/** * A file entry in the flat in-memory index. */ export interface FileEntry { /** Path relative to project root, using forward slashes. */ path: string; /** Estimated LLM token count. */ tokens: number; } /** * ProjectIndex, In-memory project file index with token counts. * * Singleton per process. Loaded at startup from disk in the background. * Mutations are debounced: flush happens 5 seconds after last write. * * Disk format: v4 tree (see DiskFormat above). */ export declare class ProjectIndex { private indexPath; private projectRoot; baseDir: string; private files; private flushTimer; private createdAt; private loaded; constructor(baseDir: string); /** * Load the index from disk. * Called at startup, safe to call multiple times. */ load(): Promise; /** * Flush to disk immediately, bypassing debounce. */ forceFlush(): Promise; getFiles(): FileEntry[]; getFile(path: string): FileEntry | null; getFilesByPrefix(prefix: string): FileEntry[]; /** Return count of files by extension (e.g. { ts: 42, json: 5 }). */ getTypeCounts(): Record; getTotalTokens(): number; /** * Insert or update a file entry. * If tokens is not provided, attempts to estimate from disk. */ upsertFile(path: string, tokens?: number): void; /** * Touch an existing file entry (update token count from disk if possible). * No-op if file not in index. */ touchFile(path: string): void; removeFile(path: string): void; private normalizePath; dispose(): Promise; /** * Re-root the project index to a new base directory. * * Flushes any pending writes to the current location, then resets all in-memory * state and re-points the index path to the new directory. A fresh load is * performed to pick up any existing index at the new location. * * @param newBaseDir - Absolute path to the new project root. */ reroot(newBaseDir: string): Promise; private scheduleFlush; private flush; } //# sourceMappingURL=project-index.d.ts.map