@jingyi0605/codingns4dsh 0.2.0-rc3 → 0.2.1-beta.1
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 +6 -6
- package/README.md +42 -29
- package/data/build/dist/bootstrap/dsh-connection-adapter.d.ts +1 -1
- package/data/build/dist/bootstrap/dsh-connection-adapter.d.ts.map +1 -1
- package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.js +2 -2
- package/data/build/dist/bootstrap/dsh-peer-host-preboot-shim.js.map +1 -1
- package/data/build/dist/bootstrap/index.d.ts +1 -1
- package/data/build/dist/bootstrap/index.d.ts.map +1 -1
- package/data/build/dist/client/bundle.js +3164 -181
- 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 +3 -3
- package/data/build/dist/client/cli-catalog.js.map +1 -1
- package/data/build/dist/client/cli-slots.d.ts +4 -0
- package/data/build/dist/client/cli-slots.d.ts.map +1 -1
- package/data/build/dist/client/cli-slots.js +70 -9
- package/data/build/dist/client/cli-slots.js.map +1 -1
- package/data/build/dist/client/context-breakdown-dom.d.ts +1 -1
- package/data/build/dist/client/context-breakdown-dom.d.ts.map +1 -1
- package/data/build/dist/client/context-breakdown-dom.js +1 -1
- package/data/build/dist/client/context-breakdown-dom.js.map +1 -1
- package/data/build/dist/client/features/assistant-panel.d.ts +5 -0
- package/data/build/dist/client/features/assistant-panel.d.ts.map +1 -0
- package/data/build/dist/client/features/assistant-panel.js +127 -0
- package/data/build/dist/client/features/assistant-panel.js.map +1 -0
- package/data/build/dist/client/features/global-voice-assistant.d.ts +10 -0
- package/data/build/dist/client/features/global-voice-assistant.d.ts.map +1 -0
- package/data/build/dist/client/features/global-voice-assistant.js +330 -0
- package/data/build/dist/client/features/global-voice-assistant.js.map +1 -0
- package/data/build/dist/client/features/index.d.ts +2 -0
- package/data/build/dist/client/features/index.d.ts.map +1 -1
- package/data/build/dist/client/features/index.js +4 -0
- package/data/build/dist/client/features/index.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 +3 -1
- package/data/build/dist/client/features/lan-access.js.map +1 -1
- package/data/build/dist/client/features/types.d.ts +4 -1
- package/data/build/dist/client/features/types.d.ts.map +1 -1
- package/data/build/dist/client/features/voice-conversation-dialog.d.ts +20 -0
- package/data/build/dist/client/features/voice-conversation-dialog.d.ts.map +1 -0
- package/data/build/dist/client/features/voice-conversation-dialog.js +59 -0
- package/data/build/dist/client/features/voice-conversation-dialog.js.map +1 -0
- package/data/build/dist/client/features/voice-initialization-dialog.d.ts +10 -0
- package/data/build/dist/client/features/voice-initialization-dialog.d.ts.map +1 -0
- package/data/build/dist/client/features/voice-initialization-dialog.js +90 -0
- package/data/build/dist/client/features/voice-initialization-dialog.js.map +1 -0
- package/data/build/dist/client/features/workspace-session-enhancement-panel.d.ts.map +1 -1
- package/data/build/dist/client/features/workspace-session-enhancement-panel.js +57 -2
- 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 +27 -0
- package/data/build/dist/client/features/workspace-session-enhancement.js.map +1 -1
- package/data/build/dist/client/global-voice-runtime-registry.d.ts +27 -0
- package/data/build/dist/client/global-voice-runtime-registry.d.ts.map +1 -0
- package/data/build/dist/client/global-voice-runtime-registry.js +12 -0
- package/data/build/dist/client/global-voice-runtime-registry.js.map +1 -0
- package/data/build/dist/client/index.d.ts +1 -1
- package/data/build/dist/client/index.d.ts.map +1 -1
- package/data/build/dist/client/locale.d.ts.map +1 -1
- package/data/build/dist/client/locale.js +185 -1
- 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 +2 -0
- package/data/build/dist/client/locales/terminalAuth.js.map +1 -1
- package/data/build/dist/client/locales/usage.d.ts.map +1 -1
- package/data/build/dist/client/locales/usage.js +4 -0
- package/data/build/dist/client/locales/usage.js.map +1 -1
- package/data/build/dist/client/mobile-session-interaction.d.ts +9 -0
- package/data/build/dist/client/mobile-session-interaction.d.ts.map +1 -1
- package/data/build/dist/client/mobile-session-interaction.js +63 -0
- package/data/build/dist/client/mobile-session-interaction.js.map +1 -1
- package/data/build/dist/client/model-catalog-cache.d.ts +23 -0
- package/data/build/dist/client/model-catalog-cache.d.ts.map +1 -1
- package/data/build/dist/client/model-catalog-cache.js +81 -9
- package/data/build/dist/client/model-catalog-cache.js.map +1 -1
- package/data/build/dist/client/service-tier.d.ts +11 -0
- package/data/build/dist/client/service-tier.d.ts.map +1 -1
- package/data/build/dist/client/service-tier.js +15 -0
- package/data/build/dist/client/service-tier.js.map +1 -1
- package/data/build/dist/client/sherpa-voice-adapter.d.ts +46 -0
- package/data/build/dist/client/sherpa-voice-adapter.d.ts.map +1 -0
- package/data/build/dist/client/sherpa-voice-adapter.js +252 -0
- package/data/build/dist/client/sherpa-voice-adapter.js.map +1 -0
- package/data/build/dist/client/skill-command.d.ts +10 -0
- package/data/build/dist/client/skill-command.d.ts.map +1 -0
- package/data/build/dist/client/skill-command.js +258 -0
- package/data/build/dist/client/skill-command.js.map +1 -0
- package/data/build/dist/client/skill-reference-dom.d.ts +38 -0
- package/data/build/dist/client/skill-reference-dom.d.ts.map +1 -0
- package/data/build/dist/client/skill-reference-dom.js +187 -0
- package/data/build/dist/client/skill-reference-dom.js.map +1 -0
- package/data/build/dist/client/subscription-slot.d.ts.map +1 -1
- package/data/build/dist/client/subscription-slot.js +51 -3
- package/data/build/dist/client/subscription-slot.js.map +1 -1
- package/data/build/dist/client/terminal/model.d.ts +40 -2
- package/data/build/dist/client/terminal/model.d.ts.map +1 -1
- package/data/build/dist/client/terminal/model.js +151 -24
- package/data/build/dist/client/terminal/model.js.map +1 -1
- package/data/build/dist/client/terminal/styles.d.ts +8 -0
- package/data/build/dist/client/terminal/styles.d.ts.map +1 -1
- package/data/build/dist/client/terminal/styles.js +23 -2
- package/data/build/dist/client/terminal/styles.js.map +1 -1
- package/data/build/dist/client/terminal/ui.d.ts.map +1 -1
- package/data/build/dist/client/terminal/ui.js +161 -26
- package/data/build/dist/client/terminal/ui.js.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.d.ts.map +1 -1
- package/data/build/dist/client/terminal/xterm-view.js +218 -42
- package/data/build/dist/client/terminal/xterm-view.js.map +1 -1
- package/data/build/dist/client/voice-capture.d.ts +32 -0
- package/data/build/dist/client/voice-capture.d.ts.map +1 -0
- package/data/build/dist/client/voice-capture.js +158 -0
- package/data/build/dist/client/voice-capture.js.map +1 -0
- package/data/build/dist/client/voice-device-manager.d.ts +24 -0
- package/data/build/dist/client/voice-device-manager.d.ts.map +1 -0
- package/data/build/dist/client/voice-device-manager.js +197 -0
- package/data/build/dist/client/voice-device-manager.js.map +1 -0
- package/data/build/dist/client/voice-output.d.ts +14 -0
- package/data/build/dist/client/voice-output.d.ts.map +1 -0
- package/data/build/dist/client/voice-output.js +32 -0
- package/data/build/dist/client/voice-output.js.map +1 -0
- package/data/build/dist/client/voice-security.d.ts +8 -0
- package/data/build/dist/client/voice-security.d.ts.map +1 -0
- package/data/build/dist/client/voice-security.js +26 -0
- package/data/build/dist/client/voice-security.js.map +1 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts +12 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.d.ts.map +1 -1
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js +32 -0
- package/data/build/dist/dsh-capabilities/client/primitives-adapter.js.map +1 -1
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts +15 -0
- package/data/build/dist/host/cli-adapters/acp-cli-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js +39 -9
- package/data/build/dist/host/cli-adapters/acp-cli-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-driver.d.ts +39 -2
- package/data/build/dist/host/cli-adapters/antigravity-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-driver.js +198 -10
- package/data/build/dist/host/cli-adapters/antigravity-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/antigravity-subscription.d.ts +121 -0
- package/data/build/dist/host/cli-adapters/antigravity-subscription.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/antigravity-subscription.js +504 -0
- package/data/build/dist/host/cli-adapters/antigravity-subscription.js.map +1 -0
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts +21 -0
- package/data/build/dist/host/cli-adapters/claude-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/claude-driver.js +173 -7
- package/data/build/dist/host/cli-adapters/claude-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codebuddy-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codebuddy-driver.js +4 -0
- package/data/build/dist/host/cli-adapters/codebuddy-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts +28 -2
- package/data/build/dist/host/cli-adapters/codex-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/codex-driver.js +234 -5
- package/data/build/dist/host/cli-adapters/codex-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/command-code-subscription.js +7 -4
- package/data/build/dist/host/cli-adapters/command-code-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/cursor-driver.d.ts +9 -0
- package/data/build/dist/host/cli-adapters/cursor-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/cursor-driver.js +72 -2
- package/data/build/dist/host/cli-adapters/cursor-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/driver.d.ts +21 -1
- 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 +15 -3
- package/data/build/dist/host/cli-adapters/dsh-message-projector.js.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 +18 -1
- 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 +4 -0
- 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 +4 -0
- 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.map +1 -1
- 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 +6 -6
- package/data/build/dist/host/cli-adapters/kimi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/mcode-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/mcode-driver.js +2 -0
- package/data/build/dist/host/cli-adapters/mcode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/model-catalog.d.ts +49 -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 +126 -0
- package/data/build/dist/host/cli-adapters/model-catalog.js.map +1 -1
- package/data/build/dist/host/cli-adapters/opencode-driver.d.ts +11 -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 +92 -8
- package/data/build/dist/host/cli-adapters/opencode-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/pi-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/pi-driver.js +4 -0
- package/data/build/dist/host/cli-adapters/pi-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.d.ts +10 -3
- package/data/build/dist/host/cli-adapters/process-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/process-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts +4 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.js +8 -1
- package/data/build/dist/host/cli-adapters/provider-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-driver.d.ts +15 -0
- package/data/build/dist/host/cli-adapters/qoder-driver.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-driver.js +171 -3
- package/data/build/dist/host/cli-adapters/qoder-driver.js.map +1 -1
- package/data/build/dist/host/cli-adapters/qoder-subscription.js +3 -1
- package/data/build/dist/host/cli-adapters/qoder-subscription.js.map +1 -1
- package/data/build/dist/host/cli-adapters/reasoning-content.d.ts +11 -0
- package/data/build/dist/host/cli-adapters/reasoning-content.d.ts.map +1 -0
- package/data/build/dist/host/cli-adapters/reasoning-content.js +79 -0
- package/data/build/dist/host/cli-adapters/reasoning-content.js.map +1 -0
- package/data/build/dist/host/cli-adapters/registry.d.ts +24 -1
- package/data/build/dist/host/cli-adapters/registry.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/registry.js +109 -4
- package/data/build/dist/host/cli-adapters/registry.js.map +1 -1
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.d.ts +3 -2
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.d.ts.map +1 -1
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.js +8 -2
- package/data/build/dist/host/cli-adapters/rpc-driver-utils.js.map +1 -1
- package/data/build/dist/host/cli-adapters/standard-stream-driver.d.ts +3 -2
- 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 +14 -2
- package/data/build/dist/host/cli-adapters/standard-stream-driver.js.map +1 -1
- package/data/build/dist/host/cli-bridge/injections.d.ts +10 -1
- package/data/build/dist/host/cli-bridge/injections.d.ts.map +1 -1
- package/data/build/dist/host/cli-bridge/injections.js +28 -8
- package/data/build/dist/host/cli-bridge/injections.js.map +1 -1
- package/data/build/dist/host/features/assistant-dispatch.d.ts +45 -0
- package/data/build/dist/host/features/assistant-dispatch.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-dispatch.js +49 -0
- package/data/build/dist/host/features/assistant-dispatch.js.map +1 -0
- package/data/build/dist/host/features/assistant-intent.d.ts +46 -0
- package/data/build/dist/host/features/assistant-intent.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-intent.js +149 -0
- package/data/build/dist/host/features/assistant-intent.js.map +1 -0
- package/data/build/dist/host/features/assistant-scope-settings.d.ts +25 -0
- package/data/build/dist/host/features/assistant-scope-settings.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-scope-settings.js +33 -0
- package/data/build/dist/host/features/assistant-scope-settings.js.map +1 -0
- package/data/build/dist/host/features/assistant-scope.d.ts +79 -0
- package/data/build/dist/host/features/assistant-scope.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-scope.js +107 -0
- package/data/build/dist/host/features/assistant-scope.js.map +1 -0
- package/data/build/dist/host/features/assistant-session-index.d.ts +44 -0
- package/data/build/dist/host/features/assistant-session-index.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-session-index.js +109 -0
- package/data/build/dist/host/features/assistant-session-index.js.map +1 -0
- package/data/build/dist/host/features/assistant-summary.d.ts +28 -0
- package/data/build/dist/host/features/assistant-summary.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-summary.js +166 -0
- package/data/build/dist/host/features/assistant-summary.js.map +1 -0
- package/data/build/dist/host/features/assistant-voice-stream.d.ts +10 -0
- package/data/build/dist/host/features/assistant-voice-stream.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-voice-stream.js +106 -0
- package/data/build/dist/host/features/assistant-voice-stream.js.map +1 -0
- package/data/build/dist/host/features/assistant-voice-turn.d.ts +27 -0
- package/data/build/dist/host/features/assistant-voice-turn.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-voice-turn.js +54 -0
- package/data/build/dist/host/features/assistant-voice-turn.js.map +1 -0
- package/data/build/dist/host/features/assistant-waiting-state.d.ts +14 -0
- package/data/build/dist/host/features/assistant-waiting-state.d.ts.map +1 -0
- package/data/build/dist/host/features/assistant-waiting-state.js +17 -0
- package/data/build/dist/host/features/assistant-waiting-state.js.map +1 -0
- package/data/build/dist/host/features/global-voice-coordinator.d.ts +55 -0
- package/data/build/dist/host/features/global-voice-coordinator.d.ts.map +1 -0
- package/data/build/dist/host/features/global-voice-coordinator.js +221 -0
- package/data/build/dist/host/features/global-voice-coordinator.js.map +1 -0
- package/data/build/dist/host/features/global-voice-rpc.d.ts +25 -0
- package/data/build/dist/host/features/global-voice-rpc.d.ts.map +1 -0
- package/data/build/dist/host/features/global-voice-rpc.js +862 -0
- package/data/build/dist/host/features/global-voice-rpc.js.map +1 -0
- package/data/build/dist/host/features/index.d.ts +10 -0
- package/data/build/dist/host/features/index.d.ts.map +1 -1
- package/data/build/dist/host/features/index.js +10 -0
- package/data/build/dist/host/features/index.js.map +1 -1
- package/data/build/dist/host/features/peer-host.d.ts +5 -0
- package/data/build/dist/host/features/peer-host.d.ts.map +1 -1
- package/data/build/dist/host/features/peer-host.js +232 -2
- package/data/build/dist/host/features/peer-host.js.map +1 -1
- package/data/build/dist/host/features/sherpa-voice-runtime.d.ts +42 -0
- package/data/build/dist/host/features/sherpa-voice-runtime.d.ts.map +1 -0
- package/data/build/dist/host/features/sherpa-voice-runtime.js +193 -0
- package/data/build/dist/host/features/sherpa-voice-runtime.js.map +1 -0
- package/data/build/dist/host/features/types.d.ts +26 -0
- package/data/build/dist/host/features/types.d.ts.map +1 -1
- package/data/build/dist/host/features/voice-agent-actions.d.ts +26 -0
- package/data/build/dist/host/features/voice-agent-actions.d.ts.map +1 -0
- package/data/build/dist/host/features/voice-agent-actions.js +128 -0
- package/data/build/dist/host/features/voice-agent-actions.js.map +1 -0
- package/data/build/dist/host/features/voice-agent-service.d.ts +117 -0
- package/data/build/dist/host/features/voice-agent-service.d.ts.map +1 -0
- package/data/build/dist/host/features/voice-agent-service.js +243 -0
- package/data/build/dist/host/features/voice-agent-service.js.map +1 -0
- package/data/build/dist/host/features/voice-model-setup.d.ts +20 -0
- package/data/build/dist/host/features/voice-model-setup.d.ts.map +1 -0
- package/data/build/dist/host/features/voice-model-setup.js +89 -0
- package/data/build/dist/host/features/voice-model-setup.js.map +1 -0
- package/data/build/dist/host/index.d.ts +2 -2
- package/data/build/dist/host/index.d.ts.map +1 -1
- package/data/build/dist/host/index.js +7 -1
- package/data/build/dist/host/index.js.map +1 -1
- package/data/build/dist/host/lan-access-dsh.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.d.ts.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.js +53 -2
- package/data/build/dist/host/modules/peer-host/peer-host-native-dispatch.js.map +1 -1
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js +15 -1
- package/data/build/dist/host/modules/peer-host/peer-host-remote-summary-source.js.map +1 -1
- package/data/build/dist/host/native-session-bridge.d.ts +2 -0
- package/data/build/dist/host/native-session-bridge.d.ts.map +1 -1
- package/data/build/dist/host/native-session-bridge.js +1 -0
- package/data/build/dist/host/native-session-bridge.js.map +1 -1
- package/data/build/dist/host/rpc.d.ts.map +1 -1
- package/data/build/dist/host/rpc.js +9 -4
- 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 +19 -1
- package/data/build/dist/host/settings.js.map +1 -1
- package/data/build/dist/host/terminal/backends/conpty-backend.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 +4 -0
- package/data/build/dist/host/terminal/terminal-controller.js.map +1 -1
- package/data/build/dist/host/terminal/terminal-service.d.ts +21 -1
- package/data/build/dist/host/terminal/terminal-service.d.ts.map +1 -1
- package/data/build/dist/host/terminal/terminal-service.js +118 -7
- 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 +1 -1
- package/data/build/dist/index.js.map +1 -1
- package/data/build/dist/shared/contracts/assistant.d.ts +70 -0
- package/data/build/dist/shared/contracts/assistant.d.ts.map +1 -0
- package/data/build/dist/shared/contracts/assistant.js +2 -0
- package/data/build/dist/shared/contracts/assistant.js.map +1 -0
- package/data/build/dist/shared/contracts/cli-adapter.d.ts +33 -1
- package/data/build/dist/shared/contracts/cli-adapter.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.d.ts +30 -0
- package/data/build/dist/shared/contracts/config.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/config.js +20 -0
- package/data/build/dist/shared/contracts/config.js.map +1 -1
- package/data/build/dist/shared/contracts/errors.d.ts +2 -2
- package/data/build/dist/shared/contracts/errors.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/subscription.d.ts +30 -0
- 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 +2 -0
- package/data/build/dist/shared/contracts/terminal.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/version.d.ts +12 -5
- package/data/build/dist/shared/contracts/version.d.ts.map +1 -1
- package/data/build/dist/shared/contracts/version.js +11 -4
- package/data/build/dist/shared/contracts/version.js.map +1 -1
- package/data/build/dist/shared/contracts/voice-runtime.d.ts +90 -0
- package/data/build/dist/shared/contracts/voice-runtime.d.ts.map +1 -0
- package/data/build/dist/shared/contracts/voice-runtime.js +16 -0
- package/data/build/dist/shared/contracts/voice-runtime.js.map +1 -0
- package/data/build/dist/shared/index.d.ts +8 -2
- package/data/build/dist/shared/index.d.ts.map +1 -1
- package/data/build/dist/shared/index.js +5 -1
- package/data/build/dist/shared/index.js.map +1 -1
- package/data/build/dist/shared/voice-models.d.ts +21 -0
- package/data/build/dist/shared/voice-models.d.ts.map +1 -0
- package/data/build/dist/shared/voice-models.js +27 -0
- package/data/build/dist/shared/voice-models.js.map +1 -0
- package/data/build/dist/shared/voice-stream.d.ts +42 -0
- package/data/build/dist/shared/voice-stream.d.ts.map +1 -0
- package/data/build/dist/shared/voice-stream.js +99 -0
- package/data/build/dist/shared/voice-stream.js.map +1 -0
- package/data/build/dist/shared/voice-text.d.ts +3 -0
- package/data/build/dist/shared/voice-text.d.ts.map +1 -0
- package/data/build/dist/shared/voice-text.js +14 -0
- package/data/build/dist/shared/voice-text.js.map +1 -0
- package/data/build/dist/typert.host.d.ts.map +1 -1
- package/data/build/dist/typert.host.js +1 -0
- package/data/build/dist/typert.host.js.map +1 -1
- package/package.json +56 -26
- package/profile/README.md +8 -5
- package/profile/package.json +5 -3
- package/profile/version.json +3 -3
- package/version.json +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { spawn, spawnSync } from 'node:child_process';
|
|
2
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { createHash, randomUUID } from 'node:crypto';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
3
4
|
import { homedir } from 'node:os';
|
|
4
5
|
import { basename, join, resolve } from 'node:path';
|
|
5
6
|
import { JsonRpcProcess, JsonRpcRequestError } from './json-rpc-process.js';
|
|
@@ -18,7 +19,7 @@ const CODEX_COMPACTION_TIMEOUT_MS = 60_000;
|
|
|
18
19
|
const CODEX_APP_SERVER_ARGS = ['app-server', '--disable', 'computer_use'];
|
|
19
20
|
/** Codex app-server 的 JSON-RPC 驱动,Host 只暴露统一文本流,不暴露线程和 token。 */
|
|
20
21
|
export class CodexAppServerDriver {
|
|
21
|
-
descriptor = { id: 'codex', name: 'Codex', protocol: 'json-rpc', capabilities: ['models', 'stream', 'resume', 'interrupt', 'tool-events', 'reasoning', 'usage', 'permission', 'questions', 'steer'] };
|
|
22
|
+
descriptor = { id: 'codex', name: 'Codex', protocol: 'json-rpc', capabilities: ['models', 'skills', 'stream', 'resume', 'interrupt', 'tool-events', 'reasoning', 'usage', 'permission', 'questions', 'steer'] };
|
|
22
23
|
// Codex 一个 Provider turn 可能同时包含多个工具调用。只有 assistant item
|
|
23
24
|
// 切换后才分段,不能在每个工具完成后注入下一 step。
|
|
24
25
|
supportsSegmentedTurns = true;
|
|
@@ -26,6 +27,8 @@ export class CodexAppServerDriver {
|
|
|
26
27
|
runSpawnSync;
|
|
27
28
|
runSpawn;
|
|
28
29
|
sessionRoots;
|
|
30
|
+
/** Codex 配置根目录;`config.toml` 与 `auth.json` 都位于这里。 */
|
|
31
|
+
codexHome;
|
|
29
32
|
cachedBinary = null;
|
|
30
33
|
processes = new Set();
|
|
31
34
|
sessions = new Map();
|
|
@@ -34,8 +37,33 @@ export class CodexAppServerDriver {
|
|
|
34
37
|
this.runSpawnSync = options.spawnSync ?? spawnSync;
|
|
35
38
|
this.runSpawn = options.spawn ?? spawn;
|
|
36
39
|
const codexHome = process.env.CODEX_HOME ?? join(homedir(), '.codex');
|
|
40
|
+
this.codexHome = codexHome;
|
|
37
41
|
this.sessionRoots = options.sessionRoots ?? [join(codexHome, 'sessions'), join(codexHome, 'archived_sessions')];
|
|
38
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Codex 目录语义指纹。
|
|
45
|
+
*
|
|
46
|
+
* 目录里的 `officialSubscription` 与 `defaultServiceTier` 完全由 `config.toml`
|
|
47
|
+
* 的 `model_provider` / `openai_base_url` / `service_tier` 和 `auth.json` 的登录
|
|
48
|
+
* 模式决定。用户在 cc-switch 之类的工具里切供应商时,只改写这两个文件,
|
|
49
|
+
* `codex` 可执行文件不变,安装探测指纹也就不会变——若不单独比对它们,
|
|
50
|
+
* 10 分钟 TTL 的目录缓存会把「第三方」判定一直沿用下去,官方订阅的 Fast
|
|
51
|
+
* 档位开关就会长期不出现。
|
|
52
|
+
*
|
|
53
|
+
* 只对解析出的**非敏感字段**做哈希:`auth.json` 里的 token 永远不进入指纹,
|
|
54
|
+
* 因此这里返回的内容不能反推凭据。
|
|
55
|
+
*/
|
|
56
|
+
catalogFingerprint() {
|
|
57
|
+
const config = readTextFile(join(this.codexHome, 'config.toml'));
|
|
58
|
+
const auth = readTextFile(join(this.codexHome, 'auth.json'));
|
|
59
|
+
// 两个文件都读不到时返回 undefined,表示无法判断;Registry 不会据此失效缓存,
|
|
60
|
+
// 避免在非标准部署下把目录变成每次都重新探测。
|
|
61
|
+
if (config === undefined && auth === undefined)
|
|
62
|
+
return undefined;
|
|
63
|
+
const configSummary = config === undefined ? 'missing' : summarizeCodexConfig(config);
|
|
64
|
+
const authSummary = auth === undefined ? 'missing' : summarizeCodexAuth(auth);
|
|
65
|
+
return createHash('sha256').update(`${configSummary}\u0000${authSummary}`).digest('hex').slice(0, 16);
|
|
66
|
+
}
|
|
39
67
|
async detect() {
|
|
40
68
|
const result = await detectBinary({ binaries: this.binaries, spawnSync: this.runSpawnSync });
|
|
41
69
|
if (result.installed)
|
|
@@ -92,6 +120,27 @@ export class CodexAppServerDriver {
|
|
|
92
120
|
},
|
|
93
121
|
});
|
|
94
122
|
}
|
|
123
|
+
/**
|
|
124
|
+
* 读取 Codex 当前工作目录的 Skill 目录。
|
|
125
|
+
*
|
|
126
|
+
* Skill 路径和内容只在本驱动缓存,Client 只能拿到可展示的摘要;这样既能
|
|
127
|
+
* 给 DSH `/skills` 提供目录,也不会把任意本地绝对路径变成浏览器输入。
|
|
128
|
+
*/
|
|
129
|
+
async listSkills(input) {
|
|
130
|
+
const command = this.cachedBinary ?? (await this.detect()).command;
|
|
131
|
+
if (command === null)
|
|
132
|
+
return [];
|
|
133
|
+
const sessionInput = {
|
|
134
|
+
sessionId: input.sessionId,
|
|
135
|
+
messages: [],
|
|
136
|
+
prompt: '',
|
|
137
|
+
...(input.cwd === undefined ? {} : { cwd: input.cwd }),
|
|
138
|
+
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
139
|
+
};
|
|
140
|
+
const session = await this.getSession(sessionInput, command);
|
|
141
|
+
await this.refreshSkillCatalog(session, input.cwd, input.forceReload === true, input.signal);
|
|
142
|
+
return [...session.skills.values()].map(({ path: _path, ...descriptor }) => descriptor);
|
|
143
|
+
}
|
|
95
144
|
async *executeTurn(input) {
|
|
96
145
|
const command = this.cachedBinary ?? (await this.detect()).command;
|
|
97
146
|
if (command === null)
|
|
@@ -516,16 +565,50 @@ export class CodexAppServerDriver {
|
|
|
516
565
|
}
|
|
517
566
|
/** turn/start 遇到上下文超限时压缩一次并重试,兼容关闭自动压缩的 Codex 配置。 */
|
|
518
567
|
async startTurn(session, input) {
|
|
568
|
+
await this.prepareSkillInputs(session, input);
|
|
519
569
|
try {
|
|
520
|
-
return await session.rpc.request('turn/start', codexTurnStartParams(input, session.threadId), { signal: input.signal, killOnAbort: false });
|
|
570
|
+
return await session.rpc.request('turn/start', codexTurnStartParams(input, session.threadId, session.skills), { signal: input.signal, killOnAbort: false });
|
|
521
571
|
}
|
|
522
572
|
catch (error) {
|
|
523
573
|
if (!isContextWindowError(error))
|
|
524
574
|
throw error;
|
|
525
575
|
await this.compactThread(session, input);
|
|
526
|
-
return session.rpc.request('turn/start', codexTurnStartParams(input, session.threadId), { signal: input.signal, killOnAbort: false });
|
|
576
|
+
return session.rpc.request('turn/start', codexTurnStartParams(input, session.threadId, session.skills), { signal: input.signal, killOnAbort: false });
|
|
527
577
|
}
|
|
528
578
|
}
|
|
579
|
+
/** 只为显式 `/skill-name` 或 `$skill-name` 预取目录;没有显式调用时保留 Codex 自己的隐式匹配。 */
|
|
580
|
+
async prepareSkillInputs(session, input) {
|
|
581
|
+
const names = codexSkillNames(input.prompt);
|
|
582
|
+
if (names.length === 0)
|
|
583
|
+
return;
|
|
584
|
+
const cwd = input.cwd ?? process.cwd();
|
|
585
|
+
if (session.skillsCwd !== cwd)
|
|
586
|
+
session.skills.clear();
|
|
587
|
+
if (session.skillsCwd !== cwd || session.skills.size === 0) {
|
|
588
|
+
try {
|
|
589
|
+
await this.refreshSkillCatalog(session, cwd, false, input.signal);
|
|
590
|
+
}
|
|
591
|
+
catch (error) {
|
|
592
|
+
// 旧版 app-server 可能还没有 skills/list;保留原始 Skill 文本,让 Codex
|
|
593
|
+
// 继续走它自己的解析路径,而不是把一次能力探测失败变成整轮失败。
|
|
594
|
+
if (!isMethodNotFound(error))
|
|
595
|
+
throw error;
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
async refreshSkillCatalog(session, cwd, forceReload, signal) {
|
|
601
|
+
const resolvedCwd = cwd ?? process.cwd();
|
|
602
|
+
const response = await session.rpc.request('skills/list', {
|
|
603
|
+
cwds: [resolvedCwd],
|
|
604
|
+
...(forceReload ? { forceReload: true } : {}),
|
|
605
|
+
}, { signal, killOnAbort: false });
|
|
606
|
+
const entries = parseCodexSkills(response, resolvedCwd);
|
|
607
|
+
session.skills.clear();
|
|
608
|
+
for (const entry of entries)
|
|
609
|
+
session.skills.set(entry.name, entry);
|
|
610
|
+
session.skillsCwd = resolvedCwd;
|
|
611
|
+
}
|
|
529
612
|
/** thread/compact/start 立即返回,真正完成由 contextCompaction turn 的终态通知表示。 */
|
|
530
613
|
async compactThread(session, input) {
|
|
531
614
|
if (session.compacting !== undefined)
|
|
@@ -754,9 +837,18 @@ export class CodexAppServerDriver {
|
|
|
754
837
|
suppressedCompactionTurnIds: new Set(),
|
|
755
838
|
pendingCompactionEvents: [],
|
|
756
839
|
autoCompaction: undefined,
|
|
840
|
+
skillsCwd: undefined,
|
|
841
|
+
skills: new Map(),
|
|
757
842
|
};
|
|
758
843
|
this.processes.add(rpc);
|
|
759
844
|
this.sessions.set(input.sessionId, session);
|
|
845
|
+
// Codex 目录发生变化时丢弃 Host 侧路径缓存;下一次显式调用会重新读取目录。
|
|
846
|
+
rpc.addNotificationListener((message) => {
|
|
847
|
+
if (message.method !== 'skills/changed')
|
|
848
|
+
return;
|
|
849
|
+
session.skills.clear();
|
|
850
|
+
session.skillsCwd = undefined;
|
|
851
|
+
});
|
|
760
852
|
await rpc.request('initialize', { clientInfo: { name: 'codingns4dsh', version: '0.1.1' }, capabilities: { experimentalApi: true } }, { signal: input.signal, killOnAbort: false });
|
|
761
853
|
rpc.notify('initialized', {});
|
|
762
854
|
rpc.setServerRequestHandler((request) => {
|
|
@@ -944,6 +1036,76 @@ async function readCodexOfficialSubscription(rpc, signal) {
|
|
|
944
1036
|
return undefined;
|
|
945
1037
|
}
|
|
946
1038
|
}
|
|
1039
|
+
/** 同步读取文本文件;不存在或不可读时返回 undefined,调用方按“无法判断”处理。 */
|
|
1040
|
+
function readTextFile(path) {
|
|
1041
|
+
try {
|
|
1042
|
+
return readFileSync(path, 'utf8');
|
|
1043
|
+
}
|
|
1044
|
+
catch {
|
|
1045
|
+
return undefined;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
/**
|
|
1049
|
+
* 从 `config.toml` 摘出影响目录语义的字段。
|
|
1050
|
+
*
|
|
1051
|
+
* 这里刻意不做完整 TOML 解析:只需覆盖两种常见写法——顶层 `key = "value"`,
|
|
1052
|
+
* 以及 `[model_providers.xxx]` 段内的 `base_url`。手写正则比引入解析依赖更稳,
|
|
1053
|
+
* 也不会因为 Codex 新增字段而改变指纹。凭据不在 config.toml 中,无需脱敏。
|
|
1054
|
+
*/
|
|
1055
|
+
function summarizeCodexConfig(config) {
|
|
1056
|
+
const fields = [];
|
|
1057
|
+
let section = '';
|
|
1058
|
+
for (const rawLine of config.split(/\r?\n/u)) {
|
|
1059
|
+
const line = rawLine.trim();
|
|
1060
|
+
if (line === '' || line.startsWith('#'))
|
|
1061
|
+
continue;
|
|
1062
|
+
const sectionMatch = line.match(/^\[(?<name>[^\]]+)\]$/u);
|
|
1063
|
+
if (sectionMatch !== null) {
|
|
1064
|
+
section = sectionMatch.groups?.name?.trim() ?? '';
|
|
1065
|
+
continue;
|
|
1066
|
+
}
|
|
1067
|
+
const assignment = line.match(/^(?<key>[A-Za-z0-9_.-]+)\s*=\s*(?<value>.*)$/u);
|
|
1068
|
+
if (assignment === null)
|
|
1069
|
+
continue;
|
|
1070
|
+
const key = assignment.groups?.key ?? '';
|
|
1071
|
+
const value = (assignment.groups?.value ?? '').trim();
|
|
1072
|
+
// 顶层:决定 Provider 与档位;Provider 段内:只有 base_url 影响上游身份。
|
|
1073
|
+
const topLevelKeys = ['model_provider', 'model', 'service_tier', 'openai_base_url', 'profile'];
|
|
1074
|
+
const isTopLevel = section === '' && topLevelKeys.includes(key);
|
|
1075
|
+
const isProviderBaseUrl = section.startsWith('model_providers.') && key === 'base_url';
|
|
1076
|
+
if (!isTopLevel && !isProviderBaseUrl)
|
|
1077
|
+
continue;
|
|
1078
|
+
fields.push(`${section}.${key}=${value}`);
|
|
1079
|
+
}
|
|
1080
|
+
return fields.join('\n');
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* 从 `auth.json` 摘出登录模式,**不读取任何凭据**。
|
|
1084
|
+
*
|
|
1085
|
+
* 官方订阅与 API key 两种登录方式的 `auth_mode` 不同;`OPENAI_API_KEY` 只取
|
|
1086
|
+
* 「有没有设置」这一位布尔信息,token 与 key 原文永远不进入指纹。
|
|
1087
|
+
*/
|
|
1088
|
+
function summarizeCodexAuth(auth) {
|
|
1089
|
+
let parsed;
|
|
1090
|
+
try {
|
|
1091
|
+
parsed = JSON.parse(auth);
|
|
1092
|
+
}
|
|
1093
|
+
catch {
|
|
1094
|
+
// auth.json 不是合法 JSON(例如切换过程中被截断):用长度当指纹,
|
|
1095
|
+
// 下一次读取到完整文件时指纹自然变化并触发失效。
|
|
1096
|
+
return `invalid:${auth.length}`;
|
|
1097
|
+
}
|
|
1098
|
+
if (!isRecord(parsed))
|
|
1099
|
+
return 'invalid:not-object';
|
|
1100
|
+
const mode = typeof parsed.auth_mode === 'string' ? parsed.auth_mode : 'unknown';
|
|
1101
|
+
const hasApiKey = typeof parsed.OPENAI_API_KEY === 'string' && parsed.OPENAI_API_KEY.trim() !== '';
|
|
1102
|
+
// 只比较 token 的“有无”与 account_id 是否变化,不比较 token 内容:
|
|
1103
|
+
// 官方订阅每次刷新都会轮换 access_token,把 token 纳入指纹会让目录每次刷新都失效。
|
|
1104
|
+
const tokens = isRecord(parsed.tokens) ? parsed.tokens : undefined;
|
|
1105
|
+
const hasTokens = tokens !== undefined && typeof tokens.refresh_token === 'string';
|
|
1106
|
+
const accountId = tokens !== undefined && typeof tokens.account_id === 'string' ? tokens.account_id : '';
|
|
1107
|
+
return `${mode}|apiKey=${hasApiKey}|tokens=${hasTokens}|account=${accountId}`;
|
|
1108
|
+
}
|
|
947
1109
|
function codexMessageToChunk(message) {
|
|
948
1110
|
const params = isRecord(message.params) ? message.params : message;
|
|
949
1111
|
const item = isRecord(params.item) ? params.item : params;
|
|
@@ -1464,7 +1626,7 @@ function codexServiceTier(value) {
|
|
|
1464
1626
|
const tier = value?.trim();
|
|
1465
1627
|
return tier === undefined || tier === '' ? undefined : tier;
|
|
1466
1628
|
}
|
|
1467
|
-
function codexTurnStartParams(input, threadId) {
|
|
1629
|
+
function codexTurnStartParams(input, threadId, skills) {
|
|
1468
1630
|
const cwd = resolve(input.cwd ?? process.cwd());
|
|
1469
1631
|
const inputBlocks = [];
|
|
1470
1632
|
const attachments = input.attachments ?? [];
|
|
@@ -1474,6 +1636,12 @@ function codexTurnStartParams(input, threadId) {
|
|
|
1474
1636
|
if (attachment.kind === 'image')
|
|
1475
1637
|
inputBlocks.push({ type: 'localImage', path: attachment.path });
|
|
1476
1638
|
}
|
|
1639
|
+
for (const name of codexSkillNames(input.prompt)) {
|
|
1640
|
+
const skill = skills.get(name);
|
|
1641
|
+
if (skill?.enabled !== true || skill.path === undefined)
|
|
1642
|
+
continue;
|
|
1643
|
+
inputBlocks.push({ type: 'skill', name: skill.name, path: skill.path });
|
|
1644
|
+
}
|
|
1477
1645
|
return {
|
|
1478
1646
|
threadId,
|
|
1479
1647
|
input: inputBlocks,
|
|
@@ -1483,6 +1651,67 @@ function codexTurnStartParams(input, threadId) {
|
|
|
1483
1651
|
...(input.effortId ? { effort: input.effortId } : {}),
|
|
1484
1652
|
};
|
|
1485
1653
|
}
|
|
1654
|
+
/** 从用户文本提取显式 Skill mention,兼容 DSH 原生 `/name` 与旧版 `$name` 写法。 */
|
|
1655
|
+
function codexSkillNames(prompt) {
|
|
1656
|
+
const names = [];
|
|
1657
|
+
const seen = new Set();
|
|
1658
|
+
for (const match of prompt.matchAll(/(?:^|\s)(?:\$|\/)([A-Za-z0-9][A-Za-z0-9._-]*)(?=\s|$)/gu)) {
|
|
1659
|
+
const name = match[1]?.trim();
|
|
1660
|
+
if (name === undefined || name === '' || seen.has(name))
|
|
1661
|
+
continue;
|
|
1662
|
+
seen.add(name);
|
|
1663
|
+
names.push(name);
|
|
1664
|
+
}
|
|
1665
|
+
return names;
|
|
1666
|
+
}
|
|
1667
|
+
/** 兼容不同 Codex app-server 版本的 `skills/list` 响应包装。 */
|
|
1668
|
+
function parseCodexSkills(value, cwd) {
|
|
1669
|
+
const root = isRecord(value) && Array.isArray(value.data) ? value.data : [];
|
|
1670
|
+
const normalizedCwd = resolve(cwd);
|
|
1671
|
+
const scoped = root
|
|
1672
|
+
.filter(isRecord)
|
|
1673
|
+
.find((item) => typeof item.cwd === 'string' && resolve(item.cwd) === normalizedCwd);
|
|
1674
|
+
// 当前请求只传了一个 cwd。部分 Codex 版本会返回规范化前后的路径,
|
|
1675
|
+
// 甚至省略 cwd;此时唯一作用域就是本次请求的结果,不能把它误判成空目录。
|
|
1676
|
+
const singleScope = root.length === 1 && isRecord(root[0]) && Array.isArray(root[0].skills);
|
|
1677
|
+
const rawSkills = Array.isArray(scoped?.skills)
|
|
1678
|
+
? scoped.skills
|
|
1679
|
+
: singleScope
|
|
1680
|
+
? root[0].skills
|
|
1681
|
+
: root.every((item) => isRecord(item) && typeof item.name === 'string')
|
|
1682
|
+
? root
|
|
1683
|
+
: [];
|
|
1684
|
+
const result = [];
|
|
1685
|
+
for (const raw of rawSkills) {
|
|
1686
|
+
if (!isRecord(raw))
|
|
1687
|
+
continue;
|
|
1688
|
+
const name = typeof raw.name === 'string' ? raw.name.trim() : '';
|
|
1689
|
+
if (name === '')
|
|
1690
|
+
continue;
|
|
1691
|
+
const interfaceInfo = isRecord(raw.interface) ? raw.interface : null;
|
|
1692
|
+
const description = firstNonEmptyString(raw.description, interfaceInfo?.shortDescription, interfaceInfo?.displayName, name) ?? name;
|
|
1693
|
+
const displayName = firstNonEmptyString(interfaceInfo?.displayName);
|
|
1694
|
+
const path = firstNonEmptyString(raw.path, raw.skillPath);
|
|
1695
|
+
if (result.some((item) => item.name === name))
|
|
1696
|
+
continue;
|
|
1697
|
+
result.push({
|
|
1698
|
+
id: name,
|
|
1699
|
+
name,
|
|
1700
|
+
description,
|
|
1701
|
+
enabled: raw.enabled !== false,
|
|
1702
|
+
...(displayName === undefined ? {} : { displayName }),
|
|
1703
|
+
...(path === undefined ? {} : { path }),
|
|
1704
|
+
});
|
|
1705
|
+
}
|
|
1706
|
+
return result;
|
|
1707
|
+
}
|
|
1708
|
+
function firstNonEmptyString(...values) {
|
|
1709
|
+
for (const value of values) {
|
|
1710
|
+
if (typeof value === 'string' && value.trim() !== '')
|
|
1711
|
+
return value.trim();
|
|
1712
|
+
}
|
|
1713
|
+
return undefined;
|
|
1714
|
+
}
|
|
1486
1715
|
/**
|
|
1487
1716
|
* 由 DSH 会话权限状态派生 Codex 原生沙箱模式。
|
|
1488
1717
|
*
|