agora-agents 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.js +8 -16
  3. package/dist/cjs/agentkit/Agent.js +6 -5
  4. package/dist/cjs/agentkit/AgentSession.js +2 -0
  5. package/dist/cjs/agentkit/avatar-types.d.ts +18 -5
  6. package/dist/cjs/agentkit/avatar-types.js +31 -3
  7. package/dist/cjs/agentkit/index.d.ts +9 -9
  8. package/dist/cjs/agentkit/index.js +8 -3
  9. package/dist/cjs/agentkit/types.d.ts +22 -5
  10. package/dist/cjs/agentkit/vendors/avatar.d.ts +3 -3
  11. package/dist/cjs/agentkit/vendors/avatar.js +3 -3
  12. package/dist/cjs/agentkit/vendors/base.d.ts +4 -0
  13. package/dist/cjs/agentkit/vendors/base.js +4 -0
  14. package/dist/cjs/agentkit/vendors/cn.d.ts +19 -1
  15. package/dist/cjs/agentkit/vendors/cn.js +23 -3
  16. package/dist/cjs/agentkit/vendors/llm.d.ts +1 -1
  17. package/dist/cjs/agentkit/vendors/llm.js +13 -3
  18. package/dist/cjs/agentkit/vendors/mllm.js +2 -2
  19. package/dist/cjs/agentkit/vendors/stt.d.ts +31 -0
  20. package/dist/cjs/agentkit/vendors/stt.js +26 -1
  21. package/dist/cjs/agentkit/vendors/tts.d.ts +60 -0
  22. package/dist/cjs/agentkit/vendors/tts.js +42 -1
  23. package/dist/cjs/api/resources/agents/client/requests/ListAgentsRequest.d.ts +2 -3
  24. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +18 -1
  25. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +8 -0
  26. package/dist/cjs/api/resources/agents/types/GetHistoryAgentsResponse.d.ts +6 -0
  27. package/dist/cjs/api/resources/agents/types/index.d.ts +0 -1
  28. package/dist/cjs/api/resources/agents/types/index.js +0 -1
  29. package/dist/cjs/api/types/Asr.d.ts +4 -1
  30. package/dist/cjs/api/types/GenericTts.d.ts +13 -0
  31. package/dist/cjs/api/types/GenericTts.js +3 -0
  32. package/dist/cjs/api/types/GenericTtsParams.d.ts +21 -0
  33. package/dist/cjs/api/types/GenericTtsParams.js +3 -0
  34. package/dist/cjs/api/types/Llm.d.ts +24 -1
  35. package/dist/cjs/api/types/Llm.js +8 -0
  36. package/dist/cjs/api/types/SpatiusAvatarParams.d.ts +23 -0
  37. package/dist/cjs/api/types/SpatiusAvatarParams.js +3 -0
  38. package/dist/cjs/api/types/Tts.d.ts +7 -1
  39. package/dist/cjs/api/types/XAiAsr.d.ts +10 -0
  40. package/dist/cjs/api/types/XAiAsr.js +3 -0
  41. package/dist/cjs/api/types/XAiAsrParams.d.ts +15 -0
  42. package/dist/cjs/api/types/XAiAsrParams.js +3 -0
  43. package/dist/cjs/api/types/XAiTts.d.ts +9 -0
  44. package/dist/cjs/api/types/XAiTts.js +3 -0
  45. package/dist/cjs/api/types/XAiTtsParams.d.ts +15 -0
  46. package/dist/cjs/api/types/XAiTtsParams.js +3 -0
  47. package/dist/cjs/api/types/index.d.ts +7 -0
  48. package/dist/cjs/api/types/index.js +7 -0
  49. package/dist/cjs/core/base64.js +1 -5
  50. package/dist/cjs/index.d.ts +2 -2
  51. package/dist/cjs/index.js +8 -3
  52. package/dist/cjs/version.d.ts +1 -1
  53. package/dist/cjs/version.js +1 -1
  54. package/dist/esm/BaseClient.mjs +2 -2
  55. package/dist/esm/Client.mjs +8 -16
  56. package/dist/esm/agentkit/Agent.mjs +6 -5
  57. package/dist/esm/agentkit/AgentSession.mjs +3 -1
  58. package/dist/esm/agentkit/avatar-types.d.mts +18 -5
  59. package/dist/esm/agentkit/avatar-types.mjs +30 -3
  60. package/dist/esm/agentkit/index.d.mts +9 -9
  61. package/dist/esm/agentkit/index.mjs +4 -4
  62. package/dist/esm/agentkit/types.d.mts +22 -5
  63. package/dist/esm/agentkit/vendors/avatar.d.mts +3 -3
  64. package/dist/esm/agentkit/vendors/avatar.mjs +3 -3
  65. package/dist/esm/agentkit/vendors/base.d.mts +4 -0
  66. package/dist/esm/agentkit/vendors/base.mjs +4 -0
  67. package/dist/esm/agentkit/vendors/cn.d.mts +19 -1
  68. package/dist/esm/agentkit/vendors/cn.mjs +21 -2
  69. package/dist/esm/agentkit/vendors/llm.d.mts +1 -1
  70. package/dist/esm/agentkit/vendors/llm.mjs +13 -3
  71. package/dist/esm/agentkit/vendors/mllm.mjs +2 -2
  72. package/dist/esm/agentkit/vendors/stt.d.mts +31 -0
  73. package/dist/esm/agentkit/vendors/stt.mjs +24 -0
  74. package/dist/esm/agentkit/vendors/tts.d.mts +60 -0
  75. package/dist/esm/agentkit/vendors/tts.mjs +39 -0
  76. package/dist/esm/api/resources/agents/client/requests/ListAgentsRequest.d.mts +2 -3
  77. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +18 -1
  78. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +8 -0
  79. package/dist/esm/api/resources/agents/types/GetHistoryAgentsResponse.d.mts +6 -0
  80. package/dist/esm/api/resources/agents/types/index.d.mts +0 -1
  81. package/dist/esm/api/resources/agents/types/index.mjs +0 -1
  82. package/dist/esm/api/types/Asr.d.mts +4 -1
  83. package/dist/esm/api/types/GenericTts.d.mts +13 -0
  84. package/dist/esm/api/types/GenericTts.mjs +2 -0
  85. package/dist/esm/api/types/GenericTtsParams.d.mts +21 -0
  86. package/dist/esm/api/types/GenericTtsParams.mjs +2 -0
  87. package/dist/esm/api/types/Llm.d.mts +24 -1
  88. package/dist/esm/api/types/Llm.mjs +8 -0
  89. package/dist/esm/api/types/SpatiusAvatarParams.d.mts +23 -0
  90. package/dist/esm/api/types/SpatiusAvatarParams.mjs +2 -0
  91. package/dist/esm/api/types/Tts.d.mts +7 -1
  92. package/dist/esm/api/types/XAiAsr.d.mts +10 -0
  93. package/dist/esm/api/types/XAiAsr.mjs +2 -0
  94. package/dist/esm/api/types/XAiAsrParams.d.mts +15 -0
  95. package/dist/esm/api/types/XAiAsrParams.mjs +2 -0
  96. package/dist/esm/api/types/XAiTts.d.mts +9 -0
  97. package/dist/esm/api/types/XAiTts.mjs +2 -0
  98. package/dist/esm/api/types/XAiTtsParams.d.mts +15 -0
  99. package/dist/esm/api/types/XAiTtsParams.mjs +2 -0
  100. package/dist/esm/api/types/index.d.mts +7 -0
  101. package/dist/esm/api/types/index.mjs +7 -0
  102. package/dist/esm/core/base64.mjs +1 -5
  103. package/dist/esm/index.d.mts +2 -2
  104. package/dist/esm/index.mjs +4 -4
  105. package/dist/esm/version.d.mts +1 -1
  106. package/dist/esm/version.mjs +1 -1
  107. package/package.json +1 -1
  108. package/dist/cjs/api/resources/agents/types/ListAgentsRequestState.d.ts +0 -10
  109. package/dist/cjs/api/resources/agents/types/ListAgentsRequestState.js +0 -13
  110. package/dist/esm/api/resources/agents/types/ListAgentsRequestState.d.mts +0 -10
  111. package/dist/esm/api/resources/agents/types/ListAgentsRequestState.mjs +0 -10
@@ -60,7 +60,7 @@ class OpenAI extends base_js_1.BaseLLM {
60
60
  const { apiKey, model, url, maxHistory, temperature, topP, maxTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
61
61
  return Object.assign(Object.assign({ url: url !== null && url !== void 0 ? url : "https://api.openai.com/v1/chat/completions" }, (apiKey && { api_key: apiKey })), {
62
62
  // model is the default; params entries extend it; named fields win.
63
- params: Object.assign(Object.assign(Object.assign(Object.assign({ model }, params), (temperature !== undefined && { temperature })), (topP !== undefined && { top_p: topP })), (maxTokens !== undefined && { max_tokens: maxTokens })), headers, max_history: maxHistory, system_messages: systemMessages, greeting_message: greetingMessage, failure_message: failureMessage, input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"], output_modalities: this.outputModalities, style: "openai", vendor: this.vendor, greeting_configs: this.greetingConfigs, template_variables: this.templateVariables, mcp_servers: this.mcpServers });
63
+ params: Object.assign(Object.assign(Object.assign(Object.assign({ model }, params), (temperature !== undefined && { temperature })), (topP !== undefined && { top_p: topP })), (maxTokens !== undefined && { max_tokens: maxTokens })), headers, max_history: maxHistory, system_messages: systemMessages, greeting_message: greetingMessage, greeting_audio_url: this.greetingAudioUrl, failure_message: failureMessage, input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"], output_modalities: this.outputModalities, style: "openai", vendor: this.vendor, greeting_configs: this.greetingConfigs, template_variables: this.templateVariables, mcp_servers: this.mcpServers });
64
64
  }
65
65
  }
66
66
  exports.OpenAI = OpenAI;
@@ -104,6 +104,7 @@ class AzureOpenAI extends base_js_1.BaseLLM {
104
104
  max_history: maxHistory,
105
105
  system_messages: systemMessages,
106
106
  greeting_message: greetingMessage,
107
+ greeting_audio_url: this.greetingAudioUrl,
107
108
  failure_message: failureMessage,
108
109
  input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
109
110
  output_modalities: this.outputModalities,
@@ -150,6 +151,7 @@ class Anthropic extends base_js_1.BaseLLM {
150
151
  max_history: maxHistory,
151
152
  system_messages: systemMessages,
152
153
  greeting_message: greetingMessage,
154
+ greeting_audio_url: this.greetingAudioUrl,
153
155
  failure_message: failureMessage,
154
156
  input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
155
157
  output_modalities: this.outputModalities,
@@ -178,19 +180,23 @@ class Gemini extends base_js_1.BaseLLM {
178
180
  super(options);
179
181
  requireString(options.apiKey, "apiKey", "Gemini");
180
182
  requireString(options.model, "model", "Gemini");
183
+ if (options.url !== undefined) {
184
+ requireString(options.url, "url", "Gemini");
185
+ }
181
186
  this.options = options;
182
187
  }
183
188
  toConfig() {
184
189
  const { apiKey, model, url, maxHistory, temperature, topP, topK, maxOutputTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
190
+ const defaultUrl = `https://generativelanguage.googleapis.com/v1beta/models/${model}:streamGenerateContent?alt=sse&key=${encodeURIComponent(apiKey)}`;
185
191
  return {
186
- url: url !== null && url !== void 0 ? url : "https://generativelanguage.googleapis.com/v1beta/models",
187
- api_key: apiKey,
192
+ url: url !== null && url !== void 0 ? url : defaultUrl,
188
193
  // model is the default; params entries extend it; named fields win.
189
194
  params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ model }, params), (temperature !== undefined && { temperature })), (topP !== undefined && { top_p: topP })), (topK !== undefined && { top_k: topK })), (maxOutputTokens !== undefined && { max_output_tokens: maxOutputTokens })),
190
195
  headers,
191
196
  max_history: maxHistory,
192
197
  system_messages: systemMessages,
193
198
  greeting_message: greetingMessage,
199
+ greeting_audio_url: this.greetingAudioUrl,
194
200
  failure_message: failureMessage,
195
201
  input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
196
202
  output_modalities: this.outputModalities,
@@ -213,6 +219,7 @@ function openAIStyleConfig(options, vendor) {
213
219
  max_history: options.maxHistory,
214
220
  system_messages: options.systemMessages,
215
221
  greeting_message: options.greetingMessage,
222
+ greeting_audio_url: options.greetingAudioUrl,
216
223
  failure_message: options.failureMessage,
217
224
  input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
218
225
  output_modalities: options.outputModalities,
@@ -270,6 +277,7 @@ class VertexAILLM extends base_js_1.BaseLLM {
270
277
  max_history: o.maxHistory,
271
278
  system_messages: o.systemMessages,
272
279
  greeting_message: o.greetingMessage,
280
+ greeting_audio_url: this.greetingAudioUrl,
273
281
  failure_message: o.failureMessage,
274
282
  input_modalities: (_b = o.inputModalities) !== null && _b !== void 0 ? _b : ["text"],
275
283
  output_modalities: this.outputModalities,
@@ -305,6 +313,7 @@ class AmazonBedrock extends base_js_1.BaseLLM {
305
313
  max_history: o.maxHistory,
306
314
  system_messages: o.systemMessages,
307
315
  greeting_message: o.greetingMessage,
316
+ greeting_audio_url: this.greetingAudioUrl,
308
317
  failure_message: o.failureMessage,
309
318
  input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
310
319
  output_modalities: this.outputModalities,
@@ -336,6 +345,7 @@ class Dify extends base_js_1.BaseLLM {
336
345
  max_history: o.maxHistory,
337
346
  system_messages: o.systemMessages,
338
347
  greeting_message: o.greetingMessage,
348
+ greeting_audio_url: this.greetingAudioUrl,
339
349
  failure_message: o.failureMessage,
340
350
  input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
341
351
  output_modalities: this.outputModalities,
@@ -66,7 +66,7 @@ class GeminiLive extends base_js_1.BaseMLLM {
66
66
  }
67
67
  toConfig() {
68
68
  const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
69
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "gemini", api_key: apiKey }, (url && { url })), { params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }), (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
69
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "gemini", api_key: apiKey, url: url !== null && url !== void 0 ? url : "", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }, (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
70
70
  }
71
71
  }
72
72
  exports.GeminiLive = GeminiLive;
@@ -95,7 +95,7 @@ class VertexAI extends base_js_1.BaseMLLM {
95
95
  }
96
96
  toConfig() {
97
97
  const { model, url, projectId, location, adcCredentialsString, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
98
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "vertexai" }, (url && { url })), { project_id: projectId, location, adc_credentials_string: adcCredentialsString, params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }), (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
98
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ vendor: "vertexai", url: url !== null && url !== void 0 ? url : "", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { model, project_id: projectId, location, adc_credentials_string: adcCredentialsString }), (instructions && { instructions })), (voice && { voice })), (affectiveDialog !== undefined && { affective_dialog: affectiveDialog })), (proactiveAudio !== undefined && { proactive_audio: proactiveAudio })), (transcribeAgent !== undefined && { transcribe_agent: transcribeAgent })), (transcribeUser !== undefined && { transcribe_user: transcribeUser })), (httpOptions && { http_options: httpOptions })) }, (messages && { messages })), (greetingMessage && { greeting_message: greetingMessage })), (inputModalities && { input_modalities: inputModalities })), (outputModalities && { output_modalities: outputModalities })), (this.options.failureMessage && { failure_message: this.options.failureMessage })), (turnDetection && { turn_detection: turnDetection }));
99
99
  }
100
100
  }
101
101
  exports.VertexAI = VertexAI;
@@ -285,4 +285,35 @@ export declare class SarvamSTT extends BaseSTT {
285
285
  constructor(options: SarvamSTTOptions);
286
286
  toConfig(): SttConfig;
287
287
  }
288
+ /**
289
+ * Constructor options for xAI STT.
290
+ */
291
+ export interface XAiSTTOptions {
292
+ /** xAI API key */
293
+ apiKey: string;
294
+ /** Language code for speech recognition */
295
+ language?: string;
296
+ /** WebSocket endpoint URL for the xAI streaming STT API */
297
+ baseUrl?: string;
298
+ /** Audio sample rate in Hz */
299
+ sampleRate?: number;
300
+ /** Additional vendor-specific parameters */
301
+ additionalParams?: Record<string, unknown>;
302
+ }
303
+ /**
304
+ * xAI STT vendor.
305
+ *
306
+ * @example
307
+ * ```typescript
308
+ * const stt = new XAiSTT({
309
+ * apiKey: process.env.XAI_API_KEY,
310
+ * language: 'en',
311
+ * });
312
+ * ```
313
+ */
314
+ export declare class XAiSTT extends BaseSTT {
315
+ private readonly options;
316
+ constructor(options: XAiSTTOptions);
317
+ toConfig(): SttConfig;
318
+ }
288
319
  export {};
@@ -3,7 +3,7 @@
3
3
  * Type-safe STT (Speech-to-Text) vendor classes.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = void 0;
6
+ exports.XAiSTT = exports.SarvamSTT = exports.AresSTT = exports.AssemblyAISTT = exports.AmazonSTT = exports.GoogleSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.DeepgramSTT = exports.SpeechmaticsSTT = void 0;
7
7
  const presets_js_1 = require("../presets.js");
8
8
  const base_js_1 = require("./base.js");
9
9
  function _requireString(value, field, vendor) {
@@ -249,3 +249,28 @@ class SarvamSTT extends base_js_1.BaseSTT {
249
249
  }
250
250
  }
251
251
  exports.SarvamSTT = SarvamSTT;
252
+ /**
253
+ * xAI STT vendor.
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * const stt = new XAiSTT({
258
+ * apiKey: process.env.XAI_API_KEY,
259
+ * language: 'en',
260
+ * });
261
+ * ```
262
+ */
263
+ class XAiSTT extends base_js_1.BaseSTT {
264
+ constructor(options) {
265
+ super();
266
+ this.options = options;
267
+ }
268
+ toConfig() {
269
+ const { apiKey, language, baseUrl, sampleRate, additionalParams } = this.options;
270
+ return {
271
+ vendor: "xai",
272
+ params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (baseUrl !== undefined && { base_url: baseUrl })), (sampleRate !== undefined && { sample_rate: sampleRate })), (language !== undefined && { language })),
273
+ };
274
+ }
275
+ }
276
+ exports.XAiSTT = XAiSTT;
@@ -501,4 +501,64 @@ export declare class MurfTTS extends BaseTTS {
501
501
  constructor(options: MurfTTSOptions);
502
502
  toConfig(): TtsConfig;
503
503
  }
504
+ /**
505
+ * Constructor options for Generic OpenAI-compatible TTS.
506
+ */
507
+ export interface GenericTTSOptions {
508
+ /** Callback address of the generic TTS service */
509
+ url: string;
510
+ /** Custom headers to include in requests to the generic TTS service */
511
+ headers: Record<string, string>;
512
+ /** API key for the generic TTS service */
513
+ apiKey?: string;
514
+ /** TTS model name */
515
+ model: string;
516
+ /** Voice name */
517
+ voice: string;
518
+ /** Speech rate */
519
+ speed?: number;
520
+ /** Output audio sample rate in Hz */
521
+ sampleRate?: number;
522
+ /** Output audio format. ConvoAI currently supports `pcm` only. */
523
+ responseFormat?: "pcm";
524
+ /** Additional voice style control instruction */
525
+ instruction?: string;
526
+ /** Additional vendor-specific parameters */
527
+ additionalParams?: Record<string, unknown>;
528
+ /** Skip patterns for bracketed content */
529
+ skipPatterns?: number[];
530
+ }
531
+ /**
532
+ * Generic OpenAI-compatible TTS vendor.
533
+ */
534
+ export declare class GenericTTS extends BaseTTS {
535
+ private readonly options;
536
+ constructor(options: GenericTTSOptions);
537
+ toConfig(): TtsConfig;
538
+ }
539
+ /**
540
+ * Constructor options for xAI TTS.
541
+ */
542
+ export interface XAiTTSOptions {
543
+ /** xAI API key */
544
+ apiKey: string;
545
+ /** BCP-47 language code for speech synthesis */
546
+ language: string;
547
+ /** xAI voice identifier */
548
+ voiceId?: string;
549
+ /** Audio sample rate in Hz */
550
+ sampleRate?: number;
551
+ /** Additional vendor-specific parameters */
552
+ additionalParams?: Record<string, unknown>;
553
+ /** Skip patterns for bracketed content */
554
+ skipPatterns?: number[];
555
+ }
556
+ /**
557
+ * xAI TTS vendor.
558
+ */
559
+ export declare class XAiTTS extends BaseTTS {
560
+ private readonly options;
561
+ constructor(options: XAiTTSOptions);
562
+ toConfig(): TtsConfig;
563
+ }
504
564
  export {};
@@ -3,7 +3,7 @@
3
3
  * Type-safe TTS (Text-to-Speech) vendor classes.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
6
+ exports.XAiTTS = exports.GenericTTS = exports.MurfTTS = exports.SarvamTTS = exports.MiniMaxTTS = exports.FishAudioTTS = exports.RimeTTS = exports.HumeAITTS = exports.DeepgramTTS = exports.AmazonTTS = exports.GoogleTTS = exports.CartesiaTTS = exports.OpenAITTS = exports.MicrosoftTTS = exports.ElevenLabsTTS = void 0;
7
7
  const presets_js_1 = require("../presets.js");
8
8
  const base_js_1 = require("./base.js");
9
9
  function requireString(value, field, vendor) {
@@ -11,6 +11,11 @@ function requireString(value, field, vendor) {
11
11
  throw new Error(`${vendor} requires ${field}`);
12
12
  }
13
13
  }
14
+ function requireRecord(value, field, vendor) {
15
+ if (value == null || typeof value !== "object" || Array.isArray(value)) {
16
+ throw new Error(`${vendor} requires ${field}`);
17
+ }
18
+ }
14
19
  function isOpenAITtsManagedModel(model) {
15
20
  return model === undefined || presets_js_1.OpenAITtsPresetModels.includes(model.trim().toLowerCase());
16
21
  }
@@ -344,3 +349,39 @@ class MurfTTS extends base_js_1.BaseTTS {
344
349
  }
345
350
  }
346
351
  exports.MurfTTS = MurfTTS;
352
+ /**
353
+ * Generic OpenAI-compatible TTS vendor.
354
+ */
355
+ class GenericTTS extends base_js_1.BaseTTS {
356
+ constructor(options) {
357
+ super();
358
+ requireString(options.url, "url", "GenericTTS");
359
+ requireRecord(options.headers, "headers", "GenericTTS");
360
+ requireString(options.model, "model", "GenericTTS");
361
+ requireString(options.voice, "voice", "GenericTTS");
362
+ this.options = options;
363
+ }
364
+ toConfig() {
365
+ const { url, headers, apiKey, model, voice, speed, sampleRate, responseFormat, instruction, additionalParams, skipPatterns, } = this.options;
366
+ return Object.assign({ vendor: "generic", url,
367
+ headers, params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey !== undefined && { api_key: apiKey })), { model,
368
+ voice }), (speed !== undefined && { speed })), (sampleRate !== undefined && { sample_rate: sampleRate })), (responseFormat !== undefined && { response_format: responseFormat })), (instruction !== undefined && { instruction })) }, (skipPatterns && { skip_patterns: skipPatterns }));
369
+ }
370
+ }
371
+ exports.GenericTTS = GenericTTS;
372
+ /**
373
+ * xAI TTS vendor.
374
+ */
375
+ class XAiTTS extends base_js_1.BaseTTS {
376
+ constructor(options) {
377
+ super();
378
+ requireString(options.apiKey, "apiKey", "XAiTTS");
379
+ requireString(options.language, "language", "XAiTTS");
380
+ this.options = options;
381
+ }
382
+ toConfig() {
383
+ const { apiKey, language, voiceId, sampleRate, additionalParams, skipPatterns } = this.options;
384
+ return Object.assign({ vendor: "xai", params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey, language }), (voiceId !== undefined && { voice_id: voiceId })), (sampleRate !== undefined && { sample_rate: sampleRate })) }, (skipPatterns && { skip_patterns: skipPatterns }));
385
+ }
386
+ }
387
+ exports.XAiTTS = XAiTTS;
@@ -1,4 +1,3 @@
1
- import type * as Agora from "../../../../index.js";
2
1
  /**
3
2
  * @example
4
3
  * {
@@ -15,7 +14,7 @@ export interface ListAgentsRequest {
15
14
  /** The end timestamp (in seconds) for the query. Default is current time. */
16
15
  to_time?: number;
17
16
  /**
18
- * The agent state to filter by. Only one state can be specified per query:
17
+ * The agent state filter. You can specify one or more agent states as a comma-separated list in a single request, for example `state=0,1,2`:
19
18
  * - `IDLE` (0): Agent is idle.
20
19
  * - `STARTING` (1): The agent is being started.
21
20
  * - `RUNNING` (2): The agent is running.
@@ -23,7 +22,7 @@ export interface ListAgentsRequest {
23
22
  * - `STOPPED` (4): The agent has exited.
24
23
  * - `FAILED` (6): The agent failed to execute.
25
24
  */
26
- state?: Agora.ListAgentsRequestState;
25
+ state?: string;
27
26
  /** The maximum number of entries returned per page. */
28
27
  limit?: number;
29
28
  /** The paging cursor, indicating the starting position (`agent_id`) of the next page of results. */
@@ -85,7 +85,7 @@ export declare namespace StartAgentsRequest {
85
85
  * - `false`: Both agent and subscriber user IDs must be integers.
86
86
  */
87
87
  enable_string_uid?: boolean;
88
- /** Sets the timeout after all the users specified in `remote_rtc_uids` are detected to have left the channel. When the timeout value is exceeded, the agent automatically stops and exits the channel. A value of `0` means that the agent does not exit until it is stopped manually. */
88
+ /** Sets the timeout after all the users specified in `remote_rtc_uids` are detected to have left the channel. When the timeout value is exceeded, the agent automatically stops and exits the channel. A value of `0` disables exit due to channel idle timeout only; it does not allow the agent to run indefinitely. Regardless of this value, the maximum runtime of a single task is 72 hours, after which the agent automatically exits. */
89
89
  idle_timeout?: number;
90
90
  /** Regional access restriction configuration. Use this to limit which Agora servers the Conversational AI Engine can access based on geographic regions. */
91
91
  geofence?: Properties.Geofence;
@@ -173,6 +173,7 @@ export declare namespace StartAgentsRequest {
173
173
  * - `anam`: Anam (Beta)
174
174
  * - `generic`: Generic (Beta)
175
175
  * - `sensetime`: SenseTime Avatar
176
+ * - `spatius`: Spatius Avatar
176
177
  */
177
178
  vendor?: Avatar.Vendor;
178
179
  /** The configuration parameters for the avatar vendor. See [AI Avatar Overview](https://docs.agora.io/en/conversational-ai/models/avatar/overview) for details. */
@@ -186,6 +187,7 @@ export declare namespace StartAgentsRequest {
186
187
  * - `anam`: Anam (Beta)
187
188
  * - `generic`: Generic (Beta)
188
189
  * - `sensetime`: SenseTime Avatar
190
+ * - `spatius`: Spatius Avatar
189
191
  */
190
192
  const Vendor: {
191
193
  readonly Akool: "akool";
@@ -199,6 +201,9 @@ export declare namespace StartAgentsRequest {
199
201
  /**
200
202
  * SenseTime Avatar */
201
203
  readonly Sensetime: "sensetime";
204
+ /**
205
+ * Spatius Avatar */
206
+ readonly Spatius: "spatius";
202
207
  /**
203
208
  * Deprecated: HeyGen has renamed to LiveAvatar. Use `liveavatar` instead. */
204
209
  readonly Heygen: "heygen";
@@ -279,6 +284,7 @@ export declare namespace StartAgentsRequest {
279
284
  * - `vad`: Based on VAD (Voice Activity Detection). Uses audio signal detection.
280
285
  * - `keywords`: Deprecated. Use `interruption.mode = "keywords"` instead.
281
286
  * - `disabled`: Deprecated. Use `interruption.enable = false` with `interruption.disabled_config.strategy` to configure the handling strategy.
287
+ * - `manual`: The client explicitly submits the start of the user turn through signaling.
282
288
  */
283
289
  mode: StartOfSpeech.Mode;
284
290
  /** VAD configuration. Used when `mode` is `vad`. */
@@ -294,11 +300,13 @@ export declare namespace StartAgentsRequest {
294
300
  * - `vad`: Based on VAD (Voice Activity Detection). Uses audio signal detection.
295
301
  * - `keywords`: Deprecated. Use `interruption.mode = "keywords"` instead.
296
302
  * - `disabled`: Deprecated. Use `interruption.enable = false` with `interruption.disabled_config.strategy` to configure the handling strategy.
303
+ * - `manual`: The client explicitly submits the start of the user turn through signaling.
297
304
  */
298
305
  const Mode: {
299
306
  readonly Vad: "vad";
300
307
  readonly Keywords: "keywords";
301
308
  readonly Disabled: "disabled";
309
+ readonly Manual: "manual";
302
310
  };
303
311
  type Mode = (typeof Mode)[keyof typeof Mode];
304
312
  /**
@@ -349,6 +357,7 @@ export declare namespace StartAgentsRequest {
349
357
  * End of speech detection mode:
350
358
  * - `vad`: Based on VAD (Voice Activity Detection). Detects silence duration.
351
359
  * - `semantic`: Based on semantic triggering. Uses semantic understanding to determine when conversation ends.
360
+ * - `manual`: The client explicitly submits the end of the user turn through signaling.
352
361
  */
353
362
  mode?: EndOfSpeech.Mode;
354
363
  /** VAD configuration. Used when `mode` is `vad`. */
@@ -361,10 +370,12 @@ export declare namespace StartAgentsRequest {
361
370
  * End of speech detection mode:
362
371
  * - `vad`: Based on VAD (Voice Activity Detection). Detects silence duration.
363
372
  * - `semantic`: Based on semantic triggering. Uses semantic understanding to determine when conversation ends.
373
+ * - `manual`: The client explicitly submits the end of the user turn through signaling.
364
374
  */
365
375
  const Mode: {
366
376
  readonly Vad: "vad";
367
377
  readonly Semantic: "semantic";
378
+ readonly Manual: "manual";
368
379
  };
369
380
  type Mode = (typeof Mode)[keyof typeof Mode];
370
381
  /**
@@ -655,6 +666,12 @@ export declare namespace StartAgentsRequest {
655
666
  * - `aiserver`: Optimized for interactions between the user and the conversational AI agent in terms of latency and network resilience.
656
667
  */
657
668
  audio_scenario?: Parameters.AudioScenario;
669
+ /**
670
+ * Whether to disable data retention for the current session:
671
+ * - `false`: Default. Session data retention remains enabled.
672
+ * - `true`: Disables session data retention. When disabled, historical session content cannot be used for troubleshooting, effectiveness review, or agent optimization.
673
+ */
674
+ opt_out?: boolean;
658
675
  }
659
676
  namespace Parameters {
660
677
  /**
@@ -35,6 +35,7 @@ var StartAgentsRequest;
35
35
  * - `anam`: Anam (Beta)
36
36
  * - `generic`: Generic (Beta)
37
37
  * - `sensetime`: SenseTime Avatar
38
+ * - `spatius`: Spatius Avatar
38
39
  */
39
40
  Avatar.Vendor = {
40
41
  Akool: "akool",
@@ -48,6 +49,9 @@ var StartAgentsRequest;
48
49
  /**
49
50
  * SenseTime Avatar */
50
51
  Sensetime: "sensetime",
52
+ /**
53
+ * Spatius Avatar */
54
+ Spatius: "spatius",
51
55
  /**
52
56
  * Deprecated: HeyGen has renamed to LiveAvatar. Use `liveavatar` instead. */
53
57
  Heygen: "heygen",
@@ -64,11 +68,13 @@ var StartAgentsRequest;
64
68
  * - `vad`: Based on VAD (Voice Activity Detection). Uses audio signal detection.
65
69
  * - `keywords`: Deprecated. Use `interruption.mode = "keywords"` instead.
66
70
  * - `disabled`: Deprecated. Use `interruption.enable = false` with `interruption.disabled_config.strategy` to configure the handling strategy.
71
+ * - `manual`: The client explicitly submits the start of the user turn through signaling.
67
72
  */
68
73
  StartOfSpeech.Mode = {
69
74
  Vad: "vad",
70
75
  Keywords: "keywords",
71
76
  Disabled: "disabled",
77
+ Manual: "manual",
72
78
  };
73
79
  let DisabledConfig;
74
80
  (function (DisabledConfig) {
@@ -89,10 +95,12 @@ var StartAgentsRequest;
89
95
  * End of speech detection mode:
90
96
  * - `vad`: Based on VAD (Voice Activity Detection). Detects silence duration.
91
97
  * - `semantic`: Based on semantic triggering. Uses semantic understanding to determine when conversation ends.
98
+ * - `manual`: The client explicitly submits the end of the user turn through signaling.
92
99
  */
93
100
  EndOfSpeech.Mode = {
94
101
  Vad: "vad",
95
102
  Semantic: "semantic",
103
+ Manual: "manual",
96
104
  };
97
105
  })(EndOfSpeech = Config.EndOfSpeech || (Config.EndOfSpeech = {}));
98
106
  })(Config = TurnDetection.Config || (TurnDetection.Config = {}));
@@ -20,6 +20,12 @@ export declare namespace GetHistoryAgentsResponse {
20
20
  role?: Item.Role;
21
21
  /** Message content. */
22
22
  content?: string;
23
+ /** The start timestamp of the speech segment in milliseconds, relative to the beginning of the current session. Returned only when `llm.vendor='custom'`. */
24
+ speech_start_ms?: number;
25
+ /** The end timestamp of the speech segment in milliseconds, relative to the beginning of the current session. Returned only when `llm.vendor='custom'`. */
26
+ speech_end_ms?: number;
27
+ /** The total delay in milliseconds introduced by audio processing algorithms, including noise reduction, background voice suppression, and voiceprint locking, after audio is captured from the user's microphone. Use this value to align timestamps with cloud recording audio. Returned only when `llm.vendor='custom'`, `contents[].role='user'`, and actual voice input is present. */
28
+ speech_algorithmic_delay?: number;
23
29
  }
24
30
  namespace Item {
25
31
  /**
@@ -2,7 +2,6 @@ export * from "./GetAgentsResponse.js";
2
2
  export * from "./GetHistoryAgentsResponse.js";
3
3
  export * from "./GetTurnsAgentsResponse.js";
4
4
  export * from "./InterruptAgentsResponse.js";
5
- export * from "./ListAgentsRequestState.js";
6
5
  export * from "./ListAgentsResponse.js";
7
6
  export * from "./SpeakAgentsResponse.js";
8
7
  export * from "./StartAgentsResponse.js";
@@ -18,7 +18,6 @@ __exportStar(require("./GetAgentsResponse.js"), exports);
18
18
  __exportStar(require("./GetHistoryAgentsResponse.js"), exports);
19
19
  __exportStar(require("./GetTurnsAgentsResponse.js"), exports);
20
20
  __exportStar(require("./InterruptAgentsResponse.js"), exports);
21
- __exportStar(require("./ListAgentsRequestState.js"), exports);
22
21
  __exportStar(require("./ListAgentsResponse.js"), exports);
23
22
  __exportStar(require("./SpeakAgentsResponse.js"), exports);
24
23
  __exportStar(require("./StartAgentsResponse.js"), exports);
@@ -1,5 +1,5 @@
1
1
  import type * as Agora from "../index.js";
2
- export type Asr = Agora.Asr.Ares | Agora.Asr.Fengming | Agora.Asr.Tencent | Agora.Asr.Microsoft | Agora.Asr.Deepgram | Agora.Asr.Openai | Agora.Asr.Google | Agora.Asr.Amazon | Agora.Asr.Assemblyai | Agora.Asr.Speechmatics | Agora.Asr.Sarvam | Agora.Asr.Xfyun | Agora.Asr.XfyunBigmodel | Agora.Asr.XfyunDialect;
2
+ export type Asr = Agora.Asr.Ares | Agora.Asr.Fengming | Agora.Asr.Tencent | Agora.Asr.Microsoft | Agora.Asr.Deepgram | Agora.Asr.Openai | Agora.Asr.Google | Agora.Asr.Amazon | Agora.Asr.Assemblyai | Agora.Asr.Speechmatics | Agora.Asr.Sarvam | Agora.Asr.Xai | Agora.Asr.Xfyun | Agora.Asr.XfyunBigmodel | Agora.Asr.XfyunDialect;
3
3
  export declare namespace Asr {
4
4
  interface Ares extends Agora.AresAsr {
5
5
  vendor: "ares";
@@ -34,6 +34,9 @@ export declare namespace Asr {
34
34
  interface Sarvam extends Agora.SarvamAsr {
35
35
  vendor: "sarvam";
36
36
  }
37
+ interface Xai extends Agora.XAiAsr {
38
+ vendor: "xai";
39
+ }
37
40
  interface Xfyun extends Agora.XfyunAsr {
38
41
  vendor: "xfyun";
39
42
  }
@@ -0,0 +1,13 @@
1
+ import type * as Agora from "../index.js";
2
+ /**
3
+ * Generic OpenAI-compatible Text-to-Speech configuration.
4
+ */
5
+ export interface GenericTts {
6
+ /** Callback address of the generic TTS service. */
7
+ url: string;
8
+ /** Custom headers to include in requests to the generic TTS service. */
9
+ headers: Record<string, string>;
10
+ params: Agora.GenericTtsParams;
11
+ /** Controls whether the TTS module skips bracketed content when reading LLM response text. */
12
+ skip_patterns?: number[];
13
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Generic TTS configuration parameters.
3
+ */
4
+ export interface GenericTtsParams {
5
+ /** API key for the generic TTS service. */
6
+ api_key?: string;
7
+ /** TTS model name. */
8
+ model: string;
9
+ /** Voice name. */
10
+ voice: string;
11
+ /** Speech rate. */
12
+ speed?: number;
13
+ /** Output audio sample rate in Hz. */
14
+ sample_rate?: number;
15
+ /** Output audio format. ConvoAI currently supports `pcm` only. */
16
+ response_format?: "pcm";
17
+ /** Additional voice style control instruction. */
18
+ instruction?: string;
19
+ /** Accepts any additional properties */
20
+ [key: string]: any;
21
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -26,6 +26,8 @@ export interface Llm {
26
26
  output_modalities?: string[];
27
27
  /** Agent greeting. */
28
28
  greeting_message?: string;
29
+ /** Publicly accessible greeting audio URL. */
30
+ greeting_audio_url?: string;
29
31
  /** Prompt for agent activation failure. */
30
32
  failure_message?: string;
31
33
  /** LLM provider identifier. */
@@ -35,7 +37,7 @@ export interface Llm {
35
37
  /** Whether to handle empty Gemini responses. */
36
38
  ignore_empty?: boolean | null;
37
39
  /** Agent greeting broadcast configuration. */
38
- greeting_configs?: Record<string, unknown>;
40
+ greeting_configs?: Llm.GreetingConfigs;
39
41
  /** Template parameter configuration. */
40
42
  template_variables?: Record<string, string>;
41
43
  /** MCP server configuration. */
@@ -55,4 +57,25 @@ export declare namespace Llm {
55
57
  readonly Bedrock: "bedrock";
56
58
  };
57
59
  type Style = (typeof Style)[keyof typeof Style];
60
+ /**
61
+ * Agent greeting broadcast configuration.
62
+ */
63
+ interface GreetingConfigs {
64
+ /** Timeout in milliseconds for downloading greeting audio. */
65
+ audio_download_timeout_ms?: number | null;
66
+ /** Sample rate in Hz for PCM greeting audio. */
67
+ audio_pcm_sample_rate?: number | null;
68
+ /** Policy for handling ASR text during uninterruptible greeting playback. */
69
+ uninterruptible_asr_policy?: GreetingConfigs.UninterruptibleAsrPolicy | null;
70
+ /** Accepts any additional properties */
71
+ [key: string]: any;
72
+ }
73
+ namespace GreetingConfigs {
74
+ /** Policy for handling ASR text during uninterruptible greeting playback. */
75
+ const UninterruptibleAsrPolicy: {
76
+ readonly MergeReply: "merge_reply";
77
+ readonly Context: "context";
78
+ };
79
+ type UninterruptibleAsrPolicy = (typeof UninterruptibleAsrPolicy)[keyof typeof UninterruptibleAsrPolicy];
80
+ }
58
81
  }
@@ -12,4 +12,12 @@ var Llm;
12
12
  Dify: "dify",
13
13
  Bedrock: "bedrock",
14
14
  };
15
+ let GreetingConfigs;
16
+ (function (GreetingConfigs) {
17
+ /** Policy for handling ASR text during uninterruptible greeting playback. */
18
+ GreetingConfigs.UninterruptibleAsrPolicy = {
19
+ MergeReply: "merge_reply",
20
+ Context: "context",
21
+ };
22
+ })(GreetingConfigs = Llm.GreetingConfigs || (Llm.GreetingConfigs = {}));
15
23
  })(Llm || (exports.Llm = Llm = {}));
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Spatius Avatar configuration parameters.
3
+ */
4
+ export interface SpatiusAvatarParams {
5
+ /** Spatius API key. */
6
+ spatius_api_key: string;
7
+ /** Spatius application ID. */
8
+ spatius_app_id: string;
9
+ /** Spatius avatar ID. */
10
+ spatius_avatar_id: string;
11
+ /** Agora UID used by the avatar service. */
12
+ agora_uid: string;
13
+ /** RTC token generated for `agora_uid` in the target channel. */
14
+ agora_token?: string | null;
15
+ /** Spatius service region, for example `cn-beijing`. */
16
+ region?: string | null;
17
+ /** Audio sample rate in Hz. Recommended to match the TTS sample rate. */
18
+ sample_rate?: number | null;
19
+ /** Spatius session validity duration in minutes. Defaults to 30. */
20
+ session_expire_minutes?: number | null;
21
+ /** Accepts any additional properties */
22
+ [key: string]: any;
23
+ }