agora-agents 2.1.1 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/README.md +49 -27
  2. package/dist/cjs/AgoraPoolClient.d.ts +9 -6
  3. package/dist/cjs/AgoraPoolClient.js +1 -0
  4. package/dist/cjs/BaseClient.js +2 -2
  5. package/dist/cjs/agentkit/Agent.d.ts +52 -51
  6. package/dist/cjs/agentkit/Agent.js +51 -51
  7. package/dist/cjs/agentkit/AgentSession.d.ts +11 -9
  8. package/dist/cjs/agentkit/AgentSession.js +10 -5
  9. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.d.ts +1 -0
  10. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +57 -0
  11. package/dist/cjs/agentkit/__tests__/readme-examples.test.d.ts +1 -0
  12. package/dist/cjs/agentkit/__tests__/readme-examples.test.js +126 -0
  13. package/dist/cjs/agentkit/__tests__/type-safety.test.js +24 -17
  14. package/dist/cjs/agentkit/area.d.ts +4 -0
  15. package/dist/cjs/agentkit/area.js +2 -0
  16. package/dist/cjs/agentkit/avatar-types.d.ts +28 -2
  17. package/dist/cjs/agentkit/avatar-types.js +24 -2
  18. package/dist/cjs/agentkit/index.d.ts +8 -5
  19. package/dist/cjs/agentkit/index.js +27 -2
  20. package/dist/cjs/agentkit/presets.js +11 -4
  21. package/dist/cjs/agentkit/region-vendors.d.ts +15 -0
  22. package/dist/cjs/agentkit/region-vendors.js +2 -0
  23. package/dist/cjs/agentkit/token.d.ts +3 -2
  24. package/dist/cjs/agentkit/token.js +3 -2
  25. package/dist/cjs/agentkit/types.d.ts +29 -6
  26. package/dist/cjs/agentkit/vendors/avatar.d.ts +9 -4
  27. package/dist/cjs/agentkit/vendors/avatar.js +6 -3
  28. package/dist/cjs/agentkit/vendors/base.d.ts +38 -5
  29. package/dist/cjs/agentkit/vendors/base.js +60 -6
  30. package/dist/cjs/agentkit/vendors/cn.d.ts +251 -0
  31. package/dist/cjs/agentkit/vendors/cn.js +293 -0
  32. package/dist/cjs/agentkit/vendors/llm.d.ts +4 -2
  33. package/dist/cjs/agentkit/vendors/llm.js +10 -5
  34. package/dist/cjs/agentkit/vendors/mllm.d.ts +8 -4
  35. package/dist/cjs/agentkit/vendors/mllm.js +8 -4
  36. package/dist/cjs/agentkit/vendors/stt.d.ts +4 -6
  37. package/dist/cjs/agentkit/vendors/stt.js +48 -62
  38. package/dist/cjs/agentkit/vendors/tts.d.ts +3 -3
  39. package/dist/cjs/agentkit/vendors/tts.js +1 -1
  40. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +5 -2
  41. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +4 -0
  42. package/dist/cjs/api/types/Asr.d.ts +16 -1
  43. package/dist/cjs/api/types/BytedanceDuplexTts.d.ts +9 -0
  44. package/dist/cjs/api/types/BytedanceDuplexTts.js +3 -0
  45. package/dist/cjs/api/types/BytedanceDuplexTtsParams.d.ts +13 -0
  46. package/dist/cjs/api/types/BytedanceDuplexTtsParams.js +3 -0
  47. package/dist/cjs/api/types/BytedanceTts.d.ts +9 -0
  48. package/dist/cjs/api/types/BytedanceTts.js +3 -0
  49. package/dist/cjs/api/types/BytedanceTtsParams.d.ts +23 -0
  50. package/dist/cjs/api/types/BytedanceTtsParams.js +3 -0
  51. package/dist/cjs/api/types/CosyvoiceTts.d.ts +9 -0
  52. package/dist/cjs/api/types/CosyvoiceTts.js +3 -0
  53. package/dist/cjs/api/types/CosyvoiceTtsParams.d.ts +15 -0
  54. package/dist/cjs/api/types/CosyvoiceTtsParams.js +3 -0
  55. package/dist/cjs/api/types/DeepgramAsr.d.ts +0 -2
  56. package/dist/cjs/api/types/DeepgramAsrParams.d.ts +1 -1
  57. package/dist/cjs/api/types/FengmingAsr.d.ts +11 -0
  58. package/dist/cjs/api/types/FengmingAsr.js +3 -0
  59. package/dist/cjs/api/types/MinimaxTtsParams.d.ts +52 -3
  60. package/dist/cjs/api/types/SensetimeAvatarParams.d.ts +48 -0
  61. package/dist/cjs/api/types/SensetimeAvatarParams.js +3 -0
  62. package/dist/cjs/api/types/StepfunTts.d.ts +9 -0
  63. package/dist/cjs/api/types/StepfunTts.js +3 -0
  64. package/dist/cjs/api/types/StepfunTtsParams.d.ts +13 -0
  65. package/dist/cjs/api/types/StepfunTtsParams.js +3 -0
  66. package/dist/cjs/api/types/TencentAsr.d.ts +10 -0
  67. package/dist/cjs/api/types/TencentAsr.js +3 -0
  68. package/dist/cjs/api/types/TencentAsrParams.d.ts +17 -0
  69. package/dist/cjs/api/types/TencentAsrParams.js +3 -0
  70. package/dist/cjs/api/types/TencentTts.d.ts +9 -0
  71. package/dist/cjs/api/types/TencentTts.js +3 -0
  72. package/dist/cjs/api/types/TencentTtsParams.d.ts +23 -0
  73. package/dist/cjs/api/types/TencentTtsParams.js +3 -0
  74. package/dist/cjs/api/types/Tts.d.ts +16 -1
  75. package/dist/cjs/api/types/XfyunAsr.d.ts +10 -0
  76. package/dist/cjs/api/types/XfyunAsr.js +3 -0
  77. package/dist/cjs/api/types/XfyunAsrParams.d.ts +15 -0
  78. package/dist/cjs/api/types/XfyunAsrParams.js +3 -0
  79. package/dist/cjs/api/types/XfyunBigmodelAsr.d.ts +10 -0
  80. package/dist/cjs/api/types/XfyunBigmodelAsr.js +3 -0
  81. package/dist/cjs/api/types/XfyunBigmodelAsrParams.d.ts +17 -0
  82. package/dist/cjs/api/types/XfyunBigmodelAsrParams.js +3 -0
  83. package/dist/cjs/api/types/XfyunDialectAsr.d.ts +10 -0
  84. package/dist/cjs/api/types/XfyunDialectAsr.js +3 -0
  85. package/dist/cjs/api/types/XfyunDialectAsrParams.d.ts +15 -0
  86. package/dist/cjs/api/types/XfyunDialectAsrParams.js +3 -0
  87. package/dist/cjs/api/types/index.d.ts +20 -0
  88. package/dist/cjs/api/types/index.js +20 -0
  89. package/dist/cjs/core/domain/index.d.ts +2 -1
  90. package/dist/cjs/core/domain/index.js +5 -3
  91. package/dist/cjs/index.d.ts +3 -2
  92. package/dist/cjs/index.js +26 -2
  93. package/dist/cjs/version.d.ts +1 -1
  94. package/dist/cjs/version.js +1 -1
  95. package/dist/esm/AgoraPoolClient.d.mts +9 -6
  96. package/dist/esm/AgoraPoolClient.mjs +1 -0
  97. package/dist/esm/BaseClient.mjs +2 -2
  98. package/dist/esm/agentkit/Agent.d.mts +52 -51
  99. package/dist/esm/agentkit/Agent.mjs +51 -51
  100. package/dist/esm/agentkit/AgentSession.d.mts +11 -9
  101. package/dist/esm/agentkit/AgentSession.mjs +11 -6
  102. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.d.mts +1 -0
  103. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +55 -0
  104. package/dist/esm/agentkit/__tests__/readme-examples.test.d.mts +1 -0
  105. package/dist/esm/agentkit/__tests__/readme-examples.test.mjs +124 -0
  106. package/dist/esm/agentkit/__tests__/type-safety.test.mjs +24 -17
  107. package/dist/esm/agentkit/area.d.mts +4 -0
  108. package/dist/esm/agentkit/area.mjs +1 -0
  109. package/dist/esm/agentkit/avatar-types.d.mts +28 -2
  110. package/dist/esm/agentkit/avatar-types.mjs +23 -2
  111. package/dist/esm/agentkit/index.d.mts +8 -5
  112. package/dist/esm/agentkit/index.mjs +3 -2
  113. package/dist/esm/agentkit/presets.mjs +11 -4
  114. package/dist/esm/agentkit/region-vendors.d.mts +15 -0
  115. package/dist/esm/agentkit/region-vendors.mjs +1 -0
  116. package/dist/esm/agentkit/token.d.mts +3 -2
  117. package/dist/esm/agentkit/token.mjs +3 -2
  118. package/dist/esm/agentkit/types.d.mts +29 -6
  119. package/dist/esm/agentkit/vendors/avatar.d.mts +9 -4
  120. package/dist/esm/agentkit/vendors/avatar.mjs +6 -3
  121. package/dist/esm/agentkit/vendors/base.d.mts +38 -5
  122. package/dist/esm/agentkit/vendors/base.mjs +55 -5
  123. package/dist/esm/agentkit/vendors/cn.d.mts +251 -0
  124. package/dist/esm/agentkit/vendors/cn.mjs +272 -0
  125. package/dist/esm/agentkit/vendors/llm.d.mts +4 -2
  126. package/dist/esm/agentkit/vendors/llm.mjs +10 -5
  127. package/dist/esm/agentkit/vendors/mllm.d.mts +8 -4
  128. package/dist/esm/agentkit/vendors/mllm.mjs +8 -4
  129. package/dist/esm/agentkit/vendors/stt.d.mts +4 -6
  130. package/dist/esm/agentkit/vendors/stt.mjs +48 -62
  131. package/dist/esm/agentkit/vendors/tts.d.mts +3 -3
  132. package/dist/esm/agentkit/vendors/tts.mjs +1 -1
  133. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +5 -2
  134. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +4 -0
  135. package/dist/esm/api/types/Asr.d.mts +16 -1
  136. package/dist/esm/api/types/BytedanceDuplexTts.d.mts +9 -0
  137. package/dist/esm/api/types/BytedanceDuplexTts.mjs +2 -0
  138. package/dist/esm/api/types/BytedanceDuplexTtsParams.d.mts +13 -0
  139. package/dist/esm/api/types/BytedanceDuplexTtsParams.mjs +2 -0
  140. package/dist/esm/api/types/BytedanceTts.d.mts +9 -0
  141. package/dist/esm/api/types/BytedanceTts.mjs +2 -0
  142. package/dist/esm/api/types/BytedanceTtsParams.d.mts +23 -0
  143. package/dist/esm/api/types/BytedanceTtsParams.mjs +2 -0
  144. package/dist/esm/api/types/CosyvoiceTts.d.mts +9 -0
  145. package/dist/esm/api/types/CosyvoiceTts.mjs +2 -0
  146. package/dist/esm/api/types/CosyvoiceTtsParams.d.mts +15 -0
  147. package/dist/esm/api/types/CosyvoiceTtsParams.mjs +2 -0
  148. package/dist/esm/api/types/DeepgramAsr.d.mts +0 -2
  149. package/dist/esm/api/types/DeepgramAsrParams.d.mts +1 -1
  150. package/dist/esm/api/types/FengmingAsr.d.mts +11 -0
  151. package/dist/esm/api/types/FengmingAsr.mjs +2 -0
  152. package/dist/esm/api/types/MinimaxTtsParams.d.mts +52 -3
  153. package/dist/esm/api/types/SensetimeAvatarParams.d.mts +48 -0
  154. package/dist/esm/api/types/SensetimeAvatarParams.mjs +2 -0
  155. package/dist/esm/api/types/StepfunTts.d.mts +9 -0
  156. package/dist/esm/api/types/StepfunTts.mjs +2 -0
  157. package/dist/esm/api/types/StepfunTtsParams.d.mts +13 -0
  158. package/dist/esm/api/types/StepfunTtsParams.mjs +2 -0
  159. package/dist/esm/api/types/TencentAsr.d.mts +10 -0
  160. package/dist/esm/api/types/TencentAsr.mjs +2 -0
  161. package/dist/esm/api/types/TencentAsrParams.d.mts +17 -0
  162. package/dist/esm/api/types/TencentAsrParams.mjs +2 -0
  163. package/dist/esm/api/types/TencentTts.d.mts +9 -0
  164. package/dist/esm/api/types/TencentTts.mjs +2 -0
  165. package/dist/esm/api/types/TencentTtsParams.d.mts +23 -0
  166. package/dist/esm/api/types/TencentTtsParams.mjs +2 -0
  167. package/dist/esm/api/types/Tts.d.mts +16 -1
  168. package/dist/esm/api/types/XfyunAsr.d.mts +10 -0
  169. package/dist/esm/api/types/XfyunAsr.mjs +2 -0
  170. package/dist/esm/api/types/XfyunAsrParams.d.mts +15 -0
  171. package/dist/esm/api/types/XfyunAsrParams.mjs +2 -0
  172. package/dist/esm/api/types/XfyunBigmodelAsr.d.mts +10 -0
  173. package/dist/esm/api/types/XfyunBigmodelAsr.mjs +2 -0
  174. package/dist/esm/api/types/XfyunBigmodelAsrParams.d.mts +17 -0
  175. package/dist/esm/api/types/XfyunBigmodelAsrParams.mjs +2 -0
  176. package/dist/esm/api/types/XfyunDialectAsr.d.mts +10 -0
  177. package/dist/esm/api/types/XfyunDialectAsr.mjs +2 -0
  178. package/dist/esm/api/types/XfyunDialectAsrParams.d.mts +15 -0
  179. package/dist/esm/api/types/XfyunDialectAsrParams.mjs +2 -0
  180. package/dist/esm/api/types/index.d.mts +20 -0
  181. package/dist/esm/api/types/index.mjs +20 -0
  182. package/dist/esm/core/domain/index.d.mts +2 -1
  183. package/dist/esm/core/domain/index.mjs +4 -2
  184. package/dist/esm/index.d.mts +3 -2
  185. package/dist/esm/index.mjs +6 -6
  186. package/dist/esm/version.d.mts +1 -1
  187. package/dist/esm/version.mjs +1 -1
  188. package/package.json +1 -1
@@ -13,17 +13,24 @@
13
13
  * 3. TypeScript should show errors for the uncommented invalid sections
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
+ const AgoraPoolClient_js_1 = require("../../AgoraPoolClient.js");
17
+ const index_js_1 = require("../../core/domain/index.js");
16
18
  const Agent_js_1 = require("../Agent.js");
17
19
  const avatar_js_1 = require("../vendors/avatar.js");
18
20
  const llm_js_1 = require("../vendors/llm.js");
19
21
  const stt_js_1 = require("../vendors/stt.js");
20
22
  const tts_js_1 = require("../vendors/tts.js");
23
+ const TEST_AGENT_CLIENT = new AgoraPoolClient_js_1.AgoraClient({
24
+ area: index_js_1.Area.US,
25
+ appId: "test-app-id",
26
+ appCertificate: "test-app-certificate",
27
+ });
21
28
  // ============================================
22
29
  // ✅ VALID CONFIGURATIONS
23
30
  // ============================================
24
31
  // Example 1: ElevenLabs 24kHz + HeyGen avatar
25
32
  function _validExample1() {
26
- return new Agent_js_1.Agent({ instructions: "Test" })
33
+ return new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
27
34
  .withTts(new tts_js_1.ElevenLabsTTS({
28
35
  key: "test",
29
36
  modelId: "eleven_flash_v2_5",
@@ -39,7 +46,7 @@ function _validExample1() {
39
46
  }
40
47
  // Example 2: ElevenLabs 16kHz + Akool avatar
41
48
  function _validExample2() {
42
- return new Agent_js_1.Agent({ instructions: "Test" })
49
+ return new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
43
50
  .withTts(new tts_js_1.ElevenLabsTTS({
44
51
  key: "test",
45
52
  modelId: "eleven_flash_v2_5",
@@ -53,7 +60,7 @@ function _validExample2() {
53
60
  }
54
61
  // Example 3: Microsoft 24kHz + HeyGen avatar
55
62
  function _validExample3() {
56
- return new Agent_js_1.Agent({ instructions: "Test" })
63
+ return new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
57
64
  .withTts(new tts_js_1.MicrosoftTTS({
58
65
  key: "test",
59
66
  region: "eastus",
@@ -68,7 +75,7 @@ function _validExample3() {
68
75
  }
69
76
  // Example 4: OpenAI (fixed 24kHz) + HeyGen avatar
70
77
  function _validExample4() {
71
- return new Agent_js_1.Agent({ instructions: "Test" })
78
+ return new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
72
79
  .withTts(new tts_js_1.OpenAITTS({
73
80
  apiKey: "test",
74
81
  voice: "alloy",
@@ -83,7 +90,7 @@ function _validExample4() {
83
90
  }
84
91
  // Example 5: Cartesia 16kHz + Akool avatar
85
92
  function _validExample5() {
86
- return new Agent_js_1.Agent({ instructions: "Test" })
93
+ return new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
87
94
  .withTts(new tts_js_1.CartesiaTTS({
88
95
  apiKey: "test",
89
96
  voiceId: "test",
@@ -131,7 +138,7 @@ new tts_js_1.MiniMaxTTS({
131
138
  /*
132
139
  // @ts-expect-error - HeyGen requires 24kHz, but TTS is configured for 16kHz
133
140
  function invalidMismatch1(): Agent<24000> {
134
- return new Agent({ instructions: "Test" })
141
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
135
142
  .withTts(
136
143
  new ElevenLabsTTS({
137
144
  key: "test",
@@ -153,7 +160,7 @@ function invalidMismatch1(): Agent<24000> {
153
160
  /*
154
161
  // @ts-expect-error - Akool requires 16kHz, but TTS is configured for 24kHz
155
162
  function invalidMismatch2(): Agent<16000> {
156
- return new Agent({ instructions: "Test" })
163
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
157
164
  .withTts(
158
165
  new ElevenLabsTTS({
159
166
  key: "test",
@@ -173,7 +180,7 @@ function invalidMismatch2(): Agent<16000> {
173
180
  /*
174
181
  // @ts-expect-error - HeyGen requires 24kHz, not 48kHz
175
182
  function invalidMismatch3(): Agent<24000> {
176
- return new Agent({ instructions: "Test" })
183
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
177
184
  .withTts(
178
185
  new MicrosoftTTS({
179
186
  key: "test",
@@ -198,7 +205,7 @@ function invalidMismatch3(): Agent<24000> {
198
205
  /*
199
206
  // @ts-expect-error - 25000 is not a valid ElevenLabs sample rate
200
207
  function invalidEnum1() {
201
- return new Agent({ instructions: "Test" }).withTts(
208
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(
202
209
  new ElevenLabsTTS({
203
210
  key: "test",
204
211
  modelId: "eleven_flash_v2_5",
@@ -212,7 +219,7 @@ function invalidEnum1() {
212
219
  /*
213
220
  // @ts-expect-error - 8000 is not a valid Microsoft sample rate
214
221
  function invalidEnum2() {
215
- return new Agent({ instructions: "Test" }).withTts(
222
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(
216
223
  new MicrosoftTTS({
217
224
  key: "test",
218
225
  region: "eastus",
@@ -225,7 +232,7 @@ function invalidEnum2() {
225
232
  /*
226
233
  // @ts-expect-error - 32000 is not a valid Cartesia sample rate
227
234
  function invalidEnum3() {
228
- return new Agent({ instructions: "Test" }).withTts(
235
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(
229
236
  new CartesiaTTS({
230
237
  key: "test",
231
238
  voiceId: "test",
@@ -240,7 +247,7 @@ function invalidEnum3() {
240
247
  // ============================================
241
248
  // Avatar without TTS configured (allowed)
242
249
  function _edgeCase1() {
243
- return new Agent_js_1.Agent({ instructions: "Test" }).withAvatar(new avatar_js_1.LiveAvatarAvatar({
250
+ return new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withAvatar(new avatar_js_1.LiveAvatarAvatar({
244
251
  apiKey: "test",
245
252
  quality: "high",
246
253
  agoraUid: "12345",
@@ -248,7 +255,7 @@ function _edgeCase1() {
248
255
  }
249
256
  // TTS without avatar (allowed)
250
257
  function _edgeCase2() {
251
- return new Agent_js_1.Agent({ instructions: "Test" }).withTts(new tts_js_1.ElevenLabsTTS({
258
+ return new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(new tts_js_1.ElevenLabsTTS({
252
259
  key: "test",
253
260
  modelId: "eleven_flash_v2_5",
254
261
  voiceId: "test",
@@ -258,7 +265,7 @@ function _edgeCase2() {
258
265
  }
259
266
  // Method chaining preserves type tracking
260
267
  function _edgeCase3() {
261
- return new Agent_js_1.Agent({ instructions: "Test" })
268
+ return new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
262
269
  .withTts(new tts_js_1.ElevenLabsTTS({
263
270
  key: "test",
264
271
  modelId: "eleven_flash_v2_5",
@@ -278,7 +285,7 @@ function _edgeCase3() {
278
285
  // Type inference verification
279
286
  // ============================================
280
287
  function _typeInference1() {
281
- const agentWith24k = new Agent_js_1.Agent({ instructions: "Test" }).withTts(new tts_js_1.ElevenLabsTTS({
288
+ const agentWith24k = new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(new tts_js_1.ElevenLabsTTS({
282
289
  key: "test",
283
290
  modelId: "eleven_flash_v2_5",
284
291
  voiceId: "test",
@@ -290,7 +297,7 @@ function _typeInference1() {
290
297
  return agentWith24k;
291
298
  }
292
299
  function _typeInference2() {
293
- const agentWith16k = new Agent_js_1.Agent({ instructions: "Test" }).withTts(new tts_js_1.ElevenLabsTTS({
300
+ const agentWith16k = new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(new tts_js_1.ElevenLabsTTS({
294
301
  key: "test",
295
302
  modelId: "eleven_flash_v2_5",
296
303
  voiceId: "test",
@@ -302,7 +309,7 @@ function _typeInference2() {
302
309
  return agentWith16k;
303
310
  }
304
311
  function _typeInference3() {
305
- const openAIAgent = new Agent_js_1.Agent({ instructions: "Test" }).withTts(new tts_js_1.OpenAITTS({
312
+ const openAIAgent = new Agent_js_1.Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(new tts_js_1.OpenAITTS({
306
313
  apiKey: "test",
307
314
  voice: "alloy",
308
315
  model: "gpt-4o-mini-tts",
@@ -0,0 +1,4 @@
1
+ import type { Area } from "../core/domain/index.js";
2
+ export type AgoraArea = Area.US | Area.EU | Area.AP | Area.CN;
3
+ export type GlobalArea = Exclude<AgoraArea, Area.CN>;
4
+ export type AreaScope<TArea extends AgoraArea> = TArea extends Area.CN ? "cn" : "global";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -4,6 +4,7 @@
4
4
  * This provides type safety for vendor-specific parameters like sample rates,
5
5
  * ensuring that invalid combinations are caught at compile time.
6
6
  */
7
+ import type { SensetimeAvatarParams } from "../api/types/SensetimeAvatarParams.js";
7
8
  import type { AvatarConfig as BaseAvatarConfig } from "./types.js";
8
9
  /**
9
10
  * HeyGen-specific avatar configuration (legacy wire vendor `heygen`).
@@ -123,11 +124,31 @@ export interface GenericAvatarConfig {
123
124
  [key: string]: unknown;
124
125
  };
125
126
  }
127
+ /**
128
+ * SenseTime-specific avatar configuration (CN).
129
+ */
130
+ export interface SensetimeAvatarConfig {
131
+ enable?: boolean;
132
+ vendor: "sensetime";
133
+ params: {
134
+ /** RTC UID for the avatar video publisher (required) */
135
+ agora_uid: string;
136
+ /** Avatar ConvoAI token (filled by AgentKit at session start when omitted) */
137
+ agora_token?: string;
138
+ /** SenseTime application ID (required) */
139
+ appId: string;
140
+ /** SenseTime application key (required) */
141
+ app_key: string;
142
+ /** SenseTime scene configuration list (required) */
143
+ sceneList: SensetimeAvatarParams.SceneList.Item[];
144
+ [key: string]: unknown;
145
+ };
146
+ }
126
147
  /**
127
148
  * Discriminated union of all avatar configurations.
128
149
  * TypeScript will enforce vendor-specific constraints based on the vendor field.
129
150
  */
130
- export type StrictAvatarConfig = HeyGenAvatarConfig | LiveAvatarAvatarConfig | AkoolAvatarConfig | AnamAvatarConfig | GenericAvatarConfig;
151
+ export type StrictAvatarConfig = HeyGenAvatarConfig | LiveAvatarAvatarConfig | AkoolAvatarConfig | AnamAvatarConfig | GenericAvatarConfig | SensetimeAvatarConfig;
131
152
  /**
132
153
  * Helper type guard to check if an avatar config uses the legacy HeyGen wire vendor.
133
154
  */
@@ -148,6 +169,10 @@ export declare function isAnamAvatar(config: StrictAvatarConfig): config is Anam
148
169
  * Helper type guard to check if an avatar config is for Generic Avatar.
149
170
  */
150
171
  export declare function isGenericAvatar(config: StrictAvatarConfig): config is GenericAvatarConfig;
172
+ /**
173
+ * Helper type guard to check if an avatar config is for SenseTime (CN).
174
+ */
175
+ export declare function isSensetimeAvatar(config: StrictAvatarConfig): config is SensetimeAvatarConfig;
151
176
  /**
152
177
  * Returns true when AgentKit manages the avatar's RTC publisher identity
153
178
  * (i.e. fills `agora_token`, validates uniqueness against the agent UID).
@@ -161,7 +186,8 @@ export declare function isAvatarTokenManaged(config: StrictAvatarConfig): boolea
161
186
  * for cases where types are bypassed or data comes from external sources.
162
187
  *
163
188
  * @param options.requireSessionFields - When true, require fields AgentKit
164
- * fills during `AgentSession.start()` for Generic avatars.
189
+ * fills during `AgentSession.start()` for Generic avatars (`agora_appid`,
190
+ * `agora_channel`, `agora_token`).
165
191
  * @throws {Error} If the configuration is invalid
166
192
  */
167
193
  export declare function validateAvatarConfig(config: StrictAvatarConfig, options?: {
@@ -11,6 +11,7 @@ exports.isLiveAvatarAvatar = isLiveAvatarAvatar;
11
11
  exports.isAkoolAvatar = isAkoolAvatar;
12
12
  exports.isAnamAvatar = isAnamAvatar;
13
13
  exports.isGenericAvatar = isGenericAvatar;
14
+ exports.isSensetimeAvatar = isSensetimeAvatar;
14
15
  exports.isAvatarTokenManaged = isAvatarTokenManaged;
15
16
  exports.validateAvatarConfig = validateAvatarConfig;
16
17
  exports.validateTtsSampleRate = validateTtsSampleRate;
@@ -45,6 +46,12 @@ function isAnamAvatar(config) {
45
46
  function isGenericAvatar(config) {
46
47
  return config.vendor === "generic";
47
48
  }
49
+ /**
50
+ * Helper type guard to check if an avatar config is for SenseTime (CN).
51
+ */
52
+ function isSensetimeAvatar(config) {
53
+ return config.vendor === "sensetime";
54
+ }
48
55
  /**
49
56
  * Returns true when AgentKit manages the avatar's RTC publisher identity
50
57
  * (i.e. fills `agora_token`, validates uniqueness against the agent UID).
@@ -52,7 +59,7 @@ function isGenericAvatar(config) {
52
59
  * Mirrors the Go and Python SDK gate so all language SDKs behave identically.
53
60
  */
54
61
  function isAvatarTokenManaged(config) {
55
- return isHeyGenAvatar(config) || isLiveAvatarAvatar(config) || isGenericAvatar(config);
62
+ return isHeyGenAvatar(config) || isLiveAvatarAvatar(config) || isGenericAvatar(config) || isSensetimeAvatar(config);
56
63
  }
57
64
  /**
58
65
  * Validates avatar configuration at runtime.
@@ -60,7 +67,8 @@ function isAvatarTokenManaged(config) {
60
67
  * for cases where types are bypassed or data comes from external sources.
61
68
  *
62
69
  * @param options.requireSessionFields - When true, require fields AgentKit
63
- * fills during `AgentSession.start()` for Generic avatars.
70
+ * fills during `AgentSession.start()` for Generic avatars (`agora_appid`,
71
+ * `agora_channel`, `agora_token`).
64
72
  * @throws {Error} If the configuration is invalid
65
73
  */
66
74
  function validateAvatarConfig(config, options = {}) {
@@ -116,6 +124,20 @@ function validateAvatarConfig(config, options = {}) {
116
124
  }
117
125
  }
118
126
  }
127
+ else if (isSensetimeAvatar(config)) {
128
+ if (!config.params.agora_uid) {
129
+ throw new Error("SenseTime avatar requires agora_uid");
130
+ }
131
+ if (!config.params.appId) {
132
+ throw new Error("SenseTime avatar requires appId");
133
+ }
134
+ if (!config.params.app_key) {
135
+ throw new Error("SenseTime avatar requires app_key");
136
+ }
137
+ if (!Array.isArray(config.params.sceneList) || config.params.sceneList.length === 0) {
138
+ throw new Error("SenseTime avatar requires a non-empty sceneList");
139
+ }
140
+ }
119
141
  }
120
142
  /**
121
143
  * Validates that TTS sample rate is compatible with the avatar vendor.
@@ -23,18 +23,21 @@ export type { AgentOptions } from "./Agent.js";
23
23
  export { Agent } from "./Agent.js";
24
24
  export type { AgentSessionEvent, AgentSessionEventHandler, AgentSessionOptions, } from "./AgentSession.js";
25
25
  export { AgentSession } from "./AgentSession.js";
26
- export type { AkoolAvatarConfig, AnamAvatarConfig, GenericAvatarConfig, HeyGenAvatarConfig, LiveAvatarAvatarConfig, StrictAvatarConfig, } from "./avatar-types.js";
27
- export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.js";
26
+ export type { AkoolAvatarConfig, AnamAvatarConfig, GenericAvatarConfig, HeyGenAvatarConfig, LiveAvatarAvatarConfig, SensetimeAvatarConfig, StrictAvatarConfig, } from "./avatar-types.js";
27
+ export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.js";
28
28
  export { AudioScenario, DataChannel, FillerWordsSelectionRule, Geofence, InterruptionDisabledStrategy, InterruptionDisabledStrategyAppend, InterruptionDisabledStrategyIgnore, InterruptionModeKeywords, InterruptionModeStartOfSpeech, InterruptionModeValues, MllmTurnDetectionModeAgoraVad, MllmTurnDetectionModeSemanticVad, MllmTurnDetectionModeServerVad, MllmTurnDetectionModeValues, SalModeValues, SilenceActionValues, SpeakPriorityAppend, SpeakPriorityIgnore, SpeakPriorityInterrupt, SpeakPriorityValues, ThinkOnListeningActionIgnore, ThinkOnListeningActionInject, ThinkOnListeningActionInterrupt, ThinkOnSpeakingActionIgnore, ThinkOnSpeakingActionInterrupt, ThinkOnThinkingActionIgnore, ThinkOnThinkingActionInterrupt, TurnDetectionTypeValues, } from "./constants.js";
29
- export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPresetModel, OpenAIPresetModel, OpenAITtsPresetModel, PresetInput, TtsPreset, } from "./presets.js";
29
+ export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPresetModel, OpenAIPresetModel, OpenAITtsPresetModel, PresetCategory, PresetInput, TtsPreset, } from "./presets.js";
30
30
  export { AgentPresets, normalizePresetInput } from "./presets.js";
31
+ export type { AvatarVendor, CNAvatarVendor, CNLlmVendor, CNSttVendor, CNTtsVendor, GlobalAvatarVendor, GlobalLlmVendor, GlobalSttVendor, GlobalTtsVendor, LlmVendor, SttVendor, TtsVendor, } from "./region-vendors.js";
31
32
  export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.js";
32
33
  export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.js";
33
- export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AvatarConfig, AvatarVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, SttVendor, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, } from "./types.js";
34
+ export type { AdvancedFeatures, AgentConfig, AgentConfigUpdate, AmazonTts, AmazonTtsParams, AsrConfig, AsrVendorName, AvatarConfig, AvatarWireVendor, CartesiaTts, CartesiaTtsParams, ConversationHistory, ConversationRole, ConversationSessionTurn, ConversationTurn, ConversationTurns, Eagerness, ElevenLabsTts, ElevenLabsTtsParams, EndOfSpeechConfig, EndOfSpeechMode, EndOfSpeechSemanticConfig, EndOfSpeechVadConfig, FarewellConfig, FillerWordsConfig, FillerWordsContent, FillerWordsContentSelectionRule, FillerWordsContentStaticConfig, FillerWordsTrigger, FillerWordsTriggerFixedTimeConfig, FishAudioTts, FishAudioTtsParams, GeofenceArea, GeofenceConfig, GeofenceExcludeArea, GetTurnsOptions, GoogleTts, GoogleTtsParams, HumeAiTts, HumeAiTtsParams, InterruptionConfig, InterruptionMode, InterruptMode, Labels, LlmConfig, LlmGreetingConfigs, LlmGreetingConfigsMode, LlmStyle, McpServersItem, MicrosoftTts, MicrosoftTtsParams, MinimaxTts, MinimaxTtsParams, MllmConfig, MllmTurnDetectionConfig, MllmTurnDetectionMode, MllmVendor, MurfTts, MurfTtsParams, OpenAiTts, OpenAiTtsParams, ParametersAudioScenario, ParametersDataChannel, RimeTts, RimeTtsParams, RtcConfig, SalConfig, SalMode, SarvamTts, SarvamTtsParams, SayOptions, SessionInfo, SessionListResponse, SessionOptions, SessionParams, SessionParamsInput, SessionStatus, SessionSummary, SilenceAction, SilenceConfig, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, } from "./types.js";
34
35
  export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LiveAvatarAvatarOptions, } from "./vendors/avatar.js";
35
36
  export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LiveAvatarAvatar, } from "./vendors/avatar.js";
36
37
  export type { AkoolSampleRate, CartesiaSampleRate, ElevenLabsSampleRate, HeyGenSampleRate, LiveAvatarSampleRate, MicrosoftSampleRate, SampleRate, } from "./vendors/base.js";
37
- export { BaseAvatar, BaseLLM, type BaseLlmOptions, BaseMLLM, BaseSTT, BaseTTS, type GoogleTTSSampleRate, } from "./vendors/base.js";
38
+ export { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, BaseLLM, type BaseLlmOptions, BaseMLLM, BaseSTT, BaseTTS, type GoogleTTSSampleRate, } from "./vendors/base.js";
39
+ export type { AliyunLLMOptions, BytedanceDuplexTTSOptions, BytedanceLLMOptions, BytedanceTTSOptions, CosyVoiceTTSOptions, DeepSeekLLMOptions, MicrosoftCNSampleRate, MicrosoftCNSTTOptions, MicrosoftCNTTSOptions, MiniMaxCNTTSOptions, SensetimeAvatarOptions, StepFunTTSOptions, TencentLLMOptions, TencentSTTOptions, TencentTTSOptions, XfyunBigModelSTTOptions, XfyunDialectSTTOptions, XfyunSTTOptions, } from "./vendors/cn.js";
40
+ export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, SensetimeAvatar, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./vendors/cn.js";
38
41
  export type { AmazonBedrockOptions, AnthropicOptions, AzureOpenAIOptions, CustomLLMOptions, DifyOptions, GeminiOptions, GroqOptions, OpenAIOptions, VertexAILLMOptions, } from "./vendors/llm.js";
39
42
  export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.js";
40
43
  export type { GeminiLiveOptions, OpenAIRealtimeOptions, VertexAIOptions, XaiGrokOptions, } from "./vendors/mllm.js";
@@ -20,8 +20,9 @@
20
20
  * parts that need manual updates when adding new sugar.
21
21
  */
22
22
  Object.defineProperty(exports, "__esModule", { value: true });
23
- exports.LiveAvatarAvatar = exports.HeyGenAvatar = exports.GenericAvatar = exports.AnamAvatar = exports.AkoolAvatar = exports.MAX_EXPIRY_SECONDS = exports.generateRtcToken = exports.generateConvoAIToken = exports.ExpiresIn = exports.normalizePresetInput = exports.AgentPresets = exports.TurnDetectionTypeValues = exports.ThinkOnThinkingActionInterrupt = exports.ThinkOnThinkingActionIgnore = exports.ThinkOnSpeakingActionInterrupt = exports.ThinkOnSpeakingActionIgnore = exports.ThinkOnListeningActionInterrupt = exports.ThinkOnListeningActionInject = exports.ThinkOnListeningActionIgnore = exports.SpeakPriorityValues = exports.SpeakPriorityInterrupt = exports.SpeakPriorityIgnore = exports.SpeakPriorityAppend = exports.SilenceActionValues = exports.SalModeValues = exports.MllmTurnDetectionModeValues = exports.MllmTurnDetectionModeServerVad = exports.MllmTurnDetectionModeSemanticVad = exports.MllmTurnDetectionModeAgoraVad = exports.InterruptionModeValues = exports.InterruptionModeStartOfSpeech = exports.InterruptionModeKeywords = exports.InterruptionDisabledStrategyIgnore = exports.InterruptionDisabledStrategyAppend = exports.InterruptionDisabledStrategy = exports.Geofence = exports.FillerWordsSelectionRule = exports.DataChannel = exports.AudioScenario = exports.validateTtsSampleRate = exports.validateAvatarConfig = exports.toBaseAvatarConfig = exports.isLiveAvatarAvatar = exports.isHeyGenAvatar = exports.isGenericAvatar = exports.isAvatarTokenManaged = exports.isAnamAvatar = exports.isAkoolAvatar = exports.AgentSession = exports.Agent = void 0;
24
- exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = exports.MiniMaxTTS = exports.MicrosoftTTS = exports.HumeAITTS = exports.GoogleTTS = exports.FishAudioTTS = exports.ElevenLabsTTS = exports.DeepgramTTS = exports.CartesiaTTS = exports.AmazonTTS = exports.SpeechmaticsSTT = exports.SarvamSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.GoogleSTT = exports.DeepgramSTT = exports.AssemblyAISTT = exports.AresSTT = exports.AmazonSTT = exports.XaiGrok = exports.VertexAI = exports.OpenAIRealtime = exports.GeminiLive = exports.VertexAILLM = exports.OpenAI = exports.Groq = exports.Gemini = exports.Dify = exports.CustomLLM = exports.AzureOpenAI = exports.Anthropic = exports.AmazonBedrock = exports.BaseTTS = exports.BaseSTT = exports.BaseMLLM = exports.BaseLLM = exports.BaseAvatar = void 0;
23
+ exports.HeyGenAvatar = exports.GenericAvatar = exports.AnamAvatar = exports.AkoolAvatar = exports.MAX_EXPIRY_SECONDS = exports.generateRtcToken = exports.generateConvoAIToken = exports.ExpiresIn = exports.normalizePresetInput = exports.AgentPresets = exports.TurnDetectionTypeValues = exports.ThinkOnThinkingActionInterrupt = exports.ThinkOnThinkingActionIgnore = exports.ThinkOnSpeakingActionInterrupt = exports.ThinkOnSpeakingActionIgnore = exports.ThinkOnListeningActionInterrupt = exports.ThinkOnListeningActionInject = exports.ThinkOnListeningActionIgnore = exports.SpeakPriorityValues = exports.SpeakPriorityInterrupt = exports.SpeakPriorityIgnore = exports.SpeakPriorityAppend = exports.SilenceActionValues = exports.SalModeValues = exports.MllmTurnDetectionModeValues = exports.MllmTurnDetectionModeServerVad = exports.MllmTurnDetectionModeSemanticVad = exports.MllmTurnDetectionModeAgoraVad = exports.InterruptionModeValues = exports.InterruptionModeStartOfSpeech = exports.InterruptionModeKeywords = exports.InterruptionDisabledStrategyIgnore = exports.InterruptionDisabledStrategyAppend = exports.InterruptionDisabledStrategy = exports.Geofence = exports.FillerWordsSelectionRule = exports.DataChannel = exports.AudioScenario = exports.validateTtsSampleRate = exports.validateAvatarConfig = exports.toBaseAvatarConfig = exports.isSensetimeAvatar = exports.isLiveAvatarAvatar = exports.isHeyGenAvatar = exports.isGenericAvatar = exports.isAvatarTokenManaged = exports.isAnamAvatar = exports.isAkoolAvatar = exports.AgentSession = exports.Agent = void 0;
24
+ exports.SpeechmaticsSTT = exports.SarvamSTT = exports.OpenAISTT = exports.MicrosoftSTT = exports.GoogleSTT = exports.DeepgramSTT = exports.AssemblyAISTT = exports.AresSTT = exports.AmazonSTT = exports.XaiGrok = exports.VertexAI = exports.OpenAIRealtime = exports.GeminiLive = exports.VertexAILLM = exports.OpenAI = exports.Groq = exports.Gemini = exports.Dify = exports.CustomLLM = exports.AzureOpenAI = exports.Anthropic = exports.AmazonBedrock = exports.XfyunSTT = exports.XfyunDialectSTT = exports.XfyunBigModelSTT = exports.TencentTTS = exports.TencentSTT = exports.TencentLLM = exports.StepFunTTS = exports.SensetimeAvatar = exports.MiniMaxCNTTS = exports.MicrosoftCNTTS = exports.MicrosoftCNSTT = exports.FengmingSTT = exports.DeepSeekLLM = exports.CosyVoiceTTS = exports.BytedanceTTS = exports.BytedanceLLM = exports.BytedanceDuplexTTS = exports.AliyunLLM = exports.BaseTTS = exports.BaseSTT = exports.BaseMLLM = exports.BaseLLM = exports.BaseCNTTS = exports.BaseCNSTT = exports.BaseCNLLM = exports.BaseCNAvatar = exports.BaseAvatar = exports.LiveAvatarAvatar = void 0;
25
+ exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = exports.MiniMaxTTS = exports.MicrosoftTTS = exports.HumeAITTS = exports.GoogleTTS = exports.FishAudioTTS = exports.ElevenLabsTTS = exports.DeepgramTTS = exports.CartesiaTTS = exports.AmazonTTS = void 0;
25
26
  // Core classes
26
27
  var Agent_js_1 = require("./Agent.js");
27
28
  Object.defineProperty(exports, "Agent", { enumerable: true, get: function () { return Agent_js_1.Agent; } });
@@ -34,6 +35,7 @@ Object.defineProperty(exports, "isAvatarTokenManaged", { enumerable: true, get:
34
35
  Object.defineProperty(exports, "isGenericAvatar", { enumerable: true, get: function () { return avatar_types_js_1.isGenericAvatar; } });
35
36
  Object.defineProperty(exports, "isHeyGenAvatar", { enumerable: true, get: function () { return avatar_types_js_1.isHeyGenAvatar; } });
36
37
  Object.defineProperty(exports, "isLiveAvatarAvatar", { enumerable: true, get: function () { return avatar_types_js_1.isLiveAvatarAvatar; } });
38
+ Object.defineProperty(exports, "isSensetimeAvatar", { enumerable: true, get: function () { return avatar_types_js_1.isSensetimeAvatar; } });
37
39
  Object.defineProperty(exports, "toBaseAvatarConfig", { enumerable: true, get: function () { return avatar_types_js_1.toBaseAvatarConfig; } });
38
40
  Object.defineProperty(exports, "validateAvatarConfig", { enumerable: true, get: function () { return avatar_types_js_1.validateAvatarConfig; } });
39
41
  Object.defineProperty(exports, "validateTtsSampleRate", { enumerable: true, get: function () { return avatar_types_js_1.validateTtsSampleRate; } });
@@ -86,10 +88,33 @@ Object.defineProperty(exports, "LiveAvatarAvatar", { enumerable: true, get: func
86
88
  // Base vendor classes
87
89
  var base_js_1 = require("./vendors/base.js");
88
90
  Object.defineProperty(exports, "BaseAvatar", { enumerable: true, get: function () { return base_js_1.BaseAvatar; } });
91
+ Object.defineProperty(exports, "BaseCNAvatar", { enumerable: true, get: function () { return base_js_1.BaseCNAvatar; } });
92
+ Object.defineProperty(exports, "BaseCNLLM", { enumerable: true, get: function () { return base_js_1.BaseCNLLM; } });
93
+ Object.defineProperty(exports, "BaseCNSTT", { enumerable: true, get: function () { return base_js_1.BaseCNSTT; } });
94
+ Object.defineProperty(exports, "BaseCNTTS", { enumerable: true, get: function () { return base_js_1.BaseCNTTS; } });
89
95
  Object.defineProperty(exports, "BaseLLM", { enumerable: true, get: function () { return base_js_1.BaseLLM; } });
90
96
  Object.defineProperty(exports, "BaseMLLM", { enumerable: true, get: function () { return base_js_1.BaseMLLM; } });
91
97
  Object.defineProperty(exports, "BaseSTT", { enumerable: true, get: function () { return base_js_1.BaseSTT; } });
92
98
  Object.defineProperty(exports, "BaseTTS", { enumerable: true, get: function () { return base_js_1.BaseTTS; } });
99
+ var cn_js_1 = require("./vendors/cn.js");
100
+ Object.defineProperty(exports, "AliyunLLM", { enumerable: true, get: function () { return cn_js_1.AliyunLLM; } });
101
+ Object.defineProperty(exports, "BytedanceDuplexTTS", { enumerable: true, get: function () { return cn_js_1.BytedanceDuplexTTS; } });
102
+ Object.defineProperty(exports, "BytedanceLLM", { enumerable: true, get: function () { return cn_js_1.BytedanceLLM; } });
103
+ Object.defineProperty(exports, "BytedanceTTS", { enumerable: true, get: function () { return cn_js_1.BytedanceTTS; } });
104
+ Object.defineProperty(exports, "CosyVoiceTTS", { enumerable: true, get: function () { return cn_js_1.CosyVoiceTTS; } });
105
+ Object.defineProperty(exports, "DeepSeekLLM", { enumerable: true, get: function () { return cn_js_1.DeepSeekLLM; } });
106
+ Object.defineProperty(exports, "FengmingSTT", { enumerable: true, get: function () { return cn_js_1.FengmingSTT; } });
107
+ Object.defineProperty(exports, "MicrosoftCNSTT", { enumerable: true, get: function () { return cn_js_1.MicrosoftCNSTT; } });
108
+ Object.defineProperty(exports, "MicrosoftCNTTS", { enumerable: true, get: function () { return cn_js_1.MicrosoftCNTTS; } });
109
+ Object.defineProperty(exports, "MiniMaxCNTTS", { enumerable: true, get: function () { return cn_js_1.MiniMaxCNTTS; } });
110
+ Object.defineProperty(exports, "SensetimeAvatar", { enumerable: true, get: function () { return cn_js_1.SensetimeAvatar; } });
111
+ Object.defineProperty(exports, "StepFunTTS", { enumerable: true, get: function () { return cn_js_1.StepFunTTS; } });
112
+ Object.defineProperty(exports, "TencentLLM", { enumerable: true, get: function () { return cn_js_1.TencentLLM; } });
113
+ Object.defineProperty(exports, "TencentSTT", { enumerable: true, get: function () { return cn_js_1.TencentSTT; } });
114
+ Object.defineProperty(exports, "TencentTTS", { enumerable: true, get: function () { return cn_js_1.TencentTTS; } });
115
+ Object.defineProperty(exports, "XfyunBigModelSTT", { enumerable: true, get: function () { return cn_js_1.XfyunBigModelSTT; } });
116
+ Object.defineProperty(exports, "XfyunDialectSTT", { enumerable: true, get: function () { return cn_js_1.XfyunDialectSTT; } });
117
+ Object.defineProperty(exports, "XfyunSTT", { enumerable: true, get: function () { return cn_js_1.XfyunSTT; } });
93
118
  // LLM vendor classes
94
119
  var llm_js_1 = require("./vendors/llm.js");
95
120
  Object.defineProperty(exports, "AmazonBedrock", { enumerable: true, get: function () { return llm_js_1.AmazonBedrock; } });
@@ -94,7 +94,7 @@ function omitUndefinedKeys(value) {
94
94
  }
95
95
  function inferAsrPreset(asr) {
96
96
  var _a, _b, _c;
97
- if (!asr || asr.vendor !== "deepgram" || ((_a = asr.params) === null || _a === void 0 ? void 0 : _a.api_key))
97
+ if (!asr || asr.vendor !== "deepgram" || ((_a = asr.params) === null || _a === void 0 ? void 0 : _a.key))
98
98
  return undefined;
99
99
  const preset = deepgramModelToPreset[(_c = normalizeModelName((_b = asr.params) === null || _b === void 0 ? void 0 : _b.model)) !== null && _c !== void 0 ? _c : ""];
100
100
  if (!preset)
@@ -124,7 +124,7 @@ function inferLlmPreset(llm) {
124
124
  };
125
125
  }
126
126
  function inferTtsPreset(tts) {
127
- var _a, _b, _c, _d, _e, _f;
127
+ var _a, _b, _c, _d, _e, _f, _g;
128
128
  if (!tts)
129
129
  return undefined;
130
130
  if (tts.vendor === "openai") {
@@ -143,7 +143,9 @@ function inferTtsPreset(tts) {
143
143
  if (tts.vendor === "minimax") {
144
144
  if ((_d = tts.params) === null || _d === void 0 ? void 0 : _d.key)
145
145
  return undefined;
146
- const preset = minimaxModelToPreset[(_f = normalizeModelName((_e = tts.params) === null || _e === void 0 ? void 0 : _e.model)) !== null && _f !== void 0 ? _f : ""];
146
+ // Model is no longer in params for the preset path; fall back to the top-level hint.
147
+ const model = (_g = (_f = normalizeModelName((_e = tts.params) === null || _e === void 0 ? void 0 : _e.model)) !== null && _f !== void 0 ? _f : normalizeModelName(tts._minimaxPresetModel)) !== null && _g !== void 0 ? _g : "";
148
+ const preset = minimaxModelToPreset[model];
147
149
  if (!preset)
148
150
  return undefined;
149
151
  return {
@@ -175,9 +177,14 @@ function stripInferredPresetFields(properties, inferred) {
175
177
  tts = Object.assign(Object.assign({}, tts), { params: omitUndefinedKeys(Object.assign(Object.assign({}, tts.params), { api_key: undefined, model: ttsInference.stripModel ? undefined : (_c = tts.params) === null || _c === void 0 ? void 0 : _c.model })) });
176
178
  }
177
179
  else if (ttsInference.vendor === "minimax" && tts.vendor === "minimax") {
178
- tts = Object.assign(Object.assign({}, tts), { params: omitUndefinedKeys(Object.assign(Object.assign({}, tts.params), { key: undefined, group_id: undefined, url: undefined, model: ttsInference.stripModel ? undefined : (_d = tts.params) === null || _d === void 0 ? void 0 : _d.model })) });
180
+ const _e = tts, { _minimaxPresetModel: _stripped } = _e, ttsWithoutHint = __rest(_e, ["_minimaxPresetModel"]);
181
+ tts = Object.assign(Object.assign({}, ttsWithoutHint), { params: omitUndefinedKeys(Object.assign(Object.assign({}, tts.params), { key: undefined, group_id: undefined, url: undefined, model: ttsInference.stripModel ? undefined : (_d = tts.params) === null || _d === void 0 ? void 0 : _d.model })) });
179
182
  }
180
183
  }
184
+ if (tts && "_minimaxPresetModel" in tts) {
185
+ const _f = tts, { _minimaxPresetModel: _discarded } = _f, rest = __rest(_f, ["_minimaxPresetModel"]);
186
+ tts = rest;
187
+ }
181
188
  return Object.assign(Object.assign(Object.assign(Object.assign({}, properties), (asr && { asr })), (llm && { llm })), (tts && { tts }));
182
189
  }
183
190
  function normalizePresetInput(preset) {
@@ -0,0 +1,15 @@
1
+ import type { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, BaseLLM, BaseSTT, BaseTTS } from "./vendors/base.js";
2
+ import type { MicrosoftCNSampleRate, MicrosoftCNSTT, MicrosoftCNTTS } from "./vendors/cn.js";
3
+ import type { CustomLLM } from "./vendors/llm.js";
4
+ export type GlobalLlmVendor = BaseLLM;
5
+ export type GlobalTtsVendor<SR extends number = number> = BaseTTS<SR>;
6
+ export type GlobalSttVendor = BaseSTT;
7
+ export type GlobalAvatarVendor<SR extends number = number> = BaseAvatar<SR>;
8
+ export type CNLlmVendor = BaseCNLLM | CustomLLM;
9
+ export type CNTtsVendor<SR extends number = number> = BaseCNTTS<SR> | (SR extends MicrosoftCNSampleRate ? MicrosoftCNTTS<SR> : never);
10
+ export type CNSttVendor = BaseCNSTT | MicrosoftCNSTT;
11
+ export type CNAvatarVendor<SR extends number = number> = BaseCNAvatar<SR>;
12
+ export type LlmVendor = GlobalLlmVendor | CNLlmVendor;
13
+ export type TtsVendor<SR extends number = number> = GlobalTtsVendor<SR> | CNTtsVendor<SR>;
14
+ export type SttVendor = GlobalSttVendor | CNSttVendor;
15
+ export type AvatarVendor<SR extends number = number> = GlobalAvatarVendor<SR> | CNAvatarVendor<SR>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -18,8 +18,9 @@ export declare const MAX_EXPIRY_SECONDS = 86400;
18
18
  *
19
19
  * @example
20
20
  * ```typescript
21
- * agent.createSession(client, {
22
- * channel: 'room-123',
21
+ * agent.createSession({
22
+ * name: `conversation-${Date.now()}`,
23
+ * channel: `demo-channel-${Date.now()}`,
23
24
  * agentUid: '1',
24
25
  * remoteUids: ['100'],
25
26
  * expiresIn: ExpiresIn.hours(12),
@@ -29,8 +29,9 @@ exports.MAX_EXPIRY_SECONDS = 86400;
29
29
  *
30
30
  * @example
31
31
  * ```typescript
32
- * agent.createSession(client, {
33
- * channel: 'room-123',
32
+ * agent.createSession({
33
+ * name: `conversation-${Date.now()}`,
34
+ * channel: `demo-channel-${Date.now()}`,
34
35
  * agentUid: '1',
35
36
  * remoteUids: ['100'],
36
37
  * expiresIn: ExpiresIn.hours(12),
@@ -13,6 +13,26 @@ export type LlmStyle = Llm.Style;
13
13
  * When using shorthand strings or minimal configs, the untyped variant is available.
14
14
  */
15
15
  export type SttConfig = {
16
+ vendor: "fengming";
17
+ language?: TurnDetectionLanguage;
18
+ params?: Record<string, unknown>;
19
+ } | {
20
+ vendor: "tencent";
21
+ language?: TurnDetectionLanguage;
22
+ params?: Record<string, unknown>;
23
+ } | {
24
+ vendor: "xfyun";
25
+ language?: TurnDetectionLanguage;
26
+ params?: Record<string, unknown>;
27
+ } | {
28
+ vendor: "xfyun_bigmodel";
29
+ language?: TurnDetectionLanguage;
30
+ params?: Record<string, unknown>;
31
+ } | {
32
+ vendor: "xfyun_dialect";
33
+ language?: TurnDetectionLanguage;
34
+ params?: Record<string, unknown>;
35
+ } | {
16
36
  vendor: "speechmatics";
17
37
  language?: TurnDetectionLanguage;
18
38
  params: SpeechmaticsParams;
@@ -51,8 +71,8 @@ export type SttConfig = {
51
71
  } | Asr;
52
72
  /** ASR configuration — alias for {@link SttConfig} (wire field: `asr`). */
53
73
  export type AsrConfig = SttConfig;
54
- /** STT vendor (ares, microsoft, deepgram, openai, etc.) */
55
- export type SttVendor = string;
74
+ /** Wire ASR vendor identifier (e.g. `"deepgram"`, `"fengming"`). */
75
+ export type AsrVendorName = string;
56
76
  /** TTS (Text-to-Speech) configuration - discriminated union */
57
77
  export type TtsConfig = Tts;
58
78
  /** MLLM (Multimodal LLM) configuration */
@@ -62,11 +82,14 @@ export type MllmVendor = Mllm.Vendor;
62
82
  /** Avatar configuration */
63
83
  export type AvatarConfig = StartAgentsRequest.Properties.Avatar;
64
84
  /** Avatar vendor (akool, liveavatar, anam, generic, deprecated heygen) */
65
- export type AvatarVendor = StartAgentsRequest.Properties.Avatar.Vendor;
85
+ /** Wire avatar vendor identifier (e.g. `"liveavatar"`, `"sensetime"`). */
86
+ export type AvatarWireVendor = StartAgentsRequest.Properties.Avatar.Vendor;
66
87
  /** BCP-47 language tag used by `turn_detection.language`. */
67
88
  export type TurnDetectionLanguage = AsrLanguage;
68
89
  /** Turn detection configuration */
69
- export type TurnDetectionConfig = StartAgentsRequest.Properties.TurnDetection;
90
+ export type TurnDetectionConfig = Omit<StartAgentsRequest.Properties.TurnDetection, "language"> & {
91
+ language?: TurnDetectionLanguage;
92
+ };
70
93
  /** Detailed nested config for turn detection (`turn_detection.config`) */
71
94
  export type TurnDetectionNestedConfig = StartAgentsRequest.Properties.TurnDetection.Config;
72
95
  /** Start of Speech (SoS) detection configuration (`turn_detection.config.start_of_speech`) */
@@ -189,9 +212,9 @@ export type McpServersItem = Record<string, unknown>;
189
212
  export type AgentConfig = StartAgentsRequest.Properties;
190
213
  /** Agent configuration update (for runtime updates) */
191
214
  export type AgentConfigUpdate = UpdateAgentsRequest.Properties;
192
- /** Options for creating a session */
215
+ /** Options for creating a session via {@link Agent.createSession} */
193
216
  export interface SessionOptions {
194
- /** Unique name for this agent instance (optional - resolved from agent or auto-generated) */
217
+ /** Unique agent instance name sent to the Agora API. Omit to auto-generate `agent-{timestamp}`. */
195
218
  name?: string;
196
219
  /** The channel to join */
197
220
  channel: string;
@@ -7,6 +7,8 @@
7
7
  import type { AvatarConfig } from "../types.js";
8
8
  import type { AkoolSampleRate, HeyGenSampleRate, LiveAvatarSampleRate } from "./base.js";
9
9
  import { BaseAvatar } from "./base.js";
10
+ /**
11
+ * Constructor options for HeyGen Avatar.
10
12
  /**
11
13
  * Constructor options for LiveAvatar.
12
14
  */
@@ -19,7 +21,7 @@ export interface LiveAvatarAvatarOptions {
19
21
  agoraUid: string;
20
22
  /** Avatar ConvoAI token. Omit to auto-generate at session start. */
21
23
  agoraToken?: string;
22
- /** Avatar ID */
24
+ /** HeyGen avatar ID */
23
25
  avatarId?: string;
24
26
  /** Whether to disable idle timeout (default: false) */
25
27
  disableIdleTimeout?: boolean;
@@ -67,7 +69,8 @@ export interface AkoolAvatarOptions {
67
69
  * sampleRate: 16000, // Required for Akool
68
70
  * });
69
71
  *
70
- * const agent = new Agent({ name: 'avatar-assistant' })
72
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
73
+ * const agent = new Agent({ client })
71
74
  * .withTts(tts)
72
75
  * .withAvatar(avatar);
73
76
  * ```
@@ -108,7 +111,8 @@ export declare class AkoolAvatar extends BaseAvatar<AkoolSampleRate> {
108
111
  * sampleRate: 24000, // Required for LiveAvatar
109
112
  * });
110
113
  *
111
- * const agent = new Agent({ name: 'avatar-assistant' })
114
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
115
+ * const agent = new Agent({ client })
112
116
  * .withTts(tts)
113
117
  * .withAvatar(avatar);
114
118
  * ```
@@ -166,7 +170,8 @@ export interface AnamAvatarOptions {
166
170
  * personaId: 'persona-id',
167
171
  * });
168
172
  *
169
- * const agent = new Agent({ name: 'avatar-assistant' })
173
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
174
+ * const agent = new Agent({ client })
170
175
  * .withAvatar(avatar);
171
176
  * ```
172
177
  *
@@ -32,7 +32,8 @@ const base_js_1 = require("./base.js");
32
32
  * sampleRate: 16000, // Required for Akool
33
33
  * });
34
34
  *
35
- * const agent = new Agent({ name: 'avatar-assistant' })
35
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
36
+ * const agent = new Agent({ client })
36
37
  * .withTts(tts)
37
38
  * .withAvatar(avatar);
38
39
  * ```
@@ -91,7 +92,8 @@ exports.AkoolAvatar = AkoolAvatar;
91
92
  * sampleRate: 24000, // Required for LiveAvatar
92
93
  * });
93
94
  *
94
- * const agent = new Agent({ name: 'avatar-assistant' })
95
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
96
+ * const agent = new Agent({ client })
95
97
  * .withTts(tts)
96
98
  * .withAvatar(avatar);
97
99
  * ```
@@ -172,7 +174,8 @@ exports.HeyGenAvatar = HeyGenAvatar;
172
174
  * personaId: 'persona-id',
173
175
  * });
174
176
  *
175
- * const agent = new Agent({ name: 'avatar-assistant' })
177
+ * const client = new AgoraClient({ area: Area.US, appId: '...', appCertificate: '...' });
178
+ * const agent = new Agent({ client })
176
179
  * .withAvatar(avatar);
177
180
  * ```
178
181
  *