@lmzhen/dsh-evolution-learning-graph 0.3.68 → 0.3.69
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 +23 -7
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -223,12 +223,12 @@ function apply(ctx, rawConfig = {}) {
|
|
|
223
223
|
const graphSkillsRoot = resolveSkillsRoot(rawConfig);
|
|
224
224
|
ctx.inject(["commands"], (commandCtx) => {
|
|
225
225
|
const commands = commandCtx.commands;
|
|
226
|
-
|
|
226
|
+
const graphCommand = {
|
|
227
227
|
name: "graph",
|
|
228
228
|
description: "Show the learning graph, or act on a node: graph [detail|edit|delete] <nodeId>",
|
|
229
229
|
recordInput: false,
|
|
230
230
|
input: { hint: "[detail|edit|delete] <nodeId> [text]" },
|
|
231
|
-
|
|
231
|
+
run: async (invocation) => {
|
|
232
232
|
const ok = (text) => ({
|
|
233
233
|
kind: "success",
|
|
234
234
|
text
|
|
@@ -249,14 +249,25 @@ function apply(ctx, rawConfig = {}) {
|
|
|
249
249
|
const detail = /^detail\s+(\S+)$/.exec(input);
|
|
250
250
|
if (detail && detail[1]) return await nodeDetail(detail[1]);
|
|
251
251
|
const edit = /^edit\s+(\S+)\s+([\s\S]+)$/.exec(input);
|
|
252
|
-
if (edit && edit[1] && edit[2] !== void 0)
|
|
252
|
+
if (edit && edit[1] && edit[2] !== void 0) {
|
|
253
|
+
if (!edit[1].startsWith("memory:")) {
|
|
254
|
+
if (await withSkills().read(edit[1]).catch(() => null) === null) return err(`Skill "${edit[1]}" not found in the live skill library — nothing to edit. (The graph may be showing a stale node.)`);
|
|
255
|
+
}
|
|
256
|
+
return await nodeEdit(edit[1], edit[2]);
|
|
257
|
+
}
|
|
253
258
|
const remove = /^delete\s+(\S+)$/.exec(input);
|
|
254
|
-
if (remove && remove[1])
|
|
259
|
+
if (remove && remove[1]) {
|
|
260
|
+
if (!remove[1].startsWith("memory:")) {
|
|
261
|
+
if (await withSkills().read(remove[1]).catch(() => null) === null) return err(`Skill "${remove[1]}" not found in the live skill library — nothing to delete.`);
|
|
262
|
+
}
|
|
263
|
+
return await nodeDelete(remove[1]);
|
|
264
|
+
}
|
|
255
265
|
const directory = await renderGraph();
|
|
256
266
|
if (input !== "") return err(`Unknown graph subcommand "${input.split(" ")[0]}". ${directory}`);
|
|
257
267
|
return ok(directory);
|
|
258
268
|
async function renderGraph() {
|
|
259
|
-
const
|
|
269
|
+
const usageReport = await usage.report();
|
|
270
|
+
const usageMap = new Map([...usageReport].filter(([, record]) => record.state !== "archived"));
|
|
260
271
|
const memoryEntries = await memory.read("memory");
|
|
261
272
|
const userEntries = await memory.read("user");
|
|
262
273
|
const skills = withSkills();
|
|
@@ -432,8 +443,13 @@ function apply(ctx, rawConfig = {}) {
|
|
|
432
443
|
}]);
|
|
433
444
|
return result.ok ? ok(result.message) : err(result.message);
|
|
434
445
|
}
|
|
435
|
-
}
|
|
436
|
-
|
|
446
|
+
},
|
|
447
|
+
handler: (invocation) => graphCommand.run(invocation).catch((error) => ({
|
|
448
|
+
kind: "error",
|
|
449
|
+
text: `graph: command failed: ${error instanceof Error ? error.message : String(error)}\nCheck the node id and the skills/memory files under the evolution root, then retry.`
|
|
450
|
+
}))
|
|
451
|
+
};
|
|
452
|
+
commandCtx.effect(() => commands.register(graphCommand), "evolution-learning-graph.command");
|
|
437
453
|
});
|
|
438
454
|
}
|
|
439
455
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-learning-graph",
|
|
3
3
|
"description": "Learning graph over skills and memory (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.69",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
34
|
-
"@lmzhen/dsh-evolution-approval": "^0.3.
|
|
35
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
34
|
+
"@lmzhen/dsh-evolution-approval": "^0.3.69",
|
|
35
|
+
"@lmzhen/dsh-evolution-core": "^0.3.69"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@deepseek-ai/dsh-commands": "^0.1.1-rc.2",
|