@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.
- package/CHANGELOG.md +753 -0
- package/README.md +88 -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/auth-bridge.js +4 -3
- package/dist/api/auth.js +6 -5
- package/dist/api/credentials.js +14 -15
- package/dist/api/lifecycle-events.d.ts +266 -0
- package/dist/api/lifecycle-events.js +169 -0
- package/dist/api/pull-token.js +2 -1
- package/dist/api/scopes.js +5 -4
- 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/center-refs.js +3 -2
- package/dist/config-d-file.d.ts +1 -1
- package/dist/config-dir-io.d.ts +1 -1
- package/dist/config-dir-io.js +3 -2
- package/dist/config-document-refusal.d.ts +5 -5
- package/dist/config-document-refusal.js +2 -1
- package/dist/config-fns.d.ts +5 -5
- package/dist/config-fns.js +17 -16
- package/dist/config-root-documents.d.ts +1 -1
- package/dist/config-root-documents.js +4 -3
- package/dist/config-root-node.d.ts +1 -1
- package/dist/config-root-node.js +5 -3
- package/dist/conformance/corpus.d.ts +1 -1
- package/dist/conformance/derive.d.ts +16 -8
- package/dist/conformance/derive.js +41 -24
- package/dist/conformance/index.d.ts +1 -1
- package/dist/conformance/index.js +1 -1
- package/dist/conformance/run.js +8 -9
- package/dist/conformance/types.js +4 -3
- 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/cross-domain.js +6 -5
- package/dist/cross-session.js +3 -2
- package/dist/deep-freeze.d.ts +26 -0
- package/dist/deep-freeze.js +69 -0
- package/dist/default-model.js +2 -1
- package/dist/device-relay.d.ts +1 -1
- package/dist/device-relay.js +1 -1
- package/dist/env-model-table.js +2 -1
- package/dist/execution-lane-index.d.ts +1 -1
- package/dist/execution-lane-index.js +5 -4
- package/dist/execution-lanes.d.ts +2 -2
- package/dist/execution-lanes.js +18 -17
- 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 +72 -59
- package/dist/fleet.js +14 -13
- package/dist/hooks-config.d.ts +12 -12
- package/dist/hooks-config.js +16 -15
- package/dist/hooks.d.ts +20 -10
- package/dist/hooks.js +30 -19
- package/dist/http-hook-allowlists.js +2 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +6 -2
- 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 +106 -59
- package/dist/mcp-server-policy.js +3 -2
- package/dist/migration-receipt.d.ts +3 -3
- package/dist/migration-receipt.js +4 -3
- package/dist/one-time-migrations.d.ts +2 -2
- package/dist/one-time-migrations.js +75 -57
- package/dist/own-key-read.d.ts +3 -1
- package/dist/plain-json-object.d.ts +6 -3
- package/dist/plain-json-object.js +6 -3
- package/dist/portable-domains.d.ts +18 -12
- package/dist/portable-domains.js +21 -15
- package/dist/reserved-member-name.d.ts +1 -1
- package/dist/reserved-member-name.js +3 -2
- package/dist/resolve-roster.js +3 -2
- package/dist/retired-envs.js +3 -6
- package/dist/retired-role-words.d.ts +1 -1
- package/dist/retired-role-words.js +4 -6
- package/dist/safety-merge-spec.d.ts +11 -4
- package/dist/safety-merge-spec.js +5 -4
- package/dist/scheduler-store-node.d.ts +5 -2
- package/dist/scheduler-store-node.js +8 -5
- package/dist/secret-scan.js +1 -1
- package/dist/settings-sources.js +6 -5
- package/dist/settings-units.js +3 -2
- 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 +89 -19
- package/dist/types.js +57 -65
- package/dist/ui-language.js +4 -3
- package/dist/url-credential.js +4 -3
- package/dist/url-shape.d.ts +1 -1
- package/dist/url-shape.js +5 -4
- package/dist/web-admin-credential.js +2 -1
- package/dist/web-admin-env.d.ts +1 -1
- package/dist/web-admin-env.js +4 -3
- package/docs/API-SURFACE.md +47 -7
- package/docs/CONFORMANCE.md +6 -4
- package/docs/CONSUMER-INTEGRATION.md +131 -6
- package/llms-full.txt +46 -24
- package/llms.txt +27 -13
- package/package.json +3 -2
|
@@ -44,20 +44,23 @@ export declare function isContentOriginWord(v: unknown): v is McpContentOrigin;
|
|
|
44
44
|
/** 坏内容出处值的**可打印**摘要:串 ⇒ 引号形的回显({@link quotedCallerText}:剥控制与双向字符、截 64 字);非串只说种类。 */
|
|
45
45
|
export declare function describeBadContentOrigin(v: unknown): string;
|
|
46
46
|
/**
|
|
47
|
-
*
|
|
48
|
-
* `assertionHeader`
|
|
47
|
+
* 请求面读器**点名拒**的键的**原因词**(闭集,29.0.0)—— 与「表外未知键」分得开的那一类:读器认得这把键,知道它为什么不在请求面上。
|
|
48
|
+
* · `key_retired`:`transport.assertionHeader`(http)—— 29.0.0 退役:托管连接器的断言是部署的声明(配置面的 `transport.credentials`),头名归引擎,请求不说它;
|
|
49
|
+
* · `credentials_not_carried`:`transport.credentials`(两种传输)—— 请求面不承载凭据引用:引擎原语包的准入表(`CREDENTIAL_REF_TRUST`)对请求面拒 `env` / `handle` / `assertion`,
|
|
50
|
+
* 其余种类本版请求面也没有座位;引用是部署一侧的声明。
|
|
51
|
+
* 读到这两把键之一(自有键、值不是 `undefined`)⇒ 硬坏形({@link RequestMcpTransportRead} 的 `ok:false`),`issue.refusal` = 这里的词、`issue.path` 点名那把键、`issue.reason` 是原因句(不回显值)。
|
|
52
|
+
* 只靠继承可见 ⇒ 不读、不拒,进 `lost` 点名 —— 与身份头同一条律({@link axisKeyOf})。
|
|
53
|
+
* 判序 = 读序:`kind` 之后先读这两把键(其余键一个都还没读)—— 一条带着点名拒的键的条目,不论别处坏不坏、读不读得出,都读成这一类;两把都在 ⇒ `assertionHeader` 先。
|
|
54
|
+
* 消费方按词分派、不读句子;多一个词而穷尽 `switch` 不补 ⇒ 编译红。
|
|
49
55
|
*/
|
|
50
|
-
export declare
|
|
51
|
-
|
|
52
|
-
assertionHeader?: string;
|
|
53
|
-
};
|
|
56
|
+
export declare const MCP_REQUEST_KEY_REFUSALS: readonly ["key_retired", "credentials_not_carried"];
|
|
57
|
+
export type McpRequestKeyRefusal = (typeof MCP_REQUEST_KEY_REFUSALS)[number];
|
|
54
58
|
/**
|
|
55
59
|
* 请求面一条 MCP 条目的传输形。与引擎传输形的关系逐键一句(处置表,对拍 = 上游漂移门 ⑧):
|
|
56
60
|
* · `kind` / `command` / `args` / `url` / `principalHeader` —— 与引擎同键同型;
|
|
57
61
|
* · `env` / `headers` —— 请求带来的**字面件**:引擎的声明不带值(一台服务器的凭据头 / 子进程环境由部署的对端座每次发送时答),
|
|
58
62
|
* 所以这两把键交给引擎之前由消费方从声明里拿走、按它自己的对端座答;
|
|
59
|
-
* · `
|
|
60
|
-
* · 引擎的 `credentials`(不透明的凭据引用)—— 请求面不收:读器不读它。
|
|
63
|
+
* · 引擎的 `credentials`(不透明的凭据引用)—— 请求面不承载:在场 ⇒ 读器点名拒(`credentials_not_carried`,{@link MCP_REQUEST_KEY_REFUSALS})。
|
|
61
64
|
*/
|
|
62
65
|
export type RequestMcpTransport = {
|
|
63
66
|
kind: "stdio";
|
|
@@ -69,7 +72,6 @@ export type RequestMcpTransport = {
|
|
|
69
72
|
url: string;
|
|
70
73
|
headers?: Record<string, string>;
|
|
71
74
|
principalHeader?: string;
|
|
72
|
-
assertionHeader?: string;
|
|
73
75
|
};
|
|
74
76
|
/**
|
|
75
77
|
* 条目内一处坏形:`path` = 条目内的键路径(`transport.url`),`reason` = 判官的原因句(只说形与词表,不回显值)。
|
|
@@ -80,14 +82,17 @@ export type RequestMcpTransport = {
|
|
|
80
82
|
* · `member_name_reserved`:有成员叫保留名({@link RESERVED_MEMBER_NAMES}:`__proto__` / `constructor` / `prototype`)。值是串 ⇒ 只剔它、其余照交,每个一条、`path` 是成员级(`transport.env.__proto__`);
|
|
81
83
|
* 成员的值也不是串(或读不出)⇒ 整张记录不交,`path` 是键级,句子一次说全两件事 —— 名坏优先、值坏并列,所以词仍是 `member_name_reserved`。
|
|
82
84
|
* `member` 是成员名的**回显形**(剥控制与双向字符、截 64 字加 `…`),可直接进日志与句子,不是回查原对象的键。其余的坏形(`args` / `url` / `principalHeader` / ……)两格都不带。
|
|
85
|
+
*
|
|
86
|
+
* `refusal` 只在**点名拒**的硬坏形上(闭集词 {@link MCP_REQUEST_KEY_REFUSALS}):读器认得这把键、知道它为什么不在请求面上 —— 消费方据它把「已退役 / 不承载的键」与「表外未知键」分开处置。
|
|
83
87
|
*/
|
|
84
88
|
export interface McpEntryKeyIssue {
|
|
85
89
|
readonly path: string;
|
|
86
90
|
readonly reason: string;
|
|
87
91
|
readonly member?: string;
|
|
88
92
|
readonly fault?: PlainStringRecordFault;
|
|
93
|
+
readonly refusal?: McpRequestKeyRefusal;
|
|
89
94
|
}
|
|
90
|
-
/** {@link readRequestMcpTransport} 的结果:`ok:false` = 硬坏形(这条 server
|
|
95
|
+
/** {@link readRequestMcpTransport} 的结果:`ok:false` = 硬坏形(这条 server 无从挂载;`issue.refusal` 在场 = 读器点名拒的键,见 {@link MCP_REQUEST_KEY_REFUSALS});`ok:true` 的 `lost` = 读器**丢掉**的可选子键(server 照挂、少一个声明)。 */
|
|
91
96
|
export type RequestMcpTransportRead = {
|
|
92
97
|
ok: true;
|
|
93
98
|
transport: RequestMcpTransport;
|
|
@@ -98,12 +103,12 @@ export type RequestMcpTransportRead = {
|
|
|
98
103
|
};
|
|
99
104
|
/**
|
|
100
105
|
* 请求面 `transport` 的**唯一读器**:读器投影 transport 用它,发送前 / 受理时的判形读它报的 `lost` —— 同一只函数两个消费点,「读器丢了什么」与「门拒什么」不可能分岔。
|
|
101
|
-
* · 硬坏形(`transport` 不是对象 / `kind` 出闭集 / stdio 缺 `command` / http 的 `url` 不是 http(s))⇒ `ok:false`,`path` 是读器点名的键路径;
|
|
106
|
+
* · 硬坏形(`transport` 不是对象 / `kind` 出闭集 / 点名拒的键在场({@link MCP_REQUEST_KEY_REFUSALS},先于其余键判)/ stdio 缺 `command` / http 的 `url` 不是 http(s))⇒ `ok:false`,`path` 是读器点名的键路径;
|
|
102
107
|
* · 软坏形(`args` 不是串数组 / `env` `headers` 不是纯数据的串记录 / `principalHeader` 非串)⇒ 读器**丢这个键**(重放存量提交体时的升级前读法),并把它记进 `lost`
|
|
103
|
-
* (受理新提交的门据它响亮拒)
|
|
108
|
+
* (受理新提交的门据它响亮拒);身份 / 凭据轴上的键({@link AXIS_KEYS}:`principalHeader` / `assertionHeader` / `credentials`)只靠继承可见 ⇒ 不读值、不拒、进 `lost` 点名;
|
|
104
109
|
* · `env` / `headers` 只收**纯数据**的记录({@link readPlainStringRecord}):必须是朴素 JSON 对象(`./plain-json-object` 的判据;`Map`、`Set`、类实例整张不收),每个自有成员的值都是串;
|
|
105
110
|
* 交出的是**副本**(不是调用方的对象,改原对象不影响读后的形)。名叫保留名({@link RESERVED_MEMBER_NAMES})的成员不进副本、每个单独记进 `lost`。
|
|
106
|
-
* 坏形的 `lost` 条目带机读位(见 {@link McpEntryKeyIssue})
|
|
111
|
+
* 坏形的 `lost` 条目带机读位(见 {@link McpEntryKeyIssue})。这两键的读法与诊断就是公开读口 {@link readRequestStringRecord} 以 `transport.env` / `transport.headers` 为坐标的读数。
|
|
107
112
|
* url 的拒句不回显值:它常规地带凭据(userinfo)。
|
|
108
113
|
*/
|
|
109
114
|
export declare function readRequestMcpTransport(t: unknown): RequestMcpTransportRead;
|
|
@@ -137,3 +142,17 @@ export type PlainStringRecordRead = {
|
|
|
137
142
|
* 名叫保留名而值也坏的成员,句子一次说全两件事(名坏在前、值坏并列):调用方照值改完再撞第二条是两步才改对。
|
|
138
143
|
*/
|
|
139
144
|
export declare function readPlainStringRecord(v: unknown): PlainStringRecordRead;
|
|
145
|
+
/** {@link readRequestStringRecord} 的读数:`record` = 交出去的纯数据副本(缺席或不交 ⇒ `undefined`);`issues` = 这份记录在坐标上的诊断(零条或多条,形见 {@link McpEntryKeyIssue})。 */
|
|
146
|
+
export interface RequestStringRecordRead {
|
|
147
|
+
readonly record: Record<string, string> | undefined;
|
|
148
|
+
readonly issues: readonly McpEntryKeyIssue[];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* 请求面一份「名 → 串」记录的**带坐标读法** —— 公开读口:传输读器读 `transport.env` / `transport.headers` 就是它的两次调用;消费方读自己的「名 → 串」记录
|
|
152
|
+
* (A2A 对端的 `headers` 一类)调同一只,诊断与 MCP 传输同形同句,不另拼原因句。`path` = 这份记录在调用方载荷里的坐标(原样进诊断,不解析)。从不抛。
|
|
153
|
+
* · 缺席(`undefined`)⇒ 不交、零条;
|
|
154
|
+
* · 记录不交({@link readPlainStringRecord} 答 `ok:false`)⇒ 恰一条,`path` 是坐标本身,`reason` = `must be a plain object of string values — ` + 读数的 `detail`,
|
|
155
|
+
* `fault` 与(坏在某个成员时)`member` 取自读数;
|
|
156
|
+
* · 交 ⇒ 纯数据副本;名叫保留名({@link RESERVED_MEMBER_NAMES})的成员不进副本,每个一条:`path` = `<坐标>.<名>`、`member` = 名、`fault` = `member_name_reserved`。
|
|
157
|
+
*/
|
|
158
|
+
export declare function readRequestStringRecord(path: string, raw: unknown): RequestStringRecordRead;
|
|
@@ -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
|
*
|
|
@@ -33,6 +34,9 @@ import { RESERVED_MCP_SERVER_NAME_REASON, isReservedMcpServerName } from "./mcp-
|
|
|
33
34
|
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";
|
|
37
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
38
|
+
import { CREDENTIAL_REF_TRUST, readCredentialRef } from "@sema-agent/primitives";
|
|
39
|
+
import { retiredFormSentence } from "./retired-form.js";
|
|
36
40
|
// ── 值的种类描述(拒句只说「你写的是什么形」,不回显值:值可能带凭据、可能任意长)──────────────────────────────────────
|
|
37
41
|
/** 值的**种类词**(不回显值本身):`null` / `array` / `typeof` 词(`object` / `function` / `string` …);读不出的对象 ⇒ 全包唯一的那一句。形状只问座位(总,不抛):两只坏值描述器共用这一只。 */
|
|
38
42
|
function describeKindWord(v) {
|
|
@@ -159,61 +163,73 @@ export function isContentOriginWord(v) {
|
|
|
159
163
|
export function describeBadContentOrigin(v) {
|
|
160
164
|
return typeof v === "string" ? quotedCallerText(v) : describeKindWord(v);
|
|
161
165
|
}
|
|
162
|
-
// ──
|
|
166
|
+
// ── 身份 / 凭据轴上的键 ─────────────────────────────────────────────────────────────────────────────
|
|
163
167
|
/**
|
|
164
|
-
*
|
|
165
|
-
* `
|
|
168
|
+
* 传输上**身份 / 凭据轴**的键(闭集;也是 `lost` 里点名它们的次序):身份头 `principalHeader`,与点名拒的两把键 `assertionHeader` / `credentials`({@link MCP_REQUEST_KEY_REFUSALS})。
|
|
169
|
+
* 一条律、一只读法({@link axisKeyOf}):只认自有键;只靠继承可见 ⇒ 不读、进 `lost` 点名({@link inheritedAxisKeyIssue})。
|
|
166
170
|
*/
|
|
167
|
-
|
|
168
|
-
const ids = identityFieldsOf(transport);
|
|
169
|
-
if (!ids.ok)
|
|
170
|
-
return {}; // 读不出 ⇒ 身份头整体读不出(传输读器对同样的输入是整只不交)
|
|
171
|
-
const { principalHeader, assertionHeader } = ids.value;
|
|
172
|
-
return {
|
|
173
|
-
...(typeof principalHeader === "string" ? { principalHeader } : {}),
|
|
174
|
-
...(typeof assertionHeader === "string" ? { assertionHeader } : {}),
|
|
175
|
-
};
|
|
176
|
-
}
|
|
171
|
+
const AXIS_KEYS = ["principalHeader", "assertionHeader", "credentials"];
|
|
177
172
|
/**
|
|
178
|
-
*
|
|
179
|
-
*
|
|
180
|
-
* **只读自有键**(身份只认自有键):键只靠继承可见(含 `Object.prototype` 被污染成数据值)⇒ 不读它的值、当缺席,但**记下**(`principalInherited` / `assertionInherited`)—— 传输读器据此点名,
|
|
181
|
-
* 身份轴上不静默;公开读者没有 `lost` 通道,只读值。
|
|
173
|
+
* 轴上键({@link AXIS_KEYS})的**唯一读法**:**只读自有键**(身份与凭据只认自有键);键只靠继承可见(含 `Object.prototype` 被污染成数据值)⇒ 不读它的值、当缺席,
|
|
174
|
+
* 但**记下**(`inherited`)—— 传输读器据此点名,这条轴上不静默。读不出 ⇒ 整体读不出(`ok:false`,向上传),不折成 `undefined`。
|
|
182
175
|
*/
|
|
183
|
-
function
|
|
184
|
-
const
|
|
185
|
-
if (
|
|
176
|
+
function axisKeyOf(record, key) {
|
|
177
|
+
const read = readKey(record, key);
|
|
178
|
+
if (read.presence === "unreadable")
|
|
186
179
|
return { ok: false, sentence: UNINSPECTABLE };
|
|
187
|
-
|
|
188
|
-
|
|
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`;
|
|
189
204
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
};
|
|
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;
|
|
202
216
|
}
|
|
203
217
|
const transportBad = (path, reason) => ({ ok: false, issue: { path, reason } });
|
|
204
|
-
/**
|
|
205
|
-
const
|
|
218
|
+
/** 轴上键({@link AXIS_KEYS})只靠继承可见时的 `lost` 条目:不读它的值,但点名(这条轴不静默;三把键一句,句子不回显值)。机读位不带(`fault` 的闭集不为它加词)。 */
|
|
219
|
+
const inheritedAxisKeyIssue = (key) => ({
|
|
206
220
|
path: `transport.${key}`,
|
|
207
|
-
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)",
|
|
208
222
|
});
|
|
223
|
+
/** 一次快照里只靠继承可见的轴上键 ⇒ `lost` 条目,按 {@link AXIS_KEYS} 的次序。 */
|
|
224
|
+
const inheritedAxisKeyIssues = (inherited) => AXIS_KEYS.filter((key) => inherited.has(key)).map(inheritedAxisKeyIssue);
|
|
209
225
|
/**
|
|
210
226
|
* 请求面 `transport` 的**唯一读器**:读器投影 transport 用它,发送前 / 受理时的判形读它报的 `lost` —— 同一只函数两个消费点,「读器丢了什么」与「门拒什么」不可能分岔。
|
|
211
|
-
* · 硬坏形(`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` 是读器点名的键路径;
|
|
212
228
|
* · 软坏形(`args` 不是串数组 / `env` `headers` 不是纯数据的串记录 / `principalHeader` 非串)⇒ 读器**丢这个键**(重放存量提交体时的升级前读法),并把它记进 `lost`
|
|
213
|
-
* (受理新提交的门据它响亮拒)
|
|
229
|
+
* (受理新提交的门据它响亮拒);身份 / 凭据轴上的键({@link AXIS_KEYS}:`principalHeader` / `assertionHeader` / `credentials`)只靠继承可见 ⇒ 不读值、不拒、进 `lost` 点名;
|
|
214
230
|
* · `env` / `headers` 只收**纯数据**的记录({@link readPlainStringRecord}):必须是朴素 JSON 对象(`./plain-json-object` 的判据;`Map`、`Set`、类实例整张不收),每个自有成员的值都是串;
|
|
215
231
|
* 交出的是**副本**(不是调用方的对象,改原对象不影响读后的形)。名叫保留名({@link RESERVED_MEMBER_NAMES})的成员不进副本、每个单独记进 `lost`。
|
|
216
|
-
* 坏形的 `lost` 条目带机读位(见 {@link McpEntryKeyIssue})
|
|
232
|
+
* 坏形的 `lost` 条目带机读位(见 {@link McpEntryKeyIssue})。这两键的读法与诊断就是公开读口 {@link readRequestStringRecord} 以 `transport.env` / `transport.headers` 为坐标的读数。
|
|
217
233
|
* url 的拒句不回显值:它常规地带凭据(userinfo)。
|
|
218
234
|
*/
|
|
219
235
|
export function readRequestMcpTransport(t) {
|
|
@@ -243,13 +259,15 @@ export function readRequestMcpTransport(t) {
|
|
|
243
259
|
const snap = snapshotRead.value;
|
|
244
260
|
// `lost` 不用 `push` 累加(`push` 是 [[Set]],会被 `Object.prototype` 上继承的数字键 setter 吞掉 / 读成污染值):每处诊断是一个值或 `undefined`,由 `issuesOf` 一次铸成数组(定义语义)
|
|
245
261
|
switch (snap.kind) {
|
|
262
|
+
case "refused":
|
|
263
|
+
return snap.read;
|
|
246
264
|
case "stdio": {
|
|
247
265
|
if (typeof snap.command !== "string" || snap.command.length === 0)
|
|
248
266
|
return transportBad("transport.command", `must be a non-empty string (the command to run) — got ${describeValueShape(snap.command)}`);
|
|
249
267
|
const rawArgs = snap.args; // 交出去的是副本(不是调用方数组的原引用),稀疏 / 读不出的数组整键丢、进 `lost`
|
|
250
268
|
const args = rawArgs === undefined ? undefined : captureStringArray(rawArgs, "wide");
|
|
251
269
|
const argsIssue = rawArgs !== undefined && args === undefined ? { path: "transport.args", reason: `must be an array of strings — got ${describeNotStringArray(rawArgs)}` } : undefined;
|
|
252
|
-
const env =
|
|
270
|
+
const env = readRequestStringRecord("transport.env", snap.env);
|
|
253
271
|
return {
|
|
254
272
|
ok: true,
|
|
255
273
|
transport: {
|
|
@@ -258,16 +276,16 @@ export function readRequestMcpTransport(t) {
|
|
|
258
276
|
...(args !== undefined ? { args } : {}),
|
|
259
277
|
...(env.record !== undefined ? { env: env.record } : {}),
|
|
260
278
|
},
|
|
261
|
-
lost: issuesOf(argsIssue, ...env.issues),
|
|
279
|
+
lost: issuesOf(argsIssue, ...env.issues, ...inheritedAxisKeyIssues(snap.inherited)),
|
|
262
280
|
};
|
|
263
281
|
}
|
|
264
282
|
case "http": {
|
|
265
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).
|
|
266
284
|
if (typeof snap.url !== "string" || !startsWithHttpScheme(snap.url))
|
|
267
285
|
return transportBad("transport.url", "must be an absolute http(s) URL (put credentials in transport.headers, never in the URL)");
|
|
268
|
-
const
|
|
269
|
-
const headers =
|
|
270
|
-
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
|
|
271
289
|
? { path: "transport.principalHeader", reason: `must be a string (the HTTP header NAME the end-user principal is injected into) — got ${describeValueShape(snap.principalHeader)}` }
|
|
272
290
|
: undefined;
|
|
273
291
|
return {
|
|
@@ -276,9 +294,9 @@ export function readRequestMcpTransport(t) {
|
|
|
276
294
|
kind: "http",
|
|
277
295
|
url: snap.url,
|
|
278
296
|
...(headers.record !== undefined ? { headers: headers.record } : {}),
|
|
279
|
-
...
|
|
297
|
+
...(principalHeader !== undefined ? { principalHeader } : {}),
|
|
280
298
|
},
|
|
281
|
-
lost: issuesOf(...headers.issues, principalIssue,
|
|
299
|
+
lost: issuesOf(...headers.issues, principalIssue, ...inheritedAxisKeyIssues(snap.inherited)),
|
|
282
300
|
};
|
|
283
301
|
}
|
|
284
302
|
case "other":
|
|
@@ -290,25 +308,50 @@ export function readRequestMcpTransport(t) {
|
|
|
290
308
|
}
|
|
291
309
|
}
|
|
292
310
|
function snapshotTransport(tr) {
|
|
293
|
-
//
|
|
294
|
-
// 任何一个字段读不出 ⇒ 整只读不出(第一个读不出的就停,后面的一个不读)
|
|
311
|
+
// 字段一律只读**自有**属性(一条律):JSON 解析只铸自有键,JSON 面不变;原型链上被污染的值 / 会抛的 getter 不触发,注入的值进不来。
|
|
312
|
+
// 任何一个字段读不出 ⇒ 整只读不出(第一个读不出的就停,后面的一个不读)。身份 / 凭据轴上的键(`AXIS_KEYS`)经 `axisKeyOf`:只靠继承可见 ⇒ 记进 `inherited`、由读器点名;
|
|
313
|
+
// 点名拒的键(`assertionHeader` / `credentials`)在 `kind` 之后先读,自有且在场即停。
|
|
295
314
|
const kind = ownValueOf(tr, "kind");
|
|
296
315
|
if (!kind.ok)
|
|
297
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
|
+
};
|
|
298
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 } };
|
|
299
333
|
const fields = ownFieldsOf(tr, ["command", "args", "env"]);
|
|
300
334
|
if (!fields.ok)
|
|
301
335
|
return fields;
|
|
302
|
-
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 } };
|
|
303
337
|
}
|
|
304
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 } };
|
|
305
348
|
const fields = ownFieldsOf(tr, ["url", "headers"]);
|
|
306
349
|
if (!fields.ok)
|
|
307
350
|
return fields;
|
|
308
|
-
const
|
|
309
|
-
if (!
|
|
310
|
-
return
|
|
311
|
-
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 } };
|
|
312
355
|
}
|
|
313
356
|
return { ok: true, value: { kind: "other", value: kind.value } };
|
|
314
357
|
}
|
|
@@ -321,7 +364,7 @@ const reservedMemberFault = (name) => `no member of a declaration may be named "
|
|
|
321
364
|
* 词的意义逐词写在 {@link McpEntryKeyIssue}。消费方按词分派,不读句子;读器的读数 {@link PlainStringRecordRead} 与传输条目的机读位 {@link McpEntryKeyIssue} 的 `fault` 都由这一张表推出。
|
|
322
365
|
* 多一个词而消费方的穷尽 `switch` 不补 ⇒ 编译红(提货成本,不是静默)。
|
|
323
366
|
*/
|
|
324
|
-
export const PLAIN_STRING_RECORD_FAULTS = ["not_plain_record", "member_not_string", "member_name_reserved"];
|
|
367
|
+
export const PLAIN_STRING_RECORD_FAULTS = deepFreeze(["not_plain_record", "member_not_string", "member_name_reserved"]);
|
|
325
368
|
/** 记录不交时 `detail` 的前半句:它是哪一种不朴素(null / 数组 / 原始值各一句,对象里的非朴素一句)。`shape` 穷举 —— 新词不补 = 编译红。 */
|
|
326
369
|
function notPlainDetail(shape, v) {
|
|
327
370
|
switch (shape) {
|
|
@@ -388,10 +431,14 @@ export function readPlainStringRecord(v) {
|
|
|
388
431
|
/** 把诊断条目铸成数组:`undefined`(这一处没有诊断)略去。`filter` 的结果走 `CreateDataProperty`,不走 `[[Set]]` —— `lost` 是「门拒什么」的读数,不能被继承的数字键 setter 吞掉。 */
|
|
389
432
|
const issuesOf = (...candidates) => candidates.filter((c) => c !== undefined);
|
|
390
433
|
/**
|
|
391
|
-
* `transport.env` / `transport.headers`
|
|
392
|
-
*
|
|
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`。
|
|
393
440
|
*/
|
|
394
|
-
function
|
|
441
|
+
export function readRequestStringRecord(path, raw) {
|
|
395
442
|
if (raw === undefined)
|
|
396
443
|
return { record: undefined, issues: [] };
|
|
397
444
|
const read = readPlainStringRecord(raw);
|
|
@@ -17,10 +17,11 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { settingsSourceContract } from "./settings-sources.js";
|
|
19
19
|
import { urlAllowPatternMatches, urlDenyPatternMatches } from "./url-pattern.js";
|
|
20
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
20
21
|
/** 两张名单的键(闭集,声明序)。 */
|
|
21
|
-
export const MCP_SERVER_LIST_KEYS = ["allowedMcpServers", "deniedMcpServers"];
|
|
22
|
+
export const MCP_SERVER_LIST_KEYS = deepFreeze(["allowedMcpServers", "deniedMcpServers"]);
|
|
22
23
|
/** 没过的那一条的种类(闭集)。拒绝名单:命中的条目种类;允许名单:必须命中而没命中的条目种类,`empty` = 允许名单是空数组。 */
|
|
23
|
-
export const MCP_POLICY_RULES = ["name", "command", "url", "empty"];
|
|
24
|
+
export const MCP_POLICY_RULES = deepFreeze(["name", "command", "url", "empty"]);
|
|
24
25
|
const isName = (e) => "serverName" in e && e.serverName !== undefined;
|
|
25
26
|
const isCommand = (e) => "serverCommand" in e && e.serverCommand !== undefined;
|
|
26
27
|
const isUrl = (e) => "serverUrl" in e && e.serverUrl !== undefined;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 一次性迁移的**收据形**与两张闭集(11.0.0)—— 叶子模块(
|
|
2
|
+
* 一次性迁移的**收据形**与两张闭集(11.0.0)—— 叶子模块(运行期零依赖;除包内私有的零 import 叶 `./deep-freeze` 外只有型导入),由 `./one-time-migrations` 再导出(不进主桶)。
|
|
3
3
|
* 单拆出来只为一件事:读迁移 id 闭集的叶子(墓碑句 `./retired-form`、车道表 `./execution-lane-index`、配置根文档 `./config-root-documents`)
|
|
4
4
|
* 不该为一个型把整套迁移体与域 schema 拉进来。(26.0.0 起调度店的读口不再带收据 —— 它的读时改写到期删了。)
|
|
5
5
|
*/
|
|
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,12 +1,13 @@
|
|
|
1
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
1
2
|
/** 本版登记的一次性迁移 id(闭集;每个 id 在 `ONE_TIME_MIGRATIONS` 登记表里恰一行)。收据只许这些 id。 */
|
|
2
|
-
export const ONE_TIME_MIGRATION_IDS = ["SS-
|
|
3
|
+
export const ONE_TIME_MIGRATION_IDS = deepFreeze(["SS-M10", "SS-M11", "SS-M12", "SS-M13"]);
|
|
3
4
|
/**
|
|
4
5
|
* 一条收据说迁移**对一个坐标做了什么**(闭集,每词一义):
|
|
5
6
|
* - `moved` — 值搬到新位(`to`),义不变;
|
|
6
7
|
* - `rewritten` — 同一坐标上的值换成今天的生效读法(例:15.x worker 行的记忆方言词 `tidb` ⇒ `mysql`);
|
|
7
|
-
* - `dropped-inert` — 删掉;今天的读法本就不让它生效(
|
|
8
|
+
* - `dropped-inert` — 删掉;今天的读法本就不让它生效(例:空的 `bindings: []`、不声明那条车道的行上的车道键);
|
|
8
9
|
* - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么;
|
|
9
10
|
* - `minted` — 在**缺席处**写下一份新事实(一份部署决定),不改任何已有的值 —— 只有 SS-M11 铸(配置根的 `config.env-models.json`:
|
|
10
11
|
* 升级前「管模型面的目录整表顶替 env 模型」的读法,写成 `replaced`;不存在才建)。
|
|
11
12
|
*/
|
|
12
|
-
export const MIGRATION_APPLIED_AS = ["moved", "rewritten", "dropped-inert", "refused", "minted"];
|
|
13
|
+
export const MIGRATION_APPLIED_AS = deepFreeze(["moved", "rewritten", "dropped-inert", "refused", "minted"]);
|
|
@@ -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
|
/**
|