@lmzhen/dsh-evolution-core 0.32.4 → 0.32.6

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/README.md CHANGED
@@ -1,123 +1,55 @@
1
1
  # @lmzhen/dsh-evolution-core
2
2
 
3
- Shared pure library for the family: `SkillLibrary`/`MemoryStore`, the prompts and guidance text, the threat/quality/drift signals, the skill CONTENT history (`skill-history.ts`: content-addressed versions behind every write) and the frame classification the plan path reports over (`evidence.ts`), plus the IO primitives (`nodeEvolutionIo`, `transactIo`, `evolutionIoAdapter`), the two helpers every host route surface shares (`http-routes.ts`: the loopback fence, the bounded JSON body reader and the JSON writer), the run lifecycle owner and the shared report window (`run-registry.ts`: the single owner of what is in flight, how a run ended and where its result lives, with read-time orphan convergence and no timer; `reports.ts`: one bucket sweep for every run-report kind, plus the per-home lock target both sweeps hold), and the long-run inventory the published table is rendered from (`long-runs.ts`). It is **not a Cordis row** — it registers no service, tool or prompt
4
- section, and importing the package root is its only entry.
3
+ Shared library for the evolution family: skill and memory stores, write kernels and mutation units, prompts, projections, event types, composition helpers, HTTP route helpers, history, recovery, and parameter definitions.
5
4
 
6
- ## Model surface
5
+ The root entry is a library, not a user-facing command. The package also exposes `./composition`, `./subagent`, `./http-routes`, and `./restrictor` subpaths.
7
6
 
8
- - **Model-visible:** nothing of its own: the guidance text and memory snapshot it renders are injected by the rows that consume it (`tool-memory`, `tool-skill-manage`).
9
- - **Prompt prefix / KV cache:** unchanged by this package: family-level rules single-sourced in `packages/README.md` §"Model-visible prompt prefix and the KV cache".
10
- - **Mount it?** no: a library, not a row; consumed by the family's rows (e.g. `evolution-threat`, `evolution-policy`, `memory-files`, `skill-usage`, `evolution-state-json`).
11
-
12
- ## Known limitations
13
-
14
- - **The family tree IS the platform's USER skill root.** `skillsRoot()` resolves to `<dshHome>/skills` — the root the platform's `skill-filesystem` serves at rank 400 — so "the same tree" holds while that root is enabled. Two divergences stay documented rather than mirrored: a platform row with `includeDefaultRoots:false` (or a composition without this family's catalog row) removes the only providers that serve the tree while family writes still succeed, and the platform's CWD-derived PROJECT roots (`<cwd>/.dsh/skills`, `<cwd>/.agents/skills`) are not read by the family at all, so `ctx.skills.get(name).path` and `SkillLibrary.read(name)` can name different files. Mirroring project roots is `U-3`, deliberately not started; point `customSkillDirs` (platform side) or `root` (family side) at a shared directory when the project tree has to be visible to both.
15
- - This package is a library, not a Cordis row; do not mount it as a plugin.
16
- - 数值配置已在消费方 Config 面钳制(`min 1`/各字段域);`MemoryStore` 内部对 `limit <= 0` 仍按 unbounded 防御处理——那是库内部防御,不构成"0 = 禁用"的配置语义。
17
- - **Content-history storage grows with the number of DISTINCT bodies a skill has ever been written
18
- with, not with the retained count.** Trimming drops index entries; the blobs they point at stay on
19
- disk (they are shared by content, so a reference count would have to span every skill's index, and no
20
- sweeper exists yet). Measured on a 3.6 KB skill written 41 times: a 5.7 KB index over 20 entries and
21
- 41 blob files totalling 150 KB (41x the live body); unchanged writes add nothing. Plan disk accordingly
22
- or remove `.history/blobs` entries by hand.
23
- - Skill-library writes are serialized **in-process**. The shipped IO backend declares single-process; a second process sharing `DSH_HOME` is unsupported. The full concurrency model, its two-phase exceptions and their provenance are in Notes and history.
24
-
25
- **Runtime invariant:** No companion is published. The platform auto-assembles nothing and the family mounts no `<pkg>/invariant` cordis row, so a companion here would never execute (v37 S2.1 / I-3).
26
-
27
- ## Notes and history
28
-
29
- - Similarity is TWO NAMED QUESTIONS plus a projection the caller declares (`quality.ts`): `identity(text)` ("is it the same text?", a normalized-content hash) and `affinity(a, b)` ("how much vocabulary do these two share?", Jaccard over two `vocabulary()` sets), asked over `projectionText(projection, input)` — `body` for the library-wide scan, `summary` (name + description) for the create-time hint. `computePrefixClusters` stays a name-side STRUCTURAL index, not a score. Adding a projection is one entry in that table; a caller that wants a fourth ruler should name the question it is really asking instead.
30
- - A whole-body replacement that keeps less than half of the previous body appends one line to its own result
31
- (`contentRetentionFeedback`, design §4 item 3): the ratio, both character counts, and the fact that the
32
- replaced version is still in the history. Computed in the write funnel where both bodies are in hand, feedback
33
- only — no ratio refuses a write, and the function owns no configuration.
34
- - **A REMOVAL now leaves an entry (E2, 2026-09-30).** `nextHistoryIndex` mints an entry from the AFTER side,
35
- so an operation with `after === null` (removing a support file) used to record nothing once its bytes were
36
- already indexed: the deletion was invisible and its action vocabulary unreachable. A removal records the bytes
37
- it removed, labeled with the write that removed them, so a face can say "these bytes are gone" and undoing that
38
- entry puts the file back. The entry deliberately carries no `beforeHash` (its own hash IS the removed content).
39
- - `anchorVerdict` is exported: the stage-time anchor rule ("does this write's target still hold the bytes the
40
- caller staged against?") has ONE implementation, and read-only readers (a preview, a dry run) call it instead
41
- of re-deriving a `contentHash` comparison.
42
- - Content history is HISTORY ONLY: the skill tree is the single truth for current content, and no judgement reads the version index (design invariant I1). Recording is best-effort but happens inside the write lock, so the index never describes content that did not land; a failed record warns once per instance instead of failing the write.
43
- - Skill-library mutations are read-modify-write on one file, so `SkillLibrary` serializes them in-process with a `makeSerialQueue` chain: `update`, `patch`, `restructure`, `writeSupportFile` and (since 0.3.46) `consolidate`'s target read→merge→commit run their whole read→validate→write under one serial task, so two concurrent mutators on one skill never interleave in this process.
44
- - `create` is INSIDE the serial chain and, when a transact backend is bound, its exists check runs inside the same per-file transact (v18); `archive`/`consolidate` are rename-based two-phase paths and stay outside the single-file serial chain.
45
- - **v18 residual (updated):** `create`, `removeSupportFile` and `setPinned` now run on the serial chain (`removeSupportFile`'s delete also goes through the per-file transact), so the remaining single-file residual is the protection TOCTOU (a marker check outside the transact) and the multi-file two-phase paths `archive`/`consolidate`/`restructure`.
46
- - The race needs a concurrent mutator on the SAME skill file/package; the exposure is acknowledged and the protection check is the next candidate (see the v18 optimization plan, E-5).
47
- - The constructor binds the IO backend's `transact` by default since 0.3.27: the single-file entry points (`update`, `patch`, `writeSupportFile`, and each per-file piece of `restructure`) run their read→write inside that transaction. The shipped backend is **single-process**, so this does not protect two processes sharing `DSH_HOME`.
48
- - The two-phase paths deliberately stay outside that lock: `create`'s exists probe runs inside the transact when a transact backend is bound (v18), so only a transact-less custom backend can still double-pass the probe across processes; `archive`/`consolidate` are rename-based with best-effort rollback (an archive loser's rollback surfaces the raw failure when the source vanished), and `restructure`'s multi-file swap can expose an interleaved tree to a concurrent reader.
49
- - These residual windows are documented rather than locked. The shipped backend is single-process; cross-process writers to the same skill file are unsupported and must not be treated as serialized.
7
+ `./restrictor` is a function plugin for restricted presets. It requires a `presetId` and a non-empty `allow` or `deny` set, then applies `tools.restrict()` in matching child-agent scopes. It constrains inherited tools, not the preset mount scope itself.
50
8
 
51
9
  ## Events (the family's own, process-local)
52
10
 
53
- Eight process events ride the cordis bus (`evolution-core/src/events.ts` declares the payloads;
54
- producers call `ctx.emit`, consumers `ctx.on`). They are NOT session events — appending one to a
55
- session log made the session unresumable (A-line P0-1), which is why the payload file says so.
56
-
57
- | event | mode today | emitted by |
11
+ | Event | the `@mode` | Purpose |
58
12
  |---|---|---|
59
- | `evolution/skill-mutated` | emit (notification) | `evolution-core` skill store |
60
- | `evolution/skills-refresh` | emit (notification) | `evolution-commands` `/evolution` verbs |
61
- | `evolution/review-scheduled` | emit (notification) | `evolution-review` cadence paths |
62
- | `evolution/review-error` | emit (notification) | `evolution-review` failure paths |
63
- | `evolution/review-completed` | emit (notification) | `evolution-review` after a plugin branch settles |
64
- | `evolution/memory-applied` | emit (notification) | `memory` after a memory write |
65
- | `evolution/memory-provider-registered` | emit (notification) | `memory` when a provider registers |
66
-
67
- `evolution/plan-applied` is declared for old activity ledgers; `evolution-review` now emits it from a branch review once that branch settles, with real action counts. `reviewMode: "inject"` still emits none by design.
68
-
69
- The mode column is what the code does today: every one of them is an announcement, and each
70
- declaration carries it as a `@mode` tag (finding O-1, landed) — `verify-arch-guards`' rule **N33** checks that
71
- tag against THIS table and against the dispatch site (`ctx.emit('…'`), so a declaration that drifts from
72
- the table, or an event with no `@mode`, fails. This table stays the set's ONE home: the machine check here
73
- (`machine.kind = event-mode`) re-derives the SET from the emit sites, so an event added or renamed in
74
- code without this table fails N19.
75
-
76
- The last two rows have no in-family consumer: `evolution/review-scheduled` and `evolution/review-error`
77
- are emitted for operators and observability (5 and 3 dispatch sites, 0 `ctx.on` subscribers here). They are
78
- **kept deliberately** — the observation surface is the point, and a deployment's own listener is the intended
79
- consumer — so the `@mode` target stays at six (decision 10, provisional: keep).
80
-
81
- ## 错误码(THE error-code table)
82
-
83
- > 本节的表与 `src/errors.ts` 的码表必须**同集**,并写明**区间**:CI 门禁 `verify-error-codes.mjs <root>`
84
- > 到 `<root>/evolution-core/README.md` 逐码核对(新增码要同时进表与区间行)。
85
- | `E-301` / `E-302` / `E-303` | approval / curator / replay service not mounted | mount the row (they ship with host/all), then run doctor |
86
- | `E-306` | this deployment stages foreground writes, but the named command is not replayable through the skill runner | approve-and-execute it directly, or set `stageForeground: false` deliberately |
87
- | `E-304` | the mounted approval service predates the release capability (a skewed/partial upgrade) | `reject` the pending record instead of `release` |
88
- | `E-305` | the invocation carries no agent (a script/headless caller reached a session-backed branch) | run the command from a session in the GUI or the CLI |
89
- | `E-307` / `E-311` | the settings service is missing or cannot report its sections (`/evolution params`, `/evolution policy set`) | mount the settings row (ships with host/all), then run doctor |
90
- | `E-312` | a parameter id or value was rejected, with the reason included | run `/evolution params` to see the canonical ids |
91
- | `E-308` / `E-313` | unknown parameter group or id | list them: `/evolution params` shows every registered id with its tier and owner |
92
- | `E-314` / `E-315` / `E-316` | the id is a deployment parameter, has no user layer, or its owner is not mounted | write it in `cordis.yml`, or mount the owner row — the message names tier, owner and namespace |
93
- | `E-309` / `E-310` | your write lost a revision race, or the settings service refused it (the reason is included) | re-read with `/evolution params` and retry |
94
- | `E-317` | you declined the confirmation the tool asked before creating or deleting a skill (a foreground create or bare delete asks when `skillWriteConfirm` is `ask` or `timeout`; the default `auto` does not ask at all) | nothing was written; repeat the call if you do want it |
95
- | `E-318` | a write without a read: the session never loaded that skill, so the write is refused (skills only; the foreground operator session is exempt) | load it with the `skill` tool, then repeat the write |
96
- | `E-326` | a support-file write without reading THAT file: reading `SKILL.md` is not evidence for `references/x.md` | read the exact support file, then repeat the write |
97
- | `E-320` | the profile home is not reported by this host, so the legacy settings document cannot be located | run the command in a session whose profile home is set |
98
- | `E-321` | no evolution-io provider is mounted, so the legacy settings document cannot be read | mount the `evolution-io-node` row |
99
- | `E-322` | a cross-field parameter constraint would be broken (the field, its floor and the attempted value are included) | raise the value to the named floor, or lower the sibling first |
100
- | `E-323` | the subagent channel is unavailable: no subagents/agentPresets service, or the spawn provider lacks the agentPreset capability | run `/evolution doctor`; review keeps its inject channel, maintenance reports the channel unavailable instead of degrading silently |
101
- | `E-324` | a restricted preset could not be created (parent preset read, YAML parse, register, or restrictor mount failed; the reason is included) | run `/evolution doctor` to see the preset id, allow set and failure reason; the review/maintenance channel stays unavailable until it is fixed |
102
- | `E-325` | the host data plane is unavailable: no connection service, so panel/approval routes are not registered | use `/evolution pending`, `approve`, `reject` (same service methods) and run `/evolution doctor` |
103
- | `E-319` | the confirmation before a create or bare delete went unanswered for `skillWriteConfirmTimeoutSeconds` (`skillWriteConfirm: 'timeout'`), so the write was cancelled | set `skillWriteConfirm` to `auto` (write without asking), keep `ask` (wait until answered), or raise the timeout |
104
- Symptom → next step; the exact text of every code (`E-301`–`E-326`) is stored once in
105
-
106
- ## 单元与撤销(本包负责的契约)
107
-
108
- - 本包持有单元契约的**类型与折叠**:SkillVersion.unitHead 两形态互斥(代表片 { moves, sources }/路标 { skill }),判别式固定为 moves !== undefined;读端折叠必须带上新字段,否则下一次写就丢。
109
- - 成员解析与孤路标判定在 src/unit-members.ts:candidateSkills(代表片首位、去重保序)、resolveUnitMembersFromIndexes(只按已知 key、三向校验)、landmarkVerdict 与 staleRouteStubs(可跳 ⟺ 目标存在 ∧ 其索引仍持该 unitId;输出按 skill/version/owner 确定性排序)。
110
- - 写作端的硬规则:kind 判 previous === null(不是 undefined);path 抄循环里既有的 rel;同一目标写两次时清单保留最后一次写入的 afterRef。
111
- - 面向读者的完整说明见仓库 docs/units-and-undo.md。
112
-
113
- ## Restricted preset ids
114
-
115
- The review and maintenance channels run under two internally generated restricted presets (they are
116
- NOT user-facing preset picker entries):
117
-
118
- - `evolution-reviewer-readonly` — the review channel's child preset;
119
- - `evolution-maintainer-readonly` — the maintenance channel's child preset.
120
-
121
- The family's own agent-preset ids (`EVOLUTION_PRESET_IDS`) are `evolution`, `evolution-ptc`,
122
- `evolution-cordis` and `evolution-minimal`. The two id sets are deliberately separate: a restricted
123
- preset is created at runtime from a parent preset, never installed or selected.
13
+ | `evolution/skill-mutated` | emit (one-way) | Invalidate catalog state after a skill-tree write. |
14
+ | `evolution/skills-refresh` | emit (one-way) | Explicitly refresh the catalog after `/evolution skills refresh`. |
15
+ | `evolution/review-scheduled` | emit (one-way) | A review was scheduled. |
16
+ | `evolution/review-completed` | emit (one-way) | A branch review completed, including failure/timeout status when known. |
17
+ | `evolution/review-error` | emit (one-way) | The review pipeline failed. |
18
+ | `evolution/plan-applied` | emit (one-way) | A reviewed plan produced an execution result. |
19
+ | `evolution/memory-applied` | emit (one-way) | A memory write succeeded through the registry sink. |
20
+ | `evolution/memory-provider-registered` | emit (one-way) | A memory provider became available. |
21
+
22
+ Preset ids: `evolution`, `evolution-ptc`, `evolution-cordis`, `evolution-minimal`, `evolution-reviewer-readonly`, `evolution-maintainer-readonly`.
23
+
24
+ ## Error codes
25
+
26
+ (`E-301`–`E-326`) identify unavailable services and command/settings failures. Exact message templates live in `src/errors.ts`.
27
+
28
+ | Code | Meaning |
29
+ |---|---|
30
+ | `E-301` | Approval service is not mounted. |
31
+ | `E-302` | Curator service is not mounted. |
32
+ | `E-303` | Replay service is not mounted. |
33
+ | `E-304` | Approval service is too old. |
34
+ | `E-305` | Invocation has no agent or delivery channel. |
35
+ | `E-306` | Foreground write cannot be replayed. |
36
+ | `E-307` | Settings namespace or revision cannot be read. |
37
+ | `E-308` | Unknown parameter group. |
38
+ | `E-309` | Parameter revision conflict. |
39
+ | `E-310` | Settings service rejected the write. |
40
+ | `E-311` | Settings service is unavailable. |
41
+ | `E-312` | Parameter write failed. |
42
+ | `E-313` | Unknown parameter id. |
43
+ | `E-314` | Deployment parameter cannot be written from a session. |
44
+ | `E-315` | Parameter has no user layer. |
45
+ | `E-316` | Namespace is not registered. |
46
+ | `E-317` | Skill write was not confirmed. |
47
+ | `E-318` | Skill was not read before writing. |
48
+ | `E-319` | Confirmation timed out and cancelled the write. |
49
+ | `E-320` | Profile home is unavailable. |
50
+ | `E-321` | Evolution IO is unavailable. |
51
+ | `E-322` | Parameter cross-field constraint failed. |
52
+ | `E-323` | Subagent channel is unavailable. |
53
+ | `E-324` | Restricted preset is unavailable. |
54
+ | `E-325` | Host data plane is unavailable. |
55
+ | `E-326` | Support file was not read before writing. |
@@ -63,7 +63,8 @@ const HOST_ROUTES = {
63
63
  pending: "/api/dsh-evolution/approval/pending",
64
64
  preview: "/api/dsh-evolution/approval/preview",
65
65
  approve: "/api/dsh-evolution/approval/approve",
66
- reject: "/api/dsh-evolution/approval/reject"
66
+ reject: "/api/dsh-evolution/approval/reject",
67
+ release: "/api/dsh-evolution/approval/release"
67
68
  },
68
69
  skillHistory: {
69
70
  skills: "/api/dsh-evolution/skill-history/skills",
@@ -82,7 +83,11 @@ const HOST_ROUTES = {
82
83
  body: "/api/dsh-evolution/merge/body",
83
84
  history: "/api/dsh-evolution/merge/history"
84
85
  },
85
- diagnostics: { view: "/api/dsh-evolution/diagnostics" }
86
+ diagnostics: { view: "/api/dsh-evolution/diagnostics" },
87
+ settings: {
88
+ describe: "/api/dsh-evolution/settings/describe",
89
+ mutate: "/api/dsh-evolution/settings/mutate"
90
+ }
86
91
  };
87
92
  function hostSurface(ctx) {
88
93
  const connection = ctx.get("connection");
@@ -96,40 +101,111 @@ function hostSurface(ctx) {
96
101
  allowsRemoteAuthorities: connection.allowsRemoteAuthorities === true
97
102
  };
98
103
  }
99
- /**
100
- * Register the family host surface on the platform's exact-route carrier.
101
- *
102
- * The platform owns admission (Host/Origin hygiene + browserAuth + exact-route owner peer) and the
103
- * disposer is bound to the CALLING fiber, not the connection service: the connection service can
104
- * outlive a reloaded family fiber, so the family must release its own registrations on dispose.
105
- * Routes carry the audit snapshot taken at registration time (deployment-level facts only — the
106
- * exact-route handler receives a Request, not the peer identity).
107
- */
104
+ function isLoopback(address) {
105
+ const value = address ?? "";
106
+ return value === "127.0.0.1" || value === "::1" || value === "::ffff:127.0.0.1";
107
+ }
108
+ function sameOrigin(origin, host) {
109
+ if (origin === void 0) return true;
110
+ try {
111
+ const parsed = new URL(origin);
112
+ return isLoopback(parsed.hostname) && host !== void 0 && parsed.host === host;
113
+ } catch {
114
+ return false;
115
+ }
116
+ }
117
+ function nodeRoute(route) {
118
+ return {
119
+ kind: "exact",
120
+ path: route.path,
121
+ handler: async (req, res) => {
122
+ if (!isLoopback(req.socket.remoteAddress)) {
123
+ res.statusCode = 403;
124
+ res.end("forbidden");
125
+ return;
126
+ }
127
+ if (!sameOrigin(req.headers.origin, req.headers.host)) {
128
+ res.statusCode = 403;
129
+ res.end("forbidden");
130
+ return;
131
+ }
132
+ const fetchSite = req.headers["sec-fetch-site"];
133
+ if (fetchSite !== void 0 && fetchSite !== "same-origin" && fetchSite !== "none") {
134
+ res.statusCode = 403;
135
+ res.end("forbidden");
136
+ return;
137
+ }
138
+ const method = req.method ?? "GET";
139
+ if (method !== "GET" && method !== "HEAD" && !(req.headers["content-type"] ?? "").toLowerCase().startsWith("application/json")) {
140
+ res.statusCode = 415;
141
+ res.end("json required");
142
+ return;
143
+ }
144
+ try {
145
+ const chunks = [];
146
+ for await (const chunk of req) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
147
+ const headers = new Headers();
148
+ for (const [key, value] of Object.entries(req.headers)) {
149
+ if (value === void 0) continue;
150
+ headers.set(key, Array.isArray(value) ? value.join(",") : value);
151
+ }
152
+ const request = new Request(new URL(req.url ?? "/", "http://127.0.0.1"), {
153
+ method,
154
+ headers,
155
+ ...method === "GET" || method === "HEAD" || chunks.length === 0 ? {} : { body: Buffer.concat(chunks) }
156
+ });
157
+ const response = await route.fetch(request);
158
+ res.statusCode = response.status;
159
+ response.headers.forEach((value, key) => {
160
+ try {
161
+ res.setHeader(key, value);
162
+ } catch {}
163
+ });
164
+ res.end(Buffer.from(await response.arrayBuffer()));
165
+ } catch (error) {
166
+ res.statusCode = 500;
167
+ res.end(error instanceof Error ? error.message : String(error));
168
+ }
169
+ }
170
+ };
171
+ }
108
172
  function registerHostRoutes(owner, build) {
109
173
  const injecting = owner;
110
174
  if (typeof injecting.inject !== "function") throw new Error("host routes require a context that owns inject()");
111
175
  injecting.inject(["connection"], (scope) => {
112
176
  const connection = scope.connection;
113
- if (connection === void 0 || connection.fetch === void 0 || typeof connection.fetch.register !== "function") throw new Error("connection service is mounted without fetch.register()");
114
- const register = connection.fetch.register.bind(connection.fetch);
115
177
  const routes = build({
116
178
  channel: "connection.fetch",
117
179
  principal: "owner",
118
- deploymentAllowsRemote: connection.allowsRemoteAuthorities === true
180
+ deploymentAllowsRemote: connection?.allowsRemoteAuthorities === true
119
181
  });
120
182
  for (const route of routes) if (!route.path.startsWith("/api/dsh-evolution/")) throw new Error("host route path must carry the /api/dsh-evolution/ prefix: " + route.path);
121
183
  const effect = scope.effect;
122
184
  if (typeof effect !== "function") throw new Error("connection scope has no effect() to own the registration");
185
+ if (connection?.fetch !== void 0 && typeof connection.fetch.register === "function") {
186
+ const register = connection.fetch.register.bind(connection.fetch);
187
+ effect.call(scope, () => {
188
+ const disposers = [];
189
+ try {
190
+ for (const route of routes) disposers.push(register(route));
191
+ } catch (error) {
192
+ for (const dispose of disposers) try {
193
+ dispose();
194
+ } catch {}
195
+ throw error;
196
+ }
197
+ return () => {
198
+ for (const dispose of disposers) try {
199
+ dispose();
200
+ } catch {}
201
+ };
202
+ }, "evolution-host-routes");
203
+ return;
204
+ }
205
+ const web = scope.get?.("webServer") ?? owner.get?.("webServer");
206
+ if (web === void 0 || typeof web.register !== "function") throw new Error("connection service has no fetch.register(), and webServer is not mounted for the loopback host-route bridge");
123
207
  effect.call(scope, () => {
124
- const disposers = [];
125
- try {
126
- for (const route of routes) disposers.push(register(route));
127
- } catch (error) {
128
- for (const dispose of disposers) try {
129
- dispose();
130
- } catch {}
131
- throw error;
132
- }
208
+ const disposers = routes.map((route) => web.register(nodeRoute(route)));
133
209
  return () => {
134
210
  for (const dispose of disposers) try {
135
211
  dispose();
@@ -1,2 +1,2 @@
1
- import { a as methodNotAllowed, i as json, n as MAX_REQUEST_BODY_BYTES, o as readJsonObject, r as hostSurface, s as registerHostRoutes, t as HOST_ROUTES } from "./http-routes-D1Ty6nnh.js";
1
+ import { a as methodNotAllowed, i as json, n as MAX_REQUEST_BODY_BYTES, o as readJsonObject, r as hostSurface, s as registerHostRoutes, t as HOST_ROUTES } from "./http-routes-_anZVlPf.js";
2
2
  export { HOST_ROUTES, MAX_REQUEST_BODY_BYTES, hostSurface, json, methodNotAllowed, readJsonObject, registerHostRoutes };
package/lib/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _ as scopedPackageName, c as MAINTAINER_PRESET_ID, d as RESTRICTED_TOOLS_ROW_ID, f as RESTRICTOR_MODULE, g as scopeOfNearestManifest, p as REVIEWER_PRESET_ID, s as EVOLUTION_PRESET_IDS, u as RESTRICTED_PRESET_DISPLAY } from "./ensure-C2tUoF5U.js";
2
- import { a as methodNotAllowed, c as asRecord, i as json, l as isRecord, n as MAX_REQUEST_BODY_BYTES, o as readJsonObject, r as hostSurface, s as registerHostRoutes, t as HOST_ROUTES } from "./http-routes-D1Ty6nnh.js";
2
+ import { a as methodNotAllowed, c as asRecord, i as json, l as isRecord, n as MAX_REQUEST_BODY_BYTES, o as readJsonObject, r as hostSurface, s as registerHostRoutes, t as HOST_ROUTES } from "./http-routes-_anZVlPf.js";
3
3
  import { w as allowRowCollisions } from "./composition-3QFfEe56.js";
4
4
  import { n as errorText, t as EVOLUTION_ERRORS } from "./errors-DRZ9A187.js";
5
5
  import { createSubagentChannel, probeChannelState, subagentChannelState } from "./subagent/index.js";
@@ -9117,11 +9117,6 @@ const PLATFORM_SERVICE_PROBES = Object.freeze([
9117
9117
  feature: "the params view inherited-vs-override column",
9118
9118
  side: "host"
9119
9119
  },
9120
- {
9121
- service: "configForms",
9122
- feature: "the settings card seat (its section renders read-only without it)",
9123
- side: "client"
9124
- },
9125
9120
  {
9126
9121
  service: "evolutionApproval",
9127
9122
  feature: "pending writes: list, approve and reject from the command surface",
@@ -18017,6 +18012,33 @@ const PARAM_EXPOSURE = Object.freeze([
18017
18012
  why: "internal"
18018
18013
  }
18019
18014
  ]);
18015
+ /**
18016
+ * Register one family row's user layer on the platform settings service.
18017
+ *
18018
+ * The 0.2.x platform no longer turns a plugin Config into a settings section implicitly:
18019
+ * every row that exposes a card must call `settings.register` with its Loader entry id.
18020
+ * The owner argument is the row id, which is also the namespace the generated card binds.
18021
+ * @param ctx - host plugin context.
18022
+ * @param owner - Loader entry id / settings namespace.
18023
+ * @param schema - the row's Config schema (schemastery).
18024
+ */
18025
+ function registerOwnerSettings(ctx, owner, schema) {
18026
+ const register = (scope) => {
18027
+ const settings = scope.settings;
18028
+ if (typeof settings?.register !== "function") return;
18029
+ try {
18030
+ settings.register(owner, schema);
18031
+ } catch (error) {
18032
+ ctx.logger?.warn?.(`evolution settings: register(${owner}) failed: ${error instanceof Error ? error.message : String(error)}`);
18033
+ }
18034
+ };
18035
+ const direct = ctx.get?.("settings");
18036
+ if (direct !== void 0) {
18037
+ register({ settings: direct });
18038
+ return;
18039
+ }
18040
+ ctx.inject?.(["settings"], register);
18041
+ }
18020
18042
  /** The settings namespace each OWNER PACKAGE registers (design §7.2).
18021
18043
  *
18022
18044
  * Keyed by owner rather than by group because a namespace has exactly one
@@ -18609,4 +18631,4 @@ function isIgnorableEvent(event) {
18609
18631
  return classifySessionEvent(event) !== "model";
18610
18632
  }
18611
18633
  //#endregion
18612
- export { AUTHORING_DESCRIPTION_BAR, AUTHORING_SPLIT_LINE_CHARS, BASELINE_ACTION, CITATION_SUPPORT_DIRS, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CONTENT_SPLIT_HINT, COST_ASCII_TOKEN_HIGH, COST_ASCII_TOKEN_LOW, COST_CJK_TOKEN_HIGH, COST_CJK_TOKEN_LOW, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEDUP_MAX_PAIR_COMPARISONS, DEDUP_SIMILARITY_THRESHOLD, DEFAULT_ADMISSION, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_CITATION_REF_BUDGET, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_BOOT_GRACE_SECONDS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_CURATOR_MODEL, DEFAULT_CURATOR_REVIEW_MAX_TOKENS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_PROBE_TIMEOUT_MS, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_REVIEW_CONTEXT_MESSAGES, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_MESSAGE_CHARS, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_REVIEW_TIMEOUT_MS, DEFAULT_RUN_RECORDS, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_SKILL_VERSION_KEEP, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_SUPPORT_FILE_CHAR_POLICY, DEFAULT_SUPPORT_READ_TOOL_NAMES, DEFAULT_THREAT_MAX_SCAN_CHARS, DEFAULT_USER_CHAR_LIMIT, DEFAULT_WRITE_CONFIRM_MODE, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, DIAGNOSTICS_FACT_KEYS, DIAGNOSTICS_RUNTIME_KEYS, DIAGNOSTICS_VIEW_SCHEMA_VERSION, DISPATCH_EVENT_TYPES, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, EVENT_ARCHIVE_PREFIX, EVENT_LOG_RETAIN_ARCHIVES, EVENT_LOG_ROTATE_AT, EVENT_LOG_VERSION, EVOLUTION_ERRORS, EVOLUTION_PRESET_IDS, EVOLUTION_WRITE_TOOLS, EXTRACT_PROMPT_HASH, EXTRACT_PROMPT_V1, EXTRACT_PROMPT_VERSION, EvolutionGateSet, FAMILY_SESSION_TOOL_NAMES, FORBIDDEN_CONTROL_KEYS, FUZZY_MAX_PATTERN_CHARS, FUZZY_MAX_WORK, HEALTH_STAMP_RE, HISTORY_DIR, HISTORY_INDEX_VERSION, HOOK_LINE_RE, HOST_ROUTES, INSTANCE_KEYS, KEEP_LINE_RE, LONG_RUNS, LOW_QUALITY_THRESHOLD, MAINTAINER_PRESET_ID, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_REQUEST_BODY_BYTES, MAX_RESTRUCTURE_MOVES, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MAX_SUPPORT_READ_PATHS, MAX_TIMER_DELAY_MS, MEMORY_GUIDANCE_SECTION_ORDER, MEMORY_REVIEW_PROMPT, MIN_STAMP_BODY_CHARS, MODEL_SESSION_EVENT_TYPES as MODEL_SESSION_EVENTS, MODEL_SESSION_EVENT_TYPES, MUTATIONS_FILE_VERSION, MemoryStore, MutationUnit, NAMESPACE_MIGRATIONS, NATIVE_CALL_EVENT, NATIVE_RESULT_EVENT, PARAM_ALIASES, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, PATTERN_OVERLAP, PLATFORM_CATALOG_DESCRIPTION_DEFAULT, PLATFORM_ESTIMATE_CHARS_PER_TOKEN, PLATFORM_LINE, PLATFORM_SERVICE_PROBES, POLICY_STAGE_DEFAULTS, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, PTC_DISPATCH_EVENT, PTC_DISPATCH_START_EVENT, QUALITY_WEIGHTS, READ_REQUIRED_ACTIONS, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, RESTRUCTURE_TARGET_RE, RETENTION_FEEDBACK_KEEP_RATIO, RETENTION_FEEDBACK_MIN_CHARS, REVIEWER_PRESET_ID, RULES, RUNS_SCHEMA_VERSION, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, STORE_LEDGER, SUMMARY_DUPLICATE_HINT_THRESHOLD, SUPPORT_DIRS, SUPPORT_SPRAWL_FILES, SUPPRESSED_FILE_VERSION, SkillLibrary, SkillModel, TEXT_DIFF_MAX_CHARS, TEXT_DIFF_MAX_LINES, THREAT_EXEMPTION_HINT, TOKEN_ASCII_WEIGHT, TOKEN_CJK_WEIGHT, ToolDispatchNormalizer, ToolDispatchPayloadError, UNIT_JOURNAL_PHASES, UNIT_JOURNAL_SCHEMA_VERSION, UNIT_STORAGE_SCHEMA_VERSION, UNTRUSTED_LINE_BREAK, UNTRUSTED_LINE_MARK, UPSTREAM_LIMIT_CHARS_PER_TOKEN, UnitTransactions, VERSION_SUMMARY_MAX_CHARS, WriteKernel, absentHostServices, acquireTreeWriteLock, admissionVerdict, advanceReview, affinity, ageCopyKey, allowRowCollisions, anchorVerdict, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, assertSkillsRootAliasRetired, assertUnitJournalTransition, assessStructureHealth, atomicWriteFiles, authoringFeedback, authorityFrom, backupsReachability, blobPath, bodyCost, buildCuratorRunReport, buildExtractPlanFromLibrary, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, candidateSkills, canonicalWriteId, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, contentRetentionFeedback, countDispatches, countReferenceFiles, createGateSet, createSubagentChannel, daysSinceIso, declaredReportStamp, describeReferenceRewrite, diffFindings, dispatchKeyOf, dispatchPathOf, dispatchStepOf, displayBodyOf, duplicateHeadings, elapsedSince, emptyRecord, ensureSkillFrontmatter, entryTarget, errorText, evaluateThreat, eventsFile, evidenceKindIndex, evolutionActivityProjection, evolutionEventPayloadIssue, evolutionEvidenceProjection, evolutionHome, evolutionIoAdapter, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionRoot, evolutionSignalsProjection, executeUnitUndo, externalRefs, fileMutationLock, filterUnreadSkillOps, findDriftSignal, findOwnerCandidate, foldCuratorFields, foldToolDispatches, foldTurnEvent, foldTurnEvents, foldUntrustedLines, frontmatterBlock, frontmatterCatalogInvalid, fuzzyPatch, getRecord, h2Sections, historyIndexFile, historyReachability, historyRoot, hostSurface, identity, idleDays, initialTurnFold, installEvolutionProjections, instanceClaimKey, instanceClaimedWriteSites, instanceHolder, isAbsent, isBookkeepingFrame, isCommittedWarning, isDeprecatedParamId, isFileShapedPath, isIgnorableEvent, isLandmark, isMissingPath, isPresent, isProcessAlive, isProgramToolName, isProjectableSession, isRecord, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, isUnreadWrite, json, landmarkVerdict, latestActivityAt, latestVersionAt, lifecycleCandidate, lintBody, lintSkill, listEventArchives, liveBool, liveEnum, liveNumber, liveString, loadMutations, loadSuppressedNames, loadUsage, loadVersionContent, loadVersions, makeSerialQueue, mapProbe, markAgentCreated, markReviewChannel, markerEntryName, memoryRoot, methodNotAllowed, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nearDuplicateSummaries, newRunRegistry, newSkillLibrary, nextHistoryIndex, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, normalizeVersionSummary, observeEvent, orderVersions, overlongLines, ownerCandidatesFromSummaries, ownerDecisionText, paramNamespace, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, parseHistoryIndex, partitionVersions, payloadText, persistedWriteSite, persistedWriteSites, pickWithPolicy, planExtract, planNamespaceMigration, planReferenceRewrite, planRehoming, planUnitUndoAcross, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectExtractBodies, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, pruneTreeChangeUnits, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readHistoryIndex, readJsonObject, readNumberParam, readParam, readProposalReports, readTreeLock, readUnitEvidence, readUnitIndex, readUnitJournal, readUnitReceipt, readUnitSnapshot, readingStats, recordMutation, recordVersions, redactSecrets, referencedBlobs, registerHostRoutes, relatedSkillNames, releaseInstance, renameWithRetry, renderCuratorReportMarkdown, renderLongRunTable, reportTime, reportsReachability, reportsSweepLockTarget, resolveCitations, resolveExecOrigins, resolveOrigins, resolveParamId, resolveRootConfig, resolveSkillsRoot, resolveUnitMembers, resolveUnitMembersFromIndexes, restructureCandidates, retainEventArchives, retirementReport, reviewPrompt, revisionAnchor, revisionAnchorOf, revisionFingerprint, revisionSupportDigest, runWriteGates, runsFile, saveSuppressedNames, saveUsage, scanBodyHooks, scanContentThreats, scanMemoryThreats, scanThreats, scopeOfNearestManifest, scopedPackageName, scopedProbeReport, selectSections, sessionAudited, sessionEvidenceIndex, sessionLastEventTime, sessionReadNames, sessionReadSkillNames, sessionReadSupportFiles, sessionSeesFamilyTools, sessionTurnSignals, skillLibraryUnitBackend, skillReadNameOf, skillRowCells, skillStateKey, skillWriteGateContext, skillsRoot, staleRouteStubs, subagentChannelState, supportFileReadFromPath, supportFileReadOf, supportRefs, suppressedFile, sweepReports, sweepReviewChannelSessions, textDiffFacts, tokenLineFor, transactIo, transactTaskGuard, treeLockFile, trimPatternBoundaries, unhookedSupportPointers, unitEvidenceDigest, unitEvidencePath, unitIndexPath, unitJournalPath, unitJournalPhaseRank, unitJournalPort, unitMembersAreComplete, unitReceiptPath, unitSnapshotPath, unitSnapshotPort, unitSnapshotsDir, unitStorageKey, unwrapLive, updateSuppressedNames, upsertUnitIndex, usageFile, usageObserved, userSetKeys, validateFrontmatter, validateMutationRequest, validateRestructureTarget, validateSupportPath, valueOr, verifyPromptBundle, versionActionKind, versionRowCells, versionSummaryPrompt, versionTarget, vocabulary, withTreeWrite, withTreeWriteLock, writeDurableTmp, writePathSymbols, writeProposalReport, writeUnitEvidence, writeUnitJournal, writeUnitReceipt, writeUnitSnapshot, yamlPlainScalarNeedsQuotes };
18634
+ export { AUTHORING_DESCRIPTION_BAR, AUTHORING_SPLIT_LINE_CHARS, BASELINE_ACTION, CITATION_SUPPORT_DIRS, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CONTENT_SPLIT_HINT, COST_ASCII_TOKEN_HIGH, COST_ASCII_TOKEN_LOW, COST_CJK_TOKEN_HIGH, COST_CJK_TOKEN_LOW, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEDUP_MAX_PAIR_COMPARISONS, DEDUP_SIMILARITY_THRESHOLD, DEFAULT_ADMISSION, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_ARCHIVE_RETENTION_POLICY, DEFAULT_CITATION_POLICY, DEFAULT_CITATION_REF_BUDGET, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_BOOT_GRACE_SECONDS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_CURATOR_MODEL, DEFAULT_CURATOR_REVIEW_MAX_TOKENS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_PROBE_TIMEOUT_MS, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_REVIEW_CONTEXT_MESSAGES, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_MESSAGE_CHARS, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_REVIEW_TIMEOUT_MS, DEFAULT_RUN_RECORDS, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_SKILL_VERSION_KEEP, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_SUPPORT_FILE_CHAR_POLICY, DEFAULT_SUPPORT_READ_TOOL_NAMES, DEFAULT_THREAT_MAX_SCAN_CHARS, DEFAULT_USER_CHAR_LIMIT, DEFAULT_WRITE_CONFIRM_MODE, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, DIAGNOSTICS_FACT_KEYS, DIAGNOSTICS_RUNTIME_KEYS, DIAGNOSTICS_VIEW_SCHEMA_VERSION, DISPATCH_EVENT_TYPES, DRIFT_MAX_LINE_CHARS, DRIFT_SIGNALS_VERSION, DRIFT_SIGNAL_NOUNS, DSH_AUTHORING_STANDARDS, ENTRY_DELIMITER, EVENT_ARCHIVE_PREFIX, EVENT_LOG_RETAIN_ARCHIVES, EVENT_LOG_ROTATE_AT, EVENT_LOG_VERSION, EVOLUTION_ERRORS, EVOLUTION_PRESET_IDS, EVOLUTION_WRITE_TOOLS, EXTRACT_PROMPT_HASH, EXTRACT_PROMPT_V1, EXTRACT_PROMPT_VERSION, EvolutionGateSet, FAMILY_SESSION_TOOL_NAMES, FORBIDDEN_CONTROL_KEYS, FUZZY_MAX_PATTERN_CHARS, FUZZY_MAX_WORK, HEALTH_STAMP_RE, HISTORY_DIR, HISTORY_INDEX_VERSION, HOOK_LINE_RE, HOST_ROUTES, INSTANCE_KEYS, KEEP_LINE_RE, LONG_RUNS, LOW_QUALITY_THRESHOLD, MAINTAINER_PRESET_ID, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_REQUEST_BODY_BYTES, MAX_RESTRUCTURE_MOVES, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MAX_SUPPORT_READ_PATHS, MAX_TIMER_DELAY_MS, MEMORY_GUIDANCE_SECTION_ORDER, MEMORY_REVIEW_PROMPT, MIN_STAMP_BODY_CHARS, MODEL_SESSION_EVENT_TYPES as MODEL_SESSION_EVENTS, MODEL_SESSION_EVENT_TYPES, MUTATIONS_FILE_VERSION, MemoryStore, MutationUnit, NAMESPACE_MIGRATIONS, NATIVE_CALL_EVENT, NATIVE_RESULT_EVENT, PARAM_ALIASES, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, PATTERN_OVERLAP, PLATFORM_CATALOG_DESCRIPTION_DEFAULT, PLATFORM_ESTIMATE_CHARS_PER_TOKEN, PLATFORM_LINE, PLATFORM_SERVICE_PROBES, POLICY_STAGE_DEFAULTS, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, PTC_DISPATCH_EVENT, PTC_DISPATCH_START_EVENT, QUALITY_WEIGHTS, READ_REQUIRED_ACTIONS, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, RESTRUCTURE_TARGET_RE, RETENTION_FEEDBACK_KEEP_RATIO, RETENTION_FEEDBACK_MIN_CHARS, REVIEWER_PRESET_ID, RULES, RUNS_SCHEMA_VERSION, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, STORE_LEDGER, SUMMARY_DUPLICATE_HINT_THRESHOLD, SUPPORT_DIRS, SUPPORT_SPRAWL_FILES, SUPPRESSED_FILE_VERSION, SkillLibrary, SkillModel, TEXT_DIFF_MAX_CHARS, TEXT_DIFF_MAX_LINES, THREAT_EXEMPTION_HINT, TOKEN_ASCII_WEIGHT, TOKEN_CJK_WEIGHT, ToolDispatchNormalizer, ToolDispatchPayloadError, UNIT_JOURNAL_PHASES, UNIT_JOURNAL_SCHEMA_VERSION, UNIT_STORAGE_SCHEMA_VERSION, UNTRUSTED_LINE_BREAK, UNTRUSTED_LINE_MARK, UPSTREAM_LIMIT_CHARS_PER_TOKEN, UnitTransactions, VERSION_SUMMARY_MAX_CHARS, WriteKernel, absentHostServices, acquireTreeWriteLock, admissionVerdict, advanceReview, affinity, ageCopyKey, allowRowCollisions, anchorVerdict, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, assertSkillsRootAliasRetired, assertUnitJournalTransition, assessStructureHealth, atomicWriteFiles, authoringFeedback, authorityFrom, backupsReachability, blobPath, bodyCost, buildCuratorRunReport, buildExtractPlanFromLibrary, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, candidateSkills, canonicalWriteId, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, contentRetentionFeedback, countDispatches, countReferenceFiles, createGateSet, createSubagentChannel, daysSinceIso, declaredReportStamp, describeReferenceRewrite, diffFindings, dispatchKeyOf, dispatchPathOf, dispatchStepOf, displayBodyOf, duplicateHeadings, elapsedSince, emptyRecord, ensureSkillFrontmatter, entryTarget, errorText, evaluateThreat, eventsFile, evidenceKindIndex, evolutionActivityProjection, evolutionEventPayloadIssue, evolutionEvidenceProjection, evolutionHome, evolutionIoAdapter, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionRoot, evolutionSignalsProjection, executeUnitUndo, externalRefs, fileMutationLock, filterUnreadSkillOps, findDriftSignal, findOwnerCandidate, foldCuratorFields, foldToolDispatches, foldTurnEvent, foldTurnEvents, foldUntrustedLines, frontmatterBlock, frontmatterCatalogInvalid, fuzzyPatch, getRecord, h2Sections, historyIndexFile, historyReachability, historyRoot, hostSurface, identity, idleDays, initialTurnFold, installEvolutionProjections, instanceClaimKey, instanceClaimedWriteSites, instanceHolder, isAbsent, isBookkeepingFrame, isCommittedWarning, isDeprecatedParamId, isFileShapedPath, isIgnorableEvent, isLandmark, isMissingPath, isPresent, isProcessAlive, isProgramToolName, isProjectableSession, isRecord, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, isUnreadWrite, json, landmarkVerdict, latestActivityAt, latestVersionAt, lifecycleCandidate, lintBody, lintSkill, listEventArchives, liveBool, liveEnum, liveNumber, liveString, loadMutations, loadSuppressedNames, loadUsage, loadVersionContent, loadVersions, makeSerialQueue, mapProbe, markAgentCreated, markReviewChannel, markerEntryName, memoryRoot, methodNotAllowed, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nearDuplicateSummaries, newRunRegistry, newSkillLibrary, nextHistoryIndex, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, normalizeVersionSummary, observeEvent, orderVersions, overlongLines, ownerCandidatesFromSummaries, ownerDecisionText, paramNamespace, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, parseHistoryIndex, partitionVersions, payloadText, persistedWriteSite, persistedWriteSites, pickWithPolicy, planExtract, planNamespaceMigration, planReferenceRewrite, planRehoming, planUnitUndoAcross, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectExtractBodies, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, pruneTreeChangeUnits, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readHistoryIndex, readJsonObject, readNumberParam, readParam, readProposalReports, readTreeLock, readUnitEvidence, readUnitIndex, readUnitJournal, readUnitReceipt, readUnitSnapshot, readingStats, recordMutation, recordVersions, redactSecrets, referencedBlobs, registerHostRoutes, registerOwnerSettings, relatedSkillNames, releaseInstance, renameWithRetry, renderCuratorReportMarkdown, renderLongRunTable, reportTime, reportsReachability, reportsSweepLockTarget, resolveCitations, resolveExecOrigins, resolveOrigins, resolveParamId, resolveRootConfig, resolveSkillsRoot, resolveUnitMembers, resolveUnitMembersFromIndexes, restructureCandidates, retainEventArchives, retirementReport, reviewPrompt, revisionAnchor, revisionAnchorOf, revisionFingerprint, revisionSupportDigest, runWriteGates, runsFile, saveSuppressedNames, saveUsage, scanBodyHooks, scanContentThreats, scanMemoryThreats, scanThreats, scopeOfNearestManifest, scopedPackageName, scopedProbeReport, selectSections, sessionAudited, sessionEvidenceIndex, sessionLastEventTime, sessionReadNames, sessionReadSkillNames, sessionReadSupportFiles, sessionSeesFamilyTools, sessionTurnSignals, skillLibraryUnitBackend, skillReadNameOf, skillRowCells, skillStateKey, skillWriteGateContext, skillsRoot, staleRouteStubs, subagentChannelState, supportFileReadFromPath, supportFileReadOf, supportRefs, suppressedFile, sweepReports, sweepReviewChannelSessions, textDiffFacts, tokenLineFor, transactIo, transactTaskGuard, treeLockFile, trimPatternBoundaries, unhookedSupportPointers, unitEvidenceDigest, unitEvidencePath, unitIndexPath, unitJournalPath, unitJournalPhaseRank, unitJournalPort, unitMembersAreComplete, unitReceiptPath, unitSnapshotPath, unitSnapshotPort, unitSnapshotsDir, unitStorageKey, unwrapLive, updateSuppressedNames, upsertUnitIndex, usageFile, usageObserved, userSetKeys, validateFrontmatter, validateMutationRequest, validateRestructureTarget, validateSupportPath, valueOr, verifyPromptBundle, versionActionKind, versionRowCells, versionSummaryPrompt, versionTarget, vocabulary, withTreeWrite, withTreeWriteLock, writeDurableTmp, writePathSymbols, writeProposalReport, writeUnitEvidence, writeUnitJournal, writeUnitReceipt, writeUnitSnapshot, yamlPlainScalarNeedsQuotes };
@@ -99,6 +99,7 @@ declare module '@deepseek-ai/cordis' {
99
99
  * A reviewed plan finished its write leg, with the counts that describe what landed. An
100
100
  * ANNOUNCEMENT: the family's own ledger of plan outcomes (A98 / O-1).
101
101
  * @param event - the outcome counts, the first failure message, and the policy fingerprint.
102
+ * @mode emit
102
103
  */
103
104
  'evolution/plan-applied'(event: EvolutionPlanAppliedEvent): void;
104
105
  /**
@@ -41,6 +41,7 @@ export declare const HOST_ROUTES: {
41
41
  readonly preview: "/api/dsh-evolution/approval/preview";
42
42
  readonly approve: "/api/dsh-evolution/approval/approve";
43
43
  readonly reject: "/api/dsh-evolution/approval/reject";
44
+ readonly release: "/api/dsh-evolution/approval/release";
44
45
  };
45
46
  readonly skillHistory: {
46
47
  readonly skills: "/api/dsh-evolution/skill-history/skills";
@@ -64,6 +65,10 @@ export declare const HOST_ROUTES: {
64
65
  readonly diagnostics: {
65
66
  readonly view: "/api/dsh-evolution/diagnostics";
66
67
  };
68
+ readonly settings: {
69
+ readonly describe: "/api/dsh-evolution/settings/describe";
70
+ readonly mutate: "/api/dsh-evolution/settings/mutate";
71
+ };
67
72
  };
68
73
  export type HostSurface = {
69
74
  readonly available: true;
@@ -74,15 +79,6 @@ export type HostSurface = {
74
79
  readonly reason: 'connection-missing' | 'service-absent';
75
80
  };
76
81
  export declare function hostSurface(ctx: Context): HostSurface;
77
- /**
78
- * Register the family host surface on the platform's exact-route carrier.
79
- *
80
- * The platform owns admission (Host/Origin hygiene + browserAuth + exact-route owner peer) and the
81
- * disposer is bound to the CALLING fiber, not the connection service: the connection service can
82
- * outlive a reloaded family fiber, so the family must release its own registrations on dispose.
83
- * Routes carry the audit snapshot taken at registration time (deployment-level facts only — the
84
- * exact-route handler receives a Request, not the peer identity).
85
- */
86
82
  export declare function registerHostRoutes(owner: Context, build: (audit: DecisionAudit) => readonly ConnectionFetchRouteLike[]): void;
87
83
  export declare function json(status: number, body: unknown): Response;
88
84
  export declare function methodNotAllowed(allowed: readonly HttpMethod[]): Response;
@@ -38,6 +38,7 @@ export const HOST_ROUTES = {
38
38
  preview: '/api/dsh-evolution/approval/preview',
39
39
  approve: '/api/dsh-evolution/approval/approve',
40
40
  reject: '/api/dsh-evolution/approval/reject',
41
+ release: '/api/dsh-evolution/approval/release',
41
42
  },
42
43
  skillHistory: {
43
44
  skills: '/api/dsh-evolution/skill-history/skills',
@@ -61,6 +62,10 @@ export const HOST_ROUTES = {
61
62
  diagnostics: {
62
63
  view: '/api/dsh-evolution/diagnostics',
63
64
  },
65
+ settings: {
66
+ describe: '/api/dsh-evolution/settings/describe',
67
+ mutate: '/api/dsh-evolution/settings/mutate',
68
+ },
64
69
  };
65
70
  export function hostSurface(ctx) {
66
71
  const connection = ctx.get('connection');
@@ -69,29 +74,88 @@ export function hostSurface(ctx) {
69
74
  const allows = connection.allowsRemoteAuthorities === true;
70
75
  return { available: true, allowsRemoteAuthorities: allows };
71
76
  }
72
- /**
73
- * Register the family host surface on the platform's exact-route carrier.
74
- *
75
- * The platform owns admission (Host/Origin hygiene + browserAuth + exact-route owner peer) and the
76
- * disposer is bound to the CALLING fiber, not the connection service: the connection service can
77
- * outlive a reloaded family fiber, so the family must release its own registrations on dispose.
78
- * Routes carry the audit snapshot taken at registration time (deployment-level facts only — the
79
- * exact-route handler receives a Request, not the peer identity).
80
- */
77
+ function isLoopback(address) {
78
+ const value = address ?? '';
79
+ return value === '127.0.0.1' || value === '::1' || value === '::ffff:127.0.0.1';
80
+ }
81
+ function sameOrigin(origin, host) {
82
+ if (origin === undefined)
83
+ return true;
84
+ try {
85
+ const parsed = new URL(origin);
86
+ return isLoopback(parsed.hostname) && host !== undefined && parsed.host === host;
87
+ }
88
+ catch {
89
+ return false;
90
+ }
91
+ }
92
+ function nodeRoute(route) {
93
+ return {
94
+ kind: 'exact',
95
+ path: route.path,
96
+ handler: async (req, res) => {
97
+ if (!isLoopback(req.socket.remoteAddress)) {
98
+ res.statusCode = 403;
99
+ res.end('forbidden');
100
+ return;
101
+ }
102
+ if (!sameOrigin(req.headers.origin, req.headers.host)) {
103
+ res.statusCode = 403;
104
+ res.end('forbidden');
105
+ return;
106
+ }
107
+ const fetchSite = req.headers['sec-fetch-site'];
108
+ if (fetchSite !== undefined && fetchSite !== 'same-origin' && fetchSite !== 'none') {
109
+ res.statusCode = 403;
110
+ res.end('forbidden');
111
+ return;
112
+ }
113
+ const method = req.method ?? 'GET';
114
+ if (method !== 'GET' && method !== 'HEAD' && !(req.headers['content-type'] ?? '').toLowerCase().startsWith('application/json')) {
115
+ res.statusCode = 415;
116
+ res.end('json required');
117
+ return;
118
+ }
119
+ try {
120
+ const chunks = [];
121
+ for await (const chunk of req)
122
+ chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
123
+ const headers = new Headers();
124
+ for (const [key, value] of Object.entries(req.headers)) {
125
+ if (value === undefined)
126
+ continue;
127
+ headers.set(key, Array.isArray(value) ? value.join(',') : value);
128
+ }
129
+ const request = new Request(new URL(req.url ?? '/', 'http://127.0.0.1'), {
130
+ method,
131
+ headers,
132
+ ...(method === 'GET' || method === 'HEAD' || chunks.length === 0 ? {} : { body: Buffer.concat(chunks) }),
133
+ });
134
+ const response = await route.fetch(request);
135
+ res.statusCode = response.status;
136
+ response.headers.forEach((value, key) => { try {
137
+ res.setHeader(key, value);
138
+ }
139
+ catch { /* ignore forbidden node header */ } });
140
+ res.end(Buffer.from(await response.arrayBuffer()));
141
+ }
142
+ catch (error) {
143
+ res.statusCode = 500;
144
+ res.end(error instanceof Error ? error.message : String(error));
145
+ }
146
+ },
147
+ };
148
+ }
81
149
  export function registerHostRoutes(owner, build) {
82
150
  const injecting = owner;
83
151
  if (typeof injecting.inject !== 'function')
84
152
  throw new Error('host routes require a context that owns inject()');
85
153
  injecting.inject(['connection'], (scope) => {
86
154
  const connection = scope.connection;
87
- if (connection === undefined || connection.fetch === undefined || typeof connection.fetch.register !== 'function') {
88
- throw new Error('connection service is mounted without fetch.register()');
89
- }
90
- const register = connection.fetch.register.bind(connection.fetch);
91
155
  const audit = {
92
156
  channel: 'connection.fetch',
93
157
  principal: 'owner',
94
- deploymentAllowsRemote: connection.allowsRemoteAuthorities === true,
158
+ deploymentAllowsRemote: connection?.allowsRemoteAuthorities === true,
95
159
  };
96
160
  const routes = build(audit);
97
161
  for (const route of routes) {
@@ -102,29 +166,50 @@ export function registerHostRoutes(owner, build) {
102
166
  const effect = scope.effect;
103
167
  if (typeof effect !== 'function')
104
168
  throw new Error('connection scope has no effect() to own the registration');
105
- effect.call(scope, () => {
106
- const disposers = [];
107
- try {
108
- for (const route of routes)
109
- disposers.push(register(route));
110
- }
111
- catch (error) {
112
- for (const dispose of disposers) {
113
- try {
114
- void dispose();
169
+ if (connection?.fetch !== undefined && typeof connection.fetch.register === 'function') {
170
+ const register = connection.fetch.register.bind(connection.fetch);
171
+ effect.call(scope, () => {
172
+ const disposers = [];
173
+ try {
174
+ for (const route of routes)
175
+ disposers.push(register(route));
176
+ }
177
+ catch (error) {
178
+ for (const dispose of disposers) {
179
+ try {
180
+ void dispose();
181
+ }
182
+ catch { /* best-effort rollback */ }
115
183
  }
116
- catch { /* best-effort rollback */ }
184
+ throw error;
117
185
  }
118
- throw error;
119
- }
120
- return () => {
121
- for (const dispose of disposers) {
122
- try {
123
- void dispose();
186
+ return () => {
187
+ for (const dispose of disposers) {
188
+ try {
189
+ void dispose();
190
+ }
191
+ catch { /* a failed disposer must not mask the others */ }
124
192
  }
125
- catch { /* a failed disposer must not mask the others */ }
193
+ };
194
+ }, 'evolution-host-routes');
195
+ return;
196
+ }
197
+ // Platform 0.2.x moved Host data-plane registration to connection.rpc. The family
198
+ // HTTP contract stays exact paths; a loopback-only webserver bridge preserves it
199
+ // without exposing these routes to remote authorities.
200
+ const web = (scope.get?.('webServer')
201
+ ?? owner.get?.('webServer'));
202
+ if (web === undefined || typeof web.register !== 'function') {
203
+ throw new Error('connection service has no fetch.register(), and webServer is not mounted for the loopback host-route bridge');
204
+ }
205
+ effect.call(scope, () => {
206
+ const disposers = routes.map(route => web.register(nodeRoute(route)));
207
+ return () => { for (const dispose of disposers) {
208
+ try {
209
+ dispose();
126
210
  }
127
- };
211
+ catch { /* best-effort */ }
212
+ } };
128
213
  }, 'evolution-host-routes');
129
214
  });
130
215
  }
@@ -138,6 +138,19 @@ export interface ParamExposure {
138
138
  * (live); E2 = resource or identity knob that stays with the deployment.
139
139
  */
140
140
  export declare const PARAM_EXPOSURE: readonly ParamExposure[];
141
+ /**
142
+ * Register one family row's user layer on the platform settings service.
143
+ *
144
+ * The 0.2.x platform no longer turns a plugin Config into a settings section implicitly:
145
+ * every row that exposes a card must call `settings.register` with its Loader entry id.
146
+ * The owner argument is the row id, which is also the namespace the generated card binds.
147
+ * @param ctx - host plugin context.
148
+ * @param owner - Loader entry id / settings namespace.
149
+ * @param schema - the row's Config schema (schemastery).
150
+ */
151
+ export declare function registerOwnerSettings(ctx: {
152
+ inject?: (names: readonly string[], callback: (scope: unknown) => void) => unknown;
153
+ }, owner: string, schema: unknown): void;
141
154
  /** The settings namespace each OWNER PACKAGE registers (design §7.2).
142
155
  *
143
156
  * Keyed by owner rather than by group because a namespace has exactly one
@@ -207,6 +207,36 @@ export const PARAM_EXPOSURE = Object.freeze([
207
207
  { id: 'mergeRunTimeoutMinutes', group: 'merge', tier: 'E3', authority: 'cordis', owner: 'evolution-merge', applies: 'live', docAnchor: 'PARAMETERS.md#merge', summary: 'Wall-clock budget of one merge run; 0 means no limit.', label: '单次运行上限', hint: '一次合并运行最多持续多少分钟;0 表示不设上限。', control: 'number', unit: '分钟', values: '', card: 'evolution-merge' },
208
208
  { id: 'mergePairTimeoutMinutes', group: 'merge', tier: 'E2', authority: 'cordis', owner: 'evolution-merge', applies: 'none', docAnchor: 'PARAMETERS.md#merge', summary: 'Wall-clock budget of one pair round (a stuck child guard).', why: 'internal' },
209
209
  ]);
210
+ /**
211
+ * Register one family row's user layer on the platform settings service.
212
+ *
213
+ * The 0.2.x platform no longer turns a plugin Config into a settings section implicitly:
214
+ * every row that exposes a card must call `settings.register` with its Loader entry id.
215
+ * The owner argument is the row id, which is also the namespace the generated card binds.
216
+ * @param ctx - host plugin context.
217
+ * @param owner - Loader entry id / settings namespace.
218
+ * @param schema - the row's Config schema (schemastery).
219
+ */
220
+ export function registerOwnerSettings(ctx, owner, schema) {
221
+ const register = (scope) => {
222
+ const settings = scope.settings;
223
+ if (typeof settings?.register !== 'function')
224
+ return;
225
+ try {
226
+ settings.register(owner, schema);
227
+ }
228
+ catch (error) {
229
+ const logger = ctx.logger;
230
+ logger?.warn?.(`evolution settings: register(${owner}) failed: ${error instanceof Error ? error.message : String(error)}`);
231
+ }
232
+ };
233
+ const direct = ctx.get?.('settings');
234
+ if (direct !== undefined) {
235
+ register({ settings: direct });
236
+ return;
237
+ }
238
+ ctx.inject?.(['settings'], register);
239
+ }
210
240
  /** The settings namespace each OWNER PACKAGE registers (design §7.2).
211
241
  *
212
242
  * Keyed by owner rather than by group because a namespace has exactly one
@@ -19,7 +19,6 @@ export const PLATFORM_SERVICE_PROBES = Object.freeze([
19
19
  { service: 'approval', feature: 'the platform approval policy the approval row shadows', side: 'host' },
20
20
  { service: 'commands', feature: 'the /skill-domain confirmation command surface', side: 'host' },
21
21
  { service: 'configEditor', feature: 'the params view inherited-vs-override column', side: 'host' },
22
- { service: 'configForms', feature: 'the settings card seat (its section renders read-only without it)', side: 'client' },
23
22
  { service: 'evolutionApproval', feature: 'pending writes: list, approve and reject from the command surface', side: 'host' },
24
23
  { service: 'evolutionCurator', feature: '/evolution curator subcommands, skill undo and history', side: 'host' },
25
24
  { service: 'evolutionIo', feature: 'every durable read and write (the IO seam)', side: 'host' },
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-core",
3
3
  "description": "Shared stores, prompts, signals and lifecycle logic for the dsh-evolution plugin family (community build)",
4
- "version": "0.32.4",
4
+ "version": "0.32.6",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -49,7 +49,7 @@
49
49
  "yaml": "^2.4.2",
50
50
  "zod": "^4.4.3",
51
51
  "js-yaml": "^4.1.0",
52
- "@lmzhen/dsh-evolution-contract": "^0.32.4"
52
+ "@lmzhen/dsh-evolution-contract": "^0.32.6"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "@deepseek-ai/cordis": "^4.0.5",