@sema-agent/settings-schema 28.0.0 → 30.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 +431 -0
- package/README.md +94 -14
- package/conformance/VERSION +1 -1
- package/conformance/cases/c01-entry-salvage-then-typo/expected.json +2 -2
- 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 +3 -3
- package/conformance/cases/c58-s784-g2-multitenant-host/expected.json +3 -3
- package/conformance/cases/c59-s784-g3-k8s-missing-image/expected.json +3 -3
- package/conformance/cases/c60-s784-g3-e2b-missing-key/expected.json +3 -3
- package/conformance/cases/c61-s784-g3-other-lane-key/expected.json +3 -3
- package/conformance/cases/c62-s784-g7a-session-tidb/expected.json +3 -3
- package/conformance/cases/c63-s784-host-two-replicas/expected.json +3 -3
- package/conformance/cases/c64-s784-multitenant-local-store/expected.json +3 -3
- package/conformance/cases/c65-s784-pg-without-db/expected.json +3 -3
- package/conformance/cases/c66-s784-memory-backend-mismatch/expected.json +3 -3
- package/conformance/cases/c67-s784-retired-field-loud/expected.json +3 -3
- package/conformance/cases/c68-s784-device-local-store/expected.json +3 -3
- 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 +2 -2
- package/conformance/cases/c77-prompts-center-artifact-carried/expected.json +1 -1
- package/conformance/cases/c78-prompts-empty-bindings-refused/expected.json +2 -2
- package/conformance/cases/c78-prompts-empty-bindings-refused/meta.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 +2 -2
- package/conformance/cases/c82-prompts-v1-catalog-refused/expected.json +2 -2
- 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/cli04-env-value-with-newline/meta.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/t01-absent-domain-key-not-null/meta.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/t04-secret-literal-never-in-warning-value/meta.json +1 -1
- package/conformance/cases/z01-every-domain-empty-object/expected.json +1 -1
- package/conformance/cases/z01-every-domain-empty-object/meta.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 +4 -2
- package/dist/config-fns.js +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 +37 -21
- 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 +72 -59
- 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 +1 -1
- package/dist/one-time-migrations.js +68 -91
- 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 +37 -44
- package/docs/API-SURFACE.md +47 -7
- package/docs/CONFORMANCE.md +6 -4
- package/docs/CONSUMER-INTEGRATION.md +147 -4
- package/llms-full.txt +45 -24
- package/llms.txt +27 -14
- package/package.json +3 -2
|
@@ -37,39 +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
|
-
{
|
|
61
|
-
id: "SS-M10",
|
|
62
|
-
oldForm: "refused",
|
|
63
|
-
introducedIn: "14.0.0",
|
|
64
|
-
releasedOn: "2026-10-17",
|
|
65
|
-
removableAfter: "2026-11-16",
|
|
66
|
-
rewrites: "prompts: an empty `bindings` array (the default every document carried before 14.0.0 — it served nothing) is removed; a non-empty " +
|
|
67
|
-
"`bindings` and a `catalog` are refused and kept verbatim — declarations compile to center overlays only through the center's card " +
|
|
68
|
-
"compiler (republish), and a catalog's digest is the engine's (rebuild it with the engine's buildPromptArtifact)",
|
|
69
|
-
removal: "the next major after the window: delete the SS-M10 step; the prompts `bindings` / `catalog` tombstone fields stay — their SS-M10 clause goes",
|
|
70
|
-
afterRemoval: "the prompts `bindings` / `catalog` tombstone fields (permanent): a residual key is refused on read and write (the prompts domain degrades " +
|
|
71
|
-
"to its default — no center layer is served)",
|
|
72
|
-
},
|
|
73
46
|
{
|
|
74
47
|
id: "SS-M11",
|
|
75
48
|
oldForm: "read-as-default",
|
|
@@ -111,6 +84,22 @@ export const ONE_TIME_MIGRATIONS = deepFreeze([
|
|
|
111
84
|
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
85
|
"15.x row is refused on write and held by readWorkersRows on read, never rewritten",
|
|
113
86
|
},
|
|
87
|
+
{
|
|
88
|
+
id: "SS-M13",
|
|
89
|
+
oldForm: "refused",
|
|
90
|
+
introducedIn: "29.0.0",
|
|
91
|
+
releasedOn: "2026-11-15",
|
|
92
|
+
removableAfter: "2026-12-15",
|
|
93
|
+
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 " +
|
|
94
|
+
"deleted (dropped-inert). An http entry carrying transport.assertionHeader (retired in 29.0.0) is refused and kept verbatim, the whole entry: the " +
|
|
95
|
+
"stored entry has no connector id, so writing transport.credentials = {\"kind\":\"assertion\",\"audience\":\"<connector id>\"} would be a guess — " +
|
|
96
|
+
"the operator writes it by hand from the deployment registry and deletes assertionHeader",
|
|
97
|
+
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 " +
|
|
98
|
+
"stays — its SS-M13 clause goes",
|
|
99
|
+
afterRemoval: "the transport.assertionHeader tombstone field (permanent): a residual key is refused on write and its entry is dropped on read (the mcp domain " +
|
|
100
|
+
"degrades to its default when no entry survives); residual authForm / entryKind keys are unknown keys — stripped on write, the entry dropped " +
|
|
101
|
+
"on read (entry-unknown-key)",
|
|
102
|
+
},
|
|
114
103
|
]);
|
|
115
104
|
/**
|
|
116
105
|
* 迁移一组存储文档(见文件头「入口」)。纯函数;没改的文档原样返回;**不抬任何版本号**(结果里没有版本 —— 那是调用方的)。
|
|
@@ -144,8 +133,7 @@ export function migrateStoredDocuments(docs) {
|
|
|
144
133
|
const receipts = [];
|
|
145
134
|
// 步序的律:纯改写步在前,拿新 schema 终判改写结果的 workers 行步最后 —— 它判的是**全部**改写之后的行(否则一跑 refused、二跑才过:既不是一次完成,也不幂等)。
|
|
146
135
|
try {
|
|
147
|
-
|
|
148
|
-
stepPromptsAxes(out, receipts);
|
|
136
|
+
stepMcpServers(out, receipts);
|
|
149
137
|
stepWorkersRows(out, receipts);
|
|
150
138
|
}
|
|
151
139
|
catch (e) {
|
|
@@ -227,6 +215,18 @@ const without = (o, k) => {
|
|
|
227
215
|
const { [k]: _gone, ...rest } = o;
|
|
228
216
|
return rest;
|
|
229
217
|
};
|
|
218
|
+
/**
|
|
219
|
+
* 一只存储文档里的数组(workers 行 / mcp 条目)的行,**按下标读一次**:内建 `Array.prototype.forEach` 的读法(`length` 一次;`0 … length-1` 里在场的下标各一次 `[[HasProperty]]` + `[[Get]]`,洞不读)——
|
|
220
|
+
* v28.0.0 调的是数组实例上的 `forEach` 且边判边写回(写回时走迭代器把各下标再读一次),自此只有这一次读;不走调用方数组自己的迭代器(展开 / `for…of` 会)、不调它自己的成员(实例上的 `forEach`、`slice` 经 `constructor` 取的 species 都会)。
|
|
221
|
+
* 读到的值按原下标**定义**进一只包自己的数组(洞留洞;定义语义:`Array.prototype` 上被污染出数字键的 setter 吞不掉它)。行步判的与写回的都是这一份副本(拒的行原样就是这一次读到的值)。
|
|
222
|
+
*/
|
|
223
|
+
function rowsByIndex(array) {
|
|
224
|
+
const rows = [];
|
|
225
|
+
Array.prototype.forEach.call(array, (row, index) => {
|
|
226
|
+
Object.defineProperty(rows, index, dataDescriptor(row));
|
|
227
|
+
});
|
|
228
|
+
return rows;
|
|
229
|
+
}
|
|
230
230
|
// 收据的三只铸点。坐标里的键段是用户写的(未知键名、zod issue 路径里的 Record 键),完全可能就是一条粘错位置的凭据 ⇒ 与读侧告警坐标
|
|
231
231
|
// 走同一道出门(`outgoingPath`,codex r1 F1);拒因句过 `redactSecrets`。收据从不带值。
|
|
232
232
|
function receipt(migration, document, path, appliedAs) {
|
|
@@ -329,7 +329,7 @@ function stepWorkersRows(out, receipts) {
|
|
|
329
329
|
const workerRows = ownOrThrow(doc, "workers");
|
|
330
330
|
if (!isJsonArray(workerRows))
|
|
331
331
|
return;
|
|
332
|
-
const rows = workerRows;
|
|
332
|
+
const rows = rowsByIndex(workerRows); // 每一行只读一次:判与写回用同一份读数(拒的行原样就是这一份)
|
|
333
333
|
let next;
|
|
334
334
|
rows.forEach((row, index) => {
|
|
335
335
|
if (!isPlainJsonObject(row) || typeof ownOrThrow(row, "name") !== "string")
|
|
@@ -358,69 +358,46 @@ function stepWorkersRows(out, receipts) {
|
|
|
358
358
|
if (next !== undefined)
|
|
359
359
|
out.workers = { ...doc, workers: next };
|
|
360
360
|
}
|
|
361
|
-
// ── SS-
|
|
362
|
-
/**
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
function stepRetiredRoleWords(out, receipts) {
|
|
377
|
-
const models = ownOrThrow(out, "models");
|
|
378
|
-
if (isPlainJsonObject(models)) {
|
|
379
|
-
const roles = withoutRetiredRoles(ownOrThrow(models, "roles"), "models", [], receipts);
|
|
380
|
-
if (roles !== undefined)
|
|
381
|
-
out.models = { ...models, roles };
|
|
382
|
-
}
|
|
383
|
-
const rosters = ownOrThrow(out, "rosters");
|
|
384
|
-
const rosterRows = isPlainJsonObject(rosters) ? ownOrThrow(rosters, "rosters") : undefined;
|
|
385
|
-
if (isPlainJsonObject(rosters) && isJsonArray(rosterRows)) {
|
|
386
|
-
const rows = rosterRows;
|
|
387
|
-
let next;
|
|
388
|
-
rows.forEach((row, index) => {
|
|
389
|
-
if (!isPlainJsonObject(row))
|
|
390
|
-
return;
|
|
391
|
-
const roles = withoutRetiredRoles(ownOrThrow(row, "roles"), "rosters", ["rosters", index], receipts);
|
|
392
|
-
if (roles === undefined)
|
|
393
|
-
return;
|
|
394
|
-
next ??= [...rows];
|
|
395
|
-
next[index] = { ...row, roles };
|
|
396
|
-
});
|
|
397
|
-
if (next !== undefined)
|
|
398
|
-
out.rosters = { ...rosters, rosters: next };
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
// ── SS-M10:prompts 两轴退役 ───────────────────────────────────────────────────────────────────────────
|
|
402
|
-
/** 14.0.0 的 prompts 域只装中心 artifact;13.x 的两轴键是墓碑。迁移只做只认形的那一件:空的 `bindings: []`(13.x 每份文档恒物化的默认值,
|
|
403
|
-
* 从不下发任何内容)删掉。非空 `bindings` / 不是数组的 `bindings` / `catalog` 一律 refused、原样留着 —— 声明要经中心的卡编译器才编得成
|
|
404
|
-
* overlay,catalog 的 digest 是引擎铸的,替运维机械转就是第二个编译器 / 第二个铸点。`prompts` 不是对象 ⇒ 不动(判形是读者的事)。 */
|
|
405
|
-
function stepPromptsAxes(out, receipts) {
|
|
406
|
-
const doc = ownOrThrow(out, "prompts");
|
|
361
|
+
// ── SS-M13:mcp 条目的两只惰性键与退役的断言头 ──────────────────────────────────────────────────────────────────
|
|
362
|
+
/** SS-M13 拒一条带 `assertionHeader` 的 http 条目时的理由句(点名新位与连接器 id 的出处;不回显值)。 */
|
|
363
|
+
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 = " +
|
|
364
|
+
"{\"kind\":\"assertion\",\"audience\":\"<connector id>\"} by hand (the connector id is this connector's name in the deployment registry) and delete assertionHeader";
|
|
365
|
+
/** SS-M13 删掉的两只惰性键(12.2.0 的解析透明键,29.0.0 删除)。 */
|
|
366
|
+
const SS_M13_INERT_KEYS = ["authForm", "entryKind"];
|
|
367
|
+
/**
|
|
368
|
+
* SS-M13(只认形):`mcp.servers[]` 逐条 ——
|
|
369
|
+
* · http 条目的传输带 `assertionHeader`(自有键,任何值)⇒ 一张拒收据(坐标 = 那把键),**整条原样**(同一条上的惰性键也不动:拒的行什么都不写);
|
|
370
|
+
* · 否则条目上的 `authForm` / `entryKind` ⇒ 删掉,每键一张 `dropped-inert` 收据。
|
|
371
|
+
* 认不出的形(`mcp` 不是对象、`servers` 不是数组、条目不是对象)⇒ 不动(判形是读者的事)。
|
|
372
|
+
*/
|
|
373
|
+
function stepMcpServers(out, receipts) {
|
|
374
|
+
const doc = ownOrThrow(out, "mcp");
|
|
407
375
|
if (!isPlainJsonObject(doc))
|
|
408
376
|
return;
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
377
|
+
const servers = ownOrThrow(doc, "servers");
|
|
378
|
+
if (!isJsonArray(servers))
|
|
379
|
+
return;
|
|
380
|
+
const rows = rowsByIndex(servers); // 每一条只读一次:判与写回用同一份读数(拒的那条原样就是这一份)
|
|
381
|
+
let next;
|
|
382
|
+
rows.forEach((row, index) => {
|
|
383
|
+
if (!isPlainJsonObject(row))
|
|
384
|
+
return;
|
|
385
|
+
const transport = ownOrThrow(row, "transport");
|
|
386
|
+
if (isPlainJsonObject(transport) && ownOrThrow(transport, "kind") === "http" && has(transport, "assertionHeader")) {
|
|
387
|
+
receipts.push(refused("SS-M13", "mcp", ["servers", index, "transport", "assertionHeader"], SS_M13_ASSERTION_HEADER_REFUSAL));
|
|
388
|
+
return;
|
|
415
389
|
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
390
|
+
const inert = SS_M13_INERT_KEYS.filter((k) => has(row, k));
|
|
391
|
+
if (inert.length === 0)
|
|
392
|
+
return;
|
|
393
|
+
let rewritten = row;
|
|
394
|
+
for (const k of inert) {
|
|
395
|
+
rewritten = without(rewritten, k);
|
|
396
|
+
receipts.push(receipt("SS-M13", "mcp", ["servers", index, k], "dropped-inert"));
|
|
419
397
|
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
out.prompts = next;
|
|
398
|
+
next ??= [...rows];
|
|
399
|
+
next[index] = rewritten;
|
|
400
|
+
});
|
|
401
|
+
if (next !== undefined)
|
|
402
|
+
out.mcp = { ...doc, servers: next };
|
|
426
403
|
}
|
|
@@ -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;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 包内私有(不进主桶、不进 exports 表):12.0.0 退役的**角色词**墓碑 —— 引擎 core 7.49.0 把 `team` / `synthesize` 从角色表里删了(对未知角色词响亮拒),
|
|
3
|
-
* 本包的 `ModelRole` 随之收成 6
|
|
4
|
-
*
|
|
5
|
-
* 迁移族按登记表的窗整族删,墓碑留下 —— 到那时句子里的迁移指路由删码那一车去掉(登记表 SS-M8 行的 `removal`)。
|
|
3
|
+
* 本包的 `ModelRole` 随之收成 6 词。墓碑是**拒**,不是第二种读法:判官遇到这两个词不把它们读成任何角色,只说「这是一份旧形」、没有角色读它、出路是把那个键从存储文档里删掉。
|
|
4
|
+
* 一处写词、一处写句:`ModelRole` 的判句与 `roles` 图的未知键判句都读这里。12.0.0 起存量由一次性迁移 SS-M8 删这两个键;29.0.0 起那一步随窗到期删了,墓碑留下、句子里的迁移指路随之去掉。
|
|
6
5
|
*/
|
|
7
6
|
import { retiredFormSentence } from "./retired-form.js";
|
|
8
7
|
/** 退役的角色词(闭集;逐字)。 */
|
|
9
8
|
export const RETIRED_ROLE_WORDS = ["team", "synthesize"];
|
|
10
9
|
const ROLE_WORDS_RETIRED = {
|
|
11
10
|
retiredIn: "12.0.0",
|
|
12
|
-
now: "no role reads it (core 7.49.0 removed the role and refuses the word)",
|
|
13
|
-
migration: "SS-M8",
|
|
11
|
+
now: "no role reads it (core 7.49.0 removed the role and refuses the word) — delete the key from the stored document",
|
|
14
12
|
};
|
|
15
13
|
const isRetiredRoleWord = (w) => RETIRED_ROLE_WORDS.some((r) => r === w);
|
|
16
|
-
/** 一组被判官拒下的角色键 / 角色词里若有退役词 ⇒ 那一句(
|
|
14
|
+
/** 一组被判官拒下的角色键 / 角色词里若有退役词 ⇒ 那一句(点名退役词、退役的版本与出路;同组里别的不认识的词也点名,一个不漏);没有 ⇒ `undefined`
|
|
17
15
|
* (交回 zod 自己的句子)。`ModelRole` 的判句(一个词)与 `roles` 图的未知键判句(一组键)都调这一只。 */
|
|
18
16
|
export function retiredRoleWordsRefusal(words) {
|
|
19
17
|
const retired = RETIRED_ROLE_WORDS.filter((r) => words.includes(r));
|
|
@@ -9,10 +9,13 @@ import { type SchedulerParseWarning, type SchedulerReadOptions, type SchedulerRe
|
|
|
9
9
|
*/
|
|
10
10
|
export declare function loadSchedulerStore(path: string, opts: SchedulerReadOptions): SchedulerStoreRead;
|
|
11
11
|
/**
|
|
12
|
-
* Persist ATOMICALLY:
|
|
12
|
+
* Persist ATOMICALLY: create the parent if it is missing, then the package's one atomic writer (`./atomic-write`: a uniquely-named `.tmp`
|
|
13
13
|
* sibling, then `rename` over the target — atomic on POSIX, so a concurrent reader never sees a partial file). The file mode
|
|
14
14
|
* is the `scheduler-store` class's (0o600 — owner-only, the records may carry principal/session identifiers; every save
|
|
15
|
-
* restores it).
|
|
15
|
+
* restores it). A missing parent is created by the package's one owner-only directory maker (`ensureOwnerOnlyDirectory`, the same
|
|
16
|
+
* one that creates a config root): every missing level is exactly 0o700 whatever the process umask (29.0.0; before, `mkdir -p`
|
|
17
|
+
* under the umask — 002 gave a group-writable directory, which a directory-trust check on the store's path refuses);
|
|
18
|
+
* a directory that already exists keeps its mode. Throws on IO failure (caller maps to a domain error).
|
|
16
19
|
*/
|
|
17
20
|
export declare function saveSchedulerStore(path: string, records: SchedulerRecord[]): void;
|
|
18
21
|
/** A filesystem-backed {@link SchedulerStore} bound to a path (convenience for the daemon/backend constructors).
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Store path = caller-supplied; both sides agree on `SEMA_CONFIG_DIR` → `~/.sema/scheduled_tasks.json`.
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { readFileSync } from 'node:fs';
|
|
10
10
|
import { dirname } from 'node:path';
|
|
11
|
-
import { writeFileAtomic } from './atomic-write.js';
|
|
11
|
+
import { ensureOwnerOnlyDirectory, writeFileAtomic } from './atomic-write.js';
|
|
12
12
|
import { parseSchedulerStore, serializeSchedulerStore } from './scheduler-store.js';
|
|
13
13
|
/**
|
|
14
14
|
* Load the durable store. A MISSING file (ENOENT) ⇒ no records, no warnings (first-run/never-written case); any OTHER
|
|
@@ -31,13 +31,16 @@ export function loadSchedulerStore(path, opts) {
|
|
|
31
31
|
return parseSchedulerStore(text, opts);
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
|
-
* Persist ATOMICALLY:
|
|
34
|
+
* Persist ATOMICALLY: create the parent if it is missing, then the package's one atomic writer (`./atomic-write`: a uniquely-named `.tmp`
|
|
35
35
|
* sibling, then `rename` over the target — atomic on POSIX, so a concurrent reader never sees a partial file). The file mode
|
|
36
36
|
* is the `scheduler-store` class's (0o600 — owner-only, the records may carry principal/session identifiers; every save
|
|
37
|
-
* restores it).
|
|
37
|
+
* restores it). A missing parent is created by the package's one owner-only directory maker (`ensureOwnerOnlyDirectory`, the same
|
|
38
|
+
* one that creates a config root): every missing level is exactly 0o700 whatever the process umask (29.0.0; before, `mkdir -p`
|
|
39
|
+
* under the umask — 002 gave a group-writable directory, which a directory-trust check on the store's path refuses);
|
|
40
|
+
* a directory that already exists keeps its mode. Throws on IO failure (caller maps to a domain error).
|
|
38
41
|
*/
|
|
39
42
|
export function saveSchedulerStore(path, records) {
|
|
40
|
-
|
|
43
|
+
ensureOwnerOnlyDirectory(dirname(path));
|
|
41
44
|
writeFileAtomic(path, serializeSchedulerStore(records), 'scheduler-store');
|
|
42
45
|
}
|
|
43
46
|
/** A filesystem-backed {@link SchedulerStore} bound to a path (convenience for the daemon/backend constructors).
|
package/dist/sha256.d.ts
CHANGED
|
@@ -17,5 +17,10 @@ import { z } from "zod";
|
|
|
17
17
|
export declare function sha256Hex(input: string): string;
|
|
18
18
|
/** The one spelling of a content digest on the wire: `sha256:` + 64 lowercase hex characters. */
|
|
19
19
|
export declare const SHA256_DIGEST_RE: RegExp;
|
|
20
|
+
/** The one MINT of that spelling: `sha256:` + the SHA-256 hex of the content. A string is digested as its UTF-8 encoding (the same answer as {@link sha256Hex}); a `Uint8Array` / `Buffer` is
|
|
21
|
+
* digested as the bytes it holds. For a valid UTF-8 byte sequence the two are the same digest of the same octets — but a string decoded from bytes that are not valid UTF-8 has lost them
|
|
22
|
+
* (each bad sequence became U+FFFD), so digest the bytes when the bytes are what you read. Every digest-bearing seat — a skill body (`skillContentHash`), the bytes of a `config.d` document
|
|
23
|
+
* (the expected digest of `writeDomainFileIf`) — calls this, so a reader and a writer of the same content can never spell it two ways. */
|
|
24
|
+
export declare function contentDigest(content: string | Uint8Array): string;
|
|
20
25
|
/** {@link SHA256_DIGEST_RE} as a schema —— 本包每个装 `sha256:<hex>` 摘要的座位都引它(此前五处各写一遍同一条正则)。 */
|
|
21
26
|
export declare const Sha256Digest: z.ZodString;
|
package/dist/sha256.js
CHANGED
|
@@ -20,5 +20,12 @@ export function sha256Hex(input) {
|
|
|
20
20
|
}
|
|
21
21
|
/** The one spelling of a content digest on the wire: `sha256:` + 64 lowercase hex characters. */
|
|
22
22
|
export const SHA256_DIGEST_RE = /^sha256:[0-9a-f]{64}$/;
|
|
23
|
+
/** The one MINT of that spelling: `sha256:` + the SHA-256 hex of the content. A string is digested as its UTF-8 encoding (the same answer as {@link sha256Hex}); a `Uint8Array` / `Buffer` is
|
|
24
|
+
* digested as the bytes it holds. For a valid UTF-8 byte sequence the two are the same digest of the same octets — but a string decoded from bytes that are not valid UTF-8 has lost them
|
|
25
|
+
* (each bad sequence became U+FFFD), so digest the bytes when the bytes are what you read. Every digest-bearing seat — a skill body (`skillContentHash`), the bytes of a `config.d` document
|
|
26
|
+
* (the expected digest of `writeDomainFileIf`) — calls this, so a reader and a writer of the same content can never spell it two ways. */
|
|
27
|
+
export function contentDigest(content) {
|
|
28
|
+
return `sha256:${typeof content === "string" ? sha256Hex(content) : toHex(sha256Digest(content))}`;
|
|
29
|
+
}
|
|
23
30
|
/** {@link SHA256_DIGEST_RE} as a schema —— 本包每个装 `sha256:<hex>` 摘要的座位都引它(此前五处各写一遍同一条正则)。 */
|
|
24
31
|
export const Sha256Digest = z.string().regex(SHA256_DIGEST_RE);
|
package/dist/skills-manifest.js
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* import here would leak `node:*` into the browser bundle (the review-flagged blocker). Output is byte-identical to
|
|
14
14
|
* `createHash("sha256")`, so the `sha256:<hex>` content-address the service verifies still matches.
|
|
15
15
|
*/
|
|
16
|
-
import {
|
|
16
|
+
import { contentDigest } from "./sha256.js";
|
|
17
17
|
// Memoize content→hash: the /effective poll path (toSkillsManifest) and the content-endpoint lookup
|
|
18
18
|
// (findSkillContent) re-hash the same small, stable skill bodies repeatedly (× N workers × 60s). Skill
|
|
19
19
|
// bodies are few + rarely change, so this stays tiny; a cap guards against unbounded growth.
|
|
@@ -25,7 +25,7 @@ export function skillContentHash(content) {
|
|
|
25
25
|
const hit = _hashMemo.get(content);
|
|
26
26
|
if (hit !== undefined)
|
|
27
27
|
return hit;
|
|
28
|
-
const h =
|
|
28
|
+
const h = contentDigest(content);
|
|
29
29
|
if (_hashMemo.size >= _HASH_MEMO_CAP)
|
|
30
30
|
_hashMemo.clear(); // bound — skills are few; simple evict-all is fine
|
|
31
31
|
_hashMemo.set(content, h);
|
package/dist/types.d.ts
CHANGED
|
@@ -1877,7 +1877,26 @@ export declare const McpTransport: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
1877
1877
|
url: z.ZodString;
|
|
1878
1878
|
headerRefs: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodString>, unknown>>;
|
|
1879
1879
|
principalHeader: z.ZodOptional<z.ZodString>;
|
|
1880
|
-
|
|
1880
|
+
credentials: z.ZodOptional<z.ZodPipe<z.ZodType<{
|
|
1881
|
+
readonly kind: "assertion";
|
|
1882
|
+
readonly audience: string;
|
|
1883
|
+
}, {
|
|
1884
|
+
readonly kind: "assertion";
|
|
1885
|
+
readonly audience: string;
|
|
1886
|
+
}, z.core.$ZodTypeInternals<{
|
|
1887
|
+
readonly kind: "assertion";
|
|
1888
|
+
readonly audience: string;
|
|
1889
|
+
}, {
|
|
1890
|
+
readonly kind: "assertion";
|
|
1891
|
+
readonly audience: string;
|
|
1892
|
+
}>>, z.ZodTransform<{
|
|
1893
|
+
readonly kind: "assertion";
|
|
1894
|
+
readonly audience: string;
|
|
1895
|
+
}, {
|
|
1896
|
+
readonly kind: "assertion";
|
|
1897
|
+
readonly audience: string;
|
|
1898
|
+
}>>>;
|
|
1899
|
+
assertionHeader: z.ZodOptional<z.ZodNever>;
|
|
1881
1900
|
}, z.core.$strip>], "kind">;
|
|
1882
1901
|
export type McpTransport = z.infer<typeof McpTransport>;
|
|
1883
1902
|
/** The closed word table for {@link McpServerSpec}.contentOrigin — a MIRROR literal of the engine's
|
|
@@ -1899,7 +1918,26 @@ export declare const McpServerSpec: z.ZodObject<{
|
|
|
1899
1918
|
url: z.ZodString;
|
|
1900
1919
|
headerRefs: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodString>, unknown>>;
|
|
1901
1920
|
principalHeader: z.ZodOptional<z.ZodString>;
|
|
1902
|
-
|
|
1921
|
+
credentials: z.ZodOptional<z.ZodPipe<z.ZodType<{
|
|
1922
|
+
readonly kind: "assertion";
|
|
1923
|
+
readonly audience: string;
|
|
1924
|
+
}, {
|
|
1925
|
+
readonly kind: "assertion";
|
|
1926
|
+
readonly audience: string;
|
|
1927
|
+
}, z.core.$ZodTypeInternals<{
|
|
1928
|
+
readonly kind: "assertion";
|
|
1929
|
+
readonly audience: string;
|
|
1930
|
+
}, {
|
|
1931
|
+
readonly kind: "assertion";
|
|
1932
|
+
readonly audience: string;
|
|
1933
|
+
}>>, z.ZodTransform<{
|
|
1934
|
+
readonly kind: "assertion";
|
|
1935
|
+
readonly audience: string;
|
|
1936
|
+
}, {
|
|
1937
|
+
readonly kind: "assertion";
|
|
1938
|
+
readonly audience: string;
|
|
1939
|
+
}>>>;
|
|
1940
|
+
assertionHeader: z.ZodOptional<z.ZodNever>;
|
|
1903
1941
|
}, z.core.$strip>], "kind">;
|
|
1904
1942
|
allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1905
1943
|
scenarios: z.ZodPrefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1916,8 +1954,6 @@ export declare const McpServerSpec: z.ZodObject<{
|
|
|
1916
1954
|
source: z.ZodOptional<z.ZodUnknown>;
|
|
1917
1955
|
toolFaces: z.ZodOptional<z.ZodUnknown>;
|
|
1918
1956
|
toolAxes: z.ZodOptional<z.ZodUnknown>;
|
|
1919
|
-
authForm: z.ZodOptional<z.ZodUnknown>;
|
|
1920
|
-
entryKind: z.ZodOptional<z.ZodUnknown>;
|
|
1921
1957
|
notes: z.ZodOptional<z.ZodString>;
|
|
1922
1958
|
}, z.core.$strip>;
|
|
1923
1959
|
export type McpServerSpec = z.infer<typeof McpServerSpec>;
|
|
@@ -1934,7 +1970,26 @@ export declare const McpConfig: z.ZodObject<{
|
|
|
1934
1970
|
url: z.ZodString;
|
|
1935
1971
|
headerRefs: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodString>, unknown>>;
|
|
1936
1972
|
principalHeader: z.ZodOptional<z.ZodString>;
|
|
1937
|
-
|
|
1973
|
+
credentials: z.ZodOptional<z.ZodPipe<z.ZodType<{
|
|
1974
|
+
readonly kind: "assertion";
|
|
1975
|
+
readonly audience: string;
|
|
1976
|
+
}, {
|
|
1977
|
+
readonly kind: "assertion";
|
|
1978
|
+
readonly audience: string;
|
|
1979
|
+
}, z.core.$ZodTypeInternals<{
|
|
1980
|
+
readonly kind: "assertion";
|
|
1981
|
+
readonly audience: string;
|
|
1982
|
+
}, {
|
|
1983
|
+
readonly kind: "assertion";
|
|
1984
|
+
readonly audience: string;
|
|
1985
|
+
}>>, z.ZodTransform<{
|
|
1986
|
+
readonly kind: "assertion";
|
|
1987
|
+
readonly audience: string;
|
|
1988
|
+
}, {
|
|
1989
|
+
readonly kind: "assertion";
|
|
1990
|
+
readonly audience: string;
|
|
1991
|
+
}>>>;
|
|
1992
|
+
assertionHeader: z.ZodOptional<z.ZodNever>;
|
|
1938
1993
|
}, z.core.$strip>], "kind">;
|
|
1939
1994
|
allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
1940
1995
|
scenarios: z.ZodPrefault<z.ZodArray<z.ZodString>>;
|
|
@@ -1951,8 +2006,6 @@ export declare const McpConfig: z.ZodObject<{
|
|
|
1951
2006
|
source: z.ZodOptional<z.ZodUnknown>;
|
|
1952
2007
|
toolFaces: z.ZodOptional<z.ZodUnknown>;
|
|
1953
2008
|
toolAxes: z.ZodOptional<z.ZodUnknown>;
|
|
1954
|
-
authForm: z.ZodOptional<z.ZodUnknown>;
|
|
1955
|
-
entryKind: z.ZodOptional<z.ZodUnknown>;
|
|
1956
2009
|
notes: z.ZodOptional<z.ZodString>;
|
|
1957
2010
|
}, z.core.$strip>>>;
|
|
1958
2011
|
}, z.core.$strip>;
|
|
@@ -2575,7 +2628,26 @@ export declare const DOMAIN_SCHEMAS: {
|
|
|
2575
2628
|
url: z.ZodString;
|
|
2576
2629
|
headerRefs: z.ZodOptional<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodString>, unknown>>;
|
|
2577
2630
|
principalHeader: z.ZodOptional<z.ZodString>;
|
|
2578
|
-
|
|
2631
|
+
credentials: z.ZodOptional<z.ZodPipe<z.ZodType<{
|
|
2632
|
+
readonly kind: "assertion";
|
|
2633
|
+
readonly audience: string;
|
|
2634
|
+
}, {
|
|
2635
|
+
readonly kind: "assertion";
|
|
2636
|
+
readonly audience: string;
|
|
2637
|
+
}, z.core.$ZodTypeInternals<{
|
|
2638
|
+
readonly kind: "assertion";
|
|
2639
|
+
readonly audience: string;
|
|
2640
|
+
}, {
|
|
2641
|
+
readonly kind: "assertion";
|
|
2642
|
+
readonly audience: string;
|
|
2643
|
+
}>>, z.ZodTransform<{
|
|
2644
|
+
readonly kind: "assertion";
|
|
2645
|
+
readonly audience: string;
|
|
2646
|
+
}, {
|
|
2647
|
+
readonly kind: "assertion";
|
|
2648
|
+
readonly audience: string;
|
|
2649
|
+
}>>>;
|
|
2650
|
+
assertionHeader: z.ZodOptional<z.ZodNever>;
|
|
2579
2651
|
}, z.core.$strip>], "kind">;
|
|
2580
2652
|
allowTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
2581
2653
|
scenarios: z.ZodPrefault<z.ZodArray<z.ZodString>>;
|
|
@@ -2592,8 +2664,6 @@ export declare const DOMAIN_SCHEMAS: {
|
|
|
2592
2664
|
source: z.ZodOptional<z.ZodUnknown>;
|
|
2593
2665
|
toolFaces: z.ZodOptional<z.ZodUnknown>;
|
|
2594
2666
|
toolAxes: z.ZodOptional<z.ZodUnknown>;
|
|
2595
|
-
authForm: z.ZodOptional<z.ZodUnknown>;
|
|
2596
|
-
entryKind: z.ZodOptional<z.ZodUnknown>;
|
|
2597
2667
|
notes: z.ZodOptional<z.ZodString>;
|
|
2598
2668
|
}, z.core.$strip>>>;
|
|
2599
2669
|
}, z.core.$strip>;
|