@makooo/dsh-session-notifier 0.0.0-stage → 1.0.1
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/LICENSE +21 -0
- package/README.md +70 -2
- package/client.js +1074 -0
- package/cordis.patch.yml +25 -0
- package/icon.svg +5 -0
- package/index.js +601 -0
- package/locale/en.json +6 -0
- package/locale/zh.json +6 -0
- package/package.json +59 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mako-o-o
|
|
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.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @makooo/dsh-session-notifier
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Desktop notifications for DeepSeek Harness sessions: replies, turn completion, session end, approvals, questions, errors and subagent completion — with click-to-session, per-event switches, quiet hours, a privacy switch and a Web Audio tone per event type.
|
|
4
|
+
|
|
5
|
+
DSH 会话系统通知插件。监听会话事件并弹浏览器系统通知;最小化浏览器或切到其他网页时仍可收到。控制入口在**会话标题栏右上角**(排在主题切换器左侧),点开是可视化设置面板。
|
|
6
|
+
|
|
7
|
+
功能参考了 [`bitterSmilezzz/dsh-notify`](https://github.com/bitterSmilezzz/dsh-notify)(MIT)的成熟做法,按本插件「Host 判定 + Client 呈现」的结构重新实现。
|
|
8
|
+
|
|
9
|
+
## 安装
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
dsh plugin --profile web add @makooo/dsh-session-notifier
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
或在 **Plugins → Add plugin** 里填包名安装。安装后刷新页面即可,无需重启。首次使用点铃铛,把「系统通知」打开并允许浏览器通知权限。
|
|
16
|
+
|
|
17
|
+
## 功能
|
|
18
|
+
|
|
19
|
+
- **十类事件分别开关**:助手新回复、轮次完成、会话结束、需要确认、需要回答、会话出错、子代理完成(默认关)、转为空闲(默认关),另有提示音与正文详情两个行为开关,加上免打扰时段。
|
|
20
|
+
- **阻塞类通知不会被顶掉**:需要确认 / 需要回答带 `requireInteraction`,用独立 `tag`,留在通知中心等人处理;后续的信息类通知只顶掉同类。Windows 上关闭一条 toast 会把它从通知中心摘除,混用 tag 会让待办请求凭空消失。
|
|
21
|
+
- **只在看不见时打扰**:页面隐藏(最小化 / 切走)才弹;正在看当前会话时不打扰。阻塞类(确认 / 提问)始终送达。
|
|
22
|
+
- **免打扰时段**:可设起止时间(支持跨午夜),只静音信息类;**审批、提问、出错不受影响**。起止相同视为未配置,坏字符串按「未配置」处理(宁可多提醒)。
|
|
23
|
+
- **隐私开关**:关掉「正文显示详情」后,横幅只显示会话名,工作内容不进通知中心。
|
|
24
|
+
- **按事件分类的合成音效**:Web Notification 无法指定音色,所以用 Web Audio 自己合成——确认/提问上行双音、出错下行小三度、轮次完成单音轻响、会话结束双音下行。全部 ≤0.6s、同类 300ms 节流。
|
|
25
|
+
- **系统声一律静音**:`silent: true` 恒定。打开音效时只响合成音(不叠成双声),关闭音效时是真的静音——不会「关了还响」。
|
|
26
|
+
- **按会话聚合**:同会话的同类通知替换上一张卡,并行会话各自独立;Windows 浏览器上不发 `tag`(该组合带 tag 可能不送达),改由插件显式关闭上一张。
|
|
27
|
+
- **点击回到会话**:聚焦窗口并 `uiWorkspace.openSession()` 跳到对应会话;入口缺失时只聚焦,不报错。
|
|
28
|
+
- **中英文案跟随界面语言**:读官方 locale 设置,Host 只发结构化事实,文案由 Client 组装成当前语言。
|
|
29
|
+
- 面板底部有**「发送测试通知」**:立刻弹一条样例,确认权限/图标/声音。它故意忽略「仅页面隐藏时提醒」,并且和真实通知一样静音系统声,所以试听到的就是实际会听到的。
|
|
30
|
+
|
|
31
|
+
## 限制
|
|
32
|
+
|
|
33
|
+
- 依赖浏览器通知权限;首次点铃铛打开面板,把「系统通知」打开并允许权限。
|
|
34
|
+
- 浏览器必须保持运行;完全关闭浏览器后不会再收到通知。
|
|
35
|
+
- 通知署名是宿主 App(`DeepSeek Harness`),不是插件;在系统通知设置里关掉该来源会静默不弹。
|
|
36
|
+
- 多个客户端同时在线会各弹一次——去重是客户端本地的,跨客户端没有仲裁。
|
|
37
|
+
- SSE 通道与本机 DSH Web GUI 同源,跨机访问不适用。
|
|
38
|
+
|
|
39
|
+
## 配置
|
|
40
|
+
|
|
41
|
+
界面上的设置会持久化到 bundle 行的 `config`(走 `configEditor`);也可以直接写 `cordis.patch.yml`。
|
|
42
|
+
|
|
43
|
+
**写入时序**:`configEditor.edit()` 会调和 profile patch,从而**热重载并重启本插件**。所以 Host 先回 HTTP 响应、再后台持久化——若在响应前 `await` 它,重启会拆掉正在等响应的那条路由,表现为「开关点了没反应」。面板同时在本地先行记录新值,不必等往返才更新。
|
|
44
|
+
|
|
45
|
+
| 字段 | 默认 | 含义 |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| `enabled` | `true` | 总开关(分项值保留) |
|
|
48
|
+
| `notifyAssistant` | `true` | 助手新消息完成 |
|
|
49
|
+
| `notifyTurn` | `true` | 轮次结束 |
|
|
50
|
+
| `notifySessionDone` | `true` | 会话结束(离开运行列表) |
|
|
51
|
+
| `notifyApproval` | `true` | 工具执行等待确认 |
|
|
52
|
+
| `notifyQuestion` | `true` | 会话等待回答 |
|
|
53
|
+
| `notifyError` | `true` | 会话出错 |
|
|
54
|
+
| `notifySubagent` | `false` | 子代理完成 |
|
|
55
|
+
| `notifyIdle` | `false` | 转为空闲 |
|
|
56
|
+
| `sound` | `true` | 合成提示音(关闭即完全静音) |
|
|
57
|
+
| `summary` | `true` | 正文显示详情;关闭后只显示会话名 |
|
|
58
|
+
| `quietHours` | `false` | 免打扰时段开关 |
|
|
59
|
+
| `quietStart` / `quietEnd` | `22:00` / `08:00` | 免打扰起止(支持跨午夜) |
|
|
60
|
+
| `notifyOnlyWhenHidden` | `true` | 只在页面隐藏时弹;`false` 则前台也弹 |
|
|
61
|
+
| `dedupeWindowMs` | `5000` | 同会话同类合并窗口(0–60000ms) |
|
|
62
|
+
| `maxBodyChars` | `96` | 正文最大码点数(20–400) |
|
|
63
|
+
|
|
64
|
+
> 旧字段名 `notifyTurnEnd` 仍可读,会自动映射到 `notifyTurn`。
|
|
65
|
+
|
|
66
|
+
## 接口
|
|
67
|
+
|
|
68
|
+
- `GET /dsh-session-notifier/events` — SSE 通知流
|
|
69
|
+
- `GET /dsh-session-notifier/config` — 读设置与取值范围
|
|
70
|
+
- `POST /dsh-session-notifier/config` — 写设置(白名单键,数值越界钳制,未知键 400)
|
|
71
|
+
- `GET /dsh-session-notifier/ping` — 存活探测
|