/** * Worker-owned attribution for Codex App's serial runner queue. * * The runner can echo a stable clientUserMessageId, but it must never choose * the daemon delivery attempt. A worker may also finish writing turn N+1 * before turn N's final transaction arrives, so the mutable "current turn" * globals are not an attribution boundary. Reserve one immutable entry per * control-line write and settle final transactions strictly from the head. */ export interface CodexAppTurnDispatchReservation { handle: number; dispatchId?: string; turnId: string; replyTurnId?: string; dispatchAttempt?: number; recovered?: boolean; /** Frozen steer authorization COPIED from the daemon-admitted head (R4-B4). * A `steer_superseded` settlement is only legitimate for a steerable head; the * worker checks this on the settled reservation before forwarding. */ codexAppSteerable?: true; } export type CodexAppTurnDispatchSettlement = { ok: true; handle: number; dispatchId?: string; turnId: string; replyTurnId?: string; dispatchAttempt?: number; nativeTurnId?: string; codexAppSteerable?: true; remaining: number; } | { ok: false; reason: 'no_pending_turn' | 'turn_mismatch' | 'dispatch_attempt_mismatch'; markerTurnId?: string; expectedTurnId?: string; markerDispatchAttempt?: unknown; expectedDispatchAttempt?: number; }; export declare class CodexAppTurnDispatchQueue { private readonly queue; private nextHandle; reserve(turnId: string, dispatchAttempt?: number, dispatchId?: string, recovered?: boolean, replyTurnId?: string, codexAppSteerable?: true): CodexAppTurnDispatchReservation; /** * A replacement worker cannot recover the old in-memory queue. It may * recover exactly the daemon-frozen active identity supplied in `init`, and * only while no locally submitted entry exists. A runner marker still has * to assert equality before this entry can settle. */ recoverWarmReattach(turnId: string | undefined, dispatchAttempt?: number, dispatchId?: string, replyTurnId?: string): CodexAppTurnDispatchReservation | undefined; restore(entries: ReadonlyArray<{ dispatchId: string; turnId: string; dispatchAttempt?: number; replyTurnId?: string; codexAppSteerable?: true; }>): void; recoveredPrefix(): CodexAppTurnDispatchReservation[]; /** Remove the exact write that threw or reported submitted=false. */ cancelExact(handle: number): boolean; markRecovered(handle: number): boolean; findExact(turnId: string, dispatchAttempt?: number): CodexAppTurnDispatchReservation | undefined; /** * Validate and consume one complete final transaction. The head remains in * place on every rejection, so a stale/mismatched marker cannot steal the * next turn or advance the FIFO. */ settleFinal(payload: { turnId?: unknown; nativeTurnId?: unknown; dispatchAttempt?: unknown; }, consume?: boolean): CodexAppTurnDispatchSettlement; commitExactHead(handle: number): boolean; size(): number; clear(): void; } //# sourceMappingURL=codex-app-turn-dispatch.d.ts.map