import type { AtomicWriteOutcome } from '../utils/atomic-json-store.js'; import type { WatcherRecord } from '../runtime/store/domains/watchers.js'; export interface WatcherStoreSnapshot { readonly version: 1; readonly watchers: readonly WatcherRecord[]; } export declare function getWatcherStorePath(rootPath: string): string; export declare function resolveWatcherStorePath(storePath?: string): string; export declare function loadWatcherSnapshot(storePath: string): WatcherStoreSnapshot | null; /** * Load a watcher store snapshot, never throwing on a corrupt file. * * A file this reader cannot trust, unparseable JSON, a torn/zero-tailed * write, or the wrong shape, is moved aside by the shared quarantine helper * with a `.why` receipt, and this returns null exactly as it does for "no * snapshot yet". Callers (daemon boot, daemon tick, TUI, agent) all rebuild * watcher state from live registrations on a null return, so a corrupt * snapshot degrades to an empty one instead of crash-looping the reader. */ export declare function loadWatcherSnapshotFromPath(storePath: string): WatcherStoreSnapshot | null; export declare function saveWatcherSnapshot(watchers: readonly WatcherRecord[], storePath: string): void; /** * Save a watcher store snapshot atomically via the shared helper: temp file * beside the target, fsync, rename over it, stale-temp sweep first. A reader, * or a process that dies mid-write, only ever sees a complete snapshot. */ export declare function saveWatcherSnapshotToPath(watchers: readonly WatcherRecord[], storePath: string): void; /** * Save a watcher snapshot the way a background tick needs it saved: a write * that fails is logged at error level with the store path and the errno, and * reported in the returned outcome, never thrown. * * The registry persists on every list refresh, and the fleet registry's * coalesced tick calls that list on a timer. An exception raised there has no * caller above it to catch anything, so it reaches the top as an uncaught * exception and takes the process with it, which is precisely what happened * on a live machine when a concurrent writer's sweep removed this store's temp * file mid-write and the `chmod` came back ENOENT. Watcher state costs nothing * to lose (see {@link WATCHER_STORE_RECOVERY}); the host process does not. */ export declare function saveWatcherSnapshotToPathSafe(watchers: readonly WatcherRecord[], storePath: string): AtomicWriteOutcome; //# sourceMappingURL=store.d.ts.map