@applitools/mcp 0.7.1 → 0.7.2

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.7.2](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.7.1...js/mcp@0.7.2) (2026-09-08)
9
+
10
+
11
+ ### Performance Improvements
12
+
13
+ * Performance - fold the dom diff and regions into evidence | AD-15975 ([#4149](https://github.com/Applitools-Dev/sdk/issues/4149)) ([b58ef06](https://github.com/Applitools-Dev/sdk/commit/b58ef0621e652caa0f7a6b569a651d8cdb7be03e))
14
+
8
15
  ## [0.7.1](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.7.0...js/mcp@0.7.1) (2026-09-06)
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.1";
4441
+ var version = "0.7.2";
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";
@@ -7452,20 +7452,21 @@ const MAX_DELAY_MS = 5000;
7452
7452
  /** With the backoff curve above this yields probes at 1s, 2.5s, 4.75s, 8.1s, 13.1s, 18.1s —
7453
7453
  * six re-checks — before the budget cuts the wait off and the running result goes to the caller. */
7454
7454
  const AWAIT_BUDGET_MS = 20000;
7455
+ const COMPOSED_AWAIT_BUDGET_MS = 4000;
7455
7456
  const defaultSleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
7456
7457
  /**
7457
7458
  * The MCP side of the api layer's caller-owned re-check cadence: absorb the polling for up to
7458
- * `AWAIT_BUDGET_MS` of planned waits (capped exponential backoff, not a fixed interval — a long
7459
+ * `budgetMs` of planned waits (capped exponential backoff, not a fixed interval — a long
7459
7460
  * task shouldn't be hammered every second), then hand the still-`running` result back so the
7460
7461
  * tool layer can tell the agent exactly how to resume. The budget counts planned sleeps, not a
7461
7462
  * clock — deterministic under test, and in production it keeps the tool call comfortably inside
7462
7463
  * common MCP clients' ~60s timeout.
7463
7464
  */
7464
- async function awaitWithinBudget(first, recheck, sleep, signal) {
7465
+ async function awaitWithinBudget(first, recheck, sleep, budgetMs, signal) {
7465
7466
  let result = first;
7466
7467
  let delay = INITIAL_DELAY_MS;
7467
7468
  let planned = 0;
7468
- while (result.status === 'running' && planned + delay <= AWAIT_BUDGET_MS) {
7469
+ while (result.status === 'running' && planned + delay <= budgetMs) {
7469
7470
  // A cancelled request's response is discarded by the MCP layer anyway — stop burning probes
7470
7471
  // the moment the client walks away; the server-side task keeps computing into the pair cache.
7471
7472
  if (signal === null || signal === void 0 ? void 0 : signal.aborted)
@@ -7481,18 +7482,18 @@ async function awaitWithinBudget(first, recheck, sleep, signal) {
7481
7482
  }
7482
7483
  /** Submits the domId pair and waits within the budget. A `running` return means the budget ran
7483
7484
  * out first — resume with `awaitDomDiffTask` and the returned taskId, never by guessing. */
7484
- async function awaitDomDiff(baseUrl, baselineDomId, checkpointDomId, keys, signal, deps = defaultAwaitDomDiffDeps) {
7485
+ async function awaitDomDiff(baseUrl, baselineDomId, checkpointDomId, keys, signal, deps = defaultAwaitDomDiffDeps, budgetMs = AWAIT_BUDGET_MS) {
7485
7486
  var _a;
7486
7487
  const first = await deps.fetchDomDiff(baseUrl, baselineDomId, checkpointDomId, keys);
7487
- return awaitWithinBudget(first, taskId => deps.checkDomDiffTask(baseUrl, taskId, baselineDomId, checkpointDomId, keys), (_a = deps.sleep) !== null && _a !== void 0 ? _a : defaultSleep, signal);
7488
+ return awaitWithinBudget(first, taskId => deps.checkDomDiffTask(baseUrl, taskId, baselineDomId, checkpointDomId, keys), (_a = deps.sleep) !== null && _a !== void 0 ? _a : defaultSleep, budgetMs, signal);
7488
7489
  }
7489
7490
  /** Resumes waiting on an already-submitted task (a prior call's `running` taskId) — probes the
7490
7491
  * task directly instead of resubmitting the pair, with the same budgeted cadence. A ready result
7491
7492
  * still lands in the same domId-pair cache, so later calls for the pair are instant. */
7492
- async function awaitDomDiffTask(baseUrl, taskId, baselineDomId, checkpointDomId, keys, signal, deps = defaultAwaitDomDiffDeps) {
7493
+ async function awaitDomDiffTask(baseUrl, taskId, baselineDomId, checkpointDomId, keys, signal, deps = defaultAwaitDomDiffDeps, budgetMs = AWAIT_BUDGET_MS) {
7493
7494
  var _a;
7494
7495
  const first = await deps.checkDomDiffTask(baseUrl, taskId, baselineDomId, checkpointDomId, keys);
7495
- return awaitWithinBudget(first, nextTaskId => deps.checkDomDiffTask(baseUrl, nextTaskId, baselineDomId, checkpointDomId, keys), (_a = deps.sleep) !== null && _a !== void 0 ? _a : defaultSleep, signal);
7496
+ return awaitWithinBudget(first, nextTaskId => deps.checkDomDiffTask(baseUrl, nextTaskId, baselineDomId, checkpointDomId, keys), (_a = deps.sleep) !== null && _a !== void 0 ? _a : defaultSleep, budgetMs, signal);
7496
7497
  }
7497
7498
 
7498
7499
  const defaultFetchVisibleDomDiffDeps = {
@@ -7516,7 +7517,7 @@ function computeVisibleDomDiff(domDiff, area, visualDiffRects) {
7516
7517
  result = excludeNonVisualNodeDiffs(result, visualDiffRects.baseline, visualDiffRects.checkpoint);
7517
7518
  return serializeDiff(result);
7518
7519
  }
7519
- async function fetchVisibleDomDiff(url, stepIndex, keys, area, taskId, signal, deps = defaultFetchVisibleDomDiffDeps) {
7520
+ async function fetchVisibleDomDiff(url, stepIndex, keys, area, taskId, signal, deps = defaultFetchVisibleDomDiffDeps, budgetMs) {
7520
7521
  var _a, _b;
7521
7522
  const { baseUrl, batchId, sessionId, accountId } = await parseSessionUrlVerified(url, keys);
7522
7523
  let rawSession;
@@ -7542,8 +7543,8 @@ async function fetchVisibleDomDiff(url, stepIndex, keys, area, taskId, signal, d
7542
7543
  // requested or how the step's match settings/regions have changed since. A given taskId
7543
7544
  // resumes that earlier submission's task directly instead of resubmitting the pair.
7544
7545
  const alignment = taskId
7545
- ? await deps.awaitDomDiffTask(baseUrl, taskId, baselineDomId, checkpointDomId, keys, signal)
7546
- : await deps.awaitDomDiff(baseUrl, baselineDomId, checkpointDomId, keys, signal);
7546
+ ? await deps.awaitDomDiffTask(baseUrl, taskId, baselineDomId, checkpointDomId, keys, signal, undefined, budgetMs)
7547
+ : await deps.awaitDomDiff(baseUrl, baselineDomId, checkpointDomId, keys, signal, undefined, budgetMs);
7547
7548
  if (alignment.status === 'running')
7548
7549
  return { status: 'computing', taskId: alignment.taskId };
7549
7550
  let domDiff = alignment.alignment.diff;
@@ -7670,7 +7671,7 @@ function inlineGroups(evidence) {
7670
7671
  return evidence.map(area => area.images).filter(group => group.length > 0);
7671
7672
  }
7672
7673
  /** The paths are unconditional; the image blocks are the turn saving, and `inlining` reports what the budget actually did. */
7673
- function buildEvidenceResult(evidence, budget = {}) {
7674
+ function buildEvidenceResult(evidence, budget = {}, composed = {}) {
7674
7675
  var _a, _b;
7675
7676
  const { images: budgetImages = INLINE_IMAGE_BUDGET, maxImageBytes = MAX_INLINE_IMAGE_BYTES } = budget;
7676
7677
  const rendersImages = IMAGE_RENDERING_CLIENTS.has((_b = (_a = getClientInfo()) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '');
@@ -7719,7 +7720,7 @@ function buildEvidenceResult(evidence, budget = {}) {
7719
7720
  maxImageBytes,
7720
7721
  };
7721
7722
  return {
7722
- content: [{ type: 'text', text: JSON.stringify({ evidence, inlining }, null, 2) }, ...imageBlocks],
7723
+ content: [{ type: 'text', text: JSON.stringify({ evidence, ...composed, inlining }, null, 2) }, ...imageBlocks],
7723
7724
  };
7724
7725
  }
7725
7726
 
@@ -8030,6 +8031,52 @@ const EYES_INSPECT_TOOLS = {
8030
8031
  regions: 'eyes_inspect_regions',
8031
8032
  history: 'eyes_inspect_history',
8032
8033
  };
8034
+ /** Only `eyes_inspect_dom_diff` resumes the server task, whichever call surfaced the taskId. */
8035
+ function domDiffComputingNext(taskId, resume, budgetMs) {
8036
+ const head = budgetMs < AWAIT_BUDGET_MS
8037
+ ? `The DOM diff is still computing server-side. Resume it now — ${resume} plus taskId "${taskId}"; that call waits for the diff, so do not idle first. `
8038
+ : `The DOM diff is still computing server-side. Wait ~10 seconds, then ${resume} plus taskId "${taskId}". `;
8039
+ return (head +
8040
+ 'Do NOT guess, summarize, or reconstruct the diff from anything else — it is only available through that call.');
8041
+ }
8042
+ const DOM_DIFF_TERMINAL_NEXT = 'No DOM diff exists for this step and none can be computed — this is terminal, not transient. ' +
8043
+ 'Do NOT call eyes_inspect_dom_diff for this step. Review it from the images alone and record that ' +
8044
+ 'the structural comparison was not available, rather than that no structural change was found.';
8045
+ /** A composed read must never take the evidence bundle down with it — the images are the call's contract. */
8046
+ function composeFailure(tool) {
8047
+ return (error) => ({
8048
+ status: 'error',
8049
+ error: error instanceof Error ? error.message : String(error),
8050
+ next: `This read failed, so ${tool} still counts as not called for this step — call it directly to retry it. ` +
8051
+ 'Everything else in this response is unaffected.',
8052
+ });
8053
+ }
8054
+ function failed(result) {
8055
+ return result.status === 'error';
8056
+ }
8057
+ /** A `null` record keeps the review gates treating the diff as not-yet-fetched until the agent actually receives it. */
8058
+ function composedDomDiff(result) {
8059
+ if (failed(result))
8060
+ return { block: { ...result }, record: null };
8061
+ if (result.status === 'computing') {
8062
+ const resume = `call ${EYES_INSPECT_TOOLS.domDiff} with this step's sessionUrl and stepIndex`;
8063
+ return {
8064
+ block: {
8065
+ status: 'computing',
8066
+ taskId: result.taskId,
8067
+ next: domDiffComputingNext(result.taskId, resume, COMPOSED_AWAIT_BUDGET_MS),
8068
+ },
8069
+ record: null,
8070
+ };
8071
+ }
8072
+ if (result.status !== 'ready') {
8073
+ return {
8074
+ block: { status: result.status, reason: result.reason, next: DOM_DIFF_TERMINAL_NEXT },
8075
+ record: { rect: undefined, status: result.status },
8076
+ };
8077
+ }
8078
+ return { block: { status: 'ready', diff: result.diff }, record: { rect: undefined } };
8079
+ }
8033
8080
  const SESSION_URL_DESC = 'Eyes session URL: https://eyes.applitools.com/app/test-results/{batchId}/{sessionId}[/steps/{N}]?accountId=... (the /steps/N suffix is ignored if present)';
8034
8081
  const BATCH_URL_DESC = 'Eyes batch URL: https://eyes.applitools.com/app/test-results/{batchId}/?accountId=... (a trailing /{sessionId}[/steps/{N}] is fine too and is ignored — pass a session/step URL here as-is, no need to strip it down)';
8035
8082
  const STEP_INDEX_DESC = 'Zero-based index of the step, as returned by eyes_inspect_steps';
@@ -8121,7 +8168,7 @@ function registerEyesInspectDataTools(server, phaseTrackerDeps = defaultPhaseTra
8121
8168
  return textResult(filePath);
8122
8169
  });
8123
8170
  server.registerTool(EYES_INSPECT_TOOLS.evidence, {
8124
- description: "Everything needed to review a step's changed areas, in one call: for each area, the image diff (checkpoint with differences highlighted in pink) plus the baseline and checkpoint screenshots, fetched together. Pass EVERY area you still have to review in a single call's `areaRects` — one call per area is exactly what this tool exists to avoid. Pass each rect exactly as eyes_review_progress gave it to you — do NOT pad it, the server pads it and clamps it to each image. Prefer this over calling eyes_inspect_image_diff and eyes_inspect_image separately; it is what eyes_review_diff_report's gate checks for. Returns `evidence`, one entry per area in the order asked for, each with a labelled file path per image, plus the images themselves for clients that render them — read each `path` only for an image whose `inline` is false, and `notInlined` says why it was not. Inlined images arrive as image blocks in the same order as the `inline: true` entries, reading `evidence` top to bottom; `inlining` reports how much of the budget the response spent. Each image carries the `rect` it was actually cropped at: the two sides of a step can differ in size, so the crops are near-identical but NOT guaranteed equal — compare by content, and check the rects before reading anything into a difference in position or extent. Any image this step cannot produce for an area is listed under that area's `unavailable` with the reason, which is a fact about the step, not a failure. Already reflects any match regions added during resolution; resolution can happen between calls, so never reuse an earlier result in this conversation — call it again.",
8171
+ description: 'Everything needed to review a step\'s changed areas, in one call: for each area, the image diff (checkpoint with differences highlighted in pink) plus the baseline and checkpoint screenshots, fetched together. Pass EVERY area you still have to review in a single call\'s `areaRects` — one call per area is exactly what this tool exists to avoid. Pass each rect exactly as eyes_review_progress gave it to you — do NOT pad it, the server pads it and clamps it to each image. Prefer this over calling eyes_inspect_image_diff and eyes_inspect_image separately; it is what eyes_review_diff_report\'s gate checks for. It also returns the whole step\'s structural DOM diff under `domDiff` and the match regions currently in effect under `regions`, so do not call eyes_inspect_dom_diff or eyes_inspect_regions separately for this step — the one exception is a `domDiff` or `regions` reporting `status: "computing"` or `status: "error"` (with the failure\'s own message under `error`), whose own `next` says where to pick it up. The composed `domDiff` waits only briefly, so `status: "computing"` is common and expected here — the images ship without waiting for it; follow its `next` to eyes_inspect_dom_diff, which is where the diff is waited out. Returns `evidence`, one entry per area in the order asked for, each with a labelled file path per image, plus the images themselves for clients that render them — read each `path` only for an image whose `inline` is false, and `notInlined` says why it was not. Inlined images arrive as image blocks in the same order as the `inline: true` entries, reading `evidence` top to bottom; `inlining` reports how much of the budget the response spent. Each image carries the `rect` it was actually cropped at: the two sides of a step can differ in size, so the crops are near-identical but NOT guaranteed equal — compare by content, and check the rects before reading anything into a difference in position or extent. Any image this step cannot produce for an area is listed under that area\'s `unavailable` with the reason, which is a fact about the step, not a failure. Already reflects any match regions added during resolution; resolution can happen between calls, so never reuse an earlier result in this conversation — call it again.',
8125
8172
  inputSchema: {
8126
8173
  sessionUrl: zod.z.string().describe(SESSION_URL_DESC),
8127
8174
  stepIndex: zod.z.number().int().nonnegative().describe(STEP_INDEX_DESC),
@@ -8132,16 +8179,27 @@ function registerEyesInspectDataTools(server, phaseTrackerDeps = defaultPhaseTra
8132
8179
  .describe(`Every changed area of this step you still need evidence for — from eyes_inspect_changed_areas or eyes_review_progress, verbatim and unpadded. Up to ${MAX_EVIDENCE_BATCH} per call; if a step has more, review these first and call again for the rest.`),
8133
8180
  },
8134
8181
  annotations: READ_ONLY,
8135
- }, async ({ sessionUrl, stepIndex, areaRects }) => {
8182
+ }, async ({ sessionUrl, stepIndex, areaRects }, extra) => {
8136
8183
  const keys = readOnlyApiKeyProvider(sessionUrl);
8137
8184
  const scopeId = stepScopeId(sessionUrl, stepIndex);
8138
- const evidence = await fetchEvidence(sessionUrl, stepIndex, areaRects, keys);
8139
- const result = buildEvidenceResult(evidence);
8185
+ // Concurrent, so the merged call costs max(images, regions, domDiff) rather than their sum.
8186
+ const [evidence, regions, domDiff] = await Promise.all([
8187
+ fetchEvidence(sessionUrl, stepIndex, areaRects, keys),
8188
+ fetchRegions(sessionUrl, stepIndex, keys).catch(composeFailure(EYES_INSPECT_TOOLS.regions)),
8189
+ fetchVisibleDomDiff(sessionUrl, stepIndex, keys, undefined, undefined, extra === null || extra === void 0 ? void 0 : extra.signal, undefined, COMPOSED_AWAIT_BUDGET_MS).catch(composeFailure(EYES_INSPECT_TOOLS.domDiff)),
8190
+ ]);
8191
+ const { block, record } = composedDomDiff(domDiff);
8192
+ const result = buildEvidenceResult(evidence, {}, { domDiff: block, regions });
8140
8193
  recordChainSource(scopeId, phaseTrackerDeps);
8141
8194
  // One record per area, not per call: eyes_review_diff_report's gate reads these area by area.
8142
8195
  for (const area of evidence) {
8143
8196
  logInvocation(scopeId, EYES_INSPECT_TOOLS.evidence, { areaRect: area.areaRect, images: area.images.map(image => image.label) }, phaseTrackerDeps);
8144
8197
  }
8198
+ // The standalone tools' own keys and argument shapes, so the review gates need no change to accept these.
8199
+ if (!failed(regions))
8200
+ logInvocation(scopeId, EYES_INSPECT_TOOLS.regions, { rect: undefined }, phaseTrackerDeps);
8201
+ if (record)
8202
+ logInvocation(scopeId, EYES_INSPECT_TOOLS.domDiff, record, phaseTrackerDeps);
8145
8203
  return result;
8146
8204
  });
8147
8205
  server.registerTool(EYES_INSPECT_TOOLS.dom, {
@@ -8186,7 +8244,7 @@ function registerEyesInspectDataTools(server, phaseTrackerDeps = defaultPhaseTra
8186
8244
  taskId: zod.z
8187
8245
  .string()
8188
8246
  .optional()
8189
- .describe('ONLY a taskId from a prior {"status":"computing"} response of this exact tool for the same sessionUrl/stepIndex — resumes checking that computation instead of resubmitting. Never invent or reuse one across steps.'),
8247
+ .describe('ONLY a taskId from a prior {"status":"computing"} response for the same sessionUrl/stepIndex — from this tool or from eyes_inspect_evidence\'s composed `domDiff` — resumes checking that computation instead of resubmitting. Never invent or reuse one across steps.'),
8190
8248
  },
8191
8249
  annotations: READ_ONLY,
8192
8250
  }, async ({ sessionUrl, stepIndex, rect, taskId }, extra) => {
@@ -8195,24 +8253,17 @@ function registerEyesInspectDataTools(server, phaseTrackerDeps = defaultPhaseTra
8195
8253
  if (result.status === 'computing') {
8196
8254
  // Deliberately NOT logged as an invocation: eyes_review's hard gates must keep treating
8197
8255
  // this step's dom diff as not-yet-fetched until the agent actually receives it.
8256
+ const resume = `call ${EYES_INSPECT_TOOLS.domDiff} again with the same sessionUrl/stepIndex/rect`;
8198
8257
  return textResult(JSON.stringify({
8199
8258
  status: 'computing',
8200
8259
  taskId: result.taskId,
8201
- next: `The DOM diff is still computing server-side. Wait ~10 seconds, then call ${EYES_INSPECT_TOOLS.domDiff} ` +
8202
- `again with the same sessionUrl/stepIndex/rect plus taskId "${result.taskId}". ` +
8203
- 'Do NOT guess, summarize, or reconstruct the diff from anything else — it is only available through that call.',
8260
+ next: domDiffComputingNext(result.taskId, resume, AWAIT_BUDGET_MS),
8204
8261
  }, null, 2));
8205
8262
  }
8206
8263
  if (result.status !== 'ready') {
8207
8264
  // Logged, unlike `computing`, so eyes_review_end's step-close gate stays satisfiable without a diff.
8208
8265
  logDataToolCall(stepScopeId(sessionUrl, stepIndex), EYES_INSPECT_TOOLS.domDiff, { rect, status: result.status }, phaseTrackerDeps);
8209
- return textResult(JSON.stringify({
8210
- status: result.status,
8211
- reason: result.reason,
8212
- next: 'No DOM diff exists for this step and none can be computed — this is terminal, not transient. ' +
8213
- 'Do NOT call this tool again for this step. Review it from the images alone and record that ' +
8214
- 'the structural comparison was not available, rather than that no structural change was found.',
8215
- }, null, 2));
8266
+ return textResult(JSON.stringify({ status: result.status, reason: result.reason, next: DOM_DIFF_TERMINAL_NEXT }, null, 2));
8216
8267
  }
8217
8268
  logDataToolCall(stepScopeId(sessionUrl, stepIndex), EYES_INSPECT_TOOLS.domDiff, { rect }, phaseTrackerDeps);
8218
8269
  return textResult(result.diff);
@@ -11619,10 +11670,6 @@ async function stepProgress(params) {
11619
11670
  if (unobtainable) {
11620
11671
  result.next.instruction += ` Do NOT call eyes_inspect_dom_diff for this step — ${unobtainable}, so no structural comparison is available. Review from the images alone, and record that the structural comparison was unavailable rather than that no structural change was found.`;
11621
11672
  }
11622
- else {
11623
- result.next.instruction +=
11624
- ' Run eyes_inspect_dom_diff for this step first, regardless of how small or scattered the changed areas look — a visual crop comparison can miss small displacement that dom_diff catches directly.';
11625
- }
11626
11673
  const calls = result.next.calls;
11627
11674
  if (((_b = calls === null || calls === void 0 ? void 0 : calls[0]) === null || _b === void 0 ? void 0 : _b.tool) === EYES_REVIEW_TOOLS.diffReport) {
11628
11675
  // Not a review tool, so it carries no rootScope/mode and is not built through `nextCall`.
@@ -11631,6 +11678,9 @@ async function stepProgress(params) {
11631
11678
  const batched = evidence.args.areaRects;
11632
11679
  calls.unshift(evidence);
11633
11680
  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
+ if (!unobtainable) {
11682
+ result.next.instruction += ` That same response carries this step's structural DOM diff and the match regions currently in effect, so ${EYES_INSPECT_TOOLS.domDiff} and ${EYES_INSPECT_TOOLS.regions} need no calls of their own here. Read the DOM diff regardless of how small or scattered the changed areas look — a visual crop comparison can miss small displacement it catches directly — and if its \`domDiff\` field reports anything other than a diff, follow that field's own \`next\` before reporting.`;
11683
+ }
11634
11684
  if (unreviewed.length > batched.length) {
11635
11685
  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.`;
11636
11686
  }
@@ -11639,9 +11689,12 @@ async function stepProgress(params) {
11639
11689
  // sameAs buys its way past the image gates with an examined dom diff, so a step with none can't use it.
11640
11690
  if (!unobtainable) {
11641
11691
  result.next.instruction +=
11642
- " Shortcut: if eyes_inspect_dom_diff already 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.";
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.";
11643
11693
  }
11644
11694
  }
11695
+ else if (!unobtainable) {
11696
+ result.next.instruction += ` Call ${EYES_INSPECT_TOOLS.domDiff} for this step before ${EYES_REVIEW_TOOLS.end} — every area here is already reviewed, so no ${EYES_INSPECT_TOOLS.evidence} call is left to carry this step's structural DOM diff, and the step does not close until that diff is on record. Read it regardless of how small or scattered the changed areas look — a visual crop comparison can miss small displacement it catches directly.`;
11697
+ }
11645
11698
  }
11646
11699
  return result;
11647
11700
  }