import type { IndexingStrictThresholds } from '../contracts/indexing.js'; import type { WatcherEventMode } from '../contracts/watcher-state.js'; export declare const WATCHED_EXTENSIONS: Set; export interface WatchLogger { log(message?: string): void; error(message?: string): void; } export interface RebuildCodeOptions { followSymlinks?: boolean; respectGitignore?: boolean; noHtml?: boolean; indexingStrict?: IndexingStrictThresholds; logger?: WatchLogger; } export interface WatchReconciliationMetrics { trigger: 'initial' | 'event' | 'periodic' | 'post-rebuild'; durationMs: number; fileCount: number; directoryCount: number; changedCount: number; eventMode: WatcherEventMode; nextIntervalMs: number; } export interface WatchOptions extends RebuildCodeOptions { signal?: AbortSignal; /** Initial authoritative reconciliation interval; retained for CLI/test compatibility. */ pollIntervalMs?: number; maxPollIntervalMs?: number; reconciliationTimeoutMs?: number; rebuildCode?: (watchPath: string, options?: RebuildCodeOptions) => boolean | null | Promise; notifyOnly?: (watchPath: string, logger?: WatchLogger) => void; onReconciliation?: (metrics: WatchReconciliationMetrics) => void; /** Internal auto-refresh handshake: listener + snapshot are active before this rebuild starts. */ rebuildOnStart?: boolean; onInitialRebuild?: (rebuilt: boolean) => void; } export interface GraphAutoRefreshController { /** Whether the initial incremental reconciliation produced a graph. */ initialRebuilt: boolean; /** Background controllers remain false until their initial reconciliation has settled. */ startupComplete?(): boolean; /** Returns a background startup/runtime failure that could not be read from watcher-state.json. */ failureReason?(): string | null; /** Resolves after the initial reconciliation succeeds, fails, or is aborted. */ startupSettled?: Promise; /** Stops the watcher and releases its filesystem resources. */ stop(): void; /** Resolves once the watcher stops. */ completed: Promise; } interface GitVisibilityCache { visibleFiles: string[] | null; expiresAt: number; } export interface WatchSnapshot { fingerprints: Map; fileCount: number; directoryCount: number; durationMs: number; } export declare function snapshotWatchedFiles(watchPath: string, followSymlinks: boolean, respectGitignore?: boolean, gitVisibilityCache?: GitVisibilityCache, timeoutMs?: number): WatchSnapshot; export declare function notifyOnly(watchPath: string, logger?: WatchLogger): void; export declare function hasNonCode(changedPaths: string[]): boolean; export declare function rebuildCode(watchPath: string, options?: RebuildCodeOptions): boolean; /** * Starts a watcher before reconciling the graph. The ordering is intentional: * a source edit made while the first generation is running is queued for a * follow-up incremental rebuild instead of being published as silently fresh. */ export declare function startGraphAutoRefresh(watchPath: string, debounceSeconds?: number, options?: Omit): GraphAutoRefreshController; export declare function watch(watchPath: string, debounce?: number, options?: WatchOptions): Promise; export {};