@sayna-ai/node-sdk 0.0.12 → 0.0.13
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/README.md +34 -7
- package/dist/errors.d.ts +18 -2
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.js +17 -4
- package/dist/index.js.map +4 -4
- package/dist/sayna-client.d.ts +34 -25
- package/dist/sayna-client.d.ts.map +1 -1
- package/dist/types.d.ts +38 -11
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,7 +138,7 @@ Retrieves all configured SIP webhook hooks from the runtime cache.
|
|
|
138
138
|
```typescript
|
|
139
139
|
const response = await client.getSipHooks();
|
|
140
140
|
for (const hook of response.hooks) {
|
|
141
|
-
console.log(`Host: ${hook.host}, URL: ${hook.url}`);
|
|
141
|
+
console.log(`Host: ${hook.host}, URL: ${hook.url}, Auth ID: ${hook.auth_id}`);
|
|
142
142
|
}
|
|
143
143
|
```
|
|
144
144
|
|
|
@@ -152,10 +152,11 @@ Sets or updates SIP webhook hooks in the runtime cache. Hooks with matching host
|
|
|
152
152
|
|
|
153
153
|
Each `SipHook` object contains:
|
|
154
154
|
|
|
155
|
-
| field
|
|
156
|
-
|
|
|
157
|
-
| `host`
|
|
158
|
-
| `url`
|
|
155
|
+
| field | type | description |
|
|
156
|
+
| --------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
157
|
+
| `host` | `string` | SIP domain pattern (case-insensitive). |
|
|
158
|
+
| `url` | `string` | HTTPS URL to forward webhook events to. |
|
|
159
|
+
| `auth_id` | `string` | Tenant identifier for this hook. Required but may be empty for unauthenticated mode. Treat as opaque; pass unchanged. |
|
|
159
160
|
|
|
160
161
|
**Returns**: `Promise<SipHooksResponse>` - Object containing the merged list of all configured hooks.
|
|
161
162
|
|
|
@@ -163,14 +164,40 @@ Each `SipHook` object contains:
|
|
|
163
164
|
|
|
164
165
|
```typescript
|
|
165
166
|
const response = await client.setSipHooks([
|
|
166
|
-
{ host: "example.com", url: "https://webhook.example.com/events" },
|
|
167
|
-
{ host: "another.com", url: "https://webhook.another.com/events" },
|
|
167
|
+
{ host: "example.com", url: "https://webhook.example.com/events", auth_id: "tenant-123" },
|
|
168
|
+
{ host: "another.com", url: "https://webhook.another.com/events", auth_id: "" }, // Empty for unauthenticated mode
|
|
168
169
|
]);
|
|
169
170
|
console.log("Total hooks configured:", response.hooks.length);
|
|
170
171
|
```
|
|
171
172
|
|
|
172
173
|
---
|
|
173
174
|
|
|
175
|
+
### Room Ownership and Access
|
|
176
|
+
|
|
177
|
+
When authentication is enabled, the server enforces room-level access control:
|
|
178
|
+
|
|
179
|
+
- **Room names are clean**: The SDK does not rewrite or prefix room names. Pass room names as-is.
|
|
180
|
+
- **Room listings are scoped**: `getLiveKitRooms()` returns only rooms accessible to your authenticated context.
|
|
181
|
+
- **403 on token requests**: `getLiveKitToken()` returns a 403 error if the room exists but is owned by another tenant. Do not retry with a modified room name.
|
|
182
|
+
- **404 masks access denial**: For room-scoped operations (`getLiveKitRoom()`, `removeLiveKitParticipant()`, `muteLiveKitParticipantTrack()`, `sipTransferRest()`), a 404 response can mean "not found" or "not accessible."
|
|
183
|
+
- **Inbound SIP rooms**: Rooms created by inbound SIP calls are owned by the routing configuration's `auth_id`. Access depends on your authentication context.
|
|
184
|
+
- **WebSocket errors**: Ownership/access errors during WebSocket configuration are surfaced via the error callback. Retry with the correct room name if needed.
|
|
185
|
+
|
|
186
|
+
Errors include HTTP status and endpoint information for easier debugging:
|
|
187
|
+
|
|
188
|
+
```typescript
|
|
189
|
+
try {
|
|
190
|
+
await client.getLiveKitToken("some-room", "user", "user-123");
|
|
191
|
+
} catch (error) {
|
|
192
|
+
if (error instanceof SaynaServerError) {
|
|
193
|
+
console.log(`Status: ${error.status}, Endpoint: ${error.endpoint}`);
|
|
194
|
+
// Status: 403, Endpoint: livekit/token
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
174
201
|
### WebSocket API Methods
|
|
175
202
|
|
|
176
203
|
These methods require an active WebSocket connection:
|
package/dist/errors.d.ts
CHANGED
|
@@ -30,9 +30,25 @@ export declare class SaynaValidationError extends SaynaError {
|
|
|
30
30
|
constructor(message: string);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Error thrown when the server returns an error.
|
|
33
|
+
* Error thrown when the server returns an error response.
|
|
34
|
+
*
|
|
35
|
+
* For REST API calls, the `status` and `endpoint` fields provide context about
|
|
36
|
+
* which request failed and with what HTTP status code. Common status codes:
|
|
37
|
+
* - 403: Access denied (e.g., room owned by another tenant on /livekit/token)
|
|
38
|
+
* - 404: Not found or not accessible (masked access denial for room-scoped operations)
|
|
39
|
+
* - 500: Internal server error
|
|
34
40
|
*/
|
|
35
41
|
export declare class SaynaServerError extends SaynaError {
|
|
36
|
-
|
|
42
|
+
/**
|
|
43
|
+
* HTTP status code returned by the server, if available.
|
|
44
|
+
* Set for REST API errors; undefined for WebSocket errors.
|
|
45
|
+
*/
|
|
46
|
+
readonly status?: number;
|
|
47
|
+
/**
|
|
48
|
+
* API endpoint that returned the error, if available.
|
|
49
|
+
* Set for REST API errors; undefined for WebSocket errors.
|
|
50
|
+
*/
|
|
51
|
+
readonly endpoint?: string;
|
|
52
|
+
constructor(message: string, status?: number, endpoint?: string);
|
|
37
53
|
}
|
|
38
54
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM;CAK5B;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;gBACxC,OAAO,GAAE,MAA2C;CAKjE;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,UAAU;gBAE9C,OAAO,GAAE,MAA0F;CAMtG;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,SAAyB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAE7B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAM7C;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;gBACtC,OAAO,EAAE,MAAM;CAK5B;AAED
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;gBACvB,OAAO,EAAE,MAAM;CAK5B;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;gBACxC,OAAO,GAAE,MAA2C;CAKjE;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,UAAU;gBAE9C,OAAO,GAAE,MAA0F;CAMtG;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,SAAyB,KAAK,CAAC,EAAE,OAAO,CAAC;gBAE7B,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAM7C;AAED;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;gBACtC,OAAO,EAAE,MAAM;CAK5B;AAED;;;;;;;;GAQG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAC9C;;;OAGG;IACH,SAAgB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhC;;;OAGG;IACH,SAAgB,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAEtB,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;CAOhE"}
|
package/dist/index.js
CHANGED
|
@@ -42,9 +42,13 @@ class SaynaValidationError extends SaynaError {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
class SaynaServerError extends SaynaError {
|
|
45
|
-
|
|
45
|
+
status;
|
|
46
|
+
endpoint;
|
|
47
|
+
constructor(message, status, endpoint) {
|
|
46
48
|
super(message);
|
|
47
49
|
this.name = "SaynaServerError";
|
|
50
|
+
this.status = status;
|
|
51
|
+
this.endpoint = endpoint;
|
|
48
52
|
Object.setPrototypeOf(this, SaynaServerError.prototype);
|
|
49
53
|
}
|
|
50
54
|
}
|
|
@@ -271,7 +275,8 @@ class SaynaClient {
|
|
|
271
275
|
}
|
|
272
276
|
async fetchFromSayna(endpoint, options = {}, responseType = "json") {
|
|
273
277
|
const httpUrl = this.getHttpUrl();
|
|
274
|
-
const
|
|
278
|
+
const normalizedEndpoint = endpoint.startsWith("/") ? endpoint.slice(1) : endpoint;
|
|
279
|
+
const url = `${httpUrl}${httpUrl.endsWith("/") ? "" : "/"}${normalizedEndpoint}`;
|
|
275
280
|
const headers = {
|
|
276
281
|
...options.headers
|
|
277
282
|
};
|
|
@@ -295,7 +300,12 @@ class SaynaClient {
|
|
|
295
300
|
} catch {
|
|
296
301
|
errorMessage = `Request failed: ${response.status} ${response.statusText}`;
|
|
297
302
|
}
|
|
298
|
-
|
|
303
|
+
if (response.status === 403) {
|
|
304
|
+
errorMessage = `Access denied: ${errorMessage}`;
|
|
305
|
+
} else if (response.status === 404) {
|
|
306
|
+
errorMessage = `Not found or not accessible: ${errorMessage}`;
|
|
307
|
+
}
|
|
308
|
+
throw new SaynaServerError(errorMessage, response.status, normalizedEndpoint);
|
|
299
309
|
}
|
|
300
310
|
if (responseType === "arrayBuffer") {
|
|
301
311
|
return await response.arrayBuffer();
|
|
@@ -576,6 +586,9 @@ class SaynaClient {
|
|
|
576
586
|
if (!hook.url || typeof hook.url !== "string" || hook.url.trim().length === 0) {
|
|
577
587
|
throw new SaynaValidationError(`hooks[${i}].url must be a non-empty string`);
|
|
578
588
|
}
|
|
589
|
+
if (typeof hook.auth_id !== "string") {
|
|
590
|
+
throw new SaynaValidationError(`hooks[${i}].auth_id must be a string`);
|
|
591
|
+
}
|
|
579
592
|
}
|
|
580
593
|
return this.fetchFromSayna("sip/hooks", {
|
|
581
594
|
method: "POST",
|
|
@@ -763,4 +776,4 @@ export {
|
|
|
763
776
|
SaynaClient
|
|
764
777
|
};
|
|
765
778
|
|
|
766
|
-
//# debugId=
|
|
779
|
+
//# debugId=15E631B45E4A4D4464756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/errors.ts", "../src/sayna-client.ts", "../src/webhook-receiver.ts", "../src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"/**\n * Base error class for all Sayna SDK errors.\n */\nexport class SaynaError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SaynaError\";\n Object.setPrototypeOf(this, SaynaError.prototype);\n }\n}\n\n/**\n * Error thrown when attempting to use the client before it's connected.\n */\nexport class SaynaNotConnectedError extends SaynaError {\n constructor(message: string = \"Not connected to Sayna WebSocket\") {\n super(message);\n this.name = \"SaynaNotConnectedError\";\n Object.setPrototypeOf(this, SaynaNotConnectedError.prototype);\n }\n}\n\n/**\n * Error thrown when attempting operations before the client is ready.\n */\nexport class SaynaNotReadyError extends SaynaError {\n constructor(\n message: string = \"Sayna voice providers are not ready. Wait for the connection to be established.\"\n ) {\n super(message);\n this.name = \"SaynaNotReadyError\";\n Object.setPrototypeOf(this, SaynaNotReadyError.prototype);\n }\n}\n\n/**\n * Error thrown when WebSocket connection fails.\n */\nexport class SaynaConnectionError extends SaynaError {\n public override readonly cause?: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = \"SaynaConnectionError\";\n this.cause = cause;\n Object.setPrototypeOf(this, SaynaConnectionError.prototype);\n }\n}\n\n/**\n * Error thrown when invalid parameters are provided.\n */\nexport class SaynaValidationError extends SaynaError {\n constructor(message: string) {\n super(message);\n this.name = \"SaynaValidationError\";\n Object.setPrototypeOf(this, SaynaValidationError.prototype);\n }\n}\n\n/**\n * Error thrown when the server returns an error.\n */\nexport class SaynaServerError extends SaynaError {\n constructor(message: string) {\n super(message);\n this.name = \"SaynaServerError\";\n Object.setPrototypeOf(this, SaynaServerError.prototype);\n }\n}\n",
|
|
6
|
-
"import type {\n STTConfig,\n TTSConfig,\n LiveKitConfig,\n ConfigMessage,\n SpeakMessage,\n ClearMessage,\n SendMessageMessage,\n STTResultMessage,\n ErrorMessage,\n SipTransferErrorMessage,\n SipTransferMessage,\n OutgoingMessage,\n SaynaMessage,\n Participant,\n VoicesResponse,\n HealthResponse,\n LiveKitTokenResponse,\n LiveKitRoomsResponse,\n LiveKitRoomDetails,\n SipHook,\n SipHooksResponse,\n RemoveLiveKitParticipantResponse,\n MuteLiveKitParticipantResponse,\n SipTransferResponse,\n} from \"./types\";\nimport {\n SaynaNotConnectedError,\n SaynaNotReadyError,\n SaynaConnectionError,\n SaynaValidationError,\n SaynaServerError,\n} from \"./errors\";\n\n// Node.js 18+ has native fetch support\ndeclare const fetch: typeof globalThis.fetch;\n\n/**\n * Event handler for speech-to-text results.\n */\nexport type STTResultHandler = (\n result: STTResultMessage\n) => void | Promise<void>;\n\n/**\n * Event handler for text-to-speech audio data.\n */\nexport type TTSAudioHandler = (audio: ArrayBuffer) => void | Promise<void>;\n\n/**\n * Event handler for error messages.\n */\nexport type ErrorHandler = (error: ErrorMessage) => void | Promise<void>;\n\n/**\n * Event handler for participant messages.\n */\nexport type MessageHandler = (message: SaynaMessage) => void | Promise<void>;\n\n/**\n * Event handler for participant disconnections.\n */\nexport type ParticipantDisconnectedHandler = (\n participant: Participant\n) => void | Promise<void>;\n\n/**\n * Event handler for TTS playback completion.\n */\nexport type TTSPlaybackCompleteHandler = (\n timestamp: number\n) => void | Promise<void>;\n\n/**\n * Event handler for SIP transfer specific errors.\n */\nexport type SipTransferErrorHandler = (\n error: SipTransferErrorMessage\n) => void | Promise<void>;\n\n/**\n * Client for connecting to Sayna WebSocket server for real-time voice interactions.\n *\n * @example\n * ```typescript\n * const client = await saynaConnect(\n * \"https://api.sayna.ai\",\n * sttConfig,\n * ttsConfig\n * );\n *\n * client.registerOnSttResult((result) => {\n * console.log(\"Transcription:\", result.transcript);\n * });\n *\n * await client.speak(\"Hello, world!\");\n * ```\n */\nexport class SaynaClient {\n private url: string;\n private sttConfig?: STTConfig;\n private ttsConfig?: TTSConfig;\n private livekitConfig?: LiveKitConfig;\n private withoutAudio: boolean;\n private apiKey?: string;\n private websocket?: WebSocket;\n private isConnected: boolean = false;\n private isReady: boolean = false;\n private _livekitRoomName?: string;\n private _livekitUrl?: string;\n private _saynaParticipantIdentity?: string;\n private _saynaParticipantName?: string;\n private _streamId?: string;\n private inputStreamId?: string;\n private sttCallback?: STTResultHandler;\n private ttsCallback?: TTSAudioHandler;\n private errorCallback?: ErrorHandler;\n private messageCallback?: MessageHandler;\n private participantDisconnectedCallback?: ParticipantDisconnectedHandler;\n private ttsPlaybackCompleteCallback?: TTSPlaybackCompleteHandler;\n private sipTransferErrorCallback?: SipTransferErrorHandler;\n private readyPromiseResolve?: () => void;\n private readyPromiseReject?: (error: Error) => void;\n\n /**\n * Creates a new SaynaClient instance.\n *\n * @param url - The Sayna server URL (e.g., \"https://api.sayna.ai\")\n * @param sttConfig - Speech-to-text configuration (required when withoutAudio=false)\n * @param ttsConfig - Text-to-speech configuration (required when withoutAudio=false)\n * @param livekitConfig - Optional LiveKit room configuration\n * @param withoutAudio - If true, disables audio streaming (default: false)\n * @param apiKey - Optional API key used to authorize HTTP and WebSocket calls (defaults to SAYNA_API_KEY env)\n * @param streamId - Optional session identifier for recording paths; server generates a UUID when omitted\n *\n * @throws {SaynaValidationError} If URL is invalid or if audio configs are missing when audio is enabled\n */\n constructor(\n url: string,\n sttConfig?: STTConfig,\n ttsConfig?: TTSConfig,\n livekitConfig?: LiveKitConfig,\n withoutAudio: boolean = false,\n apiKey?: string,\n streamId?: string\n ) {\n // Validate URL\n if (!url || typeof url !== \"string\") {\n throw new SaynaValidationError(\"URL must be a non-empty string\");\n }\n if (\n !url.startsWith(\"http://\") &&\n !url.startsWith(\"https://\") &&\n !url.startsWith(\"ws://\") &&\n !url.startsWith(\"wss://\")\n ) {\n throw new SaynaValidationError(\n \"URL must start with http://, https://, ws://, or wss://\"\n );\n }\n\n // Validate audio config requirements\n if (!withoutAudio) {\n if (!sttConfig || !ttsConfig) {\n throw new SaynaValidationError(\n \"sttConfig and ttsConfig are required when withoutAudio=false (audio streaming enabled). \" +\n \"Either provide both configs or set withoutAudio=true for non-audio use cases.\"\n );\n }\n }\n\n this.url = url;\n this.sttConfig = sttConfig;\n this.ttsConfig = ttsConfig;\n this.livekitConfig = livekitConfig;\n this.withoutAudio = withoutAudio;\n this.apiKey = apiKey ?? process.env.SAYNA_API_KEY;\n this.inputStreamId = streamId;\n }\n\n /**\n * Establishes connection to the Sayna WebSocket server.\n *\n * @throws {SaynaConnectionError} If connection fails\n * @returns Promise that resolves when the connection is ready\n */\n async connect(): Promise<void> {\n if (this.isConnected) {\n return;\n }\n\n // Convert HTTP(S) URL to WebSocket URL\n const wsUrl =\n this.url.replace(/^https:\\/\\//, \"wss://\").replace(/^http:\\/\\//, \"ws://\") +\n (this.url.endsWith(\"/\") ? \"ws\" : \"/ws\");\n\n return new Promise((resolve, reject) => {\n this.readyPromiseResolve = resolve;\n this.readyPromiseReject = reject;\n\n try {\n const headers = this.apiKey\n ? { Authorization: `Bearer ${this.apiKey}` }\n : undefined;\n\n const WebSocketConstructor = WebSocket as unknown as {\n new (\n url: string,\n protocols?: string | string[],\n options?: { headers?: Record<string, string> }\n ): WebSocket;\n };\n\n this.websocket = headers\n ? new WebSocketConstructor(wsUrl, undefined, { headers })\n : new WebSocket(wsUrl);\n\n this.websocket.onopen = () => {\n this.isConnected = true;\n\n // Send initial configuration\n const configMessage: ConfigMessage = {\n type: \"config\",\n stream_id: this.inputStreamId,\n stt_config: this.sttConfig,\n tts_config: this.ttsConfig,\n livekit: this.livekitConfig,\n audio: !this.withoutAudio,\n };\n\n try {\n if (this.websocket) {\n this.websocket.send(JSON.stringify(configMessage));\n }\n } catch (error) {\n this.cleanup();\n const err = new SaynaConnectionError(\n \"Failed to send configuration\",\n error\n );\n if (this.readyPromiseReject) {\n this.readyPromiseReject(err);\n }\n }\n };\n\n this.websocket.onmessage = async (event) => {\n try {\n if (\n event.data instanceof Blob ||\n event.data instanceof ArrayBuffer\n ) {\n // Binary TTS audio data\n const buffer =\n event.data instanceof Blob\n ? await event.data.arrayBuffer()\n : event.data;\n if (this.ttsCallback) {\n await this.ttsCallback(buffer);\n }\n } else {\n // JSON control messages\n if (typeof event.data !== \"string\") {\n throw new Error(\"Expected string data for JSON messages\");\n }\n const data = JSON.parse(event.data) as OutgoingMessage;\n await this.handleJsonMessage(data);\n }\n } catch (error) {\n // Log parse errors but don't break the connection\n if (this.errorCallback) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n await this.errorCallback({\n type: \"error\",\n message: `Failed to process message: ${errorMessage}`,\n });\n }\n }\n };\n\n this.websocket.onerror = () => {\n const error = new SaynaConnectionError(\"WebSocket connection error\");\n if (this.readyPromiseReject && !this.isReady) {\n this.readyPromiseReject(error);\n }\n };\n\n this.websocket.onclose = (event) => {\n const wasReady = this.isReady;\n this.cleanup();\n\n // If connection closed before ready, reject the promise\n if (!wasReady && this.readyPromiseReject) {\n this.readyPromiseReject(\n new SaynaConnectionError(\n `WebSocket closed before ready (code: ${event.code}, reason: ${event.reason || \"none\"})`\n )\n );\n }\n };\n } catch (error) {\n reject(new SaynaConnectionError(\"Failed to create WebSocket\", error));\n }\n });\n }\n\n /**\n * Handles incoming JSON messages from the WebSocket.\n * @internal\n */\n private async handleJsonMessage(data: OutgoingMessage): Promise<void> {\n const messageType = data.type;\n\n try {\n switch (messageType) {\n case \"ready\": {\n const readyMsg = data;\n this.isReady = true;\n this._livekitRoomName = readyMsg.livekit_room_name;\n this._livekitUrl = readyMsg.livekit_url;\n this._saynaParticipantIdentity = readyMsg.sayna_participant_identity;\n this._saynaParticipantName = readyMsg.sayna_participant_name;\n this._streamId = readyMsg.stream_id;\n if (this.readyPromiseResolve) {\n this.readyPromiseResolve();\n }\n break;\n }\n\n case \"stt_result\": {\n const sttResult = data;\n if (this.sttCallback) {\n await this.sttCallback(sttResult);\n }\n break;\n }\n\n case \"error\": {\n const errorMsg = data;\n if (this.errorCallback) {\n await this.errorCallback(errorMsg);\n }\n if (this.readyPromiseReject && !this.isReady) {\n this.readyPromiseReject(new SaynaServerError(errorMsg.message));\n }\n break;\n }\n\n case \"sip_transfer_error\": {\n const sipTransferError = data;\n if (this.sipTransferErrorCallback) {\n await this.sipTransferErrorCallback(sipTransferError);\n } else if (this.errorCallback) {\n await this.errorCallback({\n type: \"error\",\n message: sipTransferError.message,\n });\n }\n break;\n }\n\n case \"message\": {\n const messageData = data;\n if (this.messageCallback) {\n await this.messageCallback(messageData.message);\n }\n break;\n }\n\n case \"participant_disconnected\": {\n const participantMsg = data;\n if (this.participantDisconnectedCallback) {\n await this.participantDisconnectedCallback(\n participantMsg.participant\n );\n }\n break;\n }\n\n case \"tts_playback_complete\": {\n const ttsPlaybackCompleteMsg = data;\n if (this.ttsPlaybackCompleteCallback) {\n await this.ttsPlaybackCompleteCallback(\n ttsPlaybackCompleteMsg.timestamp\n );\n }\n break;\n }\n\n default: {\n const unknownMessage = data as { type: string };\n const errorMessage = `Unknown message type received: ${unknownMessage.type}`;\n if (this.errorCallback) {\n await this.errorCallback({ type: \"error\", message: errorMessage });\n } else {\n console.warn(errorMessage);\n }\n }\n }\n } catch (error) {\n // Notify error callback if handler fails\n if (this.errorCallback) {\n await this.errorCallback({\n type: \"error\",\n message: `Handler error: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n }\n }\n\n /**\n * Cleans up internal state.\n * @internal\n */\n private cleanup(): void {\n this.isConnected = false;\n this.isReady = false;\n this._livekitRoomName = undefined;\n this._livekitUrl = undefined;\n this._saynaParticipantIdentity = undefined;\n this._saynaParticipantName = undefined;\n this._streamId = undefined;\n }\n\n /**\n * Converts WebSocket URL to HTTP URL for REST API calls.\n * @internal\n */\n private getHttpUrl(): string {\n return this.url\n .replace(/^ws:\\/\\//, \"http://\")\n .replace(/^wss:\\/\\//, \"https://\");\n }\n\n /**\n * Generic fetch helper for making REST API calls to Sayna server.\n * Handles URL construction, headers, error responses, and type conversion.\n * @internal\n *\n * @param endpoint - API endpoint path (e.g., \"/voices\", \"/speak\")\n * @param options - Fetch options including method, body, headers, etc.\n * @param responseType - Expected response type: \"json\" or \"arrayBuffer\"\n * @returns Promise resolving to the parsed response\n * @throws {SaynaConnectionError} If the network request fails\n * @throws {SaynaServerError} If the server returns an error response\n */\n private async fetchFromSayna<T>(\n endpoint: string,\n options: RequestInit = {},\n responseType: \"json\" | \"arrayBuffer\" = \"json\"\n ): Promise<T> {\n const httpUrl = this.getHttpUrl();\n const url = `${httpUrl}${httpUrl.endsWith(\"/\") ? \"\" : \"/\"}${endpoint.startsWith(\"/\") ? endpoint.slice(1) : endpoint}`;\n\n // Merge default headers with user-provided headers\n const headers: Record<string, string> = {\n ...(options.headers as Record<string, string>),\n };\n\n // Add Authorization header when an API key is provided, unless user supplied one\n const hasAuthHeader = Object.keys(headers).some(\n (key) => key.toLowerCase() === \"authorization\"\n );\n if (this.apiKey && !hasAuthHeader) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n // Add Content-Type for JSON requests with body if not already set\n if (options.body && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n try {\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n if (!response.ok) {\n // Try to parse error message from JSON response\n let errorMessage: string;\n try {\n const errorData: unknown = await response.json();\n errorMessage =\n errorData &&\n typeof errorData === \"object\" &&\n \"error\" in errorData &&\n typeof errorData.error === \"string\"\n ? errorData.error\n : `Request failed: ${response.status} ${response.statusText}`;\n } catch {\n errorMessage = `Request failed: ${response.status} ${response.statusText}`;\n }\n throw new SaynaServerError(errorMessage);\n }\n\n // Parse response based on expected type\n if (responseType === \"arrayBuffer\") {\n return (await response.arrayBuffer()) as T;\n } else {\n return (await response.json()) as T;\n }\n } catch (error) {\n // Re-throw SaynaServerError as-is\n if (error instanceof SaynaServerError) {\n throw error;\n }\n // Wrap other errors in SaynaConnectionError\n throw new SaynaConnectionError(`Failed to fetch from ${endpoint}`, error);\n }\n }\n\n /**\n * Disconnects from the Sayna WebSocket server and cleans up resources.\n */\n disconnect(): void {\n if (this.websocket) {\n // Remove event handlers to prevent memory leaks\n this.websocket.onopen = null;\n this.websocket.onmessage = null;\n this.websocket.onerror = null;\n this.websocket.onclose = null;\n\n if (this.websocket.readyState === WebSocket.OPEN) {\n this.websocket.close(1000, \"Client disconnect\");\n }\n\n this.websocket = undefined;\n }\n\n this.cleanup();\n }\n\n /**\n * Sends audio data to the server for speech recognition.\n *\n * @param audioData - Raw audio data as ArrayBuffer\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n onAudioInput(audioData: ArrayBuffer): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (!(audioData instanceof ArrayBuffer)) {\n throw new SaynaValidationError(\"audioData must be an ArrayBuffer\");\n }\n\n if (audioData.byteLength === 0) {\n throw new SaynaValidationError(\"audioData cannot be empty\");\n }\n\n try {\n this.websocket.send(audioData);\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send audio data\", error);\n }\n }\n\n /**\n * Registers a callback for speech-to-text results.\n *\n * @param callback - Function to call when STT results are received\n */\n registerOnSttResult(callback: STTResultHandler): void {\n this.sttCallback = callback;\n }\n\n /**\n * Registers a callback for text-to-speech audio data.\n *\n * @param callback - Function to call when TTS audio is received\n */\n registerOnTtsAudio(callback: TTSAudioHandler): void {\n this.ttsCallback = callback;\n }\n\n /**\n * Registers a callback for error messages.\n *\n * @param callback - Function to call when errors occur\n */\n registerOnError(callback: ErrorHandler): void {\n this.errorCallback = callback;\n }\n\n /**\n * Registers a callback for participant messages.\n *\n * @param callback - Function to call when messages are received\n */\n registerOnMessage(callback: MessageHandler): void {\n this.messageCallback = callback;\n }\n\n /**\n * Registers a callback for participant disconnection events.\n *\n * @param callback - Function to call when a participant disconnects\n */\n registerOnParticipantDisconnected(\n callback: ParticipantDisconnectedHandler\n ): void {\n this.participantDisconnectedCallback = callback;\n }\n\n /**\n * Registers a callback for TTS playback completion.\n *\n * @param callback - Function to call when TTS playback is complete\n */\n registerOnTtsPlaybackComplete(callback: TTSPlaybackCompleteHandler): void {\n this.ttsPlaybackCompleteCallback = callback;\n }\n\n /**\n * Registers a callback for SIP transfer specific errors.\n *\n * @param callback - Function to call when a SIP transfer error message is received\n */\n registerOnSipTransferError(callback: SipTransferErrorHandler): void {\n this.sipTransferErrorCallback = callback;\n }\n\n /**\n * Sends text to be synthesized as speech.\n *\n * @param text - Text to synthesize\n * @param flush - Whether to flush the TTS queue before speaking (default: true)\n * @param allowInterruption - Whether this speech can be interrupted (default: true)\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If text is not a string\n */\n speak(\n text: string,\n flush: boolean = true,\n allowInterruption: boolean = true\n ): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof text !== \"string\") {\n throw new SaynaValidationError(\"text must be a string\");\n }\n\n try {\n const speakMessage: SpeakMessage = {\n type: \"speak\",\n text,\n flush,\n allow_interruption: allowInterruption,\n };\n this.websocket.send(JSON.stringify(speakMessage));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send speak command\", error);\n }\n }\n\n /**\n * Clears the text-to-speech queue.\n *\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n clear(): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n try {\n const clearMessage: ClearMessage = {\n type: \"clear\",\n };\n this.websocket.send(JSON.stringify(clearMessage));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send clear command\", error);\n }\n }\n\n /**\n * Flushes the TTS queue by sending an empty speak command.\n *\n * @param allowInterruption - Whether the flush can be interrupted (default: true)\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n ttsFlush(allowInterruption: boolean = true): void {\n this.speak(\"\", true, allowInterruption);\n }\n\n /**\n * Sends a message to the Sayna session.\n *\n * @param message - Message content\n * @param role - Message role (e.g., \"user\", \"assistant\")\n * @param topic - Optional topic identifier\n * @param debug - Optional debug metadata\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If parameters are invalid\n */\n sendMessage(\n message: string,\n role: string,\n topic?: string,\n debug?: Record<string, unknown>\n ): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof message !== \"string\") {\n throw new SaynaValidationError(\"message must be a string\");\n }\n\n if (typeof role !== \"string\") {\n throw new SaynaValidationError(\"role must be a string\");\n }\n\n try {\n const sendMsg: SendMessageMessage = {\n type: \"send_message\",\n message,\n role,\n topic,\n debug,\n };\n this.websocket.send(JSON.stringify(sendMsg));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send message\", error);\n }\n }\n\n /**\n * Initiates a SIP transfer for the active LiveKit session.\n *\n * @param transferTo - Destination phone number or extension to transfer to\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If transferTo is not a non-empty string\n */\n sipTransfer(transferTo: string): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof transferTo !== \"string\" || transferTo.trim().length === 0) {\n throw new SaynaValidationError(\"transfer_to must be a non-empty string\");\n }\n\n try {\n const sipTransferMessage: SipTransferMessage = {\n type: \"sip_transfer\",\n transfer_to: transferTo.trim(),\n };\n this.websocket.send(JSON.stringify(sipTransferMessage));\n } catch (error) {\n throw new SaynaConnectionError(\n \"Failed to send SIP transfer command\",\n error\n );\n }\n }\n\n /**\n * Performs a health check on the Sayna server.\n *\n * @returns Promise that resolves with the health status\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const health = await client.health();\n * console.log(health.status); // \"OK\"\n * ```\n */\n async health(): Promise<HealthResponse> {\n return this.fetchFromSayna<HealthResponse>(\"\");\n }\n\n /**\n * Retrieves the catalogue of text-to-speech voices grouped by provider.\n *\n * @returns Promise that resolves with voices organized by provider\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const voices = await client.getVoices();\n * for (const [provider, voiceList] of Object.entries(voices)) {\n * console.log(`${provider}:`, voiceList.map(v => v.name));\n * }\n * ```\n */\n async getVoices(): Promise<VoicesResponse> {\n return this.fetchFromSayna<VoicesResponse>(\"voices\");\n }\n\n /**\n * Synthesizes text into audio using the REST API endpoint.\n * This is a standalone synthesis method that doesn't require an active WebSocket connection.\n *\n * @param text - Text to synthesize\n * @param ttsConfig - Text-to-speech configuration\n * @returns Promise that resolves with the audio data as ArrayBuffer\n * @throws {SaynaValidationError} If text is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const audioBuffer = await client.speakRest(\"Hello, world!\", {\n * provider: \"elevenlabs\",\n * voice_id: \"21m00Tcm4TlvDq8ikWAM\",\n * model: \"eleven_turbo_v2\",\n * speaking_rate: 1.0,\n * audio_format: \"mp3\",\n * sample_rate: 24000,\n * connection_timeout: 30,\n * request_timeout: 60,\n * pronunciations: []\n * });\n * ```\n */\n async speakRest(text: string, ttsConfig: TTSConfig): Promise<ArrayBuffer> {\n if (!text || text.trim().length === 0) {\n throw new SaynaValidationError(\"Text cannot be empty\");\n }\n\n return this.fetchFromSayna<ArrayBuffer>(\n \"speak\",\n {\n method: \"POST\",\n body: JSON.stringify({\n text,\n tts_config: ttsConfig,\n }),\n },\n \"arrayBuffer\"\n );\n }\n\n /**\n * Issues a LiveKit access token for a participant.\n *\n * @param roomName - LiveKit room to join or create\n * @param participantName - Display name assigned to the participant\n * @param participantIdentity - Unique identifier for the participant\n * @returns Promise that resolves with the LiveKit token and connection details\n * @throws {SaynaValidationError} If any parameter is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const tokenInfo = await client.getLiveKitToken(\n * \"my-room\",\n * \"John Doe\",\n * \"user-123\"\n * );\n * console.log(\"Token:\", tokenInfo.token);\n * console.log(\"LiveKit URL:\", tokenInfo.livekit_url);\n * ```\n */\n async getLiveKitToken(\n roomName: string,\n participantName: string,\n participantIdentity: string\n ): Promise<LiveKitTokenResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantName || participantName.trim().length === 0) {\n throw new SaynaValidationError(\"participant_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n return this.fetchFromSayna<LiveKitTokenResponse>(\"livekit/token\", {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName,\n participant_name: participantName,\n participant_identity: participantIdentity,\n }),\n });\n }\n\n /**\n * Lists all LiveKit rooms belonging to the authenticated tenant.\n *\n * Room names are automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. Only rooms matching your tenant prefix are returned.\n *\n * @returns Promise that resolves with the list of rooms\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., LiveKit not configured)\n *\n * @example\n * ```typescript\n * const response = await client.getLiveKitRooms();\n * for (const room of response.rooms) {\n * console.log(`Room: ${room.name}, Participants: ${room.num_participants}`);\n * }\n * ```\n */\n async getLiveKitRooms(): Promise<LiveKitRoomsResponse> {\n return this.fetchFromSayna<LiveKitRoomsResponse>(\"livekit/rooms\");\n }\n\n /**\n * Retrieves detailed information about a specific LiveKit room including participants.\n *\n * The room name is automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. You should provide the room name without the tenant prefix.\n *\n * @param roomName - Name of the room to retrieve (without tenant prefix)\n * @returns Promise that resolves with detailed room information including participants\n * @throws {SaynaValidationError} If roomName is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., room not found, LiveKit not configured)\n *\n * @example\n * ```typescript\n * const room = await client.getLiveKitRoom(\"my-room\");\n * console.log(`Room: ${room.name}, SID: ${room.sid}`);\n * console.log(`Participants: ${room.num_participants}/${room.max_participants}`);\n * for (const participant of room.participants) {\n * console.log(` - ${participant.name} (${participant.identity}): ${participant.state}`);\n * }\n * ```\n */\n async getLiveKitRoom(roomName: string): Promise<LiveKitRoomDetails> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n const encoded = encodeURIComponent(roomName.trim());\n return this.fetchFromSayna<LiveKitRoomDetails>(`livekit/rooms/${encoded}`);\n }\n\n /**\n * Removes a participant from a LiveKit room, forcibly disconnecting them.\n *\n * The room name is automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. You should provide the room name without the tenant prefix.\n *\n * **Important:** This does not invalidate the participant's token. To prevent\n * rejoining, use short-lived tokens and avoid issuing new tokens to removed participants.\n *\n * @param roomName - Name of the room where the participant is connected (without tenant prefix)\n * @param participantIdentity - The identity of the participant to remove\n * @returns Promise that resolves with the removal confirmation\n * @throws {SaynaValidationError} If roomName or participantIdentity is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., participant not found, LiveKit not configured)\n *\n * @example\n * ```typescript\n * const result = await client.removeLiveKitParticipant(\"my-room\", \"user-alice-456\");\n * console.log(`Status: ${result.status}`);\n * console.log(`Removed from room: ${result.room_name}`);\n * console.log(`Participant: ${result.participant_identity}`);\n * ```\n */\n async removeLiveKitParticipant(\n roomName: string,\n participantIdentity: string\n ): Promise<RemoveLiveKitParticipantResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n return this.fetchFromSayna<RemoveLiveKitParticipantResponse>(\n \"livekit/participant\",\n {\n method: \"DELETE\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n }),\n }\n );\n }\n\n /**\n * Mutes or unmutes a participant's published track in a LiveKit room.\n *\n * The room name is automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. You should provide the room name without the tenant prefix.\n *\n * @param roomName - Name of the room where the participant is connected (without tenant prefix)\n * @param participantIdentity - The identity of the participant whose track to mute\n * @param trackSid - The session ID of the track to mute/unmute\n * @param muted - True to mute, false to unmute\n * @returns Promise that resolves with the mute operation result\n * @throws {SaynaValidationError} If roomName, participantIdentity, or trackSid is empty, or if muted is not a boolean\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., track or participant not found, LiveKit not configured)\n *\n * @example\n * ```typescript\n * // Mute a participant's track\n * const result = await client.muteLiveKitParticipantTrack(\n * \"my-room\",\n * \"user-alice-456\",\n * \"TR_abc123\",\n * true\n * );\n * console.log(`Track ${result.track_sid} muted: ${result.muted}`);\n *\n * // Unmute the track\n * const unmuteResult = await client.muteLiveKitParticipantTrack(\n * \"my-room\",\n * \"user-alice-456\",\n * \"TR_abc123\",\n * false\n * );\n * ```\n */\n async muteLiveKitParticipantTrack(\n roomName: string,\n participantIdentity: string,\n trackSid: string,\n muted: boolean\n ): Promise<MuteLiveKitParticipantResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n if (!trackSid || trackSid.trim().length === 0) {\n throw new SaynaValidationError(\"track_sid cannot be empty\");\n }\n\n if (typeof muted !== \"boolean\") {\n throw new SaynaValidationError(\"muted must be a boolean\");\n }\n\n return this.fetchFromSayna<MuteLiveKitParticipantResponse>(\n \"livekit/participant/mute\",\n {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n track_sid: trackSid.trim(),\n muted,\n }),\n }\n );\n }\n\n /**\n * Initiates a SIP call transfer via the REST API endpoint.\n *\n * This is distinct from the WebSocket `sipTransfer()` method. Use this REST endpoint\n * when you need to transfer a SIP call from outside the active WebSocket session,\n * or when you want to specify a particular room and participant explicitly.\n *\n * The room name is automatically prefixed with the tenant ID (from the JWT token)\n * for isolation. You should provide the room name without the tenant prefix.\n *\n * **Important Notes:**\n * - Only SIP participants can be transferred\n * - A successful response indicates the transfer has been **initiated**, not necessarily completed\n * - The actual transfer may take several seconds\n *\n * @param roomName - Name of the room where the SIP participant is connected (without tenant prefix)\n * @param participantIdentity - The identity of the SIP participant to transfer\n * @param transferTo - The phone number to transfer to (international, national, or extension format)\n * @returns Promise that resolves with the transfer status\n * @throws {SaynaValidationError} If roomName, participantIdentity, or transferTo is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., invalid phone, participant not found)\n *\n * @example\n * ```typescript\n * // Transfer a SIP participant to another phone number\n * const result = await client.sipTransferRest(\n * \"call-room-123\",\n * \"sip_participant_456\",\n * \"+15551234567\"\n * );\n * console.log(`Transfer status: ${result.status}`);\n * console.log(`Transferred to: ${result.transfer_to}`);\n * ```\n */\n async sipTransferRest(\n roomName: string,\n participantIdentity: string,\n transferTo: string\n ): Promise<SipTransferResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n if (!transferTo || transferTo.trim().length === 0) {\n throw new SaynaValidationError(\"transfer_to cannot be empty\");\n }\n\n return this.fetchFromSayna<SipTransferResponse>(\"sip/transfer\", {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n transfer_to: transferTo.trim(),\n }),\n });\n }\n\n /**\n * Downloads the recorded audio file for a completed session.\n *\n * @param streamId - The session identifier (obtained from the `streamId` getter after connection)\n * @returns Promise that resolves with the audio data as ArrayBuffer (OGG format)\n * @throws {SaynaValidationError} If streamId is empty\n * @throws {SaynaConnectionError} If the network request fails\n * @throws {SaynaServerError} If the recording is not found or server returns an error\n *\n * @example\n * ```typescript\n * // After a session completes, download the recording\n * const audioBuffer = await client.getRecording(client.streamId!);\n *\n * // Save to file (Node.js)\n * import { writeFile } from \"fs/promises\";\n * await writeFile(\"recording.ogg\", Buffer.from(audioBuffer));\n * ```\n */\n async getRecording(streamId: string): Promise<ArrayBuffer> {\n if (!streamId || streamId.trim().length === 0) {\n throw new SaynaValidationError(\"streamId cannot be empty\");\n }\n\n return this.fetchFromSayna<ArrayBuffer>(\n `recording/${encodeURIComponent(streamId)}`,\n { method: \"GET\" },\n \"arrayBuffer\"\n );\n }\n\n /**\n * Retrieves all configured SIP webhook hooks from the runtime cache.\n *\n * @returns Promise that resolves with the list of configured SIP hooks\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 500 if reading cache fails)\n *\n * @example\n * ```typescript\n * const response = await client.getSipHooks();\n * for (const hook of response.hooks) {\n * console.log(`Host: ${hook.host}, URL: ${hook.url}`);\n * }\n * ```\n */\n async getSipHooks(): Promise<SipHooksResponse> {\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\");\n }\n\n /**\n * Sets or updates SIP webhook hooks in the runtime cache.\n *\n * Hooks with matching hosts will be replaced; new hosts will be added.\n * The response contains the merged list of all hooks (existing + new).\n *\n * @param hooks - Array of SIP hook configurations to add or replace\n * @returns Promise that resolves with the merged list of all configured hooks\n * @throws {SaynaValidationError} If hooks array is empty or contains invalid entries\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 400 for duplicate hosts, 500 for cache errors)\n *\n * @example\n * ```typescript\n * const response = await client.setSipHooks([\n * { host: \"example.com\", url: \"https://webhook.example.com/events\" },\n * { host: \"another.com\", url: \"https://webhook.another.com/events\" }\n * ]);\n * console.log(\"Total hooks configured:\", response.hooks.length);\n * ```\n */\n async setSipHooks(hooks: SipHook[]): Promise<SipHooksResponse> {\n if (!Array.isArray(hooks)) {\n throw new SaynaValidationError(\"hooks must be an array\");\n }\n\n if (hooks.length === 0) {\n throw new SaynaValidationError(\"hooks array cannot be empty\");\n }\n\n for (const [i, hook] of hooks.entries()) {\n if (\n !hook.host ||\n typeof hook.host !== \"string\" ||\n hook.host.trim().length === 0\n ) {\n throw new SaynaValidationError(\n `hooks[${i}].host must be a non-empty string`\n );\n }\n if (\n !hook.url ||\n typeof hook.url !== \"string\" ||\n hook.url.trim().length === 0\n ) {\n throw new SaynaValidationError(\n `hooks[${i}].url must be a non-empty string`\n );\n }\n }\n\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\", {\n method: \"POST\",\n body: JSON.stringify({ hooks }),\n });\n }\n\n /**\n * Deletes SIP webhook hooks by host name from the runtime cache.\n *\n * If a deleted host exists in the original server configuration,\n * it will revert to its config value after deletion.\n *\n * @param hosts - Array of host names to remove (case-insensitive)\n * @returns Promise that resolves with the updated list of hooks after deletion\n * @throws {SaynaValidationError} If hosts array is empty or contains invalid entries\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 400 for empty hosts, 500 for cache errors)\n *\n * @example\n * ```typescript\n * const response = await client.deleteSipHooks([\"example.com\", \"another.com\"]);\n * console.log(\"Remaining hooks:\", response.hooks.length);\n * ```\n */\n async deleteSipHooks(hosts: string[]): Promise<SipHooksResponse> {\n if (!Array.isArray(hosts)) {\n throw new SaynaValidationError(\"hosts must be an array\");\n }\n\n if (hosts.length === 0) {\n throw new SaynaValidationError(\"hosts array cannot be empty\");\n }\n\n for (const [i, host] of hosts.entries()) {\n if (!host || typeof host !== \"string\" || host.trim().length === 0) {\n throw new SaynaValidationError(\n `hosts[${i}] must be a non-empty string`\n );\n }\n }\n\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\", {\n method: \"DELETE\",\n body: JSON.stringify({ hosts }),\n });\n }\n\n /**\n * Whether the client is ready to send/receive data.\n */\n get ready(): boolean {\n return this.isReady;\n }\n\n /**\n * Whether the client is connected to the WebSocket.\n */\n get connected(): boolean {\n return this.isConnected;\n }\n\n /**\n * LiveKit room name acknowledged by the server, if available.\n */\n get livekitRoomName(): string | undefined {\n return this._livekitRoomName;\n }\n\n /**\n * LiveKit WebSocket URL configured on the server, if available.\n */\n get livekitUrl(): string | undefined {\n return this._livekitUrl;\n }\n\n /**\n * Identity assigned to the agent participant when LiveKit is enabled, if available.\n */\n get saynaParticipantIdentity(): string | undefined {\n return this._saynaParticipantIdentity;\n }\n\n /**\n * Display name assigned to the agent participant when LiveKit is enabled, if available.\n */\n get saynaParticipantName(): string | undefined {\n return this._saynaParticipantName;\n }\n\n /**\n * Session identifier returned by the server.\n * This can be used to download recordings or correlate session data.\n * The value is available after the connection is ready.\n */\n get streamId(): string | undefined {\n return this._streamId;\n }\n}\n",
|
|
5
|
+
"/**\n * Base error class for all Sayna SDK errors.\n */\nexport class SaynaError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"SaynaError\";\n Object.setPrototypeOf(this, SaynaError.prototype);\n }\n}\n\n/**\n * Error thrown when attempting to use the client before it's connected.\n */\nexport class SaynaNotConnectedError extends SaynaError {\n constructor(message: string = \"Not connected to Sayna WebSocket\") {\n super(message);\n this.name = \"SaynaNotConnectedError\";\n Object.setPrototypeOf(this, SaynaNotConnectedError.prototype);\n }\n}\n\n/**\n * Error thrown when attempting operations before the client is ready.\n */\nexport class SaynaNotReadyError extends SaynaError {\n constructor(\n message: string = \"Sayna voice providers are not ready. Wait for the connection to be established.\"\n ) {\n super(message);\n this.name = \"SaynaNotReadyError\";\n Object.setPrototypeOf(this, SaynaNotReadyError.prototype);\n }\n}\n\n/**\n * Error thrown when WebSocket connection fails.\n */\nexport class SaynaConnectionError extends SaynaError {\n public override readonly cause?: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = \"SaynaConnectionError\";\n this.cause = cause;\n Object.setPrototypeOf(this, SaynaConnectionError.prototype);\n }\n}\n\n/**\n * Error thrown when invalid parameters are provided.\n */\nexport class SaynaValidationError extends SaynaError {\n constructor(message: string) {\n super(message);\n this.name = \"SaynaValidationError\";\n Object.setPrototypeOf(this, SaynaValidationError.prototype);\n }\n}\n\n/**\n * Error thrown when the server returns an error response.\n *\n * For REST API calls, the `status` and `endpoint` fields provide context about\n * which request failed and with what HTTP status code. Common status codes:\n * - 403: Access denied (e.g., room owned by another tenant on /livekit/token)\n * - 404: Not found or not accessible (masked access denial for room-scoped operations)\n * - 500: Internal server error\n */\nexport class SaynaServerError extends SaynaError {\n /**\n * HTTP status code returned by the server, if available.\n * Set for REST API errors; undefined for WebSocket errors.\n */\n public readonly status?: number;\n\n /**\n * API endpoint that returned the error, if available.\n * Set for REST API errors; undefined for WebSocket errors.\n */\n public readonly endpoint?: string;\n\n constructor(message: string, status?: number, endpoint?: string) {\n super(message);\n this.name = \"SaynaServerError\";\n this.status = status;\n this.endpoint = endpoint;\n Object.setPrototypeOf(this, SaynaServerError.prototype);\n }\n}\n",
|
|
6
|
+
"import type {\n STTConfig,\n TTSConfig,\n LiveKitConfig,\n ConfigMessage,\n SpeakMessage,\n ClearMessage,\n SendMessageMessage,\n STTResultMessage,\n ErrorMessage,\n SipTransferErrorMessage,\n SipTransferMessage,\n OutgoingMessage,\n SaynaMessage,\n Participant,\n VoicesResponse,\n HealthResponse,\n LiveKitTokenResponse,\n LiveKitRoomsResponse,\n LiveKitRoomDetails,\n SipHook,\n SipHooksResponse,\n RemoveLiveKitParticipantResponse,\n MuteLiveKitParticipantResponse,\n SipTransferResponse,\n} from \"./types\";\nimport {\n SaynaNotConnectedError,\n SaynaNotReadyError,\n SaynaConnectionError,\n SaynaValidationError,\n SaynaServerError,\n} from \"./errors\";\n\n// Node.js 18+ has native fetch support\ndeclare const fetch: typeof globalThis.fetch;\n\n/**\n * Event handler for speech-to-text results.\n */\nexport type STTResultHandler = (\n result: STTResultMessage\n) => void | Promise<void>;\n\n/**\n * Event handler for text-to-speech audio data.\n */\nexport type TTSAudioHandler = (audio: ArrayBuffer) => void | Promise<void>;\n\n/**\n * Event handler for error messages.\n */\nexport type ErrorHandler = (error: ErrorMessage) => void | Promise<void>;\n\n/**\n * Event handler for participant messages.\n */\nexport type MessageHandler = (message: SaynaMessage) => void | Promise<void>;\n\n/**\n * Event handler for participant disconnections.\n */\nexport type ParticipantDisconnectedHandler = (\n participant: Participant\n) => void | Promise<void>;\n\n/**\n * Event handler for TTS playback completion.\n */\nexport type TTSPlaybackCompleteHandler = (\n timestamp: number\n) => void | Promise<void>;\n\n/**\n * Event handler for SIP transfer specific errors.\n */\nexport type SipTransferErrorHandler = (\n error: SipTransferErrorMessage\n) => void | Promise<void>;\n\n/**\n * Client for connecting to Sayna WebSocket server for real-time voice interactions.\n *\n * @example\n * ```typescript\n * const client = await saynaConnect(\n * \"https://api.sayna.ai\",\n * sttConfig,\n * ttsConfig\n * );\n *\n * client.registerOnSttResult((result) => {\n * console.log(\"Transcription:\", result.transcript);\n * });\n *\n * await client.speak(\"Hello, world!\");\n * ```\n */\nexport class SaynaClient {\n private url: string;\n private sttConfig?: STTConfig;\n private ttsConfig?: TTSConfig;\n private livekitConfig?: LiveKitConfig;\n private withoutAudio: boolean;\n private apiKey?: string;\n private websocket?: WebSocket;\n private isConnected: boolean = false;\n private isReady: boolean = false;\n private _livekitRoomName?: string;\n private _livekitUrl?: string;\n private _saynaParticipantIdentity?: string;\n private _saynaParticipantName?: string;\n private _streamId?: string;\n private inputStreamId?: string;\n private sttCallback?: STTResultHandler;\n private ttsCallback?: TTSAudioHandler;\n private errorCallback?: ErrorHandler;\n private messageCallback?: MessageHandler;\n private participantDisconnectedCallback?: ParticipantDisconnectedHandler;\n private ttsPlaybackCompleteCallback?: TTSPlaybackCompleteHandler;\n private sipTransferErrorCallback?: SipTransferErrorHandler;\n private readyPromiseResolve?: () => void;\n private readyPromiseReject?: (error: Error) => void;\n\n /**\n * Creates a new SaynaClient instance.\n *\n * @param url - The Sayna server URL (e.g., \"https://api.sayna.ai\")\n * @param sttConfig - Speech-to-text configuration (required when withoutAudio=false)\n * @param ttsConfig - Text-to-speech configuration (required when withoutAudio=false)\n * @param livekitConfig - Optional LiveKit room configuration\n * @param withoutAudio - If true, disables audio streaming (default: false)\n * @param apiKey - Optional API key used to authorize HTTP and WebSocket calls (defaults to SAYNA_API_KEY env)\n * @param streamId - Optional session identifier for recording paths; server generates a UUID when omitted\n *\n * @throws {SaynaValidationError} If URL is invalid or if audio configs are missing when audio is enabled\n */\n constructor(\n url: string,\n sttConfig?: STTConfig,\n ttsConfig?: TTSConfig,\n livekitConfig?: LiveKitConfig,\n withoutAudio: boolean = false,\n apiKey?: string,\n streamId?: string\n ) {\n // Validate URL\n if (!url || typeof url !== \"string\") {\n throw new SaynaValidationError(\"URL must be a non-empty string\");\n }\n if (\n !url.startsWith(\"http://\") &&\n !url.startsWith(\"https://\") &&\n !url.startsWith(\"ws://\") &&\n !url.startsWith(\"wss://\")\n ) {\n throw new SaynaValidationError(\n \"URL must start with http://, https://, ws://, or wss://\"\n );\n }\n\n // Validate audio config requirements\n if (!withoutAudio) {\n if (!sttConfig || !ttsConfig) {\n throw new SaynaValidationError(\n \"sttConfig and ttsConfig are required when withoutAudio=false (audio streaming enabled). \" +\n \"Either provide both configs or set withoutAudio=true for non-audio use cases.\"\n );\n }\n }\n\n this.url = url;\n this.sttConfig = sttConfig;\n this.ttsConfig = ttsConfig;\n this.livekitConfig = livekitConfig;\n this.withoutAudio = withoutAudio;\n this.apiKey = apiKey ?? process.env.SAYNA_API_KEY;\n this.inputStreamId = streamId;\n }\n\n /**\n * Establishes connection to the Sayna WebSocket server.\n *\n * @throws {SaynaConnectionError} If connection fails\n * @returns Promise that resolves when the connection is ready\n */\n async connect(): Promise<void> {\n if (this.isConnected) {\n return;\n }\n\n // Convert HTTP(S) URL to WebSocket URL\n const wsUrl =\n this.url.replace(/^https:\\/\\//, \"wss://\").replace(/^http:\\/\\//, \"ws://\") +\n (this.url.endsWith(\"/\") ? \"ws\" : \"/ws\");\n\n return new Promise((resolve, reject) => {\n this.readyPromiseResolve = resolve;\n this.readyPromiseReject = reject;\n\n try {\n const headers = this.apiKey\n ? { Authorization: `Bearer ${this.apiKey}` }\n : undefined;\n\n const WebSocketConstructor = WebSocket as unknown as {\n new (\n url: string,\n protocols?: string | string[],\n options?: { headers?: Record<string, string> }\n ): WebSocket;\n };\n\n this.websocket = headers\n ? new WebSocketConstructor(wsUrl, undefined, { headers })\n : new WebSocket(wsUrl);\n\n this.websocket.onopen = () => {\n this.isConnected = true;\n\n // Send initial configuration\n const configMessage: ConfigMessage = {\n type: \"config\",\n stream_id: this.inputStreamId,\n stt_config: this.sttConfig,\n tts_config: this.ttsConfig,\n livekit: this.livekitConfig,\n audio: !this.withoutAudio,\n };\n\n try {\n if (this.websocket) {\n this.websocket.send(JSON.stringify(configMessage));\n }\n } catch (error) {\n this.cleanup();\n const err = new SaynaConnectionError(\n \"Failed to send configuration\",\n error\n );\n if (this.readyPromiseReject) {\n this.readyPromiseReject(err);\n }\n }\n };\n\n this.websocket.onmessage = async (event) => {\n try {\n if (\n event.data instanceof Blob ||\n event.data instanceof ArrayBuffer\n ) {\n // Binary TTS audio data\n const buffer =\n event.data instanceof Blob\n ? await event.data.arrayBuffer()\n : event.data;\n if (this.ttsCallback) {\n await this.ttsCallback(buffer);\n }\n } else {\n // JSON control messages\n if (typeof event.data !== \"string\") {\n throw new Error(\"Expected string data for JSON messages\");\n }\n const data = JSON.parse(event.data) as OutgoingMessage;\n await this.handleJsonMessage(data);\n }\n } catch (error) {\n // Log parse errors but don't break the connection\n if (this.errorCallback) {\n const errorMessage =\n error instanceof Error ? error.message : String(error);\n await this.errorCallback({\n type: \"error\",\n message: `Failed to process message: ${errorMessage}`,\n });\n }\n }\n };\n\n this.websocket.onerror = () => {\n const error = new SaynaConnectionError(\"WebSocket connection error\");\n if (this.readyPromiseReject && !this.isReady) {\n this.readyPromiseReject(error);\n }\n };\n\n this.websocket.onclose = (event) => {\n const wasReady = this.isReady;\n this.cleanup();\n\n // If connection closed before ready, reject the promise\n if (!wasReady && this.readyPromiseReject) {\n this.readyPromiseReject(\n new SaynaConnectionError(\n `WebSocket closed before ready (code: ${event.code}, reason: ${event.reason || \"none\"})`\n )\n );\n }\n };\n } catch (error) {\n reject(new SaynaConnectionError(\"Failed to create WebSocket\", error));\n }\n });\n }\n\n /**\n * Handles incoming JSON messages from the WebSocket.\n * @internal\n */\n private async handleJsonMessage(data: OutgoingMessage): Promise<void> {\n const messageType = data.type;\n\n try {\n switch (messageType) {\n case \"ready\": {\n const readyMsg = data;\n this.isReady = true;\n this._livekitRoomName = readyMsg.livekit_room_name;\n this._livekitUrl = readyMsg.livekit_url;\n this._saynaParticipantIdentity = readyMsg.sayna_participant_identity;\n this._saynaParticipantName = readyMsg.sayna_participant_name;\n this._streamId = readyMsg.stream_id;\n if (this.readyPromiseResolve) {\n this.readyPromiseResolve();\n }\n break;\n }\n\n case \"stt_result\": {\n const sttResult = data;\n if (this.sttCallback) {\n await this.sttCallback(sttResult);\n }\n break;\n }\n\n case \"error\": {\n const errorMsg = data;\n if (this.errorCallback) {\n await this.errorCallback(errorMsg);\n }\n if (this.readyPromiseReject && !this.isReady) {\n this.readyPromiseReject(new SaynaServerError(errorMsg.message));\n }\n break;\n }\n\n case \"sip_transfer_error\": {\n const sipTransferError = data;\n if (this.sipTransferErrorCallback) {\n await this.sipTransferErrorCallback(sipTransferError);\n } else if (this.errorCallback) {\n await this.errorCallback({\n type: \"error\",\n message: sipTransferError.message,\n });\n }\n break;\n }\n\n case \"message\": {\n const messageData = data;\n if (this.messageCallback) {\n await this.messageCallback(messageData.message);\n }\n break;\n }\n\n case \"participant_disconnected\": {\n const participantMsg = data;\n if (this.participantDisconnectedCallback) {\n await this.participantDisconnectedCallback(\n participantMsg.participant\n );\n }\n break;\n }\n\n case \"tts_playback_complete\": {\n const ttsPlaybackCompleteMsg = data;\n if (this.ttsPlaybackCompleteCallback) {\n await this.ttsPlaybackCompleteCallback(\n ttsPlaybackCompleteMsg.timestamp\n );\n }\n break;\n }\n\n default: {\n const unknownMessage = data as { type: string };\n const errorMessage = `Unknown message type received: ${unknownMessage.type}`;\n if (this.errorCallback) {\n await this.errorCallback({ type: \"error\", message: errorMessage });\n } else {\n console.warn(errorMessage);\n }\n }\n }\n } catch (error) {\n // Notify error callback if handler fails\n if (this.errorCallback) {\n await this.errorCallback({\n type: \"error\",\n message: `Handler error: ${error instanceof Error ? error.message : String(error)}`,\n });\n }\n }\n }\n\n /**\n * Cleans up internal state.\n * @internal\n */\n private cleanup(): void {\n this.isConnected = false;\n this.isReady = false;\n this._livekitRoomName = undefined;\n this._livekitUrl = undefined;\n this._saynaParticipantIdentity = undefined;\n this._saynaParticipantName = undefined;\n this._streamId = undefined;\n }\n\n /**\n * Converts WebSocket URL to HTTP URL for REST API calls.\n * @internal\n */\n private getHttpUrl(): string {\n return this.url\n .replace(/^ws:\\/\\//, \"http://\")\n .replace(/^wss:\\/\\//, \"https://\");\n }\n\n /**\n * Generic fetch helper for making REST API calls to Sayna server.\n * Handles URL construction, headers, error responses, and type conversion.\n * @internal\n *\n * @param endpoint - API endpoint path (e.g., \"/voices\", \"/speak\")\n * @param options - Fetch options including method, body, headers, etc.\n * @param responseType - Expected response type: \"json\" or \"arrayBuffer\"\n * @returns Promise resolving to the parsed response\n * @throws {SaynaConnectionError} If the network request fails\n * @throws {SaynaServerError} If the server returns an error response (includes status and endpoint)\n */\n private async fetchFromSayna<T>(\n endpoint: string,\n options: RequestInit = {},\n responseType: \"json\" | \"arrayBuffer\" = \"json\"\n ): Promise<T> {\n const httpUrl = this.getHttpUrl();\n const normalizedEndpoint = endpoint.startsWith(\"/\")\n ? endpoint.slice(1)\n : endpoint;\n const url = `${httpUrl}${httpUrl.endsWith(\"/\") ? \"\" : \"/\"}${normalizedEndpoint}`;\n\n // Merge default headers with user-provided headers\n const headers: Record<string, string> = {\n ...(options.headers as Record<string, string>),\n };\n\n // Add Authorization header when an API key is provided, unless user supplied one\n const hasAuthHeader = Object.keys(headers).some(\n (key) => key.toLowerCase() === \"authorization\"\n );\n if (this.apiKey && !hasAuthHeader) {\n headers[\"Authorization\"] = `Bearer ${this.apiKey}`;\n }\n\n // Add Content-Type for JSON requests with body if not already set\n if (options.body && !headers[\"Content-Type\"]) {\n headers[\"Content-Type\"] = \"application/json\";\n }\n\n try {\n const response = await fetch(url, {\n ...options,\n headers,\n });\n\n if (!response.ok) {\n // Try to parse error message from JSON response\n let errorMessage: string;\n try {\n const errorData: unknown = await response.json();\n errorMessage =\n errorData &&\n typeof errorData === \"object\" &&\n \"error\" in errorData &&\n typeof errorData.error === \"string\"\n ? errorData.error\n : `Request failed: ${response.status} ${response.statusText}`;\n } catch {\n errorMessage = `Request failed: ${response.status} ${response.statusText}`;\n }\n\n // Enhance error messages for specific status codes\n if (response.status === 403) {\n errorMessage = `Access denied: ${errorMessage}`;\n } else if (response.status === 404) {\n errorMessage = `Not found or not accessible: ${errorMessage}`;\n }\n\n throw new SaynaServerError(\n errorMessage,\n response.status,\n normalizedEndpoint\n );\n }\n\n // Parse response based on expected type\n if (responseType === \"arrayBuffer\") {\n return (await response.arrayBuffer()) as T;\n } else {\n return (await response.json()) as T;\n }\n } catch (error) {\n // Re-throw SaynaServerError as-is\n if (error instanceof SaynaServerError) {\n throw error;\n }\n // Wrap other errors in SaynaConnectionError\n throw new SaynaConnectionError(`Failed to fetch from ${endpoint}`, error);\n }\n }\n\n /**\n * Disconnects from the Sayna WebSocket server and cleans up resources.\n */\n disconnect(): void {\n if (this.websocket) {\n // Remove event handlers to prevent memory leaks\n this.websocket.onopen = null;\n this.websocket.onmessage = null;\n this.websocket.onerror = null;\n this.websocket.onclose = null;\n\n if (this.websocket.readyState === WebSocket.OPEN) {\n this.websocket.close(1000, \"Client disconnect\");\n }\n\n this.websocket = undefined;\n }\n\n this.cleanup();\n }\n\n /**\n * Sends audio data to the server for speech recognition.\n *\n * @param audioData - Raw audio data as ArrayBuffer\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n onAudioInput(audioData: ArrayBuffer): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (!(audioData instanceof ArrayBuffer)) {\n throw new SaynaValidationError(\"audioData must be an ArrayBuffer\");\n }\n\n if (audioData.byteLength === 0) {\n throw new SaynaValidationError(\"audioData cannot be empty\");\n }\n\n try {\n this.websocket.send(audioData);\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send audio data\", error);\n }\n }\n\n /**\n * Registers a callback for speech-to-text results.\n *\n * @param callback - Function to call when STT results are received\n */\n registerOnSttResult(callback: STTResultHandler): void {\n this.sttCallback = callback;\n }\n\n /**\n * Registers a callback for text-to-speech audio data.\n *\n * @param callback - Function to call when TTS audio is received\n */\n registerOnTtsAudio(callback: TTSAudioHandler): void {\n this.ttsCallback = callback;\n }\n\n /**\n * Registers a callback for error messages.\n *\n * @param callback - Function to call when errors occur\n */\n registerOnError(callback: ErrorHandler): void {\n this.errorCallback = callback;\n }\n\n /**\n * Registers a callback for participant messages.\n *\n * @param callback - Function to call when messages are received\n */\n registerOnMessage(callback: MessageHandler): void {\n this.messageCallback = callback;\n }\n\n /**\n * Registers a callback for participant disconnection events.\n *\n * @param callback - Function to call when a participant disconnects\n */\n registerOnParticipantDisconnected(\n callback: ParticipantDisconnectedHandler\n ): void {\n this.participantDisconnectedCallback = callback;\n }\n\n /**\n * Registers a callback for TTS playback completion.\n *\n * @param callback - Function to call when TTS playback is complete\n */\n registerOnTtsPlaybackComplete(callback: TTSPlaybackCompleteHandler): void {\n this.ttsPlaybackCompleteCallback = callback;\n }\n\n /**\n * Registers a callback for SIP transfer specific errors.\n *\n * @param callback - Function to call when a SIP transfer error message is received\n */\n registerOnSipTransferError(callback: SipTransferErrorHandler): void {\n this.sipTransferErrorCallback = callback;\n }\n\n /**\n * Sends text to be synthesized as speech.\n *\n * @param text - Text to synthesize\n * @param flush - Whether to flush the TTS queue before speaking (default: true)\n * @param allowInterruption - Whether this speech can be interrupted (default: true)\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If text is not a string\n */\n speak(\n text: string,\n flush: boolean = true,\n allowInterruption: boolean = true\n ): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof text !== \"string\") {\n throw new SaynaValidationError(\"text must be a string\");\n }\n\n try {\n const speakMessage: SpeakMessage = {\n type: \"speak\",\n text,\n flush,\n allow_interruption: allowInterruption,\n };\n this.websocket.send(JSON.stringify(speakMessage));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send speak command\", error);\n }\n }\n\n /**\n * Clears the text-to-speech queue.\n *\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n clear(): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n try {\n const clearMessage: ClearMessage = {\n type: \"clear\",\n };\n this.websocket.send(JSON.stringify(clearMessage));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send clear command\", error);\n }\n }\n\n /**\n * Flushes the TTS queue by sending an empty speak command.\n *\n * @param allowInterruption - Whether the flush can be interrupted (default: true)\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n */\n ttsFlush(allowInterruption: boolean = true): void {\n this.speak(\"\", true, allowInterruption);\n }\n\n /**\n * Sends a message to the Sayna session.\n *\n * @param message - Message content\n * @param role - Message role (e.g., \"user\", \"assistant\")\n * @param topic - Optional topic identifier\n * @param debug - Optional debug metadata\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If parameters are invalid\n */\n sendMessage(\n message: string,\n role: string,\n topic?: string,\n debug?: Record<string, unknown>\n ): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof message !== \"string\") {\n throw new SaynaValidationError(\"message must be a string\");\n }\n\n if (typeof role !== \"string\") {\n throw new SaynaValidationError(\"role must be a string\");\n }\n\n try {\n const sendMsg: SendMessageMessage = {\n type: \"send_message\",\n message,\n role,\n topic,\n debug,\n };\n this.websocket.send(JSON.stringify(sendMsg));\n } catch (error) {\n throw new SaynaConnectionError(\"Failed to send message\", error);\n }\n }\n\n /**\n * Initiates a SIP transfer for the active LiveKit session.\n *\n * @param transferTo - Destination phone number or extension to transfer to\n * @throws {SaynaNotConnectedError} If not connected\n * @throws {SaynaNotReadyError} If connection is not ready\n * @throws {SaynaValidationError} If transferTo is not a non-empty string\n */\n sipTransfer(transferTo: string): void {\n if (!this.isConnected || !this.websocket) {\n throw new SaynaNotConnectedError();\n }\n\n if (!this.isReady) {\n throw new SaynaNotReadyError();\n }\n\n if (typeof transferTo !== \"string\" || transferTo.trim().length === 0) {\n throw new SaynaValidationError(\"transfer_to must be a non-empty string\");\n }\n\n try {\n const sipTransferMessage: SipTransferMessage = {\n type: \"sip_transfer\",\n transfer_to: transferTo.trim(),\n };\n this.websocket.send(JSON.stringify(sipTransferMessage));\n } catch (error) {\n throw new SaynaConnectionError(\n \"Failed to send SIP transfer command\",\n error\n );\n }\n }\n\n /**\n * Performs a health check on the Sayna server.\n *\n * @returns Promise that resolves with the health status\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const health = await client.health();\n * console.log(health.status); // \"OK\"\n * ```\n */\n async health(): Promise<HealthResponse> {\n return this.fetchFromSayna<HealthResponse>(\"\");\n }\n\n /**\n * Retrieves the catalogue of text-to-speech voices grouped by provider.\n *\n * @returns Promise that resolves with voices organized by provider\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const voices = await client.getVoices();\n * for (const [provider, voiceList] of Object.entries(voices)) {\n * console.log(`${provider}:`, voiceList.map(v => v.name));\n * }\n * ```\n */\n async getVoices(): Promise<VoicesResponse> {\n return this.fetchFromSayna<VoicesResponse>(\"voices\");\n }\n\n /**\n * Synthesizes text into audio using the REST API endpoint.\n * This is a standalone synthesis method that doesn't require an active WebSocket connection.\n *\n * @param text - Text to synthesize\n * @param ttsConfig - Text-to-speech configuration\n * @returns Promise that resolves with the audio data as ArrayBuffer\n * @throws {SaynaValidationError} If text is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error\n *\n * @example\n * ```typescript\n * const audioBuffer = await client.speakRest(\"Hello, world!\", {\n * provider: \"elevenlabs\",\n * voice_id: \"21m00Tcm4TlvDq8ikWAM\",\n * model: \"eleven_turbo_v2\",\n * speaking_rate: 1.0,\n * audio_format: \"mp3\",\n * sample_rate: 24000,\n * connection_timeout: 30,\n * request_timeout: 60,\n * pronunciations: []\n * });\n * ```\n */\n async speakRest(text: string, ttsConfig: TTSConfig): Promise<ArrayBuffer> {\n if (!text || text.trim().length === 0) {\n throw new SaynaValidationError(\"Text cannot be empty\");\n }\n\n return this.fetchFromSayna<ArrayBuffer>(\n \"speak\",\n {\n method: \"POST\",\n body: JSON.stringify({\n text,\n tts_config: ttsConfig,\n }),\n },\n \"arrayBuffer\"\n );\n }\n\n /**\n * Issues a LiveKit access token for a participant.\n *\n * Room names are used as-is; the SDK does not rewrite or prefix them. When authentication\n * is enabled, this endpoint creates the room if missing and sets room ownership metadata.\n *\n * @param roomName - LiveKit room to join or create. Provide the clean room name without any prefix.\n * @param participantName - Display name assigned to the participant\n * @param participantIdentity - Unique identifier for the participant\n * @returns Promise that resolves with the LiveKit token and connection details\n * @throws {SaynaValidationError} If any parameter is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error. A 403 status indicates the room\n * is owned by another tenant; do not retry with a modified room name.\n *\n * @example\n * ```typescript\n * const tokenInfo = await client.getLiveKitToken(\n * \"my-room\",\n * \"John Doe\",\n * \"user-123\"\n * );\n * console.log(\"Token:\", tokenInfo.token);\n * console.log(\"LiveKit URL:\", tokenInfo.livekit_url);\n * ```\n */\n async getLiveKitToken(\n roomName: string,\n participantName: string,\n participantIdentity: string\n ): Promise<LiveKitTokenResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantName || participantName.trim().length === 0) {\n throw new SaynaValidationError(\"participant_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n return this.fetchFromSayna<LiveKitTokenResponse>(\"livekit/token\", {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName,\n participant_name: participantName,\n participant_identity: participantIdentity,\n }),\n });\n }\n\n /**\n * Lists LiveKit rooms accessible to the authenticated context.\n *\n * Room listings are scoped server-side based on authentication. When authentication is\n * enabled, this endpoint may return fewer rooms than before (only those you have access to).\n * Room names are not modified by the SDK.\n *\n * @returns Promise that resolves with the list of accessible rooms\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., LiveKit not configured)\n *\n * @example\n * ```typescript\n * const response = await client.getLiveKitRooms();\n * for (const room of response.rooms) {\n * console.log(`Room: ${room.name}, Participants: ${room.num_participants}`);\n * }\n * ```\n */\n async getLiveKitRooms(): Promise<LiveKitRoomsResponse> {\n return this.fetchFromSayna<LiveKitRoomsResponse>(\"livekit/rooms\");\n }\n\n /**\n * Retrieves detailed information about a specific LiveKit room including participants.\n *\n * Room names are used as-is; the SDK does not rewrite or prefix them. Access is\n * enforced server-side based on room ownership metadata.\n *\n * @param roomName - Name of the room to retrieve\n * @returns Promise that resolves with detailed room information including participants\n * @throws {SaynaValidationError} If roomName is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error. A 404 status can mean \"not found\"\n * or \"not accessible\" when room ownership is enforced.\n *\n * @example\n * ```typescript\n * const room = await client.getLiveKitRoom(\"my-room\");\n * console.log(`Room: ${room.name}, SID: ${room.sid}`);\n * console.log(`Participants: ${room.num_participants}/${room.max_participants}`);\n * for (const participant of room.participants) {\n * console.log(` - ${participant.name} (${participant.identity}): ${participant.state}`);\n * }\n * ```\n */\n async getLiveKitRoom(roomName: string): Promise<LiveKitRoomDetails> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n const encoded = encodeURIComponent(roomName.trim());\n return this.fetchFromSayna<LiveKitRoomDetails>(`livekit/rooms/${encoded}`);\n }\n\n /**\n * Removes a participant from a LiveKit room, forcibly disconnecting them.\n *\n * Room names are used as-is; the SDK does not rewrite or prefix them. Access is\n * enforced server-side based on room ownership metadata.\n *\n * **Important:** This does not invalidate the participant's token. To prevent\n * rejoining, use short-lived tokens and avoid issuing new tokens to removed participants.\n *\n * @param roomName - Name of the room where the participant is connected\n * @param participantIdentity - The identity of the participant to remove\n * @returns Promise that resolves with the removal confirmation\n * @throws {SaynaValidationError} If roomName or participantIdentity is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error. A 404 status can mean \"not found\"\n * or \"not accessible\" when room ownership is enforced.\n *\n * @example\n * ```typescript\n * const result = await client.removeLiveKitParticipant(\"my-room\", \"user-alice-456\");\n * console.log(`Status: ${result.status}`);\n * console.log(`Removed from room: ${result.room_name}`);\n * console.log(`Participant: ${result.participant_identity}`);\n * ```\n */\n async removeLiveKitParticipant(\n roomName: string,\n participantIdentity: string\n ): Promise<RemoveLiveKitParticipantResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n return this.fetchFromSayna<RemoveLiveKitParticipantResponse>(\n \"livekit/participant\",\n {\n method: \"DELETE\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n }),\n }\n );\n }\n\n /**\n * Mutes or unmutes a participant's published track in a LiveKit room.\n *\n * Room names are used as-is; the SDK does not rewrite or prefix them. Access is\n * enforced server-side based on room ownership metadata.\n *\n * @param roomName - Name of the room where the participant is connected\n * @param participantIdentity - The identity of the participant whose track to mute\n * @param trackSid - The session ID of the track to mute/unmute\n * @param muted - True to mute, false to unmute\n * @returns Promise that resolves with the mute operation result\n * @throws {SaynaValidationError} If roomName, participantIdentity, or trackSid is empty, or if muted is not a boolean\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error. A 404 status can mean \"not found\"\n * or \"not accessible\" when room ownership is enforced.\n *\n * @example\n * ```typescript\n * // Mute a participant's track\n * const result = await client.muteLiveKitParticipantTrack(\n * \"my-room\",\n * \"user-alice-456\",\n * \"TR_abc123\",\n * true\n * );\n * console.log(`Track ${result.track_sid} muted: ${result.muted}`);\n *\n * // Unmute the track\n * const unmuteResult = await client.muteLiveKitParticipantTrack(\n * \"my-room\",\n * \"user-alice-456\",\n * \"TR_abc123\",\n * false\n * );\n * ```\n */\n async muteLiveKitParticipantTrack(\n roomName: string,\n participantIdentity: string,\n trackSid: string,\n muted: boolean\n ): Promise<MuteLiveKitParticipantResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n if (!trackSid || trackSid.trim().length === 0) {\n throw new SaynaValidationError(\"track_sid cannot be empty\");\n }\n\n if (typeof muted !== \"boolean\") {\n throw new SaynaValidationError(\"muted must be a boolean\");\n }\n\n return this.fetchFromSayna<MuteLiveKitParticipantResponse>(\n \"livekit/participant/mute\",\n {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n track_sid: trackSid.trim(),\n muted,\n }),\n }\n );\n }\n\n /**\n * Initiates a SIP call transfer via the REST API endpoint.\n *\n * This is distinct from the WebSocket `sipTransfer()` method. Use this REST endpoint\n * when you need to transfer a SIP call from outside the active WebSocket session,\n * or when you want to specify a particular room and participant explicitly.\n *\n * Room names are used as-is; the SDK does not rewrite or prefix them. Access is\n * enforced server-side based on room ownership metadata.\n *\n * **Important Notes:**\n * - Only SIP participants can be transferred\n * - A successful response indicates the transfer has been **initiated**, not necessarily completed\n * - The actual transfer may take several seconds\n *\n * @param roomName - Name of the room where the SIP participant is connected\n * @param participantIdentity - The identity of the SIP participant to transfer\n * @param transferTo - The phone number to transfer to (international, national, or extension format)\n * @returns Promise that resolves with the transfer status\n * @throws {SaynaValidationError} If roomName, participantIdentity, or transferTo is empty\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error. A 404 status can mean \"not found\"\n * or \"not accessible\" when room ownership is enforced.\n *\n * @example\n * ```typescript\n * // Transfer a SIP participant to another phone number\n * const result = await client.sipTransferRest(\n * \"call-room-123\",\n * \"sip_participant_456\",\n * \"+15551234567\"\n * );\n * console.log(`Transfer status: ${result.status}`);\n * console.log(`Transferred to: ${result.transfer_to}`);\n * ```\n */\n async sipTransferRest(\n roomName: string,\n participantIdentity: string,\n transferTo: string\n ): Promise<SipTransferResponse> {\n if (!roomName || roomName.trim().length === 0) {\n throw new SaynaValidationError(\"room_name cannot be empty\");\n }\n\n if (!participantIdentity || participantIdentity.trim().length === 0) {\n throw new SaynaValidationError(\"participant_identity cannot be empty\");\n }\n\n if (!transferTo || transferTo.trim().length === 0) {\n throw new SaynaValidationError(\"transfer_to cannot be empty\");\n }\n\n return this.fetchFromSayna<SipTransferResponse>(\"sip/transfer\", {\n method: \"POST\",\n body: JSON.stringify({\n room_name: roomName.trim(),\n participant_identity: participantIdentity.trim(),\n transfer_to: transferTo.trim(),\n }),\n });\n }\n\n /**\n * Downloads the recorded audio file for a completed session.\n *\n * @param streamId - The session identifier (obtained from the `streamId` getter after connection)\n * @returns Promise that resolves with the audio data as ArrayBuffer (OGG format)\n * @throws {SaynaValidationError} If streamId is empty\n * @throws {SaynaConnectionError} If the network request fails\n * @throws {SaynaServerError} If the recording is not found or server returns an error\n *\n * @example\n * ```typescript\n * // After a session completes, download the recording\n * const audioBuffer = await client.getRecording(client.streamId!);\n *\n * // Save to file (Node.js)\n * import { writeFile } from \"fs/promises\";\n * await writeFile(\"recording.ogg\", Buffer.from(audioBuffer));\n * ```\n */\n async getRecording(streamId: string): Promise<ArrayBuffer> {\n if (!streamId || streamId.trim().length === 0) {\n throw new SaynaValidationError(\"streamId cannot be empty\");\n }\n\n return this.fetchFromSayna<ArrayBuffer>(\n `recording/${encodeURIComponent(streamId)}`,\n { method: \"GET\" },\n \"arrayBuffer\"\n );\n }\n\n /**\n * Retrieves all configured SIP webhook hooks from the runtime cache.\n *\n * @returns Promise that resolves with the list of configured SIP hooks\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 500 if reading cache fails)\n *\n * @example\n * ```typescript\n * const response = await client.getSipHooks();\n * for (const hook of response.hooks) {\n * console.log(`Host: ${hook.host}, URL: ${hook.url}`);\n * }\n * ```\n */\n async getSipHooks(): Promise<SipHooksResponse> {\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\");\n }\n\n /**\n * Sets or updates SIP webhook hooks in the runtime cache.\n *\n * Hooks with matching hosts will be replaced; new hosts will be added.\n * The response contains the merged list of all hooks (existing + new).\n *\n * @param hooks - Array of SIP hook configurations to add or replace\n * @returns Promise that resolves with the merged list of all configured hooks\n * @throws {SaynaValidationError} If hooks array is empty or contains invalid entries\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 400 for duplicate hosts, 500 for cache errors)\n *\n * @example\n * ```typescript\n * const response = await client.setSipHooks([\n * { host: \"example.com\", url: \"https://webhook.example.com/events\", auth_id: \"tenant-123\" },\n * { host: \"another.com\", url: \"https://webhook.another.com/events\", auth_id: \"\" } // Empty for unauthenticated mode\n * ]);\n * console.log(\"Total hooks configured:\", response.hooks.length);\n * ```\n */\n async setSipHooks(hooks: SipHook[]): Promise<SipHooksResponse> {\n if (!Array.isArray(hooks)) {\n throw new SaynaValidationError(\"hooks must be an array\");\n }\n\n if (hooks.length === 0) {\n throw new SaynaValidationError(\"hooks array cannot be empty\");\n }\n\n for (const [i, hook] of hooks.entries()) {\n if (\n !hook.host ||\n typeof hook.host !== \"string\" ||\n hook.host.trim().length === 0\n ) {\n throw new SaynaValidationError(\n `hooks[${i}].host must be a non-empty string`\n );\n }\n if (\n !hook.url ||\n typeof hook.url !== \"string\" ||\n hook.url.trim().length === 0\n ) {\n throw new SaynaValidationError(\n `hooks[${i}].url must be a non-empty string`\n );\n }\n // auth_id is required but may be an empty string for unauthenticated mode\n if (typeof hook.auth_id !== \"string\") {\n throw new SaynaValidationError(\n `hooks[${i}].auth_id must be a string`\n );\n }\n }\n\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\", {\n method: \"POST\",\n body: JSON.stringify({ hooks }),\n });\n }\n\n /**\n * Deletes SIP webhook hooks by host name from the runtime cache.\n *\n * If a deleted host exists in the original server configuration,\n * it will revert to its config value after deletion.\n *\n * @param hosts - Array of host names to remove (case-insensitive)\n * @returns Promise that resolves with the updated list of hooks after deletion\n * @throws {SaynaValidationError} If hosts array is empty or contains invalid entries\n * @throws {SaynaConnectionError} If the request fails\n * @throws {SaynaServerError} If server returns an error (e.g., 400 for empty hosts, 500 for cache errors)\n *\n * @example\n * ```typescript\n * const response = await client.deleteSipHooks([\"example.com\", \"another.com\"]);\n * console.log(\"Remaining hooks:\", response.hooks.length);\n * ```\n */\n async deleteSipHooks(hosts: string[]): Promise<SipHooksResponse> {\n if (!Array.isArray(hosts)) {\n throw new SaynaValidationError(\"hosts must be an array\");\n }\n\n if (hosts.length === 0) {\n throw new SaynaValidationError(\"hosts array cannot be empty\");\n }\n\n for (const [i, host] of hosts.entries()) {\n if (!host || typeof host !== \"string\" || host.trim().length === 0) {\n throw new SaynaValidationError(\n `hosts[${i}] must be a non-empty string`\n );\n }\n }\n\n return this.fetchFromSayna<SipHooksResponse>(\"sip/hooks\", {\n method: \"DELETE\",\n body: JSON.stringify({ hosts }),\n });\n }\n\n /**\n * Whether the client is ready to send/receive data.\n */\n get ready(): boolean {\n return this.isReady;\n }\n\n /**\n * Whether the client is connected to the WebSocket.\n */\n get connected(): boolean {\n return this.isConnected;\n }\n\n /**\n * LiveKit room name acknowledged by the server, if available.\n */\n get livekitRoomName(): string | undefined {\n return this._livekitRoomName;\n }\n\n /**\n * LiveKit WebSocket URL configured on the server, if available.\n */\n get livekitUrl(): string | undefined {\n return this._livekitUrl;\n }\n\n /**\n * Identity assigned to the agent participant when LiveKit is enabled, if available.\n */\n get saynaParticipantIdentity(): string | undefined {\n return this._saynaParticipantIdentity;\n }\n\n /**\n * Display name assigned to the agent participant when LiveKit is enabled, if available.\n */\n get saynaParticipantName(): string | undefined {\n return this._saynaParticipantName;\n }\n\n /**\n * Session identifier returned by the server.\n * This can be used to download recordings or correlate session data.\n * The value is available after the connection is ready.\n */\n get streamId(): string | undefined {\n return this._streamId;\n }\n}\n",
|
|
7
7
|
"import { createHmac, timingSafeEqual } from \"crypto\";\nimport { SaynaValidationError } from \"./errors\";\nimport type { WebhookSIPOutput } from \"./types\";\n\n/**\n * Minimum required secret length in characters for security.\n * @internal\n */\nconst MIN_SECRET_LENGTH = 16;\n\n/**\n * Maximum allowed time difference in seconds for replay protection.\n * Webhooks with timestamps outside this window will be rejected.\n * @internal\n */\nconst TIMESTAMP_TOLERANCE_SECONDS = 300; // 5 minutes\n\n/**\n * Receives and verifies cryptographically signed webhooks from Sayna SIP service.\n *\n * This class handles the secure verification of webhook signatures using HMAC-SHA256,\n * validates timestamp freshness to prevent replay attacks, and parses the webhook\n * payload into a strongly-typed WebhookSIPOutput object.\n *\n * ## Security Features\n *\n * - **HMAC-SHA256 Signature Verification**: Ensures webhook authenticity\n * - **Constant-Time Comparison**: Prevents timing attack vulnerabilities\n * - **Replay Protection**: 5-minute timestamp window prevents replay attacks\n * - **Strict Validation**: Comprehensive checks on all required fields\n *\n * ## Usage\n *\n * ### Basic Example\n *\n * ```typescript\n * import { WebhookReceiver } from \"@sayna-ai/node-sdk\";\n *\n * // Initialize with secret (or uses SAYNA_WEBHOOK_SECRET env variable)\n * const receiver = new WebhookReceiver(\"your-secret-key-min-16-chars\");\n *\n * // In your Express route handler\n * app.post('/webhook', express.json({ verify: (req, res, buf) => {\n * req.rawBody = buf.toString('utf8');\n * }}), (req, res) => {\n * try {\n * const webhook = receiver.receive(req.headers, req.rawBody);\n *\n * console.log('Valid webhook received:');\n * console.log(' From:', webhook.from_phone_number);\n * console.log(' To:', webhook.to_phone_number);\n * console.log(' Room:', webhook.room.name);\n * console.log(' SIP Host:', webhook.sip_host);\n * console.log(' Participant:', webhook.participant.identity);\n *\n * res.status(200).json({ received: true });\n * } catch (error) {\n * console.error('Webhook verification failed:', error.message);\n * res.status(401).json({ error: 'Invalid signature' });\n * }\n * });\n * ```\n *\n * ### With Environment Variable\n *\n * ```typescript\n * // Set environment variable\n * process.env.SAYNA_WEBHOOK_SECRET = \"your-secret-key\";\n *\n * // Receiver automatically uses env variable\n * const receiver = new WebhookReceiver();\n * ```\n *\n * ### Fastify Example\n *\n * ```typescript\n * import Fastify from 'fastify';\n * import { WebhookReceiver } from \"@sayna-ai/node-sdk\";\n *\n * const fastify = Fastify();\n * const receiver = new WebhookReceiver();\n *\n * fastify.post('/webhook', {\n * config: {\n * rawBody: true\n * }\n * }, async (request, reply) => {\n * try {\n * const webhook = receiver.receive(\n * request.headers,\n * request.rawBody\n * );\n *\n * // Process webhook...\n *\n * return { received: true };\n * } catch (error) {\n * reply.code(401);\n * return { error: error.message };\n * }\n * });\n * ```\n *\n * ## Important Notes\n *\n * - **Raw Body Required**: You MUST pass the raw request body string, not the parsed JSON object.\n * The signature is computed over the exact bytes received, so any formatting changes will\n * cause verification to fail.\n *\n * - **Case-Insensitive Headers**: Header names are case-insensitive in HTTP. This class handles\n * both `X-Sayna-Signature` and `x-sayna-signature` correctly.\n *\n * - **Secret Security**: Never commit secrets to version control. Use environment variables\n * or a secret management system.\n *\n * @see WebhookSIPOutput\n */\nexport class WebhookReceiver {\n private readonly secret: string;\n\n /**\n * Creates a new webhook receiver with the specified signing secret.\n *\n * @param secret - HMAC signing secret (min 16 chars, 32+ recommended).\n * If not provided, uses SAYNA_WEBHOOK_SECRET environment variable.\n *\n * @throws {SaynaValidationError} If secret is missing or too short\n *\n * @example\n * ```typescript\n * // Explicit secret\n * const receiver = new WebhookReceiver(\"my-secret-key-at-least-16-chars\");\n *\n * // From environment variable\n * const receiver = new WebhookReceiver();\n * ```\n */\n constructor(secret?: string) {\n const effectiveSecret = secret ?? process.env.SAYNA_WEBHOOK_SECRET;\n\n if (!effectiveSecret) {\n throw new SaynaValidationError(\n \"Webhook secret is required. Provide it as a constructor parameter or set SAYNA_WEBHOOK_SECRET environment variable.\"\n );\n }\n\n const trimmedSecret = effectiveSecret.trim();\n\n if (trimmedSecret.length < MIN_SECRET_LENGTH) {\n throw new SaynaValidationError(\n `Webhook secret must be at least ${MIN_SECRET_LENGTH} characters long. ` +\n `Received ${trimmedSecret.length} characters. ` +\n `Generate a secure secret with: openssl rand -hex 32`\n );\n }\n\n this.secret = trimmedSecret;\n }\n\n /**\n * Verifies and parses an incoming SIP webhook from Sayna.\n *\n * This method performs the following security checks:\n * 1. Validates presence of required headers\n * 2. Verifies timestamp is within acceptable window (prevents replay attacks)\n * 3. Computes HMAC-SHA256 signature over canonical string\n * 4. Performs constant-time comparison to prevent timing attacks\n * 5. Parses and validates the webhook payload structure\n *\n * @param headers - HTTP request headers (case-insensitive)\n * @param body - Raw request body as string (not parsed JSON)\n *\n * @returns Parsed and validated webhook payload\n *\n * @throws {SaynaValidationError} If signature verification fails or payload is invalid\n *\n * @example\n * ```typescript\n * const receiver = new WebhookReceiver(\"your-secret\");\n *\n * // Express example\n * app.post('/webhook', express.json({ verify: (req, res, buf) => {\n * req.rawBody = buf.toString();\n * }}), (req, res) => {\n * const webhook = receiver.receive(req.headers, req.rawBody);\n * // webhook is now a validated WebhookSIPOutput object\n * });\n * ```\n */\n receive(\n headers: Record<string, string | string[] | undefined>,\n body: string\n ): WebhookSIPOutput {\n // Normalize headers to lowercase for case-insensitive lookup\n const normalizedHeaders = this.normalizeHeaders(headers);\n\n // Extract required headers\n const signature = this.getRequiredHeader(\n normalizedHeaders,\n \"x-sayna-signature\"\n );\n const timestamp = this.getRequiredHeader(\n normalizedHeaders,\n \"x-sayna-timestamp\"\n );\n const eventId = this.getRequiredHeader(\n normalizedHeaders,\n \"x-sayna-event-id\"\n );\n\n // Parse and validate signature format\n if (!signature.startsWith(\"v1=\")) {\n throw new SaynaValidationError(\n \"Invalid signature format. Expected 'v1=<hex>' but got: \" +\n signature.substring(0, 10) +\n \"...\"\n );\n }\n const signatureHex = signature.substring(3);\n\n // Validate signature is valid hex (64 chars for SHA256)\n if (!/^[0-9a-f]{64}$/i.test(signatureHex)) {\n throw new SaynaValidationError(\n \"Invalid signature: must be 64 hex characters (HMAC-SHA256)\"\n );\n }\n\n // Validate and check timestamp\n this.validateTimestamp(timestamp);\n\n // Build canonical string for signature verification\n const canonical = `v1:${timestamp}:${eventId}:${body}`;\n\n // Compute expected signature\n const hmac = createHmac(\"sha256\", this.secret);\n hmac.update(canonical, \"utf8\");\n const expectedSignature = hmac.digest(\"hex\");\n\n // Constant-time comparison to prevent timing attacks\n if (!this.constantTimeEqual(signatureHex, expectedSignature)) {\n throw new SaynaValidationError(\n \"Signature verification failed. The webhook may have been tampered with or the secret is incorrect.\"\n );\n }\n\n // Parse and validate the webhook payload\n return this.parseAndValidatePayload(body);\n }\n\n /**\n * Normalizes HTTP headers to lowercase for case-insensitive access.\n * Handles both single string values and arrays of strings.\n *\n * @internal\n */\n private normalizeHeaders(\n headers: Record<string, string | string[] | undefined>\n ): Record<string, string> {\n const normalized: Record<string, string> = {};\n\n for (const [key, value] of Object.entries(headers)) {\n if (value !== undefined) {\n // Handle array values (take first element)\n const stringValue = Array.isArray(value) ? value[0] : value;\n if (stringValue) {\n normalized[key.toLowerCase()] = stringValue;\n }\n }\n }\n\n return normalized;\n }\n\n /**\n * Retrieves a required header value or throws a validation error.\n *\n * @internal\n */\n private getRequiredHeader(\n headers: Record<string, string>,\n name: string\n ): string {\n const value = headers[name.toLowerCase()];\n\n if (!value) {\n throw new SaynaValidationError(`Missing required header: ${name}`);\n }\n\n return value;\n }\n\n /**\n * Validates the timestamp is within the acceptable window.\n *\n * @internal\n */\n private validateTimestamp(timestampStr: string): void {\n // Parse timestamp\n const timestamp = Number(timestampStr);\n\n if (isNaN(timestamp)) {\n throw new SaynaValidationError(\n `Invalid timestamp format: expected Unix seconds but got '${timestampStr}'`\n );\n }\n\n // Check if timestamp is within acceptable range\n const now = Math.floor(Date.now() / 1000);\n const diff = Math.abs(now - timestamp);\n\n if (diff > TIMESTAMP_TOLERANCE_SECONDS) {\n throw new SaynaValidationError(\n `Timestamp outside replay protection window. ` +\n `Difference: ${diff} seconds (max allowed: ${TIMESTAMP_TOLERANCE_SECONDS}). ` +\n `This webhook may be a replay attack or there may be significant clock skew.`\n );\n }\n }\n\n /**\n * Performs constant-time string comparison to prevent timing attacks.\n *\n * @internal\n */\n private constantTimeEqual(a: string, b: string): boolean {\n if (a.length !== b.length) {\n return false;\n }\n\n const bufA = Buffer.from(a, \"utf8\");\n const bufB = Buffer.from(b, \"utf8\");\n\n return timingSafeEqual(bufA, bufB);\n }\n\n /**\n * Parses and validates the webhook payload structure.\n *\n * @internal\n */\n private parseAndValidatePayload(body: string): WebhookSIPOutput {\n let payload: unknown;\n\n // Parse JSON\n try {\n payload = JSON.parse(body);\n } catch (error) {\n throw new SaynaValidationError(\n `Invalid JSON payload: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n\n // Validate payload is an object\n if (!payload || typeof payload !== \"object\" || Array.isArray(payload)) {\n throw new SaynaValidationError(\"Webhook payload must be a JSON object\");\n }\n\n const data = payload as Record<string, unknown>;\n\n // Validate required fields\n this.validateParticipant(data.participant);\n this.validateRoom(data.room);\n this.validateStringField(data, \"from_phone_number\", \"from_phone_number\");\n this.validateStringField(data, \"to_phone_number\", \"to_phone_number\");\n this.validateStringField(data, \"room_prefix\", \"room_prefix\");\n this.validateStringField(data, \"sip_host\", \"sip_host\");\n\n // TypeScript type assertion is safe here because we've validated all fields\n // We use double assertion through unknown to satisfy strict type checking\n return data as unknown as WebhookSIPOutput;\n }\n\n /**\n * Validates the participant object structure.\n *\n * @internal\n */\n private validateParticipant(participant: unknown): void {\n if (\n !participant ||\n typeof participant !== \"object\" ||\n Array.isArray(participant)\n ) {\n throw new SaynaValidationError(\n \"Webhook payload missing required field 'participant' (must be an object)\"\n );\n }\n\n const p = participant as Record<string, unknown>;\n\n this.validateStringField(p, \"identity\", \"participant.identity\");\n this.validateStringField(p, \"sid\", \"participant.sid\");\n\n // name is optional, but if present must be a string\n if (p.name !== undefined && typeof p.name !== \"string\") {\n throw new SaynaValidationError(\n \"Field 'participant.name' must be a string if present\"\n );\n }\n }\n\n /**\n * Validates the room object structure.\n *\n * @internal\n */\n private validateRoom(room: unknown): void {\n if (!room || typeof room !== \"object\" || Array.isArray(room)) {\n throw new SaynaValidationError(\n \"Webhook payload missing required field 'room' (must be an object)\"\n );\n }\n\n const r = room as Record<string, unknown>;\n\n this.validateStringField(r, \"name\", \"room.name\");\n this.validateStringField(r, \"sid\", \"room.sid\");\n }\n\n /**\n * Validates a required string field.\n *\n * @internal\n */\n private validateStringField(\n obj: Record<string, unknown>,\n field: string,\n displayName: string\n ): void {\n const value = obj[field];\n\n if (typeof value !== \"string\" || value.length === 0) {\n throw new SaynaValidationError(\n `Webhook payload missing required field '${displayName}' (must be a non-empty string)`\n );\n }\n }\n}\n",
|
|
8
8
|
"import { SaynaClient } from \"./sayna-client\";\nimport type { STTConfig, TTSConfig, LiveKitConfig } from \"./types\";\n\nexport * from \"./sayna-client\";\nexport * from \"./types\";\nexport * from \"./errors\";\nexport * from \"./webhook-receiver\";\n\n/**\n * Creates and connects a new SaynaClient instance.\n *\n * This is the recommended way to create a Sayna client. It handles both\n * instantiation and connection, returning a ready-to-use client.\n *\n * @param url - The Sayna server URL (e.g., \"https://api.sayna.ai\")\n * @param sttConfig - Speech-to-text configuration (required when withoutAudio=false)\n * @param ttsConfig - Text-to-speech configuration (required when withoutAudio=false)\n * @param livekitConfig - Optional LiveKit room configuration\n * @param withoutAudio - If true, disables audio streaming (default: false)\n * @param apiKey - Optional API key used to authorize HTTP and WebSocket calls (defaults to SAYNA_API_KEY env)\n *\n * @returns Promise that resolves to a connected SaynaClient\n *\n * @throws {SaynaValidationError} If parameters are invalid\n * @throws {SaynaConnectionError} If connection fails\n * @throws {SaynaServerError} If server returns an error during setup\n *\n * @example\n * ```typescript\n * import { saynaConnect } from \"@sayna/node-sdk\";\n *\n * const client = await saynaConnect(\n * \"https://api.sayna.ai\",\n * {\n * provider: \"deepgram\",\n * language: \"en-US\",\n * sample_rate: 16000,\n * channels: 1,\n * punctuation: true,\n * encoding: \"linear16\",\n * model: \"nova-2\"\n * },\n * {\n * provider: \"elevenlabs\",\n * voice_id: \"21m00Tcm4TlvDq8ikWAM\",\n * speaking_rate: 1.0,\n * audio_format: \"pcm\",\n * sample_rate: 16000,\n * connection_timeout: 5000,\n * request_timeout: 10000,\n * model: \"eleven_turbo_v2\",\n * pronunciations: []\n * }\n * );\n *\n * // Register event handlers\n * client.registerOnSttResult((result) => {\n * console.log(\"Transcription:\", result.transcript);\n * });\n *\n * // Send text to be spoken\n * await client.speak(\"Hello, world!\");\n *\n * // Clean up\n * await client.disconnect();\n * ```\n */\nexport async function saynaConnect(\n url: string,\n sttConfig?: STTConfig,\n ttsConfig?: TTSConfig,\n livekitConfig?: LiveKitConfig,\n withoutAudio: boolean = false,\n apiKey?: string\n): Promise<SaynaClient> {\n const client = new SaynaClient(\n url,\n sttConfig,\n ttsConfig,\n livekitConfig,\n withoutAudio,\n apiKey\n );\n await client.connect();\n return client;\n}\n"
|
|
9
9
|
],
|
|
10
|
-
"mappings": ";AAGO,MAAM,mBAAmB,MAAM;AAAA,EACpC,WAAW,CAAC,SAAiB;AAAA,IAC3B,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,OAAO,eAAe,MAAM,WAAW,SAAS;AAAA;AAEpD;AAAA;AAKO,MAAM,+BAA+B,WAAW;AAAA,EACrD,WAAW,CAAC,UAAkB,oCAAoC;AAAA,IAChE,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,OAAO,eAAe,MAAM,uBAAuB,SAAS;AAAA;AAEhE;AAAA;AAKO,MAAM,2BAA2B,WAAW;AAAA,EACjD,WAAW,CACT,UAAkB,mFAClB;AAAA,IACA,MAAM,OAAO;AAAA,IACb,KAAK,OAAO;AAAA,IACZ,OAAO,eAAe,MAAM,mBAAmB,SAAS;AAAA;AAE5D;AAAA;AAKO,MAAM,6BAA6B,WAA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AAAA,MACA,MAAM,IAAI,qBACR,0EACF;AAAA,IACF;AAAA,IAEA,MAAM,IAAI;AAAA,IAEV,KAAK,oBAAoB,GAAG,YAAY,sBAAsB;AAAA,IAC9D,KAAK,oBAAoB,GAAG,OAAO,iBAAiB;AAAA,IAGpD,IAAI,EAAE,SAAS,aAAa,OAAO,EAAE,SAAS,UAAU;AAAA,MACtD,MAAM,IAAI,qBACR,sDACF;AAAA,IACF;AAAA;AAAA,EAQM,YAAY,CAAC,MAAqB;AAAA,IACxC,IAAI,CAAC,QAAQ,OAAO,SAAS,YAAY,MAAM,QAAQ,IAAI,GAAG;AAAA,MAC5D,MAAM,IAAI,qBACR,mEACF;AAAA,IACF;AAAA,IAEA,MAAM,IAAI;AAAA,IAEV,KAAK,oBAAoB,GAAG,QAAQ,WAAW;AAAA,IAC/C,KAAK,oBAAoB,GAAG,OAAO,UAAU;AAAA;AAAA,EAQvC,mBAAmB,CACzB,KACA,OACA,aACM;AAAA,IACN,MAAM,QAAQ,IAAI;AAAA,IAElB,IAAI,OAAO,UAAU,YAAY,MAAM,WAAW,GAAG;AAAA,MACnD,MAAM,IAAI,qBACR,2CAA2C,2CAC7C;AAAA,IACF;AAAA;AAEJ;;;AClXA,eAAsB,YAAY,CAChC,KACA,WACA,WACA,eACA,eAAwB,OACxB,QACsB;AAAA,EACtB,MAAM,SAAS,IAAI,YACjB,KACA,WACA,WACA,eACA,cACA,MACF;AAAA,EACA,MAAM,OAAO,QAAQ;AAAA,EACrB,OAAO;AAAA;",
|
|
11
|
+
"debugId": "15E631B45E4A4D4464756E2164756E21",
|
|
12
12
|
"names": []
|
|
13
13
|
}
|
package/dist/sayna-client.d.ts
CHANGED
|
@@ -116,7 +116,7 @@ export declare class SaynaClient {
|
|
|
116
116
|
* @param responseType - Expected response type: "json" or "arrayBuffer"
|
|
117
117
|
* @returns Promise resolving to the parsed response
|
|
118
118
|
* @throws {SaynaConnectionError} If the network request fails
|
|
119
|
-
* @throws {SaynaServerError} If the server returns an error response
|
|
119
|
+
* @throws {SaynaServerError} If the server returns an error response (includes status and endpoint)
|
|
120
120
|
*/
|
|
121
121
|
private fetchFromSayna;
|
|
122
122
|
/**
|
|
@@ -280,13 +280,17 @@ export declare class SaynaClient {
|
|
|
280
280
|
/**
|
|
281
281
|
* Issues a LiveKit access token for a participant.
|
|
282
282
|
*
|
|
283
|
-
*
|
|
283
|
+
* Room names are used as-is; the SDK does not rewrite or prefix them. When authentication
|
|
284
|
+
* is enabled, this endpoint creates the room if missing and sets room ownership metadata.
|
|
285
|
+
*
|
|
286
|
+
* @param roomName - LiveKit room to join or create. Provide the clean room name without any prefix.
|
|
284
287
|
* @param participantName - Display name assigned to the participant
|
|
285
288
|
* @param participantIdentity - Unique identifier for the participant
|
|
286
289
|
* @returns Promise that resolves with the LiveKit token and connection details
|
|
287
290
|
* @throws {SaynaValidationError} If any parameter is empty
|
|
288
291
|
* @throws {SaynaConnectionError} If the request fails
|
|
289
|
-
* @throws {SaynaServerError} If server returns an error
|
|
292
|
+
* @throws {SaynaServerError} If server returns an error. A 403 status indicates the room
|
|
293
|
+
* is owned by another tenant; do not retry with a modified room name.
|
|
290
294
|
*
|
|
291
295
|
* @example
|
|
292
296
|
* ```typescript
|
|
@@ -301,12 +305,13 @@ export declare class SaynaClient {
|
|
|
301
305
|
*/
|
|
302
306
|
getLiveKitToken(roomName: string, participantName: string, participantIdentity: string): Promise<LiveKitTokenResponse>;
|
|
303
307
|
/**
|
|
304
|
-
* Lists
|
|
308
|
+
* Lists LiveKit rooms accessible to the authenticated context.
|
|
305
309
|
*
|
|
306
|
-
* Room
|
|
307
|
-
*
|
|
310
|
+
* Room listings are scoped server-side based on authentication. When authentication is
|
|
311
|
+
* enabled, this endpoint may return fewer rooms than before (only those you have access to).
|
|
312
|
+
* Room names are not modified by the SDK.
|
|
308
313
|
*
|
|
309
|
-
* @returns Promise that resolves with the list of rooms
|
|
314
|
+
* @returns Promise that resolves with the list of accessible rooms
|
|
310
315
|
* @throws {SaynaConnectionError} If the request fails
|
|
311
316
|
* @throws {SaynaServerError} If server returns an error (e.g., LiveKit not configured)
|
|
312
317
|
*
|
|
@@ -322,14 +327,15 @@ export declare class SaynaClient {
|
|
|
322
327
|
/**
|
|
323
328
|
* Retrieves detailed information about a specific LiveKit room including participants.
|
|
324
329
|
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
330
|
+
* Room names are used as-is; the SDK does not rewrite or prefix them. Access is
|
|
331
|
+
* enforced server-side based on room ownership metadata.
|
|
327
332
|
*
|
|
328
|
-
* @param roomName - Name of the room to retrieve
|
|
333
|
+
* @param roomName - Name of the room to retrieve
|
|
329
334
|
* @returns Promise that resolves with detailed room information including participants
|
|
330
335
|
* @throws {SaynaValidationError} If roomName is empty
|
|
331
336
|
* @throws {SaynaConnectionError} If the request fails
|
|
332
|
-
* @throws {SaynaServerError} If server returns an error
|
|
337
|
+
* @throws {SaynaServerError} If server returns an error. A 404 status can mean "not found"
|
|
338
|
+
* or "not accessible" when room ownership is enforced.
|
|
333
339
|
*
|
|
334
340
|
* @example
|
|
335
341
|
* ```typescript
|
|
@@ -345,18 +351,19 @@ export declare class SaynaClient {
|
|
|
345
351
|
/**
|
|
346
352
|
* Removes a participant from a LiveKit room, forcibly disconnecting them.
|
|
347
353
|
*
|
|
348
|
-
*
|
|
349
|
-
*
|
|
354
|
+
* Room names are used as-is; the SDK does not rewrite or prefix them. Access is
|
|
355
|
+
* enforced server-side based on room ownership metadata.
|
|
350
356
|
*
|
|
351
357
|
* **Important:** This does not invalidate the participant's token. To prevent
|
|
352
358
|
* rejoining, use short-lived tokens and avoid issuing new tokens to removed participants.
|
|
353
359
|
*
|
|
354
|
-
* @param roomName - Name of the room where the participant is connected
|
|
360
|
+
* @param roomName - Name of the room where the participant is connected
|
|
355
361
|
* @param participantIdentity - The identity of the participant to remove
|
|
356
362
|
* @returns Promise that resolves with the removal confirmation
|
|
357
363
|
* @throws {SaynaValidationError} If roomName or participantIdentity is empty
|
|
358
364
|
* @throws {SaynaConnectionError} If the request fails
|
|
359
|
-
* @throws {SaynaServerError} If server returns an error
|
|
365
|
+
* @throws {SaynaServerError} If server returns an error. A 404 status can mean "not found"
|
|
366
|
+
* or "not accessible" when room ownership is enforced.
|
|
360
367
|
*
|
|
361
368
|
* @example
|
|
362
369
|
* ```typescript
|
|
@@ -370,17 +377,18 @@ export declare class SaynaClient {
|
|
|
370
377
|
/**
|
|
371
378
|
* Mutes or unmutes a participant's published track in a LiveKit room.
|
|
372
379
|
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
380
|
+
* Room names are used as-is; the SDK does not rewrite or prefix them. Access is
|
|
381
|
+
* enforced server-side based on room ownership metadata.
|
|
375
382
|
*
|
|
376
|
-
* @param roomName - Name of the room where the participant is connected
|
|
383
|
+
* @param roomName - Name of the room where the participant is connected
|
|
377
384
|
* @param participantIdentity - The identity of the participant whose track to mute
|
|
378
385
|
* @param trackSid - The session ID of the track to mute/unmute
|
|
379
386
|
* @param muted - True to mute, false to unmute
|
|
380
387
|
* @returns Promise that resolves with the mute operation result
|
|
381
388
|
* @throws {SaynaValidationError} If roomName, participantIdentity, or trackSid is empty, or if muted is not a boolean
|
|
382
389
|
* @throws {SaynaConnectionError} If the request fails
|
|
383
|
-
* @throws {SaynaServerError} If server returns an error
|
|
390
|
+
* @throws {SaynaServerError} If server returns an error. A 404 status can mean "not found"
|
|
391
|
+
* or "not accessible" when room ownership is enforced.
|
|
384
392
|
*
|
|
385
393
|
* @example
|
|
386
394
|
* ```typescript
|
|
@@ -410,21 +418,22 @@ export declare class SaynaClient {
|
|
|
410
418
|
* when you need to transfer a SIP call from outside the active WebSocket session,
|
|
411
419
|
* or when you want to specify a particular room and participant explicitly.
|
|
412
420
|
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
421
|
+
* Room names are used as-is; the SDK does not rewrite or prefix them. Access is
|
|
422
|
+
* enforced server-side based on room ownership metadata.
|
|
415
423
|
*
|
|
416
424
|
* **Important Notes:**
|
|
417
425
|
* - Only SIP participants can be transferred
|
|
418
426
|
* - A successful response indicates the transfer has been **initiated**, not necessarily completed
|
|
419
427
|
* - The actual transfer may take several seconds
|
|
420
428
|
*
|
|
421
|
-
* @param roomName - Name of the room where the SIP participant is connected
|
|
429
|
+
* @param roomName - Name of the room where the SIP participant is connected
|
|
422
430
|
* @param participantIdentity - The identity of the SIP participant to transfer
|
|
423
431
|
* @param transferTo - The phone number to transfer to (international, national, or extension format)
|
|
424
432
|
* @returns Promise that resolves with the transfer status
|
|
425
433
|
* @throws {SaynaValidationError} If roomName, participantIdentity, or transferTo is empty
|
|
426
434
|
* @throws {SaynaConnectionError} If the request fails
|
|
427
|
-
* @throws {SaynaServerError} If server returns an error
|
|
435
|
+
* @throws {SaynaServerError} If server returns an error. A 404 status can mean "not found"
|
|
436
|
+
* or "not accessible" when room ownership is enforced.
|
|
428
437
|
*
|
|
429
438
|
* @example
|
|
430
439
|
* ```typescript
|
|
@@ -490,8 +499,8 @@ export declare class SaynaClient {
|
|
|
490
499
|
* @example
|
|
491
500
|
* ```typescript
|
|
492
501
|
* const response = await client.setSipHooks([
|
|
493
|
-
* { host: "example.com", url: "https://webhook.example.com/events" },
|
|
494
|
-
* { host: "another.com", url: "https://webhook.another.com/events" }
|
|
502
|
+
* { host: "example.com", url: "https://webhook.example.com/events", auth_id: "tenant-123" },
|
|
503
|
+
* { host: "another.com", url: "https://webhook.another.com/events", auth_id: "" } // Empty for unauthenticated mode
|
|
495
504
|
* ]);
|
|
496
505
|
* console.log("Total hooks configured:", response.hooks.length);
|
|
497
506
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sayna-client.d.ts","sourceRoot":"","sources":["../src/sayna-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,aAAa,EAKb,gBAAgB,EAChB,YAAY,EACZ,uBAAuB,EAGvB,YAAY,EACZ,WAAW,EACX,cAAc,EACd,cAAc,EACd,oBAAoB,EACp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Ac,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAuBhE;;OAEG;IACH,IAAI,KAAK,IAAI,OAAO,CAEnB;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,GAAG,SAAS,CAExC;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,GAAG,SAAS,CAEnC;IAED;;OAEG;IACH,IAAI,wBAAwB,IAAI,MAAM,GAAG,SAAS,CAEjD;IAED;;OAEG;IACH,IAAI,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAE7C;IAED;;;;OAIG;IACH,IAAI,QAAQ,IAAI,MAAM,GAAG,SAAS,CAEjC;CACF"}
|
package/dist/types.d.ts
CHANGED
|
@@ -343,6 +343,16 @@ export interface SipHook {
|
|
|
343
343
|
host: string;
|
|
344
344
|
/** HTTPS URL to forward webhook events to */
|
|
345
345
|
url: string;
|
|
346
|
+
/**
|
|
347
|
+
* Tenant identifier for this hook. This value is written to LiveKit room metadata
|
|
348
|
+
* for inbound SIP calls routed through this hook.
|
|
349
|
+
*
|
|
350
|
+
* - When AUTH_REQUIRED=true on the server: `auth_id` must be non-empty.
|
|
351
|
+
* - When AUTH_REQUIRED=false: `auth_id` may be an empty string (unauthenticated mode).
|
|
352
|
+
*
|
|
353
|
+
* Treat this as an opaque string; pass it through unchanged without client-side interpretation.
|
|
354
|
+
*/
|
|
355
|
+
auth_id: string;
|
|
346
356
|
}
|
|
347
357
|
/**
|
|
348
358
|
* Response from the GET /sip/hooks and POST /sip/hooks endpoints.
|
|
@@ -368,9 +378,12 @@ export interface DeleteSipHooksRequest {
|
|
|
368
378
|
/**
|
|
369
379
|
* Summary information for a LiveKit room.
|
|
370
380
|
* Returned by the GET /livekit/rooms endpoint.
|
|
381
|
+
*
|
|
382
|
+
* Room listings are scoped to the authenticated context; this endpoint may return
|
|
383
|
+
* fewer rooms than before when authentication is enabled.
|
|
371
384
|
*/
|
|
372
385
|
export interface LiveKitRoomSummary {
|
|
373
|
-
/** The
|
|
386
|
+
/** The room name. Room names are not rewritten by the SDK; scoping is enforced server-side. */
|
|
374
387
|
name: string;
|
|
375
388
|
/** Number of current participants in the room */
|
|
376
389
|
num_participants: number;
|
|
@@ -379,10 +392,12 @@ export interface LiveKitRoomSummary {
|
|
|
379
392
|
}
|
|
380
393
|
/**
|
|
381
394
|
* Response from the GET /livekit/rooms endpoint.
|
|
382
|
-
*
|
|
395
|
+
*
|
|
396
|
+
* Room listings are scoped to the authenticated context. When authentication is enabled,
|
|
397
|
+
* this endpoint returns only rooms accessible to the current credentials.
|
|
383
398
|
*/
|
|
384
399
|
export interface LiveKitRoomsResponse {
|
|
385
|
-
/** List of rooms
|
|
400
|
+
/** List of rooms accessible to the authenticated client */
|
|
386
401
|
rooms: LiveKitRoomSummary[];
|
|
387
402
|
}
|
|
388
403
|
/**
|
|
@@ -420,11 +435,14 @@ export interface LiveKitParticipantInfo {
|
|
|
420
435
|
/**
|
|
421
436
|
* Detailed information about a LiveKit room including participants.
|
|
422
437
|
* Returned by the GET /livekit/rooms/{room_name} endpoint.
|
|
438
|
+
*
|
|
439
|
+
* A 404 response can mean "not found" or "not accessible" when room ownership
|
|
440
|
+
* is enforced server-side.
|
|
423
441
|
*/
|
|
424
442
|
export interface LiveKitRoomDetails {
|
|
425
443
|
/** Unique session ID for the room (generated by LiveKit) */
|
|
426
444
|
sid: string;
|
|
427
|
-
/** The
|
|
445
|
+
/** The room name. Room names are not rewritten by the SDK; scoping is enforced server-side. */
|
|
428
446
|
name: string;
|
|
429
447
|
/** Number of current participants in the room */
|
|
430
448
|
num_participants: number;
|
|
@@ -432,7 +450,10 @@ export interface LiveKitRoomDetails {
|
|
|
432
450
|
max_participants: number;
|
|
433
451
|
/** Room creation time (Unix timestamp in seconds) */
|
|
434
452
|
creation_time: number;
|
|
435
|
-
/**
|
|
453
|
+
/**
|
|
454
|
+
* Room metadata as an opaque JSON string. Do not parse or rely on this for access decisions;
|
|
455
|
+
* access is enforced server-side.
|
|
456
|
+
*/
|
|
436
457
|
metadata: string;
|
|
437
458
|
/** Whether a recording is currently active */
|
|
438
459
|
active_recording: boolean;
|
|
@@ -442,9 +463,11 @@ export interface LiveKitRoomDetails {
|
|
|
442
463
|
/**
|
|
443
464
|
* Request body for the DELETE /livekit/participant endpoint.
|
|
444
465
|
* Used to remove a participant from a LiveKit room.
|
|
466
|
+
*
|
|
467
|
+
* A 404 response can mean "not found" or "not accessible" when room ownership is enforced.
|
|
445
468
|
*/
|
|
446
469
|
export interface RemoveLiveKitParticipantRequest {
|
|
447
|
-
/** The LiveKit room name where the participant is connected
|
|
470
|
+
/** The LiveKit room name where the participant is connected. Room names are clean; the SDK does not rewrite them. */
|
|
448
471
|
room_name: string;
|
|
449
472
|
/** The identity of the participant to remove */
|
|
450
473
|
participant_identity: string;
|
|
@@ -456,7 +479,7 @@ export interface RemoveLiveKitParticipantRequest {
|
|
|
456
479
|
export interface RemoveLiveKitParticipantResponse {
|
|
457
480
|
/** Status of the removal operation (e.g., "removed") */
|
|
458
481
|
status: string;
|
|
459
|
-
/** The
|
|
482
|
+
/** The room name where the participant was removed */
|
|
460
483
|
room_name: string;
|
|
461
484
|
/** The identity of the removed participant */
|
|
462
485
|
participant_identity: string;
|
|
@@ -464,9 +487,11 @@ export interface RemoveLiveKitParticipantResponse {
|
|
|
464
487
|
/**
|
|
465
488
|
* Request body for the POST /livekit/participant/mute endpoint.
|
|
466
489
|
* Used to mute or unmute a participant's track in a LiveKit room.
|
|
490
|
+
*
|
|
491
|
+
* A 404 response can mean "not found" or "not accessible" when room ownership is enforced.
|
|
467
492
|
*/
|
|
468
493
|
export interface MuteLiveKitParticipantRequest {
|
|
469
|
-
/** The LiveKit room name where the participant is connected
|
|
494
|
+
/** The LiveKit room name where the participant is connected. Room names are clean; the SDK does not rewrite them. */
|
|
470
495
|
room_name: string;
|
|
471
496
|
/** The identity of the participant whose track to mute */
|
|
472
497
|
participant_identity: string;
|
|
@@ -480,7 +505,7 @@ export interface MuteLiveKitParticipantRequest {
|
|
|
480
505
|
* Confirms the mute/unmute operation.
|
|
481
506
|
*/
|
|
482
507
|
export interface MuteLiveKitParticipantResponse {
|
|
483
|
-
/** The
|
|
508
|
+
/** The room name where the operation was performed */
|
|
484
509
|
room_name: string;
|
|
485
510
|
/** The identity of the participant */
|
|
486
511
|
participant_identity: string;
|
|
@@ -498,9 +523,11 @@ export type SipTransferStatus = "initiated" | "completed";
|
|
|
498
523
|
/**
|
|
499
524
|
* Request body for the POST /sip/transfer endpoint.
|
|
500
525
|
* Used to initiate a SIP call transfer for a participant in a LiveKit room.
|
|
526
|
+
*
|
|
527
|
+
* A 404 response can mean "not found" or "not accessible" when room ownership is enforced.
|
|
501
528
|
*/
|
|
502
529
|
export interface SipTransferRequest {
|
|
503
|
-
/** The LiveKit room name where the SIP participant is connected
|
|
530
|
+
/** The LiveKit room name where the SIP participant is connected. Room names are clean; the SDK does not rewrite them. */
|
|
504
531
|
room_name: string;
|
|
505
532
|
/** The identity of the SIP participant to transfer */
|
|
506
533
|
participant_identity: string;
|
|
@@ -514,7 +541,7 @@ export interface SipTransferRequest {
|
|
|
514
541
|
export interface SipTransferResponse {
|
|
515
542
|
/** Status of the transfer request ("initiated" or "completed") */
|
|
516
543
|
status: SipTransferStatus;
|
|
517
|
-
/** The
|
|
544
|
+
/** The room name where the transfer was initiated */
|
|
518
545
|
room_name: string;
|
|
519
546
|
/** The identity of the participant being transferred */
|
|
520
547
|
participant_identity: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,2DAA2D;IAC3D,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,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