@sema-agent/settings-schema 27.1.0 → 28.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 (73) hide show
  1. package/CHANGELOG.md +505 -0
  2. package/README.md +17 -1
  3. package/conformance/VERSION +1 -1
  4. package/dist/api/auth-bridge.js +4 -3
  5. package/dist/api/auth.js +6 -5
  6. package/dist/api/credentials.js +9 -8
  7. package/dist/api/pull-token.js +2 -1
  8. package/dist/api/scopes.js +5 -4
  9. package/dist/center-refs.js +3 -2
  10. package/dist/config-dir-io.d.ts +1 -1
  11. package/dist/config-dir-io.js +3 -2
  12. package/dist/config-document-refusal.d.ts +1 -1
  13. package/dist/config-document-refusal.js +2 -1
  14. package/dist/config-fns.d.ts +4 -4
  15. package/dist/config-fns.js +17 -16
  16. package/dist/config-root-documents.js +4 -3
  17. package/dist/config-root-node.d.ts +1 -1
  18. package/dist/config-root-node.js +3 -2
  19. package/dist/conformance/derive.d.ts +3 -3
  20. package/dist/conformance/derive.js +6 -5
  21. package/dist/conformance/types.js +4 -3
  22. package/dist/cross-domain.js +6 -5
  23. package/dist/cross-session.js +3 -2
  24. package/dist/deep-freeze.d.ts +26 -0
  25. package/dist/deep-freeze.js +69 -0
  26. package/dist/default-model.js +2 -1
  27. package/dist/device-relay.d.ts +1 -1
  28. package/dist/device-relay.js +1 -1
  29. package/dist/env-model-table.js +2 -1
  30. package/dist/execution-lane-index.d.ts +1 -1
  31. package/dist/execution-lane-index.js +5 -4
  32. package/dist/execution-lanes.d.ts +2 -2
  33. package/dist/execution-lanes.js +18 -17
  34. package/dist/file-store.js +2 -1
  35. package/dist/fleet.d.ts +20 -4
  36. package/dist/fleet.js +32 -16
  37. package/dist/hooks-config.d.ts +12 -12
  38. package/dist/hooks-config.js +16 -15
  39. package/dist/hooks.d.ts +5 -5
  40. package/dist/hooks.js +17 -16
  41. package/dist/http-hook-allowlists.js +2 -1
  42. package/dist/index.js +1 -1
  43. package/dist/mcp-request-entry.js +2 -1
  44. package/dist/mcp-server-policy.js +3 -2
  45. package/dist/migration-receipt.d.ts +1 -1
  46. package/dist/migration-receipt.js +3 -2
  47. package/dist/one-time-migrations.js +3 -2
  48. package/dist/own-key-read.d.ts +3 -1
  49. package/dist/plain-json-object.d.ts +6 -3
  50. package/dist/plain-json-object.js +6 -3
  51. package/dist/portable-domains.js +4 -3
  52. package/dist/reserved-member-name.d.ts +1 -1
  53. package/dist/reserved-member-name.js +3 -2
  54. package/dist/resolve-roster.js +3 -2
  55. package/dist/retired-envs.js +3 -6
  56. package/dist/safety-merge-spec.d.ts +11 -4
  57. package/dist/safety-merge-spec.js +5 -4
  58. package/dist/secret-scan.js +1 -1
  59. package/dist/settings-sources.js +6 -5
  60. package/dist/settings-units.js +3 -2
  61. package/dist/types.d.ts +9 -9
  62. package/dist/types.js +27 -26
  63. package/dist/ui-language.js +4 -3
  64. package/dist/url-credential.js +4 -3
  65. package/dist/url-shape.d.ts +1 -1
  66. package/dist/url-shape.js +5 -4
  67. package/dist/web-admin-credential.js +2 -1
  68. package/dist/web-admin-env.d.ts +1 -1
  69. package/dist/web-admin-env.js +4 -3
  70. package/docs/CONSUMER-INTEGRATION.md +48 -3
  71. package/llms-full.txt +5 -3
  72. package/llms.txt +4 -2
  73. package/package.json +1 -1
@@ -0,0 +1,69 @@
1
+ const SET_MUTATORS = ["add", "delete", "clear"];
2
+ const MAP_MUTATORS = ["set", "delete", "clear"];
3
+ /** The Sets and Maps whose mutators are already guarded: freezing a collection that two tables share, or freezing a frozen constant again, is a no-op rather than a redefine error. */
4
+ const GUARDED = new WeakSet();
5
+ const refuse = (what) => () => {
6
+ throw new TypeError(`${what}: the object is frozen`);
7
+ };
8
+ function freezeGraph(value, seen) {
9
+ if (typeof value !== "object" || value === null || seen.has(value))
10
+ return;
11
+ seen.add(value);
12
+ const collection = value instanceof Set ? "Set" : value instanceof Map ? "Map" : undefined;
13
+ if (collection === undefined && !Array.isArray(value)) {
14
+ const proto = Object.getPrototypeOf(value);
15
+ if (proto !== Object.prototype && proto !== null)
16
+ return; // another prototype = someone else's object (zod schema, class instance, RegExp, Date …): not ours to freeze
17
+ }
18
+ // Every own data property: an array's elements, a table's entries, and anything attached to a Set / Map / array object itself (non-enumerable and symbol keys included).
19
+ for (const key of Reflect.ownKeys(value)) {
20
+ const d = Object.getOwnPropertyDescriptor(value, key);
21
+ if (d !== undefined && "value" in d)
22
+ freezeGraph(d.value, seen);
23
+ }
24
+ if (value instanceof Set)
25
+ for (const member of value)
26
+ freezeGraph(member, seen);
27
+ else if (value instanceof Map) {
28
+ for (const [k, v] of value) {
29
+ freezeGraph(k, seen);
30
+ freezeGraph(v, seen);
31
+ }
32
+ }
33
+ if (collection !== undefined && !GUARDED.has(value)) {
34
+ for (const name of collection === "Set" ? SET_MUTATORS : MAP_MUTATORS) {
35
+ Object.defineProperty(value, name, { value: refuse(`${collection}.${name}`), writable: false, enumerable: false, configurable: false });
36
+ }
37
+ GUARDED.add(value);
38
+ }
39
+ Object.freeze(value);
40
+ }
41
+ /**
42
+ * THE one freezer of every closed-set constant this package exports (package-private: not in the barrel, not on any subpath).
43
+ *
44
+ * A closed set — a word table, a code list, a limits record, a row table — is shared by every reader in the process. If one module can
45
+ * `push` / `sort` / assign into it, every other reader's closed set changes with it, while the declared type says `readonly`.
46
+ * So every exported container is frozen at its definition, all the way down, through this one function: the shallow
47
+ * `Object.freeze` of an outer array leaves its rows writable, and a `Set` is not stopped by `Object.freeze` at all.
48
+ *
49
+ * What it freezes — containers of data, reached through plain data properties:
50
+ * · arrays and plain objects (prototype `Object.prototype` or `null`): `Object.freeze`, after their members;
51
+ * · `Set` / `Map`: `Object.freeze` plus own, non-writable mutators (`add` / `delete` / `clear`, `set` / `delete` / `clear`) that throw a
52
+ * `TypeError`, after their members (a Map's keys and values both) and after any property attached to the collection object itself.
53
+ * What it leaves alone: functions, RegExps (stateful by design), symbols, primitives, and any object with another prototype (a zod
54
+ * schema, a class instance) — those are the library's or the class's own objects; a table that HOLDS them is frozen, they are not.
55
+ * Cycles are walked once; freezing the same collection twice (two tables sharing it) is a no-op the second time.
56
+ * The argument is returned (the same reference), typed as itself, so a declaration keeps the exact type it was written with.
57
+ *
58
+ * What a write does afterwards: an array method (`push` / `sort` / `splice` …) and a Set / Map method throw a `TypeError` in any caller;
59
+ * a plain assignment (`a[0] = x`, `t.k = v`, `a.length = 0`, `delete t.k`) throws in strict-mode code (ES modules, class bodies, TypeScript output)
60
+ * and is silently ignored in a sloppy-mode script — either way the constant keeps its value.
61
+ * The Set / Map guard stops every write made through the object's own methods (the accidental, in-process kind this exists for); a caller that reaches for
62
+ * `Set.prototype.add.call(set, x)` on purpose still gets through — the engine offers no way to lock a collection's internal slot, and an array or a plain object has no such hole.
63
+ *
64
+ * `test/closed-set-exports-frozen.test.ts` walks every export of every subpath and fails, by name, on any container this missed.
65
+ */
66
+ export function deepFreeze(value) {
67
+ freezeGraph(value, new WeakSet());
68
+ return value;
69
+ }
@@ -1,8 +1,9 @@
1
1
  import { resolveActiveTiers } from "./config-fns.js";
2
2
  import { tierLadderFrom } from "./tier-words.js";
3
+ import { deepFreeze } from "./deep-freeze.js";
3
4
  /** core 对 `default` 角色的档语义:从它的缺省档 `pro` 起**只向低档**扫 —— pro → flash → lite,绝不向上抓 max / ultra
4
5
  * (core `ROLE_TIER_DEFAULTS.default` + `DEFAULT_TIER_ORDER`;档序只在 `./tier-words` 一处,这里按起点派生;对拍钉对 devDependency 里精确钉住的那一版 core)。 */
5
- export const DEFAULT_ROLE_TIER_LADDER = tierLadderFrom("pro");
6
+ export const DEFAULT_ROLE_TIER_LADDER = deepFreeze(tierLadderFrom("pro"));
6
7
  /**
7
8
  * 缺省模型由 `roles.default` 的形分两路(一条规则:点名的走命名链,不点名的交回引擎):
8
9
  * · `{select}` ⇒ `{ kind: "select", select }`(见 {@link CatalogDefaultModel});
@@ -1,5 +1,5 @@
1
1
  /**
2
- * device 车道的设备入口 `DEVICE_RELAY_URL` 的**值文法** —— 唯一判官(16.0.0)。纯函数,浏览器安全;只 import 零依赖的 URL 形判官模块。
2
+ * device 车道的设备入口 `DEVICE_RELAY_URL` 的**值文法** —— 唯一判官(16.0.0)。纯函数,浏览器安全;只 import URL 形判官模块 `./url-shape`(它自己只 import 包内私有的零 import 叶 `./deep-freeze`)。
3
3
  *
4
4
  * ## 规则(一条)
5
5
  * 设备拨哪里是部署的必填声明,合法值只有两种:
@@ -1,5 +1,5 @@
1
1
  /**
2
- * device 车道的设备入口 `DEVICE_RELAY_URL` 的**值文法** —— 唯一判官(16.0.0)。纯函数,浏览器安全;只 import 零依赖的 URL 形判官模块。
2
+ * device 车道的设备入口 `DEVICE_RELAY_URL` 的**值文法** —— 唯一判官(16.0.0)。纯函数,浏览器安全;只 import URL 形判官模块 `./url-shape`(它自己只 import 包内私有的零 import 叶 `./deep-freeze`)。
3
3
  *
4
4
  * ## 规则(一条)
5
5
  * 设备拨哪里是部署的必填声明,合法值只有两种:
@@ -26,8 +26,9 @@ import { landCatalogWord } from "./tier-words.js";
26
26
  import { stableStringify } from "./hash.js";
27
27
  import { captureJson, dataDescriptor, isolatedObject } from "./own-key-read.js";
28
28
  import { ROSTER_CHEAP_ROLES, ROSTER_PRIMARY_ROLES } from "./resolve-roster.js";
29
+ import { deepFreeze } from "./deep-freeze.js";
29
30
  /** env 模型表的键名(闭集)。 */
30
- export const ENV_MODEL_TABLE_KEYS = { mainId: "MODEL_ID", cheapId: "MODEL_CHEAP_ID", verifier: "MODEL_VERIFIER", codeRoles: "MODEL_CODE_ROLES" };
31
+ export const ENV_MODEL_TABLE_KEYS = deepFreeze({ mainId: "MODEL_ID", cheapId: "MODEL_CHEAP_ID", verifier: "MODEL_VERIFIER", codeRoles: "MODEL_CODE_ROLES" });
31
32
  /** env 表里主模型的别名键(角色底的 `default` 绑它;引擎 env 表的条目键 = 这个别名 + 主 id + cheap id)。 */
32
33
  export const DEFAULT_MODEL_KEY = "default";
33
34
  /** cheap 槽铸出来的 id(不铸 ⇒ `undefined`)。 */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 车道表({@link EXECUTION_LANES})的两只**派生索引** + 「迁移能搬哪些逃生口键」的**一张**表,供 `types.ts`(写闸)与 `one-time-migrations.ts`(一次性迁移 SS-M12)同读。
3
3
  * 本模块是包内私有的:不进 `package.json` 的 `exports`(与 `secret-scan.ts` 同一姿势),主桶也不取它的任何名字 —— 索引、表、谓词是本包的实现细节,消费方只拿车道表本身。
4
- * (必需坐标算不算「缺」的唯一判官 `isBlankCoordinate` 不在这里:它住在零依赖的叶模块 `./execution-lanes`,包根与 `./execution-lanes` 子路径是同一只。)
4
+ * (必需坐标算不算「缺」的唯一判官 `isBlankCoordinate` 不在这里:它住在叶模块 `./execution-lanes`(只 import 包内私有的零 import 叶 `./deep-freeze`),包根与 `./execution-lanes` 子路径是同一只。)
5
5
  * 索引只从表派生,不另存任何词:表改了,这里跟着变。
6
6
  *
7
7
  * ## 迁移指路(7.0.1;11.0.0 起指路句住 `retired-form.ts`;16.0.0 起指路点名**哪一条**迁移)
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 车道表({@link EXECUTION_LANES})的两只**派生索引** + 「迁移能搬哪些逃生口键」的**一张**表,供 `types.ts`(写闸)与 `one-time-migrations.ts`(一次性迁移 SS-M12)同读。
3
3
  * 本模块是包内私有的:不进 `package.json` 的 `exports`(与 `secret-scan.ts` 同一姿势),主桶也不取它的任何名字 —— 索引、表、谓词是本包的实现细节,消费方只拿车道表本身。
4
- * (必需坐标算不算「缺」的唯一判官 `isBlankCoordinate` 不在这里:它住在零依赖的叶模块 `./execution-lanes`,包根与 `./execution-lanes` 子路径是同一只。)
4
+ * (必需坐标算不算「缺」的唯一判官 `isBlankCoordinate` 不在这里:它住在叶模块 `./execution-lanes`(只 import 包内私有的零 import 叶 `./deep-freeze`),包根与 `./execution-lanes` 子路径是同一只。)
5
5
  * 索引只从表派生,不另存任何词:表改了,这里跟着变。
6
6
  *
7
7
  * ## 迁移指路(7.0.1;11.0.0 起指路句住 `retired-form.ts`;16.0.0 起指路点名**哪一条**迁移)
@@ -10,6 +10,7 @@
10
10
  * 它们的保留名拒句只点名唯一写位。
11
11
  */
12
12
  import { EXECUTION_LANES } from "./execution-lanes.js";
13
+ import { deepFreeze } from "./deep-freeze.js";
13
14
  /** 一条车道的表行。词表与表行由 `execution-lanes.ts` 的 `satisfies Record<ExecutionLane, …>` 一一对应 ——
14
15
  * 找不到 = 本包自身的不变量坏了(不是输入错),所以抛。 */
15
16
  export function laneRowOf(lane) {
@@ -19,17 +20,17 @@ export function laneRowOf(lane) {
19
20
  return row;
20
21
  }
21
22
  /** 车道 env 名 → 归属。四栏两两不交、跨车道不交(`test/execution-lanes-7.0.0.test.ts` 钉),所以每个名恰好一个归属。 */
22
- export const LANE_ENV_OWNER = new Map(EXECUTION_LANES.flatMap((r) => {
23
+ export const LANE_ENV_OWNER = deepFreeze(new Map(EXECUTION_LANES.flatMap((r) => {
23
24
  const own = (names, secret, required) => names.map((k) => [k, { lane: r.lane, secret, required }]);
24
25
  return [...own(r.requiredEnv, false, true), ...own(r.optionalEnv, false, false), ...own(r.requiredSecretEnv, true, true), ...own(r.optionalSecretEnv, true, false)];
25
- }));
26
+ })));
26
27
  /** 一个车道 env 名在 WorkerSpec 里的**唯一写位**(保留键的拒因指路用它)。 */
27
28
  export function laneEnvSeat(name, owner) {
28
29
  return `runtime.execution.${owner.secret ? "secretRefs" : "coords"}.${name}`;
29
30
  }
30
31
  /** 7.0.0 之后才登记进车道表、而登记之前引擎就已在读的车道 env 名 → 改写它的迁移(只增不减;每有一个,在这里写一行)。16.0.0:`DEVICE_RELAY_URL`(device 行的必需坐标;
31
32
  * 此前 device 臂就读它而表漏登记,7.0.0–15.x 的写闸把它当普通 env 收下)→ SS-M12。登记之前没有任何已发引擎读过的新键(17.1.0 `DEVICE_TRUSTED_PROXY_CIDRS`)没有存量旧形可搬,不进本表。 */
32
- export const LATE_LANE_ENV_KEYS = lateLaneEnvKeys([["DEVICE_RELAY_URL", Object.freeze({ migration: "SS-M12", before: "16.0.0", onRow: "a row that declares runtime.execution" })]]);
33
+ export const LATE_LANE_ENV_KEYS = deepFreeze(lateLaneEnvKeys([["DEVICE_RELAY_URL", { migration: "SS-M12", before: "16.0.0", onRow: "a row that declares runtime.execution" }]]));
33
34
  /** 建 {@link LATE_LANE_ENV_KEYS}:每一行的名字必须在车道表里(载入时验,名字拼错 ⇒ 包载入即抛,不静默成一条永不命中的行)。 */
34
35
  function lateLaneEnvKeys(rows) {
35
36
  for (const [name] of rows) {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 执行车道 + 存储后端的**词表正本**(7.0.0,M-R2 WorkerSpec 结构块)。纯数据常量,外加三只纯判官函数(退役车道词的拒句 `retiredLaneWordRefusal`、
3
- * 车道坐标的空白判官 `isBlankCoordinate`、车道表合法性的唯一判官 `laneSetFlaws`〔18.0.0〕),零依赖(叶模块:本文件不 import 任何东西,`types.ts` 反过来引它)。
3
+ * 车道坐标的空白判官 `isBlankCoordinate`、车道表合法性的唯一判官 `laneSetFlaws`〔18.0.0〕),叶模块(本文件只 import 包内私有的零 import 叶 `./deep-freeze`〔全包闭集常量唯一的冻结入口〕,`types.ts` 反过来引它)。
4
4
  *
5
5
  * ## 为什么在这里
6
6
  * 车道词、每条车道读哪些 env、哪条车道分租户、存储后端词 —— 这几张表以前在四处各抄一份(引擎的能力表、
@@ -190,7 +190,7 @@ export declare const EXECUTION_LANES: readonly ExecutionLaneRow[];
190
190
  * 写闸对所有车道、所有必需坐标同判这一只;本地文件契约 `RemoteExecSpec`(`config.d/remote-exec.json`)的每个非空串字段(镜像 / 命名空间 / 主机 / 路径 / …)问的也是这一只(16.0.0 起:同一个部署声明在两处说,「空白」不再有两种读法);它只判「是不是空白」,不 trim 值、不管值的格式(格式不在这一条的范围:`" sandboxes "` 不是空白)。
191
191
  * 它只答「这个值是不是空白」,不管这个键是必需还是可选:据它**拒不拒**一个坐标,由调用方按键的必需 / 可选决定 —— 写闸只对必需坐标据它拒;个别可选坐标上空串有语义(如 `K8S_RUNTIME_CLASS` 的空串 = 不用 Kata),可选坐标的空串照收。
192
192
  *
193
- * 住在这个零依赖的叶模块里:包根(`export *`)与 `./execution-lanes` 子路径是**同一个函数对象** —— 只想问这一个问题的消费方走子路径,不必冷载入整只契约包桶;
193
+ * 住在这个叶模块里(它只 import 包内私有的零 import 叶 `./deep-freeze`):包根(`export *`)与 `./execution-lanes` 子路径是**同一个函数对象** —— 只想问这一个问题的消费方走子路径,不必冷载入整只契约包桶;
194
194
  * 车道表的派生索引与写闸也从这里 import,全包只有这一处函数体。
195
195
  */
196
196
  export declare function isBlankCoordinate(value: string): boolean;
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 执行车道 + 存储后端的**词表正本**(7.0.0,M-R2 WorkerSpec 结构块)。纯数据常量,外加三只纯判官函数(退役车道词的拒句 `retiredLaneWordRefusal`、
3
- * 车道坐标的空白判官 `isBlankCoordinate`、车道表合法性的唯一判官 `laneSetFlaws`〔18.0.0〕),零依赖(叶模块:本文件不 import 任何东西,`types.ts` 反过来引它)。
3
+ * 车道坐标的空白判官 `isBlankCoordinate`、车道表合法性的唯一判官 `laneSetFlaws`〔18.0.0〕),叶模块(本文件只 import 包内私有的零 import 叶 `./deep-freeze`〔全包闭集常量唯一的冻结入口〕,`types.ts` 反过来引它)。
4
4
  *
5
5
  * ## 为什么在这里
6
6
  * 车道词、每条车道读哪些 env、哪条车道分租户、存储后端词 —— 这几张表以前在四处各抄一份(引擎的能力表、
@@ -44,10 +44,11 @@
44
44
  * (`REMOTE_EXEC=remote-docker` 起服即拒;远端 docker 守护进程今天的真形 = `local-docker` + `DOCKER_HOST`)。
45
45
  * 它在退役词墓碑 {@link RETIRED_LANE_WORDS} 里:读到即拒,拒句带出路。
46
46
  */
47
+ import { deepFreeze } from "./deep-freeze.js";
47
48
  /** 可声明的执行车道闭集(= 引擎 `REMOTE_EXEC` 收的词,逐字同序;18.0.0 尾插 `none`)。 */
48
- export const EXECUTION_LANE_WORDS = ["host", "e2b", "k8s", "ssh", "adb", "local-docker", "device", "none"];
49
- export const RETIRED_LANE_WORDS = Object.freeze([
50
- Object.freeze(["remote-docker", "local-docker", "point it at the remote docker daemon with DOCKER_HOST (in a worker spec: runtime.execution.coords.DOCKER_HOST)"]),
49
+ export const EXECUTION_LANE_WORDS = deepFreeze(["host", "e2b", "k8s", "ssh", "adb", "local-docker", "device", "none"]);
50
+ export const RETIRED_LANE_WORDS = deepFreeze([
51
+ ["remote-docker", "local-docker", "point it at the remote docker daemon with DOCKER_HOST (in a worker spec: runtime.execution.coords.DOCKER_HOST)"],
51
52
  ]);
52
53
  /** 一个车道值是不是退役词:是 ⇒ 带出路的整句;否(现行词、不认识的词、非串)⇒ `undefined`。纯函数。 */
53
54
  export function retiredLaneWordRefusal(word) {
@@ -56,11 +57,11 @@ export function retiredLaneWordRefusal(word) {
56
57
  }
57
58
  /** 车道分不分租户(引擎能力表的 `tenantSeparation` 位,两档,没有「不表态」)。
58
59
  * `supported` = 每个租户的命令落在各自的目标上;`single-user-only` = 所有任务落同一个共享目标 ⇒ 只许单用户 worker。 */
59
- export const TENANT_SEPARATION_WORDS = ["supported", "single-user-only"];
60
+ export const TENANT_SEPARATION_WORDS = deepFreeze(["supported", "single-user-only"]);
60
61
  /** 分租户车道**凭什么**分租户(三档):`isolation` = 每个任务一只隔离的目标(microVM / pod / 容器);`principal-binding` = 目标绑在
61
62
  * 发起者身上(设备 ↔ principal 绑定),目标本身不隔离;`no-execution-target`(18.0.0)= 根本没有执行目标(工具没有执行环境),也就没有跨租户共享的目标 ——
62
63
  * 这一档还带一条集合规则:含这档车道的车道表只能有它这一项(判官 {@link laneSetFlaws} 读这一列)。只有 `tenantSeparation: "supported"` 的车道有依据。 */
63
- export const TENANT_SEPARATION_BASES = ["isolation", "principal-binding", "no-execution-target"];
64
+ export const TENANT_SEPARATION_BASES = deepFreeze(["isolation", "principal-binding", "no-execution-target"]);
64
65
  /** 逐车道一行。`satisfies Record<ExecutionLane, …>` = 词表加词而这里不加行 ⇒ 编译红。 */
65
66
  const LANE_ROWS = {
66
67
  /** server `config.ts` :4014 臂(无必需键);`execution-lane-caps.ts` :209 `single-user-only`(所有任务落 worker 宿主)。 */
@@ -189,18 +190,18 @@ function isStandaloneLane(lane) {
189
190
  /** 独占车道,按词表次序(从依据列现算)。 */
190
191
  const STANDALONE_LANES = EXECUTION_LANE_WORDS.filter(isStandaloneLane);
191
192
  /** 车道表(次序 = {@link EXECUTION_LANE_WORDS})。整张表深冻结 —— 它是唯一正本,消费方拿到的不许被改。 */
192
- export const EXECUTION_LANES = Object.freeze(EXECUTION_LANE_WORDS.map((lane) => {
193
+ export const EXECUTION_LANES = deepFreeze(EXECUTION_LANE_WORDS.map((lane) => {
193
194
  const row = LANE_ROWS[lane];
194
195
  const tenancy = row.tenantSeparation === "supported" ? { tenantSeparation: row.tenantSeparation, tenantSeparationBasis: row.tenantSeparationBasis } : { tenantSeparation: row.tenantSeparation };
195
- return Object.freeze({
196
+ return {
196
197
  lane,
197
198
  ...tenancy,
198
199
  singleReplica: row.singleReplica,
199
- requiredEnv: Object.freeze([...row.requiredEnv]),
200
- requiredSecretEnv: Object.freeze([...row.requiredSecretEnv]),
201
- optionalEnv: Object.freeze([...row.optionalEnv]),
202
- optionalSecretEnv: Object.freeze([...row.optionalSecretEnv]),
203
- });
200
+ requiredEnv: [...row.requiredEnv],
201
+ requiredSecretEnv: [...row.requiredSecretEnv],
202
+ optionalEnv: [...row.optionalEnv],
203
+ optionalSecretEnv: [...row.optionalSecretEnv],
204
+ };
204
205
  }));
205
206
  /**
206
207
  * 车道坐标的**唯一判官**:一个必需坐标「未设 / 空串 / 只含空白」一律算缺。本函数判其中的后两种,且只看**已经有的字符串值**:空串,或只含空白(`String.prototype.trim` 认的空白:空格 / 制表 / 换行 / 不换行空格 / 字节序标记 …)⇒ `true`;
@@ -208,7 +209,7 @@ export const EXECUTION_LANES = Object.freeze(EXECUTION_LANE_WORDS.map((lane) =>
208
209
  * 写闸对所有车道、所有必需坐标同判这一只;本地文件契约 `RemoteExecSpec`(`config.d/remote-exec.json`)的每个非空串字段(镜像 / 命名空间 / 主机 / 路径 / …)问的也是这一只(16.0.0 起:同一个部署声明在两处说,「空白」不再有两种读法);它只判「是不是空白」,不 trim 值、不管值的格式(格式不在这一条的范围:`" sandboxes "` 不是空白)。
209
210
  * 它只答「这个值是不是空白」,不管这个键是必需还是可选:据它**拒不拒**一个坐标,由调用方按键的必需 / 可选决定 —— 写闸只对必需坐标据它拒;个别可选坐标上空串有语义(如 `K8S_RUNTIME_CLASS` 的空串 = 不用 Kata),可选坐标的空串照收。
210
211
  *
211
- * 住在这个零依赖的叶模块里:包根(`export *`)与 `./execution-lanes` 子路径是**同一个函数对象** —— 只想问这一个问题的消费方走子路径,不必冷载入整只契约包桶;
212
+ * 住在这个叶模块里(它只 import 包内私有的零 import 叶 `./deep-freeze`):包根(`export *`)与 `./execution-lanes` 子路径是**同一个函数对象** —— 只想问这一个问题的消费方走子路径,不必冷载入整只契约包桶;
212
213
  * 车道表的派生索引与写闸也从这里 import,全包只有这一处函数体。
213
214
  */
214
215
  export function isBlankCoordinate(value) {
@@ -254,10 +255,10 @@ export function laneSetFlaws(lanes) {
254
255
  return flaws;
255
256
  }
256
257
  /** 存储后端(→ `DB_BACKEND`)。= server `src/config-types.ts` `DB_BACKEND_WORDS`(:67)逐字同序。 */
257
- export const STORE_BACKENDS = ["mysql", "pg", "local", "memory"];
258
+ export const STORE_BACKENDS = deepFreeze(["mysql", "pg", "local", "memory"]);
258
259
  /** session 店(→ `SESSION_BACKEND`)。= server `src/config.ts` :1760 `enumEnv("SESSION_BACKEND", …)` 的词表逐字同序
259
260
  * (`tidb` 不在集内:引擎见之拒启)。 */
260
- export const SESSION_BACKENDS = ["memory", "mysql", "auto"];
261
+ export const SESSION_BACKENDS = deepFreeze(["memory", "mysql", "auto"]);
261
262
  /** 记忆持久面方言(→ `MEMORY_ENGINE_BACKEND`)。16.0.0:MySQL 族那一只叫 `mysql`(此前 `tidb` —— 同一只 SQL 店有店词 `mysql` 与方言 `tidb` 两个字;
262
263
  * 收成一个字,与 {@link STORE_BACKENDS} 同字;硬破坏,`tidb` 读写两面拒、指路一次性迁移 SS-M12)。次序 file → pg → mysql。 */
263
- export const MEMORY_ENGINE_BACKENDS = ["file", "pg", "mysql"];
264
+ export const MEMORY_ENGINE_BACKENDS = deepFreeze(["file", "pg", "mysql"]);
@@ -33,6 +33,7 @@ import { RETIRED_DOMAIN_NAMES, configDPath, configDVersionOf, corruptDocumentRaw
33
33
  import { PORTABLE_DOMAINS } from "./portable-domains.js";
34
34
  import { REMOTE_EXEC_DOCUMENT } from "./remote-exec.js";
35
35
  import { isDomainName, isRetiredDomainName } from "./types.js";
36
+ import { deepFreeze } from "./deep-freeze.js";
36
37
  // 便携域表的定义住在纯叶 ./portable-domains.ts(14.6.0;零 node 依赖,主桶模块可 import);这里原名转出口,`./node` 子路径逐名不变。
37
38
  export { NON_PORTABLE_DOMAIN_REASONS, PORTABLE_DOMAINS } from "./portable-domains.js";
38
39
  /** `config.d/` 里**合法存在但不是域文档**的文件名(不进 `"unread-config-file"` 告警)。`remote-exec`
@@ -41,7 +42,7 @@ export { NON_PORTABLE_DOMAIN_REASONS, PORTABLE_DOMAINS } from "./portable-domain
41
42
  *
42
43
  * **导出**(3.0.0):一致性门的语料派生要按同一张表给本地腿的文件分类(域文件 / 专用文件 / 忽略),
43
44
  * 手抄一份必漂 —— 漂了的那一天,门会把一个合法的 `remote-exec.json` 报成未知文件。 */
44
- export const NON_DOMAIN_CONFIG_FILES = new Set([`${REMOTE_EXEC_DOCUMENT}.json`]);
45
+ export const NON_DOMAIN_CONFIG_FILES = deepFreeze(new Set([`${REMOTE_EXEC_DOCUMENT}.json`]));
45
46
  export class FileConfigStore {
46
47
  root;
47
48
  opts;
package/dist/fleet.d.ts CHANGED
@@ -153,9 +153,22 @@ export type RestartSignal = z.infer<typeof RestartSignal>;
153
153
  * not equality, and stays green.
154
154
  *
155
155
  * - {@link MODEL_ENTRY_REFUSAL_CODES} — why ONE catalog entry is not served on this host (the other entries keep serving):
156
- * `config.model_no_brain` — the entry's provider rides a brain this host has not mounted;
156
+ * `config.model_no_brain` — the entry's provider rides a brain this host has not mounted (no leg on this machine can serve it);
157
157
  * `config.model_entry_invalid` — the entry does not match the `ModelEntry` shape (dropped by the read, or re-judged at
158
- * the engine's own second boundary).
158
+ * the engine's own second boundary);
159
+ * `config.model_route_refused` — before counting the entry servable the server judged its route STATICALLY (the entry's
160
+ * endpoint × whether it carries a credential) with the engine's route-pairing law, and the engine refused the pair (for instance,
161
+ * today: a request carrying a credential would go over cleartext `http:` to another host): this entry is not served, the other
162
+ * entries keep serving. The JUDGE is the engine — neither this package nor the server re-judges — and the detail of the refusal,
163
+ * the engine's own code, is the engine's: it rides outside this word, relayed by the server verbatim on its own read surface and
164
+ * log. This is one generic word: it does not split into more words when the engine's route judge learns to refuse more.
165
+ * Boundary with the other two: `config.model_no_brain` is "no leg on this machine can serve the entry" and
166
+ * `config.model_entry_invalid` is "the entry's own shape is wrong"; this word is "the shape is right and a leg exists, but the
167
+ * engine's route judge does not let the entry through". It is not `config.model_route_endpoint_missing` of
168
+ * {@link MODEL_PLANE_REFUSAL_CODES} either (an openai-compatible route of the CANDIDATE resolves to no endpoint, which refuses the
169
+ * whole model plane): the two sets are disjoint and a reader tells them apart by where the code rides (an `entries` value or `plane`).
170
+ * The word is named HERE first (a contract word: this package names it and the refusing side mints it — the server, relaying the
171
+ * engine's verdict under it; this package does not verify engine behaviour).
159
172
  * - {@link MODEL_PLANE_REFUSAL_CODES} — why the model plane of a candidate catalog was refused AS A GROUP
160
173
  * (the model plane in service keeps serving). The first four words mirror the engine's group-refusal code TABLE as a
161
174
  * whole family — never picked by which invariant is reachable on the hot path today (reachability moves, the table
@@ -185,10 +198,11 @@ export type RestartSignal = z.infer<typeof RestartSignal>;
185
198
  * reads as unset (it falls back down the role chain and the engine says so once) — no reading refuses a model plane for it, so it was never
186
199
  * an engine group refusal. A reader still holding it gets it dropped by {@link readModelRefusals} like any code outside the set.
187
200
  */
188
- export declare const MODEL_ENTRY_REFUSAL_CODES: readonly ["config.model_no_brain", "config.model_entry_invalid"];
201
+ export declare const MODEL_ENTRY_REFUSAL_CODES: readonly ["config.model_no_brain", "config.model_entry_invalid", "config.model_route_refused"];
189
202
  export declare const ModelEntryRefusalCode: z.ZodEnum<{
190
203
  "config.model_no_brain": "config.model_no_brain";
191
204
  "config.model_entry_invalid": "config.model_entry_invalid";
205
+ "config.model_route_refused": "config.model_route_refused";
192
206
  }>;
193
207
  export type ModelEntryRefusalCode = z.infer<typeof ModelEntryRefusalCode>;
194
208
  /** The env-model-table confirmation gate's group-refusal code (see {@link MODEL_PLANE_REFUSAL_CODES}). */
@@ -222,7 +236,9 @@ export type ModelPlaneRefusalCode = z.infer<typeof ModelPlaneRefusalCode>;
222
236
  * - `entries` — catalog entry NAME → its code. The value is ONLY the code, on purpose: the engine's refusal fact also
223
237
  * holds the upstream `id`, the `provider` word, the bad field keys and an operator sentence, and none of them rides
224
238
  * here — an `entry_invalid` row is by definition one nothing validated, so its `id` / `provider` may be whatever the
225
- * broken row held, and the sentence is prose, not contract. "Which name, which reason" is the whole wire. A name that
239
+ * broken row held, and the sentence is prose, not contract. "Which name, which reason" is the whole wire;
240
+ * under `config.model_route_refused` the verdict is the engine's route judge's, relayed by the server — the engine's own code for it
241
+ * stays outside this wire (see {@link MODEL_ENTRY_REFUSAL_CODES}). A name that
226
242
  * cannot ride out is treated as NAMELESS — the engine leaves it out of this map entirely (not keyed, not counted). The
227
243
  * ONE predicate is `isReportableRefusalName(name)` (main barrel): this schema can carry the key (non-empty; `__proto__`
228
244
  * is silently dropped by the record, so it cannot) AND `isDisclosableIdentity(name)` (an identifier in the closed allowlist
package/dist/fleet.js CHANGED
@@ -24,6 +24,7 @@ import { parseDeclared } from "./declared-capture.js";
24
24
  import { dataDescriptor, isolatedObject, readDeclaredKey, ownValueOf } from "./own-key-read.js";
25
25
  import { isPlainJsonObject } from "./plain-json-object.js";
26
26
  import { buildQuotedIssue } from "./quoted-issue.js";
27
+ import { deepFreeze } from "./deep-freeze.js";
27
28
  // ── Web-admin's fleet endpoints (paths, one spelling) ─────────────────────────────────────────────────────
28
29
  /**
29
30
  * Web-admin's `/api/fleet/*` endpoints that are addressed from outside web-admin, relative to its origin. ONE spelling: whoever
@@ -41,13 +42,13 @@ import { buildQuotedIssue } from "./quoted-issue.js";
41
42
  * with the URL-encoded host id); the other values have none and are the path itself. A prefix router (an Ingress rule) takes the
42
43
  * template up to its first `{`.
43
44
  */
44
- export const FLEET_PATHS = {
45
+ export const FLEET_PATHS = deepFreeze({
45
46
  instances: "/api/fleet/instances",
46
47
  usage: "/api/fleet/usage",
47
48
  quotaLeases: "/api/fleet/leases",
48
49
  servingLease: "/api/fleet/live/serving-lease",
49
50
  hostPlanner: "/api/fleet/live/host-planner/{host}",
50
- };
51
+ });
51
52
  /**
52
53
  * The LIVENESS group — the fleet endpoints a web-admin answers without its readiness gate and without its config-governance gates
53
54
  * (they read no config domain and take service credentials only), so that a web-admin whose management face is refused never turns
@@ -60,11 +61,11 @@ export const FLEET_PATHS = {
60
61
  * `@sema-agent/settings-schema/fleet-paths.json` is `{ "FLEET_PATHS": …, "FLEET_LIVE_PATHS": … }`, written from these values at
61
62
  * build time — never edited by hand.
62
63
  */
63
- export const FLEET_LIVE_PATHS = [FLEET_PATHS.instances, FLEET_PATHS.servingLease, FLEET_PATHS.hostPlanner];
64
+ export const FLEET_LIVE_PATHS = deepFreeze([FLEET_PATHS.instances, FLEET_PATHS.servingLease, FLEET_PATHS.hostPlanner]);
64
65
  // ── Domain 1: drain protocol (graceful rolling update — the ground every form stands on) ──────────────────
65
66
  /** Lifecycle of a draining instance. `running`→`draining` on the stop signal; `drained` once in-flight hits
66
67
  * zero (clean) or the grace deadline forces the issue. Exit always follows `drained`. */
67
- export const DRAIN_PHASES = ["running", "draining", "drained"];
68
+ export const DRAIN_PHASES = deepFreeze(["running", "draining", "drained"]);
68
69
  /** Shipped default (server 1.96.0): generous by design — the only unrecoverable loss on restart is the
69
70
  * interactive turn currently streaming, so we wait long rather than cut short. Deployments override via
70
71
  * DRAIN_GRACE_MS; web-admin overrides per-worker through the worker spec. */
@@ -137,7 +138,7 @@ const Generation = z.string().refine(isCanonicalGeneration, buildQuotedIssue `a
137
138
  * Only a fleet member says it: an engine without a generation has no lease and carries no `leaseState` at all (there is no
138
139
  * fifth word for "not a member" — absence is that).
139
140
  */
140
- export const LEASE_STATES = ["none", "granted", "expired", "denied"];
141
+ export const LEASE_STATES = deepFreeze(["none", "granted", "expired", "denied"]);
141
142
  export const LeaseState = z.enum(LEASE_STATES);
142
143
  /**
143
144
  * "This instance must restart to apply config" — the engine's OWN observation (S-741), defined ONCE. It is part of the engine's
@@ -221,9 +222,22 @@ function readSignalBody(body, pick, schema) {
221
222
  * not equality, and stays green.
222
223
  *
223
224
  * - {@link MODEL_ENTRY_REFUSAL_CODES} — why ONE catalog entry is not served on this host (the other entries keep serving):
224
- * `config.model_no_brain` — the entry's provider rides a brain this host has not mounted;
225
+ * `config.model_no_brain` — the entry's provider rides a brain this host has not mounted (no leg on this machine can serve it);
225
226
  * `config.model_entry_invalid` — the entry does not match the `ModelEntry` shape (dropped by the read, or re-judged at
226
- * the engine's own second boundary).
227
+ * the engine's own second boundary);
228
+ * `config.model_route_refused` — before counting the entry servable the server judged its route STATICALLY (the entry's
229
+ * endpoint × whether it carries a credential) with the engine's route-pairing law, and the engine refused the pair (for instance,
230
+ * today: a request carrying a credential would go over cleartext `http:` to another host): this entry is not served, the other
231
+ * entries keep serving. The JUDGE is the engine — neither this package nor the server re-judges — and the detail of the refusal,
232
+ * the engine's own code, is the engine's: it rides outside this word, relayed by the server verbatim on its own read surface and
233
+ * log. This is one generic word: it does not split into more words when the engine's route judge learns to refuse more.
234
+ * Boundary with the other two: `config.model_no_brain` is "no leg on this machine can serve the entry" and
235
+ * `config.model_entry_invalid` is "the entry's own shape is wrong"; this word is "the shape is right and a leg exists, but the
236
+ * engine's route judge does not let the entry through". It is not `config.model_route_endpoint_missing` of
237
+ * {@link MODEL_PLANE_REFUSAL_CODES} either (an openai-compatible route of the CANDIDATE resolves to no endpoint, which refuses the
238
+ * whole model plane): the two sets are disjoint and a reader tells them apart by where the code rides (an `entries` value or `plane`).
239
+ * The word is named HERE first (a contract word: this package names it and the refusing side mints it — the server, relaying the
240
+ * engine's verdict under it; this package does not verify engine behaviour).
227
241
  * - {@link MODEL_PLANE_REFUSAL_CODES} — why the model plane of a candidate catalog was refused AS A GROUP
228
242
  * (the model plane in service keeps serving). The first four words mirror the engine's group-refusal code TABLE as a
229
243
  * whole family — never picked by which invariant is reachable on the hot path today (reachability moves, the table
@@ -253,18 +267,18 @@ function readSignalBody(body, pick, schema) {
253
267
  * reads as unset (it falls back down the role chain and the engine says so once) — no reading refuses a model plane for it, so it was never
254
268
  * an engine group refusal. A reader still holding it gets it dropped by {@link readModelRefusals} like any code outside the set.
255
269
  */
256
- export const MODEL_ENTRY_REFUSAL_CODES = ["config.model_no_brain", "config.model_entry_invalid"];
270
+ export const MODEL_ENTRY_REFUSAL_CODES = deepFreeze(["config.model_no_brain", "config.model_entry_invalid", "config.model_route_refused"]);
257
271
  export const ModelEntryRefusalCode = z.enum(MODEL_ENTRY_REFUSAL_CODES);
258
272
  /** The env-model-table confirmation gate's group-refusal code (see {@link MODEL_PLANE_REFUSAL_CODES}). */
259
273
  export const CATALOG_REPLACES_ENV_MODELS_CODE = "config.catalog_replaces_env_models";
260
- export const MODEL_PLANE_REFUSAL_CODES = [
274
+ export const MODEL_PLANE_REFUSAL_CODES = deepFreeze([
261
275
  "config.default_model_missing",
262
276
  "config.model_refused_name_minted",
263
277
  "config.model_route_endpoint_missing",
264
278
  "config.gateway_fallback_without_primary",
265
279
  CATALOG_REPLACES_ENV_MODELS_CODE,
266
280
  "config.model_catalog_refused",
267
- ];
281
+ ]);
268
282
  export const ModelPlaneRefusalCode = z.enum(MODEL_PLANE_REFUSAL_CODES);
269
283
  /**
270
284
  * "This instance does not serve part (or all) of the model catalog it was handed" — the engine's OWN per-host verdict
@@ -285,7 +299,9 @@ export const ModelPlaneRefusalCode = z.enum(MODEL_PLANE_REFUSAL_CODES);
285
299
  * - `entries` — catalog entry NAME → its code. The value is ONLY the code, on purpose: the engine's refusal fact also
286
300
  * holds the upstream `id`, the `provider` word, the bad field keys and an operator sentence, and none of them rides
287
301
  * here — an `entry_invalid` row is by definition one nothing validated, so its `id` / `provider` may be whatever the
288
- * broken row held, and the sentence is prose, not contract. "Which name, which reason" is the whole wire. A name that
302
+ * broken row held, and the sentence is prose, not contract. "Which name, which reason" is the whole wire;
303
+ * under `config.model_route_refused` the verdict is the engine's route judge's, relayed by the server — the engine's own code for it
304
+ * stays outside this wire (see {@link MODEL_ENTRY_REFUSAL_CODES}). A name that
289
305
  * cannot ride out is treated as NAMELESS — the engine leaves it out of this map entirely (not keyed, not counted). The
290
306
  * ONE predicate is `isReportableRefusalName(name)` (main barrel): this schema can carry the key (non-empty; `__proto__`
291
307
  * is silently dropped by the record, so it cannot) AND `isDisclosableIdentity(name)` (an identifier in the closed allowlist
@@ -430,7 +446,7 @@ export const InstanceHealth = z
430
446
  * - `observer-not-ready` — the reconciler's own observation vetoes it (stored rows only; the SECOND source, AND-merged).
431
447
  * - `draining` — the engine says it is draining.
432
448
  * - `not-ready` — the engine says it is not ready. */
433
- export const NOT_ROUTABLE_CODES = ["no-engine-signal", "stale", "observer-not-ready", "draining", "not-ready"];
449
+ export const NOT_ROUTABLE_CODES = deepFreeze(["no-engine-signal", "stale", "observer-not-ready", "draining", "not-ready"]);
434
450
  const notRoutable = (code) => {
435
451
  switch (code) {
436
452
  case "no-engine-signal":
@@ -637,7 +653,7 @@ export const ServingLeaseRequest = z.object({
637
653
  * - `retired` — web-admin has retired this instance (or the worker it belongs to).
638
654
  * Only {@link ServingLeaseResponse}'s `denied` arm carries a reason; `unknown` has none, by shape.
639
655
  */
640
- export const SERVING_LEASE_DENIED_REASONS = ["superseded", "retired"];
656
+ export const SERVING_LEASE_DENIED_REASONS = deepFreeze(["superseded", "retired"]);
641
657
  export const ServingLeaseDeniedReason = z.enum(SERVING_LEASE_DENIED_REASONS);
642
658
  const ServingLeaseGranted = z.object({ verdict: z.literal("granted"), ttlMs: INTEGER.positive() });
643
659
  const ServingLeaseDenied = z.object({ verdict: z.literal("denied"), reason: ServingLeaseDeniedReason });
@@ -676,7 +692,7 @@ const ServingLeaseDeniedRead = z.object({
676
692
  const ServingLeaseReadFace = z.discriminatedUnion("verdict", [ServingLeaseGranted, ServingLeaseDeniedRead, ServingLeaseUnknown]);
677
693
  /** The verdict words as a runtime list. `satisfies` bites a word the union does not have; the converse (a union arm missing
678
694
  * from this list) is pinned by a test that reads the union's discriminators. */
679
- export const SERVING_LEASE_VERDICTS = ["granted", "denied", "unknown"];
695
+ export const SERVING_LEASE_VERDICTS = deepFreeze(["granted", "denied", "unknown"]);
680
696
  /** Web-admin side: the request body of a serving-lease renewal. Shape mismatch / non-object / throwing accessor ⇒ `undefined`,
681
697
  * never throws (same guarded reader as every other read in this file). */
682
698
  export function readServingLeaseRequest(body) {
@@ -815,7 +831,7 @@ export const DrainRequest = z.object({
815
831
  });
816
832
  /** What a drain request leaves the engine in: `draining` — this call put it into draining; `already_draining` — it already was
817
833
  * (the same action repeated), and the receipt reports the first call's facts. */
818
- export const DRAIN_RECEIPT_STATES = ["draining", "already_draining"];
834
+ export const DRAIN_RECEIPT_STATES = deepFreeze(["draining", "already_draining"]);
819
835
  export const DrainReceiptState = z.enum(DRAIN_RECEIPT_STATES);
820
836
  /** The drain endpoint's answer: the engine's draining fact ({@link EngineDraining} — the same object {@link EngineSignal}
821
837
  * carries as `draining`, extended, not copied) plus how this call found the engine. */
@@ -829,7 +845,7 @@ export function readDrainReceipt(body) {
829
845
  return readSignalBody(body, WHOLE_BODY, DrainReceipt);
830
846
  }
831
847
  // ── Domain 3: dispatch policy (traffic + failover + LB — three domains, one gateway) ──────────────────────
832
- export const DISPATCH_STRATEGIES = ["round-robin", "least-inflight", "consistent-hash"];
848
+ export const DISPATCH_STRATEGIES = deepFreeze(["round-robin", "least-inflight", "consistent-hash"]);
833
849
  /** Per-worker dispatch policy (web-admin-configured; the gateway is OPTIONAL — D3: TOC/self-maintained TOB go
834
850
  * direct, sema-managed fleets route through /api/dispatch). Strategy is an enum on purpose: a new LB
835
851
  * algorithm is a new value, not a new skeleton. */
@@ -108,8 +108,8 @@ declare const HOOK_SHELLS: readonly ["bash", "powershell"];
108
108
  * The row order also decides which field an already-bad entry names (the first wrong one), so a column added later goes at the TAIL of its row (after the shared fields): adding one never
109
109
  * moves an answer the table already gave.
110
110
  */
111
- export declare const HOOK_ENTRY_FIELDS: Readonly<{
112
- command: Readonly<{
111
+ export declare const HOOK_ENTRY_FIELDS: {
112
+ readonly command: {
113
113
  readonly rewakeMessage: "nonEmpty?";
114
114
  readonly rewakeSummary: "nonEmpty?";
115
115
  readonly cloud: "any?";
@@ -123,8 +123,8 @@ export declare const HOOK_ENTRY_FIELDS: Readonly<{
123
123
  readonly async: "boolean?";
124
124
  readonly asyncRewake: "boolean?";
125
125
  readonly onFailure: "onFailure?";
126
- }>;
127
- prompt: Readonly<{
126
+ };
127
+ readonly prompt: {
128
128
  readonly continueOnBlock: "boolean?";
129
129
  readonly if: "string?";
130
130
  readonly timeout: "seconds?";
@@ -132,16 +132,16 @@ export declare const HOOK_ENTRY_FIELDS: Readonly<{
132
132
  readonly once: "boolean?";
133
133
  readonly prompt: "text";
134
134
  readonly model: "string?";
135
- }>;
136
- agent: Readonly<{
135
+ };
136
+ readonly agent: {
137
137
  readonly if: "string?";
138
138
  readonly timeout: "seconds?";
139
139
  readonly statusMessage: "string?";
140
140
  readonly once: "boolean?";
141
141
  readonly prompt: "text";
142
142
  readonly model: "string?";
143
- }>;
144
- http: Readonly<{
143
+ };
144
+ readonly http: {
145
145
  readonly cloud: "any?";
146
146
  readonly if: "string?";
147
147
  readonly timeout: "seconds?";
@@ -151,8 +151,8 @@ export declare const HOOK_ENTRY_FIELDS: Readonly<{
151
151
  readonly headers: "stringRecord?";
152
152
  readonly allowedEnvVars: "stringList?";
153
153
  readonly onFailure: "onFailure?";
154
- }>;
155
- mcp_tool: Readonly<{
154
+ };
155
+ readonly mcp_tool: {
156
156
  readonly if: "string?";
157
157
  readonly timeout: "seconds?";
158
158
  readonly statusMessage: "string?";
@@ -160,8 +160,8 @@ export declare const HOOK_ENTRY_FIELDS: Readonly<{
160
160
  readonly server: "string";
161
161
  readonly tool: "string";
162
162
  readonly input: "record?";
163
- }>;
164
- }>;
163
+ };
164
+ };
165
165
  /** The type of {@link HOOK_ENTRY_FIELDS}: per entry type, field name → field kind (literal types). */
166
166
  export type HookEntryFields = typeof HOOK_ENTRY_FIELDS;
167
167
  type HookFieldBaseValue<B> = B extends "text" | "nonEmpty" | "string" ? string : B extends "shell" ? (typeof HOOK_SHELLS)[number] : B extends "onFailure" ? HookOnFailure : B extends "any" ? unknown : B extends "boolean" ? boolean : B extends "seconds" ? number : B extends "stringRecord" ? Record<string, string> : B extends "stringList" | "argv" ? string[] : B extends "record" ? Record<string, unknown> : never;