@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,4 +1,4 @@
|
|
|
1
|
-
import { createElement, useEffect, useRef, useSyncExternalStore } from 'react';
|
|
1
|
+
import { createElement, useCallback, useEffect, useRef, useState, useSyncExternalStore } from 'react';
|
|
2
2
|
import { Button } from '@deepseek-ai/dsh-client-ui-primitives';
|
|
3
3
|
import { FitAddon } from '@xterm/addon-fit';
|
|
4
4
|
import { Terminal } from '@xterm/xterm';
|
|
@@ -9,6 +9,10 @@ import { resolveCodingNsTranslator } from '../locale.js';
|
|
|
9
9
|
import { stripTerminalDeviceAttributeResponses } from '../../shared/terminal-input.js';
|
|
10
10
|
import { debugInfo } from '../../shared/debug.js';
|
|
11
11
|
import { terminalClass } from './styles.js';
|
|
12
|
+
import { installTerminalSelectionActions, TerminalSelectionActions } from './selection-actions.js';
|
|
13
|
+
import { TerminalSurfaceCache } from './surface-cache.js';
|
|
14
|
+
/** 每个工作区终端只有一块屏幕,切换会话时移动 DOM,保留缓冲区、光标与滚动位置。 */
|
|
15
|
+
const surfaces = new TerminalSurfaceCache();
|
|
12
16
|
const TERMINAL_TOUCH_MOMENTUM_GAIN = 2;
|
|
13
17
|
const TERMINAL_TOUCH_MOMENTUM_MIN_LINES_PER_MS = 0.06;
|
|
14
18
|
const TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS = 0.9;
|
|
@@ -23,361 +27,52 @@ const TERMINAL_CONTENT_EDGE_GAP = 5;
|
|
|
23
27
|
/** 终端滚动条停止滚动后的自动隐藏延迟。 */
|
|
24
28
|
const TERMINAL_SCROLLBAR_HIDE_DELAY_MS = 3000;
|
|
25
29
|
/** 使用与 DSH 内置终端相同的布局、状态条和 xterm 默认参数。 */
|
|
26
|
-
export function CodingNsXtermView({ view, settings, themeRevision, onNewTerminal, active = true, visible = true, t: injectedTranslator, }) {
|
|
30
|
+
export function CodingNsXtermView({ view, settings, themeRevision, onNewTerminal, sharing, sessionId = view.sessionId, active = true, visible = true, t: injectedTranslator, }) {
|
|
27
31
|
const t = injectedTranslator ?? resolveCodingNsTranslator();
|
|
28
32
|
const hostRef = useRef(null);
|
|
29
|
-
const
|
|
30
|
-
const fitRef = useRef(null);
|
|
31
|
-
const scheduleReflowRef = useRef(null);
|
|
32
|
-
const lastRevision = useRef(0);
|
|
33
|
+
const surfaceRef = useRef(null);
|
|
33
34
|
const sizeClaimAtRef = useRef(0);
|
|
34
|
-
const previousActiveRef = useRef(
|
|
35
|
+
const previousActiveRef = useRef(false);
|
|
36
|
+
const [selectionActions, setSelectionActions] = useState();
|
|
37
|
+
const dismissSelection = useCallback(() => setSelectionActions(undefined), []);
|
|
35
38
|
const state = useSyncExternalStore(view.state.subscribe.bind(view.state), view.state.getSnapshot.bind(view.state));
|
|
36
39
|
const settingsSnapshot = useSyncExternalStore(settings.subscribe.bind(settings), settings.getSnapshot.bind(settings));
|
|
37
40
|
const appearance = settingsSnapshot.value?.terminalEnhancement.appearance
|
|
38
41
|
?? DEFAULT_TERMINAL_ENHANCEMENT_SETTINGS.appearance;
|
|
39
42
|
const hasTerminal = state.info !== undefined;
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
-
useEffect(() => visible ? view.mount() : undefined, [view, visible]);
|
|
43
|
+
// 兼容尚未取得库存的首次打开;屏幕建好后由屏幕接管唯一的常驻挂载引用。
|
|
44
|
+
useEffect(() => visible && !hasTerminal ? view.mount() : undefined, [hasTerminal, view, visible]);
|
|
43
45
|
useEffect(() => {
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
+
const target = hostRef.current;
|
|
47
|
+
if (target === null || !hasTerminal || !visible || view.signal.aborted)
|
|
46
48
|
return;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
terminal.loadAddon(fit);
|
|
56
|
-
terminal.open(container);
|
|
57
|
-
terminal.textarea?.setAttribute('aria-label', t('terminal.title'));
|
|
58
|
-
terminalRef.current = terminal;
|
|
59
|
-
fitRef.current = fit;
|
|
60
|
-
lastRevision.current = 0;
|
|
61
|
-
// xterm 自己拥有自绘 scrollable viewport。滚轮回调只能决定是否交给 xterm 继续处理:
|
|
62
|
-
// 有历史时返回 true,交给 xterm 的滚动容器;没有历史时返回 false,避免被解释为
|
|
63
|
-
// shell 的上下方向键(例如切换历史命令)。
|
|
64
|
-
const wheel = (event) => {
|
|
65
|
-
if (!Number.isFinite(event.deltaY) || event.deltaY === 0)
|
|
66
|
-
return false;
|
|
67
|
-
const hasScrollback = terminal.buffer.active.baseY > 0;
|
|
68
|
-
if (!hasScrollback) {
|
|
69
|
-
// 保持 xterm 在无回滚区时的默认行为(应用鼠标模式仍可接收滚轮)。
|
|
70
|
-
return false;
|
|
71
|
-
}
|
|
72
|
-
return true;
|
|
73
|
-
};
|
|
74
|
-
terminal.attachCustomWheelEventHandler(wheel);
|
|
75
|
-
const input = terminal.onData((data) => {
|
|
76
|
-
// xterm 在重放 Host resident 的历史输出时会再次回答设备识别查询。
|
|
77
|
-
// 这些 ESC[?...c/ESC[>...c 响应不应被重复送入 shell,否则 zsh 会把响应内容回显为
|
|
78
|
-
// “1;2c0;276;0c”这类异常字符。其它键盘输入和光标查询保持原样。
|
|
79
|
-
const inputData = stripTerminalDeviceAttributeResponses(data);
|
|
80
|
-
if (inputData !== '')
|
|
81
|
-
view.write(inputData);
|
|
82
|
-
});
|
|
83
|
-
let touchPoint;
|
|
84
|
-
let pendingTouchLines = 0;
|
|
85
|
-
let touchVelocityLinesPerMs = 0;
|
|
86
|
-
let touchMomentumRemainder = 0;
|
|
87
|
-
let touchMomentumFrame;
|
|
88
|
-
let touchMomentumEligible = false;
|
|
89
|
-
let lastTouchMoveAt = 0;
|
|
90
|
-
const stopTouchMomentum = () => {
|
|
91
|
-
if (touchMomentumFrame !== undefined) {
|
|
92
|
-
window.cancelAnimationFrame(touchMomentumFrame);
|
|
93
|
-
touchMomentumFrame = undefined;
|
|
94
|
-
}
|
|
95
|
-
touchMomentumRemainder = 0;
|
|
96
|
-
};
|
|
97
|
-
const hasTerminalScrollback = () => {
|
|
98
|
-
return terminal.buffer.active.baseY > 0 || terminal.buffer.active.viewportY > 0;
|
|
99
|
-
};
|
|
100
|
-
const scrollTouchLines = (lines) => {
|
|
101
|
-
if (lines === 0 || !hasTerminalScrollback())
|
|
102
|
-
return false;
|
|
103
|
-
const previousViewportY = terminal.buffer.active.viewportY;
|
|
104
|
-
terminal.scrollLines(lines);
|
|
105
|
-
return terminal.buffer.active.viewportY !== previousViewportY;
|
|
106
|
-
};
|
|
107
|
-
const startTouchMomentum = () => {
|
|
108
|
-
stopTouchMomentum();
|
|
109
|
-
if (!touchMomentumEligible ||
|
|
110
|
-
!hasTerminalScrollback() ||
|
|
111
|
-
Math.abs(touchVelocityLinesPerMs) < TERMINAL_TOUCH_MOMENTUM_MIN_LINES_PER_MS) {
|
|
112
|
-
touchVelocityLinesPerMs = 0;
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
let lastFrameAt = performance.now();
|
|
116
|
-
let elapsedTotalMs = 0;
|
|
117
|
-
let idleFrameCount = 0;
|
|
118
|
-
const step = (frameAt) => {
|
|
119
|
-
const elapsedMs = Math.max(1, frameAt - lastFrameAt);
|
|
120
|
-
lastFrameAt = frameAt;
|
|
121
|
-
elapsedTotalMs += elapsedMs;
|
|
122
|
-
touchMomentumRemainder += touchVelocityLinesPerMs * elapsedMs;
|
|
123
|
-
const lines = truncateTowardZero(touchMomentumRemainder);
|
|
124
|
-
if (lines !== 0) {
|
|
125
|
-
idleFrameCount = 0;
|
|
126
|
-
touchMomentumRemainder -= lines;
|
|
127
|
-
if (!scrollTouchLines(lines)) {
|
|
128
|
-
touchVelocityLinesPerMs = 0;
|
|
129
|
-
stopTouchMomentum();
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
idleFrameCount += 1;
|
|
135
|
-
}
|
|
136
|
-
touchVelocityLinesPerMs *= Math.pow(TERMINAL_TOUCH_MOMENTUM_FRICTION, elapsedMs / 16);
|
|
137
|
-
if (idleFrameCount >= TERMINAL_TOUCH_MOMENTUM_MAX_IDLE_FRAMES ||
|
|
138
|
-
elapsedTotalMs >= TERMINAL_TOUCH_MOMENTUM_MAX_DURATION_MS ||
|
|
139
|
-
Math.abs(touchVelocityLinesPerMs) < TERMINAL_TOUCH_MOMENTUM_MIN_LINES_PER_MS) {
|
|
140
|
-
touchVelocityLinesPerMs = 0;
|
|
141
|
-
stopTouchMomentum();
|
|
142
|
-
return;
|
|
143
|
-
}
|
|
144
|
-
touchMomentumFrame = window.requestAnimationFrame(step);
|
|
145
|
-
};
|
|
146
|
-
touchMomentumFrame = window.requestAnimationFrame(step);
|
|
147
|
-
};
|
|
148
|
-
const touchStart = (event) => {
|
|
149
|
-
stopTouchMomentum();
|
|
150
|
-
touchVelocityLinesPerMs = 0;
|
|
151
|
-
touchMomentumEligible = false;
|
|
152
|
-
pendingTouchLines = 0;
|
|
153
|
-
lastTouchMoveAt = performance.now();
|
|
154
|
-
const touch = event.touches[0];
|
|
155
|
-
touchPoint = touch === undefined ? undefined : { x: touch.clientX, y: touch.clientY };
|
|
156
|
-
};
|
|
157
|
-
const touchMove = (event) => {
|
|
158
|
-
if (touchPoint === undefined || event.touches.length !== 1)
|
|
159
|
-
return;
|
|
160
|
-
const touch = event.touches[0];
|
|
161
|
-
if (touch === undefined)
|
|
162
|
-
return;
|
|
163
|
-
const deltaX = touch.clientX - touchPoint.x;
|
|
164
|
-
const deltaY = touch.clientY - touchPoint.y;
|
|
165
|
-
touchPoint = { x: touch.clientX, y: touch.clientY };
|
|
166
|
-
// 斜向手势优先交给外层页面,避免终端抢走横向切换动作。
|
|
167
|
-
if (Math.abs(deltaY) <= Math.abs(deltaX))
|
|
168
|
-
return;
|
|
169
|
-
event.preventDefault();
|
|
170
|
-
const now = performance.now();
|
|
171
|
-
const elapsedMs = Math.max(1, now - lastTouchMoveAt);
|
|
172
|
-
lastTouchMoveAt = now;
|
|
173
|
-
const lineHeight = Math.max(1, host.clientHeight / Math.max(1, terminal.rows));
|
|
174
|
-
const deltaLines = -deltaY / lineHeight;
|
|
175
|
-
pendingTouchLines += deltaLines;
|
|
176
|
-
const lines = truncateTowardZero(pendingTouchLines);
|
|
177
|
-
if (lines === 0) {
|
|
178
|
-
// 位移还不足一整行时也更新速度;手指停住则立即清除旧速度,避免
|
|
179
|
-
// 松手时沿上一次手势方向继续滚动。
|
|
180
|
-
if (Math.abs(deltaY) < 0.5) {
|
|
181
|
-
touchVelocityLinesPerMs = 0;
|
|
182
|
-
touchMomentumEligible = false;
|
|
183
|
-
}
|
|
184
|
-
else {
|
|
185
|
-
touchVelocityLinesPerMs = clampNumber((deltaLines / elapsedMs) * TERMINAL_TOUCH_MOMENTUM_GAIN, -TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS, TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS);
|
|
186
|
-
touchMomentumEligible = hasTerminalScrollback();
|
|
187
|
-
}
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
pendingTouchLines -= lines;
|
|
191
|
-
const didScroll = scrollTouchLines(lines);
|
|
192
|
-
if (didScroll) {
|
|
193
|
-
const nextVelocity = clampNumber((deltaLines / elapsedMs) * TERMINAL_TOUCH_MOMENTUM_GAIN, -TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS, TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS);
|
|
194
|
-
touchVelocityLinesPerMs = touchVelocityLinesPerMs === 0
|
|
195
|
-
? nextVelocity
|
|
196
|
-
: touchVelocityLinesPerMs * 0.35 + nextVelocity * 0.65;
|
|
197
|
-
touchMomentumEligible = true;
|
|
198
|
-
}
|
|
199
|
-
else {
|
|
200
|
-
touchVelocityLinesPerMs = 0;
|
|
201
|
-
touchMomentumEligible = false;
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
const touchEnd = () => {
|
|
205
|
-
touchPoint = undefined;
|
|
206
|
-
pendingTouchLines = 0;
|
|
207
|
-
// 释放前已经静止一段时间,说明用户是在按住后松手,不应复用旧速度。
|
|
208
|
-
if (performance.now() - lastTouchMoveAt >= TERMINAL_TOUCH_MOMENTUM_RELEASE_IDLE_MS) {
|
|
209
|
-
touchVelocityLinesPerMs = 0;
|
|
210
|
-
touchMomentumEligible = false;
|
|
211
|
-
}
|
|
212
|
-
startTouchMomentum();
|
|
213
|
-
};
|
|
214
|
-
const touchCancel = () => {
|
|
215
|
-
touchPoint = undefined;
|
|
216
|
-
pendingTouchLines = 0;
|
|
217
|
-
touchVelocityLinesPerMs = 0;
|
|
218
|
-
touchMomentumEligible = false;
|
|
219
|
-
stopTouchMomentum();
|
|
220
|
-
};
|
|
221
|
-
const xtermRoot = terminal.element;
|
|
222
|
-
if (xtermRoot === undefined)
|
|
223
|
-
return;
|
|
224
|
-
// xterm 6 使用 .xterm-scrollable-element 的自绘滚动条;.xterm-viewport
|
|
225
|
-
// 只是兼容节点,不能再把触摸事件和可用宽度交给它。
|
|
226
|
-
const scrollTarget = xtermRoot?.querySelector('.xterm-scrollable-element') ?? xtermRoot ?? container;
|
|
227
|
-
const interactionTarget = xtermRoot ?? container;
|
|
228
|
-
let scrollbarHideTimer;
|
|
229
|
-
let lastViewportY = terminal.buffer.active.viewportY;
|
|
230
|
-
const hideScrollbar = () => {
|
|
231
|
-
if (scrollbarHideTimer !== undefined) {
|
|
232
|
-
window.clearTimeout(scrollbarHideTimer);
|
|
233
|
-
scrollbarHideTimer = undefined;
|
|
234
|
-
}
|
|
235
|
-
xtermRoot.dataset.codingnsScrollbar = 'hidden';
|
|
236
|
-
};
|
|
237
|
-
const revealScrollbar = () => {
|
|
238
|
-
if (terminal.buffer.active.baseY <= 0) {
|
|
239
|
-
hideScrollbar();
|
|
240
|
-
return;
|
|
241
|
-
}
|
|
242
|
-
xtermRoot.dataset.codingnsScrollbar = 'visible';
|
|
243
|
-
if (scrollbarHideTimer !== undefined)
|
|
244
|
-
window.clearTimeout(scrollbarHideTimer);
|
|
245
|
-
scrollbarHideTimer = window.setTimeout(() => {
|
|
246
|
-
scrollbarHideTimer = undefined;
|
|
247
|
-
xtermRoot.dataset.codingnsScrollbar = 'hidden';
|
|
248
|
-
}, TERMINAL_SCROLLBAR_HIDE_DELAY_MS);
|
|
249
|
-
};
|
|
250
|
-
const syncScrollbarState = () => {
|
|
251
|
-
const hasScrollback = terminal.buffer.active.baseY > 0;
|
|
252
|
-
xtermRoot.dataset.codingnsScrollback = hasScrollback ? 'true' : 'false';
|
|
253
|
-
if (!hasScrollback)
|
|
254
|
-
hideScrollbar();
|
|
255
|
-
else if (xtermRoot.dataset.codingnsScrollbar === undefined)
|
|
256
|
-
xtermRoot.dataset.codingnsScrollbar = 'hidden';
|
|
257
|
-
debugInfo('codingns4dsh: client terminal scrollbar state', {
|
|
258
|
-
terminalId: view.id,
|
|
259
|
-
hasScrollback,
|
|
260
|
-
baseY: terminal.buffer.active.baseY,
|
|
261
|
-
viewportY: terminal.buffer.active.viewportY,
|
|
262
|
-
});
|
|
263
|
-
};
|
|
264
|
-
syncScrollbarState();
|
|
265
|
-
scrollTarget.style.touchAction = 'pan-y';
|
|
266
|
-
scrollTarget.style.overscrollBehavior = 'contain';
|
|
267
|
-
if ('webkitOverflowScrolling' in scrollTarget.style) {
|
|
268
|
-
scrollTarget.style.webkitOverflowScrolling = 'touch';
|
|
269
|
-
}
|
|
270
|
-
interactionTarget.addEventListener('touchstart', touchStart, { passive: true });
|
|
271
|
-
interactionTarget.addEventListener('touchmove', touchMove, { passive: false });
|
|
272
|
-
interactionTarget.addEventListener('touchend', touchEnd, { passive: true });
|
|
273
|
-
interactionTarget.addEventListener('touchcancel', touchCancel, { passive: true });
|
|
274
|
-
const scroll = terminal.onScroll((viewportY) => {
|
|
275
|
-
const didScroll = viewportY !== lastViewportY;
|
|
276
|
-
lastViewportY = viewportY;
|
|
277
|
-
syncScrollbarState();
|
|
278
|
-
if (didScroll)
|
|
279
|
-
revealScrollbar();
|
|
280
|
-
debugInfo('codingns4dsh: client terminal viewport scroll', {
|
|
281
|
-
terminalId: view.id,
|
|
282
|
-
viewportY,
|
|
283
|
-
baseY: terminal.buffer.active.baseY,
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
// 调试终端由 Host 预设“配置名(终端类型)”标题;Shell 启动时通常会发一个 zsh 等默认标题,不能覆盖它。
|
|
287
|
-
const preserveHostTitle = state.info !== undefined && state.info.title !== state.info.shell.name;
|
|
288
|
-
const title = terminal.onTitleChange((value) => {
|
|
289
|
-
if (!preserveHostTitle)
|
|
290
|
-
void view.rename(value);
|
|
291
|
-
});
|
|
292
|
-
const measure = () => {
|
|
293
|
-
// 手机虚拟键盘通常只收缩 visualViewport,不会改变 DSH 外层布局视口。
|
|
294
|
-
// 先把 xterm 宿主裁到可视视口底边,再计算行列,避免最后几行和光标落到键盘下面。
|
|
295
|
-
syncTerminalViewport(host);
|
|
296
|
-
// 显示层即使在 connecting/read-only 阶段也必须跟随容器尺寸;否则
|
|
297
|
-
// ResizeObserver 会捕获首次 render 的 writable=false,后续移动端布局
|
|
298
|
-
// 变化永远不会触发历史行重排。view.resize 内部仍会按权限决定是否下发 PTY。
|
|
299
|
-
if (host.clientWidth === 0 || host.clientHeight === 0)
|
|
300
|
-
return;
|
|
301
|
-
fitTerminal(terminal, fit, view);
|
|
302
|
-
syncScrollbarState();
|
|
303
|
-
};
|
|
304
|
-
let measureFrame;
|
|
305
|
-
const scheduleMeasure = () => {
|
|
306
|
-
if (measureFrame !== undefined)
|
|
307
|
-
return;
|
|
308
|
-
measureFrame = window.requestAnimationFrame(() => {
|
|
309
|
-
measureFrame = undefined;
|
|
310
|
-
measure();
|
|
311
|
-
});
|
|
312
|
-
};
|
|
313
|
-
let reflowTimer;
|
|
314
|
-
let reflowFrame;
|
|
315
|
-
const schedulePostAttachReflow = () => {
|
|
316
|
-
// xterm 的字符尺寸、移动端字体和 Sidebar 宽度可能在首帧之后才稳定。
|
|
317
|
-
// 只在 snapshot 写入回调里 fit 一次会留下旧 scrollback 的宽度,随后每行
|
|
318
|
-
// 看起来都向右漂移。连续安排两帧和一个短延迟,覆盖字体与容器的最终布局。
|
|
319
|
-
scheduleMeasure();
|
|
320
|
-
if (reflowFrame !== undefined)
|
|
321
|
-
window.cancelAnimationFrame(reflowFrame);
|
|
322
|
-
reflowFrame = window.requestAnimationFrame(() => {
|
|
323
|
-
reflowFrame = undefined;
|
|
324
|
-
scheduleMeasure();
|
|
325
|
-
});
|
|
326
|
-
if (reflowTimer !== undefined)
|
|
327
|
-
window.clearTimeout(reflowTimer);
|
|
328
|
-
reflowTimer = window.setTimeout(() => {
|
|
329
|
-
reflowTimer = undefined;
|
|
330
|
-
scheduleMeasure();
|
|
331
|
-
}, 240);
|
|
332
|
-
};
|
|
333
|
-
scheduleReflowRef.current = schedulePostAttachReflow;
|
|
334
|
-
const resize = new ResizeObserver(scheduleMeasure);
|
|
335
|
-
resize.observe(host);
|
|
336
|
-
resize.observe(container);
|
|
337
|
-
const visualViewport = window.visualViewport;
|
|
338
|
-
const handleViewportChange = () => schedulePostAttachReflow();
|
|
339
|
-
visualViewport?.addEventListener('resize', handleViewportChange);
|
|
340
|
-
// iOS 在弹出键盘时可能先滚动 visual viewport,再触发 resize;两个事件都要处理,
|
|
341
|
-
// 否则页面被浏览器上移后,光标仍可能被键盘边缘遮住。
|
|
342
|
-
visualViewport?.addEventListener('scroll', handleViewportChange);
|
|
343
|
-
window.addEventListener('resize', handleViewportChange);
|
|
344
|
-
schedulePostAttachReflow();
|
|
49
|
+
// 仅可见卡片更新调用上下文;后台卡片不能把共享模型切回旧会话。
|
|
50
|
+
view.sessionId = sessionId;
|
|
51
|
+
const surface = surfaces.get(view, () => createTerminalSurface(target, view, appearance, sharing, t));
|
|
52
|
+
surfaceRef.current = surface;
|
|
53
|
+
surface.owner = target;
|
|
54
|
+
surface.onSelection = setSelectionActions;
|
|
55
|
+
target.replaceChildren(surface.host);
|
|
56
|
+
surface.scheduleReflow();
|
|
345
57
|
return () => {
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
window.cancelAnimationFrame(reflowFrame);
|
|
354
|
-
if (reflowTimer !== undefined)
|
|
355
|
-
window.clearTimeout(reflowTimer);
|
|
356
|
-
if (scrollbarHideTimer !== undefined)
|
|
357
|
-
window.clearTimeout(scrollbarHideTimer);
|
|
358
|
-
scheduleReflowRef.current = null;
|
|
359
|
-
input.dispose();
|
|
360
|
-
scroll.dispose();
|
|
361
|
-
interactionTarget.removeEventListener('touchstart', touchStart);
|
|
362
|
-
interactionTarget.removeEventListener('touchmove', touchMove);
|
|
363
|
-
interactionTarget.removeEventListener('touchend', touchEnd);
|
|
364
|
-
interactionTarget.removeEventListener('touchcancel', touchCancel);
|
|
365
|
-
stopTouchMomentum();
|
|
366
|
-
title.dispose();
|
|
367
|
-
terminal.dispose();
|
|
368
|
-
terminalRef.current = null;
|
|
369
|
-
fitRef.current = null;
|
|
370
|
-
host.style.height = '100%';
|
|
371
|
-
root.replaceChildren();
|
|
58
|
+
surfaceRef.current = null;
|
|
59
|
+
// 会话切换可能先挂载新卡片再清理旧卡片,旧卡片不得拆走新卡片的屏幕。
|
|
60
|
+
if (surface.owner !== target)
|
|
61
|
+
return;
|
|
62
|
+
surface.host.remove();
|
|
63
|
+
delete surface.owner;
|
|
64
|
+
delete surface.onSelection;
|
|
372
65
|
};
|
|
373
|
-
}, [hasTerminal, view]);
|
|
66
|
+
}, [hasTerminal, sessionId, sharing, view, visible]);
|
|
67
|
+
useEffect(() => { if (!active || !visible)
|
|
68
|
+
dismissSelection(); }, [active, visible, dismissSelection]);
|
|
374
69
|
useEffect(() => {
|
|
375
|
-
const becameActive = active && !previousActiveRef.current;
|
|
376
|
-
previousActiveRef.current = active;
|
|
377
|
-
const
|
|
378
|
-
|
|
379
|
-
if (terminal === null || host === null)
|
|
70
|
+
const becameActive = active && visible && !previousActiveRef.current;
|
|
71
|
+
previousActiveRef.current = active && visible;
|
|
72
|
+
const surface = surfaceRef.current;
|
|
73
|
+
if (surface === null || !active || !visible)
|
|
380
74
|
return;
|
|
75
|
+
const { terminal, host, fit } = surface;
|
|
381
76
|
applyAppearance(terminal, appearance, host, state.environment?.scrollback ?? 1000);
|
|
382
77
|
terminal.options.disableStdin = !state.writable;
|
|
383
78
|
// 聚合页切换到一个原本隐藏的终端时,虚拟键盘可能已经打开且不会再次派发
|
|
@@ -393,12 +88,9 @@ export function CodingNsXtermView({ view, settings, themeRevision, onNewTerminal
|
|
|
393
88
|
const claim = becameActive && now - sizeClaimAtRef.current >= TERMINAL_SIZE_CLAIM_INTERVAL_MS;
|
|
394
89
|
if (claim)
|
|
395
90
|
sizeClaimAtRef.current = now;
|
|
396
|
-
fitTerminal(terminal,
|
|
91
|
+
fitTerminal(terminal, fit, view, claim ? { force: true } : undefined);
|
|
397
92
|
terminal.focus();
|
|
398
93
|
}
|
|
399
|
-
else if (state.info !== undefined) {
|
|
400
|
-
terminal.resize(state.info.cols, state.info.rows);
|
|
401
|
-
}
|
|
402
94
|
}, [
|
|
403
95
|
active,
|
|
404
96
|
appearance,
|
|
@@ -408,84 +100,424 @@ export function CodingNsXtermView({ view, settings, themeRevision, onNewTerminal
|
|
|
408
100
|
state.writable,
|
|
409
101
|
themeRevision,
|
|
410
102
|
view,
|
|
103
|
+
visible,
|
|
411
104
|
]);
|
|
412
105
|
useEffect(() => {
|
|
413
|
-
if (!active || !hasTerminal)
|
|
106
|
+
if (!active || !visible || !hasTerminal)
|
|
414
107
|
return;
|
|
415
108
|
// 页面从后台回到前台(移动端切回、窗口重新聚焦)时,Host 尺寸可能已被其它
|
|
416
109
|
// 客户端改写;回到前台的视图重发一次自己的 fit 尺寸,把 tmux 抢回本视图。
|
|
417
110
|
const onVisibilityChange = () => {
|
|
418
111
|
if (document.visibilityState !== 'visible')
|
|
419
112
|
return;
|
|
420
|
-
const
|
|
421
|
-
|
|
422
|
-
if (terminal === null || host === null)
|
|
113
|
+
const surface = surfaceRef.current;
|
|
114
|
+
if (surface === null)
|
|
423
115
|
return;
|
|
116
|
+
const { terminal, host, fit } = surface;
|
|
424
117
|
if (host.clientWidth === 0 || host.clientHeight === 0)
|
|
425
118
|
return;
|
|
426
119
|
const now = Date.now();
|
|
427
120
|
if (now - sizeClaimAtRef.current < TERMINAL_SIZE_CLAIM_INTERVAL_MS)
|
|
428
121
|
return;
|
|
429
122
|
sizeClaimAtRef.current = now;
|
|
430
|
-
fitTerminal(terminal,
|
|
123
|
+
fitTerminal(terminal, fit, view, { force: true });
|
|
431
124
|
};
|
|
432
125
|
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
433
126
|
return () => document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
434
|
-
}, [active, hasTerminal, view]);
|
|
435
|
-
useEffect(() => {
|
|
436
|
-
const terminal = terminalRef.current;
|
|
437
|
-
const host = hostRef.current;
|
|
438
|
-
const render = state.render;
|
|
439
|
-
if (terminal === null || render === undefined || render.revision <= lastRevision.current)
|
|
440
|
-
return;
|
|
441
|
-
lastRevision.current = render.revision;
|
|
442
|
-
const isSnapshot = render.frame.type === 'snapshot';
|
|
443
|
-
if (isSnapshot) {
|
|
444
|
-
terminal.reset();
|
|
445
|
-
terminal.resize(render.frame.info.cols, render.frame.info.rows);
|
|
446
|
-
}
|
|
447
|
-
const data = render.frame.type === 'snapshot'
|
|
448
|
-
? normalizeTerminalSnapshot(render.frame.screen)
|
|
449
|
-
: render.frame.data;
|
|
450
|
-
terminal.write(data, () => {
|
|
451
|
-
// 快照中的尺寸来自 Host 上次记录,可能仍是桌面端列数。等完整历史写入
|
|
452
|
-
// 后再按当前 DOM 宽度 fit 一次,xterm 才会对整个 scrollback 执行重排;
|
|
453
|
-
// 否则只有后续新增的当前行会按移动端宽度换行。
|
|
454
|
-
if (isSnapshot && host !== null && host.clientWidth > 0 && host.clientHeight > 0) {
|
|
455
|
-
fitTerminal(terminal, fitRef.current, view);
|
|
456
|
-
scheduleReflowRef.current?.();
|
|
457
|
-
}
|
|
458
|
-
if (terminal.element !== undefined) {
|
|
459
|
-
const hasScrollback = terminal.buffer.active.baseY > 0;
|
|
460
|
-
terminal.element.dataset.codingnsScrollback = hasScrollback ? 'true' : 'false';
|
|
461
|
-
if (!hasScrollback)
|
|
462
|
-
terminal.element.dataset.codingnsScrollbar = 'hidden';
|
|
463
|
-
}
|
|
464
|
-
const viewport = terminal.element?.querySelector('.xterm-scrollable-element');
|
|
465
|
-
debugInfo('codingns4dsh: client terminal frame rendered', {
|
|
466
|
-
terminalId: view.id,
|
|
467
|
-
frameType: render.frame.type,
|
|
468
|
-
characters: data.length,
|
|
469
|
-
rows: terminal.rows,
|
|
470
|
-
bufferLength: terminal.buffer.active.length,
|
|
471
|
-
baseY: terminal.buffer.active.baseY,
|
|
472
|
-
viewportY: terminal.buffer.active.viewportY,
|
|
473
|
-
viewportScrollHeight: viewport?.scrollHeight ?? null,
|
|
474
|
-
viewportClientHeight: viewport?.clientHeight ?? null,
|
|
475
|
-
});
|
|
476
|
-
view.acknowledge(render.revision);
|
|
477
|
-
});
|
|
478
|
-
}, [state.render, view]);
|
|
127
|
+
}, [active, hasTerminal, view, visible]);
|
|
479
128
|
return createElement('section', {
|
|
480
129
|
className: terminalClass.root,
|
|
481
130
|
'data-sidebar-terminal': true,
|
|
482
131
|
'data-terminal-active': active ? 'true' : 'false',
|
|
483
132
|
'aria-hidden': active ? undefined : true,
|
|
484
133
|
style: active ? undefined : { display: 'none' },
|
|
485
|
-
}, createElement(TerminalStatus, { state, view, onNewTerminal, t }), hasTerminal ? createElement('div', { className: terminalClass.screen }, createElement('div', { ref: hostRef, style:
|
|
134
|
+
}, createElement(TerminalStatus, { state, view, onNewTerminal, t }), active && visible && sharing !== undefined ? createElement(TerminalSelectionActions, { selection: selectionActions, view, sessionId, sharing, t, onDismiss: dismissSelection }) : null, hasTerminal ? createElement('div', { className: terminalClass.screen }, createElement('div', { ref: hostRef, style: { width: '100%', height: '100%' } })) : null, state.error === undefined || state.phase === 'disconnected' || state.info?.state === 'lost'
|
|
486
135
|
? null
|
|
487
136
|
: createElement('p', { className: terminalClass.error, role: 'alert' }, t('terminalView.errorDetail', { message: state.error })));
|
|
488
137
|
}
|
|
138
|
+
/** 创建一次常驻屏幕;事件、输出消费和连接只在终端模型销毁时释放。 */
|
|
139
|
+
function createTerminalSurface(target, view, appearance, sharing, t) {
|
|
140
|
+
const state = view.state.getSnapshot();
|
|
141
|
+
const host = document.createElement('div');
|
|
142
|
+
// DOM 样式赋值不会像 React 一样自动给数字补 px。
|
|
143
|
+
Object.assign(host.style, terminalHostStyle, {
|
|
144
|
+
paddingLeft: `${terminalHostStyle.paddingLeft}px`,
|
|
145
|
+
paddingRight: `${terminalHostStyle.paddingRight}px`,
|
|
146
|
+
});
|
|
147
|
+
target.replaceChildren(host);
|
|
148
|
+
const root = host.shadowRoot ?? host.attachShadow({ mode: 'open' });
|
|
149
|
+
const style = document.createElement('style');
|
|
150
|
+
style.textContent = shadowCss;
|
|
151
|
+
const container = document.createElement('div');
|
|
152
|
+
container.className = 'codingns-xterm';
|
|
153
|
+
root.replaceChildren(style, container);
|
|
154
|
+
const terminal = new Terminal(terminalOptions(appearance, host, state.environment?.scrollback ?? 1000, !state.writable));
|
|
155
|
+
const fit = new FitAddon();
|
|
156
|
+
terminal.loadAddon(fit);
|
|
157
|
+
terminal.open(container);
|
|
158
|
+
terminal.textarea?.setAttribute('aria-label', t('terminal.title'));
|
|
159
|
+
const releaseSharing = sharing?.bind(view, terminal);
|
|
160
|
+
const releaseSelection = installTerminalSelectionActions(terminal, container, (selection) => retained.onSelection?.(selection));
|
|
161
|
+
// xterm 自己拥有自绘 scrollable viewport。滚轮回调只能决定是否交给 xterm 继续处理:
|
|
162
|
+
// 有历史时返回 true,交给 xterm 的滚动容器;没有历史时返回 false,避免被解释为
|
|
163
|
+
// shell 的上下方向键(例如切换历史命令)。
|
|
164
|
+
const wheel = (event) => {
|
|
165
|
+
if (!Number.isFinite(event.deltaY) || event.deltaY === 0)
|
|
166
|
+
return false;
|
|
167
|
+
const hasScrollback = terminal.buffer.active.baseY > 0;
|
|
168
|
+
if (!hasScrollback) {
|
|
169
|
+
// 保持 xterm 在无回滚区时的默认行为(应用鼠标模式仍可接收滚轮)。
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
return true;
|
|
173
|
+
};
|
|
174
|
+
terminal.attachCustomWheelEventHandler(wheel);
|
|
175
|
+
const input = terminal.onData((data) => {
|
|
176
|
+
// xterm 在重放 Host resident 的历史输出时会再次回答设备识别查询。
|
|
177
|
+
// 这些 ESC[?...c/ESC[>...c 响应不应被重复送入 shell,否则 zsh 会把响应内容回显为
|
|
178
|
+
// “1;2c0;276;0c”这类异常字符。其它键盘输入和光标查询保持原样。
|
|
179
|
+
const inputData = stripTerminalDeviceAttributeResponses(data);
|
|
180
|
+
if (inputData !== '')
|
|
181
|
+
view.write(inputData);
|
|
182
|
+
});
|
|
183
|
+
let touchPoint;
|
|
184
|
+
let pendingTouchLines = 0;
|
|
185
|
+
let touchVelocityLinesPerMs = 0;
|
|
186
|
+
let touchMomentumRemainder = 0;
|
|
187
|
+
let touchMomentumFrame;
|
|
188
|
+
let touchMomentumEligible = false;
|
|
189
|
+
let lastTouchMoveAt = 0;
|
|
190
|
+
const stopTouchMomentum = () => {
|
|
191
|
+
if (touchMomentumFrame !== undefined) {
|
|
192
|
+
window.cancelAnimationFrame(touchMomentumFrame);
|
|
193
|
+
touchMomentumFrame = undefined;
|
|
194
|
+
}
|
|
195
|
+
touchMomentumRemainder = 0;
|
|
196
|
+
};
|
|
197
|
+
const hasTerminalScrollback = () => {
|
|
198
|
+
return terminal.buffer.active.baseY > 0 || terminal.buffer.active.viewportY > 0;
|
|
199
|
+
};
|
|
200
|
+
const scrollTouchLines = (lines) => {
|
|
201
|
+
if (lines === 0 || !hasTerminalScrollback())
|
|
202
|
+
return false;
|
|
203
|
+
const previousViewportY = terminal.buffer.active.viewportY;
|
|
204
|
+
terminal.scrollLines(lines);
|
|
205
|
+
return terminal.buffer.active.viewportY !== previousViewportY;
|
|
206
|
+
};
|
|
207
|
+
const startTouchMomentum = () => {
|
|
208
|
+
stopTouchMomentum();
|
|
209
|
+
if (!touchMomentumEligible ||
|
|
210
|
+
!hasTerminalScrollback() ||
|
|
211
|
+
Math.abs(touchVelocityLinesPerMs) < TERMINAL_TOUCH_MOMENTUM_MIN_LINES_PER_MS) {
|
|
212
|
+
touchVelocityLinesPerMs = 0;
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
let lastFrameAt = performance.now();
|
|
216
|
+
let elapsedTotalMs = 0;
|
|
217
|
+
let idleFrameCount = 0;
|
|
218
|
+
const step = (frameAt) => {
|
|
219
|
+
const elapsedMs = Math.max(1, frameAt - lastFrameAt);
|
|
220
|
+
lastFrameAt = frameAt;
|
|
221
|
+
elapsedTotalMs += elapsedMs;
|
|
222
|
+
touchMomentumRemainder += touchVelocityLinesPerMs * elapsedMs;
|
|
223
|
+
const lines = truncateTowardZero(touchMomentumRemainder);
|
|
224
|
+
if (lines !== 0) {
|
|
225
|
+
idleFrameCount = 0;
|
|
226
|
+
touchMomentumRemainder -= lines;
|
|
227
|
+
if (!scrollTouchLines(lines)) {
|
|
228
|
+
touchVelocityLinesPerMs = 0;
|
|
229
|
+
stopTouchMomentum();
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
idleFrameCount += 1;
|
|
235
|
+
}
|
|
236
|
+
touchVelocityLinesPerMs *= Math.pow(TERMINAL_TOUCH_MOMENTUM_FRICTION, elapsedMs / 16);
|
|
237
|
+
if (idleFrameCount >= TERMINAL_TOUCH_MOMENTUM_MAX_IDLE_FRAMES ||
|
|
238
|
+
elapsedTotalMs >= TERMINAL_TOUCH_MOMENTUM_MAX_DURATION_MS ||
|
|
239
|
+
Math.abs(touchVelocityLinesPerMs) < TERMINAL_TOUCH_MOMENTUM_MIN_LINES_PER_MS) {
|
|
240
|
+
touchVelocityLinesPerMs = 0;
|
|
241
|
+
stopTouchMomentum();
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
touchMomentumFrame = window.requestAnimationFrame(step);
|
|
245
|
+
};
|
|
246
|
+
touchMomentumFrame = window.requestAnimationFrame(step);
|
|
247
|
+
};
|
|
248
|
+
const touchStart = (event) => {
|
|
249
|
+
stopTouchMomentum();
|
|
250
|
+
touchVelocityLinesPerMs = 0;
|
|
251
|
+
touchMomentumEligible = false;
|
|
252
|
+
pendingTouchLines = 0;
|
|
253
|
+
lastTouchMoveAt = performance.now();
|
|
254
|
+
const touch = event.touches[0];
|
|
255
|
+
touchPoint = touch === undefined ? undefined : { x: touch.clientX, y: touch.clientY };
|
|
256
|
+
};
|
|
257
|
+
const touchMove = (event) => {
|
|
258
|
+
if (touchPoint === undefined || event.touches.length !== 1)
|
|
259
|
+
return;
|
|
260
|
+
const touch = event.touches[0];
|
|
261
|
+
if (touch === undefined)
|
|
262
|
+
return;
|
|
263
|
+
const deltaX = touch.clientX - touchPoint.x;
|
|
264
|
+
const deltaY = touch.clientY - touchPoint.y;
|
|
265
|
+
touchPoint = { x: touch.clientX, y: touch.clientY };
|
|
266
|
+
// 斜向手势优先交给外层页面,避免终端抢走横向切换动作。
|
|
267
|
+
if (Math.abs(deltaY) <= Math.abs(deltaX))
|
|
268
|
+
return;
|
|
269
|
+
event.preventDefault();
|
|
270
|
+
const now = performance.now();
|
|
271
|
+
const elapsedMs = Math.max(1, now - lastTouchMoveAt);
|
|
272
|
+
lastTouchMoveAt = now;
|
|
273
|
+
const lineHeight = Math.max(1, host.clientHeight / Math.max(1, terminal.rows));
|
|
274
|
+
const deltaLines = -deltaY / lineHeight;
|
|
275
|
+
pendingTouchLines += deltaLines;
|
|
276
|
+
const lines = truncateTowardZero(pendingTouchLines);
|
|
277
|
+
if (lines === 0) {
|
|
278
|
+
// 位移还不足一整行时也更新速度;手指停住则立即清除旧速度,避免
|
|
279
|
+
// 松手时沿上一次手势方向继续滚动。
|
|
280
|
+
if (Math.abs(deltaY) < 0.5) {
|
|
281
|
+
touchVelocityLinesPerMs = 0;
|
|
282
|
+
touchMomentumEligible = false;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
touchVelocityLinesPerMs = clampNumber((deltaLines / elapsedMs) * TERMINAL_TOUCH_MOMENTUM_GAIN, -TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS, TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS);
|
|
286
|
+
touchMomentumEligible = hasTerminalScrollback();
|
|
287
|
+
}
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
pendingTouchLines -= lines;
|
|
291
|
+
const didScroll = scrollTouchLines(lines);
|
|
292
|
+
if (didScroll) {
|
|
293
|
+
const nextVelocity = clampNumber((deltaLines / elapsedMs) * TERMINAL_TOUCH_MOMENTUM_GAIN, -TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS, TERMINAL_TOUCH_MOMENTUM_MAX_LINES_PER_MS);
|
|
294
|
+
touchVelocityLinesPerMs = touchVelocityLinesPerMs === 0
|
|
295
|
+
? nextVelocity
|
|
296
|
+
: touchVelocityLinesPerMs * 0.35 + nextVelocity * 0.65;
|
|
297
|
+
touchMomentumEligible = true;
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
touchVelocityLinesPerMs = 0;
|
|
301
|
+
touchMomentumEligible = false;
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const touchEnd = () => {
|
|
305
|
+
touchPoint = undefined;
|
|
306
|
+
pendingTouchLines = 0;
|
|
307
|
+
// 释放前已经静止一段时间,说明用户是在按住后松手,不应复用旧速度。
|
|
308
|
+
if (performance.now() - lastTouchMoveAt >= TERMINAL_TOUCH_MOMENTUM_RELEASE_IDLE_MS) {
|
|
309
|
+
touchVelocityLinesPerMs = 0;
|
|
310
|
+
touchMomentumEligible = false;
|
|
311
|
+
}
|
|
312
|
+
startTouchMomentum();
|
|
313
|
+
};
|
|
314
|
+
const touchCancel = () => {
|
|
315
|
+
touchPoint = undefined;
|
|
316
|
+
pendingTouchLines = 0;
|
|
317
|
+
touchVelocityLinesPerMs = 0;
|
|
318
|
+
touchMomentumEligible = false;
|
|
319
|
+
stopTouchMomentum();
|
|
320
|
+
};
|
|
321
|
+
const xtermRoot = terminal.element;
|
|
322
|
+
// xterm 6 使用 .xterm-scrollable-element 的自绘滚动条;.xterm-viewport
|
|
323
|
+
// 只是兼容节点,不能再把触摸事件和可用宽度交给它。
|
|
324
|
+
const scrollTarget = xtermRoot?.querySelector('.xterm-scrollable-element') ?? xtermRoot ?? container;
|
|
325
|
+
const interactionTarget = xtermRoot ?? container;
|
|
326
|
+
let scrollbarHideTimer;
|
|
327
|
+
let lastViewportY = terminal.buffer.active.viewportY;
|
|
328
|
+
const hideScrollbar = () => {
|
|
329
|
+
if (scrollbarHideTimer !== undefined) {
|
|
330
|
+
window.clearTimeout(scrollbarHideTimer);
|
|
331
|
+
scrollbarHideTimer = undefined;
|
|
332
|
+
}
|
|
333
|
+
xtermRoot.dataset.codingnsScrollbar = 'hidden';
|
|
334
|
+
};
|
|
335
|
+
const revealScrollbar = () => {
|
|
336
|
+
if (terminal.buffer.active.baseY <= 0) {
|
|
337
|
+
hideScrollbar();
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
xtermRoot.dataset.codingnsScrollbar = 'visible';
|
|
341
|
+
if (scrollbarHideTimer !== undefined)
|
|
342
|
+
window.clearTimeout(scrollbarHideTimer);
|
|
343
|
+
scrollbarHideTimer = window.setTimeout(() => {
|
|
344
|
+
scrollbarHideTimer = undefined;
|
|
345
|
+
xtermRoot.dataset.codingnsScrollbar = 'hidden';
|
|
346
|
+
}, TERMINAL_SCROLLBAR_HIDE_DELAY_MS);
|
|
347
|
+
};
|
|
348
|
+
const syncScrollbarState = () => {
|
|
349
|
+
const hasScrollback = terminal.buffer.active.baseY > 0;
|
|
350
|
+
xtermRoot.dataset.codingnsScrollback = hasScrollback ? 'true' : 'false';
|
|
351
|
+
if (!hasScrollback)
|
|
352
|
+
hideScrollbar();
|
|
353
|
+
else if (xtermRoot.dataset.codingnsScrollbar === undefined)
|
|
354
|
+
xtermRoot.dataset.codingnsScrollbar = 'hidden';
|
|
355
|
+
debugInfo('codingns4dsh: client terminal scrollbar state', {
|
|
356
|
+
terminalId: view.id,
|
|
357
|
+
hasScrollback,
|
|
358
|
+
baseY: terminal.buffer.active.baseY,
|
|
359
|
+
viewportY: terminal.buffer.active.viewportY,
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
syncScrollbarState();
|
|
363
|
+
scrollTarget.style.touchAction = 'pan-y';
|
|
364
|
+
scrollTarget.style.overscrollBehavior = 'contain';
|
|
365
|
+
if ('webkitOverflowScrolling' in scrollTarget.style) {
|
|
366
|
+
scrollTarget.style.webkitOverflowScrolling = 'touch';
|
|
367
|
+
}
|
|
368
|
+
interactionTarget.addEventListener('touchstart', touchStart, { passive: true });
|
|
369
|
+
interactionTarget.addEventListener('touchmove', touchMove, { passive: false });
|
|
370
|
+
interactionTarget.addEventListener('touchend', touchEnd, { passive: true });
|
|
371
|
+
interactionTarget.addEventListener('touchcancel', touchCancel, { passive: true });
|
|
372
|
+
const scroll = terminal.onScroll((viewportY) => {
|
|
373
|
+
const didScroll = viewportY !== lastViewportY;
|
|
374
|
+
lastViewportY = viewportY;
|
|
375
|
+
syncScrollbarState();
|
|
376
|
+
if (didScroll)
|
|
377
|
+
revealScrollbar();
|
|
378
|
+
debugInfo('codingns4dsh: client terminal viewport scroll', {
|
|
379
|
+
terminalId: view.id,
|
|
380
|
+
viewportY,
|
|
381
|
+
baseY: terminal.buffer.active.baseY,
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
// 调试终端由 Host 预设“配置名(终端类型)”标题;Shell 启动时通常会发一个 zsh 等默认标题,不能覆盖它。
|
|
385
|
+
const preserveHostTitle = state.info !== undefined && state.info.title !== state.info.shell.name;
|
|
386
|
+
const title = terminal.onTitleChange((value) => {
|
|
387
|
+
if (!preserveHostTitle)
|
|
388
|
+
void view.rename(value);
|
|
389
|
+
});
|
|
390
|
+
const measure = () => {
|
|
391
|
+
// 手机虚拟键盘通常只收缩 visualViewport,不会改变 DSH 外层布局视口。
|
|
392
|
+
// 先把 xterm 宿主裁到可视视口底边,再计算行列,避免最后几行和光标落到键盘下面。
|
|
393
|
+
syncTerminalViewport(host);
|
|
394
|
+
// 显示层即使在 connecting/read-only 阶段也必须跟随容器尺寸;否则
|
|
395
|
+
// ResizeObserver 会捕获首次 render 的 writable=false,后续移动端布局
|
|
396
|
+
// 变化永远不会触发历史行重排。view.resize 内部仍会按权限决定是否下发 PTY。
|
|
397
|
+
if (host.clientWidth === 0 || host.clientHeight === 0)
|
|
398
|
+
return;
|
|
399
|
+
fitTerminal(terminal, fit, view);
|
|
400
|
+
syncScrollbarState();
|
|
401
|
+
};
|
|
402
|
+
let measureFrame;
|
|
403
|
+
const scheduleMeasure = () => {
|
|
404
|
+
if (measureFrame !== undefined)
|
|
405
|
+
return;
|
|
406
|
+
measureFrame = window.requestAnimationFrame(() => {
|
|
407
|
+
measureFrame = undefined;
|
|
408
|
+
measure();
|
|
409
|
+
});
|
|
410
|
+
};
|
|
411
|
+
let reflowTimer;
|
|
412
|
+
let reflowFrame;
|
|
413
|
+
const schedulePostAttachReflow = () => {
|
|
414
|
+
// xterm 的字符尺寸、移动端字体和 Sidebar 宽度可能在首帧之后才稳定。
|
|
415
|
+
// 只在 snapshot 写入回调里 fit 一次会留下旧 scrollback 的宽度,随后每行
|
|
416
|
+
// 看起来都向右漂移。连续安排两帧和一个短延迟,覆盖字体与容器的最终布局。
|
|
417
|
+
scheduleMeasure();
|
|
418
|
+
if (reflowFrame !== undefined)
|
|
419
|
+
window.cancelAnimationFrame(reflowFrame);
|
|
420
|
+
reflowFrame = window.requestAnimationFrame(() => {
|
|
421
|
+
reflowFrame = undefined;
|
|
422
|
+
scheduleMeasure();
|
|
423
|
+
});
|
|
424
|
+
if (reflowTimer !== undefined)
|
|
425
|
+
window.clearTimeout(reflowTimer);
|
|
426
|
+
reflowTimer = window.setTimeout(() => {
|
|
427
|
+
reflowTimer = undefined;
|
|
428
|
+
scheduleMeasure();
|
|
429
|
+
}, 240);
|
|
430
|
+
};
|
|
431
|
+
const resize = new ResizeObserver(scheduleMeasure);
|
|
432
|
+
resize.observe(host);
|
|
433
|
+
resize.observe(container);
|
|
434
|
+
const visualViewport = window.visualViewport;
|
|
435
|
+
const handleViewportChange = () => schedulePostAttachReflow();
|
|
436
|
+
visualViewport?.addEventListener('resize', handleViewportChange);
|
|
437
|
+
// iOS 在弹出键盘时可能先滚动 visual viewport,再触发 resize;两个事件都要处理,
|
|
438
|
+
// 否则页面被浏览器上移后,光标仍可能被键盘边缘遮住。
|
|
439
|
+
visualViewport?.addEventListener('scroll', handleViewportChange);
|
|
440
|
+
window.addEventListener('resize', handleViewportChange);
|
|
441
|
+
schedulePostAttachReflow();
|
|
442
|
+
const retained = { host, terminal, fit, scheduleReflow: schedulePostAttachReflow, lastRevision: 0, dispose: () => {
|
|
443
|
+
releaseState();
|
|
444
|
+
releaseMount();
|
|
445
|
+
releaseSharing?.();
|
|
446
|
+
releaseSelection();
|
|
447
|
+
resize.disconnect();
|
|
448
|
+
visualViewport?.removeEventListener('resize', handleViewportChange);
|
|
449
|
+
visualViewport?.removeEventListener('scroll', handleViewportChange);
|
|
450
|
+
window.removeEventListener('resize', handleViewportChange);
|
|
451
|
+
if (measureFrame !== undefined)
|
|
452
|
+
window.cancelAnimationFrame(measureFrame);
|
|
453
|
+
if (reflowFrame !== undefined)
|
|
454
|
+
window.cancelAnimationFrame(reflowFrame);
|
|
455
|
+
if (reflowTimer !== undefined)
|
|
456
|
+
window.clearTimeout(reflowTimer);
|
|
457
|
+
if (scrollbarHideTimer !== undefined)
|
|
458
|
+
window.clearTimeout(scrollbarHideTimer);
|
|
459
|
+
input.dispose();
|
|
460
|
+
scroll.dispose();
|
|
461
|
+
interactionTarget.removeEventListener('touchstart', touchStart);
|
|
462
|
+
interactionTarget.removeEventListener('touchmove', touchMove);
|
|
463
|
+
interactionTarget.removeEventListener('touchend', touchEnd);
|
|
464
|
+
interactionTarget.removeEventListener('touchcancel', touchCancel);
|
|
465
|
+
stopTouchMomentum();
|
|
466
|
+
title.dispose();
|
|
467
|
+
terminal.dispose();
|
|
468
|
+
host.remove();
|
|
469
|
+
root.replaceChildren();
|
|
470
|
+
} };
|
|
471
|
+
// 输出消费跟随屏幕生命周期,隐藏或跨会话移动时继续写入同一缓冲区。
|
|
472
|
+
const releaseState = view.state.subscribe(() => renderTerminalSurface(retained, view));
|
|
473
|
+
const releaseMount = view.mount();
|
|
474
|
+
renderTerminalSurface(retained, view);
|
|
475
|
+
return retained;
|
|
476
|
+
}
|
|
477
|
+
/** 每帧只写入工作区共享屏幕一次,不依赖任何会话卡片的 React 渲染或可见性。 */
|
|
478
|
+
function renderTerminalSurface(surface, view) {
|
|
479
|
+
const { terminal, host, fit } = surface;
|
|
480
|
+
const state = view.state.getSnapshot();
|
|
481
|
+
terminal.options.disableStdin = !state.writable;
|
|
482
|
+
const render = state.render;
|
|
483
|
+
if (render === undefined || render.revision <= surface.lastRevision)
|
|
484
|
+
return;
|
|
485
|
+
surface.lastRevision = render.revision;
|
|
486
|
+
const isSnapshot = render.frame.type === 'snapshot';
|
|
487
|
+
if (isSnapshot) {
|
|
488
|
+
terminal.reset();
|
|
489
|
+
terminal.resize(render.frame.info.cols, render.frame.info.rows);
|
|
490
|
+
}
|
|
491
|
+
const data = render.frame.type === 'snapshot'
|
|
492
|
+
? normalizeTerminalSnapshot(render.frame.screen)
|
|
493
|
+
: render.frame.data;
|
|
494
|
+
terminal.write(data, () => {
|
|
495
|
+
// 首次快照和真实尺寸变化仍需重排历史;移动已存在的屏幕不产生新快照。
|
|
496
|
+
if (isSnapshot && host.clientWidth > 0 && host.clientHeight > 0) {
|
|
497
|
+
fitTerminal(terminal, fit, view);
|
|
498
|
+
surface.scheduleReflow();
|
|
499
|
+
}
|
|
500
|
+
if (terminal.element !== undefined) {
|
|
501
|
+
const hasScrollback = terminal.buffer.active.baseY > 0;
|
|
502
|
+
terminal.element.dataset.codingnsScrollback = hasScrollback ? 'true' : 'false';
|
|
503
|
+
if (!hasScrollback)
|
|
504
|
+
terminal.element.dataset.codingnsScrollbar = 'hidden';
|
|
505
|
+
}
|
|
506
|
+
const viewport = terminal.element?.querySelector('.xterm-scrollable-element');
|
|
507
|
+
debugInfo('codingns4dsh: client terminal frame rendered', {
|
|
508
|
+
terminalId: view.id,
|
|
509
|
+
frameType: render.frame.type,
|
|
510
|
+
characters: data.length,
|
|
511
|
+
rows: terminal.rows,
|
|
512
|
+
bufferLength: terminal.buffer.active.length,
|
|
513
|
+
baseY: terminal.buffer.active.baseY,
|
|
514
|
+
viewportY: terminal.buffer.active.viewportY,
|
|
515
|
+
viewportScrollHeight: viewport?.scrollHeight ?? null,
|
|
516
|
+
viewportClientHeight: viewport?.clientHeight ?? null,
|
|
517
|
+
});
|
|
518
|
+
view.acknowledge(render.revision);
|
|
519
|
+
});
|
|
520
|
+
}
|
|
489
521
|
function TerminalStatus({ state, view, onNewTerminal, t, }) {
|
|
490
522
|
const status = statusText(state, t);
|
|
491
523
|
const ended = state.info?.state === 'exited' || state.phase === 'closed';
|