@lmzhen/dsh-evolution-commands 0.9.0 → 0.10.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.
Files changed (2) hide show
  1. package/lib/index.js +35 -1
  2. package/package.json +5 -5
package/lib/index.js CHANGED
@@ -2,7 +2,7 @@ import { createRequire } from "node:module";
2
2
  import z from "@deepseek-ai/schemastery";
3
3
  import { effectiveSessionPolicy } from "@lmzhen/dsh-evolution-approval";
4
4
  import { createUserMessage } from "@deepseek-ai/dsh-llm";
5
- import { DEFAULT_SKILL_LIMITS, MAX_TIMER_DELAY_MS, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, appendEvolutionEvent, assertSkillsRootAliasRetired, buildLearnPrompt, canonicalWriteId, clampedNumber, composePresetComposition, errorText, eventsFile, evolutionRoot, isDeprecatedParamId, isMissingPath, newSkillLibrary, policyStageLimits, resolveParamId, resolveRootConfig, scopedProbeReport } from "@lmzhen/dsh-evolution-core";
5
+ import { DEFAULT_SKILL_LIMITS, MAX_TIMER_DELAY_MS, PARAM_EXPOSURE, PARAM_GROUP_LABELS, PARAM_NAMESPACES, appendEvolutionEvent, assertSkillsRootAliasRetired, buildLearnPrompt, canonicalWriteId, clampedNumber, composePresetComposition, errorText, eventsFile, evolutionRoot, isDeprecatedParamId, isMissingPath, newSkillLibrary, orderVersions, policyStageLimits, resolveParamId, resolveRootConfig, scopedProbeReport } from "@lmzhen/dsh-evolution-core";
6
6
  import { buildEnrichment, buildMaintainFacts, runMaintain, snapshotFromLibrary } from "@lmzhen/dsh-evolution-maintenance";
7
7
  import { copyFileSync, existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
8
8
  import { dirname, join } from "node:path";
@@ -779,6 +779,14 @@ const COMMAND_ENTRIES = [
779
779
  usage: "skill restore <name>",
780
780
  summary: "按名字恢复一个已归档的技能"
781
781
  },
782
+ {
783
+ usage: "skill history <name>",
784
+ summary: "列出某个技能的内容版本(含时间、动作、字符数、哈希前缀)"
785
+ },
786
+ {
787
+ usage: "skill undo <name> [--to v<N>]",
788
+ summary: "把某个技能的内容回退到某一版(默认上一版;只动内容,撤销本身也记为一版)"
789
+ },
782
790
  {
783
791
  usage: "skills health",
784
792
  summary: "技能库结构体检"
@@ -1021,6 +1029,32 @@ function apply(ctx, rawConfig = {}) {
1021
1029
  };
1022
1030
  return result.ok ? ok(result.message) : err(result.message);
1023
1031
  }
1032
+ if (input.startsWith("skill history ")) {
1033
+ const name = input.slice(14).trim();
1034
+ if (!name) return err("Usage: /evolution skill history <name>");
1035
+ const curator = ctx.get("evolutionCurator");
1036
+ if (!curator) return err(errorText("e-302-curator-service-not-mounted"));
1037
+ const versions = await curator.history(name);
1038
+ if (versions.length === 0) return ok(`No content versions are recorded for "${name}" yet — they appear after the next write through skill_manage.`);
1039
+ const ordered = orderVersions(versions);
1040
+ const rows = ordered.map((entry) => `v${entry.v}\t${entry.at}\t${entry.action}\t${entry.chars} chars\t${entry.hash.slice(0, 12)}`);
1041
+ return ok([`Content versions for "${name}" (oldest first, ${ordered.length} of at most the retained count):`, ...rows].join("\n"));
1042
+ }
1043
+ if (input.startsWith("skill undo ")) {
1044
+ const rest = input.slice(11).trim();
1045
+ const toMatch = /--to\s+v?(\d+)\s*$/.exec(rest);
1046
+ const name = (toMatch?.index === void 0 ? rest : rest.slice(0, toMatch.index)).trim();
1047
+ if (!name) return err("Usage: /evolution skill undo <name> [--to v<N>]");
1048
+ const skillUndoRefusal = unreplayableWriteRefusal("skill undo");
1049
+ if (skillUndoRefusal) return skillUndoRefusal;
1050
+ const curator = ctx.get("evolutionCurator");
1051
+ const target = toMatch?.[1] === void 0 ? void 0 : Number(toMatch[1]);
1052
+ const result = curator ? await (target === void 0 ? curator.undo(name) : curator.undo(name, target)) : {
1053
+ ok: false,
1054
+ message: errorText("e-302-curator-service-not-mounted")
1055
+ };
1056
+ return result.ok ? ok(result.message) : err(result.message);
1057
+ }
1024
1058
  if (input === "skills health") {
1025
1059
  const curator = ctx.get("evolutionCurator");
1026
1060
  if (!curator) return err(errorText("e-302-curator-service-not-mounted"));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-commands",
3
3
  "description": "Human commands for the evolution family (/evolution pending|curator|maintain|doctor) (community build)",
4
- "version": "0.9.0",
4
+ "version": "0.10.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,12 +27,12 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.1",
30
- "@lmzhen/dsh-evolution-approval": "^0.9.0",
31
- "@lmzhen/dsh-evolution-core": "^0.9.0",
32
- "@lmzhen/dsh-evolution-maintenance": "^0.9.0"
30
+ "@lmzhen/dsh-evolution-approval": "^0.10.0",
31
+ "@lmzhen/dsh-evolution-core": "^0.10.0",
32
+ "@lmzhen/dsh-evolution-maintenance": "^0.10.0"
33
33
  },
34
34
  "optionalDependencies": {
35
- "@lmzhen/dsh-evolution-agent-preset": "^0.9.0"
35
+ "@lmzhen/dsh-evolution-agent-preset": "^0.10.0"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@deepseek-ai/cordis": "^4.0.1",