@lmzhen/dsh-evolution-merge 0.30.7 → 0.30.9

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
@@ -1561,10 +1561,13 @@ function mergeCommandHelp() {
1561
1561
  }
1562
1562
  //#endregion
1563
1563
  //#region lib/types/domain/errors.js
1564
+ function redact(text) {
1565
+ return text.replace(/sk-[A-Za-z0-9_-]{16,}/g, "[redacted]").replace(/Bearer\s+\S+/gi, "Bearer [redacted]").replace(/(api[_-]?key\s*[:=]\s*)\S+/gi, "$1[redacted]");
1566
+ }
1564
1567
  function formatMergeError(error) {
1565
1568
  if (error.kind === "parameter") return "merge: " + error.message + " (" + error.code + ")";
1566
1569
  const where = error.stage === void 0 && error.runId === void 0 ? error.detail ?? "no additional detail" : [error.stage === void 0 ? void 0 : "stage=" + error.stage, error.runId === void 0 ? void 0 : "run=" + error.runId].filter(Boolean).join(" ");
1567
- return "merge failed: " + error.message + " (" + error.code + ")\n" + where + "\nnext: fix the target or rerun after the cause is gone";
1570
+ return redact("merge failed: " + error.message + " (" + error.code + ")\n" + where + "\nnext: fix the target or rerun after the cause is gone");
1568
1571
  }
1569
1572
  //#endregion
1570
1573
  //#region lib/types/merge-command.js
@@ -2871,12 +2874,16 @@ async function runRound1OverChannel(options, candidate, signal) {
2871
2874
  dispose
2872
2875
  };
2873
2876
  }
2874
- if (!parsed.decision.shouldMerge || parsed.decision.mode === "keep") {
2877
+ const decision = round1.turn.cacheRead === void 0 ? parsed.decision : {
2878
+ ...parsed.decision,
2879
+ cacheRead: round1.turn.cacheRead
2880
+ };
2881
+ if (!decision.shouldMerge || decision.mode === "keep") {
2875
2882
  await dispose();
2876
2883
  return {
2877
2884
  outcome: {
2878
2885
  kind: "keep",
2879
- decision: parsed.decision
2886
+ decision
2880
2887
  },
2881
2888
  dispose
2882
2889
  };
@@ -2885,7 +2892,7 @@ async function runRound1OverChannel(options, candidate, signal) {
2885
2892
  return {
2886
2893
  outcome: {
2887
2894
  kind: "merge",
2888
- decision: parsed.decision
2895
+ decision
2889
2896
  },
2890
2897
  childId: child,
2891
2898
  dispose,
@@ -9,6 +9,7 @@ import type { ScanRound1Outcome } from './scan-run.ts';
9
9
  export interface ChannelTurnLike {
10
10
  readonly text: string;
11
11
  readonly stopReason: string;
12
+ readonly cacheRead?: number;
12
13
  }
13
14
  export type ChannelTurnOutcome = {
14
15
  readonly kind: 'ok';
@@ -52,13 +52,14 @@ export async function runRound1OverChannel(options, candidate, signal) {
52
52
  await dispose();
53
53
  return { outcome: { kind: 'failed', failure: { stage: 'decide', code: parsed.code, message: parsed.message, retryable: true, retryFrom: 'agent1' } }, dispose };
54
54
  }
55
- if (!parsed.decision.shouldMerge || parsed.decision.mode === 'keep') {
55
+ const decision = round1.turn.cacheRead === undefined ? parsed.decision : { ...parsed.decision, cacheRead: round1.turn.cacheRead };
56
+ if (!decision.shouldMerge || decision.mode === 'keep') {
56
57
  await dispose();
57
- return { outcome: { kind: 'keep', decision: parsed.decision }, dispose };
58
+ return { outcome: { kind: 'keep', decision }, dispose };
58
59
  }
59
60
  const child = opened.childId;
60
61
  return {
61
- outcome: { kind: 'merge', decision: parsed.decision },
62
+ outcome: { kind: 'merge', decision },
62
63
  childId: child,
63
64
  dispose,
64
65
  async author(row, decision, turnSignal) {
@@ -52,6 +52,7 @@ export interface MergeDecision {
52
52
  readonly confidence?: number;
53
53
  readonly aSummary?: string;
54
54
  readonly bSummary?: string;
55
+ readonly cacheRead?: number;
55
56
  }
56
57
  export interface MergeUsage {
57
58
  readonly inputTokens?: number;
@@ -1,9 +1,15 @@
1
+ function redact(text) {
2
+ return text
3
+ .replace(/sk-[A-Za-z0-9_-]{16,}/g, '[redacted]')
4
+ .replace(/Bearer\s+\S+/gi, 'Bearer [redacted]')
5
+ .replace(/(api[_-]?key\s*[:=]\s*)\S+/gi, '$1[redacted]');
6
+ }
1
7
  export function formatMergeError(error) {
2
8
  if (error.kind === 'parameter')
3
9
  return 'merge: ' + error.message + ' (' + error.code + ')';
4
10
  const where = error.stage === undefined && error.runId === undefined
5
11
  ? (error.detail ?? 'no additional detail')
6
12
  : [error.stage === undefined ? undefined : 'stage=' + error.stage, error.runId === undefined ? undefined : 'run=' + error.runId].filter(Boolean).join(' ');
7
- return 'merge failed: ' + error.message + ' (' + error.code + ')\n' + where + '\nnext: fix the target or rerun after the cause is gone';
13
+ return redact('merge failed: ' + error.message + ' (' + error.code + ')\n' + where + '\nnext: fix the target or rerun after the cause is gone');
8
14
  }
9
15
  //# sourceMappingURL=errors.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lmzhen/dsh-evolution-merge",
3
3
  "description": "Skill auto-merge domain: screening, two-round authoring, queues and commit orchestration (community build)",
4
- "version": "0.30.7",
4
+ "version": "0.30.9",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -27,8 +27,8 @@
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
29
  "@deepseek-ai/schemastery": "^3.18.5",
30
- "@lmzhen/dsh-evolution-core": "^0.30.7",
31
- "@lmzhen/dsh-evolution-merge-engine": "^0.30.7"
30
+ "@lmzhen/dsh-evolution-core": "^0.30.9",
31
+ "@lmzhen/dsh-evolution-merge-engine": "^0.30.9"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@deepseek-ai/cordis": "^4.0.5"