@lmzhen/dsh-evolution-core 0.44.0 → 0.46.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 (62) hide show
  1. package/lib/authority-plugin.js +14 -0
  2. package/lib/composition/index.js +2 -2
  3. package/lib/{composition-CVafrlEw.js → composition-Da8NfRI7.js} +2 -2
  4. package/lib/contract.js +1 -0
  5. package/lib/index.js +54 -133
  6. package/lib/{mutations-jUuOPaCn.js → io-AmUf4lVY.js} +54 -84
  7. package/lib/io-node.js +24 -0
  8. package/lib/io-registry.js +96 -0
  9. package/lib/mutation-authority-DeJ_Wz14.js +537 -0
  10. package/lib/mutations-DwvbjRHF.js +75 -0
  11. package/lib/numeric-DLeLvvGb.js +324 -0
  12. package/lib/platform/index.js +1 -1
  13. package/lib/{platform-B06_h8t-.js → platform-CFA12Jam.js} +36 -19
  14. package/lib/policy.js +99 -0
  15. package/lib/runtime/plugin.js +8 -1
  16. package/lib/{skill-health-BLGZTIv8.js → skill-health-D1pZGk5V.js} +6 -835
  17. package/lib/{skill-history-_Cssts5o.js → skill-history-CjypdYqv.js} +2 -1
  18. package/lib/skills.js +6 -3
  19. package/lib/subagent/index.js +1 -1
  20. package/lib/types/authority-plugin.d.ts +12 -0
  21. package/lib/types/authority-plugin.js +10 -0
  22. package/lib/types/authority.d.ts +96 -0
  23. package/lib/types/authority.js +237 -0
  24. package/lib/types/contract.d.ts +116 -0
  25. package/lib/types/contract.js +10 -0
  26. package/lib/types/events.d.ts +2 -2
  27. package/lib/types/home-fence.d.ts +25 -17
  28. package/lib/types/home-fence.js +42 -92
  29. package/lib/types/index.d.ts +2 -2
  30. package/lib/types/index.js +2 -2
  31. package/lib/types/io-node.d.ts +15 -0
  32. package/lib/types/io-node.js +36 -0
  33. package/lib/types/io-registry.d.ts +71 -0
  34. package/lib/types/io-registry.js +126 -0
  35. package/lib/types/io.d.ts +29 -2
  36. package/lib/types/io.js +50 -9
  37. package/lib/types/journal-protocol.d.ts +35 -0
  38. package/lib/types/journal-protocol.js +29 -0
  39. package/lib/types/lease-store.d.ts +1 -1
  40. package/lib/types/mutation-unit.d.ts +1 -1
  41. package/lib/types/params.d.ts +2 -16
  42. package/lib/types/params.js +6 -44
  43. package/lib/types/platform/llm.js +4 -1
  44. package/lib/types/platform/projections.d.ts +10 -4
  45. package/lib/types/platform/projections.js +34 -17
  46. package/lib/types/platform-services.d.ts +2 -2
  47. package/lib/types/policy.d.ts +68 -0
  48. package/lib/types/policy.js +161 -0
  49. package/lib/types/run-registry.d.ts +2 -2
  50. package/lib/types/runtime/projections.js +12 -0
  51. package/lib/types/state-store.d.ts +1 -1
  52. package/lib/types/state-store.js +1 -1
  53. package/lib/types/store-ledger.js +2 -2
  54. package/lib/types/write-inventory.js +3 -1
  55. package/lib/write.js +2 -2
  56. package/package.json +25 -4
  57. package/persisted-write-inventory.json +10 -37
  58. package/lib/types/home-owner.d.ts +0 -4
  59. package/lib/types/home-owner.js +0 -37
  60. package/lib/types/tree-lock.d.ts +0 -54
  61. package/lib/types/tree-lock.js +0 -127
  62. package/lib/{ensure-BjToTMMj.js → ensure-C5Mo1dbB.js} +1 -1
@@ -1,292 +1,11 @@
1
+ import { a as nodeEvolutionIo, s as transactIo } from "./io-AmUf4lVY.js";
1
2
  import { B as supportFileReadFromPath, O as collectReadSkillNames, k as collectReadSupportFiles, l as sessionReadNames, o as isProjectableSession, q as resolveCitations, v as DEFAULT_SUPPORT_READ_TOOL_NAMES } from "./session-projection-EB7mUOlJ.js";
3
+ import { $ as UPSTREAM_LIMIT_CHARS_PER_TOKEN, P as DEFAULT_THREAT_MAX_SCAN_CHARS, X as SKILL_NAME_RE, a as DEFAULT_SKILL_LIMITS, d as CONTENT_SPLIT_HINT, t as clampedNumber, u as AUTHORING_SPLIT_LINE_CHARS } from "./numeric-DLeLvvGb.js";
2
4
  import { n as isRecord } from "./guards-3f02mnf2.js";
3
- import { d as nodeEvolutionIo, p as transactIo, u as isProcessAlive } from "./mutations-jUuOPaCn.js";
4
- import { dirname, join, resolve } from "node:path";
5
- import { parse } from "yaml";
6
- import { createHash, randomUUID } from "node:crypto";
7
- import { homedir } from "node:os";
8
5
  import { AsyncLocalStorage } from "node:async_hooks";
9
- //#region lib/types/constants.js
10
- /**
11
- * Shared constants for the dsh-evolution plugin family.
12
- *
13
- * Two classes of value live here, deliberately separated by section so future
14
- * edits do not blur the semantic boundary:
15
- *
16
- * 1. **Fixed protocol/format/security invariants** — changing these breaks an
17
- * on-disk format, a naming/format contract, a path-security boundary, or a
18
- * cross-component invariant. They are NOT exposed as deployment config.
19
- *
20
- * 2. **Cross-package shared tunable defaults** — the same semantic default is
21
- * read (with a config override path) by more than one package (e.g.
22
- * `evolution-policy` and `evolution-curator` both default `staleAfterDays`
23
- * to 30). Centralizing them here means one authoritative default: a config
24
- * override still applies per package, but the fallback is single-sourced.
25
- *
26
- * Package-private tunables (used by exactly one package) stay in that package,
27
- * not here — see evolution-replay's `DEFAULT_WEIGHTS` and evolution-feedback's
28
- * threshold, which are intentionally left where they are used.
29
- * @module @lmzhen/dsh-evolution-core
30
- */
31
- /**
32
- * Required argument names per `skill_manage` action — the SINGLE SOURCE read
33
- * by the tool's argument gate (tool-skill-manage write-gates.ts) and the plan
34
- * validator (evolution-plan-validator), so the two can never drift.
35
- * OPT-05 (2026-09): the plan validator used to accept a `write_file`/
36
- * `remove_file` op without `file_path` while the executor required it — the
37
- * staged write then failed at EVERY approve until rejected.
38
- * Rows here are the op-level requirements only: `delete` additionally
39
- * requires `absorbed_into` at the PLAN layer (review passes may only delete
40
- * into an umbrella) and `pin`/`unpin` are tool-only actions — each consumer
41
- * adds its own extras on top of this table. An empty-string argument is NOT
42
- * caught here (the tool's gate deliberately lets it reach the library for a
43
- * more specific remedy message); the validator adds its own `.trim()`
44
- * emptiness checks for payload fields.
45
- */
46
- const SKILL_ACTION_REQUIRED_FIELDS = {
47
- create: ["name", "content"],
48
- edit: ["name", "content"],
49
- update: ["name", "content"],
50
- patch: [
51
- "name",
52
- "old_string",
53
- "new_string"
54
- ],
55
- delete: ["name"],
56
- write_file: [
57
- "name",
58
- "file_path",
59
- "file_content"
60
- ],
61
- remove_file: ["name", "file_path"],
62
- restructure: ["name"],
63
- pin: ["name"],
64
- unpin: ["name"]
65
- };
66
- /** Skill frontmatter `name` validated for the file name (lowercase + hyphen).
67
- * 计划 B-4 (v18): tightened to the UPSTREAM `SKILL_NAME` shape
68
- * (`/^[a-z0-9]+(?:-[a-z0-9]+)*$/`, packages/skill/skill/src/index.ts:21). The
69
- * old form admitted trailing/consecutive hyphens, which upstream
70
- * `validateCandidate` throws on — and that throw aborts the WHOLE `ctx.skills`
71
- * collection. The catalog provider still filters such legacy tree entries so
72
- * an existing tree cannot break a session. */
73
- const SKILL_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
74
- /** Allowed skill support-file subdirectories (path-traversal boundary). */
75
- const SUPPORT_DIRS = [
76
- "references",
77
- "templates",
78
- "scripts",
79
- "assets"
80
- ];
81
- /** Delimiter between durable memory entries (on-disk storage format). */
82
- const ENTRY_DELIMITER = "\n§\n";
83
- /** Built-in skill names the curator must never lifecycle-manage. */
84
- const PROTECTED_BUILTIN_SKILLS = new Set(["plan"]);
85
- const MAX_SKILL_NAME_LENGTH = 64;
86
- const MAX_DESCRIPTION_LENGTH = 1024;
87
- const MAX_SKILL_CONTENT_CHARS = 1e5;
88
- /** How many content versions to retain per skill (skill-history.ts). 20 mirrors the count
89
- * KiroCrew settled on for the same job (its `MAX_SKILL_VERSIONS`), and is an E2 deployment
90
- * parameter — the value is a retention policy, not a protocol constant. */
91
- const DEFAULT_SKILL_VERSION_KEEP = 20;
92
- /** The authoring DISCIPLINE band, taken from the upstream standard (archive §5):
93
- * peer skills sit at 8-14k characters and a body pushing past 20k belongs in
94
- * `references/*.md`. Deliberately separate from `MAX_SKILL_CONTENT_CHARS`: the
95
- * hard ceiling is a deployment-tunable limit, this band is the authoring
96
- * standard — deriving the band from the ceiling is exactly what let a 40k
97
- * ceiling hide a 99k body without a single signal saying "split me" (V3). */
98
- const AUTHORING_SPLIT_LINE_CHARS = 2e4;
99
- /** Upstream's conversion basis for CHARACTER LIMITS: 2.75 chars/token, labelled
100
- * model-independent in the config template (\`cli-config.yaml.example:538\`), and the
101
- * basis behind every quoted token figure there — memory 2200 chars ≈ 800 tokens,
102
- * user 1375 ≈ 500, SKILL.md 100_000 ≈ 36k (\`tools/skill_manager_tool.py:455\`).
103
- * Limits are deliberately conservative, so this is the basis a BORROWED LIMIT must
104
- * be converted with. */
105
- const UPSTREAM_LIMIT_CHARS_PER_TOKEN = 2.75;
106
- /** The platform's own estimate basis: \`CHARS_PER_TOKEN = 4\` in
107
- * \`@deepseek-ai/dsh-token-meter/estimate.ts\` (its comment reads "used until exact
108
- * tokenization is needed"), matching upstream's ESTIMATE-side heuristic — "~4
109
- * chars/token is the usual English heuristic" (\`agent/prompt_builder.py:1179\`).
110
- * Estimates use this; limits use the constant above. */
111
- const PLATFORM_ESTIMATE_CHARS_PER_TOKEN = 4;
112
- const MAX_SKILL_FILE_BYTES = 1048576;
113
- const DEFAULT_REVIEW_MEMORY_INTERVAL = 10;
114
- const DEFAULT_REVIEW_SKILL_INTERVAL = 10;
115
- /** Skill-review completion channel trigger mode: 'cadence' | 'completion' | 'both'.
116
- * 0.3.39 (V6-53 follow-up): default is 'cadence' — since 0.3.38 the cadence
117
- * channel's review is executed at conversation END (deferred), so 'both' would
118
- * inject a second (task-complete) prompt at the same boundary; the cadence
119
- * deferral alone IS the end-of-conversation summary. */
120
- const DEFAULT_SKILL_REVIEW_TRIGGER = "cadence";
121
- /** Cumulative session tool calls before a session counts as "proven long" for the completion channel. */
122
- const DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS = 20;
123
- const DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS = 3;
124
- const DEFAULT_SUBSTANTIVE_MIN_USER_CHARS = 200;
125
- const DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS = 500;
126
- const DEFAULT_CURATOR_INTERVAL_HOURS = 168;
127
- const DEFAULT_MIN_IDLE_HOURS = 2;
128
- const DEFAULT_STALE_AFTER_DAYS = 30;
129
- const DEFAULT_ARCHIVE_AFTER_DAYS = 90;
130
- /**
131
- * Support-file count above which `references-sprawl` warns. **NOT CALIBRATED YET** — 60 is a
132
- * placeholder: the platform corpus is empty (no platform skills available here), so the admission
133
- * band cannot be checked. Until `gen-health-baseline` reports both corpora, the rule is
134
- * REPORT-ONLY: its count must not be shown as a number on any surface (plan G4 ③).
135
- */
136
- const SUPPORT_SPRAWL_FILES = 60;
137
- const DEFAULT_MEMORY_CHAR_LIMIT = 2200;
138
- const DEFAULT_USER_CHAR_LIMIT = 1375;
139
- /** Consolidation-failure backoff cap, shared by MemoryStore and memory-files' Config default. */
140
- const DEFAULT_CONSOLIDATION_FAILURES = 3;
141
- /** F-20 (v18): the authored-body budget and the hard ceiling are the same
142
- * number today. Derive it so a future divergence is one edit, not two names
143
- * that silently disagree. */
144
- const DEFAULT_SKILL_CONTENT_CHARS = MAX_SKILL_CONTENT_CHARS;
145
- /** P3-19 (v14): defaults that were written twice (schema `.default()` AND the
146
- * clamp fallback literal) now have one home per value. */
147
- const DEFAULT_REVIEW_TIMEOUT_MS = 12e4;
148
- const DEFAULT_REVIEW_CONTEXT_MESSAGES = 60;
149
- const DEFAULT_REVIEW_MESSAGE_CHARS = 2e3;
150
- const DEFAULT_CURATOR_BOOT_GRACE_SECONDS = 10;
151
- const DEFAULT_CURATOR_REVIEW_MAX_TOKENS = 2048;
152
- /** Threat-scan WINDOW SIZE (not a total cap — E-12: the whole text is scanned in
153
- * overlapping windows, so content beyond this stays in scope). The coverage
154
- * floor is `PATTERN_OVERLAP + 1` (V6-05). Single home for the core scanners'
155
- * default parameter and clamp fallback, plus evolution-threat's Config default
156
- * — the two packages previously wrote 65_536 independently (G0/S0.1). */
157
- const DEFAULT_THREAT_MAX_SCAN_CHARS = 65536;
158
- /** 0.3.17 (S3.10, T-1): control-plane fields a model-facing write call may
159
- * never carry — single source for plan-validator, evolution-policy and the
160
- * threat scanner (they used to each hardcode the list).
161
- * P2-13 (v37): staged_from_sha256 joins the list — it is the replay's own
162
- * staleness anchor, and the tool-arguments root is an OPEN object, so a model
163
- * could otherwise choose the anchor that decides the write's outcome. */
164
- const FORBIDDEN_CONTROL_KEYS = [
165
- "policy",
166
- "threshold",
167
- "prompt_hash",
168
- "model_route",
169
- "evolution_config",
170
- "staged_from_sha256"
171
- ];
172
- /** 0.3.17 (S3.10): the model-facing write tools the policy guard and threat
173
- * scanner cover. */
174
- const EVOLUTION_WRITE_TOOLS = ["memory", "skill_manage"];
175
- /** Hermes authoring quality bar for descriptions (the 60-char Rule). The
176
- * platform's own index limit stays in validateFrontmatter; this bar is the
177
- * target the authoring standard names, enforced as ADVISORY feedback.
178
- * 0.3.16 (T-4): moved here from skill-store.ts so drift-signals (pure, no IO)
179
- * can reference it without importing the skill-store module. */
180
- const AUTHORING_DESCRIPTION_BAR = 60;
181
- /** The PLATFORM's default cap on the description a skill catalog shows —
182
- * `catalogDescriptionMaxLength` on the platform's `tool-skill` row (default 500).
183
- *
184
- * Recorded here because it is the third number in the description-length relationship, and the one
185
- * that is easiest to misread as a family rule: the family's own host/all rows SET that field to
186
- * `AUTHORING_DESCRIPTION_BAR` (60), so what a family deployment truncates at is the ROW's value —
187
- * this default only governs compositions that do not override it. It is NOT a refusal threshold:
188
- * the only refusal is `MAX_DESCRIPTION_LENGTH` / the row's `maxDescriptionLength`, and the catalog
189
- * cut is a view, not a validation. See tool-skill-manage/README.md for the three-number table. */
190
- const PLATFORM_CATALOG_DESCRIPTION_DEFAULT = 500;
191
- /** The split hint both size refusals share (0.5.0 V1). The same sentence used to
192
- * be copied into validateFrontmatter AND the patch path, and neither copy named
193
- * where the content should go — the upstream cap message names the destination
194
- * directories, and that is the part a model actually acts on. */
195
- const CONTENT_SPLIT_HINT = "建议拆成更小的 SKILL.md,把支撑文件放进 references/ 或 templates/。";
196
- /** V27 G2.4: the largest millisecond delay a timer accepts. `AbortSignal.timeout`
197
- * (and `setTimeout`) coerce anything larger to 1ms after a Node warning, so a
198
- * timeout configured above this ceiling silently collapses to "immediately
199
- * aborted". The curator's review timeout and the review timeout each carried
200
- * their own copy of the literal; the bound is one protocol constant.
201
- * (v19 P2-10 corrected the value from 2^32-1 to Node's real 2^31-1 ceiling.) */
202
- const MAX_TIMER_DELAY_MS = 2147483647;
203
- /**
204
- * Model-facing budget of one `maintenance_probe` call (ms) — a HANG GUARD, not a
205
- * performance knob.
206
- *
207
- * Measured (2026-10-10): one probe costs 188/220/225 ms on the deployed library
208
- * (28 skills / 418 KB) and scales linearly at ~5.5 ms per skill (100 skills
209
- * 0.4-0.6 s, 400 skills 1.9-2.5 s), so this default is ~50x the worst measured
210
- * case and ~600x the deployed one — it will not fire in normal use, and the
211
- * ~305 s desktop interaction wall is ~5e4 skills away.
212
- *
213
- * It exists for the state the probe cannot report itself: a provider that never
214
- * answers. The platform's tool-timeout guard reads this budget off the tool
215
- * definition and turns the hang into a diagnosable `tool call timed out after
216
- * <ms>ms` error result, instead of a request that ends with nothing to read.
217
- * Reopen the default when the library approaches ~1e4 skills, when the
218
- * `evolutionIo` provider stops being local, or when a model leg enters a tool's
219
- * execute (the same conditions the probe's own note lists).
220
- */
221
- const DEFAULT_PROBE_TIMEOUT_MS = 12e4;
222
- /** V27 G2.4: the model each review/curation leg defaults to. The policy schema,
223
- * the policy resolver and the curator's LLM nomination pass each carried their
224
- * own copy of these strings — a deployment that changed the policy default used
225
- * to leave the curator passing a different model than the reviews. */
226
- const DEFAULT_CURATOR_MODEL = "deepseek-v4-pro";
227
- /** Order of the `evolution:memory-guidance` section (before the skills one). */
228
- const MEMORY_GUIDANCE_SECTION_ORDER = 11e3;
229
- /** Order of the `evolution-skills-guidance` section (last of the two). */
230
- const SKILLS_GUIDANCE_SECTION_ORDER = 11100;
231
- //#endregion
232
- //#region lib/types/limits.js
233
- /**
234
- * Skill content limits: the byte/char budgets every write path validates against.
235
- *
236
- * Split out of skill-store.ts (S2-1) so the frontmatter validators and the
237
- * store share one declaration site. Re-exported by skill-store.ts: the package
238
- * export surface is unchanged.
239
- */
240
- /** `verify` checks that every cited target exists and otherwise allows the move;
241
- * `refuse` restores the pre-0.5 behaviour of refusing ANY citation-carrying
242
- * section. Resolved at the call site, so every existing limits object keeps
243
- * working (unknown policy never silently changes a write path). */
244
- const DEFAULT_CITATION_POLICY = "verify";
245
- /** Default: report the plan on refusal, never write (behaviour unchanged). */
246
- const DEFAULT_REFERENCE_REWRITE_POLICY = "plan";
247
- /** Default: report-only, because upstream's hard invariant is never to delete. */
248
- const DEFAULT_ARCHIVE_RETENTION_POLICY = "report";
249
- /** Default: report, so the cap cannot brick an existing oversize file on upgrade
250
- * (the live library carries a 189k-character release log today). */
251
- const DEFAULT_SUPPORT_FILE_CHAR_POLICY = "report";
252
- /** The four stage defaults in ONE object, so the policy schema's `z.default(...)`
253
- * calls and the store's fallbacks cannot drift apart. */
254
- const POLICY_STAGE_DEFAULTS = Object.freeze({
255
- citationPolicy: DEFAULT_CITATION_POLICY,
256
- referenceRewrite: DEFAULT_REFERENCE_REWRITE_POLICY,
257
- archiveRetention: DEFAULT_ARCHIVE_RETENTION_POLICY,
258
- supportFileCharPolicy: DEFAULT_SUPPORT_FILE_CHAR_POLICY
259
- });
260
- /**
261
- * The ONE conversion from the deployment policy snapshot to library limits
262
- * (design §16.7): every plugin that owns a writable SkillLibrary spreads this into
263
- * its limits, so a stage selected in cordis.yml reaches every write path. A
264
- * per-plugin copy would be the third home for the same threshold.
265
- *
266
- * Only PRESENT fields are copied: an absent policy field must fall through to the
267
- * library default rather than pinning `undefined` onto an optional limit (which
268
- * `exactOptionalPropertyTypes` forbids and which would defeat the `?? DEFAULT`
269
- * resolution inside the store).
270
- * @param snapshot - the evolutionPolicy snapshot, or undefined when unmounted.
271
- * @returns the stage fields the snapshot actually carries.
272
- */
273
- function policyStageLimits(snapshot) {
274
- if (snapshot === void 0) return {};
275
- const stages = {};
276
- if (snapshot.citationPolicy !== void 0) stages.citationPolicy = snapshot.citationPolicy;
277
- if (snapshot.referenceRewrite !== void 0) stages.referenceRewrite = snapshot.referenceRewrite;
278
- if (snapshot.archiveRetention !== void 0) stages.archiveRetention = snapshot.archiveRetention;
279
- if (snapshot.supportFileCharPolicy !== void 0) stages.supportFileCharPolicy = snapshot.supportFileCharPolicy;
280
- return stages;
281
- }
282
- const DEFAULT_SKILL_LIMITS = {
283
- maxNameLength: 64,
284
- maxDescriptionLength: MAX_DESCRIPTION_LENGTH,
285
- maxSkillContentChars: MAX_SKILL_CONTENT_CHARS,
286
- maxSkillFileBytes: MAX_SKILL_FILE_BYTES,
287
- versionKeep: 20
288
- };
289
- //#endregion
6
+ import { dirname, join } from "node:path";
7
+ import { createHash } from "node:crypto";
8
+ import { parse } from "yaml";
290
9
  //#region lib/types/write-authority.js
291
10
  /** The mode a deployment that configures nothing gets. */
292
11
  const DEFAULT_WRITE_CONFIRM_MODE = "auto";
@@ -1943,57 +1662,6 @@ async function updateSuppressedNames(root, io, task) {
1943
1662
  });
1944
1663
  }
1945
1664
  //#endregion
1946
- //#region lib/types/state-store.js
1947
- /**
1948
- * Evolution home path helpers: the DSH root and `$DSH_HOME/evolution` for
1949
- * plugin-owned sidecar state (reports, activity store, feedback file,
1950
- * state-domain data).
1951
- *
1952
- * C-10: PATH HELPERS ONLY — despite the file name there is no store
1953
- * here. Durable evolution state lives in the state stack (evolution-state over
1954
- * evolution-state-json / -domain); skills and memories live in skill-store.ts
1955
- * / memory-store.ts. The file name is kept deliberately: renaming it would
1956
- * touch every family import for zero behavior change, and the audit records
1957
- * the mismatch as known naming debt.
1958
- */
1959
- /**
1960
- * DSH home root: `$DSH_HOME` or `~/.dsh`. Single source of the empty-string
1961
- * fallback — an EMPTY or WHITESPACE-ONLY DSH_HOME resolves to the default
1962
- * home, never to a CWD-relative path (0.3.19 W1.3, 0.3.22 F-207);
1963
- * V8-06 (0.3.47) extends the guard to whitespace.
1964
- * C-11 correction (S2.2, PLAN 2026-09-16): upstream `resolveDshHome`
1965
- * (util/home-paths) uses `trim()` ONLY as the ADOPTION test and then uses the
1966
- * RAW env value — the earlier "same trimmed source" form returned the trimmed
1967
- * text, so `DSH_HOME=" /x "` produced `/x` where upstream produced the literal
1968
- * padded path. The value semantics now match upstream line for line:
1969
- * `const selected = configured ?? (fromEnv !== undefined &&
1970
- * fromEnv.trim().length > 0 ? fromEnv : defaultDshHome())`.
1971
- * OPT-27 (2026-09, plan D5 — accepted): the v10-era "no `~` expansion, no
1972
- * resolve" divergence from upstream `resolveDshHome` is RETIRED. It became
1973
- * load-bearing when the skill-catalog shadow made "same tree as the upstream
1974
- * `USER_DSH_RANK` provider" a hard contract: upstream watches the EXPANDED
1975
- * absolute `<home>/skills` while this value fed a literal `~/x` (a directory
1976
- * named `~` under the host CWD) or a CWD-relative path — split-brain skill
1977
- * trees, preset installs the platform never reads, doctor probes of a
1978
- * directory nothing serves.
1979
- * S2.2 (PLAN 2026-09-16), final correction: the result is ALWAYS
1980
- * `resolve(expandHomePath(selected))` — the earlier form returned an
1981
- * already-absolute value VERBATIM, so a trailing slash or `..` segment
1982
- * landed unnormalized while upstream normalizes every value. Relative
1983
- * `DSH_HOME` values change landing spot; a CLEAN absolute home stays
1984
- * byte-identical (resolve is a no-op on it).
1985
- */
1986
- function evolutionRoot(env = process.env) {
1987
- const fromEnv = env.DSH_HOME;
1988
- const selected = fromEnv !== void 0 && fromEnv.trim().length > 0 ? fromEnv : join(homedir(), ".dsh");
1989
- return resolve(selected === "~" ? homedir() : selected.startsWith("~/") || selected.startsWith("~\\") ? join(homedir(), selected.slice(2)) : selected);
1990
- }
1991
- /** Evolution home path helper: `$DSH_HOME/evolution` for plugin-owned sidecar
1992
- * state (reports, activity store, feedback file, state-domain data). */
1993
- function evolutionHome(env = process.env) {
1994
- return join(evolutionRoot(env), "evolution");
1995
- }
1996
- //#endregion
1997
1665
  //#region lib/types/cost.js
1998
1666
  /**
1999
1667
  * Context-cost accounting for skill bodies (design §5.2).
@@ -2733,48 +2401,6 @@ function makeSerialQueue() {
2733
2401
  };
2734
2402
  }
2735
2403
  //#endregion
2736
- //#region lib/types/numeric.js
2737
- /**
2738
- * Numeric config clamping for the dsh-evolution plugin family.
2739
- *
2740
- * G3.1 (0.3.23): numeric configuration values are normalised through a single
2741
- * helper so 0 / negative / NaN / ±Infinity / out-of-range all fall back to the
2742
- * package default instead of silently becoming a "disabled" special value or
2743
- * folding as NaN into a computation. A non-finite value (NaN, ±Infinity) is
2744
- * never a legitimate config, so it always falls back. The schema layer (a
2745
- * `.min(1)` clamp on the number schema) is a first-line guard where it can
2746
- * reject invalid values; this helper is the mandatory assembly-time clamp that
2747
- * also catches what schemastery lets through (NaN and +Infinity both pass a
2748
- * bare number schema).
2749
- *
2750
- * The scope here is pure numeric conversion only (no schemastery import), so
2751
- * evolution-core stays free of a schemastery dependency. Per-package Config
2752
- * schemas keep their own `.min()`/`.default()` call sites.
2753
- * @module @lmzhen/dsh-evolution-core
2754
- */
2755
- /**
2756
- * Clamp a numeric config to the `[min, max]` range.
2757
- *
2758
- * A non-finite value (NaN, ±Infinity), a non-number, or a value outside the
2759
- * inclusive range falls back to `fallback`. When `opts.min >= 1`, 0 and
2760
- * negative values also fall back to `fallback` — a 0 is never treated as a
2761
- * special "disabled" meaning (G3.1 decision). Callers that legitimately allow
2762
- * 0 (e.g. a threshold or a zero-cost weight) pass `{ min: 0 }` or omit the
2763
- * range.
2764
- *
2765
- * @param value - the raw numeric config, possibly `undefined` (absent).
2766
- * @param fallback - the default value to return when the value is invalid.
2767
- * @param opts - optional inclusive lower/upper bound.
2768
- * @returns `value` when it is a finite number within range, else `fallback`.
2769
- */
2770
- function clampedNumber(value, fallback, opts) {
2771
- if (typeof value !== "number" || !Number.isFinite(value)) return fallback;
2772
- const { min, max } = opts ?? {};
2773
- if (min !== void 0 && value < min) return fallback;
2774
- if (max !== void 0 && value > max) return fallback;
2775
- return value;
2776
- }
2777
- //#endregion
2778
2404
  //#region lib/types/threats.js
2779
2405
  /**
2780
2406
  * Threat scanning for agent-authored memory and skill content.
@@ -3208,461 +2834,6 @@ function currentReviewContext() {
3208
2834
  return storage.getStore();
3209
2835
  }
3210
2836
  //#endregion
3211
- //#region lib/types/tree-lock.js
3212
- /**
3213
- * Tree write lock.
3214
- *
3215
- * The merge run holds this lock for its whole lifetime; curator's pass takes the same
3216
- * lock. The record is created through `transactIo`, so exclusion is exactly as strong as
3217
- * the IO backend's `transact`: the platform `ctx.fs` provider is cross-process, while the
3218
- * standalone `nodeEvolutionIo` is explicitly single-process (G2 S4). This module builds no
3219
- * file lock or WAL of its own. A holder whose pid is gone is stale and may be taken over;
3220
- * a live pid is respected, even for a long run (a live long run is what the lock protects).
3221
- *
3222
- * `commitMerge` deliberately does NOT take this lock itself: the run shell owns it, so a
3223
- * run and its commit share one acquisition. Taking it inside the store would also
3224
- * deadlock the same-process curator path.
3225
- */
3226
- /** The one lock path. */
3227
- function treeLockFile(home) {
3228
- return join(home, "merge", ".tree-lock");
3229
- }
3230
- function parseLock(raw) {
3231
- if (raw === null) return void 0;
3232
- try {
3233
- const value = JSON.parse(raw);
3234
- if (typeof value.token !== "string" || typeof value.pid !== "number" || typeof value.startedAt !== "number") return void 0;
3235
- return {
3236
- token: value.token,
3237
- epoch: typeof value.epoch === "number" ? value.epoch : 0,
3238
- pid: value.pid,
3239
- startedAt: value.startedAt
3240
- };
3241
- } catch {
3242
- return;
3243
- }
3244
- }
3245
- const sleepDefault = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
3246
- /** Read the current holder without creating or changing anything. */
3247
- async function readTreeLock(io, home) {
3248
- return parseLock(await io.readText(treeLockFile(home)));
3249
- }
3250
- /** Try once. A stale record (dead pid or unparsable) is replaced. */
3251
- async function tryAcquire(io, home, now) {
3252
- const path = treeLockFile(home);
3253
- let token;
3254
- let epoch;
3255
- let holder;
3256
- await transactIo(io, path, (current) => {
3257
- const existing = parseLock(current);
3258
- if (existing !== void 0 && isProcessAlive(existing.pid)) {
3259
- holder = existing;
3260
- return current;
3261
- }
3262
- token = randomUUID();
3263
- epoch = (existing?.epoch ?? 0) + 1;
3264
- return JSON.stringify({
3265
- token,
3266
- epoch,
3267
- pid: process.pid,
3268
- startedAt: now()
3269
- });
3270
- });
3271
- return token === void 0 ? holder === void 0 ? {} : { holder } : {
3272
- token,
3273
- epoch: epoch ?? 0
3274
- };
3275
- }
3276
- /**
3277
- * Acquire the tree write lock, waiting up to `waitMs`.
3278
- *
3279
- * A live holder is never stolen. A record whose pid is gone (or a corrupt record) is
3280
- * taken over; that is how a killed process releases its lock without a timer.
3281
- */
3282
- async function acquireTreeWriteLock(options) {
3283
- const now = options.now ?? (() => Date.now());
3284
- const waitMs = options.waitMs ?? 5e3;
3285
- const pollMs = options.pollMs ?? 25;
3286
- const sleep = options.sleep ?? sleepDefault;
3287
- const deadline = now() + Math.max(0, waitMs);
3288
- let lastHolder;
3289
- try {
3290
- for (;;) {
3291
- const attempt = await tryAcquire(options.io, options.home, now);
3292
- if (attempt.token !== void 0) {
3293
- const token = attempt.token;
3294
- const epoch = attempt.epoch ?? 0;
3295
- const path = treeLockFile(options.home);
3296
- let released = false;
3297
- return {
3298
- ok: true,
3299
- lock: {
3300
- token,
3301
- epoch,
3302
- path,
3303
- acquiredAt: now(),
3304
- async assertHeld() {
3305
- const current = parseLock(await options.io.readText(path));
3306
- return current?.token === token && current.epoch === epoch;
3307
- },
3308
- async release() {
3309
- if (released) return;
3310
- await transactIo(options.io, path, (current) => {
3311
- const existing = parseLock(current);
3312
- return existing?.token === token && existing.epoch === epoch ? null : current;
3313
- });
3314
- released = true;
3315
- }
3316
- }
3317
- };
3318
- }
3319
- lastHolder = attempt.holder;
3320
- if (now() >= deadline) break;
3321
- await sleep(pollMs);
3322
- }
3323
- return {
3324
- ok: false,
3325
- reason: "busy",
3326
- ...lastHolder !== void 0 ? { holder: lastHolder } : {}
3327
- };
3328
- } catch (error) {
3329
- return {
3330
- ok: false,
3331
- reason: "io",
3332
- message: error instanceof Error ? error.message : String(error)
3333
- };
3334
- }
3335
- }
3336
- /** Acquire, run, release; the lock is released even when the body throws. */
3337
- async function withTreeWriteLock(options, body) {
3338
- const acquired = await acquireTreeWriteLock(options);
3339
- if (!acquired.ok) return acquired;
3340
- try {
3341
- return {
3342
- ok: true,
3343
- value: await body(acquired.lock)
3344
- };
3345
- } finally {
3346
- await acquired.lock.release();
3347
- }
3348
- }
3349
- //#endregion
3350
- //#region lib/types/home-owner.js
3351
- const OWNER_FILE = ".evolution-owner.json";
3352
- function isAlive(pid) {
3353
- if (!Number.isInteger(pid) || pid <= 0) return false;
3354
- try {
3355
- process.kill(pid, 0);
3356
- return true;
3357
- } catch (error) {
3358
- return error.code === "EPERM";
3359
- }
3360
- }
3361
- /** Fail loud when another live process already owns this DSH home. Single-host contract. */
3362
- async function assertHomeOwner(io, home) {
3363
- const path = join(home, OWNER_FILE);
3364
- const raw = await io.readText(path);
3365
- if (raw !== null) {
3366
- let record;
3367
- try {
3368
- const parsed = JSON.parse(raw);
3369
- if (typeof parsed.pid !== "number" || typeof parsed.startedAt !== "string") throw new Error("bad owner record");
3370
- record = {
3371
- pid: parsed.pid,
3372
- startedAt: parsed.startedAt
3373
- };
3374
- } catch {
3375
- throw new Error("evolution home owner record is unreadable; refusing a second owner (" + path + ")");
3376
- }
3377
- if (record.pid === process.pid) return;
3378
- if (isAlive(record.pid)) throw new Error("evolution home is owned by another live process (pid " + String(record.pid) + "); this deployment is single-host only");
3379
- }
3380
- await io.writeText(path, JSON.stringify({
3381
- pid: process.pid,
3382
- startedAt: (/* @__PURE__ */ new Date()).toISOString()
3383
- }));
3384
- }
3385
- //#endregion
3386
- //#region lib/types/home-fence.js
3387
- var HomeFenceError = class extends Error {
3388
- reason;
3389
- constructor(reason, message) {
3390
- super(message);
3391
- this.name = "HomeFenceError";
3392
- this.reason = reason;
3393
- }
3394
- };
3395
- /** Unlink races on Windows are transient: a virus scanner or a closing handle can hold the
3396
- * lock file for a few milliseconds. Retry only those, and only inside the fence release:
3397
- * the durable write path has its own rename budget and must not inherit lock semantics. */
3398
- const RELEASE_RETRY_MS = [
3399
- 25,
3400
- 50,
3401
- 100
3402
- ];
3403
- function transientReleaseError(error) {
3404
- if (typeof error !== "object" || error === null) return false;
3405
- const code = error.code;
3406
- return code === "EPERM" || code === "EBUSY" || code === "EACCES";
3407
- }
3408
- function asError(error) {
3409
- return error instanceof Error ? error : new Error(String(error));
3410
- }
3411
- function sleep(ms) {
3412
- return new Promise((resolve) => setTimeout(resolve, ms));
3413
- }
3414
- /**
3415
- * One home-level writer queue. It serializes same-process callers before the
3416
- * tree lock, and the tree lock remains the only cross-process guard the current
3417
- * backend can provide (nodeEvolutionIo is single-process).
3418
- *
3419
- * `acquire` is public only for legacy call sites; W0 keeps it usable but makes a
3420
- * failed release advance the queue and poison the fence instead of wedging every
3421
- * later writer. Nested acquisition is not supported: the state layer must reuse
3422
- * the transaction it is already inside (see evolution-state-json appendArchive).
3423
- */
3424
- var HomeFence = class {
3425
- tail = Promise.resolve();
3426
- poisoned;
3427
- options;
3428
- constructor(options) {
3429
- this.options = options;
3430
- }
3431
- async releaseLock(lock) {
3432
- let attempt = 0;
3433
- for (;;) try {
3434
- await lock.release();
3435
- return;
3436
- } catch (error) {
3437
- if (!transientReleaseError(error) || attempt >= RELEASE_RETRY_MS.length) throw error;
3438
- await sleep(RELEASE_RETRY_MS[attempt] ?? 100);
3439
- attempt += 1;
3440
- }
3441
- }
3442
- async acquire() {
3443
- if (this.poisoned !== void 0) throw new HomeFenceError("io", "home fence is poisoned after a failed lock release: " + this.poisoned.message);
3444
- const previous = this.tail;
3445
- let releaseQueue = () => {};
3446
- this.tail = new Promise((resolve) => {
3447
- releaseQueue = resolve;
3448
- });
3449
- await previous;
3450
- try {
3451
- const acquired = await acquireTreeWriteLock(this.options);
3452
- if (!acquired.ok) throw new HomeFenceError(acquired.reason, acquired.message ?? "home fence is " + acquired.reason);
3453
- try {
3454
- await assertHomeOwner(this.options.io, this.options.home);
3455
- } catch (error) {
3456
- await acquired.lock.release().catch(() => {});
3457
- throw error;
3458
- }
3459
- let released = false;
3460
- return {
3461
- lock: acquired.lock,
3462
- release: async () => {
3463
- if (released) return;
3464
- released = true;
3465
- let failure;
3466
- try {
3467
- await this.releaseLock(acquired.lock);
3468
- } catch (error) {
3469
- failure = asError(error);
3470
- this.poisoned = failure;
3471
- } finally {
3472
- releaseQueue();
3473
- }
3474
- if (failure !== void 0) throw failure;
3475
- }
3476
- };
3477
- } catch (error) {
3478
- releaseQueue();
3479
- throw error;
3480
- }
3481
- }
3482
- async run(body) {
3483
- const lease = await this.acquire();
3484
- try {
3485
- return await body(lease.lock);
3486
- } finally {
3487
- await lease.release();
3488
- }
3489
- }
3490
- };
3491
- //#endregion
3492
- //#region lib/types/lease-store.js
3493
- const DEFAULT_LEASE_TTL_MS = 3e4;
3494
- function leaseFile(home, runId) {
3495
- return join(home, "leases", encodeURIComponent(runId) + ".json");
3496
- }
3497
- function parseLease(raw) {
3498
- if (raw === null) return void 0;
3499
- try {
3500
- const value = JSON.parse(raw);
3501
- if (typeof value.id !== "string" || typeof value.runId !== "string" || typeof value.owner !== "string" || typeof value.pid !== "number" || typeof value.epoch !== "number" || typeof value.issuedAt !== "number" || typeof value.expiresAt !== "number" || typeof value.heartbeatAt !== "number" || value.state !== "active" && value.state !== "released") return void 0;
3502
- return value;
3503
- } catch {
3504
- return;
3505
- }
3506
- }
3507
- async function transact(io, path, task) {
3508
- if (io.transact !== void 0) {
3509
- await io.transact(path, task);
3510
- return;
3511
- }
3512
- const current = await io.readText(path);
3513
- const next = task(current);
3514
- if (next === null) await io.remove(path);
3515
- else if (next !== current) await io.writeText(path, next);
3516
- }
3517
- function tokenOf(record) {
3518
- return {
3519
- id: record.id,
3520
- owner: record.owner,
3521
- runId: record.runId,
3522
- epoch: record.epoch
3523
- };
3524
- }
3525
- /** Durable single-host lease store. One active lease per runId; expired leases are reclaimable. */
3526
- var LeaseStore = class {
3527
- io;
3528
- home;
3529
- ttlMs;
3530
- now;
3531
- pid;
3532
- constructor(options) {
3533
- this.io = options.io;
3534
- this.home = options.home;
3535
- this.ttlMs = options.ttlMs ?? 3e4;
3536
- this.now = options.now ?? Date.now;
3537
- this.pid = options.pid ?? process.pid;
3538
- }
3539
- path(runId) {
3540
- if (runId.trim() === "") throw new Error("lease runId must not be empty");
3541
- return leaseFile(this.home, runId);
3542
- }
3543
- async acquire(owner, runId, ttlMs = this.ttlMs) {
3544
- if (ttlMs <= 0) throw new Error("lease ttl must be positive");
3545
- const path = this.path(runId);
3546
- const now = this.now();
3547
- let created;
3548
- let holder;
3549
- await transact(this.io, path, (raw) => {
3550
- const current = parseLease(raw);
3551
- if (current !== void 0 && current.state === "active" && now < current.expiresAt) {
3552
- holder = current;
3553
- return raw;
3554
- }
3555
- created = {
3556
- id: randomUUID(),
3557
- owner,
3558
- runId,
3559
- pid: this.pid,
3560
- epoch: (current?.epoch ?? 0) + 1,
3561
- issuedAt: now,
3562
- expiresAt: now + ttlMs,
3563
- heartbeatAt: now,
3564
- state: "active"
3565
- };
3566
- return JSON.stringify(created);
3567
- });
3568
- if (created !== void 0) return {
3569
- ok: true,
3570
- lease: created,
3571
- token: tokenOf(created)
3572
- };
3573
- if (holder !== void 0) return {
3574
- ok: false,
3575
- reason: "busy",
3576
- holder
3577
- };
3578
- throw new Error("lease acquire did not create or observe a record");
3579
- }
3580
- async get(runId) {
3581
- return parseLease(await this.io.readText(this.path(runId))) ?? null;
3582
- }
3583
- async active(runId) {
3584
- const record = await this.get(runId);
3585
- return record !== null && record.state === "active" && this.now() < record.expiresAt ? record : null;
3586
- }
3587
- async renew(token, ttlMs = this.ttlMs) {
3588
- const path = this.path(token.runId);
3589
- let next = null;
3590
- await transact(this.io, path, (raw) => {
3591
- const current = parseLease(raw);
3592
- if (current === void 0 || current.state !== "active" || current.id !== token.id || current.epoch !== token.epoch) return raw;
3593
- const now = this.now();
3594
- next = {
3595
- ...current,
3596
- heartbeatAt: now,
3597
- expiresAt: now + ttlMs
3598
- };
3599
- return JSON.stringify(next);
3600
- });
3601
- return next;
3602
- }
3603
- async release(token) {
3604
- const path = this.path(token.runId);
3605
- await transact(this.io, path, (raw) => {
3606
- const current = parseLease(raw);
3607
- if (current === void 0 || current.id !== token.id || current.epoch !== token.epoch) return raw;
3608
- return JSON.stringify({
3609
- ...current,
3610
- state: "released",
3611
- heartbeatAt: this.now()
3612
- });
3613
- });
3614
- }
3615
- };
3616
- //#endregion
3617
- //#region lib/types/mutation-authority.js
3618
- /**
3619
- * The family's write authority. It owns the one home fence and the per-run lease store.
3620
- *
3621
- * The lease is a per-run mutex for long-running review/approval work; foreground writes
3622
- * have no run identity and are serialized by the fence. The former apply/transact/recover
3623
- * facade claimed to gate every write on a lease but had no production caller, so it was
3624
- * removed rather than kept as a false narrow waist.
3625
- */
3626
- var MutationAuthority = class {
3627
- leases;
3628
- fence;
3629
- /** Lease primitives for run/claim owners (review, approval). */
3630
- get lease() {
3631
- return this.leases;
3632
- }
3633
- /** The one home fence domain unit engines must reuse instead of taking tree-lock themselves. */
3634
- get homeFence() {
3635
- return this.fence;
3636
- }
3637
- /** Adapter for MutationUnit call sites that accept a lock port. It is the fence, no more. */
3638
- get mutationLock() {
3639
- return { acquire: async () => {
3640
- const lease = await this.fence.acquire();
3641
- return { release: async () => {
3642
- await lease.release();
3643
- } };
3644
- } };
3645
- }
3646
- constructor(options) {
3647
- this.leases = options.leases ?? new LeaseStore({
3648
- io: options.io,
3649
- home: options.home,
3650
- ...options.now === void 0 ? {} : { now: options.now }
3651
- });
3652
- this.fence = options.fence ?? new HomeFence({
3653
- io: options.io,
3654
- home: options.home,
3655
- ...options.waitMs === void 0 ? {} : { waitMs: options.waitMs },
3656
- ...options.now === void 0 ? {} : { now: options.now }
3657
- });
3658
- }
3659
- };
3660
- /** Read the authority's fence adapter from a context; undefined means no authority is mounted. */
3661
- function mutationLockFrom(ctx) {
3662
- if (ctx?.get === void 0) return void 0;
3663
- return ctx.get("evolutionMutationAuthority")?.mutationLock;
3664
- }
3665
- //#endregion
3666
2837
  //#region lib/types/skill-health.js
3667
2838
  /**
3668
2839
  * Skill structure-health domain (rc.73 A1, 008 design): a SECOND assessment
@@ -3770,4 +2941,4 @@ function assessStructureHealth(snapshot, thresholds = DEFAULT_HEALTH_THRESHOLDS)
3770
2941
  };
3771
2942
  }
3772
2943
  //#endregion
3773
- export { COST_ASCII_TOKEN_LOW as $, MAX_TIMER_DELAY_MS as $n, supportRefs as $t, clampedNumber as A, DEFAULT_PROBE_TIMEOUT_MS as An, updateSuppressedNames as At, appendEvolutionEvent as B, DEFAULT_STALE_AFTER_DAYS as Bn, authoringFeedback as Bt, sweepReviewChannelSessions as C, DEFAULT_CONSOLIDATION_FAILURES as Cn, loadUsage as Ct, scanContentThreats as D, DEFAULT_CURATOR_REVIEW_MAX_TOKENS as Dn, saveSuppressedNames as Dt, evaluateThreat as E, DEFAULT_CURATOR_MODEL as En, normalizeUsageRecord as Et, trimPatternBoundaries as F, DEFAULT_REVIEW_TIMEOUT_MS as Fn, selectSections as Ft, readEvolutionEvents as G, DEFAULT_USER_CHAR_LIMIT as Gn, normalizeFrontmatter as Gt, evolutionEventPayloadIssue as H, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS as Hn, exceedsContentLimit as Ht, EVENT_ARCHIVE_PREFIX as I, DEFAULT_SKILL_CONTENT_CHARS as In, displayBodyOf as It, RULES as J, FORBIDDEN_CONTROL_KEYS as Jn, shrinksOverLimit as Jt, readEvolutionTimeline as K, ENTRY_DELIMITER as Kn, parseFrontmatter as Kt, EVENT_LOG_RETAIN_ARCHIVES as L, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS as Ln, h2Sections as Lt, FUZZY_MAX_PATTERN_CHARS as M, DEFAULT_REVIEW_MEMORY_INTERVAL as Mn, usageObserved as Mt, FUZZY_MAX_WORK as N, DEFAULT_REVIEW_MESSAGE_CHARS as Nn, planExtract as Nt, scanMemoryThreats as O, DEFAULT_MEMORY_CHAR_LIMIT as On, saveUsage as Ot, fuzzyPatch as P, DEFAULT_REVIEW_SKILL_INTERVAL as Pn, projectExtractBodies as Pt, COST_ASCII_TOKEN_HIGH as Q, MAX_SKILL_NAME_LENGTH as Qn, externalRefs as Qt, EVENT_LOG_ROTATE_AT as R, DEFAULT_SKILL_REVIEW_TRIGGER as Rn, readingStats as Rt, markReviewChannel as S, DEFAULT_ARCHIVE_AFTER_DAYS as Sn, loadSuppressedNames as St, THREAT_EXEMPTION_HINT as T, DEFAULT_CURATOR_INTERVAL_HOURS as Tn, mutateUsage as Tt, listEventArchives as U, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS as Un, frontmatterBlock as Ut, eventsFile as V, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS as Vn, ensureSkillFrontmatter as Vt, parseEvolutionEvents as W, DEFAULT_THREAT_MAX_SCAN_CHARS as Wn, frontmatterCatalogInvalid as Wt, diffFindings as X, MAX_SKILL_CONTENT_CHARS as Xn, validateFrontmatter as Xt, countReferenceFiles as Y, MAX_DESCRIPTION_LENGTH as Yn, skillMdOnDisk as Yt, lintSkill as Z, MAX_SKILL_FILE_BYTES as Zn, yamlPlainScalarNeedsQuotes as Zt, withTreeWriteLock as _, POLICY_STAGE_DEFAULTS as _n, emptyRecord as _t, lintBody as a, filterUnreadSkillOps as an, SKILL_ACTION_REQUIRED_FIELDS as ar, tokenLineFor as at, clearReviewChannel as b, AUTHORING_SPLIT_LINE_CHARS as bn, idleDays as bt, DEFAULT_LEASE_TTL_MS as c, sessionReadSupportFiles as cn, SUPPORT_SPRAWL_FILES as cr, MAX_SUPPORT_READ_PATHS as ct, HomeFence as d, authorityFrom as dn, applyCuratorMetaFields as dt, applyReferenceRewrite as en, MEMORY_GUIDANCE_SECTION_ORDER as er, COST_CJK_TOKEN_HIGH as et, HomeFenceError as f, DEFAULT_ARCHIVE_RETENTION_POLICY as fn, bumpPatch as ft, treeLockFile as g, DEFAULT_SUPPORT_FILE_CHAR_POLICY as gn, daysSinceIso as gt, readTreeLock as h, DEFAULT_SKILL_LIMITS as hn, bumpView as ht, assessStructureHealth as i, READ_REQUIRED_ACTIONS as in, SKILLS_GUIDANCE_SECTION_ORDER as ir, bodyCost as it, makeSerialQueue as j, DEFAULT_REVIEW_CONTEXT_MESSAGES as jn, usageFile as jt, scanThreats as k, DEFAULT_MIN_IDLE_HOURS as kn, suppressedFile as kt, LeaseStore as l, DEFAULT_WRITE_CONFIRM_MODE as ln, UPSTREAM_LIMIT_CHARS_PER_TOKEN as lr, SUPPRESSED_FILE_VERSION as lt, acquireTreeWriteLock as m, DEFAULT_REFERENCE_REWRITE_POLICY as mn, bumpUse as mt, HEALTH_STAMP_RE as n, planReferenceRewrite as nn, PLATFORM_ESTIMATE_CHARS_PER_TOKEN as nr, TOKEN_ASCII_WEIGHT as nt, MutationAuthority as o, isUnreadWrite as on, SKILL_NAME_RE as or, evolutionHome as ot, assertHomeOwner as p, DEFAULT_CITATION_POLICY as pn, bumpSupportRead as pt, retainEventArchives as q, EVOLUTION_WRITE_TOOLS as qn, relatedSkillNames as qt, MIN_STAMP_BODY_CHARS as r, planRehoming as rn, PROTECTED_BUILTIN_SKILLS as rr, TOKEN_CJK_WEIGHT as rt, mutationLockFrom as s, sessionReadSkillNames as sn, SUPPORT_DIRS as sr, evolutionRoot as st, DEFAULT_HEALTH_THRESHOLDS as t, describeReferenceRewrite as tn, PLATFORM_CATALOG_DESCRIPTION_DEFAULT as tr, COST_CJK_TOKEN_LOW as tt, leaseFile as u, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS as un, applyCuratorLifecycleFields as ut, currentReviewContext as v, policyStageLimits as vn, foldCuratorFields as vt, PATTERN_OVERLAP as w, DEFAULT_CURATOR_BOOT_GRACE_SECONDS as wn, markAgentCreated as wt, isReviewChannelSession as x, CONTENT_SPLIT_HINT as xn, latestActivityAt as xt, withReviewContext as y, AUTHORING_DESCRIPTION_BAR as yn, getRecord as yt, EVENT_LOG_VERSION as z, DEFAULT_SKILL_VERSION_KEEP as zn, restructureCandidates as zt };
2944
+ export { bumpUse as $, listEventArchives as A, normalizeFrontmatter as At, COST_ASCII_TOKEN_LOW as B, describeReferenceRewrite as Bt, EVENT_ARCHIVE_PREFIX as C, readingStats as Ct, appendEvolutionEvent as D, exceedsContentLimit as Dt, EVENT_LOG_VERSION as E, ensureSkillFrontmatter as Et, RULES as F, validateFrontmatter as Ft, bodyCost as G, isUnreadWrite as Gt, COST_CJK_TOKEN_LOW as H, planRehoming as Ht, countReferenceFiles as I, yamlPlainScalarNeedsQuotes as It, SUPPRESSED_FILE_VERSION as J, DEFAULT_WRITE_CONFIRM_MODE as Jt, tokenLineFor as K, sessionReadSkillNames as Kt, diffFindings as L, externalRefs as Lt, readEvolutionEvents as M, relatedSkillNames as Mt, readEvolutionTimeline as N, shrinksOverLimit as Nt, eventsFile as O, frontmatterBlock as Ot, retainEventArchives as P, skillMdOnDisk as Pt, bumpSupportRead as Q, lintSkill as R, supportRefs as Rt, trimPatternBoundaries as S, h2Sections as St, EVENT_LOG_ROTATE_AT as T, authoringFeedback as Tt, TOKEN_ASCII_WEIGHT as U, READ_REQUIRED_ACTIONS as Ut, COST_CJK_TOKEN_HIGH as V, planReferenceRewrite as Vt, TOKEN_CJK_WEIGHT as W, filterUnreadSkillOps as Wt, applyCuratorMetaFields as X, authorityFrom as Xt, applyCuratorLifecycleFields as Y, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS as Yt, bumpPatch as Z, scanThreats as _, usageObserved as _t, lintBody as a, idleDays as at, FUZZY_MAX_WORK as b, selectSections as bt, clearReviewChannel as c, loadUsage as ct, sweepReviewChannelSessions as d, normalizeUsageRecord as dt, bumpView as et, PATTERN_OVERLAP as f, saveSuppressedNames as ft, scanMemoryThreats as g, usageFile as gt, scanContentThreats as h, updateSuppressedNames as ht, assessStructureHealth as i, getRecord as it, parseEvolutionEvents as j, parseFrontmatter as jt, evolutionEventPayloadIssue as k, frontmatterCatalogInvalid as kt, isReviewChannelSession as l, markAgentCreated as lt, evaluateThreat as m, suppressedFile as mt, HEALTH_STAMP_RE as n, emptyRecord as nt, currentReviewContext as o, latestActivityAt as ot, THREAT_EXEMPTION_HINT as p, saveUsage as pt, MAX_SUPPORT_READ_PATHS as q, sessionReadSupportFiles as qt, MIN_STAMP_BODY_CHARS as r, foldCuratorFields as rt, withReviewContext as s, loadSuppressedNames as st, DEFAULT_HEALTH_THRESHOLDS as t, daysSinceIso as tt, markReviewChannel as u, mutateUsage as ut, makeSerialQueue as v, planExtract as vt, EVENT_LOG_RETAIN_ARCHIVES as w, restructureCandidates as wt, fuzzyPatch as x, displayBodyOf as xt, FUZZY_MAX_PATTERN_CHARS as y, projectExtractBodies as yt, COST_ASCII_TOKEN_HIGH as z, applyReferenceRewrite as zt };