@jingyi0605/codingns4dsh 0.2.1-beta.2 → 0.2.1-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +8 -8
- package/README.md +103 -14
- package/THIRD_PARTY_NOTICES +141 -0
- package/assets/assistant-basics/female-v1.png +0 -0
- package/assets/assistant-basics/male-v1.png +0 -0
- package/assets/desktop-assistant/20261008-WebView2/345/210/206/345/217/221/350/257/264/346/230/216.md +14 -0
- package/assets/desktop-assistant/webview2/LICENSE.txt +27 -0
- package/assets/desktop-assistant/webview2/Microsoft.Web.WebView2.Core.dll +0 -0
- package/assets/desktop-assistant/webview2/Microsoft.Web.WebView2.Wpf.dll +0 -0
- package/assets/desktop-assistant/webview2/NOTICE.txt +85 -0
- package/assets/desktop-assistant/webview2/arm64/WebView2Loader.dll +0 -0
- package/assets/desktop-assistant/webview2/x64/WebView2Loader.dll +0 -0
- package/assets/desktop-assistant/webview2/x86/WebView2Loader.dll +0 -0
- package/assets/moss/LICENSE +201 -0
- package/assets/moss/ort_cpu_runtime.py +839 -0
- package/assets/moss/worker.py +278 -0
- package/assets/voice/bilingual-zh-en-bpe.vocab +500 -0
- package/avatar-packages/catalog.json +259 -0
- package/avatar-packages/manifests/bubu-codebrew-bear.avatar.json +13 -0
- package/avatar-packages/manifests/ds-whale-live2d.avatar.json +27 -0
- package/avatar-packages/manifests/ds-whale-sprite.avatar.json +13 -0
- package/avatar-packages/manifests/live2d-haru.avatar.json +13 -0
- package/avatar-packages/manifests/live2d-hiyori.avatar.json +13 -0
- package/avatar-packages/manifests/live2d-mao.avatar.json +13 -0
- package/avatar-packages/manifests/live2d-mark.avatar.json +13 -0
- package/avatar-packages/manifests/live2d-rice.avatar.json +13 -0
- package/avatar-packages/manifests/live2d-wanko.avatar.json +13 -0
- package/avatar-packages/manifests/nastya.avatar.json +13 -0
- package/avatar-packages/manifests/scout-corgi.avatar.json +13 -0
- package/avatar-packages/manifests/xiaoman.avatar.json +13 -0
- package/data/build/dist/client/assistant-settings-styles.d.ts +7 -0
- package/data/build/dist/client/assistant-settings-styles.d.ts.map +1 -0
- package/data/build/dist/client/assistant-settings-styles.js +6 -0
- package/data/build/dist/client/assistant-settings-styles.js.map +1 -0
- package/data/build/dist/client/avatar/builtin.d.ts +5 -0
- package/data/build/dist/client/avatar/builtin.d.ts.map +1 -0
- package/data/build/dist/client/avatar/builtin.js +9 -0
- package/data/build/dist/client/avatar/builtin.js.map +1 -0
- package/data/build/dist/client/avatar/cache-status.d.ts +4 -0
- package/data/build/dist/client/avatar/cache-status.d.ts.map +1 -0
- package/data/build/dist/client/avatar/cache-status.js +40 -0
- package/data/build/dist/client/avatar/cache-status.js.map +1 -0
- package/data/build/dist/client/avatar/catalog-panel.d.ts +49 -0
- package/data/build/dist/client/avatar/catalog-panel.d.ts.map +1 -0
- package/data/build/dist/client/avatar/catalog-panel.js +245 -0
- package/data/build/dist/client/avatar/catalog-panel.js.map +1 -0
- package/data/build/dist/client/avatar/catalog-picker.d.ts +38 -0
- package/data/build/dist/client/avatar/catalog-picker.d.ts.map +1 -0
- package/data/build/dist/client/avatar/catalog-picker.js +65 -0
- package/data/build/dist/client/avatar/catalog-picker.js.map +1 -0
- package/data/build/dist/client/avatar/desktop-bridge.d.ts +21 -0
- package/data/build/dist/client/avatar/desktop-bridge.d.ts.map +1 -0
- package/data/build/dist/client/avatar/desktop-bridge.js +109 -0
- package/data/build/dist/client/avatar/desktop-bridge.js.map +1 -0
- package/data/build/dist/client/avatar/desktop-entry.d.ts +2 -0
- package/data/build/dist/client/avatar/desktop-entry.d.ts.map +1 -0
- package/data/build/dist/client/avatar/desktop-entry.js +34 -0
- package/data/build/dist/client/avatar/desktop-entry.js.map +1 -0
- package/data/build/dist/client/avatar/desktop-view.d.ts +23 -0
- package/data/build/dist/client/avatar/desktop-view.d.ts.map +1 -0
- package/data/build/dist/client/avatar/desktop-view.js +72 -0
- package/data/build/dist/client/avatar/desktop-view.js.map +1 -0
- package/data/build/dist/client/avatar/engine.d.ts +45 -0
- package/data/build/dist/client/avatar/engine.d.ts.map +1 -0
- package/data/build/dist/client/avatar/engine.js +165 -0
- package/data/build/dist/client/avatar/engine.js.map +1 -0
- package/data/build/dist/client/avatar/floating.d.ts +20 -0
- package/data/build/dist/client/avatar/floating.d.ts.map +1 -0
- package/data/build/dist/client/avatar/floating.js +99 -0
- package/data/build/dist/client/avatar/floating.js.map +1 -0
- package/data/build/dist/client/avatar/image.d.ts +5 -0
- package/data/build/dist/client/avatar/image.d.ts.map +1 -0
- package/data/build/dist/client/avatar/image.js +22 -0
- package/data/build/dist/client/avatar/image.js.map +1 -0
- package/data/build/dist/client/avatar/live2d.d.ts +65 -0
- package/data/build/dist/client/avatar/live2d.d.ts.map +1 -0
- package/data/build/dist/client/avatar/live2d.js +278 -0
- package/data/build/dist/client/avatar/live2d.js.map +1 -0
- package/data/build/dist/client/avatar/loading.d.ts +27 -0
- package/data/build/dist/client/avatar/loading.d.ts.map +1 -0
- package/data/build/dist/client/avatar/loading.js +74 -0
- package/data/build/dist/client/avatar/loading.js.map +1 -0
- package/data/build/dist/client/avatar/manager.d.ts +71 -0
- package/data/build/dist/client/avatar/manager.d.ts.map +1 -0
- package/data/build/dist/client/avatar/manager.js +321 -0
- package/data/build/dist/client/avatar/manager.js.map +1 -0
- package/data/build/dist/client/avatar/portrait-capture.d.ts +30 -0
- package/data/build/dist/client/avatar/portrait-capture.d.ts.map +1 -0
- package/data/build/dist/client/avatar/portrait-capture.js +233 -0
- package/data/build/dist/client/avatar/portrait-capture.js.map +1 -0
- package/data/build/dist/client/avatar/portrait-editor.d.ts +14 -0
- package/data/build/dist/client/avatar/portrait-editor.d.ts.map +1 -0
- package/data/build/dist/client/avatar/portrait-editor.js +105 -0
- package/data/build/dist/client/avatar/portrait-editor.js.map +1 -0
- package/data/build/dist/client/avatar/portrait-service.d.ts +51 -0
- package/data/build/dist/client/avatar/portrait-service.d.ts.map +1 -0
- package/data/build/dist/client/avatar/portrait-service.js +244 -0
- package/data/build/dist/client/avatar/portrait-service.js.map +1 -0
- package/data/build/dist/client/avatar/portrait.d.ts +28 -0
- package/data/build/dist/client/avatar/portrait.d.ts.map +1 -0
- package/data/build/dist/client/avatar/portrait.js +56 -0
- package/data/build/dist/client/avatar/portrait.js.map +1 -0
- package/data/build/dist/client/avatar/preview-capture.d.ts +4 -0
- package/data/build/dist/client/avatar/preview-capture.d.ts.map +1 -0
- package/data/build/dist/client/avatar/preview-capture.js +100 -0
- package/data/build/dist/client/avatar/preview-capture.js.map +1 -0
- package/data/build/dist/client/avatar/preview-store.d.ts +41 -0
- package/data/build/dist/client/avatar/preview-store.d.ts.map +1 -0
- package/data/build/dist/client/avatar/preview-store.js +171 -0
- package/data/build/dist/client/avatar/preview-store.js.map +1 -0
- package/data/build/dist/client/avatar/preview.d.ts +14 -0
- package/data/build/dist/client/avatar/preview.d.ts.map +1 -0
- package/data/build/dist/client/avatar/preview.js +56 -0
- package/data/build/dist/client/avatar/preview.js.map +1 -0
- package/data/build/dist/client/avatar/registration.d.ts +2 -0
- package/data/build/dist/client/avatar/registration.d.ts.map +1 -0
- package/data/build/dist/client/avatar/registration.js +2 -0
- package/data/build/dist/client/avatar/registration.js.map +1 -0
- package/data/build/dist/client/avatar/registry.d.ts +45 -0
- package/data/build/dist/client/avatar/registry.d.ts.map +1 -0
- package/data/build/dist/client/avatar/registry.js +34 -0
- package/data/build/dist/client/avatar/registry.js.map +1 -0
- package/data/build/dist/client/avatar/settings-panel.d.ts +21 -0
- package/data/build/dist/client/avatar/settings-panel.d.ts.map +1 -0
- package/data/build/dist/client/avatar/settings-panel.js +169 -0
- package/data/build/dist/client/avatar/settings-panel.js.map +1 -0
- package/data/build/dist/client/avatar/slot.d.ts +17 -0
- package/data/build/dist/client/avatar/slot.d.ts.map +1 -0
- package/data/build/dist/client/avatar/slot.js +70 -0
- package/data/build/dist/client/avatar/slot.js.map +1 -0
- package/data/build/dist/client/avatar/spritesheet.d.ts +19 -0
- package/data/build/dist/client/avatar/spritesheet.d.ts.map +1 -0
- package/data/build/dist/client/avatar/spritesheet.js +91 -0
- package/data/build/dist/client/avatar/spritesheet.js.map +1 -0
- package/data/build/dist/client/avatar/temporary-preview.d.ts +25 -0
- package/data/build/dist/client/avatar/temporary-preview.d.ts.map +1 -0
- package/data/build/dist/client/avatar/temporary-preview.js +61 -0
- package/data/build/dist/client/avatar/temporary-preview.js.map +1 -0
- package/data/build/dist/client/bundle.js +25066 -2837
- package/data/build/dist/client/bundle.js.map +1 -1
- package/data/build/dist/client/cli-slots.d.ts.map +1 -1
- package/data/build/dist/client/cli-slots.js +9 -9
- package/data/build/dist/client/cli-slots.js.map +1 -1
- package/data/build/dist/client/desktop-assistant.js +8585 -0
- package/data/build/dist/client/features/assistant-composer-input.d.ts +10 -0
- package/data/build/dist/client/features/assistant-composer-input.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-composer-input.js +40 -0
- package/data/build/dist/client/features/assistant-composer-input.js.map +1 -0
- package/data/build/dist/client/features/assistant-configuration-session.d.ts +45 -0
- package/data/build/dist/client/features/assistant-configuration-session.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-configuration-session.js +252 -0
- package/data/build/dist/client/features/assistant-configuration-session.js.map +1 -0
- package/data/build/dist/client/features/assistant-configuration-tabs.d.ts +34 -0
- package/data/build/dist/client/features/assistant-configuration-tabs.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-configuration-tabs.js +48 -0
- package/data/build/dist/client/features/assistant-configuration-tabs.js.map +1 -0
- package/data/build/dist/client/features/assistant-conversation-message.d.ts +27 -0
- package/data/build/dist/client/features/assistant-conversation-message.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-conversation-message.js +55 -0
- package/data/build/dist/client/features/assistant-conversation-message.js.map +1 -0
- package/data/build/dist/client/features/assistant-debug-dialog.d.ts +3 -0
- package/data/build/dist/client/features/assistant-debug-dialog.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-debug-dialog.js +3 -0
- package/data/build/dist/client/features/assistant-debug-dialog.js.map +1 -0
- package/data/build/dist/client/features/assistant-debug-workbench.d.ts +48 -0
- package/data/build/dist/client/features/assistant-debug-workbench.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-debug-workbench.js +376 -0
- package/data/build/dist/client/features/assistant-debug-workbench.js.map +1 -0
- package/data/build/dist/client/features/assistant-floating-call.d.ts +33 -0
- package/data/build/dist/client/features/assistant-floating-call.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-floating-call.js +67 -0
- package/data/build/dist/client/features/assistant-floating-call.js.map +1 -0
- package/data/build/dist/client/features/assistant-panel.d.ts +2 -2
- package/data/build/dist/client/features/assistant-panel.d.ts.map +1 -1
- package/data/build/dist/client/features/assistant-panel.js +10 -123
- package/data/build/dist/client/features/assistant-panel.js.map +1 -1
- package/data/build/dist/client/features/assistant-realtime-call.d.ts +57 -0
- package/data/build/dist/client/features/assistant-realtime-call.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-realtime-call.js +131 -0
- package/data/build/dist/client/features/assistant-realtime-call.js.map +1 -0
- package/data/build/dist/client/features/assistant-record-style.d.ts +5 -0
- package/data/build/dist/client/features/assistant-record-style.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-record-style.js +25 -0
- package/data/build/dist/client/features/assistant-record-style.js.map +1 -0
- package/data/build/dist/client/features/assistant-voice-initialization.d.ts +26 -0
- package/data/build/dist/client/features/assistant-voice-initialization.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-voice-initialization.js +138 -0
- package/data/build/dist/client/features/assistant-voice-initialization.js.map +1 -0
- package/data/build/dist/client/features/assistant-voice-settings-group.d.ts +19 -0
- package/data/build/dist/client/features/assistant-voice-settings-group.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-voice-settings-group.js +34 -0
- package/data/build/dist/client/features/assistant-voice-settings-group.js.map +1 -0
- package/data/build/dist/client/features/assistant-voice-settings.d.ts +13 -0
- package/data/build/dist/client/features/assistant-voice-settings.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-voice-settings.js +184 -0
- package/data/build/dist/client/features/assistant-voice-settings.js.map +1 -0
- package/data/build/dist/client/features/assistant-workbench-controls.d.ts +72 -0
- package/data/build/dist/client/features/assistant-workbench-controls.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-workbench-controls.js +145 -0
- package/data/build/dist/client/features/assistant-workbench-controls.js.map +1 -0
- package/data/build/dist/client/features/assistant-workbench-entry.d.ts +4 -0
- package/data/build/dist/client/features/assistant-workbench-entry.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-workbench-entry.js +7 -0
- package/data/build/dist/client/features/assistant-workbench-entry.js.map +1 -0
- package/data/build/dist/client/features/assistant-workbench.d.ts +109 -0
- package/data/build/dist/client/features/assistant-workbench.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-workbench.js +568 -0
- package/data/build/dist/client/features/assistant-workbench.js.map +1 -0
- package/data/build/dist/client/features/global-voice-assistant.d.ts.map +1 -1
- package/data/build/dist/client/features/global-voice-assistant.js +88 -32
- package/data/build/dist/client/features/global-voice-assistant.js.map +1 -1
- package/data/build/dist/client/features/lan-access.js +2 -2
- package/data/build/dist/client/features/lan-access.js.map +1 -1
- package/data/build/dist/client/features/mobile-access.d.ts.map +1 -1
- package/data/build/dist/client/features/mobile-access.js +9 -0
- package/data/build/dist/client/features/mobile-access.js.map +1 -1
- package/data/build/dist/client/features/peer-host.d.ts +2 -0
- package/data/build/dist/client/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/client/features/peer-host.js +66 -73
- package/data/build/dist/client/features/peer-host.js.map +1 -1
- package/data/build/dist/client/features/types.d.ts +4 -0
- package/data/build/dist/client/features/types.d.ts.map +1 -1
- package/data/build/dist/client/features/voice-conversation-dialog.d.ts +9 -2
- package/data/build/dist/client/features/voice-conversation-dialog.d.ts.map +1 -1
- package/data/build/dist/client/features/voice-conversation-dialog.js +29 -7
- package/data/build/dist/client/features/voice-conversation-dialog.js.map +1 -1
- package/data/build/dist/client/features/voice-initialization-dialog.d.ts +42 -2
- package/data/build/dist/client/features/voice-initialization-dialog.d.ts.map +1 -1
- package/data/build/dist/client/features/voice-initialization-dialog.js +181 -67
- package/data/build/dist/client/features/voice-initialization-dialog.js.map +1 -1
- package/data/build/dist/client/global-voice-runtime-registry.d.ts +4 -0
- package/data/build/dist/client/global-voice-runtime-registry.d.ts.map +1 -1
- package/data/build/dist/client/global-voice-runtime-registry.js.map +1 -1
- package/data/build/dist/client/index.d.ts +11 -0
- package/data/build/dist/client/index.d.ts.map +1 -1
- package/data/build/dist/client/index.js +10 -0
- package/data/build/dist/client/index.js.map +1 -1
- package/data/build/dist/client/locale.d.ts.map +1 -1
- package/data/build/dist/client/locale.js +51 -14
- package/data/build/dist/client/locale.js.map +1 -1
- package/data/build/dist/client/locales/assistantAvatar.d.ts +138 -0
- package/data/build/dist/client/locales/assistantAvatar.d.ts.map +1 -0
- package/data/build/dist/client/locales/assistantAvatar.js +273 -0
- package/data/build/dist/client/locales/assistantAvatar.js.map +1 -0
- package/data/build/dist/client/locales/assistantDebug.d.ts +4 -0
- package/data/build/dist/client/locales/assistantDebug.d.ts.map +1 -0
- package/data/build/dist/client/locales/assistantDebug.js +362 -0
- package/data/build/dist/client/locales/assistantDebug.js.map +1 -0
- package/data/build/dist/client/locales/assistantTts.d.ts +80 -0
- package/data/build/dist/client/locales/assistantTts.d.ts.map +1 -0
- package/data/build/dist/client/locales/assistantTts.js +76 -0
- package/data/build/dist/client/locales/assistantTts.js.map +1 -0
- package/data/build/dist/client/locales/assistantWorkbench.d.ts +126 -0
- package/data/build/dist/client/locales/assistantWorkbench.d.ts.map +1 -0
- package/data/build/dist/client/locales/assistantWorkbench.js +96 -0
- package/data/build/dist/client/locales/assistantWorkbench.js.map +1 -0
- package/data/build/dist/client/locales/peerHostWorkspace.d.ts.map +1 -1
- package/data/build/dist/client/locales/peerHostWorkspace.js +16 -2
- package/data/build/dist/client/locales/peerHostWorkspace.js.map +1 -1
- package/data/build/dist/client/locales/terminalAuth.d.ts.map +1 -1
- package/data/build/dist/client/locales/terminalAuth.js +80 -0
- package/data/build/dist/client/locales/terminalAuth.js.map +1 -1
- package/data/build/dist/client/locales/voiceModels.d.ts +45 -0
- package/data/build/dist/client/locales/voiceModels.d.ts.map +1 -0
- package/data/build/dist/client/locales/voiceModels.js +85 -0
- package/data/build/dist/client/locales/voiceModels.js.map +1 -0
- package/data/build/dist/client/mobile-rightbar-tabs-dom.d.ts +29 -0
- package/data/build/dist/client/mobile-rightbar-tabs-dom.d.ts.map +1 -0
- package/data/build/dist/client/mobile-rightbar-tabs-dom.js +93 -0
- package/data/build/dist/client/mobile-rightbar-tabs-dom.js.map +1 -0
- package/data/build/dist/client/mobile-rightbar-visibility.d.ts +32 -0
- package/data/build/dist/client/mobile-rightbar-visibility.d.ts.map +1 -0
- package/data/build/dist/client/mobile-rightbar-visibility.js +188 -0
- package/data/build/dist/client/mobile-rightbar-visibility.js.map +1 -0
- package/data/build/dist/client/mobile-session-interaction.d.ts +9 -19
- package/data/build/dist/client/mobile-session-interaction.d.ts.map +1 -1
- package/data/build/dist/client/mobile-session-interaction.js +25 -169
- package/data/build/dist/client/mobile-session-interaction.js.map +1 -1
- package/data/build/dist/client/mobile-sidebar-gestures.d.ts +4 -0
- package/data/build/dist/client/mobile-sidebar-gestures.d.ts.map +1 -1
- package/data/build/dist/client/mobile-sidebar-gestures.js +17 -9
- package/data/build/dist/client/mobile-sidebar-gestures.js.map +1 -1
- package/data/build/dist/client/model-catalog-cache.d.ts +4 -4
- package/data/build/dist/client/model-catalog-cache.d.ts.map +1 -1
- package/data/build/dist/client/model-catalog-cache.js +57 -32
- package/data/build/dist/client/model-catalog-cache.js.map +1 -1
- package/data/build/dist/client/moss-voice-output.d.ts +39 -0
- package/data/build/dist/client/moss-voice-output.d.ts.map +1 -0
- package/data/build/dist/client/moss-voice-output.js +241 -0
- package/data/build/dist/client/moss-voice-output.js.map +1 -0
- package/data/build/dist/client/peer-host-native-projection.d.ts +4 -3
- package/data/build/dist/client/peer-host-native-projection.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-native-projection.js +7 -6
- package/data/build/dist/client/peer-host-native-projection.js.map +1 -1
- package/data/build/dist/client/peer-host-native-store-projection.js +9 -21
- package/data/build/dist/client/peer-host-native-store-projection.js.map +1 -1
- package/data/build/dist/client/peer-host-workspace-tab.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-workspace-tab.js +139 -10
- package/data/build/dist/client/peer-host-workspace-tab.js.map +1 -1
- package/data/build/dist/client/settings-bridge.d.ts +1 -0
- package/data/build/dist/client/settings-bridge.d.ts.map +1 -1
- package/data/build/dist/client/settings-bridge.js +9 -1
- package/data/build/dist/client/settings-bridge.js.map +1 -1
- package/data/build/dist/client/sherpa-voice-adapter.d.ts +23 -2
- package/data/build/dist/client/sherpa-voice-adapter.d.ts.map +1 -1
- package/data/build/dist/client/sherpa-voice-adapter.js +384 -91
- package/data/build/dist/client/sherpa-voice-adapter.js.map +1 -1
- package/data/build/dist/client/skill-command.d.ts +1 -1
- package/data/build/dist/client/skill-command.d.ts.map +1 -1
- package/data/build/dist/client/skill-command.js +25 -2
- package/data/build/dist/client/skill-command.js.map +1 -1
- package/data/build/dist/client/skill-reference-dom.js +1 -1
- package/data/build/dist/client/skill-reference-dom.js.map +1 -1
- package/data/build/dist/client/streaming-sentence-queue.d.ts +20 -0
- package/data/build/dist/client/streaming-sentence-queue.d.ts.map +1 -0
- package/data/build/dist/client/streaming-sentence-queue.js +130 -0
- package/data/build/dist/client/streaming-sentence-queue.js.map +1 -0
- package/data/build/dist/client/terminal/log-preview.d.ts +14 -0
- package/data/build/dist/client/terminal/log-preview.d.ts.map +1 -0
- package/data/build/dist/client/terminal/log-preview.js +23 -0
- package/data/build/dist/client/terminal/log-preview.js.map +1 -0
- package/data/build/dist/client/terminal/model.d.ts +38 -7
- package/data/build/dist/client/terminal/model.d.ts.map +1 -1
- package/data/build/dist/client/terminal/model.js +188 -32
- package/data/build/dist/client/terminal/model.js.map +1 -1
- package/data/build/dist/client/terminal/recovery.d.ts +7 -3
- package/data/build/dist/client/terminal/recovery.d.ts.map +1 -1
- package/data/build/dist/client/terminal/recovery.js +45 -41
- package/data/build/dist/client/terminal/recovery.js.map +1 -1
- package/data/build/dist/client/terminal/selection-actions.d.ts +63 -0
- package/data/build/dist/client/terminal/selection-actions.d.ts.map +1 -0
- package/data/build/dist/client/terminal/selection-actions.js +132 -0
- package/data/build/dist/client/terminal/selection-actions.js.map +1 -0
- package/data/build/dist/client/terminal/share-menu.d.ts +17 -0
- package/data/build/dist/client/terminal/share-menu.d.ts.map +1 -0
- package/data/build/dist/client/terminal/share-menu.js +131 -0
- package/data/build/dist/client/terminal/share-menu.js.map +1 -0
- package/data/build/dist/client/terminal/sharing.d.ts +42 -0
- package/data/build/dist/client/terminal/sharing.d.ts.map +1 -0
- package/data/build/dist/client/terminal/sharing.js +144 -0
- package/data/build/dist/client/terminal/sharing.js.map +1 -0
- package/data/build/dist/client/terminal/snapshot.d.ts +32 -0
- package/data/build/dist/client/terminal/snapshot.d.ts.map +1 -0
- package/data/build/dist/client/terminal/snapshot.js +108 -0
- package/data/build/dist/client/terminal/snapshot.js.map +1 -0
- package/data/build/dist/client/terminal/styles.d.ts +14 -0
- package/data/build/dist/client/terminal/styles.d.ts.map +1 -1
- package/data/build/dist/client/terminal/styles.js +41 -3
- package/data/build/dist/client/terminal/styles.js.map +1 -1
- package/data/build/dist/client/terminal/surface-cache.d.ts +10 -0
- package/data/build/dist/client/terminal/surface-cache.d.ts.map +1 -0
- package/data/build/dist/client/terminal/surface-cache.js +19 -0
- package/data/build/dist/client/terminal/surface-cache.js.map +1 -0
- package/data/build/dist/client/terminal/ui.d.ts.map +1 -1
- package/data/build/dist/client/terminal/ui.js +78 -21
- package/data/build/dist/client/terminal/ui.js.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.d.ts +5 -2
- package/data/build/dist/client/terminal/xterm-view.d.ts.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.js +429 -397
- package/data/build/dist/client/terminal/xterm-view.js.map +1 -1
- package/data/build/dist/client/touch-input-focus.d.ts +30 -0
- package/data/build/dist/client/touch-input-focus.d.ts.map +1 -0
- package/data/build/dist/client/touch-input-focus.js +190 -0
- package/data/build/dist/client/touch-input-focus.js.map +1 -0
- package/data/build/dist/client/voice-capture.d.ts +9 -0
- package/data/build/dist/client/voice-capture.d.ts.map +1 -1
- package/data/build/dist/client/voice-capture.js +35 -1
- package/data/build/dist/client/voice-capture.js.map +1 -1
- package/data/build/dist/client/voice-chat-updates.d.ts +12 -0
- package/data/build/dist/client/voice-chat-updates.d.ts.map +1 -0
- package/data/build/dist/client/voice-chat-updates.js +39 -0
- package/data/build/dist/client/voice-chat-updates.js.map +1 -0
- package/data/build/dist/client/voice-diagnostics.d.ts +19 -0
- package/data/build/dist/client/voice-diagnostics.d.ts.map +1 -0
- package/data/build/dist/client/voice-diagnostics.js +73 -0
- package/data/build/dist/client/voice-diagnostics.js.map +1 -0
- package/data/build/dist/client/voice-model-setup-progress.d.ts +8 -0
- package/data/build/dist/client/voice-model-setup-progress.d.ts.map +1 -0
- package/data/build/dist/client/voice-model-setup-progress.js +27 -0
- package/data/build/dist/client/voice-model-setup-progress.js.map +1 -0
- package/data/build/dist/client/voice-stream-uploader.d.ts +41 -0
- package/data/build/dist/client/voice-stream-uploader.d.ts.map +1 -0
- package/data/build/dist/client/voice-stream-uploader.js +154 -0
- package/data/build/dist/client/voice-stream-uploader.js.map +1 -0
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.d.ts +4 -0
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.js +9 -0
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts +5 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js +25 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/terminal-sharing-adapter.d.ts +33 -0
- package/data/build/dist/dsh-capabilities/client/terminal-sharing-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/client/terminal-sharing-adapter.js +187 -0
- package/data/build/dist/dsh-capabilities/client/terminal-sharing-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-agent-adapter.d.ts +55 -0
- package/data/build/dist/dsh-capabilities/host/assistant-agent-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-agent-adapter.js +264 -0
- package/data/build/dist/dsh-capabilities/host/assistant-agent-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-attachment-adapter.d.ts +16 -0
- package/data/build/dist/dsh-capabilities/host/assistant-attachment-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-attachment-adapter.js +69 -0
- package/data/build/dist/dsh-capabilities/host/assistant-attachment-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-llm-adapter.d.ts +36 -0
- package/data/build/dist/dsh-capabilities/host/assistant-llm-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-llm-adapter.js +112 -0
- package/data/build/dist/dsh-capabilities/host/assistant-llm-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-web-search-adapter.d.ts +4 -0
- package/data/build/dist/dsh-capabilities/host/assistant-web-search-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-web-search-adapter.js +41 -0
- package/data/build/dist/dsh-capabilities/host/assistant-web-search-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/sidebar-session-compat.d.ts +28 -0
- package/data/build/dist/dsh-capabilities/host/sidebar-session-compat.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/sidebar-session-compat.js +109 -0
- package/data/build/dist/dsh-capabilities/host/sidebar-session-compat.js.map +1 -0
- package/data/build/dist/dsh-capabilities/matrix.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/matrix.js +3 -0
- package/data/build/dist/dsh-capabilities/matrix.js.map +1 -1
- package/data/build/dist/dsh-capabilities/routes.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/routes.js +18 -0
- package/data/build/dist/dsh-capabilities/routes.js.map +1 -1
- package/data/build/dist/dsh-capabilities/settings-store.d.ts +2 -0
- package/data/build/dist/dsh-capabilities/settings-store.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/settings-store.js.map +1 -1
- package/data/build/dist/dsh-capabilities/types.d.ts +1 -1
- package/data/build/dist/dsh-capabilities/types.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/types.js.map +1 -1
- package/data/build/dist/host/avatar/catalog.d.ts +21 -0
- package/data/build/dist/host/avatar/catalog.d.ts.map +1 -0
- package/data/build/dist/host/avatar/catalog.js +123 -0
- package/data/build/dist/host/avatar/catalog.js.map +1 -0
- package/data/build/dist/host/avatar/engine.d.ts +42 -0
- package/data/build/dist/host/avatar/engine.d.ts.map +1 -0
- package/data/build/dist/host/avatar/engine.js +167 -0
- package/data/build/dist/host/avatar/engine.js.map +1 -0
- package/data/build/dist/host/avatar/materials.d.ts +28 -0
- package/data/build/dist/host/avatar/materials.d.ts.map +1 -0
- package/data/build/dist/host/avatar/materials.js +183 -0
- package/data/build/dist/host/avatar/materials.js.map +1 -0
- package/data/build/dist/host/avatar/packages.d.ts +34 -0
- package/data/build/dist/host/avatar/packages.d.ts.map +1 -0
- package/data/build/dist/host/avatar/packages.js +200 -0
- package/data/build/dist/host/avatar/packages.js.map +1 -0
- package/data/build/dist/host/avatar/registry.d.ts +12 -0
- package/data/build/dist/host/avatar/registry.d.ts.map +1 -0
- package/data/build/dist/host/avatar/registry.js +22 -0
- package/data/build/dist/host/avatar/registry.js.map +1 -0
- package/data/build/dist/host/avatar/remote.d.ts +18 -0
- package/data/build/dist/host/avatar/remote.d.ts.map +1 -0
- package/data/build/dist/host/avatar/remote.js +103 -0
- package/data/build/dist/host/avatar/remote.js.map +1 -0
- package/data/build/dist/host/avatar/sources.d.ts +11 -0
- package/data/build/dist/host/avatar/sources.d.ts.map +1 -0
- package/data/build/dist/host/avatar/sources.js +78 -0
- package/data/build/dist/host/avatar/sources.js.map +1 -0
- package/data/build/dist/host/avatar/temporary-previews.d.ts +26 -0
- package/data/build/dist/host/avatar/temporary-previews.d.ts.map +1 -0
- package/data/build/dist/host/avatar/temporary-previews.js +139 -0
- package/data/build/dist/host/avatar/temporary-previews.js.map +1 -0
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts +18 -1
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js +26 -8
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/attachment-utils.d.ts +16 -5
- package/data/build/dist/host/cli-adapters/attachment-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/attachment-utils.js +152 -42
- package/data/build/dist/host/cli-adapters/attachment-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts +14 -8
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.js +101 -76
- package/data/build/dist/host/cli-adapters/claude-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.js +84 -9
- package/data/build/dist/host/cli-adapters/codex-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-acp-loader.d.ts +23 -0
- package/data/build/dist/host/cli-adapters/command-code-acp-loader.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/command-code-acp-loader.js +39 -0
- package/data/build/dist/host/cli-adapters/command-code-acp-loader.js.map +1 -0
- package/data/build/dist/host/cli-adapters/command-code-driver.d.ts +17 -6
- package/data/build/dist/host/cli-adapters/command-code-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-driver.js +430 -20
- package/data/build/dist/host/cli-adapters/command-code-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-subscription.d.ts +1 -1
- package/data/build/dist/host/cli-adapters/command-code-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-subscription.js +7 -4
- package/data/build/dist/host/cli-adapters/command-code-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js +28 -0
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-tool-history.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-tool-history.js +23 -1
- package/data/build/dist/host/cli-adapters/dsh-tool-history.js.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.js +1 -1
- package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.d.ts +4 -2
- package/data/build/dist/host/cli-adapters/grok-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.js +208 -9
- package/data/build/dist/host/cli-adapters/grok-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/json-rpc-process.js +8 -3
- package/data/build/dist/host/cli-adapters/json-rpc-process.js.map +1 -1
- package/data/build/dist/host/cli-adapters/kimi-driver.d.ts +4 -0
- package/data/build/dist/host/cli-adapters/kimi-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/kimi-driver.js +11 -4
- package/data/build/dist/host/cli-adapters/kimi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/mcode-driver.js +2 -2
- package/data/build/dist/host/cli-adapters/mcode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/new-api-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/new-api-subscription.js +11 -58
- package/data/build/dist/host/cli-adapters/new-api-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts +5 -2
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.js +136 -18
- package/data/build/dist/host/cli-adapters/opencode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/pi-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/pi-driver.js +2 -1
- package/data/build/dist/host/cli-adapters/pi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.d.ts +10 -0
- package/data/build/dist/host/cli-adapters/process-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.js +20 -0
- package/data/build/dist/host/cli-adapters/process-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +3 -0
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.js +42 -8
- package/data/build/dist/host/cli-adapters/provider-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.js +5 -3
- package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.js +2 -9
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/skill-filesystem.d.ts +25 -0
- package/data/build/dist/host/cli-adapters/skill-filesystem.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/skill-filesystem.js +161 -0
- package/data/build/dist/host/cli-adapters/skill-filesystem.js.map +1 -0
- package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts +1 -0
- package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js +4 -0
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/zcode-driver.d.ts +8 -2
- package/data/build/dist/host/cli-adapters/zcode-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/zcode-driver.js +166 -55
- package/data/build/dist/host/cli-adapters/zcode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/zcode-interactions.d.ts +18 -0
- package/data/build/dist/host/cli-adapters/zcode-interactions.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-interactions.js +90 -0
- package/data/build/dist/host/cli-adapters/zcode-interactions.js.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-provider-config.d.ts +26 -0
- package/data/build/dist/host/cli-adapters/zcode-provider-config.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-provider-config.js +102 -0
- package/data/build/dist/host/cli-adapters/zcode-provider-config.js.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-subscription.d.ts +2 -7
- package/data/build/dist/host/cli-adapters/zcode-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/zcode-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/zcode-telemetry.d.ts +17 -0
- package/data/build/dist/host/cli-adapters/zcode-telemetry.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-telemetry.js +124 -0
- package/data/build/dist/host/cli-adapters/zcode-telemetry.js.map +1 -0
- package/data/build/dist/host/cli-bridge/injections.d.ts +2 -9
- package/data/build/dist/host/cli-bridge/injections.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/injections.js +7 -17
- package/data/build/dist/host/cli-bridge/injections.js.map +1 -1
- package/data/build/dist/host/desktop-assistant/controller.d.ts +44 -0
- package/data/build/dist/host/desktop-assistant/controller.d.ts.map +1 -0
- package/data/build/dist/host/desktop-assistant/controller.js +150 -0
- package/data/build/dist/host/desktop-assistant/controller.js.map +1 -0
- package/data/build/dist/host/desktop-assistant/feature.d.ts +9 -0
- package/data/build/dist/host/desktop-assistant/feature.d.ts.map +1 -0
- package/data/build/dist/host/desktop-assistant/feature.js +102 -0
- package/data/build/dist/host/desktop-assistant/feature.js.map +1 -0
- package/data/build/dist/host/desktop-assistant/launcher.d.ts +5 -0
- package/data/build/dist/host/desktop-assistant/launcher.d.ts.map +1 -0
- package/data/build/dist/host/desktop-assistant/launcher.js +84 -0
- package/data/build/dist/host/desktop-assistant/launcher.js.map +1 -0
- package/data/build/dist/host/desktop-assistant/mac-agent.d.ts +5 -0
- package/data/build/dist/host/desktop-assistant/mac-agent.d.ts.map +1 -0
- package/data/build/dist/host/desktop-assistant/mac-agent.js +122 -0
- package/data/build/dist/host/desktop-assistant/mac-agent.js.map +1 -0
- package/data/build/dist/host/desktop-assistant/process.d.ts +4 -0
- package/data/build/dist/host/desktop-assistant/process.d.ts.map +1 -0
- package/data/build/dist/host/desktop-assistant/process.js +25 -0
- package/data/build/dist/host/desktop-assistant/process.js.map +1 -0
- package/data/build/dist/host/desktop-assistant/server.d.ts +12 -0
- package/data/build/dist/host/desktop-assistant/server.d.ts.map +1 -0
- package/data/build/dist/host/desktop-assistant/server.js +74 -0
- package/data/build/dist/host/desktop-assistant/server.js.map +1 -0
- package/data/build/dist/host/desktop-assistant/win-agent.d.ts +2 -0
- package/data/build/dist/host/desktop-assistant/win-agent.d.ts.map +1 -0
- package/data/build/dist/host/desktop-assistant/win-agent.js +197 -0
- package/data/build/dist/host/desktop-assistant/win-agent.js.map +1 -0
- package/data/build/dist/host/features/assistant-avatar-assets.d.ts +3 -0
- package/data/build/dist/host/features/assistant-avatar-assets.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-avatar-assets.js +3 -0
- package/data/build/dist/host/features/assistant-avatar-assets.js.map +1 -0
- package/data/build/dist/host/features/assistant-avatar-basics.d.ts +3 -0
- package/data/build/dist/host/features/assistant-avatar-basics.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-avatar-basics.js +34 -0
- package/data/build/dist/host/features/assistant-avatar-basics.js.map +1 -0
- package/data/build/dist/host/features/assistant-avatar-legacy-assets.d.ts +6 -0
- package/data/build/dist/host/features/assistant-avatar-legacy-assets.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-avatar-legacy-assets.js +146 -0
- package/data/build/dist/host/features/assistant-avatar-legacy-assets.js.map +1 -0
- package/data/build/dist/host/features/assistant-avatar-runtime.d.ts +20 -0
- package/data/build/dist/host/features/assistant-avatar-runtime.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-avatar-runtime.js +235 -0
- package/data/build/dist/host/features/assistant-avatar-runtime.js.map +1 -0
- package/data/build/dist/host/features/assistant-conversation-storage.d.ts +8 -0
- package/data/build/dist/host/features/assistant-conversation-storage.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-conversation-storage.js +38 -0
- package/data/build/dist/host/features/assistant-conversation-storage.js.map +1 -0
- package/data/build/dist/host/features/assistant-conversation.d.ts +57 -0
- package/data/build/dist/host/features/assistant-conversation.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-conversation.js +364 -0
- package/data/build/dist/host/features/assistant-conversation.js.map +1 -0
- package/data/build/dist/host/features/assistant-dispatch.d.ts +2 -2
- package/data/build/dist/host/features/assistant-dispatch.d.ts.map +1 -1
- package/data/build/dist/host/features/assistant-dispatch.js +4 -3
- package/data/build/dist/host/features/assistant-dispatch.js.map +1 -1
- package/data/build/dist/host/features/assistant-index-analysis.d.ts +49 -0
- package/data/build/dist/host/features/assistant-index-analysis.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-index-analysis.js +255 -0
- package/data/build/dist/host/features/assistant-index-analysis.js.map +1 -0
- package/data/build/dist/host/features/assistant-index-journal.d.ts +20 -0
- package/data/build/dist/host/features/assistant-index-journal.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-index-journal.js +40 -0
- package/data/build/dist/host/features/assistant-index-journal.js.map +1 -0
- package/data/build/dist/host/features/assistant-index-retry.d.ts +12 -0
- package/data/build/dist/host/features/assistant-index-retry.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-index-retry.js +54 -0
- package/data/build/dist/host/features/assistant-index-retry.js.map +1 -0
- package/data/build/dist/host/features/assistant-index-updates.d.ts +40 -0
- package/data/build/dist/host/features/assistant-index-updates.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-index-updates.js +183 -0
- package/data/build/dist/host/features/assistant-index-updates.js.map +1 -0
- package/data/build/dist/host/features/assistant-lifecycle-settings.d.ts +5 -0
- package/data/build/dist/host/features/assistant-lifecycle-settings.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-lifecycle-settings.js +72 -0
- package/data/build/dist/host/features/assistant-lifecycle-settings.js.map +1 -0
- package/data/build/dist/host/features/assistant-management-tools.d.ts +34 -0
- package/data/build/dist/host/features/assistant-management-tools.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-management-tools.js +69 -0
- package/data/build/dist/host/features/assistant-management-tools.js.map +1 -0
- package/data/build/dist/host/features/assistant-prompts.d.ts +6 -0
- package/data/build/dist/host/features/assistant-prompts.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-prompts.js +62 -0
- package/data/build/dist/host/features/assistant-prompts.js.map +1 -0
- package/data/build/dist/host/features/assistant-session-index.d.ts +6 -1
- package/data/build/dist/host/features/assistant-session-index.d.ts.map +1 -1
- package/data/build/dist/host/features/assistant-session-index.js +11 -12
- package/data/build/dist/host/features/assistant-session-index.js.map +1 -1
- package/data/build/dist/host/features/assistant-structured-index.d.ts +21 -0
- package/data/build/dist/host/features/assistant-structured-index.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-structured-index.js +138 -0
- package/data/build/dist/host/features/assistant-structured-index.js.map +1 -0
- package/data/build/dist/host/features/assistant-summary.d.ts.map +1 -1
- package/data/build/dist/host/features/assistant-summary.js +7 -1
- package/data/build/dist/host/features/assistant-summary.js.map +1 -1
- package/data/build/dist/host/features/assistant-text-chat.d.ts +29 -0
- package/data/build/dist/host/features/assistant-text-chat.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-text-chat.js +195 -0
- package/data/build/dist/host/features/assistant-text-chat.js.map +1 -0
- package/data/build/dist/host/features/assistant-tts-service.d.ts +47 -0
- package/data/build/dist/host/features/assistant-tts-service.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-tts-service.js +507 -0
- package/data/build/dist/host/features/assistant-tts-service.js.map +1 -0
- package/data/build/dist/host/features/assistant-voice-chat.d.ts +35 -0
- package/data/build/dist/host/features/assistant-voice-chat.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-voice-chat.js +133 -0
- package/data/build/dist/host/features/assistant-voice-chat.js.map +1 -0
- package/data/build/dist/host/features/assistant-voice-hotwords.d.ts +33 -0
- package/data/build/dist/host/features/assistant-voice-hotwords.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-voice-hotwords.js +114 -0
- package/data/build/dist/host/features/assistant-voice-hotwords.js.map +1 -0
- package/data/build/dist/host/features/assistant-voice-initialization.d.ts +26 -0
- package/data/build/dist/host/features/assistant-voice-initialization.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-voice-initialization.js +68 -0
- package/data/build/dist/host/features/assistant-voice-initialization.js.map +1 -0
- package/data/build/dist/host/features/assistant-voice-sources.d.ts +13 -0
- package/data/build/dist/host/features/assistant-voice-sources.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-voice-sources.js +72 -0
- package/data/build/dist/host/features/assistant-voice-sources.js.map +1 -0
- package/data/build/dist/host/features/assistant-voice-stream.d.ts +10 -0
- package/data/build/dist/host/features/assistant-voice-stream.d.ts.map +1 -1
- package/data/build/dist/host/features/assistant-voice-stream.js +208 -5
- package/data/build/dist/host/features/assistant-voice-stream.js.map +1 -1
- package/data/build/dist/host/features/global-voice-rpc.d.ts +8 -1
- package/data/build/dist/host/features/global-voice-rpc.d.ts.map +1 -1
- package/data/build/dist/host/features/global-voice-rpc.js +1055 -153
- package/data/build/dist/host/features/global-voice-rpc.js.map +1 -1
- package/data/build/dist/host/features/index.d.ts.map +1 -1
- package/data/build/dist/host/features/index.js +4 -0
- package/data/build/dist/host/features/index.js.map +1 -1
- package/data/build/dist/host/features/moss-tts-worker.d.ts +32 -0
- package/data/build/dist/host/features/moss-tts-worker.d.ts.map +1 -0
- package/data/build/dist/host/features/moss-tts-worker.js +216 -0
- package/data/build/dist/host/features/moss-tts-worker.js.map +1 -0
- package/data/build/dist/host/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/host/features/peer-host.js +38 -7
- package/data/build/dist/host/features/peer-host.js.map +1 -1
- package/data/build/dist/host/features/sherpa-voice-runtime.d.ts +11 -0
- package/data/build/dist/host/features/sherpa-voice-runtime.d.ts.map +1 -1
- package/data/build/dist/host/features/sherpa-voice-runtime.js +72 -17
- package/data/build/dist/host/features/sherpa-voice-runtime.js.map +1 -1
- package/data/build/dist/host/features/types.d.ts +9 -1
- package/data/build/dist/host/features/types.d.ts.map +1 -1
- package/data/build/dist/host/features/voice-model-management.d.ts +22 -0
- package/data/build/dist/host/features/voice-model-management.d.ts.map +1 -0
- package/data/build/dist/host/features/voice-model-management.js +178 -0
- package/data/build/dist/host/features/voice-model-management.js.map +1 -0
- package/data/build/dist/host/features/voice-model-probe.d.ts +8 -0
- package/data/build/dist/host/features/voice-model-probe.d.ts.map +1 -0
- package/data/build/dist/host/features/voice-model-probe.js +76 -0
- package/data/build/dist/host/features/voice-model-probe.js.map +1 -0
- package/data/build/dist/host/features/voice-model-setup.d.ts +5 -2
- package/data/build/dist/host/features/voice-model-setup.d.ts.map +1 -1
- package/data/build/dist/host/features/voice-model-setup.js +40 -13
- package/data/build/dist/host/features/voice-model-setup.js.map +1 -1
- package/data/build/dist/host/features/voice-process-environment.d.ts +3 -0
- package/data/build/dist/host/features/voice-process-environment.d.ts.map +1 -0
- package/data/build/dist/host/features/voice-process-environment.js +16 -0
- package/data/build/dist/host/features/voice-process-environment.js.map +1 -0
- package/data/build/dist/host/features/voice-python-runtime.d.ts +21 -0
- package/data/build/dist/host/features/voice-python-runtime.d.ts.map +1 -0
- package/data/build/dist/host/features/voice-python-runtime.js +189 -0
- package/data/build/dist/host/features/voice-python-runtime.js.map +1 -0
- package/data/build/dist/host/index-injection.d.ts.map +1 -1
- package/data/build/dist/host/index-injection.js +5 -1
- package/data/build/dist/host/index-injection.js.map +1 -1
- package/data/build/dist/host/index.d.ts +5 -0
- package/data/build/dist/host/index.d.ts.map +1 -1
- package/data/build/dist/host/index.js +33 -12
- package/data/build/dist/host/index.js.map +1 -1
- package/data/build/dist/host/lan-access-dsh.d.ts.map +1 -1
- package/data/build/dist/host/lan-access-dsh.js +2 -1
- package/data/build/dist/host/lan-access-dsh.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-aggregate-service.d.ts +1 -0
- package/data/build/dist/host/modules/peer-host/peer-host-aggregate-service.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-aggregate-service.js +1 -0
- package/data/build/dist/host/modules/peer-host/peer-host-aggregate-service.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.d.ts +2 -0
- package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.js +5 -0
- package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js +15 -1
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js.map +1 -1
- package/data/build/dist/host/rpc.d.ts.map +1 -1
- package/data/build/dist/host/rpc.js +50 -4
- package/data/build/dist/host/rpc.js.map +1 -1
- package/data/build/dist/host/settings.d.ts +2 -1
- package/data/build/dist/host/settings.d.ts.map +1 -1
- package/data/build/dist/host/settings.js +77 -13
- package/data/build/dist/host/settings.js.map +1 -1
- package/data/build/dist/host/stage0-dev-hmr.d.ts +6 -0
- package/data/build/dist/host/stage0-dev-hmr.d.ts.map +1 -0
- package/data/build/dist/host/stage0-dev-hmr.js +20 -0
- package/data/build/dist/host/stage0-dev-hmr.js.map +1 -0
- package/data/build/dist/host/tar-archive.d.ts +8 -0
- package/data/build/dist/host/tar-archive.d.ts.map +1 -0
- package/data/build/dist/host/tar-archive.js +17 -0
- package/data/build/dist/host/tar-archive.js.map +1 -0
- package/data/build/dist/host/voice-diagnostics.d.ts +34 -0
- package/data/build/dist/host/voice-diagnostics.d.ts.map +1 -0
- package/data/build/dist/host/voice-diagnostics.js +124 -0
- package/data/build/dist/host/voice-diagnostics.js.map +1 -0
- package/data/build/dist/shared/assistant-attachments.d.ts +27 -0
- package/data/build/dist/shared/assistant-attachments.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-attachments.js +45 -0
- package/data/build/dist/shared/assistant-attachments.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-adapters.d.ts +18 -0
- package/data/build/dist/shared/assistant-avatar-adapters.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-adapters.js +119 -0
- package/data/build/dist/shared/assistant-avatar-adapters.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-catalog.d.ts +37 -0
- package/data/build/dist/shared/assistant-avatar-catalog.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-catalog.js +21 -0
- package/data/build/dist/shared/assistant-avatar-catalog.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-engine.d.ts +31 -0
- package/data/build/dist/shared/assistant-avatar-engine.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-engine.js +28 -0
- package/data/build/dist/shared/assistant-avatar-engine.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-installation.d.ts +17 -0
- package/data/build/dist/shared/assistant-avatar-installation.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-installation.js +7 -0
- package/data/build/dist/shared/assistant-avatar-installation.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-legacy-resources.d.ts +6 -0
- package/data/build/dist/shared/assistant-avatar-legacy-resources.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-legacy-resources.js +20 -0
- package/data/build/dist/shared/assistant-avatar-legacy-resources.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-legacy.d.ts +15 -0
- package/data/build/dist/shared/assistant-avatar-legacy.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-legacy.js +34 -0
- package/data/build/dist/shared/assistant-avatar-legacy.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-presets.d.ts +3 -0
- package/data/build/dist/shared/assistant-avatar-presets.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-presets.js +3 -0
- package/data/build/dist/shared/assistant-avatar-presets.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-registration.d.ts +16 -0
- package/data/build/dist/shared/assistant-avatar-registration.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-registration.js +33 -0
- package/data/build/dist/shared/assistant-avatar-registration.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar-resources.d.ts +26 -0
- package/data/build/dist/shared/assistant-avatar-resources.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-resources.js +4 -0
- package/data/build/dist/shared/assistant-avatar-resources.js.map +1 -0
- package/data/build/dist/shared/assistant-avatar.d.ts +103 -0
- package/data/build/dist/shared/assistant-avatar.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar.js +240 -0
- package/data/build/dist/shared/assistant-avatar.js.map +1 -0
- package/data/build/dist/shared/assistant-commands.d.ts +3 -0
- package/data/build/dist/shared/assistant-commands.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-commands.js +3 -0
- package/data/build/dist/shared/assistant-commands.js.map +1 -0
- package/data/build/dist/shared/assistant-lifecycle.d.ts +17 -0
- package/data/build/dist/shared/assistant-lifecycle.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-lifecycle.js +45 -0
- package/data/build/dist/shared/assistant-lifecycle.js.map +1 -0
- package/data/build/dist/shared/assistant-message-timeline.d.ts +13 -0
- package/data/build/dist/shared/assistant-message-timeline.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-message-timeline.js +22 -0
- package/data/build/dist/shared/assistant-message-timeline.js.map +1 -0
- package/data/build/dist/shared/assistant-prompts.d.ts +12 -0
- package/data/build/dist/shared/assistant-prompts.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-prompts.js +32 -0
- package/data/build/dist/shared/assistant-prompts.js.map +1 -0
- package/data/build/dist/shared/assistant-tts.d.ts +93 -0
- package/data/build/dist/shared/assistant-tts.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-tts.js +80 -0
- package/data/build/dist/shared/assistant-tts.js.map +1 -0
- package/data/build/dist/shared/assistant-voice-sessions.d.ts +13 -0
- package/data/build/dist/shared/assistant-voice-sessions.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-voice-sessions.js +16 -0
- package/data/build/dist/shared/assistant-voice-sessions.js.map +1 -0
- package/data/build/dist/shared/contracts/assistant.d.ts +206 -0
- package/data/build/dist/shared/contracts/assistant.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/cli-adapter.d.ts +4 -0
- package/data/build/dist/shared/contracts/cli-adapter.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.d.ts +23 -0
- package/data/build/dist/shared/contracts/config.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.js +2 -0
- package/data/build/dist/shared/contracts/config.js.map +1 -1
- package/data/build/dist/shared/contracts/peer-host.d.ts +2 -0
- package/data/build/dist/shared/contracts/peer-host.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/peer-host.js.map +1 -1
- package/data/build/dist/shared/contracts/terminal-share.d.ts +27 -0
- package/data/build/dist/shared/contracts/terminal-share.d.ts.map +1 -0
- package/data/build/dist/shared/contracts/terminal-share.js +2 -0
- package/data/build/dist/shared/contracts/terminal-share.js.map +1 -0
- package/data/build/dist/shared/contracts/version.d.ts +1 -1
- package/data/build/dist/shared/contracts/version.js +1 -1
- package/data/build/dist/shared/contracts/voice-runtime.d.ts +15 -1
- package/data/build/dist/shared/contracts/voice-runtime.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/voice-runtime.js.map +1 -1
- package/data/build/dist/shared/desktop-assistant.d.ts +35 -0
- package/data/build/dist/shared/desktop-assistant.d.ts.map +1 -0
- package/data/build/dist/shared/desktop-assistant.js +27 -0
- package/data/build/dist/shared/desktop-assistant.js.map +1 -0
- package/data/build/dist/shared/index.d.ts +16 -2
- package/data/build/dist/shared/index.d.ts.map +1 -1
- package/data/build/dist/shared/index.js +10 -0
- package/data/build/dist/shared/index.js.map +1 -1
- package/data/build/dist/shared/runtime-environment.d.ts +5 -0
- package/data/build/dist/shared/runtime-environment.d.ts.map +1 -0
- package/data/build/dist/shared/runtime-environment.js +7 -0
- package/data/build/dist/shared/runtime-environment.js.map +1 -0
- package/data/build/dist/shared/voice-diagnostics.d.ts +18 -0
- package/data/build/dist/shared/voice-diagnostics.d.ts.map +1 -0
- package/data/build/dist/shared/voice-diagnostics.js +57 -0
- package/data/build/dist/shared/voice-diagnostics.js.map +1 -0
- package/data/build/dist/shared/voice-initialization.d.ts +22 -0
- package/data/build/dist/shared/voice-initialization.d.ts.map +1 -0
- package/data/build/dist/shared/voice-initialization.js +4 -0
- package/data/build/dist/shared/voice-initialization.js.map +1 -0
- package/data/build/dist/shared/voice-models.d.ts +43 -0
- package/data/build/dist/shared/voice-models.d.ts.map +1 -1
- package/data/build/dist/shared/voice-models.js +23 -8
- package/data/build/dist/shared/voice-models.js.map +1 -1
- package/data/build/dist/shared/voice-stream.d.ts +12 -1
- package/data/build/dist/shared/voice-stream.d.ts.map +1 -1
- package/data/build/dist/shared/voice-stream.js +8 -1
- package/data/build/dist/shared/voice-stream.js.map +1 -1
- package/package.json +21 -3
- package/profile/README.md +2 -2
- package/profile/package.json +2 -2
- package/profile/version.json +1 -1
- package/version.json +1 -1
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { CODINGNS_RPC_CHANNEL } from '../shared/contracts/transport.js';
|
|
2
|
-
import {
|
|
2
|
+
import { ASSISTANT_VOICE_EVENTS_PATH, ASSISTANT_VOICE_STREAM_PATH } from '../shared/voice-stream.js';
|
|
3
3
|
import { BrowserVoiceDeviceManager } from './voice-device-manager.js';
|
|
4
4
|
import { ClientVoiceCapture } from './voice-capture.js';
|
|
5
|
+
import { createVoiceHttpError, VoiceStreamUploader } from './voice-stream-uploader.js';
|
|
6
|
+
import { MossVoiceOutput } from './moss-voice-output.js';
|
|
7
|
+
import { StreamingSentenceQueue } from './streaming-sentence-queue.js';
|
|
8
|
+
import { readAssistantTtsParameters, readAssistantTtsSettings } from '../shared/assistant-tts.js';
|
|
9
|
+
import { ClientVoiceDiagnostics } from './voice-diagnostics.js';
|
|
10
|
+
import { voiceDiagnosticError } from '../shared/voice-diagnostics.js';
|
|
11
|
+
import { VoiceChatUpdates } from './voice-chat-updates.js';
|
|
5
12
|
/** 浏览器侧 Sherpa 数据面:设备和权限在 Client,识别在 Host。 */
|
|
6
13
|
export class ClientSherpaVoiceAdapter {
|
|
7
14
|
listeners = new Set();
|
|
@@ -11,12 +18,24 @@ export class ClientSherpaVoiceAdapter {
|
|
|
11
18
|
capture;
|
|
12
19
|
uploader;
|
|
13
20
|
responseAbort;
|
|
21
|
+
leaseRequest;
|
|
22
|
+
stopOperation;
|
|
14
23
|
active = false;
|
|
15
24
|
hostLeaseActive = false;
|
|
16
25
|
epoch = 0;
|
|
17
26
|
configuredOwner;
|
|
18
27
|
selectedInputDeviceId;
|
|
19
28
|
selectedOutputDeviceId;
|
|
29
|
+
diagnostics;
|
|
30
|
+
trace = (event, fields) => this.diagnostics?.record(event, fields);
|
|
31
|
+
output = new MossVoiceOutput({ trace: this.trace, traceContext: () => ({ ownerId: this.configuredOwner, epoch: this.epoch, requestId: this.reply?.requestId }) });
|
|
32
|
+
reply;
|
|
33
|
+
chatStreaming = false;
|
|
34
|
+
clearOperation;
|
|
35
|
+
settleSpeech;
|
|
36
|
+
replySequence = 0;
|
|
37
|
+
microphoneMuted = false;
|
|
38
|
+
speakerMuted = false;
|
|
20
39
|
constructor(options) {
|
|
21
40
|
this.options = options;
|
|
22
41
|
this.services = options.services;
|
|
@@ -33,13 +52,32 @@ export class ClientSherpaVoiceAdapter {
|
|
|
33
52
|
get capabilities() {
|
|
34
53
|
const secure = this.devices.snapshot().secureContext;
|
|
35
54
|
const supported = secure && typeof globalThis.fetch === 'function' && typeof globalThis.ReadableStream === 'function';
|
|
36
|
-
|
|
55
|
+
const moss = readAssistantTtsSettings(this.services.settings?.getSnapshot().value?.assistant.tts).backend === 'moss-onnx';
|
|
56
|
+
const output = moss ? typeof globalThis.AudioContext === 'function' : typeof globalThis.speechSynthesis !== 'undefined';
|
|
57
|
+
return { realtime: supported, wakeWord: false, streamingInput: supported, streamingOutput: moss && output, bargeIn: supported, speechToText: supported, textToSpeech: output };
|
|
37
58
|
}
|
|
38
59
|
get ownerId() { return this.active ? this.configuredOwner : undefined; }
|
|
39
60
|
get configuredOwnerId() { return this.configuredOwner; }
|
|
40
61
|
get inputDeviceId() { return this.selectedInputDeviceId; }
|
|
41
62
|
get outputDeviceId() { return this.selectedOutputDeviceId; }
|
|
42
|
-
get outputDeviceSupported() { return
|
|
63
|
+
get outputDeviceSupported() { return readAssistantTtsSettings(this.services.settings?.getSnapshot().value?.assistant.tts).backend === 'moss-onnx' && this.output.outputDeviceSupported; }
|
|
64
|
+
get isMicrophoneMuted() { return this.microphoneMuted; }
|
|
65
|
+
get isSpeakerMuted() { return this.speakerMuted; }
|
|
66
|
+
setMicrophoneMuted(muted) {
|
|
67
|
+
this.microphoneMuted = muted;
|
|
68
|
+
this.capture?.setMuted(muted);
|
|
69
|
+
if (muted)
|
|
70
|
+
this.emit({ type: 'partial', text: '', epoch: this.epoch });
|
|
71
|
+
}
|
|
72
|
+
setSpeakerMuted(muted) {
|
|
73
|
+
this.speakerMuted = muted;
|
|
74
|
+
this.output.setMuted(muted);
|
|
75
|
+
if (muted && readAssistantTtsSettings(this.services.settings?.getSnapshot().value?.assistant.tts).backend === 'browser') {
|
|
76
|
+
this.settleSpeech?.();
|
|
77
|
+
this.settleSpeech = undefined;
|
|
78
|
+
globalThis.speechSynthesis?.cancel();
|
|
79
|
+
}
|
|
80
|
+
}
|
|
43
81
|
subscribe(listener) { this.listeners.add(listener); return () => this.listeners.delete(listener); }
|
|
44
82
|
async enumerateInputDevices() { return (await this.devices.refresh()).inputs; }
|
|
45
83
|
async enumerateOutputDevices() { return (await this.devices.refresh()).outputs; }
|
|
@@ -54,60 +92,117 @@ export class ClientSherpaVoiceAdapter {
|
|
|
54
92
|
async selectOutputDevice(deviceId) {
|
|
55
93
|
if (!this.outputDeviceSupported)
|
|
56
94
|
throw new Error('当前浏览器不支持输出设备选择');
|
|
95
|
+
await this.output.setOutputDevice(deviceId);
|
|
57
96
|
await this.devices.selectOutput(deviceId);
|
|
58
97
|
this.selectedOutputDeviceId = this.devices.snapshot().selectedOutputId ?? undefined;
|
|
59
|
-
await this.applyOutputDevice();
|
|
60
98
|
}
|
|
61
99
|
async start(ownerId) {
|
|
100
|
+
if (this.stopOperation !== undefined)
|
|
101
|
+
await this.stopOperation;
|
|
62
102
|
if (this.active)
|
|
63
103
|
return;
|
|
64
104
|
this.configuredOwner = ownerId?.trim() || this.configuredOwner;
|
|
65
105
|
if (this.configuredOwner === '')
|
|
66
106
|
throw new Error('全局语音租约缺少 ownerId');
|
|
67
|
-
const lease = await this.services.rpc.call(CODINGNS_RPC_CHANNEL, 'assistant/voice/start', { ownerId: this.configuredOwner });
|
|
68
|
-
if (!lease.ok)
|
|
69
|
-
throw new Error(lease.error.message);
|
|
70
|
-
if (isRecord(lease.value) && lease.value.unavailable === true)
|
|
71
|
-
throw new Error(typeof lease.value.message === 'string' ? lease.value.message : '本地 Sherpa 语音运行时不可用');
|
|
72
|
-
this.hostLeaseActive = true;
|
|
73
|
-
const snapshot = await this.devices.refresh();
|
|
74
|
-
if (!snapshot.secureContext)
|
|
75
|
-
throw new Error('当前页面不是安全上下文,请改用 HTTPS 或 localhost 后访问麦克风');
|
|
76
|
-
this.epoch += 1;
|
|
77
|
-
const epoch = this.epoch;
|
|
78
|
-
const uploader = new VoiceStreamUploader();
|
|
79
107
|
const abort = new AbortController();
|
|
80
|
-
|
|
108
|
+
const started = performance.now();
|
|
109
|
+
const callId = createClientId();
|
|
81
110
|
this.responseAbort = abort;
|
|
82
111
|
this.active = true;
|
|
83
|
-
this.
|
|
112
|
+
this.setMicrophoneMuted(false);
|
|
113
|
+
this.setSpeakerMuted(false);
|
|
84
114
|
try {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
115
|
+
if (readAssistantTtsSettings(this.services.settings?.getSnapshot().value?.assistant.tts).backend === 'moss-onnx') {
|
|
116
|
+
await this.output.prepare();
|
|
117
|
+
if (this.output.outputDeviceSupported && this.selectedOutputDeviceId !== undefined)
|
|
118
|
+
await this.output.setOutputDevice(this.selectedOutputDeviceId);
|
|
119
|
+
}
|
|
120
|
+
const leaseStarted = performance.now();
|
|
121
|
+
const leaseRequest = this.services.rpc.call(CODINGNS_RPC_CHANNEL, 'assistant/voice/start', { ownerId: this.configuredOwner, voiceSessionId: callId }, abort.signal);
|
|
122
|
+
this.leaseRequest = leaseRequest;
|
|
123
|
+
const lease = await leaseRequest.finally(() => { if (this.leaseRequest === leaseRequest)
|
|
124
|
+
this.leaseRequest = undefined; });
|
|
125
|
+
if (!lease.ok)
|
|
126
|
+
throw new Error(lease.error.message);
|
|
127
|
+
if (isRecord(lease.value) && lease.value.unavailable === true)
|
|
128
|
+
throw new Error(typeof lease.value.message === 'string' ? lease.value.message : '本地 Sherpa 语音运行时不可用');
|
|
129
|
+
if (abort.signal.aborted)
|
|
130
|
+
throw new Error('语音启动已取消');
|
|
131
|
+
this.hostLeaseActive = true;
|
|
132
|
+
// epoch 以 Host 租约为准,不能让刷新后的页面从 1 重新计数。
|
|
133
|
+
this.epoch = readEpoch(isRecord(lease.value) ? lease.value : {}, this.epoch + 1);
|
|
134
|
+
if (isRecord(lease.value) && lease.value.diagnosticsEnabled === true) {
|
|
135
|
+
this.diagnostics = new ClientVoiceDiagnostics(this.services, { ownerId: this.configuredOwner, callId });
|
|
136
|
+
this.trace('client.call.lease', { epoch: this.epoch, durationMs: performance.now() - leaseStarted });
|
|
137
|
+
}
|
|
138
|
+
this.emit({ type: 'state', state: 'loading', epoch: this.epoch });
|
|
139
|
+
const snapshot = await this.devices.refresh();
|
|
140
|
+
if (!snapshot.secureContext)
|
|
141
|
+
throw new Error('当前页面不是安全上下文,请改用 HTTPS 或 localhost 后访问麦克风');
|
|
142
|
+
if (abort.signal.aborted)
|
|
143
|
+
throw new Error('语音启动已取消');
|
|
144
|
+
const clientId = createClientId();
|
|
145
|
+
this.uploader = new VoiceStreamUploader({ url: resolveVoiceStreamUrl(ASSISTANT_VOICE_STREAM_PATH, { mode: 'frames' }), ownerId: this.configuredOwner, clientId, trace: this.trace, onError: (error) => this.failTransport(error, abort) });
|
|
146
|
+
const eventsStarted = performance.now();
|
|
147
|
+
const response = await globalThis.fetch(resolveVoiceStreamUrl(ASSISTANT_VOICE_EVENTS_PATH, { ownerId: this.configuredOwner, clientId }), {
|
|
148
|
+
method: 'GET',
|
|
89
149
|
signal: abort.signal,
|
|
90
150
|
credentials: 'same-origin',
|
|
91
|
-
headers: {
|
|
92
|
-
...{ duplex: 'half' },
|
|
151
|
+
headers: { accept: 'application/x-ndjson' },
|
|
93
152
|
});
|
|
94
|
-
if (!response.ok
|
|
95
|
-
throw
|
|
96
|
-
|
|
97
|
-
|
|
153
|
+
if (!response.ok)
|
|
154
|
+
throw await createVoiceHttpError(response, '语音流连接失败');
|
|
155
|
+
if (response.body === null)
|
|
156
|
+
throw new Error('语音事件连接缺少响应正文');
|
|
157
|
+
this.chatStreaming = response.headers.get('x-codingns-voice-chat-stream') === '1';
|
|
158
|
+
this.trace('client.events.connected', { durationMs: performance.now() - eventsStarted, status: response.status, streaming: this.chatStreaming });
|
|
159
|
+
void this.readEvents(response.body, abort);
|
|
160
|
+
const capture = new ClientVoiceCapture({ devices: this.devices, targetSampleRate: 16_000, trace: this.trace, onFrame: (frame) => { if (this.responseAbort === abort)
|
|
161
|
+
this.sendPcmFrame(frame, this.epoch); }, onEnded: (error) => this.failTransport(error, abort) });
|
|
98
162
|
this.capture = capture;
|
|
99
163
|
await capture.start();
|
|
100
|
-
|
|
164
|
+
if (abort.signal.aborted) {
|
|
165
|
+
await capture.stop();
|
|
166
|
+
throw new Error('语音启动已取消');
|
|
167
|
+
}
|
|
168
|
+
this.emit({ type: 'state', state: 'listening', epoch: this.epoch });
|
|
169
|
+
this.trace('client.call.started', { epoch: this.epoch, durationMs: performance.now() - started });
|
|
101
170
|
}
|
|
102
171
|
catch (error) {
|
|
103
|
-
|
|
172
|
+
this.trace('client.call.error', { durationMs: performance.now() - started, errorName: voiceDiagnosticError(error) });
|
|
173
|
+
if (this.responseAbort === abort)
|
|
174
|
+
await this.stop().catch(() => undefined);
|
|
104
175
|
throw error;
|
|
105
176
|
}
|
|
106
177
|
}
|
|
107
178
|
async stop() {
|
|
179
|
+
if (this.stopOperation !== undefined)
|
|
180
|
+
return this.stopOperation;
|
|
181
|
+
const operation = this.stopSession();
|
|
182
|
+
this.stopOperation = operation;
|
|
183
|
+
try {
|
|
184
|
+
await operation;
|
|
185
|
+
}
|
|
186
|
+
finally {
|
|
187
|
+
if (this.stopOperation === operation)
|
|
188
|
+
this.stopOperation = undefined;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
async stopSession() {
|
|
108
192
|
if (!this.active && this.capture === undefined && !this.hostLeaseActive)
|
|
109
193
|
return;
|
|
194
|
+
const leaseRequest = this.leaseRequest;
|
|
195
|
+
const diagnostics = this.diagnostics;
|
|
196
|
+
const stopped = performance.now();
|
|
110
197
|
this.active = false;
|
|
198
|
+
this.chatStreaming = false;
|
|
199
|
+
this.cancelReply();
|
|
200
|
+
this.uploader?.close();
|
|
201
|
+
this.uploader = undefined;
|
|
202
|
+
this.responseAbort?.abort();
|
|
203
|
+
this.responseAbort = undefined;
|
|
204
|
+
globalThis.speechSynthesis?.cancel();
|
|
205
|
+
this.output.dispose();
|
|
111
206
|
let captureError;
|
|
112
207
|
try {
|
|
113
208
|
await this.capture?.stop();
|
|
@@ -117,102 +212,302 @@ export class ClientSherpaVoiceAdapter {
|
|
|
117
212
|
captureError = error;
|
|
118
213
|
}
|
|
119
214
|
this.capture = undefined;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
215
|
+
// 用户在模型启动期间关闭窗口时,RPC 取消不一定能撤销 Host 已创建的租约。
|
|
216
|
+
// 等待该请求结算后再释放,避免迟到的 start 留下无人持有的实时识别器。
|
|
217
|
+
const pendingLease = await leaseRequest?.catch(() => undefined);
|
|
218
|
+
if (pendingLease?.ok && !(isRecord(pendingLease.value) && pendingLease.value.unavailable === true))
|
|
219
|
+
this.hostLeaseActive = true;
|
|
125
220
|
if (this.hostLeaseActive) {
|
|
126
221
|
this.hostLeaseActive = false;
|
|
127
222
|
await this.services.rpc.call(CODINGNS_RPC_CHANNEL, 'assistant/voice/stop', { ownerId: this.configuredOwner }).catch(() => undefined);
|
|
128
223
|
}
|
|
129
224
|
this.epoch += 1;
|
|
130
225
|
this.emit({ type: 'state', state: 'disabled', epoch: this.epoch });
|
|
226
|
+
diagnostics?.record('client.call.stopped', { epoch: this.epoch, durationMs: performance.now() - stopped });
|
|
227
|
+
diagnostics?.dispose();
|
|
228
|
+
if (this.diagnostics === diagnostics)
|
|
229
|
+
this.diagnostics = undefined;
|
|
131
230
|
if (captureError !== undefined)
|
|
132
231
|
throw captureError;
|
|
133
232
|
}
|
|
134
233
|
async interrupt() {
|
|
135
|
-
this.
|
|
136
|
-
|
|
137
|
-
this.
|
|
138
|
-
|
|
234
|
+
if (!this.active)
|
|
235
|
+
return;
|
|
236
|
+
this.cancelReply();
|
|
237
|
+
this.uploader?.clearPending();
|
|
238
|
+
// 只走一次控制 RPC,避免数据面与 RPC 各打断一次,导致双方 epoch 错位。
|
|
239
|
+
const result = await this.services.rpc.call(CODINGNS_RPC_CHANNEL, 'assistant/voice/interrupt', { ownerId: this.configuredOwner });
|
|
240
|
+
if (!result.ok)
|
|
241
|
+
throw new Error(result.error.message);
|
|
242
|
+
if (!this.active)
|
|
243
|
+
return;
|
|
244
|
+
this.epoch = readEpoch(isRecord(result.value) ? result.value : {}, this.epoch + 1);
|
|
139
245
|
this.emit({ type: 'barge-in', epoch: this.epoch });
|
|
140
246
|
}
|
|
141
247
|
sendPcm(frame, epoch) { this.sendPcmFrame(frame, epoch); }
|
|
142
|
-
async speak(text, epoch) {
|
|
143
|
-
if (epoch !== this.epoch || text.trim() === '')
|
|
248
|
+
async speak(text, epoch, isCurrent = () => true, settleState = true) {
|
|
249
|
+
if (epoch !== this.epoch || text.trim() === '' || !isCurrent())
|
|
250
|
+
return;
|
|
251
|
+
const tts = readAssistantTtsSettings(this.services.settings?.getSnapshot().value?.assistant.tts);
|
|
252
|
+
const parameters = readAssistantTtsParameters(tts.parameters);
|
|
253
|
+
const reply = this.reply;
|
|
254
|
+
const onStart = () => {
|
|
255
|
+
if (epoch !== this.epoch || !isCurrent())
|
|
256
|
+
return;
|
|
257
|
+
if (reply !== undefined && !reply.playbackStarted) {
|
|
258
|
+
reply.playbackStarted = true;
|
|
259
|
+
this.trace('client.turn.first_playback_scheduled', { requestId: reply.requestId, epoch, firstPlaybackMs: performance.now() - reply.startedAt });
|
|
260
|
+
}
|
|
261
|
+
this.emit({ type: 'state', state: 'speaking', epoch });
|
|
262
|
+
};
|
|
263
|
+
if (tts.backend === 'moss-onnx') {
|
|
264
|
+
globalThis.speechSynthesis?.cancel();
|
|
265
|
+
// 完整试听等待播放结束;对话分段只等待合成结束,下一段可在播放期间准备。
|
|
266
|
+
const completed = await this.output[settleState ? 'speak' : 'append'](text.trim(), tts.selectedId, onStart, parameters);
|
|
267
|
+
if (settleState && completed && this.active && epoch === this.epoch && isCurrent())
|
|
268
|
+
this.emit({ type: 'state', state: 'listening', epoch });
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
this.output.cancel();
|
|
272
|
+
if (this.speakerMuted)
|
|
144
273
|
return;
|
|
145
274
|
const synthesis = globalThis.speechSynthesis;
|
|
146
275
|
if (synthesis === undefined || typeof globalThis.SpeechSynthesisUtterance !== 'function')
|
|
147
276
|
throw new Error('当前浏览器不支持语音播报');
|
|
148
|
-
|
|
149
|
-
await new Promise((resolve) => {
|
|
277
|
+
this.cancelOutput();
|
|
278
|
+
await new Promise((resolve, reject) => {
|
|
279
|
+
this.settleSpeech = resolve;
|
|
150
280
|
const utterance = new SpeechSynthesisUtterance(text.trim());
|
|
151
281
|
utterance.lang = 'zh-CN';
|
|
282
|
+
utterance.rate = parameters.rate;
|
|
283
|
+
utterance.volume = parameters.volume;
|
|
284
|
+
utterance.onstart = onStart;
|
|
152
285
|
utterance.onend = () => resolve();
|
|
153
|
-
utterance.onerror = () =>
|
|
286
|
+
utterance.onerror = (event) => { if (isCurrent())
|
|
287
|
+
reject(new Error(`浏览器语音播报失败:${event.error}`));
|
|
288
|
+
else
|
|
289
|
+
resolve(); };
|
|
154
290
|
synthesis.speak(utterance);
|
|
155
291
|
});
|
|
292
|
+
if (isCurrent())
|
|
293
|
+
this.settleSpeech = undefined;
|
|
294
|
+
if (settleState && this.active && epoch === this.epoch && isCurrent())
|
|
295
|
+
this.emit({ type: 'state', state: 'listening', epoch });
|
|
296
|
+
}
|
|
297
|
+
async clearConversation() {
|
|
298
|
+
this.cancelReply();
|
|
299
|
+
if (!this.active)
|
|
300
|
+
return;
|
|
301
|
+
const epoch = this.epoch;
|
|
302
|
+
const operation = this.services.rpc.call(CODINGNS_RPC_CHANNEL, 'assistant/voice/chat/clear', { ownerId: this.configuredOwner, epoch }).then((result) => {
|
|
303
|
+
if (!result.ok)
|
|
304
|
+
throw new Error(result.error.message);
|
|
305
|
+
if (this.active && this.epoch === epoch && this.reply === undefined)
|
|
306
|
+
this.emit({ type: 'state', state: 'listening', epoch });
|
|
307
|
+
});
|
|
308
|
+
this.clearOperation = operation;
|
|
309
|
+
try {
|
|
310
|
+
await operation;
|
|
311
|
+
}
|
|
312
|
+
finally {
|
|
313
|
+
if (this.clearOperation === operation)
|
|
314
|
+
this.clearOperation = undefined;
|
|
315
|
+
}
|
|
156
316
|
}
|
|
157
317
|
dispose() { void this.stop(); this.devices.dispose(); this.listeners.clear(); }
|
|
158
318
|
sendPcmFrame(frame, epoch) {
|
|
159
319
|
if (!this.active || this.uploader === undefined || epoch !== this.epoch)
|
|
160
320
|
return;
|
|
161
|
-
this.uploader.enqueue(
|
|
162
|
-
this.uploader.enqueue(frame.bytes);
|
|
321
|
+
this.uploader.enqueue(frame, epoch);
|
|
163
322
|
}
|
|
164
|
-
async readEvents(body,
|
|
323
|
+
async readEvents(body, abort) {
|
|
165
324
|
const reader = body.getReader();
|
|
166
325
|
const decoder = new TextDecoder();
|
|
167
326
|
let text = '';
|
|
168
327
|
try {
|
|
169
328
|
while (true) {
|
|
170
329
|
const next = await reader.read();
|
|
171
|
-
if (next.done)
|
|
330
|
+
if (next.done) {
|
|
331
|
+
if (!abort.signal.aborted)
|
|
332
|
+
throw new Error('语音事件连接已断开,请重新开始实时对话');
|
|
172
333
|
break;
|
|
334
|
+
}
|
|
173
335
|
text += decoder.decode(next.value, { stream: true });
|
|
174
336
|
let newline = text.indexOf('\n');
|
|
175
337
|
while (newline >= 0) {
|
|
176
338
|
const line = text.slice(0, newline).trim();
|
|
177
339
|
text = text.slice(newline + 1);
|
|
178
|
-
if (line !== '')
|
|
179
|
-
|
|
340
|
+
if (line !== '' && this.responseAbort === abort)
|
|
341
|
+
this.handleEvent(JSON.parse(line));
|
|
180
342
|
newline = text.indexOf('\n');
|
|
181
343
|
}
|
|
182
344
|
}
|
|
183
345
|
}
|
|
184
346
|
catch (error) {
|
|
185
|
-
if (
|
|
186
|
-
this.
|
|
347
|
+
if (!abort.signal.aborted)
|
|
348
|
+
this.failTransport(error instanceof Error ? error : new Error(String(error)), abort);
|
|
349
|
+
}
|
|
350
|
+
finally {
|
|
351
|
+
reader.releaseLock();
|
|
187
352
|
}
|
|
188
353
|
}
|
|
189
|
-
|
|
190
|
-
|
|
354
|
+
handleEvent(value) {
|
|
355
|
+
const eventEpoch = readEpoch(value, this.epoch);
|
|
356
|
+
if (eventEpoch < this.epoch || typeof value.type !== 'string')
|
|
191
357
|
return;
|
|
192
|
-
if (value.type === '
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
358
|
+
if (value.type === 'chat') {
|
|
359
|
+
const reply = this.reply;
|
|
360
|
+
if (reply !== undefined && eventEpoch === reply.epoch && isVoiceChatRun(value.run) && value.run.requestId === reply.requestId) {
|
|
361
|
+
reply.updates.push(value.run);
|
|
362
|
+
this.trace('client.turn.stream_update', { requestId: reply.requestId, epoch: eventEpoch, state: value.run.state, textLength: value.run.text.length });
|
|
363
|
+
}
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
366
|
+
if (eventEpoch > this.epoch || value.type === 'barge-in')
|
|
367
|
+
this.cancelReply();
|
|
368
|
+
this.epoch = eventEpoch;
|
|
369
|
+
this.trace('client.voice.event', { epoch: eventEpoch, state: value.type, textLength: typeof value.text === 'string' ? value.text.length : undefined });
|
|
370
|
+
if (value.type === 'state' && typeof value.state === 'string') {
|
|
371
|
+
// 识别器继续收音,等待回复时保留思考/播报状态。
|
|
372
|
+
if (this.reply === undefined || value.state !== 'listening')
|
|
373
|
+
this.emit({ type: 'state', state: value.state, epoch: eventEpoch });
|
|
374
|
+
}
|
|
375
|
+
else if (value.type === 'partial' && typeof value.text === 'string' && !this.microphoneMuted)
|
|
376
|
+
this.emit({ type: 'partial', text: value.text, epoch: eventEpoch });
|
|
196
377
|
else if (value.type === 'final' && typeof value.text === 'string') {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
378
|
+
if (this.microphoneMuted)
|
|
379
|
+
return;
|
|
380
|
+
if (value.text.trim() === '')
|
|
381
|
+
return;
|
|
382
|
+
const requestId = createClientId();
|
|
383
|
+
this.emit({ type: 'final', text: value.text, epoch: eventEpoch, requestId });
|
|
384
|
+
// LLM 和播报在后台运行,下一句的 partial 继续实时显示。
|
|
385
|
+
void this.handleFinalText(value.text, eventEpoch, requestId);
|
|
202
386
|
}
|
|
203
387
|
else if (value.type === 'barge-in')
|
|
204
|
-
this.emit({ type: 'barge-in', epoch:
|
|
388
|
+
this.emit({ type: 'barge-in', epoch: eventEpoch });
|
|
205
389
|
else if (value.type === 'error')
|
|
206
|
-
this.emit({ type: 'error', code: String(value.code ?? 'voice_stream_error'), message: String(value.message ?? value.code ?? ''), recoverable: value.recoverable !== false, epoch:
|
|
390
|
+
this.emit({ type: 'error', code: String(value.code ?? 'voice_stream_error'), message: String(value.message ?? value.code ?? ''), recoverable: value.recoverable !== false, epoch: eventEpoch });
|
|
207
391
|
}
|
|
208
|
-
async
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
392
|
+
async handleFinalText(text, epoch, requestId) {
|
|
393
|
+
this.cancelReply();
|
|
394
|
+
const reply = { requestId, epoch, abort: new AbortController(), startedAt: performance.now(), updates: new VoiceChatUpdates(), playbackStarted: false };
|
|
395
|
+
this.reply = reply;
|
|
396
|
+
const started = performance.now();
|
|
397
|
+
const fields = { requestId, epoch, textLength: text.length };
|
|
398
|
+
const diagnostics = this.diagnostics;
|
|
399
|
+
const trace = (event, metrics) => diagnostics?.record(event, { ...fields, ...metrics });
|
|
400
|
+
let polls = 0;
|
|
401
|
+
let firstText = false;
|
|
402
|
+
let firstSentence = false;
|
|
403
|
+
let outcome = 'cancelled';
|
|
404
|
+
trace('client.turn.start');
|
|
405
|
+
const isCurrent = () => this.active && this.epoch === epoch && this.reply === reply && !reply.abort.signal.aborted;
|
|
406
|
+
const sentences = new StreamingSentenceQueue(async (sentence) => {
|
|
407
|
+
if (!firstSentence) {
|
|
408
|
+
firstSentence = true;
|
|
409
|
+
trace('client.turn.first_sentence', { firstSentenceMs: performance.now() - started });
|
|
410
|
+
}
|
|
411
|
+
await this.speak(sentence, epoch, isCurrent, false);
|
|
412
|
+
}, isCurrent, Date.now, (event, metrics) => trace(`client.${event}`, metrics));
|
|
413
|
+
const payload = { ownerId: this.configuredOwner, epoch, requestId, sequence: ++this.replySequence };
|
|
414
|
+
try {
|
|
415
|
+
await this.clearOperation;
|
|
416
|
+
if (!isCurrent())
|
|
417
|
+
return;
|
|
418
|
+
this.emit({ type: 'state', state: 'thinking', epoch });
|
|
419
|
+
let result = await this.services.rpc.call(CODINGNS_RPC_CHANNEL, 'assistant/voice/chat/start', { ...payload, text }, reply.abort.signal);
|
|
420
|
+
let previousText = '';
|
|
421
|
+
while (isCurrent()) {
|
|
422
|
+
if (!result.ok)
|
|
423
|
+
throw new Error(result.error.message);
|
|
424
|
+
// 首次推送可能早于 start RPC 返回;累计快照优先,不能被旧响应覆盖。
|
|
425
|
+
const pushed = reply.updates.take();
|
|
426
|
+
if (pushed !== undefined && (!isRecord(result.value) || result.value.state === 'running' || pushed.state !== 'running'))
|
|
427
|
+
result = { ok: true, value: pushed };
|
|
428
|
+
const run = result.value;
|
|
429
|
+
if (!isRecord(run) || typeof run.text !== 'string' || !['running', 'completed', 'failed', 'cancelled'].includes(String(run.state)))
|
|
430
|
+
throw new Error('语音 LLM 返回了无效的对话状态');
|
|
431
|
+
if (run.text !== previousText || run.state === 'completed') {
|
|
432
|
+
if (!firstText && run.text.trim() !== '') {
|
|
433
|
+
firstText = true;
|
|
434
|
+
trace('client.turn.first_text', { firstTextMs: performance.now() - started });
|
|
435
|
+
}
|
|
436
|
+
previousText = run.text;
|
|
437
|
+
this.emit({ type: 'reply', requestId, text: run.text, final: run.state === 'completed', epoch });
|
|
438
|
+
}
|
|
439
|
+
if (run.state === 'running' || run.state === 'completed')
|
|
440
|
+
sentences.push(run.text, run.state === 'completed');
|
|
441
|
+
if (run.state === 'completed') {
|
|
442
|
+
trace('client.turn.llm_completed', { durationMs: performance.now() - started, count: polls, textLength: run.text.length });
|
|
443
|
+
await sentences.drain();
|
|
444
|
+
if (isCurrent())
|
|
445
|
+
await this.output.finish();
|
|
446
|
+
if (isCurrent())
|
|
447
|
+
this.emit({ type: 'state', state: 'listening', epoch });
|
|
448
|
+
outcome = isCurrent() ? 'completed' : 'cancelled';
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (run.state !== 'running')
|
|
452
|
+
throw new Error(typeof run.error === 'string' ? run.error : '语音 LLM 对话已停止');
|
|
453
|
+
if (this.chatStreaming) {
|
|
454
|
+
const pushed = await reply.updates.next(reply.abort.signal);
|
|
455
|
+
if (pushed !== undefined) {
|
|
456
|
+
result = { ok: true, value: pushed };
|
|
457
|
+
continue;
|
|
458
|
+
}
|
|
459
|
+
if (isCurrent())
|
|
460
|
+
trace('client.turn.poll_fallback');
|
|
461
|
+
}
|
|
462
|
+
else
|
|
463
|
+
await waitForReplyPoll(reply.abort.signal);
|
|
464
|
+
if (!isCurrent())
|
|
465
|
+
return;
|
|
466
|
+
const pollStarted = performance.now();
|
|
467
|
+
polls++;
|
|
468
|
+
result = await this.services.rpc.call(CODINGNS_RPC_CHANNEL, 'assistant/voice/chat/read', payload, reply.abort.signal);
|
|
469
|
+
if (performance.now() - pollStarted >= 250)
|
|
470
|
+
trace('client.turn.slow_poll', { durationMs: performance.now() - pollStarted });
|
|
471
|
+
}
|
|
215
472
|
}
|
|
473
|
+
catch (error) {
|
|
474
|
+
if (isCurrent()) {
|
|
475
|
+
outcome = 'failed';
|
|
476
|
+
trace('client.turn.error', { errorName: voiceDiagnosticError(error), durationMs: performance.now() - started });
|
|
477
|
+
this.emit({ type: 'error', code: 'voice_chat_failed', message: error instanceof Error ? error.message : String(error), recoverable: true, epoch });
|
|
478
|
+
this.cancelReply();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
finally {
|
|
482
|
+
trace('client.turn.finished', { state: outcome, count: polls, durationMs: performance.now() - started });
|
|
483
|
+
if (this.reply === reply)
|
|
484
|
+
this.reply = undefined;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
cancelReply() {
|
|
488
|
+
const reply = this.reply;
|
|
489
|
+
this.reply = undefined;
|
|
490
|
+
if (reply !== undefined)
|
|
491
|
+
this.trace('client.turn.cancel', { requestId: reply.requestId, epoch: reply.epoch });
|
|
492
|
+
reply?.abort.abort();
|
|
493
|
+
this.cancelOutput();
|
|
494
|
+
if (reply !== undefined)
|
|
495
|
+
void this.services.rpc.call(CODINGNS_RPC_CHANNEL, 'assistant/voice/chat/cancel', { ownerId: this.configuredOwner, epoch: reply.epoch, requestId: reply.requestId }).catch(() => undefined);
|
|
496
|
+
}
|
|
497
|
+
cancelOutput() {
|
|
498
|
+
this.settleSpeech?.();
|
|
499
|
+
this.settleSpeech = undefined;
|
|
500
|
+
globalThis.speechSynthesis?.cancel();
|
|
501
|
+
this.output.cancel();
|
|
502
|
+
}
|
|
503
|
+
failTransport(error, abort) {
|
|
504
|
+
if (this.responseAbort !== abort || abort.signal.aborted)
|
|
505
|
+
return;
|
|
506
|
+
this.trace('client.transport.error', { epoch: this.epoch, errorName: voiceDiagnosticError(error) });
|
|
507
|
+
void this.stop().catch(() => undefined).then(() => {
|
|
508
|
+
if (!this.active)
|
|
509
|
+
this.emit({ type: 'error', code: 'voice_stream_failed', message: error.message, recoverable: false, epoch: this.epoch });
|
|
510
|
+
});
|
|
216
511
|
}
|
|
217
512
|
emit(event) { for (const listener of [...this.listeners]) {
|
|
218
513
|
try {
|
|
@@ -221,26 +516,12 @@ export class ClientSherpaVoiceAdapter {
|
|
|
221
516
|
catch { /* UI 订阅者异常不能破坏语音数据面 */ }
|
|
222
517
|
} }
|
|
223
518
|
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
enqueue(bytes) { if (!this.closed) {
|
|
230
|
-
try {
|
|
231
|
-
this.controller?.enqueue(bytes.slice());
|
|
232
|
-
}
|
|
233
|
-
catch {
|
|
234
|
-
this.closed = true;
|
|
235
|
-
}
|
|
236
|
-
} }
|
|
237
|
-
close() { if (this.closed)
|
|
238
|
-
return; this.closed = true; try {
|
|
239
|
-
this.controller?.close();
|
|
240
|
-
}
|
|
241
|
-
catch { /* fetch 已断开 */ } }
|
|
519
|
+
function resolveVoiceStreamUrl(path, parameters) {
|
|
520
|
+
const url = new URL(path, globalThis.location?.origin ?? 'http://localhost');
|
|
521
|
+
for (const [key, value] of Object.entries(parameters))
|
|
522
|
+
url.searchParams.set(key, value);
|
|
523
|
+
return url.toString();
|
|
242
524
|
}
|
|
243
|
-
function resolveVoiceStreamUrl() { return new URL('/api/codingns/assistant/voice/stream', globalThis.location?.origin ?? 'http://localhost').toString(); }
|
|
244
525
|
function createClientId() { try {
|
|
245
526
|
return globalThis.crypto?.randomUUID?.() ?? `${Date.now()}-${Math.random()}`;
|
|
246
527
|
}
|
|
@@ -249,4 +530,16 @@ catch {
|
|
|
249
530
|
} }
|
|
250
531
|
function readEpoch(value, fallback) { return typeof value.epoch === 'number' && Number.isInteger(value.epoch) ? value.epoch : fallback; }
|
|
251
532
|
function isRecord(value) { return typeof value === 'object' && value !== null && !Array.isArray(value); }
|
|
533
|
+
function isVoiceChatRun(value) {
|
|
534
|
+
return isRecord(value) && typeof value.requestId === 'string' && typeof value.text === 'string' && value.text.length <= 16000 && ['running', 'completed', 'failed', 'cancelled'].includes(String(value.state));
|
|
535
|
+
}
|
|
536
|
+
function waitForReplyPoll(signal) {
|
|
537
|
+
return new Promise((resolve) => {
|
|
538
|
+
const finish = () => { clearTimeout(timer); signal.removeEventListener('abort', finish); resolve(); };
|
|
539
|
+
const timer = setTimeout(finish, 250);
|
|
540
|
+
signal.addEventListener('abort', finish, { once: true });
|
|
541
|
+
if (signal.aborted)
|
|
542
|
+
finish();
|
|
543
|
+
});
|
|
544
|
+
}
|
|
252
545
|
//# sourceMappingURL=sherpa-voice-adapter.js.map
|