import type { Provider, ThinkingLevel } from "@kenkaiiii/gg-ai"; import { AgentSession } from "../core/agent-session.js"; /** * One bounded, tool-free chance to turn the durable transcript into a useful * result. Effort is capped: at max effort a model can still be thinking when * the 60 seconds run out, and the whole run then comes back with nothing. */ export declare function recoverTimedOutTurn(activeSession: Pick, currentOutput: () => string, setController: (controller: AbortController) => void): Promise; export type AbortReason = "timeout" | "interrupt" | "shutdown" | "stdin_closed"; /** * A turn's time limit. The spawner may shorten the default (the independent * reviewer does) but never extend it; anything unusable falls back to it. */ export declare function resolveTurnTimeLimit(requested: unknown): number; export interface TurnOutcome { status: "completed" | "interrupted" | "failed"; error?: string; recovered_after_timeout?: true; } /** * Settle a turn whose prompt resolved instead of throwing. A timeout or an * interrupt explains the stop better than whatever the loop reported on its * way out, so they win; after that, `loopError` (the error the loop stopped * on — see promptSubAgent) must still fail a turn that otherwise looks done. */ export declare function classifyResolvedTurn(turn: { aborted: boolean; abortReason: AbortReason | undefined; recoveredAfterTimeout: boolean; loopError: string | undefined; /** The limit the turn ran under, for the timeout message. Defaults to SUB_AGENT_TIMEOUT_MS. */ timeLimitMs?: number; }): TurnOutcome; /** * Add the parent's shared roots to a child's workspace (see * SubagentWorkerInitialize.additionalRoots). A root that's gone or already * covered is skipped, never fatal: the child still has its own folder. * Returns the roots added. */ export declare function addSharedRoots(session: Pick, roots: readonly string[]): Promise; /** Absolute folder paths from a parent frame; anything else is dropped. */ export declare function parseRootList(value: unknown): string[]; export interface SubagentWorkerInitialize { provider: Provider; model: string; fallbackModel?: string; cwd: string; /** * More folders the child may read and change besides its cwd (the * parent's shared workspace roots, see SubAgentManager.shareWorkspaceRoots). */ additionalRoots?: string[]; baseUrl?: string; /** Replaces the whole system prompt. */ systemPrompt?: string; /** Agent body composed with the standard prompt scaffolding — the delegation path. */ agentPrompt?: string; /** Whether the composed prompt includes project instruction files. */ agentContext?: "project" | "none"; thinkingLevel?: ThinkingLevel; /** Original selection before a pinned child model's ceiling was applied. */ parentThinkingLevel?: ThinkingLevel; allowedTools?: string[]; /** MCP servers this agent may connect, derived from its `tools:` frontmatter. */ allowedMcpServers?: string[]; promptCacheKey?: string; sessionRootDir: string; childSessionPath?: string; /** * Per-turn time limit, shorter than SUB_AGENT_TIMEOUT_MS. Reaching it ends * the turn the same way the default limit does: one tool-free recovery turn * that answers from what the child has gathered. */ turnTimeoutMs?: number; } export declare function runSubagentWorkerMode(): Promise;