@swmansion/argent 0.34.1-next.6 → 0.34.1-next.61

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.
Files changed (61) hide show
  1. package/LICENSE +1 -0
  2. package/assets/ios-screen-stream/Info.plist +12 -0
  3. package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
  4. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  5. package/bin/darwin/argent-macos-helper +0 -0
  6. package/bin/darwin/ax-service +0 -0
  7. package/bin/darwin/simulator-server +0 -0
  8. package/bin/darwin/tvos-ax-service +0 -0
  9. package/bin/darwin/tvos-hid-daemon +0 -0
  10. package/bin/linux/simulator-server +0 -0
  11. package/bin/linux-arm64/simulator-server +0 -0
  12. package/bin/network-inspector/network-inspector.jar +0 -0
  13. package/bin/tcp/ax-service +0 -0
  14. package/bin/win32/simulator-server.exe +0 -0
  15. package/dist/cli-cmds.mjs +914 -551
  16. package/dist/client.js +376 -180
  17. package/dist/flow-script-runner.mjs +1 -0
  18. package/dist/installer-help.js +4 -0
  19. package/dist/installer-help.js.map +1 -1
  20. package/dist/installer.mjs +1221 -923
  21. package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/xcshareddata/xcschemes/ArgentRunner.xcscheme +1 -0
  22. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
  23. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
  24. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession.swift +3 -0
  25. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/RunnerHTTPServer.swift +21 -9
  26. package/dist/mcp-server.mjs +593 -715
  27. package/dist/preview-ui/index.html +28 -2
  28. package/dist/tool-args.generated.d.ts +99 -31
  29. package/dist/tool-server.cjs +15753 -6244
  30. package/dylibs/libArgentAudio.dylib +0 -0
  31. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  32. package/dylibs/libKeyboardPatch.dylib +0 -0
  33. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  34. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  35. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  36. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  37. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  38. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  39. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  40. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  41. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  42. package/package.json +1 -1
  43. package/rules/argent.md +6 -23
  44. package/skills/argent-android-emulator-setup/SKILL.md +4 -4
  45. package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
  46. package/skills/argent-create-e2e/references/live-authoring.md +12 -1
  47. package/skills/argent-device-interact/SKILL.md +22 -21
  48. package/skills/argent-device-interact/references/foldables.md +22 -0
  49. package/skills/argent-ios-device-interact/SKILL.md +3 -3
  50. package/skills/argent-ios-device-setup/SKILL.md +4 -2
  51. package/skills/argent-macos-app-interact/SKILL.md +15 -5
  52. package/skills/argent-macos-app-interact/references/e2e.md +1 -1
  53. package/skills/argent-metro-debugger/SKILL.md +26 -14
  54. package/skills/argent-native-profiler/SKILL.md +14 -2
  55. package/skills/argent-react-native-app-workflow/SKILL.md +2 -2
  56. package/skills/argent-react-native-optimization/SKILL.md +10 -1
  57. package/skills/argent-react-native-optimization/references/fix-reference.md +10 -10
  58. package/skills/argent-react-native-profiler/SKILL.md +4 -3
  59. package/skills/argent-screen-recording/SKILL.md +6 -4
  60. package/skills/argent-screenshot-diff/SKILL.md +1 -1
  61. package/skills/argent-test-ui-flow/SKILL.md +1 -1
package/dist/client.js CHANGED
@@ -4390,10 +4390,10 @@ var require_resolve_block_map = __commonJS({
4390
4390
  let offset = bm.offset;
4391
4391
  let commentEnd = null;
4392
4392
  for (const collItem of bm.items) {
4393
- const { start, key, sep: sep6, value } = collItem;
4393
+ const { start, key, sep: sep7, value } = collItem;
4394
4394
  const keyProps = resolveProps.resolveProps(start, {
4395
4395
  indicator: "explicit-key-ind",
4396
- next: key ?? sep6?.[0],
4396
+ next: key ?? sep7?.[0],
4397
4397
  offset,
4398
4398
  onError,
4399
4399
  parentIndent: bm.indent,
@@ -4407,7 +4407,7 @@ var require_resolve_block_map = __commonJS({
4407
4407
  else if ("indent" in key && key.indent !== bm.indent)
4408
4408
  onError(offset, "BAD_INDENT", startColMsg);
4409
4409
  }
4410
- if (!keyProps.anchor && !keyProps.tag && !sep6) {
4410
+ if (!keyProps.anchor && !keyProps.tag && !sep7) {
4411
4411
  commentEnd = keyProps.end;
4412
4412
  if (keyProps.comment) {
4413
4413
  if (map.comment)
@@ -4431,7 +4431,7 @@ var require_resolve_block_map = __commonJS({
4431
4431
  ctx.atKey = false;
4432
4432
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
4433
4433
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
4434
- const valueProps = resolveProps.resolveProps(sep6 ?? [], {
4434
+ const valueProps = resolveProps.resolveProps(sep7 ?? [], {
4435
4435
  indicator: "map-value-ind",
4436
4436
  next: value,
4437
4437
  offset: keyNode.range[2],
@@ -4447,7 +4447,7 @@ var require_resolve_block_map = __commonJS({
4447
4447
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
4448
4448
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
4449
4449
  }
4450
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
4450
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep7, null, valueProps, onError);
4451
4451
  if (ctx.schema.compat)
4452
4452
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
4453
4453
  offset = valueNode.range[2];
@@ -4538,7 +4538,7 @@ var require_resolve_end = __commonJS({
4538
4538
  let comment = "";
4539
4539
  if (end) {
4540
4540
  let hasSpace = false;
4541
- let sep6 = "";
4541
+ let sep7 = "";
4542
4542
  for (const token of end) {
4543
4543
  const { source, type } = token;
4544
4544
  switch (type) {
@@ -4552,13 +4552,13 @@ var require_resolve_end = __commonJS({
4552
4552
  if (!comment)
4553
4553
  comment = cb;
4554
4554
  else
4555
- comment += sep6 + cb;
4556
- sep6 = "";
4555
+ comment += sep7 + cb;
4556
+ sep7 = "";
4557
4557
  break;
4558
4558
  }
4559
4559
  case "newline":
4560
4560
  if (comment)
4561
- sep6 += source;
4561
+ sep7 += source;
4562
4562
  hasSpace = true;
4563
4563
  break;
4564
4564
  default:
@@ -4601,18 +4601,18 @@ var require_resolve_flow_collection = __commonJS({
4601
4601
  let offset = fc.offset + fc.start.source.length;
4602
4602
  for (let i = 0; i < fc.items.length; ++i) {
4603
4603
  const collItem = fc.items[i];
4604
- const { start, key, sep: sep6, value } = collItem;
4604
+ const { start, key, sep: sep7, value } = collItem;
4605
4605
  const props = resolveProps.resolveProps(start, {
4606
4606
  flow: fcName,
4607
4607
  indicator: "explicit-key-ind",
4608
- next: key ?? sep6?.[0],
4608
+ next: key ?? sep7?.[0],
4609
4609
  offset,
4610
4610
  onError,
4611
4611
  parentIndent: fc.indent,
4612
4612
  startOnNewline: false
4613
4613
  });
4614
4614
  if (!props.found) {
4615
- if (!props.anchor && !props.tag && !sep6 && !value) {
4615
+ if (!props.anchor && !props.tag && !sep7 && !value) {
4616
4616
  if (i === 0 && props.comma)
4617
4617
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
4618
4618
  else if (i < fc.items.length - 1)
@@ -4666,8 +4666,8 @@ var require_resolve_flow_collection = __commonJS({
4666
4666
  }
4667
4667
  }
4668
4668
  }
4669
- if (!isMap && !sep6 && !props.found) {
4670
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
4669
+ if (!isMap && !sep7 && !props.found) {
4670
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep7, null, props, onError);
4671
4671
  coll.items.push(valueNode);
4672
4672
  offset = valueNode.range[2];
4673
4673
  if (isBlock(value))
@@ -4679,7 +4679,7 @@ var require_resolve_flow_collection = __commonJS({
4679
4679
  if (isBlock(key))
4680
4680
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
4681
4681
  ctx.atKey = false;
4682
- const valueProps = resolveProps.resolveProps(sep6 ?? [], {
4682
+ const valueProps = resolveProps.resolveProps(sep7 ?? [], {
4683
4683
  flow: fcName,
4684
4684
  indicator: "map-value-ind",
4685
4685
  next: value,
@@ -4690,8 +4690,8 @@ var require_resolve_flow_collection = __commonJS({
4690
4690
  });
4691
4691
  if (valueProps.found) {
4692
4692
  if (!isMap && !props.found && ctx.options.strict) {
4693
- if (sep6)
4694
- for (const st of sep6) {
4693
+ if (sep7)
4694
+ for (const st of sep7) {
4695
4695
  if (st === valueProps.found)
4696
4696
  break;
4697
4697
  if (st.type === "newline") {
@@ -4708,7 +4708,7 @@ var require_resolve_flow_collection = __commonJS({
4708
4708
  else
4709
4709
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
4710
4710
  }
4711
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
4711
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep7, null, valueProps, onError) : null;
4712
4712
  if (valueNode) {
4713
4713
  if (isBlock(value))
4714
4714
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -4888,7 +4888,7 @@ var require_resolve_block_scalar = __commonJS({
4888
4888
  chompStart = i + 1;
4889
4889
  }
4890
4890
  let value = "";
4891
- let sep6 = "";
4891
+ let sep7 = "";
4892
4892
  let prevMoreIndented = false;
4893
4893
  for (let i = 0; i < contentStart; ++i)
4894
4894
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -4905,24 +4905,24 @@ var require_resolve_block_scalar = __commonJS({
4905
4905
  indent = "";
4906
4906
  }
4907
4907
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
4908
- value += sep6 + indent.slice(trimIndent) + content;
4909
- sep6 = "\n";
4908
+ value += sep7 + indent.slice(trimIndent) + content;
4909
+ sep7 = "\n";
4910
4910
  } else if (indent.length > trimIndent || content[0] === " ") {
4911
- if (sep6 === " ")
4912
- sep6 = "\n";
4913
- else if (!prevMoreIndented && sep6 === "\n")
4914
- sep6 = "\n\n";
4915
- value += sep6 + indent.slice(trimIndent) + content;
4916
- sep6 = "\n";
4911
+ if (sep7 === " ")
4912
+ sep7 = "\n";
4913
+ else if (!prevMoreIndented && sep7 === "\n")
4914
+ sep7 = "\n\n";
4915
+ value += sep7 + indent.slice(trimIndent) + content;
4916
+ sep7 = "\n";
4917
4917
  prevMoreIndented = true;
4918
4918
  } else if (content === "") {
4919
- if (sep6 === "\n")
4919
+ if (sep7 === "\n")
4920
4920
  value += "\n";
4921
4921
  else
4922
- sep6 = "\n";
4922
+ sep7 = "\n";
4923
4923
  } else {
4924
- value += sep6 + content;
4925
- sep6 = " ";
4924
+ value += sep7 + content;
4925
+ sep7 = " ";
4926
4926
  prevMoreIndented = false;
4927
4927
  }
4928
4928
  }
@@ -5105,25 +5105,25 @@ var require_resolve_flow_scalar = __commonJS({
5105
5105
  trimBoth = /^[ \t]+|[ \t]+$/g;
5106
5106
  }
5107
5107
  let res = match[1].replace(trimEnd, "");
5108
- let sep6 = " ";
5108
+ let sep7 = " ";
5109
5109
  let pos = line.lastIndex;
5110
5110
  while (match = line.exec(source)) {
5111
5111
  const lm = match[1].replace(trimBoth, "");
5112
5112
  if (lm === "") {
5113
- if (sep6 === "\n")
5114
- res += sep6;
5113
+ if (sep7 === "\n")
5114
+ res += sep7;
5115
5115
  else
5116
- sep6 = "\n";
5116
+ sep7 = "\n";
5117
5117
  } else {
5118
- res += sep6 + lm;
5119
- sep6 = " ";
5118
+ res += sep7 + lm;
5119
+ sep7 = " ";
5120
5120
  }
5121
5121
  pos = line.lastIndex;
5122
5122
  }
5123
5123
  const last = /[ \t]*(.*)/sy;
5124
5124
  last.lastIndex = pos;
5125
5125
  match = last.exec(source);
5126
- return res + sep6 + (match?.[1] ?? "");
5126
+ return res + sep7 + (match?.[1] ?? "");
5127
5127
  }
5128
5128
  function doubleQuotedValue(source, onError) {
5129
5129
  let res = "";
@@ -5933,14 +5933,14 @@ var require_cst_stringify = __commonJS({
5933
5933
  }
5934
5934
  }
5935
5935
  }
5936
- function stringifyItem({ start, key, sep: sep6, value }) {
5936
+ function stringifyItem({ start, key, sep: sep7, value }) {
5937
5937
  let res = "";
5938
5938
  for (const st of start)
5939
5939
  res += st.source;
5940
5940
  if (key)
5941
5941
  res += stringifyToken(key);
5942
- if (sep6)
5943
- for (const st of sep6)
5942
+ if (sep7)
5943
+ for (const st of sep7)
5944
5944
  res += st.source;
5945
5945
  if (value)
5946
5946
  res += stringifyToken(value);
@@ -7107,18 +7107,18 @@ var require_parser = __commonJS({
7107
7107
  if (this.type === "map-value-ind") {
7108
7108
  const prev = getPrevProps(this.peek(2));
7109
7109
  const start = getFirstKeyStartProps(prev);
7110
- let sep6;
7110
+ let sep7;
7111
7111
  if (scalar.end) {
7112
- sep6 = scalar.end;
7113
- sep6.push(this.sourceToken);
7112
+ sep7 = scalar.end;
7113
+ sep7.push(this.sourceToken);
7114
7114
  delete scalar.end;
7115
7115
  } else
7116
- sep6 = [this.sourceToken];
7116
+ sep7 = [this.sourceToken];
7117
7117
  const map = {
7118
7118
  type: "block-map",
7119
7119
  offset: scalar.offset,
7120
7120
  indent: scalar.indent,
7121
- items: [{ start, key: scalar, sep: sep6 }]
7121
+ items: [{ start, key: scalar, sep: sep7 }]
7122
7122
  };
7123
7123
  this.onKeyLine = true;
7124
7124
  this.stack[this.stack.length - 1] = map;
@@ -7271,15 +7271,15 @@ var require_parser = __commonJS({
7271
7271
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
7272
7272
  const start2 = getFirstKeyStartProps(it.start);
7273
7273
  const key = it.key;
7274
- const sep6 = it.sep;
7275
- sep6.push(this.sourceToken);
7274
+ const sep7 = it.sep;
7275
+ sep7.push(this.sourceToken);
7276
7276
  delete it.key;
7277
7277
  delete it.sep;
7278
7278
  this.stack.push({
7279
7279
  type: "block-map",
7280
7280
  offset: this.offset,
7281
7281
  indent: this.indent,
7282
- items: [{ start: start2, key, sep: sep6 }]
7282
+ items: [{ start: start2, key, sep: sep7 }]
7283
7283
  });
7284
7284
  } else if (start.length > 0) {
7285
7285
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -7308,14 +7308,14 @@ var require_parser = __commonJS({
7308
7308
  case "scalar":
7309
7309
  case "single-quoted-scalar":
7310
7310
  case "double-quoted-scalar": {
7311
- const fs8 = this.flowScalar(this.type);
7311
+ const fs9 = this.flowScalar(this.type);
7312
7312
  if (atNextItem || it.value) {
7313
- map.items.push({ start, key: fs8, sep: [] });
7313
+ map.items.push({ start, key: fs9, sep: [] });
7314
7314
  this.onKeyLine = true;
7315
7315
  } else if (it.sep) {
7316
- this.stack.push(fs8);
7316
+ this.stack.push(fs9);
7317
7317
  } else {
7318
- Object.assign(it, { key: fs8, sep: [] });
7318
+ Object.assign(it, { key: fs9, sep: [] });
7319
7319
  this.onKeyLine = true;
7320
7320
  }
7321
7321
  return;
@@ -7443,13 +7443,13 @@ var require_parser = __commonJS({
7443
7443
  case "scalar":
7444
7444
  case "single-quoted-scalar":
7445
7445
  case "double-quoted-scalar": {
7446
- const fs8 = this.flowScalar(this.type);
7446
+ const fs9 = this.flowScalar(this.type);
7447
7447
  if (!it || it.value)
7448
- fc.items.push({ start: [], key: fs8, sep: [] });
7448
+ fc.items.push({ start: [], key: fs9, sep: [] });
7449
7449
  else if (it.sep)
7450
- this.stack.push(fs8);
7450
+ this.stack.push(fs9);
7451
7451
  else
7452
- Object.assign(it, { key: fs8, sep: [] });
7452
+ Object.assign(it, { key: fs9, sep: [] });
7453
7453
  return;
7454
7454
  }
7455
7455
  case "flow-map-end":
@@ -7473,13 +7473,13 @@ var require_parser = __commonJS({
7473
7473
  const prev = getPrevProps(parent);
7474
7474
  const start = getFirstKeyStartProps(prev);
7475
7475
  fixFlowSeqItems(fc);
7476
- const sep6 = fc.end.splice(1, fc.end.length);
7477
- sep6.push(this.sourceToken);
7476
+ const sep7 = fc.end.splice(1, fc.end.length);
7477
+ sep7.push(this.sourceToken);
7478
7478
  const map = {
7479
7479
  type: "block-map",
7480
7480
  offset: fc.offset,
7481
7481
  indent: fc.indent,
7482
- items: [{ start, key: fc, sep: sep6 }]
7482
+ items: [{ start, key: fc, sep: sep7 }]
7483
7483
  };
7484
7484
  this.onKeyLine = true;
7485
7485
  this.stack[this.stack.length - 1] = map;
@@ -7657,7 +7657,7 @@ var require_public_api = __commonJS({
7657
7657
  }
7658
7658
  return doc;
7659
7659
  }
7660
- function parse(src, reviver, options) {
7660
+ function parse2(src, reviver, options) {
7661
7661
  let _reviver = void 0;
7662
7662
  if (typeof reviver === "function") {
7663
7663
  _reviver = reviver;
@@ -7698,7 +7698,7 @@ var require_public_api = __commonJS({
7698
7698
  return value.toString(options);
7699
7699
  return new Document.Document(value, _replacer, options).toString(options);
7700
7700
  }
7701
- exports.parse = parse;
7701
+ exports.parse = parse2;
7702
7702
  exports.parseAllDocuments = parseAllDocuments;
7703
7703
  exports.parseDocument = parseDocument;
7704
7704
  exports.stringify = stringify;
@@ -7798,6 +7798,11 @@ var FLAG_REGISTRY = [
7798
7798
  name: "forward-secrets",
7799
7799
  description: "Over `argent link` or ARGENT_TOOLS_URL, resolve each `{{secret:NAME}}` a call names on this machine and send the value with the call, so a remote tool-server can type a secret it does not hold. The linked tool-server then receives every secret of this machine that a call names, so link only one you trust with all of them. Values go only over https:// with the certificate checked, or to a loopback address. Off by default."
7800
7800
  },
7801
+ {
7802
+ name: "ios-audio-always-inserted",
7803
+ description: "Insert the iOS audio hook (libArgentAudio.dylib) into every app an armed simulator launches, so audio-input works without restart-app. Dormant until the app opens audio. On by default; `argent disable ios-audio-always-inserted` inserts it only on the first audio tool call, for apps launched after that call.",
7804
+ defaultEnabled: true
7805
+ },
7801
7806
  {
7802
7807
  name: "video-watermark",
7803
7808
  description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
@@ -7805,7 +7810,7 @@ var FLAG_REGISTRY = [
7805
7810
  },
7806
7811
  {
7807
7812
  name: "macos-apps",
7808
- description: "Drive native Mac apps (AppKit, SwiftUI, react-native-macos) from inside the app. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
7813
+ description: "Control native Mac apps, including Mac Catalyst. Adds the macos platform to list-devices and boot-device, and the file-panel and menu-bar tools. On by default; turn it off with `argent disable macos-apps`.",
7809
7814
  defaultEnabled: true
7810
7815
  }
7811
7816
  ];
@@ -7875,6 +7880,7 @@ function isFeatureEnabled(name, options = {}, registry = FLAG_REGISTRY) {
7875
7880
  }
7876
7881
 
7877
7882
  // ../configuration-core/src/paths.ts
7883
+ import * as fs2 from "node:fs";
7878
7884
  import * as os from "node:os";
7879
7885
  import * as path2 from "node:path";
7880
7886
  function nonEmpty(value) {
@@ -7886,6 +7892,16 @@ function resolveHomeDir(options = {}) {
7886
7892
  if (options.homeDir) return options.homeDir;
7887
7893
  return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
7888
7894
  }
7895
+ function isHomeDir(dir, options = {}) {
7896
+ return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
7897
+ }
7898
+ function canonicalPath(p) {
7899
+ try {
7900
+ return fs2.realpathSync.native(p);
7901
+ } catch {
7902
+ return path2.resolve(p);
7903
+ }
7904
+ }
7889
7905
  function argentHomeDir() {
7890
7906
  return path2.join(resolveHomeDir(), ".argent");
7891
7907
  }
@@ -7902,11 +7918,11 @@ function configFilePath(scope = "global", options = {}) {
7902
7918
 
7903
7919
  // ../configuration-core/src/config.ts
7904
7920
  import * as crypto from "node:crypto";
7905
- import * as fs2 from "node:fs";
7921
+ import * as fs3 from "node:fs";
7906
7922
  import * as path3 from "node:path";
7907
7923
  function readConfigObject(scope = "global", options = {}) {
7908
7924
  try {
7909
- const raw = fs2.readFileSync(configFilePath(scope, options), "utf8");
7925
+ const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
7910
7926
  const json = JSON.parse(raw);
7911
7927
  if (json && typeof json === "object" && !Array.isArray(json)) {
7912
7928
  return json;
@@ -7943,7 +7959,7 @@ function getAtPath(obj, dottedKey) {
7943
7959
 
7944
7960
  // ../configuration-core/src/secrets.ts
7945
7961
  var import_dotenv = __toESM(require_dist(), 1);
7946
- import * as fs3 from "node:fs";
7962
+ import * as fs4 from "node:fs";
7947
7963
  import * as path4 from "node:path";
7948
7964
  var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
7949
7965
  var SECRETS_FILE_NAME = "secrets.env";
@@ -7973,10 +7989,10 @@ function fileSource(filePath, exposure) {
7973
7989
  names: [],
7974
7990
  values: /* @__PURE__ */ new Map()
7975
7991
  };
7976
- if (!fs3.statSync(filePath, { throwIfNoEntry: false })) return absent;
7992
+ if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
7977
7993
  let content;
7978
7994
  try {
7979
- content = fs3.readFileSync(filePath, "utf8");
7995
+ content = fs4.readFileSync(filePath, "utf8");
7980
7996
  } catch {
7981
7997
  return absent;
7982
7998
  }
@@ -8002,7 +8018,9 @@ function fileSource(filePath, exposure) {
8002
8018
  }
8003
8019
  function secretSources(options = {}) {
8004
8020
  const sources = [envSource(options.env ?? process.env)];
8005
- const projectRoot = findProjectRoot(options.cwd ?? process.cwd());
8021
+ const home = resolveHomeDir(options);
8022
+ const found = findProjectRoot(options.cwd ?? process.cwd());
8023
+ const projectRoot = found && isHomeDir(found, options) ? home : found;
8006
8024
  const filePaths = [];
8007
8025
  if (projectRoot) {
8008
8026
  filePaths.push({
@@ -8014,7 +8032,7 @@ function secretSources(options = {}) {
8014
8032
  }
8015
8033
  }
8016
8034
  filePaths.push({
8017
- path: path4.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME),
8035
+ path: path4.join(home, ".argent", SECRETS_FILE_NAME),
8018
8036
  exposure: "dedicated"
8019
8037
  });
8020
8038
  const seen = /* @__PURE__ */ new Set();
@@ -8136,14 +8154,6 @@ var CONFIG_SCHEMA = [
8136
8154
  // drained/reset, not just the file rewritten.
8137
8155
  manageCommand: "argent telemetry"
8138
8156
  },
8139
- {
8140
- key: "allowlist.enabled",
8141
- description: "Whether `argent update` re-applies editor auto-approve allowlist rules. Unset (the default) keeps the current behavior: update refreshes the rules for editors that already have argent configured. Set to `false` to keep update from touching editor allowlists. `false` in either scope wins, so a committed project opt-out holds for every teammate.",
8142
- scopes: ["project", "global"],
8143
- parse: asBoolean,
8144
- merge: "prioritize-restrictive",
8145
- example: "false"
8146
- },
8147
8157
  {
8148
8158
  key: "lens.agent",
8149
8159
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -8266,7 +8276,7 @@ var UnknownConfigKeyError = class extends Error {
8266
8276
 
8267
8277
  // ../argent-tools-client/src/launcher.ts
8268
8278
  import * as net from "node:net";
8269
- import * as fs4 from "node:fs";
8279
+ import * as fs5 from "node:fs";
8270
8280
  import * as path6 from "node:path";
8271
8281
  import * as readline from "node:readline";
8272
8282
  import { homedir as homedir3 } from "node:os";
@@ -8280,6 +8290,7 @@ var LOCK_FILE = path6.join(STATE_DIR, "tool-server.lock");
8280
8290
  var AUTH_TOKEN_BYTES = 32;
8281
8291
  var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
8282
8292
  var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
8293
+ var AUTOSPAWN_HOST = "127.0.0.1";
8283
8294
  function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8284
8295
  const env = {
8285
8296
  ...baseEnv,
@@ -8291,7 +8302,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8291
8302
  if (options.idleTimeoutMinutes !== void 0) {
8292
8303
  env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
8293
8304
  }
8294
- if (options.token) env[AUTH_TOKEN_ENV] = options.token;
8305
+ env[AUTH_TOKEN_ENV] = options.token ?? "";
8295
8306
  if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
8296
8307
  if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
8297
8308
  return env;
@@ -8300,7 +8311,7 @@ function generateToken() {
8300
8311
  return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
8301
8312
  }
8302
8313
  function findFreePort() {
8303
- return new Promise((resolve9, reject) => {
8314
+ return new Promise((resolve11, reject) => {
8304
8315
  const srv = net.createServer();
8305
8316
  srv.listen(0, "127.0.0.1", () => {
8306
8317
  const addr = srv.address();
@@ -8311,21 +8322,21 @@ function findFreePort() {
8311
8322
  const port = addr.port;
8312
8323
  srv.close((err) => {
8313
8324
  if (err) reject(err);
8314
- else resolve9(port);
8325
+ else resolve11(port);
8315
8326
  });
8316
8327
  });
8317
8328
  srv.on("error", reject);
8318
8329
  });
8319
8330
  }
8320
8331
  function isVersionNewer(a, b) {
8321
- const parse = (v) => {
8332
+ const parse2 = (v) => {
8322
8333
  const [core = "", ...preParts] = v.split("+")[0].split("-");
8323
8334
  const nums = core.split(".").map((n) => Number.parseInt(n, 10));
8324
8335
  if (nums.length === 0 || nums.some((n) => Number.isNaN(n))) return null;
8325
8336
  return { nums, pre: preParts.length > 0 ? preParts.join("-").split(".") : [] };
8326
8337
  };
8327
- const pa = parse(a);
8328
- const pb = parse(b);
8338
+ const pa = parse2(a);
8339
+ const pb = parse2(b);
8329
8340
  if (!pa || !pb) return false;
8330
8341
  for (let i = 0; i < 3; i++) {
8331
8342
  const x = pa.nums[i] ?? 0;
@@ -8353,7 +8364,7 @@ function isVersionNewer(a, b) {
8353
8364
  function readBundlePackageVersion(bundlePath) {
8354
8365
  try {
8355
8366
  const pkg = JSON.parse(
8356
- fs4.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
8367
+ fs5.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
8357
8368
  );
8358
8369
  return typeof pkg.version === "string" ? pkg.version : void 0;
8359
8370
  } catch {
@@ -8408,23 +8419,26 @@ function killSpawnedChild(child, pid) {
8408
8419
  }
8409
8420
  }
8410
8421
  }
8422
+ function resolveToolsServerNode() {
8423
+ const { bun, deno, electron } = process.versions;
8424
+ return !(bun || deno || electron) && fs5.existsSync(process.execPath) ? process.execPath : "node";
8425
+ }
8411
8426
  function spawnToolsServer(paths, port, options = {}) {
8412
- return new Promise((resolve9, reject) => {
8427
+ return new Promise((resolve11, reject) => {
8413
8428
  let logFd;
8414
8429
  try {
8415
- fs4.mkdirSync(STATE_DIR, { recursive: true });
8416
- logFd = fs4.openSync(LOG_FILE, "a");
8430
+ fs5.mkdirSync(STATE_DIR, { recursive: true });
8431
+ logFd = fs5.openSync(LOG_FILE, "a");
8417
8432
  } catch {
8418
- logFd = fs4.openSync("/dev/null", "w");
8433
+ logFd = fs5.openSync("/dev/null", "w");
8419
8434
  }
8420
- const { bun, deno, electron } = process.versions;
8421
- const nodeBin = !(bun || deno || electron) && fs4.existsSync(process.execPath) ? process.execPath : "node";
8435
+ const nodeBin = resolveToolsServerNode();
8422
8436
  const child = spawn(nodeBin, [paths.bundlePath, "start"], {
8423
8437
  detached: true,
8424
8438
  stdio: ["ignore", "pipe", logFd],
8425
8439
  env: buildToolsServerEnv(paths, port, process.env, options)
8426
8440
  });
8427
- fs4.closeSync(logFd);
8441
+ fs5.closeSync(logFd);
8428
8442
  child.unref();
8429
8443
  const pid = child.pid;
8430
8444
  if (!pid) {
@@ -8456,7 +8470,7 @@ function spawnToolsServer(paths, port, options = {}) {
8456
8470
  rl.close();
8457
8471
  child.stdout?.resume();
8458
8472
  child.stdout?.unref?.();
8459
- settle(() => resolve9({ port: actualPort, pid }));
8473
+ settle(() => resolve11({ port: actualPort, pid }));
8460
8474
  }
8461
8475
  });
8462
8476
  child.on("error", (err) => {
@@ -8551,7 +8565,7 @@ async function sweepDeadStateFiles() {
8551
8565
  });
8552
8566
  continue;
8553
8567
  }
8554
- if (fs4.existsSync(fresh.bundlePath)) continue;
8568
+ if (fs5.existsSync(fresh.bundlePath)) continue;
8555
8569
  if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
8556
8570
  await unlink(file).catch(() => {
8557
8571
  });
@@ -8598,7 +8612,7 @@ async function killToolServer(bundlePath) {
8598
8612
  await clearToolsServerState(bundlePath ?? state.bundlePath);
8599
8613
  return alive;
8600
8614
  }
8601
- var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs4.existsSync(p)) ?? "ps";
8615
+ var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs5.existsSync(p)) ?? "ps";
8602
8616
  var PS_WIDTH_FLAGS = ["-ww"];
8603
8617
  var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
8604
8618
  function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
@@ -8645,13 +8659,13 @@ var LOCK_STALE_MS = 45e3;
8645
8659
  var LOCK_POLL_MS = 100;
8646
8660
  function spawnLockIsStale() {
8647
8661
  try {
8648
- const { pid, ts } = JSON.parse(fs4.readFileSync(LOCK_FILE, "utf8"));
8662
+ const { pid, ts } = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
8649
8663
  if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
8650
8664
  if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS) return true;
8651
8665
  return false;
8652
8666
  } catch {
8653
8667
  try {
8654
- return Date.now() - fs4.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
8668
+ return Date.now() - fs5.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
8655
8669
  } catch {
8656
8670
  return true;
8657
8671
  }
@@ -8659,7 +8673,7 @@ function spawnLockIsStale() {
8659
8673
  }
8660
8674
  async function acquireSpawnLock() {
8661
8675
  try {
8662
- fs4.mkdirSync(STATE_DIR, { recursive: true });
8676
+ fs5.mkdirSync(STATE_DIR, { recursive: true });
8663
8677
  } catch {
8664
8678
  return null;
8665
8679
  }
@@ -8667,11 +8681,11 @@ async function acquireSpawnLock() {
8667
8681
  const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
8668
8682
  for (; ; ) {
8669
8683
  try {
8670
- const fd = fs4.openSync(LOCK_FILE, "wx");
8684
+ const fd = fs5.openSync(LOCK_FILE, "wx");
8671
8685
  try {
8672
- fs4.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
8686
+ fs5.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
8673
8687
  } finally {
8674
- fs4.closeSync(fd);
8688
+ fs5.closeSync(fd);
8675
8689
  }
8676
8690
  let released = false;
8677
8691
  return {
@@ -8679,8 +8693,8 @@ async function acquireSpawnLock() {
8679
8693
  if (released) return;
8680
8694
  released = true;
8681
8695
  try {
8682
- const cur = JSON.parse(fs4.readFileSync(LOCK_FILE, "utf8"));
8683
- if (cur.pid === process.pid && cur.nonce === nonce) fs4.unlinkSync(LOCK_FILE);
8696
+ const cur = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
8697
+ if (cur.pid === process.pid && cur.nonce === nonce) fs5.unlinkSync(LOCK_FILE);
8684
8698
  } catch {
8685
8699
  }
8686
8700
  }
@@ -8689,10 +8703,10 @@ async function acquireSpawnLock() {
8689
8703
  if (err.code !== "EEXIST") return null;
8690
8704
  if (spawnLockIsStale()) {
8691
8705
  try {
8692
- fs4.unlinkSync(LOCK_FILE);
8706
+ fs5.unlinkSync(LOCK_FILE);
8693
8707
  } catch {
8694
8708
  }
8695
- if (!fs4.existsSync(LOCK_FILE)) continue;
8709
+ if (!fs5.existsSync(LOCK_FILE)) continue;
8696
8710
  }
8697
8711
  if (Date.now() >= deadline) return null;
8698
8712
  await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
@@ -8732,7 +8746,7 @@ async function ensureToolsServer(paths) {
8732
8746
  }
8733
8747
  await clearToolsServerState(paths.bundlePath);
8734
8748
  await sweepDeadStateFiles();
8735
- if (!fs4.existsSync(paths.bundlePath)) {
8749
+ if (!fs5.existsSync(paths.bundlePath)) {
8736
8750
  throw new Error(
8737
8751
  `The argent install serving this session is gone from disk (${paths.bundlePath}) \u2014 it was likely updated or removed. Restart the editor's MCP connection to reconnect.`
8738
8752
  );
@@ -8742,6 +8756,7 @@ async function ensureToolsServer(paths) {
8742
8756
  const port = await findFreePort();
8743
8757
  const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
8744
8758
  token,
8759
+ host: AUTOSPAWN_HOST,
8745
8760
  idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
8746
8761
  });
8747
8762
  await writeState({
@@ -8750,11 +8765,11 @@ async function ensureToolsServer(paths) {
8750
8765
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
8751
8766
  bundlePath: paths.bundlePath,
8752
8767
  version: diskVersion,
8753
- host: "127.0.0.1",
8768
+ host: AUTOSPAWN_HOST,
8754
8769
  token,
8755
8770
  managed: "autospawn"
8756
8771
  });
8757
- return { url: formatUrl("127.0.0.1", actualPort), token };
8772
+ return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
8758
8773
  } finally {
8759
8774
  lock?.release();
8760
8775
  }
@@ -8796,7 +8811,18 @@ function interpolateFileInputPath(template, args) {
8796
8811
  });
8797
8812
  return missing ? null : out;
8798
8813
  }
8799
- var TOOL_FILE_EXTENSIONS = [".png", ".yaml"];
8814
+ var TOOL_FILE_EXTENSIONS = [
8815
+ ".png",
8816
+ ".yaml",
8817
+ ".wav",
8818
+ ".mp3",
8819
+ ".m4a",
8820
+ ".aac",
8821
+ ".caf",
8822
+ ".aif",
8823
+ ".aiff",
8824
+ ".flac"
8825
+ ];
8800
8826
  function hasToolFileExtension(file) {
8801
8827
  const name = file.toLowerCase();
8802
8828
  return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
@@ -8810,16 +8836,24 @@ function toolStepFiles(specs, args) {
8810
8836
  }
8811
8837
  return files;
8812
8838
  }
8839
+ var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][A-Za-z0-9+.-]+:/;
8840
+ function isUnexpandedPath(p) {
8841
+ return UNEXPANDED_PATH.test(p);
8842
+ }
8813
8843
  function isClientFileArgument({ spec, path: path14 }) {
8814
8844
  return spec.kind === "file" && spec.path === `\${${spec.target}}` && path14.startsWith("/") && hasToolFileExtension(path14);
8815
8845
  }
8816
8846
 
8847
+ // ../registry/src/flow-platforms.ts
8848
+ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
8849
+ var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
8850
+
8817
8851
  // ../registry/src/flow-file-refs.ts
8818
- import * as fs6 from "node:fs/promises";
8852
+ import * as fs7 from "node:fs/promises";
8819
8853
  import * as path8 from "node:path";
8820
8854
 
8821
8855
  // ../registry/src/e2e-dirs.ts
8822
- import * as fs5 from "node:fs/promises";
8856
+ import * as fs6 from "node:fs/promises";
8823
8857
  import * as path7 from "node:path";
8824
8858
  var E2E_DIR = path7.join(".argent", "e2e");
8825
8859
  var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
@@ -8834,7 +8868,7 @@ function e2eFileCandidates(projectRoot, name) {
8834
8868
  return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
8835
8869
  }
8836
8870
  async function exists(file) {
8837
- return fs5.stat(file).then(
8871
+ return fs6.stat(file).then(
8838
8872
  () => true,
8839
8873
  () => false
8840
8874
  );
@@ -8925,10 +8959,10 @@ function canonicalToolArgs(tool, args) {
8925
8959
  // ../registry/src/flow-file-refs.ts
8926
8960
  async function canonicalFlowPath(p) {
8927
8961
  try {
8928
- return await fs6.realpath(p);
8962
+ return await fs7.realpath(p);
8929
8963
  } catch {
8930
8964
  try {
8931
- return path8.join(await fs6.realpath(path8.dirname(p)), path8.basename(p));
8965
+ return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
8932
8966
  } catch {
8933
8967
  return p;
8934
8968
  }
@@ -8944,6 +8978,9 @@ var MAX_BLOCK_NESTING = 64;
8944
8978
  function isRecord(value) {
8945
8979
  return typeof value === "object" && value !== null && !Array.isArray(value);
8946
8980
  }
8981
+ function flowYamlSource(content) {
8982
+ return content.replace(/^\s+/, (lead) => lead.replace(/[^\n]/g, "")).trimEnd();
8983
+ }
8947
8984
  function collectFlowRequests(doc) {
8948
8985
  const runTargets = /* @__PURE__ */ new Set();
8949
8986
  const snapshots = /* @__PURE__ */ new Set();
@@ -8974,15 +9011,15 @@ function collectFlowRequests(doc) {
8974
9011
  if (isRecord(doc)) visit(doc.steps, 0);
8975
9012
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
8976
9013
  }
8977
- function baselineKeyFor(canonicalPath, flowName) {
8978
- const stem = path8.basename(canonicalPath, ".yaml");
9014
+ function baselineKeyFor(canonicalPath2, flowName) {
9015
+ const stem = path8.basename(canonicalPath2, ".yaml");
8979
9016
  return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
8980
9017
  }
8981
9018
  function flowMemberKey(anchorDir, target) {
8982
9019
  return `${anchorDir}\0${target}`;
8983
9020
  }
8984
9021
  async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
8985
- const entries = await fs6.readdir(dir).catch(() => null);
9022
+ const entries = await fs7.readdir(dir).catch(() => null);
8986
9023
  if (entries === null || entries.includes(base)) return { state: "listed" };
8987
9024
  const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
8988
9025
  if (actual === void 0) return { state: "absent" };
@@ -9092,6 +9129,10 @@ var FAILURE_CODES = {
9092
9129
  ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
9093
9130
  ANDROID_ADB_BOOT_TERMINAL_STATE: "ANDROID_ADB_BOOT_TERMINAL_STATE",
9094
9131
  ANDROID_ADB_BOOT_TIMEOUT: "ANDROID_ADB_BOOT_TIMEOUT",
9132
+ ANDROID_NETWORK_PROXY_TIMEOUT: "ANDROID_NETWORK_PROXY_TIMEOUT",
9133
+ ANDROID_NETWORK_RESTORE_TIMEOUT: "ANDROID_NETWORK_RESTORE_TIMEOUT",
9134
+ ANDROID_OFFLINE_TIMEOUT: "ANDROID_OFFLINE_TIMEOUT",
9135
+ ANDROID_OFFLINE_UNSUPPORTED: "ANDROID_OFFLINE_UNSUPPORTED",
9095
9136
  SIMULATOR_NETWORK_TIMEOUT: "SIMULATOR_NETWORK_TIMEOUT",
9096
9137
  SIMULATOR_NETWORK_CONNECTION_REFUSED: "SIMULATOR_NETWORK_CONNECTION_REFUSED",
9097
9138
  SIMULATOR_NETWORK_CONNECTION_RESET: "SIMULATOR_NETWORK_CONNECTION_RESET",
@@ -9211,12 +9252,15 @@ var FAILURE_CODES = {
9211
9252
  DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
9212
9253
  DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
9213
9254
  DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
9255
+ DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
9214
9256
  DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
9215
9257
  DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
9216
9258
  DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
9217
9259
  DEBUGGER_TARGET_DEVICE_MISMATCH: "DEBUGGER_TARGET_DEVICE_MISMATCH",
9218
9260
  DEBUGGER_EVALUATE_EXPRESSION_THREW: "DEBUGGER_EVALUATE_EXPRESSION_THREW",
9219
9261
  DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
9262
+ // e2e-add-step refused a debugger-* call that answered `not_connected`.
9263
+ DEBUGGER_NOT_CONNECTED: "DEBUGGER_NOT_CONNECTED",
9220
9264
  JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
9221
9265
  JS_RUNTIME_PAYLOAD_INVALID: "JS_RUNTIME_PAYLOAD_INVALID",
9222
9266
  JS_RUNTIME_PAYLOAD_DEVICE_MISSING: "JS_RUNTIME_PAYLOAD_DEVICE_MISSING",
@@ -9230,7 +9274,7 @@ var FAILURE_CODES = {
9230
9274
  ANDROID_NETWORK_INSPECTOR_RUN_AS_FAILED: "ANDROID_NETWORK_INSPECTOR_RUN_AS_FAILED",
9231
9275
  ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE: "ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE",
9232
9276
  ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT: "ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT",
9233
- NATIVE_NETWORK_LOGS_STOP_UNSUPPORTED: "NATIVE_NETWORK_LOGS_STOP_UNSUPPORTED",
9277
+ NETWORK_CAPTURE_UNAVAILABLE: "NETWORK_CAPTURE_UNAVAILABLE",
9234
9278
  NDJSON_CDP_REQUEST_TIMEOUT: "NDJSON_CDP_REQUEST_TIMEOUT",
9235
9279
  NDJSON_CDP_REQUEST_FAILED: "NDJSON_CDP_REQUEST_FAILED",
9236
9280
  NDJSON_CDP_CONNECTION_CLOSED: "NDJSON_CDP_CONNECTION_CLOSED",
@@ -9285,6 +9329,32 @@ var FAILURE_CODES = {
9285
9329
  NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
9286
9330
  NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
9287
9331
  NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
9332
+ /**
9333
+ * native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
9334
+ * devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
9335
+ * @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
9336
+ */
9337
+ // Not macOS, or an Xcode that cannot record the launch on this target.
9338
+ LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
9339
+ // No usable iPhone or simulator was selected, or Argent's runner holds it.
9340
+ LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
9341
+ // The bundle_id app is not installed on the selected device.
9342
+ LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
9343
+ // The runner's xcodebuild failed on code signing or provisioning.
9344
+ LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
9345
+ // The iPhone's free developer profile has no slot for Argent's runner.
9346
+ LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
9347
+ // simctl could not wait for boot, find, launch or terminate the app.
9348
+ LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
9349
+ LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
9350
+ // xctrace could not export the TOC, the CPU samples or the first-frame marker.
9351
+ LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
9352
+ // The App Launch trace has no first frame of the app, so it has no launch window.
9353
+ LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
9354
+ // The XCTest launch run of Argent's runner failed.
9355
+ LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
9356
+ // The launch test ran, but Argent read no launch measurements from its result.
9357
+ LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
9288
9358
  // iOS and Android share one capture path (simulator-server frames into
9289
9359
  // ffmpeg), so these name the failing stage, not the device family.
9290
9360
  SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
@@ -9299,6 +9369,19 @@ var FAILURE_CODES = {
9299
9369
  SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
9300
9370
  SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
9301
9371
  SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
9372
+ // A cabled iPhone has no simulator-server: its frames come from a host-side
9373
+ // CoreMediaIO capture helper, which can fail in ways of its own.
9374
+ SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
9375
+ SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
9376
+ SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
9377
+ SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
9378
+ AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
9379
+ AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
9380
+ AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
9381
+ AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
9382
+ AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
9383
+ AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
9384
+ AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
9302
9385
  FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
9303
9386
  FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
9304
9387
  FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
@@ -9362,6 +9445,8 @@ var FAILURE_CODES = {
9362
9445
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
9363
9446
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
9364
9447
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
9448
+ /** The app's loaded Argent library lacks support for the requested operation. */
9449
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
9365
9450
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
9366
9451
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
9367
9452
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -9548,7 +9633,7 @@ import { spawn as spawn2 } from "node:child_process";
9548
9633
  import { once } from "node:events";
9549
9634
  import { createReadStream, createWriteStream } from "node:fs";
9550
9635
  import { open, rm, readdir as readdir3 } from "node:fs/promises";
9551
- import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
9636
+ import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
9552
9637
  import { Writable } from "node:stream";
9553
9638
  import { pipeline } from "node:stream/promises";
9554
9639
  import zlib from "node:zlib";
@@ -9646,7 +9731,7 @@ async function sniffFormat(archivePath) {
9646
9731
  }
9647
9732
  }
9648
9733
  var ZSTD_FRAME_MAGIC = 4247762216;
9649
- async function assertSingleCompleteZstdFrame(archivePath) {
9734
+ async function assertSingleCompleteZstdFrame(archivePath, signal) {
9650
9735
  const fh = await open(archivePath, "r");
9651
9736
  try {
9652
9737
  const { size } = await fh.stat();
@@ -9656,6 +9741,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
9656
9741
  let pos = 0;
9657
9742
  const read = async (n) => {
9658
9743
  if (pos < windowStart || pos + n > windowEnd) {
9744
+ signal?.throwIfAborted();
9659
9745
  const { bytesRead } = await fh.read(window, 0, window.length, pos);
9660
9746
  windowStart = pos;
9661
9747
  windowEnd = pos + bytesRead;
@@ -9693,14 +9779,16 @@ function tarEnv(env) {
9693
9779
  const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
9694
9780
  return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
9695
9781
  }
9696
- async function runTar(archive, args) {
9782
+ async function runTar(archive, args, signal) {
9697
9783
  const child = spawn2("tar", [...args, "-f", "-"], {
9784
+ signal,
9698
9785
  env: tarEnv(process.env)
9699
9786
  });
9700
- const exited = new Promise((res, rej) => {
9701
- child.on("error", rej);
9702
- child.on("close", res);
9787
+ let childError;
9788
+ child.on("error", (err) => {
9789
+ childError = err;
9703
9790
  });
9791
+ const closed = new Promise((resolve11) => child.once("close", resolve11));
9704
9792
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
9705
9793
  maxLines: MAX_LISTING_LINES,
9706
9794
  onOverflow: () => child.kill()
@@ -9727,12 +9815,15 @@ async function runTar(archive, args) {
9727
9815
  if (err) child.stdin?.destroy();
9728
9816
  done(err);
9729
9817
  }
9730
- })
9818
+ }),
9819
+ { signal }
9731
9820
  ).then(
9732
9821
  () => null,
9733
9822
  (err) => err
9734
9823
  );
9735
- const [code, feedError] = await Promise.all([exited, fed]);
9824
+ const [code, feedError] = await Promise.all([closed, fed]);
9825
+ signal?.throwIfAborted();
9826
+ if (childError) throw childError;
9736
9827
  if (stdout.overflowed()) {
9737
9828
  throw new Error(
9738
9829
  `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
@@ -9754,24 +9845,25 @@ function isContainedPath(path14, windows = process.platform === "win32") {
9754
9845
  function isSafeTarMember(memberPath, destDir) {
9755
9846
  const normalized = normalizeTarMemberPath(memberPath);
9756
9847
  if (!isContainedPath(normalized)) return false;
9757
- const root = resolve6(destDir);
9758
- return resolve6(destDir, normalized).startsWith(root + sep2);
9848
+ const root = resolve7(destDir);
9849
+ return resolve7(destDir, normalized).startsWith(root + sep2);
9759
9850
  }
9760
- async function readListing(archive, args) {
9851
+ async function readListing(archive, args, signal) {
9761
9852
  try {
9762
- return await runTar(archive, args);
9853
+ return await runTar(archive, args, signal);
9763
9854
  } catch (err) {
9855
+ signal?.throwIfAborted();
9764
9856
  throw new ArchiveError(
9765
9857
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
9766
9858
  );
9767
9859
  }
9768
9860
  }
9769
- async function listTarMembers(archive) {
9770
- const stdout = await readListing(archive, ["-t"]);
9861
+ async function listTarMembers(archive, signal) {
9862
+ const stdout = await readListing(archive, ["-t"], signal);
9771
9863
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
9772
9864
  }
9773
- async function assertSafeMemberTypes(archive) {
9774
- const stdout = await readListing(archive, ["-tv"]);
9865
+ async function assertSafeMemberTypes(archive, signal) {
9866
+ const stdout = await readListing(archive, ["-tv"], signal);
9775
9867
  for (const line of stdout.split("\n")) {
9776
9868
  if (!line.trim()) continue;
9777
9869
  const type = line[0];
@@ -9791,8 +9883,8 @@ async function assertSafeMemberTypes(archive) {
9791
9883
  );
9792
9884
  }
9793
9885
  }
9794
- async function assertSafeArchive(archive, destDir) {
9795
- const members = await listTarMembers(archive);
9886
+ async function assertSafeArchive(archive, destDir, signal) {
9887
+ const members = await listTarMembers(archive, signal);
9796
9888
  if (members.length === 0) {
9797
9889
  throw new ArchiveError("Archive is empty.");
9798
9890
  }
@@ -9801,7 +9893,7 @@ async function assertSafeArchive(archive, destDir) {
9801
9893
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
9802
9894
  }
9803
9895
  }
9804
- await assertSafeMemberTypes(archive);
9896
+ await assertSafeMemberTypes(archive, signal);
9805
9897
  }
9806
9898
  async function resolveMember(destDir, expectedName) {
9807
9899
  const entries = await readdir3(destDir);
@@ -9816,19 +9908,24 @@ async function resolveMember(destDir, expectedName) {
9816
9908
  }
9817
9909
  return join9(destDir, real[0]);
9818
9910
  }
9819
- async function safeExtractArchive(archivePath, destDir, expectedName) {
9911
+ async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
9912
+ signal?.throwIfAborted();
9820
9913
  let archive;
9821
9914
  try {
9822
9915
  archive = { path: archivePath, format: await sniffFormat(archivePath) };
9823
- if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
9916
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
9824
9917
  } catch (err) {
9918
+ signal?.throwIfAborted();
9825
9919
  throw new ArchiveError(
9826
9920
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
9827
9921
  );
9828
9922
  }
9829
- await assertSafeArchive(archive, destDir);
9830
- await runTar(archive, ["-x", "-C", destDir]);
9831
- return resolveMember(destDir, expectedName);
9923
+ await assertSafeArchive(archive, destDir, signal);
9924
+ signal?.throwIfAborted();
9925
+ await runTar(archive, ["-x", "-C", destDir], signal);
9926
+ const member = await resolveMember(destDir, expectedName);
9927
+ signal?.throwIfAborted();
9928
+ return member;
9832
9929
  }
9833
9930
 
9834
9931
  // ../argent-tools-client/src/errors.ts
@@ -9861,6 +9958,22 @@ function interpolatePath(template, args) {
9861
9958
  });
9862
9959
  return missing ? null : out;
9863
9960
  }
9961
+ function callerPath(p) {
9962
+ const onCurrentDrive = path10.sep === "\\" && /^[\\/](?![\\/])/.test(p);
9963
+ if (!onCurrentDrive && (path10.isAbsolute(p) || path10.win32.isAbsolute(p) || isUnexpandedPath(p))) {
9964
+ return p;
9965
+ }
9966
+ const { root } = path10.parse(p);
9967
+ const rest = p.slice(root.length);
9968
+ if (!rest.split(/[\\/]/).includes("..")) {
9969
+ const resolved = path10.resolve(p);
9970
+ const last = p.split(path10.sep === "\\" ? /[\\/]/ : "/").at(-1);
9971
+ const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path10.sep);
9972
+ return dirOnly ? `${resolved}${path10.sep}` : resolved;
9973
+ }
9974
+ const base = path10.resolve(root);
9975
+ return base.endsWith(path10.sep) ? `${base}${rest}` : `${base}${path10.sep}${rest}`;
9976
+ }
9864
9977
  async function specPath(spec, args) {
9865
9978
  if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
9866
9979
  const candidates = [];
@@ -9905,10 +10018,10 @@ function untrackArchive(archive) {
9905
10018
  for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
9906
10019
  process.removeListener("exit", removePendingArchives);
9907
10020
  }
9908
- function sha256File(filePath) {
9909
- return new Promise((resolve9, reject) => {
10021
+ function sha256File(filePath, signal) {
10022
+ return new Promise((resolve11, reject) => {
9910
10023
  const hash = createHash2("sha256");
9911
- createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
10024
+ createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve11(hash.digest("hex"))).on("error", reject);
9912
10025
  });
9913
10026
  }
9914
10027
  function toolServerError(text) {
@@ -9971,7 +10084,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
9971
10084
  trackArchive(tarPath);
9972
10085
  try {
9973
10086
  await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
9974
- const contentHash = await sha256File(tarPath);
10087
+ const contentHash = await sha256File(tarPath, signal);
9975
10088
  return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
9976
10089
  } finally {
9977
10090
  untrackArchive(tarPath);
@@ -10006,13 +10119,21 @@ async function prepareFileInputs(specs, args, opts) {
10006
10119
  return args;
10007
10120
  }
10008
10121
  const record = args;
10009
- let out = null;
10122
+ const planned = [];
10123
+ const callArgs = { ...record };
10010
10124
  for (const spec of specs) {
10011
10125
  if (spec.skipWhenSet && record[spec.skipWhenSet] !== void 0) continue;
10012
10126
  if (spec.target in record && typeof record[spec.target] !== "string") continue;
10013
- const filePath = await specPath(spec, record);
10014
- if (filePath === null) continue;
10015
- if (spec.target in record && record[spec.target] !== filePath) continue;
10127
+ const spelled = await specPath(spec, record);
10128
+ if (spelled === null) continue;
10129
+ if (spec.target in record && record[spec.target] !== spelled) continue;
10130
+ const filePath = callerPath(spelled);
10131
+ planned.push({ spec, filePath });
10132
+ if (spec.target in record) callArgs[spec.target] = filePath;
10133
+ }
10134
+ if (planned.length === 0) return args;
10135
+ const out = { ...record };
10136
+ for (const { spec, filePath } of planned) {
10016
10137
  const wire = { [FILE_INPUT_MARKER2]: true, path: filePath };
10017
10138
  if (spec.kind === "file") {
10018
10139
  const read = await readFileInputWire(filePath, { includeContent: opts.includeContent });
@@ -10020,12 +10141,12 @@ async function prepareFileInputs(specs, args, opts) {
10020
10141
  if (spec.collect === "flow" && opts.includeContent && wire.content !== void 0 && opts.collectMembers) {
10021
10142
  Object.assign(
10022
10143
  wire,
10023
- await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"), record, opts)
10144
+ await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"), callArgs, opts)
10024
10145
  );
10025
10146
  }
10026
10147
  }
10027
10148
  if (spec.kind === "probe" && spec.collect === "step" && opts.includeContent && opts.collectStepMembers) {
10028
- wire.members = await opts.collectStepMembers(record, opts);
10149
+ wire.members = await opts.collectStepMembers(callArgs, opts);
10029
10150
  }
10030
10151
  if (spec.kind === "tar-upload") {
10031
10152
  const st = await stat3(filePath).catch(() => null);
@@ -10039,10 +10160,9 @@ async function prepareFileInputs(specs, args, opts) {
10039
10160
  Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
10040
10161
  }
10041
10162
  }
10042
- out = out ?? { ...record };
10043
10163
  out[spec.target] = wire;
10044
10164
  }
10045
- return out ?? args;
10165
+ return out;
10046
10166
  }
10047
10167
  function isAllowedClientFilePath(p) {
10048
10168
  if (!path10.isAbsolute(p)) return false;
@@ -10406,7 +10526,7 @@ function memberCollector(roots, opts) {
10406
10526
  for (let file = files.shift(); file !== void 0; file = files.shift()) {
10407
10527
  let doc;
10408
10528
  try {
10409
- doc = (0, import_yaml.parse)(file.text.trim(), { logLevel: "error" });
10529
+ doc = (0, import_yaml.parse)(flowYamlSource(file.text), { logLevel: "error" });
10410
10530
  } catch {
10411
10531
  continue;
10412
10532
  }
@@ -10521,7 +10641,7 @@ function recordedStep(args) {
10521
10641
  async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
10522
10642
  const { name, project_root: projectRoot } = args;
10523
10643
  const step = recordedStep(args);
10524
- if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !path11.isAbsolute(projectRoot) || step === void 0) {
10644
+ if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
10525
10645
  return [];
10526
10646
  }
10527
10647
  const recording = path11.join(recordingDirFor(projectRoot), `${name}.yaml`);
@@ -10607,7 +10727,10 @@ async function stepForOlderServer(args, listedId) {
10607
10727
  async function e2eShadowWarningFor(tool, args) {
10608
10728
  const id = canonicalToolId(tool);
10609
10729
  if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return void 0;
10610
- const target = nestedFlowTarget(args);
10730
+ const root = args?.project_root;
10731
+ const target = nestedFlowTarget(
10732
+ typeof root === "string" ? { ...args, project_root: callerPath(root) } : args
10733
+ );
10611
10734
  if (target?.kind !== "name") return void 0;
10612
10735
  const picked = await pickE2eFile(target.paths);
10613
10736
  return picked.shadowed === void 0 ? void 0 : e2eShadowWarning(picked.path, picked.shadowed);
@@ -10725,6 +10848,34 @@ function assertRequiredPresent(meta, args) {
10725
10848
  describeParamIssues({ issues }, record)
10726
10849
  );
10727
10850
  }
10851
+ var MAX_NON_FINITE_ISSUES = 12;
10852
+ function assertFiniteNumbers(args) {
10853
+ const issues = [];
10854
+ const seen = /* @__PURE__ */ new WeakSet();
10855
+ const pending = [{ value: args, key: "" }];
10856
+ for (let i = 0; i < pending.length && issues.length < MAX_NON_FINITE_ISSUES; i++) {
10857
+ const visit = pending[i];
10858
+ const { value } = visit;
10859
+ if (typeof value !== "object" || value === null || seen.has(value)) continue;
10860
+ seen.add(value);
10861
+ for (const [key, item] of Array.isArray(value) ? value.entries() : Object.entries(value)) {
10862
+ if (typeof item === "object" && item !== null) {
10863
+ pending.push({ value: item, key, parent: visit });
10864
+ } else if (typeof item === "number" && !Number.isFinite(item)) {
10865
+ const path14 = [key];
10866
+ for (let at = visit; at.parent; at = at.parent) path14.push(at.key);
10867
+ path14.reverse();
10868
+ issues.push({ code: "invalid_type", path: path14, message: `expected a number, got ${item}` });
10869
+ if (issues.length === MAX_NON_FINITE_ISSUES) break;
10870
+ }
10871
+ }
10872
+ }
10873
+ if (issues.length === 0) return;
10874
+ throw new ToolInvocationError(
10875
+ describeParamIssues({ issues }, args),
10876
+ { errorKind: "validation", issues }
10877
+ );
10878
+ }
10728
10879
  function fetchFailure(err) {
10729
10880
  if (!(err instanceof Error)) return String(err);
10730
10881
  return err.cause instanceof Error ? `${err.message}: ${err.cause.message}` : err.message;
@@ -10771,7 +10922,7 @@ async function forwardedSecrets(args) {
10771
10922
  }
10772
10923
  let parsed;
10773
10924
  try {
10774
- parsed = text === void 0 ? void 0 : (0, import_yaml2.parse)(text.trim(), { logLevel: "error" });
10925
+ parsed = text === void 0 ? void 0 : (0, import_yaml2.parse)(flowYamlSource(text), { logLevel: "error" });
10775
10926
  } catch {
10776
10927
  continue;
10777
10928
  }
@@ -10802,6 +10953,34 @@ function secretsTransportRefusal(url) {
10802
10953
  return void 0;
10803
10954
  }
10804
10955
  var FETCH_HEAD_BYTES = 256;
10956
+ function isRecord2(value) {
10957
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10958
+ }
10959
+ var PROJECT_PATH_ADVICE = {
10960
+ project_root: "Pass the absolute path to the project root directory - the same cwd the calling agent is working in.",
10961
+ e2e_test_path: "Pass the absolute path to the e2e test file."
10962
+ };
10963
+ function assertAbsoluteProjectPaths(meta, args) {
10964
+ if (!meta || !isRecord2(args)) return;
10965
+ const aliases = Object.entries(toolParamAliases(meta.name));
10966
+ for (const [param, advice] of Object.entries(PROJECT_PATH_ADVICE)) {
10967
+ const value = args[param];
10968
+ if (typeof value !== "string" || callerPath(value) === value) continue;
10969
+ const names = [param, ...aliases.filter(([, current]) => current === param).map(([f]) => f)];
10970
+ if (!meta.fileInputs?.some((spec) => names.some((n) => spec.path.includes(`\${${n}}`)))) {
10971
+ continue;
10972
+ }
10973
+ throw new Error(`${param} must be an absolute path (got "${value}"). ${advice}`);
10974
+ }
10975
+ }
10976
+ function failedRun(result) {
10977
+ if (!isRecord2(result)) return result;
10978
+ if (result.ok === true) return { ...result, ok: false };
10979
+ if (isRecord2(result.toolResult) && result.toolResult.ok === true) {
10980
+ return { ...result, toolResult: { ...result.toolResult, ok: false } };
10981
+ }
10982
+ return result;
10983
+ }
10805
10984
  function createToolsClient(options = {}) {
10806
10985
  let cached = null;
10807
10986
  const doFetch = options.fetchImpl ?? ((url, init) => fetch(url, init));
@@ -10846,10 +11025,12 @@ function createToolsClient(options = {}) {
10846
11025
  }
10847
11026
  async function callTool(name, args, opts) {
10848
11027
  opts?.signal?.throwIfAborted();
11028
+ assertFiniteNumbers(args);
10849
11029
  const { url, token, remote } = await route();
10850
11030
  let finalArgs = canonicalToolArgs(name, args);
10851
11031
  const { tools, uploadFormats } = await fetchToolList({ signal: opts?.signal });
10852
11032
  const meta = findTool(tools, name);
11033
+ if (options.refuseRelativeProjectPaths) assertAbsoluteProjectPaths(meta, finalArgs);
10853
11034
  const olderServer = meta !== null && !tools.some((t) => t.name === canonicalToolId(meta.name));
10854
11035
  if (meta) {
10855
11036
  finalArgs = await nameToE2ePathForOlderServer(meta.name, meta.fileInputs, finalArgs);
@@ -10887,7 +11068,7 @@ function createToolsClient(options = {}) {
10887
11068
  }
10888
11069
  }
10889
11070
  }
10890
- const result = applied.result;
11071
+ const result = applied.failed.length > 0 ? failedRun(applied.result) : applied.result;
10891
11072
  if (shadowWarning === void 0 || typeof result !== "object" || result === null || Array.isArray(result) || typeof result.warning === "string") {
10892
11073
  return result;
10893
11074
  }
@@ -11014,10 +11195,19 @@ function createToolsClient(options = {}) {
11014
11195
  }
11015
11196
 
11016
11197
  // ../argent-tools-client/src/artifacts.ts
11017
- import { copyFile, mkdir as mkdir4, readFile as readFile6, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
11198
+ import {
11199
+ copyFile,
11200
+ mkdir as mkdir4,
11201
+ mkdtemp,
11202
+ readFile as readFile6,
11203
+ realpath as realpath4,
11204
+ rm as rm3,
11205
+ stat as stat5,
11206
+ writeFile as writeFile4
11207
+ } from "node:fs/promises";
11018
11208
  import { constants as fsConstants } from "node:fs";
11019
11209
  import { tmpdir as tmpdir2 } from "node:os";
11020
- import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve8, sep as sep4 } from "node:path";
11210
+ import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve10, sep as sep5 } from "node:path";
11021
11211
  import { createHash as createHash3 } from "node:crypto";
11022
11212
  var ARTIFACT_MARKER2 = "__argentArtifact";
11023
11213
  function isArtifactHandle(value) {
@@ -11065,8 +11255,8 @@ function configuredRecordingsDir() {
11065
11255
  const trimmed = value.trim();
11066
11256
  if (trimmed === "") return null;
11067
11257
  const home = dirname9(argentHomeDir());
11068
- const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
11069
- return resolve8(durableBaseDir(), expanded);
11258
+ const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join13(home, trimmed.slice(2)) : trimmed;
11259
+ return resolve10(durableBaseDir(), expanded);
11070
11260
  }
11071
11261
  var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
11072
11262
  async function readCapped(res, cap) {
@@ -11113,7 +11303,7 @@ async function writeDurableUnique(dir, filename, write) {
11113
11303
  function durableSaveTarget(handle) {
11114
11304
  if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
11115
11305
  const rel = normalize2(handle.saveDir);
11116
- if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep4}`) || rel.split(sep4).includes("..")) {
11306
+ if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep5}`) || rel.split(sep5).includes("..")) {
11117
11307
  return null;
11118
11308
  }
11119
11309
  if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
@@ -11158,16 +11348,22 @@ async function resolveLocalFile(handle) {
11158
11348
  return null;
11159
11349
  }
11160
11350
  }
11161
- async function downloadAndExtractArchive(handle, data, dir) {
11162
- const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
11351
+ async function downloadAndExtractArchive(handle, data, dir, signal) {
11352
+ signal?.throwIfAborted();
11353
+ const attemptDir = await mkdtemp(join13(dir, "bundle-"));
11354
+ const tarball = join13(attemptDir, "download.tar");
11355
+ const extractDir = join13(attemptDir, "files");
11163
11356
  try {
11164
- await writeFile4(tarball, data);
11165
- return await safeExtractArchive(tarball, dir, handle.filename);
11357
+ await writeFile4(tarball, data, { signal });
11358
+ await mkdir4(extractDir);
11359
+ const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
11360
+ await rm3(tarball);
11361
+ signal?.throwIfAborted();
11362
+ return member;
11166
11363
  } catch {
11167
- return null;
11168
- } finally {
11169
- await rm3(tarball, { force: true }).catch(() => {
11364
+ await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
11170
11365
  });
11366
+ return null;
11171
11367
  }
11172
11368
  }
11173
11369
  async function materializeArtifacts(result, ctx) {
@@ -11253,7 +11449,7 @@ async function materializeArtifacts(result, ctx) {
11253
11449
  if (!data) return null;
11254
11450
  await ensureDir();
11255
11451
  if (value.archive === "tar.gz") {
11256
- return await downloadAndExtractArchive(value, data, dir);
11452
+ return await downloadAndExtractArchive(value, data, dir, ctx.signal);
11257
11453
  }
11258
11454
  if (value.size > 0 && data.length !== value.size) return null;
11259
11455
  const downloadedPath = join13(dir, sanitizeSegment(value.filename));
@@ -11290,12 +11486,12 @@ function getDeviceIdFromArgs(args) {
11290
11486
  }
11291
11487
 
11292
11488
  // src/bundled-paths.ts
11293
- import * as fs7 from "node:fs";
11489
+ import * as fs8 from "node:fs";
11294
11490
  import * as path13 from "node:path";
11295
11491
  function readPackageVersion() {
11296
11492
  try {
11297
11493
  const pkg = JSON.parse(
11298
- fs7.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
11494
+ fs8.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
11299
11495
  );
11300
11496
  return pkg.version;
11301
11497
  } catch {
@@ -11306,9 +11502,9 @@ var PACKAGE_NAME = "@swmansion/argent";
11306
11502
  function findDeclaringRoot(startDir) {
11307
11503
  let dir = startDir;
11308
11504
  for (; ; ) {
11309
- if (fs7.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
11505
+ if (fs8.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
11310
11506
  try {
11311
- const manifest = JSON.parse(fs7.readFileSync(path13.join(dir, "package.json"), "utf8"));
11507
+ const manifest = JSON.parse(fs8.readFileSync(path13.join(dir, "package.json"), "utf8"));
11312
11508
  if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
11313
11509
  return dir;
11314
11510
  }
@@ -11324,7 +11520,7 @@ function findStablePackageDir(startDir, packageRoot) {
11324
11520
  for (; ; ) {
11325
11521
  const candidate = path13.join(dir, "node_modules", PACKAGE_NAME);
11326
11522
  try {
11327
- if (fs7.realpathSync(candidate) === packageRoot) return candidate;
11523
+ if (fs8.realpathSync(candidate) === packageRoot) return candidate;
11328
11524
  } catch {
11329
11525
  }
11330
11526
  const parent = path13.dirname(dir);
@@ -11337,7 +11533,7 @@ function classifyInstall() {
11337
11533
  let dir;
11338
11534
  let cwd;
11339
11535
  try {
11340
- packageRoot = fs7.realpathSync(path13.join(import.meta.dirname, ".."));
11536
+ packageRoot = fs8.realpathSync(path13.join(import.meta.dirname, ".."));
11341
11537
  cwd = process.cwd();
11342
11538
  dir = cwd;
11343
11539
  } catch {
@@ -11345,7 +11541,7 @@ function classifyInstall() {
11345
11541
  }
11346
11542
  for (; ; ) {
11347
11543
  try {
11348
- const nmReal = fs7.realpathSync(path13.join(dir, "node_modules"));
11544
+ const nmReal = fs8.realpathSync(path13.join(dir, "node_modules"));
11349
11545
  if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path13.sep)) {
11350
11546
  return {
11351
11547
  kind: "local",