@lmzhen/dsh-evolution-learning-graph 0.3.23 → 0.3.25

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 CHANGED
@@ -28,6 +28,24 @@ function graphDensity(graph) {
28
28
  };
29
29
  }
30
30
  /**
31
+ * Render one node's display line for `/evolution graph`.
32
+ *
33
+ * A skill node's id IS its name, so `● <name>` already addresses it — an
34
+ * isolated skill (no edge) is addressable by name alone. A memory node's id
35
+ * is the `memory:<source>:<index>:<snapshot>` string `buildLearningGraph`
36
+ * emits, so the id is appended in brackets: an isolated memory node (no edge
37
+ * carrying its id) is otherwise unaddressable from the render. The full id is
38
+ * shown (not the bare `memory:<source>:<index>` prefix) so it matches the id
39
+ * form the edge lines render and so the trailing snapshot — the E-21 token the
40
+ * mutation commands use to reject a stale index — survives the copy/paste
41
+ * (F-322). A bare prefix would round-trip through `parseGraphNodeId` but would
42
+ * silently skip the E-21 drift guard in `readMemoryIndex`.
43
+ */
44
+ function renderNodeLine(node) {
45
+ if (node.kind === "skill") return "● " + node.label;
46
+ return "◆ " + node.label + " [id: " + node.id + "]";
47
+ }
48
+ /**
31
49
  * Build a small deterministic graph from usage records and memory entries.
32
50
  * Memory node ids follow `memory:<source>:<index>` (source = memory|user,
33
51
  * index = position in that file's entries) — the SAME rule the parser
@@ -224,7 +242,7 @@ function apply(ctx) {
224
242
  related.set(name, relatedSkillNames(content, name));
225
243
  }
226
244
  const graph = buildLearningGraph(usageMap, memoryEntries, userEntries, related);
227
- const lines = graph.nodes.map((node) => (node.kind === "memory" ? "◆" : "●") + " " + node.label);
245
+ const lines = graph.nodes.map((node) => renderNodeLine(node));
228
246
  const edges = graph.edges.map((edge) => edge.from + " --" + edge.type + "--> " + edge.to);
229
247
  const density = graphDensity(graph);
230
248
  const densityLine = `\n\nSkills: ${density.skillNodes} · related edges: ${density.relatedEdges} (${density.edgesPerNode}/node) · isolated: ${density.isolatedPct}%`;
@@ -319,4 +337,4 @@ function apply(ctx) {
319
337
  });
320
338
  }
321
339
  //#endregion
322
- export { apply, buildLearningGraph, graphDensity, memorySnapshotOf, name, parseGraphNodeId, readMemoryIndex, resolveGraphNode };
340
+ export { apply, buildLearningGraph, graphDensity, memorySnapshotOf, name, parseGraphNodeId, readMemoryIndex, renderNodeLine, resolveGraphNode };
@@ -35,6 +35,21 @@ export interface GraphDensity {
35
35
  isolatedPct: number;
36
36
  }
37
37
  export declare function graphDensity(graph: LearningGraph): GraphDensity;
38
+ /**
39
+ * Render one node's display line for `/evolution graph`.
40
+ *
41
+ * A skill node's id IS its name, so `● <name>` already addresses it — an
42
+ * isolated skill (no edge) is addressable by name alone. A memory node's id
43
+ * is the `memory:<source>:<index>:<snapshot>` string `buildLearningGraph`
44
+ * emits, so the id is appended in brackets: an isolated memory node (no edge
45
+ * carrying its id) is otherwise unaddressable from the render. The full id is
46
+ * shown (not the bare `memory:<source>:<index>` prefix) so it matches the id
47
+ * form the edge lines render and so the trailing snapshot — the E-21 token the
48
+ * mutation commands use to reject a stale index — survives the copy/paste
49
+ * (F-322). A bare prefix would round-trip through `parseGraphNodeId` but would
50
+ * silently skip the E-21 drift guard in `readMemoryIndex`.
51
+ */
52
+ export declare function renderNodeLine(node: GraphNode): string;
38
53
  /**
39
54
  * Build a small deterministic graph from usage records and memory entries.
40
55
  * Memory node ids follow `memory:<source>:<index>` (source = memory|user,
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.23",
4
+ "version": "0.3.25",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -30,8 +30,8 @@
30
30
  ],
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "@lmzhen/dsh-evolution-approval": "^0.3.23",
34
- "@lmzhen/dsh-evolution-core": "^0.3.23"
33
+ "@lmzhen/dsh-evolution-approval": "^0.3.25",
34
+ "@lmzhen/dsh-evolution-core": "^0.3.25"
35
35
  },
36
36
  "peerDependencies": {
37
37
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",