import type { OpenClawPluginApi } from "openclaw/plugin-sdk"; import { type Plan } from "@xgjktech/xg-openclaw-shared"; import type { ActionDispatchEvent } from "./action-store-access.js"; export type AgentToolResultMiddleware = Parameters[0]; export interface PlanMiddlewareDeps { /** 按 planId 反查权威状态(注入 TASK-2 的 getPlanById) */ getPlanById: (planId: string) => Plan | undefined; /** 发送 PLAN_STAT 增量事件(注入实现,便于单测假实现;本身设计为同步返回、内部自行 catch) */ sendPlanStat: (params: { plan: Plan; source: "tool" | "snapshot"; }) => void; /** 按 eventId 反查 action 的权威状态。 */ getActionById: (eventId: string) => ActionDispatchEvent | undefined; /** 推送 Action Dispatch 事件(内部 fire-and-forget)。 */ sendActionRunEvent: (action: ActionDispatchEvent) => void; } /** * 创建计划工具结果的 middleware handler。 * * 三条硬约束(RULING-1 §2 / DESIGN.md D1b,红线): * 1. 绝不抛异常:全身 try/catch,捕获后记 warn 并正常返回。 * 2. 绝不修改结果:恒返回 void,不 mutate event.result。 * 3. 不在 handler 内 await 网络 IO。 */ export declare function createPlanToolResultMiddleware(deps: PlanMiddlewareDeps): AgentToolResultMiddleware; //# sourceMappingURL=plan-tool-middleware.d.ts.map