/** * Agentic QE v3 - Memory Backend Factory * Creates appropriate memory backend based on configuration */ import { MemoryBackend } from './interfaces'; import { InMemoryBackend } from './memory-backend'; import { AgentDBBackend, AgentDBConfig } from './agentdb-backend'; import { HybridMemoryBackend, HybridBackendConfig, SQLiteConfig } from './hybrid-backend'; /** * Supported memory backend types */ export type MemoryBackendType = 'memory' | 'sqlite' | 'agentdb' | 'hybrid'; /** * Memory backend configuration union */ export interface MemoryBackendConfig { /** Backend type to create */ type: MemoryBackendType; /** InMemory backend options (type: 'memory') */ memory?: { cleanupInterval?: number; }; /** SQLite backend options (type: 'sqlite') */ sqlite?: Partial; /** AgentDB backend options (type: 'agentdb') */ agentdb?: Partial; /** Hybrid backend options (type: 'hybrid') */ hybrid?: Partial; } /** * Result of backend creation */ export interface MemoryBackendResult { backend: MemoryBackend; type: MemoryBackendType; initialized: boolean; } /** * Create a memory backend based on configuration * * @param config - Backend configuration * @param autoInitialize - Whether to automatically initialize the backend * @returns The created and optionally initialized memory backend * * @example * ```typescript * // Simple in-memory backend * const memory = await createMemoryBackend({ type: 'memory' }); * * // AgentDB with HNSW for vector search * const vectorMemory = await createMemoryBackend({ * type: 'agentdb', * agentdb: { * path: './data/vectors.db', * hnsw: { dimensions: 384, metric: 'cosine' } * } * }); * * // Hybrid: SQLite + AgentDB with fallback * const hybridMemory = await createMemoryBackend({ * type: 'hybrid', * hybrid: { * enableFallback: true, * sqlite: { path: './data/memory.db' }, * agentdb: { path: './data/vectors.db' } * } * }); * ``` */ export declare function createMemoryBackend(config: MemoryBackendConfig, autoInitialize?: boolean): Promise; /** * Create the default memory backend based on environment * * Uses environment variables to determine backend type: * - AQE_MEMORY_BACKEND: 'memory' | 'sqlite' | 'agentdb' | 'hybrid' * - AQE_MEMORY_PATH: Path for persistent storage * - AQE_VECTOR_DIMENSIONS: Vector embedding dimensions * * @param autoInitialize - Whether to automatically initialize * @returns Configured memory backend */ export declare function createDefaultMemoryBackend(autoInitialize?: boolean): Promise; /** * Determine the best backend type based on requirements * * @param requirements - Backend requirements * @returns Recommended backend type */ export declare function selectBackendType(requirements: { needsVectorSearch: boolean; needsPersistence: boolean; needsHighPerformance: boolean; maxMemoryMB?: number; }): MemoryBackendType; /** * Get recommended configuration for a specific use case */ export declare function getRecommendedConfig(useCase: 'testing' | 'development' | 'production' | 'ci'): MemoryBackendConfig; export { InMemoryBackend, AgentDBBackend, HybridMemoryBackend, type AgentDBConfig, type HybridBackendConfig, type SQLiteConfig, }; //# sourceMappingURL=memory-factory.d.ts.map