@lmzhen/dsh-evolution-core 0.50.0 → 0.51.1

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.
@@ -1,3 +1,3 @@
1
- import { a as entryListSchema, c as MAINTAINER_PRESET_ID, d as RESTRICTOR_MODULE, f as REVIEWER_PRESET_ID, i as composeRestrictedPresetDefinition, l as RESTRICTED_PRESET_DISPLAY, m as restrictedPresetId, n as ensureRestrictedPreset, o as parsePresetRows, p as normalizeAllow, r as restrictedPresetState, s as EVOLUTION_PRESET_IDS, t as disposeRestrictedPreset, u as RESTRICTED_TOOLS_ROW_ID } from "../ensure-Bx4ksgJk.js";
2
- import { C as trimTrailingBlankLines, S as rowSiblingEnd, _ as presetRowId, a as composePresetComposition, b as resolveBasePresetPatch, c as composePresetRow, d as listDirectories, f as loadRowOverrides, g as presetRowBody, h as presetRowBlock, i as basePresetPlugins, l as compositionRowIds, m as presetPatchText, n as AGENT_PRESET_ROOT_HINT, o as composePresetEntry, p as mergePresetRow, r as EMPTY_PATCH_SEED, s as composePresetInsert, t as AGENT_PRESET_PACKAGE, u as denseBlockSequence, v as probeDesktopScope, x as rowBlockSpan, y as removePresetRow } from "../composition-DA8XPfMc.js";
3
- export { AGENT_PRESET_PACKAGE, AGENT_PRESET_ROOT_HINT, EMPTY_PATCH_SEED, EVOLUTION_PRESET_IDS, MAINTAINER_PRESET_ID, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, REVIEWER_PRESET_ID, basePresetPlugins, composePresetComposition, composePresetEntry, composePresetInsert, composePresetRow, composeRestrictedPresetDefinition, compositionRowIds, denseBlockSequence, disposeRestrictedPreset, ensureRestrictedPreset, entryListSchema, listDirectories, loadRowOverrides, mergePresetRow, normalizeAllow, parsePresetRows, presetPatchText, presetRowBlock, presetRowBody, presetRowId, probeDesktopScope, removePresetRow, resolveBasePresetPatch, restrictedPresetId, restrictedPresetState, rowBlockSpan, rowSiblingEnd, trimTrailingBlankLines };
1
+ import { a as entryListSchema, c as GOVERNANCE_PRESET_ID, d as RESTRICTED_TOOLS_ROW_ID, f as RESTRICTOR_MODULE, h as restrictedPresetId, i as composeRestrictedPresetDefinition, l as MAINTAINER_PRESET_ID, m as normalizeAllow, n as ensureRestrictedPreset, o as parsePresetRows, p as REVIEWER_PRESET_ID, r as restrictedPresetState, s as EVOLUTION_PRESET_IDS, t as disposeRestrictedPreset, u as RESTRICTED_PRESET_DISPLAY } from "../ensure-BLmEW0Ju.js";
2
+ import { C as trimTrailingBlankLines, S as rowSiblingEnd, _ as presetRowId, a as composePresetComposition, b as resolveBasePresetPatch, c as composePresetRow, d as listDirectories, f as loadRowOverrides, g as presetRowBody, h as presetRowBlock, i as basePresetPlugins, l as compositionRowIds, m as presetPatchText, n as AGENT_PRESET_ROOT_HINT, o as composePresetEntry, p as mergePresetRow, r as EMPTY_PATCH_SEED, s as composePresetInsert, t as AGENT_PRESET_PACKAGE, u as denseBlockSequence, v as probeDesktopScope, x as rowBlockSpan, y as removePresetRow } from "../composition-CtNbVHq3.js";
3
+ export { AGENT_PRESET_PACKAGE, AGENT_PRESET_ROOT_HINT, EMPTY_PATCH_SEED, EVOLUTION_PRESET_IDS, GOVERNANCE_PRESET_ID, MAINTAINER_PRESET_ID, RESTRICTED_PRESET_DISPLAY, RESTRICTED_TOOLS_ROW_ID, RESTRICTOR_MODULE, REVIEWER_PRESET_ID, basePresetPlugins, composePresetComposition, composePresetEntry, composePresetInsert, composePresetRow, composeRestrictedPresetDefinition, compositionRowIds, denseBlockSequence, disposeRestrictedPreset, ensureRestrictedPreset, entryListSchema, listDirectories, loadRowOverrides, mergePresetRow, normalizeAllow, parsePresetRows, presetPatchText, presetRowBlock, presetRowBody, presetRowId, probeDesktopScope, removePresetRow, resolveBasePresetPatch, restrictedPresetId, restrictedPresetState, rowBlockSpan, rowSiblingEnd, trimTrailingBlankLines };
@@ -1,4 +1,4 @@
1
- import { g as scopedPackageName } from "./ensure-Bx4ksgJk.js";
1
+ import { _ as scopedPackageName } from "./ensure-BLmEW0Ju.js";
2
2
  import { dirname, join } from "node:path";
3
3
  import { existsSync, readFileSync, readdirSync } from "node:fs";
4
4
  import { fileURLToPath } from "node:url";
@@ -57,6 +57,7 @@ const EVOLUTION_PRESET_IDS = [
57
57
  ];
58
58
  const REVIEWER_PRESET_ID = "evolution-reviewer-readonly";
59
59
  const MAINTAINER_PRESET_ID = "evolution-maintainer-readonly";
60
+ const GOVERNANCE_PRESET_ID = "evolution-governance";
60
61
  const RESTRICTED_TOOLS_ROW_ID = "evolution-restricted-tools";
61
62
  const RESTRICTOR_MODULE = scopedPackageName("dsh-evolution-core/restrictor", import.meta.url);
62
63
  const RESTRICTED_PRESET_DISPLAY = {
@@ -69,10 +70,17 @@ const RESTRICTED_PRESET_DISPLAY = {
69
70
  name: "evolution maintainer (read-only)",
70
71
  description: "Internal restricted preset used by the family maintenance channel.",
71
72
  order: 901
73
+ },
74
+ governance: {
75
+ name: "evolution governance (writable)",
76
+ description: "Internal restricted preset used by the single-skill governance child.",
77
+ order: 902
72
78
  }
73
79
  };
74
80
  function restrictedPresetId(kind) {
75
- return kind === "reviewer" ? REVIEWER_PRESET_ID : MAINTAINER_PRESET_ID;
81
+ if (kind === "reviewer") return REVIEWER_PRESET_ID;
82
+ if (kind === "maintainer") return MAINTAINER_PRESET_ID;
83
+ return GOVERNANCE_PRESET_ID;
76
84
  }
77
85
  /** Trim, drop blanks, de-duplicate and sort: ONE spelling for an allow/deny set. */
78
86
  function normalizeAllow(names) {
@@ -221,4 +229,4 @@ async function disposeRestrictedPreset(ctx, kind) {
221
229
  await releaseRestrictedPreset(ctx, kind);
222
230
  }
223
231
  //#endregion
224
- export { entryListSchema as a, MAINTAINER_PRESET_ID as c, RESTRICTOR_MODULE as d, REVIEWER_PRESET_ID as f, scopedPackageName as g, scopeOfNearestManifest as h, composeRestrictedPresetDefinition as i, RESTRICTED_PRESET_DISPLAY as l, restrictedPresetId as m, ensureRestrictedPreset as n, parsePresetRows as o, normalizeAllow as p, restrictedPresetState as r, EVOLUTION_PRESET_IDS as s, disposeRestrictedPreset as t, RESTRICTED_TOOLS_ROW_ID as u };
232
+ export { scopedPackageName as _, entryListSchema as a, GOVERNANCE_PRESET_ID as c, RESTRICTED_TOOLS_ROW_ID as d, RESTRICTOR_MODULE as f, scopeOfNearestManifest as g, restrictedPresetId as h, composeRestrictedPresetDefinition as i, MAINTAINER_PRESET_ID as l, normalizeAllow as m, ensureRestrictedPreset as n, parsePresetRows as o, REVIEWER_PRESET_ID as p, restrictedPresetState as r, EVOLUTION_PRESET_IDS as s, disposeRestrictedPreset as t, RESTRICTED_PRESET_DISPLAY as u };
@@ -1,4 +1,4 @@
1
- import { E as selectSections, H as externalRefs, K as planReferenceRewrite, N as frontmatterBlock, U as supportRefs, W as applyReferenceRewrite, q as planRehoming } from "./usage-DdjIBAkm.js";
1
+ import { E as selectSections, H as externalRefs, K as planReferenceRewrite, N as frontmatterBlock, U as supportRefs, W as applyReferenceRewrite, q as planRehoming } from "./usage-B5a90TKv.js";
2
2
  import { createHash } from "node:crypto";
3
3
  //#region lib/types/extract-plan.js
4
4
  const LF = String.fromCharCode(10);
package/lib/extract.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { p as isPresent } from "./io-GxghO3Ip.js";
2
2
  import { i as DEFAULT_SKILL_LIMITS } from "./limits-C9jfvxBl.js";
3
- import { I as parseFrontmatter } from "./usage-DdjIBAkm.js";
4
- import { C as EXTRACT_PROMPT_VERSION, S as EXTRACT_PROMPT_V1, T as ownerCandidatesFromSummaries, _ as readProposalReport, b as proposalFromPlan, d as nearDuplicateSummaries, m as readExternalSupport, v as readProposalReports, w as findOwnerCandidate, x as EXTRACT_PROMPT_HASH, y as writeProposalReport } from "./quality-WAU6YatF.js";
3
+ import { I as parseFrontmatter } from "./usage-B5a90TKv.js";
4
+ import { C as EXTRACT_PROMPT_VERSION, S as EXTRACT_PROMPT_V1, T as ownerCandidatesFromSummaries, _ as readProposalReport, b as proposalFromPlan, d as nearDuplicateSummaries, m as readExternalSupport, v as readProposalReports, w as findOwnerCandidate, x as EXTRACT_PROMPT_HASH, y as writeProposalReport } from "./quality-DpAS0rd9.js";
5
5
  import { r as contentHash } from "./mutations-DQXddSJd.js";
6
- import { n as projectExtractBodies, t as planExtract } from "./extract-plan-Bru3c9ec.js";
6
+ import { n as projectExtractBodies, t as planExtract } from "./extract-plan-D6o__2Kf.js";
7
7
  import { dirname, join } from "node:path";
8
8
  //#region lib/types/extract-request.js
9
9
  /** The one human-readable owner decision shared by tool and CLI. */
package/lib/index.js CHANGED
@@ -2,16 +2,16 @@ import { S as reportTime, _ as probeMtime, a as isProcessAlive, b as probeText,
2
2
  import { a as leaseFile, c as AuthorityBusyError, d as HomeAuthority, f as authorityHolder, i as LeaseStore, l as AuthorityOrderError, n as mutationLockFrom, o as HomeFence, p as leaseAsTreeLock, r as DEFAULT_LEASE_TTL_MS, s as HomeFenceError, t as MutationAuthority, u as AuthorityReentryError } from "./mutation-authority-DQfpXs1O.js";
3
3
  import { a as isFileShapedPath, i as KEEP_LINE_RE, n as DEFAULT_CITATION_REF_BUDGET, o as resolveCitations, r as HOOK_LINE_RE, s as scanBodyHooks, t as CITATION_SUPPORT_DIRS } from "./citations-CZKTUGQF.js";
4
4
  import { A as DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, B as MAX_TIMER_DELAY_MS, C as DEFAULT_SKILL_CONTENT_CHARS, D as DEFAULT_STALE_AFTER_DAYS, E as DEFAULT_SKILL_VERSION_KEEP, F as FORBIDDEN_CONTROL_KEYS, G as SKILL_NAME_RE, H as PROTECTED_BUILTIN_SKILLS, I as MAX_DESCRIPTION_LENGTH, J as UPSTREAM_LIMIT_CHARS_PER_TOKEN, K as SUPPORT_DIRS, L as MAX_SKILL_CONTENT_CHARS, M as DEFAULT_USER_CHAR_LIMIT, N as ENTRY_DELIMITER, O as DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, P as EVOLUTION_WRITE_TOOLS, R as MAX_SKILL_FILE_BYTES, S as DEFAULT_REVIEW_TIMEOUT_MS, T as DEFAULT_SKILL_REVIEW_TRIGGER, U as SKILLS_GUIDANCE_SECTION_ORDER, V as MEMORY_GUIDANCE_SECTION_ORDER, W as SKILL_ACTION_REQUIRED_FIELDS, _ as DEFAULT_MEMORY_CHAR_LIMIT, a as DEFAULT_SUPPORT_FILE_CHAR_POLICY, b as DEFAULT_REVIEW_MEMORY_INTERVAL, c as AUTHORING_DESCRIPTION_BAR, d as DEFAULT_ARCHIVE_AFTER_DAYS, f as DEFAULT_CONSOLIDATION_FAILURES, g as DEFAULT_CURATOR_REVIEW_MAX_TOKENS, h as DEFAULT_CURATOR_MODEL, i as DEFAULT_SKILL_LIMITS, j as DEFAULT_THREAT_MAX_SCAN_CHARS, k as DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, l as AUTHORING_SPLIT_LINE_CHARS, m as DEFAULT_CURATOR_INTERVAL_HOURS, n as DEFAULT_CITATION_POLICY, o as POLICY_STAGE_DEFAULTS, p as DEFAULT_CURATOR_BOOT_GRACE_SECONDS, q as SUPPORT_SPRAWL_FILES, r as DEFAULT_REFERENCE_REWRITE_POLICY, s as policyStageLimits, t as DEFAULT_ARCHIVE_RETENTION_POLICY, u as CONTENT_SPLIT_HINT, v as DEFAULT_MIN_IDLE_HOURS, w as DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, x as DEFAULT_REVIEW_SKILL_INTERVAL, y as DEFAULT_PROBE_TIMEOUT_MS, z as MAX_SKILL_NAME_LENGTH } from "./limits-C9jfvxBl.js";
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-Bx4ksgJk.js";
6
- import { $ as authorityFrom, A as listEventArchives, B as COST_CJK_TOKEN_HIGH, C as EVENT_ARCHIVE_PREFIX, D as appendEvolutionEvent, E as EVENT_LOG_VERSION, F as RULES, G as tokenLineFor, H as TOKEN_ASCII_WEIGHT, J as isUnreadWrite, L as lintSkill, M as readEvolutionEvents, N as readEvolutionTimeline, O as eventsFile, P as retainEventArchives, Q as DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, R as COST_ASCII_TOKEN_HIGH, S as trimPatternBoundaries, T as EVENT_LOG_ROTATE_AT, U as TOKEN_CJK_WEIGHT, V as COST_CJK_TOKEN_LOW, W as bodyCost, Z as DEFAULT_WRITE_CONFIRM_MODE, _ as scanThreats, b as FUZZY_MAX_WORK, c as clearReviewChannel, d as sweepReviewChannelSessions, f as PATTERN_OVERLAP, g as scanMemoryThreats, h as scanContentThreats, i as assessStructureHealth, j as parseEvolutionEvents, k as evolutionEventPayloadIssue, l as isReviewChannelSession, m as evaluateThreat, o as currentReviewContext, p as THREAT_EXEMPTION_HINT, s as withReviewContext, t as DEFAULT_HEALTH_THRESHOLDS, u as markReviewChannel, v as makeSerialQueue, w as EVENT_LOG_RETAIN_ARCHIVES, x as fuzzyPatch, y as FUZZY_MAX_PATTERN_CHARS, z as COST_ASCII_TOKEN_LOW } from "./skill-health-Bl-MdXZ4.js";
5
+ import { _ as scopedPackageName, d as RESTRICTED_TOOLS_ROW_ID, f as RESTRICTOR_MODULE, g as scopeOfNearestManifest, l as MAINTAINER_PRESET_ID, p as REVIEWER_PRESET_ID, s as EVOLUTION_PRESET_IDS, u as RESTRICTED_PRESET_DISPLAY } from "./ensure-BLmEW0Ju.js";
6
+ import { $ as DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS, A as evolutionEventPayloadIssue, B as COST_ASCII_TOKEN_LOW, C as trimPatternBoundaries, D as EVENT_LOG_VERSION, E as EVENT_LOG_ROTATE_AT, F as retainEventArchives, G as bodyCost, H as COST_CJK_TOKEN_LOW, I as RULES, K as tokenLineFor, M as parseEvolutionEvents, N as readEvolutionEvents, O as appendEvolutionEvent, P as readEvolutionTimeline, Q as DEFAULT_WRITE_CONFIRM_MODE, R as lintSkill, S as fuzzyPatch, T as EVENT_LOG_RETAIN_ARCHIVES, U as TOKEN_ASCII_WEIGHT, V as COST_CJK_TOKEN_HIGH, W as TOKEN_CJK_WEIGHT, Y as isUnreadWrite, _ as scanMemoryThreats, b as FUZZY_MAX_PATTERN_CHARS, c as withReviewContext, d as markReviewChannel, et as authorityFrom, f as sweepReviewChannelSessions, g as scanContentThreats, h as evaluateThreat, i as assessStructureHealth, j as listEventArchives, k as eventsFile, l as clearReviewChannel, m as THREAT_EXEMPTION_HINT, o as currentReviewContext, p as PATTERN_OVERLAP, s as recordReviewRead, t as DEFAULT_HEALTH_THRESHOLDS, u as isReviewChannelSession, v as scanThreats, w as EVENT_ARCHIVE_PREFIX, x as FUZZY_MAX_WORK, y as makeSerialQueue, z as COST_ASCII_TOKEN_HIGH } from "./skill-health-BQCM4N8z.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 { A as dispatchKeyOf, C as PTC_DISPATCH_EVENT, D as assertDispatchPayload, E as ToolDispatchPayloadError, F as isSkillToolName, I as readDispatchSignal, 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, _ 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-ByNxQi9O.js";
9
- import { C as updateSuppressedNames, D as displayBodyOf, E as selectSections, G as describeReferenceRewrite, H as externalRefs, K as planReferenceRewrite, O as h2Sections, S as suppressedFile, T as usageObserved, U as supportRefs, W as applyReferenceRewrite, _ as markAgentCreated, a as bumpPatch, b as saveSuppressedNames, c as bumpView, d as foldCuratorFields, f as getRecord, g as loadUsage, h as loadSuppressedNames, i as applyCuratorMetaFields, k as readingStats, l as daysSinceIso, m as latestActivityAt, n as SUPPRESSED_FILE_VERSION, o as bumpSupportRead, p as idleDays, q as planRehoming, r as applyCuratorLifecycleFields, s as bumpUse, t as MAX_SUPPORT_READ_PATHS, u as emptyRecord, v as mutateUsage, w as usageFile, x as saveUsage, y as normalizeUsageRecord } from "./usage-DdjIBAkm.js";
9
+ import { C as updateSuppressedNames, D as displayBodyOf, E as selectSections, G as describeReferenceRewrite, H as externalRefs, K as planReferenceRewrite, O as h2Sections, S as suppressedFile, T as usageObserved, U as supportRefs, W as applyReferenceRewrite, _ as markAgentCreated, a as bumpPatch, b as saveSuppressedNames, c as bumpView, d as foldCuratorFields, f as getRecord, g as loadUsage, h as loadSuppressedNames, i as applyCuratorMetaFields, k as readingStats, l as daysSinceIso, m as latestActivityAt, n as SUPPRESSED_FILE_VERSION, o as bumpSupportRead, p as idleDays, q as planRehoming, r as applyCuratorLifecycleFields, s as bumpUse, t as MAX_SUPPORT_READ_PATHS, u as emptyRecord, v as mutateUsage, w as usageFile, x as saveUsage, y as normalizeUsageRecord } from "./usage-B5a90TKv.js";
10
10
  import { n as isRecord, t as asRecord } from "./guards-3f02mnf2.js";
11
- import { T as ownerCandidatesFromSummaries, _ as readProposalReport, a as SUMMARY_DUPLICATE_HINT_THRESHOLD, b as proposalFromPlan, c as computePrefixClusters, d as nearDuplicateSummaries, f as projectionText, g as proposalReportName, h as proposalReportDir, i as QUALITY_WEIGHTS, l as computeQualityScores, m as readExternalSupport, n as DEDUP_SIMILARITY_THRESHOLD, o as affinity, p as vocabulary, r as LOW_QUALITY_THRESHOLD, s as computeDedupGroups, t as DEDUP_MAX_PAIR_COMPARISONS, u as identity, v as readProposalReports, w as findOwnerCandidate, y as writeProposalReport } from "./quality-WAU6YatF.js";
11
+ import { T as ownerCandidatesFromSummaries, _ as readProposalReport, a as SUMMARY_DUPLICATE_HINT_THRESHOLD, b as proposalFromPlan, c as computePrefixClusters, d as nearDuplicateSummaries, f as projectionText, g as proposalReportName, h as proposalReportDir, i as QUALITY_WEIGHTS, l as computeQualityScores, m as readExternalSupport, n as DEDUP_SIMILARITY_THRESHOLD, o as affinity, p as vocabulary, r as LOW_QUALITY_THRESHOLD, s as computeDedupGroups, t as DEDUP_MAX_PAIR_COMPARISONS, u as identity, v as readProposalReports, w as findOwnerCandidate, y as writeProposalReport } from "./quality-DpAS0rd9.js";
12
12
  import { n as evolutionRoot, t as evolutionHome } from "./state-store-Jpa-iYIZ.js";
13
13
  import { HOST_ROUTES, MAX_REQUEST_BODY_BYTES, hostSurface, json, methodNotAllowed, readJsonObject, registerHostRoutes } from "./http-routes.js";
14
- import { w as allowRowCollisions } from "./composition-DA8XPfMc.js";
14
+ import { w as allowRowCollisions } from "./composition-CtNbVHq3.js";
15
15
  import { t as clampedNumber } from "./numeric-Dc53KQoe.js";
16
16
  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";
17
17
  import { u as scopeOf, y as settingsPort } from "./platform-DyHnHUmQ.js";
@@ -199,7 +199,13 @@ const GATES = [
199
199
  appliesTo: ["admission", "execution"],
200
200
  run: ({ view }) => {
201
201
  const action = view.action;
202
- const missing = (action === void 0 || !Object.hasOwn(SKILL_ACTION_REQUIRED_FIELDS, action) ? [] : SKILL_ACTION_REQUIRED_FIELDS[action] ?? []).filter((field) => view.scalars[field] === void 0 || view.scalars[field] === null);
202
+ const required = action === void 0 || !Object.hasOwn(SKILL_ACTION_REQUIRED_FIELDS, action) ? [] : SKILL_ACTION_REQUIRED_FIELDS[action] ?? [];
203
+ const section = view.scalars["section"];
204
+ const sectionPatch = action === "patch" && typeof section === "object" && section !== null && typeof section.heading === "string" && typeof section.content === "string";
205
+ const missing = required.filter((field) => {
206
+ if (sectionPatch && (field === "old_string" || field === "new_string")) return false;
207
+ return view.scalars[field] === void 0 || view.scalars[field] === null;
208
+ });
203
209
  if (missing.length === 0) return null;
204
210
  return `skill_manage ${action} requires ${missing.join(", ")}; the tool description lists the arguments per action.`;
205
211
  }
@@ -1391,8 +1397,8 @@ var MemoryStore = class {
1391
1397
  * changes semantically: the bundle digest is the fail-closed signal for
1392
1398
  * review workers, so a stale id across deployments must be distinguishable.
1393
1399
  */
1394
- const PROMPT_BUNDLE_VERSION = 27;
1395
- const PROMPT_BUNDLE_ID = `dsh-evolution@27`;
1400
+ const PROMPT_BUNDLE_VERSION = 31;
1401
+ const PROMPT_BUNDLE_ID = `dsh-evolution@31`;
1396
1402
  const MEMORY_REVIEW_BODY = `Focus on durable facts that change future collaboration:
1397
1403
 
1398
1404
  1. The user: role, context, stable preferences, constraints, and facts they would want remembered.
@@ -1409,6 +1415,8 @@ Target: a class-level skill with a compact SKILL.md and a references/ directory
1409
1415
 
1410
1416
  A skill body contains reusable decisions: when to use it, what to do, and how to verify. Session-specific narratives, dated logs, one-off evidence, and version details that do not change the decision belong in references/. Support files: references/ for detail or knowledge banks; templates/ for starter files; scripts/ for re-runnable checks and generators. When you add a support file, add the SKILL.md line that points to it; a file no pointer reaches is invisible next session. A skill must use only tools, commands, and paths available in this session. If one is unavailable, replace it only with a verified local equivalent; otherwise leave it unchanged and report the limitation. Do not invent command names.
1411
1417
 
1418
+ Before adding explanation to a skill, check whether its body is carrying session-specific detail that belongs in references/. When a loaded skill's body has grown past its decision content — long session logs, dated evidence, or detail that does not change the trigger or the procedure — move self-contained sections to references/ with skill_manage restructure, keeping the pointer line. Keep the trigger, the decision procedure, commands, and verification in SKILL.md. Offload whole sections; do not rewrite the body to make it shorter. Do at most one skill per review pass; prefer a loaded skill marked [oversize] and do not attempt a library-wide sweep.
1419
+
1412
1420
  Signals include:
1413
1421
  - The user corrected style, tone, format, verbosity, workflow, or approach.
1414
1422
  - A reusable technique, durable interface or environment fact, repair procedure, or debugging path emerged that will recur.
@@ -1625,18 +1633,34 @@ function reviewPrompt(kind, surface = "inject") {
1625
1633
  if (kind === "skill") return INJECT_SKILL_REVIEW_PROMPT;
1626
1634
  return INJECT_COMBINED_REVIEW_PROMPT;
1627
1635
  }
1636
+ const GOVERNANCE_PROMPT_TEMPLATE = `You are a skill governance worker. Work on exactly one skill.
1637
+
1638
+ Target skill: %SKILL%
1639
+ Mode: %MODE%
1640
+ Target section: %HEADING%
1641
+ Dry run: %DRY%
1642
+
1643
+ Rules:
1644
+ - Use the skill tool to read the target before writing.
1645
+ - For offload: use skill_manage restructure to move self-contained H2 sections into references/<topic>.md. Keep triggers, decision steps, commands, and verification in SKILL.md. At most five sections per call; include a short summary. When Target section names one heading, only that section may move.
1646
+ - For condense: use skill_manage patch with section: {heading, content} one section at a time. Read the result before the next edit. Do not resend the whole body; include a short summary. No content-conservation gate is applied.
1647
+ - Keep the H2 heading line for whole-section edits; replace only its content.
1648
+ - Do not create, delete, archive, merge, or split skills. Do not touch pinned or protected skills.
1649
+ - Dry run: report what you would do; do not write.
1650
+ - Finish with: what changed, body characters before/after, and unit id(s).
1651
+ `;
1628
1652
  function sha256(text) {
1629
1653
  return createHash("sha256").update(text).digest("hex");
1630
1654
  }
1631
1655
  function createPromptBundle(prompts) {
1632
1656
  const canonical = JSON.stringify({
1633
1657
  id: PROMPT_BUNDLE_ID,
1634
- version: 27,
1658
+ version: 31,
1635
1659
  prompts: Object.fromEntries(Object.entries(prompts).sort())
1636
1660
  });
1637
1661
  return Object.freeze({
1638
1662
  id: PROMPT_BUNDLE_ID,
1639
- version: 27,
1663
+ version: 31,
1640
1664
  prompts: Object.freeze({ ...prompts }),
1641
1665
  sha256: sha256(canonical)
1642
1666
  });
@@ -1650,13 +1674,14 @@ const PROMPT_BUNDLE = createPromptBundle({
1650
1674
  completion: INJECT_COMPLETION_SKILL_REVIEW_PROMPT,
1651
1675
  maintain: MAINTAIN_PROMPT,
1652
1676
  maintainOutput: MAINTAIN_OUTPUT_INSTRUCTION,
1653
- skillsGuidance: SKILLS_GUIDANCE
1677
+ skillsGuidance: SKILLS_GUIDANCE,
1678
+ governance: GOVERNANCE_PROMPT_TEMPLATE
1654
1679
  });
1655
1680
  function verifyPromptBundle(bundle = PROMPT_BUNDLE) {
1656
- if (bundle.id !== PROMPT_BUNDLE_ID || bundle.version !== 27) return false;
1681
+ if (bundle.id !== PROMPT_BUNDLE_ID || bundle.version !== 31) return false;
1657
1682
  const canonical = JSON.stringify({
1658
1683
  id: PROMPT_BUNDLE_ID,
1659
- version: 27,
1684
+ version: 31,
1660
1685
  prompts: Object.fromEntries(Object.entries(bundle.prompts).sort())
1661
1686
  });
1662
1687
  return bundle.sha256 === sha256(canonical);
@@ -2092,11 +2117,14 @@ function newRunRegistry(options) {
2092
2117
  return true;
2093
2118
  },
2094
2119
  async begin(kind, seed) {
2120
+ if (seed?.exclusive === true) {
2121
+ for (const record of owned.values()) if (record.kind === kind && record.state === "running") throw new Error(`run-kind-active:${kind}`);
2122
+ }
2095
2123
  const id = randomUUID();
2096
2124
  const startedAt = now();
2097
2125
  const controller = new AbortController();
2098
2126
  controllers.set(id, controller);
2099
- owned.set(id, {
2127
+ const record = {
2100
2128
  id,
2101
2129
  kind,
2102
2130
  state: "running",
@@ -2108,8 +2136,23 @@ function newRunRegistry(options) {
2108
2136
  done: 0,
2109
2137
  total: seed.total
2110
2138
  } } : {}
2111
- });
2112
- await persist();
2139
+ };
2140
+ if (seed?.exclusive === true) {
2141
+ try {
2142
+ await writeIndex((current) => {
2143
+ const onDisk = parseIndex(current);
2144
+ if ([...onDisk.records, ...owned.values()].some((row) => row.kind === kind && row.state === "running" && !ownerIsGone(row))) throw new Error(`run-kind-active:${kind}`);
2145
+ return serializeIndex([...onDisk.records, record], onDisk.foreign);
2146
+ });
2147
+ } catch (error) {
2148
+ controllers.delete(id);
2149
+ throw error;
2150
+ }
2151
+ owned.set(id, record);
2152
+ } else {
2153
+ owned.set(id, record);
2154
+ await persist();
2155
+ }
2113
2156
  return {
2114
2157
  id,
2115
2158
  kind,
@@ -2481,6 +2524,11 @@ const PLATFORM_SERVICE_PROBES = Object.freeze([
2481
2524
  feature: "/evolution curator subcommands, skill undo and history",
2482
2525
  side: "host"
2483
2526
  },
2527
+ {
2528
+ service: "evolutionFeedback",
2529
+ feature: "the feedback aggregate and event log behind skill_manage feedback",
2530
+ side: "host"
2531
+ },
2484
2532
  {
2485
2533
  service: "evolutionIo",
2486
2534
  feature: "every durable read and write (the IO seam)",
@@ -5223,4 +5271,4 @@ function classifySessionEvent(event) {
5223
5271
  return MODEL_EVENT_TYPES.has(type) ? "model" : "unknown";
5224
5272
  }
5225
5273
  //#endregion
5226
- 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, 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, abortLink, absentHostServices, advanceReview, affinity, allowRowCollisions, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, atomicWriteFiles, authorityFrom, authorityHolder, backupsReachability, bodyCost, buildCuratorRunReport, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, createSubagentKernel as createSubagentChannel, createSubagentKernel, createSubagentRun, 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, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, payloadText, persistedWriteSites, pickWithPolicy, planNamespaceMigration, planReferenceRewrite, planRehoming, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, 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, textOfValue, tokenLineFor, transactIo, trimPatternBoundaries, unhookedSupportPointers, unwrapLive, updateSuppressedNames, usageFile, usageObserved, userSetKeys, verifyPromptBundle, vocabulary, waitForSubagentEnd, withReviewContext, withTreeWrite, writeDurableTmp, writeProposalReport };
5274
+ 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, EvolutionGateSet, FAMILY_SESSION_TOOL_NAMES, FORBIDDEN_CONTROL_KEYS, FUZZY_MAX_PATTERN_CHARS, FUZZY_MAX_WORK, GOVERNANCE_PROMPT_TEMPLATE, 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, abortLink, absentHostServices, advanceReview, affinity, allowRowCollisions, appendEvolutionEvent, applyCuratorLifecycleFields, applyCuratorMetaFields, applyNamespaceMigration, applyReferenceRewrite, asRecord, assertDispatchPayload, atomicWriteFiles, authorityFrom, authorityHolder, backupsReachability, bodyCost, buildCuratorRunReport, buildHealthBaseline, buildLearnPrompt, bumpPatch, bumpSupportRead, bumpUse, bumpView, callingScope, claimInstance, clampOnce, clampedNumber, classifyNamespaceMigration, classifySessionEvent, clearReviewChannel, collectReadSkillNames, collectReadSupportFiles, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, createSubagentKernel as createSubagentChannel, createSubagentKernel, createSubagentRun, 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, paramRowId, paramSettingsId, parseCuratorNominations, parseEvolutionEvents, payloadText, persistedWriteSites, pickWithPolicy, planNamespaceMigration, planReferenceRewrite, planRehoming, policyStageLimits, probeAbsent, probeChannelState, probeList, probeMtime, probePresent, probeReason, probeText, probeUnknown, projectionText, proposalFromPlan, proposalReportDir, proposalReportName, protectedSkillNamesOf, readDispatchSignal, readEvolutionEvents, readEvolutionTimeline, readExternalSupport, readJsonObject, readNumberParam, readParam, readProposalReport, readProposalReports, readingStats, recordMutation, recordReviewRead, 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, textOfValue, tokenLineFor, transactIo, trimPatternBoundaries, unhookedSupportPointers, unwrapLive, updateSuppressedNames, usageFile, usageObserved, userSetKeys, verifyPromptBundle, vocabulary, waitForSubagentEnd, withReviewContext, withTreeWrite, writeDurableTmp, writeProposalReport };
@@ -1,5 +1,5 @@
1
1
  import { b as probeText, g as probeList, m as isUnknown, p as isPresent } from "./io-GxghO3Ip.js";
2
- import { H as externalRefs, O as h2Sections, m as latestActivityAt } from "./usage-DdjIBAkm.js";
2
+ import { H as externalRefs, O as h2Sections, m as latestActivityAt } from "./usage-B5a90TKv.js";
3
3
  import { t as evolutionHome } from "./state-store-Jpa-iYIZ.js";
4
4
  import { readFile, realpath, stat } from "node:fs/promises";
5
5
  import { basename, isAbsolute, join, relative, resolve } from "node:path";
@@ -1,7 +1,7 @@
1
1
  import { c as transactIo } from "./io-GxghO3Ip.js";
2
2
  import { J as UPSTREAM_LIMIT_CHARS_PER_TOKEN, j as DEFAULT_THREAT_MAX_SCAN_CHARS, l as AUTHORING_SPLIT_LINE_CHARS } from "./limits-C9jfvxBl.js";
3
3
  import { O as collectReadSkillNames, R as supportFileReadFromPath, k as collectReadSupportFiles, l as sessionReadNames, o as isProjectableSession, v as DEFAULT_SUPPORT_READ_TOOL_NAMES } from "./session-projection-ByNxQi9O.js";
4
- import { z as skillMdOnDisk } from "./usage-DdjIBAkm.js";
4
+ import { z as skillMdOnDisk } from "./usage-B5a90TKv.js";
5
5
  import { t as clampedNumber } from "./numeric-Dc53KQoe.js";
6
6
  import { AsyncLocalStorage } from "node:async_hooks";
7
7
  import { dirname, join } from "node:path";
@@ -1298,6 +1298,16 @@ function withReviewContext(context, task) {
1298
1298
  function currentReviewContext() {
1299
1299
  return storage.getStore();
1300
1300
  }
1301
+ /**
1302
+ * Record a successful skill read in the CURRENT review run. A no-op outside a
1303
+ * review loop or when the run has no read set.
1304
+ * @param name - the skill name the review actually loaded.
1305
+ */
1306
+ function recordReviewRead(name) {
1307
+ const context = storage.getStore();
1308
+ if (context?.reads === void 0 || name.trim() === "") return;
1309
+ context.reads.add(name.trim());
1310
+ }
1301
1311
  //#endregion
1302
1312
  //#region lib/types/skill-health.js
1303
1313
  /**
@@ -1406,4 +1416,4 @@ function assessStructureHealth(snapshot, thresholds = DEFAULT_HEALTH_THRESHOLDS)
1406
1416
  };
1407
1417
  }
1408
1418
  //#endregion
1409
- export { authorityFrom as $, listEventArchives as A, COST_CJK_TOKEN_HIGH as B, EVENT_ARCHIVE_PREFIX as C, appendEvolutionEvent as D, EVENT_LOG_VERSION as E, RULES as F, tokenLineFor as G, TOKEN_ASCII_WEIGHT as H, diffFindings as I, isUnreadWrite as J, READ_REQUIRED_ACTIONS as K, lintSkill as L, readEvolutionEvents as M, readEvolutionTimeline as N, eventsFile as O, retainEventArchives as P, DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS as Q, COST_ASCII_TOKEN_HIGH as R, trimPatternBoundaries as S, EVENT_LOG_ROTATE_AT as T, TOKEN_CJK_WEIGHT as U, COST_CJK_TOKEN_LOW as V, bodyCost as W, sessionReadSupportFiles as X, sessionReadSkillNames as Y, DEFAULT_WRITE_CONFIRM_MODE as Z, scanThreats as _, lintBody as a, FUZZY_MAX_WORK as b, clearReviewChannel as c, sweepReviewChannelSessions as d, PATTERN_OVERLAP as f, scanMemoryThreats as g, scanContentThreats as h, assessStructureHealth as i, parseEvolutionEvents as j, evolutionEventPayloadIssue as k, isReviewChannelSession as l, evaluateThreat as m, HEALTH_STAMP_RE as n, currentReviewContext as o, THREAT_EXEMPTION_HINT as p, filterUnreadSkillOps as q, MIN_STAMP_BODY_CHARS as r, withReviewContext as s, DEFAULT_HEALTH_THRESHOLDS as t, markReviewChannel as u, makeSerialQueue as v, EVENT_LOG_RETAIN_ARCHIVES as w, fuzzyPatch as x, FUZZY_MAX_PATTERN_CHARS as y, COST_ASCII_TOKEN_LOW as z };
1419
+ export { DEFAULT_WRITE_CONFIRM_TIMEOUT_SECONDS as $, evolutionEventPayloadIssue as A, COST_ASCII_TOKEN_LOW as B, trimPatternBoundaries as C, EVENT_LOG_VERSION as D, EVENT_LOG_ROTATE_AT as E, retainEventArchives as F, bodyCost as G, COST_CJK_TOKEN_LOW as H, RULES as I, filterUnreadSkillOps as J, tokenLineFor as K, diffFindings as L, parseEvolutionEvents as M, readEvolutionEvents as N, appendEvolutionEvent as O, readEvolutionTimeline as P, DEFAULT_WRITE_CONFIRM_MODE as Q, lintSkill as R, fuzzyPatch as S, EVENT_LOG_RETAIN_ARCHIVES as T, TOKEN_ASCII_WEIGHT as U, COST_CJK_TOKEN_HIGH as V, TOKEN_CJK_WEIGHT as W, sessionReadSkillNames as X, isUnreadWrite as Y, sessionReadSupportFiles as Z, scanMemoryThreats as _, lintBody as a, FUZZY_MAX_PATTERN_CHARS as b, withReviewContext as c, markReviewChannel as d, authorityFrom as et, sweepReviewChannelSessions as f, scanContentThreats as g, evaluateThreat as h, assessStructureHealth as i, listEventArchives as j, eventsFile as k, clearReviewChannel as l, THREAT_EXEMPTION_HINT as m, HEALTH_STAMP_RE as n, currentReviewContext as o, PATTERN_OVERLAP as p, READ_REQUIRED_ACTIONS as q, MIN_STAMP_BODY_CHARS as r, recordReviewRead as s, DEFAULT_HEALTH_THRESHOLDS as t, isReviewChannelSession as u, scanThreats as v, EVENT_ARCHIVE_PREFIX as w, FUZZY_MAX_WORK as x, makeSerialQueue as y, COST_ASCII_TOKEN_HIGH as z };
@@ -1299,6 +1299,46 @@ const HISTORY_INDEX_VERSION = 1;
1299
1299
  /** The action label for a predecessor the index had never seen (content found on disk before this
1300
1300
  * feature existed, or a hand-edited tree): it says "this is what was there", not what wrote it. */
1301
1301
  const BASELINE_ACTION = "baseline";
1302
+ /** Default hard cap for a change summary, counted in Unicode code points. */
1303
+ const DEFAULT_SKILL_WRITE_SUMMARY_CHARS = 50;
1304
+ /** Count a summary the same way the write gate does (code points, not UTF-16 units). */
1305
+ function summaryChars(text) {
1306
+ return [...text].length;
1307
+ }
1308
+ /** Normalize a model-supplied summary: single line, trimmed, non-empty, within the hard cap. */
1309
+ function normalizeChangeSummary(value, cap = 50) {
1310
+ if (typeof value !== "string") return {
1311
+ ok: false,
1312
+ reason: "missing",
1313
+ length: 0
1314
+ };
1315
+ const text = value.replace(/\s+/g, " ").trim();
1316
+ if (text === "") return {
1317
+ ok: false,
1318
+ reason: "missing",
1319
+ length: 0
1320
+ };
1321
+ if (value.includes("\n") || value.includes("\r")) return {
1322
+ ok: false,
1323
+ reason: "multiline",
1324
+ length: summaryChars(text)
1325
+ };
1326
+ const length = summaryChars(text);
1327
+ return length <= cap ? {
1328
+ ok: true,
1329
+ text
1330
+ } : {
1331
+ ok: false,
1332
+ reason: "length",
1333
+ length
1334
+ };
1335
+ }
1336
+ /** Clip a host-generated summary to the same hard cap; host facts are not rejected. */
1337
+ function clipChangeSummary(text, cap = 50) {
1338
+ const line = text.replace(/\s+/g, " ").trim();
1339
+ const chars = [...line];
1340
+ return chars.length <= cap ? line : chars.slice(0, Math.max(1, cap - 1)).join("") + "…";
1341
+ }
1302
1342
  /** The root-level history directory. */
1303
1343
  function historyRoot(root) {
1304
1344
  return join(root, HISTORY_DIR);
@@ -1450,6 +1490,7 @@ function readVersionEntry(entry) {
1450
1490
  if (typeof candidate.action !== "string") return null;
1451
1491
  if (typeof candidate.chars !== "number") return null;
1452
1492
  const summary = typeof candidate.summary === "string" && candidate.summary !== "" ? candidate.summary : void 0;
1493
+ const summarySource = candidate.summarySource === "model" || candidate.summarySource === "host" || candidate.summarySource === "fallback" ? candidate.summarySource : void 0;
1453
1494
  const path = typeof candidate.path === "string" && candidate.path !== "" ? candidate.path : void 0;
1454
1495
  const unitId = typeof candidate.unitId === "string" && candidate.unitId !== "" ? candidate.unitId : void 0;
1455
1496
  const removed = candidate.removed === true ? true : void 0;
@@ -1461,6 +1502,7 @@ function readVersionEntry(entry) {
1461
1502
  hash: candidate.hash,
1462
1503
  chars: candidate.chars,
1463
1504
  ...summary === void 0 ? {} : { summary },
1505
+ ...summarySource === void 0 ? {} : { summarySource },
1464
1506
  ...path === void 0 ? {} : { path },
1465
1507
  ...unitId === void 0 ? {} : { unitId },
1466
1508
  ...removed === void 0 ? {} : { removed },
@@ -1551,6 +1593,7 @@ function nextHistoryIndex(versions, input, keep) {
1551
1593
  chars: input.after?.length ?? 0,
1552
1594
  ...pathField,
1553
1595
  ...input.summary === void 0 ? {} : { summary: input.summary },
1596
+ ...input.summarySource === void 0 ? {} : { summarySource: input.summarySource },
1554
1597
  ...beforeHash === null ? {} : { beforeHash }
1555
1598
  });
1556
1599
  }
@@ -1566,7 +1609,8 @@ function nextHistoryIndex(versions, input, keep) {
1566
1609
  ...pathField,
1567
1610
  ...input.unitId === void 0 ? {} : { unitId: input.unitId },
1568
1611
  ...input.unitHead === void 0 ? {} : { unitHead: input.unitHead },
1569
- ...input.summary === void 0 ? {} : { summary: input.summary }
1612
+ ...input.summary === void 0 ? {} : { summary: input.summary },
1613
+ ...input.summarySource === void 0 ? {} : { summarySource: input.summarySource }
1570
1614
  });
1571
1615
  }
1572
1616
  const budget = clampKeep(keep);
@@ -1862,4 +1906,4 @@ function elapsedSince(at, nowMs) {
1862
1906
  };
1863
1907
  }
1864
1908
  //#endregion
1865
- export { validateMutationRequest as $, UNIT_JOURNAL_SCHEMA_VERSION as A, readUnitSnapshot as B, textDiffFacts as C, unitJournalPort as D, pruneTreeChangeUnits as E, writeUnitJournal as F, unitSnapshotsDir as G, unitIndexPath as H, UNIT_STORAGE_SCHEMA_VERSION as I, writeUnitEvidence as J, unitStorageKey as K, readUnitEvidence as L, readUnitJournal as M, unitJournalPath as N, unitSnapshotPort as O, unitJournalPhaseRank as P, fileMutationLock as Q, readUnitIndex as R, recordVersions as S, versionTarget as T, unitReceiptPath as U, unitEvidencePath as V, unitSnapshotPath as W, writeUnitSnapshot as X, writeUnitReceipt as Y, MutationUnit as Z, nextHistoryIndex as _, RETENTION_FEEDBACK_MIN_CHARS as a, partitionVersions as b, blobPath as c, entryTarget as d, WriteKernel as et, historyIndexFile as f, loadVersions as g, loadVersionContent as h, RETENTION_FEEDBACK_KEEP_RATIO as i, assertUnitJournalTransition as j, UNIT_JOURNAL_PHASES as k, contentRetentionFeedback as l, latestVersionAt as m, HISTORY_DIR as n, TEXT_DIFF_MAX_CHARS as o, historyRoot as p, upsertUnitIndex as q, HISTORY_INDEX_VERSION as r, TEXT_DIFF_MAX_LINES as s, BASELINE_ACTION as t, elapsedSince as u, orderVersions as v, versionActionKind as w, readHistoryIndex as x, parseHistoryIndex as y, readUnitReceipt as z };
1909
+ export { writeUnitReceipt as $, pruneTreeChangeUnits as A, UNIT_STORAGE_SCHEMA_VERSION as B, partitionVersions as C, textDiffFacts as D, summaryChars as E, assertUnitJournalTransition as F, unitEvidencePath as G, readUnitIndex as H, readUnitJournal as I, unitSnapshotPath as J, unitIndexPath as K, unitJournalPath as L, unitSnapshotPort as M, UNIT_JOURNAL_PHASES as N, versionActionKind as O, UNIT_JOURNAL_SCHEMA_VERSION as P, writeUnitEvidence as Q, unitJournalPhaseRank as R, parseHistoryIndex as S, recordVersions as T, readUnitReceipt as U, readUnitEvidence as V, readUnitSnapshot as W, unitStorageKey as X, unitSnapshotsDir as Y, upsertUnitIndex as Z, loadVersionContent as _, RETENTION_FEEDBACK_KEEP_RATIO as a, normalizeChangeSummary as b, TEXT_DIFF_MAX_LINES as c, contentRetentionFeedback as d, writeUnitSnapshot as et, elapsedSince as f, latestVersionAt as g, historyRoot as h, HISTORY_INDEX_VERSION as i, WriteKernel as it, unitJournalPort as j, versionTarget as k, blobPath as l, historyIndexFile as m, DEFAULT_SKILL_WRITE_SUMMARY_CHARS as n, fileMutationLock as nt, RETENTION_FEEDBACK_MIN_CHARS as o, entryTarget as p, unitReceiptPath as q, HISTORY_DIR as r, validateMutationRequest as rt, TEXT_DIFF_MAX_CHARS as s, BASELINE_ACTION as t, MutationUnit as tt, clipChangeSummary as u, loadVersions as v, readHistoryIndex as w, orderVersions as x, nextHistoryIndex as y, writeUnitJournal as z };