/** * Document Index — Storage and search for indexed doc chunks * * Supports two backends: * - Free tier: Local JSON file with BM25 keyword search * - Pro/dev tier: In-memory vector index with embeddings * * Follows the same patterns as local-vector-search.ts and local-file-storage.ts */ import type { DocChunk } from "./doc-chunker.js"; export interface IndexedDocChunk { id: string; file_path: string; chunk_index: number; title: string; section_title: string; category: string; content: string; file_hash: string; project: string; embedding?: number[]; indexed_at: string; } export interface DocSearchResult { id: string; file_path: string; chunk_index: number; title: string; section_title: string; category: string; content: string; similarity: number; project: string; } export interface IndexStats { total_chunks: number; total_files: number; files_indexed: string[]; categories: Record; project: string; has_embeddings: boolean; } /** * Index doc chunks into storage. * * - Removes old chunks for the same project + file_path * - Generates embeddings if available (pro/dev tier) * - Stores to local JSON file * - Loads into in-memory vector index if embeddings present * * Returns count of chunks indexed. */ export declare function indexChunks(chunks: DocChunk[], project: string, options?: { batchSize?: number; }): Promise<{ indexed: number; embedded: number; errors: number; }>; /** * Search indexed docs using semantic similarity (pro/dev) or BM25 (free) */ export declare function searchDocs(query: string, options?: { project?: string; category?: string; match_count?: number; }): Promise; /** * Get index statistics */ export declare function getIndexStats(project?: string): IndexStats; /** * Check which files have changed since last index (by hash) */ export declare function getChangedFiles(fileHashes: Map, project: string): { changed: string[]; unchanged: string[]; new_files: string[]; }; /** * Initialize vector index from local storage on startup */ export declare function initDocVectorIndex(): void; /** * Clear the doc index for a project (or all) */ export declare function clearDocIndex(project?: string): number; //# sourceMappingURL=doc-index.d.ts.map