@sema-agent/settings-schema 14.7.0 → 15.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +306 -0
  2. package/README.md +80 -3
  3. package/conformance/VERSION +1 -1
  4. package/conformance/cases/c59-s784-g3-k8s-missing-image/input.json +4 -1
  5. package/conformance/cases/c61-s784-g3-other-lane-key/input.json +1 -0
  6. package/conformance/cases/c64-s784-multitenant-local-store/input.json +2 -1
  7. package/dist/atomic-write.d.ts +15 -0
  8. package/dist/atomic-write.js +109 -5
  9. package/dist/catalog-manages.d.ts +15 -0
  10. package/dist/catalog-manages.js +60 -0
  11. package/dist/center-refs.d.ts +68 -0
  12. package/dist/center-refs.js +70 -0
  13. package/dist/config-dir-migration.js +1 -0
  14. package/dist/config-fns.js +5 -3
  15. package/dist/config-root-documents.d.ts +106 -0
  16. package/dist/config-root-documents.js +93 -0
  17. package/dist/config-root-node.d.ts +117 -0
  18. package/dist/config-root-node.js +260 -0
  19. package/dist/conformance/run.d.ts +3 -0
  20. package/dist/conformance/run.js +10 -6
  21. package/dist/conformance/temp-roots.d.ts +31 -0
  22. package/dist/conformance/temp-roots.js +184 -0
  23. package/dist/default-model.d.ts +1 -1
  24. package/dist/default-model.js +5 -4
  25. package/dist/env-model-table.d.ts +163 -0
  26. package/dist/env-model-table.js +257 -0
  27. package/dist/execution-lane-index.d.ts +6 -0
  28. package/dist/execution-lane-index.js +8 -0
  29. package/dist/execution-lanes.d.ts +2 -1
  30. package/dist/execution-lanes.js +6 -4
  31. package/dist/fleet.d.ts +25 -7
  32. package/dist/fleet.js +24 -6
  33. package/dist/index.d.ts +5 -0
  34. package/dist/index.js +5 -0
  35. package/dist/mcp-request-entry.d.ts +58 -6
  36. package/dist/mcp-request-entry.js +45 -13
  37. package/dist/mcp-server-name.d.ts +17 -0
  38. package/dist/mcp-server-name.js +19 -0
  39. package/dist/migration-receipt.d.ts +10 -6
  40. package/dist/migration-receipt.js +5 -3
  41. package/dist/node.d.ts +1 -0
  42. package/dist/node.js +2 -0
  43. package/dist/one-time-migrations.d.ts +4 -2
  44. package/dist/one-time-migrations.js +29 -1
  45. package/dist/own-key-read.d.ts +1 -1
  46. package/dist/remote-exec.d.ts +1 -1
  47. package/dist/remote-exec.js +4 -2
  48. package/dist/retired-form.d.ts +19 -0
  49. package/dist/retired-form.js +24 -1
  50. package/dist/safety-merge-spec.d.ts +6 -6
  51. package/dist/tier-words.d.ts +33 -0
  52. package/dist/tier-words.js +43 -0
  53. package/dist/types.d.ts +6 -0
  54. package/dist/types.js +29 -5
  55. package/dist/worker-row-verdict.js +7 -1
  56. package/docs/API-SURFACE.md +68 -4
  57. package/docs/CONSUMER-INTEGRATION.md +72 -2
  58. package/llms-full.txt +8 -3
  59. package/llms.txt +9 -3
  60. package/package.json +2 -2
@@ -22,6 +22,12 @@ export interface LaneEnvOwner {
22
22
  }
23
23
  /** 车道 env 名 → 归属。四栏两两不交、跨车道不交(`test/execution-lanes-7.0.0.test.ts` 钉),所以每个名恰好一个归属。 */
24
24
  export declare const LANE_ENV_OWNER: ReadonlyMap<string, LaneEnvOwner>;
25
+ /**
26
+ * 必需坐标的值算不算「缺」的**唯一判官**:空串,或只含空白(`String.prototype.trim` 认的空白:空格 / 制表 / 换行 / 不换行空格 / 字节序标记 …),都按缺席论。
27
+ * 写闸对所有车道、所有必需坐标同判这一只;它只判「是不是空白」,不 trim 值、不管值的格式(格式不在这一条的范围)。可选坐标不走它 ——
28
+ * 个别可选坐标上空串有语义(如 `K8S_RUNTIME_CLASS` 的空串 = 不用 Kata)。
29
+ */
30
+ export declare function isBlankCoordinate(value: string): boolean;
25
31
  /** 一个车道 env 名在 WorkerSpec 里的**唯一写位**(保留键的拒因指路用它)。 */
26
32
  export declare function laneEnvSeat(name: string, owner: LaneEnvOwner): string;
27
33
  /** 车道块的两个特殊键(不在车道表里,但归车道块:迁移把 `REMOTE_EXEC` 搬成 `runtime.execution.lane`、`REQUIRE_EXECUTION_LANE` 丢弃)。 */
@@ -24,6 +24,14 @@ export const LANE_ENV_OWNER = new Map(EXECUTION_LANES.flatMap((r) => {
24
24
  const own = (names, secret, required) => names.map((k) => [k, { lane: r.lane, secret, required }]);
25
25
  return [...own(r.requiredEnv, false, true), ...own(r.optionalEnv, false, false), ...own(r.requiredSecretEnv, true, true), ...own(r.optionalSecretEnv, true, false)];
26
26
  }));
27
+ /**
28
+ * 必需坐标的值算不算「缺」的**唯一判官**:空串,或只含空白(`String.prototype.trim` 认的空白:空格 / 制表 / 换行 / 不换行空格 / 字节序标记 …),都按缺席论。
29
+ * 写闸对所有车道、所有必需坐标同判这一只;它只判「是不是空白」,不 trim 值、不管值的格式(格式不在这一条的范围)。可选坐标不走它 ——
30
+ * 个别可选坐标上空串有语义(如 `K8S_RUNTIME_CLASS` 的空串 = 不用 Kata)。
31
+ */
32
+ export function isBlankCoordinate(value) {
33
+ return value.trim() === "";
34
+ }
27
35
  /** 一个车道 env 名在 WorkerSpec 里的**唯一写位**(保留键的拒因指路用它)。 */
28
36
  export function laneEnvSeat(name, owner) {
29
37
  return `runtime.execution.${owner.secret ? "secretRefs" : "coords"}.${name}`;
@@ -17,7 +17,8 @@
17
17
  * · `tenantSeparation`:同文件 `executionLaneCaps` 每臂的 `tenantSeparation` 位(:209 host / :230 e2b / :249 k8s /
18
18
  * :269 ssh / :288 adb / :308 local-docker / :327 device)。`tenantSeparationBasis`(11.0.0):分租户的那几臂凭什么分 ——
19
19
  * e2b / k8s / local-docker 每任务一只隔离目标(`isolation`),device 是发起者自己的设备(`principal-binding`)。
20
- * · `requiredEnv ∪ requiredSecretEnv`:`src/config.ts` `REQUIRED_ENVS_BY_LANE`(:1054)逐字;按 `src/config-catalog.ts`
20
+ * · `requiredEnv ∪ requiredSecretEnv`:这条车道缺了就起不了服的键。最初逐字抄自 `src/config.ts` 的手写表 `REQUIRED_ENVS_BY_LANE`(:1054),
21
+ * 那张手写表已退役 —— 服务端的必需 env 门按本表行的这两栏拒启,部署面的车道清单读同一行,所以今天**本表就是**必需键的唯一来源。按 `src/config-catalog.ts`
21
22
  * 该键那一行的值类型分栏 —— 类型 `secret` / `opaque`(目录自己「绝不回显值」的两类)进 `*SecretEnv`,其余进 `*Env`。
22
23
  * · `optionalEnv ∪ optionalSecretEnv`:`src/config.ts` `parseOrchestrationDomain` 的 `REMOTE_EXEC` 三元链里**该车道那一臂**
23
24
  * 读的 env 名(:3925 e2b / :3957 k8s / :3991 ssh / :4006 adb / :4014 host / :4026 local-docker / :4055 device;
@@ -17,7 +17,8 @@
17
17
  * · `tenantSeparation`:同文件 `executionLaneCaps` 每臂的 `tenantSeparation` 位(:209 host / :230 e2b / :249 k8s /
18
18
  * :269 ssh / :288 adb / :308 local-docker / :327 device)。`tenantSeparationBasis`(11.0.0):分租户的那几臂凭什么分 ——
19
19
  * e2b / k8s / local-docker 每任务一只隔离目标(`isolation`),device 是发起者自己的设备(`principal-binding`)。
20
- * · `requiredEnv ∪ requiredSecretEnv`:`src/config.ts` `REQUIRED_ENVS_BY_LANE`(:1054)逐字;按 `src/config-catalog.ts`
20
+ * · `requiredEnv ∪ requiredSecretEnv`:这条车道缺了就起不了服的键。最初逐字抄自 `src/config.ts` 的手写表 `REQUIRED_ENVS_BY_LANE`(:1054),
21
+ * 那张手写表已退役 —— 服务端的必需 env 门按本表行的这两栏拒启,部署面的车道清单读同一行,所以今天**本表就是**必需键的唯一来源。按 `src/config-catalog.ts`
21
22
  * 该键那一行的值类型分栏 —— 类型 `secret` / `opaque`(目录自己「绝不回显值」的两类)进 `*SecretEnv`,其余进 `*Env`。
22
23
  * · `optionalEnv ∪ optionalSecretEnv`:`src/config.ts` `parseOrchestrationDomain` 的 `REMOTE_EXEC` 三元链里**该车道那一臂**
23
24
  * 读的 env 名(:3925 e2b / :3957 k8s / :3991 ssh / :4006 adb / :4014 host / :4026 local-docker / :4055 device;
@@ -71,16 +72,17 @@ const LANE_ROWS = {
71
72
  optionalSecretEnv: ["E2B_SANDBOX_ENV"],
72
73
  },
73
74
  /** server `config.ts` :3957 臂;`K8S_TOKEN` 目录 :412 类型 `secret`、`K8S_CA_CERT_B64` :403 类型 `opaque`;
74
- * `execution-lane-caps.ts` :249 `supported`(每任务一只 pod)。`MINIO_*` 刻意不收(见文件头)。 */
75
+ * `execution-lane-caps.ts` :249 `supported`(每任务一只 pod)。`MINIO_*` 刻意不收(见文件头)。
76
+ * `K8S_NAMESPACE`(沙箱 pod 所在的命名空间)是**必需**坐标:pod 住哪是部署自己的声明,表不替它留缺省;服务端的必需 env 门按本行 `requiredEnv` 拒启,
77
+ * 所以这里没有「可选」一说。 */
75
78
  k8s: {
76
79
  tenantSeparation: "supported",
77
80
  tenantSeparationBasis: "isolation",
78
- requiredEnv: ["K8S_SANDBOX_IMAGE"],
81
+ requiredEnv: ["K8S_SANDBOX_IMAGE", "K8S_NAMESPACE"],
79
82
  requiredSecretEnv: [],
80
83
  optionalEnv: [
81
84
  "K8S_API_URL",
82
85
  "K8S_INSECURE_TLS",
83
- "K8S_NAMESPACE",
84
86
  "K8S_RUNTIME_CLASS",
85
87
  "K8S_MOUNT_PATH",
86
88
  "K8S_TIMEOUT_MS",
package/dist/fleet.d.ts CHANGED
@@ -163,9 +163,15 @@ export type RestartSignal = z.infer<typeof RestartSignal>;
163
163
  * `config.model_refused_name_minted` — a refused entry's name would be re-minted onto another entry by the
164
164
  * tier / alias expansion (or the dropped-entry carrier cannot prove it would not be);
165
165
  * `config.model_route_endpoint_missing` — an openai-compatible route of the candidate resolves to no endpoint;
166
- * `config.gateway_fallback_without_primary` — fallback gateways are declared without a primary.
167
- * Source (engine): the first two in `src/model-entry-refusal.ts`, the last two in `src/model-route-endpoint.ts:40,42`
168
- * (invariant `model-route-endpoint`, judged by the model-plane stage in `src/config-center/apply-effective.ts:664-665`).
166
+ * `config.gateway_fallback_without_primary` — fallback gateways are declared without a primary;
167
+ * `config.catalog_replaces_env_models` ({@link CATALOG_REPLACES_ENV_MODELS_CODE}) — on the LOCAL config leg, a candidate that
168
+ * manages the model plane would replace a declared env model table (`MODEL_ID` …) while the config root's decision document
169
+ * (`config.env-models.json`, read by `readEnvModelsDecision`) does not say `replaced` — the env models keep serving;
170
+ * `config.summarize_model_missing` ({@link SUMMARIZE_MODEL_MISSING_CODE}) — the summarize role, which every task resolves,
171
+ * would land on no servable entry (every task would be refused after adoption).
172
+ * Source (engine): the first two in `src/model-entry-refusal.ts`, the next two in `src/model-route-endpoint.ts:40,42`
173
+ * (invariant `model-route-endpoint`, judged by the model-plane stage in `src/config-center/apply-effective.ts:664-665`); the
174
+ * last two are named HERE first (the code is a contract word: this package names it and exports the two constants for the engine to read; the engine does not mint them today).
169
175
  */
170
176
  export declare const MODEL_ENTRY_REFUSAL_CODES: readonly ["config.model_no_brain", "config.model_entry_invalid"];
171
177
  export declare const ModelEntryRefusalCode: z.ZodEnum<{
@@ -173,8 +179,14 @@ export declare const ModelEntryRefusalCode: z.ZodEnum<{
173
179
  "config.model_entry_invalid": "config.model_entry_invalid";
174
180
  }>;
175
181
  export type ModelEntryRefusalCode = z.infer<typeof ModelEntryRefusalCode>;
176
- export declare const MODEL_PLANE_REFUSAL_CODES: readonly ["config.default_model_missing", "config.model_refused_name_minted", "config.model_route_endpoint_missing", "config.gateway_fallback_without_primary"];
182
+ /** The env-model-table confirmation gate's group-refusal code (see {@link MODEL_PLANE_REFUSAL_CODES}). */
183
+ export declare const CATALOG_REPLACES_ENV_MODELS_CODE: "config.catalog_replaces_env_models";
184
+ /** The summarize invariant's group-refusal code (see {@link MODEL_PLANE_REFUSAL_CODES}); a writer's plan answers `fix_first` with it. */
185
+ export declare const SUMMARIZE_MODEL_MISSING_CODE: "config.summarize_model_missing";
186
+ export declare const MODEL_PLANE_REFUSAL_CODES: readonly ["config.default_model_missing", "config.model_refused_name_minted", "config.model_route_endpoint_missing", "config.gateway_fallback_without_primary", "config.catalog_replaces_env_models", "config.summarize_model_missing"];
177
187
  export declare const ModelPlaneRefusalCode: z.ZodEnum<{
188
+ "config.catalog_replaces_env_models": "config.catalog_replaces_env_models";
189
+ "config.summarize_model_missing": "config.summarize_model_missing";
178
190
  "config.default_model_missing": "config.default_model_missing";
179
191
  "config.model_refused_name_minted": "config.model_refused_name_minted";
180
192
  "config.model_route_endpoint_missing": "config.model_route_endpoint_missing";
@@ -566,9 +578,15 @@ export declare const FLEET_ADVERTISE_ADDRESS_ENV = "FLEET_ADVERTISE_ADDRESS";
566
578
  * - {@link SERVING_LEASE_TTL_DEFAULT_MS} — the lease length when the operator sets none (10 min).
567
579
  * - {@link SERVING_LEASE_TTL_FLOOR_MS} — the shortest lease there is: a configured TTL below it is treated as it (1 min),
568
580
  * the same way {@link DRAIN_GRACE_FLOOR_MS} protects a fat-fingered grace.
569
- * - {@link SERVING_LEASE_DRIFT_MARGIN_MS} — web-admin's clock-skew allowance: it adds this to a lease's recorded expiry
570
- * before it counts that lease as over. It is DERIVED from {@link DEFAULT_HEARTBEAT_MS} (one cadence, one number), never a
571
- * second constant that could drift from it.
581
+ * - {@link SERVING_LEASE_DRIFT_MARGIN_MS} — the clock-skew allowance for reading a lease deadline an engine REPORTS. The engine
582
+ * says `EngineSignal.leaseUntil` (epoch ms: its own computation from the granted `ttlMs`, on its own clock); a reader that asks
583
+ * "does this member's lease still hold?" compares that instant with ITS OWN now — two clocks that need not agree — so it counts
584
+ * the lease as held only while `leaseUntil >= now + SERVING_LEASE_DRIFT_MARGIN_MS`. That is the conservative direction: a skew
585
+ * up to the margin can make a lease that still holds read as short, never one that is over read as held. It is an allowance for
586
+ * reading a reported deadline, not part of the lease clock: the engine enforces the lease on its own monotonic clock and
587
+ * web-admin keeps its own expiry from its store time (see {@link ServingLeaseResponse}) — the two sides never compare clocks
588
+ * to enforce. It is DERIVED from {@link DEFAULT_HEARTBEAT_MS} (one cadence, one number), never a second constant that could
589
+ * drift from it.
572
590
  */
573
591
  export declare const SERVING_LEASE_TTL_DEFAULT_MS = 600000;
574
592
  export declare const SERVING_LEASE_TTL_FLOOR_MS = 60000;
package/dist/fleet.js CHANGED
@@ -231,17 +231,29 @@ function readSignalBody(body, pick, schema) {
231
231
  * `config.model_refused_name_minted` — a refused entry's name would be re-minted onto another entry by the
232
232
  * tier / alias expansion (or the dropped-entry carrier cannot prove it would not be);
233
233
  * `config.model_route_endpoint_missing` — an openai-compatible route of the candidate resolves to no endpoint;
234
- * `config.gateway_fallback_without_primary` — fallback gateways are declared without a primary.
235
- * Source (engine): the first two in `src/model-entry-refusal.ts`, the last two in `src/model-route-endpoint.ts:40,42`
236
- * (invariant `model-route-endpoint`, judged by the model-plane stage in `src/config-center/apply-effective.ts:664-665`).
234
+ * `config.gateway_fallback_without_primary` — fallback gateways are declared without a primary;
235
+ * `config.catalog_replaces_env_models` ({@link CATALOG_REPLACES_ENV_MODELS_CODE}) — on the LOCAL config leg, a candidate that
236
+ * manages the model plane would replace a declared env model table (`MODEL_ID` …) while the config root's decision document
237
+ * (`config.env-models.json`, read by `readEnvModelsDecision`) does not say `replaced` — the env models keep serving;
238
+ * `config.summarize_model_missing` ({@link SUMMARIZE_MODEL_MISSING_CODE}) — the summarize role, which every task resolves,
239
+ * would land on no servable entry (every task would be refused after adoption).
240
+ * Source (engine): the first two in `src/model-entry-refusal.ts`, the next two in `src/model-route-endpoint.ts:40,42`
241
+ * (invariant `model-route-endpoint`, judged by the model-plane stage in `src/config-center/apply-effective.ts:664-665`); the
242
+ * last two are named HERE first (the code is a contract word: this package names it and exports the two constants for the engine to read; the engine does not mint them today).
237
243
  */
238
244
  export const MODEL_ENTRY_REFUSAL_CODES = ["config.model_no_brain", "config.model_entry_invalid"];
239
245
  export const ModelEntryRefusalCode = z.enum(MODEL_ENTRY_REFUSAL_CODES);
246
+ /** The env-model-table confirmation gate's group-refusal code (see {@link MODEL_PLANE_REFUSAL_CODES}). */
247
+ export const CATALOG_REPLACES_ENV_MODELS_CODE = "config.catalog_replaces_env_models";
248
+ /** The summarize invariant's group-refusal code (see {@link MODEL_PLANE_REFUSAL_CODES}); a writer's plan answers `fix_first` with it. */
249
+ export const SUMMARIZE_MODEL_MISSING_CODE = "config.summarize_model_missing";
240
250
  export const MODEL_PLANE_REFUSAL_CODES = [
241
251
  "config.default_model_missing",
242
252
  "config.model_refused_name_minted",
243
253
  "config.model_route_endpoint_missing",
244
254
  "config.gateway_fallback_without_primary",
255
+ CATALOG_REPLACES_ENV_MODELS_CODE,
256
+ SUMMARIZE_MODEL_MISSING_CODE,
245
257
  ];
246
258
  export const ModelPlaneRefusalCode = z.enum(MODEL_PLANE_REFUSAL_CODES);
247
259
  /**
@@ -594,9 +606,15 @@ export const FLEET_ADVERTISE_ADDRESS_ENV = "FLEET_ADVERTISE_ADDRESS";
594
606
  * - {@link SERVING_LEASE_TTL_DEFAULT_MS} — the lease length when the operator sets none (10 min).
595
607
  * - {@link SERVING_LEASE_TTL_FLOOR_MS} — the shortest lease there is: a configured TTL below it is treated as it (1 min),
596
608
  * the same way {@link DRAIN_GRACE_FLOOR_MS} protects a fat-fingered grace.
597
- * - {@link SERVING_LEASE_DRIFT_MARGIN_MS} — web-admin's clock-skew allowance: it adds this to a lease's recorded expiry
598
- * before it counts that lease as over. It is DERIVED from {@link DEFAULT_HEARTBEAT_MS} (one cadence, one number), never a
599
- * second constant that could drift from it.
609
+ * - {@link SERVING_LEASE_DRIFT_MARGIN_MS} — the clock-skew allowance for reading a lease deadline an engine REPORTS. The engine
610
+ * says `EngineSignal.leaseUntil` (epoch ms: its own computation from the granted `ttlMs`, on its own clock); a reader that asks
611
+ * "does this member's lease still hold?" compares that instant with ITS OWN now — two clocks that need not agree — so it counts
612
+ * the lease as held only while `leaseUntil >= now + SERVING_LEASE_DRIFT_MARGIN_MS`. That is the conservative direction: a skew
613
+ * up to the margin can make a lease that still holds read as short, never one that is over read as held. It is an allowance for
614
+ * reading a reported deadline, not part of the lease clock: the engine enforces the lease on its own monotonic clock and
615
+ * web-admin keeps its own expiry from its store time (see {@link ServingLeaseResponse}) — the two sides never compare clocks
616
+ * to enforce. It is DERIVED from {@link DEFAULT_HEARTBEAT_MS} (one cadence, one number), never a second constant that could
617
+ * drift from it.
600
618
  */
601
619
  export const SERVING_LEASE_TTL_DEFAULT_MS = 600_000;
602
620
  export const SERVING_LEASE_TTL_FLOOR_MS = 60_000;
package/dist/index.d.ts CHANGED
@@ -7,6 +7,9 @@ export * from "./execution-lanes.js";
7
7
  export * from "./url-shape.js";
8
8
  export * from "./url-credential.js";
9
9
  export * from "./default-model.js";
10
+ export { catalogManagesModelPlane, enabledEntryCount } from "./catalog-manages.js";
11
+ export { DEFAULT_MODEL_KEY, ENV_MODEL_TABLE_KEYS, buildEnvModelBaseline, envModelTableDeclared, envModelTableWriteRefusal, mintedCheapId, planEnvModelTableWrite, readEnvModelSlots, type EnvCheapSlot, type EnvModelBaseline, type EnvModelTableEntry, type EnvModelTableKey, type EnvModelTableLanding, type EnvModelTableReceipt, type EnvModelTableRoleRow, type EnvModelTableTarget, type EnvModelTableWriteInput, type EnvModelTableWriteIntent, type EnvModelTableWritePlan, type EnvRoleBinding, type EnvSnapshot, } from "./env-model-table.js";
12
+ export { CONFIG_ROOT_DOCUMENTS, ENV_MODELS_DECISIONS, ENV_MODELS_DOCUMENT, ROOT_DOCUMENT_UNREADABLE_REASONS, envModelsDecisionTag, type ConfigRootDocument, type EnvModelsDecision, type EnvModelsDecisionWord, type MarkedMigrationId, type MigrationMarker, type RootDocumentUnreadableReason } from "./config-root-documents.js";
10
13
  export * from "./loopback.js";
11
14
  export * from "./hash.js";
12
15
  export * from "./sha256.js";
@@ -42,3 +45,5 @@ export * from "./mcp-server-policy.js";
42
45
  export * from "./ui-language.js";
43
46
  export * from "./control-and-bidi.js";
44
47
  export * from "./mcp-request-entry.js";
48
+ export { REMOTE_MCP_SERVER_NAME_PREFIX } from "./mcp-server-name.js";
49
+ export * from "./center-refs.js";
package/dist/index.js CHANGED
@@ -7,6 +7,9 @@ export * from "./execution-lanes.js"; // 7.0.0 M-R2: the ONE lane / store vocabu
7
7
  export * from "./url-shape.js"; // 11.0.0: THE URL shape judge (httpUrlFlaws / httpUrlRule / isHierarchicalUrl), pure/browser-safe
8
8
  export * from "./url-credential.js"; // 14.5.0: THE "does this URL carry a credential" judge (findUrlCredential / findUrlUserinfo / URL_CREDENTIAL_REASONS / CREDENTIAL_PARAM_NAMES …), pure/browser-safe
9
9
  export * from "./default-model.js"; // 11.0.0: THE catalog-default resolver (roles.default → active tier ladder → fallback), pure/browser-safe
10
+ export { catalogManagesModelPlane, enabledEntryCount } from "./catalog-manages.js"; // THE "does this models document manage the model plane" judge (raw half: at least one entry not explicitly disabled) + the log count it is derived from, pure/browser-safe
11
+ export { DEFAULT_MODEL_KEY, ENV_MODEL_TABLE_KEYS, buildEnvModelBaseline, envModelTableDeclared, envModelTableWriteRefusal, mintedCheapId, planEnvModelTableWrite, readEnvModelSlots, } from "./env-model-table.js"; // the env model table (MODEL_ID / MODEL_CHEAP_ID) read once: readEnvModelSlots / envModelTableDeclared / buildEnvModelBaseline + the writer's plan planEnvModelTableWrite (receipt by id, confirmKey) + envModelTableWriteRefusal, pure/browser-safe (named: the env snapshot helper stays package-private)
12
+ export { CONFIG_ROOT_DOCUMENTS, ENV_MODELS_DECISIONS, ENV_MODELS_DOCUMENT, ROOT_DOCUMENT_UNREADABLE_REASONS, envModelsDecisionTag } from "./config-root-documents.js"; // the config-root documents (config.env-models.json + the per-id migration marker config.migration.<id>.json): names + closed answer tables + the one tagged identity of a decision reading (envModelsDecisionTag); the readers / writer are in ./node
10
13
  export * from "./loopback.js"; // 11.0.0: the two「本机」predicates (auth relaxation — narrow / connection routing — wide), pure/browser-safe
11
14
  export * from "./hash.js";
12
15
  export * from "./sha256.js";
@@ -42,6 +45,8 @@ export * from "./mcp-server-policy.js"; // 13.0.0 (U6): mcpServerPolicyVerdict
42
45
  export * from "./ui-language.js"; // 13.0.0 (S-1592): the UI-language settings fragment (semaUiLanguage, en | zh, category ui, user settings) + readUiLanguage, pure/browser-safe
43
46
  export * from "./control-and-bidi.js"; // the one-line echo strip set (C0 + DEL + the 12 Bidi_Control code points) — CONTROL_AND_BIDI_CHARS (the class, as regex source text) + stripControlAndBidi / hasControlOrBidi, pure/browser-safe
44
47
  export * from "./mcp-request-entry.js"; // 14.0.0: the request-plane MCP entry judges (isUsableWireName / isContentOriginWord / readMcpIdentityHeaders / readRequestMcpTransport + the value-shape describers) — one reading for the service legs and the shell pre-check, pure/browser-safe
48
+ export { REMOTE_MCP_SERVER_NAME_PREFIX } from "./mcp-server-name.js"; // the MCP server-name prefix reserved for the remote MCP servers a device executor offers (mount name = prefix + the executor's server name); the predicate and its sentence stay package-private — the request plane's MCP name judges (isUsableMcpServerName / describeBadMcpServerName) read them; the config plane's McpServerSpec.name accepts the prefix (refusing it would be a validation tightening — a major), pure/browser-safe
49
+ export * from "./center-refs.js"; // resolveCenterRefs(refs, lookup) — THE center-roster reference resolver: one verdict word per member (missing_name / not_a_string / read_threw, CENTER_REF_FAULTS), one whole verdict (resolved / unresolved / refs_unreadable, CENTER_REFS_VERDICTS); the refs record is read by the public readPlainStringRecord, the lookup is the caller's, it reads no process.env; pure/browser-safe
45
50
  // NOTE: the Node-fs-backed helpers (FileConfigStore + the file editor) are NOT in this barrel — they pull
46
51
  // `node:fs`/`node:path` and would break a browser/client bundle that only wants the contract (e.g.
47
52
  // web-admin's client components import the zod types through here). Import them from the Node-only
@@ -31,6 +31,16 @@ export declare function isUsableWireName(v: unknown): v is string;
31
31
  * (制表 / 换行这类控制空白在回显里被剥掉,所以看得出是空白靠这个种类词,不靠引号里的样子);两件事并存 ⇒ 一句说全(`N chars > 128, leading or trailing whitespace`)。
32
32
  */
33
33
  export declare function describeBadWireName(v: unknown): string;
34
+ /**
35
+ * 这个 MCP 服务器名能用吗:{@link isUsableWireName} 再加一臂 —— 不在保留给设备执行端远程 MCP 服务器的 `remote-` 命名空间里(`./mcp-server-name`,字面前缀比较)。
36
+ * 只多这一臂:线上名的判据(非空、长界、首尾空白)一字不改,别的输入两只判官逐项同答。A2A 对端名只用 {@link isUsableWireName}(它的工具名前缀是 `a2a__`,不在这个命名空间里)。
37
+ */
38
+ export declare function isUsableMcpServerName(v: unknown): v is string;
39
+ /**
40
+ * 坏 MCP 服务器名的**可打印**摘要:线上名本身就坏 ⇒ 与 {@link describeBadWireName} 逐字同(长界这类线上名的事实先说,不被保留臂盖掉);
41
+ * 线上名好而落在保留命名空间里 ⇒ 引号形的回显加那一句原因。
42
+ */
43
+ export declare function describeBadMcpServerName(v: unknown): string;
34
44
  /**
35
45
  * 在内容出处词表({@link MCP_CONTENT_ORIGINS})内吗。严判:非串与大小写不符(`"LOCAL"`)一律不在 —— 引擎的词是字面量联合、不做规范化;
36
46
  * 替它「宽容一下」等于自造第二份值域语义,而这条轴上宽容的方向恰好是**放宽信任**(把一个写坏的声明读成 `"local"`)。
@@ -46,7 +56,14 @@ export declare function readMcpIdentityHeaders(transport: Record<string, unknown
46
56
  principalHeader?: string;
47
57
  assertionHeader?: string;
48
58
  };
49
- /** 请求面一条 MCP 条目的传输形:引擎的传输形,http 形多一个承载的 `assertionHeader`(引擎的 http 传输没有这个座;交给引擎之前由消费方剥掉)。 */
59
+ /**
60
+ * 请求面一条 MCP 条目的传输形。与引擎传输形的关系逐键一句(处置表,对拍 = 上游漂移门 ⑧):
61
+ * · `kind` / `command` / `args` / `url` / `principalHeader` —— 与引擎同键同型;
62
+ * · `env` / `headers` —— 请求带来的**字面件**:引擎的声明不带值(一台服务器的凭据头 / 子进程环境由部署的对端座每次发送时答),
63
+ * 所以这两把键交给引擎之前由消费方从声明里拿走、按它自己的对端座答;
64
+ * · `assertionHeader` —— 本包承载,引擎的 http 传输没有这个座(交给引擎之前由消费方剥掉);
65
+ * · 引擎的 `credentials`(不透明的凭据引用)—— 请求面不收:读器不读它。
66
+ */
50
67
  export type RequestMcpTransport = {
51
68
  kind: "stdio";
52
69
  command: string;
@@ -62,18 +79,18 @@ export type RequestMcpTransport = {
62
79
  /**
63
80
  * 条目内一处坏形:`path` = 条目内的键路径(`transport.url`),`reason` = 判官的原因句(只说形与词表,不回显值)。
64
81
  *
65
- * `env` / `headers` 这两张「名 → 串」记录上的坏形另带两格机读位,调用方分流不必解析句子:`fault` = 闭集词 ——
66
- * · `not_plain_record`:这个键的值不是纯数据记录(不是对象 / 数组 / `null`,或不是朴素 JSON 对象 —— 原型链比座位的判据长:`Map`、`Set`、类实例);整张记录不交;
67
- * · `member_not_string`:有一个成员的值不是串(或访问器抛了);整张记录不交,`member` 点名它;
82
+ * `env` / `headers` 这两张「名 → 串」记录上的坏形另带两格机读位,调用方分流不必解析句子:`fault` = 闭集词({@link PLAIN_STRING_RECORD_FAULTS},与公开的记录读器 {@link readPlainStringRecord} 同一张表)——
83
+ * · `not_plain_record`:这个键的值不是纯数据记录(不是对象 / 数组 / `null`,或不是朴素 JSON 对象 —— 原型链比座位的判据长:`Map`、`Set`、类实例;读形状就抛的对象同);整张记录不交;
84
+ * · `member_not_string`:有一个成员的值不是串,或它读不出(它的访问器抛了,或读它的描述符时代理陷阱抛了);整张记录不交,`member` 点名它,两种情形句子分说;
68
85
  * · `member_name_reserved`:有一个成员叫 `__proto__`(引擎的声明收据拒这个名)。成员的值是串 ⇒ 只剔这个成员、其余照交,`path` 是成员级(`transport.env.__proto__`);
69
- * 成员的值也不是串 ⇒ 整张记录不交,`path` 是键级,句子一次说全两件事 —— 名坏优先、值坏并列,所以词仍是 `member_name_reserved`。
86
+ * 成员的值也不是串(或读不出)⇒ 整张记录不交,`path` 是键级,句子一次说全两件事 —— 名坏优先、值坏并列,所以词仍是 `member_name_reserved`。
70
87
  * `member` 是成员名的**回显形**(剥控制与双向字符、截 64 字加 `…`),可直接进日志与句子,不是回查原对象的键。其余的坏形(`args` / `url` / `principalHeader` / ……)两格都不带。
71
88
  */
72
89
  export interface McpEntryKeyIssue {
73
90
  readonly path: string;
74
91
  readonly reason: string;
75
92
  readonly member?: string;
76
- readonly fault?: "not_plain_record" | "member_not_string" | "member_name_reserved";
93
+ readonly fault?: PlainStringRecordFault;
77
94
  }
78
95
  /** {@link readRequestMcpTransport} 的结果:`ok:false` = 硬坏形(这条 server 无从挂载);`ok:true` 的 `lost` = 读器**丢掉**的可选子键(server 照挂、少一个声明)。 */
79
96
  export type RequestMcpTransportRead = {
@@ -95,3 +112,38 @@ export type RequestMcpTransportRead = {
95
112
  * url 的拒句不回显值:它常规地带凭据(userinfo)。
96
113
  */
97
114
  export declare function readRequestMcpTransport(t: unknown): RequestMcpTransportRead;
115
+ /**
116
+ * 引擎的声明收据不收的成员名(core `mcp-server-spec`:按赋值拷贝它会变成原型):JSON 文本铸得出这个**自有**键,对象字面量写不出。
117
+ * 公开,因为读器交出 `reservedMember: true` 时消费方要点名它 —— 名字只在这里定一次。
118
+ */
119
+ export declare const PLAIN_STRING_RECORD_RESERVED_MEMBER = "__proto__";
120
+ /**
121
+ * 「名 → 串」记录读不交(或交时点名保留名)的**原因词**,闭集,三个词、一张表:
122
+ * 整张一词(`not_plain_record`)· 成员级一词(`member_not_string`:值读成了别的种类,或读成员时抛了 —— 句子分说)· 名字级一词(`member_name_reserved`)。
123
+ * 词的意义逐词写在 {@link McpEntryKeyIssue}。消费方按词分派,不读句子;读器的读数 {@link PlainStringRecordRead} 与传输条目的机读位 {@link McpEntryKeyIssue} 的 `fault` 都由这一张表推出。
124
+ * 多一个词而消费方的穷尽 `switch` 不补 ⇒ 编译红(提货成本,不是静默)。
125
+ */
126
+ export declare const PLAIN_STRING_RECORD_FAULTS: readonly ["not_plain_record", "member_not_string", "member_name_reserved"];
127
+ export type PlainStringRecordFault = (typeof PLAIN_STRING_RECORD_FAULTS)[number];
128
+ /**
129
+ * {@link readPlainStringRecord} 的读数:`ok:false` = 记录不交(`fault` = 原因词;`detail` 是接在 `must be a plain object of string values — ` 后面的句子;坏在某个成员时 `member` 点名它的回显形);
130
+ * `ok:true` = 交出去的纯数据副本,`reservedMember` = 记录里有一个名叫 {@link PLAIN_STRING_RECORD_RESERVED_MEMBER} 的成员(它没进副本)。
131
+ */
132
+ export type PlainStringRecordRead = {
133
+ readonly ok: true;
134
+ readonly record: Record<string, string>;
135
+ readonly reservedMember: boolean;
136
+ } | {
137
+ readonly ok: false;
138
+ readonly detail: string;
139
+ readonly fault: PlainStringRecordFault;
140
+ readonly member?: string;
141
+ };
142
+ /**
143
+ * 读一份「名 → 串」记录 —— **公开读口**:传输读器读 `env` / `headers` 用的就是它,消费方读自己的「名 → 串」记录(中心名册的引用表)调同一只,不抄镜像。从不抛。记录交不交:是朴素 JSON 对象(座位的判据,见 `./plain-json-object`:原型是 `null`,或原型自己的原型是 `null`;纯数据 —— `Map`、`Set`、类实例、建在原型上的记录都不是),
144
+ * 且每个成员的值都是串。成员 = `Object.getOwnPropertyNames` 的每一个名字(不可枚举的也算 —— 引擎的收据按全部自有属性名读),值经内核 `readKey` 读(一份描述符:数据属性取值,访问器调一次,不问 `get` 陷阱;访问器或描述符 trap 抛了同判为坏 —— 词与「值不是串」同是 `member_not_string`,句子说读不出)。
145
+ * 读原型与成员名时代理 trap 抛了 ⇒ 整张不交(读器对调用方递来的任何对象都不抛;`JSON` 存体里不会有代理,这条只落在直接调读器的嵌入方身上)。
146
+ * 交出去的是副本(原型 `Object.prototype`、成员全可枚举),调用方的对象不被交出去、也不被改;名叫 `__proto__` 的成员不进副本,`reservedMember` 记下它。
147
+ * 名叫 `__proto__` 而值也坏的成员,句子一次说全两件事(名坏在前、值坏并列):调用方照值改完再撞第二条是两步才改对。
148
+ */
149
+ export declare function readPlainStringRecord(v: unknown): PlainStringRecordRead;
@@ -14,19 +14,22 @@
14
14
  *
15
15
  * ## 依赖的引擎事实(镜像 + 漂移门)
16
16
  * · 申报名的线长界 {@link TOOL_WIRE_NAME_MAX_CHARS} = 引擎同名常量(值级对拍:上游漂移门 ⑧);
17
- * · 请求面传输形 {@link RequestMcpTransport} = 引擎 MCP 条目的传输形,http 形多一个本包承载的 `assertionHeader`(编译期双向对拍:门 ⑧);
17
+ * · 请求面传输形 {@link RequestMcpTransport} 对引擎 MCP 条目的传输形是一张处置表,两边每个键恰好一行(编译期两向对拍:门 ⑧)——
18
+ * `kind` / `command` / `args` / `url` / `principalHeader` 与引擎同键同型;`env` / `headers` 是请求带来的字面件(引擎的声明不带值);
19
+ * `assertionHeader` 本包承载(引擎没有这个座);引擎的 `credentials`(不透明的凭据引用)请求面不收;
18
20
  * · 内容出处词表 = {@link MCP_CONTENT_ORIGINS}(已有的镜像,门 ⑥);
19
21
  * · url 前缀守卫 = `./url-shape` 的 `startsWithHttpScheme`(本包判 URL 的正则只在那一个模块)。它只看前缀,不是形判官 —— 同一个串两口可以答得不同,两张分歧表与收口形(S-2106)写在 `./url-shape` 头注「第二个答案」。
20
22
  *
21
23
  * ## 与配置面的关系(如实)
22
24
  * 配置面的 MCP 条目(`McpServerSpec`,部署声明:凭据只许 env-NAME 引用)与请求面(提交体:可带字面凭据 `env` / `headers`)是两份契约,本模块只管后者。
23
25
  * 两份契约对「名」与「url」今天给的判据不同(配置面:名按字符集、url 按 `NON_SECRET_URL`;请求面:名按长度界、url 按 http(s) 前缀),本版刻意不动
24
- * (语义逐字搬),是一项已知待收的分歧。
26
+ * (语义逐字搬),是一项已知待收的分歧。`remote-` 保留前缀这一臂也只在请求面(`isUsableMcpServerName`):配置面 `McpServerSpec.name` 不拒它(此前合法的名被拒是校验收紧,归 major,不在 minor 里落),是又一处两面不齐的已知分歧。
25
27
  */
26
28
  import { echoCallerText } from "./caller-text-echo.js";
27
29
  import { UNINSPECTABLE, captureStringArray, dataDescriptor, inspect, ownEntriesOf, ownFieldsOf, ownValueOf, readKey } from "./own-key-read.js";
28
30
  import { isJsonArray, isPlainJsonObject, jsonShapeOf } from "./plain-json-object.js";
29
31
  import { MCP_CONTENT_ORIGINS } from "./types.js";
32
+ import { RESERVED_MCP_SERVER_NAME_REASON, isReservedMcpServerName } from "./mcp-server-name.js";
30
33
  import { startsWithHttpScheme } from "./url-shape.js";
31
34
  // ── 值的种类描述(拒句只说「你写的是什么形」,不回显值:值可能带凭据、可能任意长)──────────────────────────────────────
32
35
  /** 值的**种类词**(不回显值本身):`null` / `array` / `typeof` 词(`object` / `function` / `string` …);读不出的对象 ⇒ 全包唯一的那一句。形状只问座位(总,不抛):两只坏值描述器共用这一只。 */
@@ -97,7 +100,7 @@ export function isStringRecord(v) {
97
100
  if (!isPlainJsonObject(v))
98
101
  return false;
99
102
  const entries = ownEntriesOf(v);
100
- return entries.ok && entries.value.every(([name, value]) => name !== RESERVED_MEMBER_NAME && typeof value === "string");
103
+ return entries.ok && entries.value.every(([name, value]) => name !== PLAIN_STRING_RECORD_RESERVED_MEMBER && typeof value === "string");
101
104
  }
102
105
  // ── 调用方写的串的回显口径 ──────────────────────────────────────────────────────────────────────────
103
106
  /** 句子里点名一个值的写法:{@link echoCallerText} 外加一对双引号;内部的引号与反斜杠逐字(不转义)。 */
@@ -136,6 +139,23 @@ export function describeBadWireName(v) {
136
139
  return `${head} (${tooLong})`;
137
140
  return `${head} (${v.length > TOOL_WIRE_NAME_MAX_CHARS ? `${tooLong}, ` : ""}leading or trailing whitespace)`;
138
141
  }
142
+ // ── MCP 服务器名(线上名 + 保留命名空间)──────────────────────────────────────────────────────────────────
143
+ /**
144
+ * 这个 MCP 服务器名能用吗:{@link isUsableWireName} 再加一臂 —— 不在保留给设备执行端远程 MCP 服务器的 `remote-` 命名空间里(`./mcp-server-name`,字面前缀比较)。
145
+ * 只多这一臂:线上名的判据(非空、长界、首尾空白)一字不改,别的输入两只判官逐项同答。A2A 对端名只用 {@link isUsableWireName}(它的工具名前缀是 `a2a__`,不在这个命名空间里)。
146
+ */
147
+ export function isUsableMcpServerName(v) {
148
+ return isUsableWireName(v) && !isReservedMcpServerName(v);
149
+ }
150
+ /**
151
+ * 坏 MCP 服务器名的**可打印**摘要:线上名本身就坏 ⇒ 与 {@link describeBadWireName} 逐字同(长界这类线上名的事实先说,不被保留臂盖掉);
152
+ * 线上名好而落在保留命名空间里 ⇒ 引号形的回显加那一句原因。
153
+ */
154
+ export function describeBadMcpServerName(v) {
155
+ if (!isUsableWireName(v))
156
+ return describeBadWireName(v);
157
+ return `${quotedCallerText(v)} (${RESERVED_MCP_SERVER_NAME_REASON})`;
158
+ }
139
159
  // ── 内容出处词 ──────────────────────────────────────────────────────────────────────────────────────
140
160
  const CONTENT_ORIGIN_WORDS = new Set(MCP_CONTENT_ORIGINS);
141
161
  /**
@@ -303,9 +323,19 @@ function snapshotTransport(tr) {
303
323
  return { ok: true, value: { kind: "other", value: kind.value } };
304
324
  }
305
325
  // ── 「名 → 串」记录的读法(`env` / `headers`)────────────────────────────────────────────────────────
306
- /** 引擎的声明收据不收的成员名(core `mcp-server-spec`:按赋值拷贝它会变成原型):JSON 文本铸得出这个**自有**键,对象字面量写不出。 */
307
- const RESERVED_MEMBER_NAME = "__proto__";
308
- const RESERVED_MEMBER_FAULT = `no member of a declaration may be named "${RESERVED_MEMBER_NAME}"`;
326
+ /**
327
+ * 引擎的声明收据不收的成员名(core `mcp-server-spec`:按赋值拷贝它会变成原型):JSON 文本铸得出这个**自有**键,对象字面量写不出。
328
+ * 公开,因为读器交出 `reservedMember: true` 时消费方要点名它 —— 名字只在这里定一次。
329
+ */
330
+ export const PLAIN_STRING_RECORD_RESERVED_MEMBER = "__proto__";
331
+ const RESERVED_MEMBER_FAULT = `no member of a declaration may be named "${PLAIN_STRING_RECORD_RESERVED_MEMBER}"`;
332
+ /**
333
+ * 「名 → 串」记录读不交(或交时点名保留名)的**原因词**,闭集,三个词、一张表:
334
+ * 整张一词(`not_plain_record`)· 成员级一词(`member_not_string`:值读成了别的种类,或读成员时抛了 —— 句子分说)· 名字级一词(`member_name_reserved`)。
335
+ * 词的意义逐词写在 {@link McpEntryKeyIssue}。消费方按词分派,不读句子;读器的读数 {@link PlainStringRecordRead} 与传输条目的机读位 {@link McpEntryKeyIssue} 的 `fault` 都由这一张表推出。
336
+ * 多一个词而消费方的穷尽 `switch` 不补 ⇒ 编译红(提货成本,不是静默)。
337
+ */
338
+ export const PLAIN_STRING_RECORD_FAULTS = ["not_plain_record", "member_not_string", "member_name_reserved"];
309
339
  /** 记录不交时 `detail` 的前半句:它是哪一种不朴素(null / 数组 / 原始值各一句,对象里的非朴素一句)。`shape` 穷举 —— 新词不补 = 编译红。 */
310
340
  function notPlainDetail(shape, v) {
311
341
  switch (shape) {
@@ -328,13 +358,13 @@ function notPlainDetail(shape, v) {
328
358
  }
329
359
  }
330
360
  /**
331
- * 读一份「名 → 串」记录。记录交不交:是朴素 JSON 对象(座位的判据,见 `./plain-json-object`:原型是 `null`,或原型自己的原型是 `null`;纯数据 —— `Map`、`Set`、类实例、建在原型上的记录都不是),
332
- * 且每个成员的值都是串。成员 = `Object.getOwnPropertyNames` 的每一个名字(不可枚举的也算 —— 引擎的收据按全部自有属性名读),值经内核 `readKey` 读(一份描述符:数据属性取值,访问器调一次,不问 `get` 陷阱;访问器或描述 trap 抛了同判为坏)。
361
+ * 读一份「名 → 串」记录 —— **公开读口**:传输读器读 `env` / `headers` 用的就是它,消费方读自己的「名 → 串」记录(中心名册的引用表)调同一只,不抄镜像。从不抛。记录交不交:是朴素 JSON 对象(座位的判据,见 `./plain-json-object`:原型是 `null`,或原型自己的原型是 `null`;纯数据 —— `Map`、`Set`、类实例、建在原型上的记录都不是),
362
+ * 且每个成员的值都是串。成员 = `Object.getOwnPropertyNames` 的每一个名字(不可枚举的也算 —— 引擎的收据按全部自有属性名读),值经内核 `readKey` 读(一份描述符:数据属性取值,访问器调一次,不问 `get` 陷阱;访问器或描述符 trap 抛了同判为坏 —— 词与「值不是串」同是 `member_not_string`,句子说读不出)。
333
363
  * 读原型与成员名时代理 trap 抛了 ⇒ 整张不交(读器对调用方递来的任何对象都不抛;`JSON` 存体里不会有代理,这条只落在直接调读器的嵌入方身上)。
334
364
  * 交出去的是副本(原型 `Object.prototype`、成员全可枚举),调用方的对象不被交出去、也不被改;名叫 `__proto__` 的成员不进副本,`reservedMember` 记下它。
335
365
  * 名叫 `__proto__` 而值也坏的成员,句子一次说全两件事(名坏在前、值坏并列):调用方照值改完再撞第二条是两步才改对。
336
366
  */
337
- function readPlainStringRecord(v) {
367
+ export function readPlainStringRecord(v) {
338
368
  // 形状归座位旁的分类(不在这里再推一遍;座位总 —— 读形状就抛的对象答 `uninspectable`)。成员名的读取(`ownKeys` 陷阱抛)读不出的对象也不是纯数据。
339
369
  // 读器不抛出去 —— 重放存量提交体的腿被一次抛错砖死比整键不交糟,而「整键不交」是响亮的(进 `lost`)。检视律与句都在 `inspect`。
340
370
  const shape = jsonShapeOf(v);
@@ -355,15 +385,17 @@ function readPlainStringRecord(v) {
355
385
  const value = read.presence === "own" ? read.value : undefined;
356
386
  if (unreadable || typeof value !== "string") {
357
387
  const valueFault = unreadable ? "could not be read (its getter threw)" : `must be a string — got ${describeValueShape(value)}`;
358
- const reserved = name === RESERVED_MEMBER_NAME;
388
+ const reserved = name === PLAIN_STRING_RECORD_RESERVED_MEMBER;
389
+ // 词:名坏优先(句子里值坏并列说全);名没问题时,读不出与值不是串同词,句子分说
390
+ const fault = reserved ? "member_name_reserved" : "member_not_string";
359
391
  return {
360
392
  ok: false,
361
- fault: reserved ? "member_name_reserved" : "member_not_string",
393
+ fault,
362
394
  member: echoCallerText(name),
363
395
  detail: `its member "${echoCallerText(name)}" ${reserved ? `is not allowed (${RESERVED_MEMBER_FAULT}) and its value ${valueFault}` : valueFault}`,
364
396
  };
365
397
  }
366
- if (name === RESERVED_MEMBER_NAME)
398
+ if (name === PLAIN_STRING_RECORD_RESERVED_MEMBER)
367
399
  reservedMember = true;
368
400
  else
369
401
  Object.defineProperty(members, name, dataDescriptor(value));
@@ -388,6 +420,6 @@ function readTransportRecord(path, raw) {
388
420
  }
389
421
  return {
390
422
  record: read.record,
391
- issues: read.reservedMember ? [{ path: `${path}.${RESERVED_MEMBER_NAME}`, reason: RESERVED_MEMBER_FAULT, member: RESERVED_MEMBER_NAME, fault: "member_name_reserved" }] : [],
423
+ issues: read.reservedMember ? [{ path: `${path}.${PLAIN_STRING_RECORD_RESERVED_MEMBER}`, reason: RESERVED_MEMBER_FAULT, member: PLAIN_STRING_RECORD_RESERVED_MEMBER, fault: "member_name_reserved" }] : [],
392
424
  };
393
425
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * MCP 服务器名的保留命名空间 —— 一处定义,请求面的 MCP 名判官(`isUsableMcpServerName` / `describeBadMcpServerName`)读同一个谓词、说同一句原因。
3
+ * 配置面 `McpServerSpec.name` **不读**它(受理以这个前缀起头的名):此前合法的名被拒是校验收紧,按发版纪律归 major。
4
+ * 纯数据 + 纯函数,浏览器安全(叶模块:不 import 本包别的模块)。
5
+ *
6
+ * 设备执行端(device executor)提供的远程 MCP 服务器以 `remote-<名>` 挂载,工具名 `mcp__remote-<名>__<工具>`。部署声明的、请求带来的 MCP 条目若也用这个前缀,
7
+ * 一台它们声明的服务器就与一台设备上的服务器同名、落进同一个工具名命名空间 —— 所以这个前缀只归设备挂载。
8
+ *
9
+ * 比较按**字面**(区分大小写、不规范化):引擎铸工具名前缀时保留大小写、只把 `[A-Za-z0-9_-]` 之外的字符换成 `_`,`remote-` 这七个字符原样保留 ——
10
+ * 所以「名字以 `remote-` 起头」恰好等于「铸出的命名空间段以 `remote-` 起头」;`Remote-x` 铸成 `mcp__Remote-x__`,不在这个命名空间里。
11
+ */
12
+ /** 保留给设备执行端远程 MCP 服务器的名字前缀(挂载名 = 这个前缀 + 设备声明的服务器名)。 */
13
+ export declare const REMOTE_MCP_SERVER_NAME_PREFIX = "remote-";
14
+ /** 这个 MCP 服务器名落在保留命名空间里吗(字面前缀比较)。 */
15
+ export declare function isReservedMcpServerName(name: string): boolean;
16
+ /** 保留前缀的原因句(不回显名字 —— 回显由读它的那一面按自己的口径加)。 */
17
+ export declare const RESERVED_MCP_SERVER_NAME_REASON = "the \"remote-\" prefix is reserved for the remote MCP servers a device executor offers";
@@ -0,0 +1,19 @@
1
+ /**
2
+ * MCP 服务器名的保留命名空间 —— 一处定义,请求面的 MCP 名判官(`isUsableMcpServerName` / `describeBadMcpServerName`)读同一个谓词、说同一句原因。
3
+ * 配置面 `McpServerSpec.name` **不读**它(受理以这个前缀起头的名):此前合法的名被拒是校验收紧,按发版纪律归 major。
4
+ * 纯数据 + 纯函数,浏览器安全(叶模块:不 import 本包别的模块)。
5
+ *
6
+ * 设备执行端(device executor)提供的远程 MCP 服务器以 `remote-<名>` 挂载,工具名 `mcp__remote-<名>__<工具>`。部署声明的、请求带来的 MCP 条目若也用这个前缀,
7
+ * 一台它们声明的服务器就与一台设备上的服务器同名、落进同一个工具名命名空间 —— 所以这个前缀只归设备挂载。
8
+ *
9
+ * 比较按**字面**(区分大小写、不规范化):引擎铸工具名前缀时保留大小写、只把 `[A-Za-z0-9_-]` 之外的字符换成 `_`,`remote-` 这七个字符原样保留 ——
10
+ * 所以「名字以 `remote-` 起头」恰好等于「铸出的命名空间段以 `remote-` 起头」;`Remote-x` 铸成 `mcp__Remote-x__`,不在这个命名空间里。
11
+ */
12
+ /** 保留给设备执行端远程 MCP 服务器的名字前缀(挂载名 = 这个前缀 + 设备声明的服务器名)。 */
13
+ export const REMOTE_MCP_SERVER_NAME_PREFIX = "remote-";
14
+ /** 这个 MCP 服务器名落在保留命名空间里吗(字面前缀比较)。 */
15
+ export function isReservedMcpServerName(name) {
16
+ return name.startsWith(REMOTE_MCP_SERVER_NAME_PREFIX);
17
+ }
18
+ /** 保留前缀的原因句(不回显名字 —— 回显由读它的那一面按自己的口径加)。 */
19
+ export const RESERVED_MCP_SERVER_NAME_REASON = `the "${REMOTE_MCP_SERVER_NAME_PREFIX}" prefix is reserved for the remote MCP servers a device executor offers`;
@@ -2,11 +2,12 @@
2
2
  * 一次性迁移的**收据形**与两张闭集(11.0.0)—— 叶子模块(运行期零依赖;只有型导入),由 `./one-time-migrations` 再导出(不进主桶)。
3
3
  * 单拆出来只为一件事:调度店的读口(`./scheduler-store`,轻、浏览器安全)要在告警里带收据,不该为一个型把整套域 schema 拉进来。
4
4
  */
5
+ import type { ENV_MODELS_DOCUMENT } from "./config-root-documents.js";
5
6
  import type { REMOTE_EXEC_DOCUMENT } from "./remote-exec.js";
6
7
  import type { DomainName, RetiredDomainName } from "./types.js";
7
8
  /** 本版登记的一次性**数据**迁移 id(闭集;每个 id 在 `ONE_TIME_MIGRATIONS` 登记表里恰一行)。收据只许这些 id —— 同表登记的 wire 删码位
8
9
  * (`WIRE_RETIREMENT_IDS`,`./one-time-migrations`)不改任何存储形,铸不出收据,不在本集。 */
9
- export declare const ONE_TIME_MIGRATION_IDS: readonly ["SS-M1", "SS-M2", "SS-M3", "SS-M4", "SS-M5", "SS-M6", "SS-M7", "SS-M8", "SS-M9", "SS-M10"];
10
+ export declare const ONE_TIME_MIGRATION_IDS: readonly ["SS-M1", "SS-M2", "SS-M3", "SS-M4", "SS-M5", "SS-M6", "SS-M7", "SS-M8", "SS-M9", "SS-M10", "SS-M11"];
10
11
  export type OneTimeMigrationId = (typeof ONE_TIME_MIGRATION_IDS)[number];
11
12
  /**
12
13
  * 一条收据说迁移**对一个坐标做了什么**(闭集,每词一义):
@@ -14,12 +15,15 @@ export type OneTimeMigrationId = (typeof ONE_TIME_MIGRATION_IDS)[number];
14
15
  * - `rewritten` — 同一坐标上的值换成今天的生效读法(例:URL 剥掉从不上线的 fragment、调度行的 durable 键重铸、6.x 的 worker 行换新形);
15
16
  * - `dropped-shadowed` — 删掉;它从来没生效过,因为另一个位赢了(例:`governance` 已设时 `runtime` 上的治理旧键、`sealedApiKey` 在场时的 `apiKeyEnv`);
16
17
  * - `dropped-inert` — 删掉;今天的读法本就不让它生效(例:超界的主机条目、引擎从不读的旧字段、空的retired 域文档);
17
- * - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么。
18
+ * - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么;
19
+ * - `minted` — 在**缺席处**写下一份新事实(一份部署决定),不改任何已有的值 —— 只有 SS-M11 铸(配置根的 `config.env-models.json`:
20
+ * 升级前「管模型面的目录整表顶替 env 模型」的读法,写成 `replaced`;不存在才建)。
18
21
  */
19
- export declare const MIGRATION_APPLIED_AS: readonly ["moved", "rewritten", "dropped-shadowed", "dropped-inert", "refused"];
22
+ export declare const MIGRATION_APPLIED_AS: readonly ["moved", "rewritten", "dropped-shadowed", "dropped-inert", "refused", "minted"];
20
23
  export type MigrationAppliedAs = (typeof MIGRATION_APPLIED_AS)[number];
21
- /** 收据指向的那份文档:配置域名、retired 域名(`runtime`)、`config.d/remote-exec.json`(`remote-exec`),或调度店(`scheduler-store`)。 */
22
- export type MigrationDocument = DomainName | RetiredDomainName | typeof REMOTE_EXEC_DOCUMENT | "scheduler-store";
24
+ /** 收据指向的那份文档:配置域名、retired 域名(`runtime`)、`config.d/remote-exec.json`(`remote-exec`)、调度店(`scheduler-store`),
25
+ * 或配置根上的 env 模型表决定(`config.env-models`,SS-M11 铸)。 */
26
+ export type MigrationDocument = DomainName | RetiredDomainName | typeof REMOTE_EXEC_DOCUMENT | "scheduler-store" | typeof ENV_MODELS_DOCUMENT;
23
27
  /** 文档里的段坐标(字符串段 = 对象键,数字段 = 数组下标;与告警坐标同一形)。 */
24
28
  export type MigrationPath = readonly (string | number)[];
25
29
  interface ReceiptBase {
@@ -35,7 +39,7 @@ export type MigrationReceipt = (ReceiptBase & {
35
39
  readonly path: MigrationPath;
36
40
  };
37
41
  }) | (ReceiptBase & {
38
- readonly appliedAs: "rewritten" | "dropped-shadowed" | "dropped-inert";
42
+ readonly appliedAs: "rewritten" | "dropped-shadowed" | "dropped-inert" | "minted";
39
43
  }) | (ReceiptBase & {
40
44
  readonly appliedAs: "refused";
41
45
  readonly reason: string;
@@ -1,12 +1,14 @@
1
1
  /** 本版登记的一次性**数据**迁移 id(闭集;每个 id 在 `ONE_TIME_MIGRATIONS` 登记表里恰一行)。收据只许这些 id —— 同表登记的 wire 删码位
2
2
  * (`WIRE_RETIREMENT_IDS`,`./one-time-migrations`)不改任何存储形,铸不出收据,不在本集。 */
3
- export const ONE_TIME_MIGRATION_IDS = ["SS-M1", "SS-M2", "SS-M3", "SS-M4", "SS-M5", "SS-M6", "SS-M7", "SS-M8", "SS-M9", "SS-M10"];
3
+ export const ONE_TIME_MIGRATION_IDS = ["SS-M1", "SS-M2", "SS-M3", "SS-M4", "SS-M5", "SS-M6", "SS-M7", "SS-M8", "SS-M9", "SS-M10", "SS-M11"];
4
4
  /**
5
5
  * 一条收据说迁移**对一个坐标做了什么**(闭集,每词一义):
6
6
  * - `moved` — 值搬到新位(`to`),义不变;
7
7
  * - `rewritten` — 同一坐标上的值换成今天的生效读法(例:URL 剥掉从不上线的 fragment、调度行的 durable 键重铸、6.x 的 worker 行换新形);
8
8
  * - `dropped-shadowed` — 删掉;它从来没生效过,因为另一个位赢了(例:`governance` 已设时 `runtime` 上的治理旧键、`sealedApiKey` 在场时的 `apiKeyEnv`);
9
9
  * - `dropped-inert` — 删掉;今天的读法本就不让它生效(例:超界的主机条目、引擎从不读的旧字段、空的retired 域文档);
10
- * - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么。
10
+ * - `refused` — 不改:要改就得替运维猜(或旧文档今天本就读不进);原样留着,读侧照旧响亮拒,`reason` 说为什么;
11
+ * - `minted` — 在**缺席处**写下一份新事实(一份部署决定),不改任何已有的值 —— 只有 SS-M11 铸(配置根的 `config.env-models.json`:
12
+ * 升级前「管模型面的目录整表顶替 env 模型」的读法,写成 `replaced`;不存在才建)。
11
13
  */
12
- export const MIGRATION_APPLIED_AS = ["moved", "rewritten", "dropped-shadowed", "dropped-inert", "refused"];
14
+ export const MIGRATION_APPLIED_AS = ["moved", "rewritten", "dropped-shadowed", "dropped-inert", "refused", "minted"];
package/dist/node.d.ts CHANGED
@@ -12,3 +12,4 @@ export * from "./scheduler-store-node.js";
12
12
  export { migrateConfigDirectory, migrateConfigDocuments, // 14.5.0:同一段「迁 → 整域终判」的同步口(入参是已有的存量文档,无 io)—— 目录形调的就是它的内核
13
13
  type ConfigDirectoryDocument, type ConfigDirectoryIo, type ConfigDirectoryMigration, type ConfigDirectoryRefusal, type ConfigDocumentsMigration, type MigrateConfigDirectoryOptions, type MigrateConfigDocumentsOptions, } from "./config-dir-migration.js";
14
14
  export { nodeConfigDirectoryIo } from "./config-dir-io.js";
15
+ export { migrateEnvModelsDecision, nodeConfigRootIo, readEnvModelsDecision, readMigrationMarker, writeEnvModelsDecision, type ConfigRootIo, type EnvModelsDecisionWrite, type EnvModelsMigration, type EnvModelsMint, } from "./config-root-node.js";
package/dist/node.js CHANGED
@@ -13,3 +13,5 @@ export * from "./scheduler-store-node.js"; // R7 self-wake scheduler store — f
13
13
  export { migrateConfigDirectory, migrateConfigDocuments, // 14.5.0:同一段「迁 → 整域终判」的同步口(入参是已有的存量文档,无 io)—— 目录形调的就是它的内核
14
14
  } from "./config-dir-migration.js";
15
15
  export { nodeConfigDirectoryIo } from "./config-dir-io.js"; // 上面那只函数的真 I/O 绑定:node:fs + 本包唯一的原子写器(config-document 模式规则)
16
+ // 配置根上的决定文档(config.env-models.json)与按 id 的运行记录(config.migration.<id>.json)的两只读者、决定文档的唯一写函数(运行记录由迁移独占创建),与一次性迁移 SS-M11 的迁移体(名字与闭集答案表在包根)。显式列名。
17
+ export { migrateEnvModelsDecision, nodeConfigRootIo, readEnvModelsDecision, readMigrationMarker, writeEnvModelsDecision, } from "./config-root-node.js";
@@ -14,8 +14,10 @@ export interface OneTimeMigrationWindow {
14
14
  * · `refused` — 读写两面拒,拒句点名本行 id(经 `migrationSignpost` 铸;钉:每个 `refused` 行的 id 在 `src/` 至少一处铸点,
15
15
  * 且非 `refused` 行零铸点);
16
16
  * · `rewritten-on-read` — 读时改写、不拒(SS-M3:调度店的下一个写者落盘),没有拒句可点名;
17
- * · `not-stored` — 没有存储形(wire 删码位),谈不上拒。 */
18
- readonly oldForm: "refused" | "rewritten-on-read" | "not-stored";
17
+ * · `not-stored` — 没有存储形(wire 删码位),谈不上拒;
18
+ * · `read-as-default` — 旧形是一份文档的**缺席**(SS-M11:配置根上没有 `config.env-models.json`),读者按它的缺省读(`kept`),不拒、没有拒句可点名 ——
19
+ * 缺省读出来的后果由读者自己的响亮臂说(引擎的模型面组拒句点名出路)。 */
20
+ readonly oldForm: "refused" | "rewritten-on-read" | "not-stored" | "read-as-default";
19
21
  /** 引入这条迁移的版本。 */
20
22
  readonly introducedIn: string;
21
23
  /** 该版本在 npm 上的发布日(UTC 日历日 YYYY-MM-DD)。`null` = 未发布形,由抬 `package.json` 到 `introducedIn` 的发布准备提交回填。 */