@idoall/dsh-notify 0.3.1 → 0.3.3
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 +32 -0
- package/README.md +22 -15
- package/README.zh.md +22 -15
- package/dist/client.js +8 -2
- package/dist/index.js +95 -24
- package/package.json +18 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,36 @@ All notable changes to this project are documented here. The format follows [Kee
|
|
|
4
4
|
|
|
5
5
|
## [Unreleased]
|
|
6
6
|
|
|
7
|
+
## [0.3.3] - 2026-09-24
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- **Adapted to DeepSeek Harness `0.1.7-rc.1`.** Background-job completions now subscribe to the consolidated `jobs.events` stream (`settled`, unawaited only) instead of the removed `onJobDone` listener. Tool-result settlement reads `message.toolCallId` / `message.isError` on the flattened tool-role message. In-toast answers read the unified `uiSession.sessionStatus` snapshot, where the answerable interaction is nested under `pendingInteraction`.
|
|
12
|
+
- **Declared DSH compatibility as a load-time requirement.** `dsh.manifestVersion`, `dsh.engines.dsh`, and every `@deepseek-ai/dsh-*` peer now state `>=0.1.7-rc.1 <0.2.0`, so DSH 0.1.7-rc.1 can refuse an incompatible bundle at profile load. `@deepseek-ai/schemastery` moves from a plain dependency to a peer (with a matching devDependency) so a `link:` install resolves it from the running installation.
|
|
13
|
+
|
|
14
|
+
### Verified
|
|
15
|
+
|
|
16
|
+
- Host jobs coverage confirms the 0.1.7 event stream, awaited settlements stay silent, and the pre-0.1.7 `onJobDone` listener remains a fallback.
|
|
17
|
+
- Flattened `tool/result` messages close the matching interaction; a nested pre-0.1.7 `tool-result` block still does.
|
|
18
|
+
- Client pending-interaction coverage reads both the 0.1.7 Session status snapshot and the older map.
|
|
19
|
+
- Live `link:` install on DSH `0.1.7-rc.1` hot-mounted without restarting: Host routes answered, the client bundle registered, **Settings → Notifications** rendered, and a four-tone self-test produced the collapsed overlay stack above the settings modal.
|
|
20
|
+
- Full verification passed: static source checks, **86 automated tests**, build, and package precondition checks.
|
|
21
|
+
|
|
22
|
+
## [0.3.2] - 2026-09-20
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **Completion now follows DSH's native idle state.** A completed Toast is not emitted when a response first appears or after an arbitrary timer. `turn/end` only creates a candidate; the card is delivered when the owning Agent reports `agent/status: idle`, the same state that stops the native session-tree spinner. A new `running` transition cancels an earlier candidate, so goal continuation, queued work, and tool follow-ups cannot announce completion too early or strand a missing notification.
|
|
27
|
+
- **One continuous task receives one green completion card.** Plan reviews and execution approvals are control gates, not finished tasks. Their transient idle pause no longer adds a green Toast before the user decides and the task resumes; the later non-interactive work turn is the sole completion delivery. This removes the duplicate same-session “任务完成” cards that could appear seconds apart after approval or plan review.
|
|
28
|
+
- **A direct answer no longer loses completion.** Ordinary `ask_user_question` is intentionally distinguished from a plan review or execution approval. When the user answer itself finishes a task and no follow-up turn starts, the native-idle transition still sends exactly one green completion Toast. If work resumes, the pending candidate is cancelled and the final work turn remains the only notification.
|
|
29
|
+
|
|
30
|
+
### Verified
|
|
31
|
+
|
|
32
|
+
- Host lifecycle regression coverage confirms a completion is withheld while DSH is native `running` and emitted exactly once only after native `idle`.
|
|
33
|
+
- A plan-review pause followed by its approved work emits one completion card, not two.
|
|
34
|
+
- An ordinary question whose answer directly finishes work emits one completion card rather than none.
|
|
35
|
+
- Full verification passed: static source checks, **84 automated tests**, build, and package precondition checks.
|
|
36
|
+
|
|
7
37
|
## [0.3.1] - 2026-09-20
|
|
8
38
|
|
|
9
39
|
### Fixed
|
|
@@ -168,6 +198,8 @@ First public release. Verified against DeepSeek Harness `0.1.5-rc.1`.
|
|
|
168
198
|
|
|
169
199
|
- Browser system notifications (channel B), host OS notifications (channel C) and web push / service worker (channel D), along with the `web-push` and `ipaddr.js` dependencies. Those channels failed invisibly (submitted but never seen) and could not be made reliable across browsers and operating systems.
|
|
170
200
|
|
|
201
|
+
[0.3.2]: https://github.com/idoall/dsh-notify/releases/tag/v0.3.2
|
|
202
|
+
[0.3.1]: https://github.com/idoall/dsh-notify/releases/tag/v0.3.1
|
|
171
203
|
[0.3.0]: https://github.com/idoall/dsh-notify/releases/tag/v0.3.0
|
|
172
204
|
[0.2.3]: https://github.com/idoall/dsh-notify/releases/tag/v0.2.3
|
|
173
205
|
[0.2.2]: https://github.com/idoall/dsh-notify/releases/tag/v0.2.2
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<a href="https://github.com/idoall/dsh-notify/actions/workflows/ci.yml"><img src="https://github.com/idoall/dsh-notify/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/@idoall/dsh-notify"><img src="https://img.shields.io/npm/v/@idoall/dsh-notify?label=npm&color=CB3837" alt="npm version"></a>
|
|
8
8
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-0F172A" alt="MIT"></a>
|
|
9
|
-
<img src="https://img.shields.io/badge/DSH-0.1.
|
|
9
|
+
<img src="https://img.shields.io/badge/DSH-0.1.7--rc.1-4B6BFB" alt="DSH 0.1.7-rc.1">
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">English | <a href="README.zh.md">中文</a></p>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
> DSH Notify is a DeepSeek Harness community plugin. It registers only a settings section and an in-page overlay; it does not modify DSH source.
|
|
24
24
|
|
|
25
|
-
When a session really stops, fails, asks a question, or needs approval, a card appears in the top-right corner of the current page. Intermediate goal rounds and queued follow-up turns stay quiet. Everything happens in the page you already have open: there is no service worker, web push, host OS notification, or notification history.
|
|
25
|
+
When a session really stops, fails, asks a question, or needs approval, a card appears in the top-right corner of the current page. A green **Task completed** card follows DSH's native `agent/status: idle` transition — the same state that stops the session-tree spinner — rather than the earlier moment when text first looks complete. Intermediate goal rounds and queued follow-up turns stay quiet. Everything happens in the page you already have open: there is no service worker, web push, host OS notification, or notification history.
|
|
26
26
|
|
|
27
27
|
<p align="center">
|
|
28
28
|
<img src="./assets/toast.png" width="70%" alt="Enhanced notification stack: the newest error card is fully visible and earlier blue, amber and green cards expose equal lower edges">
|
|
@@ -35,6 +35,7 @@ When a session really stops, fails, asks a question, or needs approval, a card a
|
|
|
35
35
|
- **Direct, traceable navigation.** Clicking a card opens its session and the exact originating turn. After the host selects that session, the selected row is smoothly revealed in the left session tree, even when it lives in a different off-screen workspace. A card stays put with an explanation if navigation cannot succeed.
|
|
36
36
|
- **Answer in the toast.** A pending question or approval renders the same compatible options as the composer. Execution approvals and plan reviews share DSH's amber decision colour; ordinary questions remain blue. In-card and composer answers share the same host interaction.
|
|
37
37
|
- **Sound and background attention.** Built-in WebAudio cues and validated custom uploads play only after a card is admitted to an enabled visual Toast queue, including while the page is hidden. One polling batch produces one cue. A background tab with unseen notifications receives a temporary bell prefix and favicon attention marker.
|
|
38
|
+
- **Completion means native idle, once per task.** A green card waits until DSH reports the owning Agent as `idle`, matching the session-tree spinner instead of guessing from a rendered answer or an elapsed timer. A plan review and an execution approval are control gates, so their temporary idle pause does not create an extra completion card; the later work turn supplies the one card. An ordinary question is different: if its answer directly finishes the task, that same turn still produces one green card. If work resumes, the prior candidate is cancelled and only the final native-idle transition is announced.
|
|
38
39
|
- **Task-noise control.** Subtask, background-job, and workflow completion notifications are off by default.
|
|
39
40
|
- **No history by design.** Notification records are held only in the open page's in-memory queue. Settled history is never replayed after a refresh or overlay remount; an interaction that is still open when the host can report it is restored silently.
|
|
40
41
|
|
|
@@ -44,7 +45,7 @@ Requirements:
|
|
|
44
45
|
|
|
45
46
|
- DeepSeek Harness with a Web profile
|
|
46
47
|
- Node.js 20 or newer
|
|
47
|
-
- Verified DeepSeek Harness version: `0.1.
|
|
48
|
+
- Verified DeepSeek Harness version: `0.1.7-rc.1`
|
|
48
49
|
|
|
49
50
|
Install from npm into your Web profile:
|
|
50
51
|
|
|
@@ -84,7 +85,7 @@ Reload the profile or restart DSH only when its plugin host has not hot-reloaded
|
|
|
84
85
|
| Toast position | conversation top-right | Anchors the overlay to the chat column and follows sidebar layout changes. |
|
|
85
86
|
| Notification style | **Enhanced** | Enhanced uses clear status colours and a short attention bar; Soft uses a quieter presentation. |
|
|
86
87
|
| Collapse multiple notifications | **on** | From two cards onward, show the newest card fully and stack older cards below it; hover or focus expands them. |
|
|
87
|
-
| In-page sound | **on** | Plays
|
|
88
|
+
| In-page sound | **on** | Plays one cue when a polling batch admits one or more new visible Toasts, including while DSH is in a background tab. Built-ins: chime, ping, alert, silent; custom uploads are supported. |
|
|
88
89
|
| Subtask / background completion | **off** | Enables notifications for subagents, background jobs, and workflows, which can otherwise be noisy. |
|
|
89
90
|
| Preview and self-test | — | Sends page-local examples only: **Completed**, **Confirm**, **Failed**, **Info**, replay all four styles, fold the active examples, or clear them. No test sends a system notification or changes a real task. |
|
|
90
91
|
|
|
@@ -92,16 +93,22 @@ Custom sounds are stored in `<dataDir>/sounds/` in the profile data directory, n
|
|
|
92
93
|
|
|
93
94
|
## Compatibility
|
|
94
95
|
|
|
95
|
-
Current release
|
|
96
|
+
Current release: plugin **`0.3.3`** is verified against DeepSeek Harness **`0.1.7-rc.1`**.
|
|
96
97
|
|
|
97
|
-
| Plugin | Verified DeepSeek Harness |
|
|
98
|
-
| --- | --- |
|
|
99
|
-
|
|
|
100
|
-
| `0.3.
|
|
101
|
-
| `0.
|
|
102
|
-
| `0.
|
|
103
|
-
| `0.2.
|
|
104
|
-
| `0.1
|
|
98
|
+
| Plugin | Verified DeepSeek Harness | What that version is |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| **`0.3.3`** | `0.1.7-rc.1` | Adapts to DSH 0.1.7: job completions follow `jobs.events.subscribe`, tool results read the flattened tool-role message, in-toast answers read `uiSession.sessionStatus`, and `@deepseek-ai/schemastery` is a peer |
|
|
101
|
+
| `0.3.2` | `0.1.6-alpha.1` | Completion follows native `agent/status: idle`; one green card per continuous task |
|
|
102
|
+
| `0.3.1` | `0.1.6-alpha.1` | Sound matches visible delivery; open interactions recover after overlay remount |
|
|
103
|
+
| `0.3.0` | `0.1.6-alpha.1` | Enhanced/soft styles, collapsed stack, and page-local self-test |
|
|
104
|
+
| `0.2.2` | `0.1.6-alpha.1` | Latest published npm `latest` until `0.3.3` is released |
|
|
105
|
+
| `0.2.1` | `0.1.6-alpha.1` | — |
|
|
106
|
+
| `0.2.0` | `0.1.6-alpha.1` | — |
|
|
107
|
+
| `0.1.2` | `0.1.6-alpha.1` | — |
|
|
108
|
+
|
|
109
|
+
- **`0.3.3` supports the DSH `0.1.7` line only.** DSH `0.1.7` removed `jobs.onJobDone`, flattened tool-result identity onto the tool-role message, and replaced `uiSession.pendingInteractions` with the unified `sessionStatus` snapshot. On an older DSH — including `0.1.6-alpha.1` — stay on plugin **`0.3.2`**.
|
|
110
|
+
- Two declarations make the `0.1.7` line load at all: `dsh.engines.dsh` and every `@deepseek-ai/dsh-*` peer declare `>=0.1.7-rc.1 <0.2.0`. DSH `0.1.7-rc.1` refuses an incompatible bundle at profile load, so a range that excluded the running release would silently drop the plugin.
|
|
111
|
+
- `@deepseek-ai/schemastery` is a **peer**, not a plain dependency: DSH 0.1.7 resolves only a linked plugin's peer dependencies from the running installation, so a `link:` install of this directory would otherwise fail to import the Host half.
|
|
105
112
|
|
|
106
113
|
The layout is also checked at a 390px mobile viewport: the settings controls reflow and the toast becomes full-width without falling behind the mobile sidebar.
|
|
107
114
|
|
|
@@ -132,8 +139,8 @@ npm run pack:check # publish preconditions + client registration check
|
|
|
132
139
|
Releases are tag-driven. Bump `package.json`, move the matching CHANGELOG section out of `Unreleased`, write `release-notes/v<version>.md`, then push the release commit and tag:
|
|
133
140
|
|
|
134
141
|
```sh
|
|
135
|
-
git tag v0.3.
|
|
136
|
-
git push origin v0.3.
|
|
142
|
+
git tag v0.3.3
|
|
143
|
+
git push origin v0.3.3
|
|
137
144
|
```
|
|
138
145
|
|
|
139
146
|
The release workflow runs `npm run verify`, packs the plugin, publishes through npm trusted publishing (OIDC), and creates a GitHub Release with the package tarball and sha256.
|
package/README.zh.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<a href="https://github.com/idoall/dsh-notify/actions/workflows/ci.yml"><img src="https://github.com/idoall/dsh-notify/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
7
7
|
<a href="https://www.npmjs.com/package/@idoall/dsh-notify"><img src="https://img.shields.io/npm/v/@idoall/dsh-notify?label=npm&color=CB3837" alt="npm 版本"></a>
|
|
8
8
|
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-0F172A" alt="MIT"></a>
|
|
9
|
-
<img src="https://img.shields.io/badge/DSH-0.1.
|
|
9
|
+
<img src="https://img.shields.io/badge/DSH-0.1.7--rc.1-4B6BFB" alt="DSH 0.1.7-rc.1">
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center"><a href="README.md">English</a> | 中文</p>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
> DSH Notify 是 DeepSeek Harness 社区插件,只注册设置区块与页内浮层,不修改 DSH 源码。
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
会话真正停下、运行失败、向你提问或请求审批时,当前页面右上角会出现通知卡片。绿色**任务完成**卡以 DSH 原生 `agent/status: idle` 为准——这与左侧会话树转圈停止是同一个状态——而不是以右侧文字看起来已经结束的时刻推测。goal 自动续跑和排队的下一轮保持安静。一切发生在你已打开的页面内:没有 Service Worker、Web Push、宿主机系统通知或通知历史。
|
|
26
26
|
|
|
27
27
|
<p align="center">
|
|
28
28
|
<img src="./assets/toast.png" width="70%" alt="增强版通知堆叠:最新的失败通知完整显示,较早的蓝色、橙色和绿色通知等距露出下边缘">
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
- **可追溯的会话跳转**:点通知会打开对应会话并定位到来源轮次。宿主选中会话后,左侧会话树会自动平滑滚动并展示已选行,即使它位于另一个屏幕外工作区。跳转失败时卡片会留在原地说明原因。
|
|
36
36
|
- **在卡片内回答**:待回复问题或审批会显示可兼容的输入框选项;执行审批与计划待审沿用 DSH 的橙色决策语义,普通需要回复保持蓝色;卡片内回答与输入框操作同一份宿主交互。
|
|
37
37
|
- **提示音与后台提醒**:通知成功进入已启用的可视 Toast 队列后,才会播放内置 WebAudio 或经过校验的自定义提示音;页面在后台时也适用。同一轮轮询的一批通知只播放一次。后台标签有未查看通知时,标题和 favicon 会短暂提示。
|
|
38
|
+
- **完成以原生 idle 为准,并且每项任务只通知一次**:绿色完成卡等待 DSH 报告所属 Agent 为 `idle` 才发送,和左侧会话树转圈停止一致;不再依据已渲染的回答或计时器猜测。计划待审和执行审批是控制门:它们短暂进入 idle 不会额外生成完成卡,批准后的后续工作轮才产生唯一一张。普通需要回复不同:如果你的回答直接结束任务,该轮仍会产生一张绿色完成卡;若之后又继续运行,旧候选会被取消,最终只通知真正结束的 native-idle 状态。
|
|
38
39
|
- **任务噪声控制**:子任务、后台任务和工作流完成通知默认关闭。
|
|
39
40
|
- **无历史设计**:通知仅保存在当前页面内存中;刷新或 Toast 浮层重新挂载后,不会回放已结算历史;若宿主仍能报告未处理交互,则会静默恢复。
|
|
40
41
|
|
|
@@ -44,7 +45,7 @@
|
|
|
44
45
|
|
|
45
46
|
- 带 Web profile 的 DeepSeek Harness
|
|
46
47
|
- Node.js 20 或更新
|
|
47
|
-
- 已验证的 DeepSeek Harness:`0.1.
|
|
48
|
+
- 已验证的 DeepSeek Harness:`0.1.7-rc.1`
|
|
48
49
|
|
|
49
50
|
从 npm 安装:
|
|
50
51
|
|
|
@@ -84,7 +85,7 @@ dsh plugin --profile web add "link:$(pwd)"
|
|
|
84
85
|
| Toast 位置 | 会话区右上 | 浮层贴在聊天区,并跟随左右侧栏布局变化。 |
|
|
85
86
|
| 通知样式 | **增强版** | 增强版使用清晰状态色和短提醒条;柔和版更克制。 |
|
|
86
87
|
| 多条通知折叠显示 | **开** | 从两条开始完整显示最新一条,旧卡叠在下方;悬停或聚焦即可展开。 |
|
|
87
|
-
| 页内提示音 | **开** |
|
|
88
|
+
| 页内提示音 | **开** | 一轮轮询只要有一条或多条新 Toast 成功进入可视队列,就播放一次提示音,即使 DSH 标签在后台。内置 chime / ping / alert / 静音,也可上传自定义声音。 |
|
|
88
89
|
| 子任务 / 后台任务完成时通知 | **关** | 开启子代理、后台任务与工作流的完成通知;默认避免噪声。 |
|
|
89
90
|
| 预览与自测 | — | 仅发送当前页面的完成、确认、失败、信息示例;也可重播四种状态、折叠当前示例或清空。不会发系统通知,也不影响真实任务。 |
|
|
90
91
|
|
|
@@ -92,16 +93,22 @@ dsh plugin --profile web add "link:$(pwd)"
|
|
|
92
93
|
|
|
93
94
|
## 兼容性
|
|
94
95
|
|
|
95
|
-
|
|
96
|
+
当前发布:插件 **`0.3.3`** 已在 DeepSeek Harness **`0.1.7-rc.1`** 上验证。
|
|
96
97
|
|
|
97
|
-
| 插件 | 已验证的 DeepSeek Harness |
|
|
98
|
-
| --- | --- |
|
|
99
|
-
|
|
|
100
|
-
| `0.3.
|
|
101
|
-
| `0.
|
|
102
|
-
| `0.
|
|
103
|
-
| `0.2.
|
|
104
|
-
| `0.1
|
|
98
|
+
| 插件 | 已验证的 DeepSeek Harness | 这一版是什么 |
|
|
99
|
+
| --- | --- | --- |
|
|
100
|
+
| **`0.3.3`** | `0.1.7-rc.1` | 适配 DSH 0.1.7:后台任务完成走 `jobs.events.subscribe`,工具结果读取扁平化后的 tool-role 消息,卡片内回答读取 `uiSession.sessionStatus`,`@deepseek-ai/schemastery` 改为 peer |
|
|
101
|
+
| `0.3.2` | `0.1.6-alpha.1` | 完成通知跟随原生 `agent/status: idle`;连续任务只发一张绿色卡 |
|
|
102
|
+
| `0.3.1` | `0.1.6-alpha.1` | 提示音与可见投递对齐;浮层重挂载后恢复未处理交互 |
|
|
103
|
+
| `0.3.0` | `0.1.6-alpha.1` | 增强/柔和样式、折叠堆叠、页内自测 |
|
|
104
|
+
| `0.2.2` | `0.1.6-alpha.1` | 在 `0.3.3` 发布前仍是 npm `latest` |
|
|
105
|
+
| `0.2.1` | `0.1.6-alpha.1` | — |
|
|
106
|
+
| `0.2.0` | `0.1.6-alpha.1` | — |
|
|
107
|
+
| `0.1.2` | `0.1.6-alpha.1` | — |
|
|
108
|
+
|
|
109
|
+
- **`0.3.3` 只支持 DSH `0.1.7` 线。** DSH `0.1.7` 移除了 `jobs.onJobDone`,把工具结果身份扁平化到 tool-role 消息上,并用统一的 `sessionStatus` 快照替换了 `uiSession.pendingInteractions`。更早的 DSH(含 `0.1.6-alpha.1`)请继续用插件 **`0.3.2`**。
|
|
110
|
+
- 两处声明决定 `0.1.7` 线能否加载:`dsh.engines.dsh` 与每一个 `@deepseek-ai/dsh-*` peer 都声明 `>=0.1.7-rc.1 <0.2.0`。DSH `0.1.7-rc.1` 会在 profile 加载时拒绝不兼容的 bundle,范围写错就会静默丢掉插件。
|
|
111
|
+
- `@deepseek-ai/schemastery` 是 **peer**,不是普通依赖:DSH 0.1.7 只会把 **link 形态**插件的 peer 解析到当前安装;若仍写成普通依赖,`link:` 安装的 Host 半会导入失败。
|
|
105
112
|
|
|
106
113
|
同时在 390px 手机视口检查:设置控件会重排,Toast 会满宽显示且不会被移动端侧栏遮挡。
|
|
107
114
|
|
|
@@ -132,8 +139,8 @@ npm run pack:check # 发布前置条件 + 客户端注册校验
|
|
|
132
139
|
发版由 tag 驱动。更新 `package.json`、将对应 CHANGELOG 段落移出 `Unreleased`、编写 `release-notes/v<版本>.md` 后,推送发版提交与 tag:
|
|
133
140
|
|
|
134
141
|
```sh
|
|
135
|
-
git tag v0.3.
|
|
136
|
-
git push origin v0.3.
|
|
142
|
+
git tag v0.3.3
|
|
143
|
+
git push origin v0.3.3
|
|
137
144
|
```
|
|
138
145
|
|
|
139
146
|
发版工作流会运行 `npm run verify`、打包插件、通过 npm trusted publishing(OIDC)发布,并创建附带 tarball 与 sha256 的 GitHub Release。
|
package/dist/client.js
CHANGED
|
@@ -1094,7 +1094,10 @@ window.__ModuleLoader__.load({
|
|
|
1094
1094
|
}
|
|
1095
1095
|
function pendingInteractionFor(pending, sessionId) {
|
|
1096
1096
|
if (!pending || typeof pending.get !== "function" || typeof sessionId !== "string") return null;
|
|
1097
|
-
|
|
1097
|
+
const entry = pending.get(sessionId) ?? null;
|
|
1098
|
+
if (!entry) return null;
|
|
1099
|
+
if ("pendingInteraction" in entry) return entry.pendingInteraction ?? null;
|
|
1100
|
+
return typeof entry.answer === "function" ? entry : null;
|
|
1098
1101
|
}
|
|
1099
1102
|
function toastAnswer(record, interaction) {
|
|
1100
1103
|
if (!interaction || typeof interaction.answer !== "function") return null;
|
|
@@ -1238,7 +1241,10 @@ window.__ModuleLoader__.load({
|
|
|
1238
1241
|
const status = { service: slots?.inject && slots?.register ? "available" : "unavailable", seats: {} };
|
|
1239
1242
|
if (status.service === "unavailable") return { status, destroy() {
|
|
1240
1243
|
} };
|
|
1241
|
-
const pendingInteractions = () =>
|
|
1244
|
+
const pendingInteractions = () => {
|
|
1245
|
+
const ui = getUiSession?.();
|
|
1246
|
+
return ui?.sessionStatus ?? ui?.pendingInteractions;
|
|
1247
|
+
};
|
|
1242
1248
|
const disposers = [installClientStyles(), installAudioUnlock()];
|
|
1243
1249
|
const activate = (name, options, Component) => {
|
|
1244
1250
|
status.seats[name] = "active";
|
package/dist/index.js
CHANGED
|
@@ -9,8 +9,9 @@ export const name = 'dsh-notify';
|
|
|
9
9
|
export const inject = [];
|
|
10
10
|
export const Config = z.object({
|
|
11
11
|
dataDir: z.string().description('Absolute path to the profile-owned dsh-notify data directory.'),
|
|
12
|
-
//
|
|
13
|
-
|
|
12
|
+
// Compatibility switch for old hosts/tests without `agent/status`; current DSH releases use the
|
|
13
|
+
// authoritative idle transition instead of guessing completion from elapsed time.
|
|
14
|
+
completionGraceMs: z.number().step(1).min(0).max(600_000).default(8_000).description('Legacy fallback for hosts without agent lifecycle status; current DSH releases notify on authoritative idle.'),
|
|
14
15
|
});
|
|
15
16
|
export { EventReducer, PLAN_REVIEW_FALLBACK, sanitizeBody, validateRequest } from './core.js';
|
|
16
17
|
export { createBuffer, createSettings, BUFFER_LIMIT } from './buffer.js';
|
|
@@ -176,6 +177,24 @@ export async function apply(ctx, config = {}) {
|
|
|
176
177
|
// A live user-questions/request has no source-proven causal callId, therefore
|
|
177
178
|
// this host must not infer one from an arrival queue or FIFO ordering.
|
|
178
179
|
const pendingToolCalls = new Map();
|
|
180
|
+
// Plan reviews and execution approvals are control gates: their idle pause is not task completion.
|
|
181
|
+
// An ordinary question can instead be the last operation of a task, so retain its kind and allow that
|
|
182
|
+
// directly-settled turn to announce completion once native DSH reaches idle.
|
|
183
|
+
const interactiveTurns = new Map();
|
|
184
|
+
const markInteractiveTurn = (sessionId, turn, kind = 'question') => {
|
|
185
|
+
if (!Number.isSafeInteger(turn) || turn <= 0) return;
|
|
186
|
+
let turns = interactiveTurns.get(sessionId);
|
|
187
|
+
if (!turns) { turns = new Map(); interactiveTurns.set(sessionId, turns); }
|
|
188
|
+
turns.set(turn, kind);
|
|
189
|
+
};
|
|
190
|
+
const consumeInteractiveTurn = (sessionId, turn) => {
|
|
191
|
+
const turns = interactiveTurns.get(sessionId);
|
|
192
|
+
if (!turns || !turns.has(turn)) return undefined;
|
|
193
|
+
const kind = turns.get(turn);
|
|
194
|
+
turns.delete(turn);
|
|
195
|
+
if (!turns.size) interactiveTurns.delete(sessionId);
|
|
196
|
+
return kind;
|
|
197
|
+
};
|
|
179
198
|
const pendingFor = (sessionId) => {
|
|
180
199
|
let calls = pendingToolCalls.get(sessionId);
|
|
181
200
|
if (!calls) { calls = new Set(); pendingToolCalls.set(sessionId, calls); }
|
|
@@ -202,15 +221,16 @@ export async function apply(ctx, config = {}) {
|
|
|
202
221
|
};
|
|
203
222
|
const safely = (work) => { Promise.resolve().then(work).catch(() => { diagnostics.eventErrors += 1; }); };
|
|
204
223
|
/**
|
|
205
|
-
* A turn
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* recorded at all; if a goal is engaged, nothing is recorded until that goal ends.
|
|
224
|
+
* A turn boundary only says that one response has ended. DSH's native sidebar stays busy until the
|
|
225
|
+
* owning Agent enters `idle`; that lifecycle transition is the authority for a completed task. The
|
|
226
|
+
* old elapsed-time heuristic could disagree with the spinner and, worse, leave a goal-held candidate
|
|
227
|
+
* stranded forever. Keep the timer solely as a compatibility fallback for pre-lifecycle hosts.
|
|
210
228
|
*/
|
|
211
229
|
const completionGraceMs = Number.isSafeInteger(config.completionGraceMs) ? config.completionGraceMs : 8_000;
|
|
212
230
|
const deferredCompletions = new Map(); // sessionId -> { payload, timer }
|
|
213
|
-
const engagedGoals = new Set(); //
|
|
231
|
+
const engagedGoals = new Set(); // only used for a legacy host without agent/status
|
|
232
|
+
const agentStatuses = new Map(); // sessionId -> 'idle' | 'running'
|
|
233
|
+
const statusCapable = new Set(); // sessions for which the Host has emitted agent/status
|
|
214
234
|
const clearDeferred = (sessionId) => { const entry = deferredCompletions.get(sessionId); if (entry?.timer) clearTimeout(entry.timer); };
|
|
215
235
|
const flushCompletion = async (sessionId) => {
|
|
216
236
|
const entry = deferredCompletions.get(sessionId);
|
|
@@ -229,8 +249,13 @@ export async function apply(ctx, config = {}) {
|
|
|
229
249
|
const deferCompletion = (sessionId, payload) => {
|
|
230
250
|
const existing = deferredCompletions.get(sessionId);
|
|
231
251
|
if (existing?.timer) clearTimeout(existing.timer);
|
|
232
|
-
//
|
|
233
|
-
|
|
252
|
+
// Current DSH: wait for exactly the same idle state that clears the native sidebar spinner.
|
|
253
|
+
if (statusCapable.has(sessionId)) {
|
|
254
|
+
deferredCompletions.set(sessionId, { payload, timer: null });
|
|
255
|
+
if (agentStatuses.get(sessionId) === 'idle') void flushCompletion(sessionId).catch(() => { diagnostics.eventErrors += 1; });
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
// Legacy DSH has no status lifecycle: retain the old grace behaviour as a safe fallback.
|
|
234
259
|
if (engagedGoals.has(sessionId)) {
|
|
235
260
|
deferredCompletions.set(sessionId, { payload, timer: null });
|
|
236
261
|
return;
|
|
@@ -284,31 +309,51 @@ export async function apply(ctx, config = {}) {
|
|
|
284
309
|
const liveTurns = new Map();
|
|
285
310
|
const turnOf = (sessionId, event) => (Number.isSafeInteger(event?.turn) && event.turn > 0 ? event.turn : liveTurns.get(sessionId));
|
|
286
311
|
|
|
312
|
+
// `agent/status: idle` is the public DSH signal that no driver remains scheduled or active. It
|
|
313
|
+
// matches the native session spinner, so completion Toasts cannot precede the sidebar state.
|
|
314
|
+
ctx?.on?.('agent/status', ({ agent, status } = {}) => {
|
|
315
|
+
const sessionId = sessionIdOf(agent);
|
|
316
|
+
if (typeof sessionId !== 'string' || sessionId === '') return;
|
|
317
|
+
if (status !== 'idle' && status !== 'running') return;
|
|
318
|
+
statusCapable.add(sessionId);
|
|
319
|
+
agentStatuses.set(sessionId, status);
|
|
320
|
+
if (status === 'running') { cancelCompletion(sessionId); return; }
|
|
321
|
+
safely(() => flushCompletion(sessionId));
|
|
322
|
+
});
|
|
323
|
+
|
|
287
324
|
ctx?.on?.('session/event', (session, event) => {
|
|
288
325
|
const data = event?.data ?? {};
|
|
289
326
|
const sessionId = session?.id;
|
|
290
327
|
if (Number.isSafeInteger(data.turn) && data.turn > 0) liveTurns.set(sessionId, data.turn);
|
|
291
328
|
if (event?.type === 'tool/call' && data.callId && (data.name === 'ask_user_question' || data.name === 'exit_plan_mode')) {
|
|
329
|
+
markInteractiveTurn(sessionId, turnOf(sessionId, data), data.name === 'exit_plan_mode' ? 'plan-review' : 'question');
|
|
292
330
|
pendingFor(sessionId).add(data.callId);
|
|
293
331
|
const interaction = reducer.question({ sessionId, callId: data.callId, intent: data.name === 'exit_plan_mode' ? { kind: 'plan-review' } : undefined, title: interactionBody(data.name, data.arguments), turn: turnOf(sessionId, data) });
|
|
294
332
|
safely(() => dispatch(interaction));
|
|
295
333
|
return;
|
|
296
334
|
}
|
|
297
335
|
if (event?.type === 'tool/result') {
|
|
298
|
-
|
|
299
|
-
|
|
336
|
+
// DSH 0.1.7 flattened the tool result onto the tool-role message (`message.toolCallId` and
|
|
337
|
+
// `message.isError`); the nested `tool-result` content block this used to read is gone. The message
|
|
338
|
+
// is the authoritative shape, and the old nested block stays only as a fallback so an older host
|
|
339
|
+
// keeps settling its interactions.
|
|
340
|
+
const message = data.message ?? {};
|
|
341
|
+
const nested = message.content?.find?.((block) => block?.type === 'tool-result');
|
|
342
|
+
const callId = message.toolCallId ?? nested?.toolCallId;
|
|
300
343
|
if (!callId) return; // Unlinked records cannot be guessed closed by an uncorrelated result.
|
|
301
344
|
removePending(sessionId, callId);
|
|
302
|
-
const
|
|
303
|
-
const existing = reducer.questionResult({ sessionId, callId, outcome });
|
|
345
|
+
const failed = message.isError === true || nested?.isError === true || data.outcome === 'abort';
|
|
346
|
+
const existing = reducer.questionResult({ sessionId, callId, outcome: failed ? 'abort' : 'settled' });
|
|
304
347
|
if (existing) safely(() => dispatch(existing));
|
|
305
348
|
return;
|
|
306
349
|
}
|
|
307
350
|
safely(async () => {
|
|
308
351
|
// Work resumed: whatever turn end is still pending for this session was not the end of the task.
|
|
309
352
|
if (event?.type === 'turn/start' || event?.type === 'tool/call') cancelCompletion(sessionId);
|
|
310
|
-
if (event?.type === 'approval/asked')
|
|
311
|
-
|
|
353
|
+
if (event?.type === 'approval/asked') {
|
|
354
|
+
markInteractiveTurn(sessionId, turnOf(sessionId, data), 'approval');
|
|
355
|
+
await dispatch(reducer.approvalAsked({ ...data, turn: turnOf(sessionId, data) }, sessionId));
|
|
356
|
+
} else if (event?.type === 'approval/decided') await dispatch(reducer.approvalDecided(data.id, data.outcome));
|
|
312
357
|
else if (event?.type === 'turn/end') {
|
|
313
358
|
const error = pendingErrors.get(`${sessionId}:${data.turn}`);
|
|
314
359
|
pendingErrors.delete(`${sessionId}:${data.turn}`);
|
|
@@ -316,7 +361,12 @@ export async function apply(ctx, config = {}) {
|
|
|
316
361
|
// leftover whose decision event was never observed, and one leftover used to shadow every
|
|
317
362
|
// later toast. Persist the expiry before the completion notification.
|
|
318
363
|
for (const stale of reducer.expireOpenForSession(sessionId)) await dispatch(stale);
|
|
319
|
-
|
|
364
|
+
// Plan reviews and execution approvals are intermediate native-idle control gates. An ordinary
|
|
365
|
+
// question may directly finish the task after the user answers, so only the gates are suppressed.
|
|
366
|
+
const interactionKind = consumeInteractiveTurn(sessionId, data.turn);
|
|
367
|
+
if (interactionKind !== 'plan-review' && interactionKind !== 'approval') {
|
|
368
|
+
deferCompletion(sessionId, { sessionId, turn: data.turn, reason: data.reason, body: error?.message || String(error || ''), origin: originOf(session) });
|
|
369
|
+
}
|
|
320
370
|
}
|
|
321
371
|
});
|
|
322
372
|
});
|
|
@@ -325,15 +375,13 @@ export async function apply(ctx, config = {}) {
|
|
|
325
375
|
// the past is not news, so a rebuild would only re-announce an approval the user can already see in
|
|
326
376
|
// the DSH UI, and it would do it on every session open.
|
|
327
377
|
ctx?.on?.('approval/request', (request, next) => { try { /* live reason is non-authoritative */ } catch { diagnostics.eventErrors += 1; } return next(); });
|
|
328
|
-
//
|
|
329
|
-
//
|
|
378
|
+
// Older Hosts may not publish agent/status. Keep goal awareness only for that legacy fallback;
|
|
379
|
+
// lifecycle-capable Hosts flush on native `idle`, not when a separate goal bookkeeping event arrives.
|
|
330
380
|
ctx?.on?.('goal/activation-changed', (payload) => safely(async () => {
|
|
331
381
|
const sessionId = sessionIdOf(payload?.sessionId) ?? payload?.sessionId;
|
|
332
|
-
if (typeof sessionId !== 'string' || sessionId === '') return;
|
|
382
|
+
if (typeof sessionId !== 'string' || sessionId === '' || statusCapable.has(sessionId)) return;
|
|
333
383
|
if (payload?.goal) {
|
|
334
384
|
engagedGoals.add(sessionId);
|
|
335
|
-
// A goal engaging after a turn ended holds that announcement: the loop is still working, so the
|
|
336
|
-
// pending payload waits for the goal to finish instead of firing on the grace timer.
|
|
337
385
|
const entry = deferredCompletions.get(sessionId);
|
|
338
386
|
if (entry?.timer) { clearTimeout(entry.timer); entry.timer = null; }
|
|
339
387
|
return;
|
|
@@ -405,6 +453,17 @@ export async function apply(ctx, config = {}) {
|
|
|
405
453
|
workflowOwners.delete(info.id);
|
|
406
454
|
safely(() => dispatch(reducer.upsert({ kind: 'workflow-end', mergeKey: `wf:${info.id}`, ...(sessionId ? { sessionId } : {}), title: info.meta?.name || '工作流结束', body: result.error || result.stopReason, phase: 'settled', outcome: result.stopReason })));
|
|
407
455
|
});
|
|
456
|
+
/**
|
|
457
|
+
* One settled job becomes one card. DSH 0.1.7 consolidated the registry into a single event stream whose
|
|
458
|
+
* terminal event is `settled`, and a settlement that released a live waiter was already handed to that
|
|
459
|
+
* caller, so only the unawaited ones are news for a human. The older `onJobDone` listener, which delivered
|
|
460
|
+
* the terminal snapshot with its owning Agent, is kept for a host that still has it.
|
|
461
|
+
*/
|
|
462
|
+
const onJobSettled = (job) => {
|
|
463
|
+
if (!subtasksWanted() || !job) return;
|
|
464
|
+
if (job.status === 'running' || job.status === 'stopping') return;
|
|
465
|
+
safely(() => dispatch(reducer.upsert({ kind: 'job-end', mergeKey: `job:${job.id}`, ...(typeof job.owner === 'string' && job.owner !== '' ? { sessionId: job.owner } : {}), ...jobNotification(job), phase: 'settled', outcome: job.status })));
|
|
466
|
+
};
|
|
408
467
|
const onJobDone = (snapshot, owner) => {
|
|
409
468
|
if (!subtasksWanted()) return;
|
|
410
469
|
safely(() => dispatch(reducer.upsert({ kind: 'job-end', mergeKey: `job:${snapshot?.id}`, sessionId: snapshot?.ownerSession ?? sessionIdOf(owner), ...jobNotification(snapshot ?? {}), phase: 'settled', outcome: snapshot?.status })));
|
|
@@ -419,10 +478,22 @@ export async function apply(ctx, config = {}) {
|
|
|
419
478
|
*/
|
|
420
479
|
let jobListenerAttached = false;
|
|
421
480
|
const attachJobs = (registry) => {
|
|
422
|
-
if (jobListenerAttached
|
|
481
|
+
if (jobListenerAttached) return false;
|
|
482
|
+
// Current DSH: one lifecycle stream, subscribed with an explicit owner filter. This plugin observes
|
|
483
|
+
// every owner because a profile-level mount is the only composition that can see all sessions.
|
|
484
|
+
if (typeof registry?.events?.subscribe === 'function') {
|
|
485
|
+
jobListenerAttached = true;
|
|
486
|
+
registry.events.subscribe({ owners: 'all' }, (event) => {
|
|
487
|
+
if (event?.type !== 'settled' || event.awaited === true) return;
|
|
488
|
+
onJobSettled(event.job);
|
|
489
|
+
});
|
|
490
|
+
diagnostics.services.jobs = 'events';
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
if (typeof registry?.onJobDone !== 'function') return false;
|
|
423
494
|
jobListenerAttached = true;
|
|
424
495
|
registry.onJobDone(onJobDone);
|
|
425
|
-
diagnostics.services.jobs = '
|
|
496
|
+
diagnostics.services.jobs = 'onJobDone';
|
|
426
497
|
return true;
|
|
427
498
|
};
|
|
428
499
|
if (typeof ctx?.inject === 'function') { try { ctx.inject(['jobs'], (jobCtx) => { attachJobs(jobCtx?.jobs); }); } catch { /* no registry in this composition */ } }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idoall/dsh-notify",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "DSH web plugin: in-page task notifications for DeepSeek Harness — enhanced or soft status toasts, a collapsible top-right stack, answer buttons, background-tab attention, and a WebAudio cue that also plays while the page is hidden. Live delivery only: no history, no service worker, no web push, no OS notification matrix.",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
"LICENSE"
|
|
19
19
|
],
|
|
20
20
|
"dsh": {
|
|
21
|
+
"manifestVersion": 1,
|
|
22
|
+
"engines": {
|
|
23
|
+
"dsh": ">=0.1.7-rc.1 <0.2.0"
|
|
24
|
+
},
|
|
21
25
|
"bundle": {
|
|
22
26
|
"patch": "./cordis.patch.yml"
|
|
23
27
|
},
|
|
@@ -29,6 +33,11 @@
|
|
|
29
33
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
30
34
|
"@deepseek-ai/dsh-client-ui-settings-general"
|
|
31
35
|
]
|
|
36
|
+
},
|
|
37
|
+
"compatibility": {
|
|
38
|
+
"dshReleases": {
|
|
39
|
+
"0.1.7-rc.1": "compatible"
|
|
40
|
+
}
|
|
32
41
|
}
|
|
33
42
|
},
|
|
34
43
|
"scripts": {
|
|
@@ -43,14 +52,18 @@
|
|
|
43
52
|
"publishConfig": {
|
|
44
53
|
"access": "public"
|
|
45
54
|
},
|
|
46
|
-
"dependencies": {
|
|
47
|
-
"@deepseek-ai/schemastery": "^3.18.2"
|
|
48
|
-
},
|
|
49
55
|
"peerDependencies": {
|
|
56
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
57
|
+
"@deepseek-ai/dsh-client-connection": ">=0.1.7-rc.1 <0.2.0",
|
|
58
|
+
"@deepseek-ai/dsh-client-ui-session": ">=0.1.7-rc.1 <0.2.0",
|
|
59
|
+
"@deepseek-ai/dsh-host-webserver": ">=0.1.7-rc.1 <0.2.0",
|
|
60
|
+
"@deepseek-ai/dsh-jobs": ">=0.1.7-rc.1 <0.2.0",
|
|
61
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
50
62
|
"react": "^18.2.0"
|
|
51
63
|
},
|
|
52
64
|
"devDependencies": {
|
|
53
|
-
"@deepseek-ai/cordis": "4.0.
|
|
65
|
+
"@deepseek-ai/cordis": "^4.0.4",
|
|
66
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
54
67
|
"@types/node": "^22.15.29",
|
|
55
68
|
"@types/react": "^18.3.23",
|
|
56
69
|
"esbuild": "^0.25.5",
|