import type { EmbeddingModelName, Logger } from "../../domain/ports"; /** * Clear the freshness cache. * Call this after explicit indexing operations. */ export declare function clearFreshnessCache(): void; export interface IndexResult { moduleId: string; indexed: number; skipped: number; errors: number; /** Time taken in milliseconds */ durationMs?: number; } export interface IndexOptions { /** Override the embedding model (semantic module) */ model?: EmbeddingModelName; /** Show detailed progress */ verbose?: boolean; /** Suppress most output (for use during query) */ quiet?: boolean; /** Logger for progress reporting. If not provided, uses console by default (quiet mode uses silent logger) */ logger?: Logger; /** Number of files to process in parallel (default: auto based on CPU cores) */ concurrency?: number; /** Show timing information for each stage */ timing?: boolean; } /** Timing information for performance profiling */ export interface TimingInfo { /** Total time in milliseconds */ totalMs: number; /** Time spent on file discovery (with mtime filtering) */ fileDiscoveryMs: number; /** Time spent on indexing changed files */ indexingMs: number; /** Time spent on cleanup operations */ cleanupMs: number; /** Number of files discovered on disk */ filesDiscovered: number; /** Number of files modified since last index */ filesChanged: number; /** Number of files that were actually re-indexed (content changed) */ filesReindexed: number; /** Whether result was from cache */ fromCache: boolean; } export interface EnsureFreshResult { /** Number of files indexed (new or modified) */ indexed: number; /** Number of stale entries removed (deleted files) */ removed: number; /** Number of files unchanged (used cache) */ unchanged: number; /** Timing information (only present if timing option was enabled) */ timing?: TimingInfo; } export interface CleanupResult { moduleId: string; /** Number of stale entries removed */ removed: number; /** Number of valid entries kept */ kept: number; } export interface IndexStatus { /** Whether an index exists */ exists: boolean; /** Root directory path */ rootDir: string; /** Index directory path */ indexDir: string; /** Last time the index was updated */ lastUpdated?: string; /** Active modules and their file counts */ modules: Array<{ id: string; fileCount: number; lastUpdated: string; }>; /** Total number of indexed files */ totalFiles: number; } /** * Index a directory using all enabled modules */ export declare function indexDirectory(rootDir: string, options?: IndexOptions): Promise; /** * Result of a reset operation */ export interface ResetResult { /** Whether the reset was successful */ success: boolean; /** The index directory that was removed */ indexDir: string; } /** * Reset (delete) the index for a directory. * * @param rootDir - Root directory of the project * @returns ResetResult with success status * @throws Error if no index exists */ export declare function resetIndex(rootDir: string): Promise; /** * Ensure the index is fresh by checking for changes and updating incrementally. * This function is designed to be called before search to transparently manage the index. * * - If no index exists, creates a full index * - If index version is incompatible, rebuilds from scratch * - If files have changed, re-indexes only the modified files * - If files have been deleted, removes stale entries * - If nothing changed, returns immediately (uses cache) * * @param rootDir - Root directory of the project * @param options - Index options * @returns Statistics about what was updated */ export declare function ensureIndexFresh(rootDir: string, options?: IndexOptions): Promise; /** * Options for cleanup operation */ export interface CleanupOptions { /** Show detailed progress */ verbose?: boolean; /** Logger for progress reporting */ logger?: Logger; } /** * Clean up stale index entries for files that no longer exist * @param rootDir - Root directory of the project * @param options - Cleanup options * @returns Array of cleanup results per module */ export declare function cleanupIndex(rootDir: string, options?: CleanupOptions): Promise; /** * Get the current status of the index * @param rootDir - Root directory of the project * @returns Index status information */ export declare function getIndexStatus(rootDir: string): Promise; export { watchDirectory, type WatchOptions, type FileWatcher } from "./watcher";