import { FileStore } from "../storage/file-store.js"; import { ChunkStore } from "../storage/chunk-store.js"; import { EmbeddingStore } from "../storage/embedding-store.js"; import { GraphStore } from "../storage/graph-store.js"; import { MemoryStore } from "../storage/memory-store.js"; import { MemoryEmbeddingStore } from "../storage/memory-embedding-store.js"; import { SymbolRefStore } from "../storage/symbol-ref-store.js"; import { DocEdgeStore } from "../storage/doc-edge-store.js"; import { EvidenceStore } from "../storage/evidence-store.js"; import { ConceptStore } from "../storage/concept-store.js"; import { HandleStore } from "../storage/handle-store.js"; import { PatternStore } from "../storage/pattern-store.js"; import { MemoryJournal } from "../memory/journal.js"; import { type SverkloConfig } from "../utils/config-file.js"; import type { ProjectConfig, IndexStatus } from "../types/index.js"; import type { IndexFiles } from "./index-files.js"; import type { IndexCode } from "./index-code.js"; import type { IndexGraph } from "./index-graph.js"; import type { IndexMemory } from "./index-memory.js"; import type { IndexAdmin } from "./index-admin.js"; export declare class Indexer implements IndexFiles, IndexCode, IndexGraph, IndexMemory, IndexAdmin { private config; private db; fileStore: FileStore; chunkStore: ChunkStore; embeddingStore: EmbeddingStore; graphStore: GraphStore; memoryStore: MemoryStore; memoryEmbeddingStore: MemoryEmbeddingStore; symbolRefStore: SymbolRefStore; docEdgeStore: DocEdgeStore; evidenceStore: EvidenceStore; conceptStore: ConceptStore; handleStore: HandleStore; patternStore: PatternStore; memoryJournal: MemoryJournal; private embeddingProvider; sverkloConfig: SverkloConfig | null; private indexing; private progress; private lastIndexedTime; private freshnessCache; private static readonly FRESHNESS_CACHE_MS; constructor(config: ProjectConfig); /** * Bring the on-disk data layer up to CURRENT_DATA_VERSION. Runs * once on Indexer construction and is a no-op on already-current * databases. * * Migrations are intentionally side-effecting on this instance's * stores; each one should be small, deterministic, and fast. */ private runDataMigrations; get rootPath(): string; /** * Embed a batch of texts using the selected provider. Callers should * prefer this over importing the legacy embed() directly so that a * single env-var change (SVERKLO_EMBEDDING_PROVIDER) actually takes * effect across every query path. * * If the provider hasn't been lazily initialized yet (embed() called * before the first index() run), we init the default provider * synchronously via the bundled ONNX module so read-path tools like * search / recall / remember still work during bootstrap. */ private __embedCache; private static __embedCacheMax; embed(texts: string[]): Promise; private initLegacyAndEmbed; /** * Human-readable name of the active embedding provider. Used by * sverklo_status and sverklo doctor to show the user which provider * their env vars actually selected. Returns "default" if the * provider hasn't been initialized yet. */ get embeddingProviderName(): string; /** * Dimensions of the active embedding provider. Surfaced in status * so users can spot a dimension mismatch that would require reindex. */ get embeddingDimensions(): number; index(): Promise; reindexFile(relativePath: string, absolutePath: string, language: string): Promise; removeFile(relativePath: string): void; getStatus(): IndexStatus; /** * Compute index freshness by walking the filesystem and comparing mtimes * to what's stored in the file index. Used by sverklo_status so reviewer * agents can decide whether to fall back to grep on a stale index. * * Disk walk is bounded by the same ignore filter as indexing, and status * is a low-frequency call (start of session) so the cost is acceptable. */ getFreshness(): { ageSeconds: number | null; dirtyFiles: string[]; missingFiles: string[]; }; /** * Drop the freshness cache. Called by the file watcher when a real * change event fires so the next sverklo_status reflects reality * without waiting for the 2-second TTL. */ invalidateFreshnessCache(): void; close(): void; /** * Delete the index database entirely and reinitialize empty stores. * Caller is responsible for triggering a reindex afterwards if desired. * * Returns the list of files that were deleted plus any that failed * (e.g. EBUSY on Windows when another sverklo process holds the * SQLite WAL/SHM open). Callers MUST check the `failed` array — * issue #58 (2026-05-22) showed reindex --force happily exiting * "Done" after every unlink failed and the same stale DB was * reopened, leaving users certain they'd tested a fresh index. */ clearIndex(): { deleted: string[]; failed: Array<{ path: string; error: NodeJS.ErrnoException; }>; }; }