agora-agents 2.0.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 (643) hide show
  1. package/README.md +202 -0
  2. package/dist/cjs/AgoraPoolClient.d.ts +130 -0
  3. package/dist/cjs/AgoraPoolClient.js +174 -0
  4. package/dist/cjs/BaseClient.d.ts +36 -0
  5. package/dist/cjs/BaseClient.js +50 -0
  6. package/dist/cjs/Client.d.ts +23 -0
  7. package/dist/cjs/Client.js +31 -0
  8. package/dist/cjs/agentkit/Agent.d.ts +415 -0
  9. package/dist/cjs/agentkit/Agent.js +645 -0
  10. package/dist/cjs/agentkit/AgentSession.d.ts +271 -0
  11. package/dist/cjs/agentkit/AgentSession.js +629 -0
  12. package/dist/cjs/agentkit/__tests__/type-safety.test.d.ts +14 -0
  13. package/dist/cjs/agentkit/__tests__/type-safety.test.js +294 -0
  14. package/dist/cjs/agentkit/avatar-types.d.ts +201 -0
  15. package/dist/cjs/agentkit/avatar-types.js +171 -0
  16. package/dist/cjs/agentkit/constants.d.ts +68 -0
  17. package/dist/cjs/agentkit/constants.js +72 -0
  18. package/dist/cjs/agentkit/index.d.ts +45 -0
  19. package/dist/cjs/agentkit/index.js +135 -0
  20. package/dist/cjs/agentkit/presets.d.ts +39 -0
  21. package/dist/cjs/agentkit/presets.js +204 -0
  22. package/dist/cjs/agentkit/token.d.ts +95 -0
  23. package/dist/cjs/agentkit/token.js +132 -0
  24. package/dist/cjs/agentkit/types.d.ts +517 -0
  25. package/dist/cjs/agentkit/types.js +6 -0
  26. package/dist/cjs/agentkit/vendors/avatar.d.ts +223 -0
  27. package/dist/cjs/agentkit/vendors/avatar.js +241 -0
  28. package/dist/cjs/agentkit/vendors/base.d.ts +157 -0
  29. package/dist/cjs/agentkit/vendors/base.js +81 -0
  30. package/dist/cjs/agentkit/vendors/llm.d.ts +300 -0
  31. package/dist/cjs/agentkit/vendors/llm.js +277 -0
  32. package/dist/cjs/agentkit/vendors/mllm.d.ts +207 -0
  33. package/dist/cjs/agentkit/vendors/mllm.js +126 -0
  34. package/dist/cjs/agentkit/vendors/stt.d.ts +272 -0
  35. package/dist/cjs/agentkit/vendors/stt.js +244 -0
  36. package/dist/cjs/agentkit/vendors/tts.d.ts +456 -0
  37. package/dist/cjs/agentkit/vendors/tts.js +313 -0
  38. package/dist/cjs/api/index.d.ts +2 -0
  39. package/dist/cjs/api/index.js +18 -0
  40. package/dist/cjs/api/resources/agentManagement/client/Client.d.ts +48 -0
  41. package/dist/cjs/api/resources/agentManagement/client/Client.js +165 -0
  42. package/dist/cjs/api/resources/agentManagement/client/index.d.ts +1 -0
  43. package/dist/cjs/api/resources/agentManagement/client/index.js +17 -0
  44. package/dist/cjs/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.d.ts +85 -0
  45. package/dist/cjs/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.js +36 -0
  46. package/dist/cjs/api/resources/agentManagement/client/requests/index.d.ts +1 -0
  47. package/dist/cjs/api/resources/agentManagement/client/requests/index.js +2 -0
  48. package/dist/cjs/api/resources/agentManagement/index.d.ts +2 -0
  49. package/dist/cjs/api/resources/agentManagement/index.js +18 -0
  50. package/dist/cjs/api/resources/agentManagement/types/AgentThinkAgentManagementResponse.d.ts +8 -0
  51. package/dist/cjs/api/resources/agentManagement/types/AgentThinkAgentManagementResponse.js +3 -0
  52. package/dist/cjs/api/resources/agentManagement/types/index.d.ts +1 -0
  53. package/dist/cjs/api/resources/agentManagement/types/index.js +17 -0
  54. package/dist/cjs/api/resources/agents/client/Client.d.ts +208 -0
  55. package/dist/cjs/api/resources/agents/client/Client.js +724 -0
  56. package/dist/cjs/api/resources/agents/client/index.d.ts +1 -0
  57. package/dist/cjs/api/resources/agents/client/index.js +17 -0
  58. package/dist/cjs/api/resources/agents/client/requests/GetAgentsRequest.d.ts +13 -0
  59. package/dist/cjs/api/resources/agents/client/requests/GetAgentsRequest.js +3 -0
  60. package/dist/cjs/api/resources/agents/client/requests/GetHistoryAgentsRequest.d.ts +13 -0
  61. package/dist/cjs/api/resources/agents/client/requests/GetHistoryAgentsRequest.js +3 -0
  62. package/dist/cjs/api/resources/agents/client/requests/GetTurnsAgentsRequest.d.ts +17 -0
  63. package/dist/cjs/api/resources/agents/client/requests/GetTurnsAgentsRequest.js +3 -0
  64. package/dist/cjs/api/resources/agents/client/requests/InterruptAgentsRequest.d.ts +13 -0
  65. package/dist/cjs/api/resources/agents/client/requests/InterruptAgentsRequest.js +3 -0
  66. package/dist/cjs/api/resources/agents/client/requests/ListAgentsRequest.d.ts +31 -0
  67. package/dist/cjs/api/resources/agents/client/requests/ListAgentsRequest.js +3 -0
  68. package/dist/cjs/api/resources/agents/client/requests/SpeakAgentsRequest.d.ts +45 -0
  69. package/dist/cjs/api/resources/agents/client/requests/SpeakAgentsRequest.js +18 -0
  70. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.d.ts +1048 -0
  71. package/dist/cjs/api/resources/agents/client/requests/StartAgentsRequest.js +335 -0
  72. package/dist/cjs/api/resources/agents/client/requests/StopAgentsRequest.d.ts +13 -0
  73. package/dist/cjs/api/resources/agents/client/requests/StopAgentsRequest.js +3 -0
  74. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentsRequest.d.ts +62 -0
  75. package/dist/cjs/api/resources/agents/client/requests/UpdateAgentsRequest.js +3 -0
  76. package/dist/cjs/api/resources/agents/client/requests/index.d.ts +9 -0
  77. package/dist/cjs/api/resources/agents/client/requests/index.js +2 -0
  78. package/dist/cjs/api/resources/agents/index.d.ts +2 -0
  79. package/dist/cjs/api/resources/agents/index.js +18 -0
  80. package/dist/cjs/api/resources/agents/types/GetAgentsResponse.d.ts +40 -0
  81. package/dist/cjs/api/resources/agents/types/GetAgentsResponse.js +24 -0
  82. package/dist/cjs/api/resources/agents/types/GetHistoryAgentsResponse.d.ts +37 -0
  83. package/dist/cjs/api/resources/agents/types/GetHistoryAgentsResponse.js +22 -0
  84. package/dist/cjs/api/resources/agents/types/GetTurnsAgentsResponse.d.ts +207 -0
  85. package/dist/cjs/api/resources/agents/types/GetTurnsAgentsResponse.js +45 -0
  86. package/dist/cjs/api/resources/agents/types/InterruptAgentsResponse.d.ts +8 -0
  87. package/dist/cjs/api/resources/agents/types/InterruptAgentsResponse.js +3 -0
  88. package/dist/cjs/api/resources/agents/types/ListAgentsRequestState.d.ts +10 -0
  89. package/dist/cjs/api/resources/agents/types/ListAgentsRequestState.js +13 -0
  90. package/dist/cjs/api/resources/agents/types/ListAgentsResponse.d.ts +53 -0
  91. package/dist/cjs/api/resources/agents/types/ListAgentsResponse.js +25 -0
  92. package/dist/cjs/api/resources/agents/types/SpeakAgentsResponse.d.ts +8 -0
  93. package/dist/cjs/api/resources/agents/types/SpeakAgentsResponse.js +3 -0
  94. package/dist/cjs/api/resources/agents/types/StartAgentsResponse.d.ts +36 -0
  95. package/dist/cjs/api/resources/agents/types/StartAgentsResponse.js +24 -0
  96. package/dist/cjs/api/resources/agents/types/UpdateAgentsResponse.d.ts +36 -0
  97. package/dist/cjs/api/resources/agents/types/UpdateAgentsResponse.js +24 -0
  98. package/dist/cjs/api/resources/agents/types/index.d.ts +9 -0
  99. package/dist/cjs/api/resources/agents/types/index.js +25 -0
  100. package/dist/cjs/api/resources/index.d.ts +12 -0
  101. package/dist/cjs/api/resources/index.js +51 -0
  102. package/dist/cjs/api/resources/phoneNumbers/client/Client.d.ts +97 -0
  103. package/dist/cjs/api/resources/phoneNumbers/client/Client.js +388 -0
  104. package/dist/cjs/api/resources/phoneNumbers/client/index.d.ts +1 -0
  105. package/dist/cjs/api/resources/phoneNumbers/client/index.js +17 -0
  106. package/dist/cjs/api/resources/phoneNumbers/client/requests/AddPhoneNumbersRequest.d.ts +83 -0
  107. package/dist/cjs/api/resources/phoneNumbers/client/requests/AddPhoneNumbersRequest.js +16 -0
  108. package/dist/cjs/api/resources/phoneNumbers/client/requests/DeletePhoneNumbersRequest.d.ts +10 -0
  109. package/dist/cjs/api/resources/phoneNumbers/client/requests/DeletePhoneNumbersRequest.js +3 -0
  110. package/dist/cjs/api/resources/phoneNumbers/client/requests/GetPhoneNumbersRequest.d.ts +10 -0
  111. package/dist/cjs/api/resources/phoneNumbers/client/requests/GetPhoneNumbersRequest.js +3 -0
  112. package/dist/cjs/api/resources/phoneNumbers/client/requests/UpdatePhoneNumbersRequest.d.ts +36 -0
  113. package/dist/cjs/api/resources/phoneNumbers/client/requests/UpdatePhoneNumbersRequest.js +3 -0
  114. package/dist/cjs/api/resources/phoneNumbers/client/requests/index.d.ts +4 -0
  115. package/dist/cjs/api/resources/phoneNumbers/client/requests/index.js +2 -0
  116. package/dist/cjs/api/resources/phoneNumbers/index.d.ts +2 -0
  117. package/dist/cjs/api/resources/phoneNumbers/index.js +18 -0
  118. package/dist/cjs/api/resources/phoneNumbers/types/AddPhoneNumbersResponse.d.ts +25 -0
  119. package/dist/cjs/api/resources/phoneNumbers/types/AddPhoneNumbersResponse.js +3 -0
  120. package/dist/cjs/api/resources/phoneNumbers/types/GetPhoneNumbersResponse.d.ts +43 -0
  121. package/dist/cjs/api/resources/phoneNumbers/types/GetPhoneNumbersResponse.js +16 -0
  122. package/dist/cjs/api/resources/phoneNumbers/types/ListPhoneNumbersResponseItem.d.ts +43 -0
  123. package/dist/cjs/api/resources/phoneNumbers/types/ListPhoneNumbersResponseItem.js +16 -0
  124. package/dist/cjs/api/resources/phoneNumbers/types/UpdatePhoneNumbersResponse.d.ts +43 -0
  125. package/dist/cjs/api/resources/phoneNumbers/types/UpdatePhoneNumbersResponse.js +16 -0
  126. package/dist/cjs/api/resources/phoneNumbers/types/index.d.ts +4 -0
  127. package/dist/cjs/api/resources/phoneNumbers/types/index.js +20 -0
  128. package/dist/cjs/api/resources/telephony/client/Client.d.ts +133 -0
  129. package/dist/cjs/api/resources/telephony/client/Client.js +416 -0
  130. package/dist/cjs/api/resources/telephony/client/index.d.ts +1 -0
  131. package/dist/cjs/api/resources/telephony/client/index.js +17 -0
  132. package/dist/cjs/api/resources/telephony/client/requests/CallTelephonyRequest.d.ts +114 -0
  133. package/dist/cjs/api/resources/telephony/client/requests/CallTelephonyRequest.js +3 -0
  134. package/dist/cjs/api/resources/telephony/client/requests/GetTelephonyRequest.d.ts +13 -0
  135. package/dist/cjs/api/resources/telephony/client/requests/GetTelephonyRequest.js +3 -0
  136. package/dist/cjs/api/resources/telephony/client/requests/HangupTelephonyRequest.d.ts +13 -0
  137. package/dist/cjs/api/resources/telephony/client/requests/HangupTelephonyRequest.js +3 -0
  138. package/dist/cjs/api/resources/telephony/client/requests/ListTelephonyRequest.d.ts +29 -0
  139. package/dist/cjs/api/resources/telephony/client/requests/ListTelephonyRequest.js +3 -0
  140. package/dist/cjs/api/resources/telephony/client/requests/index.d.ts +4 -0
  141. package/dist/cjs/api/resources/telephony/client/requests/index.js +2 -0
  142. package/dist/cjs/api/resources/telephony/index.d.ts +2 -0
  143. package/dist/cjs/api/resources/telephony/index.js +18 -0
  144. package/dist/cjs/api/resources/telephony/types/CallTelephonyResponse.d.ts +4 -0
  145. package/dist/cjs/api/resources/telephony/types/CallTelephonyResponse.js +3 -0
  146. package/dist/cjs/api/resources/telephony/types/GetTelephonyResponse.d.ts +69 -0
  147. package/dist/cjs/api/resources/telephony/types/GetTelephonyResponse.js +36 -0
  148. package/dist/cjs/api/resources/telephony/types/HangupTelephonyResponse.d.ts +1 -0
  149. package/dist/cjs/api/resources/telephony/types/HangupTelephonyResponse.js +3 -0
  150. package/dist/cjs/api/resources/telephony/types/ListTelephonyRequestType.d.ts +5 -0
  151. package/dist/cjs/api/resources/telephony/types/ListTelephonyRequestType.js +8 -0
  152. package/dist/cjs/api/resources/telephony/types/ListTelephonyResponse.d.ts +83 -0
  153. package/dist/cjs/api/resources/telephony/types/ListTelephonyResponse.js +34 -0
  154. package/dist/cjs/api/resources/telephony/types/index.d.ts +5 -0
  155. package/dist/cjs/api/resources/telephony/types/index.js +21 -0
  156. package/dist/cjs/api/types/AgentErrorResponse.d.ts +43 -0
  157. package/dist/cjs/api/types/AgentErrorResponse.js +25 -0
  158. package/dist/cjs/api/types/AmazonTts.d.ts +9 -0
  159. package/dist/cjs/api/types/AmazonTts.js +3 -0
  160. package/dist/cjs/api/types/AmazonTtsParams.d.ts +13 -0
  161. package/dist/cjs/api/types/AmazonTtsParams.js +3 -0
  162. package/dist/cjs/api/types/CartesiaTts.d.ts +9 -0
  163. package/dist/cjs/api/types/CartesiaTts.js +3 -0
  164. package/dist/cjs/api/types/CartesiaTtsParams.d.ts +13 -0
  165. package/dist/cjs/api/types/CartesiaTtsParams.js +3 -0
  166. package/dist/cjs/api/types/CartesiaTtsVoice.d.ts +9 -0
  167. package/dist/cjs/api/types/CartesiaTtsVoice.js +3 -0
  168. package/dist/cjs/api/types/DeepgramTts.d.ts +9 -0
  169. package/dist/cjs/api/types/DeepgramTts.js +3 -0
  170. package/dist/cjs/api/types/DeepgramTtsParams.d.ts +17 -0
  171. package/dist/cjs/api/types/DeepgramTtsParams.js +3 -0
  172. package/dist/cjs/api/types/ElevenLabsTts.d.ts +9 -0
  173. package/dist/cjs/api/types/ElevenLabsTts.js +3 -0
  174. package/dist/cjs/api/types/ElevenLabsTtsParams.d.ts +15 -0
  175. package/dist/cjs/api/types/ElevenLabsTtsParams.js +3 -0
  176. package/dist/cjs/api/types/FishAudioTts.d.ts +9 -0
  177. package/dist/cjs/api/types/FishAudioTts.js +3 -0
  178. package/dist/cjs/api/types/FishAudioTtsParams.d.ts +9 -0
  179. package/dist/cjs/api/types/FishAudioTtsParams.js +3 -0
  180. package/dist/cjs/api/types/GoogleTts.d.ts +9 -0
  181. package/dist/cjs/api/types/GoogleTts.js +3 -0
  182. package/dist/cjs/api/types/GoogleTtsParams.d.ts +13 -0
  183. package/dist/cjs/api/types/GoogleTtsParams.js +3 -0
  184. package/dist/cjs/api/types/HumeAiTts.d.ts +9 -0
  185. package/dist/cjs/api/types/HumeAiTts.js +3 -0
  186. package/dist/cjs/api/types/HumeAiTtsParams.d.ts +9 -0
  187. package/dist/cjs/api/types/HumeAiTtsParams.js +3 -0
  188. package/dist/cjs/api/types/MicrosoftTts.d.ts +9 -0
  189. package/dist/cjs/api/types/MicrosoftTts.js +3 -0
  190. package/dist/cjs/api/types/MicrosoftTtsParams.d.ts +13 -0
  191. package/dist/cjs/api/types/MicrosoftTtsParams.js +3 -0
  192. package/dist/cjs/api/types/MinimaxTts.d.ts +9 -0
  193. package/dist/cjs/api/types/MinimaxTts.js +3 -0
  194. package/dist/cjs/api/types/MinimaxTtsParams.d.ts +20 -0
  195. package/dist/cjs/api/types/MinimaxTtsParams.js +3 -0
  196. package/dist/cjs/api/types/MurfTts.d.ts +9 -0
  197. package/dist/cjs/api/types/MurfTts.js +3 -0
  198. package/dist/cjs/api/types/MurfTtsParams.d.ts +11 -0
  199. package/dist/cjs/api/types/MurfTtsParams.js +3 -0
  200. package/dist/cjs/api/types/OpenAiTts.d.ts +9 -0
  201. package/dist/cjs/api/types/OpenAiTts.js +3 -0
  202. package/dist/cjs/api/types/OpenAiTtsParams.d.ts +11 -0
  203. package/dist/cjs/api/types/OpenAiTtsParams.js +3 -0
  204. package/dist/cjs/api/types/RimeTts.d.ts +9 -0
  205. package/dist/cjs/api/types/RimeTts.js +3 -0
  206. package/dist/cjs/api/types/RimeTtsParams.d.ts +11 -0
  207. package/dist/cjs/api/types/RimeTtsParams.js +3 -0
  208. package/dist/cjs/api/types/SarvamTts.d.ts +9 -0
  209. package/dist/cjs/api/types/SarvamTts.js +3 -0
  210. package/dist/cjs/api/types/SarvamTtsParams.d.ts +11 -0
  211. package/dist/cjs/api/types/SarvamTtsParams.js +3 -0
  212. package/dist/cjs/api/types/TelephonyErrorResponse.d.ts +11 -0
  213. package/dist/cjs/api/types/TelephonyErrorResponse.js +3 -0
  214. package/dist/cjs/api/types/Tts.d.ts +43 -0
  215. package/dist/cjs/api/types/Tts.js +3 -0
  216. package/dist/cjs/api/types/index.d.ts +30 -0
  217. package/dist/cjs/api/types/index.js +46 -0
  218. package/dist/cjs/core/auth/AuthProvider.d.ts +4 -0
  219. package/dist/cjs/core/auth/AuthProvider.js +2 -0
  220. package/dist/cjs/core/auth/AuthRequest.d.ts +9 -0
  221. package/dist/cjs/core/auth/AuthRequest.js +2 -0
  222. package/dist/cjs/core/auth/BasicAuth.d.ts +8 -0
  223. package/dist/cjs/core/auth/BasicAuth.js +27 -0
  224. package/dist/cjs/core/auth/BearerToken.d.ts +5 -0
  225. package/dist/cjs/core/auth/BearerToken.js +15 -0
  226. package/dist/cjs/core/auth/index.d.ts +4 -0
  227. package/dist/cjs/core/auth/index.js +7 -0
  228. package/dist/cjs/core/base64.d.ts +2 -0
  229. package/dist/cjs/core/base64.js +26 -0
  230. package/dist/cjs/core/domain/index.d.ts +78 -0
  231. package/dist/cjs/core/domain/index.js +195 -0
  232. package/dist/cjs/core/exports.d.ts +2 -0
  233. package/dist/cjs/core/exports.js +18 -0
  234. package/dist/cjs/core/fetcher/APIResponse.d.ts +20 -0
  235. package/dist/cjs/core/fetcher/APIResponse.js +2 -0
  236. package/dist/cjs/core/fetcher/BinaryResponse.d.ts +20 -0
  237. package/dist/cjs/core/fetcher/BinaryResponse.js +17 -0
  238. package/dist/cjs/core/fetcher/EndpointMetadata.d.ts +13 -0
  239. package/dist/cjs/core/fetcher/EndpointMetadata.js +2 -0
  240. package/dist/cjs/core/fetcher/EndpointSupplier.d.ts +12 -0
  241. package/dist/cjs/core/fetcher/EndpointSupplier.js +22 -0
  242. package/dist/cjs/core/fetcher/Fetcher.d.ts +45 -0
  243. package/dist/cjs/core/fetcher/Fetcher.js +315 -0
  244. package/dist/cjs/core/fetcher/Headers.d.ts +2 -0
  245. package/dist/cjs/core/fetcher/Headers.js +84 -0
  246. package/dist/cjs/core/fetcher/HttpResponsePromise.d.ts +58 -0
  247. package/dist/cjs/core/fetcher/HttpResponsePromise.js +103 -0
  248. package/dist/cjs/core/fetcher/RawResponse.d.ts +29 -0
  249. package/dist/cjs/core/fetcher/RawResponse.js +44 -0
  250. package/dist/cjs/core/fetcher/ResponseWithBody.d.ts +4 -0
  251. package/dist/cjs/core/fetcher/ResponseWithBody.js +6 -0
  252. package/dist/cjs/core/fetcher/Supplier.d.ts +4 -0
  253. package/dist/cjs/core/fetcher/Supplier.js +22 -0
  254. package/dist/cjs/core/fetcher/createRequestUrl.d.ts +1 -0
  255. package/dist/cjs/core/fetcher/createRequestUrl.js +8 -0
  256. package/dist/cjs/core/fetcher/getErrorResponseBody.d.ts +1 -0
  257. package/dist/cjs/core/fetcher/getErrorResponseBody.js +45 -0
  258. package/dist/cjs/core/fetcher/getFetchFn.d.ts +1 -0
  259. package/dist/cjs/core/fetcher/getFetchFn.js +17 -0
  260. package/dist/cjs/core/fetcher/getHeader.d.ts +1 -0
  261. package/dist/cjs/core/fetcher/getHeader.js +11 -0
  262. package/dist/cjs/core/fetcher/getRequestBody.d.ts +7 -0
  263. package/dist/cjs/core/fetcher/getRequestBody.js +27 -0
  264. package/dist/cjs/core/fetcher/getResponseBody.d.ts +1 -0
  265. package/dist/cjs/core/fetcher/getResponseBody.js +55 -0
  266. package/dist/cjs/core/fetcher/index.d.ts +11 -0
  267. package/dist/cjs/core/fetcher/index.js +17 -0
  268. package/dist/cjs/core/fetcher/makeRequest.d.ts +1 -0
  269. package/dist/cjs/core/fetcher/makeRequest.js +40 -0
  270. package/dist/cjs/core/fetcher/requestWithRetries.d.ts +1 -0
  271. package/dist/cjs/core/fetcher/requestWithRetries.js +67 -0
  272. package/dist/cjs/core/fetcher/signals.d.ts +5 -0
  273. package/dist/cjs/core/fetcher/signals.js +24 -0
  274. package/dist/cjs/core/headers.d.ts +2 -0
  275. package/dist/cjs/core/headers.js +31 -0
  276. package/dist/cjs/core/index.d.ts +8 -0
  277. package/dist/cjs/core/index.js +47 -0
  278. package/dist/cjs/core/json.d.ts +15 -0
  279. package/dist/cjs/core/json.js +24 -0
  280. package/dist/cjs/core/logging/exports.d.ts +18 -0
  281. package/dist/cjs/core/logging/exports.js +45 -0
  282. package/dist/cjs/core/logging/index.d.ts +1 -0
  283. package/dist/cjs/core/logging/index.js +17 -0
  284. package/dist/cjs/core/logging/logger.d.ts +126 -0
  285. package/dist/cjs/core/logging/logger.js +144 -0
  286. package/dist/cjs/core/pagination/Page.d.ts +33 -0
  287. package/dist/cjs/core/pagination/Page.js +101 -0
  288. package/dist/cjs/core/pagination/exports.d.ts +1 -0
  289. package/dist/cjs/core/pagination/exports.js +2 -0
  290. package/dist/cjs/core/pagination/index.d.ts +1 -0
  291. package/dist/cjs/core/pagination/index.js +5 -0
  292. package/dist/cjs/core/runtime/index.d.ts +1 -0
  293. package/dist/cjs/core/runtime/index.js +5 -0
  294. package/dist/cjs/core/runtime/runtime.d.ts +9 -0
  295. package/dist/cjs/core/runtime/runtime.js +102 -0
  296. package/dist/cjs/core/url/encodePathParam.d.ts +1 -0
  297. package/dist/cjs/core/url/encodePathParam.js +21 -0
  298. package/dist/cjs/core/url/index.d.ts +3 -0
  299. package/dist/cjs/core/url/index.js +9 -0
  300. package/dist/cjs/core/url/join.d.ts +1 -0
  301. package/dist/cjs/core/url/join.js +68 -0
  302. package/dist/cjs/core/url/qs.d.ts +6 -0
  303. package/dist/cjs/core/url/qs.js +64 -0
  304. package/dist/cjs/core/utils/index.d.ts +1 -0
  305. package/dist/cjs/core/utils/index.js +5 -0
  306. package/dist/cjs/core/utils/setObjectProperty.d.ts +11 -0
  307. package/dist/cjs/core/utils/setObjectProperty.js +42 -0
  308. package/dist/cjs/environments.d.ts +4 -0
  309. package/dist/cjs/environments.js +7 -0
  310. package/dist/cjs/errors/AgoraError.d.ts +12 -0
  311. package/dist/cjs/errors/AgoraError.js +28 -0
  312. package/dist/cjs/errors/AgoraTimeoutError.d.ts +3 -0
  313. package/dist/cjs/errors/AgoraTimeoutError.js +11 -0
  314. package/dist/cjs/errors/index.d.ts +2 -0
  315. package/dist/cjs/errors/index.js +7 -0
  316. package/dist/cjs/exports.d.ts +1 -0
  317. package/dist/cjs/exports.js +17 -0
  318. package/dist/cjs/index.d.ts +10 -0
  319. package/dist/cjs/index.js +149 -0
  320. package/dist/cjs/version.d.ts +1 -0
  321. package/dist/cjs/version.js +4 -0
  322. package/dist/esm/AgoraPoolClient.d.mts +130 -0
  323. package/dist/esm/AgoraPoolClient.mjs +170 -0
  324. package/dist/esm/BaseClient.d.mts +36 -0
  325. package/dist/esm/BaseClient.mjs +14 -0
  326. package/dist/esm/Client.d.mts +23 -0
  327. package/dist/esm/Client.mjs +27 -0
  328. package/dist/esm/agentkit/Agent.d.mts +415 -0
  329. package/dist/esm/agentkit/Agent.mjs +641 -0
  330. package/dist/esm/agentkit/AgentSession.d.mts +271 -0
  331. package/dist/esm/agentkit/AgentSession.mjs +625 -0
  332. package/dist/esm/agentkit/__tests__/type-safety.test.d.mts +14 -0
  333. package/dist/esm/agentkit/__tests__/type-safety.test.mjs +292 -0
  334. package/dist/esm/agentkit/avatar-types.d.mts +201 -0
  335. package/dist/esm/agentkit/avatar-types.mjs +160 -0
  336. package/dist/esm/agentkit/constants.d.mts +68 -0
  337. package/dist/esm/agentkit/constants.mjs +69 -0
  338. package/dist/esm/agentkit/index.d.mts +45 -0
  339. package/dist/esm/agentkit/index.mjs +41 -0
  340. package/dist/esm/agentkit/presets.d.mts +39 -0
  341. package/dist/esm/agentkit/presets.mjs +199 -0
  342. package/dist/esm/agentkit/token.d.mts +95 -0
  343. package/dist/esm/agentkit/token.mjs +123 -0
  344. package/dist/esm/agentkit/types.d.mts +517 -0
  345. package/dist/esm/agentkit/types.mjs +5 -0
  346. package/dist/esm/agentkit/vendors/avatar.d.mts +223 -0
  347. package/dist/esm/agentkit/vendors/avatar.mjs +233 -0
  348. package/dist/esm/agentkit/vendors/base.d.mts +157 -0
  349. package/dist/esm/agentkit/vendors/base.mjs +73 -0
  350. package/dist/esm/agentkit/vendors/llm.d.mts +300 -0
  351. package/dist/esm/agentkit/vendors/llm.mjs +265 -0
  352. package/dist/esm/agentkit/vendors/mllm.d.mts +207 -0
  353. package/dist/esm/agentkit/vendors/mllm.mjs +119 -0
  354. package/dist/esm/agentkit/vendors/stt.d.mts +272 -0
  355. package/dist/esm/agentkit/vendors/stt.mjs +232 -0
  356. package/dist/esm/agentkit/vendors/tts.d.mts +456 -0
  357. package/dist/esm/agentkit/vendors/tts.mjs +297 -0
  358. package/dist/esm/api/index.d.mts +2 -0
  359. package/dist/esm/api/index.mjs +2 -0
  360. package/dist/esm/api/resources/agentManagement/client/Client.d.mts +48 -0
  361. package/dist/esm/api/resources/agentManagement/client/Client.mjs +128 -0
  362. package/dist/esm/api/resources/agentManagement/client/index.d.mts +1 -0
  363. package/dist/esm/api/resources/agentManagement/client/index.mjs +1 -0
  364. package/dist/esm/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.d.mts +85 -0
  365. package/dist/esm/api/resources/agentManagement/client/requests/AgentThinkAgentManagementRequest.mjs +33 -0
  366. package/dist/esm/api/resources/agentManagement/client/requests/index.d.mts +1 -0
  367. package/dist/esm/api/resources/agentManagement/client/requests/index.mjs +1 -0
  368. package/dist/esm/api/resources/agentManagement/index.d.mts +2 -0
  369. package/dist/esm/api/resources/agentManagement/index.mjs +2 -0
  370. package/dist/esm/api/resources/agentManagement/types/AgentThinkAgentManagementResponse.d.mts +8 -0
  371. package/dist/esm/api/resources/agentManagement/types/AgentThinkAgentManagementResponse.mjs +2 -0
  372. package/dist/esm/api/resources/agentManagement/types/index.d.mts +1 -0
  373. package/dist/esm/api/resources/agentManagement/types/index.mjs +1 -0
  374. package/dist/esm/api/resources/agents/client/Client.d.mts +208 -0
  375. package/dist/esm/api/resources/agents/client/Client.mjs +687 -0
  376. package/dist/esm/api/resources/agents/client/index.d.mts +1 -0
  377. package/dist/esm/api/resources/agents/client/index.mjs +1 -0
  378. package/dist/esm/api/resources/agents/client/requests/GetAgentsRequest.d.mts +13 -0
  379. package/dist/esm/api/resources/agents/client/requests/GetAgentsRequest.mjs +2 -0
  380. package/dist/esm/api/resources/agents/client/requests/GetHistoryAgentsRequest.d.mts +13 -0
  381. package/dist/esm/api/resources/agents/client/requests/GetHistoryAgentsRequest.mjs +2 -0
  382. package/dist/esm/api/resources/agents/client/requests/GetTurnsAgentsRequest.d.mts +17 -0
  383. package/dist/esm/api/resources/agents/client/requests/GetTurnsAgentsRequest.mjs +2 -0
  384. package/dist/esm/api/resources/agents/client/requests/InterruptAgentsRequest.d.mts +13 -0
  385. package/dist/esm/api/resources/agents/client/requests/InterruptAgentsRequest.mjs +2 -0
  386. package/dist/esm/api/resources/agents/client/requests/ListAgentsRequest.d.mts +31 -0
  387. package/dist/esm/api/resources/agents/client/requests/ListAgentsRequest.mjs +2 -0
  388. package/dist/esm/api/resources/agents/client/requests/SpeakAgentsRequest.d.mts +45 -0
  389. package/dist/esm/api/resources/agents/client/requests/SpeakAgentsRequest.mjs +15 -0
  390. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.d.mts +1048 -0
  391. package/dist/esm/api/resources/agents/client/requests/StartAgentsRequest.mjs +332 -0
  392. package/dist/esm/api/resources/agents/client/requests/StopAgentsRequest.d.mts +13 -0
  393. package/dist/esm/api/resources/agents/client/requests/StopAgentsRequest.mjs +2 -0
  394. package/dist/esm/api/resources/agents/client/requests/UpdateAgentsRequest.d.mts +62 -0
  395. package/dist/esm/api/resources/agents/client/requests/UpdateAgentsRequest.mjs +2 -0
  396. package/dist/esm/api/resources/agents/client/requests/index.d.mts +9 -0
  397. package/dist/esm/api/resources/agents/client/requests/index.mjs +1 -0
  398. package/dist/esm/api/resources/agents/index.d.mts +2 -0
  399. package/dist/esm/api/resources/agents/index.mjs +2 -0
  400. package/dist/esm/api/resources/agents/types/GetAgentsResponse.d.mts +40 -0
  401. package/dist/esm/api/resources/agents/types/GetAgentsResponse.mjs +21 -0
  402. package/dist/esm/api/resources/agents/types/GetHistoryAgentsResponse.d.mts +37 -0
  403. package/dist/esm/api/resources/agents/types/GetHistoryAgentsResponse.mjs +19 -0
  404. package/dist/esm/api/resources/agents/types/GetTurnsAgentsResponse.d.mts +207 -0
  405. package/dist/esm/api/resources/agents/types/GetTurnsAgentsResponse.mjs +42 -0
  406. package/dist/esm/api/resources/agents/types/InterruptAgentsResponse.d.mts +8 -0
  407. package/dist/esm/api/resources/agents/types/InterruptAgentsResponse.mjs +2 -0
  408. package/dist/esm/api/resources/agents/types/ListAgentsRequestState.d.mts +10 -0
  409. package/dist/esm/api/resources/agents/types/ListAgentsRequestState.mjs +10 -0
  410. package/dist/esm/api/resources/agents/types/ListAgentsResponse.d.mts +53 -0
  411. package/dist/esm/api/resources/agents/types/ListAgentsResponse.mjs +22 -0
  412. package/dist/esm/api/resources/agents/types/SpeakAgentsResponse.d.mts +8 -0
  413. package/dist/esm/api/resources/agents/types/SpeakAgentsResponse.mjs +2 -0
  414. package/dist/esm/api/resources/agents/types/StartAgentsResponse.d.mts +36 -0
  415. package/dist/esm/api/resources/agents/types/StartAgentsResponse.mjs +21 -0
  416. package/dist/esm/api/resources/agents/types/UpdateAgentsResponse.d.mts +36 -0
  417. package/dist/esm/api/resources/agents/types/UpdateAgentsResponse.mjs +21 -0
  418. package/dist/esm/api/resources/agents/types/index.d.mts +9 -0
  419. package/dist/esm/api/resources/agents/types/index.mjs +9 -0
  420. package/dist/esm/api/resources/index.d.mts +12 -0
  421. package/dist/esm/api/resources/index.mjs +12 -0
  422. package/dist/esm/api/resources/phoneNumbers/client/Client.d.mts +97 -0
  423. package/dist/esm/api/resources/phoneNumbers/client/Client.mjs +351 -0
  424. package/dist/esm/api/resources/phoneNumbers/client/index.d.mts +1 -0
  425. package/dist/esm/api/resources/phoneNumbers/client/index.mjs +1 -0
  426. package/dist/esm/api/resources/phoneNumbers/client/requests/AddPhoneNumbersRequest.d.mts +83 -0
  427. package/dist/esm/api/resources/phoneNumbers/client/requests/AddPhoneNumbersRequest.mjs +13 -0
  428. package/dist/esm/api/resources/phoneNumbers/client/requests/DeletePhoneNumbersRequest.d.mts +10 -0
  429. package/dist/esm/api/resources/phoneNumbers/client/requests/DeletePhoneNumbersRequest.mjs +2 -0
  430. package/dist/esm/api/resources/phoneNumbers/client/requests/GetPhoneNumbersRequest.d.mts +10 -0
  431. package/dist/esm/api/resources/phoneNumbers/client/requests/GetPhoneNumbersRequest.mjs +2 -0
  432. package/dist/esm/api/resources/phoneNumbers/client/requests/UpdatePhoneNumbersRequest.d.mts +36 -0
  433. package/dist/esm/api/resources/phoneNumbers/client/requests/UpdatePhoneNumbersRequest.mjs +2 -0
  434. package/dist/esm/api/resources/phoneNumbers/client/requests/index.d.mts +4 -0
  435. package/dist/esm/api/resources/phoneNumbers/client/requests/index.mjs +1 -0
  436. package/dist/esm/api/resources/phoneNumbers/index.d.mts +2 -0
  437. package/dist/esm/api/resources/phoneNumbers/index.mjs +2 -0
  438. package/dist/esm/api/resources/phoneNumbers/types/AddPhoneNumbersResponse.d.mts +25 -0
  439. package/dist/esm/api/resources/phoneNumbers/types/AddPhoneNumbersResponse.mjs +2 -0
  440. package/dist/esm/api/resources/phoneNumbers/types/GetPhoneNumbersResponse.d.mts +43 -0
  441. package/dist/esm/api/resources/phoneNumbers/types/GetPhoneNumbersResponse.mjs +13 -0
  442. package/dist/esm/api/resources/phoneNumbers/types/ListPhoneNumbersResponseItem.d.mts +43 -0
  443. package/dist/esm/api/resources/phoneNumbers/types/ListPhoneNumbersResponseItem.mjs +13 -0
  444. package/dist/esm/api/resources/phoneNumbers/types/UpdatePhoneNumbersResponse.d.mts +43 -0
  445. package/dist/esm/api/resources/phoneNumbers/types/UpdatePhoneNumbersResponse.mjs +13 -0
  446. package/dist/esm/api/resources/phoneNumbers/types/index.d.mts +4 -0
  447. package/dist/esm/api/resources/phoneNumbers/types/index.mjs +4 -0
  448. package/dist/esm/api/resources/telephony/client/Client.d.mts +133 -0
  449. package/dist/esm/api/resources/telephony/client/Client.mjs +379 -0
  450. package/dist/esm/api/resources/telephony/client/index.d.mts +1 -0
  451. package/dist/esm/api/resources/telephony/client/index.mjs +1 -0
  452. package/dist/esm/api/resources/telephony/client/requests/CallTelephonyRequest.d.mts +114 -0
  453. package/dist/esm/api/resources/telephony/client/requests/CallTelephonyRequest.mjs +2 -0
  454. package/dist/esm/api/resources/telephony/client/requests/GetTelephonyRequest.d.mts +13 -0
  455. package/dist/esm/api/resources/telephony/client/requests/GetTelephonyRequest.mjs +2 -0
  456. package/dist/esm/api/resources/telephony/client/requests/HangupTelephonyRequest.d.mts +13 -0
  457. package/dist/esm/api/resources/telephony/client/requests/HangupTelephonyRequest.mjs +2 -0
  458. package/dist/esm/api/resources/telephony/client/requests/ListTelephonyRequest.d.mts +29 -0
  459. package/dist/esm/api/resources/telephony/client/requests/ListTelephonyRequest.mjs +2 -0
  460. package/dist/esm/api/resources/telephony/client/requests/index.d.mts +4 -0
  461. package/dist/esm/api/resources/telephony/client/requests/index.mjs +1 -0
  462. package/dist/esm/api/resources/telephony/index.d.mts +2 -0
  463. package/dist/esm/api/resources/telephony/index.mjs +2 -0
  464. package/dist/esm/api/resources/telephony/types/CallTelephonyResponse.d.mts +4 -0
  465. package/dist/esm/api/resources/telephony/types/CallTelephonyResponse.mjs +2 -0
  466. package/dist/esm/api/resources/telephony/types/GetTelephonyResponse.d.mts +69 -0
  467. package/dist/esm/api/resources/telephony/types/GetTelephonyResponse.mjs +33 -0
  468. package/dist/esm/api/resources/telephony/types/HangupTelephonyResponse.d.mts +1 -0
  469. package/dist/esm/api/resources/telephony/types/HangupTelephonyResponse.mjs +2 -0
  470. package/dist/esm/api/resources/telephony/types/ListTelephonyRequestType.d.mts +5 -0
  471. package/dist/esm/api/resources/telephony/types/ListTelephonyRequestType.mjs +5 -0
  472. package/dist/esm/api/resources/telephony/types/ListTelephonyResponse.d.mts +83 -0
  473. package/dist/esm/api/resources/telephony/types/ListTelephonyResponse.mjs +31 -0
  474. package/dist/esm/api/resources/telephony/types/index.d.mts +5 -0
  475. package/dist/esm/api/resources/telephony/types/index.mjs +5 -0
  476. package/dist/esm/api/types/AgentErrorResponse.d.mts +43 -0
  477. package/dist/esm/api/types/AgentErrorResponse.mjs +22 -0
  478. package/dist/esm/api/types/AmazonTts.d.mts +9 -0
  479. package/dist/esm/api/types/AmazonTts.mjs +2 -0
  480. package/dist/esm/api/types/AmazonTtsParams.d.mts +13 -0
  481. package/dist/esm/api/types/AmazonTtsParams.mjs +2 -0
  482. package/dist/esm/api/types/CartesiaTts.d.mts +9 -0
  483. package/dist/esm/api/types/CartesiaTts.mjs +2 -0
  484. package/dist/esm/api/types/CartesiaTtsParams.d.mts +13 -0
  485. package/dist/esm/api/types/CartesiaTtsParams.mjs +2 -0
  486. package/dist/esm/api/types/CartesiaTtsVoice.d.mts +9 -0
  487. package/dist/esm/api/types/CartesiaTtsVoice.mjs +2 -0
  488. package/dist/esm/api/types/DeepgramTts.d.mts +9 -0
  489. package/dist/esm/api/types/DeepgramTts.mjs +2 -0
  490. package/dist/esm/api/types/DeepgramTtsParams.d.mts +17 -0
  491. package/dist/esm/api/types/DeepgramTtsParams.mjs +2 -0
  492. package/dist/esm/api/types/ElevenLabsTts.d.mts +9 -0
  493. package/dist/esm/api/types/ElevenLabsTts.mjs +2 -0
  494. package/dist/esm/api/types/ElevenLabsTtsParams.d.mts +15 -0
  495. package/dist/esm/api/types/ElevenLabsTtsParams.mjs +2 -0
  496. package/dist/esm/api/types/FishAudioTts.d.mts +9 -0
  497. package/dist/esm/api/types/FishAudioTts.mjs +2 -0
  498. package/dist/esm/api/types/FishAudioTtsParams.d.mts +9 -0
  499. package/dist/esm/api/types/FishAudioTtsParams.mjs +2 -0
  500. package/dist/esm/api/types/GoogleTts.d.mts +9 -0
  501. package/dist/esm/api/types/GoogleTts.mjs +2 -0
  502. package/dist/esm/api/types/GoogleTtsParams.d.mts +13 -0
  503. package/dist/esm/api/types/GoogleTtsParams.mjs +2 -0
  504. package/dist/esm/api/types/HumeAiTts.d.mts +9 -0
  505. package/dist/esm/api/types/HumeAiTts.mjs +2 -0
  506. package/dist/esm/api/types/HumeAiTtsParams.d.mts +9 -0
  507. package/dist/esm/api/types/HumeAiTtsParams.mjs +2 -0
  508. package/dist/esm/api/types/MicrosoftTts.d.mts +9 -0
  509. package/dist/esm/api/types/MicrosoftTts.mjs +2 -0
  510. package/dist/esm/api/types/MicrosoftTtsParams.d.mts +13 -0
  511. package/dist/esm/api/types/MicrosoftTtsParams.mjs +2 -0
  512. package/dist/esm/api/types/MinimaxTts.d.mts +9 -0
  513. package/dist/esm/api/types/MinimaxTts.mjs +2 -0
  514. package/dist/esm/api/types/MinimaxTtsParams.d.mts +20 -0
  515. package/dist/esm/api/types/MinimaxTtsParams.mjs +2 -0
  516. package/dist/esm/api/types/MurfTts.d.mts +9 -0
  517. package/dist/esm/api/types/MurfTts.mjs +2 -0
  518. package/dist/esm/api/types/MurfTtsParams.d.mts +11 -0
  519. package/dist/esm/api/types/MurfTtsParams.mjs +2 -0
  520. package/dist/esm/api/types/OpenAiTts.d.mts +9 -0
  521. package/dist/esm/api/types/OpenAiTts.mjs +2 -0
  522. package/dist/esm/api/types/OpenAiTtsParams.d.mts +11 -0
  523. package/dist/esm/api/types/OpenAiTtsParams.mjs +2 -0
  524. package/dist/esm/api/types/RimeTts.d.mts +9 -0
  525. package/dist/esm/api/types/RimeTts.mjs +2 -0
  526. package/dist/esm/api/types/RimeTtsParams.d.mts +11 -0
  527. package/dist/esm/api/types/RimeTtsParams.mjs +2 -0
  528. package/dist/esm/api/types/SarvamTts.d.mts +9 -0
  529. package/dist/esm/api/types/SarvamTts.mjs +2 -0
  530. package/dist/esm/api/types/SarvamTtsParams.d.mts +11 -0
  531. package/dist/esm/api/types/SarvamTtsParams.mjs +2 -0
  532. package/dist/esm/api/types/TelephonyErrorResponse.d.mts +11 -0
  533. package/dist/esm/api/types/TelephonyErrorResponse.mjs +2 -0
  534. package/dist/esm/api/types/Tts.d.mts +43 -0
  535. package/dist/esm/api/types/Tts.mjs +2 -0
  536. package/dist/esm/api/types/index.d.mts +30 -0
  537. package/dist/esm/api/types/index.mjs +30 -0
  538. package/dist/esm/core/auth/AuthProvider.d.mts +4 -0
  539. package/dist/esm/core/auth/AuthProvider.mjs +1 -0
  540. package/dist/esm/core/auth/AuthRequest.d.mts +9 -0
  541. package/dist/esm/core/auth/AuthRequest.mjs +1 -0
  542. package/dist/esm/core/auth/BasicAuth.d.mts +8 -0
  543. package/dist/esm/core/auth/BasicAuth.mjs +24 -0
  544. package/dist/esm/core/auth/BearerToken.d.mts +5 -0
  545. package/dist/esm/core/auth/BearerToken.mjs +12 -0
  546. package/dist/esm/core/auth/index.d.mts +4 -0
  547. package/dist/esm/core/auth/index.mjs +2 -0
  548. package/dist/esm/core/base64.d.mts +2 -0
  549. package/dist/esm/core/base64.mjs +22 -0
  550. package/dist/esm/core/domain/index.d.mts +78 -0
  551. package/dist/esm/core/domain/index.mjs +157 -0
  552. package/dist/esm/core/exports.d.mts +2 -0
  553. package/dist/esm/core/exports.mjs +2 -0
  554. package/dist/esm/core/fetcher/APIResponse.d.mts +20 -0
  555. package/dist/esm/core/fetcher/APIResponse.mjs +1 -0
  556. package/dist/esm/core/fetcher/BinaryResponse.d.mts +20 -0
  557. package/dist/esm/core/fetcher/BinaryResponse.mjs +14 -0
  558. package/dist/esm/core/fetcher/EndpointMetadata.d.mts +13 -0
  559. package/dist/esm/core/fetcher/EndpointMetadata.mjs +1 -0
  560. package/dist/esm/core/fetcher/EndpointSupplier.d.mts +12 -0
  561. package/dist/esm/core/fetcher/EndpointSupplier.mjs +19 -0
  562. package/dist/esm/core/fetcher/Fetcher.d.mts +45 -0
  563. package/dist/esm/core/fetcher/Fetcher.mjs +311 -0
  564. package/dist/esm/core/fetcher/Headers.d.mts +2 -0
  565. package/dist/esm/core/fetcher/Headers.mjs +82 -0
  566. package/dist/esm/core/fetcher/HttpResponsePromise.d.mts +58 -0
  567. package/dist/esm/core/fetcher/HttpResponsePromise.mjs +99 -0
  568. package/dist/esm/core/fetcher/RawResponse.d.mts +29 -0
  569. package/dist/esm/core/fetcher/RawResponse.mjs +40 -0
  570. package/dist/esm/core/fetcher/ResponseWithBody.d.mts +4 -0
  571. package/dist/esm/core/fetcher/ResponseWithBody.mjs +3 -0
  572. package/dist/esm/core/fetcher/Supplier.d.mts +4 -0
  573. package/dist/esm/core/fetcher/Supplier.mjs +19 -0
  574. package/dist/esm/core/fetcher/createRequestUrl.d.mts +1 -0
  575. package/dist/esm/core/fetcher/createRequestUrl.mjs +5 -0
  576. package/dist/esm/core/fetcher/getErrorResponseBody.d.mts +1 -0
  577. package/dist/esm/core/fetcher/getErrorResponseBody.mjs +42 -0
  578. package/dist/esm/core/fetcher/getFetchFn.d.mts +1 -0
  579. package/dist/esm/core/fetcher/getFetchFn.mjs +14 -0
  580. package/dist/esm/core/fetcher/getHeader.d.mts +1 -0
  581. package/dist/esm/core/fetcher/getHeader.mjs +8 -0
  582. package/dist/esm/core/fetcher/getRequestBody.d.mts +7 -0
  583. package/dist/esm/core/fetcher/getRequestBody.mjs +24 -0
  584. package/dist/esm/core/fetcher/getResponseBody.d.mts +1 -0
  585. package/dist/esm/core/fetcher/getResponseBody.mjs +52 -0
  586. package/dist/esm/core/fetcher/index.d.mts +11 -0
  587. package/dist/esm/core/fetcher/index.mjs +6 -0
  588. package/dist/esm/core/fetcher/makeRequest.d.mts +1 -0
  589. package/dist/esm/core/fetcher/makeRequest.mjs +36 -0
  590. package/dist/esm/core/fetcher/requestWithRetries.d.mts +1 -0
  591. package/dist/esm/core/fetcher/requestWithRetries.mjs +64 -0
  592. package/dist/esm/core/fetcher/signals.d.mts +5 -0
  593. package/dist/esm/core/fetcher/signals.mjs +20 -0
  594. package/dist/esm/core/headers.d.mts +2 -0
  595. package/dist/esm/core/headers.mjs +27 -0
  596. package/dist/esm/core/index.d.mts +8 -0
  597. package/dist/esm/core/index.mjs +8 -0
  598. package/dist/esm/core/json.d.mts +15 -0
  599. package/dist/esm/core/json.mjs +19 -0
  600. package/dist/esm/core/logging/exports.d.mts +18 -0
  601. package/dist/esm/core/logging/exports.mjs +9 -0
  602. package/dist/esm/core/logging/index.d.mts +1 -0
  603. package/dist/esm/core/logging/index.mjs +1 -0
  604. package/dist/esm/core/logging/logger.d.mts +126 -0
  605. package/dist/esm/core/logging/logger.mjs +138 -0
  606. package/dist/esm/core/pagination/Page.d.mts +33 -0
  607. package/dist/esm/core/pagination/Page.mjs +97 -0
  608. package/dist/esm/core/pagination/exports.d.mts +1 -0
  609. package/dist/esm/core/pagination/exports.mjs +1 -0
  610. package/dist/esm/core/pagination/index.d.mts +1 -0
  611. package/dist/esm/core/pagination/index.mjs +1 -0
  612. package/dist/esm/core/runtime/index.d.mts +1 -0
  613. package/dist/esm/core/runtime/index.mjs +1 -0
  614. package/dist/esm/core/runtime/runtime.d.mts +9 -0
  615. package/dist/esm/core/runtime/runtime.mjs +99 -0
  616. package/dist/esm/core/url/encodePathParam.d.mts +1 -0
  617. package/dist/esm/core/url/encodePathParam.mjs +18 -0
  618. package/dist/esm/core/url/index.d.mts +3 -0
  619. package/dist/esm/core/url/index.mjs +3 -0
  620. package/dist/esm/core/url/join.d.mts +1 -0
  621. package/dist/esm/core/url/join.mjs +65 -0
  622. package/dist/esm/core/url/qs.d.mts +6 -0
  623. package/dist/esm/core/url/qs.mjs +61 -0
  624. package/dist/esm/core/utils/index.d.mts +1 -0
  625. package/dist/esm/core/utils/index.mjs +1 -0
  626. package/dist/esm/core/utils/setObjectProperty.d.mts +11 -0
  627. package/dist/esm/core/utils/setObjectProperty.mjs +39 -0
  628. package/dist/esm/environments.d.mts +4 -0
  629. package/dist/esm/environments.mjs +4 -0
  630. package/dist/esm/errors/AgoraError.d.mts +12 -0
  631. package/dist/esm/errors/AgoraError.mjs +24 -0
  632. package/dist/esm/errors/AgoraTimeoutError.d.mts +3 -0
  633. package/dist/esm/errors/AgoraTimeoutError.mjs +7 -0
  634. package/dist/esm/errors/index.d.mts +2 -0
  635. package/dist/esm/errors/index.mjs +2 -0
  636. package/dist/esm/exports.d.mts +1 -0
  637. package/dist/esm/exports.mjs +1 -0
  638. package/dist/esm/index.d.mts +10 -0
  639. package/dist/esm/index.mjs +20 -0
  640. package/dist/esm/version.d.mts +1 -0
  641. package/dist/esm/version.mjs +1 -0
  642. package/package.json +71 -0
  643. package/reference.md +1389 -0
@@ -0,0 +1,292 @@
1
+ /**
2
+ * Type safety demonstrations for sample rate enforcement.
3
+ *
4
+ * This file demonstrates compile-time type checking for:
5
+ * 1. Invalid sample rates (e.g., 25000 Hz)
6
+ * 2. Avatar/TTS sample rate mismatches (e.g., 16kHz TTS + HeyGen 24kHz avatar)
7
+ * 3. Valid configurations that compile successfully
8
+ *
9
+ * To verify type checking works:
10
+ * 1. Uncomment sections marked with @ts-expect-error
11
+ * 2. Run: npm run build
12
+ * 3. TypeScript should show errors for the uncommented invalid sections
13
+ */
14
+ import { Agent } from "../Agent.mjs";
15
+ import { AkoolAvatar, LiveAvatarAvatar } from "../vendors/avatar.mjs";
16
+ import { OpenAI } from "../vendors/llm.mjs";
17
+ import { DeepgramSTT } from "../vendors/stt.mjs";
18
+ import { CartesiaTTS, ElevenLabsTTS, MicrosoftTTS, MiniMaxTTS, OpenAITTS } from "../vendors/tts.mjs";
19
+ // ============================================
20
+ // ✅ VALID CONFIGURATIONS
21
+ // ============================================
22
+ // Example 1: ElevenLabs 24kHz + HeyGen avatar
23
+ function _validExample1() {
24
+ return new Agent({ instructions: "Test" })
25
+ .withTts(new ElevenLabsTTS({
26
+ key: "test",
27
+ modelId: "eleven_flash_v2_5",
28
+ voiceId: "test",
29
+ sampleRate: 24000,
30
+ }))
31
+ .withAvatar(new LiveAvatarAvatar({
32
+ apiKey: "test",
33
+ quality: "high",
34
+ agoraUid: "12345",
35
+ }));
36
+ }
37
+ // Example 2: ElevenLabs 16kHz + Akool avatar
38
+ function _validExample2() {
39
+ return new Agent({ instructions: "Test" })
40
+ .withTts(new ElevenLabsTTS({
41
+ key: "test",
42
+ modelId: "eleven_flash_v2_5",
43
+ voiceId: "test",
44
+ sampleRate: 16000,
45
+ }))
46
+ .withAvatar(new AkoolAvatar({
47
+ apiKey: "test",
48
+ }));
49
+ }
50
+ // Example 3: Microsoft 24kHz + HeyGen avatar
51
+ function _validExample3() {
52
+ return new Agent({ instructions: "Test" })
53
+ .withTts(new MicrosoftTTS({
54
+ key: "test",
55
+ region: "eastus",
56
+ voiceName: "en-US-JennyNeural",
57
+ sampleRate: 24000,
58
+ }))
59
+ .withAvatar(new LiveAvatarAvatar({
60
+ apiKey: "test",
61
+ quality: "high",
62
+ agoraUid: "12345",
63
+ }));
64
+ }
65
+ // Example 4: OpenAI (fixed 24kHz) + HeyGen avatar
66
+ function _validExample4() {
67
+ return new Agent({ instructions: "Test" })
68
+ .withTts(new OpenAITTS({
69
+ apiKey: "test",
70
+ voice: "alloy",
71
+ }))
72
+ .withAvatar(new LiveAvatarAvatar({
73
+ apiKey: "test",
74
+ quality: "high",
75
+ agoraUid: "12345",
76
+ }));
77
+ }
78
+ // Example 5: Cartesia 16kHz + Akool avatar
79
+ function _validExample5() {
80
+ return new Agent({ instructions: "Test" })
81
+ .withTts(new CartesiaTTS({
82
+ apiKey: "test",
83
+ voiceId: "test",
84
+ sampleRate: 16000,
85
+ }))
86
+ .withAvatar(new AkoolAvatar({
87
+ apiKey: "test",
88
+ }));
89
+ }
90
+ // Agora-managed models may omit credentials.
91
+ new DeepgramSTT({ model: "nova-3" });
92
+ new OpenAI({ model: "gpt-5-mini" });
93
+ new OpenAITTS({ voice: "alloy" });
94
+ new OpenAI({ apiKey: "test", model: "gpt-5-mini", vendor: "custom" });
95
+ new MiniMaxTTS({
96
+ model: "speech-2.6-turbo",
97
+ });
98
+ // @ts-expect-error Missing apiKey is only allowed for Agora-managed Deepgram models.
99
+ new DeepgramSTT({ model: "enhanced" });
100
+ // @ts-expect-error Missing apiKey is only allowed for Agora-managed OpenAI models.
101
+ new OpenAI({ model: "gpt-4o" });
102
+ // @ts-expect-error Missing apiKey cannot be combined with a custom vendor hint.
103
+ new OpenAI({ model: "gpt-5-mini", vendor: "custom" });
104
+ // @ts-expect-error Missing apiKey cannot be combined with a custom URL.
105
+ new OpenAI({ model: "gpt-5-mini", url: "https://proxy.example.com/chat" });
106
+ // @ts-expect-error Missing apiKey is only allowed for the openai_tts_1 preset model.
107
+ new OpenAITTS({ voice: "alloy", model: "tts-1-hd" });
108
+ // @ts-expect-error Missing key is only allowed for supported MiniMax preset models.
109
+ new MiniMaxTTS({
110
+ groupId: "group",
111
+ model: "speech-02-turbo",
112
+ voiceId: "voice",
113
+ url: "wss://example.com",
114
+ });
115
+ // ============================================
116
+ // ❌ INVALID: Sample rate mismatches
117
+ // Uncomment to verify compile errors
118
+ // ============================================
119
+ /*
120
+ // @ts-expect-error - HeyGen requires 24kHz, but TTS is configured for 16kHz
121
+ function invalidMismatch1(): Agent<24000> {
122
+ return new Agent({ instructions: "Test" })
123
+ .withTts(
124
+ new ElevenLabsTTS({
125
+ key: "test",
126
+ modelId: "eleven_flash_v2_5",
127
+ voiceId: "test",
128
+ sampleRate: 16000, // ❌ Wrong rate for HeyGen
129
+ })
130
+ )
131
+ .withAvatar(
132
+ new LiveAvatarAvatar({
133
+ apiKey: "test",
134
+ quality: "high",
135
+ agoraUid: "12345",
136
+ })
137
+ );
138
+ }
139
+ */
140
+ /*
141
+ // @ts-expect-error - Akool requires 16kHz, but TTS is configured for 24kHz
142
+ function invalidMismatch2(): Agent<16000> {
143
+ return new Agent({ instructions: "Test" })
144
+ .withTts(
145
+ new ElevenLabsTTS({
146
+ key: "test",
147
+ modelId: "eleven_flash_v2_5",
148
+ voiceId: "test",
149
+ sampleRate: 24000, // ❌ Wrong rate for Akool
150
+ })
151
+ )
152
+ .withAvatar(
153
+ new AkoolAvatar({
154
+ apiKey: "test",
155
+ })
156
+ );
157
+ }
158
+ */
159
+ /*
160
+ // @ts-expect-error - HeyGen requires 24kHz, not 48kHz
161
+ function invalidMismatch3(): Agent<24000> {
162
+ return new Agent({ instructions: "Test" })
163
+ .withTts(
164
+ new MicrosoftTTS({
165
+ key: "test",
166
+ region: "eastus",
167
+ voiceName: "en-US-JennyNeural",
168
+ sampleRate: 48000, // ❌ Wrong rate for HeyGen
169
+ })
170
+ )
171
+ .withAvatar(
172
+ new LiveAvatarAvatar({
173
+ apiKey: "test",
174
+ quality: "high",
175
+ agoraUid: "12345",
176
+ })
177
+ );
178
+ }
179
+ */
180
+ // ============================================
181
+ // ❌ INVALID: Invalid enum values
182
+ // Uncomment to verify compile errors
183
+ // ============================================
184
+ /*
185
+ // @ts-expect-error - 25000 is not a valid ElevenLabs sample rate
186
+ function invalidEnum1() {
187
+ return new Agent({ instructions: "Test" }).withTts(
188
+ new ElevenLabsTTS({
189
+ key: "test",
190
+ modelId: "eleven_flash_v2_5",
191
+ voiceId: "test",
192
+ sampleRate: 25000, // ❌ Not in enum: 16000, 22050, 24000, 44100
193
+ })
194
+ );
195
+ }
196
+ */
197
+ /*
198
+ // @ts-expect-error - 8000 is not a valid Microsoft sample rate
199
+ function invalidEnum2() {
200
+ return new Agent({ instructions: "Test" }).withTts(
201
+ new MicrosoftTTS({
202
+ key: "test",
203
+ region: "eastus",
204
+ voiceName: "en-US-JennyNeural",
205
+ sampleRate: 8000, // ❌ Not in enum: 16000, 24000, 48000
206
+ })
207
+ );
208
+ }
209
+ */
210
+ /*
211
+ // @ts-expect-error - 32000 is not a valid Cartesia sample rate
212
+ function invalidEnum3() {
213
+ return new Agent({ instructions: "Test" }).withTts(
214
+ new CartesiaTTS({
215
+ key: "test",
216
+ voiceId: "test",
217
+ sampleRate: 32000, // ❌ Not in enum: 8000-48000 (specific values)
218
+ })
219
+ );
220
+ }
221
+ */
222
+ // ============================================
223
+ // ✅ VALID: Edge cases
224
+ // ============================================
225
+ // Avatar without TTS configured (allowed)
226
+ function _edgeCase1() {
227
+ return new Agent({ instructions: "Test" }).withAvatar(new LiveAvatarAvatar({
228
+ apiKey: "test",
229
+ quality: "high",
230
+ agoraUid: "12345",
231
+ }));
232
+ }
233
+ // TTS without avatar (allowed)
234
+ function _edgeCase2() {
235
+ return new Agent({ instructions: "Test" }).withTts(new ElevenLabsTTS({
236
+ key: "test",
237
+ modelId: "eleven_flash_v2_5",
238
+ voiceId: "test",
239
+ sampleRate: 16000,
240
+ }));
241
+ }
242
+ // Method chaining preserves type tracking
243
+ function _edgeCase3() {
244
+ return new Agent({ instructions: "Test" })
245
+ .withTts(new ElevenLabsTTS({
246
+ key: "test",
247
+ modelId: "eleven_flash_v2_5",
248
+ voiceId: "test",
249
+ sampleRate: 24000,
250
+ }))
251
+ .withInstructions("Updated instructions")
252
+ .withGreeting("Hello!")
253
+ .withAvatar(new LiveAvatarAvatar({
254
+ apiKey: "test",
255
+ quality: "high",
256
+ agoraUid: "12345",
257
+ }));
258
+ }
259
+ // ============================================
260
+ // Type inference verification
261
+ // ============================================
262
+ function _typeInference1() {
263
+ const agentWith24k = new Agent({ instructions: "Test" }).withTts(new ElevenLabsTTS({
264
+ key: "test",
265
+ modelId: "eleven_flash_v2_5",
266
+ voiceId: "test",
267
+ sampleRate: 24000,
268
+ }));
269
+ // Verify: Type should be Agent<24000>
270
+ const _typeCheck = agentWith24k;
271
+ return agentWith24k;
272
+ }
273
+ function _typeInference2() {
274
+ const agentWith16k = new Agent({ instructions: "Test" }).withTts(new ElevenLabsTTS({
275
+ key: "test",
276
+ modelId: "eleven_flash_v2_5",
277
+ voiceId: "test",
278
+ sampleRate: 16000,
279
+ }));
280
+ // Verify: Type should be Agent<16000>
281
+ const _typeCheck = agentWith16k;
282
+ return agentWith16k;
283
+ }
284
+ function _typeInference3() {
285
+ const openAIAgent = new Agent({ instructions: "Test" }).withTts(new OpenAITTS({
286
+ apiKey: "test",
287
+ voice: "alloy",
288
+ }));
289
+ // Verify: OpenAI is fixed at 24kHz, so type should be Agent<24000>
290
+ const _typeCheck = openAIAgent;
291
+ return openAIAgent;
292
+ }
@@ -0,0 +1,201 @@
1
+ /**
2
+ * Vendor-specific Avatar configuration types with strict type constraints.
3
+ *
4
+ * This provides type safety for vendor-specific parameters like sample rates,
5
+ * ensuring that invalid combinations are caught at compile time.
6
+ */
7
+ import type { AvatarConfig as BaseAvatarConfig } from "./types.mjs";
8
+ /**
9
+ * HeyGen-specific avatar configuration (legacy wire vendor `heygen`).
10
+ *
11
+ * @deprecated HeyGen has been renamed to LiveAvatar. Use {@link LiveAvatarAvatarConfig} instead.
12
+ *
13
+ * @see https://docs.agora.io/en/conversational-ai/models/avatar/heygen
14
+ */
15
+ export interface HeyGenAvatarConfig {
16
+ enable?: boolean;
17
+ vendor: "heygen";
18
+ params: {
19
+ /** API key for HeyGen authentication (required) */
20
+ api_key: string;
21
+ /** Video quality: "high" (720p), "medium" (480p), or "low" (360p) (required) */
22
+ quality: "low" | "medium" | "high";
23
+ /** RTC UID for the avatar (must be unique in the channel) (required) */
24
+ agora_uid: string;
25
+ /** Avatar ConvoAI token for avatar authentication (optional) */
26
+ agora_token?: string;
27
+ /** HeyGen avatar ID (optional) */
28
+ avatar_id?: string;
29
+ /** Whether to disable idle timeout (default: false) */
30
+ disable_idle_timeout?: boolean;
31
+ /** Idle timeout in seconds (default: 120, only applies if disable_idle_timeout is false) */
32
+ activity_idle_timeout?: number;
33
+ [key: string]: unknown;
34
+ };
35
+ }
36
+ /**
37
+ * LiveAvatar-specific avatar configuration (formerly HeyGen).
38
+ *
39
+ * ⚠️ IMPORTANT: LiveAvatar ONLY supports audio with a sample rate of 24,000 Hz.
40
+ * You must configure your TTS with a 24kHz sample rate or the request will fail.
41
+ *
42
+ * @see https://docs.agora.io/en/conversational-ai/models/avatar/overview
43
+ */
44
+ export interface LiveAvatarAvatarConfig {
45
+ enable?: boolean;
46
+ vendor: "liveavatar";
47
+ params: {
48
+ /** API key for LiveAvatar authentication (required) */
49
+ api_key: string;
50
+ /** Video quality: "high" (720p), "medium" (480p), or "low" (360p) (required) */
51
+ quality: "low" | "medium" | "high";
52
+ /** RTC UID for the avatar (must be unique in the channel) (required) */
53
+ agora_uid: string;
54
+ /** Avatar ConvoAI token for avatar authentication (optional) */
55
+ agora_token?: string;
56
+ /** Avatar ID (optional) */
57
+ avatar_id?: string;
58
+ /** Whether to disable idle timeout (default: false) */
59
+ disable_idle_timeout?: boolean;
60
+ /** Idle timeout in seconds (default: 120, only applies if disable_idle_timeout is false) */
61
+ activity_idle_timeout?: number;
62
+ [key: string]: unknown;
63
+ };
64
+ }
65
+ /**
66
+ * Anam-specific avatar configuration (Beta).
67
+ *
68
+ * @see https://docs.agora.io/en/conversational-ai/models/avatar/overview
69
+ */
70
+ export interface AnamAvatarConfig {
71
+ enable?: boolean;
72
+ vendor: "anam";
73
+ params: {
74
+ /** API key for Anam authentication (required) */
75
+ api_key: string;
76
+ /** Anam persona ID (optional) */
77
+ persona_id?: string;
78
+ [key: string]: unknown;
79
+ };
80
+ }
81
+ /**
82
+ * Akool-specific avatar configuration.
83
+ *
84
+ * ⚠️ IMPORTANT: Akool avatars ONLY support audio with a sample rate of 16,000 Hz.
85
+ * You must configure your TTS with a 16kHz sample rate or the request will fail.
86
+ *
87
+ * @see https://docs.agora.io/en/conversational-ai/models/avatar/akool
88
+ */
89
+ export interface AkoolAvatarConfig {
90
+ enable?: boolean;
91
+ vendor: "akool";
92
+ params: {
93
+ /** API key for Akool authentication (required) */
94
+ api_key: string;
95
+ /** Akool avatar ID (optional) */
96
+ avatar_id?: string;
97
+ /** Additional vendor-specific parameters */
98
+ [key: string]: unknown;
99
+ };
100
+ }
101
+ /**
102
+ * Generic avatar configuration.
103
+ * Use this when integrating a custom avatar provider.
104
+ */
105
+ export interface GenericAvatarConfig {
106
+ enable?: boolean;
107
+ vendor: "generic";
108
+ params: {
109
+ /** Avatar provider API key (required) */
110
+ api_key: string;
111
+ /** Avatar provider API base URL (required) */
112
+ api_base_url: string;
113
+ /** Avatar ID (required) */
114
+ avatar_id: string;
115
+ /** Agora App ID (filled by AgentKit at session start when omitted) */
116
+ agora_appid?: string;
117
+ /** Agora channel (filled by AgentKit at session start when omitted) */
118
+ agora_channel?: string;
119
+ /** RTC UID for the avatar video publisher (required) */
120
+ agora_uid: string;
121
+ /** Avatar ConvoAI token (filled by AgentKit at session start when omitted) */
122
+ agora_token?: string;
123
+ [key: string]: unknown;
124
+ };
125
+ }
126
+ /**
127
+ * Discriminated union of all avatar configurations.
128
+ * TypeScript will enforce vendor-specific constraints based on the vendor field.
129
+ */
130
+ export type StrictAvatarConfig = HeyGenAvatarConfig | LiveAvatarAvatarConfig | AkoolAvatarConfig | AnamAvatarConfig | GenericAvatarConfig;
131
+ /**
132
+ * Helper type guard to check if an avatar config uses the legacy HeyGen wire vendor.
133
+ */
134
+ export declare function isHeyGenAvatar(config: StrictAvatarConfig): config is HeyGenAvatarConfig;
135
+ /**
136
+ * Helper type guard to check if an avatar config is for LiveAvatar (formerly HeyGen).
137
+ */
138
+ export declare function isLiveAvatarAvatar(config: StrictAvatarConfig): config is LiveAvatarAvatarConfig;
139
+ /**
140
+ * Helper type guard to check if an avatar config is for Akool.
141
+ */
142
+ export declare function isAkoolAvatar(config: StrictAvatarConfig): config is AkoolAvatarConfig;
143
+ /**
144
+ * Helper type guard to check if an avatar config is for Anam.
145
+ */
146
+ export declare function isAnamAvatar(config: StrictAvatarConfig): config is AnamAvatarConfig;
147
+ /**
148
+ * Helper type guard to check if an avatar config is for Generic Avatar.
149
+ */
150
+ export declare function isGenericAvatar(config: StrictAvatarConfig): config is GenericAvatarConfig;
151
+ /**
152
+ * Returns true when AgentKit manages the avatar's RTC publisher identity
153
+ * (i.e. fills `agora_token`, validates uniqueness against the agent UID).
154
+ *
155
+ * Mirrors the Go and Python SDK gate so all language SDKs behave identically.
156
+ */
157
+ export declare function isAvatarTokenManaged(config: StrictAvatarConfig): boolean;
158
+ /**
159
+ * Validates avatar configuration at runtime.
160
+ * TypeScript catches most issues, but this provides runtime validation
161
+ * for cases where types are bypassed or data comes from external sources.
162
+ *
163
+ * @param options.requireSessionFields - When true, require fields AgentKit
164
+ * fills during `AgentSession.start()` for Generic avatars.
165
+ * @throws {Error} If the configuration is invalid
166
+ */
167
+ export declare function validateAvatarConfig(config: StrictAvatarConfig, options?: {
168
+ requireSessionFields?: boolean;
169
+ }): void;
170
+ /**
171
+ * Validates that TTS sample rate is compatible with the avatar vendor.
172
+ *
173
+ * Different avatar vendors have specific sample rate requirements:
174
+ * - ⚠️ HeyGen: ONLY supports 24,000 Hz
175
+ * - ⚠️ Akool: ONLY supports 16,000 Hz
176
+ *
177
+ * This function helps catch TTS/Avatar misconfigurations at runtime.
178
+ *
179
+ * @param avatarConfig - The avatar configuration
180
+ * @param ttsSampleRate - The sample rate from your TTS configuration (in Hz)
181
+ * @throws {Error} If TTS sample rate is incompatible with the avatar vendor
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * // HeyGen example
186
+ * const heygenAvatar: HeyGenAvatarConfig = { vendor: 'heygen', ... };
187
+ * validateTtsSampleRate(heygenAvatar, 24000); // ✅ Passes
188
+ * validateTtsSampleRate(heygenAvatar, 16000); // ❌ Throws error
189
+ *
190
+ * // Akool example
191
+ * const akoolAvatar: AkoolAvatarConfig = { vendor: 'akool', ... };
192
+ * validateTtsSampleRate(akoolAvatar, 16000); // ✅ Passes
193
+ * validateTtsSampleRate(akoolAvatar, 24000); // ❌ Throws error
194
+ * ```
195
+ */
196
+ export declare function validateTtsSampleRate(avatarConfig: StrictAvatarConfig, ttsSampleRate: number): void;
197
+ /**
198
+ * Converts strict avatar config to base avatar config for API calls.
199
+ * This bridges the gap between our type-safe agentkit and Fern's generated types.
200
+ */
201
+ export declare function toBaseAvatarConfig(config: StrictAvatarConfig): BaseAvatarConfig;
@@ -0,0 +1,160 @@
1
+ /**
2
+ * Vendor-specific Avatar configuration types with strict type constraints.
3
+ *
4
+ * This provides type safety for vendor-specific parameters like sample rates,
5
+ * ensuring that invalid combinations are caught at compile time.
6
+ */
7
+ /**
8
+ * Helper type guard to check if an avatar config uses the legacy HeyGen wire vendor.
9
+ */
10
+ export function isHeyGenAvatar(config) {
11
+ return config.vendor === "heygen";
12
+ }
13
+ /**
14
+ * Helper type guard to check if an avatar config is for LiveAvatar (formerly HeyGen).
15
+ */
16
+ export function isLiveAvatarAvatar(config) {
17
+ return config.vendor === "liveavatar";
18
+ }
19
+ /**
20
+ * Helper type guard to check if an avatar config is for Akool.
21
+ */
22
+ export function isAkoolAvatar(config) {
23
+ return config.vendor === "akool";
24
+ }
25
+ /**
26
+ * Helper type guard to check if an avatar config is for Anam.
27
+ */
28
+ export function isAnamAvatar(config) {
29
+ return config.vendor === "anam";
30
+ }
31
+ /**
32
+ * Helper type guard to check if an avatar config is for Generic Avatar.
33
+ */
34
+ export function isGenericAvatar(config) {
35
+ return config.vendor === "generic";
36
+ }
37
+ /**
38
+ * Returns true when AgentKit manages the avatar's RTC publisher identity
39
+ * (i.e. fills `agora_token`, validates uniqueness against the agent UID).
40
+ *
41
+ * Mirrors the Go and Python SDK gate so all language SDKs behave identically.
42
+ */
43
+ export function isAvatarTokenManaged(config) {
44
+ return isHeyGenAvatar(config) || isLiveAvatarAvatar(config) || isGenericAvatar(config);
45
+ }
46
+ /**
47
+ * Validates avatar configuration at runtime.
48
+ * TypeScript catches most issues, but this provides runtime validation
49
+ * for cases where types are bypassed or data comes from external sources.
50
+ *
51
+ * @param options.requireSessionFields - When true, require fields AgentKit
52
+ * fills during `AgentSession.start()` for Generic avatars.
53
+ * @throws {Error} If the configuration is invalid
54
+ */
55
+ export function validateAvatarConfig(config, options = {}) {
56
+ const validQualities = ["low", "medium", "high"];
57
+ if (isHeyGenAvatar(config) || isLiveAvatarAvatar(config)) {
58
+ const label = isHeyGenAvatar(config) ? "HeyGen" : "LiveAvatar";
59
+ if (!config.params.api_key) {
60
+ throw new Error(`${label} avatar requires api_key`);
61
+ }
62
+ if (!config.params.quality) {
63
+ throw new Error(`${label} avatar requires quality (low, medium, or high)`);
64
+ }
65
+ if (!config.params.agora_uid) {
66
+ throw new Error(`${label} avatar requires agora_uid`);
67
+ }
68
+ if (!validQualities.includes(config.params.quality)) {
69
+ throw new Error(`Invalid quality for ${label}: ${config.params.quality}. ` +
70
+ `Must be one of: ${validQualities.join(", ")}`);
71
+ }
72
+ }
73
+ else if (isAkoolAvatar(config)) {
74
+ if (!config.params.api_key) {
75
+ throw new Error("Akool avatar requires api_key");
76
+ }
77
+ }
78
+ else if (isAnamAvatar(config)) {
79
+ if (!config.params.api_key) {
80
+ throw new Error("Anam avatar requires api_key");
81
+ }
82
+ }
83
+ else if (isGenericAvatar(config)) {
84
+ if (!config.params.api_key) {
85
+ throw new Error("Generic avatar requires api_key");
86
+ }
87
+ if (!config.params.api_base_url) {
88
+ throw new Error("Generic avatar requires api_base_url");
89
+ }
90
+ if (!config.params.avatar_id) {
91
+ throw new Error("Generic avatar requires avatar_id");
92
+ }
93
+ if (!config.params.agora_uid) {
94
+ throw new Error("Generic avatar requires agora_uid");
95
+ }
96
+ if (options.requireSessionFields) {
97
+ if (!config.params.agora_appid) {
98
+ throw new Error("Generic avatar requires agora_appid after session enrichment");
99
+ }
100
+ if (!config.params.agora_channel) {
101
+ throw new Error("Generic avatar requires agora_channel after session enrichment");
102
+ }
103
+ if (!config.params.agora_token) {
104
+ throw new Error("Generic avatar requires agora_token after session enrichment");
105
+ }
106
+ }
107
+ }
108
+ }
109
+ /**
110
+ * Validates that TTS sample rate is compatible with the avatar vendor.
111
+ *
112
+ * Different avatar vendors have specific sample rate requirements:
113
+ * - ⚠️ HeyGen: ONLY supports 24,000 Hz
114
+ * - ⚠️ Akool: ONLY supports 16,000 Hz
115
+ *
116
+ * This function helps catch TTS/Avatar misconfigurations at runtime.
117
+ *
118
+ * @param avatarConfig - The avatar configuration
119
+ * @param ttsSampleRate - The sample rate from your TTS configuration (in Hz)
120
+ * @throws {Error} If TTS sample rate is incompatible with the avatar vendor
121
+ *
122
+ * @example
123
+ * ```typescript
124
+ * // HeyGen example
125
+ * const heygenAvatar: HeyGenAvatarConfig = { vendor: 'heygen', ... };
126
+ * validateTtsSampleRate(heygenAvatar, 24000); // ✅ Passes
127
+ * validateTtsSampleRate(heygenAvatar, 16000); // ❌ Throws error
128
+ *
129
+ * // Akool example
130
+ * const akoolAvatar: AkoolAvatarConfig = { vendor: 'akool', ... };
131
+ * validateTtsSampleRate(akoolAvatar, 16000); // ✅ Passes
132
+ * validateTtsSampleRate(akoolAvatar, 24000); // ❌ Throws error
133
+ * ```
134
+ */
135
+ export function validateTtsSampleRate(avatarConfig, ttsSampleRate) {
136
+ if (isHeyGenAvatar(avatarConfig) || isLiveAvatarAvatar(avatarConfig)) {
137
+ if (ttsSampleRate !== 24000) {
138
+ const label = isHeyGenAvatar(avatarConfig) ? "HeyGen" : "LiveAvatar";
139
+ throw new Error(`${label} avatars ONLY support 24,000 Hz sample rate. ` +
140
+ `Your TTS is configured with ${ttsSampleRate} Hz. ` +
141
+ `Please update your TTS configuration to use 24kHz sample rate. ` +
142
+ `See: https://docs.agora.io/en/conversational-ai/models/avatar/overview`);
143
+ }
144
+ }
145
+ else if (isAkoolAvatar(avatarConfig)) {
146
+ if (ttsSampleRate !== 16000) {
147
+ throw new Error(`Akool avatars ONLY support 16,000 Hz sample rate. ` +
148
+ `Your TTS is configured with ${ttsSampleRate} Hz. ` +
149
+ `Please update your TTS configuration to use 16kHz sample rate. ` +
150
+ `See: https://docs.agora.io/en/conversational-ai/models/avatar/akool`);
151
+ }
152
+ }
153
+ }
154
+ /**
155
+ * Converts strict avatar config to base avatar config for API calls.
156
+ * This bridges the gap between our type-safe agentkit and Fern's generated types.
157
+ */
158
+ export function toBaseAvatarConfig(config) {
159
+ return config;
160
+ }