@swmansion/argent 0.34.1-next.3 → 0.34.1-next.30

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 (50) 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 +710 -412
  16. package/dist/client.js +202 -107
  17. package/dist/installer-help.js +4 -0
  18. package/dist/installer-help.js.map +1 -1
  19. package/dist/installer.mjs +1070 -837
  20. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
  21. package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
  22. package/dist/mcp-server.mjs +384 -621
  23. package/dist/preview-ui/index.html +28 -2
  24. package/dist/tool-args.generated.d.ts +38 -8
  25. package/dist/tool-server.cjs +6821 -3369
  26. package/dylibs/libArgentAudio.dylib +0 -0
  27. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  28. package/dylibs/libKeyboardPatch.dylib +0 -0
  29. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  30. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  31. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  32. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  33. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  34. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  35. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  36. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  37. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  38. package/package.json +1 -1
  39. package/rules/argent.md +6 -23
  40. package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
  41. package/skills/argent-create-e2e/references/live-authoring.md +1 -1
  42. package/skills/argent-device-interact/references/foldables.md +22 -0
  43. package/skills/argent-ios-device-interact/SKILL.md +2 -2
  44. package/skills/argent-macos-app-interact/SKILL.md +15 -5
  45. package/skills/argent-macos-app-interact/references/e2e.md +1 -1
  46. package/skills/argent-native-profiler/SKILL.md +14 -2
  47. package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
  48. package/skills/argent-react-native-optimization/SKILL.md +10 -1
  49. package/skills/argent-react-native-profiler/SKILL.md +4 -3
  50. package/skills/argent-screen-recording/SKILL.md +3 -2
@@ -2990,7 +2990,7 @@ var require_compile = __commonJS({
2990
2990
  const schOrFunc = root.refs[ref];
2991
2991
  if (schOrFunc)
2992
2992
  return schOrFunc;
2993
- let _sch = resolve10.call(this, root, ref);
2993
+ let _sch = resolve11.call(this, root, ref);
2994
2994
  if (_sch === void 0) {
2995
2995
  const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref];
2996
2996
  const { schemaId } = this.opts;
@@ -3017,7 +3017,7 @@ var require_compile = __commonJS({
3017
3017
  function sameSchemaEnv(s1, s2) {
3018
3018
  return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
3019
3019
  }
3020
- function resolve10(root, ref) {
3020
+ function resolve11(root, ref) {
3021
3021
  let sch;
3022
3022
  while (typeof (sch = this.refs[ref]) == "string")
3023
3023
  ref = sch;
@@ -3235,8 +3235,8 @@ var require_utils = __commonJS({
3235
3235
  }
3236
3236
  return ind;
3237
3237
  }
3238
- function removeDotSegments(path17) {
3239
- let input = path17;
3238
+ function removeDotSegments(path18) {
3239
+ let input = path18;
3240
3240
  const output = [];
3241
3241
  let nextSlash = -1;
3242
3242
  let len = 0;
@@ -3488,8 +3488,8 @@ var require_schemes = __commonJS({
3488
3488
  wsComponent.secure = void 0;
3489
3489
  }
3490
3490
  if (wsComponent.resourceName) {
3491
- const [path17, query] = wsComponent.resourceName.split("?");
3492
- wsComponent.path = path17 && path17 !== "/" ? path17 : void 0;
3491
+ const [path18, query] = wsComponent.resourceName.split("?");
3492
+ wsComponent.path = path18 && path18 !== "/" ? path18 : void 0;
3493
3493
  wsComponent.query = query;
3494
3494
  wsComponent.resourceName = void 0;
3495
3495
  }
@@ -3648,7 +3648,7 @@ var require_fast_uri = __commonJS({
3648
3648
  }
3649
3649
  return uri;
3650
3650
  }
3651
- function resolve10(baseURI, relativeURI, options) {
3651
+ function resolve11(baseURI, relativeURI, options) {
3652
3652
  const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
3653
3653
  const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
3654
3654
  schemelessOptions.skipEscape = true;
@@ -3906,7 +3906,7 @@ var require_fast_uri = __commonJS({
3906
3906
  var fastUri = {
3907
3907
  SCHEMES,
3908
3908
  normalize: normalize3,
3909
- resolve: resolve10,
3909
+ resolve: resolve11,
3910
3910
  resolveComponent,
3911
3911
  equal,
3912
3912
  serialize,
@@ -6882,12 +6882,12 @@ var require_dist = __commonJS({
6882
6882
  throw new Error(`Unknown format "${name}"`);
6883
6883
  return f;
6884
6884
  };
6885
- function addFormats(ajv, list, fs12, exportName) {
6885
+ function addFormats(ajv, list, fs13, exportName) {
6886
6886
  var _a3;
6887
6887
  var _b;
6888
6888
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
6889
6889
  for (const f of list)
6890
- ajv.addFormat(f, fs12[f]);
6890
+ ajv.addFormat(f, fs13[f]);
6891
6891
  }
6892
6892
  module.exports = exports = formatsPlugin;
6893
6893
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -6972,17 +6972,17 @@ var require_visit = __commonJS({
6972
6972
  visit.BREAK = BREAK;
6973
6973
  visit.SKIP = SKIP;
6974
6974
  visit.REMOVE = REMOVE;
6975
- function visit_(key, node2, visitor, path17) {
6976
- const ctrl = callVisitor(key, node2, visitor, path17);
6975
+ function visit_(key, node2, visitor, path18) {
6976
+ const ctrl = callVisitor(key, node2, visitor, path18);
6977
6977
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
6978
- replaceNode(key, path17, ctrl);
6979
- return visit_(key, ctrl, visitor, path17);
6978
+ replaceNode(key, path18, ctrl);
6979
+ return visit_(key, ctrl, visitor, path18);
6980
6980
  }
6981
6981
  if (typeof ctrl !== "symbol") {
6982
6982
  if (identity.isCollection(node2)) {
6983
- path17 = Object.freeze(path17.concat(node2));
6983
+ path18 = Object.freeze(path18.concat(node2));
6984
6984
  for (let i = 0; i < node2.items.length; ++i) {
6985
- const ci = visit_(i, node2.items[i], visitor, path17);
6985
+ const ci = visit_(i, node2.items[i], visitor, path18);
6986
6986
  if (typeof ci === "number")
6987
6987
  i = ci - 1;
6988
6988
  else if (ci === BREAK)
@@ -6993,13 +6993,13 @@ var require_visit = __commonJS({
6993
6993
  }
6994
6994
  }
6995
6995
  } else if (identity.isPair(node2)) {
6996
- path17 = Object.freeze(path17.concat(node2));
6997
- const ck = visit_("key", node2.key, visitor, path17);
6996
+ path18 = Object.freeze(path18.concat(node2));
6997
+ const ck = visit_("key", node2.key, visitor, path18);
6998
6998
  if (ck === BREAK)
6999
6999
  return BREAK;
7000
7000
  else if (ck === REMOVE)
7001
7001
  node2.key = null;
7002
- const cv = visit_("value", node2.value, visitor, path17);
7002
+ const cv = visit_("value", node2.value, visitor, path18);
7003
7003
  if (cv === BREAK)
7004
7004
  return BREAK;
7005
7005
  else if (cv === REMOVE)
@@ -7020,17 +7020,17 @@ var require_visit = __commonJS({
7020
7020
  visitAsync.BREAK = BREAK;
7021
7021
  visitAsync.SKIP = SKIP;
7022
7022
  visitAsync.REMOVE = REMOVE;
7023
- async function visitAsync_(key, node2, visitor, path17) {
7024
- const ctrl = await callVisitor(key, node2, visitor, path17);
7023
+ async function visitAsync_(key, node2, visitor, path18) {
7024
+ const ctrl = await callVisitor(key, node2, visitor, path18);
7025
7025
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
7026
- replaceNode(key, path17, ctrl);
7027
- return visitAsync_(key, ctrl, visitor, path17);
7026
+ replaceNode(key, path18, ctrl);
7027
+ return visitAsync_(key, ctrl, visitor, path18);
7028
7028
  }
7029
7029
  if (typeof ctrl !== "symbol") {
7030
7030
  if (identity.isCollection(node2)) {
7031
- path17 = Object.freeze(path17.concat(node2));
7031
+ path18 = Object.freeze(path18.concat(node2));
7032
7032
  for (let i = 0; i < node2.items.length; ++i) {
7033
- const ci = await visitAsync_(i, node2.items[i], visitor, path17);
7033
+ const ci = await visitAsync_(i, node2.items[i], visitor, path18);
7034
7034
  if (typeof ci === "number")
7035
7035
  i = ci - 1;
7036
7036
  else if (ci === BREAK)
@@ -7041,13 +7041,13 @@ var require_visit = __commonJS({
7041
7041
  }
7042
7042
  }
7043
7043
  } else if (identity.isPair(node2)) {
7044
- path17 = Object.freeze(path17.concat(node2));
7045
- const ck = await visitAsync_("key", node2.key, visitor, path17);
7044
+ path18 = Object.freeze(path18.concat(node2));
7045
+ const ck = await visitAsync_("key", node2.key, visitor, path18);
7046
7046
  if (ck === BREAK)
7047
7047
  return BREAK;
7048
7048
  else if (ck === REMOVE)
7049
7049
  node2.key = null;
7050
- const cv = await visitAsync_("value", node2.value, visitor, path17);
7050
+ const cv = await visitAsync_("value", node2.value, visitor, path18);
7051
7051
  if (cv === BREAK)
7052
7052
  return BREAK;
7053
7053
  else if (cv === REMOVE)
@@ -7074,23 +7074,23 @@ var require_visit = __commonJS({
7074
7074
  }
7075
7075
  return visitor;
7076
7076
  }
7077
- function callVisitor(key, node2, visitor, path17) {
7077
+ function callVisitor(key, node2, visitor, path18) {
7078
7078
  if (typeof visitor === "function")
7079
- return visitor(key, node2, path17);
7079
+ return visitor(key, node2, path18);
7080
7080
  if (identity.isMap(node2))
7081
- return visitor.Map?.(key, node2, path17);
7081
+ return visitor.Map?.(key, node2, path18);
7082
7082
  if (identity.isSeq(node2))
7083
- return visitor.Seq?.(key, node2, path17);
7083
+ return visitor.Seq?.(key, node2, path18);
7084
7084
  if (identity.isPair(node2))
7085
- return visitor.Pair?.(key, node2, path17);
7085
+ return visitor.Pair?.(key, node2, path18);
7086
7086
  if (identity.isScalar(node2))
7087
- return visitor.Scalar?.(key, node2, path17);
7087
+ return visitor.Scalar?.(key, node2, path18);
7088
7088
  if (identity.isAlias(node2))
7089
- return visitor.Alias?.(key, node2, path17);
7089
+ return visitor.Alias?.(key, node2, path18);
7090
7090
  return void 0;
7091
7091
  }
7092
- function replaceNode(key, path17, node2) {
7093
- const parent = path17[path17.length - 1];
7092
+ function replaceNode(key, path18, node2) {
7093
+ const parent = path18[path18.length - 1];
7094
7094
  if (identity.isCollection(parent)) {
7095
7095
  parent.items[key] = node2;
7096
7096
  } else if (identity.isPair(parent)) {
@@ -7702,10 +7702,10 @@ var require_Collection = __commonJS({
7702
7702
  var createNode = require_createNode();
7703
7703
  var identity = require_identity();
7704
7704
  var Node = require_Node();
7705
- function collectionFromPath(schema, path17, value) {
7705
+ function collectionFromPath(schema, path18, value) {
7706
7706
  let v = value;
7707
- for (let i = path17.length - 1; i >= 0; --i) {
7708
- const k = path17[i];
7707
+ for (let i = path18.length - 1; i >= 0; --i) {
7708
+ const k = path18[i];
7709
7709
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
7710
7710
  const a = [];
7711
7711
  a[k] = v;
@@ -7724,7 +7724,7 @@ var require_Collection = __commonJS({
7724
7724
  sourceObjects: /* @__PURE__ */ new Map()
7725
7725
  });
7726
7726
  }
7727
- var isEmptyPath = (path17) => path17 == null || typeof path17 === "object" && !!path17[Symbol.iterator]().next().done;
7727
+ var isEmptyPath = (path18) => path18 == null || typeof path18 === "object" && !!path18[Symbol.iterator]().next().done;
7728
7728
  var Collection = class extends Node.NodeBase {
7729
7729
  constructor(type, schema) {
7730
7730
  super(type);
@@ -7754,11 +7754,11 @@ var require_Collection = __commonJS({
7754
7754
  * be a Pair instance or a `{ key, value }` object, which may not have a key
7755
7755
  * that already exists in the map.
7756
7756
  */
7757
- addIn(path17, value) {
7758
- if (isEmptyPath(path17))
7757
+ addIn(path18, value) {
7758
+ if (isEmptyPath(path18))
7759
7759
  this.add(value);
7760
7760
  else {
7761
- const [key, ...rest] = path17;
7761
+ const [key, ...rest] = path18;
7762
7762
  const node2 = this.get(key, true);
7763
7763
  if (identity.isCollection(node2))
7764
7764
  node2.addIn(rest, value);
@@ -7772,8 +7772,8 @@ var require_Collection = __commonJS({
7772
7772
  * Removes a value from the collection.
7773
7773
  * @returns `true` if the item was found and removed.
7774
7774
  */
7775
- deleteIn(path17) {
7776
- const [key, ...rest] = path17;
7775
+ deleteIn(path18) {
7776
+ const [key, ...rest] = path18;
7777
7777
  if (rest.length === 0)
7778
7778
  return this.delete(key);
7779
7779
  const node2 = this.get(key, true);
@@ -7787,8 +7787,8 @@ var require_Collection = __commonJS({
7787
7787
  * scalar values from their surrounding node; to disable set `keepScalar` to
7788
7788
  * `true` (collections are always returned intact).
7789
7789
  */
7790
- getIn(path17, keepScalar) {
7791
- const [key, ...rest] = path17;
7790
+ getIn(path18, keepScalar) {
7791
+ const [key, ...rest] = path18;
7792
7792
  const node2 = this.get(key, true);
7793
7793
  if (rest.length === 0)
7794
7794
  return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
@@ -7806,8 +7806,8 @@ var require_Collection = __commonJS({
7806
7806
  /**
7807
7807
  * Checks if the collection includes a value with the key `key`.
7808
7808
  */
7809
- hasIn(path17) {
7810
- const [key, ...rest] = path17;
7809
+ hasIn(path18) {
7810
+ const [key, ...rest] = path18;
7811
7811
  if (rest.length === 0)
7812
7812
  return this.has(key);
7813
7813
  const node2 = this.get(key, true);
@@ -7817,8 +7817,8 @@ var require_Collection = __commonJS({
7817
7817
  * Sets a value in this collection. For `!!set`, `value` needs to be a
7818
7818
  * boolean to add/remove the item from the set.
7819
7819
  */
7820
- setIn(path17, value) {
7821
- const [key, ...rest] = path17;
7820
+ setIn(path18, value) {
7821
+ const [key, ...rest] = path18;
7822
7822
  if (rest.length === 0) {
7823
7823
  this.set(key, value);
7824
7824
  } else {
@@ -10333,9 +10333,9 @@ var require_Document = __commonJS({
10333
10333
  this.contents.add(value);
10334
10334
  }
10335
10335
  /** Adds a value to the document. */
10336
- addIn(path17, value) {
10336
+ addIn(path18, value) {
10337
10337
  if (assertCollection(this.contents))
10338
- this.contents.addIn(path17, value);
10338
+ this.contents.addIn(path18, value);
10339
10339
  }
10340
10340
  /**
10341
10341
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -10410,14 +10410,14 @@ var require_Document = __commonJS({
10410
10410
  * Removes a value from the document.
10411
10411
  * @returns `true` if the item was found and removed.
10412
10412
  */
10413
- deleteIn(path17) {
10414
- if (Collection.isEmptyPath(path17)) {
10413
+ deleteIn(path18) {
10414
+ if (Collection.isEmptyPath(path18)) {
10415
10415
  if (this.contents == null)
10416
10416
  return false;
10417
10417
  this.contents = null;
10418
10418
  return true;
10419
10419
  }
10420
- return assertCollection(this.contents) ? this.contents.deleteIn(path17) : false;
10420
+ return assertCollection(this.contents) ? this.contents.deleteIn(path18) : false;
10421
10421
  }
10422
10422
  /**
10423
10423
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -10432,10 +10432,10 @@ var require_Document = __commonJS({
10432
10432
  * scalar values from their surrounding node; to disable set `keepScalar` to
10433
10433
  * `true` (collections are always returned intact).
10434
10434
  */
10435
- getIn(path17, keepScalar) {
10436
- if (Collection.isEmptyPath(path17))
10435
+ getIn(path18, keepScalar) {
10436
+ if (Collection.isEmptyPath(path18))
10437
10437
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
10438
- return identity.isCollection(this.contents) ? this.contents.getIn(path17, keepScalar) : void 0;
10438
+ return identity.isCollection(this.contents) ? this.contents.getIn(path18, keepScalar) : void 0;
10439
10439
  }
10440
10440
  /**
10441
10441
  * Checks if the document includes a value with the key `key`.
@@ -10446,10 +10446,10 @@ var require_Document = __commonJS({
10446
10446
  /**
10447
10447
  * Checks if the document includes a value at `path`.
10448
10448
  */
10449
- hasIn(path17) {
10450
- if (Collection.isEmptyPath(path17))
10449
+ hasIn(path18) {
10450
+ if (Collection.isEmptyPath(path18))
10451
10451
  return this.contents !== void 0;
10452
- return identity.isCollection(this.contents) ? this.contents.hasIn(path17) : false;
10452
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path18) : false;
10453
10453
  }
10454
10454
  /**
10455
10455
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -10466,13 +10466,13 @@ var require_Document = __commonJS({
10466
10466
  * Sets a value in this document. For `!!set`, `value` needs to be a
10467
10467
  * boolean to add/remove the item from the set.
10468
10468
  */
10469
- setIn(path17, value) {
10470
- if (Collection.isEmptyPath(path17)) {
10469
+ setIn(path18, value) {
10470
+ if (Collection.isEmptyPath(path18)) {
10471
10471
  this.contents = value;
10472
10472
  } else if (this.contents == null) {
10473
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path17), value);
10473
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path18), value);
10474
10474
  } else if (assertCollection(this.contents)) {
10475
- this.contents.setIn(path17, value);
10475
+ this.contents.setIn(path18, value);
10476
10476
  }
10477
10477
  }
10478
10478
  /**
@@ -12433,9 +12433,9 @@ var require_cst_visit = __commonJS({
12433
12433
  visit.BREAK = BREAK;
12434
12434
  visit.SKIP = SKIP;
12435
12435
  visit.REMOVE = REMOVE;
12436
- visit.itemAtPath = (cst, path17) => {
12436
+ visit.itemAtPath = (cst, path18) => {
12437
12437
  let item = cst;
12438
- for (const [field, index] of path17) {
12438
+ for (const [field, index] of path18) {
12439
12439
  const tok = item?.[field];
12440
12440
  if (tok && "items" in tok) {
12441
12441
  item = tok.items[index];
@@ -12444,23 +12444,23 @@ var require_cst_visit = __commonJS({
12444
12444
  }
12445
12445
  return item;
12446
12446
  };
12447
- visit.parentCollection = (cst, path17) => {
12448
- const parent = visit.itemAtPath(cst, path17.slice(0, -1));
12449
- const field = path17[path17.length - 1][0];
12447
+ visit.parentCollection = (cst, path18) => {
12448
+ const parent = visit.itemAtPath(cst, path18.slice(0, -1));
12449
+ const field = path18[path18.length - 1][0];
12450
12450
  const coll = parent?.[field];
12451
12451
  if (coll && "items" in coll)
12452
12452
  return coll;
12453
12453
  throw new Error("Parent collection not found");
12454
12454
  };
12455
- function _visit(path17, item, visitor) {
12456
- let ctrl = visitor(item, path17);
12455
+ function _visit(path18, item, visitor) {
12456
+ let ctrl = visitor(item, path18);
12457
12457
  if (typeof ctrl === "symbol")
12458
12458
  return ctrl;
12459
12459
  for (const field of ["key", "value"]) {
12460
12460
  const token = item[field];
12461
12461
  if (token && "items" in token) {
12462
12462
  for (let i = 0; i < token.items.length; ++i) {
12463
- const ci = _visit(Object.freeze(path17.concat([[field, i]])), token.items[i], visitor);
12463
+ const ci = _visit(Object.freeze(path18.concat([[field, i]])), token.items[i], visitor);
12464
12464
  if (typeof ci === "number")
12465
12465
  i = ci - 1;
12466
12466
  else if (ci === BREAK)
@@ -12471,10 +12471,10 @@ var require_cst_visit = __commonJS({
12471
12471
  }
12472
12472
  }
12473
12473
  if (typeof ctrl === "function" && field === "key")
12474
- ctrl = ctrl(item, path17);
12474
+ ctrl = ctrl(item, path18);
12475
12475
  }
12476
12476
  }
12477
- return typeof ctrl === "function" ? ctrl(item, path17) : ctrl;
12477
+ return typeof ctrl === "function" ? ctrl(item, path18) : ctrl;
12478
12478
  }
12479
12479
  exports.visit = visit;
12480
12480
  }
@@ -13776,14 +13776,14 @@ var require_parser = __commonJS({
13776
13776
  case "scalar":
13777
13777
  case "single-quoted-scalar":
13778
13778
  case "double-quoted-scalar": {
13779
- const fs12 = this.flowScalar(this.type);
13779
+ const fs13 = this.flowScalar(this.type);
13780
13780
  if (atNextItem || it.value) {
13781
- map.items.push({ start, key: fs12, sep: [] });
13781
+ map.items.push({ start, key: fs13, sep: [] });
13782
13782
  this.onKeyLine = true;
13783
13783
  } else if (it.sep) {
13784
- this.stack.push(fs12);
13784
+ this.stack.push(fs13);
13785
13785
  } else {
13786
- Object.assign(it, { key: fs12, sep: [] });
13786
+ Object.assign(it, { key: fs13, sep: [] });
13787
13787
  this.onKeyLine = true;
13788
13788
  }
13789
13789
  return;
@@ -13911,13 +13911,13 @@ var require_parser = __commonJS({
13911
13911
  case "scalar":
13912
13912
  case "single-quoted-scalar":
13913
13913
  case "double-quoted-scalar": {
13914
- const fs12 = this.flowScalar(this.type);
13914
+ const fs13 = this.flowScalar(this.type);
13915
13915
  if (!it || it.value)
13916
- fc.items.push({ start: [], key: fs12, sep: [] });
13916
+ fc.items.push({ start: [], key: fs13, sep: [] });
13917
13917
  else if (it.sep)
13918
- this.stack.push(fs12);
13918
+ this.stack.push(fs13);
13919
13919
  else
13920
- Object.assign(it, { key: fs12, sep: [] });
13920
+ Object.assign(it, { key: fs13, sep: [] });
13921
13921
  return;
13922
13922
  }
13923
13923
  case "flow-map-end":
@@ -14619,8 +14619,9 @@ var require_dist3 = __commonJS({
14619
14619
 
14620
14620
  // ../argent-mcp/src/mcp-server.ts
14621
14621
  import { appendFile, mkdir as mkdir5 } from "node:fs/promises";
14622
- import { dirname as dirname10 } from "node:path";
14622
+ import { dirname as dirname11 } from "node:path";
14623
14623
  import { homedir as homedir5 } from "node:os";
14624
+ import { setTimeout as sleep } from "node:timers/promises";
14624
14625
 
14625
14626
  // ../../node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
14626
14627
  import process2 from "node:process";
@@ -14862,10 +14863,10 @@ function mergeDefs(...defs) {
14862
14863
  function cloneDef(schema) {
14863
14864
  return mergeDefs(schema._zod.def);
14864
14865
  }
14865
- function getElementAtPath(obj, path17) {
14866
- if (!path17)
14866
+ function getElementAtPath(obj, path18) {
14867
+ if (!path18)
14867
14868
  return obj;
14868
- return path17.reduce((acc, key) => acc?.[key], obj);
14869
+ return path18.reduce((acc, key) => acc?.[key], obj);
14869
14870
  }
14870
14871
  function promiseAllObject(promisesObj) {
14871
14872
  const keys = Object.keys(promisesObj);
@@ -15205,11 +15206,11 @@ function explicitlyAborted(x, startIndex = 0) {
15205
15206
  }
15206
15207
  return false;
15207
15208
  }
15208
- function prefixIssues(path17, issues) {
15209
+ function prefixIssues(path18, issues) {
15209
15210
  return issues.map((iss) => {
15210
15211
  var _a3;
15211
15212
  (_a3 = iss).path ?? (_a3.path = []);
15212
- iss.path.unshift(path17);
15213
+ iss.path.unshift(path18);
15213
15214
  return iss;
15214
15215
  });
15215
15216
  }
@@ -15667,16 +15668,16 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
15667
15668
  }
15668
15669
  function formatError(error2, mapper = (issue2) => issue2.message) {
15669
15670
  const fieldErrors = { _errors: [] };
15670
- const processError = (error3, path17 = []) => {
15671
+ const processError = (error3, path18 = []) => {
15671
15672
  for (const issue2 of error3.issues) {
15672
15673
  if (issue2.code === "invalid_union" && issue2.errors.length) {
15673
- issue2.errors.map((issues) => processError({ issues }, [...path17, ...issue2.path]));
15674
+ issue2.errors.map((issues) => processError({ issues }, [...path18, ...issue2.path]));
15674
15675
  } else if (issue2.code === "invalid_key") {
15675
- processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
15676
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
15676
15677
  } else if (issue2.code === "invalid_element") {
15677
- processError({ issues: issue2.issues }, [...path17, ...issue2.path]);
15678
+ processError({ issues: issue2.issues }, [...path18, ...issue2.path]);
15678
15679
  } else {
15679
- const fullpath = [...path17, ...issue2.path];
15680
+ const fullpath = [...path18, ...issue2.path];
15680
15681
  if (fullpath.length === 0) {
15681
15682
  fieldErrors._errors.push(mapper(issue2));
15682
15683
  } else {
@@ -17976,7 +17977,7 @@ var recursive = /* @__PURE__ */ new WeakMap();
17976
17977
  var NONE = 0;
17977
17978
  var ASSUMED = 1;
17978
17979
  var PROVEN = 2;
17979
- function isRecursive(inst, stack, resolve10) {
17980
+ function isRecursive(inst, stack, resolve11) {
17980
17981
  const cached2 = recursive.get(inst);
17981
17982
  if (cached2 !== void 0)
17982
17983
  return cached2 ? PROVEN : NONE;
@@ -17986,7 +17987,7 @@ function isRecursive(inst, stack, resolve10) {
17986
17987
  let result = NONE;
17987
17988
  const check = (child) => {
17988
17989
  if (result !== PROVEN && child?._zod) {
17989
- const answer = isRecursive(child, stack, resolve10);
17990
+ const answer = isRecursive(child, stack, resolve11);
17990
17991
  if (answer > result)
17991
17992
  result = answer;
17992
17993
  }
@@ -17997,7 +17998,7 @@ function isRecursive(inst, stack, resolve10) {
17997
17998
  const desc = Object.getOwnPropertyDescriptor(sh, key);
17998
17999
  if (spread && !desc.enumerable)
17999
18000
  continue;
18000
- const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve10) : NONE;
18001
+ const child = desc.get ? ASSUMED : desc.value?._zod ? isRecursive(desc.value, stack, resolve11) : NONE;
18001
18002
  if (child > answer)
18002
18003
  answer = child;
18003
18004
  }
@@ -18061,7 +18062,7 @@ function isRecursive(inst, stack, resolve10) {
18061
18062
  break;
18062
18063
  // `$ZodLazy` caches its inner on the def, so a resolved edge is followed exactly
18063
18064
  case "lazy": {
18064
- const inner = def._cachedInner ?? (resolve10 ? inst._zod.innerType : void 0);
18065
+ const inner = def._cachedInner ?? (resolve11 ? inst._zod.innerType : void 0);
18065
18066
  merge2(inner ? isRecursive(inner, stack, false) : ASSUMED);
18066
18067
  break;
18067
18068
  }
@@ -22639,12 +22640,12 @@ var StdioServerTransport = class {
22639
22640
  this.onclose?.();
22640
22641
  }
22641
22642
  send(message) {
22642
- return new Promise((resolve10) => {
22643
+ return new Promise((resolve11) => {
22643
22644
  const json = serializeMessage(message);
22644
22645
  if (this._stdout.write(json)) {
22645
- resolve10();
22646
+ resolve11();
22646
22647
  } else {
22647
- this._stdout.once("drain", resolve10);
22648
+ this._stdout.once("drain", resolve11);
22648
22649
  }
22649
22650
  });
22650
22651
  }
@@ -23264,7 +23265,7 @@ var Protocol = class {
23264
23265
  return;
23265
23266
  }
23266
23267
  const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
23267
- await new Promise((resolve10) => setTimeout(resolve10, pollInterval));
23268
+ await new Promise((resolve11) => setTimeout(resolve11, pollInterval));
23268
23269
  options?.signal?.throwIfAborted();
23269
23270
  }
23270
23271
  } catch (error2) {
@@ -23281,7 +23282,7 @@ var Protocol = class {
23281
23282
  */
23282
23283
  request(request, resultSchema, options) {
23283
23284
  const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
23284
- return new Promise((resolve10, reject) => {
23285
+ return new Promise((resolve11, reject) => {
23285
23286
  const earlyReject = (error2) => {
23286
23287
  reject(error2);
23287
23288
  };
@@ -23359,7 +23360,7 @@ var Protocol = class {
23359
23360
  if (!parseResult.success) {
23360
23361
  reject(parseResult.error);
23361
23362
  } else {
23362
- resolve10(parseResult.data);
23363
+ resolve11(parseResult.data);
23363
23364
  }
23364
23365
  } catch (error2) {
23365
23366
  reject(error2);
@@ -23621,12 +23622,12 @@ var Protocol = class {
23621
23622
  }
23622
23623
  } catch {
23623
23624
  }
23624
- return new Promise((resolve10, reject) => {
23625
+ return new Promise((resolve11, reject) => {
23625
23626
  if (signal.aborted) {
23626
23627
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
23627
23628
  return;
23628
23629
  }
23629
- const timeoutId = setTimeout(resolve10, interval);
23630
+ const timeoutId = setTimeout(resolve11, interval);
23630
23631
  signal.addEventListener("abort", () => {
23631
23632
  clearTimeout(timeoutId);
23632
23633
  reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
@@ -24422,6 +24423,7 @@ var LOCK_FILE = path.join(STATE_DIR, "tool-server.lock");
24422
24423
  var AUTH_TOKEN_BYTES = 32;
24423
24424
  var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
24424
24425
  var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
24426
+ var AUTOSPAWN_HOST = "127.0.0.1";
24425
24427
  function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
24426
24428
  const env = {
24427
24429
  ...baseEnv,
@@ -24433,7 +24435,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
24433
24435
  if (options.idleTimeoutMinutes !== void 0) {
24434
24436
  env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
24435
24437
  }
24436
- if (options.token) env[AUTH_TOKEN_ENV] = options.token;
24438
+ env[AUTH_TOKEN_ENV] = options.token ?? "";
24437
24439
  if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
24438
24440
  if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
24439
24441
  return env;
@@ -24442,7 +24444,7 @@ function generateToken() {
24442
24444
  return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
24443
24445
  }
24444
24446
  function findFreePort() {
24445
- return new Promise((resolve10, reject) => {
24447
+ return new Promise((resolve11, reject) => {
24446
24448
  const srv = net.createServer();
24447
24449
  srv.listen(0, "127.0.0.1", () => {
24448
24450
  const addr = srv.address();
@@ -24453,7 +24455,7 @@ function findFreePort() {
24453
24455
  const port = addr.port;
24454
24456
  srv.close((err) => {
24455
24457
  if (err) reject(err);
24456
- else resolve10(port);
24458
+ else resolve11(port);
24457
24459
  });
24458
24460
  });
24459
24461
  srv.on("error", reject);
@@ -24550,8 +24552,12 @@ function killSpawnedChild(child, pid) {
24550
24552
  }
24551
24553
  }
24552
24554
  }
24555
+ function resolveToolsServerNode() {
24556
+ const { bun, deno, electron } = process.versions;
24557
+ return !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
24558
+ }
24553
24559
  function spawnToolsServer(paths, port, options = {}) {
24554
- return new Promise((resolve10, reject) => {
24560
+ return new Promise((resolve11, reject) => {
24555
24561
  let logFd;
24556
24562
  try {
24557
24563
  fs.mkdirSync(STATE_DIR, { recursive: true });
@@ -24559,8 +24565,7 @@ function spawnToolsServer(paths, port, options = {}) {
24559
24565
  } catch {
24560
24566
  logFd = fs.openSync("/dev/null", "w");
24561
24567
  }
24562
- const { bun, deno, electron } = process.versions;
24563
- const nodeBin = !(bun || deno || electron) && fs.existsSync(process.execPath) ? process.execPath : "node";
24568
+ const nodeBin = resolveToolsServerNode();
24564
24569
  const child = spawn(nodeBin, [paths.bundlePath, "start"], {
24565
24570
  detached: true,
24566
24571
  stdio: ["ignore", "pipe", logFd],
@@ -24598,7 +24603,7 @@ function spawnToolsServer(paths, port, options = {}) {
24598
24603
  rl.close();
24599
24604
  child.stdout?.resume();
24600
24605
  child.stdout?.unref?.();
24601
- settle2(() => resolve10({ port: actualPort, pid }));
24606
+ settle2(() => resolve11({ port: actualPort, pid }));
24602
24607
  }
24603
24608
  });
24604
24609
  child.on("error", (err) => {
@@ -24874,6 +24879,7 @@ async function ensureToolsServer(paths) {
24874
24879
  const port = await findFreePort();
24875
24880
  const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
24876
24881
  token,
24882
+ host: AUTOSPAWN_HOST,
24877
24883
  idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
24878
24884
  });
24879
24885
  await writeState({
@@ -24882,11 +24888,11 @@ async function ensureToolsServer(paths) {
24882
24888
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
24883
24889
  bundlePath: paths.bundlePath,
24884
24890
  version: diskVersion,
24885
- host: "127.0.0.1",
24891
+ host: AUTOSPAWN_HOST,
24886
24892
  token,
24887
24893
  managed: "autospawn"
24888
24894
  });
24889
- return { url: formatUrl("127.0.0.1", actualPort), token };
24895
+ return { url: formatUrl(AUTOSPAWN_HOST, actualPort), token };
24890
24896
  } finally {
24891
24897
  lock?.release();
24892
24898
  }
@@ -24939,6 +24945,11 @@ var FLAG_REGISTRY = [
24939
24945
  name: "forward-secrets",
24940
24946
  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."
24941
24947
  },
24948
+ {
24949
+ name: "ios-audio-always-inserted",
24950
+ 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.",
24951
+ defaultEnabled: true
24952
+ },
24942
24953
  {
24943
24954
  name: "video-watermark",
24944
24955
  description: "Overlay the argent corner watermark on recorded screen videos. On by default; turn it off with `argent disable video-watermark`.",
@@ -24946,7 +24957,7 @@ var FLAG_REGISTRY = [
24946
24957
  },
24947
24958
  {
24948
24959
  name: "macos-apps",
24949
- 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`.",
24960
+ 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`.",
24950
24961
  defaultEnabled: true
24951
24962
  }
24952
24963
  ];
@@ -25016,6 +25027,7 @@ function isFeatureEnabled(name, options = {}, registry2 = FLAG_REGISTRY) {
25016
25027
  }
25017
25028
 
25018
25029
  // ../configuration-core/src/paths.ts
25030
+ import * as fs3 from "node:fs";
25019
25031
  import * as os from "node:os";
25020
25032
  import * as path3 from "node:path";
25021
25033
  function nonEmpty(value) {
@@ -25027,6 +25039,16 @@ function resolveHomeDir(options = {}) {
25027
25039
  if (options.homeDir) return options.homeDir;
25028
25040
  return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
25029
25041
  }
25042
+ function isHomeDir(dir, options = {}) {
25043
+ return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
25044
+ }
25045
+ function canonicalPath(p) {
25046
+ try {
25047
+ return fs3.realpathSync.native(p);
25048
+ } catch {
25049
+ return path3.resolve(p);
25050
+ }
25051
+ }
25030
25052
  function argentHomeDir() {
25031
25053
  return path3.join(resolveHomeDir(), ".argent");
25032
25054
  }
@@ -25043,11 +25065,11 @@ function configFilePath(scope = "global", options = {}) {
25043
25065
 
25044
25066
  // ../configuration-core/src/config.ts
25045
25067
  import * as crypto from "node:crypto";
25046
- import * as fs3 from "node:fs";
25068
+ import * as fs4 from "node:fs";
25047
25069
  import * as path4 from "node:path";
25048
25070
  function readConfigObject(scope = "global", options = {}) {
25049
25071
  try {
25050
- const raw2 = fs3.readFileSync(configFilePath(scope, options), "utf8");
25072
+ const raw2 = fs4.readFileSync(configFilePath(scope, options), "utf8");
25051
25073
  const json = JSON.parse(raw2);
25052
25074
  if (json && typeof json === "object" && !Array.isArray(json)) {
25053
25075
  return json;
@@ -25092,9 +25114,9 @@ function acquireConfigLock(finalPath) {
25092
25114
  const deadline = Date.now() + LOCK_MAX_WAIT_MS;
25093
25115
  for (; ; ) {
25094
25116
  try {
25095
- const fd = fs3.openSync(lockPath, "wx", 384);
25117
+ const fd = fs4.openSync(lockPath, "wx", 384);
25096
25118
  try {
25097
- fs3.writeSync(fd, `${process.pid}
25119
+ fs4.writeSync(fd, `${process.pid}
25098
25120
  `);
25099
25121
  } catch {
25100
25122
  }
@@ -25102,8 +25124,8 @@ function acquireConfigLock(finalPath) {
25102
25124
  } catch (err) {
25103
25125
  if (err.code !== "EEXIST") return null;
25104
25126
  try {
25105
- if (Date.now() - fs3.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
25106
- fs3.unlinkSync(lockPath);
25127
+ if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS2) {
25128
+ fs4.unlinkSync(lockPath);
25107
25129
  continue;
25108
25130
  }
25109
25131
  } catch {
@@ -25115,35 +25137,35 @@ function acquireConfigLock(finalPath) {
25115
25137
  }
25116
25138
  function releaseConfigLock(lock) {
25117
25139
  try {
25118
- fs3.closeSync(lock.fd);
25140
+ fs4.closeSync(lock.fd);
25119
25141
  } catch {
25120
25142
  }
25121
25143
  try {
25122
- fs3.unlinkSync(lock.lockPath);
25144
+ fs4.unlinkSync(lock.lockPath);
25123
25145
  } catch {
25124
25146
  }
25125
25147
  }
25126
25148
  function updateConfig(mutate, scope = "global", options = {}) {
25127
25149
  const dir = configDir(scope, options);
25128
- fs3.mkdirSync(dir, { recursive: true });
25150
+ fs4.mkdirSync(dir, { recursive: true });
25129
25151
  const finalPath = configFilePath(scope, options);
25130
25152
  const lock = acquireConfigLock(finalPath);
25131
25153
  try {
25132
25154
  const next = readConfigObject(scope, options);
25133
25155
  mutate(next);
25134
25156
  const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
25135
- const fd = fs3.openSync(tmpPath, "wx", 384);
25157
+ const fd = fs4.openSync(tmpPath, "wx", 384);
25136
25158
  try {
25137
- fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
25138
- fs3.fsyncSync(fd);
25159
+ fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
25160
+ fs4.fsyncSync(fd);
25139
25161
  } finally {
25140
- fs3.closeSync(fd);
25162
+ fs4.closeSync(fd);
25141
25163
  }
25142
25164
  try {
25143
- fs3.renameSync(tmpPath, finalPath);
25165
+ fs4.renameSync(tmpPath, finalPath);
25144
25166
  } catch (err) {
25145
25167
  try {
25146
- fs3.unlinkSync(tmpPath);
25168
+ fs4.unlinkSync(tmpPath);
25147
25169
  } catch {
25148
25170
  }
25149
25171
  throw err;
@@ -25155,7 +25177,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
25155
25177
 
25156
25178
  // ../configuration-core/src/secrets.ts
25157
25179
  var import_dotenv = __toESM(require_dist3(), 1);
25158
- import * as fs4 from "node:fs";
25180
+ import * as fs5 from "node:fs";
25159
25181
  import * as path5 from "node:path";
25160
25182
  var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
25161
25183
  var SECRETS_FILE_NAME = "secrets.env";
@@ -25185,10 +25207,10 @@ function fileSource(filePath, exposure) {
25185
25207
  names: [],
25186
25208
  values: /* @__PURE__ */ new Map()
25187
25209
  };
25188
- if (!fs4.statSync(filePath, { throwIfNoEntry: false })) return absent;
25210
+ if (!fs5.statSync(filePath, { throwIfNoEntry: false })) return absent;
25189
25211
  let content;
25190
25212
  try {
25191
- content = fs4.readFileSync(filePath, "utf8");
25213
+ content = fs5.readFileSync(filePath, "utf8");
25192
25214
  } catch {
25193
25215
  return absent;
25194
25216
  }
@@ -25214,7 +25236,9 @@ function fileSource(filePath, exposure) {
25214
25236
  }
25215
25237
  function secretSources(options = {}) {
25216
25238
  const sources = [envSource(options.env ?? process.env)];
25217
- const projectRoot = findProjectRoot(options.cwd ?? process.cwd());
25239
+ const home = resolveHomeDir(options);
25240
+ const found = findProjectRoot(options.cwd ?? process.cwd());
25241
+ const projectRoot = found && isHomeDir(found, options) ? home : found;
25218
25242
  const filePaths = [];
25219
25243
  if (projectRoot) {
25220
25244
  filePaths.push({
@@ -25226,7 +25250,7 @@ function secretSources(options = {}) {
25226
25250
  }
25227
25251
  }
25228
25252
  filePaths.push({
25229
- path: path5.join(resolveHomeDir(options), ".argent", SECRETS_FILE_NAME),
25253
+ path: path5.join(home, ".argent", SECRETS_FILE_NAME),
25230
25254
  exposure: "dedicated"
25231
25255
  });
25232
25256
  const seen = /* @__PURE__ */ new Set();
@@ -25348,14 +25372,6 @@ var CONFIG_SCHEMA = [
25348
25372
  // drained/reset, not just the file rewritten.
25349
25373
  manageCommand: "argent telemetry"
25350
25374
  },
25351
- {
25352
- key: "allowlist.enabled",
25353
- 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.",
25354
- scopes: ["project", "global"],
25355
- parse: asBoolean,
25356
- merge: "prioritize-restrictive",
25357
- example: "false"
25358
- },
25359
25375
  {
25360
25376
  key: "lens.agent",
25361
25377
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -25506,7 +25522,18 @@ function interpolateFileInputPath(template, args) {
25506
25522
  });
25507
25523
  return missing ? null : out;
25508
25524
  }
25509
- var TOOL_FILE_EXTENSIONS = [".png", ".yaml"];
25525
+ var TOOL_FILE_EXTENSIONS = [
25526
+ ".png",
25527
+ ".yaml",
25528
+ ".wav",
25529
+ ".mp3",
25530
+ ".m4a",
25531
+ ".aac",
25532
+ ".caf",
25533
+ ".aif",
25534
+ ".aiff",
25535
+ ".flac"
25536
+ ];
25510
25537
  function hasToolFileExtension(file) {
25511
25538
  const name = file.toLowerCase();
25512
25539
  return TOOL_FILE_EXTENSIONS.some((extension) => name.endsWith(extension));
@@ -25520,16 +25547,16 @@ function toolStepFiles(specs, args) {
25520
25547
  }
25521
25548
  return files;
25522
25549
  }
25523
- function isClientFileArgument({ spec, path: path17 }) {
25524
- return spec.kind === "file" && spec.path === `\${${spec.target}}` && path17.startsWith("/") && hasToolFileExtension(path17);
25550
+ function isClientFileArgument({ spec, path: path18 }) {
25551
+ return spec.kind === "file" && spec.path === `\${${spec.target}}` && path18.startsWith("/") && hasToolFileExtension(path18);
25525
25552
  }
25526
25553
 
25527
25554
  // ../registry/src/flow-file-refs.ts
25528
- import * as fs6 from "node:fs/promises";
25555
+ import * as fs7 from "node:fs/promises";
25529
25556
  import * as path8 from "node:path";
25530
25557
 
25531
25558
  // ../registry/src/e2e-dirs.ts
25532
- import * as fs5 from "node:fs/promises";
25559
+ import * as fs6 from "node:fs/promises";
25533
25560
  import * as path7 from "node:path";
25534
25561
  var E2E_DIR = path7.join(".argent", "e2e");
25535
25562
  var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
@@ -25544,7 +25571,7 @@ function e2eFileCandidates(projectRoot, name) {
25544
25571
  return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
25545
25572
  }
25546
25573
  async function exists(file) {
25547
- return fs5.stat(file).then(
25574
+ return fs6.stat(file).then(
25548
25575
  () => true,
25549
25576
  () => false
25550
25577
  );
@@ -25635,10 +25662,10 @@ function canonicalToolArgs(tool, args) {
25635
25662
  // ../registry/src/flow-file-refs.ts
25636
25663
  async function canonicalFlowPath(p) {
25637
25664
  try {
25638
- return await fs6.realpath(p);
25665
+ return await fs7.realpath(p);
25639
25666
  } catch {
25640
25667
  try {
25641
- return path8.join(await fs6.realpath(path8.dirname(p)), path8.basename(p));
25668
+ return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
25642
25669
  } catch {
25643
25670
  return p;
25644
25671
  }
@@ -25684,15 +25711,15 @@ function collectFlowRequests(doc) {
25684
25711
  if (isRecord(doc)) visit(doc.steps, 0);
25685
25712
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
25686
25713
  }
25687
- function baselineKeyFor(canonicalPath, flowName) {
25688
- const stem = path8.basename(canonicalPath, ".yaml");
25714
+ function baselineKeyFor(canonicalPath2, flowName) {
25715
+ const stem = path8.basename(canonicalPath2, ".yaml");
25689
25716
  return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
25690
25717
  }
25691
25718
  function flowMemberKey(anchorDir, target) {
25692
25719
  return `${anchorDir}\0${target}`;
25693
25720
  }
25694
25721
  async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
25695
- const entries = await fs6.readdir(dir).catch(() => null);
25722
+ const entries = await fs7.readdir(dir).catch(() => null);
25696
25723
  if (entries === null || entries.includes(base)) return { state: "listed" };
25697
25724
  const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
25698
25725
  if (actual === void 0) return { state: "absent" };
@@ -25921,6 +25948,7 @@ var FAILURE_CODES = {
25921
25948
  DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
25922
25949
  DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
25923
25950
  DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
25951
+ DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
25924
25952
  DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
25925
25953
  DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
25926
25954
  DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
@@ -25995,6 +26023,32 @@ var FAILURE_CODES = {
25995
26023
  NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
25996
26024
  NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
25997
26025
  NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
26026
+ /**
26027
+ * native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
26028
+ * devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
26029
+ * @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
26030
+ */
26031
+ // Not macOS, or an Xcode that cannot record the launch on this target.
26032
+ LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
26033
+ // No usable iPhone or simulator was selected, or Argent's runner holds it.
26034
+ LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
26035
+ // The bundle_id app is not installed on the selected device.
26036
+ LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
26037
+ // The runner's xcodebuild failed on code signing or provisioning.
26038
+ LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
26039
+ // The iPhone's free developer profile has no slot for Argent's runner.
26040
+ LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
26041
+ // simctl could not wait for boot, find, launch or terminate the app.
26042
+ LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
26043
+ LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
26044
+ // xctrace could not export the TOC, the CPU samples or the first-frame marker.
26045
+ LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
26046
+ // The App Launch trace has no first frame of the app, so it has no launch window.
26047
+ LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
26048
+ // The XCTest launch run of Argent's runner failed.
26049
+ LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
26050
+ // The launch test ran, but Argent read no launch measurements from its result.
26051
+ LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
25998
26052
  // iOS and Android share one capture path (simulator-server frames into
25999
26053
  // ffmpeg), so these name the failing stage, not the device family.
26000
26054
  SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
@@ -26009,6 +26063,19 @@ var FAILURE_CODES = {
26009
26063
  SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
26010
26064
  SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
26011
26065
  SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
26066
+ // A cabled iPhone has no simulator-server: its frames come from a host-side
26067
+ // CoreMediaIO capture helper, which can fail in ways of its own.
26068
+ SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
26069
+ SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
26070
+ SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
26071
+ SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
26072
+ AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
26073
+ AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
26074
+ AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
26075
+ AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
26076
+ AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
26077
+ AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
26078
+ AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
26012
26079
  FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
26013
26080
  FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
26014
26081
  FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
@@ -26072,6 +26139,8 @@ var FAILURE_CODES = {
26072
26139
  MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
26073
26140
  MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
26074
26141
  MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
26142
+ /** The app's loaded Argent library lacks support for the requested operation. */
26143
+ MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
26075
26144
  KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
26076
26145
  KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
26077
26146
  KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
@@ -26141,13 +26210,19 @@ var FAILURE_COMMANDS = [
26141
26210
  "ax_service",
26142
26211
  "simulator_server",
26143
26212
  "ffmpeg",
26213
+ "afconvert",
26144
26214
  "cdp",
26145
26215
  "electron",
26146
26216
  "npm",
26147
26217
  "npx",
26148
26218
  "unknown",
26149
26219
  "devicectl",
26150
- "xcodebuild"
26220
+ "xcodebuild",
26221
+ "swiftc",
26222
+ // The host-side helper that captures a cabled iPhone's screen.
26223
+ "ios_screen_stream",
26224
+ // `xcrun xcresulttool`, which reads an XCTest result bundle.
26225
+ "xcresulttool"
26151
26226
  ];
26152
26227
  var FAILURE_SIGNAL_NAMES = [
26153
26228
  "SIGABRT",
@@ -26178,9 +26253,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
26178
26253
  import { randomUUID as randomUUID3 } from "node:crypto";
26179
26254
  import { AsyncLocalStorage } from "node:async_hooks";
26180
26255
  var resolvedDuringInvocation = new AsyncLocalStorage();
26181
- function valueAtPath(root, path17) {
26256
+ function valueAtPath(root, path18) {
26182
26257
  let current = root;
26183
- for (const key of path17) {
26258
+ for (const key of path18) {
26184
26259
  if (current === null || typeof current !== "object") return void 0;
26185
26260
  if (!Object.hasOwn(current, key)) return void 0;
26186
26261
  current = current[key];
@@ -26302,7 +26377,7 @@ import { spawn as spawn2 } from "node:child_process";
26302
26377
  import { once } from "node:events";
26303
26378
  import { createReadStream, createWriteStream } from "node:fs";
26304
26379
  import { open as open2, rm, readdir as readdir3 } from "node:fs/promises";
26305
- import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve6, sep as sep2 } from "node:path";
26380
+ import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
26306
26381
  import { Writable } from "node:stream";
26307
26382
  import { pipeline } from "node:stream/promises";
26308
26383
  import zlib from "node:zlib";
@@ -26400,7 +26475,7 @@ async function sniffFormat(archivePath) {
26400
26475
  }
26401
26476
  }
26402
26477
  var ZSTD_FRAME_MAGIC = 4247762216;
26403
- async function assertSingleCompleteZstdFrame(archivePath) {
26478
+ async function assertSingleCompleteZstdFrame(archivePath, signal) {
26404
26479
  const fh = await open2(archivePath, "r");
26405
26480
  try {
26406
26481
  const { size } = await fh.stat();
@@ -26410,6 +26485,7 @@ async function assertSingleCompleteZstdFrame(archivePath) {
26410
26485
  let pos = 0;
26411
26486
  const read = async (n) => {
26412
26487
  if (pos < windowStart || pos + n > windowEnd) {
26488
+ signal?.throwIfAborted();
26413
26489
  const { bytesRead } = await fh.read(window, 0, window.length, pos);
26414
26490
  windowStart = pos;
26415
26491
  windowEnd = pos + bytesRead;
@@ -26447,14 +26523,16 @@ function tarEnv(env) {
26447
26523
  const characterType = env.LC_ALL || env.LC_CTYPE || env.LANG || "";
26448
26524
  return /utf-?8/i.test(characterType) ? env : { ...env, LC_ALL: TAR_LOCALE };
26449
26525
  }
26450
- async function runTar(archive, args) {
26526
+ async function runTar(archive, args, signal) {
26451
26527
  const child = spawn2("tar", [...args, "-f", "-"], {
26528
+ signal,
26452
26529
  env: tarEnv(process.env)
26453
26530
  });
26454
- const exited = new Promise((res, rej) => {
26455
- child.on("error", rej);
26456
- child.on("close", res);
26531
+ let childError;
26532
+ child.on("error", (err) => {
26533
+ childError = err;
26457
26534
  });
26535
+ const closed = new Promise((resolve11) => child.once("close", resolve11));
26458
26536
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
26459
26537
  maxLines: MAX_LISTING_LINES,
26460
26538
  onOverflow: () => child.kill()
@@ -26481,12 +26559,15 @@ async function runTar(archive, args) {
26481
26559
  if (err) child.stdin?.destroy();
26482
26560
  done(err);
26483
26561
  }
26484
- })
26562
+ }),
26563
+ { signal }
26485
26564
  ).then(
26486
26565
  () => null,
26487
26566
  (err) => err
26488
26567
  );
26489
- const [code, feedError] = await Promise.all([exited, fed]);
26568
+ const [code, feedError] = await Promise.all([closed, fed]);
26569
+ signal?.throwIfAborted();
26570
+ if (childError) throw childError;
26490
26571
  if (stdout.overflowed()) {
26491
26572
  throw new Error(
26492
26573
  `tar ${args.join(" ")} listed more than ${MAX_LISTING_LINES} members or ${MAX_LISTING_BYTES >> 20} MiB`
@@ -26500,32 +26581,33 @@ async function runTar(archive, args) {
26500
26581
  function normalizeTarMemberPath(memberPath) {
26501
26582
  return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
26502
26583
  }
26503
- function isContainedPath(path17, windows = process.platform === "win32") {
26504
- const slashed = path17.replace(/\\/g, "/");
26584
+ function isContainedPath(path18, windows = process.platform === "win32") {
26585
+ const slashed = path18.replace(/\\/g, "/");
26505
26586
  const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
26506
26587
  return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
26507
26588
  }
26508
26589
  function isSafeTarMember(memberPath, destDir) {
26509
26590
  const normalized = normalizeTarMemberPath(memberPath);
26510
26591
  if (!isContainedPath(normalized)) return false;
26511
- const root = resolve6(destDir);
26512
- return resolve6(destDir, normalized).startsWith(root + sep2);
26592
+ const root = resolve7(destDir);
26593
+ return resolve7(destDir, normalized).startsWith(root + sep2);
26513
26594
  }
26514
- async function readListing(archive, args) {
26595
+ async function readListing(archive, args, signal) {
26515
26596
  try {
26516
- return await runTar(archive, args);
26597
+ return await runTar(archive, args, signal);
26517
26598
  } catch (err) {
26599
+ signal?.throwIfAborted();
26518
26600
  throw new ArchiveError(
26519
26601
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
26520
26602
  );
26521
26603
  }
26522
26604
  }
26523
- async function listTarMembers(archive) {
26524
- const stdout = await readListing(archive, ["-t"]);
26605
+ async function listTarMembers(archive, signal) {
26606
+ const stdout = await readListing(archive, ["-t"], signal);
26525
26607
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
26526
26608
  }
26527
- async function assertSafeMemberTypes(archive) {
26528
- const stdout = await readListing(archive, ["-tv"]);
26609
+ async function assertSafeMemberTypes(archive, signal) {
26610
+ const stdout = await readListing(archive, ["-tv"], signal);
26529
26611
  for (const line of stdout.split("\n")) {
26530
26612
  if (!line.trim()) continue;
26531
26613
  const type = line[0];
@@ -26545,8 +26627,8 @@ async function assertSafeMemberTypes(archive) {
26545
26627
  );
26546
26628
  }
26547
26629
  }
26548
- async function assertSafeArchive(archive, destDir) {
26549
- const members2 = await listTarMembers(archive);
26630
+ async function assertSafeArchive(archive, destDir, signal) {
26631
+ const members2 = await listTarMembers(archive, signal);
26550
26632
  if (members2.length === 0) {
26551
26633
  throw new ArchiveError("Archive is empty.");
26552
26634
  }
@@ -26555,7 +26637,7 @@ async function assertSafeArchive(archive, destDir) {
26555
26637
  throw new ArchiveError(`Archive contains an unsafe path "${member}" \u2014 refusing extraction.`);
26556
26638
  }
26557
26639
  }
26558
- await assertSafeMemberTypes(archive);
26640
+ await assertSafeMemberTypes(archive, signal);
26559
26641
  }
26560
26642
  async function resolveMember(destDir, expectedName) {
26561
26643
  const entries = await readdir3(destDir);
@@ -26570,19 +26652,24 @@ async function resolveMember(destDir, expectedName) {
26570
26652
  }
26571
26653
  return join9(destDir, real[0]);
26572
26654
  }
26573
- async function safeExtractArchive(archivePath, destDir, expectedName) {
26655
+ async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
26656
+ signal?.throwIfAborted();
26574
26657
  let archive;
26575
26658
  try {
26576
26659
  archive = { path: archivePath, format: await sniffFormat(archivePath) };
26577
- if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath);
26660
+ if (archive.format === "zstd") await assertSingleCompleteZstdFrame(archivePath, signal);
26578
26661
  } catch (err) {
26662
+ signal?.throwIfAborted();
26579
26663
  throw new ArchiveError(
26580
26664
  `Could not read archive: ${err instanceof Error ? err.message : String(err)}`
26581
26665
  );
26582
26666
  }
26583
- await assertSafeArchive(archive, destDir);
26584
- await runTar(archive, ["-x", "-C", destDir]);
26585
- return resolveMember(destDir, expectedName);
26667
+ await assertSafeArchive(archive, destDir, signal);
26668
+ signal?.throwIfAborted();
26669
+ await runTar(archive, ["-x", "-C", destDir], signal);
26670
+ const member = await resolveMember(destDir, expectedName);
26671
+ signal?.throwIfAborted();
26672
+ return member;
26586
26673
  }
26587
26674
 
26588
26675
  // ../argent-tools-client/src/errors.ts
@@ -26659,10 +26746,10 @@ function untrackArchive(archive) {
26659
26746
  for (const s of ARCHIVE_SIGNALS) process.removeListener(s, removeArchivesOnSignal);
26660
26747
  process.removeListener("exit", removePendingArchives);
26661
26748
  }
26662
- function sha256File(filePath) {
26663
- return new Promise((resolve10, reject) => {
26749
+ function sha256File(filePath, signal) {
26750
+ return new Promise((resolve11, reject) => {
26664
26751
  const hash = createHash2("sha256");
26665
- createReadStream2(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve10(hash.digest("hex"))).on("error", reject);
26752
+ createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve11(hash.digest("hex"))).on("error", reject);
26666
26753
  });
26667
26754
  }
26668
26755
  function toolServerError(text) {
@@ -26725,7 +26812,7 @@ async function uploadFile(sourcePath, endpoint, signal) {
26725
26812
  trackArchive(tarPath);
26726
26813
  try {
26727
26814
  await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
26728
- const contentHash = await sha256File(tarPath);
26815
+ const contentHash = await sha256File(tarPath, signal);
26729
26816
  return { uploadId: await uploadTar(tarPath, format, endpoint, signal), contentHash };
26730
26817
  } finally {
26731
26818
  untrackArchive(tarPath);
@@ -27768,10 +27855,19 @@ function createToolsClient(options = {}) {
27768
27855
  }
27769
27856
 
27770
27857
  // ../argent-tools-client/src/artifacts.ts
27771
- import { copyFile, mkdir as mkdir4, readFile as readFile6, realpath as realpath4, rm as rm3, stat as stat5, writeFile as writeFile4 } from "node:fs/promises";
27858
+ import {
27859
+ copyFile,
27860
+ mkdir as mkdir4,
27861
+ mkdtemp,
27862
+ readFile as readFile6,
27863
+ realpath as realpath4,
27864
+ rm as rm3,
27865
+ stat as stat5,
27866
+ writeFile as writeFile4
27867
+ } from "node:fs/promises";
27772
27868
  import { constants as fsConstants } from "node:fs";
27773
27869
  import { tmpdir as tmpdir2 } from "node:os";
27774
- 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";
27870
+ import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve9, sep as sep4 } from "node:path";
27775
27871
  import { createHash as createHash3 } from "node:crypto";
27776
27872
  var ARTIFACT_MARKER2 = "__argentArtifact";
27777
27873
  function isArtifactHandle(value) {
@@ -27820,7 +27916,7 @@ function configuredRecordingsDir() {
27820
27916
  if (trimmed === "") return null;
27821
27917
  const home = dirname9(argentHomeDir());
27822
27918
  const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep4}`) ? join13(home, trimmed.slice(2)) : trimmed;
27823
- return resolve8(durableBaseDir(), expanded);
27919
+ return resolve9(durableBaseDir(), expanded);
27824
27920
  }
27825
27921
  var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
27826
27922
  async function readCapped(res, cap) {
@@ -27853,10 +27949,10 @@ async function writeDurableUnique(dir, filename, write) {
27853
27949
  const stem = filename.slice(0, filename.length - ext.length);
27854
27950
  for (let i = 1; i <= 1e3; i++) {
27855
27951
  const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
27856
- const path17 = join13(dir, candidate);
27952
+ const path18 = join13(dir, candidate);
27857
27953
  try {
27858
- await write(path17);
27859
- return path17;
27954
+ await write(path18);
27955
+ return path18;
27860
27956
  } catch (err) {
27861
27957
  if (err?.code === "EEXIST") continue;
27862
27958
  throw err;
@@ -27912,16 +28008,22 @@ async function resolveLocalFile(handle) {
27912
28008
  return null;
27913
28009
  }
27914
28010
  }
27915
- async function downloadAndExtractArchive(handle, data, dir) {
27916
- const tarball = join13(dir, `${sanitizeSegment(handle.filename)}.tar.gz`);
28011
+ async function downloadAndExtractArchive(handle, data, dir, signal) {
28012
+ signal?.throwIfAborted();
28013
+ const attemptDir = await mkdtemp(join13(dir, "bundle-"));
28014
+ const tarball = join13(attemptDir, "download.tar");
28015
+ const extractDir = join13(attemptDir, "files");
27917
28016
  try {
27918
- await writeFile4(tarball, data);
27919
- return await safeExtractArchive(tarball, dir, handle.filename);
28017
+ await writeFile4(tarball, data, { signal });
28018
+ await mkdir4(extractDir);
28019
+ const member = await safeExtractArchive(tarball, extractDir, handle.filename, signal);
28020
+ await rm3(tarball);
28021
+ signal?.throwIfAborted();
28022
+ return member;
27920
28023
  } catch {
27921
- return null;
27922
- } finally {
27923
- await rm3(tarball, { force: true }).catch(() => {
28024
+ await rm3(attemptDir, { recursive: true, force: true }).catch(() => {
27924
28025
  });
28026
+ return null;
27925
28027
  }
27926
28028
  }
27927
28029
  async function materializeArtifacts(result, ctx) {
@@ -28007,7 +28109,7 @@ async function materializeArtifacts(result, ctx) {
28007
28109
  if (!data) return null;
28008
28110
  await ensureDir();
28009
28111
  if (value.archive === "tar.gz") {
28010
- return await downloadAndExtractArchive(value, data, dir);
28112
+ return await downloadAndExtractArchive(value, data, dir, ctx.signal);
28011
28113
  }
28012
28114
  if (value.size > 0 && data.length !== value.size) return null;
28013
28115
  const downloadedPath = join13(dir, sanitizeSegment(value.filename));
@@ -28044,7 +28146,7 @@ function getDeviceIdFromArgs(args) {
28044
28146
  }
28045
28147
 
28046
28148
  // ../telemetry/src/debug.ts
28047
- import * as fs7 from "node:fs";
28149
+ import * as fs8 from "node:fs";
28048
28150
 
28049
28151
  // ../telemetry/src/paths.ts
28050
28152
  import * as path13 from "node:path";
@@ -28066,7 +28168,8 @@ var DEVICE_KINDS = [
28066
28168
  "emulator",
28067
28169
  "vvd",
28068
28170
  "device",
28069
- "app"
28171
+ "app",
28172
+ "catalyst"
28070
28173
  ];
28071
28174
  var DEBUGGER_NOT_CONNECTED_REASONS = [
28072
28175
  "metro_not_running",
@@ -28226,7 +28329,8 @@ var ALLOWED = {
28226
28329
  install_mode: INSTALL_MODE
28227
28330
  },
28228
28331
  "installation:allowlist_decision": {
28229
- is_enabled: bool
28332
+ is_enabled: bool,
28333
+ decided_by: oneOf(["flag", "default", "prompt"])
28230
28334
  },
28231
28335
  "installation:stale_config_cleanup": {
28232
28336
  removed_count: COUNT,
@@ -28372,380 +28476,12 @@ import { randomUUID as randomUUID5 } from "node:crypto";
28372
28476
  // ../telemetry/src/cloud-agent-detect.ts
28373
28477
  import { existsSync as existsSync3 } from "node:fs";
28374
28478
 
28375
- // ../../node_modules/ci-info/vendors.json
28376
- var vendors_default = [
28377
- {
28378
- name: "Agola CI",
28379
- constant: "AGOLA",
28380
- env: "AGOLA_GIT_REF",
28381
- pr: "AGOLA_PULL_REQUEST_ID"
28382
- },
28383
- {
28384
- name: "Alpic",
28385
- constant: "ALPIC",
28386
- env: "ALPIC_HOST"
28387
- },
28388
- {
28389
- name: "Appcircle",
28390
- constant: "APPCIRCLE",
28391
- env: "AC_APPCIRCLE",
28392
- pr: {
28393
- env: "AC_GIT_PR",
28394
- ne: "false"
28395
- }
28396
- },
28397
- {
28398
- name: "AppVeyor",
28399
- constant: "APPVEYOR",
28400
- env: "APPVEYOR",
28401
- pr: "APPVEYOR_PULL_REQUEST_NUMBER"
28402
- },
28403
- {
28404
- name: "AWS CodeBuild",
28405
- constant: "CODEBUILD",
28406
- env: "CODEBUILD_BUILD_ARN",
28407
- pr: {
28408
- env: "CODEBUILD_WEBHOOK_EVENT",
28409
- any: [
28410
- "PULL_REQUEST_CREATED",
28411
- "PULL_REQUEST_UPDATED",
28412
- "PULL_REQUEST_REOPENED"
28413
- ]
28414
- }
28415
- },
28416
- {
28417
- name: "Azure Pipelines",
28418
- constant: "AZURE_PIPELINES",
28419
- env: "TF_BUILD",
28420
- pr: {
28421
- BUILD_REASON: "PullRequest"
28422
- }
28423
- },
28424
- {
28425
- name: "Bamboo",
28426
- constant: "BAMBOO",
28427
- env: "bamboo_planKey"
28428
- },
28429
- {
28430
- name: "Bitbucket Pipelines",
28431
- constant: "BITBUCKET",
28432
- env: "BITBUCKET_COMMIT",
28433
- pr: "BITBUCKET_PR_ID"
28434
- },
28435
- {
28436
- name: "Bitrise",
28437
- constant: "BITRISE",
28438
- env: "BITRISE_IO",
28439
- pr: "BITRISE_PULL_REQUEST"
28440
- },
28441
- {
28442
- name: "Buddy",
28443
- constant: "BUDDY",
28444
- env: "BUDDY_WORKSPACE_ID",
28445
- pr: "BUDDY_EXECUTION_PULL_REQUEST_ID"
28446
- },
28447
- {
28448
- name: "Buildkite",
28449
- constant: "BUILDKITE",
28450
- env: "BUILDKITE",
28451
- pr: {
28452
- env: "BUILDKITE_PULL_REQUEST",
28453
- ne: "false"
28454
- }
28455
- },
28456
- {
28457
- name: "CircleCI",
28458
- constant: "CIRCLE",
28459
- env: "CIRCLECI",
28460
- pr: "CIRCLE_PULL_REQUEST"
28461
- },
28462
- {
28463
- name: "Cirrus CI",
28464
- constant: "CIRRUS",
28465
- env: "CIRRUS_CI",
28466
- pr: "CIRRUS_PR"
28467
- },
28468
- {
28469
- name: "Cloudflare Pages",
28470
- constant: "CLOUDFLARE_PAGES",
28471
- env: "CF_PAGES"
28472
- },
28473
- {
28474
- name: "Cloudflare Workers",
28475
- constant: "CLOUDFLARE_WORKERS",
28476
- env: "WORKERS_CI"
28477
- },
28478
- {
28479
- name: "Codefresh",
28480
- constant: "CODEFRESH",
28481
- env: "CF_BUILD_ID",
28482
- pr: {
28483
- any: [
28484
- "CF_PULL_REQUEST_NUMBER",
28485
- "CF_PULL_REQUEST_ID"
28486
- ]
28487
- }
28488
- },
28489
- {
28490
- name: "Codemagic",
28491
- constant: "CODEMAGIC",
28492
- env: "CM_BUILD_ID",
28493
- pr: "CM_PULL_REQUEST"
28494
- },
28495
- {
28496
- name: "Codeship",
28497
- constant: "CODESHIP",
28498
- env: {
28499
- CI_NAME: "codeship"
28500
- }
28501
- },
28502
- {
28503
- name: "Drone",
28504
- constant: "DRONE",
28505
- env: "DRONE",
28506
- pr: {
28507
- DRONE_BUILD_EVENT: "pull_request"
28508
- }
28509
- },
28510
- {
28511
- name: "dsari",
28512
- constant: "DSARI",
28513
- env: "DSARI"
28514
- },
28515
- {
28516
- name: "Earthly",
28517
- constant: "EARTHLY",
28518
- env: "EARTHLY_CI"
28519
- },
28520
- {
28521
- name: "Expo Application Services",
28522
- constant: "EAS",
28523
- env: "EAS_BUILD"
28524
- },
28525
- {
28526
- name: "Gerrit",
28527
- constant: "GERRIT",
28528
- env: "GERRIT_PROJECT"
28529
- },
28530
- {
28531
- name: "Gitea Actions",
28532
- constant: "GITEA_ACTIONS",
28533
- env: "GITEA_ACTIONS"
28534
- },
28535
- {
28536
- name: "GitHub Actions",
28537
- constant: "GITHUB_ACTIONS",
28538
- env: "GITHUB_ACTIONS",
28539
- pr: {
28540
- GITHUB_EVENT_NAME: "pull_request"
28541
- }
28542
- },
28543
- {
28544
- name: "GitLab CI",
28545
- constant: "GITLAB",
28546
- env: "GITLAB_CI",
28547
- pr: "CI_MERGE_REQUEST_ID"
28548
- },
28549
- {
28550
- name: "GoCD",
28551
- constant: "GOCD",
28552
- env: "GO_PIPELINE_LABEL"
28553
- },
28554
- {
28555
- name: "Google Cloud Build",
28556
- constant: "GOOGLE_CLOUD_BUILD",
28557
- env: "BUILDER_OUTPUT"
28558
- },
28559
- {
28560
- name: "Harness CI",
28561
- constant: "HARNESS",
28562
- env: "HARNESS_BUILD_ID"
28563
- },
28564
- {
28565
- name: "Heroku",
28566
- constant: "HEROKU",
28567
- env: {
28568
- env: "NODE",
28569
- includes: "/app/.heroku/node/bin/node"
28570
- }
28571
- },
28572
- {
28573
- name: "Hudson",
28574
- constant: "HUDSON",
28575
- env: "HUDSON_URL"
28576
- },
28577
- {
28578
- name: "Jenkins",
28579
- constant: "JENKINS",
28580
- env: [
28581
- "JENKINS_URL",
28582
- "BUILD_ID"
28583
- ],
28584
- pr: {
28585
- any: [
28586
- "ghprbPullId",
28587
- "CHANGE_ID"
28588
- ]
28589
- }
28590
- },
28591
- {
28592
- name: "LayerCI",
28593
- constant: "LAYERCI",
28594
- env: "LAYERCI",
28595
- pr: "LAYERCI_PULL_REQUEST"
28596
- },
28597
- {
28598
- name: "Magnum CI",
28599
- constant: "MAGNUM",
28600
- env: "MAGNUM"
28601
- },
28602
- {
28603
- name: "Netlify CI",
28604
- constant: "NETLIFY",
28605
- env: "NETLIFY",
28606
- pr: {
28607
- env: "PULL_REQUEST",
28608
- ne: "false"
28609
- }
28610
- },
28611
- {
28612
- name: "Nevercode",
28613
- constant: "NEVERCODE",
28614
- env: "NEVERCODE",
28615
- pr: {
28616
- env: "NEVERCODE_PULL_REQUEST",
28617
- ne: "false"
28618
- }
28619
- },
28620
- {
28621
- name: "Prow",
28622
- constant: "PROW",
28623
- env: "PROW_JOB_ID"
28624
- },
28625
- {
28626
- name: "ReleaseHub",
28627
- constant: "RELEASEHUB",
28628
- env: "RELEASE_BUILD_ID"
28629
- },
28630
- {
28631
- name: "Render",
28632
- constant: "RENDER",
28633
- env: "RENDER",
28634
- pr: {
28635
- IS_PULL_REQUEST: "true"
28636
- }
28637
- },
28638
- {
28639
- name: "Sail CI",
28640
- constant: "SAIL",
28641
- env: "SAILCI",
28642
- pr: "SAIL_PULL_REQUEST_NUMBER"
28643
- },
28644
- {
28645
- name: "Screwdriver",
28646
- constant: "SCREWDRIVER",
28647
- env: "SCREWDRIVER",
28648
- pr: {
28649
- env: "SD_PULL_REQUEST",
28650
- ne: "false"
28651
- }
28652
- },
28653
- {
28654
- name: "Semaphore",
28655
- constant: "SEMAPHORE",
28656
- env: "SEMAPHORE",
28657
- pr: "PULL_REQUEST_NUMBER"
28658
- },
28659
- {
28660
- name: "Sourcehut",
28661
- constant: "SOURCEHUT",
28662
- env: {
28663
- CI_NAME: "sourcehut"
28664
- }
28665
- },
28666
- {
28667
- name: "Strider CD",
28668
- constant: "STRIDER",
28669
- env: "STRIDER"
28670
- },
28671
- {
28672
- name: "TaskCluster",
28673
- constant: "TASKCLUSTER",
28674
- env: [
28675
- "TASK_ID",
28676
- "RUN_ID"
28677
- ]
28678
- },
28679
- {
28680
- name: "TeamCity",
28681
- constant: "TEAMCITY",
28682
- env: "TEAMCITY_VERSION"
28683
- },
28684
- {
28685
- name: "Travis CI",
28686
- constant: "TRAVIS",
28687
- env: "TRAVIS",
28688
- pr: {
28689
- env: "TRAVIS_PULL_REQUEST",
28690
- ne: "false"
28691
- }
28692
- },
28693
- {
28694
- name: "Vela",
28695
- constant: "VELA",
28696
- env: "VELA",
28697
- pr: {
28698
- VELA_PULL_REQUEST: "1"
28699
- }
28700
- },
28701
- {
28702
- name: "Vercel",
28703
- constant: "VERCEL",
28704
- env: {
28705
- any: [
28706
- "NOW_BUILDER",
28707
- "VERCEL"
28708
- ]
28709
- },
28710
- pr: "VERCEL_GIT_PULL_REQUEST_ID"
28711
- },
28712
- {
28713
- name: "Visual Studio App Center",
28714
- constant: "APPCENTER",
28715
- env: "APPCENTER_BUILD_ID"
28716
- },
28717
- {
28718
- name: "Woodpecker",
28719
- constant: "WOODPECKER",
28720
- env: {
28721
- CI: "woodpecker"
28722
- },
28723
- pr: {
28724
- CI_BUILD_EVENT: "pull_request"
28725
- }
28726
- },
28727
- {
28728
- name: "Xcode Cloud",
28729
- constant: "XCODE_CLOUD",
28730
- env: "CI_XCODE_PROJECT",
28731
- pr: "CI_PULL_REQUEST_NUMBER"
28732
- },
28733
- {
28734
- name: "Xcode Server",
28735
- constant: "XCODE_SERVER",
28736
- env: "XCS"
28737
- }
28738
- ];
28739
-
28740
- // ../telemetry/src/ci-detect.ts
28741
- var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
28742
-
28743
28479
  // ../telemetry/src/base-props.ts
28744
28480
  var SESSION_ID2 = randomUUID5();
28745
28481
 
28746
28482
  // ../telemetry/src/identity.ts
28747
28483
  import * as crypto2 from "node:crypto";
28748
- import * as fs8 from "node:fs";
28484
+ import * as fs9 from "node:fs";
28749
28485
  import * as path14 from "node:path";
28750
28486
 
28751
28487
  // ../telemetry/src/fingerprint.ts
@@ -28753,21 +28489,22 @@ import { execFileSync as execFileSync2, spawn as spawn3 } from "node:child_proce
28753
28489
 
28754
28490
  // ../native-devtools-ios/src/index.ts
28755
28491
  import * as path15 from "node:path";
28756
- import * as fs9 from "node:fs";
28492
+ import * as fs10 from "node:fs";
28757
28493
  var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path15.join(__dirname, "..", "dylibs");
28758
28494
  var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path15.join(__dirname, "..", "bin");
28759
28495
  var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path15.join(DYLIB_DIR, "tcp");
28760
28496
  var DYLIB_TVOS_DIR = path15.join(DYLIB_DIR, "tvos");
28761
28497
 
28762
28498
  // ../telemetry/src/consent.ts
28763
- import * as fs10 from "node:fs";
28499
+ import * as fs11 from "node:fs";
28500
+ import * as path16 from "node:path";
28764
28501
  var cache = /* @__PURE__ */ new Map();
28765
28502
  var sessionOverride = null;
28766
28503
  function readConfigOverrideAt(filePath) {
28767
28504
  const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
28768
28505
  let stats;
28769
28506
  try {
28770
- stats = fs10.lstatSync(filePath);
28507
+ stats = fs11.lstatSync(filePath);
28771
28508
  } catch {
28772
28509
  cache.set(filePath, miss);
28773
28510
  return null;
@@ -28784,7 +28521,7 @@ function readConfigOverrideAt(filePath) {
28784
28521
  }
28785
28522
  let parsedEnabled = null;
28786
28523
  try {
28787
- const raw2 = fs10.readFileSync(filePath, "utf8");
28524
+ const raw2 = fs11.readFileSync(filePath, "utf8");
28788
28525
  const json = JSON.parse(raw2);
28789
28526
  if (json && typeof json === "object") {
28790
28527
  const t = json.telemetry;
@@ -28802,7 +28539,8 @@ function readPersistedConsent(cwd) {
28802
28539
  const globalPath = configFilePath("global");
28803
28540
  const projectPath = configFilePath("project", { cwd });
28804
28541
  const global = readConfigOverrideAt(globalPath);
28805
- const project = projectPath === globalPath ? null : readConfigOverrideAt(projectPath);
28542
+ const projectRoot = path16.dirname(path16.dirname(projectPath));
28543
+ const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
28806
28544
  if (project === false && global === false) {
28807
28545
  return { enabled: false, detail: "config.json (project and global)" };
28808
28546
  }
@@ -28893,7 +28631,7 @@ var PNG_SIGNATURE = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
28893
28631
  function imageBlock(data, mimeType) {
28894
28632
  return { type: "image", data: data.toString("base64"), mimeType };
28895
28633
  }
28896
- async function fetchPngBytes(url) {
28634
+ async function fetchPngBytes(url, signal) {
28897
28635
  try {
28898
28636
  let buf;
28899
28637
  if (url.startsWith("file://")) {
@@ -28901,7 +28639,7 @@ async function fetchPngBytes(url) {
28901
28639
  const { fileURLToPath } = await import("node:url");
28902
28640
  buf = await readFile8(fileURLToPath(url));
28903
28641
  } else {
28904
- const res = await fetch(url);
28642
+ const res = await fetch(url, { signal });
28905
28643
  if (!res.ok) return null;
28906
28644
  buf = Buffer.from(await res.arrayBuffer());
28907
28645
  }
@@ -28924,7 +28662,7 @@ async function toMcpContent(result, outputHint, ctx, args) {
28924
28662
  blocks2.push(saved);
28925
28663
  return blocks2;
28926
28664
  }
28927
- return legacyImageContent(rewritten, suppressImage);
28665
+ return legacyImageContent(rewritten, suppressImage, ctx.signal);
28928
28666
  }
28929
28667
  const blocks = [{ type: "text", text: stringifyForText(rewritten) }];
28930
28668
  if (!suppressImage) for (const img of images) blocks.push(imageBlock(img.data, img.mimeType));
@@ -28938,13 +28676,13 @@ async function toMcpContent(result, outputHint, ctx, args) {
28938
28676
  function stringifyForText(value) {
28939
28677
  return JSON.stringify(value ?? null, null, 2);
28940
28678
  }
28941
- async function legacyImageContent(result, suppressImage) {
28679
+ async function legacyImageContent(result, suppressImage, signal) {
28942
28680
  if (result && typeof result === "object" && "url" in result) {
28943
28681
  const r = result;
28944
28682
  if (suppressImage) {
28945
28683
  return [{ type: "text", text: `Saved: ${r.path ?? ""}` }];
28946
28684
  }
28947
- const buf = await fetchPngBytes(r.url);
28685
+ const buf = await fetchPngBytes(r.url, signal);
28948
28686
  if (buf) {
28949
28687
  return [imageBlock(buf, "image/png"), { type: "text", text: `Saved: ${r.path ?? ""}` }];
28950
28688
  }
@@ -29061,9 +28799,9 @@ async function flowRunToMcpContent(result, ctx) {
29061
28799
  }
29062
28800
  }
29063
28801
  for (const write of result.baselineWrites ?? []) {
29064
- const { path: path17, error: error2 } = isRecord2(write) ? write : {};
29065
- if (typeof path17 === "string" && typeof error2 === "string") {
29066
- blocks.push({ type: "text", text: `\u2717 baseline not written: ${path17}: ${error2}` });
28802
+ const { path: path18, error: error2 } = isRecord2(write) ? write : {};
28803
+ if (typeof path18 === "string" && typeof error2 === "string") {
28804
+ blocks.push({ type: "text", text: `\u2717 baseline not written: ${path18}: ${error2}` });
29067
28805
  }
29068
28806
  }
29069
28807
  if (result.ok !== void 0) {
@@ -29227,7 +28965,7 @@ function treeIdLine(id) {
29227
28965
  return `Tree id: ${id}`;
29228
28966
  }
29229
28967
  function unchangedTreeNote(id, tool) {
29230
- return `Identical to element tree \`${id}\`, which an earlier \`${tool}\` result returned, so it is not repeated here: take elements and frames from that tree. The action can still have had an effect that the tree does not show, such as text typed in a field. Call \`describe\` if you do not have tree \`${id}\`.`;
28968
+ return `Element tree matches \`${id}\` from an earlier \`${tool}\` result. Actions may have effects the tree omits. Call \`describe\` if you lack that tree.`;
29231
28969
  }
29232
28970
  function randomTag() {
29233
28971
  return randomInt(36 ** 3).toString(36).padStart(3, "0");
@@ -29504,15 +29242,15 @@ ${stopped.join("\n")}`;
29504
29242
  }
29505
29243
 
29506
29244
  // ../argent-mcp/src/instructions.ts
29507
- var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. A result names an identical earlier tree by its tree id in place of repeating it. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup.";
29245
+ var SERVER_INSTRUCTIONS = "Argent \u2014 iOS Simulator, Android Emulator, and Chromium app control for interacting, testing, profiling and debugging mobile and Chromium applications. Use the platform the user named; otherwise prefer a device list-devices shows already running, and do not default to iOS. In a single-platform project, boot that platform. Prefer these tools over raw xcrun or adb commands, which are a fallback. Prefer launch-app or open-url over tapping home-screen icons. If the task may need a saved e2e test, load the argent-create-e2e skill (argent-qa-e2e for acceptance tests) before the first launch or in-app action: recording is not retroactive. Load the matching argent-* skill before React Native build or debug work, profiling, a physical phone, a Mac app or a TV. Interaction tools return the screen after the action: a screenshot plus the accessibility element tree with normalized tap frames. Take coordinates from that tree; call describe only when no fresh tree is available \u2014 never guess coordinates from pixels. A result names an identical earlier tree by its tree id in place of repeating it. If a tap fails twice, stop retrying and call a discovery tool again. Use await-ui-element to wait for the UI instead of polling with screenshots. Do not stop simulator servers when a task finishes: the next task reuses them. Call stop-all-simulator-servers when the user asks to clean up or ends the session, or when a skill tells you to recycle a device's services, always with devices: [...] naming the devices this session used. Never stop a Metro the user started unless they ask. One tool-server is shared by every agent using this argent install, so an unscoped call tears down their devices too \u2014 reserve it for a deliberate machine-wide cleanup. The argent CLI manages the toolkit: argent --help lists its commands.";
29508
29246
 
29509
29247
  // ../argent-mcp/src/installed-version.ts
29510
- import * as fs11 from "node:fs";
29511
- import * as path16 from "node:path";
29248
+ import * as fs12 from "node:fs";
29249
+ import * as path17 from "node:path";
29512
29250
  function getInstalledVersion() {
29513
29251
  try {
29514
- const pkgPath = path16.resolve(import.meta.dirname, "..", "package.json");
29515
- const pkg = JSON.parse(fs11.readFileSync(pkgPath, "utf8"));
29252
+ const pkgPath = path17.resolve(import.meta.dirname, "..", "package.json");
29253
+ const pkg = JSON.parse(fs12.readFileSync(pkgPath, "utf8"));
29516
29254
  return pkg.version ?? "unknown";
29517
29255
  } catch {
29518
29256
  return "unknown";
@@ -29567,9 +29305,9 @@ async function untilAborted(work, signal) {
29567
29305
  }
29568
29306
  let onAbort = () => {
29569
29307
  };
29570
- const aborted2 = new Promise((resolve10) => {
29571
- onAbort = resolve10;
29572
- if (signal.aborted) resolve10();
29308
+ const aborted2 = new Promise((resolve11) => {
29309
+ onAbort = resolve11;
29310
+ if (signal.aborted) resolve11();
29573
29311
  else signal.addEventListener("abort", onAbort, { once: true });
29574
29312
  });
29575
29313
  try {
@@ -29612,7 +29350,7 @@ function createToolCaller(deps) {
29612
29350
  parseUrl(url);
29613
29351
  return fetchWithReconnect(() => rebase(url), deps.reconnect, {
29614
29352
  init: () => withHeaders(init),
29615
- // A call that carried an upload is sent once and never aborted: the
29353
+ // A call that carried an upload is sent once and never timed out: the
29616
29354
  // tool-server consumes the upload when it reads the call, so a second
29617
29355
  // attempt could only fail.
29618
29356
  fetchTimeoutMs: meta2.longRunning || meta2.carriesUpload ? null : timeout,
@@ -29630,6 +29368,19 @@ function createToolCaller(deps) {
29630
29368
  }
29631
29369
 
29632
29370
  // ../argent-mcp/src/mcp-server.ts
29371
+ var SAVES_FILES_AFTER_CANCEL = /* @__PURE__ */ new Set(["screen-recording-stop", "native-profiler-stop"]);
29372
+ async function withDeadline(signal, ms, work) {
29373
+ const deadline = new AbortController();
29374
+ const timer = setTimeout(
29375
+ () => deadline.abort(new DOMException("The operation was aborted due to timeout", "TimeoutError")),
29376
+ ms
29377
+ );
29378
+ try {
29379
+ return await work(AbortSignal.any([signal, deadline.signal]));
29380
+ } finally {
29381
+ clearTimeout(timer);
29382
+ }
29383
+ }
29633
29384
  async function startMcpServer(options) {
29634
29385
  if (shouldShowFirstRunNotice()) {
29635
29386
  process.stderr.write(`[argent] ${FIRST_RUN_NOTICE}
@@ -29686,7 +29437,7 @@ async function startMcpServer(options) {
29686
29437
  async function spyLog(entry) {
29687
29438
  try {
29688
29439
  if (!logDirReady) {
29689
- await mkdir5(dirname10(LOG_FILE2), { recursive: true });
29440
+ await mkdir5(dirname11(LOG_FILE2), { recursive: true });
29690
29441
  logDirReady = true;
29691
29442
  }
29692
29443
  await appendFile(LOG_FILE2, JSON.stringify(entry) + "\n");
@@ -29699,16 +29450,15 @@ async function startMcpServer(options) {
29699
29450
  reconnect,
29700
29451
  extraHeaders: aiClientHeaders
29701
29452
  });
29702
- async function awaitScreenSettled(udid, toolName) {
29453
+ async function awaitScreenSettled(udid, toolName, signal) {
29703
29454
  const maxWaitMs = getAutoScreenshotDelayMs(toolName);
29704
29455
  if (maxWaitMs === 0) return true;
29705
29456
  const started = Date.now();
29706
29457
  try {
29707
- const idle = await callTool(
29708
- "await-screen-idle",
29709
- { udid, timeoutMs: maxWaitMs },
29710
- // The tool bounds its poll to maxWaitMs; the rest covers its setup.
29711
- { signal: AbortSignal.timeout(maxWaitMs + captureTimeoutMs) }
29458
+ const idle = await withDeadline(
29459
+ signal,
29460
+ maxWaitMs + captureTimeoutMs,
29461
+ (s) => callTool("await-screen-idle", { udid, timeoutMs: maxWaitMs }, { signal: s })
29712
29462
  );
29713
29463
  await spyLog({
29714
29464
  ts: (/* @__PURE__ */ new Date()).toISOString(),
@@ -29719,7 +29469,10 @@ async function startMcpServer(options) {
29719
29469
  });
29720
29470
  return idle.result?.settled === true;
29721
29471
  } catch {
29722
- await new Promise((r) => setTimeout(r, Math.max(0, maxWaitMs - (Date.now() - started))));
29472
+ await sleep(Math.max(0, maxWaitMs - (Date.now() - started)), void 0, { signal }).catch(
29473
+ () => {
29474
+ }
29475
+ );
29723
29476
  return false;
29724
29477
  }
29725
29478
  }
@@ -29729,7 +29482,8 @@ async function startMcpServer(options) {
29729
29482
  const blocks = await toMcpContent(result, "image", {
29730
29483
  toolsUrl: TOOLS_URL,
29731
29484
  authToken: AUTH_TOKEN,
29732
- deviceId: udid
29485
+ deviceId: udid,
29486
+ signal
29733
29487
  });
29734
29488
  if (!blocks.some((b) => b.type === "image")) return [];
29735
29489
  return [{ type: "text", text: "--- Screen after action ---" }, ...blocks];
@@ -29774,10 +29528,10 @@ ${shown.text}` }];
29774
29528
  instructions: SERVER_INSTRUCTIONS
29775
29529
  }
29776
29530
  );
29777
- server.setRequestHandler(ListToolsRequestSchema, async () => {
29531
+ server.setRequestHandler(ListToolsRequestSchema, async (_request, { signal }) => {
29778
29532
  try {
29779
29533
  const keywordFacts = !showsSchemaKeywords(server.getClientVersion()?.name);
29780
- const tools = toMcpToolList(await fetchTools(), { keywordFacts });
29534
+ const tools = toMcpToolList(await fetchTools({ signal }), { keywordFacts });
29781
29535
  await spyLog({
29782
29536
  ts: (/* @__PURE__ */ new Date()).toISOString(),
29783
29537
  event: "list_tools",
@@ -29793,8 +29547,9 @@ ${shown.text}` }];
29793
29547
  return { tools: [] };
29794
29548
  }
29795
29549
  });
29796
- server.setRequestHandler(CallToolRequestSchema, async ({ params }, { signal: cancelled }) => {
29550
+ server.setRequestHandler(CallToolRequestSchema, async ({ params }, { signal }) => {
29797
29551
  const t0 = Date.now();
29552
+ const callSignal = SAVES_FILES_AFTER_CANCEL.has(canonicalToolId(params.name)) ? void 0 : signal;
29798
29553
  let treeUdid;
29799
29554
  await spyLog({
29800
29555
  ts: (/* @__PURE__ */ new Date()).toISOString(),
@@ -29803,7 +29558,11 @@ ${shown.text}` }];
29803
29558
  args: params.arguments
29804
29559
  });
29805
29560
  try {
29806
- const { result, outputHint, note, profiling } = await callTool(params.name, params.arguments);
29561
+ const { result, outputHint, note, profiling } = await callTool(
29562
+ params.name,
29563
+ params.arguments,
29564
+ { signal: callSignal }
29565
+ );
29807
29566
  await spyLog({
29808
29567
  ts: (/* @__PURE__ */ new Date()).toISOString(),
29809
29568
  event: "tool_result",
@@ -29815,7 +29574,8 @@ ${shown.text}` }];
29815
29574
  const ctx = {
29816
29575
  toolsUrl: TOOLS_URL,
29817
29576
  authToken: AUTH_TOKEN,
29818
- deviceId: getDeviceIdFromArgs(params.arguments)
29577
+ deviceId: getDeviceIdFromArgs(params.arguments),
29578
+ signal: callSignal
29819
29579
  };
29820
29580
  const devicesText = canonicalToolId(params.name) === "list-devices" ? listDevicesText(result) : void 0;
29821
29581
  let content;
@@ -29849,22 +29609,24 @@ ${shown.text}` }];
29849
29609
  ];
29850
29610
  } else if (udid && (wantScreenshot || wantTree) && profiling) {
29851
29611
  if (params.name !== "describe") {
29852
- await awaitScreenSettled(udid, params.name);
29612
+ await awaitScreenSettled(udid, params.name, signal);
29853
29613
  content = [...content, { type: "text", text: PROFILING_CAPTURE_SKIPPED_NOTE }];
29854
29614
  }
29855
29615
  } else if (udid && (wantScreenshot || wantTree)) {
29856
- const screenSettled = await awaitScreenSettled(udid, params.name);
29857
- const signal = AbortSignal.timeout(captureTimeoutMs);
29858
- const screenshot = wantScreenshot ? captureScreenshotBlocks(udid, signal) : Promise.resolve([]);
29859
- if (!screenSettled) await screenshot;
29616
+ const screenSettled = await awaitScreenSettled(udid, params.name, signal);
29860
29617
  if (wantTree) treeUdid = udid;
29861
- const tree = wantTree ? captureTreeBlocks(udid, params.name, signal) : Promise.resolve([]);
29862
- content = [...content, ...await screenshot, ...await tree];
29618
+ const captured = await withDeadline(signal, captureTimeoutMs, async (captureSignal) => {
29619
+ const screenshot = wantScreenshot ? captureScreenshotBlocks(udid, captureSignal) : Promise.resolve([]);
29620
+ if (!screenSettled) await screenshot;
29621
+ const tree = wantTree ? captureTreeBlocks(udid, params.name, captureSignal) : Promise.resolve([]);
29622
+ return [...await screenshot, ...await tree];
29623
+ });
29624
+ content = [...content, ...captured];
29863
29625
  }
29864
29626
  if (note) {
29865
29627
  content = [{ type: "text", text: note }, ...content];
29866
29628
  }
29867
- if (treeUdid !== void 0 && cancelled.aborted) trees.forget(treeUdid);
29629
+ if (treeUdid !== void 0 && signal.aborted) trees.forget(treeUdid);
29868
29630
  return { content };
29869
29631
  } catch (err) {
29870
29632
  if (treeUdid !== void 0) trees.forget(treeUdid);
@@ -29874,6 +29636,7 @@ ${shown.text}` }];
29874
29636
  name: params.name,
29875
29637
  durationMs: Date.now() - t0,
29876
29638
  isError: true,
29639
+ ...signal.aborted ? { cancelled: true } : {},
29877
29640
  error: String(err instanceof Error ? err.message : err)
29878
29641
  });
29879
29642
  return {