agora-agents 2.2.0 → 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 (232) hide show
  1. package/README.md +48 -26
  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/Client.js +8 -16
  6. package/dist/cjs/agentkit/Agent.d.ts +52 -51
  7. package/dist/cjs/agentkit/Agent.js +46 -44
  8. package/dist/cjs/agentkit/AgentSession.d.ts +11 -10
  9. package/dist/cjs/agentkit/AgentSession.js +12 -6
  10. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.d.ts +1 -0
  11. package/dist/cjs/agentkit/__tests__/area-aware-vendors.test.js +57 -0
  12. package/dist/cjs/agentkit/__tests__/readme-examples.test.d.ts +1 -0
  13. package/dist/cjs/agentkit/__tests__/readme-examples.test.js +126 -0
  14. package/dist/cjs/agentkit/__tests__/type-safety.test.js +24 -17
  15. package/dist/cjs/agentkit/area.d.ts +4 -0
  16. package/dist/cjs/agentkit/area.js +2 -0
  17. package/dist/cjs/agentkit/avatar-types.d.ts +43 -4
  18. package/dist/cjs/agentkit/avatar-types.js +52 -2
  19. package/dist/cjs/agentkit/index.d.ts +12 -9
  20. package/dist/cjs/agentkit/index.js +32 -2
  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 +47 -9
  26. package/dist/cjs/agentkit/vendors/avatar.d.ts +9 -6
  27. package/dist/cjs/agentkit/vendors/avatar.js +9 -6
  28. package/dist/cjs/agentkit/vendors/base.d.ts +42 -5
  29. package/dist/cjs/agentkit/vendors/base.js +64 -6
  30. package/dist/cjs/agentkit/vendors/cn.d.ts +269 -0
  31. package/dist/cjs/agentkit/vendors/cn.js +313 -0
  32. package/dist/cjs/agentkit/vendors/llm.d.ts +1 -1
  33. package/dist/cjs/agentkit/vendors/llm.js +13 -3
  34. package/dist/cjs/agentkit/vendors/mllm.d.ts +8 -4
  35. package/dist/cjs/agentkit/vendors/mllm.js +10 -6
  36. package/dist/cjs/agentkit/vendors/stt.d.ts +31 -0
  37. package/dist/cjs/agentkit/vendors/stt.js +31 -1
  38. package/dist/cjs/agentkit/vendors/tts.d.ts +63 -3
  39. package/dist/cjs/agentkit/vendors/tts.js +42 -1
  40. package/dist/cjs/api/resources/agents/client/requests/ListAgentsRequest.d.ts +2 -3
  41. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +23 -3
  42. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +12 -0
  43. package/dist/cjs/api/resources/agents/types/GetHistoryAgentsResponse.d.ts +6 -0
  44. package/dist/cjs/api/resources/agents/types/index.d.ts +0 -1
  45. package/dist/cjs/api/resources/agents/types/index.js +0 -1
  46. package/dist/cjs/api/types/Asr.d.ts +19 -1
  47. package/dist/cjs/api/types/BytedanceDuplexTts.d.ts +9 -0
  48. package/dist/cjs/api/types/BytedanceDuplexTts.js +3 -0
  49. package/dist/cjs/api/types/BytedanceDuplexTtsParams.d.ts +13 -0
  50. package/dist/cjs/api/types/BytedanceDuplexTtsParams.js +3 -0
  51. package/dist/cjs/api/types/BytedanceTts.d.ts +9 -0
  52. package/dist/cjs/api/types/BytedanceTts.js +3 -0
  53. package/dist/cjs/api/types/BytedanceTtsParams.d.ts +23 -0
  54. package/dist/cjs/api/types/BytedanceTtsParams.js +3 -0
  55. package/dist/cjs/api/types/CosyvoiceTts.d.ts +9 -0
  56. package/dist/cjs/api/types/CosyvoiceTts.js +3 -0
  57. package/dist/cjs/api/types/CosyvoiceTtsParams.d.ts +15 -0
  58. package/dist/cjs/api/types/CosyvoiceTtsParams.js +3 -0
  59. package/dist/cjs/api/types/FengmingAsr.d.ts +11 -0
  60. package/dist/cjs/api/types/FengmingAsr.js +3 -0
  61. package/dist/cjs/api/types/GenericTts.d.ts +13 -0
  62. package/dist/cjs/api/types/GenericTts.js +3 -0
  63. package/dist/cjs/api/types/GenericTtsParams.d.ts +21 -0
  64. package/dist/cjs/api/types/GenericTtsParams.js +3 -0
  65. package/dist/cjs/api/types/Llm.d.ts +24 -1
  66. package/dist/cjs/api/types/Llm.js +8 -0
  67. package/dist/cjs/api/types/MinimaxTtsParams.d.ts +52 -3
  68. package/dist/cjs/api/types/OpenAiTtsParams.d.ts +1 -1
  69. package/dist/cjs/api/types/SensetimeAvatarParams.d.ts +48 -0
  70. package/dist/cjs/api/types/SensetimeAvatarParams.js +3 -0
  71. package/dist/cjs/api/types/SpatiusAvatarParams.d.ts +23 -0
  72. package/dist/cjs/api/types/SpatiusAvatarParams.js +3 -0
  73. package/dist/cjs/api/types/StepfunTts.d.ts +9 -0
  74. package/dist/cjs/api/types/StepfunTts.js +3 -0
  75. package/dist/cjs/api/types/StepfunTtsParams.d.ts +13 -0
  76. package/dist/cjs/api/types/StepfunTtsParams.js +3 -0
  77. package/dist/cjs/api/types/TencentAsr.d.ts +10 -0
  78. package/dist/cjs/api/types/TencentAsr.js +3 -0
  79. package/dist/cjs/api/types/TencentAsrParams.d.ts +17 -0
  80. package/dist/cjs/api/types/TencentAsrParams.js +3 -0
  81. package/dist/cjs/api/types/TencentTts.d.ts +9 -0
  82. package/dist/cjs/api/types/TencentTts.js +3 -0
  83. package/dist/cjs/api/types/TencentTtsParams.d.ts +23 -0
  84. package/dist/cjs/api/types/TencentTtsParams.js +3 -0
  85. package/dist/cjs/api/types/Tts.d.ts +22 -1
  86. package/dist/cjs/api/types/XAiAsr.d.ts +10 -0
  87. package/dist/cjs/api/types/XAiAsr.js +3 -0
  88. package/dist/cjs/api/types/XAiAsrParams.d.ts +15 -0
  89. package/dist/cjs/api/types/XAiAsrParams.js +3 -0
  90. package/dist/cjs/api/types/XAiTts.d.ts +9 -0
  91. package/dist/cjs/api/types/XAiTts.js +3 -0
  92. package/dist/cjs/api/types/XAiTtsParams.d.ts +15 -0
  93. package/dist/cjs/api/types/XAiTtsParams.js +3 -0
  94. package/dist/cjs/api/types/XfyunAsr.d.ts +10 -0
  95. package/dist/cjs/api/types/XfyunAsr.js +3 -0
  96. package/dist/cjs/api/types/XfyunAsrParams.d.ts +15 -0
  97. package/dist/cjs/api/types/XfyunAsrParams.js +3 -0
  98. package/dist/cjs/api/types/XfyunBigmodelAsr.d.ts +10 -0
  99. package/dist/cjs/api/types/XfyunBigmodelAsr.js +3 -0
  100. package/dist/cjs/api/types/XfyunBigmodelAsrParams.d.ts +17 -0
  101. package/dist/cjs/api/types/XfyunBigmodelAsrParams.js +3 -0
  102. package/dist/cjs/api/types/XfyunDialectAsr.d.ts +10 -0
  103. package/dist/cjs/api/types/XfyunDialectAsr.js +3 -0
  104. package/dist/cjs/api/types/XfyunDialectAsrParams.d.ts +15 -0
  105. package/dist/cjs/api/types/XfyunDialectAsrParams.js +3 -0
  106. package/dist/cjs/api/types/index.d.ts +27 -0
  107. package/dist/cjs/api/types/index.js +27 -0
  108. package/dist/cjs/core/base64.js +1 -5
  109. package/dist/cjs/core/domain/index.d.ts +2 -1
  110. package/dist/cjs/core/domain/index.js +5 -3
  111. package/dist/cjs/index.d.ts +3 -2
  112. package/dist/cjs/index.js +31 -2
  113. package/dist/cjs/version.d.ts +1 -1
  114. package/dist/cjs/version.js +1 -1
  115. package/dist/esm/AgoraPoolClient.d.mts +9 -6
  116. package/dist/esm/AgoraPoolClient.mjs +1 -0
  117. package/dist/esm/BaseClient.mjs +2 -2
  118. package/dist/esm/Client.mjs +8 -16
  119. package/dist/esm/agentkit/Agent.d.mts +52 -51
  120. package/dist/esm/agentkit/Agent.mjs +46 -44
  121. package/dist/esm/agentkit/AgentSession.d.mts +11 -10
  122. package/dist/esm/agentkit/AgentSession.mjs +13 -7
  123. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.d.mts +1 -0
  124. package/dist/esm/agentkit/__tests__/area-aware-vendors.test.mjs +55 -0
  125. package/dist/esm/agentkit/__tests__/readme-examples.test.d.mts +1 -0
  126. package/dist/esm/agentkit/__tests__/readme-examples.test.mjs +124 -0
  127. package/dist/esm/agentkit/__tests__/type-safety.test.mjs +24 -17
  128. package/dist/esm/agentkit/area.d.mts +4 -0
  129. package/dist/esm/agentkit/area.mjs +1 -0
  130. package/dist/esm/agentkit/avatar-types.d.mts +43 -4
  131. package/dist/esm/agentkit/avatar-types.mjs +50 -2
  132. package/dist/esm/agentkit/index.d.mts +12 -9
  133. package/dist/esm/agentkit/index.mjs +5 -4
  134. package/dist/esm/agentkit/region-vendors.d.mts +15 -0
  135. package/dist/esm/agentkit/region-vendors.mjs +1 -0
  136. package/dist/esm/agentkit/token.d.mts +3 -2
  137. package/dist/esm/agentkit/token.mjs +3 -2
  138. package/dist/esm/agentkit/types.d.mts +47 -9
  139. package/dist/esm/agentkit/vendors/avatar.d.mts +9 -6
  140. package/dist/esm/agentkit/vendors/avatar.mjs +9 -6
  141. package/dist/esm/agentkit/vendors/base.d.mts +42 -5
  142. package/dist/esm/agentkit/vendors/base.mjs +59 -5
  143. package/dist/esm/agentkit/vendors/cn.d.mts +269 -0
  144. package/dist/esm/agentkit/vendors/cn.mjs +291 -0
  145. package/dist/esm/agentkit/vendors/llm.d.mts +1 -1
  146. package/dist/esm/agentkit/vendors/llm.mjs +13 -3
  147. package/dist/esm/agentkit/vendors/mllm.d.mts +8 -4
  148. package/dist/esm/agentkit/vendors/mllm.mjs +10 -6
  149. package/dist/esm/agentkit/vendors/stt.d.mts +31 -0
  150. package/dist/esm/agentkit/vendors/stt.mjs +29 -0
  151. package/dist/esm/agentkit/vendors/tts.d.mts +63 -3
  152. package/dist/esm/agentkit/vendors/tts.mjs +39 -0
  153. package/dist/esm/api/resources/agents/client/requests/ListAgentsRequest.d.mts +2 -3
  154. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +23 -3
  155. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +12 -0
  156. package/dist/esm/api/resources/agents/types/GetHistoryAgentsResponse.d.mts +6 -0
  157. package/dist/esm/api/resources/agents/types/index.d.mts +0 -1
  158. package/dist/esm/api/resources/agents/types/index.mjs +0 -1
  159. package/dist/esm/api/types/Asr.d.mts +19 -1
  160. package/dist/esm/api/types/BytedanceDuplexTts.d.mts +9 -0
  161. package/dist/esm/api/types/BytedanceDuplexTts.mjs +2 -0
  162. package/dist/esm/api/types/BytedanceDuplexTtsParams.d.mts +13 -0
  163. package/dist/esm/api/types/BytedanceDuplexTtsParams.mjs +2 -0
  164. package/dist/esm/api/types/BytedanceTts.d.mts +9 -0
  165. package/dist/esm/api/types/BytedanceTts.mjs +2 -0
  166. package/dist/esm/api/types/BytedanceTtsParams.d.mts +23 -0
  167. package/dist/esm/api/types/BytedanceTtsParams.mjs +2 -0
  168. package/dist/esm/api/types/CosyvoiceTts.d.mts +9 -0
  169. package/dist/esm/api/types/CosyvoiceTts.mjs +2 -0
  170. package/dist/esm/api/types/CosyvoiceTtsParams.d.mts +15 -0
  171. package/dist/esm/api/types/CosyvoiceTtsParams.mjs +2 -0
  172. package/dist/esm/api/types/FengmingAsr.d.mts +11 -0
  173. package/dist/esm/api/types/FengmingAsr.mjs +2 -0
  174. package/dist/esm/api/types/GenericTts.d.mts +13 -0
  175. package/dist/esm/api/types/GenericTts.mjs +2 -0
  176. package/dist/esm/api/types/GenericTtsParams.d.mts +21 -0
  177. package/dist/esm/api/types/GenericTtsParams.mjs +2 -0
  178. package/dist/esm/api/types/Llm.d.mts +24 -1
  179. package/dist/esm/api/types/Llm.mjs +8 -0
  180. package/dist/esm/api/types/MinimaxTtsParams.d.mts +52 -3
  181. package/dist/esm/api/types/OpenAiTtsParams.d.mts +1 -1
  182. package/dist/esm/api/types/SensetimeAvatarParams.d.mts +48 -0
  183. package/dist/esm/api/types/SensetimeAvatarParams.mjs +2 -0
  184. package/dist/esm/api/types/SpatiusAvatarParams.d.mts +23 -0
  185. package/dist/esm/api/types/SpatiusAvatarParams.mjs +2 -0
  186. package/dist/esm/api/types/StepfunTts.d.mts +9 -0
  187. package/dist/esm/api/types/StepfunTts.mjs +2 -0
  188. package/dist/esm/api/types/StepfunTtsParams.d.mts +13 -0
  189. package/dist/esm/api/types/StepfunTtsParams.mjs +2 -0
  190. package/dist/esm/api/types/TencentAsr.d.mts +10 -0
  191. package/dist/esm/api/types/TencentAsr.mjs +2 -0
  192. package/dist/esm/api/types/TencentAsrParams.d.mts +17 -0
  193. package/dist/esm/api/types/TencentAsrParams.mjs +2 -0
  194. package/dist/esm/api/types/TencentTts.d.mts +9 -0
  195. package/dist/esm/api/types/TencentTts.mjs +2 -0
  196. package/dist/esm/api/types/TencentTtsParams.d.mts +23 -0
  197. package/dist/esm/api/types/TencentTtsParams.mjs +2 -0
  198. package/dist/esm/api/types/Tts.d.mts +22 -1
  199. package/dist/esm/api/types/XAiAsr.d.mts +10 -0
  200. package/dist/esm/api/types/XAiAsr.mjs +2 -0
  201. package/dist/esm/api/types/XAiAsrParams.d.mts +15 -0
  202. package/dist/esm/api/types/XAiAsrParams.mjs +2 -0
  203. package/dist/esm/api/types/XAiTts.d.mts +9 -0
  204. package/dist/esm/api/types/XAiTts.mjs +2 -0
  205. package/dist/esm/api/types/XAiTtsParams.d.mts +15 -0
  206. package/dist/esm/api/types/XAiTtsParams.mjs +2 -0
  207. package/dist/esm/api/types/XfyunAsr.d.mts +10 -0
  208. package/dist/esm/api/types/XfyunAsr.mjs +2 -0
  209. package/dist/esm/api/types/XfyunAsrParams.d.mts +15 -0
  210. package/dist/esm/api/types/XfyunAsrParams.mjs +2 -0
  211. package/dist/esm/api/types/XfyunBigmodelAsr.d.mts +10 -0
  212. package/dist/esm/api/types/XfyunBigmodelAsr.mjs +2 -0
  213. package/dist/esm/api/types/XfyunBigmodelAsrParams.d.mts +17 -0
  214. package/dist/esm/api/types/XfyunBigmodelAsrParams.mjs +2 -0
  215. package/dist/esm/api/types/XfyunDialectAsr.d.mts +10 -0
  216. package/dist/esm/api/types/XfyunDialectAsr.mjs +2 -0
  217. package/dist/esm/api/types/XfyunDialectAsrParams.d.mts +15 -0
  218. package/dist/esm/api/types/XfyunDialectAsrParams.mjs +2 -0
  219. package/dist/esm/api/types/index.d.mts +27 -0
  220. package/dist/esm/api/types/index.mjs +27 -0
  221. package/dist/esm/core/base64.mjs +1 -5
  222. package/dist/esm/core/domain/index.d.mts +2 -1
  223. package/dist/esm/core/domain/index.mjs +4 -2
  224. package/dist/esm/index.d.mts +3 -2
  225. package/dist/esm/index.mjs +6 -6
  226. package/dist/esm/version.d.mts +1 -1
  227. package/dist/esm/version.mjs +1 -1
  228. package/package.json +1 -1
  229. package/dist/cjs/api/resources/agents/types/ListAgentsRequestState.d.ts +0 -10
  230. package/dist/cjs/api/resources/agents/types/ListAgentsRequestState.js +0 -13
  231. package/dist/esm/api/resources/agents/types/ListAgentsRequestState.d.mts +0 -10
  232. package/dist/esm/api/resources/agents/types/ListAgentsRequestState.mjs +0 -10
@@ -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,8 @@
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";
8
+ import type { SpatiusAvatarParams } from "../api/types/SpatiusAvatarParams.js";
7
9
  import type { AvatarConfig as BaseAvatarConfig } from "./types.js";
8
10
  /**
9
11
  * HeyGen-specific avatar configuration (legacy wire vendor `heygen`).
@@ -73,8 +75,8 @@ export interface AnamAvatarConfig {
73
75
  params: {
74
76
  /** API key for Anam authentication (required) */
75
77
  api_key: string;
76
- /** Anam persona ID (optional) */
77
- persona_id?: string;
78
+ /** Anam avatar ID (optional) */
79
+ avatar_id?: string;
78
80
  [key: string]: unknown;
79
81
  };
80
82
  }
@@ -123,11 +125,39 @@ export interface GenericAvatarConfig {
123
125
  [key: string]: unknown;
124
126
  };
125
127
  }
128
+ /**
129
+ * SenseTime-specific avatar configuration (CN).
130
+ */
131
+ export interface SensetimeAvatarConfig {
132
+ enable?: boolean;
133
+ vendor: "sensetime";
134
+ params: {
135
+ /** RTC UID for the avatar video publisher (required) */
136
+ agora_uid: string;
137
+ /** Avatar ConvoAI token (filled by AgentKit at session start when omitted) */
138
+ agora_token?: string;
139
+ /** SenseTime application ID (required) */
140
+ appId: string;
141
+ /** SenseTime application key (required) */
142
+ app_key: string;
143
+ /** SenseTime scene configuration list (optional) */
144
+ sceneList?: SensetimeAvatarParams.SceneList.Item[];
145
+ [key: string]: unknown;
146
+ };
147
+ }
148
+ /**
149
+ * Spatius-specific avatar configuration.
150
+ */
151
+ export interface SpatiusAvatarConfig {
152
+ enable?: boolean;
153
+ vendor: "spatius";
154
+ params: SpatiusAvatarParams;
155
+ }
126
156
  /**
127
157
  * Discriminated union of all avatar configurations.
128
158
  * TypeScript will enforce vendor-specific constraints based on the vendor field.
129
159
  */
130
- export type StrictAvatarConfig = HeyGenAvatarConfig | LiveAvatarAvatarConfig | AkoolAvatarConfig | AnamAvatarConfig | GenericAvatarConfig;
160
+ export type StrictAvatarConfig = HeyGenAvatarConfig | LiveAvatarAvatarConfig | AkoolAvatarConfig | AnamAvatarConfig | GenericAvatarConfig | SensetimeAvatarConfig | SpatiusAvatarConfig;
131
161
  /**
132
162
  * Helper type guard to check if an avatar config uses the legacy HeyGen wire vendor.
133
163
  */
@@ -148,6 +178,14 @@ export declare function isAnamAvatar(config: StrictAvatarConfig): config is Anam
148
178
  * Helper type guard to check if an avatar config is for Generic Avatar.
149
179
  */
150
180
  export declare function isGenericAvatar(config: StrictAvatarConfig): config is GenericAvatarConfig;
181
+ /**
182
+ * Helper type guard to check if an avatar config is for SenseTime (CN).
183
+ */
184
+ export declare function isSensetimeAvatar(config: StrictAvatarConfig): config is SensetimeAvatarConfig;
185
+ /**
186
+ * Helper type guard to check if an avatar config is for Spatius.
187
+ */
188
+ export declare function isSpatiusAvatar(config: StrictAvatarConfig): config is SpatiusAvatarConfig;
151
189
  /**
152
190
  * Returns true when AgentKit manages the avatar's RTC publisher identity
153
191
  * (i.e. fills `agora_token`, validates uniqueness against the agent UID).
@@ -161,7 +199,8 @@ export declare function isAvatarTokenManaged(config: StrictAvatarConfig): boolea
161
199
  * for cases where types are bypassed or data comes from external sources.
162
200
  *
163
201
  * @param options.requireSessionFields - When true, require fields AgentKit
164
- * fills during `AgentSession.start()` for Generic avatars.
202
+ * fills during `AgentSession.start()` for Generic avatars (`agora_appid`,
203
+ * `agora_channel`, `agora_token`).
165
204
  * @throws {Error} If the configuration is invalid
166
205
  */
167
206
  export declare function validateAvatarConfig(config: StrictAvatarConfig, options?: {
@@ -11,6 +11,8 @@ exports.isLiveAvatarAvatar = isLiveAvatarAvatar;
11
11
  exports.isAkoolAvatar = isAkoolAvatar;
12
12
  exports.isAnamAvatar = isAnamAvatar;
13
13
  exports.isGenericAvatar = isGenericAvatar;
14
+ exports.isSensetimeAvatar = isSensetimeAvatar;
15
+ exports.isSpatiusAvatar = isSpatiusAvatar;
14
16
  exports.isAvatarTokenManaged = isAvatarTokenManaged;
15
17
  exports.validateAvatarConfig = validateAvatarConfig;
16
18
  exports.validateTtsSampleRate = validateTtsSampleRate;
@@ -45,6 +47,18 @@ function isAnamAvatar(config) {
45
47
  function isGenericAvatar(config) {
46
48
  return config.vendor === "generic";
47
49
  }
50
+ /**
51
+ * Helper type guard to check if an avatar config is for SenseTime (CN).
52
+ */
53
+ function isSensetimeAvatar(config) {
54
+ return config.vendor === "sensetime";
55
+ }
56
+ /**
57
+ * Helper type guard to check if an avatar config is for Spatius.
58
+ */
59
+ function isSpatiusAvatar(config) {
60
+ return config.vendor === "spatius";
61
+ }
48
62
  /**
49
63
  * Returns true when AgentKit manages the avatar's RTC publisher identity
50
64
  * (i.e. fills `agora_token`, validates uniqueness against the agent UID).
@@ -52,7 +66,11 @@ function isGenericAvatar(config) {
52
66
  * Mirrors the Go and Python SDK gate so all language SDKs behave identically.
53
67
  */
54
68
  function isAvatarTokenManaged(config) {
55
- return isHeyGenAvatar(config) || isLiveAvatarAvatar(config) || isGenericAvatar(config);
69
+ return (isHeyGenAvatar(config) ||
70
+ isLiveAvatarAvatar(config) ||
71
+ isGenericAvatar(config) ||
72
+ isSensetimeAvatar(config) ||
73
+ isSpatiusAvatar(config));
56
74
  }
57
75
  /**
58
76
  * Validates avatar configuration at runtime.
@@ -60,7 +78,8 @@ function isAvatarTokenManaged(config) {
60
78
  * for cases where types are bypassed or data comes from external sources.
61
79
  *
62
80
  * @param options.requireSessionFields - When true, require fields AgentKit
63
- * fills during `AgentSession.start()` for Generic avatars.
81
+ * fills during `AgentSession.start()` for Generic avatars (`agora_appid`,
82
+ * `agora_channel`, `agora_token`).
64
83
  * @throws {Error} If the configuration is invalid
65
84
  */
66
85
  function validateAvatarConfig(config, options = {}) {
@@ -116,6 +135,37 @@ function validateAvatarConfig(config, options = {}) {
116
135
  }
117
136
  }
118
137
  }
138
+ else if (isSensetimeAvatar(config)) {
139
+ if (!config.params.agora_uid) {
140
+ throw new Error("SenseTime avatar requires agora_uid");
141
+ }
142
+ if (!config.params.appId) {
143
+ throw new Error("SenseTime avatar requires appId");
144
+ }
145
+ if (!config.params.app_key) {
146
+ throw new Error("SenseTime avatar requires app_key");
147
+ }
148
+ if (config.params.sceneList !== undefined && !Array.isArray(config.params.sceneList)) {
149
+ throw new Error("SenseTime avatar sceneList must be an array when provided");
150
+ }
151
+ }
152
+ else if (isSpatiusAvatar(config)) {
153
+ if (!config.params.agora_uid) {
154
+ throw new Error("Spatius avatar requires agora_uid");
155
+ }
156
+ if (!config.params.spatius_api_key) {
157
+ throw new Error("Spatius avatar requires spatius_api_key");
158
+ }
159
+ if (!config.params.spatius_app_id) {
160
+ throw new Error("Spatius avatar requires spatius_app_id");
161
+ }
162
+ if (!config.params.spatius_avatar_id) {
163
+ throw new Error("Spatius avatar requires spatius_avatar_id");
164
+ }
165
+ if (options.requireSessionFields && !config.params.agora_token) {
166
+ throw new Error("Spatius avatar requires agora_token after session enrichment");
167
+ }
168
+ }
119
169
  }
120
170
  /**
121
171
  * Validates that TTS sample rate is compatible with the avatar vendor.
@@ -23,23 +23,26 @@ 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, SpatiusAvatarConfig, StrictAvatarConfig, } from "./avatar-types.js";
27
+ export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, isSpatiusAvatar, 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, GenericTts, GenericTtsParams, 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, SpatiusAvatarParams, SpeakPriority, StartOfSpeechConfig, StartOfSpeechDisabledConfig, StartOfSpeechDisabledConfigStrategy, StartOfSpeechKeywordsConfig, StartOfSpeechMode, StartOfSpeechVadConfig, SttConfig, ThinkOnListeningAction, ThinkOnSpeakingAction, ThinkOnThinkingAction, ThinkOptions, ThinkResponse, TtsConfig, TurnDetectionConfig, TurnDetectionLanguage, TurnDetectionNestedConfig, TurnDetectionType, XAiAsr, XAiAsrParams, XAiTts, XAiTtsParams, } 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, SpatiusAvatarOptions, StepFunTTSOptions, TencentLLMOptions, TencentSTTOptions, TencentTTSOptions, XfyunBigModelSTTOptions, XfyunDialectSTTOptions, XfyunSTTOptions, } from "./vendors/cn.js";
40
+ export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, SensetimeAvatar, SpatiusAvatar, 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";
41
44
  export { GeminiLive, OpenAIRealtime, VertexAI, XaiGrok, } from "./vendors/mllm.js";
42
- export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, SarvamSTTOptions, SpeechmaticsSTTOptions, } from "./vendors/stt.js";
43
- export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GoogleSTT, MicrosoftSTT, OpenAISTT, SarvamSTT, SpeechmaticsSTT, } from "./vendors/stt.js";
44
- export type { AmazonTTSOptions, CartesiaTTSOptions, DeepgramTTSOptions, ElevenLabsTTSOptions, FishAudioTTSOptions, GoogleTTSOptions, HumeAITTSOptions, MicrosoftTTSOptions, MiniMaxTTSOptions, MurfTTSOptions, OpenAITTSOptions, RimeTTSOptions, SarvamTTSOptions, } from "./vendors/tts.js";
45
- export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GoogleTTS, HumeAITTS, MicrosoftTTS, MiniMaxTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, } from "./vendors/tts.js";
45
+ export type { AmazonSTTOptions, AresSTTOptions, AssemblyAISTTOptions, DeepgramSTTOptions, GoogleSTTOptions, MicrosoftSTTOptions, OpenAISTTOptions, SarvamSTTOptions, SpeechmaticsSTTOptions, XAiSTTOptions, } from "./vendors/stt.js";
46
+ export { AmazonSTT, AresSTT, AssemblyAISTT, DeepgramSTT, GoogleSTT, MicrosoftSTT, OpenAISTT, SarvamSTT, SpeechmaticsSTT, XAiSTT, } from "./vendors/stt.js";
47
+ export type { AmazonTTSOptions, CartesiaTTSOptions, DeepgramTTSOptions, ElevenLabsTTSOptions, FishAudioTTSOptions, GenericTTSOptions, GoogleTTSOptions, HumeAITTSOptions, MicrosoftTTSOptions, MiniMaxTTSOptions, MurfTTSOptions, OpenAITTSOptions, RimeTTSOptions, SarvamTTSOptions, XAiTTSOptions, } from "./vendors/tts.js";
48
+ export { AmazonTTS, CartesiaTTS, DeepgramTTS, ElevenLabsTTS, FishAudioTTS, GenericTTS, GoogleTTS, HumeAITTS, MicrosoftTTS, MiniMaxTTS, MurfTTS, OpenAITTS, RimeTTS, SarvamTTS, XAiTTS, } from "./vendors/tts.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.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.isSpatiusAvatar = exports.isSensetimeAvatar = exports.isLiveAvatarAvatar = exports.isHeyGenAvatar = exports.isGenericAvatar = exports.isAvatarTokenManaged = exports.isAnamAvatar = exports.isAkoolAvatar = exports.AgentSession = exports.Agent = void 0;
24
+ 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.SpatiusAvatar = 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 = exports.HeyGenAvatar = void 0;
25
+ exports.XAiTTS = exports.SarvamTTS = exports.RimeTTS = exports.OpenAITTS = exports.MurfTTS = exports.MiniMaxTTS = exports.MicrosoftTTS = exports.HumeAITTS = exports.GoogleTTS = exports.GenericTTS = exports.FishAudioTTS = exports.ElevenLabsTTS = exports.DeepgramTTS = exports.CartesiaTTS = exports.AmazonTTS = exports.XAiSTT = exports.SpeechmaticsSTT = exports.SarvamSTT = 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,8 @@ 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; } });
39
+ Object.defineProperty(exports, "isSpatiusAvatar", { enumerable: true, get: function () { return avatar_types_js_1.isSpatiusAvatar; } });
37
40
  Object.defineProperty(exports, "toBaseAvatarConfig", { enumerable: true, get: function () { return avatar_types_js_1.toBaseAvatarConfig; } });
38
41
  Object.defineProperty(exports, "validateAvatarConfig", { enumerable: true, get: function () { return avatar_types_js_1.validateAvatarConfig; } });
39
42
  Object.defineProperty(exports, "validateTtsSampleRate", { enumerable: true, get: function () { return avatar_types_js_1.validateTtsSampleRate; } });
@@ -86,10 +89,34 @@ Object.defineProperty(exports, "LiveAvatarAvatar", { enumerable: true, get: func
86
89
  // Base vendor classes
87
90
  var base_js_1 = require("./vendors/base.js");
88
91
  Object.defineProperty(exports, "BaseAvatar", { enumerable: true, get: function () { return base_js_1.BaseAvatar; } });
92
+ Object.defineProperty(exports, "BaseCNAvatar", { enumerable: true, get: function () { return base_js_1.BaseCNAvatar; } });
93
+ Object.defineProperty(exports, "BaseCNLLM", { enumerable: true, get: function () { return base_js_1.BaseCNLLM; } });
94
+ Object.defineProperty(exports, "BaseCNSTT", { enumerable: true, get: function () { return base_js_1.BaseCNSTT; } });
95
+ Object.defineProperty(exports, "BaseCNTTS", { enumerable: true, get: function () { return base_js_1.BaseCNTTS; } });
89
96
  Object.defineProperty(exports, "BaseLLM", { enumerable: true, get: function () { return base_js_1.BaseLLM; } });
90
97
  Object.defineProperty(exports, "BaseMLLM", { enumerable: true, get: function () { return base_js_1.BaseMLLM; } });
91
98
  Object.defineProperty(exports, "BaseSTT", { enumerable: true, get: function () { return base_js_1.BaseSTT; } });
92
99
  Object.defineProperty(exports, "BaseTTS", { enumerable: true, get: function () { return base_js_1.BaseTTS; } });
100
+ var cn_js_1 = require("./vendors/cn.js");
101
+ Object.defineProperty(exports, "AliyunLLM", { enumerable: true, get: function () { return cn_js_1.AliyunLLM; } });
102
+ Object.defineProperty(exports, "BytedanceDuplexTTS", { enumerable: true, get: function () { return cn_js_1.BytedanceDuplexTTS; } });
103
+ Object.defineProperty(exports, "BytedanceLLM", { enumerable: true, get: function () { return cn_js_1.BytedanceLLM; } });
104
+ Object.defineProperty(exports, "BytedanceTTS", { enumerable: true, get: function () { return cn_js_1.BytedanceTTS; } });
105
+ Object.defineProperty(exports, "CosyVoiceTTS", { enumerable: true, get: function () { return cn_js_1.CosyVoiceTTS; } });
106
+ Object.defineProperty(exports, "DeepSeekLLM", { enumerable: true, get: function () { return cn_js_1.DeepSeekLLM; } });
107
+ Object.defineProperty(exports, "FengmingSTT", { enumerable: true, get: function () { return cn_js_1.FengmingSTT; } });
108
+ Object.defineProperty(exports, "MicrosoftCNSTT", { enumerable: true, get: function () { return cn_js_1.MicrosoftCNSTT; } });
109
+ Object.defineProperty(exports, "MicrosoftCNTTS", { enumerable: true, get: function () { return cn_js_1.MicrosoftCNTTS; } });
110
+ Object.defineProperty(exports, "MiniMaxCNTTS", { enumerable: true, get: function () { return cn_js_1.MiniMaxCNTTS; } });
111
+ Object.defineProperty(exports, "SensetimeAvatar", { enumerable: true, get: function () { return cn_js_1.SensetimeAvatar; } });
112
+ Object.defineProperty(exports, "SpatiusAvatar", { enumerable: true, get: function () { return cn_js_1.SpatiusAvatar; } });
113
+ Object.defineProperty(exports, "StepFunTTS", { enumerable: true, get: function () { return cn_js_1.StepFunTTS; } });
114
+ Object.defineProperty(exports, "TencentLLM", { enumerable: true, get: function () { return cn_js_1.TencentLLM; } });
115
+ Object.defineProperty(exports, "TencentSTT", { enumerable: true, get: function () { return cn_js_1.TencentSTT; } });
116
+ Object.defineProperty(exports, "TencentTTS", { enumerable: true, get: function () { return cn_js_1.TencentTTS; } });
117
+ Object.defineProperty(exports, "XfyunBigModelSTT", { enumerable: true, get: function () { return cn_js_1.XfyunBigModelSTT; } });
118
+ Object.defineProperty(exports, "XfyunDialectSTT", { enumerable: true, get: function () { return cn_js_1.XfyunDialectSTT; } });
119
+ Object.defineProperty(exports, "XfyunSTT", { enumerable: true, get: function () { return cn_js_1.XfyunSTT; } });
93
120
  // LLM vendor classes
94
121
  var llm_js_1 = require("./vendors/llm.js");
95
122
  Object.defineProperty(exports, "AmazonBedrock", { enumerable: true, get: function () { return llm_js_1.AmazonBedrock; } });
@@ -118,6 +145,7 @@ Object.defineProperty(exports, "MicrosoftSTT", { enumerable: true, get: function
118
145
  Object.defineProperty(exports, "OpenAISTT", { enumerable: true, get: function () { return stt_js_1.OpenAISTT; } });
119
146
  Object.defineProperty(exports, "SarvamSTT", { enumerable: true, get: function () { return stt_js_1.SarvamSTT; } });
120
147
  Object.defineProperty(exports, "SpeechmaticsSTT", { enumerable: true, get: function () { return stt_js_1.SpeechmaticsSTT; } });
148
+ Object.defineProperty(exports, "XAiSTT", { enumerable: true, get: function () { return stt_js_1.XAiSTT; } });
121
149
  // TTS vendor classes
122
150
  var tts_js_1 = require("./vendors/tts.js");
123
151
  Object.defineProperty(exports, "AmazonTTS", { enumerable: true, get: function () { return tts_js_1.AmazonTTS; } });
@@ -125,6 +153,7 @@ Object.defineProperty(exports, "CartesiaTTS", { enumerable: true, get: function
125
153
  Object.defineProperty(exports, "DeepgramTTS", { enumerable: true, get: function () { return tts_js_1.DeepgramTTS; } });
126
154
  Object.defineProperty(exports, "ElevenLabsTTS", { enumerable: true, get: function () { return tts_js_1.ElevenLabsTTS; } });
127
155
  Object.defineProperty(exports, "FishAudioTTS", { enumerable: true, get: function () { return tts_js_1.FishAudioTTS; } });
156
+ Object.defineProperty(exports, "GenericTTS", { enumerable: true, get: function () { return tts_js_1.GenericTTS; } });
128
157
  Object.defineProperty(exports, "GoogleTTS", { enumerable: true, get: function () { return tts_js_1.GoogleTTS; } });
129
158
  Object.defineProperty(exports, "HumeAITTS", { enumerable: true, get: function () { return tts_js_1.HumeAITTS; } });
130
159
  Object.defineProperty(exports, "MicrosoftTTS", { enumerable: true, get: function () { return tts_js_1.MicrosoftTTS; } });
@@ -133,3 +162,4 @@ Object.defineProperty(exports, "MurfTTS", { enumerable: true, get: function () {
133
162
  Object.defineProperty(exports, "OpenAITTS", { enumerable: true, get: function () { return tts_js_1.OpenAITTS; } });
134
163
  Object.defineProperty(exports, "RimeTTS", { enumerable: true, get: function () { return tts_js_1.RimeTTS; } });
135
164
  Object.defineProperty(exports, "SarvamTTS", { enumerable: true, get: function () { return tts_js_1.SarvamTTS; } });
165
+ Object.defineProperty(exports, "XAiTTS", { enumerable: true, get: function () { return tts_js_1.XAiTTS; } });
@@ -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),