import type { FileStateCache } from './file-cache.js'; import type { ProjectIndex } from './project-index.js'; import type { HookDispatcher } from '../hooks/dispatcher.js'; /** * FileWatcher, watches key project files and invalidates caches on change. * * Uses Node.js/Bun-native `fs.watch`. Debounces events per-file (100ms). * On change: * 1. Invalidates FileStateCache entry * 2. Upserts ProjectIndex with new token estimate * 3. Fires Change:file:external hook via HookDispatcher (if provided) */ export declare class FileWatcher { private readonly fileCache; private readonly projectIndex; private readonly hookDispatcher?; private readonly projectRoot; /** Absolute paths currently being watched */ private watchedPaths; /** Active FSWatcher instances keyed by absolute path */ private watchers; /** Pending debounce timers keyed by absolute path */ private debounceTimers; /** watchFile listeners keyed by absolute path for reliable polling mode */ private pollListeners; private watching; /** Debounce window in milliseconds */ private static readonly DEBOUNCE_MS; constructor(fileCache: FileStateCache, projectIndex: ProjectIndex, options: { projectRoot: string; }, hookDispatcher?: HookDispatcher); /** * Start watching all registered paths. * Adds default paths (package.json, tsconfig.json, .env*, .goodvibes/**). * Also watches all files currently in ProjectIndex. */ start(): void; /** * Stop watching all paths and clear all watchers. */ stop(): void; /** Returns true if the watcher has been started and not stopped. */ isWatching(): boolean; /** * Add a path to the watch list. * If already watching, opens a watcher immediately. * Missing paths remain registered and are opened if they appear later. */ addPath(inputPath: string): void; /** * Remove a path from the watch list and close its watcher. */ removePath(inputPath: string): void; /** Return a snapshot of all watched absolute paths. */ getWatchedPaths(): ReadonlySet; private _openWatcher; private _scheduleChange; private _handleChange; } //# sourceMappingURL=file-watcher.d.ts.map