@convai/web-sdk 1.9.0-beta.1 → 1.9.0-beta.12

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 (346) hide show
  1. package/README.md +35 -43
  2. package/dist/core/AudioManager.d.ts +0 -1
  3. package/dist/core/AudioManager.js +0 -1
  4. package/dist/core/BlendshapeQueue.d.ts +0 -1
  5. package/dist/core/BlendshapeQueue.js +20 -6
  6. package/dist/core/CharacterRoster.d.ts +0 -1
  7. package/dist/core/CharacterRoster.js +0 -1
  8. package/dist/core/CharacterVersionManager.d.ts +0 -1
  9. package/dist/core/CharacterVersionManager.js +0 -1
  10. package/dist/core/ConnectionStateHandler.d.ts +0 -1
  11. package/dist/core/ConnectionStateHandler.js +5 -2
  12. package/dist/core/ConvaiClient.d.ts +66 -3
  13. package/dist/core/ConvaiClient.js +253 -20
  14. package/dist/core/ConvaiRoomError.d.ts +0 -1
  15. package/dist/core/ConvaiRoomError.js +20 -2
  16. package/dist/core/EventEmitter.d.ts +0 -1
  17. package/dist/core/EventEmitter.js +0 -1
  18. package/dist/core/MemoryManager.d.ts +0 -1
  19. package/dist/core/MemoryManager.js +0 -1
  20. package/dist/core/MessageHandler.d.ts +5 -3
  21. package/dist/core/MessageHandler.js +125 -47
  22. package/dist/core/SSESession.d.ts +13 -9
  23. package/dist/core/SSESession.js +240 -13
  24. package/dist/core/ScreenShareManager.d.ts +0 -1
  25. package/dist/core/ScreenShareManager.js +0 -1
  26. package/dist/core/VideoManager.d.ts +0 -1
  27. package/dist/core/VideoManager.js +0 -1
  28. package/dist/core/characterInfo.d.ts +45 -0
  29. package/dist/core/characterInfo.js +55 -0
  30. package/dist/core/characterReference.d.ts +0 -1
  31. package/dist/core/characterReference.js +0 -1
  32. package/dist/core/connectRequest.d.ts +0 -1
  33. package/dist/core/connectRequest.js +0 -1
  34. package/dist/core/contextUpdateRequest.d.ts +0 -1
  35. package/dist/core/contextUpdateRequest.js +0 -1
  36. package/dist/core/index.d.ts +5 -2
  37. package/dist/core/index.js +20 -2
  38. package/dist/core/logicalTurn.d.ts +0 -1
  39. package/dist/core/logicalTurn.js +0 -1
  40. package/dist/core/modelOutput.d.ts +0 -1
  41. package/dist/core/modelOutput.js +0 -1
  42. package/dist/core/publishedChat.d.ts +0 -1
  43. package/dist/core/publishedChat.js +0 -1
  44. package/dist/core/rosterRequest.d.ts +0 -1
  45. package/dist/core/rosterRequest.js +0 -1
  46. package/dist/core/rtviEnvelope.d.ts +5 -0
  47. package/dist/core/rtviEnvelope.js +9 -0
  48. package/dist/core/types.d.ts +241 -17
  49. package/dist/core/types.js +0 -1
  50. package/dist/core/videoSourceState.d.ts +0 -1
  51. package/dist/core/videoSourceState.js +0 -1
  52. package/dist/core/visionRequest.d.ts +0 -1
  53. package/dist/core/visionRequest.js +0 -1
  54. package/dist/embed/index.d.ts +20 -3
  55. package/dist/embed/index.js +20 -3
  56. package/dist/embed/publicationApi.d.ts +0 -1
  57. package/dist/embed/publicationApi.js +0 -1
  58. package/dist/index.d.ts +0 -1
  59. package/dist/index.js +0 -1
  60. package/dist/lipsync-helpers/arkitOrder61.d.ts +0 -1
  61. package/dist/lipsync-helpers/arkitOrder61.js +5 -3
  62. package/dist/lipsync-helpers/createBlendshapeQueue.d.ts +0 -1
  63. package/dist/lipsync-helpers/createBlendshapeQueue.js +7 -1
  64. package/dist/lipsync-helpers/declarativeMapping.d.ts +2 -1
  65. package/dist/lipsync-helpers/declarativeMapping.js +72 -146
  66. package/dist/lipsync-helpers/index.d.ts +0 -1
  67. package/dist/lipsync-helpers/index.js +0 -1
  68. package/dist/lipsync-helpers/mappingTypes.d.ts +6 -5
  69. package/dist/lipsync-helpers/mappingTypes.js +0 -1
  70. package/dist/lipsync-helpers/metahumanOrder251.d.ts +0 -1
  71. package/dist/lipsync-helpers/metahumanOrder251.js +8 -9
  72. package/dist/lipsync-helpers/mhaLimitDrivers.d.ts +0 -1
  73. package/dist/lipsync-helpers/mhaLimitDrivers.js +0 -1
  74. package/dist/lipsync-helpers/naturalness/processor.d.ts +0 -1
  75. package/dist/lipsync-helpers/naturalness/processor.js +6 -4
  76. package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts +0 -1
  77. package/dist/lipsync-helpers/naturalness/profiles/mha.js +0 -1
  78. package/dist/lipsync-helpers/naturalness/types.d.ts +0 -1
  79. package/dist/lipsync-helpers/naturalness/types.js +0 -1
  80. package/dist/lipsync-helpers/presetMappers.d.ts +0 -1
  81. package/dist/lipsync-helpers/presetMappers.js +0 -1
  82. package/dist/react/components/ConvaiWidget.d.ts +9 -1
  83. package/dist/react/components/ConvaiWidget.js +23 -28
  84. package/dist/react/components/index.d.ts +0 -1
  85. package/dist/react/components/index.js +0 -1
  86. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +0 -1
  87. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js +0 -1
  88. package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts +0 -1
  89. package/dist/react/components/rtc-widget/components/AudioVisualizer.js +0 -1
  90. package/dist/react/components/rtc-widget/components/ConviMessage.d.ts +4 -2
  91. package/dist/react/components/rtc-widget/components/ConviMessage.js +2 -3
  92. package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts +0 -1
  93. package/dist/react/components/rtc-widget/components/FloatingVideo.js +1 -3
  94. package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +7 -1
  95. package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +9 -6
  96. package/dist/react/components/rtc-widget/components/MessageBubble.d.ts +0 -1
  97. package/dist/react/components/rtc-widget/components/MessageBubble.js +0 -1
  98. package/dist/react/components/rtc-widget/components/MessageList.d.ts +4 -2
  99. package/dist/react/components/rtc-widget/components/MessageList.js +2 -3
  100. package/dist/react/components/rtc-widget/components/SiteCard.d.ts +14 -0
  101. package/dist/react/components/rtc-widget/components/SiteCard.js +34 -0
  102. package/dist/react/components/rtc-widget/components/UserMessage.d.ts +0 -1
  103. package/dist/react/components/rtc-widget/components/UserMessage.js +1 -2
  104. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +0 -1
  105. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js +0 -1
  106. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +0 -1
  107. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js +1 -3
  108. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +0 -1
  109. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js +1 -3
  110. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +0 -1
  111. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +1 -4
  112. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +0 -1
  113. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +0 -1
  114. package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts +0 -1
  115. package/dist/react/components/rtc-widget/components/conviComponents/index.js +0 -1
  116. package/dist/react/components/rtc-widget/components/index.d.ts +0 -1
  117. package/dist/react/components/rtc-widget/components/index.js +0 -1
  118. package/dist/react/components/rtc-widget/index.d.ts +0 -1
  119. package/dist/react/components/rtc-widget/index.js +0 -1
  120. package/dist/react/components/rtc-widget/styles/framerConfig.d.ts +0 -1
  121. package/dist/react/components/rtc-widget/styles/framerConfig.js +0 -1
  122. package/dist/react/components/rtc-widget/styles/icons.d.ts +0 -1
  123. package/dist/react/components/rtc-widget/styles/icons.js +0 -1
  124. package/dist/react/components/rtc-widget/styles/index.d.ts +0 -1
  125. package/dist/react/components/rtc-widget/styles/index.js +0 -1
  126. package/dist/react/components/rtc-widget/styles/styledComponents.d.ts +0 -1
  127. package/dist/react/components/rtc-widget/styles/styledComponents.js +0 -1
  128. package/dist/react/components/rtc-widget/styles/theme.d.ts +0 -1
  129. package/dist/react/components/rtc-widget/styles/theme.js +0 -1
  130. package/dist/react/components/rtc-widget/types/index.d.ts +0 -1
  131. package/dist/react/components/rtc-widget/types/index.js +0 -1
  132. package/dist/react/hooks/index.d.ts +0 -1
  133. package/dist/react/hooks/index.js +0 -1
  134. package/dist/react/hooks/useCharacterInfo.d.ts +12 -11
  135. package/dist/react/hooks/useCharacterInfo.js +49 -50
  136. package/dist/react/hooks/useConvaiClient.d.ts +0 -1
  137. package/dist/react/hooks/useConvaiClient.js +8 -5
  138. package/dist/react/hooks/useLocalCameraTrack.d.ts +0 -1
  139. package/dist/react/hooks/useLocalCameraTrack.js +0 -1
  140. package/dist/react/icons.d.ts +37 -0
  141. package/dist/react/icons.js +53 -0
  142. package/dist/react/index.d.ts +2 -1
  143. package/dist/react/index.js +1 -1
  144. package/dist/utils/inlineMarkdown.d.ts +0 -1
  145. package/dist/utils/inlineMarkdown.js +0 -1
  146. package/dist/utils/lightbox.d.ts +0 -1
  147. package/dist/utils/lightbox.js +0 -1
  148. package/dist/utils/linkPresentation.d.ts +7 -1
  149. package/dist/utils/linkPresentation.js +57 -1
  150. package/dist/utils/linkPreview.d.ts +45 -0
  151. package/dist/utils/linkPreview.js +71 -0
  152. package/dist/utils/logger.d.ts +0 -1
  153. package/dist/utils/logger.js +0 -1
  154. package/dist/vanilla/AudioRenderer.d.ts +0 -1
  155. package/dist/vanilla/AudioRenderer.js +0 -1
  156. package/dist/vanilla/ConvaiWidget.d.ts +0 -1
  157. package/dist/vanilla/ConvaiWidget.js +89 -40
  158. package/dist/vanilla/WebSocketSession.d.ts +0 -1
  159. package/dist/vanilla/WebSocketSession.js +0 -1
  160. package/dist/vanilla/WidgetEventSubscriptions.d.ts +0 -1
  161. package/dist/vanilla/WidgetEventSubscriptions.js +0 -1
  162. package/dist/vanilla/icons.d.ts +0 -1
  163. package/dist/vanilla/icons.js +0 -1
  164. package/dist/vanilla/index.d.ts +2 -1
  165. package/dist/vanilla/index.js +1 -1
  166. package/dist/vanilla/styles.d.ts +0 -1
  167. package/dist/vanilla/styles.js +0 -1
  168. package/dist/vanilla/types.d.ts +9 -1
  169. package/dist/vanilla/types.js +0 -1
  170. package/dist/vanilla/websocket.d.ts +0 -1
  171. package/dist/vanilla/websocket.js +0 -1
  172. package/dist/version.d.ts +1 -2
  173. package/dist/version.js +1 -2
  174. package/package.json +22 -27
  175. package/dist/core/AudioManager.d.ts.map +0 -1
  176. package/dist/core/AudioManager.js.map +0 -1
  177. package/dist/core/BlendshapeQueue.d.ts.map +0 -1
  178. package/dist/core/BlendshapeQueue.js.map +0 -1
  179. package/dist/core/CharacterRoster.d.ts.map +0 -1
  180. package/dist/core/CharacterRoster.js.map +0 -1
  181. package/dist/core/CharacterVersionManager.d.ts.map +0 -1
  182. package/dist/core/CharacterVersionManager.js.map +0 -1
  183. package/dist/core/ConnectionStateHandler.d.ts.map +0 -1
  184. package/dist/core/ConnectionStateHandler.js.map +0 -1
  185. package/dist/core/ConvaiClient.d.ts.map +0 -1
  186. package/dist/core/ConvaiClient.js.map +0 -1
  187. package/dist/core/ConvaiRoomError.d.ts.map +0 -1
  188. package/dist/core/ConvaiRoomError.js.map +0 -1
  189. package/dist/core/EventEmitter.d.ts.map +0 -1
  190. package/dist/core/EventEmitter.js.map +0 -1
  191. package/dist/core/MemoryManager.d.ts.map +0 -1
  192. package/dist/core/MemoryManager.js.map +0 -1
  193. package/dist/core/MessageHandler.d.ts.map +0 -1
  194. package/dist/core/MessageHandler.js.map +0 -1
  195. package/dist/core/SSESession.d.ts.map +0 -1
  196. package/dist/core/SSESession.js.map +0 -1
  197. package/dist/core/ScreenShareManager.d.ts.map +0 -1
  198. package/dist/core/ScreenShareManager.js.map +0 -1
  199. package/dist/core/VideoManager.d.ts.map +0 -1
  200. package/dist/core/VideoManager.js.map +0 -1
  201. package/dist/core/characterReference.d.ts.map +0 -1
  202. package/dist/core/characterReference.js.map +0 -1
  203. package/dist/core/connectRequest.d.ts.map +0 -1
  204. package/dist/core/connectRequest.js.map +0 -1
  205. package/dist/core/contextUpdateRequest.d.ts.map +0 -1
  206. package/dist/core/contextUpdateRequest.js.map +0 -1
  207. package/dist/core/index.d.ts.map +0 -1
  208. package/dist/core/index.js.map +0 -1
  209. package/dist/core/logicalTurn.d.ts.map +0 -1
  210. package/dist/core/logicalTurn.js.map +0 -1
  211. package/dist/core/modelOutput.d.ts.map +0 -1
  212. package/dist/core/modelOutput.js.map +0 -1
  213. package/dist/core/publishedChat.d.ts.map +0 -1
  214. package/dist/core/publishedChat.js.map +0 -1
  215. package/dist/core/rosterRequest.d.ts.map +0 -1
  216. package/dist/core/rosterRequest.js.map +0 -1
  217. package/dist/core/types.d.ts.map +0 -1
  218. package/dist/core/types.js.map +0 -1
  219. package/dist/core/videoSourceState.d.ts.map +0 -1
  220. package/dist/core/videoSourceState.js.map +0 -1
  221. package/dist/core/visionRequest.d.ts.map +0 -1
  222. package/dist/core/visionRequest.js.map +0 -1
  223. package/dist/embed/ConvaiChatElement.d.ts +0 -103
  224. package/dist/embed/ConvaiChatElement.d.ts.map +0 -1
  225. package/dist/embed/ConvaiChatElement.js +0 -679
  226. package/dist/embed/ConvaiChatElement.js.map +0 -1
  227. package/dist/embed/browser.d.ts +0 -3
  228. package/dist/embed/browser.d.ts.map +0 -1
  229. package/dist/embed/browser.js +0 -5
  230. package/dist/embed/browser.js.map +0 -1
  231. package/dist/embed/chat-embed-v1.js +0 -200
  232. package/dist/embed/chat-embed-v1.js.map +0 -7
  233. package/dist/embed/index.d.ts.map +0 -1
  234. package/dist/embed/index.js.map +0 -1
  235. package/dist/embed/publicationApi.d.ts.map +0 -1
  236. package/dist/embed/publicationApi.js.map +0 -1
  237. package/dist/index.d.ts.map +0 -1
  238. package/dist/index.js.map +0 -1
  239. package/dist/lipsync-helpers/arkitOrder61.d.ts.map +0 -1
  240. package/dist/lipsync-helpers/arkitOrder61.js.map +0 -1
  241. package/dist/lipsync-helpers/createBlendshapeQueue.d.ts.map +0 -1
  242. package/dist/lipsync-helpers/createBlendshapeQueue.js.map +0 -1
  243. package/dist/lipsync-helpers/declarativeMapping.d.ts.map +0 -1
  244. package/dist/lipsync-helpers/declarativeMapping.js.map +0 -1
  245. package/dist/lipsync-helpers/index.d.ts.map +0 -1
  246. package/dist/lipsync-helpers/index.js.map +0 -1
  247. package/dist/lipsync-helpers/mappingTypes.d.ts.map +0 -1
  248. package/dist/lipsync-helpers/mappingTypes.js.map +0 -1
  249. package/dist/lipsync-helpers/metahumanOrder251.d.ts.map +0 -1
  250. package/dist/lipsync-helpers/metahumanOrder251.js.map +0 -1
  251. package/dist/lipsync-helpers/mhaLimitDrivers.d.ts.map +0 -1
  252. package/dist/lipsync-helpers/mhaLimitDrivers.js.map +0 -1
  253. package/dist/lipsync-helpers/naturalness/processor.d.ts.map +0 -1
  254. package/dist/lipsync-helpers/naturalness/processor.js.map +0 -1
  255. package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts.map +0 -1
  256. package/dist/lipsync-helpers/naturalness/profiles/mha.js.map +0 -1
  257. package/dist/lipsync-helpers/naturalness/types.d.ts.map +0 -1
  258. package/dist/lipsync-helpers/naturalness/types.js.map +0 -1
  259. package/dist/lipsync-helpers/presetMappers.d.ts.map +0 -1
  260. package/dist/lipsync-helpers/presetMappers.js.map +0 -1
  261. package/dist/react/components/ConvaiWidget.d.ts.map +0 -1
  262. package/dist/react/components/ConvaiWidget.js.map +0 -1
  263. package/dist/react/components/index.d.ts.map +0 -1
  264. package/dist/react/components/index.js.map +0 -1
  265. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +0 -1
  266. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js.map +0 -1
  267. package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +0 -1
  268. package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +0 -1
  269. package/dist/react/components/rtc-widget/components/ConviMessage.d.ts.map +0 -1
  270. package/dist/react/components/rtc-widget/components/ConviMessage.js.map +0 -1
  271. package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts.map +0 -1
  272. package/dist/react/components/rtc-widget/components/FloatingVideo.js.map +0 -1
  273. package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +0 -1
  274. package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +0 -1
  275. package/dist/react/components/rtc-widget/components/MessageBubble.d.ts.map +0 -1
  276. package/dist/react/components/rtc-widget/components/MessageBubble.js.map +0 -1
  277. package/dist/react/components/rtc-widget/components/MessageList.d.ts.map +0 -1
  278. package/dist/react/components/rtc-widget/components/MessageList.js.map +0 -1
  279. package/dist/react/components/rtc-widget/components/UserMessage.d.ts.map +0 -1
  280. package/dist/react/components/rtc-widget/components/UserMessage.js.map +0 -1
  281. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +0 -1
  282. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js.map +0 -1
  283. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +0 -1
  284. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js.map +0 -1
  285. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +0 -1
  286. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js.map +0 -1
  287. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +0 -1
  288. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js.map +0 -1
  289. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +0 -1
  290. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +0 -1
  291. package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts.map +0 -1
  292. package/dist/react/components/rtc-widget/components/conviComponents/index.js.map +0 -1
  293. package/dist/react/components/rtc-widget/components/index.d.ts.map +0 -1
  294. package/dist/react/components/rtc-widget/components/index.js.map +0 -1
  295. package/dist/react/components/rtc-widget/index.d.ts.map +0 -1
  296. package/dist/react/components/rtc-widget/index.js.map +0 -1
  297. package/dist/react/components/rtc-widget/styles/framerConfig.d.ts.map +0 -1
  298. package/dist/react/components/rtc-widget/styles/framerConfig.js.map +0 -1
  299. package/dist/react/components/rtc-widget/styles/icons.d.ts.map +0 -1
  300. package/dist/react/components/rtc-widget/styles/icons.js.map +0 -1
  301. package/dist/react/components/rtc-widget/styles/index.d.ts.map +0 -1
  302. package/dist/react/components/rtc-widget/styles/index.js.map +0 -1
  303. package/dist/react/components/rtc-widget/styles/styledComponents.d.ts.map +0 -1
  304. package/dist/react/components/rtc-widget/styles/styledComponents.js.map +0 -1
  305. package/dist/react/components/rtc-widget/styles/theme.d.ts.map +0 -1
  306. package/dist/react/components/rtc-widget/styles/theme.js.map +0 -1
  307. package/dist/react/components/rtc-widget/types/index.d.ts.map +0 -1
  308. package/dist/react/components/rtc-widget/types/index.js.map +0 -1
  309. package/dist/react/hooks/index.d.ts.map +0 -1
  310. package/dist/react/hooks/index.js.map +0 -1
  311. package/dist/react/hooks/useCharacterInfo.d.ts.map +0 -1
  312. package/dist/react/hooks/useCharacterInfo.js.map +0 -1
  313. package/dist/react/hooks/useConvaiClient.d.ts.map +0 -1
  314. package/dist/react/hooks/useConvaiClient.js.map +0 -1
  315. package/dist/react/hooks/useLocalCameraTrack.d.ts.map +0 -1
  316. package/dist/react/hooks/useLocalCameraTrack.js.map +0 -1
  317. package/dist/react/index.d.ts.map +0 -1
  318. package/dist/react/index.js.map +0 -1
  319. package/dist/utils/inlineMarkdown.d.ts.map +0 -1
  320. package/dist/utils/inlineMarkdown.js.map +0 -1
  321. package/dist/utils/lightbox.d.ts.map +0 -1
  322. package/dist/utils/lightbox.js.map +0 -1
  323. package/dist/utils/linkPresentation.d.ts.map +0 -1
  324. package/dist/utils/linkPresentation.js.map +0 -1
  325. package/dist/utils/logger.d.ts.map +0 -1
  326. package/dist/utils/logger.js.map +0 -1
  327. package/dist/vanilla/AudioRenderer.d.ts.map +0 -1
  328. package/dist/vanilla/AudioRenderer.js.map +0 -1
  329. package/dist/vanilla/ConvaiWidget.d.ts.map +0 -1
  330. package/dist/vanilla/ConvaiWidget.js.map +0 -1
  331. package/dist/vanilla/WebSocketSession.d.ts.map +0 -1
  332. package/dist/vanilla/WebSocketSession.js.map +0 -1
  333. package/dist/vanilla/WidgetEventSubscriptions.d.ts.map +0 -1
  334. package/dist/vanilla/WidgetEventSubscriptions.js.map +0 -1
  335. package/dist/vanilla/icons.d.ts.map +0 -1
  336. package/dist/vanilla/icons.js.map +0 -1
  337. package/dist/vanilla/index.d.ts.map +0 -1
  338. package/dist/vanilla/index.js.map +0 -1
  339. package/dist/vanilla/styles.d.ts.map +0 -1
  340. package/dist/vanilla/styles.js.map +0 -1
  341. package/dist/vanilla/types.d.ts.map +0 -1
  342. package/dist/vanilla/types.js.map +0 -1
  343. package/dist/vanilla/websocket.d.ts.map +0 -1
  344. package/dist/vanilla/websocket.js.map +0 -1
  345. package/dist/version.d.ts.map +0 -1
  346. package/dist/version.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { Room, RoomEvent, DefaultReconnectPolicy, setLogLevel, } from "livekit-client";
1
+ import { Room, RoomEvent, ConnectionState, DefaultReconnectPolicy, setLogLevel, } from "livekit-client";
2
2
  setLogLevel("warn");
3
3
  import { DisconnectReasonEnum, } from "./types.js";
4
4
  import { AudioManager } from "./AudioManager.js";
@@ -22,6 +22,10 @@ import { isJsonValue } from "./modelOutput.js";
22
22
  import { isValidLogicalTurnId } from "./logicalTurn.js";
23
23
  // Module-level registry — populated by importing @convai/web-sdk/vanilla/websocket
24
24
  let _wsFactory = null;
25
+ /** The states of mind Core applies (see StateOfMind); used only to name a rejection. */
26
+ const ACCEPTED_STATES_OF_MIND = new Set([
27
+ "joy", "trust", "fear", "surprise", "sadness", "disgust", "anger", "anticipation",
28
+ ]);
25
29
  function normalizeStateOfMind(value) {
26
30
  if (value == null)
27
31
  return value;
@@ -100,6 +104,29 @@ class NoReconnectPolicy extends DefaultReconnectPolicy {
100
104
  * ```
101
105
  */
102
106
  export class ConvaiClient extends EventEmitter {
107
+ /**
108
+ * Match an update-emotion ack to a value this client sent. The ack carries
109
+ * no request id, its state_of_mind is the state still in effect rather than
110
+ * the value it judged, and acks can arrive out of order (measured: "happy"'s
111
+ * rejection before "joy"'s success). So an applied ack settles the value it
112
+ * names, and a rejected one settles the oldest pending value that is not an
113
+ * accepted state of mind. Returns the rejected value, when it can be named.
114
+ */
115
+ _settleStateOfMindAck(response) {
116
+ const pending = this._pendingStateOfMindAcks;
117
+ if (response.extras?.applied === true) {
118
+ // The ack may name a later value already in effect, so fall back to
119
+ // the oldest accepted one — or the list grows for the whole session.
120
+ let i = pending.indexOf(response.extras.state_of_mind ?? null);
121
+ if (i === -1)
122
+ i = pending.findIndex((v) => v === null || ACCEPTED_STATES_OF_MIND.has(v));
123
+ if (i !== -1)
124
+ pending.splice(i, 1);
125
+ return undefined;
126
+ }
127
+ const i = pending.findIndex((v) => v !== null && !ACCEPTED_STATES_OF_MIND.has(v));
128
+ return i === -1 ? undefined : pending.splice(i, 1)[0];
129
+ }
103
130
  /**
104
131
  * Register the WebSocket transport factory. Called automatically as a side-effect
105
132
  * when you import `@convai/web-sdk/vanilla/websocket` (or the react equivalent).
@@ -121,11 +148,28 @@ export class ConvaiClient extends EventEmitter {
121
148
  this._characterSessionId = "-1";
122
149
  /** Roster state for multi-character rooms. Empty for single-character sessions. */
123
150
  this._roster = new CharacterRoster();
151
+ /**
152
+ * Desired output-mute state, session-wide. Held rather than applied once, so
153
+ * it reaches tracks that arrive after the call — a member joining a roster
154
+ * room, or a track republished by a reconnect.
155
+ */
156
+ this._characterMuted = false;
157
+ /**
158
+ * Per-membership overrides of `_characterMuted`. A session-wide call clears
159
+ * this, so "mute everything" never leaves a member behind as an exception.
160
+ */
161
+ this._characterMutedByMembership = new Map();
162
+ /** The WebSocket transport's bot audio track, so mute can reach it too. */
163
+ this._wsBotAudioTrack = null;
124
164
  /** Roster commands awaiting their ack, keyed by command id. */
125
165
  this._pendingRosterCommands = new Map();
126
166
  this._rosterCommandSeq = 0;
127
167
  this._requestTraceId = null;
128
168
  this._isBotReady = false;
169
+ /** turnEnd held back until speaking stays stopped (see speakingChange). */
170
+ this._pendingTurnEnd = null;
171
+ /** Warn once per connect when Core reports vision off for the session. */
172
+ this._warnedVisionNotEnabled = false;
129
173
  this._participantSid = "";
130
174
  this._storedConfig = null;
131
175
  /**
@@ -133,6 +177,8 @@ export class ConvaiClient extends EventEmitter {
133
177
  * so updateEmotion() called before any config is stored is not lost.
134
178
  */
135
179
  this._stateOfMind = null;
180
+ /** States of mind published and not yet acked, oldest first; acks arrive in send order. */
181
+ this._pendingStateOfMindAcks = [];
136
182
  this._endUserId = null;
137
183
  this._endUserMetadata = null;
138
184
  this._wsSession = null;
@@ -313,6 +359,12 @@ export class ConvaiClient extends EventEmitter {
313
359
  toggleUsageUpdates(enabled) {
314
360
  if (!this.isTransportReady())
315
361
  return;
362
+ if (enabled && !this._storedConfig?.debug) {
363
+ // The server registers the usage stream only for debug sessions. Its
364
+ // refusal arrives as a serverResponse error nobody is listening for.
365
+ console.warn("[ConvaiClient] toggleUsageUpdates(true) needs a session connected with `debug: true`; " +
366
+ "without it the server sends no usageUpdate events.");
367
+ }
316
368
  this.publishMessage("usage-toggle", { enabled });
317
369
  }
318
370
  /** Insert a transcript line locally. Nothing is sent; nothing is billed. */
@@ -332,6 +384,81 @@ export class ConvaiClient extends EventEmitter {
332
384
  get audioControls() {
333
385
  return this._audioManager;
334
386
  }
387
+ /**
388
+ * Configured origin for the widget's character name/avatar lookup, or null
389
+ * when unset. See {@link ConvaiConfig.characterInfoUrl}.
390
+ */
391
+ get characterInfoUrl() {
392
+ return this._storedConfig?.characterInfoUrl ?? null;
393
+ }
394
+ /**
395
+ * Silence the character's voice, or bring it back. See
396
+ * {@link IConvaiClient.setCharacterMuted}.
397
+ */
398
+ setCharacterMuted(muted, options) {
399
+ const membershipId = options?.membershipId;
400
+ if (membershipId) {
401
+ this._characterMutedByMembership.set(membershipId, muted);
402
+ }
403
+ else {
404
+ // A session-wide call is authoritative: clearing the overrides is what
405
+ // keeps `setCharacterMuted(false)` from leaving a member still silent
406
+ // because something muted it individually earlier.
407
+ this._characterMuted = muted;
408
+ this._characterMutedByMembership.clear();
409
+ }
410
+ this._applyCharacterMute();
411
+ }
412
+ /**
413
+ * Whether the character's voice is currently silenced. See
414
+ * {@link IConvaiClient.isCharacterMuted}.
415
+ */
416
+ isCharacterMuted(membershipId) {
417
+ if (membershipId === undefined)
418
+ return this._characterMuted;
419
+ return this._characterMutedByMembership.get(membershipId) ?? this._characterMuted;
420
+ }
421
+ /**
422
+ * Push the desired state onto every track that can carry the character's
423
+ * voice right now.
424
+ *
425
+ * `MediaStreamTrack.enabled` is the lever, not LiveKit's
426
+ * `RemoteTrack.setMuted` (marked `@internal`, and it reports the publisher as
427
+ * muted) and not the `<audio>` elements (core holds no DOM, and a headless
428
+ * consumer has no elements to find). A disabled receiving track yields
429
+ * silence while the stream keeps flowing, which is what a speaker mute is:
430
+ * nothing is renegotiated and no turn is interrupted.
431
+ */
432
+ _applyCharacterMute() {
433
+ if (this._wsBotAudioTrack) {
434
+ // The WebSocket transport has one bot track and no roster, so the
435
+ // session-wide setting is the only one that can apply to it.
436
+ this._wsBotAudioTrack.enabled = !this._characterMuted;
437
+ }
438
+ if (this._room.state !== ConnectionState.Connected)
439
+ return;
440
+ this._room.remoteParticipants.forEach((participant) => {
441
+ const identity = participant.identity;
442
+ // Same attribution rule as the TrackSubscribed handler: in a roster room
443
+ // a track belongs to the exact member named by its identity, and an
444
+ // unattributable participant is left alone rather than guessed at.
445
+ let membershipId;
446
+ if (this._roster.isMultiCharacter) {
447
+ if (!identity.startsWith("character:"))
448
+ return;
449
+ const candidate = identity.slice("character:".length);
450
+ if (!this._roster.find(candidate))
451
+ return;
452
+ membershipId = candidate;
453
+ }
454
+ const muted = this.isCharacterMuted(membershipId);
455
+ participant.audioTrackPublications.forEach((publication) => {
456
+ const track = publication.track?.mediaStreamTrack;
457
+ if (track)
458
+ track.enabled = !muted;
459
+ });
460
+ });
461
+ }
335
462
  get videoControls() {
336
463
  return this._videoManager;
337
464
  }
@@ -361,6 +488,10 @@ export class ConvaiClient extends EventEmitter {
361
488
  if (track.kind !== "audio")
362
489
  return;
363
490
  const identity = participant.identity;
491
+ // Re-apply before surfacing the track: a member who joins while the
492
+ // session is muted, or a track republished by a reconnect, must arrive
493
+ // silent rather than audible until the next setCharacterMuted call.
494
+ this._applyCharacterMute();
364
495
  if (!this._roster.isMultiCharacter) {
365
496
  this.emit("characterAudioTrack", {
366
497
  membershipId: null,
@@ -435,15 +566,28 @@ export class ConvaiClient extends EventEmitter {
435
566
  this._messageHandler.on("speakingChange", (isSpeaking) => {
436
567
  this.updateState({ isSpeaking });
437
568
  this.emit("speakingChange", isSpeaking);
438
- if (!isSpeaking && this._conversationSessionId > 0) {
439
- // Bot stopped speaking - turn end signal (same semantics as BlendshapeQueue.hasReceivedEndSignal())
440
- const duration = ((Date.now() - this._conversationStartTime) /
441
- 1000).toFixed(2);
442
- this.emit("turnEnd", {
443
- sessionId: this._conversationSessionId,
444
- duration: parseFloat(duration),
445
- timestamp: Date.now(),
446
- });
569
+ if (isSpeaking) {
570
+ // Speaking resumed: the stop was a gap between segments of one reply.
571
+ if (this._pendingTurnEnd)
572
+ clearTimeout(this._pendingTurnEnd);
573
+ this._pendingTurnEnd = null;
574
+ return;
575
+ }
576
+ if (this._conversationSessionId > 0) {
577
+ // A reply can be spoken in segments: live-sh-aws sent
578
+ // bot-stopped-speaking and bot-started-speaking in the same millisecond
579
+ // between two sentences, and each stop fired turnEnd. Report the end
580
+ // only if speaking does not resume within a beat; the duration and
581
+ // timestamp are still those of the stop.
582
+ const stoppedAt = Date.now();
583
+ const sessionId = this._conversationSessionId;
584
+ const duration = parseFloat(((stoppedAt - this._conversationStartTime) / 1000).toFixed(2));
585
+ if (this._pendingTurnEnd)
586
+ clearTimeout(this._pendingTurnEnd);
587
+ this._pendingTurnEnd = setTimeout(() => {
588
+ this._pendingTurnEnd = null;
589
+ this.emit("turnEnd", { sessionId, duration, timestamp: stoppedAt });
590
+ }, ConvaiClient.TURN_END_SETTLE_MS);
447
591
  }
448
592
  });
449
593
  this._messageHandler.on("botRespondingChange", (isResponding) => {
@@ -505,11 +649,17 @@ export class ConvaiClient extends EventEmitter {
505
649
  this.emit("idleWarning", data);
506
650
  });
507
651
  // Forward LLM no-response event
508
- this._messageHandler.on("llmNoResponse", () => {
509
- this.emit("llmNoResponse");
652
+ this._messageHandler.on("llmNoResponse", (request) => {
653
+ if (request)
654
+ this.emit("llmNoResponse", request);
655
+ else
656
+ this.emit("llmNoResponse");
657
+ });
658
+ this._messageHandler.on("rawMessage", (event) => {
659
+ this.emit("rawMessage", event);
510
660
  });
511
- this._messageHandler.on("botTurnCompleted", (data) => {
512
- this.emit("botTurnCompleted", data);
661
+ this._messageHandler.on("botTurnCompleted", (data, request) => {
662
+ this.emit("botTurnCompleted", data, request);
513
663
  });
514
664
  // Forward bot-output event (aggregated output with spoken status)
515
665
  this._messageHandler.on("botOutput", (data) => {
@@ -526,6 +676,9 @@ export class ConvaiClient extends EventEmitter {
526
676
  this._messageHandler.on("botTtsStopped", () => {
527
677
  this.emit("botTtsStopped");
528
678
  });
679
+ this._messageHandler.on("audioData", (data, request) => {
680
+ this.emit("audioData", data, request);
681
+ });
529
682
  // Forward server-side muting events
530
683
  this._messageHandler.on("userMuteStarted", () => {
531
684
  this.emit("userMuteStarted");
@@ -557,9 +710,30 @@ export class ConvaiClient extends EventEmitter {
557
710
  this._messageHandler.on("modelOutputProtocolError", (data) => {
558
711
  this.emit("modelOutputProtocolError", data);
559
712
  });
560
- this._messageHandler.on("serverResponse", (response) => {
713
+ this._messageHandler.on("serverResponse", (response, request) => {
561
714
  this._handleRosterServerResponse(response);
562
- this.emit("serverResponse", response);
715
+ // The server acks an unknown state of mind as a *success* with
716
+ // applied: false, so without this nothing tells the caller it did nothing.
717
+ const sent = response.event_type === "update-emotion" ? this._settleStateOfMindAck(response) : undefined;
718
+ if (response.event_type === "update-emotion" && response.extras?.applied === false) {
719
+ console.warn(`[ConvaiClient] the server ignored ${sent !== undefined ? `state of mind ${JSON.stringify(sent)}` : "a state of mind"}. ` +
720
+ "Use one of: joy, trust, fear, surprise, sadness, disgust, anger, anticipation.");
721
+ }
722
+ // Vision needs an account feature and a vision-capable model as well as
723
+ // enableVideo; without them Core acks vision calls as successes that
724
+ // attach nothing. Say so once per session.
725
+ if (!this._warnedVisionNotEnabled &&
726
+ (response.extras?.downgrade_reason === "vision_not_enabled" ||
727
+ response.extras?.vision_buffer?.status === "vision_not_enabled")) {
728
+ this._warnedVisionNotEnabled = true;
729
+ console.warn("[ConvaiClient] vision is not enabled for this session, so published frames are not seen. " +
730
+ "It needs enableVideo: true, the unified vision context feature on the account, and a " +
731
+ "vision-capable non-realtime model on the character.");
732
+ }
733
+ if (request)
734
+ this.emit("serverResponse", response, request);
735
+ else
736
+ this.emit("serverResponse", response);
563
737
  });
564
738
  this._messageHandler.on("interactionCreated", (data) => {
565
739
  this.emit("interactionCreated", data);
@@ -662,6 +836,8 @@ export class ConvaiClient extends EventEmitter {
662
836
  * Connect to a Convai character
663
837
  */
664
838
  async connect(config) {
839
+ this._warnedVisionNotEnabled = false;
840
+ this._pendingStateOfMindAcks = [];
665
841
  // Use provided config or stored config
666
842
  const finalConfig = config || this._storedConfig;
667
843
  if (!finalConfig) {
@@ -743,9 +919,11 @@ export class ConvaiClient extends EventEmitter {
743
919
  respondModes: configWithDefaults.respondModes,
744
920
  useResponseLifecycleContract: configWithDefaults.useResponseLifecycleContract,
745
921
  invocationMetadata: configWithDefaults.invocationMetadata,
922
+ ttsEnabled: configWithDefaults.ttsEnabled,
746
923
  debug: configWithDefaults.debug,
747
- onMessage: (payload) => this._messageHandler.handleDataReceivedPublic(payload, "sse"),
748
- onError: (error) => this.emit("error", error),
924
+ onRawMessage: (event) => this.emit("rawMessage", event),
925
+ onMessage: (payload, request) => this._messageHandler.handleDataReceivedPublic(payload, "sse", request),
926
+ onError: (error, request) => this.emit("error", error, request),
749
927
  // EOF/rejection is a local transport boundary, not a synthetic Core
750
928
  // completion. Close every row before the next stateless request.
751
929
  onResponseFinished: () => this._messageHandler.finalizeInterruptedResponse(true),
@@ -1413,6 +1591,8 @@ export class ConvaiClient extends EventEmitter {
1413
1591
  }
1414
1592
  const wsSession = this._wsSession;
1415
1593
  wsSession.on("botAudioTrack", (track) => {
1594
+ this._wsBotAudioTrack = track;
1595
+ this._applyCharacterMute();
1416
1596
  this.emit("botAudioTrack", track);
1417
1597
  });
1418
1598
  wsSession.on("disconnected", () => {
@@ -1848,6 +2028,9 @@ export class ConvaiClient extends EventEmitter {
1848
2028
  this._connectionType = null;
1849
2029
  this._activeTransport = null;
1850
2030
  this._wsSession = null;
2031
+ // The track dies with the session; the mute *setting* deliberately does
2032
+ // not, so reconnecting does not hand the user back an unmuted character.
2033
+ this._wsBotAudioTrack = null;
1851
2034
  this._failPendingRosterCommands("Disconnected before the roster command was acknowledged; its outcome is unknown");
1852
2035
  this._roster.reset();
1853
2036
  this._sseSession = null;
@@ -1886,6 +2069,13 @@ export class ConvaiClient extends EventEmitter {
1886
2069
  throw new Error("resetSession() is not supported in a multi-character room; character sessions are server-owned");
1887
2070
  }
1888
2071
  this._characterSessionId = "-1";
2072
+ // connect() prefers config.characterSessionId over the live id, so a
2073
+ // resumed session in the stored config would make reconnect() resume it
2074
+ // again and quietly undo this reset.
2075
+ if (this._storedConfig?.characterSessionId !== undefined) {
2076
+ const { characterSessionId: _dropped, ...rest } = this._storedConfig;
2077
+ this._storedConfig = rest;
2078
+ }
1889
2079
  this.emit("characterSessionId", "-1");
1890
2080
  this._messageHandler.reset();
1891
2081
  // Clear metrics and disconnect reason when resetting session
@@ -1952,6 +2142,7 @@ export class ConvaiClient extends EventEmitter {
1952
2142
  }
1953
2143
  else {
1954
2144
  if (stateOfMind) {
2145
+ this._pendingStateOfMindAcks.push(stateOfMind);
1955
2146
  this.publishMessage("update-emotion", {
1956
2147
  state_of_mind: stateOfMind,
1957
2148
  participant_sid: this._participantSid || this._room.localParticipant?.sid,
@@ -2213,7 +2404,14 @@ export class ConvaiClient extends EventEmitter {
2213
2404
  * not a merge. Requires Narrative Design enabled on the character.
2214
2405
  */
2215
2406
  updateTemplateKeys(templateKeys) {
2216
- if (!this.isTransportReady() || Object.keys(templateKeys).length === 0)
2407
+ if (Object.keys(templateKeys).length === 0)
2408
+ return;
2409
+ // reconnect() replays _storedConfig; without this it re-sends the keys
2410
+ // from the original config over the ones set here.
2411
+ if (this._storedConfig) {
2412
+ this._storedConfig = { ...this._storedConfig, narrativeTemplateKeys: { ...templateKeys } };
2413
+ }
2414
+ if (!this.isTransportReady())
2217
2415
  return;
2218
2416
  this.publishMessage("update-template-keys", {
2219
2417
  template_keys: templateKeys,
@@ -2339,6 +2537,7 @@ export class ConvaiClient extends EventEmitter {
2339
2537
  respondModeUpdate(options) {
2340
2538
  if (!this.isTransportReady())
2341
2539
  return null;
2540
+ this.rememberRespondMode(options.modality, options.mode);
2342
2541
  const updateId = options.updateId ?? this.createUpdateId("respond-mode");
2343
2542
  this.publishMessage("respond-mode-update", {
2344
2543
  update_id: updateId,
@@ -2362,6 +2561,7 @@ export class ConvaiClient extends EventEmitter {
2362
2561
  return;
2363
2562
  if (this._activeTransport === "sse")
2364
2563
  return;
2564
+ this._pendingStateOfMindAcks.push(normalized);
2365
2565
  this.publishMessage("update-emotion", {
2366
2566
  state_of_mind: normalized,
2367
2567
  participant_sid: this._participantSid || this._room.localParticipant?.sid,
@@ -2382,6 +2582,30 @@ export class ConvaiClient extends EventEmitter {
2382
2582
  ...(options.respondMode && { respond_mode: options.respondMode }),
2383
2583
  });
2384
2584
  }
2585
+ /**
2586
+ * Mirror a runtime respond-mode change into the stored config, so
2587
+ * reconnect() — which replays _storedConfig — does not revert it. text and
2588
+ * audio are typed `"must_respond"` only in the config, so other values for
2589
+ * them stay runtime-only rather than widening that type.
2590
+ */
2591
+ rememberRespondMode(modality, mode) {
2592
+ if (!this._storedConfig)
2593
+ return;
2594
+ const key = {
2595
+ text: "text",
2596
+ audio: "audio",
2597
+ vision: "vision",
2598
+ context_update: "contextUpdate",
2599
+ trigger: "trigger",
2600
+ scene_metadata: "sceneMetadata",
2601
+ }[modality];
2602
+ if ((key === "text" || key === "audio") && mode !== "must_respond")
2603
+ return;
2604
+ this._storedConfig = {
2605
+ ...this._storedConfig,
2606
+ respondModes: { ...this._storedConfig.respondModes, [key]: mode },
2607
+ };
2608
+ }
2385
2609
  createUpdateId(prefix) {
2386
2610
  if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
2387
2611
  return `${prefix}:${crypto.randomUUID()}`;
@@ -2427,6 +2651,14 @@ export class ConvaiClient extends EventEmitter {
2427
2651
  toggleTts(enabled) {
2428
2652
  if (!this.isTransportReady())
2429
2653
  return;
2654
+ // Every transport, not only SSE: reconnect() replays _storedConfig.
2655
+ if (this._storedConfig) {
2656
+ this._storedConfig = { ...this._storedConfig, ttsEnabled: enabled };
2657
+ }
2658
+ if (this._activeTransport === "sse" && this._sseSession) {
2659
+ this._sseSession.setTtsEnabled(enabled);
2660
+ return;
2661
+ }
2430
2662
  this.publishMessage("tts-toggle", { enabled });
2431
2663
  }
2432
2664
  /**
@@ -2454,6 +2686,8 @@ export class ConvaiClient extends EventEmitter {
2454
2686
  });
2455
2687
  }
2456
2688
  }
2689
+ /** How long speaking must stay stopped before a turn is reported ended. */
2690
+ ConvaiClient.TURN_END_SETTLE_MS = 150;
2457
2691
  ConvaiClient.CLIENT_READY_RETRY_MS = 500;
2458
2692
  ConvaiClient.CLIENT_READY_TIMEOUT_MS = 45000;
2459
2693
  ConvaiClient.ACTION_RESULT_ACK_TIMEOUT_MS = 10000;
@@ -2470,4 +2704,3 @@ ConvaiClient.ROSTER_COMMAND_TIMEOUT_MS = 10000;
2470
2704
  /** Default bounded retry while a roster room is still provisioning. */
2471
2705
  ConvaiClient.ROSTER_RETRY_ATTEMPTS = 4;
2472
2706
  ConvaiClient.ROSTER_RETRY_INITIAL_MS = 500;
2473
- //# sourceMappingURL=ConvaiClient.js.map
@@ -45,4 +45,3 @@ export declare function extractRequestTraceId(body: unknown): string | null;
45
45
  export declare function extractRoomErrorMessage(body: unknown, status: number): string;
46
46
  /** Build a `ConvaiRoomError` from a response status and its parsed body. */
47
47
  export declare function roomErrorFromResponse(status: number, body: unknown): ConvaiRoomError;
48
- //# sourceMappingURL=ConvaiRoomError.d.ts.map
@@ -104,8 +104,26 @@ export function extractRoomErrorMessage(body, status) {
104
104
  }
105
105
  return `Room request failed with HTTP ${status}`;
106
106
  }
107
+ /** `character_ids` from a body or its `detail`, when the server names them. */
108
+ function extractCharacterIds(body) {
109
+ if (typeof body !== "object" || body === null)
110
+ return [];
111
+ const record = body;
112
+ const ids = record.character_ids;
113
+ if (Array.isArray(ids))
114
+ return ids.filter((id) => typeof id === "string");
115
+ return extractCharacterIds(record.detail);
116
+ }
107
117
  /** Build a `ConvaiRoomError` from a response status and its parsed body. */
108
118
  export function roomErrorFromResponse(status, body) {
109
- return new ConvaiRoomError(extractRoomErrorMessage(body, status), status, extractRoomErrorCode(body), extractRequestTraceId(body), body);
119
+ const code = extractRoomErrorCode(body);
120
+ let message = extractRoomErrorMessage(body, status);
121
+ // A body with only a code ({"detail":{"code":"CHARACTER_NOT_FOUND_OR_INACCESSIBLE",
122
+ // "character_ids":[...]}}) has no prose, and the generic fallback dropped both
123
+ // the reason and which character from the message people actually log.
124
+ if (code && message === `Room request failed with HTTP ${status}`) {
125
+ const ids = extractCharacterIds(body);
126
+ message = `${code} (HTTP ${status})${ids.length ? `: ${ids.join(", ")}` : ""}`;
127
+ }
128
+ return new ConvaiRoomError(message, status, code, extractRequestTraceId(body), body);
110
129
  }
111
- //# sourceMappingURL=ConvaiRoomError.js.map
@@ -35,4 +35,3 @@ export declare class EventEmitter {
35
35
  */
36
36
  listenerCount(event: string): number;
37
37
  }
38
- //# sourceMappingURL=EventEmitter.d.ts.map
@@ -65,4 +65,3 @@ export class EventEmitter {
65
65
  return this.events.get(event)?.size ?? 0;
66
66
  }
67
67
  }
68
- //# sourceMappingURL=EventEmitter.js.map
@@ -176,4 +176,3 @@ export declare class MemoryManager {
176
176
  */
177
177
  getCharacterId(): string;
178
178
  }
179
- //# sourceMappingURL=MemoryManager.d.ts.map
@@ -278,4 +278,3 @@ export class MemoryManager {
278
278
  return this.characterId;
279
279
  }
280
280
  }
281
- //# sourceMappingURL=MemoryManager.js.map
@@ -1,5 +1,5 @@
1
1
  import { Room } from "livekit-client";
2
- import { ChatMessage } from "./types.js";
2
+ import { ChatMessage, SSERequestContext } from "./types.js";
3
3
  import { EventEmitter } from "./EventEmitter.js";
4
4
  import { BlendshapeQueue } from "./BlendshapeQueue.js";
5
5
  /**
@@ -90,6 +90,9 @@ export declare class MessageHandler extends EventEmitter {
90
90
  * Handle incoming data message
91
91
  */
92
92
  private handleDataReceived;
93
+ private _handleTurnCompleted;
94
+ private _handleNoResponse;
95
+ private _handleServerResponse;
93
96
  private _handleActionResponse;
94
97
  private _handleModelOutput;
95
98
  private _clearModelOutputReplayLedger;
@@ -100,7 +103,7 @@ export declare class MessageHandler extends EventEmitter {
100
103
  /**
101
104
  * Public entry point for WebSocket transport to inject messages into the same pipeline.
102
105
  */
103
- handleDataReceivedPublic(payload: Uint8Array, transport?: "websocket" | "sse"): void;
106
+ handleDataReceivedPublic(payload: Uint8Array, transport?: "websocket" | "sse", sseRequest?: SSERequestContext): void;
104
107
  /** Append a submitted text message without waiting for a server echo. */
105
108
  addUserTextMessage(text: string): void;
106
109
  /**
@@ -122,4 +125,3 @@ export declare class MessageHandler extends EventEmitter {
122
125
  */
123
126
  reset(): void;
124
127
  }
125
- //# sourceMappingURL=MessageHandler.d.ts.map