import type { AgentToolResult } from "@lpb-work/pi-agent-core"; import type { ExtensionAPI, ExtensionContext } from "@lpb-work/pi-coding-agent"; import { type AgentConfig, type AgentScope } from "../../agents/agents.ts"; import { resolveSubagentResultStatus } from "../../intercom/result-intercom.ts"; import { type ChainStep } from "../../shared/settings.ts"; import { type AcceptanceInput, type AgentContract, type ControlConfig, type Details, type ExtensionConfig, type JsonSchemaObject, type MaxOutputConfig, type SingleResult, type SubagentState, type ToolBudgetConfig, type TurnBudgetConfig, type UsageBudgetConfig } from "../../shared/types.ts"; import type { MainWatchdogRuntime } from "../../watchdog/runtime.ts"; import { type SteerDeliveryMode } from "../background/control-channel.ts"; import type { ModelScopeConfig } from "../shared/model-scope.ts"; interface TaskParam { agent: string; task: string; cwd?: string; count?: number; output?: string | boolean; outputMode?: "inline" | "file-only"; reads?: string[] | boolean; progress?: boolean; model?: string; skill?: string | string[] | boolean; outputSchema?: JsonSchemaObject; acceptance?: AcceptanceInput; agentContract?: AgentContract; toolBudget?: ToolBudgetConfig; } export interface SubagentParamsLike { action?: string; id?: string; runId?: string; dir?: string; handoffPath?: string; index?: number; view?: "fleet" | "transcript"; lines?: number; chainName?: string; config?: unknown; name?: string; type?: string; agent?: string; task?: string; /** Retained async child run id. Valid only on workflow runs.run items. */ resume?: string; message?: string; steeringRecovery?: boolean; mode?: SteerDeliveryMode; workflowScript?: string; chatProgress?: "auto" | "off" | "live-card"; step?: ChainStep; /** Internal workflow ownership metadata; not part of the public schema. */ workflowParentRunId?: string; workflowKey?: string; suppressRoutineResultIntercom?: boolean; /** Internal durable-run compatibility fields. Public callers must use workflowScript. */ chain?: ChainStep[]; tasks?: TaskParam[]; concurrency?: number; worktree?: boolean; context?: "fresh" | "fork"; async?: boolean; foregroundOnly?: boolean; timeoutMs?: number; maxRuntimeMs?: number; turnBudget?: TurnBudgetConfig; /** Internal-only strict turn-boundary enforcement for versioned foreground delegation. */ enforceHardTurnLimit?: boolean; toolBudget?: ToolBudgetConfig; usageBudget?: UsageBudgetConfig; clarify?: boolean; share?: boolean; control?: ControlConfig; sessionDir?: string; cwd?: string; maxOutput?: MaxOutputConfig; artifacts?: boolean; includeProgress?: boolean; model?: string; thinking?: string | false; scope?: string; target?: string; focus?: boolean; skill?: string | string[] | boolean; output?: string | boolean; outputMode?: "inline" | "file-only"; outputSchema?: JsonSchemaObject; agentScope?: unknown; chainDir?: string; acceptance?: AcceptanceInput; gate?: string; agentContract?: AgentContract; schedule?: string; scheduleName?: string; at?: string; every?: string; on?: string | number; timezone?: string; overlap?: "skip"; catchUp?: "none" | "latest"; additional?: number; missionId?: string; mission?: unknown; missionUpdate?: unknown; missionStatus?: string; missionScope?: string; runMode?: string; runStatus?: string; summary?: string; } interface ExecutorDeps { pi: ExtensionAPI; state: SubagentState; config: ExtensionConfig; asyncByDefault: boolean; waitToolEnabled?: boolean; handleScheduledRunAction?: (params: SubagentParamsLike, ctx: ExtensionContext) => Promise>; watchdog?: MainWatchdogRuntime; tempArtifactsDir: string; getSubagentSessionRoot: (parentSessionFile: string | null) => string; expandTilde: (p: string) => string; discoverAgents: (cwd: string, scope: AgentScope) => { agents: AgentConfig[]; modelScope?: ModelScopeConfig; }; allowMutatingManagementActions?: boolean; kill?: (pid: number, signal?: NodeJS.Signals | 0) => boolean; } export declare function foregroundResultIntercomStatus(result: SingleResult): ReturnType; export declare function shouldSuppressRoutineResultIntercom(input: { suppressRoutineResultIntercom?: boolean; results: SingleResult[]; }): boolean; export declare const DEFAULT_FOREGROUND_TIMEOUT_MS: number; export declare function prepareWorkflowLaunchParams(workflowDefaults: SubagentParamsLike, childParams: Record, parentWorkflowRunId: string, workflowKey: string, options?: { missionDetached?: boolean; suppressRoutineResultIntercom?: boolean; }): SubagentParamsLike; export declare function createSubagentExecutor(deps: ExecutorDeps): { execute: (id: string, params: SubagentParamsLike, signal: AbortSignal, onUpdate: ((r: AgentToolResult
) => void) | undefined, ctx: ExtensionContext) => Promise>; /** Public/model-facing execution boundary. Internal direct launch primitives use execute or executeDelegated. */ executePublic: (id: string, params: SubagentParamsLike, signal: AbortSignal, onUpdate: ((r: AgentToolResult
) => void) | undefined, ctx: ExtensionContext) => Promise>; /** * Correlated extension-to-extension delegation owns its request IDs and * cancellation controllers, so independent requests may execute concurrently. * The ordinary model-facing tool keeps the one-foreground-call-per-turn guard. */ executeDelegated: (id: string, params: SubagentParamsLike, signal: AbortSignal, onUpdate: ((r: AgentToolResult
) => void) | undefined, ctx: ExtensionContext) => Promise>; /** Scheduled launches retain their owning context without replacing the live active session. */ executeScheduled: (id: string, params: SubagentParamsLike, signal: AbortSignal, ctx: ExtensionContext) => Promise>; }; export {}; //# sourceMappingURL=subagent-executor.d.ts.map