UNPKG

@mastra/core

Version:
73 lines 2.98 kB
/** * Payload carried by the native `tool-call-suspended` event when `submit_plan` pauses. * * The tool knows the plan file `path` on disk. Hosts validate that path, read the plan * from it, and fill `title`/`plan` for approval rendering and history replay. */ export interface SubmitPlanSuspendPayload { path: string; title?: string; plan?: string; } /** * The action a host resumes a suspended `submit_plan` call with. * * `approved` means the user accepted the plan and the agent should proceed. `rejected` * means the user wants revisions; the optional `feedback` is surfaced to the model so it * can revise and submit again. * * Hosts that layer additional behavior on approval (e.g. a AgentController switching from a * planning mode to an execution mode) drive that from their own response handling; the * tool itself only reports the outcome back to the model. */ export interface SubmitPlanResumeData { action: 'approved' | 'rejected'; feedback?: string; path?: string; title?: string; plan?: string; } /** * Built-in, agent-agnostic tool: submit an implementation plan for user review. * * Pausing uses the agent-native tool suspension primitive: the tool calls * `suspend({ path })`, which makes the agent emit a `tool-call-suspended` event and * persist run state. The host validates the plan file path, reads it, renders it, * collects an approve/reject decision, and continues the run via `agent.resumeStream({ action, * feedback })`; the tool re-runs with `resumeData` set to that decision and reports it * back to the model. * * This tool is deliberately host-agnostic: it does not know about AgentController modes or any * UI. A plain Agent (e.g. embedded in Studio or a customer app) can use it directly, and * a AgentController can layer mode-switch behavior on top of the approval in its own response * handling without the tool needing to change. * * The tool takes the plan file `path` — never the plan body. The host reads the plan from * disk at that path, so more than one plan can exist over time. When executed without an * agent `suspend` (e.g. direct invocation outside an agent run), the tool returns the path * as readable text so the submission is still surfaced. */ export declare const submitPlanTool: import("..").Tool<{ path: string; }, unknown, { path: string; title?: string | undefined; plan?: string | undefined; }, { action: "rejected" | "approved"; feedback?: string | undefined; path?: string | undefined; title?: string | undefined; plan?: string | undefined; }, import("..").ToolExecutionContext<{ path: string; title?: string | undefined; plan?: string | undefined; }, { action: "rejected" | "approved"; feedback?: string | undefined; path?: string | undefined; title?: string | undefined; plan?: string | undefined; }, unknown>, "submit_plan", unknown>; //# sourceMappingURL=submit-plan.d.ts.map