Skip to content

ConversationManager

Manages multi-turn conversation history for the LLM pipeline.

Defined in: src/core/collaborators/ConversationManager.ts:25

Manages multi-turn conversation history for the LLM pipeline.

Remarks

Handles accumulation of user and assistant messages, enforces the maxTurns limit, and builds I/O context messages that inform the LLM about the current interaction modality (voice vs text).

Constructors

Constructor

new ConversationManager(config?, logger?): ConversationManager;

Defined in: src/core/collaborators/ConversationManager.ts:28

Parameters

ParameterType
config?ConversationHistoryConfig
logger?Logger

Returns

ConversationManager

Accessors

enabled

Get Signature

get enabled(): boolean;

Defined in: src/core/collaborators/ConversationManager.ts:34

Whether conversation history is enabled in the configuration.

Returns

boolean

Methods

addAssistantMessage()

addAssistantMessage(text): void;

Defined in: src/core/collaborators/ConversationManager.ts:60

Add an assistant message to the conversation history.

Parameters

ParameterTypeDescription
textstringThe assistant’s response text.

Returns

void


addMessage()

addMessage(message): void;

Defined in: src/core/collaborators/ConversationManager.ts:75

Add an arbitrary message to the conversation history.

Parameters

ParameterTypeDescription
messageLLMMessageThe message to add.

Returns

void

Remarks

Used for tool-call messages (role: ‘assistant’ with toolCalls, or role: ‘tool’ with toolCallId) that don’t fit the simple user/assistant pattern.


addUserMessage()

addUserMessage(text, modality?): void;

Defined in: src/core/collaborators/ConversationManager.ts:44

Add a user message to the conversation history.

Parameters

ParameterTypeDescription
textstringThe user’s message text.
modality?"voice" | "text"How the message was input (‘voice’ or ‘text’).

Returns

void


buildIOContextMessage()

buildIOContextMessage(
   modality, 
   inputMuted, 
   outputMuted): LLMMessage;

Defined in: src/core/collaborators/ConversationManager.ts:114

Build an I/O context system message that tells the LLM about the current interaction modality.

Parameters

ParameterTypeDescription
modality"voice" | "text"How this specific message was input.
inputMutedbooleanWhether the microphone is currently muted.
outputMutedbooleanWhether audio output is currently muted.

Returns

LLMMessage

An LLMMessage with role ‘system’ describing the I/O context.


clear()

clear(): void;

Defined in: src/core/collaborators/ConversationManager.ts:100

Clears all accumulated conversation history.

Returns

void


getMessages()

getMessages(): LLMMessage[];

Defined in: src/core/collaborators/ConversationManager.ts:82

Returns a shallow copy of the current conversation history.

Returns

LLMMessage[]


getMessagesForLLM()

getMessagesForLLM(
   modality, 
   inputMuted, 
   outputMuted): LLMMessage[];

Defined in: src/core/collaborators/ConversationManager.ts:155

Get the full message list for an LLM call, including I/O context and conversation history.

Parameters

ParameterTypeDescription
modality"voice" | "text"How this specific message was input.
inputMutedbooleanWhether the microphone is currently muted.
outputMutedbooleanWhether audio output is currently muted.

Returns

LLMMessage[]

Array of LLMMessage ready to send to the LLM.


getMessagesRef()

getMessagesRef(): LLMMessage[];

Defined in: src/core/collaborators/ConversationManager.ts:93

Returns the raw internal history array (by reference).

Returns

LLMMessage[]

Remarks

Used by CompositeVoice when building message arrays for tool loops that need to mutate the array in place.

© 2026 CompositeVoice. All rights reserved.

Font size
Contrast
Motion
Transparency