@hivetechs/hive-ai
Version:
Real-time streaming AI consensus platform with HTTP+SSE MCP integration for Claude Code, VS Code, Cursor, and Windsurf - powered by OpenRouter's unified API
85 lines • 2.8 kB
TypeScript
/**
* SQLite-Based Conversation Memory System
* Implements persistent growing memory storage using SQLite as intended
* Provides 24-hour memory, thematic search, and cross-conversation context
*/
interface ContextResult {
conversation_id: string;
curator_content: string;
question: string;
created_at: string;
relevance_score: number;
context_type: 'recent_24h' | 'thematic' | 'direct_reference';
confidence_score?: number;
}
interface ConversationContext {
recent_24h: ContextResult[];
thematic: ContextResult[];
formatted_context: string;
source_count: number;
memory_summary: string;
}
export declare class SQLiteMemorySystem {
private lastBackupTime;
private backupThresholdHours;
constructor();
/**
* Get conversations from the past 24 hours for context
* Uses SQLite curator_truths table as intended for persistent memory
*/
getRecent24HourContext(userId?: string): Promise<ContextResult[]>;
/**
* Get thematically relevant conversations using SQLite FTS
* Searches curator_truths_fts table for semantic matches
*/
getThematicContext(query: string, userId?: string): Promise<ContextResult[]>;
/**
* Fallback keyword search when FTS is not available
*/
private fallbackKeywordSearch;
/**
* Build complete conversation context from SQLite persistent memory
* This is the core function that implements growing memory storage
*/
buildFullContext(query: string, conversationId: string, userId?: string): Promise<ConversationContext>;
/**
* Store curator truth as single source of truth in SQLite
* This implements the growing memory storage as intended
*/
storeCuratorTruth(conversationId: string, curatorOutput: string, confidenceScore: number, topicSummary: string): Promise<void>;
/**
* Track which context sources were used for a conversation in SQLite
*/
private trackContextSources;
/**
* Format context for inclusion in AI prompts
*/
private formatContextForPrompt;
/**
* Generate a summary of the memory context
*/
private generateMemorySummary;
/**
* Remove duplicate conversations from context
*/
private deduplicateContext;
/**
* Extract meaningful keywords from a query
*/
private extractKeywords;
/**
* Get memory statistics for debugging
*/
getMemoryStats(): Promise<any>;
/**
* Check if automatic backup should be created and trigger if needed
*/
checkAndCreateAutomaticBackup(): Promise<void>;
/**
* Close database connection
*/
close(): Promise<void>;
}
export declare const sqliteMemory: SQLiteMemorySystem;
export {};
//# sourceMappingURL=sqlite-memory.d.ts.map