@lmzhen/dsh-evolution-merge 0.30.8 → 0.30.10

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
@@ -1531,7 +1531,7 @@ function mergeUsage() {
1531
1531
  }
1532
1532
  //#endregion
1533
1533
  //#region lib/types/read-commands.js
1534
- async function handleReadOnlyMergeCommand(command, io, home) {
1534
+ async function handleReadOnlyMergeCommand(command, io, home, cards) {
1535
1535
  const withNote = (text, note) => note === void 0 ? text : "note: " + note + "\n" + text;
1536
1536
  if (command.verb === "status") {
1537
1537
  const loaded = await loadMergeState(io, home);
@@ -1544,7 +1544,8 @@ async function handleReadOnlyMergeCommand(command, io, home) {
1544
1544
  if (command.verb === "pending") {
1545
1545
  const loaded = await loadMergeState(io, home);
1546
1546
  const rows = command.expired === true ? loaded.state.rows.filter((row) => row.expired !== void 0) : loaded.state.rows;
1547
- return withNote(command.expired === true ? formatStatus(rows) : formatQueue(rows, "pending"), loaded.note);
1547
+ const live = cards === void 0 ? rows : rows.filter((row) => cards.some((card) => card.name === row.a) && cards.some((card) => card.name === row.b));
1548
+ return withNote(command.expired === true ? formatStatus(live) : formatQueue(live, "pending"), loaded.note);
1548
1549
  }
1549
1550
  if (command.verb === "candidates") {
1550
1551
  const loaded = await loadMergeState(io, home);
@@ -2874,12 +2875,16 @@ async function runRound1OverChannel(options, candidate, signal) {
2874
2875
  dispose
2875
2876
  };
2876
2877
  }
2877
- if (!parsed.decision.shouldMerge || parsed.decision.mode === "keep") {
2878
+ const decision = round1.turn.cacheRead === void 0 ? parsed.decision : {
2879
+ ...parsed.decision,
2880
+ cacheRead: round1.turn.cacheRead
2881
+ };
2882
+ if (!decision.shouldMerge || decision.mode === "keep") {
2878
2883
  await dispose();
2879
2884
  return {
2880
2885
  outcome: {
2881
2886
  kind: "keep",
2882
- decision: parsed.decision
2887
+ decision
2883
2888
  },
2884
2889
  dispose
2885
2890
  };
@@ -2888,7 +2893,7 @@ async function runRound1OverChannel(options, candidate, signal) {
2888
2893
  return {
2889
2894
  outcome: {
2890
2895
  kind: "merge",
2891
- decision: parsed.decision
2896
+ decision
2892
2897
  },
2893
2898
  childId: child,
2894
2899
  dispose,
@@ -3220,6 +3225,9 @@ async function commitStagedRun(io, home, runId, port, options) {
3220
3225
  };
3221
3226
  try {
3222
3227
  await writeCommitReceipt(io, home, receipt);
3228
+ try {
3229
+ await io.remove(snapshotPath(home, runId));
3230
+ } catch {}
3223
3231
  return {
3224
3232
  ok: true,
3225
3233
  plan: assembled.plan,
@@ -4110,7 +4118,8 @@ function createMergeRuntime(deps) {
4110
4118
  text: "merge approve 完成:merged " + String(result.report.totals.merged)
4111
4119
  };
4112
4120
  }
4113
- const text = await handleReadOnlyMergeCommand(command, deps.io, deps.home);
4121
+ const cards = command.verb === "pending" ? await deps.cards(new AbortController().signal) : void 0;
4122
+ const text = await handleReadOnlyMergeCommand(command, deps.io, deps.home, cards);
4114
4123
  if (text !== null) return {
4115
4124
  ok: true,
4116
4125
  text
@@ -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) {
@@ -2,7 +2,7 @@ import { assembleStagedCommit } from "./commit-assembly.js";
2
2
  import { writeCommitReceipt } from "./commit-receipt.js";
3
3
  import { pairKey } from "./contracts.js";
4
4
  import { writeJournal } from "./domain/commit-journal-store.js";
5
- import { writeCommitSnapshot } from "./commit-snapshot.js";
5
+ import { snapshotPath, writeCommitSnapshot } from "./commit-snapshot.js";
6
6
  export async function commitStagedRun(io, home, runId, port, options) {
7
7
  const assembled = await assembleStagedCommit(io, home, runId, port, { origin: options.origin, summary: options.summary });
8
8
  if (!assembled.ok)
@@ -46,6 +46,10 @@ export async function commitStagedRun(io, home, runId, port, options) {
46
46
  };
47
47
  try {
48
48
  await writeCommitReceipt(io, home, receipt);
49
+ try {
50
+ await io.remove(snapshotPath(home, runId));
51
+ }
52
+ catch { /* committed journal is the record */ }
49
53
  return { ok: true, plan: assembled.plan, result, receipt };
50
54
  }
51
55
  catch (error) {
@@ -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;
@@ -4,6 +4,8 @@
4
4
  */
5
5
  import type { EvolutionIoLike } from '@lmzhen/dsh-evolution-core';
6
6
  import type { MergeCliCommand } from './commands.ts';
7
- export declare function handleReadOnlyMergeCommand(command: MergeCliCommand, io: EvolutionIoLike, home: string): Promise<string | null>;
7
+ export declare function handleReadOnlyMergeCommand(command: MergeCliCommand, io: EvolutionIoLike, home: string, cards?: readonly {
8
+ readonly name: string;
9
+ }[]): Promise<string | null>;
8
10
  export declare function mergeCommandHelp(): string;
9
11
  //# sourceMappingURL=read-commands.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { loadMergeState } from "./state.js";
2
2
  import { formatQueue, formatStatus } from "./status.js";
3
3
  import { mergeUsage } from "./commands.js";
4
- export async function handleReadOnlyMergeCommand(command, io, home) {
4
+ export async function handleReadOnlyMergeCommand(command, io, home, cards) {
5
5
  const withNote = (text, note) => note === undefined ? text : 'note: ' + note + '\n' + text;
6
6
  if (command.verb === 'status') {
7
7
  const loaded = await loadMergeState(io, home);
@@ -14,7 +14,8 @@ export async function handleReadOnlyMergeCommand(command, io, home) {
14
14
  if (command.verb === 'pending') {
15
15
  const loaded = await loadMergeState(io, home);
16
16
  const rows = command.expired === true ? loaded.state.rows.filter(row => row.expired !== undefined) : loaded.state.rows;
17
- return withNote(command.expired === true ? formatStatus(rows) : formatQueue(rows, 'pending'), loaded.note);
17
+ const live = cards === undefined ? rows : rows.filter(row => cards.some(card => card.name === row.a) && cards.some(card => card.name === row.b));
18
+ return withNote(command.expired === true ? formatStatus(live) : formatQueue(live, 'pending'), loaded.note);
18
19
  }
19
20
  if (command.verb === 'candidates') {
20
21
  const loaded = await loadMergeState(io, home);
@@ -314,7 +314,8 @@ export function createMergeRuntime(deps) {
314
314
  return { ok: false, text: 'merge approve started without a report' };
315
315
  return { ok: true, text: 'merge approve 完成:merged ' + String(result.report.totals.merged) };
316
316
  }
317
- const text = await handleReadOnlyMergeCommand(command, deps.io, deps.home);
317
+ const cards = command.verb === 'pending' ? await deps.cards(new AbortController().signal) : undefined;
318
+ const text = await handleReadOnlyMergeCommand(command, deps.io, deps.home, cards);
318
319
  if (text !== null)
319
320
  return { ok: true, text };
320
321
  return readOnly.execute(command);
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.8",
4
+ "version": "0.30.10",
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.8",
31
- "@lmzhen/dsh-evolution-merge-engine": "^0.30.8"
30
+ "@lmzhen/dsh-evolution-core": "^0.30.10",
31
+ "@lmzhen/dsh-evolution-merge-engine": "^0.30.10"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "@deepseek-ai/cordis": "^4.0.5"