dsh-message-reminder:DSH 询问时的 Windows 桌面消息提醒

前言

在 DSH(DeepSeek Harness)里跑长任务时,智能体常会调用 ask_user_question 等你确认或补充信息。若此时窗口被最小化、被别的程序盖住,或你正在看别的 Session,问题卡片只留在 Web 客户端里,很容易漏看。

系统自带的通知在 Electron 外壳里往往只进通知中心、不出横幅。本插件在 Windows 上改为在桌面右下角弹出一张可点击的毛玻璃卡片;点击后恢复并置顶 DSH 窗口,并导航回发起询问的 Session。维护者为 LJY4-bilibili,分类为客户端插件,源码托管于 GitHub,许可证 MIT。

这是什么

dsh-message-reminder 是 DSH 的客户端插件:当 DSH 通过 ask_user_question 向你提问,且你当前并不在「盯着该 Session 的前台窗口」时,在 Windows 桌面右下角弹出通知卡片;点击卡片会恢复 DSH 窗口并回到对应 Session。非 Windows 或无法使用 PowerShell 辅助进程时,Host 会回退到页面内的 Notification。

插件不修改询问流程本身:Host 以 { prepend: true } 观察 user-questions/request waterfall,记录询问后仍把应答权交回原监听者;卡片不抢焦点。

核心功能

询问触发与抑制

时机 行为
调用 ask_user_question,且页面不在该 Session 或窗口未在前台 右下角弹出毛玻璃卡片(内缩约 18px),播放可配置的提示音;正文为问题摘要,多题时附带「共 N 个问题」
页面正显示该 Session 且窗口为当前活动窗口 默认不弹卡片、不响(问题已在输入区)
问题被回答或取消 卡片随辅助进程结束而消失

是否「正在看该 Session」由 client.js 上报 mainView、页面可见性与聚焦状态;Host 用 visibilityState === 'visible' 与 document.hasFocus() 的与关系判断。配置项 skipWhenViewingSession 默认为 true;设为 false 则不再抑制。

Windows acrylic 卡片

在 Windows 10 1803 及以上,卡片通过 SetWindowCompositionAttribute 与 DWMWA_WINDOW_CORNER_PREFERENCE 绘制无边框、置顶的毛玻璃窗口,文字用 TextRenderer.DrawText 绘制。README 说明:渲染进程 Notification、NotifyIcon 气泡与 WinRT toast 在该 Electron 环境下均无法显示横幅,故采用自绘窗口。

点击卡片:按阶梯策略尝试恢复、置顶 DSH 窗口(进程名默认 DeepSeek Harness),再导航回 Session。点击右上角 ✕ 仅关闭卡片,不跳转。正文超过 160 字符会截断;标题过长会省略号显示。

通道与诊断

Host 使用 Node 内置模块(node:child_process、node:fs、node:path),注册 webServer 路由,无运行时 npm 依赖。页面通过 SSE(/message-reminder/events)接收 ask / click / resolved 等事件。诊断接口:GET /message-reminder/status。

环境要求

  • DSH,且使用 Web 客户端。
  • Node.js >= 22。
  • Windows 10 1803+ 方可使用 acrylic 卡片;macOS / Linux 或 PowerShell 不可用时使用页面内 Notification。

安装与启用

插件上架 DSH 插件市场(dshmarket)后可从市场安装;也可手动加入 profile。本地 checkout 始终可用:

dsh plugin --profile <your-profile> add link:/path/to/dsh-message-reminder

包发布到 npm 后也可:

dsh plugin --profile <your-profile> add dsh-message-reminder

dsh plugin add 会在 profile 内执行 pnpm add。包自带 dsh.bundle.patch,加载 profile 时会插入对应行;请确认 profile 的 bundle 列表中包含该包名,例如:

// $DSH_HOME/profiles/<your-profile>/package.json
{
  "dsh": { "profile": { "bundles": ["...", "dsh-message-reminder"] } }
}

配置

在 profile 的 cordis.patch.yml 中按行 id 覆盖(config 块会替换整个默认块,需保留仍要使用的字段):

- id: message-reminder
  config:
    title: DSH 消息提醒                    # 卡片标题
    skipWhenViewingSession: true           # 询问 Session 已在主视图时不弹卡片(默认)
    skipWhenFocused: false                 # 为 true 时页面聚焦也跳过渲染进程通知
    windowProcessName: DeepSeek Harness    # 点击卡片时要置顶的进程窗口名
    sound: true                            # true | false | asterisk / exclamation / question / hand / beep
    notifyMode: auto                       # auto | balloon | renderer

notifyMode: balloon 指 Host 侧 PowerShell 辅助进程卡片;renderer 强制使用页面通知,便于不拉起子进程时测试。提示音仅在卡片实际展示时播放。

典型用法

1、在 profile 中按上文命令安装并确认 bundle 列表包含 dsh-message-reminder。

2、按需修改 cordis.patch.yml 中的 title、windowProcessName 与 sound 等项。

3、启动 DSH,让智能体在后台 Session 中触发 ask_user_question,同时将 DSH 最小化或切换到其他程序;应看到右下角卡片。点击卡片应回到该 Session 并展开待答问题。

4、需要排查时访问 Host 提供的 GET /message-reminder/status。

适用场景与注意

适合长时间跑 DSH、常离开窗口又需要及时回答 ask_user_question 的 Windows 用户。插件以当前 DSH 进程权限运行,安装前请自行阅读源码与 MIT 许可证。

已知限制(来自 README):

  • 卡片仅 Windows 可用;其他平台为渲染进程通知。
  • acrylic 调用失败时卡片退化为纯色背景,其余功能仍可用。
  • 部分环境下 AMSI 可能导致 PowerShell 编译脚本失败,Host 最多重试 5 次后回退到渲染进程通知。
  • 首张卡片因辅助进程编译 Win32 helper 可能略慢(约 1 秒)。

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

链接

羽毛球分组比赛记分
小程序二维码

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

小夜