@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.
- package/CHANGELOG.md +505 -0
- package/README.md +17 -1
- package/conformance/VERSION +1 -1
- package/dist/api/auth-bridge.js +4 -3
- package/dist/api/auth.js +6 -5
- package/dist/api/credentials.js +9 -8
- package/dist/api/pull-token.js +2 -1
- package/dist/api/scopes.js +5 -4
- package/dist/center-refs.js +3 -2
- package/dist/config-dir-io.d.ts +1 -1
- package/dist/config-dir-io.js +3 -2
- package/dist/config-document-refusal.d.ts +1 -1
- package/dist/config-document-refusal.js +2 -1
- package/dist/config-fns.d.ts +4 -4
- package/dist/config-fns.js +17 -16
- package/dist/config-root-documents.js +4 -3
- package/dist/config-root-node.d.ts +1 -1
- package/dist/config-root-node.js +3 -2
- package/dist/conformance/derive.d.ts +3 -3
- package/dist/conformance/derive.js +6 -5
- package/dist/conformance/types.js +4 -3
- package/dist/cross-domain.js +6 -5
- package/dist/cross-session.js +3 -2
- package/dist/deep-freeze.d.ts +26 -0
- package/dist/deep-freeze.js +69 -0
- package/dist/default-model.js +2 -1
- package/dist/device-relay.d.ts +1 -1
- package/dist/device-relay.js +1 -1
- package/dist/env-model-table.js +2 -1
- package/dist/execution-lane-index.d.ts +1 -1
- package/dist/execution-lane-index.js +5 -4
- package/dist/execution-lanes.d.ts +2 -2
- package/dist/execution-lanes.js +18 -17
- package/dist/file-store.js +2 -1
- package/dist/fleet.d.ts +20 -4
- package/dist/fleet.js +32 -16
- package/dist/hooks-config.d.ts +12 -12
- package/dist/hooks-config.js +16 -15
- package/dist/hooks.d.ts +5 -5
- package/dist/hooks.js +17 -16
- package/dist/http-hook-allowlists.js +2 -1
- package/dist/index.js +1 -1
- package/dist/mcp-request-entry.js +2 -1
- package/dist/mcp-server-policy.js +3 -2
- package/dist/migration-receipt.d.ts +1 -1
- package/dist/migration-receipt.js +3 -2
- package/dist/one-time-migrations.js +3 -2
- package/dist/own-key-read.d.ts +3 -1
- package/dist/plain-json-object.d.ts +6 -3
- package/dist/plain-json-object.js +6 -3
- package/dist/portable-domains.js +4 -3
- package/dist/reserved-member-name.d.ts +1 -1
- package/dist/reserved-member-name.js +3 -2
- package/dist/resolve-roster.js +3 -2
- package/dist/retired-envs.js +3 -6
- package/dist/safety-merge-spec.d.ts +11 -4
- package/dist/safety-merge-spec.js +5 -4
- package/dist/secret-scan.js +1 -1
- package/dist/settings-sources.js +6 -5
- package/dist/settings-units.js +3 -2
- package/dist/types.d.ts +9 -9
- package/dist/types.js +27 -26
- package/dist/ui-language.js +4 -3
- package/dist/url-credential.js +4 -3
- package/dist/url-shape.d.ts +1 -1
- package/dist/url-shape.js +5 -4
- package/dist/web-admin-credential.js +2 -1
- package/dist/web-admin-env.d.ts +1 -1
- package/dist/web-admin-env.js +4 -3
- package/docs/CONSUMER-INTEGRATION.md +48 -3
- package/llms-full.txt +5 -3
- package/llms.txt +4 -2
- package/package.json +1 -1
|
@@ -198,6 +198,12 @@ export declare const FailMode: z.ZodEnum<{
|
|
|
198
198
|
open: "open";
|
|
199
199
|
}>;
|
|
200
200
|
export type FailMode = z.infer<typeof FailMode>;
|
|
201
|
+
/** `T` with every field and every array read-only, at every depth (type level only — no runtime effect). The spec table {@link SAFETY_MERGE_SPEC} is deep-frozen, so the
|
|
202
|
+
* type of one of its rows, and of a rule read off one, must not offer a write the frozen row refuses; a `z.infer` type is mutable by construction,
|
|
203
|
+
* this is its read-only projection. A mutable value is assignable to it, so a caller that builds a rule or a row keeps compiling. */
|
|
204
|
+
type ReadonlyDeep<T> = T extends readonly (infer U)[] ? readonly ReadonlyDeep<U>[] : T extends object ? {
|
|
205
|
+
readonly [K in keyof T]: ReadonlyDeep<T[K]>;
|
|
206
|
+
} : T;
|
|
201
207
|
/** The monotone tighten-only direction for a category (which way is "stricter"). `enumRank.order` lists values
|
|
202
208
|
* from LOOSEST→STRICTEST — the category's whole vocabulary: a word outside it is refused, and a ONE-word order (11.0.0:
|
|
203
209
|
* `shellGate`, whose engine vocabulary is the single floor word) is the degenerate rank where the only merge is identity;
|
|
@@ -225,7 +231,7 @@ export declare const TightenRule: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
225
231
|
}, z.core.$strip>, z.ZodObject<{
|
|
226
232
|
rule: z.ZodLiteral<"numericLower">;
|
|
227
233
|
}, z.core.$strip>], "rule">;
|
|
228
|
-
export type TightenRule = z.infer<typeof TightenRule
|
|
234
|
+
export type TightenRule = ReadonlyDeep<z.infer<typeof TightenRule>>;
|
|
229
235
|
/** Where `candidate` lands relative to `existing` under a {@link TightenRule} (14.6.0; closed, in this order):
|
|
230
236
|
* `equal` · `stricter` · `looser` · `unordered` (comparable values, neither side contains the other — two different sets,
|
|
231
237
|
* two different `none` values) · `unreadable` (a side is outside the rule's normalized domain — absent, misspelled,
|
|
@@ -333,7 +339,7 @@ export declare const MergeCategorySpec: z.ZodObject<{
|
|
|
333
339
|
list: z.ZodOptional<z.ZodLiteral<true>>;
|
|
334
340
|
}, z.core.$strip>>>;
|
|
335
341
|
}, z.core.$strip>;
|
|
336
|
-
export type MergeCategorySpec = z.infer<typeof MergeCategorySpec
|
|
342
|
+
export type MergeCategorySpec = ReadonlyDeep<z.infer<typeof MergeCategorySpec>>;
|
|
337
343
|
/** The category spec. Keys = the unified settings categories both seats map their concrete keys/fields into.
|
|
338
344
|
* Faithful to settings-core v2-design §3 (the semantic source of record). */
|
|
339
345
|
export declare const SAFETY_MERGE_SPEC: {
|
|
@@ -370,7 +376,7 @@ export declare const SAFETY_MERGE_SPEC: {
|
|
|
370
376
|
readonly minTrust: "global";
|
|
371
377
|
readonly tighten: {
|
|
372
378
|
readonly rule: "enumRank";
|
|
373
|
-
readonly order: ["bypassPermissions", "auto", "acceptEdits", "default", "dontAsk", "plan"];
|
|
379
|
+
readonly order: readonly ["bypassPermissions", "auto", "acceptEdits", "default", "dontAsk", "plan"];
|
|
374
380
|
};
|
|
375
381
|
readonly enforcement: "gate";
|
|
376
382
|
readonly fail: "closed";
|
|
@@ -392,7 +398,7 @@ export declare const SAFETY_MERGE_SPEC: {
|
|
|
392
398
|
readonly minTrust: "global";
|
|
393
399
|
readonly tighten: {
|
|
394
400
|
readonly rule: "enumRank";
|
|
395
|
-
readonly order: ["always"];
|
|
401
|
+
readonly order: readonly ["always"];
|
|
396
402
|
};
|
|
397
403
|
readonly enforcement: "gate";
|
|
398
404
|
readonly fail: "closed";
|
|
@@ -690,3 +696,4 @@ export declare function resolveMemberTighten(spec: MergeCategorySpec, member: st
|
|
|
690
696
|
/** A declared member's comparator from the published table (see {@link resolveMemberTighten}); compare two of its values with
|
|
691
697
|
* {@link tightenVerdict}. Unknown category or member ⇒ RangeError (never the category rule as a fallback). */
|
|
692
698
|
export declare function memberTighten<C extends SafetyMergeCategory>(category: C, member: SafetyMergeMember<C>): TightenRule;
|
|
699
|
+
export {};
|
|
@@ -68,6 +68,7 @@ import { z } from "zod";
|
|
|
68
68
|
import { MAX_HASH_DEPTH, stableStringify } from "./hash.js";
|
|
69
69
|
import { captureStringArray, dataDescriptor, isAccessorDescriptor, isolatedObject } from "./own-key-read.js";
|
|
70
70
|
import { jsonShapeOf } from "./plain-json-object.js";
|
|
71
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
71
72
|
/** How values from different layers/principals combine for a category. */
|
|
72
73
|
export const MergeShape = z.enum(["denyFirst", "replace", "runAll", "overrideByName", "concat"]);
|
|
73
74
|
/** The trust-tier VOCABULARY as a RUNTIME VALUE — the ONE source of the ladder's words, in the same form as
|
|
@@ -77,7 +78,7 @@ export const MergeShape = z.enum(["denyFirst", "replace", "runAll", "overrideByN
|
|
|
77
78
|
* table as the one global the closure needs, instead of writing a ladder of its own.
|
|
78
79
|
* ⚠️ The DECLARATION ORDER is NOT the rank (it is the 1.1.0 order with `task` appended — kept byte-stable because
|
|
79
80
|
* reordering is breaking); never index it as a ladder — use {@link trustRank}. */
|
|
80
|
-
export const MIN_TRUST_WORDS = ["local", "session", "project", "global", "managed", "task"];
|
|
81
|
+
export const MIN_TRUST_WORDS = deepFreeze(["local", "session", "project", "global", "managed", "task"]);
|
|
81
82
|
/** The trust-tier VOCABULARY a category — or, since 1.1.0, one of its members — names as its admission floor
|
|
82
83
|
* (the MINIMUM trust a layer/principal must have to set it). The RANK is v2-design §1:29,
|
|
83
84
|
* `managed 6 > global 5 > project 4 > local 3 > session 2 > task 1`, published as {@link trustRank}; compare with
|
|
@@ -177,7 +178,7 @@ export const TightenRule = z.discriminatedUnion("rule", [
|
|
|
177
178
|
* `equal` · `stricter` · `looser` · `unordered` (comparable values, neither side contains the other — two different sets,
|
|
178
179
|
* two different `none` values) · `unreadable` (a side is outside the rule's normalized domain — absent, misspelled,
|
|
179
180
|
* the wrong type). */
|
|
180
|
-
export const TIGHTEN_VERDICTS = ["equal", "stricter", "looser", "unordered", "unreadable"];
|
|
181
|
+
export const TIGHTEN_VERDICTS = deepFreeze(["equal", "stricter", "looser", "unordered", "unreadable"]);
|
|
181
182
|
/** `diff` > 0 ⇒ the candidate is higher on the strictness order. */
|
|
182
183
|
function orderVerdict(diff) {
|
|
183
184
|
return diff > 0 ? "stricter" : diff < 0 ? "looser" : "equal";
|
|
@@ -348,7 +349,7 @@ export const MergeCategorySpec = z.object({
|
|
|
348
349
|
});
|
|
349
350
|
/** The category spec. Keys = the unified settings categories both seats map their concrete keys/fields into.
|
|
350
351
|
* Faithful to settings-core v2-design §3 (the semantic source of record). */
|
|
351
|
-
export const SAFETY_MERGE_SPEC = {
|
|
352
|
+
export const SAFETY_MERGE_SPEC = deepFreeze({
|
|
352
353
|
// 1.1.0 [5797] ④ — member-level admission, direction-asymmetric (header): allow = loosen ⇒ global-or-managed;
|
|
353
354
|
// deny/ask = tighten ⇒ every settings-file layer (local = the lowest file tier). The category minTrust stays
|
|
354
355
|
// "global" = the DEFAULT floor (member rows override it; consumers that predate `members` still enforce it on
|
|
@@ -459,7 +460,7 @@ export const SAFETY_MERGE_SPEC = {
|
|
|
459
460
|
disableAutoMode: { direction: "tighten", minTrust: "global", boolPole: { strict: true, minTrust: "local" } },
|
|
460
461
|
},
|
|
461
462
|
},
|
|
462
|
-
};
|
|
463
|
+
});
|
|
463
464
|
/** Own-property table lookup. The category union is compile-time only; a JavaScript or deserialized caller can
|
|
464
465
|
* hand in `"__proto__"` / `"constructor"` / `"toString"`, which a bare index resolves through Object.prototype
|
|
465
466
|
* to a non-spec object — `membersOf` would then answer `[]` = "whole key, nothing to check" (fail-OPEN). An
|
package/dist/secret-scan.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* 不靠异常:单个转义的判据写成字符集(只有 ASCII 的 `%00`–`%7F` 单独解得开),转义串的判据写成 UTF-8 良构判定 ——
|
|
11
11
|
* 结果与原来的 try/catch 逐字相同(`test/disclosable-identity-6.3.0.test.ts` 的两只冻结 oracle 钉着)。
|
|
12
12
|
*
|
|
13
|
-
* 本模块只引 `./url-shape`(
|
|
13
|
+
* 本模块只引 `./url-shape`(叶子:自己只引包内私有的零 import 叶 `./deep-freeze`;`./types` 引本模块,本模块不回引,不成环)。
|
|
14
14
|
*/
|
|
15
15
|
import { httpUrlFlaws } from "./url-shape.js"; // the URL shape judge — whether a parsed URL carries userinfo is its call
|
|
16
16
|
/** How many percent-decoded layers a secret scan reads beyond the raw string (a multi-encoded `%2573%256B…` →
|
package/dist/settings-sources.js
CHANGED
|
@@ -35,18 +35,19 @@
|
|
|
35
35
|
import { echoCallerText } from "./caller-text-echo.js";
|
|
36
36
|
import { stripControlAndBidi } from "./control-and-bidi.js";
|
|
37
37
|
import { SAFETY_MERGE_SPEC, isAtLeast, memberAdmission } from "./safety-merge-spec.js";
|
|
38
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
38
39
|
/** The settings sources, in MERGE order (a later source overrides an earlier one where a category's merge shape lets it):
|
|
39
40
|
* user < project < local < flag < policy. `flagSettings` = settings handed in at launch (`--settings <file|json>`, an SDK embedder's inline
|
|
40
41
|
* settings); `policySettings` = managed. `foreignProjectSettings` (appended) = the repository's settings files written for another tool; it
|
|
41
42
|
* contributes tightening writes only, and every tighten rule merges by "the stricter wins" (order-independent), so its place in the order
|
|
42
43
|
* changes no merged value. */
|
|
43
|
-
export const SETTINGS_SOURCES = ["userSettings", "projectSettings", "localSettings", "flagSettings", "policySettings", "foreignProjectSettings"];
|
|
44
|
+
export const SETTINGS_SOURCES = deepFreeze(["userSettings", "projectSettings", "localSettings", "flagSettings", "policySettings", "foreignProjectSettings"]);
|
|
44
45
|
/**
|
|
45
46
|
* The source table. `flagSettings` is in the operator tier (`global`, not repository-controllable) like CC's: settings handed in at launch are
|
|
46
47
|
* the launcher's own act — an SDK embedder or a wrapper script — not something a repository brings (a wrapper that turns repository content
|
|
47
48
|
* into `--settings` makes that choice itself).
|
|
48
49
|
*/
|
|
49
|
-
export const SETTINGS_SOURCE_CONTRACT = {
|
|
50
|
+
export const SETTINGS_SOURCE_CONTRACT = deepFreeze({
|
|
50
51
|
userSettings: { trust: "global", repoControllable: false },
|
|
51
52
|
projectSettings: { trust: "project", repoControllable: true },
|
|
52
53
|
localSettings: { trust: "project", repoControllable: true },
|
|
@@ -56,7 +57,7 @@ export const SETTINGS_SOURCE_CONTRACT = {
|
|
|
56
57
|
// project tier and repository-controlled like this product's own project files, and tighten-only — its deny / ask rules, kill-switches ON and
|
|
57
58
|
// sandbox restrictions are read, its allow rules, hooks, env, MCP servers and the rest never are (see the file header).
|
|
58
59
|
foreignProjectSettings: { trust: "project", repoControllable: true, tightenOnly: true },
|
|
59
|
-
};
|
|
60
|
+
});
|
|
60
61
|
/**
|
|
61
62
|
* The ONE lookup of {@link SETTINGS_SOURCE_CONTRACT}: a source's tier and whether a repository controls it. Every function in this package
|
|
62
63
|
* that needs a layer's tier reads it here ({@link layerAdmission}, the http hook allowlist judge, the MCP server list verdict) — none takes a
|
|
@@ -73,11 +74,11 @@ export function settingsSourceContract(source) {
|
|
|
73
74
|
* host must assume so), `no_trust_step` (the host has no trust step at all). A host whose reading throws or yields a word outside this set
|
|
74
75
|
* passes `declined`; this package's functions refuse an unknown word loudly rather than reading it as any tier.
|
|
75
76
|
*/
|
|
76
|
-
export const WORKSPACE_TRUST_STATES = ["accepted", "declined", "no_trust_step"];
|
|
77
|
+
export const WORKSPACE_TRUST_STATES = deepFreeze(["accepted", "declined", "no_trust_step"]);
|
|
77
78
|
/** What {@link layerAdmission} answers (closed): `admitted`; `trust_withheld` = would be admitted once the workspace is `accepted`;
|
|
78
79
|
* `below_trust_floor` = this source can never set it (its tier is below the floor); `tighten_only` = this source is read in the tighten direction
|
|
79
80
|
* only, so nothing — no workspace decision — admits this write from it. */
|
|
80
|
-
export const LAYER_ADMISSION_VERDICTS = ["admitted", "trust_withheld", "below_trust_floor", "tighten_only"];
|
|
81
|
+
export const LAYER_ADMISSION_VERDICTS = deepFreeze(["admitted", "trust_withheld", "below_trust_floor", "tighten_only"]);
|
|
81
82
|
/**
|
|
82
83
|
* Does a value from `source` for `category` (or one of its declared `member`s; `value` = the candidate value, for a value-directional member)
|
|
83
84
|
* enter the effective settings, given the workspace trust reading? The rule is in the file header; the data is {@link SETTINGS_SOURCE_CONTRACT}
|
package/dist/settings-units.js
CHANGED
|
@@ -60,8 +60,9 @@ import { classifyHooksConfig } from "./hooks-config.js";
|
|
|
60
60
|
import { captureJson, captureStringArray, ownEntriesOf } from "./own-key-read.js";
|
|
61
61
|
import { isPlainJsonObject } from "./plain-json-object.js";
|
|
62
62
|
import { SAFETY_MERGE_SPEC, resolveMemberTighten, tightenVerdict } from "./safety-merge-spec.js";
|
|
63
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
63
64
|
/** The settings-document units (see the file header). `path` is the unit's place in a settings document. */
|
|
64
|
-
export const SETTINGS_UNITS = {
|
|
65
|
+
export const SETTINGS_UNITS = deepFreeze({
|
|
65
66
|
permissions: { path: ["permissions"], category: "permissions", reads: "members" },
|
|
66
67
|
permissionMode: { path: ["permissions", "defaultMode"], category: "permissionMode", reads: "whole", reading: "permissionMode" },
|
|
67
68
|
additionalDirectories: { path: ["permissions", "additionalDirectories"], category: "sandboxNetwork", reads: "whole", reading: "stringList" },
|
|
@@ -72,7 +73,7 @@ export const SETTINGS_UNITS = {
|
|
|
72
73
|
env: { path: ["env"], category: "env", reads: "whole", reading: "envMap" },
|
|
73
74
|
model: { path: ["model"], category: "model", reads: "whole", reading: "nonEmptyString" },
|
|
74
75
|
outputStyle: { path: ["outputStyle"], category: "ui", reads: "whole", reading: "nonEmptyString" },
|
|
75
|
-
};
|
|
76
|
+
});
|
|
76
77
|
/** The one place a unit + optional member resolves to what is being asked about — the row and its comparator. Fail-closed
|
|
77
78
|
* and loud on every misaddressing: an unknown unit (own-property lookup — `"__proto__"` is unknown, not Object.prototype),
|
|
78
79
|
* a `members` unit without a member, a `whole` unit with one, a `member` unit given another one, an undeclared member
|
package/dist/types.d.ts
CHANGED
|
@@ -118,14 +118,14 @@ export type SealedApiKey = z.infer<typeof SealedApiKey>;
|
|
|
118
118
|
export type ParseTransparentValidator = "engine-ingest" | "consumer";
|
|
119
119
|
/** {@link PARSE_TRANSPARENT_KEYS} 的一行。 */
|
|
120
120
|
export interface ParseTransparentKey {
|
|
121
|
-
domain: DomainName;
|
|
121
|
+
readonly domain: DomainName;
|
|
122
122
|
/** 从域根算起的路径,`[]` = 数组条目,`{}` = Record 值(与门里的派生形逐字一致)。 */
|
|
123
|
-
path: string;
|
|
123
|
+
readonly path: string;
|
|
124
124
|
/** 这个键从哪一版起是解析透明的。 */
|
|
125
|
-
since: string;
|
|
126
|
-
validatedBy: ParseTransparentValidator;
|
|
125
|
+
readonly since: string;
|
|
126
|
+
readonly validatedBy: ParseTransparentValidator;
|
|
127
127
|
/** 为什么它在这里不设形判据 —— 一句,带真实后果。 */
|
|
128
|
-
why: string;
|
|
128
|
+
readonly why: string;
|
|
129
129
|
}
|
|
130
130
|
/**
|
|
131
131
|
* **解析透明键登记表** —— 本包收下但**不校验其形**的键,一处列全,连同「谁校验」。
|
|
@@ -509,7 +509,7 @@ export declare const ScenarioConfig: z.ZodObject<{
|
|
|
509
509
|
export type ScenarioConfig = z.infer<typeof ScenarioConfig>;
|
|
510
510
|
/** Platform credential surfaces a system may NEVER deliver into (红线1 — would let a publish overwrite the
|
|
511
511
|
* platform's own secrets). Runtime delivery (S3) re-checks; this is the save-time half. */
|
|
512
|
-
export declare const DELIVER_DENYLIST:
|
|
512
|
+
export declare const DELIVER_DENYLIST: ReadonlySet<string>;
|
|
513
513
|
export declare const SystemEntry: z.ZodObject<{
|
|
514
514
|
name: z.ZodString;
|
|
515
515
|
callsWorkers: z.ZodPrefault<z.ZodArray<z.ZodString>>;
|
|
@@ -737,7 +737,7 @@ export type EntitlementRuntimeCaps = z.infer<typeof EntitlementRuntimeCaps>;
|
|
|
737
737
|
* `allow*` ceilings tighten toward `false` (disabled wins); `forceDurableGate` tightens toward `true` (forced
|
|
738
738
|
* wins). Single source for the merge polarity so resolvers don't hardcode it. `Record<keyof …>` = a new cap
|
|
739
739
|
* without an entry is a COMPILE error (no silent wrong-direction merge). */
|
|
740
|
-
export declare const RUNTIME_CAP_STRICT: Record<keyof EntitlementRuntimeCaps, boolean
|
|
740
|
+
export declare const RUNTIME_CAP_STRICT: Readonly<Record<keyof EntitlementRuntimeCaps, boolean>>;
|
|
741
741
|
/** A named entitlement bundle (a `tier`, or a composable `role`). Bind a `roster` to inherit its model/skill/mcp
|
|
742
742
|
* visibility for free; explicit allowlists intersect on top. Edit a tier once → re-prices everyone on it. */
|
|
743
743
|
export declare const EntitlementTier: z.ZodObject<{
|
|
@@ -1422,7 +1422,7 @@ export declare const WorkerLifecycle: z.ZodObject<{
|
|
|
1422
1422
|
export type WorkerLifecycle = z.infer<typeof WorkerLifecycle>;
|
|
1423
1423
|
/** 结构化 WorkerSpec 字段已经产出的 env 名 —— 通用 `env` / `secretEnv` 逃生口**不许**设它们(用专属字段)。由
|
|
1424
1424
|
* `RESERVED_ENV_FIELD`(名 → 唯一写位)的键派生;增删理由见那张表的头注。 */
|
|
1425
|
-
export declare const RESERVED_WORKER_ENV:
|
|
1425
|
+
export declare const RESERVED_WORKER_ENV: ReadonlySet<string>;
|
|
1426
1426
|
/** 一台 worker 的名字(唯一 → 容器名 / compose project / 缺省路由键)—— **唯一**的名字判据。web-admin 在租约 / 用量 /
|
|
1427
1427
|
* discovery `?worker=` 等面上校验外部传来的 worker 名时读它(不抄窄正则)。 */
|
|
1428
1428
|
export declare const WORKER_NAME: z.ZodString;
|
|
@@ -3339,7 +3339,7 @@ export interface ConfigChange {
|
|
|
3339
3339
|
at: string;
|
|
3340
3340
|
summary?: string;
|
|
3341
3341
|
}
|
|
3342
|
-
export declare const DOMAINS: DomainName[];
|
|
3342
|
+
export declare const DOMAINS: readonly DomainName[];
|
|
3343
3343
|
/** The canonical "is this a config domain?" predicate. Use it instead of hard-coding a domain list when
|
|
3344
3344
|
* filtering arbitrary keys (e.g. a `config.d/` directory scan that also turns up the non-domain
|
|
3345
3345
|
* `remote-exec.json`) — `remote-exec` is NOT a domain (it's the exec backend; see writeRemoteExec). */
|
package/dist/types.js
CHANGED
|
@@ -39,6 +39,7 @@ import { AbsoluteHostPath } from "./host-path.js"; // the one host-path shape ju
|
|
|
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
41
|
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
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
42
43
|
// COARSE, best-effort literal-secret SHAPE detector (NOT exhaustive — the real boundary is the env-NAME schema
|
|
43
44
|
// on structured fields). Rejected in free-form value fields (worker `env`, model `extraBody`), URL components,
|
|
44
45
|
// AND as an env-NAME value (an AWS key id is a valid env-NAME charset yet is a secret VALUE, not a NAME). Case-
|
|
@@ -395,7 +396,7 @@ export const SealedApiKey = z.object({
|
|
|
395
396
|
* 双向对拍 —— 多登记一行(键已经不透明了)红,少登记一行(新键静默溜进来)也红;派生遇到不认识的
|
|
396
397
|
* schema 形 fail-loud,不「没认出来就当没有」。
|
|
397
398
|
*/
|
|
398
|
-
export const PARSE_TRANSPARENT_KEYS = [
|
|
399
|
+
export const PARSE_TRANSPARENT_KEYS = deepFreeze([
|
|
399
400
|
{
|
|
400
401
|
domain: "models",
|
|
401
402
|
path: "models[].compat",
|
|
@@ -459,7 +460,7 @@ export const PARSE_TRANSPARENT_KEYS = [
|
|
|
459
460
|
validatedBy: "engine-ingest",
|
|
460
461
|
why: "引擎的逐服务器启动界(握手与首次工具列举各带它);它只有一只判官 = 引擎根导出的 `mcpStartupTimeoutMs`(是不是数、整数性、范围一并判;坏值在引擎的拨号门拒这一台服务器、点名 `config.mcp_startup_timeout_invalid`,其余服务器照挂),投影它的消费方在交给引擎之前可调同一只;本包只承载 —— 这里哪怕只判「是不是数」,也是第二只判官的一部分,与引擎那只各答各的。",
|
|
461
462
|
},
|
|
462
|
-
];
|
|
463
|
+
]);
|
|
463
464
|
/** A catalog model's price / capability tier — fuels core 1.25 `selectModel({ tier })` role resolution. ONE closed set for both
|
|
464
465
|
* places that name it (`ModelEntry.tier`, `RoleTarget.select.tier`). Not the tier-group ladder of {@link TierBindings}
|
|
465
466
|
* (`ultra` … `lite`), which binds model NAMES to rungs. */
|
|
@@ -468,7 +469,7 @@ export const ModelTier = z.enum(["cheap", "standard", "premium"]);
|
|
|
468
469
|
* engine's `ModelThinkingLevel`, which exists only as a type — so the mirror is held at compile time by the upstream-drift gate (both directions: the
|
|
469
470
|
* engine adds or drops a word ⇒ `tsc` is red), not copied a second time anywhere else. The schema of the map ({@link ModelThinkingLevelMap}) mints its
|
|
470
471
|
* keys from this table. */
|
|
471
|
-
export const MODEL_THINKING_LEVEL_WORDS = ["off", "minimal", "low", "medium", "high", "xhigh", "max"];
|
|
472
|
+
export const MODEL_THINKING_LEVEL_WORDS = deepFreeze(["off", "minimal", "low", "medium", "high", "xhigh", "max"]);
|
|
472
473
|
/** What a deployment says one level is called on the wire: a non-empty string = the provider's own value for that level; `null` = this level is not
|
|
473
474
|
* supported on this model. (A level with no key at all = the provider's default. The empty string is not a value — it would put an empty effort on the wire.) */
|
|
474
475
|
const ThinkingLevelSpelling = z.string().min(1).nullable();
|
|
@@ -636,7 +637,7 @@ const RoleMap = z.partialRecord(ModelRole, RoleTarget, {
|
|
|
636
637
|
},
|
|
637
638
|
});
|
|
638
639
|
/** {@link AtMention} 的模式闭集:`all` = 每个启用的模型都可 `@`;`none` = 一个都不许;`only` = 只许 `models` 里点名的那几个。 */
|
|
639
|
-
export const AT_MENTION_MODES = ["all", "none", "only"];
|
|
640
|
+
export const AT_MENTION_MODES = deepFreeze(["all", "none", "only"]);
|
|
640
641
|
/** 「`@` 能点名哪些模型」(11.0.0,取代 `atModelAllowlist`)。义由 `mode` 说,不由数组空不空说:旧形一个数组靠「缺席 / 空 / 非空」
|
|
641
642
|
* 三种在场性背三种义,「一个都不许」表达不了,三个消费方各写了一只绕行。`only` 的名单至少一个名(空名单的义就是 `none`,一个义一种写法)。
|
|
642
643
|
* 全局位(`models.atMention`)缺省 `{mode:"all"}`;roster 位(`rosters[].atMention`)缺席 = 继承全局。收窄到某台 worker 的模型集
|
|
@@ -839,14 +840,14 @@ export const ScenarioConfig = z
|
|
|
839
840
|
// exclusively in the secret store (I1: audit/UI/API see fingerprints, never values).
|
|
840
841
|
/** Platform credential surfaces a system may NEVER deliver into (红线1 — would let a publish overwrite the
|
|
841
842
|
* platform's own secrets). Runtime delivery (S3) re-checks; this is the save-time half. */
|
|
842
|
-
export const DELIVER_DENYLIST = new Set([
|
|
843
|
+
export const DELIVER_DENYLIST = deepFreeze(new Set([
|
|
843
844
|
"a2-platform-secrets",
|
|
844
845
|
"tidb-creds",
|
|
845
846
|
"gitea-notify",
|
|
846
847
|
"worker-secrets",
|
|
847
848
|
// the orchestrator's OWN minted-token store (S2) — a system must never deliver into its credential source.
|
|
848
849
|
"systems-credentials",
|
|
849
|
-
]);
|
|
850
|
+
]));
|
|
850
851
|
export const SystemEntry = z.object({
|
|
851
852
|
/** System id = run.source value. Same shape the worker enforces for attribution. */
|
|
852
853
|
name: z.string().regex(/^[a-z][a-z0-9-]{1,31}$/, "lowercase slug, 2-32 chars (a-z, 0-9, -)"),
|
|
@@ -933,12 +934,12 @@ export const SystemStatusEntry = z.object({
|
|
|
933
934
|
/** retired 域的**墓碑表**:域名 → retired版本 / 事实今天住哪(/ 改写存量的一次性迁移,迁移还在时)。读存储文档的每个读者同判(`parseDomain` 拒写、`buildEffective`
|
|
934
935
|
* 向店要retired 域、`readEffectiveWire` 看 wire、`FileConfigStore` 与 `readBundle` 读 `config.d/<名>.json`):文档**带事实**(在场且不是 `{}`)⇒ 响亮拒
|
|
935
936
|
* (`RetiredDomainError`,句子点名今天的位);缺席或 `{}`(没有可丢的事实)⇒ 不理会。墓碑是拒,不是读法 —— 它不把旧文档读成任何值。 */
|
|
936
|
-
export const RETIRED_DOMAINS = {
|
|
937
|
+
export const RETIRED_DOMAINS = deepFreeze({
|
|
937
938
|
runtime: {
|
|
938
939
|
retiredIn: "11.0.0",
|
|
939
940
|
now: "governance (autonomy / commandPolicy / approvalRequire) and limits (rateLimitPerMin / maxTaskCostUsd / maxTaskTokens / maxPrincipalCostUsd / costQuotaWindowSec)",
|
|
940
941
|
},
|
|
941
|
-
};
|
|
942
|
+
});
|
|
942
943
|
/** 是不是一个retired 域名(墓碑表成员)。 */
|
|
943
944
|
export function isRetiredDomainName(x) {
|
|
944
945
|
return typeof x === "string" && Object.prototype.hasOwnProperty.call(RETIRED_DOMAINS, x);
|
|
@@ -1034,11 +1035,11 @@ export const LimitsConfig = z.object({
|
|
|
1034
1035
|
/** The autonomy ladder —— the closed set as a RUNTIME VALUE (same form as `REF_CHECKED_DOMAINS`): {@link AutonomyMode} (the zod enum)
|
|
1035
1036
|
* and its type are DERIVED from this table, so a consumer that needs the words at runtime (an env parser, a catalog's enum column) imports
|
|
1036
1037
|
* it instead of reaching into `GovernanceConfig.shape.autonomy.unwrap().options` or writing the four words again. */
|
|
1037
|
-
export const AUTONOMY_MODES = ["read-only", "ask", "plan", "auto"];
|
|
1038
|
+
export const AUTONOMY_MODES = deepFreeze(["read-only", "ask", "plan", "auto"]);
|
|
1038
1039
|
/** `governance.autonomy`'s enum, derived from {@link AUTONOMY_MODES}. */
|
|
1039
1040
|
export const AutonomyMode = z.enum(AUTONOMY_MODES);
|
|
1040
1041
|
/** A `commandPolicy[]` rule's decision —— the closed set as a RUNTIME VALUE; {@link CommandDecision} and its type are DERIVED from it. */
|
|
1041
|
-
export const COMMAND_DECISIONS = ["allow", "ask", "deny"];
|
|
1042
|
+
export const COMMAND_DECISIONS = deepFreeze(["allow", "ask", "deny"]);
|
|
1042
1043
|
/** `commandPolicy[].decision`'s enum, derived from {@link COMMAND_DECISIONS}. */
|
|
1043
1044
|
export const CommandDecision = z.enum(COMMAND_DECISIONS);
|
|
1044
1045
|
export const GovernanceConfig = z.object({
|
|
@@ -1217,7 +1218,7 @@ export const EntitlementRuntimeCaps = z.object({
|
|
|
1217
1218
|
* `allow*` ceilings tighten toward `false` (disabled wins); `forceDurableGate` tightens toward `true` (forced
|
|
1218
1219
|
* wins). Single source for the merge polarity so resolvers don't hardcode it. `Record<keyof …>` = a new cap
|
|
1219
1220
|
* without an entry is a COMPILE error (no silent wrong-direction merge). */
|
|
1220
|
-
export const RUNTIME_CAP_STRICT = {
|
|
1221
|
+
export const RUNTIME_CAP_STRICT = deepFreeze({
|
|
1221
1222
|
allowBypassPermissions: false,
|
|
1222
1223
|
allowAutoMode: false,
|
|
1223
1224
|
allowWorkflows: false,
|
|
@@ -1227,7 +1228,7 @@ export const RUNTIME_CAP_STRICT = {
|
|
|
1227
1228
|
allowUltracode: false,
|
|
1228
1229
|
allowMemoryOptOut: false,
|
|
1229
1230
|
forceDurableGate: true,
|
|
1230
|
-
};
|
|
1231
|
+
});
|
|
1231
1232
|
/** A named entitlement bundle (a `tier`, or a composable `role`). Bind a `roster` to inherit its model/skill/mcp
|
|
1232
1233
|
* visibility for free; explicit allowlists intersect on top. Edit a tier once → re-prices everyone on it. */
|
|
1233
1234
|
export const EntitlementTier = z.object({
|
|
@@ -1526,15 +1527,15 @@ export const PROJECT_ID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4
|
|
|
1526
1527
|
/** The bounds of a project registration's free-form fields —— the ONE source of these numbers: the schema below reads them, and so do
|
|
1527
1528
|
* the server's project routes and the admin / client forms (they import this, never copy a number). The path bound of `folder` / `file`
|
|
1528
1529
|
* entries is the host-path judge's own ({@link ABSOLUTE_HOST_PATH_MAX}). */
|
|
1529
|
-
export const PROJECT_LIMITS = {
|
|
1530
|
+
export const PROJECT_LIMITS = deepFreeze({
|
|
1530
1531
|
displayNameMax: 200,
|
|
1531
1532
|
goalMax: 2000,
|
|
1532
1533
|
contextItemsMax: 64,
|
|
1533
1534
|
noteMax: 4000,
|
|
1534
|
-
};
|
|
1535
|
+
});
|
|
1535
1536
|
/** A project context item's kind —— the closed set as a RUNTIME VALUE: `folder` / `file` = a host path (judged by the same
|
|
1536
1537
|
* {@link isAbsoluteHostPath} as a task's `cwd`), `note` = free text. */
|
|
1537
|
-
export const PROJECT_CONTEXT_ITEM_KINDS = ["folder", "file", "note"];
|
|
1538
|
+
export const PROJECT_CONTEXT_ITEM_KINDS = deepFreeze(["folder", "file", "note"]);
|
|
1538
1539
|
/** A project's icon: a token (lowercase letter first, then lowercase letters / digits / `-`, at most 64). Absent = the default icon. */
|
|
1539
1540
|
export const PROJECT_ICON_REGEX = /^[a-z][a-z0-9-]{0,63}$/;
|
|
1540
1541
|
/** A project's colour: `#` + six lowercase hex digits. Absent = the default colour. */
|
|
@@ -1845,7 +1846,7 @@ const WEB_ADMIN_ASSERTION_SEAT = {
|
|
|
1845
1846
|
token: "(injected by the orchestrator from the worker's assertion token — not configurable)",
|
|
1846
1847
|
};
|
|
1847
1848
|
const WEB_ADMIN_OPERATOR_FILE_SEAT = "(set directly by the operator on a hand-wired engine that is not managed by the orchestrator — never in a worker spec — not configurable)";
|
|
1848
|
-
const RESERVED_ENV_FIELD =
|
|
1849
|
+
const RESERVED_ENV_FIELD = deepFreeze({
|
|
1849
1850
|
PORT: "(fixed at 8090 — not configurable)", MODEL_PROVIDER: "model.provider", MODEL_ID: "model.modelId",
|
|
1850
1851
|
MODEL_REASONING: "model.reasoning", MODEL_CHEAP_ID: "model.cheapId", MODEL_MAX_TOKENS: "model.maxTokens",
|
|
1851
1852
|
MODEL_CONTEXT_WINDOW: "model.contextWindow", MODEL_COST_INPUT: "model.cost.input", MODEL_COST_OUTPUT: "model.cost.output",
|
|
@@ -1880,7 +1881,7 @@ const RESERVED_ENV_FIELD = Object.freeze({
|
|
|
1880
1881
|
});
|
|
1881
1882
|
/** 结构化 WorkerSpec 字段已经产出的 env 名 —— 通用 `env` / `secretEnv` 逃生口**不许**设它们(用专属字段)。由
|
|
1882
1883
|
* `RESERVED_ENV_FIELD`(名 → 唯一写位)的键派生;增删理由见那张表的头注。 */
|
|
1883
|
-
export const RESERVED_WORKER_ENV = new Set(Object.keys(RESERVED_ENV_FIELD));
|
|
1884
|
+
export const RESERVED_WORKER_ENV = deepFreeze(new Set(Object.keys(RESERVED_ENV_FIELD)));
|
|
1884
1885
|
/**
|
|
1885
1886
|
* 保留名被 `env` / `secretEnv` 逃生口设置时的拒因:点名键 + 它的唯一写位。句尾恒是「set it via <字段>」(下游按它抽归属字段,不动)。
|
|
1886
1887
|
* **迁移指路只有一条规则(7.0.1;16.0.0 起点名哪一条)**:这个键「旧形 ⇒ 一条还在的迁移能搬」(`LATE_LANE_ENV_KEYS`,与迁移读同一张表)就在键名后
|
|
@@ -2370,11 +2371,11 @@ export function workerRouteKey(w) {
|
|
|
2370
2371
|
* 默认折算**同源引用这一份**(worker 无 requests 时按 S 折算,§2-4)。值为 k8s quantity 串,直接落
|
|
2371
2372
|
* `WorkerSpec.resources`;「自定义」= 不用套餐、直接写 resources。定档口径:S=轻量单副本(默认档,略高于
|
|
2372
2373
|
* backend 兜底 50m/128Mi 的真实工作水位);M=常规编码 agent;L=重载(大 repo/多并发 turn)。 */
|
|
2373
|
-
export const WORKER_RESOURCE_PRESETS = {
|
|
2374
|
+
export const WORKER_RESOURCE_PRESETS = deepFreeze({
|
|
2374
2375
|
S: { requests: { cpu: "250m", memory: "512Mi" }, limits: { cpu: "1", memory: "1Gi" } },
|
|
2375
2376
|
M: { requests: { cpu: "500m", memory: "1Gi" }, limits: { cpu: "2", memory: "2Gi" } },
|
|
2376
2377
|
L: { requests: { cpu: "1", memory: "2Gi" }, limits: { cpu: "4", memory: "4Gi" } },
|
|
2377
|
-
};
|
|
2378
|
+
});
|
|
2378
2379
|
export const WorkersConfig = z
|
|
2379
2380
|
.object({ workers: z.array(WorkerSpec).prefault([]) })
|
|
2380
2381
|
.superRefine((cfg, ctx) => {
|
|
@@ -2627,7 +2628,7 @@ export const McpTransport = z.discriminatedUnion("kind", [
|
|
|
2627
2628
|
* PROMPT_ARTIFACT_LIMITS a mirror constant); the mirror is pinned HERE, by its owner: the upstream drift gate
|
|
2628
2629
|
* (group ⑥) asserts at compile time that this union and the engine type are the same in both directions, against the
|
|
2629
2630
|
* engine the devDependency pins. Consumers import this table — they keep no copy of their own. */
|
|
2630
|
-
export const MCP_CONTENT_ORIGINS = ["local", "execution", "external"];
|
|
2631
|
+
export const MCP_CONTENT_ORIGINS = deepFreeze(["local", "execution", "external"]);
|
|
2631
2632
|
export const McpServerSpec = z.object({
|
|
2632
2633
|
name: z.string().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/i, "letters/digits/._- , no spaces"),
|
|
2633
2634
|
transport: McpTransport,
|
|
@@ -2834,7 +2835,7 @@ export const PluginsConfig = z
|
|
|
2834
2835
|
/** 引擎 `ARTIFACT_LIMITS` 的镜像常量(本包不带引擎运行期依赖 ⇒ 镜像)。对表钉在**镜像的属主**这里:上游漂移门 ⑤ 逐键 === devDependency 钉住的那只引擎的导出。
|
|
2835
2836
|
* `maxOverlayTextBytes` / `maxTotalTextBytes` 引擎按 UTF-8 字节量;本包的 zod 按字符(UTF-16 码元)量 —— 码元数恒 ≤ UTF-8 字节数,所以本包的门恒宽于引擎、方向对。
|
|
2836
2837
|
* `maxIntentChars` / `maxRefChars` / `maxSourceRevisionChars` 引擎按 Unicode 码点量;本包用 `withinCodePoints` 同一把尺(不用 zod 的 `.max()`,它的单位随 zod 版本变)。 */
|
|
2837
|
-
export const PROMPT_ARTIFACT_LIMITS = {
|
|
2838
|
+
export const PROMPT_ARTIFACT_LIMITS = deepFreeze({
|
|
2838
2839
|
maxOverlays: 64,
|
|
2839
2840
|
maxOverlayTextBytes: 32_000,
|
|
2840
2841
|
maxTotalTextBytes: 131_072,
|
|
@@ -2842,7 +2843,7 @@ export const PROMPT_ARTIFACT_LIMITS = {
|
|
|
2842
2843
|
maxRefs: 32,
|
|
2843
2844
|
maxRefChars: 500,
|
|
2844
2845
|
maxSourceRevisionChars: 500,
|
|
2845
|
-
};
|
|
2846
|
+
});
|
|
2846
2847
|
/** 一个 binding 名(= 一次运行的场景名,`TaskSpec.promptBinding`)的长界 —— 引擎包根同名常量的镜像(对拍 = 上游漂移门 ⑤,逐值)。 */
|
|
2847
2848
|
export const PROMPT_BINDING_MAX_CHARS = 128;
|
|
2848
2849
|
/** 一张 `when.binding` 表至多点名几个 binding —— 引擎包根同名常量的镜像(同上)。 */
|
|
@@ -2991,7 +2992,7 @@ export const EffectivePromptsWire = z
|
|
|
2991
2992
|
})
|
|
2992
2993
|
.strict();
|
|
2993
2994
|
// ── The domain registry ───────────────────────────────────────────────────────
|
|
2994
|
-
export const DOMAIN_SCHEMAS = {
|
|
2995
|
+
export const DOMAIN_SCHEMAS = deepFreeze({
|
|
2995
2996
|
models: ModelsConfig,
|
|
2996
2997
|
rosters: RostersConfig,
|
|
2997
2998
|
skills: SkillsConfig,
|
|
@@ -3010,7 +3011,7 @@ export const DOMAIN_SCHEMAS = {
|
|
|
3010
3011
|
limits: LimitsConfig, // 0.19.0: cost/限流族热更新发布位(消费方 #322 批1;本地腿闭集缺口的源头修复)
|
|
3011
3012
|
a2a: A2aConfig, // 18.0.0: 常驻出站 A2A 对端名册(便携;本地腿 config.d/a2a.json 与中心腿 /effective.a2a 同一个声明座;线上按在场性承运,见 WIRE_CARRIED_DOMAINS)
|
|
3012
3013
|
// integrations + access: DELETED in 0.6.0 (EXPERT-REDESIGN §9) — parseDomain/effective/路由随之 404。
|
|
3013
|
-
};
|
|
3014
|
+
});
|
|
3014
3015
|
// ── Effective-config PROVENANCE (the unified shape TOC `sema config --effective` and TOB `/effective?principal=`
|
|
3015
3016
|
// step-5 trace both emit, so "why is this value what it is" renders identically across both seats). Settled
|
|
3016
3017
|
// via web-admin control-plane design gate③ (see web-admin control-plane design note §R2-T/§10). A pure
|
|
@@ -3049,7 +3050,7 @@ export const EffectiveKey = z.object({
|
|
|
3049
3050
|
* 不在表里的域在 1.0.0 起就在域表上,支持面内的每个生产方都恒发;线上缺席读作契约缺省(与读店同一份缺省)。**之后加进域表的域进这张表**:
|
|
3050
3051
|
* 比它旧的生产方必不发它,物化它就是替生产方编造一份「说了空」。读店 / 读 `config.d`(`EffectiveConfig`)不在本律内:那两腿的读者就是本包,恒懂每个域。
|
|
3051
3052
|
*/
|
|
3052
|
-
export const WIRE_CARRIED_DOMAINS = ["prompts", "a2a"];
|
|
3053
|
+
export const WIRE_CARRIED_DOMAINS = deepFreeze(["prompts", "a2a"]);
|
|
3053
3054
|
/** Reserved audit "domain" for RBAC/user-management events (not a config domain → no snapshot, not
|
|
3054
3055
|
* rollback-able). Lets user changes share the one audit stream the Audit page already renders. */
|
|
3055
3056
|
export const RBAC_AUDIT = "rbac";
|
|
@@ -3058,7 +3059,7 @@ export const RBAC_AUDIT = "rbac";
|
|
|
3058
3059
|
export const SECRETS_AUDIT = "secrets";
|
|
3059
3060
|
// Single source: derived from DOMAIN_SCHEMAS (insertion order = menu order) so the two can't drift —
|
|
3060
3061
|
// adding a domain to DOMAIN_SCHEMAS is enough. Object.keys preserves declaration order.
|
|
3061
|
-
export const DOMAINS = Object.keys(DOMAIN_SCHEMAS);
|
|
3062
|
+
export const DOMAINS = deepFreeze(Object.keys(DOMAIN_SCHEMAS));
|
|
3062
3063
|
/** The canonical "is this a config domain?" predicate. Use it instead of hard-coding a domain list when
|
|
3063
3064
|
* filtering arbitrary keys (e.g. a `config.d/` directory scan that also turns up the non-domain
|
|
3064
3065
|
* `remote-exec.json`) — `remote-exec` is NOT a domain (it's the exec backend; see writeRemoteExec). */
|
package/dist/ui-language.js
CHANGED
|
@@ -9,15 +9,16 @@
|
|
|
9
9
|
* 不是读设置时的事。
|
|
10
10
|
*/
|
|
11
11
|
import { z } from "zod";
|
|
12
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
12
13
|
/** 合法值闭集(声明序)。 */
|
|
13
|
-
export const UI_LANGUAGE_VALUES = ["en", "zh"];
|
|
14
|
+
export const UI_LANGUAGE_VALUES = deepFreeze(["en", "zh"]);
|
|
14
15
|
/** 这把键的声明:键名 / 值域 / 合并类 / 作用源 —— 三端读写键与值域都取这里。 */
|
|
15
|
-
export const UI_LANGUAGE_SETTING = {
|
|
16
|
+
export const UI_LANGUAGE_SETTING = deepFreeze({
|
|
16
17
|
key: "semaUiLanguage",
|
|
17
18
|
values: UI_LANGUAGE_VALUES,
|
|
18
19
|
category: "ui",
|
|
19
20
|
source: "userSettings",
|
|
20
|
-
};
|
|
21
|
+
});
|
|
21
22
|
/** 值的形门(写侧用:写进设置文件的只能是这两个词之一)。 */
|
|
22
23
|
export const UiLanguageSetting = z.enum(UI_LANGUAGE_VALUES);
|
|
23
24
|
/** 整份 `settings.json` 里本片段负责的那一键;刻意 `passthrough`(本片段不是整份设置的闭集门)。 */
|
package/dist/url-credential.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* **「这个 URL 的 userinfo 或 query / fragment 里,有没有名字在凭据名表上的参数」的名形判官**(14.5.0;lift 自 server `src/url-credential.ts`,规则、拒因词闭集与规则句逐字搬)
|
|
2
|
+
* **「这个 URL 的 userinfo 或 query / fragment 里,有没有名字在凭据名表上的参数」的名形判官**(14.5.0;lift 自 server `src/url-credential.ts`,规则、拒因词闭集与规则句逐字搬)。纯函数,除同包的 `./url-shape` 与包内私有的零 import 叶 `./deep-freeze` 外零 import,浏览器安全。
|
|
3
3
|
*
|
|
4
4
|
* ## 与 `NON_SECRET_URL`(`./types`)的关系:两个问题,互补,不是一个包含另一个
|
|
5
5
|
* 本判官按**名**判 —— 参数叫什么(名字是凭据名 = 整名在 {@link CREDENTIAL_PARAM_NAMES} 上、或以表上的强档词收尾,见下「名字判定」;不论值长什么样);`NON_SECRET_URL` 的 `urlQueryFragmentHasSecret` 按**值形**判密钥 —— 值长得像密钥
|
|
@@ -37,15 +37,16 @@
|
|
|
37
37
|
* 18.0.0 起本模块同表多一列 {@link COMPOUND_TAIL_STANCE}「这个词作为更长名字的末尾时算不算」:同一个 `Record<CredentialParamName, …>` 穷尽映射,表里加一个词而这一列不表态 ⇒ 编译红。
|
|
38
38
|
* 消费方(脱敏器的三个名字读者、受理口判官)读的是 {@link credentialParamWordOf} 返回的词 —— 拿它去查自己那一列(例:锚强度),不再对整名查表。
|
|
39
39
|
*/
|
|
40
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
40
41
|
import { httpUrlFlaws, httpUrlRule, isHierarchicalUrl } from "./url-shape.js";
|
|
41
42
|
/** 拒因词(闭集;判序 = 本数组序;词只在这一处写 —— {@link UrlCredentialReason} 与 {@link UrlCredential} 的成员都从它派生)。 */
|
|
42
|
-
export const URL_CREDENTIAL_REASONS =
|
|
43
|
+
export const URL_CREDENTIAL_REASONS = deepFreeze(["url_userinfo", "url_credential_param"]);
|
|
43
44
|
/**
|
|
44
45
|
* 凭据参数名表(闭集,23 词,全部是小写 ASCII `[a-z][a-z0-9_-]*`)。query / fragment 里名字整名(ASCII 大小写不敏感)在这张表上的参数就是凭据;
|
|
45
46
|
* 18.0.0 起以其中的强档词收尾的复合名也是(`db_password` 等,判由 {@link credentialParamWordOf})。
|
|
46
47
|
* 加一个词 = 表里加一格(minor);判官与 {@link isCredentialParamName} 现算,不手抄第二份。
|
|
47
48
|
*/
|
|
48
|
-
export const CREDENTIAL_PARAM_NAMES =
|
|
49
|
+
export const CREDENTIAL_PARAM_NAMES = deepFreeze([
|
|
49
50
|
"api_key", "apikey", "api-key", "key",
|
|
50
51
|
"token", "access_token", "refresh_token", "id_token",
|
|
51
52
|
"auth", "authorization", "proxy-authorization",
|
package/dist/url-shape.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* 部件按 WHATWG 序列化串(`href`)认:空 query `x?` 与空 fragment `x#` 在 `href` 里保留分隔符,`search` / `hash` 却是空串 ——
|
|
12
12
|
* 只看后者会把它们放过去(改前本包 `NON_SECRET_URL` 正是这样收下了 `https://gw/v1#`)。
|
|
13
13
|
*
|
|
14
|
-
* 拒句里值的样子(展示铸点)不在本模块:那是各宿主自己的展示律(server `buildRefusalShownUrl`)
|
|
14
|
+
* 拒句里值的样子(展示铸点)不在本模块:那是各宿主自己的展示律(server `buildRefusalShownUrl`)。本模块只 import 包内私有的零 import 叶 `./deep-freeze`(全包闭集常量唯一的冻结入口),纯函数,浏览器安全。
|
|
15
15
|
*
|
|
16
16
|
* ## 本模块里的第二个答案(如实,14.0.0 起;14.6.0 把分歧写成读数)
|
|
17
17
|
* 请求面 MCP 传输的 url(任务提交体 `mcpServers[i].transport.url`,`./mcp-request-entry`)今天不走上面的形判官,而是只看前缀
|
package/dist/url-shape.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* 部件按 WHATWG 序列化串(`href`)认:空 query `x?` 与空 fragment `x#` 在 `href` 里保留分隔符,`search` / `hash` 却是空串 ——
|
|
12
12
|
* 只看后者会把它们放过去(改前本包 `NON_SECRET_URL` 正是这样收下了 `https://gw/v1#`)。
|
|
13
13
|
*
|
|
14
|
-
* 拒句里值的样子(展示铸点)不在本模块:那是各宿主自己的展示律(server `buildRefusalShownUrl`)
|
|
14
|
+
* 拒句里值的样子(展示铸点)不在本模块:那是各宿主自己的展示律(server `buildRefusalShownUrl`)。本模块只 import 包内私有的零 import 叶 `./deep-freeze`(全包闭集常量唯一的冻结入口),纯函数,浏览器安全。
|
|
15
15
|
*
|
|
16
16
|
* ## 本模块里的第二个答案(如实,14.0.0 起;14.6.0 把分歧写成读数)
|
|
17
17
|
* 请求面 MCP 传输的 url(任务提交体 `mcpServers[i].transport.url`,`./mcp-request-entry`)今天不走上面的形判官,而是只看前缀
|
|
@@ -24,8 +24,9 @@
|
|
|
24
24
|
* `httpUrlFlaws(url, [座位禁的部件]).length === 0`(形与部件归本判官)—— 只收紧,不放宽;座位禁不禁 userinfo 是同一次 major 里要定的另一格(读器的拒句已写着凭据别放 URL)。
|
|
25
25
|
* 这个前缀守卫放在这里,是为了让「本包里判 URL 的正则」只有这一个模块。
|
|
26
26
|
*/
|
|
27
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
27
28
|
/** 座位可以禁掉的部件(闭集;判序 = 本数组序)。 */
|
|
28
|
-
export const HTTP_URL_PARTS = ["userinfo", "query", "fragment"];
|
|
29
|
+
export const HTTP_URL_PARTS = deepFreeze(["userinfo", "query", "fragment"]);
|
|
29
30
|
/** 「不是一个 http(s) URL」的规则句 —— 不透明形、不可解析、层级式非 http(s) 同一句;只点名规则,不回显 scheme。 */
|
|
30
31
|
export const HTTP_URL_SHAPE_RULE = "is not a parseable http(s) URL (scheme must be http or https; it must look like http(s)://host[:port][/path])";
|
|
31
32
|
/**
|
|
@@ -65,7 +66,7 @@ export function httpUrlFlaws(raw, forbid) {
|
|
|
65
66
|
* 词表加词时此处要显式裁(加进来还是明确不加),不会静默多禁一件。冻结:判官读的就是消费方手里的这一只。
|
|
66
67
|
* 按座位的本质命名,不按某个消费键名:谁的座位是「后面要拼路径的基址」,谁读它,不各自抄词。
|
|
67
68
|
*/
|
|
68
|
-
export const PATH_BASE_URL_FORBIDDEN_PARTS =
|
|
69
|
+
export const PATH_BASE_URL_FORBIDDEN_PARTS = deepFreeze(["userinfo", "query", "fragment"]);
|
|
69
70
|
/**
|
|
70
71
|
* **「逐字发给拨号方的地址」座位禁用的部件**(闭集、冻结、判序;16.0.0)。一个值若是被**逐字发布**、由别人原样去拨的地址(device 车道的设备入口
|
|
71
72
|
* `DEVICE_RELAY_URL`:引擎把它原样放上能力面,设备拨它):`userinfo` 把凭据发给每个读得到那张能力面的人;`query` / `fragment` 是令牌最常落的位置 ——
|
|
@@ -73,7 +74,7 @@ export const PATH_BASE_URL_FORBIDDEN_PARTS = Object.freeze(["userinfo", "query",
|
|
|
73
74
|
* 与 {@link PATH_BASE_URL_FORBIDDEN_PARTS} 今天同三词,但理由不同、各自裁:那一张管「往后拼路径会落错位」,这一张管「发布出去的地址里不留凭据位」——
|
|
74
75
|
* 一个座位改禁哪件,不连带另一个。策略集独立于判官词表 {@link HTTP_URL_PARTS},同上一张的规矩。
|
|
75
76
|
*/
|
|
76
|
-
export const DIAL_ADDRESS_URL_FORBIDDEN_PARTS =
|
|
77
|
+
export const DIAL_ADDRESS_URL_FORBIDDEN_PARTS = deepFreeze(["userinfo", "query", "fragment"]);
|
|
77
78
|
/**
|
|
78
79
|
* 「后面要拼路径的基址」座位的判:`[]` = 合格,否则按判序交回规则词 —— 就是 {@link httpUrlFlaws} 配 {@link PATH_BASE_URL_FORBIDDEN_PARTS},
|
|
79
80
|
* 不另写判法;规则词的句子取 {@link httpUrlRule}。答案只有词,不含值的任何片段。判**占位展开之后**的值:`http://$(POD_IP):8090` 过
|
|
@@ -26,6 +26,7 @@ import { buildQuotedIssue } from "./quoted-issue.js";
|
|
|
26
26
|
import { RFC3339_DATE_TIME } from "./rfc3339.js"; // the package's one RFC 3339 date-time judge (a project registration's `archivedAt` reads the same one)
|
|
27
27
|
import { WEB_ADMIN_ENV } from "./web-admin-env.js";
|
|
28
28
|
import { guardedSafeParse } from "./own-key-read.js"; // the one guarded zod verdict (parse + building its error in one guard)
|
|
29
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
29
30
|
/** 信封 `kind` 的闭集今只有一员(`SEALED_BOX_ALG` 同式的字面常量:schema 的字面与读方的比较都引它)。 */
|
|
30
31
|
export const WEB_ADMIN_CREDENTIAL_ENVELOPE_KIND = "user-session";
|
|
31
32
|
/** 一枚**令牌串**的形 —— 裸行 bearer、信封里的 `accessToken` / `refreshToken` 共用这**一条**律:可打印 ASCII
|
|
@@ -113,7 +114,7 @@ export function parseWebAdminCredentialFile(text) {
|
|
|
113
114
|
// ── 凭证二选一判官(每份凭证读 {@link WEB_ADMIN_ENV} 里的一对键:值键 | 文件键)────────────────────────────
|
|
114
115
|
/** 引擎向 web-admin 出示的凭证 —— 闭集;每一份由 {@link WEB_ADMIN_ENV} 里的**一对** env 名声明(值键 | 文件键):
|
|
115
116
|
* `access` = 主凭证(`token` / `tokenFile`),`assertion` = 断言令牌(`assertionToken` / `assertionTokenFile`)。 */
|
|
116
|
-
export const WEB_ADMIN_CREDENTIALS = ["access", "assertion"];
|
|
117
|
+
export const WEB_ADMIN_CREDENTIALS = deepFreeze(["access", "assertion"]);
|
|
117
118
|
/** 每份凭证的那一对键名。键是闭集的每一员(`Record` 穷举:闭集加一员而这里不给一对 = 编译错)。 */
|
|
118
119
|
const CREDENTIAL_ENV_PAIRS = {
|
|
119
120
|
access: { value: WEB_ADMIN_ENV.token, file: WEB_ADMIN_ENV.tokenFile },
|
package/dist/web-admin-env.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* 引擎连 web-admin 读的**全部 env 名** —— 一处定义(
|
|
2
|
+
* 引擎连 web-admin 读的**全部 env 名** —— 一处定义(叶模块,只 import 包内私有的零 import 叶 `./deep-freeze`:凭证判官、墓碑表与 worker 保留名表都引它);server 读、web-admin 给 worker 渲染、壳给本机引擎写,三方 import。
|
|
3
3
|
* 键名是部署面,手抄的键名会静默漂(此前只有 `token` / `tokenFile` 有契约位,其余六个各仓手抄)。读方只读这张表里的名字,
|
|
4
4
|
* 旧名一概不读(零双读):旧名是 `RETIRED_ENVS` 里的墓碑,在场即拒启。
|
|
5
5
|
*
|
package/dist/web-admin-env.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { deepFreeze } from "./deep-freeze.js";
|
|
1
2
|
/**
|
|
2
|
-
* 引擎连 web-admin 读的**全部 env 名** —— 一处定义(
|
|
3
|
+
* 引擎连 web-admin 读的**全部 env 名** —— 一处定义(叶模块,只 import 包内私有的零 import 叶 `./deep-freeze`:凭证判官、墓碑表与 worker 保留名表都引它);server 读、web-admin 给 worker 渲染、壳给本机引擎写,三方 import。
|
|
3
4
|
* 键名是部署面,手抄的键名会静默漂(此前只有 `token` / `tokenFile` 有契约位,其余六个各仓手抄)。读方只读这张表里的名字,
|
|
4
5
|
* 旧名一概不读(零双读):旧名是 `RETIRED_ENVS` 里的墓碑,在场即拒启。
|
|
5
6
|
*
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
* `env` 里写它们,会与渲染器写的值打架。断言令牌的值键 `assertionToken` 也是保留名(由编排器注入);两把凭证的文件键(`tokenFile` / `assertionTokenFile`)同样是保留名:
|
|
21
22
|
* 只给不经编排器的手接引擎、由运维直设,与同一份凭证的值键互斥,规格里写任一个都与注入撞。
|
|
22
23
|
*/
|
|
23
|
-
export const WEB_ADMIN_ENV = {
|
|
24
|
+
export const WEB_ADMIN_ENV = deepFreeze({
|
|
24
25
|
url: "SEMA_WEB_ADMIN_URL",
|
|
25
26
|
token: "SEMA_WEB_ADMIN_TOKEN",
|
|
26
27
|
tokenFile: "SEMA_WEB_ADMIN_TOKEN_FILE",
|
|
@@ -31,4 +32,4 @@ export const WEB_ADMIN_ENV = {
|
|
|
31
32
|
adminToken: "SEMA_WEB_ADMIN_ADMIN_TOKEN",
|
|
32
33
|
assertionToken: "SEMA_WEB_ADMIN_ASSERTION_TOKEN",
|
|
33
34
|
assertionTokenFile: "SEMA_WEB_ADMIN_ASSERTION_TOKEN_FILE",
|
|
34
|
-
};
|
|
35
|
+
});
|