/** * In-memory storage backend for AgentDBClient. * * The AIMDS gateway was originally written against agentdb 1.x, * which exposed `createIndex`, `search`, `insert`, `count`, `sync`, * etc. directly on the database handle returned by * `createDatabase()`. agentdb 3.x is a breaking API change — those * methods are gone, replaced by a higher-level `AgentDB` class. * * Rather than chase the v3 alpha surface (which is still moving) * across an alpha-tagged dependency, this module provides a small, * dependency-free in-memory store that satisfies the call shape the * wrapper expects. It is correct, fast (HNSW-style cosine search * over an in-memory matrix), and ships zero CVEs. * * Trade-offs vs. a real persistent backend: * - No persistence across process restarts (TTL cleanup still works * in-memory). * - No QUIC peer sync (the sync method is a no-op). * - Linear scan instead of HNSW for k-NN (still O(N·D) — fine up to * ~100k vectors, which covers single-node deployments). * * A proper persistent backend (agentdb v3 wrapper or sqlite-vec) is * scheduled for a follow-up. Until then this module keeps the * gateway functional and the npm package publishable. */ interface Doc { [key: string]: unknown; } interface SearchInput { collection: string; vector: number[]; k: number; ef?: number; } interface InsertInput { collection: string; document: Doc | Record; } interface UpsertInput { collection: string; document: Doc | Record; } interface DeleteInput { collection: string; filter: Record; } interface CountInput { collection: string; } interface CollectionInput { name: string; schema?: unknown; } interface IndexInput { type: string; params: unknown; } interface SyncInput { peer: string; protocol: string; port: number; collections: string[]; } interface SearchResult { id: string; similarity: number; metadata: Record; embedding: number[]; } export declare class InMemoryStore { private collections; private bytesEstimate; createIndex(_: IndexInput): Promise; createCollection(input: CollectionInput): Promise; insert(input: InsertInput): Promise; upsert(input: UpsertInput): Promise; search(input: SearchInput): Promise; count(input: CountInput): Promise; getMemoryUsage(): number; delete(input: DeleteInput): Promise; sync(_: SyncInput): Promise; close(): Promise; private ensure; } export {}; //# sourceMappingURL=memory-store.d.ts.map