import { type ToolDefinition } from "@earendil-works/pi-coding-agent"; import { Type } from "typebox"; import type { WorkflowExecutor } from "./executor.js"; import { WorkflowManager } from "./workflow-manager.js"; import { type WorkflowStorage } from "./workflow-saved.js"; /** The single always-on gate that authorizes workflow use without forcing it. */ export declare const WORKFLOW_GATE_GUIDELINE = "The `workflow` tool runs multi-agent orchestration \u2014 it fans decomposable work out across subagents, and fits tasks shaped like: repo-wide inspection, independent parallel research/checks, multi-perspective review, or fan-out/fan-in synthesis. ONLY call it when the user explicitly opts in \u2014 via the workflow trigger word, `/workflows run`, or their own words (e.g. 'run a workflow', 'fan this out', '\u5E76\u884C\u5BA1\u4E00\u904D'). For any other task \u2014 even one that would clearly benefit \u2014 do not call it; you may briefly offer it (with a rough cost) as an option instead."; declare const workflowToolSchema: Type.TObject<{ script: Type.TOptional; name: Type.TOptional; args: Type.TOptional>>; background: Type.TOptional; maxAgents: Type.TOptional; concurrency: Type.TOptional; agentRetries: Type.TOptional; agentTimeoutMs: Type.TOptional; tokenBudget: Type.TOptional; resumeFromRunId: Type.TOptional; forkFromRunId: Type.TOptional; }>; export type WorkflowToolInput = { script?: string; name?: string; args?: Record; background?: boolean; maxAgents?: number; concurrency?: number; agentRetries?: number; agentTimeoutMs?: number; tokenBudget?: number; resumeFromRunId?: string; forkFromRunId?: string; }; export interface WorkflowToolOptions { cwd?: string; concurrency?: number; /** Shared manager so background runs are reachable from the `/workflows` command. */ manager?: WorkflowManager; /** Shared saved-workflow storage. */ storage?: WorkflowStorage; /** Default per-agent timeout for runs created by this tool. null means no hard timeout. */ defaultAgentTimeoutMs?: number | null; /** Default max concurrent agents when no tool-level concurrency is passed. */ defaultConcurrency?: number; /** Default retry attempts after recoverable agent failures. */ defaultAgentRetries?: number; /** Default executor for agent() calls that omit one. */ defaultExecutor?: WorkflowExecutor; } export declare function createWorkflowTool(options?: WorkflowToolOptions): ToolDefinition; /** * The tool result returned when a workflow starts in the background. It both * informs the model and tells it to reassure the user: the run continues on its * own and the conversation will resume automatically when it finishes, so the * user can just wait here (or go do something else). */ export declare function backgroundStartedText(name: string, runId: string): string; /** * One-line hint telling the model how to branch a completed run into an * immutable revision. The source run stays unchanged; the new run replays the * longest usable journal prefix before executing the remaining suffix live. */ export declare function reviseHint(runId: string | undefined): string; /** * The tool result returned when the model resumes a run with an edited script. * The resumed run is always background, so its result is delivered back later. */ export declare function resumedText(name: string, runId: string): string; export declare function forkedText(name: string, runId: string, sourceRunId: string): string; /** * Explain why a resumeFromRunId could not be resumed, so the model gets a clear * tool error instead of a silent failure. Inspects live + persisted state to * name the concrete reason (not found / running / completed / stopped). */ export declare function resumeFailureText(manager: WorkflowManager, runId: string): string; export {};