DeepSeek Harness Plugin Hub

发布与管理完整 Harness Profiles,发现适合你的插件。

探索

插件目录环境预设文档中心动态

社区

发布插件联系我们报告问题

相关链接

Plugin Hub GitHubDeepSeek Harness 官方项目系统状态隐私说明
© 2026 DeepSeek Harness Plugin HubPowered byPaxTech

独立、非官方社区项目,与 DeepSeek 官方无隶属、授权或背书关系。

DeepSeek Harness Plugin Hub
ProfilesPlugins分类动态文档登录管理 Profiles
ProfilesPlugins分类动态文档登录
← Plugins

dsh-hooks-lite

Hooks Lite

轻量级、配置驱动的 DeepSeek Harness 生命周期钩子:在工具调用和会话事件前后运行 shell 命令,并通过 stdin 接收 JSON 负载。

插件会安装到这里;不确定时保持 web。

npx -y @deepseek-ai/dsh plugin --profile web add dsh-hooks-lite@0.1.0
README兼容性版本

兼容性与来源证明

Hooks Lite 以 dsh-hooks-lite 发布,当前版本为 0.1.0。Plugin Hub 会校验它的 manifest,并保存精确安装来源,便于复现安装结果。

DSH 兼容范围
*
运行环境
any
发布来源
npm
Registry 更新时间
2026/11/1

版本

0.1.0stable
2026/11/1

相关插件

正在加载相关插件…

最新版
0.1.0
DSH
*
HMR
重启进程
Tree shaking
未声明可安全裁剪
解包体积
42.1 kB
文件数
10
Surface
any
许可证
MIT
发布源
npm
GitHub
★ 1
周下载
0
最近提交
2026/11/1
查看源码 ↗
README Badge

点击下方 Badge 复制 Markdown,粘贴到 README 即可。

这是你的 Plugin?认领权益 · 优先安全扫描

验证 package.json 声明的 GitHub 仓库,即可管理这个公开页面。认领后,Hub 会优先安排当前版本的安全扫描,并在通过后公开展示结果。

认领这个 Plugin →
报告问题

相关插件

继续浏览 developer-tools 分类下经过校验的插件。

MarketdshmarketDeepSeek Harness 内的可视化插件市场——浏览、搜索并一键安装社区插件。· DSH 可视化插件市场:浏览、搜索并一键安装社区插件。Client Ui Git Graph@linxin666/dsh-client-ui-git-graph外部 dsh Web GUI 插件:空会话 Git 分支选择器和 Git 图,包含实际的主机端 Git 操作与防护,作为 dsh 配置文件包Ssh@linxin666/dsh-sshdsh Web GUI 的远程 SSH 操作:主机配置存储(~/.dsh/dsh-ssh.json,可从 ~/.ssh/config 导入)、支持跳板主机的持久化 ssh2 连接池、exec / PTY Web 终端 / SFTP 传输 / 本地端口转发隧道 / 集群执行Opsdsh-ops适用于 Windows x64、Linux x64 和 macOS arm64/x64 的原生文件和 PTC 工具;仅限 Windows 的可选 Bash 负载和主机 PowerShell 集成

README

dsh-hooks-lite

中文

Lightweight, config-driven lifecycle hooks for DeepSeek Harness. Declare event → shell command in cordis.patch.yml; no plugin code, no client bundle, no runtime dependencies.

- id: dsh-hooks-lite
  name: dsh-hooks-lite
  config:
    hooks:
      - id: guard-rm
        on: pre-tool
        tools: [bash, pwsh]
        match:
          args.command: 'rm\s+-rf'
        run: node hooks/guard.mjs
      - id: lint-after-edit
        on: post-tool
        tools: [edit, write]
        run: npm run lint -- --quiet
        timeoutMs: 30000
      - id: notify-done
        on: turn/end
        when: completed
        run: node hooks/notify.mjs

Why this exists

Claude Code and Codex popularized configuration-driven lifecycle hooks. DSH already has the right seams — tools/pre-execute, tools/post-execute, and session/event — but no small first-party-style hook plugin.

This plugin is deliberately the small version of that idea:

  • Host only. No Web GUI, no approval flow, no client bundle.
  • Zero runtime dependencies. Pure ESM + Node child processes.
  • Tool and session events. Block before a tool call; observe after it; react to completed turns, steps, user messages, and title changes.
  • JSON contract. Every command gets a stable JSON payload on stdin and DSH_HOOK_* environment variables.
  • Reloadable config. Inline profile config plus optional $DSH_HOME/hooks.json; /hooks-reload rereads the file.

It is not a compatibility layer for .claude/settings.json. If you need the full multi-harness format, use a dedicated adapter; this one keeps the config DSH-native and readable.

Install

From npm:

dsh plugin --profile web add dsh-hooks-lite

From GitHub:

dsh plugin --profile web add github:xuedipiaofei/dsh-hooks-lite

For local development:

dsh plugin --profile demo add ./dsh-hooks-lite

The bundle inserts one dsh-hooks-lite row. Add your config.hooks to the profile patch, or create $DSH_HOME/hooks.json.

Events

onWhenCan block?Useful payload
pre-toolBefore a model tool callYes — nonzero exit denies the calltoolName, args, sessionId, cwd
post-toolAfter a tool call settlesNotoolName, args, result.isError, result.content
turn/endA turn endsNoreason (completed, error, aborted, blocked, max-tokens, interrupted, forked), content
step/endA step endsNodata
user/messageA user-role message appearsNocontent, data.source.kind
session/titleSession title changesNotitle, data.source.kind

Filter a turn by reason with when:

- id: notify-error
  on: turn/end
  when: [error, aborted]
  run: node hooks/notify-error.mjs

Fields

FieldDefaultMeaning
idauto hook-NStable hook id; must be unique
onrequiredEvent from the table above (event is accepted as an alias)
runrequiredShell command (command is accepted as an alias)
toolsall toolsExact tool names for tool events; ignored by session events
matchnoneField → regex; dotted paths work (args.command, data.source.kind). All fields must match
whennoneturn/end reason or reasons
timeoutMs10000Per-run timeout; a timed-out pre-tool hook blocks
cwdplugin process cwdsession uses the session cwd; anything else is a path
stdintrueWrite the full JSON payload to stdin; false only uses env
blocktrueFor pre-tool: nonzero exit denies the call; false observes only
enabledtrueDisable without deleting
envnoneExtra environment variables for the child

match values are regular expressions tested against the field's string form. Use object comparators for numbers:

match:
  data.result.toolDurationMs: { gt: 10000 }

Payload and environment

Every command receives one JSON document on stdin:

{
  "source": "dsh-hooks-lite",
  "event": "pre-tool",
  "eventName": "PreToolUse",
  "hookId": "guard-rm",
  "sessionId": "session-...",
  "cwd": "/path/to/project",
  "toolName": "bash",
  "args": { "command": "rm -rf build" }
}

post-tool adds result; session events use event (e.g. turn/end) and may carry reason, content, title, and the raw data object.

Environment:

DSH_HOOK_ID, DSH_HOOK_EVENT, DSH_HOOK_CWD,
DSH_SESSION_ID, DSH_TOOL_NAME, CLAUDE_PROJECT_DIR

A pre-tool hook can deny the call by exiting nonzero. Its stderr (or stdout) becomes the denial reason:

// hooks/guard.mjs
const payload = JSON.parse(await new Promise((resolve) => {
  let body = ''
  process.stdin.on('data', (chunk) => (body += chunk))
  process.stdin.on('end', () => resolve(body))
}))
if (payload.args.command.includes('rm -rf')) {
  console.error('refusing destructive command')
  process.exit(1)
}

Commands

  • /hooks — configured hooks, config warnings, recent runs.
  • /hooks-reload — reread $DSH_HOME/hooks.json; inline hooks remain.

File config

{
  "hooks": [
    {
      "id": "from-file",
      "on": "post-tool",
      "tools": ["edit"],
      "run": "npm run lint"
    }
  ]
}

Default path: $DSH_HOME/hooks.json. Override with configFile in the plugin row (relative paths resolve against $DSH_HOME). Inline config.hooks is appended after file hooks.

Safety

Hooks are trusted host configuration: commands run with the DSH host process's permissions, not inside the model's tool sandbox. Only enable hooks you wrote or reviewed. A pre-tool hook can block tool calls; post/session hooks are fire-and-forget and never change model output.

Development

npm test          # pure config tests + fake-context plugin tests
npm run check     # syntax checks

License

MIT © 2026 xuedipiaofei