@jingyi0605/codingns4dsh 0.2.0-rc.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 +15 -6
- 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/qoder-cn.svg +5 -0
- package/assets/provider-icons/qoder.svg +5 -0
- package/assets/provider-icons/workbuddy.svg +29 -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/bundle.js +3864 -507
- 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 +111 -13
- 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 +2 -1
- package/data/build/dist/client/debug/ui.js.map +1 -1
- package/data/build/dist/client/delegate-command.d.ts +1 -0
- package/data/build/dist/client/delegate-command.d.ts.map +1 -1
- package/data/build/dist/client/delegate-command.js +486 -27
- package/data/build/dist/client/delegate-command.js.map +1 -1
- package/data/build/dist/client/delegate-plan.d.ts +13 -4
- package/data/build/dist/client/delegate-plan.d.ts.map +1 -1
- package/data/build/dist/client/delegate-plan.js +10 -6
- package/data/build/dist/client/delegate-plan.js.map +1 -1
- package/data/build/dist/client/delegate-ui-dom.d.ts +46 -0
- package/data/build/dist/client/delegate-ui-dom.d.ts.map +1 -1
- package/data/build/dist/client/delegate-ui-dom.js +291 -7
- package/data/build/dist/client/delegate-ui-dom.js.map +1 -1
- package/data/build/dist/client/features/cli-adapters.d.ts.map +1 -1
- package/data/build/dist/client/features/cli-adapters.js +117 -8
- package/data/build/dist/client/features/cli-adapters.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/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 +346 -18
- package/data/build/dist/client/features/peer-host.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.map +1 -1
- package/data/build/dist/client/git-management.js +21 -1
- package/data/build/dist/client/git-management.js.map +1 -1
- package/data/build/dist/client/locale.d.ts.map +1 -1
- package/data/build/dist/client/locale.js +60 -6
- package/data/build/dist/client/locale.js.map +1 -1
- package/data/build/dist/client/locales/terminalAuth.d.ts.map +1 -1
- package/data/build/dist/client/locales/terminalAuth.js +4 -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 +20 -0
- package/data/build/dist/client/locales/usage.js.map +1 -1
- package/data/build/dist/client/mobile-session-interaction.d.ts.map +1 -1
- package/data/build/dist/client/mobile-session-interaction.js +24 -7
- package/data/build/dist/client/mobile-session-interaction.js.map +1 -1
- 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/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-native-projection.d.ts +16 -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 +49 -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/provider-icon-assets.js +14 -0
- package/data/build/dist/client/provider-icon-assets.js.map +1 -1
- package/data/build/dist/client/provider-icons.d.ts.map +1 -1
- package/data/build/dist/client/provider-icons.js +15 -3
- package/data/build/dist/client/provider-icons.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/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 +7 -4
- package/data/build/dist/client/settings-section.js.map +1 -1
- package/data/build/dist/client/subscription-slot.d.ts.map +1 -1
- package/data/build/dist/client/subscription-slot.js +181 -16
- package/data/build/dist/client/subscription-slot.js.map +1 -1
- package/data/build/dist/client/terminal/model.d.ts +82 -3
- package/data/build/dist/client/terminal/model.d.ts.map +1 -1
- package/data/build/dist/client/terminal/model.js +368 -29
- 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 +215 -104
- package/data/build/dist/client/terminal/ui.js.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.d.ts +5 -1
- package/data/build/dist/client/terminal/xterm-view.d.ts.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.js +378 -20
- package/data/build/dist/client/terminal/xterm-view.js.map +1 -1
- 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.js +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.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 +12 -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 +153 -6
- 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 +637 -72
- 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 +2 -1
- package/data/build/dist/host/cli-adapters/delegate-dispatch.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/delegate-dispatch.js +14 -61
- package/data/build/dist/host/cli-adapters/delegate-dispatch.js.map +1 -1
- 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/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/feature.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/feature.js +269 -18
- package/data/build/dist/host/cli-adapters/feature.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.map +1 -1
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.js +11 -0
- package/data/build/dist/host/cli-adapters/legacy-session-adapter.js.map +1 -1
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts +5 -0
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/model-catalog.js +130 -0
- 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 +33 -3
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.js +115 -9
- package/data/build/dist/host/cli-adapters/native-subagent-dispatch.js.map +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.d.ts +14 -2
- package/data/build/dist/host/cli-adapters/native-team-subagent.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/native-team-subagent.js +23 -4
- package/data/build/dist/host/cli-adapters/native-team-subagent.js.map +1 -1
- 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 +9 -7
- package/data/build/dist/host/cli-adapters/opencode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +33 -3
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.js +158 -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.d.ts +41 -2
- package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.js +187 -18
- package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
- package/data/build/dist/host/cli-adapters/session-store.d.ts +4 -0
- package/data/build/dist/host/cli-adapters/session-store.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/session-store.js +18 -2
- 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 +14 -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 +121 -23
- 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.map +1 -1
- package/data/build/dist/host/cli-adapters/subagent-tool.js +53 -7
- package/data/build/dist/host/cli-adapters/subagent-tool.js.map +1 -1
- package/data/build/dist/host/cli-bridge/bridge-server.d.ts +5 -0
- package/data/build/dist/host/cli-bridge/bridge-server.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/bridge-server.js +7 -2
- package/data/build/dist/host/cli-bridge/bridge-server.js.map +1 -1
- package/data/build/dist/host/cli-bridge/command-code-mod.d.ts +5 -1
- package/data/build/dist/host/cli-bridge/command-code-mod.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/command-code-mod.js +43 -12
- package/data/build/dist/host/cli-bridge/command-code-mod.js.map +1 -1
- package/data/build/dist/host/cli-bridge/dispatch.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/dispatch.js +43 -5
- package/data/build/dist/host/cli-bridge/dispatch.js.map +1 -1
- package/data/build/dist/host/cli-bridge/mcp-stdio-entry.js +24 -5
- package/data/build/dist/host/cli-bridge/mcp-stdio-entry.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 +174 -30
- 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 +11 -1
- package/data/build/dist/host/index.d.ts.map +1 -1
- package/data/build/dist/host/index.js +12 -2
- package/data/build/dist/host/index.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-protocol.js +6 -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-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/native-session-bridge.d.ts.map +1 -1
- package/data/build/dist/host/native-session-bridge.js +36 -7
- package/data/build/dist/host/native-session-bridge.js.map +1 -1
- package/data/build/dist/host/rpc.js +5 -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 +12 -5
- 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 +64 -2
- package/data/build/dist/shared/contracts/cli-adapter.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.d.ts +54 -11
- package/data/build/dist/shared/contracts/config.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.js +52 -8
- package/data/build/dist/shared/contracts/config.js.map +1 -1
- package/data/build/dist/shared/contracts/subscription.d.ts +5 -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 +2 -2
- 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 +1 -1
- package/profile/README.md +2 -2
- package/profile/package.json +2 -2
- package/profile/version.json +1 -1
- package/version.json +1 -1
|
@@ -8,6 +8,11 @@ import { GrokBuildDriver } from './grok-driver.js';
|
|
|
8
8
|
import { OpenCodeDriver } from './opencode-driver.js';
|
|
9
9
|
import { MiniMaxCodeDriver } from './mcode-driver.js';
|
|
10
10
|
import { ZcodeAppServerDriver } from './zcode-driver.js';
|
|
11
|
+
import { CodeBuddyCliDriver, WorkBuddyCliDriver } from './codebuddy-driver.js';
|
|
12
|
+
import { CursorCliDriver } from './cursor-driver.js';
|
|
13
|
+
import { KiroCliDriver } from './kiro-driver.js';
|
|
14
|
+
import { QoderCliDriver } from './qoder-driver.js';
|
|
15
|
+
import { AntigravityDriver } from './antigravity-driver.js';
|
|
11
16
|
import { CodingNsCliAdapterRegistry } from './registry.js';
|
|
12
17
|
import { CodingNsCliSessionStore } from './session-store.js';
|
|
13
18
|
import { CodingNsDshMessageProjector } from './dsh-message-projector.js';
|
|
@@ -20,6 +25,10 @@ import { dispatchBridgeSubagent } from '../cli-bridge/dispatch.js';
|
|
|
20
25
|
import { startSubagentBridgeServer } from '../cli-bridge/bridge-server.js';
|
|
21
26
|
import { setSubagentBridge } from '../cli-bridge/bridge-holder.js';
|
|
22
27
|
import { delegateCapability, dispatchDelegateSubagent } from './delegate-dispatch.js';
|
|
28
|
+
import { setMaxNativeSubagentsPerParent } from './native-subagent-dispatch.js';
|
|
29
|
+
import { containsDelegationCarrier, rewriteDelegationMessages } from './delegation-mention-rewrite.js';
|
|
30
|
+
import { clearDelegationAuthorization, setDelegationAuthorization } from './delegation-authorization.js';
|
|
31
|
+
import { debugInfo } from '../../shared/debug.js';
|
|
23
32
|
export function createCliAdaptersFeature(options = {}) {
|
|
24
33
|
return {
|
|
25
34
|
descriptor: {
|
|
@@ -45,7 +54,7 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
45
54
|
if (nativeSessions !== undefined) {
|
|
46
55
|
const migration = sessionStore.migrateLegacySessions(expandMigrationChain(nativeSessions, nativeSessions.list()));
|
|
47
56
|
if (migration.migrated > 0 || migration.unresolved > 0) {
|
|
48
|
-
|
|
57
|
+
debugInfo('codingns4dsh: 旧外部会话适配器迁移完成', migration);
|
|
49
58
|
}
|
|
50
59
|
}
|
|
51
60
|
const registry = options.registry ?? new CodingNsCliAdapterRegistry([
|
|
@@ -59,6 +68,13 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
59
68
|
new GrokBuildDriver(),
|
|
60
69
|
new MiniMaxCodeDriver(),
|
|
61
70
|
new ZcodeAppServerDriver(),
|
|
71
|
+
new CodeBuddyCliDriver(),
|
|
72
|
+
new WorkBuddyCliDriver(),
|
|
73
|
+
new CursorCliDriver(),
|
|
74
|
+
new KiroCliDriver(),
|
|
75
|
+
new QoderCliDriver(),
|
|
76
|
+
new QoderCliDriver({ variant: 'qoder-cn' }),
|
|
77
|
+
new AntigravityDriver(),
|
|
62
78
|
], context.services.settings?.get().agentAdapters, {
|
|
63
79
|
sessionStore,
|
|
64
80
|
...(context.services.settings === undefined ? {} : { settings: context.services.settings }),
|
|
@@ -102,10 +118,14 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
102
118
|
});
|
|
103
119
|
context.resources.add(disposeNativeEvents);
|
|
104
120
|
}
|
|
121
|
+
registerDelegationAgentHooks(context.services.dshContext, registry, context.resources);
|
|
105
122
|
context.resources.add(context.services.rpc.register('cli', (action, payload) => {
|
|
106
123
|
switch (action) {
|
|
107
124
|
case 'catalog': return registry.catalog();
|
|
108
|
-
case 'models':
|
|
125
|
+
case 'models': {
|
|
126
|
+
const adapterId = readAdapterId(payload);
|
|
127
|
+
return adapterId === 'dsh' ? readDshModelCatalog(context.services.dshContext) : registry.models(adapterId);
|
|
128
|
+
}
|
|
109
129
|
case 'adapter/set': return setAdapterEnabled(context.services.settings, registry, payload);
|
|
110
130
|
case 'session/get': return registry.getSession(readSessionId(payload));
|
|
111
131
|
case 'session/set': return registry.setSession(readSessionId(payload), readSessionConfig(payload));
|
|
@@ -189,7 +209,16 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
189
209
|
const scheduleSubagentBridgeSync = (enabled) => {
|
|
190
210
|
bridgeSync = bridgeSync.then(() => syncSubagentBridge(enabled), () => syncSubagentBridge(enabled));
|
|
191
211
|
};
|
|
192
|
-
|
|
212
|
+
const syncSubagentBridgeSettings = (raw) => {
|
|
213
|
+
const bridgeSettings = normalizeSubagentBridgeSettings(raw);
|
|
214
|
+
// 并发上限先于桥接启停生效:桥接开启后立刻到达的并行调用必须看到用户配置,
|
|
215
|
+
// 否则第一批派发仍会撞上缺省上限。
|
|
216
|
+
setMaxNativeSubagentsPerParent(bridgeSettings.maxConcurrentSubagents);
|
|
217
|
+
scheduleSubagentBridgeSync(bridgeSettings.enabled);
|
|
218
|
+
};
|
|
219
|
+
// 初始值必须在任何派发之前落地:桥接开启后第一批并行调用就会读取上限。
|
|
220
|
+
syncSubagentBridgeSettings(context.services.settings?.get().subagentBridge);
|
|
221
|
+
await bridgeSync;
|
|
193
222
|
context.resources.add(async () => {
|
|
194
223
|
const server = bridgeServer;
|
|
195
224
|
bridgeServer = undefined;
|
|
@@ -204,7 +233,7 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
204
233
|
registry.syncPreferences(next.agentAdapterPreferences);
|
|
205
234
|
sessionStore.sync(next.cliSessions);
|
|
206
235
|
subscriptions = buildSubscriptions(next);
|
|
207
|
-
|
|
236
|
+
syncSubagentBridgeSettings(next.subagentBridge);
|
|
208
237
|
}));
|
|
209
238
|
}
|
|
210
239
|
const events = context.services.events;
|
|
@@ -231,7 +260,26 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
231
260
|
// 被恢复成 dsh,但 provider 已明确指向外部 Agent;继续旁路会让
|
|
232
261
|
// 第二轮直接落入 DSH 空流,并丢失外部驱动的 usage/context 修正。
|
|
233
262
|
const dshSelection = readDshSelection(value);
|
|
234
|
-
|
|
263
|
+
let messages = Array.isArray(value?.messages) ? value.messages.filter(isMessage) : [];
|
|
264
|
+
// 委派 carrier 只在普通对话提交时消费。选择 Agent 本身不会经过这里,也不会创建
|
|
265
|
+
// 子会话;Agent Loop 请求会在 agent/pre-step 边界完成改写。这里仅保留
|
|
266
|
+
// 非 Agent Loop 手工 llm/stream 调用的错误消费和外部 Agent 局部解析。
|
|
267
|
+
if (containsDelegationCarrier(messages)) {
|
|
268
|
+
const delegation = rewriteDelegationMessages(messages, await registry.catalog());
|
|
269
|
+
if (delegation.kind === 'error') {
|
|
270
|
+
yield* delegationErrorStream(`${delegation.error.code}: ${delegation.error.message}`);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
if (delegation.kind === 'rewritten') {
|
|
274
|
+
// DSH Agent Loop 传入的 options 是深冻结对象,不能把改写结果写回
|
|
275
|
+
// `value.messages`。外部适配器只消费本地快照,原生 Agent 的 carrier
|
|
276
|
+
// 已在 agent/pre-step 中被替换并持久化。
|
|
277
|
+
setDelegationAuthorization(sessionId, delegation.value.targets);
|
|
278
|
+
messages = [...delegation.value.messages];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
else if (sessionId !== '')
|
|
282
|
+
clearDelegationAuthorization(sessionId);
|
|
235
283
|
const selectedExternalAdapter = selectExternalAdapter(dshSelection.providerId, inferMessageAdapter(messages), registry);
|
|
236
284
|
// DSH 的 modelSelection 只描述 DSH 自己那条模型路由(例如 glor/deepseek)。
|
|
237
285
|
// 只有它明确指向即将接管的外部适配器时,model/effort 才属于该适配器;
|
|
@@ -264,6 +312,8 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
264
312
|
}
|
|
265
313
|
const cwd = resolveSessionCwd(context.services.nativeSessions, sessionId, value);
|
|
266
314
|
const turnInput = extractTurnInput(messages, context.services.dshContext);
|
|
315
|
+
const turnOptions = readCliTurnOptions(value);
|
|
316
|
+
const runtimeEnv = readCliRuntimeEnv(value);
|
|
267
317
|
// 权限状态必须与 DSH 会话当前生效值同源。驱动不能自行假设“完全权限”,
|
|
268
318
|
// 也不能把缺省当成“已确认无限制”:解析失败时留空,由驱动沿用保守默认。
|
|
269
319
|
const permission = resolveSessionPermission(context.services.dshContext, sessionId);
|
|
@@ -273,17 +323,22 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
273
323
|
// 条 usage 到达前失去投影。
|
|
274
324
|
const input = {
|
|
275
325
|
sessionId,
|
|
276
|
-
messages,
|
|
326
|
+
messages: turnInput.messages,
|
|
277
327
|
prompt: turnInput.prompt,
|
|
278
328
|
...(turnInput.attachments.length === 0 ? {} : { attachments: turnInput.attachments }),
|
|
279
329
|
...(permission === undefined ? {} : { permission }),
|
|
330
|
+
...(turnOptions.plan === true ? { plan: true } : {}),
|
|
331
|
+
...(turnOptions.forkSession === true ? { forkSession: true } : {}),
|
|
332
|
+
...(turnOptions.enableAskUserQuestion === true ? { enableAskUserQuestion: true } : {}),
|
|
333
|
+
...(runtimeEnv === undefined ? {} : { runtimeEnv }),
|
|
280
334
|
...(config.modelId ? { modelId: config.modelId } : {}),
|
|
281
335
|
...(config.effortId ? { effortId: config.effortId } : {}),
|
|
336
|
+
...(config.serviceTierId ? { serviceTierId: config.serviceTierId } : {}),
|
|
282
337
|
...(config.providerSessionId ? { providerSessionId: config.providerSessionId } : {}),
|
|
283
338
|
...(config.rawStoreRef ? { rawStoreRef: config.rawStoreRef } : {}),
|
|
284
339
|
...(cwd === undefined ? {} : { cwd }),
|
|
285
340
|
...(isAbortSignal(value?.signal) ? { signal: value.signal } : {}),
|
|
286
|
-
...(registry.supportsSegmentedTurns(config.adapterId)
|
|
341
|
+
...((registry.supportsSegmentedTurns(config.adapterId) || registry.supportsToolStepSplitting(config.adapterId))
|
|
287
342
|
&& nativeSessions?.available === true
|
|
288
343
|
&& nativeSessions.injectNextStep !== undefined
|
|
289
344
|
&& (nativeSessions.canInjectNextStep === undefined
|
|
@@ -304,6 +359,10 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
304
359
|
input.signal?.addEventListener('abort', discardSuspendedTurn, { once: true });
|
|
305
360
|
if (input.signal?.aborted)
|
|
306
361
|
discardSuspendedTurn();
|
|
362
|
+
// DSH UI 的会话未读绿点由 api-session/status 的 true -> false 转换驱动。
|
|
363
|
+
// 外部适配器绕过 DSH 原生 Agent Loop,必须在真正执行外部流前补发同一状态,
|
|
364
|
+
// 否则外部子会话完成后虽已写入历史,侧栏却永远不会生成 completionUnread。
|
|
365
|
+
publishExternalSessionStatus(context.services.events, sessionId, true);
|
|
307
366
|
try {
|
|
308
367
|
for await (const chunk of registry.execute({ ...input, adapterId: config.adapterId })) {
|
|
309
368
|
if (chunk.type === 'step-boundary') {
|
|
@@ -336,12 +395,20 @@ export function createCliAdaptersFeature(options = {}) {
|
|
|
336
395
|
}
|
|
337
396
|
finally {
|
|
338
397
|
input.signal?.removeEventListener('abort', discardSuspendedTurn);
|
|
398
|
+
publishExternalSessionStatus(context.services.events, sessionId, false);
|
|
339
399
|
}
|
|
340
400
|
});
|
|
341
401
|
if (typeof dispose === 'function')
|
|
342
402
|
context.resources.add(() => { dispose(); });
|
|
343
403
|
}
|
|
344
|
-
context.resources.add(async () => {
|
|
404
|
+
context.resources.add(async () => {
|
|
405
|
+
// DSH 先停用设置上下文再执行异步资源清理时,旧的写队列不能继续调用
|
|
406
|
+
// configEditor,否则会出现 inactive context 并污染退出日志。
|
|
407
|
+
sessionStore.dispose();
|
|
408
|
+
await registry.dispose();
|
|
409
|
+
await sessionStore.flush();
|
|
410
|
+
setAdapterRegistry(undefined);
|
|
411
|
+
});
|
|
345
412
|
},
|
|
346
413
|
};
|
|
347
414
|
}
|
|
@@ -350,6 +417,83 @@ function requireTeam(context) {
|
|
|
350
417
|
throw new Error('DSH_TEAM_NATIVE_UNAVAILABLE');
|
|
351
418
|
return context.services.nativeTeam;
|
|
352
419
|
}
|
|
420
|
+
/** 发布外部回合运行状态,让 DSH 原生 UI 能正确维护完成未读标记。 */
|
|
421
|
+
function publishExternalSessionStatus(events, sessionId, running) {
|
|
422
|
+
if (sessionId.trim() === '' || events?.emit === undefined)
|
|
423
|
+
return;
|
|
424
|
+
try {
|
|
425
|
+
events.emit('api-session/status', sessionId, running);
|
|
426
|
+
}
|
|
427
|
+
catch {
|
|
428
|
+
// 状态提示是 UI 增强能力,不能因为精简 Host 没有完整事件转发器而阻断回合。
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* 在 Agent Loop 的可变输入边界消费委派 carrier。
|
|
433
|
+
*
|
|
434
|
+
* `llm/stream` 收到的 LOOP 请求由 DSH 深冻结,监听器只能读取;如果在那里改写
|
|
435
|
+
* `messages`,会直接抛出只读属性异常。`agent/pre-step` 返回新的决策消息,随后由
|
|
436
|
+
* Agent Loop 负责把改写后的内容写入当前会话并构造下一次只读 LLM 请求。
|
|
437
|
+
*/
|
|
438
|
+
function registerDelegationAgentHooks(dshContext, registry, resources) {
|
|
439
|
+
if (dshContext === undefined || typeof dshContext.on !== 'function')
|
|
440
|
+
return;
|
|
441
|
+
const disposers = [];
|
|
442
|
+
const register = (name, listener) => {
|
|
443
|
+
const disposer = dshContext.on(name, listener, { global: true });
|
|
444
|
+
if (typeof disposer === 'function')
|
|
445
|
+
disposers.push(disposer);
|
|
446
|
+
};
|
|
447
|
+
register('agent/pre-step', async (payload, next) => {
|
|
448
|
+
const record = asRecord(payload);
|
|
449
|
+
const sessionId = readAgentSessionId(record?.agent);
|
|
450
|
+
const messages = Array.isArray(record?.messages) ? record.messages.filter(isMessage) : [];
|
|
451
|
+
let delegation;
|
|
452
|
+
if (containsDelegationCarrier(messages)) {
|
|
453
|
+
delegation = rewriteDelegationMessages(messages, await registry.catalog());
|
|
454
|
+
if (delegation.kind === 'error')
|
|
455
|
+
clearDelegationAuthorization(sessionId);
|
|
456
|
+
else if (delegation.kind === 'rewritten') {
|
|
457
|
+
setDelegationAuthorization(sessionId, delegation.value.targets);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
const decision = await next();
|
|
461
|
+
if (delegation?.kind !== 'rewritten' || !isEnterPreStepDecision(decision))
|
|
462
|
+
return decision;
|
|
463
|
+
// `next()` 可能已经追加系统上下文或模型切换通知,只替换它前面的本轮用户消息。
|
|
464
|
+
const suffix = decision.messages.slice(messages.length);
|
|
465
|
+
return {
|
|
466
|
+
...decision,
|
|
467
|
+
messages: [...delegation.value.messages, ...suffix],
|
|
468
|
+
};
|
|
469
|
+
});
|
|
470
|
+
// 正常结束、异常结束和中断最终都会进入 idle;在此清理本轮授权,避免下一轮
|
|
471
|
+
// 没有 carrier 时继承上一轮的目标白名单。
|
|
472
|
+
register('agent/status', (payload) => {
|
|
473
|
+
const record = asRecord(payload);
|
|
474
|
+
if (record?.status === 'idle')
|
|
475
|
+
clearDelegationAuthorization(readAgentSessionId(record?.agent));
|
|
476
|
+
});
|
|
477
|
+
register('agent/disposed', (payload) => {
|
|
478
|
+
clearDelegationAuthorization(readAgentSessionId(asRecord(payload)?.agent));
|
|
479
|
+
});
|
|
480
|
+
resources.add(() => {
|
|
481
|
+
for (const dispose of disposers.reverse())
|
|
482
|
+
dispose();
|
|
483
|
+
});
|
|
484
|
+
}
|
|
485
|
+
function isEnterPreStepDecision(value) {
|
|
486
|
+
const record = asRecord(value);
|
|
487
|
+
return record?.kind === 'enter' && Array.isArray(record.messages);
|
|
488
|
+
}
|
|
489
|
+
function readAgentSessionId(value) {
|
|
490
|
+
const record = asRecord(value);
|
|
491
|
+
if (typeof record?.id === 'string' && record.id.trim() !== '')
|
|
492
|
+
return record.id.trim();
|
|
493
|
+
const session = asRecord(record?.session);
|
|
494
|
+
const header = asRecord(session?.header);
|
|
495
|
+
return typeof header?.id === 'string' ? header.id.trim() : '';
|
|
496
|
+
}
|
|
353
497
|
/** DSH Context 可能在测试或嵌入式宿主里缺少目标服务;缺失时按不可用处理。 */
|
|
354
498
|
function readOptionalContextService(ctx, name) {
|
|
355
499
|
if (ctx === undefined)
|
|
@@ -361,6 +505,49 @@ function readOptionalContextService(ctx, name) {
|
|
|
361
505
|
return undefined;
|
|
362
506
|
}
|
|
363
507
|
}
|
|
508
|
+
/** 将 DSH 原生 session/modelCatalog 归一化为委派选择器复用的模型目录契约。 */
|
|
509
|
+
async function readDshModelCatalog(ctx) {
|
|
510
|
+
const controller = readOptionalContextService(ctx, 'sessionController');
|
|
511
|
+
if (isRecord(controller) && typeof controller.modelCatalog === 'function') {
|
|
512
|
+
try {
|
|
513
|
+
const raw = await controller.modelCatalog();
|
|
514
|
+
const record = asRecord(raw);
|
|
515
|
+
const groups = Array.isArray(record?.groups)
|
|
516
|
+
? record.groups.flatMap((group) => normalizeDshModelGroup(group))
|
|
517
|
+
: [];
|
|
518
|
+
const defaultSelection = asRecord(record?.default);
|
|
519
|
+
const defaultModel = typeof defaultSelection?.model === 'string' && defaultSelection.model.trim() !== '' ? defaultSelection.model.trim() : null;
|
|
520
|
+
const defaultEffort = typeof defaultSelection?.reasoningEffort === 'string' && defaultSelection.reasoningEffort.trim() !== '' ? defaultSelection.reasoningEffort.trim() : null;
|
|
521
|
+
if (groups.length > 0)
|
|
522
|
+
return { groups, currentModel: defaultModel, currentEffort: defaultEffort };
|
|
523
|
+
if (defaultModel !== null)
|
|
524
|
+
return { groups: [{ id: 'dsh', name: 'DeepSeek Harness', models: [{ id: defaultModel, name: defaultModel, efforts: defaultEffort === null ? [] : [defaultEffort] }] }], currentModel: defaultModel, currentEffort: defaultEffort };
|
|
525
|
+
}
|
|
526
|
+
catch (error) {
|
|
527
|
+
debugInfo('codingns4dsh: DSH 模型目录读取失败', { error: error instanceof Error ? error.message : String(error) });
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
// 精简 Host 没有 sessionController 时仍给出稳定的“跟随 DSH 当前模型”选项,
|
|
531
|
+
// 这样 dsh 目标不会退化成无模型可选,实际请求继续沿用 DSH 当前路由。
|
|
532
|
+
return { groups: [{ id: 'dsh', name: 'DeepSeek Harness', models: [{ id: 'provider-default', name: '跟随 DSH 当前模型', efforts: [] }] }], currentModel: 'provider-default', currentEffort: null, fallback: true };
|
|
533
|
+
}
|
|
534
|
+
function normalizeDshModelGroup(value) {
|
|
535
|
+
const record = asRecord(value);
|
|
536
|
+
const id = typeof record?.id === 'string' && record.id.trim() !== '' ? record.id.trim() : 'dsh';
|
|
537
|
+
const name = typeof record?.name === 'string' && record.name.trim() !== '' ? record.name.trim() : id;
|
|
538
|
+
const models = Array.isArray(record?.models) ? record.models.flatMap((item) => {
|
|
539
|
+
const model = asRecord(item);
|
|
540
|
+
const modelId = typeof model?.id === 'string' ? model.id.trim() : '';
|
|
541
|
+
if (modelId === '')
|
|
542
|
+
return [];
|
|
543
|
+
const reasoning = asRecord(model?.reasoning);
|
|
544
|
+
const efforts = Array.isArray(reasoning?.efforts)
|
|
545
|
+
? reasoning.efforts.flatMap((effort) => typeof asRecord(effort)?.id === 'string' ? [String(asRecord(effort)?.id)] : [])
|
|
546
|
+
: [];
|
|
547
|
+
return [{ id: modelId, name: typeof model?.name === 'string' && model.name.trim() !== '' ? model.name.trim() : modelId, ...(typeof model?.description === 'string' && model.description.trim() !== '' ? { description: model.description.trim() } : {}), efforts }];
|
|
548
|
+
}) : [];
|
|
549
|
+
return { id, name, models };
|
|
550
|
+
}
|
|
364
551
|
/**
|
|
365
552
|
* DSH 原生 Provider 可能只返回一个 finish(stop)。不能把这个空回合当作成功,
|
|
366
553
|
* 否则 Session 会落下一条空 assistant/message,用户只能看到“一秒结束”。
|
|
@@ -387,6 +574,13 @@ async function* guardDshNativeStream(next) {
|
|
|
387
574
|
yield { type: 'block-end', index: 1, block: { type: 'text', text: message } };
|
|
388
575
|
yield { type: 'finish', reason: { kind: 'error', failure: { message, code: 'PROVIDER_ERROR' } } };
|
|
389
576
|
}
|
|
577
|
+
/** carrier 解析失败也必须以可读的 DSH 错误事件结束当前轮次。 */
|
|
578
|
+
async function* delegationErrorStream(message) {
|
|
579
|
+
yield { type: 'block-start', index: 1, blockType: 'text' };
|
|
580
|
+
yield { type: 'text-delta', index: 1, text: message };
|
|
581
|
+
yield { type: 'block-end', index: 1, block: { type: 'text', text: message } };
|
|
582
|
+
yield { type: 'finish', reason: { kind: 'error', failure: { message, code: 'DELEGATE_ERROR' } } };
|
|
583
|
+
}
|
|
390
584
|
function isDshFinishChunk(value) {
|
|
391
585
|
const record = asRecord(value);
|
|
392
586
|
return record?.type === 'finish';
|
|
@@ -437,9 +631,8 @@ function readDelegateRequest(value) {
|
|
|
437
631
|
const record = asRecord(value);
|
|
438
632
|
const sessionId = readSessionId(value);
|
|
439
633
|
const adapterId = readAdapterId(value);
|
|
440
|
-
// 这里不能复用 readPrompt
|
|
441
|
-
//
|
|
442
|
-
// 回退到会话最近一条人类消息,因此只做类型与去空白处理,空串原样传下去。
|
|
634
|
+
// 这里不能复用 readPrompt:旧 Client 可能仍传入空 prompt,空串要交给派发内核返回
|
|
635
|
+
// 结构化空任务错误;不得读取历史消息补齐任务。
|
|
443
636
|
const rawPrompt = record?.prompt;
|
|
444
637
|
if (rawPrompt !== undefined && typeof rawPrompt !== 'string')
|
|
445
638
|
throw new Error('prompt 必须是字符串');
|
|
@@ -458,8 +651,12 @@ function readSessionConfig(value) {
|
|
|
458
651
|
adapterId,
|
|
459
652
|
...(typeof record?.modelId === 'string' && record.modelId.trim() ? { modelId: record.modelId.trim() } : {}),
|
|
460
653
|
...(typeof record?.effortId === 'string' && record.effortId.trim() ? { effortId: record.effortId.trim() } : {}),
|
|
654
|
+
// `default` 是显式的“标准速度”选择,不能当作空值丢弃,否则关掉 Fast 会被
|
|
655
|
+
// Registry 回退成上一次记住的加速档。
|
|
656
|
+
...(typeof record?.serviceTierId === 'string' && record.serviceTierId.trim() ? { serviceTierId: record.serviceTierId.trim() } : {}),
|
|
461
657
|
...(typeof record?.providerId === 'string' && record.providerId.trim() ? { providerId: record.providerId.trim() } : {}),
|
|
462
658
|
...(typeof record?.providerSessionId === 'string' && record.providerSessionId.trim() ? { providerSessionId: record.providerSessionId.trim() } : {}),
|
|
659
|
+
...(typeof record?.rawStoreRef === 'string' && record.rawStoreRef.trim() ? { rawStoreRef: record.rawStoreRef.trim() } : {}),
|
|
463
660
|
};
|
|
464
661
|
}
|
|
465
662
|
function readSessionListOptions(value) {
|
|
@@ -505,6 +702,33 @@ function readDshSelection(value) {
|
|
|
505
702
|
...(providerId === undefined ? {} : { providerId }),
|
|
506
703
|
};
|
|
507
704
|
}
|
|
705
|
+
/** 读取 DSH/Host 明确下发给外部 CLI 的运行选项;缺省值不改变 Provider 行为。 */
|
|
706
|
+
function readCliTurnOptions(value) {
|
|
707
|
+
const candidates = [
|
|
708
|
+
value,
|
|
709
|
+
asRecord(value?.options),
|
|
710
|
+
asRecord(value?.request),
|
|
711
|
+
asRecord(asRecord(value?.request)?.options),
|
|
712
|
+
asRecord(value?.config),
|
|
713
|
+
];
|
|
714
|
+
const read = (keys) => candidates.some((candidate) => keys.some((key) => candidate?.[key] === true));
|
|
715
|
+
const plan = read(['plan']);
|
|
716
|
+
const forkSession = read(['forkSession', 'fork']);
|
|
717
|
+
const enableAskUserQuestion = read(['enableAskUserQuestion', 'askUserQuestion']);
|
|
718
|
+
return {
|
|
719
|
+
...(plan ? { plan: true } : {}),
|
|
720
|
+
...(forkSession ? { forkSession: true } : {}),
|
|
721
|
+
...(enableAskUserQuestion ? { enableAskUserQuestion: true } : {}),
|
|
722
|
+
};
|
|
723
|
+
}
|
|
724
|
+
/** 父仓库通过运行时环境开启 ask_user_question;保留同一兼容入口。 */
|
|
725
|
+
function readCliRuntimeEnv(value) {
|
|
726
|
+
const candidate = asRecord(value?.runtimeEnv) ?? asRecord(asRecord(value?.options)?.runtimeEnv);
|
|
727
|
+
if (candidate === null)
|
|
728
|
+
return undefined;
|
|
729
|
+
const entries = Object.entries(candidate).filter(([, item]) => typeof item === 'string');
|
|
730
|
+
return entries.length === 0 ? undefined : Object.fromEntries(entries);
|
|
731
|
+
}
|
|
508
732
|
/** DSH Session 快照把最近选择放在 modelSelection.lastUsed/next。 */
|
|
509
733
|
function readModelSelectionCandidates(value) {
|
|
510
734
|
const result = [];
|
|
@@ -575,7 +799,9 @@ function selectExternalAdapter(selectedProvider, messageAdapter, registry) {
|
|
|
575
799
|
function inferMessageAdapter(messages) {
|
|
576
800
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
577
801
|
const source = asRecord(messages[index].source);
|
|
578
|
-
|
|
802
|
+
// 旧会话和 DSH 原生投影的 source 形状不完全一致;只要是模型消息就读取
|
|
803
|
+
// provider,最终仍由 selectExternalAdapter 校验是否为已启用外部适配器。
|
|
804
|
+
if (source?.kind !== 'model')
|
|
579
805
|
continue;
|
|
580
806
|
const provider = source.provider;
|
|
581
807
|
if (typeof provider === 'string' && provider.trim() !== '')
|
|
@@ -596,12 +822,31 @@ async function setAdapterEnabled(settings, registry, value) {
|
|
|
596
822
|
function extractTurnInput(messages, dshContext) {
|
|
597
823
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
598
824
|
const message = messages[index];
|
|
599
|
-
if (message !== undefined && isInjectedStepNotice(message))
|
|
600
|
-
return { prompt: extractText(message.content), attachments: [] };
|
|
601
|
-
|
|
602
|
-
|
|
825
|
+
if (message !== undefined && isInjectedStepNotice(message)) {
|
|
826
|
+
return { prompt: extractText(message.content), attachments: [], messages };
|
|
827
|
+
}
|
|
828
|
+
if (message !== undefined && isHumanUserMessage(message)) {
|
|
829
|
+
const direct = extractMessageInput(message.content, dshContext);
|
|
830
|
+
const referenceIndexes = messages
|
|
831
|
+
.slice(index + 1)
|
|
832
|
+
.map((candidate, offset) => isSessionReferenceContext(candidate) ? index + 1 + offset : -1)
|
|
833
|
+
.filter((candidateIndex) => candidateIndex >= 0);
|
|
834
|
+
const referenceText = referenceIndexes
|
|
835
|
+
.map(referenceIndex => messages[referenceIndex])
|
|
836
|
+
.filter((candidate) => candidate !== undefined)
|
|
837
|
+
.map(candidate => extractText(candidate.content))
|
|
838
|
+
.filter(text => text.trim() !== '');
|
|
839
|
+
const forwarded = referenceIndexes.length === 0
|
|
840
|
+
? messages
|
|
841
|
+
: messages.filter((_candidate, candidateIndex) => !referenceIndexes.includes(candidateIndex));
|
|
842
|
+
return {
|
|
843
|
+
prompt: [direct.prompt, ...referenceText].filter(text => text.trim() !== '').join('\n\n').trim(),
|
|
844
|
+
attachments: direct.attachments,
|
|
845
|
+
messages: forwarded,
|
|
846
|
+
};
|
|
847
|
+
}
|
|
603
848
|
}
|
|
604
|
-
return { prompt: '', attachments: [] };
|
|
849
|
+
return { prompt: '', attachments: [], messages };
|
|
605
850
|
}
|
|
606
851
|
/** DSH 为工具分段注入的继续提示必须成为下一次 Provider 请求的 prompt。 */
|
|
607
852
|
function isInjectedStepNotice(message) {
|
|
@@ -622,6 +867,12 @@ function isHumanUserMessage(message) {
|
|
|
622
867
|
return false;
|
|
623
868
|
return message.source.kind === undefined || message.source.kind === 'user';
|
|
624
869
|
}
|
|
870
|
+
/** DSH 为当前用户消息生成的只读跨会话快照,允许进入外部 Agent 的当前 prompt。 */
|
|
871
|
+
function isSessionReferenceContext(message) {
|
|
872
|
+
if (message.role !== 'user' || !isRecord(message.source))
|
|
873
|
+
return false;
|
|
874
|
+
return message.source.kind === 'session-reference' && message.source.form === 'recall';
|
|
875
|
+
}
|
|
625
876
|
function extractText(content) {
|
|
626
877
|
if (typeof content === 'string')
|
|
627
878
|
return content;
|
|
@@ -830,7 +1081,7 @@ function nativeEventType(value) {
|
|
|
830
1081
|
const record = asRecord(value);
|
|
831
1082
|
return typeof record?.type === 'string' ? record.type : undefined;
|
|
832
1083
|
}
|
|
833
|
-
function isMessage(value) { const record = asRecord(value); return (record?.role === 'user' || record?.role === 'assistant' || record?.role === 'system') && 'content' in record; }
|
|
1084
|
+
function isMessage(value) { const record = asRecord(value); return (record?.role === 'user' || record?.role === 'assistant' || record?.role === 'system' || record?.role === 'tool') && 'content' in record; }
|
|
834
1085
|
function isAbortSignal(value) { return asRecord(value)?.aborted === true || (asRecord(value)?.addEventListener instanceof Function); }
|
|
835
1086
|
function safeError(error) { return error instanceof Error ? error.message.slice(0, 512) : String(error).slice(0, 512); }
|
|
836
1087
|
//# sourceMappingURL=feature.js.map
|