index
Classes
CapabilityNotSupportedError
Defined in: core/DelphiClient.ts:126
Extends
Error
Constructors
Constructor
new CapabilityNotSupportedError(capability: SessionMode, capabilities: RuntimeCapabilities): CapabilityNotSupportedError;
Defined in: core/DelphiClient.ts:129
Parameters
| Parameter | Type |
|---|---|
capability | SessionMode |
capabilities | RuntimeCapabilities |
Returns
Overrides
Error.constructor;
Properties
capabilities
readonly capabilities: RuntimeCapabilities;
Defined in: core/DelphiClient.ts:131
capability
readonly capability: SessionMode;
Defined in: core/DelphiClient.ts:130
name
readonly name: "CapabilityNotSupportedError" = "CapabilityNotSupportedError";
Defined in: core/DelphiClient.ts:127
Overrides
Error.name;
DelphiClient
Defined in: core/DelphiClient.ts:196
Top-level Delphi SDK orchestrator.
Manages session lifecycle (token acquisition, channel WebSocket, optional
WebRTC + SIP for voice), capability discovery, and high-level helpers like
readAloud() and startCall(). Sessions are long-lived per endpoint/mode
so repeated calls reuse the same connection without blocking simultaneous
modes like interpretation speaker + listener.
Zero runtime dependencies. Compatible with useSyncExternalStore.
Example
const delphi = new DelphiClient({apiDomain: 'api.example.com', apiKey: 'key'});
// 1) Quickstart
await delphi.readAloud('Hello, world!', {endpointId: 'ext-100'});
// 2) Power-user
const session = await delphi.openSession({endpointId: 'ext-100', mode: 'audio_playback'});
session.setBrowserContext({text: 'Page text…'});
session.sendBrowserAction({messageType: 'browser.action.readAloud'});
await session.audioDone();
await session.close();
// 3) Voice call
delphi.setRemoteAudioElement(audioRef.current);
const call = await delphi.startCall({endpointId: 'ext-100'});
call.sendReadAloud('Hello!');
await delphi.endCall();
Constructors
Constructor
new DelphiClient(config?: DelphiConfig): DelphiClient;
Defined in: core/DelphiClient.ts:209
Parameters
| Parameter | Type |
|---|---|
config | DelphiConfig |
Returns
Methods
assertCapability()
assertCapability(capabilities: RuntimeCapabilities, capability: SessionMode): void;
Defined in: core/DelphiClient.ts:513
Throws CapabilityNotSupportedError if unsupported.
Parameters
| Parameter | Type |
|---|---|
capabilities | RuntimeCapabilities |
capability | SessionMode |
Returns
void
assertEndpointCapability()
assertEndpointCapability(endpointId: string, capability: SessionMode): Promise<RuntimeCapabilities>;
Defined in: core/DelphiClient.ts:523
Convenience: fetch capabilities and assert support in one call.
Parameters
| Parameter | Type |
|---|---|
endpointId | string |
capability | SessionMode |
Returns
Promise<RuntimeCapabilities>
cancelReconnect()
cancelReconnect(): void;
Defined in: core/DelphiClient.ts:1270
Cancel an in-progress reconnect attempt (does NOT send SIP hangup).
Returns
void
clearDtmfDigits()
clearDtmfDigits(): void;
Defined in: core/DelphiClient.ts:1144
Returns
void
destroy()
destroy(): void;
Defined in: core/DelphiClient.ts:1285
Tear down everything. Call on component unmount.
Returns
void
downgradeToText()
downgradeToText(options: DowngradeToTextOptions): Promise<SessionClient>;
Defined in: core/DelphiClient.ts:1033
Downgrade an active voice session back to text on the same sessionId. Ends the WebRTC call by default so TelPhi can persist the transcript.
Parameters
| Parameter | Type |
|---|---|
options | DowngradeToTextOptions |
Returns
Promise<SessionClient>
enableAudio()
enableAudio(): Promise<void>;
Defined in: core/DelphiClient.ts:1149
Enable audio after a browser autoplay block
Returns
Promise<void>
endAllSessions()
endAllSessions(): Promise<void>;
Defined in: core/DelphiClient.ts:686
Close every active session.
Returns
Promise<void>
endCall()
endCall(): Promise<void>;
Defined in: core/DelphiClient.ts:1093
Hang up the active voice call (if any) and tear down WebRTC.
Returns
Promise<void>
endSession()
endSession(endpointId: string, mode?: SessionMode): Promise<void>;
Defined in: core/DelphiClient.ts:671
Close the session(s) for an endpoint (no-op if none open).
Parameters
| Parameter | Type |
|---|---|
endpointId | string |
mode? | SessionMode |
Returns
Promise<void>
getCapabilities()
getCapabilities(endpointId: string): Promise<RuntimeCapabilities>;
Defined in: core/DelphiClient.ts:468
Discover which runtime modes and transports an endpoint supports.
Parameters
| Parameter | Type |
|---|---|
endpointId | string |
Returns
Promise<RuntimeCapabilities>
getConfig()
getConfig(): Readonly<DelphiConfig>;
Defined in: core/DelphiClient.ts:233
Return a read-only copy of the current runtime config
Returns
Readonly<DelphiConfig>
getSession()
getSession(endpointId: string, mode?: SessionMode): SessionClient | null;
Defined in: core/DelphiClient.ts:658
Returns the existing SessionClient for an endpoint/mode, or null. No I/O.
Parameters
| Parameter | Type |
|---|---|
endpointId | string |
mode? | SessionMode |
Returns
SessionClient | null
getSessionToken()
getSessionToken(endpointId: string, mode: SessionMode): Promise<SessionTokenResponse>;
Defined in: core/DelphiClient.ts:253
Request a session token from TelAPI.
Hits POST {apiDomain}/api/v1/sessions/token (or sessionTokenUrl if
configured for same-origin proxying).
Parameters
| Parameter | Type |
|---|---|
endpointId | string |
mode | SessionMode |
Returns
Promise<SessionTokenResponse>
getState()
getState(): Readonly<DelphiClientState>;
Defined in: core/DelphiClient.ts:228
Return a stable snapshot of the current state
Returns
Readonly<DelphiClientState>
hasCapability()
hasCapability(capabilities: RuntimeCapabilities, capability: SessionMode): boolean;
Defined in: core/DelphiClient.ts:505
Check whether already-fetched endpoint capabilities support an interaction mode.
Parameters
| Parameter | Type |
|---|---|
capabilities | RuntimeCapabilities |
capability | SessionMode |
Returns
boolean
listen()
listen(options: ListenOptions): Promise<SessionClient>;
Defined in: core/DelphiClient.ts:772
Open a listener session and subscribe it to an interpretation stream.
Parameters
| Parameter | Type |
|---|---|
options | ListenOptions |
Returns
Promise<SessionClient>
openSession()
openSession(options: OpenSessionOptions): Promise<SessionClient>;
Defined in: core/DelphiClient.ts:547
Find-or-create a session for an endpoint/mode pair.
Calls with the same endpoint and mode reuse the open session. Different modes for the same endpoint are kept separate so a voice speaker and an interpretation listener can run side by side.
The returned SessionClient is fully connected (or in the process of
connecting; getState().connectionState will transition through
'connecting' → 'connected').
Parameters
| Parameter | Type |
|---|---|
options | OpenSessionOptions |
Returns
Promise<SessionClient>
openSessionWithToken()
openSessionWithToken(options: OpenSessionOptions & {
token: SessionTokenResponse;
}): Promise<SessionClient>;
Defined in: core/DelphiClient.ts:391
Open a session from an already-issued token (used after text→voice upgrade).
Parameters
| Parameter | Type |
|---|---|
options | OpenSessionOptions & { token: SessionTokenResponse; } |
Returns
Promise<SessionClient>
readAloud()
readAloud(text: string, options: ReadAloudOptions): Promise<BrowserAudioEvent>;
Defined in: core/DelphiClient.ts:704
One-shot read-aloud. Find-or-create an audio_playback session for the
endpoint, send a browser_action: readAloud, and resolve when the
runtime finishes streaming the audio.
The session stays open after this resolves so subsequent calls reuse
the same WebSocket. Use delphi.endSession(endpointId) (or rely on
the configurable idle timeout) to close it.
Parameters
| Parameter | Type |
|---|---|
text | string |
options | ReadAloudOptions |
Returns
Promise<BrowserAudioEvent>
reconnectCall()
reconnectCall(state: PersistedSessionState): Promise<void>;
Defined in: core/DelphiClient.ts:1175
Reconnect a previously-saved voice call.
Parameters
| Parameter | Type |
|---|---|
state | PersistedSessionState |
Returns
Promise<void>
requestSessionDowngrade()
requestSessionDowngrade(sessionId: string, endpointId: string): Promise<SessionTokenResponse>;
Defined in: core/DelphiClient.ts:345
Downgrade an active voice session back to text on the same sessionId.
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
endpointId | string |
Returns
Promise<SessionTokenResponse>
requestSessionUpgrade()
requestSessionUpgrade(sessionId: string, endpointId: string): Promise<SessionTokenResponse>;
Defined in: core/DelphiClient.ts:299
Upgrade an active text session to voice, preserving FlowEngine context.
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
endpointId | string |
Returns
Promise<SessionTokenResponse>
restorePersistedCall()
restorePersistedCall(): PersistedSessionState | null;
Defined in: core/DelphiClient.ts:1170
Check sessionStorage for a persisted voice-call state from the previous page load.
Returns
PersistedSessionState | null
sendDtmf()
sendDtmf(digit: string): Promise<void>;
Defined in: core/DelphiClient.ts:1126
Send a DTMF tone over the active voice call (no-op if not in a call).
Parameters
| Parameter | Type |
|---|---|
digit | string |
Returns
Promise<void>
setLocalAudioElement()
setLocalAudioElement(el: HTMLAudioElement | null): void;
Defined in: core/DelphiClient.ts:1121
Parameters
| Parameter | Type |
|---|---|
el | HTMLAudioElement | null |
Returns
void
setRemoteAudioElement()
setRemoteAudioElement(el: HTMLAudioElement | null): void;
Defined in: core/DelphiClient.ts:1109
Wire the remote <audio> element. Safe to call before startCall()
— if a remote stream has already arrived (race between pc.ontrack
and the React ref attaching), it is connected immediately.
Parameters
| Parameter | Type |
|---|---|
el | HTMLAudioElement | null |
Returns
void
setSelectedText()
setSelectedText(text: string): void;
Defined in: core/DelphiClient.ts:1161
Track the user's current text selection (for AI read-aloud feature)
Parameters
| Parameter | Type |
|---|---|
text | string |
Returns
void
startCall()
startCall(options: StartCallOptions): Promise<SessionClient>;
Defined in: core/DelphiClient.ts:881
Open a voice-conversation session and bring up the WebRTC gateway +
SIP leg on top of it. Returns the underlying SessionClient. Call
endCall() (or session.close()) to hang up and tear down WebRTC.
Parameters
| Parameter | Type |
|---|---|
options | StartCallOptions |
Returns
Promise<SessionClient>
subscribe()
subscribe(listener: () => void): () => void;
Defined in: core/DelphiClient.ts:222
Subscribe to all state changes. Returns an unsubscribe function.
Parameters
| Parameter | Type |
|---|---|
listener | () => void |
Returns
() => void
updateConfig()
updateConfig(config: DelphiConfig): void;
Defined in: core/DelphiClient.ts:238
Update the runtime config (also re-binds the logger).
Parameters
| Parameter | Type |
|---|---|
config | DelphiConfig |
Returns
void
upgradeToVoice()
upgradeToVoice(options: UpgradeToVoiceOptions): Promise<SessionClient>;
Defined in: core/DelphiClient.ts:961
Migrate an active text session to voice_conversation on the same
sessionId, then bring up WebRTC. Requires an open text session first
(openSession({ mode: 'text' })).
Parameters
| Parameter | Type |
|---|---|
options | UpgradeToVoiceOptions |
Returns
Promise<SessionClient>
ReadAloudCapabilityNotFoundError
Defined in: core/DelphiClient.ts:140
Extends
Error
Constructors
Constructor
new ReadAloudCapabilityNotFoundError(endpointId: string): ReadAloudCapabilityNotFoundError;
Defined in: core/DelphiClient.ts:142
Parameters
| Parameter | Type |
|---|---|
endpointId | string |
Returns
ReadAloudCapabilityNotFoundError
Overrides
Error.constructor;
Properties
name
readonly name: "ReadAloudCapabilityNotFoundError" = "ReadAloudCapabilityNotFoundError";
Defined in: core/DelphiClient.ts:141
Overrides
Error.name;
SessionClient
Defined in: core/SessionClient.ts:183
Headless WebSocket session client.
Owns the persistent channel between the browser and the AI runtime
(telapi → telphi/ARI) for one session. A session is a server-issued
abstraction (sessionId) that scopes rate limiting, conversation
history, and audio routing.
Sessions come in different modes (text, audio_playback,
voice_conversation, browser_actions) but the wire protocol is
identical — the mode just tells the runtime what to do with messages
(e.g. stream audio back vs. route it over a SIP leg).
Zero runtime dependencies. Compatible with useSyncExternalStore.
Example
const session = new SessionClient({onAction: myHandler});
session.connect(sessionId, wsToken, 'wss://api.example.com');
session.sendBrowserAction({messageType: 'browser.action.readAloud', text: '…'});
await session.audioDone();
await session.close();
Constructors
Constructor
new SessionClient(options?: SessionOptions): SessionClient;
Defined in: core/SessionClient.ts:252
Parameters
| Parameter | Type |
|---|---|
options | SessionOptions |
Returns
Methods
audioDone()
audioDone(responseId?: string): Promise<BrowserAudioEvent>;
Defined in: core/SessionClient.ts:743
Wait for the next completed logical audio response from the runtime.
If responseId is supplied, resolves when that playable segment completes,
or when a segmented request with that requestId reaches its final segment.
Without an id, segmented audio resolves only on the final segment so
readAloud() callers do not have to manage sentence chunks.
Parameters
| Parameter | Type |
|---|---|
responseId? | string |
Returns
Promise<BrowserAudioEvent>
clearMessages()
clearMessages(): void;
Defined in: core/SessionClient.ts:449
Clear the visible message history and the persisted resume cursor.
Returns
void
close()
close(): Promise<void>;
Defined in: core/SessionClient.ts:392
Close the session: disconnect, reject pending audio waiters, fire onClose
callbacks, and prevent any further reconnection.
Returns
Promise<void>
connect()
connect(
sessionId: string,
wsToken: string,
wsUrl?: string): void;
Defined in: core/SessionClient.ts:296
Connect to the channel WebSocket for a previously-issued session.
Parameters
| Parameter | Type | Description |
|---|---|---|
sessionId | string | Session ID from the session-token response |
wsToken | string | WebSocket authentication token |
wsUrl? | string | Base WebSocket URL (e.g. wss://api.example.com) |
Returns
void
disableTextChat()
disableTextChat(): boolean;
Defined in: core/SessionClient.ts:655
Disable text-chat mode (AI returns to voice-only)
Returns
boolean
disconnect()
disconnect(): void;
Defined in: core/SessionClient.ts:370
Gracefully disconnect. Does not attempt reconnection.
Returns
void
Deprecated
Prefer close() for new code; disconnect is kept for cases
where you want to disconnect without de-registering from a parent map.
enableTextChat()
enableTextChat(responseMode?: ResponseMode): boolean;
Defined in: core/SessionClient.ts:646
Enable text-chat mode (AI will respond to text messages)
Parameters
| Parameter | Type | Default value |
|---|---|---|
responseMode | ResponseMode | "text" |
Returns
boolean
getState()
getState(): Readonly<SessionState>;
Defined in: core/SessionClient.ts:275
Return a stable snapshot of the current state
Returns
Readonly<SessionState>
importMessages()
importMessages(messages: ChannelMessage[]): void;
Defined in: core/SessionClient.ts:462
Prepend prior channel messages (e.g. after text→voice upgrade).
Parameters
| Parameter | Type |
|---|---|
messages | ChannelMessage[] |
Returns
void
listen()
listen(options: SessionListenOptions): boolean;
Defined in: core/SessionClient.ts:626
Subscribe this session to a TelPhi-produced interpretation stream.
The listener is matched by identifier plus an endpoint/app scoped
scope (usually the endpointId). TelAPI replays cached stream items and
then forwards new items as they are produced.
Parameters
| Parameter | Type |
|---|---|
options | SessionListenOptions |
Returns
boolean
onClose()
onClose(callback: () => void): () => void;
Defined in: core/SessionClient.ts:280
Register a callback fired exactly once when the session closes for any reason.
Parameters
| Parameter | Type |
|---|---|
callback | () => void |
Returns
() => void
sendActionProgress()
sendActionProgress(actionId: string, status: "received" | "executing"): boolean;
Defined in: core/SessionClient.ts:694
Send a progress update for an in-flight async action
Parameters
| Parameter | Type |
|---|---|
actionId | string |
status | "received" | "executing" |
Returns
boolean
sendActionUpdateChat()
sendActionUpdateChat(
actionId: string,
content: string,
metadata?: Record<string, unknown>): boolean;
Defined in: core/SessionClient.ts:705
Send an async action update via the chat flow
Parameters
| Parameter | Type |
|---|---|
actionId | string |
content | string |
metadata? | Record<string, unknown> |
Returns
boolean
sendAsyncActionResult()
sendAsyncActionResult(
actionId: string,
success: boolean,
options?: {
data?: unknown;
durationMs?: number;
error?: string;
}): boolean;
Defined in: core/SessionClient.ts:677
Send the final result of an async browser action
Parameters
| Parameter | Type |
|---|---|
actionId | string |
success | boolean |
options | { data?: unknown; durationMs?: number; error?: string; } |
options.data? | unknown |
options.durationMs? | number |
options.error? | string |
Returns
boolean
sendBrowserAction()
sendBrowserAction(payload: BrowserActionPayload): boolean;
Defined in: core/SessionClient.ts:599
Trigger a browser-originated capability side flow (e.g. read-aloud, transform-and-read, custom BOA flows).
The top-level channel type stays 'browser_action'; the payload's
messageType carries the flow trigger (for example
'browser.action.readAloud'). When capabilityId is omitted, the
runtime resolves the BOA itself (typically picks the first matching
one configured on the endpoint).
Parameters
| Parameter | Type |
|---|---|
payload | BrowserActionPayload |
Returns
boolean
sendChat()
sendChat(content: string, options?: {
intent?: | "conversation"
| "notification"
| "context_update"
| "browser_context"
| "action_update"
| "read_aloud";
metadata?: Record<string, unknown>;
preferredResponse?: ResponseMode;
responseExpected?: boolean;
}): boolean;
Defined in: core/SessionClient.ts:479
Send a chat message with full control over response behaviour.
Parameters
| Parameter | Type |
|---|---|
content | string |
options | { intent?: | "conversation" | "notification" | "context_update" | "browser_context" | "action_update" | "read_aloud"; metadata?: Record<string, unknown>; preferredResponse?: ResponseMode; responseExpected?: boolean; } |
options.intent? | | "conversation" | "notification" | "context_update" | "browser_context" | "action_update" | "read_aloud" |
options.metadata? | Record<string, unknown> |
options.preferredResponse? | ResponseMode |
options.responseExpected? | boolean |
Returns
boolean
sendContextUpdate()
sendContextUpdate(content: string, metadata?: Record<string, unknown>): boolean;
Defined in: core/SessionClient.ts:511
Send a context-only update — no AI response expected. Use for: async action completed, background state changes.
Parameters
| Parameter | Type |
|---|---|
content | string |
metadata? | Record<string, unknown> |
Returns
boolean
sendMessage()
sendMessage(partial: Partial<ChannelMessage>): boolean;
Defined in: core/SessionClient.ts:722
Send a raw / custom message
Parameters
| Parameter | Type |
|---|---|
partial | Partial<ChannelMessage> |
Returns
boolean
sendReadAloud()
sendReadAloud(content: string, metadata?: Record<string, unknown>): boolean;
Defined in: core/SessionClient.ts:579
Send a read-aloud request — expects a voice response from AI.
Parameters
| Parameter | Type |
|---|---|
content | string |
metadata? | Record<string, unknown> |
Returns
boolean
sendTextChat()
sendTextChat(content: string, metadata?: Record<string, unknown>): boolean;
Defined in: core/SessionClient.ts:569
Send a text chat — expects a text response from AI.
Parameters
| Parameter | Type |
|---|---|
content | string |
metadata? | Record<string, unknown> |
Returns
boolean
setBrowserContext()
setBrowserContext(browserContext: BrowserContext): boolean;
Defined in: core/SessionClient.ts:533
Set durable browser context without invoking an action or AI response.
Use to keep the AI aware of what the user is currently looking at: page text, current route, open modal, highlighted selection, etc. The runtime stores this as the "current" browser context for the session and feeds it into subsequent AI turns.
Parameters
| Parameter | Type |
|---|---|
browserContext | BrowserContext |
Returns
boolean
setMetadata()
setMetadata(meta: {
endpointId: string;
mode: SessionMode;
}): void;
Defined in: core/SessionClient.ts:360
Set the metadata describing this session (mode + endpointId).
Surfaced through getState() for UIs to introspect.
Parameters
| Parameter | Type |
|---|---|
meta | { endpointId: string; mode: SessionMode; } |
meta.endpointId | string |
meta.mode | SessionMode |
Returns
void
setResponseMode()
setResponseMode(responseMode: ResponseMode): boolean;
Defined in: core/SessionClient.ts:670
Switch the AI output modality.
'text' — AI responds with text only (Option A: no audio, user can still speak).
'voice' — AI responds with audio (normal realtime mode).
'both' — AI responds with both audio and text simultaneously.
Parameters
| Parameter | Type |
|---|---|
responseMode | ResponseMode |
Returns
boolean
setSelectionContext()
setSelectionContext(selection: BrowserContext): boolean;
Defined in: core/SessionClient.ts:559
Set durable browser selection context without invoking an action or AI response.
Convenience wrapper around setBrowserContext() that defaults
source to 'selection'.
Parameters
| Parameter | Type |
|---|---|
selection | BrowserContext |
Returns
boolean
Deprecated
Prefer setBrowserContext() for new integrations.
stopAudioPlayback()
stopAudioPlayback(): void;
Defined in: core/SessionClient.ts:768
Stop the current browser audio blob and clear queued blobs. Incoming segments for the same in-flight server request can still enqueue again.
Returns
void
subscribe()
subscribe(listener: () => void): () => void;
Defined in: core/SessionClient.ts:269
Subscribe to state changes.
Parameters
| Parameter | Type |
|---|---|
listener | () => void |
Returns
An unsubscribe function.
() => void
touch()
touch(): void;
Defined in: core/SessionClient.ts:468
Reset the idle-timeout clock without sending anything.
Returns
void
updateOptions()
updateOptions(options: Partial<SessionOptions>): void;
Defined in: core/SessionClient.ts:444
Update callback options at runtime (e.g. after reconnect with new handlers)
Parameters
| Parameter | Type |
|---|---|
options | Partial<SessionOptions> |
Returns
void
Interfaces
ActionPayload
Defined in: core/channelTypes.ts:158
Action request payload (ARI → Browser)
Properties
actionId
actionId: string;
Defined in: core/channelTypes.ts:159
description?
optional description?: string;
Defined in: core/channelTypes.ts:166
name
name: string;
Defined in: core/channelTypes.ts:161
Action name, e.g. navigate, fill_form
parameters
parameters: Record<string, unknown>;
Defined in: core/channelTypes.ts:162
priority?
optional priority?: ActionPriority;
Defined in: core/channelTypes.ts:165
requiresResponse
requiresResponse: boolean;
Defined in: core/channelTypes.ts:163
timeoutMs?
optional timeoutMs?: number;
Defined in: core/channelTypes.ts:164
ActionResultPayload
Defined in: core/channelTypes.ts:175
Action result payload (Browser → ARI). Supports both synchronous and asynchronous actions.
Properties
actionId
actionId: string;
Defined in: core/channelTypes.ts:176
data?
optional data?: unknown;
Defined in: core/channelTypes.ts:179
durationMs?
optional durationMs?: number;
Defined in: core/channelTypes.ts:181
error?
optional error?: string;
Defined in: core/channelTypes.ts:180
isFinal?
optional isFinal?: boolean;
Defined in: core/channelTypes.ts:183
true means the action is complete (no more updates expected)
status?
optional status?: ActionStatus;
Defined in: core/channelTypes.ts:177
success
success: boolean;
Defined in: core/channelTypes.ts:178
AsyncActionResult
Defined in: core/SessionClient.ts:53
Async action result — call sendAsyncActionResult() when the action finishes.
Properties
async
async: true;
Defined in: core/SessionClient.ts:54
message?
optional message?: string;
Defined in: core/SessionClient.ts:55
AudioPayload
Defined in: core/channelTypes.ts:198
Properties
delta?
optional delta?: string;
Defined in: core/channelTypes.ts:200
event
event: 'start' | 'delta' | 'done';
Defined in: core/channelTypes.ts:199
index?
optional index?: number;
Defined in: core/channelTypes.ts:211
isFinal?
optional isFinal?: boolean;
Defined in: core/channelTypes.ts:210
True on the final playable segment for the logical request.
metadata?
optional metadata?: Record<string, unknown>;
Defined in: core/channelTypes.ts:212
mimeType?
optional mimeType?: string;
Defined in: core/channelTypes.ts:201
requestId?
optional requestId?: string;
Defined in: core/channelTypes.ts:204
Stable id shared by all audio segments for one logical request.
responseId?
optional responseId?: string;
Defined in: core/channelTypes.ts:202
segmentCount?
optional segmentCount?: number;
Defined in: core/channelTypes.ts:208
Total number of playable segments for the logical request, when known.
segmentIndex?
optional segmentIndex?: number;
Defined in: core/channelTypes.ts:206
Zero-based segment number when a logical request is split into multiple playable files.
BrowserActionAsyncResult
Defined in: core/browserActions.ts:48
Async indicator — the action will complete later.
Call sendAsyncActionResult() on the SessionClient once done.
Properties
async
async: true;
Defined in: core/browserActions.ts:49
message?
optional message?: string;
Defined in: core/browserActions.ts:50
BrowserActionPayload
Defined in: core/channelTypes.ts:186
Properties
capabilityId?
optional capabilityId?: string;
Defined in: core/channelTypes.ts:189
Optional; when omitted, the runtime may resolve the first matching capability.
capabilitySlug?
optional capabilitySlug?: string;
Defined in: core/channelTypes.ts:190
data?
optional data?: Record<string, unknown>;
Defined in: core/channelTypes.ts:195
identifier?
optional identifier?: string;
Defined in: core/channelTypes.ts:191
messageType
messageType: string;
Defined in: core/channelTypes.ts:187
text?
optional text?: string;
Defined in: core/channelTypes.ts:192
title?
optional title?: string;
Defined in: core/channelTypes.ts:194
url?
optional url?: string;
Defined in: core/channelTypes.ts:193
BrowserActionSyncResult
Defined in: core/browserActions.ts:38
Synchronous return value from a browser action.
Properties
data?
optional data?: unknown;
Defined in: core/browserActions.ts:40
error?
optional error?: string;
Defined in: core/browserActions.ts:41
success
success: boolean;
Defined in: core/browserActions.ts:39
BrowserAudioEvent
Defined in: core/SessionClient.ts:66
A fully-assembled audio response from the runtime.
Emitted from SessionClient.onAudio after the runtime has finished streaming
a start → delta* → done cycle.
Properties
dataUrl
dataUrl: string;
Defined in: core/SessionClient.ts:79
data:<mimeType>;base64,<concatenated chunks> URL ready to feed into <audio> or new Audio().
isFinal?
optional isFinal?: boolean;
Defined in: core/SessionClient.ts:76
True when this event completes the logical request.
metadata?
optional metadata?: Record<string, unknown>;
Defined in: core/SessionClient.ts:82
mimeType
mimeType: string;
Defined in: core/SessionClient.ts:77
requestId?
optional requestId?: string;
Defined in: core/SessionClient.ts:70
Stable id shared by all audio segments for one logical request.
responseId
responseId: string;
Defined in: core/SessionClient.ts:68
Server-issued response id; correlates to one playable audio segment.
segmentCount?
optional segmentCount?: number;
Defined in: core/SessionClient.ts:74
Total number of playable segments for the logical request, when known.
segmentIndex?
optional segmentIndex?: number;
Defined in: core/SessionClient.ts:72
Zero-based segment number within the logical request.
segments?
optional segments?: BrowserAudioEvent[];
Defined in: core/SessionClient.ts:81
All segments completed so far for this logical request, present on final grouped events.
BrowserContext
Defined in: core/channelTypes.ts:127
Durable browser context published by the host page via setBrowserContext.
Lets the AI know current location, readiness, and where it can navigate (BTA).
Properties
identifier?
optional identifier?: string;
Defined in: core/channelTypes.ts:129
metadata?
optional metadata?: Record<string, unknown>;
Defined in: core/channelTypes.ts:142
navigation?
optional navigation?: BrowserNavigationCatalog;
Defined in: core/channelTypes.ts:141
Where the AI may navigate next
readyState?
optional readyState?: BrowserReadyState;
Defined in: core/channelTypes.ts:138
Whether the current view is usable after navigation
readyStateDetail?
optional readyStateDetail?: string;
Defined in: core/channelTypes.ts:139
role?
optional role?: string;
Defined in: core/channelTypes.ts:130
source?
optional source?: string;
Defined in: core/channelTypes.ts:134
e.g. route_change | page_ready | search | selection
sourceLanguage?
optional sourceLanguage?: string;
Defined in: core/channelTypes.ts:131
targetLanguage?
optional targetLanguage?: string;
Defined in: core/channelTypes.ts:132
text?
optional text?: string;
Defined in: core/channelTypes.ts:128
title?
optional title?: string;
Defined in: core/channelTypes.ts:136
url?
optional url?: string;
Defined in: core/channelTypes.ts:135
BrowserNavigationCatalog
Defined in: core/channelTypes.ts:116
Page-advertised navigation targets (links / search results).
Properties
links?
optional links?: BrowserNavigationLink[];
Defined in: core/channelTypes.ts:118
Stable site map or current page affordances
searchQuery?
optional searchQuery?: string;
Defined in: core/channelTypes.ts:119
searchResults?
optional searchResults?: BrowserNavigationLink & {
score?: number;
snippet?: string;
}[];
Defined in: core/channelTypes.ts:120
BrowserNavigationLink
Defined in: core/channelTypes.ts:108
Properties
description?
optional description?: string;
Defined in: core/channelTypes.ts:111
id?
optional id?: string;
Defined in: core/channelTypes.ts:112
title?
optional title?: string;
Defined in: core/channelTypes.ts:110
url
url: string;
Defined in: core/channelTypes.ts:109
ChannelMessage
Defined in: core/channelTypes.ts:242
Channel message envelope. All messages between browser ↔ telapi ↔ telphi follow this structure.
Properties
action?
optional action?: ActionPayload;
Defined in: core/channelTypes.ts:254
actionResult?
optional actionResult?: ActionResultPayload;
Defined in: core/channelTypes.ts:255
audio?
optional audio?: AudioPayload;
Defined in: core/channelTypes.ts:256
browserAction?
optional browserAction?: BrowserActionPayload;
Defined in: core/channelTypes.ts:253
chat?
optional chat?: ChatPayload;
Defined in: core/channelTypes.ts:252
control?
optional control?: ControlPayload;
Defined in: core/channelTypes.ts:258
direction
direction: MessageDirection;
Defined in: core/channelTypes.ts:250
error?
optional error?: ErrorPayload;
Defined in: core/channelTypes.ts:260
messageId
messageId: string;
Defined in: core/channelTypes.ts:246
reconnect?
optional reconnect?: ReconnectPayload;
Defined in: core/channelTypes.ts:259
sessionId
sessionId: string;
Defined in: core/channelTypes.ts:245
Server-issued session ID. Carries every message on the wire.
status?
optional status?: StatusPayload;
Defined in: core/channelTypes.ts:257
streamId?
optional streamId?: string;
Defined in: core/channelTypes.ts:248
Redis Stream entry id for replayable runtime-to-browser messages.
timestamp
timestamp: number;
Defined in: core/channelTypes.ts:249
type
type: ChannelMessageType;
Defined in: core/channelTypes.ts:243
ChatPayload
Defined in: core/channelTypes.ts:80
Chat message payload (bidirectional).
Browser → ARI: only processed by AI if text_chat is enabled,
or if responseExpected is explicitly set.
ARI → Browser: always delivered.
Properties
content
content: string;
Defined in: core/channelTypes.ts:82
intent?
optional intent?:
| "conversation"
| "notification"
| "context_update"
| "browser_context"
| "action_update"
| "read_aloud";
Defined in: core/channelTypes.ts:83
metadata?
optional metadata?: Record<string, unknown>;
Defined in: core/channelTypes.ts:102
preferredResponse?
optional preferredResponse?: ResponseMode;
Defined in: core/channelTypes.ts:99
If responseExpected is true, which channel should AI use to respond?
relatedActionId?
optional relatedActionId?: string;
Defined in: core/channelTypes.ts:101
Correlates an async action update to the original action
responseExpected?
optional responseExpected?: boolean;
Defined in: core/channelTypes.ts:95
When true — AI MUST respond (overrides textChatEnabled state).
When false — AI should NOT respond (context update only).
When undefined — follow default rules.
role
role: MessageRole;
Defined in: core/channelTypes.ts:81
ControlPayload
Defined in: core/channelTypes.ts:148
Control message payload (Browser → ARI)
Properties
command
command: ControlCommand;
Defined in: core/channelTypes.ts:149
metadata?
optional metadata?: Record<string, unknown>;
Defined in: core/channelTypes.ts:154
settings?
optional settings?: {
responseMode?: ResponseMode;
sessionTimeout?: number;
};
Defined in: core/channelTypes.ts:150
responseMode?
optional responseMode?: ResponseMode;
sessionTimeout?
optional sessionTimeout?: number;
CustomBrowserActionParameters
Defined in: core/browserActions.ts:30
Indexable
[key: string]: unknown
Properties
type?
optional type?: string;
Defined in: core/browserActions.ts:31
DelphiClientState
Defined in: core/DelphiClient.ts:40
Public snapshot of the DelphiClient's state.
Shaped for useSyncExternalStore. The active voice-call session (if any)
lives in voiceCall; all other sessions are tracked anonymously in
sessions (a flattened, serialisable view of the internal session map).
Properties
selectedText
selectedText: string;
Defined in: core/DelphiClient.ts:73
Free-form text the user has highlighted in the page
sessions
sessions: readonly {
connected: boolean;
endpointId: string;
lastActivityAt: number;
mode: SessionMode;
sessionId: string;
}[];
Defined in: core/DelphiClient.ts:65
Read-only view of every active session keyed internally by endpointId + mode.
status
status: string;
Defined in: core/DelphiClient.ts:63
Human-readable phase string for UIs
voiceCall
voiceCall: {
appName: string;
audioBlocked: boolean;
autoDialPending: boolean;
calling: boolean;
dtmfDigits: string;
endpointId: string;
endpointName: string;
inCall: boolean;
initialized: boolean;
reconnecting: boolean;
registered: boolean;
sessionId: string | null;
telproDomain: string | null;
webrtcGatewayUrl: string | null;
}
Defined in: core/DelphiClient.ts:42
appName
appName: string;
audioBlocked
audioBlocked: boolean;
autoDialPending
autoDialPending: boolean;
calling
calling: boolean;
dtmfDigits
dtmfDigits: string;
endpointId
endpointId: string;
endpointName
endpointName: string;
inCall
inCall: boolean;
initialized
initialized: boolean;
reconnecting
reconnecting: boolean;
registered
registered: boolean;
sessionId
sessionId: string | null;
telproDomain
telproDomain: string | null;
webrtcGatewayUrl
webrtcGatewayUrl: string | null;
WebSocket URL to the WebRTC gateway, captured from the active
session token. null outside of a voice_conversation session.
DelphiConfig
Defined in: core/types.ts:54
Configuration object for the Delphi client.
Pass this once when constructing DelphiClient or via <DelphiClientProvider config={…}>.
Properties
apiDomain?
optional apiDomain?: string;
Defined in: core/types.ts:56
TelAPI domain (e.g. api.example.com) — used for REST + WebSocket URLs
apiKey?
optional apiKey?: string;
Defined in: core/types.ts:58
API key for authenticating session-token requests
iceServers?
optional iceServers?: IceServer[];
Defined in: core/types.ts:75
If set and non-empty, used as the full ICE server list for RTCPeerConnection.
If omitted or empty, STUN/TURN URLs are built from the session token's
telproDomain (host telproDomain, port 3478) plus turnUsername
and turnCredential.
logger?
optional logger?: Logger;
Defined in: core/types.ts:89
Custom logger — defaults to console
preferPcma?
optional preferPcma?: boolean;
Defined in: core/types.ts:68
Prefer PCMA (G.711 A-law) over Opus when negotiating the SIP leg. Skips transcoding on the WebRTC gateway / RTP engine.
Default
true;
runtimeCapabilitiesUrl?
optional runtimeCapabilitiesUrl?: string;
Defined in: core/types.ts:62
Optional same-origin proxy endpoint for runtime capability discovery
sessionIdleTimeoutMs?
optional sessionIdleTimeoutMs?: number;
Defined in: core/types.ts:87
Idle timeout (ms) for non-voice sessions. The clock resets on every outbound send and every inbound message. Voice sessions ignore this.
Set to 0 to disable.
Default
300_000 (5 minutes)
sessionTokenUrl?
optional sessionTokenUrl?: string;
Defined in: core/types.ts:60
Optional same-origin proxy endpoint for session-token requests
turnCredential?
optional turnCredential?: string;
Defined in: core/types.ts:79
TURN long-term password when ICE is auto-derived from telproDomain
turnUsername?
optional turnUsername?: string;
Defined in: core/types.ts:77
TURN long-term username when ICE is auto-derived from telproDomain (coturn static-auth)
DelphiPhoneProps
Defined in: core/types.ts:265
Properties
onNavigate?
optional onNavigate?: (path: string) => void;
Defined in: core/types.ts:267
Optional SPA-router callback; falls back to the History API when omitted
Parameters
| Parameter | Type |
|---|---|
path | string |
Returns
void
DowngradeToTextOptions
Defined in: core/types.ts:215
Parameters for delphi.downgradeToText() — continues a voice session as text chat.
Properties
appName?
optional appName?: string;
Defined in: core/types.ts:218
endCallFirst?
optional endCallFirst?: boolean;
Defined in: core/types.ts:220
End the active WebRTC call before downgrading. Default true.
endpointId
endpointId: string;
Defined in: core/types.ts:216
endpointName?
optional endpointName?: string;
Defined in: core/types.ts:217
ErrorPayload
Defined in: core/channelTypes.ts:228
Error payload
Properties
code
code: string;
Defined in: core/channelTypes.ts:229
details?
optional details?: unknown;
Defined in: core/channelTypes.ts:231
message
message: string;
Defined in: core/channelTypes.ts:230
ExecuteBrowserActionOptions
Defined in: core/browserActions.ts:65
Properties
customHandlers?
optional customHandlers?: Record<string, BrowserActionHandler>;
Defined in: core/browserActions.ts:67
onNavigate?
optional onNavigate?: NavigateCallback;
Defined in: core/browserActions.ts:66
onUnknownAction?
optional onUnknownAction?: BrowserActionHandler;
Defined in: core/browserActions.ts:68
ListenOptions
Defined in: core/types.ts:176
Properties
capabilityId?
optional capabilityId?: string;
Defined in: core/types.ts:185
capabilitySlug?
optional capabilitySlug?: string;
Defined in: core/types.ts:186
endpointId
endpointId: string;
Defined in: core/types.ts:177
identifier
identifier: string;
Defined in: core/types.ts:178
includeCaptions?
optional includeCaptions?: boolean;
Defined in: core/types.ts:184
latencyOffsetMs?
optional latencyOffsetMs?: number;
Defined in: core/types.ts:183
messageType?
optional messageType?: string;
Defined in: core/types.ts:187
scope?
optional scope?: string;
Defined in: core/types.ts:180
sinceStreamId?
optional sinceStreamId?: string;
Defined in: core/types.ts:182
startMode?
optional startMode?: "live" | "from_beginning" | "from_sequence" | "closest_to_now";
Defined in: core/types.ts:181
targetLanguage
targetLanguage: string;
Defined in: core/types.ts:179
Logger
Defined in: core/types.ts:17
Logger interface for SDK log output.
Matches the console subset used by the SDK.
Properties
debug
debug: (...args: unknown[]) => void;
Defined in: core/types.ts:18
Parameters
| Parameter | Type |
|---|---|
...args | unknown[] |
Returns
void
error
error: (...args: unknown[]) => void;
Defined in: core/types.ts:21
Parameters
| Parameter | Type |
|---|---|
...args | unknown[] |
Returns
void
info
info: (...args: unknown[]) => void;
Defined in: core/types.ts:19
Parameters
| Parameter | Type |
|---|---|
...args | unknown[] |
Returns
void
warn
warn: (...args: unknown[]) => void;
Defined in: core/types.ts:20
Parameters
| Parameter | Type |
|---|---|
...args | unknown[] |
Returns
void
NavigateActionParameters
Defined in: core/browserActions.ts:19
Properties
target?
optional target?: string;
Defined in: core/browserActions.ts:22
For navigate: _blank (default) opens a new tab; _self uses SPA / current-tab navigation.
url
url: string;
Defined in: core/browserActions.ts:20
OpenSessionOptions
Defined in: core/types.ts:146
Parameters for opening a session
Properties
appName?
optional appName?: string;
Defined in: core/types.ts:151
endpointId
endpointId: string;
Defined in: core/types.ts:147
endpointName?
optional endpointName?: string;
Defined in: core/types.ts:150
mode
mode: SessionMode;
Defined in: core/types.ts:149
Defaults to 'audio_playback' for delphi.readAloud, must be supplied explicitly otherwise.
PersistedSessionState
Defined in: core/types.ts:97
Session state persisted to sessionStorage for reconnect-after-reload
Properties
appName?
optional appName?: string;
Defined in: core/types.ts:102
endpointId
endpointId: string;
Defined in: core/types.ts:99
endpointName?
optional endpointName?: string;
Defined in: core/types.ts:101
mode
mode: SessionMode;
Defined in: core/types.ts:100
sessionId
sessionId: string;
Defined in: core/types.ts:98
startedAt
startedAt: number;
Defined in: core/types.ts:104
Unix timestamp — used to detect stale sessions
telproDomain?
optional telproDomain?: string;
Defined in: core/types.ts:108
TelPro domain for WebRTC voice sessions (gateway / TURN / STUN host)
webrtcGatewayUrl?
optional webrtcGatewayUrl?: string;
Defined in: core/types.ts:114
WebSocket URL to the WebRTC gateway, captured from the session token response. Persisted so reconnect-after-reload doesn't need a fresh token round-trip.
wsToken?
optional wsToken?: string;
Defined in: core/types.ts:106
WebSocket token
ReadAloudOptions
Defined in: core/types.ts:158
Parameters for delphi.readAloud(). The endpoint is required; everything
else has a sensible default.
Properties
capabilityId?
optional capabilityId?: string;
Defined in: core/types.ts:163
Optional explicit BOA capability id; if omitted, the server picks.
disableAutoPlay?
optional disableAutoPlay?: boolean;
Defined in: core/types.ts:173
If true, the SDK will not play audio internally even when onAudio is omitted.
endpointId
endpointId: string;
Defined in: core/types.ts:159
identifier?
optional identifier?: string;
Defined in: core/types.ts:165
Optional disambiguator when multiple read-aloud capabilities exist on the same endpoint
messageType?
optional messageType?: string;
Defined in: core/types.ts:167
Per-call override of the message-type used to trigger the read-aloud BOA
metadata?
optional metadata?: Record<string, unknown>;
Defined in: core/types.ts:161
Optional metadata forwarded to the runtime alongside the read-aloud action
onAudio?
optional onAudio?: (event: BrowserAudioEvent) => void;
Defined in: core/types.ts:171
Override the default audio playback (the SDK plays via new Audio() by default).
Parameters
| Parameter | Type |
|---|---|
event | BrowserAudioEvent |
Returns
void
signal?
optional signal?: AbortSignal;
Defined in: core/types.ts:169
Cancellation signal
ReconnectPayload
Defined in: core/channelTypes.ts:222
Reconnection handshake payload
Properties
lastReceivedMessageId?
optional lastReceivedMessageId?: string;
Defined in: core/channelTypes.ts:223
sessionData?
optional sessionData?: Record<string, unknown>;
Defined in: core/channelTypes.ts:224
RuntimeCapabilities
Defined in: core/types.ts:229
Properties
endpointId
endpointId: string;
Defined in: core/types.ts:230
flowDefinitionId
flowDefinitionId: string | null;
Defined in: core/types.ts:231
flows
flows: {
browserActions: {
id: string;
label: string;
messageType: string;
slug: string;
type: "listen" | "readAloud" | "transformAndRead";
voiceInvocable: boolean;
}[];
entryPoints: ("phone" | "web_voice" | "web_chat")[];
responseModes: ("audio_stream" | "text_stream" | "json" | "none")[];
sideFlows: {
id: string;
messageType?: string;
name?: string;
triggerType: string;
}[];
};
Defined in: core/types.ts:241
browserActions
browserActions: {
id: string;
label: string;
messageType: string;
slug: string;
type: 'listen' | 'readAloud' | 'transformAndRead';
voiceInvocable: boolean;
}
[];
entryPoints
entryPoints: ("phone" | "web_voice" | "web_chat")[];
responseModes
responseModes: ("audio_stream" | "text_stream" | "json" | "none")[];
sideFlows
sideFlows: {
id: string;
messageType?: string;
name?: string;
triggerType: string;
}[];
interactionModes
interactionModes: Record<RuntimeInteractionMode, boolean>;
Defined in: core/types.ts:236
runtime
runtime: {
migration: RuntimeMigration[];
sessionContinuity: "supported";
};
Defined in: core/types.ts:232
migration
migration: RuntimeMigration[];
sessionContinuity
sessionContinuity: 'supported';
transports
transports: {
available: RuntimeTransport[];
preferred: RuntimeTransport[];
};
Defined in: core/types.ts:237
available
available: RuntimeTransport[];
preferred
preferred: RuntimeTransport[];
SessionListenOptions
Defined in: core/SessionClient.ts:85
Properties
capabilityId?
optional capabilityId?: string;
Defined in: core/SessionClient.ts:94
capabilitySlug?
optional capabilitySlug?: string;
Defined in: core/SessionClient.ts:95
endpointId?
optional endpointId?: string;
Defined in: core/SessionClient.ts:89
identifier
identifier: string;
Defined in: core/SessionClient.ts:86
includeCaptions?
optional includeCaptions?: boolean;
Defined in: core/SessionClient.ts:93
latencyOffsetMs?
optional latencyOffsetMs?: number;
Defined in: core/SessionClient.ts:92
messageType?
optional messageType?: string;
Defined in: core/SessionClient.ts:96
scope?
optional scope?: string;
Defined in: core/SessionClient.ts:88
sinceStreamId?
optional sinceStreamId?: string;
Defined in: core/SessionClient.ts:91
startMode?
optional startMode?: "live" | "from_beginning" | "from_sequence" | "closest_to_now";
Defined in: core/SessionClient.ts:90
targetLanguage
targetLanguage: string;
Defined in: core/SessionClient.ts:87
SessionOptions
Defined in: core/SessionClient.ts:124
Properties
autoPlayAudio?
optional autoPlayAudio?: boolean;
Defined in: core/SessionClient.ts:152
Automatically play completed runtime audio responses in the browser. (default: true)
autoReconnect?
optional autoReconnect?: boolean;
Defined in: core/SessionClient.ts:146
Enable auto-reconnection (default: true)
onAction?
optional onAction?: ActionHandler;
Defined in: core/SessionClient.ts:126
Handler for action requests from ARI
onAudio?
optional onAudio?: (audio: BrowserAudioEvent, message: ChannelMessage) => void;
Defined in: core/SessionClient.ts:136
Handler for completed runtime audio responses
Parameters
| Parameter | Type |
|---|---|
audio | BrowserAudioEvent |
message | ChannelMessage |
Returns
void
onAudioPlaybackEnd?
optional onAudioPlaybackEnd?: (audio: BrowserAudioEvent) => void;
Defined in: core/SessionClient.ts:140
Handler fired when browser audio playback finishes
Parameters
| Parameter | Type |
|---|---|
audio | BrowserAudioEvent |
Returns
void
onAudioPlaybackStart?
optional onAudioPlaybackStart?: (audio: BrowserAudioEvent) => void;
Defined in: core/SessionClient.ts:138
Handler fired when the SDK actually starts playing audio in the browser
Parameters
| Parameter | Type |
|---|---|
audio | BrowserAudioEvent |
Returns
void
onChat?
optional onChat?: (chat: ChatPayload, message: ChannelMessage) => void;
Defined in: core/SessionClient.ts:130
Handler for text-chat messages specifically
Parameters
| Parameter | Type |
|---|---|
chat | ChatPayload |
message | ChannelMessage |
Returns
void
onConnectionChange?
optional onConnectionChange?: (state: SessionConnectionState) => void;
Defined in: core/SessionClient.ts:142
Handler for connection state changes
Parameters
| Parameter | Type |
|---|---|
state | SessionConnectionState |
Returns
void
onControl?
optional onControl?: (control: ControlPayload, message: ChannelMessage) => void;
Defined in: core/SessionClient.ts:134
Handler for control messages
Parameters
| Parameter | Type |
|---|---|
control | ControlPayload |
message | ChannelMessage |
Returns
void
onError?
optional onError?: (error: Error) => void;
Defined in: core/SessionClient.ts:144
Handler for errors
Parameters
| Parameter | Type |
|---|---|
error | Error |
Returns
void
onMessage?
optional onMessage?: MessageHandler;
Defined in: core/SessionClient.ts:128
Handler for all incoming messages
onStatus?
optional onStatus?: (status: StatusPayload, message: ChannelMessage) => void;
Defined in: core/SessionClient.ts:132
Handler for status updates
Parameters
| Parameter | Type |
|---|---|
status | StatusPayload |
message | ChannelMessage |
Returns
void
pingInterval?
optional pingInterval?: number;
Defined in: core/SessionClient.ts:150
Ping interval in ms (default: 30000)
reconnectDelay?
optional reconnectDelay?: number;
Defined in: core/SessionClient.ts:148
Reconnect delay in ms (default: 2000)
SessionState
Defined in: core/SessionClient.ts:105
Properties
audioPlaying
audioPlaying: boolean;
Defined in: core/SessionClient.ts:119
True while the SDK is actively playing audio in the browser.
audioRequestPending
audioRequestPending: boolean;
Defined in: core/SessionClient.ts:117
True while a read-aloud / browser-action request has been sent but browser playback has not started yet.
connected
connected: boolean;
Defined in: core/SessionClient.ts:107
connectionState
connectionState: SessionConnectionState;
Defined in: core/SessionClient.ts:106
endpointId
endpointId: string | null;
Defined in: core/SessionClient.ts:111
lastActivityAt
lastActivityAt: number;
Defined in: core/SessionClient.ts:121
Wall-clock ms of the last outbound send or inbound message.
lastError
lastError: Error | null;
Defined in: core/SessionClient.ts:115
messages
messages: ChannelMessage[];
Defined in: core/SessionClient.ts:114
mode
mode: SessionMode | null;
Defined in: core/SessionClient.ts:112
serverReady
serverReady: boolean;
Defined in: core/SessionClient.ts:109
True once the server has acknowledged this session channel.
sessionId
sessionId: string | null;
Defined in: core/SessionClient.ts:110
textChatEnabled
textChatEnabled: boolean;
Defined in: core/SessionClient.ts:113
SessionTokenResponse
Defined in: core/types.ts:118
Response from the session-token API
Properties
expiresIn
expiresIn: number;
Defined in: core/types.ts:124
Session TTL in seconds
sessionId
sessionId: string;
Defined in: core/types.ts:119
telproDomain?
optional telproDomain?: string;
Defined in: core/types.ts:126
TelPro domain for voice_conversation sessions (omitted for non-voice)
webrtcGatewayUrl?
optional webrtcGatewayUrl?: string;
Defined in: core/types.ts:142
WebSocket URL to the WebRTC gateway used for the SIP/audio leg.
Required for mode === 'voice_conversation'; omitted for other
modes. Routing the URL through the token response (rather than
requiring the SDK consumer to configure it) lets the server pick
the gateway per session — useful for region routing, A/B tests,
and gateway swaps without any client-side change.
The current backend implementation speaks the Janus API; the field name is intentionally gateway-agnostic so the underlying transport can be swapped without an SDK or wire-format rename.
Example
`wss://gateway.example.com`;
wsToken
wsToken: string;
Defined in: core/types.ts:120
wsTokenExpiresIn
wsTokenExpiresIn: number;
Defined in: core/types.ts:122
WS token TTL in seconds
ShowAlertActionParameters
Defined in: core/browserActions.ts:25
Properties
message
message: string;
Defined in: core/browserActions.ts:26
title?
optional title?: string;
Defined in: core/browserActions.ts:27
StartCallOptions
Defined in: core/types.ts:191
Parameters for delphi.startCall() (voice_conversation session + WebRTC).
Properties
appName?
optional appName?: string;
Defined in: core/types.ts:194
autoDial?
optional autoDial?: boolean;
Defined in: core/types.ts:201
If true, dial as soon as the SIP plugin reports registered. Default false.
browserContext?
optional browserContext?: BrowserContext;
Defined in: core/types.ts:199
Context sent on the session channel before auto-dial starts. Useful for flows that need identifiers/roles when the SIP leg enters TelPhi.
endpointId
endpointId: string;
Defined in: core/types.ts:192
endpointName?
optional endpointName?: string;
Defined in: core/types.ts:193
StatusPayload
Defined in: core/channelTypes.ts:216
Status update payload (bidirectional)
Properties
metadata?
optional metadata?: Record<string, unknown>;
Defined in: core/channelTypes.ts:218
state
state: StatusState;
Defined in: core/channelTypes.ts:217
SyncActionResult
Defined in: core/SessionClient.ts:44
Sync action result — action completed immediately.
Properties
data?
optional data?: unknown;
Defined in: core/SessionClient.ts:46
error?
optional error?: string;
Defined in: core/SessionClient.ts:47
success
success: boolean;
Defined in: core/SessionClient.ts:45
UpgradeToVoiceOptions
Defined in: core/types.ts:205
Parameters for delphi.upgradeToVoice() — continues an open text session as voice.
Properties
appName?
optional appName?: string;
Defined in: core/types.ts:208
autoDial?
optional autoDial?: boolean;
Defined in: core/types.ts:211
If true, dial as soon as the SIP plugin reports registered. Default false.
browserContext?
optional browserContext?: BrowserContext;
Defined in: core/types.ts:209
endpointId
endpointId: string;
Defined in: core/types.ts:206
endpointName?
optional endpointName?: string;
Defined in: core/types.ts:207
WsRefreshPayload
Defined in: core/channelTypes.ts:277
JWT payload for WebSocket authentication
Extends
Properties
endpointId
endpointId: string;
Defined in: core/channelTypes.ts:270
Inherited from
exp
exp: number;
Defined in: core/channelTypes.ts:273
Inherited from
iat
iat: number;
Defined in: core/channelTypes.ts:272
Inherited from
originalIat
originalIat: number;
Defined in: core/channelTypes.ts:279
refreshable
refreshable: boolean;
Defined in: core/channelTypes.ts:278
sessionId
sessionId: string;
Defined in: core/channelTypes.ts:269
Inherited from
sub
sub: 'ws_token';
Defined in: core/channelTypes.ts:274
Inherited from
teamId
teamId: string;
Defined in: core/channelTypes.ts:271
Inherited from
WsTokenPayload
Defined in: core/channelTypes.ts:268
JWT payload for WebSocket authentication
Extended by
Properties
endpointId
endpointId: string;
Defined in: core/channelTypes.ts:270
exp
exp: number;
Defined in: core/channelTypes.ts:273
iat
iat: number;
Defined in: core/channelTypes.ts:272
sessionId
sessionId: string;
Defined in: core/channelTypes.ts:269
sub
sub: 'ws_token';
Defined in: core/channelTypes.ts:274
teamId
teamId: string;
Defined in: core/channelTypes.ts:271
Type Aliases
ActionHandler
type ActionHandler = (action: ActionPayload) => Promise<ActionResult>;
Defined in: core/SessionClient.ts:100
Handler invoked when the AI requests a browser action
Parameters
| Parameter | Type |
|---|---|
action | ActionPayload |
Returns
Promise<ActionResult>
ActionPriority
type ActionPriority = 'high' | 'normal' | 'low';
Defined in: core/channelTypes.ts:54
ActionResult
type ActionResult = SyncActionResult | AsyncActionResult;
Defined in: core/SessionClient.ts:58
ActionStatus
type ActionStatus = 'received' | 'executing' | 'completed' | 'failed';
Defined in: core/channelTypes.ts:169
BrowserActionHandler
type BrowserActionHandler = (
action: Pick<ActionPayload, 'name' | 'parameters'>,
) => Promise<BrowserActionResult> | BrowserActionResult;
Defined in: core/browserActions.ts:55
Parameters
| Parameter | Type |
|---|---|
action | Pick<ActionPayload, "name" | "parameters"> |
Returns
| Promise<BrowserActionResult>
| BrowserActionResult
BrowserActionName
type BrowserActionName =
| 'show_alert'
| 'show_confirm'
| 'show_prompt'
| 'show_notification'
| 'navigate'
| 'navigate_current'
| 'copy_to_clipboard'
| 'set_storage'
| 'get_storage'
| 'scroll_to'
| 'click_element'
| 'fill_form'
| 'custom';
Defined in: core/browserActions.ts:4
BrowserActionResult
type BrowserActionResult = BrowserActionSyncResult | BrowserActionAsyncResult;
Defined in: core/browserActions.ts:53
BrowserReadyState
type BrowserReadyState = 'loading' | 'interactive' | 'ready' | 'error';
Defined in: core/channelTypes.ts:106
Page load / readiness for Browser Targeted Actions (BTA) awareness.
BrowserSelectionContext
type BrowserSelectionContext = BrowserContext;
Defined in: core/channelTypes.ts:145
ChannelMessageType
type ChannelMessageType =
| 'chat'
| 'browser_action'
| 'action'
| 'action_result'
| 'audio'
| 'status'
| 'control'
| 'reconnect'
| 'ping'
| 'pong'
| 'error';
Defined in: core/channelTypes.ts:26
Channel Types
Shared types for bidirectional communication between: Browser (WebRTC Phone) <-> TelAPI (WS Gateway) <-> TelPhi (ARI / AI)
Two Communication Flows
Flow A – Tool Call Actions (AI-initiated)
AI tool call → telphi → redis stream → telapi → browser ↓ AI receives result ← telphi ← redis stream ← telapi ← browser executes
Flow B – Text Chat (Browser-initiated, on-demand)
Browser: control { enable_text_chat } ↓ User types → chat → AI processes → AI responds via TEXT ↓ Browser: control { disable_text_chat }
ControlCommand
type ControlCommand =
| 'enable_text_chat'
| 'disable_text_chat'
| 'request_context'
| 'clear_context'
| 'set_response_mode'
| 'prepare_voice_to_text_handoff';
Defined in: core/channelTypes.ts:56
CreateBrowserActionHandlerOptions
type CreateBrowserActionHandlerOptions = ExecuteBrowserActionOptions;
Defined in: core/browserActions.ts:74
Alias for ExecuteBrowserActionOptions — preferred name in BTA docs.
IceServer
type IceServer = {
credential?: string;
urls: string | string[];
username?: string;
};
Defined in: core/types.ts:7
Properties
credential?
optional credential?: string;
Defined in: core/types.ts:10
urls
urls: string | string[];
Defined in: core/types.ts:8
username?
optional username?: string;
Defined in: core/types.ts:9
MessageDirection
type MessageDirection = 'to_browser' | 'to_ari';
Defined in: core/channelTypes.ts:39
MessageHandler
type MessageHandler = (message: ChannelMessage) => void;
Defined in: core/SessionClient.ts:103
Handler invoked for every inbound message
Parameters
| Parameter | Type |
|---|---|
message | ChannelMessage |
Returns
void
MessageRole
type MessageRole = 'user' | 'assistant' | 'system';
Defined in: core/channelTypes.ts:40
NavigateCallback
type NavigateCallback = (path: string) => void;
Defined in: core/browserActions.ts:63
Optional callback for SPA-router navigation.
When not provided, the navigate_current action falls back to the History API.
Parameters
| Parameter | Type |
|---|---|
path | string |
Returns
void
ResponseMode
type ResponseMode = 'voice' | 'text' | 'both';
Defined in: core/channelTypes.ts:66
How the AI should respond to messages
RuntimeInteractionMode
type RuntimeInteractionMode = SessionMode;
Defined in: core/types.ts:225
RuntimeMigration
type RuntimeMigration = 'text_to_voice' | 'voice_to_text' | 'api_to_media';
Defined in: core/types.ts:223
RuntimeTransport
type RuntimeTransport = 'rest' | 'websocket' | 'existing_media' | 'webrtc';
Defined in: core/types.ts:227
SessionConnectionState
type SessionConnectionState = 'disconnected' | 'connecting' | 'connected' | 'reconnecting';
Defined in: core/SessionClient.ts:38
SessionMode
type SessionMode = 'text' | 'audio_playback' | 'voice_conversation' | 'browser_actions' | 'listen';
Defined in: core/types.ts:39
The kind of interaction a session is opened for.
text— text chat only; no audio.audio_playback— runtime streams TTS audio back to the browser over the channel. No microphone, no SIP leg.voice_conversation— full WebRTC two-way voice call (gateway + SIP leg). Audio is delivered via the SIP leg, not over the channel.browser_actions— pure BOA dispatch (no AI conversation).listen— subscribe to a TelPhi-produced interpretation stream.
StandardActionName
type StandardActionName = (typeof StandardActions)[keyof typeof StandardActions];
Defined in: core/channelTypes.ts:324
StatusState
type StatusState =
| 'connected'
| 'reconnecting'
| 'disconnected'
| 'call_active'
| 'call_ended'
| 'call_hold'
| 'call_resumed'
| 'text_chat_enabled'
| 'text_chat_disabled'
| 'response_mode_changed';
Defined in: core/channelTypes.ts:42
Variables
DTMF_FREQUENCIES
const DTMF_FREQUENCIES: Record<string, [number, number]>;
Defined in: core/utils/constants.ts:2
logger
const logger: Logger;
Defined in: core/utils/sdkLogger.ts:19
Module-level singleton logger used throughout the SDK.
Routes to the logger supplied in DelphiConfig.logger, falling back to console.
SESSION_STATE_STORAGE_KEY
const SESSION_STATE_STORAGE_KEY: 'delphi-voice-session-state' = 'delphi-voice-session-state';
Defined in: core/utils/constants.ts:18
Storage key for persisting voice-call session state across reloads
StandardActions
const StandardActions: {
CLICK_ELEMENT: 'click_element';
CLOSE_MODAL: 'close_modal';
COPY_TO_CLIPBOARD: 'copy_to_clipboard';
CUSTOM: 'custom';
DOWNLOAD_FILE: 'download_file';
FILL_FORM: 'fill_form';
GET_STORAGE: 'get_storage';
NAVIGATE: 'navigate';
NAVIGATE_CURRENT: 'navigate_current';
OPEN_MODAL: 'open_modal';
PLAY_AUDIO: 'play_audio';
SCROLL_TO: 'scroll_to';
SET_STORAGE: 'set_storage';
SHOW_ALERT: 'show_alert';
SHOW_CONFIRM: 'show_confirm';
SHOW_NOTIFICATION: 'show_notification';
SHOW_PROMPT: 'show_prompt';
STOP_AUDIO: 'stop_audio';
};
Defined in: core/channelTypes.ts:303
Standard action names the browser should handle
Type Declaration
CLICK_ELEMENT
readonly CLICK_ELEMENT: "click_element" = 'click_element';
CLOSE_MODAL
readonly CLOSE_MODAL: "close_modal" = 'close_modal';
COPY_TO_CLIPBOARD
readonly COPY_TO_CLIPBOARD: "copy_to_clipboard" = 'copy_to_clipboard';
CUSTOM
readonly CUSTOM: "custom" = 'custom';
DOWNLOAD_FILE
readonly DOWNLOAD_FILE: "download_file" = 'download_file';
FILL_FORM
readonly FILL_FORM: "fill_form" = 'fill_form';
GET_STORAGE
readonly GET_STORAGE: "get_storage" = 'get_storage';
NAVIGATE
readonly NAVIGATE: "navigate" = 'navigate';
NAVIGATE_CURRENT
readonly NAVIGATE_CURRENT: "navigate_current" = 'navigate_current';
OPEN_MODAL
readonly OPEN_MODAL: "open_modal" = 'open_modal';
PLAY_AUDIO
readonly PLAY_AUDIO: "play_audio" = 'play_audio';
SCROLL_TO
readonly SCROLL_TO: "scroll_to" = 'scroll_to';
SET_STORAGE
readonly SET_STORAGE: "set_storage" = 'set_storage';
SHOW_ALERT
readonly SHOW_ALERT: "show_alert" = 'show_alert';
SHOW_CONFIRM
readonly SHOW_CONFIRM: "show_confirm" = 'show_confirm';
SHOW_NOTIFICATION
readonly SHOW_NOTIFICATION: "show_notification" = 'show_notification';
SHOW_PROMPT
readonly SHOW_PROMPT: "show_prompt" = 'show_prompt';
STOP_AUDIO
readonly STOP_AUDIO: "stop_audio" = 'stop_audio';
Functions
clearSessionState()
function clearSessionState(): void;
Defined in: core/utils/sessionState.ts:44
Remove session state from sessionStorage
Returns
void
createActionAckMessage()
function createActionAckMessage(
sessionId: string,
actionId: string,
status?: 'received' | 'executing',
): ChannelMessage;
Defined in: core/utils/channel.ts:132
Create an async action acknowledgment (action received, will process)
Parameters
| Parameter | Type | Default value |
|---|---|---|
sessionId | string | undefined |
actionId | string | undefined |
status | "received" | "executing" | 'received' |
Returns
createActionMessage()
function createActionMessage(
sessionId: string,
name: string,
parameters: Record<string, unknown>,
options?: {
description?: string;
priority?: ActionPriority;
requiresResponse?: boolean;
timeoutMs?: number;
},
): ChannelMessage;
Defined in: core/utils/channel.ts:86
Create a browser-side action request (ARI → Browser)
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
name | string |
parameters | Record<string, unknown> |
options | { description?: string; priority?: ActionPriority; requiresResponse?: boolean; timeoutMs?: number; } |
options.description? | string |
options.priority? | ActionPriority |
options.requiresResponse? | boolean |
options.timeoutMs? | number |
Returns
createActionResultMessage()
function createActionResultMessage(
sessionId: string,
actionId: string,
success: boolean,
options?: {
data?: unknown;
durationMs?: number;
error?: string;
},
): ChannelMessage;
Defined in: core/utils/channel.ts:112
Create a synchronous action result (Browser → ARI)
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
actionId | string |
success | boolean |
options | { data?: unknown; durationMs?: number; error?: string; } |
options.data? | unknown |
options.durationMs? | number |
options.error? | string |
Returns
createActionUpdateChatMessage()
function createActionUpdateChatMessage(
sessionId: string,
actionId: string,
content: string,
metadata?: Record<string, unknown>,
): ChannelMessage;
Defined in: core/utils/channel.ts:170
Create a chat message that references an action (for async updates via chat flow)
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
actionId | string |
content | string |
metadata? | Record<string, unknown> |
Returns
createAsyncActionResultMessage()
function createAsyncActionResultMessage(
sessionId: string,
actionId: string,
success: boolean,
options?: {
data?: unknown;
durationMs?: number;
error?: string;
},
): ChannelMessage;
Defined in: core/utils/channel.ts:149
Create an async action completion message (final result)
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
actionId | string |
success | boolean |
options | { data?: unknown; durationMs?: number; error?: string; } |
options.data? | unknown |
options.durationMs? | number |
options.error? | string |
Returns
createAudioMessage()
function createAudioMessage(sessionId: string, payload: AudioPayload): ChannelMessage;
Defined in: core/utils/channel.ts:64
Create a playable audio message (Runtime → Browser)
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
payload | AudioPayload |
Returns
createBaseMessage()
function createBaseMessage(
type: ChannelMessageType,
sessionId: string,
direction: MessageDirection,
): Omit<
ChannelMessage,
| 'chat'
| 'browserAction'
| 'action'
| 'actionResult'
| 'audio'
| 'status'
| 'reconnect'
| 'error'
| 'control'
>;
Defined in: core/utils/channel.ts:27
Create a base message skeleton (without payload fields)
Parameters
| Parameter | Type |
|---|---|
type | ChannelMessageType |
sessionId | string |
direction | MessageDirection |
Returns
Omit<ChannelMessage,
| "chat"
| "browserAction"
| "action"
| "actionResult"
| "audio"
| "status"
| "reconnect"
| "error"
| "control">
createBrowserActionHandler()
function createBrowserActionHandler(
optionsOrNavigate?: ExecuteBrowserActionOptions | NavigateCallback,
): (action: Pick<ActionPayload, 'name' | 'parameters'>) => Promise<BrowserActionResult>;
Defined in: core/browserActions.ts:116
Build a stable onAction handler for Browser Targeted Actions (BTA).
Thin wrapper around executeBrowserAction.
Parameters
| Parameter | Type |
|---|---|
optionsOrNavigate? | | ExecuteBrowserActionOptions | NavigateCallback |
Returns
(action: Pick<ActionPayload, "name" | "parameters">) => Promise<BrowserActionResult>
createBrowserActionMessage()
function createBrowserActionMessage(
sessionId: string,
payload: BrowserActionPayload,
): ChannelMessage;
Defined in: core/utils/channel.ts:53
Create a browser-originated capability trigger (Browser → Runtime)
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
payload | BrowserActionPayload |
Returns
createBrowserContextMessage()
function createBrowserContextMessage(
sessionId: string,
browserContext: BrowserContext,
): ChannelMessage;
Defined in: core/utils/channel.ts:307
Create a browser context update — no AI response expected. Use for durable browser state such as current page context or selected text.
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
browserContext | BrowserContext |
Returns
createBrowserSelectionContextMessage()
function createBrowserSelectionContextMessage(
sessionId: string,
selection: BrowserContext,
): ChannelMessage;
Defined in: core/utils/channel.ts:293
Create a browser-selection context update — no AI response expected.
Convenience wrapper that defaults source to 'selection'.
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
selection | BrowserContext |
Returns
createChatMessage()
function createChatMessage(
sessionId: string,
direction: MessageDirection,
role: MessageRole,
content: string,
metadata?: Record<string, unknown>,
): ChannelMessage;
Defined in: core/utils/channel.ts:72
Create a chat message
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
direction | MessageDirection |
role | MessageRole |
content | string |
metadata? | Record<string, unknown> |
Returns
createContextUpdateMessage()
function createContextUpdateMessage(
sessionId: string,
content: string,
metadata?: Record<string, unknown>,
): ChannelMessage;
Defined in: core/utils/channel.ts:272
Create a context-only update — no AI response expected. Use for: async action completed, background state changes.
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
content | string |
metadata? | Record<string, unknown> |
Returns
createControlMessage()
function createControlMessage(
sessionId: string,
command: ControlCommand,
settings?: {
responseMode?: ResponseMode;
sessionTimeout?: number;
},
metadata?: Record<string, unknown>,
): ChannelMessage;
Defined in: core/utils/channel.ts:228
Create a control message (Browser → ARI)
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
command | ControlCommand |
settings? | { responseMode?: ResponseMode; sessionTimeout?: number; } |
settings.responseMode? | ResponseMode |
settings.sessionTimeout? | number |
metadata? | Record<string, unknown> |
Returns
createDisableTextChatMessage()
function createDisableTextChatMessage(sessionId: string): ChannelMessage;
Defined in: core/utils/channel.ts:249
Create a disable-text-chat control message
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
Returns
createEnableTextChatMessage()
function createEnableTextChatMessage(
sessionId: string,
responseMode?: ResponseMode,
): ChannelMessage;
Defined in: core/utils/channel.ts:241
Create an enable-text-chat control message
Parameters
| Parameter | Type | Default value |
|---|---|---|
sessionId | string | undefined |
responseMode | ResponseMode | 'text' |
Returns
createErrorMessage()
function createErrorMessage(
sessionId: string,
direction: MessageDirection,
code: string,
message: string,
details?: unknown,
): ChannelMessage;
Defined in: core/utils/channel.ts:202
Create an error message
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
direction | MessageDirection |
code | string |
message | string |
details? | unknown |
Returns
createMessageId()
function createMessageId(): string;
Defined in: core/utils/channel.ts:22
Create a unique message ID
Returns
string
createPingMessage()
function createPingMessage(sessionId: string): ChannelMessage;
Defined in: core/utils/channel.ts:369
Create a keepalive ping message
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
Returns
createPongMessage()
function createPongMessage(sessionId: string): ChannelMessage;
Defined in: core/utils/channel.ts:374
Create a keepalive pong message
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
Returns
createReadAloudMessage()
function createReadAloudMessage(
sessionId: string,
content: string,
metadata?: Record<string, unknown>,
): ChannelMessage;
Defined in: core/utils/channel.ts:350
Create a read-aloud request — expects a VOICE response from AI. Use for: user highlighted text, wants AI to read it back.
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
content | string |
metadata? | Record<string, unknown> |
Returns
createReconnectMessage()
function createReconnectMessage(
sessionId: string,
lastReceivedStreamId?: string,
sessionData?: Record<string, unknown>,
): ChannelMessage;
Defined in: core/utils/channel.ts:216
Create a reconnect request message
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
lastReceivedStreamId? | string |
sessionData? | Record<string, unknown> |
Returns
createSetResponseModeMessage()
function createSetResponseModeMessage(
sessionId: string,
responseMode: ResponseMode,
): ChannelMessage;
Defined in: core/utils/channel.ts:261
Create a set-response-mode control message. Switches the AI's output modality between voice and text-only (Option A).
'text' — AI responds with text only (no audio output); user can still speak.
'voice' — AI responds with audio (normal realtime mode).
'both' — AI responds with both audio and text simultaneously.
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
responseMode | ResponseMode |
Returns
createStatusMessage()
function createStatusMessage(
sessionId: string,
direction: MessageDirection,
state: StatusState,
metadata?: Record<string, unknown>,
): ChannelMessage;
Defined in: core/utils/channel.ts:189
Create a status message
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
direction | MessageDirection |
state | StatusState |
metadata? | Record<string, unknown> |
Returns
createTextChatMessage()
function createTextChatMessage(
sessionId: string,
content: string,
metadata?: Record<string, unknown>,
): ChannelMessage;
Defined in: core/utils/channel.ts:329
Create a text chat message — expects a TEXT response from AI. Use for: active text conversation.
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
content | string |
metadata? | Record<string, unknown> |
Returns
executeBrowserAction()
function executeBrowserAction(
action: Pick<ActionPayload, 'name' | 'parameters'>,
optionsOrNavigate?: ExecuteBrowserActionOptions | NavigateCallback,
): Promise<BrowserActionResult>;
Defined in: core/browserActions.ts:132
Execute a browser action dispatched by the AI (BTA — Browser Targeted Action).
Dual navigation model:
navigate→window.open(new tab) by default;target: '_self'uses SPA pathnavigate_current→ hostonNavigateor History API for in-app routers
Parameters
| Parameter | Type | Description |
|---|---|---|
action | Pick<ActionPayload, "name" | "parameters"> | The action payload from the AI |
optionsOrNavigate? | | ExecuteBrowserActionOptions | NavigateCallback | Handler options or a bare SPA navigate callback |
Returns
Promise<BrowserActionResult>
getChannelStream()
function getChannelStream(sessionId: string): string;
Defined in: core/channelTypes.ts:294
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
Returns
string
getToAriChannel()
function getToAriChannel(sessionId: string): string;
Defined in: core/channelTypes.ts:286
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
Returns
string
getToBrowserChannel()
function getToBrowserChannel(sessionId: string): string;
Defined in: core/channelTypes.ts:290
Parameters
| Parameter | Type |
|---|---|
sessionId | string |
Returns
string
loadSessionState()
function loadSessionState(): PersistedSessionState | null;
Defined in: core/utils/sessionState.ts:20
Load voice-session state from sessionStorage.
Returns null if nothing stored or if the state is stale (>20 s).
Returns
PersistedSessionState | null
logDebug()
function logDebug(...args: unknown[]): void;
Defined in: core/utils/sdkLogger.ts:38
Routes through the configured SDK logger with a [DelphiClient] prefix
Parameters
| Parameter | Type |
|---|---|
...args | unknown[] |
Returns
void
playDtmfTone()
function playDtmfTone(digit: string, durationMs?: number): void;
Defined in: core/utils/playDtmfTone.ts:13
Play a DTMF tone for a single digit.
Parameters
| Parameter | Type | Default value | Description |
|---|---|---|---|
digit | string | undefined | One of 0-9, *, # |
durationMs | number | 150 | Tone duration in ms (default: 150) |
Returns
void
publishBrowserContext()
function publishBrowserContext(
partial: BrowserContext,
previous?: BrowserContext | null,
): BrowserContext;
Defined in: core/browserContext.ts:7
Merge helper for partial browser-context updates.
Host apps typically call session.setBrowserContext(publishBrowserContext(...)).
Parameters
| Parameter | Type |
|---|---|
partial | BrowserContext |
previous? | BrowserContext | null |
Returns
randomString()
function randomString(len: number): string;
Defined in: core/utils/index.ts:37
Generate a random alphanumeric string of len characters
Parameters
| Parameter | Type |
|---|---|
len | number |
Returns
string
saveSessionState()
function saveSessionState(state: PersistedSessionState): void;
Defined in: core/utils/sessionState.ts:7
Persist voice-session state to sessionStorage for cross-reload reconnect
Parameters
| Parameter | Type |
|---|---|
state | PersistedSessionState |
Returns
void
setAudioCodecPreferences()
function setAudioCodecPreferences(pc: RTCPeerConnection, preferPcma?: boolean): void;
Defined in: core/utils/setAudioCodecPreferences.ts:10
Configure audio codec preferences on an RTCPeerConnection.
When preferPcma is true (default), forces PCMA (G.711 A-law) as the
preferred codec. This eliminates opus → PCMA transcoding overhead on
the WebRTC gateway / RTP engine.
Parameters
| Parameter | Type | Default value |
|---|---|---|
pc | RTCPeerConnection | undefined |
preferPcma | boolean | true |
Returns
void
setLogger()
function setLogger(customLogger: Logger | undefined): void;
Defined in: core/utils/sdkLogger.ts:30
Update the SDK logger. Called automatically when config is updated.
Pass undefined to revert to the default console logger.
Parameters
| Parameter | Type |
|---|---|
customLogger | Logger | undefined |
Returns
void
setNavigationCatalog()
function setNavigationCatalog(
catalog: BrowserNavigationCatalog,
base?: Omit<BrowserContext, 'navigation'>,
): BrowserContext;
Defined in: core/browserContext.ts:42
Convenience: build a context update that only refreshes the navigation catalog.
Parameters
| Parameter | Type |
|---|---|
catalog | BrowserNavigationCatalog |
base? | Omit<BrowserContext, "navigation"> |