@convai/web-sdk 1.9.0-beta.7 → 1.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (344) hide show
  1. package/README.md +66 -33
  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 +31 -3
  13. package/dist/core/ConvaiClient.js +136 -14
  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 +0 -1
  21. package/dist/core/MessageHandler.js +41 -10
  22. package/dist/core/SSESession.d.ts +0 -1
  23. package/dist/core/SSESession.js +0 -1
  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 +4 -3
  37. package/dist/core/index.js +20 -3
  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 +0 -1
  47. package/dist/core/rtviEnvelope.js +0 -1
  48. package/dist/core/types.d.ts +112 -10
  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 +11 -1
  55. package/dist/embed/index.js +11 -1
  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 +0 -1
  83. package/dist/react/components/ConvaiWidget.js +16 -8
  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 +0 -1
  91. package/dist/react/components/rtc-widget/components/ConviMessage.js +0 -1
  92. package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts +0 -1
  93. package/dist/react/components/rtc-widget/components/FloatingVideo.js +0 -1
  94. package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +0 -1
  95. package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +0 -1
  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 +0 -1
  99. package/dist/react/components/rtc-widget/components/MessageList.js +0 -1
  100. package/dist/react/components/rtc-widget/components/SiteCard.d.ts +0 -1
  101. package/dist/react/components/rtc-widget/components/SiteCard.js +0 -1
  102. package/dist/react/components/rtc-widget/components/UserMessage.d.ts +0 -1
  103. package/dist/react/components/rtc-widget/components/UserMessage.js +0 -1
  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 +0 -1
  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 +0 -1
  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 +0 -1
  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 +6 -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 +0 -1
  141. package/dist/react/icons.js +0 -1
  142. package/dist/react/index.d.ts +0 -1
  143. package/dist/react/index.js +0 -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 +0 -1
  149. package/dist/utils/linkPresentation.js +0 -1
  150. package/dist/utils/linkPreview.d.ts +0 -1
  151. package/dist/utils/linkPreview.js +0 -1
  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 +18 -30
  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 +0 -1
  165. package/dist/vanilla/index.js +0 -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 +0 -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 +3 -3
  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/rtviEnvelope.d.ts.map +0 -1
  218. package/dist/core/rtviEnvelope.js.map +0 -1
  219. package/dist/core/types.d.ts.map +0 -1
  220. package/dist/core/types.js.map +0 -1
  221. package/dist/core/videoSourceState.d.ts.map +0 -1
  222. package/dist/core/videoSourceState.js.map +0 -1
  223. package/dist/core/visionRequest.d.ts.map +0 -1
  224. package/dist/core/visionRequest.js.map +0 -1
  225. package/dist/embed/index.d.ts.map +0 -1
  226. package/dist/embed/index.js.map +0 -1
  227. package/dist/embed/publicationApi.d.ts.map +0 -1
  228. package/dist/embed/publicationApi.js.map +0 -1
  229. package/dist/index.d.ts.map +0 -1
  230. package/dist/index.js.map +0 -1
  231. package/dist/lipsync-helpers/arkitOrder61.d.ts.map +0 -1
  232. package/dist/lipsync-helpers/arkitOrder61.js.map +0 -1
  233. package/dist/lipsync-helpers/createBlendshapeQueue.d.ts.map +0 -1
  234. package/dist/lipsync-helpers/createBlendshapeQueue.js.map +0 -1
  235. package/dist/lipsync-helpers/declarativeMapping.d.ts.map +0 -1
  236. package/dist/lipsync-helpers/declarativeMapping.js.map +0 -1
  237. package/dist/lipsync-helpers/index.d.ts.map +0 -1
  238. package/dist/lipsync-helpers/index.js.map +0 -1
  239. package/dist/lipsync-helpers/mappingTypes.d.ts.map +0 -1
  240. package/dist/lipsync-helpers/mappingTypes.js.map +0 -1
  241. package/dist/lipsync-helpers/metahumanOrder251.d.ts.map +0 -1
  242. package/dist/lipsync-helpers/metahumanOrder251.js.map +0 -1
  243. package/dist/lipsync-helpers/mhaLimitDrivers.d.ts.map +0 -1
  244. package/dist/lipsync-helpers/mhaLimitDrivers.js.map +0 -1
  245. package/dist/lipsync-helpers/naturalness/processor.d.ts.map +0 -1
  246. package/dist/lipsync-helpers/naturalness/processor.js.map +0 -1
  247. package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts.map +0 -1
  248. package/dist/lipsync-helpers/naturalness/profiles/mha.js.map +0 -1
  249. package/dist/lipsync-helpers/naturalness/types.d.ts.map +0 -1
  250. package/dist/lipsync-helpers/naturalness/types.js.map +0 -1
  251. package/dist/lipsync-helpers/presetMappers.d.ts.map +0 -1
  252. package/dist/lipsync-helpers/presetMappers.js.map +0 -1
  253. package/dist/react/components/ConvaiWidget.d.ts.map +0 -1
  254. package/dist/react/components/ConvaiWidget.js.map +0 -1
  255. package/dist/react/components/index.d.ts.map +0 -1
  256. package/dist/react/components/index.js.map +0 -1
  257. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +0 -1
  258. package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js.map +0 -1
  259. package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +0 -1
  260. package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +0 -1
  261. package/dist/react/components/rtc-widget/components/ConviMessage.d.ts.map +0 -1
  262. package/dist/react/components/rtc-widget/components/ConviMessage.js.map +0 -1
  263. package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts.map +0 -1
  264. package/dist/react/components/rtc-widget/components/FloatingVideo.js.map +0 -1
  265. package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +0 -1
  266. package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +0 -1
  267. package/dist/react/components/rtc-widget/components/MessageBubble.d.ts.map +0 -1
  268. package/dist/react/components/rtc-widget/components/MessageBubble.js.map +0 -1
  269. package/dist/react/components/rtc-widget/components/MessageList.d.ts.map +0 -1
  270. package/dist/react/components/rtc-widget/components/MessageList.js.map +0 -1
  271. package/dist/react/components/rtc-widget/components/SiteCard.d.ts.map +0 -1
  272. package/dist/react/components/rtc-widget/components/SiteCard.js.map +0 -1
  273. package/dist/react/components/rtc-widget/components/UserMessage.d.ts.map +0 -1
  274. package/dist/react/components/rtc-widget/components/UserMessage.js.map +0 -1
  275. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +0 -1
  276. package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js.map +0 -1
  277. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +0 -1
  278. package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js.map +0 -1
  279. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +0 -1
  280. package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js.map +0 -1
  281. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +0 -1
  282. package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js.map +0 -1
  283. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +0 -1
  284. package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +0 -1
  285. package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts.map +0 -1
  286. package/dist/react/components/rtc-widget/components/conviComponents/index.js.map +0 -1
  287. package/dist/react/components/rtc-widget/components/index.d.ts.map +0 -1
  288. package/dist/react/components/rtc-widget/components/index.js.map +0 -1
  289. package/dist/react/components/rtc-widget/index.d.ts.map +0 -1
  290. package/dist/react/components/rtc-widget/index.js.map +0 -1
  291. package/dist/react/components/rtc-widget/styles/framerConfig.d.ts.map +0 -1
  292. package/dist/react/components/rtc-widget/styles/framerConfig.js.map +0 -1
  293. package/dist/react/components/rtc-widget/styles/icons.d.ts.map +0 -1
  294. package/dist/react/components/rtc-widget/styles/icons.js.map +0 -1
  295. package/dist/react/components/rtc-widget/styles/index.d.ts.map +0 -1
  296. package/dist/react/components/rtc-widget/styles/index.js.map +0 -1
  297. package/dist/react/components/rtc-widget/styles/styledComponents.d.ts.map +0 -1
  298. package/dist/react/components/rtc-widget/styles/styledComponents.js.map +0 -1
  299. package/dist/react/components/rtc-widget/styles/theme.d.ts.map +0 -1
  300. package/dist/react/components/rtc-widget/styles/theme.js.map +0 -1
  301. package/dist/react/components/rtc-widget/types/index.d.ts.map +0 -1
  302. package/dist/react/components/rtc-widget/types/index.js.map +0 -1
  303. package/dist/react/hooks/index.d.ts.map +0 -1
  304. package/dist/react/hooks/index.js.map +0 -1
  305. package/dist/react/hooks/useCharacterInfo.d.ts.map +0 -1
  306. package/dist/react/hooks/useCharacterInfo.js.map +0 -1
  307. package/dist/react/hooks/useConvaiClient.d.ts.map +0 -1
  308. package/dist/react/hooks/useConvaiClient.js.map +0 -1
  309. package/dist/react/hooks/useLocalCameraTrack.d.ts.map +0 -1
  310. package/dist/react/hooks/useLocalCameraTrack.js.map +0 -1
  311. package/dist/react/icons.d.ts.map +0 -1
  312. package/dist/react/icons.js.map +0 -1
  313. package/dist/react/index.d.ts.map +0 -1
  314. package/dist/react/index.js.map +0 -1
  315. package/dist/utils/inlineMarkdown.d.ts.map +0 -1
  316. package/dist/utils/inlineMarkdown.js.map +0 -1
  317. package/dist/utils/lightbox.d.ts.map +0 -1
  318. package/dist/utils/lightbox.js.map +0 -1
  319. package/dist/utils/linkPresentation.d.ts.map +0 -1
  320. package/dist/utils/linkPresentation.js.map +0 -1
  321. package/dist/utils/linkPreview.d.ts.map +0 -1
  322. package/dist/utils/linkPreview.js.map +0 -1
  323. package/dist/utils/logger.d.ts.map +0 -1
  324. package/dist/utils/logger.js.map +0 -1
  325. package/dist/vanilla/AudioRenderer.d.ts.map +0 -1
  326. package/dist/vanilla/AudioRenderer.js.map +0 -1
  327. package/dist/vanilla/ConvaiWidget.d.ts.map +0 -1
  328. package/dist/vanilla/ConvaiWidget.js.map +0 -1
  329. package/dist/vanilla/WebSocketSession.d.ts.map +0 -1
  330. package/dist/vanilla/WebSocketSession.js.map +0 -1
  331. package/dist/vanilla/WidgetEventSubscriptions.d.ts.map +0 -1
  332. package/dist/vanilla/WidgetEventSubscriptions.js.map +0 -1
  333. package/dist/vanilla/icons.d.ts.map +0 -1
  334. package/dist/vanilla/icons.js.map +0 -1
  335. package/dist/vanilla/index.d.ts.map +0 -1
  336. package/dist/vanilla/index.js.map +0 -1
  337. package/dist/vanilla/styles.d.ts.map +0 -1
  338. package/dist/vanilla/styles.js.map +0 -1
  339. package/dist/vanilla/types.d.ts.map +0 -1
  340. package/dist/vanilla/types.js.map +0 -1
  341. package/dist/vanilla/websocket.d.ts.map +0 -1
  342. package/dist/vanilla/websocket.js.map +0 -1
  343. package/dist/version.d.ts.map +0 -1
  344. package/dist/version.js.map +0 -1
@@ -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).
@@ -139,6 +166,10 @@ export class ConvaiClient extends EventEmitter {
139
166
  this._rosterCommandSeq = 0;
140
167
  this._requestTraceId = null;
141
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;
142
173
  this._participantSid = "";
143
174
  this._storedConfig = null;
144
175
  /**
@@ -146,6 +177,8 @@ export class ConvaiClient extends EventEmitter {
146
177
  * so updateEmotion() called before any config is stored is not lost.
147
178
  */
148
179
  this._stateOfMind = null;
180
+ /** States of mind published and not yet acked, oldest first; acks arrive in send order. */
181
+ this._pendingStateOfMindAcks = [];
149
182
  this._endUserId = null;
150
183
  this._endUserMetadata = null;
151
184
  this._wsSession = null;
@@ -326,6 +359,12 @@ export class ConvaiClient extends EventEmitter {
326
359
  toggleUsageUpdates(enabled) {
327
360
  if (!this.isTransportReady())
328
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
+ }
329
368
  this.publishMessage("usage-toggle", { enabled });
330
369
  }
331
370
  /** Insert a transcript line locally. Nothing is sent; nothing is billed. */
@@ -345,6 +384,13 @@ export class ConvaiClient extends EventEmitter {
345
384
  get audioControls() {
346
385
  return this._audioManager;
347
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
+ }
348
394
  /**
349
395
  * Silence the character's voice, or bring it back. See
350
396
  * {@link IConvaiClient.setCharacterMuted}.
@@ -520,15 +566,28 @@ export class ConvaiClient extends EventEmitter {
520
566
  this._messageHandler.on("speakingChange", (isSpeaking) => {
521
567
  this.updateState({ isSpeaking });
522
568
  this.emit("speakingChange", isSpeaking);
523
- if (!isSpeaking && this._conversationSessionId > 0) {
524
- // Bot stopped speaking - turn end signal (same semantics as BlendshapeQueue.hasReceivedEndSignal())
525
- const duration = ((Date.now() - this._conversationStartTime) /
526
- 1000).toFixed(2);
527
- this.emit("turnEnd", {
528
- sessionId: this._conversationSessionId,
529
- duration: parseFloat(duration),
530
- timestamp: Date.now(),
531
- });
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);
532
591
  }
533
592
  });
534
593
  this._messageHandler.on("botRespondingChange", (isResponding) => {
@@ -653,6 +712,24 @@ export class ConvaiClient extends EventEmitter {
653
712
  });
654
713
  this._messageHandler.on("serverResponse", (response, request) => {
655
714
  this._handleRosterServerResponse(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
+ }
656
733
  if (request)
657
734
  this.emit("serverResponse", response, request);
658
735
  else
@@ -759,6 +836,8 @@ export class ConvaiClient extends EventEmitter {
759
836
  * Connect to a Convai character
760
837
  */
761
838
  async connect(config) {
839
+ this._warnedVisionNotEnabled = false;
840
+ this._pendingStateOfMindAcks = [];
762
841
  // Use provided config or stored config
763
842
  const finalConfig = config || this._storedConfig;
764
843
  if (!finalConfig) {
@@ -1990,6 +2069,13 @@ export class ConvaiClient extends EventEmitter {
1990
2069
  throw new Error("resetSession() is not supported in a multi-character room; character sessions are server-owned");
1991
2070
  }
1992
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
+ }
1993
2079
  this.emit("characterSessionId", "-1");
1994
2080
  this._messageHandler.reset();
1995
2081
  // Clear metrics and disconnect reason when resetting session
@@ -2056,6 +2142,7 @@ export class ConvaiClient extends EventEmitter {
2056
2142
  }
2057
2143
  else {
2058
2144
  if (stateOfMind) {
2145
+ this._pendingStateOfMindAcks.push(stateOfMind);
2059
2146
  this.publishMessage("update-emotion", {
2060
2147
  state_of_mind: stateOfMind,
2061
2148
  participant_sid: this._participantSid || this._room.localParticipant?.sid,
@@ -2317,7 +2404,14 @@ export class ConvaiClient extends EventEmitter {
2317
2404
  * not a merge. Requires Narrative Design enabled on the character.
2318
2405
  */
2319
2406
  updateTemplateKeys(templateKeys) {
2320
- 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())
2321
2415
  return;
2322
2416
  this.publishMessage("update-template-keys", {
2323
2417
  template_keys: templateKeys,
@@ -2443,6 +2537,7 @@ export class ConvaiClient extends EventEmitter {
2443
2537
  respondModeUpdate(options) {
2444
2538
  if (!this.isTransportReady())
2445
2539
  return null;
2540
+ this.rememberRespondMode(options.modality, options.mode);
2446
2541
  const updateId = options.updateId ?? this.createUpdateId("respond-mode");
2447
2542
  this.publishMessage("respond-mode-update", {
2448
2543
  update_id: updateId,
@@ -2466,6 +2561,7 @@ export class ConvaiClient extends EventEmitter {
2466
2561
  return;
2467
2562
  if (this._activeTransport === "sse")
2468
2563
  return;
2564
+ this._pendingStateOfMindAcks.push(normalized);
2469
2565
  this.publishMessage("update-emotion", {
2470
2566
  state_of_mind: normalized,
2471
2567
  participant_sid: this._participantSid || this._room.localParticipant?.sid,
@@ -2486,6 +2582,30 @@ export class ConvaiClient extends EventEmitter {
2486
2582
  ...(options.respondMode && { respond_mode: options.respondMode }),
2487
2583
  });
2488
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
+ }
2489
2609
  createUpdateId(prefix) {
2490
2610
  if (typeof crypto !== "undefined" && "randomUUID" in crypto) {
2491
2611
  return `${prefix}:${crypto.randomUUID()}`;
@@ -2531,11 +2651,12 @@ export class ConvaiClient extends EventEmitter {
2531
2651
  toggleTts(enabled) {
2532
2652
  if (!this.isTransportReady())
2533
2653
  return;
2654
+ // Every transport, not only SSE: reconnect() replays _storedConfig.
2655
+ if (this._storedConfig) {
2656
+ this._storedConfig = { ...this._storedConfig, ttsEnabled: enabled };
2657
+ }
2534
2658
  if (this._activeTransport === "sse" && this._sseSession) {
2535
2659
  this._sseSession.setTtsEnabled(enabled);
2536
- if (this._storedConfig) {
2537
- this._storedConfig = { ...this._storedConfig, ttsEnabled: enabled };
2538
- }
2539
2660
  return;
2540
2661
  }
2541
2662
  this.publishMessage("tts-toggle", { enabled });
@@ -2565,6 +2686,8 @@ export class ConvaiClient extends EventEmitter {
2565
2686
  });
2566
2687
  }
2567
2688
  }
2689
+ /** How long speaking must stay stopped before a turn is reported ended. */
2690
+ ConvaiClient.TURN_END_SETTLE_MS = 150;
2568
2691
  ConvaiClient.CLIENT_READY_RETRY_MS = 500;
2569
2692
  ConvaiClient.CLIENT_READY_TIMEOUT_MS = 45000;
2570
2693
  ConvaiClient.ACTION_RESULT_ACK_TIMEOUT_MS = 10000;
@@ -2581,4 +2704,3 @@ ConvaiClient.ROSTER_COMMAND_TIMEOUT_MS = 10000;
2581
2704
  /** Default bounded retry while a roster room is still provisioning. */
2582
2705
  ConvaiClient.ROSTER_RETRY_ATTEMPTS = 4;
2583
2706
  ConvaiClient.ROSTER_RETRY_INITIAL_MS = 500;
2584
- //# 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
@@ -125,4 +125,3 @@ export declare class MessageHandler extends EventEmitter {
125
125
  */
126
126
  reset(): void;
127
127
  }
128
- //# sourceMappingURL=MessageHandler.d.ts.map
@@ -695,6 +695,13 @@ export class MessageHandler extends EventEmitter {
695
695
  if (messageData.data) {
696
696
  const serverData = messageData.data;
697
697
  switch (serverData.type) {
698
+ // How production delivers usage: wrapped in a server-message,
699
+ // the record's fields beside `type`. Strip the envelope's type.
700
+ case "usage-update": {
701
+ const { type: _envelope, ...usage } = serverData;
702
+ this.emit("usageUpdate", usage);
703
+ break;
704
+ }
698
705
  case "bot-llm-text-raw":
699
706
  this._handleBotLlmTextRaw(serverData.data ?? serverData);
700
707
  break;
@@ -912,9 +919,15 @@ export class MessageHandler extends EventEmitter {
912
919
  this.emit("messagesChange", this.chatMessages);
913
920
  }
914
921
  _handleServerResponse(envelope, request) {
915
- const response = envelope.data !== null && typeof envelope.data === "object"
916
- && !Array.isArray(envelope.data)
917
- ? envelope.data
922
+ // `data` is the response only when it is one — when it carries its own
923
+ // event_type. A roster ack carries event_type and extras *and* a `data`
924
+ // object that is the member it switched to; reading that as the response
925
+ // emitted { event_type: "unknown", status: "error" }, so every
926
+ // setInteractionTarget() timed out though Core had succeeded.
927
+ const nested = envelope.data;
928
+ const response = nested !== null && typeof nested === "object" && !Array.isArray(nested)
929
+ && (typeof nested.event_type === "string" || envelope.event_type === undefined)
930
+ ? nested
918
931
  : envelope;
919
932
  // client-ready is an internal RTVI handshake whose rejection is harmless.
920
933
  if (response.event_type === "client-ready")
@@ -1074,6 +1087,19 @@ export class MessageHandler extends EventEmitter {
1074
1087
  * Reset message state
1075
1088
  */
1076
1089
  reset() {
1090
+ // A disconnect resets three times (the Disconnected state change,
1091
+ // handleDisconnected, resetConnectionState). Emitting unconditionally made
1092
+ // every one a fresh speakingChange(false) — which the client turns into a
1093
+ // turnEnd — so each disconnect after a conversation fired three phantom
1094
+ // turns. Emit only what actually changed.
1095
+ const had = {
1096
+ messages: this.chatMessages.length > 0,
1097
+ transcription: this.userTranscription !== "",
1098
+ responding: this.isBotResponding,
1099
+ speaking: this.isSpeaking,
1100
+ listening: this.isListening,
1101
+ emotion: this._currentEmotion !== null,
1102
+ };
1077
1103
  this.chatMessages = [];
1078
1104
  this.activeBotLlmMessageId = null;
1079
1105
  this.userTranscription = "";
@@ -1085,12 +1111,17 @@ export class MessageHandler extends EventEmitter {
1085
1111
  this.seenBotOutputSegments.clear();
1086
1112
  this._clearModelOutputReplayLedger();
1087
1113
  this.blendshapeQueue.reset();
1088
- this.emit("messagesChange", this.chatMessages);
1089
- this.emit("userTranscriptionChange", "");
1090
- this.emit("botRespondingChange", false);
1091
- this.emit("speakingChange", false);
1092
- this.emit("listeningChange", false);
1093
- this.emit("emotionChange", null);
1114
+ if (had.messages)
1115
+ this.emit("messagesChange", this.chatMessages);
1116
+ if (had.transcription)
1117
+ this.emit("userTranscriptionChange", "");
1118
+ if (had.responding)
1119
+ this.emit("botRespondingChange", false);
1120
+ if (had.speaking)
1121
+ this.emit("speakingChange", false);
1122
+ if (had.listening)
1123
+ this.emit("listeningChange", false);
1124
+ if (had.emotion)
1125
+ this.emit("emotionChange", null);
1094
1126
  }
1095
1127
  }
1096
- //# sourceMappingURL=MessageHandler.js.map
@@ -76,4 +76,3 @@ export declare class SSESession {
76
76
  private static botLlmTextCorrelationChanged;
77
77
  private clearPendingBotLlmText;
78
78
  }
79
- //# sourceMappingURL=SSESession.d.ts.map
@@ -724,4 +724,3 @@ function withSseRequestErrorContext(error, messages, workspaceRequest = false) {
724
724
  // failures. Personal primitive payloads keep their preexisting value/type.
725
725
  return workspaceRequest ? { error, ...context } : error;
726
726
  }
727
- //# sourceMappingURL=SSESession.js.map
@@ -54,4 +54,3 @@ export declare class ScreenShareManager extends EventEmitter implements ScreenSh
54
54
  */
55
55
  reset(): void;
56
56
  }
57
- //# sourceMappingURL=ScreenShareManager.d.ts.map
@@ -204,4 +204,3 @@ export class ScreenShareManager extends EventEmitter {
204
204
  });
205
205
  }
206
206
  }
207
- //# sourceMappingURL=ScreenShareManager.js.map
@@ -101,4 +101,3 @@ export declare class VideoManager extends EventEmitter implements VideoControls
101
101
  reset(): void;
102
102
  }
103
103
  export {};
104
- //# sourceMappingURL=VideoManager.d.ts.map
@@ -751,4 +751,3 @@ export class VideoManager extends EventEmitter {
751
751
  });
752
752
  }
753
753
  }
754
- //# sourceMappingURL=VideoManager.js.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * The chat widget's character name and avatar lookup.
3
+ *
4
+ * One copy, because there were two: `useCharacterInfo` and the vanilla
5
+ * widget's inline version, the latter carrying the comment "matches React
6
+ * useCharacterInfo hook" — a sync kept by hand, which is how they came to
7
+ * share a hardcoded host nobody could override.
8
+ *
9
+ * This is cosmetic. The result decorates the widget header and nothing else:
10
+ * no connection, credential or message depends on it, so a failure degrades
11
+ * to the fallback name and no image rather than breaking the chat.
12
+ */
13
+ /** Origin that serves `POST /character/get`. Not `api2.convai.com`, which does not. */
14
+ export declare const DEFAULT_CHARACTER_INFO_URL = "https://api.convai.com";
15
+ /** The two fields the widget header reads. */
16
+ export interface CharacterInfo {
17
+ name: string;
18
+ image: string | null;
19
+ }
20
+ /** Shown when the character has no name of its own, or the lookup fails. */
21
+ export declare const FALLBACK_CHARACTER_NAME = "Convi";
22
+ export interface FetchCharacterInfoOptions {
23
+ characterId: string;
24
+ /** Sent as `X-API-Key`. Ignored when `authToken` is present. */
25
+ apiKey?: string | null;
26
+ /** Sent as `API-AUTH-TOKEN`, and preferred over `apiKey`. */
27
+ authToken?: string | null;
28
+ /**
29
+ * Origin to ask, for a deployment that is not Convai's SaaS. Defaults to
30
+ * {@link DEFAULT_CHARACTER_INFO_URL}. An on-prem deployment must set this,
31
+ * or the lookup leaves its network — carrying the API key with it.
32
+ */
33
+ baseUrl?: string | null;
34
+ /** Lets a caller abort in flight; the widget drops it on unmount. */
35
+ signal?: AbortSignal;
36
+ }
37
+ /** Pick the name and avatar out of a `/character/get` body, with the widget's fallbacks. */
38
+ export declare function readCharacterInfo(data: unknown): CharacterInfo;
39
+ /**
40
+ * Fetch a character's display name and avatar.
41
+ *
42
+ * Throws on a non-OK response so a caller can report it; callers that only
43
+ * decorate a header should catch and keep the fallback.
44
+ */
45
+ export declare function fetchCharacterInfo(options: FetchCharacterInfoOptions): Promise<CharacterInfo>;
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The chat widget's character name and avatar lookup.
3
+ *
4
+ * One copy, because there were two: `useCharacterInfo` and the vanilla
5
+ * widget's inline version, the latter carrying the comment "matches React
6
+ * useCharacterInfo hook" — a sync kept by hand, which is how they came to
7
+ * share a hardcoded host nobody could override.
8
+ *
9
+ * This is cosmetic. The result decorates the widget header and nothing else:
10
+ * no connection, credential or message depends on it, so a failure degrades
11
+ * to the fallback name and no image rather than breaking the chat.
12
+ */
13
+ /** Origin that serves `POST /character/get`. Not `api2.convai.com`, which does not. */
14
+ export const DEFAULT_CHARACTER_INFO_URL = "https://api.convai.com";
15
+ /** Shown when the character has no name of its own, or the lookup fails. */
16
+ export const FALLBACK_CHARACTER_NAME = "Convi";
17
+ /** Pick the name and avatar out of a `/character/get` body, with the widget's fallbacks. */
18
+ export function readCharacterInfo(data) {
19
+ const body = (data ?? {});
20
+ const str = (v) => typeof v === "string" && v.length > 0 ? v : null;
21
+ const details = body.model_details;
22
+ return {
23
+ name: str(body.character_name) ?? FALLBACK_CHARACTER_NAME,
24
+ image: str(details?.METAHUMAN?.avatar_image_square) ??
25
+ str(details?.METAHUMAN?.avatar_image) ??
26
+ str(details?.modelPlaceholder),
27
+ };
28
+ }
29
+ /**
30
+ * Fetch a character's display name and avatar.
31
+ *
32
+ * Throws on a non-OK response so a caller can report it; callers that only
33
+ * decorate a header should catch and keep the fallback.
34
+ */
35
+ export async function fetchCharacterInfo(options) {
36
+ const { characterId, apiKey, authToken, baseUrl, signal } = options;
37
+ const headers = {
38
+ "Content-Type": "application/json",
39
+ };
40
+ if (authToken)
41
+ headers["API-AUTH-TOKEN"] = authToken;
42
+ else if (apiKey)
43
+ headers["X-API-Key"] = apiKey;
44
+ const origin = (baseUrl || DEFAULT_CHARACTER_INFO_URL).replace(/\/+$/, "");
45
+ const response = await fetch(`${origin}/character/get`, {
46
+ method: "POST",
47
+ headers,
48
+ body: JSON.stringify({ charID: characterId }),
49
+ signal,
50
+ });
51
+ if (!response.ok) {
52
+ throw new Error(`Failed to fetch character info: ${response.status}`);
53
+ }
54
+ return readCharacterInfo(await response.json());
55
+ }
@@ -37,4 +37,3 @@ export declare function parseCharacterReference(value: string): CharacterReferen
37
37
  export declare function resolveCharacterReference(characterId: string, characterVersion?: CharacterVersionSelector | null): CharacterReference;
38
38
  /** True when `value` is a bare character UUID. */
39
39
  export declare function isCharacterUuid(value: string): boolean;
40
- //# sourceMappingURL=characterReference.d.ts.map
@@ -69,4 +69,3 @@ export function resolveCharacterReference(characterId, characterVersion) {
69
69
  export function isCharacterUuid(value) {
70
70
  return UUID_RE.test(value);
71
71
  }
72
- //# sourceMappingURL=characterReference.js.map
@@ -57,4 +57,3 @@ export interface ActionConnectRequestConfig {
57
57
  tools?: ClientToolConnectRequestDeclaration[];
58
58
  }
59
59
  export declare function buildActionConnectConfig(config: Pick<ConvaiConfig, "actionConfig">): ActionConnectRequestConfig | undefined;
60
- //# sourceMappingURL=connectRequest.d.ts.map
@@ -111,4 +111,3 @@ export function buildActionConnectConfig(config) {
111
111
  ...(actionConfig.tools && { tools: serializeClientTools(actionConfig.tools) }),
112
112
  };
113
113
  }
114
- //# sourceMappingURL=connectRequest.js.map
@@ -1,4 +1,3 @@
1
1
  import type { ContextUpdateOptions, RespondMode } from "./types.js";
2
2
  export declare function shouldPreemptForContextUpdateResponse(options: Pick<ContextUpdateOptions, "run_llm" | "respond_mode">): boolean;
3
3
  export declare function shouldPreemptForExplicitRespondMode(respondMode: RespondMode | undefined): boolean;
4
- //# sourceMappingURL=contextUpdateRequest.d.ts.map
@@ -7,4 +7,3 @@ export function shouldPreemptForContextUpdateResponse(options) {
7
7
  export function shouldPreemptForExplicitRespondMode(respondMode) {
8
8
  return respondMode === "must_respond";
9
9
  }
10
- //# sourceMappingURL=contextUpdateRequest.js.map
@@ -15,12 +15,13 @@ export { parseCharacterReference, resolveCharacterReference, isCharacterVersionS
15
15
  export { BlendshapeQueue } from './BlendshapeQueue.js';
16
16
  export type { TurnStats, BlendshapeChunkMetadata } from './BlendshapeQueue.js';
17
17
  export { EventEmitter } from './EventEmitter.js';
18
+ export { fetchCharacterInfo, readCharacterInfo, DEFAULT_CHARACTER_INFO_URL, FALLBACK_CHARACTER_NAME, } from './characterInfo.js';
19
+ export type { CharacterInfo, FetchCharacterInfoOptions } from './characterInfo.js';
18
20
  export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
19
21
  export type { InlineNode, MediaKind } from '../utils/inlineMarkdown.js';
20
- export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
22
+ export { linkKindForUrl, describeUrl, fileNameOf, documentBadge, contactLabel, hoverTitle, isMixedContent, } from '../utils/linkPresentation.js';
21
23
  export type { LinkKind } from '../utils/linkPresentation.js';
22
- export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS } from '../utils/linkPreview.js';
24
+ export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS, safeHttpUrl, siteNameFor, faviconFor, resetLinkPreviewCache, } from '../utils/linkPreview.js';
23
25
  export type { LinkPreviewMeta, LinkPreviewResolver } from '../utils/linkPreview.js';
24
26
  export { ModelOutputExtensionRegistry, isJsonObject, isJsonValue, parseModelOutputMessage, } from './modelOutput.js';
25
27
  export type { ExtensionRenderResult, ModelOutputExtensionRenderer, } from './modelOutput.js';
26
- //# sourceMappingURL=index.d.ts.map
@@ -20,13 +20,30 @@ export { parseCharacterReference, resolveCharacterReference, isCharacterVersionS
20
20
  export { BlendshapeQueue } from './BlendshapeQueue.js';
21
21
  // Event Emitter (for advanced usage)
22
22
  export { EventEmitter } from './EventEmitter.js';
23
+ // The widget header's character name/avatar lookup. Public so any UI —
24
+ // including @convai/web-widget once the chat UI moves there, and anyone
25
+ // building their own — reuses the one implementation and honours
26
+ // `characterInfoUrl`, rather than hardcoding a host the way two hand-synced
27
+ // copies used to.
28
+ export { fetchCharacterInfo, readCharacterInfo, DEFAULT_CHARACTER_INFO_URL, FALLBACK_CHARACTER_NAME, } from './characterInfo.js';
23
29
  // Inline markdown tokenizer. `bot-llm-text` arrives as a plain string, so a
24
30
  // custom chat UI — anything not using ConvaiWidget — needs this to turn one
25
31
  // line of it into links, images and bare URLs. Only the scheme allowlist in
26
32
  // `isSafeHref` becomes a link, so a renderer built on these nodes cannot emit
27
33
  // a javascript: href however the server framed it.
28
34
  export { parseInlineMarkdown, mediaKindForUrl, isSafeHref, compactUrl } from '../utils/inlineMarkdown.js';
29
- export { linkKindForUrl, describeUrl } from '../utils/linkPresentation.js';
30
- export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS } from '../utils/linkPreview.js';
35
+ // Pure functions for labelling a link: URL in, string out. Public so a UI
36
+ // rendering links — the bundled widgets, @convai/web-widget, or your own —
37
+ // derives the same file name, badge, contact label and hover text. The
38
+ // styling half of that module (glyph SVGs, CSS objects, card-count policy) is
39
+ // rendering, and stays with the UI.
40
+ export { linkKindForUrl, describeUrl, fileNameOf, documentBadge, contactLabel, hoverTitle, isMixedContent, } from '../utils/linkPresentation.js';
41
+ // `safeHttpUrl` is a sanitiser — http and https only — and a sanitiser should
42
+ // have exactly one implementation, so it is public rather than re-derived by
43
+ // each UI that renders a preview's favicon.
44
+ export { resolveLinkPreviewCached, isCardWorthy, LINK_PREVIEW_TIMEOUT_MS, safeHttpUrl, siteNameFor, faviconFor,
45
+ // The preview cache is module-level and shared by every card on the page,
46
+ // so a consumer had no way to drop it — on sign-out, say, or between tests
47
+ // of a UI that lives outside this package and so cannot reach it by path.
48
+ resetLinkPreviewCache, } from '../utils/linkPreview.js';
31
49
  export { ModelOutputExtensionRegistry, isJsonObject, isJsonValue, parseModelOutputMessage, } from './modelOutput.js';
32
- //# sourceMappingURL=index.js.map