@sema-agent/settings-schema 7.0.0 → 8.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 +173 -1
- package/README.md +47 -5
- package/conformance/VERSION +1 -1
- package/conformance/cases/c01-entry-salvage-then-typo/expected.json +5 -0
- package/conformance/cases/c02-hosts-clamp-stacked/expected.json +5 -0
- package/conformance/cases/c03-literal-dotted-top-key/expected.json +41 -0
- package/conformance/cases/c04-all-bad-collection-not-salvaged/expected.json +5 -0
- package/conformance/cases/c05-gate-domain-bad-entry-throws/expected.json +5 -0
- package/conformance/cases/c06-legacy-governance-lift/expected.json +12 -0
- package/conformance/cases/c07-hooks-is-not-a-config-domain/expected.json +5 -0
- package/conformance/cases/c08-limits-unknown-carried-64/expected.json +77 -0
- package/conformance/cases/c09-limits-unknown-carried-65/expected.json +78 -0
- package/conformance/cases/c10-record-key-secret-redacted-twice/expected.json +5 -0
- package/conformance/cases/c11-unicode-unknown-keys/expected.json +14 -0
- package/conformance/cases/c12-prototype-name-top-keys/expected.json +5 -0
- package/conformance/cases/c13-models-field-null/expected.json +5 -0
- package/conformance/cases/c14-models-field-empty-array/expected.json +16 -0
- package/conformance/cases/c15-models-field-number/expected.json +5 -0
- package/conformance/cases/c16-deep-nesting-205/expected.json +14 -0
- package/conformance/cases/c17-empty-domain-file/expected.json +10 -0
- package/conformance/cases/c18-wire-envelope-not-an-object/expected.json +10 -0
- package/conformance/cases/c19-wire-envelope-no-version/expected.json +10 -0
- package/conformance/cases/c20-governance-absent-lifts/expected.json +12 -0
- package/conformance/cases/c21-governance-empty-object-wins/expected.json +13 -0
- package/conformance/cases/c22-governance-null-throws/expected.json +5 -0
- package/conformance/cases/c23-mixed-validity-models/expected.json +5 -0
- package/conformance/cases/c24-valid-entries-with-unknown-keys/expected.json +29 -0
- package/conformance/cases/c25-published-roundtrip-zero-warnings/expected.json +33 -0
- package/conformance/cases/c26-hosts-array-1024/expected.json +7183 -0
- package/conformance/cases/c27-hosts-array-1025/expected.json +5 -0
- package/conformance/cases/c28-large-document-over-1mb/expected.json +14 -0
- package/conformance/cases/c29-salvage-then-domain-refine-fails/expected.json +5 -0
- package/conformance/cases/c30-version-triple-a-first/expected.json +29 -0
- package/conformance/cases/c31-version-triple-b-changed/expected.json +29 -0
- package/conformance/cases/c32-version-triple-a-restored/expected.json +29 -0
- package/conformance/cases/c33-limits-nested-carried-key/expected.json +17 -0
- package/conformance/cases/c34-skills-content-vs-manifest/expected.json +23 -0
- package/conformance/cases/c35-portable-domain-file-is-null/expected.json +5 -0
- package/conformance/cases/c36-skills-entry-without-content/expected.json +23 -0
- package/conformance/cases/c37-skills-field-null/expected.json +5 -0
- package/conformance/cases/c38-remote-exec-is-a-non-domain-file/expected.json +5 -0
- package/conformance/cases/c39-hidden-file-in-config-d/expected.json +5 -0
- package/conformance/cases/c40-s712-identity-only-what-reads-out/expected.json +5 -0
- package/conformance/cases/c41-s792-encoded-pem-identity/expected.json +5 -0
- package/conformance/cases/c42-s792-unknown-key-secret-redacted/expected.json +33 -0
- package/conformance/cases/c43-s792-form-and-deep-encoded-pem/expected.json +5 -0
- package/conformance/cases/c44-s792-utf8-escape-glued-token/expected.json +5 -0
- package/conformance/cases/c45-s792-identity-bounds-and-decode-depth/expected.json +5 -0
- package/conformance/cases/c46-s811-host-name-url-userinfo-characterization/expected.json +5 -0
- package/conformance/cases/c47-s811-roles-key-url-userinfo-characterization/expected.json +5 -0
- package/conformance/cases/c48-s935-model-headers-transported/expected.json +59 -0
- package/conformance/cases/c49-s935-model-headers-secret-entry-dropped/expected.json +5 -0
- package/conformance/cases/c50-s784-lane-host-legal/expected.json +44 -0
- package/conformance/cases/c51-s784-lane-e2b-legal/expected.json +46 -0
- package/conformance/cases/c52-s784-lane-k8s-legal/expected.json +48 -0
- package/conformance/cases/c53-s784-lane-ssh-legal/expected.json +48 -0
- package/conformance/cases/c54-s784-lane-adb-legal/expected.json +44 -0
- package/conformance/cases/c55-s784-lane-local-docker-legal/expected.json +45 -0
- package/conformance/cases/c56-s784-lane-device-legal/expected.json +51 -0
- package/conformance/cases/c57-s784-g1-enabled-no-lane/expected.json +5 -0
- package/conformance/cases/c58-s784-g2-multitenant-host/expected.json +5 -0
- package/conformance/cases/c59-s784-g3-k8s-missing-image/expected.json +5 -0
- package/conformance/cases/c60-s784-g3-e2b-missing-key/expected.json +5 -0
- package/conformance/cases/c61-s784-g3-other-lane-key/expected.json +5 -0
- package/conformance/cases/c62-s784-g7a-session-tidb/expected.json +5 -0
- package/conformance/cases/c63-s784-host-two-replicas/expected.json +5 -0
- package/conformance/cases/c64-s784-multitenant-local-store/expected.json +5 -0
- package/conformance/cases/c65-s784-pg-without-db/expected.json +5 -0
- package/conformance/cases/c66-s784-memory-backend-mismatch/expected.json +5 -0
- package/conformance/cases/c67-s784-retired-field-loud/expected.json +5 -0
- package/conformance/cases/c67-s784-retired-field-loud/meta.json +1 -1
- package/conformance/cases/c68-s784-device-local-store/expected.json +5 -0
- package/conformance/cases/cc01-mcp-toolfaces-non-object/expected.json +54 -0
- package/conformance/cases/cc02-mcp-source-key-is-transported/expected.json +27 -0
- package/conformance/cases/cc03-model-compat-unknown-subkey/expected.json +33 -0
- package/conformance/cases/cli01-model-name-nfc-vs-nfd/expected.json +5 -0
- package/conformance/cases/cli02-control-and-zero-width-chars/expected.json +5 -0
- package/conformance/cases/cli03-credential-pasted-into-unknown-key/expected.json +22 -0
- package/conformance/cases/cli04-env-value-with-newline/expected.json +46 -0
- package/conformance/cases/cli05-long-and-prefix-colliding-names/expected.json +53 -0
- package/conformance/cases/t01-absent-domain-key-not-null/expected.json +5 -0
- package/conformance/cases/t02-entry-salvage-vs-whole-domain-refusal/expected.json +5 -0
- package/conformance/cases/t03-prototype-name-key-not-swallowed/expected.json +29 -0
- package/conformance/cases/t04-secret-literal-never-in-warning-value/expected.json +5 -0
- package/conformance/cases/z01-every-domain-empty-object/expected.json +64 -0
- package/conformance/cases/z02-every-domain-unknown-key/expected.json +66 -0
- package/dist/cli.js +97 -25
- package/dist/config-fns.js +7 -1
- package/dist/conformance/contract-adapter.d.ts +4 -2
- package/dist/conformance/contract-adapter.js +21 -7
- package/dist/conformance/corpus.js +12 -7
- package/dist/conformance/derive.d.ts +26 -0
- package/dist/conformance/derive.js +25 -2
- package/dist/conformance/index.d.ts +4 -3
- package/dist/conformance/index.js +4 -3
- package/dist/conformance/run.d.ts +3 -3
- package/dist/conformance/run.js +87 -17
- package/dist/conformance/types.d.ts +57 -17
- package/dist/conformance/types.js +4 -2
- package/dist/execution-lane-index.d.ts +20 -1
- package/dist/execution-lane-index.js +24 -1
- package/dist/hooks.d.ts +4 -4
- package/dist/migrate-workers.d.ts +1 -1
- package/dist/migrate-workers.js +3 -7
- package/dist/types.js +13 -4
- package/package.json +2 -1
package/dist/types.js
CHANGED
|
@@ -20,7 +20,7 @@ import { MAX_EXTRA_BODY_DEPTH } from "./hash.js"; // reconcile the extraBody dep
|
|
|
20
20
|
import { DispatchPolicy } from "./fleet.js"; // WorkerSpec.fleet.dispatch (scheduling framework D3)
|
|
21
21
|
import { carriesUserinfo, percentLayers } from "./secret-scan.js"; // package-private normalization + the userinfo judgement (not in the barrel)
|
|
22
22
|
import { EXECUTION_LANES, EXECUTION_LANE_WORDS, MEMORY_ENGINE_BACKENDS, SESSION_BACKENDS, STORE_BACKENDS } from "./execution-lanes.js"; // 7.0.0 M-R2: the lane / store vocabulary (one exported table)
|
|
23
|
-
import { LANE_ENV_OWNER, laneEnvSeat, laneRowOf } from "./execution-lane-index.js"; // package-private indexes derived from that table (not in the barrel)
|
|
23
|
+
import { LANE_ENV_OWNER, MIGRATION_SIGNPOST, isMigratableEnvKey, laneEnvSeat, laneRowOf } from "./execution-lane-index.js"; // package-private indexes derived from that table (not in the barrel)
|
|
24
24
|
// COARSE, best-effort literal-secret SHAPE detector (NOT exhaustive — the real boundary is the env-NAME schema
|
|
25
25
|
// on structured fields). Rejected in free-form value fields (worker `env`, model `extraBody`), URL components,
|
|
26
26
|
// AND as an env-NAME value (an AWS key id is a valid env-NAME charset yet is a secret VALUE, not a NAME). Case-
|
|
@@ -1575,6 +1575,15 @@ const RESERVED_ENV_FIELD = Object.freeze({
|
|
|
1575
1575
|
/** 结构化 WorkerSpec 字段已经产出的 env 名 —— 通用 `env` / `secretEnv` 逃生口**不许**设它们(用专属字段)。由
|
|
1576
1576
|
* `RESERVED_ENV_FIELD`(名 → 唯一写位)的键派生;增删理由见那张表的头注。 */
|
|
1577
1577
|
export const RESERVED_WORKER_ENV = new Set(Object.keys(RESERVED_ENV_FIELD));
|
|
1578
|
+
/**
|
|
1579
|
+
* 保留名被 `env` / `secretEnv` 逃生口设置时的拒因:点名键 + 它的唯一写位。句尾恒是「set it via <字段>」(下游按它抽归属字段,不动)。
|
|
1580
|
+
* **迁移指路只有一条规则(7.0.1)**:这个键「旧形 ⇒ 迁移能搬」({@link isMigratableEnvKey},与迁移自己识别的键集同一只谓词)就在键名后
|
|
1581
|
+
* 带 {@link MIGRATION_SIGNPOST};搬不了的保留名(`PORT` / `MODEL_*` / `MYSQL_*` …)不带 —— 指一条跑了也没用的命令比不指更糟。
|
|
1582
|
+
*/
|
|
1583
|
+
function reservedKeyMessage(slot, key) {
|
|
1584
|
+
const signpost = isMigratableEnvKey(key) ? ` (${MIGRATION_SIGNPOST})` : "";
|
|
1585
|
+
return `${slot} cannot set reserved key "${key}"${signpost} — set it via ${RESERVED_ENV_FIELD[key]}`;
|
|
1586
|
+
}
|
|
1578
1587
|
// ── 7.0.0 M-R2:`runtime.execution` / `runtime.store` 两个结构块 ─────────────────────────────────────────────
|
|
1579
1588
|
// 词表只有一个正本(`execution-lanes.ts` 的导出表):本包写闸(`WorkerSpec.safeParse`)、中心渲染器、引擎起服三处读同一张表。
|
|
1580
1589
|
// 拒因都在 zod issue 里(`path` 指到要改的字段、`message` 带出路)—— schema 本身是唯一判据,不另导出拒因函数。
|
|
@@ -1692,7 +1701,7 @@ function retiredWorkerFieldIssues(raw, ctx) {
|
|
|
1692
1701
|
ctx.addIssue({
|
|
1693
1702
|
code: z.ZodIssueCode.custom,
|
|
1694
1703
|
path: [parent, key],
|
|
1695
|
-
message: `${parent}.${key} was removed in 7.0.0 (now ${now}) —
|
|
1704
|
+
message: `${parent}.${key} was removed in 7.0.0 (now ${now}) — ${MIGRATION_SIGNPOST}`,
|
|
1696
1705
|
});
|
|
1697
1706
|
}
|
|
1698
1707
|
}
|
|
@@ -1798,7 +1807,7 @@ const WorkerSpecObject = z.object({
|
|
|
1798
1807
|
.superRefine((rec, ctx) => {
|
|
1799
1808
|
for (const [k, v] of Object.entries(rec)) {
|
|
1800
1809
|
if (RESERVED_WORKER_ENV.has(k))
|
|
1801
|
-
ctx.addIssue({ code: "custom", message:
|
|
1810
|
+
ctx.addIssue({ code: "custom", message: reservedKeyMessage("env", k) });
|
|
1802
1811
|
// 0.1.32: NO name exemption — a PUBLIC key is allowed because SECRET_LITERAL_RE now only flags PRIVATE keys
|
|
1803
1812
|
// (root fix), so a literal private key / token in env (ANY name, incl `*_PUBKEY`) is still rejected.
|
|
1804
1813
|
if (containsSecretToken(v))
|
|
@@ -1817,7 +1826,7 @@ const WorkerSpecObject = z.object({
|
|
|
1817
1826
|
.superRefine((rec, ctx) => {
|
|
1818
1827
|
for (const k of Object.keys(rec))
|
|
1819
1828
|
if (RESERVED_WORKER_ENV.has(k))
|
|
1820
|
-
ctx.addIssue({ code: "custom", message:
|
|
1829
|
+
ctx.addIssue({ code: "custom", message: reservedKeyMessage("secretEnv", k) });
|
|
1821
1830
|
})
|
|
1822
1831
|
.optional(),
|
|
1823
1832
|
/** Opaque recreate trigger (hash-INCLUDED): bump it to force the reconciler to recreate the worker — e.g. to
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sema-agent/settings-schema",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "8.0.0",
|
|
4
4
|
"description": "Sema settings schema — pure config contract (zod domains + effective-config + roster resolution + ref-integrity + remoteExec) shared by sema-registry, sema-server, and the TOC desktop/CLI. One source of truth. (Renamed at 1.0.0 from @sema-agent/registry-core — name and docs only, no behavior change; note the range moves 0.19.0 -> 1.0.0, so a dependency must become ^1.0.0. The old names @sema-agent/registry-core <=0.19.0 and @sema-ai/registry-core remain published, frozen, for migration.)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "BUSL-1.1",
|
|
@@ -131,6 +131,7 @@
|
|
|
131
131
|
"drift:cc": "node scripts/extract-cc-hook-events.mjs",
|
|
132
132
|
"conformance:bless": "node scripts/gen-conformance.mjs",
|
|
133
133
|
"conformance:historical": "node scripts/conformance-historical.mjs",
|
|
134
|
+
"api:surface": "node scripts/api-surface.mjs",
|
|
134
135
|
"prepare": "npm run build",
|
|
135
136
|
"prepublishOnly": "npm run build && npm run test",
|
|
136
137
|
"publish:npm": "npm publish --access public --@sema-agent:registry=https://registry.npmjs.org/ --\"//registry.npmjs.org/:_authToken=${NPM_TOKEN}\""
|