@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
@@ -1,2 +1,2 @@
1
1
  import type { ConfigDirectoryIo } from "./config-dir-migration.js";
2
- export declare const nodeConfigDirectoryIo: ConfigDirectoryIo;
2
+ export declare const nodeConfigDirectoryIo: Readonly<ConfigDirectoryIo>;
@@ -6,8 +6,9 @@
6
6
  */
7
7
  import { readdir, readFile } from "node:fs/promises";
8
8
  import { resolveSymlinkTarget, writeFileAtomic } from "./atomic-write.js";
9
- export const nodeConfigDirectoryIo = {
9
+ import { deepFreeze } from "./deep-freeze.js";
10
+ export const nodeConfigDirectoryIo = deepFreeze({
10
11
  readDir: async (path) => readdir(resolveSymlinkTarget(path)),
11
12
  readFile: async (path) => readFile(resolveSymlinkTarget(path), "utf8"),
12
13
  writeFileAtomic: async (path, text) => writeFileAtomic(path, text, "config-document"), // the files this migration writes are config.d domain documents
13
- };
14
+ });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * 契约的文件层拒一份 `config.d` 文档时交出的**类型化拒**(15.2.0)。纯数据与类型,零 node 依赖、零运行期 import —— 词表在包根,读目录的口(`FileConfigStore.read()`,16.0.0)在 `./node`。
2
+ * 契约的文件层拒一份 `config.d` 文档时交出的**类型化拒**(15.2.0)。纯数据与类型,零 node 依赖,运行期只 import 包内私有的零 import 叶 `./deep-freeze` —— 词表在包根,读目录的口(`FileConfigStore.read()`,16.0.0)在 `./node`。
3
3
  *
4
4
  * ## 为什么
5
5
  * 文件层读一份文档只有抛一句话的出口:句子不带结构化的文档名,也分不出「空 / 坏 JSON / 不是对象 / 读不出」;并发读时一次只抛第一个到达的坏文档;
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * ## 形
12
12
  * 一条拒 = `{ document, reason, error }`:
13
- * · `document`:被拒的文档 —— 便携域名,或 retired 域名(retired 域的文档就以域名相称,墓碑拒的「域」就是这个名字,不另设第二个键);
13
+ * · `document`:被拒的文档 —— 本地读取域名(便携域名或 `projects`),或 retired 域名(retired 域的文档就以域名相称,墓碑拒的「域」就是这个名字,不另设第二个键);
14
14
  * · `reason`:闭集词 {@link CONFIG_DOCUMENT_REFUSAL_REASONS}。文件层五个 —— `empty`(空 / 纯空白:半写、截断)· `invalid_json`(JSON 解析不过)· `not_object`(解析出来不是 JSON 对象:
15
15
  * `null` / 数组 / 数 / 串 / 布尔)· `io`(在场却读不出:权限、路径是目录、I/O 错误、悬空的符号链接〔文档本身或 `config.d` 目录:链接在、目标不在,17.0.0 起;句子点名链接与出路〕;缺席 = 路径上没有任何条目,不是拒)· `too_deep`(16.0.0:嵌套深过整棵目录的内容版本能算的深度 ——
16
16
  * 此前它在算版本那一步抛,已经收集的拒一并丢掉);第六个 `retired_domain` 是墓碑(retired 域文档带事实);
@@ -19,13 +19,13 @@
19
19
  * · 墓碑拒的 `document` 恒是 retired 域名(26.0.0 起不再另带 `migration`:改写存量的一次性迁移到期删了,那一格没有来源)。
20
20
  * 词表是闭集:消费方用 `switch (refusal.reason)` 穷举,加词 ⇒ 它们编译红(这是通知)。
21
21
  */
22
- import type { PortableDomain } from "./portable-domains.js";
22
+ import type { LocalReadDomain } from "./portable-domains.js";
23
23
  import type { RetiredDomainName } from "./types.js";
24
24
  /** 文件层拒一份文档的闭集词:五个文件层成因 + 墓碑(恒在末位)。墓碑那个词就是 `RetiredDomainError.code`(一个词,不立第二个名)。 */
25
25
  export declare const CONFIG_DOCUMENT_REFUSAL_REASONS: readonly ["empty", "invalid_json", "not_object", "io", "too_deep", "retired_domain"];
26
26
  export type ConfigDocumentRefusalReason = (typeof CONFIG_DOCUMENT_REFUSAL_REASONS)[number];
27
- /** 能被拒的 `config.d` 文档:便携域的文档,或retired 域的文档(读它只为墓碑)。 */
28
- export type ConfigDocumentName = PortableDomain | RetiredDomainName;
27
+ /** 能被拒的 `config.d` 文档:本地读取域({@link LocalReadDomain})的文档,或retired 域的文档(读它只为墓碑)。 */
28
+ export type ConfigDocumentName = LocalReadDomain | RetiredDomainName;
29
29
  /** 被拒的一份文档(按 `reason` 判别):`{ document, reason, error }`;墓碑拒的文档名恒是 retired 域名。 */
30
30
  export type ConfigDocumentRefusal = {
31
31
  readonly document: ConfigDocumentName;
@@ -1,2 +1,3 @@
1
+ import { deepFreeze } from "./deep-freeze.js";
1
2
  /** 文件层拒一份文档的闭集词:五个文件层成因 + 墓碑(恒在末位)。墓碑那个词就是 `RetiredDomainError.code`(一个词,不立第二个名)。 */
2
- export const CONFIG_DOCUMENT_REFUSAL_REASONS = ["empty", "invalid_json", "not_object", "io", "too_deep", "retired_domain"];
3
+ export const CONFIG_DOCUMENT_REFUSAL_REASONS = deepFreeze(["empty", "invalid_json", "not_object", "io", "too_deep", "retired_domain"]);
@@ -44,7 +44,7 @@ export interface WorkerLifecycleRecord {
44
44
  }
45
45
  /** RBAC roles, hierarchical: viewer < editor < publisher < admin. */
46
46
  export type UserRole = "viewer" | "editor" | "publisher" | "admin";
47
- export declare const ROLE_RANK: Record<UserRole, number>;
47
+ export declare const ROLE_RANK: Readonly<Record<UserRole, number>>;
48
48
  export declare const USER_ROLES: readonly UserRole[];
49
49
  /** True if `role` is at least `min` in the hierarchy (e.g. publisher satisfies editor). */
50
50
  export declare function roleAtLeast(role: UserRole, min: UserRole): boolean;
@@ -57,7 +57,7 @@ export declare function isRole(v: unknown): v is UserRole;
57
57
  * {@link writeRoleFor}, which also looks at WHICH fields a write changes ({@link DOMAIN_FIELD_WRITE_ROLE}).
58
58
  */
59
59
  export declare const DEFAULT_DOMAIN_WRITE_ROLE: UserRole;
60
- export declare const DOMAIN_WRITE_ROLE: Partial<Record<DomainName, UserRole>>;
60
+ export declare const DOMAIN_WRITE_ROLE: Readonly<Partial<Record<DomainName, UserRole>>>;
61
61
  /**
62
62
  * The per-field write roles of a domain whose document is a record of entries: ONE role for each field of an entry, exhaustive for the entry's
63
63
  * shape (the table is `satisfies`-checked against the entry type, so a field added to the entry without a role is a compile error — a new field
@@ -72,7 +72,7 @@ export interface DomainFieldWriteRoles {
72
72
  * one row per domain, an absent row means "the floor decides" — read only through {@link writeRoleFor}; the changed fields come from
73
73
  * {@link changedWriteFields} (the one place that diffs two documents against this table).
74
74
  */
75
- export declare const DOMAIN_FIELD_WRITE_ROLE: Partial<Record<DomainName, DomainFieldWriteRoles>>;
75
+ export declare const DOMAIN_FIELD_WRITE_ROLE: Readonly<Partial<Record<DomainName, DomainFieldWriteRoles>>>;
76
76
  /**
77
77
  * The minimum role to make a write that changes exactly `changedFields` in `domain`: the HIGHEST of the domain's floor ({@link DOMAIN_WRITE_ROLE},
78
78
  * else {@link DEFAULT_DOMAIN_WRITE_ROLE}) and the role of each changed field ({@link DOMAIN_FIELD_WRITE_ROLE}). `[]` = a write that changes no
@@ -447,7 +447,7 @@ export type EffectiveReadWarning = {
447
447
  identity?: DroppedEntryIdentity;
448
448
  reasonCode?: DroppedEntryReasonCode;
449
449
  }
450
- /** `config.d/` 里存在、但本地读取集**永远不会读**的文件(名字不是域,或是域但不便携)。 */
450
+ /** `config.d/` 里存在、但本地读取集(`LOCAL_READ_DOMAINS`)**永远不会读**的文件:名字不是域(`not-a-domain`),或是域但不在本地读取集里(`non-portable-domain`:已发的闭集词,今天说的是 workers / hosts / systems / entitlement;`projects` 29.0.0 起在读取集里,被读)。 */
451
451
  | {
452
452
  kind: "unread-config-file";
453
453
  file: string;
@@ -554,7 +554,7 @@ export interface ExtensionNamespaceRule {
554
554
  readonly owner: string;
555
555
  readonly since: string;
556
556
  }
557
- export declare const EXTENSION_NAMESPACES: Partial<Record<DomainName, ReadonlyArray<ExtensionNamespaceRule>>>;
557
+ export declare const EXTENSION_NAMESPACES: Readonly<Partial<Record<DomainName, ReadonlyArray<ExtensionNamespaceRule>>>>;
558
558
  /** 该键是否落在 {@link EXTENSION_NAMESPACES} 登记的扩展命名空间里(⇒ 不是未知键)。**分段匹配**:`at` 对
559
559
  * 父路径的段(长度相等 ∧ 逐段——{@link ANY_INDEX} 匹配任一**数字**段,字符串段逐字相等;顶层 = `[]`),`key` 对键名
560
560
  * 本身——键名里可以含 `.`(`semaX.foo` 是一个键不是两层),段形让这件事不必再靠文法猜;前缀契约就是前缀
@@ -25,6 +25,7 @@ import { carriesUserinfo, secretScanForms } from "./secret-scan.js"; // package-
25
25
  import { sha256Hex } from "./sha256.js";
26
26
  import { unwrapSchema } from "./zod-unwrap.js"; // package-private: the ONE reading of zod's wrapper layers (salvage + the one-time migrations share it)
27
27
  import { DOMAIN_SCHEMAS, InfraCostRates, LimitsConfig, PRIVATE_KEY_PEM_HEADER, RETIRED_DOMAINS, SkillsManifestSchema, WIRE_CARRIED_DOMAINS, containsSecretToken, isDomainName, isRetiredDomainName, renderQuotedSentence, retiredDomainSentence } from "./types.js";
28
+ import { deepFreeze } from "./deep-freeze.js";
28
29
  /** Redact secret-shaped tokens from a validation MESSAGE — a zod error echoes the offending value (e.g.
29
30
  * `received 'sk-live-…'`), so a secret pasted into the WRONG field would leak via the error string. Redacts
30
31
  * space-spanning auth credentials (`Bearer <token>`) FIRST (the token pass can't see across the space), then
@@ -153,8 +154,8 @@ function sanitizeIssueValue(v, depth) {
153
154
  }
154
155
  }
155
156
  }
156
- export const ROLE_RANK = { viewer: 0, editor: 1, publisher: 2, admin: 3 };
157
- export const USER_ROLES = ["viewer", "editor", "publisher", "admin"];
157
+ export const ROLE_RANK = deepFreeze({ viewer: 0, editor: 1, publisher: 2, admin: 3 });
158
+ export const USER_ROLES = deepFreeze(["viewer", "editor", "publisher", "admin"]);
158
159
  /** True if `role` is at least `min` in the hierarchy (e.g. publisher satisfies editor). */
159
160
  export function roleAtLeast(role, min) {
160
161
  return ROLE_RANK[role] >= ROLE_RANK[min];
@@ -170,7 +171,7 @@ export function isRole(v) {
170
171
  * {@link writeRoleFor}, which also looks at WHICH fields a write changes ({@link DOMAIN_FIELD_WRITE_ROLE}).
171
172
  */
172
173
  export const DEFAULT_DOMAIN_WRITE_ROLE = "editor";
173
- export const DOMAIN_WRITE_ROLE = {
174
+ export const DOMAIN_WRITE_ROLE = deepFreeze({
174
175
  skills: "publisher",
175
176
  mcp: "publisher",
176
177
  // plugins are an EXECUTABLE surface (commands/hooks/MCP ride in via the materialized plugin) — the same
@@ -205,7 +206,7 @@ export const DOMAIN_WRITE_ROLE = {
205
206
  // carry its credentials — the same executable-surface + credential-reference profile as mcp, so the same raised gate.
206
207
  // Written out (not left to the default) because the default would be the WRONG answer here.
207
208
  a2a: "publisher",
208
- };
209
+ });
209
210
  /**
210
211
  * `projects`: a registration's identity fields are an index and stay with the floor (`editor`); its CONTENT fields are what the project hands
211
212
  * to the agent — `goal` and `notes` ride into the system prompt, `contextItems` carries folder / file entries the task's workspace and
@@ -235,9 +236,9 @@ const PROJECT_FIELD_WRITE_ROLE = {
235
236
  * one row per domain, an absent row means "the floor decides" — read only through {@link writeRoleFor}; the changed fields come from
236
237
  * {@link changedWriteFields} (the one place that diffs two documents against this table).
237
238
  */
238
- export const DOMAIN_FIELD_WRITE_ROLE = {
239
+ export const DOMAIN_FIELD_WRITE_ROLE = deepFreeze({
239
240
  projects: { entries: "projects", fields: PROJECT_FIELD_WRITE_ROLE },
240
- };
241
+ });
241
242
  /**
242
243
  * The minimum role to make a write that changes exactly `changedFields` in `domain`: the HIGHEST of the domain's floor ({@link DOMAIN_WRITE_ROLE},
243
244
  * else {@link DEFAULT_DOMAIN_WRITE_ROLE}) and the role of each changed field ({@link DOMAIN_FIELD_WRITE_ROLE}). `[]` = a write that changes no
@@ -424,7 +425,7 @@ function outgoingSegment(seg) {
424
425
  * 满射格(每个词至少有一个真丢弃点触发它 = 没有死词;每个被丢条目的词都在表里 = 没有无词的丢弃点)。
425
426
  * 读路径上剔条目的只有 `salvageEntries` 这一处(11.0.0 起 hosts 的读侧夹紧臂已retired),所以本表覆盖读路径上每一条被丢的条目。
426
427
  */
427
- export const DROPPED_ENTRY_REASON_CODES = ["entry-schema-invalid", "entry-key-invalid", "entry-unreadable", "entry-unknown-key"];
428
+ export const DROPPED_ENTRY_REASON_CODES = deepFreeze(["entry-schema-invalid", "entry-key-invalid", "entry-unreadable", "entry-unknown-key"]);
428
429
  /** 可披露身份与出门坐标段的**长度上界**(一只常量,两处用:{@link DISCLOSABLE_IDENTITY_RE} 的上限、{@link outgoingSegment}
429
430
  * 的「超长不扫描」界)。与 web-admin 读侧名长上限 256 对齐。 */
430
431
  const DISCLOSABLE_IDENTITY_MAX = 256;
@@ -521,7 +522,7 @@ function droppedEntry(path, verdict, entry) {
521
522
  return identity === undefined ? base : { ...base, identity };
522
523
  }
523
524
  /** 一次「什么都没丢」的抢救的位移表(冻结的共享空表 —— {@link rebaseWarningPaths} 对它恒等)。 */
524
- const NO_ENTRIES_DROPPED = Object.freeze({});
525
+ const NO_ENTRIES_DROPPED = deepFreeze({});
525
526
  /** 一个域的校验过程抛了(恶意 getter / Proxy 陷阱 / 校验器自己对怪形值做类型转换)⇒ 给调用方的那一句中性话:不带抛出值的文案(可能带 secret),类是 `TypeError`(调用方给的值读不出是调用方的错)。 */
526
527
  function unreadableDomainError(domain) {
527
528
  return new TypeError(`invalid "${domain}" config (a value could not be read during validation)`);
@@ -763,13 +764,13 @@ export function statusRowsToPrune(rows, opts) {
763
764
  * (给联合加一条新臂,实测这三处各红一条,`satisfies` 那行零诊断);而「新 kind 三处都处置了、却忘了登记
764
765
  * 进本表」这半条缝,由 `test/warning-projection-derived-4.0.0.test.ts` 的闭集格看着(本表 == 从 AST 解出的
765
766
  * 臂集,逐字同集同序)。 */
766
- export const WARNING_KINDS = [
767
+ export const WARNING_KINDS = deepFreeze([
767
768
  "domain-defaulted",
768
769
  "unknown-keys-dropped",
769
770
  "unknown-keys-carried",
770
771
  "entry-dropped",
771
772
  "unread-config-file",
772
- ];
773
+ ]);
773
774
  /**
774
775
  * 一条告警 → 它的投影。**闭集穷举**:新 kind 不在这里表态就编译红(#157 的闭集纪律);而字段级的对齐由
775
776
  * {@link WarningProjection} 的派生保证 —— 少铸一个字段,这里就是编译红。
@@ -922,9 +923,9 @@ const DROP_SCAN_MAX_KEYS = 64;
922
923
  * 这两件事零二义,而且字面 `"#"` 仍然是一个可登记的普通段。类型上也不塌:`readonly (string | "#")[]`
923
924
  * 会被 TS 收成 `readonly string[]`(写错通配不编译红),`readonly (string | typeof ANY_INDEX)[]` 不会。 */
924
925
  export const ANY_INDEX = Symbol("settings-schema/any-index");
925
- export const EXTENSION_NAMESPACES = {
926
+ export const EXTENSION_NAMESPACES = deepFreeze({
926
927
  models: [{ at: ["models", ANY_INDEX], key: /^sema[A-Z]/, owner: "cli", since: "shell key census design/cli-190c (2026-08-26)" }],
927
- };
928
+ });
928
929
  /** 该键是否落在 {@link EXTENSION_NAMESPACES} 登记的扩展命名空间里(⇒ 不是未知键)。**分段匹配**:`at` 对
929
930
  * 父路径的段(长度相等 ∧ 逐段——{@link ANY_INDEX} 匹配任一**数字**段,字符串段逐字相等;顶层 = `[]`),`key` 对键名
930
931
  * 本身——键名里可以含 `.`(`semaX.foo` 是一个键不是两层),段形让这件事不必再靠文法猜;前缀契约就是前缀
@@ -1354,7 +1355,7 @@ function announceUnknownKeys(domain, raw, parsed, emit) {
1354
1355
  * strictly better); WORSE, the claim write face is read-modify-write — reading a defaulted-empty
1355
1356
  * ledger and writing it back would CLOBBER existing registrations down to one entry (data loss,
1356
1357
  * one layer beyond the rosters "放权" rationale). */
1357
- export const DOMAIN_READ_FALLBACK = {
1358
+ export const DOMAIN_READ_FALLBACK = deepFreeze({
1358
1359
  models: "default",
1359
1360
  rosters: "throw",
1360
1361
  skills: "throw", // 24.0.0:空 skills = 被中心按名覆盖的出厂技能全部回位(带回它们自己的 allow 名单),不是 fail-closed;与 DOMAIN_ENTRY_SALVAGE 的 none 同一理由
@@ -1378,7 +1379,7 @@ export const DOMAIN_READ_FALLBACK = {
1378
1379
  limits: "throw",
1379
1380
  // a2a(18.0.0):能力目录(同 mcp)—— 整域读不进 ⇒ 空名册 = 不拨任何对端(能力消失,fail-closed;没有闸因此丢掉)。
1380
1381
  a2a: "default",
1381
- };
1382
+ });
1382
1383
  /** Per-domain ENTRY-SALVAGE policy (12.3.0, S-1494) — may the view-face domain reader ({@link parseDomainSalvaged}) drop single bad
1383
1384
  * entries (an array element, a Record value, and — recursively — a bad entry inside a surviving entry) and read the rest?
1384
1385
  * **One question only**: what happens when the domain stays unreadable after that is {@link DOMAIN_READ_FALLBACK}'s question.
@@ -1439,7 +1440,7 @@ export const DOMAIN_READ_FALLBACK = {
1439
1440
  * - a2a: SALVAGE (18.0.0) — the peer roster is a capability catalog like mcp: a dropped peer is one remote agent fewer. A peer's
1440
1441
  * credential references (`headerRefs`) are a value collection: a bad reference drops the whole peer, never the reference
1441
1442
  * alone (a peer kept with half of its credentials is the wrong failure direction). */
1442
- export const DOMAIN_ENTRY_SALVAGE = {
1443
+ export const DOMAIN_ENTRY_SALVAGE = deepFreeze({
1443
1444
  models: "salvage", // 留:条目 = 一个目录模型(及 `roles` 里的一个角色覆盖);缺席 = 少一个模型 / 一个角色回落到缺省 —— 选路变了,可达面没变(被引用的模型缺席 ⇒ 引用悬空 ⇒ 整域缺省,既有律)
1444
1445
  rosters: "none", // 收:条目 = 一台 worker 的模型名册;缺席 ⇒ 该 worker 回落到整份目录 = 放宽
1445
1446
  skills: "none", // 收:条目 = 按名覆盖出厂技能的中心技能(带它自己的工具 allow / deny 名单);缺席 = 同名出厂技能回位(带回它的 allow 名单、丢掉中心的 deny 名单)= 放宽
@@ -1457,7 +1458,7 @@ export const DOMAIN_ENTRY_SALVAGE = {
1457
1458
  prompts: "none", // 收:条目受 digest 约束;缺席 = digest 不再成立,或范围文本替换掉某台 worker 的 artifact(是替换不是收窄)
1458
1459
  limits: "none", // 收:条目 = 已发布上限的一行;缺席 = 发布的天花板变了(本域是这些上限的唯一发布位)
1459
1460
  a2a: "salvage", // 留:条目 = 一个出站对端;缺席 = 少一个对端(凭据引用是值集合、整体判;名字占位同 mcp,见 CHANGELOG 已知限制)
1460
- };
1461
+ });
1461
1462
  /**
1462
1463
  * Merge every domain into the effective config a consumer pulls. Shared by all store impls.
1463
1464
  * `updatedAt` is REQUIRED (the determinism refactor — the original store.ts defaulted it to the wall clock,
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * ```
5
5
  * <根>/
6
- * config.d/… 便携域文档(文件仓库只扫这一个目录)
6
+ * config.d/… 域文档(本地读取域的文件;文件仓库只扫这一个目录)
7
7
  * config.env-models.json env 模型表被目录顶替的部署决定 {"envModels":"replaced"|"kept"}
8
8
  * config.migration.SS-M11.json 一次性迁移 SS-M11 的运行记录 {"migration":"SS-M11"}(按 id 一份)
9
9
  * .env 秘密值(不归本包读)
@@ -1,5 +1,6 @@
1
1
  import { isPlainJsonObject } from "./plain-json-object.js";
2
2
  import { sha256Digest, toHex } from "./sha256-core.js";
3
+ import { deepFreeze } from "./deep-freeze.js";
3
4
  /** 配置根上的 env 模型表决定文档的名字(文件 `<根>/config.env-models.json`)。 */
4
5
  export const ENV_MODELS_DOCUMENT = "config.env-models";
5
6
  /** 运行记录文档名的前缀(包内:名字 = 前缀 + 迁移 id,文件 = 名字 + `.json`)。 */
@@ -12,15 +13,15 @@ export const migrationMarkerDocument = (id) => `${MIGRATION_MARKER_PREFIX}${id}`
12
13
  * 常规文件、有大小上界)—— 一条律、两张名单(`config.d` 读回面一张,本张一张);`config.d` 不在时也照判。
13
14
  * `<根>/.env` **不在**这张名单:引擎今天的目录信任判官只判 `config.d` 与它的读回面,不判 `.env`(秘密值文件,本包的文件仓库不读它);本名单只登记引擎会读的根级文档。
14
15
  */
15
- export const CONFIG_ROOT_DOCUMENTS = [ENV_MODELS_DOCUMENT, migrationMarkerDocument("SS-M11")];
16
+ export const CONFIG_ROOT_DOCUMENTS = deepFreeze([ENV_MODELS_DOCUMENT, migrationMarkerDocument("SS-M11")]);
16
17
  /** 包内:`id` 是写运行记录的迁移吗(读运行记录之前判:别的 id 没有记录可读,更不许拿它拼路径)。 */
17
18
  export const isMarkedMigrationId = (id) => typeof id === "string" && CONFIG_ROOT_DOCUMENTS.includes(`${MIGRATION_MARKER_PREFIX}${id}`);
18
19
  /** 决定文档里能写的两个词(闭集):`replaced` = 目录管模型面时顶替 env 模型表;`kept` = 不顶替(与缺席同义,运行记录在场之后)。 */
19
- export const ENV_MODELS_DECISIONS = ["replaced", "kept"];
20
+ export const ENV_MODELS_DECISIONS = deepFreeze(["replaced", "kept"]);
20
21
  /** 包内:是不是决定词(闭集,判法只此一只;写函数与读法同调)。 */
21
22
  export const isDecisionWord = (v) => ENV_MODELS_DECISIONS.includes(v);
22
23
  /** 根级文档读不懂的三种原因(闭集):`bad_json` = 空 / 纯空白 / 不是 JSON;`bad_shape` = 是 JSON 但不是这份文档的形;`io` = 字节读不出(权限 —— 可信属主的 0000 文件读恒 `EACCES`,是持久的 —— 不是常规文件、悬空链接、瞬时读错)。 */
23
- export const ROOT_DOCUMENT_UNREADABLE_REASONS = ["bad_json", "bad_shape", "io"];
24
+ export const ROOT_DOCUMENT_UNREADABLE_REASONS = deepFreeze(["bad_json", "bad_shape", "io"]);
24
25
  /**
25
26
  * 一份决定读数的**身份**(带标签的一种拼法):`absent` / `d:<digest>`(有字节的四臂)/ `io:<errno>`。服务端的本地配置腿读这份决定时,「每份内容只告警一次」的去重键与本地 etag 的贡献都取它 ——
26
27
  * 来自同一次读,不再开文件(那就是第二个读者)。
@@ -13,7 +13,7 @@ export interface ConfigRootIo {
13
13
  ensureDirectory(dir: string): Promise<"created" | "present">;
14
14
  }
15
15
  /** 真文件系统的绑定:读先过本包的符号链接判法(链接 ⇒ 它指向的真文件;悬空 ⇒ 抛,不是缺席),只读常规文件;写走本包唯一的原子写器。 */
16
- export declare const nodeConfigRootIo: ConfigRootIo;
16
+ export declare const nodeConfigRootIo: Readonly<ConfigRootIo>;
17
17
  /** 配置根上 env 模型表决定的**唯一读者**(闭集答案见 `EnvModelsDecision`;从字节读出的答案带同一次读的 `digest`,io 带 `errno`)。从不抛。 */
18
18
  export declare function readEnvModelsDecision(root: string, io?: ConfigRootIo): Promise<EnvModelsDecision>;
19
19
  /** {@link readEnvModelsDecision} 的**同步孪生**(壳在同步具名锁里写模型池,要在锁里读决定):同一个字节读法、同一个缺席律、同一个答案表;读真文件系统(不收注入座 —— 注入座是异步的)。从不抛。 */
@@ -29,6 +29,7 @@ import { ENV_MODEL_TABLE_KEYS, buildEnvModelBaseline, snapshotEnvModelTable } fr
29
29
  import { FsFailure, fsFailureMessage } from "./fs-failure.js";
30
30
  import { readKey } from "./own-key-read.js";
31
31
  import { jsonShapeOf } from "./plain-json-object.js";
32
+ import { deepFreeze } from "./deep-freeze.js";
32
33
  /** 根级文档 → 原子写器的模式类(穷举:加一份根级文档不补这一行 ⇒ 编译红,逼着为它选一类)。两份现有的根级文档都是契约文档(只带固定词,不带秘密值),与 `config.d` 域文档同属 `config-document`。 */
33
34
  const ROOT_DOCUMENT_CLASS = {
34
35
  [ENV_MODELS_DOCUMENT]: "config-document",
@@ -41,7 +42,7 @@ const notRegularFile = (file) => new Error(`${file} is not a regular file`);
41
42
  const writeRootDocumentSync = (document, file, text) => writeFileAtomic(file, text, ROOT_DOCUMENT_CLASS[document]);
42
43
  const createRootDocumentSync = (document, file, text) => createFileExclusive(file, text, ROOT_DOCUMENT_CLASS[document]);
43
44
  /** 真文件系统的绑定:读先过本包的符号链接判法(链接 ⇒ 它指向的真文件;悬空 ⇒ 抛,不是缺席),只读常规文件;写走本包唯一的原子写器。 */
44
- export const nodeConfigRootIo = {
45
+ export const nodeConfigRootIo = deepFreeze({
45
46
  readFile: async (file) => {
46
47
  const real = resolveSymlinkTarget(file);
47
48
  const st = await stat(real);
@@ -52,7 +53,7 @@ export const nodeConfigRootIo = {
52
53
  writeDocument: async (document, file, text) => writeRootDocumentSync(document, file, text),
53
54
  createDocument: async (document, file, text) => createRootDocumentSync(document, file, text),
54
55
  ensureDirectory: async (dir) => ensureOwnerOnlyDirectory(dir),
55
- };
56
+ });
56
57
  /** {@link nodeConfigRootIo}`.readFile` 的同步孪生(同步读口 {@link readEnvModelsDecisionSync} 用):同一条判法(符号链接 ⇒ 真文件,悬空抛;只读常规文件),只有读字节那一步同步。 */
57
58
  function readRootFileSync(file) {
58
59
  const real = resolveSymlinkTarget(file);
@@ -286,7 +287,8 @@ export async function migrateEnvModelsDecision(input) {
286
287
  let createdRoot;
287
288
  let created;
288
289
  try {
289
- createdRoot = (await io.ensureDirectory(root)) === "created";
290
+ // 一次操作一条路径串:建的目录是随后要写的那份文件的路径串的 dirname(原子写器的文件头「一次操作一条路径串」)—— 配置根下的文件一向是 `path.join(根, 文件名)`
291
+ createdRoot = (await io.ensureDirectory(path.dirname(file))) === "created";
290
292
  created = await io.createDocument(migrationMarkerDocument("SS-M11"), file, configDDocumentText(migrationMarkerValue("SS-M11")));
291
293
  }
292
294
  catch (e) {
@@ -61,7 +61,7 @@ export interface ConformanceCase {
61
61
  }
62
62
  export interface Corpus {
63
63
  version: string;
64
- /** 空文档集的 effective(冻结的 golden;非便携域的那一格由它供给,见 derive.ts T3)。 */
64
+ /** 空文档集的 effective(冻结的 golden;非本地读取域的那一格由它供给,见 derive.ts T3)。 */
65
65
  baseline: Record<string, unknown>;
66
66
  cases: readonly ConformanceCase[];
67
67
  }
@@ -3,9 +3,9 @@ import type { WarningProjection } from "./warnings.js";
3
3
  import type { LegName, LegInput, RejectStage } from "./types.js";
4
4
  /** 一条登记在案的表示差异。 */
5
5
  export interface DerivationTransform {
6
- id: string;
7
- legs: readonly LegName[];
8
- what: string;
6
+ readonly id: string;
7
+ readonly legs: readonly LegName[];
8
+ readonly what: string;
9
9
  }
10
10
  /** 变换表(本文件头注的机器形;`docs/CONFORMANCE.md` 与 `test/conformance-coverage.test.ts` 都读它)。 */
11
11
  export declare const DERIVATION_TRANSFORMS: readonly DerivationTransform[];
@@ -35,8 +35,8 @@ export declare const LEG_EXPECTATION: {
35
35
  readonly why: "T3 / T4 / T5 / T6";
36
36
  };
37
37
  };
38
- /** 非便携域 —— 由 {@link PORTABLE_DOMAINS} 派生,零手抄。 */
39
- export declare const NON_PORTABLE_DOMAINS: readonly DomainName[];
38
+ /** 非本地读取域(T3 的集合)—— 由 {@link LOCAL_READ_DOMAINS} 派生,零手抄:本地读腿(`loadLocalConfig`)不读它们的文件(报 `unread-config-file{non-portable-domain}`),域取 schema 默认。 */
39
+ export declare const NON_LOCAL_READ_DOMAINS: readonly DomainName[];
40
40
  /** 一份 `domains` 文档集里,**不是域名**的那些顶层键(T4 的触发面)。 */
41
41
  export declare const foreignKeysOf: (docs: Readonly<Record<string, unknown>>) => string[];
42
42
  /** T2 的**入参**半场:域形的 skills 文档 → wire 形的 manifest 文档。结构变换,不解析 —— 坏形原样传下去,
@@ -64,14 +64,22 @@ export type LegExpectation = {
64
64
  path: ReadonlyArray<string | number>;
65
65
  }>;
66
66
  };
67
- /** T1 + T2 + T4:`domains` 期望 → `wire` 期望。 */
67
+ /**
68
+ * T1 + T2 + T4:`domains` 期望 → `wire` 期望。
69
+ *
70
+ * **T2 只许是恒等**(这只护栏住在这里,语料跑器与直接调用同一只判、同一句):skills 是变换表里唯一一条**算出新值**的变换(content → contentHash),
71
+ * 而派生 wire 入参({@link deriveWireInput})用的是同一只 {@link toManifestDoc} —— 期望也由它算,哈希算错就两侧同错、门照绿;域形条目自带字面 `contentHash` 时,
72
+ * 那个值还被派生算出的覆盖掉,派生期望与线上读数对不上。所以 `source.effective.skills` 上 T2 不是恒等(有一条 T2 会改写的条目 —— 与入参半场同一只判据 `t2Rewrites`)⇒ 抛,
73
+ * 这条腿要写显式期望(金样入库即冻结,哈希一改就红);恒等 ⇒ skills 原样进期望。其余三条变换只搬 / 只删、不铸新值。
74
+ * **先取快照、再对快照判、再用同一份快照派生**:调用方的 `source.effective` 只读一次(克隆那一次),护栏判的与派生用的是同一份 —— 访问器第二次答别的值也进不来。
75
+ */
68
76
  export declare function deriveWireExpectation(source: Extract<LegExpectation, {
69
77
  outcome: "effective";
70
78
  }>, docs: Readonly<Record<string, unknown>>): LegExpectation;
71
- /** 纪元时刻 —— 一个 `config.d/` 里没有任何**便携**域文件时 `updatedAt` 的取值(`#maxMtimeIso` 只 stat 便携域)。 */
79
+ /** 纪元时刻 —— 一个 `config.d/` 里没有任何**本地读取**域文件时 `updatedAt` 的取值(`#maxMtimeIso` 只 stat 本地读取域)。 */
72
80
  export declare const EPOCH_ISO: string;
73
81
  /** T3 + T4 + T5:`domains` 期望 → `local-root` 期望。`baseline` = 空文档集的 effective(语料里冻结的
74
- * `conformance/baseline.json`),非便携域取它的那一格 —— 不现算,免得 schema 默认一改 golden 就跟着动。 */
82
+ * `conformance/baseline.json`),非本地读取域取它的那一格 —— 不现算,免得 schema 默认一改 golden 就跟着动。 */
75
83
  export declare function deriveLocalExpectation(source: Extract<LegExpectation, {
76
84
  outcome: "effective";
77
85
  }>, docs: Readonly<Record<string, unknown>>, baseline: Readonly<Record<string, unknown>>, localVersion: number | undefined): LegExpectation;
@@ -12,9 +12,9 @@
12
12
  * 挂回(线上读口不编造生产方没发的域)—— 缺席进缺席出;在场时 `prompts` 是**未解析的原文档**,`a2a` 是域腿的读数。表由常量派生,不手抄域名。
13
13
  * · **T2 skills 表示**(wire):域形带 `content`,wire 形带 `contentHash`(manifest)。判据 schema 随表示走;读法不随(24.0.0 起清单与域文档同一只读法、
14
14
  * 同两张表,剥键扫描与告警同读 —— 此前清单不走剥键扫描,派生要把 skills 的剥键告警从 wire 期望里滤掉)。
15
- * · **T3 非便携域**(local-root):`config.d/` 只读 {@link PORTABLE_DOMAINS};其余域的文件在场则报
16
- * `unread-config-file{why:"non-portable-domain"}`,域本身取 schema 默认。**由 `PORTABLE_DOMAINS` 派生,
17
- * 不手抄域名** —— 设计稿只点了 `hosts` 一个实例,类是「非便携域」。
15
+ * · **T3 非本地读取域**(local-root):`config.d/` 只读 {@link LOCAL_READ_DOMAINS}(便携域集 + `projects`);其余域(workers / hosts / systems / entitlement)的文件在场则报
16
+ * `unread-config-file{why:"non-portable-domain"}`(词是已发的闭集词,不随这里改名),域本身取 schema 默认。**由 `LOCAL_READ_DOMAINS` 派生,
17
+ * 不手抄域名** —— 设计稿只点了 `hosts` 一个实例,类是「本地读取集之外的域」。29.0.0 以前这一格读的是便携域集(搬运义),`projects` 因此被算作「本地不读」;两个义拆开之后本格只问本地读取义。
18
18
  * · **T4 未知顶层键**(wire + local-root):wire 是 open-world,不认识的顶层键**逐字承运**;`domains` 腿
19
19
  * 只按域名取文档,多出来的键根本不会被问到(无声);local-root 报
20
20
  * `unread-config-file{why:"not-a-domain"}`。三腿三样 —— 这条是本车对着真读数补登记的第四条。
@@ -35,19 +35,20 @@
35
35
  * 就等于让 domains 金样的一处错同时改写两条腿的期望 —— 两条腿同错、门照绿。它的金样逐条显式入库、各自冻结。
36
36
  */
37
37
  import { NON_DOMAIN_CONFIG_FILES } from "../file-store.js";
38
- import { PORTABLE_DOMAINS } from "../portable-domains.js";
38
+ import { LOCAL_READ_DOMAINS } from "../portable-domains.js";
39
39
  import { isJsonArray, isPlainJsonObject } from "../plain-json-object.js";
40
40
  import { skillContentHash } from "../skills-manifest.js";
41
41
  import { DOMAINS, WIRE_CARRIED_DOMAINS, isDomainName } from "../types.js";
42
+ import { deepFreeze } from "../deep-freeze.js";
42
43
  /** 变换表(本文件头注的机器形;`docs/CONFORMANCE.md` 与 `test/conformance-coverage.test.ts` 都读它)。 */
43
- export const DERIVATION_TRANSFORMS = [
44
+ export const DERIVATION_TRANSFORMS = deepFreeze([
44
45
  { id: "T1-wire-carried-domains", legs: ["wire"], what: "buildEffective 恒物化每个域;wire 对 WIRE_CARRIED_DOMAINS(prompts / a2a)按在场性挂回(缺席进缺席出;在场时 prompts 是原文档、a2a 是域腿读数)" },
45
46
  { id: "T2-skills-representation", legs: ["wire"], what: "域形 content ↔ wire 形 contentHash(manifest),判据 schema 随表示走;读法与告警同一只" },
46
- { id: "T3-non-portable-domains", legs: ["localRoot"], what: "config.d/ 只读 PORTABLE_DOMAINS;其余域取默认 + unread-config-file{non-portable-domain}" },
47
+ { id: "T3-non-local-read-domains", legs: ["localRoot"], what: "config.d/ 只读 LOCAL_READ_DOMAINS;其余域取默认 + unread-config-file{non-portable-domain}" },
47
48
  { id: "T4-unknown-top-level-key", legs: ["wire", "localRoot"], what: "wire open-world 逐字承运;domains 腿按域名取文档故无声;local 报 unread-config-file{not-a-domain}" },
48
49
  { id: "T5-file-layer-first", legs: ["localRoot"], what: "config.d/<域>.json 必须是 JSON 对象(空/null/数组/标量 throw),这一层在域解析之前" },
49
50
  { id: "T6-file-name-classification", legs: ["localRoot"], what: "config.d/ 的文件分三类:域文件 / NON_DOMAIN_CONFIG_FILES(remote-exec.json 自带读取与校验路径)/ 隐藏文件与非 .json(忽略);只有剩下的才报 not-a-domain" },
50
- ];
51
+ ]);
51
52
  /**
52
53
  * 每条腿的期望从哪来 —— 闭集表态(`Record<LegName, …>`:新开一条腿不在这里表态 ⇒ 编译红)。
53
54
  *
@@ -56,7 +57,7 @@ export const DERIVATION_TRANSFORMS = [
56
57
  *
57
58
  * 语料加载器与驱动都读这张表(一条规则),不再各自特判某个腿名。
58
59
  */
59
- export const LEG_EXPECTATION = {
60
+ export const LEG_EXPECTATION = deepFreeze({
60
61
  domains: { source: "explicit", why: "真源:domains 腿的期望就是金样本身" },
61
62
  strictWrite: {
62
63
  source: "explicit",
@@ -64,11 +65,15 @@ export const LEG_EXPECTATION = {
64
65
  },
65
66
  wire: { source: "derivable", why: "T1 / T2 / T4" },
66
67
  localRoot: { source: "derivable", why: "T3 / T4 / T5 / T6" },
67
- };
68
- /** 非便携域 —— 由 {@link PORTABLE_DOMAINS} 派生,零手抄。 */
69
- export const NON_PORTABLE_DOMAINS = DOMAINS.filter((d) => !PORTABLE_DOMAINS.includes(d));
68
+ });
69
+ /** 非本地读取域(T3 的集合)—— 由 {@link LOCAL_READ_DOMAINS} 派生,零手抄:本地读腿(`loadLocalConfig`)不读它们的文件(报 `unread-config-file{non-portable-domain}`),域取 schema 默认。 */
70
+ export const NON_LOCAL_READ_DOMAINS = deepFreeze(DOMAINS.filter((d) => !LOCAL_READ_DOMAINS.includes(d)));
70
71
  /** 一份 `domains` 文档集里,**不是域名**的那些顶层键(T4 的触发面)。 */
71
72
  export const foreignKeysOf = (docs) => Object.keys(docs).filter((k) => !isDomainName(k));
73
+ /** T2 改写这一条吗 —— **唯一的判据**:入参半场 {@link toManifestDoc} 按它改写,期望半场的护栏({@link deriveWireExpectation})按它拒;条目是朴素对象且 `content` 是串。 */
74
+ const t2Rewrites = (entry) => isPlainJsonObject(entry) && typeof entry.content === "string";
75
+ /** T2 在这份 skills 文档上会不会改动任何东西:是朴素对象、`skills` 是数组、有一条 {@link t2Rewrites}。只问条目 —— 与 T2 无关的值不读、不序列化。 */
76
+ const t2Moves = (doc) => isPlainJsonObject(doc) && isJsonArray(doc.skills) && doc.skills.some(t2Rewrites);
72
77
  /** T2 的**入参**半场:域形的 skills 文档 → wire 形的 manifest 文档。结构变换,不解析 —— 坏形原样传下去,
73
78
  * 让 wire 腿自己的判据去裁(否则语料就没法喂一份坏 manifest 了)。 */
74
79
  export function toManifestDoc(doc) {
@@ -77,7 +82,7 @@ export function toManifestDoc(doc) {
77
82
  return {
78
83
  ...doc,
79
84
  skills: doc.skills.map((entry) => {
80
- if (!isPlainJsonObject(entry) || typeof entry.content !== "string")
85
+ if (!t2Rewrites(entry))
81
86
  return entry;
82
87
  const { content, ...rest } = entry;
83
88
  return { ...rest, contentHash: skillContentHash(content) };
@@ -104,18 +109,30 @@ export function deriveLocalInput(docs, mtime) {
104
109
  return { leg: "localRoot", files, mtime };
105
110
  }
106
111
  const clone = (v) => structuredClone(v);
107
- /** T1 + T2 + T4:`domains` 期望 → `wire` 期望。 */
112
+ /**
113
+ * T1 + T2 + T4:`domains` 期望 → `wire` 期望。
114
+ *
115
+ * **T2 只许是恒等**(这只护栏住在这里,语料跑器与直接调用同一只判、同一句):skills 是变换表里唯一一条**算出新值**的变换(content → contentHash),
116
+ * 而派生 wire 入参({@link deriveWireInput})用的是同一只 {@link toManifestDoc} —— 期望也由它算,哈希算错就两侧同错、门照绿;域形条目自带字面 `contentHash` 时,
117
+ * 那个值还被派生算出的覆盖掉,派生期望与线上读数对不上。所以 `source.effective.skills` 上 T2 不是恒等(有一条 T2 会改写的条目 —— 与入参半场同一只判据 `t2Rewrites`)⇒ 抛,
118
+ * 这条腿要写显式期望(金样入库即冻结,哈希一改就红);恒等 ⇒ skills 原样进期望。其余三条变换只搬 / 只删、不铸新值。
119
+ * **先取快照、再对快照判、再用同一份快照派生**:调用方的 `source.effective` 只读一次(克隆那一次),护栏判的与派生用的是同一份 —— 访问器第二次答别的值也进不来。
120
+ */
108
121
  export function deriveWireExpectation(source, docs) {
109
122
  const base = clone(source.effective);
123
+ if (t2Moves(base.skills)) {
124
+ throw new Error("deriveWireExpectation: 这份期望的 skills 表示变换(T2)会**算出新值**(contentHash)—— 派生入参用的是同一只变换,哈希算错会两侧同错(域形条目自带的字面 `contentHash` 还会被覆盖);" +
125
+ "这条 wire 腿要写显式期望并写明 why(跑 `npm run conformance:bless` 填金样)");
126
+ }
110
127
  // T1:承运表里的域缺席进缺席出;在场 = 自有键且值不是 undefined(与读口同一条律,这里独立写一遍 —— 派生不调被测读口;嵌入方调导出的派生时
111
128
  // 文档集里可以有 undefined,JSON 语料没有);在场时 prompts 是**未解析的原文档**(wire 腿从不 parse prompts),其余是域腿读数。
112
- // T2:域形条目的 content → contentHash(manifest 的条目 schema = 域条目 omit content + contentHash)。
129
+ // T2:上面的护栏放行 ⇒ 恒等,skills 原样。
113
130
  // T4:open-world 顶层键逐字承运 —— 用 fromEntries 而不是逐键赋值,否则一个叫 `__proto__` 的顶层键
114
131
  // 会变成一次原型改写(期望侧与实际侧被同样吃掉 = 比对器对这一类全盲,S-332 同族)。
115
132
  const carried = WIRE_CARRIED_DOMAINS;
116
133
  const effective = Object.fromEntries([
117
134
  ...Object.entries(base).filter(([k]) => !carried.includes(k) && k !== "skills"),
118
- ["skills", toManifestDoc(base.skills)],
135
+ ["skills", base.skills],
119
136
  ...WIRE_CARRIED_DOMAINS.filter((d) => Object.prototype.hasOwnProperty.call(docs, d) && docs[d] !== undefined).map((d) => [d, d === "prompts" ? clone(docs.prompts) : base[d]]),
120
137
  ...foreignKeysOf(docs).map((k) => [k, clone(docs[k])]),
121
138
  ]);
@@ -126,20 +143,20 @@ export function deriveWireExpectation(source, docs) {
126
143
  });
127
144
  return { outcome: "effective", effective, warnings, metadata: { ...source.metadata } };
128
145
  }
129
- /** 纪元时刻 —— 一个 `config.d/` 里没有任何**便携**域文件时 `updatedAt` 的取值(`#maxMtimeIso` 只 stat 便携域)。 */
146
+ /** 纪元时刻 —— 一个 `config.d/` 里没有任何**本地读取**域文件时 `updatedAt` 的取值(`#maxMtimeIso` 只 stat 本地读取域)。 */
130
147
  export const EPOCH_ISO = new Date(0).toISOString();
131
148
  /** T3 + T4 + T5:`domains` 期望 → `local-root` 期望。`baseline` = 空文档集的 effective(语料里冻结的
132
- * `conformance/baseline.json`),非便携域取它的那一格 —— 不现算,免得 schema 默认一改 golden 就跟着动。 */
149
+ * `conformance/baseline.json`),非本地读取域取它的那一格 —— 不现算,免得 schema 默认一改 golden 就跟着动。 */
133
150
  export function deriveLocalExpectation(source, docs, baseline, localVersion) {
134
- // T5:文件层先判 —— 任何一个**便携**域的文档不是 JSON 对象 ⇒ 整条腿在解析层被拒。
135
- const badFile = PORTABLE_DOMAINS.find((d) => Object.prototype.hasOwnProperty.call(docs, d) && !isPlainJsonObject(docs[d]));
151
+ // T5:文件层先判 —— 任何一个**本地读取**域的文档不是 JSON 对象 ⇒ 整条腿在解析层被拒。
152
+ const badFile = LOCAL_READ_DOMAINS.find((d) => Object.prototype.hasOwnProperty.call(docs, d) && !isPlainJsonObject(docs[d]));
136
153
  if (badFile !== undefined)
137
154
  return { outcome: "rejected", stage: "parse" };
138
155
  const effective = clone(source.effective);
139
- for (const d of NON_PORTABLE_DOMAINS)
156
+ for (const d of NON_LOCAL_READ_DOMAINS)
140
157
  effective[d] = clone(baseline[d]);
141
- const warnings = source.warnings.filter((w) => !("domain" in w && w.domain !== undefined && NON_PORTABLE_DOMAINS.includes(w.domain)));
142
- for (const d of NON_PORTABLE_DOMAINS) {
158
+ const warnings = source.warnings.filter((w) => !("domain" in w && w.domain !== undefined && NON_LOCAL_READ_DOMAINS.includes(w.domain)));
159
+ for (const d of NON_LOCAL_READ_DOMAINS) {
143
160
  if (Object.prototype.hasOwnProperty.call(docs, d))
144
161
  warnings.push({ kind: "unread-config-file", file: `${d}.json`, domain: d, why: "non-portable-domain" });
145
162
  }
@@ -150,11 +167,11 @@ export function deriveLocalExpectation(source, docs, baseline, localVersion) {
150
167
  continue;
151
168
  warnings.push({ kind: "unread-config-file", file, why: "not-a-domain" });
152
169
  }
153
- const anyPortable = PORTABLE_DOMAINS.some((d) => Object.prototype.hasOwnProperty.call(docs, d));
170
+ const anyLocalRead = LOCAL_READ_DOMAINS.some((d) => Object.prototype.hasOwnProperty.call(docs, d));
154
171
  return {
155
172
  outcome: "effective",
156
173
  effective,
157
174
  warnings,
158
- metadata: { updatedAt: anyPortable ? source.metadata.updatedAt : EPOCH_ISO, ...(localVersion === undefined ? {} : { version: localVersion }) },
175
+ metadata: { updatedAt: anyLocalRead ? source.metadata.updatedAt : EPOCH_ISO, ...(localVersion === undefined ? {} : { version: localVersion }) },
159
176
  };
160
177
  }
@@ -17,7 +17,7 @@
17
17
  export { runConformance, materializeLocalRoot, resolveLegExpectation } from "./run.js";
18
18
  export { createContractAdapter, type ContractAdapterOptions, type ContractModule } from "./contract-adapter.js";
19
19
  export { loadCorpus, loadCase, kitIdentity, DEFAULT_CORPUS_DIR, PACKAGE_ROOT, type Corpus, type ConformanceCase, type CaseInput, type CaseMeta, type LegExpectationJson } from "./corpus.js";
20
- export { DERIVATION_TRANSFORMS, LEG_EXPECTATION, NON_PORTABLE_DOMAINS, EPOCH_ISO, deriveWireInput, deriveLocalInput, deriveWireExpectation, deriveLocalExpectation, foreignKeysOf, toManifestDoc, type DerivationTransform, type LegExpectation, } from "./derive.js";
20
+ export { DERIVATION_TRANSFORMS, LEG_EXPECTATION, NON_LOCAL_READ_DOMAINS, EPOCH_ISO, deriveWireInput, deriveLocalInput, deriveWireExpectation, deriveLocalExpectation, foreignKeysOf, toManifestDoc, type DerivationTransform, type LegExpectation, } from "./derive.js";
21
21
  export { canonicalize, deepEqual, diffJson, stableKey, type JsonPatchOp } from "./canonical.js";
22
22
  export { WARNING_KINDS, projectWarning, normalizeProjection, projectionKey, projectionValue, diffWarningMultiset, findSecretLeaks, type WarningKind, type WarningProjection, } from "./warnings.js";
23
23
  export { LEDGER_REF_RULE, LEG_DECLINE_REASONS, REF_INTEGRITY_REJECT_CODE, type RefIssueCoordinate, LEG_NAMES, REJECT_STAGES, type ConformanceAdapter, type ConformanceLeg, type DomainDocsInput, type LegDeclineReason, type LegDeclined, type LegStance, type ConformanceMode, type ConformanceNormalizer, type ConformanceOptions, type ConformanceProvenance, type ConformanceReport, type ConformanceResult, type ConformanceStatus, type KnownDivergence, type OutcomeDivergence, type PathDivergence, type LedgerRow, type LegEntry, type LegInput, type LegName, type LegOutcome, type RejectStage, } from "./types.js";
@@ -17,7 +17,7 @@
17
17
  export { runConformance, materializeLocalRoot, resolveLegExpectation } from "./run.js";
18
18
  export { createContractAdapter } from "./contract-adapter.js";
19
19
  export { loadCorpus, loadCase, kitIdentity, DEFAULT_CORPUS_DIR, PACKAGE_ROOT } from "./corpus.js";
20
- export { DERIVATION_TRANSFORMS, LEG_EXPECTATION, NON_PORTABLE_DOMAINS, EPOCH_ISO, deriveWireInput, deriveLocalInput, deriveWireExpectation, deriveLocalExpectation, foreignKeysOf, toManifestDoc, } from "./derive.js";
20
+ export { DERIVATION_TRANSFORMS, LEG_EXPECTATION, NON_LOCAL_READ_DOMAINS, EPOCH_ISO, deriveWireInput, deriveLocalInput, deriveWireExpectation, deriveLocalExpectation, foreignKeysOf, toManifestDoc, } from "./derive.js";
21
21
  export { canonicalize, deepEqual, diffJson, stableKey } from "./canonical.js";
22
22
  export { WARNING_KINDS, projectWarning, normalizeProjection, projectionKey, projectionValue, diffWarningMultiset, findSecretLeaks, } from "./warnings.js";
23
23
  export { LEDGER_REF_RULE, LEG_DECLINE_REASONS, REF_INTEGRITY_REJECT_CODE, LEG_NAMES, REJECT_STAGES, } from "./types.js";
@@ -16,7 +16,7 @@ import { basename, extname, isAbsolute, join, resolve, sep } from "node:path";
16
16
  import { isJsonArray, isPlainJsonObject, jsonShapeOf } from "../plain-json-object.js";
17
17
  import { canonicalize, deepEqual, diffJson, stableKey } from "./canonical.js";
18
18
  import { diffWarningMultiset, findSecretLeaks, projectWarning } from "./warnings.js";
19
- import { deriveLocalExpectation, deriveLocalInput, deriveWireExpectation, deriveWireInput, toManifestDoc } from "./derive.js";
19
+ import { deriveLocalExpectation, deriveLocalInput, deriveWireExpectation, deriveWireInput } from "./derive.js";
20
20
  import { kitIdentity, loadCorpus } from "./corpus.js";
21
21
  import { contractOwnedEntry, contractOwnedEntryWhy } from "./entry-origin.js";
22
22
  import { mintLocalRoot, removeLocalRoot } from "./temp-roots.js";
@@ -109,15 +109,14 @@ export function resolveLegExpectation(c, leg, baseline) {
109
109
  }
110
110
  const from = { outcome: "effective", effective: source.effective, warnings: source.warnings, metadata: source.metadata };
111
111
  if (leg === "wire") {
112
- // **派生不许替被测 helper 同时造输入与期望**(codex R1 [high] 复现):skills 是五条变换里唯一一条
113
- // **算出一个新值**的(content → contentHash),而入参与期望都走同一只 `toManifestDoc` —— 把哈希算错
114
- // 也会两侧同样算错,45 条 wire 语料照样全绿。于是这里 fail-loud:凡该变换**不是恒等**的 case,
115
- // wire 腿必须写显式期望(金样入库即冻结,哈希一改就红)。其余四条变换只搬/只删,不铸新值,照常派生。
116
- if (stableKey(toManifestDoc(source.effective.skills)) !== stableKey(source.effective.skills)) {
117
- throw new Error(`conformance corpus: ${c.id}/expected.json#wire cannot be derived — 这条 case 的 skills 表示变换会**算出新值**(contentHash),` +
118
- `派生会让入参与期望同时错;请给 wire 腿写显式期望并写明 why(跑 \`npm run conformance:bless\` 填金样)`);
112
+ // **派生不许替被测 helper 同时造输入与期望**:那只护栏(T2 不是恒等 ⇒ 拒)住在派生积木件自己身上 —— 跑器与直接调用同一只判、同一句;
113
+ // 这里只给它的拒句加上 case 坐标(语料作者要知道是哪一条)。
114
+ try {
115
+ return deriveWireExpectation(from, c.input.domains);
116
+ }
117
+ catch (e) {
118
+ throw new Error(`conformance corpus: ${c.id}/expected.json#wire cannot be derived — ${e instanceof Error ? e.message : String(e)}`, { cause: e });
119
119
  }
120
- return deriveWireExpectation(from, c.input.domains);
121
120
  }
122
121
  if (leg === "localRoot")
123
122
  return deriveLocalExpectation(from, c.input.domains, baseline, spec.localVersion);