dsh-plugin-hooks
v0.1.1 · 3 天前发布
DeepSeek Harness plugin: Claude-Code-style lifecycle hooks for DSH. Configure shell commands that run automatically before/after model tool calls (pre-tool / post-tool) with a JSON payload on stdin; pre-tool non-zero exits block the call.
README
dsh-plugin-hooks
DeepSeek Harness 插件:把 Claude Code 风格的 lifecycle hooks 带到 DSH —— 配置驱动的 shell 命令,在模型工具调用前后自动执行。
背景
DSH 0.1.0-rc.6 没有 hooks 能力,但架构已经预留了接缝:tools/pre-execute / tools/post-execute 两个有序 waterfall,以及 shell 服务"通过 stdin 给命令喂 JSON payload"的词汇表(见 @deepseek-ai/dsh-shell)。这个插件以纯外部插件形式补上这块空白,设计对齐官方预留接口:
pre-tool hook:匹配的工具执行前运行;命令非零退出 → 阻止该工具调用(等价 Claude Code PreToolUse 返回 error);post-tool hook:工具结果落地后运行;退出码只记录,不改变工具结果。配置
JSON 配置,来源二选一或叠加:
1. 文件(默认 $DSH_HOME/hooks.json):
```json
{
"hooks": [
{
"id": "lint-after-edit",
"event": "post-tool",
"tools": ["edit", "write"],
"command": "npm run lint -- --quiet",
"timeoutMs": 30000
},
{
"id": "guard-prod",
"event": "pre-tool",
"tools
版本兼容矩阵
| DSH 版本 | 状态 | 说明 |
|---|---|---|
dsh@0.1.0-rc.6 | ✅ 兼容 | cordis patch ✅ |
dsh@0.1.0 | ✅ 兼容 | 标准 patch ✅ |
dsh@0.2.0 | ⚠️ 待验证 | 待实测(API 可能在变) |
dsh@0.3.0+ | ❓ 未知 | 尚未发布 |
💡 兼容矩阵每周末自动跑实测,欢迎 PR 修正
元数据
- License
- MIT
- npm
- dsh-plugin-hooks
- Repo
- git+https://github.com/truelove-dreamer/dsh-plugin-hooks.git
- Engines
{"node":">=18"}- Weekly DL
- 0
- Monthly DL
- 0
- dsh.bundle
{"bundle":{"patch":"./cordis.patch.yml"}}