@lmzhen/dsh-evolution-curator 0.3.61 → 0.3.62
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 +19 -6
- package/lib/types/index.d.ts +8 -0
- 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_INTERVAL_HOURS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MIN_IDLE_HOURS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, SKILL_NAME_RE, SkillLibrary, buildCuratorRunReport, clampedNumber, computeDedupGroups, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, emptyRecord, evolutionHome, evolutionIoAdapter, foldCuratorFields, loadSuppressedNames, loadUsage, markerEntryName, mutateUsage, parseCuratorNominations, parseFrontmatter, relatedSkillNames, renderCuratorReportMarkdown, resolveSkillsRoot, 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_REVIEW_MAX_TOKENS, DEFAULT_HEALTH_THRESHOLDS, DEFAULT_MIN_IDLE_HOURS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, SKILL_NAME_RE, SkillLibrary, buildCuratorRunReport, clampedNumber, computeDedupGroups, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, emptyRecord, evolutionHome, evolutionIoAdapter, foldCuratorFields, loadSuppressedNames, loadUsage, markerEntryName, mutateUsage, parseCuratorNominations, parseFrontmatter, relatedSkillNames, renderCuratorReportMarkdown, resolveSkillsRoot, 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.
|
|
@@ -39,8 +39,8 @@ var EvolutionCurator = class extends Service {
|
|
|
39
39
|
pruneBuiltins: z.boolean().default(false),
|
|
40
40
|
referencedSkillNames: z.array(z.string()).default([]),
|
|
41
41
|
autoStart: z.boolean().default(true),
|
|
42
|
-
bootGraceSeconds: z.number().min(0).default(
|
|
43
|
-
curatorReviewMaxTokens: z.number().min(1).default(
|
|
42
|
+
bootGraceSeconds: z.number().min(0).default(DEFAULT_CURATOR_BOOT_GRACE_SECONDS),
|
|
43
|
+
curatorReviewMaxTokens: z.number().min(1).default(DEFAULT_CURATOR_REVIEW_MAX_TOKENS),
|
|
44
44
|
healthSoftBodyChars: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.softBodyChars),
|
|
45
45
|
healthStampDensityPerKb: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.stampDensityPerKb),
|
|
46
46
|
healthChurnMinPatches: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.churnMinPatches)
|
|
@@ -73,6 +73,8 @@ var EvolutionCurator = class extends Service {
|
|
|
73
73
|
* in-memory clock is seeded and later due runs must proceed, or the
|
|
74
74
|
* persisted===null defer repeats forever (no state service to persist). */
|
|
75
75
|
statelessFirstRunDeferred = false;
|
|
76
|
+
/** P2-5 (v14): one-shot warning that the interval baseline is process-only. */
|
|
77
|
+
statelessStateWarned = false;
|
|
76
78
|
constructor(ctx, config = {}) {
|
|
77
79
|
super(ctx, "evolutionCurator");
|
|
78
80
|
this.io = evolutionIoAdapter(() => ctx.evolutionIo.provider());
|
|
@@ -98,8 +100,8 @@ var EvolutionCurator = class extends Service {
|
|
|
98
100
|
this.manageUnmanaged = config.manageUnmanaged ?? false;
|
|
99
101
|
this.pruneBuiltins = config.pruneBuiltins ?? false;
|
|
100
102
|
this.referencedSkillNames = new Set(config.referencedSkillNames ?? []);
|
|
101
|
-
this.bootGraceSeconds = field("bootGraceSeconds", config.bootGraceSeconds,
|
|
102
|
-
this.curatorReviewMaxTokens = field("curatorReviewMaxTokens", config.curatorReviewMaxTokens,
|
|
103
|
+
this.bootGraceSeconds = field("bootGraceSeconds", config.bootGraceSeconds, DEFAULT_CURATOR_BOOT_GRACE_SECONDS, 0);
|
|
104
|
+
this.curatorReviewMaxTokens = field("curatorReviewMaxTokens", config.curatorReviewMaxTokens, DEFAULT_CURATOR_REVIEW_MAX_TOKENS, 1);
|
|
103
105
|
this.healthSoftBodyChars = field("healthSoftBodyChars", config.healthSoftBodyChars, DEFAULT_HEALTH_THRESHOLDS.softBodyChars, 1);
|
|
104
106
|
this.healthStampDensityPerKb = field("healthStampDensityPerKb", config.healthStampDensityPerKb, DEFAULT_HEALTH_THRESHOLDS.stampDensityPerKb, 1);
|
|
105
107
|
this.healthChurnMinPatches = field("healthChurnMinPatches", config.healthChurnMinPatches, DEFAULT_HEALTH_THRESHOLDS.churnMinPatches, 1);
|
|
@@ -171,10 +173,21 @@ var EvolutionCurator = class extends Service {
|
|
|
171
173
|
* HERE as a cheap pre-check (persisted or in-memory clock) AND again inside
|
|
172
174
|
* run() as the authoritative gate — the docstring no longer claims the two
|
|
173
175
|
* never duplicate; a future interval change must update both.
|
|
176
|
+
*
|
|
177
|
+
* P2-5 (v14): without the `evolution-state` service there is no durable
|
|
178
|
+
* `lastRunAt`, so the baseline degrades to this process's lifetime. That is
|
|
179
|
+
* a supported-but-degraded composition (every shipped bundle mounts the
|
|
180
|
+
* state rows), so the schedule is left as-is and the degradation is
|
|
181
|
+
* surfaced once instead of silently meaning "never runs".
|
|
174
182
|
*/
|
|
175
183
|
async autoCheck() {
|
|
176
184
|
try {
|
|
177
|
-
const
|
|
185
|
+
const stateService = this.curatorStateService();
|
|
186
|
+
if (stateService === void 0 && !this.statelessStateWarned) {
|
|
187
|
+
this.statelessStateWarned = true;
|
|
188
|
+
this.ctx.logger.warn("evolution-curator: evolution-state is not mounted — the curation interval baseline is this process's lifetime only (default interval 168h), so automatic curation will not fire again until the process has been alive that long. Mount evolution-state (evolution-host/all bundle) for a durable schedule.");
|
|
189
|
+
}
|
|
190
|
+
const last = (await stateService?.loadCuratorState())?.lastRunAt ?? this.lastRun;
|
|
178
191
|
if (Date.now() - last >= this.lifecycle().intervalHours * 36e5) await this.run();
|
|
179
192
|
} catch (error) {
|
|
180
193
|
const reason = error instanceof Error ? error.message : String(error);
|
package/lib/types/index.d.ts
CHANGED
|
@@ -115,6 +115,8 @@ export declare class EvolutionCurator extends Service {
|
|
|
115
115
|
* in-memory clock is seeded and later due runs must proceed, or the
|
|
116
116
|
* persisted===null defer repeats forever (no state service to persist). */
|
|
117
117
|
private statelessFirstRunDeferred;
|
|
118
|
+
/** P2-5 (v14): one-shot warning that the interval baseline is process-only. */
|
|
119
|
+
private statelessStateWarned;
|
|
118
120
|
constructor(ctx: Context, config?: Config);
|
|
119
121
|
private lifecycle;
|
|
120
122
|
start(): void;
|
|
@@ -139,6 +141,12 @@ export declare class EvolutionCurator extends Service {
|
|
|
139
141
|
* HERE as a cheap pre-check (persisted or in-memory clock) AND again inside
|
|
140
142
|
* run() as the authoritative gate — the docstring no longer claims the two
|
|
141
143
|
* never duplicate; a future interval change must update both.
|
|
144
|
+
*
|
|
145
|
+
* P2-5 (v14): without the `evolution-state` service there is no durable
|
|
146
|
+
* `lastRunAt`, so the baseline degrades to this process's lifetime. That is
|
|
147
|
+
* a supported-but-degraded composition (every shipped bundle mounts the
|
|
148
|
+
* state rows), so the schedule is left as-is and the degradation is
|
|
149
|
+
* surfaced once instead of silently meaning "never runs".
|
|
142
150
|
*/
|
|
143
151
|
private autoCheck;
|
|
144
152
|
/**
|
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.3.
|
|
4
|
+
"version": "0.3.62",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,20 +31,20 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
34
|
+
"@lmzhen/dsh-evolution-core": "^0.3.62"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
38
38
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
39
39
|
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
|
|
40
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
41
|
-
"@lmzhen/dsh-evolution-state": "^0.3.
|
|
40
|
+
"@lmzhen/dsh-evolution-io": "^0.3.62",
|
|
41
|
+
"@lmzhen/dsh-evolution-state": "^0.3.62"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
|
|
45
45
|
"@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
|
|
46
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
47
|
-
"@lmzhen/dsh-evolution-io": "^0.3.
|
|
48
|
-
"@lmzhen/dsh-evolution-state": "^0.3.
|
|
46
|
+
"@lmzhen/dsh-evolution-core": "^0.3.62",
|
|
47
|
+
"@lmzhen/dsh-evolution-io": "^0.3.62",
|
|
48
|
+
"@lmzhen/dsh-evolution-state": "^0.3.62"
|
|
49
49
|
}
|
|
50
50
|
}
|