/**
 * Forked AgentController — lightweight in-process side-agent that reuses a caller-owned
 * prompt snapshot and dedicated tool surface.
 *
 * Unlike task-style subagents, a forked agent does not create its own session
 * transcript. It runs in the same process, uses the caller's resolved prompt
 * snapshot, appends one user instruction, and is bounded by a caller-provided
 * max turn count.
 *
 * Scheduling is per kind:
 * - one active fork per kind
 * - one latest pending fork per kind
 * - different kinds may run in parallel
 *
 * Global concurrency is still capped to avoid overwhelming the LLM proxy.
 */
import type { AssistantMessage, Message, Model, ThinkingLevel, ToolCall } from '../../ai/types.js';
import type { ToolDefinition, ToolExecutionContext } from '../../core/core-types.js';
import type { ShortcutAuthRecovery } from '../providers/shortcut-auth-recovery.js';
export type { ThinkingLevel };
export interface ForkedAgentParentContext {
    /** Caller's resolved system prompt snapshot at enqueue time. */
    systemPrompt: string;
    /** Caller's resolved messages snapshot at enqueue time. */
    messages: Message[];
    /** The only tools visible and executable for this fork. */
    tools: ToolDefinition[];
    /** Model to use for this fork. */
    model: Model<any>;
    /** Shortcut LLM proxy base URL. */
    baseUrl: string;
    /** Auth token for the proxy. */
    apiKey: string;
    /** Extra headers (e.g., X-Session-Id for trace grouping). */
    getExtraHeaders?: () => Record<string, string> | undefined;
    /** Called on 401 to invalidate and refresh the auth token, then retry once. */
    recoverAuth?: ShortcutAuthRecovery;
    /** Optional tool execution context for child tool calls. */
    getToolContext?: () => ToolExecutionContext | undefined;
}
export interface ForkedAgentControllerOptions {
    /** Required scheduling key. One active fork plus one latest pending fork per kind. */
    kind: string;
    /** Optional hard limit on model round-trips for this fork. Omit for no fork-specific cap. */
    maxTurns?: number;
    /** Task instruction appended as final user message. */
    instruction: string;
    /** Optional directory for structured trace artifacts. Captured at enqueue time. */
    traceDir?: string;
    /** Abort signal — cancels the fork. */
    signal: AbortSignal;
    /** Thinking level for the fork (default: 'low'). */
    effortLevel?: ThinkingLevel;
    /** Called when the fork emits a tool call, before tool execution. */
    onToolCall?: (toolCall: ToolCall) => void;
}
export interface ForkedAgentResult {
    /** Text content of the fork's final response. */
    response: string;
    /** Tools the fork called (with results). */
    toolCalls: ToolCall[];
    /** Input tokens (near-zero if cache hit). */
    inputTokens: number;
    /** Output tokens. */
    outputTokens: number;
    /** Whether a cache hit was detected (cacheRead > 0). */
    cacheHit: boolean;
    /** Full usage from all fork LLM calls combined. */
    usage: AssistantMessage['usage'];
    /** Optional structured trace written when fork tracing is enabled. */
    traceFile?: string;
    /** Optional synthetic session transcript written beside the structured trace. */
    traceSessionFile?: string;
}
export declare const MAX_CONCURRENT_FORKS = 2;
/** Test-only: drop all scheduler state, rejecting any waiters and pending requests. */
export declare function _resetForkSchedulerForTests(): void;
/** Schedule and run a forked agent, returning its final response, tool calls, and usage. */
export declare function runForkedAgent(parentContext: ForkedAgentParentContext, options: ForkedAgentControllerOptions): Promise<ForkedAgentResult>;
//# sourceMappingURL=forked-agent.d.ts.map