@applitools/mcp 0.7.1 → 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 +14 -0
- package/dist/index.js +230 -76
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,20 @@ 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
|
+
|
|
15
|
+
## [0.7.2](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.7.1...js/mcp@0.7.2) (2026-09-08)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Performance Improvements
|
|
19
|
+
|
|
20
|
+
* 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))
|
|
21
|
+
|
|
8
22
|
## [0.7.1](https://github.com/Applitools-Dev/sdk/compare/js/mcp@0.7.0...js/mcp@0.7.1) (2026-09-06)
|
|
9
23
|
|
|
10
24
|
|
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.
|
|
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";
|
|
@@ -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
|
-
* `
|
|
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 <=
|
|
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:
|
|
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
|
-
|
|
8139
|
-
const
|
|
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
|
|
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:
|
|
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);
|
|
@@ -9799,6 +9850,35 @@ const SameAsShape = zod.z
|
|
|
9799
9850
|
"baseline eyes_inspect_image are not required — only this step's checkpoint image (for this areaRect) " +
|
|
9800
9851
|
'and eyes_inspect_dom_diff for this step. Findings must still be restated in full; nothing is inherited ' +
|
|
9801
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.");
|
|
9802
9882
|
// Carried up from the diff level into every consolidated summary above it, so a consumer (e.g.
|
|
9803
9883
|
// the deterministic accept/reject decision at eyes_review_end with scope "step") never has to re-derive
|
|
9804
9884
|
// "is this expected" / "is this a bug" from prose.
|
|
@@ -10783,7 +10863,7 @@ function childWalkNode(level, ctx, childKey, rootScope, mode) {
|
|
|
10783
10863
|
scopeId: diffScopeId(ctx.sessionUrl, ctx.stepIndex, areaRect),
|
|
10784
10864
|
ctx: { ...ctx, areaRect },
|
|
10785
10865
|
key: childKey,
|
|
10786
|
-
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),
|
|
10787
10867
|
};
|
|
10788
10868
|
}
|
|
10789
10869
|
case 'diff':
|
|
@@ -11619,36 +11699,34 @@ async function stepProgress(params) {
|
|
|
11619
11699
|
if (unobtainable) {
|
|
11620
11700
|
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
11701
|
}
|
|
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
11702
|
const calls = result.next.calls;
|
|
11627
11703
|
if (((_b = calls === null || calls === void 0 ? void 0 : calls[0]) === null || _b === void 0 ? void 0 : _b.tool) === EYES_REVIEW_TOOLS.diffReport) {
|
|
11628
11704
|
// Not a review tool, so it carries no rootScope/mode and is not built through `nextCall`.
|
|
11629
11705
|
const unreviewed = incompleteAreaRects(children, deps);
|
|
11630
11706
|
const evidence = evidenceRoundCall(sessionUrl, stepIndex, unreviewed);
|
|
11631
11707
|
const batched = evidence.args.areaRects;
|
|
11708
|
+
calls[0].args.reports = batched.map(areaRect => ({ areaRect }));
|
|
11632
11709
|
calls.unshift(evidence);
|
|
11633
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.`;
|
|
11711
|
+
if (!unobtainable) {
|
|
11712
|
+
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.`;
|
|
11713
|
+
}
|
|
11634
11714
|
if (unreviewed.length > batched.length) {
|
|
11635
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.`;
|
|
11636
11716
|
}
|
|
11637
|
-
result.next.instruction +=
|
|
11638
|
-
" 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.`;
|
|
11639
11718
|
// sameAs buys its way past the image gates with an examined dom diff, so a step with none can't use it.
|
|
11640
11719
|
if (!unobtainable) {
|
|
11641
11720
|
result.next.instruction +=
|
|
11642
|
-
" Shortcut: if
|
|
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.";
|
|
11643
11722
|
}
|
|
11644
11723
|
}
|
|
11724
|
+
else if (!unobtainable) {
|
|
11725
|
+
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.`;
|
|
11726
|
+
}
|
|
11645
11727
|
}
|
|
11646
11728
|
return result;
|
|
11647
11729
|
}
|
|
11648
|
-
/** The changed areas of a step still unreviewed. */
|
|
11649
|
-
function incompleteAreaRects(children, deps) {
|
|
11650
|
-
return children.filter(child => !isCompleted(child.scopeId, deps)).map(child => parseDiffChildKey(child.key));
|
|
11651
|
-
}
|
|
11652
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. */
|
|
11653
11731
|
function evidenceRoundCall(sessionUrl, stepIndex, unreviewed) {
|
|
11654
11732
|
return {
|
|
@@ -11659,18 +11737,14 @@ function evidenceRoundCall(sessionUrl, stepIndex, unreviewed) {
|
|
|
11659
11737
|
function hasEvidence(sessionUrl, stepIndex, areaRect, deps) {
|
|
11660
11738
|
return verifyInvocation(stepScopeId(sessionUrl, stepIndex), EYES_INSPECT_TOOLS.evidence, args => rectsIntersect(args.areaRect, areaRect), deps);
|
|
11661
11739
|
}
|
|
11662
|
-
/**
|
|
11663
|
-
|
|
11664
|
-
|
|
11665
|
-
const
|
|
11666
|
-
|
|
11667
|
-
if ((target === null || target === void 0 ? void 0 : target.tool) !== EYES_REVIEW_TOOLS.diffReport)
|
|
11668
|
-
return;
|
|
11669
|
-
if (hasEvidence(sessionUrl, stepIndex, target.args.areaRect, deps))
|
|
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)
|
|
11670
11745
|
return;
|
|
11671
|
-
|
|
11672
|
-
next.calls.
|
|
11673
|
-
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.`;
|
|
11674
11748
|
}
|
|
11675
11749
|
async function stepEnd(params) {
|
|
11676
11750
|
const { sessionUrl, stepIndex, findings, keys, rootScope, mode, restart, deps } = params;
|
|
@@ -11779,10 +11853,10 @@ async function stepEnd(params) {
|
|
|
11779
11853
|
return endResponse(result, mode, isRootScope);
|
|
11780
11854
|
}
|
|
11781
11855
|
async function diffReport(params) {
|
|
11782
|
-
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;
|
|
11783
11857
|
const scopeId = diffScopeId(sessionUrl, stepIndex, areaRect);
|
|
11784
11858
|
await maybeDiscard(restart, 'diff', { sessionUrl, stepIndex, areaRect }, deps);
|
|
11785
|
-
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);
|
|
11786
11860
|
if (mismatch)
|
|
11787
11861
|
return { next: mismatch };
|
|
11788
11862
|
await promoteIfNeeded({
|
|
@@ -11799,7 +11873,7 @@ async function diffReport(params) {
|
|
|
11799
11873
|
// via this diff's parent step/session/etc. — can tell this scope was cached under `inspect`;
|
|
11800
11874
|
// nothing else ever reads a diff's own mode as a "parent" the way every other level's children do.
|
|
11801
11875
|
recordScopeMode(scopeId, mode, deps);
|
|
11802
|
-
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));
|
|
11803
11877
|
const result = await runEnd({
|
|
11804
11878
|
// `diff` is a leaf with no completeness gate of its own (ownChildren is always empty,
|
|
11805
11879
|
// so runEnd's soft-redirect path — the only place progressCall would surface — never
|
|
@@ -11843,9 +11917,88 @@ async function diffReport(params) {
|
|
|
11843
11917
|
doneMessage: 'This changed area is recorded.',
|
|
11844
11918
|
deps,
|
|
11845
11919
|
});
|
|
11846
|
-
await prependEvidenceRound(result.next, { sessionUrl, stepIndex, keys, deps });
|
|
11847
11920
|
return { findings: result.findings, next: result.next };
|
|
11848
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
|
+
}
|
|
11849
12002
|
|
|
11850
12003
|
// The review tools — `eyes_review_progress`/`eyes_review_end`, each parametric over `scope`
|
|
11851
12004
|
// ∈ batch/scenario/session/step, plus `eyes_review_diff_report` for each of a step's changed areas
|
|
@@ -11907,11 +12060,23 @@ function findingsFor(shape, findings, scope) {
|
|
|
11907
12060
|
const parsed = shape.safeParse(findings);
|
|
11908
12061
|
if (!parsed.success) {
|
|
11909
12062
|
countGateRejection();
|
|
11910
|
-
const issues = parsed.error.issues
|
|
11911
|
-
.map(issue => `${issue.path.join('.') || 'findings'}: ${issue.message}`)
|
|
11912
|
-
.join('; ');
|
|
11913
12063
|
throw new Error(`findings must be the ${REQUIRED_FINDINGS[scope]} — see findings' own description for both shapes. ` +
|
|
11914
|
-
`What was submitted does not match it: ${
|
|
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)}.`);
|
|
11915
12080
|
}
|
|
11916
12081
|
return parsed.data;
|
|
11917
12082
|
}
|
|
@@ -12047,34 +12212,23 @@ function registerReviewTools(server, deps = defaultPhaseTrackerDeps) {
|
|
|
12047
12212
|
});
|
|
12048
12213
|
// --- Diff (leaf) -------------------------------------------------------------
|
|
12049
12214
|
server.registerTool(EYES_REVIEW_TOOLS.diffReport, {
|
|
12050
|
-
description: "Records the rich per-diff evidence for
|
|
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.",
|
|
12051
12216
|
inputSchema: {
|
|
12052
12217
|
sessionUrl: zod.z.string().describe(SESSION_URL_DESC),
|
|
12053
12218
|
stepIndex: zod.z.number().int().nonnegative().describe(STEP_INDEX_DESC),
|
|
12054
|
-
|
|
12055
|
-
findings: DiffReportFindingsShape,
|
|
12056
|
-
sameAs: SameAsShape.optional(),
|
|
12219
|
+
reports: zod.z.union([DiffReportsShape, JsonFileArgShape]),
|
|
12057
12220
|
rootScope: RootScopeShape,
|
|
12058
12221
|
mode: ModeShape,
|
|
12059
12222
|
restart: RestartShape,
|
|
12060
12223
|
},
|
|
12061
|
-
}, async ({ sessionUrl, stepIndex,
|
|
12224
|
+
}, async ({ sessionUrl, stepIndex, reports: rawReportsArg, rootScope: rawRootScope, mode: rawMode, restart }) => {
|
|
12062
12225
|
const rootScope = resolveRootScope('diff', rawRootScope);
|
|
12063
12226
|
const mode = resolveMode(rawMode);
|
|
12064
12227
|
recordReviewCall('diff', mode);
|
|
12065
12228
|
const keys = reviewApiKeyProvider(sessionUrl, mode);
|
|
12066
|
-
const
|
|
12067
|
-
|
|
12068
|
-
|
|
12069
|
-
areaRect,
|
|
12070
|
-
findings,
|
|
12071
|
-
sameAs,
|
|
12072
|
-
keys,
|
|
12073
|
-
rootScope,
|
|
12074
|
-
mode,
|
|
12075
|
-
restart,
|
|
12076
|
-
deps,
|
|
12077
|
-
});
|
|
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 });
|
|
12078
12232
|
return textResult(JSON.stringify(result, null, 2));
|
|
12079
12233
|
});
|
|
12080
12234
|
}
|