@lmzhen/dsh-evolution-core 0.47.0 → 0.49.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 (60) hide show
  1. package/lib/authority-plugin.js +1 -1
  2. package/lib/index.js +27 -136
  3. package/lib/{io-BCBSr6Ot.js → io-GxghO3Ip.js} +30 -8
  4. package/lib/io-node.js +1 -1
  5. package/lib/io-registry.js +1 -20
  6. package/lib/{mutation-authority-CM6wRgyK.js → mutation-authority-l57R626O.js} +14 -2
  7. package/lib/{mutations-DihgpfgG.js → mutations-DQXddSJd.js} +1 -1
  8. package/lib/{numeric-DLeLvvGb.js → numeric-D8js3sqC.js} +1 -5
  9. package/lib/platform/index.js +1 -1
  10. package/lib/{platform-CFA12Jam.js → platform-Cc9cNt5j.js} +4 -28
  11. package/lib/policy.js +1 -1
  12. package/lib/runtime/plugin.js +21 -43
  13. package/lib/{session-projection-BhlDXqws.js → session-projection-DSXnUNZG.js} +1 -19
  14. package/lib/{skill-health-BzkUQDi7.js → skill-health-DP8z9TPf.js} +3 -3
  15. package/lib/{skill-history-RWt1-kbZ.js → skill-history-CxrDE3Rb.js} +43 -51
  16. package/lib/skills.js +165 -183
  17. package/lib/types/authority.d.ts +2 -0
  18. package/lib/types/authority.js +5 -0
  19. package/lib/types/constants.d.ts +0 -4
  20. package/lib/types/constants.js +0 -4
  21. package/lib/types/contract.d.ts +0 -5
  22. package/lib/types/health-baseline.d.ts +0 -13
  23. package/lib/types/health-baseline.js +0 -20
  24. package/lib/types/home-fence.d.ts +2 -0
  25. package/lib/types/home-fence.js +11 -1
  26. package/lib/types/io-registry.d.ts +0 -16
  27. package/lib/types/io-registry.js +0 -24
  28. package/lib/types/io.d.ts +6 -1
  29. package/lib/types/io.js +35 -9
  30. package/lib/types/long-runs.d.ts +0 -5
  31. package/lib/types/long-runs.js +0 -7
  32. package/lib/types/memory-store.js +13 -5
  33. package/lib/types/mutation-authority.js +5 -0
  34. package/lib/types/mutation-unit.d.ts +1 -1
  35. package/lib/types/mutation-unit.js +9 -27
  36. package/lib/types/params.d.ts +11 -29
  37. package/lib/types/params.js +13 -60
  38. package/lib/types/platform/llm.d.ts +2 -3
  39. package/lib/types/platform/llm.js +3 -10
  40. package/lib/types/platform/projections.d.ts +4 -5
  41. package/lib/types/platform/projections.js +4 -18
  42. package/lib/types/runtime/llm.js +2 -2
  43. package/lib/types/runtime/platform.d.ts +7 -11
  44. package/lib/types/runtime/platform.js +13 -19
  45. package/lib/types/runtime/plugin.d.ts +1 -1
  46. package/lib/types/runtime/plugin.js +6 -4
  47. package/lib/types/runtime/projections.js +1 -2
  48. package/lib/types/skill-health.d.ts +29 -1
  49. package/lib/types/skill-store.d.ts +6 -0
  50. package/lib/types/skill-store.js +130 -142
  51. package/lib/types/tool-dispatch.d.ts +1 -16
  52. package/lib/types/tool-dispatch.js +0 -18
  53. package/lib/types/unit-journal.js +19 -12
  54. package/lib/types/write-inventory.d.ts +0 -15
  55. package/lib/types/write-inventory.js +0 -25
  56. package/lib/types/write-kernel.d.ts +3 -4
  57. package/lib/types/write-kernel.js +13 -25
  58. package/lib/write.js +2 -2
  59. package/package.json +1 -1
  60. package/persisted-write-inventory.json +31 -13
@@ -1,4 +1,4 @@
1
- import { c as evolutionHome, t as MutationAuthority } from "./mutation-authority-CM6wRgyK.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"];
package/lib/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { _ as probePresent, a as nodeEvolutionIo, b as probeUnknown, c as writeDurableTmp, d as isMissingPath, f as isPresent, g as probeMtime, h as probeList, i as isProcessAlive, l as declaredReportStamp, m as probeAbsent, n as evolutionIoAdapter, o as renameWithRetry, p as isUnknown, r as isCommittedWarning, s as transactIo, t as atomicWriteFiles, u as isAbsent, v as probeReason, x as reportTime, y as probeText } from "./io-BCBSr6Ot.js";
2
- import { a as leaseFile, c as evolutionHome, d as AuthorityOrderError, f as AuthorityReentryError, h as leaseAsTreeLock, i as LeaseStore, l as evolutionRoot, m as authorityHolder, n as mutationLockFrom, o as HomeFence, p as HomeAuthority, r as DEFAULT_LEASE_TTL_MS, s as HomeFenceError, t as MutationAuthority, u as AuthorityBusyError } from "./mutation-authority-CM6wRgyK.js";
3
- import { A as countDispatches, B as supportFileReadFromPath, C as PTC_DISPATCH_EVENT, D as assertDispatchPayload, E as ToolDispatchPayloadError, F as isProgramToolName, G as KEEP_LINE_RE, H as CITATION_SUPPORT_DIRS, I as isSkillReadToolName, J as scanBodyHooks, K as isFileShapedPath, L as isSkillToolName, M as dispatchPathOf, N as dispatchStepOf, O as collectReadSkillNames, P as foldToolDispatches, R as readDispatchSignal, S as NATIVE_RESULT_EVENT, T as ToolDispatchNormalizer, U as DEFAULT_CITATION_REF_BUDGET, V as supportFileReadOf, W as HOOK_LINE_RE, _ as isBookkeepingFrame, a as evolutionSignalsProjection, b as MODEL_SESSION_EVENT_TYPES, c as sessionLastEventTime, d as advanceReview, f as foldTurnEvent, g as evidenceKindIndex, h as observeEvent, i as evolutionReadsProjection, j as dispatchKeyOf, k as collectReadSupportFiles, l as sessionReadNames, m as initialTurnFold, n as evolutionEvidenceProjection, o as isProjectableSession, p as foldTurnEvents, q as resolveCitations, r as evolutionProjectionHistoryProjection, s as sessionEvidenceIndex, t as evolutionActivityProjection, u as sessionTurnSignals, v as DEFAULT_SUPPORT_READ_TOOL_NAMES, w as PTC_DISPATCH_START_EVENT, x as NATIVE_CALL_EVENT, y as DISPATCH_EVENT_TYPES, z as skillReadNameOf } from "./session-projection-BhlDXqws.js";
4
- import { $ as UPSTREAM_LIMIT_CHARS_PER_TOKEN, A as DEFAULT_STALE_AFTER_DAYS, B as MAX_SKILL_CONTENT_CHARS, C as DEFAULT_REVIEW_MESSAGE_CHARS, D as DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, E as DEFAULT_SKILL_CONTENT_CHARS, F as DEFAULT_USER_CHAR_LIMIT, G as PLATFORM_CATALOG_DESCRIPTION_DEFAULT, H as MAX_SKILL_NAME_LENGTH, I as ENTRY_DELIMITER, J as SKILLS_GUIDANCE_SECTION_ORDER, K as PLATFORM_ESTIMATE_CHARS_PER_TOKEN, L as EVOLUTION_WRITE_TOOLS, M as DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, N as DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, O as DEFAULT_SKILL_REVIEW_TRIGGER, P as DEFAULT_THREAT_MAX_SCAN_CHARS, Q as SUPPORT_SPRAWL_FILES, R as FORBIDDEN_CONTROL_KEYS, S as DEFAULT_REVIEW_MEMORY_INTERVAL, T as DEFAULT_REVIEW_TIMEOUT_MS, U as MAX_TIMER_DELAY_MS, V as MAX_SKILL_FILE_BYTES, W as MEMORY_GUIDANCE_SECTION_ORDER, X as SKILL_NAME_RE, Y as SKILL_ACTION_REQUIRED_FIELDS, Z as SUPPORT_DIRS, _ as DEFAULT_CURATOR_REVIEW_MAX_TOKENS, a as DEFAULT_SKILL_LIMITS, b as DEFAULT_PROBE_TIMEOUT_MS, c as policyStageLimits, d as CONTENT_SPLIT_HINT, f as DEFAULT_ARCHIVE_AFTER_DAYS, g as DEFAULT_CURATOR_MODEL, h as DEFAULT_CURATOR_INTERVAL_HOURS, i as DEFAULT_REFERENCE_REWRITE_POLICY, j as DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, k as DEFAULT_SKILL_VERSION_KEEP, l as AUTHORING_DESCRIPTION_BAR, m as DEFAULT_CURATOR_BOOT_GRACE_SECONDS, n as DEFAULT_ARCHIVE_RETENTION_POLICY, o as DEFAULT_SUPPORT_FILE_CHAR_POLICY, p as DEFAULT_CONSOLIDATION_FAILURES, q as PROTECTED_BUILTIN_SKILLS, r as DEFAULT_CITATION_POLICY, s as POLICY_STAGE_DEFAULTS, t as clampedNumber, u as AUTHORING_SPLIT_LINE_CHARS, v as DEFAULT_MEMORY_CHAR_LIMIT, w as DEFAULT_REVIEW_SKILL_INTERVAL, x as DEFAULT_REVIEW_CONTEXT_MESSAGES, y as DEFAULT_MIN_IDLE_HOURS, z as MAX_DESCRIPTION_LENGTH } from "./numeric-DLeLvvGb.js";
1
+ import { S as reportTime, _ as probeMtime, a as isProcessAlive, b as probeText, c as transactIo, d as isAbsent, f as isMissingPath, g as probeList, h as probeAbsent, i as isCommittedWarning, l as writeDurableTmp, m as isUnknown, n as atomicWriteFiles, o as nodeEvolutionIo, p as isPresent, r as evolutionIoAdapter, s as renameWithRetry, t as TransactionNotInvokedError, u as declaredReportStamp, v as probePresent, x as probeUnknown, y as probeReason } from "./io-GxghO3Ip.js";
2
+ import { a as leaseFile, c as evolutionHome, d as AuthorityOrderError, f as AuthorityReentryError, h as leaseAsTreeLock, i as LeaseStore, l as evolutionRoot, m as authorityHolder, n as mutationLockFrom, o as HomeFence, p as HomeAuthority, r as DEFAULT_LEASE_TTL_MS, s as HomeFenceError, t as MutationAuthority, u as AuthorityBusyError } from "./mutation-authority-l57R626O.js";
3
+ import { A as dispatchKeyOf, B as CITATION_SUPPORT_DIRS, C as PTC_DISPATCH_EVENT, D as assertDispatchPayload, E as ToolDispatchPayloadError, F as isSkillToolName, G as resolveCitations, H as HOOK_LINE_RE, I as readDispatchSignal, K as scanBodyHooks, L as skillReadNameOf, M as dispatchStepOf, N as foldToolDispatches, O as collectReadSkillNames, P as isSkillReadToolName, R as supportFileReadFromPath, S as NATIVE_RESULT_EVENT, T as ToolDispatchNormalizer, U as KEEP_LINE_RE, V as DEFAULT_CITATION_REF_BUDGET, W as isFileShapedPath, _ as isBookkeepingFrame, a as evolutionSignalsProjection, b as MODEL_SESSION_EVENT_TYPES, c as sessionLastEventTime, d as advanceReview, f as foldTurnEvent, g as evidenceKindIndex, h as observeEvent, i as evolutionReadsProjection, j as dispatchPathOf, k as collectReadSupportFiles, l as sessionReadNames, m as initialTurnFold, n as evolutionEvidenceProjection, o as isProjectableSession, p as foldTurnEvents, r as evolutionProjectionHistoryProjection, s as sessionEvidenceIndex, t as evolutionActivityProjection, u as sessionTurnSignals, v as DEFAULT_SUPPORT_READ_TOOL_NAMES, w as PTC_DISPATCH_START_EVENT, x as NATIVE_CALL_EVENT, y as DISPATCH_EVENT_TYPES, z as supportFileReadOf } from "./session-projection-DSXnUNZG.js";
4
+ import { A as DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, B as MAX_SKILL_NAME_LENGTH, C as DEFAULT_REVIEW_TIMEOUT_MS, D as DEFAULT_SKILL_VERSION_KEEP, E as DEFAULT_SKILL_REVIEW_TRIGGER, F as EVOLUTION_WRITE_TOOLS, G as SKILL_ACTION_REQUIRED_FIELDS, H as MEMORY_GUIDANCE_SECTION_ORDER, I as FORBIDDEN_CONTROL_KEYS, J as SUPPORT_SPRAWL_FILES, K as SKILL_NAME_RE, L as MAX_DESCRIPTION_LENGTH, M as DEFAULT_THREAT_MAX_SCAN_CHARS, N as DEFAULT_USER_CHAR_LIMIT, O as DEFAULT_STALE_AFTER_DAYS, P as ENTRY_DELIMITER, R as MAX_SKILL_CONTENT_CHARS, S as DEFAULT_REVIEW_SKILL_INTERVAL, T as DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, U as PROTECTED_BUILTIN_SKILLS, V as MAX_TIMER_DELAY_MS, W as SKILLS_GUIDANCE_SECTION_ORDER, Y as UPSTREAM_LIMIT_CHARS_PER_TOKEN, _ as DEFAULT_CURATOR_REVIEW_MAX_TOKENS, a as DEFAULT_SKILL_LIMITS, b as DEFAULT_PROBE_TIMEOUT_MS, c as policyStageLimits, d as CONTENT_SPLIT_HINT, f as DEFAULT_ARCHIVE_AFTER_DAYS, g as DEFAULT_CURATOR_MODEL, h as DEFAULT_CURATOR_INTERVAL_HOURS, i as DEFAULT_REFERENCE_REWRITE_POLICY, j as DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, k as DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, l as AUTHORING_DESCRIPTION_BAR, m as DEFAULT_CURATOR_BOOT_GRACE_SECONDS, n as DEFAULT_ARCHIVE_RETENTION_POLICY, o as DEFAULT_SUPPORT_FILE_CHAR_POLICY, p as DEFAULT_CONSOLIDATION_FAILURES, q as SUPPORT_DIRS, r as DEFAULT_CITATION_POLICY, s as POLICY_STAGE_DEFAULTS, t as clampedNumber, u as AUTHORING_SPLIT_LINE_CHARS, v as DEFAULT_MEMORY_CHAR_LIMIT, w as DEFAULT_SKILL_CONTENT_CHARS, x as DEFAULT_REVIEW_MEMORY_INTERVAL, y as DEFAULT_MIN_IDLE_HOURS, z as MAX_SKILL_FILE_BYTES } from "./numeric-D8js3sqC.js";
5
5
  import { c as MAINTAINER_PRESET_ID, d as RESTRICTOR_MODULE, f as REVIEWER_PRESET_ID, g as scopedPackageName, h as scopeOfNearestManifest, l as RESTRICTED_PRESET_DISPLAY, s as EVOLUTION_PRESET_IDS, u as RESTRICTED_TOOLS_ROW_ID } from "./ensure-CAjLGd9f.js";
6
- import { $ as bumpView, A as listEventArchives, B as COST_CJK_TOKEN_HIGH, Bt as planRehoming, C as EVENT_ARCHIVE_PREFIX, D as appendEvolutionEvent, E as EVENT_LOG_VERSION, F as RULES, Ft as externalRefs, G as tokenLineFor, H as TOKEN_ASCII_WEIGHT, It as supportRefs, J as applyCuratorLifecycleFields, Jt as authorityFrom, K as MAX_SUPPORT_READ_PATHS, Kt as DEFAULT_WRITE_CONFIRM_MODE, L as lintSkill, Lt as applyReferenceRewrite, M as readEvolutionEvents, N as readEvolutionTimeline, O as eventsFile, P as retainEventArchives, Q as bumpUse, R as COST_ASCII_TOKEN_HIGH, Rt as describeReferenceRewrite, S as trimPatternBoundaries, St as readingStats, T as EVENT_LOG_ROTATE_AT, U as TOKEN_CJK_WEIGHT, Ut as isUnreadWrite, V as COST_CJK_TOKEN_LOW, W as bodyCost, X as bumpPatch, Y as applyCuratorMetaFields, Z as bumpSupportRead, _ as scanThreats, _t as planExtract, at as latestActivityAt, b as FUZZY_MAX_WORK, bt as displayBodyOf, c as clearReviewChannel, ct as markAgentCreated, d as sweepReviewChannelSessions, dt as saveSuppressedNames, et as daysSinceIso, f as PATTERN_OVERLAP, ft as saveUsage, g as scanMemoryThreats, gt as usageObserved, h as scanContentThreats, ht as usageFile, i as assessStructureHealth, it as idleDays, j as parseEvolutionEvents, k as evolutionEventPayloadIssue, kt as parseFrontmatter, l as isReviewChannelSession, lt as mutateUsage, m as evaluateThreat, mt as updateSuppressedNames, nt as foldCuratorFields, o as currentReviewContext, ot as loadSuppressedNames, p as THREAT_EXEMPTION_HINT, pt as suppressedFile, q as SUPPRESSED_FILE_VERSION, qt as DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, rt as getRecord, s as withReviewContext, st as loadUsage, t as DEFAULT_HEALTH_THRESHOLDS, tt as emptyRecord, u as markReviewChannel, ut as normalizeUsageRecord, v as makeSerialQueue, vt as projectExtractBodies, w as EVENT_LOG_RETAIN_ARCHIVES, x as fuzzyPatch, xt as h2Sections, y as FUZZY_MAX_PATTERN_CHARS, yt as selectSections, z as COST_ASCII_TOKEN_LOW, zt as planReferenceRewrite } from "./skill-health-BzkUQDi7.js";
6
+ import { $ as bumpView, A as listEventArchives, B as COST_CJK_TOKEN_HIGH, Bt as planRehoming, C as EVENT_ARCHIVE_PREFIX, D as appendEvolutionEvent, E as EVENT_LOG_VERSION, F as RULES, Ft as externalRefs, G as tokenLineFor, H as TOKEN_ASCII_WEIGHT, It as supportRefs, J as applyCuratorLifecycleFields, Jt as authorityFrom, K as MAX_SUPPORT_READ_PATHS, Kt as DEFAULT_WRITE_CONFIRM_MODE, L as lintSkill, Lt as applyReferenceRewrite, M as readEvolutionEvents, N as readEvolutionTimeline, O as eventsFile, P as retainEventArchives, Q as bumpUse, R as COST_ASCII_TOKEN_HIGH, Rt as describeReferenceRewrite, S as trimPatternBoundaries, St as readingStats, T as EVENT_LOG_ROTATE_AT, U as TOKEN_CJK_WEIGHT, Ut as isUnreadWrite, V as COST_CJK_TOKEN_LOW, W as bodyCost, X as bumpPatch, Y as applyCuratorMetaFields, Z as bumpSupportRead, _ as scanThreats, _t as planExtract, at as latestActivityAt, b as FUZZY_MAX_WORK, bt as displayBodyOf, c as clearReviewChannel, ct as markAgentCreated, d as sweepReviewChannelSessions, dt as saveSuppressedNames, et as daysSinceIso, f as PATTERN_OVERLAP, ft as saveUsage, g as scanMemoryThreats, gt as usageObserved, h as scanContentThreats, ht as usageFile, i as assessStructureHealth, it as idleDays, j as parseEvolutionEvents, k as evolutionEventPayloadIssue, kt as parseFrontmatter, l as isReviewChannelSession, lt as mutateUsage, m as evaluateThreat, mt as updateSuppressedNames, nt as foldCuratorFields, o as currentReviewContext, ot as loadSuppressedNames, p as THREAT_EXEMPTION_HINT, pt as suppressedFile, q as SUPPRESSED_FILE_VERSION, qt as DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, rt as getRecord, s as withReviewContext, st as loadUsage, t as DEFAULT_HEALTH_THRESHOLDS, tt as emptyRecord, u as markReviewChannel, ut as normalizeUsageRecord, v as makeSerialQueue, vt as projectExtractBodies, w as EVENT_LOG_RETAIN_ARCHIVES, x as fuzzyPatch, xt as h2Sections, y as FUZZY_MAX_PATTERN_CHARS, yt as selectSections, z as COST_ASCII_TOKEN_LOW, zt as planReferenceRewrite } from "./skill-health-DP8z9TPf.js";
7
7
  import { i as HOST_LOCALES, n as errorText, r as errorTextIn, t as EVOLUTION_ERRORS } from "./errors-BxzLTVbS.js";
8
8
  import { n as isRecord, t as asRecord } from "./guards-3f02mnf2.js";
9
- import { a as mutationsFile, i as loadMutations, n as MUTATIONS_FILE_VERSION, o as recordMutation, r as contentHash, t as DEFAULT_MUTATION_CAP } from "./mutations-DihgpfgG.js";
9
+ import { a as mutationsFile, i as loadMutations, n as MUTATIONS_FILE_VERSION, o as recordMutation, r as contentHash, t as DEFAULT_MUTATION_CAP } from "./mutations-DQXddSJd.js";
10
10
  import { HOST_ROUTES, MAX_REQUEST_BODY_BYTES, hostSurface, json, methodNotAllowed, readJsonObject, registerHostRoutes } from "./http-routes.js";
11
11
  import { w as allowRowCollisions } from "./composition-Cqjbho0t.js";
12
- import { u as scopeOf } from "./platform-CFA12Jam.js";
12
+ import { u as scopeOf } from "./platform-Cc9cNt5j.js";
13
13
  import { createSubagentChannel, probeChannelState } from "./subagent/index.js";
14
14
  import { readFile, realpath, stat } from "node:fs/promises";
15
15
  import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
@@ -1088,10 +1088,6 @@ async function readProposalReports(io, dir = proposalReportDir(), limit = 10) {
1088
1088
  }
1089
1089
  //#endregion
1090
1090
  //#region lib/types/health-baseline.js
1091
- const DEFAULT_ADMISSION = {
1092
- minUserHitRate: .05,
1093
- maxUserHitRate: .25
1094
- };
1095
1091
  function buildHealthBaseline(skills) {
1096
1092
  const values = {};
1097
1093
  for (const rule of RULES) values[rule.id] = {
@@ -1122,25 +1118,6 @@ function buildHealthBaseline(skills) {
1122
1118
  values
1123
1119
  };
1124
1120
  }
1125
- /** The admission verdict for ONE rule id (contract §4): platform corpus must not trip it, and the
1126
- * user-library hit rate must land inside the band. Every failure names the number it failed on. */
1127
- function admissionVerdict(baseline, ruleId, thresholds = DEFAULT_ADMISSION) {
1128
- const row = baseline.values[ruleId];
1129
- const failures = [];
1130
- if (row === void 0) return {
1131
- admitted: false,
1132
- failures: ["rule " + ruleId + " has no baseline row"]
1133
- };
1134
- if (baseline.corpora.platform === 0) failures.push("no platform-corpus skills measured — a vacuous 0-hit count admits any rule");
1135
- else if (row.platformHits !== 0) failures.push("platform corpus trips " + ruleId + " " + String(row.platformHits) + " time(s) — a rule the shipped library violates is unsatisfiable");
1136
- if (baseline.corpora.user === 0) failures.push("no user-library skills measured — a rate over an empty corpus proves nothing");
1137
- else if (row.userHitRate < thresholds.minUserHitRate) failures.push(ruleId + " hits " + row.userHitRate.toFixed(3) + " of the user library, below " + String(thresholds.minUserHitRate) + " — too rare to be worth a rule");
1138
- else if (row.userHitRate > thresholds.maxUserHitRate) failures.push(ruleId + " hits " + row.userHitRate.toFixed(3) + " of the user library, above " + String(thresholds.maxUserHitRate) + " — furniture, no signal");
1139
- return {
1140
- admitted: failures.length === 0,
1141
- failures
1142
- };
1143
- }
1144
1121
  //#endregion
1145
1122
  //#region lib/types/gates.js
1146
1123
  /**
@@ -1766,8 +1743,12 @@ var MemoryStore = class {
1766
1743
  return step.write ?? current ?? null;
1767
1744
  });
1768
1745
  };
1769
- if (this.fence !== void 0) await this.fence.run(run);
1770
- else await run();
1746
+ try {
1747
+ if (this.fence !== void 0) await this.fence.run(run);
1748
+ else await run();
1749
+ } catch (error) {
1750
+ if (!(error instanceof TransactionNotInvokedError)) throw error;
1751
+ }
1771
1752
  return outcome ?? {
1772
1753
  ok: false,
1773
1754
  message: "内部错误:记忆写事务没有调用任务;未执行任何写入",
@@ -3207,13 +3188,6 @@ const LONG_RUNS = [
3207
3188
  note: "The write leg replays a staged plan through the registered runner; cancellation follows the plugin fiber."
3208
3189
  }
3209
3190
  ];
3210
- /**
3211
- * Render the inventory as the README table rows (no header).
3212
- * @returns one markdown row per entry, in inventory order.
3213
- */
3214
- function renderLongRunTable() {
3215
- return LONG_RUNS.map((entry) => `| \`${entry.id}\` | ${entry.kind} | ${entry.owner} | ${entry.lifetime} | ${entry.measured} | ${entry.resultHome} |`).join("\n");
3216
- }
3217
3191
  //#endregion
3218
3192
  //#region lib/types/platform-services.js
3219
3193
  /**
@@ -3566,7 +3540,6 @@ const INSTANCE_KEYS = {
3566
3540
  /** The per-home curator: report writing + the retention sweep. */
3567
3541
  curator: "evolution-curator" };
3568
3542
  let cachedSites;
3569
- let cachedSymbols;
3570
3543
  /**
3571
3544
  * The declared persisted write sites, in file order.
3572
3545
  *
@@ -3592,31 +3565,8 @@ function persistedWriteSites() {
3592
3565
  }
3593
3566
  const table = parseTable(JSON.parse(raw));
3594
3567
  cachedSites = table.sites;
3595
- cachedSymbols = table.symbols;
3596
3568
  return table.sites;
3597
3569
  }
3598
- /** The inventory's symbol legend — the roots every declared path is written against, with the
3599
- * segments the gate checks against the resolver's source.
3600
- * @internal no production caller — the gates read the JSON asset directly. */
3601
- function writePathSymbols() {
3602
- persistedWriteSites();
3603
- return cachedSymbols ?? {};
3604
- }
3605
- /** Sites serialized by the per-home instance claim, with their instance keys.
3606
- * @internal S2.4 (PLAN 2026-09-16): no production caller — the arch guard
3607
- * reads the JSON asset directly; the tests are the only in-tree consumers. */
3608
- function instanceClaimedWriteSites() {
3609
- return persistedWriteSites().filter((site) => site.serializedBy === "instance-claim");
3610
- }
3611
- /** One declared site by id. An undeclared id throws — a stale caller must fail
3612
- * loud rather than read "nothing is declared".
3613
- * @internal S2.4 (PLAN 2026-09-16): no production caller — the arch guard
3614
- * reads the JSON asset directly; the tests are the only in-tree consumers. */
3615
- function persistedWriteSite(id) {
3616
- const site = persistedWriteSites().find((candidate) => candidate.id === id);
3617
- if (site === void 0) throw new Error(`evolution-core: no persisted write site "${id}" in persisted-write-inventory.json`);
3618
- return site;
3619
- }
3620
3570
  //#endregion
3621
3571
  //#region lib/types/scope.js
3622
3572
  function callingScope(ctx, held) {
@@ -4187,16 +4137,16 @@ async function backupsReachability(io, backupsRoot, skillsPerSnapshot) {
4187
4137
  * the SAME name in two carriers (reviewMode, staleAfterDays, archiveAfterDays —
4188
4138
  * resolved by the existing policy-shadows-row rule) and six use DIFFERENT names.
4189
4139
  * This module owns the six: the policy/snapshot name is the canonical id, the
4190
- * plugin-row name is a deprecated alias kept readable since 0.6.x. Removal was
4191
- * planned for 0.7.0 and is deferred: the aliases still ship, so no later version
4192
- * is claimed here.
4140
+ * plugin-row name is a deprecated alias. The alias table survives only for the one-time
4141
+ * legacy-document migration and the doctor's old-key report; live readers use the
4142
+ * canonical id and its carrier no longer falls back to the legacy spelling.
4193
4143
  *
4194
- * Reading stays compatible (a carrier still spelling the legacy name resolves),
4195
- * writing is strict (the write path accepts canonical ids only, so no new
4196
- * document is created under a deprecated name).
4144
+ * Writing is canonical-only (a deprecated name is not a live row field in 0.48).
4197
4145
  * @module
4198
4146
  */
4199
- /** Deprecated alias (plugin-row name) -> canonical id (policy/snapshot name). */
4147
+ /** Deprecated alias (plugin-row name) -> canonical id (policy/snapshot name).
4148
+ * Retained for the one-time legacy-document migration and the doctor's old-key report;
4149
+ * live readers use the canonical id only. */
4200
4150
  const PARAM_ALIASES = Object.freeze({
4201
4151
  memoryInterval: "reviewMemoryInterval",
4202
4152
  skillInterval: "reviewSkillInterval",
@@ -4205,12 +4155,6 @@ const PARAM_ALIASES = Object.freeze({
4205
4155
  memoryCharLimit: "memoryChars",
4206
4156
  userCharLimit: "userChars"
4207
4157
  });
4208
- /** Canonical ids that have at least one deprecated alias, for read fallback. */
4209
- const ALIASES_BY_CANONICAL = (() => {
4210
- const index = {};
4211
- for (const [alias, canonical] of Object.entries(PARAM_ALIASES)) (index[canonical] ??= []).push(alias);
4212
- return index;
4213
- })();
4214
4158
  /**
4215
4159
  * Resolve any parameter id to its canonical form.
4216
4160
  * @param id - canonical id or deprecated alias.
@@ -4228,28 +4172,14 @@ function isDeprecatedParamId(id) {
4228
4172
  return PARAM_ALIASES[id] !== void 0;
4229
4173
  }
4230
4174
  /**
4231
- * Guard for the write path: only canonical ids may be written.
4232
- * @param id - parameter id a caller intends to write.
4233
- * @returns the canonical id.
4234
- * @throws {Error} when the id is a deprecated alias; the message names both ids.
4235
- */
4236
- function canonicalWriteId(id) {
4237
- const canonical = PARAM_ALIASES[id];
4238
- if (canonical === void 0) return id;
4239
- throw new Error(`parameter id \`${id}\` is deprecated; write \`${canonical}\` instead`);
4240
- }
4241
- /**
4242
- * Read a parameter from a carrier that may still spell the legacy name.
4175
+ * Read a parameter by its canonical id.
4243
4176
  * @param carrier - config/snapshot object to read from, or undefined.
4244
- * @param id - canonical id (a deprecated alias is accepted and resolved first).
4245
- * @returns the canonical value when present, else the alias value, else undefined.
4177
+ * @param id - canonical id (an alias is resolved first, for migration callers).
4178
+ * @returns the canonical value, or undefined.
4246
4179
  */
4247
4180
  function readParam(carrier, id) {
4248
4181
  if (carrier === void 0) return void 0;
4249
- const record = carrier;
4250
- const canonical = resolveParamId(id);
4251
- if (record[canonical] !== void 0) return record[canonical];
4252
- for (const alias of ALIASES_BY_CANONICAL[canonical] ?? []) if (record[alias] !== void 0) return record[alias];
4182
+ return carrier[resolveParamId(id)];
4253
4183
  }
4254
4184
  /**
4255
4185
  * Chinese display name per group, one entry per line (the scripts read this block
@@ -5467,21 +5397,9 @@ const PARAM_EXPOSURE = Object.freeze([
5467
5397
  owner: "scripts",
5468
5398
  applies: "restart",
5469
5399
  docAnchor: "PARAMETERS.md#deployment",
5470
- summary: "Install target plane (values all / host; the legacy layered preset path is internal-only).",
5400
+ summary: "Install target plane (values all / host; legacy modes are uninstall-only in 0.48).",
5471
5401
  why: "install"
5472
5402
  },
5473
- {
5474
- id: "install.basePreset",
5475
- group: "deployment",
5476
- tier: "E4",
5477
- authority: "install",
5478
- owner: "scripts",
5479
- applies: "restart",
5480
- docAnchor: "PARAMETERS.md#deployment",
5481
- summary: "Agent-preset base the layered install composes from (--base).",
5482
- why: "install",
5483
- consumer: "basePresetPlugins"
5484
- },
5485
5403
  {
5486
5404
  id: "install.home",
5487
5405
  group: "deployment",
@@ -5493,18 +5411,6 @@ const PARAM_EXPOSURE = Object.freeze([
5493
5411
  summary: "Harness home the installer writes into (--home).",
5494
5412
  why: "install"
5495
5413
  },
5496
- {
5497
- id: "install.presetRowOverrides",
5498
- group: "deployment",
5499
- tier: "E4",
5500
- authority: "install",
5501
- owner: "scripts",
5502
- applies: "restart",
5503
- docAnchor: "PARAMETERS.md#deployment",
5504
- summary: "Preset row overrides the installer injects (row-overrides.json).",
5505
- why: "install",
5506
- consumer: "loadRowOverrides"
5507
- },
5508
5414
  {
5509
5415
  id: "mergeApproval",
5510
5416
  group: "merge",
@@ -5597,28 +5503,13 @@ const NAMESPACE_MIGRATIONS = Object.freeze(Object.entries(PARAM_NAMESPACES).filt
5597
5503
  rowId: owner
5598
5504
  })));
5599
5505
  /**
5600
- * The LEGACY settings namespace one owner package used to register through the family's
5601
- * own seam (0.1.x). It is no longer what the platform calls the section: the platform
5602
- * derives a settings namespace from the Loader entry id, and this registry's `owner` field
5603
- * IS that row id, so a live lookup uses {@link paramRowId}. What remains here is the
5604
- * migration SOURCE (G3 moves a user layer out of this string and into the row id).
5605
- * @param owner - owner package directory name (the map's key).
5606
- * @returns the legacy namespace that owner registered.
5607
- * @throws when the owner has no entry in {@link PARAM_NAMESPACES}.
5608
- */
5609
- function paramNamespace(owner) {
5610
- const namespace = PARAM_NAMESPACES[owner];
5611
- if (namespace === void 0) throw new Error("no settings namespace registered for owner `" + owner + "` (add it to PARAM_NAMESPACES)");
5612
- return namespace;
5613
- }
5614
- /**
5615
5506
  * The settings id one row's user layer lives under, or undefined when the owner publishes
5616
5507
  * no user layer at all (a deployment-only row: its knobs are E2 and never reach a settings
5617
5508
  * section). The platform derives a settings namespace from the Loader entry id and reports
5618
5509
  * it in `settings.describe()` / `configForms.get(entryId)`, and an owner package's row id is
5619
5510
  * its own name — spelled the same in every bundle patch.
5620
5511
  *
5621
- * This is the id to LOOK UP with; {@link paramNamespace} keeps the legacy string the 0.1.x
5512
+ * This is the id to LOOK UP with; {@link PARAM_NAMESPACES} keeps the legacy string the 0.1.x
5622
5513
  * seam registered, which is the G3 migration source and never a live lookup key.
5623
5514
  * @param owner - owner package directory name (the row id).
5624
5515
  * @returns the entry id the platform reports for that row, or undefined for a row without
@@ -6091,4 +5982,4 @@ function classifySessionEvent(event) {
6091
5982
  return MODEL_EVENT_TYPES.has(type) ? "model" : "unknown";
6092
5983
  }
6093
5984
  //#endregion
6094
- export { AUTHORING_DESCRIPTION_BAR, AUTHORING_SPLIT_LINE_CHARS, AuthorityBusyError, AuthorityOrderError, AuthorityReentryError, CITATION_SUPPORT_DIRS, 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_LEASE_TTL_MS, 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, HOOK_LINE_RE, HOST_LOCALES, HOST_ROUTES, HomeAuthority, HomeFence, HomeFenceError, INJECT_COMBINED_REVIEW_PROMPT, INJECT_COMPLETION_SKILL_REVIEW_PROMPT, INJECT_MEMORY_REVIEW_PROMPT, INJECT_SKILL_REVIEW_PROMPT, INSTANCE_KEYS, KEEP_LINE_RE, LONG_RUNS, LOW_QUALITY_THRESHOLD, LeaseStore, MAINTAINER_PRESET_ID, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_REQUEST_BODY_BYTES, 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, MODEL_SESSION_EVENT_TYPES, MUTATIONS_FILE_VERSION, MemoryStore, MutationAuthority, 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, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, REVIEWER_PRESET_ID, RUNS_SCHEMA_VERSION, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, STORE_LEDGER, SUMMARY_DUPLICATE_HINT_THRESHOLD, SUPPORT_DIRS, SUPPORT_SPRAWL_FILES, SUPPRESSED_FILE_VERSION, THREAT_EXEMPTION_HINT, TOKEN_ASCII_WEIGHT, TOKEN_CJK_WEIGHT, ToolDispatchNormalizer, ToolDispatchPayloadError, UPSTREAM_LIMIT_CHARS_PER_TOKEN, absentHostServices, admissionVerdict, advanceReview, affinity, allowRowCollisions, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, atomicWriteFiles, authorityFrom, authorityHolder, backupsReachability, bodyCost, buildCuratorRunReport, buildExtractPlanFromLibrary, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, canonicalWriteId, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, countDispatches, createGateSet, createSubagentChannel, currentReviewContext, daysSinceIso, declaredReportStamp, describeReferenceRewrite, dispatchKeyOf, dispatchPathOf, dispatchStepOf, displayBodyOf, duplicateHeadings, emptyRecord, errorText, errorTextIn, evaluateThreat, eventsFile, evidenceKindIndex, evolutionActivityProjection, evolutionEventPayloadIssue, evolutionEvidenceProjection, evolutionHome, evolutionIoAdapter, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionRoot, evolutionSignalsProjection, externalRefs, findDriftSignal, findOwnerCandidate, foldCuratorFields, foldToolDispatches, foldTurnEvent, foldTurnEvents, fuzzyPatch, getRecord, h2Sections, historyReachability, hostSurface, identity, idleDays, initialTurnFold, instanceClaimKey, instanceClaimedWriteSites, instanceHolder, isAbsent, isBookkeepingFrame, isCommittedWarning, isDeprecatedParamId, isFileShapedPath, isMissingPath, isPresent, isProcessAlive, isProgramToolName, isProjectableSession, isRecord, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, json, latestActivityAt, leaseAsTreeLock, leaseFile, lifecycleCandidate, listEventArchives, liveBool, liveNumber, loadMutations, loadSuppressedNames, loadUsage, makeSerialQueue, markAgentCreated, markReviewChannel, memoryRoot, methodNotAllowed, missingSupportPointers, mutateUsage, mutationLockFrom, mutationsFile, narrowNameMatches, nearDuplicateSummaries, newRunRegistry, nodeEvolutionIo, normalizeUsageRecord, observeEvent, overlongLines, ownerCandidatesFromSummaries, ownerDecisionText, paramNamespace, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, payloadText, persistedWriteSite, persistedWriteSites, pickWithPolicy, planExtract, planNamespaceMigration, planReferenceRewrite, planRehoming, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectExtractBodies, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readJsonObject, readNumberParam, readParam, readProposalReport, readProposalReports, readingStats, recordMutation, redactSecrets, referencedBlobs, registerHostRoutes, releaseInstance, renameWithRetry, renderCuratorReportMarkdown, renderLongRunTable, reportTime, reportsReachability, reportsSweepLockTarget, resolveCitations, resolveParamId, retainEventArchives, retirementReport, reviewPrompt, runWriteGates, runsFile, saveSuppressedNames, saveUsage, scanBodyHooks, scanContentThreats, scanMemoryThreats, scanThreats, scopeOfNearestManifest, scopedPackageName, scopedProbeReport, selectSections, sessionAudited, sessionEvidenceIndex, sessionLastEventTime, sessionReadNames, sessionSeesFamilyTools, sessionTurnSignals, skillReadNameOf, skillWriteGateContext, supportFileReadFromPath, supportFileReadOf, supportRefs, suppressedFile, sweepReports, sweepReviewChannelSessions, tokenLineFor, transactIo, trimPatternBoundaries, unhookedSupportPointers, unwrapLive, updateSuppressedNames, usageFile, usageObserved, userSetKeys, verifyPromptBundle, vocabulary, withReviewContext, withTreeWrite, writeDurableTmp, writePathSymbols, writeProposalReport };
5985
+ export { AUTHORING_DESCRIPTION_BAR, AUTHORING_SPLIT_LINE_CHARS, AuthorityBusyError, AuthorityOrderError, AuthorityReentryError, CITATION_SUPPORT_DIRS, 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_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_LEASE_TTL_MS, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_PROBE_TIMEOUT_MS, DEFAULT_REFERENCE_REWRITE_POLICY, DEFAULT_REVIEW_MEMORY_INTERVAL, 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, HOOK_LINE_RE, HOST_LOCALES, HOST_ROUTES, HomeAuthority, HomeFence, HomeFenceError, INJECT_COMBINED_REVIEW_PROMPT, INJECT_COMPLETION_SKILL_REVIEW_PROMPT, INJECT_MEMORY_REVIEW_PROMPT, INJECT_SKILL_REVIEW_PROMPT, INSTANCE_KEYS, KEEP_LINE_RE, LONG_RUNS, LOW_QUALITY_THRESHOLD, LeaseStore, MAINTAINER_PRESET_ID, MAINTAIN_OUTPUT_INSTRUCTION, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_REQUEST_BODY_BYTES, 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, MODEL_SESSION_EVENT_TYPES, MUTATIONS_FILE_VERSION, MemoryStore, MutationAuthority, NAMESPACE_MIGRATIONS, NATIVE_CALL_EVENT, NATIVE_RESULT_EVENT, PARAM_ALIASES, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, PATTERN_OVERLAP, 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, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, REVIEWER_PRESET_ID, RUNS_SCHEMA_VERSION, SKILLS_GUIDANCE, SKILLS_GUIDANCE_SECTION_ORDER, SKILL_ACTION_REQUIRED_FIELDS, SKILL_NAME_RE, SKILL_REVIEW_PROMPT, STORE_LEDGER, SUMMARY_DUPLICATE_HINT_THRESHOLD, SUPPORT_DIRS, SUPPORT_SPRAWL_FILES, SUPPRESSED_FILE_VERSION, THREAT_EXEMPTION_HINT, TOKEN_ASCII_WEIGHT, TOKEN_CJK_WEIGHT, ToolDispatchNormalizer, ToolDispatchPayloadError, TransactionNotInvokedError, UPSTREAM_LIMIT_CHARS_PER_TOKEN, absentHostServices, advanceReview, affinity, allowRowCollisions, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, atomicWriteFiles, authorityFrom, authorityHolder, backupsReachability, bodyCost, buildCuratorRunReport, buildExtractPlanFromLibrary, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, createSubagentChannel, currentReviewContext, daysSinceIso, declaredReportStamp, describeReferenceRewrite, dispatchKeyOf, dispatchPathOf, dispatchStepOf, displayBodyOf, duplicateHeadings, emptyRecord, errorText, errorTextIn, evaluateThreat, eventsFile, evidenceKindIndex, evolutionActivityProjection, evolutionEventPayloadIssue, evolutionEvidenceProjection, evolutionHome, evolutionIoAdapter, evolutionProjectionHistoryProjection, evolutionReadsProjection, evolutionRoot, evolutionSignalsProjection, externalRefs, findDriftSignal, findOwnerCandidate, foldCuratorFields, foldToolDispatches, foldTurnEvent, foldTurnEvents, fuzzyPatch, getRecord, h2Sections, historyReachability, hostSurface, identity, idleDays, initialTurnFold, instanceClaimKey, instanceHolder, isAbsent, isBookkeepingFrame, isCommittedWarning, isDeprecatedParamId, isFileShapedPath, isMissingPath, isPresent, isProcessAlive, isProjectableSession, isRecord, isReviewChannelSession, isSkillReadToolName, isSkillToolName, isUnknown, json, latestActivityAt, leaseAsTreeLock, leaseFile, lifecycleCandidate, listEventArchives, liveBool, liveNumber, loadMutations, loadSuppressedNames, loadUsage, makeSerialQueue, markAgentCreated, markReviewChannel, memoryRoot, methodNotAllowed, missingSupportPointers, mutateUsage, mutationLockFrom, mutationsFile, narrowNameMatches, nearDuplicateSummaries, newRunRegistry, nodeEvolutionIo, normalizeUsageRecord, observeEvent, overlongLines, ownerCandidatesFromSummaries, ownerDecisionText, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, payloadText, persistedWriteSites, pickWithPolicy, planExtract, planNamespaceMigration, planReferenceRewrite, planRehoming, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectExtractBodies, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readJsonObject, readNumberParam, readParam, readProposalReport, readProposalReports, readingStats, recordMutation, redactSecrets, referencedBlobs, registerHostRoutes, releaseInstance, renameWithRetry, renderCuratorReportMarkdown, reportTime, reportsReachability, reportsSweepLockTarget, resolveCitations, resolveParamId, retainEventArchives, retirementReport, reviewPrompt, runWriteGates, runsFile, saveSuppressedNames, saveUsage, scanBodyHooks, scanContentThreats, scanMemoryThreats, scanThreats, scopeOfNearestManifest, scopedPackageName, scopedProbeReport, selectSections, sessionAudited, sessionEvidenceIndex, sessionLastEventTime, sessionReadNames, sessionSeesFamilyTools, sessionTurnSignals, skillReadNameOf, skillWriteGateContext, supportFileReadFromPath, supportFileReadOf, supportRefs, suppressedFile, sweepReports, sweepReviewChannelSessions, tokenLineFor, transactIo, trimPatternBoundaries, unhookedSupportPointers, unwrapLive, updateSuppressedNames, usageFile, usageObserved, userSetKeys, verifyPromptBundle, vocabulary, withReviewContext, withTreeWrite, writeDurableTmp, writeProposalReport };
@@ -124,6 +124,14 @@ async function reportTime(io, path, parsed) {
124
124
  * Every evolution package passes `ctx.evolutionIo.provider()`; standalone
125
125
  * consumers (and the core's own tests) can use `nodeEvolutionIo`.
126
126
  */
127
+ /** A backend's transact returned without ever calling the task; nothing was written. */
128
+ var TransactionNotInvokedError = class extends Error {
129
+ code = "transact-not-invoked";
130
+ constructor(path) {
131
+ super("transact-not-invoked: " + path);
132
+ this.name = "TransactionNotInvokedError";
133
+ }
134
+ };
127
135
  /**
128
136
  * Run `task` inside `io.transact` when the backend provides it; otherwise fall
129
137
  * back to a plain read → task → write/remove sequence (no cross-process lock —
@@ -133,23 +141,36 @@ async function reportTime(io, path, parsed) {
133
141
  */
134
142
  async function transactIo(io, path, task) {
135
143
  const committedOnly = (error) => isCommittedWarning(error);
144
+ const warnings = [];
145
+ const warnCommitted = (error) => {
146
+ const message = error instanceof Error ? error.message : String(error);
147
+ warnings.push(message);
148
+ console.warn(`evolution-io: ${path} was written but its directory fsync failed — the bytes are visible, durability is unconfirmed: ${message}`);
149
+ };
150
+ let invoked = false;
151
+ const invoke = async (current) => {
152
+ invoked = true;
153
+ return await task(current);
154
+ };
136
155
  if (io.transact) try {
137
- await io.transact(path, task);
156
+ await io.transact(path, invoke);
157
+ if (!invoked) throw new TransactionNotInvokedError(path);
138
158
  return;
139
159
  } catch (error) {
140
160
  if (!committedOnly(error)) throw error;
141
- console.warn(`evolution-io: ${path} was written but its directory fsync failed — the bytes are visible, durability is unconfirmed: ${error instanceof Error ? error.message : String(error)}`);
142
- return;
161
+ warnCommitted(error);
162
+ return warnings;
143
163
  }
144
164
  const current = await io.readText(path);
145
- const next = await task(current);
165
+ const next = await invoke(current);
146
166
  if (next === null) await io.remove(path);
147
167
  else if (next !== current) try {
148
168
  await io.writeText(path, next);
149
169
  } catch (error) {
150
170
  if (!committedOnly(error)) throw error;
151
- console.warn(`evolution-io: ${path} was written but its directory fsync failed — the bytes are visible, durability is unconfirmed: ${error instanceof Error ? error.message : String(error)}`);
171
+ warnCommitted(error);
152
172
  }
173
+ return warnings.length === 0 ? void 0 : warnings;
153
174
  }
154
175
  /** Lazy adapter over an IO provider registry, shared by every evolution consumer. */
155
176
  function evolutionIoAdapter(provider) {
@@ -168,9 +189,10 @@ function evolutionIoAdapter(provider) {
168
189
  const io = provider();
169
190
  return io.size ? io.size(path) : Promise.resolve(null);
170
191
  },
171
- transact: (path, task) => {
192
+ transact: async (path, task) => {
172
193
  const io = provider();
173
- return io.transact ? io.transact(path, task) : transactIo(io, path, task);
194
+ if (io.transact) await io.transact(path, task);
195
+ else await transactIo(io, path, task);
174
196
  },
175
197
  isSymlink: (path) => {
176
198
  const io = provider();
@@ -623,4 +645,4 @@ function atomicWriteFiles(targetDir, writes, fs = defaultFs, logger = console.wa
623
645
  }
624
646
  }
625
647
  //#endregion
626
- export { probePresent as _, nodeEvolutionIo as a, probeUnknown as b, writeDurableTmp as c, isMissingPath as d, isPresent as f, probeMtime as g, probeList as h, isProcessAlive as i, declaredReportStamp as l, probeAbsent as m, evolutionIoAdapter as n, renameWithRetry as o, isUnknown as p, isCommittedWarning as r, transactIo as s, atomicWriteFiles as t, isAbsent as u, probeReason as v, reportTime as x, probeText as y };
648
+ export { reportTime as S, probeMtime as _, isProcessAlive as a, probeText as b, transactIo as c, isAbsent as d, isMissingPath as f, probeList as g, probeAbsent as h, isCommittedWarning as i, writeDurableTmp as l, isUnknown as m, atomicWriteFiles as n, nodeEvolutionIo as o, isPresent as p, evolutionIoAdapter as r, renameWithRetry as s, TransactionNotInvokedError as t, declaredReportStamp as u, probePresent as v, probeUnknown as x, probeReason as y };
package/lib/io-node.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as nodeEvolutionIo } from "./io-BCBSr6Ot.js";
1
+ import { o as nodeEvolutionIo } from "./io-GxghO3Ip.js";
2
2
  //#region lib/types/io-node.js
3
3
  /**
4
4
  * Local atomic node:fs IO provider.
@@ -58,24 +58,5 @@ var EvolutionIoRegistry = class extends Service {
58
58
  return first;
59
59
  }
60
60
  };
61
- /**
62
- * Resolve the seam implementation for a consumer, preferring a backend the deployment mounted.
63
- *
64
- * Contract C2 (declared gaps) has no other shape: a consumer that can work on either medium asks for
65
- * its preference and the DEPLOYMENT decides which backends exist. The lookup is contained here because
66
- * the registry deliberately has no presence probe (v20 A-3 removed `hasProvider`; a presence probe goes
67
- * through `provider(name)`, which fails loud) — so this function is the ONE sanctioned place that turns
68
- * that failure into a fallback. A caller that needs a SPECIFIC backend must call `provider(name)` and
69
- * take the error.
70
- * @param registry - the seam registry (`ctx.evolutionIo`).
71
- * @param names - preferred provider names, most preferred first.
72
- * @returns the first registered preference, else the registry default.
73
- */
74
- function preferProvider(registry, names) {
75
- for (const name of names) try {
76
- return registry.provider(name);
77
- } catch {}
78
- return registry.provider();
79
- }
80
61
  //#endregion
81
- export { EvolutionIoRegistry, EvolutionIoRegistry as default, preferProvider };
62
+ export { EvolutionIoRegistry, EvolutionIoRegistry as default };
@@ -1,4 +1,4 @@
1
- import { i as isProcessAlive, s as transactIo } from "./io-BCBSr6Ot.js";
1
+ import { a as isProcessAlive, c as transactIo } from "./io-GxghO3Ip.js";
2
2
  import { AsyncLocalStorage } from "node:async_hooks";
3
3
  import { mkdir, readFile, rm } from "node:fs/promises";
4
4
  import { dirname, join, resolve } from "node:path";
@@ -95,6 +95,11 @@ var HomeAuthority = class {
95
95
  if (context?.owner === this) return context.scopes.has(scope);
96
96
  return (this.held.get(scope) ?? 0) > 0;
97
97
  }
98
+ /** True only when THIS async call context already holds `scope` (re-entrant nesting). */
99
+ holdsInContext(scope) {
100
+ const context = CONTEXT.getStore();
101
+ return context?.owner === this && context.scopes.has(scope);
102
+ }
98
103
  /** True while this instance holds the home lock for any scope. */
99
104
  get holding() {
100
105
  return this.held.size > 0;
@@ -338,9 +343,15 @@ var HomeFence = class {
338
343
  get releaseFailure() {
339
344
  return this.authority.releaseFailure;
340
345
  }
346
+ /** True only when this async call context already holds the home tree scope. */
347
+ holdsTree() {
348
+ return this.authority.holdsInContext("tree");
349
+ }
341
350
  async run(body) {
351
+ const invoke = async () => await body(lockView(this.authority));
342
352
  try {
343
- return await this.authority.runExclusive("tree", async () => await body(lockView(this.authority)));
353
+ if (this.authority.holdsInContext("tree")) return await this.authority.runNested("tree", invoke);
354
+ return await this.authority.runExclusive("tree", invoke);
344
355
  } catch (error) {
345
356
  throw classify(error);
346
357
  }
@@ -498,6 +509,7 @@ var MutationAuthority = class {
498
509
  /** Adapter for MutationUnit call sites that accept a lock port. It is the fence, no more. */
499
510
  get mutationLock() {
500
511
  return { acquire: async () => {
512
+ if (this.fence.holdsTree()) return { release: async () => {} };
501
513
  const lease = await this.fence.acquire();
502
514
  return { release: async () => {
503
515
  await lease.release();
@@ -1,4 +1,4 @@
1
- import { a as nodeEvolutionIo, s as transactIo } from "./io-BCBSr6Ot.js";
1
+ import { c as transactIo, o as nodeEvolutionIo } from "./io-GxghO3Ip.js";
2
2
  import { n as isRecord } from "./guards-3f02mnf2.js";
3
3
  import { join } from "node:path";
4
4
  import { createHash } from "node:crypto";
@@ -100,7 +100,6 @@ const UPSTREAM_LIMIT_CHARS_PER_TOKEN = 2.75;
100
100
  * tokenization is needed"), matching upstream's ESTIMATE-side heuristic — "~4
101
101
  * chars/token is the usual English heuristic" (\`agent/prompt_builder.py:1179\`).
102
102
  * Estimates use this; limits use the constant above. */
103
- const PLATFORM_ESTIMATE_CHARS_PER_TOKEN = 4;
104
103
  const MAX_SKILL_FILE_BYTES = 1048576;
105
104
  const DEFAULT_REVIEW_MEMORY_INTERVAL = 10;
106
105
  const DEFAULT_REVIEW_SKILL_INTERVAL = 10;
@@ -137,8 +136,6 @@ const DEFAULT_SKILL_CONTENT_CHARS = MAX_SKILL_CONTENT_CHARS;
137
136
  /** P3-19 (v14): defaults that were written twice (schema `.default()` AND the
138
137
  * clamp fallback literal) now have one home per value. */
139
138
  const DEFAULT_REVIEW_TIMEOUT_MS = 12e4;
140
- const DEFAULT_REVIEW_CONTEXT_MESSAGES = 60;
141
- const DEFAULT_REVIEW_MESSAGE_CHARS = 2e3;
142
139
  const DEFAULT_CURATOR_BOOT_GRACE_SECONDS = 10;
143
140
  const DEFAULT_CURATOR_REVIEW_MAX_TOKENS = 2048;
144
141
  /** Threat-scan WINDOW SIZE (not a total cap — E-12: the whole text is scanned in
@@ -179,7 +176,6 @@ const AUTHORING_DESCRIPTION_BAR = 60;
179
176
  * this default only governs compositions that do not override it. It is NOT a refusal threshold:
180
177
  * the only refusal is `MAX_DESCRIPTION_LENGTH` / the row's `maxDescriptionLength`, and the catalog
181
178
  * cut is a view, not a validation. See tool-skill-manage/README.md for the three-number table. */
182
- const PLATFORM_CATALOG_DESCRIPTION_DEFAULT = 500;
183
179
  /** The split hint both size refusals share (0.5.0 V1). The same sentence used to
184
180
  * be copied into validateFrontmatter AND the patch path, and neither copy named
185
181
  * where the content should go — the upstream cap message names the destination
@@ -321,4 +317,4 @@ function clampedNumber(value, fallback, opts) {
321
317
  return value;
322
318
  }
323
319
  //#endregion
324
- export { UPSTREAM_LIMIT_CHARS_PER_TOKEN as $, DEFAULT_STALE_AFTER_DAYS as A, MAX_SKILL_CONTENT_CHARS as B, DEFAULT_REVIEW_MESSAGE_CHARS as C, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS as D, DEFAULT_SKILL_CONTENT_CHARS as E, DEFAULT_USER_CHAR_LIMIT as F, PLATFORM_CATALOG_DESCRIPTION_DEFAULT as G, MAX_SKILL_NAME_LENGTH as H, ENTRY_DELIMITER as I, SKILLS_GUIDANCE_SECTION_ORDER as J, PLATFORM_ESTIMATE_CHARS_PER_TOKEN as K, EVOLUTION_WRITE_TOOLS as L, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS as M, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS as N, DEFAULT_SKILL_REVIEW_TRIGGER as O, DEFAULT_THREAT_MAX_SCAN_CHARS as P, SUPPORT_SPRAWL_FILES as Q, FORBIDDEN_CONTROL_KEYS as R, DEFAULT_REVIEW_MEMORY_INTERVAL as S, DEFAULT_REVIEW_TIMEOUT_MS as T, MAX_TIMER_DELAY_MS as U, MAX_SKILL_FILE_BYTES as V, MEMORY_GUIDANCE_SECTION_ORDER as W, SKILL_NAME_RE as X, SKILL_ACTION_REQUIRED_FIELDS as Y, SUPPORT_DIRS as Z, DEFAULT_CURATOR_REVIEW_MAX_TOKENS as _, DEFAULT_SKILL_LIMITS as a, DEFAULT_PROBE_TIMEOUT_MS as b, policyStageLimits as c, CONTENT_SPLIT_HINT as d, DEFAULT_ARCHIVE_AFTER_DAYS as f, DEFAULT_CURATOR_MODEL as g, DEFAULT_CURATOR_INTERVAL_HOURS as h, DEFAULT_REFERENCE_REWRITE_POLICY as i, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS as j, DEFAULT_SKILL_VERSION_KEEP as k, AUTHORING_DESCRIPTION_BAR as l, DEFAULT_CURATOR_BOOT_GRACE_SECONDS as m, DEFAULT_ARCHIVE_RETENTION_POLICY as n, DEFAULT_SUPPORT_FILE_CHAR_POLICY as o, DEFAULT_CONSOLIDATION_FAILURES as p, PROTECTED_BUILTIN_SKILLS as q, DEFAULT_CITATION_POLICY as r, POLICY_STAGE_DEFAULTS as s, clampedNumber as t, AUTHORING_SPLIT_LINE_CHARS as u, DEFAULT_MEMORY_CHAR_LIMIT as v, DEFAULT_REVIEW_SKILL_INTERVAL as w, DEFAULT_REVIEW_CONTEXT_MESSAGES as x, DEFAULT_MIN_IDLE_HOURS as y, MAX_DESCRIPTION_LENGTH as z };
320
+ export { DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS as A, MAX_SKILL_NAME_LENGTH as B, DEFAULT_REVIEW_TIMEOUT_MS as C, DEFAULT_SKILL_VERSION_KEEP as D, DEFAULT_SKILL_REVIEW_TRIGGER as E, EVOLUTION_WRITE_TOOLS as F, SKILL_ACTION_REQUIRED_FIELDS as G, MEMORY_GUIDANCE_SECTION_ORDER as H, FORBIDDEN_CONTROL_KEYS as I, SUPPORT_SPRAWL_FILES as J, SKILL_NAME_RE as K, MAX_DESCRIPTION_LENGTH as L, DEFAULT_THREAT_MAX_SCAN_CHARS as M, DEFAULT_USER_CHAR_LIMIT as N, DEFAULT_STALE_AFTER_DAYS as O, ENTRY_DELIMITER as P, MAX_SKILL_CONTENT_CHARS as R, DEFAULT_REVIEW_SKILL_INTERVAL as S, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS as T, PROTECTED_BUILTIN_SKILLS as U, MAX_TIMER_DELAY_MS as V, SKILLS_GUIDANCE_SECTION_ORDER as W, UPSTREAM_LIMIT_CHARS_PER_TOKEN as Y, DEFAULT_CURATOR_REVIEW_MAX_TOKENS as _, DEFAULT_SKILL_LIMITS as a, DEFAULT_PROBE_TIMEOUT_MS as b, policyStageLimits as c, CONTENT_SPLIT_HINT as d, DEFAULT_ARCHIVE_AFTER_DAYS as f, DEFAULT_CURATOR_MODEL as g, DEFAULT_CURATOR_INTERVAL_HOURS as h, DEFAULT_REFERENCE_REWRITE_POLICY as i, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS as j, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS as k, AUTHORING_DESCRIPTION_BAR as l, DEFAULT_CURATOR_BOOT_GRACE_SECONDS as m, DEFAULT_ARCHIVE_RETENTION_POLICY as n, DEFAULT_SUPPORT_FILE_CHAR_POLICY as o, DEFAULT_CONSOLIDATION_FAILURES as p, SUPPORT_DIRS as q, DEFAULT_CITATION_POLICY as r, POLICY_STAGE_DEFAULTS as s, clampedNumber as t, AUTHORING_SPLIT_LINE_CHARS as u, DEFAULT_MEMORY_CHAR_LIMIT as v, DEFAULT_SKILL_CONTENT_CHARS as w, DEFAULT_REVIEW_MEMORY_INTERVAL as x, DEFAULT_MIN_IDLE_HOURS as y, MAX_SKILL_FILE_BYTES as z };
@@ -1,4 +1,4 @@
1
1
  import { t as presetsPort } from "../presets-C8vuCuNA.js";
2
- import { a as createUserMessage, c as domainTable, d as EvolutionLlmError, f as llmPort, i as createToolResultMessage, l as escapeText, m as projectionPort, n as DomainError, o as defineDomain, p as modelRoute, r as SessionId, s as defineTool, t as BlockAssembler, u as scopeOf } from "../platform-CFA12Jam.js";
2
+ import { a as createUserMessage, c as domainTable, d as EvolutionLlmError, f as llmPort, i as createToolResultMessage, l as escapeText, m as projectionPort, n as DomainError, o as defineDomain, p as modelRoute, r as SessionId, s as defineTool, t as BlockAssembler, u as scopeOf } from "../platform-Cc9cNt5j.js";
3
3
  import { n as toolsPort, t as registerEvolutionTool } from "../tools-DzcNFex2.js";
4
4
  export { BlockAssembler, DomainError, EvolutionLlmError, SessionId, createToolResultMessage, createUserMessage, defineDomain, defineTool, domainTable, escapeText, llmPort, modelRoute, presetsPort, projectionPort, registerEvolutionTool, scopeOf, toolsPort };
@@ -5,7 +5,6 @@ import { escapeText } from "@deepseek-ai/dsh-skill";
5
5
  import { BlockAssembler, createToolResultMessage, createUserMessage } from "@deepseek-ai/dsh-llm";
6
6
  import { SessionId } from "@deepseek-ai/dsh-session";
7
7
  //#region lib/types/platform/projections.js
8
- const isThenable = (value) => (typeof value === "object" || typeof value === "function") && value !== null && typeof value.then === "function";
9
8
  const isHandle = (value) => value !== null && typeof value === "object" && typeof value.stateOf === "function" && typeof value.dispose === "function";
10
9
  /** Resolve the projection port; undefined means the host has no projection registry. */
11
10
  function projectionPort(ctx) {
@@ -21,8 +20,7 @@ function projectionPort(ctx) {
21
20
  return shape === "unrecognised" ? reason : void 0;
22
21
  },
23
22
  async register(definition) {
24
- const raw = registry.register(definition);
25
- const resolved = isThenable(raw) ? await raw : raw;
23
+ const resolved = await registry.register(definition);
26
24
  if (isHandle(resolved)) {
27
25
  shape = "handle";
28
26
  reason = void 0;
@@ -31,18 +29,8 @@ function projectionPort(ctx) {
31
29
  dispose: () => resolved.dispose()
32
30
  };
33
31
  }
34
- if (resolved === raw && typeof raw === "function" && typeof registry.stateOf === "function") {
35
- shape = "legacy";
36
- reason = void 0;
37
- return {
38
- stateOf: (session) => registry.stateOf?.(session, definition.key),
39
- dispose: async () => {
40
- raw();
41
- }
42
- };
43
- }
44
32
  shape = "unrecognised";
45
- reason = "sessionProjections.register returned " + (resolved === null ? "null" : typeof resolved) + " with neither a projection handle nor a legacy disposer";
33
+ reason = "sessionProjections.register returned " + (resolved === null ? "null" : typeof resolved) + " without a projection handle";
46
34
  return {
47
35
  stateOf: () => void 0,
48
36
  dispose: async () => {}
@@ -80,20 +68,8 @@ function llmPort(ctx) {
80
68
  const port = {
81
69
  async *stream(request) {
82
70
  const options = toOptions(request);
83
- if (llm.stream !== void 0) {
84
- yield* llm.stream(options);
85
- return;
86
- }
87
- if (llm.prepareCall !== void 0) {
88
- const call = await llm.prepareCall(options, request.signal);
89
- yield* call.stream({
90
- ...call.config,
91
- messages: request.messages,
92
- ...request.signal === void 0 ? {} : { signal: request.signal }
93
- });
94
- return;
95
- }
96
- throw new EvolutionLlmError("transport", "llm service has neither stream nor prepareCall");
71
+ if (llm.stream === void 0) throw new EvolutionLlmError("transport", "llm service has no stream()");
72
+ yield* llm.stream(options);
97
73
  },
98
74
  async completeText(request) {
99
75
  let text = "";
package/lib/policy.js CHANGED
@@ -1,4 +1,4 @@
1
- import { E as DEFAULT_SKILL_CONTENT_CHARS, F as DEFAULT_USER_CHAR_LIMIT, L as EVOLUTION_WRITE_TOOLS, R as FORBIDDEN_CONTROL_KEYS, g as DEFAULT_CURATOR_MODEL, i as DEFAULT_REFERENCE_REWRITE_POLICY, n as DEFAULT_ARCHIVE_RETENTION_POLICY, o as DEFAULT_SUPPORT_FILE_CHAR_POLICY, q as PROTECTED_BUILTIN_SKILLS, r as DEFAULT_CITATION_POLICY, s as POLICY_STAGE_DEFAULTS, t as clampedNumber, v as DEFAULT_MEMORY_CHAR_LIMIT } from "./numeric-DLeLvvGb.js";
1
+ import { F as EVOLUTION_WRITE_TOOLS, I as FORBIDDEN_CONTROL_KEYS, N as DEFAULT_USER_CHAR_LIMIT, U as PROTECTED_BUILTIN_SKILLS, g as DEFAULT_CURATOR_MODEL, i as DEFAULT_REFERENCE_REWRITE_POLICY, n as DEFAULT_ARCHIVE_RETENTION_POLICY, o as DEFAULT_SUPPORT_FILE_CHAR_POLICY, r as DEFAULT_CITATION_POLICY, s as POLICY_STAGE_DEFAULTS, t as clampedNumber, v as DEFAULT_MEMORY_CHAR_LIMIT, w as DEFAULT_SKILL_CONTENT_CHARS } from "./numeric-D8js3sqC.js";
2
2
  import { t as asRecord } from "./guards-3f02mnf2.js";
3
3
  import { n as toolsPort } from "./tools-DzcNFex2.js";
4
4
  import { Service } from "@deepseek-ai/cordis";