dsh-hotswap
Runtime hot-swap for DeepSeek Harness: hot enable/disable/restart Cordis plugins and auto hot-mount bundles from the Web GUI — no dsh restart.
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:HongzhongL/dsh-hotswap说明文档
阅读完整 README ↗dsh-hotswap
DSH Web 插件热插拔管理器:在 设置 → 插件 → 「插件管理」 标签页里列出当前挂载的所有 Cordis 插件,支持运行时热启用 / 热停用 / 热重启,以及监视 profile 的 package.json 自动热挂载 / 卸载 bundle——全程无需重启 dsh web。
原名
@dsh-external/dsh-plugin-manager(未公开发布)。
功能
- 热停用:调用 Loader 的
entry.update({ disabled: true }),插件当场卸载(服务、工具、监听器全部回收)。 - 热启用:
entry.update({ disabled: false }),当场导入并启动插件——包括启动时就处于停用状态的插件。 - 热重启:卸载后重新加载,并尽力清除 Node ESM 模块缓存,让磁盘上的新代码生效(best-effort,见「已知限制」)。
- Bundle 自动同步(热挂载):监视 profile 的
package.json,当dsh.profile.bundles增删条目时,通过 Include 根分组热挂载 / 卸载对应 bundle——dsh plugin add/remove之后无需重启。 - 持久化:每次开关都会把
disabled: true写入 / 移除 profile 的cordis.patch.yml中一个由本插件维护的自动区块(# === dsh-hotswap managed block ===),因此重启 DSH 后开关状态依然生效。 - 安全护栏:
- 保护名单:
webserver、connection、api-gateway、modules、typert*、web*、hmr等界面赖以生存的条目以及本插件自身,不能被停用; !!js表达式控制、父分组停用的条目不允许切换;- 一键「全部恢复」重新启用所有由管理器停用的插件。
- 保护名单:
- 外部停用识别:能识别
cordis.patch.yml中手写的disabled: true行;启用时会同步移除该行,避免“现在能跑、重启又没了”的不一致。
安装
dsh plugin --profile web add dsh-hotswap
# 重启生效:
dsh web
本地源码 / tgz:
npm pack
dsh plugin --profile web add ./dsh-hotswap-0.1.0.tgz
配置
全部可选,通过 profile 的 cordis.patch.yml 覆盖:
- id: dsh-hotswap
config:
profile: web # 持久化目标 profile(仅作兜底;默认从 Loader baseUrl 推导)
protected: [some-id] # 追加不可停用的条目 id
⚠️ 安全须知(重要)
本插件暴露同源 HTTP 端点(/_dsh/hotswap/*),可让请求方停用 / 启用 / 重启任意插件。它沿用 DSH Web 的「受信任主机」模型,不额外加鉴权:
- 只要 Web 服务绑定在
127.0.0.1,就只有本机进程能调用,是安全的。 - 如果你把
webserver的host设为0.0.0.0暴露到局域网,局域网内任何设备都能控制你的插件(进而驱动 agent)。DSH Web 本身无鉴权 / 无 TLS,切勿暴露到不可信网络。