@sema-agent/settings-schema 34.1.0 → 35.1.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 (77) hide show
  1. package/CHANGELOG.md +482 -0
  2. package/README.md +73 -32
  3. package/conformance/VERSION +1 -1
  4. package/conformance/cases/c100-a2a-inside-stale-fingerprint-dropped/expected.json +101 -0
  5. package/conformance/cases/c100-a2a-inside-stale-fingerprint-dropped/input.json +28 -0
  6. package/conformance/cases/c100-a2a-inside-stale-fingerprint-dropped/meta.json +6 -0
  7. package/conformance/cases/c101-a2a-inside-incomplete-dropped/expected.json +113 -0
  8. package/conformance/cases/c101-a2a-inside-incomplete-dropped/input.json +38 -0
  9. package/conformance/cases/c101-a2a-inside-incomplete-dropped/meta.json +6 -0
  10. package/conformance/cases/c102-a2a-inside-incomplete-zero-survivors/expected.json +85 -0
  11. package/conformance/cases/c102-a2a-inside-incomplete-zero-survivors/input.json +34 -0
  12. package/conformance/cases/c102-a2a-inside-incomplete-zero-survivors/meta.json +6 -0
  13. package/conformance/cases/c103-mcp-caller-meta-declared/expected.json +106 -0
  14. package/conformance/cases/c103-mcp-caller-meta-declared/input.json +28 -0
  15. package/conformance/cases/c103-mcp-caller-meta-declared/meta.json +6 -0
  16. package/conformance/cases/c98-a2a-registration-keys-carried/expected.json +163 -0
  17. package/conformance/cases/c98-a2a-registration-keys-carried/input.json +42 -0
  18. package/conformance/cases/c98-a2a-registration-keys-carried/meta.json +6 -0
  19. package/conformance/cases/c99-a2a-preapproval-on-outside-peer-dropped/expected.json +100 -0
  20. package/conformance/cases/c99-a2a-preapproval-on-outside-peer-dropped/input.json +23 -0
  21. package/conformance/cases/c99-a2a-preapproval-on-outside-peer-dropped/meta.json +6 -0
  22. package/conformance/profile/annotations.md +65 -0
  23. package/conformance/profile/loading-rules.md +193 -0
  24. package/conformance/profile/profiles/solo-auto.json +22 -0
  25. package/conformance/profile/profiles/solo-managed.json +21 -0
  26. package/conformance/profile/profiles/tenant-auto.json +36 -0
  27. package/conformance/profile/profiles/tenant-managed.json +36 -0
  28. package/conformance/profile/sema-profile.schema.json +201 -0
  29. package/conformance/profile/tools/mutations.md +62 -0
  30. package/conformance/profile/tools/validate.mjs +1190 -0
  31. package/conformance/profile/vectors/frozen-promises.json +120 -0
  32. package/conformance/profile/vectors/vectors.json +362 -0
  33. package/dist/a2a-peer-identity.d.ts +116 -0
  34. package/dist/a2a-peer-identity.js +182 -0
  35. package/dist/atomic-write.js +1 -1
  36. package/dist/catalog-manages.js +2 -2
  37. package/dist/config-dir-migration.js +0 -1
  38. package/dist/config-document-refusal.d.ts +1 -1
  39. package/dist/config-fns.d.ts +21 -8
  40. package/dist/config-fns.js +16 -3
  41. package/dist/config-root-documents.d.ts +3 -54
  42. package/dist/config-root-documents.js +24 -21
  43. package/dist/config-root-node.d.ts +2 -96
  44. package/dist/config-root-node.js +15 -163
  45. package/dist/conformance/index.d.ts +1 -0
  46. package/dist/conformance/index.js +1 -0
  47. package/dist/conformance/profile.d.ts +55 -0
  48. package/dist/conformance/profile.js +108 -0
  49. package/dist/conformance/warnings.js +1 -1
  50. package/dist/env-model-table.d.ts +3 -3
  51. package/dist/env-model-table.js +5 -5
  52. package/dist/index.d.ts +2 -1
  53. package/dist/index.js +2 -1
  54. package/dist/migration-receipt.d.ts +9 -11
  55. package/dist/migration-receipt.js +4 -5
  56. package/dist/node.d.ts +3 -3
  57. package/dist/node.js +3 -3
  58. package/dist/one-time-migrations.d.ts +3 -4
  59. package/dist/one-time-migrations.js +3 -28
  60. package/dist/retired-envs.js +5 -0
  61. package/dist/safety-merge-spec.d.ts +21 -0
  62. package/dist/safety-merge-spec.js +13 -0
  63. package/dist/scheduler-store-node.d.ts +14 -11
  64. package/dist/scheduler-store-node.js +22 -34
  65. package/dist/scheduler-store.d.ts +21 -6
  66. package/dist/scheduler-store.js +100 -19
  67. package/dist/settings-units.d.ts +9 -0
  68. package/dist/settings-units.js +12 -7
  69. package/dist/types.d.ts +44 -2
  70. package/dist/types.js +70 -2
  71. package/docs/API-SURFACE.md +38 -12
  72. package/docs/CC-DIVERGENCE.md +2 -1
  73. package/docs/CONFORMANCE.md +20 -3
  74. package/docs/CONSUMER-INTEGRATION.md +110 -13
  75. package/llms-full.txt +36 -13
  76. package/llms.txt +15 -5
  77. package/package.json +3 -3
@@ -8,44 +8,125 @@
8
8
  * - ABSTRACT: this module is the type + the parse/serialize FORMAT + the `SchedulerStore` interface. It has
9
9
  * ZERO runtime IO and ZERO deps (no `@sema-agent/*`, no `node:*`) so it lives in the browser-safe barrel.
10
10
  * The concrete filesystem binding is `@sema-agent/settings-schema/node` (`loadSchedulerStore`/`saveSchedulerStore`).
11
- * - EXTENSIBLE: `parseSchedulerStore` is FORWARD-COMPATIBLE — it validates only the required shape and
12
- * PRESERVES unknown fields, so a newer writer can add fields without an older reader dropping them on
13
- * round-trip. New optional `SchedulerRecord` fields are additive (no breaking change).
11
+ * - EXTENSIBLE: `parseSchedulerStore` is FORWARD-COMPATIBLE — it validates the declared members (each present one
12
+ * holds its declared type) and that every number anywhere in the element is finite (see `isSchedulerRecord`), and PRESERVES unknown fields, so a newer writer can add fields
13
+ * without an older reader dropping them on round-trip. A new optional `SchedulerRecord` field is additive for the
14
+ * type; judging it is a validation change for the records already on disk that carry that key.
14
15
  * - CONTRACTUAL: `when` is an inlined structural union kept byte-compatible with core `ScheduledIntent['when']`
15
16
  * but NOT imported — the contract stands alone, independent of the engine.
16
17
  *
17
18
  * 🔴 `principal` is pinned by the writer from Runner-held ctx (never the model); persisted opaquely, passed
18
19
  * through to `runTask` unchanged by the daemon (no privilege escalation).
19
20
  */
20
- import { ownDeclaredValueOf } from './own-key-read.js';
21
+ import { captureJson, ownDeclaredValueOf, ownRow } from './own-key-read.js';
21
22
  import { isJsonArray, isPlainJsonObject } from './plain-json-object.js';
22
23
  import { isSessionLifetime } from './scheduler-lifetime.js';
23
- /** Structural validation of one record (required fields + a well-formed `when`). Unknown fields are allowed. */
24
+ const isText = (value) => typeof value === 'string';
25
+ const isNumber = (value) => typeof value === 'number';
26
+ /**
27
+ * 记录的第二条律:**整条元素是纯 JSON 数据,其中任何一处的数都是有限数** —— 声明成员、判官不认识的自定义字段、嵌套的对象与数组一视同仁。
28
+ * 为什么:JSON 里超出双精度范围的数(`1e400`)解析成 `±Infinity`,写回时成 `null`;读得进、写不回的值留在记录里,别人一次无关的写之后条目还在、值却变了。
29
+ * 读法是包里的整树快照(`captureJson`,严归类:对象的自有串键 / 数组的下标是访问器或不可枚举、类实例、环 ⇒ 读不成纯数据 ⇒ 不是记录,getter 一次都不调),判在快照上:
30
+ * · 叶子只许 JSON 的值 —— 串、有限数、布尔、`null`(`bigint` / `symbol` / 函数写不回;`-0` 是有限数,写回成 `0`,与 `0` 是同一个 JSON 数);
31
+ * · 对象成员的值是 `undefined` ⇒ 当缺席(写回时这一键不在,与读它时同答);数组的洞与数组里的 `undefined` 写回成 `null` ⇒ 不是记录;
32
+ * · 数组上的非下标键不是成员(与校验器解析数组、`JSON.stringify` 同 —— 它们本来就不写回);
33
+ * · 共享的子树(同一只容器从两条路径可达)只走一次 —— 快照保留共享引用,按容器身份去重,遍历是线性的。
34
+ */
35
+ function isFiniteJsonData(v) {
36
+ const copy = captureJson(v);
37
+ if (!copy.ok)
38
+ return false;
39
+ const seen = new Set();
40
+ const stack = [copy.value];
41
+ while (stack.length > 0) {
42
+ const node = stack.pop();
43
+ if (node === null || typeof node === 'string' || typeof node === 'boolean')
44
+ continue;
45
+ if (typeof node === 'number') {
46
+ if (Number.isFinite(node))
47
+ continue;
48
+ return false;
49
+ }
50
+ // containers: shapes are asked of the seat (the snapshot's copies are plain objects / ordinary arrays)
51
+ if (isJsonArray(node)) {
52
+ if (seen.has(node))
53
+ continue;
54
+ seen.add(node);
55
+ // a hole stays a hole in the snapshot, an `undefined` element stays `undefined` — both are written back as `null`
56
+ for (let i = 0; i < node.length; i++) {
57
+ if (!(i in node) || node[i] === undefined)
58
+ return false;
59
+ stack.push(node[i]);
60
+ }
61
+ continue;
62
+ }
63
+ if (isPlainJsonObject(node)) {
64
+ if (seen.has(node))
65
+ continue;
66
+ seen.add(node);
67
+ // own enumerable data members only (the snapshot has no accessors, no inherited values); an `undefined` member reads as absent
68
+ for (const child of Object.values(node))
69
+ if (child !== undefined)
70
+ stack.push(child);
71
+ continue;
72
+ }
73
+ return false; // bigint, symbol, undefined, anything else: not a value JSON writes back as itself
74
+ }
75
+ return true;
76
+ }
77
+ /** `SchedulerRecord` 除 `when` 外的每一只声明成员 —— **按型穷举**(型上多一只成员而这里没有它的行 ⇒ 编译红;`required` 由型的可选性定)。 */
78
+ const RECORD_MEMBERS = {
79
+ id: { required: true, holds: isText },
80
+ scope: { required: true, holds: isText },
81
+ principal: { required: false, holds: isText },
82
+ sessionId: { required: false, holds: isText },
83
+ prompt: { required: true, holds: isText },
84
+ label: { required: false, holds: isText },
85
+ createdMs: { required: true, holds: isNumber },
86
+ nextRunMs: { required: false, holds: isNumber },
87
+ lifetime: { required: false, holds: isText },
88
+ mode: { required: false, holds: isText },
89
+ };
90
+ /** `when` 每一臂的那一只成员与它的判 —— 按 `SchedulerWhen` 的臂穷举(多一臂而这里没有 ⇒ 编译红)。 */
91
+ const WHEN_MEMBER = {
92
+ cron: ['expr', isText],
93
+ at: ['atMs', isNumber],
94
+ delay: ['delaySec', isNumber],
95
+ };
96
+ /**
97
+ * The ONE record judge, two rules: ① **the judge is the type** — every declared member ({@link RECORD_MEMBERS}, `when` by its arm {@link WHEN_MEMBER}) that is
98
+ * present holds its declared type (strings are strings, numbers are numbers), the required ones are present; a member written as `undefined` reads as absent;
99
+ * ② **the element is plain JSON data and every number anywhere in it is finite** ({@link isFiniteJsonData}: declared members, unknown fields and their nesting alike).
100
+ * Unknown fields are otherwise free and preserved. 35.0.0: before, only the required members' `typeof` — a record whose `lifetime` was `{}`, whose `createdMs`
101
+ * was `1e400`, or whose custom field nested a `1e400` passed, was read as the declared type, and its non-finite number turned into `null` on the next write.
102
+ */
24
103
  export function isSchedulerRecord(v) {
25
104
  if (!isPlainJsonObject(v))
26
105
  return false;
27
106
  // a type guard, so every field is read STRICTLY from the record's own keys (own, enumerable, data — the kernel's `ownDeclaredValueOf`): an inherited field is absent
28
107
  // (a polluted `Object.prototype.prompt` is not a prompt the record carries); an accessor / hidden field, or one that cannot be read ⇒ not a record — no getter is called,
29
108
  // so what the caller reads from the record next is what was judged
30
- const field = (o, key) => {
109
+ const holds = (o, key, member) => {
31
110
  const read = ownDeclaredValueOf(o, key);
32
- return read.ok ? read.value : undefined;
111
+ if (!read.ok)
112
+ return false;
113
+ return read.value === undefined ? !member.required : member.holds(read.value);
33
114
  };
34
- if (typeof field(v, 'id') !== 'string' || typeof field(v, 'scope') !== 'string' || typeof field(v, 'prompt') !== 'string' || typeof field(v, 'createdMs') !== 'number')
115
+ for (const [key, member] of Object.entries(RECORD_MEMBERS))
116
+ if (!holds(v, key, member))
117
+ return false;
118
+ const w = ownDeclaredValueOf(v, 'when');
119
+ if (!w.ok || !isPlainJsonObject(w.value))
120
+ return false;
121
+ const kind = ownDeclaredValueOf(w.value, 'kind');
122
+ if (!kind.ok || typeof kind.value !== 'string')
35
123
  return false;
36
- const w = field(v, 'when');
37
- if (!isPlainJsonObject(w))
124
+ const arm = ownRow(WHEN_MEMBER, kind.value);
125
+ if (arm === undefined || !holds(w.value, arm[0], { required: true, holds: arm[1] }))
38
126
  return false;
39
- const kind = field(w, 'kind');
40
- if (kind === 'cron')
41
- return typeof field(w, 'expr') === 'string';
42
- if (kind === 'at')
43
- return typeof field(w, 'atMs') === 'number';
44
- if (kind === 'delay')
45
- return typeof field(w, 'delaySec') === 'number';
46
- return false;
127
+ return isFiniteJsonData(v);
47
128
  }
48
- /** 一条会话链上的记录过期多久算「永驻孤儿」:`lifetime: "session"` ∧ `sessionId` 在场 ∧ `nextRunMs` 已过去这么久 ⇒ 读口丢弃并告警(7 天)。 */
129
+ /** 一条会话链上的记录过期多久算「永驻孤儿」:`lifetime: "session"` ∧ `sessionId` 是非空串 ∧ `nextRunMs` 在场(是数)且已过去这么久 ⇒ 读口丢弃并告警(7 天)。 */
49
130
  export const STALE_SESSION_RECORD_MS = 7 * 24 * 60 * 60 * 1000;
50
131
  /**
51
132
  * Parse the durable store from its serialized form. FORWARD-COMPATIBLE: well-formed records keep ALL their fields (incl.
@@ -92,6 +92,15 @@ export declare const SETTINGS_UNITS: {
92
92
  readonly reader: "shell";
93
93
  readonly sources: readonly ["userSettings"];
94
94
  };
95
+ readonly autoMemoryEnabled: {
96
+ readonly path: readonly ["autoMemoryEnabled"];
97
+ readonly category: "autoMemory";
98
+ readonly reads: "member";
99
+ readonly member: "autoMemoryEnabled";
100
+ readonly reading: "boolean";
101
+ readonly reader: "engine";
102
+ readonly sources: readonly ["userSettings", "projectSettings", "localSettings", "flagSettings", "policySettings", "foreignProjectSettings"];
103
+ };
95
104
  };
96
105
  export type SettingsUnitName = keyof typeof SETTINGS_UNITS;
97
106
  /** The comparator of one unit — or, for a `members` unit, of one DECLARED member of it: `whole` ⇒ the category's `tighten`;
@@ -5,8 +5,9 @@
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). The two
9
- * permission-mode kill-switches map to 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) — 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).
10
11
  *
11
12
  * Who reads a unit (`reader`, on every row; the closed set {@link SETTINGS_UNIT_READERS}):
12
13
  * · `shell` — the value changes only the host's own interface and never reaches the engine, wherever the engine runs — so a writer
@@ -21,7 +22,7 @@
21
22
  *
22
23
  * Which settings sources carry a unit (`sources`, on every row; words of `SETTINGS_SOURCES`): a unit is read only from the sources its row
23
24
  * lists — a value of the unit in any other source is not read (neither admitted nor refused: that source does not carry the key) — and inside
24
- * them `layerAdmission(source, workspace, category, …)` answers as for every category. Every unit the shell established is carried by every source
25
+ * them `layerAdmission(source, workspace, category, …)` answers as for every category. Every unit except `semaUiLanguage` is carried by every source
25
26
  * (their `sources` IS `SETTINGS_SOURCES`); `semaUiLanguage` only by `UI_LANGUAGE_SETTING.source` (the user's settings), read from there.
26
27
  *
27
28
  * NOT in this table: the two http-hook allowlist keys (`allowedHttpHookUrls` / `httpHookAllowedEnvVars`). They carry a merge contract
@@ -38,7 +39,7 @@
38
39
  * How a unit is addressed (`reads`):
39
40
  * · `whole` — the unit's value is one value under its category: compared by the category's `tighten`
40
41
  * (the only thing a category's `tighten` answers — safety-merge-spec header);
41
- * · `member` — the unit IS one declared member of its category (the two kill-switches): compared by that member's comparator;
42
+ * · `member` — the unit IS one declared member of its category (the two kill-switches and `autoMemoryEnabled`): compared by that member's comparator;
42
43
  * · `members` — the unit is an object of declared members (`permissions`, `sandbox`): every question names ONE declared member,
43
44
  * compared and read by that member's row ({@link memberTighten}; its value class `boolPole` / `list`). The unit's whole
44
45
  * value and its undeclared members have no comparator and no reading here — asking is a RangeError.
@@ -53,6 +54,7 @@
53
54
  * · `nonEmptyString` — a non-empty string;
54
55
  * · `uiLanguage` — a word of `UI_LANGUAGE_VALUES`, exactly as written: no case folding, no locale-tag folding (`"zh-CN"`, `"EN"`, `" en"`
55
56
  * are `unreadable`). The one judge is `readUiLanguage` (`./ui-language`); this reading delegates to it;
57
+ * · `boolean` — a boolean (`true` or `false`), strictly: no string spelling (`"disable"`, `"true"`, `"false"`) is rewritten;
56
58
  * and a member's value class: `boolPole` ⇒ a boolean, `list` ⇒ the `stringList` reading.
57
59
  * Everything else is `unreadable` — no default arm. Two laws for every unit: `undefined` and JSON `null` are `unreadable` (absence
58
60
  * is not a value; "an absent landing spot takes the write" is the loader's business, before it calls the reader), and the reader
@@ -68,11 +70,11 @@
68
70
  * it are already tables, and neither is carried by the reading (a reading has no `direction`: a `whole` unit has no direction source, so the field
69
71
  * could only be optional and every consumer would still branch on its absence — and it would be a second reader of a member row's `direction`):
70
72
  * the member's direction is `memberAdmission(category, member).direction`, and the category's failure direction is `SAFETY_MERGE_SPEC[category].fail`.
71
- * For a member of a category whose `fail` is `closed` (today every category that declares members: `permissions`, `sandboxNetwork`, `killSwitches`):
73
+ * For a member of a category whose `fail` is `closed` (today every category that declares members: `permissions`, `sandboxNetwork`, `killSwitches`, `autoMemory`):
72
74
  * · a `loosen` member — the caller MAY drop it (dropping grants less), loudly: it says which member of which layer was dropped and why;
73
75
  * · a `tighten` member — the caller must NOT drop it and must NOT read it as absent: it keeps the member and answers on ITS surface with the
74
- * strictest answer it has (the rules surface refuses every call it cannot place; a kill-switch counts as ON; a sandbox switch takes its strict
75
- * pole), because dropping a tighten member reads a restriction its author wrote — in a form the contract cannot place — as no restriction at all;
76
+ * strictest answer it has (the rules surface refuses every call it cannot place; a kill-switch counts as ON; a sandbox switch or `autoMemoryEnabled`
77
+ * takes its strict pole), because dropping a tighten member reads a restriction its author wrote — in a form the contract cannot place — as no restriction at all;
76
78
  * 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.
77
79
  * 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
78
80
  * out-of-domain value reads `unreadable` without throwing. Not covered, and not settled here: the `whole` units (`permissionMode`, `additionalDirectories`,
@@ -104,6 +106,7 @@ export const SETTINGS_UNITS = deepFreeze({
104
106
  outputStyle: { path: ["outputStyle"], category: "ui", reads: "whole", reading: "nonEmptyString", reader: "engine", sources: SETTINGS_SOURCES },
105
107
  // 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
106
108
  [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
+ autoMemoryEnabled: { path: ["autoMemoryEnabled"], category: "autoMemory", reads: "member", member: "autoMemoryEnabled", reading: "boolean", reader: "engine", sources: SETTINGS_SOURCES },
107
110
  });
108
111
  /** The one place a unit + optional member resolves to what is being asked about — the row and its comparator. Fail-closed
109
112
  * and loud on every misaddressing: an unknown unit (own-property lookup — `"__proto__"` is unknown, not Object.prototype),
@@ -204,6 +207,8 @@ function shapedReading(unit, row, rule, raw) {
204
207
  const layer = readUiLanguage(raw);
205
208
  return layer.ok && layer.value !== undefined ? { ok: true, value: raw } : UNREADABLE;
206
209
  }
210
+ case "boolean":
211
+ return typeof raw === "boolean" ? { ok: true, value: raw } : UNREADABLE;
207
212
  default: {
208
213
  const unknown = row.reading;
209
214
  throw new RangeError(`SETTINGS_UNITS: unit '${unit}' has an unknown reading '${String(unknown)}'`);
package/dist/types.d.ts CHANGED
@@ -845,10 +845,16 @@ export type EntitlementRuntimeCaps = z.output<z.ZodObject<typeof RUNTIME_CAP_FIE
845
845
  * without an entry is a COMPILE error (no silent wrong-direction merge) — so its keys are also the cap list: iterate
846
846
  * `Object.keys(RUNTIME_CAP_STRICT)` to visit every live cap. */
847
847
  export declare const RUNTIME_CAP_STRICT: Readonly<Record<keyof EntitlementRuntimeCaps, boolean>>;
848
+ /** The bounds of an entitlement tier's free-form fields —— the ONE source of these numbers: {@link EntitlementTier} reads them, and so do
849
+ * console forms and API routes (import this, never copy a number). */
850
+ export declare const ENTITLEMENT_TIER_LIMITS: {
851
+ readonly displayNameMax: 200;
852
+ };
848
853
  /** A named entitlement bundle (a `tier`, or a composable `role`). Bind a `roster` to inherit its model/skill/mcp
849
854
  * visibility for free; explicit allowlists intersect on top. Edit a tier once → re-prices everyone on it. */
850
855
  export declare const EntitlementTier: z.ZodObject<{
851
856
  id: z.ZodString;
857
+ displayName: z.ZodOptional<z.ZodString>;
852
858
  roster: z.ZodOptional<z.ZodString>;
853
859
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
854
860
  visibleSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -997,6 +1003,7 @@ export declare const EntitlementConfig: z.ZodObject<{
997
1003
  }, z.core.$strip>>;
998
1004
  tiers: z.ZodPrefault<z.ZodArray<z.ZodObject<{
999
1005
  id: z.ZodString;
1006
+ displayName: z.ZodOptional<z.ZodString>;
1000
1007
  roster: z.ZodOptional<z.ZodString>;
1001
1008
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
1002
1009
  visibleSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -1324,7 +1331,7 @@ export declare const ProjectRegistration: z.ZodObject<{
1324
1331
  }, z.core.$strip>;
1325
1332
  export type ProjectRegistration = z.infer<typeof ProjectRegistration>;
1326
1333
  /** 项目登记簿。`projects` 记录的**条目序是契约事实**:它就是登记簿的展示序,唯一来源 = 文档里的条目次序;写者必须保序({@link applyProjectPatch} 已保序)。
1327
- * 已知分工:今天的内容版本(`configDVersionOf`(`./config-d-file`))按排序后的键计算,只调换条目次序不会换版本号;内容版本自下一个大版本起看得见条目序。 */
1334
+ * 已知分工:今天的内容版本(`configDVersionOf`(`./config-d-file`))按排序后的键计算,只调换条目次序不会换版本号;今天内容版本看不见条目序;改不改另行设计(改它会让每一份配置文档的内容版本都换一次)。 */
1328
1335
  export declare const ProjectsConfig: z.ZodObject<{
1329
1336
  projects: z.ZodPrefault<z.ZodPreprocess<z.ZodRecord<z.ZodString, z.ZodObject<{
1330
1337
  displayName: z.ZodString;
@@ -2106,6 +2113,7 @@ export declare const McpServerSpec: z.ZodObject<{
2106
2113
  }>>;
2107
2114
  sessionMetaKey: z.ZodOptional<z.ZodUnknown>;
2108
2115
  startupTimeoutMs: z.ZodOptional<z.ZodUnknown>;
2116
+ callerMeta: z.ZodOptional<z.ZodBoolean>;
2109
2117
  source: z.ZodOptional<z.ZodUnknown>;
2110
2118
  toolFaces: z.ZodOptional<z.ZodUnknown>;
2111
2119
  toolAxes: z.ZodOptional<z.ZodUnknown>;
@@ -2158,6 +2166,7 @@ export declare const McpConfig: z.ZodObject<{
2158
2166
  }>>;
2159
2167
  sessionMetaKey: z.ZodOptional<z.ZodUnknown>;
2160
2168
  startupTimeoutMs: z.ZodOptional<z.ZodUnknown>;
2169
+ callerMeta: z.ZodOptional<z.ZodBoolean>;
2161
2170
  source: z.ZodOptional<z.ZodUnknown>;
2162
2171
  toolFaces: z.ZodOptional<z.ZodUnknown>;
2163
2172
  toolAxes: z.ZodOptional<z.ZodUnknown>;
@@ -2175,9 +2184,20 @@ export declare const A2aPeerSpec: z.ZodObject<{
2175
2184
  allowSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
2176
2185
  scenarios: z.ZodPrefault<z.ZodArray<z.ZodString>>;
2177
2186
  enabled: z.ZodDefault<z.ZodBoolean>;
2187
+ id: z.ZodOptional<z.ZodString>;
2188
+ boundary: z.ZodOptional<z.ZodEnum<{
2189
+ inside: "inside";
2190
+ outside: "outside";
2191
+ }>>;
2192
+ fingerprint: z.ZodOptional<z.ZodString>;
2193
+ ownerTeam: z.ZodOptional<z.ZodString>;
2194
+ displayName: z.ZodOptional<z.ZodString>;
2195
+ askEverySkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
2196
+ preApprovedFor: z.ZodOptional<z.ZodString>;
2178
2197
  }, z.core.$strip>;
2179
2198
  export type A2aPeerSpec = z.infer<typeof A2aPeerSpec>;
2180
- /** `a2a` 域:常驻出站 A2A 对端名册。空名册 = 不拨任何对端;文档缺席(店 / `config.d`)读作空名册。对端名唯一(重名拒,同 mcp)。
2199
+ /** `a2a` 域:常驻出站 A2A 对端名册。空名册 = 不拨任何对端;文档缺席(店 / `config.d`)读作空名册。对端名唯一(重名拒,同 mcp);条目编号 `id`
2200
+ * 在场的也唯一(同一道域判)。
2181
2201
  * 线上(`GET /effective`)缺席不是空名册:读口不补,{@link EffectiveWire} 上 `a2a` 缺席 = 生产方没发这个域(它的契约早于本域),见 {@link WIRE_CARRIED_DOMAINS}。 */
2182
2202
  export declare const A2aConfig: z.ZodObject<{
2183
2203
  peers: z.ZodPrefault<z.ZodArray<z.ZodObject<{
@@ -2189,6 +2209,16 @@ export declare const A2aConfig: z.ZodObject<{
2189
2209
  allowSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
2190
2210
  scenarios: z.ZodPrefault<z.ZodArray<z.ZodString>>;
2191
2211
  enabled: z.ZodDefault<z.ZodBoolean>;
2212
+ id: z.ZodOptional<z.ZodString>;
2213
+ boundary: z.ZodOptional<z.ZodEnum<{
2214
+ inside: "inside";
2215
+ outside: "outside";
2216
+ }>>;
2217
+ fingerprint: z.ZodOptional<z.ZodString>;
2218
+ ownerTeam: z.ZodOptional<z.ZodString>;
2219
+ displayName: z.ZodOptional<z.ZodString>;
2220
+ askEverySkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
2221
+ preApprovedFor: z.ZodOptional<z.ZodString>;
2192
2222
  }, z.core.$strip>>>;
2193
2223
  }, z.core.$strip>;
2194
2224
  export type A2aConfig = z.infer<typeof A2aConfig>;
@@ -2887,6 +2917,7 @@ export declare const DOMAIN_SCHEMAS: {
2887
2917
  }>>;
2888
2918
  sessionMetaKey: z.ZodOptional<z.ZodUnknown>;
2889
2919
  startupTimeoutMs: z.ZodOptional<z.ZodUnknown>;
2920
+ callerMeta: z.ZodOptional<z.ZodBoolean>;
2890
2921
  source: z.ZodOptional<z.ZodUnknown>;
2891
2922
  toolFaces: z.ZodOptional<z.ZodUnknown>;
2892
2923
  toolAxes: z.ZodOptional<z.ZodUnknown>;
@@ -3187,6 +3218,7 @@ export declare const DOMAIN_SCHEMAS: {
3187
3218
  }, z.core.$strip>>;
3188
3219
  tiers: z.ZodPrefault<z.ZodArray<z.ZodObject<{
3189
3220
  id: z.ZodString;
3221
+ displayName: z.ZodOptional<z.ZodString>;
3190
3222
  roster: z.ZodOptional<z.ZodString>;
3191
3223
  models: z.ZodOptional<z.ZodArray<z.ZodString>>;
3192
3224
  visibleSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
@@ -3515,6 +3547,16 @@ export declare const DOMAIN_SCHEMAS: {
3515
3547
  allowSkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
3516
3548
  scenarios: z.ZodPrefault<z.ZodArray<z.ZodString>>;
3517
3549
  enabled: z.ZodDefault<z.ZodBoolean>;
3550
+ id: z.ZodOptional<z.ZodString>;
3551
+ boundary: z.ZodOptional<z.ZodEnum<{
3552
+ inside: "inside";
3553
+ outside: "outside";
3554
+ }>>;
3555
+ fingerprint: z.ZodOptional<z.ZodString>;
3556
+ ownerTeam: z.ZodOptional<z.ZodString>;
3557
+ displayName: z.ZodOptional<z.ZodString>;
3558
+ askEverySkills: z.ZodOptional<z.ZodArray<z.ZodString>>;
3559
+ preApprovedFor: z.ZodOptional<z.ZodString>;
3518
3560
  }, z.core.$strip>>>;
3519
3561
  }, z.core.$strip>;
3520
3562
  };
package/dist/types.js CHANGED
@@ -43,6 +43,7 @@ import { TOOL_WIRE_NAME_MAX_CHARS, isUsableWireName } from "./wire-name.js"; //
43
43
  import { deepFreeze } from "./deep-freeze.js";
44
44
  import { PLUGIN_ID_SEGMENT_REGEX, PLUGIN_ID_SEGMENT_SENTENCE } from "./plugin-id-segment.js"; // the one grammar of a plugin id segment + its refusal sentence (a zero-import leaf, package-private; the regex is re-exported below under its own name)
45
45
  import { McpEntryCredential } from "./mcp-entry-credential.js"; // 29.0.0: the http entry's credential reference (the one reading = the engine primitives' readCredentialRef)
46
+ import { A2A_PEER_BOUNDARIES, A2A_PEER_ENTRY_PROBLEM_MEMBER, A2aPeerFingerprint, a2aPeerBoundaryOf, a2aPeerEntryProblems } from "./a2a-peer-identity.js"; // the a2a peer's boundary words + their one reading, the identity stamp's one spelling, and the entry judge (the engine primitives' registration judge + this package's two words; a leaf: it reads no value of this module)
46
47
  // COARSE, best-effort literal-secret SHAPE detector (NOT exhaustive — the real boundary is the env-NAME schema
47
48
  // on structured fields). Rejected in free-form value fields (worker `env`, model `extraBody`), URL components,
48
49
  // 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-
@@ -1267,10 +1268,20 @@ const RuntimeCapsSeat = z.object({
1267
1268
  allowAutoMode: retiredKey("runtimeCaps.allowAutoMode", RUNTIME_CAP_AUTO_MODE_RETIRED),
1268
1269
  allowUltracode: retiredKey("runtimeCaps.allowUltracode", RUNTIME_CAP_ULTRACODE_RETIRED),
1269
1270
  });
1271
+ /** The bounds of an entitlement tier's free-form fields —— the ONE source of these numbers: {@link EntitlementTier} reads them, and so do
1272
+ * console forms and API routes (import this, never copy a number). */
1273
+ export const ENTITLEMENT_TIER_LIMITS = deepFreeze({
1274
+ displayNameMax: 200,
1275
+ });
1276
+ const EntitlementTierDisplayName = z.string().min(1).max(ENTITLEMENT_TIER_LIMITS.displayNameMax);
1270
1277
  /** A named entitlement bundle (a `tier`, or a composable `role`). Bind a `roster` to inherit its model/skill/mcp
1271
1278
  * visibility for free; explicit allowlists intersect on top. Edit a tier once → re-prices everyone on it. */
1272
1279
  export const EntitlementTier = z.object({
1273
1280
  id: z.string().min(1).regex(/^[a-z0-9][a-z0-9._-]*$/i, "tier id: letters/digits/._- , no spaces"),
1281
+ /** Human-facing display label for the admin console (e.g. "标准版", "Design team"). Not an identifier, not unique, and not used for
1282
+ * matching (`id` stays the only key). Bounded by {@link ENTITLEMENT_TIER_LIMITS}`.displayNameMax`; carries the string verbatim (no trim
1283
+ * or character-set restriction, matching `ProjectRegistration.displayName`). */
1284
+ displayName: EntitlementTierDisplayName.optional(),
1274
1285
  roster: z.string().optional(),
1275
1286
  models: z.array(z.string()).optional(),
1276
1287
  visibleSkills: z.array(z.string()).optional(),
@@ -1645,7 +1656,7 @@ function remoteUniquenessIssues(cfg, ctx) {
1645
1656
  }
1646
1657
  }
1647
1658
  /** 项目登记簿。`projects` 记录的**条目序是契约事实**:它就是登记簿的展示序,唯一来源 = 文档里的条目次序;写者必须保序({@link applyProjectPatch} 已保序)。
1648
- * 已知分工:今天的内容版本(`configDVersionOf`(`./config-d-file`))按排序后的键计算,只调换条目次序不会换版本号;内容版本自下一个大版本起看得见条目序。 */
1659
+ * 已知分工:今天的内容版本(`configDVersionOf`(`./config-d-file`))按排序后的键计算,只调换条目次序不会换版本号;今天内容版本看不见条目序;改不改另行设计(改它会让每一份配置文档的内容版本都换一次)。 */
1649
1660
  export const ProjectsConfig = z
1650
1661
  .object({
1651
1662
  /** 键=projectId({@link PROJECT_ID_REGEX},generic lowercase UUID——宽读);tenant 半边=web-admin
@@ -2746,6 +2757,14 @@ export const McpServerSpec = z.object({
2746
2757
  *
2747
2758
  * **解析透明** —— 形归谁校验、为什么不放这里:{@link PARSE_TRANSPARENT_KEYS}(`mcp.servers[].startupTimeoutMs`)。 */
2748
2759
  startupTimeoutMs: z.unknown().optional(),
2760
+ /** 要不要让这台服务器知道「是谁在调」—— 一一对应引擎的 `McpServerSpec.callerMeta`。`true` ⇒ 引擎在发给这台服务器的每个 `tools/call` / `resources/read` /
2761
+ * `prompts/get` 的 `_meta` 里送调用方标识(这一腿的任务 id、这一次运行的 id、委派树的根会话 id,以及有父任务时的父任务 id);`false` 与缺席 ⇒ 什么都不送。
2762
+ * 缺席不送(`.optional()`,不铸默认:把会话 / 任务标识送出进程是部署自己选的关联)。标识里带会话 id,与 `sessionMetaKey` 是否声明无关 ——
2763
+ * 部署若不想让某台服务器学到任何会话 id,两把键都不开。
2764
+ *
2765
+ * 形是布尔,**本包判**(不是解析透明的键):布尔之外的任何值(`"true"` / `1` / `null` / 对象)整条判拒,与引擎判官同答 —— 不读成任一边,
2766
+ * 部署不会以为服务器被告知了调用方、其实没有,或者反过来。 */
2767
+ callerMeta: z.boolean().optional(),
2749
2768
  /** Declaration-plane GROUPING LABEL for this server — maps 1:1 onto the engine's `McpServerSpec.source`
2750
2769
  * (core ≥7.5.0 echoes it verbatim on `wiring_manifest.mcp[].source`, single-line + 80-char cap, so a
2751
2770
  * consumer can group servers by where they were declared). An OPEN set: CC's `plugin` / `user` /
@@ -2797,6 +2816,19 @@ export const McpConfig = z
2797
2816
  // 值集合:坏一项 ⇒ 整个对端丢),`principalHeader` = 头名判官,`name` = 线上名判官(对端名是线上工具名 `a2a__<名>__…` 的身份片)。
2798
2817
  // 秘密边界同 mcp:中心只存 env-NAME,值在读方自己的环境里。写权限 publisher(一个对端就是一组新挂进智能体的远端技能,同 mcp)。
2799
2818
  // 首版不收 `notes` / `rosters`(按 roster 定向)/ `toolAxes`(中心面不替调用方担保远端技能的副作用轴):三者都被剥并告警。
2819
+ // 七只可选的登记键(内部目的地):`id` · `boundary` · `fingerprint` · `ownerTeam` · `displayName` · `askEverySkills` · `preApprovedFor`。都是可选键、没有缺省:
2820
+ // 不带它们的条目读出来与加键之前逐字节同。22.0.0 起、加键之前的每一版读方读到带它们的条目整条丢(`entry-dropped`,`entry-unknown-key`),文档面剥键 ——
2821
+ // 所以读方先发:各服务先升到内嵌本版,管理台才写新键。身份戳、内外读法、问题词闭集与配对在 `./a2a-peer-identity`(本包铸、别处只比较)。
2822
+ // **条目判**写在 `A2aPeerSpec` 自己身上(它的第一个 refinement):成员形过了之后,问引擎原语包的完备性判官 + 本包两词(`a2aPeerEntryProblems`),每个词一条
2823
+ // issue、词在 `params.flaw`;外部条目带 `preApprovedFor` 是另一条形规则(哪些成员能同在,不带词)。写面整份拒、视图面逐条丢(全是问题词 ⇒
2824
+ // `entry-registration-refused`,行带 `registrationProblems`;有成员形的 issue ⇒ `entry-schema-invalid`),两面读这一只。
2825
+ // 有了 refinement,zod 对它的 `.pick` / `.omit` / `.partial` 运行期抛,以它为接收方的 `.merge`、覆盖已有键的 `.extend` 同样抛:要子形的从型派生
2826
+ // 或用 `A2aPeerSpec.shape` 的成员自己拼,要加键的用 `.safeExtend`,校验一条条目只用这一只。
2827
+ /** 条目编号的长界 —— 本包自己的界(引擎从不见到 `id`)。 */
2828
+ const A2A_PEER_ID_MAX_CHARS = 128;
2829
+ /** 条目编号的字符形:字母数字起头,只含字母数字与 `.` `_` `-`(UUID 与 slug 都在内;是标识符不是自由文本,读口与审计原样出门)。长界由 schema 的 `.max` 读 {@link A2A_PEER_ID_MAX_CHARS}。
2830
+ * 与协作槽位的 `id`(`CollabSlot`)是同一种标识符文法,写法也照它(小写区间在前);它不是主机路径判官 —— 那只判官只在原语包里。 */
2831
+ const A2A_PEER_ID_RE = /^[a-zA-Z0-9][a-zA-Z0-9._-]*$/;
2800
2832
  /** 一个常驻出站 A2A 对端。 */
2801
2833
  export const A2aPeerSpec = z.object({
2802
2834
  /** 对端的身份:线上工具名 `a2a__<名>__…` 的命名空间段 —— 线上名判官({@link isUsableWireName}:非空、≤128、首尾无空白;不截断、不 trim)。 */
@@ -2814,17 +2846,53 @@ export const A2aPeerSpec = z.object({
2814
2846
  /** 挂在哪些场景;空 = 全部(与 mcp / skills 同一条读方过滤)。 */
2815
2847
  scenarios: z.array(z.string().min(1)).prefault([]),
2816
2848
  enabled: z.boolean().default(true),
2849
+ /** 条目不变的编号:名字可以改,编号不变、不复用;读口、审计、管理台的列表与配对(`pairA2aPeers`)按它认条目。名册内唯一(与名字唯一同一道域判)。
2850
+ * 由写口铸(单机由「确认登记」入口铸);内部条目必带(问题词 `id_missing`)。只给读口与审计,不进引擎的声明。 */
2851
+ id: z.string().max(A2A_PEER_ID_MAX_CHARS).regex(A2A_PEER_ID_RE, "an a2a peer id starts with a letter or digit and holds only letters, digits, '.', '_' and '-'").optional(),
2852
+ /** 这个端点在不在本组织的信任边界之内:{@link A2A_PEER_BOUNDARIES}。缺席 = 外部(读法只有 `a2aPeerBoundaryOf` 一只;读出形不补这个键)。
2853
+ * 部署面的事实:只由登记的一侧写,模型、对端的卡片、请求体都说不了它。 */
2854
+ boundary: z.enum(A2A_PEER_BOUNDARIES).optional(),
2855
+ /** 身份戳(`./a2a-peer-identity`):**本包铸、别处只比较不铸**;身份字段(`url` / `cardUrl` / `ownerTeam` / `boundary`)被写一次就换一枚。
2856
+ * 不是凭据(身份的版本号,不保密、不签名)。 */
2857
+ fingerprint: A2aPeerFingerprint.optional(),
2858
+ /** 归属团队与负责人的联系面(登记人写的自由文本):问卡上的「这个对端归谁」、催不动时通知谁。不取自对端的卡片。读不读得出(有可见字符、长界)
2859
+ * 由条目判问引擎原语包(`owner_team_unreadable`),成员形只判是串。 */
2860
+ ownerTeam: z.string().optional(),
2861
+ /** 给人看的名字;`name` 仍是线上工具名的一截。缺席 ⇒ 问卡上不带展示名(不拿 `name` 顶替)。不取自对端的卡片。读不读得出由条目判问引擎原语包
2862
+ * (`display_name_unreadable`),成员形只判是串。 */
2863
+ displayName: z.string().optional(),
2864
+ /** 这些技能每次都问(只能往上加:读方把它投成该技能的「每次都问」轴,从不往下调)。一张值名单:坏一个元素 ⇒ 整条条目判不过。 */
2865
+ askEverySkills: z.array(z.string().min(1)).optional(),
2866
+ /** 全员预批:值 = 勾下那一刻条目的身份戳;等于条目当前的 `fingerprint` 才算勾着(身份一变自动不成立,写口不替人跟着改)。
2867
+ * **只许出现在内部条目上**(下面这只条目判)。 */
2868
+ preApprovedFor: A2aPeerFingerprint.optional(),
2869
+ }).superRefine((p, ctx) => {
2870
+ // 条目判:写面(parseDomain / validateDomain)整份拒、视图面(逐条丢弃)丢这一条,两面读的是这一只。
2871
+ for (const flaw of a2aPeerEntryProblems(p)) {
2872
+ const issue = buildQuotedIssue `a2a peer "${p.name}" is not a registration the engine can mount (${fixed(flaw)} at ${fixed(A2A_PEER_ENTRY_PROBLEM_MEMBER[flaw])}) — the peer is not mounted. A peer inside the trust boundary needs an id, a fingerprint minted by mintA2aPeerFingerprint for its current url / cardUrl / ownerTeam / boundary, an ownerTeam, a non-empty allowSkills, a principalHeader and locations that do not cross the network in the clear; displayName and ownerTeam, when present, hold visible text within the engine's bound`;
2873
+ ctx.addIssue({ code: "custom", ...issue, params: { ...issue.params, flaw }, path: [A2A_PEER_ENTRY_PROBLEM_MEMBER[flaw]] });
2874
+ }
2875
+ if (a2aPeerBoundaryOf(p) === "outside" && p.preApprovedFor !== undefined) {
2876
+ ctx.addIssue({ code: "custom", ...buildQuotedIssue `a2a peer "${p.name}" sets preApprovedFor but is not registered inside the trust boundary (its boundary is ${fixed(p.boundary === undefined ? "absent, which reads outside" : '"outside"')}) — a pre-approval is for inside peers only: remove preApprovedFor, or register the peer with boundary "inside"`, path: ["preApprovedFor"] });
2877
+ }
2817
2878
  });
2818
- /** `a2a` 域:常驻出站 A2A 对端名册。空名册 = 不拨任何对端;文档缺席(店 / `config.d`)读作空名册。对端名唯一(重名拒,同 mcp)。
2879
+ /** `a2a` 域:常驻出站 A2A 对端名册。空名册 = 不拨任何对端;文档缺席(店 / `config.d`)读作空名册。对端名唯一(重名拒,同 mcp);条目编号 `id`
2880
+ * 在场的也唯一(同一道域判)。
2819
2881
  * 线上(`GET /effective`)缺席不是空名册:读口不补,{@link EffectiveWire} 上 `a2a` 缺席 = 生产方没发这个域(它的契约早于本域),见 {@link WIRE_CARRIED_DOMAINS}。 */
2820
2882
  export const A2aConfig = z
2821
2883
  .object({ peers: z.array(A2aPeerSpec).prefault([]) })
2822
2884
  .superRefine((cfg, ctx) => {
2823
2885
  const seen = new Set();
2886
+ const seenIds = new Set();
2824
2887
  cfg.peers.forEach((p, i) => {
2825
2888
  if (seen.has(p.name))
2826
2889
  ctx.addIssue({ code: "custom", ...buildQuotedIssue `duplicate a2a peer "${p.name}"`, path: ["peers", i, "name"] });
2827
2890
  seen.add(p.name);
2891
+ if (p.id === undefined)
2892
+ return;
2893
+ if (seenIds.has(p.id))
2894
+ ctx.addIssue({ code: "custom", ...buildQuotedIssue `duplicate a2a peer id "${p.id}" (on peer "${p.name}")`, path: ["peers", i, "id"] });
2895
+ seenIds.add(p.id);
2828
2896
  });
2829
2897
  });
2830
2898
  // ── Domain: plugins (plugin SOURCE REFERENCES — C2 plugins 上云, additive 0.5.0) ──────────────────────────