@lmzhen/dsh-evolution-review 0.3.79 → 0.3.81

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.
Files changed (2) hide show
  1. package/lib/index.js +24 -2
  2. package/package.json +11 -11
package/lib/index.js CHANGED
@@ -51,6 +51,16 @@ const REVIEW_OUTPUT_SCHEMA = {
51
51
  summary: { type: "string" }
52
52
  }
53
53
  };
54
+ /**
55
+ * Is this pending row our own notice of the SAME kind? `summary` is the kind
56
+ * discriminator, so distinct notices (cadence review vs completion review vs
57
+ * self-improvement) still queue side by side: a repeat of one kind replaces its
58
+ * pending copy instead of adding a second.
59
+ */
60
+ function isSameKindPending(message, summary) {
61
+ const source = message.source;
62
+ return source?.kind === "plugin" && source.plugin === "dsh-evolution-review" && source.form === "notice" && source.summary === summary;
63
+ }
54
64
  function clampReviewConfig(rawConfig, ctx) {
55
65
  const clamped = [];
56
66
  const field = (name, value, fallback, min, max) => {
@@ -342,6 +352,16 @@ function apply(ctx, rawConfig = {}) {
342
352
  summary
343
353
  }
344
354
  });
355
+ const inbox = agent.inbox;
356
+ if (inbox !== void 0 && typeof inbox.replace === "function") try {
357
+ const superseded = [...inbox.nextTurn ?? [], ...inbox.nextStep ?? []].find((row) => isSameKindPending(row, summary));
358
+ if (superseded !== void 0 && inbox.replace(superseded.id, message)) {
359
+ if (reviewPrompt) markReviewChannel(agent.session.id);
360
+ return true;
361
+ }
362
+ } catch (error) {
363
+ ctx.logger.warn(`dsh-evolution-review: inbox coalescing failed (${error instanceof Error ? error.message : String(error)}) — delivering a fresh message instead`);
364
+ }
345
365
  const wake = agent;
346
366
  try {
347
367
  if (config.reviewWakeInject && typeof wake.followup === "function") {
@@ -612,6 +632,7 @@ function apply(ctx, rawConfig = {}) {
612
632
  const opName = typeof args.name === "string" ? args.name : "";
613
633
  const hashChecked = (args.action === "update" || args.action === "edit" || args.action === "patch") && opName !== "" && preRunHashes?.has(opName) === true;
614
634
  const anchored = hashChecked && typeof stagedBytes === "string" ? stagedBytes : null;
635
+ let gateVerifiedBytes = null;
615
636
  if (hashChecked) {
616
637
  const live = anchored !== null ? anchored : hashLibrary ? await hashLibrary.read(opName).catch(() => null) : null;
617
638
  const preRun = preRunHashes.get(opName);
@@ -620,8 +641,9 @@ function apply(ctx, rawConfig = {}) {
620
641
  failedOps.push(`skill ${args.action} ${args.name}: the skill changed while this review ran — ${args.action === "patch" ? "patch" : "update"} refused as stale; produce a fresh plan`);
621
642
  continue;
622
643
  }
644
+ if (anchored === null) gateVerifiedBytes = live;
623
645
  }
624
- const anchorBytes = anchored ?? stagedBytes;
646
+ const anchorBytes = anchored ?? gateVerifiedBytes ?? stagedBytes;
625
647
  if ((args.action === "update" || args.action === "edit") && anchorBytes !== void 0) args.staged_from_sha256 = anchorBytes === null ? "absent" : contentHash(anchorBytes);
626
648
  const runnerArgs = {
627
649
  operation: args,
@@ -739,7 +761,7 @@ function apply(ctx, rawConfig = {}) {
739
761
  return updated;
740
762
  }
741
763
  if (op.action === "patch") {
742
- const patched = await library.patch(name, op.old_string ?? "", op.new_string ?? "", op.file_path ?? "", false, origin);
764
+ const patched = await library.patch(name, op.old_string ?? "", op.new_string ?? "", op.file_path ?? "", op.replace_all === true, origin);
743
765
  if (patched.ok) await ctx.get("skillUsage")?.record?.(name, "patch").catch(() => {});
744
766
  return patched;
745
767
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-review",
3
3
  "description": "Background review orchestration (community build)",
4
- "version": "0.3.79",
4
+ "version": "0.3.81",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,9 +27,9 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.1",
30
- "@lmzhen/dsh-evolution-approval": "^0.3.79",
31
- "@lmzhen/dsh-evolution-core": "^0.3.79",
32
- "@lmzhen/dsh-evolution-plan-validator": "^0.3.79"
30
+ "@lmzhen/dsh-evolution-approval": "^0.3.81",
31
+ "@lmzhen/dsh-evolution-core": "^0.3.81",
32
+ "@lmzhen/dsh-evolution-plan-validator": "^0.3.81"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "@deepseek-ai/cordis": "^4.0.1",
@@ -37,8 +37,8 @@
37
37
  "@deepseek-ai/dsh-llm": "^0.1.5-rc.2",
38
38
  "@deepseek-ai/dsh-session": "^0.1.5-rc.2",
39
39
  "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
40
- "@lmzhen/dsh-evolution-state": "^0.3.79",
41
- "@lmzhen/dsh-evolution-policy": "^0.3.79"
40
+ "@lmzhen/dsh-evolution-state": "^0.3.81",
41
+ "@lmzhen/dsh-evolution-policy": "^0.3.81"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@deepseek-ai/dsh-agent": "^0.1.5-rc.2",
@@ -48,10 +48,10 @@
48
48
  "@deepseek-ai/dsh-session-persistence": "^0.1.5-rc.2",
49
49
  "@deepseek-ai/dsh-session-persistence-jsonl": "^0.1.5-rc.2",
50
50
  "@deepseek-ai/dsh-tools": "^0.1.5-rc.2",
51
- "@lmzhen/dsh-evolution-approval": "^0.3.79",
52
- "@lmzhen/dsh-evolution-core": "^0.3.79",
53
- "@lmzhen/dsh-evolution-curator": "^0.3.79",
54
- "@lmzhen/dsh-evolution-plan-validator": "^0.3.79",
55
- "@lmzhen/dsh-evolution-state": "^0.3.79"
51
+ "@lmzhen/dsh-evolution-approval": "^0.3.81",
52
+ "@lmzhen/dsh-evolution-core": "^0.3.81",
53
+ "@lmzhen/dsh-evolution-curator": "^0.3.81",
54
+ "@lmzhen/dsh-evolution-plan-validator": "^0.3.81",
55
+ "@lmzhen/dsh-evolution-state": "^0.3.81"
56
56
  }
57
57
  }