Introduction¶
DeepSeek Harness (DSH) enables PowerShell (pwsh) by default on Windows. Since bash dominates the training corpora of LLMs far more than PowerShell, agents exhibit a significantly higher error rate when executing POSIX commands. Allowing agents to use bash directly in a Windows environment reduces command miswrites and execution failures, thereby improving development efficiency.
Plugin Overview¶
dsh-windows-bash is a Windows default-shell policy plugin for DSH. It detects git-bash/MSYS2/Cygwin, provides a “Default Shell” collapsible card in Settings → Plugins → Plugin Config for one-click switching between bash and pwsh, dynamically registers the bash tool, and converges the tool surface via tools.restrict so that the agent only faces a single executable shell. This repository is a standalone maintained fork, originally sourced from LAN-TINA-WS/dsh-windows-shell-policy, and has been adapted for dsh 0.2.2 starting from v0.1.0.
Core Capabilities¶
- Bash detection: Explicit
bashPath→ common Git installation paths (Program Files / x86) → MSYS2 / Cygwin → PATH; uses whichever is found first. - Config panel: Expand the “Default Shell” card in Settings → Plugins → Plugin Config to view detection status and the currently effective shell. Supports auto/bash/pwsh selection (staged editing with Save/Discard; unsaved-change indicator persists when collapsed).
- Policy enforcement:
auto: Uses bash if detected; otherwise falls back to pwsh.bash: Forces git-bash (falls back to pwsh with a notification if bash is not detected).pwsh: Forces PowerShell (preserves DSH default behavior).- Changes take effect from the next request after saving.
- Bash tool: Dynamically registered when
effective=bash(executed via git-bash, subprocess channel, with timeout / output truncation / exit-code tagging). Displayed in a terminal card (viewable in the chat page for command, cwd, output, and exit status, consistent with the official shell tool). - Tool surface convergence: Per-agent
tools.restrict({deny})hides the alternate shell; both schema and execution admission are narrowed (model hard-calls to a hidden shell are rejected as unknown). No longer depends onsystem-prompt/assemble; confined sessions automatically fall back to pwsh. - Persistence:
preferredis written to the settings document under theshell-policysection and survives restarts. - Clean uninstall:
dsh plugin --profile web removeordev_uninject_pluginrestores everything in one step (tool deregistration + prompt restoration + junction cleanup).
Installation & Activation¶
Direct GitHub install (recommended, fastest for networks in China, no npm wait):
dsh plugin --profile web add github:qiansanyu/dsh-windows-bash
# Restart dsh web, then open Settings → Plugins → Plugin Config to begin configuration
npm install: This repository is published on npm under the new package name dsh-windows-bash (the dsh-windows-shell-policy on npm is the upstream legacy package v0.0.7 without dsh 0.2.2 compatibility — do not confuse the two). Once the npm release channel is ready, the install command will be npm i -g dsh-windows-bash; for now, please prefer the GitHub direct install or Release ZIP above.
Release ZIP install:
- Download
dsh-windows-bash-v*.zipfrom Releases and extract dsh plugin --profile web add link:<extracted_dir>- Restart
dsh web, then open Settings → Plugins → Plugin Config to begin configuration
Injector install (no restart, dev environment):
DSH_CHECKOUT=<checkout> bash scripts/build.sh # produces lib/index.js + lib/client.js
dev_inject_plugin <this_dir> # host + UI take effect immediately
Configuration¶
Expand the “Default Shell” card in Settings → Plugins → Plugin Config and select as needed:
| Option | Behavior |
|---|---|
| Auto | Uses bash if git-bash is detected; otherwise falls back to pwsh (works out of the box) |
| bash | Forces git-bash (falls back to pwsh with a notification if bash is not detected) |
| pwsh | Forces PowerShell (preserves DSH default behavior) |
Changes take effect from the next request after saving. preferred and bashPath are persisted via the settings service in this plugin’s entry config and survive restarts. An explicit bash path can be edited directly in the config panel.
Typical Usage¶
- Install the plugin using the commands above and restart
dsh web. - Open Settings → Plugins → Plugin Config and expand the “Default Shell” card.
- Select Auto, save, then send a request. The plugin will detect git-bash/MSYS2/Cygwin on the system and use it automatically.
- To force bash usage, select bash, save, and send another request — it will use git-bash (falls back to pwsh with a notification if not detected).
- View the terminal card in the chat page to inspect the command, cwd, output, and exit status.
Applicable Scenarios & Notes¶
This plugin is suitable for users who develop with DSH on Windows and want their agents to execute commands via bash to reduce command miswrites and execution failures. The plugin runs with the permissions of the current DSH process. Please review the source code and license (MIT) before installing.
Conclusion¶
dsh-windows-bash enables agents to execute commands via bash on Windows through detection, config-panel switching, dynamic bash tool registration, and tool surface convergence, thereby reducing PowerShell compatibility issues. Both installation and configuration can be completed within the DSH Web UI, and upon uninstallation, tools and prompts can be restored in one step.