Skip to content

xtalk-client


xtalk-client / Session

Interface: Session

Defined in: session/types.ts:86

Public session controller exposed by the frontend entrypoint.

Properties

muted

muted: boolean

Defined in: session/types.ts:126

Whether microphone capture is currently muted.


state

readonly state: object

Defined in: session/types.ts:104

Current conversation state snapshot.

caption

caption: string

connectionState

connectionState: "connected" | "reconnecting" | "disconnected"

latency

latency: object

latency.asr?

optional asr?: number

latency.llmFirstToken?

optional llmFirstToken?: number

latency.llmSentence?

optional llmSentence?: number

latency.network?

optional network?: number

latency.ttsFirstChunk?

optional ttsFirstChunk?: number

messages

messages: ConversationMessage[]

retrieval

retrieval: string

sessionId

sessionId: string | null

streamState

streamState: "idle" | "listening" | "processing" | "speaking"

thought

thought: string

tool_call

tool_call: object

tool_call.args

args: Record<string, any>

tool_call.name

name: string

user

user: ConversationUser | null

Methods

changeVoice()

changeVoice(voiceName): Promise<void>

Defined in: session/types.ts:132

Requests a voice change for subsequent assistant synthesis.

Parameters

voiceName

string

Target voice identifier.

Returns

Promise<void>


close()

close(): Promise<void>

Defined in: session/types.ts:94

Closes the active runtime connection and audio resources.

Returns

Promise<void>


getSessions()

getSessions(): Promise<SessionSummary[]>

Defined in: session/types.ts:143

Fetches available persisted sessions for the current user.

Returns

Promise<SessionSummary[]>


onFullAudioChunk()

onFullAudioChunk(callback): void

Defined in: session/types.ts:122

Registers a callback for merged full-duplex PCM chunks.

Parameters

callback

AudioChunkCallback

Full audio listener.

Returns

void


onInputAudioChunk()

onInputAudioChunk(callback): void

Defined in: session/types.ts:110

Registers a callback for microphone input PCM chunks.

Parameters

callback

AudioChunkCallback

Input audio listener.

Returns

void


onOutputAudioChunk()

onOutputAudioChunk(callback): void

Defined in: session/types.ts:116

Registers a callback for speaker output PCM chunks.

Parameters

callback

AudioChunkCallback

Output audio listener.

Returns

void


onStateChange()

onStateChange(callback): void

Defined in: session/types.ts:100

Registers a callback that runs whenever the conversation state changes.

Parameters

callback

(state) => void

State change listener.

Returns

void


open()

open(): Promise<void>

Defined in: session/types.ts:90

Opens the session runtime and performs authentication if needed.

Returns

Promise<void>


switchSession()

switchSession(sessionId): Promise<void>

Defined in: session/types.ts:149

Switches the active conversation to a persisted session or starts a new one.

Parameters

sessionId

string | null

Target session identifier, or null to start a new session.

Returns

Promise<void>


uploadFile()

uploadFile(file, endpoint?): Promise<void>

Defined in: session/types.ts:139

Uploads a file into the current session context.

Parameters

file

Blob

File blob to upload.

endpoint?

string | URL

Optional upload endpoint override.

Returns

Promise<void>