@sema-agent/settings-schema 28.0.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.
- package/CHANGELOG.md +330 -0
- package/README.md +81 -12
- package/conformance/VERSION +1 -1
- package/conformance/cases/c01-entry-salvage-then-typo/expected.json +1 -1
- package/conformance/cases/c02-hosts-clamp-stacked/expected.json +1 -1
- package/conformance/cases/c03-literal-dotted-top-key/expected.json +1 -1
- package/conformance/cases/c04-all-bad-collection-not-salvaged/expected.json +1 -1
- package/conformance/cases/c07-hooks-is-not-a-config-domain/expected.json +1 -1
- package/conformance/cases/c08-limits-unknown-carried-64/expected.json +1 -1
- package/conformance/cases/c09-limits-unknown-carried-65/expected.json +1 -1
- package/conformance/cases/c10-record-key-secret-redacted-twice/expected.json +1 -1
- package/conformance/cases/c11-unicode-unknown-keys/expected.json +1 -1
- package/conformance/cases/c12-prototype-name-top-keys/expected.json +1 -1
- package/conformance/cases/c13-models-field-null/expected.json +1 -1
- package/conformance/cases/c14-models-field-empty-array/expected.json +1 -1
- package/conformance/cases/c15-models-field-number/expected.json +1 -1
- package/conformance/cases/c18-wire-envelope-not-an-object/expected.json +1 -1
- package/conformance/cases/c19-wire-envelope-no-version/expected.json +1 -1
- package/conformance/cases/c21-governance-empty-object-wins/expected.json +1 -1
- package/conformance/cases/c23-mixed-validity-models/expected.json +1 -1
- package/conformance/cases/c24-valid-entries-with-unknown-keys/expected.json +1 -1
- package/conformance/cases/c25-published-roundtrip-zero-warnings/expected.json +1 -1
- package/conformance/cases/c26-hosts-array-1024/expected.json +1 -1
- package/conformance/cases/c27-hosts-array-1025/expected.json +1 -1
- package/conformance/cases/c28-large-document-over-1mb/expected.json +1 -1
- package/conformance/cases/c29-salvage-then-domain-refine-fails/expected.json +1 -1
- package/conformance/cases/c30-version-triple-a-first/expected.json +1 -1
- package/conformance/cases/c31-version-triple-b-changed/expected.json +1 -1
- package/conformance/cases/c32-version-triple-a-restored/expected.json +1 -1
- package/conformance/cases/c33-limits-nested-carried-key/expected.json +1 -1
- package/conformance/cases/c34-skills-content-vs-manifest/expected.json +1 -1
- package/conformance/cases/c36-skills-entry-without-content/expected.json +1 -1
- package/conformance/cases/c38-remote-exec-is-a-non-domain-file/expected.json +1 -1
- package/conformance/cases/c39-hidden-file-in-config-d/expected.json +1 -1
- package/conformance/cases/c40-s712-identity-only-what-reads-out/expected.json +1 -1
- package/conformance/cases/c41-s792-encoded-pem-identity/expected.json +1 -1
- package/conformance/cases/c42-s792-unknown-key-secret-redacted/expected.json +1 -1
- package/conformance/cases/c43-s792-form-and-deep-encoded-pem/expected.json +1 -1
- package/conformance/cases/c44-s792-utf8-escape-glued-token/expected.json +1 -1
- package/conformance/cases/c45-s792-identity-bounds-and-decode-depth/expected.json +1 -1
- package/conformance/cases/c46-s811-host-name-url-userinfo-withheld/expected.json +1 -1
- package/conformance/cases/c47-s811-roles-key-url-userinfo-withheld/expected.json +1 -1
- package/conformance/cases/c48-s935-model-headers-transported/expected.json +1 -1
- package/conformance/cases/c49-s935-model-headers-secret-entry-dropped/expected.json +1 -1
- package/conformance/cases/c50-s784-lane-host-legal/expected.json +1 -1
- package/conformance/cases/c51-s784-lane-e2b-legal/expected.json +1 -1
- package/conformance/cases/c52-s784-lane-k8s-legal/expected.json +1 -1
- package/conformance/cases/c53-s784-lane-ssh-legal/expected.json +1 -1
- package/conformance/cases/c54-s784-lane-adb-legal/expected.json +1 -1
- package/conformance/cases/c55-s784-lane-local-docker-legal/expected.json +1 -1
- package/conformance/cases/c56-s784-lane-device-legal/expected.json +1 -1
- package/conformance/cases/c57-s784-g1-enabled-no-lane/expected.json +1 -1
- package/conformance/cases/c58-s784-g2-multitenant-host/expected.json +1 -1
- package/conformance/cases/c59-s784-g3-k8s-missing-image/expected.json +1 -1
- package/conformance/cases/c60-s784-g3-e2b-missing-key/expected.json +1 -1
- package/conformance/cases/c61-s784-g3-other-lane-key/expected.json +1 -1
- package/conformance/cases/c62-s784-g7a-session-tidb/expected.json +1 -1
- package/conformance/cases/c63-s784-host-two-replicas/expected.json +1 -1
- package/conformance/cases/c64-s784-multitenant-local-store/expected.json +1 -1
- package/conformance/cases/c65-s784-pg-without-db/expected.json +1 -1
- package/conformance/cases/c66-s784-memory-backend-mismatch/expected.json +1 -1
- package/conformance/cases/c67-s784-retired-field-loud/expected.json +1 -1
- package/conformance/cases/c68-s784-device-local-store/expected.json +1 -1
- package/conformance/cases/c69-deep-encoded-token-past-every-reading/expected.json +1 -1
- package/conformance/cases/c70-rewritten-token-in-front-of-encoded-pem-header/expected.json +1 -1
- package/conformance/cases/c71-one-scanner-write-reads-display-forms/expected.json +1 -1
- package/conformance/cases/c72-dangling-reference-write-seat-refuses/expected.json +1 -1
- package/conformance/cases/c73-projects-extended-registration-reads/expected.json +1 -1
- package/conformance/cases/c74-projects-over-bound-refused/expected.json +3 -72
- package/conformance/cases/c75-projects-patch-remote-uniqueness/expected.json +3 -72
- package/conformance/cases/c76-projects-entry-salvage-nested/expected.json +1 -1
- package/conformance/cases/c77-prompts-center-artifact-carried/expected.json +1 -1
- package/conformance/cases/c78-prompts-empty-bindings-refused/expected.json +1 -1
- package/conformance/cases/c79-prompts-bad-worker-artifact-not-salvaged/expected.json +1 -1
- package/conformance/cases/c80-prompts-wire-v2-verbatim/expected.json +1 -1
- package/conformance/cases/c81-prompts-declaration-bindings-refused/expected.json +1 -1
- package/conformance/cases/c82-prompts-v1-catalog-refused/expected.json +1 -1
- package/conformance/cases/c83-prompts-bad-overlay-not-salvaged/expected.json +1 -1
- package/conformance/cases/c84-sandbox-git-block-carried-verbatim/expected.json +1 -1
- package/conformance/cases/c85-sandbox-git-refused-block-still-carried/expected.json +1 -1
- package/conformance/cases/c86-a2a-peers-legal/expected.json +1 -1
- package/conformance/cases/c87-a2a-credential-refs-not-partially-salvaged/expected.json +1 -1
- package/conformance/cases/c88-projects-content-attestation-carried/expected.json +1 -1
- package/conformance/cases/c89-projects-content-attestation-malformed/expected.json +1 -1
- package/conformance/cases/c90-mcp-assertion-credential-carried/expected.json +143 -0
- package/conformance/cases/c90-mcp-assertion-credential-carried/input.json +30 -0
- package/conformance/cases/c90-mcp-assertion-credential-carried/meta.json +6 -0
- package/conformance/cases/c91-mcp-assertion-header-retired-entry-dropped/expected.json +105 -0
- package/conformance/cases/c91-mcp-assertion-header-retired-entry-dropped/input.json +27 -0
- package/conformance/cases/c91-mcp-assertion-header-retired-entry-dropped/meta.json +6 -0
- package/conformance/cases/c92-mcp-principal-header-with-assertion-dropped/expected.json +105 -0
- package/conformance/cases/c92-mcp-principal-header-with-assertion-dropped/input.json +31 -0
- package/conformance/cases/c92-mcp-principal-header-with-assertion-dropped/meta.json +6 -0
- package/conformance/cases/c93-mcp-header-refs-with-credentials-dropped/expected.json +105 -0
- package/conformance/cases/c93-mcp-header-refs-with-credentials-dropped/input.json +33 -0
- package/conformance/cases/c93-mcp-header-refs-with-credentials-dropped/meta.json +6 -0
- package/conformance/cases/c94-mcp-credentials-env-kind-dropped/expected.json +105 -0
- package/conformance/cases/c94-mcp-credentials-env-kind-dropped/input.json +32 -0
- package/conformance/cases/c94-mcp-credentials-env-kind-dropped/meta.json +6 -0
- package/conformance/cases/c95-mcp-credentials-audience-not-connector-id-dropped/expected.json +105 -0
- package/conformance/cases/c95-mcp-credentials-audience-not-connector-id-dropped/input.json +30 -0
- package/conformance/cases/c95-mcp-credentials-audience-not-connector-id-dropped/meta.json +6 -0
- package/conformance/cases/c96-mcp-credentials-extra-member-dropped/expected.json +105 -0
- package/conformance/cases/c96-mcp-credentials-extra-member-dropped/input.json +31 -0
- package/conformance/cases/c96-mcp-credentials-extra-member-dropped/meta.json +6 -0
- package/conformance/cases/cc01-mcp-toolfaces-non-object/expected.json +1 -1
- package/conformance/cases/cc02-mcp-source-key-is-transported/expected.json +1 -1
- package/conformance/cases/cc03-model-compat-unknown-subkey/expected.json +1 -1
- package/conformance/cases/cli01-model-name-nfc-vs-nfd/expected.json +1 -1
- package/conformance/cases/cli02-control-and-zero-width-chars/expected.json +1 -1
- package/conformance/cases/cli03-credential-pasted-into-unknown-key/expected.json +1 -1
- package/conformance/cases/cli04-env-value-with-newline/expected.json +1 -1
- package/conformance/cases/cli05-long-and-prefix-colliding-names/expected.json +1 -1
- package/conformance/cases/t01-absent-domain-key-not-null/expected.json +1 -1
- package/conformance/cases/t03-prototype-name-key-not-swallowed/expected.json +1 -1
- package/conformance/cases/t04-secret-literal-never-in-warning-value/expected.json +1 -1
- package/conformance/cases/z01-every-domain-empty-object/expected.json +1 -1
- package/conformance/cases/z02-every-domain-unknown-key/expected.json +1 -1
- package/dist/api/credentials.js +5 -7
- package/dist/api/lifecycle-events.d.ts +266 -0
- package/dist/api/lifecycle-events.js +169 -0
- package/dist/api/wire-scalars.d.ts +13 -0
- package/dist/api/wire-scalars.js +15 -0
- package/dist/atomic-write.d.ts +4 -0
- package/dist/atomic-write.js +26 -3
- package/dist/config-d-file.d.ts +1 -1
- package/dist/config-document-refusal.d.ts +4 -4
- package/dist/config-fns.d.ts +1 -1
- package/dist/config-root-documents.d.ts +1 -1
- package/dist/config-root-node.js +2 -1
- package/dist/conformance/corpus.d.ts +1 -1
- package/dist/conformance/derive.d.ts +13 -5
- package/dist/conformance/derive.js +36 -20
- package/dist/conformance/index.d.ts +1 -1
- package/dist/conformance/index.js +1 -1
- package/dist/conformance/run.js +8 -9
- package/dist/connector-authorize-url.d.ts +23 -0
- package/dist/connector-authorize-url.js +129 -0
- package/dist/connector-id.d.ts +23 -0
- package/dist/connector-id.js +27 -0
- package/dist/file-edit.d.ts +44 -0
- package/dist/file-edit.js +70 -1
- package/dist/file-store.d.ts +12 -7
- package/dist/file-store.js +70 -58
- package/dist/hooks.d.ts +15 -5
- package/dist/hooks.js +13 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -1
- package/dist/mcp-entry-credential.d.ts +47 -0
- package/dist/mcp-entry-credential.js +73 -0
- package/dist/mcp-request-entry.d.ts +32 -13
- package/dist/mcp-request-entry.js +104 -58
- package/dist/migration-receipt.d.ts +2 -2
- package/dist/migration-receipt.js +2 -2
- package/dist/one-time-migrations.d.ts +2 -2
- package/dist/one-time-migrations.js +72 -55
- package/dist/portable-domains.d.ts +18 -12
- package/dist/portable-domains.js +17 -12
- package/dist/retired-role-words.d.ts +1 -1
- package/dist/retired-role-words.js +4 -6
- package/dist/scheduler-store-node.d.ts +5 -2
- package/dist/scheduler-store-node.js +8 -5
- package/dist/sha256.d.ts +5 -0
- package/dist/sha256.js +7 -0
- package/dist/skills-manifest.js +2 -2
- package/dist/types.d.ts +80 -10
- package/dist/types.js +30 -39
- package/docs/API-SURFACE.md +47 -7
- package/docs/CONFORMANCE.md +6 -4
- package/docs/CONSUMER-INTEGRATION.md +109 -4
- package/llms-full.txt +44 -23
- package/llms.txt +26 -13
- package/package.json +3 -2
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
* · 申报名的线长界 {@link TOOL_WIRE_NAME_MAX_CHARS} = 引擎同名常量(值级对拍:上游漂移门 ⑧);
|
|
17
17
|
* · 请求面传输形 {@link RequestMcpTransport} 对引擎 MCP 条目的传输形是一张处置表,两边每个键恰好一行(编译期两向对拍:门 ⑧)——
|
|
18
18
|
* `kind` / `command` / `args` / `url` / `principalHeader` 与引擎同键同型;`env` / `headers` 是请求带来的字面件(引擎的声明不带值);
|
|
19
|
-
* `
|
|
19
|
+
* 引擎的 `credentials`(不透明的凭据引用)请求面不承载 —— 在场 ⇒ 读器点名拒({@link MCP_REQUEST_KEY_REFUSALS} 的 `credentials_not_carried`);
|
|
20
|
+
* · 请求面点名拒的键(本包一份判法,消费方只做处置):`assertionHeader`(29.0.0 退役)与 `credentials`,见 {@link MCP_REQUEST_KEY_REFUSALS};
|
|
20
21
|
* · 内容出处词表 = {@link MCP_CONTENT_ORIGINS}(已有的镜像,门 ⑥);
|
|
21
22
|
* · url 前缀守卫 = `./url-shape` 的 `startsWithHttpScheme`(本包判 URL 的正则只在那一个模块)。它只看前缀,不是形判官 —— 同一个串两口可以答得不同,两张分歧表与收口形(S-2106)写在 `./url-shape` 头注「第二个答案」。
|
|
22
23
|
*
|
|
@@ -34,6 +35,8 @@ import { startsWithHttpScheme } from "./url-shape.js";
|
|
|
34
35
|
import { TOOL_WIRE_NAME_MAX_CHARS, hasEdgeWhitespace, isUsableWireName } from "./wire-name.js";
|
|
35
36
|
import { isReservedMemberName } from "./reserved-member-name.js";
|
|
36
37
|
import { deepFreeze } from "./deep-freeze.js";
|
|
38
|
+
import { CREDENTIAL_REF_TRUST, readCredentialRef } from "@sema-agent/primitives";
|
|
39
|
+
import { retiredFormSentence } from "./retired-form.js";
|
|
37
40
|
// ── 值的种类描述(拒句只说「你写的是什么形」,不回显值:值可能带凭据、可能任意长)──────────────────────────────────────
|
|
38
41
|
/** 值的**种类词**(不回显值本身):`null` / `array` / `typeof` 词(`object` / `function` / `string` …);读不出的对象 ⇒ 全包唯一的那一句。形状只问座位(总,不抛):两只坏值描述器共用这一只。 */
|
|
39
42
|
function describeKindWord(v) {
|
|
@@ -160,61 +163,73 @@ export function isContentOriginWord(v) {
|
|
|
160
163
|
export function describeBadContentOrigin(v) {
|
|
161
164
|
return typeof v === "string" ? quotedCallerText(v) : describeKindWord(v);
|
|
162
165
|
}
|
|
163
|
-
// ──
|
|
166
|
+
// ── 身份 / 凭据轴上的键 ─────────────────────────────────────────────────────────────────────────────
|
|
164
167
|
/**
|
|
165
|
-
*
|
|
166
|
-
* `
|
|
168
|
+
* 传输上**身份 / 凭据轴**的键(闭集;也是 `lost` 里点名它们的次序):身份头 `principalHeader`,与点名拒的两把键 `assertionHeader` / `credentials`({@link MCP_REQUEST_KEY_REFUSALS})。
|
|
169
|
+
* 一条律、一只读法({@link axisKeyOf}):只认自有键;只靠继承可见 ⇒ 不读、进 `lost` 点名({@link inheritedAxisKeyIssue})。
|
|
167
170
|
*/
|
|
168
|
-
|
|
169
|
-
const ids = identityFieldsOf(transport);
|
|
170
|
-
if (!ids.ok)
|
|
171
|
-
return {}; // 读不出 ⇒ 身份头整体读不出(传输读器对同样的输入是整只不交)
|
|
172
|
-
const { principalHeader, assertionHeader } = ids.value;
|
|
173
|
-
return {
|
|
174
|
-
...(typeof principalHeader === "string" ? { principalHeader } : {}),
|
|
175
|
-
...(typeof assertionHeader === "string" ? { assertionHeader } : {}),
|
|
176
|
-
};
|
|
177
|
-
}
|
|
171
|
+
const AXIS_KEYS = ["principalHeader", "assertionHeader", "credentials"];
|
|
178
172
|
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
181
|
-
* **只读自有键**(身份只认自有键):键只靠继承可见(含 `Object.prototype` 被污染成数据值)⇒ 不读它的值、当缺席,但**记下**(`principalInherited` / `assertionInherited`)—— 传输读器据此点名,
|
|
182
|
-
* 身份轴上不静默;公开读者没有 `lost` 通道,只读值。
|
|
173
|
+
* 轴上键({@link AXIS_KEYS})的**唯一读法**:**只读自有键**(身份与凭据只认自有键);键只靠继承可见(含 `Object.prototype` 被污染成数据值)⇒ 不读它的值、当缺席,
|
|
174
|
+
* 但**记下**(`inherited`)—— 传输读器据此点名,这条轴上不静默。读不出 ⇒ 整体读不出(`ok:false`,向上传),不折成 `undefined`。
|
|
183
175
|
*/
|
|
184
|
-
function
|
|
185
|
-
const
|
|
186
|
-
if (
|
|
176
|
+
function axisKeyOf(record, key) {
|
|
177
|
+
const read = readKey(record, key);
|
|
178
|
+
if (read.presence === "unreadable")
|
|
187
179
|
return { ok: false, sentence: UNINSPECTABLE };
|
|
188
|
-
|
|
189
|
-
|
|
180
|
+
return { ok: true, value: { value: read.presence === "own" ? read.value : undefined, inherited: read.presence === "inherited" } };
|
|
181
|
+
}
|
|
182
|
+
// ── 请求面点名拒的键 ────────────────────────────────────────────────────────────────────────────────────
|
|
183
|
+
/**
|
|
184
|
+
* 请求面读器**点名拒**的键的**原因词**(闭集,29.0.0)—— 与「表外未知键」分得开的那一类:读器认得这把键,知道它为什么不在请求面上。
|
|
185
|
+
* · `key_retired`:`transport.assertionHeader`(http)—— 29.0.0 退役:托管连接器的断言是部署的声明(配置面的 `transport.credentials`),头名归引擎,请求不说它;
|
|
186
|
+
* · `credentials_not_carried`:`transport.credentials`(两种传输)—— 请求面不承载凭据引用:引擎原语包的准入表(`CREDENTIAL_REF_TRUST`)对请求面拒 `env` / `handle` / `assertion`,
|
|
187
|
+
* 其余种类本版请求面也没有座位;引用是部署一侧的声明。
|
|
188
|
+
* 读到这两把键之一(自有键、值不是 `undefined`)⇒ 硬坏形({@link RequestMcpTransportRead} 的 `ok:false`),`issue.refusal` = 这里的词、`issue.path` 点名那把键、`issue.reason` 是原因句(不回显值)。
|
|
189
|
+
* 只靠继承可见 ⇒ 不读、不拒,进 `lost` 点名 —— 与身份头同一条律({@link axisKeyOf})。
|
|
190
|
+
* 判序 = 读序:`kind` 之后先读这两把键(其余键一个都还没读)—— 一条带着点名拒的键的条目,不论别处坏不坏、读不读得出,都读成这一类;两把都在 ⇒ `assertionHeader` 先。
|
|
191
|
+
* 消费方按词分派、不读句子;多一个词而穷尽 `switch` 不补 ⇒ 编译红。
|
|
192
|
+
*/
|
|
193
|
+
export const MCP_REQUEST_KEY_REFUSALS = deepFreeze(["key_retired", "credentials_not_carried"]);
|
|
194
|
+
/** `assertionHeader` 在请求面的退役句(退役形的唯一模板 `retiredFormSentence`)。 */
|
|
195
|
+
const ASSERTION_HEADER_RETIRED_ON_REQUEST = retiredFormSentence("transport.assertionHeader", {
|
|
196
|
+
retiredIn: "29.0.0",
|
|
197
|
+
now: "no request names it: a hosted connector's assertion is declared by the deployment (transport.credentials in its settings) and its header is the engine's — remove the key from the request",
|
|
198
|
+
});
|
|
199
|
+
/** 请求里出现的 `credentials` 为什么不收:原语包读得出且准入表对请求面拒这个种类 ⇒ 点名种类(闭集词);否则 ⇒ 请求面没有凭据引用的座位。两句都不回显值。 */
|
|
200
|
+
function credentialsNotCarriedReason(raw) {
|
|
201
|
+
const read = readCredentialRef(raw);
|
|
202
|
+
if (read.ok && CREDENTIAL_REF_TRUST[read.ref.kind].request === "refused") {
|
|
203
|
+
return `a credential reference of kind "${read.ref.kind}" is never taken from a request (the deployment declares it for this server) — remove transport.credentials from the request`;
|
|
190
204
|
}
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
};
|
|
205
|
+
return "a request carries no credential reference (the request surface has no seat for one; the deployment declares it) — remove transport.credentials from the request";
|
|
206
|
+
}
|
|
207
|
+
/** 点名拒的硬坏形(机读词在 `refusal`)。 */
|
|
208
|
+
const keyRefused = (path, reason, refusal) => ({ ok: false, issue: { path, reason, refusal } });
|
|
209
|
+
/** 点名拒的第一把键(判序见 {@link MCP_REQUEST_KEY_REFUSALS});没有 ⇒ `undefined`。入参是已读出的自有值(stdio 没有 `assertionHeader` 这一格:调用方传 `undefined`)。 */
|
|
210
|
+
function refusedKeyOf(assertionHeader, credentials) {
|
|
211
|
+
if (assertionHeader !== undefined)
|
|
212
|
+
return keyRefused("transport.assertionHeader", ASSERTION_HEADER_RETIRED_ON_REQUEST, "key_retired");
|
|
213
|
+
if (credentials !== undefined)
|
|
214
|
+
return keyRefused("transport.credentials", credentialsNotCarriedReason(credentials), "credentials_not_carried");
|
|
215
|
+
return undefined;
|
|
203
216
|
}
|
|
204
217
|
const transportBad = (path, reason) => ({ ok: false, issue: { path, reason } });
|
|
205
|
-
/**
|
|
206
|
-
const
|
|
218
|
+
/** 轴上键({@link AXIS_KEYS})只靠继承可见时的 `lost` 条目:不读它的值,但点名(这条轴不静默;三把键一句,句子不回显值)。机读位不带(`fault` 的闭集不为它加词)。 */
|
|
219
|
+
const inheritedAxisKeyIssue = (key) => ({
|
|
207
220
|
path: `transport.${key}`,
|
|
208
|
-
reason: "inherited key ignored (the key is visible only through the prototype chain; a transport's identity headers are read from its own keys)",
|
|
221
|
+
reason: "inherited key ignored (the key is visible only through the prototype chain; a transport's identity headers and credential reference are read from its own keys)",
|
|
209
222
|
});
|
|
223
|
+
/** 一次快照里只靠继承可见的轴上键 ⇒ `lost` 条目,按 {@link AXIS_KEYS} 的次序。 */
|
|
224
|
+
const inheritedAxisKeyIssues = (inherited) => AXIS_KEYS.filter((key) => inherited.has(key)).map(inheritedAxisKeyIssue);
|
|
210
225
|
/**
|
|
211
226
|
* 请求面 `transport` 的**唯一读器**:读器投影 transport 用它,发送前 / 受理时的判形读它报的 `lost` —— 同一只函数两个消费点,「读器丢了什么」与「门拒什么」不可能分岔。
|
|
212
|
-
* · 硬坏形(`transport` 不是对象 / `kind` 出闭集 / stdio 缺 `command` / http 的 `url` 不是 http(s))⇒ `ok:false`,`path` 是读器点名的键路径;
|
|
227
|
+
* · 硬坏形(`transport` 不是对象 / `kind` 出闭集 / 点名拒的键在场({@link MCP_REQUEST_KEY_REFUSALS},先于其余键判)/ stdio 缺 `command` / http 的 `url` 不是 http(s))⇒ `ok:false`,`path` 是读器点名的键路径;
|
|
213
228
|
* · 软坏形(`args` 不是串数组 / `env` `headers` 不是纯数据的串记录 / `principalHeader` 非串)⇒ 读器**丢这个键**(重放存量提交体时的升级前读法),并把它记进 `lost`
|
|
214
|
-
* (受理新提交的门据它响亮拒)
|
|
229
|
+
* (受理新提交的门据它响亮拒);身份 / 凭据轴上的键({@link AXIS_KEYS}:`principalHeader` / `assertionHeader` / `credentials`)只靠继承可见 ⇒ 不读值、不拒、进 `lost` 点名;
|
|
215
230
|
* · `env` / `headers` 只收**纯数据**的记录({@link readPlainStringRecord}):必须是朴素 JSON 对象(`./plain-json-object` 的判据;`Map`、`Set`、类实例整张不收),每个自有成员的值都是串;
|
|
216
231
|
* 交出的是**副本**(不是调用方的对象,改原对象不影响读后的形)。名叫保留名({@link RESERVED_MEMBER_NAMES})的成员不进副本、每个单独记进 `lost`。
|
|
217
|
-
* 坏形的 `lost` 条目带机读位(见 {@link McpEntryKeyIssue})
|
|
232
|
+
* 坏形的 `lost` 条目带机读位(见 {@link McpEntryKeyIssue})。这两键的读法与诊断就是公开读口 {@link readRequestStringRecord} 以 `transport.env` / `transport.headers` 为坐标的读数。
|
|
218
233
|
* url 的拒句不回显值:它常规地带凭据(userinfo)。
|
|
219
234
|
*/
|
|
220
235
|
export function readRequestMcpTransport(t) {
|
|
@@ -244,13 +259,15 @@ export function readRequestMcpTransport(t) {
|
|
|
244
259
|
const snap = snapshotRead.value;
|
|
245
260
|
// `lost` 不用 `push` 累加(`push` 是 [[Set]],会被 `Object.prototype` 上继承的数字键 setter 吞掉 / 读成污染值):每处诊断是一个值或 `undefined`,由 `issuesOf` 一次铸成数组(定义语义)
|
|
246
261
|
switch (snap.kind) {
|
|
262
|
+
case "refused":
|
|
263
|
+
return snap.read;
|
|
247
264
|
case "stdio": {
|
|
248
265
|
if (typeof snap.command !== "string" || snap.command.length === 0)
|
|
249
266
|
return transportBad("transport.command", `must be a non-empty string (the command to run) — got ${describeValueShape(snap.command)}`);
|
|
250
267
|
const rawArgs = snap.args; // 交出去的是副本(不是调用方数组的原引用),稀疏 / 读不出的数组整键丢、进 `lost`
|
|
251
268
|
const args = rawArgs === undefined ? undefined : captureStringArray(rawArgs, "wide");
|
|
252
269
|
const argsIssue = rawArgs !== undefined && args === undefined ? { path: "transport.args", reason: `must be an array of strings — got ${describeNotStringArray(rawArgs)}` } : undefined;
|
|
253
|
-
const env =
|
|
270
|
+
const env = readRequestStringRecord("transport.env", snap.env);
|
|
254
271
|
return {
|
|
255
272
|
ok: true,
|
|
256
273
|
transport: {
|
|
@@ -259,16 +276,16 @@ export function readRequestMcpTransport(t) {
|
|
|
259
276
|
...(args !== undefined ? { args } : {}),
|
|
260
277
|
...(env.record !== undefined ? { env: env.record } : {}),
|
|
261
278
|
},
|
|
262
|
-
lost: issuesOf(argsIssue, ...env.issues),
|
|
279
|
+
lost: issuesOf(argsIssue, ...env.issues, ...inheritedAxisKeyIssues(snap.inherited)),
|
|
263
280
|
};
|
|
264
281
|
}
|
|
265
282
|
case "http": {
|
|
266
283
|
// http(s) only — never file://, never a bare host (a syntactic guard, not the URL shape judge: it also lets a bare `https://` through, see ./url-shape).
|
|
267
284
|
if (typeof snap.url !== "string" || !startsWithHttpScheme(snap.url))
|
|
268
285
|
return transportBad("transport.url", "must be an absolute http(s) URL (put credentials in transport.headers, never in the URL)");
|
|
269
|
-
const
|
|
270
|
-
const headers =
|
|
271
|
-
const principalIssue = snap.principalHeader !== undefined &&
|
|
286
|
+
const principalHeader = typeof snap.principalHeader === "string" ? snap.principalHeader : undefined;
|
|
287
|
+
const headers = readRequestStringRecord("transport.headers", snap.headers);
|
|
288
|
+
const principalIssue = snap.principalHeader !== undefined && principalHeader === undefined
|
|
272
289
|
? { path: "transport.principalHeader", reason: `must be a string (the HTTP header NAME the end-user principal is injected into) — got ${describeValueShape(snap.principalHeader)}` }
|
|
273
290
|
: undefined;
|
|
274
291
|
return {
|
|
@@ -277,9 +294,9 @@ export function readRequestMcpTransport(t) {
|
|
|
277
294
|
kind: "http",
|
|
278
295
|
url: snap.url,
|
|
279
296
|
...(headers.record !== undefined ? { headers: headers.record } : {}),
|
|
280
|
-
...
|
|
297
|
+
...(principalHeader !== undefined ? { principalHeader } : {}),
|
|
281
298
|
},
|
|
282
|
-
lost: issuesOf(...headers.issues, principalIssue,
|
|
299
|
+
lost: issuesOf(...headers.issues, principalIssue, ...inheritedAxisKeyIssues(snap.inherited)),
|
|
283
300
|
};
|
|
284
301
|
}
|
|
285
302
|
case "other":
|
|
@@ -291,25 +308,50 @@ export function readRequestMcpTransport(t) {
|
|
|
291
308
|
}
|
|
292
309
|
}
|
|
293
310
|
function snapshotTransport(tr) {
|
|
294
|
-
//
|
|
295
|
-
// 任何一个字段读不出 ⇒ 整只读不出(第一个读不出的就停,后面的一个不读)
|
|
311
|
+
// 字段一律只读**自有**属性(一条律):JSON 解析只铸自有键,JSON 面不变;原型链上被污染的值 / 会抛的 getter 不触发,注入的值进不来。
|
|
312
|
+
// 任何一个字段读不出 ⇒ 整只读不出(第一个读不出的就停,后面的一个不读)。身份 / 凭据轴上的键(`AXIS_KEYS`)经 `axisKeyOf`:只靠继承可见 ⇒ 记进 `inherited`、由读器点名;
|
|
313
|
+
// 点名拒的键(`assertionHeader` / `credentials`)在 `kind` 之后先读,自有且在场即停。
|
|
296
314
|
const kind = ownValueOf(tr, "kind");
|
|
297
315
|
if (!kind.ok)
|
|
298
316
|
return kind;
|
|
317
|
+
const inherited = new Set();
|
|
318
|
+
const axis = (key) => {
|
|
319
|
+
const read = axisKeyOf(tr, key);
|
|
320
|
+
if (!read.ok)
|
|
321
|
+
return read;
|
|
322
|
+
if (read.value.inherited)
|
|
323
|
+
inherited.add(key);
|
|
324
|
+
return { ok: true, value: read.value.value };
|
|
325
|
+
};
|
|
299
326
|
if (kind.value === "stdio") {
|
|
327
|
+
const credentials = axis("credentials");
|
|
328
|
+
if (!credentials.ok)
|
|
329
|
+
return credentials;
|
|
330
|
+
const refused = refusedKeyOf(undefined, credentials.value);
|
|
331
|
+
if (refused !== undefined)
|
|
332
|
+
return { ok: true, value: { kind: "refused", read: refused } };
|
|
300
333
|
const fields = ownFieldsOf(tr, ["command", "args", "env"]);
|
|
301
334
|
if (!fields.ok)
|
|
302
335
|
return fields;
|
|
303
|
-
return { ok: true, value: { kind: "stdio", command: fields.value.command, args: fields.value.args, env: fields.value.env } };
|
|
336
|
+
return { ok: true, value: { kind: "stdio", command: fields.value.command, args: fields.value.args, env: fields.value.env, inherited } };
|
|
304
337
|
}
|
|
305
338
|
if (kind.value === "http") {
|
|
339
|
+
const assertionHeader = axis("assertionHeader");
|
|
340
|
+
if (!assertionHeader.ok)
|
|
341
|
+
return assertionHeader;
|
|
342
|
+
const credentials = axis("credentials");
|
|
343
|
+
if (!credentials.ok)
|
|
344
|
+
return credentials;
|
|
345
|
+
const refused = refusedKeyOf(assertionHeader.value, credentials.value);
|
|
346
|
+
if (refused !== undefined)
|
|
347
|
+
return { ok: true, value: { kind: "refused", read: refused } };
|
|
306
348
|
const fields = ownFieldsOf(tr, ["url", "headers"]);
|
|
307
349
|
if (!fields.ok)
|
|
308
350
|
return fields;
|
|
309
|
-
const
|
|
310
|
-
if (!
|
|
311
|
-
return
|
|
312
|
-
return { ok: true, value: { kind: "http", url: fields.value.url, headers: fields.value.headers, principalHeader:
|
|
351
|
+
const principalHeader = axis("principalHeader");
|
|
352
|
+
if (!principalHeader.ok)
|
|
353
|
+
return principalHeader;
|
|
354
|
+
return { ok: true, value: { kind: "http", url: fields.value.url, headers: fields.value.headers, principalHeader: principalHeader.value, inherited } };
|
|
313
355
|
}
|
|
314
356
|
return { ok: true, value: { kind: "other", value: kind.value } };
|
|
315
357
|
}
|
|
@@ -389,10 +431,14 @@ export function readPlainStringRecord(v) {
|
|
|
389
431
|
/** 把诊断条目铸成数组:`undefined`(这一处没有诊断)略去。`filter` 的结果走 `CreateDataProperty`,不走 `[[Set]]` —— `lost` 是「门拒什么」的读数,不能被继承的数字键 setter 吞掉。 */
|
|
390
432
|
const issuesOf = (...candidates) => candidates.filter((c) => c !== undefined);
|
|
391
433
|
/**
|
|
392
|
-
* `transport.env` / `transport.headers`
|
|
393
|
-
*
|
|
434
|
+
* 请求面一份「名 → 串」记录的**带坐标读法** —— 公开读口:传输读器读 `transport.env` / `transport.headers` 就是它的两次调用;消费方读自己的「名 → 串」记录
|
|
435
|
+
* (A2A 对端的 `headers` 一类)调同一只,诊断与 MCP 传输同形同句,不另拼原因句。`path` = 这份记录在调用方载荷里的坐标(原样进诊断,不解析)。从不抛。
|
|
436
|
+
* · 缺席(`undefined`)⇒ 不交、零条;
|
|
437
|
+
* · 记录不交({@link readPlainStringRecord} 答 `ok:false`)⇒ 恰一条,`path` 是坐标本身,`reason` = `must be a plain object of string values — ` + 读数的 `detail`,
|
|
438
|
+
* `fault` 与(坏在某个成员时)`member` 取自读数;
|
|
439
|
+
* · 交 ⇒ 纯数据副本;名叫保留名({@link RESERVED_MEMBER_NAMES})的成员不进副本,每个一条:`path` = `<坐标>.<名>`、`member` = 名、`fault` = `member_name_reserved`。
|
|
394
440
|
*/
|
|
395
|
-
function
|
|
441
|
+
export function readRequestStringRecord(path, raw) {
|
|
396
442
|
if (raw === undefined)
|
|
397
443
|
return { record: undefined, issues: [] };
|
|
398
444
|
const read = readPlainStringRecord(raw);
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
import type { ENV_MODELS_DOCUMENT } from "./config-root-documents.js";
|
|
7
7
|
import type { DomainName } from "./types.js";
|
|
8
8
|
/** 本版登记的一次性迁移 id(闭集;每个 id 在 `ONE_TIME_MIGRATIONS` 登记表里恰一行)。收据只许这些 id。 */
|
|
9
|
-
export declare const ONE_TIME_MIGRATION_IDS: readonly ["SS-
|
|
9
|
+
export declare const ONE_TIME_MIGRATION_IDS: readonly ["SS-M10", "SS-M11", "SS-M12", "SS-M13"];
|
|
10
10
|
export type OneTimeMigrationId = (typeof ONE_TIME_MIGRATION_IDS)[number];
|
|
11
11
|
/**
|
|
12
12
|
* 一条收据说迁移**对一个坐标做了什么**(闭集,每词一义):
|
|
13
13
|
* - `moved` — 值搬到新位(`to`),义不变;
|
|
14
14
|
* - `rewritten` — 同一坐标上的值换成今天的生效读法(例:15.x worker 行的记忆方言词 `tidb` ⇒ `mysql`);
|
|
15
|
-
* - `dropped-inert` — 删掉;今天的读法本就不让它生效(
|
|
15
|
+
* - `dropped-inert` — 删掉;今天的读法本就不让它生效(例:空的 `bindings: []`、不声明那条车道的行上的车道键);
|
|
16
16
|
* - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么;
|
|
17
17
|
* - `minted` — 在**缺席处**写下一份新事实(一份部署决定),不改任何已有的值 —— 只有 SS-M11 铸(配置根的 `config.env-models.json`:
|
|
18
18
|
* 升级前「管模型面的目录整表顶替 env 模型」的读法,写成 `replaced`;不存在才建)。
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { deepFreeze } from "./deep-freeze.js";
|
|
2
2
|
/** 本版登记的一次性迁移 id(闭集;每个 id 在 `ONE_TIME_MIGRATIONS` 登记表里恰一行)。收据只许这些 id。 */
|
|
3
|
-
export const ONE_TIME_MIGRATION_IDS = deepFreeze(["SS-
|
|
3
|
+
export const ONE_TIME_MIGRATION_IDS = deepFreeze(["SS-M10", "SS-M11", "SS-M12", "SS-M13"]);
|
|
4
4
|
/**
|
|
5
5
|
* 一条收据说迁移**对一个坐标做了什么**(闭集,每词一义):
|
|
6
6
|
* - `moved` — 值搬到新位(`to`),义不变;
|
|
7
7
|
* - `rewritten` — 同一坐标上的值换成今天的生效读法(例:15.x worker 行的记忆方言词 `tidb` ⇒ `mysql`);
|
|
8
|
-
* - `dropped-inert` — 删掉;今天的读法本就不让它生效(
|
|
8
|
+
* - `dropped-inert` — 删掉;今天的读法本就不让它生效(例:空的 `bindings: []`、不声明那条车道的行上的车道键);
|
|
9
9
|
* - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么;
|
|
10
10
|
* - `minted` — 在**缺席处**写下一份新事实(一份部署决定),不改任何已有的值 —— 只有 SS-M11 铸(配置根的 `config.env-models.json`:
|
|
11
11
|
* 升级前「管模型面的目录整表顶替 env 模型」的读法,写成 `replaced`;不存在才建)。
|
|
@@ -32,8 +32,8 @@ export type StoredDocuments = Readonly<Partial<Record<DomainName | RetiredDomain
|
|
|
32
32
|
export interface StoredDocumentsMigration {
|
|
33
33
|
/** 迁移后的文档集:没改的文档是**同一引用**;被移除的不在、新建的在(26.0.0 起没有一步移除或新建文档)。 */
|
|
34
34
|
readonly docs: Readonly<Record<string, unknown>>;
|
|
35
|
-
/** 逐条收据(步序 SS-
|
|
36
|
-
*
|
|
35
|
+
/** 逐条收据(步序 SS-M10 → workers 行步〔SS-M12 改写 → 一次终判〕:纯改写步在前,用新 schema 终判的 workers 行步最后;步内按坐标)。
|
|
36
|
+
* SS-M13(mcp 条目)排在 SS-M10 之后、workers 行步之前。只有 `refused` 的收据 = 什么都没改。 */
|
|
37
37
|
readonly receipts: readonly MigrationReceipt[];
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -37,26 +37,12 @@ import { outgoingPath, redactSecrets } from "./config-fns.js";
|
|
|
37
37
|
import { LANE_ENV_OWNER, LATE_LANE_ENV_KEYS } from "./execution-lane-index.js";
|
|
38
38
|
import { NOT_PLAIN_DATA, UNINSPECTABLE, UninspectableError, captureJson, dataDescriptor, emptyDocument, ownEntriesOf, ownOrThrow, readDeclaredKey, sentenceOfMinted } from "./own-key-read.js";
|
|
39
39
|
import { isJsonArray, isPlainJsonObject, jsonShapeOf } from "./plain-json-object.js";
|
|
40
|
-
import { RETIRED_ROLE_WORDS } from "./retired-role-words.js";
|
|
41
40
|
import { isDomainName, isRetiredDomainName } from "./types.js";
|
|
42
41
|
import { workerRowVerdict } from "./worker-row-verdict.js";
|
|
43
42
|
import { deepFreeze } from "./deep-freeze.js";
|
|
44
43
|
export { MIGRATION_APPLIED_AS, ONE_TIME_MIGRATION_IDS } from "./migration-receipt.js";
|
|
45
44
|
/** 一次性迁移登记表 —— 本族各条窗的**唯一属主**。别处只写「窗见 `ONE_TIME_MIGRATIONS` 登记表」。 */
|
|
46
45
|
export const ONE_TIME_MIGRATIONS = deepFreeze([
|
|
47
|
-
{
|
|
48
|
-
id: "SS-M8",
|
|
49
|
-
oldForm: "refused",
|
|
50
|
-
introducedIn: "12.0.0",
|
|
51
|
-
releasedOn: "2026-10-12",
|
|
52
|
-
removableAfter: "2026-11-11",
|
|
53
|
-
rewrites: "models / rosters: role words removed by core 7.49.0: team, synthesize — the keys roles.team / roles.synthesize (models.roles and every " +
|
|
54
|
-
"rosters[].roles) are removed whatever their value (12.0.0 drops both words from ModelRole: no role reads them, and the engine refuses " +
|
|
55
|
-
"them); every other role and key stays as stored",
|
|
56
|
-
removal: "the next major after the window: delete the SS-M8 step; the retired role-word tombstone stays — its SS-M8 clause goes",
|
|
57
|
-
afterRemoval: "the retired role-word tombstone (permanent): a residual roles.team / roles.synthesize is refused on read and write (read: the entry is dropped " +
|
|
58
|
-
"when other roles survive, else models degrades to its default; rosters: the scope fails to read)",
|
|
59
|
-
},
|
|
60
46
|
{
|
|
61
47
|
id: "SS-M10",
|
|
62
48
|
oldForm: "refused",
|
|
@@ -111,6 +97,22 @@ export const ONE_TIME_MIGRATIONS = deepFreeze([
|
|
|
111
97
|
afterRemoval: "the runtime.execution.lane tombstone field, the memory-backend refusal for \"tidb\" and the reserved-env refusal for DEVICE_RELAY_URL (permanent): a residual " +
|
|
112
98
|
"15.x row is refused on write and held by readWorkersRows on read, never rewritten",
|
|
113
99
|
},
|
|
100
|
+
{
|
|
101
|
+
id: "SS-M13",
|
|
102
|
+
oldForm: "refused",
|
|
103
|
+
introducedIn: "29.0.0",
|
|
104
|
+
releasedOn: "2026-11-15",
|
|
105
|
+
removableAfter: "2026-12-15",
|
|
106
|
+
rewrites: "mcp: on a server entry, the parse-transparent keys authForm / entryKind (12.2.0; no reader ever gave them a meaning, removed in 29.0.0) are " +
|
|
107
|
+
"deleted (dropped-inert). An http entry carrying transport.assertionHeader (retired in 29.0.0) is refused and kept verbatim, the whole entry: the " +
|
|
108
|
+
"stored entry has no connector id, so writing transport.credentials = {\"kind\":\"assertion\",\"audience\":\"<connector id>\"} would be a guess — " +
|
|
109
|
+
"the operator writes it by hand from the deployment registry and deletes assertionHeader",
|
|
110
|
+
removal: "the next major after the window: delete the SS-M13 step and SS-M13 from ONE_TIME_MIGRATION_IDS; the transport.assertionHeader tombstone field " +
|
|
111
|
+
"stays — its SS-M13 clause goes",
|
|
112
|
+
afterRemoval: "the transport.assertionHeader tombstone field (permanent): a residual key is refused on write and its entry is dropped on read (the mcp domain " +
|
|
113
|
+
"degrades to its default when no entry survives); residual authForm / entryKind keys are unknown keys — stripped on write, the entry dropped " +
|
|
114
|
+
"on read (entry-unknown-key)",
|
|
115
|
+
},
|
|
114
116
|
]);
|
|
115
117
|
/**
|
|
116
118
|
* 迁移一组存储文档(见文件头「入口」)。纯函数;没改的文档原样返回;**不抬任何版本号**(结果里没有版本 —— 那是调用方的)。
|
|
@@ -144,8 +146,8 @@ export function migrateStoredDocuments(docs) {
|
|
|
144
146
|
const receipts = [];
|
|
145
147
|
// 步序的律:纯改写步在前,拿新 schema 终判改写结果的 workers 行步最后 —— 它判的是**全部**改写之后的行(否则一跑 refused、二跑才过:既不是一次完成,也不幂等)。
|
|
146
148
|
try {
|
|
147
|
-
stepRetiredRoleWords(out, receipts);
|
|
148
149
|
stepPromptsAxes(out, receipts);
|
|
150
|
+
stepMcpServers(out, receipts);
|
|
149
151
|
stepWorkersRows(out, receipts);
|
|
150
152
|
}
|
|
151
153
|
catch (e) {
|
|
@@ -227,6 +229,18 @@ const without = (o, k) => {
|
|
|
227
229
|
const { [k]: _gone, ...rest } = o;
|
|
228
230
|
return rest;
|
|
229
231
|
};
|
|
232
|
+
/**
|
|
233
|
+
* 一只存储文档里的数组(workers 行 / mcp 条目)的行,**按下标读一次**:内建 `Array.prototype.forEach` 的读法(`length` 一次;`0 … length-1` 里在场的下标各一次 `[[HasProperty]]` + `[[Get]]`,洞不读)——
|
|
234
|
+
* v28.0.0 调的是数组实例上的 `forEach` 且边判边写回(写回时走迭代器把各下标再读一次),自此只有这一次读;不走调用方数组自己的迭代器(展开 / `for…of` 会)、不调它自己的成员(实例上的 `forEach`、`slice` 经 `constructor` 取的 species 都会)。
|
|
235
|
+
* 读到的值按原下标**定义**进一只包自己的数组(洞留洞;定义语义:`Array.prototype` 上被污染出数字键的 setter 吞不掉它)。行步判的与写回的都是这一份副本(拒的行原样就是这一次读到的值)。
|
|
236
|
+
*/
|
|
237
|
+
function rowsByIndex(array) {
|
|
238
|
+
const rows = [];
|
|
239
|
+
Array.prototype.forEach.call(array, (row, index) => {
|
|
240
|
+
Object.defineProperty(rows, index, dataDescriptor(row));
|
|
241
|
+
});
|
|
242
|
+
return rows;
|
|
243
|
+
}
|
|
230
244
|
// 收据的三只铸点。坐标里的键段是用户写的(未知键名、zod issue 路径里的 Record 键),完全可能就是一条粘错位置的凭据 ⇒ 与读侧告警坐标
|
|
231
245
|
// 走同一道出门(`outgoingPath`,codex r1 F1);拒因句过 `redactSecrets`。收据从不带值。
|
|
232
246
|
function receipt(migration, document, path, appliedAs) {
|
|
@@ -329,7 +343,7 @@ function stepWorkersRows(out, receipts) {
|
|
|
329
343
|
const workerRows = ownOrThrow(doc, "workers");
|
|
330
344
|
if (!isJsonArray(workerRows))
|
|
331
345
|
return;
|
|
332
|
-
const rows = workerRows;
|
|
346
|
+
const rows = rowsByIndex(workerRows); // 每一行只读一次:判与写回用同一份读数(拒的行原样就是这一份)
|
|
333
347
|
let next;
|
|
334
348
|
rows.forEach((row, index) => {
|
|
335
349
|
if (!isPlainJsonObject(row) || typeof ownOrThrow(row, "name") !== "string")
|
|
@@ -358,45 +372,48 @@ function stepWorkersRows(out, receipts) {
|
|
|
358
372
|
if (next !== undefined)
|
|
359
373
|
out.workers = { ...doc, workers: next };
|
|
360
374
|
}
|
|
361
|
-
// ── SS-
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
const
|
|
378
|
-
if (
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
375
|
+
// ── SS-M13:mcp 条目的两只惰性键与退役的断言头 ──────────────────────────────────────────────────────────────────
|
|
376
|
+
/** SS-M13 拒一条带 `assertionHeader` 的 http 条目时的理由句(点名新位与连接器 id 的出处;不回显值)。 */
|
|
377
|
+
const SS_M13_ASSERTION_HEADER_REFUSAL = "transport.assertionHeader was retired in 29.0.0 and the stored entry has no connector id to rewrite it with — write transport.credentials = " +
|
|
378
|
+
"{\"kind\":\"assertion\",\"audience\":\"<connector id>\"} by hand (the connector id is this connector's name in the deployment registry) and delete assertionHeader";
|
|
379
|
+
/** SS-M13 删掉的两只惰性键(12.2.0 的解析透明键,29.0.0 删除)。 */
|
|
380
|
+
const SS_M13_INERT_KEYS = ["authForm", "entryKind"];
|
|
381
|
+
/**
|
|
382
|
+
* SS-M13(只认形):`mcp.servers[]` 逐条 ——
|
|
383
|
+
* · http 条目的传输带 `assertionHeader`(自有键,任何值)⇒ 一张拒收据(坐标 = 那把键),**整条原样**(同一条上的惰性键也不动:拒的行什么都不写);
|
|
384
|
+
* · 否则条目上的 `authForm` / `entryKind` ⇒ 删掉,每键一张 `dropped-inert` 收据。
|
|
385
|
+
* 认不出的形(`mcp` 不是对象、`servers` 不是数组、条目不是对象)⇒ 不动(判形是读者的事)。
|
|
386
|
+
*/
|
|
387
|
+
function stepMcpServers(out, receipts) {
|
|
388
|
+
const doc = ownOrThrow(out, "mcp");
|
|
389
|
+
if (!isPlainJsonObject(doc))
|
|
390
|
+
return;
|
|
391
|
+
const servers = ownOrThrow(doc, "servers");
|
|
392
|
+
if (!isJsonArray(servers))
|
|
393
|
+
return;
|
|
394
|
+
const rows = rowsByIndex(servers); // 每一条只读一次:判与写回用同一份读数(拒的那条原样就是这一份)
|
|
395
|
+
let next;
|
|
396
|
+
rows.forEach((row, index) => {
|
|
397
|
+
if (!isPlainJsonObject(row))
|
|
398
|
+
return;
|
|
399
|
+
const transport = ownOrThrow(row, "transport");
|
|
400
|
+
if (isPlainJsonObject(transport) && ownOrThrow(transport, "kind") === "http" && has(transport, "assertionHeader")) {
|
|
401
|
+
receipts.push(refused("SS-M13", "mcp", ["servers", index, "transport", "assertionHeader"], SS_M13_ASSERTION_HEADER_REFUSAL));
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
const inert = SS_M13_INERT_KEYS.filter((k) => has(row, k));
|
|
405
|
+
if (inert.length === 0)
|
|
406
|
+
return;
|
|
407
|
+
let rewritten = row;
|
|
408
|
+
for (const k of inert) {
|
|
409
|
+
rewritten = without(rewritten, k);
|
|
410
|
+
receipts.push(receipt("SS-M13", "mcp", ["servers", index, k], "dropped-inert"));
|
|
411
|
+
}
|
|
412
|
+
next ??= [...rows];
|
|
413
|
+
next[index] = rewritten;
|
|
414
|
+
});
|
|
415
|
+
if (next !== undefined)
|
|
416
|
+
out.mcp = { ...doc, servers: next };
|
|
400
417
|
}
|
|
401
418
|
// ── SS-M10:prompts 两轴退役 ───────────────────────────────────────────────────────────────────────────
|
|
402
419
|
/** 14.0.0 的 prompts 域只装中心 artifact;13.x 的两轴键是墓碑。迁移只做只认形的那一件:空的 `bindings: []`(13.x 每份文档恒物化的默认值,
|
|
@@ -1,21 +1,27 @@
|
|
|
1
|
-
/** The domains
|
|
2
|
-
*
|
|
3
|
-
* {@link NON_PORTABLE_DOMAIN_REASONS} 里有一条成文理由(
|
|
1
|
+
/** The domains that **travel**: the **default** domain set of the bundle helpers (`exportBundle` / `readBundle`) and the only domains they accept — `exportBundle` / `readBundle` / `writeBundle`
|
|
2
|
+
* refuse any other name at run time (and the types narrow to {@link PortableDomain}), so a domain outside this set cannot be carried into a bundle however the caller spells it.
|
|
3
|
+
* 每个被排除的域必须在 {@link NON_PORTABLE_DOMAIN_REASONS} 里有一条成文理由(禁裸排除)。
|
|
4
4
|
*
|
|
5
|
-
* ⚠️
|
|
6
|
-
*
|
|
7
|
-
* bundle 的那条口子归调用方纪律(以及各自域的导出面),不是本常量能挡住的;要不要把 bundle API 收窄到
|
|
8
|
-
* `PortableDomain` 是一个独立的行为面裁定(#282 未决项,需三问),本批不擅自改。
|
|
5
|
+
* ⚠️ 这只常量回答的是**搬运**的问题,不是「本地读哪些域」的问题:本地文件店读的域集是 {@link LOCAL_READ_DOMAINS}(= 本集 + `projects`)。两个问题 28.0.0 以前共用这一只常量、答案碰巧相同;
|
|
6
|
+
* `projects` 不可搬运(租户身份数据,随包复制进另一个部署 = 凭空多出的身份登记),但单机部署自己的 `config.d/projects.json` 就是它自己的登记簿 —— 所以它在读取集里、不在本集里。
|
|
9
7
|
*
|
|
10
|
-
* 🔴
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* 今日的兜底:漏登记的文件会被 `FileConfigStore`(`./node`)的 `"unread-config-file"` 警告点名(fail-loud,
|
|
8
|
+
* 🔴 **开新顶层域时必须同步登记**(成案 = 消费方的真事故):域表是**闭集**,不在 {@link LOCAL_READ_DOMAINS}(便携域自动在内)里的域名,`config.d/<域>.json` 不会被读进 effective —— 消费方拿到的是「该域缺席」,
|
|
9
|
+
* 和文件不存在**逐字同形**。当年 `limits` 域就是这样在单机腿静默丢了一整片限额发布(远端腿同批可用,所以更难看出来)。新域要么进本集(可搬运,自动进读取集),要么在 {@link NON_PORTABLE_DOMAIN_REASONS} 里写理由
|
|
10
|
+
* (并在需要本地读取时进 {@link LOCAL_READ_DOMAINS})。今日的兜底:漏登记的文件会被 `FileConfigStore`(`./node`)的 `"unread-config-file"` 警告点名(fail-loud,
|
|
14
11
|
* 见 getEffective),但那只在消费方接了 `onWarning` 时才响 —— **登记仍是第一现场的义务**。 */
|
|
15
12
|
export declare const PORTABLE_DOMAINS: readonly ["models", "rosters", "skills", "mcp", "plugins", "scenarios", "collab", "governance", "execution", "prompts", "limits", "a2a"];
|
|
16
13
|
export type PortableDomain = (typeof PORTABLE_DOMAINS)[number];
|
|
14
|
+
/** The domains the local file store reads: `FileConfigStore` (and so `loadLocalConfig`) reads `<root>/config.d/<domain>.json` for exactly these — `getEffective` (strict and tolerant), `read()`, `getVersion()`,
|
|
15
|
+
* the `updatedAt` stamp and the "file nobody reads" sweep all enumerate **this** set. It is {@link PORTABLE_DOMAINS} plus `projects`, built from it (every portable domain is locally readable by construction).
|
|
16
|
+
*
|
|
17
|
+
* `projects` is here and not in {@link PORTABLE_DOMAINS} on purpose: a project registry is tenant identity data, so it never **travels** (no bundle carries it; the bundle helpers still read {@link PORTABLE_DOMAINS}
|
|
18
|
+
* and refuse it at run time) — but a single-machine deployment's own `config.d/projects.json` is that deployment's registry, not one carried in from elsewhere, and the local reader reads it like any other document.
|
|
19
|
+
* A domain outside this set (`workers` / `hosts` / `systems` / `entitlement`) is not read by the local file store: its file is named by an `"unread-config-file"` warning and its domain resolves to the schema default.
|
|
20
|
+
* New local-reader domains are added HERE, with the reason; a domain that also travels goes into {@link PORTABLE_DOMAINS} and joins this set by construction. */
|
|
21
|
+
export declare const LOCAL_READ_DOMAINS: readonly ["models", "rosters", "skills", "mcp", "plugins", "scenarios", "collab", "governance", "execution", "prompts", "limits", "a2a", "projects"];
|
|
22
|
+
export type LocalReadDomain = (typeof LOCAL_READ_DOMAINS)[number];
|
|
17
23
|
/**
|
|
18
|
-
* 非便携域的**排除理由表**(
|
|
24
|
+
* 非便携域的**排除理由表**(禁裸排除)—— 为什么这个域**不随 bundle 搬运**(搬运义;它能不能被本地读取是 {@link LOCAL_READ_DOMAINS} 的事,`projects` 就是不可搬运、却可本地读取)。
|
|
19
25
|
*
|
|
20
26
|
* `satisfies Record<Exclude<DomainName, PortableDomain>, string>` 让键集在**编译期**双向咬死:新开一个
|
|
21
27
|
* 域却不放进 PORTABLE_DOMAINS ⇒ 这里缺行 ⇒ 编译错;把某域改成便携却忘了删行 ⇒ 多余键 ⇒ 编译错。
|
package/dist/portable-domains.js
CHANGED
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import { deepFreeze } from "./deep-freeze.js";
|
|
2
|
-
/** The domains
|
|
3
|
-
*
|
|
4
|
-
* {@link NON_PORTABLE_DOMAIN_REASONS} 里有一条成文理由(
|
|
2
|
+
/** The domains that **travel**: the **default** domain set of the bundle helpers (`exportBundle` / `readBundle`) and the only domains they accept — `exportBundle` / `readBundle` / `writeBundle`
|
|
3
|
+
* refuse any other name at run time (and the types narrow to {@link PortableDomain}), so a domain outside this set cannot be carried into a bundle however the caller spells it.
|
|
4
|
+
* 每个被排除的域必须在 {@link NON_PORTABLE_DOMAIN_REASONS} 里有一条成文理由(禁裸排除)。
|
|
5
5
|
*
|
|
6
|
-
* ⚠️
|
|
7
|
-
*
|
|
8
|
-
* bundle 的那条口子归调用方纪律(以及各自域的导出面),不是本常量能挡住的;要不要把 bundle API 收窄到
|
|
9
|
-
* `PortableDomain` 是一个独立的行为面裁定(#282 未决项,需三问),本批不擅自改。
|
|
6
|
+
* ⚠️ 这只常量回答的是**搬运**的问题,不是「本地读哪些域」的问题:本地文件店读的域集是 {@link LOCAL_READ_DOMAINS}(= 本集 + `projects`)。两个问题 28.0.0 以前共用这一只常量、答案碰巧相同;
|
|
7
|
+
* `projects` 不可搬运(租户身份数据,随包复制进另一个部署 = 凭空多出的身份登记),但单机部署自己的 `config.d/projects.json` 就是它自己的登记簿 —— 所以它在读取集里、不在本集里。
|
|
10
8
|
*
|
|
11
|
-
* 🔴
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* 今日的兜底:漏登记的文件会被 `FileConfigStore`(`./node`)的 `"unread-config-file"` 警告点名(fail-loud,
|
|
9
|
+
* 🔴 **开新顶层域时必须同步登记**(成案 = 消费方的真事故):域表是**闭集**,不在 {@link LOCAL_READ_DOMAINS}(便携域自动在内)里的域名,`config.d/<域>.json` 不会被读进 effective —— 消费方拿到的是「该域缺席」,
|
|
10
|
+
* 和文件不存在**逐字同形**。当年 `limits` 域就是这样在单机腿静默丢了一整片限额发布(远端腿同批可用,所以更难看出来)。新域要么进本集(可搬运,自动进读取集),要么在 {@link NON_PORTABLE_DOMAIN_REASONS} 里写理由
|
|
11
|
+
* (并在需要本地读取时进 {@link LOCAL_READ_DOMAINS})。今日的兜底:漏登记的文件会被 `FileConfigStore`(`./node`)的 `"unread-config-file"` 警告点名(fail-loud,
|
|
15
12
|
* 见 getEffective),但那只在消费方接了 `onWarning` 时才响 —— **登记仍是第一现场的义务**。 */
|
|
16
13
|
export const PORTABLE_DOMAINS = deepFreeze(["models", "rosters", "skills", "mcp", "plugins", "scenarios", "collab", "governance", "execution", "prompts", "limits", "a2a"]);
|
|
14
|
+
/** The domains the local file store reads: `FileConfigStore` (and so `loadLocalConfig`) reads `<root>/config.d/<domain>.json` for exactly these — `getEffective` (strict and tolerant), `read()`, `getVersion()`,
|
|
15
|
+
* the `updatedAt` stamp and the "file nobody reads" sweep all enumerate **this** set. It is {@link PORTABLE_DOMAINS} plus `projects`, built from it (every portable domain is locally readable by construction).
|
|
16
|
+
*
|
|
17
|
+
* `projects` is here and not in {@link PORTABLE_DOMAINS} on purpose: a project registry is tenant identity data, so it never **travels** (no bundle carries it; the bundle helpers still read {@link PORTABLE_DOMAINS}
|
|
18
|
+
* and refuse it at run time) — but a single-machine deployment's own `config.d/projects.json` is that deployment's registry, not one carried in from elsewhere, and the local reader reads it like any other document.
|
|
19
|
+
* A domain outside this set (`workers` / `hosts` / `systems` / `entitlement`) is not read by the local file store: its file is named by an `"unread-config-file"` warning and its domain resolves to the schema default.
|
|
20
|
+
* New local-reader domains are added HERE, with the reason; a domain that also travels goes into {@link PORTABLE_DOMAINS} and joins this set by construction. */
|
|
21
|
+
export const LOCAL_READ_DOMAINS = deepFreeze([...PORTABLE_DOMAINS, "projects"]);
|
|
17
22
|
/**
|
|
18
|
-
* 非便携域的**排除理由表**(
|
|
23
|
+
* 非便携域的**排除理由表**(禁裸排除)—— 为什么这个域**不随 bundle 搬运**(搬运义;它能不能被本地读取是 {@link LOCAL_READ_DOMAINS} 的事,`projects` 就是不可搬运、却可本地读取)。
|
|
19
24
|
*
|
|
20
25
|
* `satisfies Record<Exclude<DomainName, PortableDomain>, string>` 让键集在**编译期**双向咬死:新开一个
|
|
21
26
|
* 域却不放进 PORTABLE_DOMAINS ⇒ 这里缺行 ⇒ 编译错;把某域改成便携却忘了删行 ⇒ 多余键 ⇒ 编译错。
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** 退役的角色词(闭集;逐字)。 */
|
|
2
2
|
export declare const RETIRED_ROLE_WORDS: readonly ["team", "synthesize"];
|
|
3
|
-
/** 一组被判官拒下的角色键 / 角色词里若有退役词 ⇒ 那一句(
|
|
3
|
+
/** 一组被判官拒下的角色键 / 角色词里若有退役词 ⇒ 那一句(点名退役词、退役的版本与出路;同组里别的不认识的词也点名,一个不漏);没有 ⇒ `undefined`
|
|
4
4
|
* (交回 zod 自己的句子)。`ModelRole` 的判句(一个词)与 `roles` 图的未知键判句(一组键)都调这一只。 */
|
|
5
5
|
export declare function retiredRoleWordsRefusal(words: readonly unknown[]): string | undefined;
|