본문으로 건너뛰기
H

dsh-notice-helper (dsh-notice-helper)

hzzzcyn/dsh-notice-helper/packages/dsh-notice-helper

Shows taskbar flash, a sound and a toast card on Windows when a session needs confirmation or a main task completes, with per-event sound themes, a 30-second same-session merge and multi-display anchoring next to the DSH window. Requires DSH desktop 0.2.2-rc.x; uses the koffi native backend shipped with DSH. Its HTTP routes have no DSH access check, so a web page open in your browser could call them.

설치

dsh plugin --profile web add github:hzzzcyn/dsh-notice-helper

이 플러그인은 저장소의 packages/dsh-notice-helper 하위 디렉터리에 있습니다.

README

dsh-notice-helper

给 DeepSeek Harness 桌面版补上「待办提醒」:任务栏闪烁 + 提示音 + 右下角置顶卡片,并在任务完成时弹成功/失败通知。不落地 exe、不开额外端口、不改 DSH 安装包。

功能

场景表现
有待我确认(审批 / 提问 / 方案审阅 / 其他)任务栏闪烁 + 提示音 + 右下角卡片,点击回到 DSH
主任务完成成功 → 绿勾卡片 + 提示音;失败 / 中断 → 红叹号卡片 + 错误音
子智能体 / 后台任务完成静默(不闪、不响、不弹卡),只对主任务提醒

卡片特性:置顶但不抢焦点、8 秒自动收起、悬停暂停、主题三选一(跟随 DSH / 白色 / 黑色)、预热常驻(弹卡延迟约百毫秒级)。

架构

DSH 渲染进程(页面半)          DSH 宿主进程(宿主半)
lib/client.js                 lib/index.js
只读观察待确认集合 + 绿点      ctx.effect 注册同源路由 /dsh-notice-helper/*
  └ fetch 同源 POST ──────────→  └ lib/presenter.js 表现层
                                     ├ Electron flashFrame
                                     └ 回落 koffi/user32 FlashWindowEx + MessageBeep
  • 页面半 lib/client.js:经典脚本(window.__ModuleLoader__.load 工厂,零顶层 import/export),只读观察 ctx.uiSession.sessionStatus 的待确认集合与完成绿点。
  • 宿主半 lib/index.js:跑在 ELECTRON_RUN_AS_NODE,require('electron') 会失败,Win32 表现走 koffi 调 user32/winmm。
  • 表现层 lib/presenter.js:electron → native(koffi) → none 三级降级。

目录

路径内容
packages/dsh-notice-helper/lib/client.js页面半:观察待确认集合 + 完成绿点,推事件
packages/dsh-notice-helper/lib/index.js宿主半:注册同源路由、事件分发
packages/dsh-notice-helper/lib/presenter.js表现层:闪窗 / 声音 / 卡片 / 降级
packages/dsh-notice-helper/lib/config.js配置(flash / sound / card / 主题 / 预热)
packages/dsh-notice-helper/lib/card.js卡片窗口生命周期
packages/dsh-notice-helper/lib/prewarm.js卡片预热常驻
packages/dsh-notice-helper/assets/卡片渲染资源
packages/dsh-notice-helper/cordis.patch.yml声明本包插入 DSH 插件栈
docs/ARCHITECTURE.md分层、协议、降级链
docs/PLUGIN-DEV.md插件写法、安装、验收、已知坑
docs/DECISIONS.md关键决策与踩坑记录
docs/STATUS.md版本演进与验收状态

安装

$profileDir = "$env:USERPROFILE\.dsh\profiles\desktop"
New-Item -ItemType Junction -Path "$profileDir\node_modules\dsh-notice-helper" `
  -Target "<本仓库>/packages/dsh-notice-helper"

# cordis.patch.yml 追加 insert 块(见 packages/dsh-notice-helper/cordis.patch.yml)
# 然后重启 DSH 桌面程序

或用 DSH 桌面自带 CLI 装包(推荐,自动写 patch 块):

& "<DSH 安装目录>\resources\runtime\cli\bin\dsh.cmd" plugin --profile desktop add "<本仓库克隆路径>\packages\dsh-notice-helper"

dsh plugin add 接的是本地路径或 git 地址,裸包名会去 npm registry 找。 要求 DSH 桌面版 ≥ 0.2.2-rc.x(宿主接口 dsh-client-connection / dsh-host-webserver 0.2.x)。

自检

# 状态
curl.exe http://127.0.0.1:<端口>/dsh-notice-helper/status

# 触发提醒
curl.exe -X POST http://127.0.0.1:<端口>/dsh-notice-helper/event `
  -H "content-type: application/json" -d "{\"event\":\"attention\",\"title\":\"验收\"}"

# 停止
curl.exe -X POST http://127.0.0.1:<端口>/dsh-notice-helper/event `
  -H "content-type: application/json" -d "{\"event\":\"clear\"}"

端口以 ctx.webServer.getOrigin() 为准(重启会变)。离线八套自检在 docs/evidence/*.mjs,无 GUI 环境可跑。

排错

现象处理
/status 404插件没装上:查 cordis.patch.yml 的 insert 块、node_modules 的 junction、DSH 是否重启过
没任何提醒页面半探测失败:开控制台看 [dsh-notice-helper] 的 warn,确认 sessionStatus 接口存在
卡片不弹但闪了/响了看 /status.card 与 /status.completion 的诊断字段;卡片由宿主 spawn 本机 electron.exe 独立窗口,确认 electron 可执行路径可达
DSH 崩了先删 patch 块重启,再看宿主日志里 [dsh-notice-helper] 的异常栈

开发约定

  • 无构建步骤,但两半加载机制不同:宿主半 lib/index.js 是常规 ESM;页面半 lib/client.js 是经典脚本工厂,写成 ESM 会让整个 web boot 失败(见 docs/PLUGIN-DEV.md)。
  • 两半的 apply() 整体 try/catch,失败只 console.warn / ctx.logger.warn,绝不影响 DSH。
  • 宿主半注册路由一律包在 ctx.effect() 里,卸载即注销。
  • 不碰 app.asar、安装目录、注册表、系统服务、开机自启。
  • 协议、降级链、探测顺序见 docs/ARCHITECTURE.md。

License

MIT

관련 플러그인