MAXeaglet/dsh-bash-terminal
dsh-bash-terminal
dsh-bash-terminal is a community DeepSeek Harness plugin. Read the repository README before installing.
Install
npx @deepseek-ai/dsh plugin --profile web add dsh-bash-terminalRestart `dsh web` after install. Bundle APIs can change during the developer preview.
README badge
[](https://dshhub.dev/plugins/dsh-bash-terminal)Paste this into your README. The star count updates with every catalog sync.
From the README
Excerpt from MAXeaglet/dsh-bash-terminal, cleaned of badges and images.
dsh-bash-terminal
DSH(DeepSeek Harness)插件:一个 shell 工具,在 Windows 上统一执行 PowerShell / Git Bash / WSL 三种终端命令。
| 后端 | 实际执行 | 语法 / 路径 | 环境变量 |
|---|---|---|---|
powershell(默认) | pwsh -NoLogo -NoProfile -NonInteractive -Command <cmd> | PowerShell;C:\... | $env:NAME |
gitbash | Git for Windows bash -lc <cmd> | POSIX;/d/WorkSpace;PATH 含 /usr/bin、/mingw64/bin | $NAME |
wsl | wsl [-d <distro>] -e bash -lc <cmd> | Linux;/mnt/d/... | $NAME(经 WSLENV) |
每次调用都启动全新 shell:不保留状态(cwd / 变量 / 别名)——请传 workdir 而不是用 cd。
设计要点
- 终端由用户决定,AI 无法更改:Web UI 设置页(设置 → 通用)出现"默认终端"下拉(PowerShell / Git Bash / WSL);
shell工具永远只使用该设置,不暴露终端参数给模型。设置通过 DSH settings 系统持久化(settings.yaml)。 - 不占用
ctx.shell能力接缝:DSH 自带的沙箱化pwsh工具保持原样可用;本插件的shell工具是额外的多终端入口。 - 通过共享的
ctx.subprocessseam 派生进程:进程树终止(Windowstaskkill /T)、SIGTERM→grace→SIGKILL、输出 spill 文件,与官方dsh-tool-bash/dsh-tool-pwsh行为一致。 - 后台任务注册进通用
jobsregistry,支持run_in_background/job_output/job_kill。 - 前端设置页的「默认终端」是枚举(UI 自动渲染为下拉),模型每次调用都只按该设置执行,无法自行切换终端。
安装(web profile)
标准安装(npm 发布后,官方 bundle 机制)
插件带官方 dsh.bundle manifest(包内 cordis.patch.yml),profile 列出本包时 DSH 自动应用挂载,无需手改 profile 配置:
# 1. 安装插件包
npm install -g dsh-bash-terminal
dsh plugin --profile web add dsh-bash-terminal # 自动加进 profile 的 bundles 并应用 patch
# 2. patch DSH 设置白名单(DSH 限制,见下方说明)
powershell -ExecutionPolicy Bypass -File install.ps1 install
# 3. 重启 dsh web
已用临时 profile 实测:
bundles: [dsh-bash-terminal]→ dump-config 自动出现tool-bash-terminalentry。
本地开发安装(junction 直连,改源码即时生效)
# 1. 链接插件包到 profile 的 node_modules(junction,改源码即时生效)
$profile = "$env:USERPROFILE\.dsh\profiles\web"
New-Item -ItemType Junction -Path "$profile\node_modules\dsh-bash-terminal" -Target "D:\WorkSpace\projects\dsh-bash-terminal" | Out-Null
# 2. 让插件能解析 @deepseek-ai/* 依赖(junction 到 profile 的依赖树,插件与宿主共用同一份模块实例)
New-Item -ItemType Junction -Path "D:\WorkSpace\projects\dsh-bash-terminal\node_modules\@deepseek-ai" -Target "$profile\..\node_modules\@deepseek-ai" | Out-Null
# 3. 让 profile 通过官方 bundle 挂载插件(install.ps1 install 会自动做;等价于在 dsh.profile.bundles 加 "dsh-bash-terminal")
# 4. (仅修改前端源码后)重新打包 client bundle:
# cd D:\WorkSpace\projects\dsh-bash-terminal && node scripts/build-client.mjs
# 5. 重启 dsh web
⚠️ 不要在本项目里跑
npm install:它会删掉上面第 2 步的 junction,转而给插件装一份独立的@deepseek-ai/*副本 —— 插件和宿主就不再共用模块实例,宿主升级后插件会停在旧 API 上 (本项目曾因此停在 0.1.0-rc.6)。只刷新 lock 时用npm install --package-lock-only。
兼容性:要求 DSH ≥ 0.1.5-rc.1。0.1.5 把浏览器模块表里的
@deepseek-ai/dsh-client-runtime改名为@deepseek-ai/dsh-client-store且只按精确裸名命中;旧 bundle 在新宿主上会报Failed to load plugins/require(...) missed the module table。另:0.1.5 的 Web 设置面改为
settings.describe()动态枚举,不再有 namespace 白名单 (settings-not-exposed已不存在),install.ps1里的白名单 patch 只是历史遗留、可忽略。
当前已不再需要手动改 profile 的
cordis.patch.yml:插件包内自带dsh.bundle.patch(包内cordis.patch.yml),只要 profile 的dsh.profile.bundles里有dsh-bash-terminal,DSH 就会自动挂载。
验证组合树(无需重启):
node "$env:APPDATA\nvm\v24.16.0\node_modules\@deepseek-ai\dsh\lib\bin.js" --profile web --dump-config | Select-String dsh-bash-terminal
使用
用户在 Web UI 设置默认终端:打开设置(齿轮)→ 通用 →「默认终端」下拉,选择 PowerShell / Git Bash / WSL 之一。改动即时生效并持久化。
…

