import type { CodexOpenRootRolloutInventory } from "./agent-session-provider.js"; import type { DeferredForegroundApplicationScope, DeferredForegroundBindingBoundary, DeferredForegroundDispatchSnapshot, DeferredForegroundTerminalFacts } from "./deferred-foreground-boundary.js"; import { type DeferredForegroundTransfer, type DeferredForegroundTransferSourceKind, type DeferredForegroundTransferSourceRolloutAuthority, type DeferredForegroundTransferSourceTurnAuthority } from "./deferred-foreground-transfer.js"; import { type ManagedSessionState } from "./managed-session.js"; import type { CodexCandidateSetRolloutAcceptanceAnchor } from "./terminal-submission-acceptance.js"; export interface DeferredForegroundFreshAuthority { sourceKind: DeferredForegroundTransferSourceKind; sourceRolloutAuthority: DeferredForegroundTransferSourceRolloutAuthority; sourceTurnHistory?: DeferredForegroundTransferSourceTurnAuthority[]; dispatchSnapshot?: DeferredForegroundDispatchSnapshot; sourceAbandonmentFingerprint?: string; exactSource: boolean; } export interface DeferredForegroundPreparationRequest { scope: DeferredForegroundApplicationScope; terminal: DeferredForegroundTerminalFacts; sourceSession?: ManagedSessionState; nativeIdentityVerifiedAbsent: boolean; candidateInventory?: CodexOpenRootRolloutInventory; requestText: string; expectedTerminalToken?: string; allowImplicitFreshAuthority: boolean; } export interface DeferredForegroundPreparationPorts { authority: { processIncarnation(pid: number): { processUuid: string; processBirth: string; }; observeFresh(input: { sourceSession: ManagedSessionState; candidateInventory?: CodexOpenRootRolloutInventory; liveIncarnation: { processUuid: string; processBirth: string; }; }): DeferredForegroundFreshAuthority | undefined; revalidate(scope: DeferredForegroundApplicationScope, boundary: DeferredForegroundBindingBoundary): Promise; assertExclusive(scope: DeferredForegroundApplicationScope, boundary: DeferredForegroundBindingBoundary, nativeThreadId: string, excludedManagedSessionId?: string): Promise; candidateInventoryUnclaimed(input: { sourceSession: ManagedSessionState; inventory: CodexOpenRootRolloutInventory; includeDetached: boolean; }): boolean; abandonmentStillFresh(input: { sourceSession: ManagedSessionState; sourceTurnHistory?: DeferredForegroundTransferSourceTurnAuthority[]; sourceAbandonmentFingerprint?: string; dispatchSnapshot: DeferredForegroundDispatchSnapshot; }): boolean; transferMatchesTerminal(transfer: DeferredForegroundTransfer): boolean; }; identity: { targetSessionId(): string; transferId(): string; captureCandidateAnchor(inventory: CodexOpenRootRolloutInventory, now: Date): CodexCandidateSetRolloutAcceptanceAnchor; bindingToken(input: { sourceSession: ManagedSessionState; authority: DeferredForegroundFreshAuthority; candidateInventory?: CodexOpenRootRolloutInventory; }): string; requestHash(requestText: string): string; }; runtime: { now(): Date; pid(): number; log(level: "info" | "warn" | "error", event: string, fields: { [key: string]: unknown; }): void; }; } export declare function prepareDeferredForegroundBinding(request: DeferredForegroundPreparationRequest, ports: DeferredForegroundPreparationPorts): Promise;