import type { DeliverHookPayload, HookPayload, SessionCapabilities } from "#channel/types.js"; import type { DurableSessionState } from "#execution/durable-session-store.js"; import type { SessionCommandInbox } from "#execution/session-command-inbox.js"; import type { TurnDriverAction } from "#execution/turn-control-receiver.js"; import type { RunMode } from "#shared/run-mode.js"; /** One settled turn: its terminal driver action plus deferred hook cleanup. */ export interface DispatchedTurn { readonly action: TurnDriverAction; /** * Disposes the turn's control hook. Deferred until the *next* turn * settles (or the session ends): the turn run's final control send is * at-least-once, and `sendTurnControlStep` does not treat * `HookNotFoundError` as benign, so a late duplicate resume must land * on a live hook. By the next settle, the previous run has completed * and can no longer re-send. */ dispose(): Promise; } /** Dispatches one turn and services its private-inbox control protocol until it terminates. */ export declare function dispatchAndAwaitTurn(input: { readonly bufferedDeliveries: DeliverHookPayload[]; readonly bufferedSessionControls: Array<"clear" | "compact" | "expired" | "reset">; readonly capabilities?: SessionCapabilities; readonly controlToken: string; readonly delivery: HookPayload; readonly commandInbox: SessionCommandInbox; readonly mode: RunMode; readonly parentWritable: WritableStream; readonly serializedContext: Record; readonly sessionState: DurableSessionState; }): Promise;