/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */ import { MemoryEmbeddingProviderRegistry } from './memory-embeddings.js'; import { type CodeChunkMode } from './code-index-chunking.js'; export type { CodeChunk, CodeChunkMode } from './code-index-chunking.js'; export type { CodeContextResult, CodeIndexBuildProgress, CodeIndexBuildStats, CodeIndexOptions, CodeIndexSkipReport, CodeIndexStats, } from './code-index-types.js'; import type { CodeContextResult, CodeIndexBuildProgress, CodeIndexBuildStats, CodeIndexOptions, CodeIndexStats } from './code-index-types.js'; export declare class CodeIndexStore { private readonly embeddingRegistry; private readonly options; private db; private available; private error; private platformLimitReason; private building; private buildStartedAtMs; private buildPromise; private lastBuild; private progress; private readonly intelligence; private intelligenceReadyPromise; /** * Lifecycle generation counter. Bumped by reroot() and close(); an in-flight * runBuild() captures the value at start and re-checks it after EVERY await, * aborting cleanly when stale so a build started against one root can never * write wrong-rooted chunks into a database opened for a different root. */ private epoch; private rootDir; private dbPath; constructor(rootDir: string, dbPath: string, embeddingRegistry: MemoryEmbeddingProviderRegistry, options?: CodeIndexOptions); init(): void; close(): void; /** * Re-root the store to a new working directory + db path (workspace swap). * Bumps the build epoch (aborting any in-flight build at its next await), * closes existing handles, reopens at the new path, and clears in-memory * build state. Does NOT re-trigger a build, the caller decides when to * call scheduleBuild()/buildFull() again, exactly as it decided to open the * store originally. */ reroot(newRootDir: string, newDbPath: string): Promise; isBuilding(): boolean; buildProgress(): CodeIndexBuildProgress | null; /** Wall-clock start time of the in-flight build, or null when idle. */ buildStartedAt(): number | null; /** True unless the only active embedding provider is the deterministic hashed fallback. */ hasSemanticProvider(): boolean; /** Stated once, honest: why Stage-B auto-retrieval (a later wave) would be absent right now. Null when a real provider is active. */ describeDegradation(): string | null; /** * Human-readable provider-space mismatch, or null when the stored vectors * were built with the current default provider (or provenance is unknown, * an index that predates provenance tracking keeps its legacy behavior * until the next build stamps it). */ getProviderMismatch(): string | null; stats(): CodeIndexStats; search(query: string, opts?: { limit?: number; }): CodeContextResult[]; /** * Lexical fallback used when the vector path is disabled by a provider * mismatch: token match over chunk symbol/path metadata (chunk text is not * stored, so this is name/path matching only, labeled 'lexical', never * 'semantic'). Similarity is the matched-token fraction. */ private searchLexical; /** Fire-and-forget kickoff; concurrent/repeated calls while a build is running are no-ops. Never awaited by the caller, never blocks a turn. */ scheduleBuild(): void; /** Full source-tree walk. Concurrent calls coalesce onto the same in-flight promise (mirrors MemoryStore.rebuildVectorIndexAsync). */ buildFull(): Promise; /** * Reindex a single file on demand. Intended to be called from the file * read/write tool paths and from an explicit reindex command, wiring * those call sites is out of scope for this module (see module doc). * A no-op (chunks removed) if the path is gitignored or no longer exists. */ reindexFile(absPath: string): Promise<{ indexed: boolean; mode: CodeChunkMode; }>; private runBuild; /** * Compose the root .gitignore with any nested .gitignore files (each nested * file's patterns apply relative to its own directory, per git semantics). * Nested coverage is bounded by findNestedGitignoreFiles' cap (see module doc). */ private buildIgnoreMatcher; /** * Index one file's content. Short-circuits on an unchanged file_hash (no * re-chunk, no re-embed), the "content_hash stable across re-index of * unchanged file" contract, unless forceReembed is set (provider mismatch). * * Epoch honesty: all of a file's chunks are embedded (every await) BEFORE * any row is deleted or written, and the epoch is re-checked after each * await, so a reroot() mid-file aborts with the database untouched for * that file (returns null; the caller abandons the build). */ private indexFileContent; private ensureIntelligenceReady; private embedChunkAsync; } //# sourceMappingURL=code-index-store.d.ts.map