@idoall/dsh-notify 0.4.1 → 0.4.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/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
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.2] - 2026-10-06
6
+
7
+ ### Fixed
8
+
9
+ - **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.
10
+
11
+ ### Changed
12
+
13
+ - **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.
14
+
15
+ ### Verified
16
+
17
+ - **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.
18
+ - 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.
19
+ - 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.
20
+ - **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.
21
+ - **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.
22
+ - Full verification passed: static source checks, **110 automated tests**, build, and package precondition checks.
23
+
5
24
  ## [0.4.1] - 2026-09-29
6
25
 
7
26
  ### 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.0--rc.1-4B6BFB" alt="DSH 0.2.0-rc.1">
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.0-rc.1`
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,12 @@ 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.1`** is verified against DeepSeek Harness **`0.2.0-rc.1`**.
103
+ Current release: plugin **`0.4.2`** 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.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 |
107
+ | **`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 |
108
+ | `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
109
  | `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
110
  | `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
111
  | `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 +119,9 @@ Current release: plugin **`0.4.1`** is verified against DeepSeek Harness **`0.2.
118
119
 
119
120
  - **`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
121
  - 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.
122
+ - **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
123
  - `@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.
124
+ - **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
125
 
123
126
  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
127
 
@@ -149,8 +152,8 @@ npm run pack:check # publish preconditions + client registration check
149
152
  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
153
 
151
154
  ```sh
152
- git tag v0.4.1
153
- git push origin v0.4.1
155
+ git tag v0.4.2
156
+ git push origin v0.4.2
154
157
  ```
155
158
 
156
159
  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.0--rc.1-4B6BFB" alt="DSH 0.2.0-rc.1">
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.0-rc.1`
49
+ - 已验证的 DeepSeek Harness:`0.2.1-alpha.1`
50
50
 
51
51
  从 npm 安装:
52
52
 
@@ -100,11 +100,12 @@ dsh plugin --profile web add "link:$(pwd)"
100
100
 
101
101
  ## 兼容性
102
102
 
103
- 当前发布:插件 **`0.4.1`** 已在 DeepSeek Harness **`0.2.0-rc.1`** 上验证。
103
+ 当前发布:插件 **`0.4.2`** 已在 DeepSeek Harness **`0.2.1-alpha.1`** 上验证。
104
104
 
105
105
  | 插件 | 已验证的 DeepSeek Harness | 这一版是什么 |
106
106
  | --- | --- | --- |
107
- | **`0.4.1`** | `0.2.0-rc.1` | 兼容性跟进:声明支持 DSH `0.2.0` 线(`>=0.1.7-rc.1 <0.3.0`),`0.2.0` 正式版发布时插件不会再在 profile 加载阶段被丢弃。无源码改动——它绑定的接口都没有变化 |
107
+ | **`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` 本来就接纳它们 |
108
+ | `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
109
  | `0.4.0` | `0.1.7-rc.2` | 设置 → 通知新增在线版本检测:当前版本 vs npm 最新版、手动**检查更新**(`?force=1`)、仓库/更新日志/Issue 入口,以及可复制的升级命令——只读、带缓存,绝不自动安装、绝不重启 |
109
110
  | `0.3.4` | `0.1.7-rc.1` | 触发时序修复:失败在 `agent/error` 时即投递(与 `turn/end` 共用同一张卡)、同栈 `idle → running` 抖动不再误报完成、客户端在会话状态变化与标签页重新可见时立即拉取(保留 1.5s 兜底) |
110
111
  | `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 +119,9 @@ dsh plugin --profile web add "link:$(pwd)"
118
119
 
119
120
  - **`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
121
  - 两处声明决定插件能否加载:`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` 正式版上正是如此。
122
+ - **交互门禁只在「还没等到人回答」时压住完成通知。** DSH 的执行审批与计划审批都是在**提问的那个回合内**解决的(`approval.request()` 必须处于打开的回合中并原地等待结果;`exit_plan_mode` 把结论交回同一回合),所以接着干活的回合就是提问的那个回合,它的结束就是用户任务的完成。`0.4.2` 以此为规则;`0.3.2`–`0.4.1` 压掉了整个回合,于是每个带审批的任务都静默丢失完成通知。
121
123
  - `@deepseek-ai/schemastery` 是 **peer**,不是普通依赖:DSH 只会把 **link 形态**插件的 peer 解析到当前安装;若仍写成普通依赖,`link:` 安装的 Host 半会导入失败。
124
+ - **声明的是「实测验证过的版本」,不是语义化猜测。** `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
125
 
123
126
  同时在 390px 手机视口检查:设置控件会重排,Toast 会满宽显示且不会被移动端侧栏遮挡。
124
127
 
@@ -149,8 +152,8 @@ npm run pack:check # 发布前置条件 + 客户端注册校验
149
152
  发版由 tag 驱动。更新 `package.json`、将对应 CHANGELOG 段落移出 `Unreleased`、编写 `release-notes/v<版本>.md` 后,推送发版提交与 tag:
150
153
 
151
154
  ```sh
152
- git tag v0.4.1
153
- git push origin v0.4.1
155
+ git tag v0.4.2
156
+ git push origin v0.4.2
154
157
  ```
155
158
 
156
159
  发版工作流会运行 `npm run verify`、打包插件、通过 npm trusted publishing(OIDC)发布,并创建附带 tarball 与 sha256 的 GitHub Release。
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
- // Plan reviews and execution approvals are control gates: their idle pause is not task completion.
203
- // An ordinary question can instead be the last operation of a task, so retain its kind and allow that
204
- // directly-settled turn to announce completion once native DSH reaches idle.
205
- const interactiveTurns = new Map();
206
- const markInteractiveTurn = (sessionId, turn, kind = 'question') => {
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
- let turns = interactiveTurns.get(sessionId);
209
- if (!turns) { turns = new Map(); interactiveTurns.set(sessionId, turns); }
210
- turns.set(turn, kind);
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
- const consumeInteractiveTurn = (sessionId, turn) => {
213
- const turns = interactiveTurns.get(sessionId);
214
- if (!turns || !turns.has(turn)) return undefined;
215
- const kind = turns.get(turn);
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) interactiveTurns.delete(sessionId);
218
- return kind;
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
- markInteractiveTurn(sessionId, turnOf(sessionId, data), data.name === 'exit_plan_mode' ? 'plan-review' : 'question');
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
- markInteractiveTurn(sessionId, turnOf(sessionId, data), 'approval');
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') await dispatch(reducer.approvalDecided(data.id, data.outcome));
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
- // Plan reviews and execution approvals are intermediate native-idle control gates. An ordinary
393
- // question may directly finish the task after the user answers, so only the gates are suppressed.
394
- const interactionKind = consumeInteractiveTurn(sessionId, data.turn);
395
- if (interactionKind !== 'plan-review' && interactionKind !== 'approval') {
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.1",
3
+ "version": "0.4.2",
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
  },