TerricSH
dsh-notify
No description
- Stars
- 1
- Language
- JavaScript
- Created
- Aug 14, 2026
- Updated
- Aug 14, 2026
Introduction
@terricsh/dsh-notify
给 DeepSeek Harness 的桌面通知插件:把审批请求 / 任务完成 / 出错等事件发成操作系统桌面通知,通知正文注明工作区 + 项目,点击通知可直接跳转到 Web GUI 里对应的会话(显示该会话的讨论内容)。
跨平台:
| 平台 | 通知方式 | 点击跳转 |
|---|---|---|
| Windows | PowerShell toast | ✅ 原生(点击整条通知或「打开项目」按钮) |
| macOS | terminal-notifier,缺失时退回 osascript | ✅ 装了 terminal-notifier 时;否则正文附链接 |
| Linux | notify-send | ⚠️ 正文附链接,notify-send 不支持点击打开 URL |
仓库:https://github.com/TerricSH/dsh-notify
目录结构
dsh-notify/
├── package.json # 包元数据 + dsh.client 清单(注册 Client 半边)
├── lib/
│ ├── index.js # Host 插件:监听事件 + 发通知 + 生成深链 URL
│ └── client.js # Client 插件:读 cookie 并打开对应会话
├── cordis.patch.example.yml
└── README.md
- Host 半边(
lib/index.js)是 host 平面插件:它监听进程级事件 (approval/request、agent/status、agent/error)并读webServer端口。 - Client 半边(
lib/client.js)通过package.json里的dsh.client清单 注册进 Web 客户端,负责深链跳转。
发布到 GitHub / npm
npm publish # 发布 @terricsh/dsh-notify 到 npm
git push origin main # 源码托管到 GitHub
发布
@terricsh/dsh-notify前,需先在 npm 上拥有@terricsh这个 scope (npm org create terricsh或直接npm adduser后用该 scope 发布即可)。
使用方法
两种安装方式二选一。装好后,当代理产生以下事件时会弹系统通知,点击通知 即可定位到 Web GUI 中对应会话(显示该会话的讨论内容):
- 审批请求(需要你批准某操作时)
- 任务完成(一轮对话结束)
- 任务出错
方式 A:从 npm 安装(已发布后,推荐)
-
装进 web profile:
dsh plugin --profile web add @terricsh/dsh-notify -
加 host 引用行(见
cordis.patch.example.yml),编辑$DSH_HOME/profiles/web/cordis.patch.yml(默认是[]):- insert: - id: notify-desktop name: '@terricsh/dsh-notify'也可放到 home 级
$DSH_HOME/cordis.patch.yml(对所有 profile 生效)。 -
重启:
dsh web
方式 B:本地源码安装(未发布到 npm 时)
-
把本仓库目录链进 profile 的 node_modules。Windows(PowerShell):
New-Item -ItemType Directory -Force "$env:DSH_HOME\profiles\web\node_modules\@terricsh" New-Item -ItemType Junction ` -Path "$env:DSH_HOME\profiles\web\node_modules\@terricsh\dsh-notify" ` -Target "E:\dsh\dsh-notify" # 改成你的仓库绝对路径macOS / Linux 用
ln -s建软链接到对应位置即可。 -
同样编辑
cordis.patch.yml加上面的insert行。 -
重启
dsh web。
注意事项
- 平面归属:本插件是 host 平面插件(监听全局事件 + 读端口),所以引用
行要加在
cordis.patch.yml(host patch),不要加进某个 agent 预设的agent.cordis.yml。 - Client 打包:
dsh.client清单会被 web 插件表扫描并打进前端 bundle; 若改动lib/client.js后页面没变化,需要重建 Web 产物(或运行 dev:web 观察器)。 - 深链原理:通知点击打开
<base>/open-session?session=<id>,Host 路由 写入一个 120 秒短 cookie 后 302 跳回/(复用/重载已有标签页),Client 半边读 cookie 后sessions.open(id)并清除 cookie。
从动态插件改写而来的差异
动态插件(cordis_define) | 本 npm 包 |
|---|---|
code.host / code.client 字符串 | lib/index.js / lib/client.js 真实模块 |
harness.handle + host.call 深链握手 | 重定向路由写短 cookie,Client 读 cookie |
/open-session 重定向路由(302 回 /) | 保留,用 cookie 传会话 ID |
| 临时、重启即失 | 落盘、可发布、可持久安装 |