@kesike/reminder-dsh 0.2.1 → 0.2.2
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/README.md +35 -40
- package/README.zh-CN.md +32 -120
- package/lib/client.js +49 -21
- package/package.json +2 -2
- package/src/modules/popup/index.js +17 -41
- package/src/modules/popup/open.js +22 -18
- package/src/modules/popup/toast.js +8 -4
package/README.md
CHANGED
|
@@ -1,73 +1,68 @@
|
|
|
1
1
|
# reminder-dsh
|
|
2
2
|
|
|
3
|
-
Windows reminders for DeepSeek Harness,
|
|
3
|
+
Native Windows reminders for DeepSeek Harness (DSH). Completion and approval toasts use the session title, and you can reply or handle an approval from the notification. An optional taskbar badge counts completions while the DSH window is in the background.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
- **Windows system notifications:** show an AI task summary in a native notification banner and Notification Center. The reply field sends a message to the original DSH session.
|
|
5
|
+
DeepSeek Harness 的 Windows 提醒插件。完成和审批通知以会话标题为标题,支持可选 AI 总结、通知内回复和审批,也可以在任务栏显示未查看的完成数。打开 **设置 → 通知** 即可配置。
|
|
7
6
|
|
|
8
|
-
[
|
|
7
|
+
[简体中文安装与使用说明](https://github.com/KeS1Ke/reminder-dsh/blob/main/README.zh-CN.md) · [npm package](https://www.npmjs.com/package/@kesike/reminder-dsh)
|
|
9
8
|
|
|
10
|
-
## Install
|
|
9
|
+
## Install or update / 安装或更新
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
Requirements are Windows 10 or 11 with an interactive desktop session, Node.js 24.9.0 or later, and DSH `>=0.2.2-rc.1 <0.3.0`. Toasts use the built-in Windows PowerShell. The taskbar badge needs PowerShell 7 (`pwsh.exe` on PATH). Both run on the machine hosting the DSH backend.
|
|
13
12
|
|
|
14
13
|
```powershell
|
|
15
|
-
dsh plugin --profile
|
|
16
|
-
dsh --profile web
|
|
14
|
+
dsh plugin --profile desktop add @kesike/reminder-dsh
|
|
17
15
|
```
|
|
18
16
|
|
|
19
|
-
|
|
17
|
+
Restart DSH Desktop after installation or an update. For DSH Web, use the profile that runs your Windows backend, for example `dsh plugin --profile web add @kesike/reminder-dsh`, then restart that backend. For a GitHub install, use `github:KeS1Ke/reminder-dsh` in place of the npm package name.
|
|
20
18
|
|
|
21
|
-
|
|
19
|
+
桌面版执行上面的命令后重启 DSH。Web 版请把 `desktop` 换成实际运行 Windows 后端的 profile。系统通知使用 Windows 自带的 PowerShell,任务栏角标需要 PATH 中有 PowerShell 7。
|
|
22
20
|
|
|
23
|
-
|
|
21
|
+
## Choose what you see
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Open **Settings → Notifications** in DSH.
|
|
26
24
|
|
|
27
|
-
|
|
25
|
+
| Setting | Default | What it controls |
|
|
26
|
+
| --- | --- | --- |
|
|
27
|
+
| Windows system notifications | On | Native completion and approval toasts |
|
|
28
|
+
| Show task summary in notifications | On | A short AI summary of the final answer in completion toasts |
|
|
29
|
+
| Notification interval | 10 seconds | Minimum time between completion toast submissions, from 1 to 300 seconds |
|
|
30
|
+
| Taskbar completion badge | Off | Unread completion count on the DSH taskbar icon |
|
|
31
|
+
| Target window title contains | Blank | Automatic window matching, or a unique title substring you specify |
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
Apply switch changes together with **Save** at the bottom of the page. **Cancel** discards pending switch changes. The title and interval fields have separate save buttons. Saved settings apply without restarting the plugin.
|
|
30
34
|
|
|
31
|
-
|
|
35
|
+
## Notifications and taskbar badge
|
|
32
36
|
|
|
33
|
-
|
|
37
|
+
- **Completion.** A toast follows a successful main-session turn once the session becomes idle. Concurrent completions are queued in order. Subagents, cancelled or failed turns, and restored history are excluded. The session title identifies the conversation, with a configured fallback when no title is available.
|
|
38
|
+
- **AI summary.** The plugin makes an auxiliary request through the session's configured model and asks for a short Chinese summary of its final text reply. It can add model usage. A failed summary falls back to a labeled excerpt. Disable summaries to skip this request.
|
|
39
|
+
- **Quick reply.** Send one reply per completion toast back to its original session within 24 hours while the original session and backend are available.
|
|
40
|
+
- **Approval.** The toast shows the requesting tool and reason. **Allow** grants the current request once and **Reject** declines it. The toast and the in-session card share the same pending approval.
|
|
41
|
+
- **Taskbar badge.** Completed turns increase the count while the target window is in the background. Bringing it to the foreground clears the count. Counts above 99 appear as `99+`. For DSH Web, leave the DSH tab selected in its browser window.
|
|
34
42
|
|
|
35
|
-
|
|
43
|
+
## Opening a session from a toast
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
Click the body of a completion or approval toast to request its original session. The backend keeps the latest click until the focused DSH interface acknowledges it. Version 0.2.2 fixes an inherited Electron environment variable that could prevent `dsh://open` from starting Desktop in GUI mode.
|
|
38
46
|
|
|
39
|
-
|
|
47
|
+
Windows click delivery and foreground activation can still be intermittent. If DSH stays in the background or the session does not switch, open DSH and select the session named in the notification. Test with a fresh toast after upgrading or restarting. Existing toasts can outlive the backend and their local routes.
|
|
40
48
|
|
|
41
|
-
|
|
49
|
+
Windows manages banners and Notification Center. The plugin uses a per-user notification identity and, when it finds DSH Desktop, a per-user Start menu shortcut. Interaction routes run through the plugin's local activator and named pipe.
|
|
42
50
|
|
|
43
|
-
|
|
51
|
+
## Profile configuration and removal
|
|
44
52
|
|
|
45
|
-
|
|
53
|
+
Profile overrides use the `dsh-reminder` entry in `cordis.patch.yml` with separate `popup` and `taskbar` settings. See [example.patch.yml](https://github.com/KeS1Ke/reminder-dsh/blob/main/example.patch.yml). If you are migrating from `@kesike/dsh-taskbar-reminder`, remove that package and rename its `dsh-taskbar-reminder` entry while keeping its configuration. Remove a separate `dsh-winreminder` install if present to prevent duplicate notifications.
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
To remove this plugin, run `dsh plugin --profile desktop remove @kesike/reminder-dsh` with your actual profile name, remove any manual `dsh-reminder` override, and restart DSH.
|
|
48
56
|
|
|
49
|
-
|
|
50
|
-
- `src/modules/popup/`: summaries, submission queue, session-open mailbox and native Windows toast delivery.
|
|
51
|
-
- `src/reminder.js`: shared main-session completion detection and session-title lookup.
|
|
52
|
-
- `lib/client.js`: settings for both modules, using DSH ConfigForms.
|
|
57
|
+
## Development
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
## Validation
|
|
57
|
-
|
|
58
|
-
```sh
|
|
59
|
+
```powershell
|
|
59
60
|
npm ci --ignore-scripts
|
|
60
61
|
npm test
|
|
61
62
|
npm run test:settings-ui
|
|
62
63
|
npm pack --dry-run
|
|
63
64
|
```
|
|
64
65
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
Automated checks include Cordis Loader hot updates, independent module selection, queue scheduling, notification title selection, model-failure handling and subprocess control. The browser check covers the staged switch save/cancel bar, its atomic write and refused writes. Windows-only checks cover the native toast payload and Win32 helper. Notifications are delivered on the Windows backend machine.
|
|
68
|
-
|
|
69
|
-
Publish a release with `npm publish --access public --registry=https://registry.npmjs.org`; the explicit registry is required whenever the configured default is a mirror.
|
|
70
|
-
|
|
71
|
-
## License
|
|
66
|
+
Use `npm run test:popup` for a sample Windows toast and `npm run test:taskbar -- "window title"` for a native badge check. Set `CHROMIUM_PATH` if the settings test needs a specific Chromium executable.
|
|
72
67
|
|
|
73
|
-
|
|
68
|
+
Source and icon licensing are available in the [repository](https://github.com/KeS1Ke/reminder-dsh). The plugin is distributed under [MIT](https://github.com/KeS1Ke/reminder-dsh/blob/main/LICENSE).
|
package/README.zh-CN.md
CHANGED
|
@@ -1,152 +1,64 @@
|
|
|
1
1
|
# reminder-dsh
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
在 Windows 上接收 DeepSeek Harness(DSH)的完成提醒和审批请求。通知带有会话标题,可以直接回复原会话或处理当前审批。需要安静一点时,可以单独使用任务栏角标,查看还有多少完成提醒未读。
|
|
4
4
|
|
|
5
|
-
[English](README.md)
|
|
5
|
+
[English](https://github.com/KeS1Ke/reminder-dsh/blob/main/README.md) · [npm](https://www.npmjs.com/package/@kesike/reminder-dsh)
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## 安装或更新
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
- 系统通知使用 Windows 自带的 `powershell.exe`。任务栏角标需要 PowerShell 7,`pwsh.exe` 须在 PATH 中。
|
|
11
|
-
- Node.js **24.9.0+**,DSH **`>=0.2.2-rc.1 <0.3.0`**。
|
|
12
|
-
|
|
13
|
-
原仓库骨架提到的 DSH `0.1.1-rc.2` 不支持本版采用的动态配置接口,需要升级。实现依据官方源码 [`fcc0ad4`](https://github.com/deepseek-ai/deepseek-harness/tree/fcc0ad462172522aaf5c93a7b2e01f6b9f0b0159)。
|
|
9
|
+
需要 Windows 10/11 本机交互式桌面会话、Node.js 24.9.0+ 和 DSH `>=0.2.2-rc.1 <0.3.0`。系统通知使用 Windows 自带的 `powershell.exe`,任务栏角标需要 PATH 中有 PowerShell 7(`pwsh.exe`)。提醒在 DSH 后端所在的 Windows 机器上出现。
|
|
14
10
|
|
|
15
11
|
```powershell
|
|
16
|
-
|
|
17
|
-
pwsh --version
|
|
18
|
-
|
|
19
|
-
dsh plugin --profile web add @kesike/reminder-dsh
|
|
20
|
-
dsh --profile web
|
|
12
|
+
dsh plugin --profile desktop add @kesike/reminder-dsh
|
|
21
13
|
```
|
|
22
14
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
将 `web` 替换成你实际使用的 profile。首次安装后重启对应 DSH;之后调整提醒开关和间隔无需重启。如果安装 PowerShell 后仍找不到 pwsh,请重启终端和 DSH,使 PATH 更新。
|
|
26
|
-
|
|
27
|
-
包名 `@kesike/reminder-dsh`,配置条目 ID `dsh-reminder`,与 GitHub 仓库名一致。在当前 profile 安装一次即可,不要在每个 agent 里重复安装。
|
|
28
|
-
|
|
29
|
-
### 从旧版本升级
|
|
15
|
+
安装或更新后完全退出并重新打开 DSH Desktop。Web 版请使用实际运行 Windows 后端的 profile,例如 `dsh plugin --profile web add @kesike/reminder-dsh`,然后重启该后端。也可把命令里的包名换成 `github:KeS1Ke/reminder-dsh` 从 GitHub 安装。
|
|
30
16
|
|
|
31
|
-
|
|
17
|
+
## 设置提醒方式
|
|
32
18
|
|
|
33
|
-
|
|
19
|
+
打开 DSH 的 **设置 → 通知**。
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
| 模块 / 字段 | 默认值 | 行为 |
|
|
21
|
+
| 设置 | 默认值 | 用途 |
|
|
38
22
|
| --- | --- | --- |
|
|
39
|
-
| Windows
|
|
40
|
-
|
|
|
41
|
-
|
|
|
42
|
-
|
|
|
43
|
-
|
|
|
44
|
-
|
|
45
|
-
设置使用 DSH 原生 ConfigForm 和 `.volatile()` 动态引用,保存到当前 profile 的配置覆盖层,不重新挂载插件。三个开关只改动页面上显示的值,需点击页面底部的「保存」才写入(所有未保存开关合并为一次原子提交),「取消」丢弃这些改动;保存成功后页面底部短暂显示「已保存」,失败时保留未保存的值并显示错误,可重试或取消。目标窗口标题和通知间隔仍由各自输入框旁的按钮保存。只读配置、上层覆盖或网络错误导致保存被拒绝时,同样显示失败反馈。
|
|
46
|
-
|
|
47
|
-
两个模块独立运行。关闭任务栏角标会立即清除角标并退出后台进程,关闭系统通知会取消尚未发送的提醒和通知上的待决审批操作。重新开启后处理新的完成和审批事件。
|
|
48
|
-
|
|
49
|
-
## 模块一:任务栏完成角标
|
|
50
|
-
|
|
51
|
-
通过 `pwsh` 调用 Windows 任务栏角标接口,在 DSH 窗口任务栏图标的角上显示未查看的完成数量,不抢占焦点。角标与 ChatGPT/Codex 的任务栏角标同款:深色圆底(`#26252D`)+ 白色数字,图标填满 Windows 的任务栏角标槽位(该槽位固定为 16px,ChatGPT 用系统原生角标约 18px,已尽量接近),两位数及以上自动扩展为同高胶囊以放得下数字;位置由 Windows 按任务栏方向决定,横向任务栏在图标右下角,竖排任务栏在图标右上角。
|
|
52
|
-
|
|
53
|
-
每次主会话完成时未查看数加一;多个主会话完成会累计到同一个角标。切回目标窗口(目标窗口成为前台)后角标自动清除,数字同时归零。超过 99 显示 `99+`。已在前台的目标窗口不显示角标。
|
|
54
|
-
|
|
55
|
-
角标后台进程会轮询前台窗口,切回后退出;为防止异常残留,最长保留 2 小时。默认识别标题中的 `DeepSeek Harness`、`DSH` 或 `DSH Local Build` 产品名,优先选择属于当前 DSH 后端进程祖先的匹配窗口。如果只能通过标题找到多个窗口,不会任意选择,而是记录提示,要求设置更具体的目标窗口标题。
|
|
56
|
-
|
|
57
|
-
浏览器使用场景中,DSH 标签页需要是该浏览器窗口当前显示的标签页,窗口本身可以在后台或最小化。若浏览器已经切到别的标签,自动识别通常找不到 DSH;可填写目标窗口标题,但请保证该文字能唯一定位你要提醒的窗口。该模块不能可靠地通过窗口标题区分同名的多个独立 DSH 实例。
|
|
58
|
-
|
|
59
|
-
找不到窗口、匹配不唯一、缺少 pwsh 或系统策略阻止原生调用时,原因会记录在 DSH 日志中。关闭任务栏模块会请求子进程清除角标并退出;进程异常时由超时上限兜底。
|
|
60
|
-
|
|
61
|
-
## 模块二:Windows 系统通知
|
|
62
|
-
|
|
63
|
-
主会话正常结束并进入空闲后,插件以 **DeepSeek Harness** 为发送来源提交原生 Toast。顶部显示应用图标和名称,标题显示会话标题(取不到时使用配置的固定标题);开启任务总结时正文最多显示三行任务总结和快速回复框,关闭后只显示会话标题。
|
|
64
|
-
|
|
65
|
-
点击通知正文会切回 DSH,并打开该通知对应的会话(不是当前停留的会话)。实现方式是通知正文触发本机后台激活:插件先通知后端,GUI 通过长轮询取到会话 ID 并由 `uiWorkspace.openSession` 导航,再启动 `dsh://open` 切回桌面窗口。因此点击跳转要求插件后端仍在运行(与通知上的回复、审批按钮一致);后端已退出时点击不会打开 DSH。横幅外观、显示时间和通知中心收录由 Windows 管理,受系统通知与勿扰设置控制。
|
|
66
|
-
|
|
67
|
-
在通知中输入内容并点击「发送」,Windows 回调会通过本机命名管道将回复交给触发该通知的 DSH 会话。每条通知可回复一次,回复入口在发送后 24 小时内有效,并要求原会话和 DSH 后端仍在运行。遇到回复未确认的提示时,请回到原会话核对后再发送。
|
|
23
|
+
| Windows 系统通知 | 开启 | 接收主会话完成和人工审批的原生通知 |
|
|
24
|
+
| 在通知中显示任务总结 | 开启 | 在完成通知正文中加入简短 AI 总结 |
|
|
25
|
+
| 通知发送间隔 | 10 秒 | 两条完成通知提交给 Windows 的最短间隔,可设 1–300 秒 |
|
|
26
|
+
| Windows 任务栏完成角标 | 关闭 | 在目标窗口的任务栏图标上显示未查看完成数 |
|
|
27
|
+
| 目标窗口标题包含 | 空 | 自动识别 DSH 窗口,或填写能唯一匹配的标题文字 |
|
|
68
28
|
|
|
69
|
-
|
|
29
|
+
修改开关后,点击页底的 **保存** 一次应用,点击 **取消** 丢弃未保存修改。窗口标题和发送间隔各有单独的保存按钮。设置保存到当前 profile 后立即生效。
|
|
70
30
|
|
|
71
|
-
|
|
31
|
+
## 完成、回复和审批
|
|
72
32
|
|
|
73
|
-
|
|
33
|
+
- **完成通知**使用会话标题,取不到标题时用配置的备用标题。主会话正常结束并进入空闲才触发。子会话、失败或取消的轮次以及恢复历史会话均不触发完成提醒。多个完成事件按顺序提交。
|
|
34
|
+
- **AI 任务总结**使用会话当前模型,对最后一轮的最终文字回复生成约 3 行的中文总结,可能产生额外模型用量。总结失败时显示带提示的摘录。关闭总结后跳过这次模型调用。
|
|
35
|
+
- **快速回复**把消息送回发出该通知的会话。每条完成通知可回复一次,入口保留 24 小时,要求原会话及后端仍可用。
|
|
36
|
+
- **人工审批**在通知正文中显示申请工具和原因。「允许」仅授予本次请求一次,「拒绝」驳回本次请求。通知按钮与会话内审批卡片处理的是同一个待决请求。
|
|
37
|
+
- **任务栏角标**在目标窗口位于后台时累加未查看完成数。切回目标窗口后清零,超过 99 显示 `99+`。使用 Web 版时,请让 DSH 标签页保持为该浏览器窗口的当前标签页。
|
|
74
38
|
|
|
75
|
-
|
|
39
|
+
## 点击通知返回会话
|
|
76
40
|
|
|
77
|
-
|
|
41
|
+
点击完成或审批通知正文会请求打开原会话。后端保留最近一次点击,等前台 DSH 界面确认接收。0.2.2 修复了通知激活器继承 Electron Node 模式变量、导致 `dsh://open` 无法正常唤起桌面版的问题。
|
|
78
42
|
|
|
79
|
-
|
|
43
|
+
实际点击仍可能遇到 Windows 回调未送达或窗口未置前。如果没有跳转,请打开 DSH,按通知显示的会话标题找到原会话。更新或重启后请使用新生成的通知,旧通知的跳转和交互入口可能随原后端退出而失效。
|
|
80
44
|
|
|
81
|
-
|
|
45
|
+
横幅和通知中心由 Windows 管理。插件使用当前用户的通知身份,检测到 DSH Desktop 时会创建当前用户的开始菜单快捷方式。通知交互通过本机激活器和命名管道交给插件后端。
|
|
82
46
|
|
|
83
|
-
##
|
|
47
|
+
## 配置文件与卸载
|
|
84
48
|
|
|
85
|
-
|
|
49
|
+
在当前 profile 的 `cordis.patch.yml` 中使用 `dsh-reminder` 条目,分开配置 `popup` 和 `taskbar`。参见 [配置示例](https://github.com/KeS1Ke/reminder-dsh/blob/main/example.patch.yml)。从 `@kesike/dsh-taskbar-reminder` 迁移时,先卸载旧包,将 `dsh-taskbar-reminder` 条目改为 `dsh-reminder` 并保留原配置。如还安装了独立的 `dsh-winreminder`,请移除旧插件以避免重复提醒。
|
|
86
50
|
|
|
87
|
-
|
|
51
|
+
卸载时运行 `dsh plugin --profile desktop remove @kesike/reminder-dsh`,将 `desktop` 替换为实际 profile,移除手工添加的 `dsh-reminder` 配置覆盖,然后重启 DSH。
|
|
88
52
|
|
|
89
|
-
##
|
|
90
|
-
|
|
91
|
-
在当前 profile 的 `cordis.patch.yml` 添加覆盖项:
|
|
92
|
-
|
|
93
|
-
```yaml
|
|
94
|
-
- id: dsh-reminder
|
|
95
|
-
config:
|
|
96
|
-
taskbar:
|
|
97
|
-
enabled: false
|
|
98
|
-
windowTitle: ''
|
|
99
|
-
popup:
|
|
100
|
-
enabled: true
|
|
101
|
-
durationSeconds: 10
|
|
102
|
-
showSummary: true
|
|
103
|
-
title: DSH 任务完成
|
|
104
|
-
message: 主会话已完成本轮任务。
|
|
105
|
-
summaryMaxChars: 60
|
|
106
|
-
summaryTimeoutSeconds: 15
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
`taskbar.enabled`、`taskbar.windowTitle`、`popup.enabled`、`popup.durationSeconds`、`popup.showSummary` 支持热更新。`popup.durationSeconds` 现在表示连续通知的发送间隔。其余为普通配置,修改时遵循插件重载。`summaryMaxChars` 为 20–1000(默认 60,超过 60 的部分仍按 3 行预算截断),`summaryTimeoutSeconds` 为 1–60。
|
|
110
|
-
|
|
111
|
-
## 模块目录
|
|
112
|
-
|
|
113
|
-
```text
|
|
114
|
-
src/index.js 组合两个模块、注册热更新
|
|
115
|
-
src/reminder.js 共用主会话完成检测、读取会话标题
|
|
116
|
-
src/modules/taskbar/ 原生任务栏完成角标、窗口定位、子进程管理
|
|
117
|
-
src/modules/popup/ AI 总结、发送队列、会话跳转、Windows 原生通知
|
|
118
|
-
lib/index.js 兼容原包入口
|
|
119
|
-
lib/client.js DSH 设置界面的两个模块配置
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## 验证与开发
|
|
53
|
+
## 开发验证
|
|
123
54
|
|
|
124
55
|
```powershell
|
|
125
|
-
git clone https://github.com/KeS1Ke/reminder-dsh.git
|
|
126
|
-
cd reminder-dsh
|
|
127
56
|
npm ci --ignore-scripts
|
|
128
57
|
npm test
|
|
129
58
|
npm run test:settings-ui
|
|
130
|
-
npm run
|
|
131
|
-
npm run test:taskbar
|
|
59
|
+
npm pack --dry-run
|
|
132
60
|
```
|
|
133
61
|
|
|
134
|
-
`test:popup`
|
|
135
|
-
|
|
136
|
-
自动测试覆盖真实 Cordis Loader 动态更新、模块独立开关、排队和间隔重算、摘要回退、通知标题取值及子进程行为。chromium 测试通过测试夹具验证「通知」注册、铃铛图标、开关的底部保存/取消与原子写入、输入框反馈和保存失败处理,可用 `CHROMIUM_PATH` 指定浏览器。Windows 专用测试验证原生通知载荷和 Win32 辅助代码。
|
|
137
|
-
|
|
138
|
-
提醒发生在 **DSH 后端所在 Windows 机器**。WSL/Linux 后端、远程 Windows 浏览器连接到别处后端、Windows 服务或无人登录会话不保证有可见提醒。
|
|
139
|
-
|
|
140
|
-
发布:`npm publish --access public --registry=https://registry.npmjs.org`。若本机默认 registry 是镜像,必须显式指定官方源。
|
|
141
|
-
|
|
142
|
-
## 卸载
|
|
143
|
-
|
|
144
|
-
```powershell
|
|
145
|
-
dsh plugin --profile web remove @kesike/reminder-dsh
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
删除手工添加的 `id: dsh-reminder` 覆盖项并重启 DSH。
|
|
149
|
-
|
|
150
|
-
## 许可证
|
|
62
|
+
在 Windows 上用 `npm run test:popup` 发送测试通知,或用 `npm run test:taskbar -- "窗口标题"` 检查角标。设置页浏览器测试可通过 `CHROMIUM_PATH` 指定 Chromium。
|
|
151
63
|
|
|
152
|
-
插件代码采用 [MIT](LICENSE)
|
|
64
|
+
插件代码采用 [MIT](https://github.com/KeS1Ke/reminder-dsh/blob/main/LICENSE) 许可证,图标来源及许可见 [资源说明](https://github.com/KeS1Ke/reminder-dsh/blob/main/assets/README.md)。
|
package/lib/client.js
CHANGED
|
@@ -67,28 +67,58 @@ window.__ModuleLoader__.load({
|
|
|
67
67
|
} catch { return undefined }
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if (
|
|
70
|
+
/** A background page cannot consume a click intended for the DSH window brought to the front. */
|
|
71
|
+
function followSessionOpens(workspace, endpoint) {
|
|
72
|
+
const lifetime = new AbortController()
|
|
73
|
+
const foreground = () => document.visibilityState === 'visible' && document.hasFocus()
|
|
74
|
+
let poll, acknowledgedId
|
|
75
|
+
|
|
76
|
+
async function watch(signal) {
|
|
77
|
+
const url = new URL(endpoint)
|
|
78
|
+
let failures = 0
|
|
79
|
+
while (!signal.aborted) {
|
|
80
|
+
try {
|
|
81
|
+
if (acknowledgedId) url.searchParams.set('ack', acknowledgedId)
|
|
82
|
+
const response = await fetch(url.href, { signal, credentials: 'same-origin', cache: 'no-store' })
|
|
83
|
+
if (!response.ok) throw new Error(`session-open route ${response.status}`)
|
|
84
|
+
if (response.status === 200) {
|
|
85
|
+
const value = await response.json()
|
|
86
|
+
if (signal.aborted || !foreground()) return
|
|
87
|
+
if (typeof value?.id !== 'string' || typeof value.sessionId !== 'string' || !value.sessionId) {
|
|
88
|
+
throw new Error('Invalid session-open response')
|
|
89
|
+
}
|
|
90
|
+
// A notification outlives its session: opening an id DSH no longer knows must not stop the poll.
|
|
82
91
|
try { workspace.openSession(value.sessionId) } catch {}
|
|
92
|
+
acknowledgedId = value.id
|
|
83
93
|
}
|
|
94
|
+
failures = 0
|
|
95
|
+
} catch {
|
|
96
|
+
if (signal.aborted) return
|
|
97
|
+
const delay = Math.min(10_000, 500 * 2 ** Math.min(++failures, 5))
|
|
98
|
+
await new Promise(resolve => {
|
|
99
|
+
const done = () => { clearTimeout(timer); signal.removeEventListener('abort', done); resolve() }
|
|
100
|
+
const timer = setTimeout(done, delay)
|
|
101
|
+
signal.addEventListener('abort', done, { once: true })
|
|
102
|
+
})
|
|
84
103
|
}
|
|
85
|
-
} catch {
|
|
86
|
-
if (signal.aborted) return
|
|
87
|
-
failures += 1
|
|
88
|
-
delay = Math.min(30_000, 1000 * 2 ** Math.min(failures, 5))
|
|
89
104
|
}
|
|
90
|
-
if (delay) await new Promise(resolve => setTimeout(resolve, delay))
|
|
91
105
|
}
|
|
106
|
+
|
|
107
|
+
function update() {
|
|
108
|
+
if (!foreground()) {
|
|
109
|
+
poll?.abort()
|
|
110
|
+
poll = undefined
|
|
111
|
+
} else if (!poll) {
|
|
112
|
+
const current = new AbortController()
|
|
113
|
+
poll = current
|
|
114
|
+
void watch(current.signal).finally(() => { if (poll === current) poll = undefined })
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
window.addEventListener('focus', update, { signal: lifetime.signal })
|
|
118
|
+
window.addEventListener('blur', update, { signal: lifetime.signal })
|
|
119
|
+
document.addEventListener('visibilitychange', update, { signal: lifetime.signal })
|
|
120
|
+
update()
|
|
121
|
+
return () => { lifetime.abort(); poll?.abort() }
|
|
92
122
|
}
|
|
93
123
|
|
|
94
124
|
const buttonStyle = { padding: '6px 12px', borderRadius: 6, border: '1px solid currentColor', background: 'transparent', color: 'inherit', cursor: 'pointer' }
|
|
@@ -214,11 +244,9 @@ window.__ModuleLoader__.load({
|
|
|
214
244
|
ctx.inject(['uiWorkspace'], scope => {
|
|
215
245
|
const workspace = scope.get('uiWorkspace')
|
|
216
246
|
if (!workspace || typeof workspace.openSession !== 'function') return
|
|
217
|
-
const endpoint = hostRoute('reminder-dsh/session-open')
|
|
247
|
+
const endpoint = hostRoute('api/reminder-dsh/session-open')
|
|
218
248
|
if (!endpoint) return
|
|
219
|
-
|
|
220
|
-
void watchSessionOpen(workspace, endpoint, controller.signal)
|
|
221
|
-
return () => controller.abort()
|
|
249
|
+
return followSessionOpens(workspace, endpoint)
|
|
222
250
|
})
|
|
223
251
|
const inject = () => ({
|
|
224
252
|
hooks: { preferences: form },
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kesike/reminder-dsh",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Windows
|
|
3
|
+
"version": "0.2.2",
|
|
4
|
+
"description": "Windows completion and approval toasts, quick replies, and an optional taskbar badge for DeepSeek Harness · DSH 的 Windows 完成与审批通知、通知内回复和可选任务栏角标",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"exports": {
|
|
@@ -17,47 +17,23 @@ export const Config = Schema.object({
|
|
|
17
17
|
summaryTimeoutSeconds: Schema.number().min(1).max(60).step(1).default(15).description('AI 总结超时秒数'),
|
|
18
18
|
})
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* The GUI long-polls this route and navigates to the session a clicked toast belongs to.
|
|
22
|
-
* Registered only where the host owns a web server and connection trust (the web/desktop app).
|
|
23
|
-
*/
|
|
20
|
+
/** DSH's Fetch router admits only authenticated owner peers and forwards request cancellation. */
|
|
24
21
|
function attachSessionOpenRoute(ctx, requests, logger) {
|
|
25
|
-
ctx.inject(['
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (request.method !== 'GET') {
|
|
41
|
-
response.writeHead(405)
|
|
42
|
-
response.end()
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
const sessionId = await requests.take()
|
|
46
|
-
if (sessionId === undefined) {
|
|
47
|
-
response.writeHead(204)
|
|
48
|
-
response.end()
|
|
49
|
-
return
|
|
50
|
-
}
|
|
51
|
-
response.writeHead(200, { 'content-type': 'application/json', 'cache-control': 'no-store' })
|
|
52
|
-
response.end(JSON.stringify({ sessionId }))
|
|
53
|
-
},
|
|
54
|
-
})
|
|
55
|
-
} catch (error) {
|
|
56
|
-
// Session jumps are a convenience: never let a route conflict break reminders.
|
|
57
|
-
logger.warn(`会话跳转路由不可用:${error instanceof Error ? error.message : String(error)}`)
|
|
58
|
-
return () => {}
|
|
59
|
-
}
|
|
60
|
-
}, 'reminder-dsh: session open route')
|
|
22
|
+
ctx.inject(['connection'], scope => {
|
|
23
|
+
try {
|
|
24
|
+
return scope.connection.fetch.register({
|
|
25
|
+
path: '/api/reminder-dsh/session-open', methods: ['GET'], requestBody: 'buffered',
|
|
26
|
+
async fetch(request) {
|
|
27
|
+
const acknowledgedId = new URL(request.url).searchParams.get('ack')
|
|
28
|
+
const open = await requests.take(acknowledgedId, request.signal)
|
|
29
|
+
const headers = { 'cache-control': 'no-store' }
|
|
30
|
+
return open ? Response.json(open, { headers }) : new Response(null, { status: 204, headers })
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
} catch (error) {
|
|
34
|
+
// Keep sending reminders when the host's session navigation route is unavailable.
|
|
35
|
+
logger.warn(`会话跳转路由不可用:${error instanceof Error ? error.message : String(error)}`)
|
|
36
|
+
}
|
|
61
37
|
})
|
|
62
38
|
}
|
|
63
39
|
|
|
@@ -98,6 +74,6 @@ export function createPopupModule(ctx, config, notifier = createWindowsToast(con
|
|
|
98
74
|
if (!config.enabled.get()) approvals.abort()
|
|
99
75
|
else if (approvals.signal.aborted) approvals = new AbortController()
|
|
100
76
|
},
|
|
101
|
-
dispose() { queue.dispose(); approvals.abort(); notifier.dispose() },
|
|
77
|
+
dispose() { queue.dispose(); approvals.abort(); opens.dispose(); notifier.dispose() },
|
|
102
78
|
}
|
|
103
79
|
}
|
|
@@ -1,33 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
2
|
+
|
|
3
|
+
/** Keep the latest toast click until the focused GUI has opened its session. */
|
|
2
4
|
export function createSessionOpenRequests({ timeoutMs = 25_000 } = {}) {
|
|
3
|
-
let pending
|
|
5
|
+
let pending, disposed = false
|
|
4
6
|
const waiters = new Set()
|
|
5
7
|
|
|
6
8
|
return {
|
|
7
9
|
request(sessionId) {
|
|
8
|
-
if (typeof sessionId !== 'string' || sessionId === '') return
|
|
9
|
-
pending = sessionId
|
|
10
|
-
for (const waiter of
|
|
10
|
+
if (disposed || typeof sessionId !== 'string' || sessionId === '') return
|
|
11
|
+
pending = { id: randomUUID(), sessionId }
|
|
12
|
+
for (const waiter of waiters) waiter(pending)
|
|
11
13
|
},
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (pending
|
|
15
|
-
|
|
16
|
-
pending = undefined
|
|
17
|
-
return Promise.resolve(sessionId)
|
|
18
|
-
}
|
|
14
|
+
take(acknowledgedId, signal) {
|
|
15
|
+
if (disposed || signal?.aborted) return Promise.resolve()
|
|
16
|
+
if (pending?.id === acknowledgedId) pending = undefined
|
|
17
|
+
if (pending) return Promise.resolve(pending)
|
|
19
18
|
return new Promise(resolve => {
|
|
20
|
-
|
|
21
|
-
const settle = () => {
|
|
19
|
+
const settle = value => {
|
|
22
20
|
clearTimeout(timer)
|
|
23
21
|
waiters.delete(settle)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
resolve(sessionId)
|
|
22
|
+
signal?.removeEventListener('abort', abort)
|
|
23
|
+
resolve(value)
|
|
27
24
|
}
|
|
25
|
+
const abort = () => settle()
|
|
26
|
+
const timer = setTimeout(abort, timeoutMs)
|
|
28
27
|
waiters.add(settle)
|
|
29
|
-
|
|
28
|
+
signal?.addEventListener('abort', abort, { once: true })
|
|
30
29
|
})
|
|
31
30
|
},
|
|
31
|
+
dispose() {
|
|
32
|
+
disposed = true
|
|
33
|
+
pending = undefined
|
|
34
|
+
for (const waiter of waiters) waiter()
|
|
35
|
+
},
|
|
32
36
|
}
|
|
33
37
|
}
|
|
@@ -7,16 +7,19 @@ const scriptPath = fileURLToPath(new URL('./toast.ps1', import.meta.url))
|
|
|
7
7
|
const activatorPath = fileURLToPath(new URL('./activate.ps1', import.meta.url))
|
|
8
8
|
const powershell = win32.join(process.env.SystemRoot ?? 'C:\\Windows', 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe')
|
|
9
9
|
|
|
10
|
-
export function createWindowsToast(config, launch = execFile) {
|
|
10
|
+
export function createWindowsToast(config, launch = execFile, launchActivator = spawn) {
|
|
11
11
|
const lifetime = new AbortController()
|
|
12
12
|
const replies = createToastReplies()
|
|
13
13
|
let activator
|
|
14
14
|
|
|
15
15
|
function startActivator() {
|
|
16
16
|
if (activator) return activator.ready
|
|
17
|
-
const
|
|
17
|
+
const env = { ...process.env }
|
|
18
|
+
// Desktop Host runs Electron as Node. The activator must launch dsh://open in GUI mode.
|
|
19
|
+
delete env.ELECTRON_RUN_AS_NODE
|
|
20
|
+
const child = launchActivator(powershell, [
|
|
18
21
|
'-NoLogo', '-NoProfile', '-NonInteractive', '-MTA', '-ExecutionPolicy', 'Bypass', '-File', activatorPath,
|
|
19
|
-
], { windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] })
|
|
22
|
+
], { env, windowsHide: true, stdio: ['pipe', 'pipe', 'pipe'] })
|
|
20
23
|
const ready = new Promise((resolve, reject) => {
|
|
21
24
|
let stdout = '', stderr = ''
|
|
22
25
|
const timer = setTimeout(() => {
|
|
@@ -64,7 +67,8 @@ export function createWindowsToast(config, launch = execFile) {
|
|
|
64
67
|
let sent = false
|
|
65
68
|
try {
|
|
66
69
|
if (onOpen) {
|
|
67
|
-
|
|
70
|
+
// Keep the jump available while the notification sits in the action center, even after this turn ended.
|
|
71
|
+
const open = await replies.registerOpen(onOpen, lifetime.signal)
|
|
68
72
|
if (!open) return
|
|
69
73
|
routes.push(open)
|
|
70
74
|
// The body click is a background activation: it notifies this process, then opens the app.
|