@swmansion/argent 0.34.1-next.68 → 0.34.1-next.69

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
@@ -36294,7 +36294,7 @@ function isCi(env = process.env) {
36294
36294
  var SESSION_ID2 = randomUUID5();
36295
36295
  function readCliVersion() {
36296
36296
  if (true) {
36297
- return "0.34.1-next.68";
36297
+ return "0.34.1-next.69";
36298
36298
  }
36299
36299
  return "0.0.0";
36300
36300
  }
@@ -16994,7 +16994,7 @@ function isCi(env = process.env) {
16994
16994
  var SESSION_ID = randomUUID4();
16995
16995
  function readCliVersion() {
16996
16996
  if (true) {
16997
- return "0.34.1-next.68";
16997
+ return "0.34.1-next.69";
16998
16998
  }
16999
16999
  return "0.0.0";
17000
17000
  }
@@ -30986,6 +30986,7 @@ var AUTO_SCREENSHOT_TOOLS = /* @__PURE__ */ new Set([
30986
30986
  "paste",
30987
30987
  "rotate",
30988
30988
  "fold",
30989
+ "tv-remote",
30989
30990
  "launch-app",
30990
30991
  "restart-app",
30991
30992
  "open-url",
@@ -31009,6 +31010,7 @@ var AUTO_SCREENSHOT_DELAY_MS_BY_TOOL = {
31009
31010
  "gesture-rotate": 1500,
31010
31011
  "run-sequence": 15e3,
31011
31012
  "button": 1500,
31013
+ "tv-remote": 1500,
31012
31014
  "rotate": 1e3,
31013
31015
  // The fold tool already waits for the panel hand-over; the cap covers the
31014
31016
  // repaint after it.
@@ -31038,6 +31040,7 @@ var AUTO_DESCRIBE_TOOLS = /* @__PURE__ */ new Set([
31038
31040
  "paste",
31039
31041
  "rotate",
31040
31042
  "fold",
31043
+ "tv-remote",
31041
31044
  "launch-app",
31042
31045
  "restart-app",
31043
31046
  "open-url",
@@ -16,7 +16,7 @@ export interface ArgentToolArgs {
16
16
  bundleId?: string;
17
17
  };
18
18
  "await-screen-idle": {
19
- /** Target device id from `list-devices` (iOS UDID, Android serial, HarmonyOS id, Mac app id, or Chromium id). */
19
+ /** Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, HarmonyOS id, Mac app id, or Chromium id). */
20
20
  udid: string;
21
21
  /** Max time to wait for the screen to settle before giving up (default 3000). */
22
22
  timeoutMs?: number;
@@ -101462,7 +101462,7 @@ function isCi(env = process.env) {
101462
101462
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101463
101463
  function readCliVersion() {
101464
101464
  if (true) {
101465
- return "0.34.1-next.68";
101465
+ return "0.34.1-next.69";
101466
101466
  }
101467
101467
  return "0.0.0";
101468
101468
  }
@@ -132283,6 +132283,18 @@ function unexplainedHint(hint, detail, params) {
132283
132283
  // ../tool-server/src/tools/describe/platforms/android/index.ts
132284
132284
  init_src2();
132285
132285
  init_adb();
132286
+
132287
+ // ../tool-server/src/utils/uiautomator-lock.ts
132288
+ var uiautomatorDumpLocks = /* @__PURE__ */ new Map();
132289
+ function withUiautomatorLock(serial, fn) {
132290
+ return withKeyedLock(uiautomatorDumpLocks, serial, fn);
132291
+ }
132292
+ function uiautomatorKilledMessage(output2, serial) {
132293
+ if (!/\bKilled\b/.test(output2)) return void 0;
132294
+ return `uiautomator could not capture the screen: ${output2}. Another UiAutomation client (the argent devtools helper, or a test runner such as Espresso or Appium) holds the accessibility connection. Stop it, for the helper with \`${adbCommandPrefix(process.env)}adb -s ${serial} shell am force-stop com.argent.androiddevtools\`, and try again.`;
132295
+ }
132296
+
132297
+ // ../tool-server/src/tools/describe/platforms/android/index.ts
132286
132298
  init_device_info();
132287
132299
 
132288
132300
  // ../tool-server/src/utils/android-screen.ts
@@ -132485,7 +132497,9 @@ function attrIsTrue(attrs, key2) {
132485
132497
  }
132486
132498
  function isInteractive(attrs) {
132487
132499
  if (hasGestureFlag(attrs)) return true;
132488
- if (attrIsTrue(attrs, "focusable") && labelOf(attrs) !== "") return true;
132500
+ if (attrIsTrue(attrs, "focusable") && (labelOf(attrs) !== "" || attrIsTrue(attrs, "focused"))) {
132501
+ return true;
132502
+ }
132489
132503
  return false;
132490
132504
  }
132491
132505
  function labelOf(attrs) {
@@ -132550,6 +132564,8 @@ function makeUiNode(attrs, role, pixelBounds, label, children) {
132550
132564
  checked: attrIsTrue(attrs, "checked"),
132551
132565
  disabled: attrs.enabled === "false",
132552
132566
  password: attrIsTrue(attrs, "password"),
132567
+ focused: attrIsTrue(attrs, "focused"),
132568
+ selected: attrIsTrue(attrs, "selected"),
132553
132569
  scrollHidden: 0
132554
132570
  };
132555
132571
  if (label) out.label = label;
@@ -132631,6 +132647,7 @@ function computeNodeOutput(parsed2, scrollClip, inWebView, outputs, opts) {
132631
132647
  node3.clickable ||= inner.clickable;
132632
132648
  node3.longClickable ||= inner.longClickable;
132633
132649
  node3.scrollable ||= inner.scrollable;
132650
+ node3.focused ||= inner.focused;
132634
132651
  if (!node3.identifier && inner.identifier) node3.identifier = inner.identifier;
132635
132652
  }
132636
132653
  const hidden = hiddenInScroll + (inner?.scrollHidden ?? 0);
@@ -132642,10 +132659,11 @@ function computeNodeOutput(parsed2, scrollClip, inWebView, outputs, opts) {
132642
132659
  if (attrIsTrue(attrs, "password")) {
132643
132660
  label = "[password]";
132644
132661
  }
132645
- if (cls.endsWith(".ImageView") && !interactive && !label) {
132662
+ const selected = attrIsTrue(attrs, "selected");
132663
+ if (cls.endsWith(".ImageView") && !interactive && !label && !selected) {
132646
132664
  return keptChildren;
132647
132665
  }
132648
- if (LAYOUT_CONTAINERS.has(cls) && !interactive && !label) {
132666
+ if (LAYOUT_CONTAINERS.has(cls) && !interactive && !label && !selected) {
132649
132667
  return keptChildren;
132650
132668
  }
132651
132669
  if (!visible && keptChildren.length === 0) return [];
@@ -132657,6 +132675,8 @@ function computeNodeOutput(parsed2, scrollClip, inWebView, outputs, opts) {
132657
132675
  const c = keptChildren[0];
132658
132676
  if (c.clickable && c.pixelBounds && rectsEqual(c.pixelBounds, bounds)) {
132659
132677
  if (!c.label && label) c.label = label;
132678
+ c.focused ||= attrIsTrue(attrs, "focused");
132679
+ c.selected ||= attrIsTrue(attrs, "selected");
132660
132680
  const rid = attrs["resource-id"];
132661
132681
  if (!c.identifier && rid) c.identifier = rid;
132662
132682
  return [c];
@@ -132732,6 +132752,8 @@ function finalizeUiNode(n, children, sw, sh) {
132732
132752
  if (n.scrollable) out.scrollable = true;
132733
132753
  if (n.checkable) out.checkable = true;
132734
132754
  if (n.checked) out.checked = true;
132755
+ if (n.focused) out.focused = true;
132756
+ if (n.selected) out.selected = true;
132735
132757
  if (n.disabled) out.disabled = true;
132736
132758
  if (n.password) out.password = true;
132737
132759
  if (n.scrollHidden > 0) out.scrollHidden = n.scrollHidden;
@@ -134121,13 +134143,25 @@ async function awaitWebViewPublished(first, read) {
134121
134143
  async function uiautomatorDump(serial) {
134122
134144
  const randomSuffix = `${Date.now().toString(36)}-${Math.floor(Math.random() * 1e9).toString(36)}`;
134123
134145
  const dumpPath = `/data/local/tmp/argent-ui-dump-${randomSuffix}.xml`;
134124
- const rawBuf = await adbExecOutBinary(
134146
+ const rawBuf = await withUiautomatorLock(
134125
134147
  serial,
134126
- `uiautomator dump --compressed ${dumpPath} >/dev/null && cat ${dumpPath}; rm -f ${dumpPath}`,
134127
- { timeoutMs: 2e4 }
134148
+ () => adbExecOutBinary(
134149
+ serial,
134150
+ `uiautomator dump --compressed ${dumpPath} >/dev/null && cat ${dumpPath}; rm -f ${dumpPath}`,
134151
+ { timeoutMs: 2e4 }
134152
+ )
134128
134153
  );
134129
134154
  const raw = rawBuf.toString("utf-8");
134130
134155
  const trimmed = raw.trim();
134156
+ const killed = trimmed.includes("<hierarchy") ? void 0 : uiautomatorKilledMessage(trimmed.slice(0, 200), serial);
134157
+ if (killed) {
134158
+ throw new FailureError(killed, {
134159
+ error_code: FAILURE_CODES.ANDROID_UIAUTOMATOR_CAPTURE_FAILED,
134160
+ failure_stage: "android_uiautomator_capture",
134161
+ failure_area: "tool_server",
134162
+ error_kind: "subprocess"
134163
+ });
134164
+ }
134131
134165
  if (/^ERROR:/i.test(trimmed) || !trimmed.includes("<hierarchy") && /error/i.test(trimmed)) {
134132
134166
  throw new FailureError(
134133
134167
  `uiautomator could not capture the screen: ${trimmed}. Common causes: device locked / keyguard, DRM or secure overlay, Play Integrity screen. Unlock the device or take a screenshot as a fallback.`,
@@ -135430,10 +135464,10 @@ function tvControlRef(device) {
135430
135464
  };
135431
135465
  }
135432
135466
  function axSocketPath(udid) {
135433
- return `/tmp/argent-tv-ax-${udid.slice(0, 8)}.sock`;
135467
+ return `/tmp/argent-tv-ax-${udid.slice(0, 8)}-${process.pid}.sock`;
135434
135468
  }
135435
135469
  function hidSocketPath(udid) {
135436
- return `/tmp/argent-tv-hid-${udid.slice(0, 8)}.sock`;
135470
+ return `/tmp/argent-tv-hid-${udid.slice(0, 8)}-${process.pid}.sock`;
135437
135471
  }
135438
135472
  function sendLine(socketPath, line, timeoutMs = 1e4) {
135439
135473
  return new Promise((resolve21, reject) => {
@@ -135467,7 +135501,9 @@ function typeTimeoutMs(textLength) {
135467
135501
  return TYPE_BASE_MS + textLength * TYPE_MS_PER_CHAR;
135468
135502
  }
135469
135503
  async function sendJson(socketPath, command, timeoutMs) {
135470
- const raw = (await sendLine(socketPath, command, timeoutMs)).trim();
135504
+ return parseReply((await sendLine(socketPath, command, timeoutMs)).trim(), command);
135505
+ }
135506
+ function parseReply(raw, command) {
135471
135507
  if (!raw) return {};
135472
135508
  try {
135473
135509
  return JSON.parse(raw);
@@ -135494,6 +135530,10 @@ function spawnAxDaemon(udid, socketPath, axTarget) {
135494
135530
  proc.stderr?.on("data", (data) => process.stderr.write(`[tvos-ax ${tag3}] ${data}`));
135495
135531
  return proc;
135496
135532
  }
135533
+ function reapDaemons(socketPath) {
135534
+ const pattern = `tvos-.* --socket ${socketPath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}`;
135535
+ return new Promise((resolve21) => (0, import_node_child_process25.execFile)("pkill", ["-KILL", "-f", pattern], () => resolve21()));
135536
+ }
135497
135537
  function spawnHidDaemon(udid, socketPath) {
135498
135538
  const proc = (0, import_node_child_process25.execFile)(
135499
135539
  tvosHidDaemonBinaryPath(),
@@ -135585,6 +135625,7 @@ var tvControlBlueprint = {
135585
135625
  const hidSock = hidSocketPath(udid);
135586
135626
  let disposed = false;
135587
135627
  await Promise.all([ensureAutomationEnabled(udid), firstSimulatorPoll()]);
135628
+ await Promise.all([reapDaemons(axSock), reapDaemons(hidSock)]);
135588
135629
  const axTarget = () => simctlTargetForUdidSync(udid, { granted: "ax-service" });
135589
135630
  let axProc = spawnAxDaemon(udid, axSock, axTarget());
135590
135631
  const hidProc = spawnHidDaemon(udid, hidSock);
@@ -135622,6 +135663,7 @@ var tvControlBlueprint = {
135622
135663
  hidProc.removeListener("error", onHidError);
135623
135664
  if (!axProc.killed) axProc.kill("SIGKILL");
135624
135665
  if (!hidProc.killed) hidProc.kill("SIGTERM");
135666
+ await reapDaemons(axSock);
135625
135667
  for (const p of [axSock, hidSock]) {
135626
135668
  try {
135627
135669
  fs33.unlinkSync(p);
@@ -135643,6 +135685,7 @@ var tvControlBlueprint = {
135643
135685
  fs33.unlinkSync(axSock);
135644
135686
  } catch {
135645
135687
  }
135688
+ await reapDaemons(axSock);
135646
135689
  try {
135647
135690
  axProc = spawnAxDaemon(udid, axSock, target);
135648
135691
  axProc.on("exit", onAxExit);
@@ -135693,7 +135736,9 @@ var tvControlBlueprint = {
135693
135736
  for (let attempt = 0; ; attempt++) {
135694
135737
  await ensureAxAlive();
135695
135738
  try {
135696
- return await sendJson(axSock, command, timeoutMs);
135739
+ const raw = (await sendLine(axSock, command, timeoutMs)).trim();
135740
+ if (!raw && axRespawn) throw new Error(`tvOS AX reader was reaped during "${command}"`);
135741
+ return parseReply(raw, command);
135697
135742
  } catch (err) {
135698
135743
  if (axRespawn && attempt < 2) {
135699
135744
  await axRespawn.catch(() => {
@@ -135741,6 +135786,7 @@ var tvControlBlueprint = {
135741
135786
  }
135742
135787
  if (!axProc.killed) axProc.kill("SIGKILL");
135743
135788
  if (!hidProc.killed) hidProc.kill("SIGTERM");
135789
+ await reapDaemons(axSock);
135744
135790
  for (const p of [axSock, hidSock]) {
135745
135791
  try {
135746
135792
  fs33.unlinkSync(p);
@@ -136011,18 +136057,18 @@ var androidTvControlBlueprint = {
136011
136057
  async function dumpHierarchy() {
136012
136058
  const suffix = `${Date.now().toString(36)}-${Math.floor(Math.random() * 1e9).toString(36)}`;
136013
136059
  const dumpPath = `/data/local/tmp/argent-tv-dump-${suffix}.xml`;
136014
- const raw = (await adbExecOutBinary(
136060
+ const raw = (await withUiautomatorLock(
136015
136061
  serial,
136016
- `uiautomator dump --compressed ${dumpPath} >/dev/null && cat ${dumpPath}; rm -f ${dumpPath}`,
136017
- { timeoutMs: 2e4 }
136062
+ () => adbExecOutBinary(
136063
+ serial,
136064
+ `uiautomator dump --compressed ${dumpPath} >/dev/null && cat ${dumpPath}; rm -f ${dumpPath}`,
136065
+ { timeoutMs: 2e4 }
136066
+ )
136018
136067
  )).toString("utf-8");
136019
136068
  if (!raw.includes("<hierarchy")) {
136020
136069
  const output2 = raw.trim().slice(0, 200);
136021
- if (/\bKilled\b/.test(output2)) {
136022
- throw new Error(
136023
- `uiautomator could not capture the screen: ${output2}. Another UiAutomation client (the argent devtools helper, or a test runner such as Espresso or Appium) holds the accessibility connection. Stop it, for the helper with \`${adbCommandPrefix(process.env)}adb shell am force-stop com.argent.androiddevtools\`, and try again.`
136024
- );
136025
- }
136070
+ const killed = uiautomatorKilledMessage(output2, serial);
136071
+ if (killed) throw new Error(killed);
136026
136072
  throw new Error(
136027
136073
  `uiautomator could not capture the screen: ${output2}. The device may be locked or showing a secure overlay \u2014 take a screenshot to confirm.`
136028
136074
  );
@@ -136255,6 +136301,10 @@ function quotedText(data, deviceId, node2, read) {
136255
136301
 
136256
136302
  // ../tool-server/src/utils/poll-describe-tree.ts
136257
136303
  init_src2();
136304
+ var UNWAITABLE_FAILURES = /* @__PURE__ */ new Set([
136305
+ FAILURE_CODES.TOOL_XCODE_FIRST_LAUNCH_PENDING,
136306
+ FAILURE_CODES.VEGA_MULTIPLE_DEVICES
136307
+ ]);
136258
136308
  async function pollDescribeTree(args) {
136259
136309
  const { fetchTree, timeoutMs, pollIntervalMs, signal, onSample } = args;
136260
136310
  const start2 = Date.now();
@@ -136286,9 +136336,8 @@ async function pollDescribeTree(args) {
136286
136336
  break;
136287
136337
  }
136288
136338
  if (settled.type === "error") {
136289
- if (getFailureSignal(settled.cause)?.error_code === FAILURE_CODES.TOOL_XCODE_FIRST_LAUNCH_PENDING) {
136290
- throw settled.cause;
136291
- }
136339
+ const code = getFailureSignal(settled.cause)?.error_code;
136340
+ if (code && UNWAITABLE_FAILURES.has(code)) throw settled.cause;
136292
136341
  lastError = settled.error;
136293
136342
  } else {
136294
136343
  lastData = settled.value;
@@ -140762,9 +140811,16 @@ async function ensureAutomationToolkitEnabled(_serial) {
140762
140811
  // ../tool-server/src/utils/vega-inspect.ts
140763
140812
  var TOOLKIT_DEVICE_PORT = 8383;
140764
140813
  var HOST_PORT_OFFSET = 1e4;
140814
+ var pageSourceLocks = /* @__PURE__ */ new Map();
140765
140815
  async function fetchVegaPageSource(timeoutMs = 15e3) {
140766
140816
  const { serial, consolePort } = await emulatorSerial();
140767
- const hostPort = consolePort + HOST_PORT_OFFSET;
140817
+ return withKeyedLock(
140818
+ pageSourceLocks,
140819
+ serial,
140820
+ () => fetchPageSource(serial, consolePort + HOST_PORT_OFFSET, timeoutMs)
140821
+ );
140822
+ }
140823
+ async function fetchPageSource(serial, hostPort, timeoutMs) {
140768
140824
  await adbForward(serial, hostPort, TOOLKIT_DEVICE_PORT, { timeoutMs: 1e4 });
140769
140825
  try {
140770
140826
  const body = JSON.stringify({ jsonrpc: "2.0", id: 1, method: "getPageSource", params: {} });
@@ -140807,6 +140863,7 @@ function postJson(host, port, path71, body, timeoutMs) {
140807
140863
  let data = "";
140808
140864
  res.setEncoding("utf-8");
140809
140865
  res.on("data", (chunk) => data += chunk);
140866
+ res.on("error", reject);
140810
140867
  res.on("end", () => {
140811
140868
  const status = res.statusCode ?? 0;
140812
140869
  if (status < 200 || status >= 300) {
@@ -164594,7 +164651,7 @@ function createTvRemoteTool(registry2) {
164594
164651
  id: "tv-remote",
164595
164652
  description: `Press a TV remote / D-pad button (or a whole path of them) on a TV device: Apple TV (tvOS), Android TV (leanback), or Vega (Fire TV).
164596
164653
  A TV is navigated with a directional remote, not touch. Use when you need to move focus or press a key on a TV, instead of gesture-tap/swipe (which do not apply on a TV).
164597
- Read the screen with \`describe\` before and after to see where focus landed.
164654
+ Call \`describe\` before the first press to find the cursor. Read where focus landed from the element tree in this result, or call \`describe\` again when it is missing.
164598
164655
  Returns { pressed, count }. Fails on a target that is not a TV, and on the Apple TV simulator for rewind, fastForward, next, previous, volumeUp, volumeDown and mute (its HID stack ignores them); every other button works on all three platforms.`,
164599
164656
  zodSchema: zodSchema29,
164600
164657
  searchHint: "tv remote dpad d-pad navigate focus up down left right select ok back home menu play pause rewind fast forward sequence path apple tv tvos android tv leanback vega fire tv",
@@ -168197,7 +168254,7 @@ function formatDescribeTree(root, opts) {
168197
168254
  var sleep16 = (ms3) => new Promise((r) => setTimeout(r, ms3));
168198
168255
  var EMPTY_RETRY_ATTEMPTS = 3;
168199
168256
  var EMPTY_RETRY_DELAY_MS = 600;
168200
- var EMPTY_HINT2 = "No focusable elements after retrying and recycling the read path. The app is most likely still launching (splash / loading screen) or mid-transition \u2014 this is normal right after launch-app / restart-app. Wait ~2-3s and call describe again; a React Native app only exposes focus once its JS bundle has loaded. If it stays empty, take a screenshot to confirm what's actually on screen.";
168257
+ var EMPTY_HINT2 = "No focusable elements after retrying and recycling the read path. Either the app is still loading or mid-transition (after launch-app / restart-app, or a press that opened an app), or the screen has nothing focusable (sleep, screensaver, video playback). Wait ~2-3s and call describe again; a React Native app only exposes focus once its JS bundle has loaded. If it stays empty, take a screenshot to confirm what's actually on screen.";
168201
168258
  var ANDROID_FOCUS_EMPTY_HINT = "The Android TV focus engine reported no focusable elements \u2014 common on react-native-tvos screens that drive focus with RN's own engine (invisible to the OS accessibility tree). Falling back to the full UI tree below. `tv-remote` (direction/select) still moves focus on these screens even though the labels aren't enumerable, so you can drive blind + screenshot to confirm.";
168202
168259
  function fmtElement(e) {
168203
168260
  const traits = e.traits?.length ? ` [${e.traits.join(",")}]` : "";
@@ -168350,13 +168407,13 @@ function createDescribeTool(registry2) {
168350
168407
  // Android's device probes plus the tree dump can outlast the 30s MCP fetch timeout.
168351
168408
  longRunning: true,
168352
168409
  description: `Get the accessibility / DOM element tree for the current screen.
168353
- Use when you need element frames or labels and have no fresh tree: most interaction tools (not tv-remote or shake) already return one after each action, or name an identical earlier one by its tree id.
168410
+ Use when you need element frames or labels and have no fresh tree: most interaction tools (not shake) already return one after each action, or name an identical earlier one by its tree id.
168354
168411
  On iOS it reads the AXRuntime accessibility service, so it sees whatever is visible, including system dialogs and permission prompts. While a system dialog is visible it returns the dialog's elements (buttons, text); otherwise the foreground app's. On a physical iOS device it covers only the app started with launch-app; to read system dialogs there, launch-app \`com.apple.springboard\` first. On a local iOS simulator a text field shows its placeholder as its value, with no label, so an empty field reads like one holding that text. A text field with no accessibility label or identifier (e.g. the Settings search field) can also be missing from the tree, even with text typed in it. Check a screenshot in both cases.
168355
168412
  On Android it reads the tree through Argent's UiAutomation helper, falling back to \`uiautomator dump\`. On Chromium it walks the DOM over the Chrome DevTools Protocol: every visible element with its ARIA role, accessible name and the visible part of its bounding rect; content scrolled or clipped out of view, or skipped by a closed \`<details>\` or \`content-visibility: hidden\`, has a zero-area frame.
168356
168413
  On Vega (Fire TV) it reads the on-device automation toolkit; \`[focused]\`/\`[selected]\` mark the D-pad cursor, which you move with \`tv-remote\` (Vega has no touch).<flag:harmonyos>
168357
168414
  On HarmonyOS it runs the device's \`uitest dumpLayout\` (\`source: "harmony-uitest"\`); each top-level child is a window whose \`identifier\` (not its label) is the owning bundle, so an app plus the status bar reads as two windows. A suspended display still dumps its last frame, so the result then carries a \`hint\`, as it does for an empty dump.</flag:harmonyos><flag:macos-apps>
168358
168415
  On a Mac app it reads the app's accessibility tree with web view content and React Native testIDs merged in; frames are fractions of the app window, grown to include sheets and menus past it.</flag:macos-apps>
168359
- On a TV target (Apple TV / Android TV: a \`list-devices\` entry with runtimeKind 'tv') it returns the FOCUSED element and the FOCUSABLE elements instead, since a TV UI has no tap coordinates. Move the highlight with \`tv-remote\`, then call describe again to confirm where focus landed.
168416
+ On a TV target (Apple TV / Android TV: a \`list-devices\` entry with runtimeKind 'tv') it returns the FOCUSED element and the FOCUSABLE elements instead, since a TV UI has no tap coordinates. Move the highlight with \`tv-remote\`, then read where focus landed from the tree in its result, or call describe again when it is missing.
168360
168417
 
168361
168418
  Returns \`{ description, source }\`: \`description\` renders the tree one line per element, with its role, label/value/id, VoiceOver hint (iOS simulator), interactivity flags and frame. Frames are normalized [0,1] fractions of the screen / window width and height (not pixels); tap an element at the centre of its frame. The tree has no z-order or occlusion information: an element may be covered by an overlay (e.g. a toolbar over list rows), so check a screenshot when a tap lands unexpectedly.
168362
168419
  Fails if the tree cannot be read, e.g. on a physical iOS device before launch-app has started an app.
@@ -169501,6 +169558,7 @@ var capability30 = {
169501
169558
  appleRemote: { simulator: true },
169502
169559
  android: { emulator: true, device: true, unknown: true },
169503
169560
  chromium: { app: true },
169561
+ vega: { vvd: true },
169504
169562
  harmony: { device: true },
169505
169563
  macos: { app: true, catalyst: true }
169506
169564
  };
@@ -169510,7 +169568,7 @@ function treeSignature(root) {
169510
169568
  const walk = (node2) => {
169511
169569
  const f = node2.frame;
169512
169570
  parts2.push(
169513
- `${node2.role}|${node2.label ?? ""}|${node2.value ?? ""}|${round3(f.x)},${round3(f.y)},${round3(f.width)},${round3(f.height)}`
169571
+ `${node2.role}|${node2.label ?? ""}|${node2.value ?? ""}|${round3(f.x)},${round3(f.y)},${round3(f.width)},${round3(f.height)}|${node2.focused ? "F" : ""}${node2.selected ? "S" : ""}`
169514
169572
  );
169515
169573
  for (const child of node2.children) walk(child);
169516
169574
  };
@@ -169533,7 +169591,7 @@ function unsettledNote(lastData, lastError, darkTailMs) {
169533
169591
  }
169534
169592
  var zodSchema44 = external_exports.object({
169535
169593
  udid: external_exports.string().min(1).describe(
169536
- "Target device id from `list-devices` (iOS UDID, Android serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
169594
+ "Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
169537
169595
  ),
169538
169596
  timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(
169539
169597
  `Max time to wait for the screen to settle before giving up (default ${DEFAULT_TIMEOUT_MS4}).`
@@ -169555,6 +169613,9 @@ function createAwaitScreenIdleTool(registry2) {
169555
169613
  if (device.platform === "android") {
169556
169614
  return describeAndroid(registry2, device.id, void 0, androidIsTv);
169557
169615
  }
169616
+ if (device.platform === "vega") {
169617
+ return describeVega(device.id);
169618
+ }
169558
169619
  if (device.platform === "harmony") {
169559
169620
  return pollHarmonyTree(harmonyConnectKey(device.id), budgetMs);
169560
169621
  }
@@ -169591,6 +169652,7 @@ Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutM
169591
169652
  if (device.platform === "ios") await ensureDeps(iosRequires);
169592
169653
  else if (device.platform === "ios-remote") await ensureDeps(["sim-remote"]);
169593
169654
  else if (device.platform === "android") await ensureDeps(androidRequires);
169655
+ else if (device.platform === "vega") await ensureDeps(vegaRequires);
169594
169656
  else if (device.platform === "harmony") await ensureDeps(harmonyRequires);
169595
169657
  const isTvOs = device.platform === "ios" && device.kind !== "device" && await isTvOsSimulator(device.id);
169596
169658
  const tvApi = isTvOs ? await resolveTvApi(registry2, device.id) : null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.68",
3
+ "version": "0.34.1-next.69",
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",
@@ -8,7 +8,7 @@ description: Control and inspect TV apps via argent, Apple TV (tvOS), Android TV
8
8
  ## Critical
9
9
 
10
10
  - A TV is **focus-driven, not touch-driven.** Drive every interaction with `describe` + `tv-remote` + `keyboard`; never use `gesture-*` / coordinate taps; they don't apply on any TV platform.
11
- - **Always `describe` before navigating** to find the live cursor and your target; never guess focus from a screenshot. The cursor is the focused element; on **Vega** the toolkit often leaves `focused` false and marks the highlighted item `[selected]`, so treat `[selected]` as the cursor when nothing reports `[focused]`.
11
+ - **Always read the focus view before navigating** (`describe`, or the tree the last action returned) to find the live cursor and your target; never guess focus from a screenshot. The cursor is the focused element; on **Vega** the toolkit often leaves `focused` false and marks the highlighted item `[selected]`, so treat `[selected]` as the cursor when nothing reports `[focused]`.
12
12
  - Pass the `udid` from `list-devices`: an Apple TV simulator UDID or an Android TV / Vega `serial`. Dispatch is automatic from the id; the same tools drive all three.
13
13
  - **E2E tests: Vega only.** Apple TV and Android TV have no e2e support (a `tap:` can pass without doing anything): report that limitation.
14
14
  - **Fire TV (Vega)** (`platform: "vega"` in `list-devices`): read `references/vega.md` before driving it. It covers booting and stopping the VVD, Fast Refresh, and debugging the JS runtime.
@@ -16,8 +16,8 @@ description: Control and inspect TV apps via argent, Apple TV (tvOS), Android TV
16
16
  ## The navigation loop
17
17
 
18
18
  1. `describe`: find the cursor and your target.
19
- 2. `tv-remote`: move focus toward the target. Prefer **one** call with a path ending in `select`, e.g. `{button:["down","right","select"]}`; count rows/columns from the list order.
20
- 3. `describe` again to confirm, or on Apple TV `await-ui-element {condition:"exists", selector:{text:"X", role:"focused"}}`. On a miss, repeat.
19
+ 2. `tv-remote`: move focus toward the target. Prefer **one** call with a path ending in `select`, e.g. `{button:["down","right","select"]}`; on Vega, count rows/columns from the frames to build the path. The Apple TV / Android TV focus view is a flat list with no positions: count from the list order, and read the grid's shape from the screenshot.
20
+ 3. Read where focus landed from the focus view returned under `--- Elements after action (describe) ---`; call `describe` only when that section is missing. To wait for focus to land on Apple TV, `await-ui-element {condition:"exists", selector:{text:"X", role:"focused"}}`. On a miss, repeat.
21
21
 
22
22
  ## Tools
23
23