@elizaos/app-core 2.0.0-alpha.74 → 2.0.0-alpha.76
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/App.d.ts.map +1 -0
- package/{dist/App.js → App.js} +3 -3
- package/{dist/components → components}/AdvancedPageView.d.ts.map +1 -1
- package/{dist/components → components}/AdvancedPageView.js +0 -10
- package/{dist/components → components}/CharacterView.d.ts.map +1 -1
- package/components/CharacterView.js +685 -0
- package/{dist/components → components}/ChatComposer.d.ts.map +1 -1
- package/{dist/components → components}/ChatComposer.js +4 -4
- package/{dist/components → components}/ChatView.d.ts.map +1 -1
- package/{dist/components → components}/ChatView.js +15 -0
- package/{dist/components → components}/CompanionView.js +1 -1
- package/{dist/components → components}/ConfigPageView.js +1 -1
- package/{dist/components → components}/ElizaCloudDashboard.js +1 -1
- package/{dist/components → components}/FlaminaGuide.js +1 -1
- package/{dist/components → components}/OnboardingWizard.d.ts.map +1 -1
- package/{dist/components → components}/OnboardingWizard.js +3 -2
- package/{dist/components → components}/PluginsView.d.ts.map +1 -1
- package/{dist/components → components}/PluginsView.js +1 -5
- package/{dist/components → components}/avatar/VrmEngine.d.ts +13 -0
- package/{dist/components → components}/avatar/VrmEngine.d.ts.map +1 -1
- package/{dist/components → components}/avatar/VrmEngine.js +66 -0
- package/{dist/components → components}/avatar/VrmViewer.d.ts +15 -0
- package/{dist/components → components}/avatar/VrmViewer.d.ts.map +1 -1
- package/{dist/components → components}/avatar/VrmViewer.js +56 -1
- package/{src/components/index.ts → components/index.d.ts} +1 -1
- package/{dist/components → components}/index.d.ts.map +1 -1
- package/{dist/components → components}/index.js +0 -1
- package/{dist/components → components}/onboarding/ConnectionStep.d.ts.map +1 -1
- package/{dist/components → components}/onboarding/ConnectionStep.js +12 -7
- package/{dist/components → components}/permissions/StreamingPermissions.d.ts.map +1 -1
- package/{dist/components → components}/permissions/StreamingPermissions.js +1 -1
- package/{dist/components → components}/ui-switch.js +4 -4
- package/{dist/i18n → i18n}/locales/en.json +45 -1
- package/{src/i18n → i18n}/locales/es.json +41 -0
- package/{dist/i18n → i18n}/locales/ko.json +41 -0
- package/{dist/i18n → i18n}/locales/pt.json +41 -0
- package/{dist/i18n → i18n}/locales/zh-CN.json +41 -0
- package/package.json +143 -53
- package/{dist/state → state}/AppContext.d.ts.map +1 -1
- package/{dist/state → state}/AppContext.js +38 -16
- package/{dist/styles → styles}/anime.css +1 -4
- package/{dist/styles → styles}/onboarding-game.css +125 -9
- package/.turbo/turbo-build.log +0 -2
- package/.turbo/turbo-lint$colon$check.log +0 -2
- package/.turbo/turbo-typecheck.log +0 -1
- package/dist/App.d.ts.map +0 -1
- package/dist/components/CharacterView.js +0 -719
- package/dist/components/MiladyBar.d.ts +0 -2
- package/dist/components/MiladyBar.d.ts.map +0 -1
- package/dist/components/MiladyBar.js +0 -50
- package/dist/components/MiladyBarSettings.d.ts +0 -2
- package/dist/components/MiladyBarSettings.d.ts.map +0 -1
- package/dist/components/MiladyBarSettings.js +0 -513
- package/dist/components/SecurityPageView.d.ts +0 -2
- package/dist/components/SecurityPageView.d.ts.map +0 -1
- package/dist/components/SecurityPageView.js +0 -81
- package/dist/components/index.d.ts +0 -97
- package/dist/components/milady-bar/CloudCreditsChip.d.ts +0 -2
- package/dist/components/milady-bar/CloudCreditsChip.d.ts.map +0 -1
- package/dist/components/milady-bar/CloudCreditsChip.js +0 -25
- package/dist/components/milady-bar/ProviderDropdown.d.ts +0 -13
- package/dist/components/milady-bar/ProviderDropdown.d.ts.map +0 -1
- package/dist/components/milady-bar/ProviderDropdown.js +0 -68
- package/dist/components/milady-bar/WalletSummary.d.ts +0 -2
- package/dist/components/milady-bar/WalletSummary.d.ts.map +0 -1
- package/dist/components/milady-bar/WalletSummary.js +0 -37
- package/dist/components/milady-bar/index.d.ts +0 -4
- package/dist/components/milady-bar/index.d.ts.map +0 -1
- package/dist/components/milady-bar/index.js +0 -3
- package/dist/hooks/useMiladyBar.d.ts +0 -2
- package/dist/hooks/useMiladyBar.d.ts.map +0 -1
- package/dist/hooks/useMiladyBar.js +0 -472
- package/dist/i18n/locales/es.json +0 -1195
- package/dist/package.json +0 -180
- package/src/App.tsx +0 -504
- package/src/actions/character.test.ts +0 -139
- package/src/actions/character.ts +0 -334
- package/src/actions/chat-helpers.ts +0 -100
- package/src/actions/cloud.ts +0 -59
- package/src/actions/index.ts +0 -12
- package/src/actions/lifecycle.ts +0 -175
- package/src/actions/onboarding.ts +0 -38
- package/src/actions/triggers.ts +0 -190
- package/src/ambient.d.ts +0 -33
- package/src/api/client.ts +0 -5659
- package/src/api/index.ts +0 -1
- package/src/autonomy/index.ts +0 -477
- package/src/bridge/capacitor-bridge.ts +0 -295
- package/src/bridge/electrobun-rpc.ts +0 -78
- package/src/bridge/electrobun-runtime.ts +0 -28
- package/src/bridge/index.ts +0 -5
- package/src/bridge/native-plugins.ts +0 -138
- package/src/bridge/plugin-bridge.ts +0 -352
- package/src/bridge/storage-bridge.ts +0 -162
- package/src/chat/index.ts +0 -250
- package/src/coding/index.ts +0 -43
- package/src/components/AdvancedPageView.tsx +0 -382
- package/src/components/AgentActivityBox.tsx +0 -49
- package/src/components/ApiKeyConfig.tsx +0 -222
- package/src/components/AppsPageView.tsx +0 -52
- package/src/components/AppsView.tsx +0 -293
- package/src/components/AvatarLoader.tsx +0 -104
- package/src/components/AvatarSelector.tsx +0 -223
- package/src/components/BscTradePanel.tsx +0 -549
- package/src/components/BugReportModal.tsx +0 -499
- package/src/components/CharacterRoster.tsx +0 -143
- package/src/components/CharacterView.tsx +0 -1575
- package/src/components/ChatAvatar.test.ts +0 -97
- package/src/components/ChatAvatar.tsx +0 -147
- package/src/components/ChatComposer.tsx +0 -330
- package/src/components/ChatMessage.tsx +0 -448
- package/src/components/ChatModalView.test.tsx +0 -118
- package/src/components/ChatModalView.tsx +0 -125
- package/src/components/ChatView.tsx +0 -992
- package/src/components/CloudOnboarding.tsx +0 -81
- package/src/components/CloudSourceControls.tsx +0 -85
- package/src/components/CodingAgentSettingsSection.tsx +0 -537
- package/src/components/CommandPalette.tsx +0 -284
- package/src/components/CompanionSceneHost.tsx +0 -517
- package/src/components/CompanionShell.tsx +0 -31
- package/src/components/CompanionView.tsx +0 -110
- package/src/components/ConfigPageView.tsx +0 -763
- package/src/components/ConfigSaveFooter.tsx +0 -41
- package/src/components/ConfirmModal.tsx +0 -379
- package/src/components/ConnectionFailedBanner.tsx +0 -91
- package/src/components/ConnectorsPageView.tsx +0 -13
- package/src/components/ConversationsSidebar.tsx +0 -279
- package/src/components/CustomActionEditor.tsx +0 -1127
- package/src/components/CustomActionsPanel.tsx +0 -288
- package/src/components/CustomActionsView.tsx +0 -325
- package/src/components/DatabasePageView.tsx +0 -55
- package/src/components/DatabaseView.tsx +0 -814
- package/src/components/ElizaCloudDashboard.tsx +0 -1696
- package/src/components/EmotePicker.tsx +0 -529
- package/src/components/ErrorBoundary.tsx +0 -76
- package/src/components/FineTuningView.tsx +0 -1080
- package/src/components/FlaminaGuide.test.tsx +0 -61
- package/src/components/FlaminaGuide.tsx +0 -212
- package/src/components/GameView.tsx +0 -551
- package/src/components/GameViewOverlay.tsx +0 -133
- package/src/components/GlobalEmoteOverlay.tsx +0 -152
- package/src/components/Header.test.tsx +0 -413
- package/src/components/Header.tsx +0 -400
- package/src/components/HeartbeatsView.tsx +0 -1003
- package/src/components/InventoryView.tsx +0 -393
- package/src/components/KnowledgeView.tsx +0 -1128
- package/src/components/LanguageDropdown.tsx +0 -192
- package/src/components/LifoMonitorPanel.tsx +0 -196
- package/src/components/LifoSandboxView.tsx +0 -499
- package/src/components/LoadingScreen.tsx +0 -112
- package/src/components/LogsPageView.tsx +0 -17
- package/src/components/LogsView.tsx +0 -239
- package/src/components/MediaGalleryView.tsx +0 -431
- package/src/components/MediaSettingsSection.tsx +0 -893
- package/src/components/MessageContent.tsx +0 -815
- package/src/components/MiladyBar.tsx +0 -103
- package/src/components/MiladyBarSettings.tsx +0 -872
- package/src/components/OnboardingWizard.test.tsx +0 -104
- package/src/components/OnboardingWizard.tsx +0 -249
- package/src/components/PairingView.tsx +0 -109
- package/src/components/PermissionsSection.tsx +0 -1184
- package/src/components/PluginsPageView.tsx +0 -9
- package/src/components/PluginsView.tsx +0 -3129
- package/src/components/ProviderSwitcher.tsx +0 -903
- package/src/components/RestartBanner.tsx +0 -76
- package/src/components/RuntimeView.tsx +0 -460
- package/src/components/SaveCommandModal.tsx +0 -211
- package/src/components/SecretsView.tsx +0 -569
- package/src/components/SecurityPageView.tsx +0 -242
- package/src/components/SettingsView.tsx +0 -825
- package/src/components/ShellOverlays.tsx +0 -41
- package/src/components/ShortcutsOverlay.tsx +0 -155
- package/src/components/SkillsView.tsx +0 -1435
- package/src/components/StartupFailureView.tsx +0 -63
- package/src/components/StreamView.tsx +0 -481
- package/src/components/StripeEmbeddedCheckout.tsx +0 -155
- package/src/components/SubscriptionStatus.tsx +0 -640
- package/src/components/SystemWarningBanner.tsx +0 -71
- package/src/components/ThemeToggle.tsx +0 -103
- package/src/components/TrajectoriesView.tsx +0 -526
- package/src/components/TrajectoryDetailView.tsx +0 -426
- package/src/components/TriggersView.tsx +0 -1
- package/src/components/VectorBrowserView.tsx +0 -1633
- package/src/components/VoiceConfigView.tsx +0 -674
- package/src/components/VrmStage.test.ts +0 -176
- package/src/components/VrmStage.tsx +0 -309
- package/src/components/WhatsAppQrOverlay.tsx +0 -230
- package/src/components/__tests__/chainConfig.test.ts +0 -220
- package/src/components/apps/AppDetailPane.tsx +0 -242
- package/src/components/apps/AppsCatalogGrid.tsx +0 -137
- package/src/components/apps/extensions/registry.ts +0 -13
- package/src/components/apps/extensions/types.ts +0 -9
- package/src/components/apps/helpers.ts +0 -43
- package/src/components/avatar/VrmAnimationLoader.test.ts +0 -164
- package/src/components/avatar/VrmAnimationLoader.ts +0 -151
- package/src/components/avatar/VrmBlinkController.ts +0 -118
- package/src/components/avatar/VrmCameraManager.ts +0 -407
- package/src/components/avatar/VrmEngine.ts +0 -2767
- package/src/components/avatar/VrmFootShadow.ts +0 -96
- package/src/components/avatar/VrmViewer.tsx +0 -421
- package/src/components/avatar/__tests__/VrmCameraManager.test.ts +0 -168
- package/src/components/avatar/__tests__/VrmEngine.test.ts +0 -1574
- package/src/components/avatar/mixamoVRMRigMap.ts +0 -62
- package/src/components/avatar/retargetMixamoFbxToVrm.ts +0 -144
- package/src/components/avatar/retargetMixamoGltfToVrm.ts +0 -119
- package/src/components/chainConfig.ts +0 -400
- package/src/components/companion/CompanionHeader.tsx +0 -50
- package/src/components/companion/CompanionSceneHost.tsx +0 -5
- package/src/components/companion/VrmStage.tsx +0 -2
- package/src/components/companion/__tests__/walletUtils.test.ts +0 -742
- package/src/components/companion/index.ts +0 -18
- package/src/components/companion/walletUtils.ts +0 -290
- package/src/components/companion-shell-styles.test.ts +0 -142
- package/src/components/companion-shell-styles.ts +0 -270
- package/src/components/confirm-delete-control.tsx +0 -69
- package/src/components/conversations/ConversationListItem.tsx +0 -185
- package/src/components/conversations/conversation-utils.ts +0 -151
- package/src/components/format.ts +0 -131
- package/src/components/inventory/CopyableAddress.tsx +0 -41
- package/src/components/inventory/InventoryToolbar.tsx +0 -142
- package/src/components/inventory/NftGrid.tsx +0 -99
- package/src/components/inventory/TokenLogo.tsx +0 -71
- package/src/components/inventory/TokensTable.tsx +0 -216
- package/src/components/inventory/constants.ts +0 -170
- package/src/components/inventory/index.ts +0 -29
- package/src/components/inventory/media-url.test.ts +0 -38
- package/src/components/inventory/media-url.ts +0 -36
- package/src/components/inventory/useInventoryData.ts +0 -460
- package/src/components/knowledge-upload-image.ts +0 -215
- package/src/components/labels.ts +0 -46
- package/src/components/milady-bar/CloudCreditsChip.tsx +0 -61
- package/src/components/milady-bar/ProviderDropdown.tsx +0 -166
- package/src/components/milady-bar/WalletSummary.tsx +0 -61
- package/src/components/milady-bar/index.ts +0 -3
- package/src/components/onboarding/ActivateStep.tsx +0 -34
- package/src/components/onboarding/ConnectionStep.tsx +0 -1590
- package/src/components/onboarding/IdentityStep.tsx +0 -251
- package/src/components/onboarding/OnboardingPanel.tsx +0 -39
- package/src/components/onboarding/OnboardingStepNav.tsx +0 -41
- package/src/components/onboarding/PermissionsStep.tsx +0 -20
- package/src/components/onboarding/RpcStep.tsx +0 -402
- package/src/components/permissions/PermissionIcon.tsx +0 -25
- package/src/components/permissions/StreamingPermissions.tsx +0 -413
- package/src/components/plugins/showcase-data.ts +0 -481
- package/src/components/shared/ShellHeaderControls.tsx +0 -198
- package/src/components/shared-companion-scene-context.ts +0 -15
- package/src/components/skeletons.tsx +0 -88
- package/src/components/stream/ActivityFeed.tsx +0 -113
- package/src/components/stream/AvatarPip.tsx +0 -10
- package/src/components/stream/ChatContent.tsx +0 -126
- package/src/components/stream/ChatTicker.tsx +0 -55
- package/src/components/stream/IdleContent.tsx +0 -73
- package/src/components/stream/StatusBar.tsx +0 -463
- package/src/components/stream/StreamSettings.tsx +0 -506
- package/src/components/stream/StreamTerminal.tsx +0 -94
- package/src/components/stream/StreamVoiceConfig.tsx +0 -160
- package/src/components/stream/helpers.ts +0 -134
- package/src/components/stream/overlays/OverlayLayer.tsx +0 -75
- package/src/components/stream/overlays/built-in/ActionTickerWidget.tsx +0 -64
- package/src/components/stream/overlays/built-in/AlertPopupWidget.tsx +0 -87
- package/src/components/stream/overlays/built-in/BrandingWidget.tsx +0 -51
- package/src/components/stream/overlays/built-in/CustomHtmlWidget.tsx +0 -105
- package/src/components/stream/overlays/built-in/PeonGlassWidget.tsx +0 -265
- package/src/components/stream/overlays/built-in/PeonHudWidget.tsx +0 -247
- package/src/components/stream/overlays/built-in/PeonSakuraWidget.tsx +0 -278
- package/src/components/stream/overlays/built-in/ThoughtBubbleWidget.tsx +0 -77
- package/src/components/stream/overlays/built-in/ViewerCountWidget.tsx +0 -46
- package/src/components/stream/overlays/built-in/index.ts +0 -13
- package/src/components/stream/overlays/registry.ts +0 -22
- package/src/components/stream/overlays/types.ts +0 -90
- package/src/components/stream/overlays/useOverlayLayout.ts +0 -218
- package/src/components/trajectory-format.ts +0 -50
- package/src/components/ui-badges.tsx +0 -109
- package/src/components/ui-switch.tsx +0 -57
- package/src/components/vector-browser-three.ts +0 -29
- package/src/config/branding.ts +0 -67
- package/src/config/config-catalog.ts +0 -1092
- package/src/config/config-field.tsx +0 -1924
- package/src/config/config-renderer.tsx +0 -734
- package/src/config/index.ts +0 -12
- package/src/config/ui-renderer.tsx +0 -1751
- package/src/config/ui-spec.ts +0 -256
- package/src/events/index.ts +0 -96
- package/src/hooks/index.ts +0 -14
- package/src/hooks/useBugReport.tsx +0 -43
- package/src/hooks/useCanvasWindow.ts +0 -372
- package/src/hooks/useChatAvatarVoice.ts +0 -111
- package/src/hooks/useClickOutside.ts +0 -31
- package/src/hooks/useContextMenu.ts +0 -127
- package/src/hooks/useKeyboardShortcuts.ts +0 -86
- package/src/hooks/useLifoSync.ts +0 -143
- package/src/hooks/useMemoryMonitor.ts +0 -334
- package/src/hooks/useMiladyBar.ts +0 -594
- package/src/hooks/useRenderGuard.ts +0 -43
- package/src/hooks/useRetakeCapture.ts +0 -68
- package/src/hooks/useStreamPopoutNavigation.ts +0 -27
- package/src/hooks/useTimeout.ts +0 -37
- package/src/hooks/useVoiceChat.ts +0 -1442
- package/src/hooks/useWhatsAppPairing.ts +0 -123
- package/src/i18n/index.ts +0 -76
- package/src/i18n/locales/en.json +0 -1195
- package/src/i18n/locales/ko.json +0 -1195
- package/src/i18n/locales/pt.json +0 -1195
- package/src/i18n/locales/zh-CN.json +0 -1195
- package/src/i18n/messages.ts +0 -21
- package/src/index.ts +0 -6
- package/src/navigation/index.ts +0 -286
- package/src/navigation.test.ts +0 -189
- package/src/onboarding-config.test.ts +0 -104
- package/src/onboarding-config.ts +0 -122
- package/src/platform/browser-launch.test.ts +0 -94
- package/src/platform/browser-launch.ts +0 -149
- package/src/platform/index.ts +0 -58
- package/src/platform/init.ts +0 -238
- package/src/platform/lifo.ts +0 -225
- package/src/providers/index.ts +0 -108
- package/src/shell-params.test.ts +0 -48
- package/src/shell-params.ts +0 -36
- package/src/state/AppContext.tsx +0 -6415
- package/src/state/index.ts +0 -6
- package/src/state/internal.ts +0 -91
- package/src/state/onboarding-resume.test.ts +0 -135
- package/src/state/onboarding-resume.ts +0 -263
- package/src/state/parsers.test.ts +0 -124
- package/src/state/parsers.ts +0 -309
- package/src/state/persistence.ts +0 -379
- package/src/state/shell-routing.ts +0 -39
- package/src/state/types.ts +0 -724
- package/src/state/ui-preferences.ts +0 -3
- package/src/state/useApp.ts +0 -23
- package/src/state/vrm.ts +0 -108
- package/src/styles/anime.css +0 -6324
- package/src/styles/base.css +0 -213
- package/src/styles/onboarding-game.css +0 -976
- package/src/styles/styles.css +0 -2087
- package/src/styles/xterm.css +0 -241
- package/src/types/index.ts +0 -715
- package/src/types/react-test-renderer.d.ts +0 -45
- package/src/utils/asset-url.ts +0 -110
- package/src/utils/assistant-text.ts +0 -172
- package/src/utils/clipboard.ts +0 -41
- package/src/utils/desktop-dialogs.ts +0 -80
- package/src/utils/eliza-globals.ts +0 -44
- package/src/utils/index.ts +0 -7
- package/src/utils/number-parsing.ts +0 -125
- package/src/utils/openExternalUrl.ts +0 -20
- package/src/utils/spoken-text.ts +0 -65
- package/src/utils/streaming-text.ts +0 -120
- package/src/voice/index.ts +0 -1
- package/src/voice/types.ts +0 -197
- package/src/wallet-rpc.ts +0 -176
- package/test/app/AppContext.pty-sessions.test.tsx +0 -143
- package/test/app/MessageContent.test.tsx +0 -366
- package/test/app/PermissionsOnboarding.test.tsx +0 -358
- package/test/app/PermissionsSection.test.tsx +0 -575
- package/test/app/advanced-trajectory-fine-tuning.e2e.test.ts +0 -396
- package/test/app/agent-activity-box.test.tsx +0 -132
- package/test/app/agent-transfer-lock.test.ts +0 -279
- package/test/app/api-client-electrobun-fallback.test.ts +0 -139
- package/test/app/api-client-electron-fallback.test.ts +0 -139
- package/test/app/api-client-timeout.test.ts +0 -75
- package/test/app/api-client-ws.test.ts +0 -98
- package/test/app/api-client.ws-max-reconnect.test.ts +0 -139
- package/test/app/api-client.ws-reconnect.test.ts +0 -157
- package/test/app/app-context-autonomy-events.test.ts +0 -559
- package/test/app/apps-page-view.test.ts +0 -114
- package/test/app/apps-view.test.ts +0 -768
- package/test/app/autonomous-workflows.e2e.test.ts +0 -765
- package/test/app/autonomy-events.test.ts +0 -150
- package/test/app/avatar-selector.test.tsx +0 -52
- package/test/app/bsc-trade-panel.test.tsx +0 -134
- package/test/app/bug-report-modal.test.tsx +0 -353
- package/test/app/character-action-bar-visibility.test.ts +0 -70
- package/test/app/character-customization.e2e.test.ts +0 -1384
- package/test/app/character-save-journey.test.ts +0 -1245
- package/test/app/chat-advanced-features.e2e.test.ts +0 -706
- package/test/app/chat-composer.test.tsx +0 -181
- package/test/app/chat-journey.test.ts +0 -1075
- package/test/app/chat-language-header.test.ts +0 -64
- package/test/app/chat-message.test.tsx +0 -222
- package/test/app/chat-modal-view.test.tsx +0 -191
- package/test/app/chat-routine-filter.test.ts +0 -96
- package/test/app/chat-send-lock.test.ts +0 -1465
- package/test/app/chat-stream-api-client.test.tsx +0 -390
- package/test/app/chat-view-game-modal.test.tsx +0 -661
- package/test/app/chat-view.test.tsx +0 -877
- package/test/app/cloud-api.e2e.test.ts +0 -258
- package/test/app/cloud-login-flow.e2e.test.ts +0 -494
- package/test/app/cloud-login-lock.test.ts +0 -416
- package/test/app/command-palette.test.tsx +0 -184
- package/test/app/command-registry.test.ts +0 -75
- package/test/app/companion-greeting-wave.test.tsx +0 -431
- package/test/app/companion-scene-host.test.tsx +0 -85
- package/test/app/companion-stale-conversation.test.tsx +0 -447
- package/test/app/companion-view.test.tsx +0 -690
- package/test/app/confirm-delete-control.test.ts +0 -79
- package/test/app/confirm-modal.test.tsx +0 -219
- package/test/app/connection-mode-persistence.test.ts +0 -411
- package/test/app/connectors-ui.e2e.test.ts +0 -508
- package/test/app/conversations-sidebar-game-modal.test.tsx +0 -265
- package/test/app/conversations-sidebar.test.tsx +0 -185
- package/test/app/custom-actions-smoke.test.ts +0 -387
- package/test/app/custom-avatar-api-client.test.ts +0 -207
- package/test/app/desktop-utils.test.ts +0 -145
- package/test/app/electrobun-rpc-bridge.test.ts +0 -83
- package/test/app/events.test.ts +0 -88
- package/test/app/export-import-flows.e2e.test.ts +0 -700
- package/test/app/fine-tuning-view.test.ts +0 -471
- package/test/app/game-view-auth-session.test.tsx +0 -187
- package/test/app/game-view.test.ts +0 -444
- package/test/app/global-emote-overlay.test.tsx +0 -106
- package/test/app/header-status.test.tsx +0 -149
- package/test/app/i18n.test.ts +0 -152
- package/test/app/inventory-bsc-view.test.ts +0 -940
- package/test/app/knowledge-ui.e2e.test.ts +0 -762
- package/test/app/knowledge-upload-helpers.test.ts +0 -124
- package/test/app/lifecycle-lock.test.ts +0 -267
- package/test/app/lifo-popout-utils.test.ts +0 -208
- package/test/app/lifo-safe-endpoint.test.ts +0 -34
- package/test/app/loading-screen.test.tsx +0 -45
- package/test/app/memory-monitor.test.ts +0 -331
- package/test/app/milady-bar-regression.test.tsx +0 -519
- package/test/app/milady-bar-settings.test.tsx +0 -1056
- package/test/app/milady-bar.test.tsx +0 -583
- package/test/app/navigation.test.tsx +0 -22
- package/test/app/onboarding-e2e-journey.test.ts +0 -1391
- package/test/app/onboarding-finish-lock.test.ts +0 -676
- package/test/app/onboarding-language.test.tsx +0 -160
- package/test/app/onboarding-steps.test.tsx +0 -376
- package/test/app/open-external-url.test.ts +0 -65
- package/test/app/pages-navigation-smoke.e2e.test.ts +0 -646
- package/test/app/pairing-lock.test.ts +0 -260
- package/test/app/pairing-view.test.tsx +0 -74
- package/test/app/permissions-section.test.ts +0 -432
- package/test/app/plugin-bridge.test.ts +0 -109
- package/test/app/plugins-ui.e2e.test.ts +0 -605
- package/test/app/plugins-view-game-modal.test.tsx +0 -686
- package/test/app/plugins-view-toggle-restart.test.ts +0 -129
- package/test/app/provider-dropdown-default.test.tsx +0 -300
- package/test/app/restart-banner.test.tsx +0 -205
- package/test/app/retake-capture.test.ts +0 -84
- package/test/app/sandbox-api-client.test.ts +0 -108
- package/test/app/save-command-modal.test.tsx +0 -109
- package/test/app/secrets-view.test.tsx +0 -92
- package/test/app/settings-control-styles.test.tsx +0 -142
- package/test/app/settings-reset.e2e.test.ts +0 -726
- package/test/app/settings-sections.e2e.test.ts +0 -614
- package/test/app/shared-format.test.ts +0 -44
- package/test/app/shared-switch.test.ts +0 -69
- package/test/app/shell-mode-switching.e2e.test.ts +0 -841
- package/test/app/shell-mode-tab-memory.test.tsx +0 -58
- package/test/app/shell-overlays.test.tsx +0 -50
- package/test/app/shortcuts-overlay.test.tsx +0 -111
- package/test/app/sse-interruption.test.ts +0 -122
- package/test/app/startup-asset-missing.e2e.test.ts +0 -126
- package/test/app/startup-backend-missing.e2e.test.ts +0 -126
- package/test/app/startup-chat.e2e.test.ts +0 -323
- package/test/app/startup-conversation-restore.test.tsx +0 -381
- package/test/app/startup-failure-view.test.tsx +0 -103
- package/test/app/startup-onboarding.e2e.test.ts +0 -712
- package/test/app/startup-timeout.test.tsx +0 -80
- package/test/app/startup-token-401.e2e.test.ts +0 -103
- package/test/app/stream-helpers.test.ts +0 -46
- package/test/app/stream-popout-navigation.test.tsx +0 -41
- package/test/app/stream-status-bar.test.tsx +0 -89
- package/test/app/theme-toggle.test.tsx +0 -40
- package/test/app/training-api-client.test.ts +0 -128
- package/test/app/trajectories-view.test.tsx +0 -220
- package/test/app/triggers-api-client.test.ts +0 -77
- package/test/app/triggers-navigation.test.ts +0 -113
- package/test/app/triggers-view.e2e.test.ts +0 -675
- package/test/app/update-channel-lock.test.ts +0 -259
- package/test/app/vector-browser.async-cleanup.test.tsx +0 -367
- package/test/app/vector-browser.e2e.test.ts +0 -653
- package/test/app/vrm-stage.test.tsx +0 -351
- package/test/app/vrm-viewer.test.tsx +0 -298
- package/test/app/wallet-api-save-lock.test.ts +0 -299
- package/test/app/wallet-hooks.test.ts +0 -405
- package/test/app/wallet-ui-flows.e2e.test.ts +0 -556
- package/test/avatar/asset-url.test.ts +0 -90
- package/test/avatar/avatar-selector.test.ts +0 -173
- package/test/avatar/mixamo-vrm-rig-map.test.ts +0 -111
- package/test/avatar/voice-chat-streaming-text.test.ts +0 -96
- package/test/avatar/voice-chat.test.ts +0 -391
- package/test/browser-extension/README.md +0 -138
- package/test/browser-extension/test-harness.ts +0 -499
- package/test/capacitor-plugins.e2e.test.ts +0 -168
- package/test/test-types.ts +0 -5
- package/test/ui/command-palette-commands.test.ts +0 -57
- package/test/ui/ui-renderer.test.ts +0 -39
- package/test/utils/assistant-text.test.ts +0 -68
- package/test/utils/eliza-globals.test.ts +0 -59
- package/test/utils/package-exports.test.ts +0 -70
- package/test/utils/streaming-text.test.ts +0 -89
- package/tsconfig.build.json +0 -19
- package/tsconfig.json +0 -20
- package/tsconfig.typecheck.json +0 -12
- /package/{dist/App.d.ts → App.d.ts} +0 -0
- /package/{dist/actions → actions}/character.d.ts +0 -0
- /package/{dist/actions → actions}/character.d.ts.map +0 -0
- /package/{dist/actions → actions}/character.js +0 -0
- /package/{dist/actions → actions}/chat-helpers.d.ts +0 -0
- /package/{dist/actions → actions}/chat-helpers.d.ts.map +0 -0
- /package/{dist/actions → actions}/chat-helpers.js +0 -0
- /package/{dist/actions → actions}/cloud.d.ts +0 -0
- /package/{dist/actions → actions}/cloud.d.ts.map +0 -0
- /package/{dist/actions → actions}/cloud.js +0 -0
- /package/{dist/actions → actions}/index.d.ts +0 -0
- /package/{dist/actions → actions}/index.d.ts.map +0 -0
- /package/{dist/actions → actions}/index.js +0 -0
- /package/{dist/actions → actions}/lifecycle.d.ts +0 -0
- /package/{dist/actions → actions}/lifecycle.d.ts.map +0 -0
- /package/{dist/actions → actions}/lifecycle.js +0 -0
- /package/{dist/actions → actions}/onboarding.d.ts +0 -0
- /package/{dist/actions → actions}/onboarding.d.ts.map +0 -0
- /package/{dist/actions → actions}/onboarding.js +0 -0
- /package/{dist/actions → actions}/triggers.d.ts +0 -0
- /package/{dist/actions → actions}/triggers.d.ts.map +0 -0
- /package/{dist/actions → actions}/triggers.js +0 -0
- /package/{dist/api → api}/client.d.ts +0 -0
- /package/{dist/api → api}/client.d.ts.map +0 -0
- /package/{dist/api → api}/client.js +0 -0
- /package/{dist/api → api}/index.d.ts +0 -0
- /package/{dist/api → api}/index.d.ts.map +0 -0
- /package/{dist/api → api}/index.js +0 -0
- /package/{dist/autonomy → autonomy}/index.d.ts +0 -0
- /package/{dist/autonomy → autonomy}/index.d.ts.map +0 -0
- /package/{dist/autonomy → autonomy}/index.js +0 -0
- /package/{dist/bridge → bridge}/capacitor-bridge.d.ts +0 -0
- /package/{dist/bridge → bridge}/capacitor-bridge.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/capacitor-bridge.js +0 -0
- /package/{dist/bridge → bridge}/electrobun-rpc.d.ts +0 -0
- /package/{dist/bridge → bridge}/electrobun-rpc.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/electrobun-rpc.js +0 -0
- /package/{dist/bridge → bridge}/electrobun-runtime.d.ts +0 -0
- /package/{dist/bridge → bridge}/electrobun-runtime.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/electrobun-runtime.js +0 -0
- /package/{dist/bridge → bridge}/index.d.ts +0 -0
- /package/{dist/bridge → bridge}/index.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/index.js +0 -0
- /package/{dist/bridge → bridge}/native-plugins.d.ts +0 -0
- /package/{dist/bridge → bridge}/native-plugins.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/native-plugins.js +0 -0
- /package/{dist/bridge → bridge}/plugin-bridge.d.ts +0 -0
- /package/{dist/bridge → bridge}/plugin-bridge.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/plugin-bridge.js +0 -0
- /package/{dist/bridge → bridge}/storage-bridge.d.ts +0 -0
- /package/{dist/bridge → bridge}/storage-bridge.d.ts.map +0 -0
- /package/{dist/bridge → bridge}/storage-bridge.js +0 -0
- /package/{dist/chat → chat}/index.d.ts +0 -0
- /package/{dist/chat → chat}/index.d.ts.map +0 -0
- /package/{dist/chat → chat}/index.js +0 -0
- /package/{dist/coding → coding}/index.d.ts +0 -0
- /package/{dist/coding → coding}/index.d.ts.map +0 -0
- /package/{dist/coding → coding}/index.js +0 -0
- /package/{dist/components → components}/AdvancedPageView.d.ts +0 -0
- /package/{dist/components → components}/AgentActivityBox.d.ts +0 -0
- /package/{dist/components → components}/AgentActivityBox.d.ts.map +0 -0
- /package/{dist/components → components}/AgentActivityBox.js +0 -0
- /package/{dist/components → components}/ApiKeyConfig.d.ts +0 -0
- /package/{dist/components → components}/ApiKeyConfig.d.ts.map +0 -0
- /package/{dist/components → components}/ApiKeyConfig.js +0 -0
- /package/{dist/components → components}/AppsPageView.d.ts +0 -0
- /package/{dist/components → components}/AppsPageView.d.ts.map +0 -0
- /package/{dist/components → components}/AppsPageView.js +0 -0
- /package/{dist/components → components}/AppsView.d.ts +0 -0
- /package/{dist/components → components}/AppsView.d.ts.map +0 -0
- /package/{dist/components → components}/AppsView.js +0 -0
- /package/{dist/components → components}/AvatarLoader.d.ts +0 -0
- /package/{dist/components → components}/AvatarLoader.d.ts.map +0 -0
- /package/{dist/components → components}/AvatarLoader.js +0 -0
- /package/{dist/components → components}/AvatarSelector.d.ts +0 -0
- /package/{dist/components → components}/AvatarSelector.d.ts.map +0 -0
- /package/{dist/components → components}/AvatarSelector.js +0 -0
- /package/{dist/components → components}/BscTradePanel.d.ts +0 -0
- /package/{dist/components → components}/BscTradePanel.d.ts.map +0 -0
- /package/{dist/components → components}/BscTradePanel.js +0 -0
- /package/{dist/components → components}/BugReportModal.d.ts +0 -0
- /package/{dist/components → components}/BugReportModal.d.ts.map +0 -0
- /package/{dist/components → components}/BugReportModal.js +0 -0
- /package/{dist/components → components}/CharacterRoster.d.ts +0 -0
- /package/{dist/components → components}/CharacterRoster.d.ts.map +0 -0
- /package/{dist/components → components}/CharacterRoster.js +0 -0
- /package/{dist/components → components}/CharacterView.d.ts +0 -0
- /package/{dist/components → components}/ChatAvatar.d.ts +0 -0
- /package/{dist/components → components}/ChatAvatar.d.ts.map +0 -0
- /package/{dist/components → components}/ChatAvatar.js +0 -0
- /package/{dist/components → components}/ChatComposer.d.ts +0 -0
- /package/{dist/components → components}/ChatMessage.d.ts +0 -0
- /package/{dist/components → components}/ChatMessage.d.ts.map +0 -0
- /package/{dist/components → components}/ChatMessage.js +0 -0
- /package/{dist/components → components}/ChatModalView.d.ts +0 -0
- /package/{dist/components → components}/ChatModalView.d.ts.map +0 -0
- /package/{dist/components → components}/ChatModalView.js +0 -0
- /package/{dist/components → components}/ChatView.d.ts +0 -0
- /package/{dist/components → components}/CloudOnboarding.d.ts +0 -0
- /package/{dist/components → components}/CloudOnboarding.d.ts.map +0 -0
- /package/{dist/components → components}/CloudOnboarding.js +0 -0
- /package/{dist/components → components}/CloudSourceControls.d.ts +0 -0
- /package/{dist/components → components}/CloudSourceControls.d.ts.map +0 -0
- /package/{dist/components → components}/CloudSourceControls.js +0 -0
- /package/{dist/components → components}/CodingAgentSettingsSection.d.ts +0 -0
- /package/{dist/components → components}/CodingAgentSettingsSection.d.ts.map +0 -0
- /package/{dist/components → components}/CodingAgentSettingsSection.js +0 -0
- /package/{dist/components → components}/CommandPalette.d.ts +0 -0
- /package/{dist/components → components}/CommandPalette.d.ts.map +0 -0
- /package/{dist/components → components}/CommandPalette.js +0 -0
- /package/{dist/components → components}/CompanionSceneHost.d.ts +0 -0
- /package/{dist/components → components}/CompanionSceneHost.d.ts.map +0 -0
- /package/{dist/components → components}/CompanionSceneHost.js +0 -0
- /package/{dist/components → components}/CompanionShell.d.ts +0 -0
- /package/{dist/components → components}/CompanionShell.d.ts.map +0 -0
- /package/{dist/components → components}/CompanionShell.js +0 -0
- /package/{dist/components → components}/CompanionView.d.ts +0 -0
- /package/{dist/components → components}/CompanionView.d.ts.map +0 -0
- /package/{dist/components → components}/ConfigPageView.d.ts +0 -0
- /package/{dist/components → components}/ConfigPageView.d.ts.map +0 -0
- /package/{dist/components → components}/ConfigSaveFooter.d.ts +0 -0
- /package/{dist/components → components}/ConfigSaveFooter.d.ts.map +0 -0
- /package/{dist/components → components}/ConfigSaveFooter.js +0 -0
- /package/{dist/components → components}/ConfirmModal.d.ts +0 -0
- /package/{dist/components → components}/ConfirmModal.d.ts.map +0 -0
- /package/{dist/components → components}/ConfirmModal.js +0 -0
- /package/{dist/components → components}/ConnectionFailedBanner.d.ts +0 -0
- /package/{dist/components → components}/ConnectionFailedBanner.d.ts.map +0 -0
- /package/{dist/components → components}/ConnectionFailedBanner.js +0 -0
- /package/{dist/components → components}/ConnectorsPageView.d.ts +0 -0
- /package/{dist/components → components}/ConnectorsPageView.d.ts.map +0 -0
- /package/{dist/components → components}/ConnectorsPageView.js +0 -0
- /package/{dist/components → components}/ConversationsSidebar.d.ts +0 -0
- /package/{dist/components → components}/ConversationsSidebar.d.ts.map +0 -0
- /package/{dist/components → components}/ConversationsSidebar.js +0 -0
- /package/{dist/components → components}/CustomActionEditor.d.ts +0 -0
- /package/{dist/components → components}/CustomActionEditor.d.ts.map +0 -0
- /package/{dist/components → components}/CustomActionEditor.js +0 -0
- /package/{dist/components → components}/CustomActionsPanel.d.ts +0 -0
- /package/{dist/components → components}/CustomActionsPanel.d.ts.map +0 -0
- /package/{dist/components → components}/CustomActionsPanel.js +0 -0
- /package/{dist/components → components}/CustomActionsView.d.ts +0 -0
- /package/{dist/components → components}/CustomActionsView.d.ts.map +0 -0
- /package/{dist/components → components}/CustomActionsView.js +0 -0
- /package/{dist/components → components}/DatabasePageView.d.ts +0 -0
- /package/{dist/components → components}/DatabasePageView.d.ts.map +0 -0
- /package/{dist/components → components}/DatabasePageView.js +0 -0
- /package/{dist/components → components}/DatabaseView.d.ts +0 -0
- /package/{dist/components → components}/DatabaseView.d.ts.map +0 -0
- /package/{dist/components → components}/DatabaseView.js +0 -0
- /package/{dist/components → components}/ElizaCloudDashboard.d.ts +0 -0
- /package/{dist/components → components}/ElizaCloudDashboard.d.ts.map +0 -0
- /package/{dist/components → components}/EmotePicker.d.ts +0 -0
- /package/{dist/components → components}/EmotePicker.d.ts.map +0 -0
- /package/{dist/components → components}/EmotePicker.js +0 -0
- /package/{dist/components → components}/ErrorBoundary.d.ts +0 -0
- /package/{dist/components → components}/ErrorBoundary.d.ts.map +0 -0
- /package/{dist/components → components}/ErrorBoundary.js +0 -0
- /package/{dist/components → components}/FineTuningView.d.ts +0 -0
- /package/{dist/components → components}/FineTuningView.d.ts.map +0 -0
- /package/{dist/components → components}/FineTuningView.js +0 -0
- /package/{dist/components → components}/FlaminaGuide.d.ts +0 -0
- /package/{dist/components → components}/FlaminaGuide.d.ts.map +0 -0
- /package/{dist/components → components}/GameView.d.ts +0 -0
- /package/{dist/components → components}/GameView.d.ts.map +0 -0
- /package/{dist/components → components}/GameView.js +0 -0
- /package/{dist/components → components}/GameViewOverlay.d.ts +0 -0
- /package/{dist/components → components}/GameViewOverlay.d.ts.map +0 -0
- /package/{dist/components → components}/GameViewOverlay.js +0 -0
- /package/{dist/components → components}/GlobalEmoteOverlay.d.ts +0 -0
- /package/{dist/components → components}/GlobalEmoteOverlay.d.ts.map +0 -0
- /package/{dist/components → components}/GlobalEmoteOverlay.js +0 -0
- /package/{dist/components → components}/Header.d.ts +0 -0
- /package/{dist/components → components}/Header.d.ts.map +0 -0
- /package/{dist/components → components}/Header.js +0 -0
- /package/{dist/components → components}/HeartbeatsView.d.ts +0 -0
- /package/{dist/components → components}/HeartbeatsView.d.ts.map +0 -0
- /package/{dist/components → components}/HeartbeatsView.js +0 -0
- /package/{dist/components → components}/InventoryView.d.ts +0 -0
- /package/{dist/components → components}/InventoryView.d.ts.map +0 -0
- /package/{dist/components → components}/InventoryView.js +0 -0
- /package/{dist/components → components}/KnowledgeView.d.ts +0 -0
- /package/{dist/components → components}/KnowledgeView.d.ts.map +0 -0
- /package/{dist/components → components}/KnowledgeView.js +0 -0
- /package/{dist/components → components}/LanguageDropdown.d.ts +0 -0
- /package/{dist/components → components}/LanguageDropdown.d.ts.map +0 -0
- /package/{dist/components → components}/LanguageDropdown.js +0 -0
- /package/{dist/components → components}/LifoMonitorPanel.d.ts +0 -0
- /package/{dist/components → components}/LifoMonitorPanel.d.ts.map +0 -0
- /package/{dist/components → components}/LifoMonitorPanel.js +0 -0
- /package/{dist/components → components}/LifoSandboxView.d.ts +0 -0
- /package/{dist/components → components}/LifoSandboxView.d.ts.map +0 -0
- /package/{dist/components → components}/LifoSandboxView.js +0 -0
- /package/{dist/components → components}/LoadingScreen.d.ts +0 -0
- /package/{dist/components → components}/LoadingScreen.d.ts.map +0 -0
- /package/{dist/components → components}/LoadingScreen.js +0 -0
- /package/{dist/components → components}/LogsPageView.d.ts +0 -0
- /package/{dist/components → components}/LogsPageView.d.ts.map +0 -0
- /package/{dist/components → components}/LogsPageView.js +0 -0
- /package/{dist/components → components}/LogsView.d.ts +0 -0
- /package/{dist/components → components}/LogsView.d.ts.map +0 -0
- /package/{dist/components → components}/LogsView.js +0 -0
- /package/{dist/components → components}/MediaGalleryView.d.ts +0 -0
- /package/{dist/components → components}/MediaGalleryView.d.ts.map +0 -0
- /package/{dist/components → components}/MediaGalleryView.js +0 -0
- /package/{dist/components → components}/MediaSettingsSection.d.ts +0 -0
- /package/{dist/components → components}/MediaSettingsSection.d.ts.map +0 -0
- /package/{dist/components → components}/MediaSettingsSection.js +0 -0
- /package/{dist/components → components}/MessageContent.d.ts +0 -0
- /package/{dist/components → components}/MessageContent.d.ts.map +0 -0
- /package/{dist/components → components}/MessageContent.js +0 -0
- /package/{dist/components → components}/OnboardingWizard.d.ts +0 -0
- /package/{dist/components → components}/PairingView.d.ts +0 -0
- /package/{dist/components → components}/PairingView.d.ts.map +0 -0
- /package/{dist/components → components}/PairingView.js +0 -0
- /package/{dist/components → components}/PermissionsSection.d.ts +0 -0
- /package/{dist/components → components}/PermissionsSection.d.ts.map +0 -0
- /package/{dist/components → components}/PermissionsSection.js +0 -0
- /package/{dist/components → components}/PluginsPageView.d.ts +0 -0
- /package/{dist/components → components}/PluginsPageView.d.ts.map +0 -0
- /package/{dist/components → components}/PluginsPageView.js +0 -0
- /package/{dist/components → components}/PluginsView.d.ts +0 -0
- /package/{dist/components → components}/ProviderSwitcher.d.ts +0 -0
- /package/{dist/components → components}/ProviderSwitcher.d.ts.map +0 -0
- /package/{dist/components → components}/ProviderSwitcher.js +0 -0
- /package/{dist/components → components}/RestartBanner.d.ts +0 -0
- /package/{dist/components → components}/RestartBanner.d.ts.map +0 -0
- /package/{dist/components → components}/RestartBanner.js +0 -0
- /package/{dist/components → components}/RuntimeView.d.ts +0 -0
- /package/{dist/components → components}/RuntimeView.d.ts.map +0 -0
- /package/{dist/components → components}/RuntimeView.js +0 -0
- /package/{dist/components → components}/SaveCommandModal.d.ts +0 -0
- /package/{dist/components → components}/SaveCommandModal.d.ts.map +0 -0
- /package/{dist/components → components}/SaveCommandModal.js +0 -0
- /package/{dist/components → components}/SecretsView.d.ts +0 -0
- /package/{dist/components → components}/SecretsView.d.ts.map +0 -0
- /package/{dist/components → components}/SecretsView.js +0 -0
- /package/{dist/components → components}/SettingsView.d.ts +0 -0
- /package/{dist/components → components}/SettingsView.d.ts.map +0 -0
- /package/{dist/components → components}/SettingsView.js +0 -0
- /package/{dist/components → components}/ShellOverlays.d.ts +0 -0
- /package/{dist/components → components}/ShellOverlays.d.ts.map +0 -0
- /package/{dist/components → components}/ShellOverlays.js +0 -0
- /package/{dist/components → components}/ShortcutsOverlay.d.ts +0 -0
- /package/{dist/components → components}/ShortcutsOverlay.d.ts.map +0 -0
- /package/{dist/components → components}/ShortcutsOverlay.js +0 -0
- /package/{dist/components → components}/SkillsView.d.ts +0 -0
- /package/{dist/components → components}/SkillsView.d.ts.map +0 -0
- /package/{dist/components → components}/SkillsView.js +0 -0
- /package/{dist/components → components}/StartupFailureView.d.ts +0 -0
- /package/{dist/components → components}/StartupFailureView.d.ts.map +0 -0
- /package/{dist/components → components}/StartupFailureView.js +0 -0
- /package/{dist/components → components}/StreamView.d.ts +0 -0
- /package/{dist/components → components}/StreamView.d.ts.map +0 -0
- /package/{dist/components → components}/StreamView.js +0 -0
- /package/{dist/components → components}/StripeEmbeddedCheckout.d.ts +0 -0
- /package/{dist/components → components}/StripeEmbeddedCheckout.d.ts.map +0 -0
- /package/{dist/components → components}/StripeEmbeddedCheckout.js +0 -0
- /package/{dist/components → components}/SubscriptionStatus.d.ts +0 -0
- /package/{dist/components → components}/SubscriptionStatus.d.ts.map +0 -0
- /package/{dist/components → components}/SubscriptionStatus.js +0 -0
- /package/{dist/components → components}/SystemWarningBanner.d.ts +0 -0
- /package/{dist/components → components}/SystemWarningBanner.d.ts.map +0 -0
- /package/{dist/components → components}/SystemWarningBanner.js +0 -0
- /package/{dist/components → components}/ThemeToggle.d.ts +0 -0
- /package/{dist/components → components}/ThemeToggle.d.ts.map +0 -0
- /package/{dist/components → components}/ThemeToggle.js +0 -0
- /package/{dist/components → components}/TrajectoriesView.d.ts +0 -0
- /package/{dist/components → components}/TrajectoriesView.d.ts.map +0 -0
- /package/{dist/components → components}/TrajectoriesView.js +0 -0
- /package/{dist/components → components}/TrajectoryDetailView.d.ts +0 -0
- /package/{dist/components → components}/TrajectoryDetailView.d.ts.map +0 -0
- /package/{dist/components → components}/TrajectoryDetailView.js +0 -0
- /package/{dist/components → components}/TriggersView.d.ts +0 -0
- /package/{dist/components → components}/TriggersView.d.ts.map +0 -0
- /package/{dist/components → components}/TriggersView.js +0 -0
- /package/{dist/components → components}/VectorBrowserView.d.ts +0 -0
- /package/{dist/components → components}/VectorBrowserView.d.ts.map +0 -0
- /package/{dist/components → components}/VectorBrowserView.js +0 -0
- /package/{dist/components → components}/VoiceConfigView.d.ts +0 -0
- /package/{dist/components → components}/VoiceConfigView.d.ts.map +0 -0
- /package/{dist/components → components}/VoiceConfigView.js +0 -0
- /package/{dist/components → components}/VrmStage.d.ts +0 -0
- /package/{dist/components → components}/VrmStage.d.ts.map +0 -0
- /package/{dist/components → components}/VrmStage.js +0 -0
- /package/{dist/components → components}/WhatsAppQrOverlay.d.ts +0 -0
- /package/{dist/components → components}/WhatsAppQrOverlay.d.ts.map +0 -0
- /package/{dist/components → components}/WhatsAppQrOverlay.js +0 -0
- /package/{dist/components → components}/apps/AppDetailPane.d.ts +0 -0
- /package/{dist/components → components}/apps/AppDetailPane.d.ts.map +0 -0
- /package/{dist/components → components}/apps/AppDetailPane.js +0 -0
- /package/{dist/components → components}/apps/AppsCatalogGrid.d.ts +0 -0
- /package/{dist/components → components}/apps/AppsCatalogGrid.d.ts.map +0 -0
- /package/{dist/components → components}/apps/AppsCatalogGrid.js +0 -0
- /package/{dist/components → components}/apps/extensions/registry.d.ts +0 -0
- /package/{dist/components → components}/apps/extensions/registry.d.ts.map +0 -0
- /package/{dist/components → components}/apps/extensions/registry.js +0 -0
- /package/{dist/components → components}/apps/extensions/types.d.ts +0 -0
- /package/{dist/components → components}/apps/extensions/types.d.ts.map +0 -0
- /package/{dist/components → components}/apps/extensions/types.js +0 -0
- /package/{dist/components → components}/apps/helpers.d.ts +0 -0
- /package/{dist/components → components}/apps/helpers.d.ts.map +0 -0
- /package/{dist/components → components}/apps/helpers.js +0 -0
- /package/{dist/components → components}/avatar/VrmAnimationLoader.d.ts +0 -0
- /package/{dist/components → components}/avatar/VrmAnimationLoader.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/VrmAnimationLoader.js +0 -0
- /package/{dist/components → components}/avatar/VrmBlinkController.d.ts +0 -0
- /package/{dist/components → components}/avatar/VrmBlinkController.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/VrmBlinkController.js +0 -0
- /package/{dist/components → components}/avatar/VrmCameraManager.d.ts +0 -0
- /package/{dist/components → components}/avatar/VrmCameraManager.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/VrmCameraManager.js +0 -0
- /package/{dist/components → components}/avatar/VrmFootShadow.d.ts +0 -0
- /package/{dist/components → components}/avatar/VrmFootShadow.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/VrmFootShadow.js +0 -0
- /package/{dist/components → components}/avatar/mixamoVRMRigMap.d.ts +0 -0
- /package/{dist/components → components}/avatar/mixamoVRMRigMap.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/mixamoVRMRigMap.js +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.d.ts +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoFbxToVrm.js +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.d.ts +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.d.ts.map +0 -0
- /package/{dist/components → components}/avatar/retargetMixamoGltfToVrm.js +0 -0
- /package/{dist/components → components}/chainConfig.d.ts +0 -0
- /package/{dist/components → components}/chainConfig.d.ts.map +0 -0
- /package/{dist/components → components}/chainConfig.js +0 -0
- /package/{dist/components → components}/companion/CompanionHeader.d.ts +0 -0
- /package/{dist/components → components}/companion/CompanionHeader.d.ts.map +0 -0
- /package/{dist/components → components}/companion/CompanionHeader.js +0 -0
- /package/{dist/components → components}/companion/CompanionSceneHost.d.ts +0 -0
- /package/{dist/components → components}/companion/CompanionSceneHost.d.ts.map +0 -0
- /package/{dist/components → components}/companion/CompanionSceneHost.js +0 -0
- /package/{dist/components → components}/companion/VrmStage.d.ts +0 -0
- /package/{dist/components → components}/companion/VrmStage.d.ts.map +0 -0
- /package/{dist/components → components}/companion/VrmStage.js +0 -0
- /package/{dist/components → components}/companion/index.d.ts +0 -0
- /package/{dist/components → components}/companion/index.d.ts.map +0 -0
- /package/{dist/components → components}/companion/index.js +0 -0
- /package/{dist/components → components}/companion/walletUtils.d.ts +0 -0
- /package/{dist/components → components}/companion/walletUtils.d.ts.map +0 -0
- /package/{dist/components → components}/companion/walletUtils.js +0 -0
- /package/{dist/components → components}/companion-shell-styles.d.ts +0 -0
- /package/{dist/components → components}/companion-shell-styles.d.ts.map +0 -0
- /package/{dist/components → components}/companion-shell-styles.js +0 -0
- /package/{dist/components → components}/confirm-delete-control.d.ts +0 -0
- /package/{dist/components → components}/confirm-delete-control.d.ts.map +0 -0
- /package/{dist/components → components}/confirm-delete-control.js +0 -0
- /package/{dist/components → components}/conversations/ConversationListItem.d.ts +0 -0
- /package/{dist/components → components}/conversations/ConversationListItem.d.ts.map +0 -0
- /package/{dist/components → components}/conversations/ConversationListItem.js +0 -0
- /package/{dist/components → components}/conversations/conversation-utils.d.ts +0 -0
- /package/{dist/components → components}/conversations/conversation-utils.d.ts.map +0 -0
- /package/{dist/components → components}/conversations/conversation-utils.js +0 -0
- /package/{dist/components → components}/format.d.ts +0 -0
- /package/{dist/components → components}/format.d.ts.map +0 -0
- /package/{dist/components → components}/format.js +0 -0
- /package/{dist/components → components}/inventory/CopyableAddress.d.ts +0 -0
- /package/{dist/components → components}/inventory/CopyableAddress.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/CopyableAddress.js +0 -0
- /package/{dist/components → components}/inventory/InventoryToolbar.d.ts +0 -0
- /package/{dist/components → components}/inventory/InventoryToolbar.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/InventoryToolbar.js +0 -0
- /package/{dist/components → components}/inventory/NftGrid.d.ts +0 -0
- /package/{dist/components → components}/inventory/NftGrid.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/NftGrid.js +0 -0
- /package/{dist/components → components}/inventory/TokenLogo.d.ts +0 -0
- /package/{dist/components → components}/inventory/TokenLogo.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/TokenLogo.js +0 -0
- /package/{dist/components → components}/inventory/TokensTable.d.ts +0 -0
- /package/{dist/components → components}/inventory/TokensTable.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/TokensTable.js +0 -0
- /package/{dist/components → components}/inventory/constants.d.ts +0 -0
- /package/{dist/components → components}/inventory/constants.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/constants.js +0 -0
- /package/{dist/components → components}/inventory/index.d.ts +0 -0
- /package/{dist/components → components}/inventory/index.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/index.js +0 -0
- /package/{dist/components → components}/inventory/media-url.d.ts +0 -0
- /package/{dist/components → components}/inventory/media-url.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/media-url.js +0 -0
- /package/{dist/components → components}/inventory/useInventoryData.d.ts +0 -0
- /package/{dist/components → components}/inventory/useInventoryData.d.ts.map +0 -0
- /package/{dist/components → components}/inventory/useInventoryData.js +0 -0
- /package/{dist/components → components}/knowledge-upload-image.d.ts +0 -0
- /package/{dist/components → components}/knowledge-upload-image.d.ts.map +0 -0
- /package/{dist/components → components}/knowledge-upload-image.js +0 -0
- /package/{dist/components → components}/labels.d.ts +0 -0
- /package/{dist/components → components}/labels.d.ts.map +0 -0
- /package/{dist/components → components}/labels.js +0 -0
- /package/{dist/components → components}/onboarding/ActivateStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/ActivateStep.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/ActivateStep.js +0 -0
- /package/{dist/components → components}/onboarding/ConnectionStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/IdentityStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/IdentityStep.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/IdentityStep.js +0 -0
- /package/{dist/components → components}/onboarding/OnboardingPanel.d.ts +0 -0
- /package/{dist/components → components}/onboarding/OnboardingPanel.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/OnboardingPanel.js +0 -0
- /package/{dist/components → components}/onboarding/OnboardingStepNav.d.ts +0 -0
- /package/{dist/components → components}/onboarding/OnboardingStepNav.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/OnboardingStepNav.js +0 -0
- /package/{dist/components → components}/onboarding/PermissionsStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/PermissionsStep.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/PermissionsStep.js +0 -0
- /package/{dist/components → components}/onboarding/RpcStep.d.ts +0 -0
- /package/{dist/components → components}/onboarding/RpcStep.d.ts.map +0 -0
- /package/{dist/components → components}/onboarding/RpcStep.js +0 -0
- /package/{dist/components → components}/permissions/PermissionIcon.d.ts +0 -0
- /package/{dist/components → components}/permissions/PermissionIcon.d.ts.map +0 -0
- /package/{dist/components → components}/permissions/PermissionIcon.js +0 -0
- /package/{dist/components → components}/permissions/StreamingPermissions.d.ts +0 -0
- /package/{dist/components → components}/plugins/showcase-data.d.ts +0 -0
- /package/{dist/components → components}/plugins/showcase-data.d.ts.map +0 -0
- /package/{dist/components → components}/plugins/showcase-data.js +0 -0
- /package/{dist/components → components}/shared/ShellHeaderControls.d.ts +0 -0
- /package/{dist/components → components}/shared/ShellHeaderControls.d.ts.map +0 -0
- /package/{dist/components → components}/shared/ShellHeaderControls.js +0 -0
- /package/{dist/components → components}/shared-companion-scene-context.d.ts +0 -0
- /package/{dist/components → components}/shared-companion-scene-context.d.ts.map +0 -0
- /package/{dist/components → components}/shared-companion-scene-context.js +0 -0
- /package/{dist/components → components}/skeletons.d.ts +0 -0
- /package/{dist/components → components}/skeletons.d.ts.map +0 -0
- /package/{dist/components → components}/skeletons.js +0 -0
- /package/{dist/components → components}/stream/ActivityFeed.d.ts +0 -0
- /package/{dist/components → components}/stream/ActivityFeed.d.ts.map +0 -0
- /package/{dist/components → components}/stream/ActivityFeed.js +0 -0
- /package/{dist/components → components}/stream/AvatarPip.d.ts +0 -0
- /package/{dist/components → components}/stream/AvatarPip.d.ts.map +0 -0
- /package/{dist/components → components}/stream/AvatarPip.js +0 -0
- /package/{dist/components → components}/stream/ChatContent.d.ts +0 -0
- /package/{dist/components → components}/stream/ChatContent.d.ts.map +0 -0
- /package/{dist/components → components}/stream/ChatContent.js +0 -0
- /package/{dist/components → components}/stream/ChatTicker.d.ts +0 -0
- /package/{dist/components → components}/stream/ChatTicker.d.ts.map +0 -0
- /package/{dist/components → components}/stream/ChatTicker.js +0 -0
- /package/{dist/components → components}/stream/IdleContent.d.ts +0 -0
- /package/{dist/components → components}/stream/IdleContent.d.ts.map +0 -0
- /package/{dist/components → components}/stream/IdleContent.js +0 -0
- /package/{dist/components → components}/stream/StatusBar.d.ts +0 -0
- /package/{dist/components → components}/stream/StatusBar.d.ts.map +0 -0
- /package/{dist/components → components}/stream/StatusBar.js +0 -0
- /package/{dist/components → components}/stream/StreamSettings.d.ts +0 -0
- /package/{dist/components → components}/stream/StreamSettings.d.ts.map +0 -0
- /package/{dist/components → components}/stream/StreamSettings.js +0 -0
- /package/{dist/components → components}/stream/StreamTerminal.d.ts +0 -0
- /package/{dist/components → components}/stream/StreamTerminal.d.ts.map +0 -0
- /package/{dist/components → components}/stream/StreamTerminal.js +0 -0
- /package/{dist/components → components}/stream/StreamVoiceConfig.d.ts +0 -0
- /package/{dist/components → components}/stream/StreamVoiceConfig.d.ts.map +0 -0
- /package/{dist/components → components}/stream/StreamVoiceConfig.js +0 -0
- /package/{dist/components → components}/stream/helpers.d.ts +0 -0
- /package/{dist/components → components}/stream/helpers.d.ts.map +0 -0
- /package/{dist/components → components}/stream/helpers.js +0 -0
- /package/{dist/components → components}/stream/overlays/OverlayLayer.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/OverlayLayer.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/OverlayLayer.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ActionTickerWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/AlertPopupWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/BrandingWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/CustomHtmlWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonGlassWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonHudWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/PeonSakuraWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ThoughtBubbleWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/ViewerCountWidget.js +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/index.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/index.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/built-in/index.js +0 -0
- /package/{dist/components → components}/stream/overlays/registry.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/registry.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/registry.js +0 -0
- /package/{dist/components → components}/stream/overlays/types.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/types.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/types.js +0 -0
- /package/{dist/components → components}/stream/overlays/useOverlayLayout.d.ts +0 -0
- /package/{dist/components → components}/stream/overlays/useOverlayLayout.d.ts.map +0 -0
- /package/{dist/components → components}/stream/overlays/useOverlayLayout.js +0 -0
- /package/{dist/components → components}/trajectory-format.d.ts +0 -0
- /package/{dist/components → components}/trajectory-format.d.ts.map +0 -0
- /package/{dist/components → components}/trajectory-format.js +0 -0
- /package/{dist/components → components}/ui-badges.d.ts +0 -0
- /package/{dist/components → components}/ui-badges.d.ts.map +0 -0
- /package/{dist/components → components}/ui-badges.js +0 -0
- /package/{dist/components → components}/ui-switch.d.ts +0 -0
- /package/{dist/components → components}/ui-switch.d.ts.map +0 -0
- /package/{dist/components → components}/vector-browser-three.d.ts +0 -0
- /package/{dist/components → components}/vector-browser-three.d.ts.map +0 -0
- /package/{dist/components → components}/vector-browser-three.js +0 -0
- /package/{dist/config → config}/branding.d.ts +0 -0
- /package/{dist/config → config}/branding.d.ts.map +0 -0
- /package/{dist/config → config}/branding.js +0 -0
- /package/{dist/config → config}/config-catalog.d.ts +0 -0
- /package/{dist/config → config}/config-catalog.d.ts.map +0 -0
- /package/{dist/config → config}/config-catalog.js +0 -0
- /package/{dist/config → config}/config-field.d.ts +0 -0
- /package/{dist/config → config}/config-field.d.ts.map +0 -0
- /package/{dist/config → config}/config-field.js +0 -0
- /package/{dist/config → config}/config-renderer.d.ts +0 -0
- /package/{dist/config → config}/config-renderer.d.ts.map +0 -0
- /package/{dist/config → config}/config-renderer.js +0 -0
- /package/{dist/config → config}/index.d.ts +0 -0
- /package/{dist/config → config}/index.d.ts.map +0 -0
- /package/{dist/config → config}/index.js +0 -0
- /package/{dist/config → config}/ui-renderer.d.ts +0 -0
- /package/{dist/config → config}/ui-renderer.d.ts.map +0 -0
- /package/{dist/config → config}/ui-renderer.js +0 -0
- /package/{dist/config → config}/ui-spec.d.ts +0 -0
- /package/{dist/config → config}/ui-spec.d.ts.map +0 -0
- /package/{dist/config → config}/ui-spec.js +0 -0
- /package/{dist/events → events}/index.d.ts +0 -0
- /package/{dist/events → events}/index.d.ts.map +0 -0
- /package/{dist/events → events}/index.js +0 -0
- /package/{dist/hooks → hooks}/index.d.ts +0 -0
- /package/{dist/hooks → hooks}/index.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/index.js +0 -0
- /package/{dist/hooks → hooks}/useBugReport.d.ts +0 -0
- /package/{dist/hooks → hooks}/useBugReport.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useBugReport.js +0 -0
- /package/{dist/hooks → hooks}/useCanvasWindow.d.ts +0 -0
- /package/{dist/hooks → hooks}/useCanvasWindow.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useCanvasWindow.js +0 -0
- /package/{dist/hooks → hooks}/useChatAvatarVoice.d.ts +0 -0
- /package/{dist/hooks → hooks}/useChatAvatarVoice.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useChatAvatarVoice.js +0 -0
- /package/{dist/hooks → hooks}/useClickOutside.d.ts +0 -0
- /package/{dist/hooks → hooks}/useClickOutside.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useClickOutside.js +0 -0
- /package/{dist/hooks → hooks}/useContextMenu.d.ts +0 -0
- /package/{dist/hooks → hooks}/useContextMenu.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useContextMenu.js +0 -0
- /package/{dist/hooks → hooks}/useKeyboardShortcuts.d.ts +0 -0
- /package/{dist/hooks → hooks}/useKeyboardShortcuts.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useKeyboardShortcuts.js +0 -0
- /package/{dist/hooks → hooks}/useLifoSync.d.ts +0 -0
- /package/{dist/hooks → hooks}/useLifoSync.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useLifoSync.js +0 -0
- /package/{dist/hooks → hooks}/useMemoryMonitor.d.ts +0 -0
- /package/{dist/hooks → hooks}/useMemoryMonitor.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useMemoryMonitor.js +0 -0
- /package/{dist/hooks → hooks}/useRenderGuard.d.ts +0 -0
- /package/{dist/hooks → hooks}/useRenderGuard.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useRenderGuard.js +0 -0
- /package/{dist/hooks → hooks}/useRetakeCapture.d.ts +0 -0
- /package/{dist/hooks → hooks}/useRetakeCapture.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useRetakeCapture.js +0 -0
- /package/{dist/hooks → hooks}/useStreamPopoutNavigation.d.ts +0 -0
- /package/{dist/hooks → hooks}/useStreamPopoutNavigation.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useStreamPopoutNavigation.js +0 -0
- /package/{dist/hooks → hooks}/useTimeout.d.ts +0 -0
- /package/{dist/hooks → hooks}/useTimeout.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useTimeout.js +0 -0
- /package/{dist/hooks → hooks}/useVoiceChat.d.ts +0 -0
- /package/{dist/hooks → hooks}/useVoiceChat.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useVoiceChat.js +0 -0
- /package/{dist/hooks → hooks}/useWhatsAppPairing.d.ts +0 -0
- /package/{dist/hooks → hooks}/useWhatsAppPairing.d.ts.map +0 -0
- /package/{dist/hooks → hooks}/useWhatsAppPairing.js +0 -0
- /package/{dist/i18n → i18n}/index.d.ts +0 -0
- /package/{dist/i18n → i18n}/index.d.ts.map +0 -0
- /package/{dist/i18n → i18n}/index.js +0 -0
- /package/{dist/i18n → i18n}/messages.d.ts +0 -0
- /package/{dist/i18n → i18n}/messages.d.ts.map +0 -0
- /package/{dist/i18n → i18n}/messages.js +0 -0
- /package/{dist/index.d.ts → index.d.ts} +0 -0
- /package/{dist/index.d.ts.map → index.d.ts.map} +0 -0
- /package/{dist/index.js → index.js} +0 -0
- /package/{dist/navigation → navigation}/index.d.ts +0 -0
- /package/{dist/navigation → navigation}/index.d.ts.map +0 -0
- /package/{dist/navigation → navigation}/index.js +0 -0
- /package/{dist/onboarding-config.d.ts → onboarding-config.d.ts} +0 -0
- /package/{dist/onboarding-config.d.ts.map → onboarding-config.d.ts.map} +0 -0
- /package/{dist/onboarding-config.js → onboarding-config.js} +0 -0
- /package/{dist/platform → platform}/browser-launch.d.ts +0 -0
- /package/{dist/platform → platform}/browser-launch.d.ts.map +0 -0
- /package/{dist/platform → platform}/browser-launch.js +0 -0
- /package/{dist/platform → platform}/index.d.ts +0 -0
- /package/{dist/platform → platform}/index.d.ts.map +0 -0
- /package/{dist/platform → platform}/index.js +0 -0
- /package/{dist/platform → platform}/init.d.ts +0 -0
- /package/{dist/platform → platform}/init.d.ts.map +0 -0
- /package/{dist/platform → platform}/init.js +0 -0
- /package/{dist/platform → platform}/lifo.d.ts +0 -0
- /package/{dist/platform → platform}/lifo.d.ts.map +0 -0
- /package/{dist/platform → platform}/lifo.js +0 -0
- /package/{dist/providers → providers}/index.d.ts +0 -0
- /package/{dist/providers → providers}/index.d.ts.map +0 -0
- /package/{dist/providers → providers}/index.js +0 -0
- /package/{dist/shell-params.d.ts → shell-params.d.ts} +0 -0
- /package/{dist/shell-params.d.ts.map → shell-params.d.ts.map} +0 -0
- /package/{dist/shell-params.js → shell-params.js} +0 -0
- /package/{dist/state → state}/AppContext.d.ts +0 -0
- /package/{dist/state → state}/index.d.ts +0 -0
- /package/{dist/state → state}/index.d.ts.map +0 -0
- /package/{dist/state → state}/index.js +0 -0
- /package/{dist/state → state}/internal.d.ts +0 -0
- /package/{dist/state → state}/internal.d.ts.map +0 -0
- /package/{dist/state → state}/internal.js +0 -0
- /package/{dist/state → state}/onboarding-resume.d.ts +0 -0
- /package/{dist/state → state}/onboarding-resume.d.ts.map +0 -0
- /package/{dist/state → state}/onboarding-resume.js +0 -0
- /package/{dist/state → state}/parsers.d.ts +0 -0
- /package/{dist/state → state}/parsers.d.ts.map +0 -0
- /package/{dist/state → state}/parsers.js +0 -0
- /package/{dist/state → state}/persistence.d.ts +0 -0
- /package/{dist/state → state}/persistence.d.ts.map +0 -0
- /package/{dist/state → state}/persistence.js +0 -0
- /package/{dist/state → state}/shell-routing.d.ts +0 -0
- /package/{dist/state → state}/shell-routing.d.ts.map +0 -0
- /package/{dist/state → state}/shell-routing.js +0 -0
- /package/{dist/state → state}/types.d.ts +0 -0
- /package/{dist/state → state}/types.d.ts.map +0 -0
- /package/{dist/state → state}/types.js +0 -0
- /package/{dist/state → state}/ui-preferences.d.ts +0 -0
- /package/{dist/state → state}/ui-preferences.d.ts.map +0 -0
- /package/{dist/state → state}/ui-preferences.js +0 -0
- /package/{dist/state → state}/useApp.d.ts +0 -0
- /package/{dist/state → state}/useApp.d.ts.map +0 -0
- /package/{dist/state → state}/useApp.js +0 -0
- /package/{dist/state → state}/vrm.d.ts +0 -0
- /package/{dist/state → state}/vrm.d.ts.map +0 -0
- /package/{dist/state → state}/vrm.js +0 -0
- /package/{dist/styles → styles}/base.css +0 -0
- /package/{dist/styles → styles}/styles.css +0 -0
- /package/{dist/styles → styles}/xterm.css +0 -0
- /package/{dist/types → types}/index.d.ts +0 -0
- /package/{dist/types → types}/index.d.ts.map +0 -0
- /package/{dist/types → types}/index.js +0 -0
- /package/{dist/utils → utils}/asset-url.d.ts +0 -0
- /package/{dist/utils → utils}/asset-url.d.ts.map +0 -0
- /package/{dist/utils → utils}/asset-url.js +0 -0
- /package/{dist/utils → utils}/assistant-text.d.ts +0 -0
- /package/{dist/utils → utils}/assistant-text.d.ts.map +0 -0
- /package/{dist/utils → utils}/assistant-text.js +0 -0
- /package/{dist/utils → utils}/clipboard.d.ts +0 -0
- /package/{dist/utils → utils}/clipboard.d.ts.map +0 -0
- /package/{dist/utils → utils}/clipboard.js +0 -0
- /package/{dist/utils → utils}/desktop-dialogs.d.ts +0 -0
- /package/{dist/utils → utils}/desktop-dialogs.d.ts.map +0 -0
- /package/{dist/utils → utils}/desktop-dialogs.js +0 -0
- /package/{dist/utils → utils}/eliza-globals.d.ts +0 -0
- /package/{dist/utils → utils}/eliza-globals.d.ts.map +0 -0
- /package/{dist/utils → utils}/eliza-globals.js +0 -0
- /package/{dist/utils → utils}/index.d.ts +0 -0
- /package/{dist/utils → utils}/index.d.ts.map +0 -0
- /package/{dist/utils → utils}/index.js +0 -0
- /package/{dist/utils → utils}/number-parsing.d.ts +0 -0
- /package/{dist/utils → utils}/number-parsing.d.ts.map +0 -0
- /package/{dist/utils → utils}/number-parsing.js +0 -0
- /package/{dist/utils → utils}/openExternalUrl.d.ts +0 -0
- /package/{dist/utils → utils}/openExternalUrl.d.ts.map +0 -0
- /package/{dist/utils → utils}/openExternalUrl.js +0 -0
- /package/{dist/utils → utils}/spoken-text.d.ts +0 -0
- /package/{dist/utils → utils}/spoken-text.d.ts.map +0 -0
- /package/{dist/utils → utils}/spoken-text.js +0 -0
- /package/{dist/utils → utils}/streaming-text.d.ts +0 -0
- /package/{dist/utils → utils}/streaming-text.d.ts.map +0 -0
- /package/{dist/utils → utils}/streaming-text.js +0 -0
- /package/{dist/voice → voice}/index.d.ts +0 -0
- /package/{dist/voice → voice}/index.d.ts.map +0 -0
- /package/{dist/voice → voice}/index.js +0 -0
- /package/{dist/voice → voice}/types.d.ts +0 -0
- /package/{dist/voice → voice}/types.d.ts.map +0 -0
- /package/{dist/voice → voice}/types.js +0 -0
- /package/{dist/wallet-rpc.d.ts → wallet-rpc.d.ts} +0 -0
- /package/{dist/wallet-rpc.d.ts.map → wallet-rpc.d.ts.map} +0 -0
- /package/{dist/wallet-rpc.js → wallet-rpc.js} +0 -0
|
@@ -1,1442 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bidirectional voice hook for chat + avatar lip sync.
|
|
3
|
-
*
|
|
4
|
-
* TTS providers (in priority order):
|
|
5
|
-
* 1. ElevenLabs — low-latency streaming endpoint + first-sentence cache.
|
|
6
|
-
* 2. Browser SpeechSynthesis — fallback when ElevenLabs isn't configured.
|
|
7
|
-
*
|
|
8
|
-
* STT: Web Speech API (SpeechRecognition) for user voice input.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type { PluginListenerHandle } from "@capacitor/core";
|
|
12
|
-
import { Capacitor } from "@capacitor/core";
|
|
13
|
-
import {
|
|
14
|
-
useCallback,
|
|
15
|
-
useEffect,
|
|
16
|
-
useEffectEvent,
|
|
17
|
-
useMemo,
|
|
18
|
-
useRef,
|
|
19
|
-
useState,
|
|
20
|
-
} from "react";
|
|
21
|
-
import type { VoiceConfig } from "../api/client";
|
|
22
|
-
import { getElectrobunRendererRpc } from "../bridge/electrobun-rpc";
|
|
23
|
-
import {
|
|
24
|
-
getTalkModePlugin,
|
|
25
|
-
type TalkModeErrorEvent,
|
|
26
|
-
type TalkModeStateEvent,
|
|
27
|
-
type TalkModeTranscriptEvent,
|
|
28
|
-
} from "../bridge/native-plugins";
|
|
29
|
-
import { resolveApiUrl } from "../utils";
|
|
30
|
-
import { getElizaApiToken } from "../utils/eliza-globals";
|
|
31
|
-
import { sanitizeSpeechText } from "../utils/spoken-text";
|
|
32
|
-
import { mergeStreamingText } from "../utils/streaming-text";
|
|
33
|
-
|
|
34
|
-
// ── Speech Recognition types ──────────────────────────────────────────
|
|
35
|
-
|
|
36
|
-
interface SpeechRecognitionInstance extends EventTarget {
|
|
37
|
-
continuous: boolean;
|
|
38
|
-
interimResults: boolean;
|
|
39
|
-
lang: string;
|
|
40
|
-
onstart: (() => void) | null;
|
|
41
|
-
onend: (() => void) | null;
|
|
42
|
-
onerror: ((event: { error: string }) => void) | null;
|
|
43
|
-
onresult: ((event: SpeechRecognitionResultEvent) => void) | null;
|
|
44
|
-
start(): void;
|
|
45
|
-
stop(): void;
|
|
46
|
-
abort(): void;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
interface SpeechRecognitionResultEvent {
|
|
50
|
-
results: SpeechRecognitionResultList;
|
|
51
|
-
resultIndex: number;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
interface SpeechRecognitionResultList {
|
|
55
|
-
length: number;
|
|
56
|
-
[index: number]: {
|
|
57
|
-
isFinal: boolean;
|
|
58
|
-
0: { transcript: string; confidence: number };
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
type SpeechRecognitionCtor = new () => SpeechRecognitionInstance;
|
|
63
|
-
|
|
64
|
-
interface WindowWithSpeechRecognition extends Window {
|
|
65
|
-
SpeechRecognition?: SpeechRecognitionCtor;
|
|
66
|
-
webkitSpeechRecognition?: SpeechRecognitionCtor;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/** Access browser SpeechRecognition APIs which may live under a vendor prefix. */
|
|
70
|
-
function getSpeechRecognitionCtor(): SpeechRecognitionCtor | undefined {
|
|
71
|
-
const w = window as WindowWithSpeechRecognition;
|
|
72
|
-
return w.SpeechRecognition ?? w.webkitSpeechRecognition;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// ── Public types ──────────────────────────────────────────────────────
|
|
76
|
-
|
|
77
|
-
type SpeechSegmentKind = "full" | "first-sentence" | "remainder";
|
|
78
|
-
type SpeechProviderKind = "elevenlabs" | "browser";
|
|
79
|
-
export type VoiceCaptureMode = "idle" | "compose" | "push-to-talk";
|
|
80
|
-
|
|
81
|
-
export interface VoicePlaybackStartEvent {
|
|
82
|
-
text: string;
|
|
83
|
-
segment: SpeechSegmentKind;
|
|
84
|
-
provider: SpeechProviderKind;
|
|
85
|
-
cached: boolean;
|
|
86
|
-
startedAtMs: number;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface VoiceTranscriptPreviewEvent {
|
|
90
|
-
mode: Exclude<VoiceCaptureMode, "idle">;
|
|
91
|
-
isFinal: boolean;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface VoiceChatOptions {
|
|
95
|
-
/** Called when a final transcript is ready to send */
|
|
96
|
-
onTranscript: (text: string) => void;
|
|
97
|
-
/** Called whenever the live transcript buffer changes */
|
|
98
|
-
onTranscriptPreview?: (
|
|
99
|
-
text: string,
|
|
100
|
-
event: VoiceTranscriptPreviewEvent,
|
|
101
|
-
) => void;
|
|
102
|
-
/** Called when playback of a speech segment starts */
|
|
103
|
-
onPlaybackStart?: (event: VoicePlaybackStartEvent) => void;
|
|
104
|
-
/** True when the user is authenticated to Eliza Cloud */
|
|
105
|
-
cloudConnected?: boolean;
|
|
106
|
-
/** Whether user speech should immediately interrupt assistant playback */
|
|
107
|
-
interruptOnSpeech?: boolean;
|
|
108
|
-
/** Language for speech recognition (default: "en-US") */
|
|
109
|
-
lang?: string;
|
|
110
|
-
/** Saved voice configuration — switches TTS provider when set */
|
|
111
|
-
voiceConfig?: VoiceConfig | null;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
export interface VoiceChatState {
|
|
115
|
-
/** Whether voice input is currently active */
|
|
116
|
-
isListening: boolean;
|
|
117
|
-
/** Current mic capture mode */
|
|
118
|
-
captureMode: VoiceCaptureMode;
|
|
119
|
-
/** Whether the agent is currently speaking */
|
|
120
|
-
isSpeaking: boolean;
|
|
121
|
-
/** Current mouth openness (0-1) for lip sync */
|
|
122
|
-
mouthOpen: number;
|
|
123
|
-
/** Current interim transcript being recognized */
|
|
124
|
-
interimTranscript: string;
|
|
125
|
-
/** Whether Web Speech API is supported */
|
|
126
|
-
supported: boolean;
|
|
127
|
-
/** True when using real audio analysis (ElevenLabs) for mouth */
|
|
128
|
-
usingAudioAnalysis: boolean;
|
|
129
|
-
/** Toggle voice listening on/off */
|
|
130
|
-
toggleListening: () => void;
|
|
131
|
-
/** Begin voice capture in compose or push-to-talk mode */
|
|
132
|
-
startListening: (mode?: Exclude<VoiceCaptureMode, "idle">) => Promise<void>;
|
|
133
|
-
/** End voice capture and optionally submit the transcript */
|
|
134
|
-
stopListening: (options?: { submit?: boolean }) => Promise<void>;
|
|
135
|
-
/** Speak text aloud with mouth animation */
|
|
136
|
-
speak: (text: string, options?: { append?: boolean }) => void;
|
|
137
|
-
/** Progressively speak an assistant message while it streams */
|
|
138
|
-
queueAssistantSpeech: (
|
|
139
|
-
messageId: string,
|
|
140
|
-
text: string,
|
|
141
|
-
isFinal: boolean,
|
|
142
|
-
) => void;
|
|
143
|
-
/** Stop any current speech */
|
|
144
|
-
stopSpeaking: () => void;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
interface SpeakTask {
|
|
148
|
-
text: string;
|
|
149
|
-
append: boolean;
|
|
150
|
-
segment: SpeechSegmentKind;
|
|
151
|
-
cacheKey?: string;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
interface AssistantSpeechState {
|
|
155
|
-
messageId: string;
|
|
156
|
-
lastObservedText: string;
|
|
157
|
-
firstSentenceSpoken: boolean;
|
|
158
|
-
firstSentenceText: string;
|
|
159
|
-
queuedRemainderText: string;
|
|
160
|
-
finalQueued: boolean;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
const DEFAULT_ELEVEN_MODEL = "eleven_flash_v2_5";
|
|
164
|
-
const DEFAULT_ELEVEN_VOICE = "EXAVITQu4vr4xnSDxMaL";
|
|
165
|
-
const MAX_SPOKEN_CHARS = 360;
|
|
166
|
-
const MAX_CACHED_SEGMENTS = 128;
|
|
167
|
-
const TALKMODE_STOP_SETTLE_MS = 120;
|
|
168
|
-
const REDACTED_SECRET = "[REDACTED]";
|
|
169
|
-
const MOUTH_OPEN_STEP = 0.02;
|
|
170
|
-
function resolveElevenProxyEndpoint(): string {
|
|
171
|
-
return resolveApiUrl("/api/tts/elevenlabs");
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function toArrayBuffer(bytes: Uint8Array): ArrayBuffer {
|
|
175
|
-
const out = new Uint8Array(bytes.byteLength);
|
|
176
|
-
out.set(bytes);
|
|
177
|
-
return out.buffer;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function collapseWhitespace(input: string): string {
|
|
181
|
-
return input.replace(/\s+/g, " ").trim();
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function normalizeMouthOpen(value: number): number {
|
|
185
|
-
const clamped = Math.max(0, Math.min(1, value));
|
|
186
|
-
const stepped = Math.round(clamped / MOUTH_OPEN_STEP) * MOUTH_OPEN_STEP;
|
|
187
|
-
return stepped < MOUTH_OPEN_STEP ? 0 : Math.min(1, stepped);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export function nextIdleMouthOpen(currentValue: number): number {
|
|
191
|
-
const current = normalizeMouthOpen(currentValue);
|
|
192
|
-
if (current <= MOUTH_OPEN_STEP) {
|
|
193
|
-
return 0;
|
|
194
|
-
}
|
|
195
|
-
return Math.max(0, Math.min(current * 0.85, current - MOUTH_OPEN_STEP));
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
function normalizeCacheText(input: string): string {
|
|
199
|
-
// Preserve punctuation while normalizing spacing/casing.
|
|
200
|
-
return collapseWhitespace(input.normalize("NFKC")).toLowerCase();
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
function isRedactedSecret(value: unknown): boolean {
|
|
204
|
-
return (
|
|
205
|
-
typeof value === "string" && value.trim().toUpperCase() === REDACTED_SECRET
|
|
206
|
-
);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function capSpeechLength(input: string): string {
|
|
210
|
-
if (input.length <= MAX_SPOKEN_CHARS) return input;
|
|
211
|
-
const clipped = input.slice(0, MAX_SPOKEN_CHARS);
|
|
212
|
-
const splitAt = clipped.lastIndexOf(" ");
|
|
213
|
-
const body = splitAt > 120 ? clipped.slice(0, splitAt) : clipped;
|
|
214
|
-
return `${body.trim()}...`;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
function toSpeakableText(input: string): string {
|
|
218
|
-
const normalized = sanitizeSpeechText(input);
|
|
219
|
-
if (!normalized) return "";
|
|
220
|
-
return capSpeechLength(normalized);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function splitFirstSentence(text: string): {
|
|
224
|
-
complete: boolean;
|
|
225
|
-
firstSentence: string;
|
|
226
|
-
remainder: string;
|
|
227
|
-
} {
|
|
228
|
-
const value = collapseWhitespace(text);
|
|
229
|
-
if (!value) return { complete: false, firstSentence: "", remainder: "" };
|
|
230
|
-
|
|
231
|
-
const boundary = /([.!?]+(?:["')\]]+)?)(?:\s|$)/g;
|
|
232
|
-
const match = boundary.exec(value);
|
|
233
|
-
if (match && typeof match.index === "number") {
|
|
234
|
-
const endIndex = match.index + match[0].length;
|
|
235
|
-
const firstSentence = value.slice(0, endIndex).trim();
|
|
236
|
-
const remainder = value.slice(endIndex).trim();
|
|
237
|
-
if (firstSentence.length > 0) {
|
|
238
|
-
return { complete: true, firstSentence, remainder };
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// Fallback for long content with no punctuation yet.
|
|
243
|
-
if (value.length >= 180) {
|
|
244
|
-
const window = value.slice(0, 180);
|
|
245
|
-
const splitAt = window.lastIndexOf(" ");
|
|
246
|
-
if (splitAt > 100) {
|
|
247
|
-
return {
|
|
248
|
-
complete: true,
|
|
249
|
-
firstSentence: window.slice(0, splitAt).trim(),
|
|
250
|
-
remainder: value.slice(splitAt).trim(),
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
return { complete: false, firstSentence: value, remainder: "" };
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function remainderAfter(fullText: string, firstSentence: string): string {
|
|
259
|
-
const full = collapseWhitespace(fullText);
|
|
260
|
-
const first = collapseWhitespace(firstSentence);
|
|
261
|
-
if (!full || !first) return full;
|
|
262
|
-
if (full.startsWith(first)) return full.slice(first.length).trim();
|
|
263
|
-
|
|
264
|
-
const lowerFull = full.toLowerCase();
|
|
265
|
-
const lowerFirst = first.toLowerCase();
|
|
266
|
-
if (lowerFull.startsWith(lowerFirst)) {
|
|
267
|
-
return full.slice(first.length).trim();
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
const idx = lowerFull.indexOf(lowerFirst);
|
|
271
|
-
if (idx >= 0) {
|
|
272
|
-
return full.slice(idx + first.length).trim();
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
return "";
|
|
276
|
-
}
|
|
277
|
-
|
|
278
|
-
function queueableSpeechPrefix(text: string, isFinal: boolean): string {
|
|
279
|
-
const value = collapseWhitespace(text);
|
|
280
|
-
if (!value) return "";
|
|
281
|
-
if (isFinal) return value;
|
|
282
|
-
|
|
283
|
-
let lastSentenceEnd = 0;
|
|
284
|
-
const boundary = /([.!?]+(?:["')\]]+)?)(?:\s|$)/g;
|
|
285
|
-
let match: RegExpExecArray | null = null;
|
|
286
|
-
while (true) {
|
|
287
|
-
match = boundary.exec(value);
|
|
288
|
-
if (!match || typeof match.index !== "number") break;
|
|
289
|
-
lastSentenceEnd = match.index + match[0].length;
|
|
290
|
-
}
|
|
291
|
-
if (lastSentenceEnd > 0) {
|
|
292
|
-
return value.slice(0, lastSentenceEnd).trim();
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Fallback for long content with no punctuation yet.
|
|
296
|
-
if (value.length >= 180) {
|
|
297
|
-
const window = value.slice(0, 180);
|
|
298
|
-
const splitAt = window.lastIndexOf(" ");
|
|
299
|
-
if (splitAt > 100) {
|
|
300
|
-
return window.slice(0, splitAt).trim();
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
return "";
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
function cloneVoiceConfig(
|
|
307
|
-
config: VoiceConfig | null | undefined,
|
|
308
|
-
): VoiceConfig | null {
|
|
309
|
-
if (!config) return null;
|
|
310
|
-
return {
|
|
311
|
-
...config,
|
|
312
|
-
elevenlabs: config.elevenlabs ? { ...config.elevenlabs } : undefined,
|
|
313
|
-
edge: config.edge ? { ...config.edge } : undefined,
|
|
314
|
-
};
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
function resolveEffectiveVoiceConfig(
|
|
318
|
-
config: VoiceConfig | null | undefined,
|
|
319
|
-
options?: { cloudConnected?: boolean },
|
|
320
|
-
): VoiceConfig | null {
|
|
321
|
-
const cloudConnected = options?.cloudConnected === true;
|
|
322
|
-
const base = cloneVoiceConfig(config) ?? {};
|
|
323
|
-
const provider =
|
|
324
|
-
base.provider ??
|
|
325
|
-
(base.elevenlabs ? "elevenlabs" : base.edge ? "edge" : undefined) ??
|
|
326
|
-
(cloudConnected ? "elevenlabs" : undefined);
|
|
327
|
-
|
|
328
|
-
if (!provider) return null;
|
|
329
|
-
if (provider !== "elevenlabs") {
|
|
330
|
-
return { ...base, provider };
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
const mode = base.mode ?? (cloudConnected ? "cloud" : "own-key");
|
|
334
|
-
const currentElevenLabs = base.elevenlabs ?? {};
|
|
335
|
-
const elevenlabs: NonNullable<VoiceConfig["elevenlabs"]> = {
|
|
336
|
-
...currentElevenLabs,
|
|
337
|
-
voiceId: currentElevenLabs.voiceId ?? DEFAULT_ELEVEN_VOICE,
|
|
338
|
-
modelId: currentElevenLabs.modelId ?? DEFAULT_ELEVEN_MODEL,
|
|
339
|
-
stability:
|
|
340
|
-
typeof currentElevenLabs.stability === "number"
|
|
341
|
-
? currentElevenLabs.stability
|
|
342
|
-
: 0.5,
|
|
343
|
-
similarityBoost:
|
|
344
|
-
typeof currentElevenLabs.similarityBoost === "number"
|
|
345
|
-
? currentElevenLabs.similarityBoost
|
|
346
|
-
: 0.75,
|
|
347
|
-
speed:
|
|
348
|
-
typeof currentElevenLabs.speed === "number"
|
|
349
|
-
? currentElevenLabs.speed
|
|
350
|
-
: 1.0,
|
|
351
|
-
};
|
|
352
|
-
const apiKey =
|
|
353
|
-
typeof currentElevenLabs.apiKey === "string"
|
|
354
|
-
? currentElevenLabs.apiKey.trim()
|
|
355
|
-
: "";
|
|
356
|
-
|
|
357
|
-
if (mode === "own-key" && apiKey && !isRedactedSecret(apiKey)) {
|
|
358
|
-
elevenlabs.apiKey = currentElevenLabs.apiKey;
|
|
359
|
-
} else {
|
|
360
|
-
delete elevenlabs.apiKey;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
return {
|
|
364
|
-
...base,
|
|
365
|
-
provider,
|
|
366
|
-
mode,
|
|
367
|
-
elevenlabs,
|
|
368
|
-
};
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
export const __voiceChatInternals = {
|
|
372
|
-
splitFirstSentence,
|
|
373
|
-
remainderAfter,
|
|
374
|
-
queueableSpeechPrefix,
|
|
375
|
-
resolveEffectiveVoiceConfig,
|
|
376
|
-
toSpeakableText,
|
|
377
|
-
};
|
|
378
|
-
|
|
379
|
-
function isAbortError(error: unknown): boolean {
|
|
380
|
-
if (error instanceof DOMException && error.name === "AbortError") return true;
|
|
381
|
-
if (error instanceof Error && error.name === "AbortError") return true;
|
|
382
|
-
return false;
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
function shouldPreferNativeTalkMode(): boolean {
|
|
386
|
-
if (typeof window === "undefined") return false;
|
|
387
|
-
if (getElectrobunRendererRpc()) return true;
|
|
388
|
-
return Capacitor.isNativePlatform();
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// ── Hook ──────────────────────────────────────────────────────────────
|
|
392
|
-
|
|
393
|
-
export function useVoiceChat(options: VoiceChatOptions): VoiceChatState {
|
|
394
|
-
const [isListening, setIsListening] = useState(false);
|
|
395
|
-
const [captureMode, setCaptureMode] = useState<VoiceCaptureMode>("idle");
|
|
396
|
-
const [isSpeaking, setIsSpeaking] = useState(false);
|
|
397
|
-
const [mouthOpen, setMouthOpen] = useState(0);
|
|
398
|
-
const [interimTranscript, setInterimTranscript] = useState("");
|
|
399
|
-
const [supported, setSupported] = useState(false);
|
|
400
|
-
const [usingAudioAnalysis, setUsingAudioAnalysis] = useState(false);
|
|
401
|
-
|
|
402
|
-
// Refs — stable across renders, read from animation loop & callbacks
|
|
403
|
-
const recognitionRef = useRef<SpeechRecognitionInstance | null>(null);
|
|
404
|
-
const sttBackendRef = useRef<"browser" | "talkmode" | null>(null);
|
|
405
|
-
const talkModeHandlesRef = useRef<PluginListenerHandle[]>([]);
|
|
406
|
-
const synthRef = useRef<SpeechSynthesis | null>(null);
|
|
407
|
-
const utteranceRef = useRef<SpeechSynthesisUtterance | null>(null);
|
|
408
|
-
const animFrameRef = useRef<number>(0);
|
|
409
|
-
const speakingStartRef = useRef<number>(0);
|
|
410
|
-
const speechTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
411
|
-
const enabledRef = useRef(false);
|
|
412
|
-
const listeningModeRef = useRef<VoiceCaptureMode>("idle");
|
|
413
|
-
const transcriptBufferRef = useRef("");
|
|
414
|
-
const emitTranscript = useEffectEvent((text: string) => {
|
|
415
|
-
options.onTranscript(text);
|
|
416
|
-
});
|
|
417
|
-
const emitTranscriptPreview = useEffectEvent(
|
|
418
|
-
(text: string, event: VoiceTranscriptPreviewEvent) => {
|
|
419
|
-
options.onTranscriptPreview?.(text, event);
|
|
420
|
-
},
|
|
421
|
-
);
|
|
422
|
-
const emitPlaybackStart = useEffectEvent((event: VoicePlaybackStartEvent) => {
|
|
423
|
-
options.onPlaybackStart?.(event);
|
|
424
|
-
});
|
|
425
|
-
|
|
426
|
-
const effectiveVoiceConfig = useMemo(
|
|
427
|
-
() =>
|
|
428
|
-
resolveEffectiveVoiceConfig(options.voiceConfig, {
|
|
429
|
-
cloudConnected: options.cloudConnected,
|
|
430
|
-
}),
|
|
431
|
-
[options.cloudConnected, options.voiceConfig],
|
|
432
|
-
);
|
|
433
|
-
|
|
434
|
-
// Voice config ref (latest value always available to callbacks)
|
|
435
|
-
const voiceConfigRef = useRef<VoiceConfig | null>(effectiveVoiceConfig);
|
|
436
|
-
voiceConfigRef.current = effectiveVoiceConfig;
|
|
437
|
-
const interruptOnSpeechRef = useRef(options.interruptOnSpeech ?? true);
|
|
438
|
-
interruptOnSpeechRef.current = options.interruptOnSpeech ?? true;
|
|
439
|
-
const interruptSpeechRef = useRef<() => void>(() => {});
|
|
440
|
-
|
|
441
|
-
// ── ElevenLabs Web Audio refs ──────────────────────────────────────
|
|
442
|
-
const audioCtxRef = useRef<AudioContext | null>(null);
|
|
443
|
-
const analyserRef = useRef<AnalyserNode | null>(null);
|
|
444
|
-
const audioSourceRef = useRef<AudioBufferSourceNode | null>(null);
|
|
445
|
-
const timeDomainDataRef = useRef<Float32Array<ArrayBuffer> | null>(null);
|
|
446
|
-
const usingAudioAnalysisRef = useRef(false);
|
|
447
|
-
const mouthOpenRef = useRef(0);
|
|
448
|
-
mouthOpenRef.current = mouthOpen;
|
|
449
|
-
|
|
450
|
-
// ── Progressive speech queue state ────────────────────────────────
|
|
451
|
-
const queueRef = useRef<SpeakTask[]>([]);
|
|
452
|
-
const queueWorkerRunningRef = useRef(false);
|
|
453
|
-
const generationRef = useRef(0);
|
|
454
|
-
const activeTaskFinishRef = useRef<(() => void) | null>(null);
|
|
455
|
-
const activeFetchAbortRef = useRef<AbortController | null>(null);
|
|
456
|
-
const assistantSpeechRef = useRef<AssistantSpeechState | null>(null);
|
|
457
|
-
const elevenCacheRef = useRef<Map<string, Uint8Array>>(new Map());
|
|
458
|
-
|
|
459
|
-
const clearSpeechTimers = useCallback(() => {
|
|
460
|
-
if (speechTimeoutRef.current) {
|
|
461
|
-
clearTimeout(speechTimeoutRef.current);
|
|
462
|
-
speechTimeoutRef.current = null;
|
|
463
|
-
}
|
|
464
|
-
}, []);
|
|
465
|
-
|
|
466
|
-
const rememberCachedSegment = useCallback(
|
|
467
|
-
(key: string, bytes: Uint8Array) => {
|
|
468
|
-
const cache = elevenCacheRef.current;
|
|
469
|
-
cache.delete(key);
|
|
470
|
-
cache.set(key, bytes);
|
|
471
|
-
if (cache.size <= MAX_CACHED_SEGMENTS) return;
|
|
472
|
-
const oldest = cache.keys().next().value;
|
|
473
|
-
if (oldest) cache.delete(oldest);
|
|
474
|
-
},
|
|
475
|
-
[],
|
|
476
|
-
);
|
|
477
|
-
|
|
478
|
-
const makeElevenCacheKey = useCallback(
|
|
479
|
-
(text: string, config: NonNullable<VoiceConfig["elevenlabs"]>) => {
|
|
480
|
-
const voiceId = config.voiceId ?? DEFAULT_ELEVEN_VOICE;
|
|
481
|
-
const modelId = config.modelId ?? DEFAULT_ELEVEN_MODEL;
|
|
482
|
-
const stability =
|
|
483
|
-
typeof config.stability === "number"
|
|
484
|
-
? config.stability.toFixed(2)
|
|
485
|
-
: "0.50";
|
|
486
|
-
const similarity =
|
|
487
|
-
typeof config.similarityBoost === "number"
|
|
488
|
-
? config.similarityBoost.toFixed(2)
|
|
489
|
-
: "0.75";
|
|
490
|
-
const speed =
|
|
491
|
-
typeof config.speed === "number" ? config.speed.toFixed(2) : "1.00";
|
|
492
|
-
return [
|
|
493
|
-
voiceId,
|
|
494
|
-
modelId,
|
|
495
|
-
stability,
|
|
496
|
-
similarity,
|
|
497
|
-
speed,
|
|
498
|
-
normalizeCacheText(text),
|
|
499
|
-
].join("|");
|
|
500
|
-
},
|
|
501
|
-
[],
|
|
502
|
-
);
|
|
503
|
-
|
|
504
|
-
const updateMouthOpen = useCallback(
|
|
505
|
-
(value: number | ((previousValue: number) => number)) => {
|
|
506
|
-
const previousValue = mouthOpenRef.current;
|
|
507
|
-
const resolvedValue =
|
|
508
|
-
typeof value === "function" ? value(previousValue) : value;
|
|
509
|
-
const nextValue = normalizeMouthOpen(resolvedValue);
|
|
510
|
-
if (nextValue === previousValue) {
|
|
511
|
-
return;
|
|
512
|
-
}
|
|
513
|
-
mouthOpenRef.current = nextValue;
|
|
514
|
-
setMouthOpen(nextValue);
|
|
515
|
-
},
|
|
516
|
-
[],
|
|
517
|
-
);
|
|
518
|
-
|
|
519
|
-
// ── Init ──────────────────────────────────────────────────────────
|
|
520
|
-
|
|
521
|
-
useEffect(() => {
|
|
522
|
-
const SpeechRecognitionAPI = getSpeechRecognitionCtor();
|
|
523
|
-
const canUseMicrophone =
|
|
524
|
-
typeof navigator !== "undefined" &&
|
|
525
|
-
typeof navigator.mediaDevices?.getUserMedia === "function";
|
|
526
|
-
setSupported(
|
|
527
|
-
shouldPreferNativeTalkMode()
|
|
528
|
-
? canUseMicrophone || !!SpeechRecognitionAPI
|
|
529
|
-
: !!SpeechRecognitionAPI,
|
|
530
|
-
);
|
|
531
|
-
synthRef.current = window.speechSynthesis ?? null;
|
|
532
|
-
}, []);
|
|
533
|
-
|
|
534
|
-
useEffect(() => {
|
|
535
|
-
elevenCacheRef.current.clear();
|
|
536
|
-
}, []);
|
|
537
|
-
|
|
538
|
-
// ── Mouth animation loop ──────────────────────────────────────────
|
|
539
|
-
|
|
540
|
-
useEffect(() => {
|
|
541
|
-
let frameId = 0;
|
|
542
|
-
|
|
543
|
-
const animate = () => {
|
|
544
|
-
if (!isSpeaking) {
|
|
545
|
-
const nextMouthOpen = nextIdleMouthOpen(mouthOpenRef.current);
|
|
546
|
-
updateMouthOpen(nextMouthOpen);
|
|
547
|
-
if (nextMouthOpen > 0) {
|
|
548
|
-
frameId = requestAnimationFrame(animate);
|
|
549
|
-
animFrameRef.current = frameId;
|
|
550
|
-
} else {
|
|
551
|
-
animFrameRef.current = 0;
|
|
552
|
-
}
|
|
553
|
-
return;
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
// ── ElevenLabs: real audio volume analysis ────────────────────
|
|
557
|
-
if (usingAudioAnalysisRef.current) {
|
|
558
|
-
const analyser = analyserRef.current;
|
|
559
|
-
const data = timeDomainDataRef.current;
|
|
560
|
-
if (analyser && data) {
|
|
561
|
-
analyser.getFloatTimeDomainData(data);
|
|
562
|
-
let sum = 0;
|
|
563
|
-
for (let i = 0; i < data.length; i++) {
|
|
564
|
-
const v = data[i] ?? 0;
|
|
565
|
-
sum += v * v;
|
|
566
|
-
}
|
|
567
|
-
const rms = Math.sqrt(sum / data.length);
|
|
568
|
-
const volume = Math.max(
|
|
569
|
-
0,
|
|
570
|
-
Math.min(1, 1 / (1 + Math.exp(-(rms * 30 - 2)))),
|
|
571
|
-
);
|
|
572
|
-
updateMouthOpen(volume);
|
|
573
|
-
}
|
|
574
|
-
frameId = requestAnimationFrame(animate);
|
|
575
|
-
animFrameRef.current = frameId;
|
|
576
|
-
return;
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
// ── Browser TTS: sine-wave mouth + safety check ──────────────
|
|
580
|
-
const sinceStart = Date.now() - speakingStartRef.current;
|
|
581
|
-
if (
|
|
582
|
-
sinceStart > 500 &&
|
|
583
|
-
synthRef.current &&
|
|
584
|
-
!synthRef.current.speaking &&
|
|
585
|
-
!synthRef.current.pending
|
|
586
|
-
) {
|
|
587
|
-
utteranceRef.current = null;
|
|
588
|
-
setIsSpeaking(false);
|
|
589
|
-
return;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
const elapsed = sinceStart / 1000;
|
|
593
|
-
const base = Math.sin(elapsed * 12) * 0.3 + 0.4;
|
|
594
|
-
const detail = Math.sin(elapsed * 18.7) * 0.15;
|
|
595
|
-
const slow = Math.sin(elapsed * 4.2) * 0.1;
|
|
596
|
-
updateMouthOpen(Math.max(0, Math.min(1, base + detail + slow)));
|
|
597
|
-
frameId = requestAnimationFrame(animate);
|
|
598
|
-
animFrameRef.current = frameId;
|
|
599
|
-
};
|
|
600
|
-
|
|
601
|
-
if (isSpeaking || mouthOpenRef.current > 0) {
|
|
602
|
-
frameId = requestAnimationFrame(animate);
|
|
603
|
-
animFrameRef.current = frameId;
|
|
604
|
-
} else {
|
|
605
|
-
animFrameRef.current = 0;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
return () => {
|
|
609
|
-
cancelAnimationFrame(frameId);
|
|
610
|
-
if (animFrameRef.current === frameId) {
|
|
611
|
-
animFrameRef.current = 0;
|
|
612
|
-
}
|
|
613
|
-
};
|
|
614
|
-
}, [isSpeaking, updateMouthOpen]);
|
|
615
|
-
|
|
616
|
-
// ── STT (Speech Recognition) ──────────────────────────────────────
|
|
617
|
-
|
|
618
|
-
const applyTranscriptUpdate = useCallback(
|
|
619
|
-
(transcript: string, isFinal: boolean) => {
|
|
620
|
-
const mode = listeningModeRef.current;
|
|
621
|
-
if (mode === "idle") return;
|
|
622
|
-
|
|
623
|
-
const normalized = collapseWhitespace(transcript);
|
|
624
|
-
if (!normalized) return;
|
|
625
|
-
|
|
626
|
-
const nextText = mergeStreamingText(
|
|
627
|
-
transcriptBufferRef.current,
|
|
628
|
-
normalized,
|
|
629
|
-
);
|
|
630
|
-
if (nextText === transcriptBufferRef.current) return;
|
|
631
|
-
|
|
632
|
-
transcriptBufferRef.current = nextText;
|
|
633
|
-
setInterimTranscript(nextText);
|
|
634
|
-
emitTranscriptPreview(nextText, {
|
|
635
|
-
mode,
|
|
636
|
-
isFinal,
|
|
637
|
-
});
|
|
638
|
-
|
|
639
|
-
if (interruptOnSpeechRef.current) {
|
|
640
|
-
interruptSpeechRef.current();
|
|
641
|
-
}
|
|
642
|
-
},
|
|
643
|
-
[],
|
|
644
|
-
);
|
|
645
|
-
|
|
646
|
-
const removeTalkModeListeners = useCallback(async () => {
|
|
647
|
-
const handles = talkModeHandlesRef.current;
|
|
648
|
-
talkModeHandlesRef.current = [];
|
|
649
|
-
await Promise.all(
|
|
650
|
-
handles.map((handle) =>
|
|
651
|
-
handle.remove().catch(() => {
|
|
652
|
-
/* ignore */
|
|
653
|
-
}),
|
|
654
|
-
),
|
|
655
|
-
);
|
|
656
|
-
}, []);
|
|
657
|
-
|
|
658
|
-
const ensureTalkModeListeners = useCallback(async () => {
|
|
659
|
-
if (talkModeHandlesRef.current.length > 0) return;
|
|
660
|
-
|
|
661
|
-
const talkMode = getTalkModePlugin();
|
|
662
|
-
|
|
663
|
-
const transcriptHandle = await talkMode.addListener(
|
|
664
|
-
"transcript",
|
|
665
|
-
(event: TalkModeTranscriptEvent) => {
|
|
666
|
-
applyTranscriptUpdate(event.transcript ?? "", event.isFinal === true);
|
|
667
|
-
},
|
|
668
|
-
);
|
|
669
|
-
const errorHandle = await talkMode.addListener(
|
|
670
|
-
"error",
|
|
671
|
-
(event: TalkModeErrorEvent) => {
|
|
672
|
-
if (
|
|
673
|
-
event.code === "not-allowed" ||
|
|
674
|
-
event.code === "service-not-allowed"
|
|
675
|
-
) {
|
|
676
|
-
enabledRef.current = false;
|
|
677
|
-
listeningModeRef.current = "idle";
|
|
678
|
-
sttBackendRef.current = null;
|
|
679
|
-
setCaptureMode("idle");
|
|
680
|
-
setIsListening(false);
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
);
|
|
684
|
-
const stateHandle = await talkMode.addListener(
|
|
685
|
-
"stateChange",
|
|
686
|
-
(event: TalkModeStateEvent) => {
|
|
687
|
-
if (event.state === "error" || event.state === "idle") {
|
|
688
|
-
if (!enabledRef.current) {
|
|
689
|
-
setIsListening(false);
|
|
690
|
-
setCaptureMode("idle");
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
},
|
|
694
|
-
);
|
|
695
|
-
talkModeHandlesRef.current = [transcriptHandle, errorHandle, stateHandle];
|
|
696
|
-
}, [applyTranscriptUpdate]);
|
|
697
|
-
|
|
698
|
-
const startBrowserRecognition = useCallback(
|
|
699
|
-
(mode: Exclude<VoiceCaptureMode, "idle">) => {
|
|
700
|
-
const SpeechRecognitionAPI = getSpeechRecognitionCtor();
|
|
701
|
-
if (!SpeechRecognitionAPI) return false;
|
|
702
|
-
|
|
703
|
-
const recognition = new SpeechRecognitionAPI();
|
|
704
|
-
recognition.continuous = true;
|
|
705
|
-
recognition.interimResults = true;
|
|
706
|
-
recognition.lang = options.lang ?? "en-US";
|
|
707
|
-
|
|
708
|
-
recognition.onresult = (event: SpeechRecognitionResultEvent) => {
|
|
709
|
-
let transcript = "";
|
|
710
|
-
let isFinal = false;
|
|
711
|
-
|
|
712
|
-
for (let index = 0; index < event.results.length; index += 1) {
|
|
713
|
-
const result = event.results[index];
|
|
714
|
-
const chunk = result?.[0]?.transcript ?? "";
|
|
715
|
-
if (chunk) {
|
|
716
|
-
transcript = transcript ? `${transcript} ${chunk}` : chunk;
|
|
717
|
-
}
|
|
718
|
-
if (result?.isFinal) {
|
|
719
|
-
isFinal = true;
|
|
720
|
-
}
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
applyTranscriptUpdate(transcript, isFinal);
|
|
724
|
-
};
|
|
725
|
-
|
|
726
|
-
recognition.onerror = (event: { error: string }) => {
|
|
727
|
-
if (
|
|
728
|
-
event.error === "not-allowed" ||
|
|
729
|
-
event.error === "service-not-allowed"
|
|
730
|
-
) {
|
|
731
|
-
enabledRef.current = false;
|
|
732
|
-
listeningModeRef.current = "idle";
|
|
733
|
-
sttBackendRef.current = null;
|
|
734
|
-
setCaptureMode("idle");
|
|
735
|
-
setIsListening(false);
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
recognition.onend = () => {
|
|
740
|
-
if (enabledRef.current && listeningModeRef.current === mode) {
|
|
741
|
-
try {
|
|
742
|
-
recognition.start();
|
|
743
|
-
} catch {
|
|
744
|
-
/* already started */
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
};
|
|
748
|
-
|
|
749
|
-
recognitionRef.current = recognition;
|
|
750
|
-
try {
|
|
751
|
-
recognition.start();
|
|
752
|
-
sttBackendRef.current = "browser";
|
|
753
|
-
enabledRef.current = true;
|
|
754
|
-
listeningModeRef.current = mode;
|
|
755
|
-
setCaptureMode(mode);
|
|
756
|
-
setIsListening(true);
|
|
757
|
-
return true;
|
|
758
|
-
} catch {
|
|
759
|
-
recognitionRef.current = null;
|
|
760
|
-
return false;
|
|
761
|
-
}
|
|
762
|
-
},
|
|
763
|
-
[applyTranscriptUpdate, options.lang],
|
|
764
|
-
);
|
|
765
|
-
|
|
766
|
-
const startTalkModeRecognition = useCallback(
|
|
767
|
-
async (mode: Exclude<VoiceCaptureMode, "idle">) => {
|
|
768
|
-
await ensureTalkModeListeners();
|
|
769
|
-
|
|
770
|
-
try {
|
|
771
|
-
const talkMode = getTalkModePlugin();
|
|
772
|
-
const permissions = await talkMode.checkPermissions().catch(() => null);
|
|
773
|
-
if (permissions?.microphone === "prompt") {
|
|
774
|
-
await talkMode.requestPermissions().catch(() => {
|
|
775
|
-
/* ignore */
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
|
|
779
|
-
const directRpc = getElectrobunRendererRpc();
|
|
780
|
-
const result = await talkMode.start({
|
|
781
|
-
config: {
|
|
782
|
-
stt: {
|
|
783
|
-
...(directRpc ? { engine: "whisper" as const } : {}),
|
|
784
|
-
language: options.lang ?? "en-US",
|
|
785
|
-
modelSize: "base",
|
|
786
|
-
sampleRate: 16000,
|
|
787
|
-
},
|
|
788
|
-
silenceWindowMs: 350,
|
|
789
|
-
interruptOnSpeech: true,
|
|
790
|
-
},
|
|
791
|
-
});
|
|
792
|
-
if (!result.started) {
|
|
793
|
-
return false;
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
enabledRef.current = true;
|
|
797
|
-
listeningModeRef.current = mode;
|
|
798
|
-
sttBackendRef.current = "talkmode";
|
|
799
|
-
setCaptureMode(mode);
|
|
800
|
-
setIsListening(true);
|
|
801
|
-
return true;
|
|
802
|
-
} catch {
|
|
803
|
-
return false;
|
|
804
|
-
}
|
|
805
|
-
},
|
|
806
|
-
[ensureTalkModeListeners, options.lang],
|
|
807
|
-
);
|
|
808
|
-
|
|
809
|
-
const finalizeRecognition = useCallback((submit: boolean) => {
|
|
810
|
-
const transcript = collapseWhitespace(transcriptBufferRef.current);
|
|
811
|
-
if (submit && transcript) {
|
|
812
|
-
emitTranscript(transcript);
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
transcriptBufferRef.current = "";
|
|
816
|
-
recognitionRef.current = null;
|
|
817
|
-
sttBackendRef.current = null;
|
|
818
|
-
enabledRef.current = false;
|
|
819
|
-
listeningModeRef.current = "idle";
|
|
820
|
-
setIsListening(false);
|
|
821
|
-
setCaptureMode("idle");
|
|
822
|
-
setInterimTranscript("");
|
|
823
|
-
}, []);
|
|
824
|
-
|
|
825
|
-
const startListening = useCallback(
|
|
826
|
-
async (mode: Exclude<VoiceCaptureMode, "idle"> = "compose") => {
|
|
827
|
-
if (enabledRef.current) return;
|
|
828
|
-
|
|
829
|
-
transcriptBufferRef.current = "";
|
|
830
|
-
setInterimTranscript("");
|
|
831
|
-
if (interruptOnSpeechRef.current) {
|
|
832
|
-
interruptSpeechRef.current();
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
if (shouldPreferNativeTalkMode()) {
|
|
836
|
-
const started = await startTalkModeRecognition(mode);
|
|
837
|
-
if (started) {
|
|
838
|
-
return;
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
startBrowserRecognition(mode);
|
|
843
|
-
},
|
|
844
|
-
[startBrowserRecognition, startTalkModeRecognition],
|
|
845
|
-
);
|
|
846
|
-
|
|
847
|
-
const stopListening = useCallback(
|
|
848
|
-
async (options?: { submit?: boolean }) => {
|
|
849
|
-
const mode = listeningModeRef.current;
|
|
850
|
-
if (mode === "idle") return;
|
|
851
|
-
|
|
852
|
-
const submit = options?.submit === true;
|
|
853
|
-
enabledRef.current = false;
|
|
854
|
-
|
|
855
|
-
if (sttBackendRef.current === "talkmode") {
|
|
856
|
-
await getTalkModePlugin()
|
|
857
|
-
.stop()
|
|
858
|
-
.catch(() => {
|
|
859
|
-
/* ignore */
|
|
860
|
-
});
|
|
861
|
-
await new Promise((resolve) =>
|
|
862
|
-
window.setTimeout(resolve, TALKMODE_STOP_SETTLE_MS),
|
|
863
|
-
);
|
|
864
|
-
} else {
|
|
865
|
-
recognitionRef.current?.stop();
|
|
866
|
-
await new Promise((resolve) =>
|
|
867
|
-
window.setTimeout(resolve, TALKMODE_STOP_SETTLE_MS),
|
|
868
|
-
);
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
finalizeRecognition(submit);
|
|
872
|
-
},
|
|
873
|
-
[finalizeRecognition],
|
|
874
|
-
);
|
|
875
|
-
|
|
876
|
-
const toggleListening = useCallback(() => {
|
|
877
|
-
if (enabledRef.current && listeningModeRef.current === "compose") {
|
|
878
|
-
void stopListening();
|
|
879
|
-
return;
|
|
880
|
-
}
|
|
881
|
-
if (enabledRef.current) return;
|
|
882
|
-
void startListening("compose");
|
|
883
|
-
}, [startListening, stopListening]);
|
|
884
|
-
|
|
885
|
-
// ── Cancel helpers ────────────────────────────────────────────────
|
|
886
|
-
|
|
887
|
-
/** Stop all in-progress speech playback/requests but keep assistant queue state. */
|
|
888
|
-
const cancelPlayback = useCallback(() => {
|
|
889
|
-
generationRef.current += 1;
|
|
890
|
-
queueRef.current = [];
|
|
891
|
-
|
|
892
|
-
activeFetchAbortRef.current?.abort();
|
|
893
|
-
activeFetchAbortRef.current = null;
|
|
894
|
-
|
|
895
|
-
activeTaskFinishRef.current?.();
|
|
896
|
-
activeTaskFinishRef.current = null;
|
|
897
|
-
|
|
898
|
-
// Browser TTS
|
|
899
|
-
synthRef.current?.cancel();
|
|
900
|
-
utteranceRef.current = null;
|
|
901
|
-
|
|
902
|
-
// ElevenLabs audio
|
|
903
|
-
if (audioSourceRef.current) {
|
|
904
|
-
try {
|
|
905
|
-
audioSourceRef.current.stop();
|
|
906
|
-
} catch {
|
|
907
|
-
/* ok */
|
|
908
|
-
}
|
|
909
|
-
try {
|
|
910
|
-
audioSourceRef.current.disconnect();
|
|
911
|
-
} catch {
|
|
912
|
-
/* ok */
|
|
913
|
-
}
|
|
914
|
-
audioSourceRef.current = null;
|
|
915
|
-
}
|
|
916
|
-
|
|
917
|
-
clearSpeechTimers();
|
|
918
|
-
usingAudioAnalysisRef.current = false;
|
|
919
|
-
setUsingAudioAnalysis(false);
|
|
920
|
-
}, [clearSpeechTimers]);
|
|
921
|
-
|
|
922
|
-
const stopSpeaking = useCallback(() => {
|
|
923
|
-
assistantSpeechRef.current = null;
|
|
924
|
-
cancelPlayback();
|
|
925
|
-
setIsSpeaking(false);
|
|
926
|
-
setUsingAudioAnalysis(false);
|
|
927
|
-
}, [cancelPlayback]);
|
|
928
|
-
interruptSpeechRef.current = stopSpeaking;
|
|
929
|
-
|
|
930
|
-
// ── ElevenLabs TTS ────────────────────────────────────────────────
|
|
931
|
-
|
|
932
|
-
const speakElevenLabs = useCallback(
|
|
933
|
-
async (
|
|
934
|
-
text: string,
|
|
935
|
-
elConfig: NonNullable<VoiceConfig["elevenlabs"]>,
|
|
936
|
-
task: SpeakTask,
|
|
937
|
-
generation: number,
|
|
938
|
-
) => {
|
|
939
|
-
let ctx = audioCtxRef.current;
|
|
940
|
-
if (!ctx) {
|
|
941
|
-
ctx = new AudioContext();
|
|
942
|
-
audioCtxRef.current = ctx;
|
|
943
|
-
}
|
|
944
|
-
if (ctx.state === "suspended") {
|
|
945
|
-
try {
|
|
946
|
-
await ctx.resume();
|
|
947
|
-
} catch {
|
|
948
|
-
// Force a fresh context if resume fails
|
|
949
|
-
ctx.close().catch(() => {});
|
|
950
|
-
ctx = new AudioContext();
|
|
951
|
-
audioCtxRef.current = ctx;
|
|
952
|
-
}
|
|
953
|
-
}
|
|
954
|
-
|
|
955
|
-
const voiceId = elConfig.voiceId ?? DEFAULT_ELEVEN_VOICE;
|
|
956
|
-
const modelId = elConfig.modelId ?? DEFAULT_ELEVEN_MODEL;
|
|
957
|
-
|
|
958
|
-
const cacheKey = task.cacheKey ?? makeElevenCacheKey(text, elConfig);
|
|
959
|
-
const cachedBytes = elevenCacheRef.current.get(cacheKey);
|
|
960
|
-
let audioBytes: Uint8Array | null = null;
|
|
961
|
-
let cached = false;
|
|
962
|
-
|
|
963
|
-
if (cachedBytes) {
|
|
964
|
-
elevenCacheRef.current.delete(cacheKey);
|
|
965
|
-
elevenCacheRef.current.set(cacheKey, cachedBytes);
|
|
966
|
-
audioBytes = cachedBytes.slice();
|
|
967
|
-
cached = true;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
if (!audioBytes) {
|
|
971
|
-
const controller = new AbortController();
|
|
972
|
-
activeFetchAbortRef.current = controller;
|
|
973
|
-
|
|
974
|
-
const requestBody = {
|
|
975
|
-
text,
|
|
976
|
-
model_id: modelId,
|
|
977
|
-
apply_text_normalization: "auto",
|
|
978
|
-
voice_settings: {
|
|
979
|
-
stability: elConfig.stability ?? 0.5,
|
|
980
|
-
similarity_boost: elConfig.similarityBoost ?? 0.75,
|
|
981
|
-
speed: elConfig.speed ?? 1.0,
|
|
982
|
-
},
|
|
983
|
-
};
|
|
984
|
-
const apiToken = getElizaApiToken()?.trim() ?? "";
|
|
985
|
-
|
|
986
|
-
const fetchViaProxy = async () => {
|
|
987
|
-
return fetch(resolveElevenProxyEndpoint(), {
|
|
988
|
-
method: "POST",
|
|
989
|
-
headers: {
|
|
990
|
-
"Content-Type": "application/json",
|
|
991
|
-
Accept: "audio/mpeg",
|
|
992
|
-
...(apiToken ? { Authorization: `Bearer ${apiToken}` } : {}),
|
|
993
|
-
},
|
|
994
|
-
body: JSON.stringify({
|
|
995
|
-
...requestBody,
|
|
996
|
-
voiceId,
|
|
997
|
-
modelId,
|
|
998
|
-
outputFormat: "mp3_44100_128",
|
|
999
|
-
}),
|
|
1000
|
-
signal: controller.signal,
|
|
1001
|
-
});
|
|
1002
|
-
};
|
|
1003
|
-
|
|
1004
|
-
const trimmedApiKey =
|
|
1005
|
-
typeof elConfig.apiKey === "string" ? elConfig.apiKey.trim() : "";
|
|
1006
|
-
const hasDirectKey =
|
|
1007
|
-
trimmedApiKey.length > 0 && !isRedactedSecret(trimmedApiKey);
|
|
1008
|
-
|
|
1009
|
-
let res: Response;
|
|
1010
|
-
if (hasDirectKey) {
|
|
1011
|
-
try {
|
|
1012
|
-
const url = new URL(
|
|
1013
|
-
`https://api.elevenlabs.io/v1/text-to-speech/${encodeURIComponent(voiceId)}/stream`,
|
|
1014
|
-
);
|
|
1015
|
-
url.searchParams.set("output_format", "mp3_44100_128");
|
|
1016
|
-
res = await fetch(url.toString(), {
|
|
1017
|
-
method: "POST",
|
|
1018
|
-
headers: {
|
|
1019
|
-
"xi-api-key": trimmedApiKey,
|
|
1020
|
-
"Content-Type": "application/json",
|
|
1021
|
-
Accept: "audio/mpeg",
|
|
1022
|
-
},
|
|
1023
|
-
body: JSON.stringify(requestBody),
|
|
1024
|
-
signal: controller.signal,
|
|
1025
|
-
});
|
|
1026
|
-
} catch {
|
|
1027
|
-
res = await fetchViaProxy();
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
// If the locally-available key is stale, fall back to server-side key.
|
|
1031
|
-
if (!res.ok && (res.status === 401 || res.status === 403)) {
|
|
1032
|
-
const proxyRes = await fetchViaProxy();
|
|
1033
|
-
if (proxyRes.ok) {
|
|
1034
|
-
res = proxyRes;
|
|
1035
|
-
}
|
|
1036
|
-
}
|
|
1037
|
-
} else {
|
|
1038
|
-
res = await fetchViaProxy();
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
if (activeFetchAbortRef.current === controller) {
|
|
1042
|
-
activeFetchAbortRef.current = null;
|
|
1043
|
-
}
|
|
1044
|
-
|
|
1045
|
-
if (!res.ok) {
|
|
1046
|
-
const body = await res.text().catch(() => "");
|
|
1047
|
-
throw new Error(`ElevenLabs ${res.status}: ${body.slice(0, 200)}`);
|
|
1048
|
-
}
|
|
1049
|
-
|
|
1050
|
-
const audioData = await res.arrayBuffer();
|
|
1051
|
-
audioBytes = new Uint8Array(audioData);
|
|
1052
|
-
rememberCachedSegment(cacheKey, audioBytes.slice());
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
if (generation !== generationRef.current) return;
|
|
1056
|
-
const audioBuffer = await ctx.decodeAudioData(toArrayBuffer(audioBytes));
|
|
1057
|
-
if (generation !== generationRef.current) return;
|
|
1058
|
-
|
|
1059
|
-
const analyser = ctx.createAnalyser();
|
|
1060
|
-
analyser.fftSize = 2048;
|
|
1061
|
-
analyser.smoothingTimeConstant = 0.8;
|
|
1062
|
-
analyserRef.current = analyser;
|
|
1063
|
-
timeDomainDataRef.current = new Float32Array(
|
|
1064
|
-
new ArrayBuffer(analyser.fftSize * Float32Array.BYTES_PER_ELEMENT),
|
|
1065
|
-
);
|
|
1066
|
-
|
|
1067
|
-
const source = ctx.createBufferSource();
|
|
1068
|
-
source.buffer = audioBuffer;
|
|
1069
|
-
source.connect(analyser);
|
|
1070
|
-
analyser.connect(ctx.destination);
|
|
1071
|
-
audioSourceRef.current = source;
|
|
1072
|
-
|
|
1073
|
-
await new Promise<void>((resolve) => {
|
|
1074
|
-
let finished = false;
|
|
1075
|
-
const finish = () => {
|
|
1076
|
-
if (finished) return;
|
|
1077
|
-
finished = true;
|
|
1078
|
-
if (activeTaskFinishRef.current === finish) {
|
|
1079
|
-
activeTaskFinishRef.current = null;
|
|
1080
|
-
}
|
|
1081
|
-
if (audioSourceRef.current === source) {
|
|
1082
|
-
audioSourceRef.current = null;
|
|
1083
|
-
}
|
|
1084
|
-
source.onended = null;
|
|
1085
|
-
try {
|
|
1086
|
-
source.disconnect();
|
|
1087
|
-
} catch {
|
|
1088
|
-
/* ok */
|
|
1089
|
-
}
|
|
1090
|
-
try {
|
|
1091
|
-
analyser.disconnect();
|
|
1092
|
-
} catch {
|
|
1093
|
-
/* ok */
|
|
1094
|
-
}
|
|
1095
|
-
clearSpeechTimers();
|
|
1096
|
-
resolve();
|
|
1097
|
-
};
|
|
1098
|
-
|
|
1099
|
-
activeTaskFinishRef.current = finish;
|
|
1100
|
-
source.onended = finish;
|
|
1101
|
-
|
|
1102
|
-
speechTimeoutRef.current = setTimeout(
|
|
1103
|
-
finish,
|
|
1104
|
-
Math.max(2500, Math.ceil(audioBuffer.duration * 1000) + 1200),
|
|
1105
|
-
);
|
|
1106
|
-
|
|
1107
|
-
source.start(0);
|
|
1108
|
-
emitPlaybackStart({
|
|
1109
|
-
text,
|
|
1110
|
-
segment: task.segment,
|
|
1111
|
-
provider: "elevenlabs",
|
|
1112
|
-
cached,
|
|
1113
|
-
startedAtMs: performance.now(),
|
|
1114
|
-
});
|
|
1115
|
-
});
|
|
1116
|
-
},
|
|
1117
|
-
[clearSpeechTimers, makeElevenCacheKey, rememberCachedSegment],
|
|
1118
|
-
);
|
|
1119
|
-
|
|
1120
|
-
// ── Browser SpeechSynthesis TTS ───────────────────────────────────
|
|
1121
|
-
|
|
1122
|
-
const speakBrowser = useCallback(
|
|
1123
|
-
(text: string, task: SpeakTask, generation: number) => {
|
|
1124
|
-
const synth = synthRef.current;
|
|
1125
|
-
const words = text.trim().split(/\s+/).length;
|
|
1126
|
-
const estimatedMs = Math.max(1200, (words / 3) * 1000);
|
|
1127
|
-
|
|
1128
|
-
return new Promise<void>((resolve) => {
|
|
1129
|
-
let finished = false;
|
|
1130
|
-
const finish = () => {
|
|
1131
|
-
if (finished) return;
|
|
1132
|
-
finished = true;
|
|
1133
|
-
if (activeTaskFinishRef.current === finish) {
|
|
1134
|
-
activeTaskFinishRef.current = null;
|
|
1135
|
-
}
|
|
1136
|
-
clearSpeechTimers();
|
|
1137
|
-
utteranceRef.current = null;
|
|
1138
|
-
resolve();
|
|
1139
|
-
};
|
|
1140
|
-
|
|
1141
|
-
activeTaskFinishRef.current = finish;
|
|
1142
|
-
|
|
1143
|
-
if (!synth) {
|
|
1144
|
-
emitPlaybackStart({
|
|
1145
|
-
text,
|
|
1146
|
-
segment: task.segment,
|
|
1147
|
-
provider: "browser",
|
|
1148
|
-
cached: false,
|
|
1149
|
-
startedAtMs: performance.now(),
|
|
1150
|
-
});
|
|
1151
|
-
speechTimeoutRef.current = setTimeout(finish, estimatedMs);
|
|
1152
|
-
return;
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
const utterance = new SpeechSynthesisUtterance(text.trim());
|
|
1156
|
-
utteranceRef.current = utterance;
|
|
1157
|
-
utterance.rate = 1.0;
|
|
1158
|
-
utterance.pitch = 1.0;
|
|
1159
|
-
utterance.onstart = () => {
|
|
1160
|
-
if (generation !== generationRef.current) return;
|
|
1161
|
-
emitPlaybackStart({
|
|
1162
|
-
text,
|
|
1163
|
-
segment: task.segment,
|
|
1164
|
-
provider: "browser",
|
|
1165
|
-
cached: false,
|
|
1166
|
-
startedAtMs: performance.now(),
|
|
1167
|
-
});
|
|
1168
|
-
};
|
|
1169
|
-
utterance.onend = finish;
|
|
1170
|
-
utterance.onerror = finish;
|
|
1171
|
-
synth.speak(utterance);
|
|
1172
|
-
|
|
1173
|
-
speechTimeoutRef.current = setTimeout(finish, estimatedMs + 5000);
|
|
1174
|
-
});
|
|
1175
|
-
},
|
|
1176
|
-
[clearSpeechTimers],
|
|
1177
|
-
);
|
|
1178
|
-
|
|
1179
|
-
const processQueue = useCallback(() => {
|
|
1180
|
-
if (queueWorkerRunningRef.current) return;
|
|
1181
|
-
queueWorkerRunningRef.current = true;
|
|
1182
|
-
const workerGeneration = generationRef.current;
|
|
1183
|
-
|
|
1184
|
-
void (async () => {
|
|
1185
|
-
try {
|
|
1186
|
-
while (queueRef.current.length > 0) {
|
|
1187
|
-
if (workerGeneration !== generationRef.current) return;
|
|
1188
|
-
const task = queueRef.current.shift();
|
|
1189
|
-
if (!task) break;
|
|
1190
|
-
|
|
1191
|
-
const config = voiceConfigRef.current;
|
|
1192
|
-
const elConfig = config?.elevenlabs;
|
|
1193
|
-
const useElevenLabs = config?.provider === "elevenlabs";
|
|
1194
|
-
|
|
1195
|
-
if (useElevenLabs && elConfig) {
|
|
1196
|
-
usingAudioAnalysisRef.current = true;
|
|
1197
|
-
setUsingAudioAnalysis(true);
|
|
1198
|
-
try {
|
|
1199
|
-
await speakElevenLabs(
|
|
1200
|
-
task.text,
|
|
1201
|
-
elConfig,
|
|
1202
|
-
task,
|
|
1203
|
-
workerGeneration,
|
|
1204
|
-
);
|
|
1205
|
-
continue;
|
|
1206
|
-
} catch (error) {
|
|
1207
|
-
if (
|
|
1208
|
-
workerGeneration !== generationRef.current ||
|
|
1209
|
-
isAbortError(error)
|
|
1210
|
-
) {
|
|
1211
|
-
return;
|
|
1212
|
-
}
|
|
1213
|
-
console.warn(
|
|
1214
|
-
"[useVoiceChat] ElevenLabs TTS failed, falling back to browser:",
|
|
1215
|
-
error instanceof Error
|
|
1216
|
-
? `${error.name}: ${error.message}`
|
|
1217
|
-
: error,
|
|
1218
|
-
);
|
|
1219
|
-
usingAudioAnalysisRef.current = false;
|
|
1220
|
-
setUsingAudioAnalysis(false);
|
|
1221
|
-
}
|
|
1222
|
-
} else {
|
|
1223
|
-
usingAudioAnalysisRef.current = false;
|
|
1224
|
-
setUsingAudioAnalysis(false);
|
|
1225
|
-
}
|
|
1226
|
-
|
|
1227
|
-
await speakBrowser(task.text, task, workerGeneration);
|
|
1228
|
-
}
|
|
1229
|
-
} finally {
|
|
1230
|
-
queueWorkerRunningRef.current = false;
|
|
1231
|
-
}
|
|
1232
|
-
if (workerGeneration !== generationRef.current) return;
|
|
1233
|
-
if (queueRef.current.length > 0) {
|
|
1234
|
-
processQueue();
|
|
1235
|
-
return;
|
|
1236
|
-
}
|
|
1237
|
-
usingAudioAnalysisRef.current = false;
|
|
1238
|
-
setUsingAudioAnalysis(false);
|
|
1239
|
-
setIsSpeaking(false);
|
|
1240
|
-
})();
|
|
1241
|
-
}, [speakBrowser, speakElevenLabs]);
|
|
1242
|
-
|
|
1243
|
-
const enqueueSpeech = useCallback(
|
|
1244
|
-
(task: SpeakTask) => {
|
|
1245
|
-
const speakable = toSpeakableText(task.text);
|
|
1246
|
-
if (!speakable) return;
|
|
1247
|
-
|
|
1248
|
-
if (!task.append) {
|
|
1249
|
-
cancelPlayback();
|
|
1250
|
-
}
|
|
1251
|
-
|
|
1252
|
-
queueRef.current.push({ ...task, text: speakable });
|
|
1253
|
-
speakingStartRef.current = Date.now();
|
|
1254
|
-
setIsSpeaking(true);
|
|
1255
|
-
processQueue();
|
|
1256
|
-
},
|
|
1257
|
-
[cancelPlayback, processQueue],
|
|
1258
|
-
);
|
|
1259
|
-
|
|
1260
|
-
// ── Public speak APIs ─────────────────────────────────────────────
|
|
1261
|
-
|
|
1262
|
-
const speak = useCallback(
|
|
1263
|
-
(text: string, speakOptions?: { append?: boolean }) => {
|
|
1264
|
-
assistantSpeechRef.current = null;
|
|
1265
|
-
enqueueSpeech({
|
|
1266
|
-
text,
|
|
1267
|
-
append: Boolean(speakOptions?.append),
|
|
1268
|
-
segment: "full",
|
|
1269
|
-
});
|
|
1270
|
-
},
|
|
1271
|
-
[enqueueSpeech],
|
|
1272
|
-
);
|
|
1273
|
-
|
|
1274
|
-
const queueAssistantSpeech = useCallback(
|
|
1275
|
-
(messageId: string, text: string, isFinal: boolean) => {
|
|
1276
|
-
if (!messageId) return;
|
|
1277
|
-
|
|
1278
|
-
const speakable = toSpeakableText(text);
|
|
1279
|
-
if (!speakable) return;
|
|
1280
|
-
|
|
1281
|
-
const current = assistantSpeechRef.current;
|
|
1282
|
-
if (!current || current.messageId !== messageId) {
|
|
1283
|
-
assistantSpeechRef.current = {
|
|
1284
|
-
messageId,
|
|
1285
|
-
lastObservedText: "",
|
|
1286
|
-
firstSentenceSpoken: false,
|
|
1287
|
-
firstSentenceText: "",
|
|
1288
|
-
queuedRemainderText: "",
|
|
1289
|
-
finalQueued: false,
|
|
1290
|
-
};
|
|
1291
|
-
}
|
|
1292
|
-
|
|
1293
|
-
const state = assistantSpeechRef.current;
|
|
1294
|
-
if (!state) return;
|
|
1295
|
-
|
|
1296
|
-
if (
|
|
1297
|
-
speakable === state.lastObservedText &&
|
|
1298
|
-
(!isFinal || state.finalQueued)
|
|
1299
|
-
) {
|
|
1300
|
-
return;
|
|
1301
|
-
}
|
|
1302
|
-
state.lastObservedText = speakable;
|
|
1303
|
-
|
|
1304
|
-
if (!state.firstSentenceSpoken) {
|
|
1305
|
-
const split = splitFirstSentence(speakable);
|
|
1306
|
-
if (!split.complete && !isFinal) return;
|
|
1307
|
-
|
|
1308
|
-
if (split.complete) {
|
|
1309
|
-
const firstSentence = split.firstSentence;
|
|
1310
|
-
state.firstSentenceSpoken = true;
|
|
1311
|
-
state.firstSentenceText = firstSentence;
|
|
1312
|
-
|
|
1313
|
-
const elConfig = voiceConfigRef.current?.elevenlabs;
|
|
1314
|
-
const cacheKey =
|
|
1315
|
-
voiceConfigRef.current?.provider === "elevenlabs" && elConfig
|
|
1316
|
-
? makeElevenCacheKey(firstSentence, elConfig)
|
|
1317
|
-
: undefined;
|
|
1318
|
-
|
|
1319
|
-
enqueueSpeech({
|
|
1320
|
-
text: firstSentence,
|
|
1321
|
-
append: false,
|
|
1322
|
-
segment: "first-sentence",
|
|
1323
|
-
cacheKey,
|
|
1324
|
-
});
|
|
1325
|
-
|
|
1326
|
-
const queueableRemainder = queueableSpeechPrefix(
|
|
1327
|
-
split.remainder,
|
|
1328
|
-
isFinal,
|
|
1329
|
-
);
|
|
1330
|
-
if (queueableRemainder) {
|
|
1331
|
-
enqueueSpeech({
|
|
1332
|
-
text: queueableRemainder,
|
|
1333
|
-
append: true,
|
|
1334
|
-
segment: "remainder",
|
|
1335
|
-
});
|
|
1336
|
-
state.queuedRemainderText = queueableRemainder;
|
|
1337
|
-
}
|
|
1338
|
-
if (isFinal) {
|
|
1339
|
-
state.finalQueued = true;
|
|
1340
|
-
}
|
|
1341
|
-
return;
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
enqueueSpeech({
|
|
1345
|
-
text: speakable,
|
|
1346
|
-
append: false,
|
|
1347
|
-
segment: "full",
|
|
1348
|
-
});
|
|
1349
|
-
state.finalQueued = true;
|
|
1350
|
-
return;
|
|
1351
|
-
}
|
|
1352
|
-
|
|
1353
|
-
const remainder = remainderAfter(speakable, state.firstSentenceText);
|
|
1354
|
-
const queueableRemainder = queueableSpeechPrefix(remainder, isFinal);
|
|
1355
|
-
const newRemainderDelta = remainderAfter(
|
|
1356
|
-
queueableRemainder,
|
|
1357
|
-
state.queuedRemainderText,
|
|
1358
|
-
);
|
|
1359
|
-
if (newRemainderDelta) {
|
|
1360
|
-
enqueueSpeech({
|
|
1361
|
-
text: newRemainderDelta,
|
|
1362
|
-
append: true,
|
|
1363
|
-
segment: "remainder",
|
|
1364
|
-
});
|
|
1365
|
-
state.queuedRemainderText = queueableRemainder;
|
|
1366
|
-
}
|
|
1367
|
-
|
|
1368
|
-
if (isFinal && !state.finalQueued) {
|
|
1369
|
-
state.finalQueued = true;
|
|
1370
|
-
}
|
|
1371
|
-
},
|
|
1372
|
-
[enqueueSpeech, makeElevenCacheKey],
|
|
1373
|
-
);
|
|
1374
|
-
|
|
1375
|
-
// ── Keep ElevenLabs runtime warm for lower startup latency ────────
|
|
1376
|
-
|
|
1377
|
-
useEffect(() => {
|
|
1378
|
-
const config = effectiveVoiceConfig;
|
|
1379
|
-
if (
|
|
1380
|
-
typeof window === "undefined" ||
|
|
1381
|
-
config?.provider !== "elevenlabs" ||
|
|
1382
|
-
!config.elevenlabs
|
|
1383
|
-
) {
|
|
1384
|
-
return;
|
|
1385
|
-
}
|
|
1386
|
-
|
|
1387
|
-
const warmAudioContext = () => {
|
|
1388
|
-
if (!audioCtxRef.current) {
|
|
1389
|
-
audioCtxRef.current = new AudioContext();
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
void audioCtxRef.current.resume().catch(() => {
|
|
1393
|
-
// Ignore until the next gesture or playback attempt.
|
|
1394
|
-
});
|
|
1395
|
-
};
|
|
1396
|
-
const handleUserGesture = () => {
|
|
1397
|
-
window.removeEventListener("pointerdown", handleUserGesture, true);
|
|
1398
|
-
window.removeEventListener("keydown", handleUserGesture, true);
|
|
1399
|
-
warmAudioContext();
|
|
1400
|
-
};
|
|
1401
|
-
|
|
1402
|
-
window.addEventListener("pointerdown", handleUserGesture, true);
|
|
1403
|
-
window.addEventListener("keydown", handleUserGesture, true);
|
|
1404
|
-
|
|
1405
|
-
return () => {
|
|
1406
|
-
window.removeEventListener("pointerdown", handleUserGesture, true);
|
|
1407
|
-
window.removeEventListener("keydown", handleUserGesture, true);
|
|
1408
|
-
};
|
|
1409
|
-
}, [effectiveVoiceConfig]);
|
|
1410
|
-
|
|
1411
|
-
// ── Cleanup on unmount ────────────────────────────────────────────
|
|
1412
|
-
|
|
1413
|
-
useEffect(() => {
|
|
1414
|
-
return () => {
|
|
1415
|
-
void stopListening();
|
|
1416
|
-
void removeTalkModeListeners();
|
|
1417
|
-
stopSpeaking();
|
|
1418
|
-
if (audioCtxRef.current) {
|
|
1419
|
-
void audioCtxRef.current.close().catch(() => {
|
|
1420
|
-
/* ignore */
|
|
1421
|
-
});
|
|
1422
|
-
audioCtxRef.current = null;
|
|
1423
|
-
}
|
|
1424
|
-
};
|
|
1425
|
-
}, [removeTalkModeListeners, stopListening, stopSpeaking]);
|
|
1426
|
-
|
|
1427
|
-
return {
|
|
1428
|
-
isListening,
|
|
1429
|
-
captureMode,
|
|
1430
|
-
isSpeaking,
|
|
1431
|
-
mouthOpen,
|
|
1432
|
-
interimTranscript,
|
|
1433
|
-
supported,
|
|
1434
|
-
usingAudioAnalysis,
|
|
1435
|
-
toggleListening,
|
|
1436
|
-
startListening,
|
|
1437
|
-
stopListening,
|
|
1438
|
-
speak,
|
|
1439
|
-
queueAssistantSpeech,
|
|
1440
|
-
stopSpeaking,
|
|
1441
|
-
};
|
|
1442
|
-
}
|