@elevenlabs/elevenlabs-js 2.46.0 → 2.47.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 (568) hide show
  1. package/.fern/metadata.json +1 -1
  2. package/BaseClient.js +2 -2
  3. package/Client.d.ts +3 -0
  4. package/Client.js +31 -26
  5. package/README.md +92 -0
  6. package/api/resources/conversationalAi/resources/conversations/client/Client.d.ts +2 -2
  7. package/api/resources/conversationalAi/resources/conversations/client/Client.js +2 -2
  8. package/api/resources/conversationalAi/resources/conversations/client/requests/ConversationsGetSignedUrlRequest.d.ts +2 -2
  9. package/api/resources/conversationalAi/resources/conversations/client/requests/ConversationsGetWebrtcTokenRequest.d.ts +2 -2
  10. package/api/resources/conversationalAi/resources/conversations/client/requests/ConversationsListRequest.d.ts +1 -1
  11. package/api/resources/conversationalAi/resources/conversations/resources/messages/client/requests/MessagesSearchRequest.d.ts +1 -1
  12. package/api/resources/conversationalAi/resources/conversations/resources/messages/client/requests/MessagesTextSearchRequest.d.ts +1 -1
  13. package/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/Client.d.ts +17 -0
  14. package/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/Client.js +65 -0
  15. package/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/requests/BodyUpdateFileDocumentV1ConvaiKnowledgeBaseDocumentationIdUpdateFilePatch.d.ts +11 -0
  16. package/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/requests/index.d.ts +1 -0
  17. package/api/resources/conversationalAi/resources/knowledgeBase/resources/document/types/DocumentUpdateFileResponse.d.ts +16 -0
  18. package/api/resources/conversationalAi/resources/knowledgeBase/resources/document/types/index.d.ts +1 -0
  19. package/api/resources/conversationalAi/resources/knowledgeBase/resources/document/types/index.js +1 -0
  20. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/Client.d.ts +6 -5
  21. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/Client.js +12 -9
  22. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/requests/BodyUpdateDocumentV1ConvaiKnowledgeBaseDocumentationIdPatch.d.ts +4 -4
  23. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/Client.d.ts +31 -0
  24. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/Client.js +131 -0
  25. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/index.d.ts +1 -0
  26. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/index.js +17 -0
  27. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/requests/ChunksListRequest.d.ts +17 -0
  28. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/requests/ChunksListRequest.js +3 -0
  29. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/requests/index.d.ts +1 -0
  30. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/requests/index.js +2 -0
  31. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/index.d.ts +1 -0
  32. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/index.js +17 -0
  33. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/index.d.ts +2 -0
  34. package/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/index.js +3 -1
  35. package/api/resources/conversationalAi/resources/phoneNumbers/client/requests/UpdatePhoneNumberRequest.d.ts +4 -0
  36. package/api/resources/conversationalAi/resources/users/client/requests/UsersListRequest.d.ts +1 -1
  37. package/api/resources/index.d.ts +2 -0
  38. package/api/resources/index.js +3 -1
  39. package/api/resources/serviceAccounts/resources/apiKeys/client/requests/BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPost.d.ts +2 -0
  40. package/api/resources/serviceAccounts/resources/apiKeys/client/requests/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatch.d.ts +2 -0
  41. package/api/resources/serviceAccounts/resources/apiKeys/types/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps.d.ts +4 -0
  42. package/api/resources/serviceAccounts/resources/apiKeys/types/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps.js +3 -0
  43. package/api/resources/serviceAccounts/resources/apiKeys/types/index.d.ts +1 -0
  44. package/api/resources/serviceAccounts/resources/apiKeys/types/index.js +1 -0
  45. package/api/resources/speechEngine/client/Client.d.ts +89 -0
  46. package/api/resources/speechEngine/client/Client.js +363 -0
  47. package/api/resources/speechEngine/client/index.d.ts +1 -0
  48. package/api/resources/speechEngine/client/index.js +17 -0
  49. package/api/resources/speechEngine/client/requests/CreateSpeechEngineRequest.d.ts +31 -0
  50. package/api/resources/speechEngine/client/requests/CreateSpeechEngineRequest.js +3 -0
  51. package/api/resources/speechEngine/client/requests/SpeechEngineListRequest.d.ts +23 -0
  52. package/api/resources/speechEngine/client/requests/SpeechEngineListRequest.js +3 -0
  53. package/api/resources/speechEngine/client/requests/UpdateSpeechEngineRequest.d.ts +17 -0
  54. package/api/resources/speechEngine/client/requests/UpdateSpeechEngineRequest.js +3 -0
  55. package/api/resources/speechEngine/client/requests/index.d.ts +3 -0
  56. package/api/resources/speechEngine/client/requests/index.js +2 -0
  57. package/api/resources/speechEngine/index.d.ts +1 -0
  58. package/api/resources/speechEngine/index.js +17 -0
  59. package/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechV1SpeechToSpeechVoiceIdPost.d.ts +1 -1
  60. package/api/resources/speechToSpeech/types/SpeechToSpeechConvertRequestOutputFormat.d.ts +17 -10
  61. package/api/resources/speechToSpeech/types/SpeechToSpeechConvertRequestOutputFormat.js +17 -10
  62. package/api/resources/voices/client/Client.js +3 -0
  63. package/api/resources/voices/client/requests/BodyEditVoiceV1VoicesVoiceIdEditPost.d.ts +2 -0
  64. package/api/resources/webhooks/client/requests/BodyUpdateWorkspaceWebhookV1WorkspaceWebhooksWebhookIdPatch.d.ts +2 -0
  65. package/api/resources/workspace/client/Client.d.ts +3 -0
  66. package/api/resources/workspace/client/Client.js +19 -14
  67. package/api/resources/workspace/resources/analytics/client/Client.d.ts +12 -0
  68. package/api/resources/workspace/resources/analytics/client/Client.js +16 -0
  69. package/api/resources/workspace/resources/analytics/client/index.d.ts +1 -0
  70. package/api/resources/workspace/resources/analytics/client/index.js +2 -0
  71. package/api/resources/workspace/resources/analytics/index.d.ts +2 -0
  72. package/api/resources/workspace/resources/analytics/index.js +18 -0
  73. package/api/resources/workspace/resources/analytics/resources/index.d.ts +3 -0
  74. package/api/resources/workspace/resources/analytics/resources/index.js +42 -0
  75. package/api/resources/workspace/resources/analytics/resources/requests/client/Client.d.ts +26 -0
  76. package/api/resources/workspace/resources/analytics/resources/requests/client/Client.js +118 -0
  77. package/api/resources/workspace/resources/analytics/resources/requests/client/index.d.ts +1 -0
  78. package/api/resources/workspace/resources/analytics/resources/requests/client/index.js +17 -0
  79. package/api/resources/workspace/resources/analytics/resources/requests/client/requests/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPost.d.ts +16 -0
  80. package/api/resources/workspace/resources/analytics/resources/requests/client/requests/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPost.js +3 -0
  81. package/api/resources/workspace/resources/analytics/resources/requests/client/requests/index.d.ts +1 -0
  82. package/api/resources/workspace/resources/analytics/resources/requests/client/requests/index.js +2 -0
  83. package/api/resources/workspace/resources/analytics/resources/requests/index.d.ts +2 -0
  84. package/api/resources/workspace/resources/analytics/resources/requests/index.js +18 -0
  85. package/api/resources/workspace/resources/analytics/resources/requests/types/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort.d.ts +5 -0
  86. package/api/resources/workspace/resources/analytics/resources/requests/types/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort.js +8 -0
  87. package/api/resources/workspace/resources/analytics/resources/requests/types/index.d.ts +1 -0
  88. package/api/resources/workspace/resources/analytics/resources/requests/types/index.js +17 -0
  89. package/api/resources/workspace/resources/index.d.ts +1 -0
  90. package/api/resources/workspace/resources/index.js +2 -1
  91. package/api/types/AgentAlertingMonitorConfig.d.ts +4 -0
  92. package/api/types/AgentAlertingMonitorConfig.js +3 -0
  93. package/api/types/AgentAlertingSettings.d.ts +5 -0
  94. package/api/types/AgentAlertingSettings.js +3 -0
  95. package/api/types/AgentMetadataDbModel.d.ts +7 -0
  96. package/api/types/AgentMetadataDbModel.js +3 -0
  97. package/api/types/AgentPlatformSettingsRequestModel.d.ts +1 -0
  98. package/api/types/AgentPlatformSettingsResponseModel.d.ts +1 -0
  99. package/api/types/AgentTopicResponseModel.d.ts +3 -0
  100. package/api/types/BackgroundMusicPresetId.d.ts +4 -0
  101. package/api/types/BackgroundMusicPresetId.js +4 -0
  102. package/api/types/BaseTurnConfig.d.ts +17 -0
  103. package/api/types/BaseTurnConfig.js +3 -0
  104. package/api/types/ClientEvent.d.ts +1 -0
  105. package/api/types/ClientEvent.js +1 -0
  106. package/api/types/CodeToolAllowedDomain.d.ts +6 -0
  107. package/api/types/CodeToolAllowedDomain.js +3 -0
  108. package/api/types/{ConversationTokenDbModel.d.ts → ConversationTokenResponseModel.d.ts} +2 -2
  109. package/api/types/ConversationTokenResponseModel.js +3 -0
  110. package/api/types/CreateSpeechEngineResponse.d.ts +4 -0
  111. package/api/types/CreateSpeechEngineResponse.js +3 -0
  112. package/api/types/GetAgentLinkResponseModel.d.ts +1 -1
  113. package/api/types/KnowledgeBaseDocumentChunksResponseModel.d.ts +5 -0
  114. package/api/types/KnowledgeBaseDocumentChunksResponseModel.js +3 -0
  115. package/api/types/ListSpeechEnginesResponse.d.ts +8 -0
  116. package/api/types/ListSpeechEnginesResponse.js +3 -0
  117. package/api/types/Llm.d.ts +4 -0
  118. package/api/types/Llm.js +4 -0
  119. package/api/types/LlmInfoModelInput.d.ts +2 -0
  120. package/api/types/LlmInfoModelOutput.d.ts +2 -0
  121. package/api/types/Monitor.d.ts +5 -0
  122. package/api/types/Monitor.js +8 -0
  123. package/api/types/PhoneNumberAgentInfo.d.ts +4 -0
  124. package/api/types/ProcedureCompilerMode.d.ts +1 -5
  125. package/api/types/ProcedureCompilerMode.js +0 -5
  126. package/api/types/PromptAgentApiModelInput.d.ts +1 -1
  127. package/api/types/PromptAgentApiModelOutput.d.ts +1 -1
  128. package/api/types/PromptAgentApiModelWorkflowOverrideInput.d.ts +1 -1
  129. package/api/types/PromptAgentApiModelWorkflowOverrideOutput.d.ts +1 -1
  130. package/api/types/ReadMetadataChapterDbModel.d.ts +1 -0
  131. package/api/types/RegionalProcessingSurchargeInfo.d.ts +4 -0
  132. package/api/types/RegionalProcessingSurchargeInfo.js +3 -0
  133. package/api/types/ReportKnowledgeGapParams.d.ts +3 -0
  134. package/api/types/ReportKnowledgeGapParams.js +3 -0
  135. package/api/types/SpeechEngineResponse.d.ts +16 -0
  136. package/api/types/SpeechEngineResponse.js +3 -0
  137. package/api/types/SpeechEngineSummaryResponse.d.ts +8 -0
  138. package/api/types/SpeechEngineSummaryResponse.js +3 -0
  139. package/api/types/TurnConfig.d.ts +2 -2
  140. package/api/types/TurnConfigWorkflowOverride.d.ts +2 -2
  141. package/api/types/WebhookHmacSettings.d.ts +2 -0
  142. package/api/types/WorkspaceApiKeyResponseModel.d.ts +1 -0
  143. package/api/types/WorkspaceGroupPermission.d.ts +2 -0
  144. package/api/types/WorkspaceGroupPermission.js +2 -0
  145. package/api/types/index.d.ts +14 -1
  146. package/api/types/index.js +14 -1
  147. package/dist/BaseClient.js +2 -2
  148. package/dist/Client.d.ts +3 -0
  149. package/dist/Client.js +31 -26
  150. package/dist/api/resources/conversationalAi/resources/conversations/client/Client.d.ts +2 -2
  151. package/dist/api/resources/conversationalAi/resources/conversations/client/Client.js +2 -2
  152. package/dist/api/resources/conversationalAi/resources/conversations/client/requests/ConversationsGetSignedUrlRequest.d.ts +2 -2
  153. package/dist/api/resources/conversationalAi/resources/conversations/client/requests/ConversationsGetWebrtcTokenRequest.d.ts +2 -2
  154. package/dist/api/resources/conversationalAi/resources/conversations/client/requests/ConversationsListRequest.d.ts +1 -1
  155. package/dist/api/resources/conversationalAi/resources/conversations/resources/messages/client/requests/MessagesSearchRequest.d.ts +1 -1
  156. package/dist/api/resources/conversationalAi/resources/conversations/resources/messages/client/requests/MessagesTextSearchRequest.d.ts +1 -1
  157. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/Client.d.ts +17 -0
  158. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/Client.js +65 -0
  159. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/requests/BodyUpdateFileDocumentV1ConvaiKnowledgeBaseDocumentationIdUpdateFilePatch.d.ts +11 -0
  160. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/requests/BodyUpdateFileDocumentV1ConvaiKnowledgeBaseDocumentationIdUpdateFilePatch.js +3 -0
  161. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/client/requests/index.d.ts +1 -0
  162. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/types/DocumentUpdateFileResponse.d.ts +16 -0
  163. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/types/DocumentUpdateFileResponse.js +3 -0
  164. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/types/index.d.ts +1 -0
  165. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/document/types/index.js +1 -0
  166. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/Client.d.ts +6 -5
  167. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/Client.js +12 -9
  168. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/requests/BodyUpdateDocumentV1ConvaiKnowledgeBaseDocumentationIdPatch.d.ts +4 -4
  169. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/Client.d.ts +31 -0
  170. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/Client.js +131 -0
  171. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/index.d.ts +1 -0
  172. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/index.js +17 -0
  173. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/requests/ChunksListRequest.d.ts +17 -0
  174. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/requests/ChunksListRequest.js +3 -0
  175. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/requests/index.d.ts +1 -0
  176. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/client/requests/index.js +2 -0
  177. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/index.d.ts +1 -0
  178. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/chunks/index.js +17 -0
  179. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/index.d.ts +2 -0
  180. package/dist/api/resources/conversationalAi/resources/knowledgeBase/resources/documents/resources/index.js +3 -1
  181. package/dist/api/resources/conversationalAi/resources/phoneNumbers/client/requests/UpdatePhoneNumberRequest.d.ts +4 -0
  182. package/dist/api/resources/conversationalAi/resources/users/client/requests/UsersListRequest.d.ts +1 -1
  183. package/dist/api/resources/index.d.ts +2 -0
  184. package/dist/api/resources/index.js +3 -1
  185. package/dist/api/resources/serviceAccounts/resources/apiKeys/client/requests/BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPost.d.ts +2 -0
  186. package/dist/api/resources/serviceAccounts/resources/apiKeys/client/requests/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatch.d.ts +2 -0
  187. package/dist/api/resources/serviceAccounts/resources/apiKeys/types/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps.d.ts +4 -0
  188. package/dist/api/resources/serviceAccounts/resources/apiKeys/types/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps.js +3 -0
  189. package/dist/api/resources/serviceAccounts/resources/apiKeys/types/index.d.ts +1 -0
  190. package/dist/api/resources/serviceAccounts/resources/apiKeys/types/index.js +1 -0
  191. package/dist/api/resources/speechEngine/client/Client.d.ts +89 -0
  192. package/dist/api/resources/speechEngine/client/Client.js +363 -0
  193. package/dist/api/resources/speechEngine/client/index.d.ts +1 -0
  194. package/dist/api/resources/speechEngine/client/index.js +17 -0
  195. package/dist/api/resources/speechEngine/client/requests/CreateSpeechEngineRequest.d.ts +31 -0
  196. package/dist/api/resources/speechEngine/client/requests/CreateSpeechEngineRequest.js +3 -0
  197. package/dist/api/resources/speechEngine/client/requests/SpeechEngineListRequest.d.ts +23 -0
  198. package/dist/api/resources/speechEngine/client/requests/SpeechEngineListRequest.js +3 -0
  199. package/dist/api/resources/speechEngine/client/requests/UpdateSpeechEngineRequest.d.ts +17 -0
  200. package/dist/api/resources/speechEngine/client/requests/UpdateSpeechEngineRequest.js +3 -0
  201. package/dist/api/resources/speechEngine/client/requests/index.d.ts +3 -0
  202. package/dist/api/resources/speechEngine/client/requests/index.js +2 -0
  203. package/dist/api/resources/speechEngine/index.d.ts +1 -0
  204. package/dist/api/resources/speechEngine/index.js +17 -0
  205. package/dist/api/resources/speechToSpeech/client/requests/BodySpeechToSpeechV1SpeechToSpeechVoiceIdPost.d.ts +1 -1
  206. package/dist/api/resources/speechToSpeech/types/SpeechToSpeechConvertRequestOutputFormat.d.ts +17 -10
  207. package/dist/api/resources/speechToSpeech/types/SpeechToSpeechConvertRequestOutputFormat.js +17 -10
  208. package/dist/api/resources/voices/client/Client.js +3 -0
  209. package/dist/api/resources/voices/client/requests/BodyEditVoiceV1VoicesVoiceIdEditPost.d.ts +2 -0
  210. package/dist/api/resources/webhooks/client/requests/BodyUpdateWorkspaceWebhookV1WorkspaceWebhooksWebhookIdPatch.d.ts +2 -0
  211. package/dist/api/resources/workspace/client/Client.d.ts +3 -0
  212. package/dist/api/resources/workspace/client/Client.js +19 -14
  213. package/dist/api/resources/workspace/resources/analytics/client/Client.d.ts +12 -0
  214. package/dist/api/resources/workspace/resources/analytics/client/Client.js +16 -0
  215. package/dist/api/resources/workspace/resources/analytics/client/index.d.ts +1 -0
  216. package/dist/api/resources/workspace/resources/analytics/client/index.js +2 -0
  217. package/dist/api/resources/workspace/resources/analytics/index.d.ts +2 -0
  218. package/dist/api/resources/workspace/resources/analytics/index.js +18 -0
  219. package/dist/api/resources/workspace/resources/analytics/resources/index.d.ts +3 -0
  220. package/dist/api/resources/workspace/resources/analytics/resources/index.js +42 -0
  221. package/dist/api/resources/workspace/resources/analytics/resources/requests/client/Client.d.ts +26 -0
  222. package/dist/api/resources/workspace/resources/analytics/resources/requests/client/Client.js +118 -0
  223. package/dist/api/resources/workspace/resources/analytics/resources/requests/client/index.d.ts +1 -0
  224. package/dist/api/resources/workspace/resources/analytics/resources/requests/client/index.js +17 -0
  225. package/dist/api/resources/workspace/resources/analytics/resources/requests/client/requests/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPost.d.ts +16 -0
  226. package/dist/api/resources/workspace/resources/analytics/resources/requests/client/requests/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPost.js +3 -0
  227. package/dist/api/resources/workspace/resources/analytics/resources/requests/client/requests/index.d.ts +1 -0
  228. package/dist/api/resources/workspace/resources/analytics/resources/requests/client/requests/index.js +2 -0
  229. package/dist/api/resources/workspace/resources/analytics/resources/requests/index.d.ts +2 -0
  230. package/dist/api/resources/workspace/resources/analytics/resources/requests/index.js +18 -0
  231. package/dist/api/resources/workspace/resources/analytics/resources/requests/types/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort.d.ts +5 -0
  232. package/dist/api/resources/workspace/resources/analytics/resources/requests/types/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort.js +8 -0
  233. package/dist/api/resources/workspace/resources/analytics/resources/requests/types/index.d.ts +1 -0
  234. package/dist/api/resources/workspace/resources/analytics/resources/requests/types/index.js +17 -0
  235. package/dist/api/resources/workspace/resources/index.d.ts +1 -0
  236. package/dist/api/resources/workspace/resources/index.js +2 -1
  237. package/dist/api/types/AgentAlertingMonitorConfig.d.ts +4 -0
  238. package/dist/api/types/AgentAlertingMonitorConfig.js +3 -0
  239. package/dist/api/types/AgentAlertingSettings.d.ts +5 -0
  240. package/dist/api/types/AgentAlertingSettings.js +3 -0
  241. package/dist/api/types/AgentMetadataDbModel.d.ts +7 -0
  242. package/dist/api/types/AgentMetadataDbModel.js +3 -0
  243. package/dist/api/types/AgentPlatformSettingsRequestModel.d.ts +1 -0
  244. package/dist/api/types/AgentPlatformSettingsResponseModel.d.ts +1 -0
  245. package/dist/api/types/AgentTopicResponseModel.d.ts +3 -0
  246. package/dist/api/types/BackgroundMusicPresetId.d.ts +4 -0
  247. package/dist/api/types/BackgroundMusicPresetId.js +4 -0
  248. package/dist/api/types/BaseTurnConfig.d.ts +17 -0
  249. package/dist/api/types/BaseTurnConfig.js +3 -0
  250. package/dist/api/types/ClientEvent.d.ts +1 -0
  251. package/dist/api/types/ClientEvent.js +1 -0
  252. package/dist/api/types/CodeToolAllowedDomain.d.ts +6 -0
  253. package/dist/api/types/CodeToolAllowedDomain.js +3 -0
  254. package/dist/api/types/{ConversationTokenDbModel.d.ts → ConversationTokenResponseModel.d.ts} +2 -2
  255. package/dist/api/types/ConversationTokenResponseModel.js +3 -0
  256. package/dist/api/types/CreateSpeechEngineResponse.d.ts +4 -0
  257. package/dist/api/types/CreateSpeechEngineResponse.js +3 -0
  258. package/dist/api/types/GetAgentLinkResponseModel.d.ts +1 -1
  259. package/dist/api/types/KnowledgeBaseDocumentChunksResponseModel.d.ts +5 -0
  260. package/dist/api/types/KnowledgeBaseDocumentChunksResponseModel.js +3 -0
  261. package/dist/api/types/ListSpeechEnginesResponse.d.ts +8 -0
  262. package/dist/api/types/ListSpeechEnginesResponse.js +3 -0
  263. package/dist/api/types/Llm.d.ts +4 -0
  264. package/dist/api/types/Llm.js +4 -0
  265. package/dist/api/types/LlmInfoModelInput.d.ts +2 -0
  266. package/dist/api/types/LlmInfoModelOutput.d.ts +2 -0
  267. package/dist/api/types/Monitor.d.ts +5 -0
  268. package/dist/api/types/Monitor.js +8 -0
  269. package/dist/api/types/PhoneNumberAgentInfo.d.ts +4 -0
  270. package/dist/api/types/ProcedureCompilerMode.d.ts +1 -5
  271. package/dist/api/types/ProcedureCompilerMode.js +0 -5
  272. package/dist/api/types/PromptAgentApiModelInput.d.ts +1 -1
  273. package/dist/api/types/PromptAgentApiModelOutput.d.ts +1 -1
  274. package/dist/api/types/PromptAgentApiModelWorkflowOverrideInput.d.ts +1 -1
  275. package/dist/api/types/PromptAgentApiModelWorkflowOverrideOutput.d.ts +1 -1
  276. package/dist/api/types/ReadMetadataChapterDbModel.d.ts +1 -0
  277. package/dist/api/types/RegionalProcessingSurchargeInfo.d.ts +4 -0
  278. package/dist/api/types/RegionalProcessingSurchargeInfo.js +3 -0
  279. package/dist/api/types/ReportKnowledgeGapParams.d.ts +3 -0
  280. package/dist/api/types/ReportKnowledgeGapParams.js +3 -0
  281. package/dist/api/types/SpeechEngineResponse.d.ts +16 -0
  282. package/dist/api/types/SpeechEngineResponse.js +3 -0
  283. package/dist/api/types/SpeechEngineSummaryResponse.d.ts +8 -0
  284. package/dist/api/types/SpeechEngineSummaryResponse.js +3 -0
  285. package/dist/api/types/TurnConfig.d.ts +2 -2
  286. package/dist/api/types/TurnConfigWorkflowOverride.d.ts +2 -2
  287. package/dist/api/types/WebhookHmacSettings.d.ts +2 -0
  288. package/dist/api/types/WorkspaceApiKeyResponseModel.d.ts +1 -0
  289. package/dist/api/types/WorkspaceGroupPermission.d.ts +2 -0
  290. package/dist/api/types/WorkspaceGroupPermission.js +2 -0
  291. package/dist/api/types/index.d.ts +14 -1
  292. package/dist/api/types/index.js +14 -1
  293. package/dist/serialization/resources/conversationalAi/resources/knowledgeBase/resources/document/types/DocumentUpdateFileResponse.d.ts +23 -0
  294. package/dist/serialization/resources/conversationalAi/resources/knowledgeBase/resources/document/types/DocumentUpdateFileResponse.js +53 -0
  295. package/dist/serialization/resources/conversationalAi/resources/knowledgeBase/resources/document/types/index.d.ts +1 -0
  296. package/dist/serialization/resources/conversationalAi/resources/knowledgeBase/resources/document/types/index.js +1 -0
  297. package/dist/serialization/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/requests/BodyUpdateDocumentV1ConvaiKnowledgeBaseDocumentationIdPatch.d.ts +2 -1
  298. package/dist/serialization/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/requests/BodyUpdateDocumentV1ConvaiKnowledgeBaseDocumentationIdPatch.js +2 -1
  299. package/dist/serialization/resources/conversationalAi/resources/phoneNumbers/client/requests/UpdatePhoneNumberRequest.d.ts +2 -0
  300. package/dist/serialization/resources/conversationalAi/resources/phoneNumbers/client/requests/UpdatePhoneNumberRequest.js +2 -0
  301. package/dist/serialization/resources/index.d.ts +2 -0
  302. package/dist/serialization/resources/index.js +3 -1
  303. package/dist/serialization/resources/serviceAccounts/resources/apiKeys/client/requests/BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPost.d.ts +1 -0
  304. package/dist/serialization/resources/serviceAccounts/resources/apiKeys/client/requests/BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPost.js +1 -0
  305. package/dist/serialization/resources/serviceAccounts/resources/apiKeys/client/requests/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatch.d.ts +2 -0
  306. package/dist/serialization/resources/serviceAccounts/resources/apiKeys/client/requests/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatch.js +2 -0
  307. package/dist/serialization/resources/serviceAccounts/resources/apiKeys/types/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps.d.ts +7 -0
  308. package/dist/serialization/resources/serviceAccounts/resources/apiKeys/types/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps.js +43 -0
  309. package/dist/serialization/resources/serviceAccounts/resources/apiKeys/types/index.d.ts +1 -0
  310. package/dist/serialization/resources/serviceAccounts/resources/apiKeys/types/index.js +1 -0
  311. package/dist/serialization/resources/speechEngine/client/index.d.ts +1 -0
  312. package/dist/serialization/resources/speechEngine/client/index.js +17 -0
  313. package/dist/serialization/resources/speechEngine/client/requests/CreateSpeechEngineRequest.d.ts +25 -0
  314. package/dist/serialization/resources/speechEngine/client/requests/CreateSpeechEngineRequest.js +57 -0
  315. package/dist/serialization/resources/speechEngine/client/requests/UpdateSpeechEngineRequest.d.ts +25 -0
  316. package/dist/serialization/resources/speechEngine/client/requests/UpdateSpeechEngineRequest.js +57 -0
  317. package/dist/serialization/resources/speechEngine/client/requests/index.d.ts +2 -0
  318. package/dist/serialization/resources/speechEngine/client/requests/index.js +7 -0
  319. package/dist/serialization/resources/speechEngine/index.d.ts +1 -0
  320. package/dist/serialization/resources/speechEngine/index.js +17 -0
  321. package/dist/serialization/resources/speechToSpeech/types/SpeechToSpeechConvertRequestOutputFormat.d.ts +1 -1
  322. package/dist/serialization/resources/speechToSpeech/types/SpeechToSpeechConvertRequestOutputFormat.js +16 -9
  323. package/dist/serialization/resources/webhooks/client/requests/BodyUpdateWorkspaceWebhookV1WorkspaceWebhooksWebhookIdPatch.d.ts +1 -0
  324. package/dist/serialization/resources/webhooks/client/requests/BodyUpdateWorkspaceWebhookV1WorkspaceWebhooksWebhookIdPatch.js +1 -0
  325. package/dist/serialization/resources/workspace/resources/analytics/index.d.ts +1 -0
  326. package/dist/serialization/resources/workspace/resources/analytics/index.js +17 -0
  327. package/dist/serialization/resources/workspace/resources/analytics/resources/index.d.ts +3 -0
  328. package/dist/serialization/resources/workspace/resources/analytics/resources/index.js +42 -0
  329. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/client/index.d.ts +1 -0
  330. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/client/index.js +17 -0
  331. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/client/requests/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPost.d.ts +16 -0
  332. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/client/requests/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPost.js +48 -0
  333. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/client/requests/index.d.ts +1 -0
  334. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/client/requests/index.js +5 -0
  335. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/index.d.ts +2 -0
  336. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/index.js +18 -0
  337. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/types/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort.d.ts +7 -0
  338. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/types/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort.js +39 -0
  339. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/types/index.d.ts +1 -0
  340. package/dist/serialization/resources/workspace/resources/analytics/resources/requests/types/index.js +17 -0
  341. package/dist/serialization/resources/workspace/resources/index.d.ts +1 -0
  342. package/dist/serialization/resources/workspace/resources/index.js +2 -1
  343. package/dist/serialization/types/AgentAlertingMonitorConfig.d.ts +9 -0
  344. package/dist/serialization/types/AgentAlertingMonitorConfig.js +41 -0
  345. package/dist/serialization/types/AgentAlertingSettings.d.ts +10 -0
  346. package/dist/serialization/types/AgentAlertingSettings.js +42 -0
  347. package/dist/serialization/types/AgentMetadataDbModel.d.ts +13 -0
  348. package/dist/serialization/types/AgentMetadataDbModel.js +45 -0
  349. package/dist/serialization/types/AgentPlatformSettingsRequestModel.d.ts +2 -0
  350. package/dist/serialization/types/AgentPlatformSettingsRequestModel.js +2 -0
  351. package/dist/serialization/types/AgentPlatformSettingsResponseModel.d.ts +2 -0
  352. package/dist/serialization/types/AgentPlatformSettingsResponseModel.js +2 -0
  353. package/dist/serialization/types/AgentTopicResponseModel.d.ts +3 -0
  354. package/dist/serialization/types/AgentTopicResponseModel.js +3 -0
  355. package/dist/serialization/types/BackgroundMusicPresetId.d.ts +1 -1
  356. package/dist/serialization/types/BackgroundMusicPresetId.js +11 -1
  357. package/dist/serialization/types/BaseTurnConfig.d.ts +17 -0
  358. package/dist/serialization/types/BaseTurnConfig.js +49 -0
  359. package/dist/serialization/types/ClientEvent.d.ts +1 -1
  360. package/dist/serialization/types/ClientEvent.js +1 -0
  361. package/dist/serialization/types/CodeToolAllowedDomain.d.ts +10 -0
  362. package/dist/serialization/types/CodeToolAllowedDomain.js +42 -0
  363. package/dist/serialization/types/{ConversationTokenDbModel.d.ts → ConversationTokenResponseModel.d.ts} +3 -3
  364. package/dist/serialization/types/{ConversationTokenDbModel.js → ConversationTokenResponseModel.js} +3 -3
  365. package/dist/serialization/types/CreateSpeechEngineResponse.d.ts +9 -0
  366. package/dist/serialization/types/CreateSpeechEngineResponse.js +41 -0
  367. package/dist/serialization/types/GetAgentLinkResponseModel.d.ts +2 -2
  368. package/dist/serialization/types/GetAgentLinkResponseModel.js +2 -2
  369. package/dist/serialization/types/KnowledgeBaseDocumentChunksResponseModel.d.ts +11 -0
  370. package/dist/serialization/types/KnowledgeBaseDocumentChunksResponseModel.js +43 -0
  371. package/dist/serialization/types/ListSpeechEnginesResponse.d.ts +12 -0
  372. package/dist/serialization/types/ListSpeechEnginesResponse.js +44 -0
  373. package/dist/serialization/types/Llm.d.ts +1 -1
  374. package/dist/serialization/types/Llm.js +4 -0
  375. package/dist/serialization/types/LlmInfoModelInput.d.ts +2 -0
  376. package/dist/serialization/types/LlmInfoModelInput.js +2 -0
  377. package/dist/serialization/types/LlmInfoModelOutput.d.ts +2 -0
  378. package/dist/serialization/types/LlmInfoModelOutput.js +2 -0
  379. package/dist/serialization/types/Monitor.d.ts +7 -0
  380. package/dist/serialization/types/Monitor.js +39 -0
  381. package/dist/serialization/types/PhoneNumberAgentInfo.d.ts +2 -0
  382. package/dist/serialization/types/PhoneNumberAgentInfo.js +2 -0
  383. package/dist/serialization/types/ProcedureCompilerMode.d.ts +1 -1
  384. package/dist/serialization/types/ProcedureCompilerMode.js +1 -1
  385. package/dist/serialization/types/ReadMetadataChapterDbModel.d.ts +1 -0
  386. package/dist/serialization/types/ReadMetadataChapterDbModel.js +1 -0
  387. package/dist/serialization/types/RegionalProcessingSurchargeInfo.d.ts +9 -0
  388. package/dist/serialization/types/RegionalProcessingSurchargeInfo.js +41 -0
  389. package/dist/serialization/types/ReportKnowledgeGapParams.d.ts +9 -0
  390. package/dist/serialization/types/ReportKnowledgeGapParams.js +41 -0
  391. package/dist/serialization/types/SpeechEngineResponse.d.ts +28 -0
  392. package/dist/serialization/types/SpeechEngineResponse.js +60 -0
  393. package/dist/serialization/types/SpeechEngineSummaryResponse.d.ts +12 -0
  394. package/dist/serialization/types/SpeechEngineSummaryResponse.js +44 -0
  395. package/dist/serialization/types/TurnConfig.d.ts +1 -1
  396. package/dist/serialization/types/TurnConfig.js +1 -1
  397. package/dist/serialization/types/TurnConfigWorkflowOverride.d.ts +1 -1
  398. package/dist/serialization/types/TurnConfigWorkflowOverride.js +1 -1
  399. package/dist/serialization/types/WebhookHmacSettings.d.ts +1 -0
  400. package/dist/serialization/types/WebhookHmacSettings.js +1 -0
  401. package/dist/serialization/types/WorkspaceApiKeyResponseModel.d.ts +1 -0
  402. package/dist/serialization/types/WorkspaceApiKeyResponseModel.js +1 -0
  403. package/dist/serialization/types/WorkspaceGroupPermission.d.ts +1 -1
  404. package/dist/serialization/types/WorkspaceGroupPermission.js +2 -0
  405. package/dist/serialization/types/index.d.ts +14 -1
  406. package/dist/serialization/types/index.js +14 -1
  407. package/dist/version.d.ts +1 -1
  408. package/dist/version.js +1 -1
  409. package/dist/wrapper/ElevenLabsClient.d.ts +5 -2
  410. package/dist/wrapper/ElevenLabsClient.js +9 -1
  411. package/dist/wrapper/index.d.ts +1 -0
  412. package/dist/wrapper/index.js +8 -1
  413. package/dist/wrapper/speech-engine/SpeechEngineAttachment.d.ts +21 -0
  414. package/dist/wrapper/speech-engine/SpeechEngineAttachment.js +34 -0
  415. package/dist/wrapper/speech-engine/SpeechEngineClientWrapper.d.ts +103 -0
  416. package/dist/wrapper/speech-engine/SpeechEngineClientWrapper.js +140 -0
  417. package/dist/wrapper/speech-engine/SpeechEngineResource.d.ts +78 -0
  418. package/dist/wrapper/speech-engine/SpeechEngineResource.js +261 -0
  419. package/dist/wrapper/speech-engine/SpeechEngineServer.d.ts +54 -0
  420. package/dist/wrapper/speech-engine/SpeechEngineServer.js +135 -0
  421. package/dist/wrapper/speech-engine/SpeechEngineSession.d.ts +79 -0
  422. package/dist/wrapper/speech-engine/SpeechEngineSession.js +300 -0
  423. package/dist/wrapper/speech-engine/index.d.ts +7 -0
  424. package/dist/wrapper/speech-engine/index.js +47 -0
  425. package/dist/wrapper/speech-engine/namespace.d.ts +27 -0
  426. package/dist/wrapper/speech-engine/namespace.js +37 -0
  427. package/dist/wrapper/speech-engine/types.d.ts +67 -0
  428. package/dist/wrapper/speech-engine/types.js +15 -0
  429. package/package.json +1 -1
  430. package/reference.md +551 -6
  431. package/serialization/resources/conversationalAi/resources/knowledgeBase/resources/document/types/DocumentUpdateFileResponse.d.ts +23 -0
  432. package/serialization/resources/conversationalAi/resources/knowledgeBase/resources/document/types/DocumentUpdateFileResponse.js +53 -0
  433. package/serialization/resources/conversationalAi/resources/knowledgeBase/resources/document/types/index.d.ts +1 -0
  434. package/serialization/resources/conversationalAi/resources/knowledgeBase/resources/document/types/index.js +1 -0
  435. package/serialization/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/requests/BodyUpdateDocumentV1ConvaiKnowledgeBaseDocumentationIdPatch.d.ts +2 -1
  436. package/serialization/resources/conversationalAi/resources/knowledgeBase/resources/documents/client/requests/BodyUpdateDocumentV1ConvaiKnowledgeBaseDocumentationIdPatch.js +2 -1
  437. package/serialization/resources/conversationalAi/resources/phoneNumbers/client/requests/UpdatePhoneNumberRequest.d.ts +2 -0
  438. package/serialization/resources/conversationalAi/resources/phoneNumbers/client/requests/UpdatePhoneNumberRequest.js +2 -0
  439. package/serialization/resources/index.d.ts +2 -0
  440. package/serialization/resources/index.js +3 -1
  441. package/serialization/resources/serviceAccounts/resources/apiKeys/client/requests/BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPost.d.ts +1 -0
  442. package/serialization/resources/serviceAccounts/resources/apiKeys/client/requests/BodyCreateServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysPost.js +1 -0
  443. package/serialization/resources/serviceAccounts/resources/apiKeys/client/requests/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatch.d.ts +2 -0
  444. package/serialization/resources/serviceAccounts/resources/apiKeys/client/requests/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatch.js +2 -0
  445. package/serialization/resources/serviceAccounts/resources/apiKeys/types/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps.d.ts +7 -0
  446. package/serialization/resources/serviceAccounts/resources/apiKeys/types/BodyEditServiceAccountApiKeyV1ServiceAccountsServiceAccountUserIdApiKeysApiKeyIdPatchAllowedIps.js +43 -0
  447. package/serialization/resources/serviceAccounts/resources/apiKeys/types/index.d.ts +1 -0
  448. package/serialization/resources/serviceAccounts/resources/apiKeys/types/index.js +1 -0
  449. package/serialization/resources/speechEngine/client/index.d.ts +1 -0
  450. package/serialization/resources/speechEngine/client/index.js +17 -0
  451. package/serialization/resources/speechEngine/client/requests/CreateSpeechEngineRequest.d.ts +25 -0
  452. package/serialization/resources/speechEngine/client/requests/CreateSpeechEngineRequest.js +57 -0
  453. package/serialization/resources/speechEngine/client/requests/UpdateSpeechEngineRequest.d.ts +25 -0
  454. package/serialization/resources/speechEngine/client/requests/UpdateSpeechEngineRequest.js +57 -0
  455. package/serialization/resources/speechEngine/client/requests/index.d.ts +2 -0
  456. package/serialization/resources/speechEngine/client/requests/index.js +7 -0
  457. package/serialization/resources/speechEngine/index.d.ts +1 -0
  458. package/serialization/resources/speechEngine/index.js +17 -0
  459. package/serialization/resources/speechToSpeech/types/SpeechToSpeechConvertRequestOutputFormat.d.ts +1 -1
  460. package/serialization/resources/speechToSpeech/types/SpeechToSpeechConvertRequestOutputFormat.js +16 -9
  461. package/serialization/resources/webhooks/client/requests/BodyUpdateWorkspaceWebhookV1WorkspaceWebhooksWebhookIdPatch.d.ts +1 -0
  462. package/serialization/resources/webhooks/client/requests/BodyUpdateWorkspaceWebhookV1WorkspaceWebhooksWebhookIdPatch.js +1 -0
  463. package/serialization/resources/workspace/resources/analytics/index.d.ts +1 -0
  464. package/serialization/resources/workspace/resources/analytics/index.js +17 -0
  465. package/serialization/resources/workspace/resources/analytics/resources/index.d.ts +3 -0
  466. package/serialization/resources/workspace/resources/analytics/resources/index.js +42 -0
  467. package/serialization/resources/workspace/resources/analytics/resources/requests/client/index.d.ts +1 -0
  468. package/serialization/resources/workspace/resources/analytics/resources/requests/client/index.js +17 -0
  469. package/serialization/resources/workspace/resources/analytics/resources/requests/client/requests/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPost.d.ts +16 -0
  470. package/serialization/resources/workspace/resources/analytics/resources/requests/client/requests/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPost.js +48 -0
  471. package/serialization/resources/workspace/resources/analytics/resources/requests/client/requests/index.d.ts +1 -0
  472. package/serialization/resources/workspace/resources/analytics/resources/requests/client/requests/index.js +5 -0
  473. package/serialization/resources/workspace/resources/analytics/resources/requests/index.d.ts +2 -0
  474. package/serialization/resources/workspace/resources/analytics/resources/requests/index.js +18 -0
  475. package/serialization/resources/workspace/resources/analytics/resources/requests/types/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort.d.ts +7 -0
  476. package/serialization/resources/workspace/resources/analytics/resources/requests/types/BodyListApiRequestsV1WorkspaceAnalyticsRequestsPostSort.js +39 -0
  477. package/serialization/resources/workspace/resources/analytics/resources/requests/types/index.d.ts +1 -0
  478. package/serialization/resources/workspace/resources/analytics/resources/requests/types/index.js +17 -0
  479. package/serialization/resources/workspace/resources/index.d.ts +1 -0
  480. package/serialization/resources/workspace/resources/index.js +2 -1
  481. package/serialization/types/AgentAlertingMonitorConfig.d.ts +9 -0
  482. package/serialization/types/AgentAlertingMonitorConfig.js +41 -0
  483. package/serialization/types/AgentAlertingSettings.d.ts +10 -0
  484. package/serialization/types/AgentAlertingSettings.js +42 -0
  485. package/serialization/types/AgentMetadataDbModel.d.ts +13 -0
  486. package/serialization/types/AgentMetadataDbModel.js +45 -0
  487. package/serialization/types/AgentPlatformSettingsRequestModel.d.ts +2 -0
  488. package/serialization/types/AgentPlatformSettingsRequestModel.js +2 -0
  489. package/serialization/types/AgentPlatformSettingsResponseModel.d.ts +2 -0
  490. package/serialization/types/AgentPlatformSettingsResponseModel.js +2 -0
  491. package/serialization/types/AgentTopicResponseModel.d.ts +3 -0
  492. package/serialization/types/AgentTopicResponseModel.js +3 -0
  493. package/serialization/types/BackgroundMusicPresetId.d.ts +1 -1
  494. package/serialization/types/BackgroundMusicPresetId.js +11 -1
  495. package/serialization/types/BaseTurnConfig.d.ts +17 -0
  496. package/serialization/types/BaseTurnConfig.js +49 -0
  497. package/serialization/types/ClientEvent.d.ts +1 -1
  498. package/serialization/types/ClientEvent.js +1 -0
  499. package/serialization/types/CodeToolAllowedDomain.d.ts +10 -0
  500. package/serialization/types/CodeToolAllowedDomain.js +42 -0
  501. package/serialization/types/{ConversationTokenDbModel.d.ts → ConversationTokenResponseModel.d.ts} +3 -3
  502. package/serialization/types/{ConversationTokenDbModel.js → ConversationTokenResponseModel.js} +3 -3
  503. package/serialization/types/CreateSpeechEngineResponse.d.ts +9 -0
  504. package/serialization/types/CreateSpeechEngineResponse.js +41 -0
  505. package/serialization/types/GetAgentLinkResponseModel.d.ts +2 -2
  506. package/serialization/types/GetAgentLinkResponseModel.js +2 -2
  507. package/serialization/types/KnowledgeBaseDocumentChunksResponseModel.d.ts +11 -0
  508. package/serialization/types/KnowledgeBaseDocumentChunksResponseModel.js +43 -0
  509. package/serialization/types/ListSpeechEnginesResponse.d.ts +12 -0
  510. package/serialization/types/ListSpeechEnginesResponse.js +44 -0
  511. package/serialization/types/Llm.d.ts +1 -1
  512. package/serialization/types/Llm.js +4 -0
  513. package/serialization/types/LlmInfoModelInput.d.ts +2 -0
  514. package/serialization/types/LlmInfoModelInput.js +2 -0
  515. package/serialization/types/LlmInfoModelOutput.d.ts +2 -0
  516. package/serialization/types/LlmInfoModelOutput.js +2 -0
  517. package/serialization/types/Monitor.d.ts +7 -0
  518. package/serialization/types/Monitor.js +39 -0
  519. package/serialization/types/PhoneNumberAgentInfo.d.ts +2 -0
  520. package/serialization/types/PhoneNumberAgentInfo.js +2 -0
  521. package/serialization/types/ProcedureCompilerMode.d.ts +1 -1
  522. package/serialization/types/ProcedureCompilerMode.js +1 -1
  523. package/serialization/types/ReadMetadataChapterDbModel.d.ts +1 -0
  524. package/serialization/types/ReadMetadataChapterDbModel.js +1 -0
  525. package/serialization/types/RegionalProcessingSurchargeInfo.d.ts +9 -0
  526. package/serialization/types/RegionalProcessingSurchargeInfo.js +41 -0
  527. package/serialization/types/ReportKnowledgeGapParams.d.ts +9 -0
  528. package/serialization/types/ReportKnowledgeGapParams.js +41 -0
  529. package/serialization/types/SpeechEngineResponse.d.ts +28 -0
  530. package/serialization/types/SpeechEngineResponse.js +60 -0
  531. package/serialization/types/SpeechEngineSummaryResponse.d.ts +12 -0
  532. package/serialization/types/SpeechEngineSummaryResponse.js +44 -0
  533. package/serialization/types/TurnConfig.d.ts +1 -1
  534. package/serialization/types/TurnConfig.js +1 -1
  535. package/serialization/types/TurnConfigWorkflowOverride.d.ts +1 -1
  536. package/serialization/types/TurnConfigWorkflowOverride.js +1 -1
  537. package/serialization/types/WebhookHmacSettings.d.ts +1 -0
  538. package/serialization/types/WebhookHmacSettings.js +1 -0
  539. package/serialization/types/WorkspaceApiKeyResponseModel.d.ts +1 -0
  540. package/serialization/types/WorkspaceApiKeyResponseModel.js +1 -0
  541. package/serialization/types/WorkspaceGroupPermission.d.ts +1 -1
  542. package/serialization/types/WorkspaceGroupPermission.js +2 -0
  543. package/serialization/types/index.d.ts +14 -1
  544. package/serialization/types/index.js +14 -1
  545. package/version.d.ts +1 -1
  546. package/version.js +1 -1
  547. package/wrapper/ElevenLabsClient.d.ts +5 -2
  548. package/wrapper/ElevenLabsClient.js +9 -1
  549. package/wrapper/index.d.ts +1 -0
  550. package/wrapper/index.js +8 -1
  551. package/wrapper/speech-engine/SpeechEngineAttachment.d.ts +21 -0
  552. package/wrapper/speech-engine/SpeechEngineAttachment.js +34 -0
  553. package/wrapper/speech-engine/SpeechEngineClientWrapper.d.ts +103 -0
  554. package/wrapper/speech-engine/SpeechEngineClientWrapper.js +140 -0
  555. package/wrapper/speech-engine/SpeechEngineResource.d.ts +78 -0
  556. package/wrapper/speech-engine/SpeechEngineResource.js +261 -0
  557. package/wrapper/speech-engine/SpeechEngineServer.d.ts +54 -0
  558. package/wrapper/speech-engine/SpeechEngineServer.js +135 -0
  559. package/wrapper/speech-engine/SpeechEngineSession.d.ts +79 -0
  560. package/wrapper/speech-engine/SpeechEngineSession.js +300 -0
  561. package/wrapper/speech-engine/index.d.ts +7 -0
  562. package/wrapper/speech-engine/index.js +47 -0
  563. package/wrapper/speech-engine/namespace.d.ts +27 -0
  564. package/wrapper/speech-engine/namespace.js +37 -0
  565. package/wrapper/speech-engine/types.d.ts +67 -0
  566. package/wrapper/speech-engine/types.js +15 -0
  567. /package/api/{types/ConversationTokenDbModel.js → resources/conversationalAi/resources/knowledgeBase/resources/document/client/requests/BodyUpdateFileDocumentV1ConvaiKnowledgeBaseDocumentationIdUpdateFilePatch.js} +0 -0
  568. /package/{dist/api/types/ConversationTokenDbModel.js → api/resources/conversationalAi/resources/knowledgeBase/resources/document/types/DocumentUpdateFileResponse.js} +0 -0
@@ -0,0 +1,78 @@
1
+ import type { Server as HttpServer } from "node:http";
2
+ import WebSocket from "ws";
3
+ import type { BaseClientOptions, NormalizedClientOptions } from "../../BaseClient";
4
+ import { type SpeechEngineCallbacks } from "./types";
5
+ import { SpeechEngineSession } from "./SpeechEngineSession";
6
+ import { SpeechEngineAttachment } from "./SpeechEngineAttachment";
7
+ /**
8
+ * Represents a speech engine instance. Returned by `elevenlabs.speechEngine.get()`.
9
+ *
10
+ * Use `engine.attach(httpServer, path, callbacks)` to integrate with an existing
11
+ * HTTP server, or drop down to `engine.verifyRequest()` and `engine.createSession()`
12
+ * for full control.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * const engine = await elevenlabs.speechEngine.get("seng_123");
17
+ *
18
+ * engine.attach(httpServer, "/api/speech-engine/ws", {
19
+ * async onTranscript(transcript, signal, session) {
20
+ * session.sendResponse(await llm.generate(transcript, { signal }));
21
+ * },
22
+ * });
23
+ * ```
24
+ */
25
+ export declare class SpeechEngineResource {
26
+ readonly engineId: string;
27
+ /** @internal */
28
+ readonly _options: NormalizedClientOptions<BaseClientOptions>;
29
+ /** @internal */
30
+ constructor(engineId: string, options: NormalizedClientOptions<BaseClientOptions>);
31
+ /**
32
+ * Attach to an existing HTTP server and begin accepting Speech Engine
33
+ * connections at the given path.
34
+ *
35
+ * Handles WebSocket upgrades, path routing, and request verification
36
+ * automatically. Returns a `SpeechEngineAttachment` whose `.close()` stops
37
+ * accepting connections without affecting the HTTP server.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * engine.attach(httpServer, "/api/speech-engine/ws", {
42
+ * async onTranscript(transcript, signal, session) {
43
+ * const stream = await openai.responses.create({ model: "gpt-4o", input: transcript, stream: true }, { signal });
44
+ * session.sendResponse(stream);
45
+ * },
46
+ * });
47
+ * ```
48
+ */
49
+ attach(httpServer: HttpServer, path: string, handler: SpeechEngineCallbacks): SpeechEngineAttachment;
50
+ /**
51
+ * Verify that an incoming HTTP upgrade request is a legitimate connection
52
+ * from the ElevenLabs Speech Engine API.
53
+ *
54
+ * Checks the `X-Elevenlabs-Speech-Engine-Authorization` header for a valid
55
+ * JWT signed with the SHA-256 hash of the API key.
56
+ *
57
+ * Only needed when managing the WebSocket upgrade yourself. When using
58
+ * `engine.attach()`, verification is handled automatically.
59
+ */
60
+ verifyRequest(req: {
61
+ headers: Record<string, string | string[] | undefined>;
62
+ }): Promise<boolean>;
63
+ /** @internal Returns `null` when the request is valid, or a human-readable reason when rejected. */
64
+ private getVerificationFailure;
65
+ /**
66
+ * Wrap an accepted WebSocket in a `SpeechEngineSession`.
67
+ *
68
+ * Only needed when managing the WebSocket upgrade yourself. When using
69
+ * `engine.attach()`, sessions are created automatically.
70
+ */
71
+ createSession(ws: WebSocket, options?: {
72
+ debug?: boolean;
73
+ }): SpeechEngineSession;
74
+ /** @internal */
75
+ private wireHandler;
76
+ }
77
+ /** @internal — exported for testing only */
78
+ export declare function verifySpeechEngineJwt(value: string, apiKey: string): Record<string, unknown>;
@@ -0,0 +1,261 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.SpeechEngineResource = void 0;
49
+ exports.verifySpeechEngineJwt = verifySpeechEngineJwt;
50
+ const node_crypto_1 = require("node:crypto");
51
+ const ws_1 = __importDefault(require("ws"));
52
+ const core = __importStar(require("../../core"));
53
+ const types_1 = require("./types");
54
+ const SpeechEngineSession_1 = require("./SpeechEngineSession");
55
+ const SpeechEngineAttachment_1 = require("./SpeechEngineAttachment");
56
+ /**
57
+ * Represents a speech engine instance. Returned by `elevenlabs.speechEngine.get()`.
58
+ *
59
+ * Use `engine.attach(httpServer, path, callbacks)` to integrate with an existing
60
+ * HTTP server, or drop down to `engine.verifyRequest()` and `engine.createSession()`
61
+ * for full control.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * const engine = await elevenlabs.speechEngine.get("seng_123");
66
+ *
67
+ * engine.attach(httpServer, "/api/speech-engine/ws", {
68
+ * async onTranscript(transcript, signal, session) {
69
+ * session.sendResponse(await llm.generate(transcript, { signal }));
70
+ * },
71
+ * });
72
+ * ```
73
+ */
74
+ class SpeechEngineResource {
75
+ /** @internal */
76
+ constructor(engineId, options) {
77
+ this.engineId = engineId;
78
+ this._options = options;
79
+ }
80
+ /**
81
+ * Attach to an existing HTTP server and begin accepting Speech Engine
82
+ * connections at the given path.
83
+ *
84
+ * Handles WebSocket upgrades, path routing, and request verification
85
+ * automatically. Returns a `SpeechEngineAttachment` whose `.close()` stops
86
+ * accepting connections without affecting the HTTP server.
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * engine.attach(httpServer, "/api/speech-engine/ws", {
91
+ * async onTranscript(transcript, signal, session) {
92
+ * const stream = await openai.responses.create({ model: "gpt-4o", input: transcript, stream: true }, { signal });
93
+ * session.sendResponse(stream);
94
+ * },
95
+ * });
96
+ * ```
97
+ */
98
+ attach(httpServer, path, handler) {
99
+ var _a;
100
+ const debug = (_a = handler.debug) !== null && _a !== void 0 ? _a : false;
101
+ const log = debug ? (...args) => console.log("[SpeechEngine]", ...args) : () => { };
102
+ const wss = new ws_1.default.Server({ noServer: true });
103
+ const upgradeListener = (req, socket, head) => __awaiter(this, void 0, void 0, function* () {
104
+ var _a;
105
+ const url = new URL((_a = req.url) !== null && _a !== void 0 ? _a : "/", `http://${req.headers.host}`);
106
+ log(`upgrade request: ${req.method} ${url.pathname}`);
107
+ if (url.pathname !== path) {
108
+ log(`path mismatch: expected ${path}, got ${url.pathname} — skipping`);
109
+ return;
110
+ }
111
+ if (!(yield this.verifyRequest(req))) {
112
+ // verifyRequest returned false — get the detailed reason for debug logging
113
+ const reason = yield this.getVerificationFailure(req);
114
+ log(`rejected connection — ${reason}`);
115
+ socket.destroy();
116
+ return;
117
+ }
118
+ log("upgrading connection to WebSocket");
119
+ wss.handleUpgrade(req, socket, head, (ws) => {
120
+ log("WebSocket connection established");
121
+ wss.emit("connection", ws);
122
+ });
123
+ });
124
+ httpServer.on("upgrade", upgradeListener);
125
+ wss.on("connection", (ws) => {
126
+ log("creating new session");
127
+ const session = this.createSession(ws, { debug });
128
+ this.wireHandler(session, handler);
129
+ });
130
+ log(`listening for WebSocket upgrades on ${path}`);
131
+ return new SpeechEngineAttachment_1.SpeechEngineAttachment(wss, httpServer, upgradeListener);
132
+ }
133
+ /**
134
+ * Verify that an incoming HTTP upgrade request is a legitimate connection
135
+ * from the ElevenLabs Speech Engine API.
136
+ *
137
+ * Checks the `X-Elevenlabs-Speech-Engine-Authorization` header for a valid
138
+ * JWT signed with the SHA-256 hash of the API key.
139
+ *
140
+ * Only needed when managing the WebSocket upgrade yourself. When using
141
+ * `engine.attach()`, verification is handled automatically.
142
+ */
143
+ verifyRequest(req) {
144
+ return __awaiter(this, void 0, void 0, function* () {
145
+ return (yield this.getVerificationFailure(req)) === null;
146
+ });
147
+ }
148
+ /** @internal Returns `null` when the request is valid, or a human-readable reason when rejected. */
149
+ getVerificationFailure(req) {
150
+ return __awaiter(this, void 0, void 0, function* () {
151
+ const apiKey = yield core.Supplier.get(this._options.apiKey);
152
+ if (!apiKey) {
153
+ return "no API key configured on the client";
154
+ }
155
+ const raw = req.headers["x-elevenlabs-speech-engine-authorization"];
156
+ const headerValue = Array.isArray(raw) ? raw[0] : raw;
157
+ if (!headerValue) {
158
+ return "missing X-Elevenlabs-Speech-Engine-Authorization header";
159
+ }
160
+ try {
161
+ verifySpeechEngineJwt(headerValue, apiKey);
162
+ return null;
163
+ }
164
+ catch (err) {
165
+ return err instanceof Error ? err.message : String(err);
166
+ }
167
+ });
168
+ }
169
+ /**
170
+ * Wrap an accepted WebSocket in a `SpeechEngineSession`.
171
+ *
172
+ * Only needed when managing the WebSocket upgrade yourself. When using
173
+ * `engine.attach()`, sessions are created automatically.
174
+ */
175
+ createSession(ws, options) {
176
+ return new SpeechEngineSession_1.SpeechEngineSession(ws, options);
177
+ }
178
+ /** @internal */
179
+ wireHandler(session, handler) {
180
+ const { onInit, onTranscript, onClose, onDisconnect, onError } = handler;
181
+ if (onInit)
182
+ session.on("init", (id) => onInit.call(session, id, session));
183
+ if (onTranscript) {
184
+ session.on("user_transcript", (t, s) => {
185
+ Promise.resolve(onTranscript.call(session, t, s, session)).catch((err) => {
186
+ if ((0, types_1.isAbortError)(err))
187
+ return;
188
+ const error = err instanceof Error ? err : new Error(String(err));
189
+ if (onError)
190
+ onError.call(session, error, session);
191
+ });
192
+ });
193
+ }
194
+ if (onClose)
195
+ session.on("close", () => onClose.call(session, session));
196
+ if (onDisconnect)
197
+ session.on("disconnected", () => onDisconnect.call(session, session));
198
+ if (onError)
199
+ session.on("error", (err) => onError.call(session, err, session));
200
+ }
201
+ }
202
+ exports.SpeechEngineResource = SpeechEngineResource;
203
+ // ---------------------------------------------------------------------------
204
+ // JWT verification (HS256, no external dependency)
205
+ // ---------------------------------------------------------------------------
206
+ const ISSUER = "https://api.elevenlabs.io/convai/speech-engine";
207
+ const SUBJECT = "convai_speech_engine_upstream";
208
+ const LEEWAY_SECONDS = 60;
209
+ function base64UrlDecode(input) {
210
+ const padded = input.replace(/-/g, "+").replace(/_/g, "/");
211
+ return Buffer.from(padded, "base64");
212
+ }
213
+ /** @internal — exported for testing only */
214
+ function verifySpeechEngineJwt(value, apiKey) {
215
+ let token = value.trim();
216
+ if (token.toLowerCase().startsWith("bearer ")) {
217
+ token = token.slice(7).trim();
218
+ }
219
+ const parts = token.split(".");
220
+ if (parts.length !== 3) {
221
+ throw new Error("Invalid JWT: expected 3 parts");
222
+ }
223
+ const [headerB64, payloadB64, signatureB64] = parts;
224
+ let payload;
225
+ try {
226
+ payload = JSON.parse(base64UrlDecode(payloadB64).toString("utf-8"));
227
+ }
228
+ catch (_a) {
229
+ throw new Error("Invalid JWT: failed to decode payload");
230
+ }
231
+ // SHA-256 hash of the API key, used as the HMAC secret
232
+ const trimmedKey = apiKey.trim();
233
+ const secret = (0, node_crypto_1.createHash)("sha256").update(trimmedKey, "utf-8").digest();
234
+ const expectedSignature = (0, node_crypto_1.createHmac)("sha256", secret)
235
+ .update(`${headerB64}.${payloadB64}`)
236
+ .digest();
237
+ const actualSignature = base64UrlDecode(signatureB64);
238
+ if (!expectedSignature.equals(actualSignature)) {
239
+ throw new Error("Invalid JWT: signature mismatch — make sure the API key used by your Speech Engine server matches the one used to create the engine.");
240
+ }
241
+ if (payload.iss !== ISSUER) {
242
+ throw new Error(`Invalid JWT: expected issuer "${ISSUER}", got "${payload.iss}"`);
243
+ }
244
+ if (payload.sub !== SUBJECT) {
245
+ throw new Error(`Invalid JWT: expected subject "${SUBJECT}", got "${payload.sub}"`);
246
+ }
247
+ const now = Math.floor(Date.now() / 1000);
248
+ if (typeof payload.exp !== "number") {
249
+ throw new Error("Invalid JWT: missing exp claim");
250
+ }
251
+ if (typeof payload.iat !== "number") {
252
+ throw new Error("Invalid JWT: missing iat claim");
253
+ }
254
+ if (payload.exp + LEEWAY_SECONDS < now) {
255
+ throw new Error("Invalid JWT: token has expired");
256
+ }
257
+ if (payload.iat - LEEWAY_SECONDS > now) {
258
+ throw new Error("Invalid JWT: iat is in the future");
259
+ }
260
+ return payload;
261
+ }
@@ -0,0 +1,54 @@
1
+ import WebSocket from "ws";
2
+ import { type SpeechEngineCallbacks } from "./types";
3
+ import { SpeechEngineSession } from "./SpeechEngineSession";
4
+ export interface SpeechEngineServerOptions extends SpeechEngineCallbacks {
5
+ /**
6
+ * Port to listen on. Defaults to 3001.
7
+ */
8
+ port?: number;
9
+ /**
10
+ * Your ElevenLabs API key. Used to verify that incoming WebSocket
11
+ * connections originate from the ElevenLabs API.
12
+ *
13
+ * When omitted, the server will reject all connections and throw
14
+ * an error on start. Pass `{ apiKey: "..." }` or set the
15
+ * `ELEVENLABS_API_KEY` environment variable.
16
+ */
17
+ apiKey?: string;
18
+ /**
19
+ * The ID of the speech engine this server handles connections for.
20
+ * Populated automatically when created via `engine.listen()`.
21
+ */
22
+ engineId?: string;
23
+ }
24
+ /**
25
+ * Standalone WebSocket server that produces `SpeechEngineSession` instances for
26
+ * each incoming connection from the ElevenLabs Speech Engine API.
27
+ *
28
+ * Every incoming connection is verified against the ElevenLabs API using the
29
+ * configured API key before being accepted.
30
+ *
31
+ * For integration with an existing HTTP server (e.g. Express, Next.js), use
32
+ * `engine.attach()` instead.
33
+ */
34
+ export declare class SpeechEngineServer {
35
+ private wss;
36
+ private httpServer;
37
+ private options;
38
+ constructor(options: SpeechEngineServerOptions);
39
+ /**
40
+ * Create a `SpeechEngineSession` from an existing WebSocket. Use this
41
+ * when you manage your own WebSocket server and want to wrap individual
42
+ * connections.
43
+ */
44
+ handleConnection(ws: WebSocket): SpeechEngineSession;
45
+ /**
46
+ * Start the standalone WebSocket server on the configured port.
47
+ */
48
+ start(): void;
49
+ private wireHandler;
50
+ /**
51
+ * Stop the WebSocket server and close all active connections.
52
+ */
53
+ stop(): Promise<void>;
54
+ }
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SpeechEngineServer = void 0;
7
+ const node_http_1 = require("node:http");
8
+ const ws_1 = __importDefault(require("ws"));
9
+ const types_1 = require("./types");
10
+ const SpeechEngineSession_1 = require("./SpeechEngineSession");
11
+ const SpeechEngineResource_1 = require("./SpeechEngineResource");
12
+ /**
13
+ * Standalone WebSocket server that produces `SpeechEngineSession` instances for
14
+ * each incoming connection from the ElevenLabs Speech Engine API.
15
+ *
16
+ * Every incoming connection is verified against the ElevenLabs API using the
17
+ * configured API key before being accepted.
18
+ *
19
+ * For integration with an existing HTTP server (e.g. Express, Next.js), use
20
+ * `engine.attach()` instead.
21
+ */
22
+ class SpeechEngineServer {
23
+ constructor(options) {
24
+ this.wss = null;
25
+ this.httpServer = null;
26
+ this.options = options;
27
+ }
28
+ /**
29
+ * Create a `SpeechEngineSession` from an existing WebSocket. Use this
30
+ * when you manage your own WebSocket server and want to wrap individual
31
+ * connections.
32
+ */
33
+ handleConnection(ws) {
34
+ const session = new SpeechEngineSession_1.SpeechEngineSession(ws, { debug: this.options.debug });
35
+ this.wireHandler(session);
36
+ return session;
37
+ }
38
+ /**
39
+ * Start the standalone WebSocket server on the configured port.
40
+ */
41
+ start() {
42
+ var _a, _b, _c;
43
+ if (this.wss) {
44
+ throw new Error("Server is already started");
45
+ }
46
+ const apiKey = (_a = this.options.apiKey) !== null && _a !== void 0 ? _a : process.env.ELEVENLABS_API_KEY;
47
+ if (!apiKey) {
48
+ throw new Error("SpeechEngine.Server requires an API key to verify incoming connections. " +
49
+ "Pass { apiKey: \"...\" } or set the ELEVENLABS_API_KEY environment variable.");
50
+ }
51
+ const debug = (_b = this.options.debug) !== null && _b !== void 0 ? _b : false;
52
+ const log = debug ? (...args) => console.log("[SpeechEngine]", ...args) : () => { };
53
+ const httpServer = (0, node_http_1.createServer)();
54
+ const wss = new ws_1.default.Server({ noServer: true });
55
+ httpServer.on("upgrade", (req, socket, head) => {
56
+ const headerValue = req.headers["x-elevenlabs-speech-engine-authorization"];
57
+ const token = Array.isArray(headerValue) ? headerValue[0] : headerValue;
58
+ if (!token) {
59
+ log("rejected connection — missing X-Elevenlabs-Speech-Engine-Authorization header");
60
+ socket.destroy();
61
+ return;
62
+ }
63
+ try {
64
+ (0, SpeechEngineResource_1.verifySpeechEngineJwt)(token, apiKey);
65
+ }
66
+ catch (err) {
67
+ log(`rejected connection — ${err instanceof Error ? err.message : String(err)}`);
68
+ socket.destroy();
69
+ return;
70
+ }
71
+ log("verified connection, upgrading to WebSocket");
72
+ wss.handleUpgrade(req, socket, head, (ws) => {
73
+ wss.emit("connection", ws);
74
+ });
75
+ });
76
+ wss.on("connection", (ws) => {
77
+ this.handleConnection(ws);
78
+ });
79
+ httpServer.listen((_c = this.options.port) !== null && _c !== void 0 ? _c : 3001);
80
+ this.wss = wss;
81
+ this.httpServer = httpServer;
82
+ }
83
+ wireHandler(session) {
84
+ const { onInit, onTranscript, onClose, onDisconnect, onError } = this.options;
85
+ if (onInit)
86
+ session.on("init", (id) => onInit.call(session, id, session));
87
+ if (onTranscript) {
88
+ session.on("user_transcript", (t, s) => {
89
+ Promise.resolve(onTranscript.call(session, t, s, session)).catch((err) => {
90
+ if ((0, types_1.isAbortError)(err))
91
+ return;
92
+ const error = err instanceof Error ? err : new Error(String(err));
93
+ if (onError)
94
+ onError.call(session, error, session);
95
+ });
96
+ });
97
+ }
98
+ if (onClose)
99
+ session.on("close", () => onClose.call(session, session));
100
+ if (onDisconnect)
101
+ session.on("disconnected", () => onDisconnect.call(session, session));
102
+ if (onError)
103
+ session.on("error", (err) => onError.call(session, err, session));
104
+ }
105
+ /**
106
+ * Stop the WebSocket server and close all active connections.
107
+ */
108
+ stop() {
109
+ return new Promise((resolve, reject) => {
110
+ if (!this.wss) {
111
+ resolve();
112
+ return;
113
+ }
114
+ this.wss.close((wssErr) => {
115
+ this.wss = null;
116
+ if (this.httpServer) {
117
+ this.httpServer.close((httpErr) => {
118
+ this.httpServer = null;
119
+ if (wssErr || httpErr)
120
+ reject(wssErr || httpErr);
121
+ else
122
+ resolve();
123
+ });
124
+ }
125
+ else {
126
+ if (wssErr)
127
+ reject(wssErr);
128
+ else
129
+ resolve();
130
+ }
131
+ });
132
+ });
133
+ }
134
+ }
135
+ exports.SpeechEngineServer = SpeechEngineServer;
@@ -0,0 +1,79 @@
1
+ import { type SpeechEngineEventMap, type SpeechEngineEventName, type WebSocketLike } from "./types";
2
+ /**
3
+ * Wraps a WebSocket connection from the ElevenLabs Speech Engine API into a
4
+ * typed, event-driven session.
5
+ *
6
+ * The ElevenLabs API connects to the developer's server via WebSocket. Each
7
+ * connection represents one conversation. The session emits events for
8
+ * transcripts and lifecycle changes, and provides methods to send LLM
9
+ * responses back. When a new transcript arrives, the previous transcript's
10
+ * abort signal is fired automatically, cancelling any in-flight LLM call.
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * import { SpeechEngine } from "@elevenlabs/elevenlabs-js";
15
+ *
16
+ * wss.on("connection", (ws) => {
17
+ * const session = new SpeechEngine.Session(ws);
18
+ *
19
+ * session.on(SpeechEngine.USER_TRANSCRIPT, async (transcript, { signal }) => {
20
+ * const response = await llm.generate(transcript, { signal });
21
+ * session.sendResponse(response);
22
+ * });
23
+ * });
24
+ * ```
25
+ */
26
+ export declare class SpeechEngineSession {
27
+ private ws;
28
+ private emitter;
29
+ private currentAbortController;
30
+ private currentEventId;
31
+ private inTranscriptHandler;
32
+ private _conversationId;
33
+ private closed;
34
+ private log;
35
+ constructor(ws: WebSocketLike, options?: {
36
+ debug?: boolean;
37
+ });
38
+ on<E extends SpeechEngineEventName>(event: E, listener: (...args: SpeechEngineEventMap[E]) => void): this;
39
+ off<E extends SpeechEngineEventName>(event: E, listener: (...args: SpeechEngineEventMap[E]) => void): this;
40
+ once<E extends SpeechEngineEventName>(event: E, listener: (...args: SpeechEngineEventMap[E]) => void): this;
41
+ /**
42
+ * Send an LLM response back to the Speech Engine API for TTS synthesis.
43
+ *
44
+ * Accepts a complete string, an `AsyncIterable<string>` for streaming
45
+ * token-by-token responses, or an LLM stream that yields event objects
46
+ * (e.g. an OpenAI Responses API stream). Event objects are automatically
47
+ * parsed to extract text deltas.
48
+ */
49
+ sendResponse(response: string | AsyncIterable<unknown>): Promise<void>;
50
+ /**
51
+ * Close the session and the underlying WebSocket connection.
52
+ */
53
+ close(): void;
54
+ /**
55
+ * The conversation ID assigned by the Speech Engine API, available after
56
+ * the `init` event.
57
+ */
58
+ get conversationId(): string | undefined;
59
+ /**
60
+ * Whether the session is still open.
61
+ */
62
+ get isOpen(): boolean;
63
+ private setupWebSocket;
64
+ private handleMessage;
65
+ private streamResponse;
66
+ /**
67
+ * Extract text content from a stream chunk. Handles plain strings and
68
+ * common LLM stream event formats:
69
+ *
70
+ * - OpenAI Responses API (`response.output_text.delta`)
71
+ * - OpenAI Chat Completions API (`choices[0].delta.content`)
72
+ * - Anthropic Messages API (`content_block_delta` with `text_delta`)
73
+ * - Google Gemini API (`candidates[0].content.parts[0].text`)
74
+ */
75
+ private extractText;
76
+ private sendAgentResponse;
77
+ private send;
78
+ private abortCurrent;
79
+ }