@idoall/dsh-notify 0.4.1 → 0.4.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 +31 -0
- package/README.md +10 -6
- package/README.zh.md +10 -6
- package/dist/client.js +5 -1
- package/dist/index.js +65 -23
- package/package.json +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). GitHub Releases use the same bilingual layout as [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness/releases/tag/dsh-v0.1.6-alpha.1).
|
|
4
4
|
|
|
5
|
+
## [0.4.3] - 2026-10-06
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **The two settings dropdowns no longer render larger than the labels beside them.** 「通知位置」and「提示音」were the only controls in the section that did not pin their own type size: `.dsh-notify-select` used a bare `font: inherit`, so they followed the host's content font size — `--dsh-content-font-size`, 14px by default and user-settable from 10px to 22px — while every label, hint, toggle, segmented button and action button around them is pinned (13px/12px). The select now states `font-size: 13px` after `font: inherit`, matching its own card, and still inherits the family from the host. No other control was affected: every other `select` in the plugin already sat inside a container that pinned 13px.
|
|
10
|
+
|
|
11
|
+
### Verified
|
|
12
|
+
|
|
13
|
+
- `npm run typecheck` gained a static guard: `.dsh-notify-select` must declare its own `font-size`, so the control cannot silently go back to scaling with the host's content font size.
|
|
14
|
+
- Full verification passed: static source checks, **110 automated tests**, build, and package precondition checks.
|
|
15
|
+
- Counter-proof: removing `font-size: 13px` from the rule fails `npm run typecheck` with `the settings select must pin its own font-size, not inherit the host content font size`; restoring it passes.
|
|
16
|
+
|
|
17
|
+
## [0.4.2] - 2026-10-06
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **A task that asked for your approval is announced again when it finishes.** Since `0.3.2` a turn that asked an execution approval or a plan review had its completion withheld forever. That suppression assumed the interactive pause ended the turn and the work resumed in a *new* one. DSH never does that: `approval.request()` requires an open turn and awaits its outcome inside it, and `exit_plan_mode` returns its verdict to the same turn, so the turn that resumes is the turn that asked. Replaying every session log on this machine (362 files, 3830 notifiable turns, 81 of them containing an approval or plan review) shows **8 of those 81 turns announced** before this release and **81 of 81** after it, with no extra record anywhere — the suppression removed no duplicate, it only swallowed real completions. A gate now withholds its turn's completion **only while the human still owes an answer**, which is also the safe reading if a turn ever does end on an open gate.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- **Declared DeepSeek Harness `0.2.0-rc.2` and `0.2.1-alpha.1` compatible.** `dsh.compatibility.dshReleases` gains `0.2.1-alpha.1` alongside `0.2.0-rc.2`, `0.2.0-rc.1`, `0.1.7-rc.2` and `0.1.7-rc.1`. The requirement itself stays `>=0.1.7-rc.1 <0.3.0`, which already admitted both under DSH's `includePrerelease` evaluation — that is why `0.4.1` was not among the bundles refused at startup, and no range widening was needed.
|
|
26
|
+
|
|
27
|
+
### Verified
|
|
28
|
+
|
|
29
|
+
- **No interface this plugin binds changed in `0.2.0-rc.2`.** The Host events (`agent/status`, `session/event`, `approval/request`, `user-questions/request`, `goal/activation-changed`, `agent/error`, `workflow/end`), the `webServer`/`connection` route and authorization contract, the `jobs` event stream, the `slots` seats (`settings.section`, `shell.overlay`), and the `--dsw-alias-*` theme tokens are unchanged; across the packages it binds (`dsh-client-connection`, `dsh-client-ui-session`, `dsh-host-webserver`, `dsh-jobs`, `dsh-client-ui-renderer`, `dsh-client-ui-layout`, `dsh-client-ui-settings`, `dsh-client-ui-settings-general`) the `dsh-v0.2.0-rc.1..dsh-v0.2.0-rc.2` diff is version bumps plus one internal one-line `scoped-slots` change.
|
|
30
|
+
- DSH's own loader check (`evaluatePluginCompatibility` from `dsh-app-boot`) accepts this manifest on `0.2.0-rc.2` and still refuses the unchanged `@idoall/dsh-session-colors@0.1.6`, reproducing the startup warning exactly.
|
|
31
|
+
- The new `0.2.0-rc.2` reading of `ask_user_question` (an opt-in `mode: 'timed'` row whose foreground wait returns a **pending** result and leaves the question answerable) needs no host change: the tool result settles the record while the turn continues, and the turn's own end is the completion. The default remains the blocking `legacy` tool, which this plugin already handled.
|
|
32
|
+
- **No interface this plugin binds changed in `0.2.1-alpha.1` either.** Across `dsh-v0.2.0-rc.2..dsh-v0.2.1-alpha.1` (266 commits) the bound packages differ only by version bumps and the repository-wide removal of the `invariant` companion modules, which no runtime path loads. The one real source change is `ui-layout` adding the **new** `shell.bottom` seat and a `.frame` grid row for it; the `shell.overlay` seat this plugin mounts into, its `.overlayLayer`, and the `[data-conversation-scroll]` anchor the toast measures are untouched.
|
|
33
|
+
- **Real-machine verification on `0.2.1-alpha.1`** in an isolated `DSH_HOME` under `/tmp` (the operator's profile is never touched): a profile built from the shipped `web` template with this plugin installed as `link:` booted with **no compatibility refusal**, `/plugins/dsh-notify/health` answered `guiAvailable: true` with `eventErrors: 0`, `/config`, `/pull`, `/sounds` and `/update` (real npm registry) all answered 200, the client entry was composed into `window.__DSH_BOOT__` with its full `inject` list, and its bundle served `200` as a `@idoall/dsh-notify` `__ModuleLoader__.load` registration.
|
|
34
|
+
- Full verification passed: static source checks, **110 automated tests**, build, and package precondition checks.
|
|
35
|
+
|
|
5
36
|
## [0.4.1] - 2026-09-29
|
|
6
37
|
|
|
7
38
|
### Changed
|
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.2.
|
|
9
|
+
<img src="https://img.shields.io/badge/DSH-0.2.1--alpha.1-4B6BFB" alt="DSH 0.2.1-alpha.1">
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center">English | <a href="README.zh.md">中文</a></p>
|
|
@@ -46,7 +46,7 @@ Requirements:
|
|
|
46
46
|
|
|
47
47
|
- DeepSeek Harness with a Web profile
|
|
48
48
|
- Node.js 20 or newer
|
|
49
|
-
- Verified DeepSeek Harness version: `0.2.
|
|
49
|
+
- Verified DeepSeek Harness version: `0.2.1-alpha.1`
|
|
50
50
|
|
|
51
51
|
Install from npm into your Web profile:
|
|
52
52
|
|
|
@@ -100,11 +100,13 @@ Above the cards, the page shows the running version against the newest one on np
|
|
|
100
100
|
|
|
101
101
|
## Compatibility
|
|
102
102
|
|
|
103
|
-
Current release: plugin **`0.4.
|
|
103
|
+
Current release: plugin **`0.4.3`** is verified against DeepSeek Harness **`0.2.1-alpha.1`**.
|
|
104
104
|
|
|
105
105
|
| Plugin | Verified DeepSeek Harness | What that version is |
|
|
106
106
|
| --- | --- | --- |
|
|
107
|
-
| **`0.4.
|
|
107
|
+
| **`0.4.3`** | `0.2.1-alpha.1` | The 「通知位置」and「提示音」dropdowns pin their own 13px instead of following the host's content font size, which made them render larger than their own labels. Client half only |
|
|
108
|
+
| `0.4.2` | `0.2.1-alpha.1` | A task that asked for your approval is announced again when it finishes (since `0.3.2` those completions were withheld forever), and `0.2.0-rc.2` / `0.2.1-alpha.1` are declared compatible — one `dshReleases` line each, since `>=0.1.7-rc.1 <0.3.0` already admitted them |
|
|
109
|
+
| `0.4.1` | `0.2.0-rc.1` | Compatibility follow-up: declares the DSH `0.2.0` line (`>=0.1.7-rc.1 <0.3.0`), so the plugin is no longer dropped at profile load when `0.2.0` ships. No source change — every interface it binds is unchanged |
|
|
108
110
|
| `0.4.0` | `0.1.7-rc.2` | Online version detection in 设置 → 通知: the running version against npm's newest, a manual **检查更新** (`?force=1`), repository/changelog/issues links, and a copyable upgrade command — read-only, cached, and it never installs or restarts anything |
|
|
109
111
|
| `0.3.4` | `0.1.7-rc.1` | Trigger-timing fixes: a failure is delivered at `agent/error` (one card with `turn/end`), a same-stack `idle → running` flap no longer announces a finished task, and the client pulls at once on a session-state change or a visible-again tab (1.5 s interval kept as fallback) |
|
|
110
112
|
| `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 |
|
|
@@ -118,7 +120,9 @@ Current release: plugin **`0.4.1`** is verified against DeepSeek Harness **`0.2.
|
|
|
118
120
|
|
|
119
121
|
- **`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`**.
|
|
120
122
|
- Two declarations decide whether the plugin loads at all: `dsh.engines.dsh` and every `@deepseek-ai/dsh-*` peer state the same requirement, `>=0.1.7-rc.1 <0.3.0` as of `0.4.1`. DSH refuses an incompatible bundle at profile load, so a range that excluded the running release would silently drop the plugin — which is exactly what the old `<0.2.0` ceiling would have done on the `0.2.0` release.
|
|
123
|
+
- **An interactive gate only withholds a completion while it is unanswered.** DSH resolves an execution approval and a plan review *inside* the turn that asked them (`approval.request()` awaits its outcome under an open turn; `exit_plan_mode` returns its verdict to the same turn), so the turn that resumes is the turn that asked, and its end is the user's task finishing. `0.4.2` makes that the rule; `0.3.2`–`0.4.1` suppressed the whole turn, which silently dropped the completion of every approval-gated task.
|
|
121
124
|
- `@deepseek-ai/schemastery` is a **peer**, not a plain dependency: DSH 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.
|
|
125
|
+
- **Verified releases are listed, not just matched.** `dsh.compatibility.dshReleases` names every release this plugin was actually booted on (`0.1.7-rc.1`, `0.1.7-rc.2`, `0.2.0-rc.1`, `0.2.0-rc.2`, `0.2.1-alpha.1` as of `0.4.2`) and `npm run pack:check` fails when one of them falls outside the declared range. Each entry means a real boot, not a semver guess.
|
|
122
126
|
|
|
123
127
|
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.
|
|
124
128
|
|
|
@@ -149,8 +153,8 @@ npm run pack:check # publish preconditions + client registration check
|
|
|
149
153
|
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:
|
|
150
154
|
|
|
151
155
|
```sh
|
|
152
|
-
git tag v0.4.
|
|
153
|
-
git push origin v0.4.
|
|
156
|
+
git tag v0.4.3
|
|
157
|
+
git push origin v0.4.3
|
|
154
158
|
```
|
|
155
159
|
|
|
156
160
|
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.2.
|
|
9
|
+
<img src="https://img.shields.io/badge/DSH-0.2.1--alpha.1-4B6BFB" alt="DSH 0.2.1-alpha.1">
|
|
10
10
|
</p>
|
|
11
11
|
|
|
12
12
|
<p align="center"><a href="README.md">English</a> | 中文</p>
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
- 带 Web profile 的 DeepSeek Harness
|
|
48
48
|
- Node.js 20 或更新
|
|
49
|
-
- 已验证的 DeepSeek Harness:`0.2.
|
|
49
|
+
- 已验证的 DeepSeek Harness:`0.2.1-alpha.1`
|
|
50
50
|
|
|
51
51
|
从 npm 安装:
|
|
52
52
|
|
|
@@ -100,11 +100,13 @@ dsh plugin --profile web add "link:$(pwd)"
|
|
|
100
100
|
|
|
101
101
|
## 兼容性
|
|
102
102
|
|
|
103
|
-
当前发布:插件 **`0.4.
|
|
103
|
+
当前发布:插件 **`0.4.3`** 已在 DeepSeek Harness **`0.2.1-alpha.1`** 上验证。
|
|
104
104
|
|
|
105
105
|
| 插件 | 已验证的 DeepSeek Harness | 这一版是什么 |
|
|
106
106
|
| --- | --- | --- |
|
|
107
|
-
| **`0.4.
|
|
107
|
+
| **`0.4.3`** | `0.2.1-alpha.1` | 「通知位置」与「提示音」两个下拉框改为固定 13px,不再跟随宿主的正文字号而比自己的标签还大。只动客户端半边 |
|
|
108
|
+
| `0.4.2` | `0.2.1-alpha.1` | 走了审批的任务在完成时重新会通知(自 `0.3.2` 起这类完成通知被永久吞掉);同时声明兼容 `0.2.0-rc.2` 与 `0.2.1-alpha.1`——各一行 `dshReleases`,因为 `>=0.1.7-rc.1 <0.3.0` 本来就接纳它们 |
|
|
109
|
+
| `0.4.1` | `0.2.0-rc.1` | 兼容性跟进:声明支持 DSH `0.2.0` 线(`>=0.1.7-rc.1 <0.3.0`),`0.2.0` 正式版发布时插件不会再在 profile 加载阶段被丢弃。无源码改动——它绑定的接口都没有变化 |
|
|
108
110
|
| `0.4.0` | `0.1.7-rc.2` | 设置 → 通知新增在线版本检测:当前版本 vs npm 最新版、手动**检查更新**(`?force=1`)、仓库/更新日志/Issue 入口,以及可复制的升级命令——只读、带缓存,绝不自动安装、绝不重启 |
|
|
109
111
|
| `0.3.4` | `0.1.7-rc.1` | 触发时序修复:失败在 `agent/error` 时即投递(与 `turn/end` 共用同一张卡)、同栈 `idle → running` 抖动不再误报完成、客户端在会话状态变化与标签页重新可见时立即拉取(保留 1.5s 兜底) |
|
|
110
112
|
| `0.3.3` | `0.1.7-rc.1` | 适配 DSH 0.1.7:后台任务完成走 `jobs.events.subscribe`,工具结果读取扁平化后的 tool-role 消息,卡片内回答读取 `uiSession.sessionStatus`,`@deepseek-ai/schemastery` 改为 peer |
|
|
@@ -118,7 +120,9 @@ dsh plugin --profile web add "link:$(pwd)"
|
|
|
118
120
|
|
|
119
121
|
- **`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`**。
|
|
120
122
|
- 两处声明决定插件能否加载:`dsh.engines.dsh` 与每一个 `@deepseek-ai/dsh-*` peer 都写同一条要求,自 `0.4.1` 起为 `>=0.1.7-rc.1 <0.3.0`。DSH 会在 profile 加载时拒绝不兼容的 bundle,范围写错就会静默丢掉插件——旧的 `<0.2.0` 上限在 `0.2.0` 正式版上正是如此。
|
|
123
|
+
- **交互门禁只在「还没等到人回答」时压住完成通知。** DSH 的执行审批与计划审批都是在**提问的那个回合内**解决的(`approval.request()` 必须处于打开的回合中并原地等待结果;`exit_plan_mode` 把结论交回同一回合),所以接着干活的回合就是提问的那个回合,它的结束就是用户任务的完成。`0.4.2` 以此为规则;`0.3.2`–`0.4.1` 压掉了整个回合,于是每个带审批的任务都静默丢失完成通知。
|
|
121
124
|
- `@deepseek-ai/schemastery` 是 **peer**,不是普通依赖:DSH 只会把 **link 形态**插件的 peer 解析到当前安装;若仍写成普通依赖,`link:` 安装的 Host 半会导入失败。
|
|
125
|
+
- **声明的是「实测验证过的版本」,不是语义化猜测。** `dsh.compatibility.dshReleases` 列出真正启动验证过的每个版本(截至 `0.4.2`:`0.1.7-rc.1`、`0.1.7-rc.2`、`0.2.0-rc.1`、`0.2.0-rc.2`、`0.2.1-alpha.1`),一旦其中某个落在声明范围之外,`npm run pack:check` 会直接失败。
|
|
122
126
|
|
|
123
127
|
同时在 390px 手机视口检查:设置控件会重排,Toast 会满宽显示且不会被移动端侧栏遮挡。
|
|
124
128
|
|
|
@@ -149,8 +153,8 @@ npm run pack:check # 发布前置条件 + 客户端注册校验
|
|
|
149
153
|
发版由 tag 驱动。更新 `package.json`、将对应 CHANGELOG 段落移出 `Unreleased`、编写 `release-notes/v<版本>.md` 后,推送发版提交与 tag:
|
|
150
154
|
|
|
151
155
|
```sh
|
|
152
|
-
git tag v0.4.
|
|
153
|
-
git push origin v0.4.
|
|
156
|
+
git tag v0.4.3
|
|
157
|
+
git push origin v0.4.3
|
|
154
158
|
```
|
|
155
159
|
|
|
156
160
|
发版工作流会运行 `npm run verify`、打包插件、通过 npm trusted publishing(OIDC)发布,并创建附带 tarball 与 sha256 的 GitHub Release。
|
package/dist/client.js
CHANGED
|
@@ -250,7 +250,11 @@ window.__ModuleLoader__.load({
|
|
|
250
250
|
.dsh-notify-settings .dsh-notify-toggle input{accent-color:var(--dsw-alias-state-business-primary);flex:0 0 18px;height:18px;margin:1px 0 0;max-width:18px;min-height:18px;min-width:18px;width:18px}
|
|
251
251
|
.dsh-notify-settings .dsh-notify-toggle>span{min-width:0;overflow-wrap:anywhere}
|
|
252
252
|
.dsh-notify-field{display:grid;font-size:13px;font-weight:600;gap:8px;min-width:0}
|
|
253
|
-
|
|
253
|
+
/* A bare font:inherit made this the one control that scaled with the host's content font size
|
|
254
|
+
(--dsh-content-font-size, default 14px and user-settable to 22px), while every label and control
|
|
255
|
+
around it is pinned \u2014 so the two selects sat visibly larger than their own card. Pin the size; the
|
|
256
|
+
inherited family still comes from font:inherit. */
|
|
257
|
+
.dsh-notify-select{background:var(--dsw-specific-input-major,var(--dsw-alias-bg-layer-2));border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;font:inherit;font-size:13px;font-weight:400;max-width:100%;min-height:36px;min-width:0;padding:0 10px;width:100%}
|
|
254
258
|
.dsh-notify-actions{align-items:center;display:flex;flex-wrap:wrap;gap:8px;min-width:0}
|
|
255
259
|
.dsh-notify-action{background:var(--dsw-alias-button-floating-fill);border:1px solid var(--dsw-alias-border-l2);border-radius:8px;color:inherit;cursor:pointer;font:inherit;font-size:12px;line-height:30px;max-width:100%;min-height:32px;padding:0 10px;touch-action:manipulation}
|
|
256
260
|
.dsh-notify-action:hover:not(:disabled){background:var(--dsw-alias-button-floating-hover)}
|
package/dist/index.js
CHANGED
|
@@ -199,23 +199,60 @@ export async function apply(ctx, config = {}) {
|
|
|
199
199
|
// A live user-questions/request has no source-proven causal callId, therefore
|
|
200
200
|
// this host must not infer one from an arrival queue or FIFO ordering.
|
|
201
201
|
const pendingToolCalls = new Map();
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
202
|
+
/**
|
|
203
|
+
* Plan reviews and execution approvals are control gates: the turn that asks one is not a finished
|
|
204
|
+
* task while the human still owes an answer. A gate therefore suppresses the completion of its turn
|
|
205
|
+
* only while it is still UNRESOLVED at that turn's end — and DSH resolves both gates inside the very
|
|
206
|
+
* turn that asked them (an approval is a `request()` that awaits its outcome and requires an open
|
|
207
|
+
* turn; `exit_plan_mode` returns its verdict to the same turn). In this machine's 362 real session
|
|
208
|
+
* logs, every one of the 81 approval/plan-review turns that ended normally had its work continue
|
|
209
|
+
* inside that same turn, and no gate turn was ever followed by a turn that did not start from a user
|
|
210
|
+
* message — so the turn end after a settlement is the user's task finishing and must be announced,
|
|
211
|
+
* and announcing it cannot duplicate anything. A gate still open at a turn end means that turn really
|
|
212
|
+
* did stop on the human, which is not news; that case should not arise live, and it is kept as the
|
|
213
|
+
* safe reading rather than a silent false completion.
|
|
214
|
+
*
|
|
215
|
+
* Only approvals and plan reviews suppress: an ordinary `ask_user_question` may itself be the last
|
|
216
|
+
* operation of a task, so its turn announces completion either way.
|
|
217
|
+
*/
|
|
218
|
+
const gates = new Map(); // sessionId -> Map<turn, Map<token, kind>>
|
|
219
|
+
const gateTokens = new Map(); // token -> { sessionId, turn, kind }
|
|
220
|
+
const GATE_KINDS = new Set(['approval', 'plan-review']);
|
|
221
|
+
const openGate = (sessionId, turn, kind, token) => {
|
|
222
|
+
if (typeof sessionId !== 'string' || sessionId === '') return;
|
|
207
223
|
if (!Number.isSafeInteger(turn) || turn <= 0) return;
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
turns.set(
|
|
224
|
+
if (typeof token !== 'string' || token === '') return;
|
|
225
|
+
let turns = gates.get(sessionId);
|
|
226
|
+
if (!turns) { turns = new Map(); gates.set(sessionId, turns); }
|
|
227
|
+
let tokens = turns.get(turn);
|
|
228
|
+
if (!tokens) { tokens = new Map(); turns.set(turn, tokens); }
|
|
229
|
+
tokens.set(token, kind);
|
|
230
|
+
gateTokens.set(token, { sessionId, turn, kind });
|
|
211
231
|
};
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
232
|
+
/** The gate settled: the human answered, so its turn is ordinary work from here on. */
|
|
233
|
+
const settleGate = (token) => {
|
|
234
|
+
const entry = typeof token === 'string' ? gateTokens.get(token) : undefined;
|
|
235
|
+
if (!entry) return;
|
|
236
|
+
gateTokens.delete(token);
|
|
237
|
+
const tokens = gates.get(entry.sessionId)?.get(entry.turn);
|
|
238
|
+
if (!tokens) return;
|
|
239
|
+
tokens.delete(token);
|
|
240
|
+
if (!tokens.size) gates.get(entry.sessionId).delete(entry.turn);
|
|
241
|
+
if (!gates.get(entry.sessionId).size) gates.delete(entry.sessionId);
|
|
242
|
+
};
|
|
243
|
+
/** Evaluate and forget a turn's gates: a turn end owns its own bookkeeping either way. */
|
|
244
|
+
const unresolvedGateAt = (sessionId, turn) => {
|
|
245
|
+
const turns = gates.get(sessionId);
|
|
246
|
+
const tokens = turns?.get(turn);
|
|
247
|
+
if (!tokens) return undefined;
|
|
248
|
+
let blocking;
|
|
249
|
+
for (const [token, kind] of tokens) {
|
|
250
|
+
if (GATE_KINDS.has(kind)) { blocking = kind; break; }
|
|
251
|
+
}
|
|
216
252
|
turns.delete(turn);
|
|
217
|
-
if (!turns.size)
|
|
218
|
-
|
|
253
|
+
if (!turns.size) gates.delete(sessionId);
|
|
254
|
+
for (const token of tokens.keys()) gateTokens.delete(token);
|
|
255
|
+
return blocking;
|
|
219
256
|
};
|
|
220
257
|
const pendingFor = (sessionId) => {
|
|
221
258
|
let calls = pendingToolCalls.get(sessionId);
|
|
@@ -354,7 +391,9 @@ export async function apply(ctx, config = {}) {
|
|
|
354
391
|
const sessionId = session?.id;
|
|
355
392
|
if (Number.isSafeInteger(data.turn) && data.turn > 0) liveTurns.set(sessionId, data.turn);
|
|
356
393
|
if (event?.type === 'tool/call' && data.callId && (data.name === 'ask_user_question' || data.name === 'exit_plan_mode')) {
|
|
357
|
-
|
|
394
|
+
// A plan review gates its turn until the verdict returns to it; an ordinary question does not
|
|
395
|
+
// (it may be the last operation of the task), so only the plan review opens a gate here.
|
|
396
|
+
if (data.name === 'exit_plan_mode') openGate(sessionId, turnOf(sessionId, data), 'plan-review', `call:${data.callId}`);
|
|
358
397
|
pendingFor(sessionId).add(data.callId);
|
|
359
398
|
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) });
|
|
360
399
|
safely(() => dispatch(interaction));
|
|
@@ -370,6 +409,8 @@ export async function apply(ctx, config = {}) {
|
|
|
370
409
|
const callId = message.toolCallId ?? nested?.toolCallId;
|
|
371
410
|
if (!callId) return; // Unlinked records cannot be guessed closed by an uncorrelated result.
|
|
372
411
|
removePending(sessionId, callId);
|
|
412
|
+
// The gated call returned, so the human's verdict is in hand and the turn is ordinary work again.
|
|
413
|
+
settleGate(`call:${callId}`);
|
|
373
414
|
const failed = message.isError === true || nested?.isError === true || data.outcome === 'abort';
|
|
374
415
|
const existing = reducer.questionResult({ sessionId, callId, outcome: failed ? 'abort' : 'settled' });
|
|
375
416
|
if (existing) safely(() => dispatch(existing));
|
|
@@ -379,9 +420,12 @@ export async function apply(ctx, config = {}) {
|
|
|
379
420
|
// Work resumed: whatever turn end is still pending for this session was not the end of the task.
|
|
380
421
|
if (event?.type === 'turn/start' || event?.type === 'tool/call') cancelCompletion(sessionId);
|
|
381
422
|
if (event?.type === 'approval/asked') {
|
|
382
|
-
|
|
423
|
+
openGate(sessionId, turnOf(sessionId, data), 'approval', `approval:${data.id}`);
|
|
383
424
|
await dispatch(reducer.approvalAsked({ ...data, turn: turnOf(sessionId, data) }, sessionId));
|
|
384
|
-
} else if (event?.type === 'approval/decided')
|
|
425
|
+
} else if (event?.type === 'approval/decided') {
|
|
426
|
+
settleGate(`approval:${data.id}`);
|
|
427
|
+
await dispatch(reducer.approvalDecided(data.id, data.outcome));
|
|
428
|
+
}
|
|
385
429
|
else if (event?.type === 'turn/end') {
|
|
386
430
|
const error = pendingErrors.get(`${sessionId}:${data.turn}`);
|
|
387
431
|
pendingErrors.delete(`${sessionId}:${data.turn}`);
|
|
@@ -389,12 +433,10 @@ export async function apply(ctx, config = {}) {
|
|
|
389
433
|
// leftover whose decision event was never observed, and one leftover used to shadow every
|
|
390
434
|
// later toast. Persist the expiry before the completion notification.
|
|
391
435
|
for (const stale of reducer.expireOpenForSession(sessionId)) await dispatch(stale);
|
|
392
|
-
//
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
deferCompletion(sessionId, { sessionId, turn: data.turn, reason: data.reason, body: error?.message || String(error || ''), origin: originOf(session) });
|
|
397
|
-
}
|
|
436
|
+
// A control gate swallows this turn's completion only while the human still owes an answer.
|
|
437
|
+
if (unresolvedGateAt(sessionId, data.turn) === undefined) {
|
|
438
|
+
deferCompletion(sessionId, { sessionId, turn: data.turn, reason: data.reason, body: error?.message || String(error || ''), origin: originOf(session) });
|
|
439
|
+
}
|
|
398
440
|
}
|
|
399
441
|
});
|
|
400
442
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@idoall/dsh-notify",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.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",
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
"dshReleases": {
|
|
39
39
|
"0.1.7-rc.1": "compatible",
|
|
40
40
|
"0.1.7-rc.2": "compatible",
|
|
41
|
-
"0.2.0-rc.1": "compatible"
|
|
41
|
+
"0.2.0-rc.1": "compatible",
|
|
42
|
+
"0.2.0-rc.2": "compatible",
|
|
43
|
+
"0.2.1-alpha.1": "compatible"
|
|
42
44
|
}
|
|
43
45
|
}
|
|
44
46
|
},
|