@sema-agent/settings-schema 35.1.0 → 35.2.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.
@@ -0,0 +1,229 @@
1
+ import { echoCallerText } from "./caller-text-echo.js";
2
+ import { UNINSPECTABLE, containerView, dataDescriptor, inspect, isAccessorDescriptor, readDeclaredKey } from "./own-key-read.js";
3
+ import { jsonShapeOf } from "./plain-json-object.js";
4
+ /** 本 realm 的内建:构造器与方法加载时取一次(之后有人改写 `Map.prototype.has` / 全局 `Date` 之类,这里调的仍是加载时那一份);RegExp 的读取器在调用时从加载时取的内建原型上读、以源对象为接收者调。 */
5
+ const MAP = Map;
6
+ const SET = Set;
7
+ const DATE = Date;
8
+ const REGEXP = RegExp;
9
+ const REGEXP_PROTOTYPE = RegExp.prototype;
10
+ const MAP_HAS = Map.prototype.has;
11
+ const SET_HAS = Set.prototype.has;
12
+ const MAP_FOR_EACH = Map.prototype.forEach;
13
+ const SET_FOR_EACH = Set.prototype.forEach;
14
+ const MAP_SET = Map.prototype.set;
15
+ const SET_ADD = Set.prototype.add;
16
+ const DATE_GET_TIME = Date.prototype.getTime;
17
+ /** RegExp 的旗:`RegExp.prototype` 上每只旗的读取器(读正则自己的内部槽,不读实例成员)与它的字母,按 `flags` 的规范次序。 */
18
+ const REGEXP_FLAGS = [
19
+ ["hasIndices", "d"],
20
+ ["global", "g"],
21
+ ["ignoreCase", "i"],
22
+ ["multiline", "m"],
23
+ ["dotAll", "s"],
24
+ ["unicode", "u"],
25
+ ["unicodeSets", "v"],
26
+ ["sticky", "y"],
27
+ ];
28
+ const ROOT = { parent: undefined, segment: "value" };
29
+ const step = (parent, segment) => ({ parent, segment });
30
+ const IDENTIFIER = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
31
+ const keySegment = (key) => (IDENTIFIER.test(key) ? `.${echoCallerText(key)}` : `[${JSON.stringify(echoCallerText(key))}]`);
32
+ /** Map 的一个键在路径里的写法:原始值照写(串带引号、有界回显),对象键没有字面写法 ⇒ 交 `undefined`(路径改用 `.values()[i]`)。 */
33
+ const mapKeyText = (key) => {
34
+ if (typeof key === "string")
35
+ return JSON.stringify(echoCallerText(key));
36
+ if (typeof key === "symbol")
37
+ return echoCallerText(String(key));
38
+ if (typeof key === "bigint")
39
+ return `${String(key)}n`;
40
+ if (key === null || key === undefined || typeof key === "number" || typeof key === "boolean")
41
+ return String(key);
42
+ return undefined; // 对象 / 函数键:没有字面写法
43
+ };
44
+ function pathText(at) {
45
+ let text = "";
46
+ for (let cur = at; cur !== undefined; cur = cur.parent)
47
+ text = cur.segment + text;
48
+ return text;
49
+ }
50
+ function refusal(at, what) {
51
+ return new TypeError(`mutableCopyOf: ${pathText(at)} ${what}; only plain data is copied — arrays, plain objects, Map, Set, Date, RegExp and primitives`);
52
+ }
53
+ /** 品牌检查 + 读数:是这一种 ⇒ 读数;不是(内建读取器 / 方法对它抛)⇒ `undefined`。只调加载时取的内建,以源对象为接收者;不读源对象自己的成员。 */
54
+ function branded(v) {
55
+ if (inspect(() => Reflect.apply(MAP_HAS, v, [undefined])).ok)
56
+ return { kind: "map" }; // 内建 `has` 先认内部槽:不是 Map ⇒ 抛
57
+ if (inspect(() => Reflect.apply(SET_HAS, v, [undefined])).ok)
58
+ return { kind: "set" };
59
+ const time = inspect(() => Reflect.apply(DATE_GET_TIME, v, []));
60
+ if (time.ok)
61
+ return { kind: "date", time: time.value };
62
+ const regexp = inspect(() => {
63
+ const source = Reflect.get(REGEXP_PROTOTYPE, "source", v);
64
+ let flags = "";
65
+ for (const [getter, letter] of REGEXP_FLAGS)
66
+ if (Reflect.get(REGEXP_PROTOTYPE, getter, v) === true)
67
+ flags += letter;
68
+ return { source, flags };
69
+ });
70
+ if (regexp.ok)
71
+ return { kind: "regexp", source: regexp.value.source, flags: regexp.value.flags };
72
+ return undefined;
73
+ }
74
+ /** 一个值是什么:原始值(原样交回)或一只要拷的容器;都不是 ⇒ 抛 {@link refusal}。形状只问座位。 */
75
+ function classify(v, at) {
76
+ const shape = jsonShapeOf(v);
77
+ switch (shape) {
78
+ case "null":
79
+ case "primitive":
80
+ return { leaf: true };
81
+ case "array":
82
+ return { kind: "array" };
83
+ case "plain":
84
+ return branded(v) ?? { kind: "object" }; // 原型换成 null 的 Map / Set / Date / RegExp 座位读成朴素:先按内部槽认,认不出才是朴素对象
85
+ case "uninspectable":
86
+ throw refusal(at, `is ${UNINSPECTABLE}`);
87
+ case "non_plain_object": {
88
+ if (typeof v === "function")
89
+ throw refusal(at, "is a function");
90
+ const object = v;
91
+ const container = branded(object);
92
+ if (container !== undefined)
93
+ return container;
94
+ const internals = readDeclaredKey(object, "_zod").presence; // zod 4 的实例自带(不可枚举的)`_zod`:只看在不在场,不取值、不调 getter
95
+ switch (internals) {
96
+ case "own":
97
+ case "hidden":
98
+ throw refusal(at, "is a zod schema");
99
+ case "unreadable":
100
+ throw refusal(at, `is ${UNINSPECTABLE}`);
101
+ case "inherited":
102
+ case "absent":
103
+ throw refusal(at, "is an object of another kind (a class instance, or an object this realm does not recognise)");
104
+ default: {
105
+ const unhandled = internals;
106
+ throw new Error(`mutableCopyOf: unhandled presence ${String(unhandled)}`);
107
+ }
108
+ }
109
+ }
110
+ default: {
111
+ const unhandled = shape;
112
+ throw new Error(`mutableCopyOf: unhandled shape ${String(unhandled)}`);
113
+ }
114
+ }
115
+ }
116
+ /** 新建一只空副本(内容随后由工作表填)。 */
117
+ function emptyCopy(c) {
118
+ switch (c.kind) {
119
+ case "array":
120
+ return [];
121
+ case "object":
122
+ return {};
123
+ case "map":
124
+ return new MAP();
125
+ case "set":
126
+ return new SET();
127
+ case "date":
128
+ return new DATE(c.time);
129
+ case "regexp":
130
+ return new REGEXP(c.source, c.flags);
131
+ default: {
132
+ const unhandled = c;
133
+ throw new Error(`mutableCopyOf: unhandled container ${String(unhandled.kind)}`);
134
+ }
135
+ }
136
+ }
137
+ /**
138
+ * 取一份可改的深副本:纯数据逐层新建(任何一层都不冻,原值不动),别名保别名、环照拷;不是纯数据的地方抛 `TypeError` 点出路径(规则全文见本模块头注)。
139
+ * 用途:包根导出的闭集都是深冻结的,要在它的基础上改出一份自己的(排序、加一行、改一格)时调它,例:`const rules = mutableCopyOf(EXTENSION_NAMESPACES); rules.models?.push(…)`。
140
+ */
141
+ export function mutableCopyOf(value) {
142
+ const copies = new MAP();
143
+ const queue = { head: undefined, tail: undefined };
144
+ /** 一个值 ⇒ 它的副本:原始值原样;见过的源容器 ⇒ 同一份副本;新容器 ⇒ 先建空副本登记(别名与环由此成立),内容进工作队列。 */
145
+ const copyOf = (node, at) => {
146
+ const known = copies.get(node);
147
+ if (known !== undefined)
148
+ return known;
149
+ const c = classify(node, at);
150
+ if ("leaf" in c)
151
+ return node;
152
+ const source = node;
153
+ const copy = emptyCopy(c);
154
+ copies.set(source, copy);
155
+ const item = { source, copy, container: c, at, next: undefined };
156
+ if (queue.tail === undefined)
157
+ queue.head = item;
158
+ else
159
+ queue.tail.next = item;
160
+ queue.tail = item;
161
+ return copy;
162
+ };
163
+ const root = copyOf(value, ROOT);
164
+ for (let w = queue.head; w !== undefined; w = w.next)
165
+ fill(w, copyOf);
166
+ return root;
167
+ }
168
+ /** 填一只副本:先拷它自有的可枚举串键数据属性(数组即下标),再拷 Map 的条目 / Set 的成员。 */
169
+ function fill(w, copyOf) {
170
+ const isArray = w.container.kind === "array";
171
+ const read = inspect(() => containerView(w.source, isArray, "wide"));
172
+ if (!read.ok)
173
+ throw refusal(w.at, `is ${read.sentence}`);
174
+ const view = read.value;
175
+ if (view.foreign)
176
+ throw refusal(w.at, isArray ? "has an own property that is not an array element (a named or symbol-keyed property)" : "has a symbol-keyed own property");
177
+ if (isArray) {
178
+ const length = view.length;
179
+ if (typeof length !== "number" || !Number.isSafeInteger(length) || length < 0 || length > 2 ** 32 - 1)
180
+ throw refusal(w.at, `is ${UNINSPECTABLE}`);
181
+ w.copy.length = length;
182
+ }
183
+ for (const [key, d] of view.members) {
184
+ const at = step(w.at, isArray ? `[${key}]` : keySegment(key));
185
+ if (isAccessorDescriptor(d))
186
+ throw refusal(at, "is an accessor property (getter / setter — it is never called)");
187
+ Object.defineProperty(w.copy, key, dataDescriptor(copyOf(d.value, at)));
188
+ }
189
+ const c = w.container;
190
+ let i = 0;
191
+ switch (c.kind) {
192
+ case "map": {
193
+ // 先拍快照:内建 `forEach` 直接读源 Map 的内部槽(不走源对象自己的 `Symbol.iterator` / 方法),回调只往私有的快照里放、不检视任何成员;
194
+ // 之后逐条检视时跑到的 Proxy 陷阱即使改了源 Map,也改不到快照 —— 遍历有终点,副本只含快照里的条目(上面拷自有属性时跑到的陷阱在快照之前,它们的修改会进快照)
195
+ const snapshot = new MAP();
196
+ Reflect.apply(MAP_FOR_EACH, w.source, [(value, key) => Reflect.apply(MAP_SET, snapshot, [key, value])]);
197
+ Reflect.apply(MAP_FOR_EACH, snapshot, [
198
+ (value, key) => {
199
+ const keyText = mapKeyText(key);
200
+ const keyCopy = copyOf(key, step(w.at, `.keys()[${i}]`));
201
+ const valueCopy = copyOf(value, step(w.at, keyText === undefined ? `.values()[${i}]` : `.get(${keyText})`));
202
+ Reflect.apply(MAP_SET, w.copy, [keyCopy, valueCopy]);
203
+ i += 1;
204
+ },
205
+ ]);
206
+ return;
207
+ }
208
+ case "set": {
209
+ const snapshot = new SET(); // 同 Map:先拍快照,再逐个检视
210
+ Reflect.apply(SET_FOR_EACH, w.source, [(member) => Reflect.apply(SET_ADD, snapshot, [member])]);
211
+ Reflect.apply(SET_FOR_EACH, snapshot, [
212
+ (member) => {
213
+ Reflect.apply(SET_ADD, w.copy, [copyOf(member, step(w.at, `.values()[${i}]`))]);
214
+ i += 1;
215
+ },
216
+ ]);
217
+ return;
218
+ }
219
+ case "array":
220
+ case "object":
221
+ case "date":
222
+ case "regexp":
223
+ return;
224
+ default: {
225
+ const unhandled = c;
226
+ throw new Error(`mutableCopyOf: unhandled container ${String(unhandled.kind)}`);
227
+ }
228
+ }
229
+ }
@@ -101,6 +101,14 @@ export declare const SETTINGS_UNITS: {
101
101
  readonly reader: "engine";
102
102
  readonly sources: readonly ["userSettings", "projectSettings", "localSettings", "flagSettings", "policySettings", "foreignProjectSettings"];
103
103
  };
104
+ readonly autoCompactEnabled: {
105
+ readonly path: readonly ["autoCompactEnabled"];
106
+ readonly category: "autoCompaction";
107
+ readonly reads: "whole";
108
+ readonly reading: "boolean";
109
+ readonly reader: "engine";
110
+ readonly sources: readonly ["userSettings", "projectSettings", "localSettings", "flagSettings", "policySettings", "foreignProjectSettings"];
111
+ };
104
112
  };
105
113
  export type SettingsUnitName = keyof typeof SETTINGS_UNITS;
106
114
  /** The comparator of one unit — or, for a `members` unit, of one DECLARED member of it: `whole` ⇒ the category's `tighten`;
@@ -5,9 +5,10 @@
5
5
  * Every resolver of a settings file (the shell reads it for each of its sources; a profile loader is a second projection) and every
6
6
  * writer of one reads THIS table instead of keeping a key→category map, a value judge or a reader list of its own for these units.
7
7
  * Unit names: the shell's established ten, then `semaUiLanguage` — the UI-language key, named by its key and placed by its declaration
8
- * (`UI_LANGUAGE_SETTING` in `./ui-language`: the row's `path`, `category` and `sources` are read from there, not written twice) — and
9
- * `autoMemoryEnabled`, the auto-memory switch, mapped to its `autoMemory` member row. The two permission-mode kill-switches map to
10
- * their own `killSwitches` member rows (the table has no managed-only floor for them).
8
+ * (`UI_LANGUAGE_SETTING` in `./ui-language`: the row's `path`, `category` and `sources` are read from there, not written twice) —
9
+ * `autoMemoryEnabled`, the auto-memory switch, mapped to its `autoMemory` member row, and `autoCompactEnabled`, the auto-compaction
10
+ * switch, mapped whole to `autoCompaction`. The two permission-mode kill-switches map to their own `killSwitches` member rows (the
11
+ * table has no managed-only floor for them).
11
12
  *
12
13
  * Who reads a unit (`reader`, on every row; the closed set {@link SETTINGS_UNIT_READERS}):
13
14
  * · `shell` — the value changes only the host's own interface and never reaches the engine, wherever the engine runs — so a writer
@@ -78,7 +79,7 @@
78
79
  * the contract cannot tell what it was meant to forbid, and the strictest answer is the only one that cannot be looser than what the author meant.
79
80
  * The package enforces nothing here (the surfaces are the consumers'); what it pins is that both inputs exist for every such member and that every
80
81
  * out-of-domain value reads `unreadable` without throwing. Not covered, and not settled here: the `whole` units (`permissionMode`, `additionalDirectories`,
81
- * `hooks`, `env`, `model`, `outputStyle`, `semaUiLanguage`) have no direction column; whether "unreadable = absent" closes for them depends on the order of the
82
+ * `hooks`, `env`, `model`, `outputStyle`, `semaUiLanguage`, `autoCompactEnabled`) have no direction column; whether "unreadable = absent" closes for them depends on the order of the
82
83
  * unit's own value domain, which is a design question of its own.
83
84
  * The env DOCUMENT's literal grammar (boolean words, csv + empty-set sentinel, a "≤ 0 means off" cap) is not here: it belongs to
84
85
  * the engine's env catalog, whose one implementation is the server's.
@@ -107,6 +108,7 @@ export const SETTINGS_UNITS = deepFreeze({
107
108
  // the key, its category and the one source that carries it are the declaration's (`UI_LANGUAGE_SETTING`); the computed key keeps the literal type
108
109
  [UI_LANGUAGE_SETTING.key]: { path: [UI_LANGUAGE_SETTING.key], category: UI_LANGUAGE_SETTING.category, reads: "whole", reading: "uiLanguage", reader: "shell", sources: [UI_LANGUAGE_SETTING.source] },
109
110
  autoMemoryEnabled: { path: ["autoMemoryEnabled"], category: "autoMemory", reads: "member", member: "autoMemoryEnabled", reading: "boolean", reader: "engine", sources: SETTINGS_SOURCES },
111
+ autoCompactEnabled: { path: ["autoCompactEnabled"], category: "autoCompaction", reads: "whole", reading: "boolean", reader: "engine", sources: SETTINGS_SOURCES },
110
112
  });
111
113
  /** The one place a unit + optional member resolves to what is being asked about — the row and its comparator. Fail-closed
112
114
  * and loud on every misaddressing: an unknown unit (own-property lookup — `"__proto__"` is unknown, not Object.prototype),
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Acceptance bounds the server applies to the request-face tighten-only seats: read-deny patterns
3
+ * (stars per path segment, stars across the whole list, and entries in the whole list) and entries
4
+ * per seat for the other tighten-only seats.
5
+ *
6
+ * These bounds are an acceptance policy for an untrusted writer; they do not correspond to an
7
+ * engine cost. Pure data, zero imports, browser-safe.
8
+ */
9
+ /** Maximum number of `*` wildcards accepted within a single path segment of a read-deny pattern. */
10
+ export declare const MAX_READ_DENY_STARS_PER_SEGMENT = 2;
11
+ /** Maximum total number of `*` wildcards accepted across all read-deny patterns in the list. */
12
+ export declare const MAX_READ_DENY_STARS_TOTAL = 16;
13
+ /** Maximum number of entries accepted per request-face tighten-only seat other than the read-deny list. */
14
+ export declare const MAX_TIGHTEN_ONLY_SEAT_ENTRIES = 1000;
15
+ /** Maximum number of entries accepted in the request-face read-deny pattern list. */
16
+ export declare const MAX_READ_DENY_ENTRIES = 32;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Acceptance bounds the server applies to the request-face tighten-only seats: read-deny patterns
3
+ * (stars per path segment, stars across the whole list, and entries in the whole list) and entries
4
+ * per seat for the other tighten-only seats.
5
+ *
6
+ * These bounds are an acceptance policy for an untrusted writer; they do not correspond to an
7
+ * engine cost. Pure data, zero imports, browser-safe.
8
+ */
9
+ /** Maximum number of `*` wildcards accepted within a single path segment of a read-deny pattern. */
10
+ export const MAX_READ_DENY_STARS_PER_SEGMENT = 2;
11
+ /** Maximum total number of `*` wildcards accepted across all read-deny patterns in the list. */
12
+ export const MAX_READ_DENY_STARS_TOTAL = 16;
13
+ /** Maximum number of entries accepted per request-face tighten-only seat other than the read-deny list. */
14
+ export const MAX_TIGHTEN_ONLY_SEAT_ENTRIES = 1000;
15
+ /** Maximum number of entries accepted in the request-face read-deny pattern list. */
16
+ export const MAX_READ_DENY_ENTRIES = 32;
@@ -4,9 +4,9 @@
4
4
  > 每次全量重算并逐名比对 —— 加 / 删 / 改形一个导出而不重生成本档 ⇒ 红。导出面的每次变动因此以本档的 diff 出现在评审里。
5
5
  > 形:`value` = 运行期拿得到的值;`type` = 只在类型层;`value+type` = 同名的值与类型(zod schema 与它推出的类型)。
6
6
 
7
- 子路径 25 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1713 个(同名在多条子路径上各计一次)。
7
+ 子路径 25 条(资产出口 `./package.json` / `./fleet-paths.json` 不是模块,不列),导出名合计 1728 个(同名在多条子路径上各计一次)。
8
8
 
9
- ## `.`(912)
9
+ ## `.`(927)
10
10
 
11
11
  - `A2A_PEER_BOUNDARIES` — value
12
12
  - `A2A_PEER_ENTRY_PROBLEMS` — value
@@ -53,6 +53,8 @@
53
53
  - `CONFIG_DOCUMENT_IO_KINDS` — value
54
54
  - `CONFIG_DOCUMENT_REFUSAL_REASONS` — value
55
55
  - `CONFIG_ROOT_DOCUMENTS` — value
56
+ - `CONNECTOR_ASSERTION_REFUSALS` — value
57
+ - `CONNECTOR_ASSERTION_REFUSAL_ERRORS` — value
56
58
  - `CONNECTOR_AUTHORIZE_QUERY` — value
57
59
  - `CONNECTOR_AUTHORIZE_URL_FLAWS` — value
58
60
  - `CONNECTOR_ID_MAX` — value
@@ -91,6 +93,10 @@
91
93
  - `ConfigPath` — type
92
94
  - `ConfigReader` — type
93
95
  - `ConfigRootDocument` — type
96
+ - `ConnectorAssertionAnswer` — value+type
97
+ - `ConnectorAssertionRefusal` — value+type
98
+ - `ConnectorAssertionRefusalError` — type
99
+ - `ConnectorAssertionRequest` — value+type
94
100
  - `ConnectorAuthorizeBinding` — type
95
101
  - `ConnectorAuthorizeQueryName` — type
96
102
  - `ConnectorAuthorizeUrlFlaw` — type
@@ -128,6 +134,7 @@
128
134
  - `DIALOG_EXPIRY_DEFAULT` — value
129
135
  - `DIALOG_EXPIRY_VALUES` — value
130
136
  - `DIAL_ADDRESS_URL_FORBIDDEN_PARTS` — value
137
+ - `DIAL_TARGET_COMPARISONS` — value
131
138
  - `DIRECTORY_ADDED_SOURCES` — value
132
139
  - `DISCLOSABLE_IDENTITY_RE` — value
133
140
  - `DISPATCH_STRATEGIES` — value
@@ -155,6 +162,7 @@
155
162
  - `DeviceMaxPreAuthPerRemoteFlaw` — type
156
163
  - `DeviceMaxPreAuthPerRemoteReading` — type
157
164
  - `DeviceTokenRequest` — value+type
165
+ - `DialTargetComparison` — type
158
166
  - `DialogExpirySetting` — value
159
167
  - `DialogExpirySettingValue` — type
160
168
  - `DialogExpiryValue` — type
@@ -343,6 +351,10 @@
343
351
  - `MAX_EXTRA_BODY_DEPTH` — value
344
352
  - `MAX_HASH_DEPTH` — value
345
353
  - `MAX_HASH_WRAPPER_RESERVE` — value
354
+ - `MAX_READ_DENY_ENTRIES` — value
355
+ - `MAX_READ_DENY_STARS_PER_SEGMENT` — value
356
+ - `MAX_READ_DENY_STARS_TOTAL` — value
357
+ - `MAX_TIGHTEN_ONLY_SEAT_ENTRIES` — value
346
358
  - `MCP_CONTENT_ORIGINS` — value
347
359
  - `MCP_ENTRY_CREDENTIAL_KINDS` — value
348
360
  - `MCP_POLICY_RULES` — value
@@ -391,6 +403,7 @@
391
403
  - `ModelThinkingLevelMap` — value+type
392
404
  - `ModelTier` — value+type
393
405
  - `ModelsConfig` — value+type
406
+ - `MutableCopy` — type
394
407
  - `NON_SECRET_URL` — value
395
408
  - `NOT_ROUTABLE_CODES` — value
396
409
  - `NotRoutableCode` — type
@@ -729,6 +742,7 @@
729
742
  - `classifyHooksConfig` — value
730
743
  - `classifyTimeClaims` — value
731
744
  - `collectEnvRefs` — value
745
+ - `compareDialTargets` — value
732
746
  - `compareGeneration` — value
733
747
  - `connectorAuthorizeUrlFlaws` — value
734
748
  - `connectorAuthorizeUrlOf` — value
@@ -818,6 +832,7 @@
818
832
  - `mintA2aPeerFingerprint` — value
819
833
  - `mintScopedToken` — value
820
834
  - `mintedCheapId` — value
835
+ - `mutableCopyOf` — value
821
836
  - `narrowAtMention` — value
822
837
  - `nextPollInterval` — value
823
838
  - `normalizeContentHash` — value
@@ -37,6 +37,7 @@
37
37
  > **34.1.0**(minor,全部加性;没有 BREAKING)的凭据平面共享拒答表 `CREDENTIAL_PLANE_REFUSALS`(九词)与沙箱 git 拒答表尾插第十一词 `plane_misconfigured`(`SandboxGitRefusalError` 多一员;读方先升、发这个词的一方最后改答)在 §12.5(导出表在 §12.1);请求面凭据值的独立判口 `readRequestMcpCredentials` 在 §56 末尾;插件设置的三只纯读法(`readEnabledPluginsValue` / `readPluginId` / `PLUGIN_MARKETPLACE_SENTINELS`,新子路径 `./plugin-settings`)在 §57;web-admin 凭证文件锁的 `unreadable` 臂多可缺的 `ioKind`(悬空软链答 `unreadable` 是有意维持的行为)的读法在 §8 里 web-admin 凭证文件那一条;项目登记簿的两句文书(`archivedAt` 的归档与删除、条目序是契约事实)是类型旁的注释,见 `CHANGELOG.md` 34.1.0 节末「更正与写明」。
38
38
  > **35.0.0**(major,八处破坏:`a2a` 对端条目 `A2aPeerSpec` 的条目判〔组合方法 `.pick` / `.omit` / `.partial` 运行期抛〕· `a2a` 七只登记键的校验收紧〔坏值 / 不完备的内部条目 / 重复 `id` 文档面整份拒;重复 `id` 视图面整域落缺省〕· MCP 条目 `callerMeta` 坏值整条拒 · 调度店文件读口的结果多必填 `absent`、悬空软链读也抛 · 调度店的记录判官收紧〔声明成员合型、整条是纯 JSON 数据且任何一处的数是有限数〕· 墓碑表加 `SEND_USER_FILE_SANDBOX_PUT_ENDPOINT` · 一次性迁移 SS-M11 窗关删码 · 权益档位 `EntitlementTier.displayName` 坏值整域拒)的 `a2a` 登记键与条目判在 §17 的「登记键与条目判」一条;MCP 条目 `callerMeta` 在 §7 的映射表(`TaskSpec.mcp` 一行)与 `CHANGELOG.md` 35.0.0 节;权益档位可选展示名 `EntitlementTier.displayName` 与上界常量 `ENTITLEMENT_TIER_LIMITS`(包根与 `./types`)在 `CHANGELOG.md` 35.0.0 节;同版加性的自动记忆开关 `autoMemoryEnabled` 在 §58;调度店文件读口的缺席标记 `absent`(`SchedulerStoreFileRead`)、读写同一只符号链接判官、写一次对盘上文件做了什么在 §59;墓碑表加 `SEND_USER_FILE_SANDBOX_PUT_ENDPOINT`(`removed` 族)在 §60;SS-M11 删码在 §61(登记表概览在 §0.4)。
39
39
  > **35.1.0**(minor,全部加性;没有 BREAKING)的 `./conformance` 配置档装载校验向量与只读加载器(`conformance/profile/` 11 份文件;`loadProfileVectors` / `loadBuiltinProfilesAndSchema` 与五只常量)在 §11 末条(详见 `docs/CONFORMANCE.md` §12);同版订正 35.0.0 节六处说漏或写宽的连带变化,§17、§59 – §61 里对应的句子已改准,逐条见 `CHANGELOG.md` 35.1.0「订正 35.0.0 节」。
40
+ > **35.2.0**(minor,全部加性;没有 BREAKING)的连接器断言铸口 wire 型(严格请求 `ConnectorAssertionRequest` · 应答 · 十四词拒答表 `CONNECTOR_ASSERTION_REFUSALS` 与拒体)与发送目标比较 `compareDialTargets` 在 §62(铸口拒答表与沙箱 git 拒答表同一份派生机关;凭据平面 `terminal` 的读法写成一条,对沙箱 git 既有收方多许低频复查,见 §12.5);单元表第十三行自动压缩开关 `autoCompactEnabled`(`SettingsUnitName` 多一词,穷举它的消费方红一次)在 §63;请求面只收紧座位的四只上限常量在 §64;取可改的深副本 `mutableCopyOf` / `MutableCopy<T>` 在 §65;同版订正 33.0.0 节三格判据的读法见 `CHANGELOG.md` 35.2.0「订正 33.0.0 节」。
40
41
 
41
42
  ---
42
43
 
@@ -424,7 +425,7 @@ server 直接拒启,不是静默降级。上一代 `SEMA_REGISTRY_*` 八名(`URL
424
425
 
425
426
  ### 12.5 整次拒答表(`SANDBOX_GIT_REFUSALS`)
426
427
 
427
- 体 = `{ "error", "permanence", "message" }`。`permanence` 两词:`terminal` = 不按定时重试;`transient` = 退避重试。**一个错误词的 permanence 是固定的**,拒体里再带一份只为收方不必查表 —— 两处不一致是畸形应答(`SandboxGitCredentialRefusal` 拒)。
428
+ 体 = `{ "error", "permanence", "message" }`。`permanence` 两词(凭据平面各只口共用这一张):`terminal` = 这一次请求不按退避节奏重试,再问要等一件可能改变答案的事(用户的动作、运维的修复,或收方自己的下一次连接 / 发送;收方可以为这类词设低频复查,那是收方的处置表);`transient` = 退避重试。**一个错误词的 permanence 是固定的**,拒体里再带一份只为收方不必查表 —— 两处不一致是畸形应答(`SandboxGitCredentialRefusal` 拒)。
428
429
 
429
430
  | `error` | HTTP | `permanence` | 说明 |
430
431
  |---|---|---|---|
@@ -438,11 +439,13 @@ server 直接拒启,不是静默降级。上一代 `SEMA_REGISTRY_*` 八名(`URL
438
439
  | `vault_frozen` | 503 | terminal | 凭据库冻结 |
439
440
  | `handle_invalid` | 401 | transient | 句柄验不过 / 已用 / 已过期 |
440
441
  | `vault_unavailable` | 503 | transient | 凭据库暂不可用 |
441
- | `plane_misconfigured` | 503 | terminal | 凭据平面在答方配置错(运维改配置之前,定时重试不会成功) |
442
+ | `plane_misconfigured` | 503 | terminal | 凭据平面在答方配置错(运维改配置之前,再问也不会成功) |
442
443
 
443
444
  收方怎么处置某个词(例如哪些 terminal 可由用户动作恢复、哪些不可恢复)是收方的状态机,不在本包里。**错误词不在闭集 ⇒ 畸形应答,不是「当 transient 重试」。**
444
445
 
445
- 这张表的九个词来自凭据平面共享表 `CREDENTIAL_PLANE_REFUSALS`(同一平面的各只口都从它派生,每个词的状态集与 `permanence` 只写一次);本口自有 `scope_mismatch` 与 `handle_invalid` 两词。次序是公开事实:上一版的十个词原序不动,新词只加在尾部。对没升级的收方:按本包规则读的收方当畸形应答;按 HTTP 5xx 兜底的收方当暂不可用、退避重试;两种都不取值。升级后才读得到 `terminal`、停止定时重试。
446
+ 这张表的九个词来自凭据平面共享表 `CREDENTIAL_PLANE_REFUSALS`(同一平面的各只口都从它派生,每个词的状态集与 `permanence` 只写一次);本口自有 `scope_mismatch` 与 `handle_invalid` 两词。次序是公开事实:上一版的十个词原序不动,新词只加在尾部。对没升级的收方:按本包规则读的收方当畸形应答;按 HTTP 5xx 兜底的收方当暂不可用、退避重试;两种都不取值。升级后才读得到 `terminal`:不再按退避节奏重试,再问等一件可能改变答案的事(读法同本节开头那一句)。
447
+
448
+ 同一张共享表也派生连接器断言铸口的拒答表 `CONNECTOR_ASSERTION_REFUSALS`(共享九词 + 铸口自有五词,两张表的派生机关是同一份),见 §62。
446
449
 
447
450
  ### 12.6 `VerifiedIdentity.principalInc` 与令牌声明 `sub_inc`
448
451
 
@@ -1677,3 +1680,166 @@ switch (v.kind) {
1677
1680
  | cli(终端)· web-admin | 写模型池前读决定(`readEnvModelsDecisionSync`)与计划助手;持久文件登记取 `CONFIG_ROOT_DOCUMENTS`(推断:没重读) | 持久文件登记随名单少一项;读写决定的代码零改动 |
1678
1681
  | sdk | 契约套件 | 无 |
1679
1682
  | test | 判据 | 见 `CHANGELOG.md` 35.0.0 节 SS-M11 删码小节(K66 – K67) |
1683
+
1684
+ ## 62. 连接器断言铸口的 wire 型与发送目标比较 `compareDialTargets`(加性;包根)—— web-admin、服务端、终端、客户端核心、sdk、test 各自的读法
1685
+
1686
+ **这是哪只口**:`POST /api/v1/connectors/assertions` —— 管理台铸,本服务的对端座问;一步答出断言,没有句柄、没有第二步。本包发形、词表与一只比较函数(都只在主桶,不开子路径;模块纯、浏览器安全);调用方鉴权(`wat_`)、委托、活表复核、登记册查条目、判定序、断言的签发与缓存都是各方自己的事。
1687
+
1688
+ **请求 `ConnectorAssertionRequest`**(严格对象,恰四键,全必填):
1689
+
1690
+ | 键 | 形 | 说明 |
1691
+ |---|---|---|
1692
+ | `server` | `McpServerSpec.shape.name` 那一只判官(同一对象) | MCP 服务器名,与引擎座问题里的同名成员同义;答方按原串逐字节查条目,不折大小写(判官的 `/i` 只管哪些字符能出现;同一份 mcp 域里 `Gitea` 与 `gitea` 是两只条目) |
1693
+ | `url` | `NON_SECRET_URL`(同一对象) | 引擎实际要发往的地址 —— 就是 MCP 条目 `url` 的原串 |
1694
+ | `principal` | 包内那一只主体名叶子 `PrincipalString`(与 `SandboxGitCredentialRequest.shape.principal` 是同一只 schema 对象;本节不另写长度规则) | 替谁铸;与凭据取值口的请求同一只形 |
1695
+ | `principalInc` | `PrincipalIncarnation` | 化身号;与 `SandboxGitCredentialRequest.principalInc` 同义同形 |
1696
+
1697
+ **多一个键 ⇒ 不是这一形 ⇒ 答方回 `request_invalid`**(不剥):凭据铸口上调用方多给的键看起来像约束(作用域、连接器 id、有效期上限一类),剥掉 = 调用方以为表达了的约束被静默丢掉、断言照铸。代价:请求的键集首发即定,以后要加一个成员 = 本包主版本 + 两侧同窗提货,不能由一侧先发(旧管理台会把带新成员的请求整次拒)。作用域与 worker 不在请求里(由 `wat_` 定,不信请求体);连接器 id 不在请求里(管理台按 `server` 查条目的受众)。这与凭据取值口的请求(默认剥)是两只口各自的选择,不是包的通律。
1698
+
1699
+ **应答 `ConnectorAssertionAnswer`** = `{ assertion, expiresAt }`:`assertion` 非空串,应答里唯一的秘密位;`expiresAt` epoch 毫秒(非负安全整数),中心的钟 —— 收方拿自己的钟比时自担钟差。多一键剥掉(管理台以后多带一个键,旧的收方照读)。
1700
+
1701
+ **拒体 `ConnectorAssertionRefusal`** = `{ error, permanence, message }`,按 `error` 分臂;只有 `authorization_required` 一臂可带 `authorizeUrl`(非空串:用户去哪里授权;能不能交给用户由收方问 `connectorAuthorizeUrlFlaws`,§33「授权地址」一段),别的臂收到即剥;多一键剥。`permanence` 必须等于下表里这一词的,两处不一致即畸形应答(拒);`message` 是答方的诊断句,收方不据它判,可为空串;体里不带状态码。
1702
+
1703
+ **十四词**(`CONNECTOR_ASSERTION_REFUSALS` / `CONNECTOR_ASSERTION_REFUSAL_ERRORS` / `ConnectorAssertionRefusalError`;次序即表序,一发出就是契约):
1704
+
1705
+ | 来源 · 序 | `error` | HTTP | `permanence` | 管理台何时答(管理台的判定逻辑,不进运行期表;以管理台的文档为准) |
1706
+ |---|---|---|---|---|
1707
+ | 共享 · 第 1 词 | `caller_not_admitted` | 401 / 403 | terminal | 判定序第 1 步:调用方不是被承认的舰队 worker 令牌 |
1708
+ | 共享 · 第 2 词 | `incarnation_mismatch` | 403 | terminal | 请求的化身号不等于该主体当前的化身号 |
1709
+ | 共享 · 第 3 词 | `request_invalid` | 400 | terminal | 第 2 步:`ConnectorAssertionRequest.safeParse` 不过(含多一键) |
1710
+ | 共享 · 第 4 词 | `principal_not_live` | 403 | terminal | 第 3 步:主体活表复核不过 |
1711
+ | 共享 · 第 5 词 | `delegation_required` | 403 | terminal | 第 4 步:没有活的委托 |
1712
+ | 共享 · 第 6 词 | `vault_disabled` | 503 | terminal | 凭据库关着 |
1713
+ | 共享 · 第 7 词 | `vault_frozen` | 503 | terminal | 凭据库冻结 |
1714
+ | 共享 · 第 8 词 | `vault_unavailable` | 503 | transient | 第 0 步登记册读失败;或审计行写不进(先审计后交付) |
1715
+ | 共享 · 第 9 词 | `plane_misconfigured` | 503 | terminal | 第 0 步:凭据平面在答方配置错 |
1716
+ | 铸口 · 第 10 词 | `runner_credential_unavailable` | 403 | terminal | 第 1 步的 403 一支 |
1717
+ | 铸口 · 第 11 词 | `connector_not_entitled` | 403 | terminal | 第 5 步:`server` 不在该 worker 有效配置与该主体权益的交集里 |
1718
+ | 铸口 · 第 12 词 | `connector_not_registered` | 403 | terminal | 第 6 步:条目不是带断言引用的 http 条目,或它的受众不在部署登记册里 |
1719
+ | 铸口 · 第 13 词 | `connector_target_mismatch` | 403 | terminal | 第 7 步:`compareDialTargets(请求 url, 登记册那一行的端点)` 答 `different`(答 `unreadable` 不是这一词:那只可能是登记册那一边读不出,按管理台自己的「登记册读不出」处置,见下面比较函数的「用途」) |
1720
+ | 铸口 · 第 14 词 | `authorization_required` | 403 | terminal | 第 8 步:要第三方凭据的连接器,该主体还没有可用的连接 |
1721
+
1722
+ 前九词就是凭据平面共享表 `CREDENTIAL_PLANE_REFUSALS` 的九词,原样原序,行是同一只对象(§12.5);后五词只在铸口上有意义,不进共享表。词与状态码对不对得上是收方的事。
1723
+
1724
+ **`terminal` 在铸口上怎么重问**(读法与 §12.5 同一条:这一次请求不按退避节奏重试,再问要等一件可能改变答案的事;表值不动):
1725
+
1726
+ | 情形 | 铸口上怎么重问 |
1727
+ |---|---|
1728
+ | 首次连接(引擎座问题的 `cause` 是连接) | terminal ⇒ 这次座拒、不退避重铸;transient(只有 `vault_unavailable`)⇒ 可在座的等待窗内退避重铸 |
1729
+ | 后续发送(`cause` 是请求) | 每次发送是一次新的问,不算定时重试;收方可以记住上一次的 terminal 词,免得每次发送都打中心 |
1730
+ | 用户动作之后(重新登录续上委托、去 `authorizeUrl` 授权) | 立刻重问一次;首拨已失败的,随显式重拨或下一条腿 |
1731
+ | 运维修复之后(`plane_misconfigured`、`vault_disabled` / `vault_frozen`、`connector_not_registered`、`connector_target_mismatch`:改条目或登记册并重启本服务) | 重启后的首拨自然是新的一问;收方也可以为这些词设一个低频复查 |
1732
+
1733
+ 哪只词归哪一行、复查多久,是收方座的处置表;本包只写读法。
1734
+
1735
+ **发送目标比较 `compareDialTargets(a, b)`**(`DIAL_TARGET_COMPARISONS` = `same` / `different` / `unreadable`;总、不抛):两个地址算同一个发送目标,当且仅当两边都过 `NON_SECRET_URL`,且各自按 WHATWG URL 解析后的序列化串(`href`)逐字节相等;任一边读不出 ⇒ `unreadable`,永不 `same`。先各自判、最后才比:没有「两边字节相同 / 同一只对象」的快径;输入不是原始字符串(含 `new String(...)`)⇒ 读不出。三态不能并成一个布尔。
1736
+ - **用途只有一个**:判定序第 7 步。`same` 才铸;`different` ⇒ `connector_target_mismatch`;`unreadable` 只可能来自登记册一边(请求那一边第 2 步已判过)⇒ 按「登记册读不出」处置。这个方向上多答 `different` 是多拒,失败关闭。
1737
+ - **不是登记册端点去重的判官**:去重方向上安全反过来 —— `https://c.example/%7Emcp` 与 `https://c.example/~mcp` 答 `different`,拿它去重就放过了可能指向同一处理器的别名。登记册「同一端点不许登在两个 id 下」要哪种等价(更粗的键)是另一件设计,不用这只函数。单只地址的规范串不导出。
1738
+ - 与包根的 `DIAL_ADDRESS_URL_FORBIDDEN_PARTS`(「逐字发给拨号方的地址」那一座位禁哪些部件,定义在 `src/url-shape.ts`)名近义远:那只是一个座位的部件表,这只是两个地址的比较。
1739
+
1740
+ 判别向量(每一格两向同答;S12 – S15 是下面「不给的保证」③ 的已知边):
1741
+
1742
+ | # | a | b | 答 |
1743
+ |---|---|---|---|
1744
+ | S1 | `https://c.example/mcp` | `https://c.example/mcp` | same |
1745
+ | S2 | `HTTPS://Conn.Example.COM/mcp` | `https://conn.example.com/mcp` | same |
1746
+ | S3 | `https://c.example:443/mcp` | `https://c.example/mcp` | same |
1747
+ | S4 | `http://c.example:80/x` | `http://c.example/x` | same |
1748
+ | S5 | `https://c.example/a/../mcp` | `https://c.example/mcp` | same |
1749
+ | S6 | `https://c.example/a/%2e%2e/mcp` | `https://c.example/mcp` | same |
1750
+ | S7 | `https://c.example` | `https://c.example/` | same |
1751
+ | S8 | `https://bücher.example/mcp` | `https://xn--bcher-kva.example/mcp` | same |
1752
+ | S9 | `https://[2001:0db8:0:0:0:0:0:1]/mcp` | `https://[2001:db8::1]/mcp` | same |
1753
+ | S10 | `http://127.1/mcp` | `http://127.0.0.1/mcp` | same |
1754
+ | S11 | `https://c.example/ü` | `https://c.example/%C3%BC` | same |
1755
+ | S12 | 首尾带空格的 `https://c.example/mcp` | `https://c.example/mcp` | same |
1756
+ | S13 | 路径里嵌一个制表符的 `https://c.example/m<TAB>cp` | `https://c.example/mcp` | same |
1757
+ | S14 | `https:c.example/mcp` | `https://c.example/mcp` | same |
1758
+ | S15 | `https://@c.example/mcp` | `https://c.example/mcp` | same |
1759
+ | D1 | `https://c.example/mcp` | `https://c.example/mcp/` | different |
1760
+ | D2 | `https://c.example/MCP` | `https://c.example/mcp` | different |
1761
+ | D3 | `http://c.example/mcp` | `https://c.example/mcp` | different |
1762
+ | D4 | `https://c.example:8443/mcp` | `https://c.example/mcp` | different |
1763
+ | D5 | `https://c.example/mcp?a=1` | `https://c.example/mcp` | different |
1764
+ | D6 | `https://c.example/mcp?a=1&b=2` | `https://c.example/mcp?b=2&a=1` | different |
1765
+ | D7 | `https://c.example/%7Emcp` | `https://c.example/~mcp` | different |
1766
+ | D8 | `https://c.example/%7emcp` | `https://c.example/%7Emcp` | different |
1767
+ | D9 | `https://c.example/mcp?` | `https://c.example/mcp` | different |
1768
+ | D10 | `https://c.example./mcp` | `https://c.example/mcp` | different |
1769
+ | D11 | `https://a.c.example/mcp` | `https://c.example/mcp` | different |
1770
+ | U1 | `""` | `""` | unreadable |
1771
+ | U2 | `undefined` | `https://c.example/mcp` | unreadable |
1772
+ | U3 | `null` | `https://c.example/mcp` | unreadable |
1773
+ | U4 | `7` | `https://c.example/mcp` | unreadable |
1774
+ | U5 | `new String("https://c.example/mcp")` | `https://c.example/mcp` | unreadable |
1775
+ | U6 | 同一只 `new String(...)` 对象 | 同一只对象 | unreadable |
1776
+ | U7 | `c.example/mcp` | 同 | unreadable |
1777
+ | U8 | `ftp://c.example/mcp` | 同 | unreadable |
1778
+ | U9 | `https://u:p@c.example/mcp` | 同 | unreadable |
1779
+ | U10 | `https://u@c.example/mcp` | 同 | unreadable |
1780
+ | U11 | `https://c.example/mcp#x` | `https://c.example/mcp` | unreadable |
1781
+ | U12 | `https://c.example/mcp#` | 同 | unreadable |
1782
+ | U13 | `https://` | 同 | unreadable |
1783
+ | U14 | `mailto:a@c.example` | 同 | unreadable |
1784
+ | U15 | 查询里带秘密形值的 `https://c.example/?x=sk-live-…` | 同 | unreadable |
1785
+ | U16 | `https://c.example/mcp` | `ftp://c.example/mcp` | unreadable |
1786
+
1787
+ WHATWG 解析会做的改写:scheme 与主机名转小写;去默认端口;国际化域名转 punycode;IPv4 别写形规整、IPv6 压缩;解析 `.` / `..` 段(含百分号写的 `%2e`);空路径补 `/`;路径里的非 ASCII 字符按 UTF-8 百分号编码;去首尾 C0 控制符与空格、去内嵌的制表与换行;空 userinfo 的 `@` 消失;特殊 scheme 缺 `//` 的写法补成层级式。不做:不去路径尾斜杠(空路径补 `/` 除外)、不折路径大小写、不解码已有的百分号三元组(也不改它的十六进制大小写)、不排查询参数、不去空查询的 `?`、不去主机名末尾的点。
1788
+
1789
+ **不给的保证**:① 同一序列化串 ≠ 同一实际对端(各自网络命名空间里的同一本机地址、分区 DNS、域名改指;登记信任与部署网络的残余风险;引擎发送链上自己的检查不由本函数代替)。② 跨运行时的 URL / 国际化域名归一差异没有证明只会偏向 `different`(比较跑在管理台的运行时,拨号跑在引擎的运行时)。③ 判官按解析结果认,不按原串字面认(空 userinfo 的 `@`、`https:host`、首尾空白、内嵌制表 / 换行都能过 `NON_SECRET_URL` 并与规范写法比成 `same`);本包不为此收紧 `NON_SECRET_URL` —— 多座位共用、收紧是主版本,而请求的 `url` 就是条目的 `url`,另立更严的判法 = 同一串两答。④ 挡不住会说谎的服务层,也看不到断言缓存命中的发送。⑤ 只说「是不是同一个拨号目标」,不说「这个目标许不许拨」(https 律、本机 http 例外是登记册一方的规则)。⑥ 不是去重判官。
1790
+
1791
+ | 消费方 | 读点 | 动作 |
1792
+ |---|---|---|
1793
+ | web-admin | 铸口路由(本版之前不落) | 请求 `ConnectorAssertionRequest.safeParse` 不过(含多一键)⇒ `request_invalid`;每一拒按 `CONNECTOR_ASSERTION_REFUSALS[词]` 取状态与 permanence;成功体按 `ConnectorAssertionAnswer` 出;判定第 7 步调 `compareDialTargets`。登记册「同一端点不许两个 id」**不用**这只函数,那半句改读 |
1794
+ | server | 对端座的断言行与座对拒词的处置表(各自另排) | 单提货本版零读点;接铸口时请求按 `ConnectorAssertionRequest` 发、应答与拒体按本包两只形读,`terminal` 按上表四种情形处置 |
1795
+ | cli(终端)· client-core | 不铸也不比(推断:没重读) | 无 |
1796
+ | sdk | 契约套件 | 零代码改动 |
1797
+ | test | 判据 | 见 `CHANGELOG.md` 本版节铸口小节(K73 – K79) |
1798
+
1799
+ ## 63. 自动压缩开关 `autoCompactEnabled`:`SETTINGS_UNITS.autoCompactEnabled`(加性)—— 共用库、终端、服务端、web-admin、sdk、test 各自的读法
1800
+
1801
+ **这一行**:单元表尾插在 `autoMemoryEnabled` 之后 = `{ path: ["autoCompactEnabled"], category: "autoCompaction", reads: "whole", reading: "boolean", reader: "engine", sources: SETTINGS_SOURCES }`。层准入表 `SAFETY_MERGE_SPEC.autoCompaction` 早已在表里(`replace` / 地板 `session` / 比较器 none),本版一字不动。
1802
+
1803
+ **怎么问**:
1804
+ - 原值读法:`readSettingsUnit("autoCompactEnabled", raw)` —— 纯布尔读法,只认严格布尔 `true` / `false`;字符串(含 `"true"`)、数、`null` / `undefined`、对象一律 `{ ok: false, reason: "unreadable" }`。
1805
+ - 比较器:`unitTighten("autoCompactEnabled")` = `{ rule: "none" }`(同值 `equal`,两值互比 `unordered`:这只开关没有「更严」的一侧)。
1806
+ - 层准入:`layerAdmission(source, reading, "autoCompaction")` —— 已受信的项目层与本地层 `admitted`,未受信的 `trust_withheld`,他工具的项目层 `tighten_only`(两版同答)。
1807
+
1808
+ | 消费方 | 读点 | 动作 |
1809
+ |---|---|---|
1810
+ | client-core | 单元表的生成副本、设置写面 | 提货后重出副本;写前用 `readSettingsUnit("autoCompactEnabled", 值)` 判,拒因就是读数的 `reason` |
1811
+ | cli(终端) | 运行期遍历 `SETTINGS_UNITS` 的设置目录导出与键契约派生;一只「`autoCompactEnabled` 不是 /config 设置」的钉(推断:没重读) | 提货后遍历自动带入新单元;那只钉成不成立由终端自己答 |
1812
+ | server | 读的是任务请求键,不读设置单元(推断:没重读) | 无 |
1813
+ | web-admin | 单元表零读点(推断:没重读) | 无;钉表尾次序 / 单元数的测试提货即红 = 通知 |
1814
+ | sdk | 契约套件 | 零代码改动 |
1815
+ | test | 判据 | 见 `CHANGELOG.md` 本版节自动压缩小节(K80 – K82) |
1816
+
1817
+ ## 64. 请求面只收紧座位的四只上限常量(加性;包根)—— 共用库、终端、服务端、web-admin、sdk、test 各自的读法
1818
+
1819
+ `MAX_READ_DENY_STARS_PER_SEGMENT` = 2 · `MAX_READ_DENY_STARS_TOTAL` = 16 · `MAX_TIGHTEN_ONLY_SEAT_ENTRIES` = 1000 · `MAX_READ_DENY_ENTRIES` = 32 —— 四个裸常量,型是各自的数字字面量。它们是**本服务请求面对不受信写者的受理口径**(读拒模式的 `*` 数一段 / 全表、读拒表条数、别的只收紧座位条数),不对应引擎的成本;本包只发数,判的仍是本服务的请求面。
1820
+
1821
+ | 消费方 | 读点 | 动作 |
1822
+ |---|---|---|
1823
+ | client-core | 只收紧座位的本机预判与手抄的四个数(推断:没重读) | 改从包根导入,删抄本 |
1824
+ | cli(终端) | 同上(若有本机预判) | 同上 |
1825
+ | server | 请求面只收紧座位的受理判(本服务自己定义同值的常量) | 由本服务的提货车改读本包;1 000 在本服务另有一个名字,谁读谁由本服务定 |
1826
+ | web-admin · sdk | 无读点(推断:没重读) | 无 |
1827
+ | test | 判据 | 见 `CHANGELOG.md` 本版节上限常量小节(K83) |
1828
+
1829
+ ## 65. 取可改的深副本 `mutableCopyOf` 与型 `MutableCopy<T>`(加性;包根)—— 服务端、终端、客户端核心、web-admin、sdk、test 各自的读法
1830
+
1831
+ **读法**:`import { mutableCopyOf, type MutableCopy } from "@sema-agent/settings-schema"`(只在包根)。`mutableCopyOf(X)` 的型是 `MutableCopy<typeof X>`(每一层去掉 `readonly`,可选性保留;`ReadonlyMap` / `ReadonlySet` ⇒ `Map` / `Set`;函数 / zod schema / `RegExp` / `Date` 位原样)。
1832
+
1833
+ **拷什么**:数组(各下标都拷,可枚举与否;洞仍是洞)· 朴素对象(按包里的形状座位认;副本是寻常对象)· `Map` · `Set` · `Date` · `RegExp`(`lastIndex` 归零)· 原始值(原样)。数组之外的容器拷自有的可枚举串键,照原序;不可枚举的不拷(同展开 / `structuredClone`)。别名与环照原样。原值一个字节不动,任何一层都不冻。
1834
+
1835
+ **拒什么**(`TypeError`,句子点出从 `value` 起的路径):函数、zod schema、类实例与其余对象(继承 `Map` / `Set` / `Date` / `RegExp` / `Array` 的类的实例除外,见下面 ① ④)、可枚举的访问器属性(从不调 getter;数组的下标是访问器的,可枚举与否都拒)、自有 symbol 键、数组上挂的非下标键、检视就抛的值(如已撤销的 Proxy)。带 schema / 函数的导出(`DOMAIN_SCHEMAS`、`nodeConfigDirectoryIo`、`nodeConfigRootIo` 等)整只拒,不交回半份。
1836
+
1837
+ **不报错、照做的四件**:① 继承 `Map` / `Set` / `Date` / `RegExp` 的类的实例按基类拷(子类方法与身份不进副本);② 零原型的源拷成寻常对象;③ 数组之外的容器,不可枚举的自有属性(数据或访问器)不进副本、访问器不被调;数组例外 —— 不可枚举的**数据**下标照样进副本(访问器下标拒,见上);④ `Array.isArray` 答真的值 —— 继承 `Array` 的类的实例、包着数组的 Proxy —— 按数组读、拷成普通数组、不拒(子类方法与身份不进副本;Proxy 的陷阱照样被调)。
1838
+
1839
+ **信任边界**:四种内建按内部槽认(加载时取下的内建,跨 realm 认得出);模块加载之后被替换的本 realm 内建(如 `RegExp.prototype` 上的读取器)照着走;Proxy 的陷阱在检视时照样被调。
1840
+
1841
+ | 消费方 | 读点 | 动作 |
1842
+ |---|---|---|
1843
+ | server · cli(终端)· client-core · web-admin | 零读点(推断:没重读) | 不用就零动作;要在闭集上改出自己一份的地方,用它代替手写的深拷贝 |
1844
+ | sdk | 契约套件 | 零代码改动 |
1845
+ | test | 判据 | 见 `CHANGELOG.md` 本版节深副本小节(K84 – K90) |