/** * @module @nhtio/adk/batteries/vector/hnswlib * * Embedded HNSWLib adapter (in-process, no server — like in_memory/sqlite_vec/duckdb). hnswlib is * a pure ANN index keyed by integer labels and holding ONLY vectors, so this adapter pairs the * index with a JS sidecar that owns id↔label mapping plus the document/metadata records. KNN runs * through the HNSW index; metadata filtering, filter-scans, projection and delete are served from * the sidecar via the neutral filter tree's JS reference evaluator (exact cross-adapter parity). * * Driver: `hnswlib-node` (native addon; requires the build to be approved — see * pnpm-workspace.yaml `allowBuilds`). Persistence is in-memory per process; pass a fresh store per * use. (The index supports writeIndex/readIndex on disk, but the sidecar would need its own * persistence — out of scope for the in-memory contract here.) */ import { BaseVectorStore } from "../contract"; import type { SearchPlan, UpsertPlan, DeletePlan, CollectionSpec } from "../plan"; import type { VectorMatch, VectorStoreCapabilities, BaseVectorStoreOptions } from "../types"; export interface HnswlibVectorStoreOptions extends BaseVectorStoreOptions { /** Initial index capacity per collection; grows automatically via `resizeIndex`. Default 1024. */ initialCapacity?: number; } export declare class HnswlibVectorStore extends BaseVectorStore { #private; readonly capabilities: VectorStoreCapabilities; /** Static availability probe: whether this adapter's runtime driver can load in the current environment. */ static isAvailable(): boolean; isAvailable(): boolean; connect(): Promise; close(): Promise; createCollection(spec: CollectionSpec, ifNotExists: boolean): Promise; dropCollection(collection: string, ifExists: boolean): Promise; hasCollection(collection: string): Promise; renameCollection(from: string, to: string): Promise; executeUpsert(plan: UpsertPlan): Promise; executeSearch(plan: SearchPlan): Promise; executeDelete(plan: DeletePlan): Promise; }