import type { PortableTool } from "../portable-tool.js";
export declare const AGENT_TOOL_NAME: "agent";
/**
 * Built-in agent types (CC-aligned registry).
 * The LLM selects which agent to fork based on the task.
 */
export type BuiltInAgentType = "general" | "explore" | "plan" | "code" | "research" | "verify";
export declare const BUILT_IN_AGENT_TYPES: BuiltInAgentType[];
export interface AgentToolParams {
    /** Built-in agent type to invoke. */
    agent: BuiltInAgentType;
    /** Detailed task prompt for the sub-agent. */
    prompt: string;
    /** Short description of the task (3-7 words). Used for status display. */
    description?: string;
    /** Max turns override (default varies by agent type). */
    maxTurns?: number;
    /** Run in background (returns task_id immediately). */
    background?: boolean;
    /** Inherit a trimmed prefix of the parent conversation (default false). */
    inheritContext?: boolean;
}
export declare const AGENT_TOOL_SCHEMA: {
    readonly type: "object";
    readonly properties: {
        readonly agent: {
            readonly type: "string";
            readonly enum: readonly ["general", "explore", "plan", "code", "research", "verify"];
            readonly description: string;
        };
        readonly prompt: {
            readonly type: "string";
            readonly description: string;
        };
        readonly description: {
            readonly type: "string";
            readonly description: "Short description (3-7 words) for status tracking.";
        };
        readonly maxTurns: {
            readonly type: "number";
            readonly description: "Max turns for the sub-agent. Defaults: general=200, explore=50, plan=80, code=200, research=30, verify=40.";
        };
        readonly background: {
            readonly type: "boolean";
            readonly description: string;
        };
        readonly inheritContext: {
            readonly type: "boolean";
            readonly description: string;
        };
    };
    readonly required: readonly ["agent", "prompt"];
    readonly additionalProperties: false;
};
export interface AgentResult {
    /** Foreground: synthetic fork id. Background: real TaskStore task id (poll via task tool). */
    agentId: string;
    status: "completed" | "running" | "failed";
    output?: string;
    error?: string;
    maxTurnsReached?: boolean;
    tokensUsed?: number;
}
/**
 * Host-provided fork execution backend.
 *
 * Actual behavior (not aspirational):
 * - The child starts FRESH by default: it receives only the `prompt` as a single
 *   user message. With inheritContext=true (foreground only), the host prepends a
 *   trimmed, budget-capped slice of the parent conversation (no system prompt,
 *   media/tool plumbing stripped) — best-effort cache reuse, NOT byte-identical.
 * - Child inherits the parent's tool pool, filtered by the agent definition.
 * - Fork depth is tracked via AsyncLocalStorage; spawns past MAX_FORK_DEPTH are rejected.
 * - Output is returned via in-memory streaming (not DB).
 */
export interface AgentToolDeps {
    /**
     * Fork and run a sub-agent.
     * The implementation must:
     * - Pass `prompt` as the child's task; if inheritContext, prepend the parent
     *   conversation slice (foreground only — background always starts fresh)
     * - Inherit parent's tool pool (filtered by agent definition)
     * - Track fork depth (reject if >= MAX_FORK_DEPTH)
     * - Return output via in-memory streaming backflow
     */
    forkAgent(params: {
        agent: BuiltInAgentType;
        prompt: string;
        description?: string;
        maxTurns?: number;
        background?: boolean;
        inheritContext?: boolean;
        abortSignal?: AbortSignal;
    }): Promise<AgentResult>;
    /** Abort signal from the parent turn. */
    abortSignal?: AbortSignal;
    /** Current fork depth (0 = root). Used for depth guard. */
    currentForkDepth?: number;
}
/** Maximum fork depth for in-memory agents. */
export declare const MAX_FORK_DEPTH = 4;
export declare function createAgentTool(deps: AgentToolDeps): PortableTool<AgentToolParams>;
