@swmansion/argent 0.34.1-next.96 → 0.34.1-next.97

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.
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -38575,7 +38575,7 @@ function isCi(env = process.env) {
38575
38575
  var SESSION_ID2 = randomUUID5();
38576
38576
  function readCliVersion() {
38577
38577
  if (true) {
38578
- return "0.34.1-next.96";
38578
+ return "0.34.1-next.97";
38579
38579
  }
38580
38580
  return "0.0.0";
38581
38581
  }
@@ -16998,7 +16998,7 @@ function isCi(env = process.env) {
16998
16998
  var SESSION_ID = randomUUID4();
16999
16999
  function readCliVersion() {
17000
17000
  if (true) {
17001
- return "0.34.1-next.96";
17001
+ return "0.34.1-next.97";
17002
17002
  }
17003
17003
  return "0.0.0";
17004
17004
  }
@@ -979,7 +979,7 @@ export interface ArgentToolArgs {
979
979
  captureCurrent?: boolean;
980
980
  /** Orientation override for live baseline/current captures. Rejected on HarmonyOS, which captures the display in its current orientation and has no override. Ignored on physical iPhones. */
981
981
  rotation?: "Portrait" | "LandscapeLeft" | "LandscapeRight" | "PortraitUpsideDown";
982
- /** Directory where diff artifacts should be written (default: a temp directory). The diff images are returned in the result either way. */
982
+ /** Directory where diff artifacts should be written (default: a temp directory). */
983
983
  outputDir?: string;
984
984
  };
985
985
  "settings-permissions": {
@@ -72948,7 +72948,7 @@ function isCi(env = process.env) {
72948
72948
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72949
72949
  function readCliVersion() {
72950
72950
  if (true) {
72951
- return "0.34.1-next.96";
72951
+ return "0.34.1-next.97";
72952
72952
  }
72953
72953
  return "0.0.0";
72954
72954
  }
@@ -162588,12 +162588,16 @@ function captureAbortSignal(env, budgetMs) {
162588
162588
  const bound = AbortSignal.timeout(budgetMs);
162589
162589
  return env.signal ? AbortSignal.any([env.signal, bound]) : bound;
162590
162590
  }
162591
- function comparePixels(a, b, maskTopFraction = 0) {
162591
+ function comparePixels(a, b, maskTopFraction = 0, maskBottomFraction = 0) {
162592
162592
  if (a.width !== b.width || a.height !== b.height) return "moving";
162593
162593
  const maskedRows = Math.min(a.height, Math.floor(a.height * maskTopFraction));
162594
- const total = a.width * (a.height - maskedRows);
162594
+ const maskedBottomRows = Math.min(
162595
+ a.height - maskedRows,
162596
+ Math.floor(a.height * maskBottomFraction)
162597
+ );
162598
+ const total = a.width * (a.height - maskedRows - maskedBottomRows);
162595
162599
  if (total <= 0) return "still";
162596
- const limit = Math.min(a.data.length, b.data.length);
162600
+ const limit = Math.min(a.data.length, b.data.length, (a.height - maskedBottomRows) * a.width * 4);
162597
162601
  let changed = 0;
162598
162602
  for (let o = maskedRows * a.width * 4; o + 2 < limit; o += 4) {
162599
162603
  const dr = a.data[o] - b.data[o];
@@ -162608,6 +162612,40 @@ function comparePixels(a, b, maskTopFraction = 0) {
162608
162612
  if (changed > motionThreshold) return "moving";
162609
162613
  return changed >= LOCALIZED_MOTION_MIN_PIXELS ? "localized" : "still";
162610
162614
  }
162615
+ var SNAPSHOT_SETTLE_POLL_MS = 100;
162616
+ var SNAPSHOT_SETTLE_TIMEOUT_MS = 3e3;
162617
+ var SNAPSHOT_QUIET_AFTER_ACTION_MS = 300;
162618
+ var ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS = 400;
162619
+ var SNAPSHOT_LOCALIZED_POLLS = 3;
162620
+ var HOME_INDICATOR_MASK_FRACTION = 0.02;
162621
+ async function settlesOnPixels(device) {
162622
+ if (device.platform === "android") return device.kind === "emulator";
162623
+ if (device.platform !== "ios" || isIosPhysicalDevice(device)) return false;
162624
+ return !await isTvOsSimulator(device.id);
162625
+ }
162626
+ async function settleOnPixels(env) {
162627
+ const deadline = Date.now() + SNAPSHOT_SETTLE_TIMEOUT_MS;
162628
+ const quietAfter = (env.lastActionAt ?? 0) + (env.device.platform === "android" ? ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS : SNAPSHOT_QUIET_AFTER_ACTION_MS);
162629
+ const maskTopFraction = await statusBarMaskFraction(env.device);
162630
+ const maskBottomFraction = maskTopFraction > 0 ? HOME_INDICATOR_MASK_FRACTION : 0;
162631
+ let previous = await capturePixelsWithin(env, deadline, true);
162632
+ let compared = false;
162633
+ let localizedPolls = 0;
162634
+ while (Date.now() < deadline) {
162635
+ if (!await sleepOrAbort(SNAPSHOT_SETTLE_POLL_MS, env.signal)) return "aborted";
162636
+ const frame2 = await capturePixelsWithin(env, deadline, false);
162637
+ if (env.signal?.aborted) return "aborted";
162638
+ if (previous && frame2) {
162639
+ compared = true;
162640
+ const change = comparePixels(previous, frame2, maskTopFraction, maskBottomFraction);
162641
+ localizedPolls = change === "localized" ? localizedPolls + 1 : 0;
162642
+ const settled = change === "still" || localizedPolls >= SNAPSHOT_LOCALIZED_POLLS;
162643
+ if (settled && Date.now() >= quietAfter) return "still";
162644
+ }
162645
+ previous = frame2;
162646
+ }
162647
+ return compared ? "moving" : "blind";
162648
+ }
162611
162649
 
162612
162650
  // ../tool-server/src/tools/flows/flow-actions.ts
162613
162651
  var ABORTED_OUTCOME = {
@@ -167770,13 +167808,6 @@ var FUZZY_SAME_TEXT_CENTER_DISTANCE_PX = 60;
167770
167808
  var MAX_TEXT_CHANGES = 10;
167771
167809
  var DEFAULT_TEXT_CHANGE_MIN_CONFIDENCE = 0.7;
167772
167810
  async function analyzeScreenshotTextChanges(options) {
167773
- if (options.hasPixelDiff === false) {
167774
- return {
167775
- status: "skipped",
167776
- provider: "ocr",
167777
- changes: []
167778
- };
167779
- }
167780
167811
  const [baselineOcr, currentOcr] = await Promise.all([
167781
167812
  extractOcrTextBlocks(options.baselinePath),
167782
167813
  extractOcrTextBlocks(options.currentPath)
@@ -168445,86 +168476,112 @@ var HORIZONTAL_TEXT_MERGE_HEIGHT_MULTIPLIER = 3;
168445
168476
  var HORIZONTAL_TEXT_MERGE_MIN_GAP = 32;
168446
168477
  var HORIZONTAL_TEXT_MERGE_MAX_GAP = 120;
168447
168478
  var UNIFORM_BRIGHTNESS_DELTA_TOLERANCE = 4;
168448
- async function diffPngFiles(options) {
168449
- const settings = resolveDiffSettings(options.topMask ?? "status-bar");
168450
- const [baseline, current] = await Promise.all([
168451
- decodePngFile(options.baselinePath),
168452
- decodePngFile(options.currentPath)
168479
+ var DIFF_PNG_ENCODING = { filterType: 1, deflateLevel: 3 };
168480
+ var PNG_SIGNATURE2 = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
168481
+ var PNG_IHDR_CHUNK_LENGTH = 25;
168482
+ var PNG_IEND_CHUNK = Buffer.from([0, 0, 0, 0, 73, 69, 78, 68, 174, 66, 96, 130]);
168483
+ async function compareScreenshots(options) {
168484
+ const [baselineBytes, currentBytes] = await Promise.all([
168485
+ readPngFile(options.baselinePath),
168486
+ readPngFile(options.currentPath)
168453
168487
  ]);
168488
+ const identicalSize = baselineBytes.equals(currentBytes) ? completePngSize(baselineBytes) : void 0;
168489
+ if (identicalSize) {
168490
+ return {
168491
+ totalPixels: identicalSize.width * identicalSize.height,
168492
+ differentPixels: 0,
168493
+ mismatchPercentage: 0,
168494
+ imageSize: identicalSize
168495
+ };
168496
+ }
168497
+ const baseline = decodePng(baselineBytes, options.baselinePath);
168498
+ const current = decodePng(currentBytes, options.currentPath);
168454
168499
  if (baseline.width !== current.width || baseline.height !== current.height) {
168455
- return summarizeResult(buildDimensionMismatchResult({ baseline, current }));
168500
+ return {
168501
+ totalPixels: baseline.width * baseline.height,
168502
+ differentPixels: 0,
168503
+ mismatchPercentage: 0,
168504
+ dimensionMismatch: {
168505
+ expected: { width: baseline.width, height: baseline.height },
168506
+ actual: { width: current.width, height: current.height }
168507
+ }
168508
+ };
168456
168509
  }
168510
+ const ignoreTopNormalizedY = (options.topMask ?? "status-bar") === "none" ? 0 : DEFAULT_IGNORE_TOP_NORMALIZED_Y;
168457
168511
  const totalPixels = baseline.width * baseline.height;
168458
168512
  const pixelDiff = markChangedPixels({
168459
168513
  baseline,
168460
168514
  current,
168461
- thresholdSquared: settings.thresholdSquared,
168462
- ignoreTopNormalizedY: settings.ignoreTopNormalizedY
168463
- });
168464
- const regions = getChangedRegions({
168465
- mask: pixelDiff.mask,
168466
- baseline,
168467
- current,
168468
- joinGapPixels: settings.joinGapPixels
168515
+ thresholdSquared: DEFAULT_THRESHOLD * DEFAULT_THRESHOLD * MAX_RGB_DISTANCE_SQUARED2,
168516
+ ignoreTopNormalizedY
168469
168517
  });
168518
+ return {
168519
+ totalPixels,
168520
+ differentPixels: pixelDiff.differentPixels,
168521
+ mismatchPercentage: totalPixels === 0 ? 0 : pixelDiff.differentPixels / totalPixels * 100,
168522
+ imageSize: { width: baseline.width, height: baseline.height },
168523
+ pixels: { baseline, current, mask: pixelDiff.mask, ignoreTopNormalizedY }
168524
+ };
168525
+ }
168526
+ async function writeContextDiff(comparison, destination) {
168527
+ if (!comparison.pixels || comparison.differentPixels === 0) return false;
168528
+ const diffImage = buildAnnotatedDiff(comparison.pixels, changedRegionsOf(comparison.pixels));
168529
+ await writePngFile(destination, downscalePng(diffImage, DEFAULT_CONTEXT_DIFF_SCALE));
168530
+ return true;
168531
+ }
168532
+ async function diffPngFiles(options) {
168533
+ const { pixels, ...comparison } = await compareScreenshots(options);
168534
+ if (!pixels || comparison.differentPixels === 0) {
168535
+ return summarizeResult({
168536
+ ...comparison,
168537
+ regions: [],
168538
+ textAnalysis: { status: "skipped", provider: "ocr", changes: [] }
168539
+ });
168540
+ }
168541
+ const regions = changedRegionsOf(pixels);
168470
168542
  const artifactPaths = resolveDiffArtifactPaths(options);
168471
- await writeDiffArtifacts({
168472
- baseline,
168473
- current,
168474
- mask: pixelDiff.mask,
168475
- regions,
168476
- paths: artifactPaths,
168477
- contextDiffScale: settings.contextDiffScale
168478
- });
168479
- const mismatchPercentage = totalPixels === 0 ? 0 : pixelDiff.differentPixels / totalPixels * 100;
168543
+ const diffImage = buildAnnotatedDiff(pixels, regions);
168544
+ await writePngFile(artifactPaths.diffPath, diffImage);
168545
+ await writePngFile(
168546
+ artifactPaths.contextDiffPath,
168547
+ downscalePng(diffImage, DEFAULT_CONTEXT_DIFF_SCALE)
168548
+ );
168480
168549
  const textAnalysis = await analyzeScreenshotTextChangesSafely({
168481
168550
  baselinePath: options.baselinePath,
168482
168551
  currentPath: options.currentPath,
168483
- hasPixelDiff: pixelDiff.differentPixels > 0,
168484
- baselineImage: baseline,
168485
- currentImage: current,
168486
- ignoreTopPixels: ignoredTopRowsFor(baseline.height, settings.ignoreTopNormalizedY),
168552
+ baselineImage: pixels.baseline,
168553
+ currentImage: pixels.current,
168554
+ ignoreTopPixels: ignoredTopRowsFor(pixels.baseline.height, pixels.ignoreTopNormalizedY),
168487
168555
  textChangeMinConfidence: DEFAULT_TEXT_CHANGE_MIN_CONFIDENCE
168488
168556
  });
168489
168557
  return summarizeResult({
168490
- totalPixels,
168491
- differentPixels: pixelDiff.differentPixels,
168492
- mismatchPercentage,
168493
- imageSize: { width: baseline.width, height: baseline.height },
168558
+ ...comparison,
168494
168559
  diffPath: artifactPaths.diffPath,
168495
168560
  contextDiffPath: artifactPaths.contextDiffPath,
168496
168561
  regions,
168497
168562
  textAnalysis
168498
168563
  });
168499
168564
  }
168500
- function resolveDiffSettings(topMask) {
168501
- return {
168502
- thresholdSquared: DEFAULT_THRESHOLD * DEFAULT_THRESHOLD * MAX_RGB_DISTANCE_SQUARED2,
168503
- ignoreTopNormalizedY: topMask === "none" ? 0 : DEFAULT_IGNORE_TOP_NORMALIZED_Y,
168504
- joinGapPixels: DEFAULT_REGION_MERGE_DISTANCE,
168505
- contextDiffScale: DEFAULT_CONTEXT_DIFF_SCALE
168506
- };
168565
+ function completePngSize(bytes) {
168566
+ const complete = bytes.length >= PNG_SIGNATURE2.length + PNG_IHDR_CHUNK_LENGTH + PNG_IEND_CHUNK.length && bytes.subarray(0, PNG_SIGNATURE2.length).equals(PNG_SIGNATURE2) && bytes.toString("latin1", 12, 16) === "IHDR" && bytes.subarray(bytes.length - PNG_IEND_CHUNK.length).equals(PNG_IEND_CHUNK);
168567
+ return complete ? { width: bytes.readUInt32BE(16), height: bytes.readUInt32BE(20) } : void 0;
168568
+ }
168569
+ function changedRegionsOf(pixels) {
168570
+ return getChangedRegions({
168571
+ mask: pixels.mask,
168572
+ baseline: pixels.baseline,
168573
+ current: pixels.current,
168574
+ joinGapPixels: DEFAULT_REGION_MERGE_DISTANCE
168575
+ });
168576
+ }
168577
+ function buildAnnotatedDiff(pixels, regions) {
168578
+ const diffImage = buildContextDiff(pixels);
168579
+ drawRegionRectangles(diffImage, regions);
168580
+ return diffImage;
168507
168581
  }
168508
168582
  function summarizeResult(result) {
168509
168583
  return { ...result, summary: formatScreenshotDiffSummary(result) };
168510
168584
  }
168511
- function buildDimensionMismatchResult(params) {
168512
- return {
168513
- totalPixels: params.baseline.width * params.baseline.height,
168514
- differentPixels: 0,
168515
- mismatchPercentage: 0,
168516
- dimensionMismatch: {
168517
- expected: { width: params.baseline.width, height: params.baseline.height },
168518
- actual: { width: params.current.width, height: params.current.height }
168519
- },
168520
- regions: [],
168521
- textAnalysis: {
168522
- status: "skipped",
168523
- provider: "ocr",
168524
- changes: []
168525
- }
168526
- };
168527
- }
168528
168585
  function markChangedPixels(params) {
168529
168586
  const totalPixels = params.baseline.width * params.baseline.height;
168530
168587
  const baselineData = params.baseline.data;
@@ -168580,40 +168637,32 @@ function outputArtifactBaseName(filePath) {
168580
168637
  const parsed2 = import_path8.default.parse(import_path8.default.basename(filePath));
168581
168638
  return parsed2.name || parsed2.base;
168582
168639
  }
168583
- async function writeDiffArtifacts(params) {
168584
- const diffImage = buildContextDiff({
168585
- baseline: params.baseline,
168586
- current: params.current,
168587
- mask: params.mask
168588
- });
168589
- drawRegionRectangles(diffImage, params.regions);
168590
- await writePngFile(params.paths.diffPath, diffImage);
168591
- await writePngFile(
168592
- params.paths.contextDiffPath,
168593
- downscalePng(diffImage, params.contextDiffScale)
168594
- );
168640
+ async function readPngFile(filePath) {
168641
+ try {
168642
+ return await import_promises22.default.readFile(filePath);
168643
+ } catch (err) {
168644
+ throw unreadablePngError(filePath, err);
168645
+ }
168595
168646
  }
168596
- async function decodePngFile(filePath) {
168647
+ function decodePng(buffer, filePath) {
168597
168648
  try {
168598
- const buffer = await import_promises22.default.readFile(filePath);
168599
168649
  const png = import_pngjs6.PNG.sync.read(buffer);
168600
- return {
168601
- width: png.width,
168602
- height: png.height,
168603
- data: png.data
168604
- };
168650
+ return { width: png.width, height: png.height, data: png.data };
168605
168651
  } catch (err) {
168606
- throw new FailureError(
168607
- `Could not read PNG at ${filePath}: ${err instanceof Error ? err.message : String(err)}`,
168608
- {
168609
- error_code: FAILURE_CODES.SCREENSHOT_DIFF_INPUT_INVALID,
168610
- failure_stage: "screenshot_diff_decode_failed",
168611
- failure_area: "tool_server",
168612
- error_kind: "validation"
168613
- }
168614
- );
168652
+ throw unreadablePngError(filePath, err);
168615
168653
  }
168616
168654
  }
168655
+ function unreadablePngError(filePath, err) {
168656
+ return new FailureError(
168657
+ `Could not read PNG at ${filePath}: ${err instanceof Error ? err.message : String(err)}`,
168658
+ {
168659
+ error_code: FAILURE_CODES.SCREENSHOT_DIFF_INPUT_INVALID,
168660
+ failure_stage: "screenshot_diff_decode_failed",
168661
+ failure_area: "tool_server",
168662
+ error_kind: "validation"
168663
+ }
168664
+ );
168665
+ }
168617
168666
  async function analyzeScreenshotTextChangesSafely(options) {
168618
168667
  try {
168619
168668
  return await analyzeScreenshotTextChanges(options);
@@ -168651,7 +168700,7 @@ function luminanceFromOffset(data, offset) {
168651
168700
  }
168652
168701
  async function writePngFile(filePath, png) {
168653
168702
  await import_promises22.default.mkdir(import_path8.default.dirname(filePath), { recursive: true });
168654
- await import_promises22.default.writeFile(filePath, import_pngjs6.PNG.sync.write(png));
168703
+ await import_promises22.default.writeFile(filePath, import_pngjs6.PNG.sync.write(png, DIFF_PNG_ENCODING));
168655
168704
  }
168656
168705
  function downscalePng(source, scale) {
168657
168706
  const resized = resizeDecodedPng(
@@ -168985,13 +169034,24 @@ async function cropPngFile(src, dest, frame2) {
168985
169034
  await fs81.writeFile(dest, import_pngjs7.PNG.sync.write(out));
168986
169035
  return { w, h };
168987
169036
  }
168988
- async function runSnapshot(env, opts) {
168989
- if (opts.cropOn === void 0 && supportsFlowTree(env.device.platform)) {
168990
- try {
168991
- await settleTree(env);
168992
- } catch {
168993
- }
169037
+ async function warmSnapshotCapture(registry2, device) {
169038
+ try {
169039
+ if (!await settlesOnPixels(device)) return;
169040
+ const refs = isIosSimulator(device) ? [simulatorServerRef(device), axServiceRef(device)] : [simulatorServerRef(device)];
169041
+ await Promise.all(refs.map((ref) => registry2.resolveService(ref.urn, ref.options)));
169042
+ } catch {
169043
+ }
169044
+ }
169045
+ async function settleScreen(env) {
169046
+ if (await settlesOnPixels(env.device) && await settleOnPixels(env) !== "blind") return;
169047
+ if (!supportsFlowTree(env.device.platform)) return;
169048
+ try {
169049
+ await settleTree(env);
169050
+ } catch {
168994
169051
  }
169052
+ }
169053
+ async function runSnapshot(env, opts) {
169054
+ if (opts.cropOn === void 0) await settleScreen(env);
168995
169055
  if (env.signal?.aborted) {
168996
169056
  return { status: "skip", reason: "run aborted during snapshot settle" };
168997
169057
  }
@@ -169138,13 +169198,12 @@ async function runSnapshot(env, opts) {
169138
169198
  };
169139
169199
  }
169140
169200
  const localBaseline = await hostBaseline(stored);
169141
- const outputDir = await fs81.mkdtemp(path66.join(os27.tmpdir(), "argent-e2e-diff-"));
169201
+ let outputDir;
169142
169202
  let keepInOutputDir;
169143
169203
  try {
169144
- const result = await diffPngFiles({
169204
+ const result = await compareScreenshots({
169145
169205
  baselinePath: localBaseline,
169146
169206
  currentPath,
169147
- outputDir,
169148
169207
  // A crop compares EVERY pixel of the element's region, wherever it
169149
169208
  // sits. Masking a crop's overlap with the screen's top status-bar band
169150
169209
  // would degenerate into comparing nothing for an element inside the
@@ -169178,18 +169237,20 @@ async function runSnapshot(env, opts) {
169178
169237
  baseline: await baselineArtifact(localBaseline),
169179
169238
  current: await currentArtifact()
169180
169239
  };
169181
- if (result.contextDiffPath) {
169240
+ outputDir = await fs81.mkdtemp(path66.join(os27.tmpdir(), "argent-e2e-diff-"));
169241
+ const contextDiffPath = path66.join(outputDir, `${snapshotKey}-diff.png`);
169242
+ if (await writeContextDiff(result, contextDiffPath)) {
169182
169243
  artifacts.diff = await store.register({
169183
- hostPath: result.contextDiffPath,
169244
+ hostPath: contextDiffPath,
169184
169245
  kind: "screenshot-diff-context",
169185
169246
  mimeType: "image/png",
169186
169247
  filename: `${snapshotKey}-diff.png`
169187
169248
  });
169188
- keepInOutputDir = result.contextDiffPath;
169249
+ keepInOutputDir = contextDiffPath;
169189
169250
  }
169190
169251
  return { ...captureWarned, status: "fail", reason: reason2, snapshotKey, artifacts };
169191
169252
  } finally {
169192
- await cleanupDiffDir(outputDir, keepInOutputDir);
169253
+ if (outputDir !== void 0) await cleanupDiffDir(outputDir, keepInOutputDir);
169193
169254
  }
169194
169255
  } finally {
169195
169256
  if (cropDir !== void 0) {
@@ -170005,6 +170066,9 @@ Without a link, every step kind runs.`,
170005
170066
  );
170006
170067
  const device = resolved.device;
170007
170068
  const statusBarPinned = device !== null && await pinStatusBar(device, signal);
170069
+ if (device !== null && !signal?.aborted && mayRunSnapshotStep(flow)) {
170070
+ void warmSnapshotCapture(registry2, device);
170071
+ }
170008
170072
  if (device?.platform === "chromium" && !signal?.aborted) {
170009
170073
  await frontChromiumPage(registry2, device);
170010
170074
  }
@@ -170020,6 +170084,8 @@ Without a link, every step kind runs.`,
170020
170084
  // its own, which is why that step spends this verdict rather than
170021
170085
  // inheriting whatever the sub-run proved.
170022
170086
  treeOutage: {},
170087
+ // The caller may have acted on the app right before this run.
170088
+ lastActionAt: Date.now(),
170023
170089
  flowsDir,
170024
170090
  viaUpload,
170025
170091
  project,
@@ -170319,6 +170385,19 @@ function childScope(scope, overrides = {}) {
170319
170385
  function depthOf(scope) {
170320
170386
  return scope.depth ? { depth: scope.depth } : {};
170321
170387
  }
170388
+ function mayRunSnapshotStep(flow) {
170389
+ return [...walkSteps(flow.steps)].some(
170390
+ ({ step }) => step.kind === "snapshot" || step.kind === "run"
170391
+ );
170392
+ }
170393
+ var SCREEN_READING_STEPS = /* @__PURE__ */ new Set([
170394
+ "echo",
170395
+ "await",
170396
+ "assert",
170397
+ "idle",
170398
+ "wait",
170399
+ "snapshot"
170400
+ ]);
170322
170401
  async function execSteps(state3, steps, scope) {
170323
170402
  for (const step of steps) {
170324
170403
  const index = state3.reports.length;
@@ -170389,6 +170468,9 @@ async function execSteps(state3, steps, scope) {
170389
170468
  scope.legacyPoints && step.kind === "tool" ? "native" : "upright",
170390
170469
  () => execLeafStep(state3, step, index, scope)
170391
170470
  );
170471
+ if (report.status !== "skip" && !SCREEN_READING_STEPS.has(step.kind)) {
170472
+ state3.lastActionAt = Date.now();
170473
+ }
170392
170474
  if (report.status !== "skip") report.durationMs = Date.now() - startedAt;
170393
170475
  if ((report.status === "fail" || report.status === "error") && !report.artifacts) {
170394
170476
  const screen = await captureFailureScreen(state3);
@@ -171614,9 +171696,7 @@ var zodSchema79 = external_exports.object({
171614
171696
  rotation: external_exports.enum(["Portrait", "LandscapeLeft", "LandscapeRight", "PortraitUpsideDown"]).optional().describe(
171615
171697
  "Orientation override for live baseline/current captures. <flag:harmonyos>Rejected on HarmonyOS, which captures the display in its current orientation and has no override. </flag:harmonyos>Ignored on physical iPhones."
171616
171698
  ),
171617
- outputDir: external_exports.string().min(1).optional().describe(
171618
- "Directory where diff artifacts should be written (default: a temp directory). The diff images are returned in the result either way."
171619
- )
171699
+ outputDir: external_exports.string().min(1).optional().describe("Directory where diff artifacts should be written (default: a temp directory).")
171620
171700
  }).strict();
171621
171701
  var screenshotDiffTool = {
171622
171702
  id: "screenshot-diff",
@@ -171626,7 +171706,7 @@ Both images must have identical dimensions: save baselines with screenshot scale
171626
171706
  Use when stable before/after screenshots exist and the expected result is pixel-visible: layout, spacing, color, typography, image/icon rendering, clipping, overflow, or text rendering.
171627
171707
  Physical iPhones: live captures are device-wide and need no registered app.
171628
171708
  <flag:macos-apps>Mac apps: a resized window fails as a dimension mismatch.
171629
- </flag:macos-apps>Returns { summary, diffPath, contextDiffPath }. The summary uses normalized [0,1] screen locations matching describe coordinates; diffPath is the full-size diff image and contextDiffPath is a downscaled image for MCP/agent display.
171709
+ </flag:macos-apps>Returns { summary }, plus diffPath and contextDiffPath when pixels differ. The summary uses normalized [0,1] screen locations matching describe coordinates; diffPath is the full-size diff image and contextDiffPath is a downscaled image for MCP/agent display.
171630
171710
  Ignores the fixed top status-bar band for both pixel and OCR text comparisons.
171631
171711
  Fails if the input sources are invalid, PNG files cannot be read, outputDir cannot be written, or the simulator-server / emulator backend<flag:harmonyos>, or \`hdc\` on HarmonyOS,</flag:harmonyos> is not reachable.`,
171632
171712
  zodSchema: zodSchema79,
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.96",
3
+ "version": "0.34.1-next.97",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
6
6
  "license": "Apache-2.0",
@@ -98,5 +98,5 @@
98
98
  "vitest": "^5.0.5",
99
99
  "yaml": "^2.9.1"
100
100
  },
101
- "gitHead": "698324b75329ff5f5a6f0b110dd30fd10cb03446"
101
+ "gitHead": "9c7ffba5a6037c9389f55a670dd55968e5c5cfde"
102
102
  }