@kangyishuai/dsh-next-step 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > A next-step decision card for DeepSeek Harness: after every completed answer, a compact card under it shows where the conversation stands, the question you need to settle, and two mutually exclusive proposals. Click one and that pill's text — exactly as written on it — is sent as your user message. Optionally — off by default — a grey ghost hint in the empty composer offers the next prompt, accepted with `Tab` or `→`.
4
4
 
5
- [![npm](https://img.shields.io/npm/v/@kangyishuai/dsh-next-step?color=cb3837&logo=npm)](https://www.npmjs.com/package/@kangyishuai/dsh-next-step) [![DSH](https://img.shields.io/badge/verified%20on%20DSH-0.2.2--rc.2-4b6bfb)](#compatibility) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
5
+ [![npm](https://img.shields.io/npm/v/@kangyishuai/dsh-next-step?color=cb3837&logo=npm)](https://www.npmjs.com/package/@kangyishuai/dsh-next-step) [![DSH](https://img.shields.io/badge/verified%20on%20DSH-0.2.2--rc.3-4b6bfb)](#compatibility) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
6
6
 
7
7
  [中文](./README.zh-CN.md)
8
8
 
@@ -25,7 +25,7 @@ Unofficial plugin for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/de
25
25
  ## Cost & model calls
26
26
 
27
27
  - One extra model call per trigger, on the model the session's agent is currently using (falling back to the default model selection), billed to your own provider quota.
28
- - The call times out after 20 s. Failures, rate limits and malformed JSON are silent: no card, no dialog — only a counter in the plugin's diagnostics. Malformed output is dropped without writing a record.
28
+ - The call times out after 20 s. Other failures, rate limits and malformed JSON are silent: no card, no dialog — only a counter in the plugin's diagnostics. A **timeout or cancellation** is counted separately (the `aborted` counter plus a "Last skipped" reason such as `generation timeout after 20s`), and the generate button then says the generation timed out or was cancelled — so this class stays diagnosable afterwards. Malformed output is dropped without writing a record.
29
29
  - When the model decides the turn is not worth continuing, no card is written — but **the call still happens**: this saves UI noise, not tokens. The model's reason is kept in the settings row's “Last skipped” line.
30
30
  - No other network access, no telemetry.
31
31
 
@@ -37,7 +37,7 @@ Unofficial plugin for [DeepSeek Harness (DSH)](https://github.com/deepseek-ai/de
37
37
  - **What is sent is a normal user message.** It enters the model context and is visible in the transcript exactly as if you had typed it.
38
38
  - **Private host seams.** The card renders through `conversation.chat.turnTail`; state comes from a host session projection read via `useProjection`; click-to-send uses the composer shell (`setDraft` / `submit`, waiting for the draft to settle before submitting); the ghost uses `conversation.input.overlay` and the host's placeholder DOM. These are internal, untyped and unversioned: a DSH upgrade can make the card, the send path or the ghost stop working **silently**. The plugin degrades instead of breaking a session, but after an upgrade run `pnpm probe:runtime` and the smoke suites, and check diagnostics.
39
39
  - **The ghost is coupled to the host placeholder DOM**, which is why it ships off by default; if that DOM changes, the hint can simply disappear.
40
- - **Silent failure is by design.** “No card appeared” is not an error dialog; look at the diagnostics counters before filing a bug.
40
+ - **Silent failure is by design.** “No card appeared” is not an error dialog; look at the diagnostics counters before filing a bug. Timeouts and cancellations are the one exception worth knowing: they are labelled rather than lumped into a generic failure, because an unlabelled abort is what made one “no card” incident undiagnosable.
41
41
  - **No plugin data directory and no workspace files.** Everything lives in the existing session log; nothing is written under `DSH_HOME` besides the session itself.
42
42
  - **Subagent sessions never get cards**, and only normally completed turns are eligible.
43
43
 
@@ -77,7 +77,7 @@ Settings → **Next-step suggestions** (its own section now, no longer a row bur
77
77
  - **Decision card under the answer** / **Ghost hint in the composer** — one switch per face.
78
78
  - **Cadence** — “Pause for 1 hour” / “Resume”.
79
79
  - **Per session, at most N cards** — the budget (`maxCardsPerSession`, clamped to 0–1000).
80
- - **Diagnostics** — generated / failed / skipped / in-flight counters, the **reason the last card was skipped** (model judged unnecessary / queued / paused / budget / failure, with the model's own sentence), the last error, the runtime **version + build hash**, and a Refresh button. `nextStep/diagnostics` returns the same `version` / `buildHash` / `buildFiles` / `packagePath`, so a running build can be matched against `dsh plugin list` or the npm tarball without digging through startup logs.
80
+ - **Diagnostics** — generated / failed / aborted / skipped / in-flight counters, the **reason the last card was skipped** (model judged unnecessary / queued / paused / budget / failure / timeout / cancelled, with the model's own sentence), the last error, the runtime **version + build hash**, and a Refresh button. `nextStep/diagnostics` returns the same `version` / `buildHash` / `buildFiles` / `packagePath`, so a running build can be matched against `dsh plugin list` or the npm tarball without digging through startup logs.
81
81
 
82
82
  Turning the global switch off **hides every dependent row** (card / ghost / pause / budget / diagnostics) and leaves just the switch plus one line of explanation — off means off, nothing looks like it still runs, and re-enabling restores the previous switch values.
83
83
 
@@ -85,18 +85,19 @@ The row writes the same `$DSH_HOME/next-step.settings.json` that the host re-rea
85
85
 
86
86
  ## When no card appears
87
87
 
88
- | Situation | What happens |
89
- | ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- |
90
- | The turn was stopped, errored, or produced no text | No card: only normally completed turns are eligible. |
91
- | Subagent session | No card, by design. |
92
- | Global switch off | No request is made at all; existing cards remain in the transcript. |
93
- | Paused, or the session's card budget (`maxCardsPerSession`) used up | No new card; existing cards stay. |
94
- | A card or a decision already exists for that turn | One card per turn; no duplicates. |
95
- | The model judges the turn not worth continuing (`needed=false`) | No card; “Last skipped” in diagnostics shows the model's reason. |
96
- | Model call failed, timed out (20 s), was rate-limited, bad JSON | Silent; only a diagnostics counter goes up. |
97
- | The reply is still streaming | Nothing is rendered for the turn until it ends. |
98
- | The composer already has a draft | The card is visible but the pills are disabled until the draft is cleared. |
99
- | Ghost face on, but the composer is not plain (draft, attachment, `@`, `/`, or a non-idle session) | The hint stays hidden. |
88
+ | Situation | What happens |
89
+ | ------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
90
+ | The turn was stopped, errored, or produced no text | No card: only normally completed turns are eligible. |
91
+ | Subagent session | No card, by design. |
92
+ | Global switch off | No request is made at all; existing cards remain in the transcript. |
93
+ | Paused, or the session's card budget (`maxCardsPerSession`) used up | No new card; existing cards stay. |
94
+ | A card or a decision already exists for that turn | One card per turn; no duplicates. |
95
+ | The model judges the turn not worth continuing (`needed=false`) | No card; “Last skipped” in diagnostics shows the model's reason. |
96
+ | Model call failed, was rate-limited, bad JSON | Silent; only a diagnostics counter goes up. |
97
+ | The generation **timed out (20 s) or was cancelled** | Counted in `aborted`; “Last skipped” says which, and the generate button reports it. No dialog. |
98
+ | The reply is still streaming | Nothing is rendered for the turn until it ends. |
99
+ | The composer already has a draft | The card is visible but the pills are disabled until the draft is cleared. |
100
+ | Ghost face on, but the composer is not plain (draft, attachment, `@`, `/`, or a non-idle session) | The hint stays hidden. |
100
101
 
101
102
  ## Known limitations
102
103
 
@@ -114,10 +115,11 @@ The row writes the same `$DSH_HOME/next-step.settings.json` that the host re-rea
114
115
 
115
116
  ## Compatibility
116
117
 
117
- | DSH version | Status |
118
- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
119
- | 0.2.2-rc.2 | Verified 2026-11-12: unit tests + `pnpm probe:runtime` 67/67 + web `smoke:next-step` in no-model mode (`SMOKE_NO_MODEL=1`: 7 passing + 7 skipped — host boot, plugin activation, page usable, session log layout). The card pipeline needs a real model call and was not re-run on this version. Desktop on the live app over CDP: 22/22 read-only + `--deep --workspace` 33 passing + 2 skipped (real model call: new session → prompt → generated card → pill click; skips are data-dependent branches). |
120
- | 0.2.2-rc.1 | Full regression green on 2026-11-11: web composition end-to-end (`pnpm smoke:next-step`: 59 assertions passing, 0 skipped; real host + real model calls, covering WYSIWYG sending, the picked-option echo, the `needed` gate and the force-generate button, and the progressive settings), desktop real-machine `pnpm smoke:next-step-desktop --require --deep` (32 passing + 3 skipped + 0 failing on the pre-release tarball, build `1ba08e8b`; the published 0.2.0 self-reports `version 0.2.0, build ce72c9dd` — the hash covers `package.json`, so the version bump changes it; every skip is a data-dependent branch), 83 unit tests, runtime probe 60/60, and `pnpm gate next-step` green across all four steps. Other DSH versions are not verified. |
118
+ | DSH version | Status |
119
+ | ----------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120
+ | 0.2.2-rc.3 | **0.3.0** (2026-11-14): no code change needed for this DSH build. Verified: 99 unit tests + `pnpm probe:runtime` 72/72 + web `pnpm smoke:next-step` **59/59** (real host + real model call) + desktop read-only regression **10 PASS + 2 SKIP**. The first web run reported 2 transient failures while three desktop regressions ran concurrently (the card's extra completion call failed); a solo re-run was 59/59 — see [runtime 0.2.2-rc.3 §7](../../docs/runtime/0.2.2-rc.3.md). |
121
+ | 0.2.2-rc.2 | **0.3.0** (2026-11-14): pill labels tightened to 2–20 characters and must name a concrete object (generic pills are dropped), 1–2 options instead of exactly 2, summaries must state checkable facts, two new cheap gates (previous turn errored / answer under 80 characters), ghost hint capped at 150 characters and degraded when it disagrees with the recommended pill; settings moved to their own "Settings → Next-step suggestions" section. Verified: 58 unit tests (50 prompt + 8 gates) + `pnpm probe:runtime` 72/72 + web `pnpm smoke:next-step` **59/59** (real host, real model call). The settings section was also checked on a live desktop build via read-only CDP; the desktop read-only regression reports **10 PASS + 2 SKIP** (the SKIPs are "no card in this session" and "read-only mode does not create cards"); `--deep` card interaction reports **23 PASS + 2 SKIP** (real model call — the one-sentence fixture is blocked by the new "answer under 80 characters" gate, so the run exercises the generate-now fallback, which also verifies that gate). |
122
+ | 0.2.2-rc.1 | Full regression green on 2026-11-11: web composition end-to-end (`pnpm smoke:next-step`: 59 assertions passing, 0 skipped; real host + real model calls, covering WYSIWYG sending, the picked-option echo, the `needed` gate and the force-generate button, and the progressive settings), desktop real-machine `pnpm smoke:next-step-desktop --require --deep` (32 passing + 3 skipped + 0 failing on the pre-release tarball, build `1ba08e8b`; the published 0.2.0 self-reports `version 0.2.0, build ce72c9dd` — the hash covers `package.json`, so the version bump changes it; every skip is a data-dependent branch), 83 unit tests, runtime probe 60/60, and `pnpm gate next-step` green across all four steps. Other DSH versions are not verified. |
121
123
 
122
124
  The plugin declares no `engines.dsh` and no `@deepseek-ai/*` peer range: DSH is pre-release and semver ranges over prereleases are unreliable (see [ADR 0005](../../docs/adr/0005-dsh-version-compatibility.md)). Treat the table as the compatibility statement. After a DSH upgrade run `pnpm probe:runtime`, `pnpm smoke:next-step` and `pnpm smoke:next-step-desktop`, then check the plugin's diagnostics.
123
125
 
package/README.zh-CN.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > DeepSeek Harness 的「下一步决策卡」:每条完整回答下方给一张小卡片,写清对话现状、需要你拍板的问题,以及两条互斥的下一步建议;点哪一句,就把那句**原样**作为用户消息发出(所见即所发)。模型判断这一轮不值得继续时不出卡。可选(默认关)在空输入框里给一条灰色幽灵提示,`Tab` / `→` 接受。
4
4
 
5
- [![npm](https://img.shields.io/npm/v/@kangyishuai/dsh-next-step?color=cb3837&logo=npm)](https://www.npmjs.com/package/@kangyishuai/dsh-next-step) [![DSH](https://img.shields.io/badge/verified%20on%20DSH-0.2.2--rc.2-4b6bfb)](#兼容性) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
5
+ [![npm](https://img.shields.io/npm/v/@kangyishuai/dsh-next-step?color=cb3837&logo=npm)](https://www.npmjs.com/package/@kangyishuai/dsh-next-step) [![DSH](https://img.shields.io/badge/verified%20on%20DSH-0.2.2--rc.3-4b6bfb)](#兼容性) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE)
6
6
 
7
7
  [English](./README.md)
8
8
 
@@ -25,7 +25,7 @@
25
25
  ## 成本
26
26
 
27
27
  - 每次触发多一次模型调用,用会话所在智能体当前的模型(取不到时回退到默认模型选择),**占用你自己的 provider 额度**。
28
- - 这次调用 20 秒超时。失败、限流、JSON 不合法都**静默**:不出卡、不弹框,只在插件诊断里加计数。不合法输出直接丢弃,不写记录。
28
+ - 这次调用 20 秒超时。其它失败、限流、JSON 不合法都**静默**:不出卡、不弹框,只在插件诊断里加计数。**超时 / 被取消**单独计数(`aborted`,并在「最近跳过」写明 `generation timeout after 20s`),补生成按钮也会显示「生成超时或被取消」,所以这一类事后可诊断。不合法输出直接丢弃,不写记录。
29
29
  - 模型判断「不需要继续」时也不出卡,但**这次调用已经发生**:省的是界面噪音,不是 token。想看模型给出的理由,去设置页诊断里的「最近跳过」。
30
30
  - 除此之外不联网,不上报。
31
31
 
@@ -37,7 +37,7 @@
37
37
  - **发出去的就是普通用户消息。** 它进入模型上下文、出现在对话里,和你自己打字完全一样。
38
38
  - **依赖宿主私有 seam。** 卡片渲染走 `conversation.chat.turnTail`;状态来自宿主 session projection(客户端用 `useProjection` 读);点击发送走 composer shell 的 `setDraft` / `submit`(提交前等草稿落定);幽灵提示走 `conversation.input.overlay` 和宿主 placeholder 的 DOM。这些都没有类型、没有版本契约:DSH 升级可能让卡片、发送链或幽灵提示**静默失效**。插件会降级而不是弄坏会话,但升级后请跑 `pnpm probe:runtime`、两个冒烟套件,并看诊断。
39
39
  - **幽灵提示和宿主 placeholder DOM 绑在一起**,这也是它默认关的原因;宿主改了那块 DOM,它就只是不显示了。
40
- - **失败静默是设计。**「没出卡」不是错误弹窗;先看诊断计数再判断是不是 bug。
40
+ - **失败静默是设计。**「没出卡」不是错误弹窗;先看诊断计数再判断是不是 bug。超时与取消是唯一值得单独知道的例外:它们会被标成自己的原因,而不是混进笼统的失败——之前正因为中止无痕,一次「没出卡」完全没法定位。
41
41
  - **没有插件数据目录,也不碰工作区文件。** 所有东西都在已有的会话日志里,`DSH_HOME` 下不额外写数据。
42
42
  - **子代理会话不出卡**,被停止、报错或没有文本的回合同样不出卡。
43
43
 
@@ -71,13 +71,13 @@ dsh plugin --profile desktop add /tmp/kangyishuai-dsh-next-step-*.tgz
71
71
 
72
72
  ## 设置与诊断
73
73
 
74
- 设置 → **通用** → 「下一步建议」是一行完整控制项:
74
+ 设置 → **下一步建议**(独立分节)就是一整页控制项:
75
75
 
76
76
  - **启用插件** —— 总开关。关掉之后**完全不发请求**,不是把界面藏起来。
77
77
  - **回答下方的决策卡** / **输入框里的幽灵提示** —— 每个面一个开关。
78
78
  - **生成节奏** —— 「暂停 1 小时」/「恢复生成」。
79
79
  - **每会话最多 N 张卡** —— 预算(`maxCardsPerSession`,夹在 0–1000)。
80
- - **诊断** —— 已生成 / 失败 / 跳过 / 在途计数、**最近一次没出卡的原因**(模型判断不需要 / 排队 / 暂停 / 预算 / 失败,附模型给的理由)、最近错误、**运行时版本 + 构建哈希**、刷新按钮。`nextStep/diagnostics` 同样返回 `version` / `buildHash` / `buildFiles` / `packagePath` 与 `lastSkip`,所以运行中的构建可以和 `dsh plugin list` 或 npm 上的 tarball 对照,不需要翻启动日志。
80
+ - **诊断** —— 已生成 / 失败 / 已中止 / 跳过 / 在途计数、**最近一次没出卡的原因**(模型判断不需要 / 排队 / 暂停 / 预算 / 失败 / 超时 / 取消,附模型给的理由)、最近错误、**运行时版本 + 构建哈希**、刷新按钮。`nextStep/diagnostics` 同样返回 `version` / `buildHash` / `buildFiles` / `packagePath` 与 `lastSkip`,所以运行中的构建可以和 `dsh plugin list` 或 npm 上的 tarball 对照,不需要翻启动日志。
81
81
 
82
82
  关闭总开关后,卡片 / 幽灵 / 暂停 / 预算 / 诊断这些依赖项会**整段隐藏**,只留总开关和一行说明——关掉就是关掉,不会让人以为还有东西在跑;重新启用时这些开关的取值都还在。
83
83
 
@@ -85,18 +85,19 @@ dsh plugin --profile desktop add /tmp/kangyishuai-dsh-next-step-*.tgz
85
85
 
86
86
  ## 什么情况下不出卡
87
87
 
88
- | 情况 | 表现 |
89
- | ------------------------------------------------------- | ---------------------------------------- |
90
- | 回合被停止、报错,或没有文本 | 不出卡:只有正常结束的回合才有资格。 |
91
- | 子代理会话 | 按设计不出卡。 |
92
- | 全局开关关闭 | 完全不发请求;已有卡片仍然留在对话里。 |
93
- | 已暂停,或用完该会话的卡片预算(`maxCardsPerSession`) | 不出新卡;已有卡片保留。 |
94
- | 该轮已经有 card 或 decision 记录 | 一轮最多一张卡,不重复。 |
95
- | 模型判断这一轮不需要继续(`needed=false`) | 不出卡;诊断里「最近跳过」写明理由。 |
96
- | 模型调用失败、20 秒超时、限流、JSON 不合法 | 静默;只有诊断计数增加。 |
97
- | 回答还在流式输出 | 该轮结束前槽位不渲染。 |
98
- | 输入框里已有草稿 | 卡片照常显示,但胶囊禁用,直到清空草稿。 |
99
- | ghost 开着,但草稿、附件、`@`、`/` 或输入状态不满足条件 | 提示隐藏。 |
88
+ | 情况 | 表现 |
89
+ | ------------------------------------------------------- | ---------------------------------------------------------------------- |
90
+ | 回合被停止、报错,或没有文本 | 不出卡:只有正常结束的回合才有资格。 |
91
+ | 子代理会话 | 按设计不出卡。 |
92
+ | 全局开关关闭 | 完全不发请求;已有卡片仍然留在对话里。 |
93
+ | 已暂停,或用完该会话的卡片预算(`maxCardsPerSession`) | 不出新卡;已有卡片保留。 |
94
+ | 该轮已经有 card 或 decision 记录 | 一轮最多一张卡,不重复。 |
95
+ | 模型判断这一轮不需要继续(`needed=false`) | 不出卡;诊断里「最近跳过」写明理由。 |
96
+ | 模型调用失败、限流、JSON 不合法 | 静默;只有诊断计数增加。 |
97
+ | 生成**超时(20 秒)或被取消** | 计入 `aborted`;「最近跳过」写明是哪一种,补生成按钮也会显示。不弹框。 |
98
+ | 回答还在流式输出 | 该轮结束前槽位不渲染。 |
99
+ | 输入框里已有草稿 | 卡片照常显示,但胶囊禁用,直到清空草稿。 |
100
+ | ghost 开着,但草稿、附件、`@`、`/` 或输入状态不满足条件 | 提示隐藏。 |
100
101
 
101
102
  ## 已知限制
102
103
 
@@ -114,10 +115,11 @@ dsh plugin --profile desktop add /tmp/kangyishuai-dsh-next-step-*.tgz
114
115
 
115
116
  ## 兼容性
116
117
 
117
- | DSH 版本 | 状态 |
118
- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
119
- | 0.2.2-rc.2 | 2026-11-12 已验证:单测 + `pnpm probe:runtime` 67/67 + Web `smoke:next-step` 无模型模式(`SMOKE_NO_MODEL=1`:7 PASS + 7 SKIP——宿主启动、插件激活、页面可用、会话日志对得上)。卡片链路需要真实模型调用,本版本未复跑。桌面(live 桌面版,CDP):只读 22/22 + `--deep --workspace` 33 PASS + 2 SKIP(真实模型调用:新建会话 → 发提示词 → 生成/补生成卡片 → 点胶囊;SKIP 是数据相关分支)。 |
120
- | 0.2.2-rc.1 | 2026-11-11 全量回归通过:web 组合端到端(`pnpm smoke:next-step`:59 项断言全部通过 + 0 SKIP;真实宿主 + 真实模型调用,覆盖 WYSIWYG 发送、点后回显、`needed` 门控与补生成按钮、设置渐进披露)、桌面真机 `pnpm smoke:next-step-desktop --require --deep`(32 PASS + 3 SKIP + 0 FAIL,发版前 tarball 构建 `1ba08e8b`;发布后 0.2.0 只读自证 20 PASS + 2 SKIP,诊断 `版本 0.2.0 · 构建 ce72c9dd`,哈希含 `package.json` 版本故与发版前不同)、单测 83 项、宿主探针 60/60、`pnpm gate next-step` 四步全绿。其他 DSH 版本未验证。 |
118
+ | DSH 版本 | 状态 |
119
+ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
120
+ | 0.2.2-rc.3 | **0.3.0**(2026-11-14):这一版 DSH 不需要改代码。已验证:99 项单测 + `pnpm probe:runtime` 72/72 + web `pnpm smoke:next-step` **59/59**(真实宿主 + 真实模型调用)+ 桌面只读回归 **10 PASS + 2 SKIP**。首跑有 2 项瞬时失败(与三条桌面回归并发时卡片的补生成调用失败),单独重跑 59/59——见 [runtime 0.2.2-rc.3 §7](../../docs/runtime/0.2.2-rc.3.md)。 |
121
+ | 0.2.2-rc.2 | **0.3.0**(2026-11-14):胶囊文案收紧到 2–20 字且必须含具体对象(泛化按钮直接丢弃)、选项 1–2 条、摘要要求写事实、新增「上轮报错 / 回答 < 80 字」两道便宜闸、幽灵提示 150 字上限 + 与推荐项一致性退化;设置搬到「设置 → 下一步建议」分节。已验证:单测 58(prompt 50 + gates 8)+ `pnpm probe:runtime` 72/72 + web `pnpm smoke:next-step` **59/59**(真实宿主 + 真实模型调用)。设置分节另有真机只读 CDP 核验;桌面只读回归 **10 PASS + 2 SKIP**(SKIP 是「当前会话没有决策卡」与「只读模式不造卡」);`--deep` 造卡交互 **23 PASS + 2 SKIP**(真实模型调用;一句话提示词会被「回答 < 80 字」闸挡住,走的是补生成按钮那条兜底,顺带验证了闸)。 |
122
+ | 0.2.2-rc.1 | 2026-11-11 全量回归通过:web 组合端到端(`pnpm smoke:next-step`:59 项断言全部通过 + 0 SKIP;真实宿主 + 真实模型调用,覆盖 WYSIWYG 发送、点后回显、`needed` 门控与补生成按钮、设置渐进披露)、桌面真机 `pnpm smoke:next-step-desktop --require --deep`(32 PASS + 3 SKIP + 0 FAIL,发版前 tarball 构建 `1ba08e8b`;发布后 0.2.0 只读自证 20 PASS + 2 SKIP,诊断 `版本 0.2.0 · 构建 ce72c9dd`,哈希含 `package.json` 版本故与发版前不同)、单测 83 项、宿主探针 60/60、`pnpm gate next-step` 四步全绿。其他 DSH 版本未验证。 |
121
123
 
122
124
  插件不声明 `engines.dsh`,也不声明 `@deepseek-ai/*` 的 peer 范围:DSH 还在预发布阶段,预发布版本的 semver 范围不可靠(见 [ADR 0005](../../docs/adr/0005-dsh-version-compatibility.md))。以这张表为准。DSH 升级后跑 `pnpm probe:runtime`、`pnpm smoke:next-step`、`pnpm smoke:next-step-desktop`,并看插件诊断。
123
125
 
@@ -0,0 +1,47 @@
1
+ // @ts-check
2
+ // 「卡片生成被中止」的原因细分:**超时**(插件自己的 timeout 定时器)与**取消**
3
+ // (用户取消 / 同一会话又起了新的生成)是两件事。
4
+ //
5
+ // 为什么单独一个纯函数模块:中止既不写会话日志、也不计数时,诊断面板里完全看不到
6
+ // 痕迹——2026-11-14 排查那次「卡片没出来」就卡在这里。把判据抽出来才能单测,
7
+ // 让 `writeCardFor` 与诊断行共用同一套结论。
8
+
9
+ /** 超时定时器塞进 `AbortController.abort()` 的 Error message。 */
10
+ export const TIMEOUT_MESSAGE = "next-step timeout";
11
+
12
+ /**
13
+ * 从 `AbortController.signal.reason` 判出中止原因。
14
+ * @param {unknown} reason
15
+ * @returns {"timeout" | "cancelled"}
16
+ */
17
+ export function abortReasonOf(reason) {
18
+ const message =
19
+ reason instanceof Error
20
+ ? reason.message
21
+ : typeof reason === "string"
22
+ ? reason
23
+ : typeof (/** @type {any} */ (reason)?.message) === "string"
24
+ ? String(/** @type {any} */ (reason).message)
25
+ : "";
26
+ return /timeout|timed\s*out/iu.test(message) ? "timeout" : "cancelled";
27
+ }
28
+
29
+ /**
30
+ * 诊断行里「最近一次没出卡」的 kind。用户能看懂,也便于冒烟断言。
31
+ * @param {"timeout" | "cancelled"} kind
32
+ */
33
+ export function abortSkipKind(kind) {
34
+ return kind === "timeout" ? "timeout" : "cancelled";
35
+ }
36
+
37
+ /**
38
+ * 给诊断用的英文原因 token(与其它 lastSkip.reason 风格一致:机器可读、不翻译)。
39
+ * @param {"timeout" | "cancelled"} kind
40
+ * @param {number} [timeoutMs]
41
+ */
42
+ export function abortReasonText(kind, timeoutMs) {
43
+ if (kind !== "timeout") return "cancelled";
44
+ const seconds =
45
+ Number.isFinite(timeoutMs) && Number(timeoutMs) > 0 ? Math.round(Number(timeoutMs) / 1000) : 0;
46
+ return seconds > 0 ? `generation timeout after ${seconds}s` : "generation timeout";
47
+ }
package/lib/client.js CHANGED
@@ -52,6 +52,7 @@ window.__ModuleLoader__.load({
52
52
  "error.missing": "找不到这条建议",
53
53
  "error.disabled": "插件已停用",
54
54
  "error.failed": "操作失败,请重试",
55
+ "error.aborted": "生成超时或被取消,请重试",
55
56
  "error.send": "没能把建议写进输入框",
56
57
  "error.budget": "本会话的卡片预算已用完",
57
58
  "error.exists": "这一轮已经有卡片了",
@@ -73,7 +74,8 @@ window.__ModuleLoader__.load({
73
74
  "settings.budgetUnit": "张卡",
74
75
  "settings.diagnostics": "诊断",
75
76
  "settings.refresh": "刷新",
76
- "settings.stats": "已生成 {generated} · 失败 {failed} · 跳过 {skipped} · 在途 {inflight}",
77
+ "settings.stats":
78
+ "已生成 {generated} · 失败 {failed} · 已中止 {aborted} · 跳过 {skipped} · 在途 {inflight}",
77
79
  "settings.lastError": "最近错误:{message}",
78
80
  "settings.noError": "无错误",
79
81
  "settings.paused": "已暂停,约 {time} 后恢复",
@@ -103,6 +105,7 @@ window.__ModuleLoader__.load({
103
105
  "error.missing": "That suggestion is no longer available",
104
106
  "error.disabled": "The plugin is disabled",
105
107
  "error.failed": "Something went wrong. Try again.",
108
+ "error.aborted": "Generation timed out or was cancelled. Try again.",
106
109
  "error.send": "Could not fill the composer",
107
110
  "error.budget": "This session has used up its card budget",
108
111
  "error.exists": "This turn already has a card",
@@ -125,7 +128,7 @@ window.__ModuleLoader__.load({
125
128
  "settings.diagnostics": "Diagnostics",
126
129
  "settings.refresh": "Refresh",
127
130
  "settings.stats":
128
- "Generated {generated} · failed {failed} · skipped {skipped} · in flight {inflight}",
131
+ "Generated {generated} · failed {failed} · aborted {aborted} · skipped {skipped} · in flight {inflight}",
129
132
  "settings.lastError": "Last error: {message}",
130
133
  "settings.noError": "No errors",
131
134
  "settings.paused": "Paused; resumes in about {time}",
@@ -157,7 +160,7 @@ window.__ModuleLoader__.load({
157
160
  "no-turn": "error.noTurn",
158
161
  failed: "error.failed",
159
162
  schema: "error.failed",
160
- aborted: "error.failed",
163
+ aborted: "error.aborted",
161
164
  "not-needed": "error.failed",
162
165
  };
163
166
 
@@ -1367,6 +1370,7 @@ window.__ModuleLoader__.load({
1367
1370
  diagText = t("settings.stats", {
1368
1371
  generated: String(stats.generated || 0),
1369
1372
  failed: String(stats.failed || 0),
1373
+ aborted: String(stats.aborted || 0),
1370
1374
  skipped: String(stats.skipped || 0),
1371
1375
  inflight: String(stats.inflight || 0),
1372
1376
  });
package/lib/service.js CHANGED
@@ -11,6 +11,7 @@ import { join } from "node:path";
11
11
  import { BlockAssembler, createUserMessage } from "@deepseek-ai/dsh-llm";
12
12
  import { appendPluginRecord, pluginRecordOf } from "@deepseek-ai/dsh-session";
13
13
  import { Remote, RemoteError, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
14
+ import { abortReasonOf, abortReasonText, abortSkipKind, TIMEOUT_MESSAGE } from "./abort-reason.js";
14
15
  import { buildIdentity } from "./build-info.js";
15
16
  import { cheapSkipReason } from "./gates.js";
16
17
  import {
@@ -188,10 +189,13 @@ export class NextStepService extends TypertRemoteService {
188
189
  this.config = config ?? {};
189
190
  this.logger = ctx?.logger ?? console;
190
191
  this.dataRoot = resolveDataRoot(this.config);
191
- /** @type {{ generated: number, failed: number, skipped: number, skippedByModel: number, acted: number, dismissed: number }} */
192
+ /** @type {{ generated: number, failed: number, aborted: number, skipped: number, skippedByModel: number, acted: number, dismissed: number }} */
192
193
  this.counters = {
193
194
  generated: 0,
194
195
  failed: 0,
196
+ // 生成被中止(超时/取消)。单独计数:中止既不写会话日志、原来也不计数,
197
+ // 导致「卡片没出来」在诊断里完全无痕(见 abort-reason.js 的说明)。
198
+ aborted: 0,
195
199
  skipped: 0,
196
200
  skippedByModel: 0,
197
201
  acted: 0,
@@ -326,13 +330,20 @@ export class NextStepService extends TypertRemoteService {
326
330
  const controller = new AbortController();
327
331
  this.inflight.set(sessionId, controller);
328
332
  const timer = setTimeout(
329
- () => controller.abort(new Error("next-step timeout")),
333
+ () => controller.abort(new Error(TIMEOUT_MESSAGE)),
330
334
  settings.timeoutMs,
331
335
  );
332
336
  try {
333
337
  const result = await this.generate(session, settings, controller.signal);
334
- if (controller.signal.aborted) return { ok: false, reason: "aborted" };
335
- if (this.inflight.get(sessionId) !== controller) return { ok: false, reason: "aborted" };
338
+ if (controller.signal.aborted) {
339
+ this.markAbort(controller.signal.reason, settings.timeoutMs);
340
+ return { ok: false, reason: "aborted" };
341
+ }
342
+ // 同一会话又起了新的一次生成:这次被后来者取代,算取消而不是超时。
343
+ if (this.inflight.get(sessionId) !== controller) {
344
+ this.markAbort(undefined, settings.timeoutMs);
345
+ return { ok: false, reason: "aborted" };
346
+ }
336
347
  if (result === null) {
337
348
  this.counters.failed += 1;
338
349
  this.lastError = "model output did not match the card schema";
@@ -368,12 +379,21 @@ export class NextStepService extends TypertRemoteService {
368
379
  this.lastError = "";
369
380
  return { ok: true, card };
370
381
  } catch (error) {
371
- if (!controller.signal.aborted) {
372
- this.counters.failed += 1;
373
- this.lastError = error instanceof Error ? error.message : String(error);
374
- this.markFailure(this.lastError);
375
- this.warn("card generation failed", error);
382
+ // 超时/取消会让 generate() 以抛错收场(不是返回 null):这种中止原来完全无痕,
383
+ // 既不计 failed 也不写 lastSkip,诊断里看不到——所以先单独归类。
384
+ if (controller.signal.aborted) {
385
+ this.markAbort(controller.signal.reason, settings.timeoutMs);
386
+ return { ok: false, reason: "aborted" };
387
+ }
388
+ // 宿主自己抛的错误里也可能写着超时(定时器还没触发):同样按中止记,不记成 failed。
389
+ if (abortReasonOf(error) === "timeout") {
390
+ this.markAbort(error, settings.timeoutMs);
391
+ return { ok: false, reason: "aborted" };
376
392
  }
393
+ this.counters.failed += 1;
394
+ this.lastError = error instanceof Error ? error.message : String(error);
395
+ this.markFailure(this.lastError);
396
+ this.warn("card generation failed", error);
377
397
  return { ok: false, reason: "failed" };
378
398
  } finally {
379
399
  clearTimeout(timer);
@@ -407,6 +427,22 @@ export class NextStepService extends TypertRemoteService {
407
427
  };
408
428
  }
409
429
 
430
+ /**
431
+ * 记录一次「生成被中止」:计入 aborted 并写 lastSkip,让诊断行显示得出来。
432
+ * 不碰 failed(中止不是失败,也不该把 lastError 写成中止原因)。
433
+ * @param {unknown} reason AbortController 的 reason(超时时是本插件的 timeout Error)
434
+ * @param {number} [timeoutMs]
435
+ */
436
+ markAbort(reason, timeoutMs) {
437
+ const kind = abortReasonOf(reason);
438
+ this.counters.aborted += 1;
439
+ this.lastSkip = {
440
+ kind: abortSkipKind(kind),
441
+ reason: abortReasonText(kind, timeoutMs),
442
+ at: Date.now(),
443
+ };
444
+ }
445
+
410
446
  /**
411
447
  * 一次额外补全:prepareCall + stream,产出已校验的建议。
412
448
  * @param {any} session
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kangyishuai/dsh-next-step",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Next-step decision card under each completed answer, plus an optional greyed-out next-prompt hint in the composer",
5
5
  "keywords": [
6
6
  "dsh",