@sema-agent/settings-schema 13.0.1 → 14.1.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 (136) hide show
  1. package/CHANGELOG.md +134 -0
  2. package/README.md +19 -1
  3. package/conformance/VERSION +1 -1
  4. package/conformance/baseline.json +1 -3
  5. package/conformance/cases/c01-entry-salvage-then-typo/expected.json +1 -3
  6. package/conformance/cases/c02-hosts-clamp-stacked/expected.json +1 -3
  7. package/conformance/cases/c03-literal-dotted-top-key/expected.json +1 -3
  8. package/conformance/cases/c04-all-bad-collection-not-salvaged/expected.json +1 -3
  9. package/conformance/cases/c07-hooks-is-not-a-config-domain/expected.json +1 -3
  10. package/conformance/cases/c08-limits-unknown-carried-64/expected.json +1 -3
  11. package/conformance/cases/c09-limits-unknown-carried-65/expected.json +1 -3
  12. package/conformance/cases/c10-record-key-secret-redacted-twice/expected.json +1 -3
  13. package/conformance/cases/c11-unicode-unknown-keys/expected.json +1 -3
  14. package/conformance/cases/c12-prototype-name-top-keys/expected.json +1 -3
  15. package/conformance/cases/c13-models-field-null/expected.json +1 -3
  16. package/conformance/cases/c14-models-field-empty-array/expected.json +1 -3
  17. package/conformance/cases/c15-models-field-number/expected.json +1 -3
  18. package/conformance/cases/c16-deep-nesting-205/expected.json +1 -3
  19. package/conformance/cases/c17-empty-domain-file/expected.json +1 -3
  20. package/conformance/cases/c18-wire-envelope-not-an-object/expected.json +1 -3
  21. package/conformance/cases/c19-wire-envelope-no-version/expected.json +1 -3
  22. package/conformance/cases/c21-governance-empty-object-wins/expected.json +1 -3
  23. package/conformance/cases/c23-mixed-validity-models/expected.json +1 -3
  24. package/conformance/cases/c24-valid-entries-with-unknown-keys/expected.json +1 -3
  25. package/conformance/cases/c25-published-roundtrip-zero-warnings/expected.json +1 -3
  26. package/conformance/cases/c26-hosts-array-1024/expected.json +1 -3
  27. package/conformance/cases/c27-hosts-array-1025/expected.json +1 -3
  28. package/conformance/cases/c28-large-document-over-1mb/expected.json +1 -3
  29. package/conformance/cases/c29-salvage-then-domain-refine-fails/expected.json +1 -3
  30. package/conformance/cases/c30-version-triple-a-first/expected.json +1 -3
  31. package/conformance/cases/c31-version-triple-b-changed/expected.json +1 -3
  32. package/conformance/cases/c32-version-triple-a-restored/expected.json +1 -3
  33. package/conformance/cases/c33-limits-nested-carried-key/expected.json +1 -3
  34. package/conformance/cases/c34-skills-content-vs-manifest/expected.json +1 -3
  35. package/conformance/cases/c35-portable-domain-file-is-null/expected.json +1 -3
  36. package/conformance/cases/c36-skills-entry-without-content/expected.json +1 -3
  37. package/conformance/cases/c37-skills-field-null/expected.json +1 -3
  38. package/conformance/cases/c38-remote-exec-is-a-non-domain-file/expected.json +1 -3
  39. package/conformance/cases/c39-hidden-file-in-config-d/expected.json +1 -3
  40. package/conformance/cases/c40-s712-identity-only-what-reads-out/expected.json +1 -3
  41. package/conformance/cases/c41-s792-encoded-pem-identity/expected.json +1 -3
  42. package/conformance/cases/c42-s792-unknown-key-secret-redacted/expected.json +1 -3
  43. package/conformance/cases/c43-s792-form-and-deep-encoded-pem/expected.json +1 -3
  44. package/conformance/cases/c44-s792-utf8-escape-glued-token/expected.json +1 -3
  45. package/conformance/cases/c45-s792-identity-bounds-and-decode-depth/expected.json +1 -3
  46. package/conformance/cases/c46-s811-host-name-url-userinfo-withheld/expected.json +1 -3
  47. package/conformance/cases/c47-s811-roles-key-url-userinfo-withheld/expected.json +1 -3
  48. package/conformance/cases/c48-s935-model-headers-transported/expected.json +1 -3
  49. package/conformance/cases/c49-s935-model-headers-secret-entry-dropped/expected.json +1 -3
  50. package/conformance/cases/c50-s784-lane-host-legal/expected.json +1 -3
  51. package/conformance/cases/c51-s784-lane-e2b-legal/expected.json +1 -3
  52. package/conformance/cases/c52-s784-lane-k8s-legal/expected.json +1 -3
  53. package/conformance/cases/c53-s784-lane-ssh-legal/expected.json +1 -3
  54. package/conformance/cases/c54-s784-lane-adb-legal/expected.json +1 -3
  55. package/conformance/cases/c55-s784-lane-local-docker-legal/expected.json +1 -3
  56. package/conformance/cases/c56-s784-lane-device-legal/expected.json +1 -3
  57. package/conformance/cases/c57-s784-g1-enabled-no-lane/expected.json +1 -3
  58. package/conformance/cases/c58-s784-g2-multitenant-host/expected.json +1 -3
  59. package/conformance/cases/c59-s784-g3-k8s-missing-image/expected.json +1 -3
  60. package/conformance/cases/c60-s784-g3-e2b-missing-key/expected.json +1 -3
  61. package/conformance/cases/c61-s784-g3-other-lane-key/expected.json +1 -3
  62. package/conformance/cases/c62-s784-g7a-session-tidb/expected.json +1 -3
  63. package/conformance/cases/c63-s784-host-two-replicas/expected.json +1 -3
  64. package/conformance/cases/c64-s784-multitenant-local-store/expected.json +1 -3
  65. package/conformance/cases/c65-s784-pg-without-db/expected.json +1 -3
  66. package/conformance/cases/c66-s784-memory-backend-mismatch/expected.json +1 -3
  67. package/conformance/cases/c67-s784-retired-field-loud/expected.json +1 -3
  68. package/conformance/cases/c68-s784-device-local-store/expected.json +1 -3
  69. package/conformance/cases/c69-deep-encoded-token-past-every-reading/expected.json +1 -3
  70. package/conformance/cases/c70-rewritten-token-in-front-of-encoded-pem-header/expected.json +1 -3
  71. package/conformance/cases/c71-one-scanner-write-reads-display-forms/expected.json +1 -3
  72. package/conformance/cases/c72-dangling-reference-write-seat-refuses/expected.json +1 -3
  73. package/conformance/cases/c73-projects-extended-registration-reads/expected.json +1 -3
  74. package/conformance/cases/c74-projects-over-bound-refused/expected.json +1 -3
  75. package/conformance/cases/c75-projects-patch-remote-uniqueness/expected.json +1 -3
  76. package/conformance/cases/c76-projects-entry-salvage-nested/expected.json +1 -3
  77. package/conformance/cases/c77-prompts-center-artifact-carried/expected.json +252 -0
  78. package/conformance/cases/c77-prompts-center-artifact-carried/input.json +93 -0
  79. package/conformance/cases/c77-prompts-center-artifact-carried/meta.json +5 -0
  80. package/conformance/cases/c78-prompts-empty-bindings-refused/expected.json +82 -0
  81. package/conformance/cases/c78-prompts-empty-bindings-refused/input.json +11 -0
  82. package/conformance/cases/c78-prompts-empty-bindings-refused/meta.json +5 -0
  83. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/expected.json +82 -0
  84. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/input.json +129 -0
  85. package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/meta.json +5 -0
  86. package/conformance/cases/c80-prompts-wire-v2-verbatim/expected.json +195 -0
  87. package/conformance/cases/c80-prompts-wire-v2-verbatim/input.json +65 -0
  88. package/conformance/cases/c80-prompts-wire-v2-verbatim/meta.json +5 -0
  89. package/conformance/cases/c81-prompts-declaration-bindings-refused/expected.json +82 -0
  90. package/conformance/cases/c81-prompts-declaration-bindings-refused/input.json +23 -0
  91. package/conformance/cases/c81-prompts-declaration-bindings-refused/meta.json +5 -0
  92. package/conformance/cases/c82-prompts-v1-catalog-refused/expected.json +82 -0
  93. package/conformance/cases/c82-prompts-v1-catalog-refused/input.json +35 -0
  94. package/conformance/cases/c82-prompts-v1-catalog-refused/meta.json +5 -0
  95. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/expected.json +82 -0
  96. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/input.json +56 -0
  97. package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/meta.json +5 -0
  98. package/conformance/cases/cc01-mcp-toolfaces-non-object/expected.json +1 -3
  99. package/conformance/cases/cc02-mcp-source-key-is-transported/expected.json +1 -3
  100. package/conformance/cases/cc03-model-compat-unknown-subkey/expected.json +1 -3
  101. package/conformance/cases/cli01-model-name-nfc-vs-nfd/expected.json +1 -3
  102. package/conformance/cases/cli02-control-and-zero-width-chars/expected.json +1 -3
  103. package/conformance/cases/cli03-credential-pasted-into-unknown-key/expected.json +1 -3
  104. package/conformance/cases/cli04-env-value-with-newline/expected.json +1 -3
  105. package/conformance/cases/cli05-long-and-prefix-colliding-names/expected.json +1 -3
  106. package/conformance/cases/t01-absent-domain-key-not-null/expected.json +1 -3
  107. package/conformance/cases/t03-prototype-name-key-not-swallowed/expected.json +1 -3
  108. package/conformance/cases/t04-secret-literal-never-in-warning-value/expected.json +1 -3
  109. package/conformance/cases/z01-every-domain-empty-object/expected.json +2 -6
  110. package/conformance/cases/z02-every-domain-unknown-key/expected.json +2 -6
  111. package/dist/config-fns.d.ts +7 -3
  112. package/dist/config-fns.js +19 -16
  113. package/dist/conformance/derive.js +2 -2
  114. package/dist/index.d.ts +1 -0
  115. package/dist/index.js +1 -0
  116. package/dist/mcp-request-entry.d.ts +118 -0
  117. package/dist/mcp-request-entry.js +266 -0
  118. package/dist/migration-receipt.d.ts +1 -1
  119. package/dist/migration-receipt.js +1 -1
  120. package/dist/node.d.ts +0 -1
  121. package/dist/node.js +0 -1
  122. package/dist/one-time-migrations.d.ts +1 -1
  123. package/dist/one-time-migrations.js +39 -0
  124. package/dist/safety-merge-spec.d.ts +6 -6
  125. package/dist/types.d.ts +438 -355
  126. package/dist/types.js +161 -136
  127. package/dist/url-shape.d.ts +8 -0
  128. package/dist/url-shape.js +10 -0
  129. package/docs/API-SURFACE.md +41 -27
  130. package/docs/CONFORMANCE.md +1 -1
  131. package/docs/CONSUMER-INTEGRATION.md +3 -2
  132. package/llms-full.txt +14 -11
  133. package/llms.txt +8 -2
  134. package/package.json +2 -2
  135. package/dist/prompts-digest.d.ts +0 -16
  136. package/dist/prompts-digest.js +0 -49
@@ -50,9 +50,7 @@
50
50
  "projects": {
51
51
  "projects": {}
52
52
  },
53
- "prompts": {
54
- "bindings": []
55
- },
53
+ "prompts": {},
56
54
  "rosters": {
57
55
  "rosters": []
58
56
  },
@@ -63,9 +63,7 @@
63
63
  "projects": {
64
64
  "projects": {}
65
65
  },
66
- "prompts": {
67
- "bindings": []
68
- },
66
+ "prompts": {},
69
67
  "rosters": {
70
68
  "rosters": []
71
69
  },
@@ -47,9 +47,7 @@
47
47
  "projects": {
48
48
  "projects": {}
49
49
  },
50
- "prompts": {
51
- "bindings": []
52
- },
50
+ "prompts": {},
53
51
  "rosters": {
54
52
  "rosters": []
55
53
  },
@@ -39,9 +39,7 @@
39
39
  "projects": {
40
40
  "projects": {}
41
41
  },
42
- "prompts": {
43
- "bindings": []
44
- },
42
+ "prompts": {},
45
43
  "rosters": {
46
44
  "rosters": []
47
45
  },
@@ -70,9 +70,7 @@
70
70
  "projects": {
71
71
  "projects": {}
72
72
  },
73
- "prompts": {
74
- "bindings": []
75
- },
73
+ "prompts": {},
76
74
  "rosters": {
77
75
  "rosters": []
78
76
  },
@@ -58,9 +58,7 @@
58
58
  "projects": {
59
59
  "projects": {}
60
60
  },
61
- "prompts": {
62
- "bindings": []
63
- },
61
+ "prompts": {},
64
62
  "rosters": {
65
63
  "rosters": []
66
64
  },
@@ -50,9 +50,7 @@
50
50
  "projects": {
51
51
  "projects": {}
52
52
  },
53
- "prompts": {
54
- "bindings": []
55
- },
53
+ "prompts": {},
56
54
  "rosters": {
57
55
  "rosters": []
58
56
  },
@@ -50,9 +50,7 @@
50
50
  "projects": {
51
51
  "projects": {}
52
52
  },
53
- "prompts": {
54
- "bindings": []
55
- },
53
+ "prompts": {},
56
54
  "rosters": {
57
55
  "rosters": []
58
56
  },
@@ -39,9 +39,7 @@
39
39
  "projects": {
40
40
  "projects": {}
41
41
  },
42
- "prompts": {
43
- "bindings": []
44
- },
42
+ "prompts": {},
45
43
  "rosters": {
46
44
  "rosters": []
47
45
  },
@@ -104,9 +102,7 @@
104
102
  "projects": {
105
103
  "projects": {}
106
104
  },
107
- "prompts": {
108
- "bindings": []
109
- },
105
+ "prompts": {},
110
106
  "rosters": {
111
107
  "rosters": []
112
108
  },
@@ -41,9 +41,7 @@
41
41
  "projects": {
42
42
  "projects": {}
43
43
  },
44
- "prompts": {
45
- "bindings": []
46
- },
44
+ "prompts": {},
47
45
  "rosters": {
48
46
  "rosters": []
49
47
  },
@@ -253,9 +251,7 @@
253
251
  "projects": {
254
252
  "projects": {}
255
253
  },
256
- "prompts": {
257
- "bindings": []
258
- },
254
+ "prompts": {},
259
255
  "rosters": {
260
256
  "rosters": []
261
257
  },
@@ -584,7 +584,7 @@ export declare const DOMAIN_READ_FALLBACK: {
584
584
  * it back would turn every dropped entry into a deletion — read-modify-write faces read the stored document with the document face.
585
585
  *
586
586
  * Per-domain rationale:
587
- * - models/skills/mcp/plugins/scenarios/systems/collab/prompts: additive capability / content catalogs — a dropped entry is
587
+ * - models/skills/mcp/plugins/scenarios/systems/collab: additive capability / content catalogs — a dropped entry is
588
588
  * one capability gone (fail-closed). Inside a surviving entry the same holds: the nested collections these entries carry
589
589
  * are allowlists / scopings (`allowTools`, `scenarios`, `rosters`, `callsWorkers`, …) where one entry fewer only NARROWS,
590
590
  * and the zero-survivor law (never mint an empty collection — several of these read "empty = all") holds at every level.
@@ -594,7 +594,11 @@ export declare const DOMAIN_READ_FALLBACK: {
594
594
  * schema refuses (12.2.1's UNC judgement on `contextItems[].value`) must not take the scope's other projects with it.
595
595
  * Its whenUnreadable stance stays `"throw"` (a ledger that cannot be read at all is never defaulted — see
596
596
  * {@link DOMAIN_READ_FALLBACK}).
597
- * - rosters: NONE — a dropped roster makes resolveEffectiveForWorker fall back to the FULL models catalog for that worker
597
+ * - prompts: NONE (14.0.0) — an artifact is digest-bound: a dropped overlay leaves an artifact whose digest no longer holds (the
598
+ engine refuses the whole candidate it rides in, every domain with it), and a dropped worker artifact substitutes the scope's
599
+ text for that worker (a replacement, not a narrowing). Its whenUnreadable stance stays `"default"`: unreadable ⇒ `{}` ⇒ no
600
+ center layer is served (the engine's built-in prompt).
601
+ - rosters: NONE — a dropped roster makes resolveEffectiveForWorker fall back to the FULL models catalog for that worker
598
602
  * (放权,不许).
599
603
  * - workers: NONE — a dropped worker row reads as "this worker is no longer declared": the reconciler would retire it. The
600
604
  * per-row tolerance this domain does have lives in `readWorkersRows` (rows are HELD with their original, never dropped).
@@ -617,7 +621,7 @@ export declare const DOMAIN_ENTRY_SALVAGE: {
617
621
  readonly entitlement: "none";
618
622
  readonly execution: "none";
619
623
  readonly projects: "salvage";
620
- readonly prompts: "salvage";
624
+ readonly prompts: "none";
621
625
  readonly limits: "none";
622
626
  };
623
627
  /** 一个读者向店要文档的口:配置域,以及墓碑表里的retired 域({@link RETIRED_DOMAINS})—— 后者只为让墓碑看见没迁的旧文档。 */
@@ -165,8 +165,8 @@ export const DOMAIN_WRITE_ROLE = {
165
165
  // entitlement governs who-can-USE-what (models/skills/mcp/budget/runtime caps) per principal — a governance +
166
166
  // security surface (budget ceilings, bypass kill-switch) on par with systems. Same raised gate.
167
167
  entitlement: "publisher",
168
- // prompts (0.10.19, [ref]③/②d): declaration text goes STRAIGHT into the system prompt of
169
- // every worker×scenario the binding covers — the same injection surface (and rationale) as skills/mcp,
168
+ // prompts (0.10.19, [ref]③/②d): the center artifact's overlay text goes STRAIGHT into the system prompt of
169
+ // every worker×scenario it applies to — the same injection surface (and rationale) as skills/mcp,
170
170
  // so the same raised gate. Web-admin had pre-raised this locally per governance precedent; this row is the
171
171
  // contract-side source of truth so every consumer of the shared write gate gets publisher, not editor.
172
172
  prompts: "publisher",
@@ -969,9 +969,8 @@ export const DOMAIN_READ_FALLBACK = {
969
969
  entitlement: "throw",
970
970
  execution: "throw",
971
971
  projects: "throw",
972
- // prompts:内容域(scenarios 同类)——坏形→空默认(=「无 prompts 管理」当年语义,web [1064]②
973
- // backfill-empty-default 同口径);fail-closed 由 PUBLISH_MODE 发布闸承担,default 不扩权
974
- // (空 bindings=不下发任何内容)。
972
+ // prompts:内容域(scenarios 同类)——坏形→空默认 `{}`(=「不管提示词」:不下发中心层,引擎用内置);fail-closed 由 PUBLISH_MODE
973
+ // 发布闸承担,default 不扩权。14.0.0 起墓碑键(`bindings` / `catalog`)也走这一档(读不出 ⇒ 缺省 + domain-defaulted 点名 SS-M10)。
975
974
  prompts: "default",
976
975
  // limits(0.19.0):THROW —— 本域是成本 / 限流天花板的唯一发布位(11.0.0 起 runtime 域retired)。坏形
977
976
  // 降级成空域 = 中央发布的成本/限流天花板整片蒸发,消费方回自己的 env 底(可能宽得多)= 预算轴放权。
@@ -991,7 +990,7 @@ export const DOMAIN_READ_FALLBACK = {
991
990
  * it back would turn every dropped entry into a deletion — read-modify-write faces read the stored document with the document face.
992
991
  *
993
992
  * Per-domain rationale:
994
- * - models/skills/mcp/plugins/scenarios/systems/collab/prompts: additive capability / content catalogs — a dropped entry is
993
+ * - models/skills/mcp/plugins/scenarios/systems/collab: additive capability / content catalogs — a dropped entry is
995
994
  * one capability gone (fail-closed). Inside a surviving entry the same holds: the nested collections these entries carry
996
995
  * are allowlists / scopings (`allowTools`, `scenarios`, `rosters`, `callsWorkers`, …) where one entry fewer only NARROWS,
997
996
  * and the zero-survivor law (never mint an empty collection — several of these read "empty = all") holds at every level.
@@ -1001,7 +1000,11 @@ export const DOMAIN_READ_FALLBACK = {
1001
1000
  * schema refuses (12.2.1's UNC judgement on `contextItems[].value`) must not take the scope's other projects with it.
1002
1001
  * Its whenUnreadable stance stays `"throw"` (a ledger that cannot be read at all is never defaulted — see
1003
1002
  * {@link DOMAIN_READ_FALLBACK}).
1004
- * - rosters: NONE — a dropped roster makes resolveEffectiveForWorker fall back to the FULL models catalog for that worker
1003
+ * - prompts: NONE (14.0.0) — an artifact is digest-bound: a dropped overlay leaves an artifact whose digest no longer holds (the
1004
+ engine refuses the whole candidate it rides in, every domain with it), and a dropped worker artifact substitutes the scope's
1005
+ text for that worker (a replacement, not a narrowing). Its whenUnreadable stance stays `"default"`: unreadable ⇒ `{}` ⇒ no
1006
+ center layer is served (the engine's built-in prompt).
1007
+ - rosters: NONE — a dropped roster makes resolveEffectiveForWorker fall back to the FULL models catalog for that worker
1005
1008
  * (放权,不许).
1006
1009
  * - workers: NONE — a dropped worker row reads as "this worker is no longer declared": the reconciler would retire it. The
1007
1010
  * per-row tolerance this domain does have lives in `readWorkersRows` (rows are HELD with their original, never dropped).
@@ -1024,7 +1027,7 @@ export const DOMAIN_ENTRY_SALVAGE = {
1024
1027
  entitlement: "none",
1025
1028
  execution: "none",
1026
1029
  projects: "salvage",
1027
- prompts: "salvage",
1030
+ prompts: "none",
1028
1031
  limits: "none",
1029
1032
  };
1030
1033
  /**
@@ -1074,8 +1077,8 @@ export function buildEffective(version, getRaw, updatedAt, onWarning) {
1074
1077
  // execution (0.8.0, S3): plain scope-level parse — MIRRORS governance (no overlay/merge invented here).
1075
1078
  execution: parseOr("execution", getRaw("execution")),
1076
1079
  projects: parseOr("projects", getRaw("projects")),
1077
- // prompts (0.10.18, [1064]②): content domain(坏形回空默认=「无 prompts 管理」语义;fail-closed 由 PUBLISH_MODE 发布闸承担,
1078
- // 空 bindings 不下发内容,default 不扩权)。
1080
+ // prompts (0.10.18 起;14.0.0 单轴): content domain(坏形回空默认 `{}` =「不管提示词」;fail-closed 由 PUBLISH_MODE 发布闸承担,
1081
+ // `{}` 不下发中心层,default 不扩权)。
1079
1082
  prompts: parseOr("prompts", getRaw("prompts")),
1080
1083
  limits: parseOr("limits", getRaw("limits")),
1081
1084
  };
@@ -1109,10 +1112,10 @@ export function readEffectiveWire(raw, onWarning) {
1109
1112
  const updatedAt = typeof r.updatedAt === "string" ? r.updatedAt : "";
1110
1113
  // skills redirected to undefined: buildEffective must never see the manifest(it would fail the full-domain
1111
1114
  // schema and "default" it with a FALSE domain-defaulted warning);the manifest is judged separately below.
1112
- // prompts likewise redirected(#100):on the wire it is web-admin-assembled RESOLVED form(worker lane
1113
- // strips the bindings storage table — types.ts PromptsConfig 注 [1057]⑤),consumer-validated additive JSON;
1114
- // the storage-domain schema would swallow it to {bindings:[]} with ZERO warning(zod non-strict 剥键后
1115
- // "成功")— 3.24.0 起 server 侧 promptsGate 恒败的根因。verbatim,by presence(见 return)。
1115
+ // prompts likewise redirected(#100):on the wire it is the published form `EffectivePromptsWire`(`{schemaVersion: 2, artifact}`,
1116
+ // the one artifact selected for the pulling worker — never the storage shape), judged by the CONSUMER(that shape, then the engine's
1117
+ // verify). The read leg must not parse it with the storage schema: a bad prompts value would be degraded to "absent" here and read
1118
+ // downstream as "the center withdrew its layer" — the consumer's judge refuses it loudly instead. verbatim, by presence(见 return)。
1116
1119
  const built = buildEffective(r.version, (d) => (d === "skills" || d === "prompts" ? undefined : r[d]), updatedAt, onWarning);
1117
1120
  // retired 域名不是 open-world 的未知键:墓碑已在 buildEffective 里判过(带事实 ⇒ 抛),剩下的 `{}` 没有可承运的东西。
1118
1121
  let skills;
@@ -1143,8 +1146,8 @@ export function readEffectiveWire(raw, onWarning) {
1143
1146
  // `Object.fromEntries`,**不是**逐键 `passthrough[k] = v`:后者对 `"__proto__"` 走的是原型 setter
1144
1147
  // (改掉对象的原型,而不是加一个键),fromEntries 走 CreateDataProperty —— 同一条「键就是键」的律。
1145
1148
  const passthrough = Object.fromEntries(Object.entries(r).filter(([k]) => !Object.prototype.hasOwnProperty.call(built, k) && k !== "skills" && !isRetiredDomainName(k)));
1146
- // prompts:剥掉 buildEffective 恒物化的 {bindings:[]} 底座,按 wire 在场性 verbatim 挂回(#100:
1147
- // 缺席进缺席出——web-admin worker-lane 闸关是常态形,物化会让消费端「缺席」分支永不可达)。
1149
+ // prompts:剥掉 buildEffective 恒物化的 `{}` 底座,按 wire 在场性 verbatim 挂回(#100:
1150
+ // 缺席进缺席出——发布闸关是常态形,物化会让消费端「缺席」分支永不可达)。
1148
1151
  const { prompts: _promptsMaterialized, ...builtSansPrompts } = built;
1149
1152
  return { ...passthrough, ...builtSansPrompts, skills, ...("prompts" in r ? { prompts: r.prompts } : {}) };
1150
1153
  }
@@ -8,7 +8,7 @@
8
8
  * 显示成 diff。于是「有没有第四条变换没登记」这件事不再靠人回忆 —— 没登记的那条会自己红出来。
9
9
  *
10
10
  * 变换表(每条写明:动了什么、影响哪几条腿、出处):
11
- * · **T1 prompts 物化**(wire):`buildEffective` 恒物化 `prompts: {bindings:[]}`;wire 腿按**在场性**
11
+ * · **T1 prompts 物化**(wire):`buildEffective` 恒物化 `prompts`(域缺席 ⇒ `{}`;14.0.0 前是 `{bindings:[]}`);wire 腿按**在场性**
12
12
  * verbatim 挂回(`readEffectiveWire` 的 `"prompts" in r` 判据)—— 缺席进缺席出,且在场时是**未解析的
13
13
  * 原文档**。
14
14
  * · **T2 skills 表示**(wire):域形带 `content`,wire 形带 `contentHash`(manifest)。判据 schema 随表示走。
@@ -39,7 +39,7 @@ import { skillContentHash } from "../skills-manifest.js";
39
39
  import { DOMAINS, isDomainName } from "../types.js";
40
40
  /** 变换表(本文件头注的机器形;`docs/CONFORMANCE.md` 与 `test/conformance-coverage.test.ts` 都读它)。 */
41
41
  export const DERIVATION_TRANSFORMS = [
42
- { id: "T1-prompts-materialisation", legs: ["wire"], what: "buildEffective 恒物化 prompts:{bindings:[]};wire 按在场性 verbatim 挂回(缺席进缺席出)" },
42
+ { id: "T1-prompts-materialisation", legs: ["wire"], what: "buildEffective 恒物化 prompts(缺席 ⇒ {});wire 按在场性 verbatim 挂回(缺席进缺席出)" },
43
43
  { id: "T2-skills-representation", legs: ["wire"], what: "域形 content ↔ wire 形 contentHash(manifest),判据 schema 随表示走" },
44
44
  { id: "T3-non-portable-domains", legs: ["localRoot"], what: "config.d/ 只读 PORTABLE_DOMAINS;其余域取默认 + unread-config-file{non-portable-domain}" },
45
45
  { id: "T4-unknown-top-level-key", legs: ["wire", "localRoot"], what: "wire open-world 逐字承运;domains 腿按域名取文档故无声;local 报 unread-config-file{not-a-domain}" },
package/dist/index.d.ts CHANGED
@@ -36,3 +36,4 @@ export * from "./url-pattern.js";
36
36
  export * from "./http-hook-allowlists.js";
37
37
  export * from "./mcp-server-policy.js";
38
38
  export * from "./ui-language.js";
39
+ export * from "./mcp-request-entry.js";
package/dist/index.js CHANGED
@@ -36,6 +36,7 @@ export * from "./url-pattern.js"; // 13.0.0 (S-1597): THE URL-list pattern judge
36
36
  export * from "./http-hook-allowlists.js"; // 13.0.0 (U3): allowedHttpHookUrls / httpHookAllowedEnvVars — one layer reader + httpHookUrlVerdict / httpHookEnvVarsAllowed (admitted layers INTERSECT; SAFETY_MERGE_SPEC.httpHookAllowlists), pure/browser-safe
37
37
  export * from "./mcp-server-policy.js"; // 13.0.0 (U6): mcpServerPolicyVerdict → McpPolicyBlock{name, list, rule, target, written, sources} (structure, no sentence; target judged expanded, echoed only as written), pure/browser-safe
38
38
  export * from "./ui-language.js"; // 13.0.0 (S-1592): the UI-language settings fragment (semaUiLanguage, en | zh, category ui, user settings) + readUiLanguage, pure/browser-safe
39
+ export * from "./mcp-request-entry.js"; // 14.0.0: the request-plane MCP entry judges (isUsableWireName / isContentOriginWord / readMcpIdentityHeaders / readRequestMcpTransport + the value-shape describers) — one reading for the service legs and the shell pre-check, pure/browser-safe
39
40
  // NOTE: the Node-fs-backed helpers (FileConfigStore + the file editor) are NOT in this barrel — they pull
40
41
  // `node:fs`/`node:path` and would break a browser/client bundle that only wants the contract (e.g.
41
42
  // web-admin's client components import the zod types through here). Import them from the Node-only
@@ -0,0 +1,118 @@
1
+ /**
2
+ * 请求面 MCP 条目(一条任务提交体 `mcpServers[i]`)的形判官 —— 14.0.0 起住本包:一只读法,消费方的请求腿 / 中心腿 / 壳的发送前预检都 import 这一份。
3
+ * 纯函数、浏览器安全(唯一的值依赖是本包自己的内容出处词表)。
4
+ *
5
+ * ## 律(一条)
6
+ * **一条请求面 MCP 条目的每一格「能不能用」只有一只判官。** 此前这些判官是消费方私有的:壳拿不到,只能在发送前披露「判不准、交给服务端」,
7
+ * 或者自己抄一份 —— 两份判据就是将来漂开的那一份。现在判官在契约包,服务端与壳读同一份,同一条条目在两处同受理 / 同拒、同一个键路径、同一句原因。
8
+ *
9
+ * ## 语义是搬来的,不是重写的
10
+ * 判据与原因句逐字等于消费方请求腿的那一份(钉:`test/mcp-request-entry-14.0.0.test.ts` 逐例搬了消费方既有钉的夹具与期望)。
11
+ * 本模块只答「这一格的形」;拒绝的整句(条目下标、条目名的回显清洗、收尾句)与「拒还是降级」的后果仍是消费方按自己的腿定的 —— 判据一份,后果按腿分。
12
+ * 与最初搬来时相比有三处收严,都是收到与消费方请求腿同严、不是新语义,消费方改 import 这一份之后不再各留一份旧判据:申报名判官另判**首尾空白**;
13
+ * `env` / `headers` 只收**纯数据**的「名 → 串」记录(Map / 类实例 / 自有 `__proto__` 成员不收,交出的是副本);两只回显描述器用消费方的回显口径(剥控制与双向字符、截 64 字、引号形)。
14
+ *
15
+ * ## 依赖的引擎事实(镜像 + 漂移门)
16
+ * · 申报名的线长界 {@link TOOL_WIRE_NAME_MAX_CHARS} = 引擎同名常量(值级对拍:上游漂移门 ⑧);
17
+ * · 请求面传输形 {@link RequestMcpTransport} = 引擎 MCP 条目的传输形,http 形多一个本包承载的 `assertionHeader`(编译期双向对拍:门 ⑧);
18
+ * · 内容出处词表 = {@link MCP_CONTENT_ORIGINS}(已有的镜像,门 ⑥);
19
+ * · 回显清洗类的双向半场 = 引擎 `BIDI_CONTROL_CHARS`(镜像,逐码点全扫对拍:门 ⑨;本包运行期不依赖引擎);
20
+ * · url 前缀守卫 = `./url-shape` 的 `startsWithHttpScheme`(本包判 URL 的正则只在那一个模块)。
21
+ *
22
+ * ## 与配置面的关系(如实)
23
+ * 配置面的 MCP 条目(`McpServerSpec`,部署声明:凭据只许 env-NAME 引用)与请求面(提交体:可带字面凭据 `env` / `headers`)是两份契约,本模块只管后者。
24
+ * 两份契约对「名」与「url」今天给的判据不同(配置面:名按字符集、url 按 `NON_SECRET_URL`;请求面:名按长度界、url 按 http(s) 前缀),本版刻意不动
25
+ * (语义逐字搬),是一项已知待收的分歧。
26
+ */
27
+ import { type McpContentOrigin } from "./types.js";
28
+ /** 值的**种类**(不回显值本身)。 */
29
+ export declare function describeValueShape(v: unknown): string;
30
+ /** 「不是字符串数组」的种类:数组里混了非串元素说那一句,否则回落到 {@link describeValueShape}。 */
31
+ export declare function describeNotStringArray(v: unknown): string;
32
+ /** 「不是字符串值的对象」的种类:对象里混了非串值说那一句,否则回落到 {@link describeValueShape}。 */
33
+ export declare function describeNotStringRecord(v: unknown): string;
34
+ /** 字符串数组(空数组合法)。 */
35
+ export declare function isStringArray(v: unknown): v is string[];
36
+ /**
37
+ * 纯数据的「名 → 串」记录(空对象合法;数组、`Map`、类实例、自有 `__proto__` 成员、有非串成员的对象都不是)。与传输读器读 `env` / `headers` 是**同一个**定义
38
+ * ({@link readPlainStringRecord}):包内没有第二把更宽的尺。
39
+ */
40
+ export declare function isStringRecord(v: unknown): v is Record<string, string>;
41
+ /** 引擎 `TOOL_WIRE_NAME_MAX_CHARS` 的镜像:一台 MCP server(或 A2A 对端)的申报名会成为线上工具名的命名空间段,引擎对超界名是**拒**(不截断)。 */
42
+ export declare const TOOL_WIRE_NAME_MAX_CHARS = 128;
43
+ /**
44
+ * 这个申报名能用吗。严判:非串、空串、超 {@link TOOL_WIRE_NAME_MAX_CHARS}、**首尾带空白**一律不可用。不截断、不 trim、不规范化 —— 截短或剥掉一个名字就是**换一个身份**,
45
+ * 而被换掉身份的那台 server 上挂的 allowTools / toolFaces 收窄声明会一起对不上号。首尾空白 = 坏名(它不是另一个名字:名字是 `mcp__<server>__<tool>` 的身份片,
46
+ * 带着空白的一端无从与不带的那个对上号);内部空白(`a b`)照旧是合法名,本判官不扩判。
47
+ */
48
+ export declare function isUsableWireName(v: unknown): v is string;
49
+ /**
50
+ * 坏名的**可打印**摘要(进拒句 / 告警元数据):种类、`empty`,或引号形的回显加原因 —— 绝不把任意长度的申报串原样回显。回显口径见 {@link quotedCallerText}
51
+ * (剥控制与双向字符、截 64 字)。串的原因是:超界 ⇒ `N chars > 128`(N 是送来的原长度,不是剥完的);首尾带空白 ⇒ `leading or trailing whitespace`
52
+ * (制表 / 换行这类控制空白在回显里被剥掉,所以看得出是空白靠这个种类词,不靠引号里的样子);两件事并存 ⇒ 一句说全(`N chars > 128, leading or trailing whitespace`)。
53
+ */
54
+ export declare function describeBadWireName(v: unknown): string;
55
+ /**
56
+ * 在内容出处词表({@link MCP_CONTENT_ORIGINS})内吗。严判:非串与大小写不符(`"LOCAL"`)一律不在 —— 引擎的词是字面量联合、不做规范化;
57
+ * 替它「宽容一下」等于自造第二份值域语义,而这条轴上宽容的方向恰好是**放宽信任**(把一个写坏的声明读成 `"local"`)。
58
+ */
59
+ export declare function isContentOriginWord(v: unknown): v is McpContentOrigin;
60
+ /** 坏内容出处值的**可打印**摘要:串 ⇒ 引号形的回显({@link quotedCallerText}:剥控制与双向字符、截 64 字);非串只说种类。 */
61
+ export declare function describeBadContentOrigin(v: unknown): string;
62
+ /**
63
+ * 一份 http 传输上两个身份头(`principalHeader` / `assertionHeader`)的读法:字符串才收;**`principalHeader` 胜** —— 它在场(不论值形)时
64
+ * `assertionHeader` 不收。所以读后的形**结构上不可能同带两键**;同设(一份声明给出两个答案)由调用方在读之前对**原始**传输判(判的是写了什么,不是读后留下什么)。
65
+ */
66
+ export declare function readMcpIdentityHeaders(transport: Record<string, unknown>): {
67
+ principalHeader?: string;
68
+ assertionHeader?: string;
69
+ };
70
+ /** 请求面一条 MCP 条目的传输形:引擎的传输形,http 形多一个承载的 `assertionHeader`(引擎的 http 传输没有这个座;交给引擎之前由消费方剥掉)。 */
71
+ export type RequestMcpTransport = {
72
+ kind: "stdio";
73
+ command: string;
74
+ args?: string[];
75
+ env?: Record<string, string>;
76
+ } | {
77
+ kind: "http";
78
+ url: string;
79
+ headers?: Record<string, string>;
80
+ principalHeader?: string;
81
+ assertionHeader?: string;
82
+ };
83
+ /**
84
+ * 条目内一处坏形:`path` = 条目内的键路径(`transport.url`),`reason` = 判官的原因句(只说形与词表,不回显值)。
85
+ *
86
+ * `env` / `headers` 这两张「名 → 串」记录上的坏形另带两格机读位,调用方分流不必解析句子:`fault` = 闭集词 ——
87
+ * · `not_plain_record`:这个键的值不是纯数据记录(不是对象 / 数组 / `null`,或原型不是 `Object.prototype` 与 `null`:`Map`、`Set`、类实例);整张记录不交;
88
+ * · `member_not_string`:有一个成员的值不是串(或访问器抛了);整张记录不交,`member` 点名它;
89
+ * · `member_name_reserved`:有一个成员叫 `__proto__`(引擎的声明收据拒这个名)。成员的值是串 ⇒ 只剔这个成员、其余照交,`path` 是成员级(`transport.env.__proto__`);
90
+ * 成员的值也不是串 ⇒ 整张记录不交,`path` 是键级,句子一次说全两件事 —— 名坏优先、值坏并列,所以词仍是 `member_name_reserved`。
91
+ * `member` 是成员名的**回显形**(剥控制与双向字符、截 64 字加 `…`),可直接进日志与句子,不是回查原对象的键。其余的坏形(`args` / `url` / `principalHeader` / ……)两格都不带。
92
+ */
93
+ export interface McpEntryKeyIssue {
94
+ readonly path: string;
95
+ readonly reason: string;
96
+ readonly member?: string;
97
+ readonly fault?: "not_plain_record" | "member_not_string" | "member_name_reserved";
98
+ }
99
+ /** {@link readRequestMcpTransport} 的结果:`ok:false` = 硬坏形(这条 server 无从挂载);`ok:true` 的 `lost` = 读器**丢掉**的可选子键(server 照挂、少一个声明)。 */
100
+ export type RequestMcpTransportRead = {
101
+ ok: true;
102
+ transport: RequestMcpTransport;
103
+ lost: readonly McpEntryKeyIssue[];
104
+ } | {
105
+ ok: false;
106
+ issue: McpEntryKeyIssue;
107
+ };
108
+ /**
109
+ * 请求面 `transport` 的**唯一读器**:读器投影 transport 用它,发送前 / 受理时的判形读它报的 `lost` —— 同一只函数两个消费点,「读器丢了什么」与「门拒什么」不可能分岔。
110
+ * · 硬坏形(`transport` 不是对象 / `kind` 出闭集 / stdio 缺 `command` / http 的 `url` 不是 http(s))⇒ `ok:false`,`path` 是读器点名的键路径;
111
+ * · 软坏形(`args` 不是串数组 / `env` `headers` 不是纯数据的串记录 / `principalHeader` 非串)⇒ 读器**丢这个键**(重放存量提交体时的升级前读法),并把它记进 `lost`
112
+ * (受理新提交的门据它响亮拒)。`assertionHeader` 不在 `lost` 里:两个身份头的键组合与 `assertionHeader` 的值形由调用方在读之前对原始传输判。
113
+ * · `env` / `headers` 只收**纯数据**的记录({@link readPlainStringRecord}):原型必须是 `Object.prototype` 或 `null`(`Map`、`Set`、类实例整张不收),每个自有成员的值都是串;
114
+ * 交出的是**副本**(不是调用方的对象,改原对象不影响读后的形)。名叫 `__proto__` 的成员(JSON 文本铸得出这个自有键,对象字面量写不出)不进副本、单独记进 `lost`。
115
+ * 坏形的 `lost` 条目带机读位(见 {@link McpEntryKeyIssue})。
116
+ * url 的拒句不回显值:它常规地带凭据(userinfo)。
117
+ */
118
+ export declare function readRequestMcpTransport(t: unknown): RequestMcpTransportRead;