🎁 福利专区全网大模型免费应用 + 新用户福利 + 注册活动入口,低成本玩转 AI

挂起命令拦截 acus9345/dsh-block-hanging-commands

DeepSeek Harness
acus93457 天前有提交已提供中文文档扫描:未发现敏感能力

这个插件给 DeepSeek Harness 用,会在每条 shell…

31.5/100
综合分
2
GitHub 星标
—
npm 周下载
—/5
用户评分

数据截至 2026/10/25 · 周下载取自 npm 全网(含 CI / 镜像),非本站安装数;综合分由星标、活跃度与兼容性检查合成。

安装命令 · 需先装 dsh CLI 引擎
dsh plugin --profile web add acus9345/dsh-block-hanging-commands
该包不可直接 npm 安装,改从 GitHub 源安装(明细见下方安装检查)

状态速览

判定依据:实装验证 · 静态安装检查 · 自动扫描 · 仓库维护状态
信任档位:需留意
是什么
dsh 原生插件 · security
装得上吗
实装验证未通过(unknown),装前请到仓库确认最近更新与 issue
L4 · 真实安装等级说明 →
安全吗
本站尚未对该插件做风险分级
暂未覆盖,不等同于无风险
还在维护吗
活跃:最近一次提交在 7 天前
档位由哪些信号合成

本站实装验证(真实安装 L4 覆盖全站;L5 为运行时冒烟或实机截图,覆盖范围小于 L4) · 验证所用 dsh 版本 · 静态安装检查 · 风险分级 · 仓库维护状态。 下方各区块是它的证据明细。

验证判据与等级说明 →
⚠︎ 实装验证未通过(unknown · 2026/10/30) ——可能是验证环境差异,装前建议到 GitHub 仓库确认最近更新与 issue。
社区实装还没有人打卡 · 装过的第一个就是你
安全扫描自动 · 静态分析源码
v2.7.0
🟢 扫描:未发现敏感能力尚无人工评估
展开查看扫描说明与证据 ↓

静态扫描未发现敏感能力:最多只发网络请求、读取自身元数据或只读文件,未发现执行命令、文件写入或敏感信息读取。

扫描于 2026/10/31(1 天前) · 范围 入口闭包 + 发布文件清单 · 来源 GitHub 仓库

静态扫描只反映源码中出现的调用,不构成安全背书;人工评估与自动扫描相互独立、互不覆盖。

依赖的 DSH / Cordis 模块
@deepseek-ai/cordis@deepseek-ai/dsh@deepseek-ai/dsh-agent@deepseek-ai/dsh-fs@deepseek-ai/dsh-llm@deepseek-ai/dsh-session@deepseek-ai/dsh-tools@deepseek-ai/schemastery
给这个插件打分还没有人投票↓
用户评分
还没有人投票,来当第一个

DeepSeek Harness 插件,阻止智能体执行会等待输入或永不退出的 shell 命令。

README

由 DeepSeek 最新模型翻译生成
dsh-block-hanging-commands 用过一段时间智能体,你大概见过这种场面。它跑 git commit 却不带 -m,或者跑 npm run dev,或者跑 python3 后面什么都不跟,然后这一轮就卡在那儿了。命令在等键盘输入,可没人敲。通常最后是工具超时,模型什么也没学到,接着又试一个同样糟糕的写法。 这个插件给 DeepSeek Harness 用,会在每条 shell 命令执行前先读一遍。如果命令会等输入、或者根本不会退出,就不执行。模型会收到原因,以及该换成什么命令,这样它能在同一步里把调用改对。 dsh-block-hanging-commands stopped git commit before it ran, because git commit without a message opens an editor, so the tool call would just sit there until it timed out. Instead: pass the message: git commit -m "<message>" (or --no-edit when amending). (rule: git-editor) 安装
展开完整文档(README 剩余 1 节)
dsh-block-hanging-commands

用过一段时间智能体,你大概见过这种场面。它跑 git commit 却不带 -m,或者跑 npm run dev,或者跑 python3 后面什么都不跟,然后这一轮就卡在那儿了。命令在等键盘输入,可没人敲。通常最后是工具超时,模型什么也没学到,接着又试一个同样糟糕的写法。

这个插件给 DeepSeek Harness 用,会在每条 shell 命令执行前先读一遍。如果命令会等输入、或者根本不会退出,就不执行。模型会收到原因,以及该换成什么命令,这样它能在同一步里把调用改对。

dsh-block-hanging-commands stopped git commit before it ran, because git commit
without a message opens an editor, so the tool call would just sit there until it timed out.
Instead: pass the message: git commit -m "<message>" (or --no-edit when amending).
(rule: git-editor)

安装

dsh plugin --profile web add dsh-block-hanging-commands

这里用的是 web 配置档,也就是你用 dsh web 启动的浏览器 UI。如果你用别的方式跑 DSH,换成 headless(脚本和 CI)或 acp(编辑器集成)。每个配置档各管一份插件列表,所以你用到的每个配置档都要加一遍。设置就这些。插件自带补丁层,装完就生效。

卸载:dsh plugin --profile web remove dsh-block-hanging-commands。

从克隆的仓库安装

想试本地改动,先打包成 tarball 再安装:

git clone https://github.com/acus9345/dsh-block-hanging-commands
cd dsh-block-hanging-commands
npm install
npm pack
dsh plugin --profile web add ./dsh-block-hanging-commands-0.2.0.tgz

能拦下什么

| 规则 | 例子 | 告诉模型改成什么 |
| editor | vim、nano、emacs、code --wait、subl -w | 用编辑工具或 sed -i |
| git-editor | git commit 或 git tag -a 不带 -m | 加上 -m / --no-edit |
| git-interactive | git rebase -i、git add -p | 普通 rebase,或者配 GIT_SEQUENCE_EDITOR=: 用 --autosquash;git add <path> |
| repl | python、node、psql mydb、redis-cli、sqlite3 db | -c "..."、脚本文件,或 heredoc |
| server | npm run dev、vite、next dev、flask run、rails s | run_in_background: true,或 timeout |
| watch | jest --watch、tsc -w、cargo watch、nodemon | 去掉 watch 参数,跑一次 |
| follow | tail -f、journalctl -f、kubectl logs -f、docker logs -f | tail -n 200、--since |
| remote-shell | ssh host 后面不带命令 | 把命令传进去;-o BatchMode=yes |
| container-tty | docker run -it、docker exec -it、kubectl exec -it | 去掉 -it |
| tui | htop、top、lazygit、tig、ncdu | 批量版本(top -bn1、git log) |
| prompt / login | 不带 -y 的 npm init、crontab -e、gh auth login、aws configure | 加上非交互式参数,或者去问用户 |
| pager、tty-prompt | less file、sudo 索要密码 | 只在 PTY shell 上,见下文 |

它会穿透常见的包装命令(sudo、env、nohup、npx、pnpm exec、uv run、bash -c '...'),并处理管道、&& 链、heredoc 和重定向。所以 cd app && npm run dev 会被拦下,但 echo q | python3 和 python3 < script.py 不会,因为它们的输入已经就位。timeout 30 npm run dev 能通过,带 run_in_background: true 的调用也能通过。这两种情况下命令反正都会结束或脱离。开发服务器、watcher 或 tail -f 如果用的是 shell 工具自带的 timeoutMs,同样能通过,因为那个超时以同样的方式给它设了上限。编辑器或提示词仍然不行,因为超时只会把它留在后台干等。

它在 Windows 上也能用,DSH 在那里通过 PowerShell(pwsh)而不是 bash 执行命令。在 Windows 上它还认得 npm.cmd、C:\Python312\python.exe 这样的完整路径、& 调用运算符和 Get-Content -Wait。

我费了不少劲压低误报。psql -c "select 1"、node script.js、vim -es、git commit -F msg.txt、top -bn1、ssh host uptime,以及任何命令上的 --help / --version,都能通过。

配置

最简单的办法:打开 DSH 侧边栏里的 Plugins,点 dsh-block-hanging-commands,改你要改的,然后按 Save。下一次工具调用就生效,不用重启。

或者在 ~/.dsh/profiles/<profile>/cordis.patch.yml 里加一行,像下面这样;想覆盖所有配置档就写进 ~/.dsh/cordis.patch.yml。没写的键保持默认值。

- id: block-hanging-commands
config:
mode: deny # or ask to get an approval prompt instead of a refusal
tools: [bash, pwsh] # shell tool names to inspect (pwsh is the Windows shell)
pty: false # set true if your shell tool runs on a PTY (dsh-tool-bash-persistent)
disabledRules: [] # e.g. [server] if you really want the model starting dev servers
allowPatterns: [] # regexes, e.g. ['^make serve$']

pty 很关键,因为没有终端时,less 和 git log 不会分页,sudo 会直接失败而不是提示输密码。所以这些规则只在 shell 真的是 PTY 时才启用。

工作原理

插件挂到 tools/pre-execute 上。它自己给命令分词(不启动 shell),把每个简单命令逐条对照规则检查,命中就返回 deny 并附上原因文本。什么都不执行,什么都不改写。接下来怎么做仍然由模型决定,只是它做决定时信息更充分。

开发

npm install
npm test # unit tests for the command parser and rules
npm run test:e2e # boots real dsh against a scripted local model, no API key needed

安装测试会跑 dsh plugin add,这需要你的 PATH 里有 pnpm。
端到端测试套件还会打包插件,再用 dsh plugin add 安装,跟用户的操作方式一样,确保发布出去的包真的能加载。

MIT 协议。作者 acus9345。欢迎在 issues 里提 bug 和想法。
预览分享卡片长什么样 ↓acus9345/dsh-block-hanging-commands
分享 · DeepSeek Harness Hub
acus9345/dsh-block-hanging-commands

这个插件给 DeepSeek Harness 用,会在每条 shell…

回到顶部