dsh-notify-me 1.16.1 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,54 @@
2
2
 
3
3
  All notable changes to **dsh-notify-me** are documented here.
4
4
 
5
+ ## [1.18.0] — 2026-11-08
6
+
7
+ 回应 [#26](https://github.com/chromoany/dsh-notify-me/issues/26):会话行悬停时那两个图标已经挤到标题了——铃铛可以关掉,右键菜单里也放一个同样能用的。
8
+
9
+ ### 新增
10
+
11
+ - **会话右键菜单也能静音**:右键点侧边栏的会话,菜单里多一行「静音此会话的提醒」/「取消静音,恢复此会话的提醒」,图标与按下状态跟悬停铃铛一致,点完菜单自动收起。它注在宿主旧的 `sidebar.workspaces.session.menu.item` 槽位(渲染在「归档」一行之前),优先用宿主自带的 `MenuItemButton`,看起来跟内置菜单行一样;宿主没有这个平台模块时回落成插件自己的 `role="menuitem"` 按钮。触摸设备本来就不显示悬停条,这一行是它们唯一的静音入口。
12
+ - **悬停铃铛可以关掉**:设置页「会话静音」卡片顶部新增开关「悬停时显示静音按钮」(配置键 `muteRowButton`,默认开)。关掉后未静音的会话悬停时不再出铃铛,改用右键菜单;已静音的会话仍然保留这枚铃铛——它在那里既是状态提示,也是一键取消静音的入口;标题前那个划掉的铃铛不受影响。手改的配置值不是布尔时回落默认,而不是悄悄变成关闭。
13
+
14
+ ### 修复
15
+
16
+ - **刷新后静音列表不再被清空**:`cleanMutedSessions` 的两个上限(`MUTED_MAX` / `MUTED_ID_MAX`)原本声明在 `readConfig()` 之后,而 `readConfig()` 在工厂初始化时就执行——那时两个上限还是 `undefined`,`out.length < undefined` 恒假,存过的静音 id 在启动时被整列表剪空。于是刷新页面后静音看上去还在(设置页读存储能数出来),实际提醒照发,直到下一次改设置重新读一遍存储才「想起来」。现在两个上限移到 `readConfig()` 之前,静音真正跨刷新保留;这是 1.16.0 起就存在的缺陷,与 [#26](https://github.com/chromoany/dsh-notify-me/issues/26) 同一片代码,一并修掉。
17
+
18
+ ### 测试
19
+
20
+ - `smoke/smoke-test.cjs` 的 `mutedSessionsUi` 扩写:两种语言的新文案、菜单槽位注入与注册、回退按钮的 `role="menuitem"` 与点击后经 `useMenuOpenState` 收起菜单、静音/取消静音往返、开关默认开、关掉后未静音行不渲染而静音行保留铃铛、标题前标记仍在、开关点击写回、非布尔值回落默认;卡片计数与一键恢复照旧。启动时从存储读静音列表这条路径也由这个用例覆盖(关掉悬停铃铛的页面直接按存储里的静音 id 渲染行尾铃铛)。
21
+
22
+ ### 文档
23
+
24
+ - README 中英「静音某些对话」补上右键菜单入口与「悬停时显示静音按钮」开关,边界条件说明菜单行依赖宿主旧菜单槽位、悬停铃铛关掉后的表现;`docs/listing.md` 的 `latest` 更新到 1.18.0。
25
+
26
+ ## [1.17.0] — 2026-10-29
27
+
28
+ 回到页面,还挂着的通知立刻收起;三种「自动消失」设置从此只约束定时关闭。
29
+
30
+ ### 修复
31
+
32
+ - **离开时收到的那条通知不再一直挡着**:以前按默认设置(「离开时保留」)收到的那条会一直留着——回到页面了它还在,挡在对话上或留在通知中心里,直到它自己的定时器到点、或被点掉。现在只要回到 DSH 页面,**不管用什么方式**——点任务栏、Alt+Tab、点通知本身、把最小化的窗口还原——插件都会立刻收起仍然挂着的通知。三条路径在实现上汇到同一处:窗口 `focus` 事件(`lib/client.js:2230`)、页面 `visibilitychange` 回到可见(`lib/client.js:4781`)、以及窗口一直没失去焦点但人走开了(`idleMinutes` 判定为空闲)之后的第一下键鼠输入(`lib/client.js:2254`)。
33
+ - **两条通知通道都覆盖**:桌面端那种不带按钮的普通通知由构造器产生,插件自己记着句柄(`lib/client.js:1364`);Web 端带「同意 / 拒绝」的常驻通知,插件向自己的 Service Worker 注册查列表再关(`lib/client.js:1379`)。所以连刷新页面前留下的那些也会被收掉——它们是上一个页面实例弹的,本页本来就没有它们的句柄。
34
+ - **收起只是把通知撤掉,不改动任何待办**:审批请求仍然在对话里等你裁决,标题标记、去重、外部推送、提示音都不受影响;之后请求被回答时原本的收尾逻辑照旧(关同 tag 的通知是幂等的)。记待办的 `pendingActions` 不被清掉。
35
+
36
+ ### 变更
37
+
38
+ - **三种「通知自动消失」设置只剩「时间到点」这一层含义**:离开时保留 / 总是关闭 / 从不关闭,管的都只是定时器那一次关闭;回到页面收起残留通知这一条,三种设置下都生效。「从不关闭」现在的准确含义是:不因为时间到点而关,但你回到页面时仍会收起。设置页那行提示文案一起改了(`autoDismissHint`,`lib/client.js:3300` 中文、`lib/client.js:3475` 英文):先说「离开电脑时收到的那条会留到你回来」,再点明三种设置只管那次到点关闭,切回页面(点任务栏、Alt+Tab、点通知都算)后残留的通知一律收起。
39
+
40
+ ### 新增
41
+
42
+ - `debug()` 新增三个字段:`toastsLive`(本页仍记着的、构造器通道的 toast 句柄数)、`toastsWithdrawn`(累计收起条数)、`lastToastWithdrawAt`(最后一次收起时间,ISO 字符串或 `null`)(`lib/client.js:3160`)。
43
+
44
+ ### 测试
45
+
46
+ - `smoke/smoke-test.cjs` 新增一节:回到页面即收起残留通知的离线用例(三条回来路径、两条通知通道、待办记录不被清掉;页面在前台时输入不会误收;「从不关闭」档照样收起)。
47
+
48
+ ### 文档
49
+
50
+ - README 中英同步:顶部特性里的「人走开但窗口没走」补一句回到页面就收起残留通知;「通知自动消失」与「离开时保留」两处改写边界(三种设置只约束定时关闭、回到页面一律收起、不看通知中心也不会被遗留通知挡着);提醒渠道一节补同样的边界;开发自检的测试清单补上这一节;控制台 `debug()` 一行补上新增的三个字段(`README.md:85` / `README.en.md:85`)。
51
+ - `docs/console-config.md` / `docs/console-config.en.md` 的 `autoDismiss` 注释补一句「只管定时关闭」。
52
+
5
53
  ## [1.16.1] — 2026-10-28
6
54
 
7
55
  文案修正,无行为变化。
@@ -10,6 +58,8 @@ All notable changes to **dsh-notify-me** are documented here.
10
58
 
11
59
  - 设置页「会话静音」卡的说明原写「被静音的会话在标题前显示划掉的铃铛」,但那个槽位在会话有运行状态时被状态点占用——正在跑的后台任务看不到标记。说明里补上这一点,并指出此时看行尾铃铛的按下状态(中英同步)。`README.md` / `README.en.md` 的正文本来就写了这个限制,只有设置页漏了。
12
60
  - 同一段里「列表上限 500 条」改成 200 条:上一版把 `MUTED_MAX` 降到 200(心跳 body 的 16 KiB 上限),README 两处漏改(`README.md:158`、`README.en.md:158`)。
61
+ - README 中英:兼容性写清实测范围——徽章与「已逐版实测真正激活」名单从 `0.2.1-rc.2` 更新到 `0.2.2-alpha.2`,补上 `0.2.1-rc.3` / `0.2.1-rc.4` / `0.2.2-alpha.2` 三版隔离实测(启动条目 71 / 71 / 72、`client.js` 返回 1.16.1 构建 248,023 B、`apply` 执行且 `debug()` 报 `bound`、设置页渲染出整块「通知提醒」)与「四个会话行槽位一个没少」的结论;`dsh.compatibility.dshReleases` 同步补 rc.3 / rc.4。
62
+ - 设置页截图重拍:旧图是 1.14.1 时代拍的(页脚版本号与「会话静音」卡片都不对),改在 `0.2.2-alpha.2` 的隔离实例里过 CDP 截取,两张 alt 文本补「会话静音 / muted sessions」。
13
63
 
14
64
  ## [1.16.0] — 2026-10-28
15
65
 
@@ -80,7 +130,7 @@ All notable changes to **dsh-notify-me** are documented here.
80
130
  ### 文档
81
131
 
82
132
  - README 中英:提醒渠道补上 Linux;外部推送写明关掉转发会取消已排队的重试、服务码非成功值记失败、2xx 但不是该服务的 JSON 记「已送出不可确认」;控制台示例补 `hostEnv` 与 `debug()` 的 `raiseChannel` / `raiseLast` / `configStored`。
83
- - 致谢新增 unnamed42([#21](https://github.com/chromoany/dsh-notify-me/issues/21) / [#22](https://github.com/chromoany/dsh-notify-me/pull/22):Linux 上 `dsh://open` 抬窗失效的报障与补丁)。11 张贡献者头像统一成同一套 48×48 圆形遮罩,`dunxuan`、`Donald-Yip` 之前分别是方形和自带 alpha。
133
+ - README 致谢表补 [#21](https://github.com/chromoany/dsh-notify-me/issues/21) / [#22](https://github.com/chromoany/dsh-notify-me/pull/22):Linux 上 `dsh://open` 抬窗失效的报障与补丁。11 张贡献者头像统一成同一套 48×48 圆形遮罩(此前有的方形、有的自带 alpha)。
84
134
  - `docs/listing.md` 版本口径同步到 1.14.7。
85
135
 
86
136
  ### 测试
@@ -246,13 +296,13 @@ All notable changes to **dsh-notify-me** are documented here.
246
296
 
247
297
  ### 文档
248
298
 
249
- - README 中英:外部推送整节重写(目标类型、可靠性、状态、签名、模板、钉钉为何不支持),控制台示例补 `externalRetryDelays` 与目标字段形状,已知限制口径同步;致谢加上 [@yuexian7](https://github.com/yuexian7) 与 #17。
299
+ - README 中英:外部推送整节重写(目标类型、可靠性、状态、签名、模板、钉钉为何不支持),控制台示例补 `externalRetryDelays` 与目标字段形状,已知限制口径同步;致谢表补 #17。
250
300
 
251
301
  ## [1.12.0] — 2026-10-21
252
302
 
253
303
  ### 新增
254
304
 
255
- - **人走开但窗口没走也算离开**(来自 [#16](https://github.com/chromoany/dsh-notify-me/pull/16),[@shrekcg](https://github.com/shrekcg)):`idleMinutes`(默认 3 分钟,`0` 关掉)内没有任何键鼠输入,就把「窗口在前台」按离开处理——「需要你」照常提醒、「回复完成」按离开规则提醒、`autoDismiss: "present"` 也不再撤掉那条通知。此前只认窗口失焦 / 页面隐藏,人坐在桌前离开座位时一切都还是「你在看」。
305
+ - **人走开但窗口没走也算离开**(来自 [#16](https://github.com/chromoany/dsh-notify-me/pull/16)):`idleMinutes`(默认 3 分钟,`0` 关掉)内没有任何键鼠输入,就把「窗口在前台」按离开处理——「需要你」照常提醒、「回复完成」按离开规则提醒、`autoDismiss: "present"` 也不再撤掉那条通知。此前只认窗口失焦 / 页面隐藏,人坐在桌前离开座位时一切都还是「你在看」。
256
306
  - **闲置到期会补发被压下的审批**(维护者补的):`currentHiddenOnly` 把当前对话的等待只留标题标记时,原先只有失焦 / 页面隐藏事件才会补发;现在闲置定时器到期即补发,人离开但窗口没动也能收到。一次性触发,队列清空后不重复。
257
307
  - **「回复完成」提醒时机三选一**(#16):`donePolicy` —— `"background"`(默认,旧行为)/ `"smart"`(屏幕上那条静默,别的对话完成照常提醒)/ `"always"`(从不静默),设置页「什么时候提醒」里换成下拉。
258
308
  - **通知自动消失三选一**(#16):`autoDismiss` —— `"present"`(默认,只有你在页面时才计时关闭,离开时收到的留在通知中心)/ `"always"`(旧行为)/ `"never"`(普通通知等你点掉)。带「同意 / 拒绝」的审批通知仍按 12 秒走。
@@ -274,7 +324,7 @@ All notable changes to **dsh-notify-me** are documented here.
274
324
 
275
325
  ### 文档
276
326
 
277
- - README 中英:设置清单换成三档下拉、补闲置判定与通知自收、删「副屏与审批卡片」整节、控制台示例同步、致谢加上 [@shrekcg](https://github.com/shrekcg) 与 #16。
327
+ - README 中英:设置清单换成三档下拉、补闲置判定与通知自收、删「副屏与审批卡片」整节、控制台示例同步、致谢表补 #16。
278
328
 
279
329
  ## [1.11.0] — 2026-10-21
280
330
 
@@ -508,7 +558,7 @@ All notable changes to **dsh-notify-me** are documented here.
508
558
  - 转发挂在 `fire()` 里、本地提醒决定要发之后触发:**跟本地提醒完全同一套触发规则**(「当前对话不弹通知」「页面打开时也提醒」等开关同样管它);设置页的「测试提醒」按钮与快捷裁决反馈走 `deliver()`,不会误发 webhook。
509
559
  - 跨域(CORS)口径:先走能读回响应的 CORS POST JSON;被拒(CORS/网络错误)时降级 no-cors + `text/plain` 送出,如实标为「已送出不可确认」(响应对页面不可见是浏览器规则,读不回就没法确认);Bark 另有经典 GET(`<地址>/<标题>/<正文>`)兜底;HTTP 错误如实记失败、不盲重试。
510
560
  - 版本号 1.6.1 → 1.7.0;`window.__dshNotifyMe.version` 与 `package.json` 同步;npm 关键词新增 external-notification / webhook / discord / bark / gotify / push-notification / 外部通知 / 推送提醒。
511
- - README(中英)同步:搜索词、设置清单、提醒方式、控制台配置块(四个新键 + `testExternal()`)、已知限制的 CORS 说明;致谢名单新增 [@RiZhiZhaoYi](https://github.com/RiZhiZhaoYi)(issue #12 的功能建议)。
561
+ - README(中英)同步:搜索词、设置清单、提醒方式、控制台配置块(四个新键 + `testExternal()`)、已知限制的 CORS 说明;致谢表补 #12(功能建议)。
512
562
 
513
563
  ### 测试
514
564
  - `smoke/smoke-test.cjs` 新增两段:① 转发链路(默认零外发、toast 测试不触发转发、四类负载形状、真实提醒镜像与两类开关、主开关、no-cors 降级、HTTP 500 单次不重试、Bark GET 兜底、非法 URL 剔除与未知类型归为 custom);② 设置页「外部通知」卡片(渲染与空状态、目标增删改落配置、测试按钮反馈文案、两种静默原因的提示语)。
@@ -526,7 +576,7 @@ All notable changes to **dsh-notify-me** are documented here.
526
576
 
527
577
  ### 变更
528
578
  - 版本号 1.6.0 → 1.6.1;`window.__dshNotifyMe.version` 同步。
529
- - README(中英)致谢名单新增 [@yanzhaohui1999](https://github.com/yanzhaohui1999)(issue #13 的性能报告与 PR #14 的修复及回归断言)。
579
+ - README(中英)致谢表补 #13 / #14(性能报告与修复、回归断言)。
530
580
 
531
581
  ## [1.6.0] — 2026-10-15
532
582
 
@@ -561,7 +611,7 @@ All notable changes to **dsh-notify-me** are documented here.
561
611
 
562
612
  ### 变更
563
613
  - 版本号 1.5.2 → 1.5.3;`window.__dshNotifyMe.version` 同步。
564
- - README(中英):「桌面端怎么抬窗的 / How the Desktop window gets raised」补真实壳复测结论与触发时机口径——深链必须在带用户手势的处理器里发(通知 `onclick` 自带手势,产品路径通);无手势的脚本化注入会被 Chromium 静默丢弃、外部协议不回流,复现时看似「通道被拦死」。致谢名单新增 [@EliteOtaku](https://github.com/EliteOtaku)(issue #9 的逐层排查与三轮真实壳复测)。
614
+ - README(中英):「桌面端怎么抬窗的 / How the Desktop window gets raised」补真实壳复测结论与触发时机口径——深链必须在带用户手势的处理器里发(通知 `onclick` 自带手势,产品路径通);无手势的脚本化注入会被 Chromium 静默丢弃、外部协议不回流,复现时看似「通道被拦死」。致谢表补 [#9](https://github.com/chromoany/dsh-notify-me/issues/9)(逐层排查与三轮真实壳复测)。
565
615
 
566
616
  ### 核实
567
617
  - issue #9 真实壳三轮复测(DSH Desktop 0.2.0-rc.2 / Windows 11):点通知 = 抬窗 + 切会话一步到位,同会话、跨会话、窗口在后台均稳定 ✅,1.5.2 的抬窗修复确认生效。
@@ -626,7 +676,7 @@ All notable changes to **dsh-notify-me** are documented here.
626
676
  ### 变更
627
677
  - 版本号 1.3.1 → 1.4.0;`window.__dshNotifyMe.version` 同步。
628
678
  - README(中英)补上设置页新开关、提醒时机说明、控制台配置示例与工作原理里的子代理口径。
629
- - README(中英)新增「致谢与贡献须知 / Credits & how contributions land」:外部 PR 的署名口径与贡献者名单;「只静音后台子代理、当前打开的照常提醒」这一口径来自 [@d0ublecl1ck](https://github.com/d0ublecl1ck) 在 [#8](https://github.com/chromoany/dsh-notify-me/pull/8) 讨论里的建议(收编进 main 的原版是整条静音),本次按该口径改准并由维护者落地。
679
+ - README(中英)新增「致谢与贡献须知 / Credits & how contributions land」:外部 PR 的署名口径与贡献者名单;「只静音后台子代理、当前打开的照常提醒」这一口径来自 [#8](https://github.com/chromoany/dsh-notify-me/pull/8) 讨论里的建议(收编进 main 的原版是整条静音),本次按该口径改准并由维护者落地。
630
680
 
631
681
  ### 测试
632
682
  - `smoke/smoke-test.cjs` 新增子代理用例:`ignoreSubagent` 默认值与 `debug()` 字段、后台子代理完成不提醒而普通后台会话照常、后台子代理等待不提醒也不打标题标记、分支(fork)会话仍提醒、关掉开关后子代理的等待与完成重新提醒,以及「当前打开的子代理会话照常提醒」——等待与完成都提醒;后台积压的等待在切进去时按当前对话的规则排队补发,切走则连标题标记与排队通知一起撤下。
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 chromoany
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 chromoany
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.en.md CHANGED
@@ -1,8 +1,6 @@
1
1
  <div align="center">
2
2
 
3
- <img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/brand/icon-app-128.png" width="76" height="76" alt="dsh-notify-me">
4
-
5
- # dsh-notify-me
3
+ <img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/brand/header.jpg" width="100%" alt="Banner: a lit bell mark over a dark desk scene, titled dsh-notify-me, subtitled Step away. Stay informed.">
6
4
 
7
5
  **Step away from DSH and know when to come back.**
8
6
 
@@ -15,7 +13,7 @@
15
13
  [![test](https://github.com/chromoany/dsh-notify-me/actions/workflows/test.yml/badge.svg)](https://github.com/chromoany/dsh-notify-me/actions/workflows/test.yml)
16
14
  [![DSH Web and Desktop](https://img.shields.io/badge/DSH-Web%20%7C%20Desktop-blue?style=flat-square)](#installation)
17
15
  [![Package size](https://img.shields.io/npm/unpacked-size/dsh-notify-me?style=flat-square&label=package%20size)](https://www.npmjs.com/package/dsh-notify-me)
18
- [![DSH Compatibility](https://img.shields.io/badge/DSH-tested%200.2.1--rc.2-6366f1.svg?style=flat-square)](#compatibility)
16
+ [![DSH Compatibility](https://img.shields.io/badge/DSH-tested%200.2.2--rc.1%20%2F%200.2.1--rc.5-6366f1.svg?style=flat-square)](#compatibility)
19
17
  [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
20
18
 
21
19
  </div>
@@ -26,7 +24,7 @@ A notification plugin for DSH Web / Desktop, so you can afford to keep full acce
26
24
 
27
25
  - **When input is needed:** approval, plan review, and questions get a notification, a sound, and a title marker.
28
26
  - **When a background reply finishes:** come back for the result; clicking the notification returns to that conversation. Pick "background only", "quiet for the open one", or "always".
29
- - **When you walk off but the window stays in front:** over 3 minutes without input counts as away, and the alert still fires as usual; the toast that arrived does not clear itself before you come back.
27
+ - **When you walk off but the window stays in front:** over 3 minutes without input counts as away, and the alert still fires as usual; the toast that arrived does not clear itself before you come back, and is withdrawn the moment you are back at the page (taskbar, Alt-Tab or the toast itself).
30
28
  - **When you leave your computer:** optionally forward alerts to Discord, Bark, Gotify, Feishu group bots, ServerChan, WxPusher, or your own webhook.
31
29
  - **When you close the page entirely:** optional host-side fallback — with no page open the host process keeps pushing "needs you" / "reply finished" to your gateway; or turn on just the same-origin relay so the page can reach an authenticated gateway. Both are off by default and configured in the profile's patch layer (see "After the page closes" under [Advanced](#advanced)).
32
30
 
@@ -41,7 +39,7 @@ A notification plugin for DSH Web / Desktop, so you can afford to keep full acce
41
39
  <details>
42
40
  <summary>See the settings interface</summary>
43
41
 
44
- ![The Notify me settings page: header, how you get told, when to alert, try it, and the collapsed Advanced block](https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/screenshots/settings-en.png)
42
+ ![The Notify me settings page: header, how you get told, when to alert, muted sessions, try it, and the collapsed Advanced block](https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/screenshots/settings-en.png)
45
43
 
46
44
  Just the plugin's own panel (the real component, on the same dark theme as the host), without the DSH navigation sidebar; row explanations only appear once the pointer rests on the title text, which is why only the titles show here.
47
45
 
@@ -82,7 +80,7 @@ Web users can also test the approval buttons, which then appear on the notificat
82
80
  window.__dshNotifyMe.test("done") // "reply finished" sample
83
81
  window.__dshNotifyMe.test("attention") // "needs you" sample
84
82
  window.__dshNotifyMe.test("approval") // Approve / Reject when the bridge is available; a plain notification otherwise (which is what Desktop gets)
85
- window.__dshNotifyMe.debug() // bridge ("active" = buttons work), raiseChannel, the last raise attempt in raiseLast, a refused toast's platform message in lastToastReject, configStored for whether the settings really persisted, and hostBridge for host coordination
83
+ window.__dshNotifyMe.debug() // bridge ("active" = buttons work), raiseChannel, the last raise attempt in raiseLast, a refused toast's platform message in lastToastReject, configStored for whether the settings really persisted, and hostBridge for host coordination; after coming back to the page, toastsLive / toastsWithdrawn / lastToastWithdrawAt show what is still tracked, how many were withdrawn, and when that last happened
86
84
  ```
87
85
 
88
86
  If no test notification appears, check in this order: whether the notification permission was declined (click once on the page and choose **Allow**; or address-bar lock → Site settings → Notifications → Allow → reload), whether DSH was restarted after installing, and whether the browser's notifications are switched off in the OS settings.
@@ -124,7 +122,7 @@ Open **Settings → Notify me**. The page lays out three blocks — how you get
124
122
  - **Also alert "needs you" while the window is in front** (on by default): off means you only hear it once the window goes to the background;
125
123
  - **Stay quiet for the conversation on screen** (on by default): a wait in the conversation you are looking at keeps only the tab marker, and is delivered once you leave;
126
124
  - **When "reply finished" alerts** (default "background only"): background only / quiet for the open one / always — pick one;
127
- - **Dismiss the toast automatically** (default "keep while away"): keep while away / always close / never close — pick one;
125
+ - **Dismiss the toast automatically** (default "keep while away"): keep while away / always close / never close — pick one; the choice only covers the closing on the timer, and leftover toasts are withdrawn once you are back at the page;
128
126
  - **Ignore subagent sessions** (on by default): skips background subagent sessions, while the one you have open still alerts;
129
127
  - **Click a toast to open that conversation** (on by default): switches to that conversation and brings the window forward — on Windows through the host route, on macOS / Linux through the `dsh://open` deep link — and with several tabs only one is raised.
130
128
 
@@ -134,7 +132,7 @@ Open **Settings → Notify me**. The page lays out three blocks — how you get
134
132
  - **What counts as background**: switching to another app, being covered by another window, or minimizing all count; a window left in front with 3 minutes of no keyboard or mouse input counts too, and `idleMinutes: 0` falls back to looking only at the window.
135
133
  - **When "stay quiet for the conversation on screen" is replayed**: as usual once the window goes to the background or the idle timer fires; if you already handled it, it is dropped.
136
134
  - **The three "reply finished" choices**: "background only" = alert when you are not watching the page; "quiet for the open one" = the one on screen stays silent while other conversations still alert, useful with several open; "always" = never suppress. An old profile's "also alert 'reply finished' while in front" switch migrates to this setting automatically.
137
- - **"Keep while away"**: while you are at the page a plain toast closes itself after a few seconds; one that arrived while you were away stays in the notification centre until you come back. A toast with Approve / Reject carries no auto-dismiss timer — it stays until you click a button, answer the request in the page, or a newer request replaces it; a desktop approval toast, which cannot render buttons, closes after 12 s and is likewise not withdrawn while you are away.
135
+ - **"Keep while away"**: while you are at the page a plain toast closes itself after a few seconds; one that arrived while you were away stays in the notification centre until you come back. It is withdrawn the moment you are back (taskbar, Alt-Tab, the toast itself, or restoring a minimized window), and none of the three options affect that — so a toast you never opened in the notification centre is not left in your way. A toast with Approve / Reject carries no auto-dismiss timer — it stays until you click a button, answer the request in the page, or a newer request replaces it; a desktop approval toast, which cannot render buttons, closes after 12 s and is likewise not withdrawn while you are away. Both are withdrawn when you come back to the page.
138
136
  - **Fallback for a toast click**: on Desktop a window that will not raise leaves only the conversation switch, with the reason in `debug().raiseLast`; turn this switch off and a click does nothing.
139
137
 
140
138
  </details>
@@ -143,18 +141,21 @@ Open **Settings → Notify me**. The page lays out three blocks — how you get
143
141
 
144
142
  For the "this one runs automated work in the background — I do not need to hear about it tonight" case: silence one row and nothing else.
145
143
 
146
- - **Mute**: hover a session in the sidebar, a bell appears on the right; click it to mute that conversation (the button reads "mute alerts for this session"), click again to resume.
144
+ - **Mute**: hover a session in the sidebar, a bell appears on the right; click it to mute that conversation (the button reads "mute alerts for this session"), click again to resume. You can also right-click the session and pick "Mute alerts for this session" — touch devices have no hover strip, so that menu row is their entry point.
147
145
  - **Mark**: a muted conversation shows a crossed bell before its title (announced as "alerts muted for this session").
146
+ - **The hover bell can be switched off**: the "Show the mute bell on hover" switch at the top of the "Muted sessions" card on the settings page defaults to on; off hides the bell from the hover strip, and unmuted conversations are muted from the right-click menu instead. A muted conversation keeps its bell — it shows the state and unmutes in one click; the crossed bell before the title is unaffected.
148
147
  - **Scope**: "needs you", "reply finished", sound, the tab-title mark and external forwarding are all silenced for that conversation; every other conversation is untouched. The test buttons under "Try it" still fire — they exist to check the channel on the spot.
149
148
  - **Persistence**: the list lives in local storage, so it survives reloads and restarts; a hand-edited list is pruned instead of breaking the page.
150
149
  - **After the tab closes**: the list travels with the heartbeat, so the host-side fallback honours it too — otherwise closing the page would start the very alerts you turned off.
151
150
 
152
- The settings page has a "Muted sessions" card under "When to alert" with the current count and an "Unmute all" button.
151
+ The settings page has a "Muted sessions" card under "When to alert" with the current count, the hover-bell switch at the top of the card, and an "Unmute all" button.
153
152
 
154
153
  <details>
155
154
  <summary>Edge cases</summary>
156
155
 
157
156
  - The mark lives in the host's `sidebar.session.row.leading` slot, and the host puts its status dots there while a session is running, so the mark is not rendered then — a running background job shows no crossed bell until it stops. The mute itself is unaffected.
157
+ - The right-click menu row lives in the host's legacy `sidebar.workspaces.session.menu.item` slot; a host that does not declare that slot only loses that one row — the hover bell, the settings page and the mute itself keep working.
158
+ - With the hover bell off, an unmuted conversation has no mute control in the row at all, so checking or clearing the mute goes through the right-click menu; a muted conversation keeps its pressed-state bell at the end of the row.
158
159
  - Muting keys on the session id: renaming or moving the directory changes nothing, and a deleted session is harmless in the list (capped at 200 ids; "Unmute all" clears it).
159
160
  - Muting does not change the "reply finished" policy or "current conversation stays quiet"; when both apply, the mute wins.
160
161
 
@@ -312,80 +313,11 @@ This is primarily a **browser-layer** plugin: local toasts, sound and the title
312
313
 
313
314
  ## Compatibility
314
315
 
315
- Per-release adaptation records live in [package.json](package.json) under `dsh.compatibility.dshReleases`; the current host (`0.2.1-rc.2`) gates installation on `peerDependencies` and `engines` only and no longer reads that field, so it is a human-readable record, not a gate.
316
-
317
- Every release was tested to **actually activate**: `0.1.1-rc.2`, `0.1.2-rc.1`, `0.1.5-rc.1`, `0.1.5-rc.2`, `0.2.0-rc.2` and `0.2.1-rc.2` (the criteria: the plugin entry lands in the boot page's `__DSH_BOOT__`, its inject dependencies resolve, `/plugins/??dsh-notify-me/client.js&rev=…` serves a build containing the new code, and the "Notify me" section appears in Settings). Plugin entries stay compatible from `0.1.1-rc.2` through `0.2.1-rc.2`, and stepping back to an older host needs no config change; the `1.9.0` settings redesign added no new host API, and the bell in the settings page header is the plugin's own SVG (`docs/brand/`).
318
-
319
- <details>
320
- <summary>Host-generation shape differences and two known traps</summary>
321
-
322
- The plugin picks its interaction source per host generation; the table below marks the boundaries of each shape, not a gate:
323
-
324
- | Host generation | "Needs you" interaction source | Current session | Toast-click navigation |
325
- | --- | --- | --- | --- |
326
- | `<= 0.1.2-alpha.1` | controller snapshot `pending[]` | snapshot `current` | `sessions.open()` |
327
- | `0.1.2-alpha.2 .. 0.1.6-alpha.1` | `uiSession.pendingInteractions` | snapshot `current` | `sessions.open()` |
328
- | `>= 0.1.6-alpha.2` (incl. `0.2.0-rc.2`, `0.2.1-rc.2`) | `uiSession.sessionStatus` | `retainedBy.mainView` | `uiWorkspace.openSession()` |
329
-
330
- The ranges are illustrative: the plugin picks its source by store shape (whenever `sessionStatus` exists it takes the new path), and the version numbers only mark where each shape appeared. The `peerDependencies` range shapes npm's peer warning — `0.2.1-rc.2` already falls inside `>=0.2.0-rc.1 <0.3.0-0`, so no exemption is needed.
331
-
332
- `0.2.1-rc.2` got a separate isolated run: an isolated `DSH_HOME` booting `dsh web` (70 boot entries) placed the plugin entry 59th, in the `application` batch, with all three inject targets present and ordered before it; `client.js` served the then-installed 1.7.0 source build (140,153 B); loaded in a headless Chromium page, `apply` ran normally and `debug()` reported `uiSession: bound`, `uiSessionSource: sessionStatus`, `bridge: active`. Host-side shapes match `0.2.0-rc.2`; no code change was needed.
333
-
334
- Two traps are worth remembering: a package listed in `dsh.client.inject` that a newer runtime no longer ships parks the client entry at `pending (waiting for services: …)` forever — which is exactly how 1.1.3 broke on `0.1.2-rc.1` and later; and when the host swaps a store or a field name nothing throws, alerts just go **silent** — `pendingInteractions`→`sessionStatus`, `list.current`→`retainedBy.mainView` and `sessions.open()`→`uiWorkspace.openSession()` were all this kind. So every adaptation has to confirm with `window.__dshNotifyMe.debug()` that it really reports `bound`.
335
-
336
- </details>
316
+ Every release from `0.1.1-rc.2` through `0.2.2-rc.1` was tested to actually activate, including the recent desktop build `0.2.2-rc.1` (the criteria: the plugin entry lands in the boot page's `__DSH_BOOT__`, its inject dependencies resolve, `/plugins/??dsh-notify-me/client.js` serves a build containing the new code, and the "Notify me" section appears in Settings). Per-release records, the host-generation shape differences and the two traps that fail silently are in **[docs/compatibility.en.md](docs/compatibility.en.md)**.
337
317
 
338
318
  ## Advanced console configuration
339
319
 
340
- The Settings page is the first entry point; to script or bulk-edit preferences, or to reset them, the config lives in `localStorage` (`dshNotifyMe.config`) and can be adjusted live from the console:
341
-
342
- <details>
343
- <summary>Console API and storage reference</summary>
344
-
345
- ```js
346
- window.__dshNotifyMe.config // view current config
347
- window.__dshNotifyMe.setConfig({
348
- enabled: true, // false = disable all reminders (master switch)
349
- language: "auto", // 'auto' follow the UI | 'zh' Simplified Chinese | 'en' English
350
- attentionHiddenOnly: false, // true = don't alert "needs you" while the page is visible
351
- currentHiddenOnly: true, // true = waits in the conversation on screen keep only the title marker (replayed once away)
352
- donePolicy: "background", // "reply finished" policy: 'background' only when away | 'smart' quiet only for the open one | 'always' always alert
353
- idleMinutes: 3, // minutes without keyboard/mouse input before "away" counts (0 = turn the idle rule off)
354
- autoDismiss: "present", // toast auto-dismiss: 'present' keep while away | 'always' always close | 'never' never close
355
- ignoreSubagent: true, // true = no alerts for background subagent sessions (the open one still alerts)
356
- mutedSessions: [], // session ids muted per conversation (written by the sidebar bell, survives reloads)
357
- sound: true, // sound switch (also governs the "system notification sound" mode)
358
- soundDone: "synth", // "reply finished" sound source: 'synth' built-in | 'custom' picked file | 'system' OS notification sound
359
- soundAttention: "synth", // "needs you" sound source, same values
360
- volume: 0.5, // volume 0..1
361
- autoFocus: true, // a toast click returns to the conversation that raised it
362
- quickActions: true, // Approve / Reject buttons on approval toasts
363
- hostEnv: "auto", // runtime: 'auto' detect | 'desktop' force the app | 'web' force the browser
364
- externalEnabled: false, // external forwarding master switch (default off: no endpoint, nothing is sent)
365
- externalAttention: true, // forward "needs you" (exactly the same trigger rules as local alerts)
366
- externalDone: true, // forward "reply finished"
367
- externalRetryDelays: [2000, 6000], // backoff for retryable failures (ms, with jitter; [] = send once)
368
- externalTargets: [] // push targets, see the field notes below
369
- })
370
- // Target shape: {id, type, url, secret?, token?, uid?, template?, enabled?}
371
- // type: 'discord' | 'bark' | 'gotify' | 'feishu' | 'serverchan' | 'wxpusher' | 'custom'
372
- // token/uid only for wxpusher (its URL is fixed to the official endpoint); secret signs Feishu bodies
373
- // and custom HMAC headers; template is optional ({{title}} {{body}} {{event}} {{time}} {{session}});
374
- // enabled:false disables that one target
375
- window.__dshNotifyMe.resetConfig() // restore defaults (also drops any picked audio files)
376
- window.__dshNotifyMe.decide("approval:3", "allowed-once") // programmatic decision: "allowed-once" | "rejected"
377
- window.__dshNotifyMe.testExternal() // explicit outbound test to valid targets; resolves {sent, unverified, failed, statuses}
378
- ```
379
-
380
- > **External-test switch boundary:** the settings page's "Send test notification" needs the "Enable reminders" and "External notifications" master switches on, but ignores the two per-kind forwarding switches. The console `testExternal()` call is an explicit test: with valid configured targets it sends to them even when those master switches are off; with no valid targets it sends nothing. Ordinary `test("done")` / `test("attention")` / `test("approval")` calls only test local alerts and never forward externally.
381
-
382
- > Picked audio files do not live in `dshNotifyMe.config`: each kind gets its own key (`dshNotifyMe.sound.done` / `dshNotifyMe.sound.attention`, holding a `{name, size, data}` data URL), because one file inflates by ~1.37× once turned into a data URL and would slow down every config read. `resetConfig()` clears both keys along with the config.
383
- >
384
- > To confirm which source is actually in effect, check `soundDone` / `soundAttention` and `customSoundDone` / `customSoundAttention` in `window.__dshNotifyMe.debug()`.
385
- >
386
- > `debug().hostBridge` is the read-only snapshot of host coordination: `state` (`idle` the probe has not answered yet; `active` the host has a fallback and this page is holding the lease with its heartbeat; `unavailable` the host is there but offers no fallback, which is what a stock install looks like — an unregistered 404 route counts here too and is not a fault; `error` the host answered nothing usable, or the gate refused this page outright), `leaseMs` (the lease the host granted, in milliseconds), `relayEnabled` and `relayPath` (the relay route, when the host enabled one), `relayUpstreamHost` / `relayUpstreamPath` (the gateway endpoint the fold matches), `lastReason` (why the last probe failed — `bad-host` / `cross-origin` / `http-403` — and `null` when it was not a fault), and `lastProbeAt` / `lastBeaconAt` (the last probe and the last heartbeat, as ISO strings or `null`). A gate refusal reads as `error` rather than as "off", because it is a configuration the user can fix: add this page's origin to the top-level `allowedOrigins` of the `- id: notify-me` entry in the profile.
387
-
388
- </details>
320
+ The Settings page is the first entry point. To script or bulk-edit preferences, reset them, or look up the external-target fields, see **[docs/console-config.en.md](docs/console-config.en.md)** — the full config keys, `decide()` / `testExternal()`, the external-test switch boundary, and how to read custom sounds and `debug().hostBridge`.
389
321
 
390
322
  ## How it works
391
323
 
@@ -394,7 +326,7 @@ The reminder core watches session state and pending interactions; approval decis
394
326
  <details>
395
327
  <summary>Event sources and graceful degradation</summary>
396
328
 
397
- The reminder core picks its interaction source per host generation (see the table above); the current session always comes from the client `sessions` service:
329
+ The reminder core picks its interaction source per host generation (see the table in [docs/compatibility.en.md](docs/compatibility.en.md)); the current session always comes from the client `sessions` service:
398
330
 
399
331
  - **The current session's** `SessionSnapshot`: a `running: true → false` edge means a reply finished;
400
332
  - **pending interactions**: a new key in `uiSession`'s `sessionStatus` (`>= 0.1.6`, per-session `pendingInteraction`) or in `pendingInteractions` (`0.1.2 .. 0.1.5`) means the agent is waiting on you — the container carries the approval tool name / reason or the question text; older hosts fall back to the controller snapshot's `pending[]`;
@@ -412,7 +344,7 @@ Notifications with Approve / Reject buttons can only be raised by a Service Work
412
344
  <details>
413
345
  <summary>Button-toast bookkeeping and window raising</summary>
414
346
 
415
- Each button toast is booked against its interaction key, and one toast claims only one wait; once the request has been answered in the page, or replaced by a newer request, clicking the leftover buttons decides nothing and just closes it quietly. Button toasts carry no auto-dismiss timer — they stay until you click or answer; plain toasts close after 5 s, and a desktop approval toast without buttons after 12 s. With "never close" selected neither kind closes itself. If you miss the click, the approval in the conversation is still waiting for you.
347
+ Each button toast is booked against its interaction key, and one toast claims only one wait; once the request has been answered in the page, or replaced by a newer request, clicking the leftover buttons decides nothing and just closes it quietly. Button toasts carry no auto-dismiss timer — they stay until you click or answer; plain toasts close after 5 s, and a desktop approval toast without buttons after 12 s. With "never close" selected neither kind closes on the timer; all three options cover that timer only, so anything still up is withdrawn once you are back at the page. If you miss the click, the approval in the conversation is still waiting for you.
416
348
 
417
349
  The "raise a window and switch its conversation" part of a body click is scheduled on the worker half as well: `client.focus()` raises exactly one window (a visible one first) and routes the conversation switch to that window alone, so several DSH tabs never fight over focus or all switch at once.
418
350
 
@@ -481,7 +413,7 @@ npm test # smoke-test (state machine) + host-route-test
481
413
  npm pack --dry-run # preview the published tarball
482
414
  ```
483
415
 
484
- `smoke/smoke-test.cjs` is the offline state-machine suite: three host generations + master switch + zh/en cases + the quick-decision bridge (worker half included) + idle detection and toast self-dismiss + toast tag length handling + the page's host-bridge probe / heartbeat / release and the shape of `debug().hostBridge`. `smoke/host-route-test.mjs` needs no local DSH and runs the `lib/index.js` route, its probe and the 403/405/501 gate on every platform.
416
+ `smoke/smoke-test.cjs` is the offline state-machine suite: three host generations + master switch + zh/en cases + the quick-decision bridge (worker half included) + idle detection and toast self-dismiss + withdrawing leftover toasts on return + toast tag length handling + the page's host-bridge probe / heartbeat / release and the shape of `debug().hostBridge`. `smoke/host-route-test.mjs` needs no local DSH and runs the `lib/index.js` route, its probe and the 403/405/501 gate on every platform.
485
417
 
486
418
  The three new suites also ship their own fake `ctx`, need no local DSH and touch no network: `smoke/page-bridge-test.mjs` runs the page-bridge route — status shape, heartbeat and release, missing intent header `403`, cross-origin `403`, bad JSON `400`, oversized `413`, the `allowedOrigins`-derived `Host` (a simulated tunnel) being let through, and path collisions; `smoke/host-fallback-test.mjs` runs the host fallback — approval dedupe, `turn/end` throttling, subagent skip, no push on a fresh lease, a push after the lease expires, an immediate push after `alive:false`, language following the heartbeat, credentials re-read after a 401, and the health probe; `smoke/relay-route-test.mjs` runs the relay — the `GET` probe, `405`, cross-origin `403`, `413`, `400`, `503`, the `200` / `502` mapping and "retry exactly once on a 401".
487
419
 
@@ -509,6 +441,7 @@ powershell -NoProfile -File lib/focus-window.ps1 -ProcessId 0 # the last line
509
441
  | <a href="https://github.com/dunxuan"><img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/contributors/dunxuan.png" width="40" height="40" alt="@dunxuan"></a> | [#20](https://github.com/chromoany/dsh-notify-me/issues/20): the report that alerts for the open session showed a placeholder instead of the session title |
510
442
  | <a href="https://github.com/unnamed42"><img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/contributors/unnamed42.png" width="40" height="40" alt="@unnamed42"></a> | [#21](https://github.com/chromoany/dsh-notify-me/issues/21) / [#22](https://github.com/chromoany/dsh-notify-me/pull/22): the Linux `dsh://open` raise-path report and patch, which brought the deep link back on macOS / Linux in 1.14.4 |
511
443
  | <a href="https://github.com/LIEGU0317"><img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/contributors/LIEGU0317.png" width="40" height="40" alt="@LIEGU0317"></a> | [#24](https://github.com/chromoany/dsh-notify-me/issues/24) / [#25](https://github.com/chromoany/dsh-notify-me/pull/25): the host-side fallback push and same-origin relay modules (optional, off by default), with tests and docs |
444
+ | <a href="https://github.com/ekexium"><img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/contributors/ekexium.png" width="40" height="40" alt="@ekexium"></a> | [#23](https://github.com/chromoany/dsh-notify-me/issues/23): the per-conversation mute request (an on/off switch per session, persistence across restarts, a mark on the session row), supported since 1.16.0 |
512
445
 
513
446
  Attribution policy: external PRs are landed as maintainer commits — the original commit is not reused and no Co-authored-by trailer is added, so GitHub's contributors graph lists the maintainer only and contributors are credited above.
514
447
 
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  <div align="center">
2
2
 
3
- <img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/brand/icon-app-128.png" width="76" height="76" alt="dsh-notify-me">
4
-
5
- # dsh-notify-me
3
+ <img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/brand/header.jpg" width="100%" alt="仓库头图:深色桌面上亮起的铃铛标志,标题 dsh-notify-me,副标题 Step away. Stay informed.">
6
4
 
7
5
  **离开 DSH 页面,也能及时知道何时需要回来。**
8
6
 
@@ -15,7 +13,7 @@
15
13
  [![test](https://github.com/chromoany/dsh-notify-me/actions/workflows/test.yml/badge.svg)](https://github.com/chromoany/dsh-notify-me/actions/workflows/test.yml)
16
14
  [![DSH Web and Desktop](https://img.shields.io/badge/DSH-Web%20%7C%20Desktop-blue?style=flat-square)](#安装)
17
15
  [![Package size](https://img.shields.io/npm/unpacked-size/dsh-notify-me?style=flat-square&label=package%20size)](https://www.npmjs.com/package/dsh-notify-me)
18
- [![DSH Compatibility](https://img.shields.io/badge/DSH-%E5%B7%B2%E9%80%82%E9%85%8D%200.2.1--rc.2-6366f1.svg?style=flat-square)](#兼容性)
16
+ [![DSH Compatibility](https://img.shields.io/badge/DSH-%E5%B7%B2%E9%80%82%E9%85%8D%200.2.2--rc.1%20%2F%200.2.1--rc.5-6366f1.svg?style=flat-square)](#兼容性)
19
17
  [![Awesome DSH Plugin](https://awesome-dsh-plugin.com/badge.svg)](https://awesome-dsh-plugin.com)
20
18
 
21
19
  </div>
@@ -26,7 +24,7 @@ DSH Web / Desktop 的通知插件,让你敢不开完整访问,也不必一
26
24
 
27
25
  - **需要你操作时**:审批、方案确认、提问,用通知、提示音和标题标记提醒。
28
26
  - **后台回复完成时**:及时回来查看结果,点击通知可回到对应对话;提醒时机可选「仅后台 / 仅当前对话静默 / 总是提醒」。
29
- - **人走开但窗口没走**:窗口留在最前台、人却离开座位,超过 3 分钟没有输入也算离开,该提醒的照常提醒;收到的那条通知不会在你回来之前自己消失。
27
+ - **人走开但窗口没走**:窗口留在最前台、人却离开座位,超过 3 分钟没有输入也算离开,该提醒的照常提醒;收到的那条通知不会在你回来之前自己消失,一回到页面(点任务栏、Alt+Tab、点通知都算)就收起。
30
28
  - **离开电脑时**:可选转发到 Discord、Bark、Gotify、飞书群机器人、Server酱、WxPusher 或自己的 Webhook。
31
29
  - **连页面都关掉时**:可选让宿主进程兜底——页面不在时宿主继续把「需要你操作」「回复完成」推到你的网关;也可以只开同源中继,让页面够到要认证的网关。两项默认关,配置写在 profile 的 patch 层(见[高级设置](#高级设置)里的「页面关闭后:宿主侧兜底与同源中继」)。
32
30
 
@@ -41,7 +39,7 @@ DSH Web / Desktop 的通知插件,让你敢不开完整访问,也不必一
41
39
  <details>
42
40
  <summary>展开设置界面预览</summary>
43
41
 
44
- ![通知提醒设置页:页眉、提醒方式、什么时候提醒、试一试与折叠的高级设置](https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/screenshots/settings-zh.png)
42
+ ![通知提醒设置页:页眉、提醒方式、什么时候提醒、会话静音、试一试与折叠的高级设置](https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/screenshots/settings-zh.png)
45
43
 
46
44
  只截插件自己的面板(真实组件,与宿主同款深色主题),不带 DSH 左侧导航栏;每行说明在鼠标停在标题文字上时才出现,所以这里只看到标题。
47
45
 
@@ -82,7 +80,7 @@ Web 用户可再测审批按钮,通知上会带「同意 / 拒绝」。桌面
82
80
  window.__dshNotifyMe.test("done") // 「完成」示例
83
81
  window.__dshNotifyMe.test("attention") // 「需要你」示例
84
82
  window.__dshNotifyMe.test("approval") // 桥可用时带「同意 / 拒绝」按钮;否则只发普通通知(桌面端即如此)
85
- window.__dshNotifyMe.debug() // 桥接看 bridge(active = 按钮可用)、抬窗通道 raiseChannel、最近一次尝试 raiseLast、平台拒发原文 lastToastReject、设置是否真存下来 configStored、宿主协调看 hostBridge
83
+ window.__dshNotifyMe.debug() // 桥接看 bridge(active = 按钮可用)、抬窗通道 raiseChannel、最近一次尝试 raiseLast、平台拒发原文 lastToastReject、设置是否真存下来 configStored、宿主协调看 hostBridge;切回页面后收通知看 toastsLive / toastsWithdrawn / lastToastWithdrawAt(还挂着几条 / 累计收起几条 / 最后一次的时间)
86
84
  ```
87
85
 
88
86
  没有测试通知时,先检查:通知权限是否被拒绝(在页面上点一下 → 选「允许」;或地址栏锁 → 站点设置 → 通知 → 允许 → 刷新)、装完没重启 DSH、系统设置里浏览器通知被关。
@@ -124,7 +122,7 @@ dsh-notify-me 把「监督」和「守在屏幕前」解耦:只在真的出现
124
122
  - **窗口在前台时也提醒「需要你」**(默认开):关掉后只有窗口转到后台才提醒;
125
123
  - **当前对话不弹通知**(默认开):正看着的对话里的等待只留标签页标记,人离开后照常补发;
126
124
  - **「回复完成」什么时候提醒**(默认「仅后台」):仅后台 / 仅当前对话静默 / 总是提醒,三选一;
127
- - **通知自动消失**(默认「离开时保留」):离开时保留 / 总是关闭 / 从不关闭,三选一;
125
+ - **通知自动消失**(默认「离开时保留」):离开时保留 / 总是关闭 / 从不关闭,三选一;三种设置只管「时间到点」那一次关闭,你回到页面时残留的通知一律收起;
128
126
  - **子代理会话不提醒**(默认开):跳过后台子代理(subagent)会话,你正开着的那个照常提醒;
129
127
  - **点击通知回到对应对话**(默认开):切到对应对话并把窗口带到前台,Windows 桌面走宿主路由原生抬窗、macOS / Linux 走 `dsh://open` 深链,多个标签页只调起一个。
130
128
 
@@ -134,7 +132,7 @@ dsh-notify-me 把「监督」和「守在屏幕前」解耦:只在真的出现
134
132
  - **后台的判定**:切到别的应用、被别的窗口盖住、最小化都算;窗口一直留在前台但 3 分钟没有任何键鼠输入同样算,`idleMinutes: 0` 退回只看窗口。
135
133
  - **「当前对话不弹通知」何时补发**:窗口转到后台或闲置超时后照常提醒;若你已处理掉就作废。
136
134
  - **「回复完成」三档**:「仅后台」=不在看页面才提醒;「仅当前对话静默」=屏幕上那条静默、别的对话照常提醒,多开对话时有用;「总是提醒」=从不静默。老配置里的「窗口在前台时也提醒『回复完成』」开关自动迁移到这一项。
137
- - **「离开时保留」**:你人在页面前时,普通通知几秒后自己收;人不在时收到的那条留在通知中心等你回来。带「同意 / 拒绝」的通知不设自动撤回,留到你点按钮、回页面把请求答掉、或被新请求顶替为止;桌面端画不出按钮的审批通知按 12 秒收,人不在时同样不撤。
135
+ - **「离开时保留」**:你人在页面前时,普通通知几秒后自己收;人不在时收到的那条留在通知中心等你回来。回到页面(点任务栏、Alt+Tab、点通知、还原最小化的窗口都算)就立刻收起,三种设置都不影响这一条——不看通知中心,也不会被遗留通知挡着。带「同意 / 拒绝」的通知不设自动撤回,留到你点按钮、回页面把请求答掉、或被新请求顶替为止;桌面端画不出按钮的审批通知按 12 秒收,人不在时同样不撤,回到页面同样收起。
138
136
  - **点击通知的兜底**:桌面端抬不起来时只切对话,原因记在 `debug().raiseLast` 里;关掉这一项后点通知不做任何事。
139
137
 
140
138
  </details>
@@ -143,18 +141,21 @@ dsh-notify-me 把「监督」和「守在屏幕前」解耦:只在真的出现
143
141
 
144
142
  适合「后台跑着周期任务、但这次不用管它」的对话:只关掉那一行的提醒,别的照旧。
145
143
 
146
- - **静音**:鼠标移到侧边栏的会话行上,右侧出现铃铛,点一下即静音(按钮读作「静音此会话的提醒」);再点一次恢复;
144
+ - **静音**:鼠标移到侧边栏的会话行上,右侧出现铃铛,点一下即静音(按钮读作「静音此会话的提醒」);再点一次恢复。也可以右键点会话,在菜单里选「静音此会话的提醒」——触摸设备没有悬停条,菜单里这一行就是入口;
147
145
  - **标记**:被静音的对话在标题前显示一个划掉的铃铛(读屏读作「此会话已静音」);
146
+ - **悬停铃铛可以关掉**:设置页「会话静音」卡片顶部的「悬停时显示静音按钮」默认开;关掉后悬停不再出铃铛,未静音的会话改用右键菜单。已静音的会话仍保留这枚铃铛——它既表示状态,点一下就能取消静音;标题前的划掉铃铛不受影响;
148
147
  - **范围**:「需要你」「回复完成」、提示音、标签页标记、外部推送一起关掉;别的对话完全不受影响;「试一试」里的测试按钮照发(它就是用来当场验证渠道的);
149
148
  - **持久化**:列表存在本地,刷新、重启都在;手工改坏的配置会被剪掉而不是让整页失效;
150
149
  - **关掉标签页之后**:静音列表会随心跳交给宿主,所以「页面关闭后的宿主侧兜底」也不会为它推送——否则关掉页面反而开始响。
151
150
 
152
- 设置页「什么时候提醒」下面有一张「会话静音」卡片,显示当前静音了几个对话,可以一键「全部取消静音」。
151
+ 设置页「什么时候提醒」下面有一张「会话静音」卡片,显示当前静音了几个对话,悬停铃铛的开关就在卡片顶部,可以一键「全部取消静音」。
153
152
 
154
153
  <details>
155
154
  <summary>边界条件</summary>
156
155
 
157
156
  - 标记注在宿主的 `sidebar.session.row.leading` 槽位,宿主在「这条会话有运行状态」时用状态点占着这个位置,标记就不渲染——正在跑的后台任务看不到划掉的铃铛,停下后自动回来。静音本身不受影响,通知照旧不发。
157
+ - 右键菜单里那一行注在宿主旧的 `sidebar.workspaces.session.menu.item` 槽位,宿主不声明这个槽位时只是菜单里少一行,悬停铃铛、设置页和静音本身都不受影响。
158
+ - 悬停铃铛关掉后,未静音的会话在行上没有任何静音入口,判断/取消静音都走右键菜单;已静音的会话行尾仍保留按下状态的铃铛。
158
159
  - 静音只看会话 id:重命名、换目录都不影响,删掉的会话留在列表里也不会报错(列表上限 200 条,恢复按钮随时清空)。
159
160
  - 静音不改变「回复完成」的 donePolicy 判定,也不改变「当前对话不弹通知」:两者叠加时以静音为准。
160
161
 
@@ -312,79 +313,11 @@ profile 覆盖示例(`~/.dsh/profiles/<profile>/cordis.patch.yml`)。**`conf
312
313
 
313
314
  ## 兼容性
314
315
 
315
- 逐版本适配记录见 [package.json](package.json) 的 `dsh.compatibility.dshReleases`;当前宿主(`0.2.1-rc.2`)的安装门控只读 `peerDependencies` 与 `engines`,**不再读取这个字段**,所以它只是一份给人看的记录,不构成门禁。
316
-
317
- 已逐版实测**真正激活**于 `0.1.1-rc.2`、`0.1.2-rc.1`、`0.1.5-rc.1`、`0.1.5-rc.2`、`0.2.0-rc.2` 与 `0.2.1-rc.2`(判定标准:插件条目进启动页 `__DSH_BOOT__`、注入依赖解析通过、`/plugins/??dsh-notify-me/client.js&rev=…` 返回含新代码的构建、设置里出现「通知提醒」分区)。`0.1.1-rc.2` 到 `0.2.1-rc.2` 的插件条目照旧兼容,换回旧宿主也不需要改配置;`1.9.0` 的界面重排没有引入新的宿主 API,设置页页眉的铃铛是插件自己画的 SVG(`docs/brand/`)。
318
-
319
- <details>
320
- <summary>展开宿主代际的形状差异与两个已知坑</summary>
321
-
322
- 插件按宿主代际自动选源;下表是各形状的边界,不是门禁:
323
-
324
- | 宿主代际 | 「需要你」交互来源 | 判断当前会话 | 点通知切会话 |
325
- | --- | --- | --- | --- |
326
- | `≤ 0.1.2-alpha.1` | 控制器快照的 `pending[]` | 快照 `current` | `sessions.open()` |
327
- | `0.1.2-alpha.2 .. 0.1.6-alpha.1` | `uiSession.pendingInteractions` | 快照 `current` | `sessions.open()` |
328
- | `≥ 0.1.6-alpha.2`(含 `0.2.0-rc.2`、`0.2.1-rc.2`) | `uiSession.sessionStatus` | `retainedBy.mainView` | `uiWorkspace.openSession()` |
329
-
330
- 区间仅作示意:插件按 store 形状自动选源(`sessionStatus` 存在即走新路),版本号只是各形状的出现边界。`peerDependencies` 范围决定 npm 的 peer 提示——`0.2.1-rc.2` 已落在 `>=0.2.0-rc.1 <0.3.0-0` 里,不需要豁免。
331
-
332
- `0.2.1-rc.2` 另跑了一轮隔离验证:隔离 `DSH_HOME` 起 `dsh web`(70 个启动条目),插件条目排第 59、`application` 批,三个注入目标都在且都排在它前面;`client.js` 返回 1.7.0 源码构建(140,153 B);无头 Chromium 载入后 `apply` 正常执行,`debug()` 报 `uiSession: bound`、`uiSessionSource: sessionStatus`、`bridge: active`。宿主侧形状与 `0.2.0-rc.2` 一致,不需要改代码。
333
-
334
- 两个坑值得记住:一是 `dsh.client.inject` 里列了新版运行时已不再提供的包,客户端条目会停在 `pending (waiting for services: …)` 而永不执行——1.1.3 在 `0.1.2-rc.1` 及以后正是这样失效的;二是宿主换存储或字段名时**不会报错**,提醒只会静默失效——`pendingInteractions`→`sessionStatus`、`list.current`→`retainedBy.mainView`、`sessions.open()`→`uiWorkspace.openSession()` 都是这一类,所以每次适配都要用 `window.__dshNotifyMe.debug()` 确认真的是 `bound`。
335
-
336
- </details>
316
+ 已逐版实测在 `0.1.1-rc.2` 到 `0.2.2-rc.1` 上真正激活,最近的桌面端 `0.2.2-rc.1` 也在其中(判定标准:插件条目进启动页 `__DSH_BOOT__`、注入依赖解析通过、`/plugins/??dsh-notify-me/client.js` 返回含新代码的构建、设置里出现「通知提醒」分区)。逐版适配记录、宿主代际的形状差异与两个会静默失效的坑,见 **[docs/compatibility.md](docs/compatibility.md)**。
337
317
 
338
318
  ## 控制台高级配置
339
319
 
340
- 设置页是第一入口;想脚本化/批量改或恢复默认时,偏好存 `localStorage`(`dshNotifyMe.config`),可用控制台实时调整:
341
-
342
- <details>
343
- <summary>展开控制台 API 与存储说明</summary>
344
-
345
- ```js
346
- window.__dshNotifyMe.config // 查看
347
- window.__dshNotifyMe.setConfig({
348
- enabled: true, // false = 关闭所有提醒(主开关)
349
- language: "auto", // 'auto' 跟随界面 | 'zh' 简体中文 | 'en' English
350
- attentionHiddenOnly: false, // true = 页面可见时「需要你」不提醒
351
- currentHiddenOnly: true, // true = 当前对话的等待只留标题标记(人离开后补发)
352
- donePolicy: "background", // 「回复完成」策略:'background' 仅后台 | 'smart' 仅当前对话静默 | 'always' 总是提醒
353
- idleMinutes: 3, // 超过多少分钟没有键鼠输入算「离开」(0 = 关掉闲置判定)
354
- autoDismiss: "present", // 通知自动消失:'present' 离开时保留 | 'always' 总是关闭 | 'never' 从不关闭
355
- ignoreSubagent: true, // true = 后台子代理(subagent)会话不提醒(当前打开的照常)
356
- mutedSessions: [], // 按对话静音的会话 id 列表(侧边栏铃铛写入,重载后仍在)
357
- sound: true, // 提示音开关(含「系统通知音」模式)
358
- soundDone: "synth", // 「完成」音效来源:'synth' 内置 | 'custom' 自定义文件 | 'system' 系统通知音
359
- soundAttention: "synth", // 「需要你」音效来源,取值同上
360
- volume: 0.5, // 音量 0~1
361
- autoFocus: true, // 点通知回到提醒所属的对话
362
- quickActions: true, // 审批通知上的「同意 / 拒绝」按钮
363
- hostEnv: "auto", // 运行环境:'auto' 自动识别 | 'desktop' 强制桌面端 | 'web' 强制 Web
364
- externalEnabled: false, // 外部通知转发主开关(默认关:不填端点就什么都不发)
365
- externalAttention: true, // 转发「需要你」(触发规则跟本地提醒完全一致)
366
- externalDone: true, // 转发「回复完成」
367
- externalRetryDelays: [2000, 6000], // 可重试失败的退避间隔(毫秒,带抖动;[] = 只发一次)
368
- externalTargets: [] // 推送目标,见下方字段说明
369
- })
370
- // 目标的形状:{id, type, url, secret?, token?, uid?, template?, enabled?}
371
- // type: 'discord' | 'bark' | 'gotify' | 'feishu' | 'serverchan' | 'wxpusher' | 'custom'
372
- // token/uid 只用于 wxpusher(url 固定为官方端点);secret 用于飞书签名与自定义 HMAC 签名;
373
- // template 可选,占位符 {{title}} {{body}} {{event}} {{time}} {{session}};enabled:false 单独停用该目标
374
- window.__dshNotifyMe.resetConfig() // 恢复默认(同时清掉已选的自定义音效文件)
375
- window.__dshNotifyMe.decide("approval:3", "allowed-once") // 程序化裁决:"allowed-once" | "rejected"
376
- window.__dshNotifyMe.testExternal() // 显式外发测试:向有效目标发送,返回 {sent, unverified, failed, statuses}
377
- ```
378
-
379
- > **外部通知测试的开关边界**:设置页「发送测试通知」要求「启用提醒」与「外部通知」主开关开启,但忽略两类提醒的转发开关。控制台 `testExternal()` 是显式测试调用:只要配置了有效目标,即使上述主开关关闭,也会向这些目标发送测试消息;没有有效目标则不发送。普通的 `test("done")` / `test("attention")` / `test("approval")` 只测试本地提醒,不外发。
380
-
381
- > 自定义音效文件不在 `dshNotifyMe.config` 里,而是按类别各存一个键(`dshNotifyMe.sound.done` / `dshNotifyMe.sound.attention`,内容是 `{name, size, data}` 的 data URL)——一个文件转成 data URL 会膨胀约 1.37 倍,塞进配置会拖慢每次读取。`resetConfig()` 会连这两个键一起清掉。
382
- >
383
- > 想确认当前生效的来源,看 `window.__dshNotifyMe.debug()` 的 `soundDone` / `soundAttention` 与 `customSoundDone` / `customSoundAttention`。
384
- >
385
- > `debug().hostBridge` 是宿主协调的只读快照:`state`(`idle` 还没探到;`active` 宿主有兜底、本页正用心跳占住租约;`unavailable` 宿主在但没有兜底,默认安装即如此——路由没注册的 404 也算这一档,不是故障;`error` 宿主答不出可用回包,或被闸门直接拒了)、`leaseMs`(宿主授予的租约,毫秒)、`relayEnabled` 与 `relayPath`(宿主启用了中继时给出它的路径)、`relayUpstreamHost` / `relayUpstreamPath`(中继上游网关的主机名与路径,即会被折叠的那个端点)、`lastReason`(上一次探测失败的原因,如 `bad-host` / `cross-origin` / `http-403`,正常时为 `null`)、`lastProbeAt` / `lastBeaconAt`(最近一次探测与心跳的时间,ISO 字符串或 `null`)。闸门拒绝算 `error` 而不是「未启用」,因为那是能自己修的配置:把本页来源补进 profile 里 `- id: notify-me` 顶层的 `allowedOrigins`。
386
-
387
- </details>
320
+ 设置页是第一入口。想脚本化批量改、恢复默认,或查外部通知目标的字段,见 **[docs/console-config.md](docs/console-config.md)**——完整的配置键、`decide()` / `testExternal()` 接口、外部通知测试的开关边界,以及自定义音效和 `debug().hostBridge` 的读法都在那里。
388
321
 
389
322
  ## 工作原理
390
323
 
@@ -393,7 +326,7 @@ window.__dshNotifyMe.testExternal() // 显式外发测试:向有
393
326
  <details>
394
327
  <summary>展开事件来源与降级说明</summary>
395
328
 
396
- 提醒核心按宿主代际取源(见上表),当前会话一律来自客户端 `sessions` 服务:
329
+ 提醒核心按宿主代际取源(对照表见 [docs/compatibility.md](docs/compatibility.md)),当前会话一律来自客户端 `sessions` 服务:
397
330
 
398
331
  - **当前会话** `SessionSnapshot`:`running` true→false = 回复完成;
399
332
  - **待办交互**:`uiSession` 的 `sessionStatus`(`≥ 0.1.6`,逐会话 `pendingInteraction`)或 `pendingInteractions`(`0.1.2 .. 0.1.5`)出现新 key = 模型在等你,容器里带上审批工具名 / 理由、提问文本;旧宿主回落到控制器快照的 `pending[]`;
@@ -411,7 +344,7 @@ window.__dshNotifyMe.testExternal() // 显式外发测试:向有
411
344
  <details>
412
345
  <summary>展开按钮通知的记账与调窗口</summary>
413
346
 
414
- 每条按钮通知按交互 key 记账,一次只认领一条等待;请求被页面里答掉、或被新请求顶替之后,残留通知上的按钮再点也不会误裁,只是安静地关掉。带按钮的通知不设自动撤回,等你点按钮或把请求答掉才消失;普通通知 5 秒自收,桌面端没有按钮的审批通知 12 秒自收。「通知自动消失」选「从不关闭」时,这两类都不收。没来得及点就回页面里裁决,对话里的审批一直等着你。
347
+ 每条按钮通知按交互 key 记账,一次只认领一条等待;请求被页面里答掉、或被新请求顶替之后,残留通知上的按钮再点也不会误裁,只是安静地关掉。带按钮的通知不设自动撤回,等你点按钮或把请求答掉才消失;普通通知 5 秒自收,桌面端没有按钮的审批通知 12 秒自收。「通知自动消失」选「从不关闭」时,这两类都不因到点而收;三种设置都只管定时器那一次关闭,你回到页面时残留的通知一律收起。没来得及点就回页面里裁决,对话里的审批一直等着你。
415
348
 
416
349
  点正文的「调窗口 + 切对话」也归 worker 这半侧调度:`client.focus()` 只调起一个窗口(优先当前可见的),也只让那个窗口切对话——多个 DSH 标签页不会互相抢焦点或一起乱切。
417
350
 
@@ -480,7 +413,7 @@ npm test # smoke-test(状态机)+ host-route-test(
480
413
  npm pack --dry-run # 预览发布包
481
414
  ```
482
415
 
483
- `smoke/smoke-test.cjs` 是离线状态机测试:三代宿主 + 主开关 + 中英语言用例 + 快捷裁决桥(Service Worker 半侧一并跑)+ 闲置判定与通知自收 + 通知标签长度收口 + 页面侧 host-bridge 探测/心跳/释放与 `debug().hostBridge` 形状。`smoke/host-route-test.mjs` 不需要本机 DSH,`lib/index.js` 的路由、探针与 403/405/501 闸门在任何平台都会跑。
416
+ `smoke/smoke-test.cjs` 是离线状态机测试:三代宿主 + 主开关 + 中英语言用例 + 快捷裁决桥(Service Worker 半侧一并跑)+ 闲置判定与通知自收 + 回到页面即收起残留通知 + 通知标签长度收口 + 页面侧 host-bridge 探测/心跳/释放与 `debug().hostBridge` 形状。`smoke/host-route-test.mjs` 不需要本机 DSH,`lib/index.js` 的路由、探针与 403/405/501 闸门在任何平台都会跑。
484
417
 
485
418
  新增的三个套件同样自带假 `ctx`、不联网、不需要本机 DSH:`smoke/page-bridge-test.mjs` 跑页面桥接路由的状态回包形状、心跳与释放、缺意图头 `403`、跨源 `403`、坏 JSON `400`、超长 `413`,以及 `allowedOrigins` 派生的 `Host`(模拟隧道)放行与路径冲突;`smoke/host-fallback-test.mjs` 跑宿主兜底——审批去重、`turn/end` 节流、子代理跳过、租约新鲜时不发、租约过期后发、`alive:false` 后立刻发、语言跟随心跳、401 后重读凭据、健康探针;`smoke/relay-route-test.mjs` 跑中继——`GET` 探针、`405`、跨源 `403`、`413`、`400`、`503`、`200` / `502` 映射与「401 只重试一次」。
486
419
 
@@ -508,8 +441,18 @@ powershell -NoProfile -File lib/focus-window.ps1 -ProcessId 0 # 末行应是 F
508
441
  | <a href="https://github.com/dunxuan"><img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/contributors/dunxuan.png" width="40" height="40" alt="@dunxuan"></a> | [#20](https://github.com/chromoany/dsh-notify-me/issues/20):当前会话的通知正文用占位符、未取会话标题的报告 |
509
442
  | <a href="https://github.com/unnamed42"><img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/contributors/unnamed42.png" width="40" height="40" alt="@unnamed42"></a> | [#21](https://github.com/chromoany/dsh-notify-me/issues/21) / [#22](https://github.com/chromoany/dsh-notify-me/pull/22):Linux 上 `dsh://open` 抬窗失效的报障与补丁,1.14.4 起 macOS / Linux 恢复深链抬窗 |
510
443
  | <a href="https://github.com/LIEGU0317"><img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/contributors/LIEGU0317.png" width="40" height="40" alt="@LIEGU0317"></a> | [#24](https://github.com/chromoany/dsh-notify-me/issues/24) / [#25](https://github.com/chromoany/dsh-notify-me/pull/25):页面关闭后由宿主兜底推送、同源中继两个可选模块(默认关),含测试与文档 |
444
+ | <a href="https://github.com/ekexium"><img src="https://raw.githubusercontent.com/chromoany/dsh-notify-me/main/docs/contributors/ekexium.png" width="40" height="40" alt="@ekexium"></a> | [#23](https://github.com/chromoany/dsh-notify-me/issues/23):按对话静音的诉求(每会话一个开关、跨重启持久化、会话行上带标记),1.16.0 起支持 |
511
445
 
512
446
  署名口径:本仓库收编外部 PR 时以维护者提交落地——不沿用原 commit、不挂 Co-authored-by,GitHub 的 contributors 图只显示维护者,贡献者以上面的致谢署名。
447
+ ## Star History
448
+
449
+ <a href="https://www.star-history.com/?repos=chromoany%2Fdsh-notify-me&type=timeline&legend=bottom-right">
450
+ <picture>
451
+ <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=chromoany/dsh-notify-me&type=date&theme=dark&legend=bottom-right" />
452
+ <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=chromoany/dsh-notify-me&type=date&legend=bottom-right" />
453
+ <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=chromoany/dsh-notify-me&type=date&legend=bottom-right" />
454
+ </picture>
455
+ </a>
513
456
 
514
457
  ## License
515
458
 
package/lib/client.js CHANGED
@@ -208,6 +208,13 @@
208
208
  // the reminder core, only by the optional Settings page.
209
209
  var React = null;
210
210
  try { React = require("react") || null; } catch (e) { React = null; }
211
+ // The Session menu row uses the host's own menu primitive so it looks like
212
+ // the shipped rows instead of an unstyled button. It is a platform seed
213
+ // module the loader resolves for every Module Loader plugin, not a package
214
+ // dependency (issue #26); a host that does not seed it leaves this null and
215
+ // the row falls back to a local role="menuitem" button.
216
+ var UI_PRIMITIVES = null;
217
+ try { UI_PRIMITIVES = require("@deepseek-ai/dsh-client-ui-primitives") || null; } catch (e) { UI_PRIMITIVES = null; }
211
218
 
212
219
  // ───────────────────────── configuration ─────────────────────────
213
220
  var LS_CONFIG = "dshNotifyMe.config";
@@ -258,6 +265,13 @@
258
265
  // choice, remembered across restarts; ids are opaque host strings and the
259
266
  // list is pruned on read, so a hand-edited config cannot break matching.
260
267
  mutedSessions: [],
268
+ // Whether the row's hover strip carries the mute bell (issue #26). The
269
+ // strip already holds two shipped icons plus ours, and three glyphs over
270
+ // the title read as clutter. Turning it off keeps the state reachable:
271
+ // the right-click menu always offers the switch, this page lists and
272
+ // clears the list, and a muted row keeps its bell — before the title and
273
+ // in the hover strip, where it doubles as "unmute".
274
+ muteRowButton: true,
261
275
  sound: true,
262
276
  // Where each alert's cue comes from (per kind, so "needs you" and "reply
263
277
  // finished" stay independent):
@@ -303,6 +317,20 @@
303
317
  // | 'serverchan' | 'wxpusher' | 'custom'
304
318
  externalTargets: []
305
319
  };
320
+ // Per-session mute limits (see #23). Declared before readConfig() on
321
+ // purpose: readConfig() prunes the stored list while the factory is still
322
+ // evaluating, and a `var` read before its assignment leaves the caps
323
+ // `undefined` — every id fails the `out.length < undefined` guard, the list
324
+ // comes back empty, and a reload silently forgets the mutes until the next
325
+ // settings write happens to re-read the storage.
326
+ var MUTED_MAX = 200;
327
+ var MUTED_ID_MAX = 200;
328
+ // The heartbeat body is capped at 16 KiB by the host, and the stored list
329
+ // can be longer than one beat may carry (200 ids of up to 200 chars is
330
+ // already ~40 KB worst case). Trim what goes on the wire by bytes, keeping
331
+ // the head of the list: a session past the cut still stops its own local
332
+ // alerts, it just is not covered by the host-side fallback.
333
+ var MUTED_BEAT_BUDGET = 8 * 1024;
306
334
  function readConfig() {
307
335
  var cfg = {};
308
336
  try {
@@ -332,6 +360,9 @@
332
360
  // suite, a downgrade) sees what the policy actually does.
333
361
  cfg.doneHiddenOnly = cfg.donePolicy !== "always";
334
362
  cfg.mutedSessions = cleanMutedSessions(cfg.mutedSessions);
363
+ // Only an explicit boolean hides the hover bell; a hand-edited value of
364
+ // another type falls back to the default instead of disabling the row.
365
+ if (typeof cfg.muteRowButton !== "boolean") cfg.muteRowButton = DEFAULTS.muteRowButton;
335
366
  return cfg;
336
367
  }
337
368
  function writeConfig(patch) {
@@ -366,24 +397,19 @@
366
397
  function setConfigLocal(patch) {
367
398
  config = writeConfig(patch);
368
399
  applyTitle();
369
- // A mute-list change is the one setting the host half reads: tell the rows
370
- // and beat right away so the host filters on the new list immediately.
371
- if (patch && "mutedSessions" in patch) notifyMuteChange();
400
+ // A mute-list or hover-bell change is what the rows and the host half
401
+ // read: tell the mounted rows and beat right away so the host filters on
402
+ // the new list immediately. The bell toggle only repaints rows; the extra
403
+ // beat is harmless.
404
+ if (patch && ("mutedSessions" in patch || "muteRowButton" in patch)) notifyMuteChange();
372
405
  return config;
373
406
  }
374
407
 
375
408
  // ─────────────────── per-session mute (see #23) ──────────────────
376
409
  // The list lives in the config JSON on purpose: the sidebar row button has
377
410
  // to keep working after a reload, and the page already rewrites this object
378
- // on every settings change.
379
- var MUTED_MAX = 200;
380
- var MUTED_ID_MAX = 200;
381
- // The heartbeat body is capped at 16 KiB by the host, and the stored list
382
- // can be longer than one beat may carry (200 ids of up to 200 chars is
383
- // already ~40 KB worst case). Trim what goes on the wire by bytes, keeping
384
- // the head of the list: a session past the cut still stops its own local
385
- // alerts, it just is not covered by the host-side fallback.
386
- var MUTED_BEAT_BUDGET = 8 * 1024;
411
+ // on every settings change. Its size caps sit above readConfig() so the
412
+ // boot-time prune can use them (see the note there).
387
413
  function cleanMutedSessions(list) {
388
414
  if (!Array.isArray(list)) return [];
389
415
  var out = [];
@@ -1339,6 +1365,59 @@
1339
1365
  };
1340
1366
  try { console.warn("[dsh-notify-me] toast refused (" + lastToastReject.length + "-char tag): " + message); } catch (e) {}
1341
1367
  }
1368
+ // ─────────── withdrawing what is left over when the user comes back ───────
1369
+ // A toast raised while the page was away is kept on purpose (see the
1370
+ // autoDismiss note in showToast): walking off must never cost an alert.
1371
+ // Nothing used to withdraw it once the user was back, though — it hovered
1372
+ // over the very conversation it was about, or sat in the Action Center,
1373
+ // until its own timer or a click. Getting back to the page always ends in
1374
+ // one of three events (window focus, visibility, the first input after an
1375
+ // idle stretch) whichever route was used: taskbar, alt-tab, clicking the
1376
+ // notification itself, a restored window. All three mean the same thing —
1377
+ // the page is in front of the user again — so they all withdraw the
1378
+ // leftovers. Closing a toast only removes it from the screen: pendingActions
1379
+ // is untouched, so an approval is still answerable in the conversation
1380
+ // (and its answer still closes whatever toast a retry raises).
1381
+ var liveToasts = []; // constructor-path handles: { tag, close }
1382
+ var toastsWithdrawn = 0;
1383
+ var lastToastWithdrawAt = null;
1384
+ var LIVE_TOASTS_LIMIT = 24; // the platform shows far fewer; this is a leak guard
1385
+ function noteToastWithdraw(n) {
1386
+ if (!n) return;
1387
+ toastsWithdrawn += n;
1388
+ lastToastWithdrawAt = new Date().toISOString();
1389
+ }
1390
+ function trackToast(tag, close) {
1391
+ liveToasts.push({ tag: tag, close: close });
1392
+ if (liveToasts.length > LIVE_TOASTS_LIMIT) liveToasts.splice(0, liveToasts.length - LIVE_TOASTS_LIMIT);
1393
+ }
1394
+ function withdrawToasts() {
1395
+ var list = liveToasts;
1396
+ liveToasts = [];
1397
+ for (var i = 0; i < list.length; i++) {
1398
+ try { list[i].close(); } catch (e) {}
1399
+ }
1400
+ noteToastWithdraw(list.length);
1401
+ // The worker path gives no handle back, so ask the registration for its
1402
+ // list: every notification under it is the plugin's own, which also
1403
+ // covers toasts raised before a page reload (this page instance never
1404
+ // held those). Closing is idempotent on both paths.
1405
+ if (swRegistration && typeof swRegistration.getNotifications === "function") {
1406
+ try {
1407
+ var done = function (notes) {
1408
+ var n = (notes || []).length;
1409
+ for (var j = 0; j < n; j++) {
1410
+ try { notes[j].close(); } catch (e) {}
1411
+ }
1412
+ noteToastWithdraw(n);
1413
+ };
1414
+ var r = swRegistration.getNotifications();
1415
+ if (r && typeof r.then === "function") r.then(done, function () {});
1416
+ else done(r);
1417
+ } catch (e) {}
1418
+ }
1419
+ return list.length;
1420
+ }
1342
1421
  function showToast(kind, title, body, sessionId, quick) {
1343
1422
  if (!canToast()) return;
1344
1423
  var tag = quick ? quick.tag : uniqueToastTag(kind);
@@ -1388,6 +1467,9 @@
1388
1467
  silent: !systemCue(kind),
1389
1468
  icon: (location.origin || "") + "/favicon.svg"
1390
1469
  });
1470
+ // The handle is the only way to withdraw this one later; withdrawToasts()
1471
+ // fires whenever the user is back at the page.
1472
+ trackToast(tag, function () { n.close(); });
1391
1473
  if (config.autoFocus) {
1392
1474
  n.onclick = function () {
1393
1475
  focusSession(sessionId);
@@ -2171,7 +2253,13 @@
2171
2253
  try {
2172
2254
  if (typeof document.hasFocus === "function") pageFocused = document.hasFocus() !== false;
2173
2255
  } catch (e) {}
2174
- function onPageFocus() { pageFocused = true; }
2256
+ function onPageFocus() {
2257
+ pageFocused = true;
2258
+ // Back at the page, whatever brought it forward — the taskbar, alt-tab, a
2259
+ // click on the notification itself, or the window being restored. The
2260
+ // alerts kept while away have done their job (see withdrawToasts()).
2261
+ try { withdrawToasts(); } catch (e) {}
2262
+ }
2175
2263
  function onPageBlur() {
2176
2264
  pageFocused = false;
2177
2265
  // Walking away is what re-arms the waits kept quiet because they belonged
@@ -2184,7 +2272,14 @@
2184
2272
  // away too. Everything that keys on away() benefits without changing shape.
2185
2273
  var lastActivityAt = Date.now();
2186
2274
  function noteActivity() {
2275
+ // The other way back, and the one that fires no focus event: the window
2276
+ // never lost focus, its owner simply stopped touching it (idleMinutes).
2277
+ // The first input after that stretch is a return, so it withdraws the
2278
+ // leftovers exactly like onPageFocus() does — read before the clock is
2279
+ // reset, otherwise the stretch has already ended.
2280
+ var returning = idleExpired();
2187
2281
  lastActivityAt = Date.now();
2282
+ if (returning) { try { withdrawToasts(); } catch (e) {} }
2188
2283
  if (!idleTimer) armIdle();
2189
2284
  }
2190
2285
  // Registered from the watchers effect (see apply below) so a client-plugin
@@ -2932,7 +3027,7 @@
2932
3027
  });
2933
3028
  } catch (e) {}
2934
3029
  // keep in sync with package.json "version" on every release
2935
- api.version = "1.16.1";
3030
+ api.version = "1.18.0";
2936
3031
  api.setConfig = function (patch) { return setConfigLocal(patch); };
2937
3032
  api.resetConfig = function () {
2938
3033
  try {
@@ -3084,7 +3179,13 @@
3084
3179
  // #18).
3085
3180
  notifyTagBudget: toastTagBudget(),
3086
3181
  notifyTagLimit: TOAST_TAG_LIMIT,
3087
- lastToastReject: lastToastReject
3182
+ lastToastReject: lastToastReject,
3183
+ // Coming back to the page withdraws the toasts that were kept while
3184
+ // away. Count + timestamp, so "did it close by itself or did I never see
3185
+ // it" is answerable from the page instead of guessed from a screenshot.
3186
+ toastsLive: liveToasts.length,
3187
+ toastsWithdrawn: toastsWithdrawn,
3188
+ lastToastWithdrawAt: lastToastWithdrawAt
3088
3189
  };
3089
3190
  };
3090
3191
  window.__dshNotifyMe = api;
@@ -3222,7 +3323,7 @@
3222
3323
  dpSmart: "仅当前对话静默",
3223
3324
  dpAlways: "总是提醒",
3224
3325
  autoDismiss: "通知自动消失",
3225
- autoDismissHint: "离开电脑时收到的那条,回来还要能看见。选「离开时保留」时只在你看页面时才关掉。",
3326
+ autoDismissHint: "离开电脑时收到的那条会留到你回来。三种设置管的都只是「时间到点」那次关闭;一旦你切回页面(点任务栏、Alt+Tab、点通知都算),残留的通知一律收起。",
3226
3327
  adPresent: "离开时保留",
3227
3328
  adAlways: "总是关闭",
3228
3329
  adNever: "从不关闭",
@@ -3259,7 +3360,9 @@
3259
3360
  offHint: "已关闭提醒:先打开「启用提醒」再测试。",
3260
3361
  storageFailed: "设置没能保存:浏览器拒绝了这次本地存储写入(空间不足或存储被禁用),改动只在当前页面有效,刷新即还原。",
3261
3362
  secMute: "会话静音",
3262
- muteHint: "把鼠标移到侧边栏的会话上,点铃铛就只关掉这一条会话的提醒:被静音的会话在标题前显示划掉的铃铛,正在运行的会话那里被状态点占着,此时看行尾铃铛的按下状态;其它会话照旧提醒。",
3363
+ muteHint: "把鼠标移到侧边栏的会话上点铃铛,或者右键点会话、在菜单里选「静音此会话的提醒」,就只关掉这一条会话的提醒:被静音的会话在标题前显示划掉的铃铛,正在运行的会话那里被状态点占着,此时看行尾铃铛的按下状态;其它会话照旧提醒。",
3364
+ muteRow: "悬停时显示静音按钮",
3365
+ muteRowHint: "关掉后悬停不再显示铃铛,未静音的会话请用右键菜单;已被静音的会话会保留这枚铃铛(提示状态、点一下取消静音),标题前的划掉铃铛也照常显示。",
3263
3366
  muteNone: "还没有静音的会话。",
3264
3367
  muteMuted: "已静音会话数:",
3265
3368
  muteClear: "全部取消静音",
@@ -3397,7 +3500,7 @@
3397
3500
  dpSmart: "Quiet for the open one",
3398
3501
  dpAlways: "Always",
3399
3502
  autoDismiss: "Dismiss the toast automatically",
3400
- autoDismissHint: "An alert that arrived while you were away should still be there when you return. \"Keep while away\" only tidies up while the page is in front.",
3503
+ autoDismissHint: "An alert that arrived while you were away waits for you here. All three options cover the timer only — once you are back at the page (taskbar, Alt-Tab or the notification itself), any leftover toast is withdrawn.",
3401
3504
  adPresent: "Keep while away",
3402
3505
  adAlways: "Always close",
3403
3506
  adNever: "Never close",
@@ -3434,7 +3537,9 @@
3434
3537
  offHint: "Reminders are off: enable them first, then test.",
3435
3538
  storageFailed: "Settings were not saved: the browser refused this local-storage write (quota or storage disabled), so the change lasts only for this page and is gone on reload.",
3436
3539
  secMute: "Muted sessions",
3437
- muteHint: "Hover a session in the sidebar and click the bell to silence just that conversation: a muted session shows a crossed bell before its title — while a session is running that spot holds the status dots, so the hover bell (pressed, struck through) is where the state shows then; other sessions keep alerting.",
3540
+ muteHint: "Hover a session in the sidebar and click the bell — or right-click the session and pick \"Mute alerts for this session\" — to silence just that conversation: a muted session shows a crossed bell before its title — while a session is running that spot holds the status dots, so the hover bell (pressed, struck through) is where the state shows then; other sessions keep alerting.",
3541
+ muteRow: "Show the mute bell on hover",
3542
+ muteRowHint: "Off hides the bell from the hover strip; mute from the right-click menu instead. A muted session keeps its bell (state, plus one click to unmute), and the crossed bell before its title stays either way.",
3438
3543
  muteNone: "No session is muted.",
3439
3544
  muteMuted: "Muted sessions: ",
3440
3545
  muteClear: "Unmute all",
@@ -3609,7 +3714,14 @@
3609
3714
  ".dnm-rowIcon{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;padding:0;border:0;border-radius:4px;background:none;color:var(--dsw-alias-label-tertiary,rgba(120,120,120,.9));cursor:pointer;line-height:0}" +
3610
3715
  ".dnm-rowIcon:hover{color:var(--dsw-alias-label-primary,rgba(20,20,20,.9));background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.14))}" +
3611
3716
  ".dnm-rowIcon.on{color:var(--dsw-alias-label-secondary,rgba(90,90,90,.9))}" +
3612
- ".dnm-rowMark{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none;line-height:0;color:var(--dsw-alias-label-tertiary,rgba(120,120,120,.9))}";
3717
+ ".dnm-rowMark{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none;line-height:0;color:var(--dsw-alias-label-tertiary,rgba(120,120,120,.9))}" +
3718
+ // Fallback Session-menu rows (issue #26) for hosts whose platform bundle
3719
+ // does not seed MenuItemButton; a normal host renders the shipped menu
3720
+ // primitive instead and these two classes stay unused. Sized and coloured
3721
+ // to read like the neighbouring rows inside the host's menu surface.
3722
+ ".dnm-menuItem{display:flex;align-items:center;gap:8px;width:100%;box-sizing:border-box;padding:6px 10px;border:0;border-radius:6px;background:none;color:var(--dsw-alias-label-primary,rgba(20,20,20,.9));font-family:inherit;font-size:13px;line-height:20px;text-align:left;cursor:pointer}" +
3723
+ ".dnm-menuItem:hover{background:var(--dsw-alias-bg-layer-2,rgba(128,128,128,.14))}" +
3724
+ ".dnm-menuIcon{display:inline-flex;align-items:center;justify-content:center;width:14px;height:14px;flex:none;line-height:0;color:var(--dsw-alias-label-tertiary,rgba(120,120,120,.9))}";
3613
3725
  (function injectStyle() {
3614
3726
  try {
3615
3727
  if (typeof document === "undefined" || typeof document.createElement !== "function") return;
@@ -3786,11 +3898,14 @@
3786
3898
  // own action slot (visible on hover) and leaves a mark in its leading slot
3787
3899
  // while the session is muted — the two slots the schedule plugin already
3788
3900
  // injects into, i.e. the cheapest stable place to hang this off (issue #23).
3789
- function sessionMuteIcon(kind) {
3901
+ function sessionMuteIcon(kind, size) {
3902
+ // 14px matches the built-in row-action glyphs; menu rows use the host's
3903
+ // 16px icon box instead (see SessionMuteMenuItem).
3904
+ var px = String(size || 14);
3790
3905
  var base = {
3791
3906
  viewBox: "0 0 16 16",
3792
- width: "14",
3793
- height: "14",
3907
+ width: px,
3908
+ height: px,
3794
3909
  fill: "none",
3795
3910
  stroke: "currentColor",
3796
3911
  strokeWidth: "1.4",
@@ -3823,9 +3938,16 @@
3823
3938
  }, []);
3824
3939
  return isSessionMuted(sessionId);
3825
3940
  }
3941
+ function muteRowButtonEnabled() {
3942
+ return !config || config.muteRowButton !== false;
3943
+ }
3826
3944
  function SessionMuteButton(props) {
3827
3945
  var sid = typeof props.sessionId === "string" ? props.sessionId : "";
3828
3946
  var muted = useSessionMuted(sid);
3947
+ // Issue #26: with the hover bell turned off, only a muted row keeps it —
3948
+ // there it is the state indicator while the session runs (the leading
3949
+ // slot then holds the status dots) and clicking it unmutes.
3950
+ if (!muted && !muteRowButtonEnabled()) return null;
3829
3951
  var labelText = muted ? props.t("unmuteSession") : props.t("muteSession");
3830
3952
  return h("button", {
3831
3953
  type: "button",
@@ -3857,6 +3979,46 @@
3857
3979
  "data-dnm-mute-mark": sid
3858
3980
  }, sessionMuteIcon("off"));
3859
3981
  }
3982
+ // Issue #26: the same switch in the Session context menu, so the hover strip
3983
+ // can stay quiet and touch devices — which never show that strip — still get
3984
+ // the action. The host exposes this as the legacy React menu-row slot; the
3985
+ // shipped MenuItemButton keeps the row looking like its neighbours, and a
3986
+ // plain role="menuitem" button stands in when the primitive is unavailable.
3987
+ function SessionMuteMenuItem(props) {
3988
+ var sid = typeof props.sessionId === "string" ? props.sessionId : "";
3989
+ var muted = useSessionMuted(sid);
3990
+ // The host hands over the shared menu's [open, setOpen] pair as this hook;
3991
+ // closing the menu after acting is what returns focus to the trigger.
3992
+ var openState = null;
3993
+ try {
3994
+ openState = typeof props.useMenuOpenState === "function" ? props.useMenuOpenState() : null;
3995
+ } catch (e) { openState = null; }
3996
+ function closeMenu() {
3997
+ try {
3998
+ if (openState && typeof openState[1] === "function") openState[1](false);
3999
+ } catch (e2) {}
4000
+ }
4001
+ function onSelect(e) {
4002
+ if (e && typeof e.preventDefault === "function") e.preventDefault();
4003
+ if (sid) setSessionMuted(sid, !isSessionMuted(sid));
4004
+ closeMenu();
4005
+ }
4006
+ var labelText = muted ? props.t("unmuteSession") : props.t("muteSession");
4007
+ var iconEl = sessionMuteIcon(muted ? "off" : "on", 16);
4008
+ var MenuItemButton = UI_PRIMITIVES && typeof UI_PRIMITIVES.MenuItemButton === "function"
4009
+ ? UI_PRIMITIVES.MenuItemButton
4010
+ : null;
4011
+ if (MenuItemButton) {
4012
+ return h(MenuItemButton, { separatorBefore: true, icon: iconEl, onSelect: onSelect }, labelText);
4013
+ }
4014
+ return h("button", {
4015
+ type: "button",
4016
+ role: "menuitem",
4017
+ className: "dnm-menuItem",
4018
+ "data-dnm-mute-menu": sid,
4019
+ onClick: onSelect
4020
+ }, h("span", { className: "dnm-menuIcon" }, iconEl), h("span", null, labelText));
4021
+ }
3860
4022
 
3861
4023
  function NotifySettingsView(props) {
3862
4024
  var ctx = props.ctx;
@@ -4426,6 +4588,9 @@
4426
4588
  // is where the list is visible and can be cleared in one click.
4427
4589
  secTitle(t("secMute")),
4428
4590
  card([
4591
+ rowSwitch("muteRowButton", t("muteRow"), t("muteRowHint"), cfg.muteRowButton, function (v) {
4592
+ patch({ muteRowButton: v });
4593
+ }),
4429
4594
  cfg.mutedSessions.length === 0
4430
4595
  ? h("div", { className: "dnm-row" }, [
4431
4596
  h("div", { className: "dnm-rowText" }, [h("div", { className: "dnm-hint" }, t("muteNone"))])
@@ -4680,6 +4845,31 @@
4680
4845
  } catch (e) {
4681
4846
  try { console.warn("[dsh-notify-me] row leading slot unavailable", e); } catch (e2) {}
4682
4847
  }
4848
+ // Issue #26: the same switch in the Session right-click menu. The slot
4849
+ // is the legacy React menu-row list (rendered together before the
4850
+ // built-in Archive row); a host without it simply never calls this
4851
+ // factory, so no new inject entry is needed. Declared last so a host
4852
+ // that rejects it cannot lose the two row affordances above.
4853
+ try {
4854
+ ctx.slots.inject("sidebar.workspaces.session.menu.item", function () {
4855
+ return ctx.slots.register({
4856
+ name: "sidebar.workspaces.session.menu.item",
4857
+ id: "dsh-notify-me-mute-menu",
4858
+ order: 500,
4859
+ locale: NS,
4860
+ inject: function () { return { t: t }; }
4861
+ }, function (ownerProps) {
4862
+ return React.createElement(SessionMuteMenuItem, {
4863
+ sessionId: ownerProps.sessionId,
4864
+ displayTitle: ownerProps.displayTitle,
4865
+ useMenuOpenState: ownerProps.useMenuOpenState,
4866
+ t: t
4867
+ });
4868
+ });
4869
+ });
4870
+ } catch (e) {
4871
+ try { console.warn("[dsh-notify-me] session menu slot unavailable", e); } catch (e2) {}
4872
+ }
4683
4873
  }
4684
4874
  } catch (e) {
4685
4875
  try { console.error("[dsh-notify-me] settings page unavailable", e); } catch (e2) {}
@@ -4698,7 +4888,15 @@
4698
4888
  unsubs.push(sessionsSvc.list.subscribe(onListChanged));
4699
4889
  // A wait kept quiet because it was already on screen still has to
4700
4890
  // reach the user the moment they leave the page.
4701
- var onVisibility = function () { try { flushQuieted(); } catch (e) {} };
4891
+ // Two directions, two jobs: leaving delivers the waits kept quiet only
4892
+ // because their conversation was on screen; coming back withdraws the
4893
+ // toasts raised for them (a restored window reports this, and not
4894
+ // always a focus event). Withdraw first so a toast flushed in the same
4895
+ // tick cannot be closed before it is ever seen.
4896
+ var onVisibility = function () {
4897
+ try { if (!hidden()) withdrawToasts(); } catch (e) {}
4898
+ try { flushQuieted(); } catch (e) {}
4899
+ };
4702
4900
  try { document.addEventListener("visibilitychange", onVisibility); } catch (e) {}
4703
4901
  unsubs.push(function () { try { document.removeEventListener("visibilitychange", onVisibility); } catch (e) {} });
4704
4902
  for (var ai = 0; ai < ACTIVITY_EVENTS.length; ai++) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-notify-me",
3
- "version": "1.16.1",
3
+ "version": "1.18.0",
4
4
  "description": "离开 DSH 页面也能收到提醒:需要你操作 / 后台回复完成时发系统通知、标题标记与提示音,支持审批快捷裁决与外部推送,Web 版与桌面版均可用。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -104,7 +104,11 @@
104
104
  "0.1.5-rc.2": "compatible",
105
105
  "0.2.0-rc.2": "compatible",
106
106
  "0.2.1-rc.2": "compatible",
107
- "0.2.2-alpha.2": "compatible"
107
+ "0.2.1-rc.3": "compatible",
108
+ "0.2.1-rc.4": "compatible",
109
+ "0.2.1-rc.5": "compatible",
110
+ "0.2.2-alpha.2": "compatible",
111
+ "0.2.2-rc.1": "compatible"
108
112
  }
109
113
  }
110
114
  },