@lmzhen/dsh-evolution-curator 0.54.0 → 0.55.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 CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createUserMessage, settingsPort } from "@lmzhen/dsh-evolution-core/platform";
2
2
  import { Service } from "@deepseek-ai/cordis";
3
- 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_MIN_IDLE_HOURS, DEFAULT_REVIEW_TIMEOUT_MS, DEFAULT_SKILL_LIMITS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, HomeAuthority, INSTANCE_KEYS, MAX_TIMER_DELAY_MS, PROMPT_BUNDLE, SKILL_NAME_RE, authorityFrom, buildCuratorRunReport, claimInstance, clampOnce, clampedNumber, computeDedupGroups, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, emptyRecord, eventsFile, evolutionHome, evolutionIoAdapter, foldCuratorFields, isPresent, isUnknown, liveBool, loadSuppressedNames, loadUsage, mutateUsage, paramRowId, parseCuratorNominations, pickWithPolicy, policyStageLimits, probeList, probeText, readEvolutionEvents, readNumberParam, releaseInstance, renderCuratorReportMarkdown, reportTime, reportsSweepLockTarget, sessionLastEventTime, sweepReports, transactIo, unwrapLive, updateSuppressedNames, usageObserved, userSetKeys, verifyPromptBundle, withTreeWrite, writeProposalReport } from "@lmzhen/dsh-evolution-core";
3
+ import { AUTHORING_SPLIT_LINE_CHARS, 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_MIN_IDLE_HOURS, DEFAULT_REVIEW_TIMEOUT_MS, DEFAULT_SKILL_LIMITS, DEFAULT_SOFT_BODY_TOKENS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, HomeAuthority, INSTANCE_KEYS, MAX_TIMER_DELAY_MS, PROMPT_BUNDLE, SKILL_NAME_RE, UPSTREAM_LIMIT_CHARS_PER_TOKEN, authorityFrom, buildCuratorRunReport, claimInstance, clampOnce, clampedNumber, computeDedupGroups, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, contentHash, emptyRecord, eventsFile, evolutionHome, evolutionIoAdapter, foldCuratorFields, isPresent, isUnknown, liveBool, loadSuppressedNames, loadUsage, mutateUsage, paramRowId, parseCuratorNominations, pickWithPolicy, policyStageLimits, probeList, probeText, readEvolutionEvents, readNumberParam, releaseInstance, renderCuratorReportMarkdown, reportTime, reportsSweepLockTarget, sessionLastEventTime, sweepReports, transactIo, unwrapLive, updateSuppressedNames, usageObserved, userSetKeys, verifyPromptBundle, withTreeWrite, writeProposalReport } from "@lmzhen/dsh-evolution-core";
4
4
  import { randomUUID } from "node:crypto";
5
5
  import { dirname, join } from "node:path";
6
6
  import z from "@deepseek-ai/schemastery";
7
- import { DEFAULT_HEALTH_THRESHOLDS, blobPath, entryTarget, historyIndexFile, lintSkill, markerEntryName, newSkillLibrary, parseFrontmatter, parseHistoryIndex, relatedSkillNames } from "@lmzhen/dsh-evolution-core/skills";
7
+ import { DEFAULT_HEALTH_THRESHOLDS, blobPath, entryTarget, historyIndexFile, lintSkill, markerEntryName, newSkillLibrary, parseFrontmatter, parseHistoryIndex, relatedSkillNames, softBodyTokenBudget } from "@lmzhen/dsh-evolution-core/skills";
8
8
  import { EXTRACT_PROMPT_HASH } from "@lmzhen/dsh-evolution-core/extract";
9
9
  import { executeUnitUndo, planUnitUndoAcross, resolveUnitMembers, staleRouteStubs, unitMembersAreComplete } from "@lmzhen/dsh-evolution-core/write";
10
10
  //#region lib/types/unit-undo-plan.js
@@ -102,7 +102,8 @@ var EvolutionCurator = class extends Service {
102
102
  bootGraceSeconds: z.number().min(0).default(DEFAULT_CURATOR_BOOT_GRACE_SECONDS),
103
103
  curatorReviewMaxTokens: z.number().min(1).default(DEFAULT_CURATOR_REVIEW_MAX_TOKENS).volatile(),
104
104
  curatorReviewTimeoutMs: z.number().min(1).max(MAX_TIMER_DELAY_MS).default(DEFAULT_REVIEW_TIMEOUT_MS).volatile(),
105
- healthSoftBodyChars: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.softBodyChars).volatile(),
105
+ healthSoftBodyTokens: z.number().min(1).volatile(),
106
+ healthSoftBodyChars: z.number().min(1).volatile(),
106
107
  healthStampDensityPerKb: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.stampDensityPerKb).volatile(),
107
108
  healthChurnMinPatches: z.number().min(1).default(DEFAULT_HEALTH_THRESHOLDS.churnMinPatches).volatile()
108
109
  });
@@ -242,6 +243,19 @@ var EvolutionCurator = class extends Service {
242
243
  return clampOnce(this.clampedKeys, this.clampWarn, key, this.rowValue(key), fallback, min, max);
243
244
  }
244
245
  /**
246
+ * Resolve the health body line in tokens. The token field is primary; the old
247
+ * character field is converted only when no token value exists, so an existing
248
+ * deployment keeps its line without one more stored field.
249
+ * @returns the clamped token line.
250
+ */
251
+ rowSoftBodyTokens() {
252
+ const token = this.rowValue("healthSoftBodyTokens");
253
+ const chars = this.rowValue("healthSoftBodyChars");
254
+ const converted = chars !== void 0 && Number.isFinite(chars) && chars >= 1 ? Math.max(1, Math.round(chars / UPSTREAM_LIMIT_CHARS_PER_TOKEN)) : void 0;
255
+ const target = token ?? converted ?? DEFAULT_SOFT_BODY_TOKENS;
256
+ return clampOnce(this.clampedKeys, this.clampWarn, "healthSoftBodyTokens", target, DEFAULT_SOFT_BODY_TOKENS, 1);
257
+ }
258
+ /**
245
259
  * One DEPLOYMENT numeric row field, clamped and warned once.
246
260
  *
247
261
  * The sibling of {@link rowNumber} for a field with no user layer (no `.volatile()`): it reads
@@ -283,7 +297,8 @@ var EvolutionCurator = class extends Service {
283
297
  llmReview: this.rowBoolean("llmReview", false),
284
298
  curatorReviewMaxTokens: number("curatorReviewMaxTokens", DEFAULT_CURATOR_REVIEW_MAX_TOKENS, 1),
285
299
  curatorReviewTimeoutMs: number("curatorReviewTimeoutMs", DEFAULT_REVIEW_TIMEOUT_MS, 1, MAX_TIMER_DELAY_MS),
286
- healthSoftBodyChars: number("healthSoftBodyChars", DEFAULT_HEALTH_THRESHOLDS.softBodyChars, 1),
300
+ healthSoftBodyTokens: this.rowSoftBodyTokens(),
301
+ healthSoftBodyChars: number("healthSoftBodyChars", AUTHORING_SPLIT_LINE_CHARS, 1),
287
302
  healthStampDensityPerKb: number("healthStampDensityPerKb", DEFAULT_HEALTH_THRESHOLDS.stampDensityPerKb, 1),
288
303
  healthChurnMinPatches: number("healthChurnMinPatches", DEFAULT_HEALTH_THRESHOLDS.churnMinPatches, 1)
289
304
  };
@@ -323,7 +338,8 @@ var EvolutionCurator = class extends Service {
323
338
  llmReview: pick("llmReview"),
324
339
  curatorReviewMaxTokens: number("curatorReviewMaxTokens", 1),
325
340
  curatorReviewTimeoutMs: number("curatorReviewTimeoutMs", 1, MAX_TIMER_DELAY_MS),
326
- healthSoftBodyChars: number("healthSoftBodyChars", 1),
341
+ healthSoftBodyTokens: row.healthSoftBodyTokens,
342
+ healthSoftBodyChars: row.healthSoftBodyChars,
327
343
  healthStampDensityPerKb: number("healthStampDensityPerKb", 1),
328
344
  healthChurnMinPatches: number("healthChurnMinPatches", 1)
329
345
  };
@@ -1336,7 +1352,7 @@ var EvolutionCurator = class extends Service {
1336
1352
  async healthView() {
1337
1353
  const settings = this.settings();
1338
1354
  const thresholds = {
1339
- softBodyChars: settings.healthSoftBodyChars,
1355
+ softBodyTokens: settings.healthSoftBodyTokens,
1340
1356
  stampDensityPerKb: settings.healthStampDensityPerKb,
1341
1357
  churnMinPatches: settings.healthChurnMinPatches,
1342
1358
  hardCapMinHits: DEFAULT_HEALTH_THRESHOLDS.hardCapMinHits
@@ -1390,7 +1406,7 @@ var EvolutionCurator = class extends Service {
1390
1406
  churnReads: null,
1391
1407
  hardCapHits: null
1392
1408
  },
1393
- softLineChars: thresholds.softBodyChars,
1409
+ softLineTokens: softBodyTokenBudget(thresholds),
1394
1410
  overSoftLine: false,
1395
1411
  overTwiceSoftLine: false,
1396
1412
  stampLimitPerKb: thresholds.stampDensityPerKb,
@@ -69,7 +69,9 @@ export interface Config {
69
69
  curatorReviewMaxTokens?: Volatile<number>;
70
70
  /** Timeout (ms) for the optional LLM nomination pass (B-10, v18). */
71
71
  curatorReviewTimeoutMs?: Volatile<number>;
72
- /** Structure-health soft body limit (chars) — see DEFAULT_HEALTH_THRESHOLDS (rc.73 A1). */
72
+ /** Structure-health soft body limit (estimated tokens). */
73
+ healthSoftBodyTokens?: Volatile<number>;
74
+ /** Deprecated character line; converted once to `healthSoftBodyTokens`. */
73
75
  healthSoftBodyChars?: Volatile<number>;
74
76
  /** Structure-health stamp-density ceiling per KB — see DEFAULT_HEALTH_THRESHOLDS. */
75
77
  healthStampDensityPerKb?: Volatile<number>;
@@ -98,7 +100,9 @@ export interface CuratorSettings {
98
100
  curatorReviewMaxTokens: number;
99
101
  /** Wall-clock bound of the curator LLM review. */
100
102
  curatorReviewTimeoutMs: number;
101
- /** Body character line the health view judges against. */
103
+ /** Body token line the health view judges against. */
104
+ healthSoftBodyTokens: number;
105
+ /** Legacy character view of the same line; not used for judgment. */
102
106
  healthSoftBodyChars: number;
103
107
  /** Stamp density per KB that flags log-like content in a body. */
104
108
  healthStampDensityPerKb: number;
@@ -175,7 +179,8 @@ export declare class EvolutionCurator extends Service {
175
179
  bootGraceSeconds: z<number, number, "defined">;
176
180
  curatorReviewMaxTokens: z<number, number, "volatile-defined">;
177
181
  curatorReviewTimeoutMs: z<number, number, "volatile-defined">;
178
- healthSoftBodyChars: z<number, number, "volatile-defined">;
182
+ healthSoftBodyTokens: z<number, number, "volatile">;
183
+ healthSoftBodyChars: z<number, number, "volatile">;
179
184
  healthStampDensityPerKb: z<number, number, "volatile-defined">;
180
185
  healthChurnMinPatches: z<number, number, "volatile-defined">;
181
186
  }>>, Schemastery.ObjectT<NoInfer<{
@@ -197,7 +202,8 @@ export declare class EvolutionCurator extends Service {
197
202
  bootGraceSeconds: z<number, number, "defined">;
198
203
  curatorReviewMaxTokens: z<number, number, "volatile-defined">;
199
204
  curatorReviewTimeoutMs: z<number, number, "volatile-defined">;
200
- healthSoftBodyChars: z<number, number, "volatile-defined">;
205
+ healthSoftBodyTokens: z<number, number, "volatile">;
206
+ healthSoftBodyChars: z<number, number, "volatile">;
201
207
  healthStampDensityPerKb: z<number, number, "volatile-defined">;
202
208
  healthChurnMinPatches: z<number, number, "volatile-defined">;
203
209
  }>>, "plain">;
@@ -266,6 +272,13 @@ export declare class EvolutionCurator extends Service {
266
272
  * @returns the value the engine may use.
267
273
  */
268
274
  private rowNumber;
275
+ /**
276
+ * Resolve the health body line in tokens. The token field is primary; the old
277
+ * character field is converted only when no token value exists, so an existing
278
+ * deployment keeps its line without one more stored field.
279
+ * @returns the clamped token line.
280
+ */
281
+ private rowSoftBodyTokens;
269
282
  /**
270
283
  * One DEPLOYMENT numeric row field, clamped and warned once.
271
284
  *
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.54.0",
4
+ "version": "0.55.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -29,19 +29,19 @@
29
29
  "license": "MIT",
30
30
  "dependencies": {
31
31
  "@deepseek-ai/schemastery": "^3.18.5",
32
- "@lmzhen/dsh-evolution-core": "0.54.0"
32
+ "@lmzhen/dsh-evolution-core": "0.55.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@deepseek-ai/cordis": "^4.0.5",
36
36
  "@deepseek-ai/dsh-llm": "^0.2.2-rc.3",
37
37
  "@deepseek-ai/dsh-session": "^0.2.2-rc.3",
38
- "@lmzhen/dsh-evolution-state": "^0.54.0"
38
+ "@lmzhen/dsh-evolution-state": "^0.55.0"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@deepseek-ai/dsh-llm": "^0.2.2-rc.3",
42
42
  "@deepseek-ai/dsh-session": "^0.2.2-rc.3",
43
- "@lmzhen/dsh-evolution-core": "^0.54.0",
44
- "@lmzhen/dsh-evolution-state": "^0.54.0"
43
+ "@lmzhen/dsh-evolution-core": "^0.55.0",
44
+ "@lmzhen/dsh-evolution-state": "^0.55.0"
45
45
  },
46
46
  "engines": {
47
47
  "dsh": ">=0.2.2-rc.3 <0.2.3-0"