dsh-notify-me 1.17.0 → 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,27 @@
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
+
5
26
  ## [1.17.0] — 2026-10-29
6
27
 
7
28
  回到页面,还挂着的通知立刻收起;三种「自动消失」设置从此只约束定时关闭。
@@ -26,7 +47,7 @@ All notable changes to **dsh-notify-me** are documented here.
26
47
 
27
48
  ### 文档
28
49
 
29
- - README 中英同步:顶部特性里的「人走开但窗口没走」补一句回到页面就收起残留通知;「通知自动消失」与「离开时保留」两处改写边界(三种设置只约束定时关闭、回到页面一律收起、不看通知中心也不会被遗留通知挡着);提醒渠道一节补同样的边界;开发自检的测试清单补上这一节。
50
+ - README 中英同步:顶部特性里的「人走开但窗口没走」补一句回到页面就收起残留通知;「通知自动消失」与「离开时保留」两处改写边界(三种设置只约束定时关闭、回到页面一律收起、不看通知中心也不会被遗留通知挡着);提醒渠道一节补同样的边界;开发自检的测试清单补上这一节;控制台 `debug()` 一行补上新增的三个字段(`README.md:85` / `README.en.md:85`)。
30
51
  - `docs/console-config.md` / `docs/console-config.en.md` 的 `autoDismiss` 注释补一句「只管定时关闭」。
31
52
 
32
53
  ## [1.16.1] — 2026-10-28
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.2--alpha.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>
@@ -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.
@@ -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,7 +313,7 @@ This is primarily a **browser-layer** plugin: local toasts, sound and the title
312
313
 
313
314
  ## Compatibility
314
315
 
315
- Every release from `0.1.1-rc.2` through `0.2.2-alpha.2` was tested to actually activate (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)**.
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)**.
316
317
 
317
318
  ## Advanced console configuration
318
319
 
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.2--alpha.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>
@@ -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、系统设置里浏览器通知被关。
@@ -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,7 +313,7 @@ profile 覆盖示例(`~/.dsh/profiles/<profile>/cordis.patch.yml`)。**`conf
312
313
 
313
314
  ## 兼容性
314
315
 
315
- 已逐版实测在 `0.1.1-rc.2` 到 `0.2.2-alpha.2` 上真正激活(判定标准:插件条目进启动页 `__DSH_BOOT__`、注入依赖解析通过、`/plugins/??dsh-notify-me/client.js` 返回含新代码的构建、设置里出现「通知提醒」分区)。逐版适配记录、宿主代际的形状差异与两个会静默失效的坑,见 **[docs/compatibility.md](docs/compatibility.md)**。
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)**。
316
317
 
317
318
  ## 控制台高级配置
318
319
 
@@ -443,6 +444,15 @@ powershell -NoProfile -File lib/focus-window.ps1 -ProcessId 0 # 末行应是 F
443
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 起支持 |
444
445
 
445
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>
446
456
 
447
457
  ## License
448
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 = [];
@@ -3001,7 +3027,7 @@
3001
3027
  });
3002
3028
  } catch (e) {}
3003
3029
  // keep in sync with package.json "version" on every release
3004
- api.version = "1.17.0";
3030
+ api.version = "1.18.0";
3005
3031
  api.setConfig = function (patch) { return setConfigLocal(patch); };
3006
3032
  api.resetConfig = function () {
3007
3033
  try {
@@ -3334,7 +3360,9 @@
3334
3360
  offHint: "已关闭提醒:先打开「启用提醒」再测试。",
3335
3361
  storageFailed: "设置没能保存:浏览器拒绝了这次本地存储写入(空间不足或存储被禁用),改动只在当前页面有效,刷新即还原。",
3336
3362
  secMute: "会话静音",
3337
- muteHint: "把鼠标移到侧边栏的会话上,点铃铛就只关掉这一条会话的提醒:被静音的会话在标题前显示划掉的铃铛,正在运行的会话那里被状态点占着,此时看行尾铃铛的按下状态;其它会话照旧提醒。",
3363
+ muteHint: "把鼠标移到侧边栏的会话上点铃铛,或者右键点会话、在菜单里选「静音此会话的提醒」,就只关掉这一条会话的提醒:被静音的会话在标题前显示划掉的铃铛,正在运行的会话那里被状态点占着,此时看行尾铃铛的按下状态;其它会话照旧提醒。",
3364
+ muteRow: "悬停时显示静音按钮",
3365
+ muteRowHint: "关掉后悬停不再显示铃铛,未静音的会话请用右键菜单;已被静音的会话会保留这枚铃铛(提示状态、点一下取消静音),标题前的划掉铃铛也照常显示。",
3338
3366
  muteNone: "还没有静音的会话。",
3339
3367
  muteMuted: "已静音会话数:",
3340
3368
  muteClear: "全部取消静音",
@@ -3509,7 +3537,9 @@
3509
3537
  offHint: "Reminders are off: enable them first, then test.",
3510
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.",
3511
3539
  secMute: "Muted sessions",
3512
- 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.",
3513
3543
  muteNone: "No session is muted.",
3514
3544
  muteMuted: "Muted sessions: ",
3515
3545
  muteClear: "Unmute all",
@@ -3684,7 +3714,14 @@
3684
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}" +
3685
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))}" +
3686
3716
  ".dnm-rowIcon.on{color:var(--dsw-alias-label-secondary,rgba(90,90,90,.9))}" +
3687
- ".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))}";
3688
3725
  (function injectStyle() {
3689
3726
  try {
3690
3727
  if (typeof document === "undefined" || typeof document.createElement !== "function") return;
@@ -3861,11 +3898,14 @@
3861
3898
  // own action slot (visible on hover) and leaves a mark in its leading slot
3862
3899
  // while the session is muted — the two slots the schedule plugin already
3863
3900
  // injects into, i.e. the cheapest stable place to hang this off (issue #23).
3864
- 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);
3865
3905
  var base = {
3866
3906
  viewBox: "0 0 16 16",
3867
- width: "14",
3868
- height: "14",
3907
+ width: px,
3908
+ height: px,
3869
3909
  fill: "none",
3870
3910
  stroke: "currentColor",
3871
3911
  strokeWidth: "1.4",
@@ -3898,9 +3938,16 @@
3898
3938
  }, []);
3899
3939
  return isSessionMuted(sessionId);
3900
3940
  }
3941
+ function muteRowButtonEnabled() {
3942
+ return !config || config.muteRowButton !== false;
3943
+ }
3901
3944
  function SessionMuteButton(props) {
3902
3945
  var sid = typeof props.sessionId === "string" ? props.sessionId : "";
3903
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;
3904
3951
  var labelText = muted ? props.t("unmuteSession") : props.t("muteSession");
3905
3952
  return h("button", {
3906
3953
  type: "button",
@@ -3932,6 +3979,46 @@
3932
3979
  "data-dnm-mute-mark": sid
3933
3980
  }, sessionMuteIcon("off"));
3934
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
+ }
3935
4022
 
3936
4023
  function NotifySettingsView(props) {
3937
4024
  var ctx = props.ctx;
@@ -4501,6 +4588,9 @@
4501
4588
  // is where the list is visible and can be cleared in one click.
4502
4589
  secTitle(t("secMute")),
4503
4590
  card([
4591
+ rowSwitch("muteRowButton", t("muteRow"), t("muteRowHint"), cfg.muteRowButton, function (v) {
4592
+ patch({ muteRowButton: v });
4593
+ }),
4504
4594
  cfg.mutedSessions.length === 0
4505
4595
  ? h("div", { className: "dnm-row" }, [
4506
4596
  h("div", { className: "dnm-rowText" }, [h("div", { className: "dnm-hint" }, t("muteNone"))])
@@ -4755,6 +4845,31 @@
4755
4845
  } catch (e) {
4756
4846
  try { console.warn("[dsh-notify-me] row leading slot unavailable", e); } catch (e2) {}
4757
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
+ }
4758
4873
  }
4759
4874
  } catch (e) {
4760
4875
  try { console.error("[dsh-notify-me] settings page unavailable", e); } catch (e2) {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-notify-me",
3
- "version": "1.17.0",
3
+ "version": "1.18.0",
4
4
  "description": "离开 DSH 页面也能收到提醒:需要你操作 / 后台回复完成时发系统通知、标题标记与提示音,支持审批快捷裁决与外部推送,Web 版与桌面版均可用。",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -106,7 +106,9 @@
106
106
  "0.2.1-rc.2": "compatible",
107
107
  "0.2.1-rc.3": "compatible",
108
108
  "0.2.1-rc.4": "compatible",
109
- "0.2.2-alpha.2": "compatible"
109
+ "0.2.1-rc.5": "compatible",
110
+ "0.2.2-alpha.2": "compatible",
111
+ "0.2.2-rc.1": "compatible"
110
112
  }
111
113
  }
112
114
  },