@swmansion/argent 0.35.1-next.5 → 0.35.1-next.6

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/cli-cmds.mjs CHANGED
@@ -38585,7 +38585,7 @@ function isCi(env = process.env) {
38585
38585
  var SESSION_ID2 = randomUUID5();
38586
38586
  function readCliVersion() {
38587
38587
  if (true) {
38588
- return "0.35.1-next.5";
38588
+ return "0.35.1-next.6";
38589
38589
  }
38590
38590
  return "0.0.0";
38591
38591
  }
@@ -17103,7 +17103,7 @@ function isCi(env = process.env) {
17103
17103
  var SESSION_ID = randomUUID4();
17104
17104
  function readCliVersion() {
17105
17105
  if (true) {
17106
- return "0.35.1-next.5";
17106
+ return "0.35.1-next.6";
17107
17107
  }
17108
17108
  return "0.0.0";
17109
17109
  }
@@ -38044,7 +38044,7 @@ async function startMcpServer(options) {
38044
38044
  const autoDescribeOn = autoDescribeEnabled();
38045
38045
  const whatsNewOn = whatsNewEnabled();
38046
38046
  const installedVersion = getInstalledVersion();
38047
- const highlightsVersion = true ? "0.35.1-next.5" : installedVersion;
38047
+ const highlightsVersion = true ? "0.35.1-next.6" : installedVersion;
38048
38048
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38049
38049
  const trees = createTreeMemory();
38050
38050
  const screenshots = createScreenshotMemory();
@@ -72957,7 +72957,7 @@ function isCi(env = process.env) {
72957
72957
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72958
72958
  function readCliVersion() {
72959
72959
  if (true) {
72960
- return "0.35.1-next.5";
72960
+ return "0.35.1-next.6";
72961
72961
  }
72962
72962
  return "0.0.0";
72963
72963
  }
@@ -163485,16 +163485,12 @@ function captureAbortSignal(env, budgetMs) {
163485
163485
  }
163486
163486
  function comparePixels(a, b, maskTopFraction = 0, maskBottomFraction = 0) {
163487
163487
  if (a.width !== b.width || a.height !== b.height) return "moving";
163488
- const maskedRows = Math.min(a.height, Math.floor(a.height * maskTopFraction));
163489
- const maskedBottomRows = Math.min(
163490
- a.height - maskedRows,
163491
- Math.floor(a.height * maskBottomFraction)
163492
- );
163493
- const total = a.width * (a.height - maskedRows - maskedBottomRows);
163488
+ const { start: start2, end } = unmaskedBytes(a, maskTopFraction, maskBottomFraction);
163489
+ const total = (end - start2) / 4;
163494
163490
  if (total <= 0) return "still";
163495
- const limit = Math.min(a.data.length, b.data.length, (a.height - maskedBottomRows) * a.width * 4);
163491
+ const limit = Math.min(a.data.length, b.data.length, end);
163496
163492
  let changed = 0;
163497
- for (let o = maskedRows * a.width * 4; o + 2 < limit; o += 4) {
163493
+ for (let o = start2; o + 2 < limit; o += 4) {
163498
163494
  const dr = a.data[o] - b.data[o];
163499
163495
  const dg = a.data[o + 1] - b.data[o + 1];
163500
163496
  const db = a.data[o + 2] - b.data[o + 2];
@@ -163507,11 +163503,29 @@ function comparePixels(a, b, maskTopFraction = 0, maskBottomFraction = 0) {
163507
163503
  if (changed > motionThreshold) return "moving";
163508
163504
  return changed >= LOCALIZED_MOTION_MIN_PIXELS ? "localized" : "still";
163509
163505
  }
163506
+ function unmaskedBytes(frame2, maskTopFraction, maskBottomFraction) {
163507
+ const maskedRows = Math.min(frame2.height, Math.floor(frame2.height * maskTopFraction));
163508
+ const maskedBottomRows = Math.min(
163509
+ frame2.height - maskedRows,
163510
+ Math.floor(frame2.height * maskBottomFraction)
163511
+ );
163512
+ return {
163513
+ start: maskedRows * frame2.width * 4,
163514
+ end: (frame2.height - maskedBottomRows) * frame2.width * 4
163515
+ };
163516
+ }
163517
+ function identicalPixels(a, b, maskTopFraction, maskBottomFraction) {
163518
+ if (a.width !== b.width || a.height !== b.height) return false;
163519
+ const { start: start2, end } = unmaskedBytes(a, maskTopFraction, maskBottomFraction);
163520
+ return a.data.subarray(start2, end).equals(b.data.subarray(start2, end));
163521
+ }
163510
163522
  var SNAPSHOT_SETTLE_POLL_MS = 100;
163511
163523
  var SNAPSHOT_SETTLE_TIMEOUT_MS = 3e3;
163512
163524
  var SNAPSHOT_QUIET_AFTER_ACTION_MS = 300;
163513
163525
  var ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS = 400;
163514
163526
  var SNAPSHOT_LOCALIZED_POLLS = 3;
163527
+ var SNAPSHOT_SLOW_START_WINDOW_MS = 2e3;
163528
+ var SNAPSHOT_SLOW_START_POLLS = 3;
163515
163529
  var HOME_INDICATOR_MASK_FRACTION = 0.02;
163516
163530
  async function settlesOnPixels(device) {
163517
163531
  if (device.platform === "android") return device.kind === "emulator";
@@ -163520,24 +163534,38 @@ async function settlesOnPixels(device) {
163520
163534
  }
163521
163535
  async function settleOnPixels(env) {
163522
163536
  const deadline = Date.now() + SNAPSHOT_SETTLE_TIMEOUT_MS;
163523
- const quietAfter = (env.lastActionAt ?? 0) + (env.device.platform === "android" ? ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS : SNAPSHOT_QUIET_AFTER_ACTION_MS);
163537
+ const lastActionAt = env.lastActionAt ?? 0;
163538
+ const quietAfter = lastActionAt + (env.device.platform === "android" ? ANDROID_SNAPSHOT_QUIET_AFTER_ACTION_MS : SNAPSHOT_QUIET_AFTER_ACTION_MS);
163524
163539
  const maskTopFraction = await statusBarMaskFraction(env.device);
163525
163540
  const maskBottomFraction = maskTopFraction > 0 ? HOME_INDICATOR_MASK_FRACTION : 0;
163526
- let previous = await capturePixelsWithin(env, deadline, true);
163541
+ const compare = (a, b) => comparePixels(a, b, maskTopFraction, maskBottomFraction);
163542
+ const identical = (a, b) => identicalPixels(a, b, maskTopFraction, maskBottomFraction);
163543
+ const mayStillBeChanging = (recent2, frame2) => {
163544
+ if (Date.now() - lastActionAt >= SNAPSHOT_SLOW_START_WINDOW_MS) return false;
163545
+ if (recent2.length < SNAPSHOT_SLOW_START_POLLS) return true;
163546
+ return compare(recent2[0], frame2) === "moving";
163547
+ };
163548
+ const first = await capturePixelsWithin(env, deadline, true);
163549
+ let recent = first ? [first] : [];
163527
163550
  let compared = false;
163528
163551
  let localizedPolls = 0;
163529
163552
  while (Date.now() < deadline) {
163530
163553
  if (!await sleepOrAbort(SNAPSHOT_SETTLE_POLL_MS, env.signal)) return "aborted";
163531
163554
  const frame2 = await capturePixelsWithin(env, deadline, false);
163532
163555
  if (env.signal?.aborted) return "aborted";
163533
- if (previous && frame2) {
163556
+ if (!frame2) {
163557
+ recent = [];
163558
+ continue;
163559
+ }
163560
+ const previous = recent.at(-1);
163561
+ if (previous) {
163534
163562
  compared = true;
163535
- const change = comparePixels(previous, frame2, maskTopFraction, maskBottomFraction);
163563
+ const change = compare(previous, frame2);
163536
163564
  localizedPolls = change === "localized" ? localizedPolls + 1 : 0;
163537
- const settled = change === "still" || localizedPolls >= SNAPSHOT_LOCALIZED_POLLS;
163565
+ const settled = (change === "still" || localizedPolls >= SNAPSHOT_LOCALIZED_POLLS) && (identical(previous, frame2) || !mayStillBeChanging(recent, frame2));
163538
163566
  if (settled && Date.now() >= quietAfter) return "still";
163539
163567
  }
163540
- previous = frame2;
163568
+ recent = [...recent, frame2].slice(-SNAPSHOT_SLOW_START_POLLS);
163541
163569
  }
163542
163570
  return compared ? "moving" : "blind";
163543
163571
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.35.1-next.5",
3
+ "version": "0.35.1-next.6",
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": "873b4c7d6e9274ad84070eb7c1a581a732296ddb"
101
+ "gitHead": "0e7a817c0dfcfd2c615d5247a62f58858764c3ad"
102
102
  }