import { type ModelRegistry, type ToolDefinition } from "@earendil-works/pi-coding-agent"; import { Type } from "typebox"; import type { LoopGuardOptions } from "./loop-detector.js"; import { type ModelTierConfig } from "./model-tier-config.js"; import { WorkflowManager } from "./workflow-manager.js"; import { type WorkflowStorage } from "./workflow-saved.js"; /** * Model routing guideline for workflow authors. * Tells the LLM about opts.tier (small/medium/big) for runtime-enforced * model selection, and opts.model for an exact provider/id override. * * This string is injected into the workflow tool's promptGuidelines and * therefore appears in the LLM's system prompt for every workflow execution. */ export declare function modelRoutingGuideline(registry?: ModelRegistry, tierConfig?: ModelTierConfig | null): string; /** * Tells the LLM which named subagent definitions (agentType) are available, so * it can route an agent() to a reusable role that binds tools+model+prompt. * Returns undefined when no definitions are registered (nothing to advertise). */ export declare function agentTypeGuideline(cwd?: string): string | undefined; declare const workflowToolSchema: Type.TObject<{ script: Type.TString; args: Type.TOptional; background: Type.TOptional; maxAgents: Type.TOptional; concurrency: Type.TOptional; agentRetries: Type.TOptional; agentTimeoutMs: Type.TOptional; workflowTimeoutMs: Type.TOptional; loopGuard: Type.TOptional; maxRepeats: Type.TOptional; maxConsecutive: Type.TOptional; action: Type.TOptional, Type.TLiteral<"abort">]>>; }>>; tokenBudget: Type.TOptional; agentMaxContextTokens: Type.TOptional>; agentContextReserveTokens: Type.TOptional>; compactionPolicy: Type.TOptional, Type.TLiteral<"default">, Type.TLiteral<"aggressive-local">, Type.TLiteral<"cache-preserving">, Type.TLiteral<"off">, Type.TNull]>>; }>; export type WorkflowToolInput = { script: string; args?: unknown; background?: boolean; maxAgents?: number; concurrency?: number; agentRetries?: number; agentTimeoutMs?: number; workflowTimeoutMs?: number; loopGuard?: LoopGuardOptions; tokenBudget?: number; agentMaxContextTokens?: number | null; agentContextReserveTokens?: number | null; compactionPolicy?: "auto" | "default" | "aggressive-local" | "cache-preserving" | "off" | null; }; 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 hard wall-clock timeout for runs created by this tool, in ms. null * disables the run-wide timeout explicitly; undefined lets the runtime * constant apply. Overrides the settings-derived default when provided. */ defaultWorkflowTimeoutMs?: 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 hard per-agent provider input/context token cap. */ defaultAgentMaxContextTokens?: number | null; /** Default reserve subtracted from model context windows for occupancy. */ defaultAgentContextReserveTokens?: number | null; } export declare function createWorkflowTool(options?: WorkflowToolOptions): ToolDefinition; export declare function resolveWorkflowToolDefaults(options: WorkflowToolOptions, cwd: string): { agentTimeoutMs: number | null; workflowTimeoutMs: number | null | undefined; concurrency?: number; agentRetries: number; agentMaxContextTokens: number | null; agentContextReserveTokens: number | null; }; /** * 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, transcriptDir?: string): string; export {};