@swmansion/argent 0.35.1-next.3 → 0.35.1-next.31

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 (55) hide show
  1. package/README.md +16 -15
  2. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  3. package/bin/darwin/argent-macos-helper +0 -0
  4. package/bin/darwin/ax-service +0 -0
  5. package/bin/darwin/tvos-ax-service +0 -0
  6. package/bin/darwin/tvos-hid-daemon +0 -0
  7. package/bin/network-inspector/network-inspector.jar +0 -0
  8. package/bin/tcp/ax-service +0 -0
  9. package/dist/cli-cmds.mjs +1810 -1656
  10. package/dist/client.js +267 -250
  11. package/dist/fatal-handlers.js +7 -1
  12. package/dist/fatal-handlers.js.map +1 -1
  13. package/dist/installer-help.js +2 -1
  14. package/dist/installer-help.js.map +1 -1
  15. package/dist/installer.mjs +768 -550
  16. package/dist/mcp-server.mjs +1312 -1184
  17. package/dist/tool-args.generated.d.ts +355 -317
  18. package/dist/tool-server.cjs +103433 -101961
  19. package/dylibs/libArgentAudio.dylib +0 -0
  20. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  21. package/dylibs/libKeyboardPatch.dylib +0 -0
  22. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  23. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  24. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  25. package/dylibs/tcp/argent-audio-feeder +0 -0
  26. package/dylibs/tcp/libArgentAudio.dylib +0 -0
  27. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  28. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  29. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  30. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  31. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  32. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  33. package/package.json +2 -2
  34. package/skills/argent-android-emulator-setup/SKILL.md +2 -2
  35. package/skills/argent-create-e2e/SKILL.md +1 -1
  36. package/skills/argent-create-e2e/references/e2e-yaml.md +25 -2
  37. package/skills/argent-create-e2e/references/live-authoring.md +9 -0
  38. package/skills/argent-device-interact/SKILL.md +21 -94
  39. package/skills/argent-device-interact/references/advanced.md +64 -0
  40. package/skills/argent-ios-device-interact/SKILL.md +1 -1
  41. package/skills/argent-ios-device-setup/SKILL.md +1 -1
  42. package/skills/argent-ios-simulator-setup/SKILL.md +1 -1
  43. package/skills/argent-lens/SKILL.md +1 -1
  44. package/skills/argent-macos-app-interact/SKILL.md +1 -1
  45. package/skills/argent-metro-debugger/SKILL.md +1 -1
  46. package/skills/argent-native-profiler/SKILL.md +1 -1
  47. package/skills/argent-qa-e2e/SKILL.md +1 -1
  48. package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
  49. package/skills/argent-react-native-optimization/SKILL.md +1 -1
  50. package/skills/argent-react-native-profiler/SKILL.md +1 -1
  51. package/skills/argent-screen-recording/SKILL.md +1 -1
  52. package/skills/argent-screenshot-diff/SKILL.md +1 -1
  53. package/skills/argent-settings-permissions/SKILL.md +1 -1
  54. package/skills/argent-test-ui-flow/SKILL.md +1 -1
  55. package/skills/argent-tv-interact/SKILL.md +1 -1
package/dist/client.js CHANGED
@@ -504,17 +504,17 @@ var require_visit = __commonJS({
504
504
  visit.BREAK = BREAK;
505
505
  visit.SKIP = SKIP;
506
506
  visit.REMOVE = REMOVE;
507
- function visit_(key, node, visitor, path14) {
508
- const ctrl = callVisitor(key, node, visitor, path14);
507
+ function visit_(key, node, visitor, path15) {
508
+ const ctrl = callVisitor(key, node, visitor, path15);
509
509
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
510
- replaceNode(key, path14, ctrl);
511
- return visit_(key, ctrl, visitor, path14);
510
+ replaceNode(key, path15, ctrl);
511
+ return visit_(key, ctrl, visitor, path15);
512
512
  }
513
513
  if (typeof ctrl !== "symbol") {
514
514
  if (identity.isCollection(node)) {
515
- path14 = Object.freeze(path14.concat(node));
515
+ path15 = Object.freeze(path15.concat(node));
516
516
  for (let i = 0; i < node.items.length; ++i) {
517
- const ci = visit_(i, node.items[i], visitor, path14);
517
+ const ci = visit_(i, node.items[i], visitor, path15);
518
518
  if (typeof ci === "number")
519
519
  i = ci - 1;
520
520
  else if (ci === BREAK)
@@ -525,13 +525,13 @@ var require_visit = __commonJS({
525
525
  }
526
526
  }
527
527
  } else if (identity.isPair(node)) {
528
- path14 = Object.freeze(path14.concat(node));
529
- const ck = visit_("key", node.key, visitor, path14);
528
+ path15 = Object.freeze(path15.concat(node));
529
+ const ck = visit_("key", node.key, visitor, path15);
530
530
  if (ck === BREAK)
531
531
  return BREAK;
532
532
  else if (ck === REMOVE)
533
533
  node.key = null;
534
- const cv = visit_("value", node.value, visitor, path14);
534
+ const cv = visit_("value", node.value, visitor, path15);
535
535
  if (cv === BREAK)
536
536
  return BREAK;
537
537
  else if (cv === REMOVE)
@@ -552,17 +552,17 @@ var require_visit = __commonJS({
552
552
  visitAsync.BREAK = BREAK;
553
553
  visitAsync.SKIP = SKIP;
554
554
  visitAsync.REMOVE = REMOVE;
555
- async function visitAsync_(key, node, visitor, path14) {
556
- const ctrl = await callVisitor(key, node, visitor, path14);
555
+ async function visitAsync_(key, node, visitor, path15) {
556
+ const ctrl = await callVisitor(key, node, visitor, path15);
557
557
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
558
- replaceNode(key, path14, ctrl);
559
- return visitAsync_(key, ctrl, visitor, path14);
558
+ replaceNode(key, path15, ctrl);
559
+ return visitAsync_(key, ctrl, visitor, path15);
560
560
  }
561
561
  if (typeof ctrl !== "symbol") {
562
562
  if (identity.isCollection(node)) {
563
- path14 = Object.freeze(path14.concat(node));
563
+ path15 = Object.freeze(path15.concat(node));
564
564
  for (let i = 0; i < node.items.length; ++i) {
565
- const ci = await visitAsync_(i, node.items[i], visitor, path14);
565
+ const ci = await visitAsync_(i, node.items[i], visitor, path15);
566
566
  if (typeof ci === "number")
567
567
  i = ci - 1;
568
568
  else if (ci === BREAK)
@@ -573,13 +573,13 @@ var require_visit = __commonJS({
573
573
  }
574
574
  }
575
575
  } else if (identity.isPair(node)) {
576
- path14 = Object.freeze(path14.concat(node));
577
- const ck = await visitAsync_("key", node.key, visitor, path14);
576
+ path15 = Object.freeze(path15.concat(node));
577
+ const ck = await visitAsync_("key", node.key, visitor, path15);
578
578
  if (ck === BREAK)
579
579
  return BREAK;
580
580
  else if (ck === REMOVE)
581
581
  node.key = null;
582
- const cv = await visitAsync_("value", node.value, visitor, path14);
582
+ const cv = await visitAsync_("value", node.value, visitor, path15);
583
583
  if (cv === BREAK)
584
584
  return BREAK;
585
585
  else if (cv === REMOVE)
@@ -606,23 +606,23 @@ var require_visit = __commonJS({
606
606
  }
607
607
  return visitor;
608
608
  }
609
- function callVisitor(key, node, visitor, path14) {
609
+ function callVisitor(key, node, visitor, path15) {
610
610
  if (typeof visitor === "function")
611
- return visitor(key, node, path14);
611
+ return visitor(key, node, path15);
612
612
  if (identity.isMap(node))
613
- return visitor.Map?.(key, node, path14);
613
+ return visitor.Map?.(key, node, path15);
614
614
  if (identity.isSeq(node))
615
- return visitor.Seq?.(key, node, path14);
615
+ return visitor.Seq?.(key, node, path15);
616
616
  if (identity.isPair(node))
617
- return visitor.Pair?.(key, node, path14);
617
+ return visitor.Pair?.(key, node, path15);
618
618
  if (identity.isScalar(node))
619
- return visitor.Scalar?.(key, node, path14);
619
+ return visitor.Scalar?.(key, node, path15);
620
620
  if (identity.isAlias(node))
621
- return visitor.Alias?.(key, node, path14);
621
+ return visitor.Alias?.(key, node, path15);
622
622
  return void 0;
623
623
  }
624
- function replaceNode(key, path14, node) {
625
- const parent = path14[path14.length - 1];
624
+ function replaceNode(key, path15, node) {
625
+ const parent = path15[path15.length - 1];
626
626
  if (identity.isCollection(parent)) {
627
627
  parent.items[key] = node;
628
628
  } else if (identity.isPair(parent)) {
@@ -1234,10 +1234,10 @@ var require_Collection = __commonJS({
1234
1234
  var createNode = require_createNode();
1235
1235
  var identity = require_identity();
1236
1236
  var Node = require_Node();
1237
- function collectionFromPath(schema, path14, value) {
1237
+ function collectionFromPath(schema, path15, value) {
1238
1238
  let v = value;
1239
- for (let i = path14.length - 1; i >= 0; --i) {
1240
- const k = path14[i];
1239
+ for (let i = path15.length - 1; i >= 0; --i) {
1240
+ const k = path15[i];
1241
1241
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
1242
1242
  const a = [];
1243
1243
  a[k] = v;
@@ -1256,7 +1256,7 @@ var require_Collection = __commonJS({
1256
1256
  sourceObjects: /* @__PURE__ */ new Map()
1257
1257
  });
1258
1258
  }
1259
- var isEmptyPath = (path14) => path14 == null || typeof path14 === "object" && !!path14[Symbol.iterator]().next().done;
1259
+ var isEmptyPath = (path15) => path15 == null || typeof path15 === "object" && !!path15[Symbol.iterator]().next().done;
1260
1260
  var Collection = class extends Node.NodeBase {
1261
1261
  constructor(type, schema) {
1262
1262
  super(type);
@@ -1286,11 +1286,11 @@ var require_Collection = __commonJS({
1286
1286
  * be a Pair instance or a `{ key, value }` object, which may not have a key
1287
1287
  * that already exists in the map.
1288
1288
  */
1289
- addIn(path14, value) {
1290
- if (isEmptyPath(path14))
1289
+ addIn(path15, value) {
1290
+ if (isEmptyPath(path15))
1291
1291
  this.add(value);
1292
1292
  else {
1293
- const [key, ...rest] = path14;
1293
+ const [key, ...rest] = path15;
1294
1294
  const node = this.get(key, true);
1295
1295
  if (identity.isCollection(node))
1296
1296
  node.addIn(rest, value);
@@ -1304,8 +1304,8 @@ var require_Collection = __commonJS({
1304
1304
  * Removes a value from the collection.
1305
1305
  * @returns `true` if the item was found and removed.
1306
1306
  */
1307
- deleteIn(path14) {
1308
- const [key, ...rest] = path14;
1307
+ deleteIn(path15) {
1308
+ const [key, ...rest] = path15;
1309
1309
  if (rest.length === 0)
1310
1310
  return this.delete(key);
1311
1311
  const node = this.get(key, true);
@@ -1319,8 +1319,8 @@ var require_Collection = __commonJS({
1319
1319
  * scalar values from their surrounding node; to disable set `keepScalar` to
1320
1320
  * `true` (collections are always returned intact).
1321
1321
  */
1322
- getIn(path14, keepScalar) {
1323
- const [key, ...rest] = path14;
1322
+ getIn(path15, keepScalar) {
1323
+ const [key, ...rest] = path15;
1324
1324
  const node = this.get(key, true);
1325
1325
  if (rest.length === 0)
1326
1326
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -1338,8 +1338,8 @@ var require_Collection = __commonJS({
1338
1338
  /**
1339
1339
  * Checks if the collection includes a value with the key `key`.
1340
1340
  */
1341
- hasIn(path14) {
1342
- const [key, ...rest] = path14;
1341
+ hasIn(path15) {
1342
+ const [key, ...rest] = path15;
1343
1343
  if (rest.length === 0)
1344
1344
  return this.has(key);
1345
1345
  const node = this.get(key, true);
@@ -1349,8 +1349,8 @@ var require_Collection = __commonJS({
1349
1349
  * Sets a value in this collection. For `!!set`, `value` needs to be a
1350
1350
  * boolean to add/remove the item from the set.
1351
1351
  */
1352
- setIn(path14, value) {
1353
- const [key, ...rest] = path14;
1352
+ setIn(path15, value) {
1353
+ const [key, ...rest] = path15;
1354
1354
  if (rest.length === 0) {
1355
1355
  this.set(key, value);
1356
1356
  } else {
@@ -3865,9 +3865,9 @@ var require_Document = __commonJS({
3865
3865
  this.contents.add(value);
3866
3866
  }
3867
3867
  /** Adds a value to the document. */
3868
- addIn(path14, value) {
3868
+ addIn(path15, value) {
3869
3869
  if (assertCollection(this.contents))
3870
- this.contents.addIn(path14, value);
3870
+ this.contents.addIn(path15, value);
3871
3871
  }
3872
3872
  /**
3873
3873
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3942,14 +3942,14 @@ var require_Document = __commonJS({
3942
3942
  * Removes a value from the document.
3943
3943
  * @returns `true` if the item was found and removed.
3944
3944
  */
3945
- deleteIn(path14) {
3946
- if (Collection.isEmptyPath(path14)) {
3945
+ deleteIn(path15) {
3946
+ if (Collection.isEmptyPath(path15)) {
3947
3947
  if (this.contents == null)
3948
3948
  return false;
3949
3949
  this.contents = null;
3950
3950
  return true;
3951
3951
  }
3952
- return assertCollection(this.contents) ? this.contents.deleteIn(path14) : false;
3952
+ return assertCollection(this.contents) ? this.contents.deleteIn(path15) : false;
3953
3953
  }
3954
3954
  /**
3955
3955
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3964,10 +3964,10 @@ var require_Document = __commonJS({
3964
3964
  * scalar values from their surrounding node; to disable set `keepScalar` to
3965
3965
  * `true` (collections are always returned intact).
3966
3966
  */
3967
- getIn(path14, keepScalar) {
3968
- if (Collection.isEmptyPath(path14))
3967
+ getIn(path15, keepScalar) {
3968
+ if (Collection.isEmptyPath(path15))
3969
3969
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3970
- return identity.isCollection(this.contents) ? this.contents.getIn(path14, keepScalar) : void 0;
3970
+ return identity.isCollection(this.contents) ? this.contents.getIn(path15, keepScalar) : void 0;
3971
3971
  }
3972
3972
  /**
3973
3973
  * Checks if the document includes a value with the key `key`.
@@ -3978,10 +3978,10 @@ var require_Document = __commonJS({
3978
3978
  /**
3979
3979
  * Checks if the document includes a value at `path`.
3980
3980
  */
3981
- hasIn(path14) {
3982
- if (Collection.isEmptyPath(path14))
3981
+ hasIn(path15) {
3982
+ if (Collection.isEmptyPath(path15))
3983
3983
  return this.contents !== void 0;
3984
- return identity.isCollection(this.contents) ? this.contents.hasIn(path14) : false;
3984
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path15) : false;
3985
3985
  }
3986
3986
  /**
3987
3987
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3998,13 +3998,13 @@ var require_Document = __commonJS({
3998
3998
  * Sets a value in this document. For `!!set`, `value` needs to be a
3999
3999
  * boolean to add/remove the item from the set.
4000
4000
  */
4001
- setIn(path14, value) {
4002
- if (Collection.isEmptyPath(path14)) {
4001
+ setIn(path15, value) {
4002
+ if (Collection.isEmptyPath(path15)) {
4003
4003
  this.contents = value;
4004
4004
  } else if (this.contents == null) {
4005
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path14), value);
4005
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path15), value);
4006
4006
  } else if (assertCollection(this.contents)) {
4007
- this.contents.setIn(path14, value);
4007
+ this.contents.setIn(path15, value);
4008
4008
  }
4009
4009
  }
4010
4010
  /**
@@ -5965,9 +5965,9 @@ var require_cst_visit = __commonJS({
5965
5965
  visit.BREAK = BREAK;
5966
5966
  visit.SKIP = SKIP;
5967
5967
  visit.REMOVE = REMOVE;
5968
- visit.itemAtPath = (cst, path14) => {
5968
+ visit.itemAtPath = (cst, path15) => {
5969
5969
  let item = cst;
5970
- for (const [field, index] of path14) {
5970
+ for (const [field, index] of path15) {
5971
5971
  const tok = item?.[field];
5972
5972
  if (tok && "items" in tok) {
5973
5973
  item = tok.items[index];
@@ -5976,23 +5976,23 @@ var require_cst_visit = __commonJS({
5976
5976
  }
5977
5977
  return item;
5978
5978
  };
5979
- visit.parentCollection = (cst, path14) => {
5980
- const parent = visit.itemAtPath(cst, path14.slice(0, -1));
5981
- const field = path14[path14.length - 1][0];
5979
+ visit.parentCollection = (cst, path15) => {
5980
+ const parent = visit.itemAtPath(cst, path15.slice(0, -1));
5981
+ const field = path15[path15.length - 1][0];
5982
5982
  const coll = parent?.[field];
5983
5983
  if (coll && "items" in coll)
5984
5984
  return coll;
5985
5985
  throw new Error("Parent collection not found");
5986
5986
  };
5987
- function _visit(path14, item, visitor) {
5988
- let ctrl = visitor(item, path14);
5987
+ function _visit(path15, item, visitor) {
5988
+ let ctrl = visitor(item, path15);
5989
5989
  if (typeof ctrl === "symbol")
5990
5990
  return ctrl;
5991
5991
  for (const field of ["key", "value"]) {
5992
5992
  const token = item[field];
5993
5993
  if (token && "items" in token) {
5994
5994
  for (let i = 0; i < token.items.length; ++i) {
5995
- const ci = _visit(Object.freeze(path14.concat([[field, i]])), token.items[i], visitor);
5995
+ const ci = _visit(Object.freeze(path15.concat([[field, i]])), token.items[i], visitor);
5996
5996
  if (typeof ci === "number")
5997
5997
  i = ci - 1;
5998
5998
  else if (ci === BREAK)
@@ -6003,10 +6003,10 @@ var require_cst_visit = __commonJS({
6003
6003
  }
6004
6004
  }
6005
6005
  if (typeof ctrl === "function" && field === "key")
6006
- ctrl = ctrl(item, path14);
6006
+ ctrl = ctrl(item, path15);
6007
6007
  }
6008
6008
  }
6009
- return typeof ctrl === "function" ? ctrl(item, path14) : ctrl;
6009
+ return typeof ctrl === "function" ? ctrl(item, path15) : ctrl;
6010
6010
  }
6011
6011
  exports.visit = visit;
6012
6012
  }
@@ -7759,8 +7759,27 @@ var require_dist2 = __commonJS({
7759
7759
 
7760
7760
  // ../configuration-core/src/flags.ts
7761
7761
  import * as fs from "node:fs";
7762
+ import * as path2 from "node:path";
7763
+
7764
+ // ../configuration-core/src/home.ts
7765
+ import * as os from "node:os";
7762
7766
  import * as path from "node:path";
7763
- import { homedir } from "node:os";
7767
+ var ARGENT_HOME_DIR_ENV = "ARGENT_HOME_DIR";
7768
+ function nonEmpty(value) {
7769
+ if (value == void 0) return null;
7770
+ const trimmed = value.trim();
7771
+ return trimmed === "" ? null : value;
7772
+ }
7773
+ function resolveHomeDir(options = {}) {
7774
+ if (options.homeDir) return options.homeDir;
7775
+ return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
7776
+ }
7777
+ function argentHomeDir(options = {}) {
7778
+ const override = options.homeDir ? null : nonEmpty(process.env[ARGENT_HOME_DIR_ENV]);
7779
+ return override ? path.resolve(override.trim()) : path.join(resolveHomeDir(options), ".argent");
7780
+ }
7781
+
7782
+ // ../configuration-core/src/flags.ts
7764
7783
  var FLAG_REGISTRY = [
7765
7784
  {
7766
7785
  name: "disable-auto-screenshot",
@@ -7824,26 +7843,25 @@ function getFlagDefinition(name, registry = FLAG_REGISTRY) {
7824
7843
  }
7825
7844
  var PROJECT_MARKERS = [".argent", ".git", "package.json"];
7826
7845
  function findProjectRoot(startDir) {
7827
- let current = path.resolve(startDir);
7846
+ let current = path2.resolve(startDir);
7828
7847
  while (true) {
7829
7848
  for (const marker of PROJECT_MARKERS) {
7830
- if (fs.existsSync(path.join(current, marker))) return current;
7849
+ if (fs.existsSync(path2.join(current, marker))) return current;
7831
7850
  }
7832
- const parent = path.dirname(current);
7851
+ const parent = path2.dirname(current);
7833
7852
  if (parent === current) return null;
7834
7853
  current = parent;
7835
7854
  }
7836
7855
  }
7837
7856
  function resolveProjectRoot(startDir) {
7838
- return findProjectRoot(startDir) ?? path.resolve(startDir);
7857
+ return findProjectRoot(startDir) ?? path2.resolve(startDir);
7839
7858
  }
7840
7859
  function getFlagsPath(scope, options = {}) {
7841
- const home = options.homeDir ?? homedir();
7842
7860
  if (scope === "global") {
7843
- return path.join(home, ".argent", "flags.json");
7861
+ return path2.join(argentHomeDir({ homeDir: options.homeDir }), "flags.json");
7844
7862
  }
7845
7863
  const cwd = options.cwd ?? process.cwd();
7846
- return path.join(resolveProjectRoot(cwd), ".argent", "flags.json");
7864
+ return path2.join(resolveProjectRoot(cwd), ".argent", "flags.json");
7847
7865
  }
7848
7866
  function readFlagsFile(filePath) {
7849
7867
  let raw;
@@ -7886,17 +7904,7 @@ function isFeatureEnabled(name, options = {}, registry = FLAG_REGISTRY) {
7886
7904
 
7887
7905
  // ../configuration-core/src/paths.ts
7888
7906
  import * as fs2 from "node:fs";
7889
- import * as os from "node:os";
7890
- import * as path2 from "node:path";
7891
- function nonEmpty(value) {
7892
- if (value == void 0) return null;
7893
- const trimmed = value.trim();
7894
- return trimmed === "" ? null : value;
7895
- }
7896
- function resolveHomeDir(options = {}) {
7897
- if (options.homeDir) return options.homeDir;
7898
- return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
7899
- }
7907
+ import * as path3 from "node:path";
7900
7908
  function isHomeDir(dir, options = {}) {
7901
7909
  return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
7902
7910
  }
@@ -7904,27 +7912,22 @@ function canonicalPath(p) {
7904
7912
  try {
7905
7913
  return fs2.realpathSync.native(p);
7906
7914
  } catch {
7907
- return path2.resolve(p);
7915
+ return path3.resolve(p);
7908
7916
  }
7909
7917
  }
7910
- function argentHomeDir() {
7911
- return path2.join(resolveHomeDir(), ".argent");
7912
- }
7913
7918
  function configDir(scope = "global", options = {}) {
7914
- if (scope === "global") {
7915
- return path2.join(resolveHomeDir(options), ".argent");
7916
- }
7919
+ if (scope === "global") return argentHomeDir(options);
7917
7920
  const cwd = options.cwd ?? process.cwd();
7918
- return path2.join(resolveProjectRoot(cwd), ".argent");
7921
+ return path3.join(resolveProjectRoot(cwd), ".argent");
7919
7922
  }
7920
7923
  function configFilePath(scope = "global", options = {}) {
7921
- return path2.join(configDir(scope, options), "config.json");
7924
+ return path3.join(configDir(scope, options), "config.json");
7922
7925
  }
7923
7926
 
7924
7927
  // ../configuration-core/src/config.ts
7925
7928
  import * as crypto from "node:crypto";
7926
7929
  import * as fs3 from "node:fs";
7927
- import * as path3 from "node:path";
7930
+ import * as path4 from "node:path";
7928
7931
  function readConfigObject(scope = "global", options = {}) {
7929
7932
  try {
7930
7933
  const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
@@ -7965,7 +7968,7 @@ function getAtPath(obj, dottedKey) {
7965
7968
  // ../configuration-core/src/secrets.ts
7966
7969
  var import_dotenv = __toESM(require_dist(), 1);
7967
7970
  import * as fs4 from "node:fs";
7968
- import * as path4 from "node:path";
7971
+ import * as path5 from "node:path";
7969
7972
  var SECRET_ENV_PREFIX = "ARGENT_SECRET_";
7970
7973
  var SECRETS_FILE_NAME = "secrets.env";
7971
7974
  var SHARED_ENV_FILES = [".env.local", ".env"];
@@ -8029,20 +8032,20 @@ function secretSources(options = {}) {
8029
8032
  const filePaths = [];
8030
8033
  if (projectRoot) {
8031
8034
  filePaths.push({
8032
- path: path4.join(projectRoot, ".argent", SECRETS_FILE_NAME),
8035
+ path: path5.join(projectRoot, ".argent", SECRETS_FILE_NAME),
8033
8036
  exposure: "dedicated"
8034
8037
  });
8035
8038
  for (const name of SHARED_ENV_FILES) {
8036
- filePaths.push({ path: path4.join(projectRoot, name), exposure: "shared" });
8039
+ filePaths.push({ path: path5.join(projectRoot, name), exposure: "shared" });
8037
8040
  }
8038
8041
  }
8039
8042
  filePaths.push({
8040
- path: path4.join(home, ".argent", SECRETS_FILE_NAME),
8043
+ path: path5.join(argentHomeDir(options), SECRETS_FILE_NAME),
8041
8044
  exposure: "dedicated"
8042
8045
  });
8043
8046
  const seen = /* @__PURE__ */ new Set();
8044
8047
  for (const entry of filePaths) {
8045
- const resolved = path4.resolve(entry.path);
8048
+ const resolved = path5.resolve(entry.path);
8046
8049
  if (seen.has(resolved)) continue;
8047
8050
  seen.add(resolved);
8048
8051
  sources.push(fileSource(resolved, entry.exposure));
@@ -8159,6 +8162,15 @@ var CONFIG_SCHEMA = [
8159
8162
  // drained/reset, not just the file rewritten.
8160
8163
  manageCommand: "argent telemetry"
8161
8164
  },
8165
+ {
8166
+ key: "autoUpdate.enabled",
8167
+ description: "Automatically update the global Argent installation. Project-local installs require confirmation.",
8168
+ scopes: ["global"],
8169
+ parse: asBoolean,
8170
+ merge: "prioritize-local",
8171
+ default: true,
8172
+ example: "false"
8173
+ },
8162
8174
  {
8163
8175
  key: "lens.agent",
8164
8176
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -8247,7 +8259,7 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
8247
8259
  }
8248
8260
 
8249
8261
  // ../configuration-core/src/config-access.ts
8250
- import * as path5 from "node:path";
8262
+ import * as path6 from "node:path";
8251
8263
  function readScopeValue(def, scope, options) {
8252
8264
  if (!def.scopes.includes(scope)) return void 0;
8253
8265
  const raw = getAtPath(readConfigObject(scope, options), def.key);
@@ -8282,16 +8294,15 @@ var UnknownConfigKeyError = class extends Error {
8282
8294
  // ../argent-tools-client/src/launcher.ts
8283
8295
  import * as net from "node:net";
8284
8296
  import * as fs5 from "node:fs";
8285
- import * as path6 from "node:path";
8297
+ import * as path7 from "node:path";
8286
8298
  import * as readline from "node:readline";
8287
- import { homedir as homedir3 } from "node:os";
8288
8299
  import { spawn, execFileSync } from "node:child_process";
8289
8300
  import { createHash, randomBytes } from "node:crypto";
8290
8301
  import { mkdir, writeFile, readFile, readdir, unlink, rename, chmod } from "node:fs/promises";
8291
- var STATE_DIR = path6.join(homedir3(), ".argent");
8292
- var STATE_FILE = path6.join(STATE_DIR, "tool-server.json");
8293
- var LOG_FILE = path6.join(STATE_DIR, "tool-server.log");
8294
- var LOCK_FILE = path6.join(STATE_DIR, "tool-server.lock");
8302
+ var STATE_DIR = argentHomeDir();
8303
+ var STATE_FILE = path7.join(STATE_DIR, "tool-server.json");
8304
+ var LOG_FILE = path7.join(STATE_DIR, "tool-server.log");
8305
+ var LOCK_FILE = path7.join(STATE_DIR, "tool-server.lock");
8295
8306
  var AUTH_TOKEN_BYTES = 32;
8296
8307
  var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
8297
8308
  var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
@@ -8308,6 +8319,7 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8308
8319
  env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
8309
8320
  }
8310
8321
  env[AUTH_TOKEN_ENV] = options.token ?? "";
8322
+ env.ARGENT_SERVER_MANAGED = options.managed ?? "autospawn";
8311
8323
  if (paths.installKind) env.ARGENT_INSTALL_KIND = paths.installKind;
8312
8324
  if (paths.installProjectRoot) env.ARGENT_PROJECT_ROOT = paths.installProjectRoot;
8313
8325
  return env;
@@ -8316,7 +8328,7 @@ function generateToken() {
8316
8328
  return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
8317
8329
  }
8318
8330
  function findFreePort() {
8319
- return new Promise((resolve11, reject) => {
8331
+ return new Promise((resolve12, reject) => {
8320
8332
  const srv = net.createServer();
8321
8333
  srv.listen(0, "127.0.0.1", () => {
8322
8334
  const addr = srv.address();
@@ -8327,7 +8339,7 @@ function findFreePort() {
8327
8339
  const port = addr.port;
8328
8340
  srv.close((err) => {
8329
8341
  if (err) reject(err);
8330
- else resolve11(port);
8342
+ else resolve12(port);
8331
8343
  });
8332
8344
  });
8333
8345
  srv.on("error", reject);
@@ -8369,7 +8381,7 @@ function isVersionNewer(a, b) {
8369
8381
  function readBundlePackageVersion(bundlePath) {
8370
8382
  try {
8371
8383
  const pkg = JSON.parse(
8372
- fs5.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
8384
+ fs5.readFileSync(path7.join(path7.dirname(bundlePath), "..", "package.json"), "utf8")
8373
8385
  );
8374
8386
  return typeof pkg.version === "string" ? pkg.version : void 0;
8375
8387
  } catch {
@@ -8428,8 +8440,12 @@ function resolveToolsServerNode() {
8428
8440
  const { bun, deno, electron } = process.versions;
8429
8441
  return !(bun || deno || electron) && fs5.existsSync(process.execPath) ? process.execPath : "node";
8430
8442
  }
8443
+ function parseListeningPort(line) {
8444
+ const match = line.match(/Tools server listening on http:\/\/.+:(\d+)/);
8445
+ return match ? parseInt(match[1], 10) : null;
8446
+ }
8431
8447
  function spawnToolsServer(paths, port, options = {}) {
8432
- return new Promise((resolve11, reject) => {
8448
+ return new Promise((resolve12, reject) => {
8433
8449
  let logFd;
8434
8450
  try {
8435
8451
  fs5.mkdirSync(STATE_DIR, { recursive: true });
@@ -8444,7 +8460,6 @@ function spawnToolsServer(paths, port, options = {}) {
8444
8460
  env: buildToolsServerEnv(paths, port, process.env, options)
8445
8461
  });
8446
8462
  fs5.closeSync(logFd);
8447
- child.unref();
8448
8463
  const pid = child.pid;
8449
8464
  if (!pid) {
8450
8465
  child.once(
@@ -8469,13 +8484,13 @@ function spawnToolsServer(paths, port, options = {}) {
8469
8484
  });
8470
8485
  const rl = readline.createInterface({ input: child.stdout });
8471
8486
  rl.on("line", (line) => {
8472
- const match = line.match(/Tools server listening on http:\/\/.+:(\d+)/);
8473
- if (match) {
8474
- const actualPort = parseInt(match[1], 10);
8487
+ const actualPort = parseListeningPort(line);
8488
+ if (actualPort !== null) {
8475
8489
  rl.close();
8476
8490
  child.stdout?.resume();
8477
8491
  child.stdout?.unref?.();
8478
- settle(() => resolve11({ port: actualPort, pid }));
8492
+ child.unref();
8493
+ settle(() => resolve12({ port: actualPort, pid }));
8479
8494
  }
8480
8495
  });
8481
8496
  child.on("error", (err) => {
@@ -8495,7 +8510,7 @@ function spawnToolsServer(paths, port, options = {}) {
8495
8510
  }
8496
8511
  function stateFileForBundle(bundlePath) {
8497
8512
  const key = createHash("sha256").update(bundlePath).digest("hex").slice(0, 12);
8498
- return path6.join(STATE_DIR, `tool-server-${key}.json`);
8513
+ return path7.join(STATE_DIR, `tool-server-${key}.json`);
8499
8514
  }
8500
8515
  async function readStateFile(file) {
8501
8516
  try {
@@ -8554,7 +8569,7 @@ async function readAllToolsServerStates() {
8554
8569
  const out = [];
8555
8570
  for (const name of names) {
8556
8571
  if (!STATE_FILE_RE.test(name)) continue;
8557
- const file = path6.join(STATE_DIR, name);
8572
+ const file = path7.join(STATE_DIR, name);
8558
8573
  const state = await readStateFile(file);
8559
8574
  if (state) out.push({ file, state });
8560
8575
  }
@@ -8784,7 +8799,7 @@ async function ensureToolsServer(paths) {
8784
8799
  var import_yaml2 = __toESM(require_dist2(), 1);
8785
8800
  import { readFile as readFile5 } from "node:fs/promises";
8786
8801
  import { maxHeaderSize } from "node:http";
8787
- import * as path12 from "node:path";
8802
+ import * as path13 from "node:path";
8788
8803
 
8789
8804
  // ../registry/src/types.ts
8790
8805
  var LINKED_CALL_HEADER = "x-argent-linked";
@@ -8845,8 +8860,8 @@ var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][
8845
8860
  function isUnexpandedPath(p) {
8846
8861
  return UNEXPANDED_PATH.test(p);
8847
8862
  }
8848
- function isClientFileArgument({ spec, path: path14 }) {
8849
- return spec.kind === "file" && spec.path === `\${${spec.target}}` && path14.startsWith("/") && hasToolFileExtension(path14);
8863
+ function isClientFileArgument({ spec, path: path15 }) {
8864
+ return spec.kind === "file" && spec.path === `\${${spec.target}}` && path15.startsWith("/") && hasToolFileExtension(path15);
8850
8865
  }
8851
8866
 
8852
8867
  // ../registry/src/flow-platforms.ts
@@ -8855,22 +8870,22 @@ var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
8855
8870
 
8856
8871
  // ../registry/src/flow-file-refs.ts
8857
8872
  import * as fs7 from "node:fs/promises";
8858
- import * as path8 from "node:path";
8873
+ import * as path9 from "node:path";
8859
8874
 
8860
8875
  // ../registry/src/e2e-dirs.ts
8861
8876
  import * as fs6 from "node:fs/promises";
8862
- import * as path7 from "node:path";
8863
- var E2E_DIR = path7.join(".argent", "e2e");
8864
- var LEGACY_E2E_DIRS = Object.freeze([path7.join(".argent", "flows")]);
8877
+ import * as path8 from "node:path";
8878
+ var E2E_DIR = path8.join(".argent", "e2e");
8879
+ var LEGACY_E2E_DIRS = Object.freeze([path8.join(".argent", "flows")]);
8865
8880
  var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
8866
8881
  function e2eDirFor(projectRoot) {
8867
- return path7.join(projectRoot, E2E_DIR);
8882
+ return path8.join(projectRoot, E2E_DIR);
8868
8883
  }
8869
8884
  function e2eDirsFor(projectRoot) {
8870
- return E2E_DIRS.map((dir) => path7.join(projectRoot, dir));
8885
+ return E2E_DIRS.map((dir) => path8.join(projectRoot, dir));
8871
8886
  }
8872
8887
  function e2eFileCandidates(projectRoot, name) {
8873
- return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
8888
+ return e2eDirsFor(projectRoot).map((dir) => path8.join(dir, `${name}.yaml`));
8874
8889
  }
8875
8890
  async function exists(file) {
8876
8891
  return fs6.stat(file).then(
@@ -8900,21 +8915,21 @@ async function pickE2eFile(candidates) {
8900
8915
  function e2eShadowWarning(used, shadowed) {
8901
8916
  return `${shadowed} is not used: ${used} has the same name and is read first.`;
8902
8917
  }
8903
- var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path7.basename(dir));
8918
+ var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path8.basename(dir));
8904
8919
  function e2eDirProject(dir) {
8905
8920
  const trimmed = dir.length > 1 ? dir.replace(/[\\/]+$/, "") : dir;
8906
- const argent = path7.dirname(trimmed);
8907
- if (!E2E_DIR_NAMES.includes(path7.basename(trimmed)) || path7.basename(argent) !== ".argent") {
8921
+ const argent = path8.dirname(trimmed);
8922
+ if (!E2E_DIR_NAMES.includes(path8.basename(trimmed)) || path8.basename(argent) !== ".argent") {
8908
8923
  return null;
8909
8924
  }
8910
- return path7.dirname(argent);
8925
+ return path8.dirname(argent);
8911
8926
  }
8912
8927
  function e2eRunFallbackDirs(anchorDir, target) {
8913
8928
  if (target.includes("/") || target.includes("\\")) return [];
8914
8929
  const project = e2eDirProject(anchorDir);
8915
8930
  if (project === null) return [];
8916
- const anchor = path7.resolve(anchorDir);
8917
- return e2eDirsFor(project).filter((dir) => path7.resolve(dir) !== anchor);
8931
+ const anchor = path8.resolve(anchorDir);
8932
+ return e2eDirsFor(project).filter((dir) => path8.resolve(dir) !== anchor);
8918
8933
  }
8919
8934
 
8920
8935
  // ../registry/src/tool-ids.ts
@@ -8967,7 +8982,7 @@ async function canonicalFlowPath(p) {
8967
8982
  return await fs7.realpath(p);
8968
8983
  } catch {
8969
8984
  try {
8970
- return path8.join(await fs7.realpath(path8.dirname(p)), path8.basename(p));
8985
+ return path9.join(await fs7.realpath(path9.dirname(p)), path9.basename(p));
8971
8986
  } catch {
8972
8987
  return p;
8973
8988
  }
@@ -8976,7 +8991,7 @@ async function canonicalFlowPath(p) {
8976
8991
  function completeRunExtension(value) {
8977
8992
  if (value.endsWith(".yaml")) return value;
8978
8993
  const candidate = `${value}.yaml`;
8979
- return FLOW_FILE_NAME_PATTERN.test(path8.posix.basename(candidate)) ? candidate : value;
8994
+ return FLOW_FILE_NAME_PATTERN.test(path9.posix.basename(candidate)) ? candidate : value;
8980
8995
  }
8981
8996
  var MAX_RUN_DEPTH = 20;
8982
8997
  var MAX_BLOCK_NESTING = 64;
@@ -8998,9 +9013,9 @@ function collectFlowRequests(doc) {
8998
9013
  for (const step of steps) {
8999
9014
  if (!isRecord(step)) continue;
9000
9015
  const run = step.run;
9001
- if (typeof run === "string" && !run.includes("\\") && !path8.posix.isAbsolute(run) && !/^[A-Za-z]:/.test(run)) {
9016
+ if (typeof run === "string" && !run.includes("\\") && !path9.posix.isAbsolute(run) && !/^[A-Za-z]:/.test(run)) {
9002
9017
  const target = completeRunExtension(run);
9003
- if (FLOW_FILE_NAME_PATTERN.test(path8.posix.basename(target))) runTargets.add(target);
9018
+ if (FLOW_FILE_NAME_PATTERN.test(path9.posix.basename(target))) runTargets.add(target);
9004
9019
  }
9005
9020
  const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
9006
9021
  if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
@@ -9013,11 +9028,14 @@ function collectFlowRequests(doc) {
9013
9028
  visit(step.steps, depth + 1);
9014
9029
  }
9015
9030
  };
9016
- if (isRecord(doc)) visit(doc.steps, 0);
9031
+ if (isRecord(doc)) {
9032
+ visit(doc.steps, 0);
9033
+ visit(doc.shutdown, 0);
9034
+ }
9017
9035
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
9018
9036
  }
9019
9037
  function baselineKeyFor(canonicalPath2, flowName) {
9020
- const stem = path8.basename(canonicalPath2, ".yaml");
9038
+ const stem = path9.basename(canonicalPath2, ".yaml");
9021
9039
  return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
9022
9040
  }
9023
9041
  function flowMemberKey(anchorDir, target) {
@@ -9046,11 +9064,11 @@ function nestedFlowTarget(args) {
9046
9064
  return { kind: "name", projectRoot, name, path: paths[0], paths };
9047
9065
  }
9048
9066
  if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
9049
- if (!FLOW_FILE_NAME_PATTERN.test(path8.basename(flowPath))) return void 0;
9067
+ if (!FLOW_FILE_NAME_PATTERN.test(path9.basename(flowPath))) return void 0;
9050
9068
  return { kind: "e2e_test_path", path: flowPath };
9051
9069
  }
9052
9070
  function isResolvedAbsolute(value) {
9053
- return typeof value === "string" && path8.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
9071
+ return typeof value === "string" && path9.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
9054
9072
  }
9055
9073
 
9056
9074
  // ../registry/src/failure-codes.ts
@@ -9518,9 +9536,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
9518
9536
  import { randomUUID as randomUUID3 } from "node:crypto";
9519
9537
  import { AsyncLocalStorage } from "node:async_hooks";
9520
9538
  var resolvedDuringInvocation = new AsyncLocalStorage();
9521
- function valueAtPath(root, path14) {
9539
+ function valueAtPath(root, path15) {
9522
9540
  let current = root;
9523
- for (const key of path14) {
9541
+ for (const key of path15) {
9524
9542
  if (current === null || typeof current !== "object") return void 0;
9525
9543
  if (!Object.hasOwn(current, key)) return void 0;
9526
9544
  current = current[key];
@@ -9578,11 +9596,10 @@ function describeParamIssues(error, params) {
9578
9596
  }
9579
9597
 
9580
9598
  // ../argent-tools-client/src/link-config.ts
9581
- import * as path9 from "node:path";
9582
- import { homedir as homedir4 } from "node:os";
9599
+ import * as path10 from "node:path";
9583
9600
  import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
9584
- var LINK_DIR = path9.join(homedir4(), ".argent");
9585
- var LINK_FILE = path9.join(LINK_DIR, "link.json");
9601
+ var LINK_DIR = argentHomeDir();
9602
+ var LINK_FILE = path10.join(LINK_DIR, "link.json");
9586
9603
  async function readLinkConfig() {
9587
9604
  try {
9588
9605
  const raw = await readFile2(LINK_FILE, "utf8");
@@ -9635,14 +9652,14 @@ import {
9635
9652
  writeFile as writeFile3
9636
9653
  } from "node:fs/promises";
9637
9654
  import { constants, tmpdir } from "node:os";
9638
- import * as path10 from "node:path";
9655
+ import * as path11 from "node:path";
9639
9656
 
9640
9657
  // ../archive/src/index.ts
9641
9658
  import { spawn as spawn2 } from "node:child_process";
9642
9659
  import { once } from "node:events";
9643
9660
  import { createReadStream, createWriteStream } from "node:fs";
9644
9661
  import { open, rm, readdir as readdir3 } from "node:fs/promises";
9645
- import { basename as basename4, dirname as dirname5, join as join9, resolve as resolve7, sep as sep2 } from "node:path";
9662
+ import { basename as basename4, dirname as dirname5, join as join10, resolve as resolve8, sep as sep2 } from "node:path";
9646
9663
  import { Writable } from "node:stream";
9647
9664
  import { pipeline } from "node:stream/promises";
9648
9665
  import zlib from "node:zlib";
@@ -9797,7 +9814,7 @@ async function runTar(archive, args, signal) {
9797
9814
  child.on("error", (err) => {
9798
9815
  childError = err;
9799
9816
  });
9800
- const closed = new Promise((resolve11) => child.once("close", resolve11));
9817
+ const closed = new Promise((resolve12) => child.once("close", resolve12));
9801
9818
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
9802
9819
  maxLines: MAX_LISTING_LINES,
9803
9820
  onOverflow: () => child.kill()
@@ -9846,16 +9863,16 @@ async function runTar(archive, args, signal) {
9846
9863
  function normalizeTarMemberPath(memberPath) {
9847
9864
  return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
9848
9865
  }
9849
- function isContainedPath(path14, windows = process.platform === "win32") {
9850
- const slashed = path14.replace(/\\/g, "/");
9866
+ function isContainedPath(path15, windows = process.platform === "win32") {
9867
+ const slashed = path15.replace(/\\/g, "/");
9851
9868
  const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
9852
9869
  return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
9853
9870
  }
9854
9871
  function isSafeTarMember(memberPath, destDir) {
9855
9872
  const normalized = normalizeTarMemberPath(memberPath);
9856
9873
  if (!isContainedPath(normalized)) return false;
9857
- const root = resolve7(destDir);
9858
- return resolve7(destDir, normalized).startsWith(root + sep2);
9874
+ const root = resolve8(destDir);
9875
+ return resolve8(destDir, normalized).startsWith(root + sep2);
9859
9876
  }
9860
9877
  async function readListing(archive, args, signal) {
9861
9878
  try {
@@ -9907,7 +9924,7 @@ async function assertSafeArchive(archive, destDir, signal) {
9907
9924
  async function resolveMember(destDir, expectedName) {
9908
9925
  const entries = await readdir3(destDir);
9909
9926
  if (entries.includes(expectedName)) {
9910
- return join9(destDir, expectedName);
9927
+ return join10(destDir, expectedName);
9911
9928
  }
9912
9929
  const real = entries.filter((e) => !e.startsWith("._"));
9913
9930
  if (real.length !== 1) {
@@ -9915,7 +9932,7 @@ async function resolveMember(destDir, expectedName) {
9915
9932
  `Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
9916
9933
  );
9917
9934
  }
9918
- return join9(destDir, real[0]);
9935
+ return join10(destDir, real[0]);
9919
9936
  }
9920
9937
  async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
9921
9938
  signal?.throwIfAborted();
@@ -9968,20 +9985,20 @@ function interpolatePath(template, args) {
9968
9985
  return missing ? null : out;
9969
9986
  }
9970
9987
  function callerPath(p) {
9971
- const onCurrentDrive = path10.sep === "\\" && /^[\\/](?![\\/])/.test(p);
9972
- if (!onCurrentDrive && (path10.isAbsolute(p) || path10.win32.isAbsolute(p) || isUnexpandedPath(p))) {
9988
+ const onCurrentDrive = path11.sep === "\\" && /^[\\/](?![\\/])/.test(p);
9989
+ if (!onCurrentDrive && (path11.isAbsolute(p) || path11.win32.isAbsolute(p) || isUnexpandedPath(p))) {
9973
9990
  return p;
9974
9991
  }
9975
- const { root } = path10.parse(p);
9992
+ const { root } = path11.parse(p);
9976
9993
  const rest = p.slice(root.length);
9977
9994
  if (!rest.split(/[\\/]/).includes("..")) {
9978
- const resolved = path10.resolve(p);
9979
- const last = p.split(path10.sep === "\\" ? /[\\/]/ : "/").at(-1);
9980
- const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path10.sep);
9981
- return dirOnly ? `${resolved}${path10.sep}` : resolved;
9995
+ const resolved = path11.resolve(p);
9996
+ const last = p.split(path11.sep === "\\" ? /[\\/]/ : "/").at(-1);
9997
+ const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path11.sep);
9998
+ return dirOnly ? `${resolved}${path11.sep}` : resolved;
9982
9999
  }
9983
- const base = path10.resolve(root);
9984
- return base.endsWith(path10.sep) ? `${base}${rest}` : `${base}${path10.sep}${rest}`;
10000
+ const base = path11.resolve(root);
10001
+ return base.endsWith(path11.sep) ? `${base}${rest}` : `${base}${path11.sep}${rest}`;
9985
10002
  }
9986
10003
  async function specPath(spec, args) {
9987
10004
  if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
@@ -10028,9 +10045,9 @@ function untrackArchive(archive) {
10028
10045
  process.removeListener("exit", removePendingArchives);
10029
10046
  }
10030
10047
  function sha256File(filePath, signal) {
10031
- return new Promise((resolve11, reject) => {
10048
+ return new Promise((resolve12, reject) => {
10032
10049
  const hash = createHash2("sha256");
10033
- createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve11(hash.digest("hex"))).on("error", reject);
10050
+ createReadStream2(filePath, { signal }).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve12(hash.digest("hex"))).on("error", reject);
10034
10051
  });
10035
10052
  }
10036
10053
  function toolServerError(text) {
@@ -10089,7 +10106,7 @@ async function uploadTar(tarPath, format, endpoint, signal) {
10089
10106
  }
10090
10107
  async function uploadFile(sourcePath, endpoint, signal) {
10091
10108
  const format = pickArchiveFormat(endpoint.formats);
10092
- const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
10109
+ const tarPath = path11.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
10093
10110
  trackArchive(tarPath);
10094
10111
  try {
10095
10112
  await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
@@ -10164,7 +10181,7 @@ async function prepareFileInputs(specs, args, opts) {
10164
10181
  wire.mtimeMs = st.mtimeMs;
10165
10182
  }
10166
10183
  if (opts.uploadEndpoint && st) {
10167
- process.stderr.write(`Uploading ${path10.basename(filePath)} to the remote tool-server...
10184
+ process.stderr.write(`Uploading ${path11.basename(filePath)} to the remote tool-server...
10168
10185
  `);
10169
10186
  Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
10170
10187
  }
@@ -10174,7 +10191,7 @@ async function prepareFileInputs(specs, args, opts) {
10174
10191
  return out;
10175
10192
  }
10176
10193
  function isAllowedClientFilePath(p) {
10177
- if (!path10.isAbsolute(p)) return false;
10194
+ if (!path11.isAbsolute(p)) return false;
10178
10195
  const segments = p.split(/[\\/]+/);
10179
10196
  if (segments.includes("..")) return false;
10180
10197
  const file = segments[segments.length - 1] ?? "";
@@ -10185,7 +10202,7 @@ function isClientFileDirective2(value) {
10185
10202
  return !!value && typeof value === "object" && value[CLIENT_FILE_MARKER2] === true && typeof value.path === "string" && typeof value.content === "string";
10186
10203
  }
10187
10204
  async function replaceFile(target, bytes, mode) {
10188
- const temp = path10.join(path10.dirname(target), `.baseline-${randomUUID4()}.tmp`);
10205
+ const temp = path11.join(path11.dirname(target), `.baseline-${randomUUID4()}.tmp`);
10189
10206
  try {
10190
10207
  await writeFile3(temp, bytes, { flag: "wx" });
10191
10208
  if (mode !== void 0) await chmod3(temp, mode & 511);
@@ -10196,27 +10213,27 @@ async function replaceFile(target, bytes, mode) {
10196
10213
  }
10197
10214
  }
10198
10215
  async function writeBaselineFile(file, bytes, allowedDirs) {
10199
- if (!path10.isAbsolute(file) || path10.normalize(file) !== file || file.split(/[\\/]/).includes("..") || !file.endsWith(".png") || !allowedDirs.includes(path10.dirname(file))) {
10216
+ if (!path11.isAbsolute(file) || path11.normalize(file) !== file || file.split(/[\\/]/).includes("..") || !file.endsWith(".png") || !allowedDirs.includes(path11.dirname(file))) {
10200
10217
  return allowedDirs.length === 0 ? "this call writes no baselines" : `${file} is not a baseline of this call (${allowedDirs.map((d) => `${d}/<name>.png`).join(", ")})`;
10201
10218
  }
10202
10219
  if (bytes.length > MAX_CONTENT_BYTES) {
10203
10220
  return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
10204
10221
  }
10205
- const dir = path10.dirname(file);
10222
+ const dir = path11.dirname(file);
10206
10223
  await mkdir3(dir, { recursive: true });
10207
10224
  const link = await lstat(file).catch(() => null);
10208
10225
  const real = link === null ? null : await realpath2(file).catch(() => null);
10209
10226
  if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
10210
10227
  if (real !== null) {
10211
10228
  if (!real.endsWith(".png")) return `${file} links to a file that is not a PNG file`;
10212
- if (path10.dirname(real) !== await realpath2(dir)) {
10229
+ if (path11.dirname(real) !== await realpath2(dir)) {
10213
10230
  return `${file} links outside its baseline directory`;
10214
10231
  }
10215
10232
  }
10216
10233
  const existing = real === null ? null : await stat3(real);
10217
10234
  if (existing !== null && !existing.isFile()) return `${file} is not a regular file`;
10218
10235
  await replaceFile(
10219
- real ?? path10.join(await realpath2(dir), path10.basename(file)),
10236
+ real ?? path11.join(await realpath2(dir), path11.basename(file)),
10220
10237
  bytes,
10221
10238
  existing?.mode
10222
10239
  );
@@ -10242,7 +10259,7 @@ async function applyClientFileDirectives(result, opts = {}) {
10242
10259
  if (isClientFileDirective2(value)) {
10243
10260
  if (!isAllowedClientFilePath(value.path)) return null;
10244
10261
  try {
10245
- await mkdir3(path10.dirname(value.path), { recursive: true });
10262
+ await mkdir3(path11.dirname(value.path), { recursive: true });
10246
10263
  await writeFile3(value.path, value.content, "utf8");
10247
10264
  written.push(value.path);
10248
10265
  return value.path;
@@ -10271,13 +10288,13 @@ async function applyClientFileDirectives(result, opts = {}) {
10271
10288
  // ../argent-tools-client/src/flow-files.ts
10272
10289
  var import_yaml = __toESM(require_dist2(), 1);
10273
10290
  import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
10274
- import * as path11 from "node:path";
10291
+ import * as path12 from "node:path";
10275
10292
  var INLINE_MEMBERS_BYTES = 256 * 1024;
10276
10293
  function filesLogEnabled() {
10277
10294
  return (process.env.ARGENT_E2E_FILES_LOG ?? process.env.ARGENT_FLOW_FILES_LOG) === "1";
10278
10295
  }
10279
10296
  function isWithin(inner, outer) {
10280
- return inner === outer || inner.startsWith(outer.endsWith(path11.sep) ? outer : outer + path11.sep);
10297
+ return inner === outer || inner.startsWith(outer.endsWith(path12.sep) ? outer : outer + path12.sep);
10281
10298
  }
10282
10299
  function printable(text) {
10283
10300
  return [...text].map(
@@ -10285,7 +10302,7 @@ function printable(text) {
10285
10302
  ).join("");
10286
10303
  }
10287
10304
  function isResolvedAbsolute2(value) {
10288
- return typeof value === "string" && path11.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
10305
+ return typeof value === "string" && path12.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
10289
10306
  }
10290
10307
  function namesValidFlow(args) {
10291
10308
  let canonical;
@@ -10297,13 +10314,13 @@ function namesValidFlow(args) {
10297
10314
  const { project_root, e2e_test_path: testPath, name } = canonical;
10298
10315
  if (!isResolvedAbsolute2(project_root)) return false;
10299
10316
  if (name === void 0) {
10300
- return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path11.basename(testPath));
10317
+ return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path12.basename(testPath));
10301
10318
  }
10302
10319
  return testPath === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
10303
10320
  }
10304
10321
  function savedFlowProject(file) {
10305
- if (!path11.isAbsolute(file)) return null;
10306
- for (let dir = path11.dirname(file); dir !== path11.dirname(dir); dir = path11.dirname(dir)) {
10322
+ if (!path12.isAbsolute(file)) return null;
10323
+ for (let dir = path12.dirname(file); dir !== path12.dirname(dir); dir = path12.dirname(dir)) {
10307
10324
  const project = e2eDirProject(dir);
10308
10325
  if (project !== null) return project;
10309
10326
  }
@@ -10318,11 +10335,11 @@ async function landing(spelled) {
10318
10335
  const canonical = await canonicalFlowPath(spelled);
10319
10336
  let at = spelled;
10320
10337
  for (; ; ) {
10321
- const parent = path11.dirname(at);
10338
+ const parent = path12.dirname(at);
10322
10339
  if (parent === at) return { canonical, fence: spelled, ...failure };
10323
10340
  const real = await realpath3(parent).catch(() => null);
10324
10341
  if (real !== null) {
10325
- return { canonical, fence: path11.join(real, path11.basename(at)), ...failure };
10342
+ return { canonical, fence: path12.join(real, path12.basename(at)), ...failure };
10326
10343
  }
10327
10344
  at = parent;
10328
10345
  }
@@ -10330,10 +10347,10 @@ async function landing(spelled) {
10330
10347
  }
10331
10348
  async function closureRoots(rootPath, rootCanonical, projectRoot) {
10332
10349
  const candidates = [];
10333
- if (typeof projectRoot === "string" && path11.isAbsolute(projectRoot)) {
10350
+ if (typeof projectRoot === "string" && path12.isAbsolute(projectRoot)) {
10334
10351
  candidates.push(projectRoot, ...e2eDirsFor(projectRoot));
10335
10352
  }
10336
- candidates.push(path11.dirname(rootPath), path11.dirname(rootCanonical));
10353
+ candidates.push(path12.dirname(rootPath), path12.dirname(rootCanonical));
10337
10354
  for (const file of [rootPath, rootCanonical]) {
10338
10355
  const project = savedFlowProject(file);
10339
10356
  if (project !== null) candidates.push(project);
@@ -10346,11 +10363,11 @@ async function closureRoots(rootPath, rootCanonical, projectRoot) {
10346
10363
  return real.filter((root) => !real.some((other) => other !== root && isWithin(root, other)));
10347
10364
  }
10348
10365
  async function readFlowMember(anchorDir, target, roots, budget, opts) {
10349
- const spelled = anchorDir + path11.sep + target;
10366
+ const spelled = anchorDir + path12.sep + target;
10350
10367
  const { canonical, fence, missing, error } = await landing(spelled);
10351
10368
  const spelling = await classifyOnDiskSpelling(
10352
- path11.dirname(spelled),
10353
- path11.posix.basename(target),
10369
+ path12.dirname(spelled),
10370
+ path12.posix.basename(target),
10354
10371
  FLOW_FILE_NAME_PATTERN
10355
10372
  );
10356
10373
  const member = {
@@ -10375,7 +10392,7 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
10375
10392
  return { member: { ...member, state: "missing" }, sent: "missing" };
10376
10393
  }
10377
10394
  if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
10378
- if (!/\.ya?ml$/i.test(path11.basename(canonical))) {
10395
+ if (!/\.ya?ml$/i.test(path12.basename(canonical))) {
10379
10396
  return refuse(`${target} links to a file that is not a YAML file`);
10380
10397
  }
10381
10398
  const sent = await sendBytes(member, canonical, budget, opts);
@@ -10500,12 +10517,12 @@ function memberCollector(roots, opts) {
10500
10517
  }
10501
10518
  async function savedTest(target) {
10502
10519
  for (const candidate of target.paths) {
10503
- const found = await flow(path11.dirname(candidate), path11.basename(candidate), true);
10520
+ const found = await flow(path12.dirname(candidate), path12.basename(candidate), true);
10504
10521
  if (found !== void 0) return found;
10505
10522
  }
10506
10523
  let first;
10507
10524
  for (const candidate of target.paths) {
10508
- first ??= await flow(path11.dirname(candidate), path11.basename(candidate));
10525
+ first ??= await flow(path12.dirname(candidate), path12.basename(candidate));
10509
10526
  }
10510
10527
  return first;
10511
10528
  }
@@ -10542,7 +10559,7 @@ function memberCollector(roots, opts) {
10542
10559
  const requests = collectFlowRequests(doc);
10543
10560
  for (const name of requests.snapshots) snapshots.add(name);
10544
10561
  for (const step of requests.toolSteps) await toolFiles(step);
10545
- const anchorDir = path11.dirname(file.canonical);
10562
+ const anchorDir = path12.dirname(file.canonical);
10546
10563
  for (const target of requests.runTargets) {
10547
10564
  const key = flowMemberKey(anchorDir, target);
10548
10565
  if (visited.has(key)) continue;
@@ -10564,8 +10581,8 @@ function memberCollector(roots, opts) {
10564
10581
  }
10565
10582
  }
10566
10583
  if (snapshots.size === 0) continue;
10567
- const dir = path11.join(
10568
- path11.dirname(run.canonical),
10584
+ const dir = path12.join(
10585
+ path12.dirname(run.canonical),
10569
10586
  "__baselines__",
10570
10587
  baselineKeyFor(run.canonical, run.flowName)
10571
10588
  );
@@ -10589,7 +10606,7 @@ function memberCollector(roots, opts) {
10589
10606
  if (!name.endsWith(".png")) continue;
10590
10607
  const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
10591
10608
  if (!updates && !compared) continue;
10592
- const file = path11.join(dir, name);
10609
+ const file = path12.join(dir, name);
10593
10610
  if (tools.has(file)) continue;
10594
10611
  const member = { role: "baseline", key: file, path: file };
10595
10612
  const entry = await baselineEntry(file, roots, updates && !compared);
@@ -10612,8 +10629,8 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
10612
10629
  if (!namesValidFlow(args)) return {};
10613
10630
  const canonical = await canonicalFlowPath(rootPath);
10614
10631
  const spelling = await classifyOnDiskSpelling(
10615
- path11.dirname(rootPath),
10616
- path11.basename(rootPath),
10632
+ path12.dirname(rootPath),
10633
+ path12.basename(rootPath),
10617
10634
  FLOW_FILE_NAME_PATTERN
10618
10635
  );
10619
10636
  const collector = memberCollector(
@@ -10624,7 +10641,7 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
10624
10641
  {
10625
10642
  canonical,
10626
10643
  text: rootBytes.toString("utf8"),
10627
- flowName: path11.basename(rootPath, ".yaml"),
10644
+ flowName: path12.basename(rootPath, ".yaml"),
10628
10645
  hop: 0,
10629
10646
  updates: args.updateBaselines === true,
10630
10647
  platform: callPlatform(args)
@@ -10653,31 +10670,31 @@ async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
10653
10670
  if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
10654
10671
  return [];
10655
10672
  }
10656
- const recording = path11.join(recordingDirFor(projectRoot), `${name}.yaml`);
10673
+ const recording = path12.join(recordingDirFor(projectRoot), `${name}.yaml`);
10657
10674
  const collector = memberCollector(
10658
10675
  await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
10659
10676
  opts
10660
10677
  );
10661
10678
  await collector.toolFiles(step);
10662
10679
  if (canonicalToolId(step.tool) === "e2e-execute") {
10663
- const self = await collector.flow(path11.dirname(recording), path11.basename(recording));
10680
+ const self = await collector.flow(path12.dirname(recording), path12.basename(recording));
10664
10681
  let runArgs = step.args;
10665
10682
  const named = nestedFlowTarget(runArgs);
10666
10683
  if (named?.kind === "e2e_test_path") {
10667
- const stem = path11.basename(named.path, ".yaml");
10668
- const base = path11.basename(named.path);
10669
- const dir = path11.resolve(path11.dirname(named.path));
10670
- const recordingDir = path11.dirname(recording);
10684
+ const stem = path12.basename(named.path, ".yaml");
10685
+ const base = path12.basename(named.path);
10686
+ const dir = path12.resolve(path12.dirname(named.path));
10687
+ const recordingDir = path12.dirname(recording);
10671
10688
  const dirs = [recordingDir, ...e2eRunFallbackDirs(recordingDir, base)];
10672
- if (dirs.some((d) => path11.resolve(d) === dir)) {
10673
- await collector.flow(path11.dirname(named.path), base);
10689
+ if (dirs.some((d) => path12.resolve(d) === dir)) {
10690
+ await collector.flow(path12.dirname(named.path), base);
10674
10691
  runArgs = { ...runArgs, name: stem };
10675
10692
  delete runArgs.e2e_test_path;
10676
10693
  }
10677
10694
  }
10678
10695
  const target = nestedFlowTarget(runArgs);
10679
10696
  if (target?.kind === "name") {
10680
- await collector.flow(path11.dirname(self.member.canonical), `${target.name}.yaml`);
10697
+ await collector.flow(path12.dirname(self.member.canonical), `${target.name}.yaml`);
10681
10698
  const run = await collector.nestedRun(
10682
10699
  target,
10683
10700
  0,
@@ -10871,10 +10888,10 @@ function assertFiniteNumbers(args) {
10871
10888
  if (typeof item === "object" && item !== null) {
10872
10889
  pending.push({ value: item, key, parent: visit });
10873
10890
  } else if (typeof item === "number" && !Number.isFinite(item)) {
10874
- const path14 = [key];
10875
- for (let at = visit; at.parent; at = at.parent) path14.push(at.key);
10876
- path14.reverse();
10877
- issues.push({ code: "invalid_type", path: path14, message: `expected a number, got ${item}` });
10891
+ const path15 = [key];
10892
+ for (let at = visit; at.parent; at = at.parent) path15.push(at.key);
10893
+ path15.reverse();
10894
+ issues.push({ code: "invalid_type", path: path15, message: `expected a number, got ${item}` });
10878
10895
  if (issues.length === MAX_NON_FINITE_ISSUES) break;
10879
10896
  }
10880
10897
  }
@@ -11059,7 +11076,7 @@ function createToolsClient(options = {}) {
11059
11076
  log: diagnose,
11060
11077
  baselineDirs,
11061
11078
  collectMembers: collectFlowMembers,
11062
- collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) => path12.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
11079
+ collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) => path13.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
11063
11080
  toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
11064
11081
  signal: opts?.signal
11065
11082
  });
@@ -11072,7 +11089,7 @@ function createToolsClient(options = {}) {
11072
11089
  }
11073
11090
  if (filesLogEnabled()) {
11074
11091
  for (const file of applied.written) {
11075
- if (baselineDirs.includes(path12.dirname(file))) {
11092
+ if (baselineDirs.includes(path13.dirname(file))) {
11076
11093
  diagnose(`[e2e-files] baseline ${file}: written`);
11077
11094
  }
11078
11095
  }
@@ -11216,7 +11233,7 @@ import {
11216
11233
  } from "node:fs/promises";
11217
11234
  import { constants as fsConstants } from "node:fs";
11218
11235
  import { tmpdir as tmpdir2 } from "node:os";
11219
- import { basename as basename7, dirname as dirname9, extname as extname2, isAbsolute as isAbsolute6, join as join13, normalize as normalize2, resolve as resolve10, sep as sep5 } from "node:path";
11236
+ import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as join14, normalize as normalize2, resolve as resolve11, sep as sep5 } from "node:path";
11220
11237
  import { createHash as createHash3 } from "node:crypto";
11221
11238
  var ARTIFACT_MARKER2 = "__argentArtifact";
11222
11239
  function isArtifactHandle(value) {
@@ -11240,16 +11257,16 @@ function projectSlug() {
11240
11257
  return `${name}-${hash}`;
11241
11258
  }
11242
11259
  function artifactsRoot() {
11243
- return process.env.ARGENT_ARTIFACTS_DIR ?? join13(tmpdir2(), "argent-artifacts");
11260
+ return process.env.ARGENT_ARTIFACTS_DIR ?? join14(tmpdir2(), "argent-artifacts");
11244
11261
  }
11245
11262
  function artifactDir(deviceId) {
11246
11263
  const parts = [artifactsRoot(), projectSlug(), sessionId()];
11247
11264
  if (deviceId) parts.push(sanitizeSegment(deviceId));
11248
- return join13(...parts);
11265
+ return join14(...parts);
11249
11266
  }
11250
11267
  function durableBaseDir() {
11251
11268
  const projectRoot = findProjectRoot(process.cwd());
11252
- return projectRoot ?? dirname9(argentHomeDir());
11269
+ return projectRoot ?? resolveHomeDir();
11253
11270
  }
11254
11271
  var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
11255
11272
  var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
@@ -11263,9 +11280,9 @@ function configuredRecordingsDir() {
11263
11280
  if (typeof value !== "string") return null;
11264
11281
  const trimmed = value.trim();
11265
11282
  if (trimmed === "") return null;
11266
- const home = dirname9(argentHomeDir());
11267
- const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join13(home, trimmed.slice(2)) : trimmed;
11268
- return resolve10(durableBaseDir(), expanded);
11283
+ const home = resolveHomeDir();
11284
+ const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join14(home, trimmed.slice(2)) : trimmed;
11285
+ return resolve11(durableBaseDir(), expanded);
11269
11286
  }
11270
11287
  var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
11271
11288
  async function readCapped(res, cap) {
@@ -11298,10 +11315,10 @@ async function writeDurableUnique(dir, filename, write) {
11298
11315
  const stem = filename.slice(0, filename.length - ext.length);
11299
11316
  for (let i = 1; i <= 1e3; i++) {
11300
11317
  const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
11301
- const path14 = join13(dir, candidate);
11318
+ const path15 = join14(dir, candidate);
11302
11319
  try {
11303
- await write(path14);
11304
- return path14;
11320
+ await write(path15);
11321
+ return path15;
11305
11322
  } catch (err) {
11306
11323
  if (err?.code === "EEXIST") continue;
11307
11324
  throw err;
@@ -11321,21 +11338,21 @@ function durableSaveTarget(handle) {
11321
11338
  if (configured) {
11322
11339
  return {
11323
11340
  dir: configured,
11324
- path: join13(configured, sanitizeSegment(handle.filename)),
11341
+ path: join14(configured, sanitizeSegment(handle.filename)),
11325
11342
  base: configured,
11326
11343
  rel: ""
11327
11344
  };
11328
11345
  }
11329
11346
  }
11330
11347
  const base = durableBaseDir();
11331
- const dir = join13(base, rel);
11332
- return { dir, path: join13(dir, sanitizeSegment(handle.filename)), base, rel };
11348
+ const dir = join14(base, rel);
11349
+ return { dir, path: join14(dir, sanitizeSegment(handle.filename)), base, rel };
11333
11350
  }
11334
11351
  async function confineToRealBase(dir, base, rel) {
11335
11352
  try {
11336
11353
  const realDir = await realpath4(dir);
11337
11354
  const realBase = await realpath4(base);
11338
- return realDir === join13(realBase, rel);
11355
+ return realDir === join14(realBase, rel);
11339
11356
  } catch {
11340
11357
  return false;
11341
11358
  }
@@ -11359,9 +11376,9 @@ async function resolveLocalFile(handle) {
11359
11376
  }
11360
11377
  async function downloadAndExtractArchive(handle, data, dir, signal) {
11361
11378
  signal?.throwIfAborted();
11362
- const attemptDir = await mkdtemp(join13(dir, "bundle-"));
11363
- const tarball = join13(attemptDir, "download.tar");
11364
- const extractDir = join13(attemptDir, "files");
11379
+ const attemptDir = await mkdtemp(join14(dir, "bundle-"));
11380
+ const tarball = join14(attemptDir, "download.tar");
11381
+ const extractDir = join14(attemptDir, "files");
11365
11382
  try {
11366
11383
  await writeFile4(tarball, data, { signal });
11367
11384
  await mkdir4(extractDir);
@@ -11461,7 +11478,7 @@ async function materializeArtifacts(result, ctx) {
11461
11478
  return await downloadAndExtractArchive(value, data, dir, ctx.signal);
11462
11479
  }
11463
11480
  if (value.size > 0 && data.length !== value.size) return null;
11464
- const downloadedPath = join13(dir, sanitizeSegment(value.filename));
11481
+ const downloadedPath = join14(dir, sanitizeSegment(value.filename));
11465
11482
  await writeFile4(downloadedPath, data);
11466
11483
  if (value.mimeType.startsWith("image/")) {
11467
11484
  images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
@@ -11496,11 +11513,11 @@ function getDeviceIdFromArgs(args) {
11496
11513
 
11497
11514
  // src/bundled-paths.ts
11498
11515
  import * as fs8 from "node:fs";
11499
- import * as path13 from "node:path";
11516
+ import * as path14 from "node:path";
11500
11517
  function readPackageVersion() {
11501
11518
  try {
11502
11519
  const pkg = JSON.parse(
11503
- fs8.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
11520
+ fs8.readFileSync(path14.join(import.meta.dirname, "..", "package.json"), "utf8")
11504
11521
  );
11505
11522
  return pkg.version;
11506
11523
  } catch {
@@ -11511,15 +11528,15 @@ var PACKAGE_NAME = "@swmansion/argent";
11511
11528
  function findDeclaringRoot(startDir) {
11512
11529
  let dir = startDir;
11513
11530
  for (; ; ) {
11514
- if (fs8.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
11531
+ if (fs8.existsSync(path14.join(dir, ".argent", "install.json"))) return dir;
11515
11532
  try {
11516
- const manifest = JSON.parse(fs8.readFileSync(path13.join(dir, "package.json"), "utf8"));
11533
+ const manifest = JSON.parse(fs8.readFileSync(path14.join(dir, "package.json"), "utf8"));
11517
11534
  if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
11518
11535
  return dir;
11519
11536
  }
11520
11537
  } catch {
11521
11538
  }
11522
- const parent = path13.dirname(dir);
11539
+ const parent = path14.dirname(dir);
11523
11540
  if (parent === dir) return null;
11524
11541
  dir = parent;
11525
11542
  }
@@ -11527,12 +11544,12 @@ function findDeclaringRoot(startDir) {
11527
11544
  function findStablePackageDir(startDir, packageRoot) {
11528
11545
  let dir = startDir;
11529
11546
  for (; ; ) {
11530
- const candidate = path13.join(dir, "node_modules", PACKAGE_NAME);
11547
+ const candidate = path14.join(dir, "node_modules", PACKAGE_NAME);
11531
11548
  try {
11532
11549
  if (fs8.realpathSync(candidate) === packageRoot) return candidate;
11533
11550
  } catch {
11534
11551
  }
11535
- const parent = path13.dirname(dir);
11552
+ const parent = path14.dirname(dir);
11536
11553
  if (parent === dir) return void 0;
11537
11554
  dir = parent;
11538
11555
  }
@@ -11542,7 +11559,7 @@ function classifyInstall() {
11542
11559
  let dir;
11543
11560
  let cwd;
11544
11561
  try {
11545
- packageRoot = fs8.realpathSync(path13.join(import.meta.dirname, ".."));
11562
+ packageRoot = fs8.realpathSync(path14.join(import.meta.dirname, ".."));
11546
11563
  cwd = process.cwd();
11547
11564
  dir = cwd;
11548
11565
  } catch {
@@ -11550,8 +11567,8 @@ function classifyInstall() {
11550
11567
  }
11551
11568
  for (; ; ) {
11552
11569
  try {
11553
- const nmReal = fs8.realpathSync(path13.join(dir, "node_modules"));
11554
- if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path13.sep)) {
11570
+ const nmReal = fs8.realpathSync(path14.join(dir, "node_modules"));
11571
+ if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path14.sep)) {
11555
11572
  return {
11556
11573
  kind: "local",
11557
11574
  projectRoot: findDeclaringRoot(cwd) ?? dir,
@@ -11560,22 +11577,22 @@ function classifyInstall() {
11560
11577
  }
11561
11578
  } catch {
11562
11579
  }
11563
- const parent = path13.dirname(dir);
11580
+ const parent = path14.dirname(dir);
11564
11581
  if (parent === dir) break;
11565
11582
  dir = parent;
11566
11583
  }
11567
- if (packageRoot.includes(`${path13.sep}.yarn${path13.sep}`)) {
11584
+ if (packageRoot.includes(`${path14.sep}.yarn${path14.sep}`)) {
11568
11585
  const declRoot = findDeclaringRoot(cwd);
11569
11586
  if (declRoot) return { kind: "local", projectRoot: declRoot };
11570
11587
  }
11571
11588
  return { kind: "global" };
11572
11589
  }
11573
11590
  var classifiedInstall = classifyInstall();
11574
- var packageDir = classifiedInstall.stablePackageDir ?? path13.join(import.meta.dirname, "..");
11591
+ var packageDir = classifiedInstall.stablePackageDir ?? path14.join(import.meta.dirname, "..");
11575
11592
  var BUNDLED_RUNTIME_PATHS = {
11576
- bundlePath: path13.join(packageDir, "dist", "tool-server.cjs"),
11577
- simulatorServerDir: path13.join(packageDir, "bin"),
11578
- nativeDevtoolsDir: path13.join(packageDir, "dylibs"),
11593
+ bundlePath: path14.join(packageDir, "dist", "tool-server.cjs"),
11594
+ simulatorServerDir: path14.join(packageDir, "bin"),
11595
+ nativeDevtoolsDir: path14.join(packageDir, "dylibs"),
11579
11596
  version: readPackageVersion(),
11580
11597
  installKind: classifiedInstall.kind,
11581
11598
  installProjectRoot: classifiedInstall.projectRoot