import { MemoryConfig, MemoryRecord, MemoryState } from '@celiums/memory-types'; /** * @celiums/memory — SQLite Store * * Single-file persistent memory store. Zero infrastructure — just a .db file. * Sits between InMemoryMemoryStore (volatile dev) and MemoryStore (PG+Qdrant+Valkey production). * * Features: * - better-sqlite3 for synchronous, fast, battle-tested persistence * - FTS5 full-text search built into SQLite * - Vector embeddings stored as BLOB, cosine computed in JS * - Same API as InMemoryMemoryStore — drop-in replacement * - Atomic writes via SQLite transactions * - Survives process restarts, portable between machines * * When to use: * - You want persistence but don't want Docker/PG/Qdrant/Valkey * - Single-user deployments (local dev, personal assistants, single-tenant apps) * - Up to ~500K memories comfortably * * When to upgrade to MemoryStore: * - Multi-user production with concurrent writes * - > 1M memories needing HNSW indexing * - Distributed deployments needing shared state * * @license Apache-2.0 */ interface SqliteStoreConfig extends MemoryConfig { /** Path to SQLite database file. Defaults to ./celiums-memory.db */ sqlitePath?: string; } declare class SqliteMemoryStore { private db; private config; private sqlitePath; private embeddingDimensions; constructor(config: SqliteStoreConfig); initialize(): Promise; saveMemory(memory: MemoryRecord): Promise; getMemory(id: string): Promise; searchByImportance(userId: string, minImportance: number, limit?: number): Promise; deleteMemories(ids: string[]): Promise; updateLifecycle(id: string, importance: number, state: MemoryState): Promise; reactivate(id: string): Promise; getForLifecycle(userId: string, batchSize?: number): Promise; health(): Promise<{ postgres: boolean; qdrant: boolean; valkey: boolean; overall: boolean; }>; embed(text: string): Promise; private deterministicEmbed; semanticSearch(vector: number[], userId: string, projectId: string | null, limit?: number, scoreThreshold?: number): Promise>; fullTextSearch(query: string, userId: string, projectId: string | null, limit?: number): Promise>; private likeSearch; getMemoriesByIds(ids: string[]): Promise; getRecentSessionMemories(userId: string, sessionId: string, limit?: number): Promise; findSimilarMemories(vector: number[], userId: string, threshold?: number, limit?: number): Promise>; updateMemory(id: string, updates: Partial>): Promise; updateSession(sessionId: string, updates: any): Promise; bulkUpdateLifecycle(updates: Array<{ id: string; importance: number; strength: number; state: MemoryState; }>): Promise; getUserProfile(userId: string): Promise; getProjectContext(projectId: string): Promise; shutdown(): Promise; getStats(userId: string): Promise<{ totalMemories: any; byType: { episodic: any; semantic: any; procedural: any; emotional: any; }; byState: { encoding: any; active: any; consolidated: any; decayed: any; archived: any; }; avgImportance: any; avgStrength: any; }>; } export { SqliteMemoryStore, type SqliteStoreConfig };