@applitools/mcp 0.8.0 → 0.8.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/dist/index.js CHANGED
@@ -54,11 +54,6 @@ const TOOL_NAMES = {
54
54
  EYES_FETCH_VISUAL_RESULTS: 'eyes_fetch_visual_results',
55
55
  EYES_ANALYZE_BATCH: 'eyes_analyze_batch',
56
56
  };
57
- /**
58
- * Design-partner guard on experimental mode (AD-15109): the name rotates with each release
59
- * (version segment + fresh token) and must never appear in public docs.
60
- */
61
- const EXPERIMENTAL_GUARD_ENV = 'BETA_v0_5_16_2832';
62
57
  const DEFAULT_SERVER_URL = 'https://eyes.applitools.com';
63
58
  const TRANSPORT_MODE = 'stdio';
64
59
  const RESOURCE_URIS = {
@@ -250,17 +245,14 @@ function setExperimental(enabled) {
250
245
  function isExperimental() {
251
246
  return experimental;
252
247
  }
253
- function envEnabled(value) {
254
- return ['1', 'true'].includes((value !== null && value !== void 0 ? value : '').toLowerCase());
255
- }
256
248
  /**
257
- * Evaluated once at process start; up = the server swaps the legacy results tools for the
258
- * eyes-inspect/eyes-resolve/eyes-review families — see `registerAllTools`. The design-partner
259
- * guard env (AD-15109) is the ONLY activator; the public opt-ins (`--experimental` argv,
260
- * `APPLITOOLS_MCP_EXPERIMENTAL`) were retired, hence no argv parameter.
249
+ * The swap is unconditional: the server always registers the eyes-inspect/eyes-resolve/eyes-review
250
+ * families in place of the legacy results tools — see `registerAllTools`. No env, argv or config
251
+ * turns it off; the retired `--experimental` argv and `APPLITOOLS_MCP_EXPERIMENTAL` stay ignored.
252
+ * Kept as a seam so the mode plumbing can be unwound in one pass rather than threaded through here.
261
253
  */
262
- function parseExperimental(env) {
263
- return envEnabled(env[EXPERIMENTAL_GUARD_ENV]);
254
+ function parseExperimental() {
255
+ return true;
264
256
  }
265
257
 
266
258
  /** Load credentials from server context, config files, or environment variables */
@@ -696,6 +688,11 @@ function rectContains(outer, inner) {
696
688
  function rectsIntersect(a, b) {
697
689
  return a.left < b.left + b.width && a.left + a.width > b.left && a.top < b.top + b.height && a.top + a.height > b.top;
698
690
  }
691
+ function intersectionArea(a, b) {
692
+ const w = Math.min(a.left + a.width, b.left + b.width) - Math.max(a.left, b.left);
693
+ const h = Math.min(a.top + a.height, b.top + b.height) - Math.max(a.top, b.top);
694
+ return w > 0 && h > 0 ? w * h : 0;
695
+ }
699
696
  function boundingRect(a, b) {
700
697
  const left = Math.min(a.left, b.left);
701
698
  const top = Math.min(a.top, b.top);
@@ -703,6 +700,41 @@ function boundingRect(a, b) {
703
700
  const bottom = Math.max(a.top + a.height, b.top + b.height);
704
701
  return { left, top, width: right - left, height: bottom - top };
705
702
  }
703
+ /** A region under this covers a diff artefact, not content, and as a search source it matches almost everywhere. */
704
+ const MIN_REGION_AREA_PX = 16;
705
+ function isTooSmallRegion(rect) {
706
+ return rect.width * rect.height < MIN_REGION_AREA_PX;
707
+ }
708
+ function sameRect(a, b) {
709
+ return a.left === b.left && a.top === b.top && a.width === b.width && a.height === b.height;
710
+ }
711
+ /** Intersection area as a fraction of the smaller rect's area — IoU would punish a thin rect for a few px of drift. */
712
+ function overlapCoverage(a, b) {
713
+ const smaller = Math.min(a.width * a.height, b.width * b.height);
714
+ // A rect with no area covers nothing, and would divide by zero.
715
+ if (smaller === 0)
716
+ return 0;
717
+ return intersectionArea(a, b) / smaller;
718
+ }
719
+ /** Below this, two rects merely graze each other at the edges and are treated as unrelated. */
720
+ const SIGNIFICANT_OVERLAP_MIN_FRACTION = 0.1;
721
+ /** Below this on either axis the two rects are different shapes, however much they overlap. */
722
+ const SIMILAR_SIZE_MIN_RATIO = 0.85;
723
+ const SIMILAR_COVERAGE_MIN_FRACTION = 0.7;
724
+ function isSignificantOverlap(a, b) {
725
+ return rectsIntersect(a, b) && overlapCoverage(a, b) > SIGNIFICANT_OVERLAP_MIN_FRACTION;
726
+ }
727
+ /**
728
+ * Similar size on both axes and mostly overlapping: one rect is the other after a drift of a few px.
729
+ * A rect that moved a whole row away shares no area with where it was, so it is not nearly the same.
730
+ */
731
+ function isNearlySameRect(a, b) {
732
+ if (!isSignificantOverlap(a, b))
733
+ return false;
734
+ const ratio = (x, y) => Math.min(x, y) / Math.max(x, y);
735
+ const sizeRatio = Math.min(ratio(a.width, b.width), ratio(a.height, b.height));
736
+ return sizeRatio >= SIMILAR_SIZE_MIN_RATIO && overlapCoverage(a, b) >= SIMILAR_COVERAGE_MIN_FRACTION;
737
+ }
706
738
 
707
739
  /** Shapes a raw batch entity's fields (see `BatchInfo` — fetched via `api`'s `fetchBatchInfo`) into `BatchStats`. */
708
740
  function toBatchStats(raw) {
@@ -1251,17 +1283,15 @@ function resolveNodeIdsToNodes(root, nodeIds) {
1251
1283
  return result;
1252
1284
  }
1253
1285
  /**
1254
- * Finds the element node in `root` whose rect most closely matches `targetRect` — within
1255
- * `tolerancePx` on all four of left/top/width/height — returning the same {domSelector,
1256
- * rect} shape as `findNodeById`. Lets a caller upgrade a raw pixel rect (e.g. one eyeballed off
1257
- * a screenshot) into a domSelector-backed region when a matching element actually exists,
1258
- * so the region tracks that element rather than a fixed set of pixels. Returns `null` if no
1259
- * node is within tolerance. When multiple nodes qualify (e.g. a wrapper and its one child
1260
- * share nearly the same rect), the one with the smallest total deviation wins.
1286
+ * The element `targetRect` denotes: a match within `tolerancePx` on every edge, else the element
1287
+ * whose box is nearly the same rect — a changed-area rect bounds the differing pixels, which rarely
1288
+ * lands within a few px of the element's own box. Within a tier the smallest total deviation wins.
1261
1289
  */
1262
1290
  function findNodeByRect(root, targetRect, tolerancePx = 5) {
1263
- let best = null;
1264
- let bestDelta = Infinity;
1291
+ let exact = null;
1292
+ let exactDelta = Infinity;
1293
+ let shifted = null;
1294
+ let shiftedDelta = Infinity;
1265
1295
  for (const { node } of flattenTree(root)) {
1266
1296
  const r = nodeRect(node);
1267
1297
  if (!r)
@@ -1270,15 +1300,20 @@ function findNodeByRect(root, targetRect, tolerancePx = 5) {
1270
1300
  const dTop = Math.abs(r.top - targetRect.top);
1271
1301
  const dWidth = Math.abs(r.width - targetRect.width);
1272
1302
  const dHeight = Math.abs(r.height - targetRect.height);
1273
- if (dLeft > tolerancePx || dTop > tolerancePx || dWidth > tolerancePx || dHeight > tolerancePx)
1274
- continue;
1275
1303
  const delta = dLeft + dTop + dWidth + dHeight;
1276
- if (delta < bestDelta) {
1277
- bestDelta = delta;
1278
- best = node;
1304
+ if (dLeft <= tolerancePx && dTop <= tolerancePx && dWidth <= tolerancePx && dHeight <= tolerancePx) {
1305
+ if (delta < exactDelta) {
1306
+ exactDelta = delta;
1307
+ exact = node;
1308
+ }
1309
+ }
1310
+ else if (isNearlySameRect(r, targetRect) && delta < shiftedDelta) {
1311
+ shiftedDelta = delta;
1312
+ shifted = node;
1279
1313
  }
1280
1314
  }
1281
- return best ? findNodeById(root, best.id) : null;
1315
+ const found = exact ?? shifted;
1316
+ return found ? findNodeById(root, found.id) : null;
1282
1317
  }
1283
1318
  // ---------------------------------------------------------------------------
1284
1319
  // Reading-order sort
@@ -2764,7 +2799,9 @@ function pickCategories(bucket) {
2764
2799
  * `appOutputResolution[stepIndex].annotations` if a resolution exists, else
2765
2800
  * `expectedAppOutput[stepIndex].annotations` (the baseline's own regions) — since
2766
2801
  * `imageMatchSettings`'s own arrays only reflect what was true when the test last ran, not any
2767
- * region a reviewer added since.
2802
+ * region a reviewer added since. The coded regions among them (`regionId`) stay in those arrays
2803
+ * ahead of the annotations: the compare endpoint applies the arrays and not `identifiedRegions`,
2804
+ * so leaving them out reports diffs inside regions the real match never checks.
2768
2805
  *
2769
2806
  * No baseline/checkpoint side-picking or healing happens here: the raw session already resolves
2770
2807
  * which side a region describes (see `regions.ts`'s `getEffectiveRegions`, used instead for a
@@ -2774,12 +2811,33 @@ function pickCategories(bucket) {
2774
2811
  function getEffectiveMatchSettings(rawSession, stepIndex) {
2775
2812
  const imageMatchSettings = rawSession?.actualAppOutput?.[stepIndex]?.imageMatchSettings ?? {};
2776
2813
  const annotations = rawSession?.appOutputResolution?.[stepIndex]?.annotations ?? rawSession?.expectedAppOutput?.[stepIndex]?.annotations;
2777
- return {
2778
- ...imageMatchSettings,
2779
- ...pickCategories(annotations),
2780
- identifiedRegions: pickCategories(imageMatchSettings),
2781
- };
2814
+ const coded = pickCategories(imageMatchSettings);
2815
+ const annotated = pickCategories(annotations);
2816
+ const regions = {};
2817
+ for (const category of MATCH_SETTINGS_CATEGORIES) {
2818
+ regions[category] = [...coded[category].filter(isCodedRegion), ...annotated[category]];
2819
+ }
2820
+ return { ...imageMatchSettings, ...regions, identifiedRegions: coded };
2782
2821
  }
2822
+ function isCodedRegion(region) {
2823
+ return typeof region.regionId === 'string' && region.regionId !== '';
2824
+ }
2825
+ /**
2826
+ * The five match levels a match region can name — a subset of `MATCH_SETTINGS_CATEGORIES`, ordered
2827
+ * as the `regionOp` wire syntax and the MCP tool schemas list them.
2828
+ */
2829
+ const REGION_TYPES = ['ignore', 'strict', 'ignorecolors', 'dynamic', 'layout'];
2830
+ /**
2831
+ * Higher masks less: `strict` checks almost everything, `ignore` checks nothing. Read to refuse a
2832
+ * replacement that would leave a region weaker than it was.
2833
+ */
2834
+ const REGION_TYPE_STRENGTH = {
2835
+ ignore: 0,
2836
+ layout: 1,
2837
+ dynamic: 2,
2838
+ ignorecolors: 3,
2839
+ strict: 4,
2840
+ };
2783
2841
 
2784
2842
  const ANNOTATION_CATEGORIES = [
2785
2843
  'content',
@@ -4438,7 +4496,7 @@ function gateRejectionCount() {
4438
4496
 
4439
4497
  var name = "@applitools/mcp";
4440
4498
  var mcpName = "io.github.applitools/applitools";
4441
- var version = "0.8.0";
4499
+ var version = "0.8.2";
4442
4500
  var description = "Applitools MCP server for AI coding assistants";
4443
4501
  var main = "./dist/index.js";
4444
4502
  var bin = "./dist/index.js";
@@ -4452,6 +4510,7 @@ var scripts = {
4452
4510
  test: "yarn test:mocha && yarn test:tools",
4453
4511
  "test:mocha": "mocha test/**/*.spec.ts --parallel",
4454
4512
  "test:tools": "vitest run",
4513
+ "test:smoke": "node test/smoke/server-boot.mjs",
4455
4514
  "test:watch": "mocha test/**/*.spec.ts --watch",
4456
4515
  lint: "eslint 'src/**/*.ts'",
4457
4516
  "lint:fix": "eslint 'src/**/*.ts' --fix"
@@ -4503,9 +4562,7 @@ var dependencies = {
4503
4562
  "@applitools/req": "workspace:*",
4504
4563
  "@applitools/utils": "workspace:*",
4505
4564
  "@modelcontextprotocol/sdk": "^1.0.0",
4506
- cors: "^2.8.5",
4507
4565
  dotenv: "^16.3.1",
4508
- express: "^5.2.1",
4509
4566
  zod: "^4.0.0"
4510
4567
  };
4511
4568
  var devDependencies = {
@@ -4514,8 +4571,6 @@ var devDependencies = {
4514
4571
  "@rollup/plugin-json": "^6.1.0",
4515
4572
  "@rollup/plugin-node-resolve": "^15.2.3",
4516
4573
  "@rollup/plugin-typescript": "^11.1.6",
4517
- "@types/cors": "^2.8.19",
4518
- "@types/express": "^5.0.6",
4519
4574
  "@types/mocha": "^10.0.6",
4520
4575
  "@types/node": "^20.10.0",
4521
4576
  "@typescript-eslint/eslint-plugin": "^8.51.0",
@@ -4531,7 +4586,7 @@ var devDependencies = {
4531
4586
  "rollup-plugin-copy": "^3.5.0",
4532
4587
  "rollup-plugin-node-externals": "^8.1.2",
4533
4588
  typescript: "~5.9.3",
4534
- vitest: "^4.1.9"
4589
+ vitest: "^3.2.4"
4535
4590
  };
4536
4591
  var publishConfig = {
4537
4592
  access: "public"
@@ -4542,7 +4597,8 @@ var lavamoat = {
4542
4597
  "@applitools/image>sharp": false,
4543
4598
  "vitest>vite>esbuild": false,
4544
4599
  "vitest>jsdom>ws>bufferutil": false,
4545
- "vitest>jsdom>ws>utf-8-validate": false
4600
+ "vitest>jsdom>ws>utf-8-validate": false,
4601
+ "vitest>vite-node>vite>esbuild": false
4546
4602
  }
4547
4603
  };
4548
4604
  var packageJson = {
@@ -8323,7 +8379,6 @@ function registerEyesInspectResources(server) {
8323
8379
  }));
8324
8380
  }
8325
8381
 
8326
- const SUPPORTED_REGION_TYPES = ['ignore', 'strict', 'ignorecolors', 'dynamic', 'layout'];
8327
8382
  /** A clear op — `-*` (every category) or `-<category>-*`/`-<category>*` (one category) — drops every matching existing region instead of resolving a single id/rect target. */
8328
8383
  function isClearOp(op) {
8329
8384
  return op.targetRaw === '*';
@@ -8349,8 +8404,8 @@ function parseRegionOp(arg) {
8349
8404
  return { action: 'remove', regionType: 'all', targetRaw: '*' };
8350
8405
  }
8351
8406
  const regionType = rest.replace(/-?\*$/, '');
8352
- if (!SUPPORTED_REGION_TYPES.includes(regionType)) {
8353
- throw new Error(`Unknown match level "${regionType}" in regionOp "${arg}". Supported: ${SUPPORTED_REGION_TYPES.join(', ')}`);
8407
+ if (!REGION_TYPES.includes(regionType)) {
8408
+ throw new Error(`Unknown match level "${regionType}" in regionOp "${arg}". Supported: ${REGION_TYPES.join(', ')}`);
8354
8409
  }
8355
8410
  return { action: 'remove', regionType: regionType, targetRaw: '*' };
8356
8411
  }
@@ -8363,8 +8418,11 @@ function parseRegionOp(arg) {
8363
8418
  if (!targetRaw) {
8364
8419
  throw new Error(`regionOp is missing a target: "${arg}"`);
8365
8420
  }
8366
- if (!SUPPORTED_REGION_TYPES.includes(regionType)) {
8367
- throw new Error(`Unknown match level "${regionType}" in regionOp "${arg}". Supported: ${SUPPORTED_REGION_TYPES.join(', ')}`);
8421
+ if (!REGION_TYPES.includes(regionType)) {
8422
+ throw new Error(`Unknown match level "${regionType}" in regionOp "${arg}". Supported: ${REGION_TYPES.join(', ')}`);
8423
+ }
8424
+ if (sign === '+' && regionType === 'dynamic') {
8425
+ throw new Error(`regionOp "${arg}" adds a dynamic region, but dynamic is Eyes' default match level and masks nothing on its own. Add a layout region instead.`);
8368
8426
  }
8369
8427
  return { action: sign === '+' ? 'add' : 'remove', regionType: regionType, targetRaw };
8370
8428
  }
@@ -8776,8 +8834,8 @@ async function updateRegions(url, stepIndex, action, rawRegionOps, keys, propaga
8776
8834
  ];
8777
8835
  if (propagate) {
8778
8836
  // Every add/remove op is propagate-eligible, plus every synthetic remove op a clear op
8779
- // expanded into above.
8780
- const propagatableOps = [...regionOps.filter(op => !isClearOp(op)), ...clearSynthesizedOps];
8837
+ // expanded into above — except a speck, which images/find matches almost everywhere.
8838
+ const propagatableOps = [...regionOps.filter(op => !isClearOp(op)), ...clearSynthesizedOps].filter(op => !isTooSmallRegion(resolvedOnRefBeforeConversion.get(op.targetRaw)));
8781
8839
  if (propagatableOps.length > 0) {
8782
8840
  const sourceImage = imageForSide(rawSession, stepIndex, refSide);
8783
8841
  const candidateSteps = await findPropagationCandidateSteps(rawSession, stepIndex, sessionId, baseUrl, batchId, accountId, keys, propagate, false, deps);
@@ -9031,9 +9089,9 @@ const PROPAGATE_DESC = 'Which other steps also get this exact change, applied to
9031
9089
  'session\'s scenario name, e.g. "Login|Checkout" — sessions matching are included in the candidate pool on top ' +
9032
9090
  'of the same-scenario default.';
9033
9091
  const REGION_OP_DESC = 'A compact match-region change: (+|-)<matchLevel>-(<rect>|<id>). matchLevel, strictest to loosest: strict (near pixel-perfect), ignorecolors ' +
9034
- "(color-only drift tolerated), dynamic (Eyes' own dynamic-content matching), layout (content may change but structure must still hold — a " +
9092
+ '(color-only drift tolerated), layout (content may change but structure must still hold — a ' +
9035
9093
  'vanished/overlapping/resized element is still flagged), ignore (nothing in the region is ever checked). Always pick the strictest level ' +
9036
- 'that still accommodates the diff: prefer dynamic over layout over ignore. Target is a raw rect "left,top,width,height" or a bare DOM node ' +
9094
+ 'that still accommodates the diff: prefer layout over ignore. A dynamic add is refused — dynamic is the default match level — so add layout instead. Target is a raw rect "left,top,width,height" or a bare DOM node ' +
9037
9095
  'id from eyes_inspect_dom/eyes_inspect_dom_diff. A removal target may also be a glob: "-*" removes every region, "-<matchLevel>-*" removes ' +
9038
9096
  'every region of that one category. Examples: "+layout-14", "-ignore-100,200,50,80", "-layout-*".';
9039
9097
  function registerEyesResolveTools(server, deps = defaultCommandsDeps) {
@@ -9733,17 +9791,25 @@ const IS_EXPECTED_DESC = 'Non-null means this diff is a real, permanent, intenti
9733
9791
  'the field for a one-off change someone made on purpose; if instead the content itself is expected to vary or recur on every run (a rotating ' +
9734
9792
  "banner, a timestamp), that's `dynamic`'s job instead, not this one — a finding is either a permanent change (this field) or recurring/" +
9735
9793
  'varying content (`dynamic`), never justified as both from the same evidence.';
9736
- const MATCH_LEVEL_DESC = 'Strictest to loosest: "strict" (near pixel-perfect — tightens, not a masking choice), "ignorecolors" (color-only drift tolerated, ' +
9737
- 'structure and text still checked), "dynamic" (Eyes\' own dynamic-content matching), "layout" (content may change but structure must still ' +
9738
- 'hold — a vanished/overlapping/resized element is still flagged), "ignore" (nothing in the region is ever checked, content or structure). ' +
9739
- 'Always pick the strictest level that still accommodates the diff: prefer dynamic over layout over ignore.';
9740
- /** The five match levels a `regionOp` can express — the same set `eyes-resolve/region-op.ts`'s `RegionType` names. */
9741
- const RegionTypeShape = zod.z.enum(['ignore', 'strict', 'ignorecolors', 'dynamic', 'layout']).describe(MATCH_LEVEL_DESC);
9742
- /** One region: where it is (a DOM node id or a checkpoint-image rect) and which match level it applies. */
9794
+ /** The two levels a mask can be added at, strictest first. */
9795
+ const MASK_LEVELS = ['layout', 'ignore'];
9796
+ /** Also appended to the step's `next.instruction` in resolve mode, so it reaches the model as a result and not only as schema text. */
9797
+ const MASK_LEVEL_RULE = 'If the dynamic area follows a clear consistent symmetry such that text segments are replaced with (possibly longer or shorter) text of ' +
9798
+ 'similar font and font size, and images are replaced with other images of similar size but overall all elements retain their relative ' +
9799
+ 'alignment and margins, you should mask the dynamic area with a Layout region. In all other cases use an Ignore region. Do not use any ' +
9800
+ 'other match level for masking.';
9801
+ /** Every level an existing region can carry — `before` names one of those, dynamic included. */
9802
+ const ExistingRegionTypeShape = zod.z.enum(REGION_TYPES).describe('The match level the existing region currently has');
9803
+ const RegionTypeShape = zod.z.enum(MASK_LEVELS).describe(MASK_LEVEL_RULE);
9804
+ const AREA_DESC = 'A DOM node id (string) from eyes_inspect_dom/eyes_inspect_dom_diff, or a checkpoint-image rect';
9805
+ /** An existing region: where it is and the level it currently has. */
9806
+ const ExistingRegionSpecShape = zod.z.object({
9807
+ area: zod.z.union([zod.z.string(), AreaRectShape]).describe(AREA_DESC),
9808
+ matchLevel: ExistingRegionTypeShape,
9809
+ });
9810
+ /** A region to add: where it is and which level it applies. */
9743
9811
  const RegionSpecShape = zod.z.object({
9744
- area: zod.z
9745
- .union([zod.z.string(), AreaRectShape])
9746
- .describe('A DOM node id (string) from eyes_inspect_dom/eyes_inspect_dom_diff, or a checkpoint-image rect'),
9812
+ area: zod.z.union([zod.z.string(), AreaRectShape]).describe(AREA_DESC),
9747
9813
  matchLevel: RegionTypeShape,
9748
9814
  });
9749
9815
  /**
@@ -9754,7 +9820,7 @@ const RegionSpecShape = zod.z.object({
9754
9820
  * opposite of this field's purpose.
9755
9821
  */
9756
9822
  zod.z.object({
9757
- before: RegionSpecShape.nullable().describe('The stale region being replaced, if one existed — null for a from-scratch mask over content that was never masked at all'),
9823
+ before: ExistingRegionSpecShape.nullable().describe('The stale region being replaced, if one existed — null for a from-scratch mask over content that was never masked at all'),
9758
9824
  after: RegionSpecShape.describe('The corrected/fresh region that should mask this content — always required'),
9759
9825
  description: zod.z.string().describe('Human-readable description of the proposed change'),
9760
9826
  });
@@ -9764,7 +9830,7 @@ zod.z.object({
9764
9830
  * supply the one judgment call this schema can't make for it: `after.matchLevel`.
9765
9831
  */
9766
9832
  const MaskProposalShape = zod.z.object({
9767
- before: RegionSpecShape.nullable().describe('The stale region being replaced, if one existed — null for a from-scratch mask over content that was never masked at all'),
9833
+ before: ExistingRegionSpecShape.nullable().describe('The stale region being replaced, if one existed — null for a from-scratch mask over content that was never masked at all'),
9768
9834
  after: zod.z
9769
9835
  .object({
9770
9836
  area: zod.z
@@ -9785,8 +9851,8 @@ const DYNAMIC_JUSTIFICATION_DESC = 'How it was established that this diff is dyn
9785
9851
  "finding's node.";
9786
9852
  const DYNAMIC_EVIDENCE_DESC = "The concrete evidence for `justification` — the actual pattern observed, what the history call showed, the user's own words, or the code path.";
9787
9853
  const DYNAMIC_MASK_DESC = 'The region to add or change to mask this diff — required whenever `dynamic` is non-null, so a masking decision always names an actual fix, ' +
9788
- 'not just a category. `matchLevel` is always required — see its own description for what each level tolerates and prefer the strictest one ' +
9789
- "that still accommodates the diff. `area` may be null or omitted, in which case the tool uses this finding's own `area`. `before` is null " +
9854
+ 'not just a category. `matchLevel` is always required, `layout` or `ignore` — see its own description for which. ' +
9855
+ "`area` may be null or omitted, in which case the tool uses this finding's own `area`. `before` is null " +
9790
9856
  'for a from-scratch mask; naming a stale region being replaced — one that stopped tracking its element as the page drifted — requires ' +
9791
9857
  'calling eyes_inspect_regions for this step first to identify it.';
9792
9858
  const DYNAMIC_DESC = 'Non-null means this diff is dynamic/recurring content — expected to vary or reappear differently on every run — rather than a one-off ' +
@@ -10019,12 +10085,11 @@ function buildDiffUrl(parts) {
10019
10085
  */
10020
10086
  const MAX_REGION_AREA_FRACTION = 0.5;
10021
10087
  /**
10022
- * The step's current regions, as the guard rails see them: the checkpoint side's rect (the side
10023
- * `DiffFindingShape.area` is always expressed in), and the `matchLevel` a regionOp would name.
10024
- * A region in a category no regionOp can express (`floating`/`accessibility`/…) is left out — the
10025
- * guard rails only reason about regions this flow could actually add or remove, which is also why
10026
- * only `fetchRegions`' `regions` are considered and never its `codedRegions`: those come from the
10027
- * test code itself and no region op can touch them.
10088
+ * Regions as the guard rails see them: the checkpoint side's rect (the side `DiffFindingShape.area`
10089
+ * is always expressed in), and the `matchLevel` a regionOp would name. A region in a category no
10090
+ * regionOp can express (`floating`/`accessibility`/…) is left out. Applied to `fetchRegions`'
10091
+ * `regions` for what this flow may remove or replace, and to its `codedRegions` for what it must
10092
+ * only avoid — those come from the test code and no region op can touch them.
10028
10093
  */
10029
10094
  function toExistingRegionEntries(regions) {
10030
10095
  var _a;
@@ -10056,9 +10121,6 @@ function proposedRegionChange(finding) {
10056
10121
  description: mask.description,
10057
10122
  };
10058
10123
  }
10059
- function sameRect(a, b) {
10060
- return a.left === b.left && a.top === b.top && a.width === b.width && a.height === b.height;
10061
- }
10062
10124
  /**
10063
10125
  * Whether a proposal's resolved `after` already exists, verbatim (same rect, same `matchLevel`),
10064
10126
  * among the step's current regions — e.g. because propagation from a sibling step (or an earlier
@@ -10070,42 +10132,121 @@ function sameRect(a, b) {
10070
10132
  function regionAlreadyInEffect(existing, rect, matchLevel) {
10071
10133
  return rect !== null && existing.some(e => e.matchLevel === matchLevel && sameRect(e.rect, rect));
10072
10134
  }
10135
+ function matchExistingRegion(existing, rect, matchLevel) {
10136
+ var _a;
10137
+ const exact = existing.find(entry => entry.matchLevel === matchLevel && sameRect(entry.rect, rect));
10138
+ if (exact)
10139
+ return exact;
10140
+ const shifted = existing.filter(entry => entry.matchLevel === matchLevel && isNearlySameRect(entry.rect, rect));
10141
+ if (shifted.length > 1)
10142
+ return 'ambiguous';
10143
+ return (_a = shifted[0]) !== null && _a !== void 0 ? _a : null;
10144
+ }
10073
10145
  /**
10074
- * §4 step 2's two guard rails, checked before anything is sent:
10146
+ * §4 step 2's guard rails, checked before anything is sent:
10075
10147
  *
10076
10148
  * - **No nesting, regardless of matchLevel.** A proposal falling entirely inside an existing
10077
10149
  * region is already covered, so it's refused. A proposal entirely containing existing ones is
10078
10150
  * fine — those get removed first, and come back as `contained`.
10151
+ * - **No touching a coded region.** `coded` regions come from the test code, so a proposal inside
10152
+ * one is refused as covered and one overlapping it is refused outright — it can be neither
10153
+ * replaced nor removed here.
10079
10154
  * - **No oversized regions.** A proposal covering more than `MAX_REGION_AREA_FRACTION` of the
10080
10155
  * checkpoint image is refused.
10156
+ * - **No specks.** A proposal under `MIN_REGION_AREA_PX` is refused: it masks a diff artefact, not
10157
+ * content, and propagation would find it everywhere.
10158
+ * - **No stacking on top of a region it partly covers.** A proposal that is nearly the same rect as
10159
+ * an existing region replaces it (`superseded`); one that straddles a different region, or is
10160
+ * equally close to two of them, is refused. A replacement may never weaken the match level.
10081
10161
  *
10082
10162
  * `proposedRect` is `null` when the proposal's `area` is a node id whose geometry couldn't be
10083
- * resolved; both rails are geometric, so there's nothing to check and the proposal passes.
10084
- * `excludeRect` is the proposal's own `before` region, which must not count as either a
10085
- * containing neighbour or a nested one — it's the thing being replaced.
10163
+ * resolved; every rail then has nothing to check and the proposal passes.
10164
+ * `excludeRect` is the proposal's own `before` region, which must not count as a containing
10165
+ * neighbour, a nested one, or an overlap — it's the thing being replaced.
10086
10166
  */
10087
10167
  function checkGuardRails(params) {
10088
- const { proposedRect, existing, imageSize, excludeRect, matchLevel } = params;
10168
+ var _a;
10169
+ const { proposedRect, existing, coded = [], imageSize, excludeRect, matchLevel } = params;
10089
10170
  if (!proposedRect)
10090
- return { ok: true, contained: [] };
10171
+ return { ok: true, contained: [], superseded: null };
10172
+ if (isTooSmallRegion(proposedRect)) {
10173
+ return {
10174
+ ok: false,
10175
+ kind: 'too-small',
10176
+ reason: `the proposed ${matchLevel} region ${formatRect(proposedRect)} is ${proposedRect.width}x${proposedRect.height}px, under the ${MIN_REGION_AREA_PX}px² floor — a mask this small covers a diff artefact, not content`,
10177
+ };
10178
+ }
10091
10179
  const relevant = existing.filter(e => !excludeRect || !sameRect(e.rect, excludeRect));
10092
10180
  const container = relevant.find(e => rectContains(e.rect, proposedRect));
10093
10181
  if (container) {
10094
10182
  return {
10095
10183
  ok: false,
10184
+ kind: 'nested',
10096
10185
  reason: `the proposed ${matchLevel} region ${formatRect(proposedRect)} falls entirely inside an existing ${container.matchLevel} region ${formatRect(container.rect)}, so the area is already covered`,
10097
10186
  };
10098
10187
  }
10188
+ const codedContainer = coded.find(e => rectContains(e.rect, proposedRect));
10189
+ if (codedContainer) {
10190
+ return {
10191
+ ok: false,
10192
+ kind: 'nested',
10193
+ reason: `the proposed ${matchLevel} region ${formatRect(proposedRect)} falls entirely inside an existing ${codedContainer.matchLevel} region ${formatRect(codedContainer.rect)} from the test code, so the area is already covered`,
10194
+ };
10195
+ }
10196
+ const codedOverlap = coded.find(e => isSignificantOverlap(e.rect, proposedRect));
10197
+ if (codedOverlap) {
10198
+ const percent = Math.round(overlapCoverage(codedOverlap.rect, proposedRect) * 100);
10199
+ return {
10200
+ ok: false,
10201
+ kind: 'overlaps',
10202
+ reason: `the proposed ${matchLevel} region ${formatRect(proposedRect)} overlaps an existing ${codedOverlap.matchLevel} region ${formatRect(codedOverlap.rect)} from the test code by ${percent}% of the smaller region, ` +
10203
+ 'and a region from the test code can be neither replaced nor removed here',
10204
+ };
10205
+ }
10099
10206
  if (imageSize && imageSize.width > 0 && imageSize.height > 0) {
10100
10207
  const fraction = (proposedRect.width * proposedRect.height) / (imageSize.width * imageSize.height);
10101
10208
  if (fraction > MAX_REGION_AREA_FRACTION) {
10102
10209
  return {
10103
10210
  ok: false,
10211
+ kind: 'oversized',
10104
10212
  reason: `the proposed ${matchLevel} region ${formatRect(proposedRect)} covers ${Math.round(fraction * 100)}% of the checkpoint image, which would nullify the purpose of the check`,
10105
10213
  };
10106
10214
  }
10107
10215
  }
10108
- return { ok: true, contained: relevant.filter(e => rectContains(proposedRect, e.rect)) };
10216
+ const contained = relevant.filter(e => rectContains(proposedRect, e.rect));
10217
+ const neighbours = relevant.filter(e => !contained.includes(e));
10218
+ const shifted = neighbours.filter(e => isNearlySameRect(e.rect, proposedRect));
10219
+ const straddled = neighbours.find(e => !shifted.includes(e) && isSignificantOverlap(e.rect, proposedRect));
10220
+ if (straddled) {
10221
+ const percent = Math.round(overlapCoverage(straddled.rect, proposedRect) * 100);
10222
+ return {
10223
+ ok: false,
10224
+ kind: 'overlaps',
10225
+ reason: `the proposed ${matchLevel} region ${formatRect(proposedRect)} overlaps an existing ${straddled.matchLevel} region ${formatRect(straddled.rect)} by ${percent}% of the smaller region ` +
10226
+ 'without being nearly the same rect (their sizes or positions differ too much)',
10227
+ };
10228
+ }
10229
+ if (shifted.length > 1) {
10230
+ const named = shifted.map(e => `${e.matchLevel} ${formatRect(e.rect)}`).join(' and ');
10231
+ return {
10232
+ ok: false,
10233
+ kind: 'ambiguous-overlap',
10234
+ reason: `the proposed ${matchLevel} region ${formatRect(proposedRect)} overlaps ${shifted.length} existing regions closely enough that which one it replaces is ambiguous (${named})`,
10235
+ };
10236
+ }
10237
+ const superseded = (_a = shifted[0]) !== null && _a !== void 0 ? _a : null;
10238
+ // A dynamic region only restates Eyes' default match level, so superseding it weakens nothing.
10239
+ if (superseded &&
10240
+ superseded.matchLevel !== 'dynamic' &&
10241
+ REGION_TYPE_STRENGTH[matchLevel] < REGION_TYPE_STRENGTH[superseded.matchLevel]) {
10242
+ return {
10243
+ ok: false,
10244
+ kind: 'overlaps',
10245
+ reason: `the proposed ${matchLevel} region ${formatRect(proposedRect)} is nearly the same rect as an existing ${superseded.matchLevel} region ${formatRect(superseded.rect)}, ` +
10246
+ `but replacing a ${superseded.matchLevel} region with a ${matchLevel} region would remove protection this flow cannot restore`,
10247
+ };
10248
+ }
10249
+ return { ok: true, contained, superseded };
10109
10250
  }
10110
10251
  function regionOpTarget(area) {
10111
10252
  return typeof area === 'string' ? area : formatRect(area);
@@ -10119,19 +10260,34 @@ function removeOp(matchLevel, target) {
10119
10260
  /**
10120
10261
  * §4 step 3's plan: every region already contained by the proposal is removed first, then the
10121
10262
  * proposal itself is applied — as a plain add when nothing preceded it, or as a remove-then-add
10122
- * pair when it replaces a stale region. The pair counts as one `(before, after)` transition rather
10263
+ * pair when it replaces a stale region, whether the model named that region as its `before` or the
10264
+ * guard rails found it (`superseded`). The pair counts as one `(before, after)` transition rather
10123
10265
  * than two independent ops, since that's what actually happened to the region.
10124
10266
  */
10125
- function planRegionActions(change, contained) {
10267
+ function planRegionActions(change, contained, superseded = null) {
10126
10268
  const plans = [];
10127
10269
  for (const entry of contained) {
10128
10270
  const op = removeOp(entry.matchLevel, formatRect(entry.rect));
10129
10271
  plans.push({ ops: [op], countOp: op, before: entry.matchLevel, after: null });
10130
10272
  }
10131
10273
  const add = addOp(change.after);
10274
+ const removeSuperseded = superseded ? [removeOp(superseded.matchLevel, formatRect(superseded.rect))] : [];
10132
10275
  if (change.before) {
10133
10276
  const remove = removeOp(change.before.matchLevel, regionOpTarget(change.before.area));
10134
- plans.push({ ops: [remove, add], countOp: add, before: change.before.matchLevel, after: change.after.matchLevel });
10277
+ plans.push({
10278
+ ops: [...removeSuperseded, remove, add],
10279
+ countOp: add,
10280
+ before: change.before.matchLevel,
10281
+ after: change.after.matchLevel,
10282
+ });
10283
+ }
10284
+ else if (superseded) {
10285
+ plans.push({
10286
+ ops: [...removeSuperseded, add],
10287
+ countOp: add,
10288
+ before: superseded.matchLevel,
10289
+ after: change.after.matchLevel,
10290
+ });
10135
10291
  }
10136
10292
  else {
10137
10293
  plans.push({ ops: [add], countOp: add, before: null, after: change.after.matchLevel });
@@ -10165,25 +10321,48 @@ function countAppliedRegions(plans, results) {
10165
10321
  function describeRegionOutcome(regions, failureReasons) {
10166
10322
  const sentences = [];
10167
10323
  const added = regions.filter(r => r.before === null && r.after !== null);
10168
- const adjusted = regions.filter(r => r.before !== null);
10324
+ const moved = regions.filter(r => r.before !== null && r.before === r.after);
10325
+ const adjusted = regions.filter(r => r.before !== null && r.before !== r.after);
10169
10326
  const plural = (count, noun) => `${count} ${noun}${count === 1 ? '' : 's'}`;
10170
10327
  const addedText = added.map(r => plural(r.count, `${r.after} region`)).join(', ');
10328
+ const movedText = moved.map(r => plural(r.count, `${r.after} region`)).join(', ');
10171
10329
  const adjustedText = adjusted
10172
10330
  .map(r => r.after === null
10173
10331
  ? plural(r.count, `nested ${r.before} region`) + ' away'
10174
10332
  : plural(r.count, 'region') + ` from ${r.before} to ${r.after}`)
10175
10333
  .join(', ');
10176
- if (addedText && adjustedText)
10177
- sentences.push(`Added ${addedText} and adjusted ${adjustedText} to mask this diff.`);
10178
- else if (addedText)
10179
- sentences.push(`Added ${addedText} to mask this diff.`);
10180
- else if (adjustedText)
10181
- sentences.push(`Adjusted ${adjustedText} to mask this diff.`);
10334
+ const clauses = [
10335
+ addedText && `added ${addedText}`,
10336
+ adjustedText && `adjusted ${adjustedText}`,
10337
+ movedText && `moved ${movedText}`,
10338
+ ].filter((clause) => clause !== '');
10339
+ if (clauses.length > 0) {
10340
+ const joined = clauses.length > 1 ? `${clauses.slice(0, -1).join(', ')} and ${clauses[clauses.length - 1]}` : clauses[0];
10341
+ sentences.push(`${joined[0].toUpperCase()}${joined.slice(1)} to mask this diff.`);
10342
+ }
10182
10343
  for (const reason of failureReasons) {
10183
10344
  sentences.push(`The diff could not be masked because ${reason}.`);
10184
10345
  }
10185
10346
  return sentences.join(' ');
10186
10347
  }
10348
+ function resolveStaleRegion(existing, proposal, rectOf) {
10349
+ if (!proposal.before)
10350
+ return null;
10351
+ const rect = rectOf(proposal.before.area);
10352
+ if (!rect)
10353
+ return null;
10354
+ const resolved = matchExistingRegion(existing, rect, proposal.before.matchLevel);
10355
+ return resolved === 'ambiguous' ? null : resolved;
10356
+ }
10357
+ function foldAppliedProposal(existing, removed, added) {
10358
+ for (const gone of removed) {
10359
+ const at = gone ? existing.indexOf(gone) : -1;
10360
+ if (at !== -1)
10361
+ existing.splice(at, 1);
10362
+ }
10363
+ if (added)
10364
+ existing.push(added);
10365
+ }
10187
10366
  /**
10188
10367
  * Runs §4 over every finding of one `diff_report` call, in order, and returns the findings with
10189
10368
  * their `regions` filled in and their `description` extended. Region changes are applied against
@@ -10202,17 +10381,18 @@ function describeRegionOutcome(regions, failureReasons) {
10202
10381
  * `mode: 'resolve'` — never read back by this flow, and never part of what the model sees.
10203
10382
  */
10204
10383
  async function applyRegionMasking(params) {
10205
- var _a, _b, _c;
10384
+ var _a, _b, _c, _d;
10206
10385
  const { sessionUrl, stepIndex, findings, keys, deps = defaultPhaseTrackerDeps } = params;
10207
10386
  const proposals = findings.map(proposedRegionChange);
10208
10387
  if (proposals.every(p => p === null)) {
10209
10388
  return findings.map(finding => ({ ...finding, regions: [] }));
10210
10389
  }
10211
- const [{ regions: rawRegions }, session] = await Promise.all([
10390
+ const [{ regions: rawRegions, codedRegions: rawCoded }, session] = await Promise.all([
10212
10391
  fetchRegions(sessionUrl, stepIndex, keys),
10213
10392
  fetchSteps(sessionUrl, keys),
10214
10393
  ]);
10215
10394
  const existing = toExistingRegionEntries(rawRegions);
10395
+ const coded = toExistingRegionEntries(rawCoded);
10216
10396
  const imageSize = (_c = (_b = (_a = session.steps) === null || _a === void 0 ? void 0 : _a[stepIndex]) === null || _b === void 0 ? void 0 : _b.checkpoint.size) !== null && _c !== void 0 ? _c : null;
10217
10397
  // Every node id any proposal names, resolved to its checkpoint-side geometry in one pass — the
10218
10398
  // guard rails are geometric, and a proposal is free to name an element rather than a rect.
@@ -10239,11 +10419,16 @@ async function applyRegionMasking(params) {
10239
10419
  reported.push({ ...finding, regions: [] });
10240
10420
  continue;
10241
10421
  }
10422
+ const stale = resolveStaleRegion(existing, proposal, rectOf);
10423
+ const change = stale
10424
+ ? { ...proposal, before: { area: stale.rect, matchLevel: stale.matchLevel } }
10425
+ : { ...proposal, before: null };
10242
10426
  const guard = checkGuardRails({
10243
10427
  proposedRect,
10244
10428
  existing,
10429
+ coded,
10245
10430
  imageSize,
10246
- excludeRect: proposal.before ? rectOf(proposal.before.area) : null,
10431
+ excludeRect: (_d = stale === null || stale === void 0 ? void 0 : stale.rect) !== null && _d !== void 0 ? _d : null,
10247
10432
  matchLevel: proposal.after.matchLevel,
10248
10433
  });
10249
10434
  if (!guard.ok) {
@@ -10255,7 +10440,7 @@ async function applyRegionMasking(params) {
10255
10440
  });
10256
10441
  continue;
10257
10442
  }
10258
- const plans = planRegionActions(proposal, guard.contained);
10443
+ const plans = planRegionActions(change, guard.contained, guard.superseded);
10259
10444
  const ops = plans.flatMap(plan => plan.ops);
10260
10445
  const updateRegionsInput = {
10261
10446
  sessionUrl,
@@ -10288,17 +10473,8 @@ async function applyRegionMasking(params) {
10288
10473
  description: sentence ? `${finding.description} ${sentence}` : finding.description,
10289
10474
  });
10290
10475
  // What just happened is now part of "what's already there" for the remaining findings of this
10291
- // same call, so two findings can't end up nested inside each other either — the regions this
10292
- // proposal cleared out (its nested neighbours, and the stale one it replaced) are gone, and the
10293
- // one it added is now in effect.
10294
- const staleRect = proposal.before ? rectOf(proposal.before.area) : null;
10295
- for (const gone of [...guard.contained, ...(staleRect ? existing.filter(e => sameRect(e.rect, staleRect)) : [])]) {
10296
- const at = existing.indexOf(gone);
10297
- if (at !== -1)
10298
- existing.splice(at, 1);
10299
- }
10300
- if (proposedRect)
10301
- existing.push({ matchLevel: proposal.after.matchLevel, rect: proposedRect });
10476
+ // same call, so two findings can't end up nested inside — or overlapping — each other either.
10477
+ foldAppliedProposal(existing, [...guard.contained, guard.superseded, stale], proposedRect ? { matchLevel: proposal.after.matchLevel, rect: proposedRect } : null);
10302
10478
  }
10303
10479
  return reported;
10304
10480
  }
@@ -10345,12 +10521,19 @@ async function verifyMasksAgainstRegions(params) {
10345
10521
  reason: `its mask's \`before\` (${regionOpTarget(mask.before.area)}) could not be resolved to a rect, so it can't be confirmed as an existing region`,
10346
10522
  };
10347
10523
  }
10348
- if (!existing.some(e => e.matchLevel === mask.before.matchLevel && sameRect(e.rect, beforeRect))) {
10524
+ const resolved = matchExistingRegion(existing, beforeRect, mask.before.matchLevel);
10525
+ if (resolved === null) {
10349
10526
  return {
10350
10527
  findingIndex: index,
10351
10528
  reason: `its mask's \`before\` (a ${mask.before.matchLevel} region at ${formatRect(beforeRect)}) does not match any region currently in effect on this step`,
10352
10529
  };
10353
10530
  }
10531
+ if (resolved === 'ambiguous') {
10532
+ return {
10533
+ findingIndex: index,
10534
+ reason: `its mask's \`before\` (a ${mask.before.matchLevel} region at ${formatRect(beforeRect)}) is equally close to more than one region currently in effect on this step, so which one it replaces is ambiguous`,
10535
+ };
10536
+ }
10354
10537
  }
10355
10538
  const afterRect = rectOf(mask.after.area);
10356
10539
  const findingRect = rectOf(finding.area);
@@ -11715,6 +11898,9 @@ async function stepProgress(params) {
11715
11898
  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.`;
11716
11899
  }
11717
11900
  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.`;
11901
+ // Masks are applied here, so the level rule has to arrive as a result the model reads now, not only as schema text.
11902
+ if (mode === 'resolve')
11903
+ result.next.instruction += ` ${MASK_LEVEL_RULE}`;
11718
11904
  // sameAs buys its way past the image gates with an examined dom diff, so a step with none can't use it.
11719
11905
  if (!unobtainable) {
11720
11906
  result.next.instruction +=
@@ -12248,7 +12434,7 @@ const EXPERIMENTAL_TOOL_SWAP = {
12248
12434
  ],
12249
12435
  };
12250
12436
  function skippedToolNames(experimental) {
12251
- return new Set(experimental ? EXPERIMENTAL_TOOL_SWAP.replacedByExperimental : EXPERIMENTAL_TOOL_SWAP.experimentalOnly);
12437
+ return new Set(EXPERIMENTAL_TOOL_SWAP.replacedByExperimental );
12252
12438
  }
12253
12439
  function filteredRegistrar(inner, skipped) {
12254
12440
  const registerTool = (name, config, handler) => {
@@ -12264,7 +12450,7 @@ function filteredRegistrar(inner, skipped) {
12264
12450
  * place that decides which tools each mode exposes.
12265
12451
  */
12266
12452
  function registerAllTools(server, experimental) {
12267
- const skipped = skippedToolNames(experimental);
12453
+ const skipped = skippedToolNames();
12268
12454
  Object.values(ALL_TOOLS).forEach(tool => {
12269
12455
  if (skipped.has(tool.name))
12270
12456
  return;
@@ -12281,18 +12467,17 @@ function registerAllTools(server, experimental) {
12281
12467
  registerEyesResolveTools(registrar);
12282
12468
  registerReviewTools(registrar);
12283
12469
  // A resource, not a tool — outside the name-based swap, so it stays gated by the mode directly.
12284
- if (experimental)
12285
- registerEyesInspectResources(server);
12470
+ registerEyesInspectResources(server);
12286
12471
  }
12287
12472
  /** Derived from the same swap structure as registration, so the startup log can't drift. */
12288
12473
  function registeredToolNames(experimental) {
12289
- const skipped = skippedToolNames(experimental);
12474
+ const skipped = skippedToolNames();
12290
12475
  return [...Object.values(TOOL_NAMES), ...EXPERIMENTAL_TOOL_SWAP.experimentalOnly].filter(name => !skipped.has(name));
12291
12476
  }
12292
12477
 
12293
12478
  async function startServer() {
12294
12479
  loadEnvOnce(process.cwd(), 'server startup');
12295
- const experimental = parseExperimental(process.env);
12480
+ const experimental = parseExperimental();
12296
12481
  setExperimental(experimental);
12297
12482
  const server = new mcp_js.McpServer({
12298
12483
  name: 'applitools-mcp',
@@ -12355,7 +12540,7 @@ async function startServer() {
12355
12540
  .catch(error => log$2('debug', '[MCP Server] roots/list failed:', error));
12356
12541
  }
12357
12542
  };
12358
- registerAllTools(server, experimental);
12543
+ registerAllTools(server);
12359
12544
  server.registerResource('documentation', RESOURCE_URIS.DOCUMENTATION_README, {
12360
12545
  title: RESOURCE_METADATA.DOCUMENTATION_README.title,
12361
12546
  description: RESOURCE_METADATA.DOCUMENTATION_README.description,
@@ -12378,8 +12563,8 @@ async function startServer() {
12378
12563
  const transport = new stdio_js.StdioServerTransport();
12379
12564
  await server.connect(transport);
12380
12565
  log$2('info', '[MCP Server] Applitools MCP Server started successfully (Stdio Mode)');
12381
- log$2('info', `[MCP Server] Experimental tools ${experimental ? 'enabled' : 'disabled'}`);
12382
- log$2('info', `[MCP Server] Available tools: ${registeredToolNames(experimental).join(', ')}`);
12566
+ log$2('info', `[MCP Server] Experimental tools ${'enabled' }`);
12567
+ log$2('info', `[MCP Server] Available tools: ${registeredToolNames().join(', ')}`);
12383
12568
  log$2('info', `[MCP Server] Available resources: documentation (${RESOURCE_URIS.DOCUMENTATION_README})`);
12384
12569
  }
12385
12570
  process.on('SIGINT', () => {