/** * SMI-1519: HNSW Embedding Store * SMI-4577: Production HNSW path now lives in `embeddings/hnsw-search.ts` and is * wired into `EmbeddingService.findSimilar`. This class retains its * historical API for callers that want a self-contained store without * the full `EmbeddingService` surface, but no longer references the * V3 VectorDB (decommissioned after the claude-flow → ruflo rename). * * High-performance vector storage with SQLite-backed metadata. `findSimilar` * uses brute-force search; consumers wanting the HNSW backend should use * `EmbeddingService` instead, which lazy-loads `hnswlib-node` from the * shared search module. * * @see ADR-009: Embedding Service Fallback Strategy */ import type { SimilarityResult } from './index.js'; export type { HierarchicalNSW, HNSWSearchResult, HierarchicalNSWConstructor, HNSWConfig, HNSWEmbeddingStoreOptions, HNSWIndexStats, BatchInsertResult, IEmbeddingStore, } from './hnsw-store.types.js'; export { DEFAULT_HNSW_CONFIG, HNSW_PRESETS } from './hnsw-store.types.js'; export { createHNSWStore, isHNSWAvailable, loadHNSWLib } from './hnsw-store.helpers.js'; import type { HNSWConfig, HNSWEmbeddingStoreOptions, HNSWIndexStats, BatchInsertResult, IEmbeddingStore } from './hnsw-store.types.js'; /** * High-performance embedding storage using HNSW index. * Provides O(log n) approximate nearest neighbor search with SQLite persistence. */ export declare class HNSWEmbeddingStore implements IEmbeddingStore { private db; private index; private readonly hnswEnabled; private readonly config; private readonly maxElements; private readonly indexPath; private readonly distanceMetric; private readonly autoSave; private skillIdToLabel; private labelToSkillId; private nextLabel; private vectorDB; private initPromise; /** * @deprecated If dbPath is passed, use HNSWEmbeddingStore.create(options) instead — * the async factory supports both native and WASM SQLite. Passing dbPath to this * constructor throws to prevent silent data loss. */ constructor(options?: HNSWEmbeddingStoreOptions); /** * Async factory — supports both native and WASM SQLite. * * @param options - Store options; dbPath is opened via createDatabaseAsync * @returns Fully initialised HNSWEmbeddingStore instance */ static create(options?: HNSWEmbeddingStoreOptions): Promise; ensureInitialized(): Promise; storeEmbedding(skillId: string, embedding: Float32Array, text: string): void; getEmbedding(skillId: string): Float32Array | null; getAllEmbeddings(): Map; findSimilar(queryEmbedding: Float32Array, topK?: number): SimilarityResult[]; findSimilarAsync(queryEmbedding: Float32Array, topK?: number): Promise; cosineSimilarity(a: Float32Array, b: Float32Array): number; isUsingFallback(): boolean; close(): void; getStats(): HNSWIndexStats; batchInsert(embeddings: Array<{ skillId: string; embedding: Float32Array; text: string; }>): BatchInsertResult; removeEmbedding(skillId: string): boolean; saveIndex(): void; loadIndex(): void; rebuildIndex(newConfig?: Partial): Promise; setEfSearch(efSearch: number): void; private initDatabase; private initDatabaseAsync; private initEmbeddingsTable; private initHNSWIndex; private distanceToSimilarity; } //# sourceMappingURL=hnsw-store.d.ts.map