DSH 插件体检:manifest/patch/entry/build/pack/install 校验、可被模型调用的 plugin_check、profile 宿主遮蔽与 BOM 检测、环境诊断、投毒预检。
安装
# GitHub 源码(首次需按提示配置 allowBuilds 构建授权后重试)
dsh plugin --profile web add github:zoahdev/dsh-plugin-doctor
装任何插件都等于在你的机器上跑第三方代码,权限和你本人一样大——能读你的文件、用你的凭据、访问网络,工具审批管不到它。GitHub 来源的插件还会在安装时执行构建脚本。请只安装可信来源,并尽量锁定 commit(github:owner/repo#sha)。
README
English
Health checks for DeepSeek Harness plugins — the practical answer to the dsh plugin check idea from RFC #1629, until the official command exists.
It works in two ways:
- CLI (
dsh-plugin-doctor/node lib/bin.js) — run it in your terminal or CI before opening a PR. - Plugin shell (
dsh plugin add) — once installed in DeepSeek Harness, the agent can call theplugin_checktool directly: "check whether this plugin is ready to publish", no shell needed.
What it checks
| Check | What it verifies | Default |
|---|---|---|
manifest |
package.json exists; dsh.bundle + dsh.bundle.patch + prepare + main present |
✅ |
patch |
cordis.patch.yml parses as YAML and contains at least one insert row with an id |
✅ |
entry |
main target exists (warns when not built yet) |
✅ |
files |
a files allowlist is declared |
✅ |
build |
pnpm run build succeeds |
--build |
pack + install + config |
pnpm pack, install into a fresh DSH_HOME profile, and confirm the plugin id in --dump-config |
--full |
profile-shadow |
a dsh profile has no real-directory @deepseek-ai/* copy shadowing the host instance (discussion #1697) |
--profile <dir> |
manifest-bom |
a dsh profile's package.json has no UTF-8 BOM (crashes dsh web at boot, discussion #1842) |
--profile <dir> |
large-files |
no profile file exceeds 100 MB (session logs can hit the ~512 MB stringify cap, discussion #1859) | --profile <dir> |
entry-points |
every installed plugin's main/exports target exists (source-copy installs without a build crash dsh web at boot, discussion #1965) |
--profile <dir> |
profile-deps |
the runtime @deepseek-ai scope is present (a bare npm install in a profile dir prunes the shared tree, discussion #2081) |
--profile <dir> |
native-modules |
koffi/node-pty are present in the runtime tree (npm 11 allow-scripts=false skips native builds, discussion #2081) |
--profile <dir> |
pre-execute-side-effects |
pre-execute listeners do not run host-level side effects before approval (heuristic lint, discussion #1863) | default pipeline |
shell-launcher |
child_process usage does not invoke explorer/start/open/powershell/cmd surfaces that can bypass approval/workspace limits (heuristic, discussions #1923/#1863) | default pipeline |
node / pnpm / dsh-path / port-3080 / win-bash |
environment diagnostics: toolchain on PATH, Web UI port free, and Windows bash resolvable for the minimal preset (discussion #1856) | --env |
Exit code is 0 when nothing failed, 1 otherwise. --json prints a machine-readable report for CI.
CLI usage
npx dsh-plugin-doctor . # quick checks on the current directory
npx dsh-plugin-doctor --build ./my-plugin
npx dsh-plugin-doctor --full ./my-plugin
npx dsh-plugin-doctor preflight ./my-plugin # alias: build + full pipeline (discussion #1774)
npx dsh-plugin-doctor check ./my-plugin # same pipeline; matches the proposed `dsh plugin check` surface (RFC #1846)
npx dsh-plugin-doctor --json ./my-plugin
npx dsh-plugin-doctor --profile ~/.dsh/profiles/web # profile tripwire: host-shadowing + manifest BOM
npx dsh-plugin-doctor --env # environment diagnostics (node/pnpm/dsh PATH, port 3080)
npx dsh-plugin-doctor --env --port 8090 # probe a custom web port instead
npx dsh-plugin-doctor env explain DEEPSEEK_API_KEY # secret-safe env provenance (RFC #1953)
npx dsh-plugin-doctor env explain MY_KEY --json # machine-readable envelope; value always [redacted]
npx dsh-plugin-doctor --help
Run from the repo without installing (after pnpm build):
node lib/bin.js --full ./my-plugin
Plugin usage (agent-callable)
Install the plugin into a DeepSeek Harness profile:
dsh plugin --profile web add dsh-plugin-doctor # from npm
# or from a local build:
dsh plugin --profile web add ./dsh-plugin-doctor-1.6.0.tgz
Then ask the agent inside DSH:
检查一下这个插件能不能发布 —— 先跑 build,再做完整验证。 Check whether this plugin is ready to publish — run the build first, then do a full verification.
The agent calls the plugin_check tool (dir, optional build/full flags). The tool returns PASS/WARN/FAIL per check plus an overall ok flag.
What "full" really proves
--full does not just load the bundle. It:
- runs
pnpm packon the real project; - creates a fresh
DSH_HOMEprofile (no pollution of your real one); - runs
dsh plugin add <tarball>; - runs
dsh --dump-configand asserts the plugin id fromcordis.patch.ymlactually appears in the composed config.
CI also runs a real-registry agent-visibility check: a real Cordis context + real dsh-tools ToolRuntime + a scoped agent view, asserting plugin_check is visible through ctx.tools.schemas(scope) — the mechanism agents actually use (covers the dual-instance shadowing class from discussions #1697/#1782).
This is the same path the awesome-dsh-plugin maintainers use when they review plugin PRs.
Why it exists
- pnpm can silently link an older RC into a plugin's peer slot, and "loads fine" does not mean "works" (see the template runtime guard and troubleshooting).
- A repeatable local check (manifest → build → install → config) catches the failures that only show up on other people's machines.
- The
dsh webboot step currently runs on Windows in CI because the upstream npm CLI lacks the linux-x64pty.nodeprebuild (discussion #1686); doctor's install/config verification is platform-independent. - A profile-hoisted real-directory copy of
@deepseek-ai/dsh-toolscan shadow the host instance and crash every tool call (discussion #1697);--profileflags exactly that precondition before anything boots. - A UTF-8 BOM in a profile's
package.jsoncrashesdsh webat boot withUnexpected token(discussion #1842); themanifest-bomcheck catches it before boot. - Environment friction (missing pnpm, Node version, PATH, occupied web port) is the other big setup-time failure class;
--envturns it into one command (thedsh doctoridea from discussion #1719).
Related community tools
- moonquake2004/dsh-doctor — offline profile/session/env diagnostics with 19 checks mapped to community failure reports. Complementary: dsh-plugin-doctor covers the pre-publish plugin path, dsh-doctor covers the offline profile/session path. Its P5 check and our
profile-shadowcheck flag the same host-shadowing precondition from two sides. - iiwish/dsh-testkit — real-host plugin lifecycle testing (pack → install → boot → register → deterministic exercise → uninstall → reboot → residue) in a disposable Docker environment. Complementary: dsh-plugin-doctor is the fast local preflight, dsh-testkit is the full release-branch lifecycle gate.
CI
For plugin authors, the same checks ship as a one-line GitHub Action:
- uses: zoahdev/dsh-plugin-doctor-action@v1
with: { path: . }
See zoahdev/dsh-plugin-doctor-action.
The repository CI runs:
pnpm install --frozen-lockfile → typecheck → build → unit tests → packaged plugin-shell smoke (pack → fresh host install → load lib/plugin.js → register plugin_check → call the real handler → assert result) → CLI smoke → full doctor self-check (pack → fresh DSH_HOME profile → dsh plugin add → --dump-config).
Development
pnpm install
pnpm typecheck
pnpm build
pnpm test
pnpm test:integration
License
MIT © 2026 zoahdev
中文
dsh-plugin-doctor —— DeepSeek Harness 插件的健康检查工具,是 RFC #1629 中 dsh plugin check 提案在官方命令落地前的实际实现。
它有两种使用方式:
- CLI(
dsh-plugin-doctor/node lib/bin.js)——在终端或 CI 里跑,适合提 PR 前自检。 - 插件外壳(
dsh plugin add)——装进 DeepSeek Harness 后,agent 可以直接调用plugin_check工具:说一句"检查一下我这个插件能不能发",不用切到终端。
检查项
| 检查 | 验证内容 | 默认 |
|---|---|---|
manifest |
package.json 存在;dsh.bundle、dsh.bundle.patch、prepare、main 齐全 |
✅ |
patch |
cordis.patch.yml 是合法 YAML,且至少有一条带 id 的 insert |
✅ |
entry |
main 指向的文件存在(未构建时给 WARN) |
✅ |
files |
声明了 files 白名单 |
✅ |
build |
pnpm run build 成功 |
--build |
pack+install+config |
pnpm pack,装进全新 DSH_HOME profile,并在 --dump-config 里确认插件 id |
--full |
profile-shadow |
dsh profile 顶层没有真实目录形式的 @deepseek-ai/* 副本遮蔽宿主实例(讨论 #1697) |
--profile <dir> |
| entry-points | 已安装插件的 main/exports 指向的文件存在(未构建的源码拷贝会导致 dsh web 启动崩溃,讨论 #1965) | --profile |
node / pnpm / dsh-path / port-3080 / win-bash |
环境诊断:工具链在 PATH 上、Web UI 端口空闲、Windows bash 可解析(minimal 预设,讨论 #1856) | --env |
退出码:全部通过为 0,否则为 1。--json 输出机器可读报告,方便接入 CI。
CLI 用法
npx dsh-plugin-doctor . # 对当前目录做快速检查
npx dsh-plugin-doctor --build ./my-plugin
npx dsh-plugin-doctor --full ./my-plugin
npx dsh-plugin-doctor preflight ./my-plugin # 别名:build + 全链路(讨论 #1774)
npx dsh-plugin-doctor check ./my-plugin # 同 pipeline;对应 RFC #1846 的 `dsh plugin check` 命名
npx dsh-plugin-doctor --json ./my-plugin
npx dsh-plugin-doctor --profile ~/.dsh/profiles/web # profile 级宿主遮蔽 tripwire
npx dsh-plugin-doctor --env # 环境诊断(node/pnpm/dsh PATH、3080 端口)
npx dsh-plugin-doctor --env --port 8090 # 探测自定义端口
npx dsh-plugin-doctor env explain DEEPSEEK_API_KEY # 密钥安全的环境变量源大排查(RFC #1953)
npx dsh-plugin-doctor --help
不全局安装也可以(先 pnpm build):
node lib/bin.js --full ./my-plugin
插件用法(agent 可直接调用)
装进 DeepSeek Harness profile:
dsh plugin --profile web add dsh-plugin-doctor # 从 npm 安装
# 或本地构建产物:
dsh plugin --profile web add ./dsh-plugin-doctor-1.5.0.tgz
然后在 DSH 里直接对 agent 说:
检查一下这个插件能不能发布 —— 先跑 build,再做完整验证。
agent 会调用 plugin_check 工具(参数 dir,可选 build/full),逐项返回 PASS/WARN/FAIL 和整体 ok 标志。
--full 真正验证了什么
不是"能加载"就算过,而是:
- 对真实项目执行
pnpm pack; - 创建全新
DSH_HOMEprofile(不污染真实配置); - 执行
dsh plugin add <tarball>; - 执行
dsh --dump-config,断言cordis.patch.yml里的插件 id 真的出现在合成配置里。
这条路径与 awesome-dsh-plugin 维护者人工审插件 PR 的流程一致。
为什么需要它
- pnpm 可能把旧 RC 静默链进插件的 peer 槽;"能加载"不等于"能用"(参见模板的运行时守卫与故障排查)。
- 本地可重复检查(manifest → build → 安装 → 配置)能提前抓出只在别人机器上才会爆的错。
- 因为上游 npm CLI 目前缺 linux-x64 的
pty.node预编译(#1686),dsh web启动冒烟在 CI 的 Windows runner 上执行;doctor 的安装/配置验证与平台无关。 - profile 顶层若出现真实目录形式的
@deepseek-ai/dsh-tools副本,会遮蔽宿主实例并让每次工具调用崩溃(#1697);--profile在启动前就能把这个前置条件抓出来。 - 环境类故障(缺 pnpm、Node 版本、PATH、Web 端口被占)是另一大 setup 期痛点;
--env一条命令全查(#1719 的dsh doctor设想)。
相关社区工具
- moonquake2004/dsh-doctor —— 离线 profile/session/env 诊断(19 项检查,映射到社区故障报告)。与 dsh-plugin-doctor 互补:我们管发布前插件路径,它管离线 profile/session 路径;它的 P5 检查与我们的
profile-shadow检查从两个方向标记同一个宿主遮蔽前置条件。 - iiwish/dsh-testkit —— 真实宿主插件生命周期测试(pack → install → boot → register → 确定性调用 → uninstall → reboot → 残留检查),在一次性 Docker 环境运行。互补:dsh-plugin-doctor 是快速的本地 preflight,dsh-testkit 是发布分支的完整生命周期门禁。
CI
仓库 CI 完整流程:
pnpm install --frozen-lockfile → typecheck → build → 单元测试 → 打包插件外壳冒烟(pack → 全新宿主安装 → 加载 lib/plugin.js → 注册 plugin_check → 真实调用 handler → 断言结果)→ CLI 冒烟 → doctor 自检(pack → 全新 DSH_HOME profile → dsh plugin add → --dump-config)。
开发
pnpm install
pnpm typecheck
pnpm build
pnpm test
pnpm test:integration
许可证
MIT © 2026 zoahdev
链接
同类插件
strukto-ai/mirage#dsh★ 3467
把文件系统与 bash 提供者换成 mirage 虚拟工作区:文件工具与 shell 命令作用于挂载的资源(RAM、S3、Redis、Slack、Gmail、Notion、Postgres)而非宿主磁盘,支持按挂载点设置读/写/执行模式、按命令选择沙箱(进程内 monty、pyodide、quickjs;远程 docker、e2b、daytona),并可在虚拟终端中安装 CLI(git、gh、slack、linear、ntn、gws,或自行注册的程序树)作为命令头词。
hust-open-atom-club/oh-dsh★ 215
社区发行版:TUI、桌面端与 Web UI 统一体验,分层安装、一步到位。
Jayden-X-L/forkprobe★ 66
同一任务并行试跑多个技能,对比结果选出最优。
vlln/plugin-registry★ 50
插件生态基建:浏览器面板管理官方 repository 插件(0 patch)+ make-dsh-plugin 插件开发引导技能。
forrestchang/dsh-multica-runtime★ 39
让 dsh 运行时跑在 Multica 上。
omdsh-dev/dsh-plugin-check★ 23
插件健康检查:扫描清单协议/patch 格式/构建陷阱,零依赖只读。