import type { DeferredForegroundApplicationScope } from "./deferred-foreground-boundary.js"; import type { DeferredForegroundTransfer } from "./deferred-foreground-transfer.js"; import { type ManagedSessionState } from "./managed-session.js"; import { type TerminalNativeIdentity as NativeAgentSessionIdentity } from "./terminal-binding-authority.js"; import type { DeferredForegroundBindingBoundary as DeferredCodexForegroundBindingBoundary } from "./deferred-foreground-boundary.js"; type CrashPoint = "source_session_reserved" | "source_reserved" | "target_prepared" | "source_scrubbed" | "target_accepted" | "committed" | "source_detached" | "target_bound"; interface OwnershipRequest { processPid: number; nativeThreadId: string; excludedManagedSessionId?: string; allowedManagedSessionIds?: string[]; } export interface DeferredForegroundApplicationPorts { authority: { verifyReservedSource(scope: DeferredForegroundApplicationScope, boundary: DeferredCodexForegroundBindingBoundary): Promise; assertExclusive(scope: DeferredForegroundApplicationScope, boundary: DeferredCodexForegroundBindingBoundary, request: OwnershipRequest): Promise; assertFrozenPredecessor(scope: DeferredForegroundApplicationScope, boundary: DeferredCodexForegroundBindingBoundary, transfer: DeferredForegroundTransfer): void; valuesMatch(left: unknown, right: unknown): boolean; }; clock: { now(): Date; }; runtime: { crashAt(point: CrashPoint): void; errorReceipt(reason: string): string; summary(value: string): unknown; log(level: "info" | "warn" | "error", event: string, fields: { [key: string]: unknown; }): void; }; } export interface DeferredForegroundReservation { createdSession: ManagedSessionState; rollback(scope: DeferredForegroundApplicationScope): void; } interface ReserveRequest { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; targetSession: ManagedSessionState; messageId: string; turnId: string; } interface CommitRequest { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; identity: NativeAgentSessionIdentity; acceptedAt: string; } export declare function deferredForegroundTransferRevision(transfer: DeferredForegroundTransfer): number; export declare class DeferredForegroundApplicationService { #private; constructor(ports: DeferredForegroundApplicationPorts); assertTransferAuthority(scope: DeferredForegroundApplicationScope, transfer: DeferredForegroundTransfer, boundary: DeferredCodexForegroundBindingBoundary): void; abortBeforeInput(options: { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; reason: string; terminalInputNotStartedAt?: string; }): void; finalizeAbort(scope: DeferredForegroundApplicationScope, transfer: DeferredForegroundTransfer): DeferredForegroundTransfer; reserve(request: ReserveRequest): Promise; begin(options: { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; at: string; }): DeferredForegroundTransfer; advance(options: { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; stage: "text_injected" | "enter_dispatched"; at: string; }): DeferredForegroundTransfer; reserveSubmissionRetry(options: { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; attemptId: string; mode: "exact_draft_enter" | "replacement_send"; messageId: string; preparedAt: string; textReservedAt?: string; textInjectedAt?: string; }): DeferredForegroundTransfer; advanceSubmissionRetry(options: { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; attemptId: string; messageId: string; stage: "text_reserved" | "text_injected" | "enter_reserved" | "enter_dispatched"; at: string; }): DeferredForegroundTransfer; commit(request: CommitRequest): Promise; resolve(options: { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; }): Promise; markUncertain(options: { scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; reason: string; }): DeferredForegroundTransfer; } export {};