@swmansion/argent 0.35.0 → 0.35.1-next.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.
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.35.0";
38578
+ return "0.35.1-next.0";
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.35.0";
17001
+ return "0.35.1-next.0";
17002
17002
  }
17003
17003
  return "0.0.0";
17004
17004
  }
@@ -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.35.0";
72951
+ return "0.35.1-next.0";
72952
72952
  }
72953
72953
  return "0.0.0";
72954
72954
  }
@@ -109942,9 +109942,12 @@ function contentElements(hierarchy, focusText) {
109942
109942
  }
109943
109943
  function tvFocusTree(res, hierarchy = null) {
109944
109944
  const elements = [...res.focusable];
109945
- if (res.focused && !res.focusable.some((e) => e.isFocused)) {
109945
+ const cursorNotListed = !!res.focused && !res.focusable.some((e) => e.isFocused);
109946
+ if (cursorNotListed) {
109946
109947
  elements.push({ ...res.focused, isFocused: true });
109947
109948
  }
109949
+ const cursorNotLanded = cursorNotListed && cursorLeftBehind(res.focused, res.focusable, hierarchy);
109950
+ const flags = cursorNotLanded ? { cursorNotLanded } : {};
109948
109951
  const focusText = /* @__PURE__ */ new Set();
109949
109952
  for (const e of elements) {
109950
109953
  if (e.label) focusText.add(e.label);
@@ -109955,12 +109958,39 @@ function tvFocusTree(res, hierarchy = null) {
109955
109958
  if (root.children.length === 0) {
109956
109959
  return { tree: root, source: "tv-focus", hint: TV_FOCUS_WAIT_EMPTY_HINT };
109957
109960
  }
109958
- return (hierarchy?.nodeCount ?? 0) > TV_HIERARCHY_NODE_CAP ? { tree: root, source: "tv-focus", partial: true, hint: TV_HIERARCHY_CAPPED_HINT } : { tree: root, source: "tv-focus" };
109961
+ return (hierarchy?.nodeCount ?? 0) > TV_HIERARCHY_NODE_CAP ? { tree: root, source: "tv-focus", ...flags, partial: true, hint: TV_HIERARCHY_CAPPED_HINT } : { tree: root, source: "tv-focus", ...flags };
109962
+ }
109963
+ var TEXT_ENTRY_TRAIT = 0x40000n;
109964
+ function cursorLeftBehind(focused, focusable, hierarchy) {
109965
+ const isTextEntry = (element) => !!element._traitsHex && (BigInt(element._traitsHex) & TEXT_ENTRY_TRAIT) !== 0n;
109966
+ if (isTextEntry(focused)) return true;
109967
+ const screen = hierarchy?.screenFrame;
109968
+ const f = focused.frame;
109969
+ if (!hierarchy?.tree || !screen?.width || !screen.height || !f) return true;
109970
+ const containsField = (node2) => isTextEntry(node2) || (node2.children ?? []).some(containsField);
109971
+ if (focusable.length === 0 && containsField(hierarchy.tree)) return true;
109972
+ const x = f.x * screen.width;
109973
+ const y = f.y * screen.height;
109974
+ const right = x + f.width * screen.width;
109975
+ const bottom = y + f.height * screen.height;
109976
+ const area = (right - x) * (bottom - y);
109977
+ const EPS = 0.5;
109978
+ const encloses = (node2) => {
109979
+ const g = node2.frame;
109980
+ if (g && !node2.children?.length && (node2.label || node2.value) && !node2.traits?.includes("staticText")) {
109981
+ const gArea = g.width * g.height;
109982
+ if (gArea < screen.width * screen.height && gArea > area && g.x - EPS <= x && g.y - EPS <= y && right <= g.x + g.width + EPS && bottom <= g.y + g.height + EPS) {
109983
+ return true;
109984
+ }
109985
+ }
109986
+ return (node2.children ?? []).some(encloses);
109987
+ };
109988
+ return !encloses(hierarchy.tree);
109959
109989
  }
109960
109990
  var TV_HIERARCHY_NODE_CAP = 800;
109961
109991
  var TV_HIERARCHY_CAPPED_HINT = "The Apple TV hierarchy stopped at its 800-element cap, so text past it was not read.";
109962
- function hasTvCursor(tree) {
109963
- return tree.children.some((n) => n.focused);
109992
+ function hasTvCursor(data) {
109993
+ return !data.cursorNotLanded && data.tree.children.some((n) => n.focused);
109964
109994
  }
109965
109995
  async function describeTvFocus(api) {
109966
109996
  const res = await api.describe();
@@ -110853,6 +110883,7 @@ async function pollDescribeTree(args) {
110853
110883
  const remaining = Math.max(0, deadline - Date.now());
110854
110884
  const settled = await settleWithin(fetchTree(remaining), remaining, signal);
110855
110885
  polls += 1;
110886
+ let waitMs = pollIntervalMs;
110856
110887
  if (settled.type === "aborted") return outcome(void 0, true);
110857
110888
  lastAttempt = settled.type === "timeout" ? "unsettled" : settled.type === "error" ? "error" : "tree";
110858
110889
  if (settled.type === "timeout") {
@@ -110870,9 +110901,10 @@ async function pollDescribeTree(args) {
110870
110901
  lastError = void 0;
110871
110902
  const verdict = onSample(settled.value, Date.now());
110872
110903
  if (verdict.done) return outcome(verdict.result, false);
110904
+ waitMs = verdict.waitMs ?? pollIntervalMs;
110873
110905
  }
110874
110906
  if (Date.now() >= deadline) break;
110875
- const sleepMs = Math.min(pollIntervalMs, Math.max(0, deadline - Date.now()));
110907
+ const sleepMs = Math.min(waitMs, Math.max(0, deadline - Date.now()));
110876
110908
  if (!await sleepOrAbort(sleepMs, signal)) return outcome(void 0, true);
110877
110909
  }
110878
110910
  return outcome(void 0, false);
@@ -134300,14 +134332,26 @@ async function tvScreenshot(udid, scale, signal) {
134300
134332
  os20.tmpdir(),
134301
134333
  `argent-tv-screenshot-${udid.slice(0, 8)}-${process.hrtime.bigint()}.png`
134302
134334
  );
134303
- await execFileAsync35("xcrun", await simctlArgsForUdid(udid, ["io", udid, "screenshot", file2]), {
134304
- signal
134305
- });
134306
- if (scale === void 0 || scale < 1) {
134307
- await execFileAsync35("sips", ["-Z", String(await tvTargetLongSide(file2, scale)), file2], {
134335
+ const capture = async (out, type) => {
134336
+ const io = ["io", udid, "screenshot", ...type ? [`--type=${type}`] : [], out];
134337
+ await execFileAsync35("xcrun", await simctlArgsForUdid(udid, io), { signal });
134338
+ };
134339
+ if (scale !== void 0) {
134340
+ await capture(file2);
134341
+ await downscalePngInPlace(file2, scale, signal);
134342
+ return file2;
134343
+ }
134344
+ const jpeg = file2.replace(/\.png$/, ".jpg");
134345
+ await capture(jpeg, "jpeg");
134346
+ try {
134347
+ const longSide = String(await tvTargetLongSide(jpeg, scale));
134348
+ await execFileAsync35("sips", ["-Z", longSide, "-s", "format", "png", jpeg, "--out", file2], {
134308
134349
  signal
134309
- }).catch(() => {
134310
134350
  });
134351
+ } catch {
134352
+ await capture(file2);
134353
+ } finally {
134354
+ await fs48.rm(jpeg, { force: true });
134311
134355
  }
134312
134356
  return file2;
134313
134357
  }
@@ -144060,22 +144104,24 @@ Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutM
144060
144104
  return { done: false };
144061
144105
  }
144062
144106
  const signature = treeSignature(data.tree);
144063
- if (signature === stableSignature) {
144064
- const requiredMs = tvApi && !hasTvCursor(data.tree) ? Math.max(minStableMs, TV_NO_CURSOR_STABLE_MS) : minStableMs;
144065
- if (nowMs - stableSince >= requiredMs) return { done: true, result: true };
144066
- } else {
144107
+ if (signature !== stableSignature) {
144067
144108
  stableSignature = signature;
144068
144109
  stableSince = nowMs;
144069
144110
  if (minStableMs === 0) return { done: true, result: true };
144070
144111
  }
144071
- return { done: false };
144112
+ const requiredMs = tvApi && !hasTvCursor(data) ? Math.max(minStableMs, TV_NO_CURSOR_STABLE_MS) : minStableMs;
144113
+ if (nowMs - stableSince >= requiredMs) return { done: true, result: true };
144114
+ return {
144115
+ done: false,
144116
+ waitMs: Math.min(stableSince + requiredMs - nowMs, pollIntervalMs)
144117
+ };
144072
144118
  }
144073
144119
  });
144074
144120
  const settled = poll.result === true;
144075
144121
  const darkTailMs = Date.now() - lastReadAt;
144076
144122
  const hung = lastReadAt > 0 && darkTailMs > Math.min(DARK_TAIL_POLLS * pollIntervalMs, DARK_TAIL_MAX_MS);
144077
144123
  const note = settled ? poll.lastData?.stale ? poll.lastData.hint : void 0 : unsettledNote(poll.lastData, poll.lastError, hung ? darkTailMs : void 0);
144078
- const populatedNoCursor = tvApi && poll.lastData?.tree.children.length && !hasTvCursor(poll.lastData.tree);
144124
+ const populatedNoCursor = tvApi && poll.lastData?.tree.children.length && !hasTvCursor(poll.lastData);
144079
144125
  const cursorNote = populatedNoCursor ? TV_NO_CURSOR_NOTE : void 0;
144080
144126
  return {
144081
144127
  settled,
@@ -148892,14 +148938,14 @@ function parseHangsXml(xml) {
148892
148938
  function parseLeaksXml(xml) {
148893
148939
  const leaks = [];
148894
148940
  const rowRe = /<row\s+([^>]*?)\/>/g;
148895
- let rm15;
148896
- while ((rm15 = rowRe.exec(xml)) !== null) {
148897
- const objectType = attr(rm15[0], "leaked-object") ?? "Unknown";
148898
- const sizeStr = attr(rm15[0], "size");
148941
+ let rm16;
148942
+ while ((rm16 = rowRe.exec(xml)) !== null) {
148943
+ const objectType = attr(rm16[0], "leaked-object") ?? "Unknown";
148944
+ const sizeStr = attr(rm16[0], "size");
148899
148945
  const sizeBytes = sizeStr ? parseInt(sizeStr, 10) : 0;
148900
- const responsibleFrame = attr(rm15[0], "responsible-frame") ?? "Unknown";
148901
- const responsibleLibrary = attr(rm15[0], "responsible-library") ?? "";
148902
- const countStr = attr(rm15[0], "count");
148946
+ const responsibleFrame = attr(rm16[0], "responsible-frame") ?? "Unknown";
148947
+ const responsibleLibrary = attr(rm16[0], "responsible-library") ?? "";
148948
+ const countStr = attr(rm16[0], "count");
148903
148949
  const count2 = countStr ? parseInt(countStr, 10) : 1;
148904
148950
  leaks.push({
148905
148951
  objectType,
Binary file
Binary file
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.35.0",
3
+ "version": "0.35.1-next.0",
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": "b3cbe2e4a08242b5d2f3d37bb8c6eef53095282b"
101
+ "gitHead": "5807135dfb7d744c16a93b80fd6d7bc0c19f0caf"
102
102
  }