@lmzhen/dsh-evolution-learning-graph 0.3.58 → 0.3.60

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/README.md CHANGED
@@ -10,7 +10,7 @@ Memory node ids carry a trailing snapshot token (`memory:<source>:<index>:<snaps
10
10
 
11
11
  Memory→skill edges are word-level, not substring: the entry is tokenized on non-letter/digit/hyphen runs and a skill name links only when it is a whole token. This prevents a skill named `run` from linking the words `running`/`grunt`.
12
12
 
13
- `graph edit`/`graph delete` of a skill node route through the evolution approval seam when it is mounted (soft-probed; the write executes directly when it is absent). Each approved/executed edit bumps the skill's patch counter and a delete archives it, matching `skill_manage` — including the no-op gate: an edit whose content is byte-equivalent to the current file (`noop`) writes nothing and does not bump the patch counter, exactly as `skill_manage` treats an unchanged update/patch.
13
+ `graph edit`/`graph delete` of a skill node route through the evolution approval seam when it is mounted (soft-probed; the write executes directly when it is absent). Each approved/executed edit bumps the skill's patch counter and a delete archives it, matching `skill_manage` — including the no-op gate: an edit whose content is byte-equivalent to the current file (`noop`) writes nothing and does not bump the patch counter, exactly as `skill_manage` treats an unchanged update/patch. The command invocation's session rides the approval request (v12 N1), so a `never`-policy session stages nothing instead of deriving every graph write as foreground.
14
14
 
15
15
  ## Model Experience
16
16
 
package/lib/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { effectiveSessionPolicy } from "@lmzhen/dsh-evolution-approval";
1
2
  import z from "@deepseek-ai/schemastery";
2
3
  import { SKILL_NAME_RE, SkillLibrary, evolutionIoAdapter, relatedSkillNames, resolveOrigins, resolveSkillsRoot } from "@lmzhen/dsh-evolution-core";
3
4
  //#region lib/types/index.js
@@ -238,6 +239,7 @@ function apply(ctx, rawConfig = {}) {
238
239
  const usage = usageService;
239
240
  const memory = memoryService;
240
241
  const io = ioService;
242
+ const session = invocation.agent?.session;
241
243
  const input = (invocation.rawInput ?? "").trim();
242
244
  const detail = /^detail\s+(\S+)$/.exec(input);
243
245
  if (detail && detail[1]) return await nodeDetail(detail[1]);
@@ -286,7 +288,8 @@ function apply(ctx, rawConfig = {}) {
286
288
  if (parsed.kind === "skill") {
287
289
  const approval = ctx.get("evolutionApproval");
288
290
  if (approval) {
289
- const origins = resolveOrigins(void 0);
291
+ const origins = resolveOrigins(session?.header?.origin);
292
+ const sessionPolicy = effectiveSessionPolicy(ctx, session);
290
293
  const decision = await approval.request({
291
294
  kind: "skill",
292
295
  summary: `graph edit ${parsed.name}`,
@@ -299,7 +302,10 @@ function apply(ctx, rawConfig = {}) {
299
302
  origin: origins.approval,
300
303
  libraryOrigin: origins.library
301
304
  },
302
- origin: origins.approval
305
+ origin: origins.approval,
306
+ ...session?.id ? { sessionId: session.id } : {},
307
+ ...session ? { session } : {},
308
+ ...sessionPolicy !== void 0 ? { sessionPolicy } : {}
303
309
  });
304
310
  if (decision.action === "staged") return ok(decision.message);
305
311
  }
@@ -322,7 +328,8 @@ function apply(ctx, rawConfig = {}) {
322
328
  if (parsed.kind === "skill") {
323
329
  const approval = ctx.get("evolutionApproval");
324
330
  if (approval) {
325
- const origins = resolveOrigins(void 0);
331
+ const origins = resolveOrigins(session?.header?.origin);
332
+ const sessionPolicy = effectiveSessionPolicy(ctx, session);
326
333
  const decision = await approval.request({
327
334
  kind: "skill",
328
335
  summary: `graph delete ${parsed.name}`,
@@ -334,7 +341,10 @@ function apply(ctx, rawConfig = {}) {
334
341
  origin: origins.approval,
335
342
  libraryOrigin: origins.library
336
343
  },
337
- origin: origins.approval
344
+ origin: origins.approval,
345
+ ...session?.id ? { sessionId: session.id } : {},
346
+ ...session ? { session } : {},
347
+ ...sessionPolicy !== void 0 ? { sessionPolicy } : {}
338
348
  });
339
349
  if (decision.action === "staged") return ok(decision.message);
340
350
  }
@@ -37,6 +37,24 @@ export interface GraphDensity {
37
37
  edgesPerNode: number;
38
38
  isolatedPct: number;
39
39
  }
40
+ /**
41
+ * The command invocation contract (N1, v12): the platform command handler
42
+ * freezes the invoking agent onto the invocation object — evolution-commands
43
+ * `/evolution learn` already reads `invocation.agent` — so the graph can pass
44
+ * `agent.session` to the approval service (tool-skill-manage pattern) instead
45
+ * of deriving every approval as foreground.
46
+ */
47
+ export interface GraphInvocation {
48
+ rawInput?: string;
49
+ agent?: {
50
+ session?: {
51
+ id?: string;
52
+ header?: {
53
+ origin?: string;
54
+ };
55
+ };
56
+ };
57
+ }
40
58
  export declare function graphDensity(graph: LearningGraph): GraphDensity;
41
59
  /**
42
60
  * Render one node's display line for `/evolution graph`.
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.58",
4
+ "version": "0.3.60",
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.58",
35
- "@lmzhen/dsh-evolution-core": "^0.3.58"
34
+ "@lmzhen/dsh-evolution-approval": "^0.3.60",
35
+ "@lmzhen/dsh-evolution-core": "^0.3.60"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",