/** Turn driver: wraps `agentLoop` with per-session config and reduces stream events into AgentState. */
import type { EventStream } from '../ai/event-stream.js';
import { type AssistantMessage, type Message, type ToolCall, type Transport } from '../ai/types.js';
import type { ShortcutXLLlmOperation } from '../contracts/model-stream.js';
import type { AgentMessageQueue } from './agent-message-queue.js';
import { type AgentContext, type AgentLoopConfig, type AgentLoopEvent, type AgentMessage, type AgentState, type InFlightMeta, type InFlightOpKind, type StreamFn, type ToolExecutionContext } from './core-types.js';
import { type HeartbeatClock } from './heartbeat.js';
export type HeartbeatWrapFn = <T>(promise: Promise<T>, kind: InFlightOpKind, meta?: InFlightMeta) => Promise<T>;
export interface AgentEngineOptions {
    convertToLlm?: (messages: AgentMessage[]) => Message[] | Promise<Message[]>;
    transformContext?: (messages: AgentMessage[], signal?: AbortSignal) => Promise<AgentMessage[]>;
    streamFn?: StreamFn;
    requestAssistantResponse?: (context: AgentContext, config: AgentLoopConfig, signal: AbortSignal | undefined, stream: EventStream<AgentLoopEvent, AgentMessage[]>, streamFn?: StreamFn, onToolCallReady?: (toolCall: ToolCall) => void) => Promise<AssistantMessage>;
    sessionId?: string;
    getApiKey?: (provider: string) => Promise<string | undefined> | string | undefined;
    transport?: Transport;
    maxRetryDelayMs?: number;
    getToolContext?: () => ToolExecutionContext | undefined;
    heartbeatClock?: HeartbeatClock;
    heartbeatIntervalMs?: number;
}
export interface AgentEngineRunOptions {
    state: AgentState;
    messageQueue: AgentMessageQueue;
    signal: AbortSignal;
    messages?: AgentMessage[];
    skipInitialSteeringPoll?: boolean;
    onEvent: (event: AgentLoopEvent) => void;
}
export interface AgentEngineStreamObservabilityContext {
    agentMode?: string;
    initialFileId?: string;
    fileAttachmentIds?: readonly string[];
    interactionMode?: string;
    llmOperation?: ShortcutXLLlmOperation;
}
export declare class AgentEngine {
    private _convertToLlm;
    private _transformContext?;
    private _streamFn?;
    private _requestAssistantResponse;
    private _sessionId?;
    private _getApiKey?;
    private _transport;
    private _maxRetryDelayMs?;
    private _getToolContext?;
    private _heartbeatClock?;
    private _heartbeatIntervalMs?;
    /** Active turn's heartbeat wrap; bridge / long-lived components read via getHeartbeatWrap(). */
    private _activeWrap;
    /**
     * Per-call speed mode. Set by the embedded runtime's submit() from
     * `AgentSubmitOptions.speed` and cleared after the run. Forwarded
     * through `AgentLoopConfig.speed` into `streamFn` (see core-types.ts).
     */
    private _speed;
    private _streamObservabilityContext;
    constructor(options?: AgentEngineOptions);
    /** Returns the current turn's wrap, or undefined when idle. */
    getHeartbeatWrap(): HeartbeatWrapFn | undefined;
    get streamFn(): StreamFn | undefined;
    set streamFn(value: StreamFn | undefined);
    get sessionId(): string | undefined;
    set sessionId(value: string | undefined);
    get transport(): Transport;
    set transport(value: Transport);
    get maxRetryDelayMs(): number | undefined;
    set maxRetryDelayMs(value: number | undefined);
    get speed(): 'fast' | 'standard' | undefined;
    set speed(value: 'fast' | 'standard' | undefined);
    get streamObservabilityContext(): AgentEngineStreamObservabilityContext | undefined;
    set streamObservabilityContext(value: AgentEngineStreamObservabilityContext | undefined);
    runTurn(options: AgentEngineRunOptions): Promise<void>;
}
//# sourceMappingURL=agent-engine.d.ts.map