@swmansion/argent 0.34.1-next.80 → 0.34.1-next.82

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.
@@ -1762,6 +1762,7 @@ var init_failure_codes = __esm({
1762
1762
  ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE: "ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE",
1763
1763
  ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT: "ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT",
1764
1764
  NETWORK_CAPTURE_UNAVAILABLE: "NETWORK_CAPTURE_UNAVAILABLE",
1765
+ NETWORK_CAPTURE_NOT_STARTED: "NETWORK_CAPTURE_NOT_STARTED",
1765
1766
  NDJSON_CDP_REQUEST_TIMEOUT: "NDJSON_CDP_REQUEST_TIMEOUT",
1766
1767
  NDJSON_CDP_REQUEST_FAILED: "NDJSON_CDP_REQUEST_FAILED",
1767
1768
  NDJSON_CDP_CONNECTION_CLOSED: "NDJSON_CDP_CONNECTION_CLOSED",
@@ -18038,8 +18039,8 @@ function finalize(ctx, schema) {
18038
18039
  const root = ctx.seen.get(schema);
18039
18040
  if (!root)
18040
18041
  throw new Error("Unprocessed schema. This is a bug in Zod.");
18041
- const flattenRef = (zodSchema86) => {
18042
- const seen = ctx.seen.get(zodSchema86);
18042
+ const flattenRef = (zodSchema87) => {
18043
+ const seen = ctx.seen.get(zodSchema87);
18043
18044
  if (seen.ref === null)
18044
18045
  return;
18045
18046
  const schema2 = seen.def ?? seen.schema;
@@ -18057,7 +18058,7 @@ function finalize(ctx, schema) {
18057
18058
  assignProps(schema2, refSchema);
18058
18059
  }
18059
18060
  assignProps(schema2, _cached);
18060
- const isParentRef = zodSchema86._zod.parent === ref;
18061
+ const isParentRef = zodSchema87._zod.parent === ref;
18061
18062
  if (isParentRef) {
18062
18063
  for (const key2 in schema2) {
18063
18064
  if (key2 === "$ref" || key2 === "allOf")
@@ -18077,7 +18078,7 @@ function finalize(ctx, schema) {
18077
18078
  }
18078
18079
  }
18079
18080
  }
18080
- const parent = zodSchema86._zod.parent;
18081
+ const parent = zodSchema87._zod.parent;
18081
18082
  if (parent && parent !== ref) {
18082
18083
  flattenRef(parent);
18083
18084
  const parentSeen = ctx.seen.get(parent);
@@ -18095,7 +18096,7 @@ function finalize(ctx, schema) {
18095
18096
  }
18096
18097
  }
18097
18098
  ctx.override({
18098
- zodSchema: zodSchema86,
18099
+ zodSchema: zodSchema87,
18099
18100
  jsonSchema: schema2,
18100
18101
  path: seen.path ?? []
18101
18102
  });
@@ -21530,10 +21531,10 @@ function convertBaseSchema(schema, ctx) {
21530
21531
  }
21531
21532
  ctx.processing.add(refPath);
21532
21533
  const resolved = resolveRef(refPath, ctx);
21533
- const zodSchema87 = convertSchema(resolved, ctx);
21534
- ctx.refs.set(refPath, zodSchema87);
21534
+ const zodSchema88 = convertSchema(resolved, ctx);
21535
+ ctx.refs.set(refPath, zodSchema88);
21535
21536
  ctx.processing.delete(refPath);
21536
- return zodSchema87;
21537
+ return zodSchema88;
21537
21538
  }
21538
21539
  if (schema.enum !== void 0) {
21539
21540
  const enumValues = schema.enum;
@@ -21575,7 +21576,7 @@ function convertBaseSchema(schema, ctx) {
21575
21576
  if (!type) {
21576
21577
  return z.any();
21577
21578
  }
21578
- let zodSchema86;
21579
+ let zodSchema87;
21579
21580
  switch (type) {
21580
21581
  case "string": {
21581
21582
  let stringSchema = z.string();
@@ -21644,7 +21645,7 @@ function convertBaseSchema(schema, ctx) {
21644
21645
  if (schema.pattern) {
21645
21646
  stringSchema = stringSchema.regex(new RegExp(schema.pattern));
21646
21647
  }
21647
- zodSchema86 = stringSchema;
21648
+ zodSchema87 = stringSchema;
21648
21649
  break;
21649
21650
  }
21650
21651
  case "number":
@@ -21669,15 +21670,15 @@ function convertBaseSchema(schema, ctx) {
21669
21670
  if (typeof schema.multipleOf === "number") {
21670
21671
  numberSchema = numberSchema.multipleOf(schema.multipleOf);
21671
21672
  }
21672
- zodSchema86 = numberSchema;
21673
+ zodSchema87 = numberSchema;
21673
21674
  break;
21674
21675
  }
21675
21676
  case "boolean": {
21676
- zodSchema86 = z.boolean();
21677
+ zodSchema87 = z.boolean();
21677
21678
  break;
21678
21679
  }
21679
21680
  case "null": {
21680
- zodSchema86 = z.null();
21681
+ zodSchema87 = z.null();
21681
21682
  break;
21682
21683
  }
21683
21684
  case "object": {
@@ -21704,21 +21705,21 @@ function convertBaseSchema(schema, ctx) {
21704
21705
  }
21705
21706
  schemasToIntersect.push(...looseRecords);
21706
21707
  if (schemasToIntersect.length === 0) {
21707
- zodSchema86 = z.object({}).passthrough();
21708
+ zodSchema87 = z.object({}).passthrough();
21708
21709
  } else if (schemasToIntersect.length === 1) {
21709
- zodSchema86 = schemasToIntersect[0];
21710
+ zodSchema87 = schemasToIntersect[0];
21710
21711
  } else {
21711
21712
  let result = z.intersection(schemasToIntersect[0], schemasToIntersect[1]);
21712
21713
  for (let i = 2; i < schemasToIntersect.length; i++) {
21713
21714
  result = z.intersection(result, schemasToIntersect[i]);
21714
21715
  }
21715
- zodSchema86 = result;
21716
+ zodSchema87 = result;
21716
21717
  }
21717
21718
  if (schema.additionalProperties === false) {
21718
21719
  const propertyKeys = Object.keys(shape);
21719
21720
  const patterns = patternKeys.map((p) => new RegExp(p));
21720
- const basePatternSchema = zodSchema86;
21721
- zodSchema86 = zodSchema86.check((payload) => {
21721
+ const basePatternSchema = zodSchema87;
21722
+ zodSchema87 = zodSchema87.check((payload) => {
21722
21723
  if (!isPlainObject2(payload.value))
21723
21724
  return;
21724
21725
  const unrecognized = [];
@@ -21742,11 +21743,11 @@ function convertBaseSchema(schema, ctx) {
21742
21743
  } else {
21743
21744
  const objectSchema = z.object(shape);
21744
21745
  if (schema.additionalProperties === false) {
21745
- zodSchema86 = objectSchema.strict();
21746
+ zodSchema87 = objectSchema.strict();
21746
21747
  } else if (additionalSchema) {
21747
- zodSchema86 = objectSchema.catchall(additionalSchema);
21748
+ zodSchema87 = objectSchema.catchall(additionalSchema);
21748
21749
  } else {
21749
- zodSchema86 = objectSchema.passthrough();
21750
+ zodSchema87 = objectSchema.passthrough();
21750
21751
  }
21751
21752
  }
21752
21753
  const hasKeyGuard = schema.propertyNames !== void 0 && schema.propertyNames !== true;
@@ -21758,7 +21759,7 @@ function convertBaseSchema(schema, ctx) {
21758
21759
  const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === void 0 ? { type: "string", ...schema.propertyNames } : schema.propertyNames;
21759
21760
  keySchema = convertSchema(keyJSONSchema, ctx);
21760
21761
  }
21761
- zodSchema86 = checkObjectGuards(zodSchema86, { keySchema, minProperties, maxProperties });
21762
+ zodSchema87 = checkObjectGuards(zodSchema87, { keySchema, minProperties, maxProperties });
21762
21763
  }
21763
21764
  break;
21764
21765
  }
@@ -21771,12 +21772,12 @@ function convertBaseSchema(schema, ctx) {
21771
21772
  const positionalItems = applyMinItems(tupleItems, minItems);
21772
21773
  const rest = !Array.isArray(items) ? getTupleRest(items, ctx) : void 0;
21773
21774
  const tupleSchema = z.tuple(positionalItems);
21774
- zodSchema86 = rest ? tupleSchema.rest(rest) : tupleSchema;
21775
+ zodSchema87 = rest ? tupleSchema.rest(rest) : tupleSchema;
21775
21776
  if (typeof schema.minItems === "number") {
21776
- zodSchema86 = zodSchema86.check(z.minLength(schema.minItems));
21777
+ zodSchema87 = zodSchema87.check(z.minLength(schema.minItems));
21777
21778
  }
21778
21779
  if (typeof schema.maxItems === "number") {
21779
- zodSchema86 = zodSchema86.check(z.maxLength(schema.maxItems));
21780
+ zodSchema87 = zodSchema87.check(z.maxLength(schema.maxItems));
21780
21781
  }
21781
21782
  } else if (Array.isArray(items)) {
21782
21783
  const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
@@ -21784,12 +21785,12 @@ function convertBaseSchema(schema, ctx) {
21784
21785
  const positionalItems = applyMinItems(tupleItems, minItems);
21785
21786
  const rest = getTupleRest(schema.additionalItems, ctx);
21786
21787
  const tupleSchema = z.tuple(positionalItems);
21787
- zodSchema86 = rest ? tupleSchema.rest(rest) : tupleSchema;
21788
+ zodSchema87 = rest ? tupleSchema.rest(rest) : tupleSchema;
21788
21789
  if (typeof schema.minItems === "number") {
21789
- zodSchema86 = zodSchema86.check(z.minLength(schema.minItems));
21790
+ zodSchema87 = zodSchema87.check(z.minLength(schema.minItems));
21790
21791
  }
21791
21792
  if (typeof schema.maxItems === "number") {
21792
- zodSchema86 = zodSchema86.check(z.maxLength(schema.maxItems));
21793
+ zodSchema87 = zodSchema87.check(z.maxLength(schema.maxItems));
21793
21794
  }
21794
21795
  } else if (items !== void 0) {
21795
21796
  const element = convertSchema(items, ctx);
@@ -21800,12 +21801,12 @@ function convertBaseSchema(schema, ctx) {
21800
21801
  if (typeof schema.maxItems === "number") {
21801
21802
  arraySchema = arraySchema.max(schema.maxItems);
21802
21803
  }
21803
- zodSchema86 = arraySchema;
21804
+ zodSchema87 = arraySchema;
21804
21805
  } else {
21805
- zodSchema86 = z.array(z.any());
21806
+ zodSchema87 = z.array(z.any());
21806
21807
  }
21807
21808
  if (schema.uniqueItems === true || schema.contains !== void 0) {
21808
- zodSchema86 = checkArrayGuards(zodSchema86, {
21809
+ zodSchema87 = checkArrayGuards(zodSchema87, {
21809
21810
  uniqueItems: schema.uniqueItems === true,
21810
21811
  containsSchema: schema.contains !== void 0 ? convertSchema(schema.contains, ctx) : void 0,
21811
21812
  minContains: typeof schema.minContains === "number" ? schema.minContains : void 0,
@@ -21817,7 +21818,7 @@ function convertBaseSchema(schema, ctx) {
21817
21818
  default:
21818
21819
  throw new Error(`Unsupported type: ${type}`);
21819
21820
  }
21820
- return zodSchema86;
21821
+ return zodSchema87;
21821
21822
  }
21822
21823
  function convertSchema(schema, ctx) {
21823
21824
  if (typeof schema === "boolean") {
@@ -51253,8 +51254,7 @@ var init_capability = __esm({
51253
51254
  "reinstall-app": "argent does not install Mac apps, it starts the .app where it was built. Rebuild the app, then run restart-app (or boot-device with macosAppPath for a .app at another path)"
51254
51255
  };
51255
51256
  NO_CAPTURE_START_STOP_REASONS = {
51256
- vega: "a Vega app's network capture has no start or stop: view-network-logs turns it on at its first call",
51257
- chromium: "a Chromium app's network capture has no start or stop: argent turns it on at the first tool call on the app; read the requests with view-network-logs"
51257
+ vega: "a Vega app's network capture has no start or stop: view-network-logs turns it on at its first call"
51258
51258
  };
51259
51259
  CATALYST_NO_APPKIT_VIEWS = "a Mac Catalyst app's UIKit views are not in its AppKit view tree: use describe, which lists them with their identifiers and frames";
51260
51260
  MACOS_CATALYST_REFUSAL_REASONS = {
@@ -72947,7 +72947,7 @@ function isCi(env = process.env) {
72947
72947
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72948
72948
  function readCliVersion() {
72949
72949
  if (true) {
72950
- return "0.34.1-next.80";
72950
+ return "0.34.1-next.81";
72951
72951
  }
72952
72952
  return "0.0.0";
72953
72953
  }
@@ -96489,7 +96489,9 @@ function createIosNetworkRecords(state3, link, recording = () => true, layer = "
96489
96489
  }
96490
96490
  for (const record2 of open5) resize(record2);
96491
96491
  },
96492
- records: (port) => records.filter((r) => !cleared.has(r) && !isMetroTraffic(r.request.url, port)),
96492
+ records: (port, options) => records.filter(
96493
+ (r) => (options?.includeHidden === true || !cleared.has(r)) && !isMetroTraffic(r.request.url, port)
96494
+ ),
96493
96495
  record: (id) => byId.get(id),
96494
96496
  clear() {
96495
96497
  for (const record2 of records) cleared.add(record2);
@@ -101268,16 +101270,23 @@ function createNetworkManager(deps) {
101268
101270
  const { cdp } = deps;
101269
101271
  const order = [];
101270
101272
  const byId = /* @__PURE__ */ new Map();
101273
+ const seqOf = /* @__PURE__ */ new Map();
101274
+ let lastSeq = 0;
101275
+ let mark;
101271
101276
  let conditions = null;
101272
101277
  function record2(requestId) {
101273
101278
  let rec = byId.get(requestId);
101274
101279
  if (!rec) {
101275
101280
  rec = { requestId, method: "", url: "", startedDateTime: "", startTs: 0 };
101276
101281
  byId.set(requestId, rec);
101282
+ seqOf.set(requestId, ++lastSeq);
101277
101283
  order.push(requestId);
101278
101284
  if (order.length > MAX_RECORDS2) {
101279
101285
  const evicted = order.shift();
101280
- if (evicted) byId.delete(evicted);
101286
+ if (evicted) {
101287
+ byId.delete(evicted);
101288
+ seqOf.delete(evicted);
101289
+ }
101281
101290
  }
101282
101291
  }
101283
101292
  return rec;
@@ -101331,6 +101340,7 @@ function createNetworkManager(deps) {
101331
101340
  case "Network.loadingFinished": {
101332
101341
  const rec = byId.get(params.requestId);
101333
101342
  if (rec) {
101343
+ rec.finished = true;
101334
101344
  rec.encodedDataLength = params.encodedDataLength;
101335
101345
  if (rec.startTs) rec.durationMs = (params.timestamp - rec.startTs) * 1e3;
101336
101346
  }
@@ -101350,7 +101360,18 @@ function createNetworkManager(deps) {
101350
101360
  cdp.events.on("event", onEvent);
101351
101361
  return {
101352
101362
  requests: () => order.map((id) => byId.get(id)).filter((r) => !!r),
101363
+ requestsAfter: (seq) => order.flatMap((id) => {
101364
+ const at = seqOf.get(id);
101365
+ const rec = byId.get(id);
101366
+ return at !== void 0 && at > seq && rec ? [{ seq: at, record: rec }] : [];
101367
+ }),
101353
101368
  get: (requestId) => byId.get(requestId),
101369
+ startCapture: () => mark = { lastSeq },
101370
+ stopCapture: () => {
101371
+ if (mark && mark.stoppedSeq === void 0) mark = { ...mark, stoppedSeq: lastSeq };
101372
+ return mark;
101373
+ },
101374
+ captureMark: () => mark,
101354
101375
  reattach: async () => {
101355
101376
  await cdp.send("Network.enable").catch(() => {
101356
101377
  });
@@ -106367,15 +106388,15 @@ async function memberText(member, tempDirs, lookupUpload, taken) {
106367
106388
  }
106368
106389
  const file2 = await materializeMember(member, tempDirs, lookupUpload);
106369
106390
  if (file2 === void 0) return void 0;
106370
- const unreadable = (err) => {
106391
+ const unreadable2 = (err) => {
106371
106392
  throw new FileInputError(
106372
106393
  `Could not read the uploaded file "${member.path}": ${errorText(err)}`
106373
106394
  );
106374
106395
  };
106375
- const { size } = await (0, import_promises10.stat)(file2).catch(unreadable);
106396
+ const { size } = await (0, import_promises10.stat)(file2).catch(unreadable2);
106376
106397
  checkUploadSize(member, size);
106377
106398
  countMemberBytes(member, taken, size);
106378
- return (0, import_promises10.readFile)(file2, "utf8").catch(unreadable);
106399
+ return (0, import_promises10.readFile)(file2, "utf8").catch(unreadable2);
106379
106400
  }
106380
106401
  async function resolveMembers(members2, tempDirs, lookupUpload) {
106381
106402
  const out = {};
@@ -117922,6 +117943,7 @@ function createMacosAppApi(bundleId) {
117922
117943
  let disposed = false;
117923
117944
  let captureStarted = false;
117924
117945
  let captureStopped = false;
117946
+ let captureMark;
117925
117947
  let captureGap = false;
117926
117948
  let armedSinceLaunch = false;
117927
117949
  let recordedProcess = null;
@@ -118493,8 +118515,9 @@ function createMacosAppApi(bundleId) {
118493
118515
  },
118494
118516
  isConnected: () => Boolean(channel?.isOpen && channel.handshake),
118495
118517
  handshake: () => channel?.isOpen ? channel.handshake : null,
118496
- async startNetworkCapture() {
118518
+ async startNetworkCapture(metroPort2) {
118497
118519
  captureStopped = false;
118520
+ captureMark = { lastRecord: lastIosRecordNumber(), metroPort: metroPort2 };
118498
118521
  const startedNow = !captureStarted;
118499
118522
  captureStarted = true;
118500
118523
  if (channel) channel.stopUnconfirmed = false;
@@ -118563,13 +118586,15 @@ function createMacosAppApi(bundleId) {
118563
118586
  }
118564
118587
  },
118565
118588
  forgetNetworkCaptureStart() {
118566
- if (liveChannel()) return;
118589
+ if (liveChannel() || !captureStarted) return;
118567
118590
  captureStarted = false;
118568
118591
  captureGap = false;
118569
118592
  armedSinceLaunch = false;
118593
+ captureMark = void 0;
118570
118594
  },
118571
118595
  isNetworkCaptureStarted: () => captureStarted,
118572
118596
  isNetworkCaptureStopped: () => captureStopped,
118597
+ networkCaptureMark: () => captureMark,
118573
118598
  isNetworkCaptureStopUnconfirmed: () => liveChannel()?.stopUnconfirmed === true,
118574
118599
  takeCaptureGap: () => {
118575
118600
  const gap = captureGap;
@@ -119897,11 +119922,23 @@ function deriveSelector(node2) {
119897
119922
  return null;
119898
119923
  }
119899
119924
 
119900
- // ../tool-server/src/tools/await-ui-element/index.ts
119925
+ // ../tool-server/src/utils/wait-result.ts
119901
119926
  var AWAIT_UI_ELEMENT_TOOL_ID = "await-ui-element";
119902
- function isUnmetUiWaitResult(tool, result) {
119903
- return tool === AWAIT_UI_ELEMENT_TOOL_ID && typeof result === "object" && result !== null && result.success === false;
119927
+ var AWAIT_NETWORK_REQUEST_TOOL_ID = "await-network-request";
119928
+ var WAIT_TOOL_IDS = /* @__PURE__ */ new Set([
119929
+ AWAIT_UI_ELEMENT_TOOL_ID,
119930
+ AWAIT_NETWORK_REQUEST_TOOL_ID
119931
+ ]);
119932
+ function isUnmetWaitResult(tool, result) {
119933
+ return WAIT_TOOL_IDS.has(tool) && typeof result === "object" && result !== null && result.success === false;
119934
+ }
119935
+ var DARK_TAIL_TOLERANCE_INTERVALS = 2;
119936
+ var DARK_TAIL_TOLERANCE_MAX_MS = 2e3;
119937
+ function darkTailToleranceMs(pollIntervalMs) {
119938
+ return Math.min(DARK_TAIL_TOLERANCE_INTERVALS * pollIntervalMs, DARK_TAIL_TOLERANCE_MAX_MS);
119904
119939
  }
119940
+
119941
+ // ../tool-server/src/tools/await-ui-element/index.ts
119905
119942
  var WAIT_CANCELLED_NOTE = "wait was cancelled before the condition was met";
119906
119943
  var TREE_FETCH_FAILED_NOTE_PREFIX = "last tree fetch failed: ";
119907
119944
  var HIDDEN_UNREADABLE_NOTE = "could not confirm the element is hidden \u2014 the UI tree was empty or unreadable at timeout";
@@ -119930,18 +119967,12 @@ var conditionCompleted = {
119930
119967
  hidden: "UI element became hidden",
119931
119968
  text: "UI element matched expected text"
119932
119969
  };
119933
- var DARK_TAIL_TOLERANCE_INTERVALS = 2;
119934
- var DARK_TAIL_TOLERANCE_MAX_MS = 2e3;
119935
119970
  function timeoutCause(condition, lastTrustedReadAt, finalRead, pollIntervalMs) {
119936
119971
  if (lastTrustedReadAt === void 0) return "unreadable";
119937
119972
  if (finalRead === "trusted") return "unmet";
119938
119973
  if (finalRead === "untrusted" && condition === "hidden") return "unreadable";
119939
119974
  const darkTailMs = Date.now() - lastTrustedReadAt;
119940
- const tolerance = Math.min(
119941
- DARK_TAIL_TOLERANCE_INTERVALS * pollIntervalMs,
119942
- DARK_TAIL_TOLERANCE_MAX_MS
119943
- );
119944
- return darkTailMs > tolerance ? "unreadable" : "unmet";
119975
+ return darkTailMs > darkTailToleranceMs(pollIntervalMs) ? "unreadable" : "unmet";
119945
119976
  }
119946
119977
  var capability = {
119947
119978
  apple: { simulator: true, device: true },
@@ -120880,14 +120911,21 @@ function nestedOrchestratorOutcome(tool, result) {
120880
120911
  }
120881
120912
 
120882
120913
  // ../tool-server/src/utils/tool-result-verdict.ts
120883
- function unmetWaitReason(result) {
120914
+ function unmetWaitCause(tool, result) {
120915
+ if (tool === AWAIT_UI_ELEMENT_TOOL_ID) return unmetUiWaitCause(result);
120916
+ const carried = result?.cause;
120917
+ return carried === "unreadable" || carried === "cancelled" ? carried : "unmet";
120918
+ }
120919
+ function unmetWaitReason(tool, result) {
120884
120920
  const { note } = result;
120885
- const cause = unmetUiWaitCause(result);
120921
+ const cause = unmetWaitCause(tool, result);
120886
120922
  const what = cause === "unmet" ? "condition not met" : `condition not judged (${cause})`;
120887
- return `await-ui-element ${what}${note ? `: ${note}` : ""}`;
120923
+ return `${tool} ${what}${note ? `: ${note}` : ""}`;
120888
120924
  }
120889
120925
  function toolResultVerdict(tool, result) {
120890
- if (isUnmetUiWaitResult(tool, result)) return { status: "fail", reason: unmetWaitReason(result) };
120926
+ if (isUnmetWaitResult(tool, result)) {
120927
+ return { status: "fail", reason: unmetWaitReason(tool, result) };
120928
+ }
120891
120929
  const nested = nestedOrchestratorOutcome(tool, result);
120892
120930
  if (nested) return nested;
120893
120931
  if (isDebuggerNotConnectedResult(tool, result)) {
@@ -122069,6 +122107,9 @@ var RUN_TAG2 = (0, import_node_crypto14.randomBytes)(2).toString("hex");
122069
122107
  var ANDROID_NATIVE_REQUEST_ID = /^android-[0-9a-f]{4}-\d+$/;
122070
122108
  var liveInspectors = /* @__PURE__ */ new Map();
122071
122109
  var nextRecordNumber2 = 1;
122110
+ function lastAndroidRecordNumber() {
122111
+ return nextRecordNumber2 - 1;
122112
+ }
122072
122113
  function allHandles() {
122073
122114
  return [...liveInspectors.values()].flatMap((set2) => [...set2]);
122074
122115
  }
@@ -123495,8 +123536,8 @@ function createInspector(serial, packageName, initialMetroPort) {
123495
123536
  ...!conn && note && !stopped ? { note: shownNote() } : {}
123496
123537
  };
123497
123538
  },
123498
- records: (port) => records.filter(
123499
- (r) => !cleared.has(r) && !isMetroTraffic(r.request.url, port, { androidEmulatorHost: true })
123539
+ records: (port, options) => records.filter(
123540
+ (r) => (options?.includeHidden === true || !cleared.has(r)) && !isMetroTraffic(r.request.url, port, { androidEmulatorHost: true })
123500
123541
  ),
123501
123542
  record: (id) => byId.get(id)?.record,
123502
123543
  responseBody: (id) => fetchBody(id, "response"),
@@ -124616,17 +124657,19 @@ function nativeAppServices(params) {
124616
124657
  }
124617
124658
  function requireMacosAppOfBundle(services, device, toolId, bundleId) {
124618
124659
  const app = requireMacosApp(services, toolId, device);
124619
- if (bundleId !== app.bundleId) {
124620
- throw new InvalidToolInputError(
124621
- `bundleId '${bundleId}' is not the app of this device: a Mac app id names one app. Pass bundleId '${app.bundleId}', or use the device id macos-app-${bundleId}.`,
124622
- {
124623
- error_code: FAILURE_CODES.MACOS_APP_BUNDLE_ID_MISMATCH,
124624
- failure_stage: "native_devtools_macos_bundle_id"
124625
- }
124626
- );
124627
- }
124660
+ assertMacosAppBundle(app.bundleId, bundleId);
124628
124661
  return app;
124629
124662
  }
124663
+ function assertMacosAppBundle(appBundleId, bundleId) {
124664
+ if (bundleId === appBundleId) return;
124665
+ throw new InvalidToolInputError(
124666
+ `bundleId '${bundleId}' is not the app of this device: a Mac app id names one app. Pass bundleId '${appBundleId}', or use the device id macos-app-${bundleId}.`,
124667
+ {
124668
+ error_code: FAILURE_CODES.MACOS_APP_BUNDLE_ID_MISMATCH,
124669
+ failure_stage: "native_devtools_macos_bundle_id"
124670
+ }
124671
+ );
124672
+ }
124630
124673
  var VIEW_HIERARCHY_TIMEOUT_MS = 22e3;
124631
124674
  async function queryViewHierarchyFor(services, params, toolId, method, errorCode2, toResult) {
124632
124675
  const { udid, bundleId, ...rpcParams } = params;
@@ -124668,16 +124711,16 @@ async function queryViewHierarchyFor(services, params, toolId, method, errorCode
124668
124711
  // ../tool-server/src/tools/network/network-capture.ts
124669
124712
  var captureSchema = external_exports.object({
124670
124713
  udid: external_exports.string().describe(
124671
- "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>"
124714
+ "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>)."
124672
124715
  ),
124673
124716
  bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
124674
- "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>"
124717
+ "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."
124675
124718
  ),
124676
124719
  port: metroPortField.describe(
124677
- "The app's Metro port: the JS layer is reached through it, and the native layers leave its requests out. Omit it to use this device's port, 8081 by default."
124720
+ "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."
124678
124721
  ),
124679
124722
  layer: external_exports.enum(["js", "native"]).optional().describe(
124680
- "Select js for JavaScript runtime capture or native for native HTTP capture. Omit to control both layers."
124723
+ "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."
124681
124724
  ),
124682
124725
  logicalDeviceId: external_exports.string().min(1).optional().describe(
124683
124726
  "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."
@@ -124717,7 +124760,8 @@ var CAPTURE_CAPABILITY = {
124717
124760
  apple: { simulator: true },
124718
124761
  appleRemote: { simulator: true },
124719
124762
  android: { emulator: true, device: true },
124720
- macos: { app: true, catalyst: true }
124763
+ macos: { app: true, catalyst: true },
124764
+ chromium: { app: true }
124721
124765
  };
124722
124766
  var captureLocks = /* @__PURE__ */ new Map();
124723
124767
  var captureSweeps = /* @__PURE__ */ new Set();
@@ -124725,15 +124769,25 @@ function lockDevice(udid) {
124725
124769
  return deviceKeyOf(udid).toLowerCase();
124726
124770
  }
124727
124771
  var nativeUnavailable = /* @__PURE__ */ new Map();
124728
- function nativeUnavailableKey(udid, bundleId) {
124772
+ function appKey(udid, bundleId) {
124729
124773
  return `${lockDevice(udid)}:${bundleId}`;
124730
124774
  }
124731
124775
  function setNativeUnavailable(udid, bundleId, reason2) {
124732
- if (reason2 === void 0) nativeUnavailable.delete(nativeUnavailableKey(udid, bundleId));
124733
- else nativeUnavailable.set(nativeUnavailableKey(udid, bundleId), reason2);
124776
+ if (reason2 === void 0) nativeUnavailable.delete(appKey(udid, bundleId));
124777
+ else nativeUnavailable.set(appKey(udid, bundleId), reason2);
124734
124778
  }
124735
124779
  function nativeUnavailableReason(udid, bundleId) {
124736
- return nativeUnavailable.get(nativeUnavailableKey(udid, bundleId));
124780
+ return nativeUnavailable.get(appKey(udid, bundleId));
124781
+ }
124782
+ var lastStarts = /* @__PURE__ */ new Map();
124783
+ function noteCaptureStart(udid, bundleId, layers, nativeFloor) {
124784
+ lastStarts.set(appKey(udid, bundleId), {
124785
+ layers: new Set(layers.filter((entry) => !entry.unavailable).map((entry) => entry.layer)),
124786
+ nativeFloor
124787
+ });
124788
+ }
124789
+ function lastCaptureStart(udid, bundleId) {
124790
+ return lastStarts.get(appKey(udid, bundleId));
124737
124791
  }
124738
124792
  function forgetNativeUnavailableOf(devices2) {
124739
124793
  const covered = devices2 && new Set(devices2.map(lockDevice));
@@ -127521,17 +127575,10 @@ function makeNetworkLogReadScript(start2, limit, metroPort2) {
127521
127575
  var log = globalThis.__argent_network_log;
127522
127576
  if (!log) return JSON.stringify({ entries: [], total: 0, interceptorInstalled: false });
127523
127577
 
127524
- // Filter out requests to the Metro server
127578
+ ${metroFilter(metroPort2)}
127525
127579
  var filtered = [];
127526
127580
  for (var i = 0; i < log.length; i++) {
127527
- var e = log[i];
127528
- if (e.request && e.request.url) {
127529
- try {
127530
- var u = e.request.url;
127531
- if ((u.indexOf('://localhost:${metroPort2}') !== -1 || u.indexOf('://127.0.0.1:${metroPort2}') !== -1)) continue;
127532
- } catch(ex) {}
127533
- }
127534
- filtered.push(e);
127581
+ if (!isMetro(log[i])) filtered.push(log[i]);
127535
127582
  }
127536
127583
 
127537
127584
  var total = filtered.length;
@@ -127566,6 +127613,49 @@ function makeNetworkLogReadScript(start2, limit, metroPort2) {
127566
127613
  });
127567
127614
  })()`;
127568
127615
  }
127616
+ function metroFilter(metroPort2) {
127617
+ return `function isMetro(e) {
127618
+ var u = e.request && e.request.url;
127619
+ return typeof u === 'string' && (u.indexOf('://localhost:${metroPort2}') !== -1 || u.indexOf('://127.0.0.1:${metroPort2}') !== -1);
127620
+ }`;
127621
+ }
127622
+ function makeNetworkWaitReadScript(mark, metroPort2) {
127623
+ return `(function() {
127624
+ var g = globalThis;
127625
+ var xhr = typeof g.XMLHttpRequest === 'function';
127626
+ var log = g.__argent_network_log;
127627
+ if (typeof g.__argent_network_mark !== 'function' || !Array.isArray(log)) {
127628
+ return JSON.stringify({ installed: false, xhr: xhr });
127629
+ }
127630
+ ${metroFilter(metroPort2)}
127631
+ var token = typeof g.__argent_network_install === 'string' ? g.__argent_network_install : null;
127632
+ var markToken = ${JSON.stringify(mark.install)};
127633
+ var lastId = ${mark.install === null ? 0 : mark.lastId};
127634
+ var sameContext = markToken !== null && token === markToken;
127635
+ var entries = [];
127636
+ for (var i = 0; i < log.length; i++) {
127637
+ var e = log[i];
127638
+ if (sameContext && !(e.id > lastId)) continue;
127639
+ if (isMetro(e)) continue;
127640
+ entries.push({
127641
+ requestId: e.requestId,
127642
+ state: e.state,
127643
+ method: e.request ? e.request.method : undefined,
127644
+ url: e.request ? e.request.url : undefined,
127645
+ status: e.response ? e.response.status : undefined,
127646
+ durationMs: e.durationMs,
127647
+ errorText: e.errorText
127648
+ });
127649
+ }
127650
+ return JSON.stringify({
127651
+ installed: true,
127652
+ xhr: xhr,
127653
+ token: token,
127654
+ paused: g.__argent_network_paused === true,
127655
+ entries: entries
127656
+ });
127657
+ })()`;
127658
+ }
127569
127659
  function makeNetworkDetailReadScript(requestId) {
127570
127660
  return `(function() {
127571
127661
  var byId = globalThis.__argent_network_by_id;
@@ -127664,6 +127754,18 @@ function jsCapturesOn(device) {
127664
127754
  function findJsCapture(device, bundleId) {
127665
127755
  return jsCapturesOn(device).find((capture) => capture.bundleId === bundleId);
127666
127756
  }
127757
+ function findJsCaptureOfDevice(udid, bundleId) {
127758
+ let byPhysical;
127759
+ for (const [payload, capture] of jsCaptures) {
127760
+ if (capture.bundleId !== bundleId) continue;
127761
+ const { port, device } = splitPayload(payload);
127762
+ if (sameDevice(device, udid)) return { payload, port, capture };
127763
+ if (capture.physicalDeviceId !== void 0 && sameDevice(capture.physicalDeviceId, udid)) {
127764
+ byPhysical ??= { payload, port, capture };
127765
+ }
127766
+ }
127767
+ return byPhysical;
127768
+ }
127667
127769
  function jsCapturesOfAppOn(port, bundleId, exceptDevice) {
127668
127770
  return [...jsCaptures].filter(([payload, capture]) => {
127669
127771
  const { port: on, device } = splitPayload(payload);
@@ -136975,9 +137077,9 @@ async function invokeSubTool(registry2, ctx, toolId, args, extra) {
136975
137077
  }
136976
137078
  function describeNestedParamError(registry2, err, toolId, dispatchedArgs, authoredArgs) {
136977
137079
  if (getFailureSignal(err)?.error_code !== FAILURE_CODES.TOOL_INPUT_INVALID) return void 0;
136978
- const zodSchema86 = registry2.getTool(toolId)?.zodSchema;
136979
- if (!zodSchema86) return void 0;
136980
- const parsed2 = zodSchema86.safeParse(dispatchedArgs ?? {});
137080
+ const zodSchema87 = registry2.getTool(toolId)?.zodSchema;
137081
+ if (!zodSchema87) return void 0;
137082
+ const parsed2 = zodSchema87.safeParse(dispatchedArgs ?? {});
136981
137083
  if (parsed2.success) return void 0;
136982
137084
  return `Invalid params for tool "${toolId}": ${describeParamIssues(parsed2.error, authoredArgs)}`;
136983
137085
  }
@@ -137005,7 +137107,10 @@ var ALLOWED_TOOLS = /* @__PURE__ */ new Set([
137005
137107
  // it returns state only; the capture comes once, after the last step.
137006
137108
  "fold",
137007
137109
  "tv-remote",
137008
- AWAIT_UI_ELEMENT_TOOL_ID
137110
+ AWAIT_UI_ELEMENT_TOOL_ID,
137111
+ // Returns its match, never an image: after network-capture-start, an
137112
+ // action and its wait run as one sequence, and an unmet wait stops it.
137113
+ AWAIT_NETWORK_REQUEST_TOOL_ID
137009
137114
  ]);
137010
137115
  var capability25 = {
137011
137116
  // Physical iOS is a valid outer target. Unsupported steps fail at their own gate, not the whole sequence.
@@ -137041,7 +137146,7 @@ function createRunSequenceTool(registry2) {
137041
137146
  id: "run-sequence",
137042
137147
  description: `Execute several device interaction steps in one call.
137043
137148
  Use when every step is known in advance and you do not need to see the screen between steps (e.g. scrolling several times, typing then pressing enter). If a step depends on the result of an earlier one (e.g. a menu item that appears only after a tap), make separate calls instead.
137044
- Steps run in order. If a step fails (an error, a tool that is not allowed or not supported on the target, or an await-ui-element that returns success=false), the sequence stops there and later steps do NOT run. Returns { completed, total, steps } with a result or an error for each step that ran, so a stopped sequence returns partial results.
137149
+ If a step fails, the sequence stops. This includes an unsupported tool or a wait step that returns success=false. Returns { completed, total, steps } with a result or error for each step attempted.
137045
137150
  One screenshot and element tree are captured after the whole sequence, not per step: call screenshot separately only for a baseline before it or to see an intermediate step. A \`{{secret:...}}\` in any step skips that capture, so type a secret and submit it in one sequence.
137046
137151
  On a TV target (Apple TV / Android TV / Vega) use tv-remote for remote presses and keyboard for text.
137047
137152
 
@@ -137062,7 +137167,8 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
137062
137167
  fold: posture? "closed"|"half-open"|"open", or angle? 0\u2013180, exactly one (later steps land on the new panel, whose coordinates differ) [foldable ios sim/android emu]
137063
137168
  tv-remote: button (one button, or an array run as a path in one step), repeat? [apple tv/android tv/vega]
137064
137169
  buttons: up/down/left/right/select/back/home/menu/playPause; rewind/fastForward/next/previous/volumeUp/volumeDown/mute on Android TV and Vega only
137065
- await-ui-element: condition: "exists"|"visible"|"hidden"|"text", selector: { text?, identifier?, role? }, expectedText? (for "text"), textMatch?, timeoutMs?, pollIntervalMs? [all]`,
137170
+ await-ui-element: condition: "exists"|"visible"|"hidden"|"text", selector: { text?, identifier?, role? }, expectedText? (for "text"), textMatch?, timeoutMs?, pollIntervalMs? [all]
137171
+ await-network-request: bundleId, url, plus the standalone tool's optional args. Call network-capture-start before the sequence. [ios sim/android/chromium<flag:macos-apps>/macos</flag:macos-apps>]`,
137066
137172
  zodSchema: zodSchema30,
137067
137173
  alwaysLoad: true,
137068
137174
  searchHint: "batch sequence multiple gesture steps sequentially",
@@ -137107,8 +137213,8 @@ Allowed tools, their args (? = optional) and targets. Positions and distances ar
137107
137213
  const toolArgs = { ...step.args, udid };
137108
137214
  try {
137109
137215
  const result = await invokeSubTool(registry2, ctx, step.tool, toolArgs);
137110
- if (isUnmetUiWaitResult(step.tool, result)) {
137111
- results.push({ tool: step.tool, error: unmetWaitReason(result) });
137216
+ if (isUnmetWaitResult(step.tool, result)) {
137217
+ results.push({ tool: step.tool, error: unmetWaitReason(step.tool, result) });
137112
137218
  break;
137113
137219
  }
137114
137220
  results.push({ tool: step.tool, result });
@@ -139742,7 +139848,8 @@ var JS_ANSWER_WAIT_MS = 5e3;
139742
139848
  function createNetworkCaptureStartTool(registry2) {
139743
139849
  return {
139744
139850
  id: "network-capture-start",
139745
- description: `Start network capture on iOS simulators and Android<flag:macos-apps> (also on Mac apps)</flag:macos-apps>. Use when you are about to trigger requests you need to inspect, including in an e2e test. Repeating the call keeps requests already captured. Capture can slow the app.
139851
+ 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.
139852
+ On Chromium, Argent connects if needed and marks the start of the wait window. The log records while connected.
139746
139853
  The JavaScript layer needs an app connected to Metro. Start again after its JavaScript loads, including after a reload or relaunch. 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>
139747
139854
  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.
139748
139855
  When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_UNAVAILABLE or TOOL_DEPENDENCY_MISSING.`,
@@ -139770,8 +139877,18 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
139770
139877
  const device = resolveDevice(params.udid);
139771
139878
  assertSupported("network-capture-start", CAPTURE_CAPABILITY, device);
139772
139879
  const run2 = requestedLayers(params.layer);
139880
+ if (device.platform === "chromium") {
139881
+ const layer = await withCaptureLock(
139882
+ params.udid,
139883
+ params.bundleId,
139884
+ () => startChromiumLayer(registry2, device)
139885
+ );
139886
+ if (layer.unavailable) throw unavailableError(params, [layer]);
139887
+ return { status: "ok", layers: [layer] };
139888
+ }
139773
139889
  const port = metroPort({ device_id: params.udid, port: params.port });
139774
139890
  const layers = await withCaptureLock(params.udid, params.bundleId, async () => {
139891
+ const nativeFloor = device.platform === "android" ? lastAndroidRecordNumber() : lastIosRecordNumber();
139775
139892
  const app = device.platform === "macos" ? await macosAppOfCall(registry2, device, "network-capture-start", params.bundleId) : void 0;
139776
139893
  if (device.platform === "ios-remote") await ensureDeps(["sim-remote"]);
139777
139894
  if (run2.native && device.platform === "ios" && isInjectableBundleId(params.bundleId)) {
@@ -139790,9 +139907,14 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
139790
139907
  )
139791
139908
  ] : [],
139792
139909
  ...run2.native ? [
139793
- app ? startMacosLayer(app, device, params.bundleId) : device.platform === "android" ? startAndroidLayer(registry2, device, params.bundleId, port) : startIosLayer(registry2, device, params.bundleId, port, run2.js)
139910
+ app ? startMacosLayer(app, device, params.bundleId, port) : device.platform === "android" ? startAndroidLayer(registry2, device, params.bundleId, port) : startIosLayer(registry2, device, params.bundleId, port, run2.js)
139794
139911
  ] : []
139795
- ]);
139912
+ ]).then((started) => {
139913
+ if (!started.every((layer) => layer.unavailable)) {
139914
+ noteCaptureStart(params.udid, params.bundleId, started, nativeFloor);
139915
+ }
139916
+ return started;
139917
+ });
139796
139918
  });
139797
139919
  if (layers.every((layer) => layer.unavailable)) {
139798
139920
  const error63 = unavailableError(params, layers);
@@ -139806,7 +139928,7 @@ When every requested layer is unavailable, the call fails with NETWORK_CAPTURE_U
139806
139928
  }
139807
139929
  };
139808
139930
  }
139809
- async function startMacosLayer(app, device, bundleId) {
139931
+ async function startMacosLayer(app, device, bundleId, port) {
139810
139932
  const notTurnedOn = (reason3) => {
139811
139933
  app.forgetNetworkCaptureStart();
139812
139934
  setNativeUnavailable(device.id, bundleId, reason3);
@@ -139820,9 +139942,20 @@ async function startMacosLayer(app, device, bundleId) {
139820
139942
  const refusal = app.isConnected() ? void 0 : await macosLaunchRefusal(bundleId);
139821
139943
  if (refusal) return notTurnedOn(refusal);
139822
139944
  setNativeUnavailable(device.id, bundleId);
139823
- const { armed, reason: reason2 } = await app.startNetworkCapture();
139945
+ const { armed, reason: reason2 } = await app.startNetworkCapture(port);
139824
139946
  return { layer: "macos-native", armed, ...reason2 ? { reason: reason2 } : {} };
139825
139947
  }
139948
+ async function startChromiumLayer(registry2, device) {
139949
+ const ref = chromiumCdpRef(device);
139950
+ let api;
139951
+ try {
139952
+ api = await registry2.resolveService(ref.urn, ref.options);
139953
+ } catch (err) {
139954
+ return unavailable2("chromium", `argent cannot reach the app over CDP: ${errorMessage4(err)}`);
139955
+ }
139956
+ api.server.network.startCapture();
139957
+ return { layer: "chromium", armed: true };
139958
+ }
139826
139959
  function unavailableError(params, layers) {
139827
139960
  return new FailureError(
139828
139961
  `Network capture cannot start for ${params.bundleId} on ${params.udid}: ` + layers.map((layer) => `${layer.layer}: ${layer.reason}`).join("; "),
@@ -139878,6 +140011,7 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
139878
140011
  return lost ? unavailable2("js", text) : { layer: "js", armed: false, reason: text };
139879
140012
  }
139880
140013
  if (lost && recording) {
140014
+ dropJsMark(payload);
139881
140015
  return {
139882
140016
  layer: "js",
139883
140017
  armed: false,
@@ -139894,7 +140028,6 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
139894
140028
  setJsCapture(payload, {
139895
140029
  bundleId,
139896
140030
  intent: "started",
139897
- mark: { install: null },
139898
140031
  installed: installedHere,
139899
140032
  physicalDeviceId: udid,
139900
140033
  ...installedHere && found?.paused ? { paused: true } : {}
@@ -139909,6 +140042,7 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
139909
140042
  if (appId !== void 0 && appId !== bundleId) {
139910
140043
  const notOurs = `the JS runtime on Metro port ${port} is ${appId}'s, not ${bundleId}'s`;
139911
140044
  if (recording) {
140045
+ dropJsMark(payload);
139912
140046
  return {
139913
140047
  layer: "js",
139914
140048
  armed: false,
@@ -139932,7 +140066,6 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
139932
140066
  try {
139933
140067
  capture.mark = await readMark(dbg);
139934
140068
  } catch (err) {
139935
- capture.mark = { install: null };
139936
140069
  if (installedHere && found?.paused) capture.paused = true;
139937
140070
  return {
139938
140071
  layer: "js",
@@ -139964,6 +140097,10 @@ async function startJsLayer(registry2, udid, logicalDeviceId, bundleId, port) {
139964
140097
  };
139965
140098
  }
139966
140099
  }
140100
+ function dropJsMark(payload) {
140101
+ const kept = jsCapture(payload);
140102
+ if (kept) delete kept.mark;
140103
+ }
139967
140104
  async function readMark(dbg) {
139968
140105
  const answer = await dbg.cdp.evaluate(NETWORK_CAPTURE_MARK_SCRIPT, {
139969
140106
  timeout: JS_ANSWER_WAIT_MS
@@ -140070,10 +140207,10 @@ var JS_ANSWER_WAIT_MS2 = 5e3;
140070
140207
  function createNetworkCaptureStopTool(registry2) {
140071
140208
  return {
140072
140209
  id: "network-capture-stop",
140073
- description: `Stop network capture for an app on every layer and keep what was captured. Pass layer js or native to stop only that layer; the other layer keeps capturing.
140074
- Use when you have the requests you need, before you profile, or to end capture in an e2e test. Unlike stop-all-simulator-servers, the requests stay listed in native-network-logs and view-network-logs, and their ids keep working in view-network-request-details (a view-network-logs id until the app's JS runtime reloads).
140075
- Capture stays off: the read tools, launch-app and restart-app do not turn it on again; network-capture-start does. A request in flight at the stop completes in the list on iOS<flag:macos-apps> and Mac apps</flag:macos-apps> and in the JS runtime. When the stop covers the native layer on Android, the list marks such a request failed, while the app's own request goes on, and a body that view-network-request-details did not read before the stop is no longer available.
140076
- Returns { status, layers }: per layer the call stopped, armed (false once the layer confirmed the stop), total (the requests it keeps for the app, or 0 when the stop could not count them, as on a JS runtime it did not reach) and a reason when the layer was not reached or was not started.`,
140210
+ 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.
140211
+ 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.
140212
+ 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.
140213
+ 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.`,
140077
140214
  zodSchema: captureSchema,
140078
140215
  capability: CAPTURE_CAPABILITY,
140079
140216
  interaction: {
@@ -140091,6 +140228,14 @@ Returns { status, layers }: per layer the call stopped, armed (false once the la
140091
140228
  assertSupported("network-capture-stop", CAPTURE_CAPABILITY, device);
140092
140229
  const port = metroPort({ device_id: params.udid, port: params.port });
140093
140230
  const run2 = requestedLayers(params.layer);
140231
+ if (device.platform === "chromium") {
140232
+ const layer = await withCaptureLock(
140233
+ params.udid,
140234
+ params.bundleId,
140235
+ () => stopChromiumLayer(registry2, device)
140236
+ );
140237
+ return { status: "ok", layers: [layer] };
140238
+ }
140094
140239
  const layers = await withCaptureLock(params.udid, params.bundleId, async () => {
140095
140240
  const app = device.platform === "macos" ? await macosAppOfCall(registry2, device, "network-capture-stop", params.bundleId) : void 0;
140096
140241
  return runLayers([
@@ -140318,6 +140463,23 @@ async function stopMacosLayer(app, port) {
140318
140463
  ...reason2 ? { reason: reason2 } : {}
140319
140464
  };
140320
140465
  }
140466
+ async function stopChromiumLayer(registry2, device) {
140467
+ const ref = chromiumCdpRef(device);
140468
+ if (!isLiveService(registry2, ref.urn)) {
140469
+ return { layer: "chromium", armed: false, total: 0, reason: NOT_STARTED2 };
140470
+ }
140471
+ const api = await registry2.resolveService(ref.urn, ref.options);
140472
+ const network = api.server.network;
140473
+ if (!network.stopCapture()) {
140474
+ return { layer: "chromium", armed: false, total: 0, reason: NOT_STARTED2 };
140475
+ }
140476
+ return {
140477
+ layer: "chromium",
140478
+ armed: false,
140479
+ total: network.requests().length,
140480
+ reason: "view-network-logs keeps listing the tab's requests while argent is attached; await-network-request reads only the requests up to this stop"
140481
+ };
140482
+ }
140321
140483
  async function stopAndroidLayer(registry2, device, bundleId, port) {
140322
140484
  const ref = androidNetworkInspectorRef(device, bundleId, port);
140323
140485
  if (!isLiveService(registry2, ref.urn)) {
@@ -141757,14 +141919,586 @@ Fails with FILL_NO_FOCUSED_FIELD when nothing editable has focus, FILL_NOT_VERIF
141757
141919
  };
141758
141920
  }
141759
141921
 
141922
+ // ../tool-server/src/tools/await-network-request/index.ts
141923
+ init_zod();
141924
+ init_src2();
141925
+ init_device_info();
141926
+ init_capability();
141927
+
141928
+ // ../tool-server/src/tools/await-network-request/layers.ts
141929
+ var CAPTURE_ENDED = "its capture ended after the start (stop-all-simulator-servers, a stop of the device's services, or a tool-server restart); call network-capture-start again";
141930
+ async function liveService(registry2, ref) {
141931
+ return isLiveService(registry2, ref.urn) ? registry2.resolveService(ref.urn, ref.options) : void 0;
141932
+ }
141933
+ function unreadable(layer, note, stopped = false) {
141934
+ return { layer, readable: false, armed: false, stopped, records: [], note };
141935
+ }
141936
+ function recordNumber(id) {
141937
+ return Number(id.slice(id.lastIndexOf("-") + 1));
141938
+ }
141939
+ var LOST_ENDINGS = /* @__PURE__ */ new Set([
141940
+ STOPPED_BEFORE_FINISH,
141941
+ LOST_WHILE_DISCONNECTED,
141942
+ AGENT_GONE_REASON,
141943
+ NOT_RECONNECTED,
141944
+ PROCESS_ENDED,
141945
+ MACOS_CONNECTION_DROPPED
141946
+ ]);
141947
+ function fromNative(record2) {
141948
+ const lost = record2.state === "failed" && record2.errorText !== void 0 && LOST_ENDINGS.has(record2.errorText);
141949
+ return {
141950
+ id: record2.id,
141951
+ layer: record2.layer,
141952
+ method: record2.request.method,
141953
+ url: record2.request.url,
141954
+ ...record2.response ? { status: record2.response.status } : {},
141955
+ state: lost ? "lost" : record2.state,
141956
+ ...record2.timing.durationMs !== void 0 ? { durationMs: Math.round(record2.timing.durationMs) } : {},
141957
+ ...record2.errorText ? { errorText: record2.errorText } : {}
141958
+ };
141959
+ }
141960
+ function nativeAfter(records, floor) {
141961
+ return records.filter((r) => recordNumber(r.id) > floor).map(fromNative);
141962
+ }
141963
+ async function markedLayers(registry2, device, bundleId) {
141964
+ const layers = [];
141965
+ const start2 = lastCaptureStart(device.id, bundleId);
141966
+ const startWindow = {
141967
+ current: (layer, stopped) => !start2 || start2.layers.has(layer) || layer !== "js" && !stopped,
141968
+ floor: (mark) => Math.max(mark.lastRecord, start2?.nativeFloor ?? 0)
141969
+ };
141970
+ const native = device.platform === "chromium" ? await chromiumLayer(registry2, device) : device.platform === "android" ? await androidLayer(registry2, device, bundleId, startWindow) : device.platform === "macos" ? await macosLayer(registry2, device, startWindow) : await iosLayer(registry2, device, bundleId, startWindow);
141971
+ if (native) layers.push(native);
141972
+ if (device.platform !== "chromium") {
141973
+ const js = jsLayer(registry2, device, bundleId, startWindow);
141974
+ if (js) layers.push(js);
141975
+ }
141976
+ return layers;
141977
+ }
141978
+ async function iosLayer(registry2, device, bundleId, startWindow) {
141979
+ const ref = nativeDevtoolsRef(device);
141980
+ const resolve21 = () => liveService(registry2, ref);
141981
+ const found = await resolve21();
141982
+ if (!found?.networkCaptureMark(bundleId)) return void 0;
141983
+ if (!startWindow.current("ios-native", found.isNetworkCaptureStopped(bundleId))) return void 0;
141984
+ return {
141985
+ layer: "ios-native",
141986
+ async read() {
141987
+ const api = await resolve21();
141988
+ const mark = api?.networkCaptureMark(bundleId);
141989
+ if (!api || !mark) return unreadable("ios-native", CAPTURE_ENDED);
141990
+ const stopped = api.isNetworkCaptureStopped(bundleId);
141991
+ const store = api.networkRecords(bundleId);
141992
+ const state3 = store?.state();
141993
+ const armed = stopped || state3?.armed === true;
141994
+ return {
141995
+ layer: "ios-native",
141996
+ readable: true,
141997
+ armed,
141998
+ stopped,
141999
+ records: nativeAfter(
142000
+ store?.records(mark.metroPort, { includeHidden: true }) ?? [],
142001
+ startWindow.floor(mark)
142002
+ ),
142003
+ ...armed ? {} : { note: state3?.note ?? "the app has not connected yet; capture arms when it does" }
142004
+ };
142005
+ }
142006
+ };
142007
+ }
142008
+ async function androidLayer(registry2, device, bundleId, startWindow) {
142009
+ const ref = androidNetworkInspectorRef(device, bundleId, metroPort({ device_id: device.id }));
142010
+ const resolve21 = () => liveService(registry2, ref);
142011
+ const found = await resolve21();
142012
+ if (!found?.captureMark()) return void 0;
142013
+ if (!startWindow.current("android-native", found.isStopped())) return void 0;
142014
+ return {
142015
+ layer: "android-native",
142016
+ async read() {
142017
+ const api = await resolve21();
142018
+ const mark = api?.captureMark();
142019
+ if (!api || !mark) return unreadable("android-native", CAPTURE_ENDED);
142020
+ const stopped = api.isStopped();
142021
+ const state3 = api.state();
142022
+ const armed = stopped || state3.armed && state3.capture?.state !== "unavailable";
142023
+ return {
142024
+ layer: "android-native",
142025
+ readable: true,
142026
+ armed,
142027
+ stopped,
142028
+ records: nativeAfter(
142029
+ api.records(mark.metroPort, { includeHidden: true }),
142030
+ startWindow.floor(mark)
142031
+ ),
142032
+ ...armed ? {} : {
142033
+ note: state3.note ?? state3.capture?.detail ?? api.unavailableReason() ?? "the app's agent has not armed yet"
142034
+ }
142035
+ };
142036
+ }
142037
+ };
142038
+ }
142039
+ async function macosLayer(registry2, device, startWindow) {
142040
+ const ref = macosAppRef(device);
142041
+ const resolve21 = () => liveService(registry2, ref);
142042
+ const found = await resolve21();
142043
+ if (!found?.networkCaptureMark()) return void 0;
142044
+ if (!startWindow.current("macos-native", found.isNetworkCaptureStopped())) return void 0;
142045
+ return {
142046
+ layer: "macos-native",
142047
+ async read() {
142048
+ const app = await resolve21();
142049
+ const mark = app?.networkCaptureMark();
142050
+ if (!app || !mark) return unreadable("macos-native", CAPTURE_ENDED);
142051
+ const stopped = app.isNetworkCaptureStopped();
142052
+ const store = app.networkRecords();
142053
+ const state3 = store.state();
142054
+ const armed = stopped || state3.armed;
142055
+ return {
142056
+ layer: "macos-native",
142057
+ readable: true,
142058
+ armed,
142059
+ stopped,
142060
+ records: nativeAfter(
142061
+ store.records(mark.metroPort, { includeHidden: true }),
142062
+ startWindow.floor(mark)
142063
+ ),
142064
+ ...armed ? {} : { note: state3.note ?? "the app has not connected to argent yet" }
142065
+ };
142066
+ }
142067
+ };
142068
+ }
142069
+ function fromChromium(record2) {
142070
+ return {
142071
+ id: record2.requestId,
142072
+ layer: "chromium",
142073
+ method: record2.method,
142074
+ url: record2.url,
142075
+ ...record2.status !== void 0 ? { status: record2.status } : {},
142076
+ state: record2.failed ? "failed" : record2.finished ? "complete" : record2.status !== void 0 ? "headers" : "pending",
142077
+ ...record2.durationMs !== void 0 ? { durationMs: Math.round(record2.durationMs) } : {},
142078
+ ...record2.errorText ? { errorText: record2.errorText } : {}
142079
+ };
142080
+ }
142081
+ async function chromiumLayer(registry2, device) {
142082
+ const ref = chromiumCdpRef(device);
142083
+ const resolve21 = () => liveService(registry2, ref);
142084
+ if (!(await resolve21())?.server.network.captureMark()) return void 0;
142085
+ return {
142086
+ layer: "chromium",
142087
+ async read() {
142088
+ const network = (await resolve21())?.server.network;
142089
+ const mark = network?.captureMark();
142090
+ if (!network || !mark) return unreadable("chromium", CAPTURE_ENDED);
142091
+ const stopped = mark.stoppedSeq !== void 0;
142092
+ return {
142093
+ layer: "chromium",
142094
+ readable: true,
142095
+ armed: true,
142096
+ stopped,
142097
+ records: network.requestsAfter(mark.lastSeq).filter(({ seq }) => mark.stoppedSeq === void 0 || seq <= mark.stoppedSeq).map(({ record: record2 }) => fromChromium(record2))
142098
+ };
142099
+ }
142100
+ };
142101
+ }
142102
+ function fromJs(entry) {
142103
+ const state3 = entry.state === "finished" ? "complete" : entry.state === "failed" ? "failed" : entry.status !== void 0 ? "headers" : "pending";
142104
+ return {
142105
+ id: entry.requestId ?? "",
142106
+ layer: "js",
142107
+ method: entry.method ?? "",
142108
+ url: entry.url ?? "",
142109
+ ...typeof entry.status === "number" ? { status: entry.status } : {},
142110
+ state: state3,
142111
+ ...typeof entry.durationMs === "number" ? { durationMs: Math.round(entry.durationMs) } : {},
142112
+ ...entry.errorText ? { errorText: entry.errorText } : {}
142113
+ };
142114
+ }
142115
+ function jsLayer(registry2, device, bundleId, startWindow) {
142116
+ const found = findJsCaptureOfDevice(device.id, bundleId);
142117
+ if (!found?.capture.mark) return void 0;
142118
+ if (!startWindow.current("js", found.capture.intent === "stopped")) return void 0;
142119
+ return {
142120
+ layer: "js",
142121
+ async read(budgetMs) {
142122
+ const found2 = findJsCaptureOfDevice(device.id, bundleId);
142123
+ const mark = found2?.capture.mark;
142124
+ if (!found2 || !mark) return unreadable("js", CAPTURE_ENDED);
142125
+ const { payload, port, capture } = found2;
142126
+ let stopped = capture.intent === "stopped";
142127
+ if (!isLiveService(registry2, `${JS_RUNTIME_DEBUGGER_NAMESPACE}:${payload}`)) {
142128
+ return unreadable(
142129
+ "js",
142130
+ stopped ? "the app's JS runtime is not connected, and a stopped capture does not reconnect to it" : "argent's connection to the app's JS runtime ended (a relaunch, a Metro restart or a stop of the device's services); call network-capture-start again",
142131
+ stopped
142132
+ );
142133
+ }
142134
+ const physical = capture.physicalDeviceId ?? device.id;
142135
+ const target = payload.slice(payload.indexOf(":") + 1);
142136
+ try {
142137
+ const dbg = await resolveJsRuntime(
142138
+ registry2,
142139
+ physical,
142140
+ target !== physical ? target : void 0,
142141
+ port
142142
+ );
142143
+ const appId = dbg.runtimeApp?.appId;
142144
+ if (appId !== void 0 && appId !== bundleId) {
142145
+ return unreadable(
142146
+ "js",
142147
+ `the JS runtime on Metro port ${port} is ${appId}'s, not ${bundleId}'s`,
142148
+ stopped
142149
+ );
142150
+ }
142151
+ const answer = JSON.parse(
142152
+ String(
142153
+ await dbg.cdp.evaluate(makeNetworkWaitReadScript(mark, port), {
142154
+ timeout: Math.max(1, budgetMs)
142155
+ })
142156
+ )
142157
+ );
142158
+ const pauseMissed = stopped && answer.installed && answer.paused === false;
142159
+ if (pauseMissed) stopped = false;
142160
+ if (!answer.installed) {
142161
+ if (stopped) {
142162
+ return {
142163
+ layer: "js",
142164
+ readable: true,
142165
+ armed: true,
142166
+ stopped,
142167
+ records: [],
142168
+ note: "the app's JS runtime reloaded since the stop, which cleared its requests"
142169
+ };
142170
+ }
142171
+ return unreadable(
142172
+ "js",
142173
+ answer.xhr === true ? "the app's JS runtime has no interceptor, as after a reload; call network-capture-start again" : "the app's JavaScript has not loaded yet; call network-capture-start once it has"
142174
+ );
142175
+ }
142176
+ const records = (answer.entries ?? []).map(fromJs);
142177
+ if (!stopped && answer.paused === true) {
142178
+ return {
142179
+ layer: "js",
142180
+ readable: true,
142181
+ armed: false,
142182
+ stopped,
142183
+ records,
142184
+ note: "a stop's pause is still in the app's JS runtime, so it records nothing; call network-capture-start again"
142185
+ };
142186
+ }
142187
+ const note = mark.install !== null && answer.token !== mark.install ? "the app's JS runtime reloaded after the start, so its requests between the reload and the interceptor's reinstall are missing" : pauseMissed ? "the stop's pause did not reach the app's JS runtime, which still records: requests after the stop count" : void 0;
142188
+ return {
142189
+ layer: "js",
142190
+ readable: true,
142191
+ armed: true,
142192
+ stopped,
142193
+ records,
142194
+ ...note ? { note } : {}
142195
+ };
142196
+ } catch (err) {
142197
+ const reason2 = classifyNotConnected(err);
142198
+ return unreadable(
142199
+ "js",
142200
+ reason2 !== void 0 ? jsNotReached(reason2, port, err) : `the app's JS runtime did not answer: ${errorMessage4(err)}`,
142201
+ stopped
142202
+ );
142203
+ }
142204
+ }
142205
+ };
142206
+ }
142207
+
142208
+ // ../tool-server/src/tools/await-network-request/match.ts
142209
+ var STATUS_CLASSES = ["1xx", "2xx", "3xx", "4xx", "5xx"];
142210
+ function urlMatches(criteria, url2) {
142211
+ switch (criteria.urlMatch) {
142212
+ case "equals":
142213
+ return url2.toLowerCase() === criteria.url.toLowerCase();
142214
+ case "matches":
142215
+ return (criteria.regex ??= new RegExp(criteria.url)).test(url2);
142216
+ default:
142217
+ return url2.toLowerCase().includes(criteria.url.toLowerCase());
142218
+ }
142219
+ }
142220
+ function statusMatches(wanted, status) {
142221
+ if (status === void 0) return false;
142222
+ if (typeof wanted === "number") return status === wanted;
142223
+ return Math.floor(status / 100) === Number(wanted[0]);
142224
+ }
142225
+ function outcomeMatches(outcome, state3) {
142226
+ if (outcome === "complete") return state3 === "complete";
142227
+ if (outcome === "failed") return state3 === "failed";
142228
+ return state3 === "complete" || state3 === "failed";
142229
+ }
142230
+ function mismatches(criteria, record2) {
142231
+ const failed3 = [];
142232
+ if (!urlMatches(criteria, record2.url)) failed3.push("url");
142233
+ if (criteria.method !== void 0 && record2.method.toLowerCase() !== criteria.method.toLowerCase()) {
142234
+ failed3.push("method");
142235
+ }
142236
+ if (criteria.status !== void 0 && !statusMatches(criteria.status, record2.status)) {
142237
+ failed3.push("status");
142238
+ }
142239
+ if (!outcomeMatches(criteria.outcome, record2.state)) failed3.push("outcome");
142240
+ return failed3;
142241
+ }
142242
+ function firstMatch(criteria, records) {
142243
+ return records.find((record2) => mismatches(criteria, record2).length === 0);
142244
+ }
142245
+ var NOTE_URL_CHARS = 120;
142246
+ function shortUrl(url2) {
142247
+ return url2.length > NOTE_URL_CHARS ? `${url2.slice(0, NOTE_URL_CHARS)}...` : url2;
142248
+ }
142249
+ function describeCriteria(criteria) {
142250
+ const url2 = criteria.urlMatch === "matches" ? `URL matching the regular expression "${shortUrl(criteria.url)}"` : `URL ${criteria.urlMatch === "equals" ? "equal to" : "containing"} "${shortUrl(criteria.url)}"`;
142251
+ return [
142252
+ criteria.method ? criteria.method.toUpperCase() : void 0,
142253
+ url2,
142254
+ criteria.status !== void 0 ? `status ${criteria.status}` : void 0,
142255
+ criteria.outcome === "any" ? "complete or failed" : criteria.outcome
142256
+ ].filter(Boolean).join(", ");
142257
+ }
142258
+
142259
+ // ../tool-server/src/tools/await-network-request/index.ts
142260
+ var DEFAULT_TIMEOUT_MS4 = 1e4;
142261
+ var DEFAULT_POLL_INTERVAL_MS2 = 400;
142262
+ var MIN_JS_READ_MS = 1e3;
142263
+ var zodSchema44 = external_exports.object({
142264
+ udid: external_exports.string().min(1).describe(
142265
+ "Device ID passed as udid to network-capture-start, even if that call also used logicalDeviceId."
142266
+ ),
142267
+ bundleId: external_exports.string().regex(BUNDLE_ID_PATTERN, BUNDLE_ID_MESSAGE).describe(
142268
+ "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."
142269
+ ),
142270
+ url: external_exports.string().min(1).describe(
142271
+ 'URL text or pattern, such as "/v1/auth/login". Do not include secrets. The result includes the matched URL, and {{secret:...}} placeholders are rejected.'
142272
+ ),
142273
+ urlMatch: external_exports.enum(["contains", "equals", "matches"]).optional().describe(
142274
+ "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."
142275
+ ),
142276
+ method: external_exports.string().min(1).optional().describe("HTTP method such as POST. Ignores case."),
142277
+ status: external_exports.union([
142278
+ external_exports.enum(STATUS_CLASSES),
142279
+ external_exports.coerce.number().int().min(100).max(599)
142280
+ ]).optional().describe(
142281
+ 'Exact HTTP status such as 200 or a class such as "2xx". A failed request matches a status only if it received response headers.'
142282
+ ),
142283
+ outcome: external_exports.enum(["complete", "failed", "any"]).optional().describe(
142284
+ "complete (default) means the response finished, regardless of HTTP status. failed matches a request error such as an abort. any accepts either."
142285
+ ),
142286
+ timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(`Wait limit in milliseconds. Default ${DEFAULT_TIMEOUT_MS4}.`),
142287
+ pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(
142288
+ `Interval between capture reads in milliseconds. Default ${DEFAULT_POLL_INTERVAL_MS2}.`
142289
+ )
142290
+ }).strict().superRefine((params, ctx) => {
142291
+ if (params.url.includes(SECRET_PLACEHOLDER_MARKER)) {
142292
+ ctx.addIssue({
142293
+ code: external_exports.ZodIssueCode.custom,
142294
+ path: ["url"],
142295
+ message: "url takes no {{secret:...}} placeholder: a matcher never resolves secrets, and the match is returned in the result. Match on another part of the URL."
142296
+ });
142297
+ }
142298
+ if (params.urlMatch === "matches") {
142299
+ try {
142300
+ new RegExp(params.url);
142301
+ } catch (err) {
142302
+ ctx.addIssue({
142303
+ code: external_exports.ZodIssueCode.custom,
142304
+ path: ["url"],
142305
+ message: `url is not a valid regular expression: ${err instanceof Error ? err.message : String(err)}`
142306
+ });
142307
+ }
142308
+ }
142309
+ });
142310
+ var CANCELLED_NOTE = "the wait was cancelled before a request matched";
142311
+ function criteriaOf(params) {
142312
+ return {
142313
+ url: params.url,
142314
+ urlMatch: params.urlMatch ?? "contains",
142315
+ ...params.method !== void 0 ? { method: params.method } : {},
142316
+ ...params.status !== void 0 ? { status: params.status } : {},
142317
+ outcome: params.outcome ?? "complete"
142318
+ };
142319
+ }
142320
+ function notStartedError(params) {
142321
+ return new FailureError(
142322
+ `Network capture is not started for ${params.bundleId} on ${params.udid}, so no request can be waited for. Call network-capture-start for ${params.bundleId}, repeat the action that sends the request, then call await-network-request. stop-all-simulator-servers, a stop of the device's services and a tool-server restart also end a capture.`,
142323
+ {
142324
+ error_code: FAILURE_CODES.NETWORK_CAPTURE_NOT_STARTED,
142325
+ failure_stage: "await_network_request_marks",
142326
+ failure_area: "tool_server",
142327
+ error_kind: "not_found"
142328
+ }
142329
+ );
142330
+ }
142331
+ function isOpen2(record2) {
142332
+ return record2.state === "pending" || record2.state === "headers";
142333
+ }
142334
+ function createAwaitNetworkRequestTool(registry2) {
142335
+ return {
142336
+ // A literal, so scripts/extract-tools.mjs finds the description it scores.
142337
+ id: "await-network-request",
142338
+ 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.
142339
+ Returns the matching request. Pass match.id as requestId to view-network-request-details for headers and bodies. Requests whose outcome capture missed cannot match. When success is false, check cause. For unmet, check the action and criteria. For unreadable, use the layer notes to restore capture. For cancelled, retry if needed. A false result fails an e2e step and stops a run-sequence.
142340
+ If capture has no start for the target, the tool raises NETWORK_CAPTURE_NOT_STARTED. Start capture and repeat the action. After a JavaScript reload, start capture again once the runtime is ready.`,
142341
+ zodSchema: zodSchema44,
142342
+ searchHint: "wait await network request http api call fetch xhr response status url match after capture start e2e assert",
142343
+ readOnly: true,
142344
+ longRunning: true,
142345
+ capability: CAPTURE_CAPABILITY,
142346
+ interaction: {
142347
+ startedMsg: ({ params }) => `Waiting for a request to ${params.url}`,
142348
+ completedMsg: ({ params, result }) => result.success && result.match ? `Request matched: ${result.match.method} ${result.match.url}${result.match.status !== void 0 ? ` ${result.match.status}` : ""}` : `No request to ${params.url} matched (${result.cause ?? "unmet"})`,
142349
+ failedMsg: ({ failureSignal: failureSignal2 }) => `Failed while waiting for a network request: ${failureSignal2.error_code}`
142350
+ },
142351
+ // Each layer looks its service up itself, so the wait creates no native service.
142352
+ services: () => ({}),
142353
+ async execute(_services, params, ctx) {
142354
+ const signal = ctx?.signal;
142355
+ const device = resolveDevice(params.udid);
142356
+ assertSupported(AWAIT_NETWORK_REQUEST_TOOL_ID, CAPTURE_CAPABILITY, device);
142357
+ if (device.platform === "macos") {
142358
+ assertMacosAppBundle(parseMacosAppBundleId(device.id) ?? device.id, params.bundleId);
142359
+ }
142360
+ const layers = await markedLayers(registry2, device, params.bundleId);
142361
+ if (layers.length === 0) throw notStartedError(params);
142362
+ const criteria = criteriaOf(params);
142363
+ const timeoutMs = params.timeoutMs ?? DEFAULT_TIMEOUT_MS4;
142364
+ const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
142365
+ const start2 = Date.now();
142366
+ const deadline = start2 + timeoutMs;
142367
+ const elapsed = () => Date.now() - start2;
142368
+ const native = layers.filter((layer) => layer.layer !== "js");
142369
+ const js = layers.find((layer) => layer.layer === "js");
142370
+ const latest = /* @__PURE__ */ new Map();
142371
+ const latestReadable = /* @__PURE__ */ new Map();
142372
+ let lastArmedNativeAt;
142373
+ let lastArmedJsAt;
142374
+ const jsBound = Math.max(pollIntervalMs, MIN_JS_READ_MS);
142375
+ const notesSeen = /* @__PURE__ */ new Map();
142376
+ const keep = (read) => {
142377
+ latest.set(read.layer, read);
142378
+ if (read.note) {
142379
+ const seen = notesSeen.get(read.layer) ?? /* @__PURE__ */ new Set();
142380
+ notesSeen.set(read.layer, seen.add(read.note));
142381
+ }
142382
+ if (!read.readable) return;
142383
+ latestReadable.set(read.layer, read);
142384
+ if (!read.armed) return;
142385
+ if (read.layer === "js") lastArmedJsAt = read.at;
142386
+ else lastArmedNativeAt = Math.max(lastArmedNativeAt ?? 0, read.at);
142387
+ };
142388
+ let jsRead;
142389
+ const readJs = (layer, budgetMs) => {
142390
+ if (jsRead) return jsRead;
142391
+ const read = layer.read(budgetMs).then((answer) => ({ ...answer, at: Date.now() })).finally(() => {
142392
+ if (jsRead === read) jsRead = void 0;
142393
+ });
142394
+ jsRead = read;
142395
+ return read;
142396
+ };
142397
+ const success2 = (match) => {
142398
+ const notes = [...notesSeen].flatMap(
142399
+ ([layer, seen]) => [...seen].map((note) => `${layer}: ${note}`)
142400
+ );
142401
+ return {
142402
+ success: true,
142403
+ elapsed: elapsed(),
142404
+ match,
142405
+ ...notes.length > 0 ? { note: notes.join("; ") } : {}
142406
+ };
142407
+ };
142408
+ for (; ; ) {
142409
+ const atDeadline = Date.now() >= deadline;
142410
+ if (signal?.aborted) {
142411
+ return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
142412
+ }
142413
+ const reads = [];
142414
+ for (const layer of native) {
142415
+ const read = { ...await layer.read(0), at: Date.now() };
142416
+ keep(read);
142417
+ reads.push(read);
142418
+ const match = firstMatch(criteria, read.records);
142419
+ if (match) return success2(match);
142420
+ }
142421
+ const remaining = deadline - Date.now();
142422
+ if (js && (remaining > 0 || !latest.has("js"))) {
142423
+ const bound = Math.min(jsBound, Math.max(1, remaining));
142424
+ const settled = await settleWithin(readJs(js, bound), bound, signal);
142425
+ if (settled.type === "aborted") {
142426
+ return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
142427
+ }
142428
+ if (settled.type === "value") {
142429
+ keep(settled.value);
142430
+ reads.push(settled.value);
142431
+ const match = firstMatch(criteria, settled.value.records);
142432
+ if (match) return success2(match);
142433
+ } else if (settled.type === "timeout" && bound < jsBound && latest.has("js")) {
142434
+ } else {
142435
+ const note = settled.type === "timeout" ? `the app's JS runtime did not answer within ${bound} ms` : `the read of the app's JS runtime failed: ${settled.error}`;
142436
+ const read = {
142437
+ layer: "js",
142438
+ readable: false,
142439
+ armed: false,
142440
+ stopped: latest.get("js")?.stopped ?? false,
142441
+ records: [],
142442
+ note,
142443
+ at: Date.now()
142444
+ };
142445
+ keep(read);
142446
+ reads.push(read);
142447
+ }
142448
+ }
142449
+ if (reads.length === layers.length && reads.every((read) => read.readable && read.stopped && !read.records.some(isOpen2))) {
142450
+ return timedOut3("unmet", true);
142451
+ }
142452
+ if (atDeadline) break;
142453
+ if (Date.now() >= deadline) continue;
142454
+ const sleepMs = Math.min(pollIntervalMs, Math.max(0, deadline - Date.now()));
142455
+ if (!await sleepOrAbort(sleepMs, signal)) {
142456
+ return { success: false, elapsed: elapsed(), note: CANCELLED_NOTE, cause: "cancelled" };
142457
+ }
142458
+ }
142459
+ const now = Date.now();
142460
+ const tolerance = darkTailToleranceMs(pollIntervalMs);
142461
+ const fresh = lastArmedNativeAt !== void 0 && now - lastArmedNativeAt <= tolerance || lastArmedJsAt !== void 0 && now - lastArmedJsAt <= Math.max(tolerance, jsBound + pollIntervalMs);
142462
+ return timedOut3(fresh ? "unmet" : "unreadable", false);
142463
+ function timedOut3(cause, allStopped) {
142464
+ const summaries = layers.map(({ layer }) => {
142465
+ const last = latest.get(layer);
142466
+ const readable = latestReadable.get(layer);
142467
+ return {
142468
+ layer,
142469
+ armed: last?.readable === true ? last.armed : false,
142470
+ readable: readable !== void 0,
142471
+ ...last?.stopped ? { stopped: true } : {},
142472
+ requests: readable?.records.length ?? 0,
142473
+ ...last?.note ? { note: last.note } : {}
142474
+ };
142475
+ });
142476
+ const counts = summaries.map(
142477
+ (s) => `${s.layer} ${s.readable ? s.requests : "not read"}${s.armed ? "" : " (not armed)"}`
142478
+ ).join(", ");
142479
+ const head = allStopped ? `No request matched (wanted: ${describeCriteria(criteria)}): capture is stopped on every marked layer, so only the requests captured between network-capture-start and network-capture-stop were searched.` : `No request since network-capture-start matched within this ${timeoutMs} ms wait (wanted: ${describeCriteria(criteria)}).`;
142480
+ const notes = summaries.filter((s) => s.note).map((s) => `${s.layer}: ${s.note}`).join("; ");
142481
+ const note = [head, `Requests since the start: ${counts}.`, notes ? `${notes}.` : void 0].filter(Boolean).join(" ");
142482
+ return {
142483
+ success: false,
142484
+ elapsed: elapsed(),
142485
+ cause,
142486
+ note,
142487
+ layers: summaries
142488
+ };
142489
+ }
142490
+ }
142491
+ };
142492
+ }
142493
+
141760
142494
  // ../tool-server/src/tools/await-screen-idle/index.ts
141761
142495
  init_zod();
141762
142496
  init_device_info();
141763
142497
  init_adb();
141764
142498
  init_capability();
141765
142499
  var AWAIT_SCREEN_IDLE_TOOL_ID = "await-screen-idle";
141766
- var DEFAULT_TIMEOUT_MS4 = 3e3;
141767
- var DEFAULT_POLL_INTERVAL_MS2 = 200;
142500
+ var DEFAULT_TIMEOUT_MS5 = 3e3;
142501
+ var DEFAULT_POLL_INTERVAL_MS3 = 200;
141768
142502
  var DEFAULT_MIN_STABLE_MS = 250;
141769
142503
  var TV_NO_CURSOR_STABLE_MS = 1200;
141770
142504
  var DARK_TAIL_POLLS = 2;
@@ -141806,14 +142540,14 @@ function unsettledNote(lastData, lastError, darkTailMs) {
141806
142540
  if (lastData.hint) parts2.push(lastData.hint);
141807
142541
  return parts2.join("; ");
141808
142542
  }
141809
- var zodSchema44 = external_exports.object({
142543
+ var zodSchema45 = external_exports.object({
141810
142544
  udid: external_exports.string().min(1).describe(
141811
142545
  "Target device id from `list-devices` (iOS UDID, Android serial, Vega serial, <flag:harmonyos>HarmonyOS id, </flag:harmonyos><flag:macos-apps>Mac app id, </flag:macos-apps>or Chromium id)."
141812
142546
  ),
141813
142547
  timeoutMs: external_exports.number().int().positive().max(12e4).optional().describe(
141814
- `Max time to wait for the screen to settle before giving up (default ${DEFAULT_TIMEOUT_MS4}).`
142548
+ `Max time to wait for the screen to settle before giving up (default ${DEFAULT_TIMEOUT_MS5}).`
141815
142549
  ),
141816
- pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`How often to re-read the tree (default ${DEFAULT_POLL_INTERVAL_MS2}).`),
142550
+ pollIntervalMs: external_exports.number().int().min(50).max(5e3).optional().describe(`How often to re-read the tree (default ${DEFAULT_POLL_INTERVAL_MS3}).`),
141817
142551
  minStableMs: external_exports.number().int().min(0).max(1e4).optional().describe(
141818
142552
  `The screen must hold the same content for at least this long to count as settled (default ${DEFAULT_MIN_STABLE_MS}); 0 settles on the first non-empty read.`
141819
142553
  )
@@ -141846,7 +142580,7 @@ function createAwaitScreenIdleTool(registry2) {
141846
142580
  description: `Block until the screen has rendered content and held it for minStableMs, or the timeout elapses. It polls the same element tree as \`describe\`.
141847
142581
  Use when a launch or navigation must finish rendering before a screenshot or tap.
141848
142582
  Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutMs, it returns settled=false instead of failing.<flag:harmonyos> A note on settled=true means the screen it settled on is not live: a suspended HarmonyOS panel settles instantly on its last frame, and taps land nowhere until it is woken.</flag:harmonyos>`,
141849
- zodSchema: zodSchema44,
142583
+ zodSchema: zodSchema45,
141850
142584
  searchHint: "wait until screen settles idle stable stops changing animation transition rendered ready before screenshot",
141851
142585
  readOnly: true,
141852
142586
  interaction: {
@@ -141875,13 +142609,13 @@ Returns { settled, waitedMs, polls, note? }. If that is not seen before timeoutM
141875
142609
  const tvApi = isTvOs ? await resolveTvApi(registry2, device.id) : null;
141876
142610
  const androidIsTv = device.platform === "android" && await isAndroidTv(device.id);
141877
142611
  const minStableMs = params.minStableMs ?? DEFAULT_MIN_STABLE_MS;
141878
- const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS2;
142612
+ const pollIntervalMs = params.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS3;
141879
142613
  let stableSignature;
141880
142614
  let stableSince = 0;
141881
142615
  let lastReadAt = 0;
141882
142616
  const poll = await pollDescribeTree({
141883
142617
  fetchTree: (budgetMs) => fetchTree(device, services, tvApi, androidIsTv, budgetMs),
141884
- timeoutMs: params.timeoutMs ?? DEFAULT_TIMEOUT_MS4,
142618
+ timeoutMs: params.timeoutMs ?? DEFAULT_TIMEOUT_MS5,
141885
142619
  pollIntervalMs,
141886
142620
  signal: ctx?.signal,
141887
142621
  onSample: (data, nowMs) => {
@@ -142086,7 +142820,7 @@ function safeGetState(registry2, urn) {
142086
142820
  return null;
142087
142821
  }
142088
142822
  }
142089
- var zodSchema45 = external_exports.object({
142823
+ var zodSchema46 = external_exports.object({
142090
142824
  port: metroPortField,
142091
142825
  device_id: external_exports.string().describe(
142092
142826
  "Device ID from list-devices<flag:macos-apps>, including a Mac app ID</flag:macos-apps>. For iOS or Android on a shared Metro, use the target's logicalDeviceId if asked to disambiguate."
@@ -142104,7 +142838,7 @@ On an iOS simulator, Android device<flag:macos-apps>, or Mac app</flag:macos-app
142104
142838
  After starting, ask the user to perform the interaction to profile, then call react-profiler-stop.
142105
142839
  Returns { started_at, startedAtEpochMs, hermes_version, detected_architecture }. On iOS and Android, a warning names the apps with native network capture on (started by network-capture-start): their timings in the profile can differ. If a session is already running, returns { already_running: true, mine, owner, \u2026 } instead, without clobbering its data, unless it is another tool-server's stale run, has no owner record, or is a lost run of this tool-server: start replaces those. mine: true means this tool-server started the run: if it is yours, call react-profiler-stop. With stale: true it may be another agent's: follow the note. Otherwise, BEFORE OVERTAKING with { force: true }, ask the user for approval first, as how_to_reclaim explains. A start that replaces a run reports it in took_over.
142106
142840
  Fails if the Hermes runtime is not reachable or the Metro CDP connection cannot be established.`,
142107
- zodSchema: zodSchema45,
142841
+ zodSchema: zodSchema46,
142108
142842
  interaction: {
142109
142843
  startedMsg: () => "Starting React profiler",
142110
142844
  completedMsg: ({ result }) => result.already_running ? "React profiler was already running" : "Started React profiler",
@@ -143171,7 +143905,7 @@ function stopInProgressError() {
143171
143905
  error_kind: "not_found"
143172
143906
  });
143173
143907
  }
143174
- var zodSchema46 = external_exports.object({
143908
+ var zodSchema47 = external_exports.object({
143175
143909
  port: metroPortField,
143176
143910
  device_id: external_exports.string().describe(
143177
143911
  "Device ID passed to react-profiler-start<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>."
@@ -143186,7 +143920,7 @@ Call react-profiler-start first, then exercise the app, then call this.
143186
143920
  Returns { duration_ms, sample_count, fiber_renders_captured, total_react_commits, hot_commit_indices, react_render_ms, react_render_share_pct, react_render_peak_1s_pct }.
143187
143921
  If some fibers' display names could not be resolved (typically modals, tooltips or animations that unmounted before stop), it also returns { unattributed_ms, unattributed_fiber_count, unattributed_commit_count }: the work missing from the per-component breakdown. Per-commit durations stay correct.
143188
143922
  Fails if no active profiling session exists, another stop is running, the CDP connection was lost during recording, or another session took the run over.`,
143189
- zodSchema: zodSchema46,
143923
+ zodSchema: zodSchema47,
143190
143924
  // Collection can outlast the MCP client's 30 s abort. The client would then
143191
143925
  // resend the call, and the resend fails on the stop still collecting.
143192
143926
  longRunning: true,
@@ -143481,7 +144215,7 @@ Fails if no active profiling session exists, another stop is running, the CDP co
143481
144215
 
143482
144216
  // ../tool-server/src/tools/profiler/react/react-profiler-status.ts
143483
144217
  init_zod();
143484
- var zodSchema47 = external_exports.object({
144218
+ var zodSchema48 = external_exports.object({
143485
144219
  port: metroPortField,
143486
144220
  device_id: external_exports.string().describe(
143487
144221
  "Device ID of the app to inspect<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>. During a recording, use the ID passed to react-profiler-start."
@@ -143499,7 +144233,7 @@ function createReactProfilerStatusTool(registry2) {
143499
144233
  return {
143500
144234
  id: "react-profiler-status",
143501
144235
  description: `Check whether a React recording is running, saved, lost, or taken over. Use after an interruption to decide whether to collect the recording or start again. If the runtime is unavailable, session_status is no_react_runtime and note gives the reason.`,
143502
- zodSchema: zodSchema47,
144236
+ zodSchema: zodSchema48,
143503
144237
  readOnly: true,
143504
144238
  interaction: {
143505
144239
  startedMsg: () => "Checking React profiler",
@@ -145178,7 +145912,7 @@ var annotationSchema = external_exports.object({
145178
145912
  ),
145179
145913
  label: external_exports.string().describe("Description of the action performed")
145180
145914
  });
145181
- var zodSchema48 = external_exports.object({
145915
+ var zodSchema49 = external_exports.object({
145182
145916
  port: metroPortField,
145183
145917
  device_id: external_exports.string().describe(
145184
145918
  "Device ID used to record or load the React profile<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>."
@@ -145201,7 +145935,7 @@ After presenting the report, ask the user whether to investigate further (drill-
145201
145935
  profiler-cpu-query / profiler-commit-query) or implement fixes and re-profile for comparison.
145202
145936
  Use when the profiling session is complete and you need to interpret the collected data.
145203
145937
  Fails if react-profiler-stop has not been called or no profiling data is stored.`,
145204
- zodSchema: zodSchema48,
145938
+ zodSchema: zodSchema49,
145205
145939
  interaction: {
145206
145940
  startedMsg: () => "Analyzing React profile",
145207
145941
  completedMsg: () => "Analyzed React profile",
@@ -145386,7 +146120,7 @@ var import_fs6 = require("fs");
145386
146120
  var fileInputs = [
145387
146121
  { target: "project_root", path: "${project_root}", kind: "directory" }
145388
146122
  ];
145389
- var zodSchema49 = external_exports.object({
146123
+ var zodSchema50 = external_exports.object({
145390
146124
  component_name: external_exports.string().describe("Name of the React component to look up"),
145391
146125
  project_root: external_exports.string().describe("Absolute path to the RN project root")
145392
146126
  });
@@ -145396,7 +146130,7 @@ var reactProfilerComponentSourceTool = {
145396
146130
  Call this per-finding after react-profiler-analyze to inspect source before proposing a fix.
145397
146131
  Returns found: false if the component is not found in user-owned code (e.g. lives in node_modules).
145398
146132
  When several files define a component with the same name (e.g. platform variants like List.tsx and List.web.tsx), returns the primary match and lists the rest under otherMatches[] (file/line/col). Check it before assuming the returned file is the one you meant.`,
145399
- zodSchema: zodSchema49,
146133
+ zodSchema: zodSchema50,
145400
146134
  readOnly: true,
145401
146135
  // react-profiler-analyze runs the same AST lookup for each component in its
145402
146136
  // table (file, line and other matches) and adds the source of the located ones
@@ -145523,7 +146257,7 @@ function renderMarkdownTable(entries) {
145523
146257
  );
145524
146258
  return [header, sep11, ...rows].join("\n");
145525
146259
  }
145526
- var zodSchema50 = external_exports.object({
146260
+ var zodSchema51 = external_exports.object({
145527
146261
  port: metroPortField,
145528
146262
  device_id: external_exports.string().describe(
145529
146263
  "Device ID used to record or load the React profile<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>."
@@ -145538,7 +146272,7 @@ FOR DEDICATED CPU INVESTIGATION ONLY: do NOT call this as part of a normal profi
145538
146272
  Use react-profiler-analyze instead; it covers all React rendering performance analysis.
145539
146273
  Use when you specifically need to investigate JS CPU hotspots that are NOT tied to React rendering (e.g. regex slowness, cryptography, heavy computations).
145540
146274
  Fails if react-profiler-stop has not been called or no CPU profile is stored.`,
145541
- zodSchema: zodSchema50,
146275
+ zodSchema: zodSchema51,
145542
146276
  readOnly: true,
145543
146277
  // Agents use profiler-cpu-query mode top_functions, which reads the same
145544
146278
  // profile with per-sample intervals and idle filtered out, and has the same
@@ -145646,7 +146380,7 @@ function renderMarkdownTable2(entries) {
145646
146380
  );
145647
146381
  return [header, sep11, ...rows].join("\n");
145648
146382
  }
145649
- var zodSchema51 = external_exports.object({
146383
+ var zodSchema52 = external_exports.object({
145650
146384
  port: metroPortField,
145651
146385
  device_id: external_exports.string().describe(
145652
146386
  "Device ID of the app to inspect<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>. During a recording, use the ID passed to react-profiler-start."
@@ -145659,7 +146393,7 @@ var reactProfilerRendersTool = {
145659
146393
  Returns a markdown table of the components with the longest total self render time. It reads the top 30 levels of the tree and does not count re-renders: record a profiling session for that.
145660
146394
  Use when you want a quick look at what is mounted in a live connected app, without a profiling session.
145661
146395
  Fails if the React DevTools hook is not present in the runtime or the app is not connected.`,
145662
- zodSchema: zodSchema51,
146396
+ zodSchema: zodSchema52,
145663
146397
  readOnly: true,
145664
146398
  // It walks only the top 30 fiber levels, above the screens of a real app
145665
146399
  // (Bluesky's first feed item sits at depth 446), and counts mounts, not
@@ -145828,7 +146562,7 @@ function buildFiberTreeScript(maxDepth, filter) {
145828
146562
  }
145829
146563
  })()`;
145830
146564
  }
145831
- var zodSchema52 = external_exports.object({
146565
+ var zodSchema53 = external_exports.object({
145832
146566
  port: metroPortField,
145833
146567
  device_id: external_exports.string().describe(
145834
146568
  "Device ID of the app to inspect<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>. During a recording, use the ID passed to react-profiler-start."
@@ -145842,7 +146576,7 @@ var reactProfilerFiberTreeTool = {
145842
146576
  Use when tracing the ancestry of a library component.
145843
146577
  Returns a nested JSON tree of fiber nodes with name, tag, actualDuration, selfBaseDuration, and children.
145844
146578
  Fails if the React DevTools hook is not present or no fiber roots have been committed yet.`,
145845
- zodSchema: zodSchema52,
146579
+ zodSchema: zodSchema53,
145846
146580
  readOnly: true,
145847
146581
  interaction: {
145848
146582
  startedMsg: () => "Reading React fiber tree",
@@ -150431,7 +151165,7 @@ var capability31 = {
150431
151165
  android: { emulator: true, device: true, unknown: true },
150432
151166
  macos: { app: true, catalyst: true }
150433
151167
  };
150434
- var zodSchema53 = external_exports.object({
151168
+ var zodSchema54 = external_exports.object({
150435
151169
  device_id: metroDeviceIdParam(
150436
151170
  "Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
150437
151171
  ),
@@ -150453,7 +151187,7 @@ var nativeProfilerStartTool = {
150453
151187
  Start the target app first for an attach recording. Wait for this call to return before reproducing the scenario, then call native-profiler-stop while the app is still running.
150454
151188
  On iOS and Android, a warning names apps whose timings may be affected by native network capture (started by network-capture-start).<flag:macos-apps> On a Mac app, a warning says when the app runs with malloc stack logging. Launch the app through Argent and use a development-signed build. If signing blocks profiling in a background session such as SSH, try the "Time Profiler" template for CPU and hangs without leak checks.
150455
151189
  With malloc stack logging off, Argent blocks the bundled template if it detects a WebKit heap or the check fails. Use "Time Profiler" to keep the app's state, or set malloc_stack_logging to true to restart the app and record leaks with the bundled template. With logging off, other templates that use the Allocations instrument, including "Leaks" and "Allocations", can freeze an affected app.</flag:macos-apps>`,
150456
- zodSchema: zodSchema53,
151190
+ zodSchema: zodSchema54,
150457
151191
  interaction: {
150458
151192
  startedMsg: () => "Starting native profiler",
150459
151193
  completedMsg: () => "Started native profiler",
@@ -150520,7 +151254,7 @@ async function exportedFilesToArtifacts(store, files) {
150520
151254
  function registerTrace(store, traceFile) {
150521
151255
  return store.register({ hostPath: traceFile, kind: "native-profile-trace", archive: "tar.gz" });
150522
151256
  }
150523
- var zodSchema54 = external_exports.object({
151257
+ var zodSchema55 = external_exports.object({
150524
151258
  device_id: metroDeviceIdParam(
150525
151259
  "Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
150526
151260
  )
@@ -150529,7 +151263,7 @@ var nativeProfilerStopTool = {
150529
151263
  id: "native-profiler-stop",
150530
151264
  description: `End a native profiling session started by native-profiler-start and save the trace as a downloadable artifact.
150531
151265
  On iOS<flag:macos-apps> and Mac apps</flag:macos-apps>, export CPU, hangs, and leaks XML from Instruments. Check warning and exportDiagnostics for partial or skipped exports. On Android, save the Perfetto .pftrace.`,
150532
- zodSchema: zodSchema54,
151266
+ zodSchema: zodSchema55,
150533
151267
  interaction: {
150534
151268
  startedMsg: () => "Stopping native profiler",
150535
151269
  completedMsg: ({ result }) => `Saved native profile ${result.traceFile.filename}`,
@@ -150578,7 +151312,7 @@ var capability33 = {
150578
151312
  android: { emulator: true, device: true, unknown: true },
150579
151313
  macos: { app: true, catalyst: true }
150580
151314
  };
150581
- var zodSchema55 = external_exports.object({
151315
+ var zodSchema56 = external_exports.object({
150582
151316
  device_id: metroDeviceIdParam(
150583
151317
  "Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
150584
151318
  )
@@ -150588,7 +151322,7 @@ var nativeProfilerAnalyzeTool = {
150588
151322
  description: `Summarize a native trace saved by native-profiler-stop or restored with profiler-load. Returns a Markdown report with severity and suggested next steps.
150589
151323
  Instruments reports CPU hotspots, UI hangs, and memory leaks on iOS<flag:macos-apps> and Mac apps</flag:macos-apps>. Android reports also include jank reasons, main-thread state, garbage collection, and memory growth as a weak leak signal.
150590
151324
  Use profiler-stack-query for details behind a finding.`,
150591
- zodSchema: zodSchema55,
151325
+ zodSchema: zodSchema56,
150592
151326
  interaction: {
150593
151327
  startedMsg: () => "Analyzing native profile",
150594
151328
  completedMsg: () => "Analyzed native profile",
@@ -151878,7 +152612,7 @@ var launchAnalysisMode = {
151878
152612
  failed: "Failed to record iOS App Launch"
151879
152613
  }
151880
152614
  };
151881
- var zodSchema56 = external_exports.object({
152615
+ var zodSchema57 = external_exports.object({
151882
152616
  mode: external_exports.enum(["measure", "profile"]).describe(
151883
152617
  "measure: time five launches with XCTest. profile: record one Instruments App Launch trace."
151884
152618
  ),
@@ -151918,7 +152652,7 @@ Install a Release build of bundle_id before calling; the tool does not build or
151918
152652
  Use when you need the iOS launch time or want to find what slows the app's startup.
151919
152653
  Returns samplesCollected in measure mode. In profile mode, launchMs runs from the first lifecycle phase after Process Creation to the first frame (null on a simulator); follow profilerSession.next to load the CPU samples with profiler-load and query them with profiler-stack-query.
151920
152654
  Fails if the app is not installed or no iPhone or allowed simulator is available.`,
151921
- zodSchema: zodSchema56,
152655
+ zodSchema: zodSchema57,
151922
152656
  services: () => ({}),
151923
152657
  async execute(_services, params, ctx) {
151924
152658
  switch (params.mode) {
@@ -152281,7 +153015,7 @@ function resolveAudioSession(registry2, device) {
152281
153015
  }
152282
153016
 
152283
153017
  // ../tool-server/src/tools/audio/audio-input.ts
152284
- var zodSchema57 = external_exports.object({
153018
+ var zodSchema58 = external_exports.object({
152285
153019
  udid: external_exports.string().describe("Target iOS Simulator UDID from `list-devices`."),
152286
153020
  source: external_exports.enum(["file", "tone", "microphone"]).describe(
152287
153021
  "`file` plays `path`, `tone` a sine wave, `microphone` restores the real microphone."
@@ -152309,7 +153043,7 @@ function createAudioInputTool(registry2) {
152309
153043
  id: "audio-input",
152310
153044
  description: `Set what apps in an iOS Simulator hear as microphone input: an audio file, a tone, or the real microphone.
152311
153045
  A file starts playing on this call, so call it right before the action that makes the app record.`,
152312
- zodSchema: zodSchema57,
153046
+ zodSchema: zodSchema58,
152313
153047
  searchHint: "audio microphone input mock fake inject voice speech sound file tone simulator mic",
152314
153048
  interaction: {
152315
153049
  startedMsg: ({ params }) => `Setting simulator audio input to ${params.source}`,
@@ -154216,7 +154950,7 @@ var capability34 = {
154216
154950
  // argent's library records the app's window from inside the app.
154217
154951
  macos: { app: true, catalyst: true }
154218
154952
  };
154219
- var zodSchema58 = external_exports.object({
154953
+ var zodSchema59 = external_exports.object({
154220
154954
  udid: external_exports.string().describe(
154221
154955
  "Target ID from `list-devices`.<flag:macos-apps> For a Mac app, use its device ID, such as `macos-app-com.example.notes`.</flag:macos-apps>"
154222
154956
  ),
@@ -154237,7 +154971,7 @@ function createScreenRecordingStartTool(registry2) {
154237
154971
  Recording continues across tool calls until stopped or until the time limit. Set a reminder as soon as recording starts. The start result returns \`outputFile\` on the tool-server host. Retrieve the video with \`screen-recording-stop\`, even after the time limit.
154238
154972
  Start fails if the target is unavailable or already has a recording waiting to be stopped or retrieved. Local simulators, Android emulators and devices, and cabled iPhones require ffmpeg. On a physical iPhone, check for \`transportType: "wired"\` in \`list-devices\` and have the user allow camera access for \`ios-screen-stream\` if prompted on the first recording. tvOS, Chromium<flag:harmonyos>, HarmonyOS</flag:harmonyos>, and Vega are unsupported.<flag:macos-apps>
154239
154973
  For a Mac app started by Argent, restore its window and move it fully onto one display. Capture protection blocks recording. Mac app recording needs neither Screen Recording permission nor ffmpeg and continues while the Mac is locked. If start returns \`MACOS_APP_LIBRARY_OUTDATED\`, run \`restart-app\` and retry.</flag:macos-apps>`,
154240
- zodSchema: zodSchema58,
154974
+ zodSchema: zodSchema59,
154241
154975
  searchHint: "record video screen capture movie mp4 start filming screencast",
154242
154976
  interaction: {
154243
154977
  startedMsg: () => "Starting screen recording",
@@ -154381,7 +155115,7 @@ var capability35 = {
154381
155115
  android: { emulator: true, device: true, unknown: true },
154382
155116
  macos: { app: true, catalyst: true }
154383
155117
  };
154384
- var zodSchema59 = external_exports.object({
155118
+ var zodSchema60 = external_exports.object({
154385
155119
  udid: external_exports.string().describe(
154386
155120
  "Target ID from `list-devices`.<flag:macos-apps> For a Mac app, use its device ID, such as `macos-app-com.example.notes`.</flag:macos-apps>"
154387
155121
  )
@@ -154391,7 +155125,7 @@ var screenRecordingStopTool = {
154391
155125
  description: `Stop a screen recording and retrieve its MP4. Call this even after the time limit or an early capture exit. The tool downloads recordings from remote simulators.
154392
155126
  Returns the saved \`video\` and its \`durationMs\`. When trimming removes still sections, \`wallClockMs\` gives the original duration and \`trimmedMs\` gives the time removed. On a foldable simulator the video follows the active panel, keeps the first panel's size, and reports any \`panelSwitches\`.
154393
155127
  Check \`warning\` for capture problems, such as an undetected foldable panel.<flag:macos-apps> On a Mac app, a warning can report when the video held its last frame or omitted a protected window. Quitting or restarting the app or connecting to it from another Argent tool-server during capture can discard the recording. A stop error can include a path to a recoverable video.</flag:macos-apps>`,
154394
- zodSchema: zodSchema59,
155128
+ zodSchema: zodSchema60,
154395
155129
  searchHint: "stop end finish screen recording video capture save retrieve",
154396
155130
  interaction: {
154397
155131
  startedMsg: () => "Stopping screen recording",
@@ -154781,7 +155515,7 @@ var timeRangeSchema = external_exports.object({
154781
155515
  start: external_exports.coerce.number().describe("Start of range in ms"),
154782
155516
  end: external_exports.coerce.number().describe("End of range in ms")
154783
155517
  });
154784
- var zodSchema60 = external_exports.object({
155518
+ var zodSchema61 = external_exports.object({
154785
155519
  port: metroPortField,
154786
155520
  device_id: metroDeviceIdParam(
154787
155521
  "Device ID used to record or load the React profile<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>."
@@ -154807,7 +155541,7 @@ Modes:
154807
155541
  Use when drilling into specific components or time windows after react-profiler-analyze.
154808
155542
  Returns a markdown table or tree of commit data matching the requested mode.
154809
155543
  Fails if react-profiler-stop has not been called.`,
154810
- zodSchema: zodSchema60,
155544
+ zodSchema: zodSchema61,
154811
155545
  readOnly: true,
154812
155546
  interaction: {
154813
155547
  startedMsg: ({ params }) => `Querying React commits ${params.mode.replace(/^by_/, "by ").replaceAll("_", " ")}`,
@@ -155243,7 +155977,7 @@ var timeWindowSchema = external_exports.object({
155243
155977
  start: external_exports.coerce.number().describe("Start of window in ms"),
155244
155978
  end: external_exports.coerce.number().describe("End of window in ms")
155245
155979
  });
155246
- var zodSchema61 = external_exports.object({
155980
+ var zodSchema62 = external_exports.object({
155247
155981
  port: metroPortField,
155248
155982
  device_id: metroDeviceIdParam(
155249
155983
  "Device ID used to record or load the React profile<flag:macos-apps>. For a Mac app, use its ID from list-devices</flag:macos-apps>."
@@ -155275,7 +156009,7 @@ Each row is one call path, so a function can have several rows and top_n counts
155275
156009
  Use when investigating JS CPU hotspots or correlating CPU cost with specific components.
155276
156010
  Returns a markdown table of CPU hotspots, call tree, or per-component CPU breakdown.
155277
156011
  Fails if no CPU profile is stored; run react-profiler-stop (and ideally react-profiler-analyze) first.`,
155278
- zodSchema: zodSchema61,
156012
+ zodSchema: zodSchema62,
155279
156013
  readOnly: true,
155280
156014
  interaction: {
155281
156015
  startedMsg: ({ params }) => `Querying CPU profile by ${params.mode.replaceAll("_", " ")}`,
@@ -155662,7 +156396,7 @@ async function executeAndroid(api, params) {
155662
156396
  topN: params.top_n
155663
156397
  });
155664
156398
  }
155665
- var zodSchema62 = external_exports.object({
156399
+ var zodSchema63 = external_exports.object({
155666
156400
  device_id: metroDeviceIdParam(
155667
156401
  "Target device id from `list-devices` (iOS UDID<flag:macos-apps>, Mac app id</flag:macos-apps> or Android serial)."
155668
156402
  ),
@@ -155684,7 +156418,7 @@ Modes:
155684
156418
  - function_callers: Who calls function_name and what it calls.
155685
156419
  - thread_breakdown: CPU time split by thread, optionally filtered.
155686
156420
  - leak_stacks: Memory leak details (iOS<flag:macos-apps> and Mac apps</flag:macos-apps> only). Requires a trace with leak data.`,
155687
- zodSchema: zodSchema62,
156421
+ zodSchema: zodSchema63,
155688
156422
  readOnly: true,
155689
156423
  interaction: {
155690
156424
  startedMsg: ({ params }) => `Querying native stacks by ${stackQueryMode[params.mode]}`,
@@ -155762,7 +156496,7 @@ function buildPerfettoAnchor(wallClockStartMs) {
155762
156496
  }
155763
156497
 
155764
156498
  // ../tool-server/src/tools/profiler/combined/profiler-combined-report.ts
155765
- var zodSchema63 = external_exports.object({
156499
+ var zodSchema64 = external_exports.object({
155766
156500
  port: metroPortField,
155767
156501
  device_id: metroDeviceIdParam(
155768
156502
  "Device ID from list-devices used for the native profile (iOS simulator UDID, Android serial<flag:macos-apps>, or Mac app ID</flag:macos-apps>)."
@@ -155775,7 +156509,7 @@ Maps native hangs to React commits using wall-clock time alignment.
155775
156509
  Call this tool when both profilers were run in parallel on the same session.
155776
156510
  Returns a markdown report correlating hangs with React commits, memory leaks, and investigation hints.
155777
156511
  Fails if either react-profiler-analyze or native-profiler-analyze has not been called first, or if the session stored no React commits.`,
155778
- zodSchema: zodSchema63,
156512
+ zodSchema: zodSchema64,
155779
156513
  readOnly: true,
155780
156514
  interaction: {
155781
156515
  startedMsg: () => "Building combined performance report",
@@ -156465,7 +157199,7 @@ var profilerLoadAction = {
156465
157199
  failure: "load"
156466
157200
  }
156467
157201
  };
156468
- var zodSchema64 = external_exports.object({
157202
+ var zodSchema65 = external_exports.object({
156469
157203
  mode: external_exports.enum(["list", "load_react", "load_native"]).describe("What to do; see Modes in the tool description."),
156470
157204
  session_id: external_exports.string().regex(SESSION_ID_PATTERN, "session_id may only contain letters, digits, '_' and '-'").optional().describe("Timestamp-based session identifier (e.g. '20250313-143022') from the list output."),
156471
157205
  port: metroPortField,
@@ -156487,7 +157221,7 @@ Modes:
156487
157221
  Loading replaces the session in memory for this device_id (and Metro port, for React): the one the query tools and react-profiler-analyze read. The replaced session stays on disk; load it again by its session_id.
156488
157222
  Returns a summary of the loaded session or a session list for the list mode.
156489
157223
  Fails if the session_id is not found or the session's trace files are missing from disk.`,
156490
- zodSchema: zodSchema64,
157224
+ zodSchema: zodSchema65,
156491
157225
  interaction: {
156492
157226
  startedMsg: ({ params }) => profilerLoadAction[params.mode].started(params),
156493
157227
  completedMsg: ({ params }) => profilerLoadAction[params.mode].completed(params),
@@ -156647,7 +157381,7 @@ function unnameableSessionUrns(urns) {
156647
157381
  }
156648
157382
 
156649
157383
  // ../tool-server/src/tools/simulator/stop-simulator-server.ts
156650
- var zodSchema65 = external_exports.object({
157384
+ var zodSchema66 = external_exports.object({
156651
157385
  udid: external_exports.string().describe(
156652
157386
  "Target device id (iOS UDID, Android serial, or Chromium id) whose transport session to stop"
156653
157387
  )
@@ -156656,7 +157390,7 @@ function createStopSimulatorServerTool(registry2) {
156656
157390
  return {
156657
157391
  id: "stop-simulator-server",
156658
157392
  description: `Stop the transport session for a specific device (iOS simulator / Android: simulator-server process; physical iOS: the on-device runner; Chromium: CDP WebSocket) and free its resources; on a TV target it also reaps that device's TV-control daemons. Use to restart a wedged transport, or when the user is done with one device but wants to keep others running - not just because a task on it finished, since the next task on that device would start cold again. On iOS / Android / TV it deliberately leaves this device's native-devtools, accessibility, profiler and debugger services running - to drain those as well, use stop-all-simulator-servers with \`devices\`. On CHROMIUM, stopping the transport also ends the JS-runtime debugger session and its captured console history - reconnect with debugger-connect afterwards.<flag:macos-apps> On a Mac app, this ends native capture and discards its records. Use network-capture-stop to stop JS capture or to keep records. Disconnecting the app also ends its screen recording. Retrieve the video first, or check the next screen-recording-stop error for the path to any saved video.</flag:macos-apps> Returns { stopped, udid }; \`stopped\` is false, not an error, when no session is open for the id.`,
156659
- zodSchema: zodSchema65,
157393
+ zodSchema: zodSchema66,
156660
157394
  interaction: {
156661
157395
  startedMsg: ({ params }) => `Stopping simulator server for ${params.udid}`,
156662
157396
  completedMsg: ({ params }) => `Stopped simulator server for ${params.udid}`,
@@ -156691,7 +157425,7 @@ function createStopSimulatorServerTool(registry2) {
156691
157425
  // ../tool-server/src/tools/simulator/stop-all-simulator-servers.ts
156692
157426
  init_zod();
156693
157427
  init_src2();
156694
- var zodSchema66 = external_exports.object({
157428
+ var zodSchema67 = external_exports.object({
156695
157429
  devices: external_exports.array(external_exports.string()).optional().describe(
156696
157430
  "Ids of the devices THIS session used (iOS UDID / Android serial / Chromium id), to scope the teardown to."
156697
157431
  )
@@ -156704,7 +157438,7 @@ PASS \`devices\` with the device ids this session used: one tool-server serves e
156704
157438
  A JS-runtime debugger session is keyed by the id you called \`debugger-connect\` with. On a Metro serving two or more devices that id can be a \`logicalDeviceId\`: connect refuses a udid or serial it cannot match to one Metro device by name, and tells you to re-target with the \`logicalDeviceId\` it returns. A scope built from \`list-devices\` ids cannot reach that session. Pass any such \`logicalDeviceId\` in \`devices\` ALONGSIDE the device id.
156705
157439
  Returns { stopped }: the URNs of the live services that were shut down; empty means nothing was still running. { unmatched }, present only when a supplied id owns no service here, lists those ids, so a typo or a device NAME passed instead of an id does not read as a clean machine. It is NOT proof the id is wrong: a Vega device you only booted and drove with the remote registers no service and lands here, as does any device this session never started anything on. { left_running } lists the URNs of live debugger sessions (and the network inspectors / React profiler sessions riding on them) whose id no device scope can name; re-call with the id after each URN's \`<namespace>:<port>:\` prefix to reap them. { aborted: true } means the request was cancelled part-way: the rest was left untouched and \`unmatched\` / \`left_running\` were not computed.
156706
157440
  Fails if the input has an unknown key (e.g. \`udids\` instead of \`devices\`); otherwise it always succeeds, and reaping nothing is a result, not a failure.`,
156707
- zodSchema: zodSchema66,
157441
+ zodSchema: zodSchema67,
156708
157442
  interaction: {
156709
157443
  // "all" only holds for the unscoped sweep; a scoped call touches just the
156710
157444
  // ids it was given.
@@ -156907,13 +157641,13 @@ function listeningPids(port) {
156907
157641
  }
156908
157642
  return lines.map((s) => parseInt(s, 10));
156909
157643
  }
156910
- var zodSchema67 = external_exports.object({
157644
+ var zodSchema68 = external_exports.object({
156911
157645
  port: external_exports.number().int().min(1).max(65535).default(8081).describe("TCP port Metro is listening on")
156912
157646
  });
156913
157647
  var stopMetroTool = {
156914
157648
  id: "stop-metro",
156915
157649
  description: `Stop the Metro bundler process listening on \`port\`. Use when the user asks to stop Metro or when Metro must be restarted - do not offer it when a task wraps up, since the next task would wait on a cold Metro start. Returns { stopped, port, pids }: stopped=true when it sent SIGTERM to every listening pid it found (or the pid had already exited), stopped=false when it found none. Fails if the port lookup cannot run or times out, if it finds a listener but not the process that owns it, or if it cannot signal a listener it found (e.g. EPERM). On macOS another user's listener is detected only when no other listener on the port is visible, so it can survive stopped=true. This is DESTRUCTIVE: always ask the user for confirmation before calling this tool.`,
156916
- zodSchema: zodSchema67,
157650
+ zodSchema: zodSchema68,
156917
157651
  interaction: {
156918
157652
  startedMsg: ({ params }) => `Stopping Metro on port ${params.port}`,
156919
157653
  completedMsg: ({ params }) => `Stopped Metro on port ${params.port}`,
@@ -159449,7 +160183,7 @@ var MACOS_PLATFORM_FLAG = { [FLAG_ENUM_META_KEY]: { macos: MACOS_APPS_FLAG } };
159449
160183
  var fileInputs3 = [
159450
160184
  { target: "project_root", path: "${project_root}", kind: "probe" }
159451
160185
  ];
159452
- var zodSchema68 = external_exports.object({
160186
+ var zodSchema69 = external_exports.object({
159453
160187
  name: external_exports.string().describe(
159454
160188
  'Name for this e2e test (e.g. "settings-explore"): letters, digits, underscore and hyphen only.'
159455
160189
  ),
@@ -159496,7 +160230,7 @@ Call e2e-finish-recording when done.
159496
160230
  To remove or reorder steps, edit the .yaml file after e2e-finish-recording, not
159497
160231
  during the recording: over a link, the next recorded step writes over your edit,
159498
160232
  and without a link, an edit that renumbers the steps drops their warnings.`,
159499
- zodSchema: zodSchema68,
160233
+ zodSchema: zodSchema69,
159500
160234
  aliases: ["flow-start-recording"],
159501
160235
  interaction: {
159502
160236
  // Name the flow: concurrent recordings interleave in one log, and "flow
@@ -161553,7 +162287,7 @@ async function waitForIdle(env, step) {
161553
162287
  if (left < MIN_ROUND_BUDGET_MS) break;
161554
162288
  if (!await sleepOrAbort(Math.min(IDLE_POLL_MS, left), env.signal)) return ABORTED_OUTCOME;
161555
162289
  }
161556
- const unreadable = (underlying) => ({
162290
+ const unreadable2 = (underlying) => ({
161557
162291
  ok: false,
161558
162292
  indeterminate: true,
161559
162293
  // The underlying reader reports an instrumentation failure, whose remedy
@@ -161568,7 +162302,7 @@ async function waitForIdle(env, step) {
161568
162302
  reason: `the UI tree read back empty and degraded while waiting for the screen to settle, so the screen was never observed \u2014 this is the reader reporting it could not see the app, not the app rendering nothing` + (blindHint === void 0 ? "" : `. ${blindHint}`)
161569
162303
  });
161570
162304
  if (readsSucceeded === 0) {
161571
- if (treeErrorMessage !== void 0) return unreadable(treeErrorMessage);
162305
+ if (treeErrorMessage !== void 0) return unreadable2(treeErrorMessage);
161572
162306
  if (treeReadBlind) return degraded();
161573
162307
  return {
161574
162308
  ok: false,
@@ -161577,7 +162311,7 @@ async function waitForIdle(env, step) {
161577
162311
  };
161578
162312
  }
161579
162313
  if (treeErrorMessage !== void 0 && darkReads > IDLE_TOLERATED_DARK_READS) {
161580
- return unreadable(treeErrorMessage);
162314
+ return unreadable2(treeErrorMessage);
161581
162315
  }
161582
162316
  if (treeReadBlind && darkReads > IDLE_TOLERATED_DARK_READS) {
161583
162317
  return degraded();
@@ -162398,6 +163132,14 @@ function unmetWaitWarningFor(cause) {
162398
163132
  if (cause === "cancelled") return CANCELLED_WAIT_WARNING;
162399
163133
  return UNMET_WAIT_WARNING;
162400
163134
  }
163135
+ var UNMET_NETWORK_WAIT_WARNING = "recorded, but the wait never held: `await-network-request` returned success:false, and at replay an unmet wait FAILS the step. `toolResult.note` counts the requests since the start per layer: fix the matcher, or record the action that sends the request, then record the wait again. Delete the failed step after `e2e-finish-recording`, not mid-recording";
163136
+ var UNREADABLE_NETWORK_WAIT_WARNING = "recorded, but no armed capture layer was read near the deadline, so the request was never judged and whether it is sent is UNKNOWN: `toolResult.layers` says why. Get the layer back (for example call network-capture-start again once the app's JavaScript has loaded) and record the wait again. Do not delete the step on this warning alone";
163137
+ var CANCELLED_NETWORK_WAIT_WARNING = "recorded, but this wait was cancelled before its deadline, so whether the request is sent is UNKNOWN: record the step again to find out";
163138
+ function unmetNetworkWaitWarningFor(cause) {
163139
+ if (cause === "unreadable") return UNREADABLE_NETWORK_WAIT_WARNING;
163140
+ if (cause === "cancelled") return CANCELLED_NETWORK_WAIT_WARNING;
163141
+ return UNMET_NETWORK_WAIT_WARNING;
163142
+ }
162401
163143
  function indeterminateReasonCaveat(udid) {
162402
163144
  if (platformOf(udid) !== "ios") return "";
162403
163145
  return ". One thing that reason cannot see is this step: the probe predicts an `await:`/`assert:` directive, and no directive takes a bundleId, so neither this probe nor the runner accepts one (the `bundleId` on this step reached the live wait only)";
@@ -162804,7 +163546,7 @@ function withRecordedPanelKind(command, args, toolResult) {
162804
163546
  var fileInputs4 = [
162805
163547
  { target: "project_root", path: "${project_root}", kind: "probe", collect: "step" }
162806
163548
  ];
162807
- var zodSchema69 = external_exports.object({
163549
+ var zodSchema70 = external_exports.object({
162808
163550
  name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
162809
163551
  project_root: external_exports.string().describe(
162810
163552
  "Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
@@ -162823,7 +163565,7 @@ function createFlowAddStepTool(registry2) {
162823
163565
  description: `Execute one MCP tool and record its step in the e2e test named by \`name\` + \`project_root\`. Use when recording and you want each action run and captured; the recording must already be open.
162824
163566
  A coordinate \`gesture-tap\` records as a portable \`tap\` selector step; \`restart-app\` as a \`launch\`.
162825
163567
  Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status, says whether a step was appended. Fails with an error, recording nothing. Call recording tools, including \`e2e-add-script\`, directly.`,
162826
- zodSchema: zodSchema69,
163568
+ zodSchema: zodSchema70,
162827
163569
  aliases: ["flow-add-step"],
162828
163570
  interaction: {
162829
163571
  // Name the flow: recordings are concurrent, so several of these lines can
@@ -162962,16 +163704,15 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
162962
163704
  );
162963
163705
  }
162964
163706
  let waitWarning;
162965
- if (command === AWAIT_UI_ELEMENT_TOOL_ID) {
162966
- if (isUnmetUiWaitResult(params.command, toolResult)) {
162967
- waitWarning = {
162968
- warning: unmetWaitWarningFor(unmetUiWaitCause(toolResult)),
162969
- kind: "wait"
162970
- };
162971
- } else {
162972
- const probed = (await probeAgainstRunnerTree(registry2, ctx, args)).warning;
162973
- if (probed) waitWarning = { warning: probed, kind: "conversion" };
162974
- }
163707
+ if (isUnmetWaitResult(command, toolResult)) {
163708
+ const cause = unmetWaitCause(command, toolResult);
163709
+ waitWarning = {
163710
+ warning: command === AWAIT_NETWORK_REQUEST_TOOL_ID ? unmetNetworkWaitWarningFor(cause) : unmetWaitWarningFor(cause),
163711
+ kind: "wait"
163712
+ };
163713
+ } else if (command === AWAIT_UI_ELEMENT_TOOL_ID) {
163714
+ const probed = (await probeAgainstRunnerTree(registry2, ctx, args)).warning;
163715
+ if (probed) waitWarning = { warning: probed, kind: "conversion" };
162975
163716
  }
162976
163717
  const runTarget = command === RUN_TARGET_COMMAND && params.delayMs === void 0 ? await captureRunTarget(session, args, project) : void 0;
162977
163718
  const strippedArgs = stripDeviceKeys(args);
@@ -163066,7 +163807,7 @@ Returns { message, stepCount, recorded, savedTo }; \`recorded\`, not the status,
163066
163807
 
163067
163808
  // ../tool-server/src/tools/flows/flow-insert-echo.ts
163068
163809
  init_zod();
163069
- var zodSchema70 = external_exports.object({
163810
+ var zodSchema71 = external_exports.object({
163070
163811
  name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
163071
163812
  project_root: external_exports.string().describe(
163072
163813
  "Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
@@ -163078,7 +163819,7 @@ var flowInsertEchoTool = {
163078
163819
  description: `Record an echo step in the e2e test named by \`name\` + \`project_root\`. Echo steps print a message when the e2e test is replayed, useful as labels between tool calls.
163079
163820
  Use when you want to annotate a recorded e2e test with a human-readable label or checkpoint message.
163080
163821
  Returns { message, stepCount, savedTo }. Fails if that e2e test has no recording in progress.`,
163081
- zodSchema: zodSchema70,
163822
+ zodSchema: zodSchema71,
163082
163823
  fileInputs: PROJECT_ROOT_INPUT,
163083
163824
  aliases: ["flow-add-echo"],
163084
163825
  interaction: {
@@ -164554,7 +165295,7 @@ function renderOutput(output2) {
164554
165295
  const kept = bytes.subarray(0, utf8SafeCut(bytes, OUTPUT_RENDER_LIMIT_BYTES));
164555
165296
  return { outputJson: kept.toString("utf8"), outputTruncated: true };
164556
165297
  }
164557
- var zodSchema71 = external_exports.object({
165298
+ var zodSchema72 = external_exports.object({
164558
165299
  name: external_exports.string().describe("E2E test name passed to e2e-start-recording."),
164559
165300
  project_root: external_exports.string().describe("Absolute project root passed to e2e-start-recording."),
164560
165301
  path: external_exports.string().describe(
@@ -164565,7 +165306,7 @@ var zodSchema71 = external_exports.object({
164565
165306
  var flowAddScriptTool = {
164566
165307
  id: "e2e-add-script",
164567
165308
  description: `Run a local JavaScript (.mjs, .js) or TypeScript (.mts, .ts) file and record it as a \`script:\` step in an active e2e test. Use when the user requests a local script in the e2e test, and only then. Call it at the point in the recording where the script must run. Returns \`status\`, \`reason\` and \`stepCount\`. A failed script is not recorded. Check \`reason\` and the affected state before you retry. Over a link (argent link or ARGENT_TOOLS_URL), the tool refuses the call: record such an e2e test with no link.`,
164568
- zodSchema: zodSchema71,
165309
+ zodSchema: zodSchema72,
164569
165310
  fileInputs: PROJECT_ROOT_INPUT,
164570
165311
  aliases: ["flow-add-script"],
164571
165312
  interaction: {
@@ -164709,7 +165450,7 @@ function anchoredWarnings(session, steps) {
164709
165450
  }
164710
165451
  return kept;
164711
165452
  }
164712
- var zodSchema72 = external_exports.object({
165453
+ var zodSchema73 = external_exports.object({
164713
165454
  name: external_exports.string().describe("Name of the e2e test being recorded: the one passed to e2e-start-recording."),
164714
165455
  project_root: external_exports.string().describe(
164715
165456
  "Absolute path to the project root of the e2e test being recorded: the same value passed to e2e-start-recording."
@@ -164720,7 +165461,7 @@ var flowFinishRecordingTool = {
164720
165461
  description: `Finish recording the e2e test named by \`name\` + \`project_root\`, leaving recordings under any other key untouched. Returns { message, path, executionPrerequisite, steps, summary, e2eTestFile, savedTo } - a summary of all recorded steps plus the final YAML. Use when you have added all desired steps and want to finalize the e2e test file. Fails if that e2e test has no recording in progress.
164721
165462
  A warning e2e-add-step raised on a recorded \`await-ui-element\` is repeated in \`summary\` as a \`warning:\` line right below its step, and \`message\` counts them by kind. Read them before you convert a wait to \`await:\`/\`assert:\` or replay the e2e test.
164722
165463
  You can still edit the .yaml file directly afterwards to remove or reorder steps.`,
164723
- zodSchema: zodSchema72,
165464
+ zodSchema: zodSchema73,
164724
165465
  fileInputs: PROJECT_ROOT_INPUT,
164725
165466
  aliases: ["flow-finish-recording"],
164726
165467
  interaction: {
@@ -167793,7 +168534,7 @@ Run the e2e test on the computer that runs the tool-server, with no link and no
167793
168534
  }
167794
168535
  );
167795
168536
  }
167796
- var zodSchema73 = external_exports.object({
168537
+ var zodSchema74 = external_exports.object({
167797
168538
  name: external_exports.string().optional().describe(
167798
168539
  'Name of a saved e2e test to run from `<project_root>/.argent/e2e`, or `.argent/flows` when it is not there (e.g. "settings-explore").'
167799
168540
  ),
@@ -167842,7 +168583,7 @@ a nested e2e-execute not called by name with an absolute project_root, a directo
167842
168583
  argument, a file path built from several arguments, a relative path): it stops before the first step and the
167843
168584
  error lists each such step. An absolute .png/.yaml argument from anywhere else fails only when its step runs.
167844
168585
  Without a link, every step kind runs.`,
167845
- zodSchema: zodSchema73,
168586
+ zodSchema: zodSchema74,
167846
168587
  aliases: ["flow-execute"],
167847
168588
  interaction: {
167848
168589
  startedMsg: ({ params }) => `Running e2e test ${displayFlowName(params)}`,
@@ -168928,7 +169669,7 @@ var fileInputs6 = [
168928
169669
  },
168929
169670
  ...PROJECT_ROOT_INPUT
168930
169671
  ];
168931
- var zodSchema74 = external_exports.object({
169672
+ var zodSchema75 = external_exports.object({
168932
169673
  name: external_exports.string().optional().describe(
168933
169674
  'Name of a saved e2e test to inspect from `<project_root>/.argent/e2e`, or `.argent/flows` when it is not there (e.g. "settings-explore").'
168934
169675
  ),
@@ -168959,7 +169700,7 @@ correct account, correct screen) before committing to a run, or when relaying th
168959
169700
  Touches no device and needs none booted: it only reads the file.
168960
169701
  Fails if the e2e test file does not exist.
168961
169702
  Address the e2e test exactly as you will address it in e2e-execute: name or e2e_test_path, one and only one; supplying both or neither is rejected.`,
168962
- zodSchema: zodSchema74,
169703
+ zodSchema: zodSchema75,
168963
169704
  readOnly: true,
168964
169705
  // When its gates pass, e2e-execute without prerequisiteAcknowledged returns
168965
169706
  // the same executionPrerequisite, from the same resolveFlowSource, before any
@@ -169293,7 +170034,7 @@ async function readWorkspaceSnapshot(workspacePath) {
169293
170034
  var fileInputs7 = [
169294
170035
  { target: "workspacePath", path: "${workspacePath}", kind: "directory" }
169295
170036
  ];
169296
- var zodSchema75 = external_exports.object({
170037
+ var zodSchema76 = external_exports.object({
169297
170038
  workspacePath: external_exports.string().describe("Absolute path to the project root directory to inspect (e.g. /Users/dev/MyApp)")
169298
170039
  });
169299
170040
  var gatherWorkspaceDataTool = {
@@ -169308,7 +170049,7 @@ Makefile targets, lint-staged config, and a list of detected config files.
169308
170049
  Use when a program needs the project type (React Native, Expo, Flutter, native iOS/Android,
169309
170050
  or other), build commands, platform support, package manager or QA tooling.
169310
170051
  Items it cannot read are null or empty collections. Fails if workspacePath is not a directory on the tool-server host.`,
169311
- zodSchema: zodSchema75,
170052
+ zodSchema: zodSchema76,
169312
170053
  readOnly: true,
169313
170054
  hideFromMcp: true,
169314
170055
  interaction: {
@@ -169390,7 +170131,7 @@ function targetFlagsFor(target) {
169390
170131
  return [`--${target}`];
169391
170132
  }
169392
170133
  var updateScheduled = false;
169393
- var zodSchema76 = external_exports.object({
170134
+ var zodSchema77 = external_exports.object({
169394
170135
  target: external_exports.enum(["auto", "global", "local", "both"]).optional().describe(
169395
170136
  "Which install to update. 'auto' (default) updates the install serving this session: the global PATH install or this project's local devDependency, whichever this server runs from. Pass 'global' / 'local' to force one, or 'both' when the user has both and wants each updated."
169396
170137
  )
@@ -169398,7 +170139,7 @@ var zodSchema76 = external_exports.object({
169398
170139
  var updateArgentTool = {
169399
170140
  id: "update-argent",
169400
170141
  description: "Apply a pending Argent update. Call this only when the user has explicitly consented in this conversation to updating Argent, e.g. after an update notification reports a new version. Returns { message } with the update status, version info, and whether the tool server restarts. Fails if no update is available or an update is already in progress.",
169401
- zodSchema: zodSchema76,
170142
+ zodSchema: zodSchema77,
169402
170143
  interaction: {
169403
170144
  startedMsg: () => `Updating Argent to ${getUpdateState().installableVersion ?? "latest"}`,
169404
170145
  completedMsg: () => `Updated Argent to ${getUpdateState().installableVersion ?? "latest"}`,
@@ -169489,7 +170230,7 @@ var updateArgentTool = {
169489
170230
  // ../tool-server/src/tools/system/dismiss-update.ts
169490
170231
  init_zod();
169491
170232
  var MAX_HOURS = 24 * 365 * 10;
169492
- var zodSchema77 = external_exports.object({
170233
+ var zodSchema78 = external_exports.object({
169493
170234
  hours: external_exports.number().min(0).describe(
169494
170235
  "Hours until reminders resume: 168 is a week, 87600 is the longest, 0 turns them back on"
169495
170236
  )
@@ -169497,7 +170238,7 @@ var zodSchema77 = external_exports.object({
169497
170238
  var dismissUpdateTool = {
169498
170239
  id: "dismiss-update",
169499
170240
  description: "Postpone the Argent update reminder, on every tool-server on this machine, when the user wants it later or tomorrow, wants it stopped, or never wants it (87600 hours). Installs nothing. A memory or a reminder of your own does not change it. Returns { message, remindersResumeAt, persisted, pendingVersion }: tell the user when reminders resume, and if persisted is false, that it did not fully hold.",
169500
- zodSchema: zodSchema77,
170241
+ zodSchema: zodSchema78,
169501
170242
  interaction: {
169502
170243
  startedMsg: () => "Dismissing Argent update",
169503
170244
  completedMsg: () => "Dismissed Argent update",
@@ -169550,7 +170291,7 @@ var fileInputs8 = [
169550
170291
  { target: "currentPath", path: "${currentPath}", kind: "file", optional: true },
169551
170292
  { target: "outputDir", path: "${outputDir}", kind: "probe", optional: true }
169552
170293
  ];
169553
- var zodSchema78 = external_exports.object({
170294
+ var zodSchema79 = external_exports.object({
169554
170295
  baselinePath: external_exports.string().min(1).optional().describe(
169555
170296
  "Path to the saved baseline PNG file. Required unless captureBaseline is true; do not pass both."
169556
170297
  ),
@@ -169584,7 +170325,7 @@ Physical iPhones: live captures are device-wide and need no registered app.
169584
170325
  </flag:macos-apps>Returns { summary, diffPath, contextDiffPath }. The summary uses normalized [0,1] screen locations matching describe coordinates; diffPath is the full-size diff image and contextDiffPath is a downscaled image for MCP/agent display.
169585
170326
  Ignores the fixed top status-bar band for both pixel and OCR text comparisons.
169586
170327
  Fails if the input sources are invalid, PNG files cannot be read, outputDir cannot be written, or the simulator-server / emulator backend<flag:harmonyos>, or \`hdc\` on HarmonyOS,</flag:harmonyos> is not reachable.`,
169587
- zodSchema: zodSchema78,
170328
+ zodSchema: zodSchema79,
169588
170329
  searchHint: "compare screenshots png diff visual UI changes UI regression visual regression screenshot diff changed regions text ocr live capture<flag:harmonyos> harmony harmonyos</flag:harmonyos>",
169589
170330
  interaction: {
169590
170331
  startedMsg: () => "Comparing screenshots",
@@ -169931,7 +170672,7 @@ async function captureElementFrame(registry2, udid, match, opts = {}) {
169931
170672
  }
169932
170673
 
169933
170674
  // ../tool-server/src/tools/variants/propose-variant.ts
169934
- var zodSchema79 = external_exports.object({
170675
+ var zodSchema80 = external_exports.object({
169935
170676
  element: external_exports.string().min(1).max(200).describe(
169936
170677
  'Human name of the on-screen element this variant targets, e.g. "Foo button" or "profile header". Repeated calls with the same element accumulate multiple variants on it. Used as the default screen matcher when `match` is omitted.'
169937
170678
  ),
@@ -169984,7 +170725,7 @@ arrives as a follow-up message (this is the case in an \`argent lens\` CLI sessi
169984
170725
 
169985
170726
  Returns { round, elementId, variantId, element, variantCount, totalElements }: confirmation only;
169986
170727
  it does not wait for the user.`,
169987
- zodSchema: zodSchema79,
170728
+ zodSchema: zodSchema80,
169988
170729
  searchHint: "propose design variant alternative option for element non-blocking ab choice",
169989
170730
  featureFlag: "argent-lens",
169990
170731
  interaction: {
@@ -170015,7 +170756,7 @@ it does not wait for the user.`,
170015
170756
 
170016
170757
  // ../tool-server/src/tools/variants/await-user-selection.ts
170017
170758
  init_zod();
170018
- var zodSchema80 = external_exports.object({
170759
+ var zodSchema81 = external_exports.object({
170019
170760
  timeoutSeconds: external_exports.number().int().min(5).max(86400).optional().describe(
170020
170761
  "Max seconds to block this call before returning a re-awaitable { status: 'pending' } result (default 1800). The user's proposals stay live across timeouts; on 'pending' just call await_user_selection again. Lower this if your MCP client enforces a short request timeout."
170021
170762
  )
@@ -170043,7 +170784,7 @@ Returns one of:
170043
170784
 
170044
170785
  This tool is long-running; it intentionally holds the request open. It honors client
170045
170786
  disconnects (aborts cleanly).`,
170046
- zodSchema: zodSchema80,
170787
+ zodSchema: zodSchema81,
170047
170788
  searchHint: "await wait user selection choice variant blocking confirm picks complete",
170048
170789
  featureFlag: "argent-lens",
170049
170790
  // Hidden while an `argent lens` CLI session owns the preview window: there the
@@ -170096,7 +170837,7 @@ var tabAction = {
170096
170837
  var capability37 = {
170097
170838
  chromium: { app: true }
170098
170839
  };
170099
- var zodSchema81 = external_exports.object({
170840
+ var zodSchema82 = external_exports.object({
170100
170841
  udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
170101
170842
  action: external_exports.enum(["list", "select", "new", "close"]).describe(
170102
170843
  "list: enumerate tabs/windows. select: make a tab active. new: open a tab and activate it. close: close a tab; if it was active, another live tab becomes active."
@@ -170113,7 +170854,7 @@ var chromiumTabsTool = {
170113
170854
  The active tab is what describe / gesture-tap / screenshot / debugger-evaluate / open-url all operate on, so select a tab before driving it. tabIds (\`t1\`, \`t2\`, \u2026) are stable for the session and never reused.
170114
170855
  Use when an app exposes multiple windows or tabs and you need to inspect or drive one other than the current page, or to open/close a page during an e2e test.
170115
170856
  Returns { tabs: [{ tabId, targetId, title, url, active, label? }] } after the action. Fails if the device is not a Chromium (CDP) device, or the requested tabId/label no longer matches a live tab.`,
170116
- zodSchema: zodSchema81,
170857
+ zodSchema: zodSchema82,
170117
170858
  searchHint: "tab tabs window windows switch select close new open multi-tab chromium electron",
170118
170859
  interaction: {
170119
170860
  startedMsg: ({ params }) => tabAction[params.action].started(params),
@@ -170230,7 +170971,7 @@ var cookieAction = {
170230
170971
  var capability38 = {
170231
170972
  chromium: { app: true }
170232
170973
  };
170233
- var zodSchema82 = external_exports.object({
170974
+ var zodSchema83 = external_exports.object({
170234
170975
  udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
170235
170976
  action: external_exports.enum(["get", "set", "delete", "clear"]).describe(
170236
170977
  "get: read cookies. set: create/update a cookie. delete: remove matching cookies. clear: remove ALL browser cookies."
@@ -170253,7 +170994,7 @@ var chromiumCookiesTool = {
170253
170994
  \`set\` needs \`name\`, \`value\`, and \`url\` or \`domain\`; \`delete\` needs \`name\` and \`url\` or \`domain\`.
170254
170995
  Use when seeding an authenticated session before an e2e test (set the session cookie, then navigate) or asserting cookie state after one.
170255
170996
  Returns { cookies, count } for get, or a small status object ({ set } / { deleted } / { cleared }) otherwise. Fails if the device is not a Chromium (CDP) device, or a param that \`set\` / \`delete\` needs is missing.`,
170256
- zodSchema: zodSchema82,
170997
+ zodSchema: zodSchema83,
170257
170998
  searchHint: "cookies cookie get set delete clear httponly samesite session auth chromium",
170258
170999
  interaction: {
170259
171000
  startedMsg: ({ params }) => `${cookieAction[params.action].started} browser cookies`,
@@ -170334,7 +171075,7 @@ var storageAction = {
170334
171075
  var capability39 = {
170335
171076
  chromium: { app: true }
170336
171077
  };
170337
- var zodSchema83 = external_exports.object({
171078
+ var zodSchema84 = external_exports.object({
170338
171079
  udid: external_exports.string().describe("Chromium device id from `list-devices` (e.g. `chromium-cdp-9222`)."),
170339
171080
  store: external_exports.enum(["local", "session"]).describe("`local`: localStorage. `session`: sessionStorage."),
170340
171081
  action: external_exports.enum(["get", "set", "remove", "clear"]).describe(
@@ -170348,7 +171089,7 @@ var chromiumStorageTool = {
170348
171089
  description: `Read and write localStorage / sessionStorage of a Chromium (CDP) app, for the origin of the active tab's page.
170349
171090
  Use when seeding feature flags / auth tokens before an e2e test or asserting persisted app state after one.
170350
171091
  Returns { value } for one key, { entries, count } for all keys, and { set } / { removed } / { cleared } for the writes. Fails if the device is not a Chromium (CDP) device, or the action is missing the \`key\` / \`value\` it needs.`,
170351
- zodSchema: zodSchema83,
171092
+ zodSchema: zodSchema84,
170352
171093
  searchHint: "storage localstorage sessionstorage local session get set remove clear key value chromium",
170353
171094
  // Agents read and write Web Storage with debugger-evaluate, which runs the same
170354
171095
  // Runtime.evaluate on the active page. The SDK and the e2e-full suite still call it.
@@ -170567,7 +171308,7 @@ async function stub(app, params) {
170567
171308
  });
170568
171309
  return { armed, mode, panelKind };
170569
171310
  }
170570
- var zodSchema84 = external_exports.object({
171311
+ var zodSchema85 = external_exports.object({
170571
171312
  udid: external_exports.string().describe("Mac app id from `list-devices` (macos-app-<bundle id>)."),
170572
171313
  action: external_exports.enum(["list", "choose", "cancel", "discard", "stub"]).describe(
170573
171314
  "list: the open file panels. choose: answer a panel with path or paths. cancel: cancel a panel. discard: answer a panel with its Delete or Don't Save button. stub: arm an answer or a cancel for the next panel the app presents (stubMode)."
@@ -170600,7 +171341,7 @@ For stub, panelKind names the kind of panel the answer is for; without it, paths
170600
171341
  A sandboxed app that argent started is given access to the chosen paths only. A save panel that lists file formats refuses a path whose extension matches none of them, also a path with no extension, unless it saves any file (public.data, public.item) or allows other file types. On macOS 15 and later, the extension picks the format. argent does not check a path for an open panel against the panel's allowed file types.
170601
171342
  Returns { panels } for list, { chosen, panel, kind, paths } for choose, { cancelled, panel } for cancel, { discarded, panel } for discard, { armed, mode, panelKind? } for stub.
170602
171343
  Fails if no panel appears within timeoutMs, if more than one panel is open and panel is not given, if a path is relative or does not exist (a save panel needs an existing folder), if a path for a save panel is an existing folder other than a document package the panel saves, if the path does not fit the panel choose finds (a folder for a panel of files, a file for a panel of folders, a refused extension), if discard finds no Delete or Don't Save button, or if the Mac app is not running.`,
170603
- zodSchema: zodSchema84,
171344
+ zodSchema: zodSchema85,
170604
171345
  searchHint: "file panel dialog open save choose pick file folder nsopenpanel nssavepanel mac app",
170605
171346
  featureFlag: "macos-apps",
170606
171347
  interaction: {
@@ -170702,7 +171443,7 @@ function renderMenus(items, depth, lines) {
170702
171443
  if (item.items) renderMenus(item.items, depth + 1, lines);
170703
171444
  }
170704
171445
  }
170705
- var zodSchema85 = external_exports.object({
171446
+ var zodSchema86 = external_exports.object({
170706
171447
  udid: external_exports.string().describe("Mac app id from `list-devices` (macos-app-<bundle id>)."),
170707
171448
  action: external_exports.enum(["list", "choose"]).describe(
170708
171449
  "list: the app's menu bar, one line per item. choose: run one menu item, by path or identifier."
@@ -170718,7 +171459,7 @@ var menuBarTool = {
170718
171459
  Use when a command lives in the app's menus. Use keyboard instead for a shortcut you already know, and file-panel for the open or save panel that a command shows.
170719
171460
  list returns { menuBar }, one line per item indented under its menu: the title (a menu ends with " >"), [disabled] or [checked], the shortcut in keyboard syntax, and id="..." when the item has one. choose takes path (the titles from the menu bar down, e.g. ["File", "Export..."]) or identifier, and returns { chosen } with the path; the command runs right after the reply.
170720
171461
  Fails if no item matches (the error lists the titles at that level), if the item is disabled or is a menu, if a menu of the app is open, or if the device is not a Mac app.`,
170721
- zodSchema: zodSchema85,
171462
+ zodSchema: zodSchema86,
170722
171463
  searchHint: "menu bar main menu command item file edit view window help choose mac app",
170723
171464
  featureFlag: "macos-apps",
170724
171465
  interaction: {
@@ -170852,6 +171593,7 @@ function createRegistry() {
170852
171593
  registry2.registerTool(networkRequestTool);
170853
171594
  registry2.registerTool(createNetworkCaptureStartTool(registry2));
170854
171595
  registry2.registerTool(createNetworkCaptureStopTool(registry2));
171596
+ registry2.registerTool(createAwaitNetworkRequestTool(registry2));
170855
171597
  registry2.registerTool(createDescribeTool(registry2));
170856
171598
  registry2.registerTool(createUiTreeTool(registry2));
170857
171599
  registry2.registerTool(createForegroundAppTool(registry2));