import type { CodexOpenRootRolloutInventory } from "./agent-session-provider.js"; import { type ExecutorKind } from "./executors.js"; import { type Conversation } from "./protocol.js"; import { type HumanObservedHandoffTargetSnapshot, type ManagedSessionState, type ManagedTerminalBinding } from "./managed-session.js"; import { type TerminalControlRef } from "./terminal-control-ref.js"; import type { TerminalBridgeStatus } from "./terminal-agent-bridge.js"; import type { DeferredForegroundTransferSourceRolloutAuthority, DeferredForegroundTransferSourceTurnAuthority } from "./deferred-foreground-transfer.js"; import { candidateSourceRootAuthorityMatches, classifyTerminalBindingConflict, isCodexStatusCardEvidence, isCompleteNativeRollout, terminalNativeIdentityFence, terminalNativeIdentityMatchesFence, type ManagedBindingConflictKind, type TerminalCodexOpenRootIdentity, type TerminalNativeIdentity, type TerminalNativeIdentityFence, type TerminalNativeRolloutIdentity } from "./terminal-binding-authority.js"; export { candidateSourceRootAuthorityMatches, classifyTerminalBindingConflict as classifyManagedBindingConflict, isCodexStatusCardEvidence, isCompleteNativeRollout, terminalNativeIdentityFence as codexIdentityFence, terminalNativeIdentityMatchesFence as nativeIdentityMatchesCodexPreMaterialization }; export type { ManagedBindingConflictKind, TerminalCodexOpenRootIdentity, TerminalNativeIdentity, TerminalNativeRolloutIdentity }; export type ProcessIncarnationRelationship = "same" | "different" | "unverifiable"; export interface DeferredCodexForegroundDispatchSnapshot { status: "none" | "resolved"; fingerprint: string; } export type CodexPreMaterializationIdentity = TerminalNativeIdentityFence; export declare function assertSafeTerminalSend(agent: ExecutorKind, terminalStatus: TerminalBridgeStatus | undefined): void; export interface CodexAllowedCompanionSet { primary?: CodexPreMaterializationIdentity; additional: CodexPreMaterializationIdentity[]; } export interface CodexSendAuthorityContext { terminalId: string; terminalControl: TerminalControlRef; pid: number; workspace?: string; liveProcessUuid?: string; liveProcessBirth?: string; } export declare function terminalControlSelectorKey(control: unknown): string | undefined; export declare function terminalControlsShareIncarnation(left: unknown, right: unknown): boolean; export declare function terminalControlAliasMatches(storedTerminalId: unknown, storedControl: unknown, currentTerminalId: unknown, currentControl: unknown): boolean; export declare function selectRootTerminalProcesses(processes: readonly Process[], processTree?: readonly Pick[]): Process[]; export declare function childProcessIdsForRoot(root: Process, processes: readonly Process[]): number[]; export declare function processIncarnationRelationship({ binding, livePid, liveProcessUuid, liveProcessBirth }: { binding: ManagedTerminalBinding; livePid: number; liveProcessUuid?: string; liveProcessBirth?: string; }): ProcessIncarnationRelationship; export declare function decideManagedBindingConflict(facts: { session: ManagedSessionState; claimsTerminal: boolean; exactBinding: boolean; ownerConclusivelyInactive: boolean; processRelationship: ProcessIncarnationRelationship; liveNativeThreadId?: string; statusCardNativeThreadId?: string; managedTurnCount?: number; }): ManagedBindingConflictKind | undefined; export declare function codexCompanionsPresentInOpenRootInventory(companions: CodexAllowedCompanionSet, inventory: CodexOpenRootRolloutInventory): CodexAllowedCompanionSet; export declare function withCodexCompanionFences(runtime: Runtime, companions: CodexAllowedCompanionSet): Runtime & { allowedPreMaterializationNativeIdentity?: CodexPreMaterializationIdentity; allowedAdditionalNativeIdentities: CodexPreMaterializationIdentity[]; }; export declare function codexCompanionsExcludingPreferred(roots: CodexAllowedCompanionSet, preferredSessionId: string): CodexAllowedCompanionSet; export interface StoredTurnNativeIdentityFacts { strictNativeIdentity: boolean; agent: ExecutorKind; storedSessionId?: string; storedProcessUuid?: string; storedProcessBirth?: string; storedRollout?: { fd?: string; device?: string; inode?: string; path?: string; }; } export declare function nativeIdentityMatchesStoredTurn(facts: StoredTurnNativeIdentityFacts, currentIdentity: TerminalNativeIdentity | undefined): boolean; /** Project one stored Turn into the canonical native-identity matcher. */ export declare function nativeAgentIdentityMatchesTurn(conversation: Conversation, currentIdentity: TerminalNativeIdentity | undefined): boolean; export declare function exactBoundCodexSendSource(facts: { kind: "verified_empty" | "status_card" | "candidate"; sourceSession: ManagedSessionState; context: CodexSendAuthorityContext; inventory?: CodexOpenRootRolloutInventory; sourceRolloutAuthority?: DeferredForegroundTransferSourceRolloutAuthority; }): boolean; export declare function exactCodexCandidateInventoryForDeferredSend({ inventory, sourceSession, pid, workspace, processUuid, processBirth, sourceRolloutAuthority }: { inventory: CodexOpenRootRolloutInventory; sourceSession: ManagedSessionState; pid: number; workspace: string; processUuid: string; processBirth: string; sourceRolloutAuthority: DeferredForegroundTransferSourceRolloutAuthority; }): boolean; export declare function deferredCodexForegroundBindingToken(facts: { terminalId: string; terminalControl: TerminalControlRef; pid: number; workspace: string; processUuid: string; processBirth: string; sourceSession: ManagedSessionState; dispatchSnapshot: DeferredCodexForegroundDispatchSnapshot; candidateInventory?: CodexOpenRootRolloutInventory; sourceTurnHistory?: DeferredForegroundTransferSourceTurnAuthority[]; sourceRolloutAuthority?: DeferredForegroundTransferSourceRolloutAuthority; sourceAbandonmentFingerprint?: string; }): string; export declare function verifiedEmptyCodexHandoffToken(facts: { terminalId: string; terminalControl: TerminalControlRef; pid: number; workspace: string; processUuid: string; processBirth: string; sourceSession: ManagedSessionState; }): string; export declare function observedHandoffAuthorityToken(facts: { terminalId: string; terminalControl: TerminalControlRef; agent: ExecutorKind; pid: number; workspace: string; identity: TerminalNativeIdentity; sourceSession: ManagedSessionState; target: HumanObservedHandoffTargetSnapshot; }): string; export declare function activeTurnHandoffDecisionToken(facts: { handoffToken: string; sessionId: string; turnId: string; turnStatus: string; turnUpdatedAt: string | null; currentMessageId: string | null; ledgerGenerationId: string | null; ledgerMessageId: string | null; ledgerStatus: string | null; }): string;