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

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 +25 -6
  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, 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, computeQualityScores, computeScopeView, emptyRecord, evolutionHome, evolutionIoAdapter, loadSuppressedNames, loadUsage, mutateUsage, parseCuratorNominations, relatedSkillNames, renderCuratorReportMarkdown, saveUsage, 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.
@@ -503,7 +503,10 @@ var EvolutionCurator = class extends Service {
503
503
  if (!archived.ok) {
504
504
  const record = usage.get(name);
505
505
  const from = failedFrom?.get(name);
506
- if (record && (from === "stale" || from === "active")) record.state = from;
506
+ if (record && (from === "stale" || from === "active")) {
507
+ record.state = from;
508
+ record.archived_at = null;
509
+ }
507
510
  errors.push(`${name}: ${archived.message}`);
508
511
  } else {
509
512
  const record = usage.get(name);
@@ -563,7 +566,9 @@ var EvolutionCurator = class extends Service {
563
566
  this.ctx.logger.warn("evolution-curator: failed to persist suppressed names; archived built-ins may re-enter the lifecycle");
564
567
  }
565
568
  try {
566
- await saveUsage(root, usage, this.io);
569
+ await mutateUsage(root, this.io, (disk) => {
570
+ for (const [name, record] of usage) disk.set(name, record);
571
+ });
567
572
  } catch {
568
573
  this.ctx.logger.warn("evolution-curator: failed to persist usage sidecar");
569
574
  }
@@ -627,9 +632,23 @@ var EvolutionCurator = class extends Service {
627
632
  }
628
633
  async latestReport() {
629
634
  const reportsRoot = join(evolutionHome(), "reports");
630
- const latest = (await this.io.list(reportsRoot)).filter((name) => name.startsWith("curator-") && name.endsWith(".json")).sort().reverse()[0];
631
- if (!latest) return null;
632
- const raw = await this.io.readText(join(reportsRoot, latest));
635
+ const names = (await this.io.list(reportsRoot)).filter((name) => name.startsWith("curator-") && name.endsWith(".json")).sort();
636
+ let latest = null;
637
+ for (const name of names) {
638
+ const raw = await this.io.readText(join(reportsRoot, name));
639
+ if (raw === null) continue;
640
+ try {
641
+ const parsed = JSON.parse(raw);
642
+ const startedAt = typeof parsed.startedAt === "string" ? Date.parse(parsed.startedAt) : 0;
643
+ if (!Number.isFinite(startedAt)) continue;
644
+ if (latest === null || startedAt > latest.startedAt) latest = {
645
+ name,
646
+ startedAt
647
+ };
648
+ } catch {}
649
+ }
650
+ if (latest === null) return null;
651
+ const raw = await this.io.readText(join(reportsRoot, latest.name));
633
652
  if (raw === null) return null;
634
653
  try {
635
654
  return JSON.parse(raw);
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.63",
4
+ "version": "0.1.0-rc.65",
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.63"
36
+ "@lmzhen/dsh-evolution-core": "^0.1.0-rc.65"
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.63",
43
- "@lmzhen/dsh-evolution-state": "^0.1.0-rc.63"
42
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.65",
43
+ "@lmzhen/dsh-evolution-state": "^0.1.0-rc.65"
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.63",
49
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.63",
50
- "@lmzhen/dsh-evolution-state": "^0.1.0-rc.63"
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"
51
51
  }
52
52
  }