import type { HookRegistry } from "../../contracts/hooks.js";
import type { ChatMessage as WireChatMessage, ToolDefinition as WireToolDefinition, WireTokenUsage } from "../../protocol/wire/index.js";
export type ChatMessage = WireChatMessage;
export type TokenUsage = WireTokenUsage;
export interface ToolDefinition extends WireToolDefinition {
    backfillObservableInput?: (input: Record<string, unknown>) => void;
}
export type TurnEvent = {
    type: "start";
    turnId: string;
} | {
    type: "delta";
    turnId: string;
    text: string;
} | {
    type: "tool_call";
    turnId: string;
    callId: string;
    name: string;
    arguments: string;
    inputSummary?: string;
} | {
    type: "end";
    turnId: string;
    content: string;
    usage?: TokenUsage;
    model?: string;
    provider?: string;
} | {
    type: "error";
    turnId: string;
    error: string;
    code?: string;
    usage?: TokenUsage;
} | {
    type: "skill_instruction";
    turnId: string;
    instruction: unknown;
} | {
    type: "tool_result";
    turnId: string;
    callId: string;
    name: string;
    ok: boolean;
    error?: string;
    outputPreview?: string;
    durationMs?: number;
    exitCode?: number;
    stdout?: string;
    stderr?: string;
    details?: Record<string, unknown>;
} | {
    type: "tool_blocked";
    turnId: string;
    callId: string;
    name: string;
    reason: string;
} | {
    type: "recovery";
    turnId: string;
    action: string;
    detail?: string;
} | {
    type: "plan_update";
    turnId: string;
    slug: string;
    content: string;
} | {
    type: "heartbeat";
    turnId: string;
    message: string;
} | {
    type: "tool_use_summary";
    turnId: string;
    summary: string;
} | {
    type: "reasoning_delta";
    turnId: string;
    text: string;
} | {
    type: "suggestions";
    turnId: string;
    items: Array<{
        text: string;
        icon?: string;
        action?: string;
    }>;
} | {
    type: "media_result";
    turnId: string;
    mediaType: "image" | "tts" | "video" | "music" | "3d";
    url: string;
    model?: string;
    provider?: string;
    durationSeconds?: number;
    width?: number;
    height?: number;
    mimeType?: string;
    billingUnit?: string;
    billingQuantity?: number;
    taskId?: string;
} | {
    type: "artifact";
    turnId: string;
    artifactId: string;
    artifactType: "code" | "file" | "image" | "document" | "diagram" | "table";
    title: string;
    filePath?: string;
    language?: string;
    content?: string;
    mimeType?: string;
} | {
    type: "annotations";
    turnId: string;
    annotations: Array<{
        type: string;
        url?: string;
        title?: string;
        [key: string]: unknown;
    }>;
} | {
    type: "subagent_started";
    turnId: string;
    subagentId: string;
    agentType: string;
    prompt?: string;
} | {
    type: "subagent_ended";
    turnId: string;
    subagentId: string;
    agentType: string;
    ok: boolean;
    outputPreview?: string;
    error?: string;
};
export interface ToolInvoker {
    invoke(turnId: string, name: string, args: string, signal?: AbortSignal): Promise<{
        result: string;
        error?: string;
        toolReferences?: string[];
        imageUrls?: string[];
        details?: Record<string, unknown>;
    }>;
}
export interface AgentRunRequest {
    turnId: string;
    sessionId: string;
    messages: ChatMessage[];
    tools: ToolDefinition[];
    systemPrompt?: string;
    config?: {
        model?: string;
        apiKey?: string;
        temperature?: number;
        maxOutputTokens?: number;
        parentDepth?: number;
    };
}
export interface ForkedAgentRunner {
    run(request: AgentRunRequest, signal?: AbortSignal): AsyncIterable<TurnEvent>;
}
export interface ForkedAgentRunnerFactory {
    (params: {
        transport: unknown;
        apiKey: string;
        toolInvoker: ToolInvoker;
        log: AgentLogger;
        hooks?: HookRegistry;
        maxRounds?: number;
    }): ForkedAgentRunner;
}
export interface AgentLogger {
    info(message: string): void;
    info(obj: Record<string, unknown>, message: string): void;
    warn(message: string): void;
    warn(obj: Record<string, unknown>, message: string): void;
    error(message: string): void;
    error(obj: Record<string, unknown>, message: string): void;
    debug(message: string): void;
    debug(obj: Record<string, unknown>, message: string): void;
}
export type { HookRegistry };
