dsh-notify-yimit 0.1.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/README.en.md +97 -0
- package/README.md +95 -0
- package/cordis.patch.yml +6 -0
- package/lib/client.js +790 -0
- package/lib/index.js +716 -0
- package/lib/toast-host.ps1 +393 -0
- package/lib/typert.host.js +158 -0
- package/package.json +51 -0
package/README.en.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# dsh-notify-yimit
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="./README.md">简体中文</a>
|
|
5
|
+
/
|
|
6
|
+
<a href="./README.en.md">English</a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
A notification plugin for DeepSeek Harness: alerts you on **task completed / task failed / running (live activity) / awaiting approval / awaiting answer**.
|
|
10
|
+
The notification title is the conversation title; both system and custom notifications support **click-to-jump to the corresponding session**.
|
|
11
|
+
|
|
12
|
+
## Features
|
|
13
|
+
|
|
14
|
+
- **Settings-page integration**: DSH Settings → "Notifications" section (native DSH styling, `--dsw-*` theme variables):
|
|
15
|
+
- Plugin master switch (all other controls are disabled while off);
|
|
16
|
+
- Notification style **segmented control** with three options: **Windows system notifications** / **custom in-app notifications** / **off** (default: off);
|
|
17
|
+
- **Browser picker for jump-to-session** (shown when the style is system or custom; auto-detects installed browsers — Chrome/Edge/Firefox etc.; empty = system default browser; "Jump to session" always opens the browser);
|
|
18
|
+
- Custom notifications: **max simultaneously visible**, **display duration**, and a **per-type background/text color** list
|
|
19
|
+
(done = green, failed = red, running = blue, approval = yellow, question = purple; each customizable);
|
|
20
|
+
- The custom-settings block animates open/closed; system notifications offer one-click permission request.
|
|
21
|
+
- **Trigger scenarios**:
|
|
22
|
+
| Scenario | Notification content |
|
|
23
|
+
|---|---|
|
|
24
|
+
| Task completed | Task completed |
|
|
25
|
+
| Task failed | Task failed (with error message) |
|
|
26
|
+
| Running | Live activity (started / thinking… / generating reply… / executing \<tool\>; toast text updates in place) |
|
|
27
|
+
| Awaiting approval | The concrete approval content (tool name / reason) |
|
|
28
|
+
| Awaiting answer | The concrete question from ask_user_question |
|
|
29
|
+
- **Custom notification = desktop toast (independent of the browser)**: the host plugin spawns a **resident PowerShell + WPF host process** that pops borderless, always-on-top toasts at the **bottom-right** of the screen (multiple toasts stack upward without overlapping). Each toast has a title, body, and **Ignore** / **Jump to session** buttons (10px rounded-rect buttons), colored per type from the config. Done/failed toasts auto-dismiss after the display duration; **running/approval/question toasts stay until their state ends** (turn end / decision made / answer given). Running content is **updated in place** (400ms throttle — no re-spawn, no flicker); approval/question are stateful and **not debounced** (multiple approvals/questions within 2s are never swallowed). Whether the browser page is open or minimized does not matter.
|
|
30
|
+
- **Resident host architecture**: the plugin starts one `powershell` host process (`toast-host.ps1`) on load; WPF is loaded only once and every toast is created inside that process — toast creation latency drops from ~1s cold start to ~10ms. The host receives one JSON command per line on **stdin** (`show`/`text`/`move`/`close`/`shutdown`) and reports `pos`/`exit` on **stdout**; no per-toast process spawn and no ctl/pos file polling.
|
|
31
|
+
- **Jump to session**: clicking a system notification or the toast's "Jump to session" button → **always opens the browser** and navigates to the session (via the URL hash convention `#dsh-notify-yimit/session=<id>`, listened to by the client; optionally with a specific browser).
|
|
32
|
+
- **System notifications**: native browser notifications; clicking one focuses the window and opens the session.
|
|
33
|
+
- **Requirements**: Windows (PowerShell 5.1+, built-in); custom desktop toasts need no extra dependencies.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```sh
|
|
38
|
+
dsh plugin --profile web add <path-to-this-directory>
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Then **restart dsh web** (host-side plugins need a restart) and enable it in Settings → Notifications.
|
|
42
|
+
|
|
43
|
+
> Manual alternative: add `"dsh-notify-yimit": "file:<path-to-this-directory>"` to the `dependencies` of
|
|
44
|
+
> `~/.dsh/profiles/web/package.json`, run `pnpm install`, then restart.
|
|
45
|
+
|
|
46
|
+
### Installing from npm (published package)
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
dsh plugin --profile web add dsh-notify-yimit
|
|
50
|
+
# or manually:
|
|
51
|
+
# ~/.dsh/profiles/web/package.json → dependencies: "dsh-notify": "^0.1.0"
|
|
52
|
+
# ~/.dsh/profiles/web/package.json → dsh.profile.bundles: add "dsh-notify"
|
|
53
|
+
pnpm install # inside the profile
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Then restart `dsh web`.
|
|
57
|
+
|
|
58
|
+
## Structure
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
dsh-notify-yimit/
|
|
62
|
+
├── package.json dsh.bundle.patch + dsh.client.platform: web (client half auto-discovered)
|
|
63
|
+
├── cordis.patch.yml registers the host row (id: dsh-notify-yimit)
|
|
64
|
+
├── lib/index.js host half: config storage + session state machine + event queue + notify service + toast scheduling
|
|
65
|
+
├── lib/toast-host.ps1 resident PowerShell + WPF toast host (stdin commands / stdout reports; all toasts in one process)
|
|
66
|
+
├── lib/typert.host.js Typert host manifest (getState / updateConfig / ackEvents)
|
|
67
|
+
├── lib/client.js client half: "Notifications" settings section + system-notification dispatch + session deep link (hash)
|
|
68
|
+
├── README.md documentation (Chinese)
|
|
69
|
+
└── README.en.md documentation (English)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Data flow
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
host: session/event(turn/start|assistant/chunk|tool/call|turn/end|session/title)
|
|
76
|
+
+ agent/status + approval/request
|
|
77
|
+
→ per-session state machine → dispatch:
|
|
78
|
+
- custom (desktop toasts): one JSON command per line on stdin → resident host (show/text/move/close);
|
|
79
|
+
host reports pos/exit on stdout → host-side adaptive stacking (real heights + 12px gap) and reflow;
|
|
80
|
+
running: 400ms throttle + in-place text updates on activity change; at most N toasts at once;
|
|
81
|
+
approval/question: stateful, no debounce (replace = update, nothing swallowed)
|
|
82
|
+
- system / off: unacknowledged event queue → Typert service (client polls every 250ms)
|
|
83
|
+
client: settings config → dispatch:
|
|
84
|
+
- system → Web Notification (tag replaced per session:type, onclick jumps to session)
|
|
85
|
+
- custom → only acknowledges events (no in-page overlay; desktop toasts are handled by the host)
|
|
86
|
+
- session deep link: listens to #dsh-notify/session=<id> (the toast "Jump to session" channel) → ctx.sessions.open
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Config storage
|
|
90
|
+
|
|
91
|
+
`$DSH_HOME/storages/dsh-notify-yimit/config.json` (atomic write + debounce).
|
|
92
|
+
|
|
93
|
+
## Notes
|
|
94
|
+
|
|
95
|
+
- System notifications require browser notification permission; `127.0.0.1` is a secure context, so it can be requested directly.
|
|
96
|
+
- The plugin is off by default; enable it and pick a style to take effect.
|
|
97
|
+
- Running notifications update their content in real time as activity changes; completed/failed/approval/question are one-shot (stateful ones update in place).
|
package/README.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# dsh-notify-yimit
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="./README.md">简体中文</a>
|
|
5
|
+
/
|
|
6
|
+
<a href="./README.en.md">English</a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
DeepSeek Harness 通知插件:在 **任务完成 / 任务出错 / 运行中 / 等待审批 / 等待回答** 时提醒用户。
|
|
10
|
+
通知标题为对话标题;系统通知与自定义通知均支持**点击跳转到对应会话**。
|
|
11
|
+
|
|
12
|
+
## 功能
|
|
13
|
+
|
|
14
|
+
- **设置页集成**:DSH 设置 → 「通知」分节(符合 DSH 原生样式,`--dsw-*` 主题变量):
|
|
15
|
+
|
|
16
|
+
- 插件总开关(关闭状态下其余设置项全部禁用);
|
|
17
|
+
- 通知方式**分段控制器**三选一:**Windows 系统通知** / **插件自定义样式通知** / **关闭**(默认关闭);
|
|
18
|
+
- **跳转浏览器选择器**(通知方式为系统通知/自定义通知时显示;自动探测本机浏览器,
|
|
19
|
+
可指定 Chrome/Edge/Firefox 等;默认=系统默认浏览器;「跳转会话」始终打开浏览器);
|
|
20
|
+
- 自定义通知:**同时最多显示数量**、**显示时长**,以及**每种通知类型的背景/文字颜色**列表
|
|
21
|
+
(完成=绿、出错=红、运行中=蓝、待审批=黄、待回答=紫,可逐类定制);
|
|
22
|
+
- 自定义设置区块显隐带过渡动画;系统通知可一键申请浏览器通知权限。
|
|
23
|
+
- **触发场景**:
|
|
24
|
+
| 场景 | 通知内容 |
|
|
25
|
+
|---|---|
|
|
26
|
+
| 任务完成 | 任务已完成 |
|
|
27
|
+
| 任务出错 | 任务出错(含错误信息) |
|
|
28
|
+
| 运行中 | 实时活动(开始处理 / 正在思考… / 正在生成回复… / 正在执行 \<工具\>,浮窗内容实时更新) |
|
|
29
|
+
| 等待审批 | 具体的审批内容(工具名 / 原因) |
|
|
30
|
+
| 等待回答 | ask_user_question 的具体问题 |
|
|
31
|
+
- **自定义通知 = 桌面浮窗(不依赖浏览器)**:宿主插件通过**常驻 PowerShell + WPF 宿主进程**
|
|
32
|
+
在屏幕**右下角**弹出无边框置顶浮窗(多浮窗自动向上堆叠不重叠),标题、内容、**忽略**、
|
|
33
|
+
**跳转会话**按钮(按钮为圆角矩形 10px);按通知类型使用对应配置的背景/文字色。完成/出错
|
|
34
|
+
按显示时长后自动消失;**运行中/待审批/待回答在状态结束前不会消失**(任务结束/审批决定/
|
|
35
|
+
回答完成后自动关闭)。运行中内容**原地更新文本**(400ms 节流,不重弹、不闪烁);
|
|
36
|
+
待审批/待回答为状态性通知,**不做防抖**(2s 内多条审批/提问不会被吞)。浏览器页面是否
|
|
37
|
+
打开、是否最小化都不影响通知送达。
|
|
38
|
+
- **常驻宿主架构**:插件加载时启动一个 powershell 宿主进程(toast-host.ps1),WPF 只加载
|
|
39
|
+
一次,所有浮窗在该进程内创建——通知创建延迟从 ~1s 冷启动降到 ~10ms。宿主经 **stdin**
|
|
40
|
+
收一行一个 JSON 命令(`show`/`text`/`move`/`close`/`shutdown`),经 **stdout** 回传
|
|
41
|
+
`pos`/`exit` 报告;不再逐通知 spawn 进程,也没有 ctl/pos 文件轮询。
|
|
42
|
+
- **跳转会话**:系统通知点击 / 自定义浮窗「跳转会话」按钮 → **始终打开浏览器**并定位到该会话
|
|
43
|
+
(通过 URL hash 约定 `#dsh-notify-yimit/session=<id>`,客户端监听后切换;可用所选浏览器打开)。
|
|
44
|
+
- **系统通知**:浏览器原生通知,点击通知即聚焦窗口并打开对应会话。
|
|
45
|
+
- **运行要求**:Windows(PowerShell 5.1+,系统自带);自定义桌面浮窗无需任何额外依赖。
|
|
46
|
+
|
|
47
|
+
## 安装
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
dsh plugin --profile web add <本目录路径>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
然后**重启 dsh web**(host 插件生效需重启),打开 设置 → 通知 开启即可。
|
|
54
|
+
|
|
55
|
+
> 也可以手动方式:在 `~/.dsh/profiles/web/package.json` 的 dependencies 中加入
|
|
56
|
+
> `"dsh-notify-yimit": "file:<本目录路径>"` 后 `pnpm install`,再重启。
|
|
57
|
+
|
|
58
|
+
## 结构
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
dsh-notify-yimit/
|
|
62
|
+
├── package.json dsh.bundle.patch + dsh.client.platform: web(客户端 half 自动发现)
|
|
63
|
+
├── cordis.patch.yml 注册 host 行(id: dsh-notify-yimit)
|
|
64
|
+
├── lib/index.js host half:配置存储 + 会话状态机 + 通知事件队列 + notify 服务 + 桌面浮窗调度
|
|
65
|
+
├── lib/toast-host.ps1 常驻 PowerShell + WPF 浮窗宿主(stdin 命令 / stdout 报告,所有浮窗一个进程)
|
|
66
|
+
├── lib/typert.host.js Typert 宿主清单(getState / updateConfig / ackEvents)
|
|
67
|
+
└── lib/client.js client half:设置页「通知」+ 系统通知调度 + 会话深链接(hash)跳转
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## 数据流
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
host: session/event(turn/start|assistant/chunk|tool/call|turn/end|session/title)
|
|
74
|
+
+ agent/status + approval/request
|
|
75
|
+
→ 每会话状态机 → 分发:
|
|
76
|
+
- custom(桌面浮窗):stdin 一行 JSON 命令 → 常驻宿主(show/text/move/close);
|
|
77
|
+
宿主 stdout 回传 pos/exit → host 自适应堆叠(真实高度 + 12px 间距)并重排;
|
|
78
|
+
运行中按 400ms 节流 + 活动文本变化原地 text 更新;最多 N 个同时显示;
|
|
79
|
+
审批/问答状态性通知免防抖(替换即更新,不吞通知)
|
|
80
|
+
- system / off:未确认事件队列 → Typert 服务(客户端 250ms 轮询)
|
|
81
|
+
client: 设置页「通知」配置 → 分发:
|
|
82
|
+
- system → Web Notification(tag 按 会话:类型 替换,onclick 跳转会话)
|
|
83
|
+
- custom → 只消费回执(不渲染页面内浮层;桌面浮窗由 host 负责)
|
|
84
|
+
- 会话深链接:监听 #dsh-notify/session=<id>(桌面浮窗"跳转会话"通道)→ ctx.sessions.open
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 配置存储
|
|
88
|
+
|
|
89
|
+
`$DSH_HOME/storages/dsh-notify-yimit/config.json`(原子写 + 防抖)。
|
|
90
|
+
|
|
91
|
+
## 说明
|
|
92
|
+
|
|
93
|
+
- 系统通知依赖浏览器通知权限;`127.0.0.1` 属安全上下文,可直接申请。
|
|
94
|
+
- 插件默认关闭,不打扰;开启后选择通知方式生效。
|
|
95
|
+
- 运行中通知在活动变化时实时更新内容;完成/出错/审批/问答为一次性通知。
|
package/cordis.patch.yml
ADDED