ConversationManager
Defined in: agent/conversation-manager.ts:27
Default implementation of IConversationManager. Manages conversation history by building on top of base messages (system prompt, gadget instructions).
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new ConversationManager(
baseMessages,initialMessages,options):ConversationManager
Defined in: agent/conversation-manager.ts:35
Parameters
Section titled “Parameters”baseMessages
Section titled “baseMessages”initialMessages
Section titled “initialMessages”options
Section titled “options”ConversationManagerOptions = {}
Returns
Section titled “Returns”ConversationManager
Methods
Section titled “Methods”addAssistantMessage()
Section titled “addAssistantMessage()”addAssistantMessage(
content):void
Defined in: agent/conversation-manager.ts:59
Adds an assistant message to the conversation.
Parameters
Section titled “Parameters”content
Section titled “content”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IConversationManager.addAssistantMessage
addGadgetCallResult()
Section titled “addGadgetCallResult()”addGadgetCallResult(
gadgetName,parameters,result,invocationId,media?,mediaIds?):void
Defined in: agent/conversation-manager.ts:63
Adds a gadget call and its result to the conversation. The invocationId is shown to the LLM so it can reference previous calls when building dependencies. Optionally includes media outputs (images, audio, etc.) for multimodal results.
Parameters
Section titled “Parameters”gadgetName
Section titled “gadgetName”string
parameters
Section titled “parameters”Record<string, unknown>
result
Section titled “result”string
invocationId
Section titled “invocationId”string
media?
Section titled “media?”mediaIds?
Section titled “mediaIds?”string[]
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IConversationManager.addGadgetCallResult
addUserMessage()
Section titled “addUserMessage()”addUserMessage(
content):void
Defined in: agent/conversation-manager.ts:55
Adds a user message to the conversation. Supports multimodal content (text + images/audio).
Parameters
Section titled “Parameters”content
Section titled “content”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”IConversationManager.addUserMessage
getBaseMessages()
Section titled “getBaseMessages()”getBaseMessages():
LLMMessage[]
Defined in: agent/conversation-manager.ts:82
Gets the base messages (system prompts, gadget instructions). These are never compacted and always included at the start.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”IConversationManager.getBaseMessages
getConversationHistory()
Section titled “getConversationHistory()”getConversationHistory():
LLMMessage[]
Defined in: agent/conversation-manager.ts:105
Gets full conversation history including initial messages and runtime history. Used for REPL session continuation - returns everything except base (system) messages. This combines:
- initialMessages: History from previous sessions (set via withHistory())
- historyBuilder: Messages from the current session
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”IConversationManager.getConversationHistory
getHistoryMessages()
Section titled “getHistoryMessages()”getHistoryMessages():
LLMMessage[]
Defined in: agent/conversation-manager.ts:78
Gets only the conversation history messages (excludes base messages). Used by compaction to determine what can be compressed.
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”IConversationManager.getHistoryMessages
getMessages()
Section titled “getMessages()”getMessages():
LLMMessage[]
Defined in: agent/conversation-manager.ts:74
Gets the complete conversation history including base messages (system prompts, gadget instructions).
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”IConversationManager.getMessages
replaceHistory()
Section titled “replaceHistory()”replaceHistory(
newHistory):void
Defined in: agent/conversation-manager.ts:86
Replaces the conversation history with new messages. Used by compaction to update history after compression.
Parameters
Section titled “Parameters”newHistory
Section titled “newHistory”The compacted history messages to replace with
Returns
Section titled “Returns”void