@swmansion/argent 0.27.1-next.14 → 0.27.1-next.16

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
package/dist/cli-cmds.mjs CHANGED
@@ -21916,7 +21916,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
21916
21916
  var SESSION_ID2 = randomUUID5();
21917
21917
  function readCliVersion() {
21918
21918
  if (true) {
21919
- return "0.27.1-next.14";
21919
+ return "0.27.1-next.16";
21920
21920
  }
21921
21921
  return "0.0.0";
21922
21922
  }
package/dist/client.d.ts CHANGED
@@ -45,7 +45,7 @@ export interface UiTreeNode {
45
45
  bundleId?: string;
46
46
  editable?: boolean;
47
47
  heading?: boolean;
48
- /** iOS: on screen, but behind an in-app presentation or a system alert. */
48
+ /** On screen, but behind an in-app presentation (iOS) or a system alert. */
49
49
  covered?: boolean;
50
50
  placeholder?: string;
51
51
  /** The input shows its placeholder: it holds no text, and `value` is unset. */
@@ -62,14 +62,23 @@ export interface UiTree {
62
62
  width: number;
63
63
  height: number;
64
64
  };
65
- /** While an iOS system alert shows, the system app first and the app it covers second. */
65
+ /**
66
+ * iOS: while a system alert shows, the system app first and the app it covers
67
+ * second. Android: one root per window, topmost first.
68
+ */
66
69
  roots: UiTreeNode[];
67
70
  truncated: boolean;
68
71
  alertVisible?: boolean;
69
72
  keyboardVisible?: boolean;
70
- /** The bundle id of the app in front, under any system alert. */
73
+ /**
74
+ * The bundle id or package of the app in front, under any system alert.
75
+ * Android: unset when the alert hides the app's window.
76
+ */
71
77
  foregroundApp?: string;
72
- /** Fields this source cannot report. */
78
+ /**
79
+ * Fields this source cannot report. On Android they depend on the API level:
80
+ * `placeholder` and `hintShowing` need 26, `heading` 28.
81
+ */
73
82
  unsupportedFields: string[];
74
83
  }
75
84
  export interface CallToolOptions {
@@ -16730,7 +16730,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16730
16730
  var SESSION_ID = randomUUID4();
16731
16731
  function readCliVersion() {
16732
16732
  if (true) {
16733
- return "0.27.1-next.14";
16733
+ return "0.27.1-next.16";
16734
16734
  }
16735
16735
  return "0.0.0";
16736
16736
  }
@@ -94814,7 +94814,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
94814
94814
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
94815
94815
  function readCliVersion() {
94816
94816
  if (true) {
94817
- return "0.27.1-next.14";
94817
+ return "0.27.1-next.16";
94818
94818
  }
94819
94819
  return "0.0.0";
94820
94820
  }
@@ -136454,26 +136454,40 @@ async function queryAndroidFullHierarchy(registry2, device) {
136454
136454
  }
136455
136455
 
136456
136456
  // ../tool-server/src/tools/ui-tree/android.ts
136457
- var UNSUPPORTED_FIELDS = [
136457
+ var LEGACY_UNSUPPORTED_FIELDS2 = [
136458
136458
  "placeholder",
136459
136459
  "hintShowing",
136460
136460
  "hidden",
136461
136461
  "heading",
136462
136462
  "keyboardVisible",
136463
- "foregroundApp"
136463
+ "foregroundApp",
136464
+ "alertVisible"
136464
136465
  ];
136465
- function mapNode(xml, screenW, screenH, isRoot) {
136466
+ var TYPE_APPLICATION = 1;
136467
+ var TYPE_INPUT_METHOD = 2;
136468
+ var TYPE_SYSTEM = 3;
136469
+ var SYSTEM_DIALOG_PACKAGES = /* @__PURE__ */ new Set([
136470
+ "com.android.packageinstaller",
136471
+ "com.google.android.packageinstaller",
136472
+ "com.android.permissioncontroller",
136473
+ "com.google.android.permissioncontroller",
136474
+ "com.android.systemui"
136475
+ ]);
136476
+ var SYSTEM_SHEET_PACKAGES = /* @__PURE__ */ new Set(["android", "com.android.intentresolver"]);
136477
+ function mapNode(xml, screenW, screenH, isRoot, v2) {
136466
136478
  const a = xml.attrs;
136467
136479
  const type = a.class ?? "";
136468
136480
  const password = attrIsTrue(a, "password");
136469
- const text = password ? "" : a.text ?? "";
136481
+ const hintShowing = v2 && attrIsTrue(a, "showing-hint");
136482
+ const text = password || hintShowing ? "" : a.text ?? "";
136470
136483
  const desc = a["content-desc"] ?? "";
136471
136484
  const rect = parseUiAutomatorBounds(a.bounds ?? "");
136472
- const editable = type.endsWith("EditText") || type.endsWith("AutoCompleteTextView");
136485
+ const textInput = type.endsWith("EditText") || type.endsWith("AutoCompleteTextView");
136486
+ const editable = v2 ? attrIsTrue(a, "editable") || textInput && a.enabled === "false" : textInput;
136473
136487
  const node = { role: deriveUiAutomatorRole(type), children: [] };
136474
136488
  if (type) node.type = type;
136475
136489
  if (text || desc) node.label = text || desc;
136476
- if (editable && text) node.value = text;
136490
+ if ((editable || textInput) && text) node.value = text;
136477
136491
  if (desc) node.contentDescription = desc;
136478
136492
  if (a["resource-id"]) node.identifier = a["resource-id"];
136479
136493
  if (isRoot && a.package) node.bundleId = a.package;
@@ -136491,31 +136505,87 @@ function mapNode(xml, screenW, screenH, isRoot) {
136491
136505
  if (attrIsTrue(a, "checkable")) node.checked = attrIsTrue(a, "checked");
136492
136506
  if (password) node.password = true;
136493
136507
  if (editable) node.editable = true;
136508
+ if (v2) {
136509
+ if (a.hint) node.placeholder = a.hint;
136510
+ if (hintShowing) node.hintShowing = true;
136511
+ const empty2 = node.frame && (node.frame.width <= 0 || node.frame.height <= 0);
136512
+ if (a["visible-to-user"] === "false" || empty2) node.hidden = true;
136513
+ if (attrIsTrue(a, "heading")) node.heading = true;
136514
+ }
136494
136515
  for (const child of xml.children) {
136495
- if (child.tag === "node") node.children.push(mapNode(child, screenW, screenH, false));
136516
+ if (child.tag === "node") node.children.push(mapNode(child, screenW, screenH, false, v2));
136496
136517
  }
136497
136518
  return node;
136498
136519
  }
136499
- function adaptAndroidTree(xml, truncated, screen) {
136500
- const root = parseUiAutomatorXml(xml);
136501
- const roots = (root?.children ?? []).filter((c) => c.tag === "node").map((c) => mapNode(c, screen.width, screen.height, true));
136502
- return {
136520
+ function onScreen(frame) {
136521
+ if (!frame) return false;
136522
+ const w = Math.min(frame.x + frame.width, 1) - Math.max(frame.x, 0);
136523
+ const h = Math.min(frame.y + frame.height, 1) - Math.max(frame.y, 0);
136524
+ return w > 0 && h > 0;
136525
+ }
136526
+ function fillsScreen(frame) {
136527
+ return !!frame && frame.x <= 0 && frame.x + frame.width >= 1 && frame.y <= 0.1;
136528
+ }
136529
+ function markCovered(node) {
136530
+ node.covered = true;
136531
+ for (const child of node.children) markCovered(child);
136532
+ }
136533
+ function adaptAndroidTree(capture, screen) {
136534
+ const { xml, truncated } = capture;
136535
+ const v2 = (capture.treeVersion ?? 1) >= 2;
136536
+ const windows = (parseUiAutomatorXml(xml)?.children ?? []).filter((c) => c.tag === "node");
136537
+ const roots = windows.map((c) => mapNode(c, screen.width, screen.height, true, v2));
136538
+ const tree = {
136503
136539
  schemaVersion: 1,
136504
136540
  source: "android-devtools",
136505
136541
  screen: { width: screen.width, height: screen.height },
136506
136542
  roots,
136507
136543
  truncated,
136508
- unsupportedFields: UNSUPPORTED_FIELDS
136544
+ unsupportedFields: LEGACY_UNSUPPORTED_FIELDS2
136509
136545
  };
136546
+ if (!v2) return tree;
136547
+ const unsupported = [];
136548
+ const sdk = capture.sdkInt ?? 0;
136549
+ if (sdk < 26) unsupported.push("placeholder", "hintShowing");
136550
+ if (sdk < 28) unsupported.push("heading");
136551
+ if (capture.captureMode === "active-window") {
136552
+ unsupported.push("keyboardVisible", "foregroundApp", "alertVisible");
136553
+ } else {
136554
+ let keyboard = false;
136555
+ let foreground;
136556
+ let alert = false;
136557
+ windows.forEach((w, i) => {
136558
+ const windowType = Number(w.attrs["window-type"]);
136559
+ const root = roots[i];
136560
+ if (windowType === TYPE_INPUT_METHOD && onScreen(root.frame)) keyboard = true;
136561
+ if (foreground !== void 0 || !root.bundleId) return;
136562
+ if (windowType === TYPE_SYSTEM && root.bundleId === "android") alert = true;
136563
+ if (windowType !== TYPE_APPLICATION) return;
136564
+ if (SYSTEM_SHEET_PACKAGES.has(root.bundleId) || SYSTEM_DIALOG_PACKAGES.has(root.bundleId) && !fillsScreen(root.frame)) {
136565
+ alert = true;
136566
+ } else foreground = i;
136567
+ });
136568
+ const unknown2 = truncated ? void 0 : false;
136569
+ tree.keyboardVisible = keyboard || unknown2;
136570
+ if (foreground !== void 0) tree.foregroundApp = roots[foreground].bundleId;
136571
+ tree.alertVisible = alert || (foreground === void 0 ? unknown2 : false);
136572
+ if (alert && foreground !== void 0) {
136573
+ for (let i = foreground; i < roots.length; i++) {
136574
+ if (roots[i].bundleId === tree.foregroundApp) markCovered(roots[i]);
136575
+ }
136576
+ }
136577
+ }
136578
+ tree.unsupportedFields = unsupported;
136579
+ return tree;
136510
136580
  }
136511
136581
  async function readAndroidUiTree(registry2, device) {
136512
136582
  const ref = androidDevtoolsRef(device);
136513
136583
  const devtools = await registry2.resolveService(ref.urn, ref.options);
136514
- const [{ xml, truncated }, size] = await Promise.all([
136584
+ const [capture, size] = await Promise.all([
136515
136585
  devtools.getHierarchy({ maxNodes: FLOW_MAX_NODES, clearCache: true }),
136516
136586
  devtools.getScreenSize()
136517
136587
  ]);
136518
- return adaptAndroidTree(xml, truncated, size);
136588
+ return adaptAndroidTree(capture, size);
136519
136589
  }
136520
136590
 
136521
136591
  // ../tool-server/src/tools/ui-tree/index.ts
@@ -136524,6 +136594,7 @@ var zodSchema40 = external_exports.object({
136524
136594
  });
136525
136595
  var capability25 = {
136526
136596
  apple: { simulator: true },
136597
+ appleRemote: { simulator: true },
136527
136598
  android: { emulator: true, device: true, unknown: true }
136528
136599
  };
136529
136600
  function createUiTreeTool(registry2) {
@@ -136554,6 +136625,12 @@ Fails if the iOS ax-service predates the tree command; update argent.`,
136554
136625
  return readIosUiTree(registry2, device);
136555
136626
  }
136556
136627
  },
136628
+ iosRemote: {
136629
+ // ax-service routes through sim-remote for an ios-remote device, so
136630
+ // only the preflight dep differs from the ios branch.
136631
+ requires: ["sim-remote"],
136632
+ handler: async (_services, _params, device) => readIosUiTree(registry2, device)
136633
+ },
136557
136634
  android: {
136558
136635
  requires: androidRequires,
136559
136636
  handler: async (_services, _params, device) => readAndroidUiTree(registry2, device)
@@ -149916,12 +149993,12 @@ function wrapPreservingFailure(message, err) {
149916
149993
  return signal ? new FailureError(message, signal, { cause }) : new Error(message, { cause });
149917
149994
  }
149918
149995
  function projectIosDeviceNode(node) {
149919
- const onScreen = node.frame.width > 0 && node.frame.height > 0;
149996
+ const onScreen2 = node.frame.width > 0 && node.frame.height > 0;
149920
149997
  return {
149921
149998
  skip: false,
149922
149999
  children: node.children,
149923
150000
  // Off-screen text must not hoist.
149924
- ownText: onScreen ? nodeText(node) : "",
150001
+ ownText: onScreen2 ? nodeText(node) : "",
149925
150002
  leaf: { ...node, children: [] },
149926
150003
  shield: Boolean(node.identifier),
149927
150004
  // Scroll-clip inputs (see `flattenHoisting`), in the adapter's normalized
@@ -149956,12 +150033,12 @@ async function queryIosDeviceFlowTree(registry2, device) {
149956
150033
 
149957
150034
  // ../tool-server/src/tools/flows/flow-chromium-tree.ts
149958
150035
  function projectChromiumNode(node) {
149959
- const onScreen = node.frame.width > 0 && node.frame.height > 0;
150036
+ const onScreen2 = node.frame.width > 0 && node.frame.height > 0;
149960
150037
  const addressable = Boolean(
149961
150038
  node.identifier || node.label || node.value || node.clickable || node.focused
149962
150039
  );
149963
150040
  let leaf = null;
149964
- if (onScreen && addressable) {
150041
+ if (onScreen2 && addressable) {
149965
150042
  leaf = { ...node, children: [] };
149966
150043
  if (node.password) {
149967
150044
  leaf.label = "[password]";
@@ -149974,7 +150051,7 @@ function projectChromiumNode(node) {
149974
150051
  // Off-screen text must not hoist, or a text assert against an ancestor
149975
150052
  // would pass on content the screen doesn't show. A password's text never
149976
150053
  // bubbles up.
149977
- ownText: onScreen && !node.password ? nodeText(node) : "",
150054
+ ownText: onScreen2 && !node.password ? nodeText(node) : "",
149978
150055
  leaf,
149979
150056
  shield: Boolean(node.identifier) || node.password === true
149980
150057
  };
@@ -150000,13 +150077,13 @@ async function queryChromiumTree(registry2, device) {
150000
150077
 
150001
150078
  // ../tool-server/src/tools/flows/flow-vega-tree.ts
150002
150079
  function projectVegaNode(node) {
150003
- const onScreen = node.frame.width > 0 && node.frame.height > 0;
150080
+ const onScreen2 = node.frame.width > 0 && node.frame.height > 0;
150004
150081
  return {
150005
150082
  skip: false,
150006
150083
  children: node.children,
150007
150084
  // Off-screen text must not hoist, or a text assert against an ancestor
150008
150085
  // would pass on content the screen doesn't show.
150009
- ownText: onScreen ? nodeText(node) : "",
150086
+ ownText: onScreen2 ? nodeText(node) : "",
150010
150087
  leaf: { ...node, children: [] },
150011
150088
  shield: isAuthoredVegaTestId(node.identifier)
150012
150089
  };
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.27.1-next.14",
3
+ "version": "0.27.1-next.16",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",