@lmzhen/dsh-evolution-commands 0.9.0 → 0.11.1
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 +37 -1
- 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, partitionVersions, 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,34 @@ 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 groups = partitionVersions(versions);
|
|
1040
|
+
const row = (entry) => `v${entry.v}\t${entry.at}\t${entry.action}\t${entry.chars} chars\t${entry.hash.slice(0, 12)}`;
|
|
1041
|
+
const lines = [`Content versions for "${name}" (oldest first, ${groups.content.length} of at most the retained count):`, ...groups.content.map(row)];
|
|
1042
|
+
if (groups.support.length > 0) lines.push("Support-file versions (history only — undo restores SKILL.md, not these bytes):", ...groups.support.map(row));
|
|
1043
|
+
return ok(lines.join("\n"));
|
|
1044
|
+
}
|
|
1045
|
+
if (input.startsWith("skill undo ")) {
|
|
1046
|
+
const rest = input.slice(11).trim();
|
|
1047
|
+
const toMatch = /--to\s+v?(\d+)\s*$/.exec(rest);
|
|
1048
|
+
const name = (toMatch?.index === void 0 ? rest : rest.slice(0, toMatch.index)).trim();
|
|
1049
|
+
if (!name) return err("Usage: /evolution skill undo <name> [--to v<N>]");
|
|
1050
|
+
const skillUndoRefusal = unreplayableWriteRefusal("skill undo");
|
|
1051
|
+
if (skillUndoRefusal) return skillUndoRefusal;
|
|
1052
|
+
const curator = ctx.get("evolutionCurator");
|
|
1053
|
+
const target = toMatch?.[1] === void 0 ? void 0 : Number(toMatch[1]);
|
|
1054
|
+
const result = curator ? await (target === void 0 ? curator.undo(name) : curator.undo(name, target)) : {
|
|
1055
|
+
ok: false,
|
|
1056
|
+
message: errorText("e-302-curator-service-not-mounted")
|
|
1057
|
+
};
|
|
1058
|
+
return result.ok ? ok(result.message) : err(result.message);
|
|
1059
|
+
}
|
|
1024
1060
|
if (input === "skills health") {
|
|
1025
1061
|
const curator = ctx.get("evolutionCurator");
|
|
1026
1062
|
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.
|
|
4
|
+
"version": "0.11.1",
|
|
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.
|
|
31
|
-
"@lmzhen/dsh-evolution-core": "^0.
|
|
32
|
-
"@lmzhen/dsh-evolution-maintenance": "^0.
|
|
30
|
+
"@lmzhen/dsh-evolution-approval": "^0.11.1",
|
|
31
|
+
"@lmzhen/dsh-evolution-core": "^0.11.1",
|
|
32
|
+
"@lmzhen/dsh-evolution-maintenance": "^0.11.1"
|
|
33
33
|
},
|
|
34
34
|
"optionalDependencies": {
|
|
35
|
-
"@lmzhen/dsh-evolution-agent-preset": "^0.
|
|
35
|
+
"@lmzhen/dsh-evolution-agent-preset": "^0.11.1"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@deepseek-ai/cordis": "^4.0.1",
|