Constructs a ConversationManager instance.
Initialization via initialize() is required before use.
Initializes the ConversationManager with its configuration and dependencies. This method sets up persistence if enabled and prepares the manager for operation.
Configuration for the manager.
Optional utilityAIService: IUtilityAIOptional IUtilityAI instance, primarily used by ConversationContext instances for features like summarization.
Optional storageAdapter: StorageAdapterOptional storage adapter for database persistence.
Required if config.persistenceEnabled is true.
A promise that resolves when initialization is complete.
If configuration is invalid or dependencies are missing when required.
Creates a new conversation context or retrieves an existing one.
If conversationId is provided:
conversationId is provided, a new one is generated.
Manages in-memory cache size by evicting the oldest conversation if capacity is reached.Optional conversationId: stringOptional ID of an existing conversation. This ID will also be used as the ConversationContext.sessionId.
Optional userId: stringID of the user associated with the conversation.
Optional gmiInstanceId: stringID of the GMI instance this conversation is for.
Optional activePersonaId: stringID of the active persona for the conversation.
Optional initialMetadata: Record<string, any> = {}Initial metadata for a new conversation.
Optional overrideConfig: Partial<ConversationContextConfig>Config overrides for a new context.
The created or retrieved ConversationContext.
If essential parameters for creating a new context are missing or if an error occurs.
Lists minimal context info for a given session. Currently returns a single entry matching the provided sessionId if found in memory or storage.
Saves a ConversationContext to persistent storage if persistence is enabled. This is called automatically when a context is evicted from memory or during shutdown.
The ConversationContext to save.
If the save operation fails.
Gets basic info about a conversation (ID and creation timestamp). Checks in-memory cache first, then persistent storage if enabled.
The ID of the conversation.
Array with conversation info, or empty if not found.
Gets the last active time for a conversation, typically the timestamp of the last message or update. Checks in-memory cache first, then persistent storage if enabled.
The ID of the conversation.
Timestamp of last activity (Unix epoch ms), or undefined if not found.
Readonly managerUnique identifier for this ConversationManager instance.
ConversationManager
Description
Manages ConversationContext instances for AgentOS, handling their creation, retrieval, in-memory caching, and persistent storage via sql-storage-adapter. This class is vital for maintaining conversational state across user sessions and GMI interactions.