PeterBon/dsh-hooks 预览 preview

PeterBon/dsh-hooks

DeepSeek Harness 的配置驱动生命周期钩子插件

Project Overview项目介绍

dsh-hooks is a native config-driven lifecycle hook plugin built specifically for DeepSeek Harness (DSH). It follows official DSH plugin conventions, and lets users set up custom event-to-command hooks without writing any custom plugin code. To install, users can run dsh plugin --profile <profile-name> add dsh-hooks from npm, or install directly from the GitHub repository with dsh plugin --profile <profile-name> add github:PeterBon/dsh-hooks. After installation completes, you just need to restart the dsh web process, and a new dedicated Hooks configuration section will appear in the DSH web settings panel.

Users add all hook configurations directly in their DSH profile's cordis.patch.yml file. Each hook supports a wide range of configuration options, including triggering events, context filtering rules, custom execution commands or built-in notifications. Additional supported options include timeout limits, retry logic for failed runs, debouncing for high-frequency events, and caps on concurrent hook runs. Supported triggering events cover all key DSH lifecycle points, including turn end, tool call, approval request, and step end. Filtering supports both regex matching on string fields and numeric comparisons for numeric values, letting users tailor triggers to their needs.

This plugin is released under the permissive MIT open source license. It includes pre-built support for Feishu notification integration, with three separate setup options: QR code scan via the web GUI, setup via the CLI command, or manual configuration for advanced users. Since hooks run arbitrary commands with the same privileges as the host DSH process, users are strongly advised to only add hooks from trusted sources. Sensitive credentials like API keys should be stored in environment variables instead of plaintext configuration files to avoid accidental exposure.

这是一个专门为DeepSeek Harness(DSH)开发的配置驱动生命周期钩子原生插件。用户无需编写自定义插件代码,只需要直接在个人配置文件的cordis.patch.yml中声明「事件-命令」映射关系即可使用。用户可以通过DSH的CLI插件命令从npm或项目GitHub仓库直接安装,安装后重启dsh web即可启用,插件会在DSH的网页设置面板中新增一个「Hooks」配置分区。

插件支持丰富的钩子配置项,可配置触发事件、过滤规则、自定义执行命令或内置通知功能,还支持超时、重试、去抖动、并发限制等高级参数。触发事件支持回合结束、工具调用、审批请求、步骤结束等多种DSH生命周期事件,过滤规则支持正则匹配和数值比较,满足各类自定义触发需求。

该项目基于MIT许可证开源,支持飞书通知的便捷配置流程,可通过网页端扫码、CLI命令或手动配置三种方式完成飞书通知机器人的接入。钩子以当前DSH进程权限执行任意命令,因此用户仅可配置自己信任的命令,密钥等敏感信息需保存在环境变量或凭证存储中,不要写入配置文件。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 6 stars - very few users, little community feedback星标只有 6,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add dsh-hooks

把 PeterBon/dsh-hooks 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-hooks

Config-driven lifecycle hooks plugin for DeepSeek Harness (dsh).

Declare event -> command hooks directly in your profile's cordis.patch.yml — like Codex CLI / OpenCode hooks, but for dsh. No plugin code required.

中文文档 | Design | Feishu example | Web GUI

Install

One package ships everything (hook engine + Web GUI settings page):

dsh plugin --profile web add dsh-hooks           # from npm
# or straight from git:
dsh plugin --profile web add github:PeterBon/dsh-hooks

Restart dsh web. The settings panel gains a "Hooks" section (see Web GUI).

Configure

Add a config block to your profile's cordis.patch.yml:

- id: dsh-hooks
  name: dsh-hooks
  config:
    hooks:
      - on: 'turn/end'
        when: 'completed'            # optional: only completed turns
        run: 'node examples/notify-feishu.mjs'
        timeoutMs: 10000             # optional, default 10000
      - on: 'approval/asked'
        run: 'powershell -Command "Write-Output approval-requested >> hooks.log"'
      - on: 'tool/call'
        match:                       # optional: field → regex, all must match
          tool: '^(rm|git|ssh)'
        run: 'node examples/notify-webhook.mjs --slack'
      - on: 'turn/end'
        when: 'completed'
        run: 'node examples/notify-feishu.mjs'
        retries: 2                   # optional: retry non-zero exits (default 0)
        retryDelayMs: 1000           # optional: base retry delay, doubles (default 500)
      - on: 'turn/end'
        input: 'stdin'               # optional: write the full context JSON to stdin
        run: 'node my-hook.mjs'
      - on: 'approval/asked'
        notify:                      # built-in notification: instead of run, no script needed
          channel: 'desktop'         # platform balloon/toast
      - on: 'turn/end'
        when: 'completed'
        notify:
          channel: 'webhook'         # POST JSON to any HTTP endpoint
          url: 'https://hooks.slack.com/services/…'
          slack: true                # optional: { text } one-line summary (Slack style)
      - on: 'step/end'
        run: 'node examples/log-step.mjs'
        debounceMs: 500              # optional: debounce high-frequency events
        maxConcurrent: 2             # optional: cap concurrent processes
      - on: 'tool/result'
        match:
          toolDurationMs: '>10000'   # numeric comparison ({ gt: 10000 } object form too)
        run: 'node examples/notify-slow-tool.mjs'
      - on: 'turn/end'
        enabled: false               # optional: disable without deleting
        cwd: 'session'               # optional: run in the session working directory
        run: 'node examples/log-turn.mjs'

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-desktop 下一个 Next dsh-eli-mode →