import type { DeliverHookPayload, DeliverPayload } from "#channel/types.js"; import type { DurableSessionState } from "#execution/durable-session-store.js"; import type { SessionCommandInbox } from "#execution/session-command-inbox.js"; /** What the parked driver should do with the next session activity. */ export type NextTurnInstruction = { readonly kind: "clear"; } | { readonly kind: "compact"; } | { readonly kind: "expired"; } | { readonly kind: "reset"; } | { readonly kind: "closed"; } | { readonly kind: "cancel-turn"; } | { readonly kind: "turn"; readonly deliver: DeliverHookPayload; readonly remainder: DeliverPayload; }; /** * Awaits the next delivery that requires driver action while the session * is parked. Deliveries fully routed to a descendant leave the parent with * no turn to run, so this keeps waiting until a delivery produces a parent * turn, a cancellation, expiry, or hook closure. The wait is unbounded by * design: a parked session lives until something addresses it. */ export declare function nextTurnDelivery(input: { readonly bufferedDeliveries: DeliverHookPayload[]; readonly bufferedSessionControls: Array<"clear" | "compact" | "expired" | "reset">; readonly commandInbox: SessionCommandInbox; readonly driverWritable: WritableStream; readonly sessionState: DurableSessionState; }): Promise;