@applitools/mcp 0.7.2 → 0.8.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to the Applitools Eyes MCP will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.8.0](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.7.2...js/mcp@0.8.0) (2026-09-09)
9
+
10
+
11
+ ### Features
12
+
13
+ * Performance - batch diff_report across a step's areas | AD-15976 ([#4150](https://github.com/Applitools-Dev/sdk/issues/4150)) ([ad0d3db](https://github.com/Applitools-Dev/sdk/commit/ad0d3db99d63db0416cbe6e72ed164afb581aff0))
14
+
8
15
  ## [0.7.2](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.7.1...js/mcp@0.7.2) (2026-09-08)
9
16
 
10
17
 
package/dist/index.js CHANGED
@@ -4438,7 +4438,7 @@ function gateRejectionCount() {
4438
4438
 
4439
4439
  var name = "@applitools/mcp";
4440
4440
  var mcpName = "io.github.applitools/applitools";
4441
- var version = "0.7.2";
4441
+ var version = "0.8.0";
4442
4442
  var description = "Applitools MCP server for AI coding assistants";
4443
4443
  var main = "./dist/index.js";
4444
4444
  var bin = "./dist/index.js";
@@ -9850,6 +9850,35 @@ const SameAsShape = zod.z
9850
9850
  "baseline eyes_inspect_image are not required — only this step's checkpoint image (for this areaRect) " +
9851
9851
  'and eyes_inspect_dom_diff for this step. Findings must still be restated in full; nothing is inherited ' +
9852
9852
  'from the referenced call.');
9853
+ /** What one changed area is allowed to cost: its own full-areaRect entry plus the sub-rect entries a multi-region area splits into. */
9854
+ const ENTRIES_PER_AREA = 3;
9855
+ // Entries, not areas — a split area costs more than one — so this cannot be the evidence cap, which counts areas. It holds a full evidence round at the allowance above; a step needing more splits into calls, and `eyes_review_end`'s completeness gate covers the split.
9856
+ const MAX_DIFF_REPORT_BATCH = MAX_EVIDENCE_BATCH * ENTRIES_PER_AREA;
9857
+ /** One changed area's report — the unit the hard gate verifies, against this entry's own `areaRect`. */
9858
+ const DiffReportGroupShape = zod.z.object({
9859
+ areaRect: AreaRectShape.describe(AREA_RECT_DESC),
9860
+ findings: DiffReportFindingsShape,
9861
+ sameAs: SameAsShape.optional(),
9862
+ });
9863
+ const DiffReportsShape = zod.z
9864
+ .array(DiffReportGroupShape)
9865
+ .min(1)
9866
+ .max(MAX_DIFF_REPORT_BATCH, `more than ${MAX_DIFF_REPORT_BATCH} entries — nothing from this call was recorded. Split it into calls of at ` +
9867
+ `most ${MAX_DIFF_REPORT_BATCH} entries each, splitting at a full-areaRect boundary (every sub-rect entry stays ` +
9868
+ 'in the same call as, and before, its own full-areaRect entry), and re-send them all')
9869
+ .describe('One entry per changed area being reported — put every unreviewed area of this step in a single call, never one ' +
9870
+ 'call per area. Entries are processed in order and each is verified on its own: its findings must be backed by ' +
9871
+ "evidence fetched for that entry's own areaRect, so reporting one area never lets another through. Order matters " +
9872
+ 'in two places: a sub-rect entry must come before the full-area entry it sits inside, and a `sameAs` may only ' +
9873
+ 'reference an area already recorded — by an earlier call, or by an earlier entry of this same call. If an entry ' +
9874
+ 'is rejected, the entries before it stay recorded and the ones after it are not processed; the error names ' +
9875
+ `exactly which areas to re-send. At most ${MAX_DIFF_REPORT_BATCH} entries per call — entries, not areas, so an ` +
9876
+ 'area you split into sub-rect entries costs more than one. The cap bounds count, not text: each area still ' +
9877
+ 'needs its own complete finding(s) in full, and there is no shorthand for "one ' +
9878
+ 'cause, many areas" (not even via `sameAs`, whose findings are restated in full, never inherited), so a batch ' +
9879
+ 'where every area shares one repetitive cause (e.g. one locale/theme change touching many areas alike) can still ' +
9880
+ 'run long. If writing every entry out inline risks the response not finishing before its JSON closes, use this ' +
9881
+ "argument's other accepted form (a file path) instead of the inline array — see JsonFileArgShape's own description.");
9853
9882
  // Carried up from the diff level into every consolidated summary above it, so a consumer (e.g.
9854
9883
  // the deterministic accept/reject decision at eyes_review_end with scope "step") never has to re-derive
9855
9884
  // "is this expected" / "is this a bug" from prose.
@@ -10834,7 +10863,7 @@ function childWalkNode(level, ctx, childKey, rootScope, mode) {
10834
10863
  scopeId: diffScopeId(ctx.sessionUrl, ctx.stepIndex, areaRect),
10835
10864
  ctx: { ...ctx, areaRect },
10836
10865
  key: childKey,
10837
- call: nextCall(EYES_REVIEW_TOOLS.diffReport, { sessionUrl: ctx.sessionUrl, stepIndex: ctx.stepIndex, areaRect }, rootScope, mode),
10866
+ call: nextCall(EYES_REVIEW_TOOLS.diffReport, { sessionUrl: ctx.sessionUrl, stepIndex: ctx.stepIndex, reports: [{ areaRect }] }, rootScope, mode),
10838
10867
  };
10839
10868
  }
10840
10869
  case 'diff':
@@ -11676,6 +11705,7 @@ async function stepProgress(params) {
11676
11705
  const unreviewed = incompleteAreaRects(children, deps);
11677
11706
  const evidence = evidenceRoundCall(sessionUrl, stepIndex, unreviewed);
11678
11707
  const batched = evidence.args.areaRects;
11708
+ calls[0].args.reports = batched.map(areaRect => ({ areaRect }));
11679
11709
  calls.unshift(evidence);
11680
11710
  result.next.instruction += ` Call ${EYES_INSPECT_TOOLS.evidence} ONCE, with the ${batched.length} areaRects the first call in next.calls already carries — not once per area, and do NOT pad them yourself; it returns the image diff and both baseline/checkpoint images for every area together, already padded and cropped.`;
11681
11711
  if (!unobtainable) {
@@ -11684,12 +11714,11 @@ async function stepProgress(params) {
11684
11714
  if (unreviewed.length > batched.length) {
11685
11715
  result.next.instruction += ` This step has ${unreviewed.length} unreviewed areas, more than one call can carry: review these ${batched.length} first, then call ${EYES_INSPECT_TOOLS.evidence} again for the rest.`;
11686
11716
  }
11687
- result.next.instruction +=
11688
- " Then take the areas one at a time: count the pink regions in that area's image diff. If more than one, report each individually via eyes_review_diff_report with its own smaller rect, then always finish with one eyes_review_diff_report call on the changed area's own full areaRect — that's what marks it reviewed.";
11717
+ result.next.instruction += ` Then report all ${batched.length} in ONE ${EYES_REVIEW_TOOLS.diffReport} call, not one call per area — the last call in next.calls already carries a \`reports\` entry per area, so fill in each entry's own findings. Per area: count the pink regions in its image diff, and if there is more than one, add an entry for each with its own smaller rect BEFORE that area's own full-areaRect entry — at most ${ENTRIES_PER_AREA - 1} such sub-rect entries per area, with any further pink regions reported as extra findings (each with its own \`area\`) inside the full-areaRect entry, which is what marks the area reviewed. Kept to that, a full round always fits one call; if a call would still pass ${MAX_DIFF_REPORT_BATCH} entries, split it at a full-areaRect boundary — every sub-rect entry stays in the same call as, and before, its own full-areaRect entry; areas deferred this way come back in the next response's \`reports\` on their own.`;
11689
11718
  // sameAs buys its way past the image gates with an examined dom diff, so a step with none can't use it.
11690
11719
  if (!unobtainable) {
11691
11720
  result.next.instruction +=
11692
- " Shortcut: if that response's DOM diff shows this exact structural change was recorded earlier in this scenario (another step of this session, or a sibling session in another browser/environment/viewport), call eyes_review_diff_report with sameAs: {sessionUrl, stepIndex, areaRect} pointing at that prior call and report from this step's own evidence without re-analysing the whole change.";
11721
+ " Shortcut: if that response's DOM diff shows this exact structural change was recorded earlier in this scenario (another step of this session, or a sibling session in another browser/environment/viewport), set sameAs: {sessionUrl, stepIndex, areaRect} on that area's own reports entry, pointing at that prior call, and report from this step's own evidence without re-analysing the whole change.";
11693
11722
  }
11694
11723
  }
11695
11724
  else if (!unobtainable) {
@@ -11698,10 +11727,6 @@ async function stepProgress(params) {
11698
11727
  }
11699
11728
  return result;
11700
11729
  }
11701
- /** The changed areas of a step still unreviewed. */
11702
- function incompleteAreaRects(children, deps) {
11703
- return children.filter(child => !isCompleted(child.scopeId, deps)).map(child => parseDiffChildKey(child.key));
11704
- }
11705
11730
  /** One evidence round: as many unreviewed areas as a single call can inline. A step with more is reviewed a round at a time, so no area is ever judged from paths alone. */
11706
11731
  function evidenceRoundCall(sessionUrl, stepIndex, unreviewed) {
11707
11732
  return {
@@ -11712,18 +11737,14 @@ function evidenceRoundCall(sessionUrl, stepIndex, unreviewed) {
11712
11737
  function hasEvidence(sessionUrl, stepIndex, areaRect, deps) {
11713
11738
  return verifyInvocation(stepScopeId(sessionUrl, stepIndex), EYES_INSPECT_TOOLS.evidence, args => rectsIntersect(args.areaRect, areaRect), deps);
11714
11739
  }
11715
- /** Opens the next round when the walk reaches an area the last round did not cover — without it the area's gate would reject and the step would stall. */
11716
- async function prependEvidenceRound(next, params) {
11717
- var _a;
11718
- const { sessionUrl, stepIndex, keys, deps } = params;
11719
- const target = (_a = next.calls) === null || _a === void 0 ? void 0 : _a[0];
11720
- if ((target === null || target === void 0 ? void 0 : target.tool) !== EYES_REVIEW_TOOLS.diffReport)
11740
+ /** Re-opens evidence for every area of the next round no earlier round covered — a half-reported round leaves seen and unseen areas side by side, and any unseen one would stall the step at its gate. */
11741
+ function prependEvidenceRound(next, params) {
11742
+ const { sessionUrl, stepIndex, remaining, deps } = params;
11743
+ const unseen = remaining.filter(areaRect => !hasEvidence(sessionUrl, stepIndex, areaRect, deps));
11744
+ if (unseen.length === 0)
11721
11745
  return;
11722
- if (hasEvidence(sessionUrl, stepIndex, target.args.areaRect, deps))
11723
- return;
11724
- const unreviewed = incompleteAreaRects(await stepChildren(sessionUrl, stepIndex, keys, deps), deps);
11725
- next.calls.unshift(evidenceRoundCall(sessionUrl, stepIndex, unreviewed));
11726
- next.instruction += ` The areas left need their own evidence: call ${EYES_INSPECT_TOOLS.evidence} ONCE with the areaRects the first call in next.calls already carries.`;
11746
+ next.calls.unshift(evidenceRoundCall(sessionUrl, stepIndex, unseen));
11747
+ next.instruction += ` ${unseen.length} of the ${remaining.length} areas left have no evidence yet: call ${EYES_INSPECT_TOOLS.evidence} ONCE with exactly the areaRects the first call in next.calls already carries — the other areas left already have theirs on record — then report all ${remaining.length} in the one ${EYES_REVIEW_TOOLS.diffReport} call.`;
11727
11748
  }
11728
11749
  async function stepEnd(params) {
11729
11750
  const { sessionUrl, stepIndex, findings, keys, rootScope, mode, restart, deps } = params;
@@ -11832,10 +11853,10 @@ async function stepEnd(params) {
11832
11853
  return endResponse(result, mode, isRootScope);
11833
11854
  }
11834
11855
  async function diffReport(params) {
11835
- const { sessionUrl, stepIndex, areaRect, findings, sameAs, keys, rootScope, mode, restart, deps } = params;
11856
+ const { sessionUrl, stepIndex, areaRect, findings, sameAs, keys, rootScope, mode, restart, groupIndex, deps } = params;
11836
11857
  const scopeId = diffScopeId(sessionUrl, stepIndex, areaRect);
11837
11858
  await maybeDiscard(restart, 'diff', { sessionUrl, stepIndex, areaRect }, deps);
11838
- const mismatch = checkParentModeMismatch('diff', rootScope, stepScopeId(sessionUrl, stepIndex), mode, nextCall(EYES_REVIEW_TOOLS.diffReport, { sessionUrl, stepIndex, areaRect, findings, sameAs }, rootScope, mode), deps);
11859
+ const mismatch = checkParentModeMismatch('diff', rootScope, stepScopeId(sessionUrl, stepIndex), mode, nextCall(EYES_REVIEW_TOOLS.diffReport, { sessionUrl, stepIndex, reports: [{ areaRect, findings, sameAs }] }, rootScope, mode), deps);
11839
11860
  if (mismatch)
11840
11861
  return { next: mismatch };
11841
11862
  await promoteIfNeeded({
@@ -11852,7 +11873,7 @@ async function diffReport(params) {
11852
11873
  // via this diff's parent step/session/etc. — can tell this scope was cached under `inspect`;
11853
11874
  // nothing else ever reads a diff's own mode as a "parent" the way every other level's children do.
11854
11875
  recordScopeMode(scopeId, mode, deps);
11855
- await withGateLog(EYES_REVIEW_TOOLS.diffReport, sessionScopeId(sessionUrl), { sessionUrl, stepIndex, areaRect, findings, sameAs, rootScope, mode }, deps, () => verifyDiffReportHardGate(sessionUrl, stepIndex, areaRect, findings, sameAs, keys, deps));
11876
+ await withGateLog(EYES_REVIEW_TOOLS.diffReport, sessionScopeId(sessionUrl), { sessionUrl, stepIndex, areaRect, findings, sameAs, rootScope, mode, groupIndex }, deps, () => verifyDiffReportHardGate(sessionUrl, stepIndex, areaRect, findings, sameAs, keys, deps));
11856
11877
  const result = await runEnd({
11857
11878
  // `diff` is a leaf with no completeness gate of its own (ownChildren is always empty,
11858
11879
  // so runEnd's soft-redirect path — the only place progressCall would surface — never
@@ -11896,9 +11917,88 @@ async function diffReport(params) {
11896
11917
  doneMessage: 'This changed area is recorded.',
11897
11918
  deps,
11898
11919
  });
11899
- await prependEvidenceRound(result.next, { sessionUrl, stepIndex, keys, deps });
11900
11920
  return { findings: result.findings, next: result.next };
11901
11921
  }
11922
+ // Sequential, not verify-all-then-apply-all: an entry may `sameAs` an area an earlier entry of this same call recorded, and in resolve mode its mask gate re-reads the regions earlier entries applied.
11923
+ async function diffReportBatch(params) {
11924
+ var _a, _b;
11925
+ const { sessionUrl, stepIndex, reports, keys, rootScope, mode, restart, deps } = params;
11926
+ const groups = [];
11927
+ let last;
11928
+ for (const [groupIndex, report] of reports.entries()) {
11929
+ try {
11930
+ last = await diffReport({
11931
+ sessionUrl,
11932
+ stepIndex,
11933
+ areaRect: report.areaRect,
11934
+ findings: report.findings,
11935
+ sameAs: report.sameAs,
11936
+ keys,
11937
+ rootScope,
11938
+ mode,
11939
+ restart,
11940
+ groupIndex,
11941
+ deps,
11942
+ });
11943
+ }
11944
+ catch (error) {
11945
+ throw new Error(await batchStopMessage({
11946
+ sessionUrl,
11947
+ stepIndex,
11948
+ reports,
11949
+ groupIndex,
11950
+ reason: error instanceof Error ? error.message : String(error),
11951
+ mode,
11952
+ keys,
11953
+ deps,
11954
+ }));
11955
+ }
11956
+ // A mode-mismatch redirect persisted nothing and re-routes the whole call, so the entries after it are not this call's to process either.
11957
+ if (last.findings === undefined) {
11958
+ const next = last.next;
11959
+ for (const call of (_b = (_a = next.calls) === null || _a === void 0 ? void 0 : _a.filter(c => c.tool === EYES_REVIEW_TOOLS.diffReport)) !== null && _b !== void 0 ? _b : []) {
11960
+ call.args.reports = reports.slice(groupIndex);
11961
+ }
11962
+ return { groups, next };
11963
+ }
11964
+ groups.push({ areaRect: report.areaRect, findings: last.findings });
11965
+ }
11966
+ const next = last.next;
11967
+ await widenToRemainingAreas(next, { sessionUrl, stepIndex, keys, deps });
11968
+ return { groups, next };
11969
+ }
11970
+ /** The changed areas of a step still unreviewed — the only list a `next` or a retry instruction may name. */
11971
+ function incompleteAreaRects(children, deps) {
11972
+ return children.filter(child => !isCompleted(child.scopeId, deps)).map(child => parseDiffChildKey(child.key));
11973
+ }
11974
+ // Re-derived from the phase tracker, never by subtracting what the model just submitted, so an area dropped from one round's `reports` resurfaces in the next.
11975
+ async function widenToRemainingAreas(next, params) {
11976
+ var _a, _b;
11977
+ const { sessionUrl, stepIndex, keys, deps } = params;
11978
+ const calls = (_b = (_a = next.calls) === null || _a === void 0 ? void 0 : _a.filter(call => call.tool === EYES_REVIEW_TOOLS.diffReport)) !== null && _b !== void 0 ? _b : [];
11979
+ if (calls.length === 0)
11980
+ return;
11981
+ const children = await stepChildren(sessionUrl, stepIndex, keys, deps);
11982
+ const remaining = incompleteAreaRects(children, deps).slice(0, MAX_EVIDENCE_BATCH);
11983
+ const reports = remaining.map(areaRect => ({ areaRect }));
11984
+ for (const call of calls)
11985
+ call.args.reports = reports;
11986
+ prependEvidenceRound(next, { sessionUrl, stepIndex, remaining, deps });
11987
+ }
11988
+ /** The one accounting a stopped batch owes the model: what stuck, what failed and why, and what to send back. */
11989
+ async function batchStopMessage(params) {
11990
+ const { sessionUrl, stepIndex, reports, groupIndex, reason, mode, keys, deps } = params;
11991
+ const children = await stepChildren(sessionUrl, stepIndex, keys, deps);
11992
+ const remaining = incompleteAreaRects(children, deps).slice(0, MAX_EVIDENCE_BATCH);
11993
+ const recorded = groupIndex > 0 ? ` reports[0..${groupIndex - 1}] are recorded and stay recorded — do NOT send them again.` : '';
11994
+ const applied = groupIndex > 0 && mode === 'resolve'
11995
+ ? " Their region changes are already applied — and propagated to this session's other steps and to this scenario's sibling sessions — exactly as each recorded finding's `regions` says; nothing reaches the baseline before eyes_resolve_save."
11996
+ : '';
11997
+ const unprocessed = groupIndex + 1 < reports.length ? ` reports[${groupIndex + 1}..${reports.length - 1}] were not processed.` : '';
11998
+ return (`reports[${groupIndex}] (areaRect ${JSON.stringify(reports[groupIndex].areaRect)}) was rejected: ${reason}${recorded}${applied}${unprocessed}` +
11999
+ ` Call ${EYES_REVIEW_TOOLS.diffReport} again with one entry for each of these still-unreviewed areas, and no others: ` +
12000
+ `${JSON.stringify(remaining)}. That list is this step's live state — use it rather than reconstructing one from what you just sent.`);
12001
+ }
11902
12002
 
11903
12003
  // The review tools — `eyes_review_progress`/`eyes_review_end`, each parametric over `scope`
11904
12004
  // ∈ batch/scenario/session/step, plus `eyes_review_diff_report` for each of a step's changed areas
@@ -11960,11 +12060,23 @@ function findingsFor(shape, findings, scope) {
11960
12060
  const parsed = shape.safeParse(findings);
11961
12061
  if (!parsed.success) {
11962
12062
  countGateRejection();
11963
- const issues = parsed.error.issues
11964
- .map(issue => `${issue.path.join('.') || 'findings'}: ${issue.message}`)
11965
- .join('; ');
11966
12063
  throw new Error(`findings must be the ${REQUIRED_FINDINGS[scope]} — see findings' own description for both shapes. ` +
11967
- `What was submitted does not match it: ${issues}.`);
12064
+ `What was submitted does not match it: ${formatZodIssues(parsed.error)}.`);
12065
+ }
12066
+ return parsed.data;
12067
+ }
12068
+ function formatZodIssues(error) {
12069
+ return error.issues.map(issue => `${issue.path.join('.') || 'value'}: ${issue.message}`).join('; ');
12070
+ }
12071
+ /**
12072
+ * Validates an argument already resolved from JsonFileArgShape (inline value or file contents)
12073
+ * against the one shape it must take — unlike `findingsFor`, there's no scope-dependent branching here.
12074
+ */
12075
+ function parseResolvedArg(shape, value, argName) {
12076
+ const parsed = shape.safeParse(value);
12077
+ if (!parsed.success) {
12078
+ countGateRejection();
12079
+ throw new Error(`${argName} does not match the expected shape: ${formatZodIssues(parsed.error)}.`);
11968
12080
  }
11969
12081
  return parsed.data;
11970
12082
  }
@@ -12100,34 +12212,23 @@ function registerReviewTools(server, deps = defaultPhaseTrackerDeps) {
12100
12212
  });
12101
12213
  // --- Diff (leaf) -------------------------------------------------------------
12102
12214
  server.registerTool(EYES_REVIEW_TOOLS.diffReport, {
12103
- description: "Records the rich per-diff evidence for one changed area — every entry must be fully specified for its claimed category. Hard-throws if eyes_inspect_image_diff/eyes_inspect_image weren't actually fetched for this areaRect, a finding claims dynamic.justification:\"History\" with no matching eyes_inspect_history call, a finding proposes a dynamic.mask fix with no eyes_inspect_regions call for this step, its mask's `before` doesn't match a region actually in effect right now, or its mask's `after` doesn't cover the finding's own area. If this is the exact same underlying change as a prior eyes_review_diff_report call in the same scenario, pass `sameAs` instead of redoing the full trio — see its own description. In mode \"resolve\" each finding's `dynamic.mask` is turned into an actual checkpoint match-region change right here — `mask.after.area`, if left null/omitted, defaults to the finding's own `area` — and the response reports per finding what was added/adjusted (or why it could not be), on `regions` and appended to `description`. Always follow the returned `next` field — it tells you exactly what to do next, whether that's reviewing another changed area or moving up to the step level.",
12215
+ description: "Records the rich per-diff evidence for the changed areas of one step — one `reports` entry per area, every unreviewed area of the step in a single call, and every finding fully specified for its claimed category. Each entry is verified on its own, against its own areaRect: it hard-throws if eyes_inspect_evidence wasn't actually fetched for that areaRect, a finding claims dynamic.justification:\"History\" with no matching eyes_inspect_history call, a finding proposes a dynamic.mask fix with no eyes_inspect_regions call for this step, its mask's `before` doesn't match a region actually in effect right now, or its mask's `after` doesn't cover the finding's own area. Entries are processed in order and stop at the first rejection — the ones before it stay recorded, and the error names exactly which areas to send back. If an area is the exact same underlying change as an area already recorded in the same scenario, set its entry's `sameAs` instead of redoing the full trio — see its own description. In mode \"resolve\" each finding's `dynamic.mask` is turned into an actual checkpoint match-region change right here — `mask.after.area`, if left null/omitted, defaults to the finding's own `area` — and the response reports per finding what was added/adjusted (or why it could not be), on `regions` and appended to `description`. Always follow the returned `next` field — it tells you exactly what to do next, whether that's reporting more changed areas or moving up to the step level.",
12104
12216
  inputSchema: {
12105
12217
  sessionUrl: zod.z.string().describe(SESSION_URL_DESC),
12106
12218
  stepIndex: zod.z.number().int().nonnegative().describe(STEP_INDEX_DESC),
12107
- areaRect: AreaRectShape.describe(AREA_RECT_DESC),
12108
- findings: DiffReportFindingsShape,
12109
- sameAs: SameAsShape.optional(),
12219
+ reports: zod.z.union([DiffReportsShape, JsonFileArgShape]),
12110
12220
  rootScope: RootScopeShape,
12111
12221
  mode: ModeShape,
12112
12222
  restart: RestartShape,
12113
12223
  },
12114
- }, async ({ sessionUrl, stepIndex, areaRect, findings, sameAs, rootScope: rawRootScope, mode: rawMode, restart }) => {
12224
+ }, async ({ sessionUrl, stepIndex, reports: rawReportsArg, rootScope: rawRootScope, mode: rawMode, restart }) => {
12115
12225
  const rootScope = resolveRootScope('diff', rawRootScope);
12116
12226
  const mode = resolveMode(rawMode);
12117
12227
  recordReviewCall('diff', mode);
12118
12228
  const keys = reviewApiKeyProvider(sessionUrl, mode);
12119
- const result = await diffReport({
12120
- sessionUrl,
12121
- stepIndex,
12122
- areaRect,
12123
- findings,
12124
- sameAs,
12125
- keys,
12126
- rootScope,
12127
- mode,
12128
- restart,
12129
- deps,
12130
- });
12229
+ const rawReports = await resolveJsonArg(rawReportsArg, 'reports');
12230
+ const reports = parseResolvedArg(DiffReportsShape, rawReports, 'reports');
12231
+ const result = await diffReportBatch({ sessionUrl, stepIndex, reports, keys, rootScope, mode, restart, deps });
12131
12232
  return textResult(JSON.stringify(result, null, 2));
12132
12233
  });
12133
12234
  }