/** * Agentic QE v3 - Hybrid Memory Backend * Combines SQLite (structured data) with AgentDB (vector search) */ import { MemoryBackend, StoreOptions, VectorSearchResult } from './interfaces'; import { AgentDBConfig } from './agentdb-backend'; /** * SQLite connection configuration */ export interface SQLiteConfig { /** Database file path */ path: string; /** Enable WAL mode for better concurrency */ walMode: boolean; /** Connection pool size */ poolSize: number; /** Busy timeout in milliseconds */ busyTimeout: number; } /** * Hybrid backend configuration */ export interface HybridBackendConfig { /** SQLite configuration for structured data */ sqlite: Partial; /** AgentDB configuration for vector operations */ agentdb: Partial; /** Whether to fallback to in-memory if backends fail */ enableFallback: boolean; /** Default namespace for operations */ defaultNamespace: string; /** Cleanup interval in milliseconds */ cleanupInterval: number; } /** * Backend health status */ interface BackendHealth { sqlite: 'healthy' | 'degraded' | 'unavailable'; agentdb: 'healthy' | 'degraded' | 'unavailable'; fallback: 'active' | 'inactive'; } /** * Hybrid Memory Backend * * Combines SQLite for structured key-value storage with AgentDB for * high-performance vector operations. Provides automatic fallback to * in-memory storage if persistent backends are unavailable. * * Architecture: * - SQLite: Structured data, key patterns, namespace management * - AgentDB: Vector embeddings, HNSW indexing, similarity search * - InMemory: Fallback when persistent backends unavailable */ export declare class HybridMemoryBackend implements MemoryBackend { private sqliteClient; private agentdbBackend; private fallbackBackend; private config; private cleanupInterval?; private initialized; private useFallback; constructor(config?: Partial); /** * Initialize all backend connections */ initialize(): Promise; /** * Dispose of all backend connections */ dispose(): Promise; /** * Store a value - routes to SQLite or fallback */ set(key: string, value: T, options?: StoreOptions): Promise; /** * Retrieve a value - routes to SQLite or fallback */ get(key: string): Promise; /** * Delete a value from all backends */ delete(key: string): Promise; /** * Check if key exists */ has(key: string): Promise; /** * Search for keys matching pattern - uses SQLite */ search(pattern: string, limit?: number): Promise; /** * Vector similarity search - routes to AgentDB or fallback * Uses HNSW index for O(log n) performance */ vectorSearch(embedding: number[], k: number): Promise; /** * Store vector embedding - routes to AgentDB or fallback */ storeVector(key: string, embedding: number[], metadata?: unknown): Promise; /** * Get health status of all backends */ getHealth(): BackendHealth; /** * Get configuration */ getConfig(): Readonly; /** * Store with explicit backend selection */ setWithBackend(key: string, value: T, backend: 'sqlite' | 'memory', options?: StoreOptions): Promise; /** * Get AgentDB index statistics (if available) */ getVectorStats(): Promise<{ vectorCount: number; indexSize: number; } | null>; private ensureInitialized; private cleanup; } export {}; //# sourceMappingURL=hybrid-backend.d.ts.map