@toddzheng024/dscode-desktop 0.0.0-stage → 0.7.33
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/LICENSE +21 -0
- package/README.md +120 -2
- package/THIRD_PARTY_NOTICES.md +30 -0
- package/bin/apply_patch +9 -0
- package/cordis.patch.yml +433 -0
- package/docs/CHANGELOG.md +641 -0
- package/docs/account-login.md +44 -0
- package/docs/auto-review.md +128 -0
- package/docs/browser-use.md +783 -0
- package/docs/computer-use.md +81 -0
- package/docs/custom-providers.md +88 -0
- package/docs/demo.md +76 -0
- package/docs/distribution.md +58 -0
- package/docs/dscode-ultra.md +75 -0
- package/docs/email.md +296 -0
- package/docs/exec.md +40 -0
- package/docs/hub-distribution.md +190 -0
- package/docs/memory.md +121 -0
- package/docs/opencode-go.md +61 -0
- package/docs/plugin-hub.md +68 -0
- package/docs/releases/0.2.0.md +28 -0
- package/docs/releases/0.3.0.md +21 -0
- package/docs/releases/0.4.0.md +20 -0
- package/docs/releases/0.5.0.md +19 -0
- package/docs/releases/0.6.0.md +20 -0
- package/docs/releases/0.7.0.md +22 -0
- package/docs/releases/0.7.1.md +20 -0
- package/docs/releases/0.7.10.md +10 -0
- package/docs/releases/0.7.11.md +17 -0
- package/docs/releases/0.7.12.md +11 -0
- package/docs/releases/0.7.13.md +12 -0
- package/docs/releases/0.7.14.md +11 -0
- package/docs/releases/0.7.15.md +11 -0
- package/docs/releases/0.7.16.md +10 -0
- package/docs/releases/0.7.17.md +12 -0
- package/docs/releases/0.7.18.md +13 -0
- package/docs/releases/0.7.19.md +8 -0
- package/docs/releases/0.7.2.md +19 -0
- package/docs/releases/0.7.20.md +10 -0
- package/docs/releases/0.7.21.md +9 -0
- package/docs/releases/0.7.22.md +11 -0
- package/docs/releases/0.7.23.md +14 -0
- package/docs/releases/0.7.24.md +11 -0
- package/docs/releases/0.7.25.md +8 -0
- package/docs/releases/0.7.26.md +18 -0
- package/docs/releases/0.7.27.md +8 -0
- package/docs/releases/0.7.28.md +22 -0
- package/docs/releases/0.7.29.md +12 -0
- package/docs/releases/0.7.3.md +23 -0
- package/docs/releases/0.7.30.md +19 -0
- package/docs/releases/0.7.31.md +14 -0
- package/docs/releases/0.7.32.md +14 -0
- package/docs/releases/0.7.33.md +30 -0
- package/docs/releases/0.7.4.md +16 -0
- package/docs/releases/0.7.5.md +18 -0
- package/docs/releases/0.7.6.md +29 -0
- package/docs/releases/0.7.7.md +36 -0
- package/docs/releases/0.7.8.md +14 -0
- package/docs/releases/0.7.9.md +15 -0
- package/docs/session-bridge.md +80 -0
- package/docs/session-cards.md +53 -0
- package/docs/session-communication.md +186 -0
- package/docs/session-metrics.md +41 -0
- package/docs/skills.md +81 -0
- package/docs/triggers.md +338 -0
- package/docs/tui-commands.md +204 -0
- package/extensions/browser/manifest.json +22 -0
- package/extensions/browser/popup.css +6 -0
- package/extensions/browser/popup.html +11 -0
- package/extensions/browser/popup.mjs +47 -0
- package/extensions/browser/protocol.mjs +168 -0
- package/extensions/browser/worker.mjs +94 -0
- package/icon.svg +7 -0
- package/locale/en.json +6 -0
- package/locale/zh-cn.json +6 -0
- package/node_modules/@deepseek-ai/node-addon-system/LICENSE +21 -0
- package/node_modules/@deepseek-ai/node-addon-system/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system/README.md +15 -0
- package/node_modules/@deepseek-ai/node-addon-system/README.zh.md +15 -0
- package/node_modules/@deepseek-ai/node-addon-system/lib/flock.d.ts +13 -0
- package/node_modules/@deepseek-ai/node-addon-system/lib/flock.js +51 -0
- package/node_modules/@deepseek-ai/node-addon-system/lib/index.d.ts +73 -0
- package/node_modules/@deepseek-ai/node-addon-system/lib/index.js +98 -0
- package/node_modules/@deepseek-ai/node-addon-system/package.json +45 -0
- package/node_modules/@deepseek-ai/node-addon-system/src/flock.c +164 -0
- package/node_modules/@deepseek-ai/node-addon-system/src/main.c +298 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/LICENSE +28 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.md +9 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/README.zh.md +9 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/bin/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/package.json +31 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-arm64/prebuilds.json +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/LICENSE +28 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.md +9 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/README.zh.md +9 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/bin/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/package.json +31 -0
- package/node_modules/@deepseek-ai/node-addon-system-darwin-x64/prebuilds.json +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/LICENSE +28 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.md +11 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/README.zh.md +11 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/glibc/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/landlock-run +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/bin/musl/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/package.json +31 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-arm64/prebuilds.json +24 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/LICENSE +28 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.i18n.yaml +6 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.md +11 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/README.zh.md +11 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/glibc/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/landlock-run +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/bin/musl/system.node +0 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/package.json +31 -0
- package/node_modules/@deepseek-ai/node-addon-system-linux-x64/prebuilds.json +24 -0
- package/package.json +156 -4
- package/plugins/account/index.mjs +178 -0
- package/plugins/account/state.mjs +123 -0
- package/plugins/auto-review/audit.mjs +24 -0
- package/plugins/auto-review/index.mjs +267 -0
- package/plugins/auto-review/policy.mjs +92 -0
- package/plugins/browser/SKILL.md +158 -0
- package/plugins/browser/access.mjs +143 -0
- package/plugins/browser/config.mjs +60 -0
- package/plugins/browser/connection.mjs +385 -0
- package/plugins/browser/desktop-client.mjs +282 -0
- package/plugins/browser/desktop-host.mjs +74 -0
- package/plugins/browser/document-identity.mjs +57 -0
- package/plugins/browser/extension-relay.mjs +66 -0
- package/plugins/browser/files.mjs +32 -0
- package/plugins/browser/index.mjs +235 -0
- package/plugins/browser/mcp-entry.mjs +18 -0
- package/plugins/browser/mcp-tools.mjs +21 -0
- package/plugins/browser/presentation.mjs +45 -0
- package/plugins/browser/preview.mjs +77 -0
- package/plugins/browser/review.mjs +20 -0
- package/plugins/browser/screenshots.mjs +35 -0
- package/plugins/clipboard-image/clipboard-image.swift +56 -0
- package/plugins/clipboard-image/index.mjs +70 -0
- package/plugins/code-review/baseline.mjs +143 -0
- package/plugins/code-review/git.mjs +163 -0
- package/plugins/code-review/index.mjs +236 -0
- package/plugins/compaction/engine.mjs +304 -0
- package/plugins/compaction/tetris.mjs +65 -0
- package/plugins/compaction/threshold.mjs +98 -0
- package/plugins/computer-use/DESKTOP-SKILL.md +64 -0
- package/plugins/computer-use/desktop-host.mjs +75 -0
- package/plugins/computer-use/desktop-skill.mjs +28 -0
- package/plugins/computer-use/desktop-upstream.mjs +3 -0
- package/plugins/computer-use/index.mjs +37 -0
- package/plugins/cordis-config/plain.mjs +31 -0
- package/plugins/credentials/index.mjs +73 -0
- package/plugins/custom/adapter.mjs +110 -0
- package/plugins/custom/config.mjs +85 -0
- package/plugins/custom/desktop-client.mjs +150 -0
- package/plugins/custom/desktop-host.mjs +78 -0
- package/plugins/custom/images.mjs +32 -0
- package/plugins/custom/index.mjs +145 -0
- package/plugins/custom/wire.mjs +179 -0
- package/plugins/desktop/client.mjs +1041 -0
- package/plugins/desktop/index.mjs +10 -0
- package/plugins/desktop/shell-environment.mjs +9 -0
- package/plugins/desktop-workspace/hooks.mjs +29 -0
- package/plugins/desktop-workspace/index.mjs +37 -0
- package/plugins/dscode/board.mjs +260 -0
- package/plugins/dscode/child-target.mjs +11 -0
- package/plugins/dscode/control.mjs +17 -0
- package/plugins/dscode/desktop-client.mjs +55 -0
- package/plugins/dscode/desktop-host.mjs +37 -0
- package/plugins/dscode/index.mjs +270 -0
- package/plugins/email/cli.mjs +32 -0
- package/plugins/email/contacts.mjs +36 -0
- package/plugins/email/desktop-client.mjs +117 -0
- package/plugins/email/desktop-host.mjs +54 -0
- package/plugins/email/desktop-service.mjs +106 -0
- package/plugins/email/gmail-oauth.mjs +69 -0
- package/plugins/email/gmail-store.mjs +2 -0
- package/plugins/email/gmail.mjs +194 -0
- package/plugins/email/imap.mjs +136 -0
- package/plugins/email/inbox.d.mts +25 -0
- package/plugins/email/inbox.mjs +76 -0
- package/plugins/email/smtp.mjs +70 -0
- package/plugins/email/store.mjs +32 -0
- package/plugins/email-tools/index.mjs +46 -0
- package/plugins/exec/cli.mjs +64 -0
- package/plugins/exec/index.mjs +112 -0
- package/plugins/grok/adapter.mjs +114 -0
- package/plugins/grok/auth.mjs +76 -0
- package/plugins/grok/billing.mjs +146 -0
- package/plugins/grok/index.mjs +122 -0
- package/plugins/grok/models.mjs +129 -0
- package/plugins/grok/status.mjs +28 -0
- package/plugins/grok/wire.mjs +268 -0
- package/plugins/hub/catalog.mjs +82 -0
- package/plugins/hub/desktop-client.mjs +114 -0
- package/plugins/hub/desktop-host.mjs +129 -0
- package/plugins/i18n/messages.d.mts +21 -0
- package/plugins/i18n/messages.mjs +537 -0
- package/plugins/jev/approval.mjs +131 -0
- package/plugins/jev/client.mjs +74 -0
- package/plugins/jev/index.mjs +99 -0
- package/plugins/memory/content.mjs +57 -0
- package/plugins/memory/desktop-host.mjs +3 -0
- package/plugins/memory/index.mjs +168 -0
- package/plugins/memory/pipeline.mjs +79 -0
- package/plugins/memory/store.mjs +93 -0
- package/plugins/message-source/kind.mjs +20 -0
- package/plugins/opencode-go/adapter.mjs +96 -0
- package/plugins/opencode-go/command.mjs +128 -0
- package/plugins/opencode-go/index.mjs +120 -0
- package/plugins/opencode-go/models.mjs +58 -0
- package/plugins/opencode-go/oauth.mjs +194 -0
- package/plugins/opencode-go/search.mjs +86 -0
- package/plugins/opencode-go/usage.mjs +119 -0
- package/plugins/opencode-go/version.mjs +10 -0
- package/plugins/opencode-go/wire.mjs +73 -0
- package/plugins/openrouter/adapter.mjs +232 -0
- package/plugins/openrouter/index.mjs +123 -0
- package/plugins/openrouter/models.mjs +157 -0
- package/plugins/openrouter/search.mjs +113 -0
- package/plugins/openrouter/wire.mjs +101 -0
- package/plugins/providers/catalog.mjs +160 -0
- package/plugins/providers/chat-messages.mjs +120 -0
- package/plugins/providers/chat-stream.mjs +174 -0
- package/plugins/providers/desktop-client.mjs +84 -0
- package/plugins/providers/desktop-host.mjs +63 -0
- package/plugins/providers/effort.mjs +35 -0
- package/plugins/providers/http-errors.mjs +50 -0
- package/plugins/providers/openrouter-account.mjs +171 -0
- package/plugins/session-bridge/client.mjs +106 -0
- package/plugins/session-bridge/communication.mjs +260 -0
- package/plugins/session-bridge/index.mjs +68 -0
- package/plugins/session-bridge/mailbox.mjs +267 -0
- package/plugins/session-bridge/paths.mjs +21 -0
- package/plugins/session-bridge/server.mjs +172 -0
- package/plugins/session-bridge/tasks.mjs +229 -0
- package/plugins/session-cards/content.mjs +64 -0
- package/plugins/session-cards/index.mjs +38 -0
- package/plugins/session-cards/manager.mjs +140 -0
- package/plugins/session-metrics/attribution.mjs +30 -0
- package/plugins/session-metrics/balance.mjs +81 -0
- package/plugins/session-metrics/desktop-client.mjs +62 -0
- package/plugins/session-metrics/desktop-host.mjs +46 -0
- package/plugins/session-metrics/index.mjs +96 -0
- package/plugins/session-metrics/pricing.mjs +84 -0
- package/plugins/session-metrics/rate.mjs +59 -0
- package/plugins/session-metrics/store.mjs +75 -0
- package/plugins/session-metrics/turns.mjs +134 -0
- package/plugins/session-metrics/view.mjs +271 -0
- package/plugins/time-marks/desktop-host.mjs +2 -0
- package/plugins/time-marks/index.mjs +116 -0
- package/plugins/time-marks/marks.mjs +152 -0
- package/plugins/triggers/cli.mjs +558 -0
- package/plugins/triggers/commands.mjs +143 -0
- package/plugins/triggers/config.mjs +264 -0
- package/plugins/triggers/desktop-client.mjs +155 -0
- package/plugins/triggers/desktop-host.mjs +88 -0
- package/plugins/triggers/desktop-management.mjs +97 -0
- package/plugins/triggers/desktop-scheduler.mjs +125 -0
- package/plugins/triggers/host.mjs +24 -0
- package/plugins/triggers/index.mjs +27 -0
- package/plugins/triggers/job-cli.mjs +110 -0
- package/plugins/triggers/jobs.mjs +156 -0
- package/plugins/triggers/launchd.mjs +101 -0
- package/plugins/triggers/lease.mjs +24 -0
- package/plugins/triggers/log.mjs +104 -0
- package/plugins/triggers/management.mjs +181 -0
- package/plugins/triggers/options.mjs +117 -0
- package/plugins/triggers/overlay.mjs +7 -0
- package/plugins/triggers/poll.mjs +65 -0
- package/plugins/triggers/run.mjs +157 -0
- package/plugins/triggers/schedule.mjs +40 -0
- package/plugins/triggers/scheduler-service.mjs +46 -0
- package/plugins/triggers/scheduler.mjs +92 -0
- package/plugins/triggers/session-run.mjs +125 -0
- package/plugins/triggers/session.mjs +48 -0
- package/plugins/triggers/source-emit.mjs +19 -0
- package/plugins/triggers/source-host.mjs +78 -0
- package/plugins/triggers/source-ingress.mjs +70 -0
- package/plugins/triggers/source-sandbox.mjs +35 -0
- package/plugins/triggers/sources.mjs +45 -0
- package/plugins/triggers/spool.mjs +145 -0
- package/plugins/triggers/tools.mjs +67 -0
- package/plugins/triggers/unattended.mjs +18 -0
- package/plugins/tui-tools/composition.mjs +28 -0
- package/plugins/tui-tools/desktop-host.mjs +2 -0
- package/plugins/tui-tools/doctor-cli.mjs +22 -0
- package/plugins/tui-tools/doctor.mjs +148 -0
- package/plugins/tui-tools/hook-sources.mjs +113 -0
- package/plugins/tui-tools/hooks.mjs +23 -0
- package/plugins/tui-tools/index.mjs +268 -0
- package/plugins/tui-tools/sandbox-runner.mjs +123 -0
- package/plugins/tui-tools/shell.mjs +27 -0
- package/plugins/tui-tools/update.mjs +111 -0
- package/plugins/tui-tools/workspace-discovery.mjs +129 -0
- package/plugins/ultra/policy.mjs +42 -0
- package/plugins/worktree-subagent/worktree.mjs +56 -0
- package/runtime-sources.json +94 -0
- package/vendor/bash/LICENSE +21 -0
- package/vendor/bash/index.js +717 -0
- package/vendor/bash/types/background.d.ts +50 -0
- package/vendor/bash/types/index.d.ts +38 -0
- package/vendor/bash/types/render.d.ts +57 -0
- package/vendor/command-goal/LICENSE +21 -0
- package/vendor/command-goal/index.js +210 -0
- package/vendor/command-goal/types/index.d.ts +10 -0
- package/vendor/computer-use/LICENSE +21 -0
- package/vendor/computer-use/lib/approval-policy.js +12 -0
- package/vendor/computer-use/lib/approval-policy.js.map +1 -0
- package/vendor/computer-use/lib/artifacts.js +79 -0
- package/vendor/computer-use/lib/artifacts.js.map +1 -0
- package/vendor/computer-use/lib/backend.js +3 -0
- package/vendor/computer-use/lib/backend.js.map +1 -0
- package/vendor/computer-use/lib/client.js +369 -0
- package/vendor/computer-use/lib/client.js.map +1 -0
- package/vendor/computer-use/lib/config.js +159 -0
- package/vendor/computer-use/lib/config.js.map +1 -0
- package/vendor/computer-use/lib/confirmations.js +99 -0
- package/vendor/computer-use/lib/confirmations.js.map +1 -0
- package/vendor/computer-use/lib/diff.js +58 -0
- package/vendor/computer-use/lib/diff.js.map +1 -0
- package/vendor/computer-use/lib/errors.js +22 -0
- package/vendor/computer-use/lib/errors.js.map +1 -0
- package/vendor/computer-use/lib/exposure.js +244 -0
- package/vendor/computer-use/lib/exposure.js.map +1 -0
- package/vendor/computer-use/lib/index.js +66 -0
- package/vendor/computer-use/lib/index.js.map +1 -0
- package/vendor/computer-use/lib/leases.js +262 -0
- package/vendor/computer-use/lib/leases.js.map +1 -0
- package/vendor/computer-use/lib/providers/macos.js +243 -0
- package/vendor/computer-use/lib/providers/macos.js.map +1 -0
- package/vendor/computer-use/lib/providers/native-helper.js +726 -0
- package/vendor/computer-use/lib/providers/native-helper.js.map +1 -0
- package/vendor/computer-use/lib/providers/unsupported.js +51 -0
- package/vendor/computer-use/lib/providers/unsupported.js.map +1 -0
- package/vendor/computer-use/lib/service.js +608 -0
- package/vendor/computer-use/lib/service.js.map +1 -0
- package/vendor/computer-use/lib/skill.js +136 -0
- package/vendor/computer-use/lib/skill.js.map +1 -0
- package/vendor/computer-use/lib/target-resolver.js +180 -0
- package/vendor/computer-use/lib/target-resolver.js.map +1 -0
- package/vendor/computer-use/lib/tools.js +511 -0
- package/vendor/computer-use/lib/tools.js.map +1 -0
- package/vendor/computer-use/lib/types/approval-policy.d.ts +13 -0
- package/vendor/computer-use/lib/types/approval-policy.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/artifacts.d.ts +10 -0
- package/vendor/computer-use/lib/types/artifacts.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/backend.d.ts +124 -0
- package/vendor/computer-use/lib/types/backend.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/client/index.d.ts +83 -0
- package/vendor/computer-use/lib/types/client/index.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/config.d.ts +94 -0
- package/vendor/computer-use/lib/types/config.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/confirmations.d.ts +23 -0
- package/vendor/computer-use/lib/types/confirmations.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/diff.d.ts +5 -0
- package/vendor/computer-use/lib/types/diff.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/errors.d.ts +15 -0
- package/vendor/computer-use/lib/types/errors.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/exposure.d.ts +30 -0
- package/vendor/computer-use/lib/types/exposure.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/index.d.ts +21 -0
- package/vendor/computer-use/lib/types/index.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/leases.d.ts +81 -0
- package/vendor/computer-use/lib/types/leases.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/providers/macos.d.ts +39 -0
- package/vendor/computer-use/lib/types/providers/macos.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/providers/native-helper.d.ts +48 -0
- package/vendor/computer-use/lib/types/providers/native-helper.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/providers/unsupported.d.ts +23 -0
- package/vendor/computer-use/lib/types/providers/unsupported.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/service.d.ts +58 -0
- package/vendor/computer-use/lib/types/service.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/skill.d.ts +14 -0
- package/vendor/computer-use/lib/types/skill.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/target-resolver.d.ts +38 -0
- package/vendor/computer-use/lib/types/target-resolver.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/tools.d.ts +6 -0
- package/vendor/computer-use/lib/types/tools.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/types.d.ts +270 -0
- package/vendor/computer-use/lib/types/types.d.ts.map +1 -0
- package/vendor/computer-use/lib/types/web.d.ts +33 -0
- package/vendor/computer-use/lib/types/web.d.ts.map +1 -0
- package/vendor/computer-use/lib/types.js +9 -0
- package/vendor/computer-use/lib/types.js.map +1 -0
- package/vendor/computer-use/lib/web.js +188 -0
- package/vendor/computer-use/lib/web.js.map +1 -0
- package/vendor/computer-use/native/macos/Sources/Fixture/main.swift +412 -0
- package/vendor/computer-use/native/macos/Sources/Helper/CursorImage.swift +11 -0
- package/vendor/computer-use/native/macos/Sources/Helper/CursorMotion.swift +67 -0
- package/vendor/computer-use/native/macos/Sources/Helper/CursorOverlay.swift +840 -0
- package/vendor/computer-use/native/macos/Sources/Helper/TargetedPointer.swift +327 -0
- package/vendor/computer-use/native/macos/Sources/Helper/WindowNumberMatcher.swift +29 -0
- package/vendor/computer-use/native/macos/Sources/Helper/main.swift +1244 -0
- package/vendor/computer-use/native/macos/Sources/Monitor/main.swift +153 -0
- package/vendor/computer-use/native/macos/bin/dsh-computer-use-helper +0 -0
- package/vendor/computer-use/native/macos/manifest.json +14 -0
- package/vendor/persistent/LICENSE +21 -0
- package/vendor/persistent/index.js +411 -0
- package/vendor/persistent/types/index.d.ts +24 -0
- package/vendor/subagent/LICENSE +21 -0
- package/vendor/subagent/index.js +694 -0
- package/vendor/subagent/invariant.js +52 -0
- package/vendor/subagent/model-selection-settings.js +68 -0
- package/vendor/subagent/types/index.d.ts +82 -0
- package/vendor/subagent/types/invariant.d.ts +16 -0
- package/vendor/subagent/types/list-models.d.ts +10 -0
- package/vendor/subagent/types/model-selection-settings.d.ts +45 -0
- package/vendor/subagent/types/model-selection-state.d.ts +48 -0
- package/vendor/subagent/types/model-selection.d.ts +81 -0
- package/vendor/subagent-core/LICENSE +21 -0
- package/vendor/subagent-core/index.js +3202 -0
- package/vendor/subagent-core/invariant.js +76 -0
- package/vendor/subagent-core/typert.host.d.ts +3 -0
- package/vendor/subagent-core/typert.host.js +978 -0
- package/vendor/subagent-core/typert.remote-client.d.ts +25 -0
- package/vendor/subagent-core/typert.remote-client.js +114 -0
- package/vendor/subagent-core/types/archive-admission.d.ts +16 -0
- package/vendor/subagent-core/types/archive-admission.js +151 -0
- package/vendor/subagent-core/types/assistant-output.d.ts +48 -0
- package/vendor/subagent-core/types/assistant-output.js +73 -0
- package/vendor/subagent-core/types/catalog.d.ts +84 -0
- package/vendor/subagent-core/types/catalog.js +109 -0
- package/vendor/subagent-core/types/child-agent.d.ts +156 -0
- package/vendor/subagent-core/types/child-agent.js +213 -0
- package/vendor/subagent-core/types/client.d.ts +8 -0
- package/vendor/subagent-core/types/client.js +7 -0
- package/vendor/subagent-core/types/continuation-activation.d.ts +267 -0
- package/vendor/subagent-core/types/continuation-activation.js +700 -0
- package/vendor/subagent-core/types/continuation-messages.d.ts +62 -0
- package/vendor/subagent-core/types/continuation-messages.js +106 -0
- package/vendor/subagent-core/types/continuation.d.ts +124 -0
- package/vendor/subagent-core/types/continuation.js +455 -0
- package/vendor/subagent-core/types/control-types.d.ts +135 -0
- package/vendor/subagent-core/types/control-types.js +8 -0
- package/vendor/subagent-core/types/control.d.ts +45 -0
- package/vendor/subagent-core/types/control.js +79 -0
- package/vendor/subagent-core/types/depth.d.ts +31 -0
- package/vendor/subagent-core/types/depth.js +39 -0
- package/vendor/subagent-core/types/descriptor.d.ts +144 -0
- package/vendor/subagent-core/types/descriptor.js +193 -0
- package/vendor/subagent-core/types/error.d.ts +11 -0
- package/vendor/subagent-core/types/error.js +14 -0
- package/vendor/subagent-core/types/inbox.d.ts +43 -0
- package/vendor/subagent-core/types/inbox.js +61 -0
- package/vendor/subagent-core/types/index.d.ts +320 -0
- package/vendor/subagent-core/types/index.js +475 -0
- package/vendor/subagent-core/types/internal.d.ts +58 -0
- package/vendor/subagent-core/types/internal.js +58 -0
- package/vendor/subagent-core/types/invariant.d.ts +13 -0
- package/vendor/subagent-core/types/invariant.js +91 -0
- package/vendor/subagent-core/types/lifecycle.d.ts +113 -0
- package/vendor/subagent-core/types/lifecycle.js +180 -0
- package/vendor/subagent-core/types/list-children.d.ts +36 -0
- package/vendor/subagent-core/types/list-children.js +166 -0
- package/vendor/subagent-core/types/out-of-process.d.ts +118 -0
- package/vendor/subagent-core/types/out-of-process.js +219 -0
- package/vendor/subagent-core/types/projection-types.d.ts +82 -0
- package/vendor/subagent-core/types/projection-types.js +7 -0
- package/vendor/subagent-core/types/projection.d.ts +100 -0
- package/vendor/subagent-core/types/projection.js +157 -0
- package/vendor/subagent-core/types/run-settlement.d.ts +17 -0
- package/vendor/subagent-core/types/run-settlement.js +70 -0
- package/vendor/subagent-core/types/types.d.ts +377 -0
- package/vendor/subagent-core/types/types.js +19 -0
- package/vendor/subagent-driver/LICENSE +21 -0
- package/vendor/subagent-driver/index.js +255 -0
- package/vendor/subagent-driver/types/index.d.ts +33 -0
- package/vendor/subagent-driver/types/structured.d.ts +42 -0
- package/vendor/subagent-fork/LICENSE +21 -0
- package/vendor/subagent-fork/index.js +61 -0
- package/vendor/subagent-fork/types/index.d.ts +20 -0
- package/vendor/subagent-spawn/LICENSE +21 -0
- package/vendor/subagent-spawn/index.js +45 -0
- package/vendor/subagent-spawn/types/index.d.ts +19 -0
- package/vendor/terminal/LICENSE +21 -0
- package/vendor/terminal/index.js +1093 -0
- package/vendor/terminal/types/config.d.ts +82 -0
- package/vendor/terminal/types/index.d.ts +36 -0
- package/vendor/terminal/types/sanitize.d.ts +47 -0
- package/vendor/terminal/types/session.d.ts +87 -0
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
import { desktopShellEnvironment } from '../../plugins/desktop/shell-environment.mjs';
|
|
2
|
+
// dscode-named-shell-v1
|
|
3
|
+
import z from "@deepseek-ai/schemastery";
|
|
4
|
+
import { isAbsolute, sep } from "node:path";
|
|
5
|
+
import { TOOL_ABORTED, defineTool } from "@deepseek-ai/dsh-tools";
|
|
6
|
+
import { HarnessError } from "@deepseek-ai/dsh-llm";
|
|
7
|
+
import { ESCALATION_TARGETS, approveEscalation, escalationHintMarker, sandboxDenialMarker, sandboxPermissionsDescription, validateEscalationArgs } from "@deepseek-ai/dsh-sandbox";
|
|
8
|
+
import { DSH_ENV_PREFIX, parseExitStatus } from "@deepseek-ai/dsh-shell";
|
|
9
|
+
//#region lib/types/background.js
|
|
10
|
+
/**
|
|
11
|
+
* Generic-job adaptation for bash process handles: the terminal outcome the
|
|
12
|
+
* registry records, the pull sources it pumps, and the ring read a foreground
|
|
13
|
+
* call renders when it stops waiting.
|
|
14
|
+
*
|
|
15
|
+
* @module @deepseek-ai/dsh-tool-bash/background
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Sandbox facts worth the terminal detail: a runner that never ran the
|
|
19
|
+
* command, or a denial (with the escalation hint this composition offers).
|
|
20
|
+
* @param sandbox - settled sandbox facts, when this was a confined process.
|
|
21
|
+
* @param escalationModes - escalation targets advertised by this composition.
|
|
22
|
+
* @returns the markers to append, oldest first.
|
|
23
|
+
*/
|
|
24
|
+
function sandboxNotes(sandbox, escalationModes) {
|
|
25
|
+
if (sandbox?.runnerFailed) return [`[sandbox: the sandbox runner itself failed under ${sandbox.mode} mode — the command did not run; this is a sandbox problem, not a command failure]`];
|
|
26
|
+
if (sandbox?.denied) {
|
|
27
|
+
const notes = [sandboxDenialMarker(sandbox.mode)];
|
|
28
|
+
if (escalationModes.length > 0) notes.push(escalationHintMarker("command"));
|
|
29
|
+
return notes;
|
|
30
|
+
}
|
|
31
|
+
return [];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Map a settled background process onto the generic job-outcome vocabulary:
|
|
35
|
+
* `killed` stays `killed` (detail: the signal when one is known), everything
|
|
36
|
+
* else is `completed` with the exit code as detail. A nonzero command exit is
|
|
37
|
+
* reported, not failed, exactly like the foreground rendering. Sandbox facts
|
|
38
|
+
* join the detail, since a job's terminal reason is the one line every
|
|
39
|
+
* reader — the model's status line, the roster row — shows.
|
|
40
|
+
* @param proc - the settled process handle.
|
|
41
|
+
* @param escalationModes - escalation targets advertised by this composition.
|
|
42
|
+
* @returns the outcome for the `ctx.jobs` registration.
|
|
43
|
+
*/
|
|
44
|
+
function processOutcome(proc, escalationModes = []) {
|
|
45
|
+
const base = proc.status === "killed" ? {
|
|
46
|
+
status: "killed",
|
|
47
|
+
detail: proc.signal !== null ? `signal: ${proc.signal}` : "killed before exit"
|
|
48
|
+
} : {
|
|
49
|
+
status: "completed",
|
|
50
|
+
detail: `exit code: ${proc.exitCode ?? 0}`
|
|
51
|
+
};
|
|
52
|
+
const notes = sandboxNotes(proc.sandbox, escalationModes);
|
|
53
|
+
return notes.length === 0 ? base : {
|
|
54
|
+
...base,
|
|
55
|
+
detail: `${base.detail}; ${notes.join(" ")}`
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The process's non-consuming stream readers as registry pull sources. They
|
|
60
|
+
* bind lazily because the process is spawned inside the starter, after the
|
|
61
|
+
* registry admitted the job; a read before the spawn yields nothing, and the
|
|
62
|
+
* pump keeps the model's consuming cursor untouched. A rejected spawn's
|
|
63
|
+
* stderr reader carries the provider's `subprocess failed before reporting an
|
|
64
|
+
* outcome: …` note.
|
|
65
|
+
* @param proc - the started process's observed streams, once the starter has spawned it.
|
|
66
|
+
* @returns one source per stream, stdout first.
|
|
67
|
+
*/
|
|
68
|
+
function processSources(proc) {
|
|
69
|
+
const source = (channel) => ({
|
|
70
|
+
channel,
|
|
71
|
+
read: (fromByte) => {
|
|
72
|
+
const live = proc();
|
|
73
|
+
return live === void 0 ? {
|
|
74
|
+
text: "",
|
|
75
|
+
nextOffset: fromByte,
|
|
76
|
+
lossy: false
|
|
77
|
+
} : live.observed[channel].readFrom(fromByte);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return [source("stdout"), source("stderr")];
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The ring chunks of one consuming registry read as the shell tools render a
|
|
84
|
+
* process read: stdout chunks in order, then every stderr chunk in one
|
|
85
|
+
* `[stderr]` section, so the output a foreground call hands over when it
|
|
86
|
+
* stops waiting reads exactly like the `job_output` reads that follow it.
|
|
87
|
+
* @param chunks - the chunks since the model cursor, in offset order.
|
|
88
|
+
* @returns the delta text, possibly empty.
|
|
89
|
+
*/
|
|
90
|
+
function ringDelta(chunks) {
|
|
91
|
+
const out = chunks.filter((chunk) => chunk.channel !== "stderr").map((chunk) => chunk.text).join("");
|
|
92
|
+
const err = chunks.filter((chunk) => chunk.channel === "stderr").map((chunk) => chunk.text).join("");
|
|
93
|
+
const separator = out.length > 0 && !out.endsWith("\n") ? "\n" : "";
|
|
94
|
+
return out + (err.length > 0 ? `${separator}[stderr]\n${err}` : "");
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Adapt asynchronous shell preparation after job admission without exposing a partial process.
|
|
98
|
+
* @param start - starts the process with job-owned cancellation.
|
|
99
|
+
* @param outcome - projects the settled process into the job outcome.
|
|
100
|
+
* @returns synchronous job hooks whose completion includes preparation and process settlement.
|
|
101
|
+
*/
|
|
102
|
+
function processJob(start, outcome) {
|
|
103
|
+
const controller = new AbortController();
|
|
104
|
+
let process;
|
|
105
|
+
return {
|
|
106
|
+
cancel: (reason) => {
|
|
107
|
+
if (controller.signal.aborted) return;
|
|
108
|
+
controller.abort(reason);
|
|
109
|
+
process?.kill();
|
|
110
|
+
},
|
|
111
|
+
done: (async () => {
|
|
112
|
+
try {
|
|
113
|
+
process = await start(controller.signal);
|
|
114
|
+
try {
|
|
115
|
+
if (controller.signal.aborted) process.kill();
|
|
116
|
+
} finally {
|
|
117
|
+
await process.done;
|
|
118
|
+
}
|
|
119
|
+
return outcome(process);
|
|
120
|
+
} catch (error) {
|
|
121
|
+
return {
|
|
122
|
+
status: controller.signal.aborted && process === void 0 ? "killed" : "failed",
|
|
123
|
+
detail: error instanceof Error ? error.message : String(error)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
})()
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
130
|
+
//#region lib/types/render.js
|
|
131
|
+
/**
|
|
132
|
+
* Model-facing result rendering for the bash tool.
|
|
133
|
+
*
|
|
134
|
+
* @module @deepseek-ai/dsh-tool-bash/render
|
|
135
|
+
*/
|
|
136
|
+
/** Append the truncation notice (with the full-output spill path) to a stream's text. */
|
|
137
|
+
function streamText(output) {
|
|
138
|
+
if (!output.truncated) return output.text;
|
|
139
|
+
return `${output.text}\n[output truncated; full output: ${output.spillPath ?? "(unavailable)"}]`;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Shape one finished run into the text the model sees: stdout, then a marked
|
|
143
|
+
* stderr section, then exit-status markers. Non-zero exits are reported, not
|
|
144
|
+
* errored — the model decides how to react; only infrastructure failures
|
|
145
|
+
* (spawn errors, aborts) surface as isError results.
|
|
146
|
+
* @param result - the completed foreground run from the executor.
|
|
147
|
+
* @param escalationModes - the escalation targets this composition advertises;
|
|
148
|
+
* non-empty adds the same-turn escalation hint after a denial marker
|
|
149
|
+
* (default `[]`: no hint).
|
|
150
|
+
* @returns the model-facing text: output body (or `(no output)`), then any timeout/stopped/signal/exit markers, each on its own line.
|
|
151
|
+
*/
|
|
152
|
+
function renderResult(result, escalationModes = []) {
|
|
153
|
+
const out = streamText(result.stdout);
|
|
154
|
+
const err = streamText(result.stderr);
|
|
155
|
+
let body = out;
|
|
156
|
+
if (err.length > 0) {
|
|
157
|
+
if (body.length > 0 && !body.endsWith("\n")) body += "\n";
|
|
158
|
+
body += `[stderr]\n${err}`;
|
|
159
|
+
}
|
|
160
|
+
if (body.length === 0) body = "(no output)";
|
|
161
|
+
const markers = [];
|
|
162
|
+
if (result.sandbox?.denied) {
|
|
163
|
+
markers.push(sandboxDenialMarker(result.sandbox.mode));
|
|
164
|
+
if (escalationModes.length > 0) markers.push(escalationHintMarker("command"));
|
|
165
|
+
}
|
|
166
|
+
if (result.timedOut) markers.push(`[timed out after ${result.timeoutMs}ms]`);
|
|
167
|
+
if (result.stopped !== void 0) markers.push(`[stopped: ${result.stopped}]`);
|
|
168
|
+
if (result.signal !== null) markers.push(`[killed by signal: ${result.signal}]`);
|
|
169
|
+
else if (result.exitCode !== 0) markers.push(`[exit code: ${result.exitCode}]`);
|
|
170
|
+
if (markers.length === 0) return body;
|
|
171
|
+
if (!body.endsWith("\n")) body += "\n";
|
|
172
|
+
return body + markers.join("\n");
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Shape a foreground call that stopped waiting into the text the model sees:
|
|
176
|
+
* the output captured so far (one consuming registry read taken at that
|
|
177
|
+
* point, so `job_output` continues exactly after it), then the still-running
|
|
178
|
+
* marker and the job hand-off guidance.
|
|
179
|
+
* @param promoted - the promoted result value: the job id, the wait that
|
|
180
|
+
* expired, and the output so far.
|
|
181
|
+
* @returns the model-facing text for a promoted call.
|
|
182
|
+
*/
|
|
183
|
+
function renderPromoted(promoted) {
|
|
184
|
+
return `${promoted.output.length > 0 ? promoted.output.endsWith("\n") ? promoted.output : `${promoted.output}\n` : ""}[still running after ${promoted.timeoutMs}ms; moved to background job ${promoted.jobId}]\nThe command keeps running in the background. You will be notified when it finishes; read newer output with job_output, stop it with job_kill.`;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Shape the one consuming registry read a foreground call embeds in its
|
|
188
|
+
* result when it stops waiting: the output produced so far, plus the
|
|
189
|
+
* dropped-output notice (naming the job's spill files) when the model cursor
|
|
190
|
+
* fell behind the ring, and the sandbox notices. Later `job_output` reads
|
|
191
|
+
* render the same ring through the job tools.
|
|
192
|
+
* @param delta - the read's chunks as rendered text.
|
|
193
|
+
* @param lossy - whether bytes before the delta were evicted unread.
|
|
194
|
+
* @param spillPaths - the complete-stream files the job currently advertises.
|
|
195
|
+
* @param sandbox - settled sandbox facts, when this was a confined process.
|
|
196
|
+
* @param escalationModes - escalation targets advertised by this composition.
|
|
197
|
+
* @returns the delta text with any loss or sandbox notice appended.
|
|
198
|
+
*/
|
|
199
|
+
function renderJobRead(delta, lossy, spillPaths, sandbox, escalationModes = []) {
|
|
200
|
+
const notices = [];
|
|
201
|
+
if (lossy) notices.push(`[some output was dropped from memory; full output: ${spillPaths.length > 0 ? spillPaths.join(", ") : "(unavailable)"}]`);
|
|
202
|
+
if (sandbox?.runnerFailed) notices.push(`[sandbox: the sandbox runner itself failed under ${sandbox.mode} mode — the command did not run; this is a sandbox problem, not a command failure]`);
|
|
203
|
+
else if (sandbox?.denied) {
|
|
204
|
+
notices.push(sandboxDenialMarker(sandbox.mode));
|
|
205
|
+
if (escalationModes.length > 0) notices.push(escalationHintMarker("command"));
|
|
206
|
+
}
|
|
207
|
+
if (notices.length === 0) return delta;
|
|
208
|
+
return `${delta}${delta.length > 0 && !delta.endsWith("\n") ? "\n" : ""}${notices.join("\n")}`;
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
211
|
+
//#region lib/types/index.js
|
|
212
|
+
/**
|
|
213
|
+
* Model-facing Consumer of the `ctx.shell` capability seam. While a job
|
|
214
|
+
* registry is composed, every call registers its process with `ctx.jobs` as
|
|
215
|
+
* it starts: `run_in_background` returns the id at once, and a foreground call
|
|
216
|
+
* waits on its job until the command finishes or the wait times out, at which
|
|
217
|
+
* point it returns the same id. Without a registry the tool is foreground-only
|
|
218
|
+
* and the executor's deadline kills the command.
|
|
219
|
+
*
|
|
220
|
+
* TODO(permissions): deployment policy belongs in `tools/pre-execute` and
|
|
221
|
+
* sandboxing executors; see docs/architecture.md § Where new behavior goes.
|
|
222
|
+
* @module @deepseek-ai/dsh-tool-bash
|
|
223
|
+
*/
|
|
224
|
+
const name = "tool-bash";
|
|
225
|
+
const inject = [
|
|
226
|
+
"tools",
|
|
227
|
+
"shell",
|
|
228
|
+
"systemPrompt",
|
|
229
|
+
"shellEnv"
|
|
230
|
+
];
|
|
231
|
+
/** Runtime configuration schema for the bash tool plugin. */
|
|
232
|
+
const Config = z.object({
|
|
233
|
+
toolName: z.string().default("bash"),
|
|
234
|
+
enableRunInBackground: z.boolean().default(true),
|
|
235
|
+
promoteOnTimeout: z.boolean().default(true)
|
|
236
|
+
});
|
|
237
|
+
function validateBashArgs(args, effectiveMode) {
|
|
238
|
+
if (args.command.trim().length === 0) throw new Error("invalid command: expected a non-empty string");
|
|
239
|
+
if (args.description.trim().length === 0) throw new Error("invalid description: expected a non-empty string");
|
|
240
|
+
if (args.timeoutMs !== void 0 && (!Number.isFinite(args.timeoutMs) || args.timeoutMs <= 0)) throw new Error(`invalid timeoutMs: expected a positive number, got ${JSON.stringify(args.timeoutMs)}`);
|
|
241
|
+
if (args.sandbox_permissions !== void 0 && args.sandbox_permissions === effectiveMode) return;
|
|
242
|
+
const justification = args.sandbox_permissions === void 0 && args.justification?.trim() === "" ? void 0 : args.justification;
|
|
243
|
+
validateEscalationArgs(args.sandbox_permissions, justification);
|
|
244
|
+
}
|
|
245
|
+
function bashDescription() {
|
|
246
|
+
return `Execute a bash command (\`bash -c\`) and return its stdout/stderr. Each call runs in a fresh shell; pass \`workdir\` instead of using \`cd\`. Managed \`$${DSH_ENV_PREFIX}*\` variables expose current harness environment facts. Long output is truncated to its tail; the full output is saved to a file whose path is reported when available. Before any delete or move, verify that the resolved absolute target path is the intended one; never run it against a computed path you have not checked. An unset variable expands to an empty string, so guard variables in such paths with \`\${VAR:?}\`. Commands may run under a file sandbox; a blocked file operation is reported as \`[sandbox: file access denied under <mode> mode]\`, a policy denial: do not retry another way.`;
|
|
247
|
+
}
|
|
248
|
+
function presentBashCall(args) {
|
|
249
|
+
if (args.run_in_background === true) return {
|
|
250
|
+
card: "generic",
|
|
251
|
+
title: args.command,
|
|
252
|
+
kind: "execute",
|
|
253
|
+
rawInput: args.command,
|
|
254
|
+
content: [{
|
|
255
|
+
type: "text",
|
|
256
|
+
text: args.description
|
|
257
|
+
}]
|
|
258
|
+
};
|
|
259
|
+
return {
|
|
260
|
+
card: "terminal",
|
|
261
|
+
title: args.command,
|
|
262
|
+
description: args.description,
|
|
263
|
+
...args.workdir !== void 0 ? { cwd: args.workdir } : {}
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Present completed foreground output as a terminal; background acknowledgements
|
|
268
|
+
* and execution errors use generic fenced output without an exit-status pill.
|
|
269
|
+
*/
|
|
270
|
+
function presentBashResult(args, result) {
|
|
271
|
+
const block = result.content.length === 1 ? result.content[0] : void 0;
|
|
272
|
+
if (block === void 0 || block.type !== "text") return void 0;
|
|
273
|
+
const raw = block.text;
|
|
274
|
+
const isBackground = typeof args === "object" && args !== null && args.run_in_background === true;
|
|
275
|
+
const isPromoted = result.value?.kind === "promoted";
|
|
276
|
+
if (isBackground || isPromoted || result.isError) return {
|
|
277
|
+
card: "generic",
|
|
278
|
+
content: [{
|
|
279
|
+
type: "text",
|
|
280
|
+
text: `\`\`\`console\n${raw.replace(/\n+$/, "")}\n\`\`\``
|
|
281
|
+
}]
|
|
282
|
+
};
|
|
283
|
+
const { body, ...exit } = parseExitStatus(raw);
|
|
284
|
+
return {
|
|
285
|
+
card: "terminal",
|
|
286
|
+
output: body,
|
|
287
|
+
...exit
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Resolve an explicit workdir first, making a relative one session-workspace-relative;
|
|
292
|
+
* otherwise use the filesystem identity of the session cwd and leave executor
|
|
293
|
+
* defaulting as the fallback. A resolved sandbox-policy root wins so workdir
|
|
294
|
+
* and confinement use the exact same per-call identity.
|
|
295
|
+
*/
|
|
296
|
+
function resolveWorkdir(modelWorkdir, exec, policyWorkspaceRoot) {
|
|
297
|
+
const headerCwd = exec.agent?.session.header.cwd;
|
|
298
|
+
const sessionCwd = policyWorkspaceRoot ?? headerCwd;
|
|
299
|
+
if (modelWorkdir === void 0) return sessionCwd;
|
|
300
|
+
if (sessionCwd !== void 0 && !isAbsolute(modelWorkdir)) return `${sessionCwd}${sep}${modelWorkdir}`;
|
|
301
|
+
return modelWorkdir;
|
|
302
|
+
}
|
|
303
|
+
/** Detach the executor DTO from readonly Service Definition types into plain JSON data. */
|
|
304
|
+
function canonicalBashResult(result) {
|
|
305
|
+
const output = (stream) => ({
|
|
306
|
+
text: stream.text,
|
|
307
|
+
truncated: stream.truncated,
|
|
308
|
+
...stream.spillPath !== void 0 ? { spillPath: stream.spillPath } : {}
|
|
309
|
+
});
|
|
310
|
+
return {
|
|
311
|
+
exitCode: result.exitCode,
|
|
312
|
+
signal: result.signal,
|
|
313
|
+
timedOut: result.timedOut,
|
|
314
|
+
aborted: result.aborted,
|
|
315
|
+
timeoutMs: result.timeoutMs,
|
|
316
|
+
stdout: output(result.stdout),
|
|
317
|
+
stderr: output(result.stderr),
|
|
318
|
+
...result.sandbox !== void 0 ? { sandbox: {
|
|
319
|
+
mode: result.sandbox.mode,
|
|
320
|
+
denied: result.sandbox.denied,
|
|
321
|
+
...result.sandbox.enforcement !== void 0 ? { enforcement: result.sandbox.enforcement } : {},
|
|
322
|
+
...result.sandbox.runnerFailed !== void 0 ? { runnerFailed: result.sandbox.runnerFailed } : {}
|
|
323
|
+
} } : {}
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
/** The structured abort the foreground paths throw when the caller cancels the call. */
|
|
327
|
+
function toolAborted() {
|
|
328
|
+
const error = new HarnessError("tool call aborted", TOOL_ABORTED);
|
|
329
|
+
error.name = "AbortError";
|
|
330
|
+
return error;
|
|
331
|
+
}
|
|
332
|
+
/** Canonical background-handle properties shared by the bash output union. */
|
|
333
|
+
const BACKGROUND_OUTPUT_PROPERTIES = {
|
|
334
|
+
kind: {
|
|
335
|
+
type: "string",
|
|
336
|
+
required: true,
|
|
337
|
+
const: "background"
|
|
338
|
+
},
|
|
339
|
+
jobId: {
|
|
340
|
+
type: "string",
|
|
341
|
+
required: true
|
|
342
|
+
}
|
|
343
|
+
};
|
|
344
|
+
function apply(ctx, config = {}) {
|
|
345
|
+
const backgroundEnabled = config.enableRunInBackground ?? true;
|
|
346
|
+
const promoteOnTimeout = (config.promoteOnTimeout ?? true) && backgroundEnabled;
|
|
347
|
+
const defaultMode = ctx.shell.sandboxMode;
|
|
348
|
+
const escalationModes = defaultMode === void 0 ? [] : ESCALATION_TARGETS;
|
|
349
|
+
const sandboxPolicy = defaultMode === void 0 ? void 0 : ctx.get("sandboxPolicy");
|
|
350
|
+
if (defaultMode !== void 0 && sandboxPolicy === void 0) throw new Error("tool-bash: the mounted bash executor confines but ctx.sandboxPolicy is missing");
|
|
351
|
+
/** Resolve the complete standing policy for this call when a confining executor is mounted. */
|
|
352
|
+
const resolveSandboxPolicy = (exec) => sandboxPolicy?.resolve(exec.agent === void 0 ? {} : { session: exec.agent.session });
|
|
353
|
+
/**
|
|
354
|
+
* Resolve a sandbox-escalation request through `ctx.approval` BEFORE
|
|
355
|
+
* anything executes, delegating the shared fail-closed sequence (strict
|
|
356
|
+
* widening, channel resolution, outcome mapping) to
|
|
357
|
+
* {@link approveEscalation}. This tool contributes only the composition
|
|
358
|
+
* guard (the fields are unadvertised without a sandboxing executor, yet
|
|
359
|
+
* schema validation checks advertised keys only, so an unadvertised
|
|
360
|
+
* `sandbox_permissions` still reaches execute) and the approval
|
|
361
|
+
* ingredients. The shared policy resolver is required whenever the executor
|
|
362
|
+
* advertises confinement, so a split composition fails at tool-plugin load.
|
|
363
|
+
*/
|
|
364
|
+
const approveBashEscalation = (mode, justification, exec, standingPolicy) => {
|
|
365
|
+
if (escalationModes.length === 0) throw new Error("sandbox_permissions is not available in this composition (no sandboxing executor to escalate)");
|
|
366
|
+
const effectiveMode = standingPolicy.mode;
|
|
367
|
+
return approveEscalation({
|
|
368
|
+
requestedMode: mode,
|
|
369
|
+
justification,
|
|
370
|
+
effectiveMode,
|
|
371
|
+
subject: "command"
|
|
372
|
+
}, {
|
|
373
|
+
approver: ctx.get("approval"),
|
|
374
|
+
agent: exec.agent,
|
|
375
|
+
callId: exec.callId,
|
|
376
|
+
toolName: config.toolName,
|
|
377
|
+
signal: exec.signal
|
|
378
|
+
});
|
|
379
|
+
};
|
|
380
|
+
ctx.systemPrompt.section({
|
|
381
|
+
name: "tool:" + config.toolName,
|
|
382
|
+
order: ctx.systemPrompt.getSectionOrder("TOOL_BASH"),
|
|
383
|
+
text: `Check the [exit code: N] marker on every ${config.toolName} result; investigate failures before moving on.`
|
|
384
|
+
});
|
|
385
|
+
/**
|
|
386
|
+
* One registration of the `bash` tool. With a registry, every call
|
|
387
|
+
* registers its process as a job at its start; without one the tool is
|
|
388
|
+
* foreground-only and the executor's deadline kills the command.
|
|
389
|
+
*/
|
|
390
|
+
const bashTool = (jobs) => {
|
|
391
|
+
const background = jobs !== void 0;
|
|
392
|
+
const promote = background && promoteOnTimeout;
|
|
393
|
+
/** Register the command as a job; the process spawns inside the starter, after admission. */
|
|
394
|
+
const startJob = (registry, args, exec, spec) => {
|
|
395
|
+
let proc;
|
|
396
|
+
let stopped;
|
|
397
|
+
return {
|
|
398
|
+
id: registry.start({
|
|
399
|
+
kind: "bash",
|
|
400
|
+
label: args.command,
|
|
401
|
+
...exec.agent ? { owner: exec.agent.id } : {},
|
|
402
|
+
output: processSources(() => proc),
|
|
403
|
+
run: () => {
|
|
404
|
+
const hooks = processJob(async (signal) => {
|
|
405
|
+
proc = await ctx.shell.execute({
|
|
406
|
+
...spec,
|
|
407
|
+
signal
|
|
408
|
+
});
|
|
409
|
+
return proc;
|
|
410
|
+
}, (started) => processOutcome(started, escalationModes));
|
|
411
|
+
return {
|
|
412
|
+
done: hooks.done,
|
|
413
|
+
cancel: (reason) => {
|
|
414
|
+
stopped = reason;
|
|
415
|
+
hooks.cancel(reason);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
}),
|
|
420
|
+
process: () => proc,
|
|
421
|
+
stopped: () => stopped
|
|
422
|
+
};
|
|
423
|
+
};
|
|
424
|
+
/** Wait on a registered foreground command until it settles or the timeout passes. */
|
|
425
|
+
const waitOnJob = async (registry, attached, exec, spec) => {
|
|
426
|
+
const owner = exec.agent?.id;
|
|
427
|
+
const timeoutMs = spec.timeoutMs;
|
|
428
|
+
/**
|
|
429
|
+
* Stop the job on this call's own account and stay on it until it
|
|
430
|
+
* settles, so the settlement is `awaited` and no completion notice
|
|
431
|
+
* follows a result this call already carries; the record then leaves
|
|
432
|
+
* with the call, as the model never saw the id.
|
|
433
|
+
*/
|
|
434
|
+
const stop = async (reason) => {
|
|
435
|
+
registry.kill(attached.id, owner, reason);
|
|
436
|
+
const settled = await registry.wait(attached.id, timeoutMs, owner);
|
|
437
|
+
if (settled.status !== "running" && settled.status !== "stopping") registry.remove(attached.id, owner);
|
|
438
|
+
return settled;
|
|
439
|
+
};
|
|
440
|
+
let view;
|
|
441
|
+
try {
|
|
442
|
+
view = await registry.wait(attached.id, timeoutMs, owner, exec.signal);
|
|
443
|
+
} catch {
|
|
444
|
+
await stop("tool call aborted");
|
|
445
|
+
throw toolAborted();
|
|
446
|
+
}
|
|
447
|
+
if ((view.status === "running" || view.status === "stopping") && attached.process() === void 0) {
|
|
448
|
+
await stop("timed out during preparation");
|
|
449
|
+
return {
|
|
450
|
+
kind: "foreground",
|
|
451
|
+
exitCode: null,
|
|
452
|
+
signal: null,
|
|
453
|
+
timedOut: true,
|
|
454
|
+
aborted: false,
|
|
455
|
+
timeoutMs,
|
|
456
|
+
stdout: {
|
|
457
|
+
text: "",
|
|
458
|
+
truncated: false
|
|
459
|
+
},
|
|
460
|
+
stderr: {
|
|
461
|
+
text: "",
|
|
462
|
+
truncated: false
|
|
463
|
+
},
|
|
464
|
+
...spec.sandboxPolicy !== void 0 ? { sandbox: {
|
|
465
|
+
mode: spec.sandboxPolicy.mode,
|
|
466
|
+
denied: false
|
|
467
|
+
} } : {}
|
|
468
|
+
};
|
|
469
|
+
}
|
|
470
|
+
if (view.status === "running" || view.status === "stopping") {
|
|
471
|
+
const read = registry.read(attached.id, owner);
|
|
472
|
+
return {
|
|
473
|
+
kind: "promoted",
|
|
474
|
+
jobId: attached.id,
|
|
475
|
+
timeoutMs,
|
|
476
|
+
output: renderJobRead(ringDelta(read.chunks), read.lossy, read.job.output.spillPaths ?? [], attached.process()?.sandbox, escalationModes)
|
|
477
|
+
};
|
|
478
|
+
}
|
|
479
|
+
registry.remove(attached.id, owner);
|
|
480
|
+
const process = attached.process();
|
|
481
|
+
if (process === void 0) throw new Error(view.detail);
|
|
482
|
+
const result = await process.result();
|
|
483
|
+
const stopped = attached.stopped();
|
|
484
|
+
return {
|
|
485
|
+
kind: "foreground",
|
|
486
|
+
...canonicalBashResult(result),
|
|
487
|
+
...stopped !== void 0 ? { stopped } : {}
|
|
488
|
+
};
|
|
489
|
+
};
|
|
490
|
+
return defineTool({
|
|
491
|
+
name: config.toolName,
|
|
492
|
+
description: bashDescription(),
|
|
493
|
+
parameters: {
|
|
494
|
+
command: {
|
|
495
|
+
type: "string",
|
|
496
|
+
required: true,
|
|
497
|
+
description: "The bash command to execute."
|
|
498
|
+
},
|
|
499
|
+
description: {
|
|
500
|
+
type: "string",
|
|
501
|
+
required: true,
|
|
502
|
+
description: "Clear, concise description of what this command does in active voice, 5-10 words (shown in the UI). Examples: \"ls\" → \"List files in current directory\"; \"git status\" → \"Show working tree status\"; \"npm install\" → \"Install package dependencies\"."
|
|
503
|
+
},
|
|
504
|
+
timeoutMs: {
|
|
505
|
+
type: "number",
|
|
506
|
+
description: promote ? "Timeout in milliseconds. The executor applies its configured default and cap; on expiry the command moves to the background as a job instead of being killed." : "Timeout in milliseconds. The executor applies its configured default and cap, and kills the command on expiry."
|
|
507
|
+
},
|
|
508
|
+
workdir: {
|
|
509
|
+
type: "string",
|
|
510
|
+
description: "Working directory for this command. Defaults to the session workspace; a relative path is resolved against it."
|
|
511
|
+
},
|
|
512
|
+
...background ? { run_in_background: {
|
|
513
|
+
type: "boolean",
|
|
514
|
+
description: "Run in the background and return a job id immediately (collect with job_output, stop with job_kill). No timeout applies."
|
|
515
|
+
} } : {},
|
|
516
|
+
...escalationModes.length > 0 ? {
|
|
517
|
+
sandbox_permissions: {
|
|
518
|
+
type: "string",
|
|
519
|
+
enum: [...escalationModes],
|
|
520
|
+
description: sandboxPermissionsDescription("command")
|
|
521
|
+
},
|
|
522
|
+
justification: {
|
|
523
|
+
type: "string",
|
|
524
|
+
description: "Required with sandbox_permissions: one sentence for the user explaining why this exact command needs the wider access. Use the language of the user’s current request."
|
|
525
|
+
}
|
|
526
|
+
} : {}
|
|
527
|
+
},
|
|
528
|
+
output: {
|
|
529
|
+
schema: { oneOf: [
|
|
530
|
+
{
|
|
531
|
+
type: "object",
|
|
532
|
+
additionalProperties: false,
|
|
533
|
+
properties: BACKGROUND_OUTPUT_PROPERTIES
|
|
534
|
+
},
|
|
535
|
+
{
|
|
536
|
+
type: "object",
|
|
537
|
+
additionalProperties: false,
|
|
538
|
+
properties: {
|
|
539
|
+
kind: {
|
|
540
|
+
type: "string",
|
|
541
|
+
required: true,
|
|
542
|
+
const: "promoted"
|
|
543
|
+
},
|
|
544
|
+
jobId: {
|
|
545
|
+
type: "string",
|
|
546
|
+
required: true
|
|
547
|
+
},
|
|
548
|
+
timeoutMs: {
|
|
549
|
+
type: "number",
|
|
550
|
+
required: true
|
|
551
|
+
},
|
|
552
|
+
output: {
|
|
553
|
+
type: "string",
|
|
554
|
+
required: true
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
type: "object",
|
|
560
|
+
additionalProperties: false,
|
|
561
|
+
properties: {
|
|
562
|
+
kind: {
|
|
563
|
+
type: "string",
|
|
564
|
+
required: true,
|
|
565
|
+
const: "foreground"
|
|
566
|
+
},
|
|
567
|
+
exitCode: {
|
|
568
|
+
required: true,
|
|
569
|
+
oneOf: [{ type: "integer" }, { type: "null" }]
|
|
570
|
+
},
|
|
571
|
+
signal: {
|
|
572
|
+
required: true,
|
|
573
|
+
oneOf: [{ type: "string" }, { type: "null" }]
|
|
574
|
+
},
|
|
575
|
+
timedOut: {
|
|
576
|
+
type: "boolean",
|
|
577
|
+
required: true
|
|
578
|
+
},
|
|
579
|
+
aborted: {
|
|
580
|
+
type: "boolean",
|
|
581
|
+
required: true
|
|
582
|
+
},
|
|
583
|
+
stopped: { type: "string" },
|
|
584
|
+
timeoutMs: {
|
|
585
|
+
type: "number",
|
|
586
|
+
required: true
|
|
587
|
+
},
|
|
588
|
+
stdout: {
|
|
589
|
+
type: "object",
|
|
590
|
+
additionalProperties: false,
|
|
591
|
+
required: true,
|
|
592
|
+
properties: {
|
|
593
|
+
text: {
|
|
594
|
+
type: "string",
|
|
595
|
+
required: true
|
|
596
|
+
},
|
|
597
|
+
truncated: {
|
|
598
|
+
type: "boolean",
|
|
599
|
+
required: true
|
|
600
|
+
},
|
|
601
|
+
spillPath: { type: "string" }
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
stderr: {
|
|
605
|
+
type: "object",
|
|
606
|
+
additionalProperties: false,
|
|
607
|
+
required: true,
|
|
608
|
+
properties: {
|
|
609
|
+
text: {
|
|
610
|
+
type: "string",
|
|
611
|
+
required: true
|
|
612
|
+
},
|
|
613
|
+
truncated: {
|
|
614
|
+
type: "boolean",
|
|
615
|
+
required: true
|
|
616
|
+
},
|
|
617
|
+
spillPath: { type: "string" }
|
|
618
|
+
}
|
|
619
|
+
},
|
|
620
|
+
sandbox: {
|
|
621
|
+
type: "object",
|
|
622
|
+
additionalProperties: false,
|
|
623
|
+
properties: {
|
|
624
|
+
mode: {
|
|
625
|
+
type: "string",
|
|
626
|
+
required: true
|
|
627
|
+
},
|
|
628
|
+
denied: {
|
|
629
|
+
type: "boolean",
|
|
630
|
+
required: true
|
|
631
|
+
},
|
|
632
|
+
enforcement: { type: "string" },
|
|
633
|
+
runnerFailed: { type: "boolean" }
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
] },
|
|
639
|
+
render: (_args, value) => [{
|
|
640
|
+
type: "text",
|
|
641
|
+
text: value.kind === "background" ? `started background job ${value.jobId}` : value.kind === "promoted" ? renderPromoted(value) : renderResult(value, escalationModes)
|
|
642
|
+
}]
|
|
643
|
+
},
|
|
644
|
+
async execute(args, exec) {
|
|
645
|
+
const standingPolicy = resolveSandboxPolicy(exec);
|
|
646
|
+
validateBashArgs(args, standingPolicy?.mode);
|
|
647
|
+
const approvedMode = args.sandbox_permissions !== void 0 && args.justification !== void 0 ? await approveBashEscalation(args.sandbox_permissions, args.justification, exec, standingPolicy) : void 0;
|
|
648
|
+
const policy = approvedMode === void 0 ? standingPolicy : {
|
|
649
|
+
...standingPolicy,
|
|
650
|
+
mode: approvedMode
|
|
651
|
+
};
|
|
652
|
+
const workdir = resolveWorkdir(args.workdir, exec, standingPolicy?.workspaceRoot);
|
|
653
|
+
const dshEnv = ctx.shellEnv.collect(exec);
|
|
654
|
+
const request = {
|
|
655
|
+
env: desktopShellEnvironment(),
|
|
656
|
+
command: args.command,
|
|
657
|
+
...workdir !== void 0 ? { workdir } : {},
|
|
658
|
+
...args.timeoutMs !== void 0 ? { timeoutMs: args.timeoutMs } : {},
|
|
659
|
+
dshEnv,
|
|
660
|
+
...policy !== void 0 ? { sandboxPolicy: policy } : {}
|
|
661
|
+
};
|
|
662
|
+
if (args.run_in_background === true) {
|
|
663
|
+
if (!backgroundEnabled) throw new Error("run_in_background is disabled for this deployment (enableRunInBackground: false)");
|
|
664
|
+
if (jobs === void 0) throw new Error("background jobs unavailable: load @deepseek-ai/dsh-jobs and @deepseek-ai/dsh-tool-jobs");
|
|
665
|
+
if (exec.signal.aborted) throw toolAborted();
|
|
666
|
+
return {
|
|
667
|
+
kind: "background",
|
|
668
|
+
jobId: startJob(jobs, args, exec, ctx.shell.resolve({
|
|
669
|
+
...request,
|
|
670
|
+
onExpiry: "none"
|
|
671
|
+
})).id
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
if (jobs !== void 0 && promote) {
|
|
675
|
+
const spec = ctx.shell.resolve({
|
|
676
|
+
...request,
|
|
677
|
+
onExpiry: "none"
|
|
678
|
+
});
|
|
679
|
+
let attached;
|
|
680
|
+
try {
|
|
681
|
+
attached = startJob(jobs, args, exec, spec);
|
|
682
|
+
} catch (error) {
|
|
683
|
+
ctx.logger.warn(`bash: job registration refused, running in the foreground with the timeout kill instead: ${String(error)}`);
|
|
684
|
+
}
|
|
685
|
+
if (attached !== void 0) return waitOnJob(jobs, attached, exec, spec);
|
|
686
|
+
}
|
|
687
|
+
const result = await (await ctx.shell.execute(ctx.shell.resolve({
|
|
688
|
+
...request,
|
|
689
|
+
signal: exec.signal
|
|
690
|
+
}))).result();
|
|
691
|
+
if (result.aborted) throw toolAborted();
|
|
692
|
+
return {
|
|
693
|
+
kind: "foreground",
|
|
694
|
+
...canonicalBashResult(result)
|
|
695
|
+
};
|
|
696
|
+
},
|
|
697
|
+
presentCall: presentBashCall,
|
|
698
|
+
presentResult: presentBashResult
|
|
699
|
+
});
|
|
700
|
+
};
|
|
701
|
+
if (!backgroundEnabled) {
|
|
702
|
+
ctx.tools.register(bashTool(void 0));
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
let foregroundOnly = ctx.get("jobs") === void 0 ? ctx.tools.register(bashTool(void 0)) : void 0;
|
|
706
|
+
ctx.inject(["jobs"], (jobCtx) => {
|
|
707
|
+
foregroundOnly?.();
|
|
708
|
+
foregroundOnly = void 0;
|
|
709
|
+
const unregister = ctx.tools.register(bashTool(jobCtx.jobs));
|
|
710
|
+
jobCtx.effect(() => () => {
|
|
711
|
+
unregister();
|
|
712
|
+
if (ctx.fiber.state === 2) foregroundOnly = ctx.tools.register(bashTool(void 0));
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
}
|
|
716
|
+
//#endregion
|
|
717
|
+
export { Config, apply, inject, name };
|