import { type ManagedSessionState, type ManagedTerminalBinding, type NativeThreadCandidate, type NativeThreadTransition } from "./managed-session.js"; import type { TerminalThreadLifecycleCandidateToken } from "./terminal-agent-adapter.js"; import { type TerminalControlEvidence, type TerminalControlRef } from "./terminal-control-ref.js"; export declare const NATIVE_THREAD_RESUME_SNAPSHOT_TTL_MS: number; export declare const NATIVE_THREAD_RESUME_SNAPSHOT_SCHEMA = "agent-knock-knock/native-thread-resume-snapshot"; export declare const NATIVE_THREAD_RESUME_SNAPSHOT_VERSION = 2; export declare const LEGACY_NATIVE_THREAD_RESUME_SNAPSHOT_VERSION = 1; export interface NativeThreadResumeSnapshotRow { selection_number: number; short_id: string; selection_handle: string; native_thread_id: string; candidate_token?: string; resumable: boolean; unavailable_reason?: string; } export interface NativeThreadResumeSnapshot { schema: typeof NATIVE_THREAD_RESUME_SNAPSHOT_SCHEMA; version: typeof LEGACY_NATIVE_THREAD_RESUME_SNAPSHOT_VERSION | typeof NATIVE_THREAD_RESUME_SNAPSHOT_VERSION; snapshot_id: string; store_key: string; selection_scope: string; created_at: string; expires_at: string; terminal_id: string; agent: string; workspace: string; terminal_control: { target: string; socket_path?: string; pane_pid?: number; kind?: "tmux" | "herdr"; session?: string; session_dir?: string; workspace_id?: string; tab_id?: string; pane_id?: string; terminal_id?: string; }; terminal_endpoint?: TerminalControlEvidence; current_session_id?: string; current_native_thread_id?: string; expected_binding_token: string; terminal_action_fingerprint: string; candidate_snapshot_fingerprint: string; rows: NativeThreadResumeSnapshotRow[]; } export interface ResumeSnapshotTerminalObservation { conversationId: string; agent: string; terminalControl: TerminalControlRef; } export declare function encodeThreadCandidateToken(token: TerminalThreadLifecycleCandidateToken): string; export declare function decodeThreadCandidateToken(value: string): TerminalThreadLifecycleCandidateToken; export declare function assertResumeSnapshotMatchesTerminal(snapshot: NativeThreadResumeSnapshot, terminal: ResumeSnapshotTerminalObservation, cwd: () => string): void; export declare function assertResumeSnapshotActionFingerprint(snapshot: NativeThreadResumeSnapshot, ledger: unknown): void; export declare function assertResumeSnapshotCandidates(snapshot: NativeThreadResumeSnapshot, candidates: readonly NativeThreadCandidate[]): void; export declare function assertResumeSnapshotNotExpired(snapshot: NativeThreadResumeSnapshot, clock: () => number): void; export declare function sortNativeThreadCandidates(candidates: readonly NativeThreadCandidate[]): NativeThreadCandidate[]; export declare function collisionSafeNativeThreadShortIds(nativeThreadIds: readonly string[]): Map; export declare function canonicalNativeThreadResumeSnapshotRows(snapshotId: string, candidates: readonly NativeThreadCandidate[]): NativeThreadResumeSnapshotRow[]; export declare function nativeThreadResumeSnapshotRowsMatchCandidates(snapshot: NativeThreadResumeSnapshot, candidates: readonly NativeThreadCandidate[]): boolean; export declare function nativeThreadCandidateSnapshotFingerprint(candidates: readonly NativeThreadCandidate[]): string; export declare function terminalActionFingerprint(value: unknown): string; export declare function verifiedPreviousResumeCandidate({ terminalId, agent, workspace, currentSession, transition, candidates }: { terminalId: string; agent: string; workspace: string; currentSession?: ManagedSessionState; transition?: NativeThreadTransition; candidates: readonly NativeThreadCandidate[]; }): NativeThreadCandidate | undefined; export declare function lifecycleAfterBindingMatchesCurrent(after: ManagedTerminalBinding, current: ManagedTerminalBinding): boolean;