@swmansion/argent 0.35.1-next.19 → 0.35.1-next.20

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
@@ -38595,7 +38595,7 @@ function isCi(env = process.env) {
38595
38595
  var SESSION_ID2 = randomUUID5();
38596
38596
  function readCliVersion() {
38597
38597
  if (true) {
38598
- return "0.35.1-next.18";
38598
+ return "0.35.1-next.20";
38599
38599
  }
38600
38600
  return "0.0.0";
38601
38601
  }
@@ -17117,7 +17117,7 @@ function isCi(env = process.env) {
17117
17117
  var SESSION_ID = randomUUID4();
17118
17118
  function readCliVersion() {
17119
17119
  if (true) {
17120
- return "0.35.1-next.18";
17120
+ return "0.35.1-next.20";
17121
17121
  }
17122
17122
  return "0.0.0";
17123
17123
  }
@@ -38067,7 +38067,7 @@ async function startMcpServer(options) {
38067
38067
  const autoDescribeOn = autoDescribeEnabled();
38068
38068
  const whatsNewOn = whatsNewEnabled();
38069
38069
  const installedVersion = getInstalledVersion();
38070
- const highlightsVersion = true ? "0.35.1-next.18" : installedVersion;
38070
+ const highlightsVersion = true ? "0.35.1-next.20" : installedVersion;
38071
38071
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38072
38072
  const trees = createTreeMemory();
38073
38073
  const screenshots = createScreenshotMemory();
@@ -38320,7 +38320,7 @@ ${shown.text}` }];
38320
38320
  content = [...content, { type: "text", text: screenshotIdLine(id) }];
38321
38321
  }
38322
38322
  }
38323
- if (udid && autoDescribeOn && canonicalToolId(params.name) === "describe") {
38323
+ if (udid && autoDescribeOn && canonicalToolId(params.name) === "describe" && params.arguments?.raw !== true) {
38324
38324
  const tree = describedTree(result);
38325
38325
  if (tree !== void 0) {
38326
38326
  treeUdid = udid;
@@ -235,6 +235,8 @@ export interface ArgentToolArgs {
235
235
  udid: string;
236
236
  /** iOS simulator only: fallback bundle id when AX-service returns empty (auto-detects frontmost if omitted). */
237
237
  bundleId?: string;
238
+ /** Return the unpruned tree, keeping bare structural wrapper containers and duplicate child labels omitted by default. */
239
+ raw?: boolean;
238
240
  };
239
241
  "dismiss-update": {
240
242
  /** Hours until reminders resume: 168 is a week, 87600 is the longest, 0 turns them back on */
@@ -72978,7 +72978,7 @@ function isCi(env = process.env) {
72978
72978
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72979
72979
  function readCliVersion() {
72980
72980
  if (true) {
72981
- return "0.35.1-next.18";
72981
+ return "0.35.1-next.20";
72982
72982
  }
72983
72983
  return "0.0.0";
72984
72984
  }
@@ -146044,7 +146044,9 @@ function clampFinite(n) {
146044
146044
  return Number.isFinite(n) ? n : 0;
146045
146045
  }
146046
146046
  function fmtCoord(n) {
146047
- return clampFinite(n).toFixed(3);
146047
+ const rounded = clampFinite(n).toFixed(3);
146048
+ const trimmed = rounded.includes(".") ? rounded.replace(/\.?0+$/, "") : rounded;
146049
+ return trimmed === "-0" ? "0" : trimmed;
146048
146050
  }
146049
146051
  function fmtFrame(f) {
146050
146052
  return `(${fmtCoord(f.x)},${fmtCoord(f.y)},${fmtCoord(f.width)},${fmtCoord(f.height)})`;
@@ -146099,59 +146101,140 @@ function formatLine(n, indent, source) {
146099
146101
  const flagPart = formatFlags(n, source);
146100
146102
  const annotations = `${labelPart}${valuePart}${idPart}${hintPart}${flagPart}`.trim();
146101
146103
  const annotated = annotations ? ` ${annotations}` : "";
146102
- return `${pad}${n.role}${annotated} ${fmtFrame(n.frame)}`;
146104
+ return `${pad}${n.role}${annotated} ${fmtFrame(n.frame)}`;
146105
+ }
146106
+ var CONTAIN_EPS = 5e-3;
146107
+ function frameContains2(outer, inner) {
146108
+ return inner.x >= outer.x - CONTAIN_EPS && inner.y >= outer.y - CONTAIN_EPS && inner.x + inner.width <= outer.x + outer.width + CONTAIN_EPS && inner.y + inner.height <= outer.y + outer.height + CONTAIN_EPS;
146109
+ }
146110
+ function normalizeLabel(s) {
146111
+ return (s ?? "").replace(/[\s,]+/g, " ").trim().toLowerCase();
146112
+ }
146113
+ var DECORATIVE_CHEVRON_RE = /^(chevron(\.(right|left|forward|backward))?|disclosure)$/i;
146114
+ function pruneFlatDuplicates(nodes) {
146115
+ const drop = /* @__PURE__ */ new Set();
146116
+ for (let i = 0; i < nodes.length; i++) {
146117
+ if (drop.has(i)) continue;
146118
+ const a = nodes[i];
146119
+ for (let j = 0; j < nodes.length; j++) {
146120
+ if (i === j || drop.has(j) || drop.has(i)) continue;
146121
+ const b = nodes[j];
146122
+ if (!frameContains2(a.frame, b.frame)) continue;
146123
+ if ((a.label || a.identifier) && a.role === b.role && (a.label ?? "") === (b.label ?? "") && (a.identifier ?? "") === (b.identifier ?? "") && (a.value ?? "") === (b.value ?? "") && (a.hint ?? "") === (b.hint ?? "") && Boolean(a.disabled) === Boolean(b.disabled) && Boolean(a.selected) === Boolean(b.selected) && Boolean(a.focused) === Boolean(b.focused) && Boolean(a.checked) === Boolean(b.checked)) {
146124
+ if (!frameContains2(b.frame, a.frame) || i < j) {
146125
+ drop.add(j);
146126
+ }
146127
+ continue;
146128
+ }
146129
+ if (a.role === "AXGroup" && (b.role === "AXButton" || b.role === "AXLink") && !a.value && !a.hint && !a.disabled && !a.selected && a.identifier && a.identifier === b.identifier && a.label && b.label && normalizeLabel(a.label) === normalizeLabel(b.label)) {
146130
+ drop.add(i);
146131
+ break;
146132
+ }
146133
+ if (a.role === "AXButton" && b.disabled && !b.value && !b.identifier && b.label && DECORATIVE_CHEVRON_RE.test(b.label.trim())) {
146134
+ drop.add(j);
146135
+ }
146136
+ }
146137
+ }
146138
+ const stage1 = nodes.filter((_, idx) => !drop.has(idx));
146139
+ const drop2 = /* @__PURE__ */ new Set();
146140
+ for (let i = 0; i < stage1.length; i++) {
146141
+ const a = stage1[i];
146142
+ if (a.role !== "AXButton" && a.role !== "AXGroup" && a.role !== "AXLink" || !a.label) {
146143
+ continue;
146144
+ }
146145
+ const aNorm = normalizeLabel(a.label);
146146
+ if (!aNorm) continue;
146147
+ for (let j = 0; j < stage1.length; j++) {
146148
+ if (i === j || drop2.has(j)) continue;
146149
+ const b = stage1[j];
146150
+ if ((b.role === "AXStaticText" || b.role === "AXImage") && b.label && !b.value && !b.hint && !b.disabled && !b.selected && !b.focused && (!b.identifier || b.identifier === a.identifier) && frameContains2(a.frame, b.frame)) {
146151
+ const bNorm = normalizeLabel(b.label);
146152
+ const covered = a.role === "AXGroup" ? bNorm === aNorm || a.label.split(", ").map(normalizeLabel).includes(bNorm) : ` ${aNorm} `.includes(` ${bNorm} `);
146153
+ if (bNorm && covered) {
146154
+ drop2.add(j);
146155
+ }
146156
+ }
146157
+ }
146158
+ }
146159
+ return stage1.filter((_, idx) => !drop2.has(idx));
146103
146160
  }
146104
146161
  var IOS_SCROLL_BAR_LABEL = /^(Vertical|Horizontal) scroll bar, .+\bpages?$/;
146105
146162
  var PERCENT_VALUE = /^\d+(?:\.\d+)?%$/;
146106
146163
  function isIosScrollBar(n) {
146107
146164
  return n.role === "AXAdjustable" && !n.identifier && !n.hint && typeof n.label === "string" && IOS_SCROLL_BAR_LABEL.test(n.label) && (n.value === void 0 || PERCENT_VALUE.test(n.value));
146108
146165
  }
146109
- function renderFlat(root, contentRoles, source) {
146110
- return root.children.filter((n) => !isIosScrollBar(n) && (shouldEmit(n, contentRoles) || hasIosState(n))).slice().sort((a, b) => a.frame.y - b.frame.y || a.frame.x - b.frame.x).map((n) => formatLine(n, 1, source));
146111
- }
146112
- function renderNested(root, contentRoles, source) {
146166
+ function renderFlat(root, contentRoles, source, raw) {
146167
+ const sorted = root.children.filter((n) => (raw || !isIosScrollBar(n)) && (shouldEmit(n, contentRoles) || hasIosState(n))).slice().sort((a, b) => a.frame.y - b.frame.y || a.frame.x - b.frame.x);
146168
+ const kept = raw ? sorted : pruneFlatDuplicates(sorted);
146169
+ return kept.map((n) => formatLine(n, 1, source));
146170
+ }
146171
+ function isRedundantChildImage(parent, child) {
146172
+ if (child.children.length > 0) return false;
146173
+ if (child.role !== "Image" && child.role !== "AXImage" && child.role !== "img") return false;
146174
+ if (child.clickable || child.longClickable || child.identifier || child.value) return false;
146175
+ if (!parent.clickable || !parent.label || !child.label) return false;
146176
+ return normalizeLabel(child.label) === normalizeLabel(parent.label);
146177
+ }
146178
+ var STRUCTURAL_CONTAINER_ROLES = /* @__PURE__ */ new Set([
146179
+ "dialog",
146180
+ "alertdialog",
146181
+ "AlertDialog",
146182
+ "Dialog",
146183
+ "AXSheet",
146184
+ "AXWindow",
146185
+ "AXPopover"
146186
+ ]);
146187
+ function renderNested(root, contentRoles, source, raw) {
146113
146188
  const lines = [];
146114
146189
  const stack = [];
146115
146190
  for (let i = root.children.length - 1; i >= 0; i--) {
146116
146191
  stack.push({ node: root.children[i], depth: 1 });
146117
146192
  }
146118
146193
  while (stack.length > 0) {
146119
- const { node: node2, depth } = stack.pop();
146120
- if (shouldEmit(node2, contentRoles) || node2.children.length > 0) {
146194
+ const { node: node2, depth, parent } = stack.pop();
146195
+ if (!raw && parent && isRedundantChildImage(parent, node2)) {
146196
+ continue;
146197
+ }
146198
+ const meaningful = shouldEmit(node2, contentRoles) || Boolean(node2.focused || node2.password) || node2.children.length > 0 && (STRUCTURAL_CONTAINER_ROLES.has(node2.role) || Boolean(node2.selected || node2.disabled || node2.hint));
146199
+ const emit = raw ? shouldEmit(node2, contentRoles) || node2.children.length > 0 : meaningful;
146200
+ if (emit) {
146121
146201
  lines.push(formatLine(node2, depth, source));
146122
146202
  }
146203
+ const childDepth = emit ? depth + 1 : depth;
146204
+ const nextParent = emit ? node2 : parent;
146123
146205
  for (let i = node2.children.length - 1; i >= 0; i--) {
146124
- stack.push({ node: node2.children[i], depth: depth + 1 });
146206
+ stack.push({ node: node2.children[i], depth: childDepth, parent: nextParent });
146125
146207
  }
146126
146208
  }
146127
146209
  return lines;
146128
146210
  }
146211
+ function isDefaultRoot(root) {
146212
+ return !root.label && !root.value && !root.identifier && !root.hint && root.frame.x === 0 && root.frame.y === 0 && root.frame.width === 1 && root.frame.height === 1;
146213
+ }
146129
146214
  function formatDescribeTree(root, opts) {
146215
+ const raw = opts.raw === true;
146130
146216
  const isMacos2 = opts.source === "macos-devtools" || opts.source === "macos-fallback";
146131
146217
  const mode = opts.source === "uiautomator" || opts.source === "android-devtools" || opts.source === "uiautomator+cdp" || opts.source === "android-devtools+cdp" || opts.source === "cdp-dom" || opts.source === "vega-automation" || opts.source === "harmony-uitest" || // Physical iOS: the runner reports a parent/child tree. Nested mode keeps that structure.
146132
146218
  opts.source === "xcuitest-runner" || // A Mac app: the library's accessibility tree, with web content under its web view.
146133
146219
  isMacos2 ? "nested" : "flat";
146134
146220
  const isVega = opts.source === "vega-automation";
146135
146221
  const header = [];
146136
- header.push(`Source: ${opts.source} | Mode: ${mode}`);
146137
146222
  if (isVega) {
146223
+ header.push(`Source: ${opts.source} | Mode: ${mode} | Frame: (x,y,w,h) [0,1]`);
146138
146224
  header.push(
146139
- 'Coordinates: normalized [0,1] screen (x,y,w,h), not pixels. Vega is remote-driven (no tap): use frames to plan D-pad moves via `tv-remote` from `[focused]` (or `[selected]` when none reports `[focused]`), counting rows/columns (e.g. ["down","right","right","select"]).'
146225
+ "Vega is remote-driven (no tap): plan `tv-remote` D-pad moves from `[focused]`/`[selected]`."
146140
146226
  );
146141
146227
  } else if (isMacos2) {
146142
- header.push(
146143
- "Coordinates: normalized [0,1] app window (title bar + overhanging sheets/alerts/menus; x,y,w,h), not pixels. Mouse input only: pass to gesture-tap / gesture-drag / gesture-scroll; tap centre = (x+w/2, y+h/2). Menu bar not in tree: use menu-bar."
146144
- );
146228
+ header.push(`Source: ${opts.source} | Mode: ${mode} | Frame: (x,y,w,h) [0,1] app window`);
146229
+ header.push("Mouse only (gesture-tap / gesture-drag / gesture-scroll); menu bar via menu-bar.");
146145
146230
  } else {
146146
- header.push(
146147
- "Coordinates: normalized [0,1] screen (x,y,w,h), not pixels; pass to gesture-tap / gesture-swipe / gesture-pinch; tap centre = (x+w/2, y+h/2)."
146148
- );
146231
+ header.push(`Source: ${opts.source} | Mode: ${mode} | Frame: (x,y,w,h) [0,1]`);
146232
+ }
146233
+ if (raw || !isDefaultRoot(root)) {
146234
+ header.push(`ROOT ${root.role} ${fmtFrame(root.frame)}`);
146149
146235
  }
146150
- header.push("");
146151
- header.push(`ROOT ${root.role} ${fmtFrame(root.frame)}`);
146152
- header.push("");
146153
146236
  const contentRoles = isVega ? VEGA_CONTENT_ROLES : CONTENT_ROLES;
146154
- const body = mode === "flat" ? renderFlat(root, contentRoles, opts.source) : renderNested(root, contentRoles, opts.source);
146237
+ const body = mode === "flat" ? renderFlat(root, contentRoles, opts.source, raw) : renderNested(root, contentRoles, opts.source, raw);
146155
146238
  return [...header, ...body].join("\n").replace(/\n+$/, "\n");
146156
146239
  }
146157
146240
 
@@ -146183,7 +146266,7 @@ function renderFocusView(res) {
146183
146266
  }
146184
146267
  return lines.join("\n");
146185
146268
  }
146186
- async function describeTv(registry2, device) {
146269
+ async function describeTv(registry2, device, raw) {
146187
146270
  const api = await resolveTvApi(registry2, device.id);
146188
146271
  let res = await api.describe();
146189
146272
  if (device.platform !== "android") {
@@ -146202,7 +146285,8 @@ async function describeTv(registry2, device) {
146202
146285
  description: `${ANDROID_FOCUS_EMPTY_HINT}
146203
146286
 
146204
146287
  ${formatDescribeTree(data.tree, {
146205
- source: data.source
146288
+ source: data.source,
146289
+ raw
146206
146290
  })}`,
146207
146291
  source: data.source,
146208
146292
  hint: ANDROID_FOCUS_EMPTY_HINT
@@ -146222,9 +146306,9 @@ Note: ${EMPTY_HINT2}` : renderFocusView(res);
146222
146306
  // ../tool-server/src/tools/describe/index.ts
146223
146307
  init_device_info();
146224
146308
  init_adb();
146225
- function withDescription(data) {
146309
+ function withDescription(data, raw) {
146226
146310
  const out = {
146227
- description: formatDescribeTree(data.tree, { source: data.source }),
146311
+ description: formatDescribeTree(data.tree, { source: data.source, raw }),
146228
146312
  source: data.source
146229
146313
  };
146230
146314
  if (data.should_restart) out.should_restart = data.should_restart;
@@ -146248,17 +146332,18 @@ function makeDescribeExecute(registry2) {
146248
146332
  requires: iosRequires,
146249
146333
  handler: async (_services, params, device) => (
146250
146334
  // Probe tvOS once here, then pass the verdict into describeIos.
146251
- await isTvOsSimulator(device.id) ? describeTv(registry2, device) : withDescription(
146335
+ await isTvOsSimulator(device.id) ? describeTv(registry2, device, params.raw) : withDescription(
146252
146336
  withBootCaveatOncePerDevice(
146253
146337
  device.id,
146254
146338
  await describeIos(registry2, device, params, { isTvOs: false })
146255
- )
146339
+ ),
146340
+ params.raw
146256
146341
  )
146257
146342
  )
146258
146343
  },
146259
146344
  iosDevice: {
146260
146345
  requires: iosRequires,
146261
- handler: async (_services, _params, device) => withDescription(await describeIosDevice(registry2, device))
146346
+ handler: async (_services, params, device) => withDescription(await describeIosDevice(registry2, device), params.raw)
146262
146347
  },
146263
146348
  iosRemote: {
146264
146349
  // Both the ax-service and native-devtools blueprints route through
@@ -146269,7 +146354,8 @@ function makeDescribeExecute(registry2) {
146269
146354
  withBootCaveatOncePerDevice(
146270
146355
  device.id,
146271
146356
  await describeIos(registry2, device, params, { isTvOs: false })
146272
- )
146357
+ ),
146358
+ params.raw
146273
146359
  )
146274
146360
  },
146275
146361
  android: {
@@ -146277,24 +146363,27 @@ function makeDescribeExecute(registry2) {
146277
146363
  handler: async (_services, params, device) => (
146278
146364
  // Resolve the form factor once and thread the known `isTv: false`
146279
146365
  // through so describeAndroid doesn't re-probe.
146280
- await isAndroidTv(device.id) ? describeTv(registry2, device) : withDescription(await describeAndroid(registry2, params.udid, params.bundleId, false))
146366
+ await isAndroidTv(device.id) ? describeTv(registry2, device, params.raw) : withDescription(
146367
+ await describeAndroid(registry2, params.udid, params.bundleId, false),
146368
+ params.raw
146369
+ )
146281
146370
  )
146282
146371
  },
146283
146372
  chromium: {
146284
- handler: async (services) => withDescription(await describeChromium(services.chromium))
146373
+ handler: async (services, params) => withDescription(await describeChromium(services.chromium), params.raw)
146285
146374
  },
146286
146375
  vega: {
146287
146376
  requires: vegaRequires,
146288
- handler: async (_services, params) => withDescription(await describeVega(params.udid))
146377
+ handler: async (_services, params) => withDescription(await describeVega(params.udid), params.raw)
146289
146378
  },
146290
146379
  harmony: {
146291
146380
  requires: harmonyRequires,
146292
- handler: async (_services, _params, device) => withDescription(await describeHarmony(harmonyConnectKey(device.id)))
146381
+ handler: async (_services, params, device) => withDescription(await describeHarmony(harmonyConnectKey(device.id)), params.raw)
146293
146382
  },
146294
146383
  // The in-app library's connection resolves through the closed-over
146295
146384
  // registry, after the macos-apps flag check, as the iOS services do.
146296
146385
  macos: {
146297
- handler: async (_services, _params, device) => withDescription(await describeMacos(registry2, device))
146386
+ handler: async (_services, params, device) => withDescription(await describeMacos(registry2, device), params.raw)
146298
146387
  }
146299
146388
  });
146300
146389
  }
@@ -146302,6 +146391,9 @@ var zodSchema41 = external_exports.object({
146302
146391
  udid: external_exports.string().min(1).describe("Target device id from `list-devices`."),
146303
146392
  bundleId: external_exports.string().optional().describe(
146304
146393
  "iOS simulator only: fallback bundle id when AX-service returns empty (auto-detects frontmost if omitted)."
146394
+ ),
146395
+ raw: external_exports.boolean().optional().describe(
146396
+ "Return the unpruned tree, keeping bare structural wrapper containers and duplicate child labels omitted by default."
146305
146397
  )
146306
146398
  });
146307
146399
  function createDescribeTool(registry2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.35.1-next.19",
3
+ "version": "0.35.1-next.20",
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": "600763288e4c7cb320286ad056f8e18b078001b2"
101
+ "gitHead": "ce0d732e148fd0d3160ad5f3fe8ef09a595cc714"
102
102
  }