@lmzhen/dsh-evolution-curator 0.21.0 → 0.23.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 +10 -15
- package/lib/types/index.d.ts +6 -1
- package/package.json +7 -7
package/lib/index.js
CHANGED
|
@@ -3,7 +3,8 @@ 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 {
|
|
6
|
+
import { preferProvider } from "@lmzhen/dsh-evolution-io";
|
|
7
|
+
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_REVIEW_TIMEOUT_MS, DEFAULT_SKILL_LIMITS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, INSTANCE_KEYS, MAX_TIMER_DELAY_MS, PROMPT_BUNDLE, SKILL_NAME_RE, buildCuratorRunReport, claimInstance, clampOnce, clampedNumber, computeDedupGroups, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, emptyRecord, entryTarget, evolutionHome, evolutionIoAdapter, foldCuratorFields, isPresent, isUnknown, liveBool, loadSuppressedNames, loadUsage, markerEntryName, mutateUsage, newSkillLibrary, paramRowId, parseCuratorNominations, parseFrontmatter, pickWithPolicy, policyStageLimits, probeList, probeText, readNumberParam, relatedSkillNames, releaseInstance, renderCuratorReportMarkdown, reportTime, reportsSweepLockTarget, sessionLastEventTime, sweepReports, transactIo, unwrapLive, updateSuppressedNames, usageObserved, userSetKeys, verifyPromptBundle } from "@lmzhen/dsh-evolution-core";
|
|
7
8
|
//#region lib/types/index.js
|
|
8
9
|
/**
|
|
9
10
|
* Deterministic skill lifecycle curator with interval gate and archive.
|
|
@@ -11,12 +12,6 @@ import { CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEF
|
|
|
11
12
|
*/
|
|
12
13
|
/** Quality-warned skills may turn stale after this many idle days (package-private tunable, P2-8). */
|
|
13
14
|
const DEFAULT_QUALITY_WARN_STALE_AFTER_DAYS = 7;
|
|
14
|
-
/** B-10 (v18): the optional LLM nomination pass gets its own timeout so a
|
|
15
|
-
* hung/unresponsive provider cannot hold the control-plane mutex forever
|
|
16
|
-
* (`run()` never returns; `restore()`/`consolidate()` queue behind it).
|
|
17
|
-
* 120s matches the review subagent default; the 32-bit ceiling is Node's
|
|
18
|
-
* timer-delay limit (`AbortSignal.timeout` throws above it). */
|
|
19
|
-
const DEFAULT_CURATOR_REVIEW_TIMEOUT_MS = 12e4;
|
|
20
15
|
/**
|
|
21
16
|
* The cross-field rule the schema cannot express (A2-17): an archive threshold
|
|
22
17
|
* below the stale threshold makes the engine reactivate stale records instead of
|
|
@@ -59,7 +54,7 @@ var EvolutionCurator = class extends Service {
|
|
|
59
54
|
autoStart: z.boolean().default(true),
|
|
60
55
|
bootGraceSeconds: z.number().min(0).default(DEFAULT_CURATOR_BOOT_GRACE_SECONDS),
|
|
61
56
|
curatorReviewMaxTokens: z.number().min(1).default(DEFAULT_CURATOR_REVIEW_MAX_TOKENS).volatile(),
|
|
62
|
-
curatorReviewTimeoutMs: z.number().min(1).max(MAX_TIMER_DELAY_MS).default(
|
|
57
|
+
curatorReviewTimeoutMs: z.number().min(1).max(MAX_TIMER_DELAY_MS).default(DEFAULT_REVIEW_TIMEOUT_MS).volatile(),
|
|
63
58
|
healthSoftBodyChars: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.softBodyChars).volatile(),
|
|
64
59
|
healthStampDensityPerKb: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.stampDensityPerKb).volatile(),
|
|
65
60
|
healthChurnMinPatches: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.churnMinPatches).volatile()
|
|
@@ -121,7 +116,7 @@ var EvolutionCurator = class extends Service {
|
|
|
121
116
|
if (typeof disposer === "function") ctx.effect(() => disposer, "evolution-curator: settings presentation");
|
|
122
117
|
});
|
|
123
118
|
if (!verifyPromptBundle(PROMPT_BUNDLE)) throw new Error("dsh-evolution prompt bundle integrity check failed; refusing to run the curator");
|
|
124
|
-
this.io = evolutionIoAdapter(() => ctx.evolutionIo
|
|
119
|
+
this.io = evolutionIoAdapter(() => preferProvider(ctx.evolutionIo, ["fs"]));
|
|
125
120
|
this.skills = newSkillLibrary({
|
|
126
121
|
config,
|
|
127
122
|
io: this.io,
|
|
@@ -174,9 +169,9 @@ var EvolutionCurator = class extends Service {
|
|
|
174
169
|
* @param key - the canonical registry id of the field.
|
|
175
170
|
* @returns the current plain value, or undefined when nothing supplied one.
|
|
176
171
|
*/
|
|
177
|
-
|
|
178
|
-
if (key === "curatorIntervalHours") return this.config.curatorIntervalHours
|
|
179
|
-
return this.config[key]
|
|
172
|
+
rowValue(key) {
|
|
173
|
+
if (key === "curatorIntervalHours") return unwrapLive(this.config.curatorIntervalHours) ?? this.config.intervalHours;
|
|
174
|
+
return unwrapLive(this.config[key]);
|
|
180
175
|
}
|
|
181
176
|
/**
|
|
182
177
|
* One live numeric row field, clamped and warned once (G3.1).
|
|
@@ -187,7 +182,7 @@ var EvolutionCurator = class extends Service {
|
|
|
187
182
|
* @returns the value the engine may use.
|
|
188
183
|
*/
|
|
189
184
|
rowNumber(key, fallback, min, max) {
|
|
190
|
-
return clampOnce(this.clampedKeys, this.clampWarn, key, this.
|
|
185
|
+
return clampOnce(this.clampedKeys, this.clampWarn, key, this.rowValue(key), fallback, min, max);
|
|
191
186
|
}
|
|
192
187
|
/**
|
|
193
188
|
* One DEPLOYMENT numeric row field, clamped and warned once.
|
|
@@ -212,7 +207,7 @@ var EvolutionCurator = class extends Service {
|
|
|
212
207
|
* @returns the current value.
|
|
213
208
|
*/
|
|
214
209
|
rowBoolean(key, fallback) {
|
|
215
|
-
return this.config[key]
|
|
210
|
+
return liveBool(this.config[key], fallback);
|
|
216
211
|
}
|
|
217
212
|
/**
|
|
218
213
|
* This row's resolved values — the base layer of the precedence chain (G1 §8.3).
|
|
@@ -230,7 +225,7 @@ var EvolutionCurator = class extends Service {
|
|
|
230
225
|
minIdleFailOpen: this.rowBoolean("minIdleFailOpen", true),
|
|
231
226
|
llmReview: this.rowBoolean("llmReview", false),
|
|
232
227
|
curatorReviewMaxTokens: number("curatorReviewMaxTokens", DEFAULT_CURATOR_REVIEW_MAX_TOKENS, 1),
|
|
233
|
-
curatorReviewTimeoutMs: number("curatorReviewTimeoutMs",
|
|
228
|
+
curatorReviewTimeoutMs: number("curatorReviewTimeoutMs", DEFAULT_REVIEW_TIMEOUT_MS, 1, MAX_TIMER_DELAY_MS),
|
|
234
229
|
healthSoftBodyChars: number("healthSoftBodyChars", DEFAULT_HEALTH_THRESHOLDS.softBodyChars, 1),
|
|
235
230
|
healthStampDensityPerKb: number("healthStampDensityPerKb", DEFAULT_HEALTH_THRESHOLDS.stampDensityPerKb, 1),
|
|
236
231
|
healthChurnMinPatches: number("healthChurnMinPatches", DEFAULT_HEALTH_THRESHOLDS.churnMinPatches, 1)
|
package/lib/types/index.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ import { EvolutionGateSet, type SkillLibrary } from '@lmzhen/dsh-evolution-core'
|
|
|
17
17
|
import { type CuratorConsolidation, type CuratorNominations, type CuratorRunReport, type ScopeView, type SkillActionResult, type SkillHealthVerdict } from '@lmzhen/dsh-evolution-core';
|
|
18
18
|
import type { SkillVersion } from '@lmzhen/dsh-evolution-core';
|
|
19
19
|
import type { CuratorStateRecord } from '@lmzhen/dsh-evolution-state';
|
|
20
|
+
/** B-10 (v18): the optional LLM nomination pass gets its own timeout so a
|
|
21
|
+
* hung/unresponsive provider cannot hold the control-plane mutex forever
|
|
22
|
+
* (`run()` never returns; `restore()`/`consolidate()` queue behind it).
|
|
23
|
+
* 120s matches the review subagent default; the 32-bit ceiling is Node's
|
|
24
|
+
* timer-delay limit (`AbortSignal.timeout` throws above it). */
|
|
20
25
|
declare module '@deepseek-ai/cordis' {
|
|
21
26
|
interface Context {
|
|
22
27
|
evolutionCurator: EvolutionCurator;
|
|
@@ -244,7 +249,7 @@ export declare class EvolutionCurator extends Service {
|
|
|
244
249
|
* @param key - the canonical registry id of the field.
|
|
245
250
|
* @returns the current plain value, or undefined when nothing supplied one.
|
|
246
251
|
*/
|
|
247
|
-
private
|
|
252
|
+
private rowValue;
|
|
248
253
|
/**
|
|
249
254
|
* One live numeric row field, clamped and warned once (G3.1).
|
|
250
255
|
* @param key - the canonical registry id of the field.
|
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.23.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.4",
|
|
30
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
30
|
+
"@lmzhen/dsh-evolution-core": "^0.23.0"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
34
34
|
"@deepseek-ai/dsh-llm": "^0.2.0-rc.1",
|
|
35
35
|
"@deepseek-ai/dsh-session": "^0.2.0-rc.1",
|
|
36
|
-
"@lmzhen/dsh-evolution-io": "^0.
|
|
37
|
-
"@lmzhen/dsh-evolution-state": "^0.
|
|
36
|
+
"@lmzhen/dsh-evolution-io": "^0.23.0",
|
|
37
|
+
"@lmzhen/dsh-evolution-state": "^0.23.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@deepseek-ai/dsh-llm": "^0.2.0-rc.1",
|
|
41
41
|
"@deepseek-ai/dsh-session": "^0.2.0-rc.1",
|
|
42
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
43
|
-
"@lmzhen/dsh-evolution-io": "^0.
|
|
44
|
-
"@lmzhen/dsh-evolution-state": "^0.
|
|
42
|
+
"@lmzhen/dsh-evolution-core": "^0.23.0",
|
|
43
|
+
"@lmzhen/dsh-evolution-io": "^0.23.0",
|
|
44
|
+
"@lmzhen/dsh-evolution-state": "^0.23.0"
|
|
45
45
|
}
|
|
46
46
|
}
|