@swmansion/argent 0.30.0 → 0.30.1-next.1

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
@@ -35549,7 +35549,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
35549
35549
  var SESSION_ID2 = randomUUID5();
35550
35550
  function readCliVersion() {
35551
35551
  if (true) {
35552
- return "0.30.0";
35552
+ return "0.30.1-next.1";
35553
35553
  }
35554
35554
  return "0.0.0";
35555
35555
  }
@@ -16875,7 +16875,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16875
16875
  var SESSION_ID = randomUUID4();
16876
16876
  function readCliVersion() {
16877
16877
  if (true) {
16878
- return "0.30.0";
16878
+ return "0.30.1-next.1";
16879
16879
  }
16880
16880
  return "0.0.0";
16881
16881
  }
@@ -100766,7 +100766,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
100766
100766
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
100767
100767
  function readCliVersion() {
100768
100768
  if (true) {
100769
- return "0.30.0";
100769
+ return "0.30.1-next.1";
100770
100770
  }
100771
100771
  return "0.0.0";
100772
100772
  }
@@ -102129,7 +102129,7 @@ var import_node_path6 = __toESM(require("node:path"));
102129
102129
  var import_semver2 = __toESM(require_semver2());
102130
102130
 
102131
102131
  // ../tool-server/package.json
102132
- var version2 = "0.30.0";
102132
+ var version2 = "0.30.1";
102133
102133
 
102134
102134
  // ../tool-server/src/utils/update-checker.ts
102135
102135
  var import_update_core = __toESM(require_dist7());
@@ -133053,12 +133053,18 @@ async function injectAndroidNamedKey(serial, name) {
133053
133053
 
133054
133054
  // ../tool-server/src/blueprints/android-tv-control.ts
133055
133055
  var ANDROID_TV_CONTROL_NAMESPACE = "AndroidTvControl";
133056
- function androidTvControlRef(device) {
133056
+ function androidTvControlRef(device, registry2) {
133057
133057
  return {
133058
133058
  urn: `${ANDROID_TV_CONTROL_NAMESPACE}:${device.id}`,
133059
- options: { device }
133059
+ options: registry2 ? { device, readHelperHierarchy: () => readHelperHierarchy(registry2, device) } : { device }
133060
133060
  };
133061
133061
  }
133062
+ async function readHelperHierarchy(registry2, device) {
133063
+ const ref = androidDevtoolsRef(device);
133064
+ const devtools = await registry2.resolveService(ref.urn, ref.options);
133065
+ const { xml } = await devtools.getHierarchy({ clearCache: true });
133066
+ return xml;
133067
+ }
133062
133068
  var KEYEVENTS = {
133063
133069
  up: 19,
133064
133070
  // KEYCODE_DPAD_UP
@@ -133098,14 +133104,24 @@ function valueOf(attrs) {
133098
133104
  const text = (attrs.text ?? "").trim();
133099
133105
  return cd && text && cd !== text ? text : "";
133100
133106
  }
133107
+ var WINDOW_TYPE_INPUT_METHOD = "2";
133108
+ function hasFocusedNode(node2) {
133109
+ return attrIsTrue(node2.attrs, "focused") || node2.children.some(hasFocusedNode);
133110
+ }
133111
+ function activeWindow(root) {
133112
+ const windows = root.children.filter((c) => c.attrs["window-type"] !== void 0);
133113
+ if (windows.length === 0) return root;
133114
+ return windows.find(hasFocusedNode) ?? windows.find((w) => w.attrs["window-type"] !== WINDOW_TYPE_INPUT_METHOD) ?? windows[0];
133115
+ }
133101
133116
  function collectTvNodes(xml) {
133102
133117
  const root = parseUiAutomatorXml(xml);
133103
133118
  const focusable = [];
133104
133119
  let focused = null;
133105
133120
  if (!root) return { focused, focusable };
133106
- const stack = [root];
133121
+ const stack = [activeWindow(root)];
133107
133122
  while (stack.length > 0) {
133108
133123
  const node2 = stack.pop();
133124
+ if (node2.attrs["visible-to-user"] === "false") continue;
133109
133125
  for (let i = node2.children.length - 1; i >= 0; i--) stack.push(node2.children[i]);
133110
133126
  const attrs = node2.attrs;
133111
133127
  const isFocusable = attrIsTrue(attrs, "focusable");
@@ -133156,7 +133172,7 @@ var androidTvControlBlueprint = {
133156
133172
  `${ANDROID_TV_CONTROL_NAMESPACE}.factory requires a resolved DeviceInfo via options.device. Use androidTvControlRef(device) when registering the service ref.`
133157
133173
  );
133158
133174
  }
133159
- const { device } = opts;
133175
+ const { device, readHelperHierarchy: readHelperHierarchy2 } = opts;
133160
133176
  if (typeof device.id !== "string" || device.id.length === 0) {
133161
133177
  throw new Error(
133162
133178
  `${ANDROID_TV_CONTROL_NAMESPACE}.factory requires a non-empty device.id; got ${JSON.stringify(device.id)}.`
@@ -133186,14 +133202,32 @@ var androidTvControlBlueprint = {
133186
133202
  { timeoutMs: 2e4 }
133187
133203
  )).toString("utf-8");
133188
133204
  if (!raw.includes("<hierarchy")) {
133205
+ const output2 = raw.trim().slice(0, 200);
133206
+ if (/\bKilled\b/.test(output2)) {
133207
+ throw new Error(
133208
+ `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 \`adb shell am force-stop com.argent.androiddevtools\`, and try again.`
133209
+ );
133210
+ }
133189
133211
  throw new Error(
133190
- `uiautomator could not capture the screen: ${raw.trim().slice(0, 200)}. The device may be locked or showing a secure overlay \u2014 take a screenshot to confirm.`
133212
+ `uiautomator could not capture the screen: ${output2}. The device may be locked or showing a secure overlay \u2014 take a screenshot to confirm.`
133191
133213
  );
133192
133214
  }
133193
133215
  return raw;
133194
133216
  }
133217
+ async function readHierarchy() {
133218
+ if (readHelperHierarchy2) {
133219
+ try {
133220
+ return await readHelperHierarchy2();
133221
+ } catch (err) {
133222
+ console.debug(
133223
+ `[android-tv-control] devtools helper failed, falling back to uiautomator dump: ${err instanceof Error ? err.message : String(err)}`
133224
+ );
133225
+ }
133226
+ }
133227
+ return dumpHierarchy();
133228
+ }
133195
133229
  async function read() {
133196
- return collectTvNodes(await dumpHierarchy());
133230
+ return collectTvNodes(await readHierarchy());
133197
133231
  }
133198
133232
  async function pressKey(direction) {
133199
133233
  await adbShell(serial, `input keyevent ${KEYEVENTS[direction]}`, { timeoutMs: 1e4 });
@@ -140085,8 +140119,8 @@ init_device_info();
140085
140119
  var sleep2 = (ms) => new Promise((r) => setTimeout(r, ms));
140086
140120
  var zodSchema17 = external_exports.object({
140087
140121
  udid: external_exports.string().describe("Target device id from `list-devices` (iOS UDID, Android serial, or Chromium id)."),
140088
- x: external_exports.number().describe("Normalized horizontal position 0.0\u20131.0 (left=0, right=1), not pixels"),
140089
- y: external_exports.number().describe("Normalized vertical position 0.0\u20131.0 (top=0, bottom=1), not pixels"),
140122
+ x: external_exports.number().min(0).max(1).describe("Normalized horizontal position 0.0\u20131.0 (left=0, right=1), not pixels"),
140123
+ y: external_exports.number().min(0).max(1).describe("Normalized vertical position 0.0\u20131.0 (top=0, bottom=1), not pixels"),
140090
140124
  clickCount: external_exports.number().int().min(1).max(10).optional().describe(
140091
140125
  "Number of taps/clicks dispatched as ONE multi-tap gesture (2 = double-tap / double-click). The taps land inside the OS double-tap window; on Chromium each click carries an escalating CDP clickCount so dblclick actually fires; on physical iOS 2 is the native double-tap and higher counts land as separate taps. Default 1."
140092
140126
  )
@@ -140200,10 +140234,10 @@ var MOMENTUM_FREE_MIN_DURATION_MS = 150;
140200
140234
  var MAX_DURATION_MS = 1e4;
140201
140235
  var zodSchema18 = external_exports.object({
140202
140236
  udid: external_exports.string().describe("Target device id from `list-devices` (iOS UDID or Android serial)."),
140203
- fromX: external_exports.number().describe("Start x: normalized 0.0\u20131.0 (not pixels; same as tap)"),
140204
- fromY: external_exports.number().describe("Start y: normalized 0.0\u20131.0 (not pixels; same as tap)"),
140205
- toX: external_exports.number().describe("End x: normalized 0.0\u20131.0 (not pixels; same as tap)"),
140206
- toY: external_exports.number().describe("End y: normalized 0.0\u20131.0 (not pixels; same as tap)"),
140237
+ fromX: external_exports.number().min(0).max(1).describe("Start x: normalized 0.0\u20131.0 (not pixels; same as tap)"),
140238
+ fromY: external_exports.number().min(0).max(1).describe("Start y: normalized 0.0\u20131.0 (not pixels; same as tap)"),
140239
+ toX: external_exports.number().min(0).max(1).describe("End x: normalized 0.0\u20131.0 (not pixels; same as tap)"),
140240
+ toY: external_exports.number().min(0).max(1).describe("End y: normalized 0.0\u20131.0 (not pixels; same as tap)"),
140207
140241
  durationMs: external_exports.number().max(MAX_DURATION_MS, {
140208
140242
  message: `durationMs must be at most ${MAX_DURATION_MS} (10s): every frame is a real 16ms sleep with the finger held down, so a larger value is that many milliseconds of wall clock spent holding a touch the device cannot shake off.`
140209
140243
  }).optional().describe(
@@ -140346,10 +140380,10 @@ init_device_info();
140346
140380
  var sleep4 = (ms) => new Promise((r) => setTimeout(r, ms));
140347
140381
  var zodSchema19 = external_exports.object({
140348
140382
  udid: external_exports.string().describe("Target Chromium device id from `list-devices` (chromium-cdp-<port>)."),
140349
- x: external_exports.number().describe(
140383
+ x: external_exports.number().min(0).max(1).describe(
140350
140384
  "Anchor x: normalized 0.0\u20131.0 (fraction of window width, not pixels). The wheel events land here; put it over the element you want to scroll."
140351
140385
  ),
140352
- y: external_exports.number().describe("Anchor y: normalized 0.0\u20131.0 (fraction of window height, not pixels)."),
140386
+ y: external_exports.number().min(0).max(1).describe("Anchor y: normalized 0.0\u20131.0 (fraction of window height, not pixels)."),
140353
140387
  deltaX: external_exports.number().optional().describe(
140354
140388
  "Horizontal scroll distance as a fraction of the window width (e.g. 0.5 = half a window). Positive scrolls content right (reveals content to the right)."
140355
140389
  ),
@@ -140415,10 +140449,10 @@ var MOMENTUM_FREE_MIN_STEPS = 8;
140415
140449
  var MAX_DURATION_MS2 = 1e4;
140416
140450
  var zodSchema20 = external_exports.object({
140417
140451
  udid: external_exports.string().describe("Target Chromium device id from `list-devices` (chromium-cdp-<port>)."),
140418
- fromX: external_exports.number().describe("Press x: normalized 0.0\u20131.0 (fraction of window width, not pixels)."),
140419
- fromY: external_exports.number().describe("Press y: normalized 0.0\u20131.0 (fraction of window height, not pixels)."),
140420
- toX: external_exports.number().describe("Release x: normalized 0.0\u20131.0 (not pixels; same space as tap)."),
140421
- toY: external_exports.number().describe("Release y: normalized 0.0\u20131.0 (not pixels; same space as tap)."),
140452
+ fromX: external_exports.number().min(0).max(1).describe("Press x: normalized 0.0\u20131.0 (fraction of window width, not pixels)."),
140453
+ fromY: external_exports.number().min(0).max(1).describe("Press y: normalized 0.0\u20131.0 (fraction of window height, not pixels)."),
140454
+ toX: external_exports.number().min(0).max(1).describe("Release x: normalized 0.0\u20131.0 (not pixels; same space as tap)."),
140455
+ toY: external_exports.number().min(0).max(1).describe("Release y: normalized 0.0\u20131.0 (not pixels; same space as tap)."),
140422
140456
  durationMs: external_exports.number().max(MAX_DURATION_MS2, {
140423
140457
  message: `durationMs must be at most ${MAX_DURATION_MS2} (10s): the drag holds the left button down for exactly this long, one frame per ~16ms, so a larger value is that much wall clock spent mid-press.`
140424
140458
  }).optional().describe(
@@ -141261,12 +141295,12 @@ async function typeSimulatorServer(registry2, device, params) {
141261
141295
 
141262
141296
  // ../tool-server/src/tools/tv/tv-service.ts
141263
141297
  init_device_info();
141264
- function tvServiceRef(udid) {
141298
+ function tvServiceRef(udid, registry2) {
141265
141299
  const device = resolveDevice(udid);
141266
- return device.platform === "android" ? androidTvControlRef(device) : tvControlRef(device);
141300
+ return device.platform === "android" ? androidTvControlRef(device, registry2) : tvControlRef(device);
141267
141301
  }
141268
141302
  async function resolveTvApi(registry2, udid) {
141269
- const ref = tvServiceRef(udid);
141303
+ const ref = tvServiceRef(udid, registry2);
141270
141304
  return typeof ref === "string" ? registry2.resolveService(ref) : registry2.resolveService(ref.urn, ref.options);
141271
141305
  }
141272
141306
 
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.30.0",
3
+ "version": "0.30.1-next.1",
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",