dsh-goal-contract 0.0.0-stage → 0.2.5

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 ADDED
@@ -0,0 +1,798 @@
1
+ 中文 / English
2
+
3
+ # Changelog
4
+
5
+ 本文件记录 `dsh-goal-contract` 的对外变化。每条先中文整段、再英文整段。
6
+
7
+ ## 0.2.5 — 2026-11-28
8
+
9
+ 中文 / English
10
+
11
+ ### 中文
12
+
13
+ 这一版没有改任何插件行为,只补了「一个正常仓库该有的东西」。起因是 0.2.4 推上去之后,看 npm 页面和 GitHub 首页才发现:README 只有中文、没有 CI、没有 issue 模板、GitHub 的 About 三项全空。
14
+
15
+ **新增英文版 README。** `README.en.md`,276 行,与中文版逐行对齐——15 个章节标题落在完全相同的行号,15 个工具名、模型选型的全部数字、16 个配置项都原样保留。两份 README 顶部互相加跳转:中文版写 `**中文** | [English](README.en.md)`,英文版写 `[中文](README.md) | **English**`。
16
+
17
+ **新增 CI。** `.github/workflows/ci.yml`:Ubuntu 和 Windows 两个平台、Node 22,每次 push 到 master 或提 PR 自动跑一千八百多个测试。两个细节是必需的——这个包没有 lock 文件,所以用 `npm install` 而不是 `npm ci`;有 5 个测试会读 `dist/client.js`,所以必须先跑 `npm run build:client` 再跑测试。
18
+
19
+ **新增协作文件。** `.github/ISSUE_TEMPLATE/` 下的 bug 与功能建议表单、`.github/pull_request_template.md`、`CONTRIBUTING.md`(怎么本地跑起来、提 PR 前要做什么、不接受什么)、`SECURITY.md`(双语;写清「模型能绕过这个插件」不算漏洞——它本来就不是安全边界)。
20
+
21
+ **补齐 GitHub 仓库 About。** description(和 npm 同一句)、homepage(指向 npm 页面)、8 个 topics(dsh / dsh-plugin / deepseek-harness / cordis / goal-tracking / agent-safety / ai-agent / autonomous-agent)。
22
+
23
+ 测试:1806 个全通过,进程退出码 0。
24
+
25
+ ### English
26
+
27
+ No plugin behaviour changed in this release. It only fills in what a normal repository is expected to have. After 0.2.4 shipped, looking at the npm page and the GitHub front page made the gaps obvious: the README was Chinese-only, there was no CI, no issue templates, and all three GitHub About fields were empty.
28
+
29
+ **English README added.** `README.en.md`, 276 lines, aligned with the Chinese version line by line — all 15 section headings land on exactly the same line numbers, and all 15 tool names, every number in the model benchmark table, and all 16 configuration keys are preserved verbatim. The two READMEs link to each other at the top.
30
+
31
+ **CI added.** `.github/workflows/ci.yml`: Ubuntu and Windows, Node 22, running the full suite of 1,800+ tests on every push to master and every pull request. Two details are load-bearing — this package has no lock file, so it uses `npm install` rather than `npm ci`; and five tests read `dist/client.js`, so `npm run build:client` has to run before the suite.
32
+
33
+ **Collaboration files added.** Bug and feature-request forms under `.github/ISSUE_TEMPLATE/`, `.github/pull_request_template.md`, `CONTRIBUTING.md` (how to run it locally, what to check before opening a PR, and what will be rejected), and `SECURITY.md` (bilingual; it states plainly that "the model can bypass this plugin" is not a vulnerability, because the plugin was never a security boundary).
34
+
35
+ **GitHub About filled in.** description (the same sentence as npm), homepage (pointing at the npm page), and 8 topics.
36
+
37
+ Tests: 1806 passing, process exit code 0.
38
+
39
+ ## 0.2.4 — 2026-11-28
40
+
41
+ ### 中文
42
+
43
+ **README 拆成两份:给用户的说明书,和给我自己的施工记录**
44
+
45
+ 原来那份 943 行的 README 里,**约 720 行是我的施工日记**——哪些功能还没做、哪些被移除、
46
+ 「上一版 README 完全没有记录的部分」、内部编号 t52 / t83 / P0-3a、真机验证记录、账本膨胀排查。
47
+
48
+ 这些对**要装这个插件的人**没有任何意义。他打开页面看到「上一版 README 完全没有记录的部分」,
49
+ 只会觉得这个项目没整理好——他不知道我在说什么。
50
+
51
+ 拆成两个文件:
52
+
53
+ - **`README.md`(274 行)** —— 只回答陌生人 30 秒内要问的七件事:
54
+ 这是什么 / 为什么要用它 / 怎么装 / 头一步怎么用 / 它能做哪几件事 / 有什么限制 / 出问题去哪问。
55
+ - **`docs/implementation-notes.md`(783 行)** —— 那 720 行原文照搬,17 段带索引。
56
+ 开头写明「这份文档不是给用户看的」,并说明保留理由:
57
+ 删掉它,这些设计决策就只剩 git log 里孤零零的一行提交信息。
58
+
59
+ 内容一个字没丢,只是换了位置。
60
+
61
+ **保留下来的一节:模型选型实测表**
62
+
63
+ 「如果你要换模型:实测参考」——两个模型(Qwen3-8B 83% / 827ms、GLM-4-9B 75%、
64
+ Qwen2.5-7B 75%、R1 58%、Qwen3.5-4B 超时、XingChen 29B 25%)、四条选型条件、
65
+ 以及「模型 + 代码兜底 → 92%」的结论,全部原样保留。
66
+ 这些是别人选二审模型或路由抽取模型时的实测依据,属于对外有用的技术资料,不是内部备忘。
67
+
68
+ **测试:诚实守卫从「查词」改成「查两处」**
69
+
70
+ `test/smoke.test.mjs` 里原来有一条用例断言「README 必须含『已实现』『未实现』两个词」。
71
+ 拆完之后它红了——但内容没丢,只是换了位置。所以没有删掉它,而是把它改得更严:
72
+
73
+ - README 必须有一节写清「它做不到什么」+ 声明「不是安全边界」+ 两条具体边界(空话不算);
74
+ - `docs/implementation-notes.md` 必须有「已实现」「未实现」两份清单,
75
+ 且契约存储 / 漂移规则 / 选项卡三个能力词必须仍在(证明是搬家不是删掉);
76
+ - README 必须列出模型可用的工具。
77
+
78
+ 这样用户看的说明书保持干净,而「哪些做了哪些没做」这个事实仍然被用例钉在仓库里。
79
+
80
+ ### English
81
+
82
+ **Split the README into two files: a user guide, and my own build notes**
83
+
84
+ Of the original 943-line README, roughly 720 lines were my build log — what is not implemented
85
+ yet, what was removed, "the parts the previous README never documented", internal ticket ids
86
+ (t52 / t83 / P0-3a), real-machine verification records, ledger-growth investigations.
87
+
88
+ None of that means anything to someone who wants to install the plugin. Seeing "the parts the
89
+ previous README never documented" in a public README just makes the project look unkempt — they
90
+ have no idea what I am talking about.
91
+
92
+ Split into two files:
93
+
94
+ - **`README.md` (274 lines)** — answers only the seven questions a stranger asks within 30 seconds:
95
+ what is it / why would I want it / how do I install it / what is the first step / what can it do /
96
+ what are its limits / where do I report problems.
97
+ - **`docs/implementation-notes.md` (783 lines)** — those 720 lines moved verbatim, with a
98
+ 17-section index. Its opening states plainly that it is not written for users, and why it is kept:
99
+ delete it and these design decisions survive only as a lonely git-log line.
100
+
101
+ Nothing was dropped. It moved.
102
+
103
+ **One section deliberately kept: the model benchmark table**
104
+
105
+ "If you want to swap the model: measured reference" keeps every reading — Qwen3-8B 83% / 827ms,
106
+ GLM-4-9B 75%, Qwen2.5-7B 75%, R1 58%, Qwen3.5-4B all timeouts, XingChen 29B 25% — plus the four
107
+ selection criteria and the "model + code fallback → 92%" result. This is useful reference data for
108
+ anyone choosing a reviewer or route-extraction model, not internal bookkeeping.
109
+
110
+ **Tests: the honesty guard now checks two places instead of one word list**
111
+
112
+ `test/smoke.test.mjs` used to assert that README.md contains both "已实现" and "未实现". After the
113
+ split it failed — but nothing was lost, it merely moved. So the case was not deleted, it was
114
+ tightened:
115
+
116
+ - README must have a limits section, must declare it is not a security boundary, and must name two
117
+ concrete limits (a vague sentence does not count);
118
+ - `docs/implementation-notes.md` must list both implemented and not-implemented items, and the three
119
+ capability words (contract store / drift rules / tabs) must still be present — proof of a move,
120
+ not a deletion;
121
+ - README must list the tools available to the model.
122
+
123
+ The user-facing guide stays clean, while "what is done and what is not" remains pinned in the repo
124
+ by a test that fails loudly if anyone quietly removes it.
125
+
126
+ ## 0.2.3 — 2026-11-28
127
+
128
+ ### 中文
129
+
130
+ **修好「循环检测在真机上从不触发」——它把每次调用都会变的**耗时**当成了「结果不同」**
131
+
132
+ 循环检测判定「原地打转」的条件是「调用相同 **且** 结果相同」。真机上跑同一条命令四次,
133
+ 结果明明是同一份输出,检测器却认为每次都不一样,于是第 4 次照样放行。
134
+
135
+ 根因在结果指纹:`resultKey` 原来是 `hashText(resultText)`,**原样把整段结果拿去哈希**。
136
+ 而工具结果里带 `durationMs` 这类耗时字段(`dsh-ops` 的 `execution.js:103` 写的是
137
+ `durationMs: Math.max(0, Math.round(performance.now() - startedAt))`),每跑一次就差几毫秒 ——
138
+ 指纹每次都不同,「结果相同」这个条件永远不成立。
139
+
140
+ 原有的 `normalizeVolatile` 兜不住它:那个正则只吃 **≥10 位**数字(毫秒时间戳的量级),
141
+ 而 `durationMs` 只有三位。
142
+
143
+ 改法是**按字段名挑、不按位数一刀切**:新增 `VOLATILE_TIMING_RE`,只把
144
+ `durationMs` / `elapsedMs` / `tookMs` 这类**耗时**字段的值换成 `<num>`。
145
+
146
+ 为什么不一刀切掉所有数字:结果里「3 个文件 → 4 个文件」是**有进展**,只有**耗时**才是
147
+ 「没进展」。一刀切会把这两者混成一样,反而制造误报。
148
+
149
+ 配套加了两条用例:一条固定「**只有耗时不同 → 要拦**」(耗时不是进展),一条固定
150
+ 「**结果文字不同 → 不拦**」(归一化不许过头)。「结果完全一致 → 第 4 次拦」这条行为
151
+ 由**既有**用例(`test/interrupt.test.mjs:129`)钉住,本次没有重写它。全套 1806 条测试通过。
152
+
153
+ 同时补上一份真机验证记录 `docs/verification-2026-11-28.md`:三组对照(开 / 关 / 回归)
154
+ 的真实读数、面板关掉检测器的路径、桌面端与 web 端的实测证据,以及三条「容易骗自己」的坑
155
+ (`continuum_restart` 返回「已受理」不等于已执行,要认 GUI 端口真的变了)。
156
+
157
+ ### English
158
+
159
+ **Fixed "loop detection never fires on a real host" — it treated per-run **timing** as "different result".**
160
+
161
+ Loop detection fires when "the call is identical **and** the result is identical". On a real host we
162
+ ran the same command four times; the output was byte-identical, yet the detector saw a different
163
+ result every time and let the fourth call through.
164
+
165
+ Root cause was the result fingerprint: `resultKey` was `hashText(resultText)`, hashing the whole
166
+ raw result. Tool results carry timing fields such as `durationMs` (`dsh-ops` writes
167
+ `durationMs: Math.max(0, Math.round(performance.now() - startedAt))` in `execution.js:103`), which
168
+ differ by a few milliseconds on every run — so the fingerprint never matched and "same result" never
169
+ held.
170
+
171
+ The existing `normalizeVolatile` could not absorb it: that regex only matches **10+ digit**
172
+ numbers (millisecond-timestamp scale), while a `durationMs` value has three digits.
173
+
174
+ The fix keys on the **field name** instead of digit count: a new `VOLATILE_TIMING_RE` rewrites only
175
+ the value of **timing** fields (`durationMs` / `elapsedMs` / `tookMs` …) to `<num>`.
176
+
177
+ It deliberately does not blank out every number: in a result, "3 files → 4 files" is **progress**,
178
+ while only **elapsed time** means "no progress". Blanking everything would conflate the two and
179
+ create false positives.
180
+
181
+ Two tests pin the behaviour: one requires that a **timing-only** difference still trips (elapsed
182
+ time is not progress), the other requires that a difference in the **result text** does not trip
183
+ (normalisation must not overshoot). The "identical result trips on the 4th call" behaviour was
184
+ already pinned by an **existing** test (`test/interrupt.test.mjs:129`) and was not rewritten here.
185
+ Full suite: 1806 passing.
186
+
187
+ Also added a real-host verification record, `docs/verification-2026-11-28.md`: the on / off /
188
+ regression readings, the settings-page path for switching a detector off, the desktop and hosted-web
189
+ evidence, and three "easy to fool yourself" pitfalls — including that `continuum_restart` answering
190
+ "accepted" does not mean it executed; the GUI port actually changing is the evidence.
191
+
192
+ ## 0.2.2 — 2026-11-28
193
+
194
+ ### 中文
195
+
196
+ **去掉拦截文案里那句「或者在设置页把这一项关掉」——它等于告诉主代理「被拦了就去把闸关掉」**
197
+
198
+ 「轮次控制」的拦截文案原来给出两条出路:
199
+
200
+ 1. 用户回一句「继续」即可;
201
+ 2. **或者在设置页把「工具连续失败 / 循环检测」这一项关掉,之后同类调用不再被拦。**
202
+
203
+ 第 2 条是**自我破坏**:它把「绕过这道闸」的路当作出路,直接指给了模型。真机上已经发生过 ——
204
+ 主代理被拦之后**直接改 `stuck-config.json`** 把检测器关掉。
205
+
206
+ 改法(用户本人批准的文案,逐字写进拦截文案):
207
+
208
+ ```
209
+ ★ 关闭检测器**不是模型能自行决定的事**:
210
+ · 只有用户本人能在设置页把它关掉;
211
+ · 如果你认为这是误拦,只能向用户说明情况、请他决定,
212
+ 不得自行用任何方式(改设置 / 改配置文件 / 绕过工具)关掉或削弱它。
213
+ ```
214
+
215
+ 关键区别是**「只有用户本人能关」**,而不是「你请求用户许可、然后自己关」—— 后者等于把「关」的
216
+ 资格又交回模型手里。
217
+
218
+ 同一条规矩按 `docs/model-guidance-first.md` 第 3 节写**两个位置**:
219
+
220
+ - **落位 A(长规格)**:拦截文案本身 —— 被拦的那一刻要看到「你没有资格关它」;
221
+ - **落位 B(每回合唤起)**:每个**用户回合**一次的注入里放一句短唤起(≤200 码点、不含判据)——
222
+ 只写在拦截文案里的话,这条规矩只活在被拦的那一刻,会随文案改动一起消失。
223
+
224
+ 顺带修掉另外两处**同一种毛病**的表述:「文本重复」检测器的停止通知,以及拦截文案里
225
+ 「可在设置页…单独关掉这一项」那句括注。修完之后,`src/index.js` 里所有**模型看得见**的
226
+ 「关掉检测器」都只有一种语义:**只有用户能关,模型不得自行关**。
227
+
228
+ ### English
229
+
230
+ **Removed the "or turn it off in the settings page" line from the round-control denial text —
231
+ it was telling the main agent to switch the gate off when it got blocked.**
232
+
233
+ The denial text offered two ways out: the user replies "continue", **or turn off
234
+ "tool failure / loop detection" in the settings page**.
235
+
236
+ The second one was self-defeating: it handed the model the bypass path as a legitimate way out.
237
+ It already happened in production — a main agent **edited `stuck-config.json`** to switch the
238
+ detector off after being blocked.
239
+
240
+ The replacement (wording approved by the user, copied verbatim) makes the ownership explicit:
241
+ **only the user can turn the detector off**. The model may report a suspected false positive and
242
+ let the user decide; it must not weaken the detector in any way (settings, config file, or by
243
+ going around the tool).
244
+
245
+ Per `docs/model-guidance-first.md` §3 the same rule is now written in **two places**: the long
246
+ spec in the denial text (landing A) and a short reminder (≤200 code points, no criteria) injected
247
+ once per **user turn** (landing B) — a rule that lives only inside a denial message disappears
248
+ with the next copy edit.
249
+
250
+ Two more model-visible wordings with the same defect were fixed as well (the "text repeat"
251
+ detector's stop notice, and the "you can switch it off separately in the settings page"
252
+ parenthetical inside the denial text), so every model-visible mention of turning a detector off
253
+ now carries one single meaning: **only the user may turn it off; the model must not**.
254
+
255
+ ## 0.2.1 — 2026-11-28
256
+
257
+ ### 中文
258
+
259
+ **删掉一段临时诊断插桩,并修掉它暴露出来的真 bug:二分法开关读错了 `mode.txt` 的目录**
260
+
261
+ 定位「默认全开后为什么仍不拦」时临时加过一段 9 行的插桩(把「会话 id 取没取到」写进
262
+ `interrupt-debug.log`)。插桩自己的注释里写着「定位完就删」,但仓里没有任何清理机制 ——
263
+ 不删,它就会跟着下一个版本一起发出去。本次删干净。
264
+
265
+ 删插桩时顺手核了一遍它用的那个路径,发现**一个真 bug**:
266
+
267
+ 二分法开关(`<stateDir>/mode.txt`)的三处调用读的是 `config?.stateDir`,而这个值拿不到:
268
+
269
+ - `stateDir` **不在本插件的 Config schema 里** → 宿主按 schema 校验配置,没声明的键会被**悄悄丢掉**,
270
+ 所以它默认恒为 `undefined`,宿主根本不会把它传进来。
271
+
272
+ 于是 `String(config?.stateDir ?? '')` 得空串 → `path.join('', 'mode.txt')` 得到**相对路径**
273
+ → `mode.txt` 落到**宿主进程 CWD**(实测在 `~/.dsh/profiles/desktop/`),而规范目录
274
+ `~/.dsh/storages/dsh-goal-contract/` 里那份 `mode.txt`(内容 `full`)**永远读不到**。
275
+
276
+ 后果不是「开关失灵」这么轻:在 CWD 丢一个写 `no-pre` 的 `mode.txt`,就能让整个
277
+ `tools/pre-execute` **静默消失** —— 插件看上去正常跑,但那道闸根本没挂上。
278
+
279
+ 修法:三处 `gcOff` 调用统一改用 `diagnosticDir`(组合层显式给了 `stateDir` 就用它,
280
+ 否则用默认的 `~/.dsh/storages/dsh-goal-contract`)—— 与诊断日志、判定记录同一个来源。
281
+
282
+ - `gcOff('all', …)`(apply 开头)、`gcOff('guard', …)`(`tools.guard` 注册处)、
283
+ `gcOff('pre', …)`(`tools/pre-execute` 注册处)三处都改了;
284
+ - `diagnosticDir` 的计算**提到** `gcOff('all')` 之前 —— 让「开关读哪个目录」和
285
+ 「日志写哪个目录」永远是同一个答案;
286
+ - **没有新增配置项**:`stateDir` 仍然不在 Config schema 里,本次只是把读法改对。
287
+
288
+ ### English
289
+
290
+ **Removed a temporary diagnostic probe, and fixed the real bug it exposed: the
291
+ binary-search switch was reading `mode.txt` from the wrong directory**
292
+
293
+ Locating "why does it still not interrupt even though everything is on by default" needed a
294
+ 9-line probe that wrote "did we get a session id" into `interrupt-debug.log`. The probe's own
295
+ comment said "delete this once located", but nothing in the repo would ever delete it — so it
296
+ would have shipped with the next release. It is gone now.
297
+
298
+ While removing it, checking the path it used turned up **a real bug**:
299
+
300
+ All three call sites of the binary-search switch (`<stateDir>/mode.txt`) read
301
+ `config?.stateDir`, and that value cannot be obtained:
302
+
303
+ - `stateDir` is **not in this plugin's Config schema** → the host validates the config
304
+ against that schema and **silently strips** the keys it does not declare, so the value
305
+ is `undefined` by default and never reaches the plugin at all.
306
+
307
+ So `String(config?.stateDir ?? '')` is the empty string → `path.join('', 'mode.txt')`
308
+ produces a **relative path** → `mode.txt` lands in the **host process CWD** (measured:
309
+ `~/.dsh/profiles/desktop/`), while the canonical directory
310
+ `~/.dsh/storages/dsh-goal-contract/` holds a `mode.txt` (contents: `full`) that
311
+ **can never be read**.
312
+
313
+ The consequence is heavier than "the switch stops working": drop a `mode.txt` containing
314
+ `no-pre` into the CWD and the whole `tools/pre-execute` hook **silently disappears** — the
315
+ plugin looks like it is running fine, but that gate was never mounted.
316
+
317
+ The fix: all three `gcOff` call sites now use `diagnosticDir` (the composition layer's
318
+ explicit `stateDir` when given, otherwise the default
319
+ `~/.dsh/storages/dsh-goal-contract`) — the same source the diagnostic logs and the
320
+ decision ledger already use.
321
+
322
+ - `gcOff('all', …)` (top of `apply`), `gcOff('guard', …)` (`tools.guard` registration) and
323
+ `gcOff('pre', …)` (`tools/pre-execute` registration) were all changed;
324
+ - the `diagnosticDir` computation was **moved above** `gcOff('all')`, so "which directory
325
+ does the switch read" and "which directory do the logs go to" are always the same answer;
326
+ - **no new configuration option was added**: `stateDir` is still absent from the Config
327
+ schema; only the way it is read was fixed.
328
+
329
+ ## 0.2.0 — 2026-11-28
330
+
331
+ ### 中文
332
+
333
+ **三个「强制打断」检测器改回默认全开,并修掉一处「默认值和运行时判定打架」**
334
+
335
+ 用户 2026-11-26 拍板「三检测器全开」,2026-11-27 的实现改成了**默认全部关闭**
336
+ (理由:三种判据误报率不同,逐个打开才能定位误杀)。2026-11-28 用户明确要求按原拍板执行。
337
+
338
+ **改默认值的过程中发现了一个更值得记的事实**:光把 `DEFAULT_STUCK_CONFIG.interrupt`
339
+ 里三处 `enabled` 改成 `true` **不够** —— 还有一道判定会把它抹掉:
340
+
341
+ ```js
342
+ // src/stuck.js(改前)
343
+ const enabled = kindSource.enabled === true; // undefined === true → false
344
+ ```
345
+
346
+ 后果:`normalizeStuckConfig({})` **永远返回全 false** —— 也就是说,
347
+ **界面上看到的「默认值」和运行时实际生效的值不是同一个东西**。
348
+ 不先实测就宣布改完,会以为改好了。
349
+
350
+ 现在三处(默认值 / `normalizeInterruptConfig` / `interruptConfigOf`)统一成同一口径:
351
+
352
+ - **缺值 / undefined / 老配置 → 走默认值**(现为全开)
353
+ - **显式 false → 关**
354
+ - **显式 true → 开**
355
+
356
+ 误杀时的定位手段仍在:设置页可以**逐个单独关**(关掉其余两个看是不是它)。
357
+
358
+ 测试同步更新:`test/stuck.test.mjs` 里三块「默认值期望」的断言 `false → true`(9 处),
359
+ **而「显式 false 才算关」那条对照组(`{ enabled: false }` 无 max)保持不动** —— 它测的是另一件事。
360
+
361
+ 全量 1804 / 1804 / 0。
362
+
363
+ ### English
364
+
365
+ **The three "forced interrupt" detectors default to ON again, plus a fix for a
366
+ "default value disagrees with runtime judgement" trap**
367
+
368
+ The user decided "all three detectors on" on 2026-11-26; the 2026-11-27 implementation
369
+ flipped them to default OFF (rationale: the three detectors have different false-positive
370
+ rates, so enabling them one at a time makes it possible to locate the one misfiring).
371
+ On 2026-11-28 the user asked for the original decision to be honoured.
372
+
373
+ **Changing the default surfaced a fact worth recording**: flipping the three `enabled`
374
+ flags in `DEFAULT_STUCK_CONFIG.interrupt` to `true` was **not enough** — another
375
+ judgement erased it:
376
+
377
+ ```js
378
+ // src/stuck.js (before)
379
+ const enabled = kindSource.enabled === true; // undefined === true → false
380
+ ```
381
+
382
+ So `normalizeStuckConfig({})` **always returned all-false** — the "default" the UI showed
383
+ and the value actually in force at runtime were two different things. Declaring the change
384
+ done without measuring it first would have left it broken.
385
+
386
+ All three places now share one rule: **missing → use the default (now on);
387
+ explicit false → off; explicit true → on.** Per-detector disabling remains available for
388
+ locating false positives. Tests updated accordingly (9 default-value assertions `false → true`);
389
+ the "explicit false turns it off" control case is untouched. Full suite 1804 / 1804 / 0.
390
+
391
+ ## 0.1.6 — 2026-11-28
392
+
393
+ ### 中文
394
+
395
+ **allow 清单里写 `file_changed:<路径>` 永远匹配不上(2026-11-28 修复)**
396
+
397
+ CodeKG 的 allow 清单,条目按官方示例格式写成 `<类型>:<路径>`,
398
+ 例如 `file_changed:plugins/x/src/client.js`。而 `pathMatchMode` 把**整条**当路径去比对 ——
399
+ 模式里多了一截类型前缀,连「后缀兜底」也兜不住,永远返回 `none`。
400
+
401
+ 后果很实际:**照官方示例格式写 allow 清单,会被一直判成「未授权」;只有写裸路径才通过。**
402
+ 子代理 `panel-obj-title` 实测被这个卡了 6 次:「`pathMatchMode('file_changed:...', 目标)` = none,
403
+ 而裸路径 = suffix、裸绝对路径 = exact」。
404
+
405
+ 修法:在 `pathMatchMode` 比对前,把**模式侧**的类型前缀剥掉(`file_changed` / `file_added` /
406
+ `file_removed` / `before` / `after`,大小写不敏感)。**目标侧不剥** —— 目标是宿主传来的真实路径。
407
+
408
+ 两个刻意的取舍:
409
+
410
+ 1. **用白名单,不用「任意 `xxx:` 前缀」**。Windows 盘符 `C:` 长得一模一样;
411
+ 用宽松正则会把它剥成 `/repo/a.js`,把绝对路径降级成相对路径 —— 比原 bug 更坏。
412
+ 2. **未知类型名不剥**。将来 CodeKG 加新类型时要显式加进白名单,而不是被静默剥掉后
413
+ 悄悄匹配到别的东西。
414
+
415
+ 新增 `test/path-kind-prefix.test.mjs`(6 条),其中 2 条专防回归:
416
+ 盘符不许被剥、未知前缀不许被剥。此前这条路径**零测试覆盖**。
417
+
418
+ ### English
419
+
420
+ **`file_changed:<path>` entries in an allow list never matched (fixed 2026-11-28)**
421
+
422
+ CodeKG allow lists document entries as `<kind>:<path>`, e.g. `file_changed:plugins/x/src/client.js`.
423
+ `pathMatchMode` compared the **entire string** as a path — the extra kind prefix meant even the
424
+ suffix fallback could not match, so it always returned `none`.
425
+
426
+ Practical impact: **an allow list written in the documented format was always judged
427
+ "unauthorized"; only bare paths worked.** Subagent `panel-obj-title` was blocked by this 6 times.
428
+
429
+ Fix: strip the kind prefix from the **pattern** side before matching (`file_changed` /
430
+ `file_added` / `file_removed` / `before` / `after`, case-insensitive). The **target** side is
431
+ left untouched — it is a real path supplied by the host.
432
+
433
+ Two deliberate trade-offs: (1) a **whitelist**, not "any `xxx:` prefix" — a Windows drive letter
434
+ `C:` looks identical and would be stripped into a relative path, which is worse than the original
435
+ bug; (2) unknown kind names are not stripped, so new CodeKG kinds must be added explicitly.
436
+ Adds `test/path-kind-prefix.test.mjs` (6 cases; 2 guard the drive-letter and unknown-prefix
437
+ regressions). This path previously had **zero test coverage**.
438
+
439
+ ## 0.1.5 — 2026-11-28
440
+
441
+ ### 中文
442
+
443
+ **设置页二审卡片:两处「控件该不该出现,跟着状态走却不给交代」**(2026-11-28 修复)
444
+
445
+ 用户看截图报了两处,共同病根是同一句话:**控件能不能用跟着别的状态走,但界面上不说为什么。**
446
+
447
+ **① 主模型「思考强度」静默消失**
448
+
449
+ - 现象:选了不带 efforts 的模型(如 `XingChenAGI/Xing4.0-29B`),主模型行只剩**两个**下拉,
450
+ 而兜底模型那行有**三个**;下面小字还写着「服务商 · 模型 · **思考强度**」——
451
+ **说有三个,实际只有两个**。用户第一反应是「少做了一个」。
452
+ - 原实现:`efforts.length > 0 ? <select> : null`(注释写「不给无效选项」)。
453
+ - 改法:**始终渲染**下拉;不支持时 `disabled: true` + 只有一项占位「(当前模型不支持)」,
454
+ 小字改成「服务商 · 模型(当前模型不支持思考强度)」。主模型与兜底模型**两处都改**。
455
+ - 为什么不只是把小字里的「思考强度」删掉:那样用户永远不知道**别的模型支持这个能力**。
456
+
457
+ **② 「轮数」在代码核对模式下是死参数**
458
+
459
+ - 现象:用户原话「二审下面保存按钮怎么有一个轮次 10 是什么东西???多余的把?」
460
+ - 事实:`rounds` 传给 `createCriticGate({ rounds })` —— **二审时最多让模型复核几轮**。
461
+ 而「怎么审」选「只用代码核对」(**默认值**)时根本不调模型,这个数字永远用不到。
462
+ - 改法:该模式下 `disabled: !critic.available || !critic.enabled` + 灰字
463
+ 「(仅『加上大模型复核』时生效)」。**没有删掉它**——切到模型复核模式时它就有用了。
464
+
465
+ **两条既有断言被改(正当,不是凑数)**
466
+
467
+ - `test/panel.test.mjs:646-651`:旧断言 `assert.equal(effort, undefined)` 逐字钉死「不渲染」。
468
+ 改为「渲染 + disabled === true」,断言数 **9 → 10**。
469
+ - `test/panel.test.mjs:1878-1912`:旧断言 `length === 0`。改为「渲染 + disabled + 恰好 1 项占位 option」,
470
+ 断言数 **2 → 4**。计数语义从「0 个」变成「恰好 1 个占位」,**钉得更死**。
471
+ - 独立验收做了**双向实验**证明正当性:
472
+ - EXP-X(新实现 + 旧断言)→ exit 1,红的正是那两条 ⇒ **旧断言必须改**
473
+ - EXP-Y(旧实现 + 新断言)→ exit 1,5 条新断言自己咬住 ⇒ **新断言不是空断言**
474
+ - 零处降级(无 `===`→`includes`、无字段丢失、无删除)
475
+
476
+ **验证读数**(独立只读验收子代理自写探针,19 项断言全过)
477
+
478
+ - `efforts` 为空:`critic-effort` = `exists:true, disabled:true`,1 项占位;
479
+ 小字含「当前模型不支持思考强度」
480
+ - `efforts` 非空:`exists:true, disabled:false`,3 项;小字「服务商 · 模型 · 思考强度」
481
+ - `enabled=false`:`critic-rounds` = `disabled:true` + **有**灰字
482
+ - `enabled=true`:`critic-rounds` = `disabled:false` + **无**灰字
483
+ - 兜底模型两个状态同上
484
+
485
+ - 变异验证(验收员重做):撤回「不支持 → null」→ 5/5 变 3/5(主模型+兜底两条同时红)
486
+ - `critic.enabled` 默认值**仍是 false**(`src/critic.js` 与 `src/index.js` 与 HEAD 逐字相同)
487
+ - 轮数输入框**还在**(`grep -c critic-rounds` = 2,只增不改)
488
+ - 全量测试:`1793 → 1798`(+5),`fail 0`;`client.js --check` 退出码 0
489
+
490
+ **这次的一条口径**(写下来):控件因为「当前状态不支持」而不该可用时,
491
+ **要保留它并说明原因,不要让它静默消失或静默失效**——
492
+ 消失会让用户以为功能丢了,失效会让用户以为是自己操作错了。
493
+
494
+ ### English
495
+
496
+ **Settings page, critic card: two controls whose availability followed other state without saying why** (fixed 2026-11-28)
497
+
498
+ 1. The main model reasoning-effort dropdown silently disappeared when the selected model has no
499
+ efforts, while the fallback row still showed three dropdowns and the caption still read
500
+ "provider - model - effort". It now always renders, disabled, with a single placeholder option,
501
+ and the caption says the current model does not support reasoning effort. Both rows fixed.
502
+
503
+ 2. The rounds field was a dead parameter in code-only mode. It only bounds how many model review
504
+ rounds the critic may use, and the default mode calls no model at all. The input is now disabled
505
+ with a hint explaining it applies only in model-review mode - it was not removed.
506
+
507
+ **Two existing assertions were changed, legitimately.** The independent verifier ran two
508
+ experiments: reverting the assertions while keeping the new implementation fails exactly on those
509
+ two; keeping the old implementation with the new assertions fails on five new cases. Assertion
510
+ counts only went up (9 -> 10 and 2 -> 4), with no weakening.
511
+
512
+ Full suite: `1793 -> 1798` (+5), `fail 0`.
513
+
514
+ **Rule recorded**: when a control is unavailable because of the current state, keep it visible and
515
+ say why. Silently hiding makes users think the feature is gone; silently disabling makes them
516
+ think they clicked wrong.
517
+
518
+ ## 0.1.4 — 2026-11-28
519
+
520
+ ### 中文
521
+
522
+ **真 bug:文本重复的次数下拉「能选但存不进去」**(2026-11-28 修复)
523
+
524
+ - **现象**:设置页「轮次控制 → 强制打断 → 文本重复」的下拉显示 **10**,
525
+ 但服务端实际生效值是 **30** —— 界面既显示不出真实值,也选不成 30。
526
+ - **根因是两处,少修一处都是假修**:
527
+ 1. **客户端**(`src/client.js`):`textRepeat` 写死 `min:3 / limit:10`,
528
+ 而夹取逻辑 `max <= one.limit ? max : one.max` 把 30 判为越界、**回落到残留旧值**。
529
+ 下拉因此只有 3~10,永远出不了 30。
530
+ 2. **服务端**(`src/state-route.js` 的 `parseInterruptPatch`):两处钳制都写死
531
+ `MAX_STUCK_THRESHOLD(10)`,**漏了 textRepeat 该走 `MAX_TEXT_REPEAT_THRESHOLD(100)` 的分支**
532
+ (`src/stuck.js` 早就有正确写法,这里没抄)。
533
+ 实测:`sent 15/50/75/100 → stored 30`,全部被钳回默认值。
534
+ - **修法**:
535
+ - 客户端改成**离散档位** `options: [15, 30, 50, 75, 100]`、默认 `30`;
536
+ 三个消费点(下拉生成 / 同步夹取 / 保存夹取)统一走 `stuckInterruptOptionValues` 与
537
+ `stuckInterruptAcceptsMax` 两个新函数,**没有 `options` 的检测器仍走旧的 `min..limit`**;
538
+ - 服务端 `parseInterruptPatch` 两处钳制改成按 kind 取 `upper`;
539
+ - `MAX_TEXT_REPEAT_THRESHOLD` 从 `30` 抬到 `100`(默认值仍是 30,不变)。
540
+ - **为什么是这五个档位**:用户 2026-11-28 指定。**这覆盖了设计稿 `:319` 的 3~10**
541
+ (设计稿是 mockup,用户口径优先)。
542
+ - **验证读数**(独立只读验收子代理亲自跑,不是执行者自报):
543
+
544
+ | 用户选 | 下拉里有 | 服务端存成 |
545
+ |---|---|---|
546
+ | 15 / 30 / 50 / 75 / 100 | 全部 true | **全部原样存进去** |
547
+
548
+ - 「客户端有、服务端存不进的」= **空集**(五档一档不漏)
549
+ - `toolFail.max=15` 仍被拒回 **6**、`loop.max=15` 仍被拒回 **3**(另两个没被顺手放大)
550
+ - `src/index.js` **零钳制**(`:5386` 是调用点不是钳制点),保存路与直调路由共用同一个 `parseInterruptPatch`
551
+ - **回归防护**:新增 `test/stuck-interrupt-options.test.mjs`(7 条)+
552
+ `test/state-route-interrupt-upper.test.mjs`(7 条)。
553
+ 变异验证:撤回服务端分支 → 7/7 变 4/7;撤回客户端 `options` → 7/7 变 1/7。
554
+ - 全量测试:`1779 → 1793`(+14),`fail 0`。
555
+
556
+ **这次教训**(写下来免得下次重犯):改「配置项的取值范围」时,**客户端可选集合、
557
+ 服务端保存钳制、服务端归一化**是三条独立的路径,必须逐一确认。
558
+ 只改客户端 = 能选不能存;只改服务端 = 能存不能选。**两者都不是修好。**
559
+
560
+ ### English
561
+
562
+ **Real bug: the text-repeat dropdown could be selected but could not be saved** (fixed 2026-11-28)
563
+
564
+ - **Symptom**: the dropdown showed **10** while the server-side effective value was **30** —
565
+ the UI could neither show the real value nor let you pick 30.
566
+ - **Two root causes; fixing only one is a fake fix**:
567
+ 1. **Client** (`src/client.js`): `textRepeat` was hard-coded to `min:3 / limit:10`, and the
568
+ clamp `max <= one.limit ? max : one.max` treated 30 as out-of-range and **fell back to a
569
+ stale value**, so the dropdown could never offer 30.
570
+ 2. **Server** (`src/state-route.js` `parseInterruptPatch`): both clamps hard-coded
571
+ `MAX_STUCK_THRESHOLD(10)` and **missed the textRepeat branch** that `src/stuck.js` already had.
572
+ Measured: `sent 15/50/75/100 -> stored 30`.
573
+ - **Fix**: client switched to discrete `options: [15, 30, 50, 75, 100]` (default 30) via two new
574
+ helpers, so detectors without `options` keep the old `min..limit` behaviour; server clamps now
575
+ pick `upper` per kind; `MAX_TEXT_REPEAT_THRESHOLD` raised `30 -> 100` (default stays 30).
576
+ - **Why these five values**: specified by the user on 2026-11-28, overriding the mockup 3~10.
577
+ - **Verified** by an independent read-only verifier: all five values round-trip unchanged; the set
578
+ "client offers but server rejects" is **empty**; the other two detectors were not widened.
579
+ - Full suite: `1779 -> 1793` (+14), `fail 0`.
580
+
581
+ **Lesson recorded**: when changing the allowed range of a config value, the client option set, the
582
+ server save clamp and the server normalizer are three independent paths - check all three.
583
+
584
+ ## 0.1.3 — 2026-11-28
585
+
586
+ ### 中文
587
+
588
+ **真 bug:`goal_debts` 在 70 个会话上整只工具报废**(2026-11-28 修复)
589
+
590
+ - **现象**:调用 `goal_debts` 返回 `invalid output`,一条欠账都读不出来。
591
+ - **根因**:读取侧把「工具连续失败」这类**异常提醒**重分类成 `type=anomaly`
592
+ (`src/debts.js:448`),而输出 schema 的 `kind` enum 只有 4 个值、且三处
593
+ `additionalProperties:false` 是严格模式 —— **清单里只要一条越界,整次输出被拒**,
594
+ 不是只丢那一条。
595
+ - **修法**(**没动 enum、没动账本格式**):
596
+ 1. 产出侧把异常提醒拆到独立数组 `anomalies`,schema 给它单独一份
597
+ `ANOMALY_ITEM_PROPERTIES`(`kind` 固定 `anomaly`);
598
+ 2. 产出侧加 `DEBT_KINDS.includes(kind)` 白名单兜底,将来账本混进怪值也不会报废;
599
+ 3. `total` 口径改为「范围内**欠账**条数」(原来把异常提醒也算进去了,那本身就是 bug 的一部分)。
600
+ - **真机读数**(独立验收子代理复跑):
601
+ - 修前:2275 账本 / 2431 欠账行 / **267 条越界** / **70 个会话**,其中 **69 个会话的输出过不了自己的 schema**;
602
+ - 修后:**0 条越界 / 0 个会话过不了 schema / 267 条全部归位到 anomalies**。
603
+ - **回归防护**:新增 `test/debts-anomaly-split.test.mjs`(5 条行为级用例)。
604
+ 变异验证:把拆分逻辑撤回后,用例从 5/5 变 2/5,失败原文正是
605
+ `value.debts[0].kind: "anomaly" 不在 enum 里` —— 与真机事故形状一致。
606
+ - 全量测试:`1774 → 1779`(+5 条新用例),`fail 0`。
607
+
608
+ **已知缺口**(本次未修,已记录):`fail()` 的三个错误分支里的 `anomalies` 键
609
+ **目前没有测试覆盖** —— 变异实验(删掉它)不会让任何用例变红。今天的代码是对的,
610
+ 但将来谁漏了这一行,测试拦不住。
611
+
612
+ ### English
613
+
614
+ **Real bug: `goal_debts` was completely broken on 70 sessions** (fixed 2026-11-28)
615
+
616
+ - **Symptom**: `goal_debts` returned `invalid output` and no debt could be read at all.
617
+ - **Root cause**: the read path reclassifies "tool keeps failing" reminders as
618
+ `type=anomaly` (`src/debts.js:448`), but the output schema declares `kind` with an
619
+ enum of only four values under `additionalProperties:false` — **a single out-of-enum
620
+ row rejects the entire tool output**, not just that row.
621
+ - **Fix** (no enum change, no on-disk ledger change):
622
+ 1. the producer now puts anomaly reminders into a separate `anomalies` array with its
623
+ own `ANOMALY_ITEM_PROPERTIES` (`kind` pinned to `anomaly`);
624
+ 2. a `DEBT_KINDS.includes(kind)` allow-list guards the `debts` array;
625
+ 3. `total` now counts **debts only** (it used to include anomalies, which was itself
626
+ part of the bug).
627
+ - **Measured on the real ledger** (re-run by an independent read-only verifier):
628
+ - before: 2275 files / 2431 debt rows / **267 out-of-enum rows** / **70 sessions**,
629
+ of which **69 failed their own output schema**;
630
+ - after: **0 out-of-enum rows, 0 failing sessions, all 267 moved into anomalies**.
631
+ - **Regression guard**: new `test/debts-anomaly-split.test.mjs` (5 behaviour-level cases).
632
+ Mutation check: reverting the split turns 5/5 into 2/5 with
633
+ `value.debts[0].kind: "anomaly" not in enum` — the same shape as the real incident.
634
+ - Full suite: `1774 → 1779` (+5), `fail 0`.
635
+
636
+ **Known gap** (not fixed here): the `anomalies` key inside the three `fail()` error
637
+ branches has **no test coverage** — deleting it turns nothing red today.
638
+
639
+ ## 0.1.2 — 2026-11-27
640
+
641
+ ### 中文
642
+
643
+ **测试基础设施:两处「检查写了但没人看得见」的缺陷**(2026-11-27 修复)
644
+
645
+ - `test/stream-breaker.test.mjs` **从来没被入口垫片引用** —— 那 13 个用例一直没进过验收命令。
646
+ - 垫片的「漏引用自检」原来直接 `throw`,但 `node:test` 会把模块顶层的 throw 吞成
647
+ `uncaughtException`,**fail 计数一点不变**。后果:自检明明在喊「某份测试没被引用」,
648
+ 报表照样显示「fail 11(全是既有失败)」,谁也不会注意到。
649
+ 改成一条真测试后,漏引用会让 fail 计数 +1、报表当场变红。
650
+
651
+ 验收读数(实测):`tests 1758 → 1774`、`pass 1747 → 1763`、`fail 11 → 11`(零新增)。
652
+ 多出来的 16 例 = stream-breaker 的 15 例(本来就存在、只是没被跑)+ 1 条垫片自检。
653
+
654
+ 这一版把「强制打断」从纸面做成了真会停的东西,并把面板上一直占地方却没用的几段文字清掉了。
655
+
656
+ **强制打断:三个检测器全部接进运行时**
657
+
658
+ 设置页「轮次控制」卡里新增「强制打断」整块:一个子开关 + 三个勾选框 + 三个下拉(工具连续失败 6 / 循环检测 3 / 文本重复 6,都可调)。勾上之后:
659
+
660
+ - **工具连续失败**:同一个工具连续报错到阈值,再调它会被当场拒绝(`tools/pre-execute` 返回 `deny`),只拒这一条调用,不打断整轮。
661
+ - **循环检测**:看的是「调用参数 + 返回结果」的指纹。**结果变了就算有进展**——同一个命令跑两次但输出不同,不拦。另外能抓「来回摆」(A→B→A→B)。参数里的时间戳会先归一化,所以「同一件事重试」照样抓得到。
662
+ - **文本重复**:模型正文反复吐同一段时**截断本轮输出、回合正常结束**。判据是「连续相同的 `text-delta` 数」,**代码默认阈值 10**(下拉档位 3 / 6 / 10 / 30 …)。本次实测时用户把它配成 **30**,理由是「原抄 `dsh-loop-guard` 的 60 太大、卡死时等太久」;这个 30 是**配置值**,不是默认值。`------` 这类表格线和正常长文不会误报。
663
+
664
+ 只读工具(read / grep / glob 等 12 个)失败不计入「工具连续失败」——读文件失败没有破坏性,算进去会误伤最正常的排查。但「反复读同一个不存在的文件、结果都一样」仍然会被循环检测拦下。
665
+
666
+ 拦截文案照交接文档原样,不做改写。
667
+
668
+ **拦截不会把会话锁死**(2026-11-27 修,同版内修复)
669
+
670
+ 第一版接线有个致命缺陷:**某条调用被拦过一次之后,第 4 次起会永久拦下去**,用户看到的是「所有会话都提示【轮次控制已拦截】然后动不了」。
671
+
672
+ 原因有两层:① 它把「我自己拒绝了这次调用」也当成一次工具失败记进历史 —— 而拒绝文案是恒定的,于是「参数相同 + 结果相同」把循环判据(默认 3 次)喂满;② `reset()` 在接线层没有任何调用点,计数跨轮永不归零,锁死无法自愈。
673
+
674
+ 现在**拦下这一条之后立刻清零本会话计数**:语义变成「拦一次、重新起算」。真死循环仍然每攒够阈值就被拦一次,但不会锁死。回归测试用「同一参数 + 恒定拒绝文案」连跑 12 次,要求被拦次数落在 1~4 次之间 —— 修好之前实测是 9 次(第 4 次起一直拦)。
675
+
676
+ 同一条纪律适用于以后任何闸:**「闸自己拒绝了」不是「工具失败了」的证据,计数器也不许只增不减。**
677
+
678
+ 配置会真正落盘:勾选与阈值重启后还在。以前设置页能勾但存不住——`updateStuckConfig` / `readStuckOverride` / `writeStuckOverride` 三层都没带这个字段,现在三层都通了。
679
+
680
+ **面板:清掉三段旧版本残留**
681
+
682
+ 「目标契约」卡里删掉了卡片标题、只读说明句和「修订号」那一行——它们跟页面上方的信息重复,而且「目标契约」是插件自己的名字,不该出现在用户面前。「里程碑 / 阶段」这个行标签也去掉了:那个框本来就是里程碑。
683
+
684
+ 「还没完的事」这一列改名为「未完结事项」,欠账与用户待定条目合成一组(每条仍带自己的来源标签),「异常提醒」保持独立一组。
685
+
686
+ **砍掉 roundStall / roundStop 两级**
687
+
688
+ 轮次控制原来的「提醒 / 停止」两级整体删除。它和新的三检测器是两套判据,并存只会让「为什么这次没拦」变得说不清。`stuckInstruction`(工具连续失败那条)保留。
689
+
690
+ **修掉设置页思考强度下拉点不动的毛病**
691
+
692
+ 三种情况现在都会给出原因,不再是一个灰框让人猜。
693
+
694
+ ### English
695
+
696
+ This release turns "forced interrupt" from a document into something that actually stops the model, and removes several lines of leftover text from the panel.
697
+
698
+ **Forced interrupt: all three detectors are wired into the runtime**
699
+
700
+ The settings page's turn-control card gains a "forced interrupt" block: one sub-switch, three checkboxes and three dropdowns (consecutive tool failures 6 / loop detection 3 / text repetition 6, all adjustable). Once enabled:
701
+
702
+ - **Consecutive tool failures**: when one tool fails repeatedly up to the threshold, the next call to it is denied at `tools/pre-execute` — only that one call, never the whole turn.
703
+ - **Loop detection**: based on a fingerprint of "arguments + result". **A changed result counts as progress** — the same command run twice with different output is not blocked. Back-and-forth patterns (A→B→A→B) are also caught. Timestamps in arguments are normalized first, so genuine retries are still detected.
704
+ - **Text repetition**: when the model's own text repeats the same passage, this turn's output is **truncated** and the turn ends normally. The criterion is the count of consecutive identical `text-delta` chunks, default threshold **30** (originally 60, taken from `dsh-loop-guard`; lowered on user request). Table rules like `------` and ordinary long prose do not trigger it.
705
+
706
+ Failures of read-only tools (read / grep / glob and nine others) do not count toward "consecutive failures" — a failed read is harmless, and counting it would punish ordinary investigation. Repeatedly reading the same missing file with identical results is still caught by loop detection.
707
+
708
+ The denial text is used verbatim from the handoff document.
709
+
710
+ **Interrupting never locks the session out** (fixed 2026-11-27, same release)
711
+
712
+ The first wiring had a fatal defect: **once a call had been denied a single time, it stayed denied forever from the 4th attempt on** — users saw "every session shows 【轮次控制已拦截】 and then nothing works".
713
+
714
+ Two causes stacked: ① the interceptor recorded **its own denial** as a failed tool call, and since the denial text is constant, "same arguments + same result" saturated the loop detector (default 3); ② `reset()` had no call site in the wiring layer, so counters accumulated across turns forever and the lock-in could never heal.
715
+
716
+ Now **each denial immediately clears that session's counters**: the semantics are "deny once, start over". A genuine loop is still denied every time it reaches the threshold, but it can no longer wedge the session. The regression test replays the same call with a constant denial text 12 times and requires the denial count to land between 1 and 4 — before the fix it measured 9 (denied from the 4th attempt onward).
717
+
718
+ The same discipline applies to any future gate: **"the gate denied this" is not evidence that "the tool failed", and counters must never only ever grow.**
719
+
720
+ Configuration now actually persists: checkboxes and thresholds survive a restart. Previously the settings page accepted changes but the value was dropped by `updateStuckConfig` / `readStuckOverride` / `writeStuckOverride`; all three layers now carry it.
721
+
722
+ **Panel: three pieces of stale text removed**
723
+
724
+ The contract card no longer shows its own title, the read-only explanation, or the revision row — they duplicated information already visible above, and the plugin's own name does not belong in front of the user. The "milestones / stages" row label is gone too: the whole box is milestones.
725
+
726
+ The "not done yet" column is renamed "unfinished items", with debts and user-pending notes merged into one group (each row keeps its source label); "anomalies" stays a separate group.
727
+
728
+ **roundStall / roundStop removed**
729
+
730
+ The old two-level "remind / stop" turn control is deleted entirely. It and the new three detectors were two separate rule sets; keeping both made "why wasn't this blocked" unanswerable. `stuckInstruction` (the consecutive-failure path) is kept.
731
+
732
+ **Settings page: thinking-effort dropdown no longer dead**
733
+
734
+ All three cases now explain themselves instead of showing a grey box and leaving the user guessing.
735
+
736
+ ## 0.1.1 — 2026-11-25
737
+
738
+ ### 中文
739
+
740
+ 这是本插件第一个对外发布的版本(`0.1.0` 从未发布)。它给一次会话立一份目标契约——要交付什么、允许动什么、明确不许动什么、怎样才算做完——并把每次变更记成 append-only 的台账。
741
+
742
+ **目标与里程碑**
743
+
744
+ - 面板上的「最近改了什么」改名为「目标和里程碑变更台账」,并且只记录**目标与里程碑本身的变化**(立目标、改目标、勾里程碑、报轮次、收尾、暂停、状态变化)。简报、诊断采样、对账闸标记这类过程记录一律不再出现——以前它们会以「技术原文」的名义混进台账。
745
+ - 删除旧的「契约详情」子页签与旧变更台账卡片,只保留新的三列仪表盘。
746
+ - 仪表盘第一列的目标文字加「当前目标:」前缀,过长时换行而不是截断。
747
+
748
+ **同步按钮**
749
+
750
+ - 按钮状态补上「未创建目标」与「读取中…」两态:还没有目标时不再假装能同步;状态还没取到时说「读取中」,不再闪一下「无法同步」。
751
+ - 目标文字与右侧状态栏按钮统一字号。
752
+ - 去掉这里的第二个同步按钮(同步入口保留在输入框上方那一条)。
753
+
754
+ **修掉两个状态显示错误**
755
+
756
+ - **换掉整套目标后按钮仍显示「已完成」**:判据原来是「账本里最后一条 phase 事件是不是 complete」,而 `goal_amend` 换掉验收条之后那条旧 phase 仍停在 complete。现在「完成」只认当前契约——phase 说完成、但契约还有没勾完的验收时,判定该 phase 属于上一版目标,不予采信。
757
+ - **「无法同步」一闪而过**:数据还没取到时被当成了「宿主不支持同步」。现在把「不知道」和「不可用」分成两态。
758
+
759
+ **目标做完后再提新需求时主动提醒**
760
+
761
+ - 以前「目标已完成 + 用户又提新活」只在模型真要动手时拦一下,**从不在对话里说任何话**。现在会在用户发新话的那一轮主动说一句:这条目标已经做完了,你现在说的是新的,先说清是重开旧里程碑还是加新的。
762
+ - 这个判断只用账本做本地计算,不经过路由抽取模型——模型没跑或超时也会照常提醒。
763
+
764
+ **设置页**
765
+
766
+ - 二审设置里说明「只用代码核对」和「加上大模型复核」的区别。
767
+ - 路由抽取模型的说明改为推荐配置小模型以节省成本,并把默认值改为跟随二审主模型(**已经保存过的配置不会被覆盖**)。模型要求:能稳定输出规定 JSON、响应快、优先非推理模型。
768
+
769
+ ### English
770
+
771
+ This is the first published release of the plugin (`0.1.0` was never published). It gives a session a goal contract — what to deliver, what may be touched, what must not be touched, and what counts as done — and records every change in an append-only ledger.
772
+
773
+ **Goals and milestones**
774
+
775
+ - The panel's "what changed recently" is now the **goal and milestone change ledger**, and it records only changes to the goals and milestones themselves. Briefings, diagnostic samples and reconciliation markers no longer appear there — previously they leaked into the ledger as "raw technical text".
776
+ - The legacy "contract details" sub-tab and the legacy ledger card are removed; only the new three-column dashboard remains.
777
+ - The objective in the first column is prefixed with "Current goal:" and wraps instead of being truncated.
778
+
779
+ **Sync button**
780
+
781
+ - Two new states: "no goal yet" and "loading". The button no longer pretends it can sync when no goal exists, and no longer flashes "cannot sync" while the state is still loading.
782
+ - Button font size in the right-hand status bar now matches the objective text.
783
+ - The duplicate sync button in this area is gone (the sync entry point stays above the input box).
784
+
785
+ **Two status-display bugs fixed**
786
+
787
+ - **The button kept saying "done" after the whole goal was replaced**: the check used the latest `phase` event in the ledger, which still said `complete` after `goal_amend` replaced the acceptance items. "Done" now depends on the current contract only — a stale `complete` phase is ignored while the contract still has unchecked items.
788
+ - **"Cannot sync" flashed briefly**: a state that had not loaded yet was treated as "the host does not support sync". "Unknown" and "unavailable" are now separate states.
789
+
790
+ **A nudge when new work arrives after the goal is done**
791
+
792
+ - Previously the plugin only intercepted tool calls when a finished goal received new work; it never said anything in the conversation. It now speaks up in the turn where new work arrives: this goal is finished, what you just said is new — decide whether to reopen a milestone or add one.
793
+ - This decision is computed locally from the ledger, never through the route-extraction model, so it still fires when that model is unavailable.
794
+
795
+ **Settings**
796
+
797
+ - The review settings explain the difference between code-only verification and adding an LLM review pass.
798
+ - The route-extraction model hint now recommends a small model to save cost, and defaults to following the main review model (existing saved configuration is never overwritten). Requirements: reliable JSON output, low latency, prefer a non-reasoning model.