dsh-plugin-desktop-notify

August 16, 2026 · View on GitHub

DSH Web GUI 的浏览器桌面通知插件 / Browser desktop-notification plugin for the DSH Web GUI.

当某个会话的回合结束(running 位由 true 变 false)且页面不可见或未聚焦时,弹出系统级 Web Notification;点击通知聚焦页面。

When a session finishes its turn (running bit true → false) while the page is hidden or unfocused, a system-level Web Notification fires; clicking it focuses the page.

行为 / Behavior

  • 触发 / Trigger:会话列表 running→idle 边沿,仅实时帧驱动——页面加载/重连时重放的历史状态不会误触发。/ Edge on the session list's running→idle transition, driven by live frames only — history replayed at page load or reconnect never fires.
  • 静默 / Silence:页面可见且聚焦;通知权限被拒绝;浏览器不支持 Notification API。/ Page visible and focused; notification permission denied; Notification API unsupported.
  • 权限 / Permission:加载后首次点击/按键时请求授权(浏览器要求用户手势),拒绝后静默。/ Permission is requested on the first click/keypress after load (browsers require a user gesture); stays silent once denied.
  • 正文 / Body「会话名」回合已完成,点击返回查看,中英双语跟随界面语言。/ Localized (zh/en), following the UI language.

安装 / Install

git clone https://github.com/owenwei888-boop/dsh-plugin-desktop-notify.git
dsh plugin --profile web add file:C:/path/to/dsh-plugin-desktop-notify

更新(源码修改后需重新安装,安装的是副本,不自动跟随源码)/ Update (the installed copy does not follow the source; re-run to reinstall after changes):

dsh plugin --profile web add file:C:/path/to/dsh-plugin-desktop-notify

卸载 / Uninstall:

dsh plugin --profile web remove dsh-plugin-desktop-notify

插件集变更需重启 dsh web 服务后刷新浏览器页面生效。/ Plugin-set changes take effect after restarting the dsh web service, then refreshing the page.

验证 / Verify

重启并刷新页面后,在浏览器 DevTools 控制台执行 / After restart and refresh, run in the browser DevTools console:

__DSH_DESKTOP_NOTIFY_TEST__()   // 切走标签页时应弹出测试通知,返回 "notified" / fires a test notification with the tab hidden; returns "notified"

测试钩子同样遵守前台静默策略——前台时返回 "foreground"。/ The test hook honors the foreground-silence policy — it returns "foreground" while the page is visible and focused.

已知限制 / Known limitations

  • 不区分回合结束原因(出错/达到长度上限与正常完成同文案)。/ Does not distinguish why a turn ended (errors and length caps share the completion wording).
  • 多标签页同时打开时各自触发(同 tag 通知在系统层去重,极端情况可能出现两条)。/ Multiple open tabs each fire (same-tag notifications dedupe at the OS level; two can appear in rare cases).

License

MIT