@jingyi0605/codingns4dsh 0.2.1-beta.3 → 0.2.1-beta.5
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 +30 -6
- package/README.md +121 -10
- 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/account-bar.d.ts +1 -1
- package/data/build/dist/client/account-bar.d.ts.map +1 -1
- package/data/build/dist/client/account-bar.js +22 -14
- package/data/build/dist/client/account-bar.js.map +1 -1
- package/data/build/dist/client/adapter-catalog-watch.d.ts +8 -0
- package/data/build/dist/client/adapter-catalog-watch.d.ts.map +1 -0
- package/data/build/dist/client/adapter-catalog-watch.js +79 -0
- package/data/build/dist/client/adapter-catalog-watch.js.map +1 -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 +67 -0
- package/data/build/dist/client/avatar/live2d.d.ts.map +1 -0
- package/data/build/dist/client/avatar/live2d.js +288 -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 +323 -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 +25603 -3080
- package/data/build/dist/client/bundle.js.map +1 -1
- package/data/build/dist/client/cli-catalog.d.ts +3 -0
- package/data/build/dist/client/cli-catalog.d.ts.map +1 -1
- package/data/build/dist/client/cli-catalog.js +7 -0
- package/data/build/dist/client/cli-catalog.js.map +1 -1
- package/data/build/dist/client/cli-slots.d.ts.map +1 -1
- package/data/build/dist/client/cli-slots.js +14 -52
- package/data/build/dist/client/cli-slots.js.map +1 -1
- package/data/build/dist/client/debug/ui.d.ts.map +1 -1
- package/data/build/dist/client/debug/ui.js +14 -5
- package/data/build/dist/client/debug/ui.js.map +1 -1
- package/data/build/dist/client/desktop-assistant.js +8599 -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/cli-adapters.d.ts.map +1 -1
- package/data/build/dist/client/features/cli-adapters.js +48 -13
- package/data/build/dist/client/features/cli-adapters.js.map +1 -1
- package/data/build/dist/client/features/global-voice-assistant.d.ts.map +1 -1
- package/data/build/dist/client/features/global-voice-assistant.js +100 -39
- 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 +4 -1
- package/data/build/dist/client/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/client/features/peer-host.js +176 -106
- 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/features/workspace-session-enhancement.d.ts.map +1 -1
- package/data/build/dist/client/features/workspace-session-enhancement.js +37 -10
- package/data/build/dist/client/features/workspace-session-enhancement.js.map +1 -1
- package/data/build/dist/client/git-management.d.ts +1 -1
- package/data/build/dist/client/git-management.d.ts.map +1 -1
- package/data/build/dist/client/git-management.js +46 -27
- package/data/build/dist/client/git-management.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 +61 -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/peerHost.d.ts.map +1 -1
- package/data/build/dist/client/locales/peerHost.js +4 -0
- package/data/build/dist/client/locales/peerHost.js.map +1 -1
- package/data/build/dist/client/locales/peerHostWorkspace.js +2 -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/usage.d.ts.map +1 -1
- package/data/build/dist/client/locales/usage.js +4 -0
- package/data/build/dist/client/locales/usage.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 +66 -34
- 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/rpc-call.d.ts +4 -0
- package/data/build/dist/client/rpc-call.d.ts.map +1 -0
- package/data/build/dist/client/rpc-call.js +23 -0
- package/data/build/dist/client/rpc-call.js.map +1 -0
- package/data/build/dist/client/serial-polling.d.ts +13 -0
- package/data/build/dist/client/serial-polling.d.ts.map +1 -0
- package/data/build/dist/client/serial-polling.js +41 -0
- package/data/build/dist/client/serial-polling.js.map +1 -0
- package/data/build/dist/client/session-adapter-cache.d.ts.map +1 -1
- package/data/build/dist/client/session-adapter-cache.js +11 -1
- package/data/build/dist/client/session-adapter-cache.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 +386 -93
- package/data/build/dist/client/sherpa-voice-adapter.js.map +1 -1
- package/data/build/dist/client/streaming-sentence-queue.d.ts +20 -0
- package/data/build/dist/client/streaming-sentence-queue.d.ts.map +1 -0
- package/data/build/dist/client/streaming-sentence-queue.js +130 -0
- package/data/build/dist/client/streaming-sentence-queue.js.map +1 -0
- package/data/build/dist/client/subscription-slot.d.ts +11 -0
- package/data/build/dist/client/subscription-slot.d.ts.map +1 -1
- package/data/build/dist/client/subscription-slot.js +42 -15
- package/data/build/dist/client/subscription-slot.js.map +1 -1
- package/data/build/dist/client/terminal/log-preview.d.ts +14 -0
- package/data/build/dist/client/terminal/log-preview.d.ts.map +1 -0
- package/data/build/dist/client/terminal/log-preview.js +23 -0
- package/data/build/dist/client/terminal/log-preview.js.map +1 -0
- package/data/build/dist/client/terminal/model.d.ts +38 -7
- package/data/build/dist/client/terminal/model.d.ts.map +1 -1
- package/data/build/dist/client/terminal/model.js +188 -32
- package/data/build/dist/client/terminal/model.js.map +1 -1
- package/data/build/dist/client/terminal/recovery.d.ts +7 -3
- package/data/build/dist/client/terminal/recovery.d.ts.map +1 -1
- package/data/build/dist/client/terminal/recovery.js +45 -41
- package/data/build/dist/client/terminal/recovery.js.map +1 -1
- package/data/build/dist/client/terminal/selection-actions.d.ts +63 -0
- package/data/build/dist/client/terminal/selection-actions.d.ts.map +1 -0
- package/data/build/dist/client/terminal/selection-actions.js +132 -0
- package/data/build/dist/client/terminal/selection-actions.js.map +1 -0
- package/data/build/dist/client/terminal/share-menu.d.ts +17 -0
- package/data/build/dist/client/terminal/share-menu.d.ts.map +1 -0
- package/data/build/dist/client/terminal/share-menu.js +131 -0
- package/data/build/dist/client/terminal/share-menu.js.map +1 -0
- package/data/build/dist/client/terminal/sharing.d.ts +42 -0
- package/data/build/dist/client/terminal/sharing.d.ts.map +1 -0
- package/data/build/dist/client/terminal/sharing.js +144 -0
- package/data/build/dist/client/terminal/sharing.js.map +1 -0
- package/data/build/dist/client/terminal/snapshot.d.ts +32 -0
- package/data/build/dist/client/terminal/snapshot.d.ts.map +1 -0
- package/data/build/dist/client/terminal/snapshot.js +108 -0
- package/data/build/dist/client/terminal/snapshot.js.map +1 -0
- package/data/build/dist/client/terminal/styles.d.ts +14 -0
- package/data/build/dist/client/terminal/styles.d.ts.map +1 -1
- package/data/build/dist/client/terminal/styles.js +39 -1
- package/data/build/dist/client/terminal/styles.js.map +1 -1
- package/data/build/dist/client/terminal/surface-cache.d.ts +10 -0
- package/data/build/dist/client/terminal/surface-cache.d.ts.map +1 -0
- package/data/build/dist/client/terminal/surface-cache.js +19 -0
- package/data/build/dist/client/terminal/surface-cache.js.map +1 -0
- package/data/build/dist/client/terminal/ui.d.ts.map +1 -1
- package/data/build/dist/client/terminal/ui.js +78 -21
- package/data/build/dist/client/terminal/ui.js.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.d.ts +5 -2
- package/data/build/dist/client/terminal/xterm-view.d.ts.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.js +429 -397
- package/data/build/dist/client/terminal/xterm-view.js.map +1 -1
- package/data/build/dist/client/touch-input-focus.d.ts +30 -0
- package/data/build/dist/client/touch-input-focus.d.ts.map +1 -0
- package/data/build/dist/client/touch-input-focus.js +190 -0
- package/data/build/dist/client/touch-input-focus.js.map +1 -0
- package/data/build/dist/client/voice-capture.d.ts +9 -0
- package/data/build/dist/client/voice-capture.d.ts.map +1 -1
- package/data/build/dist/client/voice-capture.js +35 -1
- package/data/build/dist/client/voice-capture.js.map +1 -1
- package/data/build/dist/client/voice-chat-updates.d.ts +12 -0
- package/data/build/dist/client/voice-chat-updates.d.ts.map +1 -0
- package/data/build/dist/client/voice-chat-updates.js +39 -0
- package/data/build/dist/client/voice-chat-updates.js.map +1 -0
- package/data/build/dist/client/voice-diagnostics.d.ts +19 -0
- package/data/build/dist/client/voice-diagnostics.d.ts.map +1 -0
- package/data/build/dist/client/voice-diagnostics.js +73 -0
- package/data/build/dist/client/voice-diagnostics.js.map +1 -0
- package/data/build/dist/client/voice-model-setup-progress.d.ts +8 -0
- package/data/build/dist/client/voice-model-setup-progress.d.ts.map +1 -0
- package/data/build/dist/client/voice-model-setup-progress.js +27 -0
- package/data/build/dist/client/voice-model-setup-progress.js.map +1 -0
- package/data/build/dist/client/voice-stream-uploader.d.ts +41 -0
- package/data/build/dist/client/voice-stream-uploader.d.ts.map +1 -0
- package/data/build/dist/client/voice-stream-uploader.js +154 -0
- package/data/build/dist/client/voice-stream-uploader.js.map +1 -0
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.d.ts +4 -0
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.js +9 -0
- package/data/build/dist/dsh-capabilities/client/config-forms-adapter.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts +5 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js +25 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/terminal-sharing-adapter.d.ts +33 -0
- package/data/build/dist/dsh-capabilities/client/terminal-sharing-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/client/terminal-sharing-adapter.js +187 -0
- package/data/build/dist/dsh-capabilities/client/terminal-sharing-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-agent-adapter.d.ts +55 -0
- package/data/build/dist/dsh-capabilities/host/assistant-agent-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-agent-adapter.js +264 -0
- package/data/build/dist/dsh-capabilities/host/assistant-agent-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-attachment-adapter.d.ts +16 -0
- package/data/build/dist/dsh-capabilities/host/assistant-attachment-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-attachment-adapter.js +69 -0
- package/data/build/dist/dsh-capabilities/host/assistant-attachment-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-llm-adapter.d.ts +36 -0
- package/data/build/dist/dsh-capabilities/host/assistant-llm-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-llm-adapter.js +112 -0
- package/data/build/dist/dsh-capabilities/host/assistant-llm-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-web-search-adapter.d.ts +4 -0
- package/data/build/dist/dsh-capabilities/host/assistant-web-search-adapter.d.ts.map +1 -0
- package/data/build/dist/dsh-capabilities/host/assistant-web-search-adapter.js +41 -0
- package/data/build/dist/dsh-capabilities/host/assistant-web-search-adapter.js.map +1 -0
- package/data/build/dist/dsh-capabilities/matrix.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/matrix.js +3 -0
- package/data/build/dist/dsh-capabilities/matrix.js.map +1 -1
- package/data/build/dist/dsh-capabilities/routes.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/routes.js +18 -0
- package/data/build/dist/dsh-capabilities/routes.js.map +1 -1
- package/data/build/dist/dsh-capabilities/settings-store.d.ts +2 -0
- package/data/build/dist/dsh-capabilities/settings-store.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/settings-store.js.map +1 -1
- package/data/build/dist/dsh-capabilities/types.d.ts +1 -1
- package/data/build/dist/dsh-capabilities/types.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/types.js.map +1 -1
- package/data/build/dist/host/avatar/catalog.d.ts +21 -0
- package/data/build/dist/host/avatar/catalog.d.ts.map +1 -0
- package/data/build/dist/host/avatar/catalog.js +123 -0
- package/data/build/dist/host/avatar/catalog.js.map +1 -0
- package/data/build/dist/host/avatar/engine.d.ts +42 -0
- package/data/build/dist/host/avatar/engine.d.ts.map +1 -0
- package/data/build/dist/host/avatar/engine.js +167 -0
- package/data/build/dist/host/avatar/engine.js.map +1 -0
- package/data/build/dist/host/avatar/materials.d.ts +28 -0
- package/data/build/dist/host/avatar/materials.d.ts.map +1 -0
- package/data/build/dist/host/avatar/materials.js +183 -0
- package/data/build/dist/host/avatar/materials.js.map +1 -0
- package/data/build/dist/host/avatar/packages.d.ts +34 -0
- package/data/build/dist/host/avatar/packages.d.ts.map +1 -0
- package/data/build/dist/host/avatar/packages.js +200 -0
- package/data/build/dist/host/avatar/packages.js.map +1 -0
- package/data/build/dist/host/avatar/registry.d.ts +12 -0
- package/data/build/dist/host/avatar/registry.d.ts.map +1 -0
- package/data/build/dist/host/avatar/registry.js +22 -0
- package/data/build/dist/host/avatar/registry.js.map +1 -0
- package/data/build/dist/host/avatar/remote.d.ts +18 -0
- package/data/build/dist/host/avatar/remote.d.ts.map +1 -0
- package/data/build/dist/host/avatar/remote.js +103 -0
- package/data/build/dist/host/avatar/remote.js.map +1 -0
- package/data/build/dist/host/avatar/sources.d.ts +11 -0
- package/data/build/dist/host/avatar/sources.d.ts.map +1 -0
- package/data/build/dist/host/avatar/sources.js +78 -0
- package/data/build/dist/host/avatar/sources.js.map +1 -0
- package/data/build/dist/host/avatar/temporary-previews.d.ts +26 -0
- package/data/build/dist/host/avatar/temporary-previews.d.ts.map +1 -0
- package/data/build/dist/host/avatar/temporary-previews.js +139 -0
- package/data/build/dist/host/avatar/temporary-previews.js.map +1 -0
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts +1 -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 +3 -10
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-subscription.js +10 -10
- package/data/build/dist/host/cli-adapters/antigravity-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.js +7 -5
- package/data/build/dist/host/cli-adapters/claude-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codebuddy-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codebuddy-driver.js +8 -7
- package/data/build/dist/host/cli-adapters/codebuddy-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 +10 -3
- package/data/build/dist/host/cli-adapters/codex-driver.js.map +1 -1
- 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 +9 -8
- package/data/build/dist/host/cli-adapters/command-code-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/cursor-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/cursor-driver.js +4 -3
- package/data/build/dist/host/cli-adapters/cursor-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/delegate-dispatch.js +1 -1
- package/data/build/dist/host/cli-adapters/delegate-dispatch.js.map +1 -1
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.js +5 -0
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.js.map +1 -1
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.js +2 -4
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.js.map +1 -1
- package/data/build/dist/host/cli-adapters/driver.d.ts +1 -1
- package/data/build/dist/host/cli-adapters/feature.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.js +28 -36
- package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/grok-driver.js +2 -1
- package/data/build/dist/host/cli-adapters/grok-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/kimi-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/kimi-driver.js +4 -3
- package/data/build/dist/host/cli-adapters/kimi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.d.ts +2 -0
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.js +10 -0
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.js.map +1 -1
- package/data/build/dist/host/cli-adapters/log-files.d.ts +3 -0
- package/data/build/dist/host/cli-adapters/log-files.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/log-files.js +32 -0
- package/data/build/dist/host/cli-adapters/log-files.js.map +1 -0
- package/data/build/dist/host/cli-adapters/native-team-subagent.js +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.js.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts +10 -0
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.js +128 -26
- package/data/build/dist/host/cli-adapters/opencode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.d.ts +29 -0
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.js +471 -0
- package/data/build/dist/host/cli-adapters/opencode-v2-protocol.js.map +1 -0
- 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 +8 -2
- package/data/build/dist/host/cli-adapters/process-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.js +90 -9
- package/data/build/dist/host/cli-adapters/process-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-driver.js +55 -72
- package/data/build/dist/host/cli-adapters/qoder-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-subscription.d.ts +6 -1
- package/data/build/dist/host/cli-adapters/qoder-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-subscription.js +37 -10
- package/data/build/dist/host/cli-adapters/qoder-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.d.ts +13 -21
- package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.js +71 -127
- package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.d.ts +1 -0
- 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 +6 -6
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/session-store.d.ts +5 -1
- package/data/build/dist/host/cli-adapters/session-store.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/session-store.js +68 -11
- package/data/build/dist/host/cli-adapters/session-store.js.map +1 -1
- 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 -3
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js.map +1 -1
- package/data/build/dist/host/cli-bridge/dispatch.js +1 -1
- package/data/build/dist/host/cli-bridge/dispatch.js.map +1 -1
- package/data/build/dist/host/debug.d.ts.map +1 -1
- package/data/build/dist/host/debug.js +5 -4
- package/data/build/dist/host/debug.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/dsh-runtime-version.d.ts +1 -1
- package/data/build/dist/host/dsh-runtime-version.d.ts.map +1 -1
- package/data/build/dist/host/dsh-runtime-version.js +22 -17
- package/data/build/dist/host/dsh-runtime-version.js.map +1 -1
- 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 +250 -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-source-cache.d.ts +12 -0
- package/data/build/dist/host/features/assistant-source-cache.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-source-cache.js +56 -0
- package/data/build/dist/host/features/assistant-source-cache.js.map +1 -0
- 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-coordinator.d.ts.map +1 -1
- package/data/build/dist/host/features/global-voice-coordinator.js +15 -10
- package/data/build/dist/host/features/global-voice-coordinator.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 +1076 -159
- package/data/build/dist/host/features/global-voice-rpc.js.map +1 -1
- package/data/build/dist/host/features/index.d.ts.map +1 -1
- package/data/build/dist/host/features/index.js +4 -0
- package/data/build/dist/host/features/index.js.map +1 -1
- package/data/build/dist/host/features/moss-tts-worker.d.ts +32 -0
- package/data/build/dist/host/features/moss-tts-worker.d.ts.map +1 -0
- package/data/build/dist/host/features/moss-tts-worker.js +216 -0
- package/data/build/dist/host/features/moss-tts-worker.js.map +1 -0
- package/data/build/dist/host/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/host/features/peer-host.js +15 -7
- package/data/build/dist/host/features/peer-host.js.map +1 -1
- package/data/build/dist/host/features/sherpa-voice-runtime.d.ts +11 -0
- package/data/build/dist/host/features/sherpa-voice-runtime.d.ts.map +1 -1
- package/data/build/dist/host/features/sherpa-voice-runtime.js +72 -17
- package/data/build/dist/host/features/sherpa-voice-runtime.js.map +1 -1
- package/data/build/dist/host/features/sherpa-voice-worker.d.ts +18 -0
- package/data/build/dist/host/features/sherpa-voice-worker.d.ts.map +1 -0
- package/data/build/dist/host/features/sherpa-voice-worker.js +40 -0
- package/data/build/dist/host/features/sherpa-voice-worker.js.map +1 -0
- package/data/build/dist/host/features/sherpa-worker-runtime.d.ts +41 -0
- package/data/build/dist/host/features/sherpa-worker-runtime.d.ts.map +1 -0
- package/data/build/dist/host/features/sherpa-worker-runtime.js +200 -0
- package/data/build/dist/host/features/sherpa-worker-runtime.js.map +1 -0
- 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 +6 -1
- package/data/build/dist/host/index.d.ts.map +1 -1
- package/data/build/dist/host/index.js +32 -14
- 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 +7 -23
- package/data/build/dist/host/lan-access-dsh.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.d.ts +6 -46
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.js +48 -28
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.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-diagnostics.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-diagnostics.js +1 -0
- package/data/build/dist/host/modules/peer-host/peer-host-diagnostics.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-handshake.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-handshake.js +4 -1
- package/data/build/dist/host/modules/peer-host/peer-host-handshake.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js +12 -0
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-session.d.ts +7 -1
- package/data/build/dist/host/modules/peer-host/peer-host-session.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-session.js +40 -13
- package/data/build/dist/host/modules/peer-host/peer-host-session.js.map +1 -1
- package/data/build/dist/host/rpc.d.ts.map +1 -1
- package/data/build/dist/host/rpc.js +46 -5
- 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/terminal/backends/tmux-backend.d.ts +1 -1
- package/data/build/dist/host/terminal/backends/tmux-backend.d.ts.map +1 -1
- package/data/build/dist/host/terminal/backends/tmux-backend.js +15 -14
- package/data/build/dist/host/terminal/backends/tmux-backend.js.map +1 -1
- 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 +34 -0
- package/data/build/dist/shared/assistant-avatar-engine.d.ts.map +1 -0
- package/data/build/dist/shared/assistant-avatar-engine.js +32 -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 +3 -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/errors.d.ts +1 -0
- package/data/build/dist/shared/contracts/errors.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/errors.js +1 -0
- package/data/build/dist/shared/contracts/errors.js.map +1 -1
- package/data/build/dist/shared/contracts/peer-host.d.ts +3 -0
- package/data/build/dist/shared/contracts/peer-host.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/peer-host.js +1 -0
- 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 +3 -1
- package/data/build/dist/shared/contracts/version.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/version.js +20 -7
- package/data/build/dist/shared/contracts/version.js.map +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/peer-host-http-routes.d.ts +62 -0
- package/data/build/dist/shared/peer-host-http-routes.d.ts.map +1 -0
- package/data/build/dist/shared/peer-host-http-routes.js +31 -0
- package/data/build/dist/shared/peer-host-http-routes.js.map +1 -0
- package/data/build/dist/shared/runtime-environment.d.ts +5 -0
- package/data/build/dist/shared/runtime-environment.d.ts.map +1 -0
- package/data/build/dist/shared/runtime-environment.js +7 -0
- package/data/build/dist/shared/runtime-environment.js.map +1 -0
- package/data/build/dist/shared/voice-diagnostics.d.ts +18 -0
- package/data/build/dist/shared/voice-diagnostics.d.ts.map +1 -0
- package/data/build/dist/shared/voice-diagnostics.js +57 -0
- package/data/build/dist/shared/voice-diagnostics.js.map +1 -0
- package/data/build/dist/shared/voice-initialization.d.ts +22 -0
- package/data/build/dist/shared/voice-initialization.d.ts.map +1 -0
- package/data/build/dist/shared/voice-initialization.js +4 -0
- package/data/build/dist/shared/voice-initialization.js.map +1 -0
- package/data/build/dist/shared/voice-models.d.ts +43 -0
- package/data/build/dist/shared/voice-models.d.ts.map +1 -1
- package/data/build/dist/shared/voice-models.js +23 -8
- package/data/build/dist/shared/voice-models.js.map +1 -1
- package/data/build/dist/shared/voice-stream.d.ts +12 -1
- package/data/build/dist/shared/voice-stream.d.ts.map +1 -1
- package/data/build/dist/shared/voice-stream.js +8 -1
- package/data/build/dist/shared/voice-stream.js.map +1 -1
- package/package.json +19 -3
- package/profile/README.md +2 -2
- package/profile/package.json +2 -2
- package/profile/version.json +1 -1
- package/version.json +1 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AssistantAvatarCatalogEntry } from '../../shared/assistant-avatar-catalog.js';
|
|
2
|
+
import { AssistantAvatarRemote } from './remote.js';
|
|
3
|
+
import type { AssistantAvatarPackages } from './packages.js';
|
|
4
|
+
type ReadCatalogFile = (path: string) => Promise<string>;
|
|
5
|
+
/** 随包只保存索引和安装清单;选中记录后才请求预览,安装确认后才请求素材。 */
|
|
6
|
+
export declare class AssistantAvatarCatalog {
|
|
7
|
+
private readonly read;
|
|
8
|
+
private readonly remote;
|
|
9
|
+
private records;
|
|
10
|
+
private readonly previews;
|
|
11
|
+
constructor(read?: ReadCatalogFile, remote?: AssistantAvatarRemote);
|
|
12
|
+
list(): Promise<readonly AssistantAvatarCatalogEntry[]>;
|
|
13
|
+
install(id: string, revision: string, packages: AssistantAvatarPackages, signal?: AbortSignal): Promise<import("../../index.js").AssistantAvatarInstallation>;
|
|
14
|
+
/** 固定白名单路径,不接受浏览器传入外部 URL;也不返回整张动作图集作为预览。 */
|
|
15
|
+
preview(request: Request): Promise<Response>;
|
|
16
|
+
private find;
|
|
17
|
+
private load;
|
|
18
|
+
private readRecords;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../../src/host/avatar/catalog.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAA;AAC3F,OAAO,EAAE,qBAAqB,EAAa,MAAM,aAAa,CAAA;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAA;AAQ5D,KAAK,eAAe,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;AAGxD,0CAA0C;AAC1C,qBAAa,sBAAsB;IAGrB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAAqC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAF7F,OAAO,CAAC,OAAO,CAA+C;IAC9D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgE;gBAC5D,IAAI,GAAE,eAAiC,EAAmB,MAAM,wBAA8B;IAErH,IAAI,IAAI,OAAO,CAAC,SAAS,2BAA2B,EAAE,CAAC;IAEvD,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,uBAAuB,EAAE,MAAM,CAAC,EAAE,WAAW;IAMnG,6CAA6C;IACvC,OAAO,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC;YAqBpC,IAAI;IAKlB,OAAO,CAAC,IAAI;YAIE,WAAW;CA6B1B"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
import { dirname, join } from 'node:path';
|
|
4
|
+
import { BUILTIN_ASSISTANT_AVATAR_ADAPTERS } from '../../shared/assistant-avatar-adapters.js';
|
|
5
|
+
import { ASSISTANT_AVATAR_CATALOG_PREVIEW_PATH } from '../../shared/assistant-avatar-catalog.js';
|
|
6
|
+
import { AssistantAvatarRemote, remoteUrl } from './remote.js';
|
|
7
|
+
const previewLimit = 1024 * 1024;
|
|
8
|
+
/** 随包只保存索引和安装清单;选中记录后才请求预览,安装确认后才请求素材。 */
|
|
9
|
+
export class AssistantAvatarCatalog {
|
|
10
|
+
read;
|
|
11
|
+
remote;
|
|
12
|
+
records;
|
|
13
|
+
previews = new Map();
|
|
14
|
+
constructor(read = readCatalogFile, remote = new AssistantAvatarRemote()) {
|
|
15
|
+
this.read = read;
|
|
16
|
+
this.remote = remote;
|
|
17
|
+
}
|
|
18
|
+
async list() { return (await this.load()).map(({ entry }) => entry); }
|
|
19
|
+
async install(id, revision, packages, signal) {
|
|
20
|
+
signal?.throwIfAborted();
|
|
21
|
+
const record = await this.find(id, revision);
|
|
22
|
+
return packages.installManifest(record.manifest, record.manifestUrl, 'codingns-pack', signal);
|
|
23
|
+
}
|
|
24
|
+
/** 固定白名单路径,不接受浏览器传入外部 URL;也不返回整张动作图集作为预览。 */
|
|
25
|
+
async preview(request) {
|
|
26
|
+
const url = new URL(request.url);
|
|
27
|
+
if (url.pathname !== ASSISTANT_AVATAR_CATALOG_PREVIEW_PATH)
|
|
28
|
+
return new Response(null, { status: 404 });
|
|
29
|
+
if (request.method !== 'GET')
|
|
30
|
+
return new Response(null, { status: 405, headers: { Allow: 'GET' } });
|
|
31
|
+
const record = await this.find(url.searchParams.get('id') ?? '', url.searchParams.get('revision') ?? '');
|
|
32
|
+
if (record.previewUrl === undefined)
|
|
33
|
+
return new Response(null, { status: 404 });
|
|
34
|
+
const key = `${record.entry.id}:${record.entry.revision}`;
|
|
35
|
+
let preview = this.previews.get(key);
|
|
36
|
+
if (preview === undefined) {
|
|
37
|
+
const { bytes } = await this.remote.read(record.previewUrl, previewLimit, request.signal);
|
|
38
|
+
const contentType = previewContentType(bytes);
|
|
39
|
+
request.signal.throwIfAborted();
|
|
40
|
+
preview = { bytes, contentType };
|
|
41
|
+
// 上限八张小图,既避免反复切换下载,也不长期积累整个目录的图片。
|
|
42
|
+
if (this.previews.size >= 8)
|
|
43
|
+
this.previews.delete(this.previews.keys().next().value);
|
|
44
|
+
this.previews.set(key, preview);
|
|
45
|
+
}
|
|
46
|
+
return new Response(new Uint8Array(preview.bytes), { headers: { 'Content-Type': preview.contentType,
|
|
47
|
+
'Cache-Control': 'no-store', 'X-Content-Type-Options': 'nosniff' } });
|
|
48
|
+
}
|
|
49
|
+
async find(id, revision) {
|
|
50
|
+
const record = (await this.load()).find(({ entry }) => entry.id === id && entry.revision === revision);
|
|
51
|
+
if (record === undefined)
|
|
52
|
+
throw new TypeError('形象目录记录已变更,请重新选择');
|
|
53
|
+
return record;
|
|
54
|
+
}
|
|
55
|
+
load() {
|
|
56
|
+
this.records ??= this.readRecords().catch((error) => { this.records = undefined; throw error; });
|
|
57
|
+
return this.records;
|
|
58
|
+
}
|
|
59
|
+
async readRecords() {
|
|
60
|
+
const value = parseJson(await this.read('avatar-packages/catalog.json'));
|
|
61
|
+
if (value?.catalogVersion !== 1 || !Array.isArray(value.packages) || value.packages.length > 100)
|
|
62
|
+
throw new TypeError('形象目录格式无效');
|
|
63
|
+
const ids = new Set();
|
|
64
|
+
const native = BUILTIN_ASSISTANT_AVATAR_ADAPTERS.find((adapter) => adapter.id === 'codingns-pack');
|
|
65
|
+
return Promise.all(value.packages.map(async (item, index) => {
|
|
66
|
+
if (item === null || typeof item !== 'object' || typeof item.id !== 'string' || !/^[a-z0-9-]{1,80}$/u.test(item.id)
|
|
67
|
+
|| ids.has(item.id) || item.number !== index + 1 || typeof item.revision !== 'string' || !/^[a-f0-9]{40}$/u.test(item.revision))
|
|
68
|
+
throw new TypeError('形象目录身份无效');
|
|
69
|
+
ids.add(item.id);
|
|
70
|
+
const manifest = parseJson(await this.read(`avatar-packages/manifests/${item.id}.avatar.json`));
|
|
71
|
+
const manifestUrl = publicUrl(item.installManifestUrl);
|
|
72
|
+
const model = native.parse(manifest, { manifestUrl });
|
|
73
|
+
const name = label(item.name, 80);
|
|
74
|
+
const author = label(item.author, 500);
|
|
75
|
+
if (model.id !== `catalog-${item.id}` || model.name !== name || model.package?.author !== author || !model.package.license || !model.package.homepage)
|
|
76
|
+
throw new TypeError('形象清单与目录不一致');
|
|
77
|
+
const repositoryUrl = publicUrl(item.repositoryUrl);
|
|
78
|
+
const repository = new URL(repositoryUrl);
|
|
79
|
+
const pinnedSource = `https://raw.githubusercontent.com${repository.pathname}/${item.revision}/`;
|
|
80
|
+
if (repository.origin !== 'https://github.com' || !model.source.startsWith(pinnedSource))
|
|
81
|
+
throw new TypeError('形象素材未固定到目录版本');
|
|
82
|
+
const stats = item.verification;
|
|
83
|
+
if (!Number.isSafeInteger(stats?.files) || stats.files < 1 || !Number.isSafeInteger(stats?.bytes) || stats.bytes < 1)
|
|
84
|
+
throw new TypeError('形象目录大小无效');
|
|
85
|
+
const previewUrl = item.previewUrl === undefined ? undefined : publicUrl(item.previewUrl);
|
|
86
|
+
return { manifest, manifestUrl, ...(previewUrl === undefined ? {} : { previewUrl }), entry: Object.freeze({
|
|
87
|
+
id: item.id, number: index + 1, name, author, description: label(item.description, 1000), remarks: label(item.remarks, 2000),
|
|
88
|
+
repositoryUrl, licenseUrl: publicUrl(item.licenseUrl), license: model.package.license, homepage: model.package.homepage,
|
|
89
|
+
format: label(item.format, 80), revision: item.revision, bytes: stats.bytes, files: stats.files, previewAvailable: previewUrl !== undefined,
|
|
90
|
+
}) };
|
|
91
|
+
}));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
async function readCatalogFile(path) {
|
|
95
|
+
const root = dirname(createRequire(import.meta.url).resolve('@jingyi0605/codingns4dsh/package.json'));
|
|
96
|
+
return readFile(join(root, path), 'utf8');
|
|
97
|
+
}
|
|
98
|
+
function parseJson(text) {
|
|
99
|
+
if (text.length > 256 * 1024)
|
|
100
|
+
throw new TypeError('形象目录清单过大');
|
|
101
|
+
return JSON.parse(text);
|
|
102
|
+
}
|
|
103
|
+
function label(value, max) {
|
|
104
|
+
if (typeof value !== 'string' || !value.trim() || value.length > max)
|
|
105
|
+
throw new TypeError('形象目录文字无效');
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
function publicUrl(value) {
|
|
109
|
+
if (typeof value !== 'string')
|
|
110
|
+
throw new TypeError('形象目录地址无效');
|
|
111
|
+
return remoteUrl(value).href;
|
|
112
|
+
}
|
|
113
|
+
function previewContentType(bytes) {
|
|
114
|
+
const signature = Buffer.from(bytes.subarray(0, 12));
|
|
115
|
+
if (signature.subarray(0, 8).equals(Buffer.from([137, 80, 78, 71, 13, 10, 26, 10])))
|
|
116
|
+
return 'image/png';
|
|
117
|
+
if (signature.subarray(0, 4).toString() === 'RIFF' && signature.subarray(8, 12).toString() === 'WEBP')
|
|
118
|
+
return 'image/webp';
|
|
119
|
+
if (signature[0] === 255 && signature[1] === 216 && signature[2] === 255)
|
|
120
|
+
return 'image/jpeg';
|
|
121
|
+
throw new TypeError('形象预览必须为 PNG、WebP 或 JPEG 图片');
|
|
122
|
+
}
|
|
123
|
+
//# sourceMappingURL=catalog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../../../src/host/avatar/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,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QAAE,OAAO,YAAY,CAAA;IAC7F,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type AssistantAvatarEngineProgress = {
|
|
2
|
+
readonly phase: 'checking';
|
|
3
|
+
} | {
|
|
4
|
+
readonly phase: 'downloading';
|
|
5
|
+
readonly bytes: number;
|
|
6
|
+
readonly total: number | null;
|
|
7
|
+
} | {
|
|
8
|
+
readonly phase: 'extracting';
|
|
9
|
+
} | {
|
|
10
|
+
readonly phase: 'ready';
|
|
11
|
+
};
|
|
12
|
+
export type AssistantAvatarEngineDownload = (url: string, file: string, signal: AbortSignal, progress: (bytes: number, total: number | null) => void) => Promise<void>;
|
|
13
|
+
export type AssistantAvatarEngineCommand = (command: string, args: readonly string[], signal: AbortSignal) => Promise<void>;
|
|
14
|
+
export interface AssistantAvatarEngineInstallOptions {
|
|
15
|
+
readonly signal: AbortSignal;
|
|
16
|
+
readonly directory?: string;
|
|
17
|
+
readonly progress?: (progress: AssistantAvatarEngineProgress) => void;
|
|
18
|
+
readonly download?: AssistantAvatarEngineDownload;
|
|
19
|
+
readonly run?: AssistantAvatarEngineCommand;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* CodingNS 自有引擎目录,不复用 DSH 插件目录、源码或 Desktop Profile。
|
|
23
|
+
*
|
|
24
|
+
* 显式目录用于离线预置与测试;默认与语音模型同根,随 DSH_HOME 隔离。
|
|
25
|
+
*/
|
|
26
|
+
export declare function assistantAvatarEngineDirectory(environment?: NodeJS.ProcessEnv): string;
|
|
27
|
+
/** 只读取已校验的完整安装;缺少标记、版本漂移或入口异常都视为未安装。 */
|
|
28
|
+
export declare function readAssistantAvatarEngine(options?: {
|
|
29
|
+
readonly directory?: string;
|
|
30
|
+
}): Promise<string | undefined>;
|
|
31
|
+
export declare function assistantAvatarEngineInstalled(options?: {
|
|
32
|
+
readonly directory?: string;
|
|
33
|
+
}): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* 在专属暂存目录下载、校验并解压,最后原子提升;失败不留伪就绪标记。
|
|
36
|
+
*
|
|
37
|
+
* 同进程内串行化,重复点击不会产生两份并发下载;已就绪时直接返回。
|
|
38
|
+
*/
|
|
39
|
+
export declare function installAssistantAvatarEngine(options: AssistantAvatarEngineInstallOptions): Promise<void>;
|
|
40
|
+
/** 参数数组调用,取消与超时后才结算,避免旧安装进程覆盖新结果。 */
|
|
41
|
+
export declare function runEngineProcess(command: string, args: readonly string[], signal: AbortSignal): Promise<void>;
|
|
42
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../../../src/host/avatar/engine.ts"],"names":[],"mappings":"AAeA,MAAM,MAAM,6BAA6B,GACrC;IAAE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE,GAC9B;IAAE,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACxF;IAAE,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAChC;IAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAA;AAC/B,MAAM,MAAM,6BAA6B,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,EACzF,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAC3E,MAAM,MAAM,4BAA4B,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;AAC3H,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,6BAA6B,KAAK,IAAI,CAAA;IACrE,QAAQ,CAAC,QAAQ,CAAC,EAAE,6BAA6B,CAAA;IACjD,QAAQ,CAAC,GAAG,CAAC,EAAE,4BAA4B,CAAA;CAC5C;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,WAAW,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAMnG;AAED,wCAAwC;AACxC,wBAAsB,yBAAyB,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAQ1H;AAED,wBAAsB,8BAA8B,CAAC,OAAO,GAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAEpH;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,mCAAmC,GAAG,OAAO,CAAC,IAAI,CAAC,CAExG;AAsDD,qCAAqC;AACrC,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBnH"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { mkdir, mkdtemp, open, readFile, rename, rm, stat, writeFile } from 'node:fs/promises';
|
|
4
|
+
import { homedir } from 'node:os';
|
|
5
|
+
import { dirname, join } from 'node:path';
|
|
6
|
+
import { ASSISTANT_AVATAR_ENGINE_ENTRY, ASSISTANT_AVATAR_ENGINE_MAX_ARCHIVE_BYTES, ASSISTANT_AVATAR_ENGINE_MIN_ENTRY_BYTES, ASSISTANT_AVATAR_ENGINE_SHA512, ASSISTANT_AVATAR_ENGINE_TARBALL, ASSISTANT_AVATAR_ENGINE_VERSION, } from '../../shared/assistant-avatar-engine.js';
|
|
7
|
+
import { systemTarCommand } from '../tar-archive.js';
|
|
8
|
+
/**
|
|
9
|
+
* CodingNS 自有引擎目录,不复用 DSH 插件目录、源码或 Desktop Profile。
|
|
10
|
+
*
|
|
11
|
+
* 显式目录用于离线预置与测试;默认与语音模型同根,随 DSH_HOME 隔离。
|
|
12
|
+
*/
|
|
13
|
+
export function assistantAvatarEngineDirectory(environment = process.env) {
|
|
14
|
+
const configured = environment.CODINGNS4DSH_AVATAR_ENGINE_DIR?.trim();
|
|
15
|
+
if (configured !== undefined && configured !== '')
|
|
16
|
+
return configured;
|
|
17
|
+
const dshHome = environment.DSH_HOME?.trim();
|
|
18
|
+
return join(dshHome === undefined || dshHome === '' ? join(homedir(), '.dsh') : dshHome, 'codingns4dsh', 'avatar-engine', `l2d-${ASSISTANT_AVATAR_ENGINE_VERSION}`);
|
|
19
|
+
}
|
|
20
|
+
/** 只读取已校验的完整安装;缺少标记、版本漂移或入口异常都视为未安装。 */
|
|
21
|
+
export async function readAssistantAvatarEngine(options = {}) {
|
|
22
|
+
const directory = options.directory ?? assistantAvatarEngineDirectory();
|
|
23
|
+
try {
|
|
24
|
+
const marker = JSON.parse(await readFile(join(directory, 'ready.json'), 'utf8'));
|
|
25
|
+
if (marker.version !== ASSISTANT_AVATAR_ENGINE_VERSION || marker.sha512 !== ASSISTANT_AVATAR_ENGINE_SHA512)
|
|
26
|
+
return undefined;
|
|
27
|
+
const bytes = await readFile(join(directory, ASSISTANT_AVATAR_ENGINE_ENTRY));
|
|
28
|
+
return bytes.byteLength < ASSISTANT_AVATAR_ENGINE_MIN_ENTRY_BYTES ? undefined : bytes.toString('utf8');
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export async function assistantAvatarEngineInstalled(options = {}) {
|
|
35
|
+
return await readAssistantAvatarEngine(options) !== undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* 在专属暂存目录下载、校验并解压,最后原子提升;失败不留伪就绪标记。
|
|
39
|
+
*
|
|
40
|
+
* 同进程内串行化,重复点击不会产生两份并发下载;已就绪时直接返回。
|
|
41
|
+
*/
|
|
42
|
+
export function installAssistantAvatarEngine(options) {
|
|
43
|
+
return serialize(() => installOnce(options));
|
|
44
|
+
}
|
|
45
|
+
async function installOnce(options) {
|
|
46
|
+
const directory = options.directory ?? assistantAvatarEngineDirectory();
|
|
47
|
+
options.signal.throwIfAborted();
|
|
48
|
+
options.progress?.({ phase: 'checking' });
|
|
49
|
+
if (await assistantAvatarEngineInstalled({ directory }))
|
|
50
|
+
return;
|
|
51
|
+
const root = dirname(directory);
|
|
52
|
+
await mkdir(root, { recursive: true, mode: 0o700 });
|
|
53
|
+
const staging = await mkdtemp(join(root, '.prepare-'));
|
|
54
|
+
try {
|
|
55
|
+
const archive = join(staging, 'engine.tgz');
|
|
56
|
+
options.progress?.({ phase: 'downloading', bytes: 0, total: null });
|
|
57
|
+
await (options.download ?? downloadEngineArchive)(ASSISTANT_AVATAR_ENGINE_TARBALL, archive, options.signal, (bytes, total) => options.progress?.({ phase: 'downloading', bytes, total }));
|
|
58
|
+
options.signal.throwIfAborted();
|
|
59
|
+
options.progress?.({ phase: 'extracting' });
|
|
60
|
+
await (options.run ?? runEngineProcess)(systemTarCommand(), ['-xzf', archive, '-C', staging], options.signal);
|
|
61
|
+
const info = await stat(join(staging, ASSISTANT_AVATAR_ENGINE_ENTRY)).catch(() => undefined);
|
|
62
|
+
if (info === undefined || !info.isFile() || info.size < ASSISTANT_AVATAR_ENGINE_MIN_ENTRY_BYTES)
|
|
63
|
+
throw new Error('Live2D 引擎解压结果不完整,请重试');
|
|
64
|
+
options.signal.throwIfAborted();
|
|
65
|
+
await rm(archive, { force: true });
|
|
66
|
+
await writeFile(join(staging, 'ready.json'), JSON.stringify({ version: ASSISTANT_AVATAR_ENGINE_VERSION, sha512: ASSISTANT_AVATAR_ENGINE_SHA512 }), { mode: 0o600 });
|
|
67
|
+
await promoteEngine(staging, directory);
|
|
68
|
+
options.progress?.({ phase: 'ready' });
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
await rm(staging, { recursive: true, force: true });
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** 摘要与大小上限固定,不执行远程脚本;网络失败与内容变化都必须在写入前失败。 */
|
|
75
|
+
async function downloadEngineArchive(url, file, signal, progress) {
|
|
76
|
+
const response = await fetch(url, { signal: AbortSignal.any([signal, AbortSignal.timeout(180_000)]), redirect: 'follow' });
|
|
77
|
+
if (!response.ok || response.body === null)
|
|
78
|
+
throw new Error(`Live2D 引擎下载失败(${response.status}),请检查网络后重试`);
|
|
79
|
+
const length = Number(response.headers.get('content-length'));
|
|
80
|
+
const total = length > 0 && response.headers.get('content-encoding') === null ? length : null;
|
|
81
|
+
const reader = response.body.getReader();
|
|
82
|
+
const handle = await open(file, 'wx', 0o600);
|
|
83
|
+
const hash = createHash('sha512');
|
|
84
|
+
let bytes = 0;
|
|
85
|
+
try {
|
|
86
|
+
while (true) {
|
|
87
|
+
const next = await reader.read();
|
|
88
|
+
signal.throwIfAborted();
|
|
89
|
+
if (next.done)
|
|
90
|
+
break;
|
|
91
|
+
bytes += next.value.byteLength;
|
|
92
|
+
if (bytes > ASSISTANT_AVATAR_ENGINE_MAX_ARCHIVE_BYTES)
|
|
93
|
+
throw new Error('Live2D 引擎超过下载大小限制');
|
|
94
|
+
hash.update(next.value);
|
|
95
|
+
await handle.writeFile(next.value);
|
|
96
|
+
progress(bytes, total);
|
|
97
|
+
}
|
|
98
|
+
if (bytes === 0 || (total !== null && bytes !== total))
|
|
99
|
+
throw new Error('Live2D 引擎下载不完整,请重试');
|
|
100
|
+
if (hash.digest('base64') !== ASSISTANT_AVATAR_ENGINE_SHA512)
|
|
101
|
+
throw new Error('Live2D 引擎完整性校验失败,请重试');
|
|
102
|
+
await handle.sync();
|
|
103
|
+
}
|
|
104
|
+
finally {
|
|
105
|
+
await reader.cancel().catch(() => undefined);
|
|
106
|
+
reader.releaseLock();
|
|
107
|
+
await handle.close();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/** 参数数组调用,取消与超时后才结算,避免旧安装进程覆盖新结果。 */
|
|
111
|
+
export async function runEngineProcess(command, args, signal) {
|
|
112
|
+
signal.throwIfAborted();
|
|
113
|
+
await new Promise((resolve, reject) => {
|
|
114
|
+
const child = spawn(command, [...args], { windowsHide: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
115
|
+
let output = '';
|
|
116
|
+
let failure;
|
|
117
|
+
child.stdout.setEncoding('utf8');
|
|
118
|
+
child.stderr.setEncoding('utf8');
|
|
119
|
+
const collect = (chunk) => { output = (output + chunk).slice(-2000); };
|
|
120
|
+
child.stdout.on('data', collect);
|
|
121
|
+
child.stderr.on('data', collect);
|
|
122
|
+
const stop = (error) => { failure = error; child.kill('SIGKILL'); };
|
|
123
|
+
const cancel = () => stop(new Error('Live2D 引擎安装已取消'));
|
|
124
|
+
signal.addEventListener('abort', cancel, { once: true });
|
|
125
|
+
if (signal.aborted)
|
|
126
|
+
cancel();
|
|
127
|
+
const timeout = setTimeout(() => stop(new Error('Live2D 引擎解压超时')), 180_000);
|
|
128
|
+
child.once('error', (error) => { failure = new Error(`无法运行解压命令 ${command}:${error.message}`); });
|
|
129
|
+
child.once('close', (code) => {
|
|
130
|
+
clearTimeout(timeout);
|
|
131
|
+
signal.removeEventListener('abort', cancel);
|
|
132
|
+
if (failure !== undefined || code !== 0)
|
|
133
|
+
reject(failure ?? new Error(`Live2D 引擎解压失败(${code}):${output}`));
|
|
134
|
+
else
|
|
135
|
+
resolve();
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async function promoteEngine(staging, directory) {
|
|
140
|
+
const previous = `${directory}.${randomUUID()}.previous`;
|
|
141
|
+
let moved = false;
|
|
142
|
+
try {
|
|
143
|
+
await rename(directory, previous);
|
|
144
|
+
moved = true;
|
|
145
|
+
}
|
|
146
|
+
catch (error) {
|
|
147
|
+
if (error.code !== 'ENOENT')
|
|
148
|
+
throw error;
|
|
149
|
+
}
|
|
150
|
+
try {
|
|
151
|
+
await rename(staging, directory);
|
|
152
|
+
}
|
|
153
|
+
catch (error) {
|
|
154
|
+
if (moved)
|
|
155
|
+
await rename(previous, directory);
|
|
156
|
+
throw error;
|
|
157
|
+
}
|
|
158
|
+
if (moved)
|
|
159
|
+
await rm(previous, { recursive: true, force: true });
|
|
160
|
+
}
|
|
161
|
+
let engineInstallation = Promise.resolve();
|
|
162
|
+
function serialize(action) {
|
|
163
|
+
const task = engineInstallation.then(action);
|
|
164
|
+
engineInstallation = task.catch(() => undefined);
|
|
165
|
+
return task;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../../../src/host/avatar/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACpD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC9F,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EACL,6BAA6B,EAC7B,yCAAyC,EACzC,uCAAuC,EACvC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AAC5D,SAAS,SAAS,CAAI,MAAwB;IAC5C,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAC5C,kBAAkB,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAA;IAChD,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AssistantAvatarAsset, AssistantAvatarModel } from '../../shared/assistant-avatar.js';
|
|
2
|
+
import { AssistantAvatarRemote } from './remote.js';
|
|
3
|
+
export interface AssistantAvatarMaterial {
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly contentType: string;
|
|
6
|
+
readonly bytes: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
export interface AssistantAvatarMaterialContext {
|
|
9
|
+
readonly signal?: AbortSignal;
|
|
10
|
+
file(source: string, kind: 'image' | 'binary' | 'json' | 'sound' | 'motion'): Promise<string>;
|
|
11
|
+
model(source: string): Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
/** 渲染格式拥有自己的依赖解释器;安装器不识别角色、文件目录或插件名称。 */
|
|
14
|
+
export interface AssistantAvatarMaterialAdapter {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
supports(renderer: string): boolean;
|
|
17
|
+
install(asset: AssistantAvatarAsset, context: AssistantAvatarMaterialContext): Promise<AssistantAvatarAsset>;
|
|
18
|
+
}
|
|
19
|
+
export declare const BUILTIN_ASSISTANT_AVATAR_MATERIAL_ADAPTERS: readonly AssistantAvatarMaterialAdapter[];
|
|
20
|
+
/** 依赖完整下载并重写为本地引用;模型、动作、贴图本体不做裁剪。 */
|
|
21
|
+
export declare function installAssistantAvatarMaterials(model: AssistantAvatarModel, remote: AssistantAvatarRemote, signal?: AbortSignal, adapters?: readonly AssistantAvatarMaterialAdapter[]): Promise<{
|
|
22
|
+
id: string;
|
|
23
|
+
model: AssistantAvatarModel;
|
|
24
|
+
materials: readonly AssistantAvatarMaterial[];
|
|
25
|
+
}>;
|
|
26
|
+
/** Cubism 2/3 的所有文件引用统一走安装上下文,其余布局、参数和扩展数据原样保留。 */
|
|
27
|
+
export declare function rewriteAssistantAvatarModel(value: unknown, source: string, context: AssistantAvatarMaterialContext): Promise<unknown>;
|
|
28
|
+
//# sourceMappingURL=materials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"materials.d.ts","sourceRoot":"","sources":["../../../../../src/host/avatar/materials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAA;AAIlG,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,MAAM,WAAW,uBAAuB;IAAG,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAAE;AAC3H,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAA;IAC7B,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC7F,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;CACvC;AACD,yCAAyC;AACzC,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAA;IACnC,OAAO,CAAC,KAAK,EAAE,oBAAoB,EAAE,OAAO,EAAE,8BAA8B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAA;CAC7G;AAaD,eAAO,MAAM,0CAA0C,EAAE,SAAS,8BAA8B,EAAoB,CAAA;AAIpH,qCAAqC;AACrC,wBAAsB,+BAA+B,CAAC,KAAK,EAAE,oBAAoB,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,CAAC,EAAE,WAAW,EACpI,QAAQ,GAAE,SAAS,8BAA8B,EAA+C,GAAG,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,oBAAoB,CAAC;IAAC,SAAS,EAAE,SAAS,uBAAuB,EAAE,CAAA;CAAE,CAAC,CA6EvM;AAED,mDAAmD;AACnD,wBAAsB,2BAA2B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,8BAA8B,GAAG,OAAO,CAAC,OAAO,CAAC,CAqC3I"}
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { copyAssistantAvatarModel, validateAssistantAvatarModel } from '../../shared/assistant-avatar.js';
|
|
3
|
+
import { assistantAvatarInstalledSource } from '../../shared/assistant-avatar-installation.js';
|
|
4
|
+
import { resolveAssistantAvatarSource } from '../../shared/assistant-avatar-adapters.js';
|
|
5
|
+
import { AssistantAvatarRemote } from './remote.js';
|
|
6
|
+
const image = {
|
|
7
|
+
id: 'image', supports: (renderer) => renderer === 'image' || renderer === 'spritesheet',
|
|
8
|
+
async install(asset, context) {
|
|
9
|
+
const source = await context.file(asset.source, 'image');
|
|
10
|
+
const entries = await Promise.all(Object.entries(asset.stateSources ?? {}).map(async ([state, url]) => [state, await context.file(url, 'image')]));
|
|
11
|
+
return { ...asset, source, ...(asset.stateSources === undefined ? {} : { stateSources: Object.fromEntries(entries) }) };
|
|
12
|
+
},
|
|
13
|
+
};
|
|
14
|
+
const live2d = {
|
|
15
|
+
id: 'live2d', supports: (renderer) => renderer === 'live2d',
|
|
16
|
+
async install(asset, context) { return { ...asset, source: await context.model(asset.source) }; },
|
|
17
|
+
};
|
|
18
|
+
export const BUILTIN_ASSISTANT_AVATAR_MATERIAL_ADAPTERS = [image, live2d];
|
|
19
|
+
const marker = 'PACK_VERSION';
|
|
20
|
+
const digest = (value) => createHash('sha256').update(value).digest('hex');
|
|
21
|
+
/** 依赖完整下载并重写为本地引用;模型、动作、贴图本体不做裁剪。 */
|
|
22
|
+
export async function installAssistantAvatarMaterials(model, remote, signal, adapters = BUILTIN_ASSISTANT_AVATAR_MATERIAL_ADAPTERS) {
|
|
23
|
+
validateAssistantAvatarModel(model);
|
|
24
|
+
const lifetime = new AbortController();
|
|
25
|
+
const cancellation = signal === undefined ? lifetime.signal : AbortSignal.any([lifetime.signal, signal]);
|
|
26
|
+
const pending = new Map();
|
|
27
|
+
const materials = [];
|
|
28
|
+
let size = 0;
|
|
29
|
+
let active = 0;
|
|
30
|
+
const waiters = [];
|
|
31
|
+
const read = async (source, maxBytes) => {
|
|
32
|
+
if (active >= 4)
|
|
33
|
+
await new Promise((resolve) => waiters.push(resolve));
|
|
34
|
+
else
|
|
35
|
+
active++;
|
|
36
|
+
try {
|
|
37
|
+
cancellation.throwIfAborted();
|
|
38
|
+
return await remote.read(source, maxBytes, cancellation);
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
const next = waiters.shift();
|
|
42
|
+
if (next === undefined)
|
|
43
|
+
active--;
|
|
44
|
+
else
|
|
45
|
+
next();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
const register = (source, contentType, bytes) => {
|
|
49
|
+
size += bytes.byteLength;
|
|
50
|
+
if (size > 256 * 1024 * 1024)
|
|
51
|
+
throw new TypeError('单个形象包超过 256 MiB');
|
|
52
|
+
const suffix = new URL(source).pathname.match(/(\.model3?\.json|\.[a-z0-9]+)$/iu)?.[1]?.toLowerCase() ?? '.bin';
|
|
53
|
+
const key = `${digest(source)}${suffix}`;
|
|
54
|
+
materials.push({ key, contentType, bytes });
|
|
55
|
+
return assistantAvatarInstalledSource(marker, key);
|
|
56
|
+
};
|
|
57
|
+
const once = (source, action) => {
|
|
58
|
+
const existing = pending.get(source);
|
|
59
|
+
if (existing !== undefined)
|
|
60
|
+
return existing;
|
|
61
|
+
if (pending.size >= 256)
|
|
62
|
+
throw new TypeError('单个形象包最多包含 256 个资源');
|
|
63
|
+
const task = action();
|
|
64
|
+
pending.set(source, task);
|
|
65
|
+
return task;
|
|
66
|
+
};
|
|
67
|
+
const context = {
|
|
68
|
+
signal: cancellation,
|
|
69
|
+
file(source, kind) {
|
|
70
|
+
const contentType = resourceType(source, kind);
|
|
71
|
+
return once(source, async () => {
|
|
72
|
+
const result = await read(source, kind === 'json' ? 2 * 1024 * 1024 : 32 * 1024 * 1024);
|
|
73
|
+
// 对资源 JSON 做语法验证,避免把错误网页作为缓存成功保存。
|
|
74
|
+
if (kind === 'json')
|
|
75
|
+
JSON.parse(new TextDecoder().decode(result.bytes));
|
|
76
|
+
if (kind === 'image' && !imageSignature(result.bytes))
|
|
77
|
+
throw new TypeError('图片资源内容无效');
|
|
78
|
+
return register(source, contentType, result.bytes);
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
model(source) {
|
|
82
|
+
resourceType(source, 'json');
|
|
83
|
+
return once(source, async () => {
|
|
84
|
+
const result = await read(source, 2 * 1024 * 1024);
|
|
85
|
+
const value = JSON.parse(new TextDecoder().decode(result.bytes));
|
|
86
|
+
const rewritten = await rewriteAssistantAvatarModel(value, result.url, context);
|
|
87
|
+
// l2d 通过字符串拼接目录,因此依赖引用须是同目录的相对入口,而非绝对 URL。
|
|
88
|
+
const bytes = new TextEncoder().encode(JSON.stringify(rewritten));
|
|
89
|
+
return register(source, 'application/json', bytes);
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
const install = async (asset) => {
|
|
94
|
+
const adapter = adapters.find((item) => item.supports(asset.renderer));
|
|
95
|
+
if (adapter === undefined)
|
|
96
|
+
throw new TypeError(`此渲染器尚无本地素材安装适配器:${asset.renderer}`);
|
|
97
|
+
return adapter.install(asset, context);
|
|
98
|
+
};
|
|
99
|
+
try {
|
|
100
|
+
// 顺序收集展示位置,共用去重表,不重复下载同一个模型或贴图。
|
|
101
|
+
const base = await install(model);
|
|
102
|
+
const surfaces = model.surfaces === undefined ? undefined : Object.fromEntries(await Promise.all(Object.entries(model.surfaces).map(async ([surface, asset]) => [surface, await install(asset)])));
|
|
103
|
+
await Promise.all(pending.values());
|
|
104
|
+
cancellation.throwIfAborted();
|
|
105
|
+
const result = { id: model.id, name: model.name, ...base, package: model.package, ...(surfaces === undefined ? {} : { surfaces }) };
|
|
106
|
+
const id = digest(JSON.stringify([result, materials.map((file) => [file.key, digest(file.bytes)]).sort(([a], [b]) => a.localeCompare(b))]));
|
|
107
|
+
const local = JSON.parse(JSON.stringify(result).replaceAll(`pack=${marker}`, `pack=${id}`));
|
|
108
|
+
const completed = materials.map((file) => file.contentType !== 'application/json' ? file : { ...file,
|
|
109
|
+
bytes: new TextEncoder().encode(new TextDecoder().decode(file.bytes).replaceAll(`pack=${marker}`, `pack=${id}`)) });
|
|
110
|
+
return { id, model: copyAssistantAvatarModel({ ...local, package: { ...local.package, adapterId: local.package?.adapterId ?? 'codingns-pack', installationId: id } }), materials: completed };
|
|
111
|
+
}
|
|
112
|
+
catch (error) {
|
|
113
|
+
// 一项失败后取消其余并发下载,再等待它们退出,避免孤立请求跨越安装生命周期。
|
|
114
|
+
lifetime.abort();
|
|
115
|
+
await Promise.allSettled(pending.values());
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Cubism 2/3 的所有文件引用统一走安装上下文,其余布局、参数和扩展数据原样保留。 */
|
|
120
|
+
export async function rewriteAssistantAvatarModel(value, source, context) {
|
|
121
|
+
if (!record(value))
|
|
122
|
+
throw new TypeError('Live2D 模型清单无效');
|
|
123
|
+
const cubism3 = value.FileReferences !== undefined;
|
|
124
|
+
if (cubism3 && (value.Version !== 3 || !record(value.FileReferences)))
|
|
125
|
+
throw new TypeError('Live2D 模型版本无效');
|
|
126
|
+
const refs = { ...(cubism3 ? value.FileReferences : value) };
|
|
127
|
+
const field = async (input, kind) => {
|
|
128
|
+
const local = await context.file(resolveAssistantAvatarSource(input, source), kind);
|
|
129
|
+
return local.slice(local.lastIndexOf('/') + 1);
|
|
130
|
+
};
|
|
131
|
+
const mocKey = cubism3 ? 'Moc' : 'model';
|
|
132
|
+
const textureKey = cubism3 ? 'Textures' : 'textures';
|
|
133
|
+
const textures = refs[textureKey];
|
|
134
|
+
if (!Array.isArray(textures) || textures.length === 0 || textures.length > 32)
|
|
135
|
+
throw new TypeError('Live2D 模型贴图无效');
|
|
136
|
+
refs[mocKey] = await field(refs[mocKey], 'binary');
|
|
137
|
+
refs[textureKey] = await Promise.all(textures.map((url) => field(url, 'image')));
|
|
138
|
+
for (const key of cubism3 ? ['Physics', 'Pose', 'UserData', 'DisplayInfo'] : ['physics', 'pose']) {
|
|
139
|
+
if (refs[key] !== undefined && refs[key] !== '')
|
|
140
|
+
refs[key] = await field(refs[key], 'json');
|
|
141
|
+
}
|
|
142
|
+
const rewriteEntries = async (entries) => {
|
|
143
|
+
if (!Array.isArray(entries) || entries.length > 256)
|
|
144
|
+
throw new TypeError('Live2D 动作或表情列表无效');
|
|
145
|
+
return Promise.all(entries.map(async (entry) => {
|
|
146
|
+
if (!record(entry))
|
|
147
|
+
throw new TypeError('Live2D 动作或表情无效');
|
|
148
|
+
const key = cubism3 ? 'File' : 'file';
|
|
149
|
+
const result = { ...entry, [key]: await field(entry[key], cubism3 || new URL(resolveAssistantAvatarSource(entry[key], source)).pathname.endsWith('.json') ? 'json' : 'motion') };
|
|
150
|
+
const sound = cubism3 ? 'Sound' : 'sound';
|
|
151
|
+
if (entry[sound] !== undefined && entry[sound] !== '')
|
|
152
|
+
result[sound] = await field(entry[sound], 'sound');
|
|
153
|
+
return result;
|
|
154
|
+
}));
|
|
155
|
+
};
|
|
156
|
+
const expressions = cubism3 ? 'Expressions' : 'expressions';
|
|
157
|
+
if (refs[expressions] !== undefined)
|
|
158
|
+
refs[expressions] = await rewriteEntries(refs[expressions]);
|
|
159
|
+
const motionsKey = cubism3 ? 'Motions' : 'motions';
|
|
160
|
+
if (refs[motionsKey] !== undefined) {
|
|
161
|
+
if (!record(refs[motionsKey]))
|
|
162
|
+
throw new TypeError('Live2D 动作映射无效');
|
|
163
|
+
refs[motionsKey] = Object.fromEntries(await Promise.all(Object.entries(refs[motionsKey]).map(async ([group, entries]) => [group, await rewriteEntries(entries)])));
|
|
164
|
+
}
|
|
165
|
+
return cubism3 ? { ...value, FileReferences: refs } : refs;
|
|
166
|
+
}
|
|
167
|
+
function record(value) { return value !== null && typeof value === 'object' && !Array.isArray(value); }
|
|
168
|
+
function resourceType(source, kind) {
|
|
169
|
+
const ext = new URL(source).pathname.split('.').pop()?.toLowerCase();
|
|
170
|
+
const types = kind === 'image' ? { png: 'image/png', webp: 'image/webp', jpg: 'image/jpeg', jpeg: 'image/jpeg', gif: 'image/gif' }
|
|
171
|
+
: kind === 'json' ? { json: 'application/json' } : kind === 'binary' ? { moc: 'application/octet-stream', moc3: 'application/octet-stream' }
|
|
172
|
+
: kind === 'motion' ? { mtn: 'application/octet-stream' } : { wav: 'audio/wav', mp3: 'audio/mpeg', ogg: 'audio/ogg' };
|
|
173
|
+
const type = ext === undefined ? undefined : types[ext];
|
|
174
|
+
if (type === undefined)
|
|
175
|
+
throw new TypeError('形象资源类型不受支持,请提供 JSON、模型、图片或音频文件地址');
|
|
176
|
+
return type;
|
|
177
|
+
}
|
|
178
|
+
function imageSignature(bytes) {
|
|
179
|
+
const head = new TextDecoder().decode(bytes.slice(0, 12));
|
|
180
|
+
return (bytes[0] === 137 && head.slice(1, 4) === 'PNG') || head.startsWith('GIF8')
|
|
181
|
+
|| (head.startsWith('RIFF') && head.slice(8, 12) === 'WEBP') || (bytes[0] === 255 && bytes[1] === 216 && bytes[2] === 255);
|
|
182
|
+
}
|
|
183
|
+
//# sourceMappingURL=materials.js.map
|