dsh-web
zhu1090093659/dsh-webDeepSeek Harness(DSH)Web 插件聚合生态包 · 一切皆插件,创意工坊分发(dsh-market.com)
DSH (DeepSeek Harness) lifecycle hooks settings panel plugin — 7-event coverage, guard rules with live toggles, run status. dsh-plugin
DSH(DeepSeek Harness)的生命周期钩子设置面板插件 —— 在设置界面列出已配置的钩子(hooks.json):事件、matcher、命令、超时与状态信息,风格对齐 Codex Desktop 的钩子页。
$DSH_HOME/hooks.json → ~/.claude/hooks.json → ~/.codex/hooks.json 顺序探测;也可在插件配置里显式指定 hooksPathcolor-mix(in srgb, currentColor),浅色/深色/透明主题自动适配在 DSH profile 目录(<dsh-home>/profiles/<name>/):
package.json 的 dependencies 加:"dsh-hook": "github:<你的用户名>/dsh-hook"
dsh.profile.bundles 数组加 "dsh-hook"pnpm install"dsh-hook": "link:D:/path/to/dsh-hook"
⚠️ pnpm 对 scope 名 +
link:组合会报ERR_PNPM_INVALID_DEPENDENCY_NAME,请用无 scope 包名。
插件的 cordis.patch.yml 里可显式指定 hooksPath(默认自动探测):
- insert:
- id: hooks-panel
name: 'dsh-hook'
config:
hooksPath: 'D:\my\dsh-home\hooks.json'
本插件只做显示。要让钩子在工具调用前真正拦截,需要装 DSH 官方的钩子桥:
@deepseek-ai/dsh-hooks-claude-code(选与内核版本一致的 tag)配套的守卫脚本示例(拦截递归删除 / C 盘写入 / 环境变量枚举)见仓库 examples/hook-guard.ps1。
@deepseek-ai/dsh peer >=0.2.0-rc.1dsh-client-ui-slots / dsh-client-ui-renderer / dsh-client-connection(DSH 内核自带)@linxin666/dsh-usage 等 settings.section 插件共存(order 152,usage 之后)┌─ lib/index.js(宿主半)─────────────────────┐
│ 读 hooks.json(显式 hooksPath 或自动探测) │
│ 注册 GET /api/dsh-hook/overview │
└──────────────────────────────────────────────┘
↓ fetch(仅页面打开时 15s 轮询)
┌─ lib/client.js(客户端半)──────────────────┐
│ ctx.slots.register('settings.section', ...) │
│ 纯 DOM 渲染(React ref 挂载,无构建链) │
└──────────────────────────────────────────────┘
ℹ️ 源码说明:
lib/client.js与lib/index.js就是手写源码(本插件不走 TypeScript 构建链,直接手写__ModuleLoader__.load形态,参考@linxin666/dsh-usage)。 v0.3.1 之前文件头曾带//#region src/client/index.ts注释,那只是残留的编辑器 region 标记,不是编译产物标记——已删(v0.3.2),避免误导。 历史教训:v0.3.1 的relTime只有调用点而无定义,曾拖垮整个面板 (详见AUDIT.md)。回归防线 = 仓库内test/验证脚本(见下节)。
仓库内 test/ 提供不依赖浏览器的验证脚本(Node 直接跑,无需安装依赖):
node test/verify-cwrite.mjs # cWrite 正则:只拦 C 盘、放行 D/E 盘与白名单
node test/verify-render.mjs # 端到端渲染:用真实 client.js 渲染全部卡片,确保不抛异常
node test/verify-host.mjs # 宿主半:路由返回含 ruleKeys,且与 zh/en 字典键一致
node test/verify-hardening.mjs # 加固:loopback 校验、runs/clear 限 POST、字典键完备
MIT