前言¶
在 DeepSeek Harness 里跑长任务时,窗口不一定在前台:根回合结束、审批卡住、模型通过 ask_user_question 提问,或上下文/token 逼近上限,若只靠盯着界面,很容易漏掉需要立刻处理的节点。社区里也有其它通知类插件;本文介绍的 dsh-notify(维护者 NotLinky671,GitHub NotLinky671/dsh-notify)走 Windows 10/11 原生 Toast,把上述事件写入系统通知中心,并可选点击通知把 Harness 窗口拉到前台。
这是什么¶
dsh-notify 是 DSH 的客户端类插件:监听会话与投影事件,在 Windows 上通过 PowerShell 5.1 调用 WinRT 弹出 Toast。它不发起网络请求,运行时零第三方 npm 依赖;macOS 在路线图中,Linux 未计划——在非 Windows 上仅打一条警告后安静退出,不影响 DSH 本体。
会触发哪些通知¶
下面表格与 README 一致,便于对照默认开关与展示方式(Banner 为常规横幅;Alert 为长驻 + 默认约 1.3s 提示音,由插件经 SoundPlayer 播放,而非 Toast XML 里的 <audio>)。
| 事件 | 来源 | 展示 | 默认 |
|---|---|---|---|
| 根回合完成 | turn/end,reason=completed |
Banner | 开 |
| 根回合失败 | turn/end,reason=error |
Alert | 开 |
| 根回合中断 | turn/end,reason=aborted / max-tokens / blocked |
Banner | 开 |
| 需要审批 | approval/asked |
Alert | 开 |
| Agent 向你提问 | tool/call,name=ask_user_question |
Alert(含问题标题) | 开 |
| 审批被策略自动拒绝 | approval/asked,policy=never |
Banner | 随上项策略 |
| 上下文超阈值 | contextPressure 投影 |
Banner;≥95% 升为 Alert | 开(80%) |
| 当日 token 预算超限 | tokenUsage 投影增量 |
Alert(每日一次) | 关 |
| 子 Agent 回合结束 | turn/end,origin=subagent |
Banner | 关 |
安装与启用¶
仅支持 Windows。README 写明在 DSH 0.2.x Desktop 上验证过;安装前须完全退出 DeepSeek Harness(含托盘),因为 desktop profile 在应用运行期间不能被外部改写。
不要执行 dsh plugin add dsh-notify:npm 上另有同名包 Pasumao/dsh-plugin-notify,会装错项目。应使用 github: 形式:
# 1. 完全退出 DeepSeek Harness(含托盘图标)
# 2. 安装
& "$env:LOCALAPPDATA\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add "github:NotLinky671/dsh-notify"
# 3. 手动重新启动应用
使用 dsh web 时,把 --profile desktop 换成 --profile web。
需要固定版本或环境无 git 时,可用 release 压缩包:
& "$env:LOCALAPPDATA\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add "https://github.com/NotLinky671/dsh-notify/releases/latest/download/dsh-notify.tgz"
本地改插件源码时,可 link 当前目录,重启即生效,无需反复安装:
& "$env:LOCALAPPDATA\Programs\DeepSeek Harness\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add "link:$PWD"
配置¶
在 ~/.dsh/profiles/desktop/cordis.patch.yml(dsh web 对应 .../profiles/web/)里按插件 id 覆盖:
- patch:
- id: dsh-notify
config:
contextWarnPercent: 80 # 0 表示关闭上下文警告
contextCooldownMs: 300000 # 同一会话内两次警告的最小间隔
dailyTokenBudget: 20000000 # 每日 20M token;0 表示关闭
quietHours: [23, 8] # 23:00–08:00 不弹 Toast(可跨午夜)
notifySubagentEnd: true # 开启子 Agent 结束通知
sound: false
clickFocus: false
改完后重启应用。当日 token 累计与基线写在 ~/.dsh/storages/dsh-notify/state.json;插件首次见到某 session 只记基线,不把历史用量算进当天。
可选字段 README 还提到 soundEvent、criticalRepeat 等,用于调整 Alert 音色与重复次数;完整列表以仓库 README 为准。
点击通知聚焦窗口¶
默认首次加载会在 HKCU(当前用户、无需管理员)写入 AppUserModelID 与 dsh-notify: 协议;点击 Toast 经 wscript.exe 隐藏调用 focus.ps1,尝试把 Harness 窗口带到前台。若不需要点击行为,设 clickFocus: false 可跳过注册表,Toast 仍正常显示。
实现与运行环境注意¶
- 通知脚本依赖 Windows PowerShell 5.1 的 WinRT 投影;PowerShell 7(pwsh)无
Windows.UI.Notifications,会直接失败。 - 插件以当前 DSH 进程权限运行;安装前建议浏览源码并确认许可证(MIT)。
- 无网络、不读取消息正文,仅使用
session/title、approval/policy及tokenUsage/contextPressure等元数据。
适用场景¶
适合在 Windows 10/11 上长时间挂 DSH Desktop、又不想一直盯着窗口的开发者:失败与审批、模型提问用 Alert 拉高注意力;上下文与 token 预算可按项目习惯调阈值。社区插件目录见 skillhub.cn 上的 dsh-notify 页;源码与 issue 在 GitHub。DSH 生态强调「一切皆插件」,该目录为独立社区站点,与 DeepSeek / 幻方无官方从属关系。
经过上面的步骤,你可以在 Windows 上把 DSH 里「该看一眼」的事件交给系统通知中心,并按需关闭声音、静默时段或点击聚焦。