@jingyi0605/codingns4dsh 0.2.1-beta.3 → 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 +4 -4
- package/README.md +95 -8
- 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 +24898 -2803
- 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/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/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/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 +39 -1
- 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/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/codex-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.js +10 -3
- package/data/build/dist/host/cli-adapters/codex-driver.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 +15 -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 +30 -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-remote-summary-source.js +12 -0
- 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 +45 -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/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 +19 -3
- package/profile/README.md +2 -2
- package/profile/package.json +2 -2
- package/profile/version.json +1 -1
- package/version.json +1 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/** 只有这个控制器拥有进程与端口;Client 的迟到请求不能复活已关闭的 generation。 */
|
|
2
|
+
export class DesktopAssistantController {
|
|
3
|
+
options;
|
|
4
|
+
owner;
|
|
5
|
+
sequence = -1;
|
|
6
|
+
generation = 0;
|
|
7
|
+
frame;
|
|
8
|
+
presentation = { visible: false, state: 'idle', caption: '', label: '' };
|
|
9
|
+
page;
|
|
10
|
+
agent;
|
|
11
|
+
starting;
|
|
12
|
+
stopping = Promise.resolve();
|
|
13
|
+
visible = false;
|
|
14
|
+
ready = false;
|
|
15
|
+
error;
|
|
16
|
+
openSequence = 0;
|
|
17
|
+
disposed = false;
|
|
18
|
+
settle;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
}
|
|
22
|
+
attach(owner) {
|
|
23
|
+
if (this.disposed)
|
|
24
|
+
return this.status(owner);
|
|
25
|
+
// 页面刷新显式取得所有权,旧页面随后发来的 detach/update 均失效。
|
|
26
|
+
if (this.owner !== owner) {
|
|
27
|
+
this.owner = owner;
|
|
28
|
+
this.sequence = -1;
|
|
29
|
+
this.error = undefined;
|
|
30
|
+
}
|
|
31
|
+
return this.status(owner);
|
|
32
|
+
}
|
|
33
|
+
async update(owner, sequence, presentation) {
|
|
34
|
+
if (this.disposed || this.owner !== owner || sequence <= this.sequence)
|
|
35
|
+
return this.status(owner);
|
|
36
|
+
this.sequence = sequence;
|
|
37
|
+
this.presentation = presentation;
|
|
38
|
+
await this.refresh();
|
|
39
|
+
return this.status(owner);
|
|
40
|
+
}
|
|
41
|
+
async refresh() {
|
|
42
|
+
this.frame = this.options.readFrame(this.presentation);
|
|
43
|
+
if (!this.options.supported || this.disposed || !this.owner || !this.frame) {
|
|
44
|
+
this.error = undefined;
|
|
45
|
+
await this.stop();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (this.error)
|
|
49
|
+
return;
|
|
50
|
+
if (!this.frame.visible) {
|
|
51
|
+
if (!this.ready) {
|
|
52
|
+
await this.stop();
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
this.visible = false;
|
|
56
|
+
this.agent?.send({ cmd: 'hide' });
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
if (!this.agent) {
|
|
60
|
+
this.starting ??= this.start().finally(() => { this.starting = undefined; });
|
|
61
|
+
await this.starting;
|
|
62
|
+
}
|
|
63
|
+
if (this.ready && this.frame?.visible)
|
|
64
|
+
this.agent?.send({ cmd: 'show', width: this.frame.size, height: Math.ceil(this.frame.size * 208 / 192) + (this.frame.caption ? 132 : 0) });
|
|
65
|
+
}
|
|
66
|
+
status(owner) {
|
|
67
|
+
// 能否使用原生形象与窗口是否已经显示是两回事,启动握手期间不能误判为不可用。
|
|
68
|
+
// 当前形象不支持原生渲染时明确放行页面回退,避免一直停留在原生等待状态。
|
|
69
|
+
return { available: this.options.supported && !this.disposed && this.options.readFrame(this.presentation) !== undefined,
|
|
70
|
+
owned: this.owner === owner, attached: this.owner !== undefined,
|
|
71
|
+
visible: this.visible && this.owner === owner, openSequence: this.openSequence, error: this.error };
|
|
72
|
+
}
|
|
73
|
+
async detach(owner) {
|
|
74
|
+
if (this.owner !== owner)
|
|
75
|
+
return;
|
|
76
|
+
this.owner = undefined;
|
|
77
|
+
await this.stop();
|
|
78
|
+
}
|
|
79
|
+
async dispose() { this.disposed = true; this.owner = undefined; await this.stop(); await this.starting; }
|
|
80
|
+
async start() {
|
|
81
|
+
const generation = ++this.generation;
|
|
82
|
+
await this.stopping;
|
|
83
|
+
if (generation !== this.generation || this.disposed)
|
|
84
|
+
return;
|
|
85
|
+
let page;
|
|
86
|
+
let agent;
|
|
87
|
+
try {
|
|
88
|
+
page = await this.options.openPage(() => this.frame);
|
|
89
|
+
if (generation !== this.generation) {
|
|
90
|
+
await page.close();
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
this.page = page;
|
|
94
|
+
const ready = new Promise((resolve, reject) => {
|
|
95
|
+
const timer = setTimeout(() => this.settle?.('原生悬浮窗口启动超时'), this.options.deadlineMs ?? 20000);
|
|
96
|
+
this.settle = (error) => { clearTimeout(timer); this.settle = undefined; error ? reject(new Error(error)) : resolve(); };
|
|
97
|
+
});
|
|
98
|
+
// 防止 launch 期间失败的就绪 Promise 成为未处理拒绝。
|
|
99
|
+
void ready.catch(() => undefined);
|
|
100
|
+
agent = await this.options.launch((event) => this.event(generation, event), () => this.failed(generation, '原生悬浮进程已退出'));
|
|
101
|
+
if (generation !== this.generation) {
|
|
102
|
+
await agent.stop();
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
this.agent = agent;
|
|
106
|
+
agent.send({ cmd: 'load', url: page.url, width: this.frame.size, height: Math.ceil(this.frame.size * 208 / 192) + (this.frame.caption ? 132 : 0) });
|
|
107
|
+
await ready;
|
|
108
|
+
if (generation !== this.generation)
|
|
109
|
+
return;
|
|
110
|
+
this.ready = true;
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
this.failed(generation, error instanceof Error ? error.message : String(error));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
event(generation, event) {
|
|
117
|
+
if (generation !== this.generation || this.disposed)
|
|
118
|
+
return;
|
|
119
|
+
if (event.ev === 'loaded')
|
|
120
|
+
this.settle?.();
|
|
121
|
+
if (event.ev === 'shown')
|
|
122
|
+
this.visible = this.frame?.visible === true;
|
|
123
|
+
// 打开 Desktop 或助理工作台只发送交互事件,不改变原生形象的常驻状态。
|
|
124
|
+
if (event.ev === 'open')
|
|
125
|
+
this.openSequence++;
|
|
126
|
+
if (event.ev === 'error')
|
|
127
|
+
this.failed(generation, typeof event.message === 'string' ? event.message.slice(0, 500) : '原生悬浮窗口不可用');
|
|
128
|
+
}
|
|
129
|
+
failed(generation, message) {
|
|
130
|
+
if (generation !== this.generation)
|
|
131
|
+
return;
|
|
132
|
+
this.error = message;
|
|
133
|
+
void this.stop();
|
|
134
|
+
}
|
|
135
|
+
stop() {
|
|
136
|
+
this.generation++;
|
|
137
|
+
this.visible = false;
|
|
138
|
+
this.ready = false;
|
|
139
|
+
this.settle?.('悬浮窗口已关闭');
|
|
140
|
+
const agent = this.agent, page = this.page;
|
|
141
|
+
this.agent = undefined;
|
|
142
|
+
this.page = undefined;
|
|
143
|
+
this.stopping = this.stopping.then(async () => {
|
|
144
|
+
// 任意一项清理失败都不能挡住另一项,也不能让后续 generation 永久挂在拒绝链上。
|
|
145
|
+
await Promise.allSettled([agent?.stop(), page?.close()]);
|
|
146
|
+
});
|
|
147
|
+
return this.stopping;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../../../../../src/host/desktop-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AA;QAC1D,CAAC,CAAC,CAAA;QACF,OAAO,IAAI,CAAC,QAAQ,CAAA;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
+
import type { FeatureModule } from '../../shared/contracts/feature.js';
|
|
3
|
+
import type { CodingNsHostServices } from '../features/types.js';
|
|
4
|
+
import { DesktopAssistantController } from './controller.js';
|
|
5
|
+
/** 原生窗口能力只在官方 Desktop Host 中启用,不依据客户端宣称的平台启动进程。 */
|
|
6
|
+
export declare function createDesktopAssistantFeature(): FeatureModule<CodingNsHostServices>;
|
|
7
|
+
/** 同时要求物理回环连接与 DSH 认证;PeerHost 转发与普通远程网页不能启动本机窗口。 */
|
|
8
|
+
export declare function handleDesktopAssistantRequest(request: IncomingMessage, response: ServerResponse, rejection: (headers: IncomingMessage['headers']) => number | undefined, controller: DesktopAssistantController): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=feature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/feature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAGhE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AACtE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAGhE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAI5D,mDAAmD;AACnD,wBAAgB,6BAA6B,IAAI,aAAa,CAAC,oBAAoB,CAAC,CA8BnF;AAED,qDAAqD;AACrD,wBAAsB,6BAA6B,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,cAAc,EACpG,SAAS,EAAE,CAAC,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,KAAK,MAAM,GAAG,SAAS,EAAE,UAAU,EAAE,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAmC/H"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { isDesktopAssistantHost, readDesktopAssistantPresentation, DESKTOP_ASSISTANT_CHANNEL } from '../../shared/desktop-assistant.js';
|
|
2
|
+
import { normalizeAssistantAppearance, selectedAssistantAvatar, resolveAssistantAvatarAsset } from '../../shared/assistant-avatar.js';
|
|
3
|
+
import { getAssistantAvatarPackages } from '../avatar/registry.js';
|
|
4
|
+
import { createAssistantAvatarRouteHandler } from '../features/assistant-avatar-runtime.js';
|
|
5
|
+
import { DesktopAssistantController } from './controller.js';
|
|
6
|
+
import { openDesktopAssistantPage } from './server.js';
|
|
7
|
+
import { launchDesktopAssistant } from './launcher.js';
|
|
8
|
+
/** 原生窗口能力只在官方 Desktop Host 中启用,不依据客户端宣称的平台启动进程。 */
|
|
9
|
+
export function createDesktopAssistantFeature() {
|
|
10
|
+
return {
|
|
11
|
+
descriptor: { name: 'desktopAssistant', version: '0.1.0', enabledByDefault: true, dependencies: [], runtime: 'host' },
|
|
12
|
+
start(context) {
|
|
13
|
+
const supported = isDesktopAssistantHost(process.platform, process.versions.electron, process.env.ELECTRON_RUN_AS_NODE, process.argv[1] ?? '');
|
|
14
|
+
const ctx = context.services.dshContext;
|
|
15
|
+
if (!supported || !ctx)
|
|
16
|
+
return;
|
|
17
|
+
const assets = createAssistantAvatarRouteHandler(getAssistantAvatarPackages(context.services), true);
|
|
18
|
+
const controller = new DesktopAssistantController({ supported, launch: launchDesktopAssistant,
|
|
19
|
+
openPage: (frame) => openDesktopAssistantPage({ frame, assets }),
|
|
20
|
+
readFrame: (presentation) => {
|
|
21
|
+
const settings = context.services.settings?.get();
|
|
22
|
+
if (!settings?.modules.globalVoiceAssistant || settings.assistant.profile?.initialized !== true)
|
|
23
|
+
return undefined;
|
|
24
|
+
const appearance = normalizeAssistantAppearance(settings.assistant.appearance);
|
|
25
|
+
if (!appearance.floatingEnabled)
|
|
26
|
+
return undefined;
|
|
27
|
+
const model = selectedAssistantAvatar(appearance);
|
|
28
|
+
// 第三方自定义渲染器在主 Client 注册,无法假设它已存在于独立页面。
|
|
29
|
+
if (!['builtin', 'image', 'spritesheet', 'live2d'].includes(resolveAssistantAvatarAsset(model, 'floating').renderer))
|
|
30
|
+
return undefined;
|
|
31
|
+
return { ...presentation, model, size: appearance.floatingSize };
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
const webServer = ctx.get('webServer');
|
|
35
|
+
context.resources.add(webServer.register({ kind: 'prefix', path: DESKTOP_ASSISTANT_CHANNEL,
|
|
36
|
+
handler: (req, res) => handleDesktopAssistantRequest(req, res, (headers) => ctx.connection.requestRejection({ headers }), controller),
|
|
37
|
+
}));
|
|
38
|
+
const unwatch = context.services.settings?.watch(() => { void controller.refresh().catch(() => undefined); });
|
|
39
|
+
if (unwatch)
|
|
40
|
+
context.resources.add(unwatch);
|
|
41
|
+
context.resources.add(() => controller.dispose());
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/** 同时要求物理回环连接与 DSH 认证;PeerHost 转发与普通远程网页不能启动本机窗口。 */
|
|
46
|
+
export async function handleDesktopAssistantRequest(request, response, rejection, controller) {
|
|
47
|
+
// 官方 dsh-app 转发会移除 Origin 并使用回环 Host;反代和 Web 页面不能借回环代理进入。
|
|
48
|
+
const localHost = /^(?:127\.0\.0\.1|localhost|\[::1\])(?::\d+)?$/u.test(request.headers.host ?? '');
|
|
49
|
+
const forwarded = ['forwarded', 'x-forwarded-for', 'x-forwarded-host', 'x-real-ip'].some((key) => request.headers[key] !== undefined);
|
|
50
|
+
if (!['127.0.0.1', '::1', '::ffff:127.0.0.1'].includes(request.socket.remoteAddress ?? '')
|
|
51
|
+
|| !localHost || forwarded || request.headers.origin !== undefined
|
|
52
|
+
|| rejection(request.headers) !== undefined) {
|
|
53
|
+
response.writeHead(403).end();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
if (request.method !== 'POST' || request.headers['content-type']?.split(';')[0] !== 'application/json') {
|
|
57
|
+
response.writeHead(405).end();
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
let rpcId = '';
|
|
61
|
+
try {
|
|
62
|
+
const chunks = [];
|
|
63
|
+
let length = 0;
|
|
64
|
+
for await (const chunk of request) {
|
|
65
|
+
const bytes = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
66
|
+
length += bytes.length;
|
|
67
|
+
if (length > 40000)
|
|
68
|
+
throw new Error('悬浮请求过大');
|
|
69
|
+
chunks.push(bytes);
|
|
70
|
+
}
|
|
71
|
+
const envelope = JSON.parse(Buffer.concat(chunks).toString('utf8'));
|
|
72
|
+
if (envelope.type !== 'client-request' || typeof envelope.rpcId !== 'string' || envelope.rpcId.length > 160)
|
|
73
|
+
throw new Error('悬浮协议无效');
|
|
74
|
+
rpcId = envelope.rpcId;
|
|
75
|
+
const action = envelope.method;
|
|
76
|
+
if (!['attach', 'update', 'detach'].includes(String(action)) || request.url?.split('?')[0] !== `${DESKTOP_ASSISTANT_CHANNEL}/${String(action)}`)
|
|
77
|
+
throw new Error('悬浮操作无效');
|
|
78
|
+
const input = envelope.payload;
|
|
79
|
+
if (!input || typeof input.ownerId !== 'string' || !/^[a-zA-Z0-9:-]{8,160}$/u.test(input.ownerId))
|
|
80
|
+
throw new Error('悬浮调用方无效');
|
|
81
|
+
let value;
|
|
82
|
+
if (action === 'attach')
|
|
83
|
+
value = controller.attach(input.ownerId);
|
|
84
|
+
else if (action === 'detach') {
|
|
85
|
+
await controller.detach(input.ownerId);
|
|
86
|
+
value = controller.status(input.ownerId);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
if (!Number.isSafeInteger(input.sequence) || Number(input.sequence) < 0)
|
|
90
|
+
throw new Error('悬浮更新序号无效');
|
|
91
|
+
value = await controller.update(input.ownerId, Number(input.sequence), readDesktopAssistantPresentation(input.presentation));
|
|
92
|
+
}
|
|
93
|
+
response.setHeader('Content-Type', 'application/json');
|
|
94
|
+
response.end(JSON.stringify({ type: 'server-response', rpcId, result: { ok: true, value } }));
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
response.setHeader('Content-Type', 'application/json');
|
|
98
|
+
response.end(JSON.stringify({ type: 'server-response', rpcId,
|
|
99
|
+
result: { ok: false, error: { code: 'desktop_assistant_unavailable', message: error instanceof Error ? error.message : String(error), details: {} } } }));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feature.js","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/feature.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,gCAAgC,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAA;AACvI,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAA;AAGrI,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAA;AAClE,OAAO,EAAE,iCAAiC,EAAE,MAAM,yCAAyC,CAAA;AAC3F,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAA;AAEtD,mDAAmD;AACnD,MAAM,UAAU,6BAA6B;IAC3C,OAAO;QACL,UAAU,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE;QACrH,KAAK,CAAC,OAAO;YACX,MAAM,SAAS,GAAG,sBAAsB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,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,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;gBAAE,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAA;YACpG,KAAK,GAAG,MAAM,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,gCAAgC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAA;QAC9H,CAAC;QACD,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,CAAA;IACvJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK;YAClH,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,+BAA+B,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAC7J,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DesktopAssistantAgent } from './controller.js';
|
|
2
|
+
/** 所有运行数据落在插件自有目录,不触碰 Desktop 壳或其包目录。 */
|
|
3
|
+
export declare function desktopAssistantDirectory(): string;
|
|
4
|
+
export declare function launchDesktopAssistant(onEvent: (event: Record<string, unknown>) => void, onExit: () => void): Promise<DesktopAssistantAgent>;
|
|
5
|
+
//# sourceMappingURL=launcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/launcher.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAA;AAE5D,yCAAyC;AACzC,wBAAgB,yBAAyB,IAAI,MAAM,CAAuE;AAE1H,wBAAsB,sBAAsB,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAoDlJ"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { mkdir, mkdtemp, readFile, rm, writeFile, rename } from 'node:fs/promises';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { resolveDshHome } from '@deepseek-ai/dsh-home-paths';
|
|
6
|
+
import { buildMacAssistantScript } from './mac-agent.js';
|
|
7
|
+
import { buildWinAssistantScript } from './win-agent.js';
|
|
8
|
+
import { observeDesktopAssistantProcess } from './process.js';
|
|
9
|
+
/** 所有运行数据落在插件自有目录,不触碰 Desktop 壳或其包目录。 */
|
|
10
|
+
export function desktopAssistantDirectory() { return join(resolveDshHome(), 'codingns4dsh', 'desktop-assistant'); }
|
|
11
|
+
export async function launchDesktopAssistant(onEvent, onExit) {
|
|
12
|
+
const directory = desktopAssistantDirectory();
|
|
13
|
+
await mkdir(directory, { recursive: true });
|
|
14
|
+
const temporary = await mkdtemp(join(directory, 'run-'));
|
|
15
|
+
const windows = process.platform === 'win32';
|
|
16
|
+
const sdkRoot = fileURLToPath(new URL('../../../../../assets/desktop-assistant/webview2/', import.meta.url));
|
|
17
|
+
const script = join(temporary, windows ? 'assistant.ps1' : 'assistant.js');
|
|
18
|
+
let bounds;
|
|
19
|
+
try {
|
|
20
|
+
bounds = JSON.parse(await readFile(join(directory, 'position.json'), 'utf8'));
|
|
21
|
+
}
|
|
22
|
+
catch { /* 首次运行或损坏记录使用系统默认位置。 */ }
|
|
23
|
+
// PowerShell 5.1 无 BOM 时按系统 ANSI 读取,用户目录含中文会导致 SDK 路径损坏。
|
|
24
|
+
try {
|
|
25
|
+
await writeFile(script, windows ? '\uFEFF' + buildWinAssistantScript(sdkRoot) : buildMacAssistantScript(), 'utf8');
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
await rm(temporary, { recursive: true, force: true });
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
const command = windows ? join(process.env.SystemRoot ?? 'C:\\Windows', 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe') : '/usr/bin/osascript';
|
|
32
|
+
const args = windows ? ['-NoProfile', '-NonInteractive', '-Sta', '-ExecutionPolicy', 'Bypass', '-File', script] : ['-l', 'JavaScript', script];
|
|
33
|
+
const child = spawn(command, args, { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
|
|
34
|
+
let buffer = '', stopped = false, saving = Promise.resolve();
|
|
35
|
+
const failure = (message) => onEvent({ ev: 'error', message });
|
|
36
|
+
const exit = observeDesktopAssistantProcess(child, failure, onExit, () => stopped);
|
|
37
|
+
child.stdout.setEncoding('utf8');
|
|
38
|
+
child.stdout.on('data', (chunk) => {
|
|
39
|
+
buffer += chunk;
|
|
40
|
+
if (buffer.length > 65536) {
|
|
41
|
+
buffer = '';
|
|
42
|
+
failure('原生悬浮输出超出限制');
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let newline;
|
|
46
|
+
while ((newline = buffer.indexOf('\n')) >= 0) {
|
|
47
|
+
const line = buffer.slice(0, newline);
|
|
48
|
+
buffer = buffer.slice(newline + 1);
|
|
49
|
+
try {
|
|
50
|
+
const event = JSON.parse(line);
|
|
51
|
+
if (event.ev === 'moved' && ['x', 'y', 'width', 'height'].every((key) => typeof event[key] === 'number' && Number.isFinite(event[key]))) {
|
|
52
|
+
const value = JSON.stringify({ x: event.x, y: event.y, width: event.width, height: event.height });
|
|
53
|
+
// 只保存完成拖动的位置;串行原子替换,退出等待最后一笔。
|
|
54
|
+
saving = saving.then(async () => { await writeFile(join(temporary, 'position.json'), value); await rename(join(temporary, 'position.json'), join(directory, 'position.json')); }).catch(() => undefined);
|
|
55
|
+
}
|
|
56
|
+
onEvent(event);
|
|
57
|
+
}
|
|
58
|
+
catch { /* 非协议行不解释为命令。 */ }
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
return {
|
|
62
|
+
send(command) {
|
|
63
|
+
if (stopped || child.stdin.destroyed)
|
|
64
|
+
return;
|
|
65
|
+
const extra = command.cmd === 'load' ? { parentPid: process.ppid, userData: join(directory, 'webview2'), bounds } : {};
|
|
66
|
+
child.stdin.write(JSON.stringify({ ...command, ...extra }) + '\n');
|
|
67
|
+
},
|
|
68
|
+
async stop() {
|
|
69
|
+
if (stopped) {
|
|
70
|
+
await exit;
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
stopped = true;
|
|
74
|
+
if (!child.stdin.destroyed)
|
|
75
|
+
child.stdin.end(JSON.stringify({ cmd: 'quit' }) + '\n');
|
|
76
|
+
const timer = setTimeout(() => child.kill(), 2000);
|
|
77
|
+
await exit;
|
|
78
|
+
clearTimeout(timer);
|
|
79
|
+
await saving;
|
|
80
|
+
await rm(temporary, { recursive: true, force: true });
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=launcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/launcher.ts"],"names":[],"mappings":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AAI,CAAC,KAAK,CAAC,KAAK,CAAC,SAAS;gBAAE,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAAC,CAAA;YACnF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,IAAI,CAAC,CAAA;YAClD,MAAM,IAAI,CAAC;YAAC,YAAY,CAAC,KAAK,CAAC,CAAA;YAC/B,MAAM,MAAM,CAAA;YACZ,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACvD,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** 交给 Desktop 的 open-url 入口恢复主窗口;单纯激活进程不会取消窗口最小化。 */
|
|
2
|
+
export declare function buildMacDesktopFocusScript(): string;
|
|
3
|
+
/** Cocoa/WKWebView 伴随进程;stdout 只传 JSON Lines,原生异常转为明确失败事件。 */
|
|
4
|
+
export declare function buildMacAssistantScript(): string;
|
|
5
|
+
//# sourceMappingURL=mac-agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mac-agent.d.ts","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/mac-agent.ts"],"names":[],"mappings":"AAEA,qDAAqD;AACrD,wBAAgB,0BAA0B,IAAI,MAAM,CAuBnD;AAED,8DAA8D;AAC9D,wBAAgB,uBAAuB,IAAI,MAAM,CA6FhD"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { clampDesktopAssistantBounds } from '../../shared/desktop-assistant.js';
|
|
2
|
+
/** 交给 Desktop 的 open-url 入口恢复主窗口;单纯激活进程不会取消窗口最小化。 */
|
|
3
|
+
export function buildMacDesktopFocusScript() {
|
|
4
|
+
return String.raw `
|
|
5
|
+
var focusingDesktop=false
|
|
6
|
+
function focusDesktop(){
|
|
7
|
+
if(focusingDesktop)return
|
|
8
|
+
var desktop=$.NSRunningApplication.runningApplicationWithProcessIdentifier(parentPid)
|
|
9
|
+
if(parentPid<=0||desktop.isNil()||desktop.terminated||desktop.bundleURL.isNil())throw new Error('Desktop application is unavailable')
|
|
10
|
+
var configuration=$.NSWorkspaceOpenConfiguration.configuration
|
|
11
|
+
configuration.setActivates(true);configuration.setCreatesNewApplicationInstance(false)
|
|
12
|
+
configuration.setAllowsRunningApplicationSubstitution(false)
|
|
13
|
+
configuration.setPromptsUserIfNeeded(false)
|
|
14
|
+
focusingDesktop=true
|
|
15
|
+
try{
|
|
16
|
+
// 明确指定当前父进程的应用包,避免系统协议默认值指向另一份 Desktop。
|
|
17
|
+
$.NSWorkspace.sharedWorkspace.openURLsWithApplicationAtURLConfigurationCompletionHandler(
|
|
18
|
+
$([$.NSURL.URLWithString('dsh://open')]),desktop.bundleURL,configuration,safe(function(application,error){
|
|
19
|
+
focusingDesktop=false
|
|
20
|
+
if(!error.isNil()){emit({ev:'error',message:'Desktop restore: '+ObjC.unwrap(error.localizedDescription)});return}
|
|
21
|
+
emit({ev:'open'})
|
|
22
|
+
}))
|
|
23
|
+
}catch(error){focusingDesktop=false;throw error}
|
|
24
|
+
}
|
|
25
|
+
`.trim();
|
|
26
|
+
}
|
|
27
|
+
/** Cocoa/WKWebView 伴随进程;stdout 只传 JSON Lines,原生异常转为明确失败事件。 */
|
|
28
|
+
export function buildMacAssistantScript() {
|
|
29
|
+
return String.raw `
|
|
30
|
+
ObjC.import('Cocoa')
|
|
31
|
+
ObjC.import('WebKit')
|
|
32
|
+
var out=$.NSFileHandle.fileHandleWithStandardOutput,NL=String.fromCharCode(10)
|
|
33
|
+
function emit(m){out.writeData($(JSON.stringify(m)+NL).dataUsingEncoding($.NSUTF8StringEncoding))}
|
|
34
|
+
function safe(fn){return function(){try{return fn.apply(null,arguments)}catch(e){emit({ev:'error',message:String(e)})}}}
|
|
35
|
+
var app=$.NSApplication.sharedApplication
|
|
36
|
+
app.setActivationPolicy(1)
|
|
37
|
+
var win=$.NSPanel.alloc.initWithContentRectStyleMaskBackingDefer($.NSMakeRect(0,0,144,156),128,2,false)
|
|
38
|
+
win.setOpaque(false);win.setBackgroundColor($.NSColor.clearColor);win.setHasShadow(false)
|
|
39
|
+
win.setLevel(3);win.setCollectionBehavior(1|16|256);win.setHidesOnDeactivate(false)
|
|
40
|
+
var visible=false,drag=false,lastMouse=null,parentPid=0,origin='',positioned=false
|
|
41
|
+
${buildMacDesktopFocusScript()}
|
|
42
|
+
var clampBounds=${clampDesktopAssistantBounds.toString()}
|
|
43
|
+
function moved(){var f=win.frame;emit({ev:'moved',x:f.origin.x,y:f.origin.y,width:f.size.width,height:f.size.height})}
|
|
44
|
+
function clamp(){
|
|
45
|
+
var f=win.frame,screens=$.NSScreen.screens,areas=[]
|
|
46
|
+
for(var i=0;i<screens.count;i++){var a=screens.objectAtIndex(i).visibleFrame;areas.push({x:a.origin.x,y:a.origin.y,width:a.size.width,height:a.size.height})}
|
|
47
|
+
var next=clampBounds({x:f.origin.x,y:f.origin.y,width:f.size.width,height:f.size.height},areas)
|
|
48
|
+
win.setFrameDisplay($.NSMakeRect(next.x,next.y,next.width,next.height),true)
|
|
49
|
+
}
|
|
50
|
+
function bounds(m){
|
|
51
|
+
var f=win.frame,w=Math.max(72,Math.min(320,Number(m.width)||144)),h=Math.max(78,Math.min(480,Number(m.height)||156))
|
|
52
|
+
var area=$.NSScreen.mainScreen.visibleFrame
|
|
53
|
+
var x=positioned?f.origin.x:area.origin.x+area.size.width-w-24,y=positioned?f.origin.y:area.origin.y+24
|
|
54
|
+
if(m.bounds&&Number.isFinite(m.bounds.x)&&Number.isFinite(m.bounds.y)){x=m.bounds.x;y=m.bounds.y}
|
|
55
|
+
win.setFrameDisplay($.NSMakeRect(x,y,w,h),true);positioned=true;clamp()
|
|
56
|
+
}
|
|
57
|
+
function endDrag(){if(!drag)return;drag=false;clamp();moved()}
|
|
58
|
+
var config=$.WKWebViewConfiguration.alloc.init,controller=$.WKUserContentController.alloc.init
|
|
59
|
+
// JXA 注册类不返回类对象;WebKit 协议元数据也并非所有系统都可见。
|
|
60
|
+
// 显式声明代理方法签名,注册后通过 $ 查找类,由 WebKit 按选择器调用。
|
|
61
|
+
ObjC.registerSubclass({name:'CodingNsAssistantBridge',methods:{'userContentController:didReceiveScriptMessage:':{types:['void',['id','id']],implementation:safe(function(c,m){
|
|
62
|
+
if(!m.frameInfo.isMainFrame)return
|
|
63
|
+
var msg=JSON.parse(ObjC.unwrap(m.body))
|
|
64
|
+
if(msg.type==='ready')emit({ev:'loaded'})
|
|
65
|
+
else if(msg.type==='error')emit({ev:'error',message:String(msg.message).slice(0,500)})
|
|
66
|
+
else if(msg.type==='drag-start'){drag=true;lastMouse=$.NSEvent.mouseLocation}
|
|
67
|
+
else if(msg.type==='drag-end')endDrag()
|
|
68
|
+
else if(msg.type==='open')focusDesktop()
|
|
69
|
+
})}}})
|
|
70
|
+
var bridgeHandler=$.CodingNsAssistantBridge.alloc.init
|
|
71
|
+
controller.addScriptMessageHandlerName(bridgeHandler,$('assistant'));config.setUserContentController(controller)
|
|
72
|
+
config.setWebsiteDataStore($.WKWebsiteDataStore.nonPersistentDataStore)
|
|
73
|
+
var web=$.WKWebView.alloc.initWithFrameConfiguration($.NSMakeRect(0,0,144,156),config)
|
|
74
|
+
web.setValueForKey($.NSNumber.numberWithBool(false),'drawsBackground');win.setContentView(web)
|
|
75
|
+
ObjC.registerSubclass({name:'CodingNsAssistantNavigation',methods:{
|
|
76
|
+
'webView:decidePolicyForNavigationAction:decisionHandler:':{types:['void',['id','id','id']],implementation:safe(function(w,a,done){
|
|
77
|
+
var policy=0
|
|
78
|
+
try{var url=ObjC.unwrap(a.request.URL.absoluteString);policy=url.indexOf(origin+'/')===0?1:0}
|
|
79
|
+
finally{
|
|
80
|
+
// block 的隐含参数只有自身,没有 Objective-C 方法的 selector。
|
|
81
|
+
// 用 NSInvocation 按 void (^)(NSInteger) 签名调用,不能把它当 JS 函数。
|
|
82
|
+
var invocation=$.NSInvocation.invocationWithMethodSignature($.NSMethodSignature.signatureWithObjCTypes('v@?q')),argument=Ref('long')
|
|
83
|
+
argument[0]=policy;invocation.setTarget(done);invocation.setArgumentAtIndex(argument,1);invocation.invoke
|
|
84
|
+
}
|
|
85
|
+
})},
|
|
86
|
+
'webView:didFailProvisionalNavigation:withError:':{types:['void',['id','id','id']],implementation:safe(function(w,n,e){emit({ev:'error',message:'navigation: '+e.code+' '+ObjC.unwrap(e.localizedDescription)})})},
|
|
87
|
+
'webView:didFailNavigation:withError:':{types:['void',['id','id','id']],implementation:safe(function(w,n,e){emit({ev:'error',message:'navigation: '+e.code+' '+ObjC.unwrap(e.localizedDescription)})})},
|
|
88
|
+
'webViewWebContentProcessDidTerminate:':{types:['void',['id']],implementation:safe(function(w){emit({ev:'error',message:'webview process terminated'})})}
|
|
89
|
+
}})
|
|
90
|
+
var navigation=$.CodingNsAssistantNavigation.alloc.init;web.setNavigationDelegate(navigation)
|
|
91
|
+
$.NSTimer.scheduledTimerWithTimeIntervalRepeatsBlock(1/60,true,safe(function(){
|
|
92
|
+
if(!drag)return;if(($.NSEvent.pressedMouseButtons&1)===0||!visible){endDrag();return}
|
|
93
|
+
var p=$.NSEvent.mouseLocation,f=win.frame;win.setFrameOrigin($.NSMakePoint(f.origin.x+p.x-lastMouse.x,f.origin.y+p.y-lastMouse.y));lastMouse=p
|
|
94
|
+
}))
|
|
95
|
+
$.NSNotificationCenter.defaultCenter.addObserverForNameObjectQueueUsingBlock($.NSApplicationDidChangeScreenParametersNotification,$(),$.NSOperationQueue.mainQueue,safe(function(){clamp();moved()}))
|
|
96
|
+
function handle(m){
|
|
97
|
+
if(m.cmd==='quit'){app.terminate($());return}
|
|
98
|
+
if(m.cmd==='hide'){endDrag();win.orderOut($());visible=false;return}
|
|
99
|
+
if(m.cmd==='load'){
|
|
100
|
+
parentPid=Number(m.parentPid)||0;bounds(m)
|
|
101
|
+
var url=$.NSURL.URLWithString($(String(m.url)));origin=String(m.url).split('/').slice(0,3).join('/')
|
|
102
|
+
web.loadRequest($.NSURLRequest.requestWithURL(url));return
|
|
103
|
+
}
|
|
104
|
+
if(m.cmd==='show'){if(!drag)bounds(m);if(!visible){win.orderFrontRegardless;visible=true}emit({ev:'shown'});return}
|
|
105
|
+
}
|
|
106
|
+
var stdin=$.NSFileHandle.fileHandleWithStandardInput,buf='',pending=$.NSMutableData.data
|
|
107
|
+
$.NSNotificationCenter.defaultCenter.addObserverForNameObjectQueueUsingBlock($.NSFileHandleDataAvailableNotification,stdin,$.NSOperationQueue.mainQueue,safe(function(){
|
|
108
|
+
var data=stdin.availableData;if(data.length===0){app.terminate($());return}
|
|
109
|
+
// 管道可能在中文字节中间分块,完整 UTF-8 到达前保留原始数据。
|
|
110
|
+
pending.appendData(data);if(pending.length+buf.length>65536)throw new Error('command too large')
|
|
111
|
+
var decoded=$.NSString.alloc.initWithDataEncoding(pending,$.NSUTF8StringEncoding)
|
|
112
|
+
if(decoded.isNil()){stdin.waitForDataInBackgroundAndNotify;return}
|
|
113
|
+
buf+=decoded.js;pending.setLength(0)
|
|
114
|
+
var i;while((i=buf.indexOf(NL))>=0){var line=buf.slice(0,i);buf=buf.slice(i+1);handle(JSON.parse(line))}
|
|
115
|
+
stdin.waitForDataInBackgroundAndNotify
|
|
116
|
+
}))
|
|
117
|
+
stdin.waitForDataInBackgroundAndNotify
|
|
118
|
+
emit({ev:'ready'})
|
|
119
|
+
app.run
|
|
120
|
+
`.trim();
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=mac-agent.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mac-agent.js","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/mac-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAA;AAE/E,qDAAqD;AACrD,MAAM,UAAU,0BAA0B;IACxC,OAAO,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;CAqBlB,CAAC,IAAI,EAAE,CAAA;AACR,CAAC;AAED,8DAA8D;AAC9D,MAAM,UAAU,uBAAuB;IACrC,OAAO,MAAM,CAAC,GAAG,CAAA;;;;;;;;;;;;EAYjB,0BAA0B,EAAE;kBACZ,2BAA2B,CAAC,QAAQ,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EvD,CAAC,IAAI,EAAE,CAAA;AACR,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChildProcessWithoutNullStreams } from 'node:child_process';
|
|
2
|
+
/** 保留有上限的原生启动诊断;正常回收不产生降级提示。 */
|
|
3
|
+
export declare function observeDesktopAssistantProcess(child: ChildProcessWithoutNullStreams, onError: (message: string) => void, onExit: () => void, isStopping: () => boolean): Promise<void>;
|
|
4
|
+
//# sourceMappingURL=process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAA;AAExE,gCAAgC;AAChC,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,8BAA8B,EAClF,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,EAAE,UAAU,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBlG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** 保留有上限的原生启动诊断;正常回收不产生降级提示。 */
|
|
2
|
+
export function observeDesktopAssistantProcess(child, onError, onExit, isStopping) {
|
|
3
|
+
let stderr = '', reported = false;
|
|
4
|
+
const failure = (message) => {
|
|
5
|
+
if (reported || isStopping())
|
|
6
|
+
return;
|
|
7
|
+
reported = true;
|
|
8
|
+
// 导航错误可能包含一次性启动 URL,不把实例令牌放进界面。
|
|
9
|
+
onError(message.replace(/([?&]token=)[^\s&"'<>]+/gu, '$1[redacted]').slice(0, 500));
|
|
10
|
+
};
|
|
11
|
+
child.stderr.setEncoding('utf8');
|
|
12
|
+
child.stderr.on('data', (chunk) => { stderr = (stderr + chunk).slice(0, 4096); });
|
|
13
|
+
child.once('error', (error) => failure(`原生悬浮启动失败:${error.message}`));
|
|
14
|
+
// EPIPE 常常先于 close 到达;等待退出诊断,避免它掩盖真正的脚本异常。
|
|
15
|
+
child.stdin.on('error', () => { });
|
|
16
|
+
return new Promise((resolve) => {
|
|
17
|
+
child.once('close', (code, signal) => {
|
|
18
|
+
const reason = stderr.trim() || `code=${String(code)}, signal=${signal ?? 'none'}`;
|
|
19
|
+
failure(`原生悬浮进程已退出:${reason}`);
|
|
20
|
+
onExit();
|
|
21
|
+
resolve();
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"process.js","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/process.ts"],"names":[],"mappings":"AAEA,gCAAgC;AAChC,MAAM,UAAU,8BAA8B,CAAC,KAAqC,EAClF,OAAkC,EAAE,MAAkB,EAAE,UAAyB;IACjF,IAAI,MAAM,GAAG,EAAE,EAAE,QAAQ,GAAG,KAAK,CAAA;IACjC,MAAM,OAAO,GAAG,CAAC,OAAe,EAAQ,EAAE;QACxC,IAAI,QAAQ,IAAI,UAAU,EAAE;YAAE,OAAM;QACpC,QAAQ,GAAG,IAAI,CAAA;QACf,gCAAgC;QAChC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,2BAA2B,EAAE,cAAc,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAA;IACrF,CAAC,CAAA;IACD,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAChC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,GAAG,MAAM,GAAG,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;IACxF,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;IACpE,2CAA2C;IAC3C,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IACjC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;YACnC,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,IAAI,QAAQ,MAAM,CAAC,IAAI,CAAC,YAAY,MAAM,IAAI,MAAM,EAAE,CAAA;YAClF,OAAO,CAAC,aAAa,MAAM,EAAE,CAAC,CAAA;YAC9B,MAAM,EAAE,CAAC;YAAC,OAAO,EAAE,CAAA;QACrB,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DesktopAssistantFrame } from '../../shared/desktop-assistant.js';
|
|
2
|
+
export interface DesktopAssistantPage {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
close(): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
/** 独立回环服务只提供形象,不把完整 DSH 页面或认证会话交给伴随窗口。 */
|
|
7
|
+
export declare function openDesktopAssistantPage(options: {
|
|
8
|
+
readonly frame: () => DesktopAssistantFrame | undefined;
|
|
9
|
+
readonly assets: (request: Request) => Promise<Response>;
|
|
10
|
+
readonly readBundle?: () => Promise<string>;
|
|
11
|
+
}): Promise<DesktopAssistantPage>;
|
|
12
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../src/host/desktop-assistant/server.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAA;AAE9E,MAAM,WAAW,oBAAoB;IAAG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE;AACtF,0CAA0C;AAC1C,wBAAsB,wBAAwB,CAAC,OAAO,EAAE;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,qBAAqB,GAAG,SAAS,CAAA;IACvD,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IACxD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CAC5C,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAyChC"}
|