Skip to content

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).

new ConversationManager(baseMessages, initialMessages, options): ConversationManager

Defined in: agent/conversation-manager.ts:35

LLMMessage[]

LLMMessage[]

ConversationManagerOptions = {}

ConversationManager

addAssistantMessage(content): void

Defined in: agent/conversation-manager.ts:59

Adds an assistant message to the conversation.

string

void

IConversationManager.addAssistantMessage


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.

string

Record<string, unknown>

string

string

GadgetMediaOutput[]

string[]

void

IConversationManager.addGadgetCallResult


addUserMessage(content): void

Defined in: agent/conversation-manager.ts:55

Adds a user message to the conversation. Supports multimodal content (text + images/audio).

MessageContent

void

IConversationManager.addUserMessage


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.

LLMMessage[]

IConversationManager.getBaseMessages


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

LLMMessage[]

IConversationManager.getConversationHistory


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.

LLMMessage[]

IConversationManager.getHistoryMessages


getMessages(): LLMMessage[]

Defined in: agent/conversation-manager.ts:74

Gets the complete conversation history including base messages (system prompts, gadget instructions).

LLMMessage[]

IConversationManager.getMessages


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.

LLMMessage[]

The compacted history messages to replace with

void

IConversationManager.replaceHistory