dsh-goal-contract 0.2.6 → 0.2.9

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
@@ -4,6 +4,90 @@
4
4
 
5
5
  本文件记录 `dsh-goal-contract` 的对外变化。每条先中文整段、再英文整段。
6
6
 
7
+ ## 0.2.9 — 2026-11-29
8
+
9
+ 中文 / English
10
+
11
+ ### 中文
12
+
13
+ 这一版没有新功能,修两处**已经存在的行为不对**。
14
+
15
+ **销账(`goal_settle_queue`)在条目变长以后就无法按文字销账。** 失败时列出候选条目的信息只带截断到 30 字的文字,而按文字匹配要求相似度 ≥ 0.5;一个 130 字的条目,前 30 字的相似度只有 0.40 —— 差 10 个字。用户拿工具自己显示的那段文字去销账,两边一模一样却一直失败,而失败信息还让他「改口再试」,等于永远试不对。三处一起修:① 候选条目加上 id,失败信息里能直接照抄 id 再销一次;② 文字被截断时点明「共 N 字」,不再把残句当整条;③ 调用方给的前缀只要 ≥ 10 字且真的是某条目的开头,直接命中,不再走相似度打分。原有的相似度路径、阈值与失败文案一个字没动。
16
+
17
+ **捕获提醒里带着 ①②③④ 四个编号。** 编号对写插件的人来说很清楚,对看到这条提醒的用户毫无意义 —— 模型经常只回一句「按第 ④ 条处理」,用插件的人根本不知道 4 指什么。现在判据改成用「哪种情况」的自然语言描述,并且明确要求模型**用一句大白话告诉用户「这句话我按什么处理了」**,例如「你让我把间距改深一点 —— 这是个具体数值改动,我改完代码就跑测试,不占验收条」。四个判据本身、错误关键词那条限制、以及「只记队列等于没记」的理由一句没少;只是去掉了可以照抄的编号,模型没有数字可引用,只能复述情况。
18
+
19
+ 合并提醒(同一轮捕获到好几句)里,原话清单前面的 ①②③④⑤ **保留**——那是给模型区分「这是第几句原话」用的,和判据编号是两回事。
20
+
21
+ 验证口径:1833 条测试全部通过、0 失败;销账那三处另用临时脚本实测过「130 字条目 + 前 30 字能销掉」「6 字前缀不会误销」「不存在的 id 会列出可照抄的 id 与总字数」。
22
+
23
+ **`goal_amend` 整段替换验收时,会把已勾过的验收点悄悄冲掉。** 修之前:勾了 3 条、传一个新清单进来,那 3 条勾全部消失,接口只回一句「⚠ 有 3 个勾被作废」——进度丢了,但操作算成功。现在这种情况直接拒绝,并把丢掉的那几条逐条点名(例如「第 1 条「跑通测试」(已打勾)」),同时给出两条出路:`appendMilestones`(只加不删),或 `confirmReplace: true`(我确实知道会丢,就这么办)。被拒时账本一行都不写、契约也没动——拒绝不等于执行。
24
+
25
+ 什么不算「丢」:旧条目的里程碑被原样带到新清单里(按 id 或标题能对上),说明进度被迁移保住了,不拦。判据和迁移逻辑用同一把尺,不会出现「迁移说你还在、闸说你丢了」。
26
+
27
+ 被冲掉时账本会留一条 `acceptance-replaced` 记录,写明冲掉几条、分别叫什么 —— 事后能查「上次那批改动到底丢了什么」。
28
+
29
+ 本版同时把 `goal_amend` 的这几条行为都写进了测试:新增 8 条(三个判据的纯函数、四条端到端、一条账本留痕),并做了变异测试——故意改错一条断言,确认它会红,证明这些断言真的在跑而不是空壳。
30
+
31
+ ### English
32
+
33
+ No new features in this release — two **existing behaviours that were wrong** are fixed.
34
+
35
+ **Settling a queue entry by its text stopped working once the entry got long.** When settling failed, the candidate list only carried the first 30 characters of each entry, while text matching required a similarity of at least 0.5. For a 130-character entry the first 30 characters score only 0.40 — ten characters short. A user copying the very text the tool had just shown them could never settle the entry, and the failure message told them to "try phrasing it differently", which could never work. Three things changed together: (1) candidates now carry their id, so the failure message can show an id to copy; (2) truncated text now says how long the full entry is instead of presenting a fragment as the whole thing; (3) a caller-supplied prefix of at least 10 characters that really is the start of an entry now matches directly instead of going through the similarity score. The existing similarity path, its threshold and its failure wording are untouched.
36
+
37
+ **The capture reminder carried the numbers ①②③④.** The numbering is clear to whoever writes the plugin and meaningless to the user who sees the reminder — models routinely answered with "handled under item ④", which tells a plugin user nothing. The criteria are now phrased as natural-language descriptions of each situation, and the model is explicitly asked to **tell the user in one plain sentence what it did with that sentence**, for example "you asked me to darken the spacing — that is a concrete value change, so I change the code and run the tests rather than touching an acceptance item". All four criteria, the bug-keyword restriction and the "a queue entry nobody can see equals no record at all" rationale are still there; only the copyable numbers are gone, so there is no digit left to quote instead of stating the situation.
38
+
39
+ In the merged reminder (several sentences captured in one turn), the ①②③④⑤ before the quoted sentences **stay** — those number the sentences for the model, and are a different thing from numbering the criteria.
40
+
41
+ Verification: all 1833 tests pass, 0 failures; the three settle changes were additionally checked with a throwaway script — a 130-character entry settles from its first 30 characters, a 6-character prefix does not match anything, and an unknown id now lists copyable ids together with each entry's length.
42
+
43
+ **Replacing the whole acceptance list through `goal_amend` used to wipe out already-checked-off items without saying so.** Before the fix: three acceptance points checked, then a new list passed in, and all three ticks vanished while the call only answered "⚠ 3 ticks were voided" — the progress was gone but the operation counted as a success. It now refuses, names every lost item (for example "item 1 "run the tests" (already checked)"), and offers two ways forward: `appendMilestones` (add only, never remove), or `confirmReplace: true` (I know progress will be lost, do it anyway). A refused call writes nothing to the ledger and leaves the contract untouched — a refusal is not an execution.
44
+
45
+ What does not count as "lost": when an old item's milestones are carried over into the new list unchanged (matching by id or title), the progress survived the migration, so it is not treated as lost. The check and the migration use the same rule, so there is no case where the migration says the item is still there while the guard claims it was lost.
46
+
47
+ When a replacement does go through, the ledger records an `acceptance-replaced` entry stating how many items were voided and what they were called — so "what exactly did that batch of changes throw away" can be answered afterwards.
48
+
49
+ All of these behaviours are covered by tests in this release: eight new cases (pure functions for the three rules, four end-to-end paths, one ledger-record check), plus a mutation test that deliberately breaks one assertion and confirms it goes red, proving the assertions actually run instead of being empty shells.
50
+
51
+ ## 0.2.8 — 2026-11-29
52
+
53
+ 中文 / English
54
+
55
+ ### 中文
56
+
57
+ 这一版没有新功能,是**版本适配**:状态路由跟上宿主自带的准入机制,另外修「测试会随仓库放在哪个目录而变红」并给 CI 加了一道检查。
58
+
59
+ **状态路由改为跟随宿主自带的准入机制。** 以前这两条路由(面板读目标状态、读锁)自己不管准入;现在把判断交给宿主已有的机制,不再自己另搞一套。在宿主没有提供该机制的运行时(例如桌面版),这段自动放行,行为与以前完全一样。
60
+
61
+ **两条测试原来只在特定目录布局下才过。** 一条把「插件目录的父目录」写死成了 `plugins`,只派生最后一段目录名——仓库一离开 `plugins/` 就后缀匹配不上,本该放行的写操作被误判成越界;另一条把夹具造在「当前目录」下的绝对路径里,一旦整个项目被放进系统临时目录,源码文件就会被判成临时物、记一条假欠账。现在两条都改成不依赖检出位置:父目录名也派生,夹具改用相对路径。
62
+
63
+ **CI 新增一道「环境无关性」检查。** 它故意把仓库检出到一个不叫 `plugins` 的目录名下再跑测试——以后任何人(包括外部贡献者)再写出依赖检出路径的测试,会在 CI 上第一次就红,而不是等本地绿、CI 红、没人知道为什么。
64
+
65
+ CI 里跑测试改用 `scripts/ci-run-tests.mjs`:退出码与 `node --test test/` 完全一致(通过 / 失败判定不变),但失败时会把失败用例名打成 GitHub 注解,红了一看就知道是哪条,不用登录网页翻长日志、也不用令牌。
66
+
67
+ **Node 最低要求提到 24。** DSH 本体要求的就是 24,插件没理由比宿主更宽松;而且实测 Node 22 的 `zlib.zstdDecompressSync` 解不了多段 zstd —— 同一个 69 MB 会话日志,Node 24 解出 126 MB,Node 22 只解出 252 字节,凡是走这条路径的能力在 22 上都不可用。CI 同步只测 24(windows + linux 两个平台)。
68
+
69
+ 验证口径:干净克隆 + 非 `plugins` 目录名 + 空 `HOME` 三重叠加下,1825 条测试 1825 通过、0 失败;真实会话日志回归在本机有日志时一并跑过,日志不在本机时按设计跳过。改前同样条件是 1813 通过、2 失败。
70
+
71
+ `src/**` 这版只动了 `state-route.js` 一处(状态路由接入宿主准入机制),另加了 4 条跟着它的回归测试;其余源码未动。
72
+
73
+ ### English
74
+
75
+ No new features in this release — it is a **compatibility update**: the state route now follows the admission mechanism the host already provides, and tests that only passed under one particular checkout layout are fixed, with a CI check for that class of problem.
76
+
77
+ **The state route now follows the admission mechanism the host already provides.** The two routes (the panel reading goal state and locks) used to do no admission of their own; the decision is now delegated to the host's existing mechanism instead of a second one being invented here. On a runtime that does not provide it (the desktop app, for example), this section admits everything, so behaviour is exactly as before.
78
+
79
+ **Two tests depended on where the repo happened to live.** One hardcoded `plugins` as the parent directory and only derived the last path segment — the moment the repo left `plugins/`, suffix matching failed and a write that should have been allowed was rejected as out of scope. The other built its fixture at an absolute path under the current directory, so whenever the project sat inside the system temp directory, a source file was classified as a temporary artefact and a false debt was recorded. Both are now location-independent: the parent directory name is derived too, and the fixture uses a relative path.
80
+
81
+ **CI gains an "environment independence" check.** It deliberately checks the repository out into a directory that is *not* named `plugins` and runs the tests there — so anyone (including outside contributors) who writes a checkout-path-dependent test sees it go red in CI immediately, instead of local green / CI red with nobody knowing why.
82
+
83
+ CI now runs the tests through `scripts/ci-run-tests.mjs`: the exit code matches `node --test test/` exactly (the pass/fail verdict is unchanged), but a failure prints the failing test names as GitHub annotations, so a red run tells you which test failed without opening the web UI for a long log or using a token.
84
+
85
+ **Minimum Node is now 24.** DSH itself requires 24, so the plugin has no reason to be laxer than its host. Measured: Node 22's `zlib.zstdDecompressSync` cannot decode multi-frame zstd — the same 69 MB session log yields 126 MB of output on Node 24 but only 252 bytes on Node 22, so every capability on that path is unusable there. CI now tests 24 only, on both windows and linux.
86
+
87
+ Verification: under a clean clone, a non-`plugins` directory name and an empty `HOME` at once, all 1,825 tests pass with 0 failures; the real-session-log regression runs when the log is present on the machine and skips by design when it is not. Before the fix the same conditions gave 1,813 pass and 2 fail.
88
+
89
+ Under `src/**` this release touches exactly one file — `state-route.js` (the state route now goes through the host's admission mechanism) — plus four regression tests that cover it; no other source file changed.
90
+
7
91
  ## 0.2.6 — 2026-11-28
8
92
 
9
93
  中文 / English
package/README.en.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [中文](README.md) | **English**
4
4
 
5
- Current version: 0.2.6
5
+ Current version: 0.2.9
6
6
 
7
7
  **While you are away, the AI's goal keeps moving forward — under control.**
8
8
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **中文** | [English](README.en.md)
4
4
 
5
- 当前版本:0.2.6
5
+ 当前版本:0.2.9
6
6
 
7
7
  **你走开的时候,AI 的目标还在(相对)受控地往前走。**
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-goal-contract",
3
- "version": "0.2.6",
3
+ "version": "0.2.9",
4
4
  "type": "module",
5
5
  "description": "Helps keep an AI agent's goal under control while you are away. It cannot silently change the goal, completing a milestone needs a real command exit code, and it stops on repeated failures, loops or text repetition instead of grinding all night.",
6
6
  "license": "MIT",
@@ -19,6 +19,7 @@
19
19
  "icon.svg",
20
20
  "cordis.patch.yml",
21
21
  "README.md",
22
+ "README.en.md",
22
23
  "ORIGIN.md",
23
24
  "CHANGELOG.md"
24
25
  ],
@@ -65,6 +66,6 @@
65
66
  },
66
67
  "author": "Eason-22",
67
68
  "engines": {
68
- "node": ">=22"
69
+ "node": ">=24"
69
70
  }
70
71
  }
package/src/index.js CHANGED
@@ -340,23 +340,27 @@ export function injectedSessionMessage(text) {
340
340
  */
341
341
  export const CAPTURE_NOTICE_TEMPLATE = [
342
342
  '【捕获】你这一轮没处理用户的话:「{{quote}}」',
343
- '用户说过的话不该凭空丢掉。按下面四条判,选一个,并且必须落到工具上:',
344
- '① 出现了新的交付物 → goal_amend 加一条里程碑',
345
- '② 某条验收已经有完成证据 → goal_accept 标完成(「以前坏的 / 没做的,这一轮跑通了」也算完成证据)',
346
- '③ 用户改了口径 / 推翻了原计划 → goal_amend 修正验收(优先于 ①:先改口径再加东西)',
347
- '④ 都不是 → goal_route 记入未完结事项(纠正一个**事实细节**、改代码里的某个值都算 ④;只有改变了「什么算做完」才是 ③)',
348
- '★ 用户说「bug / 坏了 / 不对 / 要修 / 有问题」时,不许只走 ④ 记进未完结事项 —— 先判是新交付物(→ ① 加里程碑)还是已有条目没做完(→ ② 标完成 / ③ 修正验收);都不沾才轮到 ④。',
343
+ '用户说过的话不该凭空丢掉。先判这句话属于哪种情况,然后落到工具上:',
344
+ '- 用户要的是**一件新东西** → goal_amend 加一条里程碑',
345
+ '- **某条验收其实已经做完了**(以前坏的 / 没做的,这一轮跑通了)→ goal_accept 标完成',
346
+ '- 用户**改了口径或推翻了原计划** → goal_amend 修正验收;这种优先于「要新东西」——先改口径再加东西',
347
+ '- **以上都不是**(只是在纠正一个事实细节、改代码里的某个值)→ goal_route 记入未完结事项;只有改变了「什么算做完」才属于「改口径」',
348
+ '★ 用户说「bug / 坏了 / 不对 / 要修 / 有问题」时,别直接当成「记进未完结事项」——先看这是「要一件新东西」还是「已有条目没做完」;都不是才记队列。',
349
349
  ' 理由:队列里的条目面板看不到,用户也不会再说一遍 —— 只记队列等于没记。',
350
- '反例(④ 不是 ①):用户说「面板进度条颜色再深一点」——这是改代码里的一个值,**不许** goal_amend 动验收条。',
351
- // ★★ 2026-11-26(交接文档 2.1,用户原话:「捕获的注入提示里面现在有4个选项,每次模型
352
- // 就回复了一个选4,别人根本就不知道4是什么」):**只改末尾这句**,四条判据一个字不动。
353
- // ★ 为什么不能只写「已按第 N 条处理」:用户不知道 N 指什么。必须让模型把**文字判据**
354
- // 和**具体做了什么**写出来——所以给了正例/反例,光说「别写数字」模型照样写数字。
355
- // ★ 别动的地方:① / ③ 括号里的优先级说明是盲测证明「不给判据也判得对」的唯一承重句;
356
- // ④ 上面那段 bug-/坏了 关键词的前置条件是另一条独立护栏。都不在本条改动范围内。
357
- '判完在回复里写清楚你判成了哪一种、具体做了什么:',
358
- '✓ 正确:「这条是补充说明 —— 我把间距从 8px 改成 12px,记进了未完成事项」',
359
- '✗ 错误:「选4」「④」「按第 4 条处理」(用户不知道数字指什么,必须写文字)',
350
+ // ★★ 2026-11-29(用户原话:「不是已经把这个选哪个选项的编号的部分去掉了吗?……AI 会直接',
351
+ // 告诉我他选了某个编号,那别的用户用我们这个插件根本就不知道这个编号是什么意思啊!',
352
+ // 正确的应该是引导主代理表达他对用户上一句话怎么处理」):',
353
+ // **编号已全部拿掉**(原来那四条是 ①②③④),改成用「哪种情况」的自然语言描述。',
354
+ // ★ 为什么光加反例没用(实测我被自己的反例拦下来过):反例只说了「别写数字」,',
355
+ // 模型照样写「我判成 ①」——因为判据本身就长成编号的样子,它顺手就引用了。',
356
+ // 去掉编号之后没有东西可引用,模型只能复述「这是什么情况」。',
357
+ // ★ 要求的产出也换了:不再是「写清判成了哪一种」,而是「用一句大白话说清这句话你',
358
+ // 按什么处理了」——用户读得懂,不需要看见这张提示也能明白。',
359
+ '**判完之后,用一句大白话告诉用户:这句话你按什么处理了。**',
360
+ '不要说「第几条」「第 N 项」这种带编号的话 —— 用户看不到这张提示,不知道数字指什么。',
361
+ '写清「用户说了什么 → 你做了什么」,例如:',
362
+ '「你让我把间距改深一点 —— 这是个具体数值改动,我改完代码就跑测试,不占验收条。」',
363
+ '「你说面板卡住了 —— 这是个新问题,我加了一条验收来跟它,而不是记进待办就算。」',
360
364
  '这一轮结束仍没处理 → 自动记成未完结事项。',
361
365
  ].join('\n');
362
366
 
@@ -1758,7 +1762,7 @@ export const name = 'dsh-goal-contract';
1758
1762
  export const SERVICE_NAME = 'goalContract';
1759
1763
 
1760
1764
  /** 版本号。必须与 package.json 的 version 一致(测试会核对这两处不漂)。 */
1761
- export const PLUGIN_VERSION = '0.2.6';
1765
+ export const PLUGIN_VERSION = '0.2.9';
1762
1766
 
1763
1767
  // ── 配置声明(挂进 DSH 设置页) ─────────────────────────────────────────────
1764
1768
  //
package/src/ledger.js CHANGED
@@ -728,6 +728,20 @@ export const LEDGER_ALL_KINDS = Object.freeze([
728
728
  // 目标被换掉时,旧验收随之结案归档 —— 不记这一条,账本里就没人说得清
729
729
  // 「那几条旧验收到底怎么了」(这正是本次要修的真 bug)。
730
730
  ...LEDGER_ACCEPTANCE_CLOSED_KINDS,
731
+ // ★★ task-16:**验收被替换**的留痕(kind='acceptance-replaced')。
732
+ // 场景:goal_amend 整段替换 acceptance,冲掉了已被勾选的里程碑 ——
733
+ // 不记这一条,账本里就没人说得清「那几条勾过的进度是怎么没的」。
734
+ // ★ 位置:紧挨 acceptance-closed(同属「验收相关的留痕」这一组)。本数组是
735
+ // **按语义分组**排的,不是字母序 —— 新 kind 按语义落在对应分组里。
736
+ // ★ append() 对这个 kind **没有额外必填字段**:kind 在白名单里就能落账
737
+ // ('owe' 的 temp-doc 绝对路径校验、'accept' 的退出码校验都不适用于它)。
738
+ // ★ 载荷口径(写入端 src/tools.js 的 goal_amend 写这三个字段):
739
+ // lostCount(冲掉了几条)/ lostTitles(标题数组)/ lostItems({index,title} 数组)。
740
+ // ★★ 这三个字段已登记在文件末尾的 LEDGER_KIND_EXTRA_FIELDS 里(task-19 补的),
741
+ // 且冻结逻辑已改成「数组按数组冻结」→ 落账后 lostTitles / lostItems **仍是数组**。
742
+ // (以前:字段没登记 → 全被丢掉;就算登记了,`{...value}` 展开也会把数组
743
+ // 摊成带数字键的对象 —— 读回来是 `{"0":"A","1":"B"}`,不是数组。)
744
+ 'acceptance-replaced',
731
745
  // ★ 2026-11-11(t22):目标变更**被拒**的留痕(不进契约归约、不进变更台账)。
732
746
  ...LEDGER_DENY_KINDS,
733
747
  // ★ M1 契约对账硬闸的三种留痕(见 ACK_GATE_KINDS 的说明)。
@@ -1066,6 +1080,36 @@ export function diffContracts(from, to) {
1066
1080
  return out;
1067
1081
  }
1068
1082
 
1083
+ /**
1084
+ * 冻结一个「按 kind 放行的额外字段」的值(唯一真相见文件末尾的 LEDGER_KIND_EXTRA_FIELDS)。
1085
+ *
1086
+ * ★ 为什么数组要单独一条:以前这里对**所有对象**一律 `{...value}` 展开 ——
1087
+ * **数组会被摊成带数字键的对象**(`['A','B']` → `{0:'A',1:'B'}`),
1088
+ * 存进账本、JSON 序列化、再读回来,得到的还是对象(`{"0":"A","1":"B"}`)——
1089
+ * 「写入端写的是数组、读回来是对象」这种坑最难查(本文件 471/661 行记着同一族坑)。
1090
+ * 写入端的口径是「数组就是数组」(如 acceptance-replaced 的 lostTitles / lostItems),
1091
+ * 所以这里按三种形状分派:
1092
+ * - 数组 → 复制一份再冻结(**数组还是数组**,元素逐个按同规则冻结)
1093
+ * - 其它对象 → 原来的展开方式(`{...value}`),行为逐字节不变
1094
+ * - 其它(字符串 / 数字 / 布尔)→ 原样
1095
+ *
1096
+ * ★ 向后兼容(逐个字段实测过):现有已登记的 kind 里**没有任何一个字段在运行时会拿到数组** ——
1097
+ * round.evidence 是普通对象(`{...计数, positive}`)、route.near 是字符串、
1098
+ * ack / action / ack-gate-blocked 的字段全是标量 → 对它们**逐字节无影响**。
1099
+ *
1100
+ * @param {any} value
1101
+ * @returns {any}
1102
+ */
1103
+ function freezeExtraFieldValue(value) {
1104
+ if (Array.isArray(value)) {
1105
+ return Object.freeze(value.map((item) => freezeExtraFieldValue(item)));
1106
+ }
1107
+ if (value !== null && typeof value === 'object' && !Object.isFrozen(value)) {
1108
+ return Object.freeze({ ...value });
1109
+ }
1110
+ return value;
1111
+ }
1112
+
1069
1113
  /**
1070
1114
  * 记一条账本记录(冻结,调用方改不动)。
1071
1115
  *
@@ -1144,9 +1188,8 @@ function freezeEntry(entry, goalId) {
1144
1188
  for (const field of LEDGER_KIND_EXTRA_FIELDS[String(entry.kind ?? '')] ?? []) {
1145
1189
  const value = entry[field];
1146
1190
  if (value === undefined || value === null) continue;
1147
- extraFields[field] = value !== null && typeof value === 'object' && !Object.isFrozen(value)
1148
- ? Object.freeze({ ...value })
1149
- : value;
1191
+ // ★ 值的形状按三种分派(数组要**还是数组**)——见 freezeExtraFieldValue。
1192
+ extraFields[field] = freezeExtraFieldValue(value);
1150
1193
  }
1151
1194
  return Object.freeze({
1152
1195
  goalId: String(goalId ?? ''),
@@ -3048,6 +3091,16 @@ export const LEDGER_KIND_EXTRA_FIELDS = Object.freeze({
3048
3091
  // reopenText —— reopen 时要重开的那条(「第 N 条」或标题原文)
3049
3092
  // addText —— add 时新增的那条里程碑标题
3050
3093
  route: Object.freeze(['action', 'quote', 'appendText', 'hint', 'near', 'conf', 'reopenText', 'addText']),
3094
+ // ★★★ task-19:**「冲掉了哪几条」的留痕**(kind='acceptance-replaced')。
3095
+ // 写入端(src/tools.js 的 goal_amend 替换保护)传三样:
3096
+ // lostCount —— 数字:冲掉了几条
3097
+ // lostTitles —— 字符串数组:冲掉的那几条的标题
3098
+ // lostItems —— 对象数组:每条 {index, title}
3099
+ // ★ 以前这三个字段**不在表里** → 落账时全被丢掉(条目记上了、内容是空的)。
3100
+ // ★ lostTitles / lostItems 是**数组**:冻结逻辑已改成「数组按数组冻结」
3101
+ // (以前一律 `{...value}` 展开 → 数组被摊成带数字键的对象),所以这里登记完
3102
+ // 读回来仍是数组。
3103
+ 'acceptance-replaced': Object.freeze(['lostCount', 'lostTitles', 'lostItems']),
3051
3104
  });
3052
3105
 
3053
3106
  /** 契约的稳定文本(只取 objective + acceptance,**不含时间戳/修订号/随机量**)。 */