Skip to main content

index

Classes

CapabilityNotSupportedError

Defined in: core/DelphiClient.ts:119

Extends

  • Error

Constructors

Constructor
new CapabilityNotSupportedError(capability: SessionMode, capabilities: RuntimeCapabilities): CapabilityNotSupportedError;

Defined in: core/DelphiClient.ts:122

Parameters
ParameterType
capabilitySessionMode
capabilitiesRuntimeCapabilities
Returns

CapabilityNotSupportedError

Overrides
Error.constructor;

Properties

capabilities
readonly capabilities: RuntimeCapabilities;

Defined in: core/DelphiClient.ts:124

capability
readonly capability: SessionMode;

Defined in: core/DelphiClient.ts:123

name
readonly name: "CapabilityNotSupportedError" = 'CapabilityNotSupportedError';

Defined in: core/DelphiClient.ts:120

Overrides
Error.name;

DelphiClient

Defined in: core/DelphiClient.ts:185

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:198

Parameters
ParameterType
configDelphiConfig
Returns

DelphiClient

Methods

assertCapability()
assertCapability(capabilities: RuntimeCapabilities, capability: SessionMode): void;

Defined in: core/DelphiClient.ts:317

Throws CapabilityNotSupportedError if unsupported.

Parameters
ParameterType
capabilitiesRuntimeCapabilities
capabilitySessionMode
Returns

void

assertEndpointCapability()
assertEndpointCapability(endpointId: string, capability: SessionMode): Promise<RuntimeCapabilities>;

Defined in: core/DelphiClient.ts:324

Convenience: fetch capabilities and assert support in one call.

Parameters
ParameterType
endpointIdstring
capabilitySessionMode
Returns

Promise<RuntimeCapabilities>

cancelReconnect()
cancelReconnect(): void;

Defined in: core/DelphiClient.ts:885

Cancel an in-progress reconnect attempt (does NOT send SIP hangup).

Returns

void

clearDtmfDigits()
clearDtmfDigits(): void;

Defined in: core/DelphiClient.ts:769

Returns

void

destroy()
destroy(): void;

Defined in: core/DelphiClient.ts:898

Tear down everything. Call on component unmount.

Returns

void

enableAudio()
enableAudio(): Promise<void>;

Defined in: core/DelphiClient.ts:774

Enable audio after a browser autoplay block

Returns

Promise<void>

endAllSessions()
endAllSessions(): Promise<void>;

Defined in: core/DelphiClient.ts:469

Close every active session.

Returns

Promise<void>

endCall()
endCall(): Promise<void>;

Defined in: core/DelphiClient.ts:725

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:454

Close the session(s) for an endpoint (no-op if none open).

Parameters
ParameterType
endpointIdstring
mode?SessionMode
Returns

Promise<void>

getCapabilities()
getCapabilities(endpointId: string): Promise<RuntimeCapabilities>;

Defined in: core/DelphiClient.ts:282

Discover which runtime modes and transports an endpoint supports.

Parameters
ParameterType
endpointIdstring
Returns

Promise<RuntimeCapabilities>

getConfig()
getConfig(): Readonly<DelphiConfig>;

Defined in: core/DelphiClient.ts:222

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:445

Returns the existing SessionClient for an endpoint/mode, or null. No I/O.

Parameters
ParameterType
endpointIdstring
mode?SessionMode
Returns

SessionClient | null

getSessionToken()
getSessionToken(endpointId: string, mode: SessionMode): Promise<SessionTokenResponse>;

Defined in: core/DelphiClient.ts:242

Request a session token from TelAPI.

Hits POST {apiDomain}/api/v1/sessions/token (or sessionTokenUrl if configured for same-origin proxying).

Parameters
ParameterType
endpointIdstring
modeSessionMode
Returns

Promise<SessionTokenResponse>

getState()
getState(): Readonly<DelphiClientState>;

Defined in: core/DelphiClient.ts:217

Return a stable snapshot of the current state

Returns

Readonly<DelphiClientState>

hasCapability()
hasCapability(capabilities: RuntimeCapabilities, capability: SessionMode): boolean;

Defined in: core/DelphiClient.ts:312

Check whether already-fetched endpoint capabilities support an interaction mode.

Parameters
ParameterType
capabilitiesRuntimeCapabilities
capabilitySessionMode
Returns

boolean

listen()
listen(options: ListenOptions): Promise<SessionClient>;

Defined in: core/DelphiClient.ts:546

Open a listener session and subscribe it to an interpretation stream.

Parameters
ParameterType
optionsListenOptions
Returns

Promise<SessionClient>

openSession()
openSession(options: OpenSessionOptions): Promise<SessionClient>;

Defined in: core/DelphiClient.ts:348

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
ParameterType
optionsOpenSessionOptions
Returns

Promise<SessionClient>

readAloud()
readAloud(text: string, options: ReadAloudOptions): Promise<BrowserAudioEvent>;

Defined in: core/DelphiClient.ts:487

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
ParameterType
textstring
optionsReadAloudOptions
Returns

Promise<BrowserAudioEvent>

reconnectCall()
reconnectCall(state: PersistedSessionState): Promise<void>;

Defined in: core/DelphiClient.ts:800

Reconnect a previously-saved voice call.

Parameters
ParameterType
statePersistedSessionState
Returns

Promise<void>

restorePersistedCall()
restorePersistedCall(): PersistedSessionState | null;

Defined in: core/DelphiClient.ts:795

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:753

Send a DTMF tone over the active voice call (no-op if not in a call).

Parameters
ParameterType
digitstring
Returns

Promise<void>

setLocalAudioElement()
setLocalAudioElement(el: HTMLAudioElement | null): void;

Defined in: core/DelphiClient.ts:748

Parameters
ParameterType
elHTMLAudioElement | null
Returns

void

setRemoteAudioElement()
setRemoteAudioElement(el: HTMLAudioElement | null): void;

Defined in: core/DelphiClient.ts:740

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
ParameterType
elHTMLAudioElement | null
Returns

void

setSelectedText()
setSelectedText(text: string): void;

Defined in: core/DelphiClient.ts:786

Track the user's current text selection (for AI read-aloud feature)

Parameters
ParameterType
textstring
Returns

void

startCall()
startCall(options: StartCallOptions): Promise<SessionClient>;

Defined in: core/DelphiClient.ts:652

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
ParameterType
optionsStartCallOptions
Returns

Promise<SessionClient>

subscribe()
subscribe(listener: () => void): () => void;

Defined in: core/DelphiClient.ts:211

Subscribe to all state changes. Returns an unsubscribe function.

Parameters
ParameterType
listener() => void
Returns

() => void

updateConfig()
updateConfig(config: DelphiConfig): void;

Defined in: core/DelphiClient.ts:227

Update the runtime config (also re-binds the logger).

Parameters
ParameterType
configDelphiConfig
Returns

void


ReadAloudCapabilityNotFoundError

Defined in: core/DelphiClient.ts:133

Extends

  • Error

Constructors

Constructor
new ReadAloudCapabilityNotFoundError(endpointId: string): ReadAloudCapabilityNotFoundError;

Defined in: core/DelphiClient.ts:135

Parameters
ParameterType
endpointIdstring
Returns

ReadAloudCapabilityNotFoundError

Overrides
Error.constructor;

Properties

name
readonly name: "ReadAloudCapabilityNotFoundError" = 'ReadAloudCapabilityNotFoundError';

Defined in: core/DelphiClient.ts:134

Overrides
Error.name;

SessionClient

Defined in: core/SessionClient.ts:164

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:207

Parameters
ParameterType
optionsSessionOptions
Returns

SessionClient

Methods

audioDone()
audioDone(responseId?: string): Promise<BrowserAudioEvent>;

Defined in: core/SessionClient.ts:636

Wait for the next assembled audio response from the runtime.

If responseId is supplied, resolves only when that specific response completes; otherwise resolves on the next audio.done.

Parameters
ParameterType
responseId?string
Returns

Promise<BrowserAudioEvent>

clearMessages()
clearMessages(): void;

Defined in: core/SessionClient.ts:394

Clear the visible message history and the persisted resume cursor.

Returns

void

close()
close(): Promise<void>;

Defined in: core/SessionClient.ts:341

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:251

Connect to the channel WebSocket for a previously-issued session.

Parameters
ParameterTypeDescription
sessionIdstringSession ID from the session-token response
wsTokenstringWebSocket authentication token
wsUrl?stringBase WebSocket URL (e.g. wss://api.example.com)
Returns

void

disableTextChat()
disableTextChat(): boolean;

Defined in: core/SessionClient.ts:565

Disable text-chat mode (AI returns to voice-only)

Returns

boolean

disconnect()
disconnect(): void;

Defined in: core/SessionClient.ts:321

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:556

Enable text-chat mode (AI will respond to text messages)

Parameters
ParameterTypeDefault value
responseModeResponseMode'text'
Returns

boolean

getState()
getState(): Readonly<SessionState>;

Defined in: core/SessionClient.ts:230

Return a stable snapshot of the current state

Returns

Readonly<SessionState>

listen()
listen(options: SessionListenOptions): boolean;

Defined in: core/SessionClient.ts:536

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
ParameterType
optionsSessionListenOptions
Returns

boolean

onClose()
onClose(callback: () => void): () => void;

Defined in: core/SessionClient.ts:235

Register a callback fired exactly once when the session closes for any reason.

Parameters
ParameterType
callback() => void
Returns

() => void

sendActionProgress()
sendActionProgress(actionId: string, status: "received" | "executing"): boolean;

Defined in: core/SessionClient.ts:599

Send a progress update for an in-flight async action

Parameters
ParameterType
actionIdstring
status"received" | "executing"
Returns

boolean

sendActionUpdateChat()
sendActionUpdateChat(
actionId: string,
content: string,
metadata?: Record<string, unknown>): boolean;

Defined in: core/SessionClient.ts:605

Send an async action update via the chat flow

Parameters
ParameterType
actionIdstring
contentstring
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:587

Send the final result of an async browser action

Parameters
ParameterType
actionIdstring
successboolean
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:522

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
ParameterType
payloadBrowserActionPayload
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:418

Send a chat message with full control over response behaviour.

Parameters
ParameterType
contentstring
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:450

Send a context-only update — no AI response expected. Use for: async action completed, background state changes.

Parameters
ParameterType
contentstring
metadata?Record<string, unknown>
Returns

boolean

sendMessage()
sendMessage(partial: Partial<ChannelMessage>): boolean;

Defined in: core/SessionClient.ts:617

Send a raw / custom message

Parameters
ParameterType
partialPartial<ChannelMessage>
Returns

boolean

sendReadAloud()
sendReadAloud(content: string, metadata?: Record<string, unknown>): boolean;

Defined in: core/SessionClient.ts:505

Send a read-aloud request — expects a voice response from AI.

Parameters
ParameterType
contentstring
metadata?Record<string, unknown>
Returns

boolean

sendTextChat()
sendTextChat(content: string, metadata?: Record<string, unknown>): boolean;

Defined in: core/SessionClient.ts:495

Send a text chat — expects a text response from AI.

Parameters
ParameterType
contentstring
metadata?Record<string, unknown>
Returns

boolean

setBrowserContext()
setBrowserContext(browserContext: BrowserContext): boolean;

Defined in: core/SessionClient.ts:465

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
ParameterType
browserContextBrowserContext
Returns

boolean

setMetadata()
setMetadata(meta: {
endpointId: string;
mode: SessionMode;
}): void;

Defined in: core/SessionClient.ts:311

Set the metadata describing this session (mode + endpointId). Surfaced through getState() for UIs to introspect.

Parameters
ParameterType
meta{ endpointId: string; mode: SessionMode; }
meta.endpointIdstring
meta.modeSessionMode
Returns

void

setResponseMode()
setResponseMode(responseMode: ResponseMode): boolean;

Defined in: core/SessionClient.ts:580

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
ParameterType
responseModeResponseMode
Returns

boolean

setSelectionContext()
setSelectionContext(selection: BrowserContext): boolean;

Defined in: core/SessionClient.ts:488

Set durable browser selection context without invoking an action or AI response.

Convenience wrapper around setBrowserContext() that defaults source to 'selection'.

Parameters
ParameterType
selectionBrowserContext
Returns

boolean

Deprecated

Prefer setBrowserContext() for new integrations.

subscribe()
subscribe(listener: () => void): () => void;

Defined in: core/SessionClient.ts:224

Subscribe to state changes.

Parameters
ParameterType
listener() => void
Returns

An unsubscribe function.

() => void

touch()
touch(): void;

Defined in: core/SessionClient.ts:407

Reset the idle-timeout clock without sending anything.

Returns

void

updateOptions()
updateOptions(options: Partial<SessionOptions>): void;

Defined in: core/SessionClient.ts:389

Update callback options at runtime (e.g. after reconnect with new handlers)

Parameters
ParameterType
optionsPartial<SessionOptions>
Returns

void

Interfaces

ActionPayload

Defined in: core/channelTypes.ts:129

Action request payload (ARI → Browser)

Properties

actionId
actionId: string;

Defined in: core/channelTypes.ts:130

description?
optional description?: string;

Defined in: core/channelTypes.ts:137

name
name: string;

Defined in: core/channelTypes.ts:132

Action name, e.g. navigate, fill_form

parameters
parameters: Record<string, unknown>;

Defined in: core/channelTypes.ts:133

priority?
optional priority?: ActionPriority;

Defined in: core/channelTypes.ts:136

requiresResponse
requiresResponse: boolean;

Defined in: core/channelTypes.ts:134

timeoutMs?
optional timeoutMs?: number;

Defined in: core/channelTypes.ts:135


ActionResultPayload

Defined in: core/channelTypes.ts:146

Action result payload (Browser → ARI). Supports both synchronous and asynchronous actions.

Properties

actionId
actionId: string;

Defined in: core/channelTypes.ts:147

data?
optional data?: unknown;

Defined in: core/channelTypes.ts:150

durationMs?
optional durationMs?: number;

Defined in: core/channelTypes.ts:152

error?
optional error?: string;

Defined in: core/channelTypes.ts:151

isFinal?
optional isFinal?: boolean;

Defined in: core/channelTypes.ts:154

true means the action is complete (no more updates expected)

status?
optional status?: ActionStatus;

Defined in: core/channelTypes.ts:148

success
success: boolean;

Defined in: core/channelTypes.ts:149


AsyncActionResult

Defined in: core/SessionClient.ts:52

Async action result — call sendAsyncActionResult() when the action finishes.

Properties

async
async: true;

Defined in: core/SessionClient.ts:53

message?
optional message?: string;

Defined in: core/SessionClient.ts:54


AudioPayload

Defined in: core/channelTypes.ts:169

Properties

delta?
optional delta?: string;

Defined in: core/channelTypes.ts:171

event
event: 'start' | 'delta' | 'done';

Defined in: core/channelTypes.ts:170

index?
optional index?: number;

Defined in: core/channelTypes.ts:174

metadata?
optional metadata?: Record<string, unknown>;

Defined in: core/channelTypes.ts:175

mimeType?
optional mimeType?: string;

Defined in: core/channelTypes.ts:172

responseId?
optional responseId?: string;

Defined in: core/channelTypes.ts:173


BrowserActionAsyncResult

Defined in: core/browserActions.ts:46

Async indicator — the action will complete later. Call sendAsyncActionResult() on the SessionClient once done.

Properties

async
async: true;

Defined in: core/browserActions.ts:47

message?
optional message?: string;

Defined in: core/browserActions.ts:48


BrowserActionPayload

Defined in: core/channelTypes.ts:157

Properties

capabilityId?
optional capabilityId?: string;

Defined in: core/channelTypes.ts:160

Optional; when omitted, the runtime may resolve the first matching capability.

capabilitySlug?
optional capabilitySlug?: string;

Defined in: core/channelTypes.ts:161

data?
optional data?: Record<string, unknown>;

Defined in: core/channelTypes.ts:166

identifier?
optional identifier?: string;

Defined in: core/channelTypes.ts:162

messageType
messageType: string;

Defined in: core/channelTypes.ts:158

text?
optional text?: string;

Defined in: core/channelTypes.ts:163

title?
optional title?: string;

Defined in: core/channelTypes.ts:165

url?
optional url?: string;

Defined in: core/channelTypes.ts:164


BrowserActionSyncResult

Defined in: core/browserActions.ts:36

Synchronous return value from a browser action.

Properties

data?
optional data?: unknown;

Defined in: core/browserActions.ts:38

error?
optional error?: string;

Defined in: core/browserActions.ts:39

success
success: boolean;

Defined in: core/browserActions.ts:37


BrowserAudioEvent

Defined in: core/SessionClient.ts:65

A fully-assembled audio response from the runtime.

Emitted from SessionClient.onAudio after the runtime has finished streaming a startdelta* → done cycle.

Properties

dataUrl
dataUrl: string;

Defined in: core/SessionClient.ts:70

data:<mimeType>;base64,<concatenated chunks> URL ready to feed into <audio> or new Audio().

metadata?
optional metadata?: Record<string, unknown>;

Defined in: core/SessionClient.ts:71

mimeType
mimeType: string;

Defined in: core/SessionClient.ts:68

responseId
responseId: string;

Defined in: core/SessionClient.ts:67

Server-issued response id; correlates to a single readAloud / sendBrowserAction request.


BrowserContext

Defined in: core/channelTypes.ts:104

Properties

identifier?
optional identifier?: string;

Defined in: core/channelTypes.ts:106

metadata?
optional metadata?: Record<string, unknown>;

Defined in: core/channelTypes.ts:113

role?
optional role?: string;

Defined in: core/channelTypes.ts:107

source?
optional source?: string;

Defined in: core/channelTypes.ts:110

sourceLanguage?
optional sourceLanguage?: string;

Defined in: core/channelTypes.ts:108

targetLanguage?
optional targetLanguage?: string;

Defined in: core/channelTypes.ts:109

text?
optional text?: string;

Defined in: core/channelTypes.ts:105

title?
optional title?: string;

Defined in: core/channelTypes.ts:112

url?
optional url?: string;

Defined in: core/channelTypes.ts:111


ChannelMessage

Defined in: core/channelTypes.ts:205

Channel message envelope. All messages between browser ↔ telapi ↔ telphi follow this structure.

Properties

action?
optional action?: ActionPayload;

Defined in: core/channelTypes.ts:217

actionResult?
optional actionResult?: ActionResultPayload;

Defined in: core/channelTypes.ts:218

audio?
optional audio?: AudioPayload;

Defined in: core/channelTypes.ts:219

browserAction?
optional browserAction?: BrowserActionPayload;

Defined in: core/channelTypes.ts:216

chat?
optional chat?: ChatPayload;

Defined in: core/channelTypes.ts:215

control?
optional control?: ControlPayload;

Defined in: core/channelTypes.ts:221

direction
direction: MessageDirection;

Defined in: core/channelTypes.ts:213

error?
optional error?: ErrorPayload;

Defined in: core/channelTypes.ts:223

messageId
messageId: string;

Defined in: core/channelTypes.ts:209

reconnect?
optional reconnect?: ReconnectPayload;

Defined in: core/channelTypes.ts:222

sessionId
sessionId: string;

Defined in: core/channelTypes.ts:208

Server-issued session ID. Carries every message on the wire.

status?
optional status?: StatusPayload;

Defined in: core/channelTypes.ts:220

streamId?
optional streamId?: string;

Defined in: core/channelTypes.ts:211

Redis Stream entry id for replayable runtime-to-browser messages.

timestamp
timestamp: number;

Defined in: core/channelTypes.ts:212

type
type: ChannelMessageType;

Defined in: core/channelTypes.ts:206


ChatPayload

Defined in: core/channelTypes.ts:79

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:81

intent?
optional intent?:
| "conversation"
| "notification"
| "context_update"
| "browser_context"
| "action_update"
| "read_aloud";

Defined in: core/channelTypes.ts:82

metadata?
optional metadata?: Record<string, unknown>;

Defined in: core/channelTypes.ts:101

preferredResponse?
optional preferredResponse?: ResponseMode;

Defined in: core/channelTypes.ts:98

If responseExpected is true, which channel should AI use to respond?

relatedActionId?
optional relatedActionId?: string;

Defined in: core/channelTypes.ts:100

Correlates an async action update to the original action

responseExpected?
optional responseExpected?: boolean;

Defined in: core/channelTypes.ts:94

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:80


ControlPayload

Defined in: core/channelTypes.ts:119

Control message payload (Browser → ARI)

Properties

command
command: ControlCommand;

Defined in: core/channelTypes.ts:120

metadata?
optional metadata?: Record<string, unknown>;

Defined in: core/channelTypes.ts:125

settings?
optional settings?: {
responseMode?: ResponseMode;
sessionTimeout?: number;
};

Defined in: core/channelTypes.ts:121

responseMode?
optional responseMode?: ResponseMode;
sessionTimeout?
optional sessionTimeout?: number;

CustomBrowserActionParameters

Defined in: core/browserActions.ts:28

Indexable

[key: string]: unknown

Properties

type?
optional type?: string;

Defined in: core/browserActions.ts:29


DelphiClientState

Defined in: core/DelphiClient.ts:33

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:66

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:58

Read-only view of every active session keyed internally by endpointId + mode.

status
status: string;

Defined in: core/DelphiClient.ts:56

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:35

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:246

Properties

onNavigate?
optional onNavigate?: (path: string) => void;

Defined in: core/types.ts:248

Optional SPA-router callback; falls back to the History API when omitted

Parameters
ParameterType
pathstring
Returns

void


ErrorPayload

Defined in: core/channelTypes.ts:191

Error payload

Properties

code
code: string;

Defined in: core/channelTypes.ts:192

details?
optional details?: unknown;

Defined in: core/channelTypes.ts:194

message
message: string;

Defined in: core/channelTypes.ts:193


ExecuteBrowserActionOptions

Defined in: core/browserActions.ts:63

Properties

customHandlers?
optional customHandlers?: Record<string, BrowserActionHandler>;

Defined in: core/browserActions.ts:65

onNavigate?
optional onNavigate?: NavigateCallback;

Defined in: core/browserActions.ts:64

onUnknownAction?
optional onUnknownAction?: BrowserActionHandler;

Defined in: core/browserActions.ts:66


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
ParameterType
...argsunknown[]
Returns

void

error
error: (...args: unknown[]) => void;

Defined in: core/types.ts:21

Parameters
ParameterType
...argsunknown[]
Returns

void

info
info: (...args: unknown[]) => void;

Defined in: core/types.ts:19

Parameters
ParameterType
...argsunknown[]
Returns

void

warn
warn: (...args: unknown[]) => void;

Defined in: core/types.ts:20

Parameters
ParameterType
...argsunknown[]
Returns

void


Defined in: core/browserActions.ts:19

Properties

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
ParameterType
eventBrowserAudioEvent
Returns

void

signal?
optional signal?: AbortSignal;

Defined in: core/types.ts:169

Cancellation signal


ReconnectPayload

Defined in: core/channelTypes.ts:185

Reconnection handshake payload

Properties

lastReceivedMessageId?
optional lastReceivedMessageId?: string;

Defined in: core/channelTypes.ts:186

sessionData?
optional sessionData?: Record<string, unknown>;

Defined in: core/channelTypes.ts:187


RuntimeCapabilities

Defined in: core/types.ts:210

Properties

endpointId
endpointId: string;

Defined in: core/types.ts:211

flowDefinitionId
flowDefinitionId: string | null;

Defined in: core/types.ts:212

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:222

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:217

runtime
runtime: {
migration: RuntimeMigration[];
sessionContinuity: "supported";
};

Defined in: core/types.ts:213

migration
migration: RuntimeMigration[];
sessionContinuity
sessionContinuity: 'supported';
transports
transports: {
available: RuntimeTransport[];
preferred: RuntimeTransport[];
};

Defined in: core/types.ts:218

available
available: RuntimeTransport[];
preferred
preferred: RuntimeTransport[];

SessionListenOptions

Defined in: core/SessionClient.ts:74

Properties

capabilityId?
optional capabilityId?: string;

Defined in: core/SessionClient.ts:83

capabilitySlug?
optional capabilitySlug?: string;

Defined in: core/SessionClient.ts:84

endpointId?
optional endpointId?: string;

Defined in: core/SessionClient.ts:78

identifier
identifier: string;

Defined in: core/SessionClient.ts:75

includeCaptions?
optional includeCaptions?: boolean;

Defined in: core/SessionClient.ts:82

latencyOffsetMs?
optional latencyOffsetMs?: number;

Defined in: core/SessionClient.ts:81

messageType?
optional messageType?: string;

Defined in: core/SessionClient.ts:85

scope?
optional scope?: string;

Defined in: core/SessionClient.ts:77

sinceStreamId?
optional sinceStreamId?: string;

Defined in: core/SessionClient.ts:80

startMode?
optional startMode?: "live" | "from_beginning" | "from_sequence" | "closest_to_now";

Defined in: core/SessionClient.ts:79

targetLanguage
targetLanguage: string;

Defined in: core/SessionClient.ts:76


SessionOptions

Defined in: core/SessionClient.ts:109

Properties

autoPlayAudio?
optional autoPlayAudio?: boolean;

Defined in: core/SessionClient.ts:133

Automatically play completed runtime audio responses in the browser. (default: true)

autoReconnect?
optional autoReconnect?: boolean;

Defined in: core/SessionClient.ts:127

Enable auto-reconnection (default: true)

onAction?
optional onAction?: ActionHandler;

Defined in: core/SessionClient.ts:111

Handler for action requests from ARI

onAudio?
optional onAudio?: (audio: BrowserAudioEvent, message: ChannelMessage) => void;

Defined in: core/SessionClient.ts:121

Handler for completed runtime audio responses

Parameters
ParameterType
audioBrowserAudioEvent
messageChannelMessage
Returns

void

onChat?
optional onChat?: (chat: ChatPayload, message: ChannelMessage) => void;

Defined in: core/SessionClient.ts:115

Handler for text-chat messages specifically

Parameters
ParameterType
chatChatPayload
messageChannelMessage
Returns

void

onConnectionChange?
optional onConnectionChange?: (state: SessionConnectionState) => void;

Defined in: core/SessionClient.ts:123

Handler for connection state changes

Parameters
ParameterType
stateSessionConnectionState
Returns

void

onControl?
optional onControl?: (control: ControlPayload, message: ChannelMessage) => void;

Defined in: core/SessionClient.ts:119

Handler for control messages

Parameters
ParameterType
controlControlPayload
messageChannelMessage
Returns

void

onError?
optional onError?: (error: Error) => void;

Defined in: core/SessionClient.ts:125

Handler for errors

Parameters
ParameterType
errorError
Returns

void

onMessage?
optional onMessage?: MessageHandler;

Defined in: core/SessionClient.ts:113

Handler for all incoming messages

onStatus?
optional onStatus?: (status: StatusPayload, message: ChannelMessage) => void;

Defined in: core/SessionClient.ts:117

Handler for status updates

Parameters
ParameterType
statusStatusPayload
messageChannelMessage
Returns

void

pingInterval?
optional pingInterval?: number;

Defined in: core/SessionClient.ts:131

Ping interval in ms (default: 30000)

reconnectDelay?
optional reconnectDelay?: number;

Defined in: core/SessionClient.ts:129

Reconnect delay in ms (default: 2000)


SessionState

Defined in: core/SessionClient.ts:94

Properties

connected
connected: boolean;

Defined in: core/SessionClient.ts:96

connectionState
connectionState: SessionConnectionState;

Defined in: core/SessionClient.ts:95

endpointId
endpointId: string | null;

Defined in: core/SessionClient.ts:100

lastActivityAt
lastActivityAt: number;

Defined in: core/SessionClient.ts:106

Wall-clock ms of the last outbound send or inbound message.

lastError
lastError: Error | null;

Defined in: core/SessionClient.ts:104

messages
messages: ChannelMessage[];

Defined in: core/SessionClient.ts:103

mode
mode: SessionMode | null;

Defined in: core/SessionClient.ts:101

serverReady
serverReady: boolean;

Defined in: core/SessionClient.ts:98

True once the server has acknowledged this session channel.

sessionId
sessionId: string | null;

Defined in: core/SessionClient.ts:99

textChatEnabled
textChatEnabled: boolean;

Defined in: core/SessionClient.ts:102


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:23

Properties

message
message: string;

Defined in: core/browserActions.ts:24

title?
optional title?: string;

Defined in: core/browserActions.ts:25


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:179

Status update payload (bidirectional)

Properties

metadata?
optional metadata?: Record<string, unknown>;

Defined in: core/channelTypes.ts:181

state
state: StatusState;

Defined in: core/channelTypes.ts:180


SyncActionResult

Defined in: core/SessionClient.ts:43

Sync action result — action completed immediately.

Properties

data?
optional data?: unknown;

Defined in: core/SessionClient.ts:45

error?
optional error?: string;

Defined in: core/SessionClient.ts:46

success
success: boolean;

Defined in: core/SessionClient.ts:44


WsRefreshPayload

Defined in: core/channelTypes.ts:240

JWT payload for WebSocket authentication

Extends

Properties

endpointId
endpointId: string;

Defined in: core/channelTypes.ts:233

Inherited from

WsTokenPayload.endpointId

exp
exp: number;

Defined in: core/channelTypes.ts:236

Inherited from

WsTokenPayload.exp

iat
iat: number;

Defined in: core/channelTypes.ts:235

Inherited from

WsTokenPayload.iat

originalIat
originalIat: number;

Defined in: core/channelTypes.ts:242

refreshable
refreshable: boolean;

Defined in: core/channelTypes.ts:241

sessionId
sessionId: string;

Defined in: core/channelTypes.ts:232

Inherited from

WsTokenPayload.sessionId

sub
sub: 'ws_token';

Defined in: core/channelTypes.ts:237

Inherited from

WsTokenPayload.sub

teamId
teamId: string;

Defined in: core/channelTypes.ts:234

Inherited from

WsTokenPayload.teamId


WsTokenPayload

Defined in: core/channelTypes.ts:231

JWT payload for WebSocket authentication

Extended by

Properties

endpointId
endpointId: string;

Defined in: core/channelTypes.ts:233

exp
exp: number;

Defined in: core/channelTypes.ts:236

iat
iat: number;

Defined in: core/channelTypes.ts:235

sessionId
sessionId: string;

Defined in: core/channelTypes.ts:232

sub
sub: 'ws_token';

Defined in: core/channelTypes.ts:237

teamId
teamId: string;

Defined in: core/channelTypes.ts:234

Type Aliases

ActionHandler

type ActionHandler = (action: ActionPayload) => Promise<ActionResult>;

Defined in: core/SessionClient.ts:89

Handler invoked when the AI requests a browser action

Parameters

ParameterType
actionActionPayload

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:57


ActionStatus

type ActionStatus = 'received' | 'executing' | 'completed' | 'failed';

Defined in: core/channelTypes.ts:140


BrowserActionHandler

type BrowserActionHandler = (
action: Pick<ActionPayload, 'name' | 'parameters'>,
) => Promise<BrowserActionResult> | BrowserActionResult;

Defined in: core/browserActions.ts:53

Parameters

ParameterType
actionPick<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:51


BrowserSelectionContext

type BrowserSelectionContext = BrowserContext;

Defined in: core/channelTypes.ts:116


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';

Defined in: core/channelTypes.ts:56


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:92

Handler invoked for every inbound message

Parameters

ParameterType
messageChannelMessage

Returns

void


MessageRole

type MessageRole = 'user' | 'assistant' | 'system';

Defined in: core/channelTypes.ts:40


type NavigateCallback = (path: string) => void;

Defined in: core/browserActions.ts:61

Optional callback for SPA-router navigation. When not provided, the navigate_current action falls back to the History API.

Parameters

ParameterType
pathstring

Returns

void


ResponseMode

type ResponseMode = 'voice' | 'text' | 'both';

Defined in: core/channelTypes.ts:65

How the AI should respond to messages


RuntimeInteractionMode

type RuntimeInteractionMode = SessionMode;

Defined in: core/types.ts:204


RuntimeMigration

type RuntimeMigration = 'text_to_voice' | 'api_to_media';

Defined in: core/types.ts:208


RuntimeTransport

type RuntimeTransport = 'rest' | 'websocket' | 'existing_media' | 'webrtc';

Defined in: core/types.ts:206


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:287


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:266

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';
readonly NAVIGATE: "navigate" = 'navigate';
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

ParameterTypeDefault value
sessionIdstringundefined
actionIdstringundefined
status"received" | "executing"'received'

Returns

ChannelMessage


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

ParameterType
sessionIdstring
namestring
parametersRecord<string, unknown>
options{ description?: string; priority?: ActionPriority; requiresResponse?: boolean; timeoutMs?: number; }
options.description?string
options.priority?ActionPriority
options.requiresResponse?boolean
options.timeoutMs?number

Returns

ChannelMessage


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

ParameterType
sessionIdstring
actionIdstring
successboolean
options{ data?: unknown; durationMs?: number; error?: string; }
options.data?unknown
options.durationMs?number
options.error?string

Returns

ChannelMessage


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

ParameterType
sessionIdstring
actionIdstring
contentstring
metadata?Record<string, unknown>

Returns

ChannelMessage


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

ParameterType
sessionIdstring
actionIdstring
successboolean
options{ data?: unknown; durationMs?: number; error?: string; }
options.data?unknown
options.durationMs?number
options.error?string

Returns

ChannelMessage


createAudioMessage()

function createAudioMessage(sessionId: string, payload: AudioPayload): ChannelMessage;

Defined in: core/utils/channel.ts:64

Create a playable audio message (Runtime → Browser)

Parameters

ParameterType
sessionIdstring
payloadAudioPayload

Returns

ChannelMessage


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

ParameterType
typeChannelMessageType
sessionIdstring
directionMessageDirection

Returns

Omit<ChannelMessage, | "chat" | "browserAction" | "action" | "actionResult" | "audio" | "status" | "reconnect" | "error" | "control">


createBrowserActionMessage()

function createBrowserActionMessage(
sessionId: string,
payload: BrowserActionPayload,
): ChannelMessage;

Defined in: core/utils/channel.ts:53

Create a browser-originated capability trigger (Browser → Runtime)

Parameters

ParameterType
sessionIdstring
payloadBrowserActionPayload

Returns

ChannelMessage


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

ParameterType
sessionIdstring
browserContextBrowserContext

Returns

ChannelMessage


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

ParameterType
sessionIdstring
selectionBrowserContext

Returns

ChannelMessage


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

ParameterType
sessionIdstring
directionMessageDirection
roleMessageRole
contentstring
metadata?Record<string, unknown>

Returns

ChannelMessage


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

ParameterType
sessionIdstring
contentstring
metadata?Record<string, unknown>

Returns

ChannelMessage


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

ParameterType
sessionIdstring
commandControlCommand
settings?{ responseMode?: ResponseMode; sessionTimeout?: number; }
settings.responseMode?ResponseMode
settings.sessionTimeout?number
metadata?Record<string, unknown>

Returns

ChannelMessage


createDisableTextChatMessage()

function createDisableTextChatMessage(sessionId: string): ChannelMessage;

Defined in: core/utils/channel.ts:249

Create a disable-text-chat control message

Parameters

ParameterType
sessionIdstring

Returns

ChannelMessage


createEnableTextChatMessage()

function createEnableTextChatMessage(
sessionId: string,
responseMode?: ResponseMode,
): ChannelMessage;

Defined in: core/utils/channel.ts:241

Create an enable-text-chat control message

Parameters

ParameterTypeDefault value
sessionIdstringundefined
responseModeResponseMode'text'

Returns

ChannelMessage


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

ParameterType
sessionIdstring
directionMessageDirection
codestring
messagestring
details?unknown

Returns

ChannelMessage


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

ParameterType
sessionIdstring

Returns

ChannelMessage


createPongMessage()

function createPongMessage(sessionId: string): ChannelMessage;

Defined in: core/utils/channel.ts:374

Create a keepalive pong message

Parameters

ParameterType
sessionIdstring

Returns

ChannelMessage


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

ParameterType
sessionIdstring
contentstring
metadata?Record<string, unknown>

Returns

ChannelMessage


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

ParameterType
sessionIdstring
lastReceivedStreamId?string
sessionData?Record<string, unknown>

Returns

ChannelMessage


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

ParameterType
sessionIdstring
responseModeResponseMode

Returns

ChannelMessage


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

ParameterType
sessionIdstring
directionMessageDirection
stateStatusState
metadata?Record<string, unknown>

Returns

ChannelMessage


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

ParameterType
sessionIdstring
contentstring
metadata?Record<string, unknown>

Returns

ChannelMessage


executeBrowserAction()

function executeBrowserAction(
action: Pick<ActionPayload, 'name' | 'parameters'>,
optionsOrNavigate?: ExecuteBrowserActionOptions | NavigateCallback,
): Promise<BrowserActionResult>;

Defined in: core/browserActions.ts:91

Execute a browser action dispatched by the AI.

This is a pure function with no React or store dependencies — pass it directly to SessionClient as the onAction callback, or call it manually.

Parameters

ParameterTypeDescription
actionPick<ActionPayload, "name" | "parameters">The action payload from the AI
optionsOrNavigate?| ExecuteBrowserActionOptions | NavigateCallback-

Returns

Promise<BrowserActionResult>


getChannelStream()

function getChannelStream(sessionId: string): string;

Defined in: core/channelTypes.ts:257

Parameters

ParameterType
sessionIdstring

Returns

string


getToAriChannel()

function getToAriChannel(sessionId: string): string;

Defined in: core/channelTypes.ts:249

Parameters

ParameterType
sessionIdstring

Returns

string


getToBrowserChannel()

function getToBrowserChannel(sessionId: string): string;

Defined in: core/channelTypes.ts:253

Parameters

ParameterType
sessionIdstring

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

ParameterType
...argsunknown[]

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

ParameterTypeDefault valueDescription
digitstringundefinedOne of 0-9, *, #
durationMsnumber150Tone duration in ms (default: 150)

Returns

void


randomString()

function randomString(len: number): string;

Defined in: core/utils/index.ts:37

Generate a random alphanumeric string of len characters

Parameters

ParameterType
lennumber

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

ParameterType
statePersistedSessionState

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

ParameterTypeDefault value
pcRTCPeerConnectionundefined
preferPcmabooleantrue

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

ParameterType
customLoggerLogger | undefined

Returns

void