@lmzhen/dsh-evolution-core 0.46.0 → 0.48.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 (101) hide show
  1. package/lib/authority-plugin.js +1 -1
  2. package/lib/composition/index.js +3 -3
  3. package/lib/{composition-Da8NfRI7.js → composition-Cqjbho0t.js} +1 -1
  4. package/lib/{ensure-C5Mo1dbB.js → ensure-CAjLGd9f.js} +1 -2
  5. package/lib/http-routes.js +21 -96
  6. package/lib/index.js +47 -246
  7. package/lib/{io-AmUf4lVY.js → io-GxghO3Ip.js} +30 -70
  8. package/lib/io-node.js +1 -1
  9. package/lib/io-registry.js +1 -35
  10. package/lib/{mutation-authority-DeJ_Wz14.js → mutation-authority-l57R626O.js} +17 -15
  11. package/lib/{mutations-DwvbjRHF.js → mutations-DQXddSJd.js} +1 -1
  12. package/lib/{numeric-DLeLvvGb.js → numeric-D8js3sqC.js} +1 -5
  13. package/lib/platform/index.js +1 -1
  14. package/lib/{platform-CFA12Jam.js → platform-Cc9cNt5j.js} +4 -28
  15. package/lib/policy.js +1 -1
  16. package/lib/runtime/plugin.js +21 -43
  17. package/lib/{session-projection-EB7mUOlJ.js → session-projection-DSXnUNZG.js} +3 -21
  18. package/lib/{skill-health-D1pZGk5V.js → skill-health-DP8z9TPf.js} +4 -25
  19. package/lib/{skill-history-CjypdYqv.js → skill-history-CxrDE3Rb.js} +54 -102
  20. package/lib/skills.js +166 -184
  21. package/lib/subagent/index.js +4 -10
  22. package/lib/types/authority.d.ts +2 -0
  23. package/lib/types/authority.js +5 -0
  24. package/lib/types/composition/preset-ids.d.ts +0 -1
  25. package/lib/types/composition/preset-ids.js +0 -1
  26. package/lib/types/constants.d.ts +0 -4
  27. package/lib/types/constants.js +0 -4
  28. package/lib/types/contract.d.ts +0 -5
  29. package/lib/types/curator.d.ts +0 -1
  30. package/lib/types/curator.js +0 -1
  31. package/lib/types/document-body.d.ts +0 -12
  32. package/lib/types/document-body.js +0 -14
  33. package/lib/types/health-baseline.d.ts +0 -13
  34. package/lib/types/health-baseline.js +0 -20
  35. package/lib/types/home-fence.d.ts +2 -0
  36. package/lib/types/home-fence.js +11 -1
  37. package/lib/types/http-routes.d.ts +9 -4
  38. package/lib/types/http-routes.js +36 -116
  39. package/lib/types/index.d.ts +0 -3
  40. package/lib/types/index.js +0 -3
  41. package/lib/types/io-registry.d.ts +0 -16
  42. package/lib/types/io-registry.js +0 -27
  43. package/lib/types/io.d.ts +6 -54
  44. package/lib/types/io.js +35 -65
  45. package/lib/types/journal-protocol.d.ts +0 -15
  46. package/lib/types/journal-protocol.js +1 -19
  47. package/lib/types/lease-store.d.ts +1 -1
  48. package/lib/types/lease-store.js +4 -15
  49. package/lib/types/live.d.ts +0 -12
  50. package/lib/types/live.js +0 -18
  51. package/lib/types/memory-store.d.ts +0 -1
  52. package/lib/types/memory-store.js +13 -6
  53. package/lib/types/mutation-authority.js +5 -0
  54. package/lib/types/mutation-unit.d.ts +1 -1
  55. package/lib/types/mutation-unit.js +14 -31
  56. package/lib/types/params.d.ts +11 -29
  57. package/lib/types/params.js +13 -60
  58. package/lib/types/platform/llm.d.ts +2 -3
  59. package/lib/types/platform/llm.js +3 -10
  60. package/lib/types/platform/projections.d.ts +4 -5
  61. package/lib/types/platform/projections.js +4 -18
  62. package/lib/types/probe.d.ts +0 -3
  63. package/lib/types/probe.js +0 -7
  64. package/lib/types/run-registry.js +10 -12
  65. package/lib/types/runtime/llm.js +2 -2
  66. package/lib/types/runtime/platform.d.ts +7 -11
  67. package/lib/types/runtime/platform.js +13 -19
  68. package/lib/types/runtime/plugin.d.ts +1 -1
  69. package/lib/types/runtime/plugin.js +6 -4
  70. package/lib/types/runtime/projections.js +1 -2
  71. package/lib/types/session-fold.d.ts +0 -8
  72. package/lib/types/session-fold.js +0 -5
  73. package/lib/types/session-projection.js +2 -2
  74. package/lib/types/skill-discovery.d.ts +0 -2
  75. package/lib/types/skill-discovery.js +1 -2
  76. package/lib/types/skill-health.d.ts +29 -1
  77. package/lib/types/skill-history.d.ts +0 -24
  78. package/lib/types/skill-history.js +0 -41
  79. package/lib/types/skill-lint.d.ts +0 -3
  80. package/lib/types/skill-lint.js +0 -12
  81. package/lib/types/skill-store.d.ts +6 -0
  82. package/lib/types/skill-store.js +130 -142
  83. package/lib/types/subagent/readiness.d.ts +0 -1
  84. package/lib/types/subagent/readiness.js +2 -8
  85. package/lib/types/tool-dispatch.d.ts +1 -16
  86. package/lib/types/tool-dispatch.js +0 -18
  87. package/lib/types/unit-journal.d.ts +1 -1
  88. package/lib/types/unit-journal.js +20 -15
  89. package/lib/types/unit-storage.d.ts +1 -1
  90. package/lib/types/unit-storage.js +5 -16
  91. package/lib/types/write-inventory.d.ts +0 -4
  92. package/lib/types/write-inventory.js +0 -9
  93. package/lib/types/write-kernel.d.ts +3 -4
  94. package/lib/types/write-kernel.js +13 -25
  95. package/lib/write.js +2 -2
  96. package/package.json +1 -1
  97. package/persisted-write-inventory.json +72 -9
  98. package/lib/types/fold-untrusted.d.ts +0 -35
  99. package/lib/types/fold-untrusted.js +0 -44
  100. package/lib/types/unit-recovery.d.ts +0 -5
  101. package/lib/types/unit-recovery.js +0 -12
@@ -1,4 +1,4 @@
1
- import { c as evolutionHome, t as MutationAuthority } from "./mutation-authority-DeJ_Wz14.js";
1
+ import { c as evolutionHome, t as MutationAuthority } from "./mutation-authority-l57R626O.js";
2
2
  //#region lib/types/authority-plugin.js
3
3
  const name = "evolution-authority";
4
4
  const inject = ["evolutionIo"];
@@ -1,3 +1,3 @@
1
- import { a as entryListSchema, c as MAINTAINER_PRESET_ID, d as RESTRICTED_TOOLS_ROW_ID, f as RESTRICTOR_MODULE, h as restrictedPresetId, i as composeRestrictedPresetDefinition, l as RESTRICTED_PRESET_DELIVERY, m as normalizeAllow, n as ensureRestrictedPreset, o as parsePresetRows, p as REVIEWER_PRESET_ID, r as restrictedPresetState, s as EVOLUTION_PRESET_IDS, t as disposeRestrictedPreset, u as RESTRICTED_PRESET_DISPLAY } from "../ensure-C5Mo1dbB.js";
2
- import { C as trimTrailingBlankLines, S as rowSiblingEnd, _ as presetRowId, a as composePresetComposition, b as resolveBasePresetPatch, c as composePresetRow, d as listDirectories, f as loadRowOverrides, g as presetRowBody, h as presetRowBlock, i as basePresetPlugins, l as compositionRowIds, m as presetPatchText, n as AGENT_PRESET_ROOT_HINT, o as composePresetEntry, p as mergePresetRow, r as EMPTY_PATCH_SEED, s as composePresetInsert, t as AGENT_PRESET_PACKAGE, u as denseBlockSequence, v as probeDesktopScope, x as rowBlockSpan, y as removePresetRow } from "../composition-Da8NfRI7.js";
3
- export { AGENT_PRESET_PACKAGE, AGENT_PRESET_ROOT_HINT, EMPTY_PATCH_SEED, EVOLUTION_PRESET_IDS, MAINTAINER_PRESET_ID, RESTRICTED_PRESET_DELIVERY, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, REVIEWER_PRESET_ID, basePresetPlugins, composePresetComposition, composePresetEntry, composePresetInsert, composePresetRow, composeRestrictedPresetDefinition, compositionRowIds, denseBlockSequence, disposeRestrictedPreset, ensureRestrictedPreset, entryListSchema, listDirectories, loadRowOverrides, mergePresetRow, normalizeAllow, parsePresetRows, presetPatchText, presetRowBlock, presetRowBody, presetRowId, probeDesktopScope, removePresetRow, resolveBasePresetPatch, restrictedPresetId, restrictedPresetState, rowBlockSpan, rowSiblingEnd, trimTrailingBlankLines };
1
+ import { a as entryListSchema, c as MAINTAINER_PRESET_ID, d as RESTRICTOR_MODULE, f as REVIEWER_PRESET_ID, i as composeRestrictedPresetDefinition, l as RESTRICTED_PRESET_DISPLAY, m as restrictedPresetId, n as ensureRestrictedPreset, o as parsePresetRows, p as normalizeAllow, r as restrictedPresetState, s as EVOLUTION_PRESET_IDS, t as disposeRestrictedPreset, u as RESTRICTED_TOOLS_ROW_ID } from "../ensure-CAjLGd9f.js";
2
+ import { C as trimTrailingBlankLines, S as rowSiblingEnd, _ as presetRowId, a as composePresetComposition, b as resolveBasePresetPatch, c as composePresetRow, d as listDirectories, f as loadRowOverrides, g as presetRowBody, h as presetRowBlock, i as basePresetPlugins, l as compositionRowIds, m as presetPatchText, n as AGENT_PRESET_ROOT_HINT, o as composePresetEntry, p as mergePresetRow, r as EMPTY_PATCH_SEED, s as composePresetInsert, t as AGENT_PRESET_PACKAGE, u as denseBlockSequence, v as probeDesktopScope, x as rowBlockSpan, y as removePresetRow } from "../composition-Cqjbho0t.js";
3
+ export { AGENT_PRESET_PACKAGE, AGENT_PRESET_ROOT_HINT, EMPTY_PATCH_SEED, EVOLUTION_PRESET_IDS, MAINTAINER_PRESET_ID, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, REVIEWER_PRESET_ID, basePresetPlugins, composePresetComposition, composePresetEntry, composePresetInsert, composePresetRow, composeRestrictedPresetDefinition, compositionRowIds, denseBlockSequence, disposeRestrictedPreset, ensureRestrictedPreset, entryListSchema, listDirectories, loadRowOverrides, mergePresetRow, normalizeAllow, parsePresetRows, presetPatchText, presetRowBlock, presetRowBody, presetRowId, probeDesktopScope, removePresetRow, resolveBasePresetPatch, restrictedPresetId, restrictedPresetState, rowBlockSpan, rowSiblingEnd, trimTrailingBlankLines };
@@ -1,4 +1,4 @@
1
- import { _ as scopedPackageName } from "./ensure-C5Mo1dbB.js";
1
+ import { g as scopedPackageName } from "./ensure-CAjLGd9f.js";
2
2
  import { dirname, join } from "node:path";
3
3
  import { existsSync, readFileSync, readdirSync } from "node:fs";
4
4
  import { fileURLToPath } from "node:url";
@@ -59,7 +59,6 @@ const REVIEWER_PRESET_ID = "evolution-reviewer-readonly";
59
59
  const MAINTAINER_PRESET_ID = "evolution-maintainer-readonly";
60
60
  const RESTRICTED_TOOLS_ROW_ID = "evolution-restricted-tools";
61
61
  const RESTRICTOR_MODULE = scopedPackageName("dsh-evolution-core/restrictor", import.meta.url);
62
- const RESTRICTED_PRESET_DELIVERY = "runtime";
63
62
  const RESTRICTED_PRESET_DISPLAY = {
64
63
  reviewer: {
65
64
  name: "evolution reviewer (read-only)",
@@ -212,4 +211,4 @@ async function disposeRestrictedPreset(ctx, kind) {
212
211
  await releaseRestrictedPreset(ctx, kind);
213
212
  }
214
213
  //#endregion
215
- export { scopedPackageName as _, entryListSchema as a, MAINTAINER_PRESET_ID as c, RESTRICTED_TOOLS_ROW_ID as d, RESTRICTOR_MODULE as f, scopeOfNearestManifest as g, restrictedPresetId as h, composeRestrictedPresetDefinition as i, RESTRICTED_PRESET_DELIVERY as l, normalizeAllow as m, ensureRestrictedPreset as n, parsePresetRows as o, REVIEWER_PRESET_ID as p, restrictedPresetState as r, EVOLUTION_PRESET_IDS as s, disposeRestrictedPreset as t, RESTRICTED_PRESET_DISPLAY as u };
214
+ export { entryListSchema as a, MAINTAINER_PRESET_ID as c, RESTRICTOR_MODULE as d, REVIEWER_PRESET_ID as f, scopedPackageName as g, scopeOfNearestManifest as h, composeRestrictedPresetDefinition as i, RESTRICTED_PRESET_DISPLAY as l, restrictedPresetId as m, ensureRestrictedPreset as n, parsePresetRows as o, normalizeAllow as p, restrictedPresetState as r, EVOLUTION_PRESET_IDS as s, disposeRestrictedPreset as t, RESTRICTED_TOOLS_ROW_ID as u };
@@ -56,11 +56,7 @@ const HOST_ROUTES = {
56
56
  body: "/api/dsh-evolution/merge/body",
57
57
  history: "/api/dsh-evolution/merge/history"
58
58
  },
59
- diagnostics: { view: "/api/dsh-evolution/diagnostics" },
60
- settings: {
61
- describe: "/api/dsh-evolution/settings/describe",
62
- mutate: "/api/dsh-evolution/settings/mutate"
63
- }
59
+ diagnostics: { view: "/api/dsh-evolution/diagnostics" }
64
60
  };
65
61
  function hostSurface(ctx) {
66
62
  const connection = ctx.get("connection");
@@ -74,74 +70,15 @@ function hostSurface(ctx) {
74
70
  allowsRemoteAuthorities: connection.allowsRemoteAuthorities === true
75
71
  };
76
72
  }
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 === void 0) return true;
83
- try {
84
- const parsed = new URL(origin);
85
- return isLoopback(parsed.hostname) && host !== void 0 && parsed.host === host;
86
- } catch {
87
- return false;
88
- }
89
- }
90
- function nodeRoute(route) {
91
- return {
92
- kind: "exact",
93
- path: route.path,
94
- handler: async (req, res) => {
95
- if (!isLoopback(req.socket.remoteAddress)) {
96
- res.statusCode = 403;
97
- res.end("forbidden");
98
- return;
99
- }
100
- if (!sameOrigin(req.headers.origin, req.headers.host)) {
101
- res.statusCode = 403;
102
- res.end("forbidden");
103
- return;
104
- }
105
- const fetchSite = req.headers["sec-fetch-site"];
106
- if (fetchSite !== void 0 && fetchSite !== "same-origin" && fetchSite !== "none") {
107
- res.statusCode = 403;
108
- res.end("forbidden");
109
- return;
110
- }
111
- const method = req.method ?? "GET";
112
- if (method !== "GET" && method !== "HEAD" && !(req.headers["content-type"] ?? "").toLowerCase().startsWith("application/json")) {
113
- res.statusCode = 415;
114
- res.end("json required");
115
- return;
116
- }
117
- try {
118
- const chunks = [];
119
- for await (const chunk of req) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
120
- const headers = new Headers();
121
- for (const [key, value] of Object.entries(req.headers)) {
122
- if (value === void 0) continue;
123
- headers.set(key, Array.isArray(value) ? value.join(",") : value);
124
- }
125
- const request = new Request(new URL(req.url ?? "/", "http://127.0.0.1"), {
126
- method,
127
- headers,
128
- ...method === "GET" || method === "HEAD" || chunks.length === 0 ? {} : { body: Buffer.concat(chunks) }
129
- });
130
- const response = await route.fetch(request);
131
- res.statusCode = response.status;
132
- response.headers.forEach((value, key) => {
133
- try {
134
- res.setHeader(key, value);
135
- } catch {}
136
- });
137
- res.end(Buffer.from(await response.arrayBuffer()));
138
- } catch (error) {
139
- res.statusCode = 500;
140
- res.end(error instanceof Error ? error.message : String(error));
141
- }
142
- }
143
- };
144
- }
73
+ /**
74
+ * Register the family host surface on the platform's exact-route carrier.
75
+ *
76
+ * The platform owns admission (Host/Origin hygiene + browserAuth + exact-route owner peer) and the
77
+ * disposer is bound to the CALLING fiber, not the connection service: the connection service can
78
+ * outlive a reloaded family fiber, so the family must release its own registrations on dispose.
79
+ * Routes carry the audit snapshot taken at registration time (deployment-level facts only — the
80
+ * exact-route handler receives a Request, not the peer identity).
81
+ */
145
82
  function registerHostRoutes(owner, build) {
146
83
  const injecting = owner;
147
84
  if (typeof injecting.inject !== "function") throw new Error("host routes require a context that owns inject()");
@@ -155,30 +92,18 @@ function registerHostRoutes(owner, build) {
155
92
  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);
156
93
  const effect = scope.effect;
157
94
  if (typeof effect !== "function") throw new Error("connection scope has no effect() to own the registration");
158
- if (connection?.fetch !== void 0 && typeof connection.fetch.register === "function") {
159
- const register = connection.fetch.register.bind(connection.fetch);
160
- effect.call(scope, () => {
161
- const disposers = [];
162
- try {
163
- for (const route of routes) disposers.push(register(route));
164
- } catch (error) {
165
- for (const dispose of disposers) try {
166
- dispose();
167
- } catch {}
168
- throw error;
169
- }
170
- return () => {
171
- for (const dispose of disposers) try {
172
- dispose();
173
- } catch {}
174
- };
175
- }, "evolution-host-routes");
176
- return;
177
- }
178
- const web = scope.get?.("webServer") ?? owner.get?.("webServer");
179
- 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");
95
+ if (connection?.fetch === void 0 || typeof connection.fetch.register !== "function") throw new Error("connection.fetch.register() is required to register family host routes (platform >= 0.2.2-rc.1); no fallback admission path exists");
96
+ const register = connection.fetch.register.bind(connection.fetch);
180
97
  effect.call(scope, () => {
181
- const disposers = routes.map((route) => web.register(nodeRoute(route)));
98
+ const disposers = [];
99
+ try {
100
+ for (const route of routes) disposers.push(register(route));
101
+ } catch (error) {
102
+ for (const dispose of disposers) try {
103
+ dispose();
104
+ } catch {}
105
+ throw error;
106
+ }
182
107
  return () => {
183
108
  for (const dispose of disposers) try {
184
109
  dispose();