dsh-mac-notify: Bringing Native macOS Notifications to DeepSeek Harness

前言

在 DSH 里跑长任务时,窗口往往被其它应用盖住。任务结束、失败、或等着审批时,若只靠盯着界面,很容易错过时机。系统自带的 macOS 通知可以打断这种「守窗口」的习惯,但 DSH 本身并不会默认把各类会话事件推到通知中心。

下面介绍社区插件 dsh-mac-notify(维护者 CarbeneLee):它监听 DSH 的 Cordis 事件,在任务完成、失败、需要审批或需要回答时弹出横幅,并可在点击后尝试激活 DeepSeek Harness。插件在 package.json 中声明 dsh.bundle.platforms: ["darwin"],非 macOS 主机不会安装该 bundle,避免装上一个永远无法触发的插件。

这是什么

dsh-mac-notify 是面向 DeepSeek Harness (DSH) 的 macOS 通知插件,当前 npm 包版本为 0.4.1,许可证 MIT,要求 Node >=20。源码与说明见 GitHub 仓库,也可在 SkillHub 目录页 找到条目。

会监听哪些时刻

插件把 DSH 事件映射为通知文案,要点如下(子代理回合默认静音,以免刷屏):

时刻 DSH 事件 横幅内容概要
任务完成 turn/end → completed 耗时、你的 prompt、最后一行回答
任务失败 turn/end → error / max-tokens 错误信息 + 任务
需要审批 approval/request 工具名 + 原因
需要回答 user-questions/request 问题文本(多条时带数量)
计划待审 user-questions/request 且含 plan-review 专用副标题
任务阻塞 turn/end → blocked 默认关闭

子代理会持续结束回合;默认只有你在看的会话会播报,可通过配置 includeSubagents 打开(通常较吵)。

安装与启用

环境限定 macOS。桌面版与 CLI 的配置方式不同。

DeepSeek Harness 桌面应用

桌面 profile 由 Electron 应用独占管理,不能用 dsh plugin --profile desktop ...。应在侧栏 Plugins → Install 填写:

link:/absolute/path/to/dsh-mac-notify     # 本地路径
github:CarbeneLee/dsh-mac-notify          # 直接从 GitHub

桌面版带 HMR,bundle 多半无需重启即可挂载;若始终没有横幅,再退出并重新打开应用。

Web profile / 自定义 profile(CLI)

dsh plugin --profile web add dsh-mac-notify                    # 从 npm(推荐)
dsh plugin --profile web add github:CarbeneLee/dsh-mac-notify  # 或从 GitHub

默认通知后端为 auto:依次尝试 Electron、原生 helper、terminal-notifier、osascript。首次挂载时若缺少 DSHNotifier.app,插件会在后台构建(需 Xcode Command Line Tools,约数秒);构建完成前仍可通过 osascript 收到通知(图标为 Script Editor)。设置环境变量 DSH_MAC_NOTIFY_NO_BUILD=1 可跳过构建。

手动写入 profile

在 ~/.dsh/profiles/<profile>/package.json 增加依赖与 bundle,再用应用自带的 pnpm 安装:

{
  "dependencies": { "dsh-mac-notify": "link:/path/to/dsh-mac-notify" },
  "dsh": { "profile": { "bundles": ["...", "dsh-mac-notify"] } }
}
cd ~/.dsh/profiles/desktop
node "/Applications/DeepSeek Harness.app/Contents/Resources/runtime/primary-runtime/dependencies/pnpm/bin/pnpm.mjs" install

验证是否工作

先做系统级演示(不依赖插件):

node scripts/notify-demo.mjs

插件挂载后,可对模型说「send a test notification」,模型会调用 mac_notify_test 并返回当前后端与配置。将配置项 debug: true 后,每次投递会追加到 ~/.dsh/dsh-mac-notify/debug.log。

配置

覆盖项写在对应 profile 的 cordis.patch.yml:

- id: dsh-mac-notify
  config:
    appName: DeepSeek Harness
    notifyOnComplete: true
    notifyOnError: true
    notifyOnApproval: true
    notifyOnQuestion: true
    suppressWhenFocused: false
    backend: osascript
    completeSound: Glass
    debug: false

常用字段包括:enabled(总开关)、appName / bundleId(标题与点击激活的应用)、locale(zh / en / auto)、各类 notifyOn*、suppressWhenFocused(DSH 窗口在前台时是否跳过)、completeSound 等系统音名、*SoundFile(afplay 可播文件,优先于音名)、backend、minIntervalMs(节流)、maxBodyChars / maxLabelChars(正文与标签长度)、debug。完整默认值见仓库 README 配置表。

通知后端与图标

backend 说明
helper(推荐) 经 bundled DSHNotifier.app 发送,横幅为 DSH 图标,点击可激活应用
osascript display notification,无额外依赖;归因 Script Editor,横幅不可点
electron 原生 Electron 通知;当前随附的 DSH 桌面构建不向插件暴露 electron 模块时会回退
terminal-notifier 需本机 brew install terminal-notifier
command 自定义命令,环境变量 DSH_NOTIFY_TITLE/SUBTITLE/BODY/SOUND/GROUP 承载载荷
auto(默认) Electron → helper → terminal-notifier → osascript

可一次性构建 helper:

sh scripts/build-helper.sh

输出安装到 ~/.dsh/dsh-mac-notify/DSHNotifier.app,再在配置里设 backend: helper。首次通知会请求系统通知权限,需在 系统设置 → 通知 中允许。

若要把提示音换成其它应用素材(示例为微信 notify.caf),应复制到自有目录再配置 *SoundFile,避免应用更新后路径失效。

backend: command 示例(Webhook):

backend: command
command: 'curl -s -X POST -H "Content-Type: application/json" -d "{\"text\":\"$DSH_NOTIFY_BODY\"}" https://example.com/hook'

适用场景与注意

适合在 macOS 上长期用 DSH 跑 agent、工具审批或多轮问答、又希望离开窗口时仍能收到回调的开发者。Windows / Linux 用户无需安装此插件。

与其它 DSH 插件一样,逻辑在 当前 DSH 进程权限 下运行;安装前建议阅读仓库源码与 MIT 许可证,自行判断数据是否会出现在通知正文(插件会截断 maxBodyChars 等,但敏感内容仍可能泄露到通知中心)。

SkillHub 等社区目录独立于 DeepSeek / 幻方,并非官方应用商店;插件由 CarbeneLee 维护,问题可提 GitHub Issues。

结尾

dsh-mac-notify 把 DSH 的关键会话节点接到 macOS 通知中心,减少盯着窗口的时间,并可选 DSH 图标与点击回应用。按需选 npm / GitHub / 本地 link 安装,用 cordis.patch.yml 收紧事件类型与后端即可。

  • 目录页:https://www.skillhub.cn/plugins/CarbeneLee/dsh-mac-notify
  • GitHub:https://github.com/CarbeneLee/dsh-mac-notify
羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye