import { type TerminalWatch } from "./terminal-watch-record.js"; export { TERMINAL_WATCH_INTERACTION_POLICIES, TERMINAL_WATCH_SCHEMA, TERMINAL_WATCH_VERSION, TERMINAL_WATCHES_DIRECTORY, createClaudeUserExplicitFallbackWatchAnchor, createCodexUserExplicitFallbackWatchAnchor, createTerminalActivityWatchAnchor, initialTerminalWatchInteractionPolicy, initialTerminalWatchObservationCheckpoint, isTerminalActivityWatch, isUserExplicitFallbackWatch, terminalUserExplicitFallbackWatchId, terminalWatchCallbackEnvelope, terminalWatchCallbackMessage, terminalWatchIdentityFingerprint, terminalWatchNotificationCallbackSnapshot, terminalWatchNotificationId, terminalWatchNotificationIdempotencyKey, terminalWatchNotificationOnlyRoute, terminalWatchRevision, type ClaudeUserExplicitFallbackWatchAnchor, type ClaudeUserExplicitFallbackWatchObservationCheckpoint, type CodexTerminalWatchObservationCheckpoint, type CodexUserExplicitFallbackWatchAcceptedIdentity, type CodexUserExplicitFallbackWatchAnchor, type CodexUserExplicitFallbackWatchObservationCheckpoint, type TerminalActivityState, type TerminalActivityWatchAnchor, type TerminalActivityWatchObservationCheckpoint, type TerminalWatch, type TerminalWatchAnchor, type TerminalWatchCallbackEvent, type TerminalWatchCallbackMessageInput, type TerminalWatchCurrentInteraction, type TerminalWatchInteractionPolicy, type TerminalWatchManualInteractionOption, type TerminalWatchManualInteractionResponseKind, type TerminalWatchManualInteractionSummary, type TerminalWatchNotification, type TerminalWatchNotificationCallbackSnapshot, type TerminalWatchNotificationKind, type TerminalWatchNotificationStatus, type TerminalWatchObservationCheckpoint, type TerminalWatchSettlement, type TerminalWatchStatus, type TerminalWatchTerminalIdentity, type TerminalWatchTerminalStatus, type UserExplicitFallbackWatchAnchor } from "./terminal-watch-record.js"; export { assertTerminalWatch, assertTerminalWatchCurrentInteraction, assertTerminalWatchManualInteractionSummary, assertTerminalWatchObservationCheckpoint } from "./terminal-watch-codec.js"; export interface TerminalWatchSaveOptions { /** `null` creates; a positive revision performs an exact CAS update. */ expectedRevision: number | null; } export interface TerminalWatchPaths { root: string; statePath: string; lockPath: string; } export interface TerminalWatchFileLockPort { acquire(lockPath: string): () => void; } export interface TerminalWatchStore { list(): TerminalWatch[]; scanForReconciliation(): TerminalWatchReconciliationScan; load(watchId: string): TerminalWatch; save(watch: TerminalWatch, options: TerminalWatchSaveOptions): TerminalWatch; withWatchLock(watchId: string, operation: () => Result): Result; /** * Hold the canonical Store writer lease while a caller inserts an * interaction-authority lock before acquiring the per-Watch state lock. * The scope is synchronous and becomes invalid when this callback returns. */ withWriterLease(operation: (scope: TerminalWatchWriterScope) => Result): Result; } export interface TerminalWatchWriterScope { list(): TerminalWatch[]; load(watchId: string): TerminalWatch; save(watch: TerminalWatch, options: TerminalWatchSaveOptions): TerminalWatch; withWatchLock(watchId: string, operation: () => Result): Result; } export interface TerminalWatchReconciliationScanError { watch_id: string; error_code: "terminal_watch_record_invalid"; } export interface TerminalWatchReconciliationScan { watches: TerminalWatch[]; errors: TerminalWatchReconciliationScanError[]; } export declare class TerminalWatchConflictError extends Error { readonly code = "AKK_TERMINAL_WATCH_CONFLICT"; readonly watchId: string; readonly expectedRevision: number | null; readonly actualRevision: number | null; constructor(watchId: string, expectedRevision: number | null, actualRevision: number | null, detail?: string); } export declare function terminalWatchesDir(storeDir: string): string; export declare function pathsForTerminalWatch(watchId: string, storeDir: string): TerminalWatchPaths; /** * Acquire the Store writer lease before the per-Watch state lock. This keeps * the repository compatible with the canonical `writer -> state` lock order. */ export declare function withTerminalWatchLock(storeDir: string, watchId: string, locks: TerminalWatchFileLockPort, operation: () => Result): Result; export declare function createTerminalWatchStore(storeDir: string, locks: TerminalWatchFileLockPort): TerminalWatchStore; export declare function saveTerminalWatch(storeDir: string, watch: TerminalWatch, options: TerminalWatchSaveOptions): TerminalWatch; export declare function loadTerminalWatch(storeDir: string, watchId: string): TerminalWatch; export declare function tryLoadTerminalWatch(storeDir: string, watchId: string): TerminalWatch | undefined; export declare function listTerminalWatches(storeDir: string): TerminalWatch[]; /** * Reconciliation isolates only malformed contents of an already-named JSON * record. Directory shape, symlinks, unknown entries, permissions, and I/O * failures remain global fail-closed boundaries. */ export declare function scanTerminalWatchesForReconciliation(storeDir: string): TerminalWatchReconciliationScan;