@swmansion/argent 0.35.1-next.17 → 0.35.1-next.19

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.
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));
@@ -8256,7 +8259,7 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
8256
8259
  }
8257
8260
 
8258
8261
  // ../configuration-core/src/config-access.ts
8259
- import * as path5 from "node:path";
8262
+ import * as path6 from "node:path";
8260
8263
  function readScopeValue(def, scope, options) {
8261
8264
  if (!def.scopes.includes(scope)) return void 0;
8262
8265
  const raw = getAtPath(readConfigObject(scope, options), def.key);
@@ -8291,16 +8294,15 @@ var UnknownConfigKeyError = class extends Error {
8291
8294
  // ../argent-tools-client/src/launcher.ts
8292
8295
  import * as net from "node:net";
8293
8296
  import * as fs5 from "node:fs";
8294
- import * as path6 from "node:path";
8297
+ import * as path7 from "node:path";
8295
8298
  import * as readline from "node:readline";
8296
- import { homedir as homedir3 } from "node:os";
8297
8299
  import { spawn, execFileSync } from "node:child_process";
8298
8300
  import { createHash, randomBytes } from "node:crypto";
8299
8301
  import { mkdir, writeFile, readFile, readdir, unlink, rename, chmod } from "node:fs/promises";
8300
- var STATE_DIR = path6.join(homedir3(), ".argent");
8301
- var STATE_FILE = path6.join(STATE_DIR, "tool-server.json");
8302
- var LOG_FILE = path6.join(STATE_DIR, "tool-server.log");
8303
- 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");
8304
8306
  var AUTH_TOKEN_BYTES = 32;
8305
8307
  var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
8306
8308
  var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
@@ -8326,7 +8328,7 @@ function generateToken() {
8326
8328
  return randomBytes(AUTH_TOKEN_BYTES).toString("hex");
8327
8329
  }
8328
8330
  function findFreePort() {
8329
- return new Promise((resolve11, reject) => {
8331
+ return new Promise((resolve12, reject) => {
8330
8332
  const srv = net.createServer();
8331
8333
  srv.listen(0, "127.0.0.1", () => {
8332
8334
  const addr = srv.address();
@@ -8337,7 +8339,7 @@ function findFreePort() {
8337
8339
  const port = addr.port;
8338
8340
  srv.close((err) => {
8339
8341
  if (err) reject(err);
8340
- else resolve11(port);
8342
+ else resolve12(port);
8341
8343
  });
8342
8344
  });
8343
8345
  srv.on("error", reject);
@@ -8379,7 +8381,7 @@ function isVersionNewer(a, b) {
8379
8381
  function readBundlePackageVersion(bundlePath) {
8380
8382
  try {
8381
8383
  const pkg = JSON.parse(
8382
- fs5.readFileSync(path6.join(path6.dirname(bundlePath), "..", "package.json"), "utf8")
8384
+ fs5.readFileSync(path7.join(path7.dirname(bundlePath), "..", "package.json"), "utf8")
8383
8385
  );
8384
8386
  return typeof pkg.version === "string" ? pkg.version : void 0;
8385
8387
  } catch {
@@ -8438,8 +8440,12 @@ function resolveToolsServerNode() {
8438
8440
  const { bun, deno, electron } = process.versions;
8439
8441
  return !(bun || deno || electron) && fs5.existsSync(process.execPath) ? process.execPath : "node";
8440
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
+ }
8441
8447
  function spawnToolsServer(paths, port, options = {}) {
8442
- return new Promise((resolve11, reject) => {
8448
+ return new Promise((resolve12, reject) => {
8443
8449
  let logFd;
8444
8450
  try {
8445
8451
  fs5.mkdirSync(STATE_DIR, { recursive: true });
@@ -8454,7 +8460,6 @@ function spawnToolsServer(paths, port, options = {}) {
8454
8460
  env: buildToolsServerEnv(paths, port, process.env, options)
8455
8461
  });
8456
8462
  fs5.closeSync(logFd);
8457
- child.unref();
8458
8463
  const pid = child.pid;
8459
8464
  if (!pid) {
8460
8465
  child.once(
@@ -8479,13 +8484,13 @@ function spawnToolsServer(paths, port, options = {}) {
8479
8484
  });
8480
8485
  const rl = readline.createInterface({ input: child.stdout });
8481
8486
  rl.on("line", (line) => {
8482
- const match = line.match(/Tools server listening on http:\/\/.+:(\d+)/);
8483
- if (match) {
8484
- const actualPort = parseInt(match[1], 10);
8487
+ const actualPort = parseListeningPort(line);
8488
+ if (actualPort !== null) {
8485
8489
  rl.close();
8486
8490
  child.stdout?.resume();
8487
8491
  child.stdout?.unref?.();
8488
- settle(() => resolve11({ port: actualPort, pid }));
8492
+ child.unref();
8493
+ settle(() => resolve12({ port: actualPort, pid }));
8489
8494
  }
8490
8495
  });
8491
8496
  child.on("error", (err) => {
@@ -8505,7 +8510,7 @@ function spawnToolsServer(paths, port, options = {}) {
8505
8510
  }
8506
8511
  function stateFileForBundle(bundlePath) {
8507
8512
  const key = createHash("sha256").update(bundlePath).digest("hex").slice(0, 12);
8508
- return path6.join(STATE_DIR, `tool-server-${key}.json`);
8513
+ return path7.join(STATE_DIR, `tool-server-${key}.json`);
8509
8514
  }
8510
8515
  async function readStateFile(file) {
8511
8516
  try {
@@ -8564,7 +8569,7 @@ async function readAllToolsServerStates() {
8564
8569
  const out = [];
8565
8570
  for (const name of names) {
8566
8571
  if (!STATE_FILE_RE.test(name)) continue;
8567
- const file = path6.join(STATE_DIR, name);
8572
+ const file = path7.join(STATE_DIR, name);
8568
8573
  const state = await readStateFile(file);
8569
8574
  if (state) out.push({ file, state });
8570
8575
  }
@@ -8794,7 +8799,7 @@ async function ensureToolsServer(paths) {
8794
8799
  var import_yaml2 = __toESM(require_dist2(), 1);
8795
8800
  import { readFile as readFile5 } from "node:fs/promises";
8796
8801
  import { maxHeaderSize } from "node:http";
8797
- import * as path12 from "node:path";
8802
+ import * as path13 from "node:path";
8798
8803
 
8799
8804
  // ../registry/src/types.ts
8800
8805
  var LINKED_CALL_HEADER = "x-argent-linked";
@@ -8855,8 +8860,8 @@ var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][
8855
8860
  function isUnexpandedPath(p) {
8856
8861
  return UNEXPANDED_PATH.test(p);
8857
8862
  }
8858
- function isClientFileArgument({ spec, path: path14 }) {
8859
- 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);
8860
8865
  }
8861
8866
 
8862
8867
  // ../registry/src/flow-platforms.ts
@@ -8865,22 +8870,22 @@ var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
8865
8870
 
8866
8871
  // ../registry/src/flow-file-refs.ts
8867
8872
  import * as fs7 from "node:fs/promises";
8868
- import * as path8 from "node:path";
8873
+ import * as path9 from "node:path";
8869
8874
 
8870
8875
  // ../registry/src/e2e-dirs.ts
8871
8876
  import * as fs6 from "node:fs/promises";
8872
- import * as path7 from "node:path";
8873
- var E2E_DIR = path7.join(".argent", "e2e");
8874
- 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")]);
8875
8880
  var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
8876
8881
  function e2eDirFor(projectRoot) {
8877
- return path7.join(projectRoot, E2E_DIR);
8882
+ return path8.join(projectRoot, E2E_DIR);
8878
8883
  }
8879
8884
  function e2eDirsFor(projectRoot) {
8880
- return E2E_DIRS.map((dir) => path7.join(projectRoot, dir));
8885
+ return E2E_DIRS.map((dir) => path8.join(projectRoot, dir));
8881
8886
  }
8882
8887
  function e2eFileCandidates(projectRoot, name) {
8883
- return e2eDirsFor(projectRoot).map((dir) => path7.join(dir, `${name}.yaml`));
8888
+ return e2eDirsFor(projectRoot).map((dir) => path8.join(dir, `${name}.yaml`));
8884
8889
  }
8885
8890
  async function exists(file) {
8886
8891
  return fs6.stat(file).then(
@@ -8910,21 +8915,21 @@ async function pickE2eFile(candidates) {
8910
8915
  function e2eShadowWarning(used, shadowed) {
8911
8916
  return `${shadowed} is not used: ${used} has the same name and is read first.`;
8912
8917
  }
8913
- var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path7.basename(dir));
8918
+ var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path8.basename(dir));
8914
8919
  function e2eDirProject(dir) {
8915
8920
  const trimmed = dir.length > 1 ? dir.replace(/[\\/]+$/, "") : dir;
8916
- const argent = path7.dirname(trimmed);
8917
- 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") {
8918
8923
  return null;
8919
8924
  }
8920
- return path7.dirname(argent);
8925
+ return path8.dirname(argent);
8921
8926
  }
8922
8927
  function e2eRunFallbackDirs(anchorDir, target) {
8923
8928
  if (target.includes("/") || target.includes("\\")) return [];
8924
8929
  const project = e2eDirProject(anchorDir);
8925
8930
  if (project === null) return [];
8926
- const anchor = path7.resolve(anchorDir);
8927
- 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);
8928
8933
  }
8929
8934
 
8930
8935
  // ../registry/src/tool-ids.ts
@@ -8977,7 +8982,7 @@ async function canonicalFlowPath(p) {
8977
8982
  return await fs7.realpath(p);
8978
8983
  } catch {
8979
8984
  try {
8980
- 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));
8981
8986
  } catch {
8982
8987
  return p;
8983
8988
  }
@@ -8986,7 +8991,7 @@ async function canonicalFlowPath(p) {
8986
8991
  function completeRunExtension(value) {
8987
8992
  if (value.endsWith(".yaml")) return value;
8988
8993
  const candidate = `${value}.yaml`;
8989
- 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;
8990
8995
  }
8991
8996
  var MAX_RUN_DEPTH = 20;
8992
8997
  var MAX_BLOCK_NESTING = 64;
@@ -9008,9 +9013,9 @@ function collectFlowRequests(doc) {
9008
9013
  for (const step of steps) {
9009
9014
  if (!isRecord(step)) continue;
9010
9015
  const run = step.run;
9011
- 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)) {
9012
9017
  const target = completeRunExtension(run);
9013
- 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);
9014
9019
  }
9015
9020
  const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
9016
9021
  if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
@@ -9030,7 +9035,7 @@ function collectFlowRequests(doc) {
9030
9035
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
9031
9036
  }
9032
9037
  function baselineKeyFor(canonicalPath2, flowName) {
9033
- const stem = path8.basename(canonicalPath2, ".yaml");
9038
+ const stem = path9.basename(canonicalPath2, ".yaml");
9034
9039
  return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
9035
9040
  }
9036
9041
  function flowMemberKey(anchorDir, target) {
@@ -9059,11 +9064,11 @@ function nestedFlowTarget(args) {
9059
9064
  return { kind: "name", projectRoot, name, path: paths[0], paths };
9060
9065
  }
9061
9066
  if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
9062
- 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;
9063
9068
  return { kind: "e2e_test_path", path: flowPath };
9064
9069
  }
9065
9070
  function isResolvedAbsolute(value) {
9066
- return typeof value === "string" && path8.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
9071
+ return typeof value === "string" && path9.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
9067
9072
  }
9068
9073
 
9069
9074
  // ../registry/src/failure-codes.ts
@@ -9531,9 +9536,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
9531
9536
  import { randomUUID as randomUUID3 } from "node:crypto";
9532
9537
  import { AsyncLocalStorage } from "node:async_hooks";
9533
9538
  var resolvedDuringInvocation = new AsyncLocalStorage();
9534
- function valueAtPath(root, path14) {
9539
+ function valueAtPath(root, path15) {
9535
9540
  let current = root;
9536
- for (const key of path14) {
9541
+ for (const key of path15) {
9537
9542
  if (current === null || typeof current !== "object") return void 0;
9538
9543
  if (!Object.hasOwn(current, key)) return void 0;
9539
9544
  current = current[key];
@@ -9591,11 +9596,10 @@ function describeParamIssues(error, params) {
9591
9596
  }
9592
9597
 
9593
9598
  // ../argent-tools-client/src/link-config.ts
9594
- import * as path9 from "node:path";
9595
- import { homedir as homedir4 } from "node:os";
9599
+ import * as path10 from "node:path";
9596
9600
  import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
9597
- var LINK_DIR = path9.join(homedir4(), ".argent");
9598
- var LINK_FILE = path9.join(LINK_DIR, "link.json");
9601
+ var LINK_DIR = argentHomeDir();
9602
+ var LINK_FILE = path10.join(LINK_DIR, "link.json");
9599
9603
  async function readLinkConfig() {
9600
9604
  try {
9601
9605
  const raw = await readFile2(LINK_FILE, "utf8");
@@ -9648,14 +9652,14 @@ import {
9648
9652
  writeFile as writeFile3
9649
9653
  } from "node:fs/promises";
9650
9654
  import { constants, tmpdir } from "node:os";
9651
- import * as path10 from "node:path";
9655
+ import * as path11 from "node:path";
9652
9656
 
9653
9657
  // ../archive/src/index.ts
9654
9658
  import { spawn as spawn2 } from "node:child_process";
9655
9659
  import { once } from "node:events";
9656
9660
  import { createReadStream, createWriteStream } from "node:fs";
9657
9661
  import { open, rm, readdir as readdir3 } from "node:fs/promises";
9658
- 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";
9659
9663
  import { Writable } from "node:stream";
9660
9664
  import { pipeline } from "node:stream/promises";
9661
9665
  import zlib from "node:zlib";
@@ -9810,7 +9814,7 @@ async function runTar(archive, args, signal) {
9810
9814
  child.on("error", (err) => {
9811
9815
  childError = err;
9812
9816
  });
9813
- const closed = new Promise((resolve11) => child.once("close", resolve11));
9817
+ const closed = new Promise((resolve12) => child.once("close", resolve12));
9814
9818
  const stdout = collect(child.stdout, MAX_LISTING_BYTES, {
9815
9819
  maxLines: MAX_LISTING_LINES,
9816
9820
  onOverflow: () => child.kill()
@@ -9859,16 +9863,16 @@ async function runTar(archive, args, signal) {
9859
9863
  function normalizeTarMemberPath(memberPath) {
9860
9864
  return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
9861
9865
  }
9862
- function isContainedPath(path14, windows = process.platform === "win32") {
9863
- const slashed = path14.replace(/\\/g, "/");
9866
+ function isContainedPath(path15, windows = process.platform === "win32") {
9867
+ const slashed = path15.replace(/\\/g, "/");
9864
9868
  const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
9865
9869
  return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
9866
9870
  }
9867
9871
  function isSafeTarMember(memberPath, destDir) {
9868
9872
  const normalized = normalizeTarMemberPath(memberPath);
9869
9873
  if (!isContainedPath(normalized)) return false;
9870
- const root = resolve7(destDir);
9871
- return resolve7(destDir, normalized).startsWith(root + sep2);
9874
+ const root = resolve8(destDir);
9875
+ return resolve8(destDir, normalized).startsWith(root + sep2);
9872
9876
  }
9873
9877
  async function readListing(archive, args, signal) {
9874
9878
  try {
@@ -9920,7 +9924,7 @@ async function assertSafeArchive(archive, destDir, signal) {
9920
9924
  async function resolveMember(destDir, expectedName) {
9921
9925
  const entries = await readdir3(destDir);
9922
9926
  if (entries.includes(expectedName)) {
9923
- return join9(destDir, expectedName);
9927
+ return join10(destDir, expectedName);
9924
9928
  }
9925
9929
  const real = entries.filter((e) => !e.startsWith("._"));
9926
9930
  if (real.length !== 1) {
@@ -9928,7 +9932,7 @@ async function resolveMember(destDir, expectedName) {
9928
9932
  `Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
9929
9933
  );
9930
9934
  }
9931
- return join9(destDir, real[0]);
9935
+ return join10(destDir, real[0]);
9932
9936
  }
9933
9937
  async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
9934
9938
  signal?.throwIfAborted();
@@ -9981,20 +9985,20 @@ function interpolatePath(template, args) {
9981
9985
  return missing ? null : out;
9982
9986
  }
9983
9987
  function callerPath(p) {
9984
- const onCurrentDrive = path10.sep === "\\" && /^[\\/](?![\\/])/.test(p);
9985
- 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))) {
9986
9990
  return p;
9987
9991
  }
9988
- const { root } = path10.parse(p);
9992
+ const { root } = path11.parse(p);
9989
9993
  const rest = p.slice(root.length);
9990
9994
  if (!rest.split(/[\\/]/).includes("..")) {
9991
- const resolved = path10.resolve(p);
9992
- const last = p.split(path10.sep === "\\" ? /[\\/]/ : "/").at(-1);
9993
- const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path10.sep);
9994
- 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;
9995
9999
  }
9996
- const base = path10.resolve(root);
9997
- 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}`;
9998
10002
  }
9999
10003
  async function specPath(spec, args) {
10000
10004
  if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
@@ -10041,9 +10045,9 @@ function untrackArchive(archive) {
10041
10045
  process.removeListener("exit", removePendingArchives);
10042
10046
  }
10043
10047
  function sha256File(filePath, signal) {
10044
- return new Promise((resolve11, reject) => {
10048
+ return new Promise((resolve12, reject) => {
10045
10049
  const hash = createHash2("sha256");
10046
- 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);
10047
10051
  });
10048
10052
  }
10049
10053
  function toolServerError(text) {
@@ -10102,7 +10106,7 @@ async function uploadTar(tarPath, format, endpoint, signal) {
10102
10106
  }
10103
10107
  async function uploadFile(sourcePath, endpoint, signal) {
10104
10108
  const format = pickArchiveFormat(endpoint.formats);
10105
- const tarPath = path10.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
10109
+ const tarPath = path11.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
10106
10110
  trackArchive(tarPath);
10107
10111
  try {
10108
10112
  await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
@@ -10177,7 +10181,7 @@ async function prepareFileInputs(specs, args, opts) {
10177
10181
  wire.mtimeMs = st.mtimeMs;
10178
10182
  }
10179
10183
  if (opts.uploadEndpoint && st) {
10180
- 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...
10181
10185
  `);
10182
10186
  Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
10183
10187
  }
@@ -10187,7 +10191,7 @@ async function prepareFileInputs(specs, args, opts) {
10187
10191
  return out;
10188
10192
  }
10189
10193
  function isAllowedClientFilePath(p) {
10190
- if (!path10.isAbsolute(p)) return false;
10194
+ if (!path11.isAbsolute(p)) return false;
10191
10195
  const segments = p.split(/[\\/]+/);
10192
10196
  if (segments.includes("..")) return false;
10193
10197
  const file = segments[segments.length - 1] ?? "";
@@ -10198,7 +10202,7 @@ function isClientFileDirective2(value) {
10198
10202
  return !!value && typeof value === "object" && value[CLIENT_FILE_MARKER2] === true && typeof value.path === "string" && typeof value.content === "string";
10199
10203
  }
10200
10204
  async function replaceFile(target, bytes, mode) {
10201
- const temp = path10.join(path10.dirname(target), `.baseline-${randomUUID4()}.tmp`);
10205
+ const temp = path11.join(path11.dirname(target), `.baseline-${randomUUID4()}.tmp`);
10202
10206
  try {
10203
10207
  await writeFile3(temp, bytes, { flag: "wx" });
10204
10208
  if (mode !== void 0) await chmod3(temp, mode & 511);
@@ -10209,27 +10213,27 @@ async function replaceFile(target, bytes, mode) {
10209
10213
  }
10210
10214
  }
10211
10215
  async function writeBaselineFile(file, bytes, allowedDirs) {
10212
- 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))) {
10213
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(", ")})`;
10214
10218
  }
10215
10219
  if (bytes.length > MAX_CONTENT_BYTES) {
10216
10220
  return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
10217
10221
  }
10218
- const dir = path10.dirname(file);
10222
+ const dir = path11.dirname(file);
10219
10223
  await mkdir3(dir, { recursive: true });
10220
10224
  const link = await lstat(file).catch(() => null);
10221
10225
  const real = link === null ? null : await realpath2(file).catch(() => null);
10222
10226
  if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
10223
10227
  if (real !== null) {
10224
10228
  if (!real.endsWith(".png")) return `${file} links to a file that is not a PNG file`;
10225
- if (path10.dirname(real) !== await realpath2(dir)) {
10229
+ if (path11.dirname(real) !== await realpath2(dir)) {
10226
10230
  return `${file} links outside its baseline directory`;
10227
10231
  }
10228
10232
  }
10229
10233
  const existing = real === null ? null : await stat3(real);
10230
10234
  if (existing !== null && !existing.isFile()) return `${file} is not a regular file`;
10231
10235
  await replaceFile(
10232
- real ?? path10.join(await realpath2(dir), path10.basename(file)),
10236
+ real ?? path11.join(await realpath2(dir), path11.basename(file)),
10233
10237
  bytes,
10234
10238
  existing?.mode
10235
10239
  );
@@ -10255,7 +10259,7 @@ async function applyClientFileDirectives(result, opts = {}) {
10255
10259
  if (isClientFileDirective2(value)) {
10256
10260
  if (!isAllowedClientFilePath(value.path)) return null;
10257
10261
  try {
10258
- await mkdir3(path10.dirname(value.path), { recursive: true });
10262
+ await mkdir3(path11.dirname(value.path), { recursive: true });
10259
10263
  await writeFile3(value.path, value.content, "utf8");
10260
10264
  written.push(value.path);
10261
10265
  return value.path;
@@ -10284,13 +10288,13 @@ async function applyClientFileDirectives(result, opts = {}) {
10284
10288
  // ../argent-tools-client/src/flow-files.ts
10285
10289
  var import_yaml = __toESM(require_dist2(), 1);
10286
10290
  import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
10287
- import * as path11 from "node:path";
10291
+ import * as path12 from "node:path";
10288
10292
  var INLINE_MEMBERS_BYTES = 256 * 1024;
10289
10293
  function filesLogEnabled() {
10290
10294
  return (process.env.ARGENT_E2E_FILES_LOG ?? process.env.ARGENT_FLOW_FILES_LOG) === "1";
10291
10295
  }
10292
10296
  function isWithin(inner, outer) {
10293
- 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);
10294
10298
  }
10295
10299
  function printable(text) {
10296
10300
  return [...text].map(
@@ -10298,7 +10302,7 @@ function printable(text) {
10298
10302
  ).join("");
10299
10303
  }
10300
10304
  function isResolvedAbsolute2(value) {
10301
- return typeof value === "string" && path11.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
10305
+ return typeof value === "string" && path12.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
10302
10306
  }
10303
10307
  function namesValidFlow(args) {
10304
10308
  let canonical;
@@ -10310,13 +10314,13 @@ function namesValidFlow(args) {
10310
10314
  const { project_root, e2e_test_path: testPath, name } = canonical;
10311
10315
  if (!isResolvedAbsolute2(project_root)) return false;
10312
10316
  if (name === void 0) {
10313
- return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path11.basename(testPath));
10317
+ return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path12.basename(testPath));
10314
10318
  }
10315
10319
  return testPath === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
10316
10320
  }
10317
10321
  function savedFlowProject(file) {
10318
- if (!path11.isAbsolute(file)) return null;
10319
- 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)) {
10320
10324
  const project = e2eDirProject(dir);
10321
10325
  if (project !== null) return project;
10322
10326
  }
@@ -10331,11 +10335,11 @@ async function landing(spelled) {
10331
10335
  const canonical = await canonicalFlowPath(spelled);
10332
10336
  let at = spelled;
10333
10337
  for (; ; ) {
10334
- const parent = path11.dirname(at);
10338
+ const parent = path12.dirname(at);
10335
10339
  if (parent === at) return { canonical, fence: spelled, ...failure };
10336
10340
  const real = await realpath3(parent).catch(() => null);
10337
10341
  if (real !== null) {
10338
- return { canonical, fence: path11.join(real, path11.basename(at)), ...failure };
10342
+ return { canonical, fence: path12.join(real, path12.basename(at)), ...failure };
10339
10343
  }
10340
10344
  at = parent;
10341
10345
  }
@@ -10343,10 +10347,10 @@ async function landing(spelled) {
10343
10347
  }
10344
10348
  async function closureRoots(rootPath, rootCanonical, projectRoot) {
10345
10349
  const candidates = [];
10346
- if (typeof projectRoot === "string" && path11.isAbsolute(projectRoot)) {
10350
+ if (typeof projectRoot === "string" && path12.isAbsolute(projectRoot)) {
10347
10351
  candidates.push(projectRoot, ...e2eDirsFor(projectRoot));
10348
10352
  }
10349
- candidates.push(path11.dirname(rootPath), path11.dirname(rootCanonical));
10353
+ candidates.push(path12.dirname(rootPath), path12.dirname(rootCanonical));
10350
10354
  for (const file of [rootPath, rootCanonical]) {
10351
10355
  const project = savedFlowProject(file);
10352
10356
  if (project !== null) candidates.push(project);
@@ -10359,11 +10363,11 @@ async function closureRoots(rootPath, rootCanonical, projectRoot) {
10359
10363
  return real.filter((root) => !real.some((other) => other !== root && isWithin(root, other)));
10360
10364
  }
10361
10365
  async function readFlowMember(anchorDir, target, roots, budget, opts) {
10362
- const spelled = anchorDir + path11.sep + target;
10366
+ const spelled = anchorDir + path12.sep + target;
10363
10367
  const { canonical, fence, missing, error } = await landing(spelled);
10364
10368
  const spelling = await classifyOnDiskSpelling(
10365
- path11.dirname(spelled),
10366
- path11.posix.basename(target),
10369
+ path12.dirname(spelled),
10370
+ path12.posix.basename(target),
10367
10371
  FLOW_FILE_NAME_PATTERN
10368
10372
  );
10369
10373
  const member = {
@@ -10388,7 +10392,7 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
10388
10392
  return { member: { ...member, state: "missing" }, sent: "missing" };
10389
10393
  }
10390
10394
  if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
10391
- if (!/\.ya?ml$/i.test(path11.basename(canonical))) {
10395
+ if (!/\.ya?ml$/i.test(path12.basename(canonical))) {
10392
10396
  return refuse(`${target} links to a file that is not a YAML file`);
10393
10397
  }
10394
10398
  const sent = await sendBytes(member, canonical, budget, opts);
@@ -10513,12 +10517,12 @@ function memberCollector(roots, opts) {
10513
10517
  }
10514
10518
  async function savedTest(target) {
10515
10519
  for (const candidate of target.paths) {
10516
- const found = await flow(path11.dirname(candidate), path11.basename(candidate), true);
10520
+ const found = await flow(path12.dirname(candidate), path12.basename(candidate), true);
10517
10521
  if (found !== void 0) return found;
10518
10522
  }
10519
10523
  let first;
10520
10524
  for (const candidate of target.paths) {
10521
- first ??= await flow(path11.dirname(candidate), path11.basename(candidate));
10525
+ first ??= await flow(path12.dirname(candidate), path12.basename(candidate));
10522
10526
  }
10523
10527
  return first;
10524
10528
  }
@@ -10555,7 +10559,7 @@ function memberCollector(roots, opts) {
10555
10559
  const requests = collectFlowRequests(doc);
10556
10560
  for (const name of requests.snapshots) snapshots.add(name);
10557
10561
  for (const step of requests.toolSteps) await toolFiles(step);
10558
- const anchorDir = path11.dirname(file.canonical);
10562
+ const anchorDir = path12.dirname(file.canonical);
10559
10563
  for (const target of requests.runTargets) {
10560
10564
  const key = flowMemberKey(anchorDir, target);
10561
10565
  if (visited.has(key)) continue;
@@ -10577,8 +10581,8 @@ function memberCollector(roots, opts) {
10577
10581
  }
10578
10582
  }
10579
10583
  if (snapshots.size === 0) continue;
10580
- const dir = path11.join(
10581
- path11.dirname(run.canonical),
10584
+ const dir = path12.join(
10585
+ path12.dirname(run.canonical),
10582
10586
  "__baselines__",
10583
10587
  baselineKeyFor(run.canonical, run.flowName)
10584
10588
  );
@@ -10602,7 +10606,7 @@ function memberCollector(roots, opts) {
10602
10606
  if (!name.endsWith(".png")) continue;
10603
10607
  const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
10604
10608
  if (!updates && !compared) continue;
10605
- const file = path11.join(dir, name);
10609
+ const file = path12.join(dir, name);
10606
10610
  if (tools.has(file)) continue;
10607
10611
  const member = { role: "baseline", key: file, path: file };
10608
10612
  const entry = await baselineEntry(file, roots, updates && !compared);
@@ -10625,8 +10629,8 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
10625
10629
  if (!namesValidFlow(args)) return {};
10626
10630
  const canonical = await canonicalFlowPath(rootPath);
10627
10631
  const spelling = await classifyOnDiskSpelling(
10628
- path11.dirname(rootPath),
10629
- path11.basename(rootPath),
10632
+ path12.dirname(rootPath),
10633
+ path12.basename(rootPath),
10630
10634
  FLOW_FILE_NAME_PATTERN
10631
10635
  );
10632
10636
  const collector = memberCollector(
@@ -10637,7 +10641,7 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
10637
10641
  {
10638
10642
  canonical,
10639
10643
  text: rootBytes.toString("utf8"),
10640
- flowName: path11.basename(rootPath, ".yaml"),
10644
+ flowName: path12.basename(rootPath, ".yaml"),
10641
10645
  hop: 0,
10642
10646
  updates: args.updateBaselines === true,
10643
10647
  platform: callPlatform(args)
@@ -10666,31 +10670,31 @@ async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
10666
10670
  if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
10667
10671
  return [];
10668
10672
  }
10669
- const recording = path11.join(recordingDirFor(projectRoot), `${name}.yaml`);
10673
+ const recording = path12.join(recordingDirFor(projectRoot), `${name}.yaml`);
10670
10674
  const collector = memberCollector(
10671
10675
  await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
10672
10676
  opts
10673
10677
  );
10674
10678
  await collector.toolFiles(step);
10675
10679
  if (canonicalToolId(step.tool) === "e2e-execute") {
10676
- const self = await collector.flow(path11.dirname(recording), path11.basename(recording));
10680
+ const self = await collector.flow(path12.dirname(recording), path12.basename(recording));
10677
10681
  let runArgs = step.args;
10678
10682
  const named = nestedFlowTarget(runArgs);
10679
10683
  if (named?.kind === "e2e_test_path") {
10680
- const stem = path11.basename(named.path, ".yaml");
10681
- const base = path11.basename(named.path);
10682
- const dir = path11.resolve(path11.dirname(named.path));
10683
- 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);
10684
10688
  const dirs = [recordingDir, ...e2eRunFallbackDirs(recordingDir, base)];
10685
- if (dirs.some((d) => path11.resolve(d) === dir)) {
10686
- 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);
10687
10691
  runArgs = { ...runArgs, name: stem };
10688
10692
  delete runArgs.e2e_test_path;
10689
10693
  }
10690
10694
  }
10691
10695
  const target = nestedFlowTarget(runArgs);
10692
10696
  if (target?.kind === "name") {
10693
- await collector.flow(path11.dirname(self.member.canonical), `${target.name}.yaml`);
10697
+ await collector.flow(path12.dirname(self.member.canonical), `${target.name}.yaml`);
10694
10698
  const run = await collector.nestedRun(
10695
10699
  target,
10696
10700
  0,
@@ -10884,10 +10888,10 @@ function assertFiniteNumbers(args) {
10884
10888
  if (typeof item === "object" && item !== null) {
10885
10889
  pending.push({ value: item, key, parent: visit });
10886
10890
  } else if (typeof item === "number" && !Number.isFinite(item)) {
10887
- const path14 = [key];
10888
- for (let at = visit; at.parent; at = at.parent) path14.push(at.key);
10889
- path14.reverse();
10890
- 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}` });
10891
10895
  if (issues.length === MAX_NON_FINITE_ISSUES) break;
10892
10896
  }
10893
10897
  }
@@ -11072,7 +11076,7 @@ function createToolsClient(options = {}) {
11072
11076
  log: diagnose,
11073
11077
  baselineDirs,
11074
11078
  collectMembers: collectFlowMembers,
11075
- 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,
11076
11080
  toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
11077
11081
  signal: opts?.signal
11078
11082
  });
@@ -11085,7 +11089,7 @@ function createToolsClient(options = {}) {
11085
11089
  }
11086
11090
  if (filesLogEnabled()) {
11087
11091
  for (const file of applied.written) {
11088
- if (baselineDirs.includes(path12.dirname(file))) {
11092
+ if (baselineDirs.includes(path13.dirname(file))) {
11089
11093
  diagnose(`[e2e-files] baseline ${file}: written`);
11090
11094
  }
11091
11095
  }
@@ -11229,7 +11233,7 @@ import {
11229
11233
  } from "node:fs/promises";
11230
11234
  import { constants as fsConstants } from "node:fs";
11231
11235
  import { tmpdir as tmpdir2 } from "node:os";
11232
- 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";
11233
11237
  import { createHash as createHash3 } from "node:crypto";
11234
11238
  var ARTIFACT_MARKER2 = "__argentArtifact";
11235
11239
  function isArtifactHandle(value) {
@@ -11253,16 +11257,16 @@ function projectSlug() {
11253
11257
  return `${name}-${hash}`;
11254
11258
  }
11255
11259
  function artifactsRoot() {
11256
- return process.env.ARGENT_ARTIFACTS_DIR ?? join13(tmpdir2(), "argent-artifacts");
11260
+ return process.env.ARGENT_ARTIFACTS_DIR ?? join14(tmpdir2(), "argent-artifacts");
11257
11261
  }
11258
11262
  function artifactDir(deviceId) {
11259
11263
  const parts = [artifactsRoot(), projectSlug(), sessionId()];
11260
11264
  if (deviceId) parts.push(sanitizeSegment(deviceId));
11261
- return join13(...parts);
11265
+ return join14(...parts);
11262
11266
  }
11263
11267
  function durableBaseDir() {
11264
11268
  const projectRoot = findProjectRoot(process.cwd());
11265
- return projectRoot ?? dirname9(argentHomeDir());
11269
+ return projectRoot ?? resolveHomeDir();
11266
11270
  }
11267
11271
  var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
11268
11272
  var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
@@ -11276,9 +11280,9 @@ function configuredRecordingsDir() {
11276
11280
  if (typeof value !== "string") return null;
11277
11281
  const trimmed = value.trim();
11278
11282
  if (trimmed === "") return null;
11279
- const home = dirname9(argentHomeDir());
11280
- const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep5}`) ? join13(home, trimmed.slice(2)) : trimmed;
11281
- 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);
11282
11286
  }
11283
11287
  var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
11284
11288
  async function readCapped(res, cap) {
@@ -11311,10 +11315,10 @@ async function writeDurableUnique(dir, filename, write) {
11311
11315
  const stem = filename.slice(0, filename.length - ext.length);
11312
11316
  for (let i = 1; i <= 1e3; i++) {
11313
11317
  const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
11314
- const path14 = join13(dir, candidate);
11318
+ const path15 = join14(dir, candidate);
11315
11319
  try {
11316
- await write(path14);
11317
- return path14;
11320
+ await write(path15);
11321
+ return path15;
11318
11322
  } catch (err) {
11319
11323
  if (err?.code === "EEXIST") continue;
11320
11324
  throw err;
@@ -11334,21 +11338,21 @@ function durableSaveTarget(handle) {
11334
11338
  if (configured) {
11335
11339
  return {
11336
11340
  dir: configured,
11337
- path: join13(configured, sanitizeSegment(handle.filename)),
11341
+ path: join14(configured, sanitizeSegment(handle.filename)),
11338
11342
  base: configured,
11339
11343
  rel: ""
11340
11344
  };
11341
11345
  }
11342
11346
  }
11343
11347
  const base = durableBaseDir();
11344
- const dir = join13(base, rel);
11345
- 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 };
11346
11350
  }
11347
11351
  async function confineToRealBase(dir, base, rel) {
11348
11352
  try {
11349
11353
  const realDir = await realpath4(dir);
11350
11354
  const realBase = await realpath4(base);
11351
- return realDir === join13(realBase, rel);
11355
+ return realDir === join14(realBase, rel);
11352
11356
  } catch {
11353
11357
  return false;
11354
11358
  }
@@ -11372,9 +11376,9 @@ async function resolveLocalFile(handle) {
11372
11376
  }
11373
11377
  async function downloadAndExtractArchive(handle, data, dir, signal) {
11374
11378
  signal?.throwIfAborted();
11375
- const attemptDir = await mkdtemp(join13(dir, "bundle-"));
11376
- const tarball = join13(attemptDir, "download.tar");
11377
- 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");
11378
11382
  try {
11379
11383
  await writeFile4(tarball, data, { signal });
11380
11384
  await mkdir4(extractDir);
@@ -11474,7 +11478,7 @@ async function materializeArtifacts(result, ctx) {
11474
11478
  return await downloadAndExtractArchive(value, data, dir, ctx.signal);
11475
11479
  }
11476
11480
  if (value.size > 0 && data.length !== value.size) return null;
11477
- const downloadedPath = join13(dir, sanitizeSegment(value.filename));
11481
+ const downloadedPath = join14(dir, sanitizeSegment(value.filename));
11478
11482
  await writeFile4(downloadedPath, data);
11479
11483
  if (value.mimeType.startsWith("image/")) {
11480
11484
  images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
@@ -11509,11 +11513,11 @@ function getDeviceIdFromArgs(args) {
11509
11513
 
11510
11514
  // src/bundled-paths.ts
11511
11515
  import * as fs8 from "node:fs";
11512
- import * as path13 from "node:path";
11516
+ import * as path14 from "node:path";
11513
11517
  function readPackageVersion() {
11514
11518
  try {
11515
11519
  const pkg = JSON.parse(
11516
- fs8.readFileSync(path13.join(import.meta.dirname, "..", "package.json"), "utf8")
11520
+ fs8.readFileSync(path14.join(import.meta.dirname, "..", "package.json"), "utf8")
11517
11521
  );
11518
11522
  return pkg.version;
11519
11523
  } catch {
@@ -11524,15 +11528,15 @@ var PACKAGE_NAME = "@swmansion/argent";
11524
11528
  function findDeclaringRoot(startDir) {
11525
11529
  let dir = startDir;
11526
11530
  for (; ; ) {
11527
- if (fs8.existsSync(path13.join(dir, ".argent", "install.json"))) return dir;
11531
+ if (fs8.existsSync(path14.join(dir, ".argent", "install.json"))) return dir;
11528
11532
  try {
11529
- 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"));
11530
11534
  if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
11531
11535
  return dir;
11532
11536
  }
11533
11537
  } catch {
11534
11538
  }
11535
- const parent = path13.dirname(dir);
11539
+ const parent = path14.dirname(dir);
11536
11540
  if (parent === dir) return null;
11537
11541
  dir = parent;
11538
11542
  }
@@ -11540,12 +11544,12 @@ function findDeclaringRoot(startDir) {
11540
11544
  function findStablePackageDir(startDir, packageRoot) {
11541
11545
  let dir = startDir;
11542
11546
  for (; ; ) {
11543
- const candidate = path13.join(dir, "node_modules", PACKAGE_NAME);
11547
+ const candidate = path14.join(dir, "node_modules", PACKAGE_NAME);
11544
11548
  try {
11545
11549
  if (fs8.realpathSync(candidate) === packageRoot) return candidate;
11546
11550
  } catch {
11547
11551
  }
11548
- const parent = path13.dirname(dir);
11552
+ const parent = path14.dirname(dir);
11549
11553
  if (parent === dir) return void 0;
11550
11554
  dir = parent;
11551
11555
  }
@@ -11555,7 +11559,7 @@ function classifyInstall() {
11555
11559
  let dir;
11556
11560
  let cwd;
11557
11561
  try {
11558
- packageRoot = fs8.realpathSync(path13.join(import.meta.dirname, ".."));
11562
+ packageRoot = fs8.realpathSync(path14.join(import.meta.dirname, ".."));
11559
11563
  cwd = process.cwd();
11560
11564
  dir = cwd;
11561
11565
  } catch {
@@ -11563,8 +11567,8 @@ function classifyInstall() {
11563
11567
  }
11564
11568
  for (; ; ) {
11565
11569
  try {
11566
- const nmReal = fs8.realpathSync(path13.join(dir, "node_modules"));
11567
- 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)) {
11568
11572
  return {
11569
11573
  kind: "local",
11570
11574
  projectRoot: findDeclaringRoot(cwd) ?? dir,
@@ -11573,22 +11577,22 @@ function classifyInstall() {
11573
11577
  }
11574
11578
  } catch {
11575
11579
  }
11576
- const parent = path13.dirname(dir);
11580
+ const parent = path14.dirname(dir);
11577
11581
  if (parent === dir) break;
11578
11582
  dir = parent;
11579
11583
  }
11580
- if (packageRoot.includes(`${path13.sep}.yarn${path13.sep}`)) {
11584
+ if (packageRoot.includes(`${path14.sep}.yarn${path14.sep}`)) {
11581
11585
  const declRoot = findDeclaringRoot(cwd);
11582
11586
  if (declRoot) return { kind: "local", projectRoot: declRoot };
11583
11587
  }
11584
11588
  return { kind: "global" };
11585
11589
  }
11586
11590
  var classifiedInstall = classifyInstall();
11587
- var packageDir = classifiedInstall.stablePackageDir ?? path13.join(import.meta.dirname, "..");
11591
+ var packageDir = classifiedInstall.stablePackageDir ?? path14.join(import.meta.dirname, "..");
11588
11592
  var BUNDLED_RUNTIME_PATHS = {
11589
- bundlePath: path13.join(packageDir, "dist", "tool-server.cjs"),
11590
- simulatorServerDir: path13.join(packageDir, "bin"),
11591
- 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"),
11592
11596
  version: readPackageVersion(),
11593
11597
  installKind: classifiedInstall.kind,
11594
11598
  installProjectRoot: classifiedInstall.projectRoot