@lmzhen/dsh-evolution-core 0.3.24 → 0.3.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js
CHANGED
|
@@ -2332,7 +2332,10 @@ async function recordMutation(root, io, record, cap = 500) {
|
|
|
2332
2332
|
* delta rows.
|
|
2333
2333
|
*
|
|
2334
2334
|
* Same contract as `install-layered.mjs` `generateAgentPreset` (the source
|
|
2335
|
-
* install path) — installer.spec pins byte parity between the two
|
|
2335
|
+
* install path) — installer.spec pins byte parity between the two, and both
|
|
2336
|
+
* apply the identical row-collision contract: a delta id that overlaps a
|
|
2337
|
+
* standard row id fails loud by default, and `DSH_EVOLUTION_ALLOW_ROW_COLLISIONS=1`
|
|
2338
|
+
* downgrades it to a warning that keeps both (the row mounts twice).
|
|
2336
2339
|
*
|
|
2337
2340
|
* Row ids are read from `- id:` lines; an id present in both fragments would
|
|
2338
2341
|
* mount twice and could shadow the platform row, so it fails loud.
|
|
@@ -2343,7 +2346,8 @@ async function recordMutation(root, io, record, cap = 500) {
|
|
|
2343
2346
|
function composePresetComposition(standardComposition, deltaComposition) {
|
|
2344
2347
|
const standardIds = compositionRowIds(standardComposition);
|
|
2345
2348
|
const collisions = [...compositionRowIds(deltaComposition)].filter((id) => standardIds.has(id)).sort();
|
|
2346
|
-
if (collisions.length > 0) throw new Error(`evolution preset composition: delta rows collide with runtime standard rows: ${collisions.join(", ")}`);
|
|
2349
|
+
if (collisions.length > 0 && process.env.DSH_EVOLUTION_ALLOW_ROW_COLLISIONS !== "1") throw new Error(`evolution preset composition: delta rows collide with runtime standard rows: ${collisions.join(", ")}`);
|
|
2350
|
+
if (collisions.length > 0) console.warn(`evolution preset composition: warning — delta rows collide with standard rows (${collisions.join(", ")}); keeping both (DSH_EVOLUTION_ALLOW_ROW_COLLISIONS=1)`);
|
|
2347
2351
|
return `${standardComposition.replace(/\s+$/, "")}\n\n${deltaComposition.trim()}\n`;
|
|
2348
2352
|
}
|
|
2349
2353
|
function compositionRowIds(composition) {
|
|
@@ -2582,8 +2586,15 @@ const DEFAULT_HEALTH_THRESHOLDS = {
|
|
|
2582
2586
|
stampDensityPerKb: 2,
|
|
2583
2587
|
churnMinPatches: 20
|
|
2584
2588
|
};
|
|
2585
|
-
/**
|
|
2586
|
-
|
|
2589
|
+
/**
|
|
2590
|
+
* Stamp regex shared by health assessment and the maintenance probe (single
|
|
2591
|
+
* source, 011). Two refinements over the naive form (F-320): the hex branch
|
|
2592
|
+
* requires at least one digit so coincidental all-letter English words
|
|
2593
|
+
* (`defaced`, `feedback`) are not counted as commit shas; the ISO branch
|
|
2594
|
+
* accepts a UTC `Z`, a numeric UTC offset (`+08:00`), or no timezone at all —
|
|
2595
|
+
* non-UTC timestamps used to escape detection (log-like content missed).
|
|
2596
|
+
*/
|
|
2597
|
+
const HEALTH_STAMP_RE = new RegExp(String.raw`\brc\.\d+\b|\b(?=[0-9a-f]{7,40}\b)[0-9a-f]*[0-9][0-9a-f]*\b|\b\d{4}-\d{2}-\d{2}(?:T[0-9:.]+(?:Z|[+-]\d{2}:?\d{2})?)?\b`, "g");
|
|
2587
2598
|
/**
|
|
2588
2599
|
* Bodies below this size skip stamp-density assessment: a few dates or shas
|
|
2589
2600
|
* in a short body are ordinary documentation, not log-like content. With the
|
|
@@ -2926,7 +2937,9 @@ function skillDir(root, name) {
|
|
|
2926
2937
|
/** Dot-prefixed on-disk marker name. SINGLE source: `list()` matches directory
|
|
2927
2938
|
* entries against this name, and path builders must never hardcode a marker
|
|
2928
2939
|
* literal (N-1: the rc.49 exists()-probe convergence dropped the dot,
|
|
2929
|
-
* poisoning every protectedBy/managed report).
|
|
2940
|
+
* poisoning every protectedBy/managed report). Exported for cross-package
|
|
2941
|
+
* consumers that must probe markers without re-deriving the name (curator's
|
|
2942
|
+
* archive-copy bundled probe, 0.3.26 V4-02). */
|
|
2930
2943
|
function markerEntryName(marker) {
|
|
2931
2944
|
return `.${marker}`;
|
|
2932
2945
|
}
|
|
@@ -3109,7 +3122,7 @@ function relatedSkillNames(content, exclude) {
|
|
|
3109
3122
|
const raw = parsed.frontmatter["related_skills"];
|
|
3110
3123
|
if (typeof raw !== "string") return [];
|
|
3111
3124
|
const names = /* @__PURE__ */ new Set();
|
|
3112
|
-
for (const match of Array.from(raw.matchAll(/[a-z0-9][a-z0-9-]
|
|
3125
|
+
for (const match of Array.from(raw.matchAll(/(?<![A-Za-z0-9_-])[a-z0-9][a-z0-9-]*(?![A-Za-z0-9_-])/g))) {
|
|
3113
3126
|
const target = match[0];
|
|
3114
3127
|
if (target && SKILL_NAME_RE.test(target) && target !== exclude) names.add(target);
|
|
3115
3128
|
}
|
|
@@ -3853,7 +3866,7 @@ var SkillLibrary = class {
|
|
|
3853
3866
|
const protection = await this.deleteProtection(name, options.allowBundled === void 0 ? {} : { allowBundled: options.allowBundled });
|
|
3854
3867
|
if (protection) return {
|
|
3855
3868
|
ok: false,
|
|
3856
|
-
message: `Skill "${name}" is protected (${protection}).`
|
|
3869
|
+
message: protection === "pinned" ? `Skill "${name}" is pinned and cannot be archived. Remove the \`.pinned\` marker in its directory, then retry.` : `Skill "${name}" is protected (${protection}).`
|
|
3857
3870
|
};
|
|
3858
3871
|
if (options.absorbedInto) {
|
|
3859
3872
|
if (options.absorbedInto.trim() === name) return {
|
|
@@ -4603,7 +4616,7 @@ var SkillLibrary = class {
|
|
|
4603
4616
|
rootEntries = [];
|
|
4604
4617
|
}
|
|
4605
4618
|
for (const entry of rootEntries) {
|
|
4606
|
-
if (entry.
|
|
4619
|
+
if (entry === ".archive" || entry === ".backups" || entry === ".mutations.json" || entry === ".curator-suppressed.json") continue;
|
|
4607
4620
|
await this.io.remove(join(this.root, entry));
|
|
4608
4621
|
}
|
|
4609
4622
|
const manifest = await this.readSnapshotManifest(snapshotPath);
|
|
@@ -4684,4 +4697,4 @@ function clampedNumber(value, fallback, opts) {
|
|
|
4684
4697
|
return value;
|
|
4685
4698
|
}
|
|
4686
4699
|
//#endregion
|
|
4687
|
-
export { AUTHORING_DESCRIPTION_BAR, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_USER_CHAR_LIMIT, 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_WRITE_TOOLS, EvolutionGateSet, FORBIDDEN_CONTROL_KEYS, HEALTH_STAMP_RE, LOW_QUALITY_THRESHOLD, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_RESTRUCTURE_MOVES, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MIN_STAMP_BODY_CHARS, MUTATIONS_FILE_VERSION, MemoryStore, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, QUALITY_WEIGHTS, RESTRUCTURE_TARGET_RE, SKILLS_GUIDANCE, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, advanceReview, appendEvolutionEvent, applyCuratorFields, applyCuratorLifecycleFields, applyCuratorMetaFields, assessStructureHealth, authoringFeedback, buildCuratorRunReport, buildLearnPrompt, bumpPatch, bumpUse, bumpView, clampedNumber, composePresetComposition, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, duplicateHeadings, emptyRecord, evaluateThreat, eventsFile, evolutionHome, evolutionIoAdapter, evolutionRoot, findDriftSignal, foldCuratorFields, foldTurn, frontmatterBlock, frontmatterYamlUnsafeValues, getRecord, latestActivityAt, lifecycleCandidate, listEventArchives, loadMutations, loadSuppressedNames, loadUsage, makeSerialQueue, markAgentCreated, memoryRoot, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, observeEvent, overlongLines, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, readEvolutionEvents, readEvolutionTimeline, recordMutation, redactSecrets, relatedSkillNames, renameWithRetry, renderCuratorReportMarkdown, resolveOrigins, resolveSkillsRoot, retainEventArchives, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, transactIo, updateSuppressedNames, usageFile, usageObserved, validateFrontmatter, verifyPromptBundle, yamlPlainScalarNeedsQuotes };
|
|
4700
|
+
export { AUTHORING_DESCRIPTION_BAR, COMBINED_REVIEW_PLAN_PROMPT, COMBINED_REVIEW_PROMPT, COMPLETION_SKILL_REVIEW_PROMPT, CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CONSOLIDATION_FAILURES, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MAX_OPS_PER_PLAN, DEFAULT_MEMORY_CHAR_LIMIT, DEFAULT_MIN_IDLE_HOURS, DEFAULT_MUTATION_CAP, DEFAULT_REVIEW_MEMORY_INTERVAL, DEFAULT_REVIEW_SKILL_INTERVAL, DEFAULT_SKILL_CONTENT_CHARS, DEFAULT_SKILL_LIMITS, DEFAULT_SKILL_REVIEW_COMPLETION_MIN_TOOL_CALLS, DEFAULT_SKILL_REVIEW_TRIGGER, DEFAULT_STALE_AFTER_DAYS, DEFAULT_SUBSTANTIVE_MIN_AGENT_CHARS, DEFAULT_SUBSTANTIVE_MIN_TOOL_CALLS, DEFAULT_SUBSTANTIVE_MIN_USER_CHARS, DEFAULT_USER_CHAR_LIMIT, 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_WRITE_TOOLS, EvolutionGateSet, FORBIDDEN_CONTROL_KEYS, HEALTH_STAMP_RE, LOW_QUALITY_THRESHOLD, MAINTAIN_PROMPT, MAX_DESCRIPTION_LENGTH, MAX_RESTRUCTURE_MOVES, MAX_SKILL_CONTENT_CHARS, MAX_SKILL_FILE_BYTES, MAX_SKILL_NAME_LENGTH, MEMORY_REVIEW_PROMPT, MIN_STAMP_BODY_CHARS, MUTATIONS_FILE_VERSION, MemoryStore, PROMPT_BUNDLE, PROMPT_BUNDLE_ID, PROMPT_BUNDLE_VERSION, PROTECTED_BUILTIN_SKILLS, QUALITY_WEIGHTS, RESTRUCTURE_TARGET_RE, SKILLS_GUIDANCE, SKILL_NAME_RE, SKILL_REVIEW_PLAN_PROMPT, SKILL_REVIEW_PROMPT, SNAPSHOT_EXTRA_NAME_RE, SUPPORT_DIRS, SUPPRESSED_FILE_VERSION, SkillLibrary, advanceReview, appendEvolutionEvent, applyCuratorFields, applyCuratorLifecycleFields, applyCuratorMetaFields, assessStructureHealth, authoringFeedback, buildCuratorRunReport, buildLearnPrompt, bumpPatch, bumpUse, bumpView, clampedNumber, composePresetComposition, computeDedupGroups, computeDriftSignals, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, createGateSet, duplicateHeadings, emptyRecord, evaluateThreat, eventsFile, evolutionHome, evolutionIoAdapter, evolutionRoot, findDriftSignal, foldCuratorFields, foldTurn, frontmatterBlock, frontmatterYamlUnsafeValues, getRecord, latestActivityAt, lifecycleCandidate, listEventArchives, loadMutations, loadSuppressedNames, loadUsage, makeSerialQueue, markAgentCreated, markerEntryName, memoryRoot, missingSupportPointers, mutateUsage, mutationsFile, narrowNameMatches, nodeEvolutionIo, normalizeFrontmatter, normalizeUsageRecord, observeEvent, overlongLines, parseCuratorNominations, parseEvolutionEvents, parseFrontmatter, readEvolutionEvents, readEvolutionTimeline, recordMutation, redactSecrets, relatedSkillNames, renameWithRetry, renderCuratorReportMarkdown, resolveOrigins, resolveSkillsRoot, retainEventArchives, reviewPrompt, saveSuppressedNames, saveUsage, scanContentThreats, scanMemoryThreats, scanThreats, skillsRoot, suppressedFile, transactIo, updateSuppressedNames, usageFile, usageObserved, validateFrontmatter, verifyPromptBundle, yamlPlainScalarNeedsQuotes };
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
* delta rows.
|
|
7
7
|
*
|
|
8
8
|
* Same contract as `install-layered.mjs` `generateAgentPreset` (the source
|
|
9
|
-
* install path) — installer.spec pins byte parity between the two
|
|
9
|
+
* install path) — installer.spec pins byte parity between the two, and both
|
|
10
|
+
* apply the identical row-collision contract: a delta id that overlaps a
|
|
11
|
+
* standard row id fails loud by default, and `DSH_EVOLUTION_ALLOW_ROW_COLLISIONS=1`
|
|
12
|
+
* downgrades it to a warning that keeps both (the row mounts twice).
|
|
10
13
|
*
|
|
11
14
|
* Row ids are read from `- id:` lines; an id present in both fragments would
|
|
12
15
|
* mount twice and could shadow the platform row, so it fails loud.
|
|
@@ -22,7 +22,14 @@ export interface SkillHealthThresholds {
|
|
|
22
22
|
churnMinPatches: number;
|
|
23
23
|
}
|
|
24
24
|
export declare const DEFAULT_HEALTH_THRESHOLDS: SkillHealthThresholds;
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Stamp regex shared by health assessment and the maintenance probe (single
|
|
27
|
+
* source, 011). Two refinements over the naive form (F-320): the hex branch
|
|
28
|
+
* requires at least one digit so coincidental all-letter English words
|
|
29
|
+
* (`defaced`, `feedback`) are not counted as commit shas; the ISO branch
|
|
30
|
+
* accepts a UTC `Z`, a numeric UTC offset (`+08:00`), or no timezone at all —
|
|
31
|
+
* non-UTC timestamps used to escape detection (log-like content missed).
|
|
32
|
+
*/
|
|
26
33
|
export declare const HEALTH_STAMP_RE: RegExp;
|
|
27
34
|
/**
|
|
28
35
|
* Bodies below this size skip stamp-density assessment: a few dates or shas
|
|
@@ -108,6 +108,13 @@ export declare function resolveOrigins(headerOrigin: string | undefined, isRevie
|
|
|
108
108
|
approval: 'foreground' | 'background_review';
|
|
109
109
|
library: WriteOrigin;
|
|
110
110
|
};
|
|
111
|
+
/** Dot-prefixed on-disk marker name. SINGLE source: `list()` matches directory
|
|
112
|
+
* entries against this name, and path builders must never hardcode a marker
|
|
113
|
+
* literal (N-1: the rc.49 exists()-probe convergence dropped the dot,
|
|
114
|
+
* poisoning every protectedBy/managed report). Exported for cross-package
|
|
115
|
+
* consumers that must probe markers without re-deriving the name (curator's
|
|
116
|
+
* archive-copy bundled probe, 0.3.26 V4-02). */
|
|
117
|
+
export declare function markerEntryName(marker: 'bundled' | 'hub-installed' | 'pinned' | 'hermes-managed'): string;
|
|
111
118
|
export interface Frontmatter {
|
|
112
119
|
name?: string;
|
|
113
120
|
description?: string;
|
package/package.json
CHANGED