import type { ModelMessage } from 'ai';
import type { RunResult } from './agent';
import type { ApprovalRequest } from './hooks';
import type { ApprovalDecision } from './state';
import type { TokenUsageEvent } from './token-usage';
type AgentEventMeta = {
    agentId?: string;
    parentToolCallId?: string;
};
export type AgentEvent = ({
    type: 'message';
    message: ModelMessage;
} & AgentEventMeta) | ({
    type: 'approvalRequested';
    approval: ApprovalRequest;
    toolCallId: string;
    toolName: string;
    input: Record<string, unknown>;
} & AgentEventMeta) | ({
    type: 'tokenUsage';
    usage: TokenUsageEvent;
} & AgentEventMeta) | ({
    type: 'stepStart';
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'textStart';
    id: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'textDelta';
    id: string;
    text: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'textEnd';
    id: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'toolInputStart';
    id: string;
    toolName: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'toolInputDelta';
    id: string;
    delta: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'toolInputEnd';
    id: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'reasoningDelta';
    id: string;
    text: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'reasoningStart';
    id: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'reasoningEnd';
    id: string;
    stepIndex: number;
} & AgentEventMeta) | ({
    type: 'stepFinish';
    stepIndex: number;
    finishReason?: string;
} & AgentEventMeta);
export declare class AgentRun implements AsyncIterable<AgentEvent> {
    private state;
    private promise;
    private resolve;
    private events;
    private iteratorResolve;
    private done;
    private _running;
    /** Whether this run should surface live model streaming events. */
    stream: boolean;
    /** Optional callback fired on every pushEvent — used by executeLoop to process forwarded child events. */
    onEvent?: (event: AgentEvent) => void;
    /** Per-approval promise resolvers, keyed by toolCallId. Populated by the ask branch in executeLoop. */
    readonly pendingResolvers: Map<string, (decision: ApprovalDecision) => void>;
    /** Currently-running child AgentRuns (transient, never serialized). */
    readonly activeChildren: Set<AgentRun>;
    get running(): boolean;
    get result(): Promise<RunResult>;
    /**
     * Inject an approval decision into a live run.
     *
     * Checks own `pendingResolvers` first, then delegates recursively to `activeChildren`.
     * Returns `true` if the decision was delivered, `false` if no matching resolver was found
     * (caller should fall back to the cold path: `withApprovals()` + `agent.run()`).
     */
    resolveApproval(toolCallId: string, decision: 'approve' | 'deny', reason?: string): boolean;
    push(msg: ModelMessage): void;
    pushEvent(event: AgentEvent): void;
    finish(value: RunResult): void;
    [Symbol.asyncIterator](): AsyncGenerator<AgentEvent>;
}
export {};
//# sourceMappingURL=agent-run.d.ts.map