@jingyi0605/codingns4dsh 0.2.0-beta.2 → 0.2.0-rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +4 -4
- package/README.md +18 -7
- package/assets/provider-icons/antigravity.svg +39 -0
- package/assets/provider-icons/codebuddy.svg +37 -0
- package/assets/provider-icons/cursor-cli.svg +1 -0
- package/assets/provider-icons/kiro-cli.svg +11 -0
- package/assets/provider-icons/minimax-code.svg +4 -0
- package/assets/provider-icons/qoder-cn.svg +5 -0
- package/assets/provider-icons/qoder.svg +5 -0
- package/assets/provider-icons/workbuddy.svg +29 -0
- package/assets/provider-icons/zcode.svg +14 -0
- package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.d.ts.map +1 -1
- package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.js +78 -1
- package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.js.map +1 -1
- package/data/build/dist/client/account-bar.d.ts +2 -1
- package/data/build/dist/client/account-bar.d.ts.map +1 -1
- package/data/build/dist/client/account-bar.js +21 -16
- package/data/build/dist/client/account-bar.js.map +1 -1
- package/data/build/dist/client/bundle.js +8147 -2158
- package/data/build/dist/client/bundle.js.map +1 -1
- package/data/build/dist/client/cli-catalog.d.ts +1 -1
- package/data/build/dist/client/cli-catalog.d.ts.map +1 -1
- package/data/build/dist/client/cli-catalog.js +11 -5
- 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 +127 -21
- package/data/build/dist/client/cli-slots.js.map +1 -1
- package/data/build/dist/client/debug/ui.d.ts +2 -1
- package/data/build/dist/client/debug/ui.d.ts.map +1 -1
- package/data/build/dist/client/debug/ui.js +41 -34
- package/data/build/dist/client/debug/ui.js.map +1 -1
- package/data/build/dist/client/delegate-command.d.ts +17 -0
- package/data/build/dist/client/delegate-command.d.ts.map +1 -0
- package/data/build/dist/client/delegate-command.js +597 -0
- package/data/build/dist/client/delegate-command.js.map +1 -0
- package/data/build/dist/client/delegate-plan.d.ts +40 -0
- package/data/build/dist/client/delegate-plan.d.ts.map +1 -0
- package/data/build/dist/client/delegate-plan.js +63 -0
- package/data/build/dist/client/delegate-plan.js.map +1 -0
- package/data/build/dist/client/delegate-ui-dom.d.ts +86 -0
- package/data/build/dist/client/delegate-ui-dom.d.ts.map +1 -0
- package/data/build/dist/client/delegate-ui-dom.js +647 -0
- package/data/build/dist/client/delegate-ui-dom.js.map +1 -0
- package/data/build/dist/client/external-tool-stream.d.ts.map +1 -1
- package/data/build/dist/client/external-tool-stream.js +44 -36
- package/data/build/dist/client/external-tool-stream.js.map +1 -1
- package/data/build/dist/client/features/cli-adapters.d.ts +7 -2
- package/data/build/dist/client/features/cli-adapters.d.ts.map +1 -1
- package/data/build/dist/client/features/cli-adapters.js +153 -95
- package/data/build/dist/client/features/cli-adapters.js.map +1 -1
- package/data/build/dist/client/features/debug.d.ts.map +1 -1
- package/data/build/dist/client/features/debug.js +5 -3
- package/data/build/dist/client/features/debug.js.map +1 -1
- package/data/build/dist/client/features/file-management.d.ts.map +1 -1
- package/data/build/dist/client/features/file-management.js +7 -4
- package/data/build/dist/client/features/file-management.js.map +1 -1
- package/data/build/dist/client/features/lan-access-panel.js +10 -10
- package/data/build/dist/client/features/lan-access-panel.js.map +1 -1
- package/data/build/dist/client/features/lan-access.d.ts.map +1 -1
- package/data/build/dist/client/features/lan-access.js +8 -3
- package/data/build/dist/client/features/lan-access.js.map +1 -1
- package/data/build/dist/client/features/login-protection-panel.d.ts.map +1 -1
- package/data/build/dist/client/features/login-protection-panel.js +9 -7
- package/data/build/dist/client/features/login-protection-panel.js.map +1 -1
- package/data/build/dist/client/features/login-protection.js +2 -2
- package/data/build/dist/client/features/login-protection.js.map +1 -1
- package/data/build/dist/client/features/mobile-access-panel.d.ts.map +1 -1
- package/data/build/dist/client/features/mobile-access-panel.js +8 -7
- package/data/build/dist/client/features/mobile-access-panel.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 +6 -2
- package/data/build/dist/client/features/mobile-access.js.map +1 -1
- package/data/build/dist/client/features/peer-host.d.ts +6 -4
- package/data/build/dist/client/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/client/features/peer-host.js +459 -27
- package/data/build/dist/client/features/peer-host.js.map +1 -1
- package/data/build/dist/client/features/reverse-proxy.js +2 -2
- package/data/build/dist/client/features/reverse-proxy.js.map +1 -1
- package/data/build/dist/client/features/terminal-enhancement.js +2 -2
- package/data/build/dist/client/features/terminal-enhancement.js.map +1 -1
- package/data/build/dist/client/features/workspace-session-enhancement-panel.js +1 -1
- package/data/build/dist/client/features/workspace-session-enhancement-panel.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 +8 -3
- package/data/build/dist/client/features/workspace-session-enhancement.js.map +1 -1
- package/data/build/dist/client/file-management-dom.d.ts +3 -0
- package/data/build/dist/client/file-management-dom.d.ts.map +1 -1
- package/data/build/dist/client/file-management-dom.js +41 -30
- package/data/build/dist/client/file-management-dom.js.map +1 -1
- package/data/build/dist/client/git-history-graph.d.ts +2 -2
- package/data/build/dist/client/git-history-graph.d.ts.map +1 -1
- package/data/build/dist/client/git-history-graph.js +2 -2
- package/data/build/dist/client/git-history-graph.js.map +1 -1
- package/data/build/dist/client/git-management.d.ts +2 -0
- package/data/build/dist/client/git-management.d.ts.map +1 -1
- package/data/build/dist/client/git-management.js +103 -75
- package/data/build/dist/client/git-management.js.map +1 -1
- package/data/build/dist/client/git-workspace-events.d.ts +7 -0
- package/data/build/dist/client/git-workspace-events.d.ts.map +1 -0
- package/data/build/dist/client/git-workspace-events.js +32 -0
- package/data/build/dist/client/git-workspace-events.js.map +1 -0
- package/data/build/dist/client/index.d.ts +2 -0
- package/data/build/dist/client/index.d.ts.map +1 -1
- package/data/build/dist/client/index.js +6 -5
- package/data/build/dist/client/index.js.map +1 -1
- package/data/build/dist/client/locale.d.ts +7 -0
- package/data/build/dist/client/locale.d.ts.map +1 -1
- package/data/build/dist/client/locale.js +140 -42
- package/data/build/dist/client/locale.js.map +1 -1
- package/data/build/dist/client/locales/debug.d.ts +9 -0
- package/data/build/dist/client/locales/debug.d.ts.map +1 -0
- package/data/build/dist/client/locales/debug.js +163 -0
- package/data/build/dist/client/locales/debug.js.map +1 -0
- package/data/build/dist/client/locales/fileWorkspace.d.ts +9 -0
- package/data/build/dist/client/locales/fileWorkspace.d.ts.map +1 -0
- package/data/build/dist/client/locales/fileWorkspace.js +139 -0
- package/data/build/dist/client/locales/fileWorkspace.js.map +1 -0
- package/data/build/dist/client/locales/git.d.ts +9 -0
- package/data/build/dist/client/locales/git.d.ts.map +1 -0
- package/data/build/dist/client/locales/git.js +223 -0
- package/data/build/dist/client/locales/git.js.map +1 -0
- package/data/build/dist/client/locales/panels.d.ts +9 -0
- package/data/build/dist/client/locales/panels.d.ts.map +1 -0
- package/data/build/dist/client/locales/panels.js +33 -0
- package/data/build/dist/client/locales/panels.js.map +1 -0
- package/data/build/dist/client/locales/peerHost.d.ts +9 -0
- package/data/build/dist/client/locales/peerHost.d.ts.map +1 -0
- package/data/build/dist/client/locales/peerHost.js +153 -0
- package/data/build/dist/client/locales/peerHost.js.map +1 -0
- package/data/build/dist/client/locales/peerHostWorkspace.d.ts +9 -0
- package/data/build/dist/client/locales/peerHostWorkspace.d.ts.map +1 -0
- package/data/build/dist/client/locales/peerHostWorkspace.js +69 -0
- package/data/build/dist/client/locales/peerHostWorkspace.js.map +1 -0
- package/data/build/dist/client/locales/terminalAuth.d.ts +9 -0
- package/data/build/dist/client/locales/terminalAuth.d.ts.map +1 -0
- package/data/build/dist/client/locales/terminalAuth.js +71 -0
- package/data/build/dist/client/locales/terminalAuth.js.map +1 -0
- package/data/build/dist/client/locales/usage.d.ts +9 -0
- package/data/build/dist/client/locales/usage.d.ts.map +1 -0
- package/data/build/dist/client/locales/usage.js +215 -0
- package/data/build/dist/client/locales/usage.js.map +1 -0
- package/data/build/dist/client/mobile-session-interaction.d.ts +44 -0
- package/data/build/dist/client/mobile-session-interaction.d.ts.map +1 -0
- package/data/build/dist/client/mobile-session-interaction.js +308 -0
- package/data/build/dist/client/mobile-session-interaction.js.map +1 -0
- package/data/build/dist/client/mobile-sidebar-gestures.d.ts +55 -7
- package/data/build/dist/client/mobile-sidebar-gestures.d.ts.map +1 -1
- package/data/build/dist/client/mobile-sidebar-gestures.js +339 -40
- package/data/build/dist/client/mobile-sidebar-gestures.js.map +1 -1
- package/data/build/dist/client/mobile-sidebar-rail-dom.d.ts +10 -2
- package/data/build/dist/client/mobile-sidebar-rail-dom.d.ts.map +1 -1
- package/data/build/dist/client/mobile-sidebar-rail-dom.js +14 -6
- package/data/build/dist/client/mobile-sidebar-rail-dom.js.map +1 -1
- package/data/build/dist/client/model-catalog-cache.d.ts +5 -0
- package/data/build/dist/client/model-catalog-cache.d.ts.map +1 -0
- package/data/build/dist/client/model-catalog-cache.js +58 -0
- package/data/build/dist/client/model-catalog-cache.js.map +1 -0
- package/data/build/dist/client/peer-host-aggregate-refresh.d.ts +7 -0
- package/data/build/dist/client/peer-host-aggregate-refresh.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-aggregate-refresh.js +13 -1
- package/data/build/dist/client/peer-host-aggregate-refresh.js.map +1 -1
- package/data/build/dist/client/peer-host-connection-button.d.ts +14 -1
- package/data/build/dist/client/peer-host-connection-button.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-connection-button.js +12 -4
- package/data/build/dist/client/peer-host-connection-button.js.map +1 -1
- package/data/build/dist/client/peer-host-management-panel.d.ts +3 -0
- package/data/build/dist/client/peer-host-management-panel.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-management-panel.js +83 -79
- package/data/build/dist/client/peer-host-management-panel.js.map +1 -1
- package/data/build/dist/client/peer-host-native-projection.d.ts +17 -1
- package/data/build/dist/client/peer-host-native-projection.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-native-projection.js +54 -8
- package/data/build/dist/client/peer-host-native-projection.js.map +1 -1
- package/data/build/dist/client/peer-host-native-store-projection.d.ts +6 -2
- package/data/build/dist/client/peer-host-native-store-projection.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-native-store-projection.js +308 -10
- package/data/build/dist/client/peer-host-native-store-projection.js.map +1 -1
- package/data/build/dist/client/peer-host-scoped-client.js +5 -5
- package/data/build/dist/client/peer-host-scoped-client.js.map +1 -1
- package/data/build/dist/client/peer-host-workspace-tab.d.ts +8 -0
- package/data/build/dist/client/peer-host-workspace-tab.d.ts.map +1 -1
- package/data/build/dist/client/peer-host-workspace-tab.js +48 -28
- package/data/build/dist/client/peer-host-workspace-tab.js.map +1 -1
- package/data/build/dist/client/provider-icon-assets.js +18 -0
- package/data/build/dist/client/provider-icon-assets.js.map +1 -1
- package/data/build/dist/client/provider-icons.d.ts +8 -2
- package/data/build/dist/client/provider-icons.d.ts.map +1 -1
- package/data/build/dist/client/provider-icons.js +28 -7
- package/data/build/dist/client/provider-icons.js.map +1 -1
- package/data/build/dist/client/pwa-install-prompt.d.ts +4 -1
- package/data/build/dist/client/pwa-install-prompt.d.ts.map +1 -1
- package/data/build/dist/client/pwa-install-prompt.js +8 -7
- package/data/build/dist/client/pwa-install-prompt.js.map +1 -1
- package/data/build/dist/client/quick-phrase-layout.d.ts +11 -0
- package/data/build/dist/client/quick-phrase-layout.d.ts.map +1 -1
- package/data/build/dist/client/quick-phrase-layout.js +20 -0
- package/data/build/dist/client/quick-phrase-layout.js.map +1 -1
- package/data/build/dist/client/quick-phrase-slot.d.ts.map +1 -1
- package/data/build/dist/client/quick-phrase-slot.js +20 -8
- package/data/build/dist/client/quick-phrase-slot.js.map +1 -1
- package/data/build/dist/client/remote-web-context.js +10 -6
- package/data/build/dist/client/remote-web-context.js.map +1 -1
- package/data/build/dist/client/service-tier.d.ts +54 -0
- package/data/build/dist/client/service-tier.d.ts.map +1 -0
- package/data/build/dist/client/service-tier.js +78 -0
- package/data/build/dist/client/service-tier.js.map +1 -0
- package/data/build/dist/client/session-changed-files-view.d.ts +8 -1
- package/data/build/dist/client/session-changed-files-view.d.ts.map +1 -1
- package/data/build/dist/client/session-changed-files-view.js +71 -28
- package/data/build/dist/client/session-changed-files-view.js.map +1 -1
- package/data/build/dist/client/settings-anchor.d.ts +9 -3
- package/data/build/dist/client/settings-anchor.d.ts.map +1 -1
- package/data/build/dist/client/settings-anchor.js +8 -2
- package/data/build/dist/client/settings-anchor.js.map +1 -1
- package/data/build/dist/client/settings-promo-styles.d.ts +28 -0
- package/data/build/dist/client/settings-promo-styles.d.ts.map +1 -0
- package/data/build/dist/client/settings-promo-styles.js +58 -0
- package/data/build/dist/client/settings-promo-styles.js.map +1 -0
- package/data/build/dist/client/settings-promo.d.ts +14 -0
- package/data/build/dist/client/settings-promo.d.ts.map +1 -0
- package/data/build/dist/client/settings-promo.js +68 -0
- package/data/build/dist/client/settings-promo.js.map +1 -0
- package/data/build/dist/client/settings-section.d.ts +2 -1
- package/data/build/dist/client/settings-section.d.ts.map +1 -1
- package/data/build/dist/client/settings-section.js +10 -7
- package/data/build/dist/client/settings-section.js.map +1 -1
- package/data/build/dist/client/subscription-slot.d.ts +4 -1
- package/data/build/dist/client/subscription-slot.d.ts.map +1 -1
- package/data/build/dist/client/subscription-slot.js +497 -56
- package/data/build/dist/client/subscription-slot.js.map +1 -1
- package/data/build/dist/client/terminal/model.d.ts +94 -4
- package/data/build/dist/client/terminal/model.d.ts.map +1 -1
- package/data/build/dist/client/terminal/model.js +392 -33
- package/data/build/dist/client/terminal/model.js.map +1 -1
- package/data/build/dist/client/terminal/recovery.d.ts +16 -1
- package/data/build/dist/client/terminal/recovery.d.ts.map +1 -1
- package/data/build/dist/client/terminal/recovery.js +101 -39
- package/data/build/dist/client/terminal/recovery.js.map +1 -1
- package/data/build/dist/client/terminal/styles.d.ts +10 -0
- package/data/build/dist/client/terminal/styles.d.ts.map +1 -1
- package/data/build/dist/client/terminal/styles.js +27 -3
- package/data/build/dist/client/terminal/styles.js.map +1 -1
- package/data/build/dist/client/terminal/ui.d.ts +3 -2
- package/data/build/dist/client/terminal/ui.d.ts.map +1 -1
- package/data/build/dist/client/terminal/ui.js +216 -103
- package/data/build/dist/client/terminal/ui.js.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.d.ts +8 -1
- package/data/build/dist/client/terminal/xterm-view.d.ts.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.js +394 -34
- package/data/build/dist/client/terminal/xterm-view.js.map +1 -1
- package/data/build/dist/client/workspace-session-archive-dom.d.ts +3 -0
- package/data/build/dist/client/workspace-session-archive-dom.d.ts.map +1 -1
- package/data/build/dist/client/workspace-session-archive-dom.js +131 -45
- package/data/build/dist/client/workspace-session-archive-dom.js.map +1 -1
- package/data/build/dist/client/workspace-session-logo-dom.d.ts +3 -0
- package/data/build/dist/client/workspace-session-logo-dom.d.ts.map +1 -1
- package/data/build/dist/client/workspace-session-logo-dom.js +3 -1
- package/data/build/dist/client/workspace-session-logo-dom.js.map +1 -1
- package/data/build/dist/client/workspace-session-visibility-dom.d.ts +3 -0
- package/data/build/dist/client/workspace-session-visibility-dom.d.ts.map +1 -1
- package/data/build/dist/client/workspace-session-visibility-dom.js +46 -17
- package/data/build/dist/client/workspace-session-visibility-dom.js.map +1 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts +10 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js +20 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js.map +1 -1
- package/data/build/dist/host/browser-text.d.ts +30 -0
- package/data/build/dist/host/browser-text.d.ts.map +1 -0
- package/data/build/dist/host/browser-text.js +105 -0
- package/data/build/dist/host/browser-text.js.map +1 -0
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts +58 -0
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js +271 -0
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/antigravity-driver.d.ts +30 -0
- package/data/build/dist/host/cli-adapters/antigravity-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/antigravity-driver.js +210 -0
- package/data/build/dist/host/cli-adapters/antigravity-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts +28 -2
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.js +74 -4
- package/data/build/dist/host/cli-adapters/claude-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-model-options.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-model-options.js +22 -9
- package/data/build/dist/host/cli-adapters/claude-model-options.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codebuddy-driver.d.ts +139 -0
- package/data/build/dist/host/cli-adapters/codebuddy-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/codebuddy-driver.js +1721 -0
- package/data/build/dist/host/cli-adapters/codebuddy-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/codebuddy-subscription.d.ts +53 -0
- package/data/build/dist/host/cli-adapters/codebuddy-subscription.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/codebuddy-subscription.js +778 -0
- package/data/build/dist/host/cli-adapters/codebuddy-subscription.js.map +1 -0
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts +22 -0
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.js +254 -7
- 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 +43 -3
- 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 +681 -74
- package/data/build/dist/host/cli-adapters/command-code-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-history.d.ts +147 -0
- package/data/build/dist/host/cli-adapters/command-code-history.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/command-code-history.js +659 -0
- package/data/build/dist/host/cli-adapters/command-code-history.js.map +1 -0
- package/data/build/dist/host/cli-adapters/cursor-driver.d.ts +12 -0
- package/data/build/dist/host/cli-adapters/cursor-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/cursor-driver.js +20 -0
- package/data/build/dist/host/cli-adapters/cursor-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/custom-upstream-classifier.d.ts +67 -0
- package/data/build/dist/host/cli-adapters/custom-upstream-classifier.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/custom-upstream-classifier.js +169 -0
- package/data/build/dist/host/cli-adapters/custom-upstream-classifier.js.map +1 -0
- package/data/build/dist/host/cli-adapters/delegate-dispatch.d.ts +48 -0
- package/data/build/dist/host/cli-adapters/delegate-dispatch.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/delegate-dispatch.js +111 -0
- package/data/build/dist/host/cli-adapters/delegate-dispatch.js.map +1 -0
- package/data/build/dist/host/cli-adapters/delegation-authorization.d.ts +19 -0
- package/data/build/dist/host/cli-adapters/delegation-authorization.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/delegation-authorization.js +49 -0
- package/data/build/dist/host/cli-adapters/delegation-authorization.js.map +1 -0
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.d.ts +34 -0
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.js +121 -0
- package/data/build/dist/host/cli-adapters/delegation-mention-rewrite.js.map +1 -0
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.d.ts +32 -0
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.js +121 -0
- package/data/build/dist/host/cli-adapters/desktop-app-runtime.js.map +1 -0
- package/data/build/dist/host/cli-adapters/driver.d.ts +6 -0
- package/data/build/dist/host/cli-adapters/driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-message-projector.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js +5 -4
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js.map +1 -1
- package/data/build/dist/host/cli-adapters/dsh-virtual-providers.d.ts +16 -0
- package/data/build/dist/host/cli-adapters/dsh-virtual-providers.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/dsh-virtual-providers.js +73 -0
- package/data/build/dist/host/cli-adapters/dsh-virtual-providers.js.map +1 -0
- package/data/build/dist/host/cli-adapters/feature.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.js +459 -26
- package/data/build/dist/host/cli-adapters/feature.js.map +1 -1
- package/data/build/dist/host/cli-adapters/gemini-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/gemini-driver.js +21 -5
- package/data/build/dist/host/cli-adapters/gemini-driver.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 +24 -7
- package/data/build/dist/host/cli-adapters/grok-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts +22 -6
- package/data/build/dist/host/cli-adapters/json-rpc-process.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/json-rpc-process.js +118 -21
- package/data/build/dist/host/cli-adapters/json-rpc-process.js.map +1 -1
- package/data/build/dist/host/cli-adapters/kimi-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/kimi-driver.js +25 -4
- package/data/build/dist/host/cli-adapters/kimi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/kiro-driver.d.ts +12 -0
- package/data/build/dist/host/cli-adapters/kiro-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/kiro-driver.js +18 -0
- package/data/build/dist/host/cli-adapters/kiro-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.d.ts +11 -2
- 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 +26 -6
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.js.map +1 -1
- package/data/build/dist/host/cli-adapters/mcode-catalog.d.ts +23 -0
- package/data/build/dist/host/cli-adapters/mcode-catalog.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/mcode-catalog.js +120 -0
- package/data/build/dist/host/cli-adapters/mcode-catalog.js.map +1 -0
- package/data/build/dist/host/cli-adapters/mcode-driver.d.ts +56 -0
- package/data/build/dist/host/cli-adapters/mcode-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/mcode-driver.js +544 -0
- package/data/build/dist/host/cli-adapters/mcode-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts +35 -5
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/model-catalog.js +213 -8
- package/data/build/dist/host/cli-adapters/model-catalog.js.map +1 -1
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.d.ts +81 -0
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.js +299 -0
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.js.map +1 -0
- package/data/build/dist/host/cli-adapters/native-subagent-holder.d.ts +4 -0
- package/data/build/dist/host/cli-adapters/native-subagent-holder.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/native-subagent-holder.js +4 -0
- package/data/build/dist/host/cli-adapters/native-subagent-holder.js.map +1 -0
- package/data/build/dist/host/cli-adapters/native-team-proxy.js +18 -15
- package/data/build/dist/host/cli-adapters/native-team-proxy.js.map +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.d.ts +57 -0
- package/data/build/dist/host/cli-adapters/native-team-subagent.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/native-team-subagent.js +126 -0
- package/data/build/dist/host/cli-adapters/native-team-subagent.js.map +1 -0
- package/data/build/dist/host/cli-adapters/new-api-subscription.d.ts +75 -0
- package/data/build/dist/host/cli-adapters/new-api-subscription.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/new-api-subscription.js +959 -0
- package/data/build/dist/host/cli-adapters/new-api-subscription.js.map +1 -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 +22 -10
- package/data/build/dist/host/cli-adapters/opencode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/pi-driver.js +24 -7
- package/data/build/dist/host/cli-adapters/pi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +41 -4
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.js +254 -40
- package/data/build/dist/host/cli-adapters/provider-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-driver.d.ts +71 -0
- package/data/build/dist/host/cli-adapters/qoder-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/qoder-driver.js +553 -0
- package/data/build/dist/host/cli-adapters/qoder-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/qoder-subscription.d.ts +31 -0
- package/data/build/dist/host/cli-adapters/qoder-subscription.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/qoder-subscription.js +178 -0
- package/data/build/dist/host/cli-adapters/qoder-subscription.js.map +1 -0
- package/data/build/dist/host/cli-adapters/registry-holder.d.ts +4 -0
- package/data/build/dist/host/cli-adapters/registry-holder.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/registry-holder.js +9 -0
- package/data/build/dist/host/cli-adapters/registry-holder.js.map +1 -0
- package/data/build/dist/host/cli-adapters/registry.d.ts +54 -2
- package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.js +224 -18
- package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
- package/data/build/dist/host/cli-adapters/session-store.d.ts +10 -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 +60 -6
- 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 +16 -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 +150 -26
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts +10 -1
- package/data/build/dist/host/cli-adapters/stream-normalizer.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/stream-normalizer.js +23 -0
- package/data/build/dist/host/cli-adapters/stream-normalizer.js.map +1 -1
- package/data/build/dist/host/cli-adapters/subagent-tool.d.ts +5 -0
- package/data/build/dist/host/cli-adapters/subagent-tool.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/subagent-tool.js +112 -0
- package/data/build/dist/host/cli-adapters/subagent-tool.js.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-driver.d.ts +57 -0
- package/data/build/dist/host/cli-adapters/zcode-driver.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-driver.js +843 -0
- package/data/build/dist/host/cli-adapters/zcode-driver.js.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-subscription.d.ts +28 -0
- package/data/build/dist/host/cli-adapters/zcode-subscription.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/zcode-subscription.js +212 -0
- package/data/build/dist/host/cli-adapters/zcode-subscription.js.map +1 -0
- package/data/build/dist/host/cli-bridge/bridge-holder.d.ts +27 -0
- package/data/build/dist/host/cli-bridge/bridge-holder.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/bridge-holder.js +51 -0
- package/data/build/dist/host/cli-bridge/bridge-holder.js.map +1 -0
- package/data/build/dist/host/cli-bridge/bridge-server.d.ts +39 -0
- package/data/build/dist/host/cli-bridge/bridge-server.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/bridge-server.js +140 -0
- package/data/build/dist/host/cli-bridge/bridge-server.js.map +1 -0
- package/data/build/dist/host/cli-bridge/command-code-mod.d.ts +29 -0
- package/data/build/dist/host/cli-bridge/command-code-mod.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/command-code-mod.js +91 -0
- package/data/build/dist/host/cli-bridge/command-code-mod.js.map +1 -0
- package/data/build/dist/host/cli-bridge/dispatch.d.ts +19 -0
- package/data/build/dist/host/cli-bridge/dispatch.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/dispatch.js +128 -0
- package/data/build/dist/host/cli-bridge/dispatch.js.map +1 -0
- package/data/build/dist/host/cli-bridge/injections.d.ts +28 -0
- package/data/build/dist/host/cli-bridge/injections.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/injections.js +131 -0
- package/data/build/dist/host/cli-bridge/injections.js.map +1 -0
- package/data/build/dist/host/cli-bridge/mcp-stdio-entry.d.ts +8 -0
- package/data/build/dist/host/cli-bridge/mcp-stdio-entry.d.ts.map +1 -0
- package/data/build/dist/host/cli-bridge/mcp-stdio-entry.js +170 -0
- package/data/build/dist/host/cli-bridge/mcp-stdio-entry.js.map +1 -0
- package/data/build/dist/host/features/lan-access-dsh.d.ts.map +1 -1
- package/data/build/dist/host/features/lan-access-dsh.js +6 -2
- package/data/build/dist/host/features/lan-access-dsh.js.map +1 -1
- package/data/build/dist/host/features/peer-host.d.ts +21 -1
- package/data/build/dist/host/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/host/features/peer-host.js +176 -31
- package/data/build/dist/host/features/peer-host.js.map +1 -1
- package/data/build/dist/host/features/types.d.ts +2 -0
- package/data/build/dist/host/features/types.d.ts.map +1 -1
- package/data/build/dist/host/index.d.ts +15 -1
- package/data/build/dist/host/index.d.ts.map +1 -1
- package/data/build/dist/host/index.js +48 -2
- package/data/build/dist/host/index.js.map +1 -1
- package/data/build/dist/host/lan-access-dsh.d.ts +7 -1
- package/data/build/dist/host/lan-access-dsh.d.ts.map +1 -1
- package/data/build/dist/host/lan-access-dsh.js +95 -19
- package/data/build/dist/host/lan-access-dsh.js.map +1 -1
- package/data/build/dist/host/login-attempt-guard.d.ts +55 -0
- package/data/build/dist/host/login-attempt-guard.d.ts.map +1 -0
- package/data/build/dist/host/login-attempt-guard.js +201 -0
- package/data/build/dist/host/login-attempt-guard.js.map +1 -0
- package/data/build/dist/host/modules/peer-host/host-api-proxy-service.d.ts +3 -0
- 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 +2 -0
- 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-native-protocol.d.ts +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.js +9 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-transport.d.ts +8 -0
- package/data/build/dist/host/modules/peer-host/peer-host-native-transport.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-transport.js +9 -0
- package/data/build/dist/host/modules/peer-host/peer-host-native-transport.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.d.ts +7 -0
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js +31 -3
- 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-virtual-registry.d.ts +2 -0
- package/data/build/dist/host/modules/peer-host/peer-host-virtual-registry.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-virtual-registry.js +26 -7
- package/data/build/dist/host/modules/peer-host/peer-host-virtual-registry.js.map +1 -1
- package/data/build/dist/host/modules/pwa/pwa-assets.d.ts +6 -4
- package/data/build/dist/host/modules/pwa/pwa-assets.d.ts.map +1 -1
- package/data/build/dist/host/modules/pwa/pwa-assets.js +11 -9
- package/data/build/dist/host/modules/pwa/pwa-assets.js.map +1 -1
- package/data/build/dist/host/modules/pwa/pwa-session-notifications.d.ts +3 -0
- package/data/build/dist/host/modules/pwa/pwa-session-notifications.d.ts.map +1 -1
- package/data/build/dist/host/modules/pwa/pwa-session-notifications.js +6 -4
- package/data/build/dist/host/modules/pwa/pwa-session-notifications.js.map +1 -1
- package/data/build/dist/host/native-session-bridge.d.ts.map +1 -1
- package/data/build/dist/host/native-session-bridge.js +106 -59
- package/data/build/dist/host/native-session-bridge.js.map +1 -1
- package/data/build/dist/host/rpc.js +8 -2
- package/data/build/dist/host/rpc.js.map +1 -1
- package/data/build/dist/host/settings.d.ts.map +1 -1
- package/data/build/dist/host/settings.js +14 -4
- package/data/build/dist/host/settings.js.map +1 -1
- package/data/build/dist/host/terminal/backends/local-pty-backend.d.ts.map +1 -1
- package/data/build/dist/host/terminal/backends/local-pty-backend.js +14 -0
- package/data/build/dist/host/terminal/backends/local-pty-backend.js.map +1 -1
- package/data/build/dist/host/terminal/backends/tmux-backend.d.ts +40 -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 +291 -18
- package/data/build/dist/host/terminal/backends/tmux-backend.js.map +1 -1
- package/data/build/dist/host/terminal/runtime-adapter.d.ts +32 -0
- package/data/build/dist/host/terminal/runtime-adapter.d.ts.map +1 -1
- package/data/build/dist/host/terminal/runtime-adapter.js +8 -0
- package/data/build/dist/host/terminal/runtime-adapter.js.map +1 -1
- package/data/build/dist/host/terminal/runtime-manager.d.ts +3 -0
- package/data/build/dist/host/terminal/runtime-manager.d.ts.map +1 -1
- package/data/build/dist/host/terminal/runtime-manager.js +92 -4
- package/data/build/dist/host/terminal/runtime-manager.js.map +1 -1
- package/data/build/dist/host/terminal/terminal-controller.d.ts.map +1 -1
- package/data/build/dist/host/terminal/terminal-controller.js +58 -6
- package/data/build/dist/host/terminal/terminal-controller.js.map +1 -1
- package/data/build/dist/host/terminal/terminal-process-service.d.ts.map +1 -1
- package/data/build/dist/host/terminal/terminal-process-service.js +12 -2
- package/data/build/dist/host/terminal/terminal-process-service.js.map +1 -1
- package/data/build/dist/host/terminal/terminal-service.d.ts +41 -4
- package/data/build/dist/host/terminal/terminal-service.d.ts.map +1 -1
- package/data/build/dist/host/terminal/terminal-service.js +551 -61
- package/data/build/dist/host/terminal/terminal-service.js.map +1 -1
- package/data/build/dist/index.d.ts +2 -2
- package/data/build/dist/index.d.ts.map +1 -1
- package/data/build/dist/index.js +2 -2
- package/data/build/dist/index.js.map +1 -1
- package/data/build/dist/shared/contracts/cli-adapter.d.ts +69 -2
- package/data/build/dist/shared/contracts/cli-adapter.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.d.ts +63 -10
- package/data/build/dist/shared/contracts/config.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.js +57 -5
- package/data/build/dist/shared/contracts/config.js.map +1 -1
- package/data/build/dist/shared/contracts/peer-host.d.ts +2 -0
- package/data/build/dist/shared/contracts/peer-host.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/peer-host.js.map +1 -1
- package/data/build/dist/shared/contracts/subscription.d.ts +20 -1
- package/data/build/dist/shared/contracts/subscription.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/subscription.js.map +1 -1
- package/data/build/dist/shared/contracts/terminal.d.ts +8 -1
- package/data/build/dist/shared/contracts/terminal.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/version.d.ts +1 -1
- package/data/build/dist/shared/contracts/version.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/version.js +1 -1
- package/data/build/dist/shared/contracts/version.js.map +1 -1
- package/data/build/dist/shared/debug.d.ts +8 -0
- package/data/build/dist/shared/debug.d.ts.map +1 -1
- package/data/build/dist/shared/debug.js +43 -7
- package/data/build/dist/shared/debug.js.map +1 -1
- package/data/build/dist/shared/delegation-carrier.d.ts +24 -0
- package/data/build/dist/shared/delegation-carrier.d.ts.map +1 -0
- package/data/build/dist/shared/delegation-carrier.js +111 -0
- package/data/build/dist/shared/delegation-carrier.js.map +1 -0
- package/data/build/dist/shared/index.d.ts +3 -3
- package/data/build/dist/shared/index.d.ts.map +1 -1
- package/data/build/dist/shared/index.js +2 -2
- package/data/build/dist/shared/index.js.map +1 -1
- package/data/build/dist/shared/terminal-input.d.ts +8 -0
- package/data/build/dist/shared/terminal-input.d.ts.map +1 -0
- package/data/build/dist/shared/terminal-input.js +10 -0
- package/data/build/dist/shared/terminal-input.js.map +1 -0
- package/data/build/dist/transport/debug.d.ts +7 -0
- package/data/build/dist/transport/debug.d.ts.map +1 -1
- package/data/build/dist/transport/debug.js +33 -5
- package/data/build/dist/transport/debug.js.map +1 -1
- package/data/build/dist/transport/index.d.ts +1 -1
- package/data/build/dist/transport/index.d.ts.map +1 -1
- package/data/build/dist/transport/index.js +1 -1
- package/data/build/dist/transport/index.js.map +1 -1
- package/data/build/dist/typert.host.js +1 -1
- package/data/build/dist/typert.host.js.map +1 -1
- package/package.json +3 -1
- 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,647 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `/委派` 的界面增强(DOM 注入)。
|
|
3
|
+
*
|
|
4
|
+
* DSH 的 `/` 菜单把「添加」分类写死在 `sectionRows` 的名单里(file/goal/plan/feedback),
|
|
5
|
+
* 客户端贡献项只能落到「指令」分类;popupSelect 的 `SelectOption` 契约也没有图标字段。
|
|
6
|
+
* 这两点都无法通过公开 API 表达,因此这里按仓库既有的 DOM 注入惯例做两件事:
|
|
7
|
+
*
|
|
8
|
+
* 1. 把插件自己的委派行放进「添加」分类。真实行由 React 拥有,插件**只加属性隐藏它**,
|
|
9
|
+
* 绝不搬动它;「添加」分类末尾放一个克隆行,交互事件转发回真实行。
|
|
10
|
+
* - 不用 CSS `order` 让真实行「看起来」在添加分类里:`order` 只改视觉位置,
|
|
11
|
+
* 而菜单高亮由 store 的候选顺序(等于 DOM 顺序)驱动,两者会分叉——方向键
|
|
12
|
+
* 走到委派时高亮会突然跳到上面去。克隆行则让视觉与键盘顺序保持一致。
|
|
13
|
+
* - 绝不移动 React 拥有的节点,否则下一次协调时 React 的 insertBefore 会抛
|
|
14
|
+
* NotFoundError 打断整个菜单。
|
|
15
|
+
* - 克隆行**不能继承**隐藏标记,否则真实行和克隆行都被隐藏,委派入口整个消失;
|
|
16
|
+
* 隐藏规则本身也用 `:not()` 排除克隆行作为第二道保险。
|
|
17
|
+
* 2. 给委派弹层里的适配器行补上 Provider 图标。
|
|
18
|
+
*
|
|
19
|
+
* 依赖的 DSH 0.2.0-rc.2 契约(任何一条不成立都只是不生效,不会误改宿主界面):
|
|
20
|
+
* - `/` 菜单行是 `button[role="option"]`,id 前缀 `dsh-slash-option-`,标题在
|
|
21
|
+
* `span[class*="itemName"]`;分类标题在 `div[class*="sectionTitle"]`,「添加」恒为首个;
|
|
22
|
+
* - 委派弹层的搜索框 placeholder 由插件自己提供,行标题在 `span[class*="labelText"]`。
|
|
23
|
+
*/
|
|
24
|
+
import { providerIconUrl } from './provider-icons.js';
|
|
25
|
+
/** 被打在真实委派菜单行上的隐藏标记。 */
|
|
26
|
+
export const DELEGATE_MENU_ROW_ATTRIBUTE = 'data-codingns-delegate-row';
|
|
27
|
+
/** 插件在「添加」分类里创建的克隆行标记。 */
|
|
28
|
+
export const DELEGATE_MENU_PROXY_ATTRIBUTE = 'data-codingns-delegate-proxy';
|
|
29
|
+
/** 插件在委派弹层适配器行前插入的图标标记。 */
|
|
30
|
+
export const DELEGATE_POPUP_LOGO_ATTRIBUTE = 'data-codingns-delegate-logo';
|
|
31
|
+
/** 委派输入 chip 前插入的 Provider Logo 标记。 */
|
|
32
|
+
export const DELEGATE_CHIP_LOGO_ATTRIBUTE = 'data-codingns-delegate-chip-logo';
|
|
33
|
+
/** DSH 消息时间线中由插件投影的委派 Agent chip 标记。 */
|
|
34
|
+
export const DELEGATE_TIMELINE_CHIP_ATTRIBUTE = 'data-codingns-delegate-timeline-chip';
|
|
35
|
+
/** 时间线 chip 保存的原始 carrier,停用插件时用于恢复 React 之外的 DOM。 */
|
|
36
|
+
export const DELEGATE_TIMELINE_RAW_ATTRIBUTE = 'data-codingns-delegate-timeline-raw';
|
|
37
|
+
/** DSH 时间线中由 Host 改写消息投影的委派任务卡片标记。 */
|
|
38
|
+
export const DELEGATE_TIMELINE_CARD_ATTRIBUTE = 'data-codingns-delegation-card';
|
|
39
|
+
/** 委派卡片保存原始指令,停用插件时用于恢复 React 之外的 DOM。 */
|
|
40
|
+
export const DELEGATE_TIMELINE_CARD_RAW_ATTRIBUTE = 'data-codingns-delegation-card-raw';
|
|
41
|
+
/** DSH 空状态输入提示保存原始文案的标记。 */
|
|
42
|
+
export const DELEGATE_PLACEHOLDER_BASE_ATTRIBUTE = 'data-codingns-delegate-placeholder-base';
|
|
43
|
+
export const DELEGATE_PLACEHOLDER_MARK_ATTRIBUTE = 'data-codingns-delegate-placeholder';
|
|
44
|
+
/** 插件样式标签的幂等键。 */
|
|
45
|
+
export const DELEGATE_UI_STYLE_ID = 'codingns4dsh-delegate-ui-style';
|
|
46
|
+
const MENU_OPTION_SELECTOR = '[role="option"]';
|
|
47
|
+
const MENU_LISTBOX_SELECTOR = '[role="listbox"]';
|
|
48
|
+
const MENU_OPTION_ID_PREFIX = 'dsh-slash-option-';
|
|
49
|
+
const ITEM_NAME_SELECTOR = '[class*="itemName"]';
|
|
50
|
+
const SECTION_TITLE_SELECTOR = '[class*="sectionTitle"]';
|
|
51
|
+
const LABEL_TEXT_SELECTOR = '[class*="labelText"]';
|
|
52
|
+
const DELEGATION_INSTRUCTION_MARKER = '[CodingNS 委派指令]';
|
|
53
|
+
// 隐藏规则排除克隆行:即使克隆意外带上了标记,也不会连克隆一起隐藏。
|
|
54
|
+
const DELEGATE_UI_STYLE_TEXT = `[${DELEGATE_MENU_ROW_ATTRIBUTE}]:not([${DELEGATE_MENU_PROXY_ATTRIBUTE}]){display:none!important}`
|
|
55
|
+
+ `[${DELEGATE_MENU_PROXY_ATTRIBUTE}][data-active="true"]{background:var(--dsw-alias-interactive-bg-hover)}`
|
|
56
|
+
+ `[${DELEGATE_POPUP_LOGO_ATTRIBUTE}]{width:16px;height:16px;flex:none;object-fit:contain;border-radius:3px;margin-right:2px}`
|
|
57
|
+
+ `[${DELEGATE_CHIP_LOGO_ATTRIBUTE}]{width:14px;height:14px;flex:none;align-self:center;object-fit:contain;border-radius:3px;margin-right:2px}`
|
|
58
|
+
// ReferenceInsert 的 session 图标是通用 SVG;已有品牌 Logo 时隐藏它,避免出现双图标。
|
|
59
|
+
+ `[data-composer-chip="codingns-delegate"]:has([${DELEGATE_CHIP_LOGO_ATTRIBUTE}]) svg{display:none!important}`
|
|
60
|
+
+ `[${DELEGATE_TIMELINE_CHIP_ATTRIBUTE}]{display:inline-flex;align-items:center;vertical-align:baseline;gap:3px;padding:0 5px;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover);color:var(--dsw-alias-label-primary);white-space:nowrap;font-size:.95em;line-height:1.45}`
|
|
61
|
+
+ `[${DELEGATE_TIMELINE_CHIP_ATTRIBUTE}] img{width:14px;height:14px;flex:none;object-fit:contain;border-radius:3px}`
|
|
62
|
+
+ `[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}]{box-sizing:border-box;display:flex;flex-direction:column;align-self:stretch;width:100%;max-width:100%;min-width:0;gap:8px;margin:2px 0;padding:10px 12px;border:1px solid var(--dsw-alias-border-l2,rgba(127,127,127,.2));border-radius:10px;background:var(--dsw-alias-bg-layer-2,rgba(127,127,127,.06));line-height:1.5;overflow-wrap:anywhere}`
|
|
63
|
+
+ `[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-title]{display:flex;align-items:center;min-width:0;gap:6px;font-weight:600;overflow-wrap:anywhere}`
|
|
64
|
+
+ `[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-targets]{display:flex;flex-wrap:wrap;min-width:0;width:100%;max-width:100%;gap:5px}`
|
|
65
|
+
+ `[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-target]{box-sizing:border-box;display:inline-flex;align-items:center;flex:0 1 auto;min-width:0;max-width:100%;gap:3px;padding:1px 7px;border-radius:999px;background:var(--dsw-alias-interactive-bg-hover);font-size:.9em;white-space:normal;overflow-wrap:anywhere;word-break:break-word}`
|
|
66
|
+
+ `[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-target] img{flex:0 0 auto;width:14px;height:14px;object-fit:contain;border-radius:3px}`
|
|
67
|
+
+ `[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-target] span{min-width:0;overflow-wrap:anywhere;word-break:break-word}`
|
|
68
|
+
+ `[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-task]{box-sizing:border-box;width:100%;max-width:100%;min-width:0;white-space:pre-wrap;overflow-wrap:anywhere;word-break:break-word}`
|
|
69
|
+
+ `[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-status]{min-width:0;color:var(--dsw-alias-label-secondary,GrayText);font-size:.88em;overflow-wrap:anywhere;word-break:break-word}`
|
|
70
|
+
+ `@media (max-width:768px){[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}]{gap:6px;margin:2px 0;padding:8px 10px;border-radius:8px;font-size:.95em}[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-targets]{gap:4px}[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}] [data-codingns-delegation-card-target]{padding:2px 6px;font-size:.88em}}`;
|
|
71
|
+
/** 克隆行 → 真实行;真实行被 React 重建时据此判定需要重建克隆。 */
|
|
72
|
+
const proxySources = new WeakMap();
|
|
73
|
+
let popupOptions = [];
|
|
74
|
+
let requestRefresh;
|
|
75
|
+
/**
|
|
76
|
+
* 登记当前委派弹层的适配器选项。
|
|
77
|
+
*
|
|
78
|
+
* `/委派` 的 `options()` 每次加载后调用;图标注入据此把行标题反查回适配器 id。
|
|
79
|
+
* 行标题就是适配器显示名,因此这张表同时充当标题到 id 的映射。
|
|
80
|
+
*/
|
|
81
|
+
export function setDelegatePopupOptions(options) {
|
|
82
|
+
popupOptions = options;
|
|
83
|
+
requestRefresh?.();
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 安装 `/委派` 的界面增强。
|
|
87
|
+
*
|
|
88
|
+
* @param options - 注入点(document/观察器/本地化文案/图标表),便于单测替换。
|
|
89
|
+
* @returns 控制器;`document` 缺失时退化为空操作。
|
|
90
|
+
*/
|
|
91
|
+
export function startDelegateUiDom(options) {
|
|
92
|
+
const dom = options.document ?? (typeof document === 'undefined' ? undefined : document);
|
|
93
|
+
const Observer = options.MutationObserver
|
|
94
|
+
?? (typeof MutationObserver === 'undefined' ? undefined : MutationObserver);
|
|
95
|
+
const iconUrl = options.iconUrlForAdapter ?? providerIconUrl;
|
|
96
|
+
let disposed = false;
|
|
97
|
+
let scanQueued = false;
|
|
98
|
+
let observer;
|
|
99
|
+
const observe = () => {
|
|
100
|
+
if (disposed || dom === undefined || observer === undefined)
|
|
101
|
+
return;
|
|
102
|
+
observer.observe(dom.documentElement, {
|
|
103
|
+
childList: true,
|
|
104
|
+
subtree: true,
|
|
105
|
+
attributes: true,
|
|
106
|
+
attributeFilter: ['aria-selected'],
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
const runScan = () => {
|
|
110
|
+
if (disposed || dom === undefined)
|
|
111
|
+
return;
|
|
112
|
+
// 菜单只在存在 listbox 时扫描;输入 chip 则始终检查,因为它可能在菜单关闭后
|
|
113
|
+
// 才完成 Decorator 渲染。观察器挂在 documentElement 且带 subtree,扫描必须保持幂等。
|
|
114
|
+
const listboxes = [...dom.querySelectorAll(MENU_LISTBOX_SELECTOR)];
|
|
115
|
+
if (listboxes.length > 0) {
|
|
116
|
+
relocateMenuRow(listboxes, options.menuLabel());
|
|
117
|
+
decoratePopupRows(listboxes, options.popupPlaceholder(), iconUrl);
|
|
118
|
+
}
|
|
119
|
+
decorateReferenceChips(dom, iconUrl);
|
|
120
|
+
decorateTimelineMessages(dom, iconUrl, options);
|
|
121
|
+
decorateComposerPlaceholders(dom, options.composerPlaceholder);
|
|
122
|
+
};
|
|
123
|
+
const scan = () => {
|
|
124
|
+
if (disposed || dom === undefined)
|
|
125
|
+
return;
|
|
126
|
+
// 本函数会写克隆行的 aria-selected(把真实行高亮镜像到「添加」分类),而观察器
|
|
127
|
+
// 恰好盯这个属性:不摘掉观察器就会「写属性 → 触发观察器 → 再扫 → 再写」无限
|
|
128
|
+
// 循环,鼠标移到菜单(首次出现 aria-selected="true")时页面直接卡死。断开观察器
|
|
129
|
+
// 还会丢弃已入队的记录,因此本次扫描自身的改动不会再触发自己。
|
|
130
|
+
observer?.disconnect();
|
|
131
|
+
try {
|
|
132
|
+
runScan();
|
|
133
|
+
}
|
|
134
|
+
finally {
|
|
135
|
+
observe();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const scheduleScan = () => {
|
|
139
|
+
if (disposed || scanQueued)
|
|
140
|
+
return;
|
|
141
|
+
scanQueued = true;
|
|
142
|
+
queueMicrotask(() => {
|
|
143
|
+
scanQueued = false;
|
|
144
|
+
scan();
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
requestRefresh = scheduleScan;
|
|
148
|
+
if (dom !== undefined)
|
|
149
|
+
installDelegateUiStyles(dom);
|
|
150
|
+
// 菜单行只在悬停/方向键变化时改写 aria-selected(结构不变),因此必须观察属性才能
|
|
151
|
+
// 把高亮同步到克隆行;扫描期间的自我触发由 scan() 里的断开-重连兜住。
|
|
152
|
+
observer = dom === undefined || Observer === undefined ? undefined : new Observer(scheduleScan);
|
|
153
|
+
observe();
|
|
154
|
+
scan();
|
|
155
|
+
return {
|
|
156
|
+
refresh: scheduleScan,
|
|
157
|
+
dispose() {
|
|
158
|
+
if (disposed)
|
|
159
|
+
return;
|
|
160
|
+
disposed = true;
|
|
161
|
+
observer?.disconnect();
|
|
162
|
+
if (requestRefresh === scheduleScan)
|
|
163
|
+
requestRefresh = undefined;
|
|
164
|
+
if (dom !== undefined)
|
|
165
|
+
removeDelegateNodes(dom);
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/** 把插件自己的 `/` 菜单行搬进「添加」分类。 */
|
|
170
|
+
function relocateMenuRow(listboxes, label) {
|
|
171
|
+
const listbox = findSlashMenuListbox(listboxes);
|
|
172
|
+
if (listbox === undefined)
|
|
173
|
+
return;
|
|
174
|
+
const row = findMenuRow(listbox, label);
|
|
175
|
+
const section = findAddSectionTitle(listbox);
|
|
176
|
+
// 只有「能造出克隆行」时才隐藏真实行:用户一旦在 `/` 后输入过滤词,DSH 会走
|
|
177
|
+
// rankByName 而不产生分类标题,此时若已经隐藏真实行,委派入口就会凭空消失。
|
|
178
|
+
if (row === undefined || section === undefined) {
|
|
179
|
+
removeProxies(listbox);
|
|
180
|
+
if (row !== undefined)
|
|
181
|
+
row.removeAttribute(DELEGATE_MENU_ROW_ATTRIBUTE);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
const existing = listbox.querySelector(`[${DELEGATE_MENU_PROXY_ATTRIBUTE}]`);
|
|
185
|
+
let proxy = existing !== null && proxySources.get(existing) === row ? existing : undefined;
|
|
186
|
+
if (proxy === undefined) {
|
|
187
|
+
existing?.remove();
|
|
188
|
+
proxy = buildProxyRow(row);
|
|
189
|
+
insertAfterSectionOptions(section, proxy);
|
|
190
|
+
proxySources.set(proxy, row);
|
|
191
|
+
}
|
|
192
|
+
// 克隆行没挂进文档就撤回隐藏,宁可留在原分类,也不能让委派入口两边都看不见。
|
|
193
|
+
if (proxy.parentNode === null)
|
|
194
|
+
row.removeAttribute(DELEGATE_MENU_ROW_ATTRIBUTE);
|
|
195
|
+
else
|
|
196
|
+
row.setAttribute(DELEGATE_MENU_ROW_ATTRIBUTE, '');
|
|
197
|
+
syncProxyActive(row, proxy);
|
|
198
|
+
}
|
|
199
|
+
/** 克隆真实行:视觉、图标与文案与原生行完全一致,交互转发回真实行。 */
|
|
200
|
+
function buildProxyRow(row) {
|
|
201
|
+
const proxy = row.cloneNode(true);
|
|
202
|
+
// 克隆会把「隐藏真实行」的标记一起复制过来。不清掉的话克隆行会被插件自己的样式
|
|
203
|
+
// 隐藏,于是真实行隐藏、克隆行也隐藏,委派入口整个从菜单里消失。
|
|
204
|
+
proxy.removeAttribute(DELEGATE_MENU_ROW_ATTRIBUTE);
|
|
205
|
+
proxy.removeAttribute('id');
|
|
206
|
+
proxy.removeAttribute('aria-selected');
|
|
207
|
+
// 克隆瞬间若真实行正被高亮,会把高亮类一起复制过来,导致克隆行永久高亮;
|
|
208
|
+
// 高亮一律改由 data-active 驱动。
|
|
209
|
+
stripActiveClass(proxy);
|
|
210
|
+
proxy.setAttribute(DELEGATE_MENU_PROXY_ATTRIBUTE, '');
|
|
211
|
+
proxy.setAttribute('data-active', 'false');
|
|
212
|
+
// MenuView 用 onMouseMove 维护高亮、onMouseDown 触发选择,克隆行必须转发两者,
|
|
213
|
+
// 否则「看得见的高亮」与「真正被选中的行」会分叉。
|
|
214
|
+
forwardEvent(proxy, row, 'mousemove');
|
|
215
|
+
forwardEvent(proxy, row, 'mousedown');
|
|
216
|
+
proxy.addEventListener('click', (event) => {
|
|
217
|
+
event.preventDefault();
|
|
218
|
+
event.stopPropagation();
|
|
219
|
+
});
|
|
220
|
+
return proxy;
|
|
221
|
+
}
|
|
222
|
+
function forwardEvent(proxy, target, type) {
|
|
223
|
+
proxy.addEventListener(type, (event) => {
|
|
224
|
+
event.preventDefault();
|
|
225
|
+
dispatchLike(target, type);
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
/** 在真实行上派发一次可冒泡事件,让 React 的合成事件把它当成真实交互。 */
|
|
229
|
+
function dispatchLike(target, type) {
|
|
230
|
+
const view = target.ownerDocument?.defaultView;
|
|
231
|
+
const MouseEventCtor = view?.MouseEvent ?? (typeof MouseEvent === 'undefined' ? undefined : MouseEvent);
|
|
232
|
+
const event = MouseEventCtor === undefined
|
|
233
|
+
? new Event(type, { bubbles: true, cancelable: true })
|
|
234
|
+
: new MouseEventCtor(type, { bubbles: true, cancelable: true });
|
|
235
|
+
target.dispatchEvent(event);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* 去掉克隆行上的原生高亮类。
|
|
239
|
+
*
|
|
240
|
+
* 类名带 CSS Modules 哈希(如 `_3e4SsG_active`),不能硬编码;这里按「最后一个下划线
|
|
241
|
+
* 片段等于 active」识别,同时兼容没有哈希的 `active`。
|
|
242
|
+
*/
|
|
243
|
+
function stripActiveClass(proxy) {
|
|
244
|
+
const classes = proxy.getAttribute('class');
|
|
245
|
+
if (classes === null || classes === '')
|
|
246
|
+
return;
|
|
247
|
+
const kept = classes.split(/\s+/u).filter((name) => name !== 'active' && !name.endsWith('_active'));
|
|
248
|
+
proxy.setAttribute('class', kept.join(' '));
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* 真实行被方向键/悬停高亮时,克隆行同步高亮。
|
|
252
|
+
*
|
|
253
|
+
* 每次写入前都必须先比较现值:这里的属性正是观察器盯着的那个,多余的写会白白
|
|
254
|
+
* 触发一轮重扫(真正的死循环由 scan() 的断开-重连兜住,这里只减少无谓触发)。
|
|
255
|
+
*/
|
|
256
|
+
function syncProxyActive(row, proxy) {
|
|
257
|
+
const active = row.getAttribute('aria-selected') === 'true';
|
|
258
|
+
const next = String(active);
|
|
259
|
+
if (proxy.getAttribute('data-active') !== next)
|
|
260
|
+
proxy.setAttribute('data-active', next);
|
|
261
|
+
const current = proxy.getAttribute('aria-selected');
|
|
262
|
+
if (active) {
|
|
263
|
+
if (current !== 'true')
|
|
264
|
+
proxy.setAttribute('aria-selected', 'true');
|
|
265
|
+
// 方向键移动时菜单会把真实行滚进视野,但用户看到的是克隆行,必须一并滚动。
|
|
266
|
+
proxy.scrollIntoView?.({ block: 'nearest' });
|
|
267
|
+
}
|
|
268
|
+
else if (current !== null) {
|
|
269
|
+
proxy.removeAttribute('aria-selected');
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function findSlashMenuListbox(listboxes) {
|
|
273
|
+
for (const listbox of listboxes) {
|
|
274
|
+
if (listbox.querySelector(`[id^="${MENU_OPTION_ID_PREFIX}"]`) !== null)
|
|
275
|
+
return listbox;
|
|
276
|
+
}
|
|
277
|
+
return undefined;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* 定位插件自己的菜单行。
|
|
281
|
+
*
|
|
282
|
+
* 必须跳过克隆行:它与真实行同名,先命中克隆行会让后续判定全部错位。
|
|
283
|
+
*/
|
|
284
|
+
function findMenuRow(listbox, label) {
|
|
285
|
+
for (const row of listbox.querySelectorAll(MENU_OPTION_SELECTOR)) {
|
|
286
|
+
if (row.hasAttribute(DELEGATE_MENU_PROXY_ATTRIBUTE))
|
|
287
|
+
continue;
|
|
288
|
+
if (row.getAttribute('id')?.startsWith(MENU_OPTION_ID_PREFIX) !== true)
|
|
289
|
+
continue;
|
|
290
|
+
const name = row.querySelector(ITEM_NAME_SELECTOR);
|
|
291
|
+
if (name !== null && (name.textContent ?? '').trim() === label)
|
|
292
|
+
return row;
|
|
293
|
+
}
|
|
294
|
+
// 类名缺失时的兜底:仍只接受插件菜单行的 id 前缀,避免命中弹层里的同名行。
|
|
295
|
+
for (const row of listbox.querySelectorAll(MENU_OPTION_SELECTOR)) {
|
|
296
|
+
if (row.hasAttribute(DELEGATE_MENU_PROXY_ATTRIBUTE))
|
|
297
|
+
continue;
|
|
298
|
+
if (row.getAttribute('id')?.startsWith(MENU_OPTION_ID_PREFIX) !== true)
|
|
299
|
+
continue;
|
|
300
|
+
if ((row.textContent ?? '').includes(label))
|
|
301
|
+
return row;
|
|
302
|
+
}
|
|
303
|
+
return undefined;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* 「添加」分类标题。
|
|
307
|
+
*
|
|
308
|
+
* DSH 的 `sectionRows` 恒把添加分类排在指令分类之前,因此首个分类标题就是它;
|
|
309
|
+
* 这里不硬编码「添加」字样,避免绑定语言。
|
|
310
|
+
*/
|
|
311
|
+
function findAddSectionTitle(listbox) {
|
|
312
|
+
return listbox.querySelectorAll(SECTION_TITLE_SELECTOR)[0];
|
|
313
|
+
}
|
|
314
|
+
/** 插入到该分类最后一行之后;分类为空时紧贴标题。 */
|
|
315
|
+
function insertAfterSectionOptions(section, proxy) {
|
|
316
|
+
let anchor = section;
|
|
317
|
+
let sibling = section.nextElementSibling;
|
|
318
|
+
while (sibling !== null && sibling.matches(MENU_OPTION_SELECTOR)) {
|
|
319
|
+
anchor = sibling;
|
|
320
|
+
sibling = sibling.nextElementSibling;
|
|
321
|
+
}
|
|
322
|
+
const parent = anchor.parentNode;
|
|
323
|
+
if (parent === null)
|
|
324
|
+
return;
|
|
325
|
+
parent.insertBefore(proxy, anchor.nextSibling);
|
|
326
|
+
}
|
|
327
|
+
/** 给委派弹层里的适配器行补图标。 */
|
|
328
|
+
function decoratePopupRows(listboxes, placeholder, iconUrl) {
|
|
329
|
+
const listbox = findDelegatePopupListbox(listboxes, placeholder);
|
|
330
|
+
if (listbox === undefined)
|
|
331
|
+
return;
|
|
332
|
+
for (const row of listbox.querySelectorAll(MENU_OPTION_SELECTOR)) {
|
|
333
|
+
if (row.querySelector(`[${DELEGATE_POPUP_LOGO_ATTRIBUTE}]`) !== null)
|
|
334
|
+
continue;
|
|
335
|
+
const adapterId = adapterIdForLabel(readPopupOptionLabel(row));
|
|
336
|
+
if (adapterId === undefined)
|
|
337
|
+
continue;
|
|
338
|
+
const url = iconUrl(adapterId);
|
|
339
|
+
if (url === undefined)
|
|
340
|
+
continue;
|
|
341
|
+
const image = listbox.ownerDocument.createElement('img');
|
|
342
|
+
image.setAttribute('src', url);
|
|
343
|
+
image.setAttribute('alt', '');
|
|
344
|
+
image.setAttribute('aria-hidden', 'true');
|
|
345
|
+
image.setAttribute(DELEGATE_POPUP_LOGO_ATTRIBUTE, adapterId);
|
|
346
|
+
row.insertBefore(image, row.firstChild);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* 给 DSH 原生 ReferenceChip 补上外部 Agent 的品牌图标。
|
|
351
|
+
*
|
|
352
|
+
* ReferenceInsert 的 appearance 只支持 session/file/folder,不能传入
|
|
353
|
+
* Provider 资产。只扫描本插件自己的 chip,并按 chip 标题反查委派目录;
|
|
354
|
+
* 目录尚未就绪时保留 DSH 的通用 session 图标,避免误标其它引用。
|
|
355
|
+
*/
|
|
356
|
+
function decorateReferenceChips(dom, iconUrl) {
|
|
357
|
+
for (const chip of dom.querySelectorAll('[data-composer-chip="codingns-delegate"]')) {
|
|
358
|
+
const labelNode = chip.querySelector('[title]');
|
|
359
|
+
const label = labelNode?.getAttribute('title')?.trim()
|
|
360
|
+
|| labelNode?.textContent?.trim()
|
|
361
|
+
|| chip.textContent?.trim()
|
|
362
|
+
|| '';
|
|
363
|
+
const adapterId = adapterIdForLabel(label);
|
|
364
|
+
if (adapterId === undefined)
|
|
365
|
+
continue;
|
|
366
|
+
const src = iconUrl(adapterId);
|
|
367
|
+
if (src === undefined || src === '')
|
|
368
|
+
continue;
|
|
369
|
+
const existing = chip.querySelector(`[${DELEGATE_CHIP_LOGO_ATTRIBUTE}]`);
|
|
370
|
+
if (existing !== null) {
|
|
371
|
+
if (existing.getAttribute('src') !== src)
|
|
372
|
+
existing.setAttribute('src', src);
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
const logo = dom.createElement('img');
|
|
376
|
+
logo.setAttribute(DELEGATE_CHIP_LOGO_ATTRIBUTE, adapterId);
|
|
377
|
+
logo.setAttribute('src', src);
|
|
378
|
+
logo.setAttribute('alt', '');
|
|
379
|
+
logo.setAttribute('aria-hidden', 'true');
|
|
380
|
+
chip.insertBefore(logo, chip.firstChild);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* 统一 DSH 新建会话和已有会话的输入框提示。
|
|
385
|
+
*
|
|
386
|
+
* DSH 没有公开修改内置 placeholder 的接口,因此保存原文后更新显示文本。
|
|
387
|
+
* 观察器会在 React 重绘或会话切换后重新应用,确保两种会话状态始终一致。
|
|
388
|
+
*/
|
|
389
|
+
function decorateComposerPlaceholders(dom, textFactory) {
|
|
390
|
+
const text = textFactory?.().trim();
|
|
391
|
+
if (text === undefined || text === '')
|
|
392
|
+
return;
|
|
393
|
+
for (const placeholder of dom.querySelectorAll('[data-composer-placeholder]')) {
|
|
394
|
+
const base = placeholder.getAttribute(DELEGATE_PLACEHOLDER_BASE_ATTRIBUTE)
|
|
395
|
+
?? placeholder.textContent?.trim()
|
|
396
|
+
?? '';
|
|
397
|
+
if (base === '')
|
|
398
|
+
continue;
|
|
399
|
+
if (!placeholder.hasAttribute(DELEGATE_PLACEHOLDER_BASE_ATTRIBUTE)) {
|
|
400
|
+
placeholder.setAttribute(DELEGATE_PLACEHOLDER_BASE_ATTRIBUTE, base);
|
|
401
|
+
}
|
|
402
|
+
placeholder.setAttribute(DELEGATE_PLACEHOLDER_MARK_ATTRIBUTE, '');
|
|
403
|
+
if (placeholder.textContent !== text)
|
|
404
|
+
placeholder.textContent = text;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* 将已经提交到 DSH 时间线的 carrier 投影为可读的 Agent chip。
|
|
409
|
+
*
|
|
410
|
+
* DSH 的输入 codec 只有一个序列化结果:Host 需要的 carrier;因此 durable
|
|
411
|
+
* `user/message` 也会携带这段传输文本。这里仅处理 DSH 的 userRow/bubble,
|
|
412
|
+
* 不触碰 assistant、代码块和普通页面文本,避免把模型内容中的 carrier 改写。
|
|
413
|
+
*/
|
|
414
|
+
function decorateTimelineMessages(dom, iconUrl, options) {
|
|
415
|
+
const rows = [...dom.querySelectorAll('[class*="userRow"]')];
|
|
416
|
+
// 发送尚未落成 durable user/message 时,DSH 的队列预览只有
|
|
417
|
+
// data-submission-echo + preview 类名;也要同步清理,避免用户在短暂回显阶段看到 carrier。
|
|
418
|
+
for (const row of dom.querySelectorAll('[data-submission-echo]')) {
|
|
419
|
+
if (!rows.includes(row))
|
|
420
|
+
rows.push(row);
|
|
421
|
+
}
|
|
422
|
+
for (const row of rows) {
|
|
423
|
+
const bubble = row.querySelector('[class*="bubble"]') ?? row.querySelector('[class*="preview"]');
|
|
424
|
+
if (bubble === null)
|
|
425
|
+
continue;
|
|
426
|
+
decorateTimelineNode(bubble, dom, iconUrl, options);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
function decorateTimelineNode(node, dom, iconUrl, options) {
|
|
430
|
+
if (node.nodeType === 3) {
|
|
431
|
+
const value = node.nodeValue ?? '';
|
|
432
|
+
if (value.includes('<!--codingns:delegate:') || value.includes(DELEGATION_INSTRUCTION_MARKER))
|
|
433
|
+
replaceTimelineTextNode(node, value, dom, iconUrl, options);
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (node.nodeType !== 1
|
|
437
|
+
|| node.hasAttribute(DELEGATE_TIMELINE_CHIP_ATTRIBUTE)
|
|
438
|
+
|| node.hasAttribute(DELEGATE_TIMELINE_CARD_ATTRIBUTE))
|
|
439
|
+
return;
|
|
440
|
+
for (const child of [...node.childNodes])
|
|
441
|
+
decorateTimelineNode(child, dom, iconUrl, options);
|
|
442
|
+
}
|
|
443
|
+
const TIMELINE_CARRIER_V1_PATTERN = /<!--codingns:delegate:v1:([^:>]+):([^>]+)-->/gu;
|
|
444
|
+
const TIMELINE_CARRIER_V2_PATTERN = /<!--codingns:delegate:v2:([^:>]+):([^:>]+):([^>]+)-->/gu;
|
|
445
|
+
const DELEGATION_INSTRUCTION_PATTERN = /\[CodingNS 委派指令\]\s*\n任务:([\s\S]*?)\n允许使用的外部 Agent:\s*\n([\s\S]*?)(?=\n请先根据任务语义制定简短的角色和步骤计划:|\n然后调用已有 agent_subagent 工具执行委派。|$)/u;
|
|
446
|
+
const DEFAULT_ADAPTER_MODEL_LABEL = String.fromCodePoint(0x9002, 0x914d, 0x5668, 0x9ed8, 0x8ba4);
|
|
447
|
+
const DELEGATION_TARGET_PATTERN = /^-\s*([^\s((]+)\s*[((]([^,,))]+)(?:[,,]\s*模型:([^,,))]*))?(?:[,,][^))]*)?[))]\s*$/gmu;
|
|
448
|
+
/** 解析 Host 改写后的委派指令,提取用户真正关心的任务和目标 Agent。 */
|
|
449
|
+
export function parseDelegationTimelineCard(value) {
|
|
450
|
+
const match = DELEGATION_INSTRUCTION_PATTERN.exec(value);
|
|
451
|
+
if (match === null)
|
|
452
|
+
return undefined;
|
|
453
|
+
// 旧版 slash 命令可能把命令本身序列化为 `/`,Host instruction 中会留下
|
|
454
|
+
// `/ 任务`;它不是用户任务的一部分,必须在卡片里隐藏。
|
|
455
|
+
const task = (match[1] ?? '').trim().replace(/^\/\s*/u, '').trim();
|
|
456
|
+
if (task === '')
|
|
457
|
+
return undefined;
|
|
458
|
+
const targets = [];
|
|
459
|
+
for (const target of (match[2] ?? '').matchAll(DELEGATION_TARGET_PATTERN)) {
|
|
460
|
+
const adapterId = target[1]?.trim() ?? '';
|
|
461
|
+
const label = target[2]?.trim() ?? '';
|
|
462
|
+
const modelId = target[3]?.trim() ?? '';
|
|
463
|
+
if (adapterId === '' || label === '' || targets.some((item) => item.adapterId === adapterId))
|
|
464
|
+
continue;
|
|
465
|
+
targets.push({ adapterId, label, ...(modelId !== '' && modelId !== DEFAULT_ADAPTER_MODEL_LABEL ? { modelId } : {}) });
|
|
466
|
+
}
|
|
467
|
+
if (targets.length === 0)
|
|
468
|
+
return undefined;
|
|
469
|
+
return { raw: value, task, targets };
|
|
470
|
+
}
|
|
471
|
+
/** 解析时间线文本中的有效 carrier;无效编码原样保留,避免误删用户内容。 */
|
|
472
|
+
export function parseDelegationTimelineCarriers(value) {
|
|
473
|
+
const mentions = [];
|
|
474
|
+
const collect = (pattern, labelGroup) => {
|
|
475
|
+
for (const match of value.matchAll(pattern)) {
|
|
476
|
+
const carrierStart = match.index ?? -1;
|
|
477
|
+
const carrier = match[0] ?? '';
|
|
478
|
+
const adapterId = decodeCarrierPart(match[1]);
|
|
479
|
+
const label = decodeCarrierPart(match[labelGroup]);
|
|
480
|
+
if (carrierStart < 0 || carrier === '' || adapterId === undefined || label === undefined)
|
|
481
|
+
continue;
|
|
482
|
+
const mention = `@${label}`;
|
|
483
|
+
const start = carrierStart >= mention.length && value.slice(carrierStart - mention.length, carrierStart) === mention
|
|
484
|
+
? carrierStart - mention.length
|
|
485
|
+
: carrierStart;
|
|
486
|
+
const raw = value.slice(start, carrierStart + carrier.length);
|
|
487
|
+
mentions.push({ raw, adapterId, label, start, end: start + raw.length });
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
collect(TIMELINE_CARRIER_V1_PATTERN, 2);
|
|
491
|
+
collect(TIMELINE_CARRIER_V2_PATTERN, 3);
|
|
492
|
+
return mentions.sort((a, b) => a.start - b.start);
|
|
493
|
+
}
|
|
494
|
+
function replaceTimelineTextNode(node, value, dom, iconUrl, options) {
|
|
495
|
+
const card = parseDelegationTimelineCard(value);
|
|
496
|
+
if (card !== undefined && node.parentNode !== null) {
|
|
497
|
+
node.parentNode.replaceChild(buildTimelineCard(dom, card, iconUrl, options.cardTitle, options.cardStatus, options.cardTarget), node);
|
|
498
|
+
return;
|
|
499
|
+
}
|
|
500
|
+
const matches = parseDelegationTimelineCarriers(value);
|
|
501
|
+
if (matches.length === 0 || node.parentNode === null)
|
|
502
|
+
return;
|
|
503
|
+
const fragment = dom.createDocumentFragment();
|
|
504
|
+
let cursor = 0;
|
|
505
|
+
for (const match of matches) {
|
|
506
|
+
if (match.start < cursor)
|
|
507
|
+
continue;
|
|
508
|
+
if (match.start > cursor)
|
|
509
|
+
fragment.append(dom.createTextNode(value.slice(cursor, match.start)));
|
|
510
|
+
fragment.append(buildTimelineChip(dom, match.raw, match.adapterId, match.label, iconUrl(match.adapterId)));
|
|
511
|
+
cursor = match.end;
|
|
512
|
+
}
|
|
513
|
+
if (cursor === 0)
|
|
514
|
+
return;
|
|
515
|
+
if (cursor < value.length)
|
|
516
|
+
fragment.append(dom.createTextNode(value.slice(cursor)));
|
|
517
|
+
node.parentNode.replaceChild(fragment, node);
|
|
518
|
+
}
|
|
519
|
+
function buildTimelineCard(dom, card, iconUrl, cardTitle = () => 'Delegation task', cardStatus = () => 'Delegating', cardTarget = ({ label, adapterId, modelId }) => `${label} (${adapterId}${modelId === undefined ? '' : ` · ${modelId}`})`) {
|
|
520
|
+
const root = dom.createElement('div');
|
|
521
|
+
root.setAttribute(DELEGATE_TIMELINE_CARD_ATTRIBUTE, '');
|
|
522
|
+
root.setAttribute(DELEGATE_TIMELINE_CARD_RAW_ATTRIBUTE, card.raw);
|
|
523
|
+
const title = dom.createElement('div');
|
|
524
|
+
title.setAttribute('data-codingns-delegation-card-title', '');
|
|
525
|
+
title.textContent = cardTitle();
|
|
526
|
+
const targets = dom.createElement('div');
|
|
527
|
+
targets.setAttribute('data-codingns-delegation-card-targets', '');
|
|
528
|
+
for (const target of card.targets) {
|
|
529
|
+
const badge = dom.createElement('span');
|
|
530
|
+
badge.setAttribute('data-codingns-delegation-card-target', target.adapterId);
|
|
531
|
+
const logoUrl = iconUrl(target.adapterId);
|
|
532
|
+
if (logoUrl !== undefined && logoUrl !== '') {
|
|
533
|
+
const logo = dom.createElement('img');
|
|
534
|
+
logo.src = logoUrl;
|
|
535
|
+
logo.alt = '';
|
|
536
|
+
logo.setAttribute('aria-hidden', 'true');
|
|
537
|
+
badge.append(logo);
|
|
538
|
+
}
|
|
539
|
+
const label = dom.createElement('span');
|
|
540
|
+
label.textContent = cardTarget(target);
|
|
541
|
+
badge.append(label);
|
|
542
|
+
targets.append(badge);
|
|
543
|
+
}
|
|
544
|
+
const task = dom.createElement('div');
|
|
545
|
+
task.setAttribute('data-codingns-delegation-card-task', '');
|
|
546
|
+
task.textContent = card.task;
|
|
547
|
+
const status = dom.createElement('div');
|
|
548
|
+
status.setAttribute('data-codingns-delegation-card-status', '');
|
|
549
|
+
status.textContent = cardStatus();
|
|
550
|
+
root.append(title, targets, task, status);
|
|
551
|
+
return root;
|
|
552
|
+
}
|
|
553
|
+
function decodeCarrierPart(value) {
|
|
554
|
+
if (value === undefined || value === '')
|
|
555
|
+
return undefined;
|
|
556
|
+
try {
|
|
557
|
+
const decoded = decodeURIComponent(value).trim();
|
|
558
|
+
return decoded === '' ? undefined : decoded;
|
|
559
|
+
}
|
|
560
|
+
catch {
|
|
561
|
+
return undefined;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
function buildTimelineChip(dom, raw, adapterId, label, iconUrl) {
|
|
565
|
+
const chip = dom.createElement('span');
|
|
566
|
+
chip.setAttribute(DELEGATE_TIMELINE_CHIP_ATTRIBUTE, adapterId);
|
|
567
|
+
chip.setAttribute(DELEGATE_TIMELINE_RAW_ATTRIBUTE, raw);
|
|
568
|
+
chip.setAttribute('title', `@${label}`);
|
|
569
|
+
if (iconUrl !== undefined && iconUrl !== '') {
|
|
570
|
+
const logo = dom.createElement('img');
|
|
571
|
+
logo.setAttribute('src', iconUrl);
|
|
572
|
+
logo.setAttribute('alt', '');
|
|
573
|
+
logo.setAttribute('aria-hidden', 'true');
|
|
574
|
+
chip.append(logo);
|
|
575
|
+
}
|
|
576
|
+
const text = dom.createElement('span');
|
|
577
|
+
text.textContent = `@${label}`;
|
|
578
|
+
chip.append(text);
|
|
579
|
+
return chip;
|
|
580
|
+
}
|
|
581
|
+
/** 通过插件自己的搜索占位符识别委派弹层,避免影响其它 popupSelect 命令。 */
|
|
582
|
+
function findDelegatePopupListbox(listboxes, placeholder) {
|
|
583
|
+
for (const listbox of listboxes) {
|
|
584
|
+
if (listbox.querySelector(`[id^="${MENU_OPTION_ID_PREFIX}"]`) !== null)
|
|
585
|
+
continue;
|
|
586
|
+
const card = listbox.parentNode;
|
|
587
|
+
const input = card?.querySelector?.('input') ?? null;
|
|
588
|
+
if (input?.getAttribute('placeholder') === placeholder)
|
|
589
|
+
return listbox;
|
|
590
|
+
}
|
|
591
|
+
return undefined;
|
|
592
|
+
}
|
|
593
|
+
function readPopupOptionLabel(row) {
|
|
594
|
+
const text = row.querySelector(LABEL_TEXT_SELECTOR)?.textContent ?? row.textContent ?? '';
|
|
595
|
+
return text.trim();
|
|
596
|
+
}
|
|
597
|
+
function adapterIdForLabel(label) {
|
|
598
|
+
if (label === '')
|
|
599
|
+
return undefined;
|
|
600
|
+
return popupOptions.find((option) => option.label === label)?.id;
|
|
601
|
+
}
|
|
602
|
+
function removeProxies(scope) {
|
|
603
|
+
for (const proxy of scope.querySelectorAll(`[${DELEGATE_MENU_PROXY_ATTRIBUTE}]`))
|
|
604
|
+
proxy.remove();
|
|
605
|
+
}
|
|
606
|
+
function removeDelegateNodes(dom) {
|
|
607
|
+
for (const proxy of dom.querySelectorAll(`[${DELEGATE_MENU_PROXY_ATTRIBUTE}]`))
|
|
608
|
+
proxy.remove();
|
|
609
|
+
for (const logo of dom.querySelectorAll(`[${DELEGATE_POPUP_LOGO_ATTRIBUTE}]`))
|
|
610
|
+
logo.remove();
|
|
611
|
+
for (const logo of dom.querySelectorAll(`[${DELEGATE_CHIP_LOGO_ATTRIBUTE}]`))
|
|
612
|
+
logo.remove();
|
|
613
|
+
for (const chip of dom.querySelectorAll(`[${DELEGATE_TIMELINE_CHIP_ATTRIBUTE}]`)) {
|
|
614
|
+
const raw = chip.getAttribute(DELEGATE_TIMELINE_RAW_ATTRIBUTE);
|
|
615
|
+
const parent = chip.parentNode;
|
|
616
|
+
if (raw !== null && parent !== null)
|
|
617
|
+
parent.replaceChild(dom.createTextNode(raw), chip);
|
|
618
|
+
}
|
|
619
|
+
for (const card of dom.querySelectorAll(`[${DELEGATE_TIMELINE_CARD_ATTRIBUTE}]`)) {
|
|
620
|
+
const raw = card.getAttribute(DELEGATE_TIMELINE_CARD_RAW_ATTRIBUTE);
|
|
621
|
+
const parent = card.parentNode;
|
|
622
|
+
if (raw !== null && parent !== null)
|
|
623
|
+
parent.replaceChild(dom.createTextNode(raw), card);
|
|
624
|
+
}
|
|
625
|
+
for (const placeholder of dom.querySelectorAll(`[${DELEGATE_PLACEHOLDER_MARK_ATTRIBUTE}]`)) {
|
|
626
|
+
const base = placeholder.getAttribute(DELEGATE_PLACEHOLDER_BASE_ATTRIBUTE);
|
|
627
|
+
if (base !== null)
|
|
628
|
+
placeholder.textContent = base;
|
|
629
|
+
placeholder.removeAttribute(DELEGATE_PLACEHOLDER_BASE_ATTRIBUTE);
|
|
630
|
+
placeholder.removeAttribute(DELEGATE_PLACEHOLDER_MARK_ATTRIBUTE);
|
|
631
|
+
}
|
|
632
|
+
for (const row of dom.querySelectorAll(`[${DELEGATE_MENU_ROW_ATTRIBUTE}]`))
|
|
633
|
+
row.removeAttribute(DELEGATE_MENU_ROW_ATTRIBUTE);
|
|
634
|
+
// 隐藏规则是插件全局样式,停用时必须一并收回,避免残留选择器影响后续渲染。
|
|
635
|
+
dom.querySelector(`style[data-plugin-css="${DELEGATE_UI_STYLE_ID}"]`)?.remove();
|
|
636
|
+
}
|
|
637
|
+
/** 样式只装一次;重复安装由 data-plugin-css 幂等键挡住。 */
|
|
638
|
+
function installDelegateUiStyles(dom) {
|
|
639
|
+
if (dom.querySelector(`style[data-plugin-css="${DELEGATE_UI_STYLE_ID}"]`) !== null)
|
|
640
|
+
return;
|
|
641
|
+
const style = dom.createElement('style');
|
|
642
|
+
style.setAttribute('data-plugin', 'codingns4dsh');
|
|
643
|
+
style.setAttribute('data-plugin-css', DELEGATE_UI_STYLE_ID);
|
|
644
|
+
style.textContent = DELEGATE_UI_STYLE_TEXT;
|
|
645
|
+
dom.head.appendChild(style);
|
|
646
|
+
}
|
|
647
|
+
//# sourceMappingURL=delegate-ui-dom.js.map
|