/** * Enhanced memory implementation for Agentis agents * Provides short-term, long-term memory and notes functionality */ import { EnhancedMemoryInterface, EnhancedMemoryConfig, ShortTermMemory, LongTermMemory, AgentNote, MemoryRetrievalResult } from './enhanced-memory-interface'; import { VectorStore } from './pinecone-store'; /** * Implementation of the enhanced memory system */ export declare class EnhancedMemory implements EnhancedMemoryInterface { private config; private logger; private embeddingService; private vectorStore; private shortTermMemories; private longTermCache; private notes; private shortTermPath; private notesPath; private initialized; /** * Creates a new enhanced memory system * * @param vectorStore - Vector store for long-term memory * @param config - Configuration for the memory system */ constructor(vectorStore: VectorStore, config?: Partial); /** * Initializes the memory system * * @returns Promise that resolves when initialization is complete */ initialize(): Promise; /** * Stores a memory in short-term memory * * @param memory - The memory to store * @returns Promise that resolves to the stored memory ID */ storeShortTerm(memory: Omit): Promise; /** * Stores a memory in long-term memory * * @param memory - The memory to store * @returns Promise that resolves to the stored memory ID */ storeLongTerm(memory: Omit): Promise; /** * Creates or updates a note * * @param note - The note to create or update * @returns Promise that resolves to the note ID */ saveNote(note: Omit): Promise; /** * Retrieves memories relevant to a query * * @param query - The query to find relevant memories for * @param options - Optional retrieval options * @returns Promise resolving to retrieved memories */ retrieve(query: string, options?: { shortTermLimit?: number; longTermLimit?: number; notesLimit?: number; minRelevance?: number; includeAll?: boolean; }): Promise; /** * Gets a note by ID * * @param id - The note ID * @returns Promise resolving to the note or undefined if not found */ getNote(id: string): Promise; /** * Gets all notes * * @returns Promise resolving to all notes */ getAllNotes(): Promise; /** * Gets notes by tag * * @param tag - The tag to filter by * @returns Promise resolving to notes with the specified tag */ getNotesByTag(tag: string): Promise; /** * Transfers short-term memories to long-term * * @param shortTermIds - IDs of short-term memories to transfer * @returns Promise resolving to the IDs of the new long-term memories */ transferToLongTerm(shortTermIds: string[]): Promise; /** * Prunes memories based on relevance, access time, etc. * * @returns Promise resolving when pruning is complete */ prune(): Promise; /** * Clears all memories * * @returns Promise resolving when all memories are cleared */ clear(): Promise; /** * Ensures the memory system is initialized * * @returns Promise that resolves when initialization is complete */ private ensureInitialized; /** * Retrieves short-term memories based on keyword matching * * @param query - The query to match against * @param limit - Maximum number of memories to retrieve * @returns Short-term memories and their relevance scores */ private retrieveShortTerm; /** * Retrieves long-term memories using vector search * * @param queryEmbedding - Embedding of the query * @param limit - Maximum number of memories to retrieve * @param minRelevance - Minimum relevance score (0-1) * @returns Long-term memories and their relevance scores */ private retrieveLongTerm; /** * Retrieves notes relevant to a query * * @param query - Text query for keyword matching * @param queryEmbedding - Embedding for semantic matching * @param limit - Maximum number of notes to retrieve * @returns Notes and their relevance scores */ private retrieveNotes; /** * Counts keyword matches in text * * @param text - Text to search * @param keywords - Keywords to match * @returns Number of matches */ private countKeywordMatches; /** * Prunes short-term memories * Removes expired memories and oldest memories if over capacity */ private pruneShortTerm; /** * Prunes notes * Removes least important notes if over capacity */ private pruneNotes; /** * Loads short-term memories and notes from disk */ private loadFromDisk; /** * Saves short-term memories and notes to disk */ private saveToDisk; /** * Cleans up expired short-term memories */ private cleanupExpiredMemories; }