/** * Shared type for conversation memory managers. * Both ConversationMemoryManager and RedisConversationMemoryManager * should implement this type. */ import type { ChatMessage, ConversationMemoryConfig, ConversationMemoryStats, SessionMemory, StoreConversationTurnOptions } from "./conversation.js"; /** * Common type for all conversation memory manager implementations. * Provides a consistent API for storing, retrieving, and managing conversation history. */ export type IConversationMemoryManager = { config: ConversationMemoryConfig; /** Initialize the memory manager */ initialize(): Promise | void; /** Store a conversation turn */ storeConversationTurn(options: StoreConversationTurnOptions): Promise; /** Get session by ID */ getSession(sessionId: string, userId?: string): SessionMemory | undefined | Promise; /** Build context messages for AI prompt injection */ buildContextMessages(sessionId: string, userId?: string, enableSummarization?: boolean, requestId?: string): Promise | ChatMessage[]; /** Clear a specific session */ clearSession(sessionId: string, userId?: string): Promise | boolean; /** Clear all sessions */ clearAllSessions(): Promise | void; /** Get memory statistics */ getStats(): Promise | ConversationMemoryStats; /** Get raw messages array for a session (no context filtering or summarization) */ getSessionMessages(sessionId: string, userId?: string): Promise; /** Replace the entire messages array for a session */ setSessionMessages(sessionId: string, messages: ChatMessage[], userId?: string): Promise; /** Close/shutdown the memory manager and release resources (e.g., Redis connections) */ close?(): Promise; };