@sema-agent/settings-schema 31.1.0 → 32.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 (58) hide show
  1. package/CHANGELOG.md +753 -0
  2. package/README.md +79 -17
  3. package/conformance/VERSION +1 -1
  4. package/conformance/cases/c97-roles-own-proto-key-entry-dropped/expected.json +105 -0
  5. package/conformance/cases/c97-roles-own-proto-key-entry-dropped/input.json +26 -0
  6. package/conformance/cases/c97-roles-own-proto-key-entry-dropped/meta.json +6 -0
  7. package/dist/api/auth.d.ts +1 -1
  8. package/dist/api/feedback.d.ts +3 -3
  9. package/dist/api/feedback.js +3 -2
  10. package/dist/center-refs.d.ts +1 -1
  11. package/dist/center-refs.js +1 -1
  12. package/dist/config-fns.d.ts +14 -3
  13. package/dist/config-fns.js +49 -12
  14. package/dist/config-root-documents.js +1 -1
  15. package/dist/conformance/contract-adapter.js +18 -1
  16. package/dist/declared-capture.d.ts +1 -1
  17. package/dist/declared-capture.js +5 -1
  18. package/dist/device-lane-knobs.d.ts +57 -0
  19. package/dist/device-lane-knobs.js +127 -0
  20. package/dist/execution-lanes.d.ts +3 -1
  21. package/dist/execution-lanes.js +3 -1
  22. package/dist/fleet.d.ts +5 -5
  23. package/dist/fleet.js +4 -3
  24. package/dist/hooks-config.d.ts +47 -23
  25. package/dist/hooks-config.js +93 -134
  26. package/dist/hooks.d.ts +26 -22
  27. package/dist/hooks.js +17 -8
  28. package/dist/host-path.d.ts +9 -5
  29. package/dist/host-path.js +9 -20
  30. package/dist/index.d.ts +2 -0
  31. package/dist/index.js +2 -0
  32. package/dist/ip-address.d.ts +19 -0
  33. package/dist/ip-address.js +28 -0
  34. package/dist/loopback.d.ts +3 -11
  35. package/dist/loopback.js +11 -12
  36. package/dist/mcp-request-entry.js +4 -6
  37. package/dist/migration-receipt.d.ts +1 -1
  38. package/dist/migration-receipt.js +1 -1
  39. package/dist/one-time-migrations.d.ts +1 -1
  40. package/dist/one-time-migrations.js +257 -62
  41. package/dist/plain-json-object.d.ts +5 -8
  42. package/dist/plain-json-object.js +5 -8
  43. package/dist/record-seat.d.ts +35 -0
  44. package/dist/record-seat.js +97 -0
  45. package/dist/reserved-member-name.d.ts +8 -3
  46. package/dist/reserved-member-name.js +10 -3
  47. package/dist/retired-envs.js +10 -0
  48. package/dist/safety-merge-spec.d.ts +11 -3
  49. package/dist/safety-merge-spec.js +3 -2
  50. package/dist/types.d.ts +404 -112
  51. package/dist/types.js +132 -73
  52. package/docs/API-SURFACE.md +23 -6
  53. package/docs/CC-DIVERGENCE.md +11 -2
  54. package/docs/CONFORMANCE.md +2 -2
  55. package/docs/CONSUMER-INTEGRATION.md +157 -6
  56. package/llms-full.txt +31 -18
  57. package/llms.txt +11 -7
  58. package/package.json +7 -6
package/dist/types.js CHANGED
@@ -22,7 +22,7 @@ import { MAX_EXTRA_BODY_DEPTH } from "./hash.js"; // reconcile the extraBody dep
22
22
  import { DispatchPolicy, FLEET_GENERATION_ENV, FLEET_SCOPE_ENV } from "./fleet.js"; // WorkerSpec.fleet.dispatch (scheduling framework D3)
23
23
  import { isLoopbackAuthHost } from "./loopback.js";
24
24
  import { isJsonArray, isPlainJsonObject } from "./plain-json-object.js"; // THE "is this a JSON object" predicate + the total array test
25
- import { appendOwn, guardedSafeParse, isAccessorDescriptor, ownEntriesOf } from "./own-key-read.js"; // the one spelling of "is this descriptor an accessor" (its own fields only) + the one guarded zod verdict
25
+ import { appendOwn, guardedSafeParse, isAccessorDescriptor } from "./own-key-read.js"; // the one spelling of "is this descriptor an accessor" (its own fields only) + the one guarded zod verdict
26
26
  import { httpUrlFlaws, httpUrlRule } from "./url-shape.js"; // 11.0.0: THE URL shape judge // 11.0.0: the one narrow「本机」predicate (auth relaxation)
27
27
  import { secretScanForms } from "./secret-scan.js"; // package-private normalization — the one set of forms both scanners read (not in the barrel)
28
28
  import { WEB_ADMIN_ENV } from "./web-admin-env.js"; // the three connection keys the config renderer writes are reserved worker env
@@ -34,10 +34,11 @@ import { LANE_ENV_OWNER, LATE_LANE_ENV_KEYS, laneEnvSeat, laneRowOf } from "./ex
34
34
  import { migrationSignpost, retiredFormSentence, retiredKey } from "./retired-form.js"; // 11.0.0: the ONE retired-form sentence + key tombstone (package-private)
35
35
  import { retiredRoleWordsRefusal } from "./retired-role-words.js"; // 12.0.0: the retired role-word tombstone (package-private)
36
36
  import { buildQuotedIssue, fixed } from "./quoted-issue.js"; // THE minting point of custom issues (package-private)
37
- import { RESERVED_MEMBER_NAMES, isReservedMemberName } from "./reserved-member-name.js"; // 18.0.0: the one reserved-member-name table (the record reader and the center-refs resolver ask the same predicate)
38
- import { AbsoluteHostPath } from "./host-path.js"; // the one host-path shape judge (a task's cwd and a project's folder / file entries)
37
+ import { RECORD_MEMBER_NAME, partialRecordOf, recordOf } from "./record-seat.js"; // the one way to mint a record seat (its guard refuses a reserved own member name — the table the record reader and the center-refs resolver read) · the judge every name that keys a record seat starts from (worker name, catalog entry name, HTTP header name: a reserved name is refused where the name is minted)
38
+ import { AbsoluteHostPath } from "./host-path.js"; // the zod seat of the one host-path shape judge (a task's cwd and a project's folder / file entries)
39
39
  import { RFC3339_DATE_TIME } from "./rfc3339.js"; // the package's one RFC 3339 date-time judge (package-private)
40
40
  import { DEVICE_RELAY_RULE, deviceRelayFlaws } from "./device-relay.js"; // 16.0.0: the value grammar of the device lane's DEVICE_RELAY_URL (ws(s) URL or the literal none)
41
+ import { DEVICE_MAX_PREAUTH_PER_REMOTE_RULE, DEVICE_TRUSTED_PROXY_CIDRS_RULE, readDeviceMaxPreAuthPerRemote, readDeviceTrustedProxyCidrs } from "./device-lane-knobs.js"; // the value grammar of the device lane's two optional knobs (the one judge; engine boot reads the same)
41
42
  import { TOOL_WIRE_NAME_MAX_CHARS, isUsableWireName } from "./wire-name.js"; // 18.0.0: the one "usable wire name" judge (the a2a peer name; the request-plane MCP / A2A readers ask the same function)
42
43
  import { deepFreeze } from "./deep-freeze.js";
43
44
  import { McpEntryCredential } from "./mcp-entry-credential.js"; // 29.0.0: the http entry's credential reference (the one reading = the engine primitives' readCredentialRef)
@@ -108,7 +109,8 @@ export const hasNul = (s) => s.includes("\0");
108
109
  /** The params of a custom issue's sentence and their one rendering live in the package-private minting module `./quoted-issue`
109
110
  * (one minting point for the whole package); re-exported here unchanged. */
110
111
  export { renderQuotedSentence } from "./quoted-issue.js";
111
- /** The one host-path shape judge (a task's `cwd`, a project's `folder` / `file` entries) lives in its leaf module `./host-path`. */
112
+ /** The one host-path shape judge (a task's `cwd`, a project's `folder` / `file` entries) is the engine primitives package's `isAbsoluteHostPath`; its leaf module `./host-path`
113
+ * re-exports that function and the length bound (the same objects, not copies) and holds the zod seat `AbsoluteHostPath`. */
112
114
  export { ABSOLUTE_HOST_PATH_MAX, AbsoluteHostPath, isAbsoluteHostPath } from "./host-path.js";
113
115
  /** Does `s` contain a secret-shaped token? —— **the one scanner** (11.0.0, S-1274): the write side (this detector, behind every
114
116
  * free-text write port — NON_SECRET_URL, mcp stdio, execution coords, ssh login, worker env, extraBody, …) and the display side
@@ -468,8 +470,9 @@ export const ModelThinkingLevelMap = z
468
470
  .object(Object.fromEntries(MODEL_THINKING_LEVEL_WORDS.map((word) => [word, ThinkingLevelSpelling.optional()])))
469
471
  .strict();
470
472
  export const ModelEntry = z.object({
471
- /** Catalog key + `@name` mention handle (stable, url/word-safe), e.g. "model-a". */
472
- name: z.string().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/i, "letters/digits/._- , no spaces"),
473
+ /** Catalog key + `@name` mention handle (stable, url/word-safe), e.g. "model-a". It keys record seats (`budget.perModel`, the refusal signal's
474
+ * `entries`), so it starts from {@link RECORD_MEMBER_NAME}: `constructor` / `prototype` are refused here, with the record reader's sentence. */
475
+ name: RECORD_MEMBER_NAME.min(1).regex(/^[a-z0-9][a-z0-9._-]*$/i, "letters/digits/._- , no spaces"),
473
476
  /** The gateway's model id, e.g. "deepseek-v4-pro" (what actually goes on the wire). */
474
477
  id: z.string().min(1),
475
478
  /** Routes the brain in the service (createRoutingBrain by provider): "gateway"/"vllm" → OpenAI brain,
@@ -489,7 +492,7 @@ export const ModelEntry = z.object({
489
492
  sealedApiKey: SealedApiKey.optional(),
490
493
  /** Price/capability tier — fuels core 1.25 `selectModel({ tier })` role resolution. */
491
494
  tier: ModelTier.default("standard"),
492
- /** Capability bits are THREE-STATE (S-1625 / C-R484): `true` = declared capable, `false` = declared not capable, ABSENT =
495
+ /** Capability bits are THREE-STATE: `true` = declared capable, `false` = declared not capable, ABSENT =
493
496
  * not declared — the reader applies its own default (the engine reads it through one predicate). This package never fills an
494
497
  * absent bit in: reading "not written" as "not capable" is a default only a reader may choose. */
495
498
  reasoning: z.boolean().optional(),
@@ -504,6 +507,19 @@ export const ModelEntry = z.object({
504
507
  * face's rule for a closed vocabulary, unlike `compat`'s parse-transparent carry. What each value means on the wire is the reading
505
508
  * consumer's call; this package only carries the declaration. */
506
509
  thinkingLevelMap: ModelThinkingLevelMap.optional(),
510
+ /** This model's own default reasoning level — the engine's `Model.defaultThinking`: the level a request that names none runs at on this model
511
+ * (`off` = the request carries the explicit off, which a default-on gateway needs to stop thinking). One word of {@link MODEL_THINKING_LEVEL_WORDS}
512
+ * — the same table `thinkingLevelMap` is keyed by, not a second copy. Real need: a catalog entry whose gateway thinks by default and whose job
513
+ * (a classifier, a cheap step) does not need it; without this key the declaration is stripped (document face) or the whole entry is dropped
514
+ * (view face) and the deployment has nowhere to say it. THREE-STATE like the capability bits above: ABSENT = not declared (this package never
515
+ * mints the key; the reader's own default applies).
516
+ *
517
+ * **A bad value refuses the WHOLE entry** — a word outside the table (another spelling, another case, surrounding blanks), `null`, a non-string:
518
+ * nothing is stripped, nothing is defaulted, nothing reads as absence (the strict write face refuses the document; the read legs drop the entry
519
+ * with `entry-dropped` / `entry-schema-invalid` under the same cascade as any other bad entry), the same law as `thinkingLevelMap` and
520
+ * `fallbacks`. Whether this model can think at all, and how a level is spelled on its wire, is the reading engine's call; this package only
521
+ * carries the declaration. */
522
+ defaultThinking: z.enum(MODEL_THINKING_LEVEL_WORDS).optional(),
507
523
  /** This model's fallback chain — the engine's per-model `fallbacks` (`RunnerDeps.models.<name>.fallbacks`): the names of the catalog entries
508
524
  * (or tier words / aliases, which the engine resolves against its own expanded catalog) a call falls back to, in hop order, when this model
509
525
  * cannot serve it. THREE-STATE like the capability bits above: ABSENT = not declared (this package never mints the key), `[]` = declared, no
@@ -518,6 +534,18 @@ export const ModelEntry = z.object({
518
534
  * in this package would be a second source of the same fact. The chain is FLAT: a hop's own `fallbacks` is not followed (that is how the engine's catalog door reads a chain since core 7.67.0; this package only carries the declaration and does not verify engine behavior). Not an env-leg key: the
519
535
  * env leg has no per-member seat in the catalog, so a chain is declared in the catalog document. */
520
536
  fallbacks: z.array(z.string().min(1)).optional(),
537
+ /** Whether this model has a fast tier — the engine's `Model.fastMode`: `true` = declared to have one, `false` = declared not to. Real need: a
538
+ * deployment that offers its users a fast-mode switch says here which catalog entries the switch can apply to; without this key the declaration
539
+ * is stripped (document face) or the whole entry is dropped (view face), and the reading engine only ever sees "not declared".
540
+ * THREE-STATE like the capability bits above: ABSENT = not declared (this package never mints the key; the reader's own default applies —
541
+ * `false` is a declaration, not a second spelling of absence).
542
+ *
543
+ * **A bad value refuses the WHOLE entry** — a string, `null`, a number, an array, an object: nothing is stripped, nothing is defaulted, nothing
544
+ * reads as absence (the strict write face refuses the document; the read legs drop the entry with `entry-dropped` / `entry-schema-invalid` under
545
+ * the same cascade as any other bad entry), the same law as `reasoning` / `vision` and as `defaultThinking`, `thinkingLevelMap` and `fallbacks`.
546
+ * Whether this model can actually run fast, and when a request falls back from the fast tier, is the reading engine's call; this package only
547
+ * carries the declaration. */
548
+ fastMode: z.boolean().optional(),
521
549
  contextWindow: INTEGER.positive().optional(),
522
550
  maxTokens: INTEGER.positive().optional(),
523
551
  /** Auto-compaction trigger threshold (tokens) for this model — web-admin 显式下发时本地 FileConfigStore
@@ -616,7 +644,7 @@ export const RoleTarget = z.union([
616
644
  ]);
617
645
  /** 角色 → 目标的图(`models.roles` 与 `rosters[].roles` 同一只)。键不认识 ⇒ zod 的「未知键」句;键里有 12.0.0 退役的角色词 ⇒ 那一句点名
618
646
  * 该词与出路(同组别的未知键一并点名)。 */
619
- const RoleMap = z.partialRecord(ModelRole, RoleTarget, {
647
+ const RoleMap = partialRecordOf(ModelRole, RoleTarget, {
620
648
  // 枚举键的 record 在运行期以 `unrecognized_keys`(带 `keys`)报未知键,zod 的型面只列了 invalid_type / invalid_key —— 按运行期形读(钉:role-words-12.0.0)。
621
649
  error: (iss) => {
622
650
  const raw = iss;
@@ -1085,7 +1113,7 @@ export const EntitlementBudget = z.object({
1085
1113
  tpmLimit: INTEGER.nonnegative().optional(),
1086
1114
  rpmLimit: INTEGER.nonnegative().optional(),
1087
1115
  maxParallelRequests: INTEGER.nonnegative().optional(),
1088
- perModel: z.record(z.string(), z.object({ maxBudgetUsd: z.number().finite().nonnegative().optional(), tpmLimit: INTEGER.nonnegative().optional(), rpmLimit: INTEGER.nonnegative().optional() })).optional(),
1116
+ perModel: recordOf(z.string(), z.object({ maxBudgetUsd: z.number().finite().nonnegative().optional(), tpmLimit: INTEGER.nonnegative().optional(), rpmLimit: INTEGER.nonnegative().optional() })).optional(),
1089
1117
  /** Per-RUN admission gate (agentic-runaway guard, §3.3 🔴) — period budgets can't stop ONE runaway run. */
1090
1118
  maxRunCostUsd: z.number().finite().nonnegative().optional(),
1091
1119
  maxIterations: INTEGER.positive().optional(),
@@ -1138,11 +1166,14 @@ export const ScenarioAssignments = z.object({
1138
1166
  groups: z.array(z.object({ group: z.string().min(1), scenario: z.string().min(1) })).prefault([]),
1139
1167
  principals: z.array(z.object({ principal: z.string().min(1), scenario: z.string().min(1) })).prefault([]),
1140
1168
  });
1141
- /** Org-forced-off runtime ceilings (gate②). ABSENT = no ceiling (local controls); `false` = org-disabled
1169
+ /** The live runtime caps, one field each — the ONE source of the cap set: the type {@link EntitlementRuntimeCaps}, the merge
1170
+ * polarity table {@link RUNTIME_CAP_STRICT} (keyed by that type) and the one caps-object schema (`RuntimeCapsSeat`, below) all read
1171
+ * it. A field record, not an object schema: a caps object is parsed only where it lives — inside an entitlement document
1172
+ * (`EntitlementConfig` / `validateDomain("entitlement", …)`) or on the caps wire (`PrincipalCapsWire`).
1173
+ * Each cap is an org-forced-off runtime ceiling (gate②): ABSENT = no ceiling (local controls); `false` = org-disabled
1142
1174
  * fleet-wide. Only ever pushes the "off" ceiling — never force-enables (monotone tighten-only). */
1143
- export const EntitlementRuntimeCaps = z.object({
1175
+ const RUNTIME_CAP_FIELDS = {
1144
1176
  allowBypassPermissions: z.boolean().optional(),
1145
- allowAutoMode: z.boolean().optional(),
1146
1177
  /** Per-principal governance of the workflow/ultracode capability (K-2, 产品拍板 2026-06-28). web-admin treats this as
1147
1178
  * the "准不准" axis; the engine separately advertises "能不能" (Capabilities.workflows). The shell enables
1148
1179
  * ultracode/workflows iff engine-capable ∧ principal-entitled. Like the others: ABSENT = no ceiling,
@@ -1174,12 +1205,11 @@ export const EntitlementRuntimeCaps = z.object({
1174
1205
  * source — never backfill absence into an explicit verdict); `true` = explicitly arm the classifier for this
1175
1206
  * principal (a no-op on a deployment without a wired classify leg — the capability gate lives in core);
1176
1207
  * `false` = explicit org deny. On compose across bundles `false` (deny) wins — see RUNTIME_CAP_STRICT;
1177
- * core's `=== true` opt-in check is orthogonal to that merge polarity. DIVISION OF LABOR vs
1178
- * {@link allowAutoMode}: `allowAutoMode` is the 准入 may-I ceiling on the USER-facing auto permission mode
1179
- * (shell/settings face, tighten-only); `autoMode` is web-admin's 部署 arm decision for the server-side
1180
- * classifier leg itself. */
1208
+ * core's `=== true` opt-in check is orthogonal to that merge polarity. ONE SOURCE (32.0.0): this is the only
1209
+ * key that says the org denies auto mode — `false` here is that deny, for the user-facing auto permission mode and the
1210
+ * classifier leg alike (the former `allowAutoMode: false` meant the same deny and is folded into this key by the
1211
+ * one-time migration; its `true` only meant "no ceiling"). */
1181
1212
  autoMode: z.boolean().optional(),
1182
- allowUltracode: z.boolean().optional(),
1183
1213
  /** Per-principal governance of the session memory-capture OPT-OUT — the consumer's `RuntimeCaps.allowMemoryOptOut`
1184
1214
  * (design/383 §3.1): may this principal declare `memory.capture: "off"` for a run? `false` = the deployment
1185
1215
  * REQUIRES capture for this principal (compliance / knowledge retention) — the declaration is refused, terminal
@@ -1200,22 +1230,42 @@ export const EntitlementRuntimeCaps = z.object({
1200
1230
  * here `true` is the STRICT/tightening value (forcing the gate ON), so it wins on compose — see RUNTIME_CAP_STRICT.
1201
1231
  * ABSENT = no fleet override (local/default resolution decides). Server-side enforcement = core's per-principal axis. */
1202
1232
  forceDurableGate: z.boolean().optional(),
1203
- });
1233
+ };
1204
1234
  /** The STRICT (tightening) value per RuntimeCap — the value that WINS on compose (monotone tighten-only). The
1205
1235
  * `allow*` ceilings tighten toward `false` (disabled wins); `forceDurableGate` tightens toward `true` (forced
1206
1236
  * wins). Single source for the merge polarity so resolvers don't hardcode it. `Record<keyof …>` = a new cap
1207
- * without an entry is a COMPILE error (no silent wrong-direction merge). */
1237
+ * without an entry is a COMPILE error (no silent wrong-direction merge) — so its keys are also the cap list: iterate
1238
+ * `Object.keys(RUNTIME_CAP_STRICT)` to visit every live cap. */
1208
1239
  export const RUNTIME_CAP_STRICT = deepFreeze({
1209
1240
  allowBypassPermissions: false,
1210
- allowAutoMode: false,
1211
1241
  allowWorkflows: false,
1212
1242
  allowFork: false,
1213
1243
  allowObservers: false,
1214
1244
  autoMode: false,
1215
- allowUltracode: false,
1216
1245
  allowMemoryOptOut: false,
1217
1246
  forceDurableGate: true,
1218
1247
  });
1248
+ /** 32.0.0 删去的两只能力位的墓碑形(拒句经 `retiredFormSentence` 铸,点名改写存量的一次性迁移)。 */
1249
+ const RUNTIME_CAP_AUTO_MODE_RETIRED = {
1250
+ retiredIn: "32.0.0",
1251
+ migration: "SS-M14",
1252
+ now: "runtimeCaps.autoMode (false = the org denies auto mode; the old key's true only meant no ceiling and has no counterpart)",
1253
+ };
1254
+ const RUNTIME_CAP_ULTRACODE_RETIRED = {
1255
+ retiredIn: "32.0.0",
1256
+ migration: "SS-M14",
1257
+ now: "nothing — no consumer ever enforced it; delete the key",
1258
+ };
1259
+ /**
1260
+ * 能力位对象的**唯一一只 schema**:现行字段({@link RUNTIME_CAP_FIELDS})+ 两只旧键原位的墓碑(在场即拒,任何值)。存着或带着能力位对象的三处都挂这一只 ——
1261
+ * 权益档位的 `runtimeCaps`、全员缺省的 `runtimeCaps`、caps wire 的 `runtimeCaps`(wire 那一处在它上面再开放世界)。
1262
+ * 墓碑不能省:能力位对象默认剥未知键(存储两座)、wire 座带未知键原样过,只删键 ⇒ 存量 / 在途的 `allowAutoMode: false` 静默失效(组织的 auto 拒位没了)。
1263
+ */
1264
+ const RuntimeCapsSeat = z.object({
1265
+ ...RUNTIME_CAP_FIELDS,
1266
+ allowAutoMode: retiredKey("runtimeCaps.allowAutoMode", RUNTIME_CAP_AUTO_MODE_RETIRED),
1267
+ allowUltracode: retiredKey("runtimeCaps.allowUltracode", RUNTIME_CAP_ULTRACODE_RETIRED),
1268
+ });
1219
1269
  /** A named entitlement bundle (a `tier`, or a composable `role`). Bind a `roster` to inherit its model/skill/mcp
1220
1270
  * visibility for free; explicit allowlists intersect on top. Edit a tier once → re-prices everyone on it. */
1221
1271
  export const EntitlementTier = z.object({
@@ -1228,12 +1278,12 @@ export const EntitlementTier = z.object({
1228
1278
  * "no constraint on this axis" semantics as visibleMcp (deny-wins on intersection; C2, additive 0.5.0). */
1229
1279
  visiblePlugins: z.array(z.string()).optional(),
1230
1280
  budget: EntitlementBudget.optional(),
1231
- runtimeCaps: EntitlementRuntimeCaps.optional(),
1281
+ runtimeCaps: RuntimeCapsSeat.optional(),
1232
1282
  /** design/170 件A(additive 0.15.0):org 记忆授权束——`org:` scope 键 → 授予(`write` 缺席=只读)。
1233
1283
  * 挂 bundle 与 visibleSkills 同轴:tier ⊕ roles 跨束**并集**(write:true 在并集中胜出——多束=更多
1234
1284
  * 访问,「展开」轴)。刻意**不挂 defaults**:全员默认 org 授权恰是准入面要防的形;要全员授,建显式
1235
1285
  * tier。键形状门=`org:` 前缀(严校验单一真源在 core 的 v2 scope 契约,此处只拦挂错轴的类别错误)。 */
1236
- orgMemory: z.record(z.string().regex(/^org:\S+$/, "orgMemory key must be an `org:` scope string"), z.object({ write: z.boolean().optional() }).strict()).optional(),
1286
+ orgMemory: recordOf(z.string().regex(/^org:\S+$/, "orgMemory key must be an `org:` scope string"), z.object({ write: z.boolean().optional() }).strict()).optional(),
1237
1287
  /** 🔴 B1 违宪修复(EXPERT-REDESIGN §4-1):tokenQuota **不挂 tier** —— 只挂 defaults/subject/groupBinding。
1238
1288
  * fail-loud 而非 zod 默认的静默剥除(admin 挂上去以为生效才是最糟的)。 */
1239
1289
  tokenQuota: z
@@ -1293,7 +1343,7 @@ export const EntitlementConfig = z
1293
1343
  * can only TIGHTEN further (monotone), never re-loosen the default. Leave unset for per-tier-only control. */
1294
1344
  defaults: z
1295
1345
  .object({
1296
- runtimeCaps: EntitlementRuntimeCaps.optional(),
1346
+ runtimeCaps: RuntimeCapsSeat.optional(),
1297
1347
  budget: EntitlementBudget.optional(),
1298
1348
  /** 全局默认 token 双窗额度(最不具体层——被组/用户层压过)。 */
1299
1349
  tokenQuota: TokenQuota.optional(),
@@ -1352,7 +1402,7 @@ export const EntitlementConfig = z
1352
1402
  export const PrincipalOrgMemoryWire = z
1353
1403
  .object({
1354
1404
  gen: INTEGER.nonnegative(),
1355
- scopes: z.record(z.string().regex(/^org:\S+$/, "orgMemory scope must be an `org:` scope string"), z.object({ write: z.boolean().optional() }).strict()),
1405
+ scopes: recordOf(z.string().regex(/^org:\S+$/, "orgMemory scope must be an `org:` scope string"), z.object({ write: z.boolean().optional() }).strict()),
1356
1406
  })
1357
1407
  .strict();
1358
1408
  /** `?principal=` caps wire **整体**的读边界 schema(web-admin 铸、server 消费同源锚;产品令 2026-08-05:
@@ -1360,7 +1410,8 @@ export const PrincipalOrgMemoryWire = z
1360
1410
  * 显式保持宽读(每面注明所依裁定),不许硬转严:
1361
1411
  * - `runtimeCaps`/`budget`(治理面,fail-closed):严格校验已知键 + **passthrough 未知键**——新 web-admin
1362
1412
  * 的新 cap 键必须原样透传给 core(老 server 剥键=静默放松治理);值漂移 ⇒ 整体 parse 失败 ⇒ 消费端
1363
- * fail-close(「outage 绝不静默 GRANT」的既裁方向)。
1413
+ * fail-close(「outage 绝不静默 GRANT」的既裁方向)。`runtimeCaps` 上 32.0.0 删去的两只旧键(`allowAutoMode` /
1414
+ * `allowUltracode`)不是未知键:它们原位是墓碑,在场即拒(拒句点名迁移)—— 当未知键透传,读七键的消费方就不再读那只拒位。
1364
1415
  * - `scenario`/`allowlist`/`execution`(能力面,fail-open,[565]/[580] 裁定):保持 `unknown` 宽读,
1365
1416
  * 归一与 drift 审计诊断在消费端(schema 无法产出 executionDrift 诊断串,且整体拒会把 fail-open
1366
1417
  * 面错翻成 fail-closed)。
@@ -1374,7 +1425,7 @@ export const PrincipalCapsWire = z
1374
1425
  principal: z.string().optional(),
1375
1426
  worker: z.string().nullable().optional(),
1376
1427
  configured: z.boolean().optional(),
1377
- runtimeCaps: EntitlementRuntimeCaps.passthrough().nullable().optional(),
1428
+ runtimeCaps: RuntimeCapsSeat.passthrough().nullable().optional(),
1378
1429
  budget: EntitlementBudget.passthrough().nullable().optional(),
1379
1430
  scenario: z.unknown().optional(),
1380
1431
  allowlist: z.unknown().optional(),
@@ -1596,7 +1647,7 @@ export const ProjectsConfig = z
1596
1647
  .object({
1597
1648
  /** 键=projectId({@link PROJECT_ID_REGEX},generic lowercase UUID——宽读);tenant 半边=web-admin
1598
1649
  * scope 轴(不进域文档,见域头注)。 */
1599
- projects: z.record(z.string().regex(PROJECT_ID_REGEX, "projectId must be a lowercase canonical UUID"), ProjectRegistration).prefault({}),
1650
+ projects: recordOf(z.string().regex(PROJECT_ID_REGEX, "projectId must be a lowercase canonical UUID"), ProjectRegistration).prefault({}),
1600
1651
  })
1601
1652
  .superRefine(remoteUniquenessIssues);
1602
1653
  /** The PATCH form of one registration: every key a PATCH may change, all optional; `registeredBy` / `registeredAt` / `contentAttestedAt` (and any key
@@ -1896,11 +1947,40 @@ const nonSecretLiteral = (minLength) => z
1896
1947
  .max(2048)
1897
1948
  .refine((s) => !containsSecretToken(s), buildQuotedIssue `looks like a literal secret — a credential goes in a secretRefs field as an env-NAME, never a value here`);
1898
1949
  /**
1899
- * 有文法的车道坐标 → 它的值判官(16.0.0;今天一行)。判的是**在场、非空白**的值(缺席 / 空白归必需栏那两句,所有车道同一只);判官交拒因词,规则句随行。
1900
- * 键都在车道表的非密坐标栏里(`test/device-relay-16.0.0.test.ts` 钉 device 那一行)。
1950
+ * 可信代理名单一个坏项的拒因片语(进写闸拒句「found:」那一段,整段是定文):**只有位置数与闭集拒因词** —— 参数的型就是这条不变式(`item` / `of` 是数,
1951
+ * `flaw` 是拒因闭集的型),名单项的文本(配置里的值)没有参数可进来。逐项的结构化读数是判官交的那一份(`readDeviceTrustedProxyCidrs` 的 `items`),
1952
+ * 这里只是它的定词渲染。
1953
+ */
1954
+ function cidrItemFlawPhrase(item, of, flaw) {
1955
+ return `item ${item} of ${of}: ${flaw}`;
1956
+ }
1957
+ /**
1958
+ * 有文法的车道坐标 → 它的值判官(16.0.0 起;三行,都在 device 车道)。判的是**在场**的值 —— 必需坐标的空白先归必需栏那一句(所有车道同一只);可选坐标的值整串交判官,
1959
+ * 判官自己说哪个拼法是未设(两只可选坐标都只认空串)。判官是唯一的那一只(写闸与管理面表单同读;`DEVICE_RELAY_URL` 的引擎起服也读同一只,两只可选坐标的引擎起服改读它是服务端提货本包这一版那一步的事);这里只把它的读数折成拒因短语(定词,不回显值),规则句随行。
1960
+ * 键都在车道表的非密坐标栏里(`test/device-relay-16.0.0.test.ts` / `test/device-lane-knobs-32.0.0.test.ts` 钉 device 那一行)。
1901
1961
  */
1902
1962
  const COORDINATE_VALUE_GRAMMAR = new Map([
1903
1963
  ["DEVICE_RELAY_URL", { flaws: deviceRelayFlaws, rule: DEVICE_RELAY_RULE }],
1964
+ [
1965
+ "DEVICE_MAX_PREAUTH_PER_REMOTE",
1966
+ {
1967
+ flaws: (value) => {
1968
+ const r = readDeviceMaxPreAuthPerRemote(value);
1969
+ return r.ok ? [] : [r.flaw];
1970
+ },
1971
+ rule: DEVICE_MAX_PREAUTH_PER_REMOTE_RULE,
1972
+ },
1973
+ ],
1974
+ [
1975
+ "DEVICE_TRUSTED_PROXY_CIDRS",
1976
+ {
1977
+ flaws: (value) => {
1978
+ const r = readDeviceTrustedProxyCidrs(value);
1979
+ return r.ok ? [] : r.items.map((i) => cidrItemFlawPhrase(i.item, i.of, i.flaw));
1980
+ },
1981
+ rule: DEVICE_TRUSTED_PROXY_CIDRS_RULE,
1982
+ },
1983
+ ],
1904
1984
  ]);
1905
1985
  /** 车道集缺席 / 为空时的那一句(块在而缺 `lanes`、`lanes` 是空表,与 enabled 的 worker 根本没有车道块,同一句)。规则句取判官的 {@link LANE_SET_RULE}。 */
1906
1986
  const LANES_REQUIRED = `runtime.execution.lanes ${LANE_SET_RULE}`;
@@ -1952,38 +2032,17 @@ function addLaneSetIssue(ctx, lanes, flaw) {
1952
2032
  }
1953
2033
  }
1954
2034
  }
1955
- /**
1956
- * 凭据引用集合(名 → 宿主 env-NAME)的**唯一铸法**:先按**自有属性名**判保留成员名(`isReservedMemberName`,一张表,记录读器与中心引用解析口问同一个谓词;
1957
- * 经读内核 `ownEntriesOf` 的严归类读名:每个自有串键都读到名字,不调 getter),一条就使集合判不过、record 不再判;再交给 `record`。
1958
- * zod 的 record 读键前先跳过 `__proto__`(不判它的值、输出里也没有它),只靠 record 判会把「带着一条被剥掉的引用」读成「没有那条引用」,条目带着其余引用活下来。
1959
- * 只判朴素对象(形状问座位 `isPlainJsonObject`;别的形由 `record` 自己拒,拒句不变);成员名读不出(隐藏键 / 访问器 / 陷阱抛)⇒ 同样判坏,句子是内核那一句(fail-closed:守卫看不清名字就不担保)。
1960
- * 每一只成员都由它铸,所以成员复用到哪个座位,这道判据就跟到哪个座位。凭据引用集合的值是 env-NAME 串 —— 一组值,不是一组条目:逐条抢救不下钻它
1961
- * (值名单律,见 `salvageEntries`),坏一项 ⇒ 它所属的那一条条目整条判不过。
1962
- */
1963
- function credentialRefs(record) {
1964
- return z.preprocess((input, ctx) => {
1965
- if (!isPlainJsonObject(input))
1966
- return input;
1967
- const members = ownEntriesOf(input);
1968
- if (!members.ok) {
1969
- ctx.addIssue({ code: "custom", input, ...buildQuotedIssue `${fixed(members.sentence)}` });
1970
- return input;
1971
- }
1972
- for (const [name] of members.value)
1973
- if (isReservedMemberName(name))
1974
- ctx.addIssue({ code: "custom", input, ...buildQuotedIssue `a credential reference is named "${fixed(name)}" — a reserved member name (${fixed(RESERVED_MEMBER_NAMES.join(" | "))}) never names a reference; rename it` });
1975
- return input;
1976
- }, record);
1977
- }
2035
+ // 凭据引用集合(名 → 宿主 env-NAME)是普通的记录座位(`./record-seat`:成员按自有属性名读,保留成员名 ⇒ 座位拒 —— 与包里每一只记录同一只守卫、同一句、同一个词)。
2036
+ // 它的值是 env-NAME 串 —— 一组值,不是一组条目:逐条抢救不下钻它(值名单律,见 `salvageEntries`),坏一项 ⇒ 它所属的那一条条目整条判不过。
1978
2037
  /** 车道块的密钥引用(服务变量名 → 宿主 env-NAME)—— 凭据引用集合(值集合:不逐项抢救)。 */
1979
- const LaneSecretRefs = credentialRefs(z.record(ENV_NAME, ENV_NAME));
2038
+ const LaneSecretRefs = recordOf(ENV_NAME, ENV_NAME);
1980
2039
  /** worker 的密钥 env 透传(服务变量名 → 宿主 env-NAME)—— 凭据引用集合(值集合:不逐项抢救)。 */
1981
- const WorkerSecretEnv = credentialRefs(z.record(ENV_NAME, ENV_NAME).superRefine((rec, ctx) => {
2040
+ const WorkerSecretEnv = recordOf(ENV_NAME, ENV_NAME).superRefine((rec, ctx) => {
1982
2041
  retiredEnvIssue(rec, ctx);
1983
2042
  for (const k of Object.keys(rec))
1984
2043
  if (RESERVED_WORKER_ENV.has(k))
1985
2044
  ctx.addIssue({ code: "custom", ...reservedKeyIssue("secretEnv", k) });
1986
- }));
2045
+ });
1987
2046
  /** 一项是不是可声明的车道词(只给下面的变换收窄类型用:判官放行之后每一项都是)。 */
1988
2047
  const isDeclarableLane = (v) => EXECUTION_LANE_WORDS.some((w) => w === v);
1989
2048
  /** 列表的一次快照(长度只读一次,空洞读成 `undefined`):判官判的与变换收窄的是同一份项,不对调用方的数组读第二遍。不是列表 ⇒ 原样(下面的判据拒)。 */
@@ -2024,7 +2083,7 @@ const ExecutionBlock = z
2024
2083
  .object({
2025
2084
  lane: retiredKey("runtime.execution.lane", { retiredIn: "16.0.0", now: "runtime.execution.lanes (an ordered lane set; the first one is the default)", migration: "SS-M12" }),
2026
2085
  lanes: DeclaredLanes,
2027
- coords: z.record(ENV_NAME, nonSecretLiteral(0)).prefault({}),
2086
+ coords: recordOf(ENV_NAME, nonSecretLiteral(0)).prefault({}),
2028
2087
  secretRefs: LaneSecretRefs.prefault({}),
2029
2088
  })
2030
2089
  .superRefine((x, ctx) => {
@@ -2057,9 +2116,9 @@ const ExecutionBlock = z
2057
2116
  if (!judgeKey("coords", key))
2058
2117
  continue;
2059
2118
  const owner = LANE_ENV_OWNER.get(key);
2060
- if (isBlankCoordinate(value)) {
2061
- if (owner?.required === true)
2062
- issue("coords", key, buildQuotedIssue `required coordinate ${key} of lane "${fixed(owner.lane)}" is empty or whitespace-only — it counts as absent, and the engine refuses to start without it`);
2119
+ // 必需坐标:空白 = 缺(所有车道一句,不再问文法)。有文法的坐标:在场的值只问它的判官 —— 判官自己说哪个拼法是未设(可选坐标的空白因此不在这里放过)。
2120
+ if (owner?.required === true && isBlankCoordinate(value)) {
2121
+ issue("coords", key, buildQuotedIssue `required coordinate ${key} of lane "${fixed(owner.lane)}" is empty or whitespace-only — it counts as absent, and the engine refuses to start without it`);
2063
2122
  continue;
2064
2123
  }
2065
2124
  const grammar = COORDINATE_VALUE_GRAMMAR.get(key);
@@ -2116,8 +2175,9 @@ const StoreBlock = z.object({
2116
2175
  .optional(),
2117
2176
  });
2118
2177
  /** 一台 worker 的名字(唯一 → 容器名 / compose project / 缺省路由键)—— **唯一**的名字判据。web-admin 在租约 / 用量 /
2119
- * discovery `?worker=` 等面上校验外部传来的 worker 名时读它(不抄窄正则)。 */
2120
- export const WORKER_NAME = z.string().min(1).regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters/digits/-, no spaces");
2178
+ * discovery `?worker=` 等面上校验外部传来的 worker 名时读它(不抄窄正则)。它作记录座位的键(`prompts.workers`),所以从
2179
+ * {@link RECORD_MEMBER_NAME} 起步:`constructor` / `prototype` 在建名的这一刻就拒,句子是记录读器那一句。 */
2180
+ export const WORKER_NAME = RECORD_MEMBER_NAME.min(1).regex(/^[a-z0-9][a-z0-9-]*$/, "lowercase letters/digits/-, no spaces");
2121
2181
  const WorkerSpecObject = z.object({
2122
2182
  /** 唯一 → 容器名 / compose project. */
2123
2183
  name: WORKER_NAME,
@@ -2216,8 +2276,7 @@ const WorkerSpecObject = z.object({
2216
2276
  * secret 名…)被拒,防 env 改路由/关鉴权/遮蔽密钥(council);墓碑表 `RETIRED_ENVS` 里的旧名被拒(引擎见之拒启;空串 = 未设,同引擎)。
2217
2277
  * 可覆盖非保留键(如 LOG_LEVEL)。hash-included(改它重建)。
2218
2278
  */
2219
- env: z
2220
- .record(ENV_NAME, z.string().max(2048))
2279
+ env: recordOf(ENV_NAME, z.string().max(2048))
2221
2280
  .superRefine((rec, ctx) => {
2222
2281
  retiredEnvIssue(rec, ctx);
2223
2282
  for (const [k, v] of Object.entries(rec)) {
@@ -2556,19 +2615,19 @@ export const SkillsManifestSchema = skillsDocument(SkillSpec.omit({ content: tru
2556
2615
  // env-NAME references (`envRefs`/`headerRefs`: target-key → an ENV_NAME in the SERVICE's env). The service's
2557
2616
  // `resolveSpec` reads the real values from its own environment — this DB never holds a credential. Like
2558
2617
  // skills, MCP is applied at boot/reconcile (not hot) and writing is gated to `publisher` + the publish gate.
2559
- const McpEnvRefs = credentialRefs(z.record(ENV_NAME, ENV_NAME)); // target ENV key → ENV_NAME holding its value (both env-name-shaped)
2618
+ const McpEnvRefs = recordOf(ENV_NAME, ENV_NAME); // target ENV key → ENV_NAME holding its value (both env-name-shaped)
2560
2619
  // An HTTP header NAME: an RFC 7230 token that ALSO must not be a secret literal. A secret-SHAPED header name
2561
2620
  // (a headerRefs key `sk-live-…`, or principalHeader `ghp_…`) is stored + shipped verbatim on /effective — the
2562
2621
  // SAME invariant-① gap as worker.env / model.extraBody / mcp stdio command+args (credentials belong on the
2563
2622
  // VALUE side = an env-NAME ref, never the name). The token charset includes `%`, so an encoded secret could ride
2564
2623
  // the name — containsSecretToken percent-decodes, catching it too. ONE shared schema for every header-name field
2565
- // (headerRefs keys, principalHeader). R19.
2566
- const HTTP_HEADER_NAME = z
2567
- .string()
2624
+ // (headerRefs keys, principalHeader). R19. A header name keys a record seat (headerRefs), so it starts from RECORD_MEMBER_NAME:
2625
+ // `__proto__` / `constructor` / `prototype` are refused for principalHeader too, with the record reader's sentence (32.0.0).
2626
+ const HTTP_HEADER_NAME = RECORD_MEMBER_NAME
2568
2627
  .regex(/^[A-Za-z0-9!#$%&'*+.^_`|~-]+$/, "must be an HTTP header NAME")
2569
2628
  .refine((s) => !containsSecretToken(s), buildQuotedIssue `HTTP header name must not contain a secret literal — credentials go in the env-NAME value, never the header name`);
2570
2629
  // Header NAME → ENV_NAME holding its value. Header names are tokens (RFC 7230) — not env-name-shaped.
2571
- const McpHeaderRefs = credentialRefs(z.record(HTTP_HEADER_NAME, ENV_NAME));
2630
+ const McpHeaderRefs = recordOf(HTTP_HEADER_NAME, ENV_NAME);
2572
2631
  /** The retired `transport.assertionHeader` (29.0.0): one tombstone sentence for every face. */
2573
2632
  const MCP_ASSERTION_HEADER_RETIRED = {
2574
2633
  retiredIn: "29.0.0",
@@ -2843,8 +2902,8 @@ export const PROMPT_BINDING_LIST_MAX = 64;
2843
2902
  const PROMPT_OVERLAY_ID_MAX_CHARS = 128;
2844
2903
  const isNonBlank = (s) => s.trim() !== "";
2845
2904
  /** 引擎字符界的同一把尺:按 Unicode 码点量(一个非 BMP 字符算一个),与引擎 `codePointsOver` 同答 —— binding 名 / `evidence.intent` / 每条 ref / `sourceRevision` 四处共用。
2846
- * 不用 zod 的 `.max()`:它的单位随 zod 版本变(低端量 UTF-16 码元、高端量码点;版本界与实测见 CHANGELOG 14.0.0 B4),而本包声明的 zod 区间两端都在 —— 那样宿主解析到哪一版 zod,
2847
- * 镜像对非 BMP 字符的答案就跟着变,比引擎窄一步就破「引擎收的,本包必收」。镜像自带这把尺,答案不随 zod 版本动。
2905
+ * 不用 zod 的 `.max()`:它的单位随 zod 版本变(低端量 UTF-16 码元、高端量码点;版本界与实测见 CHANGELOG 14.0.0 B4;本包声明的 zod 区间此前两端都在,32.0.0 起下界抬到 4.6.3、低端已出范围)——
2906
+ * 此前宿主解析到哪一版 zod,镜像对非 BMP 字符的答案就跟着变,比引擎窄一步就破「引擎收的,本包必收」。镜像自带这把尺,答案不随 zod 版本动。
2848
2907
  * 码元数 ≤ max ⇒ 码点数 ≤ max;码元数 > 2·max ⇒ 码点数 > max;只有夹在中间的才逐点数(不整串拷贝)。 */
2849
2908
  const withinCodePoints = (max) => (s) => {
2850
2909
  if (s.length <= max)
@@ -2878,7 +2937,7 @@ export const PromptOverlayWhen = z
2878
2937
  .object({
2879
2938
  traits: z.object({ allOf: z.array(z.string()).optional(), noneOf: z.array(z.string()).optional() }).strict().optional(),
2880
2939
  host: z.object({ role: z.string().optional(), form: z.string().optional() }).strict().optional(),
2881
- facts: z.record(z.string(), z.boolean()).optional(),
2940
+ facts: recordOf(z.string(), z.boolean()).optional(),
2882
2941
  binding: PromptBindingCondition.optional(),
2883
2942
  })
2884
2943
  .strict();
@@ -2963,7 +3022,7 @@ export const PromptsConfig = z.object({
2963
3022
  /** 每台 worker 都组装的中心层(`workers` 点名的那台除外)。缺席 = 不管提示词(引擎内置)。 */
2964
3023
  artifact: PromptArtifact.optional(),
2965
3024
  /** 按 worker 的中心层:点名的 worker 组装这一份,**整份取代** `artifact`(不叠加;覆盖语义只在编出它的那一处)。键 = worker 名(唯一的 worker 名判据)。 */
2966
- workers: z.record(WORKER_NAME, PromptArtifact).optional(),
3025
+ workers: recordOf(WORKER_NAME, PromptArtifact).optional(),
2967
3026
  bindings: retiredKey("prompts.bindings", PROMPTS_AXES_RETIRED),
2968
3027
  catalog: retiredKey("prompts.catalog", PROMPTS_AXES_RETIRED),
2969
3028
  });
@@ -4,9 +4,9 @@
4
4
  > 每次全量重算并逐名比对 —— 加 / 删 / 改形一个导出而不重生成本档 ⇒ 红。导出面的每次变动因此以本档的 diff 出现在评审里。
5
5
  > 形:`value` = 运行期拿得到的值;`type` = 只在类型层;`value+type` = 同名的值与类型(zod schema 与它推出的类型)。
6
6
 
7
- 子路径 24 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1596 个(同名在多条子路径上各计一次)。
7
+ 子路径 24 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1613 个(同名在多条子路径上各计一次)。
8
8
 
9
- ## `.`(850)
9
+ ## `.`(865)
10
10
 
11
11
  - `A2aConfig` — value+type
12
12
  - `A2aPeerSpec` — value+type
@@ -105,9 +105,12 @@
105
105
  - `DEVICE_AUTH_STATUSES` — value
106
106
  - `DEVICE_CODE_TTL_SECONDS` — value
107
107
  - `DEVICE_GRANT_TYPE` — value
108
+ - `DEVICE_MAX_PREAUTH_PER_REMOTE_FLAWS` — value
109
+ - `DEVICE_MAX_PREAUTH_PER_REMOTE_RULE` — value
108
110
  - `DEVICE_POLL_INTERVAL_SECONDS` — value
109
111
  - `DEVICE_RELAY_NONE` — value
110
112
  - `DEVICE_RELAY_RULE` — value
113
+ - `DEVICE_TRUSTED_PROXY_CIDRS_RULE` — value
111
114
  - `DIALOG_EXPIRY_DEFAULT` — value
112
115
  - `DIALOG_EXPIRY_VALUES` — value
113
116
  - `DIAL_ADDRESS_URL_FORBIDDEN_PARTS` — value
@@ -132,6 +135,8 @@
132
135
  - `DeviceAuthStatus` — type
133
136
  - `DeviceCodeRequest` — value+type
134
137
  - `DeviceCodeResponse` — value+type
138
+ - `DeviceMaxPreAuthPerRemoteFlaw` — type
139
+ - `DeviceMaxPreAuthPerRemoteReading` — type
135
140
  - `DeviceTokenRequest` — value+type
136
141
  - `DialogExpirySetting` — value
137
142
  - `DialogExpirySettingValue` — type
@@ -143,6 +148,7 @@
143
148
  - `DomainConfig` — type
144
149
  - `DomainFieldWriteRoles` — type
145
150
  - `DomainName` — type
151
+ - `DomainReadRefusedError` — value+type
146
152
  - `DrainPhase` — type
147
153
  - `DrainReceipt` — value+type
148
154
  - `DrainReceiptState` — value+type
@@ -176,7 +182,7 @@
176
182
  - `EntitlementConfig` — value+type
177
183
  - `EntitlementGroupBinding` — value+type
178
184
  - `EntitlementOverride` — value+type
179
- - `EntitlementRuntimeCaps` — value+type
185
+ - `EntitlementRuntimeCaps` — type
180
186
  - `EntitlementSubject` — value+type
181
187
  - `EntitlementTier` — value+type
182
188
  - `EntryKeptIndex` — type
@@ -601,6 +607,7 @@
601
607
  - `TIGHTEN_VERDICTS` — value
602
608
  - `TOKEN_SCOPE_REFUSALS` — value
603
609
  - `TOOL_WIRE_NAME_MAX_CHARS` — value
610
+ - `TRUSTED_PROXY_CIDR_FLAWS` — value
604
611
  - `TaskCompletedHookInput` — value
605
612
  - `TaskCreatedHookInput` — value
606
613
  - `TeammateIdleHookInput` — value
@@ -614,6 +621,10 @@
614
621
  - `TokenQuota` — value+type
615
622
  - `TokenRefreshRequest` — value+type
616
623
  - `TokenScopeRefusal` — type
624
+ - `TrustedProxyCidr` — type
625
+ - `TrustedProxyCidrFlaw` — type
626
+ - `TrustedProxyCidrItemFlaw` — type
627
+ - `TrustedProxyCidrsReading` — type
617
628
  - `UI_LANGUAGE_SETTING` — value
618
629
  - `UI_LANGUAGE_VALUES` — value
619
630
  - `URL_CREDENTIAL_REASONS` — value
@@ -721,6 +732,7 @@
721
732
  - `httpUrlFlaws` — value
722
733
  - `httpUrlRule` — value
723
734
  - `interpolateHookEnvVars` — value
735
+ - `ipFamilyOf` — value
724
736
  - `isAbsoluteHostPath` — value
725
737
  - `isAtLeast` — value
726
738
  - `isBlankCoordinate` — value
@@ -789,12 +801,15 @@
789
801
  - `promptArtifactFor` — value
790
802
  - `readCapabilityReading` — value
791
803
  - `readCrossSessionInbound` — value
804
+ - `readDeviceMaxPreAuthPerRemote` — value
805
+ - `readDeviceTrustedProxyCidrs` — value
792
806
  - `readDialogExpiry` — value
793
807
  - `readDrainReceipt` — value
794
808
  - `readDrainRequest` — value
795
809
  - `readEffectiveWire` — value
796
810
  - `readEngineSignal` — value
797
811
  - `readEnvModelSlots` — value
812
+ - `readHookPluginOptionRef` — value
798
813
  - `readHttpHookAllowlistLayer` — value
799
814
  - `readModelRefusals` — value
800
815
  - `readPlainStringRecord` — value
@@ -897,7 +912,7 @@
897
912
  - `EntitlementConfig` — value+type
898
913
  - `EntitlementGroupBinding` — value+type
899
914
  - `EntitlementOverride` — value+type
900
- - `EntitlementRuntimeCaps` — value+type
915
+ - `EntitlementRuntimeCaps` — type
901
916
  - `EntitlementSubject` — value+type
902
917
  - `EntitlementTier` — value+type
903
918
  - `ExecutionPolicy` — value+type
@@ -1080,7 +1095,7 @@
1080
1095
  - `resolveEffectiveForWorker` — value
1081
1096
  - `rosterMarkerRoles` — value
1082
1097
 
1083
- ## `./config-fns`(57)
1098
+ ## `./config-fns`(58)
1084
1099
 
1085
1100
  - `ANY_INDEX` — value
1086
1101
  - `ApprovePublishResult` — type
@@ -1094,6 +1109,7 @@
1094
1109
  - `DOMAIN_WRITE_ROLE` — value
1095
1110
  - `DROPPED_ENTRY_REASON_CODES` — value
1096
1111
  - `DomainFieldWriteRoles` — type
1112
+ - `DomainReadRefusedError` — value+type
1097
1113
  - `DroppedEntry` — type
1098
1114
  - `DroppedEntryIdentity` — type
1099
1115
  - `DroppedEntryReasonCode` — type
@@ -1360,7 +1376,7 @@
1360
1376
  - `parseSchedulerStore` — value
1361
1377
  - `serializeSchedulerStore` — value
1362
1378
 
1363
- ## `./hooks`(120)
1379
+ ## `./hooks`(121)
1364
1380
 
1365
1381
  - `AgentHookEntry` — value+type
1366
1382
  - `AssistantTurnError` — value+type
@@ -1481,6 +1497,7 @@
1481
1497
  - `planHookCommandSpawn` — value
1482
1498
  - `pluginOptionEnvName` — value
1483
1499
  - `pluginOptionKeysProblem` — value
1500
+ - `readHookPluginOptionRef` — value
1484
1501
  - `stopAttributionText` — value
1485
1502
 
1486
1503
  ## `./fleet`(85)
@@ -1,14 +1,14 @@
1
1
  # CC 偏离登记(本包)
2
2
 
3
3
  本包镜像或对齐 Claude Code(CC)上游的设置语义时,**有意**不照抄的地方逐条登在这里:差在哪(CC 原形与语料坐标 / 本包的形)、哪个方向、为什么、谁读它。
4
- 锚 = CC 2.1.296 语料 `cli296.js`(只 grep,不解包;坐标写行号,行号属于那一份语料,只引不抄);H7 的条目字段另引 `cli309.js` 的坐标,H8 引 `cli321.js` 的坐标。
4
+ 锚 = CC 2.1.296 语料 `cli296.js`(只 grep,不解包;坐标写行号,行号属于那一份语料,只引不抄);H7 的条目字段另引 `cli309.js` 的坐标,H8 / H9 引 `cli321.js` 的坐标。
5
5
 
6
6
  方向只有两种写法:**更严**(本包拦下 / 不放行 / 不装 CC 会放行或会装的)与**更宽**(本包拦下 CC 不拦的 —— 只出现在拒绝方向)。
7
7
  本包不登「比 CC 更松」的偏离;出现了即是缺陷。
8
8
 
9
9
  ## hooks classifier(`classifyHooksConfig`,`src/hooks-config.ts`)
10
10
 
11
- 这八处都只在**更严**的方向上:CC 会装上的文档,这里可能整份不装;反过来的情形在这八处里不存在(登记表之外的更松面是缺陷,不登在这里,见 CHANGELOG 20.0.0 的已知限制)。代价都是同一个 —— 一份本可装上的设置文件整份不装(同文件的 `permissions.deny` 一起不生效),所以每条都写了它挡的是什么。
11
+ 这九处都只在**更严**的方向上:CC 会装上的文档,这里可能整份不装;反过来的情形在这九处里不存在(登记表之外的更松面是缺陷,不登在这里;20.0.0 披露的那一处 —— http 条目的 `url` 不判 URL 语法 —— 自32.0.0 起收掉,收法的余差登在 H9)。代价都是同一个 —— 一份本可装上的设置文件整份不装(同文件的 `permissions.deny` 一起不生效),所以每条都写了它挡的是什么。
12
12
 
13
13
  | # | 本包 | CC 2.1.296 | 为什么 |
14
14
  |---|---|---|---|
@@ -20,6 +20,7 @@
20
20
  | H6 | `hooks` 是装着**数组**的数组 ⇒ 整份拒(与装对象同判) | 只对装对象 / 装迹象的数组整份拒,装数组的剔掉 | 套一层数组的守卫不该被当成标量剔掉 |
21
21
  | H7 | 条目字段以本包字段表为准(`HOOK_ENTRY_FIELDS`),CC 五型条目 schema 上的每个键都在表里(`cli309.js:252382`):`args`(command;exec 形参数表,元素另判零 NUL —— `spawn()` 对含 NUL 的参数抛,CC 的串数组不判)· `onFailure`(command / http;词表 `HOOK_ON_FAILURE_WORDS` = `continue` \| `block`;缺席不补缺省)· `rewakeMessage` / `rewakeSummary`(command;非空串 —— CC 的 `min(1)`,空白 / 多行 / NUL 都是值)· `cloud`(command / http;**任意值照带** —— CC 的 `.catch("skip")` 没有坏值,词表 `HOOK_CLOUD_WORDS` = `device` \| `skip` 只是读者折法的参考)· `continueOnBlock`(prompt;布尔)。`args` / `onFailure` / `rewakeMessage` / `rewakeSummary` / `continueOnBlock` 的坏值一律是坏块(不剥键、不折默认);写在 CC 的 schema 没有它的型上、或 CC 不认识的键(本包自己的列 `plugin` 除外,见 H8),仍是契约外的键(剥掉,不算坏块;键下装着守卫迹象的除外:H3,整份拒) | 认得这些字段,逐键同归属型(`cli309.js:252382`:`args` 只在 command,`onFailure` 与 `cloud` 在 command 与 http,`rewakeMessage` / `rewakeSummary` 只在 command,`continueOnBlock` 只在 prompt);`cloud` 的任何值都合法 | 契约只收本包定义的字段;`args` / `onFailure` 19.0.0 起进表、另四键 20.0.0 起进表(此前被剥掉:exec 形条目只剩可执行名去跑,`block` 的守卫起不来照放行,守卫事件里 `rewakeMessage: ""` / 非布尔 `continueOnBlock` 照装 —— 比 CC 松,这一条随 20.0.0 收了);字段级的上游漂移今天没有门(type 集有,见漂移门 ①b)—— 未闭环 |
22
22
  | H8 | command 条目承运本包自己的一列 `plugin`(插件上下文 `HookPluginContext` = `{ name, root, dataDir?, options? }`,31.0.0;行尾):成员闭集,`name` 非空无 NUL,`root` / `dataDir` 主机绝对路径,选项键是标识符且大写后不相撞,选项值是无 NUL 的串或 **`vault` 种**凭据引用 `{ kind: "vault", entry }`(别的种类一律不收);坏的 `plugin` 是坏块(非守卫事件剔那一条、守卫事件整份拒,`field` = `plugin`) | 设置文件 hook 条目的 schema 没有这个键(`cli321.js:276219` 的 command 条目:`args` / `shell` / `async` / `asyncRewake` / `onFailure` / `rewakeMessage` / `rewakeSummary` / `cloud` 与公共字段,没有 `plugin`):写了就剥掉、照装 —— 插件 hook 的上下文由插件加载器从插件所在处给,不写在条目上 | 本栈的壳把插件 hook 投影进请求,上下文得随条目到达执行面;一份上下文一个判官(此前执行面自带一份形判,壳用的分类器副本把这个键剥掉、投前自检看不见它)。代价:一份写了坏 `plugin` 的设置文件,CC 剥键照装,这里那一条被剔 / 守卫事件整份不装 |
23
+ | H9 | http 条目的 `url`(值形 `url`,32.0.0 起):非空、无 NUL 的串,运行时的 WHATWG URL 解析器**原样**读得出一个绝对 URL(`URL.canParse(值)`),**去掉两端空白之后**也读得出(`URL.canParse(值.trim())`,即 CC 读的那一份 —— 所以本包收的 CC 必收);**原样带**,不把去过空白的那一份带走。所以两种值与 CC 分开:① 两端带 URL 解析器自己不去、且带着它原样解析不出的空白(不换行空格 U+00A0、全角空格 U+3000、BOM U+FEFF 等非 ASCII 空白 —— 写在开头恒如此;写在结尾落在路径里的,解析器把它编码,两边都收、本包原样带;ASCII 空格与串中的 `\t` `\n` `\r` 解析器自己会去,两边都收);② 串里有 NUL(值形 `text` 的律,20.0.0 起)。两种都是坏块(非守卫事件剔那一条、守卫事件整份拒,`field` = `url`) | `url:o().url()`(`cli321.js:276219`;`o` 是 zod 4.6.2 的串,判法在 `:275880` 的 `$ZodURL`):先 `value.trim()`(JS 的空白全集,含上面几种),再交 URL 解析器;带走的是 trim 后再删 `\t` `\n` `\r` 的那一份。①② 两种 CC 都照装(路径里的 NUL 被解析器编成 `%00`) | 判的就是带走的那一份,分类器不改写值(与 `cloud` 原样照带同一条律);两端的非 ASCII 空白多半是粘贴带进来的,CC 去掉了、执行面按原样去请求就会请求失败。代价:一份 url 两端带这类空白(或含 NUL)的设置文件,CC 照装,这里那一条被剔 / 守卫事件整份不装 —— 删掉那几个字符即可 |
23
24
 
24
25
  不是偏差的(与 CC 同):守卫事件集 {`PreToolUse`, `PermissionRequest`};守卫事件值 `null` = 剔不拒;非守卫事件里坏匹配器 / 坏条目逐个剔;hook 条目 type 五种;command / http 条目的 `cloud` 任意值照带(CC 的 `.catch("skip")` 接住任何值、读作 `skip`、文件照装,折在读者;本包不判、不折、不剥)。
25
26
 
@@ -33,6 +34,14 @@
33
34
 
34
35
  不是偏差的(与 CC 同):选项占位只在插件条目上是占位 —— CC 只对插件钩子取选项表(`:288367` 的 `if(Te)Eo=await tH(Te,tt)`;`tH` 对插件恒给一张表,没有选项也是 `{}`),shell 形的拒(`!Cn&&Eo`)与 exec 形的替(`if(Eo)…pen(…)`)都挂在这张表上;不是插件带来的条目里 `${user_config.K}` 原样交给程序 / shell。本包同形:是不是插件条目由条目自己带(条目上有 `plugin` 成员,与分类器同一只读法);条目上没有 `plugin` 时 `${user_config.…}` 不是占位、原样留下,shell 形不因它而拒;插件条目的表是解后的表或它自己的 `plugin.options`(没有 `options` 成员是空表 `{}`,也算表),照判。
35
36
 
37
+ ## 钩子输入输出形里的「名 → 值」记录(`src/hooks.ts`,32.0.0 起)
38
+
39
+ 锚 = CC 2.1.321 语料 `cli321.js`(只 grep,不解包;坐标写行号,只引不抄)。六只记录在参照的 schema 里是同一个形 `me(o(),ie()).optional()`,读作 zod 的 `record(string(), unknown())`:`me` 是 `:275932` 里 `type:"record"` 的构造,`o` 是同一行里 `ZodString` 的构造,`ie` 是 `ZodUnknown` 的构造(各块之间的导入绑定没有逐块核,标识符按同名定义读)。输入两只在 `:276995`,输出四只在 `:276996`,逐只见下表。记录的读法是 `:275930` 里语料自带的那份 zod 记录解析:按 `Reflect.ownKeys` 逐键走,自有键 `__proto__` 先 `continue`(键不判、值不判、输出里没有),别的名字过键 schema 与值 schema 后进输出 —— `constructor` / `prototype` 照收照带。以上读自语料,没有跑过 CC 本体;CC 运行时是不是正好拿这几只 schema 判钩子输入 / 输出,没有核。这一处在**更严**的方向:参照读法照收的记录,这里整份拒。
40
+
41
+ | 号 | 面 | CC 原形 | 本包 | 方向 | 理由 | 读它的 |
42
+ |---|---|---|---|---|---|---|
43
+ | SS-CCD-10 | 钩子输入输出形里的六只记录,按座位分两类。**输入两只**(交给钩子的):`ElicitationHookInput.requested_schema`(`src/hooks.ts:429`;MCP 服务器要的表单 schema,成员名是 JSON Schema 的关键字)· `ElicitationResultHookInput.content`(`:438`;用户的表单答案,成员名是表单字段名)。**输出四只**(钩子交回的):`HookPermissionRequestDecision` allow 臂的 `updatedInput`(`:608`;工具参数名)· `HookSpecificOutput` 的 PreToolUse `updatedInput`(`:627`;工具参数名)/ Elicitation `content`(`:653`;表单字段名)/ ElicitationResult `content`(`:658`;表单字段名) | 六只都是 `record(string, unknown)`。输入两只在 `cli321.js:276995`:Elicitation 输入的 `requested_schema` · ElicitationResult 输入的 `content`;输出四只在 `:276996`:PreToolUse 的 `updatedInput` · PermissionRequest 决定 allow 臂的 `updatedInput` · Elicitation 的 `content` · ElicitationResult 的 `content`。读法在 `:275930`:成员名叫 `constructor` / `prototype` 的照收、照带;带自有 `__proto__` 键的,那一键被静默跳过、其余照收 | 这六只是记录座位,与包里每一只记录座位同一条律:成员名是保留成员名(`__proto__` / `constructor` / `prototype`)⇒ 整份拒(`params.flaw` = `member_name_reserved`,句子 `no member of a declaration may be named "<名>"`) | 更严 | 一只守卫一张表:剥掉 `__proto__` 是「读成没有这一键」,下游看不见被改写的那一键;`constructor` / `prototype` 作成员名,读方对普通对象做下标读时撞上原型成员。代价按座位分开读:**输入两只**的成员名来自 MCP 服务器(表单 schema 的关键字)与用户的表单答案(字段名由服务器的表单定),这三个名之一作成员名的输入,参照读法照收,这里整份判不过 —— 这份输入还交不交给钩子,看判它的一方怎么处置判不过的输入,本包读不出;**输出四只**的成员名来自钩子本身,工具参数或表单字段恰叫这三个名之一的钩子输出(改写后的工具输入、表单内容),参照读法照收,这里整份判不过 —— 守卫的决定(block / deny)会不会跟着丢,看消费方怎么处置判不过的钩子输出,本包读不出 | 按本包 schema 判钩子输入 / 输出的执行面与终端 |
44
+
36
45
  ## URL 名单与 http hook 名单(`src/url-pattern.ts` / `src/http-hook-allowlists.ts`)
37
46
 
38
47
  | 号 | 面 | CC 原形 | 本包 | 方向 | 理由 | 读它的 |