@craftedxp/voice-js 0.3.2 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.d.ts CHANGED
@@ -1,295 +1,339 @@
1
1
  interface ClientTool {
2
- description: string;
3
- parameters: Record<string, unknown>;
4
- usage?: string;
5
- timeoutMs?: number;
6
- example?: string;
7
- handler: (args: Record<string, unknown>) => Promise<string | object> | string | object;
2
+ description: string
3
+ parameters: Record<string, unknown>
4
+ usage?: string
5
+ timeoutMs?: number
6
+ example?: string
7
+ handler: (args: Record<string, unknown>) => Promise<string | object> | string | object
8
8
  }
9
- type ClientToolMap = Record<string, ClientTool>;
9
+ type ClientToolMap = Record<string, ClientTool>
10
10
  interface ClientToolCallFrame {
11
- toolCallId: string;
12
- name: string;
13
- args: Record<string, unknown>;
11
+ toolCallId: string
12
+ name: string
13
+ args: Record<string, unknown>
14
14
  }
15
15
 
16
- type CallState = 'idle' | 'connecting' | 'listening' | 'user_speaking' | 'agent_speaking' | 'ended' | 'error';
17
- type TranscriptEntry = {
18
- id: string;
19
- role: 'user';
20
- text: string;
21
- committed: boolean;
22
- } | {
23
- id: string;
24
- role: 'agent';
25
- text: string;
26
- interrupted?: boolean;
27
- } | {
28
- id: string;
29
- role: 'tool';
30
- text: string;
31
- } | {
32
- id: string;
33
- role: 'system';
34
- text: string;
35
- };
36
- type CallErrorCode = 'missing_credentials' | 'forbidden' | 'mic_denied' | 'mic_start_failed' | 'audio_session_failed' | 'token_expired' | 'token_invalid' | 'unauthorized' | 'network_unreachable' | 'socket_error' | 'payment_required' | 'not_found' | 'silence_timeout' | 'server_error';
16
+ type CallState =
17
+ | 'idle'
18
+ | 'connecting'
19
+ | 'listening'
20
+ | 'user_speaking'
21
+ | 'agent_speaking'
22
+ | 'ended'
23
+ | 'error'
24
+ type TranscriptEntry =
25
+ | {
26
+ id: string
27
+ role: 'user'
28
+ text: string
29
+ committed: boolean
30
+ }
31
+ | {
32
+ id: string
33
+ role: 'agent'
34
+ text: string
35
+ interrupted?: boolean
36
+ }
37
+ | {
38
+ id: string
39
+ role: 'tool'
40
+ text: string
41
+ }
42
+ | {
43
+ id: string
44
+ role: 'system'
45
+ text: string
46
+ }
47
+ type CallErrorCode =
48
+ | 'missing_credentials'
49
+ | 'forbidden'
50
+ | 'mic_denied'
51
+ | 'mic_start_failed'
52
+ | 'audio_session_failed'
53
+ | 'token_expired'
54
+ | 'token_invalid'
55
+ | 'unauthorized'
56
+ | 'network_unreachable'
57
+ | 'socket_error'
58
+ | 'payment_required'
59
+ | 'not_found'
60
+ | 'silence_timeout'
61
+ | 'server_error'
37
62
  interface CallError {
38
- code: CallErrorCode;
39
- message: string;
63
+ code: CallErrorCode
64
+ message: string
40
65
  }
41
- type CallEndReason = 'agent_ended' | 'user_hangup' | 'timeout' | 'error';
66
+ type CallEndReason = 'agent_ended' | 'user_hangup' | 'timeout' | 'error'
42
67
  interface CallEndEvent {
43
- reason: CallEndReason;
44
- errorCode?: CallErrorCode;
45
- durationMs: number;
68
+ reason: CallEndReason
69
+ errorCode?: CallErrorCode
70
+ durationMs: number
46
71
  }
47
72
  interface VolumeEvent {
48
- input: number;
49
- output: number;
73
+ input: number
74
+ output: number
50
75
  }
51
76
  type ServerMessage = Record<string, unknown> & {
52
- type?: string;
53
- };
77
+ type?: string
78
+ }
54
79
  interface ProtocolState {
55
- state: CallState;
56
- transcript: TranscriptEntry[];
57
- agentBubbleId: string | null;
58
- idCounter: number;
59
- endReason: CallEndReason | null;
80
+ state: CallState
81
+ transcript: TranscriptEntry[]
82
+ agentBubbleId: string | null
83
+ idCounter: number
84
+ endReason: CallEndReason | null
60
85
  }
61
- declare const createProtocolState: () => ProtocolState;
86
+ declare const createProtocolState: () => ProtocolState
62
87
  interface ProtocolCallbacks {
63
- onState: (next: CallState) => void;
64
- onTranscript: (entries: TranscriptEntry[]) => void;
65
- onError: (err: CallError) => void;
66
- onInterrupt: () => void;
67
- onAgentTurnStart: () => void;
68
- onCallEnd: (reason: CallEndReason) => void;
69
- onConnected: () => void;
70
- onClientToolCall: (frame: ClientToolCallFrame) => void;
88
+ onState: (next: CallState) => void
89
+ onTranscript: (entries: TranscriptEntry[]) => void
90
+ onError: (err: CallError) => void
91
+ onInterrupt: () => void
92
+ onAgentTurnStart: (seq?: number) => void
93
+ onAgentTurnEnd: (seq?: number) => void
94
+ onCallEnd: (reason: CallEndReason) => void
95
+ onConnected: () => void
96
+ onClientToolCall: (frame: ClientToolCallFrame) => void
71
97
  }
72
- declare function handleServerMessage(raw: string, state: ProtocolState, cb: ProtocolCallbacks): void;
98
+ declare function handleServerMessage(raw: string, state: ProtocolState, cb: ProtocolCallbacks): void
73
99
  interface BuildWsUrlArgs {
74
- apiBase: string;
75
- agentId: string;
76
- token: string;
77
- bargeIn?: boolean;
100
+ apiBase: string
101
+ agentId: string
102
+ token: string
103
+ bargeIn?: boolean
78
104
  }
79
- declare function buildWsUrl(args: BuildWsUrlArgs): string;
105
+ declare function buildWsUrl(args: BuildWsUrlArgs): string
80
106
 
81
107
  interface FetchTokenArgs {
82
- /** The agent the SDK is about to call. */
83
- agentId: string;
84
- /**
85
- * Optional consumer-side user identifier. Round-tripped to the server
86
- * as `contactId` for Phase 11 contact memory. The SDK does not
87
- * inspect this; your backend uses it to scope the token mint.
88
- */
89
- userId?: string;
90
- /**
91
- * Per-call structured context lowered into the agent's effective
92
- * system prompt server-side at session open. Opaque to the SDK.
93
- */
94
- context?: Record<string, unknown>;
95
- /**
96
- * String key/value pairs round-tripped on the `call.ended` webhook.
97
- * Capped at 1 KB total server-side. NOT lowered into the system prompt.
98
- */
99
- metadata?: Record<string, string>;
108
+ /** The agent the SDK is about to call. */
109
+ agentId: string
110
+ /**
111
+ * Optional consumer-side user identifier. Round-tripped to the server
112
+ * as `contactId` for Phase 11 contact memory. The SDK does not
113
+ * inspect this; your backend uses it to scope the token mint.
114
+ */
115
+ userId?: string
116
+ /**
117
+ * Per-call structured context lowered into the agent's effective
118
+ * system prompt server-side at session open. Opaque to the SDK.
119
+ */
120
+ context?: Record<string, unknown>
121
+ /**
122
+ * String key/value pairs round-tripped on the `call.ended` webhook.
123
+ * Capped at 1 KB total server-side. NOT lowered into the system prompt.
124
+ */
125
+ metadata?: Record<string, string>
126
+ }
127
+ /**
128
+ * What `fetchToken` may return. The rich object form lets the server
129
+ * choose the transport per call. Returning a bare string is backwards-
130
+ * compatible — the SDK treats it as `{ token, transport: 'ws' }`.
131
+ */
132
+ interface FetchTokenResult {
133
+ /** Raw `ct_` to feed into the WS open / WebRTC offer. */
134
+ token: string
135
+ /** Server-selected transport. Default `'ws'` if absent. */
136
+ transport?: 'ws' | 'webrtc'
137
+ /** Required when `transport === 'webrtc'` AND the server uses a
138
+ * separate signaling gateway. When omitted on a webrtc result, the
139
+ * SDK falls back to the API base's Phase-1 routes (local dev). */
140
+ webrtcGatewayBase?: string
100
141
  }
101
- type FetchToken = (args: FetchTokenArgs) => Promise<string>;
142
+ type FetchToken = (args: FetchTokenArgs) => Promise<string | FetchTokenResult>
102
143
  interface VoiceClientConfig {
103
- /**
104
- * Full HTTPS URL of the Voxline server. The WebSocket scheme is
105
- * derived: `https` → `wss`, `http` → `ws`. No trailing slash needed.
106
- */
107
- apiBase: string;
108
- /**
109
- * Called by the SDK whenever it needs a fresh `ct_` token (initial
110
- * connect; mid-call refresh on `token_expired`). Your implementation
111
- * should hit YOUR backend, which holds the `sk_` API key and mints
112
- * via `POST /v1/call-tokens` (or `client.callTokens.mint` from
113
- * @craftedxp/sdk-node). Never embed `sk_` in JS code that ships to a
114
- * client.
115
- */
116
- fetchToken: FetchToken;
117
- /**
118
- * Optional metadata applied to EVERY startCall. Per-call `metadata`
119
- * in `startCall` is merged on top (per-call wins on key conflicts).
120
- * Useful for dashboard-wide tags like `{ surface: 'web', appVersion }`.
121
- */
122
- defaultMetadata?: Record<string, string>;
123
- /**
124
- * Optional context applied to EVERY startCall. Per-call `context` in
125
- * `startCall` is merged on top. Useful for cross-call invariants like
126
- * the signed-in user's locale.
127
- */
128
- defaultContext?: Record<string, unknown>;
144
+ /**
145
+ * Full HTTPS URL of the Voissia server. The WebSocket scheme is
146
+ * derived: `https` → `wss`, `http` → `ws`. No trailing slash needed.
147
+ */
148
+ apiBase: string
149
+ /**
150
+ * Called by the SDK whenever it needs a fresh `ct_` token (initial
151
+ * connect; mid-call refresh on `token_expired`). Your implementation
152
+ * should hit YOUR backend, which holds the `sk_` API key and mints
153
+ * via `POST /v1/call-tokens` (or `client.callTokens.mint` from
154
+ * @craftedxp/sdk-node). Never embed `sk_` in JS code that ships to a
155
+ * client.
156
+ */
157
+ fetchToken: FetchToken
158
+ /**
159
+ * Optional metadata applied to EVERY startCall. Per-call `metadata`
160
+ * in `startCall` is merged on top (per-call wins on key conflicts).
161
+ * Useful for dashboard-wide tags like `{ surface: 'web', appVersion }`.
162
+ */
163
+ defaultMetadata?: Record<string, string>
164
+ /**
165
+ * Optional context applied to EVERY startCall. Per-call `context` in
166
+ * `startCall` is merged on top. Useful for cross-call invariants like
167
+ * the signed-in user's locale.
168
+ */
169
+ defaultContext?: Record<string, unknown>
129
170
  }
130
171
  interface StartCallOptions {
131
- /** The agent to call. */
132
- agentId: string;
133
- /** Per-call user identifier. Round-tripped to fetchToken as `userId`. */
134
- userId?: string;
135
- /**
136
- * Per-call structured context. Merged on top of `defaultContext`
137
- * configured at factory time.
138
- */
139
- context?: Record<string, unknown>;
140
- /**
141
- * Per-call metadata. Merged on top of `defaultMetadata` configured
142
- * at factory time.
143
- */
144
- metadata?: Record<string, string>;
145
- /**
146
- * When false, the SDK + server stay full-duplex but barge-in is
147
- * suppressed. Useful for alarm-style flows where the user shouldn't
148
- * accidentally interrupt the script. Default true.
149
- */
150
- bargeIn?: boolean;
151
- /**
152
- * Client-side tools the agent's LLM can call mid-conversation. Each
153
- * tool's handler runs on the consumer's side; result is fed back to
154
- * the LLM through the existing call WebSocket. Schema and handler
155
- * colocate. Validated synchronously at startCall — bad input throws.
156
- *
157
- * See docs/integration-echocheck.md for the wire protocol and the
158
- * server-side guarantees.
159
- */
160
- clientTools?: ClientToolMap;
161
- /**
162
- * Test-only escape hatch — pass a pre-minted `ct_` directly and skip
163
- * the `fetchToken` call. Don't use this in production code: tokens
164
- * expire and the SDK can't re-mint without the callback.
165
- */
166
- token?: string;
167
- onStateChange?: (state: CallState) => void;
168
- onTranscript?: (entries: TranscriptEntry[]) => void;
169
- onError?: (err: CallError) => void;
170
- onEnd?: (end: CallEndEvent) => void;
171
- /** Volume-meter event for VU UIs. ~10 Hz cadence (browser bundle only). */
172
- onVolume?: (vol: VolumeEvent) => void;
173
- /**
174
- * Fires when the server signals barge-in (the user started talking
175
- * mid-agent-turn). The browser bundle automatically flushes its
176
- * built-in audio playback before this callback runs; the callback is
177
- * fired regardless. Node / Electron consumers with custom playback
178
- * should drain their audio queue here so the agent goes silent
179
- * immediately.
180
- */
181
- onInterrupt?: () => void;
182
- /**
183
- * Fires on `agent_turn_start` — the server has begun a new agent
184
- * turn. The state-machine transition to `agent_speaking` happens at
185
- * the same moment via `onStateChange`; use this when you want a
186
- * precise turn anchor (e.g. "agent has been speaking for N ms" UIs)
187
- * without diffing state.
188
- */
189
- onAgentTurnStart?: () => void;
172
+ /** The agent to call. */
173
+ agentId: string
174
+ /** Per-call user identifier. Round-tripped to fetchToken as `userId`. */
175
+ userId?: string
176
+ /**
177
+ * Per-call structured context. Merged on top of `defaultContext`
178
+ * configured at factory time.
179
+ */
180
+ context?: Record<string, unknown>
181
+ /**
182
+ * Per-call metadata. Merged on top of `defaultMetadata` configured
183
+ * at factory time.
184
+ */
185
+ metadata?: Record<string, string>
186
+ /**
187
+ * When false, the SDK + server stay full-duplex but barge-in is
188
+ * suppressed. Useful for alarm-style flows where the user shouldn't
189
+ * accidentally interrupt the script. Default true.
190
+ */
191
+ bargeIn?: boolean
192
+ /**
193
+ * Client-side tools the agent's LLM can call mid-conversation. Each
194
+ * tool's handler runs on the consumer's side; result is fed back to
195
+ * the LLM through the existing call WebSocket. Schema and handler
196
+ * colocate. Validated synchronously at startCall — bad input throws.
197
+ *
198
+ * See docs/integration-echocheck.md for the wire protocol and the
199
+ * server-side guarantees.
200
+ */
201
+ clientTools?: ClientToolMap
202
+ /**
203
+ * Test-only escape hatch — pass a pre-minted `ct_` directly and skip
204
+ * the `fetchToken` call. Don't use this in production code: tokens
205
+ * expire and the SDK can't re-mint without the callback.
206
+ */
207
+ token?: string
208
+ onStateChange?: (state: CallState) => void
209
+ onTranscript?: (entries: TranscriptEntry[]) => void
210
+ onError?: (err: CallError) => void
211
+ onEnd?: (end: CallEndEvent) => void
212
+ /** Volume-meter event for VU UIs. ~10 Hz cadence (browser bundle only). */
213
+ onVolume?: (vol: VolumeEvent) => void
214
+ /**
215
+ * Fires when the server signals barge-in (the user started talking
216
+ * mid-agent-turn). The browser bundle automatically flushes its
217
+ * built-in audio playback before this callback runs; the callback is
218
+ * fired regardless. Node / Electron consumers with custom playback
219
+ * should drain their audio queue here so the agent goes silent
220
+ * immediately.
221
+ */
222
+ onInterrupt?: () => void
223
+ /**
224
+ * Fires on `agent_turn_start` — the server has begun a new agent
225
+ * turn. The state-machine transition to `agent_speaking` happens at
226
+ * the same moment via `onStateChange`; use this when you want a
227
+ * precise turn anchor (e.g. "agent has been speaking for N ms" UIs)
228
+ * without diffing state.
229
+ */
230
+ onAgentTurnStart?: () => void
190
231
  }
191
232
  interface Call {
192
- /** Current state. Snapshot — subscribe via onStateChange for live updates. */
193
- readonly state: CallState;
194
- /** Full transcript so far. Snapshot — subscribe via onTranscript for live updates. */
195
- readonly transcript: TranscriptEntry[];
196
- /** True after `mute()` and before `unmute()`. */
197
- readonly isMuted: boolean;
198
- /** End the call locally. Closes the WS, stops the mic, fires onEnd. Idempotent. */
199
- end: () => void;
200
- /** Mute mic frames. Wire stays active so server endpointing doesn't false-positive. Idempotent. */
201
- mute: () => void;
202
- /** Unmute mic frames. Idempotent. */
203
- unmute: () => void;
233
+ /** Current state. Snapshot — subscribe via onStateChange for live updates. */
234
+ readonly state: CallState
235
+ /** Full transcript so far. Snapshot — subscribe via onTranscript for live updates. */
236
+ readonly transcript: TranscriptEntry[]
237
+ /** True after `mute()` and before `unmute()`. */
238
+ readonly isMuted: boolean
239
+ /** End the call locally. Closes the WS, stops the mic, fires onEnd. Idempotent. */
240
+ end: () => void
241
+ /** Mute mic frames. Wire stays active so server endpointing doesn't false-positive. Idempotent. */
242
+ mute: () => void
243
+ /** Unmute mic frames. Idempotent. */
244
+ unmute: () => void
204
245
  }
205
246
  interface VoiceClientFactory {
206
- /** Read back the resolved config (post trailing-slash normalisation). */
207
- readonly config: VoiceClientConfig;
208
- /**
209
- * Open a fresh call. Returns when the WS is open; rejects on
210
- * pre-flight failure (missing config, fetchToken throw, etc). Mid-
211
- * call failures arrive via the per-call `onError` callback — they
212
- * don't reject this promise.
213
- */
214
- startCall: (options: StartCallOptions) => Promise<Call>;
247
+ /** Read back the resolved config (post trailing-slash normalisation). */
248
+ readonly config: VoiceClientConfig
249
+ /**
250
+ * Open a fresh call. Returns when the WS is open; rejects on
251
+ * pre-flight failure (missing config, fetchToken throw, etc). Mid-
252
+ * call failures arrive via the per-call `onError` callback — they
253
+ * don't reject this promise.
254
+ */
255
+ startCall: (options: StartCallOptions) => Promise<Call>
215
256
  }
216
257
 
217
- type OnChunk = (pcm: ArrayBuffer) => void;
218
- type OnVolume$1 = (rms01: number) => void;
219
- type OnError = (err: Error) => void;
258
+ type OnChunk = (pcm: ArrayBuffer) => void
259
+ type OnVolume$1 = (rms01: number) => void
260
+ type OnError = (err: Error) => void
220
261
  interface CaptureOptions {
221
- onChunk: OnChunk;
222
- onVolume?: OnVolume$1;
223
- onError?: OnError;
262
+ onChunk: OnChunk
263
+ onVolume?: OnVolume$1
264
+ onError?: OnError
224
265
  }
225
266
  interface CaptureController {
226
- start: () => Promise<void>;
227
- stop: () => void;
228
- mute: (muted: boolean) => void;
229
- isCapturing: () => boolean;
267
+ start: () => Promise<void>
268
+ stop: () => void
269
+ mute: (muted: boolean) => void
270
+ isCapturing: () => boolean
230
271
  }
231
- declare const createAudioCapture: (options: CaptureOptions) => CaptureController;
272
+ declare const createAudioCapture: (options: CaptureOptions) => CaptureController
232
273
 
233
- type OnVolume = (rms01: number) => void;
234
- type OnAgentSpeakingChange = (speaking: boolean) => void;
274
+ type OnVolume = (rms01: number) => void
275
+ type OnAgentSpeakingChange = (speaking: boolean) => void
235
276
  interface PlaybackOptions {
236
- sampleRate?: number;
237
- onVolume?: OnVolume;
238
- onSpeakingChange?: OnAgentSpeakingChange;
277
+ sampleRate?: number
278
+ onVolume?: OnVolume
279
+ onSpeakingChange?: OnAgentSpeakingChange
239
280
  }
240
281
  interface PlaybackController {
241
- enqueue: (pcm: ArrayBuffer) => void;
242
- flush: () => void;
243
- close: () => void;
244
- resume: () => Promise<void>;
282
+ enqueue: (pcm: ArrayBuffer) => void
283
+ flush: () => void
284
+ close: () => void
285
+ resume: () => Promise<void>
245
286
  }
246
- declare const createAudioPlayback: (options?: PlaybackOptions) => PlaybackController;
287
+ declare const createAudioPlayback: (options?: PlaybackOptions) => PlaybackController
247
288
 
248
- type RWSEvent = {
249
- type: 'open';
250
- } | {
251
- type: 'reconnected';
252
- } | {
253
- type: 'message';
254
- data: string | ArrayBuffer;
255
- } | {
256
- type: 'close';
257
- code: number;
258
- reason: string;
259
- permanent: boolean;
260
- } | {
261
- type: 'error';
262
- error: Error;
263
- };
289
+ type RWSEvent =
290
+ | {
291
+ type: 'open'
292
+ }
293
+ | {
294
+ type: 'reconnected'
295
+ }
296
+ | {
297
+ type: 'message'
298
+ data: string | ArrayBuffer
299
+ }
300
+ | {
301
+ type: 'close'
302
+ code: number
303
+ reason: string
304
+ permanent: boolean
305
+ }
306
+ | {
307
+ type: 'error'
308
+ error: Error
309
+ }
264
310
  interface WebSocketLike {
265
- binaryType: string;
266
- readyState: number;
267
- onopen: ((ev: unknown) => void) | null;
268
- onmessage: ((ev: {
269
- data: string | ArrayBuffer;
270
- }) => void) | null;
271
- onerror: ((ev: unknown) => void) | null;
272
- onclose: ((ev: {
273
- code: number;
274
- reason: string;
275
- }) => void) | null;
276
- send: (data: string | ArrayBuffer | ArrayBufferView) => void;
277
- close: (code?: number, reason?: string) => void;
311
+ binaryType: string
312
+ readyState: number
313
+ onopen: ((ev: unknown) => void) | null
314
+ onmessage: ((ev: { data: string | ArrayBuffer }) => void) | null
315
+ onerror: ((ev: unknown) => void) | null
316
+ onclose: ((ev: { code: number; reason: string }) => void) | null
317
+ send: (data: string | ArrayBuffer | ArrayBufferView) => void
318
+ close: (code?: number, reason?: string) => void
278
319
  }
279
- type WebSocketFactory = (url: string) => WebSocketLike;
320
+ type WebSocketFactory = (url: string) => WebSocketLike
280
321
  interface RWSOptions {
281
- url: string;
282
- wsFactory: WebSocketFactory;
283
- maxRetries?: number;
284
- initialBackoffMs?: number;
285
- maxBackoffMs?: number;
322
+ url: string
323
+ wsFactory: WebSocketFactory
324
+ maxRetries?: number
325
+ initialBackoffMs?: number
326
+ maxBackoffMs?: number
327
+ }
328
+ declare const createReconnectingWebSocket: (
329
+ options: RWSOptions,
330
+ onEvent: (ev: RWSEvent) => void,
331
+ ) => {
332
+ send: (data: string | ArrayBuffer | ArrayBufferView) => void
333
+ close: (code?: number, reason?: string) => void
334
+ readyState: () => number
286
335
  }
287
- declare const createReconnectingWebSocket: (options: RWSOptions, onEvent: (ev: RWSEvent) => void) => {
288
- send: (data: string | ArrayBuffer | ArrayBufferView) => void;
289
- close: (code?: number, reason?: string) => void;
290
- readyState: () => number;
291
- };
292
- type ReconnectingWebSocket = ReturnType<typeof createReconnectingWebSocket>;
336
+ type ReconnectingWebSocket = ReturnType<typeof createReconnectingWebSocket>
293
337
 
294
338
  /**
295
339
  * One-time SDK setup. Returns a factory you call `startCall` on for
@@ -316,6 +360,46 @@ type ReconnectingWebSocket = ReturnType<typeof createReconnectingWebSocket>;
316
360
  * call.mute()
317
361
  * call.end()
318
362
  */
319
- declare function configureVoiceClient(config: VoiceClientConfig): VoiceClientFactory;
363
+ declare function configureVoiceClient(config: VoiceClientConfig): VoiceClientFactory
320
364
 
321
- export { type Call, type CallEndEvent, type CallEndReason, type CallError, type CallErrorCode, type CallState, type CaptureController, type CaptureOptions, type ClientTool, type ClientToolMap, type FetchToken, type FetchTokenArgs, type OnAgentSpeakingChange, type OnChunk, type OnError, type OnVolume$1 as OnVolume, type PlaybackController, type PlaybackOptions, type ProtocolCallbacks, type ProtocolState, type RWSEvent, type RWSOptions, type ReconnectingWebSocket, type ServerMessage, type StartCallOptions, type TranscriptEntry, type VoiceClientConfig, type VoiceClientFactory, type VolumeEvent, type WebSocketFactory, type WebSocketLike, buildWsUrl, configureVoiceClient, createAudioCapture, createAudioPlayback, createProtocolState, createReconnectingWebSocket, handleServerMessage };
365
+ export {
366
+ type Call,
367
+ type CallEndEvent,
368
+ type CallEndReason,
369
+ type CallError,
370
+ type CallErrorCode,
371
+ type CallState,
372
+ type CaptureController,
373
+ type CaptureOptions,
374
+ type ClientTool,
375
+ type ClientToolMap,
376
+ type FetchToken,
377
+ type FetchTokenArgs,
378
+ type FetchTokenResult,
379
+ type OnAgentSpeakingChange,
380
+ type OnChunk,
381
+ type OnError,
382
+ type OnVolume$1 as OnVolume,
383
+ type PlaybackController,
384
+ type PlaybackOptions,
385
+ type ProtocolCallbacks,
386
+ type ProtocolState,
387
+ type RWSEvent,
388
+ type RWSOptions,
389
+ type ReconnectingWebSocket,
390
+ type ServerMessage,
391
+ type StartCallOptions,
392
+ type TranscriptEntry,
393
+ type VoiceClientConfig,
394
+ type VoiceClientFactory,
395
+ type VolumeEvent,
396
+ type WebSocketFactory,
397
+ type WebSocketLike,
398
+ buildWsUrl,
399
+ configureVoiceClient,
400
+ createAudioCapture,
401
+ createAudioPlayback,
402
+ createProtocolState,
403
+ createReconnectingWebSocket,
404
+ handleServerMessage,
405
+ }