前言¶
在 DeepSeek Harness(DSH)里跑长任务时,开发者常常会把窗口切到别处写代码或查文档,等 agent 一轮跑完再切回来。没有显式反馈时,只能反复切回主窗口确认状态。dsh-turn-notify 是社区维护的客户端类 bundle 插件:在 每一轮 agent 任务结束 时,于 Windows 桌面右下角弹出一张会自动消失的 WPF 提示卡片,展示会话名、完成状态与耗时。与浏览器 Notification 或系统 Toast 的常见做法不同,本插件在 host 侧订阅 DSH 的会话事件,在独立渲染进程里用 PowerShell + WPF 画卡片,并针对 DSH 插件宿主(plain-node 子进程)和高压安全软件环境做了实测取舍。
这是什么¶
- 名称:dsh-turn-notify(GitHub:
koolook123/dsh-turn-notify) - 维护者:koolook123
- 分类:客户端(SkillHub 目录归类)
- 许可证:MIT(README 与 package.json 一致)
- 当前发布:GitHub Release v1.0.0;公共 npm 上的包名
dsh-turn-notify已被其他项目占用,本插件默认通过 GitHub / bundle 方式安装,未使用该 npm 名发布
插件只在 Windows 上工作:process.platform !== 'win32' 时直接静默退出。非 Windows 环境无需安装。
核心功能¶
事件与文案¶
插件在 host 侧订阅 session/event 流中的 turn/start 与 turn/end:
turn/start:记录该会话本轮开始时间。turn/end:计算耗时,按结束原因生成正文(如「消息完成」「本轮失败」「达到 token 上限」「本轮已停止」),再拉起渲染进程显示卡片。
弹窗带队列:同一时刻只保留一张卡片,新一轮会替换排队中的旧内容,避免叠多个窗口。
文案示例(来自 README):
DeepSeek Harness · 复盘 A 股收盘数据
消息完成 · 耗时 1m23s
实现要点(为何是 PowerShell + WPF)¶
README 中记录了在 DSH 插件宿主下的实测结论,摘要如下:未打包 Win32 进程下 Windows Toast 易被静默丢弃;插件宿主无法 require('electron') 使用 BrowserWindow;隐藏式启动 PowerShell 可能被 HIPS 拦截;detached: true 会导致宿主误判子进程过早退出;高 DPI 下须用 SystemParameters.WorkArea 与 SetProcessDPIAware();toast.ps1 须保留 UTF-8 BOM 供 PowerShell 5.1 正确解析中文。
环境要求¶
- Windows
- PowerShell 5.1+,可加载
PresentationFramework/PresentationCore/WindowsBase/System.Windows.Forms - Node.js 18+(ESM)
- DeepSeek Harness,且 profile 支持
dsh.bundle.patch
安装与启用¶
社区插件目录页:https://www.skillhub.cn/plugins/koolook123/dsh-turn-notify
源码与说明:https://github.com/koolook123/dsh-turn-notify
下列命令来自官方 README,请按原文执行,不要自行拼接其他 dsh plugin add 形式。
方式一:从 GitHub 安装 bundle(推荐)¶
在 profile 目录(默认 ~/.dsh/profiles/desktop)执行:
cd ~/.dsh/profiles/desktop
pnpm add github:koolook123/dsh-turn-notify
将包名写入该目录 package.json 的 dsh.profile.bundles:
"dsh": {
"profile": {
"bundles": [
"@deepseek-ai/dsh-base",
"@deepseek-ai/dsh-web-app",
"dsh-turn-notify"
]
}
}
DSH 会读取包内 dsh.bundle.patch 指向的 cordis.patch.yml 并合并挂载。修改后需重启 DSH(插件宿主为常驻子进程,热更新不生效)。
方式二:本地 link(开发/调试)¶
cd ~/.dsh/profiles/desktop
pnpm add link:C:/path/to/dsh-turn-notify
同样在 dsh.profile.bundles 中加入 dsh-turn-notify,并重启 DSH。
方式三:手动写入 cordis.patch.yml¶
部分 DSH 版本对 bundle 裸包名解析基准与 profile 目录不一致,可能静默加载失败。可在 profile 的 cordis.patch.yml 中插入挂载段,并将 name 写成相对路径,例如:
- insert:
- id: turn-notify
name: ./node_modules/dsh-turn-notify/lib/index.js
config:
enabled: true
seconds: 6
width: 380
bottomMargin: 24
rightMargin: 24
notifyOnSuccess: true
notifyOnError: true
minDurationSec: 0
showSessionTitle: true
maxBodyChars: 160
同时保证 package.json 的 dependencies 中已有对应包(github: 或 link: 形式)。
配置项¶
可在安装后编辑 profile 里的 cordis.patch.yml(或与包内 cordis.patch.yml 默认值对照修改):
| 键 | 默认值 | 说明 |
|---|---|---|
enabled |
true |
总开关 |
seconds |
6 |
卡片停留秒数(含淡入淡出) |
width |
380 |
卡片宽度(DIP) |
bottomMargin / rightMargin |
24 / 24 |
距右下角边距(DIP) |
notifyOnSuccess |
true |
正常结束时弹窗 |
notifyOnError |
true |
error / interrupted 结束时弹窗 |
minDurationSec |
0 |
最短耗时阈值,短于此不弹;0 表示每轮都弹 |
showSessionTitle |
true |
标题是否带会话名 |
maxBodyChars |
160 |
正文字符上限 |
debounceMs |
400 |
两次弹窗最小间隔 |
script |
自动探测 | 自定义渲染脚本路径,优先级高于包内 toast.ps1 |
script 解析顺序:配置路径 → 包内 toast.ps1 → ~/.dsh/plugins/dsh-turn-notify/toast.ps1。
典型用法与自检¶
不依赖 DSH 时,可手动触发一次卡片,验证 PowerShell 与 WPF 环境:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File toast.ps1 \
-Title "DeepSeek Harness" -Body "消息完成 · 耗时 12s" -Seconds 6
(toast.ps1 路径以你 clone 或 node_modules 中的实际位置为准。)
排查问题时,README 建议查看:
- Host:
~/.dsh/turn-notify-debug.log(订阅、turn/end、渲染进程退出码等) - 渲染:
~/.dsh/turn-notify-wpf.log(显示坐标、关闭、异常)
DSH_HOME 可覆盖日志目录前缀;未设置时使用 %USERPROFILE%\.dsh。
语法与 BOM 快检:
node --check lib/index.js
xxd -l 3 toast.ps1
xxd 前三字节应为 efbbbf(UTF-8 BOM)。
适用场景与注意¶
适合:在 Windows 上使用 DSH 桌面 profile,希望 agent 每轮结束有本地视觉反馈、又不想一直盯着主窗口的开发者。
不适用:Linux / macOS;不需要任何桌面通知的场景(可将 enabled 设为 false 或不要装入 bundles)。
安全与权限:插件以当前 DSH 进程及其子进程权限运行,会 spawn PowerShell 执行包内脚本。安装前应浏览 lib/index.js 与 toast.ps1,确认行为与 MIT 许可证可接受。SkillHub 为社区目录,与 DeepSeek / 幻方无官方从属关系;星标、下载数据以各站点当时展示为准(目录当前星标为 0)。
若弹窗「闪一下就没了」,README 提到常见原因包括向 PowerShell 传入空的 -LogPath、去掉 toast.ps1 的 BOM,或被安全软件拦截非最小化方式以外的隐藏启动——对应修复见上文实现要点与日志文件。
结尾¶
dsh-turn-notify 把 DSH「每轮 agent 结束」这一时刻接到 Windows 右下角的一张短驻卡片上,用会话事件驱动,而不是轮询 UI。按 README 在 profile 中 pnpm add github:koolook123/dsh-turn-notify 并写入 dsh.profile.bundles 后重启 DSH 即可启用;更多细节与发布说明见 GitHub 仓库,索引页见 SkillHub 插件页。