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
@@ -0,0 +1,55 @@
1
+ import { AgoraClient } from "../../AgoraPoolClient.mjs";
2
+ import { Area } from "../../core/domain/index.mjs";
3
+ import { Agent } from "../Agent.mjs";
4
+ import { AliyunLLM, FengmingSTT, MiniMaxCNTTS } from "../vendors/cn.mjs";
5
+ import { OpenAI } from "../vendors/llm.mjs";
6
+ import { DeepgramSTT } from "../vendors/stt.mjs";
7
+ import { MiniMaxTTS } from "../vendors/tts.mjs";
8
+ const client = new AgoraClient({
9
+ area: Area.US,
10
+ appId: "app-id",
11
+ appCertificate: "app-certificate",
12
+ });
13
+ new Agent({ client, turnDetection: { language: "en-US" } })
14
+ .withStt(new DeepgramSTT({ model: "nova-3", language: "en-US" }))
15
+ .withLlm(new OpenAI({ model: "gpt-5-mini" }))
16
+ .withTts(new MiniMaxTTS({ model: "speech-2.6-turbo", voiceId: "English_captivating_female1" }))
17
+ .createSession({
18
+ name: "assistant",
19
+ channel: "test-room",
20
+ agentUid: "1",
21
+ remoteUids: ["100"],
22
+ });
23
+ // Area and provider may differ.
24
+ new Agent({ client }).withStt(new FengmingSTT());
25
+ new Agent({ client }).withLlm(new AliyunLLM({ url: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions", model: "qwen-plus" }));
26
+ new Agent({ client }).withTts(new MiniMaxCNTTS({ key: "minimax-key", model: "speech-01-turbo", voiceSetting: { voice_id: "female-shaonv" } }));
27
+ {
28
+ const client = new AgoraClient({
29
+ area: Area.CN,
30
+ appId: "app-id",
31
+ appCertificate: "app-certificate",
32
+ });
33
+ new Agent({ client, turnDetection: { language: "zh-CN" } })
34
+ .withStt(new FengmingSTT())
35
+ .withLlm(new AliyunLLM({
36
+ url: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
37
+ model: "qwen-plus",
38
+ }))
39
+ .withTts(new MiniMaxCNTTS({
40
+ key: "minimax-key",
41
+ model: "speech-01-turbo",
42
+ voiceSetting: { voice_id: "female-shaonv" },
43
+ audioSetting: { sample_rate: 16000 },
44
+ }))
45
+ .createSession({
46
+ name: "assistant",
47
+ channel: "cn-room",
48
+ agentUid: "1",
49
+ remoteUids: ["100"],
50
+ });
51
+ new Agent({ client }).withStt(new DeepgramSTT({ model: "nova-3", language: "en-US" }));
52
+ new Agent({ client }).withLlm(new OpenAI({ model: "gpt-5-mini" }));
53
+ new Agent({ client }).withTts(new MiniMaxTTS({ model: "speech-2.6-turbo", voiceId: "English_captivating_female1" }));
54
+ }
55
+ new Agent({ client }).withStt(new DeepgramSTT({ model: "nova-3", language: "en-US" }));
@@ -0,0 +1,124 @@
1
+ import { AgoraClient } from "../../AgoraPoolClient.mjs";
2
+ import { Area } from "../../core/domain/index.mjs";
3
+ import { Agent } from "../Agent.mjs";
4
+ import { AliyunLLM, FengmingSTT, MiniMaxCNTTS } from "../vendors/cn.mjs";
5
+ import { OpenAI } from "../vendors/llm.mjs";
6
+ import { DeepgramSTT } from "../vendors/stt.mjs";
7
+ import { MiniMaxTTS } from "../vendors/tts.mjs";
8
+ const AGENT_PROMPT = "You are a concise, technically credible voice assistant. Keep replies short unless the user asks for detail.";
9
+ const GREETING = "Hi there! I am your Agora voice assistant. How can I help?";
10
+ const SUPPORT_PROMPT = "You are a concise support assistant.";
11
+ const client = new AgoraClient({
12
+ area: Area.US,
13
+ appId: "app-id",
14
+ appCertificate: "app-certificate",
15
+ });
16
+ new Agent({
17
+ client,
18
+ turnDetection: {
19
+ language: "en-US",
20
+ config: {
21
+ speech_threshold: 0.5,
22
+ start_of_speech: {
23
+ mode: "vad",
24
+ vad_config: {
25
+ interrupt_duration_ms: 160,
26
+ prefix_padding_ms: 300,
27
+ },
28
+ },
29
+ end_of_speech: {
30
+ mode: "vad",
31
+ vad_config: {
32
+ silence_duration_ms: 480,
33
+ },
34
+ },
35
+ },
36
+ },
37
+ advancedFeatures: {
38
+ enable_rtm: true,
39
+ enable_tools: true,
40
+ },
41
+ parameters: {
42
+ data_channel: "rtm",
43
+ enable_error_message: true,
44
+ },
45
+ })
46
+ .withStt(new DeepgramSTT({ model: "nova-3", language: "en" }))
47
+ .withLlm(new OpenAI({
48
+ model: "gpt-4o-mini",
49
+ systemMessages: [{ role: "system", content: AGENT_PROMPT }],
50
+ greetingMessage: GREETING,
51
+ failureMessage: "Please wait a moment.",
52
+ maxHistory: 50,
53
+ params: {
54
+ max_tokens: 1024,
55
+ temperature: 0.7,
56
+ top_p: 0.95,
57
+ },
58
+ }))
59
+ .withTts(new MiniMaxTTS({
60
+ model: "speech_2_6_turbo",
61
+ voiceId: "English_captivating_female1",
62
+ }))
63
+ .createSession({
64
+ name: `conversation-${Date.now()}`,
65
+ channel: `demo-channel-${Date.now()}`,
66
+ agentUid: "123456",
67
+ remoteUids: ["*"],
68
+ idleTimeout: 30,
69
+ });
70
+ {
71
+ const client = new AgoraClient({
72
+ area: Area.CN,
73
+ appId: "app-id",
74
+ appCertificate: "app-certificate",
75
+ });
76
+ new Agent({
77
+ client,
78
+ turnDetection: { language: "zh-CN" },
79
+ })
80
+ .withStt(new FengmingSTT())
81
+ .withLlm(new AliyunLLM({
82
+ url: "https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions",
83
+ model: "qwen-plus",
84
+ }))
85
+ .withTts(new MiniMaxCNTTS({
86
+ key: "minimax-key",
87
+ model: "speech-01-turbo",
88
+ voiceSetting: { voice_id: "female-shaonv" },
89
+ audioSetting: { sample_rate: 16000 },
90
+ }))
91
+ .createSession({
92
+ name: `conversation-${Date.now()}`,
93
+ channel: `demo-channel-${Date.now()}`,
94
+ agentUid: "1001",
95
+ remoteUids: ["100"],
96
+ });
97
+ }
98
+ {
99
+ const client = new AgoraClient({
100
+ area: Area.US,
101
+ appId: "app-id",
102
+ appCertificate: "app-certificate",
103
+ });
104
+ new Agent({ client, turnDetection: { language: "en-US" } })
105
+ .withStt(new DeepgramSTT({
106
+ apiKey: "deepgram-key",
107
+ model: "nova-3",
108
+ language: "en",
109
+ }))
110
+ .withLlm(new OpenAI({
111
+ apiKey: "openai-key",
112
+ url: "https://api.openai.com/v1/chat/completions",
113
+ model: "gpt-4o-mini",
114
+ systemMessages: [{ role: "system", content: SUPPORT_PROMPT }],
115
+ greetingMessage: GREETING,
116
+ maxTokens: 1024,
117
+ temperature: 0.7,
118
+ topP: 0.95,
119
+ }))
120
+ .withTts(new MiniMaxTTS({
121
+ model: "speech_2_6_turbo",
122
+ voiceId: "English_captivating_female1",
123
+ }));
124
+ }
@@ -11,17 +11,24 @@
11
11
  * 2. Run: npm run build
12
12
  * 3. TypeScript should show errors for the uncommented invalid sections
13
13
  */
14
+ import { AgoraClient } from "../../AgoraPoolClient.mjs";
15
+ import { Area } from "../../core/domain/index.mjs";
14
16
  import { Agent } from "../Agent.mjs";
15
17
  import { AkoolAvatar, LiveAvatarAvatar } from "../vendors/avatar.mjs";
16
18
  import { OpenAI } from "../vendors/llm.mjs";
17
19
  import { DeepgramSTT } from "../vendors/stt.mjs";
18
20
  import { CartesiaTTS, ElevenLabsTTS, MicrosoftTTS, MiniMaxTTS, OpenAITTS } from "../vendors/tts.mjs";
21
+ const TEST_AGENT_CLIENT = new AgoraClient({
22
+ area: Area.US,
23
+ appId: "test-app-id",
24
+ appCertificate: "test-app-certificate",
25
+ });
19
26
  // ============================================
20
27
  // ✅ VALID CONFIGURATIONS
21
28
  // ============================================
22
29
  // Example 1: ElevenLabs 24kHz + HeyGen avatar
23
30
  function _validExample1() {
24
- return new Agent({ instructions: "Test" })
31
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
25
32
  .withTts(new ElevenLabsTTS({
26
33
  key: "test",
27
34
  modelId: "eleven_flash_v2_5",
@@ -37,7 +44,7 @@ function _validExample1() {
37
44
  }
38
45
  // Example 2: ElevenLabs 16kHz + Akool avatar
39
46
  function _validExample2() {
40
- return new Agent({ instructions: "Test" })
47
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
41
48
  .withTts(new ElevenLabsTTS({
42
49
  key: "test",
43
50
  modelId: "eleven_flash_v2_5",
@@ -51,7 +58,7 @@ function _validExample2() {
51
58
  }
52
59
  // Example 3: Microsoft 24kHz + HeyGen avatar
53
60
  function _validExample3() {
54
- return new Agent({ instructions: "Test" })
61
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
55
62
  .withTts(new MicrosoftTTS({
56
63
  key: "test",
57
64
  region: "eastus",
@@ -66,7 +73,7 @@ function _validExample3() {
66
73
  }
67
74
  // Example 4: OpenAI (fixed 24kHz) + HeyGen avatar
68
75
  function _validExample4() {
69
- return new Agent({ instructions: "Test" })
76
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
70
77
  .withTts(new OpenAITTS({
71
78
  apiKey: "test",
72
79
  voice: "alloy",
@@ -81,7 +88,7 @@ function _validExample4() {
81
88
  }
82
89
  // Example 5: Cartesia 16kHz + Akool avatar
83
90
  function _validExample5() {
84
- return new Agent({ instructions: "Test" })
91
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
85
92
  .withTts(new CartesiaTTS({
86
93
  apiKey: "test",
87
94
  voiceId: "test",
@@ -129,7 +136,7 @@ new MiniMaxTTS({
129
136
  /*
130
137
  // @ts-expect-error - HeyGen requires 24kHz, but TTS is configured for 16kHz
131
138
  function invalidMismatch1(): Agent<24000> {
132
- return new Agent({ instructions: "Test" })
139
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
133
140
  .withTts(
134
141
  new ElevenLabsTTS({
135
142
  key: "test",
@@ -151,7 +158,7 @@ function invalidMismatch1(): Agent<24000> {
151
158
  /*
152
159
  // @ts-expect-error - Akool requires 16kHz, but TTS is configured for 24kHz
153
160
  function invalidMismatch2(): Agent<16000> {
154
- return new Agent({ instructions: "Test" })
161
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
155
162
  .withTts(
156
163
  new ElevenLabsTTS({
157
164
  key: "test",
@@ -171,7 +178,7 @@ function invalidMismatch2(): Agent<16000> {
171
178
  /*
172
179
  // @ts-expect-error - HeyGen requires 24kHz, not 48kHz
173
180
  function invalidMismatch3(): Agent<24000> {
174
- return new Agent({ instructions: "Test" })
181
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
175
182
  .withTts(
176
183
  new MicrosoftTTS({
177
184
  key: "test",
@@ -196,7 +203,7 @@ function invalidMismatch3(): Agent<24000> {
196
203
  /*
197
204
  // @ts-expect-error - 25000 is not a valid ElevenLabs sample rate
198
205
  function invalidEnum1() {
199
- return new Agent({ instructions: "Test" }).withTts(
206
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(
200
207
  new ElevenLabsTTS({
201
208
  key: "test",
202
209
  modelId: "eleven_flash_v2_5",
@@ -210,7 +217,7 @@ function invalidEnum1() {
210
217
  /*
211
218
  // @ts-expect-error - 8000 is not a valid Microsoft sample rate
212
219
  function invalidEnum2() {
213
- return new Agent({ instructions: "Test" }).withTts(
220
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(
214
221
  new MicrosoftTTS({
215
222
  key: "test",
216
223
  region: "eastus",
@@ -223,7 +230,7 @@ function invalidEnum2() {
223
230
  /*
224
231
  // @ts-expect-error - 32000 is not a valid Cartesia sample rate
225
232
  function invalidEnum3() {
226
- return new Agent({ instructions: "Test" }).withTts(
233
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(
227
234
  new CartesiaTTS({
228
235
  key: "test",
229
236
  voiceId: "test",
@@ -238,7 +245,7 @@ function invalidEnum3() {
238
245
  // ============================================
239
246
  // Avatar without TTS configured (allowed)
240
247
  function _edgeCase1() {
241
- return new Agent({ instructions: "Test" }).withAvatar(new LiveAvatarAvatar({
248
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withAvatar(new LiveAvatarAvatar({
242
249
  apiKey: "test",
243
250
  quality: "high",
244
251
  agoraUid: "12345",
@@ -246,7 +253,7 @@ function _edgeCase1() {
246
253
  }
247
254
  // TTS without avatar (allowed)
248
255
  function _edgeCase2() {
249
- return new Agent({ instructions: "Test" }).withTts(new ElevenLabsTTS({
256
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(new ElevenLabsTTS({
250
257
  key: "test",
251
258
  modelId: "eleven_flash_v2_5",
252
259
  voiceId: "test",
@@ -256,7 +263,7 @@ function _edgeCase2() {
256
263
  }
257
264
  // Method chaining preserves type tracking
258
265
  function _edgeCase3() {
259
- return new Agent({ instructions: "Test" })
266
+ return new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" })
260
267
  .withTts(new ElevenLabsTTS({
261
268
  key: "test",
262
269
  modelId: "eleven_flash_v2_5",
@@ -276,7 +283,7 @@ function _edgeCase3() {
276
283
  // Type inference verification
277
284
  // ============================================
278
285
  function _typeInference1() {
279
- const agentWith24k = new Agent({ instructions: "Test" }).withTts(new ElevenLabsTTS({
286
+ const agentWith24k = new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(new ElevenLabsTTS({
280
287
  key: "test",
281
288
  modelId: "eleven_flash_v2_5",
282
289
  voiceId: "test",
@@ -288,7 +295,7 @@ function _typeInference1() {
288
295
  return agentWith24k;
289
296
  }
290
297
  function _typeInference2() {
291
- const agentWith16k = new Agent({ instructions: "Test" }).withTts(new ElevenLabsTTS({
298
+ const agentWith16k = new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(new ElevenLabsTTS({
292
299
  key: "test",
293
300
  modelId: "eleven_flash_v2_5",
294
301
  voiceId: "test",
@@ -300,7 +307,7 @@ function _typeInference2() {
300
307
  return agentWith16k;
301
308
  }
302
309
  function _typeInference3() {
303
- const openAIAgent = new Agent({ instructions: "Test" }).withTts(new OpenAITTS({
310
+ const openAIAgent = new Agent({ client: TEST_AGENT_CLIENT, instructions: "Test" }).withTts(new OpenAITTS({
304
311
  apiKey: "test",
305
312
  voice: "alloy",
306
313
  model: "gpt-4o-mini-tts",
@@ -0,0 +1,4 @@
1
+ import type { Area } from "../core/domain/index.mjs";
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 @@
1
+ export {};
@@ -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.mjs";
7
8
  import type { AvatarConfig as BaseAvatarConfig } from "./types.mjs";
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?: {
@@ -34,6 +34,12 @@ export function isAnamAvatar(config) {
34
34
  export function isGenericAvatar(config) {
35
35
  return config.vendor === "generic";
36
36
  }
37
+ /**
38
+ * Helper type guard to check if an avatar config is for SenseTime (CN).
39
+ */
40
+ export function isSensetimeAvatar(config) {
41
+ return config.vendor === "sensetime";
42
+ }
37
43
  /**
38
44
  * Returns true when AgentKit manages the avatar's RTC publisher identity
39
45
  * (i.e. fills `agora_token`, validates uniqueness against the agent UID).
@@ -41,7 +47,7 @@ export function isGenericAvatar(config) {
41
47
  * Mirrors the Go and Python SDK gate so all language SDKs behave identically.
42
48
  */
43
49
  export function isAvatarTokenManaged(config) {
44
- return isHeyGenAvatar(config) || isLiveAvatarAvatar(config) || isGenericAvatar(config);
50
+ return isHeyGenAvatar(config) || isLiveAvatarAvatar(config) || isGenericAvatar(config) || isSensetimeAvatar(config);
45
51
  }
46
52
  /**
47
53
  * Validates avatar configuration at runtime.
@@ -49,7 +55,8 @@ export function isAvatarTokenManaged(config) {
49
55
  * for cases where types are bypassed or data comes from external sources.
50
56
  *
51
57
  * @param options.requireSessionFields - When true, require fields AgentKit
52
- * fills during `AgentSession.start()` for Generic avatars.
58
+ * fills during `AgentSession.start()` for Generic avatars (`agora_appid`,
59
+ * `agora_channel`, `agora_token`).
53
60
  * @throws {Error} If the configuration is invalid
54
61
  */
55
62
  export function validateAvatarConfig(config, options = {}) {
@@ -105,6 +112,20 @@ export function validateAvatarConfig(config, options = {}) {
105
112
  }
106
113
  }
107
114
  }
115
+ else if (isSensetimeAvatar(config)) {
116
+ if (!config.params.agora_uid) {
117
+ throw new Error("SenseTime avatar requires agora_uid");
118
+ }
119
+ if (!config.params.appId) {
120
+ throw new Error("SenseTime avatar requires appId");
121
+ }
122
+ if (!config.params.app_key) {
123
+ throw new Error("SenseTime avatar requires app_key");
124
+ }
125
+ if (!Array.isArray(config.params.sceneList) || config.params.sceneList.length === 0) {
126
+ throw new Error("SenseTime avatar requires a non-empty sceneList");
127
+ }
128
+ }
108
129
  }
109
130
  /**
110
131
  * Validates that TTS sample rate is compatible with the avatar vendor.
@@ -23,18 +23,21 @@ export type { AgentOptions } from "./Agent.mjs";
23
23
  export { Agent } from "./Agent.mjs";
24
24
  export type { AgentSessionEvent, AgentSessionEventHandler, AgentSessionOptions, } from "./AgentSession.mjs";
25
25
  export { AgentSession } from "./AgentSession.mjs";
26
- export type { AkoolAvatarConfig, AnamAvatarConfig, GenericAvatarConfig, HeyGenAvatarConfig, LiveAvatarAvatarConfig, StrictAvatarConfig, } from "./avatar-types.mjs";
27
- export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
26
+ export type { AkoolAvatarConfig, AnamAvatarConfig, GenericAvatarConfig, HeyGenAvatarConfig, LiveAvatarAvatarConfig, SensetimeAvatarConfig, StrictAvatarConfig, } from "./avatar-types.mjs";
27
+ export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
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.mjs";
29
- export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPresetModel, OpenAIPresetModel, OpenAITtsPresetModel, PresetInput, TtsPreset, } from "./presets.mjs";
29
+ export type { AgentPreset, AsrPreset, DeepgramPresetModel, LlmPreset, MiniMaxPresetModel, OpenAIPresetModel, OpenAITtsPresetModel, PresetCategory, PresetInput, TtsPreset, } from "./presets.mjs";
30
30
  export { AgentPresets, normalizePresetInput } from "./presets.mjs";
31
+ export type { AvatarVendor, CNAvatarVendor, CNLlmVendor, CNSttVendor, CNTtsVendor, GlobalAvatarVendor, GlobalLlmVendor, GlobalSttVendor, GlobalTtsVendor, LlmVendor, SttVendor, TtsVendor, } from "./region-vendors.mjs";
31
32
  export type { GenerateConvoAITokenOptions, GenerateTokenOptions, } from "./token.mjs";
32
33
  export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS, } from "./token.mjs";
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.mjs";
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.mjs";
34
35
  export type { AkoolAvatarOptions, AnamAvatarOptions, GenericAvatarOptions, HeyGenAvatarOptions, LiveAvatarAvatarOptions, } from "./vendors/avatar.mjs";
35
36
  export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LiveAvatarAvatar, } from "./vendors/avatar.mjs";
36
37
  export type { AkoolSampleRate, CartesiaSampleRate, ElevenLabsSampleRate, HeyGenSampleRate, LiveAvatarSampleRate, MicrosoftSampleRate, SampleRate, } from "./vendors/base.mjs";
37
- export { BaseAvatar, BaseLLM, type BaseLlmOptions, BaseMLLM, BaseSTT, BaseTTS, type GoogleTTSSampleRate, } from "./vendors/base.mjs";
38
+ export { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, BaseLLM, type BaseLlmOptions, BaseMLLM, BaseSTT, BaseTTS, type GoogleTTSSampleRate, } from "./vendors/base.mjs";
39
+ export type { AliyunLLMOptions, BytedanceDuplexTTSOptions, BytedanceLLMOptions, BytedanceTTSOptions, CosyVoiceTTSOptions, DeepSeekLLMOptions, MicrosoftCNSampleRate, MicrosoftCNSTTOptions, MicrosoftCNTTSOptions, MiniMaxCNTTSOptions, SensetimeAvatarOptions, StepFunTTSOptions, TencentLLMOptions, TencentSTTOptions, TencentTTSOptions, XfyunBigModelSTTOptions, XfyunDialectSTTOptions, XfyunSTTOptions, } from "./vendors/cn.mjs";
40
+ export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, SensetimeAvatar, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./vendors/cn.mjs";
38
41
  export type { AmazonBedrockOptions, AnthropicOptions, AzureOpenAIOptions, CustomLLMOptions, DifyOptions, GeminiOptions, GroqOptions, OpenAIOptions, VertexAILLMOptions, } from "./vendors/llm.mjs";
39
42
  export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.mjs";
40
43
  export type { GeminiLiveOptions, OpenAIRealtimeOptions, VertexAIOptions, XaiGrokOptions, } from "./vendors/mllm.mjs";
@@ -21,7 +21,7 @@
21
21
  // Core classes
22
22
  export { Agent } from "./Agent.mjs";
23
23
  export { AgentSession } from "./AgentSession.mjs";
24
- export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
24
+ export { isAkoolAvatar, isAnamAvatar, isAvatarTokenManaged, isGenericAvatar, isHeyGenAvatar, isLiveAvatarAvatar, isSensetimeAvatar, toBaseAvatarConfig, validateAvatarConfig, validateTtsSampleRate, } from "./avatar-types.mjs";
25
25
  // Type-safe constants
26
26
  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.mjs";
27
27
  export { AgentPresets, normalizePresetInput } from "./presets.mjs";
@@ -30,7 +30,8 @@ export { ExpiresIn, generateConvoAIToken, generateRtcToken, MAX_EXPIRY_SECONDS,
30
30
  // Avatar vendor classes
31
31
  export { AkoolAvatar, AnamAvatar, GenericAvatar, HeyGenAvatar, LiveAvatarAvatar, } from "./vendors/avatar.mjs";
32
32
  // Base vendor classes
33
- export { BaseAvatar, BaseLLM, BaseMLLM, BaseSTT, BaseTTS, } from "./vendors/base.mjs";
33
+ export { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, BaseLLM, BaseMLLM, BaseSTT, BaseTTS, } from "./vendors/base.mjs";
34
+ export { AliyunLLM, BytedanceDuplexTTS, BytedanceLLM, BytedanceTTS, CosyVoiceTTS, DeepSeekLLM, FengmingSTT, MicrosoftCNSTT, MicrosoftCNTTS, MiniMaxCNTTS, SensetimeAvatar, StepFunTTS, TencentLLM, TencentSTT, TencentTTS, XfyunBigModelSTT, XfyunDialectSTT, XfyunSTT, } from "./vendors/cn.mjs";
34
35
  // LLM vendor classes
35
36
  export { AmazonBedrock, Anthropic, AzureOpenAI, CustomLLM, Dify, Gemini, Groq, OpenAI, VertexAILLM, } from "./vendors/llm.mjs";
36
37
  // MLLM vendor classes
@@ -85,7 +85,7 @@ function omitUndefinedKeys(value) {
85
85
  }
86
86
  export function inferAsrPreset(asr) {
87
87
  var _a, _b, _c;
88
- if (!asr || asr.vendor !== "deepgram" || ((_a = asr.params) === null || _a === void 0 ? void 0 : _a.api_key))
88
+ if (!asr || asr.vendor !== "deepgram" || ((_a = asr.params) === null || _a === void 0 ? void 0 : _a.key))
89
89
  return undefined;
90
90
  const preset = deepgramModelToPreset[(_c = normalizeModelName((_b = asr.params) === null || _b === void 0 ? void 0 : _b.model)) !== null && _c !== void 0 ? _c : ""];
91
91
  if (!preset)
@@ -115,7 +115,7 @@ export function inferLlmPreset(llm) {
115
115
  };
116
116
  }
117
117
  export function inferTtsPreset(tts) {
118
- var _a, _b, _c, _d, _e, _f;
118
+ var _a, _b, _c, _d, _e, _f, _g;
119
119
  if (!tts)
120
120
  return undefined;
121
121
  if (tts.vendor === "openai") {
@@ -134,7 +134,9 @@ export function inferTtsPreset(tts) {
134
134
  if (tts.vendor === "minimax") {
135
135
  if ((_d = tts.params) === null || _d === void 0 ? void 0 : _d.key)
136
136
  return undefined;
137
- const preset = minimaxModelToPreset[(_f = normalizeModelName((_e = tts.params) === null || _e === void 0 ? void 0 : _e.model)) !== null && _f !== void 0 ? _f : ""];
137
+ // Model is no longer in params for the preset path; fall back to the top-level hint.
138
+ 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 : "";
139
+ const preset = minimaxModelToPreset[model];
138
140
  if (!preset)
139
141
  return undefined;
140
142
  return {
@@ -166,9 +168,14 @@ function stripInferredPresetFields(properties, inferred) {
166
168
  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 })) });
167
169
  }
168
170
  else if (ttsInference.vendor === "minimax" && tts.vendor === "minimax") {
169
- 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 })) });
171
+ const _e = tts, { _minimaxPresetModel: _stripped } = _e, ttsWithoutHint = __rest(_e, ["_minimaxPresetModel"]);
172
+ 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 })) });
170
173
  }
171
174
  }
175
+ if (tts && "_minimaxPresetModel" in tts) {
176
+ const _f = tts, { _minimaxPresetModel: _discarded } = _f, rest = __rest(_f, ["_minimaxPresetModel"]);
177
+ tts = rest;
178
+ }
172
179
  return Object.assign(Object.assign(Object.assign(Object.assign({}, properties), (asr && { asr })), (llm && { llm })), (tts && { tts }));
173
180
  }
174
181
  export function normalizePresetInput(preset) {
@@ -0,0 +1,15 @@
1
+ import type { BaseAvatar, BaseCNAvatar, BaseCNLLM, BaseCNSTT, BaseCNTTS, BaseLLM, BaseSTT, BaseTTS } from "./vendors/base.mjs";
2
+ import type { MicrosoftCNSampleRate, MicrosoftCNSTT, MicrosoftCNTTS } from "./vendors/cn.mjs";
3
+ import type { CustomLLM } from "./vendors/llm.mjs";
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 @@
1
+ export {};
@@ -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),
@@ -20,8 +20,9 @@ export const MAX_EXPIRY_SECONDS = 86400;
20
20
  *
21
21
  * @example
22
22
  * ```typescript
23
- * agent.createSession(client, {
24
- * channel: 'room-123',
23
+ * agent.createSession({
24
+ * name: `conversation-${Date.now()}`,
25
+ * channel: `demo-channel-${Date.now()}`,
25
26
  * agentUid: '1',
26
27
  * remoteUids: ['100'],
27
28
  * expiresIn: ExpiresIn.hours(12),