/** * Chain execution logic for subagent tool */ import type { AgentToolResult } from "@lpb-work/pi-agent-core"; import type { ExtensionContext } from "@lpb-work/pi-coding-agent"; import type { AgentConfig } from "../../agents/agents.ts"; import { type ChainStep } from "../../shared/settings.ts"; import { type AgentContract, type ArtifactConfig, type ControlEvent, type Details, type ForegroundRunControl, type IntercomEventBus, type NestedRouteInfo, type ResolvedControlConfig, type ResolvedToolBudget, type ResolvedTurnBudget, type SingleResult, type ToolBudgetConfig, type UsageBudgetConfig } from "../../shared/types.ts"; import type { ResolvedSubagentCapabilityCeiling } from "../shared/capability-ceiling.ts"; import type { ContextMode } from "../shared/context-mode.ts"; import type { ModelScopeConfig } from "../shared/model-scope.ts"; import type { PermissionConfig } from "../shared/permissions.ts"; interface ChainExecutionParams { chain: ChainStep[]; task?: string; agents: AgentConfig[]; ctx: ExtensionContext; intercomEvents?: IntercomEventBus; signal?: AbortSignal; runId: string; cwd?: string; shareEnabled: boolean; sessionDirForIndex: (idx?: number) => string | undefined; sessionFileForIndex?: (idx?: number) => string | undefined; sessionFileForTask?: (agentName: string, idx?: number, modelOverride?: string) => string | undefined; thinkingOverrideForTask?: (agentName: string, idx?: number, modelOverride?: string) => AgentConfig["thinking"] | undefined; contextForAgent?: (agentName: string) => ContextMode; modelScope?: ModelScopeConfig; artifactsDir: string; artifactConfig: ArtifactConfig; includeProgress?: boolean; clarify?: boolean; onUpdate?: (r: AgentToolResult
) => void; onControlEvent?: (event: ControlEvent) => void; controlConfig: ResolvedControlConfig; agentContract?: AgentContract; childIntercomTarget?: (agent: string, index: number) => string | undefined; orchestratorIntercomTarget?: string; foregroundControl?: ForegroundRunControl; chainSkills?: string[]; chainDir?: string; dynamicFanoutMaxItems?: number; maxSubagentDepth: number; nestedRoute?: NestedRouteInfo; worktreeSetupHook?: string; worktreeSetupHookTimeoutMs?: number; worktreeBaseDir?: string; timeoutMs?: number; deadlineAt?: number; turnBudget?: ResolvedTurnBudget; onDetachedExit?: (index: number, result: SingleResult) => void; /** Ownership callback used when parallel siblings outlive executeChain rejection. */ onForegroundChildSettled?: () => void; toolBudget?: ResolvedToolBudget; usageBudget?: UsageBudgetConfig; configToolBudget?: ToolBudgetConfig; permissions?: PermissionConfig; /** Global cap on simultaneously-running tasks within this chain. Defaults to DEFAULT_GLOBAL_CONCURRENCY_LIMIT. */ globalConcurrencyLimit?: number; capabilityCeiling?: ResolvedSubagentCapabilityCeiling; } interface ChainExecutionResult { content: Array<{ type: "text"; text: string; }>; details: Details; isError?: boolean; /** User requested async execution via TUI - caller should dispatch to executeAsyncChain */ requestedAsync?: { chain: ChainStep[]; chainSkills: string[]; }; } /** * Execute a chain of subagent steps */ export declare function executeChain(params: ChainExecutionParams): Promise; export {}; //# sourceMappingURL=chain-execution.d.ts.map