@sema-agent/settings-schema 19.0.0 → 20.0.0

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 (44) hide show
  1. package/CHANGELOG.md +127 -0
  2. package/README.md +36 -11
  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/c34-skills-content-vs-manifest/expected.json +0 -3
  8. package/conformance/cases/c36-skills-entry-without-content/expected.json +0 -3
  9. package/conformance/cases/c37-skills-field-null/expected.json +0 -3
  10. package/conformance/cases/c40-s712-identity-only-what-reads-out/meta.json +1 -1
  11. package/conformance/cases/c41-s792-encoded-pem-identity/meta.json +1 -1
  12. package/conformance/cases/c42-s792-unknown-key-secret-redacted/meta.json +1 -1
  13. package/conformance/cases/c43-s792-form-and-deep-encoded-pem/meta.json +1 -1
  14. package/conformance/cases/c44-s792-utf8-escape-glued-token/meta.json +1 -1
  15. package/conformance/cases/c45-s792-identity-bounds-and-decode-depth/meta.json +1 -1
  16. package/conformance/cases/c46-s811-host-name-url-userinfo-withheld/meta.json +1 -1
  17. package/conformance/cases/c47-s811-roles-key-url-userinfo-withheld/meta.json +2 -2
  18. package/conformance/cases/c48-s935-model-headers-transported/meta.json +1 -1
  19. package/conformance/cases/c49-s935-model-headers-secret-entry-dropped/meta.json +1 -1
  20. package/conformance/cases/c57-s784-g1-enabled-no-lane/meta.json +1 -1
  21. package/conformance/cases/c65-s784-pg-without-db/meta.json +1 -1
  22. package/conformance/cases/c71-one-scanner-write-reads-display-forms/meta.json +2 -2
  23. package/conformance/cases/c76-projects-entry-salvage-nested/meta.json +1 -1
  24. package/conformance/cases/c80-prompts-wire-v2-verbatim/expected.json +0 -3
  25. package/conformance/cases/c84-sandbox-git-block-carried-verbatim/expected.json +0 -3
  26. package/conformance/cases/c85-sandbox-git-refused-block-still-carried/expected.json +0 -3
  27. package/conformance/cases/t01-absent-domain-key-not-null/meta.json +1 -1
  28. package/conformance/cases/t02-entry-salvage-vs-whole-domain-refusal/meta.json +1 -1
  29. package/conformance/cases/t03-prototype-name-key-not-swallowed/meta.json +1 -1
  30. package/dist/config-fns.d.ts +5 -0
  31. package/dist/config-fns.js +16 -5
  32. package/dist/conformance/derive.d.ts +1 -1
  33. package/dist/conformance/derive.js +10 -9
  34. package/dist/hooks-config.d.ts +54 -25
  35. package/dist/hooks-config.js +82 -21
  36. package/dist/types.d.ts +75 -7
  37. package/dist/types.js +39 -2
  38. package/docs/API-SURFACE.md +22 -4
  39. package/docs/CC-DIVERGENCE.md +4 -4
  40. package/docs/CONFORMANCE.md +11 -11
  41. package/docs/CONSUMER-INTEGRATION.md +55 -8
  42. package/llms-full.txt +16 -10
  43. package/llms.txt +12 -8
  44. package/package.json +1 -1
package/dist/types.d.ts CHANGED
@@ -162,6 +162,27 @@ export declare const ModelTier: z.ZodEnum<{
162
162
  premium: "premium";
163
163
  }>;
164
164
  export type ModelTier = z.infer<typeof ModelTier>;
165
+ /** The reasoning-level words a catalog entry's {@link ModelEntry}`.thinkingLevelMap` is keyed by: `off` plus the six effort tiers. A mirror of the
166
+ * engine's `ModelThinkingLevel`, which exists only as a type — so the mirror is held at compile time by the upstream-drift gate (both directions: the
167
+ * engine adds or drops a word ⇒ `tsc` is red), not copied a second time anywhere else. The schema of the map ({@link ModelThinkingLevelMap}) mints its
168
+ * keys from this table. */
169
+ export declare const MODEL_THINKING_LEVEL_WORDS: readonly ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
170
+ /** One word of {@link MODEL_THINKING_LEVEL_WORDS}. */
171
+ export type ModelThinkingLevel = (typeof MODEL_THINKING_LEVEL_WORDS)[number];
172
+ /** A catalog entry's per-level wire values — the engine's `Model.thinkingLevelMap`. Every key is optional, the key set is CLOSED
173
+ * ({@link MODEL_THINKING_LEVEL_WORDS}), and an unknown key refuses the whole map (`.strict()`): a misspelt level name is not stripped, because
174
+ * stripping "this level cannot be turned off" reads as "this level behaves as usual". The refusal lands on the entry that carries the map (the schema
175
+ * face: a bad form is a bad entry), not on this object alone. */
176
+ export declare const ModelThinkingLevelMap: z.ZodObject<{
177
+ off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
178
+ minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
179
+ low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
180
+ medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
181
+ high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
182
+ xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
183
+ max: z.ZodOptional<z.ZodNullable<z.ZodString>>;
184
+ }, z.core.$strict>;
185
+ export type ModelThinkingLevelMap = z.infer<typeof ModelThinkingLevelMap>;
165
186
  export declare const ModelEntry: z.ZodObject<{
166
187
  name: z.ZodString;
167
188
  id: z.ZodString;
@@ -185,6 +206,15 @@ export declare const ModelEntry: z.ZodObject<{
185
206
  }>>;
186
207
  reasoning: z.ZodOptional<z.ZodBoolean>;
187
208
  vision: z.ZodOptional<z.ZodBoolean>;
209
+ thinkingLevelMap: z.ZodOptional<z.ZodObject<{
210
+ off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
211
+ minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
212
+ low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
213
+ medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
214
+ high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
215
+ xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
216
+ max: z.ZodOptional<z.ZodNullable<z.ZodString>>;
217
+ }, z.core.$strict>>;
188
218
  contextWindow: z.ZodOptional<z.ZodNumber>;
189
219
  maxTokens: z.ZodOptional<z.ZodNumber>;
190
220
  autoCompactTokens: z.ZodOptional<z.ZodNumber>;
@@ -298,6 +328,15 @@ export declare const ModelsConfig: z.ZodObject<{
298
328
  }>>;
299
329
  reasoning: z.ZodOptional<z.ZodBoolean>;
300
330
  vision: z.ZodOptional<z.ZodBoolean>;
331
+ thinkingLevelMap: z.ZodOptional<z.ZodObject<{
332
+ off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
333
+ minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
334
+ low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
335
+ medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
336
+ high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
337
+ xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
338
+ max: z.ZodOptional<z.ZodNullable<z.ZodString>>;
339
+ }, z.core.$strict>>;
301
340
  contextWindow: z.ZodOptional<z.ZodNumber>;
302
341
  maxTokens: z.ZodOptional<z.ZodNumber>;
303
342
  autoCompactTokens: z.ZodOptional<z.ZodNumber>;
@@ -1446,8 +1485,8 @@ export declare const WorkerSpec: z.ZodObject<{
1446
1485
  }>>;
1447
1486
  memory: z.ZodPrefault<z.ZodObject<{
1448
1487
  engine: z.ZodDefault<z.ZodEnum<{
1449
- on: "on";
1450
1488
  off: "off";
1489
+ on: "on";
1451
1490
  }>>;
1452
1491
  backend: z.ZodDefault<z.ZodEnum<{
1453
1492
  file: "file";
@@ -1607,8 +1646,8 @@ export declare const WorkersConfig: z.ZodObject<{
1607
1646
  }>>;
1608
1647
  memory: z.ZodPrefault<z.ZodObject<{
1609
1648
  engine: z.ZodDefault<z.ZodEnum<{
1610
- on: "on";
1611
1649
  off: "off";
1650
+ on: "on";
1612
1651
  }>>;
1613
1652
  backend: z.ZodDefault<z.ZodEnum<{
1614
1653
  file: "file";
@@ -1943,7 +1982,8 @@ export declare const A2aPeerSpec: z.ZodObject<{
1943
1982
  enabled: z.ZodDefault<z.ZodBoolean>;
1944
1983
  }, z.core.$strip>;
1945
1984
  export type A2aPeerSpec = z.infer<typeof A2aPeerSpec>;
1946
- /** `a2a` 域:常驻出站 A2A 对端名册。空 / 缺席 = 不拨任何对端。对端名唯一(重名拒,同 mcp)。 */
1985
+ /** `a2a` 域:常驻出站 A2A 对端名册。空名册 = 不拨任何对端;文档缺席(店 / `config.d`)读作空名册。对端名唯一(重名拒,同 mcp)。
1986
+ * 线上(`GET /effective`)缺席不是空名册:读口不补,{@link EffectiveWire} 上 `a2a` 缺席 = 生产方没发这个域(它的契约早于本域),见 {@link WIRE_CARRIED_DOMAINS}。 */
1947
1987
  export declare const A2aConfig: z.ZodObject<{
1948
1988
  peers: z.ZodPrefault<z.ZodArray<z.ZodObject<{
1949
1989
  name: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
@@ -2401,6 +2441,15 @@ export declare const DOMAIN_SCHEMAS: {
2401
2441
  }>>;
2402
2442
  reasoning: z.ZodOptional<z.ZodBoolean>;
2403
2443
  vision: z.ZodOptional<z.ZodBoolean>;
2444
+ thinkingLevelMap: z.ZodOptional<z.ZodObject<{
2445
+ off: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2446
+ minimal: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2447
+ low: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2448
+ medium: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2449
+ high: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2450
+ xhigh: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2451
+ max: z.ZodOptional<z.ZodNullable<z.ZodString>>;
2452
+ }, z.core.$strict>>;
2404
2453
  contextWindow: z.ZodOptional<z.ZodNumber>;
2405
2454
  maxTokens: z.ZodOptional<z.ZodNumber>;
2406
2455
  autoCompactTokens: z.ZodOptional<z.ZodNumber>;
@@ -2718,8 +2767,8 @@ export declare const DOMAIN_SCHEMAS: {
2718
2767
  }>>;
2719
2768
  memory: z.ZodPrefault<z.ZodObject<{
2720
2769
  engine: z.ZodDefault<z.ZodEnum<{
2721
- on: "on";
2722
2770
  off: "off";
2771
+ on: "on";
2723
2772
  }>>;
2724
2773
  backend: z.ZodDefault<z.ZodEnum<{
2725
2774
  file: "file";
@@ -3157,7 +3206,8 @@ export interface EffectiveConfig {
3157
3206
  /** cost/限流族的热更新发布位(0.19.0,消费方 #322 批1)。域缺席 ⇒ `{}`(每一键都 ABSENT =
3158
3207
  * web-admin 不管 ⇒ 消费方回 env 底);11.0.0 起五个限额键的唯一位。 */
3159
3208
  limits: LimitsConfig;
3160
- /** 常驻出站 A2A 对端名册(18.0.0)。域缺席 ⇒ `{ peers: [] }`(缺席 ≡ 空表:不拨任何对端);header 值只以 env-NAME 引用出现,读方从自己的环境取值。 */
3209
+ /** 常驻出站 A2A 对端名册(18.0.0)。读店 / `config.d` 时文档缺席 ⇒ `{ peers: [] }`(读者即本包,恒懂此域:没写 = 不拨任何对端);header 值只以 env-NAME 引用出现,
3210
+ * 读方从自己的环境取值。线上读形不在此列:{@link EffectiveWire} 上的 `a2a` 是可选的(缺席 = 生产方没发,20.0.0 起不补空名册)。 */
3161
3211
  a2a: A2aConfig;
3162
3212
  }
3163
3213
  /** One provenance source in a key's resolution trail. Two orthogonal axes: the TOC file LAYER, or the TOB
@@ -3261,12 +3311,30 @@ export type EffectiveKey = z.infer<typeof EffectiveKey>;
3261
3311
  * gate is closed), never the storage shape.
3262
3312
  * `sandboxGit` (14.7.0) is the third wire-only key and the third carried verbatim: the sandbox git plane's origin block — web-admin projects it from the
3263
3313
  * deployment's registry, it is NOT a stored domain, so `buildEffective` never produces it and `readEffectiveWire` neither validates nor drops it. Optional with
3264
- * no default (absent = the deployment projects no such block); the ONE seat that judges it is `SandboxGitConfig` (`./sandbox-git`), run by the consumer before use. */
3265
- export type EffectiveWire = Omit<EffectiveConfig, "skills" | "prompts"> & {
3314
+ * no default (absent = the deployment projects no such block); the ONE seat that judges it is `SandboxGitConfig` (`./sandbox-git`), run by the consumer before use.
3315
+ * `a2a` (20.0.0) is optional here too: the wire reader never fabricates a domain the producer did not send — {@link WIRE_CARRIED_DOMAINS} is the one table of
3316
+ * domains carried by presence (absent on the wire ⇒ absent here; a producer whose contract predates the domain does not send it), every other domain is
3317
+ * sent by every supported producer and reads as the contract default when absent. */
3318
+ export type EffectiveWire = Omit<EffectiveConfig, "skills" | WireCarriedDomain> & {
3266
3319
  skills: SkillsManifest;
3267
3320
  prompts?: unknown;
3268
3321
  sandboxGit?: unknown;
3322
+ } & {
3323
+ [K in Exclude<WireCarriedDomain, "prompts">]?: EffectiveConfig[K];
3269
3324
  };
3325
+ /**
3326
+ * **线上读口不编造生产方没发的域**(20.0.0)—— 按在场性承运的域的唯一一张表。表里的域在 `GET /effective` 载荷上缺席 ⇒ `readEffectiveWire` 的读出形里
3327
+ * 同样缺席({@link EffectiveWire} 上可选:缺席 = 生产方没发这个域,它的契约早于本域,或它刻意不发);在场 ⇒ 照该域既有读法。在场判据只有一个:
3328
+ * 载荷的**自有键,且值不是 `undefined`**(与 `parseDomain`「只有 undefined 是缺席」同律 —— JSON 载荷里没有 undefined,嵌入方传的 `undefined` 与没写同读)。
3329
+ * · `prompts`:线上形是发布形 {@link EffectivePromptsWire},读口原样承运、由消费方判(发布闸关 / 没有发布 = 不发,缺席是常态形);
3330
+ * · `a2a`:在场 ⇒ 照域读法(解析、逐条抢救、整域读不进 ⇒ `{ peers: [] }` + `domain-defaulted`)。缺席 ≠ 空名册 —— 18.0.0 之前的生产方不懂此域,不发它;
3331
+ * 18.0.0 起 `buildEffective` 恒物化 a2a,所以 ≥ 18.0.0 的中心恒发(没存文档也发 `{ peers: [] }`):线上缺席 ⇔ 生产方不懂此域。
3332
+ * 不在表里的域在 1.0.0 起就在域表上,支持面内的每个生产方都恒发;线上缺席读作契约缺省(与读店同一份缺省)。**之后加进域表的域进这张表**:
3333
+ * 比它旧的生产方必不发它,物化它就是替生产方编造一份「说了空」。读店 / 读 `config.d`(`EffectiveConfig`)不在本律内:那两腿的读者就是本包,恒懂每个域。
3334
+ */
3335
+ export declare const WIRE_CARRIED_DOMAINS: readonly ["prompts", "a2a"];
3336
+ /** {@link WIRE_CARRIED_DOMAINS} 的成员。 */
3337
+ export type WireCarriedDomain = (typeof WIRE_CARRIED_DOMAINS)[number];
3270
3338
  /** Reserved audit "domain" for RBAC/user-management events (not a config domain → no snapshot, not
3271
3339
  * rollback-able). Lets user changes share the one audit stream the Audit page already renders. */
3272
3340
  export declare const RBAC_AUDIT = "rbac";
package/dist/types.js CHANGED
@@ -479,6 +479,21 @@ export const PARSE_TRANSPARENT_KEYS = [
479
479
  * places that name it (`ModelEntry.tier`, `RoleTarget.select.tier`). Not the tier-group ladder of {@link TierBindings}
480
480
  * (`ultra` … `lite`), which binds model NAMES to rungs. */
481
481
  export const ModelTier = z.enum(["cheap", "standard", "premium"]);
482
+ /** The reasoning-level words a catalog entry's {@link ModelEntry}`.thinkingLevelMap` is keyed by: `off` plus the six effort tiers. A mirror of the
483
+ * engine's `ModelThinkingLevel`, which exists only as a type — so the mirror is held at compile time by the upstream-drift gate (both directions: the
484
+ * engine adds or drops a word ⇒ `tsc` is red), not copied a second time anywhere else. The schema of the map ({@link ModelThinkingLevelMap}) mints its
485
+ * keys from this table. */
486
+ export const MODEL_THINKING_LEVEL_WORDS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
487
+ /** What a deployment says one level is called on the wire: a non-empty string = the provider's own value for that level; `null` = this level is not
488
+ * supported on this model. (A level with no key at all = the provider's default. The empty string is not a value — it would put an empty effort on the wire.) */
489
+ const ThinkingLevelSpelling = z.string().min(1).nullable();
490
+ /** A catalog entry's per-level wire values — the engine's `Model.thinkingLevelMap`. Every key is optional, the key set is CLOSED
491
+ * ({@link MODEL_THINKING_LEVEL_WORDS}), and an unknown key refuses the whole map (`.strict()`): a misspelt level name is not stripped, because
492
+ * stripping "this level cannot be turned off" reads as "this level behaves as usual". The refusal lands on the entry that carries the map (the schema
493
+ * face: a bad form is a bad entry), not on this object alone. */
494
+ export const ModelThinkingLevelMap = z
495
+ .object(Object.fromEntries(MODEL_THINKING_LEVEL_WORDS.map((word) => [word, ThinkingLevelSpelling.optional()])))
496
+ .strict();
482
497
  export const ModelEntry = z.object({
483
498
  /** Catalog key + `@name` mention handle (stable, url/word-safe), e.g. "model-a". */
484
499
  name: z.string().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/i, "letters/digits/._- , no spaces"),
@@ -507,6 +522,16 @@ export const ModelEntry = z.object({
507
522
  * absent bit in: reading "not written" as "not capable" is a default only a reader may choose. */
508
523
  reasoning: z.boolean().optional(),
509
524
  vision: z.boolean().optional(),
525
+ /** Per-level wire values for the reasoning knob — the engine's `Model.thinkingLevelMap` (keys {@link MODEL_THINKING_LEVEL_WORDS}; a string is the
526
+ * provider's own value for that level, `null` marks the level unsupported on this model, a missing key = the provider's default). Real need: a
527
+ * deployment on an `anthropic-messages` wire where some level cannot be turned off, or goes by another name — the catalog entry is the seat
528
+ * that declares it; without this key the declaration is stripped at parse on every read leg and never reaches the consumer.
529
+ * THREE-STATE like the capability bits above: ABSENT = not declared (this package never mints `{}`), `{}` = declared with no overrides.
530
+ * **A bad form refuses the WHOLE entry** — an unknown key, a non-object, an empty-string value, a value that is neither a string nor `null`:
531
+ * nothing is stripped and nothing is defaulted (the read legs drop the entry with `entry-dropped` and the rest of the catalog stands as long as the entry is not referenced; an entry that is REFERENCED — named by `roles`, by `atMention.models` in mode `only`, or by `tierGroups[].tiers` — leaves that reference dangling once dropped, and the existing dangling-reference law defaults the WHOLE `models` domain: `domain-defaulted` only, the catalog reads empty, siblings go with it, no `entry-dropped` (any bad referenced entry gets this answer; 19.0.x loaded such an entry and only stripped the key). When no entry of the catalog survives, the existing zero-survivor law gives the same outcome; the document-face read throws; the write gate refuses it). This is the schema
532
+ * face's rule for a closed vocabulary, unlike `compat`'s parse-transparent carry. What each value means on the wire is the reading
533
+ * consumer's call; this package only carries the declaration. */
534
+ thinkingLevelMap: ModelThinkingLevelMap.optional(),
510
535
  contextWindow: INTEGER.positive().optional(),
511
536
  maxTokens: INTEGER.positive().optional(),
512
537
  /** Auto-compaction trigger threshold (tokens) for this model — web-admin 显式下发时本地 FileConfigStore
@@ -2744,7 +2769,8 @@ export const A2aPeerSpec = z.object({
2744
2769
  scenarios: z.array(z.string().min(1)).prefault([]),
2745
2770
  enabled: z.boolean().default(true),
2746
2771
  });
2747
- /** `a2a` 域:常驻出站 A2A 对端名册。空 / 缺席 = 不拨任何对端。对端名唯一(重名拒,同 mcp)。 */
2772
+ /** `a2a` 域:常驻出站 A2A 对端名册。空名册 = 不拨任何对端;文档缺席(店 / `config.d`)读作空名册。对端名唯一(重名拒,同 mcp)。
2773
+ * 线上(`GET /effective`)缺席不是空名册:读口不补,{@link EffectiveWire} 上 `a2a` 缺席 = 生产方没发这个域(它的契约早于本域),见 {@link WIRE_CARRIED_DOMAINS}。 */
2748
2774
  export const A2aConfig = z
2749
2775
  .object({ peers: z.array(A2aPeerSpec).prefault([]) })
2750
2776
  .superRefine((cfg, ctx) => {
@@ -3009,7 +3035,7 @@ export const DOMAIN_SCHEMAS = {
3009
3035
  projects: ProjectsConfig, // 0.10.0: 142-S3 project identity ledger + 无仓铸造权威 (scope=tenant 轴; NOT portable — 租户身份数据)
3010
3036
  prompts: PromptsConfig, // 0.10.18 起;14.0.0 单轴:中心 artifact 的身份(`{ artifact?, workers? }`);13.x 两轴的键是墓碑(SS-M10)
3011
3037
  limits: LimitsConfig, // 0.19.0: cost/限流族热更新发布位(消费方 #322 批1;本地腿闭集缺口的源头修复)
3012
- a2a: A2aConfig, // 18.0.0: 常驻出站 A2A 对端名册(便携;本地腿 config.d/a2a.json 与中心腿 /effective.a2a 同一个声明座)
3038
+ a2a: A2aConfig, // 18.0.0: 常驻出站 A2A 对端名册(便携;本地腿 config.d/a2a.json 与中心腿 /effective.a2a 同一个声明座;线上按在场性承运,见 WIRE_CARRIED_DOMAINS)
3013
3039
  // integrations + access: DELETED in 0.6.0 (EXPERT-REDESIGN §9) — parseDomain/effective/路由随之 404。
3014
3040
  };
3015
3041
  // ── Effective-config PROVENANCE (the unified shape TOC `sema config --effective` and TOB `/effective?principal=`
@@ -3040,6 +3066,17 @@ export const EffectiveKey = z.object({
3040
3066
  lockBehavior: z.enum(["locked", "advisory", "forced-off", "tighten-only"]).optional(),
3041
3067
  sources: z.array(SettingSource).optional(),
3042
3068
  });
3069
+ /**
3070
+ * **线上读口不编造生产方没发的域**(20.0.0)—— 按在场性承运的域的唯一一张表。表里的域在 `GET /effective` 载荷上缺席 ⇒ `readEffectiveWire` 的读出形里
3071
+ * 同样缺席({@link EffectiveWire} 上可选:缺席 = 生产方没发这个域,它的契约早于本域,或它刻意不发);在场 ⇒ 照该域既有读法。在场判据只有一个:
3072
+ * 载荷的**自有键,且值不是 `undefined`**(与 `parseDomain`「只有 undefined 是缺席」同律 —— JSON 载荷里没有 undefined,嵌入方传的 `undefined` 与没写同读)。
3073
+ * · `prompts`:线上形是发布形 {@link EffectivePromptsWire},读口原样承运、由消费方判(发布闸关 / 没有发布 = 不发,缺席是常态形);
3074
+ * · `a2a`:在场 ⇒ 照域读法(解析、逐条抢救、整域读不进 ⇒ `{ peers: [] }` + `domain-defaulted`)。缺席 ≠ 空名册 —— 18.0.0 之前的生产方不懂此域,不发它;
3075
+ * 18.0.0 起 `buildEffective` 恒物化 a2a,所以 ≥ 18.0.0 的中心恒发(没存文档也发 `{ peers: [] }`):线上缺席 ⇔ 生产方不懂此域。
3076
+ * 不在表里的域在 1.0.0 起就在域表上,支持面内的每个生产方都恒发;线上缺席读作契约缺省(与读店同一份缺省)。**之后加进域表的域进这张表**:
3077
+ * 比它旧的生产方必不发它,物化它就是替生产方编造一份「说了空」。读店 / 读 `config.d`(`EffectiveConfig`)不在本律内:那两腿的读者就是本包,恒懂每个域。
3078
+ */
3079
+ export const WIRE_CARRIED_DOMAINS = ["prompts", "a2a"];
3043
3080
  /** Reserved audit "domain" for RBAC/user-management events (not a config domain → no snapshot, not
3044
3081
  * rollback-able). Lets user changes share the one audit stream the Audit page already renders. */
3045
3082
  export const RBAC_AUDIT = "rbac";
@@ -4,9 +4,9 @@
4
4
  > 每次全量重算并逐名比对 —— 加 / 删 / 改形一个导出而不重生成本档 ⇒ 红。导出面的每次变动因此以本档的 diff 出现在评审里。
5
5
  > 形:`value` = 运行期拿得到的值;`type` = 只在类型层;`value+type` = 同名的值与类型(zod schema 与它推出的类型)。
6
6
 
7
- 子路径 24 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1501 个(同名在多条子路径上各计一次)。
7
+ 子路径 24 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1519 个(同名在多条子路径上各计一次)。
8
8
 
9
- ## `.`(785)
9
+ ## `.`(794)
10
10
 
11
11
  - `A2aConfig` — value+type
12
12
  - `A2aPeerSpec` — value+type
@@ -210,6 +210,8 @@
210
210
  - `HOOKS_CLASSIFICATION_OUTCOMES` — value
211
211
  - `HOOKS_DROPPED_PIECE_CODES` — value
212
212
  - `HOOKS_REJECTION_CODES` — value
213
+ - `HOOK_CLOUD_WORDS` — value
214
+ - `HOOK_ENTRY_FIELDS` — value
213
215
  - `HOOK_ENTRY_TYPES` — value
214
216
  - `HOOK_EVENTS` — value
215
217
  - `HOOK_EVENT_MATCHER_FIELD` — value
@@ -222,8 +224,10 @@
222
224
  - `HTTP_URL_PARTS` — value
223
225
  - `HTTP_URL_SHAPE_RULE` — value
224
226
  - `HeldWorkerRow` — type
227
+ - `HookCloud` — type
225
228
  - `HookDecision` — value+type
226
229
  - `HookEntry` — value+type
230
+ - `HookEntryFields` — type
227
231
  - `HookEntryType` — type
228
232
  - `HookEnvBlank` — type
229
233
  - `HookEnvInterpolation` — type
@@ -289,6 +293,7 @@
289
293
  - `MODEL_ENTRY_REFUSAL_CODES` — value
290
294
  - `MODEL_PLANE_REFUSAL_CODES` — value
291
295
  - `MODEL_SWITCH_SOURCES` — value
296
+ - `MODEL_THINKING_LEVEL_WORDS` — value
292
297
  - `MarkedMigrationId` — type
293
298
  - `McpConfig` — value+type
294
299
  - `McpContentOrigin` — type
@@ -318,6 +323,8 @@
318
323
  - `ModelRefusalsSignal` — type
319
324
  - `ModelRefusalsWire` — value+type
320
325
  - `ModelRole` — value+type
326
+ - `ModelThinkingLevel` — type
327
+ - `ModelThinkingLevelMap` — value+type
321
328
  - `ModelTier` — value+type
322
329
  - `ModelsConfig` — value+type
323
330
  - `NON_SECRET_URL` — value
@@ -588,6 +595,7 @@
588
595
  - `WEB_ADMIN_CREDENTIAL_ENVELOPE_KIND` — value
589
596
  - `WEB_ADMIN_ENV` — value
590
597
  - `WEB_ADMIN_JWKS_PATH` — value
598
+ - `WIRE_CARRIED_DOMAINS` — value
591
599
  - `WORKER_NAME` — value
592
600
  - `WORKER_PULL_TOKEN` — value
593
601
  - `WORKER_RESOURCE_PRESETS` — value
@@ -603,6 +611,7 @@
603
611
  - `WebAdminJwk` — value+type
604
612
  - `WebAdminJwks` — value+type
605
613
  - `WebAdminSessionTarget` — type
614
+ - `WireCarriedDomain` — type
606
615
  - `WorkerCondition` — value+type
607
616
  - `WorkerLifecycle` — value+type
608
617
  - `WorkerLifecycleRecord` — type
@@ -794,7 +803,7 @@
794
803
  - `workersReferencingSecret` — value
795
804
  - `wsUrlFlaws` — value
796
805
 
797
- ## `./types`(150)
806
+ ## `./types`(155)
798
807
 
799
808
  - `A2aConfig` — value+type
800
809
  - `A2aPeerSpec` — value+type
@@ -850,6 +859,7 @@
850
859
  - `K8S_QUANTITY` — value
851
860
  - `LimitsConfig` — value+type
852
861
  - `MCP_CONTENT_ORIGINS` — value
862
+ - `MODEL_THINKING_LEVEL_WORDS` — value
853
863
  - `McpConfig` — value+type
854
864
  - `McpContentOrigin` — type
855
865
  - `McpServerSpec` — value+type
@@ -857,6 +867,8 @@
857
867
  - `ModelCost` — value
858
868
  - `ModelEntry` — value+type
859
869
  - `ModelRole` — value+type
870
+ - `ModelThinkingLevel` — type
871
+ - `ModelThinkingLevelMap` — value+type
860
872
  - `ModelTier` — value+type
861
873
  - `ModelsConfig` — value+type
862
874
  - `NON_SECRET_URL` — value
@@ -926,8 +938,10 @@
926
938
  - `TierBindings` — value+type
927
939
  - `TierGroup` — value+type
928
940
  - `TokenQuota` — value+type
941
+ - `WIRE_CARRIED_DOMAINS` — value
929
942
  - `WORKER_NAME` — value
930
943
  - `WORKER_RESOURCE_PRESETS` — value
944
+ - `WireCarriedDomain` — type
931
945
  - `WorkerCondition` — value+type
932
946
  - `WorkerLifecycle` — value+type
933
947
  - `WorkerResourcePreset` — type
@@ -1289,7 +1303,7 @@
1289
1303
  - `parseSchedulerStore` — value
1290
1304
  - `serializeSchedulerStore` — value
1291
1305
 
1292
- ## `./hooks`(96)
1306
+ ## `./hooks`(100)
1293
1307
 
1294
1308
  - `AgentHookEntry` — value+type
1295
1309
  - `AssistantTurnError` — value+type
@@ -1311,14 +1325,18 @@
1311
1325
  - `HOOKS_CLASSIFICATION_OUTCOMES` — value
1312
1326
  - `HOOKS_DROPPED_PIECE_CODES` — value
1313
1327
  - `HOOKS_REJECTION_CODES` — value
1328
+ - `HOOK_CLOUD_WORDS` — value
1329
+ - `HOOK_ENTRY_FIELDS` — value
1314
1330
  - `HOOK_ENTRY_TYPES` — value
1315
1331
  - `HOOK_EVENTS` — value
1316
1332
  - `HOOK_EVENT_MATCHER_FIELD` — value
1317
1333
  - `HOOK_EVENT_OWNER` — value
1318
1334
  - `HOOK_INJECTED_ENV` — value
1319
1335
  - `HOOK_ON_FAILURE_WORDS` — value
1336
+ - `HookCloud` — type
1320
1337
  - `HookDecision` — value+type
1321
1338
  - `HookEntry` — value+type
1339
+ - `HookEntryFields` — type
1322
1340
  - `HookEntryType` — type
1323
1341
  - `HookEnvBlank` — type
1324
1342
  - `HookEnvInterpolation` — type
@@ -1,14 +1,14 @@
1
1
  # CC 偏离登记(本包)
2
2
 
3
3
  本包镜像或对齐 Claude Code(CC)上游的设置语义时,**有意**不照抄的地方逐条登在这里:差在哪(CC 原形与语料坐标 / 本包的形)、哪个方向、为什么、谁读它。
4
- 锚 = CC 2.1.296 语料 `cli296.js`(只 grep,不解包;坐标写行号,行号属于那一份语料,只引不抄);H7 的两个新进字段另引 `cli309.js` 的坐标。
4
+ 锚 = CC 2.1.296 语料 `cli296.js`(只 grep,不解包;坐标写行号,行号属于那一份语料,只引不抄);H7 的条目字段另引 `cli309.js` 的坐标。
5
5
 
6
6
  方向只有两种写法:**更严**(本包拦下 / 不放行 / 不装 CC 会放行或会装的)与**更宽**(本包拦下 CC 不拦的 —— 只出现在拒绝方向)。
7
7
  本包不登「比 CC 更松」的偏离;出现了即是缺陷。
8
8
 
9
9
  ## hooks classifier(`classifyHooksConfig`,`src/hooks-config.ts`)
10
10
 
11
- 七处都只在**更严**的方向上:CC 会装上的文档,这里可能整份不装;反过来的情形不存在。代价都是同一个 —— 一份本可装上的设置文件整份不装(同文件的 `permissions.deny` 一起不生效),所以每条都写了它挡的是什么。
11
+ 这七处都只在**更严**的方向上:CC 会装上的文档,这里可能整份不装;反过来的情形在这七处里不存在(登记表之外的更松面是缺陷,不登在这里,见 CHANGELOG 20.0.0 的已知限制)。代价都是同一个 —— 一份本可装上的设置文件整份不装(同文件的 `permissions.deny` 一起不生效),所以每条都写了它挡的是什么。
12
12
 
13
13
  | # | 本包 | CC 2.1.296 | 为什么 |
14
14
  |---|---|---|---|
@@ -18,9 +18,9 @@
18
18
  | H4 | 已知非守卫事件的值写成一只匹配器(不是数组)⇒ 整份拒 | 剔掉那个键(警告) | 匹配器形本身就是迹象(规则一条,不因事件名分档) |
19
19
  | H5 | 整份文档本身写成一只匹配器(顶层带 `matcher` 键 + 匹配器形)⇒ 整份拒 | 无此判 | 把一只守卫匹配器误贴成整份设置时,CC 剔掉坏的 `hooks` 后照装 |
20
20
  | H6 | `hooks` 是装着**数组**的数组 ⇒ 整份拒(与装对象同判) | 只对装对象 / 装迹象的数组整份拒,装数组的剔掉 | 套一层数组的守卫不该被当成标量剔掉 |
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) —— 未闭环 |
21
+ | H7 | 条目字段以本包字段表为准(`HOOK_ENTRY_FIELDS`),CC 五型条目 schema 上的每个键都在表里(`cli309.js:252382`):`args`(command;exec 形参数表,元素另判零 NUL —— `spawn()` 对含 NUL 的参数抛,CC 的串数组不判)· `onFailure`(command / http;词表 `HOOK_ON_FAILURE_WORDS` = `continue` \| `block`;缺席不补缺省)· `rewakeMessage` / `rewakeSummary`(command;非空串 —— CC 的 `min(1)`,空白 / 多行 / NUL 都是值)· `cloud`(command / http;**任意值照带** —— CC 的 `.catch("skip")` 没有坏值,词表 `HOOK_CLOUD_WORDS` = `device` \| `skip` 只是读者折法的参考)· `continueOnBlock`(prompt;布尔)。`args` / `onFailure` / `rewakeMessage` / `rewakeSummary` / `continueOnBlock` 的坏值一律是坏块(不剥键、不折默认);写在 CC 的 schema 没有它的型上、或 CC 不认识的键,仍是契约外的键(剥掉,不算坏块;键下装着守卫迹象的除外:H3,整份拒) | 认得这些字段,逐键同归属型(`cli309.js:252382`:`args` 只在 command,`onFailure` 与 `cloud` 在 command 与 http,`rewakeMessage` / `rewakeSummary` 只在 command,`continueOnBlock` 只在 prompt);`cloud` 的任何值都合法 | 契约只收本包定义的字段;`args` / `onFailure` 19.0.0 起进表、另四键 20.0.0 起进表(此前被剥掉:exec 形条目只剩可执行名去跑,`block` 的守卫起不来照放行,守卫事件里 `rewakeMessage: ""` / 非布尔 `continueOnBlock` 照装 —— 比 CC 松,这一条随 20.0.0 收了);字段级的上游漂移今天没有门(type 集有,见漂移门 ①b)—— 未闭环 |
22
22
 
23
- 不是偏差的(与 CC 同):守卫事件集 {`PreToolUse`, `PermissionRequest`};守卫事件值 `null` = 剔不拒;非守卫事件里坏匹配器 / 坏条目逐个剔;hook 条目 type 五种。
23
+ 不是偏差的(与 CC 同):守卫事件集 {`PreToolUse`, `PermissionRequest`};守卫事件值 `null` = 剔不拒;非守卫事件里坏匹配器 / 坏条目逐个剔;hook 条目 type 五种;command / http 条目的 `cloud` 任意值照带(CC 的 `.catch("skip")` 接住任何值、读作 `skip`、文件照装,折在读者;本包不判、不折、不剥)。
24
24
 
25
25
  ## URL 名单与 http hook 名单(`src/url-pattern.ts` / `src/http-hook-allowlists.ts`)
26
26
 
@@ -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 已同批更新)。
@@ -215,7 +215,7 @@ sema-test 的读数,是本仓自己重跑 `node scripts/conformance-historical.m
215
215
 
216
216
  | id | 影响的腿 | 动了什么 |
217
217
  |---|---|---|
218
- | `T1-prompts-materialisation` | wire | `buildEffective` 恒物化 `prompts`(缺席 ⇒ `{}`;14.0.0 前是 `{bindings:[]}`);wire 按**在场性** verbatim 挂回(缺席进缺席出,且在场时是**未解析的原文档**) |
218
+ | `T1-wire-carried-domains` | wire | `buildEffective` 恒物化每个域;wire 对承运表 `WIRE_CARRIED_DOMAINS`(`prompts`、`a2a`)按**在场性**挂回 —— 线上读口不编造生产方没发的域:缺席进缺席出;在场时 `prompts` 是**未解析的原文档**,`a2a` 是域腿读数。**由常量派生,不手抄域名**;覆盖律要求表里每个域都有语料让两腿在它上面真的分开 |
219
219
  | `T2-skills-representation` | wire | 域形带 `content`,wire 形带 `contentHash`(manifest);判据 schema 随表示走,于是 wire 腿**没有** skills 的剥键告警 |
220
220
  | `T3-non-portable-domains` | local-root | `config.d/` 只读 `PORTABLE_DOMAINS`;其余域取 schema 默认 + `unread-config-file{non-portable-domain}`。**由常量派生,不手抄域名** |
221
221
  | `T4-unknown-top-level-key` | wire + local-root | wire 是 open-world,不认识的顶层键**逐字承运**;`domains` 腿按域名取文档故无声;local-root 报 `unread-config-file{not-a-domain}` |
@@ -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。
@@ -13,6 +13,7 @@
13
13
  > **17.2.0** 的 settings 单元读不进处置律在 §15,`./node` 的同步读写口(`config.d` 文档读数、决定文档读 / 写)与根桶的「显式停用」谓词在 §16。
14
14
  > **18.0.0** 的车道词 `none`、`REQUIRE_EXECUTION_LANE` 墓碑、车道集单一判官 `laneSetFlaws` 与便携新域 `a2a` 在 §17。
15
15
  > **19.0.0** 的 hook 条目字段 `args`(exec 形参数表)与 `onFailure`(失败按放行还是阻断)在 §18。
16
+ > **20.0.0** 的 hook 条目余下四个 CC 键(`rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock`)与词闭集 `HOOK_CLOUD_WORDS` 同在 §18;**20.0.0** 的目录条目 `thinkingLevelMap`(词表 `MODEL_THINKING_LEVEL_WORDS`)与运行期导出 `HOOK_ENTRY_FIELDS` 在 §19;**20.0.0** 的线上读口承运表 `WIRE_CARRIED_DOMAINS`(`EffectiveWire.a2a` 可选:缺席不再补空名册)在 §20。
16
17
 
17
18
  ---
18
19
 
@@ -234,8 +235,8 @@ server 直接拒启,不是静默降级。上一代 `SEMA_REGISTRY_*` 八名(`URL
234
235
  —— 在场即拒启(见 §2)。
235
236
  - 凭证也可以声明成**文件**:`WEB_ADMIN_ENV.tokenFile`(每次取值重读,轮换不重启),与 `WEB_ADMIN_ENV.token`
236
237
  **二选一**,两个都设 = 拒;断言令牌的一对(`assertionToken` / `assertionTokenFile`)同一条规则。这条规则**别手抄**:取
237
- `judgeWebAdminCredentialDeclaration(env, "access" | "assertion")`(S-742);文件内容的读法取
238
- `parseWebAdminCredentialFile(text)`(S-698:裸行 = 静态 bearer,`{` 开头 = `WebAdminCredentialEnvelope` 用户会话信封,
238
+ `judgeWebAdminCredentialDeclaration(env, "access" | "assertion")`(二选一判官 6.1.0 起,`assertion` 一对与必填第二参 11.0.0 起);文件内容的读法取
239
+ `parseWebAdminCredentialFile(text)`(6.1.0 起:裸行 = 静态 bearer,`{` 开头 = `WebAdminCredentialEnvelope` 用户会话信封,
239
240
  读不成 = `unreadable`,不回落)。
240
241
  - **本地 `config.d` 的一次性迁移(引擎起服)**:调 `@sema-agent/settings-schema/node` 的 `migrateConfigDirectory(dir, { documents, io: nodeConfigDirectoryIo })`,`documents` 填你本地读腿会读的域名集
241
242
  (覆盖面外的文件不读不判不写不删;要迁 retired 的 `runtime` 域就得把 `governance` 与 `limits` 一并放进来 —— 迁出的旧值要写那两份,缺了 `runtime` 按 `partial` 拒迁、一字不写);按返回的 `kind` 穷举处置(`applied` / `noop` / `pending` / `refused` / `no-documents` / `unreadable`)。**别按同语义自写**读目录、迁、整域终判、原子写、删退役域文件那一串 ——
@@ -246,7 +247,7 @@ server 直接拒启,不是静默降级。上一代 `SEMA_REGISTRY_*` 八名(`URL
246
247
  - **会话网页链接**:要给用户一个 web-admin 里的会话链接,调 `webAdminSessionUrl(webBaseUrl, { worker, sessionId })`(`webBaseUrl` 取引擎 `/health` 自报的人用界面根 URL,
247
248
  `worker` 取引擎向 web-admin 登记用的 worker 名),得到 `<webBaseUrl>/chat?agent=<worker>&session=<sessionId>`;**别按地址形手拼** —— 路由属于 web-admin,模板与读回的
248
249
  `parseWebAdminSessionUrl(link)` 同在本包,路径与参数名只此一份。两位必填:只带 `session` 的链接会落到页面自己挑的 worker 上、可能找不到会话。
249
- - **模型拒因(引擎 → web-admin,S-768,6.2.0)**:引擎逐台报「本机不服务目录里的哪些条目、为什么」,一处铸、两出口 ——
250
+ - **模型拒因(引擎 → web-admin,6.2.0)**:引擎逐台报「本机不服务目录里的哪些条目、为什么」,一处铸、两出口 ——
250
251
  心跳 `InstanceAnnouncement.modelRefusals?` 与 `GET /health` 的 `modelRefusals`(`InstanceHealth` 不类型化它)。**两个出口
251
252
  同一只读口**:`readModelRefusals(body)`,`body` 传 `/health` 体或已 parse 的公告都行(它只读 `modelRefusals` 键);别直接
252
253
  读公告上的字段 —— 字段是 wire 形 `ModelRefusalsWire`(码是开放串),读口才按本包闭集收窄成 `ModelRefusalsSignal`。
@@ -631,9 +632,9 @@ fleet 成员对中心公告的可达地址(`FLEET_ADVERTISE_ADDRESS`,中心往
631
632
 
632
633
  ### 17.4 便携新域 `a2a`:常驻出站 A2A 对端名册
633
634
 
634
- - 形:`A2aConfig = { peers: A2aPeerSpec[] }`(缺席 ≡ 空表 = 不拨任何对端;对端名唯一);`A2aPeerSpec = { name, url, cardUrl?, headerRefs?, principalHeader?, allowSkills?, scenarios(缺省 []), enabled(缺省 true) }`。
635
+ - 形:`A2aConfig = { peers: A2aPeerSpec[] }`(空表 = 不拨任何对端;对端名唯一;线上缺席不是空表,见 §20);`A2aPeerSpec = { name, url, cardUrl?, headerRefs?, principalHeader?, allowSkills?, scenarios(缺省 []), enabled(缺省 true) }`。
635
636
  判官全复用:`name` = `isUsableWireName`(对端名是线上工具名 `a2a__<名>__…` 的身份片,不 trim、不截断)· `url` / `cardUrl` = `NON_SECRET_URL`(不带凭据与 fragment)· `headerRefs` = 头名 → env-NAME(值在读方自己的环境里,中心不存值)· `principalHeader` = 头名判官。
636
- - 读法:本地 `config.d/a2a.json` 与中心 `/effective.a2a` 是同一个声明座(两腿恒物化 `{ peers: [] }`);整域读不进 ⇒ 空名册;坏对端逐条丢;写权限 `domainWriteRole("a2a")` = `publisher`。
637
+ - 读法:本地 `config.d/a2a.json` 与中心 `/effective.a2a` 是同一个声明座(读店 / 读 `config.d` 恒物化 `{ peers: [] }`;20.0.0 起线上载荷不带 `a2a` 时读出形里缺席,见 §20);整域读不进 ⇒ 空名册;坏对端逐条丢;写权限 `domainWriteRole("a2a")` = `publisher`。
637
638
  - **凭据引用集合不部分抢救**(`ATOMIC_SALVAGE`,按 schema 身份:mcp 的 `envRefs` / `headerRefs`、a2a 的 `headerRefs`、车道块的 `secretRefs`、worker 的 `secretEnv`):集合里坏一项 ⇒ 整个条目 `entry-dropped`,兄弟保留;别的集合字段照旧逐条丢。
638
639
  对已记录语料零变化;两处例外:引用名为 `__proto__` / `constructor` / `prototype` 的条目整条丢(旧版:`__proto__` 被剥并告警、`constructor` / `prototype` 照收,条目都留着);
639
640
  直接对 `WorkersConfig` 调 `salvageEntries` 时,`secretEnv` 带坏引用的 worker 整条丢(此前只丢那一条引用)。保留名只有一张表(`RESERVED_MEMBER_NAMES`),记录读器与解析口(§14)同答。
@@ -653,12 +654,12 @@ fleet 成员对中心公告的可达地址(`FLEET_ADVERTISE_ADDRESS`,中心往
653
654
  凭据参数名(同版):「这个已解码的参数名是不是凭据名」只问包根 `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,受理口由受理变拒。
654
655
  读点:server 7.147.0 的日志脱敏器(URL 参数 · JSON 秘密字段 · 自由文本强锚三个名字读者与诊断值位)改读它、拿返回的词去查自己的锚强度列,受理口判官与脱敏器同一版同一天翻;cli 无读点(壳零直调这组判官);client-core 无读点(只有一格探针扫本包 d.ts 的导出名,新名字不命中它的『同类键名判官』扫描式);web-admin、sdk 不读名字判定(sdk 合同测里的固定样例 `?token=` / `?api_key=` 照旧命中)。
655
656
 
656
- ## 18. hook 条目的 `args` 与 `onFailure`(19.0.0 起)—— server、web-admin、cli、client-core、sdk 各自的读法
657
+ ## 18. hook 条目的 `args` 与 `onFailure`(19.0.0 起)、`rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock`(20.0.0 起)—— server、web-admin、cli、client-core、sdk 各自的读法
657
658
 
658
659
  - 字段表(`classifyHooksConfig` 与 `HookEntry` 一族 zod 面的唯一声明)多两列:command 条目的可选 `args`(串数组;`[]` 与空串元素都是值,元素含 NUL 为坏)与可选 `onFailure`,http 条目的可选 `onFailure`;
659
660
  词闭集 `HOOK_ON_FAILURE_WORDS` = `continue` | `block`(包根与 `./hooks`),型 `HookOnFailure`。缺席不补缺省(CC 的缺省 = `continue`,读方自己补)。
660
661
  - 此前这两个键被分类器当契约外的键剥掉(不算坏块);自此:词表外的 `onFailure`、不合形的 `args` 是坏块(非守卫事件剔那一条,守卫事件整份拒,`field` 点名它);`args` 写在别的四型上、`onFailure` 写在 prompt / agent / mcp_tool 上仍是契约外的键(剥掉,不算坏块;键下装着守卫迹象的除外 —— 那一直是整份拒)。
661
- `rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock` 仍不承运(`docs/CC-DIVERGENCE.md` H7)。
662
+ (20.0.0 起另四个 CC 键也进表,见本节末「20.0.0 起」。)
662
663
  - **承运 ≠ 执行**:本包只判形。读到 `onFailure: "block"` 的消费方要么执行它(hook 起不来 / 超时 / 退出码非 0 非 2 / 输出 JSON 非法 ⇒ 按 exit 2 阻断,同步条目、非 Stop 一族事件),要么在自己的受理面明拒 —— 静默不执行等于守卫起不来照放行。
663
664
 
664
665
  | 消费方 | 读点 | 动作 |
@@ -668,3 +669,49 @@ fleet 成员对中心公告的可达地址(`FLEET_ADVERTISE_ADDRESS`,中心往
668
669
  | client-core | 由 `classifyHooksConfig` 生成的读器副本 | 闭包多一个私有件 `HOOK_ON_FAILURE_ACCEPTED`(与 `HOOK_SHELLS` 同法随函数抄走),自由名仍只有 `HOOK_EVENTS`;生成器照旧整函数抄 |
669
670
  | web-admin | `HookEntry` 一族的编辑面 | 可选:表单承运两列 |
670
671
  | sdk | `CommandHookEntry` / `HttpHookEntry`(类型面) | 加性:多两个可选键;对 `keyof` 写穷举表的地方补两列 |
672
+
673
+ **20.0.0 起 —— 余下四个 CC 键**(CC `cli309.js:252382` 条目 schema 上本包原先剥掉的键;至此 CC 五型条目 schema 上的每个键都在字段表里):
674
+
675
+ - 字段表再多四列:command 条目的可选 `rewakeMessage` / `rewakeSummary`(非空串 —— CC 的 `min(1)`,空白 / 多行 / NUL 都是值;`asyncRewake` 的 hook 以退出码 2 退出时给模型的提醒前缀 / 给用户的一行摘要)、command 与 http 条目的可选 `cloud`(**任意值照带**;云会话由本机驱动时这个 hook 能不能被带进去 —— CC 的词是 `device` | `skip`,即 `HOOK_CLOUD_WORDS` / 型 `HookCloud`,词表外的任何值 CC 读作 `skip`,**由读者折**,本包不判不折不剥;`cloud` 字段的型是 `unknown`)、prompt 条目的可选 `continueOnBlock`(布尔;判「不通过」产出 `decision: "block"` 时的 `continue` 取值)。缺席不补缺省。
676
+ - `rewakeMessage` / `rewakeSummary` / `continueOnBlock` 的坏值是坏块(非守卫事件剔那一条,守卫事件整份拒,`field` 点名它;zod 面整个拒,`readSettingsUnit("hooks", …)` 整个答 `unreadable`);`cloud` 没有坏值。写在别的型上仍是契约外的键。**读 `cloud` 的一侧自己折**:词表外的任何值按 CC 读作 `skip`;不要在分类器输出之上替作者改写,也不要剥掉。新列排在每行行尾:已是坏块的条目 `field` 点名的字段不变。
677
+ - **承运 ≠ 执行**:`rewakeMessage` / `rewakeSummary` / `cloud` 是 CC 标 `@internal` 的键,`@internal` 不是不承运的理由,也不是要执行的理由 —— 本包只判形;server 侧的执行面另票处理,本版不规定;需要执行它们的一侧(跑 hook 的壳)自己读。
678
+
679
+ | 消费方 | 读点 | 动作 |
680
+ |---|---|---|
681
+ | server | `CommandHookEntry` / `HttpHookEntry` / `PromptHookEntry`(四键)· `HOOK_CLOUD_WORDS` | 提货后:`rewakeMessage` / `rewakeSummary` / `cloud` 的执行面另票处理,本版不规定;`continueOnBlock` 与 prompt 条目的其余字段同路 |
682
+ | cli | 同上 · `classifyHooksConfig` | 壳若自己执行 hook(引擎属主事件 `ENGINE_OWNED_HOOK_EVENTS` 以外):执行、如实带着或明拒;`cloud` 要折就按 CC 折;「能不能装」仍只问分类器 |
683
+ | client-core | 由 `classifyHooksConfig` 生成的读器副本 | 重生成:闭包读的私有件由 19.0.x 的私有 `HOOK_ENTRY_FIELDS` + `HOOK_ENTRY_COMMON_FIELDS` 换成 `HOOK_ENTRY_FIELDS_READ`(公共四字段在投影里写开),字段表多四列、取值判多 `nonEmpty` · `any` 两个分支,行为随表(`rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock` 承运,`rewakeMessage` / `rewakeSummary` / `continueOnBlock` 的坏值是坏块 —— 见 hook 条目余下四个 CC 键一节);自由名仍只有 `HOOK_EVENTS`;生成器照旧整函数抄 |
684
+ | web-admin | `HookEntry` 一族的编辑面 | 可选:表单承运四列(`cloud` 的选项可取 `HOOK_CLOUD_WORDS`) |
685
+ | sdk | 三型条目的类型面 | 加性:多四个可选键(`cloud` 的型是 `unknown`);对 `keyof` 写穷举表的地方补列 |
686
+
687
+ ## 19. 目录条目的 `thinkingLevelMap` 与运行期导出的 `HOOK_ENTRY_FIELDS`(20.0.0 起)—— server、web-admin、client-core、cli 各自的读法
688
+
689
+ - **`ModelEntry.thinkingLevelMap?`**(引擎 `Model.thinkingLevelMap` 的声明位):键闭集 = 词表 `MODEL_THINKING_LEVEL_WORDS`(`off` `minimal` `low` `medium` `high` `xhigh` `max`;包根与 `./types`,型 `ModelThinkingLevel`,席位 schema `ModelThinkingLevelMap`),全可选;
690
+ 值 = 非空串(供应商在这一档上自己的取值)或 `null`(这一档在这个模型上不支持);缺键 = 供应商缺省。缺席 = 未声明,本包不补 `{}`;`{}` = 声明了、没有覆盖。
691
+ - **坏形整条目拒**:未知键 · 非对象(含 `null`、数组)· 空串值 · 非串非 `null` 的值 ⇒ 读口逐条丢并报 `entry-dropped`(同域未被引用的其余条目照常;**被 `roles` / `atMention.only` / `tierGroups` 引用的条目坏形 ⇒ 引用悬空,既有级联律把整个 `models` 域退成缺省**:只发 `domain-defaulted`、目录退空、兄弟条目一并丢,不发 `entry-dropped`;目录里一条好条目都不剩时,含它是唯一一条,走既有的零幸存者律:不发 `entry-dropped`,只发 `domain-defaulted`、`models` 退成空目录),文档面整域抛,写口拒;不剥键、不折默认。此前这个键被当未知键剥掉(`unknown-keys-dropped`)、条目照装。
692
+ 本包只承载与判形,**不判语义**:串是供应商取值,怎么落到线缆归读它的消费方。
693
+ - **`HOOK_ENTRY_FIELDS`**(包根与 `./hooks`,深冻结)与型 `HookEntryFields`:hook 条目的字段表 —— 每型 → 字段名 → 取值类(`text` `nonEmpty` `string` `shell` `boolean` `seconds` `stringRecord` `stringList` `argv` `onFailure` `any` `record`,`?` 结尾 = 选填;`nonEmpty` = 至少一个字符的串、别的不判,`any` = 不判、原值照带),字段序即装上的条目的键序。
694
+ 分类器读的是闭包私有的投影、不是这一只(生成器整函数抄走的前提),两者以型标注咬合、差分钉住;导出表是给**投影字段集**的消费方读的,不是给分类器注入的。
695
+
696
+ | 消费方 | 读点 | 动作 |
697
+ |---|---|---|
698
+ | server 7.147.0 | `ModelEntry.thinkingLevelMap` · `MODEL_THINKING_LEVEL_WORDS` / `ModelThinkingLevel` · `HOOK_ENTRY_FIELDS` | 目录条目的席位随条目到达(中心名册透传 · env 腿 · 模型清单投影 · anthropic `compat` 分读由 server 自己的版本接);能力位 `settingsContract.hookEntryFields` 从 `HOOK_ENTRY_FIELDS` 投影,退役本地镜像 |
699
+ | web-admin | `ModelEntry`(编辑面) | 可选:表单承运 `thinkingLevelMap`,键取词表七词、值取非空串或 `null`;写坏的条目会在读口被丢,表单只产合形 |
700
+ | client-core | 由 `classifyHooksConfig` 生成的读器副本 | 重生成:闭包读的私有件由 19.0.x 的私有 `HOOK_ENTRY_FIELDS` + `HOOK_ENTRY_COMMON_FIELDS` 换成 `HOOK_ENTRY_FIELDS_READ`(公共四字段在投影里写开),字段表多四列、取值判多 `nonEmpty` · `any` 两个分支,行为随表(`rewakeMessage` / `rewakeSummary` / `cloud` / `continueOnBlock` 承运,`rewakeMessage` / `rewakeSummary` / `continueOnBlock` 的坏值是坏块 —— 见 hook 条目余下四个 CC 键一节);自由名仍只有 `HOOK_EVENTS`;生成器照旧整函数抄 |
701
+ | cli | — | 无读点 |
702
+
703
+ ## 20. 线上读口不编造生产方没发的域(20.0.0 起)—— `EffectiveWire.a2a` 可选,server、client-core、web-admin、sdk、cli 各自的读法
704
+
705
+ - **律**:`readEffectiveWire` 对承运表 `WIRE_CARRIED_DOMAINS`(`prompts` / `a2a`,包根与 `./types`,型 `WireCarriedDomain`)里的域按在场性承运 —— 载荷上缺席 ⇒ 读出形里缺席;在场 ⇒ 照该域既有读法。
706
+ 在场判据只有一个:载荷的自有键,且值不是 `undefined`。`EffectiveWire` 由这张表派生(除 `prompts` 外表里的域是可选成员)。其余 15 个域 1.0.0 起就在域表上、支持面内的生产方恒发,线上缺席读作契约缺省(不变)。
707
+ - **`a2a` 的三态**:缺席(生产方不懂此域 —— 18.0.0 起 `buildEffective` 恒物化 `a2a`,≥ 18.0.0 的中心恒发它)· 在场(`{ peers: [] }` = 说了空名册)· 读不进(在场、值为 `{ peers: [] }`,另有 `domain-defaulted`,域 `a2a`)。
708
+ 读出形里的「在不在」就是这一读法;不另设在场位,也不要再回原始载荷判第二遍。
709
+ - **不在本律内**:`EffectiveConfig`(`buildEffective` / `FileConfigStore` / `loadLocalConfig` / `emptyEffective`)照旧物化 `a2a`、仍必填 —— 读者即本包,恒懂每个域。`config.d/a2a.json` 在不在只问 `readConfigDFileReadingSync(root, "a2a")`。
710
+
711
+ | 消费方 | 读点 | 动作 |
712
+ |---|---|---|
713
+ | server 7.147.0 | 中心腿 `readEffectiveWire` → 换装成本仓的线上型(`a2a` 已是可选成员)· 本地腿 `FileConfigStore` 的 `EffectiveConfig.a2a` | 零编译改动;老中心上 `a2a` 由 `{ peers: [] }` 变缺席,两者都不拨对端(按场景筛对端时空表与缺席同答)、重启指纹同为空;改准「中心腿缺省已物化」的注释 |
714
+ | client-core | 原始回体上的 a2a 三态 | 可改读契约:`readEffectiveWire(body)` 的 `a2a` 不在 ⇒ 缺席 / 在 ⇒ 在场 / 在 + `domain-defaulted{a2a}` ⇒ 读不进;「`readEffectiveWire` 把缺席补成空名册」那一格翻面,`buildEffective` / `emptyEffective` 恒物化两格不翻 |
715
+ | web-admin | 无 a2a 读点 | 无;提货 ≥ 18.0.0 后中心载荷恒带 `a2a` |
716
+ | sdk / cli | 不读 `EffectiveWire` / `readEffectiveWire` | 无 |
717
+ | 任何直读 `readEffectiveWire(…).a2a.peers` 的一侧 | `EffectiveWire.a2a` | 编译红:先判在场;要旧读法补 `?? { peers: [] }` |