import { type ExtensionContext, type ToolDefinition } from "@earendil-works/pi-coding-agent"; import { type SubagentToolResult } from "./progress.js"; import type { SubagentProfile, SubagentTelemetry, SubagentUsage } from "../types.js"; /** * The delegation tools a spawned child must never receive, so subagents cannot * recursively fan out. Owned by the spawn core and used as the default exclude * list so no caller can accidentally under-specify the nesting block. */ export declare const CHILD_EXCLUDED_TOOLS: readonly string[]; export declare function incrementalPiUsage(current: SubagentUsage, baseline: SubagentUsage): SubagentUsage; /** * Parameters for a single subagent run. This is the shared spawn primitive used * by both the `run_agent` tool and the `run_workflow` tool's `run_agent()` global. * Concurrency accounting lives in the callers, not here; callers acquire a slot * before invoking spawnSubagent, so the runtime timeout below excludes queue time. */ export interface SpawnSubagentParams { label: string; prompt: string; profile: SubagentProfile; model?: NonNullable; thinkingLevel: string | undefined; ctx: ExtensionContext; signal: AbortSignal | undefined; /** Maximum wall-clock runtime once this spawn starts. Set 0 to disable. */ timeoutMs: number; progressEnabled: boolean; onProgress: ((result: SubagentToolResult) => void) | undefined; onUsage: (usage: SubagentUsage, telemetry: SubagentTelemetry) => void; /** Tools (and the extensions that provide them) to keep out of the child session. Defaults to {@link CHILD_EXCLUDED_TOOLS}. */ excludeTools?: readonly string[]; appendInstructions?: string; customTools?: ToolDefinition[]; /** Backend session/thread id resolved from a caller-facing session_key. */ sessionId?: string; persistSession?: boolean; /** JSON schema for CLI backends that can validate final text output natively. */ outputSchema?: unknown; } export declare function spawnSubagent(params: SpawnSubagentParams): Promise;