/**
 * Nested subagent runner used by the `task` contract.
 * Constructs a child `AgentController` in-process with isolated message history,
 * caller-signal + timeout abort, and contained errors.
 */
import type { Api, Model } from '../../../ai/types.js';
import type { AgentLoopEvent, StreamFn, ThinkingLevel, ToolDefinition } from '../../../core/core-types.js';
import type { AgentDefinition } from './agent-definition.js';
export interface RunSubagentOptions {
    readonly definition: AgentDefinition;
    /**
     * Resolved system prompt for the child. The contract resolves any
     * prompt builders before calling the runner so the runner stays
     * platform-agnostic. Optional — when omitted the runner falls back to
     * `definition.systemPrompt` if it is a static string. Function-form
     * prompts must be resolved before reaching the runner.
     */
    readonly systemPrompt?: string;
    /** Prompt the parent LLM wants the subagent to run. */
    readonly query: string;
    /** Resolved tools the child may call. */
    readonly childTools: readonly ToolDefinition[];
    readonly streamFn: StreamFn;
    readonly model: Model<Api>;
    /** Effective thinking level for this run. Defaults to the subagent definition. */
    readonly thinkingLevel?: ThinkingLevel;
    /** Active per-turn speed inherited from the parent run. */
    readonly speed?: 'fast' | 'standard';
    /**
     * Resolve an API key for a provider. Required for auth-gated providers
     * (e.g. shortcut proxy) — without it the stream rejects with 401.
     */
    readonly getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;
    /** Composed with `definition.timeoutSeconds` — either aborts the child. */
    readonly signal: AbortSignal;
    /**
     * Optional verbatim sink for child `AgentLoopEvent`s. The `task` contract
     * stamps toolCallId on the way out — the runner stays naming-agnostic.
     */
    readonly onChildAgentEvent?: (event: AgentLoopEvent) => void;
}
export interface SubagentRunResult {
    /** The child's final assistant-message text. Present on success. */
    readonly finalContent?: string;
    /** Structured error message. Present on failure or timeout. */
    readonly error?: string;
    /** True when the caller cancelled the child (vs. child failing on its own). */
    readonly cancelled?: boolean;
}
export declare function runSubagent(options: RunSubagentOptions): Promise<SubagentRunResult>;
//# sourceMappingURL=run-subagent.d.ts.map