/** * Enhanced memory interface for the Agentis framework * Provides short-term, long-term memory and notes functionality */ import { MemoryEntry } from './memory-interface'; /** * Represents a note that the agent can create and reference */ export interface AgentNote { id: string; title: string; content: string; tags: string[]; importance: number; created: number; updated: number; } /** * Interface for short term memory entries * These are temporary and will expire after a certain amount of time */ export interface ShortTermMemory extends MemoryEntry { expiresAt: number; } /** * Interface for long term memory entries * These are persistent and will not expire unless explicitly deleted */ export interface LongTermMemory extends MemoryEntry { lastAccessed?: number; accessCount?: number; importance?: number; embedding?: number[]; } /** * Configuration for the enhanced memory system */ export interface EnhancedMemoryConfig { userId?: string; namespace?: string; shortTermTTL?: number; shortTermCapacity?: number; longTermPruneThreshold?: number; embeddingModel?: string; embeddingDimension?: number; vectorStoreName?: 'pinecone' | 'supabase'; vectorStoreConfig?: Record; notesCapacity?: number; } /** * Results from memory retrieval */ export interface MemoryRetrievalResult { shortTerm: ShortTermMemory[]; longTerm: LongTermMemory[]; notes: AgentNote[]; relevanceScores?: Record; } /** * Enhanced memory interface with short-term, long-term, and notes functionality */ export interface EnhancedMemoryInterface { /** * 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 * (Usually called when memory meets certain criteria) * * @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; }