@lmzhen/dsh-evolution-learning-graph 0.3.64 → 0.3.66

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
@@ -1,6 +1,6 @@
1
1
  import { effectiveSessionPolicy } from "@lmzhen/dsh-evolution-approval";
2
2
  import z from "@deepseek-ai/schemastery";
3
- import { SKILL_NAME_RE, SkillLibrary, evolutionIoAdapter, relatedSkillNames, resolveOrigins, resolveSkillsRoot } from "@lmzhen/dsh-evolution-core";
3
+ import { SKILL_NAME_RE, SkillLibrary, contentHash, evolutionIoAdapter, relatedSkillNames, resolveOrigins, resolveSkillsRoot } from "@lmzhen/dsh-evolution-core";
4
4
  //#region lib/types/index.js
5
5
  /**
6
6
  * Learning graph over skills and memory, plus node-level commands
@@ -199,7 +199,10 @@ async function resolveGraphNode(parsed, repository) {
199
199
  * manage registers for `kind: 'skill'` replays them on approve.
200
200
  */
201
201
  const name = "evolution-learning-graph";
202
- const Config = z.object({ root: z.string().default("") });
202
+ const Config = z.object({
203
+ root: z.string().default(""),
204
+ threatExemptLabels: z.array(z.string()).default([])
205
+ });
203
206
  /**
204
207
  * F-10: rendered-line cap for the `/graph` directory — nodes span the
205
208
  * whole usage set plus every memory entry and the edge list is a full join, so
@@ -272,7 +275,7 @@ function apply(ctx, rawConfig = {}) {
272
275
  function withSkills() {
273
276
  return new SkillLibrary(graphSkillsRoot, evolutionIoAdapter(() => io.provider()), void 0, (event) => {
274
277
  ctx.emit("evolution/skill-mutated", event);
275
- });
278
+ }, void 0, [...rawConfig.threatExemptLabels ?? []]);
276
279
  }
277
280
  async function nodeDetail(id) {
278
281
  const parsed = parseGraphNodeId(id);
@@ -294,6 +297,7 @@ function apply(ctx, rawConfig = {}) {
294
297
  const stagesForeground = approval.stageForeground !== false;
295
298
  if (approval.isEnabled !== false && sessionPolicyEdit !== "never" && (origins.approval === "background_review" || stagesForeground) && !approval.hasRunner("skill")) return err("Graph skill write cannot be staged: no skill replay runner is registered — mount the tool-skill-manage row (evolution-agent preset) or disable evolution-approval.");
296
299
  const sessionPolicy = sessionPolicyEdit;
300
+ const stageCurrent = await withSkills().read(parsed.name).catch(() => null);
297
301
  const decision = await approval.request({
298
302
  kind: "skill",
299
303
  summary: `graph edit ${parsed.name}`,
@@ -301,7 +305,8 @@ function apply(ctx, rawConfig = {}) {
301
305
  operation: {
302
306
  action: "update",
303
307
  name: parsed.name,
304
- content
308
+ content,
309
+ ...stageCurrent !== null ? { staged_from_sha256: contentHash(stageCurrent) } : {}
305
310
  },
306
311
  origin: origins.approval,
307
312
  libraryOrigin: origins.library
@@ -323,7 +328,7 @@ function apply(ctx, rawConfig = {}) {
323
328
  if (memoryApproval) {
324
329
  const originsM = resolveOrigins(session?.header?.origin);
325
330
  const sessionPolicyM = effectiveSessionPolicy(ctx, session);
326
- if (memoryApproval.isEnabled !== false && sessionPolicyM !== "never" && (originsM.approval === "background_review" || memoryApproval.stageForeground !== false) && !memoryApproval.hasRunner("memory")) return err("Graph memory write cannot be staged: no memory replay runner is registered — mount the tool-memory row (evolution-host/evolution-all bundle) or disable evolution-approval.");
331
+ if (memoryApproval.isEnabled !== false && sessionPolicyM !== "never" && (originsM.approval === "background_review" || memoryApproval.stageForeground !== false) && !memoryApproval.hasRunner("memory")) return err("Graph memory write cannot be staged: no memory replay runner is registered — mount the tool-memory row (evolution-all bundle, or the evolution-preset overlay; the host bundle does not carry it) or disable evolution-approval.");
327
332
  const decision = await memoryApproval.request({
328
333
  kind: "memory",
329
334
  summary: `graph edit memory:${parsed.source}:${parsed.index}`,
@@ -386,7 +391,7 @@ function apply(ctx, rawConfig = {}) {
386
391
  if (memoryApproval) {
387
392
  const origins = resolveOrigins(session?.header?.origin);
388
393
  const sessionPolicy = effectiveSessionPolicy(ctx, session);
389
- if (memoryApproval.isEnabled !== false && sessionPolicy !== "never" && (origins.approval === "background_review" || memoryApproval.stageForeground !== false) && !memoryApproval.hasRunner("memory")) return err("Graph memory delete cannot be staged: no memory replay runner is registered — mount the tool-memory row (evolution-host/evolution-all bundle) or disable evolution-approval.");
394
+ if (memoryApproval.isEnabled !== false && sessionPolicy !== "never" && (origins.approval === "background_review" || memoryApproval.stageForeground !== false) && !memoryApproval.hasRunner("memory")) return err("Graph memory delete cannot be staged: no memory replay runner is registered — mount the tool-memory row (evolution-all bundle, or the evolution-preset overlay; the host bundle does not carry it) or disable evolution-approval.");
390
395
  const decision = await memoryApproval.request({
391
396
  kind: "memory",
392
397
  summary: `graph delete memory:${parsed.source}:${parsed.index}`,
@@ -150,6 +150,12 @@ export interface Config {
150
150
  * the graph on the SAME skills tree the tools/catalog read under a
151
151
  * custom-root deployment (previously the default root was hardcoded). */
152
152
  root?: string;
153
+ /** P2-26 (v19): the deployment's benign threat labels. The graph edit/delete
154
+ * channel writes skill content through the same SkillLibrary as the tools,
155
+ * so it must honour the same exemption list — without it a label allowed on
156
+ * the tool channel was refused here, and the refusal named a config key this
157
+ * channel could not reach. */
158
+ threatExemptLabels?: string[];
153
159
  }
154
160
  export declare const Config: z<Config>;
155
161
  /**
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.64",
4
+ "version": "0.3.66",
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.64",
35
- "@lmzhen/dsh-evolution-core": "^0.3.64"
34
+ "@lmzhen/dsh-evolution-approval": "^0.3.66",
35
+ "@lmzhen/dsh-evolution-core": "^0.3.66"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@deepseek-ai/dsh-invariants": "^0.1.1-rc.2",