import type { CodexOpenRootRolloutInventory } from "./agent-session-provider.js"; 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 Conversation } from "./protocol.js"; import type { TerminalControlRef } from "./terminal-agent-adapter.js"; import type { TerminalNativeIdentity as NativeAgentSessionIdentity } from "./terminal-binding-authority.js"; import type { DeferredCodexForegroundBindingBoundary, TerminalDispatchTerminal } from "./terminal-dispatch-composition.js"; import { type TerminalBridgeSubmissionMutation } from "./terminal-dispatch-receipt.js"; import { type CodexRolloutAcceptanceAnchor } from "./terminal-submission-acceptance.js"; export interface DeferredForegroundRecoveryAdapterPorts { native: { processIncarnation(pid: number): { processUuid: string; processBirth: string; }; inventory(input: { options: Record; pid: number; cwd?: string; }): Promise; identity(input: { options: Record; agent: "codex"; pid: number; cwd?: string; }): Promise; }; turn: { terminalControl(value: unknown): TerminalControlRef | undefined; storeDir(conversation: Conversation): string | undefined; withIdentity(conversation: Conversation, identity: NativeAgentSessionIdentity): Conversation; withSubmission(mutation: TerminalBridgeSubmissionMutation): Conversation; }; ledger: { load(control: TerminalControlRef): Record | undefined; save(control: TerminalControlRef, ledger: Record): void; matchesControl(ledger: Record | undefined, control: TerminalControlRef): boolean; bindingFields(conversation: Conversation): Record; previousSnapshotMatches(input: { transfer: DeferredForegroundTransfer; terminalControl: TerminalControlRef; ledger: Record | undefined; }): boolean; }; authority: { assertFrozen(input: { storeDir: string; transfer: DeferredForegroundTransfer; terminalControl: TerminalControlRef; }): void; assertTurnIdentity(input: { conversation: Conversation; currentIdentity: NativeAgentSessionIdentity; operation: string; }): void; }; application: { abortBeforeInput(input: { options: Record; scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; reason: string; terminalInputNotStartedAt?: string; }): void; commit(input: { options: Record; scope: DeferredForegroundApplicationScope; boundary: DeferredCodexForegroundBindingBoundary; identity: NativeAgentSessionIdentity; acceptedAt: string; }): Promise; }; } interface DeferredForegroundTurnAuthority { conversation: Conversation; statePath: string; logPath: string; takeover: Record; submission: Record; anchor: CodexRolloutAcceptanceAnchor; } export declare function deferredCodexBoundaryFromTransfer(ports: DeferredForegroundRecoveryAdapterPorts, { terminal, transfer }: { terminal: TerminalDispatchTerminal; transfer: DeferredForegroundTransfer; }): DeferredCodexForegroundBindingBoundary; export declare function loadDeferredForegroundTurnAuthority(ports: DeferredForegroundRecoveryAdapterPorts, { storeDir, terminal, transfer, scope }: { storeDir: string; terminal: TerminalDispatchTerminal; transfer: DeferredForegroundTransfer; scope?: DeferredForegroundApplicationScope; }): DeferredForegroundTurnAuthority; export declare function assertDeferredForegroundLedgerAuthority(ports: DeferredForegroundRecoveryAdapterPorts, { storeDir, terminal, transfer, ledger, statePath, expectedMessageBodyHash }: { storeDir: string; terminal: Pick; transfer: DeferredForegroundTransfer; ledger: Record; statePath: string; expectedMessageBodyHash?: string; }): void; export declare function assertDeferredForegroundResolvedZeroInputLedger(ports: DeferredForegroundRecoveryAdapterPorts, { storeDir, terminal, transfer, ledger, statePath }: { storeDir: string; terminal: Pick; transfer: DeferredForegroundTransfer; ledger: Record; statePath: string; }): void; export declare function deferredCodexDurableInputNotStartedAt(_ports: DeferredForegroundRecoveryAdapterPorts, scope: DeferredForegroundApplicationScope, transfer: DeferredForegroundTransfer): string | undefined; interface AbortPreparedDeferredTurnInput { options: Record; scope: DeferredForegroundApplicationScope; storeDir: string; terminal: TerminalDispatchTerminal; transfer: DeferredForegroundTransfer; boundary: DeferredCodexForegroundBindingBoundary; terminalInputNotStartedAt?: string; } export declare function abortPreparedDeferredForegroundTurn(ports: DeferredForegroundRecoveryAdapterPorts, input: AbortPreparedDeferredTurnInput): void; interface RecoverAcceptedDeferredDispatchInput { options: Record; scope: DeferredForegroundApplicationScope; storeDir: string; terminal: TerminalDispatchTerminal; transfer: DeferredForegroundTransfer; boundary: DeferredCodexForegroundBindingBoundary; } export declare function recoverAcceptedDeferredForegroundDispatch(ports: DeferredForegroundRecoveryAdapterPorts, input: RecoverAcceptedDeferredDispatchInput): Promise; interface PersistCommittedAcceptanceInput { options: Record; scope: DeferredForegroundApplicationScope; storeDir: string; terminal: TerminalDispatchTerminal; transfer: DeferredForegroundTransfer; } export declare function persistCommittedDeferredForegroundTurnAcceptance(ports: DeferredForegroundRecoveryAdapterPorts, input: PersistCommittedAcceptanceInput): Promise<{ conversation: Conversation; identity: NativeAgentSessionIdentity; }>; export {};