@craftedxp/voice-js 0.3.1 → 0.4.0
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/CONSUMING.md +1 -1
- package/README.md +8 -7
- package/dist/browser.d.mts +20 -4
- package/dist/browser.d.ts +334 -250
- package/dist/browser.js +818 -541
- package/dist/browser.js.map +1 -1
- package/dist/browser.mjs +278 -9
- package/dist/browser.mjs.map +1 -1
- package/dist/embed.iife.js +1094 -4
- package/dist/node.d.mts +20 -4
- package/dist/node.d.ts +324 -247
- package/dist/node.js +480 -369
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +103 -6
- package/dist/node.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node.d.mts
CHANGED
|
@@ -64,7 +64,8 @@ interface ProtocolCallbacks {
|
|
|
64
64
|
onTranscript: (entries: TranscriptEntry[]) => void;
|
|
65
65
|
onError: (err: CallError) => void;
|
|
66
66
|
onInterrupt: () => void;
|
|
67
|
-
onAgentTurnStart: () => void;
|
|
67
|
+
onAgentTurnStart: (seq?: number) => void;
|
|
68
|
+
onAgentTurnEnd: (seq?: number) => void;
|
|
68
69
|
onCallEnd: (reason: CallEndReason) => void;
|
|
69
70
|
onConnected: () => void;
|
|
70
71
|
onClientToolCall: (frame: ClientToolCallFrame) => void;
|
|
@@ -98,10 +99,25 @@ interface FetchTokenArgs {
|
|
|
98
99
|
*/
|
|
99
100
|
metadata?: Record<string, string>;
|
|
100
101
|
}
|
|
101
|
-
|
|
102
|
+
/**
|
|
103
|
+
* What `fetchToken` may return. The rich object form lets the server
|
|
104
|
+
* choose the transport per call. Returning a bare string is backwards-
|
|
105
|
+
* compatible — the SDK treats it as `{ token, transport: 'ws' }`.
|
|
106
|
+
*/
|
|
107
|
+
interface FetchTokenResult {
|
|
108
|
+
/** Raw `ct_` to feed into the WS open / WebRTC offer. */
|
|
109
|
+
token: string;
|
|
110
|
+
/** Server-selected transport. Default `'ws'` if absent. */
|
|
111
|
+
transport?: 'ws' | 'webrtc';
|
|
112
|
+
/** Required when `transport === 'webrtc'` AND the server uses a
|
|
113
|
+
* separate signaling gateway. When omitted on a webrtc result, the
|
|
114
|
+
* SDK falls back to the API base's Phase-1 routes (local dev). */
|
|
115
|
+
webrtcGatewayBase?: string;
|
|
116
|
+
}
|
|
117
|
+
type FetchToken = (args: FetchTokenArgs) => Promise<string | FetchTokenResult>;
|
|
102
118
|
interface VoiceClientConfig {
|
|
103
119
|
/**
|
|
104
|
-
* Full HTTPS URL of the
|
|
120
|
+
* Full HTTPS URL of the Voissia server. The WebSocket scheme is
|
|
105
121
|
* derived: `https` → `wss`, `http` → `ws`. No trailing slash needed.
|
|
106
122
|
*/
|
|
107
123
|
apiBase: string;
|
|
@@ -322,4 +338,4 @@ interface NodeVoiceClientFactory {
|
|
|
322
338
|
*/
|
|
323
339
|
declare function configureVoiceClient(config: VoiceClientConfig): NodeVoiceClientFactory;
|
|
324
340
|
|
|
325
|
-
export { type Call, type CallEndEvent, type CallEndReason, type CallError, type CallErrorCode, type CallState, type ClientTool, type ClientToolMap, type FetchToken, type FetchTokenArgs, type NodeCall, type NodeStartCallOptions, type NodeVoiceClientFactory, 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, createProtocolState, createReconnectingWebSocket, handleServerMessage };
|
|
341
|
+
export { type Call, type CallEndEvent, type CallEndReason, type CallError, type CallErrorCode, type CallState, type ClientTool, type ClientToolMap, type FetchToken, type FetchTokenArgs, type FetchTokenResult, type NodeCall, type NodeStartCallOptions, type NodeVoiceClientFactory, 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, createProtocolState, createReconnectingWebSocket, handleServerMessage };
|