@swmansion/argent 0.35.1-next.66 → 0.35.1-next.68

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, path15) {
508
- const ctrl = callVisitor(key, node, visitor, path15);
507
+ function visit_(key, node, visitor, path16) {
508
+ const ctrl = callVisitor(key, node, visitor, path16);
509
509
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
510
- replaceNode(key, path15, ctrl);
511
- return visit_(key, ctrl, visitor, path15);
510
+ replaceNode(key, path16, ctrl);
511
+ return visit_(key, ctrl, visitor, path16);
512
512
  }
513
513
  if (typeof ctrl !== "symbol") {
514
514
  if (identity.isCollection(node)) {
515
- path15 = Object.freeze(path15.concat(node));
515
+ path16 = Object.freeze(path16.concat(node));
516
516
  for (let i = 0; i < node.items.length; ++i) {
517
- const ci = visit_(i, node.items[i], visitor, path15);
517
+ const ci = visit_(i, node.items[i], visitor, path16);
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
- path15 = Object.freeze(path15.concat(node));
529
- const ck = visit_("key", node.key, visitor, path15);
528
+ path16 = Object.freeze(path16.concat(node));
529
+ const ck = visit_("key", node.key, visitor, path16);
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, path15);
534
+ const cv = visit_("value", node.value, visitor, path16);
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, path15) {
556
- const ctrl = await callVisitor(key, node, visitor, path15);
555
+ async function visitAsync_(key, node, visitor, path16) {
556
+ const ctrl = await callVisitor(key, node, visitor, path16);
557
557
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
558
- replaceNode(key, path15, ctrl);
559
- return visitAsync_(key, ctrl, visitor, path15);
558
+ replaceNode(key, path16, ctrl);
559
+ return visitAsync_(key, ctrl, visitor, path16);
560
560
  }
561
561
  if (typeof ctrl !== "symbol") {
562
562
  if (identity.isCollection(node)) {
563
- path15 = Object.freeze(path15.concat(node));
563
+ path16 = Object.freeze(path16.concat(node));
564
564
  for (let i = 0; i < node.items.length; ++i) {
565
- const ci = await visitAsync_(i, node.items[i], visitor, path15);
565
+ const ci = await visitAsync_(i, node.items[i], visitor, path16);
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
- path15 = Object.freeze(path15.concat(node));
577
- const ck = await visitAsync_("key", node.key, visitor, path15);
576
+ path16 = Object.freeze(path16.concat(node));
577
+ const ck = await visitAsync_("key", node.key, visitor, path16);
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, path15);
582
+ const cv = await visitAsync_("value", node.value, visitor, path16);
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, path15) {
609
+ function callVisitor(key, node, visitor, path16) {
610
610
  if (typeof visitor === "function")
611
- return visitor(key, node, path15);
611
+ return visitor(key, node, path16);
612
612
  if (identity.isMap(node))
613
- return visitor.Map?.(key, node, path15);
613
+ return visitor.Map?.(key, node, path16);
614
614
  if (identity.isSeq(node))
615
- return visitor.Seq?.(key, node, path15);
615
+ return visitor.Seq?.(key, node, path16);
616
616
  if (identity.isPair(node))
617
- return visitor.Pair?.(key, node, path15);
617
+ return visitor.Pair?.(key, node, path16);
618
618
  if (identity.isScalar(node))
619
- return visitor.Scalar?.(key, node, path15);
619
+ return visitor.Scalar?.(key, node, path16);
620
620
  if (identity.isAlias(node))
621
- return visitor.Alias?.(key, node, path15);
621
+ return visitor.Alias?.(key, node, path16);
622
622
  return void 0;
623
623
  }
624
- function replaceNode(key, path15, node) {
625
- const parent = path15[path15.length - 1];
624
+ function replaceNode(key, path16, node) {
625
+ const parent = path16[path16.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, path15, value) {
1237
+ function collectionFromPath(schema, path16, value) {
1238
1238
  let v = value;
1239
- for (let i = path15.length - 1; i >= 0; --i) {
1240
- const k = path15[i];
1239
+ for (let i = path16.length - 1; i >= 0; --i) {
1240
+ const k = path16[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 = (path15) => path15 == null || typeof path15 === "object" && !!path15[Symbol.iterator]().next().done;
1259
+ var isEmptyPath = (path16) => path16 == null || typeof path16 === "object" && !!path16[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(path15, value) {
1290
- if (isEmptyPath(path15))
1289
+ addIn(path16, value) {
1290
+ if (isEmptyPath(path16))
1291
1291
  this.add(value);
1292
1292
  else {
1293
- const [key, ...rest] = path15;
1293
+ const [key, ...rest] = path16;
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(path15) {
1308
- const [key, ...rest] = path15;
1307
+ deleteIn(path16) {
1308
+ const [key, ...rest] = path16;
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(path15, keepScalar) {
1323
- const [key, ...rest] = path15;
1322
+ getIn(path16, keepScalar) {
1323
+ const [key, ...rest] = path16;
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(path15) {
1342
- const [key, ...rest] = path15;
1341
+ hasIn(path16) {
1342
+ const [key, ...rest] = path16;
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(path15, value) {
1353
- const [key, ...rest] = path15;
1352
+ setIn(path16, value) {
1353
+ const [key, ...rest] = path16;
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(path15, value) {
3868
+ addIn(path16, value) {
3869
3869
  if (assertCollection(this.contents))
3870
- this.contents.addIn(path15, value);
3870
+ this.contents.addIn(path16, 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(path15) {
3946
- if (Collection.isEmptyPath(path15)) {
3945
+ deleteIn(path16) {
3946
+ if (Collection.isEmptyPath(path16)) {
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(path15) : false;
3952
+ return assertCollection(this.contents) ? this.contents.deleteIn(path16) : 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(path15, keepScalar) {
3968
- if (Collection.isEmptyPath(path15))
3967
+ getIn(path16, keepScalar) {
3968
+ if (Collection.isEmptyPath(path16))
3969
3969
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3970
- return identity.isCollection(this.contents) ? this.contents.getIn(path15, keepScalar) : void 0;
3970
+ return identity.isCollection(this.contents) ? this.contents.getIn(path16, 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(path15) {
3982
- if (Collection.isEmptyPath(path15))
3981
+ hasIn(path16) {
3982
+ if (Collection.isEmptyPath(path16))
3983
3983
  return this.contents !== void 0;
3984
- return identity.isCollection(this.contents) ? this.contents.hasIn(path15) : false;
3984
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path16) : 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(path15, value) {
4002
- if (Collection.isEmptyPath(path15)) {
4001
+ setIn(path16, value) {
4002
+ if (Collection.isEmptyPath(path16)) {
4003
4003
  this.contents = value;
4004
4004
  } else if (this.contents == null) {
4005
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path15), value);
4005
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path16), value);
4006
4006
  } else if (assertCollection(this.contents)) {
4007
- this.contents.setIn(path15, value);
4007
+ this.contents.setIn(path16, 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, path15) => {
5968
+ visit.itemAtPath = (cst, path16) => {
5969
5969
  let item = cst;
5970
- for (const [field, index] of path15) {
5970
+ for (const [field, index] of path16) {
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, path15) => {
5980
- const parent = visit.itemAtPath(cst, path15.slice(0, -1));
5981
- const field = path15[path15.length - 1][0];
5979
+ visit.parentCollection = (cst, path16) => {
5980
+ const parent = visit.itemAtPath(cst, path16.slice(0, -1));
5981
+ const field = path16[path16.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(path15, item, visitor) {
5988
- let ctrl = visitor(item, path15);
5987
+ function _visit(path16, item, visitor) {
5988
+ let ctrl = visitor(item, path16);
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(path15.concat([[field, i]])), token.items[i], visitor);
5995
+ const ci = _visit(Object.freeze(path16.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, path15);
6006
+ ctrl = ctrl(item, path16);
6007
6007
  }
6008
6008
  }
6009
- return typeof ctrl === "function" ? ctrl(item, path15) : ctrl;
6009
+ return typeof ctrl === "function" ? ctrl(item, path16) : ctrl;
6010
6010
  }
6011
6011
  exports.visit = visit;
6012
6012
  }
@@ -7308,14 +7308,14 @@ var require_parser = __commonJS({
7308
7308
  case "scalar":
7309
7309
  case "single-quoted-scalar":
7310
7310
  case "double-quoted-scalar": {
7311
- const fs10 = this.flowScalar(this.type);
7311
+ const fs11 = this.flowScalar(this.type);
7312
7312
  if (atNextItem || it.value) {
7313
- map.items.push({ start, key: fs10, sep: [] });
7313
+ map.items.push({ start, key: fs11, sep: [] });
7314
7314
  this.onKeyLine = true;
7315
7315
  } else if (it.sep) {
7316
- this.stack.push(fs10);
7316
+ this.stack.push(fs11);
7317
7317
  } else {
7318
- Object.assign(it, { key: fs10, sep: [] });
7318
+ Object.assign(it, { key: fs11, sep: [] });
7319
7319
  this.onKeyLine = true;
7320
7320
  }
7321
7321
  return;
@@ -7443,13 +7443,13 @@ var require_parser = __commonJS({
7443
7443
  case "scalar":
7444
7444
  case "single-quoted-scalar":
7445
7445
  case "double-quoted-scalar": {
7446
- const fs10 = this.flowScalar(this.type);
7446
+ const fs11 = this.flowScalar(this.type);
7447
7447
  if (!it || it.value)
7448
- fc.items.push({ start: [], key: fs10, sep: [] });
7448
+ fc.items.push({ start: [], key: fs11, sep: [] });
7449
7449
  else if (it.sep)
7450
- this.stack.push(fs10);
7450
+ this.stack.push(fs11);
7451
7451
  else
7452
- Object.assign(it, { key: fs10, sep: [] });
7452
+ Object.assign(it, { key: fs11, sep: [] });
7453
7453
  return;
7454
7454
  }
7455
7455
  case "flow-map-end":
@@ -8328,22 +8328,149 @@ var UnknownConfigKeyError = class extends Error {
8328
8328
  key;
8329
8329
  };
8330
8330
 
8331
- // ../argent-tools-client/src/launcher.ts
8332
- import * as net from "node:net";
8333
- import * as os2 from "node:os";
8331
+ // ../configuration-core/src/cloud-android.ts
8334
8332
  import * as fs6 from "node:fs";
8333
+ import * as os2 from "node:os";
8335
8334
  import * as path7 from "node:path";
8335
+ var CLOUD_URL_ENV = "ARGENT_CLOUD_URL";
8336
+ var CLOUD_API_KEY_ENV = "ARGENT_CLOUD_API_KEY";
8337
+ function isLoopbackHost(hostname) {
8338
+ return hostname === "localhost" || hostname === "[::1]" || /^127(\.\d{1,3}){3}$/.test(hostname);
8339
+ }
8340
+ function parseCloudAndroidCredential(env) {
8341
+ const rawUrl = env[CLOUD_URL_ENV]?.trim();
8342
+ const apiKey = env[CLOUD_API_KEY_ENV]?.trim();
8343
+ if (!rawUrl || !apiKey) return null;
8344
+ let url;
8345
+ try {
8346
+ url = new URL(rawUrl);
8347
+ } catch {
8348
+ return null;
8349
+ }
8350
+ if (url.username || url.password || url.search || url.hash) return null;
8351
+ if (url.protocol !== "https:" && !(url.protocol === "http:" && isLoopbackHost(url.hostname))) {
8352
+ return null;
8353
+ }
8354
+ return { baseUrl: `${url.origin}${url.pathname.replace(/\/+$/, "")}`, apiKey };
8355
+ }
8356
+ function cloudAndroidMarkersDir() {
8357
+ if (markersDirOverride) return markersDirOverride;
8358
+ let home;
8359
+ try {
8360
+ home = os2.userInfo().homedir;
8361
+ } catch {
8362
+ home = "";
8363
+ }
8364
+ return path7.join(home || os2.homedir(), ".argent", "cloud-android-leases");
8365
+ }
8366
+ var markersDirOverride = null;
8367
+ function primaryGid() {
8368
+ try {
8369
+ return os2.userInfo().gid;
8370
+ } catch {
8371
+ return process.getgid?.();
8372
+ }
8373
+ }
8374
+ function untrusted(dir) {
8375
+ const uid = process.getuid?.();
8376
+ if (uid === void 0) return null;
8377
+ const otherCanWrite = (stat7) => {
8378
+ const ownPrivateGroup = process.platform === "linux" && stat7.gid === primaryGid();
8379
+ return (stat7.mode & 2) !== 0 || (stat7.mode & 16) !== 0 && !ownPrivateGroup;
8380
+ };
8381
+ let stat6;
8382
+ let parent;
8383
+ try {
8384
+ stat6 = fs6.lstatSync(dir);
8385
+ parent = fs6.statSync(path7.dirname(dir));
8386
+ } catch {
8387
+ return "it cannot be read";
8388
+ }
8389
+ if (!stat6.isDirectory()) return "it is not a directory";
8390
+ if (stat6.uid !== uid) return "another account owns it";
8391
+ if ((stat6.mode & 63) !== 0) return "other accounts can read or write it";
8392
+ if (parent.uid !== uid && parent.uid !== 0 || otherCanWrite(parent)) {
8393
+ return "other accounts can write its parent directory";
8394
+ }
8395
+ return null;
8396
+ }
8397
+ function trustedCloudAndroidMarkersDir() {
8398
+ const dir = cloudAndroidMarkersDir();
8399
+ return untrusted(dir) ? null : dir;
8400
+ }
8401
+ var CLOUD_ANDROID_MARKER_TTL_MS = 2 * 6e4;
8402
+ function readCloudAndroidMarker(file) {
8403
+ try {
8404
+ const raw = JSON.parse(fs6.readFileSync(file, "utf8"));
8405
+ if (typeof raw.pid !== "number" || typeof raw.lease !== "string") return null;
8406
+ if (typeof raw.serial !== "string") return null;
8407
+ return {
8408
+ serial: raw.serial,
8409
+ pid: raw.pid,
8410
+ lease: raw.lease,
8411
+ refreshedAt: fs6.statSync(file).mtimeMs
8412
+ };
8413
+ } catch {
8414
+ return null;
8415
+ }
8416
+ }
8417
+ function readCloudAndroidMarkers(dir = trustedCloudAndroidMarkersDir()) {
8418
+ if (!dir) return [];
8419
+ let names;
8420
+ try {
8421
+ names = fs6.readdirSync(dir);
8422
+ } catch {
8423
+ return [];
8424
+ }
8425
+ return names.filter((name) => name.endsWith(".json")).map((name) => readCloudAndroidMarker(path7.join(dir, name))).filter((marker) => marker !== null);
8426
+ }
8427
+ function pidAlive(pid) {
8428
+ try {
8429
+ process.kill(pid, 0);
8430
+ return true;
8431
+ } catch (err) {
8432
+ return err.code === "EPERM";
8433
+ }
8434
+ }
8435
+ function isLiveCloudAndroidMarker(marker, now = Date.now()) {
8436
+ return now - marker.refreshedAt < CLOUD_ANDROID_MARKER_TTL_MS && pidAlive(marker.pid);
8437
+ }
8438
+ function cloudAndroidLeaseHolders(dir = trustedCloudAndroidMarkersDir()) {
8439
+ const now = Date.now();
8440
+ return new Set(
8441
+ readCloudAndroidMarkers(dir).filter((marker) => isLiveCloudAndroidMarker(marker, now)).map((marker) => marker.pid)
8442
+ );
8443
+ }
8444
+
8445
+ // ../argent-tools-client/src/launcher.ts
8446
+ import * as net from "node:net";
8447
+ import * as os3 from "node:os";
8448
+ import * as fs7 from "node:fs";
8449
+ import * as path8 from "node:path";
8336
8450
  import * as readline from "node:readline";
8337
8451
  import { spawn, execFileSync } from "node:child_process";
8338
8452
  import { createHash, randomBytes } from "node:crypto";
8339
8453
  import { readFile, readdir, unlink } from "node:fs/promises";
8340
8454
  var STATE_DIR = argentHomeDir();
8341
- var STATE_FILE = path7.join(STATE_DIR, "tool-server.json");
8342
- var LOG_FILE = path7.join(STATE_DIR, "tool-server.log");
8343
- var LOCK_FILE = path7.join(STATE_DIR, "tool-server.lock");
8455
+ var STATE_FILE = path8.join(STATE_DIR, "tool-server.json");
8456
+ var LOG_FILE = path8.join(STATE_DIR, "tool-server.log");
8457
+ var LOCK_FILE = path8.join(STATE_DIR, "tool-server.lock");
8344
8458
  var AUTH_TOKEN_BYTES = 32;
8345
8459
  var AUTH_TOKEN_ENV = "ARGENT_AUTH_TOKEN";
8346
8460
  var AUTOSPAWN_IDLE_TIMEOUT_MINUTES = 30;
8461
+ var CLOUD_URL_ENV2 = "ARGENT_CLOUD_URL";
8462
+ var CLOUD_API_KEY_ENV2 = "ARGENT_CLOUD_API_KEY";
8463
+ function cloudCredential(env = process.env) {
8464
+ const parsed = parseCloudAndroidCredential(env);
8465
+ return parsed ? { url: parsed.baseUrl, apiKey: parsed.apiKey } : null;
8466
+ }
8467
+ function linkedCloudCredentialNotice(env = process.env) {
8468
+ if (!cloudCredential(env)) return null;
8469
+ return "[argent] ARGENT_CLOUD_URL and ARGENT_CLOUD_API_KEY are not used over a linked tool-server (ARGENT_TOOLS_URL or `argent link`): it never receives them. Unlink to use them on this machine.";
8470
+ }
8471
+ function cloudProfileId(credential) {
8472
+ return createHash("sha256").update(`argent-cloud-android\0${credential.url}\0${credential.apiKey}`).digest("hex").slice(0, 12);
8473
+ }
8347
8474
  var AUTOSPAWN_HOST = "127.0.0.1";
8348
8475
  function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8349
8476
  const env = {
@@ -8352,6 +8479,12 @@ function buildToolsServerEnv(paths, port, baseEnv = process.env, options = {}) {
8352
8479
  ARGENT_SIMULATOR_SERVER_DIR: paths.simulatorServerDir,
8353
8480
  ARGENT_NATIVE_DEVTOOLS_DIR: paths.nativeDevtoolsDir
8354
8481
  };
8482
+ delete env[CLOUD_API_KEY_ENV2];
8483
+ delete env[CLOUD_URL_ENV2];
8484
+ if (options.cloud) {
8485
+ env[CLOUD_URL_ENV2] = options.cloud.url;
8486
+ env[CLOUD_API_KEY_ENV2] = options.cloud.apiKey;
8487
+ }
8355
8488
  if (options.host !== void 0) env.ARGENT_HOST = options.host;
8356
8489
  if (options.idleTimeoutMinutes !== void 0) {
8357
8490
  env.ARGENT_IDLE_TIMEOUT_MINUTES = String(options.idleTimeoutMinutes);
@@ -8419,7 +8552,7 @@ function isVersionNewer(a, b) {
8419
8552
  function readBundlePackageVersion(bundlePath) {
8420
8553
  try {
8421
8554
  const pkg = JSON.parse(
8422
- fs6.readFileSync(path7.join(path7.dirname(bundlePath), "..", "package.json"), "utf8")
8555
+ fs7.readFileSync(path8.join(path8.dirname(bundlePath), "..", "package.json"), "utf8")
8423
8556
  );
8424
8557
  return typeof pkg.version === "string" ? pkg.version : void 0;
8425
8558
  } catch {
@@ -8476,7 +8609,7 @@ function killSpawnedChild(child, pid) {
8476
8609
  }
8477
8610
  function resolveToolsServerNode() {
8478
8611
  const { bun, deno, electron } = process.versions;
8479
- return !(bun || deno || electron) && fs6.existsSync(process.execPath) ? process.execPath : "node";
8612
+ return !(bun || deno || electron) && fs7.existsSync(process.execPath) ? process.execPath : "node";
8480
8613
  }
8481
8614
  function parseListeningPort(line) {
8482
8615
  const match = line.match(/Tools server listening on http:\/\/.+:(\d+)/);
@@ -8486,10 +8619,10 @@ function spawnToolsServer(paths, port, options = {}) {
8486
8619
  return new Promise((resolve12, reject) => {
8487
8620
  let logFd;
8488
8621
  try {
8489
- fs6.mkdirSync(STATE_DIR, { recursive: true });
8490
- logFd = fs6.openSync(LOG_FILE, "a");
8622
+ fs7.mkdirSync(STATE_DIR, { recursive: true });
8623
+ logFd = fs7.openSync(LOG_FILE, "a");
8491
8624
  } catch {
8492
- logFd = fs6.openSync("/dev/null", "w");
8625
+ logFd = fs7.openSync("/dev/null", "w");
8493
8626
  }
8494
8627
  const nodeBin = resolveToolsServerNode();
8495
8628
  const child = spawn(nodeBin, [paths.bundlePath, "start"], {
@@ -8497,7 +8630,7 @@ function spawnToolsServer(paths, port, options = {}) {
8497
8630
  stdio: ["ignore", "pipe", logFd],
8498
8631
  env: buildToolsServerEnv(paths, port, process.env, options)
8499
8632
  });
8500
- fs6.closeSync(logFd);
8633
+ fs7.closeSync(logFd);
8501
8634
  const pid = child.pid;
8502
8635
  if (!pid) {
8503
8636
  child.once(
@@ -8546,9 +8679,10 @@ function spawnToolsServer(paths, port, options = {}) {
8546
8679
  rl.on("close", () => clearTimeout(timer));
8547
8680
  });
8548
8681
  }
8549
- function stateFileForBundle(bundlePath) {
8682
+ function stateFileForBundle(bundlePath, cloudProfile) {
8550
8683
  const key = createHash("sha256").update(bundlePath).digest("hex").slice(0, 12);
8551
- return path7.join(STATE_DIR, `tool-server-${key}.json`);
8684
+ const profile = cloudProfile ? `-cloud-${cloudProfile}` : "";
8685
+ return path8.join(STATE_DIR, `tool-server-${key}${profile}.json`);
8552
8686
  }
8553
8687
  async function readStateFile(file) {
8554
8688
  try {
@@ -8558,16 +8692,20 @@ async function readStateFile(file) {
8558
8692
  return null;
8559
8693
  }
8560
8694
  }
8561
- async function readToolsServerState(bundlePath) {
8695
+ async function readToolsServerState(bundlePath, cloudProfile) {
8562
8696
  if (bundlePath === void 0) return readStateFile(STATE_FILE);
8697
+ if (cloudProfile) {
8698
+ const own2 = await readStateFile(stateFileForBundle(bundlePath, cloudProfile));
8699
+ return own2?.cloudProfile === cloudProfile ? own2 : null;
8700
+ }
8563
8701
  const own = await readStateFile(stateFileForBundle(bundlePath));
8564
8702
  if (own) return own;
8565
8703
  const legacy = await readStateFile(STATE_FILE);
8566
8704
  return legacy && legacy.bundlePath === bundlePath ? legacy : null;
8567
8705
  }
8568
- function primaryGid() {
8706
+ function primaryGid2() {
8569
8707
  try {
8570
- return os2.userInfo().gid;
8708
+ return os3.userInfo().gid;
8571
8709
  } catch {
8572
8710
  return process.getgid?.();
8573
8711
  }
@@ -8577,19 +8715,19 @@ var UnsafeArgentHomeError = class extends Error {
8577
8715
  };
8578
8716
  function statHome() {
8579
8717
  try {
8580
- fs6.mkdirSync(path7.dirname(STATE_DIR), { recursive: true });
8581
- fs6.mkdirSync(STATE_DIR, { mode: 448 });
8718
+ fs7.mkdirSync(path8.dirname(STATE_DIR), { recursive: true });
8719
+ fs7.mkdirSync(STATE_DIR, { mode: 448 });
8582
8720
  } catch {
8583
8721
  }
8584
8722
  try {
8585
- return fs6.statSync(STATE_DIR);
8723
+ return fs7.statSync(STATE_DIR);
8586
8724
  } catch {
8587
8725
  return null;
8588
8726
  }
8589
8727
  }
8590
8728
  function isWritable(dir) {
8591
8729
  try {
8592
- fs6.accessSync(dir, fs6.constants.W_OK);
8730
+ fs7.accessSync(dir, fs7.constants.W_OK);
8593
8731
  return true;
8594
8732
  } catch {
8595
8733
  return false;
@@ -8605,7 +8743,7 @@ function assertPrivateArgentHome() {
8605
8743
  `The Argent home ${STATE_DIR} belongs to another user. Change its owner or set ARGENT_HOME_DIR to a directory you own.`
8606
8744
  );
8607
8745
  }
8608
- const ownPrivateGroup = process.platform === "linux" && stat6.gid === primaryGid();
8746
+ const ownPrivateGroup = process.platform === "linux" && stat6.gid === primaryGid2();
8609
8747
  const groupCanWrite = (stat6.mode & 16) !== 0 && !ownPrivateGroup;
8610
8748
  if ((stat6.mode & 2) !== 0 || groupCanWrite) {
8611
8749
  throw new UnsafeArgentHomeError(
@@ -8617,20 +8755,22 @@ async function writeToolsServerState(state) {
8617
8755
  writeToolsServerStateSync(state);
8618
8756
  }
8619
8757
  function writeToolsServerStateSync(state) {
8620
- const target = stateFileForBundle(state.bundlePath);
8621
- fs6.mkdirSync(STATE_DIR, { recursive: true });
8758
+ const target = stateFileForBundle(state.bundlePath, state.cloudProfile);
8759
+ fs7.mkdirSync(STATE_DIR, { recursive: true });
8622
8760
  const tmp = `${target}.${randomBytes(8).toString("hex")}.tmp`;
8623
8761
  try {
8624
- fs6.writeFileSync(tmp, JSON.stringify(state, null, 2) + "\n", { flag: "wx", mode: 384 });
8625
- fs6.renameSync(tmp, target);
8762
+ fs7.writeFileSync(tmp, JSON.stringify(state, null, 2) + "\n", { flag: "wx", mode: 384 });
8763
+ fs7.renameSync(tmp, target);
8626
8764
  } catch (err) {
8627
- fs6.rmSync(tmp, { force: true });
8765
+ fs7.rmSync(tmp, { force: true });
8628
8766
  throw err;
8629
8767
  }
8630
8768
  }
8631
- async function clearToolsServerState(bundlePath) {
8769
+ async function clearToolsServerState(bundlePath, cloudProfile) {
8632
8770
  const files = [STATE_FILE];
8633
- if (bundlePath !== void 0) {
8771
+ if (bundlePath !== void 0 && cloudProfile) {
8772
+ files[0] = stateFileForBundle(bundlePath, cloudProfile);
8773
+ } else if (bundlePath !== void 0) {
8634
8774
  files[0] = stateFileForBundle(bundlePath);
8635
8775
  const legacy = await readStateFile(STATE_FILE);
8636
8776
  if (legacy && legacy.bundlePath === bundlePath) files.push(STATE_FILE);
@@ -8642,7 +8782,7 @@ async function clearToolsServerState(bundlePath) {
8642
8782
  }
8643
8783
  }
8644
8784
  }
8645
- var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12})?\.json$/;
8785
+ var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12}(-cloud-[0-9a-f]{12})?)?\.json$/;
8646
8786
  async function readAllToolsServerStates() {
8647
8787
  let names;
8648
8788
  try {
@@ -8653,7 +8793,7 @@ async function readAllToolsServerStates() {
8653
8793
  const out = [];
8654
8794
  for (const name of names) {
8655
8795
  if (!STATE_FILE_RE.test(name)) continue;
8656
- const file = path7.join(STATE_DIR, name);
8796
+ const file = path8.join(STATE_DIR, name);
8657
8797
  const state = await readStateFile(file);
8658
8798
  if (state) out.push({ file, state });
8659
8799
  }
@@ -8669,7 +8809,7 @@ async function sweepDeadStateFiles() {
8669
8809
  });
8670
8810
  continue;
8671
8811
  }
8672
- if (fs6.existsSync(fresh.bundlePath)) continue;
8812
+ if (fs7.existsSync(fresh.bundlePath)) continue;
8673
8813
  if (!couldBeOurToolServer(fresh.pid, fresh.bundlePath)) continue;
8674
8814
  await unlink(file).catch(() => {
8675
8815
  });
@@ -8706,17 +8846,21 @@ async function terminatePid(pid, stillOurs) {
8706
8846
  }
8707
8847
  await waitForExit(pid, SIGKILL_GRACE_MS);
8708
8848
  }
8709
- async function killToolServer(bundlePath) {
8710
- const state = await readState(bundlePath);
8849
+ async function killToolServer(bundlePath, cloudProfile) {
8850
+ const state = await readState(bundlePath, cloudProfile);
8711
8851
  if (!state) return false;
8712
8852
  const stillOurs = () => couldBeOurToolServer(state.pid, state.bundlePath);
8713
8853
  const alive = isProcessAlive(state.pid);
8714
8854
  if (alive && !stillOurs()) return false;
8715
8855
  if (alive) await terminatePid(state.pid, stillOurs);
8716
- await clearToolsServerState(bundlePath ?? state.bundlePath);
8856
+ await clearToolsServerState(bundlePath ?? state.bundlePath, cloudProfile);
8717
8857
  return alive;
8718
8858
  }
8719
- var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs6.existsSync(p)) ?? "ps";
8859
+ function clientCloudProfile(env = process.env) {
8860
+ const cloud = cloudCredential(env);
8861
+ return cloud ? cloudProfileId(cloud) : void 0;
8862
+ }
8863
+ var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs7.existsSync(p)) ?? "ps";
8720
8864
  var PS_WIDTH_FLAGS = ["-ww"];
8721
8865
  var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
8722
8866
  function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
@@ -8763,13 +8907,13 @@ var LOCK_STALE_MS = 45e3;
8763
8907
  var LOCK_POLL_MS = 100;
8764
8908
  function spawnLockIsStale() {
8765
8909
  try {
8766
- const { pid, ts } = JSON.parse(fs6.readFileSync(LOCK_FILE, "utf8"));
8910
+ const { pid, ts } = JSON.parse(fs7.readFileSync(LOCK_FILE, "utf8"));
8767
8911
  if (typeof pid === "number" && pid > 0 && !isProcessAlive(pid)) return true;
8768
8912
  if (typeof ts === "number" && Date.now() - ts > LOCK_STALE_MS) return true;
8769
8913
  return false;
8770
8914
  } catch {
8771
8915
  try {
8772
- return Date.now() - fs6.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
8916
+ return Date.now() - fs7.statSync(LOCK_FILE).mtimeMs > LOCK_STALE_MS;
8773
8917
  } catch {
8774
8918
  return true;
8775
8919
  }
@@ -8777,7 +8921,7 @@ function spawnLockIsStale() {
8777
8921
  }
8778
8922
  async function acquireSpawnLock() {
8779
8923
  try {
8780
- fs6.mkdirSync(STATE_DIR, { recursive: true });
8924
+ fs7.mkdirSync(STATE_DIR, { recursive: true });
8781
8925
  } catch {
8782
8926
  return null;
8783
8927
  }
@@ -8785,11 +8929,11 @@ async function acquireSpawnLock() {
8785
8929
  const deadline = Date.now() + LOCK_WAIT_TIMEOUT_MS;
8786
8930
  for (; ; ) {
8787
8931
  try {
8788
- const fd = fs6.openSync(LOCK_FILE, "wx");
8932
+ const fd = fs7.openSync(LOCK_FILE, "wx");
8789
8933
  try {
8790
- fs6.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
8934
+ fs7.writeSync(fd, JSON.stringify({ pid: process.pid, nonce, ts: Date.now() }));
8791
8935
  } finally {
8792
- fs6.closeSync(fd);
8936
+ fs7.closeSync(fd);
8793
8937
  }
8794
8938
  let released = false;
8795
8939
  return {
@@ -8797,8 +8941,8 @@ async function acquireSpawnLock() {
8797
8941
  if (released) return;
8798
8942
  released = true;
8799
8943
  try {
8800
- const cur = JSON.parse(fs6.readFileSync(LOCK_FILE, "utf8"));
8801
- if (cur.pid === process.pid && cur.nonce === nonce) fs6.unlinkSync(LOCK_FILE);
8944
+ const cur = JSON.parse(fs7.readFileSync(LOCK_FILE, "utf8"));
8945
+ if (cur.pid === process.pid && cur.nonce === nonce) fs7.unlinkSync(LOCK_FILE);
8802
8946
  } catch {
8803
8947
  }
8804
8948
  }
@@ -8807,10 +8951,10 @@ async function acquireSpawnLock() {
8807
8951
  if (err.code !== "EEXIST") return null;
8808
8952
  if (spawnLockIsStale()) {
8809
8953
  try {
8810
- fs6.unlinkSync(LOCK_FILE);
8954
+ fs7.unlinkSync(LOCK_FILE);
8811
8955
  } catch {
8812
8956
  }
8813
- if (!fs6.existsSync(LOCK_FILE)) continue;
8957
+ if (!fs7.existsSync(LOCK_FILE)) continue;
8814
8958
  }
8815
8959
  if (Date.now() >= deadline) return null;
8816
8960
  await new Promise((r) => setTimeout(r, LOCK_POLL_MS));
@@ -8820,7 +8964,8 @@ async function acquireSpawnLock() {
8820
8964
  async function reusableHandle(state, wantBundlePath, wantVersion) {
8821
8965
  if (!state || !isProcessAlive(state.pid)) return null;
8822
8966
  if (wantBundlePath !== void 0 && state.bundlePath !== wantBundlePath) return null;
8823
- if (wantBundlePath !== void 0 && state.version !== void 0) {
8967
+ const holdsLease = state.cloudProfile !== void 0 && cloudAndroidLeaseHolders().has(state.pid);
8968
+ if (wantBundlePath !== void 0 && state.version !== void 0 && !holdsLease) {
8824
8969
  const diskVersion = readBundlePackageVersion(wantBundlePath);
8825
8970
  if (diskVersion !== void 0) {
8826
8971
  if (diskVersion !== state.version) return null;
@@ -8833,25 +8978,24 @@ async function reusableHandle(state, wantBundlePath, wantVersion) {
8833
8978
  if (!healthy) return null;
8834
8979
  return { url: formatUrl(healthCheckHost(host), state.port), token: state.token ?? "" };
8835
8980
  }
8836
- async function ensureToolsServer(paths) {
8981
+ async function ensureToolsServer(paths, env = process.env) {
8837
8982
  assertPrivateArgentHome();
8838
- const fast = await reusableHandle(
8839
- await readState(paths.bundlePath),
8840
- paths.bundlePath,
8841
- paths.version
8842
- );
8983
+ const cloud = cloudCredential(env) ?? void 0;
8984
+ const cloudProfile = clientCloudProfile(env);
8985
+ const readOwnState = () => readState(paths.bundlePath, cloudProfile);
8986
+ const fast = await reusableHandle(await readOwnState(), paths.bundlePath, paths.version);
8843
8987
  if (fast) return fast;
8844
8988
  const lock = await acquireSpawnLock();
8845
8989
  try {
8846
- const state = await readState(paths.bundlePath);
8990
+ const state = await readOwnState();
8847
8991
  const reuse = await reusableHandle(state, paths.bundlePath, paths.version);
8848
8992
  if (reuse) return reuse;
8849
8993
  if (state && state.managed === "autospawn" && state.bundlePath === paths.bundlePath && isProcessAlive(state.pid) && couldBeOurToolServer(state.pid, state.bundlePath)) {
8850
8994
  await terminatePid(state.pid, () => couldBeOurToolServer(state.pid, state.bundlePath));
8851
8995
  }
8852
- await clearToolsServerState(paths.bundlePath);
8996
+ await clearToolsServerState(paths.bundlePath, cloudProfile);
8853
8997
  await sweepDeadStateFiles();
8854
- if (!fs6.existsSync(paths.bundlePath)) {
8998
+ if (!fs7.existsSync(paths.bundlePath)) {
8855
8999
  throw new Error(
8856
9000
  `The argent install serving this session is gone from disk (${paths.bundlePath}) \u2014 it was likely updated or removed. Restart the editor's MCP connection to reconnect.`
8857
9001
  );
@@ -8862,9 +9006,11 @@ async function ensureToolsServer(paths) {
8862
9006
  const { port: actualPort, pid } = await spawnToolsServer(paths, port, {
8863
9007
  token,
8864
9008
  host: AUTOSPAWN_HOST,
8865
- idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES
9009
+ idleTimeoutMinutes: AUTOSPAWN_IDLE_TIMEOUT_MINUTES,
9010
+ ...cloud ? { cloud } : {}
8866
9011
  });
8867
9012
  await writeState({
9013
+ ...cloudProfile ? { cloudProfile } : {},
8868
9014
  port: actualPort,
8869
9015
  pid,
8870
9016
  startedAt: (/* @__PURE__ */ new Date()).toISOString(),
@@ -8884,7 +9030,7 @@ async function ensureToolsServer(paths) {
8884
9030
  var import_yaml2 = __toESM(require_dist2(), 1);
8885
9031
  import { readFile as readFile5 } from "node:fs/promises";
8886
9032
  import { maxHeaderSize } from "node:http";
8887
- import * as path13 from "node:path";
9033
+ import * as path14 from "node:path";
8888
9034
 
8889
9035
  // ../registry/src/types.ts
8890
9036
  var LINKED_CALL_HEADER = "x-argent-linked";
@@ -8946,8 +9092,8 @@ var UNEXPANDED_PATH = /^~|\$[A-Za-z0-9_{(]|`|%[A-Za-z_][A-Za-z0-9_]*%|^[A-Za-z][
8946
9092
  function isUnexpandedPath(p) {
8947
9093
  return UNEXPANDED_PATH.test(p);
8948
9094
  }
8949
- function isClientFileArgument({ spec, path: path15 }) {
8950
- return spec.kind === "file" && spec.path === `\${${spec.target}}` && path15.startsWith("/") && hasToolFileExtension(path15);
9095
+ function isClientFileArgument({ spec, path: path16 }) {
9096
+ return spec.kind === "file" && spec.path === `\${${spec.target}}` && path16.startsWith("/") && hasToolFileExtension(path16);
8951
9097
  }
8952
9098
 
8953
9099
  // ../registry/src/flow-platforms.ts
@@ -8955,26 +9101,26 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
8955
9101
  var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
8956
9102
 
8957
9103
  // ../registry/src/flow-file-refs.ts
8958
- import * as fs8 from "node:fs/promises";
8959
- import * as path9 from "node:path";
9104
+ import * as fs9 from "node:fs/promises";
9105
+ import * as path10 from "node:path";
8960
9106
 
8961
9107
  // ../registry/src/e2e-dirs.ts
8962
- import * as fs7 from "node:fs/promises";
8963
- import * as path8 from "node:path";
8964
- var E2E_DIR = path8.join(".argent", "e2e");
8965
- var LEGACY_E2E_DIRS = Object.freeze([path8.join(".argent", "flows")]);
9108
+ import * as fs8 from "node:fs/promises";
9109
+ import * as path9 from "node:path";
9110
+ var E2E_DIR = path9.join(".argent", "e2e");
9111
+ var LEGACY_E2E_DIRS = Object.freeze([path9.join(".argent", "flows")]);
8966
9112
  var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
8967
9113
  function e2eDirFor(projectRoot) {
8968
- return path8.join(projectRoot, E2E_DIR);
9114
+ return path9.join(projectRoot, E2E_DIR);
8969
9115
  }
8970
9116
  function e2eDirsFor(projectRoot) {
8971
- return E2E_DIRS.map((dir) => path8.join(projectRoot, dir));
9117
+ return E2E_DIRS.map((dir) => path9.join(projectRoot, dir));
8972
9118
  }
8973
9119
  function e2eFileCandidates(projectRoot, name) {
8974
- return e2eDirsFor(projectRoot).map((dir) => path8.join(dir, `${name}.yaml`));
9120
+ return e2eDirsFor(projectRoot).map((dir) => path9.join(dir, `${name}.yaml`));
8975
9121
  }
8976
9122
  async function exists(file) {
8977
- return fs7.stat(file).then(
9123
+ return fs8.stat(file).then(
8978
9124
  () => true,
8979
9125
  () => false
8980
9126
  );
@@ -9001,21 +9147,21 @@ async function pickE2eFile(candidates) {
9001
9147
  function e2eShadowWarning(used, shadowed) {
9002
9148
  return `${shadowed} is not used: ${used} has the same name and is read first.`;
9003
9149
  }
9004
- var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path8.basename(dir));
9150
+ var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path9.basename(dir));
9005
9151
  function e2eDirProject(dir) {
9006
9152
  const trimmed = dir.length > 1 ? dir.replace(/[\\/]+$/, "") : dir;
9007
- const argent = path8.dirname(trimmed);
9008
- if (!E2E_DIR_NAMES.includes(path8.basename(trimmed)) || path8.basename(argent) !== ".argent") {
9153
+ const argent = path9.dirname(trimmed);
9154
+ if (!E2E_DIR_NAMES.includes(path9.basename(trimmed)) || path9.basename(argent) !== ".argent") {
9009
9155
  return null;
9010
9156
  }
9011
- return path8.dirname(argent);
9157
+ return path9.dirname(argent);
9012
9158
  }
9013
9159
  function e2eRunFallbackDirs(anchorDir, target) {
9014
9160
  if (target.includes("/") || target.includes("\\")) return [];
9015
9161
  const project = e2eDirProject(anchorDir);
9016
9162
  if (project === null) return [];
9017
- const anchor = path8.resolve(anchorDir);
9018
- return e2eDirsFor(project).filter((dir) => path8.resolve(dir) !== anchor);
9163
+ const anchor = path9.resolve(anchorDir);
9164
+ return e2eDirsFor(project).filter((dir) => path9.resolve(dir) !== anchor);
9019
9165
  }
9020
9166
 
9021
9167
  // ../registry/src/tool-ids.ts
@@ -9065,10 +9211,10 @@ function canonicalToolArgs(tool, args) {
9065
9211
  // ../registry/src/flow-file-refs.ts
9066
9212
  async function canonicalFlowPath(p) {
9067
9213
  try {
9068
- return await fs8.realpath(p);
9214
+ return await fs9.realpath(p);
9069
9215
  } catch {
9070
9216
  try {
9071
- return path9.join(await fs8.realpath(path9.dirname(p)), path9.basename(p));
9217
+ return path10.join(await fs9.realpath(path10.dirname(p)), path10.basename(p));
9072
9218
  } catch {
9073
9219
  return p;
9074
9220
  }
@@ -9077,7 +9223,7 @@ async function canonicalFlowPath(p) {
9077
9223
  function completeRunExtension(value) {
9078
9224
  if (value.endsWith(".yaml")) return value;
9079
9225
  const candidate = `${value}.yaml`;
9080
- return FLOW_FILE_NAME_PATTERN.test(path9.posix.basename(candidate)) ? candidate : value;
9226
+ return FLOW_FILE_NAME_PATTERN.test(path10.posix.basename(candidate)) ? candidate : value;
9081
9227
  }
9082
9228
  var MAX_RUN_DEPTH = 20;
9083
9229
  var MAX_BLOCK_NESTING = 64;
@@ -9099,9 +9245,9 @@ function collectFlowRequests(doc) {
9099
9245
  for (const step of steps) {
9100
9246
  if (!isRecord(step)) continue;
9101
9247
  const run = step.run;
9102
- if (typeof run === "string" && !run.includes("\\") && !path9.posix.isAbsolute(run) && !/^[A-Za-z]:/.test(run)) {
9248
+ if (typeof run === "string" && !run.includes("\\") && !path10.posix.isAbsolute(run) && !/^[A-Za-z]:/.test(run)) {
9103
9249
  const target = completeRunExtension(run);
9104
- if (FLOW_FILE_NAME_PATTERN.test(path9.posix.basename(target))) runTargets.add(target);
9250
+ if (FLOW_FILE_NAME_PATTERN.test(path10.posix.basename(target))) runTargets.add(target);
9105
9251
  }
9106
9252
  const snapshot = isRecord(step.snapshot) ? step.snapshot.name : step.snapshot;
9107
9253
  if (typeof snapshot === "string" && FLOW_NAME_PATTERN.test(snapshot)) snapshots.add(snapshot);
@@ -9121,14 +9267,14 @@ function collectFlowRequests(doc) {
9121
9267
  return { runTargets: [...runTargets], snapshots: [...snapshots], toolSteps, nested };
9122
9268
  }
9123
9269
  function baselineKeyFor(canonicalPath2, flowName) {
9124
- const stem = path9.basename(canonicalPath2, ".yaml");
9270
+ const stem = path10.basename(canonicalPath2, ".yaml");
9125
9271
  return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
9126
9272
  }
9127
9273
  function flowMemberKey(anchorDir, target) {
9128
9274
  return `${anchorDir}\0${target}`;
9129
9275
  }
9130
9276
  async function classifyOnDiskSpelling(dir, base, addressable = FLOW_FILE_NAME_PATTERN) {
9131
- const entries = await fs8.readdir(dir).catch(() => null);
9277
+ const entries = await fs9.readdir(dir).catch(() => null);
9132
9278
  if (entries === null || entries.includes(base)) return { state: "listed" };
9133
9279
  const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
9134
9280
  if (actual === void 0) return { state: "absent" };
@@ -9150,11 +9296,11 @@ function nestedFlowTarget(args) {
9150
9296
  return { kind: "name", projectRoot, name, path: paths[0], paths };
9151
9297
  }
9152
9298
  if (name !== void 0 || !isResolvedAbsolute(flowPath)) return void 0;
9153
- if (!FLOW_FILE_NAME_PATTERN.test(path9.basename(flowPath))) return void 0;
9299
+ if (!FLOW_FILE_NAME_PATTERN.test(path10.basename(flowPath))) return void 0;
9154
9300
  return { kind: "e2e_test_path", path: flowPath };
9155
9301
  }
9156
9302
  function isResolvedAbsolute(value) {
9157
- return typeof value === "string" && path9.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
9303
+ return typeof value === "string" && path10.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
9158
9304
  }
9159
9305
 
9160
9306
  // ../registry/src/failure-codes.ts
@@ -9588,6 +9734,17 @@ var FAILURE_CODES = {
9588
9734
  BOOT_HARMONY_STOP_TIMEOUT: "BOOT_HARMONY_STOP_TIMEOUT",
9589
9735
  BOOT_HARMONY_MANAGER_EXITED: "BOOT_HARMONY_MANAGER_EXITED",
9590
9736
  BOOT_HARMONY_START_FAILED: "BOOT_HARMONY_START_FAILED",
9737
+ /**
9738
+ * Argent Cloud Android emulators
9739
+ * @see [leases.ts](../../tool-server/src/utils/cloud-android/leases.ts)
9740
+ */
9741
+ CLOUD_ANDROID_ACCESS_DENIED: "CLOUD_ANDROID_ACCESS_DENIED",
9742
+ CLOUD_ANDROID_ACQUIRE_FAILED: "CLOUD_ANDROID_ACQUIRE_FAILED",
9743
+ CLOUD_ANDROID_ADB_KEY_MISSING: "CLOUD_ANDROID_ADB_KEY_MISSING",
9744
+ CLOUD_ANDROID_ADB_SERVER_REMOTE: "CLOUD_ANDROID_ADB_SERVER_REMOTE",
9745
+ CLOUD_ANDROID_CONNECT_FAILED: "CLOUD_ANDROID_CONNECT_FAILED",
9746
+ CLOUD_ANDROID_LEASE_IN_USE: "CLOUD_ANDROID_LEASE_IN_USE",
9747
+ CLOUD_ANDROID_NO_EMULATOR: "CLOUD_ANDROID_NO_EMULATOR",
9591
9748
  /**
9592
9749
  * External device providers
9593
9750
  * @see [external-devices.ts](../../tool-server/src/utils/external-devices.ts)
@@ -9622,9 +9779,9 @@ var FAILURE_SPAWN_CODE_SET = new Set(FAILURE_SPAWN_CODES);
9622
9779
  import { randomUUID as randomUUID3 } from "node:crypto";
9623
9780
  import { AsyncLocalStorage } from "node:async_hooks";
9624
9781
  var resolvedDuringInvocation = new AsyncLocalStorage();
9625
- function valueAtPath(root, path15) {
9782
+ function valueAtPath(root, path16) {
9626
9783
  let current = root;
9627
- for (const key of path15) {
9784
+ for (const key of path16) {
9628
9785
  if (current === null || typeof current !== "object") return void 0;
9629
9786
  if (!Object.hasOwn(current, key)) return void 0;
9630
9787
  current = current[key];
@@ -9682,10 +9839,10 @@ function describeParamIssues(error, params) {
9682
9839
  }
9683
9840
 
9684
9841
  // ../argent-tools-client/src/link-config.ts
9685
- import * as path10 from "node:path";
9842
+ import * as path11 from "node:path";
9686
9843
  import { mkdir, writeFile, readFile as readFile2, unlink as unlink2, chmod } from "node:fs/promises";
9687
9844
  var LINK_DIR = argentHomeDir();
9688
- var LINK_FILE = path10.join(LINK_DIR, "link.json");
9845
+ var LINK_FILE = path11.join(LINK_DIR, "link.json");
9689
9846
  async function readLinkConfig() {
9690
9847
  try {
9691
9848
  const raw = await readFile2(LINK_FILE, "utf8");
@@ -9738,14 +9895,14 @@ import {
9738
9895
  writeFile as writeFile2
9739
9896
  } from "node:fs/promises";
9740
9897
  import { constants as constants2, tmpdir } from "node:os";
9741
- import * as path11 from "node:path";
9898
+ import * as path12 from "node:path";
9742
9899
 
9743
9900
  // ../archive/src/index.ts
9744
9901
  import { spawn as spawn2 } from "node:child_process";
9745
9902
  import { once } from "node:events";
9746
9903
  import { createReadStream, createWriteStream } from "node:fs";
9747
9904
  import { open, rm, readdir as readdir3 } from "node:fs/promises";
9748
- import { basename as basename4, dirname as dirname5, join as join10, resolve as resolve8, sep as sep2 } from "node:path";
9905
+ import { basename as basename4, dirname as dirname6, join as join11, resolve as resolve8, sep as sep2 } from "node:path";
9749
9906
  import { Writable } from "node:stream";
9750
9907
  import { pipeline } from "node:stream/promises";
9751
9908
  import zlib from "node:zlib";
@@ -9769,7 +9926,7 @@ function createCompressor(format) {
9769
9926
  }
9770
9927
  function createTarArgs(sourcePath) {
9771
9928
  const name = basename4(sourcePath);
9772
- return ["-cf", "-", "-C", dirname5(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
9929
+ return ["-cf", "-", "-C", dirname6(sourcePath), /^[-@]/.test(name) ? `./${name}` : name];
9773
9930
  }
9774
9931
  var MAX_LISTING_BYTES = 32 << 20;
9775
9932
  var MAX_LISTING_LINES = 1 << 18;
@@ -9949,8 +10106,8 @@ async function runTar(archive, args, signal) {
9949
10106
  function normalizeTarMemberPath(memberPath) {
9950
10107
  return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
9951
10108
  }
9952
- function isContainedPath(path15, windows = process.platform === "win32") {
9953
- const slashed = path15.replace(/\\/g, "/");
10109
+ function isContainedPath(path16, windows = process.platform === "win32") {
10110
+ const slashed = path16.replace(/\\/g, "/");
9954
10111
  const drive = windows ? /^[A-Za-z]:/ : /^[A-Za-z]:\//;
9955
10112
  return !slashed.startsWith("/") && !drive.test(slashed) && !slashed.split("/").includes("..");
9956
10113
  }
@@ -10010,7 +10167,7 @@ async function assertSafeArchive(archive, destDir, signal) {
10010
10167
  async function resolveMember(destDir, expectedName) {
10011
10168
  const entries = await readdir3(destDir);
10012
10169
  if (entries.includes(expectedName)) {
10013
- return join10(destDir, expectedName);
10170
+ return join11(destDir, expectedName);
10014
10171
  }
10015
10172
  const real = entries.filter((e) => !e.startsWith("._"));
10016
10173
  if (real.length !== 1) {
@@ -10018,7 +10175,7 @@ async function resolveMember(destDir, expectedName) {
10018
10175
  `Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
10019
10176
  );
10020
10177
  }
10021
- return join10(destDir, real[0]);
10178
+ return join11(destDir, real[0]);
10022
10179
  }
10023
10180
  async function safeExtractArchive(archivePath, destDir, expectedName, signal) {
10024
10181
  signal?.throwIfAborted();
@@ -10071,20 +10228,20 @@ function interpolatePath(template, args) {
10071
10228
  return missing ? null : out;
10072
10229
  }
10073
10230
  function callerPath(p) {
10074
- const onCurrentDrive = path11.sep === "\\" && /^[\\/](?![\\/])/.test(p);
10075
- if (!onCurrentDrive && (path11.isAbsolute(p) || path11.win32.isAbsolute(p) || isUnexpandedPath(p))) {
10231
+ const onCurrentDrive = path12.sep === "\\" && /^[\\/](?![\\/])/.test(p);
10232
+ if (!onCurrentDrive && (path12.isAbsolute(p) || path12.win32.isAbsolute(p) || isUnexpandedPath(p))) {
10076
10233
  return p;
10077
10234
  }
10078
- const { root } = path11.parse(p);
10235
+ const { root } = path12.parse(p);
10079
10236
  const rest = p.slice(root.length);
10080
10237
  if (!rest.split(/[\\/]/).includes("..")) {
10081
- const resolved = path11.resolve(p);
10082
- const last = p.split(path11.sep === "\\" ? /[\\/]/ : "/").at(-1);
10083
- const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path11.sep);
10084
- return dirOnly ? `${resolved}${path11.sep}` : resolved;
10238
+ const resolved = path12.resolve(p);
10239
+ const last = p.split(path12.sep === "\\" ? /[\\/]/ : "/").at(-1);
10240
+ const dirOnly = p !== last && (last === "" || last === ".") && !resolved.endsWith(path12.sep);
10241
+ return dirOnly ? `${resolved}${path12.sep}` : resolved;
10085
10242
  }
10086
- const base = path11.resolve(root);
10087
- return base.endsWith(path11.sep) ? `${base}${rest}` : `${base}${path11.sep}${rest}`;
10243
+ const base = path12.resolve(root);
10244
+ return base.endsWith(path12.sep) ? `${base}${rest}` : `${base}${path12.sep}${rest}`;
10088
10245
  }
10089
10246
  async function specPath(spec, args) {
10090
10247
  if (spec.kind !== "file" || !spec.paths?.length) return interpolatePath(spec.path, args);
@@ -10192,7 +10349,7 @@ async function uploadTar(tarPath, format, endpoint, signal) {
10192
10349
  }
10193
10350
  async function uploadFile(sourcePath, endpoint, signal) {
10194
10351
  const format = pickArchiveFormat(endpoint.formats);
10195
- const tarPath = path11.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
10352
+ const tarPath = path12.join(tmpdir(), `argent-upload-${randomUUID4()}.tar.gz`);
10196
10353
  trackArchive(tarPath);
10197
10354
  try {
10198
10355
  await createArchiveFile(await realpath2(sourcePath), tarPath, format, signal);
@@ -10267,7 +10424,7 @@ async function prepareFileInputs(specs, args, opts) {
10267
10424
  wire.mtimeMs = st.mtimeMs;
10268
10425
  }
10269
10426
  if (opts.uploadEndpoint && st) {
10270
- process.stderr.write(`Uploading ${path11.basename(filePath)} to the remote tool-server...
10427
+ process.stderr.write(`Uploading ${path12.basename(filePath)} to the remote tool-server...
10271
10428
  `);
10272
10429
  Object.assign(wire, await uploadFile(filePath, opts.uploadEndpoint, opts.signal));
10273
10430
  }
@@ -10277,7 +10434,7 @@ async function prepareFileInputs(specs, args, opts) {
10277
10434
  return out;
10278
10435
  }
10279
10436
  function isAllowedClientFilePath(p) {
10280
- if (!path11.isAbsolute(p)) return false;
10437
+ if (!path12.isAbsolute(p)) return false;
10281
10438
  const segments = p.split(/[\\/]+/);
10282
10439
  if (segments.includes("..")) return false;
10283
10440
  const file = segments[segments.length - 1] ?? "";
@@ -10288,7 +10445,7 @@ function isClientFileDirective2(value) {
10288
10445
  return !!value && typeof value === "object" && value[CLIENT_FILE_MARKER2] === true && typeof value.path === "string" && typeof value.content === "string";
10289
10446
  }
10290
10447
  async function replaceFile(target, bytes, mode) {
10291
- const temp = path11.join(path11.dirname(target), `.baseline-${randomUUID4()}.tmp`);
10448
+ const temp = path12.join(path12.dirname(target), `.baseline-${randomUUID4()}.tmp`);
10292
10449
  try {
10293
10450
  await writeFile2(temp, bytes, { flag: "wx" });
10294
10451
  if (mode !== void 0) await chmod2(temp, mode & 511);
@@ -10299,27 +10456,27 @@ async function replaceFile(target, bytes, mode) {
10299
10456
  }
10300
10457
  }
10301
10458
  async function writeBaselineFile(file, bytes, allowedDirs) {
10302
- if (!path11.isAbsolute(file) || path11.normalize(file) !== file || file.split(/[\\/]/).includes("..") || !file.endsWith(".png") || !allowedDirs.includes(path11.dirname(file))) {
10459
+ if (!path12.isAbsolute(file) || path12.normalize(file) !== file || file.split(/[\\/]/).includes("..") || !file.endsWith(".png") || !allowedDirs.includes(path12.dirname(file))) {
10303
10460
  return allowedDirs.length === 0 ? "this call writes no baselines" : `${file} is not a baseline of this call (${allowedDirs.map((d) => `${d}/<name>.png`).join(", ")})`;
10304
10461
  }
10305
10462
  if (bytes.length > MAX_CONTENT_BYTES) {
10306
10463
  return `${file}: the baseline is larger than the 32 MiB cap on a file this client writes`;
10307
10464
  }
10308
- const dir = path11.dirname(file);
10465
+ const dir = path12.dirname(file);
10309
10466
  await mkdir2(dir, { recursive: true });
10310
10467
  const link = await lstat(file).catch(() => null);
10311
10468
  const real = link === null ? null : await realpath2(file).catch(() => null);
10312
10469
  if (link !== null && real === null) return `${file} is a symbolic link to a missing file`;
10313
10470
  if (real !== null) {
10314
10471
  if (!real.endsWith(".png")) return `${file} links to a file that is not a PNG file`;
10315
- if (path11.dirname(real) !== await realpath2(dir)) {
10472
+ if (path12.dirname(real) !== await realpath2(dir)) {
10316
10473
  return `${file} links outside its baseline directory`;
10317
10474
  }
10318
10475
  }
10319
10476
  const existing = real === null ? null : await stat3(real);
10320
10477
  if (existing !== null && !existing.isFile()) return `${file} is not a regular file`;
10321
10478
  await replaceFile(
10322
- real ?? path11.join(await realpath2(dir), path11.basename(file)),
10479
+ real ?? path12.join(await realpath2(dir), path12.basename(file)),
10323
10480
  bytes,
10324
10481
  existing?.mode
10325
10482
  );
@@ -10345,7 +10502,7 @@ async function applyClientFileDirectives(result, opts = {}) {
10345
10502
  if (isClientFileDirective2(value)) {
10346
10503
  if (!isAllowedClientFilePath(value.path)) return null;
10347
10504
  try {
10348
- await mkdir2(path11.dirname(value.path), { recursive: true });
10505
+ await mkdir2(path12.dirname(value.path), { recursive: true });
10349
10506
  await writeFile2(value.path, value.content, "utf8");
10350
10507
  written.push(value.path);
10351
10508
  return value.path;
@@ -10374,13 +10531,13 @@ async function applyClientFileDirectives(result, opts = {}) {
10374
10531
  // ../argent-tools-client/src/flow-files.ts
10375
10532
  var import_yaml = __toESM(require_dist2(), 1);
10376
10533
  import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
10377
- import * as path12 from "node:path";
10534
+ import * as path13 from "node:path";
10378
10535
  var INLINE_MEMBERS_BYTES = 256 * 1024;
10379
10536
  function filesLogEnabled() {
10380
10537
  return (process.env.ARGENT_E2E_FILES_LOG ?? process.env.ARGENT_FLOW_FILES_LOG) === "1";
10381
10538
  }
10382
10539
  function isWithin(inner, outer) {
10383
- return inner === outer || inner.startsWith(outer.endsWith(path12.sep) ? outer : outer + path12.sep);
10540
+ return inner === outer || inner.startsWith(outer.endsWith(path13.sep) ? outer : outer + path13.sep);
10384
10541
  }
10385
10542
  function printable(text) {
10386
10543
  return [...text].map(
@@ -10388,7 +10545,7 @@ function printable(text) {
10388
10545
  ).join("");
10389
10546
  }
10390
10547
  function isResolvedAbsolute2(value) {
10391
- return typeof value === "string" && path12.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
10548
+ return typeof value === "string" && path13.isAbsolute(value) && !value.split(/[\\/]+/).includes("..");
10392
10549
  }
10393
10550
  function namesValidFlow(args) {
10394
10551
  let canonical;
@@ -10400,13 +10557,13 @@ function namesValidFlow(args) {
10400
10557
  const { project_root, e2e_test_path: testPath, name } = canonical;
10401
10558
  if (!isResolvedAbsolute2(project_root)) return false;
10402
10559
  if (name === void 0) {
10403
- return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path12.basename(testPath));
10560
+ return isResolvedAbsolute2(testPath) && FLOW_FILE_NAME_PATTERN.test(path13.basename(testPath));
10404
10561
  }
10405
10562
  return testPath === void 0 && typeof name === "string" && FLOW_NAME_PATTERN.test(name);
10406
10563
  }
10407
10564
  function savedFlowProject(file) {
10408
- if (!path12.isAbsolute(file)) return null;
10409
- for (let dir = path12.dirname(file); dir !== path12.dirname(dir); dir = path12.dirname(dir)) {
10565
+ if (!path13.isAbsolute(file)) return null;
10566
+ for (let dir = path13.dirname(file); dir !== path13.dirname(dir); dir = path13.dirname(dir)) {
10410
10567
  const project = e2eDirProject(dir);
10411
10568
  if (project !== null) return project;
10412
10569
  }
@@ -10421,11 +10578,11 @@ async function landing(spelled) {
10421
10578
  const canonical = await canonicalFlowPath(spelled);
10422
10579
  let at = spelled;
10423
10580
  for (; ; ) {
10424
- const parent = path12.dirname(at);
10581
+ const parent = path13.dirname(at);
10425
10582
  if (parent === at) return { canonical, fence: spelled, ...failure };
10426
10583
  const real = await realpath3(parent).catch(() => null);
10427
10584
  if (real !== null) {
10428
- return { canonical, fence: path12.join(real, path12.basename(at)), ...failure };
10585
+ return { canonical, fence: path13.join(real, path13.basename(at)), ...failure };
10429
10586
  }
10430
10587
  at = parent;
10431
10588
  }
@@ -10433,10 +10590,10 @@ async function landing(spelled) {
10433
10590
  }
10434
10591
  async function closureRoots(rootPath, rootCanonical, projectRoot) {
10435
10592
  const candidates = [];
10436
- if (typeof projectRoot === "string" && path12.isAbsolute(projectRoot)) {
10593
+ if (typeof projectRoot === "string" && path13.isAbsolute(projectRoot)) {
10437
10594
  candidates.push(projectRoot, ...e2eDirsFor(projectRoot));
10438
10595
  }
10439
- candidates.push(path12.dirname(rootPath), path12.dirname(rootCanonical));
10596
+ candidates.push(path13.dirname(rootPath), path13.dirname(rootCanonical));
10440
10597
  for (const file of [rootPath, rootCanonical]) {
10441
10598
  const project = savedFlowProject(file);
10442
10599
  if (project !== null) candidates.push(project);
@@ -10449,11 +10606,11 @@ async function closureRoots(rootPath, rootCanonical, projectRoot) {
10449
10606
  return real.filter((root) => !real.some((other) => other !== root && isWithin(root, other)));
10450
10607
  }
10451
10608
  async function readFlowMember(anchorDir, target, roots, budget, opts) {
10452
- const spelled = anchorDir + path12.sep + target;
10609
+ const spelled = anchorDir + path13.sep + target;
10453
10610
  const { canonical, fence, missing, error } = await landing(spelled);
10454
10611
  const spelling = await classifyOnDiskSpelling(
10455
- path12.dirname(spelled),
10456
- path12.posix.basename(target),
10612
+ path13.dirname(spelled),
10613
+ path13.posix.basename(target),
10457
10614
  FLOW_FILE_NAME_PATTERN
10458
10615
  );
10459
10616
  const member = {
@@ -10478,7 +10635,7 @@ async function readFlowMember(anchorDir, target, roots, budget, opts) {
10478
10635
  return { member: { ...member, state: "missing" }, sent: "missing" };
10479
10636
  }
10480
10637
  if (st.isDirectory()) return refuse("EISDIR: illegal operation on a directory, read");
10481
- if (!/\.ya?ml$/i.test(path12.basename(canonical))) {
10638
+ if (!/\.ya?ml$/i.test(path13.basename(canonical))) {
10482
10639
  return refuse(`${target} links to a file that is not a YAML file`);
10483
10640
  }
10484
10641
  const sent = await sendBytes(member, canonical, budget, opts);
@@ -10604,12 +10761,12 @@ function memberCollector(roots, opts) {
10604
10761
  }
10605
10762
  async function savedTest(target) {
10606
10763
  for (const candidate of target.paths) {
10607
- const found = await flow(path12.dirname(candidate), path12.basename(candidate), true);
10764
+ const found = await flow(path13.dirname(candidate), path13.basename(candidate), true);
10608
10765
  if (found !== void 0) return found;
10609
10766
  }
10610
10767
  let first;
10611
10768
  for (const candidate of target.paths) {
10612
- first ??= await flow(path12.dirname(candidate), path12.basename(candidate));
10769
+ first ??= await flow(path13.dirname(candidate), path13.basename(candidate));
10613
10770
  }
10614
10771
  return first;
10615
10772
  }
@@ -10619,9 +10776,9 @@ function memberCollector(roots, opts) {
10619
10776
  return { canonical: member.canonical, text, flowName: target.name, hop, updates, platform };
10620
10777
  }
10621
10778
  async function pathRun(target, hop, updates, platform) {
10622
- const { member, text } = await flow(path12.dirname(target.path), path12.basename(target.path));
10779
+ const { member, text } = await flow(path13.dirname(target.path), path13.basename(target.path));
10623
10780
  if (text === void 0 || hop >= MAX_RUN_DEPTH) return void 0;
10624
- const flowName = path12.basename(target.path, ".yaml");
10781
+ const flowName = path13.basename(target.path, ".yaml");
10625
10782
  return { canonical: member.canonical, text, flowName, hop, updates, platform };
10626
10783
  }
10627
10784
  async function runTarget(anchorDir, target) {
@@ -10652,7 +10809,7 @@ function memberCollector(roots, opts) {
10652
10809
  const requests = collectFlowRequests(doc);
10653
10810
  for (const name of requests.snapshots) snapshots.add(name);
10654
10811
  for (const step of requests.toolSteps) await toolFiles(step);
10655
- const anchorDir = path12.dirname(file.canonical);
10812
+ const anchorDir = path13.dirname(file.canonical);
10656
10813
  for (const target of requests.runTargets) {
10657
10814
  const key = flowMemberKey(anchorDir, target);
10658
10815
  if (visited.has(key)) continue;
@@ -10669,8 +10826,8 @@ function memberCollector(roots, opts) {
10669
10826
  }
10670
10827
  }
10671
10828
  if (snapshots.size === 0) continue;
10672
- const dir = path12.join(
10673
- path12.dirname(run.canonical),
10829
+ const dir = path13.join(
10830
+ path13.dirname(run.canonical),
10674
10831
  "__baselines__",
10675
10832
  baselineKeyFor(run.canonical, run.flowName)
10676
10833
  );
@@ -10695,7 +10852,7 @@ function memberCollector(roots, opts) {
10695
10852
  if (!name.endsWith(".png")) continue;
10696
10853
  const compared = [...prefixes].some((prefix) => name.startsWith(prefix));
10697
10854
  if (!updates && !compared) continue;
10698
- const file = path12.join(dir, name);
10855
+ const file = path13.join(dir, name);
10699
10856
  if (tools.has(file)) continue;
10700
10857
  const member = { role: "baseline", key: file, path: file };
10701
10858
  const entry = await baselineEntry(file, roots, updates && !compared);
@@ -10718,19 +10875,19 @@ async function collectFlowMembers(rootPath, rootBytes, args, opts) {
10718
10875
  if (!namesValidFlow(args)) return {};
10719
10876
  const canonical = await canonicalFlowPath(rootPath);
10720
10877
  const spelling = await classifyOnDiskSpelling(
10721
- path12.dirname(rootPath),
10722
- path12.basename(rootPath),
10878
+ path13.dirname(rootPath),
10879
+ path13.basename(rootPath),
10723
10880
  FLOW_FILE_NAME_PATTERN
10724
10881
  );
10725
10882
  const collector = memberCollector(
10726
- opts.scanOnly ? [path12.parse(path12.resolve(rootPath)).root] : await closureRoots(rootPath, canonical, args.project_root),
10883
+ opts.scanOnly ? [path13.parse(path13.resolve(rootPath)).root] : await closureRoots(rootPath, canonical, args.project_root),
10727
10884
  opts
10728
10885
  );
10729
10886
  await collector.walk([
10730
10887
  {
10731
10888
  canonical,
10732
10889
  text: rootBytes.toString("utf8"),
10733
- flowName: path12.basename(rootPath, ".yaml"),
10890
+ flowName: path13.basename(rootPath, ".yaml"),
10734
10891
  hop: 0,
10735
10892
  updates: args.updateBaselines === true,
10736
10893
  platform: callPlatform(args)
@@ -10759,31 +10916,31 @@ async function collectStepMembers(args, opts, recordingDirFor = e2eDirFor) {
10759
10916
  if (typeof name !== "string" || !FLOW_NAME_PATTERN.test(name) || !isResolvedAbsolute2(projectRoot) || step === void 0) {
10760
10917
  return [];
10761
10918
  }
10762
- const recording = path12.join(recordingDirFor(projectRoot), `${name}.yaml`);
10919
+ const recording = path13.join(recordingDirFor(projectRoot), `${name}.yaml`);
10763
10920
  const collector = memberCollector(
10764
- opts.scanOnly ? [path12.parse(recording).root] : await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
10921
+ opts.scanOnly ? [path13.parse(recording).root] : await closureRoots(recording, (await landing(recording)).canonical, projectRoot),
10765
10922
  opts
10766
10923
  );
10767
10924
  await collector.toolFiles(step);
10768
10925
  if (canonicalToolId(step.tool) === "e2e-execute") {
10769
- const self = await collector.flow(path12.dirname(recording), path12.basename(recording));
10926
+ const self = await collector.flow(path13.dirname(recording), path13.basename(recording));
10770
10927
  let runArgs = step.args;
10771
10928
  const named = nestedFlowTarget(runArgs);
10772
10929
  if (named?.kind === "e2e_test_path") {
10773
- const stem = path12.basename(named.path, ".yaml");
10774
- const base = path12.basename(named.path);
10775
- const dir = path12.resolve(path12.dirname(named.path));
10776
- const recordingDir = path12.dirname(recording);
10930
+ const stem = path13.basename(named.path, ".yaml");
10931
+ const base = path13.basename(named.path);
10932
+ const dir = path13.resolve(path13.dirname(named.path));
10933
+ const recordingDir = path13.dirname(recording);
10777
10934
  const dirs = [recordingDir, ...e2eRunFallbackDirs(recordingDir, base)];
10778
- if (dirs.some((d) => path12.resolve(d) === dir)) {
10779
- await collector.flow(path12.dirname(named.path), base);
10935
+ if (dirs.some((d) => path13.resolve(d) === dir)) {
10936
+ await collector.flow(path13.dirname(named.path), base);
10780
10937
  runArgs = { ...runArgs, name: stem };
10781
10938
  delete runArgs.e2e_test_path;
10782
10939
  }
10783
10940
  }
10784
10941
  const target = nestedFlowTarget(runArgs);
10785
10942
  if (target?.kind === "name") {
10786
- await collector.flow(path12.dirname(self.member.canonical), `${target.name}.yaml`);
10943
+ await collector.flow(path13.dirname(self.member.canonical), `${target.name}.yaml`);
10787
10944
  const run = await collector.nestedRun(
10788
10945
  target,
10789
10946
  0,
@@ -10977,10 +11134,10 @@ function assertFiniteNumbers(args) {
10977
11134
  if (typeof item === "object" && item !== null) {
10978
11135
  pending.push({ value: item, key, parent: visit });
10979
11136
  } else if (typeof item === "number" && !Number.isFinite(item)) {
10980
- const path15 = [key];
10981
- for (let at = visit; at.parent; at = at.parent) path15.push(at.key);
10982
- path15.reverse();
10983
- issues.push({ code: "invalid_type", path: path15, message: `expected a number, got ${item}` });
11137
+ const path16 = [key];
11138
+ for (let at = visit; at.parent; at = at.parent) path16.push(at.key);
11139
+ path16.reverse();
11140
+ issues.push({ code: "invalid_type", path: path16, message: `expected a number, got ${item}` });
10984
11141
  if (issues.length === MAX_NON_FINITE_ISSUES) break;
10985
11142
  }
10986
11143
  }
@@ -11089,8 +11246,8 @@ var RECORDING_TOOLS = /* @__PURE__ */ new Set([
11089
11246
  ]);
11090
11247
  var RECORDING_FILE_INPUT = {
11091
11248
  target: "__recording",
11092
- path: `\${project_root}/${E2E_DIRS[0].split(path13.sep).join("/")}/\${name}.yaml`,
11093
- paths: E2E_DIRS.map((dir) => `\${project_root}/${dir.split(path13.sep).join("/")}/\${name}.yaml`),
11249
+ path: `\${project_root}/${E2E_DIRS[0].split(path14.sep).join("/")}/\${name}.yaml`,
11250
+ paths: E2E_DIRS.map((dir) => `\${project_root}/${dir.split(path14.sep).join("/")}/\${name}.yaml`),
11094
11251
  kind: "file",
11095
11252
  optional: true,
11096
11253
  collect: "flow"
@@ -11139,6 +11296,7 @@ function failedRun(result) {
11139
11296
  }
11140
11297
  function createToolsClient(options = {}) {
11141
11298
  let cached = null;
11299
+ let linkedNoticeShown = false;
11142
11300
  const doFetch = options.fetchImpl ?? ((url, init) => fetch(url, init));
11143
11301
  const diagnose = options.onDiagnostic ?? ((message) => void process.stderr.write(`${message}
11144
11302
  `));
@@ -11147,6 +11305,11 @@ function createToolsClient(options = {}) {
11147
11305
  assertPrivateArgentHome();
11148
11306
  const resolved = await getResolvedToolsUrl();
11149
11307
  if (resolved.url) {
11308
+ if (!linkedNoticeShown) {
11309
+ linkedNoticeShown = true;
11310
+ const notice = linkedCloudCredentialNotice();
11311
+ if (notice) diagnose(notice);
11312
+ }
11150
11313
  return { url: resolved.url, token: resolved.token ?? "", remote: true };
11151
11314
  }
11152
11315
  if (!cached) {
@@ -11201,7 +11364,7 @@ function createToolsClient(options = {}) {
11201
11364
  let unwrittenBaselines = [];
11202
11365
  const memberOptions = {
11203
11366
  collectMembers: collectFlowMembers,
11204
- collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) => path13.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
11367
+ collectStepMembers: olderServer ? (record, o) => collectStepMembers(record, o, (root) => path14.join(root, LEGACY_E2E_DIRS[0])) : collectStepMembers,
11205
11368
  toolFileInputs: (tool) => findTool(tools, tool)?.fileInputs,
11206
11369
  signal: opts?.signal
11207
11370
  };
@@ -11234,7 +11397,7 @@ function createToolsClient(options = {}) {
11234
11397
  }
11235
11398
  if (filesLogEnabled()) {
11236
11399
  for (const file of applied.written) {
11237
- if (baselineDirs.includes(path13.dirname(file))) {
11400
+ if (baselineDirs.includes(path14.dirname(file))) {
11238
11401
  diagnose(`[e2e-files] baseline ${file}: written`);
11239
11402
  }
11240
11403
  }
@@ -11383,7 +11546,7 @@ import {
11383
11546
  } from "node:fs/promises";
11384
11547
  import { constants as fsConstants } from "node:fs";
11385
11548
  import { tmpdir as tmpdir2 } from "node:os";
11386
- import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as join14, normalize as normalize2, resolve as resolve11, sep as sep6 } from "node:path";
11549
+ import { basename as basename7, extname as extname2, isAbsolute as isAbsolute6, join as join15, normalize as normalize2, resolve as resolve11, sep as sep6 } from "node:path";
11387
11550
  import { createHash as createHash3 } from "node:crypto";
11388
11551
  var ARTIFACT_MARKER2 = "__argentArtifact";
11389
11552
  function isArtifactHandle(value) {
@@ -11407,12 +11570,12 @@ function projectSlug() {
11407
11570
  return `${name}-${hash}`;
11408
11571
  }
11409
11572
  function artifactsRoot() {
11410
- return process.env.ARGENT_ARTIFACTS_DIR ?? join14(tmpdir2(), "argent-artifacts");
11573
+ return process.env.ARGENT_ARTIFACTS_DIR ?? join15(tmpdir2(), "argent-artifacts");
11411
11574
  }
11412
11575
  function artifactDir(deviceId) {
11413
11576
  const parts = [artifactsRoot(), projectSlug(), sessionId()];
11414
11577
  if (deviceId) parts.push(sanitizeSegment(deviceId));
11415
- return join14(...parts);
11578
+ return join15(...parts);
11416
11579
  }
11417
11580
  function durableBaseDir() {
11418
11581
  const projectRoot = findProjectRoot(process.cwd());
@@ -11431,7 +11594,7 @@ function configuredRecordingsDir() {
11431
11594
  const trimmed = value.trim();
11432
11595
  if (trimmed === "") return null;
11433
11596
  const home = resolveHomeDir();
11434
- const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep6}`) ? join14(home, trimmed.slice(2)) : trimmed;
11597
+ const expanded = trimmed === "~" ? home : trimmed.startsWith("~/") || trimmed.startsWith(`~${sep6}`) ? join15(home, trimmed.slice(2)) : trimmed;
11435
11598
  return resolve11(durableBaseDir(), expanded);
11436
11599
  }
11437
11600
  var MAX_ARTIFACT_BYTES = 2 * 1024 * 1024 * 1024;
@@ -11465,10 +11628,10 @@ async function writeDurableUnique(dir, filename, write) {
11465
11628
  const stem = filename.slice(0, filename.length - ext.length);
11466
11629
  for (let i = 1; i <= 1e3; i++) {
11467
11630
  const candidate = i === 1 ? filename : `${stem} (${i})${ext}`;
11468
- const path15 = join14(dir, candidate);
11631
+ const path16 = join15(dir, candidate);
11469
11632
  try {
11470
- await write(path15);
11471
- return path15;
11633
+ await write(path16);
11634
+ return path16;
11472
11635
  } catch (err) {
11473
11636
  if (err?.code === "EEXIST") continue;
11474
11637
  throw err;
@@ -11488,21 +11651,21 @@ function durableSaveTarget(handle) {
11488
11651
  if (configured) {
11489
11652
  return {
11490
11653
  dir: configured,
11491
- path: join14(configured, sanitizeSegment(handle.filename)),
11654
+ path: join15(configured, sanitizeSegment(handle.filename)),
11492
11655
  base: configured,
11493
11656
  rel: ""
11494
11657
  };
11495
11658
  }
11496
11659
  }
11497
11660
  const base = durableBaseDir();
11498
- const dir = join14(base, rel);
11499
- return { dir, path: join14(dir, sanitizeSegment(handle.filename)), base, rel };
11661
+ const dir = join15(base, rel);
11662
+ return { dir, path: join15(dir, sanitizeSegment(handle.filename)), base, rel };
11500
11663
  }
11501
11664
  async function confineToRealBase(dir, base, rel) {
11502
11665
  try {
11503
11666
  const realDir = await realpath4(dir);
11504
11667
  const realBase = await realpath4(base);
11505
- return realDir === join14(realBase, rel);
11668
+ return realDir === join15(realBase, rel);
11506
11669
  } catch {
11507
11670
  return false;
11508
11671
  }
@@ -11526,9 +11689,9 @@ async function resolveLocalFile(handle) {
11526
11689
  }
11527
11690
  async function downloadAndExtractArchive(handle, data, dir, signal) {
11528
11691
  signal?.throwIfAborted();
11529
- const attemptDir = await mkdtemp(join14(dir, "bundle-"));
11530
- const tarball = join14(attemptDir, "download.tar");
11531
- const extractDir = join14(attemptDir, "files");
11692
+ const attemptDir = await mkdtemp(join15(dir, "bundle-"));
11693
+ const tarball = join15(attemptDir, "download.tar");
11694
+ const extractDir = join15(attemptDir, "files");
11532
11695
  try {
11533
11696
  await writeFile3(tarball, data, { signal });
11534
11697
  await mkdir3(extractDir);
@@ -11628,7 +11791,7 @@ async function materializeArtifacts(result, ctx) {
11628
11791
  return await downloadAndExtractArchive(value, data, dir, ctx.signal);
11629
11792
  }
11630
11793
  if (value.size > 0 && data.length !== value.size) return null;
11631
- const downloadedPath = join14(dir, sanitizeSegment(value.filename));
11794
+ const downloadedPath = join15(dir, sanitizeSegment(value.filename));
11632
11795
  await writeFile3(downloadedPath, data);
11633
11796
  if (value.mimeType.startsWith("image/")) {
11634
11797
  images.push({ localPath: downloadedPath, data, mimeType: value.mimeType });
@@ -11662,12 +11825,12 @@ function getDeviceIdFromArgs(args) {
11662
11825
  }
11663
11826
 
11664
11827
  // src/bundled-paths.ts
11665
- import * as fs9 from "node:fs";
11666
- import * as path14 from "node:path";
11828
+ import * as fs10 from "node:fs";
11829
+ import * as path15 from "node:path";
11667
11830
  function readPackageVersion() {
11668
11831
  try {
11669
11832
  const pkg = JSON.parse(
11670
- fs9.readFileSync(path14.join(import.meta.dirname, "..", "package.json"), "utf8")
11833
+ fs10.readFileSync(path15.join(import.meta.dirname, "..", "package.json"), "utf8")
11671
11834
  );
11672
11835
  return pkg.version;
11673
11836
  } catch {
@@ -11678,15 +11841,15 @@ var PACKAGE_NAME = "@swmansion/argent";
11678
11841
  function findDeclaringRoot(startDir) {
11679
11842
  let dir = startDir;
11680
11843
  for (; ; ) {
11681
- if (fs9.existsSync(path14.join(dir, ".argent", "install.json"))) return dir;
11844
+ if (fs10.existsSync(path15.join(dir, ".argent", "install.json"))) return dir;
11682
11845
  try {
11683
- const manifest = JSON.parse(fs9.readFileSync(path14.join(dir, "package.json"), "utf8"));
11846
+ const manifest = JSON.parse(fs10.readFileSync(path15.join(dir, "package.json"), "utf8"));
11684
11847
  if (manifest.devDependencies?.[PACKAGE_NAME] || manifest.dependencies?.[PACKAGE_NAME] || manifest.optionalDependencies?.[PACKAGE_NAME]) {
11685
11848
  return dir;
11686
11849
  }
11687
11850
  } catch {
11688
11851
  }
11689
- const parent = path14.dirname(dir);
11852
+ const parent = path15.dirname(dir);
11690
11853
  if (parent === dir) return null;
11691
11854
  dir = parent;
11692
11855
  }
@@ -11694,12 +11857,12 @@ function findDeclaringRoot(startDir) {
11694
11857
  function findStablePackageDir(startDir, packageRoot) {
11695
11858
  let dir = startDir;
11696
11859
  for (; ; ) {
11697
- const candidate = path14.join(dir, "node_modules", PACKAGE_NAME);
11860
+ const candidate = path15.join(dir, "node_modules", PACKAGE_NAME);
11698
11861
  try {
11699
- if (fs9.realpathSync(candidate) === packageRoot) return candidate;
11862
+ if (fs10.realpathSync(candidate) === packageRoot) return candidate;
11700
11863
  } catch {
11701
11864
  }
11702
- const parent = path14.dirname(dir);
11865
+ const parent = path15.dirname(dir);
11703
11866
  if (parent === dir) return void 0;
11704
11867
  dir = parent;
11705
11868
  }
@@ -11709,7 +11872,7 @@ function classifyInstall() {
11709
11872
  let dir;
11710
11873
  let cwd;
11711
11874
  try {
11712
- packageRoot = fs9.realpathSync(path14.join(import.meta.dirname, ".."));
11875
+ packageRoot = fs10.realpathSync(path15.join(import.meta.dirname, ".."));
11713
11876
  cwd = process.cwd();
11714
11877
  dir = cwd;
11715
11878
  } catch {
@@ -11717,8 +11880,8 @@ function classifyInstall() {
11717
11880
  }
11718
11881
  for (; ; ) {
11719
11882
  try {
11720
- const nmReal = fs9.realpathSync(path14.join(dir, "node_modules"));
11721
- if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path14.sep)) {
11883
+ const nmReal = fs10.realpathSync(path15.join(dir, "node_modules"));
11884
+ if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path15.sep)) {
11722
11885
  return {
11723
11886
  kind: "local",
11724
11887
  projectRoot: findDeclaringRoot(cwd) ?? dir,
@@ -11727,22 +11890,22 @@ function classifyInstall() {
11727
11890
  }
11728
11891
  } catch {
11729
11892
  }
11730
- const parent = path14.dirname(dir);
11893
+ const parent = path15.dirname(dir);
11731
11894
  if (parent === dir) break;
11732
11895
  dir = parent;
11733
11896
  }
11734
- if (packageRoot.includes(`${path14.sep}.yarn${path14.sep}`)) {
11897
+ if (packageRoot.includes(`${path15.sep}.yarn${path15.sep}`)) {
11735
11898
  const declRoot = findDeclaringRoot(cwd);
11736
11899
  if (declRoot) return { kind: "local", projectRoot: declRoot };
11737
11900
  }
11738
11901
  return { kind: "global" };
11739
11902
  }
11740
11903
  var classifiedInstall = classifyInstall();
11741
- var packageDir = classifiedInstall.stablePackageDir ?? path14.join(import.meta.dirname, "..");
11904
+ var packageDir = classifiedInstall.stablePackageDir ?? path15.join(import.meta.dirname, "..");
11742
11905
  var BUNDLED_RUNTIME_PATHS = {
11743
- bundlePath: path14.join(packageDir, "dist", "tool-server.cjs"),
11744
- simulatorServerDir: path14.join(packageDir, "bin"),
11745
- nativeDevtoolsDir: path14.join(packageDir, "dylibs"),
11906
+ bundlePath: path15.join(packageDir, "dist", "tool-server.cjs"),
11907
+ simulatorServerDir: path15.join(packageDir, "bin"),
11908
+ nativeDevtoolsDir: path15.join(packageDir, "dylibs"),
11746
11909
  version: readPackageVersion(),
11747
11910
  installKind: classifiedInstall.kind,
11748
11911
  installProjectRoot: classifiedInstall.projectRoot
@@ -11774,7 +11937,7 @@ function listFlags() {
11774
11937
  function createArgentClient() {
11775
11938
  let client = createToolsClient({ paths: BUNDLED_RUNTIME_PATHS });
11776
11939
  async function stopServer() {
11777
- const stopped = await killToolServer(BUNDLED_RUNTIME_PATHS.bundlePath);
11940
+ const stopped = await killToolServer(BUNDLED_RUNTIME_PATHS.bundlePath, clientCloudProfile());
11778
11941
  client = createToolsClient({ paths: BUNDLED_RUNTIME_PATHS });
11779
11942
  return stopped;
11780
11943
  }