ConversationState
Manages session lifecycle: load, save, delete, message append, turn counting. Shared by Runtime and VoiceEngine.
Methods
Section titled “Methods”appendAssistantMessage()
Section titled “appendAssistantMessage()”appendAssistantMessage(session, text): void;Append an assistant message to the session history.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Section titled “Returns”void
appendMessage()
Section titled “appendMessage()”appendMessage(session, message): void;Append a raw ModelMessage to the session history.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Section titled “Returns”void
appendUserMessage()
Section titled “appendUserMessage()”appendUserMessage(session, text): void;Append a user message to the session history.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Section titled “Returns”void
bumpSessionTurn()
Section titled “bumpSessionTurn()”bumpSessionTurn(session): number;Increment and return the new turn number.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”number
createSession()
Section titled “createSession()”createSession( id, defaultAgentId, userId?, opts?): Session;Create a fresh session with defaults.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
Returns
Section titled “Returns”delete()
Section titled “delete()”delete(sessionId): Promise<void>;Delete a session from the backing store.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
Returns
Section titled “Returns”Promise<void>
getSessionTurn()
Section titled “getSessionTurn()”getSessionTurn(session): number;Get the current turn number for the session.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”number
load()
Section titled “load()”load(sessionId, userId?): Promise<Session>;Load an existing session or create a new one.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
|
|
|
|
Returns
Section titled “Returns”Promise<Session>
save()
Section titled “save()”save(session): Promise<void>;Persist session to the backing store.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”Promise<void>
touchSession()
Section titled “touchSession()”touchSession(session): void;Update the session’s updatedAt timestamp.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|
Returns
Section titled “Returns”void
workingMemory()
Section titled “workingMemory()”workingMemory(session): WorkingMemory;Get a WorkingMemory wrapper for the session.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
|
|