dsh-session-toast:DSH 会话轮次结束时的 Windows 11 系统通知

前言

在 DeepSeek Harness(DSH)里跑长任务时,模型一轮回复结束、等待你继续输入,界面往往不在前台。Claude Code、Codex 等工具会在完成时给出系统级提示;DSH 默认没有同等机制,切到其他窗口后容易错过「可以接着干」的时机。下面介绍社区插件 dsh-session-toast:在每一轮 turn/end 时,于 Windows 11 右下角弹出原生 Toast(必要时降级为托盘气泡),并在 DSH 处于前台时默认不打扰。

这是什么

dsh-session-toast 是 DSH 宿主侧插件,维护者为 LeeeWM,在 SkillHub 目录中归类为客户端。它监听会话的 session/event → turn/end,把完成或出错等状态转成一条 Windows 通知,正文通常包含会话标题、用时与轮次编号;无标题时退回工作目录名。插件仅面向 Windows(win32),其他平台会自动不激活。许可证为 MIT,当前仓库版本为 0.2.0,在 package.json 中声明与 DSH 0.2.1-rc.3 兼容。

安装时请统一使用包名 dsh-session-toast。README 说明:npm 上的 dsh-session-notifier 属于另一位作者,与本项目无关,按旧名安装可能装错。

核心功能

完成通知与过滤

默认在 completed 与 error 两种结束原因下通知(可通过 notifyOn 调整为仅完成、或包含 aborted 等)。子代理会话默认忽略,避免一次主任务弹出多条;需要时可设 notifySubagents: true。

前台感知与去抖

onlyWhenUnfocused 默认为 true:当前前台窗口进程名匹配 dshProcessNames(默认 DeepSeek Harness)时不弹通知。收到 turn/end 后还有 1.2 秒去抖(debounceMs 可调);若其间发生 turn/start,会取消上一条待发通知,减少连续轮次刷屏。

投递方式

宿主侧用 Node 内置模块监听事件,通过 powershell.exe 执行仓库内的 notify.ps1;payload 以 base64(UTF-8 JSON) 传入 argv,避免中文与 emoji 受代码页影响。通知优先走 WinRT ToastNotificationManager,不可用时降级 NotifyIcon 气泡。无 npm 运行时依赖,也不依赖 BurntToast。

可配置项概览

config 共 15 个可选键,省略即用默认值。常用项包括:enabled、sound、language(zh / en)、minTurnDurationMs(过短轮次不通知)、mode(auto / toast / balloon)、dryRun(只打 payload 不弹窗,便于测试)、logFile(notify.ps1 诊断日志)。完整表格见 GitHub README。

安装与启用

插件以当前 DSH 进程权限运行;安装前建议浏览仓库源码与 MIT 许可证,确认符合本机策略。

非桌面 profile(web / headless / tui 等)

README 推荐从 GitHub 安装,命令如下(将 <profile> 换成实际 profile 名):

dsh plugin --profile <profile> add github:LeeeWM/dsh-session-toast
dsh --profile <profile> --dump-config | Select-String "dsh-session-toast"

输出中应能看到与 dsh-session-toast 相关的配置段(文档示例为 # == dsh-session-toast)。

桌面 profile

桌面 profile 由 Electron 独占管理,CLI 会拒绝安装。需在 DSH Plugins → Add plugin → Install a third-party plugin 中填写插件目录的绝对路径,再 Install → Enable now。若 UI 支持直接填 GitHub 包名,也可尝试 github:LeeeWM/dsh-session-toast;仓库文档以目录安装为准。

dsh plugin --profile <profile> add "C:\path\to\dsh-session-toast"

修改 index.js 或 notify.ps1 后,需禁用再启用插件或重启 DSH 才会加载新代码。

从 v0.2.0 起若仍保留旧 id dsh-session-notifier,应在 Plugins 中 Remove 后按上法重装 dsh-session-toast,并用 --dump-config 确认插件行存在。

典型用法

覆盖默认配置

在机器级用户层 $DSH_HOME/cordis.patch.yml 中对插件行做整行覆盖(文档提醒:不要手改桌面 profile 目录下的 package.json / cordis.patch.yml)。示例:

- id: dsh-session-toast
  name: dsh-session-toast
  config:
    enabled: true
    notifyOn: completed-and-error
    onlyWhenUnfocused: false
    sound: true
    language: zh
    debounceMs: 800
    notifySubagents: false
    mode: auto
    logFile: 'C:\Users\Lenovo\.dsh\logs\dsh-session-toast.log'

onlyWhenUnfocused: false 表示即使 DSH 在前台也弹出,适合需要始终提醒的场景。

排查「装了但没通知」

  1. 用 dsh --profile <profile> --dump-config 确认插件已启用,输出含 dsh-session-toast 段;仅出现在 package.json 依赖而未进入 bundle 时不会加载。
  2. 检查 Windows 设置 → 系统 → 通知 与勿扰模式。
  3. 设置 logFile 查看 notify.ps1 日志;或设环境变量 DSH_SESSION_TOAST_DEBUG=1,在 DSH 控制台查看 turn/end 是被过滤、前台跳过还是已投递。

临时调试可用:dsh --profile <test> --patch <overlay.yml>。

适用场景与注意

适合在 Windows 11 上使用 DSH、且经常在后台跑多轮对话的开发者。系统需自带 Windows PowerShell 5.1;Node 20+ 由 DSH 运行时提供。

需注意:Toast 约 5 秒后自动消失,插件不实现点击回焦 DSH;勿扰或系统通知总开关关闭时 Toast 可能被静默丢弃,可尝试 mode: balloon。通知正文含本地会话标题,不联网。多会话并行时按会话分别通知。

DSH 生态强调「一切皆插件」;SkillHub 目录 为社区站点,与 DeepSeek / 幻方无官方从属关系。

结尾

dsh-session-toast 把 DSH 的轮次结束事件映射为 Windows 原生通知,并用前台检测与去抖控制打扰程度。进一步了解配置、工作原理与开发验证命令,见仓库 README。

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

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

Xiaoye