@lmzhen/dsh-evolution-curator 0.4.0 → 0.5.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.
- package/lib/index.js +20 -7
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { randomUUID } from "node:crypto";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { BlockAssembler, createUserMessage } from "@deepseek-ai/dsh-llm";
|
|
5
5
|
import z from "@deepseek-ai/schemastery";
|
|
6
|
-
import { CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CURATOR_BOOT_GRACE_SECONDS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_CURATOR_MODEL, DEFAULT_CURATOR_REVIEW_MAX_TOKENS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MIN_IDLE_HOURS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, INSTANCE_KEYS, MAX_TIMER_DELAY_MS, SKILL_NAME_RE, buildCuratorRunReport, claimInstance, clampedNumber, computeDedupGroups, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, emptyRecord, evolutionHome, evolutionIoAdapter, foldCuratorFields, isPresent, isUnknown, loadSuppressedNames, loadUsage, markerEntryName, mutateUsage, newSkillLibrary, parseCuratorNominations, parseFrontmatter, probeList, probeMtime, relatedSkillNames, releaseInstance, renderCuratorReportMarkdown, transactIo, updateSuppressedNames, usageObserved } from "@lmzhen/dsh-evolution-core";
|
|
6
|
+
import { CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CURATOR_BOOT_GRACE_SECONDS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_CURATOR_MODEL, DEFAULT_CURATOR_REVIEW_MAX_TOKENS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MIN_IDLE_HOURS, DEFAULT_SKILL_LIMITS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, INSTANCE_KEYS, MAX_TIMER_DELAY_MS, SKILL_NAME_RE, buildCuratorRunReport, claimInstance, clampedNumber, computeDedupGroups, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, emptyRecord, evolutionHome, evolutionIoAdapter, foldCuratorFields, isPresent, isUnknown, loadSuppressedNames, loadUsage, markerEntryName, mutateUsage, newSkillLibrary, parseCuratorNominations, parseFrontmatter, policyStageLimits, probeList, probeMtime, relatedSkillNames, releaseInstance, renderCuratorReportMarkdown, transactIo, updateSuppressedNames, usageObserved } from "@lmzhen/dsh-evolution-core";
|
|
7
7
|
//#region lib/types/index.js
|
|
8
8
|
/**
|
|
9
9
|
* Deterministic skill lifecycle curator with interval gate and archive.
|
|
@@ -110,7 +110,11 @@ var EvolutionCurator = class extends Service {
|
|
|
110
110
|
this.skills = newSkillLibrary({
|
|
111
111
|
config,
|
|
112
112
|
io: this.io,
|
|
113
|
-
ctx: this.ctx
|
|
113
|
+
ctx: this.ctx,
|
|
114
|
+
limits: {
|
|
115
|
+
...DEFAULT_SKILL_LIMITS,
|
|
116
|
+
...policyStageLimits(this.ctx.get("evolutionPolicy")?.get?.())
|
|
117
|
+
}
|
|
114
118
|
});
|
|
115
119
|
this.enabled = config.enabled ?? true;
|
|
116
120
|
this.instanceHome = evolutionHome();
|
|
@@ -161,10 +165,16 @@ var EvolutionCurator = class extends Service {
|
|
|
161
165
|
}
|
|
162
166
|
lifecycle() {
|
|
163
167
|
const snapshot = this.ctx.get("evolutionPolicy")?.get();
|
|
168
|
+
const staleAfterDays = snapshot?.staleAfterDays ?? this.staleAfterDays;
|
|
169
|
+
let archiveAfterDays = snapshot?.archiveAfterDays ?? this.archiveAfterDays;
|
|
170
|
+
if (archiveAfterDays < staleAfterDays) {
|
|
171
|
+
this.ctx.logger.warn(`evolution-curator: policy archiveAfterDays (${archiveAfterDays}) < policy staleAfterDays (${staleAfterDays}); using the stale threshold as the archive threshold`);
|
|
172
|
+
archiveAfterDays = staleAfterDays;
|
|
173
|
+
}
|
|
164
174
|
return {
|
|
165
175
|
intervalHours: snapshot?.curatorIntervalHours ?? this.intervalHours,
|
|
166
|
-
staleAfterDays
|
|
167
|
-
archiveAfterDays
|
|
176
|
+
staleAfterDays,
|
|
177
|
+
archiveAfterDays
|
|
168
178
|
};
|
|
169
179
|
}
|
|
170
180
|
start() {
|
|
@@ -648,10 +658,13 @@ var EvolutionCurator = class extends Service {
|
|
|
648
658
|
});
|
|
649
659
|
const runAborted = errors.some((error) => error.startsWith("run aborted"));
|
|
650
660
|
if (!dryRun && !runAborted) this.lastRun = Date.now();
|
|
661
|
+
const finishedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
662
|
+
const wouldPrune = this.skills.archiveRetentionPolicy() === "report" ? await this.skills.expiredArchives() : void 0;
|
|
651
663
|
const report = buildCuratorRunReport({
|
|
652
664
|
runId,
|
|
653
665
|
startedAt,
|
|
654
|
-
finishedAt
|
|
666
|
+
finishedAt,
|
|
667
|
+
...wouldPrune === void 0 ? {} : { wouldPrune },
|
|
655
668
|
staleCandidates: result.markStale,
|
|
656
669
|
llmNominations,
|
|
657
670
|
archiveCandidates,
|
|
@@ -691,8 +704,8 @@ var EvolutionCurator = class extends Service {
|
|
|
691
704
|
const pausedNow = current?.paused ?? false;
|
|
692
705
|
return {
|
|
693
706
|
schemaVersion: 1,
|
|
694
|
-
lastRunAt: dryRun || runAborted ? persisted?.lastRunAt ?? this.lastRun : Date.now(),
|
|
695
|
-
runCount: dryRun || runAborted ? persisted?.runCount ?? 0 : (current?.runCount ?? 0) + 1,
|
|
707
|
+
lastRunAt: dryRun || runAborted ? current?.lastRunAt ?? persisted?.lastRunAt ?? this.lastRun : Date.now(),
|
|
708
|
+
runCount: dryRun || runAborted ? current?.runCount ?? persisted?.runCount ?? 0 : (current?.runCount ?? 0) + 1,
|
|
696
709
|
lastSummary: summary,
|
|
697
710
|
paused: pausedNow
|
|
698
711
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-curator",
|
|
3
3
|
"description": "Deterministic skill lifecycle and recovery (community build)",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,20 +27,20 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
30
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
30
|
+
"@lmzhen/dsh-evolution-core": "^0.5.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
34
34
|
"@deepseek-ai/dsh-llm": "^0.1.5-rc.2",
|
|
35
35
|
"@deepseek-ai/dsh-session": "^0.1.5-rc.2",
|
|
36
|
-
"@lmzhen/dsh-evolution-io": "^0.
|
|
37
|
-
"@lmzhen/dsh-evolution-state": "^0.
|
|
36
|
+
"@lmzhen/dsh-evolution-io": "^0.5.0",
|
|
37
|
+
"@lmzhen/dsh-evolution-state": "^0.5.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@deepseek-ai/dsh-llm": "^0.1.5-rc.2",
|
|
41
41
|
"@deepseek-ai/dsh-session": "^0.1.5-rc.2",
|
|
42
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
43
|
-
"@lmzhen/dsh-evolution-io": "^0.
|
|
44
|
-
"@lmzhen/dsh-evolution-state": "^0.
|
|
42
|
+
"@lmzhen/dsh-evolution-core": "^0.5.0",
|
|
43
|
+
"@lmzhen/dsh-evolution-io": "^0.5.0",
|
|
44
|
+
"@lmzhen/dsh-evolution-state": "^0.5.0"
|
|
45
45
|
}
|
|
46
46
|
}
|