dsh-plugin-safety
DSH 插件健康告警:预检失败自动禁用后页面持久弹窗;出现不可用插件告警即自动创建 headless 修复会话,叉掉前刷新/重开页面告警都在
安装
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:Seryta/dsh-plugin-safety说明文档
阅读完整 README ↗dsh-plugin-safety — 插件健康告警
DSH 插件故障防控的最后两环:
- 预检 + 自动禁用:
scripts/check-profile-plugins.py在 dsh-web 启动前预检 profile 中每个未禁用的插件入口;import 失败的坏插件自动写入disabled: true(bundle 则移除 bundle),并落盘告警。 - 持久告警 + 自动修复会话:浏览器半部渲染红色告警卡片,× 掉前 刷新/重开页面都会重现;host 半部在返回告警前保证每个告警 action 都有 对应的 headless 修复会话。
核心不变式
只要出现“不可用插件已被禁用/需人工处理”的告警,就自动创建修复会话。 不区分告警来源:预检脚本检出、直接写
notice.json的测试/手工场景, 都遵守同一规则。
具体机制:
- host 半部
GET /plugins/dsh-plugin-safety/notice返回告警前先检查fixActionIds是否覆盖全部 action;未覆盖就调用check-profile-plugins.py --ensure-fix补启动。 - 同一批 action 只启动一次;同一份告警新增坏插件时,只为新增 action 补启动一次。
Popen成功才写fixStartedAt/fixActionIds;启动失败时前端如实 显示“修复会话自动创建失败”,不再假装已创建。- 文件锁防多个 GET/预检并发重复启动。
组件
| 文件 | 职责 |
|---|---|
index.js | host 半部:告警读写端点 + 返回前 ensure-fix |
client.js | 浏览器半部:持久弹窗、× 关闭(POST 清除) |
scripts/check-profile-plugins.py | 预检、自动禁用、告警落盘、修复会话启动 |
cordis.patch.yml | bundle patch:把插件挂进 profile |
dsh.plugin.json | DSH 插件元数据 |
零第三方依赖:host/脚本仅用 Node/Python 标准库;client 为原生 DOM。
告警文件
$DSH_HOME/storages/plugin-safety/notice.json(未设置 DSH_HOME 时为
~/.dsh/storages/plugin-safety/notice.json):
{
"at": 1786799000000,
"actions": [
{
"id": "some-plugin",
"name": "some-plugin",
"kind": "patch",
"reason": "Cannot find package 'some-plugin'",
"disabledAt": 1786799000000,
"autoDisabled": true,
"profile": "/home/me/.dsh/profiles/web"
}
],
"fixStartedAt": 1786799001000,
"fixActionIds": ["some-plugin"],
"fixWorkspace": "/home/me/.dsh/plugin-maintenance",
"fixLogFile": "/home/me/.dsh/plugin-maintenance/plugin-safety-fix.log"
}
POST 同一端点即视为用户已叉掉告警,文件重置为
{"at": 0, "actions": []};下一条新告警会重新生成。
安装
dsh plugin --profile web add github:Seryta/dsh-plugin-safety
安装后重启 dsh-web(host 半部需要进程重新 import;client.js 是静态服务, 重启前刷新页面也能拿到新逻辑)。