@sema-agent/settings-schema 27.2.0 → 29.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 (221) hide show
  1. package/CHANGELOG.md +753 -0
  2. package/README.md +88 -12
  3. package/conformance/VERSION +1 -1
  4. package/conformance/cases/c01-entry-salvage-then-typo/expected.json +1 -1
  5. package/conformance/cases/c02-hosts-clamp-stacked/expected.json +1 -1
  6. package/conformance/cases/c03-literal-dotted-top-key/expected.json +1 -1
  7. package/conformance/cases/c04-all-bad-collection-not-salvaged/expected.json +1 -1
  8. package/conformance/cases/c07-hooks-is-not-a-config-domain/expected.json +1 -1
  9. package/conformance/cases/c08-limits-unknown-carried-64/expected.json +1 -1
  10. package/conformance/cases/c09-limits-unknown-carried-65/expected.json +1 -1
  11. package/conformance/cases/c10-record-key-secret-redacted-twice/expected.json +1 -1
  12. package/conformance/cases/c11-unicode-unknown-keys/expected.json +1 -1
  13. package/conformance/cases/c12-prototype-name-top-keys/expected.json +1 -1
  14. package/conformance/cases/c13-models-field-null/expected.json +1 -1
  15. package/conformance/cases/c14-models-field-empty-array/expected.json +1 -1
  16. package/conformance/cases/c15-models-field-number/expected.json +1 -1
  17. package/conformance/cases/c18-wire-envelope-not-an-object/expected.json +1 -1
  18. package/conformance/cases/c19-wire-envelope-no-version/expected.json +1 -1
  19. package/conformance/cases/c21-governance-empty-object-wins/expected.json +1 -1
  20. package/conformance/cases/c23-mixed-validity-models/expected.json +1 -1
  21. package/conformance/cases/c24-valid-entries-with-unknown-keys/expected.json +1 -1
  22. package/conformance/cases/c25-published-roundtrip-zero-warnings/expected.json +1 -1
  23. package/conformance/cases/c26-hosts-array-1024/expected.json +1 -1
  24. package/conformance/cases/c27-hosts-array-1025/expected.json +1 -1
  25. package/conformance/cases/c28-large-document-over-1mb/expected.json +1 -1
  26. package/conformance/cases/c29-salvage-then-domain-refine-fails/expected.json +1 -1
  27. package/conformance/cases/c30-version-triple-a-first/expected.json +1 -1
  28. package/conformance/cases/c31-version-triple-b-changed/expected.json +1 -1
  29. package/conformance/cases/c32-version-triple-a-restored/expected.json +1 -1
  30. package/conformance/cases/c33-limits-nested-carried-key/expected.json +1 -1
  31. package/conformance/cases/c34-skills-content-vs-manifest/expected.json +1 -1
  32. package/conformance/cases/c36-skills-entry-without-content/expected.json +1 -1
  33. package/conformance/cases/c38-remote-exec-is-a-non-domain-file/expected.json +1 -1
  34. package/conformance/cases/c39-hidden-file-in-config-d/expected.json +1 -1
  35. package/conformance/cases/c40-s712-identity-only-what-reads-out/expected.json +1 -1
  36. package/conformance/cases/c41-s792-encoded-pem-identity/expected.json +1 -1
  37. package/conformance/cases/c42-s792-unknown-key-secret-redacted/expected.json +1 -1
  38. package/conformance/cases/c43-s792-form-and-deep-encoded-pem/expected.json +1 -1
  39. package/conformance/cases/c44-s792-utf8-escape-glued-token/expected.json +1 -1
  40. package/conformance/cases/c45-s792-identity-bounds-and-decode-depth/expected.json +1 -1
  41. package/conformance/cases/c46-s811-host-name-url-userinfo-withheld/expected.json +1 -1
  42. package/conformance/cases/c47-s811-roles-key-url-userinfo-withheld/expected.json +1 -1
  43. package/conformance/cases/c48-s935-model-headers-transported/expected.json +1 -1
  44. package/conformance/cases/c49-s935-model-headers-secret-entry-dropped/expected.json +1 -1
  45. package/conformance/cases/c50-s784-lane-host-legal/expected.json +1 -1
  46. package/conformance/cases/c51-s784-lane-e2b-legal/expected.json +1 -1
  47. package/conformance/cases/c52-s784-lane-k8s-legal/expected.json +1 -1
  48. package/conformance/cases/c53-s784-lane-ssh-legal/expected.json +1 -1
  49. package/conformance/cases/c54-s784-lane-adb-legal/expected.json +1 -1
  50. package/conformance/cases/c55-s784-lane-local-docker-legal/expected.json +1 -1
  51. package/conformance/cases/c56-s784-lane-device-legal/expected.json +1 -1
  52. package/conformance/cases/c57-s784-g1-enabled-no-lane/expected.json +1 -1
  53. package/conformance/cases/c58-s784-g2-multitenant-host/expected.json +1 -1
  54. package/conformance/cases/c59-s784-g3-k8s-missing-image/expected.json +1 -1
  55. package/conformance/cases/c60-s784-g3-e2b-missing-key/expected.json +1 -1
  56. package/conformance/cases/c61-s784-g3-other-lane-key/expected.json +1 -1
  57. package/conformance/cases/c62-s784-g7a-session-tidb/expected.json +1 -1
  58. package/conformance/cases/c63-s784-host-two-replicas/expected.json +1 -1
  59. package/conformance/cases/c64-s784-multitenant-local-store/expected.json +1 -1
  60. package/conformance/cases/c65-s784-pg-without-db/expected.json +1 -1
  61. package/conformance/cases/c66-s784-memory-backend-mismatch/expected.json +1 -1
  62. package/conformance/cases/c67-s784-retired-field-loud/expected.json +1 -1
  63. package/conformance/cases/c68-s784-device-local-store/expected.json +1 -1
  64. package/conformance/cases/c69-deep-encoded-token-past-every-reading/expected.json +1 -1
  65. package/conformance/cases/c70-rewritten-token-in-front-of-encoded-pem-header/expected.json +1 -1
  66. package/conformance/cases/c71-one-scanner-write-reads-display-forms/expected.json +1 -1
  67. package/conformance/cases/c72-dangling-reference-write-seat-refuses/expected.json +1 -1
  68. package/conformance/cases/c73-projects-extended-registration-reads/expected.json +1 -1
  69. package/conformance/cases/c74-projects-over-bound-refused/expected.json +3 -72
  70. package/conformance/cases/c75-projects-patch-remote-uniqueness/expected.json +3 -72
  71. package/conformance/cases/c76-projects-entry-salvage-nested/expected.json +1 -1
  72. package/conformance/cases/c77-prompts-center-artifact-carried/expected.json +1 -1
  73. package/conformance/cases/c78-prompts-empty-bindings-refused/expected.json +1 -1
  74. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/expected.json +1 -1
  75. package/conformance/cases/c80-prompts-wire-v2-verbatim/expected.json +1 -1
  76. package/conformance/cases/c81-prompts-declaration-bindings-refused/expected.json +1 -1
  77. package/conformance/cases/c82-prompts-v1-catalog-refused/expected.json +1 -1
  78. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/expected.json +1 -1
  79. package/conformance/cases/c84-sandbox-git-block-carried-verbatim/expected.json +1 -1
  80. package/conformance/cases/c85-sandbox-git-refused-block-still-carried/expected.json +1 -1
  81. package/conformance/cases/c86-a2a-peers-legal/expected.json +1 -1
  82. package/conformance/cases/c87-a2a-credential-refs-not-partially-salvaged/expected.json +1 -1
  83. package/conformance/cases/c88-projects-content-attestation-carried/expected.json +1 -1
  84. package/conformance/cases/c89-projects-content-attestation-malformed/expected.json +1 -1
  85. package/conformance/cases/c90-mcp-assertion-credential-carried/expected.json +143 -0
  86. package/conformance/cases/c90-mcp-assertion-credential-carried/input.json +30 -0
  87. package/conformance/cases/c90-mcp-assertion-credential-carried/meta.json +6 -0
  88. package/conformance/cases/c91-mcp-assertion-header-retired-entry-dropped/expected.json +105 -0
  89. package/conformance/cases/c91-mcp-assertion-header-retired-entry-dropped/input.json +27 -0
  90. package/conformance/cases/c91-mcp-assertion-header-retired-entry-dropped/meta.json +6 -0
  91. package/conformance/cases/c92-mcp-principal-header-with-assertion-dropped/expected.json +105 -0
  92. package/conformance/cases/c92-mcp-principal-header-with-assertion-dropped/input.json +31 -0
  93. package/conformance/cases/c92-mcp-principal-header-with-assertion-dropped/meta.json +6 -0
  94. package/conformance/cases/c93-mcp-header-refs-with-credentials-dropped/expected.json +105 -0
  95. package/conformance/cases/c93-mcp-header-refs-with-credentials-dropped/input.json +33 -0
  96. package/conformance/cases/c93-mcp-header-refs-with-credentials-dropped/meta.json +6 -0
  97. package/conformance/cases/c94-mcp-credentials-env-kind-dropped/expected.json +105 -0
  98. package/conformance/cases/c94-mcp-credentials-env-kind-dropped/input.json +32 -0
  99. package/conformance/cases/c94-mcp-credentials-env-kind-dropped/meta.json +6 -0
  100. package/conformance/cases/c95-mcp-credentials-audience-not-connector-id-dropped/expected.json +105 -0
  101. package/conformance/cases/c95-mcp-credentials-audience-not-connector-id-dropped/input.json +30 -0
  102. package/conformance/cases/c95-mcp-credentials-audience-not-connector-id-dropped/meta.json +6 -0
  103. package/conformance/cases/c96-mcp-credentials-extra-member-dropped/expected.json +105 -0
  104. package/conformance/cases/c96-mcp-credentials-extra-member-dropped/input.json +31 -0
  105. package/conformance/cases/c96-mcp-credentials-extra-member-dropped/meta.json +6 -0
  106. package/conformance/cases/cc01-mcp-toolfaces-non-object/expected.json +1 -1
  107. package/conformance/cases/cc02-mcp-source-key-is-transported/expected.json +1 -1
  108. package/conformance/cases/cc03-model-compat-unknown-subkey/expected.json +1 -1
  109. package/conformance/cases/cli01-model-name-nfc-vs-nfd/expected.json +1 -1
  110. package/conformance/cases/cli02-control-and-zero-width-chars/expected.json +1 -1
  111. package/conformance/cases/cli03-credential-pasted-into-unknown-key/expected.json +1 -1
  112. package/conformance/cases/cli04-env-value-with-newline/expected.json +1 -1
  113. package/conformance/cases/cli05-long-and-prefix-colliding-names/expected.json +1 -1
  114. package/conformance/cases/t01-absent-domain-key-not-null/expected.json +1 -1
  115. package/conformance/cases/t03-prototype-name-key-not-swallowed/expected.json +1 -1
  116. package/conformance/cases/t04-secret-literal-never-in-warning-value/expected.json +1 -1
  117. package/conformance/cases/z01-every-domain-empty-object/expected.json +1 -1
  118. package/conformance/cases/z02-every-domain-unknown-key/expected.json +1 -1
  119. package/dist/api/auth-bridge.js +4 -3
  120. package/dist/api/auth.js +6 -5
  121. package/dist/api/credentials.js +14 -15
  122. package/dist/api/lifecycle-events.d.ts +266 -0
  123. package/dist/api/lifecycle-events.js +169 -0
  124. package/dist/api/pull-token.js +2 -1
  125. package/dist/api/scopes.js +5 -4
  126. package/dist/api/wire-scalars.d.ts +13 -0
  127. package/dist/api/wire-scalars.js +15 -0
  128. package/dist/atomic-write.d.ts +4 -0
  129. package/dist/atomic-write.js +26 -3
  130. package/dist/center-refs.js +3 -2
  131. package/dist/config-d-file.d.ts +1 -1
  132. package/dist/config-dir-io.d.ts +1 -1
  133. package/dist/config-dir-io.js +3 -2
  134. package/dist/config-document-refusal.d.ts +5 -5
  135. package/dist/config-document-refusal.js +2 -1
  136. package/dist/config-fns.d.ts +5 -5
  137. package/dist/config-fns.js +17 -16
  138. package/dist/config-root-documents.d.ts +1 -1
  139. package/dist/config-root-documents.js +4 -3
  140. package/dist/config-root-node.d.ts +1 -1
  141. package/dist/config-root-node.js +5 -3
  142. package/dist/conformance/corpus.d.ts +1 -1
  143. package/dist/conformance/derive.d.ts +16 -8
  144. package/dist/conformance/derive.js +41 -24
  145. package/dist/conformance/index.d.ts +1 -1
  146. package/dist/conformance/index.js +1 -1
  147. package/dist/conformance/run.js +8 -9
  148. package/dist/conformance/types.js +4 -3
  149. package/dist/connector-authorize-url.d.ts +23 -0
  150. package/dist/connector-authorize-url.js +129 -0
  151. package/dist/connector-id.d.ts +23 -0
  152. package/dist/connector-id.js +27 -0
  153. package/dist/cross-domain.js +6 -5
  154. package/dist/cross-session.js +3 -2
  155. package/dist/deep-freeze.d.ts +26 -0
  156. package/dist/deep-freeze.js +69 -0
  157. package/dist/default-model.js +2 -1
  158. package/dist/device-relay.d.ts +1 -1
  159. package/dist/device-relay.js +1 -1
  160. package/dist/env-model-table.js +2 -1
  161. package/dist/execution-lane-index.d.ts +1 -1
  162. package/dist/execution-lane-index.js +5 -4
  163. package/dist/execution-lanes.d.ts +2 -2
  164. package/dist/execution-lanes.js +18 -17
  165. package/dist/file-edit.d.ts +44 -0
  166. package/dist/file-edit.js +70 -1
  167. package/dist/file-store.d.ts +12 -7
  168. package/dist/file-store.js +72 -59
  169. package/dist/fleet.js +14 -13
  170. package/dist/hooks-config.d.ts +12 -12
  171. package/dist/hooks-config.js +16 -15
  172. package/dist/hooks.d.ts +20 -10
  173. package/dist/hooks.js +30 -19
  174. package/dist/http-hook-allowlists.js +2 -1
  175. package/dist/index.d.ts +4 -0
  176. package/dist/index.js +6 -2
  177. package/dist/mcp-entry-credential.d.ts +47 -0
  178. package/dist/mcp-entry-credential.js +73 -0
  179. package/dist/mcp-request-entry.d.ts +32 -13
  180. package/dist/mcp-request-entry.js +106 -59
  181. package/dist/mcp-server-policy.js +3 -2
  182. package/dist/migration-receipt.d.ts +3 -3
  183. package/dist/migration-receipt.js +4 -3
  184. package/dist/one-time-migrations.d.ts +2 -2
  185. package/dist/one-time-migrations.js +75 -57
  186. package/dist/own-key-read.d.ts +3 -1
  187. package/dist/plain-json-object.d.ts +6 -3
  188. package/dist/plain-json-object.js +6 -3
  189. package/dist/portable-domains.d.ts +18 -12
  190. package/dist/portable-domains.js +21 -15
  191. package/dist/reserved-member-name.d.ts +1 -1
  192. package/dist/reserved-member-name.js +3 -2
  193. package/dist/resolve-roster.js +3 -2
  194. package/dist/retired-envs.js +3 -6
  195. package/dist/retired-role-words.d.ts +1 -1
  196. package/dist/retired-role-words.js +4 -6
  197. package/dist/safety-merge-spec.d.ts +11 -4
  198. package/dist/safety-merge-spec.js +5 -4
  199. package/dist/scheduler-store-node.d.ts +5 -2
  200. package/dist/scheduler-store-node.js +8 -5
  201. package/dist/secret-scan.js +1 -1
  202. package/dist/settings-sources.js +6 -5
  203. package/dist/settings-units.js +3 -2
  204. package/dist/sha256.d.ts +5 -0
  205. package/dist/sha256.js +7 -0
  206. package/dist/skills-manifest.js +2 -2
  207. package/dist/types.d.ts +89 -19
  208. package/dist/types.js +57 -65
  209. package/dist/ui-language.js +4 -3
  210. package/dist/url-credential.js +4 -3
  211. package/dist/url-shape.d.ts +1 -1
  212. package/dist/url-shape.js +5 -4
  213. package/dist/web-admin-credential.js +2 -1
  214. package/dist/web-admin-env.d.ts +1 -1
  215. package/dist/web-admin-env.js +4 -3
  216. package/docs/API-SURFACE.md +47 -7
  217. package/docs/CONFORMANCE.md +6 -4
  218. package/docs/CONSUMER-INTEGRATION.md +131 -6
  219. package/llms-full.txt +46 -24
  220. package/llms.txt +27 -13
  221. package/package.json +3 -2
package/dist/types.js CHANGED
@@ -32,13 +32,15 @@ import { Sha256Digest } from "./sha256.js"; // the one `sha256:<hex>` digest for
32
32
  import { EXECUTION_LANES, EXECUTION_LANE_WORDS, LANE_SET_RULE, MEMORY_ENGINE_BACKENDS, SESSION_BACKENDS, STORE_BACKENDS, isBlankCoordinate, laneSetFlaws, retiredLaneWordRefusal } from "./execution-lanes.js"; // 7.0.0 M-R2: the lane / store vocabulary (one exported table)
33
33
  import { LANE_ENV_OWNER, LATE_LANE_ENV_KEYS, laneEnvSeat, laneRowOf } from "./execution-lane-index.js"; // package-private indexes derived from that table (none of them is in the barrel)
34
34
  import { migrationSignpost, retiredFormSentence, retiredKey } from "./retired-form.js"; // 11.0.0: the ONE retired-form sentence + key tombstone (package-private)
35
- import { retiredRoleWordsRefusal } from "./retired-role-words.js"; // 12.0.0: the retired role-word tombstone (package-private; SS-M8)
35
+ import { retiredRoleWordsRefusal } from "./retired-role-words.js"; // 12.0.0: the retired role-word tombstone (package-private)
36
36
  import { buildQuotedIssue, fixed } from "./quoted-issue.js"; // THE minting point of custom issues (package-private)
37
37
  import { RESERVED_MEMBER_NAMES, isReservedMemberName } from "./reserved-member-name.js"; // 18.0.0: the one reserved-member-name table (the record reader and the center-refs resolver ask the same predicate)
38
38
  import { AbsoluteHostPath } from "./host-path.js"; // the one host-path shape judge (a task's cwd and a project's folder / file entries)
39
39
  import { RFC3339_DATE_TIME } from "./rfc3339.js"; // the package's one RFC 3339 date-time judge (package-private)
40
40
  import { DEVICE_RELAY_RULE, deviceRelayFlaws } from "./device-relay.js"; // 16.0.0: the value grammar of the device lane's DEVICE_RELAY_URL (ws(s) URL or the literal none)
41
41
  import { TOOL_WIRE_NAME_MAX_CHARS, isUsableWireName } from "./wire-name.js"; // 18.0.0: the one "usable wire name" judge (the a2a peer name; the request-plane MCP / A2A readers ask the same function)
42
+ import { deepFreeze } from "./deep-freeze.js";
43
+ import { McpEntryCredential } from "./mcp-entry-credential.js"; // 29.0.0: the http entry's credential reference (the one reading = the engine primitives' readCredentialRef)
42
44
  // COARSE, best-effort literal-secret SHAPE detector (NOT exhaustive — the real boundary is the env-NAME schema
43
45
  // on structured fields). Rejected in free-form value fields (worker `env`, model `extraBody`), URL components,
44
46
  // AND as an env-NAME value (an AWS key id is a valid env-NAME charset yet is a secret VALUE, not a NAME). Case-
@@ -395,7 +397,7 @@ export const SealedApiKey = z.object({
395
397
  * 双向对拍 —— 多登记一行(键已经不透明了)红,少登记一行(新键静默溜进来)也红;派生遇到不认识的
396
398
  * schema 形 fail-loud,不「没认出来就当没有」。
397
399
  */
398
- export const PARSE_TRANSPARENT_KEYS = [
400
+ export const PARSE_TRANSPARENT_KEYS = deepFreeze([
399
401
  {
400
402
  domain: "models",
401
403
  path: "models[].compat",
@@ -424,20 +426,6 @@ export const PARSE_TRANSPARENT_KEYS = [
424
426
  validatedBy: "engine-ingest",
425
427
  why: "连接器条目声明的按工具轴覆盖层;轴的词表与形只有一只判官 = 引擎根导出 `readMcpToolAxes`(整声明一坏全拒、不默认),投影它的消费方(server 两腿)与写它的连接器都调它,本包只承载 —— 这里再写一份 zod 就是第二只判官,必漂。",
426
428
  },
427
- {
428
- domain: "mcp",
429
- path: "servers[].authForm",
430
- since: "12.2.0",
431
- validatedBy: "consumer",
432
- why: "连接器条目声明的认证形;词表与语义归读它的消费方(connectors 挂载读 / server 投影),本包只承载、不判语义。",
433
- },
434
- {
435
- domain: "mcp",
436
- path: "servers[].entryKind",
437
- since: "12.2.0",
438
- validatedBy: "consumer",
439
- why: "连接器条目声明的条目种类;词表与语义归读它的消费方(connectors 挂载读 / server 投影),本包只承载、不判语义。",
440
- },
441
429
  {
442
430
  domain: "entitlement",
443
431
  path: "subjects[].overrides[].value",
@@ -459,7 +447,7 @@ export const PARSE_TRANSPARENT_KEYS = [
459
447
  validatedBy: "engine-ingest",
460
448
  why: "引擎的逐服务器启动界(握手与首次工具列举各带它);它只有一只判官 = 引擎根导出的 `mcpStartupTimeoutMs`(是不是数、整数性、范围一并判;坏值在引擎的拨号门拒这一台服务器、点名 `config.mcp_startup_timeout_invalid`,其余服务器照挂),投影它的消费方在交给引擎之前可调同一只;本包只承载 —— 这里哪怕只判「是不是数」,也是第二只判官的一部分,与引擎那只各答各的。",
461
449
  },
462
- ];
450
+ ]);
463
451
  /** A catalog model's price / capability tier — fuels core 1.25 `selectModel({ tier })` role resolution. ONE closed set for both
464
452
  * places that name it (`ModelEntry.tier`, `RoleTarget.select.tier`). Not the tier-group ladder of {@link TierBindings}
465
453
  * (`ultra` … `lite`), which binds model NAMES to rungs. */
@@ -468,7 +456,7 @@ export const ModelTier = z.enum(["cheap", "standard", "premium"]);
468
456
  * 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
469
457
  * 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
470
458
  * keys from this table. */
471
- export const MODEL_THINKING_LEVEL_WORDS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
459
+ export const MODEL_THINKING_LEVEL_WORDS = deepFreeze(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
472
460
  /** 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
473
461
  * 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.) */
474
462
  const ThinkingLevelSpelling = z.string().min(1).nullable();
@@ -615,8 +603,8 @@ export const ModelEntry = z.object({
615
603
  // `consolidate` = 记忆整理(core FALLBACK consolidate→summarize)。
616
604
  // 两个词都**不进** roster 标记族(resolve-roster.ts):显式归 cheap 会让 server 把它钉死到 cheapRef,盖掉用户
617
605
  // `models.tiers.flash` 的档位与 core 兜底链 —— 新角色「不派生、走 core 兜底、只由 settings 显式钉」。
618
- // 12.0.0(硬破坏):`team` / `synthesize` 随 core 7.49.0 删掉(引擎对未知角色词响亮拒)—— 零别名、零双读;存着的这两个键由一次性迁移 SS-M8 删,
619
- // 迁移前到达判官的旧词拒句点名它(墓碑在 `./retired-role-words`)。`advisor`(teacher mode)本包从未收(没有消费方)。
606
+ // 12.0.0(硬破坏):`team` / `synthesize` 随 core 7.49.0 删掉(引擎对未知角色词响亮拒)—— 零别名、零双读;存着的这两个键到达判官时,
607
+ // 旧词拒句点名该词与出路(墓碑在 `./retired-role-words`)。`advisor`(teacher mode)本包从未收(没有消费方)。
620
608
  // 子集关系(本表 ⊆ 引擎角色表)由消费方服务端的型面对账钉住(本仓不依赖 core;dev 期的漂移门 ② 对拍 devDependency 那一版引擎)。
621
609
  export const ModelRole = z.enum(["default", "summarize", "subagent", "verifier", "classifier", "consolidate"], {
622
610
  error: (iss) => (iss.code === "invalid_value" ? retiredRoleWordsRefusal([iss.input]) : undefined),
@@ -627,7 +615,7 @@ export const RoleTarget = z.union([
627
615
  z.object({ select: z.object({ tier: ModelTier.optional(), needs: z.array(z.enum(["vision", "reasoning"])).optional(), prefer: z.enum(["cheapest", "premium"]).optional() }) }),
628
616
  ]);
629
617
  /** 角色 → 目标的图(`models.roles` 与 `rosters[].roles` 同一只)。键不认识 ⇒ zod 的「未知键」句;键里有 12.0.0 退役的角色词 ⇒ 那一句点名
630
- * 一次性迁移 SS-M8(同组别的未知键一并点名)。 */
618
+ * 该词与出路(同组别的未知键一并点名)。 */
631
619
  const RoleMap = z.partialRecord(ModelRole, RoleTarget, {
632
620
  // 枚举键的 record 在运行期以 `unrecognized_keys`(带 `keys`)报未知键,zod 的型面只列了 invalid_type / invalid_key —— 按运行期形读(钉:role-words-12.0.0)。
633
621
  error: (iss) => {
@@ -636,7 +624,7 @@ const RoleMap = z.partialRecord(ModelRole, RoleTarget, {
636
624
  },
637
625
  });
638
626
  /** {@link AtMention} 的模式闭集:`all` = 每个启用的模型都可 `@`;`none` = 一个都不许;`only` = 只许 `models` 里点名的那几个。 */
639
- export const AT_MENTION_MODES = ["all", "none", "only"];
627
+ export const AT_MENTION_MODES = deepFreeze(["all", "none", "only"]);
640
628
  /** 「`@` 能点名哪些模型」(11.0.0,取代 `atModelAllowlist`)。义由 `mode` 说,不由数组空不空说:旧形一个数组靠「缺席 / 空 / 非空」
641
629
  * 三种在场性背三种义,「一个都不许」表达不了,三个消费方各写了一只绕行。`only` 的名单至少一个名(空名单的义就是 `none`,一个义一种写法)。
642
630
  * 全局位(`models.atMention`)缺省 `{mode:"all"}`;roster 位(`rosters[].atMention`)缺席 = 继承全局。收窄到某台 worker 的模型集
@@ -839,14 +827,14 @@ export const ScenarioConfig = z
839
827
  // exclusively in the secret store (I1: audit/UI/API see fingerprints, never values).
840
828
  /** Platform credential surfaces a system may NEVER deliver into (红线1 — would let a publish overwrite the
841
829
  * platform's own secrets). Runtime delivery (S3) re-checks; this is the save-time half. */
842
- export const DELIVER_DENYLIST = new Set([
830
+ export const DELIVER_DENYLIST = deepFreeze(new Set([
843
831
  "a2-platform-secrets",
844
832
  "tidb-creds",
845
833
  "gitea-notify",
846
834
  "worker-secrets",
847
835
  // the orchestrator's OWN minted-token store (S2) — a system must never deliver into its credential source.
848
836
  "systems-credentials",
849
- ]);
837
+ ]));
850
838
  export const SystemEntry = z.object({
851
839
  /** System id = run.source value. Same shape the worker enforces for attribution. */
852
840
  name: z.string().regex(/^[a-z][a-z0-9-]{1,31}$/, "lowercase slug, 2-32 chars (a-z, 0-9, -)"),
@@ -933,12 +921,12 @@ export const SystemStatusEntry = z.object({
933
921
  /** retired 域的**墓碑表**:域名 → retired版本 / 事实今天住哪(/ 改写存量的一次性迁移,迁移还在时)。读存储文档的每个读者同判(`parseDomain` 拒写、`buildEffective`
934
922
  * 向店要retired 域、`readEffectiveWire` 看 wire、`FileConfigStore` 与 `readBundle` 读 `config.d/<名>.json`):文档**带事实**(在场且不是 `{}`)⇒ 响亮拒
935
923
  * (`RetiredDomainError`,句子点名今天的位);缺席或 `{}`(没有可丢的事实)⇒ 不理会。墓碑是拒,不是读法 —— 它不把旧文档读成任何值。 */
936
- export const RETIRED_DOMAINS = {
924
+ export const RETIRED_DOMAINS = deepFreeze({
937
925
  runtime: {
938
926
  retiredIn: "11.0.0",
939
927
  now: "governance (autonomy / commandPolicy / approvalRequire) and limits (rateLimitPerMin / maxTaskCostUsd / maxTaskTokens / maxPrincipalCostUsd / costQuotaWindowSec)",
940
928
  },
941
- };
929
+ });
942
930
  /** 是不是一个retired 域名(墓碑表成员)。 */
943
931
  export function isRetiredDomainName(x) {
944
932
  return typeof x === "string" && Object.prototype.hasOwnProperty.call(RETIRED_DOMAINS, x);
@@ -1034,11 +1022,11 @@ export const LimitsConfig = z.object({
1034
1022
  /** The autonomy ladder —— the closed set as a RUNTIME VALUE (same form as `REF_CHECKED_DOMAINS`): {@link AutonomyMode} (the zod enum)
1035
1023
  * and its type are DERIVED from this table, so a consumer that needs the words at runtime (an env parser, a catalog's enum column) imports
1036
1024
  * it instead of reaching into `GovernanceConfig.shape.autonomy.unwrap().options` or writing the four words again. */
1037
- export const AUTONOMY_MODES = ["read-only", "ask", "plan", "auto"];
1025
+ export const AUTONOMY_MODES = deepFreeze(["read-only", "ask", "plan", "auto"]);
1038
1026
  /** `governance.autonomy`'s enum, derived from {@link AUTONOMY_MODES}. */
1039
1027
  export const AutonomyMode = z.enum(AUTONOMY_MODES);
1040
1028
  /** A `commandPolicy[]` rule's decision —— the closed set as a RUNTIME VALUE; {@link CommandDecision} and its type are DERIVED from it. */
1041
- export const COMMAND_DECISIONS = ["allow", "ask", "deny"];
1029
+ export const COMMAND_DECISIONS = deepFreeze(["allow", "ask", "deny"]);
1042
1030
  /** `commandPolicy[].decision`'s enum, derived from {@link COMMAND_DECISIONS}. */
1043
1031
  export const CommandDecision = z.enum(COMMAND_DECISIONS);
1044
1032
  export const GovernanceConfig = z.object({
@@ -1217,7 +1205,7 @@ export const EntitlementRuntimeCaps = z.object({
1217
1205
  * `allow*` ceilings tighten toward `false` (disabled wins); `forceDurableGate` tightens toward `true` (forced
1218
1206
  * wins). Single source for the merge polarity so resolvers don't hardcode it. `Record<keyof …>` = a new cap
1219
1207
  * without an entry is a COMPILE error (no silent wrong-direction merge). */
1220
- export const RUNTIME_CAP_STRICT = {
1208
+ export const RUNTIME_CAP_STRICT = deepFreeze({
1221
1209
  allowBypassPermissions: false,
1222
1210
  allowAutoMode: false,
1223
1211
  allowWorkflows: false,
@@ -1227,7 +1215,7 @@ export const RUNTIME_CAP_STRICT = {
1227
1215
  allowUltracode: false,
1228
1216
  allowMemoryOptOut: false,
1229
1217
  forceDurableGate: true,
1230
- };
1218
+ });
1231
1219
  /** A named entitlement bundle (a `tier`, or a composable `role`). Bind a `roster` to inherit its model/skill/mcp
1232
1220
  * visibility for free; explicit allowlists intersect on top. Edit a tier once → re-prices everyone on it. */
1233
1221
  export const EntitlementTier = z.object({
@@ -1526,15 +1514,15 @@ export const PROJECT_ID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4
1526
1514
  /** The bounds of a project registration's free-form fields —— the ONE source of these numbers: the schema below reads them, and so do
1527
1515
  * the server's project routes and the admin / client forms (they import this, never copy a number). The path bound of `folder` / `file`
1528
1516
  * entries is the host-path judge's own ({@link ABSOLUTE_HOST_PATH_MAX}). */
1529
- export const PROJECT_LIMITS = {
1517
+ export const PROJECT_LIMITS = deepFreeze({
1530
1518
  displayNameMax: 200,
1531
1519
  goalMax: 2000,
1532
1520
  contextItemsMax: 64,
1533
1521
  noteMax: 4000,
1534
- };
1522
+ });
1535
1523
  /** A project context item's kind —— the closed set as a RUNTIME VALUE: `folder` / `file` = a host path (judged by the same
1536
1524
  * {@link isAbsoluteHostPath} as a task's `cwd`), `note` = free text. */
1537
- export const PROJECT_CONTEXT_ITEM_KINDS = ["folder", "file", "note"];
1525
+ export const PROJECT_CONTEXT_ITEM_KINDS = deepFreeze(["folder", "file", "note"]);
1538
1526
  /** A project's icon: a token (lowercase letter first, then lowercase letters / digits / `-`, at most 64). Absent = the default icon. */
1539
1527
  export const PROJECT_ICON_REGEX = /^[a-z][a-z0-9-]{0,63}$/;
1540
1528
  /** A project's colour: `#` + six lowercase hex digits. Absent = the default colour. */
@@ -1845,7 +1833,7 @@ const WEB_ADMIN_ASSERTION_SEAT = {
1845
1833
  token: "(injected by the orchestrator from the worker's assertion token — not configurable)",
1846
1834
  };
1847
1835
  const WEB_ADMIN_OPERATOR_FILE_SEAT = "(set directly by the operator on a hand-wired engine that is not managed by the orchestrator — never in a worker spec — not configurable)";
1848
- const RESERVED_ENV_FIELD = Object.freeze({
1836
+ const RESERVED_ENV_FIELD = deepFreeze({
1849
1837
  PORT: "(fixed at 8090 — not configurable)", MODEL_PROVIDER: "model.provider", MODEL_ID: "model.modelId",
1850
1838
  MODEL_REASONING: "model.reasoning", MODEL_CHEAP_ID: "model.cheapId", MODEL_MAX_TOKENS: "model.maxTokens",
1851
1839
  MODEL_CONTEXT_WINDOW: "model.contextWindow", MODEL_COST_INPUT: "model.cost.input", MODEL_COST_OUTPUT: "model.cost.output",
@@ -1880,7 +1868,7 @@ const RESERVED_ENV_FIELD = Object.freeze({
1880
1868
  });
1881
1869
  /** 结构化 WorkerSpec 字段已经产出的 env 名 —— 通用 `env` / `secretEnv` 逃生口**不许**设它们(用专属字段)。由
1882
1870
  * `RESERVED_ENV_FIELD`(名 → 唯一写位)的键派生;增删理由见那张表的头注。 */
1883
- export const RESERVED_WORKER_ENV = new Set(Object.keys(RESERVED_ENV_FIELD));
1871
+ export const RESERVED_WORKER_ENV = deepFreeze(new Set(Object.keys(RESERVED_ENV_FIELD)));
1884
1872
  /**
1885
1873
  * 保留名被 `env` / `secretEnv` 逃生口设置时的拒因:点名键 + 它的唯一写位。句尾恒是「set it via <字段>」(下游按它抽归属字段,不动)。
1886
1874
  * **迁移指路只有一条规则(7.0.1;16.0.0 起点名哪一条)**:这个键「旧形 ⇒ 一条还在的迁移能搬」(`LATE_LANE_ENV_KEYS`,与迁移读同一张表)就在键名后
@@ -2370,11 +2358,11 @@ export function workerRouteKey(w) {
2370
2358
  * 默认折算**同源引用这一份**(worker 无 requests 时按 S 折算,§2-4)。值为 k8s quantity 串,直接落
2371
2359
  * `WorkerSpec.resources`;「自定义」= 不用套餐、直接写 resources。定档口径:S=轻量单副本(默认档,略高于
2372
2360
  * backend 兜底 50m/128Mi 的真实工作水位);M=常规编码 agent;L=重载(大 repo/多并发 turn)。 */
2373
- export const WORKER_RESOURCE_PRESETS = {
2361
+ export const WORKER_RESOURCE_PRESETS = deepFreeze({
2374
2362
  S: { requests: { cpu: "250m", memory: "512Mi" }, limits: { cpu: "1", memory: "1Gi" } },
2375
2363
  M: { requests: { cpu: "500m", memory: "1Gi" }, limits: { cpu: "2", memory: "2Gi" } },
2376
2364
  L: { requests: { cpu: "1", memory: "2Gi" }, limits: { cpu: "4", memory: "4Gi" } },
2377
- };
2365
+ });
2378
2366
  export const WorkersConfig = z
2379
2367
  .object({ workers: z.array(WorkerSpec).prefault([]) })
2380
2368
  .superRefine((cfg, ctx) => {
@@ -2574,13 +2562,19 @@ const McpEnvRefs = credentialRefs(z.record(ENV_NAME, ENV_NAME)); // target ENV k
2574
2562
  // SAME invariant-① gap as worker.env / model.extraBody / mcp stdio command+args (credentials belong on the
2575
2563
  // VALUE side = an env-NAME ref, never the name). The token charset includes `%`, so an encoded secret could ride
2576
2564
  // the name — containsSecretToken percent-decodes, catching it too. ONE shared schema for every header-name field
2577
- // (headerRefs keys, principalHeader, assertionHeader). R19.
2565
+ // (headerRefs keys, principalHeader). R19.
2578
2566
  const HTTP_HEADER_NAME = z
2579
2567
  .string()
2580
2568
  .regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/, "must be an HTTP header NAME")
2581
2569
  .refine((s) => !containsSecretToken(s), buildQuotedIssue `HTTP header name must not contain a secret literal — credentials go in the env-NAME value, never the header name`);
2582
2570
  // Header NAME → ENV_NAME holding its value. Header names are tokens (RFC 7230) — not env-name-shaped.
2583
2571
  const McpHeaderRefs = credentialRefs(z.record(HTTP_HEADER_NAME, ENV_NAME));
2572
+ /** The retired `transport.assertionHeader` (29.0.0): one tombstone sentence for every face. */
2573
+ const MCP_ASSERTION_HEADER_RETIRED = {
2574
+ retiredIn: "29.0.0",
2575
+ migration: "SS-M13",
2576
+ now: 'transport.credentials = {"kind":"assertion","audience":"<connector id>"} (the audience is the connector id, used verbatim as the assertion\'s audience; the header is the engine\'s, no entry names it)',
2577
+ };
2584
2578
  export const McpTransport = z.discriminatedUnion("kind", [
2585
2579
  z.object({
2586
2580
  kind: z.literal("stdio"),
@@ -2612,14 +2606,15 @@ export const McpTransport = z.discriminatedUnion("kind", [
2612
2606
  * this is dynamic — the caller's principal, set per-request by the worker — so it's a header NAME, not an
2613
2607
  * env-NAME ref (no secret). Empty → the worker forwards no principal (server sees an anonymous call). */
2614
2608
  principalHeader: HTTP_HEADER_NAME.optional(),
2615
- /** 12.2.0 —— Header NAME the SERVICE fills with the CONNECTOR ASSERTION when proxying a tool call to this (hosted connector)
2616
- * server. Like `principalHeader` it is a header NAME, not an env-NAME ref (no secret), and it answers the same question
2617
- * — "which header carries the identity on this request" — with a different answer, so the two are MUTUALLY EXCLUSIVE:
2618
- * the entry-level check on {@link McpServerSpec} rejects both set. The name goes through the same judge
2619
- * ({@link HTTP_HEADER_NAME}) as `principalHeader` / `headerRefs` keys. This package judges only the SHAPE: how the assertion
2620
- * is minted and verified is the consumers' (connectors / server). Absent = no assertion header. On a stdio transport the key
2621
- * is stripped exactly as `principalHeader` is (the stdio member has no such key). */
2622
- assertionHeader: HTTP_HEADER_NAME.optional(),
2609
+ /** 29.0.0 —— the credential reference of a hosted connector entry: `{ kind: "assertion", audience: <connector id> }` ({@link McpEntryCredential}).
2610
+ * Read once by the engine primitives' `readCredentialRef` (the frozen copy it hands back is what this field holds); the admitted kinds are
2611
+ * `MCP_ENTRY_CREDENTIAL_KINDS` (only `assertion`); `audience` is the connector id, used verbatim as the assertion's audience. The header that
2612
+ * carries the assertion is the engine's (`MCP_ASSERTION_HEADER`) — no entry names it. Absent = no credential reference. Two entry-level rules on
2613
+ * {@link McpServerSpec}: not together with `principalHeader` (an assertion reference), not together with `headerRefs` (any kind: the engine
2614
+ * holds one reference per entry). */
2615
+ credentials: McpEntryCredential.optional(),
2616
+ /** Retired in 29.0.0 (it named the header for the connector assertion; the header is the engine's and the assertion is `credentials`). */
2617
+ assertionHeader: retiredKey("transport.assertionHeader", MCP_ASSERTION_HEADER_RETIRED),
2623
2618
  }),
2624
2619
  ]);
2625
2620
  /** The closed word table for {@link McpServerSpec}.contentOrigin — a MIRROR literal of the engine's
@@ -2627,7 +2622,7 @@ export const McpTransport = z.discriminatedUnion("kind", [
2627
2622
  * PROMPT_ARTIFACT_LIMITS a mirror constant); the mirror is pinned HERE, by its owner: the upstream drift gate
2628
2623
  * (group ⑥) asserts at compile time that this union and the engine type are the same in both directions, against the
2629
2624
  * engine the devDependency pins. Consumers import this table — they keep no copy of their own. */
2630
- export const MCP_CONTENT_ORIGINS = ["local", "execution", "external"];
2625
+ export const MCP_CONTENT_ORIGINS = deepFreeze(["local", "execution", "external"]);
2631
2626
  export const McpServerSpec = z.object({
2632
2627
  name: z.string().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/i, "letters/digits/._- , no spaces"),
2633
2628
  transport: McpTransport,
@@ -2693,20 +2688,17 @@ export const McpServerSpec = z.object({
2693
2688
  *
2694
2689
  * **解析透明** —— 形归谁校验、为什么不放这里:{@link PARSE_TRANSPARENT_KEYS}(`mcp.servers[].toolAxes`)。 */
2695
2690
  toolAxes: z.unknown().optional(),
2696
- /** 12.2.0 —— 连接器条目的认证形声明。缺席 = 不铸键;语义归消费方,本包只承载。
2697
- *
2698
- * **解析透明** —— 形归谁校验、为什么不放这里:{@link PARSE_TRANSPARENT_KEYS}(`mcp.servers[].authForm`)。 */
2699
- authForm: z.unknown().optional(),
2700
- /** 12.2.0 —— 连接器条目的种类声明。缺席 = 不铸键;语义归消费方,本包只承载。
2701
- *
2702
- * **解析透明** —— 形归谁校验、为什么不放这里:{@link PARSE_TRANSPARENT_KEYS}(`mcp.servers[].entryKind`)。 */
2703
- entryKind: z.unknown().optional(),
2704
2691
  notes: z.string().optional(),
2705
2692
  }).superRefine((s, ctx) => {
2706
- // 身份头二选一(12.2.0):`principalHeader` 与 `assertionHeader` 回答同一个问题「这台 http 服务器的请求上用哪个头送身份」—— 同设 = 两个答案。
2707
- // 互斥只在这一处判(拒句点名条目名,所以住条目层,不住传输层:传输层看不见 `name`)。
2708
- if (s.transport.kind === "http" && s.transport.principalHeader !== undefined && s.transport.assertionHeader !== undefined)
2709
- ctx.addIssue({ code: "custom", ...buildQuotedIssue `mcp server "${s.name}" sets both principalHeader and assertionHeader — an http entry names ONE header for the identity it sends: keep principalHeader (the end-user principal) or assertionHeader (the connector assertion), not both`, path: ["transport", "assertionHeader"] });
2693
+ // 29.0.0 —— two rules, one each, both in the entry layer (the sentence names the entry; the transport layer cannot see `name`):
2694
+ // · principalHeader ⊥ an assertion reference: the end-user principal header and a connector assertion answer "who is calling" twice;
2695
+ // · headerRefs ⊥ credentials (by presence, whatever the kind): the engine holds ONE credential reference per entry, and static header refs are minted into that same seat.
2696
+ if (s.transport.kind === "http" && s.transport.credentials !== undefined) {
2697
+ if (s.transport.principalHeader !== undefined && s.transport.credentials.kind === "assertion")
2698
+ ctx.addIssue({ code: "custom", ...buildQuotedIssue `mcp server "${s.name}" sets both principalHeader and an assertion reference in credentials — a hosted connector entry identifies its caller by the assertion: keep one of the two`, path: ["transport", "credentials"] });
2699
+ if (s.transport.headerRefs !== undefined)
2700
+ ctx.addIssue({ code: "custom", ...buildQuotedIssue `mcp server "${s.name}" sets both headerRefs and credentials — an entry carries one credential reference: keep one of the two`, path: ["transport", "credentials"] });
2701
+ }
2710
2702
  });
2711
2703
  export const McpConfig = z
2712
2704
  .object({ servers: z.array(McpServerSpec).prefault([]) })
@@ -2834,7 +2826,7 @@ export const PluginsConfig = z
2834
2826
  /** 引擎 `ARTIFACT_LIMITS` 的镜像常量(本包不带引擎运行期依赖 ⇒ 镜像)。对表钉在**镜像的属主**这里:上游漂移门 ⑤ 逐键 === devDependency 钉住的那只引擎的导出。
2835
2827
  * `maxOverlayTextBytes` / `maxTotalTextBytes` 引擎按 UTF-8 字节量;本包的 zod 按字符(UTF-16 码元)量 —— 码元数恒 ≤ UTF-8 字节数,所以本包的门恒宽于引擎、方向对。
2836
2828
  * `maxIntentChars` / `maxRefChars` / `maxSourceRevisionChars` 引擎按 Unicode 码点量;本包用 `withinCodePoints` 同一把尺(不用 zod 的 `.max()`,它的单位随 zod 版本变)。 */
2837
- export const PROMPT_ARTIFACT_LIMITS = {
2829
+ export const PROMPT_ARTIFACT_LIMITS = deepFreeze({
2838
2830
  maxOverlays: 64,
2839
2831
  maxOverlayTextBytes: 32_000,
2840
2832
  maxTotalTextBytes: 131_072,
@@ -2842,7 +2834,7 @@ export const PROMPT_ARTIFACT_LIMITS = {
2842
2834
  maxRefs: 32,
2843
2835
  maxRefChars: 500,
2844
2836
  maxSourceRevisionChars: 500,
2845
- };
2837
+ });
2846
2838
  /** 一个 binding 名(= 一次运行的场景名,`TaskSpec.promptBinding`)的长界 —— 引擎包根同名常量的镜像(对拍 = 上游漂移门 ⑤,逐值)。 */
2847
2839
  export const PROMPT_BINDING_MAX_CHARS = 128;
2848
2840
  /** 一张 `when.binding` 表至多点名几个 binding —— 引擎包根同名常量的镜像(同上)。 */
@@ -2991,7 +2983,7 @@ export const EffectivePromptsWire = z
2991
2983
  })
2992
2984
  .strict();
2993
2985
  // ── The domain registry ───────────────────────────────────────────────────────
2994
- export const DOMAIN_SCHEMAS = {
2986
+ export const DOMAIN_SCHEMAS = deepFreeze({
2995
2987
  models: ModelsConfig,
2996
2988
  rosters: RostersConfig,
2997
2989
  skills: SkillsConfig,
@@ -3010,7 +3002,7 @@ export const DOMAIN_SCHEMAS = {
3010
3002
  limits: LimitsConfig, // 0.19.0: cost/限流族热更新发布位(消费方 #322 批1;本地腿闭集缺口的源头修复)
3011
3003
  a2a: A2aConfig, // 18.0.0: 常驻出站 A2A 对端名册(便携;本地腿 config.d/a2a.json 与中心腿 /effective.a2a 同一个声明座;线上按在场性承运,见 WIRE_CARRIED_DOMAINS)
3012
3004
  // integrations + access: DELETED in 0.6.0 (EXPERT-REDESIGN §9) — parseDomain/effective/路由随之 404。
3013
- };
3005
+ });
3014
3006
  // ── Effective-config PROVENANCE (the unified shape TOC `sema config --effective` and TOB `/effective?principal=`
3015
3007
  // step-5 trace both emit, so "why is this value what it is" renders identically across both seats). Settled
3016
3008
  // via web-admin control-plane design gate③ (see web-admin control-plane design note §R2-T/§10). A pure
@@ -3049,7 +3041,7 @@ export const EffectiveKey = z.object({
3049
3041
  * 不在表里的域在 1.0.0 起就在域表上,支持面内的每个生产方都恒发;线上缺席读作契约缺省(与读店同一份缺省)。**之后加进域表的域进这张表**:
3050
3042
  * 比它旧的生产方必不发它,物化它就是替生产方编造一份「说了空」。读店 / 读 `config.d`(`EffectiveConfig`)不在本律内:那两腿的读者就是本包,恒懂每个域。
3051
3043
  */
3052
- export const WIRE_CARRIED_DOMAINS = ["prompts", "a2a"];
3044
+ export const WIRE_CARRIED_DOMAINS = deepFreeze(["prompts", "a2a"]);
3053
3045
  /** Reserved audit "domain" for RBAC/user-management events (not a config domain → no snapshot, not
3054
3046
  * rollback-able). Lets user changes share the one audit stream the Audit page already renders. */
3055
3047
  export const RBAC_AUDIT = "rbac";
@@ -3058,7 +3050,7 @@ export const RBAC_AUDIT = "rbac";
3058
3050
  export const SECRETS_AUDIT = "secrets";
3059
3051
  // Single source: derived from DOMAIN_SCHEMAS (insertion order = menu order) so the two can't drift —
3060
3052
  // adding a domain to DOMAIN_SCHEMAS is enough. Object.keys preserves declaration order.
3061
- export const DOMAINS = Object.keys(DOMAIN_SCHEMAS);
3053
+ export const DOMAINS = deepFreeze(Object.keys(DOMAIN_SCHEMAS));
3062
3054
  /** The canonical "is this a config domain?" predicate. Use it instead of hard-coding a domain list when
3063
3055
  * filtering arbitrary keys (e.g. a `config.d/` directory scan that also turns up the non-domain
3064
3056
  * `remote-exec.json`) — `remote-exec` is NOT a domain (it's the exec backend; see writeRemoteExec). */
@@ -9,15 +9,16 @@
9
9
  * 不是读设置时的事。
10
10
  */
11
11
  import { z } from "zod";
12
+ import { deepFreeze } from "./deep-freeze.js";
12
13
  /** 合法值闭集(声明序)。 */
13
- export const UI_LANGUAGE_VALUES = ["en", "zh"];
14
+ export const UI_LANGUAGE_VALUES = deepFreeze(["en", "zh"]);
14
15
  /** 这把键的声明:键名 / 值域 / 合并类 / 作用源 —— 三端读写键与值域都取这里。 */
15
- export const UI_LANGUAGE_SETTING = {
16
+ export const UI_LANGUAGE_SETTING = deepFreeze({
16
17
  key: "semaUiLanguage",
17
18
  values: UI_LANGUAGE_VALUES,
18
19
  category: "ui",
19
20
  source: "userSettings",
20
- };
21
+ });
21
22
  /** 值的形门(写侧用:写进设置文件的只能是这两个词之一)。 */
22
23
  export const UiLanguageSetting = z.enum(UI_LANGUAGE_VALUES);
23
24
  /** 整份 `settings.json` 里本片段负责的那一键;刻意 `passthrough`(本片段不是整份设置的闭集门)。 */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * **「这个 URL 的 userinfo 或 query / fragment 里,有没有名字在凭据名表上的参数」的名形判官**(14.5.0;lift 自 server `src/url-credential.ts`,规则、拒因词闭集与规则句逐字搬)。纯函数,零 import(除同包的 `./url-shape`),浏览器安全。
2
+ * **「这个 URL 的 userinfo 或 query / fragment 里,有没有名字在凭据名表上的参数」的名形判官**(14.5.0;lift 自 server `src/url-credential.ts`,规则、拒因词闭集与规则句逐字搬)。纯函数,除同包的 `./url-shape` 与包内私有的零 import 叶 `./deep-freeze` 外零 import,浏览器安全。
3
3
  *
4
4
  * ## 与 `NON_SECRET_URL`(`./types`)的关系:两个问题,互补,不是一个包含另一个
5
5
  * 本判官按**名**判 —— 参数叫什么(名字是凭据名 = 整名在 {@link CREDENTIAL_PARAM_NAMES} 上、或以表上的强档词收尾,见下「名字判定」;不论值长什么样);`NON_SECRET_URL` 的 `urlQueryFragmentHasSecret` 按**值形**判密钥 —— 值长得像密钥
@@ -37,15 +37,16 @@
37
37
  * 18.0.0 起本模块同表多一列 {@link COMPOUND_TAIL_STANCE}「这个词作为更长名字的末尾时算不算」:同一个 `Record<CredentialParamName, …>` 穷尽映射,表里加一个词而这一列不表态 ⇒ 编译红。
38
38
  * 消费方(脱敏器的三个名字读者、受理口判官)读的是 {@link credentialParamWordOf} 返回的词 —— 拿它去查自己那一列(例:锚强度),不再对整名查表。
39
39
  */
40
+ import { deepFreeze } from "./deep-freeze.js";
40
41
  import { httpUrlFlaws, httpUrlRule, isHierarchicalUrl } from "./url-shape.js";
41
42
  /** 拒因词(闭集;判序 = 本数组序;词只在这一处写 —— {@link UrlCredentialReason} 与 {@link UrlCredential} 的成员都从它派生)。 */
42
- export const URL_CREDENTIAL_REASONS = Object.freeze(["url_userinfo", "url_credential_param"]);
43
+ export const URL_CREDENTIAL_REASONS = deepFreeze(["url_userinfo", "url_credential_param"]);
43
44
  /**
44
45
  * 凭据参数名表(闭集,23 词,全部是小写 ASCII `[a-z][a-z0-9_-]*`)。query / fragment 里名字整名(ASCII 大小写不敏感)在这张表上的参数就是凭据;
45
46
  * 18.0.0 起以其中的强档词收尾的复合名也是(`db_password` 等,判由 {@link credentialParamWordOf})。
46
47
  * 加一个词 = 表里加一格(minor);判官与 {@link isCredentialParamName} 现算,不手抄第二份。
47
48
  */
48
- export const CREDENTIAL_PARAM_NAMES = Object.freeze([
49
+ export const CREDENTIAL_PARAM_NAMES = deepFreeze([
49
50
  "api_key", "apikey", "api-key", "key",
50
51
  "token", "access_token", "refresh_token", "id_token",
51
52
  "auth", "authorization", "proxy-authorization",
@@ -11,7 +11,7 @@
11
11
  * 部件按 WHATWG 序列化串(`href`)认:空 query `x?` 与空 fragment `x#` 在 `href` 里保留分隔符,`search` / `hash` 却是空串 ——
12
12
  * 只看后者会把它们放过去(改前本包 `NON_SECRET_URL` 正是这样收下了 `https://gw/v1#`)。
13
13
  *
14
- * 拒句里值的样子(展示铸点)不在本模块:那是各宿主自己的展示律(server `buildRefusalShownUrl`)。本模块零 import,纯函数,浏览器安全。
14
+ * 拒句里值的样子(展示铸点)不在本模块:那是各宿主自己的展示律(server `buildRefusalShownUrl`)。本模块只 import 包内私有的零 import 叶 `./deep-freeze`(全包闭集常量唯一的冻结入口),纯函数,浏览器安全。
15
15
  *
16
16
  * ## 本模块里的第二个答案(如实,14.0.0 起;14.6.0 把分歧写成读数)
17
17
  * 请求面 MCP 传输的 url(任务提交体 `mcpServers[i].transport.url`,`./mcp-request-entry`)今天不走上面的形判官,而是只看前缀
package/dist/url-shape.js CHANGED
@@ -11,7 +11,7 @@
11
11
  * 部件按 WHATWG 序列化串(`href`)认:空 query `x?` 与空 fragment `x#` 在 `href` 里保留分隔符,`search` / `hash` 却是空串 ——
12
12
  * 只看后者会把它们放过去(改前本包 `NON_SECRET_URL` 正是这样收下了 `https://gw/v1#`)。
13
13
  *
14
- * 拒句里值的样子(展示铸点)不在本模块:那是各宿主自己的展示律(server `buildRefusalShownUrl`)。本模块零 import,纯函数,浏览器安全。
14
+ * 拒句里值的样子(展示铸点)不在本模块:那是各宿主自己的展示律(server `buildRefusalShownUrl`)。本模块只 import 包内私有的零 import 叶 `./deep-freeze`(全包闭集常量唯一的冻结入口),纯函数,浏览器安全。
15
15
  *
16
16
  * ## 本模块里的第二个答案(如实,14.0.0 起;14.6.0 把分歧写成读数)
17
17
  * 请求面 MCP 传输的 url(任务提交体 `mcpServers[i].transport.url`,`./mcp-request-entry`)今天不走上面的形判官,而是只看前缀
@@ -24,8 +24,9 @@
24
24
  * `httpUrlFlaws(url, [座位禁的部件]).length === 0`(形与部件归本判官)—— 只收紧,不放宽;座位禁不禁 userinfo 是同一次 major 里要定的另一格(读器的拒句已写着凭据别放 URL)。
25
25
  * 这个前缀守卫放在这里,是为了让「本包里判 URL 的正则」只有这一个模块。
26
26
  */
27
+ import { deepFreeze } from "./deep-freeze.js";
27
28
  /** 座位可以禁掉的部件(闭集;判序 = 本数组序)。 */
28
- export const HTTP_URL_PARTS = ["userinfo", "query", "fragment"];
29
+ export const HTTP_URL_PARTS = deepFreeze(["userinfo", "query", "fragment"]);
29
30
  /** 「不是一个 http(s) URL」的规则句 —— 不透明形、不可解析、层级式非 http(s) 同一句;只点名规则,不回显 scheme。 */
30
31
  export const HTTP_URL_SHAPE_RULE = "is not a parseable http(s) URL (scheme must be http or https; it must look like http(s)://host[:port][/path])";
31
32
  /**
@@ -65,7 +66,7 @@ export function httpUrlFlaws(raw, forbid) {
65
66
  * 词表加词时此处要显式裁(加进来还是明确不加),不会静默多禁一件。冻结:判官读的就是消费方手里的这一只。
66
67
  * 按座位的本质命名,不按某个消费键名:谁的座位是「后面要拼路径的基址」,谁读它,不各自抄词。
67
68
  */
68
- export const PATH_BASE_URL_FORBIDDEN_PARTS = Object.freeze(["userinfo", "query", "fragment"]);
69
+ export const PATH_BASE_URL_FORBIDDEN_PARTS = deepFreeze(["userinfo", "query", "fragment"]);
69
70
  /**
70
71
  * **「逐字发给拨号方的地址」座位禁用的部件**(闭集、冻结、判序;16.0.0)。一个值若是被**逐字发布**、由别人原样去拨的地址(device 车道的设备入口
71
72
  * `DEVICE_RELAY_URL`:引擎把它原样放上能力面,设备拨它):`userinfo` 把凭据发给每个读得到那张能力面的人;`query` / `fragment` 是令牌最常落的位置 ——
@@ -73,7 +74,7 @@ export const PATH_BASE_URL_FORBIDDEN_PARTS = Object.freeze(["userinfo", "query",
73
74
  * 与 {@link PATH_BASE_URL_FORBIDDEN_PARTS} 今天同三词,但理由不同、各自裁:那一张管「往后拼路径会落错位」,这一张管「发布出去的地址里不留凭据位」——
74
75
  * 一个座位改禁哪件,不连带另一个。策略集独立于判官词表 {@link HTTP_URL_PARTS},同上一张的规矩。
75
76
  */
76
- export const DIAL_ADDRESS_URL_FORBIDDEN_PARTS = Object.freeze(["userinfo", "query", "fragment"]);
77
+ export const DIAL_ADDRESS_URL_FORBIDDEN_PARTS = deepFreeze(["userinfo", "query", "fragment"]);
77
78
  /**
78
79
  * 「后面要拼路径的基址」座位的判:`[]` = 合格,否则按判序交回规则词 —— 就是 {@link httpUrlFlaws} 配 {@link PATH_BASE_URL_FORBIDDEN_PARTS},
79
80
  * 不另写判法;规则词的句子取 {@link httpUrlRule}。答案只有词,不含值的任何片段。判**占位展开之后**的值:`http://$(POD_IP):8090` 过
@@ -26,6 +26,7 @@ import { buildQuotedIssue } from "./quoted-issue.js";
26
26
  import { RFC3339_DATE_TIME } from "./rfc3339.js"; // the package's one RFC 3339 date-time judge (a project registration's `archivedAt` reads the same one)
27
27
  import { WEB_ADMIN_ENV } from "./web-admin-env.js";
28
28
  import { guardedSafeParse } from "./own-key-read.js"; // the one guarded zod verdict (parse + building its error in one guard)
29
+ import { deepFreeze } from "./deep-freeze.js";
29
30
  /** 信封 `kind` 的闭集今只有一员(`SEALED_BOX_ALG` 同式的字面常量:schema 的字面与读方的比较都引它)。 */
30
31
  export const WEB_ADMIN_CREDENTIAL_ENVELOPE_KIND = "user-session";
31
32
  /** 一枚**令牌串**的形 —— 裸行 bearer、信封里的 `accessToken` / `refreshToken` 共用这**一条**律:可打印 ASCII
@@ -113,7 +114,7 @@ export function parseWebAdminCredentialFile(text) {
113
114
  // ── 凭证二选一判官(每份凭证读 {@link WEB_ADMIN_ENV} 里的一对键:值键 | 文件键)────────────────────────────
114
115
  /** 引擎向 web-admin 出示的凭证 —— 闭集;每一份由 {@link WEB_ADMIN_ENV} 里的**一对** env 名声明(值键 | 文件键):
115
116
  * `access` = 主凭证(`token` / `tokenFile`),`assertion` = 断言令牌(`assertionToken` / `assertionTokenFile`)。 */
116
- export const WEB_ADMIN_CREDENTIALS = ["access", "assertion"];
117
+ export const WEB_ADMIN_CREDENTIALS = deepFreeze(["access", "assertion"]);
117
118
  /** 每份凭证的那一对键名。键是闭集的每一员(`Record` 穷举:闭集加一员而这里不给一对 = 编译错)。 */
118
119
  const CREDENTIAL_ENV_PAIRS = {
119
120
  access: { value: WEB_ADMIN_ENV.token, file: WEB_ADMIN_ENV.tokenFile },
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 引擎连 web-admin 读的**全部 env 名** —— 一处定义(叶模块,零 import:凭证判官、墓碑表与 worker 保留名表都引它);server 读、web-admin 给 worker 渲染、壳给本机引擎写,三方 import。
2
+ * 引擎连 web-admin 读的**全部 env 名** —— 一处定义(叶模块,只 import 包内私有的零 import 叶 `./deep-freeze`:凭证判官、墓碑表与 worker 保留名表都引它);server 读、web-admin 给 worker 渲染、壳给本机引擎写,三方 import。
3
3
  * 键名是部署面,手抄的键名会静默漂(此前只有 `token` / `tokenFile` 有契约位,其余六个各仓手抄)。读方只读这张表里的名字,
4
4
  * 旧名一概不读(零双读):旧名是 `RETIRED_ENVS` 里的墓碑,在场即拒启。
5
5
  *
@@ -1,5 +1,6 @@
1
+ import { deepFreeze } from "./deep-freeze.js";
1
2
  /**
2
- * 引擎连 web-admin 读的**全部 env 名** —— 一处定义(叶模块,零 import:凭证判官、墓碑表与 worker 保留名表都引它);server 读、web-admin 给 worker 渲染、壳给本机引擎写,三方 import。
3
+ * 引擎连 web-admin 读的**全部 env 名** —— 一处定义(叶模块,只 import 包内私有的零 import 叶 `./deep-freeze`:凭证判官、墓碑表与 worker 保留名表都引它);server 读、web-admin 给 worker 渲染、壳给本机引擎写,三方 import。
3
4
  * 键名是部署面,手抄的键名会静默漂(此前只有 `token` / `tokenFile` 有契约位,其余六个各仓手抄)。读方只读这张表里的名字,
4
5
  * 旧名一概不读(零双读):旧名是 `RETIRED_ENVS` 里的墓碑,在场即拒启。
5
6
  *
@@ -20,7 +21,7 @@
20
21
  * `env` 里写它们,会与渲染器写的值打架。断言令牌的值键 `assertionToken` 也是保留名(由编排器注入);两把凭证的文件键(`tokenFile` / `assertionTokenFile`)同样是保留名:
21
22
  * 只给不经编排器的手接引擎、由运维直设,与同一份凭证的值键互斥,规格里写任一个都与注入撞。
22
23
  */
23
- export const WEB_ADMIN_ENV = {
24
+ export const WEB_ADMIN_ENV = deepFreeze({
24
25
  url: "SEMA_WEB_ADMIN_URL",
25
26
  token: "SEMA_WEB_ADMIN_TOKEN",
26
27
  tokenFile: "SEMA_WEB_ADMIN_TOKEN_FILE",
@@ -31,4 +32,4 @@ export const WEB_ADMIN_ENV = {
31
32
  adminToken: "SEMA_WEB_ADMIN_ADMIN_TOKEN",
32
33
  assertionToken: "SEMA_WEB_ADMIN_ASSERTION_TOKEN",
33
34
  assertionTokenFile: "SEMA_WEB_ADMIN_ASSERTION_TOKEN_FILE",
34
- };
35
+ });