@convai/web-sdk 1.8.0-beta.8 → 1.8.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 +45 -213
- package/dist/core/ConvaiClient.d.ts +1 -190
- package/dist/core/ConvaiClient.d.ts.map +1 -1
- package/dist/core/ConvaiClient.js +286 -1306
- package/dist/core/ConvaiClient.js.map +1 -1
- package/dist/core/MessageHandler.d.ts +1 -19
- package/dist/core/MessageHandler.d.ts.map +1 -1
- package/dist/core/MessageHandler.js +27 -378
- package/dist/core/MessageHandler.js.map +1 -1
- package/dist/core/connectRequest.d.ts +4 -17
- package/dist/core/connectRequest.d.ts.map +1 -1
- package/dist/core/connectRequest.js +17 -28
- package/dist/core/connectRequest.js.map +1 -1
- package/dist/core/index.d.ts +1 -8
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -13
- package/dist/core/index.js.map +1 -1
- package/dist/core/logicalTurn.d.ts +6 -4
- package/dist/core/logicalTurn.d.ts.map +1 -1
- package/dist/core/logicalTurn.js +4 -29
- package/dist/core/logicalTurn.js.map +1 -1
- package/dist/core/modelOutput.d.ts.map +1 -1
- package/dist/core/modelOutput.js +2 -2
- package/dist/core/modelOutput.js.map +1 -1
- package/dist/core/types.d.ts +22 -860
- package/dist/core/types.d.ts.map +1 -1
- package/dist/core/types.js.map +1 -1
- package/dist/embed/ConvaiChatElement.d.ts +1 -77
- package/dist/embed/ConvaiChatElement.d.ts.map +1 -1
- package/dist/embed/ConvaiChatElement.js +54 -433
- package/dist/embed/ConvaiChatElement.js.map +1 -1
- package/dist/embed/chat-embed-v1.js +35 -136
- package/dist/embed/chat-embed-v1.js.map +4 -4
- package/dist/react/components/ConvaiWidget.d.ts.map +1 -1
- package/dist/react/components/ConvaiWidget.js +1 -6
- package/dist/react/components/ConvaiWidget.js.map +1 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js +1 -28
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +1 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +0 -7
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +46 -135
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +1 -1
- package/dist/react/components/rtc-widget/components/UserMessage.js +1 -1
- package/dist/react/components/rtc-widget/components/UserMessage.js.map +1 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +1 -1
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +49 -93
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +1 -1
- package/dist/react/hooks/useConvaiClient.d.ts.map +1 -1
- package/dist/react/hooks/useConvaiClient.js +2 -17
- package/dist/react/hooks/useConvaiClient.js.map +1 -1
- package/dist/react/index.d.ts +1 -4
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -8
- package/dist/react/index.js.map +1 -1
- package/dist/vanilla/AudioRenderer.d.ts +1 -3
- package/dist/vanilla/AudioRenderer.d.ts.map +1 -1
- package/dist/vanilla/AudioRenderer.js +2 -8
- package/dist/vanilla/AudioRenderer.js.map +1 -1
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -1
- package/dist/vanilla/ConvaiWidget.js +302 -1122
- package/dist/vanilla/ConvaiWidget.js.map +1 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts +1 -1
- package/dist/vanilla/WidgetEventSubscriptions.d.ts.map +1 -1
- package/dist/vanilla/WidgetEventSubscriptions.js +0 -5
- package/dist/vanilla/WidgetEventSubscriptions.js.map +1 -1
- package/dist/vanilla/icons.d.ts.map +1 -1
- package/dist/vanilla/icons.js +15 -62
- package/dist/vanilla/icons.js.map +1 -1
- package/dist/vanilla/index.d.ts +2 -6
- package/dist/vanilla/index.d.ts.map +1 -1
- package/dist/vanilla/index.js +1 -5
- package/dist/vanilla/index.js.map +1 -1
- package/dist/vanilla/styles.d.ts +1 -18
- package/dist/vanilla/styles.d.ts.map +1 -1
- package/dist/vanilla/styles.js +29 -141
- package/dist/vanilla/styles.js.map +1 -1
- package/dist/vanilla/types.d.ts +0 -74
- package/dist/vanilla/types.d.ts.map +1 -1
- package/dist/vanilla/types.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +17 -44
- package/dist/core/CharacterRoster.d.ts +0 -84
- package/dist/core/CharacterRoster.d.ts.map +0 -1
- package/dist/core/CharacterRoster.js +0 -348
- package/dist/core/CharacterRoster.js.map +0 -1
- package/dist/core/CharacterVersionManager.d.ts +0 -100
- package/dist/core/CharacterVersionManager.d.ts.map +0 -1
- package/dist/core/CharacterVersionManager.js +0 -227
- package/dist/core/CharacterVersionManager.js.map +0 -1
- package/dist/core/ConvaiRoomError.d.ts +0 -48
- package/dist/core/ConvaiRoomError.d.ts.map +0 -1
- package/dist/core/ConvaiRoomError.js +0 -111
- package/dist/core/ConvaiRoomError.js.map +0 -1
- package/dist/core/SSESession.d.ts +0 -59
- package/dist/core/SSESession.d.ts.map +0 -1
- package/dist/core/SSESession.js +0 -289
- package/dist/core/SSESession.js.map +0 -1
- package/dist/core/characterReference.d.ts +0 -40
- package/dist/core/characterReference.d.ts.map +0 -1
- package/dist/core/characterReference.js +0 -72
- package/dist/core/characterReference.js.map +0 -1
- package/dist/core/rosterRequest.d.ts +0 -57
- package/dist/core/rosterRequest.d.ts.map +0 -1
- package/dist/core/rosterRequest.js +0 -210
- package/dist/core/rosterRequest.js.map +0 -1
- package/dist/utils/inlineMarkdown.d.ts +0 -60
- package/dist/utils/inlineMarkdown.d.ts.map +0 -1
- package/dist/utils/inlineMarkdown.js +0 -183
- package/dist/utils/inlineMarkdown.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/vanilla/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE;QACN,OAAO,EAAE;YACP,EAAE,EAAE,SAAS;YACb,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;SACf;QACD,MAAM,EAAE;YACN,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,SAAS;YACjB,IAAI,EAAE,SAAS;SAChB;QACD,OAAO,EAAE;YACP,EAAE,EAAE,SAAS;YACb,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;SACf;QACD,KAAK,EAAE;YACL,KAAK,EAAE,0BAA0B;YACjC,MAAM,EAAE,2BAA2B;YACnC,IAAI,EAAE,oBAAoB;YAC1B,QAAQ,EAAE,0BAA0B;YACpC,IAAI,EAAE,0BAA0B;YAChC,aAAa,EAAE,YAAY;YAC3B,WAAW,EAAE,oCAAoC;SAClD;QACD,MAAM,EAAE;YACN,MAAM,EAAE,SAAS;YACjB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,SAAS;YACjB,GAAG,EAAE,SAAS;SACf;QACD,KAAK,EAAE;YACL,EAAE,EAAE,SAAS;YACb,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,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AW,GAAG,gBAAgB,CAAC;IACrC,SAAS,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAErC,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAA2B,EAAU,EAAE;IAClE,OAAO,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;SAC1B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACpB,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5D,OAAO,GAAG,MAAM,KAAK,KAAK,EAAE,CAAC;IAC/B,CAAC,CAAC;SACD,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/**\n * Vanilla Styles - Port of React theme system for vanilla implementations\n */\n\n// Theme configuration (matching React version)\nexport const aeroTheme = {\n colors: {\n primary: {\n 50: \"#f0f9ff\",\n 100: \"#e0f2fe\",\n 200: \"#bae6fd\",\n 300: \"#7dd3fc\",\n 400: \"#38bdf8\",\n 500: \"#0ea5e9\",\n 600: \"#0284c7\",\n 700: \"#0369a1\",\n 800: \"#075985\",\n 900: \"#0c4a6e\",\n },\n convai: {\n light: \"#1EB453\",\n medium: \"#0b6049\",\n dark: \"#084c3a\",\n },\n neutral: {\n 50: \"#fafafa\",\n 100: \"#f5f5f5\",\n 200: \"#e5e5e5\",\n 300: \"#d4d4d4\",\n 400: \"#a3a3a3\",\n 500: \"#737373\",\n 600: \"#525252\",\n 700: \"#404040\",\n 800: \"#262626\",\n 900: \"#171717\",\n },\n glass: {\n light: \"rgba(255, 255, 255, 0.1)\",\n medium: \"rgba(255, 255, 255, 0.15)\",\n dark: \"rgba(0, 0, 0, 0.1)\",\n backdrop: \"rgba(255, 255, 255, 0.8)\",\n card: \"rgba(255, 255, 255, 0.9)\",\n backdropLight: \"blur(20px)\",\n borderLight: \"1px solid rgba(255, 255, 255, 0.2)\",\n },\n accent: {\n purple: \"#8b5cf6\",\n green: \"#10b981\",\n blue: \"#3b82f6\",\n orange: \"#f59e0b\",\n red: \"#ef4444\",\n },\n error: {\n 50: \"#fef2f2\",\n 100: \"#fee2e2\",\n 200: \"#fecaca\",\n 300: \"#fca5a5\",\n 400: \"#f87171\",\n 500: \"#ef4444\",\n 600: \"#dc2626\",\n 700: \"#b91c1c\",\n 800: \"#991b1b\",\n 900: \"#7f1d1d\",\n },\n text: {\n primary: \"#1f2937\",\n secondary: \"#6b7280\",\n tertiary: \"#9ca3af\",\n inverse: \"#ffffff\",\n },\n },\n typography: {\n fontFamily: {\n primary: '\"Noto Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n body: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n mono: 'SF Mono, Monaco, \"Cascadia Code\", \"Roboto Mono\", Consolas, \"Courier New\", monospace',\n },\n fontSize: {\n xs: \"12px\",\n sm: \"14px\",\n base: \"16px\",\n lg: \"18px\",\n xl: \"20px\",\n \"2xl\": \"24px\",\n \"3xl\": \"30px\",\n \"4xl\": \"36px\",\n },\n fontWeight: {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n },\n spacing: {\n xs: \"4px\",\n sm: \"8px\",\n md: \"16px\",\n lg: \"24px\",\n xl: \"32px\",\n \"2xl\": \"48px\",\n \"3xl\": \"64px\",\n },\n borderRadius: {\n none: \"0\",\n sm: \"4px\",\n md: \"8px\",\n lg: \"12px\",\n xl: \"16px\",\n \"2xl\": \"24px\",\n full: \"9999px\",\n },\n shadows: {\n sm: \"0 1px 2px 0 rgba(0, 0, 0, 0.05)\",\n md: \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)\",\n lg: \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\",\n xl: \"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)\",\n glass: \"0 8px 32px rgba(0, 0, 0, 0.1)\",\n },\n glass: {\n backdrop: \"blur(20px)\",\n backdropLight: \"blur(10px)\",\n backdropHeavy: \"blur(40px)\",\n border: \"1px solid rgba(255, 255, 255, 0.2)\",\n borderLight: \"1px solid rgba(255, 255, 255, 0.1)\",\n },\n transitions: {\n fast: \"0.15s ease-in-out\",\n normal: \"0.2s ease-in-out\",\n slow: \"0.3s ease-in-out\",\n spring: \"0.4s cubic-bezier(0.4, 0, 0.2, 1)\",\n snappy: \"all 0.1s ease-out\",\n },\n zIndex: {\n base: 1,\n dropdown: 1000,\n sticky: 1020,\n fixed: 1030,\n modal: 1040,\n popover: 1050,\n tooltip: 1060,\n },\n};\n\n/**\n * Global CSS styles for the Convai widget\n * This should be injected once into the document head\n */\nexport const getGlobalStyles = (): string => `\n @keyframes convai-pulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n }\n\n @keyframes convai-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n\n @keyframes convai-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n }\n\n @keyframes convai-slide-up {\n from {\n transform: translateY(20px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n }\n\n @keyframes convai-slide-down {\n from {\n transform: translateY(-20px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n }\n\n @keyframes convai-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n @keyframes convai-scale-in {\n from {\n transform: scale(0.8);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n }\n\n .convai-widget * {\n box-sizing: border-box;\n }\n\n .convai-widget {\n font-family: var(--convai-font, ${aeroTheme.typography.fontFamily.primary});\n color: var(--convai-panel-fg, ${aeroTheme.colors.text.primary});\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n .convai-widget button {\n font-family: inherit;\n cursor: pointer;\n border: none;\n outline: none;\n background: none;\n padding: 0;\n margin: 0;\n }\n\n .convai-widget input {\n font-family: inherit;\n border: none;\n outline: none;\n background: none;\n }\n\n .convai-widget::-webkit-scrollbar {\n width: 6px;\n }\n\n .convai-widget::-webkit-scrollbar-track {\n background: rgba(0, 0, 0, 0.05);\n border-radius: 3px;\n }\n\n .convai-widget::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.2);\n border-radius: 3px;\n }\n\n .convai-widget::-webkit-scrollbar-thumb:hover {\n background: rgba(0, 0, 0, 0.3);\n }\n`;\n\n/**\n * A document (the default) or a shadow root the widget is mounted inside.\n * `@keyframes` and global styles must be injected per-target because\n * shadow trees do not resolve rules defined in the document head.\n */\nexport type StyleTarget = Document | ShadowRoot;\n\n/** Ids of the injected <style> nodes. Public in effect: hosts and a second\n * copy of the SDK on the same page both key off them. */\nconst WIDGET_STYLES_ID = 'convai-widget-styles';\nconst WIDGET_KEYFRAMES_ID = 'convai-widget-keyframes';\n\n/** Targets that already hold the widget stylesheet. Per-target, so multiple\n * widget instances and shadow roots each get their own copy. */\nconst styledTargets = new WeakSet<StyleTarget>();\n\n/** Targets that already hold the widget's `@keyframes`. */\nconst keyframedTargets = new WeakSet<StyleTarget>();\n\n/** Where a <style> node should be appended for a given target. */\nconst styleHost = (target: StyleTarget): ShadowRoot | HTMLHeadElement =>\n target instanceof ShadowRoot ? target : target.head;\n\n/**\n * True when `target` already holds a <style> with this id.\n *\n * The WeakSets above dedup within one module instance. This is the\n * cross-bundle guard: two copies of the SDK on one page (an app bundling it\n * and an embed script loading its own) each get their own WeakSet, so without\n * an existence check they would both append a <style> carrying the same id.\n * Inert, but the pre-refactor inline code checked for this and it should not\n * regress.\n */\nconst hasStyleNode = (target: StyleTarget, id: string): boolean =>\n styleHost(target).querySelector(`#${id}`) !== null;\n\nconst WIDGET_KEYFRAMES = `\n @keyframes popIn {\n from { opacity: 0; transform: scale(0.95) translateY(-10px); }\n to { opacity: 1; transform: scale(1) translateY(0); }\n }\n\n /* Link-preview skeleton: one sweep across the placeholder while the media\n * decodes. Lives here rather than in getGlobalStyles() because that string is\n * pinned byte-for-byte by the inline-style parity fixture, and this is an\n * addition no existing element uses. */\n @keyframes convai-preview-shimmer {\n from { background-position: 200% 0; }\n to { background-position: -200% 0; }\n }\n\n /* Connecting overlay: logo spin + label pulse. Values match the React\n * widget's framer-motion transitions (ConvaiWidget.tsx:681-737) exactly --\n * a full turn every 2s linear, and opacity 0.5 -> 1 -> 0.5 every 2s\n * ease-in-out. React does not honour prefers-reduced-motion; vanilla does,\n * via the media query below, since a full-turn infinite spin plus a\n * pulsing label is exactly what that setting exists for. */\n @keyframes convaiConnectingSpin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n @keyframes convaiConnectingPulse {\n 0%, 100% { opacity: 0.5; }\n 50% { opacity: 1; }\n }\n\n /* Voice mode's avatar: two counter-rotating liquid-gradient layers behind\n * the character image. Matches the React overlay's framer-motion values\n * (VoiceModeOverlay.tsx) — 20s clockwise for the conic layer, 15s\n * anticlockwise for the radial one, both linear and infinite — and the\n * gentle scale breathing it applies while the character is speaking. */\n @keyframes convaiVoiceSpin {\n from { transform: rotate(0deg); }\n to { transform: rotate(360deg); }\n }\n\n @keyframes convaiVoiceSpinReverse {\n from { transform: rotate(360deg); }\n to { transform: rotate(0deg); }\n }\n\n @keyframes convaiVoiceBreathe {\n 0%, 100% { transform: scale(1); }\n 50% { transform: scale(1.05); }\n }\n\n @media (prefers-reduced-motion: reduce) {\n .convai-connecting-spin {\n animation: none !important;\n }\n .convai-connecting-pulse {\n animation: none !important;\n }\n .convai-voice-gradient,\n .convai-voice-avatar {\n animation: none !important;\n }\n [data-convai-skeleton] {\n animation: none !important;\n }\n }\n`;\n\n/**\n * Inject the widget's global styles into a document or a shadow root.\n * Defaults to the document, so existing callers are unaffected.\n */\nexport const injectGlobalStyles = (target: StyleTarget = document): void => {\n if (styledTargets.has(target)) return;\n if (hasStyleNode(target, WIDGET_STYLES_ID)) {\n styledTargets.add(target);\n return;\n }\n\n const styleElement = document.createElement('style');\n styleElement.id = WIDGET_STYLES_ID;\n styleElement.textContent = getGlobalStyles();\n styleHost(target).appendChild(styleElement);\n\n styledTargets.add(target);\n};\n\n/**\n * Inject the widget's `@keyframes` (e.g. the settings tray's `popIn`)\n * into a document or a shadow root. `@keyframes` defined in the document\n * do not resolve for shadow content, so they must be injected into each\n * shadow root that uses them.\n */\nexport const injectKeyframes = (target: StyleTarget = document): void => {\n if (keyframedTargets.has(target)) return;\n if (hasStyleNode(target, WIDGET_KEYFRAMES_ID)) {\n keyframedTargets.add(target);\n return;\n }\n\n const style = document.createElement('style');\n style.id = WIDGET_KEYFRAMES_ID;\n style.textContent = WIDGET_KEYFRAMES;\n styleHost(target).appendChild(style);\n\n keyframedTargets.add(target);\n};\n\n/**\n * Helper to create inline styles object from theme\n */\nexport const createStyles = (styles: Record<string, any>): string => {\n return Object.entries(styles)\n .map(([key, value]) => {\n const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();\n return `${cssKey}: ${value}`;\n })\n .join('; ');\n};\n\n"]}
|
|
1
|
+
{"version":3,"file":"styles.js","sourceRoot":"","sources":["../../src/vanilla/styles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,MAAM,EAAE;QACN,OAAO,EAAE;YACP,EAAE,EAAE,SAAS;YACb,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAAG,EAAE,SAAS;YACd,GAA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,CAAC;AAChB,CAAC,CAAC","sourcesContent":["/**\n * Vanilla Styles - Port of React theme system for vanilla implementations\n */\n\n// Theme configuration (matching React version)\nexport const aeroTheme = {\n colors: {\n primary: {\n 50: \"#f0f9ff\",\n 100: \"#e0f2fe\",\n 200: \"#bae6fd\",\n 300: \"#7dd3fc\",\n 400: \"#38bdf8\",\n 500: \"#0ea5e9\",\n 600: \"#0284c7\",\n 700: \"#0369a1\",\n 800: \"#075985\",\n 900: \"#0c4a6e\",\n },\n convai: {\n light: \"#1EB453\",\n medium: \"#0b6049\",\n dark: \"#084c3a\",\n },\n neutral: {\n 50: \"#fafafa\",\n 100: \"#f5f5f5\",\n 200: \"#e5e5e5\",\n 300: \"#d4d4d4\",\n 400: \"#a3a3a3\",\n 500: \"#737373\",\n 600: \"#525252\",\n 700: \"#404040\",\n 800: \"#262626\",\n 900: \"#171717\",\n },\n glass: {\n light: \"rgba(255, 255, 255, 0.1)\",\n medium: \"rgba(255, 255, 255, 0.15)\",\n dark: \"rgba(0, 0, 0, 0.1)\",\n backdrop: \"rgba(255, 255, 255, 0.8)\",\n card: \"rgba(255, 255, 255, 0.9)\",\n backdropLight: \"blur(20px)\",\n borderLight: \"1px solid rgba(255, 255, 255, 0.2)\",\n },\n accent: {\n purple: \"#8b5cf6\",\n green: \"#10b981\",\n blue: \"#3b82f6\",\n orange: \"#f59e0b\",\n red: \"#ef4444\",\n },\n error: {\n 50: \"#fef2f2\",\n 100: \"#fee2e2\",\n 200: \"#fecaca\",\n 300: \"#fca5a5\",\n 400: \"#f87171\",\n 500: \"#ef4444\",\n 600: \"#dc2626\",\n 700: \"#b91c1c\",\n 800: \"#991b1b\",\n 900: \"#7f1d1d\",\n },\n text: {\n primary: \"#1f2937\",\n secondary: \"#6b7280\",\n tertiary: \"#9ca3af\",\n inverse: \"#ffffff\",\n },\n },\n typography: {\n fontFamily: {\n primary: '\"Noto Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n body: '-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif',\n mono: 'SF Mono, Monaco, \"Cascadia Code\", \"Roboto Mono\", Consolas, \"Courier New\", monospace',\n },\n fontSize: {\n xs: \"0.75rem\",\n sm: \"0.875rem\",\n base: \"1rem\",\n lg: \"1.125rem\",\n xl: \"1.25rem\",\n \"2xl\": \"1.5rem\",\n \"3xl\": \"1.875rem\",\n \"4xl\": \"2.25rem\",\n },\n fontWeight: {\n normal: 400,\n medium: 500,\n semibold: 600,\n bold: 700,\n },\n },\n spacing: {\n xs: \"0.25rem\",\n sm: \"0.5rem\",\n md: \"1rem\",\n lg: \"1.5rem\",\n xl: \"2rem\",\n \"2xl\": \"3rem\",\n \"3xl\": \"4rem\",\n },\n borderRadius: {\n none: \"0\",\n sm: \"0.25rem\",\n md: \"0.5rem\",\n lg: \"0.75rem\",\n xl: \"1rem\",\n \"2xl\": \"1.5rem\",\n full: \"9999px\",\n },\n shadows: {\n sm: \"0 1px 2px 0 rgba(0, 0, 0, 0.05)\",\n md: \"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)\",\n lg: \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\",\n xl: \"0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)\",\n glass: \"0 8px 32px rgba(0, 0, 0, 0.1)\",\n },\n glass: {\n backdrop: \"blur(20px)\",\n backdropLight: \"blur(10px)\",\n backdropHeavy: \"blur(40px)\",\n border: \"1px solid rgba(255, 255, 255, 0.2)\",\n borderLight: \"1px solid rgba(255, 255, 255, 0.1)\",\n },\n transitions: {\n fast: \"0.15s ease-in-out\",\n normal: \"0.2s ease-in-out\",\n slow: \"0.3s ease-in-out\",\n spring: \"0.4s cubic-bezier(0.4, 0, 0.2, 1)\",\n snappy: \"all 0.1s ease-out\",\n },\n zIndex: {\n base: 1,\n dropdown: 1000,\n sticky: 1020,\n fixed: 1030,\n modal: 1040,\n popover: 1050,\n tooltip: 1060,\n },\n};\n\n/**\n * Global CSS styles for the Convai widget\n * This should be injected once into the document head\n */\nexport const getGlobalStyles = (): string => `\n @keyframes convai-pulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n }\n\n @keyframes convai-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n }\n\n @keyframes convai-bounce {\n 0%, 100% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-10px);\n }\n }\n\n @keyframes convai-slide-up {\n from {\n transform: translateY(20px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n }\n\n @keyframes convai-slide-down {\n from {\n transform: translateY(-20px);\n opacity: 0;\n }\n to {\n transform: translateY(0);\n opacity: 1;\n }\n }\n\n @keyframes convai-fade-in {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n @keyframes convai-scale-in {\n from {\n transform: scale(0.8);\n opacity: 0;\n }\n to {\n transform: scale(1);\n opacity: 1;\n }\n }\n\n .convai-widget * {\n box-sizing: border-box;\n }\n\n .convai-widget {\n font-family: ${aeroTheme.typography.fontFamily.primary};\n color: ${aeroTheme.colors.text.primary};\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n }\n\n .convai-widget button {\n font-family: inherit;\n cursor: pointer;\n border: none;\n outline: none;\n background: none;\n padding: 0;\n margin: 0;\n }\n\n .convai-widget input {\n font-family: inherit;\n border: none;\n outline: none;\n background: none;\n }\n\n .convai-widget::-webkit-scrollbar {\n width: 6px;\n }\n\n .convai-widget::-webkit-scrollbar-track {\n background: rgba(0, 0, 0, 0.05);\n border-radius: 3px;\n }\n\n .convai-widget::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.2);\n border-radius: 3px;\n }\n\n .convai-widget::-webkit-scrollbar-thumb:hover {\n background: rgba(0, 0, 0, 0.3);\n }\n`;\n\n/**\n * Inject global styles into the document head\n */\nlet stylesInjected = false;\nexport const injectGlobalStyles = (): void => {\n if (stylesInjected) return;\n\n const styleElement = document.createElement('style');\n styleElement.id = 'convai-widget-styles';\n styleElement.textContent = getGlobalStyles();\n document.head.appendChild(styleElement);\n \n stylesInjected = true;\n};\n\n/**\n * Helper to create inline styles object from theme\n */\nexport const createStyles = (styles: Record<string, any>): string => {\n return Object.entries(styles)\n .map(([key, value]) => {\n const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase();\n return `${cssKey}: ${value}`;\n })\n .join('; ');\n};\n\n"]}
|
package/dist/vanilla/types.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { IConvaiClient, ChatMessage, PublishedChatConnectOptions } from '../core/types.js';
|
|
2
2
|
import type { PublishedChatDescriptor } from '../embed/publicationApi.js';
|
|
3
|
-
/** Where the widget anchors itself. `inline` renders it in normal document flow. */
|
|
4
|
-
export type WidgetPlacement = 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' | 'inline';
|
|
5
3
|
/**
|
|
6
4
|
* Options for creating a vanilla ConvaiWidget
|
|
7
5
|
*
|
|
@@ -18,14 +16,6 @@ export interface VanillaWidgetOptions {
|
|
|
18
16
|
convaiClient?: IConvaiClient & {
|
|
19
17
|
activity?: string;
|
|
20
18
|
chatMessages: ChatMessage[];
|
|
21
|
-
/**
|
|
22
|
-
* Present on the real `ConvaiClient` (it extends `EventEmitter`) and on
|
|
23
|
-
* the test stubs; absent only if a caller hand-rolls a minimal
|
|
24
|
-
* `IConvaiClient`. Optional so that case still type-checks -- the widget
|
|
25
|
-
* calls it defensively (`client.emit?.(...)`) to surface mic-permission
|
|
26
|
-
* failures on the same `error` channel `ConvaiClient` already uses.
|
|
27
|
-
*/
|
|
28
|
-
emit?: (event: string, ...args: any[]) => void;
|
|
29
19
|
};
|
|
30
20
|
/** Option 2: Pass connection config directly (convenience shortcut). Either apiKey or authToken is required. */
|
|
31
21
|
apiKey?: string;
|
|
@@ -74,21 +64,6 @@ export interface VanillaWidgetOptions {
|
|
|
74
64
|
publishedChatConnectOptions?: PublishedChatConnectOptions;
|
|
75
65
|
/** Public descriptor used to label a credential-free published session. */
|
|
76
66
|
publishedChatDescriptor?: Pick<PublishedChatDescriptor, 'display_name' | 'image_url'>;
|
|
77
|
-
/**
|
|
78
|
-
* Where the widget's `<style>` and `@keyframes` nodes are injected.
|
|
79
|
-
*
|
|
80
|
-
* Omit it and the target is derived from `container.getRootNode()` at
|
|
81
|
-
* construction time — correct only when the container is *already* inside
|
|
82
|
-
* its final root. A custom element that builds its subtree first and appends
|
|
83
|
-
* it to its shadow root afterwards (the usual pattern) constructs the widget
|
|
84
|
-
* while the container is still detached, so the derivation sees the
|
|
85
|
-
* document and the shadow root never receives the stylesheet or the `popIn`
|
|
86
|
-
* keyframes — silently, with no error. Pass the shadow root here in that
|
|
87
|
-
* case; when supplied it is used verbatim and no derivation happens.
|
|
88
|
-
*/
|
|
89
|
-
styleTarget?: Document | ShadowRoot;
|
|
90
|
-
/** Corner to anchor to, or `inline` for normal flow. Default `bottom-right`. */
|
|
91
|
-
placement?: WidgetPlacement;
|
|
92
67
|
/** Optional callbacks */
|
|
93
68
|
onConnect?: () => void;
|
|
94
69
|
onDisconnect?: () => void;
|
|
@@ -106,57 +81,8 @@ export interface VanillaWidget {
|
|
|
106
81
|
client: IConvaiClient & {
|
|
107
82
|
activity?: string;
|
|
108
83
|
chatMessages: ChatMessage[];
|
|
109
|
-
emit?: (event: string, ...args: any[]) => void;
|
|
110
84
|
};
|
|
111
85
|
/** Update widget state (for future extensions) */
|
|
112
86
|
update?: (options: Partial<VanillaWidgetOptions>) => void;
|
|
113
|
-
/**
|
|
114
|
-
* Open the panel. Drives the same internal open path as the launcher
|
|
115
|
-
* click (connect-on-first-open, then the morph to the panel). Idempotent:
|
|
116
|
-
* calling `open()` while already open — or while a first open is still
|
|
117
|
-
* waiting on `connect()` — is a no-op. It will not re-run the morph
|
|
118
|
-
* animation, and it will not start a second connect.
|
|
119
|
-
*/
|
|
120
|
-
open: () => void;
|
|
121
|
-
/**
|
|
122
|
-
* Close the panel. Drives the same internal path as the header's close
|
|
123
|
-
* button. Idempotent: calling `close()` while already closed is a no-op.
|
|
124
|
-
*
|
|
125
|
-
* Called while a first open is still connecting, it *cancels* that open:
|
|
126
|
-
* the connect completes (the client ends up connected) but the panel stays
|
|
127
|
-
* collapsed rather than popping open once the promise resolves.
|
|
128
|
-
*/
|
|
129
|
-
close: () => void;
|
|
130
|
-
/**
|
|
131
|
-
* Toggle the panel open or closed, per the current {@link isOpen} state.
|
|
132
|
-
* Mid-connect this closes — i.e. a second click cancels the open in flight,
|
|
133
|
-
* rather than queueing a second one.
|
|
134
|
-
*/
|
|
135
|
-
toggle: () => void;
|
|
136
|
-
/**
|
|
137
|
-
* Whether the panel is open, or is opening. This is *requested* state, and
|
|
138
|
-
* it updates synchronously: `widget.open(); widget.isOpen` is always `true`,
|
|
139
|
-
* including on a cold client where the panel is only committed once
|
|
140
|
-
* `connect()` resolves seconds later. Cancelling that open (via `close()`,
|
|
141
|
-
* `toggle()`, or a second launcher click) returns it to `false`
|
|
142
|
-
* immediately.
|
|
143
|
-
*
|
|
144
|
-
* The distinction matters only for the first open on a disconnected client;
|
|
145
|
-
* every other transition is synchronous, so rendered and requested state
|
|
146
|
-
* coincide. Consumers reconciling their own open/close events against this
|
|
147
|
-
* flag get the answer that matches the user's last instruction, not the
|
|
148
|
-
* animation frame.
|
|
149
|
-
*/
|
|
150
|
-
readonly isOpen: boolean;
|
|
151
|
-
/**
|
|
152
|
-
* Insert a message into the transcript locally, without sending it to the
|
|
153
|
-
* character. Use this for client-side lines — e.g. a greeting — that must
|
|
154
|
-
* appear in the chat but must never reach the LLM and must never be billed
|
|
155
|
-
* as a turn. This is not `sendUserTextMessage`: nothing is transmitted.
|
|
156
|
-
*/
|
|
157
|
-
appendMessage: (message: {
|
|
158
|
-
sender: "user" | "bot";
|
|
159
|
-
content: string;
|
|
160
|
-
}) => void;
|
|
161
87
|
}
|
|
162
88
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,WAAW,EAAE,CAAA;KAAE,CAAC;IAElF,gHAAgH;IAChH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mEAAmE;IACnE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kGAAkG;IAClG,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE;QACjB,qFAAqF;QACrF,MAAM,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;QACzB,+DAA+D;QAC/D,YAAY,CAAC,EAAE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["../../src/vanilla/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n IConvaiClient,\n ChatMessage,\n PublishedChatConnectOptions,\n} from '../core/types';\nimport type { PublishedChatDescriptor } from '../embed/publicationApi';\n\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/vanilla/types.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n IConvaiClient,\n ChatMessage,\n PublishedChatConnectOptions,\n} from '../core/types';\nimport type { PublishedChatDescriptor } from '../embed/publicationApi';\n\n/**\n * Options for creating a vanilla ConvaiWidget\n * \n * You can either:\n * 1. Pass an existing convaiClient instance, OR\n * 2. Pass connection config (apiKey, characterId, etc.) directly\n */\nexport interface VanillaWidgetOptions {\n /** \n * Option 1: Pass an existing Convai client instance.\n * Should be initialized with config: new ConvaiClient({ apiKey, characterId, ... })\n * The widget will auto-connect on first click.\n */\n convaiClient?: IConvaiClient & { activity?: string; chatMessages: ChatMessage[] };\n \n /** Option 2: Pass connection config directly (convenience shortcut). Either apiKey or authToken is required. */\n apiKey?: string;\n /** Auth token for realtime API (alternative to apiKey). See https://realtime-api.convai.com/docs */\n authToken?: string;\n characterId?: string;\n enableVideo?: boolean;\n startWithVideoOn?: boolean;\n /** Enable lipsync/facial animation blendshapes (default: false) */\n enableLipsync?: boolean;\n /** Enable emotion detection and bot-emotion updates (default: false) */\n enableEmotion?: boolean;\n /** Log incoming and outgoing decoded RTVI data messages to the browser console (default: true) */\n logRtviMessages?: boolean;\n /** Blendshape configuration for facial animation format */\n blendshapeConfig?: {\n /** Format of blendshapes: \"arkit\" or \"mha\" (Meta Human Animation, default: \"mha\") */\n format?: \"arkit\" | \"mha\";\n /** Custom mapper function to transform incoming blendshapes */\n customMapper?: (input: number[] | Float32Array) => Float32Array;\n /** Indexed NeuroSync ahead-delivery. Defaults to true; set false for the legacy paced path. */\n deliver_chunks_ahead?: boolean;\n /** Ahead-delivery timeline FPS override; ignored when deliver_chunks_ahead is false. */\n output_fps?: number;\n /** Seconds the server buffers blendshapes before releasing them. */\n frames_buffer_duration?: number;\n };\n \n /** \n * Show video toggle button in settings (default: true).\n * Only works if connection type is \"video\". If false, hides the video button.\n */\n showVideo?: boolean;\n /** \n * Show screen share toggle button in settings (default: true).\n * Only works if connection type is \"video\". If false, hides the screen share button.\n */\n showScreenShare?: boolean;\n /**\n * Start in voice mode by default when widget opens (default: true).\n * When true, the widget will open directly in voice mode with microphone enabled.\n */\n defaultVoiceMode?: boolean;\n /** Mint a fresh single-use grant when a published-chat session is reopened. */\n requestPublicationGrant?: () => Promise<string>;\n /** Core endpoint override used with requestPublicationGrant. */\n publishedChatConnectOptions?: PublishedChatConnectOptions;\n /** Public descriptor used to label a credential-free published session. */\n publishedChatDescriptor?: Pick<\n PublishedChatDescriptor,\n 'display_name' | 'image_url'\n >;\n \n /** Optional callbacks */\n onConnect?: () => void;\n onDisconnect?: () => void;\n onMessage?: (message: ChatMessage) => void;\n}\n\n/**\n * Vanilla ConvaiWidget instance with cleanup method\n */\nexport interface VanillaWidget {\n /** Root DOM element of the widget */\n element: HTMLElement;\n /** Cleanup and destroy the widget */\n destroy: () => void;\n /** The Convai client instance */\n client: IConvaiClient & { activity?: string; chatMessages: ChatMessage[] };\n /** Update widget state (for future extensions) */\n update?: (options: Partial<VanillaWidgetOptions>) => void;\n}\n"]}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.8.0
|
|
1
|
+
export declare const SDK_VERSION = "1.8.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,UAAU,CAAC"}
|
package/dist/version.js
CHANGED
package/dist/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,gDAAgD;AAChD,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC","sourcesContent":["// GENERATED by scripts/sync-version.mjs — do not edit by hand.\n// Regenerated from package.json on every build.\nexport const SDK_VERSION = \"1.8.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@convai/web-sdk",
|
|
3
|
-
"version": "1.8.0
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"description": "Build web apps with lifelike AI characters. The Convai Web SDK gives you real-time voice, lipsync, emotions, and dynamic context — with first-class support for React and vanilla TypeScript.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -9,52 +9,36 @@
|
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
12
|
"import": "./dist/index.js",
|
|
14
|
-
"
|
|
15
|
-
"default": "./dist/index.js"
|
|
13
|
+
"types": "./dist/index.d.ts"
|
|
16
14
|
},
|
|
17
15
|
"./core": {
|
|
18
|
-
"types": "./dist/core/index.d.ts",
|
|
19
16
|
"import": "./dist/core/index.js",
|
|
20
|
-
"
|
|
21
|
-
"default": "./dist/core/index.js"
|
|
17
|
+
"types": "./dist/core/index.d.ts"
|
|
22
18
|
},
|
|
23
19
|
"./vanilla": {
|
|
24
|
-
"types": "./dist/vanilla/index.d.ts",
|
|
25
20
|
"import": "./dist/vanilla/index.js",
|
|
26
|
-
"
|
|
27
|
-
"default": "./dist/vanilla/index.js"
|
|
21
|
+
"types": "./dist/vanilla/index.d.ts"
|
|
28
22
|
},
|
|
29
23
|
"./vanilla/websocket": {
|
|
30
|
-
"types": "./dist/vanilla/websocket.d.ts",
|
|
31
24
|
"import": "./dist/vanilla/websocket.js",
|
|
32
|
-
"
|
|
33
|
-
"default": "./dist/vanilla/websocket.js"
|
|
25
|
+
"types": "./dist/vanilla/websocket.d.ts"
|
|
34
26
|
},
|
|
35
27
|
"./embed": {
|
|
36
|
-
"types": "./dist/embed/index.d.ts",
|
|
37
28
|
"import": "./dist/embed/index.js",
|
|
38
|
-
"
|
|
39
|
-
"default": "./dist/embed/index.js"
|
|
29
|
+
"types": "./dist/embed/index.d.ts"
|
|
40
30
|
},
|
|
41
31
|
"./embed/browser": {
|
|
42
|
-
"types": "./dist/embed/browser.d.ts",
|
|
43
32
|
"import": "./dist/embed/chat-embed-v1.js",
|
|
44
|
-
"
|
|
45
|
-
"default": "./dist/embed/chat-embed-v1.js"
|
|
33
|
+
"types": "./dist/embed/browser.d.ts"
|
|
46
34
|
},
|
|
47
35
|
"./react": {
|
|
48
|
-
"types": "./dist/react/index.d.ts",
|
|
49
36
|
"import": "./dist/react/index.js",
|
|
50
|
-
"
|
|
51
|
-
"default": "./dist/react/index.js"
|
|
37
|
+
"types": "./dist/react/index.d.ts"
|
|
52
38
|
},
|
|
53
39
|
"./lipsync-helpers": {
|
|
54
|
-
"types": "./dist/lipsync-helpers/index.d.ts",
|
|
55
40
|
"import": "./dist/lipsync-helpers/index.js",
|
|
56
|
-
"
|
|
57
|
-
"default": "./dist/lipsync-helpers/index.js"
|
|
41
|
+
"types": "./dist/lipsync-helpers/index.d.ts"
|
|
58
42
|
},
|
|
59
43
|
"./package.json": "./package.json"
|
|
60
44
|
},
|
|
@@ -69,21 +53,18 @@
|
|
|
69
53
|
"access": "public"
|
|
70
54
|
},
|
|
71
55
|
"scripts": {
|
|
72
|
-
"build": "node scripts/sync-version.mjs && tsc
|
|
73
|
-
"build:fast": "node scripts/sync-version.mjs && tsc
|
|
74
|
-
"build:prod": "node scripts/sync-version.mjs && NODE_ENV=production tsc
|
|
56
|
+
"build": "node scripts/sync-version.mjs && tsc && node scripts/fix-dist-extensions.mjs && pnpm build:embed && pnpm typecheck:downstream",
|
|
57
|
+
"build:fast": "node scripts/sync-version.mjs && tsc && node scripts/fix-dist-extensions.mjs && pnpm build:embed",
|
|
58
|
+
"build:prod": "node scripts/sync-version.mjs && NODE_ENV=production tsc && node scripts/fix-dist-extensions.mjs && pnpm build:embed && pnpm typecheck:downstream",
|
|
75
59
|
"build:embed": "esbuild src/embed/browser.ts --bundle --format=esm --platform=browser --target=es2020 --outfile=dist/embed/chat-embed-v1.js --minify --sourcemap",
|
|
76
|
-
"dev": "tsc
|
|
60
|
+
"dev": "tsc --watch",
|
|
77
61
|
"clean": "rimraf dist",
|
|
78
62
|
"fix:ext": "node scripts/fix-dist-extensions.mjs",
|
|
79
63
|
"typecheck": "tsc --noEmit",
|
|
80
|
-
"test": "vitest run",
|
|
81
|
-
"test:protocol": "tsc && node --test tests/modelOutput.test.mjs
|
|
64
|
+
"test": "vitest run src",
|
|
65
|
+
"test:protocol": "tsc && node --test tests/modelOutput.test.mjs",
|
|
82
66
|
"typecheck:downstream": "pnpm -r --filter './examples/**' exec tsc -b --noEmit && pnpm -r --filter './doc-tests/**' exec tsc --noEmit",
|
|
83
67
|
"typecheck:all": "pnpm typecheck && pnpm typecheck:downstream",
|
|
84
|
-
"test:watch": "vitest",
|
|
85
|
-
"verify": "vitest run && tsc && tsc -p tsconfig.build.json && pnpm -r --filter './doc-tests/**' exec tsc --noEmit",
|
|
86
|
-
"test:lipsync": "tsc && node scripts/test-neurosync-ahead.mjs",
|
|
87
68
|
"prepublishOnly": "npm run clean && npm run build:prod",
|
|
88
69
|
"changeset": "changeset",
|
|
89
70
|
"version": "changeset version",
|
|
@@ -109,8 +90,7 @@
|
|
|
109
90
|
"verify:release": "node scripts/verify-release.mjs",
|
|
110
91
|
"check:docs": "node scripts/check-docs.mjs",
|
|
111
92
|
"check:contract": "node scripts/check-api-contract.mjs",
|
|
112
|
-
"check:packaging": "node scripts/check-packaging.mjs"
|
|
113
|
-
"check:hosts": "node scripts/check-hosts.mjs"
|
|
93
|
+
"check:packaging": "node scripts/check-packaging.mjs"
|
|
114
94
|
},
|
|
115
95
|
"keywords": [
|
|
116
96
|
"convai",
|
|
@@ -155,7 +135,6 @@
|
|
|
155
135
|
"@types/react-dom": "^18.3.5",
|
|
156
136
|
"@types/styled-components": "^5.1.34",
|
|
157
137
|
"esbuild": "^0.28.2",
|
|
158
|
-
"happy-dom": "^15.11.7",
|
|
159
138
|
"rimraf": "^5.0.0",
|
|
160
139
|
"typescript": "^5.7.3",
|
|
161
140
|
"vitest": "^3.2.4"
|
|
@@ -163,11 +142,5 @@
|
|
|
163
142
|
"files": [
|
|
164
143
|
"dist",
|
|
165
144
|
"README.md"
|
|
166
|
-
]
|
|
167
|
-
"pnpm": {
|
|
168
|
-
"onlyBuiltDependencies": [
|
|
169
|
-
"esbuild"
|
|
170
|
-
]
|
|
171
|
-
},
|
|
172
|
-
"packageManager": "pnpm@10.10.0"
|
|
145
|
+
]
|
|
173
146
|
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { ActiveCharacterChange, CharacterRosterChange, ConvaiCharacterInstance, ConvaiRoomSession, ServerResponseExtras, UpdateCharacterRosterOptions } from "./types.js";
|
|
2
|
-
export declare class CharacterRoster {
|
|
3
|
-
private _characters;
|
|
4
|
-
private _activeMembershipId;
|
|
5
|
-
private _roomSessionId;
|
|
6
|
-
private _roomName;
|
|
7
|
-
private _requestTraceId;
|
|
8
|
-
private _routeEpoch;
|
|
9
|
-
private _rosterEpoch;
|
|
10
|
-
private _partialDispatch;
|
|
11
|
-
/** Character instances in roster order. Empty in single-character mode. */
|
|
12
|
-
get characters(): ConvaiCharacterInstance[];
|
|
13
|
-
/** Membership currently receiving user turns, or null. */
|
|
14
|
-
get activeMembershipId(): string | null;
|
|
15
|
-
get roomSessionId(): string | null;
|
|
16
|
-
get routeEpoch(): number;
|
|
17
|
-
get rosterEpoch(): number;
|
|
18
|
-
/** True once a multi-character connect response has been applied. */
|
|
19
|
-
get isMultiCharacter(): boolean;
|
|
20
|
-
/** The server-owned snapshot, or null for a single-character session. */
|
|
21
|
-
get roomSession(): ConvaiRoomSession | null;
|
|
22
|
-
find(membershipId: string): ConvaiCharacterInstance | undefined;
|
|
23
|
-
/** Members that have sent their own `bot-ready`. */
|
|
24
|
-
get readyCharacters(): ConvaiCharacterInstance[];
|
|
25
|
-
/**
|
|
26
|
-
* Mark a member ready from its own `bot-ready`, filling in any detail the
|
|
27
|
-
* connect response did not yet have.
|
|
28
|
-
*
|
|
29
|
-
* Returns whether anything changed, so the caller only pushes state when it
|
|
30
|
-
* did. A single-character `bot-ready` also carries these fields, so nothing
|
|
31
|
-
* is tracked until a roster is actually seeded.
|
|
32
|
-
*/
|
|
33
|
-
applyBotReady(about: Record<string, unknown> | undefined): boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Apply a `character-status` transition. Readiness recorded here is
|
|
36
|
-
* bookkeeping for replacement selection; `bot-ready` remains what gates
|
|
37
|
-
* interaction.
|
|
38
|
-
*/
|
|
39
|
-
applyCharacterStatus(status: {
|
|
40
|
-
membershipId: string;
|
|
41
|
-
status: "starting" | "ready" | "failed";
|
|
42
|
-
failureCode: string | null;
|
|
43
|
-
}): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Pick a member to take over routing when the active one is removed.
|
|
46
|
-
*
|
|
47
|
-
* The runtime refuses a replacement that has not sent `bot-ready`
|
|
48
|
-
* (`replacement_target_unavailable`), so ready survivors come first. Falling
|
|
49
|
-
* back to any survivor at least produces a nameable rejection rather than
|
|
50
|
-
* `replacement_target_required`.
|
|
51
|
-
*/
|
|
52
|
-
pickReplacement(removing: string[]): string | undefined;
|
|
53
|
-
/** Payload that switches the active member. */
|
|
54
|
-
buildInteractionTarget(membershipId: string | null, commandId: string): Record<string, unknown>;
|
|
55
|
-
/** Payload that adds and removes members. */
|
|
56
|
-
buildRosterUpdate(options: UpdateCharacterRosterOptions, commandId: string): Record<string, unknown>;
|
|
57
|
-
/**
|
|
58
|
-
* Adopt the server's authoritative epochs and active member from any
|
|
59
|
-
* response, errors included.
|
|
60
|
-
*
|
|
61
|
-
* A `stale_route_epoch` rejection carries the real epoch, and adopting it is
|
|
62
|
-
* precisely what makes the single retry meaningful rather than a repeat of
|
|
63
|
-
* the same losing bet.
|
|
64
|
-
*/
|
|
65
|
-
adoptEpochs(extras: ServerResponseExtras | null | undefined): void;
|
|
66
|
-
/**
|
|
67
|
-
* Apply a successful `interaction-target` ack. Returns the change even when
|
|
68
|
-
* the target did not move, so a caller awaiting the promise always learns the
|
|
69
|
-
* authoritative state.
|
|
70
|
-
*/
|
|
71
|
-
applyInteractionTarget(extras: ServerResponseExtras | null | undefined): ActiveCharacterChange;
|
|
72
|
-
/** Apply a successful `character-roster-update` ack, mutating the roster. */
|
|
73
|
-
applyRosterUpdate(extras: ServerResponseExtras | null | undefined): CharacterRosterChange;
|
|
74
|
-
reset(): void;
|
|
75
|
-
/**
|
|
76
|
-
* Seed the roster from a `/connect` response, for either a create or a join.
|
|
77
|
-
*
|
|
78
|
-
* Returns false for a response with no `characters` array — that is an
|
|
79
|
-
* ordinary single-character session, and the roster stays empty so
|
|
80
|
-
* `isMultiCharacter` keeps distinguishing the two.
|
|
81
|
-
*/
|
|
82
|
-
applyConnectResponse(data: Record<string, unknown>): boolean;
|
|
83
|
-
}
|
|
84
|
-
//# sourceMappingURL=CharacterRoster.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CharacterRoster.d.ts","sourceRoot":"","sources":["../../src/core/CharacterRoster.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EAErB,qBAAqB,EACrB,uBAAuB,EAEvB,iBAAiB,EACjB,oBAAoB,EAC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