@sema-agent/settings-schema 18.0.0 → 19.0.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.
Files changed (34) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +20 -10
  3. package/conformance/VERSION +1 -1
  4. package/conformance/cases/c01-entry-salvage-then-typo/meta.json +1 -1
  5. package/conformance/cases/c03-literal-dotted-top-key/meta.json +1 -1
  6. package/conformance/cases/c12-prototype-name-top-keys/meta.json +1 -1
  7. package/conformance/cases/c40-s712-identity-only-what-reads-out/meta.json +1 -1
  8. package/conformance/cases/c41-s792-encoded-pem-identity/meta.json +1 -1
  9. package/conformance/cases/c42-s792-unknown-key-secret-redacted/meta.json +1 -1
  10. package/conformance/cases/c43-s792-form-and-deep-encoded-pem/meta.json +1 -1
  11. package/conformance/cases/c44-s792-utf8-escape-glued-token/meta.json +1 -1
  12. package/conformance/cases/c45-s792-identity-bounds-and-decode-depth/meta.json +1 -1
  13. package/conformance/cases/c46-s811-host-name-url-userinfo-withheld/meta.json +1 -1
  14. package/conformance/cases/c47-s811-roles-key-url-userinfo-withheld/meta.json +2 -2
  15. package/conformance/cases/c48-s935-model-headers-transported/meta.json +1 -1
  16. package/conformance/cases/c49-s935-model-headers-secret-entry-dropped/meta.json +1 -1
  17. package/conformance/cases/c57-s784-g1-enabled-no-lane/meta.json +1 -1
  18. package/conformance/cases/c65-s784-pg-without-db/meta.json +1 -1
  19. package/conformance/cases/c71-one-scanner-write-reads-display-forms/meta.json +2 -2
  20. package/conformance/cases/c76-projects-entry-salvage-nested/meta.json +1 -1
  21. package/conformance/cases/t01-absent-domain-key-not-null/meta.json +1 -1
  22. package/conformance/cases/t02-entry-salvage-vs-whole-domain-refusal/meta.json +1 -1
  23. package/conformance/cases/t03-prototype-name-key-not-swallowed/meta.json +1 -1
  24. package/dist/hooks-config.d.ts +23 -5
  25. package/dist/hooks-config.js +33 -5
  26. package/dist/hooks.d.ts +6 -4
  27. package/dist/hooks.js +3 -1
  28. package/docs/API-SURFACE.md +7 -3
  29. package/docs/CC-DIVERGENCE.md +2 -2
  30. package/docs/CONFORMANCE.md +10 -10
  31. package/docs/CONSUMER-INTEGRATION.md +21 -4
  32. package/llms-full.txt +9 -8
  33. package/llms.txt +7 -7
  34. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -8,6 +8,76 @@
8
8
 
9
9
  ## Unreleased
10
10
 
11
+ ## 19.0.1 — 2026-11-03 — patch:随包文件去内部编号 + docs-hygiene K 组门 · 零幸存者律澄清与钉
12
+
13
+ > 已知限制(复审两腿;另票收):已发 CHANGELOG 节里的内部编号(约 159 处)本版未改 —— 本仓此前没有成文的「已发节字节冻结」纪律,且有六个已发节与其 tag 不同;下一版先成文该纪律并配门(照 server 的已发节字节核),再决定是否做一次性清洗。同用途的编号 / 版本词表在 test/ 下仍有多份,随该票并成一张;门 K 认不出的复审项标号(如 WA-NN / L5 / M1 类)与语料数据文件里的编号同票。
14
+
15
+ > 档位(按发版纪律):**patch** —— 文案 / 注释 / 测试:零导出变化、零行为变化(随包文字、一致性语料的 `meta.json` 文字、测试);`docs/API-SURFACE.md` 无需重生。读数不变的地方不写「谁受伤」:没有人。
16
+
17
+ - **随包文本不再带内部编号**。`package.json` 的 `files` 清单里的文本文件此前带着 56 处台账号 / 帖号 / 裁定号(README 8 · `llms.txt` 5 · `llms-full.txt` 6 · `docs/CONSUMER-INTEGRATION.md` 4 · `docs/CONFORMANCE.md` 10 · 一致性语料 17 个 `meta.json` 共 23),读者(消费方、npm 页面)解析不了它们,剩下的只是一句指向够不着的账本的话。
18
+ 这 56 处已逐处改写成事实句 —— 「某票起可带」写成「6.1.0 起可带」,「某帖实测」写成「web-admin 实测」,文档示例里的台账号 `ref` 换成中性的示例值(合 `LEDGER_REF_RULE` 的形);语义不变,换上去的坐标是读者够得着的(版本号 / 行为)。词表认不出的同类编号形另改了 3 处(语料里 web-admin 的两处缺陷号、一处评审条目号)。
19
+ 语料只动 `meta.json` 里 `claim` / `note` 的文字:`input.json` / `expected.json` 一字未动,case 名(目录名)不变;`docs/CONFORMANCE.md` 里「原样收编、未改写措辞」那句因此补了一半(措辞未改,仅把帖号换成不带编号的短语)。
20
+ **一类一门**:`test/docs-hygiene.test.ts` 新增 K 组 —— 读 `package.json` 的 `files` 本身(往里加一项,当天就被扫;npm 对包根隐式收编的 `README*` / `LICENSE*` / `package.json` 同扫),七族词表(票号可带子票小写字母)全文扫、零放行;文本种类是闭集(新种类响亮地红)。
21
+ `CHANGELOG.md` 只扫**还能改的文本** —— 第一个「版本低于 `package.json` 当前版本」的节之前的全部(前言 / `## Unreleased` / 本版及更高版本节);**已发节不可改**(逐字进过 tag,字节冻结),所以不扫它们,这是已发节不可改的律落在门上的形,不是给旧编号开的口子:免扫区是肯定识别出来的(认不出的头一律照扫),免扫区里再出现在途节头 / 版本不低于当前的头、节头形标题紧跟围栏线、或全文的版本头不是严格最新在前(围栏里隔着空行的示例标题多半会撞上这一条)都红。`files` 里的项必须能按字面解析(通配项 / 不存在的路径 ⇒ 红,逼着有意地展开)。
22
+ 门有牙:往 README 塞一个编号 ⇒ 红且只红那一处;往 `## Unreleased` 塞 ⇒ 红;塞进已发节 ⇒ 不红(合成文本自证);基线上(改写前)该格红 56 处,改写后 0。
23
+ - **澄清:「零幸存者」律的可读行为(行为不变)**。一个集合里**一条都救不活**时,`salvageEntries` 原样返回、一条不丢 —— 没有幸存者就没有要抢救的东西,它从不凭空造出一个空集合(把「全是坏值」的限制清单抢救成空数组 = 悄悄删了限制,这一类 fail-open 由此挡住)。所以单个 worker、`secretEnv` 只有一条坏引用时,直接调 `salvageEntries` 返回的文档里那条坏引用还在 —— 这是**设计**:它**到不了** effective。集合挂在条目体内时(例:mcp 服务的 `allowTools` 全坏),那一条条目随后被整条判不过而丢掉(`entry-dropped`,兄弟留);域里一条条目都不剩时,下一步整域档位裁:
24
+ 闸域(`workers` 等:`DOMAIN_ENTRY_SALVAGE` 判 `"none"`、`DOMAIN_READ_FALLBACK` 判 `"throw"`)读路径上(`parseDomainSalvaged` / `buildEffective` / `readEffectiveWire`)抛原错 —— ZodError,issue 坐标点名那条坏引用(`["workers", 0, "secretEnv", "bad-key"]`),零告警;
25
+ 目录域(`a2a` / `mcp`:`"salvage"` × `"default"`)单条目全坏 ⇒ 整域回落默认(空名册 / 空表:能力消失,fail-closed)+ 恰一条 `domain-defaulted` 点名该域。
26
+ 好坏同在时:目录域恰一条 `entry-dropped`(坐标 = 条目,不是引用那一键;凭据引用集合不可部分抢救,坏条目没有「半截凭据」存活),好条目整条留;直接调 `salvageEntries` 的 `workers` 同样丢整个 worker、留兄弟 —— 但读路径上的 `workers` 域不抢救,好坏同在也抛。
27
+ 钉:`test/zero-survivor-law-19.0.1.test.ts`(11 格,含嵌套集合全坏的两格;变异:`salvageLayerUnsafe` 的零幸存者判去掉 ⇒ 直接调 `salvageEntries` 的原引用格、目录域单条目格与嵌套格红)。`README.md` 抢救段补了一句,头注原文(`salvageEntries` 前一段「零幸存者不算部分损坏」)未改。
28
+ - **已知限制(披露,本版不收)**:`dist/*.d.ts` 随 `removeComments:false` 带着 `src/` 的 JSDoc,其中仍可含内部编号 —— 那是**另一个面**(源头是 `src/` 注释,不是本件改的这些文本),K 组不读 `dist`(门不依赖 build 在不在场)。
29
+ 一致性语料的 case 目录名(例:带票号小写缩写的几个 `c4x-s…` 名)是 case 的身份,被各仓的 historical 账与适配器引用,改名是契约变更,本版不动。
30
+
31
+ ## 19.0.0 — 2026-11-03 — major:hook 条目承运 `args`(command 的 exec 形参数表)与 `onFailure`(command / http:失败按放行还是按 exit 2 阻断)· 词闭集 `HOOK_ON_FAILURE_WORDS` / 型 `HookOnFailure` · 这两个键的坏值自此是坏块(校验收紧)
32
+
33
+ > 档位(按发版纪律):**major** —— 校验收紧、同一份配置解析出不同结果(发版纪律「破坏性变更必 bump major」点名的两类),理由是下面「会变的三处」,尤其第 ②:守卫事件里一个坏值能让整份设置不装。加性的部分:新导出两个(`HOOK_ON_FAILURE_WORDS` 值、`HookOnFailure` 型);hook 条目字段表多两个可选列(`CommandHookEntry` 多可选键 `args` 与 `onFailure`,`HttpHookEntry` 多可选键 `onFailure`;对 `keyof` 写穷举表的消费方在提货时编译红,是提货成本)。
34
+ > **同一输入解析结果会变的三处**:① 带这两个键的条目,装上的那一份自此带着它们(此前被当作契约外的键剥掉);② 这两个键带**坏值**的条目 —— 词表外的 `onFailure`、不是串数组或含 NUL 元素的 `args` —— 自此是坏块:非守卫事件里剔那一条,**守卫事件(`PreToolUse` / `PermissionRequest`)里整份设置不装,同文件的 `permissions.deny` 一起不生效**;此前这两个键不论值是什么都被剥掉、整份照装(值里藏守卫迹象的除外:那一直是整份拒,见 `classifyHooksConfig` 头注)。上面是分类器的读法;zod 面(`HooksConfig` / `HookEntry` / 逐型五只)对该值**整个拒**,`readSettingsUnit("hooks", …)` 对该设置单元**整个答 `unreadable`**(此前都受理)——不止「剔那一条」;
35
+ > ③ 已经是坏块的条目若还带着这两个键的坏值,`field` 点名字段表序里第一个坏字段 —— `args` 在表里排在 `shell` / `async` / `asyncRewake` / `onFailure` 与公共字段(`if` / `timeout` / `statusMessage` / `once`)之前,`onFailure` 排在公共字段之前(command 里在 `async*` 之后,http 里在 `headers` / `allowedEnvVars` 之后),所以 `{ type: "command", command: "x", args: [1], shell: "zsh" }` 的 `field` 由 `shell` 变 `args`(`async: "yes"` / `asyncRewake: 5` 同),`{ type: "command", command: "x", onFailure: "retry", timeout: 0 }` 的由 `timeout` 变 `onFailure`(结局不变:仍是同一条坏块)。对不带这两个键的文档,读数逐字不变(差分门语料里原先拿 `onFailure` 当契约外键的样本换成了 `rewakeSummary`,其余样本零翻面)。
36
+ > **迁移**:不配一次性迁移 —— 坏值没有可猜的正确值,要人改。升级前检查设置文件、请求体里的 `hooks`(含存下来要续跑的):把词表外的 `onFailure` 改成 `continue` | `block`、把不合形的 `args` 改成串数组(元素不含 NUL;`[]` 与空串元素合法),或把这两个键整个删掉(删掉后读数逐字同 18.0.0)。不确定就先跑一遍 `classifyHooksConfig`:结局不是 `loaded`,或 `field` 是 `args` / `onFailure`,就是要改的那一条。
37
+ > 律:hook 条目的字段集只有一张表(`HOOK_ENTRY_FIELDS`),分类器、zod 面、条目类型同读它;「承运」与「执行」是两件事 —— 本包只判形,读到 `onFailure: "block"` 的消费方执行它或明拒它,静默不执行等于守卫起不来照放行。
38
+
39
+ ### 字段表两列与词闭集
40
+
41
+ - **`args`(只 command)**:exec 形参数表(CC `cli309.js:252382`:`args` 在场时 `command` 是一个可执行文件、带这些参数直接 spawn,不过 shell;在场本身就是开关,`[]` 也是 exec 形)。值 = 串数组,装上时拷贝;本包另判**元素零 NUL**(`spawn()` 对含 NUL 的参数抛;CC 的 `C(o())` 不判);空串元素是值(空参数是合法的 exec 参数)。别的四型上写 `args` 仍是契约外的键(剥掉,不算坏块;键下装着守卫迹象的除外)。
42
+ - **`onFailure`(command 与 http)**:这个 hook 的**失败**怎么办 —— 起不来(脚本缺失)、超时、退出码非 0 非 2、输出的 JSON 非法或校验不过。`continue`:失败被报告,动作照做;`block`:失败按 exit 2 算,事件所守卫的动作被阻断(CC 的 `onFailure:At()` 只在 command 与 http 两个 schema 上;对异步条目与 `Stop` / `SubagentStop` / `TaskCompleted` / `TeammateIdle` 事件不生效,那是执行方的事)。
43
+ 缺席就是缺席:本包不补缺省(CC 的缺省是 `continue`,读方自己补)。prompt / agent / mcp_tool 上写 `onFailure` 仍是契约外的键。
44
+ - **`HOOK_ON_FAILURE_WORDS = ["continue", "block"] as const`**(包根与 `./hooks`)· 型 **`HookOnFailure`**。登记表 `docs/API-SURFACE.md` 已重生。
45
+ - **一事一源**:字段表仍是唯一声明 —— 两个新取值类(`argv` · `onFailure`)是表里的两个词,分类器的取值判、zod 面、条目类型都从表读;没有按字段名写的分支。词表的运行期镜像是分类器闭包私有的 `Record<HookOnFailure, true>`(分类器被消费方的生成器整函数抄走,自由名只有 `HOOK_EVENTS`,读不了导出的词表),
46
+ 编译器双向咬死 —— 导出词表加一个词而镜像不补一行、或镜像多一行,`tsc` 红;钉再核一遍:分类器受理的值恰是导出的词表。
47
+ - **仍不承运**(`docs/CC-DIVERGENCE.md` H7 留):command / http 的 `rewakeMessage` · `rewakeSummary` · `cloud`(CC 标 `@internal`)与 prompt 的 `continueOnBlock` —— 本版仍按契约外的键剥掉、不看值:守卫事件里 `rewakeMessage: ""`、非布尔的 `continueOnBlock` 照装,比 CC 松(CC 的 schema 判这两个值;`cloud` 的坏值 CC 读成 `skip` 照装,与本包同)。**已知限制**,随下一个 major 承运这四个余键时一并收(键下装着守卫迹象的除外:那一直是整份拒,不因本版改变)。
48
+ - **三问** —— **谁需要**:把 `hooks` 当守卫写的部署与壳:`onFailure: "block"` 让「守卫起不来 / 超时 / 吐坏 JSON」按拒绝算而不是照放行;`args` 让带引号 / `$` / 反引号的路径不过 shell 解析器;此前这两个键一进契约就被剥掉,守卫起不来照放行、exec 形条目只剩可执行名去跑。
49
+ **谁受伤**:第 ① 处,依消费方是否执行 exec 形而定 —— 带 `args` 且 `command` 是整行 shell 命令的条目(例 `{ command: "/g.sh --strict", args: [] }`):18.0.0 的消费方把 `args` 剥掉,整行过 shell 照跑;执行 exec 形的 19.0.0 消费方把整行当可执行文件名去 spawn,起不来,缺省 `continue` 下被守卫的动作照做(CC 同读,这类文档对 CC 本来就是错的);第 ② 处 —— 在这两个键上写过坏值的设置文档(词表外的 `onFailure`、不合形的 `args`);守卫事件里是整份不装。CC 的 schema 对这两个键同样判值(`onFailure` 是 `continue` | `block` 的枚举,`args` 是串数组),所以按 CC 写的文档只在一种情形下受伤:`args` 的元素含 NUL(CC 不判,本包判)。
50
+ **补偿**:坏块的 `field` 点名 `args` / `onFailure`;改成 `continue` | `block` / 串数组即可。不想要这两个键的文档删掉它们,读数逐字同 18.0.0。
51
+
52
+ ### 消费方提货
53
+
54
+ - **server 7.147.0**:`CommandHookEntry` / `HttpHookEntry` 的 `onFailure`(随条目到达,`block` 的失败按 exit 2 执行;不执行就要在受理面明拒)· `args`(契约字段)· `HOOK_ON_FAILURE_WORDS` / `HookOnFailure`(穷举处读词表)。
55
+ - **cli**:`CommandHookEntry` / `HttpHookEntry` 的两个键 —— 壳若自己执行 hook(引擎属主事件 `ENGINE_OWNED_HOOK_EVENTS` 以外)执行它们或明拒;「能不能装」仍只问 `classifyHooksConfig`。
56
+ - **client-core**:由 `classifyHooksConfig` 生成的读器副本 —— 闭包多一个私有件 `HOOK_ON_FAILURE_ACCEPTED`(与 `HOOK_SHELLS` 同法随函数抄走),自由名仍只有 `HOOK_EVENTS`;生成器照旧整函数抄。
57
+ - **web-admin**:`HookEntry` 一族的编辑面可选地承运两列;不读也不受影响(加性的类型面)。
58
+ - **sdk**:类型面 —— 多两个可选键;对 `CommandHookEntry` / `HttpHookEntry` 的 `keyof` 写穷举表的地方编译红,补两列。
59
+ - 文书:README hooks 条一句 + 升级指引(18.0.x → 19.0.0)· `llms.txt` / `llms-full.txt` · `docs/CONSUMER-INTEGRATION.md` §18 · `docs/CC-DIVERGENCE.md` H7 改准 · `docs/API-SURFACE.md` 重生。
60
+
61
+ ### 钉
62
+
63
+ `test/hooks-command-fields-19.0.0.test.ts`(承运集:每型装上的键与键序、类型面 `keyof` 精确 · `args` 正控 / `[]` 与空串元素 / 坏形(非数组 · 非串元素 · 含 NUL)× 守卫与非守卫 / 别的四型不带 · `onFailure` 两词 × 两型 × 两类事件 / 缺席不补缺省 / 词表外与非串(含大小写变体与原型名)× 两型 × 两类事件 / 别的三型不带 · zod 面投影 ·
64
+ 词表导出与分类器同一份读法〔含原型名;分类器私有镜像的键从源码字面量读出,与导出元组逐词比〕· 四个仍不承运的键〕)· `test/hooks-classify-13.0.0.test.ts`(两处把 `onFailure` 当「契约外键」的例子换成 `rewakeSummary`,判不变:契约外的键剥掉、不算坏块;差分门语料的 `extra` 样本同换)· `test/docs-19.0.0.test.ts`(文书对账)。
65
+
66
+ **自 v18.0.0 起运行期代码有改动的公开导出(机器重算;上界 —— 可达 ≠ 一定变,不可达 ⇒ 一定不变;本版新增的导出不入表)**
67
+
68
+ ```text
69
+ AgentHookEntry [., ./hooks]
70
+ CommandHookEntry [., ./hooks]
71
+ HookEntry [., ./hooks]
72
+ HookMatcherEntry [., ./hooks]
73
+ HooksConfig [., ./hooks]
74
+ HttpHookEntry [., ./hooks]
75
+ McpToolHookEntry [., ./hooks]
76
+ PromptHookEntry [., ./hooks]
77
+ classifyHooksConfig [., ./hooks]
78
+ readSettingsUnit [.]
79
+ ```
80
+
11
81
  ## 18.0.0 — 2026-11-03 — major:车道词 `none`(不给智能体的工具提供执行环境)· `REQUIRE_EXECUTION_LANE` 进墓碑表 · 车道集单一判官 `laneSetFlaws` / `LANE_SET_RULE` · 便携新域 `a2a`(常驻出站 A2A 对端名册)· 凭据引用集合不可部分抢救 `ATOMIC_SALVAGE` · 复合凭据名 `credentialParamWordOf`
12
82
 
13
83
  > 档位(按发版纪律):**major** —— 三处不加性边:① 词表联合加成员(`ExecutionLane` 加 `none`、`TenantSeparationBasis` 加 `no-execution-target`、`RemoteExecSpec` 加 `none` 臂、`DomainName` 尾插 `a2a`;对它们写穷举 `switch` / `Record<…>` 的消费方编译红,把不认识的词读成某条车道的消费方运行期读错;公开记录读器的保留成员名由一个名改成一张表 —— `PLAIN_STRING_RECORD_RESERVED_MEMBER` 删除、`PlainStringRecordRead` 的 `reservedMember: boolean` 改名 `reservedMembers`,读它们的消费方编译红);
package/README.md CHANGED
@@ -47,6 +47,16 @@ therefore shows only `zod`. Node built-ins only (`node:crypto`, `node:fs`).
47
47
  > zod 3, nested inside every zod-4 host). The move to zod 4 did not change what any schema accepts or produces —
48
48
  > the conformance corpus reads byte-identically on both — only the wording of validation errors (see CHANGELOG 11.0.0).
49
49
 
50
+ ## 升级指引:18.0.x → 19.0.0(BREAKING:hook 条目承运 `args` / `onFailure`,这两个键的坏值自此是坏块)
51
+
52
+ 一处**不加性**的边(三问与逐条细节见 CHANGELOG 19.0.0):
53
+
54
+ 1. **`hooks` 条目的两个键此前被当作契约外的键剥掉,自此是契约字段**:command 条目的 `args`(exec 形参数表,串数组、元素不含 NUL;`[]` 与空串元素合法)、command / http 条目的 `onFailure`(`HOOK_ON_FAILURE_WORDS` = `continue` | `block`,型 `HookOnFailure`;缺席不补缺省)。别的条目型上写这两个键仍是契约外的键。
55
+ - 合形的值:装上的那一份自此带着它们(此前没有)。读到 `onFailure: "block"` 的一侧要执行它(失败按 exit 2)或在自己的受理面明拒,不能静默忽略。
56
+ - **坏值**(词表外的 `onFailure`、不是串数组或含 NUL 元素的 `args`):**非守卫事件里那一条 hook 被剔;守卫事件(`PreToolUse` / `PermissionRequest`)里整份设置不装,同文件的 `permissions.deny` 一起不生效**。此前这两个键不论值是什么都被剥掉、整份照装。**例外 —— 值里装着守卫事件名记号**(例:`Stop` 事件的条目 `args: { "PreToolUse": "guard" }`):18.0.0 与 19.0.0 **都**整份拒(`guard-entry-invalid`,`field` 点名 `args`),不是「18.0.0 剥掉后装、19.0.0 只剔那一条」;本版没改这一条。zod 面与 `readSettingsUnit("hooks", …)` 对坏值则整个拒 / 整个答 `unreadable`(此前都受理)。
57
+ - 动作:升级前把设置文件与请求体里(含存下来要续跑的)词表外的 `onFailure` 改成 `continue` | `block`、不合形的 `args` 改成串数组,或整个删掉这两个键(删掉后读数逐字同 18.0.0)。不确定就跑一遍 `classifyHooksConfig(settingsDoc)`:结局不是 `loaded`,或拒 / 剔项的 `field` 是 `args` / `onFailure`,就是要改的那一条。
58
+ 2. 对 `CommandHookEntry` / `HttpHookEntry` 的 `keyof` 写穷举表的地方编译红(多两个可选键):补两列。已是坏块的条目若还带着这两个键的坏值,`field` 点名字段表序里第一个坏字段(`args` 排在 `shell` / `async` / `asyncRewake` / `onFailure` 与公共字段之前,`onFailure` 排在公共字段之前)。
59
+
50
60
  ## 升级指引:17.2.x → 18.0.0(BREAKING:车道词 `none` · `REQUIRE_EXECUTION_LANE` 进墓碑表 · 新域 `a2a` 成为 `EffectiveConfig` 的必填成员)
51
61
 
52
62
  三处**不加性**的边,逐条给读点与动作(三问与逐条细节见 CHANGELOG 18.0.0):
@@ -456,8 +466,8 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
456
466
  1.2.0 adds the **trust ordering primitives**: `trustRank(layer)` (v2-design §1 verbatim, `managed 6 > global 5 >
457
467
  project 4 > local 3 > session 2 > task 1`) and `isAtLeast(layer, minTrust)` — the ladder every resolver is to
458
468
  compare floors against; consumers retire their own rank tables onto it. **3.0.1 correction**: this used to say
459
- the CLI's `TRUST_RANK` migration was still pending (board [5807] ③) — it shipped in the CLI's own 1.2.0
460
- consumption batch (board [5815], 2026-08-31): the CLI's third literal copy of the ladder is deleted
469
+ the CLI's `TRUST_RANK` migration was still pending — it shipped in the CLI's own 1.2.0
470
+ consumption batch (2026-08-31): the CLI's third literal copy of the ladder is deleted
461
471
  (`src/sema/settings/keyContracts.ts` self-documents the retirement) and its resolver now really imports
462
472
  `isAtLeast` from this package (`src/sema/settings/resolver.ts`). Exporting the primitive DID make it the
463
473
  single source, for this consumer.
@@ -525,7 +535,7 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
525
535
  verbatim; absent claim ⇒ no key, never a placeholder; present but not a non-empty string ⇒ the token is refused. A deleted-and-re-created
526
536
  user keeps the name and gets a new incarnation, so `sub` alone names a slot, not a person; `PrincipalIncarnation` is the one schema every
527
537
  incarnation field reads).
528
- - **web-admin credential file + connection env names** (`web-admin-credential.ts`, main barrel; S-698): the file behind
538
+ - **web-admin credential file + connection env names** (`web-admin-credential.ts`, main barrel; since 6.1.0): the file behind
529
539
  `SEMA_WEB_ADMIN_TOKEN_FILE` is one of two KINDS — a bare line (one static token — the same kind of file as today:
530
540
  its first line, printable ASCII with no control / non-ASCII characters; user JWT vs worker pull token stays the reader's `looksLikeJwt` call) or a
531
541
  `WebAdminCredentialEnvelope` (strict JSON: `kind: "user-session"` = `WEB_ADMIN_CREDENTIAL_ENVELOPE_KIND`, a JWT
@@ -536,8 +546,7 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
536
546
  `parseWebAdminCredentialFile(text)` is the ONE discrimination law — trimmed text starting with `{` is read ONLY
537
547
  as an envelope (a failure is `unreadable`, never a fallback to a bare line); anything else is a bare line,
538
548
  and a first line that is not a token is `unreadable` too (never sent as a bearer); empty is `unreadable`. The `reason` names envelope fields / zod issue codes / an unknown-key COUNT, never file
539
- content. Pure: reading, atomically writing and renewing the file are the consumers' job. S-742 lifts the
540
- DECLARATION face here too: `WEB_ADMIN_ENV` — every env name an engine reads to reach web-admin, one table
549
+ content. Pure: reading, atomically writing and renewing the file are the consumers' job. The DECLARATION face is lifted here too (since 6.1.0 as two key names plus the exclusive-or judge; the one table below, the `assertion` pair and the required second argument since 11.0.0): `WEB_ADMIN_ENV` — every env name an engine reads to reach web-admin, one table
541
550
  (`url` / `token` / `tokenFile` / `worker` / `liveUrl` / `webUrl` / `dryRun` / `adminToken` / `assertionToken` /
542
551
  `assertionTokenFile`, values `SEMA_WEB_ADMIN_*`; one spelling for web-admin rendering worker env, the shell writing its
543
552
  local engine's env, and the server reading it) and `judgeWebAdminCredentialDeclaration(env, credential)` — `credential` ∈
@@ -649,7 +658,7 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
649
658
  sharing ONE body (strict parse + the unknown-key warnings): the DOCUMENT face (`parseDomain` / `parseDomainLoud` — the
650
659
  write seat, export, `getDomain`) never salvages and reads exactly as 12.2.x; the VIEW face (`parseDomainSalvaged`, which
651
660
  `buildEffective` calls for every domain) salvages per the table, recursing into a surviving entry's own collections
652
- (coordinates carry the parent prefix, the zero-survivor law holds at every level). **S-712** (additive) lets each `entry-dropped` carry an
661
+ (coordinates carry the parent prefix, the zero-survivor law holds at every level — a collection with no survivor is not "partly damaged", so `salvageEntries` returns it untouched; the entry that owns such a nested collection is then judged as a whole and dropped with its siblings kept, and when no entry of the domain survives, the whole-domain tier decides: gate domains such as `workers` throw the original error, catalog domains fall to the domain default with one `domain-defaulted` warning — either way the bad entry never reaches an effective config; good and bad siblings together drop the whole bad entry, never half of a credential-reference set). **6.1.0** (additive) lets each `entry-dropped` carry an
653
662
  optional `identity?: { name?, id?, enabled? }` read from the dropped entry's OWN text (`DroppedEntryIdentity`):
654
663
  a string `name` / `id` and a boolean `enabled`, own data properties only, each key present only when it
655
664
  reads with that exact type and `isDisclosableIdentity` says it may ride out (not guessed, not coerced, not
@@ -664,7 +673,7 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
664
673
  dropped without re-reading the source document by coordinate (the document it holds may not be the one this
665
674
  read saw). `identity` is part of the warning projection, so the conformance gate compares it (corpus
666
675
  cases `c40` / `c41` pin the laws JSON can express; the historical normalizer strips it, since older versions cannot
667
- mint it — `ConformanceNormalizer.warning?`). **S-1295** (additive) adds `reasonCode` — WHY the entry was
676
+ mint it — `ConformanceNormalizer.warning?`). **10.1.0** (additive) adds `reasonCode` — WHY the entry was
668
677
  dropped, as a machine-readable CLOSED word (`DROPPED_ENTRY_REASON_CODES` / `DroppedEntryReasonCode`; also on
669
678
  `DroppedEntry` from `salvageEntries`): `entry-schema-invalid` (the entry — array element or Record value — failed its
670
679
  own entry schema), `entry-key-invalid` (a Record key failed the key schema), `entry-unreadable` (validation threw while
@@ -688,7 +697,8 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
688
697
  `HOOK_EVENT_OWNER` (engine | shell), the matcher-field table, a per-event input schema (`HookInput`),
689
698
  the output/decision shapes (`SyncHookOutput` / `HookSpecificOutput` / `HookPermissionRequestDecision`),
690
699
  the config surface (defined in `hooks-config.ts`, re-exported by `./hooks`): `HOOK_ENTRY_TYPES` (CC 2.1.296's five: command / prompt / agent / http /
691
- `mcp_tool`) and the ONE classifier `classifyHooksConfig(settingsDoc)` — which pieces of a settings document's `hooks` drop
700
+ `mcp_tool`; the field table carries `args` — the exec-form argument list — on `command` entries and `onFailure` — `HOOK_ON_FAILURE_WORDS` = `continue` | `block`, type `HookOnFailure` —
701
+ on `command` and `http` entries; carried, not executed: a consumer that reads `block` executes it or refuses it) and the ONE classifier `classifyHooksConfig(settingsDoc)` — which pieces of a settings document's `hooks` drop
692
702
  (`HOOKS_DROPPED_PIECE_CODES`), whether the whole document is rejected because a guard (`PreToolUse` / `PermissionRequest`) may be
693
703
  in a bad piece (`HOOKS_REJECTION_CODES`), and what loads; codes + `ConfigPath` coordinates + the wrong key's name (`field`: for a matcher / entry, the contract
694
704
  field whose value is wrong, or the member that holds a guard sign; absent only when the piece is not an object), no sentences, self-contained (no zod;
@@ -724,7 +734,7 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
724
734
  `./node`): the durable self-wake record shape + `parseSchedulerStore` / `serializeSchedulerStore`
725
735
  (forward-compatible: unknown fields survive a round-trip, malformed records are dropped one by one).
726
736
  - **Fleet contract** (`fleet.ts`, subpath `./fleet`): drain protocol, instance discovery, dispatch policy,
727
- quota lease, usage report, quota-reset event. **S-741** adds the restart signal, defined ONCE:
737
+ quota lease, usage report, quota-reset event. **6.1.0** adds the restart signal, defined ONCE:
728
738
  `RestartSignal` (`{ reasons: string[] (≥1, non-empty words), version: number (the web-admin config version that
729
739
  differs from boot — finite, judged exactly as `readEffectiveWire` judges a config version), since: number (epoch
730
740
  ms, non-negative integer) }` — exactly what the server already ships on /health). The heartbeat carries it as
@@ -733,7 +743,7 @@ settings 单元读不进的成员**不是缺席**(`loosen` 可丢且要响,`tigh
733
743
  no `required` boolean inside). A heartbeat re-announces the full row, so one without it means "no longer required".
734
744
  Since 11.0.0 it is engine state and is read in ONE place on both exits — inside `EngineSignal` under `engineSignal`
735
745
  (`readEngineSignal(body)?.restart`); the flat `restart` both bodies still carry is the pre-11 dialect, read by nothing,
736
- and the flat reader `readRestartSignal` is gone. **S-768** adds the model-refusals signal the same
746
+ and the flat reader `readRestartSignal` is gone. **6.2.0** adds the model-refusals signal the same
737
747
  way (one mint point, two exits, ONE reader): the wire face `ModelRefusalsWire` (`{ entries: { <catalog entry name>:
738
748
  <code> }, plane?: <code> }` with codes as open strings — name → code is the whole wire, no upstream id / provider /
739
749
  field keys / prose) rides the heartbeat as `InstanceAnnouncement.modelRefusals?` and /health (`InstanceHealth` again
@@ -1 +1 @@
1
- 18.0.0
1
+ 19.0.1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "抢救剔掉坏条目后,后续的剥键扫描报的是**压缩后**的下标 —— 谁不回写,谁就让运维照着告警去改原文档的另一条(S-323 消费方真案)。三腿必须同样报**原文档**坐标 ['models',1,'typo'],而不是 ['models',0,'typo']。",
3
+ "claim": "抢救剔掉坏条目后,后续的剥键扫描报的是**压缩后**的下标 —— 谁不回写,谁就让运维照着告警去改原文档的另一条(一个消费方的真案;2.1.0 起的坐标律)。三腿必须同样报**原文档**坐标 ['models',1,'typo'],而不是 ['models',0,'typo']。",
4
4
  "firstRedOn": [
5
5
  "settings-schema@1.0.0",
6
6
  "settings-schema@1.10.0",
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "同一份文档里同时有字面叫 `models.1.k` 的顶层键与 models[1] 里的未知键 `k` —— 2.1.0 的点号串把两者编码成同一个串(S-323c 登记的残余二义)。段坐标下两条必须不同,且比对器按段深相等直比、零 stringify。",
3
+ "claim": "同一份文档里同时有字面叫 `models.1.k` 的顶层键与 models[1] 里的未知键 `k` —— 2.1.0 的点号串把两者编码成同一个串(登记过的残余二义,3.0.0 的段坐标改铸收掉)。段坐标下两条必须不同,且比对器按段深相等直比、零 stringify。",
4
4
  "firstRedOn": []
5
5
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "`constructor` / `toString` / `hasOwnProperty` / `__proto__` 作未知顶层键(S-332 真 bug):`k in built` 会一路问到 Object.prototype,于是这四个名字被判成「已知域」整条吞掉 —— open-world 的承诺对它们恰好失效,而且无声。wire 腿必须四键都逐字承运且是**自有键**;local-root 腿必须四条 not-a-domain 都报出来。",
3
+ "claim": "`constructor` / `toString` / `hasOwnProperty` / `__proto__` 作未知顶层键(3.0.0 修的真 bug):`k in built` 会一路问到 Object.prototype,于是这四个名字被判成「已知域」整条吞掉 —— open-world 的承诺对它们恰好失效,而且无声。wire 腿必须四键都逐字承运且是**自有键**;local-root 腿必须四条 not-a-domain 都报出来。",
4
4
  "firstRedOn": [
5
5
  "settings-schema@1.0.0",
6
6
  "settings-schema@1.10.0",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "S-712 身份律的两道闸压在语料上:被丢条目的 name 是一段脱敏器会改动的串(Bearer 形)⇒ identity 不带 name(同一条告警里坐标会打码,身份不许把原文带出去);enabled 是字符串 \"yes\" ⇒ 不带 enabled;id 是干净字符串 ⇒ 照带。另两条被丢条目压脱敏判据的两道边:`tok=Bearer abc1234`(短令牌,探测器 containsSecretToken 不判阳、脱敏器会改)与一整段 PEM 私钥(头里带空格,脱敏器的定点两遍够不着、靠整串兜底)⇒ 两条的 name 都不带。正控:另一条被丢条目 name / id / enabled:false 三键齐全逐字带出。读腿若放宽任一闸,告警面多出字段即红;秘密清单同时由告警面零命中门看着。",
3
+ "claim": "6.1.0 起的身份律,两道闸压在语料上:被丢条目的 name 是一段脱敏器会改动的串(Bearer 形)⇒ identity 不带 name(同一条告警里坐标会打码,身份不许把原文带出去);enabled 是字符串 \"yes\" ⇒ 不带 enabled;id 是干净字符串 ⇒ 照带。另两条被丢条目压脱敏判据的两道边:`tok=Bearer abc1234`(短令牌,探测器 containsSecretToken 不判阳、脱敏器会改)与一整段 PEM 私钥(头里带空格,脱敏器的定点两遍够不着、靠整串兜底)⇒ 两条的 name 都不带。正控:另一条被丢条目 name / id / enabled:false 三键齐全逐字带出。读腿若放宽任一闸,告警面多出字段即红;秘密清单同时由告警面零命中门看着。",
4
4
  "firstRedOn": [],
5
5
  "secrets": [
6
6
  "FAKE-S712-CORPUS-00000000",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "6.3.0(codex gpt-6-astra 对 v6.1.0 复审 [high] 回填 D-4):`key=` + 百分号编码的 PEM 私钥 —— 原文上 PEM header 带 `%20` 看不见、`containsSecretToken` 的行首锚被 `key=` 前缀打败 —— 同时作被丢条目的 `id`(身份面)与 `roles` 的坏键(坐标面 + zod error 的 received / message 面)。身份面走白名单闭形 `DISCLOSABLE_IDENTITY_RE`(`%` / `=` 不在集内)⇒ 只剩 name(四重编码的同一把私钥同样只剩 name —— 身份面靠白名单闭形,与编码深度无关;6.3.0 起自由文本面也在解码界上 fail-closed);坐标 / error 走 `redactSecrets`,整串判套在归一化形(原文 + 探测器同界的解码层)上 ⇒ 坐标段整段扣留、error 不带私钥。另压白名单的两道边:字符集**之内**的密钥形 name(`sk-` 形;`ops@` 后接单点 `eyJ…` 形 —— 探测器判阴、坐标脱敏器会改)⇒ 不带 name,身份的否决判据与坐标脱敏同一只;正控:带 `/` `@` `:` `+` 的真实形上游 id 与合法 name 逐字带出。",
3
+ "claim": "6.3.0(codex gpt-6-astra 对 v6.1.0 复审 [high] 回填):`key=` + 百分号编码的 PEM 私钥 —— 原文上 PEM header 带 `%20` 看不见、`containsSecretToken` 的行首锚被 `key=` 前缀打败 —— 同时作被丢条目的 `id`(身份面)与 `roles` 的坏键(坐标面 + zod error 的 received / message 面)。身份面走白名单闭形 `DISCLOSABLE_IDENTITY_RE`(`%` / `=` 不在集内)⇒ 只剩 name(四重编码的同一把私钥同样只剩 name —— 身份面靠白名单闭形,与编码深度无关;6.3.0 起自由文本面也在解码界上 fail-closed);坐标 / error 走 `redactSecrets`,整串判套在归一化形(原文 + 探测器同界的解码层)上 ⇒ 坐标段整段扣留、error 不带私钥。另压白名单的两道边:字符集**之内**的密钥形 name(`sk-` 形;`ops@` 后接单点 `eyJ…` 形 —— 探测器判阴、坐标脱敏器会改)⇒ 不带 name,身份的否决判据与坐标脱敏同一只;正控:带 `/` `@` `:` `+` 的真实形上游 id 与合法 name 逐字带出。",
4
4
  "firstRedOn": [],
5
5
  "secrets": [
6
6
  "MC4CAQAwBQYDK2VwBCIEIFAKES621ENCODEDPEMCORPUSBODY00000000000000",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "6.3.0(codex gpt-6-astra r1 F2,发版方裁并入 S-792):未知键告警的坐标是**用户写的键名**,完全可能就是一条粘错位置的凭据 —— 0.19.0 起 `droppedKeys` / `carriedUnknownKeys` 铸 `keys` 从不过脱敏器,`sk-` / `ghp_` 形的键名原样进 `unknown-keys-dropped` / `unknown-keys-carried` 与投影。三处:models 顶层未知键、models 条目内嵌套未知键(strip 域)、limits 承运的未知键(open-world 域)⇒ 坐标段 `[redacted-secret]`,告警面零命中语料秘密;良性拼错键(`typoKey` / `maxToolCallz`)逐字点名(正控);承运进 effective 的值与键照旧逐字(承运是契约,告警才是本包铸的新文本)。",
3
+ "claim": "6.3.0(codex gpt-6-astra r1 F2,发版方裁并入本版的安全修):未知键告警的坐标是**用户写的键名**,完全可能就是一条粘错位置的凭据 —— 0.19.0 起 `droppedKeys` / `carriedUnknownKeys` 铸 `keys` 从不过脱敏器,`sk-` / `ghp_` 形的键名原样进 `unknown-keys-dropped` / `unknown-keys-carried` 与投影。三处:models 顶层未知键、models 条目内嵌套未知键(strip 域)、limits 承运的未知键(open-world 域)⇒ 坐标段 `[redacted-secret]`,告警面零命中语料秘密;良性拼错键(`typoKey` / `maxToolCallz`)逐字点名(正控);承运进 effective 的值与键照旧逐字(承运是契约,告警才是本包铸的新文本)。",
4
4
  "firstRedOn": [],
5
5
  "secrets": [
6
6
  "sk-live-FAKEC42TOPUNKNOWNKEY0000",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "6.3.0(codex gpt-6-astra r1 F1 部分修,S-792):归一化那一处的两件事压在语料上。① `+` 代空格:扁平无换行的 `-----BEGIN+PRIVATE+KEY-----<base64>-----END+PRIVATE+KEY-----` 全在身份白名单字符集内,6.2.0 起它过身份与 refusal 两谓词 ⇒ 被丢条目的 id 必须不带(`secretScanForms` 把 `+` 读作空格的形交 PEM 头判,身份否决随之);URLSearchParams 形(`+` 代空格 + `%0A`)作 roles 坏键 ⇒ 坐标段整段扣、error 不带私钥。② 解码界上 fail-closed:四层 / 五层百分号编码作 roles 坏键 ⇒ 三层走完仍能再解,整串扣(codex r2 起展示侧的边界读法对末层再解一层,四层那条因此也被 PEM 头判扣下;五层那条只有「没走完」这一位扣得住 —— 变异门的 `unresolved` 靶靠它)。正控:`o3-mini+high` 作 id 逐字带出(`+` 在真实 id 里照旧可披露)。 【10.0.0 订正】探测器改认串中任意位置的私钥头之后,它对每个归一化形再读三层,五层那条也被探测器那一遍扣下,「没走完」这一位不再独自承重于本条;`unresolved` 靶的语料杀手改为 c69。",
3
+ "claim": "6.3.0(codex gpt-6-astra r1 F1 部分修):归一化那一处的两件事压在语料上。① `+` 代空格:扁平无换行的 `-----BEGIN+PRIVATE+KEY-----<base64>-----END+PRIVATE+KEY-----` 全在身份白名单字符集内,6.2.0 起它过身份与 refusal 两谓词 ⇒ 被丢条目的 id 必须不带(`secretScanForms` 把 `+` 读作空格的形交 PEM 头判,身份否决随之);URLSearchParams 形(`+` 代空格 + `%0A`)作 roles 坏键 ⇒ 坐标段整段扣、error 不带私钥。② 解码界上 fail-closed:四层 / 五层百分号编码作 roles 坏键 ⇒ 三层走完仍能再解,整串扣(codex r2 起展示侧的边界读法对末层再解一层,四层那条因此也被 PEM 头判扣下;五层那条只有「没走完」这一位扣得住 —— 变异门的 `unresolved` 靶靠它)。正控:`o3-mini+high` 作 id 逐字带出(`+` 在真实 id 里照旧可披露)。 【10.0.0 订正】探测器改认串中任意位置的私钥头之后,它对每个归一化形再读三层,五层那条也被探测器那一遍扣下,「没走完」这一位不再独自承重于本条;`unresolved` 靶的语料杀手改为 c69。",
4
4
  "firstRedOn": [],
5
5
  "secrets": [
6
6
  "MC4CAQAwBQYDK2VwBCIEIFAKEC43FLATPLUSIDBODY0000000000000000000000",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "6.3.0(codex gpt-6-astra r2 F-r2-1 [high],S-792):转义的 UTF-8 字节粘在密钥形令牌前面(`%C2%A0` = NBSP、`%E2%80%8B` = 零宽空格)—— 逐个 %HH 解码解不开多字节,十六进制位粘上令牌(`A0sk-live-…`),探测器与脱敏器都看不见令牌边界,而任何标准解码器都还原得出。作 roles 坏键(坐标 + zod received / message)与 models 顶层未知键名 ⇒ 坐标段 `[redacted-secret]`,告警面零命中语料秘密。正控:`path%2Fto%E4%B8%AD`(编码的中文、不带秘密)作 roles 坏键照旧逐字进坐标。",
3
+ "claim": "6.3.0(codex gpt-6-astra r2 F-r2-1 [high]):转义的 UTF-8 字节粘在密钥形令牌前面(`%C2%A0` = NBSP、`%E2%80%8B` = 零宽空格)—— 逐个 %HH 解码解不开多字节,十六进制位粘上令牌(`A0sk-live-…`),探测器与脱敏器都看不见令牌边界,而任何标准解码器都还原得出。作 roles 坏键(坐标 + zod received / message)与 models 顶层未知键名 ⇒ 坐标段 `[redacted-secret]`,告警面零命中语料秘密。正控:`path%2Fto%E4%B8%AD`(编码的中文、不带秘密)作 roles 坏键照旧逐字进坐标。",
4
4
  "firstRedOn": [],
5
5
  "secrets": [
6
6
  "sk-live-FAKEC44NBSPGLUEDROLEKEY000",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "6.3.0(合并复审 opus 腿 L5 / M1 / M2 / L1,S-792):给语料里此前没有杀手的几道边补上 —— ① 长度上界 256(身份白名单与出门坐标段同一只常量):256 字的合法模型名被丢时身份照带 name、257 字不带;256 字的良性未知键名逐字点名、257 字整段 `[redacted-secret]`。② 解码层数 3(校验侧探测器):mcp stdio 参数里三重百分号编码的 `sk-` 形令牌照旧被拒、条目被丢(层数少一层就放行进 effective)。③ 身份否决里的 URL userinfo 判定:`postgres://svc:…@db…` 作被丢条目 id 不带;路径里的 `@`(`https://…/@scope/pkg`)照带。④(11.0.0 起 hosts 读侧夹紧臂退役)超长主机名作被丢条目出门、身份过同一道披露判据:`sk-live-…` 形超长主机名读 `[redacted-secret]`,不再是 63 字原文前缀。",
3
+ "claim": "6.3.0(合并复审 opus 腿 L5 / M1 / M2 / L1):给语料里此前没有杀手的几道边补上 —— ① 长度上界 256(身份白名单与出门坐标段同一只常量):256 字的合法模型名被丢时身份照带 name、257 字不带;256 字的良性未知键名逐字点名、257 字整段 `[redacted-secret]`。② 解码层数 3(校验侧探测器):mcp stdio 参数里三重百分号编码的 `sk-` 形令牌照旧被拒、条目被丢(层数少一层就放行进 effective)。③ 身份否决里的 URL userinfo 判定:`postgres://svc:…@db…` 作被丢条目 id 不带;路径里的 `@`(`https://…/@scope/pkg`)照带。④(11.0.0 起 hosts 读侧夹紧臂退役)超长主机名作被丢条目出门、身份过同一道披露判据:`sk-live-…` 形超长主机名读 `[redacted-secret]`,不再是 63 字原文前缀。",
4
4
  "firstRedOn": [],
5
5
  "secrets": [
6
6
  "FAKEC45USERINFOPW",
@@ -2,7 +2,7 @@
2
2
  "contributor": "contract",
3
3
  "claim": "超长主机名是一条带 userinfo 的 URL(`https://admin:hunter2@hhh…h.com`,81 字)。改前它被 hosts 读侧夹紧臂按名剔掉,`droppedNames` 的标签原样带着 `admin:hunter2`(特征格)。11.0.0 起夹紧臂退役,这一条作被丢条目出门(entry-dropped),身份否决里的 userinfo 判定不让它的名字出门 —— 那条泄漏路随臂一起没了,`hunter2` 进本条的秘密清单,从特征钉变成护栏。",
4
4
  "firstRedOn": [],
5
- "note": "车PE(2026-09-27)按主会话令加,当时是现状特征钉(刻意不登 `hunter2`);11.0.0 起翻成护栏:持久面一件退役了夹紧臂(这一条改作被丢条目出门),S-811 让 `redactSecrets` 对 URL 候选段问 `carriesUserinfo` —— 身份面问的就是它,带凭据的名不出门。",
5
+ "note": "车PE(2026-09-27)按主会话令加,当时是现状特征钉(刻意不登 `hunter2`);11.0.0 起翻成护栏:持久面一件退役了夹紧臂(这一条改作被丢条目出门),同版让 `redactSecrets` 对 URL 候选段问 `carriesUserinfo` —— 身份面问的就是它,带凭据的名不出门。",
6
6
  "secrets": [
7
7
  "hunter2"
8
8
  ]
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "S-811(11.0.0 收;原 🚧 特征格翻面):坏 roles 键 `https://admin:hunter2@db.example.com/x` 被逐条丢掉,坐标段与 zod 回显的文本都过 `redactSecrets` —— 11.0.0 起它对 URL 候选段问 `carriesUserinfo`,整段扣成 `[redacted-secret]`(改前坐标 `[\"roles\", \"https://admin:hunter2@db.example.com/x\"]` 原样出门)。第二个坏键是同一形的百分号编码(`https%3A%2F%2Fadmin%3AFAKEC47ENCODEDPW%40db.example.com`):原文上看不见 `@`,只在归一化形上可见 ⇒ 整串扣。 第三个坏键是一句话里夹着同一个带凭据的 URL(`see https://admin:hunter2@…`):只扣那一段,坐标段读 `see [redacted-secret]`(其余照旧可读)。",
3
+ "claim": "11.0.0 收(原 🚧 特征格翻面):坏 roles 键 `https://admin:hunter2@db.example.com/x` 被逐条丢掉,坐标段与 zod 回显的文本都过 `redactSecrets` —— 11.0.0 起它对 URL 候选段问 `carriesUserinfo`,整段扣成 `[redacted-secret]`(改前坐标 `[\"roles\", \"https://admin:hunter2@db.example.com/x\"]` 原样出门)。第二个坏键是同一形的百分号编码(`https%3A%2F%2Fadmin%3AFAKEC47ENCODEDPW%40db.example.com`):原文上看不见 `@`,只在归一化形上可见 ⇒ 整串扣。 第三个坏键是一句话里夹着同一个带凭据的 URL(`see https://admin:hunter2@…`):只扣那一段,坐标段读 `see [redacted-secret]`(其余照旧可读)。",
4
4
  "firstRedOn": [],
5
- "note": "车PE(2026-09-27)按主会话令加,当时是现状特征钉(刻意不登 `hunter2`);11.0.0 S-811 修后翻成护栏,并加编码形与句中形两键。变异门靶:URL 候选段 userinfo 一遍(本条第三键杀:去掉它,句中形整串扣)、归一化形上的 userinfo 整串扣(本条第二键杀)。",
5
+ "note": "车PE(2026-09-27)按主会话令加,当时是现状特征钉(刻意不登 `hunter2`);11.0.0 修后翻成护栏,并加编码形与句中形两键。变异门靶:URL 候选段 userinfo 一遍(本条第三键杀:去掉它,句中形整串扣)、归一化形上的 userinfo 整串扣(本条第二键杀)。",
6
6
  "secrets": [
7
7
  "hunter2",
8
8
  "FAKEC47ENCODEDPW"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "S-935(6.4.0):`models[].headers` 是解析透明键(与 `compat` 同一只变换)⇒ 三读腿**逐字交出、零告警**,不剥、不报 `unknown-keys-dropped`;并且本包**不做形校验** —— 写在 openai 线路上的数组形 `headers`(非规范大小写的名、根本不是头袋)照样逐字过,形与线路归 sema-server 的目录条目判据。任一腿把它剥掉,经生产配置通道写下的附加请求头(开 1M 上下文的 `anthropic-beta`)就到不了 server 目录且零告警;任一腿对它做形校验,就是本包复述了 server 的白名单(两个写者)。第三条不带 `headers` 的条目是负控:不铸键。",
3
+ "claim": "6.4.0:`models[].headers` 是解析透明键(与 `compat` 同一只变换)⇒ 三读腿**逐字交出、零告警**,不剥、不报 `unknown-keys-dropped`;并且本包**不做形校验** —— 写在 openai 线路上的数组形 `headers`(非规范大小写的名、根本不是头袋)照样逐字过,形与线路归 sema-server 的目录条目判据。任一腿把它剥掉,经生产配置通道写下的附加请求头(开 1M 上下文的 `anthropic-beta`)就到不了 server 目录且零告警;任一腿对它做形校验,就是本包复述了 server 的白名单(两个写者)。第三条不带 `headers` 的条目是负控:不铸键。",
4
4
  "firstRedOn": [],
5
5
  "note": "车SL(2026-10-01)红先:6.3.0 读腿在本条上三腿同红 —— 两条带 `headers` 的条目都被剥掉该键,`unknown-keys-dropped` 点名 `[\"models\",0,\"headers\"]` / `[\"models\",1,\"headers\"]`(实测读数见车SL 收车档)。firstRedOn 为空:`conformance/historical/` 的阶梯证据(2.1.0 及更早)真跑于本条入库之前,没有本条的读数,那一栏只收 historical 真跑,不手填(c41 同口径)。"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "S-935(6.4.0):`models[].headers` 里粘了一把密钥形值(`x-api-key: sk-ant-…`)⇒ 与 `compat` 同一只自由形安全判据拒 ⇒ 该条目**逐条丢**(`entry-dropped`,坐标 `[\"models\",0]`)、兄弟条目幸存、告警面零回显那把钥匙。打的是两种读错:① 腿把 `headers` 当未知键剥掉(6.3.0 形)⇒ 条目带着「看起来干净」的形幸存,明文凭据却已经进了持久层且没人拒;② 腿对 `headers` 另起一套判据(或把拒句拼上值)⇒ 告警面带出密钥。",
3
+ "claim": "6.4.0:`models[].headers` 里粘了一把密钥形值(`x-api-key: sk-ant-…`)⇒ 与 `compat` 同一只自由形安全判据拒 ⇒ 该条目**逐条丢**(`entry-dropped`,坐标 `[\"models\",0]`)、兄弟条目幸存、告警面零回显那把钥匙。打的是两种读错:① 腿把 `headers` 当未知键剥掉(6.3.0 形)⇒ 条目带着「看起来干净」的形幸存,明文凭据却已经进了持久层且没人拒;② 腿对 `headers` 另起一套判据(或把拒句拼上值)⇒ 告警面带出密钥。",
4
4
  "firstRedOn": [],
5
5
  "secrets": [
6
6
  "sk-ant-api03-FAKES935CORPUS000000000000000000"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "G1:enabled 的 worker 没有 runtime.execution ⇒ 拒(拒因点名 runtime.execution.lanes —— 16.0.0 起车道集)。打「声明不了车道也能过闸、起服落进程内 stub、无手照回 completed」那条静默路(WA-49)。",
3
+ "claim": "G1:enabled 的 worker 没有 runtime.execution ⇒ 拒(拒因点名 runtime.execution.lanes —— 16.0.0 起车道集)。打「声明不了车道也能过闸、起服落进程内 stub、无手照回 completed」那条静默路。",
4
4
  "firstRedOn": []
5
5
  }
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "store.backend pg 缺 runtime.store.db ⇒ 拒:SQL 坐标 ⇔ SQL 店。打 WA-50「PG 部署无坐标可写」的另一面 —— 声明了 pg 却没坐标。",
3
+ "claim": "store.backend pg 缺 runtime.store.db ⇒ 拒:SQL 坐标 ⇔ SQL 店。打「PG 部署无坐标可写」的另一面 —— 声明了 pg 却没坐标。",
4
4
  "firstRedOn": []
5
5
  }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "11.0.0(一只秘密扫描器,S-1274 + S-797):写侧探测器读展示侧同一组归一化形。mcp stdio 参数三条:① 三重百分号编码的良性串(`%252541`)在解码预算之内 ⇒ 照收(预算少一层就成了「归一化没走完」被拒);② 只在 `+` 读作空格时才是私钥 PEM 头的串 ⇒ 该条被丢(改前写侧只读百分号层,照收进 effective);③ 认证词后接编码空格(`+`)的短凭据 `Basic+…` ⇒ 该条被丢(改前两侧都放行)。告警面零命中语料秘密。",
3
+ "claim": "11.0.0(一只秘密扫描器):写侧探测器读展示侧同一组归一化形。mcp stdio 参数三条:① 三重百分号编码的良性串(`%252541`)在解码预算之内 ⇒ 照收(预算少一层就成了「归一化没走完」被拒);② 只在 `+` 读作空格时才是私钥 PEM 头的串 ⇒ 该条被丢(改前写侧只读百分号层,照收进 effective);③ 认证词后接编码空格(`+`)的短凭据 `Basic+…` ⇒ 该条被丢(改前两侧都放行)。告警面零命中语料秘密。",
4
4
  "firstRedOn": [],
5
5
  "secrets": [
6
6
  "FAKEC71PLUSPEMBODY0000",
7
7
  "FAKEc71"
8
8
  ],
9
- "note": "变异门杀手:`containsSecretToken` 读形改回只读百分号层(②杀)、S-797 一臂去掉(③杀)、`SECRET_SCAN_DECODE_LAYERS` 3 → 2(①杀)。firstRedOn 为空:不是 historical 阶梯证据。"
9
+ "note": "变异门杀手:`containsSecretToken` 读形改回只读百分号层(②杀)、认证词后接编码空格的一臂去掉(③杀)、`SECRET_SCAN_DECODE_LAYERS` 3 → 2(①杀)。firstRedOn 为空:不是 historical 阶梯证据。"
10
10
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "contract",
3
- "claim": "12.3.0(S-1494)projects 逐条抢救 + 抢救递归:三条登记里第 2 条的第 1 个上下文条目是 Windows 长路径前缀形(12.2.1 起拒)、第 3 条 displayName 201 字。读腿:登记 1、2 在(2 的 contextItems 丢第 1 项,其余照用)、3 不在,两条 entry-dropped 分别点到嵌套那一格与整条登记;第 2 条第 2 项上的拼错键按**原文档**下标报(压缩后它是第 1 项)。严写腿整份拒。打的是三种读法分歧:projects 仍整域拒(12.2.x 读法,整个 scope 的项目停摆)/ 抢救只下到顶层(整条登记 2 连坐丢掉)/ 嵌套坐标报压缩后的下标。",
3
+ "claim": "12.3.0 的 projects 逐条抢救 + 抢救递归:三条登记里第 2 条的第 1 个上下文条目是 Windows 长路径前缀形(12.2.1 起拒)、第 3 条 displayName 201 字。读腿:登记 1、2 在(2 的 contextItems 丢第 1 项,其余照用)、3 不在,两条 entry-dropped 分别点到嵌套那一格与整条登记;第 2 条第 2 项上的拼错键按**原文档**下标报(压缩后它是第 1 项)。严写腿整份拒。打的是三种读法分歧:projects 仍整域拒(12.2.x 读法,整个 scope 的项目停摆)/ 抢救只下到顶层(整条登记 2 连坐丢掉)/ 嵌套坐标报压缩后的下标。",
4
4
  "firstRedOn": [],
5
5
  "note": "firstRedOn 为空:historical 阶梯(≤ 2.1.0)不覆盖 11.3.0 的 projects 扩形;对 12.2.x 这一条会红(projects 整域拒),那一版不在入库的真跑证据里。"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "test",
3
- "claim": "告警对象上 `domain` **缺席**(不是 `null`、不是空串)时,三腿必须原样传成缺席。消费方普遍写 `{domain: w.domain, …}` 这种投影(web-admin [7285] ③ 实测 `unread-config-file` 无必填 `domain`),谁把缺席折成 `null` 或 `\"\"`,谁就让下游多红一处而自己看不见。",
3
+ "claim": "告警对象上 `domain` **缺席**(不是 `null`、不是空串)时,三腿必须原样传成缺席。消费方普遍写 `{domain: w.domain, …}` 这种投影(web-admin 实测 `unread-config-file` 无必填 `domain`),谁把缺席折成 `null` 或 `\"\"`,谁就让下游多红一处而自己看不见。",
4
4
  "firstRedOn": [],
5
5
  "note": "一条输入里同时放两条 `unread-config-file`:`hosts.json`(非便携域 ⇒ **带** `domain`)与 `web-admin-ui.json`(非域名 ⇒ **不带** `domain`)。两种形并排,所以「把缺席一律折成 null」与「把 domain 整个丢掉」两种错法都会红,而不是只挡住其中一种。诚实边界:`unread-config-file` 是 `config.d/` 扫描**独有**的 kind(闭集里唯一 `domain` 可选的那条),所以「缺席传成缺席」这件事**结构上只在 local-root 腿上可观察**;domains / wire 两腿在本条上是零告警的正控(它们不该凭空造出这条告警)。firstRedOn 空是**实跑**出来的:五个历史版本(1.0.0/1.5.0/1.10.0/2.0.0/2.1.0)在本条上全绿 ⇒ 护栏,不是回归凭证。"
6
6
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "contributor": "test",
3
- "claim": "同一份坏条目,放进逐条容错的域(`models`,`DOMAIN_READ_FALLBACK=\"default\"`)与放进 fail-loud 的闸门域(`rosters`,`=\"throw\"`),结论必须不同:前者丢那一条并恰报一条 `entry-dropped`、**不得同时**报 `domain-defaulted`(一域一个结论);后者**整份读在 validate 层被拒**(不是回落到 schema 默认 —— 对闸门域回落就是放宽闸门)。server [6782] 与 web-admin [7285] G2/G4 是同一件事的两半,跨腿读错会把『逐条容错』顺手放宽到闸门域,把这条设计为拒的输入读成绿(带两条 `entry-dropped`)。",
3
+ "claim": "同一份坏条目,放进逐条容错的域(`models`,`DOMAIN_READ_FALLBACK=\"default\"`)与放进 fail-loud 的闸门域(`rosters`,`=\"throw\"`),结论必须不同:前者丢那一条并恰报一条 `entry-dropped`、**不得同时**报 `domain-defaulted`(一域一个结论);后者**整份读在 validate 层被拒**(不是回落到 schema 默认 —— 对闸门域回落就是放宽闸门)。server 与 web-admin 各自的验收判据是同一件事的两半,跨腿读错会把『逐条容错』顺手放宽到闸门域,把这条设计为拒的输入读成绿(带两条 `entry-dropped`)。",
4
4
  "firstRedOn": [],
5
5
  "note": "【claim 措辞订正 2026-09-19,test 自纠】初稿写的是「后者整域回落」—— **是本方写错**:「回落」是 `DOMAIN_READ_FALLBACK=\"default\"` 那一族的动作,闸门域是 `\"throw\"` = fail-loud,整份读被拒。出处:契约自述 `config-fns.js` 的 `DOMAIN_READ_FALLBACK` 头注(defaulting would LOOSEN gates)+ 契约自带 `c05-gate-domain-bad-entry-throws` 金样(rejected/validate)+ 本仓 historical 实跑五版一致。claim 已按实测改写,对抗意图不变。两域放**同形**坏条目(`name` 是数字):`models`(DOMAIN_READ_FALLBACK=\"default\")与 `rosters`(=\"throw\",且是唯一一个便携的数组形闸门域)。3.0.0 实测:闸门域坏条目使**整份读**在 `validate` 层拒,三腿同形 —— 因此本条的期望是 `rejected/validate`,`models` 那半场在同一份输入里**结构上观察不到**。这正是本条的判别力所在:一个把逐条容错顺手放宽到闸门域的消费方,会把这条设计为拒的 case 读成绿(带两条 `entry-dropped`)。claim 前半场(`models` 恰一条 `entry-dropped`、零 `domain-defaulted`)由 verify.mjs 的配对正控臂(同一份输入去掉 `rosters` 域)钉住,读数记在 _SUMMARY.json 的 t02.pairedControl。claim 里「闸门域整域回落」的『回落』一词与契约自述的 `\"throw\"` = fail-loud 不符 —— 见 _SUMMARY.json 的 claimVsObserved。firstRedOn 空是**实跑**出来的:1.0.0/1.5.0/1.10.0/2.0.0/2.1.0 五版在本条上都是 expected-rejected(闸门域坏条目整份拒这条律从 1.0.0 起一字未动)⇒ 护栏,不是回归凭证。"
6
6
  }
@@ -2,5 +2,5 @@
2
2
  "contributor": "test",
3
3
  "claim": "`__proto__` / `constructor` / `toString` 作为域内条目的键,**在坏条目上**:告警坐标必须把它当**普通字面键**点名、`effective` 的原型必须不被污染、三腿读法一致。本方在 server 7.87.0 G6 实测过同族(`answer.answers[0].__proto__` ⇒ `400 request.field_invalid` 且 `unknownKeys` 逐字点名);也在本仓自证里把 `__proto__` 的断言方向搞反过一次(`JSON.parse` + spread **保留** own 属性、plain assignment 才污染原型),所以这条同时是护栏。",
4
4
  "firstRedOn": [],
5
- "note": "【claim 收窄 2026-09-19,server [7621] ① 指出、主会话亲验】初稿把 `__proto__` **作好条目的 record 键**也算进「当普通字面键报进坐标」。**实测不成立**:`parseDomainLoud('limits', {__proto__:1, ok:2}, …)` 的告警 keys 只有 `['ok']`,`parsed` 上无 own `__proto__`(原型仍是 `Object.prototype`)—— 好条目上的原型名键在 zod 3 正常解析路径上本来就被丢,是 [7617] 已知限制,不是本条要钉的东西。claim 已收窄到**坏条目**那半场(真的、可判、有判别力);好条目那半场不入语料。与契约仓 c12 的差别:c12 打的是**顶层键**(`k in built` 一路问到 Object.prototype ⇒ open-world 承诺失效),本条打的是**域内条目的键**(剥键扫描 `collectDropped` 的 `Object.keys` / `hasOwnProperty` 两处判据,以及 salvage/rebase 路径上的对象重建)。构造坑(本方亲踩,记在此处防下一个人重踩):用 JS 对象字面量 `{\"__proto__\": {...}}` 造这条输入会**设置原型而不是加一个键**,于是 `isPlainJsonObject` 判假、整条扫描被跳过、case 测了个寂寞;语料走 `JSON.parse` 才拿到自有键 —— 这也是为什么这条必须以磁盘语料形存在,而不是测试里一个内联对象。firstRedOn 空是**实跑**出来的:五个旧版(1.0.0/1.5.0/1.10.0/2.0.0/2.1.0)在本条上全绿 —— S-332 那个 bug 只落在**顶层键**那一层(契约 c12 五版全红),域内条目键这一层从 1.0.0 起就一直对 ⇒ 本条是护栏,不是回归凭证。"
5
+ "note": "【claim 收窄 2026-09-19,server 指出、主会话亲验】初稿把 `__proto__` **作好条目的 record 键**也算进「当普通字面键报进坐标」。**实测不成立**:`parseDomainLoud('limits', {__proto__:1, ok:2}, …)` 的告警 keys 只有 `['ok']`,`parsed` 上无 own `__proto__`(原型仍是 `Object.prototype`)—— 好条目上的原型名键在 zod 3 正常解析路径上本来就被丢,是已知限制,不是本条要钉的东西。claim 已收窄到**坏条目**那半场(真的、可判、有判别力);好条目那半场不入语料。与契约仓 c12 的差别:c12 打的是**顶层键**(`k in built` 一路问到 Object.prototype ⇒ open-world 承诺失效),本条打的是**域内条目的键**(剥键扫描 `collectDropped` 的 `Object.keys` / `hasOwnProperty` 两处判据,以及 salvage/rebase 路径上的对象重建)。构造坑(本方亲踩,记在此处防下一个人重踩):用 JS 对象字面量 `{\"__proto__\": {...}}` 造这条输入会**设置原型而不是加一个键**,于是 `isPlainJsonObject` 判假、整条扫描被跳过、case 测了个寂寞;语料走 `JSON.parse` 才拿到自有键 —— 这也是为什么这条必须以磁盘语料形存在,而不是测试里一个内联对象。firstRedOn 空是**实跑**出来的:五个旧版(1.0.0/1.5.0/1.10.0/2.0.0/2.1.0)在本条上全绿 —— 3.0.0 修的那个 bug 只落在**顶层键**那一层(契约 c12 五版全红),域内条目键这一层从 1.0.0 起就一直对 ⇒ 本条是护栏,不是回归凭证。"
6
6
  }
@@ -52,24 +52,39 @@ export declare const HOOK_EVENTS: readonly ["PreToolUse", "PostToolUse", "PostTo
52
52
  /** One hook event name (the same union as `./hooks`' `HookEventName`, which is the zod enum over {@link HOOK_EVENTS}). */
53
53
  type HookEventWord = (typeof HOOK_EVENTS)[number];
54
54
  /**
55
- * The hook entry `type` closed set — CC 2.1.296's five (`cli296.js:237454`): `command` (shell command on the host that runs the hook),
55
+ * The hook entry `type` closed set — CC 2.1.296's five (`cli296.js:237454`): `command` (a command on the host that runs the hook: a shell command line, or — with `args` — an executable spawned directly, no shell),
56
56
  * `prompt` (one-shot LLM evaluation of the hook input), `agent` (agentic verifier loop), `http` (POST the hook input to a URL),
57
57
  * `mcp_tool` (call a tool on an already-configured MCP server). An entry of another type is a bad piece — and in a guard event that rejects
58
58
  * the whole document, which is why `test/upstream-drift.test.ts` ①b holds this set against the CC anchor snapshot.
59
59
  */
60
60
  export declare const HOOK_ENTRY_TYPES: readonly ["command", "prompt", "agent", "http", "mcp_tool"];
61
61
  export type HookEntryType = (typeof HOOK_ENTRY_TYPES)[number];
62
+ /**
63
+ * The `onFailure` closed set (CC `cli309.js:252382`, `onFailure:At()`): what a FAILURE of the hook does — it could not start (a missing script), timed out, exited with a code other
64
+ * than 0 or 2, or printed JSON that is invalid or fails validation. `continue` (CC's default when the key is absent; this package does not fill it in — an absent key stays absent): the
65
+ * failure is reported and the action goes ahead. `block`: the failure counts as exit code 2, so the action the event guards is blocked. Carried by `command` and `http` entries only.
66
+ * CARRIED, not executed here: a consumer that reads `block` executes it or refuses it — ignoring it makes a guard that cannot start let the action through.
67
+ * The classifier reads this set through a closure-private projection that the compiler ties to it in both directions.
68
+ */
69
+ export declare const HOOK_ON_FAILURE_WORDS: readonly ["continue", "block"];
70
+ /** One word of {@link HOOK_ON_FAILURE_WORDS}. */
71
+ export type HookOnFailure = (typeof HOOK_ON_FAILURE_WORDS)[number];
62
72
  /** `shell` values: 'bash' = the user's $SHELL family; 'powershell' = pwsh. Default bash. */
63
73
  declare const HOOK_SHELLS: readonly ["bash", "powershell"];
64
74
  /**
65
75
  * THE field table of a hook entry, per type — read by {@link classifyHooksConfig} (which field is bad, what is carried) and by the entry
66
76
  * types below (derived from it). Field order = the order a loaded entry's keys come out in.
67
- * · command: `shell` (see above), `async` = run in background without blocking, `asyncRewake` = background + wake the model on exit 2;
77
+ * · command: `args` = exec form (CC `cli309.js:252382`: when present — `[]` included — `command` is an executable spawned directly with these arguments, no shell; the mere
78
+ * presence of `args` is the switch), `shell` (see above), `async` = run in background without blocking, `asyncRewake` = background + wake the model on exit 2,
79
+ * `onFailure` (see {@link HOOK_ON_FAILURE_WORDS});
68
80
  * · prompt / agent: `prompt` ($ARGUMENTS = the hook input JSON), `model`;
69
81
  * · http: `url`, `headers` (values may reference $NAMEs listed in `allowedEnvVars` — env-NAME interpolation only, the config never carries a
70
- * secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`;
82
+ * secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`, `onFailure` (the other schema CC gives it to);
71
83
  * · mcp_tool: `server` (an already-configured MCP server's name), `tool`, `input` (the tool's arguments; string values may interpolate
72
84
  * `${path}` from the hook input JSON — CC 2.1.296 semantics, the runner's business).
85
+ * NOT in the table, on purpose: CC's `@internal` command / http keys `rewakeMessage` / `rewakeSummary` / `cloud` (not public settings keys; `cloud` even reads a bad value
86
+ * as 'skip' and loads the file) and the prompt entry's `continueOnBlock`. A key outside a type's row is not carried and not a bad piece (`docs/CC-DIVERGENCE.md` H7) —
87
+ * which is also why `args` on a non-command entry and `onFailure` on a prompt / agent / mcp_tool entry are such keys.
73
88
  */
74
89
  declare const HOOK_ENTRY_FIELDS: {
75
90
  readonly command: {
@@ -78,9 +93,11 @@ declare const HOOK_ENTRY_FIELDS: {
78
93
  readonly statusMessage: "string?";
79
94
  readonly once: "boolean?";
80
95
  readonly command: "text";
96
+ readonly args: "argv?";
81
97
  readonly shell: "shell?";
82
98
  readonly async: "boolean?";
83
99
  readonly asyncRewake: "boolean?";
100
+ readonly onFailure: "onFailure?";
84
101
  };
85
102
  readonly prompt: {
86
103
  readonly if: "string?";
@@ -106,6 +123,7 @@ declare const HOOK_ENTRY_FIELDS: {
106
123
  readonly url: "text";
107
124
  readonly headers: "stringRecord?";
108
125
  readonly allowedEnvVars: "stringList?";
126
+ readonly onFailure: "onFailure?";
109
127
  };
110
128
  readonly mcp_tool: {
111
129
  readonly if: "string?";
@@ -117,7 +135,7 @@ declare const HOOK_ENTRY_FIELDS: {
117
135
  readonly input: "record?";
118
136
  };
119
137
  };
120
- type HookFieldBaseValue<B> = B extends "text" | "string" ? string : B extends "shell" ? (typeof HOOK_SHELLS)[number] : B extends "boolean" ? boolean : B extends "seconds" ? number : B extends "stringRecord" ? Record<string, string> : B extends "stringList" ? string[] : B extends "record" ? Record<string, unknown> : never;
138
+ type HookFieldBaseValue<B> = B extends "text" | "string" ? string : B extends "shell" ? (typeof HOOK_SHELLS)[number] : B extends "onFailure" ? HookOnFailure : B extends "boolean" ? boolean : B extends "seconds" ? number : B extends "stringRecord" ? Record<string, string> : B extends "stringList" | "argv" ? string[] : B extends "record" ? Record<string, unknown> : never;
121
139
  type HookFieldValue<K> = K extends `${infer B}?` ? HookFieldBaseValue<B> : HookFieldBaseValue<K>;
122
140
  type Flat<O> = {
123
141
  [K in keyof O]: O[K];
@@ -130,7 +148,7 @@ type HookEntryOf<T extends HookEntryType, F = (typeof HOOK_ENTRY_FIELDS)[T]> = F
130
148
  } & {
131
149
  -readonly [K in keyof F as F[K] extends `${string}?` ? K : never]?: HookFieldValue<F[K]>;
132
150
  }>;
133
- /** `command` — shell command on the host that runs the hook (DESIGN POINT ② in `./hooks`). */
151
+ /** `command` — a command on the host that runs the hook: a shell command line, or — when the entry carries `args` — an executable spawned directly with those arguments, no shell (DESIGN POINT ② in `./hooks`). */
134
152
  export type CommandHookEntry = HookEntryOf<"command">;
135
153
  /** `prompt` — one-shot LLM evaluation of the hook input ($ARGUMENTS = input JSON). */
136
154
  export type PromptHookEntry = HookEntryOf<"prompt">;
@@ -99,14 +99,26 @@ export const HOOK_EVENTS = [...CC_198_HOOK_EVENTS, ...POST_198_HOOK_EVENTS];
99
99
  const HOOK_GUARD_EVENTS = ["PreToolUse", "PermissionRequest"];
100
100
  // ── entry vocabulary and the one field table ───────────────────────────────────────────────────────────────
101
101
  /**
102
- * The hook entry `type` closed set — CC 2.1.296's five (`cli296.js:237454`): `command` (shell command on the host that runs the hook),
102
+ * The hook entry `type` closed set — CC 2.1.296's five (`cli296.js:237454`): `command` (a command on the host that runs the hook: a shell command line, or — with `args` — an executable spawned directly, no shell),
103
103
  * `prompt` (one-shot LLM evaluation of the hook input), `agent` (agentic verifier loop), `http` (POST the hook input to a URL),
104
104
  * `mcp_tool` (call a tool on an already-configured MCP server). An entry of another type is a bad piece — and in a guard event that rejects
105
105
  * the whole document, which is why `test/upstream-drift.test.ts` ①b holds this set against the CC anchor snapshot.
106
106
  */
107
107
  export const HOOK_ENTRY_TYPES = ["command", "prompt", "agent", "http", "mcp_tool"];
108
+ /**
109
+ * The `onFailure` closed set (CC `cli309.js:252382`, `onFailure:At()`): what a FAILURE of the hook does — it could not start (a missing script), timed out, exited with a code other
110
+ * than 0 or 2, or printed JSON that is invalid or fails validation. `continue` (CC's default when the key is absent; this package does not fill it in — an absent key stays absent): the
111
+ * failure is reported and the action goes ahead. `block`: the failure counts as exit code 2, so the action the event guards is blocked. Carried by `command` and `http` entries only.
112
+ * CARRIED, not executed here: a consumer that reads `block` executes it or refuses it — ignoring it makes a guard that cannot start let the action through.
113
+ * The classifier reads this set through a closure-private projection that the compiler ties to it in both directions.
114
+ */
115
+ export const HOOK_ON_FAILURE_WORDS = ["continue", "block"];
108
116
  /** `shell` values: 'bash' = the user's $SHELL family; 'powershell' = pwsh. Default bash. */
109
117
  const HOOK_SHELLS = ["bash", "powershell"];
118
+ /** The classifier's reading of {@link HOOK_ON_FAILURE_WORDS}. The classifier is copied as source by consumers' generators, so its closure cannot read an exported name (its one free name
119
+ * is {@link HOOK_EVENTS}): this record is the closure-private projection of the exported set, and the compiler ties the two in both directions — a word added to the set without a row
120
+ * here, or a row here that the set does not hold, is a compile error. */
121
+ const HOOK_ON_FAILURE_ACCEPTED = { continue: true, block: true };
110
122
  /** Fields every entry type takes: `if` = permission-rule syntax (e.g. "Bash(git *)") evaluated against tool_name/tool_input before the hook
111
123
  * runs (tool events only; shell superset field, CC-compatible); `timeout` = seconds for this entry (default `DEFAULT_HOOK_TIMEOUT_SECONDS`);
112
124
  * `statusMessage` = spinner status message; `once` = run once, then remove. */
@@ -114,18 +126,23 @@ const HOOK_ENTRY_COMMON_FIELDS = { if: "string?", timeout: "seconds?", statusMes
114
126
  /**
115
127
  * THE field table of a hook entry, per type — read by {@link classifyHooksConfig} (which field is bad, what is carried) and by the entry
116
128
  * types below (derived from it). Field order = the order a loaded entry's keys come out in.
117
- * · command: `shell` (see above), `async` = run in background without blocking, `asyncRewake` = background + wake the model on exit 2;
129
+ * · command: `args` = exec form (CC `cli309.js:252382`: when present — `[]` included — `command` is an executable spawned directly with these arguments, no shell; the mere
130
+ * presence of `args` is the switch), `shell` (see above), `async` = run in background without blocking, `asyncRewake` = background + wake the model on exit 2,
131
+ * `onFailure` (see {@link HOOK_ON_FAILURE_WORDS});
118
132
  * · prompt / agent: `prompt` ($ARGUMENTS = the hook input JSON), `model`;
119
133
  * · http: `url`, `headers` (values may reference $NAMEs listed in `allowedEnvVars` — env-NAME interpolation only, the config never carries a
120
- * secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`;
134
+ * secret value; `interpolateHookEnvVars` is the one reading), `allowedEnvVars`, `onFailure` (the other schema CC gives it to);
121
135
  * · mcp_tool: `server` (an already-configured MCP server's name), `tool`, `input` (the tool's arguments; string values may interpolate
122
136
  * `${path}` from the hook input JSON — CC 2.1.296 semantics, the runner's business).
137
+ * NOT in the table, on purpose: CC's `@internal` command / http keys `rewakeMessage` / `rewakeSummary` / `cloud` (not public settings keys; `cloud` even reads a bad value
138
+ * as 'skip' and loads the file) and the prompt entry's `continueOnBlock`. A key outside a type's row is not carried and not a bad piece (`docs/CC-DIVERGENCE.md` H7) —
139
+ * which is also why `args` on a non-command entry and `onFailure` on a prompt / agent / mcp_tool entry are such keys.
123
140
  */
124
141
  const HOOK_ENTRY_FIELDS = {
125
- command: { command: "text", shell: "shell?", async: "boolean?", asyncRewake: "boolean?", ...HOOK_ENTRY_COMMON_FIELDS },
142
+ command: { command: "text", args: "argv?", shell: "shell?", async: "boolean?", asyncRewake: "boolean?", onFailure: "onFailure?", ...HOOK_ENTRY_COMMON_FIELDS },
126
143
  prompt: { prompt: "text", model: "string?", ...HOOK_ENTRY_COMMON_FIELDS },
127
144
  agent: { prompt: "text", model: "string?", ...HOOK_ENTRY_COMMON_FIELDS },
128
- http: { url: "text", headers: "stringRecord?", allowedEnvVars: "stringList?", ...HOOK_ENTRY_COMMON_FIELDS },
145
+ http: { url: "text", headers: "stringRecord?", allowedEnvVars: "stringList?", onFailure: "onFailure?", ...HOOK_ENTRY_COMMON_FIELDS },
129
146
  mcp_tool: { server: "string", tool: "string", input: "record?", ...HOOK_ENTRY_COMMON_FIELDS },
130
147
  };
131
148
  // ── classification vocabulary ──────────────────────────────────────────────────────────────────────────────
@@ -338,6 +355,17 @@ function hookFieldFits(base, value) {
338
355
  if (typeof value[i] !== "string")
339
356
  return false;
340
357
  return true;
358
+ case "argv":
359
+ if (!hookIsArray(value))
360
+ return false;
361
+ for (let i = 0; i < value.length; i++) {
362
+ const arg = value[i];
363
+ if (typeof arg !== "string" || arg.includes("\0"))
364
+ return false;
365
+ }
366
+ return true;
367
+ case "onFailure":
368
+ return typeof value === "string" && Object.hasOwn(HOOK_ON_FAILURE_ACCEPTED, value);
341
369
  case "record":
342
370
  return hookIsRecord(value);
343
371
  default: {
package/dist/hooks.d.ts CHANGED
@@ -1442,8 +1442,8 @@ export declare const HookInput: z.ZodDiscriminatedUnion<[z.ZodObject<{
1442
1442
  export type HookInput = z.infer<typeof HookInput>;
1443
1443
  /** Legacy top-level decision (CC): "approve" ≈ allow, "block" feeds `reason` back to the model. */
1444
1444
  export declare const HookDecision: z.ZodEnum<{
1445
- approve: "approve";
1446
1445
  block: "block";
1446
+ approve: "approve";
1447
1447
  }>;
1448
1448
  export type HookDecision = z.infer<typeof HookDecision>;
1449
1449
  /** PermissionRequest hook decision — mirrors CC PermissionResult (allow may rewrite input/permissions). */
@@ -1728,19 +1728,21 @@ export type HookSpecificOutput = z.infer<typeof HookSpecificOutput>;
1728
1728
  * Synchronous hook JSON output (stdout of a command hook, CC-verbatim). Exit-code semantics ride
1729
1729
  * alongside: exit 0 = success (stdout parsed as this shape when JSON); exit 2 = BLOCKING error (stderr is fed
1730
1730
  * back to the model as the block reason / additionalContext, per event); any other exit, a timeout, a spawn
1731
- * failure or malformed JSON = NON-BLOCKING failure: the run continues, and the consumer's hook-runner forwards
1731
+ * failure or malformed JSON = NON-BLOCKING failure by default (the entry's `onFailure` is absent or `continue`): the run continues, and the consumer's hook-runner forwards
1732
1732
  * it as a `hook_non_blocking_failure` notice (a `hook_notice` frame on the task/fleet stream carrying hook name,
1733
1733
  * event, reason, exit code and the stderr text redacted-then-bounded to 512 chars), so the failure is visible
1734
1734
  * from the task's point of view instead of only in server logs. There is no separate "shown to the user"
1735
1735
  * surface: what a user sees is whatever their client renders from that notice frame.
1736
+ * An entry that carries `onFailure: "block"` (a contract field of `command` and `http` entries, see `./hooks-config`) counts exactly those failures as exit 2 instead;
1737
+ * executing that is the consumer's business, and a consumer that ignores it lets through a guarded action whose guard could not run.
1736
1738
  */
1737
1739
  export declare const SyncHookOutput: z.ZodObject<{
1738
1740
  continue: z.ZodOptional<z.ZodBoolean>;
1739
1741
  suppressOutput: z.ZodOptional<z.ZodBoolean>;
1740
1742
  stopReason: z.ZodOptional<z.ZodString>;
1741
1743
  decision: z.ZodOptional<z.ZodEnum<{
1742
- approve: "approve";
1743
1744
  block: "block";
1745
+ approve: "approve";
1744
1746
  }>>;
1745
1747
  reason: z.ZodOptional<z.ZodString>;
1746
1748
  systemMessage: z.ZodOptional<z.ZodString>;
@@ -1935,8 +1937,8 @@ export declare const HookOutput: z.ZodUnion<readonly [z.ZodObject<{
1935
1937
  suppressOutput: z.ZodOptional<z.ZodBoolean>;
1936
1938
  stopReason: z.ZodOptional<z.ZodString>;
1937
1939
  decision: z.ZodOptional<z.ZodEnum<{
1938
- approve: "approve";
1939
1940
  block: "block";
1941
+ approve: "approve";
1940
1942
  }>>;
1941
1943
  reason: z.ZodOptional<z.ZodString>;
1942
1944
  systemMessage: z.ZodOptional<z.ZodString>;
package/dist/hooks.js CHANGED
@@ -546,11 +546,13 @@ export const HookSpecificOutput = z.union([
546
546
  * Synchronous hook JSON output (stdout of a command hook, CC-verbatim). Exit-code semantics ride
547
547
  * alongside: exit 0 = success (stdout parsed as this shape when JSON); exit 2 = BLOCKING error (stderr is fed
548
548
  * back to the model as the block reason / additionalContext, per event); any other exit, a timeout, a spawn
549
- * failure or malformed JSON = NON-BLOCKING failure: the run continues, and the consumer's hook-runner forwards
549
+ * failure or malformed JSON = NON-BLOCKING failure by default (the entry's `onFailure` is absent or `continue`): the run continues, and the consumer's hook-runner forwards
550
550
  * it as a `hook_non_blocking_failure` notice (a `hook_notice` frame on the task/fleet stream carrying hook name,
551
551
  * event, reason, exit code and the stderr text redacted-then-bounded to 512 chars), so the failure is visible
552
552
  * from the task's point of view instead of only in server logs. There is no separate "shown to the user"
553
553
  * surface: what a user sees is whatever their client renders from that notice frame.
554
+ * An entry that carries `onFailure: "block"` (a contract field of `command` and `http` entries, see `./hooks-config`) counts exactly those failures as exit 2 instead;
555
+ * executing that is the consumer's business, and a consumer that ignores it lets through a guarded action whose guard could not run.
554
556
  */
555
557
  export const SyncHookOutput = z.object({
556
558
  /** Whether the run should continue after the hook (default true). */
@@ -4,9 +4,9 @@
4
4
  > 每次全量重算并逐名比对 —— 加 / 删 / 改形一个导出而不重生成本档 ⇒ 红。导出面的每次变动因此以本档的 diff 出现在评审里。
5
5
  > 形:`value` = 运行期拿得到的值;`type` = 只在类型层;`value+type` = 同名的值与类型(zod schema 与它推出的类型)。
6
6
 
7
- 子路径 24 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1497 个(同名在多条子路径上各计一次)。
7
+ 子路径 24 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1501 个(同名在多条子路径上各计一次)。
8
8
 
9
- ## `.`(783)
9
+ ## `.`(785)
10
10
 
11
11
  - `A2aConfig` — value+type
12
12
  - `A2aPeerSpec` — value+type
@@ -215,6 +215,7 @@
215
215
  - `HOOK_EVENT_MATCHER_FIELD` — value
216
216
  - `HOOK_EVENT_OWNER` — value
217
217
  - `HOOK_INJECTED_ENV` — value
218
+ - `HOOK_ON_FAILURE_WORDS` — value
218
219
  - `HOSTS_ARRAY_MAX` — value
219
220
  - `HOST_NAME_MAX` — value
220
221
  - `HTTP_HOOK_ALLOWLIST_KEYS` — value
@@ -230,6 +231,7 @@
230
231
  - `HookInput` — value+type
231
232
  - `HookMatcherEntry` — value+type
232
233
  - `HookMatcherForm` — type
234
+ - `HookOnFailure` — type
233
235
  - `HookOutput` — value+type
234
236
  - `HookOwner` — value+type
235
237
  - `HookPermissionRequestDecision` — value+type
@@ -1287,7 +1289,7 @@
1287
1289
  - `parseSchedulerStore` — value
1288
1290
  - `serializeSchedulerStore` — value
1289
1291
 
1290
- ## `./hooks`(94)
1292
+ ## `./hooks`(96)
1291
1293
 
1292
1294
  - `AgentHookEntry` — value+type
1293
1295
  - `AssistantTurnError` — value+type
@@ -1314,6 +1316,7 @@
1314
1316
  - `HOOK_EVENT_MATCHER_FIELD` — value
1315
1317
  - `HOOK_EVENT_OWNER` — value
1316
1318
  - `HOOK_INJECTED_ENV` — value
1319
+ - `HOOK_ON_FAILURE_WORDS` — value
1317
1320
  - `HookDecision` — value+type
1318
1321
  - `HookEntry` — value+type
1319
1322
  - `HookEntryType` — type
@@ -1323,6 +1326,7 @@
1323
1326
  - `HookInput` — value+type
1324
1327
  - `HookMatcherEntry` — value+type
1325
1328
  - `HookMatcherForm` — type
1329
+ - `HookOnFailure` — type
1326
1330
  - `HookOutput` — value+type
1327
1331
  - `HookOwner` — value+type
1328
1332
  - `HookPermissionRequestDecision` — value+type
@@ -1,7 +1,7 @@
1
1
  # CC 偏离登记(本包)
2
2
 
3
3
  本包镜像或对齐 Claude Code(CC)上游的设置语义时,**有意**不照抄的地方逐条登在这里:差在哪(CC 原形与语料坐标 / 本包的形)、哪个方向、为什么、谁读它。
4
- 锚 = CC 2.1.296 语料 `cli296.js`(只 grep,不解包;坐标写行号,行号属于那一份语料,只引不抄)。
4
+ 锚 = CC 2.1.296 语料 `cli296.js`(只 grep,不解包;坐标写行号,行号属于那一份语料,只引不抄);H7 的两个新进字段另引 `cli309.js` 的坐标。
5
5
 
6
6
  方向只有两种写法:**更严**(本包拦下 / 不放行 / 不装 CC 会放行或会装的)与**更宽**(本包拦下 CC 不拦的 —— 只出现在拒绝方向)。
7
7
  本包不登「比 CC 更松」的偏离;出现了即是缺陷。
@@ -18,7 +18,7 @@
18
18
  | H4 | 已知非守卫事件的值写成一只匹配器(不是数组)⇒ 整份拒 | 剔掉那个键(警告) | 匹配器形本身就是迹象(规则一条,不因事件名分档) |
19
19
  | H5 | 整份文档本身写成一只匹配器(顶层带 `matcher` 键 + 匹配器形)⇒ 整份拒 | 无此判 | 把一只守卫匹配器误贴成整份设置时,CC 剔掉坏的 `hooks` 后照装 |
20
20
  | H6 | `hooks` 是装着**数组**的数组 ⇒ 整份拒(与装对象同判) | 只对装对象 / 装迹象的数组整份拒,装数组的剔掉 | 套一层数组的守卫不该被当成标量剔掉 |
21
- | H7 | 条目字段以本包字段表为准(`HOOK_ENTRY_FIELDS`);CC 独有字段(`args` / `onFailure` / `cloud` / `continueOnBlock` / `rewakeMessage` …)不进装上的那一份,也不算坏块 | 认得这些字段 | 契约只收本包定义的字段;字段级的上游漂移今天没有门(type 集有,见漂移门 ①b) —— 未闭环 |
21
+ | H7 | 条目字段以本包字段表为准(`HOOK_ENTRY_FIELDS`):command 收 `args`(exec 形参数表;元素另判零 NUL —— `spawn()` 对含 NUL 的参数抛,CC 的串数组不判)、command / http 收 `onFailure`(词表 `HOOK_ON_FAILURE_WORDS` = `continue` \| `block`;缺席不补缺省);其余 CC 独有字段(`cloud` / `continueOnBlock` / `rewakeMessage` / `rewakeSummary` …,CC 标 `@internal` 的键与 prompt 条目的 `continueOnBlock`)不进装上的那一份,也不算坏块 —— `args` 写在 command 以外、`onFailure` 写在 command / http 以外的条目上同属这一类(键下装着守卫迹象的除外:H3,整份拒) | 认得这些字段(`cli309.js:252382`:`args` 只在 command 的 schema 上,`onFailure` 在 command 与 http 的 schema 上) | 契约只收本包定义的字段;`args` / `onFailure` 19.0.0 起进表(此前被剥掉:exec 形条目只剩可执行名去跑,`block` 的守卫起不来照放行);字段级的上游漂移今天没有门(type 集有,见漂移门 ①b) —— 未闭环 |
22
22
 
23
23
  不是偏差的(与 CC 同):守卫事件集 {`PreToolUse`, `PermissionRequest`};守卫事件值 `null` = 剔不拒;非守卫事件里坏匹配器 / 坏条目逐个剔;hook 条目 type 五种。
24
24
 
@@ -131,7 +131,7 @@ expect(report.ok).toBe(true);
131
131
  - **`historical`** —— 对旧版包跑,只记行为 diff。可挂一只**自陈有损**的归一器(旧版坐标是点号串、今天是
132
132
  段数组)。`npm run conformance:historical` 就是它,产出进 `conformance/historical/`。归一器可带一只
133
133
  **投影级**钩子 `warning?(p)`(先于 `path` 作用,期望与实际两侧同过):旧版**铸不出**的 additive 字段在这里
134
- 剥掉 —— 今天是 `entry-dropped.identity`(S-712)与 `entry-dropped.reasonCode`(S-1295)—— 否则「旧版没有这个字段」会被记成「旧版行为红」。
134
+ 剥掉 —— 今天是 `entry-dropped.identity`(6.1.0 起)与 `entry-dropped.reasonCode`(10.1.0 起)—— 否则「旧版没有这个字段」会被记成「旧版行为红」。
135
135
 
136
136
  ## 4. 四律(缺一不算「门」)
137
137
 
@@ -191,10 +191,10 @@ conformance/
191
191
  `{"why": "<为什么受理 / 为什么拒>"}`),跑 `npm run conformance:bless` 填金样,跑 `npm run conformance:historical` 填 `firstRedOn`。
192
192
  - `contributor` **只写真交了的仓**。替别人写的语料带不进那个仓的读法,只会让门看起来更满。
193
193
 
194
- **test 的四条(S-570,2026-09-22)**:`t01-absent-domain-key-not-null` / `t02-entry-salvage-vs-whole-domain-refusal`
194
+ **test 的四条(3.0.1 收编,2026-09-22)**:`t01-absent-domain-key-not-null` / `t02-entry-salvage-vs-whole-domain-refusal`
195
195
  / `t03-prototype-name-key-not-swallowed` / `t04-secret-literal-never-in-warning-value` —— 来源
196
196
  `sema-test` 仓 `repro/ss300-corpus-20260919/cases/`(该围栏对 3.0.0 的黑盒验收批,`contributor` 字段
197
- 在源头就已是 `"test"`);本仓只读取用、原样收编,未改写 `claim`/`note` 的措辞。`firstRedOn` 未沿用
197
+ 在源头就已是 `"test"`);本仓只读取用、原样收编;`claim`/`note` 的措辞未改,仅 19.0.1 把其中指向外部频道的帖号换成了不带编号的短语。`firstRedOn` 未沿用
198
198
  sema-test 的读数,是本仓自己重跑 `node scripts/conformance-historical.mjs 1.0.0 1.5.0 1.10.0 2.0.0 2.1.0`
199
199
  对五个历史发布版真实产出的(与源头读数逐字一致,交叉印证)。四条把 `contributor: "test"` 从 0 条
200
200
  带到 4 条(`test/conformance-corpus.test.ts` 对抗律①的机器记账 pin 已同批更新)。
@@ -237,11 +237,11 @@ sema-test 的读数,是本仓自己重跑 `node scripts/conformance-historical.m
237
237
  - **告警投影**:对 `EffectiveReadWarning` 联合做**穷举 typed 投影** = 每臂减掉 `error`,**从联合逐臂派生**
238
238
  (4.0.0:属主在契约包的 `./config-fns`,kit 只再导出 —— 此前是 kit 里一份**手写**字段表,给某个 kind 加
239
239
  一个字段两边都不红);`error` 文案**不比对**(它可经脱敏、可随 zod 改字,比文案 = 比实现),但先断言它
240
- **不含语料自带的秘密**。`entry-dropped` 的 `identity`(S-712:被丢条目原文里读得出的 `name` / `id` /
240
+ **不含语料自带的秘密**。`entry-dropped` 的 `identity`(6.1.0:被丢条目原文里读得出的 `name` / `id` /
241
241
  `enabled`,读不出 ⇒ 键缺席)**在**投影里 —— 它是契约铸的数据,不是文案;一条自己重铸告警、漏带身份的读腿
242
242
  会在告警面报 `missing` / `extra`;**消费方自己入库的语料**(例:web-admin `test/conformance/cases/wa05-*` 在
243
243
  被丢的 skills 条目上断言 `entry-dropped`)提货时要按新读数重新加冕 —— additive 字段让旧金样少一个键,
244
- 是提货成本,不是读法分歧。`reasonCode`(S-1295:为什么丢的机读闭集词)同理在投影里 —— 语料里 `entry-key-invalid` /
244
+ 是提货成本,不是读法分歧。`reasonCode`(10.1.0:为什么丢的机读闭集词)同理在投影里 —— 语料里 `entry-key-invalid` /
245
245
  `entry-schema-invalid` 由 JSON 表达得出;`entry-unreadable`(判的过程抛了)需要病态访问器,JSON 表达不出,由
246
246
  `test/dropped-entry-reason-code-s1295.test.ts` 看着;web-admin 自有语料同样要在提货时按新读数重新加冕。
247
247
  - **多重集**而不是集合:同一 kind 在同一域上发两次是有信息的,去重会把「报了两条」读成「报了一条」。
@@ -273,7 +273,7 @@ const adapter: ConformanceAdapter = {
273
273
  // …
274
274
  knownDivergences: [
275
275
  { leg: "wire", pathPrefix: "/limits/infraCostRates", kind: "debt",
276
- ref: "A-075.41", window: "2026-10-31", flipWhen: "本仓改完 limits 投影后删掉这一条" },
276
+ ref: "DEBT-41", window: "2026-10-31", flipWhen: "本仓改完 limits 投影后删掉这一条" },
277
277
  ],
278
278
  };
279
279
  // release 模式挂着账本 ⇒ 调用方传钟:runConformance(adapter, { mode: "release", nowMs: Date.now() })
@@ -304,7 +304,7 @@ const adapter: ConformanceAdapter = {
304
304
  ```ts
305
305
  { kind: "debt",
306
306
  outcome: { leg: "wire", cases: ["c17-empty-domain-file"], expected: "rejected", actual: "effective" },
307
- ref: "A-075.NN", window: "2026-10-31", flipWhen: "本仓改成按契约拒收后删掉这一条" }
307
+ ref: "DEBT-42", window: "2026-10-31", flipWhen: "本仓改成按契约拒收后删掉这一条" }
308
308
  ```
309
309
 
310
310
  - 命中判据**四道全等**:腿 ∧ case 在点名名单里 ∧ 金样期望的结局 ∧ 消费方实际的结局。
@@ -331,8 +331,8 @@ const adapter: ConformanceAdapter = {
331
331
 
332
332
  - **消费方半场的 `firstRedOn` 测不到**:`firstRedOn` 只能反映**契约包自身**在旧版上的行为差,消费方
333
333
  (server / 管理面)在它们 2.1.0 期的读腿分歧,要等它们交 adapter 才量得到。
334
- - **有损归一器会抹平真差异**:对 2.1.0 跑时,S-323c 的坐标改铸(刻意的契约变更)被归一器抹平 —— 同一套
334
+ - **有损归一器会抹平真差异**:对 2.1.0 跑时,3.0.0 的坐标改铸(刻意的契约变更)被归一器抹平 —— 同一套
335
335
  抹平也会掩盖「两条不同的段坐标拼成同一个串」这类真二义。归一器自陈 `lossy:true` 就是为了让这句话
336
- 必须被说出来,而不是被当成「没差别」。S-712 起它还两侧剥掉 `entry-dropped.identity`(旧版铸不出):
337
- 身份的差在 historical 读数里同样看不见;S-1295 起 `entry-dropped.reasonCode` 同理。
336
+ 必须被说出来,而不是被当成「没差别」。6.1.0 起它还两侧剥掉 `entry-dropped.identity`(旧版铸不出):
337
+ 身份的差在 historical 读数里同样看不见;10.1.0 起 `entry-dropped.reasonCode` 同理。
338
338
  - **来源律不能证明非同义反复**(见 §4-4):那一半归消费方半场的变异自证。
@@ -4,7 +4,7 @@
4
4
  **定位:** 这是消费这个包的**单一真值**,把跨仓频道里零散的接入答疑一次性固化。**接入前读这一份,不必再追问。** owner = web-admin。
5
5
 
6
6
  > **本档订正到 3.0.0**(此前停在改名定版前的开发代号一节,2.0.0/2.1.0/3.0.0 三版未跟)。逐条改动见
7
- > S-570 收车档;3.0.0 之后的下一次真实改动,请同一批把这份文档也带上,别再停摆。**7.0.0**(M-R2 WorkerSpec 结构块)的
7
+ > 3.0.1 的 CHANGELOG 节;3.0.0 之后的下一次真实改动,请同一批把这份文档也带上,别再停摆。**7.0.0**(M-R2 WorkerSpec 结构块)的
8
8
  > 三方迁移句在 §0.2,`remoteExec` 删 `remote-docker` 在 §5。**8.0.0**(一致性门第四条腿 + 表态律 + CLI `--check`)在 §0.3。
9
9
  > **11.0.0** 的持久面(`runtime` 域退役、读侧兼容臂退役、一次性迁移族 `./one-time-migrations`)在 §0.4。
10
10
  > **14.7.0** 的沙箱 git 凭据平面(取值口 wire 型、有效配置块 `sandboxGit`、`VerifiedIdentity.principalInc`)在 §12。
@@ -12,6 +12,7 @@
12
12
  > 中心引用解析口 `resolveCenterRefs` 与记录读器 `readPlainStringRecord`(原因词表 `PLAIN_STRING_RECORD_FAULTS`)在 §14。
13
13
  > **17.2.0** 的 settings 单元读不进处置律在 §15,`./node` 的同步读写口(`config.d` 文档读数、决定文档读 / 写)与根桶的「显式停用」谓词在 §16。
14
14
  > **18.0.0** 的车道词 `none`、`REQUIRE_EXECUTION_LANE` 墓碑、车道集单一判官 `laneSetFlaws` 与便携新域 `a2a` 在 §17。
15
+ > **19.0.0** 的 hook 条目字段 `args`(exec 形参数表)与 `onFailure`(失败按放行还是阻断)在 §18。
15
16
 
16
17
  ---
17
18
 
@@ -233,8 +234,8 @@ server 直接拒启,不是静默降级。上一代 `SEMA_REGISTRY_*` 八名(`URL
233
234
  —— 在场即拒启(见 §2)。
234
235
  - 凭证也可以声明成**文件**:`WEB_ADMIN_ENV.tokenFile`(每次取值重读,轮换不重启),与 `WEB_ADMIN_ENV.token`
235
236
  **二选一**,两个都设 = 拒;断言令牌的一对(`assertionToken` / `assertionTokenFile`)同一条规则。这条规则**别手抄**:取
236
- `judgeWebAdminCredentialDeclaration(env, "access" | "assertion")`(S-742);文件内容的读法取
237
- `parseWebAdminCredentialFile(text)`(S-698:裸行 = 静态 bearer,`{` 开头 = `WebAdminCredentialEnvelope` 用户会话信封,
237
+ `judgeWebAdminCredentialDeclaration(env, "access" | "assertion")`(二选一判官 6.1.0 起,`assertion` 一对与必填第二参 11.0.0 起);文件内容的读法取
238
+ `parseWebAdminCredentialFile(text)`(6.1.0 起:裸行 = 静态 bearer,`{` 开头 = `WebAdminCredentialEnvelope` 用户会话信封,
238
239
  读不成 = `unreadable`,不回落)。
239
240
  - **本地 `config.d` 的一次性迁移(引擎起服)**:调 `@sema-agent/settings-schema/node` 的 `migrateConfigDirectory(dir, { documents, io: nodeConfigDirectoryIo })`,`documents` 填你本地读腿会读的域名集
240
241
  (覆盖面外的文件不读不判不写不删;要迁 retired 的 `runtime` 域就得把 `governance` 与 `limits` 一并放进来 —— 迁出的旧值要写那两份,缺了 `runtime` 按 `partial` 拒迁、一字不写);按返回的 `kind` 穷举处置(`applied` / `noop` / `pending` / `refused` / `no-documents` / `unreadable`)。**别按同语义自写**读目录、迁、整域终判、原子写、删退役域文件那一串 ——
@@ -245,7 +246,7 @@ server 直接拒启,不是静默降级。上一代 `SEMA_REGISTRY_*` 八名(`URL
245
246
  - **会话网页链接**:要给用户一个 web-admin 里的会话链接,调 `webAdminSessionUrl(webBaseUrl, { worker, sessionId })`(`webBaseUrl` 取引擎 `/health` 自报的人用界面根 URL,
246
247
  `worker` 取引擎向 web-admin 登记用的 worker 名),得到 `<webBaseUrl>/chat?agent=<worker>&session=<sessionId>`;**别按地址形手拼** —— 路由属于 web-admin,模板与读回的
247
248
  `parseWebAdminSessionUrl(link)` 同在本包,路径与参数名只此一份。两位必填:只带 `session` 的链接会落到页面自己挑的 worker 上、可能找不到会话。
248
- - **模型拒因(引擎 → web-admin,S-768,6.2.0)**:引擎逐台报「本机不服务目录里的哪些条目、为什么」,一处铸、两出口 ——
249
+ - **模型拒因(引擎 → web-admin,6.2.0)**:引擎逐台报「本机不服务目录里的哪些条目、为什么」,一处铸、两出口 ——
249
250
  心跳 `InstanceAnnouncement.modelRefusals?` 与 `GET /health` 的 `modelRefusals`(`InstanceHealth` 不类型化它)。**两个出口
250
251
  同一只读口**:`readModelRefusals(body)`,`body` 传 `/health` 体或已 parse 的公告都行(它只读 `modelRefusals` 键);别直接
251
252
  读公告上的字段 —— 字段是 wire 形 `ModelRefusalsWire`(码是开放串),读口才按本包闭集收窄成 `ModelRefusalsSignal`。
@@ -651,3 +652,19 @@ fleet 成员对中心公告的可达地址(`FLEET_ADVERTISE_ADDRESS`,中心往
651
652
 
652
653
  凭据参数名(同版):「这个已解码的参数名是不是凭据名」只问包根 `credentialParamWordOf`(返回表词或 `undefined`:整名在 `CREDENTIAL_PARAM_NAMES` 上,或末段 / 尾串收在 `password` `passwd` `pwd` `secret` `apikey` 与 `secret key` / `secret access key` / `api key` / `access token` 上(后两条答各自的整名词 `api_key` / `access_token`);`password_hash` / `secretName` / `passwordless` 一类不是),`isCredentialParamName` / `findUrlCredential` 读同一只 —— 带 `?db_password=` 这类参数的 URL,受理口由受理变拒。
653
654
  读点:server 7.147.0 的日志脱敏器(URL 参数 · JSON 秘密字段 · 自由文本强锚三个名字读者与诊断值位)改读它、拿返回的词去查自己的锚强度列,受理口判官与脱敏器同一版同一天翻;cli 无读点(壳零直调这组判官);client-core 无读点(只有一格探针扫本包 d.ts 的导出名,新名字不命中它的『同类键名判官』扫描式);web-admin、sdk 不读名字判定(sdk 合同测里的固定样例 `?token=` / `?api_key=` 照旧命中)。
655
+
656
+ ## 18. hook 条目的 `args` 与 `onFailure`(19.0.0 起)—— server、web-admin、cli、client-core、sdk 各自的读法
657
+
658
+ - 字段表(`classifyHooksConfig` 与 `HookEntry` 一族 zod 面的唯一声明)多两列:command 条目的可选 `args`(串数组;`[]` 与空串元素都是值,元素含 NUL 为坏)与可选 `onFailure`,http 条目的可选 `onFailure`;
659
+ 词闭集 `HOOK_ON_FAILURE_WORDS` = `continue` | `block`(包根与 `./hooks`),型 `HookOnFailure`。缺席不补缺省(CC 的缺省 = `continue`,读方自己补)。
660
+ - 此前这两个键被分类器当契约外的键剥掉(不算坏块);自此:词表外的 `onFailure`、不合形的 `args` 是坏块(非守卫事件剔那一条,守卫事件整份拒,`field` 点名它);`args` 写在别的四型上、`onFailure` 写在 prompt / agent / mcp_tool 上仍是契约外的键(剥掉,不算坏块;键下装着守卫迹象的除外 —— 那一直是整份拒)。
661
+ `rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock` 仍不承运(`docs/CC-DIVERGENCE.md` H7)。
662
+ - **承运 ≠ 执行**:本包只判形。读到 `onFailure: "block"` 的消费方要么执行它(hook 起不来 / 超时 / 退出码非 0 非 2 / 输出 JSON 非法 ⇒ 按 exit 2 阻断,同步条目、非 Stop 一族事件),要么在自己的受理面明拒 —— 静默不执行等于守卫起不来照放行。
663
+
664
+ | 消费方 | 读点 | 动作 |
665
+ |---|---|---|
666
+ | server 7.147.0 | `CommandHookEntry` / `HttpHookEntry`(`args` · `onFailure`)· `HOOK_ON_FAILURE_WORDS` | 提货同版:`onFailure` 随条目到达,`block` 的失败按 exit 2 执行;`args` 是契约字段(读它的受理面以契约字段为准) |
667
+ | cli | `CommandHookEntry` / `HttpHookEntry` · `classifyHooksConfig` | 壳若自己执行 hook(引擎属主事件 `ENGINE_OWNED_HOOK_EVENTS` 以外):执行 `args` 与 `onFailure`,或明拒;「能不能装」仍只问分类器 |
668
+ | client-core | 由 `classifyHooksConfig` 生成的读器副本 | 闭包多一个私有件 `HOOK_ON_FAILURE_ACCEPTED`(与 `HOOK_SHELLS` 同法随函数抄走),自由名仍只有 `HOOK_EVENTS`;生成器照旧整函数抄 |
669
+ | web-admin | `HookEntry` 一族的编辑面 | 可选:表单承运两列 |
670
+ | sdk | `CommandHookEntry` / `HttpHookEntry`(类型面) | 加性:多两个可选键;对 `keyof` 写穷举表的地方补两列 |
package/llms-full.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  llms-full.txt — 自包含全文 · 消费方(使用者)视角 · @sema-agent/settings-schema
3
- 重写日期: 2026-11-03 | 包版本: 18.0.0
3
+ 重写日期: 2026-11-03 | 包版本: 19.0.1
4
4
  生成方式: 无生成脚本——按当前树 src/*.ts 导出面 + package.json + README/CHANGELOG 手写事实版。
5
5
  证据约定: 每条"它怎么工作"的断言附 (文件: 符号) 坐标,刻意不用行号(行号逐版腐烂;符号名由
6
6
  typecheck 与 test/package-surface.test.ts、test/docs-hygiene.test.ts 等常驻门钉住)。无证据推断显式标【推断】。
@@ -100,7 +100,7 @@ registry:公网 npmjs,无需私有 registry 配置。
100
100
  `atMention`(11.0.0 取代 `atModelAllowlist`:`{mode:"all"}` 缺省 / `{mode:"none"}` / `{mode:"only",models}`;roster 位缺席 = 继承;
101
101
  收窄读法一只 `narrowAtMention`;旧键是墓碑字段,在场即拒)+
102
102
  档位组 `tierGroups`/`activeTierGroup`(`resolveActiveTiers` 解析)。
103
- 能力位 `reasoning?` / `vision?` 三态(S-1625):缺席 = 未声明,不再被填成 false;读者按自己的缺省。
103
+ 能力位 `reasoning?` / `vision?` 三态(13.0.0 起):缺席 = 未声明,不再被填成 false;读者按自己的缺省。
104
104
  --- 1.10.0:`ModelEntry.compat?`(`z.unknown().optional()` 解析透明,无默认;镜像引擎 `OpenAICompletionsCompat` 五键 `thinkingFormat`/`reasoningEffortLevels`/`maxTokensField`/`requiresReasoningContentOnAssistantMessages`/`supportsReasoningEffort`;形与词表校验归消费方摄入侧单点,登记在 `PARSE_TRANSPARENT_KEYS`——那张词表的属主是引擎,本包复述一份必漂;缺席不铸键)——真需求 = vLLM/Qwen 类缺省开思考的网关(`chat_template_kwargs.enable_thinking=false`),`extraBody` 被引擎保留键表拦下;唯一解析拒 = 与 `extraBody` 共用的 `vetFreeFormJson` 安全判据(secret 形键/值、访问器、循环、非 JSON、深于 `MAX_EXTRA_BODY_DEPTH`) ---
105
105
  --- 6.4.0:`ModelEntry.headers?`(`z.unknown().optional()` 解析透明,无默认;与 `compat` 同一只变换 —— 缺席不铸键,其余只过与 `compat`/`extraBody` 共用的 `vetFreeFormJson` 安全判据,拒句同形只换字段名;登记在 `PARSE_TRANSPARENT_KEYS`,`validatedBy: "consumer"`)——部署 ↔ 供应商的 per-model 附加请求头,例 `{"anthropic-beta":"context-1m-2025-08-07"}`(开 1M 上下文);头名闭集白名单 × 读它的线路 × 值形的判据**唯一属主是 sema-server**(坏声明 ⇒ 该条目整条不可用,不是丢头照常),本包刻意不做形校验(字符串 / 数组 / 大小写不规范的名 / 白名单外的名一律逐字过,由 server 判)。修前(≤6.3.0)每条读腿都剥它并报 `unknown-keys-dropped` ---
106
106
  · rosters:`RosterEntry[]`(`primaryModel`/`cheapModel` 标记角色;`ROSTER_PRIMARY_ROLES`/`ROSTER_CHEAP_ROLES`)。
@@ -175,7 +175,7 @@ registry:公网 npmjs,无需私有 registry 配置。
175
175
  `unknown-keys-dropped`(strip 域的未知键,段坐标)| `unknown-keys-carried`(open-world 域已承运的未知键)
176
176
  (6.3.0 起告警坐标一律出门前过 `redactSecrets`:秘密形键段读 `[redacted-secret]`)|
177
177
  `unread-config-file`(config.d 里永不会被读的文件)| `entry-dropped`(2.0.0,逐条容错丢掉的那一条条目,
178
- 段坐标 `["models",3]` / `["roles","summarize"]`;S-712 起可带 `identity?: { name?, id?, enabled?, nameWithheld?, idWithheld?, token? }` =
178
+ 段坐标 `["models",3]` / `["roles","summarize"]`;6.1.0 起可带 `identity?: { name?, id?, enabled?, nameWithheld?, idWithheld?, token? }` =
179
179
  被丢条目**原文**里读得出的身份(`DroppedEntryIdentity`:字符串 `name`/`id`、布尔 `enabled`,只认自有数据属性,
180
180
  类型不对 ⇒ 不带该键;是字符串但 `isDisclosableIdentity` 说不可披露 ⇒ 带 `nameWithheld` / `idWithheld: true`(11.0.0),扣下的名另带可比记号
181
181
  `token`(12.0.0,`withheldNameToken(name)` 一只铸法:稳定、不可逆)—— 判据 6.3.0 起 = 白名单闭形 `DISCLOSABLE_IDENTITY_RE`
@@ -337,10 +337,11 @@ entitlement/execution/limits = `none`;`projects` = `salvage`,整域档位仍 `"t
337
337
  MessageDisplay/DirectoryAdded/PreModelSwitch/PostModelSwitch);owner 表 `HOOK_EVENT_OWNER`(engine|shell,单属主)、`ENGINE_OWNED_HOOK_EVENTS`、
338
338
  matcher 语义表 `HOOK_EVENT_MATCHER_FIELD`(null = 无 matcher 轴)。
339
339
  - 逐事件输入形 `*HookInput`(union `HookInput`);输出:`SyncHookOutput`(exit 0 JSON;exit 2 = 阻断,stderr
340
- 作为理由/附加上下文喂回模型;其余 exit/超时/spawn 失败/坏 JSON = 非阻断故障,消费方 hook-runner 铸
340
+ 作为理由/附加上下文喂回模型;其余 exit/超时/spawn 失败/坏 JSON = 非阻断故障〔缺省 `onFailure: "continue"`;command / http 条目写 `onFailure: "block"`(19.0.0 起的契约字段)则这些失败按 exit 2 算,执行是消费方的事〕,消费方 hook-runner 铸
341
341
  `hook_non_blocking_failure` 通知帧上任务/fleet 流,stderr 先脱敏后截断 512 字)、`AsyncHookOutput`、
342
342
  决策形 `HookDecision` / `HookPermissionRequestDecision` / `HookSpecificOutput`。
343
343
  - 配置形(src/hooks-config.ts,经 `./hooks` 整体转出):`HookEntry`(`HOOK_ENTRY_TYPES` 五型 command|prompt|agent|http|mcp_tool)→ `HookMatcherEntry` → `HooksConfig`
344
+ (条目字段只有一张表,分类器、zod 面、条目类型同读它;19.0.0 起 command 条目承运 `args` —— exec 形参数表,串数组、元素零 NUL,`[]` 与空串元素合法;command / http 条目承运 `onFailure` —— 词闭集 `HOOK_ON_FAILURE_WORDS` = continue|block,型 `HookOnFailure`,缺席不补缺省;承运 ≠ 执行;这两个键的坏值是坏块;`rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock` 仍不承运)
344
345
  (`Partial<Record<HookEventName, HookMatcherEntry[]>>`,事件名闭集);三者与逐型五只 zod 面都是 `classifyHooksConfig` 的投影(受理 ⇔ loaded,
345
346
  issue = 码 + 坐标 + 坏字段名)。`classifyHooksConfig(settingsDoc)` = hooks 坏形的唯一读者:结局 `loaded`/`loaded-partial`/`rejected`;剔点五码
346
347
  `HOOKS_DROPPED_PIECE_CODES`(非守卫事件的坏块逐个剔);拒点六码 `HOOKS_REJECTION_CODES`(守卫事件 PreToolUse / PermissionRequest 任何坏处、
@@ -405,13 +406,13 @@ entitlement/execution/limits = `none`;`projects` = `salvage`,整域档位仍 `"t
405
406
  --- 4.8 fleet 契约(主 barrel / `./fleet`) ---
406
407
  - drain 协议(`DRAIN_PHASES`/`DrainSnapshot`/`drainVerdict`/`DEFAULT_DRAIN_GRACE_MS`);实例发现
407
408
  (`InstanceAnnouncement`/`InstanceRegistration`/`isInstanceStale`/`routableInstances`/`InstanceHealth`;
408
- S-741 重启信号 `RestartSignal` **定义一次** = `{ reasons: string[](≥1 个非空词), version: number(与 boot 不同的
409
+ 6.1.0 起重启信号 `RestartSignal` **定义一次** = `{ reasons: string[](≥1 个非空词), version: number(与 boot 不同的
409
410
  web-admin 配置版本,有限数,与 `readEffectiveWire` 读配置版本同一条判据), since: number(epoch ms,非负整数)}`,即 server
410
411
  `/health` 已发的形;心跳键 `InstanceAnnouncement.restart?` 引它(`InstanceRegistration` 随 extend 同带);`/health` 一侧
411
412
  `InstanceHealth` 上它不入类型(passthrough,与顶层冗余布尔 `restartRequired` 一起原样承运)。在场 ⇔ 需要重启,形里没有
412
413
  `required` 布尔。心跳每拍整行重报 ⇒ 不带它的一拍 = 不再需要,存行整替不合并;11.0.0 起重启是引擎状态,两出口只在
413
414
  `EngineSignal.restart`(`engineSignal` 键里)读:`readEngineSignal(body)?.restart`,平铺读口 `readRestartSignal` 删,两只体上平铺的
414
- `restart` 是收缩窗里的方言、不读;S-768 模型拒因同法**定义一次**,两个面:wire 形 `ModelRefusalsWire`
415
+ `restart` 是收缩窗里的方言、不读;6.2.0 起模型拒因同法**定义一次**,两个面:wire 形 `ModelRefusalsWire`
415
416
  (zod)= `{ entries: record(非空名 → 非空串), plane?: 非空串 }` + 空信号 refine(只判形律,码是开放串),读方型
416
417
  `ModelRefusalsSignal` = `{ entries: Record<条目名, ModelEntryRefusalCode>, plane?: ModelPlaneRefusalCode }`;值只码(不带上游
417
418
  id / provider / 坏字段键 / 句子);码闭集真源在本包:`MODEL_ENTRY_REFUSAL_CODES`(`config.model_no_brain` /
@@ -485,7 +486,7 @@ entitlement/execution/limits = `none`;`projects` = `salvage`,整域档位仍 `"t
485
486
  `effectiveScopeRole`/`readTokenScope`(11.0.0:缺 scope 声明 ⇒ `{refused:"scope_claim_missing"}`,不再读成 global);wire 形 `ScopesListResponse`/`ScopeSwitchRequest/Response`/
486
487
  `ScopeCreateRequest`/`ScopeMemberUpsert*`。
487
488
 
488
- --- 4.10b web-admin 凭证文件契约 + 连接 env 名表(src/web-admin-credential.ts,主 barrel;S-698) ---
489
+ --- 4.10b web-admin 凭证文件契约 + 连接 env 名表(src/web-admin-credential.ts,主 barrel;6.1.0 起) ---
489
490
  - `SEMA_WEB_ADMIN_TOKEN_FILE` 指向的文件有两种**种类**:裸行(一个静态令牌,与今天同一种文件:首行 = 静态 bearer,
490
491
  只收可打印 ASCII(首尾可见、中间可有空格);是用户 JWT 还是 worker 拉取令牌由读方用 `looksLikeJwt` 自判)与**信封** `WebAdminCredentialEnvelope`
491
492
  (`.strict()` 的 JSON 对象:`kind: "user-session"`(常量 `WEB_ADMIN_CREDENTIAL_ENVELOPE_KIND`,闭集今一员)、
@@ -497,7 +498,7 @@ entitlement/execution/limits = `none`;`projects` = `salvage`,整域档位仍 `"t
497
498
  ⇒ 只按信封读,JSON 不成立或 schema 不过 ⇒ `unreadable`(**不回落**裸行);否则裸行,bearer = 第一个 CR / LF
498
499
  之前那段,它不是令牌(含空格 / 控制 / 非 ASCII 字符)⇒ `unreadable`,绝不当 bearer 发出去。`reason` 只点信封字段名 + zod 问题码 + 未知键**个数**,从不回显文件内容。纯函数零 IO:读文件、
499
500
  写文件(tmp + rename 原子替换,mode 0600)、续签都是消费方的事。
500
- - 声明面(S-742;11.0.0 起并入一张表):`WEB_ADMIN_ENV` = 引擎连 web-admin 读的全部 env 名(`url` / `token` / `tokenFile` / `worker` / `liveUrl` / `webUrl` / `dryRun` / `adminToken` /
501
+ - 声明面(6.1.0 起;11.0.0 起并入一张表):`WEB_ADMIN_ENV` = 引擎连 web-admin 读的全部 env 名(`url` / `token` / `tokenFile` / `worker` / `liveUrl` / `webUrl` / `dryRun` / `adminToken` /
501
502
  `assertionToken` / `assertionTokenFile`,值 `SEMA_WEB_ADMIN_*`)
502
503
  (键名一处定义,管理面渲染 worker env、壳写本机引擎 env、server 读,三方 import 同一份);
503
504
  `judgeWebAdminCredentialDeclaration(env, credential)`(`credential` ∈ `WEB_ADMIN_CREDENTIALS` = `access`(`token` / `tokenFile`)|
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  <!--
2
2
  llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
3
- 重写日期: 2026-11-03 | 包版本: 18.0.0
3
+ 重写日期: 2026-11-03 | 包版本: 19.0.1
4
4
  生成方式: 无生成脚本——按当前树的 src/*.ts 导出面 + package.json + README/CHANGELOG 手写事实版;
5
5
  每条断言附证据坐标(文件:符号),刻意不用行号(行号随每版腐烂,符号名由 typecheck/test 钉住)。
6
6
  刷新触发: package.json 版号变更(test/docs-hygiene.test.ts D 组钉「包版本:」与 package.json 相等、
@@ -27,7 +27,7 @@ llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
27
27
  projects · prompts · limits · a2a(18.0.0:常驻出站 A2A 对端名册,便携;`A2aConfig` / `A2aPeerSpec`)。`runtime` 域 11.0.0 起 retired(墓碑 `RETIRED_DOMAINS`:读写遇带事实的 runtime 文档响亮拒,
28
28
  存量由一次性迁移 SS-M1 搬进 governance / limits —— `./one-time-migrations`)。(src/types.ts: `DOMAIN_SCHEMAS`)
29
29
  - **域内坏条目逐条丢**(2.0.0):一条写坏的目录条目只丢它自己,同域其余条目照常生效,并逐条发
30
- `entry-dropped` 点名(坐标形见下条;S-712 起可带 `identity?: { name?, id?, enabled? }` = 被丢条目原文里
30
+ `entry-dropped` 点名(坐标形见下条;6.1.0 起可带 `identity?: { name?, id?, enabled? }` = 被丢条目原文里
31
31
  读得出的身份,类型不对 / `isDisclosableIdentity` 说不可披露 ⇒ 不带该键;6.3.0 起身份须是白名单闭形
32
32
  `DISCLOSABLE_IDENTITY_RE` = `^[A-Za-z0-9._:/@+-]{1,256}$` 里的标识符 ∧ `redactSecrets` 原样放行;10.1.0 起每条 `entry-dropped` 还带
33
33
  `reasonCode` = 为什么丢的机读闭集词 `DROPPED_ENTRY_REASON_CODES`:`entry-schema-invalid` / `entry-key-invalid` / `entry-unreadable`,
@@ -93,7 +93,7 @@ llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
93
93
  WorkerSpec 的 `runtime.execution` / `runtime.store` 两块按这张表判(写闸 = `WorkerSpec.safeParse`,拒因在 zod issue 里);
94
94
  存量 workers 行由一次性迁移改写(6.x 行 SS-M4、15.x 行 SS-M12;`migrateStoredDocuments` / bin `npx @sema-agent/settings-schema migrate <config.d directory>`),逐行终判是读侧的 `readWorkersRows`。
95
95
  (src/execution-lanes.ts;src/types.ts: `WorkerSpec`;src/one-time-migrations.ts)
96
- - **hooks 契约**:33 个 hook 事件的全集 + owner 表 + 逐事件输入/输出形 + 配置面:hook 条目五种 type(`HOOK_ENTRY_TYPES`,含 `mcp_tool`)与**一只**
96
+ - **hooks 契约**:33 个 hook 事件的全集 + owner 表 + 逐事件输入/输出形 + 配置面:hook 条目五种 type(`HOOK_ENTRY_TYPES`,含 `mcp_tool`;19.0.0 起 command 条目承运 `args`〔exec 形参数表〕、command / http 条目承运 `onFailure`〔`HOOK_ON_FAILURE_WORDS` = continue|block,型 `HookOnFailure`;承运不是执行〕)与**一只**
97
97
  坏形分类器 `classifyHooksConfig(settingsDoc)`(非守卫事件坏块逐个剔、守卫事件 PreToolUse / PermissionRequest 任何坏处或守卫迹象 ⇒ 整份拒;码 + 坐标 + 坏字段名 `field`(坏块是匹配器 / 条目 ⇒ 它上面出问题的键,块不是对象才缺席;一块多个迹象时先该块自身的迹象(自有守卫事件键;条目自己是匹配器形取 `hooks`),再按文档序找嵌套迹象;匹配器下合形条目列表里的迹象归各条目)、零句子、零 zod 自含;
98
98
  闭包里 JS 内建之外只有一个自由名 `HOOK_EVENTS` —— 整函数抄走的生成器(client-core)须把本包运行期导出 `HOOK_EVENTS`(上游常量)注入抄本作用域,不许贴字面事件表),
99
99
  `HooksConfig` / `HookEntry` 等 zod 面是它的投影;事件与 type 两张闭集与上游的漂移由常驻门看住(上游有而本包没有的词 ⇒ 门红并点名)。http 钩子 header 里 `$VAR` / `${VAR}` 的展开也只有一只读法(名单内展开、名单外与凭据名置空并回报)。(src/hooks.ts: `HOOK_EVENTS` / `interpolateHookEnvVars`)
@@ -135,9 +135,9 @@ llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
135
135
  唯一选择读法 `promptArtifactFor`);本包镜像 artifact v3 的结构与上界,语义交引擎 verify;13.x 两轴是墓碑,存量经一次性迁移 SS-M10。
136
136
  - **界面语言设置片段**(13.0.0):`UI_LANGUAGE_SETTING`(`semaUiLanguage`,`en` / `zh`,类 `ui`,用户设置)+ `readUiLanguage`(词表外 `ok:false`,不猜)。
137
137
  (src/ui-language.ts)
138
- - **fleet 契约**(drain / 实例发现 / 派发策略 / 配额租约 / 用量上报;S-741 重启信号 `RestartSignal` 定义一次,
138
+ - **fleet 契约**(drain / 实例发现 / 派发策略 / 配额租约 / 用量上报;6.1.0 起重启信号 `RestartSignal` 定义一次,
139
139
  11.0.0 起它是引擎状态,两出口只在 `engineSignal` 里读(`readEngineSignal(body)?.restart`;平铺 `restart` 是方言、不读,平铺读口已删),在场 ⇔ 需要重启;
140
- S-768 模型拒因同法定义一次:wire 形 `ModelRefusalsWire` = `{ entries: 名 → 码, plane?: 组拒码 }`(码是开放串),
140
+ 6.2.0 起模型拒因同法定义一次:wire 形 `ModelRefusalsWire` = `{ entries: 名 → 码, plane?: 组拒码 }`(码是开放串),
141
141
  `readModelRefusals(body)` 一只读口读两出口并按闭集 `MODEL_ENTRY_REFUSAL_CODES`(2)/ `MODEL_PLANE_REFUSAL_CODES`(5)收窄成
142
142
  `ModelRefusalsSignal`,集外码 = 没说;心跳 `InstanceAnnouncement.modelRefusals?` 上形坏 / 集外码都不拖垮心跳;缺席读 `version`,
143
143
  老引擎缺席 = 不可知;8.1.0 additive:`RestartSignal.withheld?`、引擎自铸信号的闭形 `EngineSignal` + `readEngineSignal(health)`
@@ -154,11 +154,11 @@ llms.txt — 消费方(使用者)视角索引 · @sema-agent/settings-schema
154
154
  9.0.0 BREAKING:`readCenterCapabilities` 删,换三态读器 `readCapabilityReading(reply): CapabilityReading`(`declared` | `undeclared` | `unreadable`;键在场而形坏 ≠ 没宣告)、`EngineSignal.configTargetVersion` / `configAppliedVersion` 由串改数)、**scheduler-store 契约**(自唤醒
155
155
  存储形 + node 绑定)、**auth / auth-bridge / scopes / wire** 契约(RFC 8628 设备流、RS256 JWKS 鉴权桥、
156
156
  多租户 scope)。(src/fleet.ts;src/scheduler-store*.ts;src/api/*.ts)
157
- - **web-admin 凭证文件契约**(S-698):`SEMA_WEB_ADMIN_TOKEN_FILE` 的内容是裸行(首行 = bearer,只收可打印 ASCII)或
157
+ - **web-admin 凭证文件契约**(6.1.0 起):`SEMA_WEB_ADMIN_TOKEN_FILE` 的内容是裸行(首行 = bearer,只收可打印 ASCII)或
158
158
  `WebAdminCredentialEnvelope` 信封(`user-session`:access / refresh token + RFC 3339 `expiresAt` + `issuer`);
159
159
  `parseWebAdminCredentialFile(text)` 三态判别(`{` 开头只按信封读,读不成 = `unreadable`,不回落裸行);
160
160
  连接 env 名一张表 `WEB_ADMIN_ENV`(十键,值 `SEMA_WEB_ADMIN_*`)+ 二选一判官 `judgeWebAdminCredentialDeclaration(env, credential)`(凭证闭集 `WEB_ADMIN_CREDENTIALS`:
161
- `access` 读 `token` / `tokenFile`,`assertion` 读 `assertionToken` / `assertionTokenFile`;第二参必填;一对里两个都设 ⇒ throw,S-742)。
161
+ `access` 读 `token` / `tokenFile`,`assertion` 读 `assertionToken` / `assertionTokenFile`;第二参必填;一对里两个都设 ⇒ throw;二选一判官 6.1.0 起,`assertion` 一对与必填第二参 11.0.0 起)。
162
162
  (src/web-admin-credential.ts)
163
163
  - **目录形一次性迁移**(`./node`):`migrateConfigDirectory(dir, { documents, io, check? })` —— 命令行 `migrate` 背后的唯一实现(读目录 → 迁 → 整域终判 → 原子写 → 删退役域文件);`documents` = 调用方读的域名集(覆盖面外的文件不读不判不写不删),
164
164
  `io` 注入四个口,真绑定 `nodeConfigDirectoryIo`(node:fs + 唯一的原子写器);返回闭集 `unreadable` / `no-documents` / `refused` / `noop` / `pending` / `applied`。(src/config-dir-migration.ts · src/config-dir-io.ts)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sema-agent/settings-schema",
3
- "version": "18.0.0",
3
+ "version": "19.0.1",
4
4
  "description": "Sema settings schema — pure config contract (zod domains + effective-config + roster resolution + ref-integrity + remoteExec) shared by sema-web-admin, sema-server, and the TOC desktop/CLI. One source of truth. (Renamed at 1.0.0 from @sema-agent/registry-core — name and docs only, no behavior change; note the range moves 0.19.0 -> 1.0.0, so a dependency must become ^1.0.0. The old names @sema-agent/registry-core <=0.19.0 and @sema-ai/registry-core remain published, frozen, for migration.)",
5
5
  "type": "module",
6
6
  "license": "BUSL-1.1",