@lmzhen/dsh-evolution-curator 0.1.0-rc.65 → 0.1.0-rc.67

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.
Files changed (2) hide show
  1. package/lib/index.js +22 -14
  2. 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_MIN_IDLE_HOURS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, SkillLibrary, buildCuratorRunReport, computeDedupGroups, computeLifecycleTransitions, computeQualityScores, computeScopeView, emptyRecord, evolutionHome, evolutionIoAdapter, loadSuppressedNames, loadUsage, mutateUsage, parseCuratorNominations, relatedSkillNames, renderCuratorReportMarkdown, saveUsage, updateSuppressedNames } from "@lmzhen/dsh-evolution-core";
6
+ import { CURATOR_DRY_RUN_BANNER, CURATOR_PROMPT, DEFAULT_ARCHIVE_AFTER_DAYS, DEFAULT_CURATOR_INTERVAL_HOURS, DEFAULT_MIN_IDLE_HOURS, DEFAULT_STALE_AFTER_DAYS, EvolutionGateSet, SkillLibrary, buildCuratorRunReport, computeDedupGroups, computeLifecycleTransitions, computePrefixClusters, computeQualityScores, computeScopeView, emptyRecord, evolutionHome, evolutionIoAdapter, foldCuratorFields, loadSuppressedNames, loadUsage, mutateUsage, parseCuratorNominations, relatedSkillNames, renderCuratorReportMarkdown, updateSuppressedNames } 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.
@@ -165,6 +165,8 @@ var EvolutionCurator = class extends Service {
165
165
  const llm = this.ctx.get("llm");
166
166
  if (!llm) return empty;
167
167
  const model = this.ctx.get("evolutionPolicy")?.get().curatorModel ?? "deepseek-v4-pro";
168
+ const clusters = computePrefixClusters(candidates);
169
+ const clusterLines = clusters.length === 0 ? ["Prefix clusters observed in the candidate list: (none)"] : ["Prefix clusters observed in the candidate list (orientation only — verify against the names above; you may also flag additional clusters):", ...clusters.map((cluster) => `- '${cluster.key}': ${cluster.members.join(", ")}`)];
168
170
  const prompt = [
169
171
  options.dryRun ? CURATOR_DRY_RUN_BANNER : "",
170
172
  CURATOR_PROMPT,
@@ -172,6 +174,8 @@ var EvolutionCurator = class extends Service {
172
174
  `Stale candidates observed by the deterministic lifecycle scanner:${candidates.length === 0 ? " (none)" : ""}`,
173
175
  ...candidates.map((name) => `- ${name}`),
174
176
  "",
177
+ ...clusterLines,
178
+ "",
175
179
  "Return a YAML summary with consolidations and prunings lists. Nominate only actions whose archival/merge is clearly safe."
176
180
  ].join("\n");
177
181
  try {
@@ -567,7 +571,7 @@ var EvolutionCurator = class extends Service {
567
571
  }
568
572
  try {
569
573
  await mutateUsage(root, this.io, (disk) => {
570
- for (const [name, record] of usage) disk.set(name, record);
574
+ foldCuratorFields(disk, usage);
571
575
  });
572
576
  } catch {
573
577
  this.ctx.logger.warn("evolution-curator: failed to persist usage sidecar");
@@ -708,13 +712,15 @@ var EvolutionCurator = class extends Service {
708
712
  await this.snapshotFull("pre-consolidate");
709
713
  const result = await this.skills.consolidate(target, sources);
710
714
  if (!result.ok) return result;
711
- const usage = await loadUsage(this.skills.root, this.io);
712
- for (const source of sources) {
713
- const record = usage.get(source);
714
- if (record) record.state = "archived";
715
- if (record) record.archived_at = (/* @__PURE__ */ new Date()).toISOString();
716
- }
717
- await saveUsage(this.skills.root, usage, this.io);
715
+ await mutateUsage(this.skills.root, this.io, (disk) => {
716
+ for (const source of sources) {
717
+ const record = disk.get(source);
718
+ if (record) {
719
+ record.state = "archived";
720
+ record.archived_at = (/* @__PURE__ */ new Date()).toISOString();
721
+ }
722
+ }
723
+ });
718
724
  return result;
719
725
  }
720
726
  /**
@@ -725,11 +731,13 @@ var EvolutionCurator = class extends Service {
725
731
  await this.snapshotFull("pre-restore");
726
732
  const result = await this.skills.restoreFromArchive(name);
727
733
  if (!result.ok) return result;
728
- const usage = await loadUsage(this.skills.root, this.io);
729
- const record = usage.get(name);
730
- if (record) record.state = "active";
731
- if (record) record.archived_at = null;
732
- await saveUsage(this.skills.root, usage, this.io);
734
+ await mutateUsage(this.skills.root, this.io, (disk) => {
735
+ const record = disk.get(name);
736
+ if (record) {
737
+ record.state = "active";
738
+ record.archived_at = null;
739
+ }
740
+ });
733
741
  if (new Set(await loadSuppressedNames(this.skills.root, this.io)).has(name)) try {
734
742
  await updateSuppressedNames(this.skills.root, this.io, (current) => {
735
743
  current.delete(name);
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.1.0-rc.65",
4
+ "version": "0.1.0-rc.67",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -33,20 +33,20 @@
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
35
  "@deepseek-ai/schemastery": "^3.18.1",
36
- "@lmzhen/dsh-evolution-core": "^0.1.0-rc.65"
36
+ "@lmzhen/dsh-evolution-core": "^0.1.0-rc.67"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@deepseek-ai/cordis": "^4.0.1",
40
40
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
41
41
  "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
42
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.65",
43
- "@lmzhen/dsh-evolution-state": "^0.1.0-rc.65"
42
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.67",
43
+ "@lmzhen/dsh-evolution-state": "^0.1.0-rc.67"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",
47
47
  "@deepseek-ai/dsh-llm": "^0.1.1-rc.2",
48
- "@lmzhen/dsh-evolution-core": "^0.1.0-rc.65",
49
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.65",
50
- "@lmzhen/dsh-evolution-state": "^0.1.0-rc.65"
48
+ "@lmzhen/dsh-evolution-core": "^0.1.0-rc.67",
49
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.67",
50
+ "@lmzhen/dsh-evolution-state": "^0.1.0-rc.67"
51
51
  }
52
52
  }