@swmansion/argent 0.34.1-next.97 → 0.34.1-next.99

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
@@ -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.34.1-next.97";
38578
+ return "0.34.1-next.99";
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.34.1-next.97";
17001
+ return "0.34.1-next.99";
17002
17002
  }
17003
17003
  return "0.0.0";
17004
17004
  }
@@ -36931,12 +36931,176 @@ function getAutoScreenshotDelayMs(toolName) {
36931
36931
  import { randomInt } from "node:crypto";
36932
36932
  var MAX_UNCHANGED_IN_A_ROW = 3;
36933
36933
  var UNCHANGED_MAX_AGE_MS = 5 * 6e4;
36934
+ var MAX_DIFF_RATIO = 0.6;
36935
+ var MAX_EDIT_DISTANCE = 256;
36936
+ var CONTEXT_LINES = 1;
36934
36937
  function treeIdLine(id) {
36935
36938
  return `Tree id: ${id}`;
36936
36939
  }
36937
36940
  function unchangedTreeNote(id, tool) {
36938
36941
  return `Element tree matches \`${id}\` from an earlier \`${tool}\` result. Actions may have effects the tree omits. Call \`describe\` if you lack that tree.`;
36939
36942
  }
36943
+ function treeDiffHeader(id, tool) {
36944
+ return `Diff against \`${id}\` (\`${tool}\`) \u2014 all other lines match \`${id}\` (- gone, + new; call \`describe\` if you lack \`${id}\`):`;
36945
+ }
36946
+ function countLines(lines) {
36947
+ const counts = /* @__PURE__ */ new Map();
36948
+ for (const line of lines) counts.set(line, (counts.get(line) ?? 0) + 1);
36949
+ return counts;
36950
+ }
36951
+ function isMultisetSubset(subset, superset) {
36952
+ if (subset.length === 0) return true;
36953
+ if (subset.length > superset.length) return false;
36954
+ const counts = countLines(superset);
36955
+ for (const line of subset) {
36956
+ const left = counts.get(line) ?? 0;
36957
+ if (left === 0) return false;
36958
+ counts.set(line, left - 1);
36959
+ }
36960
+ return true;
36961
+ }
36962
+ function treeMetaSignature(tree) {
36963
+ const meta2 = [];
36964
+ for (const line of tree.split("\n")) {
36965
+ if (line.startsWith("Hint: ") || line.startsWith("Source: ") || line.startsWith("Mode: ")) {
36966
+ meta2.push(line);
36967
+ } else if (line.trim() !== "") {
36968
+ break;
36969
+ }
36970
+ }
36971
+ return meta2.join("\n");
36972
+ }
36973
+ function myersDiff(a, b, maxD) {
36974
+ const n = a.length;
36975
+ const m = b.length;
36976
+ const limit = Math.min(maxD, n + m);
36977
+ const offset = limit;
36978
+ const v = new Int32Array(2 * limit + 1);
36979
+ const trace = [];
36980
+ for (let d = 0; d <= limit; d++) {
36981
+ trace.push(v.slice());
36982
+ for (let k = -d; k <= d; k += 2) {
36983
+ let x;
36984
+ if (k === -d || k !== d && v[offset + k - 1] < v[offset + k + 1]) {
36985
+ x = v[offset + k + 1];
36986
+ } else {
36987
+ x = v[offset + k - 1] + 1;
36988
+ }
36989
+ let y = x - k;
36990
+ while (x < n && y < m && a[x] === b[y]) {
36991
+ x++;
36992
+ y++;
36993
+ }
36994
+ v[offset + k] = x;
36995
+ if (x === n && y === m) {
36996
+ const ops = [];
36997
+ let bx = n;
36998
+ let by = m;
36999
+ for (let step = d; step > 0; step--) {
37000
+ const prevV = trace[step];
37001
+ const bk = bx - by;
37002
+ const prevK = bk === -step || bk !== step && prevV[offset + bk - 1] < prevV[offset + bk + 1] ? bk + 1 : bk - 1;
37003
+ const prevX = prevV[offset + prevK];
37004
+ const prevY = prevX - prevK;
37005
+ while (bx > prevX && by > prevY) {
37006
+ bx--;
37007
+ by--;
37008
+ ops.push({ kind: "eq", line: a[bx] });
37009
+ }
37010
+ if (bx === prevX) {
37011
+ by--;
37012
+ ops.push({ kind: "ins", line: b[by] });
37013
+ } else {
37014
+ bx--;
37015
+ ops.push({ kind: "del", line: a[bx] });
37016
+ }
37017
+ }
37018
+ while (bx > 0 && by > 0) {
37019
+ bx--;
37020
+ by--;
37021
+ ops.push({ kind: "eq", line: a[bx] });
37022
+ }
37023
+ ops.reverse();
37024
+ return ops;
37025
+ }
37026
+ }
37027
+ }
37028
+ return null;
37029
+ }
37030
+ function diffLines(before, after) {
37031
+ let prefix = 0;
37032
+ const minLen = Math.min(before.length, after.length);
37033
+ while (prefix < minLen && before[prefix] === after[prefix]) prefix++;
37034
+ let suffix = 0;
37035
+ while (suffix < minLen - prefix && before[before.length - 1 - suffix] === after[after.length - 1 - suffix]) {
37036
+ suffix++;
37037
+ }
37038
+ const midBefore = before.slice(prefix, before.length - suffix);
37039
+ const midAfter = after.slice(prefix, after.length - suffix);
37040
+ const midOps = midBefore.length === 0 && midAfter.length === 0 ? [] : myersDiff(midBefore, midAfter, MAX_EDIT_DISTANCE);
37041
+ if (midOps === null) return null;
37042
+ const ops = [];
37043
+ for (let i = 0; i < prefix; i++) ops.push({ kind: "eq", line: before[i] });
37044
+ for (const op of midOps) ops.push(op);
37045
+ for (let i = before.length - suffix; i < before.length; i++) {
37046
+ ops.push({ kind: "eq", line: before[i] });
37047
+ }
37048
+ return ops;
37049
+ }
37050
+ function renderHunks(ops) {
37051
+ const visible = new Uint8Array(ops.length);
37052
+ for (let i = 0; i < ops.length; i++) {
37053
+ if (ops[i].kind === "eq") continue;
37054
+ const start = Math.max(0, i - CONTEXT_LINES);
37055
+ const end = Math.min(ops.length - 1, i + CONTEXT_LINES);
37056
+ for (let j = start; j <= end; j++) visible[j] = 1;
37057
+ }
37058
+ const out = [];
37059
+ let inHunk = false;
37060
+ let hadHunk = false;
37061
+ for (let i = 0; i < ops.length; i++) {
37062
+ if (!visible[i]) {
37063
+ inHunk = false;
37064
+ continue;
37065
+ }
37066
+ if (!inHunk) {
37067
+ if (hadHunk) out.push("...");
37068
+ inHunk = true;
37069
+ hadHunk = true;
37070
+ }
37071
+ const op = ops[i];
37072
+ if (op.kind === "del") out.push(`- ${op.line}`);
37073
+ else if (op.kind === "ins") out.push(`+ ${op.line}`);
37074
+ else out.push(` ${op.line}`);
37075
+ }
37076
+ return out;
37077
+ }
37078
+ function splitTreeLines(tree) {
37079
+ const trimmed = tree.endsWith("\n") ? tree.slice(0, -1) : tree;
37080
+ return trimmed.split("\n");
37081
+ }
37082
+ function computeTreeDiff(base, next, id, tool) {
37083
+ if (treeMetaSignature(base) !== treeMetaSignature(next)) return null;
37084
+ if (base === next) {
37085
+ return { mode: "unchanged", text: unchangedTreeNote(id, tool), removed: [], added: [] };
37086
+ }
37087
+ const before = splitTreeLines(base);
37088
+ const after = splitTreeLines(next);
37089
+ const ops = diffLines(before, after);
37090
+ if (ops === null) return null;
37091
+ const removed = [];
37092
+ const added = [];
37093
+ for (const op of ops) {
37094
+ if (op.kind === "del") removed.push(op.line);
37095
+ else if (op.kind === "ins") added.push(op.line);
37096
+ }
37097
+ if (removed.length === 0 && added.length === 0) {
37098
+ return { mode: "unchanged", text: unchangedTreeNote(id, tool), removed, added };
37099
+ }
37100
+ const text = [treeDiffHeader(id, tool), ...renderHunks(ops)].join("\n");
37101
+ if (text.length > Math.floor(next.length * MAX_DIFF_RATIO)) return null;
37102
+ return { mode: "diff", text, removed, added };
37103
+ }
36940
37104
  function randomTag() {
36941
37105
  return randomInt(36 ** 3).toString(36).padStart(3, "0");
36942
37106
  }
@@ -36945,7 +37109,14 @@ function createTreeMemory(now = Date.now, tag = randomTag()) {
36945
37109
  let count = 0;
36946
37110
  const sent = (udid, tree, toolName) => {
36947
37111
  const id = `${tag}-${++count}`;
36948
- lastSent.set(udid, { id, tree, tool: normalizeToolName(toolName), sentAt: now(), notes: 0 });
37112
+ lastSent.set(udid, {
37113
+ id,
37114
+ tree,
37115
+ tool: normalizeToolName(toolName),
37116
+ sentAt: now(),
37117
+ shortResults: 0,
37118
+ priorDiff: null
37119
+ });
36949
37120
  return id;
36950
37121
  };
36951
37122
  return {
@@ -36953,13 +37124,50 @@ function createTreeMemory(now = Date.now, tag = randomTag()) {
36953
37124
  afterAction(udid, tree, toolName) {
36954
37125
  const last = lastSent.get(udid);
36955
37126
  const identical = last !== void 0 && last.tree === tree;
36956
- if (last !== void 0 && identical && last.notes < MAX_UNCHANGED_IN_A_ROW && now() - last.sentAt <= UNCHANGED_MAX_AGE_MS) {
36957
- last.notes += 1;
36958
- return { text: unchangedTreeNote(last.id, last.tool), identical, note: true };
37127
+ const canShorten = last !== void 0 && last.shortResults < MAX_UNCHANGED_IN_A_ROW && now() - last.sentAt <= UNCHANGED_MAX_AGE_MS;
37128
+ if (canShorten) {
37129
+ if (identical) {
37130
+ if (last.priorDiff === null) {
37131
+ last.shortResults += 1;
37132
+ return {
37133
+ text: unchangedTreeNote(last.id, last.tool),
37134
+ mode: "unchanged",
37135
+ identical: true,
37136
+ note: true
37137
+ };
37138
+ }
37139
+ } else {
37140
+ const diff = computeTreeDiff(last.tree, tree, last.id, last.tool);
37141
+ if (diff !== null) {
37142
+ if (diff.mode === "unchanged") {
37143
+ if (last.priorDiff === null) {
37144
+ last.shortResults += 1;
37145
+ return {
37146
+ text: diff.text,
37147
+ mode: "unchanged",
37148
+ identical: true,
37149
+ note: true
37150
+ };
37151
+ }
37152
+ } else {
37153
+ const monotonic = last.priorDiff === null || isMultisetSubset(last.priorDiff.removed, diff.removed) && isMultisetSubset(last.priorDiff.added, diff.added);
37154
+ if (monotonic) {
37155
+ last.shortResults += 1;
37156
+ last.priorDiff = { removed: diff.removed, added: diff.added };
37157
+ return {
37158
+ text: diff.text,
37159
+ mode: "diff",
37160
+ identical: false,
37161
+ note: false
37162
+ };
37163
+ }
37164
+ }
37165
+ }
37166
+ }
36959
37167
  }
36960
37168
  const id = sent(udid, tree, toolName);
36961
37169
  return { text: `${treeIdLine(id)}
36962
- ${tree}`, identical, note: false };
37170
+ ${tree}`, mode: "full", identical, note: false };
36963
37171
  },
36964
37172
  forget(udid) {
36965
37173
  lastSent.delete(udid);
@@ -37428,7 +37636,7 @@ function debuggerLogRegistryText(result) {
37428
37636
  }
37429
37637
 
37430
37638
  // ../argent-mcp/src/instructions.ts
37431
- var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Use the platform the user named; otherwise prefer a device list-devices shows already running, and do not default to iOS. In a single-platform project, boot that platform. Prefer these tools over raw xcrun or adb commands, which are a fallback. Prefer launch-app or open-url over tapping home-screen icons. If the task may need a saved e2e test, load the argent-create-e2e skill (argent-qa-e2e for acceptance tests) before the first launch or in-app action: recording is not retroactive. Load the matching argent-* skill before React Native build or debug work, profiling, a physical phone, a Mac app or a TV. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. A result names an identical earlier tree by its tree id in place of repeating it. If a tap fails twice, stop retrying and call a discovery tool again. Use await-ui-element to wait for the UI instead of polling with screenshots. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup. The argent CLI manages the toolkit: argent --help lists its commands.";
37639
+ var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Use the platform the user named; otherwise prefer a device list-devices shows already running, and do not default to iOS. In a single-platform project, boot that platform. Prefer these tools over raw xcrun or adb commands, which are a fallback. Prefer launch-app or open-url over tapping home-screen icons. If the task may need a saved e2e test, load the argent-create-e2e skill (argent-qa-e2e for acceptance tests) before the first launch or in-app action: recording is not retroactive. Load the matching argent-* skill before React Native build or debug work, profiling, a physical phone, a Mac app or a TV. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. When the tree matches or differs slightly from an earlier tree, the result names that earlier tree by its tree id (unchanged note or `-` gone / `+` new lines) in place of repeating it. If a tap fails twice, stop retrying and call a discovery tool again. Use await-ui-element to wait for the UI instead of polling with screenshots. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup. The argent CLI manages the toolkit: argent --help lists its commands.";
37432
37640
 
37433
37641
  // ../argent-mcp/src/installed-version.ts
37434
37642
  import * as fs12 from "node:fs";
@@ -37735,6 +37943,8 @@ async function startMcpServer(options) {
37735
37943
  name: toolName,
37736
37944
  durationMs: Date.now() - t1,
37737
37945
  chars: tree?.length ?? 0,
37946
+ sentChars: shown?.text.length ?? 0,
37947
+ mode: shown?.mode,
37738
37948
  // `identical` is the repeat rate; `note` is what the agent was spared.
37739
37949
  identical: shown?.identical ?? false,
37740
37950
  note: shown?.note ?? false
@@ -16,19 +16,19 @@ export interface ArgentToolArgs {
16
16
  bundleId?: string;
17
17
  };
18
18
  "await-network-request": {
19
- /** Device ID passed as udid to network-capture-start, even if that call also used logicalDeviceId. */
19
+ /** Device ID passed as udid to network-capture-start. The wait reuses its Metro target. */
20
20
  udid: string;
21
- /** App ID passed to network-capture-start. On macOS it must match the app named by udid. On Chromium, use a valid placeholder such as argent.capture. */
21
+ /** The bundleId used for network-capture-start. On Chromium, use a valid placeholder such as argent.capture. */
22
22
  bundleId: string;
23
- /** URL text or pattern, such as "/v1/auth/login". Do not include secrets. The result includes the matched URL, and {{secret:...}} placeholders are rejected. */
23
+ /** URL text or a pattern. Match a part with no secrets. The result includes the full URL and secret placeholders are rejected. */
24
24
  url: string;
25
- /** contains (default) searches for a substring. equals compares the full URL. Both ignore case. matches uses a case-sensitive JavaScript regular expression without implicit anchors. */
25
+ /** contains (default) and equals ignore case. matches uses a case-sensitive JavaScript regular expression with no implicit anchors. */
26
26
  urlMatch?: "contains" | "equals" | "matches";
27
- /** HTTP method such as POST. Ignores case. */
27
+ /** HTTP method, matched without regard to case. */
28
28
  method?: string;
29
- /** Exact HTTP status such as 200 or a class such as "2xx". A failed request matches a status only if it received response headers. */
29
+ /** Exact HTTP status or a class such as "2xx". Failed requests can match if they received response headers. */
30
30
  status?: "1xx" | "2xx" | "3xx" | "4xx" | "5xx" | number;
31
- /** complete (default) means the response finished, regardless of HTTP status. failed matches a request error such as an abort. any accepts either. */
31
+ /** complete (default) accepts a finished response, including HTTP errors. failed accepts a request error. any accepts either. */
32
32
  outcome?: "complete" | "failed" | "any";
33
33
  /** Wait limit in milliseconds. Default 10000. */
34
34
  timeoutMs?: number;
@@ -572,13 +572,13 @@ export interface ArgentToolArgs {
572
572
  "native-network-logs": {
573
573
  /** Device ID from list-devices: an iOS simulator UDID or Android serial, or a Mac app id (macos-app-<bundle id>) */
574
574
  udid: string;
575
- /** App bundle ID on iOS or package name on Android (on a Mac app, the bundle id in the device id) */
575
+ /** App bundle ID on iOS or package name on Android. On macOS, omit the macos-app- prefix. */
576
576
  bundleId: string;
577
- /** The app's Metro port, whose requests are left out of the listing. Omit it to use this device's port, 8081 by default. */
577
+ /** Exclude requests to this Metro port on local addresses. Omit it to use the device's Metro port (usually 8081). */
578
578
  port?: number;
579
- /** Maximum number of requests to return: the most recent ones, oldest first. 0 returns only the header and the total. */
579
+ /** Take the newest matching requests and return them oldest first. Use 0 for capture status and totals without entries. */
580
580
  limit?: number;
581
- /** Clear the log after reading. The IDs of cleared requests still work in view-network-request-details */
581
+ /** Hide existing history from later lists. Cleared request IDs still work in view-network-request-details. */
582
582
  clear?: boolean;
583
583
  };
584
584
  "native-profiler-analyze": {
@@ -658,43 +658,43 @@ export interface ArgentToolArgs {
658
658
  hitTest?: boolean;
659
659
  };
660
660
  "network-capture-start": {
661
- /** Target ID from list-devices: an iOS simulator UDID, an Android serial, a Mac app ID (macos-app-<bundle id>) or a Chromium ID (chromium-cdp-<port>). */
661
+ /** Device ID from list-devices. For Mac builds started outside Argent, use macos-app-<bundle id>. */
662
662
  udid: string;
663
- /** App bundle ID on iOS or package name on Android. On Mac apps, use the bundle ID from udid. On Chromium, udid selects the app. Use a valid placeholder such as argent.capture. */
663
+ /** App bundle ID on iOS or package name on Android. On Mac, omit the macos-app- prefix. On Chromium, use a valid placeholder such as argent.capture. */
664
664
  bundleId: string;
665
- /** The app's Metro port. Omit it to use the device's port (8081 by default). Native layers exclude requests to this port on local addresses. Chromium uses the CDP port in udid. */
665
+ /** The app's Metro port for JS capture and native log filtering. Omit it only when the app uses the device's port (usually 8081); otherwise check the project's Metro start script. Chromium uses the CDP port in udid. */
666
666
  port?: number;
667
- /** Use js for JavaScript runtime capture or native for native HTTP capture. Omit to control both layers. Chromium ignores this setting and uses its single chromium layer. */
667
+ /** Omit to control both layers. Selecting one leaves the other alone. Chromium ignores this setting. */
668
668
  layer?: "js" | "native";
669
- /** Only when several devices share the Metro port: this device's logicalDeviceId, which the JS layer's reason lists. The JS layer connects to that runtime, and view-network-logs then takes it as device_id. The native layer always uses udid. */
669
+ /** For iOS simulators and Android on shared Metro, use the logical ID for the intended device if requested. Reuse it for start and stop, and as device_id for JS reads. For Mac apps, omit logicalDeviceId and keep the Mac app id even on shared Metro. */
670
670
  logicalDeviceId?: string;
671
671
  };
672
672
  "network-capture-stop": {
673
- /** Target ID from list-devices: an iOS simulator UDID, an Android serial, a Mac app ID (macos-app-<bundle id>) or a Chromium ID (chromium-cdp-<port>). */
673
+ /** Device ID from list-devices. For Mac builds started outside Argent, use macos-app-<bundle id>. */
674
674
  udid: string;
675
- /** App bundle ID on iOS or package name on Android. On Mac apps, use the bundle ID from udid. On Chromium, udid selects the app. Use a valid placeholder such as argent.capture. */
675
+ /** App bundle ID on iOS or package name on Android. On Mac, omit the macos-app- prefix. On Chromium, use a valid placeholder such as argent.capture. */
676
676
  bundleId: string;
677
- /** The app's Metro port. Omit it to use the device's port (8081 by default). Native layers exclude requests to this port on local addresses. Chromium uses the CDP port in udid. */
677
+ /** The app's Metro port for JS capture and native log filtering. Omit it only when the app uses the device's port (usually 8081); otherwise check the project's Metro start script. Chromium uses the CDP port in udid. */
678
678
  port?: number;
679
- /** Use js for JavaScript runtime capture or native for native HTTP capture. Omit to control both layers. Chromium ignores this setting and uses its single chromium layer. */
679
+ /** Omit to control both layers. Selecting one leaves the other alone. Chromium ignores this setting. */
680
680
  layer?: "js" | "native";
681
- /** Only when several devices share the Metro port: this device's logicalDeviceId, which the JS layer's reason lists. The JS layer connects to that runtime, and view-network-logs then takes it as device_id. The native layer always uses udid. */
681
+ /** For iOS simulators and Android on shared Metro, use the logical ID for the intended device if requested. Reuse it for start and stop, and as device_id for JS reads. For Mac apps, omit logicalDeviceId and keep the Mac app id even on shared Metro. */
682
682
  logicalDeviceId?: string;
683
683
  };
684
684
  "network-conditions": {
685
- /** Target device id from `list-devices`: an iOS simulator UDID, an Android emulator serial, or a Chromium id. */
685
+ /** Device ID from list-devices. */
686
686
  udid: string;
687
- /** iOS only, and required there: the bundle id of the app to throttle. */
687
+ /** Bundle ID of the app to shape. Required on iOS and ignored elsewhere. */
688
688
  bundleId?: string;
689
- /** iOS and Android: the Metro port the throttle leaves alone. Omit it to use this device's port (8081 by default). */
689
+ /** Metro port to exempt from shaping on iOS and Android. Omit for the device's port (usually 8081). */
690
690
  port?: number;
691
- /** Minimum time in milliseconds from sending a request to its response. */
691
+ /** Delay in milliseconds. Android adds it per round trip. iOS and Chromium use it as a minimum response delay. */
692
692
  latencyMs?: number;
693
693
  /** Download limit in kilobits per second. */
694
694
  downloadKbps?: number;
695
695
  /** Upload limit in kilobits per second. */
696
696
  uploadKbps?: number;
697
- /** Make requests fail as if the network were down. On Android, ports forwarded with adb reverse stay reachable. */
697
+ /** Make requests fail as if the network were down. On Android, adb reverse ports stay reachable, but Metro at 10.0.2.2 does not. False alone resets the conditions. */
698
698
  offline?: boolean;
699
699
  };
700
700
  "open-url": {
@@ -1035,19 +1035,19 @@ export interface ArgentToolArgs {
1035
1035
  "view-network-logs": {
1036
1036
  /** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
1037
1037
  port?: number;
1038
- /** Device id from list-devices, or the logicalDeviceId used to start an iOS or Android capture on shared Metro. For macOS, use the Mac app id. */
1038
+ /** Device ID from list-devices. For iOS simulators and Android, use logicalDeviceId if capture started with it. For a Mac app, keep the Mac app id macos-app-<bundle id> on shared Metro and for builds started outside Argent. */
1039
1039
  device_id: string;
1040
- /** Page index (0-based) or "latest" for the most recent page. Each page contains up to 50 entries. */
1040
+ /** Zero-based page index. "latest" and null select the newest page. Each page contains up to 50 entries. */
1041
1041
  pageIndex?: number | "latest" | null;
1042
1042
  };
1043
1043
  "view-network-request-details": {
1044
1044
  /** Metro port. Omit it to use this device's port (8081 by default). Ignored for Chromium, whose CDP port is in device_id. */
1045
1045
  port?: number;
1046
- /** Device id used to list the request. For macOS, use the Mac app id. */
1046
+ /** Device ID for the matching log. For JS capture on iOS simulators and Android, use the logicalDeviceId if capture started with it. For a Mac app, keep the Mac app id even on shared Metro. */
1047
1047
  device_id: string;
1048
- /** The requestId from view-network-logs, or a native ID (ios-, android- or macos-) from native-network-logs. */
1048
+ /** Request ID from either network log or await-network-request. */
1049
1049
  requestId: string;
1050
- /** Whether to include the response body (if captured). */
1050
+ /** Set false to omit the response body. The request body can still appear. */
1051
1051
  includeBody?: boolean;
1052
1052
  };
1053
1053
  /** @deprecated Renamed to `e2e-add-echo`. */
@@ -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.34.1-next.97";
72951
+ return "0.34.1-next.99";
72952
72952
  }
72953
72953
  return "0.0.0";
72954
72954
  }
@@ -125226,19 +125226,19 @@ async function queryViewHierarchyFor(services, params, toolId, method, errorCode
125226
125226
  // ../tool-server/src/tools/network/network-capture.ts
125227
125227
  var captureSchema = external_exports.object({
125228
125228
  udid: external_exports.string().describe(
125229
- "Target ID from list-devices: an iOS simulator UDID, an Android serial<flag:macos-apps>, a Mac app ID (macos-app-<bundle id>)</flag:macos-apps> or a Chromium ID (chromium-cdp-<port>)."
125229
+ "Device ID from list-devices<flag:macos-apps>. For Mac builds started outside Argent, use macos-app-<bundle id></flag:macos-apps>."
125230
125230
  ),
125231
125231
  bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
125232
- "App bundle ID on iOS or package name on Android<flag:macos-apps>. On Mac apps, use the bundle ID from udid</flag:macos-apps>. On Chromium, udid selects the app. Use a valid placeholder such as argent.capture."
125232
+ "App bundle ID on iOS or package name on Android<flag:macos-apps>. On Mac, omit the macos-app- prefix</flag:macos-apps>. On Chromium, use a valid placeholder such as argent.capture."
125233
125233
  ),
125234
125234
  port: metroPortField.describe(
125235
- "The app's Metro port. Omit it to use the device's port (8081 by default). Native layers exclude requests to this port on local addresses. Chromium uses the CDP port in udid."
125235
+ "The app's Metro port for JS capture and native log filtering. Omit it only when the app uses the device's port (usually 8081); otherwise check the project's Metro start script. Chromium uses the CDP port in udid."
125236
125236
  ),
125237
125237
  layer: external_exports.enum(["js", "native"]).optional().describe(
125238
- "Use js for JavaScript runtime capture or native for native HTTP capture. Omit to control both layers. Chromium ignores this setting and uses its single chromium layer."
125238
+ "Omit to control both layers. Selecting one leaves the other alone. Chromium ignores this setting."
125239
125239
  ),
125240
125240
  logicalDeviceId: external_exports.string().min(1).optional().describe(
125241
- "Only when several devices share the Metro port: this device's logicalDeviceId, which the JS layer's reason lists. The JS layer connects to that runtime, and view-network-logs then takes it as device_id. The native layer always uses udid."
125241
+ "For iOS simulators and Android on shared Metro, use the logical ID for the intended device if requested. Reuse it for start and stop, and as device_id for JS reads.<flag:macos-apps> For Mac apps, omit logicalDeviceId and keep the Mac app id even on shared Metro.</flag:macos-apps>"
125242
125242
  )
125243
125243
  });
125244
125244
  function requestedLayers(layer) {
@@ -125386,23 +125386,23 @@ var zodSchema4 = external_exports.object({
125386
125386
  "Device ID from list-devices: an iOS simulator UDID or Android serial<flag:macos-apps>, or a Mac app id (macos-app-<bundle id>)</flag:macos-apps>"
125387
125387
  ),
125388
125388
  bundleId: external_exports.string().describe(
125389
- "App bundle ID on iOS or package name on Android<flag:macos-apps> (on a Mac app, the bundle id in the device id)</flag:macos-apps>"
125389
+ "App bundle ID on iOS or package name on Android<flag:macos-apps>. On macOS, omit the macos-app- prefix</flag:macos-apps>."
125390
125390
  ),
125391
125391
  port: metroPortField.describe(
125392
- "The app's Metro port, whose requests are left out of the listing. Omit it to use this device's port, 8081 by default."
125392
+ "Exclude requests to this Metro port on local addresses. Omit it to use the device's Metro port (usually 8081)."
125393
125393
  ),
125394
125394
  limit: external_exports.number().int().nonnegative().optional().default(50).describe(
125395
- "Maximum number of requests to return: the most recent ones, oldest first. 0 returns only the header and the total."
125395
+ "Take the newest matching requests and return them oldest first. Use 0 for capture status and totals without entries."
125396
125396
  ),
125397
125397
  clear: external_exports.boolean().optional().default(false).describe(
125398
- "Clear the log after reading. The IDs of cleared requests still work in view-network-request-details"
125398
+ "Hide existing history from later lists. Cleared request IDs still work in view-network-request-details."
125399
125399
  ),
125400
125400
  // Declared so this non-strict object refuses the old stop instead of stripping it: the read
125401
125401
  // would succeed while capture records on.
125402
125402
  stop: external_exports.never({
125403
125403
  error: "native-network-logs no longer stops capture: call network-capture-stop with this udid and bundleId, which keeps what was captured (stop-all-simulator-servers for the device also ends it). Drop `stop` from this call; `stop: false` was a plain read"
125404
125404
  }).optional().describe(
125405
- "Retired: native-network-logs only reads. Call network-capture-stop with the same udid and bundleId to stop capture; drop `stop: false`, which was a plain read."
125405
+ "Retired. Omit even when false. Use network-capture-stop with the same udid and bundleId."
125406
125406
  )
125407
125407
  });
125408
125408
  function createNativeNetworkLogsTool(registry2) {
@@ -125419,18 +125419,11 @@ function createNativeNetworkLogsTool(registry2) {
125419
125419
  android: { emulator: true, device: true },
125420
125420
  macos: { app: true, catalyst: true }
125421
125421
  },
125422
- description: `Retrieve network requests captured at the native level: NSURLProtocol on iOS<flag:macos-apps> and Mac apps</flag:macos-apps>, OkHttp on Android.
125423
- Use when inspecting native-level HTTP traffic that view-network-logs cannot see: requests that never pass through JS XMLHttpRequest or fetch.
125424
- On iOS<flag:macos-apps> and Mac apps</flag:macos-apps> it sees URLSession requests (default and ephemeral session configurations, and URLSession.shared) from native modules and Swift/Objective-C code<flag:macos-apps>, and react-native-macos fetch</flag:macos-apps>. It does not see background URLSession transfers, WKWebView, Network.framework, or HTTP stacks that bypass URLSession (e.g. Flutter), so an empty result does not mean the app sent nothing.
125425
- Returns { status, header, armed, count, total, requests }: one line per request, oldest first, with its id (ios-3f9a-12, android-3f9a-12<flag:macos-apps>, macos-3f9a-12</flag:macos-apps>), method, URL, state (pending, headers, complete or failed), status, mimeType, durationMs and errorText. The header says whether capture is armed, how many requests there are and the app's pid once read, and why capture is not armed when it is not. Requests to Metro on \`port\` are left out. Pass a request's id to view-network-request-details for its headers and bodies, and on Android its redirects. The history is kept across relaunches of the app, except on a device whose devtools agent argent attached to.
125426
- Call network-capture-start before triggering requests. This tool reads existing records, including after network-capture-stop. Check the header for readiness or the reason capture is unavailable.<flag:macos-apps> If the Mac native header says stopped after a failed start, check the start result for the reason.</flag:macos-apps>
125427
- On iOS: when capture started while the app was already running, the header of the first answer says that the app's launch was not recorded; to capture the launch, call restart-app, then network-capture-start (a relaunch ends JS capture), then this tool, unless the header says the launch cannot be recorded on that device. On a local simulator, launch-app and restart-app return networkCapture saying whether capture is armed in the new process.
125428
- <flag:macos-apps>On a Mac app: when capture started while the app was already running, the header of the first answer says that its requests before the start were not recorded. Capture stays on across restart-app, and requests sent while the app starts can be missing.
125429
- </flag:macos-apps>On iOS: If status is restart_required: follow the message (usually restart-app), then retry. If status is service_stale: the app is already injected, so restarting it cannot help. Restart the tool-server (\`argent server stop && argent server start --detach\`) and retry. If the same status comes back after that restart, stop restarting: follow the message, which names the terminal fallback. If status is connect_pending: the app is injected and still connecting. Do not restart it, wait a few seconds and retry. If status is init_failed: follow the message (re-boot the simulator) rather than retrying.
125430
- On a device whose devtools agent argent attached to rather than armed itself, a not-connected app fails with \`NATIVE_DEVTOOLS_NOT_CONNECTED\` instead of a status, and no restart on argent's side fixes it. An Apple system app is rejected outright (terminal: never retry it).
125431
- On Android: needs a debuggable build. A header that says not attached means this tool-server did not attach capture to the app's current process: network-capture-start attaches it.
125432
- Capture also misses a request already in flight at the attach and requests from clients other than OkHttp (e.g. HttpURLConnection, Cronet); an app whose OkHttp is fully minified reports capture unavailable.
125433
- Android results also carry capture and captureDetail. When capture is active, captureDetail and the header can say that only some requests are captured: then an empty or short list does not mean the app sent nothing.`,
125422
+ description: `List native HTTP requests from URLSession and NSURLConnection on iOS simulators<flag:macos-apps> and Mac apps</flag:macos-apps>, or OkHttp in a debuggable Android build. Use when debugging traffic from a native module or SDK. Coverage excludes background URLSession transfers, WKWebView and Network.framework.
125423
+ Call network-capture-start before triggering requests. Returns recent requests oldest first, with capture status and coverage in header. The log stays readable after capture stops. Pass an ID to view-network-request-details.<flag:macos-apps> If the Mac log stays stopped after a failed start, check the start result.</flag:macos-apps>
125424
+ On an iOS simulator, a blocked read returns status and a message with the next action. Follow the message before retrying.
125425
+ If the call fails with NATIVE_DEVTOOLS_NOT_CONNECTED, follow its message.
125426
+ An Apple system app is rejected outright (terminal: never retry it).`,
125434
125427
  zodSchema: zodSchema4,
125435
125428
  services: (params) => {
125436
125429
  const device = resolveDevice(params.udid);
@@ -132397,7 +132390,7 @@ function createLaunchAppTool(registry2) {
132397
132390
  longRunning: true,
132398
132391
  description: `Open an installed app, or confirm the running renderer (Chromium).<flag:macos-apps> On a Mac app it starts the app in the background when it does not run, and leaves a running app as it is.</flag:macos-apps>
132399
132392
  Use when starting any app; prefer this over tapping home-screen / launcher icons. Also prepares the native-devtools injection before the app starts (iOS and Apple TV).
132400
- Returns { launched, bundleId, <flag:macos-apps>kind?, appPath?, args?, </flag:macos-apps>note?, networkCapture? }. Fails if the app is not installed on the target device (iOS / Android<flag:harmonyos> / HarmonyOS</flag:harmonyos>). On a physical iPhone this registers the app every other tool acts on; com.apple.springboard and com.apple.Spotlight register without launching. note warns when runner signing is not ready. networkCapture (Android, and local iOS simulators where capture stays on for later processes), once network-capture-start started native network capture for the app, says whether it followed the launch, or that network-capture-stop stopped it.<flag:macos-apps>
132393
+ Returns { launched, bundleId, <flag:macos-apps>kind?, appPath?, args?, </flag:macos-apps>note?, networkCapture? }. Fails if the app is not installed on the target device (iOS / Android<flag:harmonyos> / HarmonyOS</flag:harmonyos>). On a physical iPhone this registers the app every other tool acts on; com.apple.springboard and com.apple.Spotlight register without launching. note warns when runner signing is not ready. If Argent started native capture, networkCapture reports whether it followed the launch or was stopped. This note applies to Android and local iOS simulators.<flag:macos-apps>
132401
132394
  For Mac apps, kind is 'catalyst' or 'app'. Check appPath and args to confirm the build and arguments in use. The note can report an already running app or a missing window.</flag:macos-apps>
132402
132395
  For Chromium, the app is already running behind a CDP port; this call simply refreshes the cached viewport and acknowledges the bundleId tag. To change the visible route, use \`open-url\`.
132403
132396
 
@@ -132697,7 +132690,7 @@ function createRestartAppTool(registry2) {
132697
132690
  longRunning: true,
132698
132691
  description: `Terminate then relaunch an app on iOS, Android, <flag:harmonyos>HarmonyOS, </flag:harmonyos><flag:macos-apps>macOS, </flag:macos-apps>or Vega.
132699
132692
  Use when you need a clean in-memory state without a full reinstall. The relaunch also refreshes the native-devtools injection (iOS and Apple TV).<flag:macos-apps> On a Mac app it quits the app and starts the same .app again in the background.</flag:macos-apps>
132700
- Returns { restarted, bundleId, <flag:macos-apps>kind?, appPath?, args?, note?, </flag:macos-apps>networkCapture? }. networkCapture (Android, and local iOS simulators where capture stays on for later processes), once network-capture-start started native network capture for the app, says whether it followed the launch, or that network-capture-stop stopped it. Fails if the app is not installed, on a local iOS simulator if terminating it does not finish within 15s, or on a remote simulator if terminating it fails for a reason other than the app not running.<flag:macos-apps>
132693
+ Returns { restarted, bundleId, <flag:macos-apps>kind?, appPath?, args?, note?, </flag:macos-apps>networkCapture? }. If Argent started native capture, networkCapture reports whether it followed the launch or was stopped. This note applies to Android and local iOS simulators. Fails if the app is not installed, on a local iOS simulator if terminating it does not finish within 15s, or on a remote simulator if terminating it fails for a reason other than the app not running.<flag:macos-apps>
132701
132694
  For Mac apps, kind is 'catalyst' or 'app'. Check appPath and args to confirm the restarted build and arguments. Check note for warnings such as a force-quit or no window.</flag:macos-apps>`,
132702
132695
  zodSchema: zodSchema12,
132703
132696
  alwaysLoad: true,
@@ -137356,18 +137349,18 @@ init_device_info();
137356
137349
  // ../tool-server/src/tools/network-conditions/schema.ts
137357
137350
  init_zod();
137358
137351
  var networkConditionsZodSchema = external_exports.object({
137359
- udid: external_exports.string().min(1).describe(
137360
- "Target device id from `list-devices`: an iOS simulator UDID, an Android emulator serial, or a Chromium id."
137361
- ),
137362
- bundleId: external_exports.string().min(1).optional().describe("iOS only, and required there: the bundle id of the app to throttle."),
137352
+ udid: external_exports.string().min(1).describe("Device ID from list-devices."),
137353
+ bundleId: external_exports.string().min(1).optional().describe("Bundle ID of the app to shape. Required on iOS and ignored elsewhere."),
137363
137354
  port: metroPortField.describe(
137364
- "iOS and Android: the Metro port the throttle leaves alone. Omit it to use this device's port (8081 by default)."
137355
+ "Metro port to exempt from shaping on iOS and Android. Omit for the device's port (usually 8081)."
137356
+ ),
137357
+ latencyMs: external_exports.number().int().min(0).max(6e4).optional().describe(
137358
+ "Delay in milliseconds. Android adds it per round trip. iOS and Chromium use it as a minimum response delay."
137365
137359
  ),
137366
- latencyMs: external_exports.number().int().min(0).max(6e4).optional().describe("Minimum time in milliseconds from sending a request to its response."),
137367
137360
  downloadKbps: external_exports.number().int().min(1).optional().describe("Download limit in kilobits per second."),
137368
137361
  uploadKbps: external_exports.number().int().min(1).optional().describe("Upload limit in kilobits per second."),
137369
137362
  offline: external_exports.boolean().optional().describe(
137370
- "Make requests fail as if the network were down. On Android, ports forwarded with adb reverse stay reachable."
137363
+ "Make requests fail as if the network were down. On Android, adb reverse ports stay reachable, but Metro at 10.0.2.2 does not. False alone resets the conditions."
137371
137364
  )
137372
137365
  }).strict();
137373
137366
  function requestedConditions(params) {
@@ -137598,13 +137591,12 @@ var capability22 = {
137598
137591
  };
137599
137592
  var networkConditionsTool = {
137600
137593
  id: "network-conditions",
137601
- description: `Throttle the network: add latency, limit download and upload speed, or go offline.
137602
- Use to test loading states, timeouts, retries and offline handling. Each call replaces the previous conditions. Call it with no condition (only udid, plus bundleId on iOS) to remove the throttle.
137603
- Returns { scope, conditions }. scope names what was shaped:
137604
- - "app" on an iOS simulator: only the app named by bundleId, a non-Apple app with native devtools connected. Shapes its http/https URLSession requests, except WebSockets and requests to the Metro port (port). The server gets each request at once: Argent delays what the app receives. Argent applies the conditions again when the app restarts and reconnects; the app drops them when the tool-server stops. If status is restart_required, service_stale, connect_pending or init_failed, follow the message as for native-network-logs.
137605
- - "device" on an Android emulator: Argent points the emulator's global HTTP proxy at its own proxy on the host, which adds latencyMs to every round trip (a new HTTPS connection pays it several times) and caps the total speed of http/https requests and WebSockets. Not shaped: the Metro port (port), raw sockets, UDP, QUIC, DNS, apps that ignore the system proxy (such as Flutter dart:io) and connections opened before the call until they close (restart the app to shape all of them). A localhost request without adb reverse fails with 502 while throttled. Fails when the emulator has a proxy Argent did not set. A reset or a tool-server stop removes the proxy; after a crash apps cannot connect until a reset. offline removes the proxy and turns Wi-Fi and mobile data off, and fails on an emulator that keeps a network (an Android TV emulator uses Ethernet); adb reverse ports stay reachable and an app that reaches Metro at 10.0.2.2 loses it. Any call other than offline turns both radios on when no network is up and fails if none comes up within 15 s.
137606
- - "tab" on Chromium: requests of the active tab's page, not its workers, service workers or cross-site iframes. Argent applies the conditions again after a tab switch and before a tab opened by chromium-tabs loads.
137607
- conditions is null after a reset. Fails on a physical iOS or Android device.`,
137594
+ description: `Add latency, cap speed or simulate an offline connection. Use when testing loading states, retries or timeouts. Each call replaces the previous conditions. Omit the conditions to reset after the test.
137595
+ Returns the scope and applied conditions. A reset returns null for conditions.
137596
+ On a local iOS simulator, Argent shapes one app's intercepted HTTP traffic. While online, Argent forwards requests immediately and delays delivery to the app. Native devtools must be connected. WebSockets and the Metro port are exempt. Follow message if the result includes a status.
137597
+ On Android, Argent shapes traffic that uses the system proxy. Restart the app if existing connections bypass shaping. Throttling fails if the emulator has a proxy Argent did not set. Ethernet can prevent offline mode. Reset if a crash leaves the emulator unable to connect.
137598
+ On Chromium, Argent shapes the active page. Workers and cross-site iframes are outside its scope.
137599
+ Fails on physical devices and remote iOS simulators.`,
137608
137600
  zodSchema: networkConditionsZodSchema,
137609
137601
  searchHint: "network throttle latency slow offline bandwidth 3g conditions emulate",
137610
137602
  interaction: {
@@ -140652,25 +140644,20 @@ ${lines.join("\n")}`;
140652
140644
  var zodSchema38 = external_exports.object({
140653
140645
  port: metroPortField,
140654
140646
  device_id: external_exports.string().describe(
140655
- "Device id from list-devices, or the logicalDeviceId used to start an iOS or Android capture on shared Metro<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
140647
+ "Device ID from list-devices. For iOS simulators and Android, use logicalDeviceId if capture started with it<flag:macos-apps>. For a Mac app, keep the Mac app id macos-app-<bundle id> on shared Metro and for builds started outside Argent</flag:macos-apps>."
140656
140648
  ),
140657
140649
  // `.default` covers only an omitted param, and `z.coerce.number()` reads null as 0, so
140658
140650
  // null would return the oldest page. Agents send null for "not set": read it as "latest".
140659
140651
  pageIndex: external_exports.union([external_exports.coerce.number().int().nonnegative(), external_exports.literal("latest")]).nullable().default("latest").transform((value) => value ?? "latest").describe(
140660
- 'Page index (0-based) or "latest" for the most recent page. Each page contains up to 50 entries.'
140652
+ 'Zero-based page index. "latest" and null select the newest page. Each page contains up to 50 entries.'
140661
140653
  )
140662
140654
  });
140663
140655
  var networkLogsTool = {
140664
140656
  id: "view-network-logs",
140665
- description: `Retrieve captured network (HTTP) requests from the running app.
140666
- Returns a paginated list of requests with method, URL, status, resource type, size, and duration.
140667
- A size with "~" is estimated from the body's length in characters; on React Native, "\u2192 <url>" is the final URL after a redirect.
140668
- Pass an entry's requestId to view-network-request-details for full details.
140669
- On React Native, lists XMLHttpRequest (including axios), React Native fetch, Expo fetch, and requests from libraries such as react-native-fetch-api that call React Native's network module in a Metro development build.
140670
- For JavaScript capture on iOS and Android<flag:macos-apps> (and on Mac apps)</flag:macos-apps>, use network-capture-start before triggering requests and after a reload. On Vega, the first read starts capture. Read again after a reload to resume capture.<flag:macos-apps> Use native-network-logs for native URLSession traffic on Mac apps. Both logs can show the same fetch request.</flag:macos-apps>
140671
- On Chromium, lists all request types for the active tab.
140672
- Use when inspecting outbound HTTP traffic or debugging API calls in the running app.
140673
- Fails if the app is not connected (RN) or the device is not reachable (Chromium).`,
140657
+ description: `List captured HTTP requests from React Native JavaScript or the active Chromium tab. Use when you need to find a request or compare several calls. For native traffic, use native-network-logs.
140658
+ Returns a paginated list with request IDs, status, size and timing. Pass an ID to view-network-request-details for headers and bodies.
140659
+ On iOS simulators<flag:macos-apps>, Mac apps</flag:macos-apps> and Android, call network-capture-start before the action and again after a reload. On Vega, read this log before the action and again after a reload to resume capture. Chromium records while Argent is attached to the page.
140660
+ Fails if the Chromium target is unreachable. A read can also fail if Argent cannot reach the debugger for an existing JS capture. If the tool returns a capture message in place of a list, follow it before retrying.`,
140674
140661
  zodSchema: zodSchema38,
140675
140662
  readOnly: true,
140676
140663
  interaction: {
@@ -140821,20 +140808,16 @@ ${postData.slice(0, MAX_BODY_SIZE)}...`;
140821
140808
  var zodSchema39 = external_exports.object({
140822
140809
  port: metroPortField,
140823
140810
  device_id: external_exports.string().describe(
140824
- "Device id used to list the request<flag:macos-apps>. For macOS, use the Mac app id</flag:macos-apps>."
140825
- ),
140826
- requestId: external_exports.string().describe(
140827
- "The requestId from view-network-logs, or a native ID (ios-, android-<flag:macos-apps> or macos-</flag:macos-apps>) from native-network-logs."
140811
+ "Device ID for the matching log. For JS capture on iOS simulators and Android, use the logicalDeviceId if capture started with it<flag:macos-apps>. For a Mac app, keep the Mac app id even on shared Metro</flag:macos-apps>."
140828
140812
  ),
140829
- includeBody: external_exports.boolean().default(true).describe("Whether to include the response body (if captured).")
140813
+ requestId: external_exports.string().describe("Request ID from either network log or await-network-request."),
140814
+ includeBody: external_exports.boolean().default(true).describe("Set false to omit the response body. The request body can still appear.")
140830
140815
  });
140831
140816
  var networkRequestTool = {
140832
140817
  id: "view-network-request-details",
140833
- description: `Read the details of one request after listing captured traffic. Native requests can be read without a debugger connection.
140834
- Returns request/response headers (sensitive headers redacted), status, timing, the request body, and optionally the response body.
140835
- Request and response bodies over 1000 chars are cut to 1000 under a "[TRUNCATED: ...]" line that gives the full size; a binary response body is omitted, as is a binary request body of a native ID. For a native ID, a body that cannot be read shows "[unavailable: <reason>]"; when the reason says the app may still be sending the request body, call again once the request has ended. Use when you need headers, body, or timing for a specific request after listing logs.
140836
- If a request is missing, the tool returns an error: list requests again. If capture is off, start it before reproducing the request. On Vega, a JS lookup can start capture. Use view-network-logs before triggering requests on Vega.
140837
- IDs from stopped capture still work. After a JavaScript reload, list requests again because an old JS ID may now refer to a different request.`,
140818
+ description: `Read the details of one captured request. Call this with an ID from a network log or await-network-request. Native requests need no debugger connection.
140819
+ Returns status, timing, headers and available bodies. Argent redacts sensitive headers and limits text previews to 1000 characters. URLs and bodies can still contain secrets. If a native upload is still in progress, retry after it finishes.
140820
+ If the ID is not found, the tool returns a message. Refresh the log if that happens or after a JavaScript reload. Reloads can reuse IDs for different requests. On Vega, a JS lookup can start capture. Read view-network-logs before triggering the request.`,
140838
140821
  zodSchema: zodSchema39,
140839
140822
  readOnly: true,
140840
140823
  interaction: {
@@ -141236,11 +141219,10 @@ var JS_ANSWER_WAIT_MS = 5e3;
141236
141219
  function createNetworkCaptureStartTool(registry2) {
141237
141220
  return {
141238
141221
  id: "network-capture-start",
141239
- description: `Start network capture on iOS simulators and Android<flag:macos-apps> (also on Mac apps)</flag:macos-apps>. Use when you need to inspect traffic from an upcoming action or check a request with await-network-request. A new start keeps the log and begins a new window for the wait. Capture can slow the app.
141240
- On Chromium, Argent connects if needed and marks the start of the wait window. The log records while connected.
141241
- The JavaScript layer needs an app connected to Metro. After a reload or relaunch, start capture again once JavaScript loads and before triggering the request. Android native capture needs a debuggable build.<flag:macos-apps> For a supported React Native app launched from Xcode, use layer js and form udid as macos-app-<bundle id>. Native capture needs a supported build launched through Argent.</flag:macos-apps>
141242
- Returns { status, layers }: check armed and reason for each requested layer. A pending native layer can become ready when Argent launches or reconnects to the app. On a device whose devtools agent Argent attached to, start native capture again after a relaunch.
141243
- When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING.`,
141222
+ description: `Start HTTP capture on iOS simulators, Android<flag:macos-apps>, Mac apps</flag:macos-apps> and Chromium. Call this before the action you want to inspect. Each start keeps existing requests and opens a new window for await-network-request. On Chromium, start attaches to the tab if needed and marks the window in its log.
141223
+ Returns each layer's readiness in armed. Follow reason if a layer is still waiting or unavailable. Native capture can arm when the app connects on iOS<flag:macos-apps> and Mac apps</flag:macos-apps>. On Android, it can attach when Argent launches the app. JS capture needs the app's Metro port. Start it again after a reload or relaunch.<flag:macos-apps> For a React Native Mac app launched from Xcode, select layer js. If the reason lists other targets for a Mac app, verify the app's Metro port and Debug build.</flag:macos-apps>
141224
+ Stop capture with network-capture-stop when you have the requests. Native capture can affect timing.
141225
+ Fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING when every requested layer is unavailable.`,
141244
141226
  zodSchema: captureSchema,
141245
141227
  capability: CAPTURE_CAPABILITY,
141246
141228
  interaction: {
@@ -141595,10 +141577,8 @@ var JS_ANSWER_WAIT_MS2 = 5e3;
141595
141577
  function createNetworkCaptureStopTool(registry2) {
141596
141578
  return {
141597
141579
  id: "network-capture-stop",
141598
- description: `Stop network capture and keep the recorded requests. Use when you have the requests you need, before profiling, or to end capture in an e2e test.
141599
- On Chromium, mark the end of the window for await-network-request. The existing connection keeps recording for view-network-logs. If no window was started, call network-capture-start before reproducing the request.
141600
- On other supported targets, read the retained requests with native-network-logs or view-network-logs. Use view-network-request-details with an ID from the log. JS request IDs expire on reload. Capture stays off until network-capture-start, including after relaunch. In-flight requests can finish in the log. Stopping Android native capture marks them failed in the log without interrupting the app's requests. Only bodies read before that stop remain available.
141601
- Returns { status, layers }. Check armed and reason to confirm the stop. If the stop fails to reach the JS runtime, retry once the app reconnects to Metro. total counts the retained requests, or is 0 when the stop cannot count them.`,
141580
+ description: `Stop capture and keep the recorded requests. Call this after collecting the requests you need or before profiling. Read any Android native bodies you need before stopping. On Chromium, this closes the window for await-network-request. The tab log keeps recording while Argent is attached.
141581
+ Returns a result for each layer. Check armed and reason. The reason can explain an unconfirmed stop or say that capture never started. If Argent fails to reach the JS runtime, retry after it reconnects to Metro.`,
141602
141582
  zodSchema: captureSchema,
141603
141583
  capability: CAPTURE_CAPABILITY,
141604
141584
  interaction: {
@@ -143598,26 +143578,26 @@ var DEFAULT_POLL_INTERVAL_MS2 = 400;
143598
143578
  var MIN_JS_READ_MS = 1e3;
143599
143579
  var zodSchema44 = external_exports.object({
143600
143580
  udid: external_exports.string().min(1).describe(
143601
- "Device ID passed as udid to network-capture-start, even if that call also used logicalDeviceId."
143581
+ "Device ID passed as udid to network-capture-start. The wait reuses its Metro target."
143602
143582
  ),
143603
143583
  bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
143604
- "App ID passed to network-capture-start<flag:macos-apps>. On macOS it must match the app named by udid</flag:macos-apps>. On Chromium, use a valid placeholder such as argent.capture."
143584
+ "The bundleId used for network-capture-start. On Chromium, use a valid placeholder such as argent.capture."
143605
143585
  ),
143606
143586
  url: external_exports.string().min(1).describe(
143607
- 'URL text or pattern, such as "/v1/auth/login". Do not include secrets. The result includes the matched URL, and {{secret:...}} placeholders are rejected.'
143587
+ "URL text or a pattern. Match a part with no secrets. The result includes the full URL and secret placeholders are rejected."
143608
143588
  ),
143609
143589
  urlMatch: external_exports.enum(["contains", "equals", "matches"]).optional().describe(
143610
- "contains (default) searches for a substring. equals compares the full URL. Both ignore case. matches uses a case-sensitive JavaScript regular expression without implicit anchors."
143590
+ "contains (default) and equals ignore case. matches uses a case-sensitive JavaScript regular expression with no implicit anchors."
143611
143591
  ),
143612
- method: external_exports.string().min(1).optional().describe("HTTP method such as POST. Ignores case."),
143592
+ method: external_exports.string().min(1).optional().describe("HTTP method, matched without regard to case."),
143613
143593
  status: external_exports.union([
143614
143594
  external_exports.enum(STATUS_CLASSES),
143615
143595
  external_exports.coerce.number().int().min(100).max(599)
143616
143596
  ]).optional().describe(
143617
- 'Exact HTTP status such as 200 or a class such as "2xx". A failed request matches a status only if it received response headers.'
143597
+ 'Exact HTTP status or a class such as "2xx". Failed requests can match if they received response headers.'
143618
143598
  ),
143619
143599
  outcome: external_exports.enum(["complete", "failed", "any"]).optional().describe(
143620
- "complete (default) means the response finished, regardless of HTTP status. failed matches a request error such as an abort. any accepts either."
143600
+ "complete (default) accepts a finished response, including HTTP errors. failed accepts a request error. any accepts either."
143621
143601
  ),
143622
143602
  timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(`Wait limit in milliseconds. Default ${DEFAULT_TIMEOUT_MS4}.`),
143623
143603
  pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(
@@ -143671,9 +143651,9 @@ function createAwaitNetworkRequestTool(registry2) {
143671
143651
  return {
143672
143652
  // A literal, so scripts/extract-tools.mjs finds the description it scores.
143673
143653
  id: "await-network-request",
143674
- description: `Check whether a matching request finished. Use when an action should send a specific request. Call network-capture-start before the action, then call this tool. It searches requests started since the latest capture start and waits until a match finishes or the timeout expires. On Chromium, match the final URL, method and status after redirects.
143675
- Pass match.id as requestId to view-network-request-details for headers and bodies. A request can match only if Argent saw its outcome. When success is false, check cause. For unmet or unreadable, nearMisses can show which criteria captured requests missed. For unreadable, follow the layer notes to restore capture and repeat the action. For cancelled, retry if needed. A false result fails an e2e step and stops a run-sequence.
143676
- If the tool raises NETWORK_CAPTURE_NOT_STARTED, start capture and repeat the action. While the JavaScript capture window is active, the wait can reconnect to the runtime and restore recording. Requests sent before recording resumes may be missing.`,
143654
+ description: `Check whether a request finished in the latest capture window. Call network-capture-start before the action. Call this tool after triggering the request, then stop capture when you are done. On Chromium, match the final URL and method after redirects. Other layers use the URL the app requested. Physical iPhones and Vega are unsupported.
143655
+ Returns the match or diagnostic details. Use match.id with view-network-request-details. A miss only means no captured request matched. Check cause and nearMisses. If capture is unreadable, follow the layer notes before repeating the action. An active JS window can restore recording after a disconnect. Requests sent before it reconnects can be missing.
143656
+ Fails with NETWORK_CAPTURE_NOT_STARTED if there is no usable capture window. Start capture and repeat the action. A result with success false fails an e2e step and stops a run-sequence.`,
143677
143657
  zodSchema: zodSchema44,
143678
143658
  searchHint: "wait await network request http api call fetch xhr response status url match after capture start e2e assert",
143679
143659
  readOnly: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.97",
3
+ "version": "0.34.1-next.99",
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": "9c7ffba5a6037c9389f55a670dd55968e5c5cfde"
101
+ "gitHead": "1434678620bf0a87c1281b78db69256cac5dd387"
102
102
  }
@@ -16,7 +16,6 @@ Read this file before creating or changing an e2e test. Exercise the saved path
16
16
  - [Scrolling and swiping](#scrolling-and-swiping)
17
17
  - [Live waits and checks](#live-waits-and-checks)
18
18
  - [Network capture](#network-capture)
19
- - [Network checks](#network-checks)
20
19
  - [Wrong turns](#wrong-turns)
21
20
  - [Finish and polish](#finish-and-polish)
22
21
  - [Worked example](#worked-example)
@@ -147,23 +146,16 @@ A warning does not reject the step. If `e2e-finish-recording` reports dropped wa
147
146
 
148
147
  ### Network capture
149
148
 
150
- On iOS, Android, and Mac apps, record a capture start before reproducing the request. On Chromium, record `view-network-logs` before the action if you only need to inspect requests. Use start and stop steps when the test needs a capture window. The Chromium log includes requests outside that window.
149
+ On iOS simulators, Android, Mac apps, and Chromium, use `e2e-add-step` to record `network-capture-start`, the action, `await-network-request`, and `network-capture-stop` in that order. Put capture start after launch and the first-screen wait. A start before `launch:` makes the test a fragment. Use [Inspect network requests](../../argent-metro-debugger/SKILL.md#inspect-network-requests) for platform setup.
151
150
 
152
- 1. Add `network-capture-start` through `e2e-add-step` after the launch and first-screen wait, if present, and before the action. A relaunch ends JS capture. A start before `launch:` makes the test a fragment.
153
- 2. After the action, record a network check if the test must verify the request. Record `network-capture-stop` as soon as you have the requests you need.
154
- 3. If a read reports that capture never started, record the start through `e2e-add-step`, then re-record the action and the read. Replay only runs the steps you recorded.
155
- 4. A `tool:` step keeps its recorded `bundleId` on every platform. Only `launch:` takes an id per platform. If the app id differs by platform, add a top-level `requires:` block with the recording platform (see [File shape and test type](e2e-yaml.md#file-shape-and-test-type)). Record a separate test for each other platform.
156
- 5. After replay, check `armed` and `reason` for the layer the test uses in each step's `result`. A passed step can report an unarmed start or an unconfirmed stop. A Chromium stop reports `armed: false` even when `reason` says no capture window was started. Fix the reported problem and replay before relying on the capture.
151
+ - Keep the wait as a raw `tool:` step. A log listing can pass with an empty log. Match a part of the URL that contains no secret. On Android, capture can slow the app: start just before the action and stop right after the wait. When collecting several related requests, stop after the last check.
152
+ - If the recorder reports `NETWORK_CAPTURE_NOT_STARTED`, record the missing start, then repeat and record the action and the wait. Replay only uses recorded steps.
153
+ - If the recorder saves a failed wait, inspect `toolResult.nearMisses` for an `unmet` wait. Restore capture and repeat the action for `unreadable`. Record a new wait if cancelled. Remove superseded steps after `e2e-finish-recording`.
154
+ - On replay, verify the relevant layer's `armed` and `reason` in the start and stop results. On Chromium, stop can report `armed: false` even when there was no window. If a failed step skips the stop, stop capture before replaying.
157
155
 
158
- ### Network checks
156
+ On Vega, call `view-network-logs` before the action to start JavaScript capture. Read the log again after the action to inspect the requests. `await-network-request` is unavailable on Vega.
159
157
 
160
- Use `await-network-request` when the replay must verify that the action sent a request. A log listing passes even when the request is missing. Record start → action → wait → stop through `e2e-add-step`. This works on iOS simulators, Android, Mac apps, and Chromium. On Chromium use the same valid `bundleId` placeholder, such as `argent.capture`, for the capture calls and the wait.
161
-
162
- Keep the wait as a `tool:` step in YAML. Match on a part of the URL that contains no secret.
163
-
164
- On Android, capture can slow the app. Start just before the triggering action and stop immediately after the wait, before checking the UI. For many related requests, keep capture running through the group and stop after the last wait. If a replay fails before the stop, stop capture before retrying.
165
-
166
- If the recorder reports `NETWORK_CAPTURE_NOT_STARTED`, record the start and repeat the action. If it records a wait with `success: false`, read the warning. For `unmet`, use `toolResult.nearMisses` and the request counts in `toolResult.note` to check the matcher and the recorded action. For `unreadable`, fix the layer named in the result before repeating the action. For `cancelled`, record the wait again. Remove superseded steps after `e2e-finish-recording`.
158
+ A recorded `tool:` step keeps its `bundleId` on every platform. If app IDs differ, restrict the test with [`requires:`](e2e-yaml.md#file-shape-and-test-type) and record a test for each platform.
167
159
 
168
160
  ### Wrong turns
169
161
 
@@ -16,32 +16,34 @@ Each tool's own description carries its parameters, defaults, return shape and e
16
16
 
17
17
  ## 2. Choosing the Right Tool
18
18
 
19
- | Action | Tool | Notes |
20
- | ------------------------------ | -------------------- | ------------------------------------------------------------------------ |
21
- | Several known steps | `run-sequence` | One call, one screenshot at the end (§5) |
22
- | Open an app | `launch-app` | **Never tap home-screen icons** |
23
- | Restart an app | `restart-app` | Clean in-memory state |
24
- | Open URL / deep link | `open-url` | Web pages, deep links, URL schemes |
25
- | Tap | `gesture-tap` | Buttons, links, checkboxes |
26
- | Scroll / swipe | `gesture-swipe` | Touch targets; not Chromium |
27
- | Scroll (Chromium) | `gesture-scroll` | Mouse wheel |
28
- | Drag (Chromium) | `gesture-drag` | Sliders, drag-and-drop, text selection |
29
- | Long press, drag & drop | `gesture-custom` | Also any other non-linear touch sequence |
30
- | Pinch / zoom | `gesture-pinch` | |
31
- | Two-finger rotation | `gesture-rotate` | |
32
- | Hardware key | `button` | Home, back, power, volume, appSwitch, actionButton |
33
- | Type text or press a named key | `keyboard` | Every platform; text or one key per call (§6) |
34
- | Paste text | `paste` | Only where a user would paste (§6). Sim/emu, Mac app |
35
- | Rotate device | `rotate` | Orientation changes |
36
- | Fold device | `fold` | Foldables only: `references/foldables.md` |
37
- | Shake device | `shake` | Shake handlers (sim/emu only), Undo-typing prompt, RN dev menu |
38
- | Slow or offline network | `network-conditions` | Latency, bandwidth, offline. iOS sim app, Chromium tab, Android emulator |
39
- | Wait for UI | `await-ui-element` | Block until an element is visible/hidden/exists/contains text |
40
- | Wait for idle | `await-screen-idle` | Block until a non-empty tree holds for `minStableMs` (§4) |
19
+ | Action | Tool | Notes |
20
+ | ------------------------------ | -------------------- | -------------------------------------------------------------- |
21
+ | Several known steps | `run-sequence` | One call, one screenshot at the end (§5) |
22
+ | Open an app | `launch-app` | **Never tap home-screen icons** |
23
+ | Restart an app | `restart-app` | Clean in-memory state |
24
+ | Open URL / deep link | `open-url` | Web pages, deep links, URL schemes |
25
+ | Tap | `gesture-tap` | Buttons, links, checkboxes |
26
+ | Scroll / swipe | `gesture-swipe` | Touch targets; not Chromium |
27
+ | Scroll (Chromium) | `gesture-scroll` | Mouse wheel |
28
+ | Drag (Chromium) | `gesture-drag` | Sliders, drag-and-drop, text selection |
29
+ | Long press, drag & drop | `gesture-custom` | Also any other non-linear touch sequence |
30
+ | Pinch / zoom | `gesture-pinch` | |
31
+ | Two-finger rotation | `gesture-rotate` | |
32
+ | Hardware key | `button` | Home, back, power, volume, appSwitch, actionButton |
33
+ | Type text or press a named key | `keyboard` | Every platform; text or one key per call (§6) |
34
+ | Paste text | `paste` | Only where a user would paste (§6). Sim/emu, Mac app |
35
+ | Rotate device | `rotate` | Orientation changes |
36
+ | Fold device | `fold` | Foldables only: `references/foldables.md` |
37
+ | Shake device | `shake` | Shake handlers (sim/emu only), Undo-typing prompt, RN dev menu |
38
+ | Slow or offline network | `network-conditions` | iOS simulator app, Android emulator, or Chromium tab |
39
+ | Wait for UI | `await-ui-element` | Block until an element is visible/hidden/exists/contains text |
40
+ | Wait for idle | `await-screen-idle` | Block until a non-empty tree holds for `minStableMs` (§4) |
41
+
42
+ After a network test, call `network-conditions` with the same target and omit the conditions to reset. On Android, this brings an offline emulator back online. If an Argent crash leaves an emulator's proxy active, reset before retrying.
41
43
 
42
44
  ## 3. Finding Tap Targets
43
45
 
44
- After an action moves you to a different screen, or whenever you don't know an element's coordinates, discover before tapping. Interaction results already carry the element tree (`--- Elements after action (describe) ---`): use it, and call a discovery tool only when no fresh tree covers the current screen. Each tree has a `Tree id`. When the tree is identical to an earlier one, the result names that id in place of the tree: use that tree, and call `describe` if it is not in your context. An identical tree does not mean the action did nothing.
46
+ After an action moves you to a different screen, or whenever you don't know an element's coordinates, discover before tapping. Interaction results already carry the element tree (`--- Elements after action (describe) ---`): use it, and call a discovery tool only when no fresh tree covers the current screen. Each full tree has a `Tree id`. When the tree matches an earlier one, or only a few lines changed, the result names that id in place of repeating the full tree (an unchanged note, or `-` gone / `+` new lines against it): apply that to the named tree, and call `describe` if it is not in your context. An identical tree does not mean the action did nothing.
45
47
 
46
48
  | Need | Tool |
47
49
  | ---------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
@@ -80,7 +82,7 @@ Use `run-sequence` when every step is known in advance; if a step depends on wha
80
82
  - "submit form": fill every field, then tap submit
81
83
  - "go back to X": a known tap path
82
84
 
83
- Use `await-ui-element` to gate a step on a screen transition. To gate on a network request, start capture before the sequence, then put `await-network-request` after the triggering action. A failed step, including a wait with `success: false`, stops the sequence and returns partial results.
85
+ Use `await-ui-element` to gate a step on a screen transition. To gate on a request, start capture before the sequence and put `await-network-request` after the triggering action. A failed step, including a wait with `success: false`, stops the sequence and returns partial results.
84
86
 
85
87
  ## 6. Text Entry and Secrets
86
88
 
@@ -55,4 +55,4 @@ Read `references/e2e.md` before recording or writing a test for a Mac app.
55
55
 
56
56
  ## React Native
57
57
 
58
- For React Native Debug builds on macOS, including Mac Catalyst, start Metro before `boot-device` (see `argent-react-native-app-workflow`). Use `describe` for UI targets. For JavaScript debugging and network capture, follow the Mac app workflow in `argent-metro-debugger`.
58
+ For React Native Debug builds on macOS, including Mac Catalyst, start Metro before `boot-device` (see `argent-react-native-app-workflow`). Use `describe` for UI targets. For JavaScript debugging and network capture, load `argent-metro-debugger` and follow [React Native Mac apps](../argent-metro-debugger/SKILL.md#react-native-mac-apps) and [Inspect network requests](../argent-metro-debugger/SKILL.md#inspect-network-requests).
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: argent-metro-debugger
3
- description: Debug JavaScript with Argent in React Native apps on iOS, Android, Vega, and macOS, or in Chromium and Electron over CDP. Use when connecting to a runtime, inspecting React components, reading console logs, or evaluating JavaScript.
3
+ description: Debug JavaScript with Argent in React Native apps on iOS, Android, Vega, and macOS, or in Chromium and Electron over CDP. Use when connecting to a runtime, inspecting React components, reading console logs, evaluating JavaScript, or inspecting and checking an app's HTTP requests.
4
4
  ---
5
5
 
6
6
  ## 1. Prerequisites
@@ -16,42 +16,42 @@ Physical iPhone: not supported; every `debugger-*` tool rejects `kind: "device"`
16
16
 
17
17
  Use the `device_id` from `list-devices` and keep the same ID and Metro port across calls. On shared Metro, if `debugger-connect` cannot match an iOS simulator UDID or Android serial, it lists logical IDs. Choose the requested device's `logicalDeviceId` for subsequent debugger calls. If you later tear down this session, include that ID in `stop-all-simulator-servers`'s `devices`.
18
18
 
19
- | Tool | Use for |
20
- | ---------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
21
- | `debugger-status` | Diagnosing the connection. Call it first when anything fails |
22
- | `debugger-connect` | Opening the session and starting console capture |
23
- | `debugger-reload-metro` | Reloading the JS bundle of an attached app |
24
- | `restart-app` | Relaunching the app when it lost its Metro connection |
25
- | `debugger-component-tree` | Component names and testIDs on screen. Find tap targets with `describe` |
26
- | `debugger-inspect-element` | Which component is at a point and where it is defined (source file:line). Takes **logical pixels**, not normalized 0–1 |
27
- | `debugger-log-registry` | Console log summary, the newest entries inline, and the log file path (§4) |
28
- | `debugger-evaluate` | Running a JS expression in the app runtime |
29
- | `view-network-logs` → `view-network-request-details` | Find a request and inspect its headers, timing, or body |
19
+ | Tool | Use for |
20
+ | -------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
21
+ | `debugger-status` | Diagnosing the connection. Call it first when anything fails |
22
+ | `debugger-connect` | Opening the session and starting console capture |
23
+ | `debugger-reload-metro` | Reloading the JS bundle of an attached app |
24
+ | `restart-app` | Relaunching the app when it lost its Metro connection |
25
+ | `debugger-component-tree` | Component names and testIDs on screen. Find tap targets with `describe` |
26
+ | `debugger-inspect-element` | Which component is at a point and where it is defined (source file:line). Takes **logical pixels**, not normalized 0–1 |
27
+ | `debugger-log-registry` | Console log summary, the newest entries inline, and the log file path (§4) |
28
+ | `debugger-evaluate` | Running a JS expression in the app runtime |
30
29
 
31
30
  A component missing from `debugger-component-tree`? `includeSkipped` only adds counts of what was pruned. Use `onScreenOnly: false` for one off screen, or `debugger-inspect-element` at its point for one on screen.
32
31
 
33
- ### Inspect HTTP requests
34
-
35
- On iOS simulators, Android, and Mac apps, call `network-capture-start` before reproducing the request and check that `js` reports `armed: true`. Start again once JavaScript is ready after a reload or relaunch.
36
-
37
- After the action, use `await-network-request` if you know which request to check. Use `view-network-logs` to explore the traffic. Open the details with `view-network-request-details` when needed. Stop capture when you have what you need. If the stop still reports `armed: true`, follow its `reason`.
38
-
39
- Use the device ID as `udid` for start, stop, and the wait. On shared Metro, pass the logical ID as `logicalDeviceId` for start and stop, or `device_id` for the log tools. The wait reuses the Metro target from the start. Keep the Metro port consistent across the other calls.
40
-
41
- On Vega, call `view-network-logs` before reproducing the request and again after a reload.
42
-
43
- On Chromium and Electron, call `view-network-logs` before reproducing the request so Argent connects to the page. Use `network-capture-start` and `network-capture-stop` to mark a capture window when needed. The log includes requests outside that window.
44
-
45
32
  ### React Native Mac apps
46
33
 
47
34
  1. Start Metro before launching a Debug Hermes build of react-native-macos 0.76+ or React Native for Mac Catalyst. Launch Mac Catalyst through Argent so it can identify its runtime. If `boot-device` refuses a hardened react-native-macos build, have the user start it from Xcode. JavaScript tools still work. UI inspection and gestures require a build Argent can control.
48
35
  2. Keep `macos-app-<bundle id>` as `device_id`, even on shared Metro. If a call returns `device_mismatch`, check that the Debug bundle loaded from the requested Metro port. The IDs in the error identify other targets.
49
- 3. For a build started from Xcode, use `macos-app-<bundle id>` as `udid` and set `layer: "js"` for start and stop. `list-devices` only lists Mac apps launched through Argent. To inspect native `URLSession` requests, launch a supported build through Argent and read with `native-network-logs`.
50
36
 
51
37
  Use `describe` for tap targets. The React tools use the root with the most components, which can be in a different window. Before using a point, verify that both tools are looking at the same window. To inspect a tap point from the React tree, multiply its fractions by the width and height in `Screen: WxH`. The resulting points include the title bar. On the old architecture (Paper), native views around the React root can shift those points. Check the returned component against the intended control.
52
38
 
39
+ For JavaScript capture in an app started from Xcode, use `macos-app-<bundle id>` as `udid` and select `layer: "js"` on start and stop. `list-devices` only lists Mac apps launched through Argent. Native capture needs a supported build launched through Argent.
40
+
53
41
  If `debugger-reload-metro` fails to reload the Mac app, use `restart-app` for an Argent-controlled build. For a build started from Xcode, restart it there.
54
42
 
43
+ ### Inspect network requests
44
+
45
+ 1. Choose the log. Use `view-network-logs` for JavaScript or the active Chromium tab and `native-network-logs` for OkHttp or URLSession. The two logs can show the same request.
46
+ 2. Start before triggering the request. On iOS simulators, Android, and Mac apps, call `network-capture-start`. Select `layer: "js"` or `layer: "native"` when you only need one. Check that the layer you need is armed. On Vega, read the JS log to start. On Chromium, read the log to attach or call start if you need a window for a request check.
47
+ 3. After the action, use `await-network-request` to check for a specific request or read the logs to explore traffic. On Vega, use the log. On Chromium, use a valid placeholder bundle ID such as `argent.capture` for start, stop, and wait. The log includes traffic outside the window. For redirects, Chromium waits match the final URL and method. Other layers match the URL the app requested.
48
+ 4. For an `unmet` wait, check the action and matcher against the near misses. For `unreadable`, follow the layer notes before repeating the action. A wait can restore recording while a JS window is active, but may miss requests sent before it reconnects.
49
+ 5. Pass an ID from the log or wait to `view-network-request-details`. Read Android native bodies you need before stopping. Stop the capture you started with `network-capture-stop`. Check `armed` and `reason` to confirm what stopped. On Chromium, a stop closes the window and leaves tab logging active.
50
+
51
+ Keep the original `udid` for start, wait, stop, and native reads. On iOS simulators and Android, if shared Metro requires a logical ID, use it as `logicalDeviceId` on start and stop and as `device_id` on JS reads. For Mac apps, keep `macos-app-<bundle id>` for capture and JS reads, even on shared Metro. Check the project's Metro start script if the port is unclear. Pass the same port throughout when it differs from the device default. The wait reuses the target from start.
52
+
53
+ After a JavaScript reload or relaunch, start JS capture again before repeating the action. On Vega, read the log again instead. If the Android app restarted outside Argent, start native capture again. If an iOS provider owns native capture, relaunch clears its history. Once the app reconnects, start capture again and confirm the native layer is armed.
54
+
55
55
  ## 3. Rules and recovery
56
56
 
57
57
  1. **`debugger-status` first when something fails.** Only `debugger-status` and `debugger-log-registry` return `status: "not_connected"` with a `guidance`; the other tools throw. Follow the `guidance` once; do not retry in a loop.
@@ -83,7 +83,7 @@ A snapshot has no recorder form. Inspect its stable state during the walkthrough
83
83
  - **Repeated controls:** prefer an id. Otherwise use YAML-only `within` with a stable container. Use `text.in` to prove rendered membership inside that container.
84
84
  - **Dynamic content:** assert controlled state or stable app chrome. Use anchored structure for unavoidable dynamic values and disclose the dependency.
85
85
  - **Visual state:** snapshot only a correct, settled, deterministic screen. Use full screen for global changes and `cropOn` for one component.
86
- - **Network requests:** record capture inside the test, after `launch:`, so both replays establish their own capture window. On Android, start just before the triggering action and stop after the wait. For many related requests, stop after the last wait. A wait requires a match, so use it only for requests the app must send. See [Network checks](../argent-create-e2e/references/live-authoring.md#network-checks).
86
+ - **Network requests:** record capture inside the test, after `launch:`, so both replays establish their own capture window. On Android, start just before the triggering action and stop after the wait. For many related requests, stop after the last wait. A wait requires a match, so use it only for requests the app must send. See [Network capture](../argent-create-e2e/references/live-authoring.md#network-capture).
87
87
 
88
88
  Never put acceptance evidence inside `when:`. Use `when:` only for optional setup that reconverges to the required path.
89
89
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Match profiler findings and semantic sweep results to concrete fixes. With React Compiler active, skip the first three rows for the components it compiles; keep them for components it skips (`compilationMode: "annotation"`, `"use no memo"`, a `sources` filter).
4
4
 
5
- | Finding | Fix | Detail |
6
- | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
7
- | Re-renders with same props | `React.memo(Comp)` | Only where the props really are equal between renders |
8
- | Expensive recomputation / unstable callbacks | `useMemo(fn, [deps])` / `useCallback(fn, [deps])` | `useCallback` must pair with `React.memo` on child; alone it has no effect |
9
- | Inline objects/arrays in JSX | `StyleSheet.create()` / module-level const | New reference every render breaks shallow equality |
10
- | List jank | `removeClippedSubviews`, `maxToRenderPerBatch`, `windowSize`, `getItemLayout` | Or migrate to `@shopify/flash-list` (v2 needs the New Architecture) |
11
- | JS-thread animation jank | `useNativeDriver: true` or `react-native-reanimated` | `useNativeDriver` can't animate layout props (width, height, margins, …) |
12
- | Heavy work during transitions | `requestIdleCallback()` | Runs the work when the JS thread is idle; `InteractionManager` is deprecated |
13
- | Slow startup | Defer heavy imports (lazy `require()`) | Check inline requires in the Metro config (on in bare RN, off in Expo) |
14
- | Redundant, heavy, or n+1 network calls | Inspect requests using `argent-metro-debugger`. On iOS, Android, and Mac apps, stop capture with `network-capture-stop`, then restart the app before profiling again. | Batch, debounce, or cache at the data layer |
5
+ | Finding | Fix | Detail |
6
+ | -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
7
+ | Re-renders with same props | `React.memo(Comp)` | Only where the props really are equal between renders |
8
+ | Expensive recomputation / unstable callbacks | `useMemo(fn, [deps])` / `useCallback(fn, [deps])` | `useCallback` must pair with `React.memo` on child; alone it has no effect |
9
+ | Inline objects/arrays in JSX | `StyleSheet.create()` / module-level const | New reference every render breaks shallow equality |
10
+ | List jank | `removeClippedSubviews`, `maxToRenderPerBatch`, `windowSize`, `getItemLayout` | Or migrate to `@shopify/flash-list` (v2 needs the New Architecture) |
11
+ | JS-thread animation jank | `useNativeDriver: true` or `react-native-reanimated` | `useNativeDriver` can't animate layout props (width, height, margins, …) |
12
+ | Heavy work during transitions | `requestIdleCallback()` | Runs the work when the JS thread is idle; `InteractionManager` is deprecated |
13
+ | Slow startup | Defer heavy imports (lazy `require()`) | Check inline requires in the Metro config (on in bare RN, off in Expo) |
14
+ | Redundant, heavy, or n+1 network calls | Follow [Inspect network requests](../../argent-metro-debugger/SKILL.md#inspect-network-requests). Before profiling again, stop capture with `network-capture-stop` and restart the app. | Batch, debounce, or cache at the data layer |
@@ -16,11 +16,11 @@ For implementation tasks that modify visible UI, this workflow also serves as a
16
16
  1. **Baseline screenshot**: call `screenshot` to see the current UI state. For visual regression comparison or UI change verification, capture the baseline at `scale: 1.0` with `includeImageInContext: false` and keep the returned `path` before editing whenever feasible.
17
17
  2. **Find target**: get element coordinates from a discovery tool before tapping:
18
18
  - **App screens (React Native included), in-app modals and system dialogs**: `describe`. Fall back to `screenshot` only if an overlay is not exposed reliably. When the app raises its own permission dialog, answer it here; that's the real flow under test. To take a prompt _out_ of the flow, use `argent-settings-permissions` during setup.
19
- 3. **Interact**: perform the action (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, ...); you receive a screenshot and element tree automatically (an identical earlier tree is named by its `Tree id`, not repeated).
19
+ 3. **Interact**: perform the action (`gesture-tap`, `gesture-swipe`, `keyboard`, `button`, ...); you receive a screenshot and element tree automatically (an identical or slightly changed tree references the earlier `Tree id` with a note or `-`/`+` line diff instead of repeating the full tree).
20
20
  4. **Verify**: check the returned screenshot. If it shows a loading/transitional state, block with `await-ui-element` (expected element `visible`, or a spinner `hidden`) rather than a guessed delay (its result carries the new screenshot and element tree), but only with a selector you can trust (`text`/`identifier`/`role`) that the screen is known to have or that you saw in a prior `describe`; a guessed one just times out. Otherwise use a short fixed wait. Pick evidence by what's being asserted:
21
21
  - **Visual** (layout, spacing, color, typography, image/icon rendering, clipping, overflow, text rendering): prefer `screenshot-diff` against the step 1 baseline: it surfaces pixel-visible changes the auto-screenshot might miss. Fall back to inspecting the auto-screenshot only when a stable baseline isn't available.
22
22
  - **Structural** (navigation state, element existence, accessibility labels/values, selection, hierarchy, route): verify with `describe` or `debugger-component-tree`.
23
- - **Runtime / log / network** (console errors, API calls, persistence, timing): use `debugger-log-registry`, `debugger-evaluate`, or targeted tests. If a debugger tool returns `not_connected`, follow its `guidance` and verify again. To verify a specific request, start capture before the action, call `await-network-request` after it, then stop capture. See `argent-metro-debugger` for capture setup and recovery.
23
+ - **Runtime / log / network** (console errors, API calls, persistence, timing): verify with `debugger-log-registry`, `debugger-evaluate`, or targeted tests. If the debugger reports `not_connected`, follow its `guidance` before drawing conclusions. For a specific API request, start capture before the action. Then call `await-network-request` and finish with `network-capture-stop`. See [Inspect network requests](../argent-metro-debugger/SKILL.md#inspect-network-requests) for setup.
24
24
  - **Mixed**: collect evidence for each relevant class.
25
25
  - Report the combined verdict: expected behavior, observed behavior, evidence used, and any blocker for requested visual diffing.
26
26
  5. **Repeat** for each step in the flow.