@swmansion/argent 0.34.1-next.7 → 0.34.1-next.70

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 (68) hide show
  1. package/LICENSE +1 -0
  2. package/README.md +1 -1
  3. package/assets/argent.tracecfg.pbtxt +7 -1
  4. package/assets/ios-screen-stream/Info.plist +12 -0
  5. package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
  6. package/assets/trace-processor/engine_bundle.node.js +2074 -11121
  7. package/assets/trace-processor/trace_processor.wasm +0 -0
  8. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  9. package/bin/darwin/argent-macos-helper +0 -0
  10. package/bin/darwin/ax-service +0 -0
  11. package/bin/darwin/simulator-server +0 -0
  12. package/bin/darwin/tvos-ax-service +0 -0
  13. package/bin/darwin/tvos-hid-daemon +0 -0
  14. package/bin/linux/simulator-server +0 -0
  15. package/bin/linux-arm64/simulator-server +0 -0
  16. package/bin/network-inspector/network-inspector.jar +0 -0
  17. package/bin/tcp/ax-service +0 -0
  18. package/bin/win32/simulator-server.exe +0 -0
  19. package/dist/cli-cmds.mjs +1259 -616
  20. package/dist/client.js +381 -180
  21. package/dist/flow-script-runner.mjs +1 -0
  22. package/dist/installer-help.js +4 -0
  23. package/dist/installer-help.js.map +1 -1
  24. package/dist/installer.mjs +1248 -898
  25. package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/xcshareddata/xcschemes/ArgentRunner.xcscheme +1 -0
  26. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
  27. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
  28. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession.swift +3 -0
  29. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/RunnerHTTPServer.swift +21 -9
  30. package/dist/mcp-server.mjs +2675 -715
  31. package/dist/preview-ui/index.html +28 -2
  32. package/dist/tool-args.generated.d.ts +101 -33
  33. package/dist/tool-server.cjs +15873 -6272
  34. package/dylibs/libArgentAudio.dylib +0 -0
  35. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  36. package/dylibs/libKeyboardPatch.dylib +0 -0
  37. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  38. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  39. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  40. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  41. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  42. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  43. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  44. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  45. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  46. package/package.json +1 -1
  47. package/rules/argent.md +6 -23
  48. package/skills/argent-android-emulator-setup/SKILL.md +4 -4
  49. package/skills/argent-create-e2e/SKILL.md +3 -0
  50. package/skills/argent-create-e2e/references/e2e-yaml.md +20 -2
  51. package/skills/argent-create-e2e/references/live-authoring.md +12 -1
  52. package/skills/argent-device-interact/SKILL.md +22 -21
  53. package/skills/argent-device-interact/references/foldables.md +22 -0
  54. package/skills/argent-ios-device-interact/SKILL.md +3 -3
  55. package/skills/argent-ios-device-setup/SKILL.md +4 -2
  56. package/skills/argent-macos-app-interact/SKILL.md +15 -5
  57. package/skills/argent-macos-app-interact/references/e2e.md +1 -1
  58. package/skills/argent-metro-debugger/SKILL.md +26 -14
  59. package/skills/argent-native-profiler/SKILL.md +14 -2
  60. package/skills/argent-qa-e2e/SKILL.md +1 -1
  61. package/skills/argent-react-native-app-workflow/SKILL.md +2 -2
  62. package/skills/argent-react-native-optimization/SKILL.md +10 -1
  63. package/skills/argent-react-native-optimization/references/fix-reference.md +10 -10
  64. package/skills/argent-react-native-profiler/SKILL.md +4 -3
  65. package/skills/argent-screen-recording/SKILL.md +6 -4
  66. package/skills/argent-screenshot-diff/SKILL.md +1 -1
  67. package/skills/argent-test-ui-flow/SKILL.md +1 -1
  68. package/skills/argent-tv-interact/SKILL.md +3 -3
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,14 +7798,24 @@ 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`.",
7804
7809
  defaultEnabled: true
7805
7810
  },
7811
+ {
7812
+ name: "whats-new",
7813
+ description: "After an update, tell the agent the highlights of the new Argent version on its first tool call. On by default; turn it off with `argent disable whats-new`.",
7814
+ defaultEnabled: true
7815
+ },
7806
7816
  {
7807
7817
  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`.",
7818
+ 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
7819
  defaultEnabled: true
7810
7820
  }
7811
7821
  ];
@@ -7875,6 +7885,7 @@ function isFeatureEnabled(name, options = {}, registry = FLAG_REGISTRY) {
7875
7885
  }
7876
7886
 
7877
7887
  // ../configuration-core/src/paths.ts
7888
+ import * as fs2 from "node:fs";
7878
7889
  import * as os from "node:os";
7879
7890
  import * as path2 from "node:path";
7880
7891
  function nonEmpty(value) {
@@ -7886,6 +7897,16 @@ function resolveHomeDir(options = {}) {
7886
7897
  if (options.homeDir) return options.homeDir;
7887
7898
  return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
7888
7899
  }
7900
+ function isHomeDir(dir, options = {}) {
7901
+ return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
7902
+ }
7903
+ function canonicalPath(p) {
7904
+ try {
7905
+ return fs2.realpathSync.native(p);
7906
+ } catch {
7907
+ return path2.resolve(p);
7908
+ }
7909
+ }
7889
7910
  function argentHomeDir() {
7890
7911
  return path2.join(resolveHomeDir(), ".argent");
7891
7912
  }
@@ -7902,11 +7923,11 @@ function configFilePath(scope = "global", options = {}) {
7902
7923
 
7903
7924
  // ../configuration-core/src/config.ts
7904
7925
  import * as crypto from "node:crypto";
7905
- import * as fs2 from "node:fs";
7926
+ import * as fs3 from "node:fs";
7906
7927
  import * as path3 from "node:path";
7907
7928
  function readConfigObject(scope = "global", options = {}) {
7908
7929
  try {
7909
- const raw = fs2.readFileSync(configFilePath(scope, options), "utf8");
7930
+ const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
7910
7931
  const json = JSON.parse(raw);
7911
7932
  if (json && typeof json === "object" && !Array.isArray(json)) {
7912
7933
  return json;
@@ -7943,7 +7964,7 @@ function getAtPath(obj, dottedKey) {
7943
7964
 
7944
7965
  // ../configuration-core/src/secrets.ts
7945
7966
  var import_dotenv = __toESM(require_dist(), 1);
7946
- import * as fs3 from "node:fs";
7967
+ import * as fs4 from "node:fs";
7947
7968
  import * as path4 from "node:path";
7948
7969
  var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
7949
7970
  var SECRETS_FILE_NAME = "secrets.env";
@@ -7973,10 +7994,10 @@ function fileSource(filePath, exposure) {
7973
7994
  names: [],
7974
7995
  values: /* @__PURE__ */ new Map()
7975
7996
  };
7976
- if (!fs3.statSync(filePath, { throwIfNoEntry: false })) return absent;
7997
+ if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
7977
7998
  let content;
7978
7999
  try {
7979
- content = fs3.readFileSync(filePath, "utf8");
8000
+ content = fs4.readFileSync(filePath, "utf8");
7980
8001
  } catch {
7981
8002
  return absent;
7982
8003
  }
@@ -8002,7 +8023,9 @@ function fileSource(filePath, exposure) {
8002
8023
  }
8003
8024
  function secretSources(options = {}) {
8004
8025
  const sources = [envSource(options.env ?? process.env)];
8005
- const projectRoot = findProjectRoot(options.cwd ?? process.cwd());
8026
+ const home = resolveHomeDir(options);
8027
+ const found = findProjectRoot(options.cwd ?? process.cwd());
8028
+ const projectRoot = found && isHomeDir(found, options) ? home : found;
8006
8029
  const filePaths = [];
8007
8030
  if (projectRoot) {
8008
8031
  filePaths.push({
@@ -8014,7 +8037,7 @@ function secretSources(options = {}) {
8014
8037
  }
8015
8038
  }
8016
8039
  filePaths.push({
8017
- path: path4.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME),
8040
+ path: path4.join(home, ".argent", SECRETS_FILE_NAME),
8018
8041
  exposure: "dedicated"
8019
8042
  });
8020
8043
  const seen = /* @__PURE__ */ new Set();
@@ -8136,14 +8159,6 @@ var CONFIG_SCHEMA = [
8136
8159
  // drained/reset, not just the file rewritten.
8137
8160
  manageCommand: "argent telemetry"
8138
8161
  },
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
8162
  {
8148
8163
  key: "lens.agent",
8149
8164
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -8266,7 +8281,7 @@ var UnknownConfigKeyError = class extends Error {
8266
8281
 
8267
8282
  // ../argent-tools-client/src/launcher.ts
8268
8283
  import * as net from "node:net";
8269
- import * as fs4 from "node:fs";
8284
+ import * as fs5 from "node:fs";
8270
8285
  import * as path6 from "node:path";
8271
8286
  import * as readline from "node:readline";
8272
8287
  import { homedir as homedir3 } from "node:os";
@@ -8280,6 +8295,7 @@ var LOCK_FILE = path6.join(STATE_DIR, "tool-server.lock");
8280
8295
  var AUTH_TOKEN_BYTES = 32;
8281
8296
  var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
8282
8297
  var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
8298
+ var AUTOSPAWN_HOST = "127.0.0.1";
8283
8299
  function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8284
8300
  const env = {
8285
8301
  ...baseEnv,
@@ -8291,7 +8307,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8291
8307
  if (options.idleTimeoutMinutes !== void 0) {
8292
8308
  env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
8293
8309
  }
8294
- if (options.token) env[AUTH_TOKEN_ENV] = options.token;
8310
+ env[AUTH_TOKEN_ENV] = options.token ?? "";
8295
8311
  if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
8296
8312
  if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
8297
8313
  return env;
@@ -8300,7 +8316,7 @@ function generateToken() {
8300
8316
  return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
8301
8317
  }
8302
8318
  function findFreePort() {
8303
- return new Promise((resolve9, reject) => {
8319
+ return new Promise((resolve11, reject) => {
8304
8320
  const srv = net.createServer();
8305
8321
  srv.listen(0, "127.0.0.1", () => {
8306
8322
  const addr = srv.address();
@@ -8311,21 +8327,21 @@ function findFreePort() {
8311
8327
  const port = addr.port;
8312
8328
  srv.close((err) => {
8313
8329
  if (err) reject(err);
8314
- else resolve9(port);
8330
+ else resolve11(port);
8315
8331
  });
8316
8332
  });
8317
8333
  srv.on("error", reject);
8318
8334
  });
8319
8335
  }
8320
8336
  function isVersionNewer(a, b) {
8321
- const parse = (v) => {
8337
+ const parse2 = (v) => {
8322
8338
  const [core = "", ...preParts] = v.split("+")[0].split("-");
8323
8339
  const nums = core.split(".").map((n) => Number.parseInt(n, 10));
8324
8340
  if (nums.length === 0 || nums.some((n) => Number.isNaN(n))) return null;
8325
8341
  return { nums, pre: preParts.length > 0 ? preParts.join("-").split(".") : [] };
8326
8342
  };
8327
- const pa = parse(a);
8328
- const pb = parse(b);
8343
+ const pa = parse2(a);
8344
+ const pb = parse2(b);
8329
8345
  if (!pa || !pb) return false;
8330
8346
  for (let i = 0; i < 3; i++) {
8331
8347
  const x = pa.nums[i] ?? 0;
@@ -8353,7 +8369,7 @@ function isVersionNewer(a, b) {
8353
8369
  function readBundlePackageVersion(bundlePath) {
8354
8370
  try {
8355
8371
  const pkg = JSON.parse(
8356
- fs4.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
8372
+ fs5.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
8357
8373
  );
8358
8374
  return typeof pkg.version === "string" ? pkg.version : void 0;
8359
8375
  } catch {
@@ -8408,23 +8424,26 @@ function killSpawnedChild(child, pid) {
8408
8424
  }
8409
8425
  }
8410
8426
  }
8427
+ function resolveToolsServerNode() {
8428
+ const { bun, deno, electron } = process.versions;
8429
+ return !(bun || deno || electron) && fs5.existsSync(process.execPath) ? process.execPath : "node";
8430
+ }
8411
8431
  function spawnToolsServer(paths, port, options = {}) {
8412
- return new Promise((resolve9, reject) => {
8432
+ return new Promise((resolve11, reject) => {
8413
8433
  let logFd;
8414
8434
  try {
8415
- fs4.mkdirSync(STATE_DIR, { recursive: true });
8416
- logFd = fs4.openSync(LOG_FILE, "a");
8435
+ fs5.mkdirSync(STATE_DIR, { recursive: true });
8436
+ logFd = fs5.openSync(LOG_FILE, "a");
8417
8437
  } catch {
8418
- logFd = fs4.openSync("/dev/null", "w");
8438
+ logFd = fs5.openSync("/dev/null", "w");
8419
8439
  }
8420
- const { bun, deno, electron } = process.versions;
8421
- const nodeBin = !(bun || deno || electron) && fs4.existsSync(process.execPath) ? process.execPath : "node";
8440
+ const nodeBin = resolveToolsServerNode();
8422
8441
  const child = spawn(nodeBin, [paths.bundlePath, "start"], {
8423
8442
  detached: true,
8424
8443
  stdio: ["ignore", "pipe", logFd],
8425
8444
  env: buildToolsServerEnv(paths, port, process.env, options)
8426
8445
  });
8427
- fs4.closeSync(logFd);
8446
+ fs5.closeSync(logFd);
8428
8447
  child.unref();
8429
8448
  const pid = child.pid;
8430
8449
  if (!pid) {
@@ -8456,7 +8475,7 @@ function spawnToolsServer(paths, port, options = {}) {
8456
8475
  rl.close();
8457
8476
  child.stdout?.resume();
8458
8477
  child.stdout?.unref?.();
8459
- settle(() => resolve9({ port: actualPort, pid }));
8478
+ settle(() => resolve11({ port: actualPort, pid }));
8460
8479
  }
8461
8480
  });
8462
8481
  child.on("error", (err) => {
@@ -8551,7 +8570,7 @@ async function sweepDeadStateFiles() {
8551
8570
  });
8552
8571
  continue;
8553
8572
  }
8554
- if (fs4.existsSync(fresh.bundlePath)) continue;
8573
+ if (fs5.existsSync(fresh.bundlePath)) continue;
8555
8574
  if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
8556
8575
  await unlink(file).catch(() => {
8557
8576
  });
@@ -8598,7 +8617,7 @@ async function killToolServer(bundlePath) {
8598
8617
  await clearToolsServerState(bundlePath ?? state.bundlePath);
8599
8618
  return alive;
8600
8619
  }
8601
- var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs4.existsSync(p)) ?? "ps";
8620
+ var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs5.existsSync(p)) ?? "ps";
8602
8621
  var PS_WIDTH_FLAGS = ["-ww"];
8603
8622
  var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
8604
8623
  function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
@@ -8645,13 +8664,13 @@ var LOCK_STALE_MS = 45e3;
8645
8664
  var LOCK_POLL_MS = 100;
8646
8665
  function spawnLockIsStale() {
8647
8666
  try {
8648
- const { pid, ts } = JSON.parse(fs4.readFileSync(LOCK_FILE, "utf8"));
8667
+ const { pid, ts } = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
8649
8668
  if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
8650
8669
  if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS) return true;
8651
8670
  return false;
8652
8671
  } catch {
8653
8672
  try {
8654
- return Date.now() - fs4.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
8673
+ return Date.now() - fs5.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
8655
8674
  } catch {
8656
8675
  return true;
8657
8676
  }
@@ -8659,7 +8678,7 @@ function spawnLockIsStale() {
8659
8678
  }
8660
8679
  async function acquireSpawnLock() {
8661
8680
  try {
8662
- fs4.mkdirSync(STATE_DIR, { recursive: true });
8681
+ fs5.mkdirSync(STATE_DIR, { recursive: true });
8663
8682
  } catch {
8664
8683
  return null;
8665
8684
  }
@@ -8667,11 +8686,11 @@ async function acquireSpawnLock() {
8667
8686
  const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
8668
8687
  for (; ; ) {
8669
8688
  try {
8670
- const fd = fs4.openSync(LOCK_FILE, "wx");
8689
+ const fd = fs5.openSync(LOCK_FILE, "wx");
8671
8690
  try {
8672
- fs4.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
8691
+ fs5.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
8673
8692
  } finally {
8674
- fs4.closeSync(fd);
8693
+ fs5.closeSync(fd);
8675
8694
  }
8676
8695
  let released = false;
8677
8696
  return {
@@ -8679,8 +8698,8 @@ async function acquireSpawnLock() {
8679
8698
  if (released) return;
8680
8699
  released = true;
8681
8700
  try {
8682
- const cur = JSON.parse(fs4.readFileSync(LOCK_FILE, "utf8"));
8683
- if (cur.pid === process.pid && cur.nonce === nonce) fs4.unlinkSync(LOCK_FILE);
8701
+ const cur = JSON.parse(fs5.readFileSync(LOCK_FILE, "utf8"));
8702
+ if (cur.pid === process.pid && cur.nonce === nonce) fs5.unlinkSync(LOCK_FILE);
8684
8703
  } catch {
8685
8704
  }
8686
8705
  }
@@ -8689,10 +8708,10 @@ async function acquireSpawnLock() {
8689
8708
  if (err.code !== "EEXIST") return null;
8690
8709
  if (spawnLockIsStale()) {
8691
8710
  try {
8692
- fs4.unlinkSync(LOCK_FILE);
8711
+ fs5.unlinkSync(LOCK_FILE);
8693
8712
  } catch {
8694
8713
  }
8695
- if (!fs4.existsSync(LOCK_FILE)) continue;
8714
+ if (!fs5.existsSync(LOCK_FILE)) continue;
8696
8715
  }
8697
8716
  if (Date.now() >= deadline) return null;
8698
8717
  await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
@@ -8732,7 +8751,7 @@ async function ensureToolsServer(paths) {
8732
8751
  }
8733
8752
  await clearToolsServerState(paths.bundlePath);
8734
8753
  await sweepDeadStateFiles();
8735
- if (!fs4.existsSync(paths.bundlePath)) {
8754
+ if (!fs5.existsSync(paths.bundlePath)) {
8736
8755
  throw new Error(
8737
8756
  `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
8757
  );
@@ -8742,6 +8761,7 @@ async function ensureToolsServer(paths) {
8742
8761
  const port = await findFreePort();
8743
8762
  const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
8744
8763
  token,
8764
+ host: AUTOSPAWN_HOST,
8745
8765
  idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
8746
8766
  });
8747
8767
  await writeState({
@@ -8750,11 +8770,11 @@ async function ensureToolsServer(paths) {
8750
8770
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
8751
8771
  bundlePath: paths.bundlePath,
8752
8772
  version: diskVersion,
8753
- host: "127.0.0.1",
8773
+ host: AUTOSPAWN_HOST,
8754
8774
  token,
8755
8775
  managed: "autospawn"
8756
8776
  });
8757
- return { url: formatUrl("127.0.0.1", actualPort), token };
8777
+ return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
8758
8778
  } finally {
8759
8779
  lock?.release();
8760
8780
  }
@@ -8796,7 +8816,18 @@ function interpolateFileInputPath(template, args) {
8796
8816
  });
8797
8817
  return missing ? null : out;
8798
8818
  }
8799
- var TOOL_FILE_EXTENSIONS = [".png", ".yaml"];
8819
+ var TOOL_FILE_EXTENSIONS = [
8820
+ ".png",
8821
+ ".yaml",
8822
+ ".wav",
8823
+ ".mp3",
8824
+ ".m4a",
8825
+ ".aac",
8826
+ ".caf",
8827
+ ".aif",
8828
+ ".aiff",
8829
+ ".flac"
8830
+ ];
8800
8831
  function hasToolFileExtension(file) {
8801
8832
  const name = file.toLowerCase();
8802
8833
  return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
@@ -8810,16 +8841,24 @@ function toolStepFiles(specs, args) {
8810
8841
  }
8811
8842
  return files;
8812
8843
  }
8844
+ var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][A-Za-z0-9+.-]+:/;
8845
+ function isUnexpandedPath(p) {
8846
+ return UNEXPANDED_PATH.test(p);
8847
+ }
8813
8848
  function isClientFileArgument({ spec, path: path14 }) {
8814
8849
  return spec.kind === "file" && spec.path === `\${${spec.target}}` && path14.startsWith("/") && hasToolFileExtension(path14);
8815
8850
  }
8816
8851
 
8852
+ // ../registry/src/flow-platforms.ts
8853
+ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
8854
+ var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
8855
+
8817
8856
  // ../registry/src/flow-file-refs.ts
8818
- import * as fs6 from "node:fs/promises";
8857
+ import * as fs7 from "node:fs/promises";
8819
8858
  import * as path8 from "node:path";
8820
8859
 
8821
8860
  // ../registry/src/e2e-dirs.ts
8822
- import * as fs5 from "node:fs/promises";
8861
+ import * as fs6 from "node:fs/promises";
8823
8862
  import * as path7 from "node:path";
8824
8863
  var E2E_DIR = path7.join(".argent", "e2e");
8825
8864
  var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
@@ -8834,7 +8873,7 @@ function e2eFileCandidates(projectRoot, name) {
8834
8873
  return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
8835
8874
  }
8836
8875
  async function exists(file) {
8837
- return fs5.stat(file).then(
8876
+ return fs6.stat(file).then(
8838
8877
  () => true,
8839
8878
  () => false
8840
8879
  );
@@ -8925,10 +8964,10 @@ function canonicalToolArgs(tool, args) {
8925
8964
  // ../registry/src/flow-file-refs.ts
8926
8965
  async function canonicalFlowPath(p) {
8927
8966
  try {
8928
- return await fs6.realpath(p);
8967
+ return await fs7.realpath(p);
8929
8968
  } catch {
8930
8969
  try {
8931
- return path8.join(await fs6.realpath(path8.dirname(p)), path8.basename(p));
8970
+ return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
8932
8971
  } catch {
8933
8972
  return p;
8934
8973
  }
@@ -8944,6 +8983,9 @@ var MAX_BLOCK_NESTING = 64;
8944
8983
  function isRecord(value) {
8945
8984
  return typeof value === "object" && value !== null && !Array.isArray(value);
8946
8985
  }
8986
+ function flowYamlSource(content) {
8987
+ return content.replace(/^\s+/, (lead) => lead.replace(/[^\n]/g, "")).trimEnd();
8988
+ }
8947
8989
  function collectFlowRequests(doc) {
8948
8990
  const runTargets = /* @__PURE__ */ new Set();
8949
8991
  const snapshots = /* @__PURE__ */ new Set();
@@ -8974,15 +9016,15 @@ function collectFlowRequests(doc) {
8974
9016
  if (isRecord(doc)) visit(doc.steps, 0);
8975
9017
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
8976
9018
  }
8977
- function baselineKeyFor(canonicalPath, flowName) {
8978
- const stem = path8.basename(canonicalPath, ".yaml");
9019
+ function baselineKeyFor(canonicalPath2, flowName) {
9020
+ const stem = path8.basename(canonicalPath2, ".yaml");
8979
9021
  return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
8980
9022
  }
8981
9023
  function flowMemberKey(anchorDir, target) {
8982
9024
  return `${anchorDir}\0${target}`;
8983
9025
  }
8984
9026
  async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
8985
- const entries = await fs6.readdir(dir).catch(() => null);
9027
+ const entries = await fs7.readdir(dir).catch(() => null);
8986
9028
  if (entries === null || entries.includes(base)) return { state: "listed" };
8987
9029
  const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
8988
9030
  if (actual === void 0) return { state: "absent" };
@@ -9092,6 +9134,10 @@ var FAILURE_CODES = {
9092
9134
  ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
9093
9135
  ANDROID_ADB_BOOT_TERMINAL_STATE: "ANDROID_ADB_BOOT_TERMINAL_STATE",
9094
9136
  ANDROID_ADB_BOOT_TIMEOUT: "ANDROID_ADB_BOOT_TIMEOUT",
9137
+ ANDROID_NETWORK_PROXY_TIMEOUT: "ANDROID_NETWORK_PROXY_TIMEOUT",
9138
+ ANDROID_NETWORK_RESTORE_TIMEOUT: "ANDROID_NETWORK_RESTORE_TIMEOUT",
9139
+ ANDROID_OFFLINE_TIMEOUT: "ANDROID_OFFLINE_TIMEOUT",
9140
+ ANDROID_OFFLINE_UNSUPPORTED: "ANDROID_OFFLINE_UNSUPPORTED",
9095
9141
  SIMULATOR_NETWORK_TIMEOUT: "SIMULATOR_NETWORK_TIMEOUT",
9096
9142
  SIMULATOR_NETWORK_CONNECTION_REFUSED: "SIMULATOR_NETWORK_CONNECTION_REFUSED",
9097
9143
  SIMULATOR_NETWORK_CONNECTION_RESET: "SIMULATOR_NETWORK_CONNECTION_RESET",
@@ -9211,12 +9257,15 @@ var FAILURE_CODES = {
9211
9257
  DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
9212
9258
  DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
9213
9259
  DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
9260
+ DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
9214
9261
  DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
9215
9262
  DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
9216
9263
  DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
9217
9264
  DEBUGGER_TARGET_DEVICE_MISMATCH: "DEBUGGER_TARGET_DEVICE_MISMATCH",
9218
9265
  DEBUGGER_EVALUATE_EXPRESSION_THREW: "DEBUGGER_EVALUATE_EXPRESSION_THREW",
9219
9266
  DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
9267
+ // e2e-add-step refused a debugger-* call that answered `not_connected`.
9268
+ DEBUGGER_NOT_CONNECTED: "DEBUGGER_NOT_CONNECTED",
9220
9269
  JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
9221
9270
  JS_RUNTIME_PAYLOAD_INVALID: "JS_RUNTIME_PAYLOAD_INVALID",
9222
9271
  JS_RUNTIME_PAYLOAD_DEVICE_MISSING: "JS_RUNTIME_PAYLOAD_DEVICE_MISSING",
@@ -9230,7 +9279,7 @@ var FAILURE_CODES = {
9230
9279
  ANDROID_NETWORK_INSPECTOR_RUN_AS_FAILED: "ANDROID_NETWORK_INSPECTOR_RUN_AS_FAILED",
9231
9280
  ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE: "ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE",
9232
9281
  ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT: "ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT",
9233
- NATIVE_NETWORK_LOGS_STOP_UNSUPPORTED: "NATIVE_NETWORK_LOGS_STOP_UNSUPPORTED",
9282
+ NETWORK_CAPTURE_UNAVAILABLE: "NETWORK_CAPTURE_UNAVAILABLE",
9234
9283
  NDJSON_CDP_REQUEST_TIMEOUT: "NDJSON_CDP_REQUEST_TIMEOUT",
9235
9284
  NDJSON_CDP_REQUEST_FAILED: "NDJSON_CDP_REQUEST_FAILED",
9236
9285
  NDJSON_CDP_CONNECTION_CLOSED: "NDJSON_CDP_CONNECTION_CLOSED",
@@ -9285,6 +9334,32 @@ var FAILURE_CODES = {
9285
9334
  NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
9286
9335
  NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
9287
9336
  NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
9337
+ /**
9338
+ * native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
9339
+ * devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
9340
+ * @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
9341
+ */
9342
+ // Not macOS, or an Xcode that cannot record the launch on this target.
9343
+ LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
9344
+ // No usable iPhone or simulator was selected, or Argent's runner holds it.
9345
+ LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
9346
+ // The bundle_id app is not installed on the selected device.
9347
+ LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
9348
+ // The runner's xcodebuild failed on code signing or provisioning.
9349
+ LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
9350
+ // The iPhone's free developer profile has no slot for Argent's runner.
9351
+ LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
9352
+ // simctl could not wait for boot, find, launch or terminate the app.
9353
+ LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
9354
+ LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
9355
+ // xctrace could not export the TOC, the CPU samples or the first-frame marker.
9356
+ LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
9357
+ // The App Launch trace has no first frame of the app, so it has no launch window.
9358
+ LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
9359
+ // The XCTest launch run of Argent's runner failed.
9360
+ LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
9361
+ // The launch test ran, but Argent read no launch measurements from its result.
9362
+ LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
9288
9363
  // iOS and Android share one capture path (simulator-server frames into
9289
9364
  // ffmpeg), so these name the failing stage, not the device family.
9290
9365
  SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
@@ -9299,6 +9374,19 @@ var FAILURE_CODES = {
9299
9374
  SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
9300
9375
  SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
9301
9376
  SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
9377
+ // A cabled iPhone has no simulator-server: its frames come from a host-side
9378
+ // CoreMediaIO capture helper, which can fail in ways of its own.
9379
+ SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
9380
+ SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
9381
+ SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
9382
+ SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
9383
+ AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
9384
+ AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
9385
+ AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
9386
+ AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
9387
+ AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
9388
+ AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
9389
+ AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
9302
9390
  FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
9303
9391
  FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
9304
9392
  FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
@@ -9362,6 +9450,8 @@ var FAILURE_CODES = {
9362
9450
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
9363
9451
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
9364
9452
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
9453
+ /** The app's loaded Argent library lacks support for the requested operation. */
9454
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
9365
9455
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
9366
9456
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
9367
9457
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -9548,7 +9638,7 @@ import { spawn as spawn2 } from "node:child_process";
9548
9638
  import { once } from "node:events";
9549
9639
  import { createReadStream, createWriteStream } from "node:fs";
9550
9640
  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";
9641
+ import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
9552
9642
  import { Writable } from "node:stream";
9553
9643
  import { pipeline } from "node:stream/promises";
9554
9644
  import zlib from "node:zlib";
@@ -9646,7 +9736,7 @@ async function sniffFormat(archivePath) {
9646
9736
  }
9647
9737
  }
9648
9738
  var ZSTD_FRAME_MAGIC = 4247762216;
9649
- async function assertSingleCompleteZstdFrame(archivePath) {
9739
+ async function assertSingleCompleteZstdFrame(archivePath, signal) {
9650
9740
  const fh = await open(archivePath, "r");
9651
9741
  try {
9652
9742
  const { size } = await fh.stat();
@@ -9656,6 +9746,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
9656
9746
  let pos = 0;
9657
9747
  const read = async (n) => {
9658
9748
  if (pos < windowStart || pos + n > windowEnd) {
9749
+ signal?.throwIfAborted();
9659
9750
  const { bytesRead } = await fh.read(window, 0, window.length, pos);
9660
9751
  windowStart = pos;
9661
9752
  windowEnd = pos + bytesRead;
@@ -9693,14 +9784,16 @@ function tarEnv(env) {
9693
9784
  const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
9694
9785
  return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
9695
9786
  }
9696
- async function runTar(archive, args) {
9787
+ async function runTar(archive, args, signal) {
9697
9788
  const child = spawn2("tar", [...args, "-f", "-"], {
9789
+ signal,
9698
9790
  env: tarEnv(process.env)
9699
9791
  });
9700
- const exited = new Promise((res, rej) => {
9701
- child.on("error", rej);
9702
- child.on("close", res);
9792
+ let childError;
9793
+ child.on("error", (err) => {
9794
+ childError = err;
9703
9795
  });
9796
+ const closed = new Promise((resolve11) => child.once("close", resolve11));
9704
9797
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
9705
9798
  maxLines: MAX_LISTING_LINES,
9706
9799
  onOverflow: () => child.kill()
@@ -9727,12 +9820,15 @@ async function runTar(archive, args) {
9727
9820
  if (err) child.stdin?.destroy();
9728
9821
  done(err);
9729
9822
  }
9730
- })
9823
+ }),
9824
+ { signal }
9731
9825
  ).then(
9732
9826
  () => null,
9733
9827
  (err) => err
9734
9828
  );
9735
- const [code, feedError] = await Promise.all([exited, fed]);
9829
+ const [code, feedError] = await Promise.all([closed, fed]);
9830
+ signal?.throwIfAborted();
9831
+ if (childError) throw childError;
9736
9832
  if (stdout.overflowed()) {
9737
9833
  throw new Error(
9738
9834
  `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
@@ -9754,24 +9850,25 @@ function isContainedPath(path14, windows = process.platform === "win32") {
9754
9850
  function isSafeTarMember(memberPath, destDir) {
9755
9851
  const normalized = normalizeTarMemberPath(memberPath);
9756
9852
  if (!isContainedPath(normalized)) return false;
9757
- const root = resolve6(destDir);
9758
- return resolve6(destDir, normalized).startsWith(root + sep2);
9853
+ const root = resolve7(destDir);
9854
+ return resolve7(destDir, normalized).startsWith(root + sep2);
9759
9855
  }
9760
- async function readListing(archive, args) {
9856
+ async function readListing(archive, args, signal) {
9761
9857
  try {
9762
- return await runTar(archive, args);
9858
+ return await runTar(archive, args, signal);
9763
9859
  } catch (err) {
9860
+ signal?.throwIfAborted();
9764
9861
  throw new ArchiveError(
9765
9862
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
9766
9863
  );
9767
9864
  }
9768
9865
  }
9769
- async function listTarMembers(archive) {
9770
- const stdout = await readListing(archive, ["-t"]);
9866
+ async function listTarMembers(archive, signal) {
9867
+ const stdout = await readListing(archive, ["-t"], signal);
9771
9868
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
9772
9869
  }
9773
- async function assertSafeMemberTypes(archive) {
9774
- const stdout = await readListing(archive, ["-tv"]);
9870
+ async function assertSafeMemberTypes(archive, signal) {
9871
+ const stdout = await readListing(archive, ["-tv"], signal);
9775
9872
  for (const line of stdout.split("\n")) {
9776
9873
  if (!line.trim()) continue;
9777
9874
  const type = line[0];
@@ -9791,8 +9888,8 @@ async function assertSafeMemberTypes(archive) {
9791
9888
  );
9792
9889
  }
9793
9890
  }
9794
- async function assertSafeArchive(archive, destDir) {
9795
- const members = await listTarMembers(archive);
9891
+ async function assertSafeArchive(archive, destDir, signal) {
9892
+ const members = await listTarMembers(archive, signal);
9796
9893
  if (members.length === 0) {
9797
9894
  throw new ArchiveError("Archive is empty.");
9798
9895
  }
@@ -9801,7 +9898,7 @@ async function assertSafeArchive(archive, destDir) {
9801
9898
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
9802
9899
  }
9803
9900
  }
9804
- await assertSafeMemberTypes(archive);
9901
+ await assertSafeMemberTypes(archive, signal);
9805
9902
  }
9806
9903
  async function resolveMember(destDir, expectedName) {
9807
9904
  const entries = await readdir3(destDir);
@@ -9816,19 +9913,24 @@ async function resolveMember(destDir, expectedName) {
9816
9913
  }
9817
9914
  return join9(destDir, real[0]);
9818
9915
  }
9819
- async function safeExtractArchive(archivePath, destDir, expectedName) {
9916
+ async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
9917
+ signal?.throwIfAborted();
9820
9918
  let archive;
9821
9919
  try {
9822
9920
  archive = { path: archivePath, format: await sniffFormat(archivePath) };
9823
- if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
9921
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
9824
9922
  } catch (err) {
9923
+ signal?.throwIfAborted();
9825
9924
  throw new ArchiveError(
9826
9925
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
9827
9926
  );
9828
9927
  }
9829
- await assertSafeArchive(archive, destDir);
9830
- await runTar(archive, ["-x", "-C", destDir]);
9831
- return resolveMember(destDir, expectedName);
9928
+ await assertSafeArchive(archive, destDir, signal);
9929
+ signal?.throwIfAborted();
9930
+ await runTar(archive, ["-x", "-C", destDir], signal);
9931
+ const member = await resolveMember(destDir, expectedName);
9932
+ signal?.throwIfAborted();
9933
+ return member;
9832
9934
  }
9833
9935
 
9834
9936
  // ../argent-tools-client/src/errors.ts
@@ -9861,6 +9963,22 @@ function interpolatePath(template, args) {
9861
9963
  });
9862
9964
  return missing ? null : out;
9863
9965
  }
9966
+ function callerPath(p) {
9967
+ const onCurrentDrive = path10.sep === "\\" && /^[\\/](?![\\/])/.test(p);
9968
+ if (!onCurrentDrive && (path10.isAbsolute(p) || path10.win32.isAbsolute(p) || isUnexpandedPath(p))) {
9969
+ return p;
9970
+ }
9971
+ const { root } = path10.parse(p);
9972
+ const rest = p.slice(root.length);
9973
+ if (!rest.split(/[\\/]/).includes("..")) {
9974
+ const resolved = path10.resolve(p);
9975
+ const last = p.split(path10.sep === "\\" ? /[\\/]/ : "/").at(-1);
9976
+ const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path10.sep);
9977
+ return dirOnly ? `${resolved}${path10.sep}` : resolved;
9978
+ }
9979
+ const base = path10.resolve(root);
9980
+ return base.endsWith(path10.sep) ? `${base}${rest}` : `${base}${path10.sep}${rest}`;
9981
+ }
9864
9982
  async function specPath(spec, args) {
9865
9983
  if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
9866
9984
  const candidates = [];
@@ -9905,10 +10023,10 @@ function untrackArchive(archive) {
9905
10023
  for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
9906
10024
  process.removeListener("exit", removePendingArchives);
9907
10025
  }
9908
- function sha256File(filePath) {
9909
- return new Promise((resolve9, reject) => {
10026
+ function sha256File(filePath, signal) {
10027
+ return new Promise((resolve11, reject) => {
9910
10028
  const hash = createHash2("sha256");
9911
- createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve9(hash.digest("hex"))).on("error", reject);
10029
+ createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve11(hash.digest("hex"))).on("error", reject);
9912
10030
  });
9913
10031
  }
9914
10032
  function toolServerError(text) {
@@ -9971,7 +10089,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
9971
10089
  trackArchive(tarPath);
9972
10090
  try {
9973
10091
  await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
9974
- const contentHash = await sha256File(tarPath);
10092
+ const contentHash = await sha256File(tarPath, signal);
9975
10093
  return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
9976
10094
  } finally {
9977
10095
  untrackArchive(tarPath);
@@ -10006,13 +10124,21 @@ async function prepareFileInputs(specs, args, opts) {
10006
10124
  return args;
10007
10125
  }
10008
10126
  const record = args;
10009
- let out = null;
10127
+ const planned = [];
10128
+ const callArgs = { ...record };
10010
10129
  for (const spec of specs) {
10011
10130
  if (spec.skipWhenSet && record[spec.skipWhenSet] !== void 0) continue;
10012
10131
  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;
10132
+ const spelled = await specPath(spec, record);
10133
+ if (spelled === null) continue;
10134
+ if (spec.target in record && record[spec.target] !== spelled) continue;
10135
+ const filePath = callerPath(spelled);
10136
+ planned.push({ spec, filePath });
10137
+ if (spec.target in record) callArgs[spec.target] = filePath;
10138
+ }
10139
+ if (planned.length === 0) return args;
10140
+ const out = { ...record };
10141
+ for (const { spec, filePath } of planned) {
10016
10142
  const wire = { [FILE_INPUT_MARKER2]: true, path: filePath };
10017
10143
  if (spec.kind === "file") {
10018
10144
  const read = await readFileInputWire(filePath, { includeContent: opts.includeContent });
@@ -10020,12 +10146,12 @@ async function prepareFileInputs(specs, args, opts) {
10020
10146
  if (spec.collect === "flow" && opts.includeContent && wire.content !== void 0 && opts.collectMembers) {
10021
10147
  Object.assign(
10022
10148
  wire,
10023
- await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"), record, opts)
10149
+ await opts.collectMembers(filePath, Buffer.from(wire.content, "base64"), callArgs, opts)
10024
10150
  );
10025
10151
  }
10026
10152
  }
10027
10153
  if (spec.kind === "probe" && spec.collect === "step" && opts.includeContent && opts.collectStepMembers) {
10028
- wire.members = await opts.collectStepMembers(record, opts);
10154
+ wire.members = await opts.collectStepMembers(callArgs, opts);
10029
10155
  }
10030
10156
  if (spec.kind === "tar-upload") {
10031
10157
  const st = await stat3(filePath).catch(() => null);
@@ -10039,10 +10165,9 @@ async function prepareFileInputs(specs, args, opts) {
10039
10165
  Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
10040
10166
  }
10041
10167
  }
10042
- out = out ?? { ...record };
10043
10168
  out[spec.target] = wire;
10044
10169
  }
10045
- return out ?? args;
10170
+ return out;
10046
10171
  }
10047
10172
  function isAllowedClientFilePath(p) {
10048
10173
  if (!path10.isAbsolute(p)) return false;
@@ -10406,7 +10531,7 @@ function memberCollector(roots, opts) {
10406
10531
  for (let file = files.shift(); file !== void 0; file = files.shift()) {
10407
10532
  let doc;
10408
10533
  try {
10409
- doc = (0, import_yaml.parse)(file.text.trim(), { logLevel: "error" });
10534
+ doc = (0, import_yaml.parse)(flowYamlSource(file.text), { logLevel: "error" });
10410
10535
  } catch {
10411
10536
  continue;
10412
10537
  }
@@ -10521,7 +10646,7 @@ function recordedStep(args) {
10521
10646
  async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
10522
10647
  const { name, project_root: projectRoot } = args;
10523
10648
  const step = recordedStep(args);
10524
- if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || typeof projectRoot !== "string" || !path11.isAbsolute(projectRoot) || step === void 0) {
10649
+ if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
10525
10650
  return [];
10526
10651
  }
10527
10652
  const recording = path11.join(recordingDirFor(projectRoot), `${name}.yaml`);
@@ -10607,7 +10732,10 @@ async function stepForOlderServer(args, listedId) {
10607
10732
  async function e2eShadowWarningFor(tool, args) {
10608
10733
  const id = canonicalToolId(tool);
10609
10734
  if (id !== "e2e-execute" && id !== "e2e-read-prerequisite") return void 0;
10610
- const target = nestedFlowTarget(args);
10735
+ const root = args?.project_root;
10736
+ const target = nestedFlowTarget(
10737
+ typeof root === "string" ? { ...args, project_root: callerPath(root) } : args
10738
+ );
10611
10739
  if (target?.kind !== "name") return void 0;
10612
10740
  const picked = await pickE2eFile(target.paths);
10613
10741
  return picked.shadowed === void 0 ? void 0 : e2eShadowWarning(picked.path, picked.shadowed);
@@ -10725,6 +10853,34 @@ function assertRequiredPresent(meta, args) {
10725
10853
  describeParamIssues({ issues }, record)
10726
10854
  );
10727
10855
  }
10856
+ var MAX_NON_FINITE_ISSUES = 12;
10857
+ function assertFiniteNumbers(args) {
10858
+ const issues = [];
10859
+ const seen = /* @__PURE__ */ new WeakSet();
10860
+ const pending = [{ value: args, key: "" }];
10861
+ for (let i = 0; i < pending.length && issues.length < MAX_NON_FINITE_ISSUES; i++) {
10862
+ const visit = pending[i];
10863
+ const { value } = visit;
10864
+ if (typeof value !== "object" || value === null || seen.has(value)) continue;
10865
+ seen.add(value);
10866
+ for (const [key, item] of Array.isArray(value) ? value.entries() : Object.entries(value)) {
10867
+ if (typeof item === "object" && item !== null) {
10868
+ pending.push({ value: item, key, parent: visit });
10869
+ } else if (typeof item === "number" && !Number.isFinite(item)) {
10870
+ const path14 = [key];
10871
+ for (let at = visit; at.parent; at = at.parent) path14.push(at.key);
10872
+ path14.reverse();
10873
+ issues.push({ code: "invalid_type", path: path14, message: `expected a number, got ${item}` });
10874
+ if (issues.length === MAX_NON_FINITE_ISSUES) break;
10875
+ }
10876
+ }
10877
+ }
10878
+ if (issues.length === 0) return;
10879
+ throw new ToolInvocationError(
10880
+ describeParamIssues({ issues }, args),
10881
+ { errorKind: "validation", issues }
10882
+ );
10883
+ }
10728
10884
  function fetchFailure(err) {
10729
10885
  if (!(err instanceof Error)) return String(err);
10730
10886
  return err.cause instanceof Error ? `${err.message}: ${err.cause.message}` : err.message;
@@ -10771,7 +10927,7 @@ async function forwardedSecrets(args) {
10771
10927
  }
10772
10928
  let parsed;
10773
10929
  try {
10774
- parsed = text === void 0 ? void 0 : (0, import_yaml2.parse)(text.trim(), { logLevel: "error" });
10930
+ parsed = text === void 0 ? void 0 : (0, import_yaml2.parse)(flowYamlSource(text), { logLevel: "error" });
10775
10931
  } catch {
10776
10932
  continue;
10777
10933
  }
@@ -10802,6 +10958,34 @@ function secretsTransportRefusal(url) {
10802
10958
  return void 0;
10803
10959
  }
10804
10960
  var FETCH_HEAD_BYTES = 256;
10961
+ function isRecord2(value) {
10962
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10963
+ }
10964
+ var PROJECT_PATH_ADVICE = {
10965
+ project_root: "Pass the absolute path to the project root directory - the same cwd the calling agent is working in.",
10966
+ e2e_test_path: "Pass the absolute path to the e2e test file."
10967
+ };
10968
+ function assertAbsoluteProjectPaths(meta, args) {
10969
+ if (!meta || !isRecord2(args)) return;
10970
+ const aliases = Object.entries(toolParamAliases(meta.name));
10971
+ for (const [param, advice] of Object.entries(PROJECT_PATH_ADVICE)) {
10972
+ const value = args[param];
10973
+ if (typeof value !== "string" || callerPath(value) === value) continue;
10974
+ const names = [param, ...aliases.filter(([, current]) => current === param).map(([f]) => f)];
10975
+ if (!meta.fileInputs?.some((spec) => names.some((n) => spec.path.includes(`\${${n}}`)))) {
10976
+ continue;
10977
+ }
10978
+ throw new Error(`${param} must be an absolute path (got "${value}"). ${advice}`);
10979
+ }
10980
+ }
10981
+ function failedRun(result) {
10982
+ if (!isRecord2(result)) return result;
10983
+ if (result.ok === true) return { ...result, ok: false };
10984
+ if (isRecord2(result.toolResult) && result.toolResult.ok === true) {
10985
+ return { ...result, toolResult: { ...result.toolResult, ok: false } };
10986
+ }
10987
+ return result;
10988
+ }
10805
10989
  function createToolsClient(options = {}) {
10806
10990
  let cached = null;
10807
10991
  const doFetch = options.fetchImpl ?? ((url, init) => fetch(url, init));
@@ -10846,10 +11030,12 @@ function createToolsClient(options = {}) {
10846
11030
  }
10847
11031
  async function callTool(name, args, opts) {
10848
11032
  opts?.signal?.throwIfAborted();
11033
+ assertFiniteNumbers(args);
10849
11034
  const { url, token, remote } = await route();
10850
11035
  let finalArgs = canonicalToolArgs(name, args);
10851
11036
  const { tools, uploadFormats } = await fetchToolList({ signal: opts?.signal });
10852
11037
  const meta = findTool(tools, name);
11038
+ if (options.refuseRelativeProjectPaths) assertAbsoluteProjectPaths(meta, finalArgs);
10853
11039
  const olderServer = meta !== null && !tools.some((t) => t.name === canonicalToolId(meta.name));
10854
11040
  if (meta) {
10855
11041
  finalArgs = await nameToE2ePathForOlderServer(meta.name, meta.fileInputs, finalArgs);
@@ -10887,7 +11073,7 @@ function createToolsClient(options = {}) {
10887
11073
  }
10888
11074
  }
10889
11075
  }
10890
- const result = applied.result;
11076
+ const result = applied.failed.length > 0 ? failedRun(applied.result) : applied.result;
10891
11077
  if (shadowWarning === void 0 || typeof result !== "object" || result === null || Array.isArray(result) || typeof result.warning === "string") {
10892
11078
  return result;
10893
11079
  }
@@ -11014,10 +11200,19 @@ function createToolsClient(options = {}) {
11014
11200
  }
11015
11201
 
11016
11202
  // ../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";
11203
+ import {
11204
+ copyFile,
11205
+ mkdir as mkdir4,
11206
+ mkdtemp,
11207
+ readFile as readFile6,
11208
+ realpath as realpath4,
11209
+ rm as rm3,
11210
+ stat as stat5,
11211
+ writeFile as writeFile4
11212
+ } from "node:fs/promises";
11018
11213
  import { constants as fsConstants } from "node:fs";
11019
11214
  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";
11215
+ 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
11216
  import { createHash as createHash3 } from "node:crypto";
11022
11217
  var ARTIFACT_MARKER2 = "__argentArtifact";
11023
11218
  function isArtifactHandle(value) {
@@ -11065,8 +11260,8 @@ function configuredRecordingsDir() {
11065
11260
  const trimmed = value.trim();
11066
11261
  if (trimmed === "") return null;
11067
11262
  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);
11263
+ const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join13(home, trimmed.slice(2)) : trimmed;
11264
+ return resolve10(durableBaseDir(), expanded);
11070
11265
  }
11071
11266
  var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
11072
11267
  async function readCapped(res, cap) {
@@ -11113,7 +11308,7 @@ async function writeDurableUnique(dir, filename, write) {
11113
11308
  function durableSaveTarget(handle) {
11114
11309
  if (typeof handle.saveDir !== "string" || !handle.saveDir || handle.archive) return null;
11115
11310
  const rel = normalize2(handle.saveDir);
11116
- if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep4}`) || rel.split(sep4).includes("..")) {
11311
+ if (isAbsolute6(rel) || rel === ".." || rel.startsWith(`..${sep5}`) || rel.split(sep5).includes("..")) {
11117
11312
  return null;
11118
11313
  }
11119
11314
  if (!ALLOWED_SAVE_DIRS.has(rel)) return null;
@@ -11158,16 +11353,22 @@ async function resolveLocalFile(handle) {
11158
11353
  return null;
11159
11354
  }
11160
11355
  }
11161
- async function downloadAndExtractArchive(handle, data, dir) {
11162
- const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
11356
+ async function downloadAndExtractArchive(handle, data, dir, signal) {
11357
+ signal?.throwIfAborted();
11358
+ const attemptDir = await mkdtemp(join13(dir, "bundle-"));
11359
+ const tarball = join13(attemptDir, "download.tar");
11360
+ const extractDir = join13(attemptDir, "files");
11163
11361
  try {
11164
- await writeFile4(tarball, data);
11165
- return await safeExtractArchive(tarball, dir, handle.filename);
11362
+ await writeFile4(tarball, data, { signal });
11363
+ await mkdir4(extractDir);
11364
+ const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
11365
+ await rm3(tarball);
11366
+ signal?.throwIfAborted();
11367
+ return member;
11166
11368
  } catch {
11167
- return null;
11168
- } finally {
11169
- await rm3(tarball, { force: true }).catch(() => {
11369
+ await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
11170
11370
  });
11371
+ return null;
11171
11372
  }
11172
11373
  }
11173
11374
  async function materializeArtifacts(result, ctx) {
@@ -11253,7 +11454,7 @@ async function materializeArtifacts(result, ctx) {
11253
11454
  if (!data) return null;
11254
11455
  await ensureDir();
11255
11456
  if (value.archive === "tar.gz") {
11256
- return await downloadAndExtractArchive(value, data, dir);
11457
+ return await downloadAndExtractArchive(value, data, dir, ctx.signal);
11257
11458
  }
11258
11459
  if (value.size > 0 && data.length !== value.size) return null;
11259
11460
  const downloadedPath = join13(dir, sanitizeSegment(value.filename));
@@ -11290,12 +11491,12 @@ function getDeviceIdFromArgs(args) {
11290
11491
  }
11291
11492
 
11292
11493
  // src/bundled-paths.ts
11293
- import * as fs7 from "node:fs";
11494
+ import * as fs8 from "node:fs";
11294
11495
  import * as path13 from "node:path";
11295
11496
  function readPackageVersion() {
11296
11497
  try {
11297
11498
  const pkg = JSON.parse(
11298
- fs7.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
11499
+ fs8.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
11299
11500
  );
11300
11501
  return pkg.version;
11301
11502
  } catch {
@@ -11306,9 +11507,9 @@ var PACKAGE_NAME = "@swmansion/argent";
11306
11507
  function findDeclaringRoot(startDir) {
11307
11508
  let dir = startDir;
11308
11509
  for (; ; ) {
11309
- if (fs7.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
11510
+ if (fs8.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
11310
11511
  try {
11311
- const manifest = JSON.parse(fs7.readFileSync(path13.join(dir, "package.json"), "utf8"));
11512
+ const manifest = JSON.parse(fs8.readFileSync(path13.join(dir, "package.json"), "utf8"));
11312
11513
  if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
11313
11514
  return dir;
11314
11515
  }
@@ -11324,7 +11525,7 @@ function findStablePackageDir(startDir, packageRoot) {
11324
11525
  for (; ; ) {
11325
11526
  const candidate = path13.join(dir, "node_modules", PACKAGE_NAME);
11326
11527
  try {
11327
- if (fs7.realpathSync(candidate) === packageRoot) return candidate;
11528
+ if (fs8.realpathSync(candidate) === packageRoot) return candidate;
11328
11529
  } catch {
11329
11530
  }
11330
11531
  const parent = path13.dirname(dir);
@@ -11337,7 +11538,7 @@ function classifyInstall() {
11337
11538
  let dir;
11338
11539
  let cwd;
11339
11540
  try {
11340
- packageRoot = fs7.realpathSync(path13.join(import.meta.dirname, ".."));
11541
+ packageRoot = fs8.realpathSync(path13.join(import.meta.dirname, ".."));
11341
11542
  cwd = process.cwd();
11342
11543
  dir = cwd;
11343
11544
  } catch {
@@ -11345,7 +11546,7 @@ function classifyInstall() {
11345
11546
  }
11346
11547
  for (; ; ) {
11347
11548
  try {
11348
- const nmReal = fs7.realpathSync(path13.join(dir, "node_modules"));
11549
+ const nmReal = fs8.realpathSync(path13.join(dir, "node_modules"));
11349
11550
  if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path13.sep)) {
11350
11551
  return {
11351
11552
  kind: "local",