@convai/web-sdk 1.9.0-beta.6 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -13
- package/dist/core/AudioManager.d.ts +0 -1
- package/dist/core/AudioManager.js +0 -1
- package/dist/core/BlendshapeQueue.d.ts +0 -1
- package/dist/core/BlendshapeQueue.js +20 -6
- package/dist/core/CharacterRoster.d.ts +0 -1
- package/dist/core/CharacterRoster.js +0 -1
- package/dist/core/CharacterVersionManager.d.ts +0 -1
- package/dist/core/CharacterVersionManager.js +0 -1
- package/dist/core/ConnectionStateHandler.d.ts +0 -1
- package/dist/core/ConnectionStateHandler.js +5 -2
- package/dist/core/ConvaiClient.d.ts +31 -3
- package/dist/core/ConvaiClient.js +136 -14
- package/dist/core/ConvaiRoomError.d.ts +0 -1
- package/dist/core/ConvaiRoomError.js +20 -2
- package/dist/core/EventEmitter.d.ts +0 -1
- package/dist/core/EventEmitter.js +0 -1
- package/dist/core/MemoryManager.d.ts +0 -1
- package/dist/core/MemoryManager.js +0 -1
- package/dist/core/MessageHandler.d.ts +0 -1
- package/dist/core/MessageHandler.js +41 -10
- package/dist/core/SSESession.d.ts +0 -1
- package/dist/core/SSESession.js +0 -1
- package/dist/core/ScreenShareManager.d.ts +0 -1
- package/dist/core/ScreenShareManager.js +0 -1
- package/dist/core/VideoManager.d.ts +0 -1
- package/dist/core/VideoManager.js +0 -1
- package/dist/core/characterInfo.d.ts +45 -0
- package/dist/core/characterInfo.js +55 -0
- package/dist/core/characterReference.d.ts +0 -1
- package/dist/core/characterReference.js +0 -1
- package/dist/core/connectRequest.d.ts +0 -1
- package/dist/core/connectRequest.js +0 -1
- package/dist/core/contextUpdateRequest.d.ts +0 -1
- package/dist/core/contextUpdateRequest.js +0 -1
- package/dist/core/index.d.ts +4 -3
- package/dist/core/index.js +20 -3
- package/dist/core/logicalTurn.d.ts +0 -1
- package/dist/core/logicalTurn.js +0 -1
- package/dist/core/modelOutput.d.ts +0 -1
- package/dist/core/modelOutput.js +0 -1
- package/dist/core/publishedChat.d.ts +0 -1
- package/dist/core/publishedChat.js +0 -1
- package/dist/core/rosterRequest.d.ts +0 -1
- package/dist/core/rosterRequest.js +0 -1
- package/dist/core/rtviEnvelope.d.ts +0 -1
- package/dist/core/rtviEnvelope.js +0 -1
- package/dist/core/types.d.ts +112 -10
- package/dist/core/types.js +0 -1
- package/dist/core/videoSourceState.d.ts +0 -1
- package/dist/core/videoSourceState.js +0 -1
- package/dist/core/visionRequest.d.ts +0 -1
- package/dist/core/visionRequest.js +0 -1
- package/dist/embed/index.d.ts +11 -1
- package/dist/embed/index.js +11 -1
- package/dist/embed/publicationApi.d.ts +0 -1
- package/dist/embed/publicationApi.js +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/dist/lipsync-helpers/arkitOrder61.d.ts +0 -1
- package/dist/lipsync-helpers/arkitOrder61.js +5 -3
- package/dist/lipsync-helpers/createBlendshapeQueue.d.ts +0 -1
- package/dist/lipsync-helpers/createBlendshapeQueue.js +7 -1
- package/dist/lipsync-helpers/declarativeMapping.d.ts +2 -1
- package/dist/lipsync-helpers/declarativeMapping.js +72 -146
- package/dist/lipsync-helpers/index.d.ts +0 -1
- package/dist/lipsync-helpers/index.js +0 -1
- package/dist/lipsync-helpers/mappingTypes.d.ts +6 -5
- package/dist/lipsync-helpers/mappingTypes.js +0 -1
- package/dist/lipsync-helpers/metahumanOrder251.d.ts +0 -1
- package/dist/lipsync-helpers/metahumanOrder251.js +8 -9
- package/dist/lipsync-helpers/mhaLimitDrivers.d.ts +0 -1
- package/dist/lipsync-helpers/mhaLimitDrivers.js +0 -1
- package/dist/lipsync-helpers/naturalness/processor.d.ts +0 -1
- package/dist/lipsync-helpers/naturalness/processor.js +6 -4
- package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts +0 -1
- package/dist/lipsync-helpers/naturalness/profiles/mha.js +0 -1
- package/dist/lipsync-helpers/naturalness/types.d.ts +0 -1
- package/dist/lipsync-helpers/naturalness/types.js +0 -1
- package/dist/lipsync-helpers/presetMappers.d.ts +0 -1
- package/dist/lipsync-helpers/presetMappers.js +0 -1
- package/dist/react/components/ConvaiWidget.d.ts +0 -1
- package/dist/react/components/ConvaiWidget.js +16 -8
- package/dist/react/components/index.d.ts +0 -1
- package/dist/react/components/index.js +0 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js +0 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js +0 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.js +0 -1
- package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/FloatingVideo.js +0 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +0 -1
- package/dist/react/components/rtc-widget/components/MessageBubble.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/MessageBubble.js +0 -1
- package/dist/react/components/rtc-widget/components/MessageList.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/MessageList.js +0 -1
- package/dist/react/components/rtc-widget/components/SiteCard.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/SiteCard.js +0 -1
- package/dist/react/components/rtc-widget/components/UserMessage.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/UserMessage.js +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/index.js +0 -1
- package/dist/react/components/rtc-widget/components/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/components/index.js +0 -1
- package/dist/react/components/rtc-widget/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/index.js +0 -1
- package/dist/react/components/rtc-widget/styles/framerConfig.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/framerConfig.js +0 -1
- package/dist/react/components/rtc-widget/styles/icons.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/icons.js +0 -1
- package/dist/react/components/rtc-widget/styles/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/index.js +0 -1
- package/dist/react/components/rtc-widget/styles/styledComponents.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/styledComponents.js +0 -1
- package/dist/react/components/rtc-widget/styles/theme.d.ts +0 -1
- package/dist/react/components/rtc-widget/styles/theme.js +0 -1
- package/dist/react/components/rtc-widget/types/index.d.ts +0 -1
- package/dist/react/components/rtc-widget/types/index.js +0 -1
- package/dist/react/hooks/index.d.ts +0 -1
- package/dist/react/hooks/index.js +0 -1
- package/dist/react/hooks/useCharacterInfo.d.ts +12 -11
- package/dist/react/hooks/useCharacterInfo.js +49 -50
- package/dist/react/hooks/useConvaiClient.d.ts +0 -1
- package/dist/react/hooks/useConvaiClient.js +6 -5
- package/dist/react/hooks/useLocalCameraTrack.d.ts +0 -1
- package/dist/react/hooks/useLocalCameraTrack.js +0 -1
- package/dist/react/icons.d.ts +0 -1
- package/dist/react/icons.js +0 -1
- package/dist/react/index.d.ts +0 -1
- package/dist/react/index.js +0 -1
- package/dist/utils/inlineMarkdown.d.ts +0 -1
- package/dist/utils/inlineMarkdown.js +0 -1
- package/dist/utils/lightbox.d.ts +0 -1
- package/dist/utils/lightbox.js +0 -1
- package/dist/utils/linkPresentation.d.ts +0 -1
- package/dist/utils/linkPresentation.js +0 -1
- package/dist/utils/linkPreview.d.ts +0 -1
- package/dist/utils/linkPreview.js +0 -1
- package/dist/utils/logger.d.ts +0 -1
- package/dist/utils/logger.js +0 -1
- package/dist/vanilla/AudioRenderer.d.ts +0 -1
- package/dist/vanilla/AudioRenderer.js +0 -1
- package/dist/vanilla/ConvaiWidget.d.ts +0 -1
- package/dist/vanilla/ConvaiWidget.js +18 -30
- package/dist/vanilla/WebSocketSession.d.ts +0 -1
- package/dist/vanilla/WebSocketSession.js +0 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts +0 -1
- package/dist/vanilla/WidgetEventSubscriptions.js +0 -1
- package/dist/vanilla/icons.d.ts +0 -1
- package/dist/vanilla/icons.js +0 -1
- package/dist/vanilla/index.d.ts +0 -1
- package/dist/vanilla/index.js +0 -1
- package/dist/vanilla/styles.d.ts +0 -1
- package/dist/vanilla/styles.js +0 -1
- package/dist/vanilla/types.d.ts +0 -1
- package/dist/vanilla/types.js +0 -1
- package/dist/vanilla/websocket.d.ts +0 -1
- package/dist/vanilla/websocket.js +0 -1
- package/dist/version.d.ts +1 -2
- package/dist/version.js +1 -2
- package/package.json +4 -4
- package/dist/core/AudioManager.d.ts.map +0 -1
- package/dist/core/AudioManager.js.map +0 -1
- package/dist/core/BlendshapeQueue.d.ts.map +0 -1
- package/dist/core/BlendshapeQueue.js.map +0 -1
- package/dist/core/CharacterRoster.d.ts.map +0 -1
- package/dist/core/CharacterRoster.js.map +0 -1
- package/dist/core/CharacterVersionManager.d.ts.map +0 -1
- package/dist/core/CharacterVersionManager.js.map +0 -1
- package/dist/core/ConnectionStateHandler.d.ts.map +0 -1
- package/dist/core/ConnectionStateHandler.js.map +0 -1
- package/dist/core/ConvaiClient.d.ts.map +0 -1
- package/dist/core/ConvaiClient.js.map +0 -1
- package/dist/core/ConvaiRoomError.d.ts.map +0 -1
- package/dist/core/ConvaiRoomError.js.map +0 -1
- package/dist/core/EventEmitter.d.ts.map +0 -1
- package/dist/core/EventEmitter.js.map +0 -1
- package/dist/core/MemoryManager.d.ts.map +0 -1
- package/dist/core/MemoryManager.js.map +0 -1
- package/dist/core/MessageHandler.d.ts.map +0 -1
- package/dist/core/MessageHandler.js.map +0 -1
- package/dist/core/SSESession.d.ts.map +0 -1
- package/dist/core/SSESession.js.map +0 -1
- package/dist/core/ScreenShareManager.d.ts.map +0 -1
- package/dist/core/ScreenShareManager.js.map +0 -1
- package/dist/core/VideoManager.d.ts.map +0 -1
- package/dist/core/VideoManager.js.map +0 -1
- package/dist/core/characterReference.d.ts.map +0 -1
- package/dist/core/characterReference.js.map +0 -1
- package/dist/core/connectRequest.d.ts.map +0 -1
- package/dist/core/connectRequest.js.map +0 -1
- package/dist/core/contextUpdateRequest.d.ts.map +0 -1
- package/dist/core/contextUpdateRequest.js.map +0 -1
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js.map +0 -1
- package/dist/core/logicalTurn.d.ts.map +0 -1
- package/dist/core/logicalTurn.js.map +0 -1
- package/dist/core/modelOutput.d.ts.map +0 -1
- package/dist/core/modelOutput.js.map +0 -1
- package/dist/core/publishedChat.d.ts.map +0 -1
- package/dist/core/publishedChat.js.map +0 -1
- package/dist/core/rosterRequest.d.ts.map +0 -1
- package/dist/core/rosterRequest.js.map +0 -1
- package/dist/core/rtviEnvelope.d.ts.map +0 -1
- package/dist/core/rtviEnvelope.js.map +0 -1
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js.map +0 -1
- package/dist/core/videoSourceState.d.ts.map +0 -1
- package/dist/core/videoSourceState.js.map +0 -1
- package/dist/core/visionRequest.d.ts.map +0 -1
- package/dist/core/visionRequest.js.map +0 -1
- package/dist/embed/index.d.ts.map +0 -1
- package/dist/embed/index.js.map +0 -1
- package/dist/embed/publicationApi.d.ts.map +0 -1
- package/dist/embed/publicationApi.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lipsync-helpers/arkitOrder61.d.ts.map +0 -1
- package/dist/lipsync-helpers/arkitOrder61.js.map +0 -1
- package/dist/lipsync-helpers/createBlendshapeQueue.d.ts.map +0 -1
- package/dist/lipsync-helpers/createBlendshapeQueue.js.map +0 -1
- package/dist/lipsync-helpers/declarativeMapping.d.ts.map +0 -1
- package/dist/lipsync-helpers/declarativeMapping.js.map +0 -1
- package/dist/lipsync-helpers/index.d.ts.map +0 -1
- package/dist/lipsync-helpers/index.js.map +0 -1
- package/dist/lipsync-helpers/mappingTypes.d.ts.map +0 -1
- package/dist/lipsync-helpers/mappingTypes.js.map +0 -1
- package/dist/lipsync-helpers/metahumanOrder251.d.ts.map +0 -1
- package/dist/lipsync-helpers/metahumanOrder251.js.map +0 -1
- package/dist/lipsync-helpers/mhaLimitDrivers.d.ts.map +0 -1
- package/dist/lipsync-helpers/mhaLimitDrivers.js.map +0 -1
- package/dist/lipsync-helpers/naturalness/processor.d.ts.map +0 -1
- package/dist/lipsync-helpers/naturalness/processor.js.map +0 -1
- package/dist/lipsync-helpers/naturalness/profiles/mha.d.ts.map +0 -1
- package/dist/lipsync-helpers/naturalness/profiles/mha.js.map +0 -1
- package/dist/lipsync-helpers/naturalness/types.d.ts.map +0 -1
- package/dist/lipsync-helpers/naturalness/types.js.map +0 -1
- package/dist/lipsync-helpers/presetMappers.d.ts.map +0 -1
- package/dist/lipsync-helpers/presetMappers.js.map +0 -1
- package/dist/react/components/ConvaiWidget.d.ts.map +0 -1
- package/dist/react/components/ConvaiWidget.js.map +0 -1
- package/dist/react/components/index.d.ts.map +0 -1
- package/dist/react/components/index.js.map +0 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js.map +0 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +0 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/ConviMessage.js.map +0 -1
- package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/FloatingVideo.js.map +0 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +0 -1
- package/dist/react/components/rtc-widget/components/MessageBubble.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/MessageBubble.js.map +0 -1
- package/dist/react/components/rtc-widget/components/MessageList.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/MessageList.js.map +0 -1
- package/dist/react/components/rtc-widget/components/SiteCard.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/SiteCard.js.map +0 -1
- package/dist/react/components/rtc-widget/components/UserMessage.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/UserMessage.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/conviComponents/index.js.map +0 -1
- package/dist/react/components/rtc-widget/components/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/components/index.js.map +0 -1
- package/dist/react/components/rtc-widget/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/index.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/framerConfig.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/framerConfig.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/icons.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/icons.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/index.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/styledComponents.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/styledComponents.js.map +0 -1
- package/dist/react/components/rtc-widget/styles/theme.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/styles/theme.js.map +0 -1
- package/dist/react/components/rtc-widget/types/index.d.ts.map +0 -1
- package/dist/react/components/rtc-widget/types/index.js.map +0 -1
- package/dist/react/hooks/index.d.ts.map +0 -1
- package/dist/react/hooks/index.js.map +0 -1
- package/dist/react/hooks/useCharacterInfo.d.ts.map +0 -1
- package/dist/react/hooks/useCharacterInfo.js.map +0 -1
- package/dist/react/hooks/useConvaiClient.d.ts.map +0 -1
- package/dist/react/hooks/useConvaiClient.js.map +0 -1
- package/dist/react/hooks/useLocalCameraTrack.d.ts.map +0 -1
- package/dist/react/hooks/useLocalCameraTrack.js.map +0 -1
- package/dist/react/icons.d.ts.map +0 -1
- package/dist/react/icons.js.map +0 -1
- package/dist/react/index.d.ts.map +0 -1
- package/dist/react/index.js.map +0 -1
- package/dist/utils/inlineMarkdown.d.ts.map +0 -1
- package/dist/utils/inlineMarkdown.js.map +0 -1
- package/dist/utils/lightbox.d.ts.map +0 -1
- package/dist/utils/lightbox.js.map +0 -1
- package/dist/utils/linkPresentation.d.ts.map +0 -1
- package/dist/utils/linkPresentation.js.map +0 -1
- package/dist/utils/linkPreview.d.ts.map +0 -1
- package/dist/utils/linkPreview.js.map +0 -1
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js.map +0 -1
- package/dist/vanilla/AudioRenderer.d.ts.map +0 -1
- package/dist/vanilla/AudioRenderer.js.map +0 -1
- package/dist/vanilla/ConvaiWidget.d.ts.map +0 -1
- package/dist/vanilla/ConvaiWidget.js.map +0 -1
- package/dist/vanilla/WebSocketSession.d.ts.map +0 -1
- package/dist/vanilla/WebSocketSession.js.map +0 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts.map +0 -1
- package/dist/vanilla/WidgetEventSubscriptions.js.map +0 -1
- package/dist/vanilla/icons.d.ts.map +0 -1
- package/dist/vanilla/icons.js.map +0 -1
- package/dist/vanilla/index.d.ts.map +0 -1
- package/dist/vanilla/index.js.map +0 -1
- package/dist/vanilla/styles.d.ts.map +0 -1
- package/dist/vanilla/styles.js.map +0 -1
- package/dist/vanilla/types.d.ts.map +0 -1
- package/dist/vanilla/types.js.map +0 -1
- package/dist/vanilla/websocket.d.ts.map +0 -1
- package/dist/vanilla/websocket.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Real-time conversational AI characters for the web.**
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/@convai/web-sdk)
|
|
6
6
|
[](https://www.typescriptlang.org/)
|
|
7
7
|
[](./LICENSE)
|
|
8
8
|
|
|
@@ -10,19 +10,44 @@ TypeScript-first SDK for embedding Convai AI characters into React and vanilla J
|
|
|
10
10
|
|
|
11
11
|
---
|
|
12
12
|
|
|
13
|
-
## What's new in 1.
|
|
13
|
+
## What's new in 1.9.0
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
> **Breaking for 1.8.0 users:** the `<convai-chat>` custom element and the `./embed/browser` entry point (`dist/embed/chat-embed-v1.js`) are removed. The copy/paste published-chat embed is now `<convai-widget>` from [`@convai/web-widget`](https://www.npmjs.com/package/@convai/web-widget); the [CHANGELOG](./CHANGELOG.md) has the before/after snippet.
|
|
16
16
|
|
|
17
17
|
- **Multi-character rooms** — connect a roster of characters with the `characters` config option (two copies of one character are two independent members), switch who answers with `setInteractionTarget()`, add or remove members live with `updateCharacterRoster()`, and let other participants join the same room with `joinRoom()`. Every transcript line, audio track and readiness event is attributed to a `membershipId`. [Usage below.](#multi-character-rooms-beta)
|
|
18
|
-
- **Agentic actions and canonical model output (v2)** — opt in with `capabilities`, declare client-executed tools in `actionConfig.tools`, consume typed `modelOutput` envelopes, return results with `sendActionResultAndWait()` for a correlated server acknowledgement, and read the raw provider stream through `botLlmTextRaw`. `visionPromptMode: "disabled"` keeps scene context without advertising visual perception. [Usage below.](#agentic-actions-and-canonical-model-output-v2)
|
|
19
|
-
- **Published text chat** — a credential-free, text-only connection for public chat pages: `connectWithPublicationGrant()` and `connectionType: "text"`. For a copy/paste embed, pair it with [`@convai/web-widget`](https://www.npmjs.com/package/@convai/web-widget). [Usage below.](#published-text-chat)
|
|
20
18
|
- **Typed events** — `client.on(event, callback)` infers each callback's payload from the exported `ConvaiEventMap`, so `botReady`, `modelOutput`, `characterStatus` and the rest are checked at compile time. See the [events reference](docs/convai_events.md).
|
|
21
|
-
- **Local transcript lines and usage updates** — `appendMessage()` inserts a line into the transcript without sending anything, and `toggleUsageUpdates(true)` opts into per-turn `usageUpdate` cost breakdowns.
|
|
19
|
+
- **Local transcript lines and usage updates** — `appendMessage()` inserts a line into the transcript without sending anything, and `toggleUsageUpdates(true)` opts into per-turn `usageUpdate` cost breakdowns (on a session connected with `debug: true`; otherwise the server has no usage stream).
|
|
22
20
|
- **Character versioning** — connect to a character's editable draft, its promoted latest release, or an immutable tag with the `characterVersion` config option, and list, compare, release, promote, fork and discard versions through `client.characterVersions`. [Usage below.](#character-versioning-beta)
|
|
23
|
-
- **SSE interaction transport** —
|
|
21
|
+
- **SSE interaction transport** — chat over the interaction API, selected by `interactionApiUrl`: text in, the reply streamed as text and, with `ttsEnabled`, as speech (`audioData`); the one transport that runs under Node. We recommend SSE for chat and realtime for voice — see [Choosing a Transport](docs/convai_choosing_transport.md). [Usage below.](#sse-interaction-transport-beta)
|
|
24
22
|
- **Embeddable vanilla widget** — the vanilla widget runs inside a shadow root, with a character header and a connecting overlay, so it can be dropped into any page.
|
|
25
23
|
- **Node-importable dist** — `@convai/web-sdk/core`, `/vanilla`, `/vanilla/websocket` and `/lipsync-helpers` load in plain Node, SSR and Next.js server components.
|
|
24
|
+
- **Character voice mute** — `setCharacterMuted()` / `isCharacterMuted()` silence the character's voice for the listener; `audioControls` stays the microphone.
|
|
25
|
+
- **Raw transport frames** — the typed `rawMessage` event exposes incoming LiveKit, WebSocket and SSE frames.
|
|
26
|
+
- **Smaller install** — 220 MB → 36 MB of dependencies, and no shipped source maps (681.9 kB → 290.5 kB packed).
|
|
27
|
+
|
|
28
|
+
### Previously in 1.8.0
|
|
29
|
+
|
|
30
|
+
- **Protocol capabilities, opted into one at a time** — `capabilities`
|
|
31
|
+
selects v2 correlated client tool calls, the canonical Core-validated
|
|
32
|
+
`modelOutput` envelope, and raw `bot-llm-text` streaming, each independent
|
|
33
|
+
of the others. Core must confirm a v2 capability or the SDK refuses the
|
|
34
|
+
connection, so a half-upgraded backend fails at connect rather than
|
|
35
|
+
mid-conversation. Omit the block entirely and nothing changes: existing
|
|
36
|
+
connections and one-argument text messages stay on the v1 wire contract.
|
|
37
|
+
[Options table.](./docs/convai_configuration.md#protocol-capabilities)
|
|
38
|
+
- **Correlated action results and logical turns** — action results carry the
|
|
39
|
+
call they answer, and turn correlation holds across multi-envelope and
|
|
40
|
+
voice turns, so a response can be tied to its cause without guessing from
|
|
41
|
+
arrival order.
|
|
42
|
+
- **Extension renderer registry** — render custom model-output extensions
|
|
43
|
+
without the SDK knowing your UI framework.
|
|
44
|
+
- **Published chat without a credential** — a text-only connection method for
|
|
45
|
+
published-chat launch grants, plus a native custom-element browser bundle
|
|
46
|
+
at `dist/embed/chat-embed-v1.js` for iframe-free embeds. The embed never
|
|
47
|
+
receives a publisher API key. [Usage below.](#published-text-chat)
|
|
48
|
+
- **Loads in Node without a bundler** — emitted ESM carries explicit relative
|
|
49
|
+
extensions, so the published package and the Chat Publish client resolve
|
|
50
|
+
under plain Node resolution.
|
|
26
51
|
|
|
27
52
|
### Previously in 1.7.0
|
|
28
53
|
|
|
@@ -31,7 +56,7 @@ Install the beta with `npm install @convai/web-sdk@beta`.
|
|
|
31
56
|
- **Lipsync naturalness pipeline** — modular naturalness processing with a tuned MetaHuman profile.
|
|
32
57
|
- **Adaptive glass widget styling** — `ConvaiWidget` adapts to light and dark backgrounds.
|
|
33
58
|
|
|
34
|
-
### 1.6.0
|
|
59
|
+
### Previously in 1.6.0
|
|
35
60
|
|
|
36
61
|
- **Narrative Design template keys** — personalize one narrative graph per session: seed values at connect with the `narrativeTemplateKeys` config option, replace them mid-session with `updateTemplateKeys()`. [Usage below.](#narrative-design-template-keys)
|
|
37
62
|
- **Typed parameterized actions** — `actionResponse` is now typed via the exported `ConvaiAction` / `ActionResponseEvent`, including the `target` of parameterized actions. [Usage below.](#actions)
|
|
@@ -236,7 +261,8 @@ Full documentation is at **<a href="https://docs.convai.com/api-docs/plugins-and
|
|
|
236
261
|
| <a href="https://docs.convai.com/api-docs/plugins-and-integrations/web-plugins/convai-web-sdk/error-handling" target="_blank" rel="noopener noreferrer">Error Handling</a> | `error`, `disconnect`, `serverResponse`, retry patterns |
|
|
237
262
|
| <a href="https://docs.convai.com/api-docs/plugins-and-integrations/web-plugins/convai-web-sdk/auth-tokens" target="_blank" rel="noopener noreferrer">Auth Tokens</a> | Server-side token exchange for production |
|
|
238
263
|
| <a href="https://docs.convai.com/api-docs/plugins-and-integrations/web-plugins/convai-web-sdk/websocket-transport-layer" target="_blank" rel="noopener noreferrer">WebSocket Transport</a> | Alternative transport for WebRTC-constrained environments |
|
|
239
|
-
| <a href="https://docs.convai.com/api-docs/plugins-and-integrations/web-plugins/convai-web-sdk" target="_blank" rel="noopener noreferrer">SSE Transport</a> |
|
|
264
|
+
| <a href="https://docs.convai.com/api-docs/plugins-and-integrations/web-plugins/convai-web-sdk" target="_blank" rel="noopener noreferrer">SSE Transport</a> | Chat transport: text in, text or audio out; the one that runs under Node |
|
|
265
|
+
| [Choosing a Transport](docs/convai_choosing_transport.md) | SSE vs realtime vs WebSocket, the recommended SSE-chat-plus-voice-mode setup, and why |
|
|
240
266
|
| [Character Versioning](docs/convai_character_versioning.md) | Connect to a draft, latest, or tagged version; list, compare, release and promote versions |
|
|
241
267
|
| [Multi-Character Rooms](docs/convai_multi_character.md) | Rosters, `joinRoom`, interaction targets, live roster updates, per-member attribution |
|
|
242
268
|
| [Published Text Chat](docs/convai_published_chat.md) | Grant-based text-only sessions, the copy/paste embed, lifecycle and API reference |
|
|
@@ -297,7 +323,7 @@ See the <a href="https://docs.convai.com/api-docs/plugins-and-integrations/web-p
|
|
|
297
323
|
|
|
298
324
|
## SSE interaction transport (beta)
|
|
299
325
|
|
|
300
|
-
Use the interaction API for
|
|
326
|
+
Use the interaction API for chat — typed input, with the reply streamed as text and, optionally, speech:
|
|
301
327
|
|
|
302
328
|
```ts
|
|
303
329
|
const client = new ConvaiClient({
|
|
@@ -311,10 +337,15 @@ client.sendUserTextMessage("Hello!");
|
|
|
311
337
|
```
|
|
312
338
|
|
|
313
339
|
This sends each message as an SSE `POST` with `Authorization: Bearer ...`. Set `transport: "sse"`
|
|
314
|
-
explicitly if preferred.
|
|
340
|
+
explicitly if preferred. With `ttsEnabled: true` the reply's speech streams as `audioData`
|
|
341
|
+
events on the same response; there is no microphone, video, or lipsync. It never calls
|
|
315
342
|
`/connect`, so `connect()` makes no network request and the session id arrives on the first
|
|
316
343
|
interaction via the `characterSessionId` event.
|
|
317
344
|
|
|
345
|
+
We recommend SSE for chat and realtime for voice: start on SSE and move the same conversation to
|
|
346
|
+
realtime when the user wants to talk. See [Choosing a Transport](docs/convai_choosing_transport.md)
|
|
347
|
+
for why, and for building on one transport only.
|
|
348
|
+
|
|
318
349
|
Because it needs neither WebRTC nor a DOM, this is the only transport that runs outside a browser.
|
|
319
350
|
Import `@convai/web-sdk/core` from Node, SSR, or a serverless function — not the root or `/react`
|
|
320
351
|
entry points, which pull in browser-only dependencies.
|
|
@@ -473,7 +504,7 @@ const triggerId = client.visionTrigger({
|
|
|
473
504
|
await client.videoControls.unpublishVisionSource(handle);
|
|
474
505
|
```
|
|
475
506
|
|
|
476
|
-
`visionStatus()` and `visionTrigger()` return an update id. Match it against `serverResponse` events for outcomes such as `frames_available`, `buffer_empty`, `attached`, or `
|
|
507
|
+
`visionStatus()` and `visionTrigger()` return an update id. Match it against `serverResponse` events for outcomes such as `frames_available`, `buffer_empty`, `attached`, `no_active_video` or `vision_not_enabled`. Vision needs more than `enableVideo: true`: the account's unified vision context feature and a vision-capable, non-realtime model. Without them frames publish fine but are never seen, and the SDK warns once per session.
|
|
477
508
|
|
|
478
509
|
---
|
|
479
510
|
|
|
@@ -641,7 +672,7 @@ client.updateEmotion("joy");
|
|
|
641
672
|
client.updateEmotion(null); // clear — "neutral" and "" clear it too
|
|
642
673
|
```
|
|
643
674
|
|
|
644
|
-
Values are trimmed and lowercased. The runtime value carries into the next connect, including a reconnect; an explicit `stateOfMind` in the connect config takes precedence.
|
|
675
|
+
The server applies Plutchik's eight primary emotions — `joy`, `trust`, `fear`, `surprise`, `sadness`, `disgust`, `anger`, `anticipation` — and ignores anything else (the SDK warns). Values are trimmed and lowercased. The runtime value carries into the next connect, including a reconnect; an explicit `stateOfMind` in the connect config takes precedence.
|
|
645
676
|
|
|
646
677
|
Requires backend support — live on production as of 2026-08-20. On a backend without it, the server replies with an `Unknown message type` error on `serverResponse`. Because `/connect` silently ignores unknown fields, a successful connect alone does not prove `state_of_mind` was applied, so watch the ack:
|
|
647
678
|
|
|
@@ -20,6 +20,25 @@
|
|
|
20
20
|
* - Mapper is applied when frames are added to the queue
|
|
21
21
|
* - Common use cases: ARKit 61 → ARKit 52, MetaHuman 251 → Custom format
|
|
22
22
|
*/
|
|
23
|
+
/**
|
|
24
|
+
* A frame scaled by alpha. Mapper output keeps its shape: the
|
|
25
|
+
* lipsync-helpers name mappers hang target names on the array
|
|
26
|
+
* (`__blendshapeNames`) or return `{ names, values, ... }`, and a fade that
|
|
27
|
+
* dropped either made getBlendshapeObject() return {} on faded frames.
|
|
28
|
+
*/
|
|
29
|
+
function scaleFrame(frame, alpha) {
|
|
30
|
+
const optimized = frame;
|
|
31
|
+
if (!(frame instanceof Float32Array) && optimized.values instanceof Float32Array) {
|
|
32
|
+
return { ...optimized, values: optimized.values.map((v) => v * alpha) };
|
|
33
|
+
}
|
|
34
|
+
const faded = new Float32Array(frame.length);
|
|
35
|
+
for (let i = 0; i < frame.length; i++)
|
|
36
|
+
faded[i] = frame[i] * alpha;
|
|
37
|
+
const names = frame.__blendshapeNames;
|
|
38
|
+
if (names)
|
|
39
|
+
Object.defineProperty(faded, "__blendshapeNames", { value: names, enumerable: false });
|
|
40
|
+
return faded;
|
|
41
|
+
}
|
|
23
42
|
export class BlendshapeQueue {
|
|
24
43
|
/**
|
|
25
44
|
* Create a new BlendshapeQueue
|
|
@@ -425,11 +444,7 @@ export class BlendshapeQueue {
|
|
|
425
444
|
}
|
|
426
445
|
// Apply alpha to all morph values
|
|
427
446
|
if (alpha < 1.0) {
|
|
428
|
-
|
|
429
|
-
for (let i = 0; i < frame.length; i++) {
|
|
430
|
-
fadedFrame[i] = frame[i] * alpha;
|
|
431
|
-
}
|
|
432
|
-
return fadedFrame;
|
|
447
|
+
return scaleFrame(frame, alpha);
|
|
433
448
|
}
|
|
434
449
|
return frame;
|
|
435
450
|
}
|
|
@@ -770,4 +785,3 @@ export class BlendshapeQueue {
|
|
|
770
785
|
BlendshapeQueue.TARGET_FPS = 60;
|
|
771
786
|
BlendshapeQueue.MAX_RETIRED_TIMELINE_ALIASES = 48;
|
|
772
787
|
BlendshapeQueue.MISSING_INDEXED_FRAME_GRACE_MS = (24 / BlendshapeQueue.TARGET_FPS) * 1000;
|
|
773
|
-
//# sourceMappingURL=BlendshapeQueue.js.map
|
|
@@ -51,7 +51,11 @@ export class ConnectionStateHandler {
|
|
|
51
51
|
isConnected: true,
|
|
52
52
|
isConnecting: false,
|
|
53
53
|
});
|
|
54
|
-
|
|
54
|
+
// Do not reset bot-ready here. Connecting (and Disconnected) already
|
|
55
|
+
// did, so a fresh connect still waits for it — but the first bot-ready
|
|
56
|
+
// data frame can arrive before this event (measured: 3ms early, 1
|
|
57
|
+
// connect in 5). Resetting then dropped it: botReady fired twice, and
|
|
58
|
+
// isBotReady stayed false until the server happened to send another.
|
|
55
59
|
}
|
|
56
60
|
else if (state === ConnectionState.Connecting) {
|
|
57
61
|
this.onStateUpdate({
|
|
@@ -81,4 +85,3 @@ export class ConnectionStateHandler {
|
|
|
81
85
|
this.onMessageHandlerReset();
|
|
82
86
|
}
|
|
83
87
|
}
|
|
84
|
-
//# sourceMappingURL=ConnectionStateHandler.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Room } from "livekit-client";
|
|
2
|
-
import { ConvaiConfig, ConvaiClientState, ChatMessage, IConvaiClient, PublishedChatConnectOptions, AudioControls, CharacterMuteOptions, VideoControls, ScreenShareControls, DynamicInfo, ContextUpdateOptions, UploadFileOptions, ServerResponse, WebSocketSessionFactory, RespondModeUpdateOptions, UpdateSceneMetadataOptions, VisionStatusOptions, VisionTriggerOptions, ConnectionData, SendUserTextMessageOptions, ConvaiCharacterInstance, ConvaiRoomSession, JoinRoomOptions, ActiveCharacterChange, CharacterRosterChange, UpdateCharacterRosterOptions, AppendMessageOptions, ConvaiEventMap, ActionResult, ActionResultAck, ActionResultAckFailureReason, ActionResultAckOptions } from "./types.js";
|
|
2
|
+
import { ConvaiConfig, ConvaiClientState, ChatMessage, IConvaiClient, PublishedChatConnectOptions, AudioControls, CharacterMuteOptions, VideoControls, ScreenShareControls, DynamicInfo, ContextUpdateOptions, UploadFileOptions, ServerResponse, WebSocketSessionFactory, RespondModeUpdateOptions, UpdateSceneMetadataOptions, VisionStatusOptions, VisionTriggerOptions, ConnectionData, SendUserTextMessageOptions, StateOfMindInput, ConvaiCharacterInstance, ConvaiRoomSession, JoinRoomOptions, ActiveCharacterChange, CharacterRosterChange, UpdateCharacterRosterOptions, AppendMessageOptions, ConvaiEventMap, ActionResult, ActionResultAck, ActionResultAckFailureReason, ActionResultAckOptions } from "./types.js";
|
|
3
3
|
import { EventEmitter } from "./EventEmitter.js";
|
|
4
4
|
import { BlendshapeQueue } from "./BlendshapeQueue.js";
|
|
5
5
|
import { MemoryManager } from "./MemoryManager.js";
|
|
@@ -91,6 +91,12 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
91
91
|
private _rosterCommandSeq;
|
|
92
92
|
private _requestTraceId;
|
|
93
93
|
private _isBotReady;
|
|
94
|
+
/** turnEnd held back until speaking stays stopped (see speakingChange). */
|
|
95
|
+
private _pendingTurnEnd;
|
|
96
|
+
/** How long speaking must stay stopped before a turn is reported ended. */
|
|
97
|
+
private static readonly TURN_END_SETTLE_MS;
|
|
98
|
+
/** Warn once per connect when Core reports vision off for the session. */
|
|
99
|
+
private _warnedVisionNotEnabled;
|
|
94
100
|
private _participantSid;
|
|
95
101
|
private _audioSettings;
|
|
96
102
|
private _storedConfig;
|
|
@@ -99,6 +105,17 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
99
105
|
* so updateEmotion() called before any config is stored is not lost.
|
|
100
106
|
*/
|
|
101
107
|
private _stateOfMind;
|
|
108
|
+
/** States of mind published and not yet acked, oldest first; acks arrive in send order. */
|
|
109
|
+
private _pendingStateOfMindAcks;
|
|
110
|
+
/**
|
|
111
|
+
* Match an update-emotion ack to a value this client sent. The ack carries
|
|
112
|
+
* no request id, its state_of_mind is the state still in effect rather than
|
|
113
|
+
* the value it judged, and acks can arrive out of order (measured: "happy"'s
|
|
114
|
+
* rejection before "joy"'s success). So an applied ack settles the value it
|
|
115
|
+
* names, and a rejected one settles the oldest pending value that is not an
|
|
116
|
+
* accepted state of mind. Returns the rejected value, when it can be named.
|
|
117
|
+
*/
|
|
118
|
+
private _settleStateOfMindAck;
|
|
102
119
|
private _endUserId;
|
|
103
120
|
private _endUserMetadata;
|
|
104
121
|
private _wsSession;
|
|
@@ -180,6 +197,11 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
180
197
|
get requestTraceId(): string | null;
|
|
181
198
|
get isBotReady(): boolean;
|
|
182
199
|
get audioControls(): AudioControls;
|
|
200
|
+
/**
|
|
201
|
+
* Configured origin for the widget's character name/avatar lookup, or null
|
|
202
|
+
* when unset. See {@link ConvaiConfig.characterInfoUrl}.
|
|
203
|
+
*/
|
|
204
|
+
get characterInfoUrl(): string | null;
|
|
183
205
|
/**
|
|
184
206
|
* Silence the character's voice, or bring it back. See
|
|
185
207
|
* {@link IConvaiClient.setCharacterMuted}.
|
|
@@ -456,7 +478,7 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
456
478
|
* Set or clear the character's temporary state of mind.
|
|
457
479
|
* This is silent: it affects the next response and does not trigger one.
|
|
458
480
|
*/
|
|
459
|
-
updateEmotion(stateOfMind:
|
|
481
|
+
updateEmotion(stateOfMind: StateOfMindInput): void;
|
|
460
482
|
/**
|
|
461
483
|
* Send descriptive scene updates. Use when environment description changes
|
|
462
484
|
* and the bot should know what is visible or nearby. Does not modify action_config.
|
|
@@ -465,6 +487,13 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
465
487
|
name: string;
|
|
466
488
|
description: string;
|
|
467
489
|
}>, options?: UpdateSceneMetadataOptions): void;
|
|
490
|
+
/**
|
|
491
|
+
* Mirror a runtime respond-mode change into the stored config, so
|
|
492
|
+
* reconnect() — which replays _storedConfig — does not revert it. text and
|
|
493
|
+
* audio are typed `"must_respond"` only in the config, so other values for
|
|
494
|
+
* them stay runtime-only rather than widening that type.
|
|
495
|
+
*/
|
|
496
|
+
private rememberRespondMode;
|
|
468
497
|
private createUpdateId;
|
|
469
498
|
private serializeRespondModes;
|
|
470
499
|
/**
|
|
@@ -489,4 +518,3 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
489
518
|
*/
|
|
490
519
|
resetIdleTimer(): void;
|
|
491
520
|
}
|
|
492
|
-
//# sourceMappingURL=ConvaiClient.d.ts.map
|
|
@@ -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 (
|
|
524
|
-
//
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
this.
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|