DeepSeek Harness (dsh) Plugin: dsh-niubash-only

Preface

The plugin ecosystem of DeepSeek Harness (dsh) emphasizes that “everything is a plugin”. In a Windows environment, agent models tend to habitually use PowerShell or CMD syntax. These commands often do not throw errors in Niubash but result in silent failures (for example, $env:PATH is expanded as an empty variable to :PATH, with an exit code of 0). dsh-niubash-only aims to solve this problem by taking over the execution layer, enforcing a single environment, and providing a teaching layer to ensure models write correct Bash code even on Windows.

Plugin Positioning

Positioning: DeepSeek Harness (dsh) bundle: Niubash as the sole shell executor + Bash-on-Windows instruction.
Author: YMRwithNoworry
License: MIT

Core Functions

The plugin resolves compatibility issues through the coordination of four layers:

  1. Execution Layer Takeover
    The plugin takes over the ctx.shell execution layer, disables the first-party bash-sandbox / pwsh-sandbox, and replaces them with dsh-niubash-only/executor. All shell executions are uniformly converted to niu -c "<command>". Logic such as timeout, output limit, spill files, and background handles inherits from the first-party implementation, but defaults to running directly on the local machine (sandbox: false) without additional wrapping.

  2. Rejecting Other Shells (Enforcement Layer)
    The executor has a built-in guard that refuses to hand execution rights to other shells (such as pwsh, powershell, cmd /c, wsl, nu, zsh, etc.). For bash / sh, the plugin detects whether the local command with the same name resolves to the Niubash installation directory; otherwise, it is rejected.

  3. Dialect Pre-check Layer
    Before command execution, the plugin checks and rejects PowerShell/CMD idioms (such as $env:VAR, Get-ChildItem, if ($x...), etc.) and writes the correct Bash syntax into the error text. Strings, comments, and heredoc bodies are masked to avoid false positives.

  4. Teaching Layer & Failure Hints
    A teaching layer registered on the host plane, containing shell: niubash-rules (rules), shell: niubash-guide (Bash on Windows manual), and tool description rewriting. When execution fails, a correction hint based on the actual error is appended to the end of stderr.

Installation and Enablement

Prerequisites:
* dsh version >= 0.2.0-rc.2
* Node.js >= 22.19.0
* Install Niubash 1.1.4 (with WinuxCmd 1.0.8)

Installation Command:

# Install via GitHub
dsh plugin --profile web add github:YMRwithNoworry/dsh-niubash-only

# Or install from npm (ensure dsh version matches)
dsh plugin --profile web add dsh-niubash-only

Must Read Before Enabling:
Starting from dsh 0.2.0-rc.2, runtime versions are validated against peerDependencies; mismatches will cause installation to be rejected. Restarting the profile is mandatory after installation.

Conflict Handling:
Only one ctx.shell provider is allowed per context. If the profile already contains other shell executors (such as dsh-nushell-only or @cmx666/dsh-winuxsh-bundle), they must be uninstalled or disabled first; otherwise, startup will fail due to duplicate registration. Common operations:

# Uninstall conflicting plugins
dsh plugin --profile web remove dsh-nushell-only
dsh plugin --profile web remove @cmx666/dsh-winuxsh-bundle

Verify Installation:

dsh --profile web --dump-config | grep -n niubash

The expected output should include niubash-executor and niubash-teaching configuration items, and bash-sandbox / pwsh-sandbox should be disabled.

Configuration Description

The plugin injects configuration via cordis.patch.yml by default, mainly consisting of two parts:

- id: niubash-executor
  name: dsh-niubash-only/executor
  config:
    timeoutMs: 120000
    enforceNiubashOnly: true   # Refuse shell switching
    dialectLint: true          # Pre-check dialect errors
    dialectHints: true         # Provide hints on failure
    sandbox: false             # Do not enable sandbox wrapping by default

- id: niubash-teaching
  name: dsh-niubash-only/teaching
  config:
    guide: full                # Provide full Bash on Windows manual
    rewriteToolDescriptions: true

Use Cases and Precautions

  • Use Cases: Using DeepSeek Harness to develop agents in a Windows environment, intending to force the model to use Bash syntax rather than PowerShell, or needing to solve compatibility issues with Windows native Shells.
  • Permission Notes: Under the default configuration sandbox: false, execution occurs directly on the local machine, and the result will truthfully report mode: danger-full-access.
  • Dependency Notes: Ensure that niu.exe exists in the local PATH, otherwise every call will fail.

Summary

dsh-niubash-only forces the agent development environment on Windows to be unified as Niubash by taking over the ctx.shell interface, combined with dialect pre-checks and a teaching layer. It does not rely on sandbox isolation but ensures execution correctness through strict syntax checks and error hints, making it suitable for developers requiring stable Bash interaction.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye