メインコンテンツへスキップ
Q

dsh-shell

qianwenxue1/dsh-shell

dsh-shell for DeepSeek Harness: runs cmd / PowerShell commands on Windows (and bash-like shells on POSIX) with a bash-inspired safety model — timeouts, output truncation, exit codes, background jobs and a cwd allowlist

インストール

dsh plugin --profile web add github:qianwenxue1/dsh-shell

README

dsh-shell

A DeepSeek Harness (DSH) plugin that lets the model run cmd and PowerShell commands on Windows — with the safety model of the standard bash tool.

Why

The stock bash tool of many agents fails on Windows (subprocess-local: terminal inspection is unsupported on platform win32). dsh-shell registers a shell_exec tool that understands Windows natively:

  • cmd.exe /d /s /c ... by default
  • powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -Command ...
  • sh/bash fallback on Linux/macOS hosts

It mirrors the bash tool's safety contract:

FeatureBehavior
Persistent cwdcd persists across calls (per session, on disk)
Timeoutper-command timeout ms, capped by maxTimeout
Output truncationper-stream maxOutputBytes cap with a marker (head + tail kept)
Exit codesexit_code, timed_out, stdout, stderr, truncated
Background jobsbackground: true returns a job_id; poll with shell_job_status
Denylistrefuses rm -rf /, format, drive-wide del/rd, shutdown, registry/service deletes
cwd allowliststays inside the session workspace unless allowAnyCwd

Install

npm

dsh plugin --profile web add @qianwenxue1/dsh-shell

build soure

# from npm after publishing
dsh plugin --profile web add @qianwenxue1/dsh-shell

# or from a local checkout
git clone https://github.com/qianwenxue1/dsh-shell.git
cd dsh-shell
pnpm install
pnpm build
dsh plugin --profile web add .

Config

- id: dsh-shell
  config:
    stateDir: .dsh-shell      # per-session state under the workspace
    defaultShell: cmd         # cmd | powershell
    maxTimeout: 600000        # ms hard cap
    maxOutputBytes: 30720     # per-stream cap (head + tail kept)
    allowAnyCwd: false        # true to allow cd/commands outside the workspace
    allowDangerous: false     # true to bypass the denylist

Tools

shell_exec

Run a command in the persistent shell.

{ "command": "dir /b", "shell": "cmd" }                       // simplest
{ "command": "Get-ChildItem -Name", "shell": "powershell" }   // PowerShell cmdlets
{ "command": "npm test", "timeout": 180000, "background": true } // long-running

shell_job_status

Poll a background job:

{ "job_id": "job-1710000000000-abc123" }

Development

pnpm install
pnpm build
pnpm verify

License

MIT

関連プラグイン