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
@@ -2,7 +2,7 @@
2
2
  * Clean type aliases for the Agora Conversational AI SDK.
3
3
  * These provide shorter, more intuitive names for the verbose Fern-generated types.
4
4
  */
5
- import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, Asr, AsrLanguage, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, HumeAiTtsParams as HumeAiTtsParamsType, HumeAiTts as HumeAiTtsType, ListAgentsResponse, Llm, MicrosoftTtsParams as MicrosoftTtsParamsType, MicrosoftTts as MicrosoftTtsType, MinimaxTtsParams as MinimaxTtsParamsType, MinimaxTts as MinimaxTtsType, Mllm, MllmTurnDetection, MllmTurnDetection as MllmTurnDetectionNS, MurfTtsParams as MurfTtsParamsType, MurfTts as MurfTtsType, OpenAiTtsParams as OpenAiTtsParamsType, OpenAiTts as OpenAiTtsType, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, SarvamTtsParams as SarvamTtsParamsType, SarvamTts as SarvamTtsType, SpeakAgentsRequest, StartAgentsRequest, Tts, UpdateAgentsRequest } from "../api/index.mjs";
5
+ import type { AgentThinkAgentManagementResponse, AmazonTtsParams as AmazonTtsParamsType, AmazonTts as AmazonTtsType, Asr, AsrLanguage, CartesiaTtsParams as CartesiaTtsParamsType, CartesiaTts as CartesiaTtsType, ElevenLabsTtsParams as ElevenLabsTtsParamsType, ElevenLabsTts as ElevenLabsTtsType, FishAudioTtsParams as FishAudioTtsParamsType, FishAudioTts as FishAudioTtsType, GenericTtsParams as GenericTtsParamsType, GenericTts as GenericTtsType, GetAgentsResponse, GetHistoryAgentsResponse, GetTurnsAgentsResponse, GoogleTtsParams as GoogleTtsParamsType, GoogleTts as GoogleTtsType, HumeAiTtsParams as HumeAiTtsParamsType, HumeAiTts as HumeAiTtsType, ListAgentsResponse, Llm, MicrosoftTtsParams as MicrosoftTtsParamsType, MicrosoftTts as MicrosoftTtsType, MinimaxTtsParams as MinimaxTtsParamsType, MinimaxTts as MinimaxTtsType, Mllm, MllmTurnDetection, MllmTurnDetection as MllmTurnDetectionNS, MurfTtsParams as MurfTtsParamsType, MurfTts as MurfTtsType, OpenAiTtsParams as OpenAiTtsParamsType, OpenAiTts as OpenAiTtsType, RimeTtsParams as RimeTtsParamsType, RimeTts as RimeTtsType, SarvamTtsParams as SarvamTtsParamsType, SarvamTts as SarvamTtsType, SpatiusAvatarParams as SpatiusAvatarParamsType, SpeakAgentsRequest, StartAgentsRequest, Tts, UpdateAgentsRequest, XAiAsrParams as XAiAsrParamsType, XAiAsr as XAiAsrType, XAiTtsParams as XAiTtsParamsType, XAiTts as XAiTtsType } from "../api/index.mjs";
6
6
  import type { AgentThinkAgentManagementRequest } from "../api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.mjs";
7
7
  import type { PresetInput } from "./presets.mjs";
8
8
  /** LLM request style (openai, gemini, anthropic, dify) */
@@ -68,6 +68,10 @@ export type SttConfig = {
68
68
  vendor: "sarvam";
69
69
  language?: TurnDetectionLanguage;
70
70
  params: SarvamAsrParams;
71
+ } | {
72
+ vendor: "xai";
73
+ language?: TurnDetectionLanguage;
74
+ params: XAiAsrParams;
71
75
  } | Asr;
72
76
  /** ASR configuration — alias for {@link SttConfig} (wire field: `asr`). */
73
77
  export type AsrConfig = SttConfig;
@@ -82,7 +86,7 @@ export type MllmVendor = Mllm.Vendor;
82
86
  /** Avatar configuration */
83
87
  export type AvatarConfig = StartAgentsRequest.Properties.Avatar;
84
88
  /** Avatar vendor (akool, liveavatar, anam, generic, deprecated heygen) */
85
- /** Wire avatar vendor identifier (e.g. `"liveavatar"`, `"sensetime"`). */
89
+ /** Wire avatar vendor identifier (e.g. `"liveavatar"`, `"sensetime"`, `"spatius"`). */
86
90
  export type AvatarWireVendor = StartAgentsRequest.Properties.Avatar.Vendor;
87
91
  /** BCP-47 language tag used by `turn_detection.language`. */
88
92
  export type TurnDetectionLanguage = AsrLanguage;
@@ -203,9 +207,9 @@ export type FillerWordsContentSelectionRule = StartAgentsRequest.Properties.Fill
203
207
  /** Custom business labels attached to the agent (returned in notification callbacks) */
204
208
  export type Labels = Record<string, string>;
205
209
  /** LLM greeting broadcast configuration (`llm.greeting_configs`) */
206
- export type LlmGreetingConfigs = Record<string, unknown>;
207
- /** Greeting broadcast mode: `"single_every"` | `"single_first"` */
208
- export type LlmGreetingConfigsMode = string;
210
+ export type LlmGreetingConfigs = Llm.GreetingConfigs;
211
+ /** Greeting broadcast ASR policy: `"merge_reply"` | `"context"` */
212
+ export type LlmGreetingConfigsMode = Llm.GreetingConfigs.UninterruptibleAsrPolicy;
209
213
  /** MCP server config item (`llm.mcp_servers[]`) */
210
214
  export type McpServersItem = Record<string, unknown>;
211
215
  /** Full agent configuration (alias for StartAgentsRequest.Properties) */
@@ -366,6 +370,8 @@ interface BaseLlmConfig {
366
370
  output_modalities?: string[];
367
371
  /** Agent greeting message */
368
372
  greeting_message?: string;
373
+ /** Publicly accessible greeting audio URL */
374
+ greeting_audio_url?: string;
369
375
  /** Failure message when LLM call fails */
370
376
  failure_message?: string;
371
377
  /** LLM provider (e.g., 'azure', 'custom') */
@@ -528,6 +534,12 @@ export interface SarvamAsrParams {
528
534
  /** Additional Sarvam-specific parameters */
529
535
  [key: string]: unknown;
530
536
  }
537
+ /**
538
+ * xAI STT parameters
539
+ * @see https://docs.agora.io/en/conversational-ai/models/asr/overview
540
+ */
541
+ export type XAiAsr = XAiAsrType;
542
+ export type XAiAsrParams = XAiAsrParamsType;
531
543
  export type MicrosoftTts = MicrosoftTtsType;
532
544
  export type MicrosoftTtsParams = MicrosoftTtsParamsType;
533
545
  export type ElevenLabsTts = ElevenLabsTtsType;
@@ -542,6 +554,8 @@ export type RimeTts = RimeTtsType;
542
554
  export type RimeTtsParams = RimeTtsParamsType;
543
555
  export type FishAudioTts = FishAudioTtsType;
544
556
  export type FishAudioTtsParams = FishAudioTtsParamsType;
557
+ export type GenericTts = GenericTtsType;
558
+ export type GenericTtsParams = GenericTtsParamsType;
545
559
  export type GoogleTts = GoogleTtsType;
546
560
  export type GoogleTtsParams = GoogleTtsParamsType;
547
561
  export type AmazonTts = AmazonTtsType;
@@ -552,4 +566,7 @@ export type MurfTts = MurfTtsType;
552
566
  export type MurfTtsParams = MurfTtsParamsType;
553
567
  export type SarvamTts = SarvamTtsType;
554
568
  export type SarvamTtsParams = SarvamTtsParamsType;
569
+ export type XAiTts = XAiTtsType;
570
+ export type XAiTtsParams = XAiTtsParamsType;
571
+ export type SpatiusAvatarParams = SpatiusAvatarParamsType;
555
572
  export {};
@@ -151,8 +151,8 @@ export declare class HeyGenAvatar extends BaseAvatar<HeyGenSampleRate> {
151
151
  export interface AnamAvatarOptions {
152
152
  /** Anam API key */
153
153
  apiKey: string;
154
- /** Anam persona ID */
155
- personaId?: string;
154
+ /** Anam avatar ID */
155
+ avatarId?: string;
156
156
  /** Enable avatar (default: true) */
157
157
  enable?: boolean;
158
158
  /** Additional vendor-specific parameters */
@@ -167,7 +167,7 @@ export interface AnamAvatarOptions {
167
167
  *
168
168
  * const avatar = new AnamAvatar({
169
169
  * apiKey: process.env.ANAM_API_KEY,
170
- * personaId: 'persona-id',
170
+ * avatarId: 'avatar-id',
171
171
  * });
172
172
  *
173
173
  * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
@@ -165,7 +165,7 @@ export class HeyGenAvatar extends BaseAvatar {
165
165
  *
166
166
  * const avatar = new AnamAvatar({
167
167
  * apiKey: process.env.ANAM_API_KEY,
168
- * personaId: 'persona-id',
168
+ * avatarId: 'avatar-id',
169
169
  * });
170
170
  *
171
171
  * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
@@ -189,11 +189,11 @@ export class AnamAvatar extends BaseAvatar {
189
189
  }
190
190
  }
191
191
  toConfig() {
192
- const { apiKey, personaId, enable = true, additionalParams } = this.options;
192
+ const { apiKey, avatarId, enable = true, additionalParams } = this.options;
193
193
  return {
194
194
  enable,
195
195
  vendor: "anam",
196
- params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (personaId && { persona_id: personaId })),
196
+ params: Object.assign(Object.assign(Object.assign({}, additionalParams), { api_key: apiKey }), (avatarId && { avatar_id: avatarId })),
197
197
  };
198
198
  }
199
199
  }
@@ -25,6 +25,8 @@ export interface BaseLlmOptions {
25
25
  * - `"single_first"`: Broadcasts a greeting only once to the first user.
26
26
  */
27
27
  greetingConfigs?: LlmGreetingConfigs;
28
+ /** Publicly accessible greeting audio URL played when the session starts. */
29
+ greetingAudioUrl?: string;
28
30
  /**
29
31
  * Key-value pairs injected into `system_messages`, `greeting_message`, and
30
32
  * `failure_message` via `{{variable_name}}` syntax. Useful for per-session
@@ -87,12 +89,14 @@ declare abstract class ScopedBaseLLM<TScope extends VendorScope> {
87
89
  readonly areaScope: TScope;
88
90
  private readonly _outputModalities?;
89
91
  private readonly _greetingConfigs?;
92
+ private readonly _greetingAudioUrl?;
90
93
  private readonly _templateVariables?;
91
94
  private readonly _vendor?;
92
95
  private readonly _mcpServers?;
93
96
  constructor(areaScope: TScope, options?: BaseLlmOptions);
94
97
  protected get outputModalities(): string[] | undefined;
95
98
  protected get greetingConfigs(): LlmGreetingConfigs | undefined;
99
+ protected get greetingAudioUrl(): string | undefined;
96
100
  protected get templateVariables(): Record<string, string> | undefined;
97
101
  protected get vendor(): string | undefined;
98
102
  /** MCP servers with transport defaulted to streamable_http (API requires it; only option). */
@@ -13,6 +13,7 @@ class ScopedBaseLLM {
13
13
  this.areaScope = areaScope;
14
14
  this._outputModalities = options === null || options === void 0 ? void 0 : options.outputModalities;
15
15
  this._greetingConfigs = options === null || options === void 0 ? void 0 : options.greetingConfigs;
16
+ this._greetingAudioUrl = options === null || options === void 0 ? void 0 : options.greetingAudioUrl;
16
17
  this._templateVariables = options === null || options === void 0 ? void 0 : options.templateVariables;
17
18
  this._vendor = options === null || options === void 0 ? void 0 : options.vendor;
18
19
  this._mcpServers = options === null || options === void 0 ? void 0 : options.mcpServers;
@@ -23,6 +24,9 @@ class ScopedBaseLLM {
23
24
  get greetingConfigs() {
24
25
  return this._greetingConfigs;
25
26
  }
27
+ get greetingAudioUrl() {
28
+ return this._greetingAudioUrl;
29
+ }
26
30
  get templateVariables() {
27
31
  return this._templateVariables;
28
32
  }
@@ -238,7 +238,7 @@ export interface SensetimeAvatarOptions {
238
238
  agoraToken?: string;
239
239
  appId: string;
240
240
  appKey: string;
241
- sceneList: Record<string, unknown>[];
241
+ sceneList?: Record<string, unknown>[];
242
242
  enable?: boolean;
243
243
  additionalParams?: Record<string, unknown>;
244
244
  }
@@ -248,4 +248,22 @@ export declare class SensetimeAvatar extends BaseCNAvatar<number> {
248
248
  constructor(options: SensetimeAvatarOptions);
249
249
  toConfig(): AvatarConfig;
250
250
  }
251
+ export interface SpatiusAvatarOptions {
252
+ spatiusApiKey: string;
253
+ spatiusAppId: string;
254
+ spatiusAvatarId: string;
255
+ agoraUid: string;
256
+ agoraToken?: string;
257
+ region?: string;
258
+ sampleRate?: 16000 | 24000;
259
+ sessionExpireMinutes?: number;
260
+ enable?: boolean;
261
+ additionalParams?: Record<string, unknown>;
262
+ }
263
+ export declare class SpatiusAvatar extends BaseCNAvatar<number> {
264
+ private readonly options;
265
+ readonly requiredSampleRate: number;
266
+ constructor(options: SpatiusAvatarOptions);
267
+ toConfig(): AvatarConfig;
268
+ }
251
269
  export {};
@@ -206,7 +206,7 @@ export class StepFunTTS extends BaseCNTTS {
206
206
  }
207
207
  function cnLlmConfig(options, vendor) {
208
208
  var _a;
209
- return Object.assign(Object.assign({ url: options.url }, (options.apiKey && { api_key: options.apiKey })), { params: Object.assign({ model: options.model }, options.params), headers: options.headers, max_history: options.maxHistory, system_messages: options.systemMessages, greeting_message: options.greetingMessage, failure_message: options.failureMessage, input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"], output_modalities: options.outputModalities, style: "openai", vendor, greeting_configs: options.greetingConfigs, template_variables: options.templateVariables, mcp_servers: options.mcpServers });
209
+ return Object.assign(Object.assign({ url: options.url }, (options.apiKey && { api_key: options.apiKey })), { params: Object.assign({ model: options.model }, options.params), headers: options.headers, max_history: options.maxHistory, system_messages: options.systemMessages, greeting_message: options.greetingMessage, greeting_audio_url: options.greetingAudioUrl, failure_message: options.failureMessage, input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"], output_modalities: options.outputModalities, style: "openai", vendor, greeting_configs: options.greetingConfigs, template_variables: options.templateVariables, mcp_servers: options.mcpServers });
210
210
  }
211
211
  export class AliyunLLM extends BaseCNLLM {
212
212
  constructor(options) {
@@ -266,7 +266,26 @@ export class SensetimeAvatar extends BaseCNAvatar {
266
266
  return {
267
267
  enable,
268
268
  vendor: "sensetime",
269
- params: Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { agora_uid: agoraUid }), (agoraToken && { agora_token: agoraToken })), { appId, app_key: appKey, sceneList }),
269
+ params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { agora_uid: agoraUid }), (agoraToken && { agora_token: agoraToken })), { appId, app_key: appKey }), (sceneList !== undefined && { sceneList })),
270
+ };
271
+ }
272
+ }
273
+ export class SpatiusAvatar extends BaseCNAvatar {
274
+ constructor(options) {
275
+ super();
276
+ this.options = options;
277
+ this.requiredSampleRate = 0;
278
+ requireString(options.spatiusApiKey, "spatiusApiKey", "SpatiusAvatar");
279
+ requireString(options.spatiusAppId, "spatiusAppId", "SpatiusAvatar");
280
+ requireString(options.spatiusAvatarId, "spatiusAvatarId", "SpatiusAvatar");
281
+ requireString(options.agoraUid, "agoraUid", "SpatiusAvatar");
282
+ }
283
+ toConfig() {
284
+ const { spatiusApiKey, spatiusAppId, spatiusAvatarId, agoraUid, agoraToken, region, sampleRate, sessionExpireMinutes, enable = true, additionalParams, } = this.options;
285
+ return {
286
+ enable,
287
+ vendor: "spatius",
288
+ params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), { spatius_api_key: spatiusApiKey, spatius_app_id: spatiusAppId, spatius_avatar_id: spatiusAvatarId, agora_uid: agoraUid }), (agoraToken && { agora_token: agoraToken })), (region && { region })), (sampleRate !== undefined && { sample_rate: sampleRate })), (sessionExpireMinutes !== undefined && { session_expire_minutes: sessionExpireMinutes })),
270
289
  };
271
290
  }
272
291
  }
@@ -174,7 +174,7 @@ export interface GeminiOptions extends BaseLlmOptions {
174
174
  apiKey: string;
175
175
  /** Model name (e.g., 'gemini-pro', 'gemini-pro-vision') */
176
176
  model: string;
177
- /** API endpoint URL (defaults to Google's generativelanguage endpoint) */
177
+ /** Optional full API endpoint URL override. When omitted, AgentKit builds the official Gemini stream URL. */
178
178
  url?: string;
179
179
  /** Maximum number of conversation history messages to cache */
180
180
  maxHistory?: number;
@@ -57,7 +57,7 @@ export class OpenAI extends BaseLLM {
57
57
  const { apiKey, model, url, maxHistory, temperature, topP, maxTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
58
58
  return Object.assign(Object.assign({ url: url !== null && url !== void 0 ? url : "https://api.openai.com/v1/chat/completions" }, (apiKey && { api_key: apiKey })), {
59
59
  // model is the default; params entries extend it; named fields win.
60
- 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 });
60
+ 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 });
61
61
  }
62
62
  }
63
63
  /**
@@ -100,6 +100,7 @@ export class AzureOpenAI extends BaseLLM {
100
100
  max_history: maxHistory,
101
101
  system_messages: systemMessages,
102
102
  greeting_message: greetingMessage,
103
+ greeting_audio_url: this.greetingAudioUrl,
103
104
  failure_message: failureMessage,
104
105
  input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
105
106
  output_modalities: this.outputModalities,
@@ -145,6 +146,7 @@ export class Anthropic extends BaseLLM {
145
146
  max_history: maxHistory,
146
147
  system_messages: systemMessages,
147
148
  greeting_message: greetingMessage,
149
+ greeting_audio_url: this.greetingAudioUrl,
148
150
  failure_message: failureMessage,
149
151
  input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
150
152
  output_modalities: this.outputModalities,
@@ -172,19 +174,23 @@ export class Gemini extends BaseLLM {
172
174
  super(options);
173
175
  requireString(options.apiKey, "apiKey", "Gemini");
174
176
  requireString(options.model, "model", "Gemini");
177
+ if (options.url !== undefined) {
178
+ requireString(options.url, "url", "Gemini");
179
+ }
175
180
  this.options = options;
176
181
  }
177
182
  toConfig() {
178
183
  const { apiKey, model, url, maxHistory, temperature, topP, topK, maxOutputTokens, systemMessages, greetingMessage, failureMessage, inputModalities, params, headers, } = this.options;
184
+ const defaultUrl = `https://generativelanguage.googleapis.com/v1beta/models/${model}:streamGenerateContent?alt=sse&key=${encodeURIComponent(apiKey)}`;
179
185
  return {
180
- url: url !== null && url !== void 0 ? url : "https://generativelanguage.googleapis.com/v1beta/models",
181
- api_key: apiKey,
186
+ url: url !== null && url !== void 0 ? url : defaultUrl,
182
187
  // model is the default; params entries extend it; named fields win.
183
188
  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 })),
184
189
  headers,
185
190
  max_history: maxHistory,
186
191
  system_messages: systemMessages,
187
192
  greeting_message: greetingMessage,
193
+ greeting_audio_url: this.greetingAudioUrl,
188
194
  failure_message: failureMessage,
189
195
  input_modalities: inputModalities !== null && inputModalities !== void 0 ? inputModalities : ["text"],
190
196
  output_modalities: this.outputModalities,
@@ -206,6 +212,7 @@ function openAIStyleConfig(options, vendor) {
206
212
  max_history: options.maxHistory,
207
213
  system_messages: options.systemMessages,
208
214
  greeting_message: options.greetingMessage,
215
+ greeting_audio_url: options.greetingAudioUrl,
209
216
  failure_message: options.failureMessage,
210
217
  input_modalities: (_a = options.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
211
218
  output_modalities: options.outputModalities,
@@ -261,6 +268,7 @@ export class VertexAILLM extends BaseLLM {
261
268
  max_history: o.maxHistory,
262
269
  system_messages: o.systemMessages,
263
270
  greeting_message: o.greetingMessage,
271
+ greeting_audio_url: this.greetingAudioUrl,
264
272
  failure_message: o.failureMessage,
265
273
  input_modalities: (_b = o.inputModalities) !== null && _b !== void 0 ? _b : ["text"],
266
274
  output_modalities: this.outputModalities,
@@ -295,6 +303,7 @@ export class AmazonBedrock extends BaseLLM {
295
303
  max_history: o.maxHistory,
296
304
  system_messages: o.systemMessages,
297
305
  greeting_message: o.greetingMessage,
306
+ greeting_audio_url: this.greetingAudioUrl,
298
307
  failure_message: o.failureMessage,
299
308
  input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
300
309
  output_modalities: this.outputModalities,
@@ -325,6 +334,7 @@ export class Dify extends BaseLLM {
325
334
  max_history: o.maxHistory,
326
335
  system_messages: o.systemMessages,
327
336
  greeting_message: o.greetingMessage,
337
+ greeting_audio_url: this.greetingAudioUrl,
328
338
  failure_message: o.failureMessage,
329
339
  input_modalities: (_a = o.inputModalities) !== null && _a !== void 0 ? _a : ["text"],
330
340
  output_modalities: this.outputModalities,
@@ -62,7 +62,7 @@ export class GeminiLive extends BaseMLLM {
62
62
  }
63
63
  toConfig() {
64
64
  const { apiKey, model, url, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
65
- 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 }));
65
+ 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 }));
66
66
  }
67
67
  }
68
68
  /**
@@ -90,7 +90,7 @@ export class VertexAI extends BaseMLLM {
90
90
  }
91
91
  toConfig() {
92
92
  const { model, url, projectId, location, adcCredentialsString, instructions, voice, affectiveDialog, proactiveAudio, transcribeAgent, transcribeUser, httpOptions, greetingMessage, inputModalities, outputModalities, messages, additionalParams, turnDetection, } = this.options;
93
- 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 }));
93
+ 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 }));
94
94
  }
95
95
  }
96
96
  /**
@@ -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 {};
@@ -237,3 +237,27 @@ export class SarvamSTT extends BaseSTT {
237
237
  };
238
238
  }
239
239
  }
240
+ /**
241
+ * xAI STT vendor.
242
+ *
243
+ * @example
244
+ * ```typescript
245
+ * const stt = new XAiSTT({
246
+ * apiKey: process.env.XAI_API_KEY,
247
+ * language: 'en',
248
+ * });
249
+ * ```
250
+ */
251
+ export class XAiSTT extends BaseSTT {
252
+ constructor(options) {
253
+ super();
254
+ this.options = options;
255
+ }
256
+ toConfig() {
257
+ const { apiKey, language, baseUrl, sampleRate, additionalParams } = this.options;
258
+ return {
259
+ vendor: "xai",
260
+ 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 })),
261
+ };
262
+ }
263
+ }
@@ -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 {};
@@ -8,6 +8,11 @@ function requireString(value, field, vendor) {
8
8
  throw new Error(`${vendor} requires ${field}`);
9
9
  }
10
10
  }
11
+ function requireRecord(value, field, vendor) {
12
+ if (value == null || typeof value !== "object" || Array.isArray(value)) {
13
+ throw new Error(`${vendor} requires ${field}`);
14
+ }
15
+ }
11
16
  function isOpenAITtsManagedModel(model) {
12
17
  return model === undefined || OpenAITtsPresetModels.includes(model.trim().toLowerCase());
13
18
  }
@@ -328,3 +333,37 @@ export class MurfTTS extends BaseTTS {
328
333
  return Object.assign({ vendor: "murf", params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ api_key: key }, (baseUrl && { base_url: baseUrl })), (voiceId && { voiceId })), (locale && { locale })), (rate !== undefined && { rate })), (pitch !== undefined && { pitch })), (model && { model })), (sampleRate !== undefined && { sample_rate: sampleRate })) }, (skipPatterns && { skip_patterns: skipPatterns }));
329
334
  }
330
335
  }
336
+ /**
337
+ * Generic OpenAI-compatible TTS vendor.
338
+ */
339
+ export class GenericTTS extends BaseTTS {
340
+ constructor(options) {
341
+ super();
342
+ requireString(options.url, "url", "GenericTTS");
343
+ requireRecord(options.headers, "headers", "GenericTTS");
344
+ requireString(options.model, "model", "GenericTTS");
345
+ requireString(options.voice, "voice", "GenericTTS");
346
+ this.options = options;
347
+ }
348
+ toConfig() {
349
+ const { url, headers, apiKey, model, voice, speed, sampleRate, responseFormat, instruction, additionalParams, skipPatterns, } = this.options;
350
+ return Object.assign({ vendor: "generic", url,
351
+ headers, params: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, additionalParams), (apiKey !== undefined && { api_key: apiKey })), { model,
352
+ voice }), (speed !== undefined && { speed })), (sampleRate !== undefined && { sample_rate: sampleRate })), (responseFormat !== undefined && { response_format: responseFormat })), (instruction !== undefined && { instruction })) }, (skipPatterns && { skip_patterns: skipPatterns }));
353
+ }
354
+ }
355
+ /**
356
+ * xAI TTS vendor.
357
+ */
358
+ export class XAiTTS extends BaseTTS {
359
+ constructor(options) {
360
+ super();
361
+ requireString(options.apiKey, "apiKey", "XAiTTS");
362
+ requireString(options.language, "language", "XAiTTS");
363
+ this.options = options;
364
+ }
365
+ toConfig() {
366
+ const { apiKey, language, voiceId, sampleRate, additionalParams, skipPatterns } = this.options;
367
+ 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 }));
368
+ }
369
+ }
@@ -1,4 +1,3 @@
1
- import type * as Agora from "../../../../index.mjs";
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. */