@swmansion/argent 0.18.1-next.21 → 0.18.1-next.22

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.
@@ -482,11 +482,14 @@ var init_artifacts = __esm({
482
482
  function isFileInputWire(value) {
483
483
  return !!value && typeof value === "object" && value[FILE_INPUT_MARKER] === true && typeof value.path === "string";
484
484
  }
485
- var FILE_INPUT_MARKER, CLIENT_FILE_MARKER;
485
+ var FILE_INPUT_MARKER, FLOW_NAME_CHARSET, FLOW_NAME_PATTERN, FLOW_FILE_NAME_PATTERN, CLIENT_FILE_MARKER;
486
486
  var init_file_inputs = __esm({
487
487
  "../registry/src/file-inputs.ts"() {
488
488
  "use strict";
489
489
  FILE_INPUT_MARKER = "__argentFileInput";
490
+ FLOW_NAME_CHARSET = "[A-Za-z0-9_-]+";
491
+ FLOW_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}$`);
492
+ FLOW_FILE_NAME_PATTERN = new RegExp(`^${FLOW_NAME_CHARSET}\\.yaml$`);
490
493
  CLIENT_FILE_MARKER = "__argentClientFile";
491
494
  }
492
495
  });
@@ -21741,10 +21744,10 @@ var require_raw_body = __commonJS({
21741
21744
  if (done) {
21742
21745
  return readStream(stream, encoding, length, limit, wrap(done));
21743
21746
  }
21744
- return new Promise(function executor(resolve9, reject) {
21747
+ return new Promise(function executor(resolve10, reject) {
21745
21748
  readStream(stream, encoding, length, limit, function onRead(err, buf) {
21746
21749
  if (err) return reject(err);
21747
- resolve9(buf);
21750
+ resolve10(buf);
21748
21751
  });
21749
21752
  });
21750
21753
  }
@@ -31573,7 +31576,7 @@ var require_mime_types = __commonJS({
31573
31576
  "../../node_modules/type-is/node_modules/mime-types/index.js"(exports2) {
31574
31577
  "use strict";
31575
31578
  var db = require_mime_db();
31576
- var extname4 = require("path").extname;
31579
+ var extname6 = require("path").extname;
31577
31580
  var mimeScore = require_mimeScore();
31578
31581
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
31579
31582
  var TEXT_TYPE_REGEXP = /^text\//i;
@@ -31629,7 +31632,7 @@ var require_mime_types = __commonJS({
31629
31632
  if (!path40 || typeof path40 !== "string") {
31630
31633
  return false;
31631
31634
  }
31632
- var extension3 = extname4("x." + path40).toLowerCase().slice(1);
31635
+ var extension3 = extname6("x." + path40).toLowerCase().slice(1);
31633
31636
  if (!extension3) {
31634
31637
  return false;
31635
31638
  }
@@ -35256,15 +35259,15 @@ var require_view = __commonJS({
35256
35259
  var path40 = require("node:path");
35257
35260
  var fs55 = require("node:fs");
35258
35261
  var dirname14 = path40.dirname;
35259
- var basename10 = path40.basename;
35260
- var extname4 = path40.extname;
35262
+ var basename12 = path40.basename;
35263
+ var extname6 = path40.extname;
35261
35264
  var join47 = path40.join;
35262
- var resolve9 = path40.resolve;
35265
+ var resolve10 = path40.resolve;
35263
35266
  module2.exports = View;
35264
35267
  function View(name, options) {
35265
35268
  var opts = options || {};
35266
35269
  this.defaultEngine = opts.defaultEngine;
35267
- this.ext = extname4(name);
35270
+ this.ext = extname6(name);
35268
35271
  this.name = name;
35269
35272
  this.root = opts.root;
35270
35273
  if (!this.ext && !this.defaultEngine) {
@@ -35293,9 +35296,9 @@ var require_view = __commonJS({
35293
35296
  debug('lookup "%s"', name);
35294
35297
  for (var i = 0; i < roots.length && !path41; i++) {
35295
35298
  var root2 = roots[i];
35296
- var loc = resolve9(root2, name);
35299
+ var loc = resolve10(root2, name);
35297
35300
  var dir = dirname14(loc);
35298
- var file2 = basename10(loc);
35301
+ var file2 = basename12(loc);
35299
35302
  path41 = this.resolve(dir, file2);
35300
35303
  }
35301
35304
  return path41;
@@ -35318,14 +35321,14 @@ var require_view = __commonJS({
35318
35321
  });
35319
35322
  sync = false;
35320
35323
  };
35321
- View.prototype.resolve = function resolve10(dir, file2) {
35324
+ View.prototype.resolve = function resolve11(dir, file2) {
35322
35325
  var ext = this.ext;
35323
35326
  var path41 = join47(dir, file2);
35324
35327
  var stat4 = tryStat(path41);
35325
35328
  if (stat4 && stat4.isFile()) {
35326
35329
  return path41;
35327
35330
  }
35328
- path41 = join47(dir, basename10(file2, ext), "index" + ext);
35331
+ path41 = join47(dir, basename12(file2, ext), "index" + ext);
35329
35332
  stat4 = tryStat(path41);
35330
35333
  if (stat4 && stat4.isFile()) {
35331
35334
  return path41;
@@ -44892,7 +44895,7 @@ var require_mime_types2 = __commonJS({
44892
44895
  "../../node_modules/express/node_modules/mime-types/index.js"(exports2) {
44893
44896
  "use strict";
44894
44897
  var db = require_mime_db2();
44895
- var extname4 = require("path").extname;
44898
+ var extname6 = require("path").extname;
44896
44899
  var mimeScore = require_mimeScore2();
44897
44900
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
44898
44901
  var TEXT_TYPE_REGEXP = /^text\//i;
@@ -44948,7 +44951,7 @@ var require_mime_types2 = __commonJS({
44948
44951
  if (!path40 || typeof path40 !== "string") {
44949
44952
  return false;
44950
44953
  }
44951
- var extension3 = extname4("x." + path40).toLowerCase().slice(1);
44954
+ var extension3 = extname6("x." + path40).toLowerCase().slice(1);
44952
44955
  if (!extension3) {
44953
44956
  return false;
44954
44957
  }
@@ -47082,7 +47085,7 @@ var require_application = __commonJS({
47082
47085
  var compileETag = require_utils3().compileETag;
47083
47086
  var compileQueryParser = require_utils3().compileQueryParser;
47084
47087
  var compileTrust = require_utils3().compileTrust;
47085
- var resolve9 = require("node:path").resolve;
47088
+ var resolve10 = require("node:path").resolve;
47086
47089
  var once = require_once();
47087
47090
  var Router2 = require_router();
47088
47091
  var slice = Array.prototype.slice;
@@ -47136,7 +47139,7 @@ var require_application = __commonJS({
47136
47139
  this.mountpath = "/";
47137
47140
  this.locals.settings = this.settings;
47138
47141
  this.set("view", View);
47139
- this.set("views", resolve9("views"));
47142
+ this.set("views", resolve10("views"));
47140
47143
  this.set("jsonp callback name", "callback");
47141
47144
  if (env === "production") {
47142
47145
  this.enable("view cache");
@@ -57248,7 +57251,7 @@ var require_mime_types3 = __commonJS({
57248
57251
  "../../node_modules/accepts/node_modules/mime-types/index.js"(exports2) {
57249
57252
  "use strict";
57250
57253
  var db = require_mime_db3();
57251
- var extname4 = require("path").extname;
57254
+ var extname6 = require("path").extname;
57252
57255
  var mimeScore = require_mimeScore3();
57253
57256
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
57254
57257
  var TEXT_TYPE_REGEXP = /^text\//i;
@@ -57304,7 +57307,7 @@ var require_mime_types3 = __commonJS({
57304
57307
  if (!path40 || typeof path40 !== "string") {
57305
57308
  return false;
57306
57309
  }
57307
- var extension3 = extname4("x." + path40).toLowerCase().slice(1);
57310
+ var extension3 = extname6("x." + path40).toLowerCase().slice(1);
57308
57311
  if (!extension3) {
57309
57312
  return false;
57310
57313
  }
@@ -57770,9 +57773,9 @@ var require_content_disposition = __commonJS({
57770
57773
  if (typeof fallback === "string" && NON_LATIN1_REGEXP.test(fallback)) {
57771
57774
  throw new TypeError("fallback must be ISO-8859-1 string");
57772
57775
  }
57773
- var name = basename10(filename);
57776
+ var name = basename12(filename);
57774
57777
  var isQuotedString = TEXT_REGEXP.test(name);
57775
- var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name) : basename10(fallback);
57778
+ var fallbackName = typeof fallback !== "string" ? fallback && getlatin1(name) : basename12(fallback);
57776
57779
  var hasFallback = typeof fallbackName === "string" && fallbackName !== name;
57777
57780
  if (hasFallback || !isQuotedString || hasHexEscape(name)) {
57778
57781
  params["filename*"] = name;
@@ -57892,7 +57895,7 @@ var require_content_disposition = __commonJS({
57892
57895
  this.type = type;
57893
57896
  this.parameters = parameters;
57894
57897
  }
57895
- function basename10(path40) {
57898
+ function basename12(path40) {
57896
57899
  const normalized = path40.replaceAll("\\", "/");
57897
57900
  let end = normalized.length;
57898
57901
  while (end > 0 && normalized[end - 1] === "/") {
@@ -67528,7 +67531,7 @@ var require_mime_types4 = __commonJS({
67528
67531
  "../../node_modules/send/node_modules/mime-types/index.js"(exports2) {
67529
67532
  "use strict";
67530
67533
  var db = require_mime_db4();
67531
- var extname4 = require("path").extname;
67534
+ var extname6 = require("path").extname;
67532
67535
  var mimeScore = require_mimeScore4();
67533
67536
  var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
67534
67537
  var TEXT_TYPE_REGEXP = /^text\//i;
@@ -67584,7 +67587,7 @@ var require_mime_types4 = __commonJS({
67584
67587
  if (!path40 || typeof path40 !== "string") {
67585
67588
  return false;
67586
67589
  }
67587
- var extension3 = extname4("x." + path40).toLowerCase().slice(1);
67590
+ var extension3 = extname6("x." + path40).toLowerCase().slice(1);
67588
67591
  if (!extension3) {
67589
67592
  return false;
67590
67593
  }
@@ -67648,11 +67651,11 @@ var require_send = __commonJS({
67648
67651
  var statuses = require_statuses();
67649
67652
  var Stream2 = require("stream");
67650
67653
  var util = require("util");
67651
- var extname4 = path40.extname;
67654
+ var extname6 = path40.extname;
67652
67655
  var join47 = path40.join;
67653
67656
  var normalize = path40.normalize;
67654
- var resolve9 = path40.resolve;
67655
- var sep6 = path40.sep;
67657
+ var resolve10 = path40.resolve;
67658
+ var sep7 = path40.sep;
67656
67659
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
67657
67660
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
67658
67661
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
@@ -67680,7 +67683,7 @@ var require_send = __commonJS({
67680
67683
  this._maxage = opts.maxAge || opts.maxage;
67681
67684
  this._maxage = typeof this._maxage === "string" ? ms(this._maxage) : Number(this._maxage);
67682
67685
  this._maxage = !isNaN(this._maxage) ? Math.min(Math.max(0, this._maxage), MAX_MAXAGE) : 0;
67683
- this._root = opts.root ? resolve9(opts.root) : null;
67686
+ this._root = opts.root ? resolve10(opts.root) : null;
67684
67687
  }
67685
67688
  util.inherits(SendStream, Stream2);
67686
67689
  SendStream.prototype.error = function error52(status, err) {
@@ -67813,14 +67816,14 @@ var require_send = __commonJS({
67813
67816
  var parts;
67814
67817
  if (root2 !== null) {
67815
67818
  if (path41) {
67816
- path41 = normalize("." + sep6 + path41);
67819
+ path41 = normalize("." + sep7 + path41);
67817
67820
  }
67818
67821
  if (UP_PATH_REGEXP.test(path41)) {
67819
67822
  debug('malicious path "%s"', path41);
67820
67823
  this.error(403);
67821
67824
  return res;
67822
67825
  }
67823
- parts = path41.split(sep6);
67826
+ parts = path41.split(sep7);
67824
67827
  path41 = normalize(join47(root2, path41));
67825
67828
  } else {
67826
67829
  if (UP_PATH_REGEXP.test(path41)) {
@@ -67828,8 +67831,8 @@ var require_send = __commonJS({
67828
67831
  this.error(403);
67829
67832
  return res;
67830
67833
  }
67831
- parts = normalize(path41).split(sep6);
67832
- path41 = resolve9(path41);
67834
+ parts = normalize(path41).split(sep7);
67835
+ path41 = resolve10(path41);
67833
67836
  }
67834
67837
  if (containsDotFile(parts)) {
67835
67838
  debug('%s dotfile "%s"', this._dotfiles, path41);
@@ -67922,8 +67925,8 @@ var require_send = __commonJS({
67922
67925
  var self2 = this;
67923
67926
  debug('stat "%s"', path41);
67924
67927
  fs55.stat(path41, function onstat(err, stat4) {
67925
- var pathEndsWithSep = path41[path41.length - 1] === sep6;
67926
- if (err && err.code === "ENOENT" && !extname4(path41) && !pathEndsWithSep) {
67928
+ var pathEndsWithSep = path41[path41.length - 1] === sep7;
67929
+ if (err && err.code === "ENOENT" && !extname6(path41) && !pathEndsWithSep) {
67927
67930
  return next(err);
67928
67931
  }
67929
67932
  if (err) return self2.onStatError(err);
@@ -67986,7 +67989,7 @@ var require_send = __commonJS({
67986
67989
  SendStream.prototype.type = function type(path41) {
67987
67990
  var res = this.res;
67988
67991
  if (res.getHeader("Content-Type")) return;
67989
- var ext = extname4(path41);
67992
+ var ext = extname6(path41);
67990
67993
  var type2 = mime.contentType(ext) || "application/octet-stream";
67991
67994
  debug("content-type %s", type2);
67992
67995
  res.setHeader("Content-Type", type2);
@@ -68206,8 +68209,8 @@ var require_response = __commonJS({
68206
68209
  var setCharset = require_utils3().setCharset;
68207
68210
  var cookie = require_cookie();
68208
68211
  var send = require_send();
68209
- var extname4 = path40.extname;
68210
- var resolve9 = path40.resolve;
68212
+ var extname6 = path40.extname;
68213
+ var resolve10 = path40.resolve;
68211
68214
  var vary = require_vary();
68212
68215
  var { Buffer: Buffer2 } = require("node:buffer");
68213
68216
  var res = Object.create(http5.ServerResponse.prototype);
@@ -68413,7 +68416,7 @@ var require_response = __commonJS({
68413
68416
  }
68414
68417
  opts = Object.create(opts);
68415
68418
  opts.headers = headers;
68416
- var fullPath = !opts.root ? resolve9(path41) : path41;
68419
+ var fullPath = !opts.root ? resolve10(path41) : path41;
68417
68420
  return this.sendFile(fullPath, opts, done);
68418
68421
  };
68419
68422
  res.contentType = res.type = function contentType(type) {
@@ -68444,7 +68447,7 @@ var require_response = __commonJS({
68444
68447
  };
68445
68448
  res.attachment = function attachment(filename) {
68446
68449
  if (filename) {
68447
- this.type(extname4(filename));
68450
+ this.type(extname6(filename));
68448
68451
  }
68449
68452
  this.set("Content-Disposition", contentDisposition(filename));
68450
68453
  return this;
@@ -68662,7 +68665,7 @@ var require_serve_static = __commonJS({
68662
68665
  var encodeUrl = require_encodeurl();
68663
68666
  var escapeHtml = require_escape_html();
68664
68667
  var parseUrl = require_parseurl();
68665
- var resolve9 = require("path").resolve;
68668
+ var resolve10 = require("path").resolve;
68666
68669
  var send = require_send();
68667
68670
  var url2 = require("url");
68668
68671
  module2.exports = serveStatic;
@@ -68681,7 +68684,7 @@ var require_serve_static = __commonJS({
68681
68684
  throw new TypeError("option setHeaders must be function");
68682
68685
  }
68683
68686
  opts.maxage = opts.maxage || opts.maxAge || 0;
68684
- opts.root = resolve9(root2);
68687
+ opts.root = resolve10(root2);
68685
68688
  var onDirectory = redirect ? createRedirectDirectoryListener() : createNotFoundDirectoryListener();
68686
68689
  return function serveStatic2(req, res, next) {
68687
68690
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -71033,13 +71036,13 @@ var require_min_release_age = __commonJS({
71033
71036
  return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
71034
71037
  }
71035
71038
  function probe3(p) {
71036
- return new Promise((resolve9) => {
71039
+ return new Promise((resolve10) => {
71037
71040
  (0, node_child_process_1.exec)(p.command, { timeout: PROBE_TIMEOUT_MS, windowsHide: true }, (err, stdout) => {
71038
71041
  if (err) {
71039
- resolve9(0);
71042
+ resolve10(0);
71040
71043
  return;
71041
71044
  }
71042
- resolve9(p.parse(stdout));
71045
+ resolve10(p.parse(stdout));
71043
71046
  });
71044
71047
  });
71045
71048
  }
@@ -71072,12 +71075,12 @@ var require_registry = __commonJS({
71072
71075
  var node_https_1 = __importDefault(require("node:https"));
71073
71076
  var REQUEST_TIMEOUT_MS = 1e4;
71074
71077
  function fetchRegistryInfo2(url2) {
71075
- return new Promise((resolve9) => {
71078
+ return new Promise((resolve10) => {
71076
71079
  let resolved = false;
71077
71080
  const safeResolve = (value) => {
71078
71081
  if (!resolved) {
71079
71082
  resolved = true;
71080
- resolve9(value);
71083
+ resolve10(value);
71081
71084
  }
71082
71085
  };
71083
71086
  const req = node_https_1.default.get(url2, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
@@ -72706,7 +72709,7 @@ var require_aspromise = __commonJS({
72706
72709
  var params = new Array(arguments.length - 1), offset = 0, index = 2, pending = true;
72707
72710
  while (index < arguments.length)
72708
72711
  params[offset++] = arguments[index++];
72709
- return new Promise(function executor(resolve9, reject) {
72712
+ return new Promise(function executor(resolve10, reject) {
72710
72713
  params[offset] = function callback(err) {
72711
72714
  if (pending) {
72712
72715
  pending = false;
@@ -72716,7 +72719,7 @@ var require_aspromise = __commonJS({
72716
72719
  var params2 = new Array(arguments.length - 1), offset2 = 0;
72717
72720
  while (offset2 < params2.length)
72718
72721
  params2[offset2++] = arguments[offset2];
72719
- resolve9.apply(null, params2);
72722
+ resolve10.apply(null, params2);
72720
72723
  }
72721
72724
  }
72722
72725
  };
@@ -75213,13 +75216,13 @@ var require_path = __commonJS({
75213
75216
  "../../node_modules/@protobufjs/path/index.js"(exports2) {
75214
75217
  "use strict";
75215
75218
  var path40 = exports2;
75216
- var isAbsolute6 = (
75219
+ var isAbsolute7 = (
75217
75220
  /**
75218
75221
  * Tests if the specified path is absolute.
75219
75222
  * @param {string} path Path to test
75220
75223
  * @returns {boolean} `true` if path is absolute
75221
75224
  */
75222
- path40.isAbsolute = function isAbsolute7(path41) {
75225
+ path40.isAbsolute = function isAbsolute8(path41) {
75223
75226
  return /^(?:\/|\w+:)/.test(path41);
75224
75227
  }
75225
75228
  );
@@ -75231,7 +75234,7 @@ var require_path = __commonJS({
75231
75234
  */
75232
75235
  path40.normalize = function normalize2(path41) {
75233
75236
  path41 = path41.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
75234
- var parts = path41.split("/"), absolute = isAbsolute6(path41), prefix = "";
75237
+ var parts = path41.split("/"), absolute = isAbsolute7(path41), prefix = "";
75235
75238
  if (absolute)
75236
75239
  prefix = parts.shift() + "/";
75237
75240
  for (var i = 0; i < parts.length; ) {
@@ -75250,10 +75253,10 @@ var require_path = __commonJS({
75250
75253
  return prefix + parts.join("/");
75251
75254
  }
75252
75255
  );
75253
- path40.resolve = function resolve9(originPath, includePath, alreadyNormalized) {
75256
+ path40.resolve = function resolve10(originPath, includePath, alreadyNormalized) {
75254
75257
  if (!alreadyNormalized)
75255
75258
  includePath = normalize(includePath);
75256
- if (isAbsolute6(includePath))
75259
+ if (isAbsolute7(includePath))
75257
75260
  return includePath;
75258
75261
  if (!alreadyNormalized)
75259
75262
  originPath = normalize(originPath);
@@ -75607,7 +75610,7 @@ var require_mapfield = __commonJS({
75607
75610
  keepComments ? this.comment : void 0
75608
75611
  ]);
75609
75612
  };
75610
- MapField.prototype.resolve = function resolve9() {
75613
+ MapField.prototype.resolve = function resolve10() {
75611
75614
  if (this.resolved)
75612
75615
  return this;
75613
75616
  if (types.mapKey[this.keyType] === void 0)
@@ -75684,7 +75687,7 @@ var require_method = __commonJS({
75684
75687
  this.parsedOptions
75685
75688
  ]);
75686
75689
  };
75687
- Method.prototype.resolve = function resolve9() {
75690
+ Method.prototype.resolve = function resolve10() {
75688
75691
  if (this.resolved)
75689
75692
  return this;
75690
75693
  this.resolvedRequestType = this.parent.lookupType(this.requestType);
@@ -77297,7 +77300,7 @@ var require_field = __commonJS({
77297
77300
  keepComments ? this.comment : void 0
77298
77301
  ]);
77299
77302
  };
77300
- Field.prototype.resolve = function resolve9() {
77303
+ Field.prototype.resolve = function resolve10() {
77301
77304
  if (this.resolved)
77302
77305
  return this;
77303
77306
  if ((this.typeDefault = types.defaults[this.type]) === void 0) {
@@ -77570,7 +77573,7 @@ var require_object = __commonJS({
77570
77573
  this.parent = null;
77571
77574
  this.resolved = false;
77572
77575
  };
77573
- ReflectionObject.prototype.resolve = function resolve9() {
77576
+ ReflectionObject.prototype.resolve = function resolve10() {
77574
77577
  if (this.resolved)
77575
77578
  return this;
77576
77579
  if (this.root instanceof Root)
@@ -84726,7 +84729,7 @@ var require_minimatch = __commonJS({
84726
84729
  var require_path_is_absolute = __commonJS({
84727
84730
  "../../node_modules/path-is-absolute/index.js"(exports2, module2) {
84728
84731
  "use strict";
84729
- function posix3(path40) {
84732
+ function posix5(path40) {
84730
84733
  return path40.charAt(0) === "/";
84731
84734
  }
84732
84735
  function win32(path40) {
@@ -84736,8 +84739,8 @@ var require_path_is_absolute = __commonJS({
84736
84739
  var isUnc = Boolean(device && device.charAt(1) !== ":");
84737
84740
  return Boolean(result[2] || isUnc);
84738
84741
  }
84739
- module2.exports = process.platform === "win32" ? win32 : posix3;
84740
- module2.exports.posix = posix3;
84742
+ module2.exports = process.platform === "win32" ? win32 : posix5;
84743
+ module2.exports.posix = posix5;
84741
84744
  module2.exports.win32 = win32;
84742
84745
  }
84743
84746
  });
@@ -84759,7 +84762,7 @@ var require_common3 = __commonJS({
84759
84762
  }
84760
84763
  var path40 = require("path");
84761
84764
  var minimatch = require_minimatch();
84762
- var isAbsolute6 = require_path_is_absolute();
84765
+ var isAbsolute7 = require_path_is_absolute();
84763
84766
  var Minimatch = minimatch.Minimatch;
84764
84767
  function alphasorti(a, b) {
84765
84768
  return a.toLowerCase().localeCompare(b.toLowerCase());
@@ -84902,7 +84905,7 @@ var require_common3 = __commonJS({
84902
84905
  var abs = f;
84903
84906
  if (f.charAt(0) === "/") {
84904
84907
  abs = path40.join(self2.root, f);
84905
- } else if (isAbsolute6(f) || f === "") {
84908
+ } else if (isAbsolute7(f) || f === "") {
84906
84909
  abs = f;
84907
84910
  } else if (self2.changedCwd) {
84908
84911
  abs = path40.resolve(self2.cwd, f);
@@ -84940,7 +84943,7 @@ var require_sync = __commonJS({
84940
84943
  var util = require("util");
84941
84944
  var path40 = require("path");
84942
84945
  var assert2 = require("assert");
84943
- var isAbsolute6 = require_path_is_absolute();
84946
+ var isAbsolute7 = require_path_is_absolute();
84944
84947
  var common = require_common3();
84945
84948
  var alphasort = common.alphasort;
84946
84949
  var alphasorti = common.alphasorti;
@@ -85014,8 +85017,8 @@ var require_sync = __commonJS({
85014
85017
  var read;
85015
85018
  if (prefix === null)
85016
85019
  read = ".";
85017
- else if (isAbsolute6(prefix) || isAbsolute6(pattern.join("/"))) {
85018
- if (!prefix || !isAbsolute6(prefix))
85020
+ else if (isAbsolute7(prefix) || isAbsolute7(pattern.join("/"))) {
85021
+ if (!prefix || !isAbsolute7(prefix))
85019
85022
  prefix = "/" + prefix;
85020
85023
  read = prefix;
85021
85024
  } else
@@ -85200,7 +85203,7 @@ var require_sync = __commonJS({
85200
85203
  this.matches[index] = /* @__PURE__ */ Object.create(null);
85201
85204
  if (!exists2)
85202
85205
  return;
85203
- if (prefix && isAbsolute6(prefix) && !this.nomount) {
85206
+ if (prefix && isAbsolute7(prefix) && !this.nomount) {
85204
85207
  var trail = /[\/\\]$/.test(prefix);
85205
85208
  if (prefix.charAt(0) === "/") {
85206
85209
  prefix = path40.join(this.root, prefix);
@@ -85320,7 +85323,7 @@ var require_glob = __commonJS({
85320
85323
  var EE = require("events").EventEmitter;
85321
85324
  var path40 = require("path");
85322
85325
  var assert2 = require("assert");
85323
- var isAbsolute6 = require_path_is_absolute();
85326
+ var isAbsolute7 = require_path_is_absolute();
85324
85327
  var globSync = require_sync();
85325
85328
  var common = require_common3();
85326
85329
  var alphasort = common.alphasort;
@@ -85534,8 +85537,8 @@ var require_glob = __commonJS({
85534
85537
  var read;
85535
85538
  if (prefix === null)
85536
85539
  read = ".";
85537
- else if (isAbsolute6(prefix) || isAbsolute6(pattern.join("/"))) {
85538
- if (!prefix || !isAbsolute6(prefix))
85540
+ else if (isAbsolute7(prefix) || isAbsolute7(pattern.join("/"))) {
85541
+ if (!prefix || !isAbsolute7(prefix))
85539
85542
  prefix = "/" + prefix;
85540
85543
  read = prefix;
85541
85544
  } else
@@ -85767,7 +85770,7 @@ var require_glob = __commonJS({
85767
85770
  this.matches[index] = /* @__PURE__ */ Object.create(null);
85768
85771
  if (!exists2)
85769
85772
  return cb();
85770
- if (prefix && isAbsolute6(prefix) && !this.nomount) {
85773
+ if (prefix && isAbsolute7(prefix) && !this.nomount) {
85771
85774
  var trail = /[\/\\]$/.test(prefix);
85772
85775
  if (prefix.charAt(0) === "/") {
85773
85776
  prefix = path40.join(this.root, prefix);
@@ -87604,7 +87607,7 @@ var require_util2 = __commonJS({
87604
87607
  }
87605
87608
  path40 = url2.path;
87606
87609
  }
87607
- var isAbsolute6 = exports2.isAbsolute(path40);
87610
+ var isAbsolute7 = exports2.isAbsolute(path40);
87608
87611
  var parts = [];
87609
87612
  var start2 = 0;
87610
87613
  var i = 0;
@@ -87639,7 +87642,7 @@ var require_util2 = __commonJS({
87639
87642
  }
87640
87643
  path40 = parts.join("/");
87641
87644
  if (path40 === "") {
87642
- path40 = isAbsolute6 ? "/" : ".";
87645
+ path40 = isAbsolute7 ? "/" : ".";
87643
87646
  }
87644
87647
  if (url2) {
87645
87648
  url2.path = path40;
@@ -95379,10 +95382,10 @@ var require_resolve_block_map = __commonJS({
95379
95382
  let offset = bm.offset;
95380
95383
  let commentEnd = null;
95381
95384
  for (const collItem of bm.items) {
95382
- const { start: start2, key, sep: sep6, value } = collItem;
95385
+ const { start: start2, key, sep: sep7, value } = collItem;
95383
95386
  const keyProps = resolveProps.resolveProps(start2, {
95384
95387
  indicator: "explicit-key-ind",
95385
- next: key ?? sep6?.[0],
95388
+ next: key ?? sep7?.[0],
95386
95389
  offset,
95387
95390
  onError,
95388
95391
  parentIndent: bm.indent,
@@ -95396,7 +95399,7 @@ var require_resolve_block_map = __commonJS({
95396
95399
  else if ("indent" in key && key.indent !== bm.indent)
95397
95400
  onError(offset, "BAD_INDENT", startColMsg);
95398
95401
  }
95399
- if (!keyProps.anchor && !keyProps.tag && !sep6) {
95402
+ if (!keyProps.anchor && !keyProps.tag && !sep7) {
95400
95403
  commentEnd = keyProps.end;
95401
95404
  if (keyProps.comment) {
95402
95405
  if (map2.comment)
@@ -95420,7 +95423,7 @@ var require_resolve_block_map = __commonJS({
95420
95423
  ctx.atKey = false;
95421
95424
  if (utilMapIncludes.mapIncludes(ctx, map2.items, keyNode))
95422
95425
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
95423
- const valueProps = resolveProps.resolveProps(sep6 ?? [], {
95426
+ const valueProps = resolveProps.resolveProps(sep7 ?? [], {
95424
95427
  indicator: "map-value-ind",
95425
95428
  next: value,
95426
95429
  offset: keyNode.range[2],
@@ -95436,7 +95439,7 @@ var require_resolve_block_map = __commonJS({
95436
95439
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
95437
95440
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
95438
95441
  }
95439
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep6, null, valueProps, onError);
95442
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep7, null, valueProps, onError);
95440
95443
  if (ctx.schema.compat)
95441
95444
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
95442
95445
  offset = valueNode.range[2];
@@ -95527,7 +95530,7 @@ var require_resolve_end = __commonJS({
95527
95530
  let comment = "";
95528
95531
  if (end) {
95529
95532
  let hasSpace = false;
95530
- let sep6 = "";
95533
+ let sep7 = "";
95531
95534
  for (const token of end) {
95532
95535
  const { source, type } = token;
95533
95536
  switch (type) {
@@ -95541,13 +95544,13 @@ var require_resolve_end = __commonJS({
95541
95544
  if (!comment)
95542
95545
  comment = cb;
95543
95546
  else
95544
- comment += sep6 + cb;
95545
- sep6 = "";
95547
+ comment += sep7 + cb;
95548
+ sep7 = "";
95546
95549
  break;
95547
95550
  }
95548
95551
  case "newline":
95549
95552
  if (comment)
95550
- sep6 += source;
95553
+ sep7 += source;
95551
95554
  hasSpace = true;
95552
95555
  break;
95553
95556
  default:
@@ -95590,18 +95593,18 @@ var require_resolve_flow_collection = __commonJS({
95590
95593
  let offset = fc.offset + fc.start.source.length;
95591
95594
  for (let i = 0; i < fc.items.length; ++i) {
95592
95595
  const collItem = fc.items[i];
95593
- const { start: start2, key, sep: sep6, value } = collItem;
95596
+ const { start: start2, key, sep: sep7, value } = collItem;
95594
95597
  const props = resolveProps.resolveProps(start2, {
95595
95598
  flow: fcName,
95596
95599
  indicator: "explicit-key-ind",
95597
- next: key ?? sep6?.[0],
95600
+ next: key ?? sep7?.[0],
95598
95601
  offset,
95599
95602
  onError,
95600
95603
  parentIndent: fc.indent,
95601
95604
  startOnNewline: false
95602
95605
  });
95603
95606
  if (!props.found) {
95604
- if (!props.anchor && !props.tag && !sep6 && !value) {
95607
+ if (!props.anchor && !props.tag && !sep7 && !value) {
95605
95608
  if (i === 0 && props.comma)
95606
95609
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
95607
95610
  else if (i < fc.items.length - 1)
@@ -95655,8 +95658,8 @@ var require_resolve_flow_collection = __commonJS({
95655
95658
  }
95656
95659
  }
95657
95660
  }
95658
- if (!isMap && !sep6 && !props.found) {
95659
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep6, null, props, onError);
95661
+ if (!isMap && !sep7 && !props.found) {
95662
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep7, null, props, onError);
95660
95663
  coll.items.push(valueNode);
95661
95664
  offset = valueNode.range[2];
95662
95665
  if (isBlock(value))
@@ -95668,7 +95671,7 @@ var require_resolve_flow_collection = __commonJS({
95668
95671
  if (isBlock(key))
95669
95672
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
95670
95673
  ctx.atKey = false;
95671
- const valueProps = resolveProps.resolveProps(sep6 ?? [], {
95674
+ const valueProps = resolveProps.resolveProps(sep7 ?? [], {
95672
95675
  flow: fcName,
95673
95676
  indicator: "map-value-ind",
95674
95677
  next: value,
@@ -95679,8 +95682,8 @@ var require_resolve_flow_collection = __commonJS({
95679
95682
  });
95680
95683
  if (valueProps.found) {
95681
95684
  if (!isMap && !props.found && ctx.options.strict) {
95682
- if (sep6)
95683
- for (const st of sep6) {
95685
+ if (sep7)
95686
+ for (const st of sep7) {
95684
95687
  if (st === valueProps.found)
95685
95688
  break;
95686
95689
  if (st.type === "newline") {
@@ -95697,7 +95700,7 @@ var require_resolve_flow_collection = __commonJS({
95697
95700
  else
95698
95701
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
95699
95702
  }
95700
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep6, null, valueProps, onError) : null;
95703
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep7, null, valueProps, onError) : null;
95701
95704
  if (valueNode) {
95702
95705
  if (isBlock(value))
95703
95706
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -95877,7 +95880,7 @@ var require_resolve_block_scalar = __commonJS({
95877
95880
  chompStart = i + 1;
95878
95881
  }
95879
95882
  let value = "";
95880
- let sep6 = "";
95883
+ let sep7 = "";
95881
95884
  let prevMoreIndented = false;
95882
95885
  for (let i = 0; i < contentStart; ++i)
95883
95886
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -95894,24 +95897,24 @@ var require_resolve_block_scalar = __commonJS({
95894
95897
  indent = "";
95895
95898
  }
95896
95899
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
95897
- value += sep6 + indent.slice(trimIndent) + content;
95898
- sep6 = "\n";
95900
+ value += sep7 + indent.slice(trimIndent) + content;
95901
+ sep7 = "\n";
95899
95902
  } else if (indent.length > trimIndent || content[0] === " ") {
95900
- if (sep6 === " ")
95901
- sep6 = "\n";
95902
- else if (!prevMoreIndented && sep6 === "\n")
95903
- sep6 = "\n\n";
95904
- value += sep6 + indent.slice(trimIndent) + content;
95905
- sep6 = "\n";
95903
+ if (sep7 === " ")
95904
+ sep7 = "\n";
95905
+ else if (!prevMoreIndented && sep7 === "\n")
95906
+ sep7 = "\n\n";
95907
+ value += sep7 + indent.slice(trimIndent) + content;
95908
+ sep7 = "\n";
95906
95909
  prevMoreIndented = true;
95907
95910
  } else if (content === "") {
95908
- if (sep6 === "\n")
95911
+ if (sep7 === "\n")
95909
95912
  value += "\n";
95910
95913
  else
95911
- sep6 = "\n";
95914
+ sep7 = "\n";
95912
95915
  } else {
95913
- value += sep6 + content;
95914
- sep6 = " ";
95916
+ value += sep7 + content;
95917
+ sep7 = " ";
95915
95918
  prevMoreIndented = false;
95916
95919
  }
95917
95920
  }
@@ -96093,25 +96096,25 @@ var require_resolve_flow_scalar = __commonJS({
96093
96096
  if (!match)
96094
96097
  return source;
96095
96098
  let res = match[1];
96096
- let sep6 = " ";
96099
+ let sep7 = " ";
96097
96100
  let pos = first.lastIndex;
96098
96101
  line.lastIndex = pos;
96099
96102
  while (match = line.exec(source)) {
96100
96103
  if (match[1] === "") {
96101
- if (sep6 === "\n")
96102
- res += sep6;
96104
+ if (sep7 === "\n")
96105
+ res += sep7;
96103
96106
  else
96104
- sep6 = "\n";
96107
+ sep7 = "\n";
96105
96108
  } else {
96106
- res += sep6 + match[1];
96107
- sep6 = " ";
96109
+ res += sep7 + match[1];
96110
+ sep7 = " ";
96108
96111
  }
96109
96112
  pos = line.lastIndex;
96110
96113
  }
96111
96114
  const last = /[ \t]*(.*)/sy;
96112
96115
  last.lastIndex = pos;
96113
96116
  match = last.exec(source);
96114
- return res + sep6 + (match?.[1] ?? "");
96117
+ return res + sep7 + (match?.[1] ?? "");
96115
96118
  }
96116
96119
  function doubleQuotedValue(source, onError) {
96117
96120
  let res = "";
@@ -96921,14 +96924,14 @@ var require_cst_stringify = __commonJS({
96921
96924
  }
96922
96925
  }
96923
96926
  }
96924
- function stringifyItem({ start: start2, key, sep: sep6, value }) {
96927
+ function stringifyItem({ start: start2, key, sep: sep7, value }) {
96925
96928
  let res = "";
96926
96929
  for (const st of start2)
96927
96930
  res += st.source;
96928
96931
  if (key)
96929
96932
  res += stringifyToken(key);
96930
- if (sep6)
96931
- for (const st of sep6)
96933
+ if (sep7)
96934
+ for (const st of sep7)
96932
96935
  res += st.source;
96933
96936
  if (value)
96934
96937
  res += stringifyToken(value);
@@ -98095,18 +98098,18 @@ var require_parser2 = __commonJS({
98095
98098
  if (this.type === "map-value-ind") {
98096
98099
  const prev = getPrevProps(this.peek(2));
98097
98100
  const start2 = getFirstKeyStartProps(prev);
98098
- let sep6;
98101
+ let sep7;
98099
98102
  if (scalar.end) {
98100
- sep6 = scalar.end;
98101
- sep6.push(this.sourceToken);
98103
+ sep7 = scalar.end;
98104
+ sep7.push(this.sourceToken);
98102
98105
  delete scalar.end;
98103
98106
  } else
98104
- sep6 = [this.sourceToken];
98107
+ sep7 = [this.sourceToken];
98105
98108
  const map2 = {
98106
98109
  type: "block-map",
98107
98110
  offset: scalar.offset,
98108
98111
  indent: scalar.indent,
98109
- items: [{ start: start2, key: scalar, sep: sep6 }]
98112
+ items: [{ start: start2, key: scalar, sep: sep7 }]
98110
98113
  };
98111
98114
  this.onKeyLine = true;
98112
98115
  this.stack[this.stack.length - 1] = map2;
@@ -98259,15 +98262,15 @@ var require_parser2 = __commonJS({
98259
98262
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
98260
98263
  const start3 = getFirstKeyStartProps(it.start);
98261
98264
  const key = it.key;
98262
- const sep6 = it.sep;
98263
- sep6.push(this.sourceToken);
98265
+ const sep7 = it.sep;
98266
+ sep7.push(this.sourceToken);
98264
98267
  delete it.key;
98265
98268
  delete it.sep;
98266
98269
  this.stack.push({
98267
98270
  type: "block-map",
98268
98271
  offset: this.offset,
98269
98272
  indent: this.indent,
98270
- items: [{ start: start3, key, sep: sep6 }]
98273
+ items: [{ start: start3, key, sep: sep7 }]
98271
98274
  });
98272
98275
  } else if (start2.length > 0) {
98273
98276
  it.sep = it.sep.concat(start2, this.sourceToken);
@@ -98461,13 +98464,13 @@ var require_parser2 = __commonJS({
98461
98464
  const prev = getPrevProps(parent);
98462
98465
  const start2 = getFirstKeyStartProps(prev);
98463
98466
  fixFlowSeqItems(fc);
98464
- const sep6 = fc.end.splice(1, fc.end.length);
98465
- sep6.push(this.sourceToken);
98467
+ const sep7 = fc.end.splice(1, fc.end.length);
98468
+ sep7.push(this.sourceToken);
98466
98469
  const map2 = {
98467
98470
  type: "block-map",
98468
98471
  offset: fc.offset,
98469
98472
  indent: fc.indent,
98470
- items: [{ start: start2, key: fc, sep: sep6 }]
98473
+ items: [{ start: start2, key: fc, sep: sep7 }]
98471
98474
  };
98472
98475
  this.onKeyLine = true;
98473
98476
  this.stack[this.stack.length - 1] = map2;
@@ -101730,14 +101733,14 @@ async function addSourceContext(frames) {
101730
101733
  return frames;
101731
101734
  }
101732
101735
  function getContextLinesFromFile(path40, ranges, output) {
101733
- return new Promise((resolve9) => {
101736
+ return new Promise((resolve10) => {
101734
101737
  const stream = (0, import_node_fs.createReadStream)(path40);
101735
101738
  const lineReaded = (0, import_node_readline.createInterface)({
101736
101739
  input: stream
101737
101740
  });
101738
101741
  function destroyStreamAndResolve() {
101739
101742
  stream.destroy();
101740
- resolve9();
101743
+ resolve10();
101741
101744
  }
101742
101745
  let lineNumber = 0;
101743
101746
  let currentRangeIndex = 0;
@@ -103034,9 +103037,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
103034
103037
  if (!waitUntil) return;
103035
103038
  if (this.disabled || this.optedOut) return;
103036
103039
  if (!this._waitUntilCycle) {
103037
- let resolve9;
103040
+ let resolve10;
103038
103041
  const promise2 = new Promise((r) => {
103039
- resolve9 = r;
103042
+ resolve10 = r;
103040
103043
  });
103041
103044
  try {
103042
103045
  waitUntil(promise2);
@@ -103044,7 +103047,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
103044
103047
  return;
103045
103048
  }
103046
103049
  this._waitUntilCycle = {
103047
- resolve: resolve9,
103050
+ resolve: resolve10,
103048
103051
  startedAt: Date.now(),
103049
103052
  timer: void 0
103050
103053
  };
@@ -103068,12 +103071,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
103068
103071
  return cycle?.resolve;
103069
103072
  }
103070
103073
  async resolveWaitUntilFlush() {
103071
- const resolve9 = this._consumeWaitUntilCycle();
103074
+ const resolve10 = this._consumeWaitUntilCycle();
103072
103075
  try {
103073
103076
  await super.flush();
103074
103077
  } catch {
103075
103078
  } finally {
103076
- resolve9?.();
103079
+ resolve10?.();
103077
103080
  }
103078
103081
  }
103079
103082
  getPersistedProperty(key) {
@@ -103194,15 +103197,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
103194
103197
  async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
103195
103198
  if (this.isLocalEvaluationReady()) return true;
103196
103199
  if (void 0 === this.featureFlagsPoller) return false;
103197
- return new Promise((resolve9) => {
103200
+ return new Promise((resolve10) => {
103198
103201
  const timeout = setTimeout(() => {
103199
103202
  cleanup();
103200
- resolve9(false);
103203
+ resolve10(false);
103201
103204
  }, timeoutMs);
103202
103205
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count2) => {
103203
103206
  clearTimeout(timeout);
103204
103207
  cleanup();
103205
- resolve9(count2 > 0);
103208
+ resolve10(count2 > 0);
103206
103209
  });
103207
103210
  });
103208
103211
  }
@@ -103657,14 +103660,14 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
103657
103660
  this.context?.enter(data, options);
103658
103661
  }
103659
103662
  async _shutdown(shutdownTimeoutMs) {
103660
- const resolve9 = this._consumeWaitUntilCycle();
103663
+ const resolve10 = this._consumeWaitUntilCycle();
103661
103664
  await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
103662
103665
  this.errorTracking.shutdown();
103663
103666
  try {
103664
103667
  return await super._shutdown(shutdownTimeoutMs);
103665
103668
  } finally {
103666
103669
  this.distinctIdHasSentFlagCalls = {};
103667
- resolve9?.();
103670
+ resolve10?.();
103668
103671
  }
103669
103672
  }
103670
103673
  async _requestRemoteConfigPayload(flagKey) {
@@ -105202,12 +105205,12 @@ function resolveHostFingerprint() {
105202
105205
  }
105203
105206
  }
105204
105207
  function resolveHostFingerprintAsync() {
105205
- return new Promise((resolve9) => {
105208
+ return new Promise((resolve10) => {
105206
105209
  let binary;
105207
105210
  try {
105208
105211
  binary = simulatorServerBinaryPath();
105209
105212
  } catch {
105210
- resolve9(null);
105213
+ resolve10(null);
105211
105214
  return;
105212
105215
  }
105213
105216
  let settled = false;
@@ -105220,7 +105223,7 @@ function resolveHostFingerprintAsync() {
105220
105223
  child?.kill("SIGKILL");
105221
105224
  } catch {
105222
105225
  }
105223
- resolve9(value);
105226
+ resolve10(value);
105224
105227
  };
105225
105228
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
105226
105229
  watchdog.unref?.();
@@ -105604,7 +105607,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
105604
105607
  try {
105605
105608
  await Promise.race([
105606
105609
  client2.shutdown(timeoutMs),
105607
- new Promise((resolve9) => setTimeout(resolve9, timeoutMs + 250).unref())
105610
+ new Promise((resolve10) => setTimeout(resolve10, timeoutMs + 250).unref())
105608
105611
  ]);
105609
105612
  } catch (err) {
105610
105613
  emitDebugError("shutdown failed", err);
@@ -105897,7 +105900,7 @@ async function runVega(args, options = {}) {
105897
105900
  const vegaPath = await resolveVegaOrThrow();
105898
105901
  const timeoutMs = options.timeoutMs ?? 6e4;
105899
105902
  const maxOutputBytes = options.maxOutputBytes ?? VEGA_MAX_OUTPUT_BYTES;
105900
- return new Promise((resolve9, reject) => {
105903
+ return new Promise((resolve10, reject) => {
105901
105904
  let child;
105902
105905
  try {
105903
105906
  child = (0, import_node_child_process4.spawn)(vegaPath, args, {
@@ -105987,7 +105990,7 @@ async function runVega(args, options = {}) {
105987
105990
  });
105988
105991
  const finish = (code, signal) => {
105989
105992
  if (code === 0) {
105990
- settle(() => resolve9({ stdout, stderr }));
105993
+ settle(() => resolve10({ stdout, stderr }));
105991
105994
  } else {
105992
105995
  settle(
105993
105996
  () => reject(
@@ -106936,7 +106939,7 @@ function getSocketPath(udid) {
106936
106939
  return `/tmp/ax-${udid.slice(0, 8)}.sock`;
106937
106940
  }
106938
106941
  function startListener(endpoint, onConnection) {
106939
- return new Promise((resolve9, reject) => {
106942
+ return new Promise((resolve10, reject) => {
106940
106943
  if (endpoint.transport === "unix") {
106941
106944
  try {
106942
106945
  fs12.unlinkSync(endpoint.socketPath);
@@ -106956,7 +106959,7 @@ function startListener(endpoint, onConnection) {
106956
106959
  }
106957
106960
  endpoint.port = addr.port;
106958
106961
  }
106959
- resolve9(server);
106962
+ resolve10(server);
106960
106963
  };
106961
106964
  if (endpoint.transport === "tcp") {
106962
106965
  server.listen(endpoint.port ?? 0, "127.0.0.1", onListening);
@@ -106966,13 +106969,13 @@ function startListener(endpoint, onConnection) {
106966
106969
  });
106967
106970
  }
106968
106971
  function waitForDaemonConnection(server, proc, timeoutMs) {
106969
- return new Promise((resolve9, reject) => {
106972
+ return new Promise((resolve10, reject) => {
106970
106973
  let settled = false;
106971
106974
  const onConnection = (socket) => {
106972
106975
  if (settled) return;
106973
106976
  settled = true;
106974
106977
  cleanup();
106975
- resolve9(socket);
106978
+ resolve10(socket);
106976
106979
  };
106977
106980
  const onExit = (code) => {
106978
106981
  if (settled) return;
@@ -107186,7 +107189,7 @@ var axServiceBlueprint = {
107186
107189
  throw err;
107187
107190
  }
107188
107191
  function query(command, timeoutMs = 5e3) {
107189
- return new Promise((resolve9, reject) => {
107192
+ return new Promise((resolve10, reject) => {
107190
107193
  if (!daemonSocket || daemonSocket.destroyed) {
107191
107194
  reject(
107192
107195
  new FailureError("ax-service not connected", {
@@ -107212,7 +107215,7 @@ var axServiceBlueprint = {
107212
107215
  );
107213
107216
  }
107214
107217
  }, timeoutMs);
107215
- pendingRpc.set(id, { resolve: resolve9, reject, timer });
107218
+ pendingRpc.set(id, { resolve: resolve10, reject, timer });
107216
107219
  daemonSocket.write(JSON.stringify({ id, command }) + "\n");
107217
107220
  });
107218
107221
  }
@@ -107481,8 +107484,8 @@ var Signal = class _Signal {
107481
107484
  }
107482
107485
  /** Resolves with the next value, once the signal changes. */
107483
107486
  next() {
107484
- return new Promise((resolve9) => {
107485
- this.changed(resolve9);
107487
+ return new Promise((resolve10) => {
107488
+ this.changed(resolve10);
107486
107489
  });
107487
107490
  }
107488
107491
  /** Calls `fn` with the current value now, and again every time it changes. */
@@ -107494,9 +107497,9 @@ var Signal = class _Signal {
107494
107497
  /** Resolves with the next value from whichever of the given signals changes first. */
107495
107498
  static async race(...sigs) {
107496
107499
  const dispose = [];
107497
- const result = await new Promise((resolve9) => {
107500
+ const result = await new Promise((resolve10) => {
107498
107501
  for (const sig of sigs) {
107499
- dispose.push(sig.changed(resolve9));
107502
+ dispose.push(sig.changed(resolve10));
107500
107503
  }
107501
107504
  });
107502
107505
  for (const fn of dispose)
@@ -107559,12 +107562,12 @@ ${debugInfo}`);
107559
107562
  if (this.#async.length > 0) {
107560
107563
  try {
107561
107564
  let warn;
107562
- const timeout = new Promise((resolve9) => {
107565
+ const timeout = new Promise((resolve10) => {
107563
107566
  warn = setTimeout(() => {
107564
107567
  if (DEV) {
107565
107568
  console.warn("spawn is still running after 5s; continuing anyway", this.#stack);
107566
107569
  }
107567
- resolve9();
107570
+ resolve10();
107568
107571
  }, 5e3);
107569
107572
  });
107570
107573
  await Promise.race([Promise.all(this.#async), timeout]);
@@ -107867,11 +107870,11 @@ var Announced = class {
107867
107870
  closed;
107868
107871
  constructor(prefix = empty()) {
107869
107872
  this.prefix = prefix;
107870
- this.closed = new Promise((resolve9) => {
107873
+ this.closed = new Promise((resolve10) => {
107871
107874
  const dispose = this.state.closed.subscribe((closed) => {
107872
107875
  if (!closed)
107873
107876
  return;
107874
- resolve9(closed instanceof Error ? closed : void 0);
107877
+ resolve10(closed instanceof Error ? closed : void 0);
107875
107878
  dispose();
107876
107879
  });
107877
107880
  });
@@ -107937,11 +107940,11 @@ var Group = class {
107937
107940
  closed;
107938
107941
  constructor(sequence) {
107939
107942
  this.sequence = sequence;
107940
- this.closed = new Promise((resolve9) => {
107943
+ this.closed = new Promise((resolve10) => {
107941
107944
  const dispose = this.#state.closed.subscribe((closed) => {
107942
107945
  if (!closed)
107943
107946
  return;
107944
- resolve9(closed instanceof Error ? closed : void 0);
107947
+ resolve10(closed instanceof Error ? closed : void 0);
107945
107948
  dispose();
107946
107949
  });
107947
107950
  });
@@ -108069,11 +108072,11 @@ var Track = class {
108069
108072
  closed;
108070
108073
  constructor(name) {
108071
108074
  this.name = name;
108072
- this.closed = new Promise((resolve9) => {
108075
+ this.closed = new Promise((resolve10) => {
108073
108076
  const dispose = this.state.closed.subscribe((closed) => {
108074
108077
  if (!closed)
108075
108078
  return;
108076
- resolve9(closed instanceof Error ? closed : void 0);
108079
+ resolve10(closed instanceof Error ? closed : void 0);
108077
108080
  dispose();
108078
108081
  });
108079
108082
  });
@@ -108276,11 +108279,11 @@ var Broadcast = class {
108276
108279
  /** Resolves with the abort error (or undefined) once closed. */
108277
108280
  closed;
108278
108281
  constructor() {
108279
- this.closed = new Promise((resolve9) => {
108282
+ this.closed = new Promise((resolve10) => {
108280
108283
  const dispose = this.state.closed.subscribe((closed) => {
108281
108284
  if (!closed)
108282
108285
  return;
108283
- resolve9(closed instanceof Error ? closed : void 0);
108286
+ resolve10(closed instanceof Error ? closed : void 0);
108284
108287
  dispose();
108285
108288
  });
108286
108289
  });
@@ -108346,11 +108349,11 @@ var E_ALREADY_LOCKED = new Error("mutex already locked");
108346
108349
  var E_CANCELED = new Error("request for lock canceled");
108347
108350
  var __awaiter$2 = function(thisArg, _arguments, P, generator) {
108348
108351
  function adopt(value) {
108349
- return value instanceof P ? value : new P(function(resolve9) {
108350
- resolve9(value);
108352
+ return value instanceof P ? value : new P(function(resolve10) {
108353
+ resolve10(value);
108351
108354
  });
108352
108355
  }
108353
- return new (P || (P = Promise))(function(resolve9, reject) {
108356
+ return new (P || (P = Promise))(function(resolve10, reject) {
108354
108357
  function fulfilled(value) {
108355
108358
  try {
108356
108359
  step(generator.next(value));
@@ -108366,7 +108369,7 @@ var __awaiter$2 = function(thisArg, _arguments, P, generator) {
108366
108369
  }
108367
108370
  }
108368
108371
  function step(result) {
108369
- result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
108372
+ result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
108370
108373
  }
108371
108374
  step((generator = generator.apply(thisArg, _arguments || [])).next());
108372
108375
  });
@@ -108381,8 +108384,8 @@ var Semaphore = class {
108381
108384
  acquire(weight = 1, priority = 0) {
108382
108385
  if (weight <= 0)
108383
108386
  throw new Error(`invalid weight ${weight}: must be positive`);
108384
- return new Promise((resolve9, reject) => {
108385
- const task = { resolve: resolve9, reject, weight, priority };
108387
+ return new Promise((resolve10, reject) => {
108388
+ const task = { resolve: resolve10, reject, weight, priority };
108386
108389
  const i = findIndexFromEnd(this._queue, (other) => priority <= other.priority);
108387
108390
  if (i === -1 && weight <= this._value) {
108388
108391
  this._dispatchItem(task);
@@ -108407,10 +108410,10 @@ var Semaphore = class {
108407
108410
  if (this._couldLockImmediately(weight, priority)) {
108408
108411
  return Promise.resolve();
108409
108412
  } else {
108410
- return new Promise((resolve9) => {
108413
+ return new Promise((resolve10) => {
108411
108414
  if (!this._weightedWaiters[weight - 1])
108412
108415
  this._weightedWaiters[weight - 1] = [];
108413
- insertSorted(this._weightedWaiters[weight - 1], { resolve: resolve9, priority });
108416
+ insertSorted(this._weightedWaiters[weight - 1], { resolve: resolve10, priority });
108414
108417
  });
108415
108418
  }
108416
108419
  }
@@ -108493,11 +108496,11 @@ function findIndexFromEnd(a, predicate) {
108493
108496
  }
108494
108497
  var __awaiter$1 = function(thisArg, _arguments, P, generator) {
108495
108498
  function adopt(value) {
108496
- return value instanceof P ? value : new P(function(resolve9) {
108497
- resolve9(value);
108499
+ return value instanceof P ? value : new P(function(resolve10) {
108500
+ resolve10(value);
108498
108501
  });
108499
108502
  }
108500
- return new (P || (P = Promise))(function(resolve9, reject) {
108503
+ return new (P || (P = Promise))(function(resolve10, reject) {
108501
108504
  function fulfilled(value) {
108502
108505
  try {
108503
108506
  step(generator.next(value));
@@ -108513,7 +108516,7 @@ var __awaiter$1 = function(thisArg, _arguments, P, generator) {
108513
108516
  }
108514
108517
  }
108515
108518
  function step(result) {
108516
- result.done ? resolve9(result.value) : adopt(result.value).then(fulfilled, rejected);
108519
+ result.done ? resolve10(result.value) : adopt(result.value).then(fulfilled, rejected);
108517
108520
  }
108518
108521
  step((generator = generator.apply(thisArg, _arguments || [])).next());
108519
108522
  });
@@ -108632,8 +108635,8 @@ var ControlStreamAdapter = class {
108632
108635
  const queued = this.#incomingQueue.shift();
108633
108636
  if (queued)
108634
108637
  return queued;
108635
- return new Promise((resolve9) => {
108636
- this.#incomingWaiters.push(resolve9);
108638
+ return new Promise((resolve10) => {
108639
+ this.#incomingWaiters.push(resolve10);
108637
108640
  });
108638
108641
  }
108639
108642
  /**
@@ -108704,8 +108707,8 @@ var ControlStreamAdapter = class {
108704
108707
  this.#requestId += 2n;
108705
108708
  return id;
108706
108709
  }
108707
- await new Promise((resolve9) => {
108708
- this.#maxRequestIdResolves.push(resolve9);
108710
+ await new Promise((resolve10) => {
108711
+ this.#maxRequestIdResolves.push(resolve10);
108709
108712
  });
108710
108713
  }
108711
108714
  }
@@ -108750,8 +108753,8 @@ var ControlStreamAdapter = class {
108750
108753
  break;
108751
108754
  case Route.MaxRequestId:
108752
108755
  this.#maxRequestId = requestId;
108753
- for (const resolve9 of this.#maxRequestIdResolves)
108754
- resolve9();
108756
+ for (const resolve10 of this.#maxRequestIdResolves)
108757
+ resolve10();
108755
108758
  this.#maxRequestIdResolves = [];
108756
108759
  break;
108757
108760
  }
@@ -109109,8 +109112,8 @@ var ControlStreamAdapter = class {
109109
109112
  this.#namespaces.clear();
109110
109113
  this.#namespacesByRequestId.clear();
109111
109114
  this.#subscribeNamespaces.clear();
109112
- for (const resolve9 of this.#maxRequestIdResolves)
109113
- resolve9();
109115
+ for (const resolve10 of this.#maxRequestIdResolves)
109116
+ resolve10();
109114
109117
  this.#maxRequestIdResolves = [];
109115
109118
  }
109116
109119
  };
@@ -111528,8 +111531,8 @@ var Publisher2 = class {
111528
111531
  }
111529
111532
  for (; ; ) {
111530
111533
  let dispose;
111531
- const changed = new Promise((resolve9) => {
111532
- dispose = this.#broadcasts.changed(resolve9);
111534
+ const changed = new Promise((resolve10) => {
111535
+ dispose = this.#broadcasts.changed(resolve10);
111533
111536
  });
111534
111537
  const broadcasts2 = await Promise.race([changed, stream.reader.closed]);
111535
111538
  dispose();
@@ -111675,7 +111678,7 @@ var Publisher2 = class {
111675
111678
  let lastSentTime;
111676
111679
  try {
111677
111680
  for (; ; ) {
111678
- const timeout = new Promise((resolve9) => setTimeout(() => resolve9("timeout"), PROBE_INTERVAL));
111681
+ const timeout = new Promise((resolve10) => setTimeout(() => resolve10("timeout"), PROBE_INTERVAL));
111679
111682
  const result = await Promise.race([timeout, stream.reader.closed]);
111680
111683
  if (result !== "timeout")
111681
111684
  break;
@@ -112177,19 +112180,19 @@ var Connection2 = class {
112177
112180
  }
112178
112181
  async #runSendBandwidth(bandwidth) {
112179
112182
  const quic = this.#quic;
112180
- return new Promise((resolve9) => {
112183
+ return new Promise((resolve10) => {
112181
112184
  const id = setInterval(async () => {
112182
112185
  try {
112183
112186
  const stats = await quic.getStats();
112184
112187
  bandwidth.set(stats.estimatedSendRate ?? void 0);
112185
112188
  } catch {
112186
112189
  clearInterval(id);
112187
- resolve9();
112190
+ resolve10();
112188
112191
  }
112189
112192
  }, SEND_BW_POLL_INTERVAL);
112190
112193
  void this.closed.then(() => {
112191
112194
  clearInterval(id);
112192
- resolve9();
112195
+ resolve10();
112193
112196
  });
112194
112197
  });
112195
112198
  }
@@ -112376,8 +112379,8 @@ var Credit = class {
112376
112379
  const claimed = this.tryClaim(limit);
112377
112380
  if (claimed > 0n)
112378
112381
  return claimed;
112379
- await new Promise((resolve9, reject) => {
112380
- this.#waiters.push({ resolve: resolve9, reject });
112382
+ await new Promise((resolve10, reject) => {
112383
+ this.#waiters.push({ resolve: resolve10, reject });
112381
112384
  });
112382
112385
  }
112383
112386
  }
@@ -112442,8 +112445,8 @@ var Credit = class {
112442
112445
  #wake() {
112443
112446
  const waiters = this.#waiters;
112444
112447
  this.#waiters = [];
112445
- for (const { resolve: resolve9 } of waiters)
112446
- resolve9();
112448
+ for (const { resolve: resolve10 } of waiters)
112449
+ resolve10();
112447
112450
  }
112448
112451
  };
112449
112452
 
@@ -113492,7 +113495,7 @@ var Session = class _Session {
113492
113495
  }
113493
113496
  async #sendFrame(frame) {
113494
113497
  while (this.#ws.bufferedAmount > 64 * 1024) {
113495
- await new Promise((resolve9) => setTimeout(resolve9, 10));
113498
+ await new Promise((resolve10) => setTimeout(resolve10, 10));
113496
113499
  }
113497
113500
  const chunk = encode7(frame, this.#version);
113498
113501
  this.#ws.send(chunk);
@@ -113908,7 +113911,7 @@ async function connectWebTransport(url2, cancel, options) {
113908
113911
  return quic;
113909
113912
  }
113910
113913
  async function connectWebSocket(url2, delay2, cancel) {
113911
- const timer = new Promise((resolve9) => setTimeout(resolve9, delay2));
113914
+ const timer = new Promise((resolve10) => setTimeout(resolve10, delay2));
113912
113915
  const active = await Promise.race([cancel, timer.then(() => true)]);
113913
113916
  if (!active)
113914
113917
  return void 0;
@@ -113960,8 +113963,8 @@ var Reload = class {
113960
113963
  this.webtransport = props?.webtransport;
113961
113964
  this.websocket = props?.websocket;
113962
113965
  this.#delay = this.delay.initial;
113963
- this.closed = new Promise((resolve9, reject) => {
113964
- this.#closedResolve = resolve9;
113966
+ this.closed = new Promise((resolve10, reject) => {
113967
+ this.#closedResolve = resolve10;
113965
113968
  this.#closedReject = reject;
113966
113969
  });
113967
113970
  this.signals.run(this.#connect.bind(this));
@@ -114336,28 +114339,28 @@ init_src();
114336
114339
  var sleep = (ms) => new Promise((r) => setTimeout(r, ms));
114337
114340
  var DEFAULT_INTER_STEP_DELAY_MS = 100;
114338
114341
  function sleepOrAbort(ms, signal) {
114339
- return new Promise((resolve9) => {
114340
- if (signal?.aborted) return resolve9(false);
114342
+ return new Promise((resolve10) => {
114343
+ if (signal?.aborted) return resolve10(false);
114341
114344
  const onAbort = () => {
114342
114345
  clearTimeout(timer);
114343
- resolve9(false);
114346
+ resolve10(false);
114344
114347
  };
114345
114348
  const timer = setTimeout(() => {
114346
114349
  signal?.removeEventListener("abort", onAbort);
114347
- resolve9(true);
114350
+ resolve10(true);
114348
114351
  }, ms);
114349
114352
  signal?.addEventListener("abort", onAbort, { once: true });
114350
114353
  });
114351
114354
  }
114352
114355
  function settleWithin(p, ms, signal) {
114353
- return new Promise((resolve9) => {
114356
+ return new Promise((resolve10) => {
114354
114357
  let done = false;
114355
114358
  const teardown = [];
114356
114359
  const finish = (r) => {
114357
114360
  if (done) return;
114358
114361
  done = true;
114359
114362
  for (const fn of teardown) fn();
114360
- resolve9(r);
114363
+ resolve10(r);
114361
114364
  };
114362
114365
  p.then(
114363
114366
  (value) => finish({ type: "value", value }),
@@ -114650,7 +114653,7 @@ async function spawnSimulatorServerProcess(udid, subcommand) {
114650
114653
  }
114651
114654
  const deviceSet = subcommand === "ios" ? await deviceSetForUdid(udid) : null;
114652
114655
  const { BINARY_PATH, BINARY_DIR } = getPaths();
114653
- return new Promise((resolve9, reject) => {
114656
+ return new Promise((resolve10, reject) => {
114654
114657
  const args = [subcommand, "--id", udid];
114655
114658
  if (deviceSet) args.push("--device-set", deviceSet);
114656
114659
  const proc = (0, import_node_child_process10.spawn)(BINARY_PATH, args, {
@@ -114674,7 +114677,7 @@ async function spawnSimulatorServerProcess(udid, subcommand) {
114674
114677
  };
114675
114678
  const resolveWhenReady = () => {
114676
114679
  if (apiUrl == null) return;
114677
- settle(() => resolve9({ proc, apiUrl, streamUrl }));
114680
+ settle(() => resolve10({ proc, apiUrl, streamUrl }));
114678
114681
  };
114679
114682
  rl.on("line", (rawLine) => {
114680
114683
  const line = rawLine.trim();
@@ -114976,7 +114979,7 @@ var CDPClient = class {
114976
114979
  this.sendOrigin = options?.sendOrigin !== false;
114977
114980
  }
114978
114981
  connect() {
114979
- return new Promise((resolve9, reject) => {
114982
+ return new Promise((resolve10, reject) => {
114980
114983
  let headers;
114981
114984
  if (this.sendOrigin) {
114982
114985
  const { protocol, host } = new URL(this.wsUrl);
@@ -114988,7 +114991,7 @@ var CDPClient = class {
114988
114991
  const onOpen = () => {
114989
114992
  cleanup();
114990
114993
  this.events.emit("connected");
114991
- resolve9();
114994
+ resolve10();
114992
114995
  };
114993
114996
  const onError = (err) => {
114994
114997
  cleanup();
@@ -115021,10 +115024,10 @@ var CDPClient = class {
115021
115024
  if (!this.ws) return;
115022
115025
  const ws = this.ws;
115023
115026
  this.ws = null;
115024
- return new Promise((resolve9) => {
115025
- ws.once("close", () => resolve9());
115027
+ return new Promise((resolve10) => {
115028
+ ws.once("close", () => resolve10());
115026
115029
  ws.close();
115027
- setTimeout(resolve9, 1e3);
115030
+ setTimeout(resolve10, 1e3);
115028
115031
  });
115029
115032
  }
115030
115033
  /**
@@ -115059,7 +115062,7 @@ var CDPClient = class {
115059
115062
  return this.ws?.readyState === wrapper_default.OPEN;
115060
115063
  }
115061
115064
  send(method, params, timeout = DEFAULT_TIMEOUT_MS2) {
115062
- return new Promise((resolve9, reject) => {
115065
+ return new Promise((resolve10, reject) => {
115063
115066
  if (!this.ws || this.ws.readyState !== wrapper_default.OPEN) {
115064
115067
  return reject(new Error("CDP not connected"));
115065
115068
  }
@@ -115071,7 +115074,7 @@ var CDPClient = class {
115071
115074
  this.pending.set(id, {
115072
115075
  resolve: (result) => {
115073
115076
  this.trackDomain(method);
115074
- resolve9(result);
115077
+ resolve10(result);
115075
115078
  },
115076
115079
  reject,
115077
115080
  timer
@@ -115122,7 +115125,7 @@ var CDPClient = class {
115122
115125
  )
115123
115126
  );
115124
115127
  }
115125
- return new Promise((resolve9, reject) => {
115128
+ return new Promise((resolve10, reject) => {
115126
115129
  const timer = setTimeout(() => {
115127
115130
  this.pendingBindings.delete(id);
115128
115131
  reject(
@@ -115134,7 +115137,7 @@ var CDPClient = class {
115134
115137
  })
115135
115138
  );
115136
115139
  }, timeout);
115137
- this.pendingBindings.set(id, { resolve: resolve9, reject, timer });
115140
+ this.pendingBindings.set(id, { resolve: resolve10, reject, timer });
115138
115141
  this.evaluate(expression, { timeout, returnByValue: false, awaitPromise: false }).catch(
115139
115142
  (err) => {
115140
115143
  this.pendingBindings.delete(id);
@@ -116558,11 +116561,11 @@ function parseVegaDeviceList(stdout) {
116558
116561
  const devices = [];
116559
116562
  for (const raw of stdout.split("\n")) {
116560
116563
  const line = raw.trim();
116561
- const sep6 = line.indexOf(" : ");
116562
- if (sep6 < 0) continue;
116563
- const type = line.slice(0, sep6).trim();
116564
+ const sep7 = line.indexOf(" : ");
116565
+ if (sep7 < 0) continue;
116566
+ const type = line.slice(0, sep7).trim();
116564
116567
  if (!/^[A-Za-z]+$/.test(type)) continue;
116565
- const rhs = line.slice(sep6 + 3).trim();
116568
+ const rhs = line.slice(sep7 + 3).trim();
116566
116569
  const parts = rhs.split(/\s+-\s+/);
116567
116570
  const serial = parts[parts.length - 1]?.trim();
116568
116571
  if (!serial) continue;
@@ -116733,13 +116736,13 @@ async function withDeadline(p, fallback, label) {
116733
116736
  try {
116734
116737
  return await Promise.race([
116735
116738
  p,
116736
- new Promise((resolve9) => {
116739
+ new Promise((resolve10) => {
116737
116740
  timer = setTimeout(() => {
116738
116741
  process.stderr.write(
116739
116742
  `[list-devices] ${label} discovery exceeded ${BRANCH_DEADLINE_MS}ms; returning partial results (a wedged device or its CLI is unresponsive)
116740
116743
  `
116741
116744
  );
116742
- resolve9(fallback);
116745
+ resolve10(fallback);
116743
116746
  }, BRANCH_DEADLINE_MS);
116744
116747
  })
116745
116748
  ]);
@@ -117267,7 +117270,7 @@ var VariantProposalStore = class {
117267
117270
  message: "No variants have been proposed yet. Call propose_variant first, then await_user_selection."
117268
117271
  });
117269
117272
  }
117270
- return new Promise((resolve9, reject) => {
117273
+ return new Promise((resolve10, reject) => {
117271
117274
  let done = false;
117272
117275
  const finish = (fn) => {
117273
117276
  if (done) return;
@@ -117282,7 +117285,7 @@ var VariantProposalStore = class {
117282
117285
  const waiter = {
117283
117286
  round: this.round,
117284
117287
  settled: false,
117285
- settle: (outcome) => finish(() => resolve9(outcome))
117288
+ settle: (outcome) => finish(() => resolve10(outcome))
117286
117289
  };
117287
117290
  const onAbort = () => {
117288
117291
  waiter.settled = true;
@@ -117295,7 +117298,7 @@ var VariantProposalStore = class {
117295
117298
  const timer = setTimeout(() => {
117296
117299
  waiter.settled = true;
117297
117300
  finish(
117298
- () => resolve9({
117301
+ () => resolve10({
117299
117302
  status: "pending",
117300
117303
  round: waiter.round,
117301
117304
  message: "User has not completed their selection yet. The proposals are still live in the preview window \u2014 call await_user_selection again to keep waiting (this is expected; it is not an error).",
@@ -117378,11 +117381,11 @@ function getNativeDevtoolsSocketPath(udid) {
117378
117381
  return `/tmp/argent-nd-${udid.slice(0, 8)}.sock`;
117379
117382
  }
117380
117383
  function bindNativeDevtoolsUnixSocket(server, socketPath) {
117381
- return new Promise((resolve9, reject) => {
117384
+ return new Promise((resolve10, reject) => {
117382
117385
  let retried = false;
117383
117386
  const onListening = () => {
117384
117387
  server.off("error", onError);
117385
- resolve9();
117388
+ resolve10();
117386
117389
  };
117387
117390
  const onError = (err) => {
117388
117391
  if ((err.code === "EADDRINUSE" || err.code === "EEXIST") && !retried) {
@@ -117506,8 +117509,8 @@ var nativeDevtoolsBlueprint = {
117506
117509
  );
117507
117510
  }
117508
117511
  const id = nextRpcId++;
117509
- return new Promise((resolve9, reject) => {
117510
- pendingRpc.set(id, { resolve: resolve9, reject });
117512
+ return new Promise((resolve10, reject) => {
117513
+ pendingRpc.set(id, { resolve: resolve10, reject });
117511
117514
  conn.socket.write(
117512
117515
  JSON.stringify({
117513
117516
  type: "ViewInspector",
@@ -117608,7 +117611,7 @@ var nativeDevtoolsBlueprint = {
117608
117611
  });
117609
117612
  });
117610
117613
  if (endpoint.transport === "tcp") {
117611
- await new Promise((resolve9, reject) => {
117614
+ await new Promise((resolve10, reject) => {
117612
117615
  server.once("error", reject);
117613
117616
  server.listen(endpoint.port ?? 0, "127.0.0.1", () => {
117614
117617
  server.off("error", reject);
@@ -117619,7 +117622,7 @@ var nativeDevtoolsBlueprint = {
117619
117622
  return;
117620
117623
  }
117621
117624
  endpoint.port = addr.port;
117622
- resolve9();
117625
+ resolve10();
117623
117626
  });
117624
117627
  });
117625
117628
  await host.startProxy(udid, endpoint.port);
@@ -118892,7 +118895,7 @@ init_src();
118892
118895
  var DEFAULT_RPC_TIMEOUT_MS = 5e3;
118893
118896
  var LONG_RPC_TIMEOUT_MS = 15e3;
118894
118897
  function connectAndroidDevtoolsClient(localPort, onTerminated) {
118895
- return new Promise((resolve9, reject) => {
118898
+ return new Promise((resolve10, reject) => {
118896
118899
  const socket = net3.createConnection({ host: "127.0.0.1", port: localPort });
118897
118900
  socket.setNoDelay(true);
118898
118901
  const pending = /* @__PURE__ */ new Map();
@@ -118951,7 +118954,7 @@ function connectAndroidDevtoolsClient(localPort, onTerminated) {
118951
118954
  }
118952
118955
  });
118953
118956
  rl.on("close", () => cleanup());
118954
- resolve9({
118957
+ resolve10({
118955
118958
  request(method, params = {}) {
118956
118959
  const send = () => {
118957
118960
  if (closed) {
@@ -119052,7 +119055,7 @@ async function spawnHelper(serial) {
119052
119055
  ["-s", serial, "shell", "am", "instrument", "-w", manifest.instrumentationRunner],
119053
119056
  { stdio: ["ignore", "pipe", "pipe"] }
119054
119057
  );
119055
- return new Promise((resolve9, reject) => {
119058
+ return new Promise((resolve10, reject) => {
119056
119059
  let devicePort = null;
119057
119060
  let localPort = null;
119058
119061
  let settled = false;
@@ -119085,7 +119088,7 @@ async function spawnHelper(serial) {
119085
119088
  });
119086
119089
  }
119087
119090
  localPort = parseInt(lpMatch[1], 10);
119088
- settle(() => resolve9({ proc, devicePort, localPort }));
119091
+ settle(() => resolve10({ proc, devicePort, localPort }));
119089
119092
  } catch (err) {
119090
119093
  settle(
119091
119094
  () => reject(err instanceof Error ? err : new Error(String(err))),
@@ -119939,32 +119942,28 @@ var MAX_UPLOAD_BYTES = 32 * 1024 * 1024;
119939
119942
  var FileInputError = class extends Error {
119940
119943
  };
119941
119944
  async function probeHostPath(wire, kind) {
119945
+ const miss = { present: false, statVerified: false };
119942
119946
  try {
119943
119947
  const st = await (0, import_promises8.stat)(wire.path);
119944
- if (kind === "directory") return st.isDirectory();
119945
- if (kind === "probe") return true;
119946
- if (kind === "tar-upload") {
119947
- if (st.isDirectory()) {
119948
- if (wire.mtimeMs != null && Math.round(st.mtimeMs) !== Math.round(wire.mtimeMs)) {
119949
- return false;
119950
- }
119951
- return true;
119952
- }
119953
- if (!st.isFile()) return false;
119954
- if (wire.size != null && st.size !== wire.size) return false;
119948
+ if (kind === "directory") return { present: st.isDirectory(), statVerified: false };
119949
+ if (kind === "probe") return { present: true, statVerified: false };
119950
+ if (kind === "tar-upload" && st.isDirectory()) {
119955
119951
  if (wire.mtimeMs != null && Math.round(st.mtimeMs) !== Math.round(wire.mtimeMs)) {
119956
- return false;
119952
+ return miss;
119957
119953
  }
119958
- return true;
119954
+ return { present: true, statVerified: false };
119959
119955
  }
119960
- if (!st.isFile()) return false;
119961
- if (wire.size != null && st.size !== wire.size) return false;
119962
- if (wire.mtimeMs != null && Math.round(st.mtimeMs) !== Math.round(wire.mtimeMs)) return false;
119963
- return true;
119956
+ if (!st.isFile()) return miss;
119957
+ if (wire.size != null && st.size !== wire.size) return miss;
119958
+ if (wire.mtimeMs != null && Math.round(st.mtimeMs) !== Math.round(wire.mtimeMs)) return miss;
119959
+ return { present: true, statVerified: wire.size != null && wire.mtimeMs != null };
119964
119960
  } catch {
119965
- return false;
119961
+ return miss;
119966
119962
  }
119967
119963
  }
119964
+ function isParamSet(value) {
119965
+ return value !== void 0;
119966
+ }
119968
119967
  function formatBytes(bytes) {
119969
119968
  if (bytes == null) return "unknown size";
119970
119969
  return (0, import_bytes.default)(bytes, { decimalPlaces: 1, unitSeparator: " " }) ?? `${bytes} B`;
@@ -120025,10 +120024,12 @@ async function extractTarUpload(wire, uploadId, meta3, tempDirs, lookupUpload) {
120025
120024
  }
120026
120025
  }
120027
120026
  async function resolveOne(spec, wire, tempDirs, lookupUpload) {
120027
+ const probe3 = await probeHostPath(wire, spec.kind);
120028
120028
  const meta3 = {
120029
120029
  clientPath: wire.path,
120030
- presentOnHost: await probeHostPath(wire, spec.kind),
120031
- viaUpload: false
120030
+ presentOnHost: probe3.present,
120031
+ viaUpload: false,
120032
+ ...probe3.statVerified ? { statVerified: true } : {}
120032
120033
  };
120033
120034
  if (spec.kind === "probe") {
120034
120035
  return { value: wire.path, meta: meta3 };
@@ -120084,6 +120085,14 @@ async function resolveFileInputs(def, body, lookupUpload) {
120084
120085
  for (const spec of specs) {
120085
120086
  const value = args[spec.target];
120086
120087
  if (!isFileInputWire(value)) continue;
120088
+ if (spec.unwrapWhenSet !== void 0 && isParamSet(args[spec.unwrapWhenSet])) {
120089
+ args[spec.target] = value.path;
120090
+ continue;
120091
+ }
120092
+ if (spec.skipWhenSet !== void 0 && isParamSet(args[spec.skipWhenSet])) {
120093
+ delete args[spec.target];
120094
+ continue;
120095
+ }
120087
120096
  const { value: path40, meta: meta3 } = await resolveOne(spec, value, tempDirs, lookupUpload);
120088
120097
  args[spec.target] = path40;
120089
120098
  resolved = { ...resolved ?? {}, [spec.target]: meta3 };
@@ -120344,6 +120353,10 @@ function isToolExposed(def) {
120344
120353
  function findDependencyMissing(err) {
120345
120354
  return findErrorInCauseChain(err, DependencyMissingError);
120346
120355
  }
120356
+ function errorSignalFields(err) {
120357
+ const signal = getFailureSignal(err);
120358
+ return signal ? { error_code: signal.error_code, error_kind: signal.error_kind } : {};
120359
+ }
120347
120360
  function streamErrorMessage(err) {
120348
120361
  if (err instanceof ToolNotFoundError) return err.message;
120349
120362
  const depErr = findDependencyMissing(err);
@@ -120821,27 +120834,27 @@ function createHttpApp(registry2, options) {
120821
120834
  }
120822
120835
  } catch (err) {
120823
120836
  if (wantsStream) {
120824
- writeLine({ event: "error", error: streamErrorMessage(err) });
120837
+ writeLine({ event: "error", error: streamErrorMessage(err), ...errorSignalFields(err) });
120825
120838
  res.end();
120826
120839
  return;
120827
120840
  }
120828
120841
  if (err instanceof ToolNotFoundError) {
120829
- res.status(404).json({ error: err.message });
120842
+ res.status(404).json({ error: err.message, ...errorSignalFields(err) });
120830
120843
  return;
120831
120844
  }
120832
120845
  const depErr = findDependencyMissing(err);
120833
120846
  if (depErr) {
120834
- res.status(424).json({ error: depErr.message, missing: depErr.missing });
120847
+ res.status(424).json({ error: depErr.message, missing: depErr.missing, ...errorSignalFields(err) });
120835
120848
  return;
120836
120849
  }
120837
120850
  const unsupportedErr = findErrorInCauseChain(err, UnsupportedOperationError);
120838
120851
  if (unsupportedErr) {
120839
- res.status(400).json({ error: unsupportedErr.message });
120852
+ res.status(400).json({ error: unsupportedErr.message, ...errorSignalFields(err) });
120840
120853
  return;
120841
120854
  }
120842
120855
  const invalidInputErr = findErrorInCauseChain(err, InvalidToolInputError);
120843
120856
  if (invalidInputErr) {
120844
- res.status(400).json({ error: invalidInputErr.message });
120857
+ res.status(400).json({ error: invalidInputErr.message, ...errorSignalFields(err) });
120845
120858
  return;
120846
120859
  }
120847
120860
  const notImplementedErr = findErrorInCauseChain(err, NotImplementedOnPlatformError);
@@ -120850,11 +120863,12 @@ function createHttpApp(registry2, options) {
120850
120863
  error: notImplementedErr.message,
120851
120864
  toolId: notImplementedErr.toolId,
120852
120865
  platform: notImplementedErr.platform,
120853
- hint: notImplementedErr.hint
120866
+ hint: notImplementedErr.hint,
120867
+ ...errorSignalFields(err)
120854
120868
  });
120855
120869
  return;
120856
120870
  }
120857
- res.status(500).json({ error: formatErrorForAgent(err) });
120871
+ res.status(500).json({ error: formatErrorForAgent(err), ...errorSignalFields(err) });
120858
120872
  } finally {
120859
120873
  if (keepAlive) clearInterval(keepAlive);
120860
120874
  releaseInvocationMeta?.();
@@ -120951,13 +120965,13 @@ function createToolServerEventLog({
120951
120965
  dispose: () => {
120952
120966
  if (disposePromise) return disposePromise;
120953
120967
  disposed = true;
120954
- disposePromise = new Promise((resolve9, reject) => {
120968
+ disposePromise = new Promise((resolve10, reject) => {
120955
120969
  if (streamError) {
120956
120970
  reject(streamError);
120957
120971
  return;
120958
120972
  }
120959
120973
  if (fileStream.closed || fileStream.destroyed) {
120960
- resolve9();
120974
+ resolve10();
120961
120975
  return;
120962
120976
  }
120963
120977
  fileStream.once("error", (error52) => {
@@ -120967,7 +120981,7 @@ function createToolServerEventLog({
120967
120981
  })
120968
120982
  );
120969
120983
  });
120970
- fileStream.end(resolve9);
120984
+ fileStream.end(resolve10);
120971
120985
  });
120972
120986
  return disposePromise;
120973
120987
  }
@@ -121426,7 +121440,7 @@ function formatConsoleArgs(params) {
121426
121440
  }).join(" ");
121427
121441
  }
121428
121442
  function createConsoleLogServer(consoleEvents, logWriter) {
121429
- return new Promise((resolve9, reject) => {
121443
+ return new Promise((resolve10, reject) => {
121430
121444
  const server = http.createServer();
121431
121445
  const wss = new import_websocket_server.default({ server });
121432
121446
  wss.on("connection", (ws) => {
@@ -121448,7 +121462,7 @@ function createConsoleLogServer(consoleEvents, logWriter) {
121448
121462
  return;
121449
121463
  }
121450
121464
  const url2 = `ws://127.0.0.1:${addr.port}`;
121451
- resolve9({
121465
+ resolve10({
121452
121466
  url: url2,
121453
121467
  close: () => new Promise((res) => {
121454
121468
  wss.clients.forEach((c) => c.close());
@@ -121589,7 +121603,7 @@ function hidSocketPath(udid) {
121589
121603
  return `/tmp/argent-tv-hid-${udid.slice(0, 8)}.sock`;
121590
121604
  }
121591
121605
  function sendLine(socketPath, line, timeoutMs = 1e4) {
121592
- return new Promise((resolve9, reject) => {
121606
+ return new Promise((resolve10, reject) => {
121593
121607
  const socket = net4.createConnection(socketPath);
121594
121608
  const chunks = [];
121595
121609
  let settled = false;
@@ -121605,7 +121619,7 @@ function sendLine(socketPath, line, timeoutMs = 1e4) {
121605
121619
  clearTimeout(timer);
121606
121620
  socket.destroy();
121607
121621
  if (err) reject(err);
121608
- else resolve9(value ?? "");
121622
+ else resolve10(value ?? "");
121609
121623
  };
121610
121624
  socket.on("connect", () => socket.write(line.endsWith("\n") ? line : line + "\n"));
121611
121625
  socket.on("data", (d) => chunks.push(d));
@@ -121676,13 +121690,13 @@ async function waitForSocket(socketPath, proc, timeoutMs) {
121676
121690
  throw new Error(`tv daemon exited with code ${exited} before its socket was ready`);
121677
121691
  }
121678
121692
  if (fs21.existsSync(socketPath)) {
121679
- const ok = await new Promise((resolve9) => {
121693
+ const ok = await new Promise((resolve10) => {
121680
121694
  const s = net4.createConnection(socketPath);
121681
121695
  s.on("connect", () => {
121682
121696
  s.destroy();
121683
- resolve9(true);
121697
+ resolve10(true);
121684
121698
  });
121685
- s.on("error", () => resolve9(false));
121699
+ s.on("error", () => resolve10(false));
121686
121700
  });
121687
121701
  if (ok) return;
121688
121702
  }
@@ -123074,7 +123088,7 @@ function formatConsoleArgs2(params) {
123074
123088
  }).join(" ");
123075
123089
  }
123076
123090
  function createConsoleLogServer2(consoleEvents, logWriter) {
123077
- return new Promise((resolve9, reject) => {
123091
+ return new Promise((resolve10, reject) => {
123078
123092
  const server = http2.createServer();
123079
123093
  const wss = new import_websocket_server.default({ server });
123080
123094
  wss.on("connection", (ws) => {
@@ -123103,7 +123117,7 @@ function createConsoleLogServer2(consoleEvents, logWriter) {
123103
123117
  return;
123104
123118
  }
123105
123119
  const url2 = `ws://127.0.0.1:${addr.port}`;
123106
- resolve9({
123120
+ resolve10({
123107
123121
  url: url2,
123108
123122
  close: () => new Promise((res) => {
123109
123123
  wss.clients.forEach((c) => c.close());
@@ -124377,7 +124391,7 @@ function electronGuiChildEnv(overrides = {}) {
124377
124391
  // ../tool-server/src/tools/devices/boot-electron.ts
124378
124392
  var DEFAULT_READY_TIMEOUT_MS = 3e4;
124379
124393
  async function pickFreePort() {
124380
- return new Promise((resolve9, reject) => {
124394
+ return new Promise((resolve10, reject) => {
124381
124395
  const srv = net5.createServer();
124382
124396
  srv.unref();
124383
124397
  srv.on("error", reject);
@@ -124385,7 +124399,7 @@ async function pickFreePort() {
124385
124399
  const addr = srv.address();
124386
124400
  if (addr && typeof addr === "object") {
124387
124401
  const { port } = addr;
124388
- srv.close(() => resolve9(port));
124402
+ srv.close(() => resolve10(port));
124389
124403
  } else {
124390
124404
  srv.close(() => reject(new Error("Could not allocate a free TCP port")));
124391
124405
  }
@@ -129003,7 +129017,7 @@ async function fetchVegaPageSource(timeoutMs = 15e3) {
129003
129017
  }
129004
129018
  }
129005
129019
  function postJson(host, port, path40, body, timeoutMs) {
129006
- return new Promise((resolve9, reject) => {
129020
+ return new Promise((resolve10, reject) => {
129007
129021
  const req = (0, import_node_http.request)(
129008
129022
  {
129009
129023
  host,
@@ -129026,7 +129040,7 @@ function postJson(host, port, path40, body, timeoutMs) {
129026
129040
  reject(new Error(`toolkit HTTP ${status}: ${data.slice(0, 200)}`));
129027
129041
  return;
129028
129042
  }
129029
- resolve9(data);
129043
+ resolve10(data);
129030
129044
  });
129031
129045
  }
129032
129046
  );
@@ -132350,21 +132364,21 @@ var Matcher = class {
132350
132364
  * @returns {string}
132351
132365
  */
132352
132366
  toString(separator, includeNamespace = true) {
132353
- const sep6 = separator || this.separator;
132354
- const isDefault = sep6 === this.separator && includeNamespace === true;
132367
+ const sep7 = separator || this.separator;
132368
+ const isDefault = sep7 === this.separator && includeNamespace === true;
132355
132369
  if (isDefault) {
132356
132370
  if (this._pathStringCache !== null) {
132357
132371
  return this._pathStringCache;
132358
132372
  }
132359
132373
  const result = this.path.map(
132360
132374
  (n) => n.namespace ? `${n.namespace}:${n.tag}` : n.tag
132361
- ).join(sep6);
132375
+ ).join(sep7);
132362
132376
  this._pathStringCache = result;
132363
132377
  return result;
132364
132378
  }
132365
132379
  return this.path.map(
132366
132380
  (n) => includeNamespace && n.namespace ? `${n.namespace}:${n.tag}` : n.tag
132367
- ).join(sep6);
132381
+ ).join(sep7);
132368
132382
  }
132369
132383
  /**
132370
132384
  * Get path as array of tag names.
@@ -135068,7 +135082,7 @@ Use when you want to apply code changes or reset JS state. Returns { reloaded, p
135068
135082
  async execute(services, _params) {
135069
135083
  const api = services.debugger;
135070
135084
  const port = api.port;
135071
- const disableLogBox = () => new Promise((resolve9) => setTimeout(resolve9, 2e3)).then(
135085
+ const disableLogBox = () => new Promise((resolve10) => setTimeout(resolve10, 2e3)).then(
135072
135086
  () => api.cdp.evaluate(DISABLE_LOGBOX_SCRIPT).catch(() => {
135073
135087
  })
135074
135088
  );
@@ -139731,11 +139745,11 @@ function buildHotspots(nodes, samples, timeDeltas, topN2, reactOnly) {
139731
139745
  function renderMarkdownTable(entries) {
139732
139746
  if (entries.length === 0) return "_No hotspots found._";
139733
139747
  const header = "| Function | Location | Self (ms) | Total (ms) | Self % |";
139734
- const sep6 = "|---|---|---|---|---|";
139748
+ const sep7 = "|---|---|---|---|---|";
139735
139749
  const rows = entries.map(
139736
139750
  (e) => `| \`${e.function}\` | ${e.url || "\u2014"} | ${e.self_ms} | ${e.total_ms} | ${e.self_pct} |`
139737
139751
  );
139738
- return [header, sep6, ...rows].join("\n");
139752
+ return [header, sep7, ...rows].join("\n");
139739
139753
  }
139740
139754
  var reactProfilerCpuSummaryTool = {
139741
139755
  id: "react-profiler-cpu-summary",
@@ -139843,11 +139857,11 @@ function renderMarkdownTable2(entries) {
139843
139857
  if (entries.length === 0)
139844
139858
  return "_No render data found. Ensure React DevTools global hook is present._";
139845
139859
  const header = "| Component | Renders | Total (ms) | Self Base (ms) |";
139846
- const sep6 = "|---|---|---|---|";
139860
+ const sep7 = "|---|---|---|---|";
139847
139861
  const rows = entries.map(
139848
139862
  (e) => `| \`${e.component}\` | ${e.renderCount} | ${e.totalActualDuration_ms.toFixed(2)} | ${e.selfBaseDuration_ms.toFixed(2)} |`
139849
139863
  );
139850
- return [header, sep6, ...rows].join("\n");
139864
+ return [header, sep7, ...rows].join("\n");
139851
139865
  }
139852
139866
  var zodSchema46 = external_exports.object({
139853
139867
  port: external_exports.coerce.number().default(8081).describe("Metro server port"),
@@ -140120,14 +140134,14 @@ function waitForChildExit(child, ms) {
140120
140134
  if (child.exitCode !== null || child.signalCode !== null) {
140121
140135
  return Promise.resolve(true);
140122
140136
  }
140123
- return new Promise((resolve9) => {
140137
+ return new Promise((resolve10) => {
140124
140138
  const onExit = () => {
140125
140139
  clearTimeout(timer);
140126
- resolve9(true);
140140
+ resolve10(true);
140127
140141
  };
140128
140142
  const timer = setTimeout(() => {
140129
140143
  child.removeListener("exit", onExit);
140130
- resolve9(false);
140144
+ resolve10(false);
140131
140145
  }, ms);
140132
140146
  child.once("exit", onExit);
140133
140147
  });
@@ -140341,7 +140355,7 @@ function listenForDarwinNotification(name) {
140341
140355
  // ../tool-server/src/utils/ios-profiler/startup.ts
140342
140356
  init_src();
140343
140357
  function waitForXctraceReady(child, { notify, timeoutMs }) {
140344
- return new Promise((resolve9, reject) => {
140358
+ return new Promise((resolve10, reject) => {
140345
140359
  let settled = false;
140346
140360
  let stderrBuffer = "";
140347
140361
  const settle = (run2) => {
@@ -140354,7 +140368,7 @@ function waitForXctraceReady(child, { notify, timeoutMs }) {
140354
140368
  child.stdout?.on("data", (data) => {
140355
140369
  const text = data.toString();
140356
140370
  if (text.includes("Ctrl-C to stop") || text.includes("Starting recording")) {
140357
- settle(() => resolve9({ stderrBuffer }));
140371
+ settle(() => resolve10({ stderrBuffer }));
140358
140372
  }
140359
140373
  });
140360
140374
  child.stderr?.on("data", (data) => {
@@ -140417,7 +140431,7 @@ function waitForXctraceReady(child, { notify, timeoutMs }) {
140417
140431
  });
140418
140432
  }, timeoutMs);
140419
140433
  if (notify) {
140420
- notify.fired.then(() => settle(() => resolve9({ stderrBuffer }))).catch(() => {
140434
+ notify.fired.then(() => settle(() => resolve10({ stderrBuffer }))).catch(() => {
140421
140435
  });
140422
140436
  }
140423
140437
  });
@@ -142650,7 +142664,7 @@ async function startPerfetto(opts) {
142650
142664
  child.stderr.on("data", (chunk) => {
142651
142665
  stderr += chunk.toString("utf8");
142652
142666
  });
142653
- const pid = await new Promise((resolve9, reject) => {
142667
+ const pid = await new Promise((resolve10, reject) => {
142654
142668
  let settled = false;
142655
142669
  const timer = setTimeout(() => {
142656
142670
  fail(
@@ -142680,7 +142694,7 @@ async function startPerfetto(opts) {
142680
142694
  if (settled) return;
142681
142695
  settled = true;
142682
142696
  clearTimeout(timer);
142683
- resolve9(value);
142697
+ resolve10(value);
142684
142698
  }
142685
142699
  child.on(
142686
142700
  "error",
@@ -144071,7 +144085,7 @@ function streamFailure(message, stage, kind = "network", cause) {
144071
144085
  );
144072
144086
  }
144073
144087
  function openMjpegStream(url2, connectTimeoutMs = 1e4) {
144074
- return new Promise((resolve9, reject) => {
144088
+ return new Promise((resolve10, reject) => {
144075
144089
  let settled = false;
144076
144090
  const request3 = import_http.default.get(url2, (res) => {
144077
144091
  request3.setTimeout(0);
@@ -144139,7 +144153,7 @@ function openMjpegStream(url2, connectTimeoutMs = 1e4) {
144139
144153
  res.on("error", fail);
144140
144154
  res.on("aborted", () => fail(new Error("frame stream aborted")));
144141
144155
  settled = true;
144142
- resolve9({
144156
+ resolve10({
144143
144157
  get latest() {
144144
144158
  return state3.latest;
144145
144159
  },
@@ -144692,7 +144706,7 @@ async function startCaptureLocked(api, params) {
144692
144706
  };
144693
144707
  }
144694
144708
  function waitForEncoderReady(child, stderrRef) {
144695
- return new Promise((resolve9, reject) => {
144709
+ return new Promise((resolve10, reject) => {
144696
144710
  let settled = false;
144697
144711
  const finish = (err) => {
144698
144712
  if (settled) return;
@@ -144701,7 +144715,7 @@ function waitForEncoderReady(child, stderrRef) {
144701
144715
  child.removeListener("exit", onExit);
144702
144716
  child.removeListener("error", onError);
144703
144717
  if (err) reject(err);
144704
- else resolve9();
144718
+ else resolve10();
144705
144719
  };
144706
144720
  const onExit = (code, signal) => {
144707
144721
  finish(
@@ -145063,7 +145077,7 @@ function renderTopFunctions(index, topN2, startMs, endMs) {
145063
145077
  const hotspots = queryCpuWindow(index, windowStart, windowEnd, topN2);
145064
145078
  if (hotspots.length === 0) return "_No CPU hotspots found in the specified range._";
145065
145079
  const header = "| Function | Self (ms) | Total (ms) | Location |";
145066
- const sep6 = "|---|---|---|---|";
145080
+ const sep7 = "|---|---|---|---|";
145067
145081
  const rows = hotspots.map((hs) => {
145068
145082
  const loc = hs.url ? `${shortenUrl(hs.url)}${hs.lineNumber != null ? `:${hs.lineNumber}` : ""}` : "\u2014";
145069
145083
  return `| \`${hs.name}\` | ${hs.selfMs} | ${hs.totalMs} | ${loc} |`;
@@ -145074,7 +145088,7 @@ function renderTopFunctions(index, topN2, startMs, endMs) {
145074
145088
  return `## CPU Hotspots
145075
145089
 
145076
145090
  ${rangeNote}${header}
145077
- ${sep6}
145091
+ ${sep7}
145078
145092
  ${rows.join("\n")}`;
145079
145093
  }
145080
145094
  function renderCallTree(index, functionName, topN2, includeCallers) {
@@ -147087,10 +147101,12 @@ function requireActiveProjectRoot() {
147087
147101
  }
147088
147102
  return activeProjectRoot;
147089
147103
  }
147104
+ function flowsDirFor(root2) {
147105
+ return path31.join(root2, FLOWS_DIR_NAME);
147106
+ }
147090
147107
  function getFlowsDir() {
147091
- return path31.join(requireActiveProjectRoot(), FLOWS_DIR_NAME);
147108
+ return flowsDirFor(requireActiveProjectRoot());
147092
147109
  }
147093
- var FLOW_NAME_PATTERN = /^[A-Za-z0-9_-]+$/;
147094
147110
  function assertSafeFlowName(name) {
147095
147111
  if (!FLOW_NAME_PATTERN.test(name)) {
147096
147112
  throw new FailureError(
@@ -147118,6 +147134,13 @@ function getFlowPath(name) {
147118
147134
  }
147119
147135
  return filePath;
147120
147136
  }
147137
+ async function classifyOnDiskSpelling(dir, base) {
147138
+ const entries = await fs43.readdir(dir).catch(() => null);
147139
+ if (entries === null || entries.includes(base)) return { state: "listed" };
147140
+ const actual = entries.find((entry) => entry.toLowerCase() === base.toLowerCase());
147141
+ if (actual === void 0) return { state: "absent" };
147142
+ return { state: "case_folded", actual, addressable: FLOW_FILE_NAME_PATTERN.test(actual) };
147143
+ }
147121
147144
  function startRecordingSession(name, session) {
147122
147145
  activeFlowName = name;
147123
147146
  recordingSession = session;
@@ -147432,6 +147455,7 @@ function toYamlStep(step) {
147432
147455
  }
147433
147456
  }
147434
147457
  }
147458
+ var MAX_ENTRY_RENDER_CHARS = 200;
147435
147459
  function badEntry(raw, detail) {
147436
147460
  let rendered;
147437
147461
  try {
@@ -147439,6 +147463,10 @@ function badEntry(raw, detail) {
147439
147463
  } catch {
147440
147464
  rendered = "[cyclic entry]";
147441
147465
  }
147466
+ if (rendered.length > MAX_ENTRY_RENDER_CHARS) {
147467
+ const elided = rendered.length - MAX_ENTRY_RENDER_CHARS;
147468
+ rendered = `${rendered.slice(0, MAX_ENTRY_RENDER_CHARS)}\u2026(+${elided} chars)`;
147469
+ }
147442
147470
  throw new FailureError(`Unrecognized flow entry (${detail}): ${rendered}`, {
147443
147471
  error_code: FAILURE_CODES.FLOW_ENTRY_UNRECOGNIZED,
147444
147472
  failure_stage: "flow_file_parse_step",
@@ -147968,6 +147996,42 @@ function parseWhenStep(raw, depth) {
147968
147996
  });
147969
147997
  return { kind: "when", condition, steps };
147970
147998
  }
147999
+ function runTargetName(target) {
148000
+ return path31.posix.basename(target, ".yaml");
148001
+ }
148002
+ function parseRunTarget(raw, value) {
148003
+ if (typeof value !== "string") {
148004
+ badEntry(
148005
+ raw,
148006
+ value === null || value === void 0 ? "`run` has no target \u2014 give it a YAML path relative to this flow's file, e.g. `run: fragments/login.yaml`" : "a `run` target must be a YAML path string relative to this flow's file, e.g. `run: fragments/login.yaml`"
148007
+ );
148008
+ }
148009
+ if (value.includes("\\")) {
148010
+ badEntry(raw, "a `run` path uses forward slashes, e.g. `run: fragments/login.yaml`");
148011
+ }
148012
+ if (path31.posix.isAbsolute(value) || /^[A-Za-z]:/.test(value)) {
148013
+ badEntry(raw, "a `run` path must be relative to the flow file that references it");
148014
+ }
148015
+ const target = completeRunExtension(value);
148016
+ if (!target.endsWith(".yaml")) {
148017
+ if (target.toLowerCase().endsWith(".yaml")) {
148018
+ badEntry(raw, "a `run` path must use the lowercase .yaml extension");
148019
+ }
148020
+ badEntry(raw, "a `run` path must end in .yaml, or name a sibling flow (`run: login`)");
148021
+ }
148022
+ if (!FLOW_FILE_NAME_PATTERN.test(path31.posix.basename(target))) {
148023
+ badEntry(
148024
+ raw,
148025
+ `a \`run\` target's filename must match ${FLOW_FILE_NAME_PATTERN} \u2014 letters, digits, underscore, hyphen before the .yaml`
148026
+ );
148027
+ }
148028
+ return target;
148029
+ }
148030
+ function completeRunExtension(value) {
148031
+ if (value.endsWith(".yaml")) return value;
148032
+ const candidate = `${value}.yaml`;
148033
+ return FLOW_FILE_NAME_PATTERN.test(path31.posix.basename(candidate)) ? candidate : value;
148034
+ }
147971
148035
  function fromYamlStep(raw, whenDepth = 0) {
147972
148036
  const entry = raw;
147973
148037
  if ("optional" in raw) {
@@ -148000,7 +148064,7 @@ function fromYamlStep(raw, whenDepth = 0) {
148000
148064
  }
148001
148065
  if ("echo" in raw) return { kind: "echo", message: String(raw.echo) };
148002
148066
  if ("launch" in raw) return { kind: "launch", app: parseLaunch(raw.launch) };
148003
- if ("run" in raw) return { kind: "run", flow: String(raw.run) };
148067
+ if ("run" in raw) return { kind: "run", flow: parseRunTarget(raw, raw.run) };
148004
148068
  if ("when" in raw) return parseWhenStep(entry, whenDepth);
148005
148069
  if ("tap" in raw) return parseTap(raw.tap, raw);
148006
148070
  if ("long-press" in raw) {
@@ -148139,7 +148203,21 @@ function parseFlow(content) {
148139
148203
  if (trimmed.length === 0) {
148140
148204
  return { executionPrerequisite: "", steps: [] };
148141
148205
  }
148142
- const parsed = (0, import_yaml.parse)(trimmed);
148206
+ let parsed;
148207
+ try {
148208
+ parsed = (0, import_yaml.parse)(trimmed);
148209
+ } catch (err) {
148210
+ throw new FailureError(
148211
+ `Invalid flow file: ${err instanceof Error ? err.message : String(err)}`,
148212
+ {
148213
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
148214
+ failure_stage: "flow_file_parse",
148215
+ failure_area: "tool_server",
148216
+ error_kind: "validation"
148217
+ },
148218
+ err instanceof Error ? { cause: err } : void 0
148219
+ );
148220
+ }
148143
148221
  if (typeof parsed !== "object" || parsed === null || !("steps" in parsed) || !Array.isArray(parsed.steps)) {
148144
148222
  throw new FailureError("Invalid flow file: expected an object with a steps array", {
148145
148223
  error_code: FAILURE_CODES.FLOW_FILE_INVALID,
@@ -148280,6 +148358,7 @@ to remove or reorder steps.`,
148280
148358
  init_zod();
148281
148359
  var fs45 = __toESM(require("node:fs/promises"));
148282
148360
  var path32 = __toESM(require("node:path"));
148361
+ init_src();
148283
148362
 
148284
148363
  // ../tool-server/src/tools/flows/flow-device.ts
148285
148364
  init_src();
@@ -148862,9 +148941,66 @@ async function captureTapSelector(registry2, udid, point) {
148862
148941
  }
148863
148942
  }
148864
148943
  var RUN_TARGET_COMMAND = "flow-execute";
148944
+ async function rewriteSiblingFlowPath(session, args) {
148945
+ const flowPath = args.flow_path;
148946
+ if (typeof flowPath !== "string" || args.name !== void 0) return;
148947
+ const invalid = (detail) => new FailureError(
148948
+ `Cannot record a flow-execute of flow_path "${flowPath}": ${detail}. flow_path carries no file-input resolution through flow-add-step's opaque args \u2014 pass name + project_root for a flow saved beside the recording, or add a \`run: <relative path>.yaml\` step to the flow YAML by hand for a cross-directory target.`,
148949
+ {
148950
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
148951
+ failure_stage: "flow_add_step_flow_path",
148952
+ failure_area: "tool_server",
148953
+ error_kind: "validation"
148954
+ }
148955
+ );
148956
+ if (!session || session.persist !== "host") {
148957
+ throw invalid(
148958
+ "the recording is not persisted on this host, so its siblings cannot be resolved here"
148959
+ );
148960
+ }
148961
+ if (flowPath.split(/[\\/]+/).includes("..")) {
148962
+ throw invalid(
148963
+ 'flow paths must not contain ".." segments \u2014 sibling identity is decided lexically from this path, and a symlinked directory component would make the rewrite run a different file than the path opens'
148964
+ );
148965
+ }
148966
+ const ext = path32.extname(flowPath);
148967
+ const bareExtension = path32.basename(flowPath).toLowerCase() === ".yaml";
148968
+ if (!bareExtension && ext !== ".yaml") {
148969
+ throw invalid(
148970
+ ext.toLowerCase() === ".yaml" ? `flow files must use the lowercase .yaml extension, not "${ext}"` : "flow files must use the .yaml extension"
148971
+ );
148972
+ }
148973
+ const flowsDir = path32.dirname(session.filePath);
148974
+ if (path32.resolve(path32.dirname(flowPath)) !== path32.resolve(flowsDir)) {
148975
+ throw invalid(
148976
+ `it is not in the recording's flow directory ("${flowsDir}"), and a raw tool: step has no boundary to resolve a path through at replay`
148977
+ );
148978
+ }
148979
+ const stem = bareExtension ? "" : path32.basename(flowPath, ".yaml");
148980
+ assertSafeFlowName(stem);
148981
+ const projectRoot = args.project_root;
148982
+ if (typeof projectRoot !== "string" || !path32.isAbsolute(projectRoot)) {
148983
+ throw invalid(
148984
+ `project_root must be an absolute path (got ${typeof projectRoot === "string" ? `"${projectRoot}"` : "none"}) \u2014 a relative root would be resolved against the tool server's cwd, not the calling agent's`
148985
+ );
148986
+ }
148987
+ if (path32.resolve(flowsDirFor(projectRoot), `${stem}.yaml`) !== path32.resolve(flowPath)) {
148988
+ throw invalid(`project_root "${projectRoot}" does not resolve "${stem}" to it`);
148989
+ }
148990
+ const suppliedBase = path32.basename(flowPath);
148991
+ const spelling = await classifyOnDiskSpelling(flowsDir, suppliedBase);
148992
+ if (spelling.state !== "listed") {
148993
+ const recovery = spelling.state === "absent" ? `pass the basename exactly as it appears on disk` : spelling.addressable ? `pass flow_path with the on-disk basename "${spelling.actual}"` : `rename "${spelling.actual}" to "${suppliedBase}" to record it \u2014 flow files must be lowercase .yaml`;
148994
+ throw invalid(
148995
+ `the file must be named as it appears on disk \u2014 no directory entry is named "${suppliedBase}"` + (spelling.state === "case_folded" ? ` (this filesystem matched it case-insensitively to "${spelling.actual}")` : "") + `, so the recorded run: step would name a flow no case-sensitive checkout can find \u2014 ` + recovery
148996
+ );
148997
+ }
148998
+ delete args.flow_path;
148999
+ args.name = stem;
149000
+ }
148865
149001
  async function captureRunTarget(session, args) {
148866
- const name = args.name;
148867
- if (typeof name !== "string") {
149002
+ const name = typeof args.name === "string" ? args.name : void 0;
149003
+ if (name === void 0) {
148868
149004
  return { warning: "flow-execute call had no flow name; kept the raw step" };
148869
149005
  }
148870
149006
  if (!session || session.persist !== "host") {
@@ -148874,9 +149010,40 @@ async function captureRunTarget(session, args) {
148874
149010
  }
148875
149011
  try {
148876
149012
  assertSafeFlowName(name);
148877
- const fragPath = path32.join(path32.dirname(session.filePath), `${name}.yaml`);
149013
+ const realFlowPath = await fs45.realpath(session.filePath);
149014
+ const flowsDir = path32.dirname(realFlowPath);
149015
+ const fragPath = path32.join(flowsDir, `${name}.yaml`);
149016
+ const projectRoot = args.project_root;
149017
+ if (typeof projectRoot !== "string" || !path32.isAbsolute(projectRoot)) {
149018
+ return {
149019
+ warning: `kept the raw flow-execute step \u2014 project_root must be an absolute path (got ${typeof projectRoot === "string" ? `"${projectRoot}"` : "none"}) to confirm "${name}" names the recording's own sibling`
149020
+ };
149021
+ }
149022
+ const spelling = await classifyOnDiskSpelling(flowsDir, `${name}.yaml`);
149023
+ if (spelling.state === "case_folded") {
149024
+ const recovery = spelling.addressable ? `re-run it as name "${path32.basename(spelling.actual, ".yaml")}" to record it` : `rename "${spelling.actual}" to "${name}.yaml" to record it \u2014 flow files must be lowercase .yaml`;
149025
+ return {
149026
+ warning: `kept the raw flow-execute step \u2014 no sibling is named "${name}.yaml" (this filesystem matched it case-insensitively to "${spelling.actual}"), so a run: ${name} step would name a flow no case-sensitive checkout can find \u2014 ${recovery}`
149027
+ };
149028
+ }
148878
149029
  parseFlow(await fs45.readFile(fragPath, "utf8"));
148879
- return { flow: name };
149030
+ let executedPath;
149031
+ try {
149032
+ executedPath = await fs45.realpath(path32.join(flowsDirFor(projectRoot), `${name}.yaml`));
149033
+ } catch {
149034
+ executedPath = void 0;
149035
+ }
149036
+ if (executedPath === void 0) {
149037
+ return {
149038
+ warning: `kept the raw flow-execute step \u2014 could not verify which file the live flow-execute ran ("${name}" has no canonical file in project_root's flows dir to compare the sibling against)`
149039
+ };
149040
+ }
149041
+ if (executedPath !== await fs45.realpath(fragPath)) {
149042
+ return {
149043
+ warning: `kept the raw flow-execute step \u2014 project_root "${projectRoot}" resolves "${name}" to "${executedPath}", not the recording's sibling "${fragPath}", so "${name}.yaml" beside the recording's real file is not the file the live flow-execute ran and a run: ${name} step would replay a different flow than the one that just ran`
149044
+ };
149045
+ }
149046
+ return { flow: `${name}.yaml` };
148880
149047
  } catch (err) {
148881
149048
  return {
148882
149049
  warning: `could not resolve "${name}" as a sibling fragment (${err instanceof Error ? err.message : String(err)}); kept the raw flow-execute step`
@@ -148898,6 +149065,8 @@ If a step was recorded by mistake, edit the .yaml file directly to remove it.`,
148898
149065
  async execute(_services, params, ctx) {
148899
149066
  const flowName = getActiveFlow();
148900
149067
  const args = params.args ? JSON.parse(params.args) : {};
149068
+ const session = getRecordingSession();
149069
+ if (params.command === RUN_TARGET_COMMAND) await rewriteSiblingFlowPath(session, args);
148901
149070
  const isTap = params.command === "gesture-tap" && params.delayMs === void 0 && typeof args.udid === "string" && typeof args.x === "number" && typeof args.y === "number";
148902
149071
  let captured;
148903
149072
  if (isTap) {
@@ -148907,7 +149076,6 @@ If a step was recorded by mistake, edit the .yaml file directly to remove it.`,
148907
149076
  });
148908
149077
  }
148909
149078
  const toolResult = await invokeSubTool(registry2, ctx, params.command, args);
148910
- const session = getRecordingSession();
148911
149079
  const runTarget = params.command === RUN_TARGET_COMMAND && params.delayMs === void 0 ? await captureRunTarget(session, args) : void 0;
148912
149080
  const strippedArgs = stripDeviceKeys(args);
148913
149081
  const isLaunch = params.command === "restart-app" && params.delayMs === void 0 && typeof strippedArgs.bundleId === "string" && Object.keys(strippedArgs).length === 1;
@@ -151974,13 +152142,18 @@ async function restoreStatusBar(device) {
151974
152142
 
151975
152143
  // ../tool-server/src/tools/flows/flow-run.ts
151976
152144
  var zodSchema64 = external_exports.object({
151977
- name: external_exports.string().describe('Name of the flow to run (e.g. "settings-explore")'),
152145
+ name: external_exports.string().optional().describe(
152146
+ 'Name of a saved flow to run from `.argent/flows` (e.g. "settings-explore"). Omit when flow_path is set.'
152147
+ ),
151978
152148
  project_root: external_exports.string().describe(
151979
- "Absolute path to the project root directory that contains `.argent/flows/<name>.yaml`."
152149
+ "Absolute path to the calling agent's project root \u2014 the cwd it is working in. With name, the saved flow is read from `.argent/flows/<name>.yaml` under this root; with flow_path, the flow, its run: siblings, and baselines all resolve beside the YAML instead, so pass the agent's cwd."
151980
152150
  ),
151981
152151
  flow_file: external_exports.string().optional().describe(
151982
152152
  "Path to the flow .yaml as readable by the tool-server. Internal \u2014 the argent client derives it from project_root and name automatically; leave unset."
151983
152153
  ),
152154
+ flow_path: external_exports.string().optional().describe(
152155
+ "Absolute path to a co-located flow .yaml on the client and tool server's shared filesystem. This must be supplied through the file-input boundary. For remote execution, pass name + project_root instead."
152156
+ ),
151984
152157
  device: external_exports.string().optional().describe(
151985
152158
  "Device id to run against (iOS UDID, Android/Vega serial, Chromium id). Auto-detected when omitted."
151986
152159
  ),
@@ -151991,9 +152164,37 @@ var zodSchema64 = external_exports.object({
151991
152164
  prerequisiteAcknowledged: external_exports.boolean().optional().describe(
151992
152165
  "Set to true to confirm the execution prerequisite has been met. Required (LLM path) when a fragment defines an executionPrerequisite."
151993
152166
  )
151994
- });
152167
+ }).superRefine((params, ctx) => {
152168
+ if (params.name === void 0 === (params.flow_path === void 0)) {
152169
+ ctx.addIssue({
152170
+ code: external_exports.ZodIssueCode.custom,
152171
+ message: "Pass exactly one flow source: name or flow_path.",
152172
+ path: ["flow_path"]
152173
+ });
152174
+ }
152175
+ });
152176
+ var inputSchema2 = {
152177
+ ...zodObjectToJsonSchema(zodSchema64),
152178
+ // Zod's JSON Schema conversion cannot represent superRefine. `oneOf` makes
152179
+ // the same exactly-one source rule visible to MCP and HTTP clients: neither
152180
+ // branch matches when both fields are absent, and both branches match (which
152181
+ // is invalid for oneOf) when both fields are present.
152182
+ oneOf: [{ required: ["name"] }, { required: ["flow_path"] }]
152183
+ };
151995
152184
  var fileInputs3 = [
151996
- { target: "flow_file", path: "${project_root}/.argent/flows/${name}.yaml", kind: "file" }
152185
+ {
152186
+ target: "flow_path",
152187
+ path: "${flow_path}",
152188
+ kind: "file",
152189
+ optional: true,
152190
+ unwrapWhenSet: "name"
152191
+ },
152192
+ {
152193
+ target: "flow_file",
152194
+ path: "${project_root}/.argent/flows/${name}.yaml",
152195
+ kind: "file",
152196
+ skipWhenSet: "flow_path"
152197
+ }
151997
152198
  ];
151998
152199
  var MAX_RUN_DEPTH = 20;
151999
152200
  var POST_LAUNCH_SETTLE_MS = 1500;
@@ -152114,15 +152315,51 @@ function deviceEnv(state3) {
152114
152315
  }
152115
152316
  return { ...state3, device: state3.device };
152116
152317
  }
152318
+ function displayFlowName(params) {
152319
+ const stem = params.flow_path === void 0 ? void 0 : path35.basename(params.flow_path, ".yaml");
152320
+ return params.name || stem || params.flow_path || "(unspecified)";
152321
+ }
152322
+ function* walkSteps(steps) {
152323
+ for (const step of steps) {
152324
+ yield step;
152325
+ if (step.kind === "when") yield* walkSteps(step.steps);
152326
+ }
152327
+ }
152328
+ function assertUploadSelfContained(flow) {
152329
+ for (const step of walkSteps(flow.steps)) {
152330
+ if (step.kind === "run") {
152331
+ throw new FailureError(
152332
+ `This flow uses run: composition ("run: ${step.flow}"), which requires a co-located client and tool server \u2014 an uploaded flow's referenced files are not available on this host.`,
152333
+ {
152334
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152335
+ failure_stage: "flow_upload_run_composition",
152336
+ failure_area: "tool_server",
152337
+ error_kind: "validation"
152338
+ }
152339
+ );
152340
+ }
152341
+ if (step.kind === "snapshot") {
152342
+ throw new FailureError(
152343
+ `This flow uses a snapshot step ("snapshot: ${step.name}"), whose baselines live beside the flow's file \u2014 an uploaded flow materializes to a fresh temp directory each call, so a plain snapshot can never find a baseline and updateBaselines (--update-baselines) writes PNGs no later run can read. Use name + project_root with a co-located client and tool server for snapshot flows.`,
152344
+ {
152345
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152346
+ failure_stage: "flow_upload_snapshot_baseline",
152347
+ failure_area: "tool_server",
152348
+ error_kind: "validation"
152349
+ }
152350
+ );
152351
+ }
152352
+ }
152353
+ }
152117
152354
  function createRunFlowTool(registry2) {
152118
152355
  return {
152119
152356
  id: "flow-execute",
152120
152357
  interaction: {
152121
- startedMsg: ({ params }) => `Running flow ${params.name}`,
152122
- completedMsg: ({ params }) => `Ran flow ${params.name}`,
152123
- failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to run flow ${params.name}: ${failureSignal2.error_code}`
152358
+ startedMsg: ({ params }) => `Running flow ${displayFlowName(params)}`,
152359
+ completedMsg: ({ params }) => `Ran flow ${displayFlowName(params)}`,
152360
+ failedMsg: ({ params, failureSignal: failureSignal2 }) => `Failed to run flow ${displayFlowName(params)}: ${failureSignal2.error_code}`
152124
152361
  },
152125
- description: `Run a saved flow from the .argent/flows/ directory.
152362
+ description: `Run a saved flow from the .argent/flows/ directory, or an explicit boundary-managed flow_path.
152126
152363
  Steps run in order: \`launch\` starts an app from scratch (terminate + relaunch) and waits until it is
152127
152364
  ready; \`tool\` calls dispatch through the registry; \`tap\`/\`long-press\`/\`type\` resolve a selector to an
152128
152365
  element and act on it (\`tap: { on, times: 2 }\` double-taps; \`long-press: { on, duration }\` presses and
@@ -152140,7 +152377,9 @@ when \`on\` is omitted; distinct from the \`rotate\` tool, which changes device
152140
152377
  for a UI condition; \`wait\` pauses for a fixed number of milliseconds; \`assert\` checks one now; \`snapshot\`
152141
152378
  diffs a screenshot \u2014 or, with \`cropOn: <selector>\`, one element's cropped region \u2014 against a stored
152142
152379
  baseline (a missing baseline fails the step \u2014 set updateBaselines to adopt the current screen; a
152143
- cropped element whose size drifted fails on dimensions); \`echo\` annotates; \`run\` executes a referenced fragment inline.
152380
+ cropped element whose size drifted fails on dimensions); \`echo\` annotates; \`run\` executes another flow
152381
+ inline \u2014 a YAML path resolved against the directory of the flow file that references it (co-located
152382
+ runs only).
152144
152383
  A \`when:\` block (condition + \`steps:\`, no else) runs its steps only if the condition holds \u2014
152145
152384
  checked once with the short assert grace \u2014 for one-sided divergences like interstitials and coach
152146
152385
  marks; a skipped block reports distinctly and failures inside an entered block are real failures.
@@ -152156,21 +152395,28 @@ If a fragment has an execution prerequisite and prerequisiteAcknowledged is not
152156
152395
  returns a notice with the prerequisite instead of running.`,
152157
152396
  longRunning: true,
152158
152397
  zodSchema: zodSchema64,
152398
+ inputSchema: inputSchema2,
152159
152399
  fileInputs: fileInputs3,
152160
152400
  services: () => ({}),
152161
152401
  async execute(_services, params, ctx) {
152162
152402
  const signal = ctx?.signal;
152163
- const filePath = resolveFlowFilePath(params, ctx?.fileInputs?.flow_file);
152164
- const flowsDir = path35.dirname(filePath);
152165
- const flow = parseFlow(await fs49.readFile(filePath, "utf8"));
152403
+ const { filePath, flowName, viaUpload } = await resolveFlowSource(
152404
+ params,
152405
+ ctx?.fileInputs?.flow_file,
152406
+ ctx?.fileInputs?.flow_path
152407
+ );
152408
+ const canonicalPath = await canonicalFlowPath(filePath);
152409
+ const flowsDir = path35.dirname(canonicalPath);
152410
+ const flow = parseFlow(await fs49.readFile(canonicalPath, "utf8"));
152411
+ if (viaUpload) assertUploadSelfContained(flow);
152166
152412
  if (flow.executionPrerequisite && !params.prerequisiteAcknowledged) {
152167
152413
  return {
152168
- flow: params.name,
152414
+ flow: flowName,
152169
152415
  notice: "This flow has an execution prerequisite that must be fulfilled before it can run. Verify the prerequisite is met and call flow-execute again with prerequisiteAcknowledged set to true.",
152170
152416
  executionPrerequisite: flow.executionPrerequisite
152171
152417
  };
152172
152418
  }
152173
- const resolved = await resolveRunDevice(registry2, ctx, flow, params, flowsDir);
152419
+ const resolved = await resolveRunDevice(registry2, ctx, flow, params, flowsDir, viaUpload);
152174
152420
  const device = resolved.device;
152175
152421
  const statusBarPinned = device !== null && await pinStatusBar(device);
152176
152422
  if (device?.platform === "chromium") await frontChromiumPage(registry2, device);
@@ -152180,7 +152426,7 @@ returns a notice with the prerequisite instead of running.`,
152180
152426
  device,
152181
152427
  signal,
152182
152428
  flowsDir,
152183
- topFlowName: params.name,
152429
+ baselineKey: baselineKeyFor(canonicalPath, flowName),
152184
152430
  updateBaselines: Boolean(params.updateBaselines),
152185
152431
  reports: [],
152186
152432
  stopped: false,
@@ -152192,8 +152438,7 @@ returns a notice with the prerequisite instead of running.`,
152192
152438
  let aborted2;
152193
152439
  try {
152194
152440
  await execSteps(state3, flow.steps, {
152195
- flow: params.name,
152196
- runStack: [params.name],
152441
+ runStack: [{ canonical: canonicalPath, display: flowName }],
152197
152442
  depth: 0
152198
152443
  });
152199
152444
  } finally {
@@ -152202,7 +152447,7 @@ returns a notice with the prerequisite instead of running.`,
152202
152447
  if (resolved.booted) await teardownBootedChromium(registry2, resolved.booted);
152203
152448
  }
152204
152449
  return summarize(
152205
- params.name,
152450
+ flowName,
152206
152451
  device?.id ?? "",
152207
152452
  flow.executionPrerequisite,
152208
152453
  state3.reports,
@@ -152211,11 +152456,11 @@ returns a notice with the prerequisite instead of running.`,
152211
152456
  }
152212
152457
  };
152213
152458
  }
152214
- async function resolveRunDevice(registry2, ctx, flow, params, flowDir) {
152459
+ async function resolveRunDevice(registry2, ctx, flow, params, flowDir, viaUpload) {
152215
152460
  if (!params.device) {
152216
152461
  const spec = chromiumBootSpec(flow, params.platform);
152217
152462
  if (spec) {
152218
- const booted = await bootChromiumForFlow(spec, flowDir);
152463
+ const booted = await bootChromiumForFlow(spec, flowDir, viaUpload);
152219
152464
  return { device: resolveDevice(booted.deviceId), booted };
152220
152465
  }
152221
152466
  if (!flowRequiresDevice(registry2, flow.steps)) {
@@ -152243,7 +152488,18 @@ function launchTargetPlatform(launch, platform) {
152243
152488
  }
152244
152489
  return null;
152245
152490
  }
152246
- async function bootChromiumForFlow(spec, flowDir) {
152491
+ async function bootChromiumForFlow(spec, flowDir, viaUpload) {
152492
+ if (viaUpload && !path35.isAbsolute(spec.path)) {
152493
+ throw new FailureError(
152494
+ `A relative chromium app path ("${spec.path}") resolves against the flow file's directory, which requires a co-located client and tool server \u2014 an uploaded flow has no real flow directory on this host. Use an absolute tool-server path instead.`,
152495
+ {
152496
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152497
+ failure_stage: "flow_upload_chromium_app_path",
152498
+ failure_area: "tool_server",
152499
+ error_kind: "validation"
152500
+ }
152501
+ );
152502
+ }
152247
152503
  const appPath = path35.isAbsolute(spec.path) ? spec.path : path35.resolve(flowDir, spec.path);
152248
152504
  const res = await bootElectronApp({ appPath, extraArgs: spec.args });
152249
152505
  return { deviceId: res.id, port: res.port, pid: res.pid };
@@ -152348,10 +152604,27 @@ function stepTarget(step) {
152348
152604
  }
152349
152605
  case "snapshot":
152350
152606
  return step.cropOn ? `"${step.name}" cropOn ${selectorLabel2(step.cropOn)}` : `"${step.name}"`;
152607
+ case "run":
152608
+ return step.flow;
152351
152609
  default:
152352
152610
  return void 0;
152353
152611
  }
152354
152612
  }
152613
+ function scopeFlow(scope) {
152614
+ return scope.runStack[scope.runStack.length - 1].display;
152615
+ }
152616
+ function runDisplayName(target, scope) {
152617
+ const stem = runTargetName(target);
152618
+ if (stem !== scope.runStack[0].display) return stem;
152619
+ const spelled = target.slice(0, -".yaml".length);
152620
+ return spelled === stem ? `./${stem}` : spelled;
152621
+ }
152622
+ function stepFlow(step, scope) {
152623
+ return step.kind === "run" ? runDisplayName(step.flow, scope) : scopeFlow(scope);
152624
+ }
152625
+ function scopeFlowDir(scope) {
152626
+ return path35.dirname(scope.runStack[scope.runStack.length - 1].canonical);
152627
+ }
152355
152628
  function childScope(scope, overrides = {}) {
152356
152629
  return { ...scope, ...overrides, depth: scope.depth + 1 };
152357
152630
  }
@@ -152366,7 +152639,7 @@ async function execSteps(state3, steps, scope) {
152366
152639
  index,
152367
152640
  kind: step.kind,
152368
152641
  status: "skip",
152369
- flow: scope.flow,
152642
+ flow: stepFlow(step, scope),
152370
152643
  target: stepTarget(step),
152371
152644
  ...depthOf(scope),
152372
152645
  // Carry the echo's message so a skipped narration renders as a skip
@@ -152382,7 +152655,7 @@ async function execSteps(state3, steps, scope) {
152382
152655
  index,
152383
152656
  kind: step.kind,
152384
152657
  status: "error",
152385
- flow: scope.flow,
152658
+ flow: scopeFlow(scope),
152386
152659
  target: stepTarget(step),
152387
152660
  ...depthOf(scope),
152388
152661
  reason: `step needs a device but the flow was resolved as device-free \u2014 pass an explicit device`
@@ -152397,7 +152670,7 @@ async function execSteps(state3, steps, scope) {
152397
152670
  kind: step.kind,
152398
152671
  status: "skip",
152399
152672
  reason: "run aborted",
152400
- flow: scope.flow,
152673
+ flow: stepFlow(step, scope),
152401
152674
  target: stepTarget(step),
152402
152675
  ...depthOf(scope),
152403
152676
  ...step.kind === "echo" ? { message: step.message } : {}
@@ -152431,10 +152704,7 @@ function reportBlockSkipped(state3, steps, scope, reason) {
152431
152704
  kind: step.kind,
152432
152705
  status: "skip",
152433
152706
  reason,
152434
- // A `run:` line is attributed to the fragment it names, matching the
152435
- // executed marker in execRunStep; everything else belongs to the
152436
- // enclosing flow.
152437
- flow: step.kind === "run" ? step.flow : scope.flow,
152707
+ flow: stepFlow(step, scope),
152438
152708
  target: stepTarget(step),
152439
152709
  ...depthOf(scope),
152440
152710
  ...step.kind === "echo" ? { message: step.message } : {}
@@ -152446,7 +152716,13 @@ async function execWhenStep(state3, step, scope) {
152446
152716
  const index = state3.reports.length;
152447
152717
  const label = describeWhenCondition(step.condition);
152448
152718
  const target = stepTarget(step);
152449
- const marker = { index, kind: "when", flow: scope.flow, target, ...depthOf(scope) };
152719
+ const marker = {
152720
+ index,
152721
+ kind: "when",
152722
+ flow: scopeFlow(scope),
152723
+ target,
152724
+ ...depthOf(scope)
152725
+ };
152450
152726
  const inner = childScope(scope);
152451
152727
  let met;
152452
152728
  if (step.condition.kind === "platform") {
@@ -152485,46 +152761,82 @@ async function execWhenStep(state3, step, scope) {
152485
152761
  pushReport(state3, { ...marker, status: "pass", reason: `condition met (${label})` });
152486
152762
  await execSteps(state3, step.steps, inner);
152487
152763
  }
152764
+ async function canonicalFlowPath(p) {
152765
+ try {
152766
+ return await fs49.realpath(p);
152767
+ } catch {
152768
+ try {
152769
+ return path35.join(await fs49.realpath(path35.dirname(p)), path35.basename(p));
152770
+ } catch {
152771
+ return p;
152772
+ }
152773
+ }
152774
+ }
152775
+ function baselineKeyFor(canonicalPath, flowName) {
152776
+ const stem = path35.basename(canonicalPath, ".yaml");
152777
+ return FLOW_NAME_PATTERN.test(stem) ? stem : flowName;
152778
+ }
152488
152779
  async function execRunStep(state3, step, scope) {
152489
152780
  const index = state3.reports.length;
152490
152781
  const target = step.flow;
152782
+ const display = runDisplayName(target, scope);
152491
152783
  const fail = (reason) => {
152492
152784
  pushReport(state3, {
152493
152785
  index,
152494
152786
  kind: "run",
152495
152787
  status: "error",
152496
- flow: target,
152788
+ flow: display,
152789
+ target,
152497
152790
  reason,
152498
152791
  ...depthOf(scope)
152499
152792
  });
152500
152793
  state3.stopped = true;
152501
152794
  };
152502
- if (scope.runStack.includes(target)) {
152503
- return fail(`cyclic flow reference: ${[...scope.runStack, target].join(" \u2192 ")}`);
152795
+ const canonical = await canonicalFlowPath(scopeFlowDir(scope) + path35.sep + target);
152796
+ if (scope.runStack.some((entry) => entry.canonical === canonical)) {
152797
+ return fail(
152798
+ `cyclic flow reference: ${[...scope.runStack.map((entry) => entry.display), display].join(" \u2192 ")}`
152799
+ );
152504
152800
  }
152505
152801
  if (scope.runStack.length >= MAX_RUN_DEPTH) {
152506
152802
  return fail("max run depth exceeded");
152507
152803
  }
152804
+ const suppliedBase = path35.posix.basename(target);
152805
+ const spelling = await classifyOnDiskSpelling(
152806
+ path35.dirname(scopeFlowDir(scope) + path35.sep + target),
152807
+ suppliedBase
152808
+ );
152809
+ if (spelling.state === "case_folded") {
152810
+ const recovery = spelling.addressable ? `reference it as "${target.slice(0, target.length - suppliedBase.length)}${spelling.actual}"` : `rename "${spelling.actual}" to "${suppliedBase}" to compose it \u2014 flow files must be lowercase .yaml`;
152811
+ return fail(
152812
+ `mis-cased fragment reference "${target}": no directory entry is named "${suppliedBase}" (this filesystem matched it case-insensitively to "${spelling.actual}"), so the fragment name keying its step reports is one nothing on disk carries and a case-sensitive checkout could not find the file at all \u2014 ${recovery}`
152813
+ );
152814
+ }
152508
152815
  let fragment;
152509
152816
  try {
152510
- assertSafeFlowName(target);
152511
- const fragPath = path35.join(state3.flowsDir, `${target}.yaml`);
152512
- fragment = parseFlow(await fs49.readFile(fragPath, "utf8"));
152817
+ fragment = parseFlow(await fs49.readFile(canonical, "utf8"));
152513
152818
  } catch (err) {
152514
152819
  return fail(`could not load fragment "${target}": ${errMsg2(err)}`);
152515
152820
  }
152516
- pushReport(state3, { index, kind: "run", status: "pass", flow: target, ...depthOf(scope) });
152821
+ pushReport(state3, {
152822
+ index,
152823
+ kind: "run",
152824
+ status: "pass",
152825
+ flow: display,
152826
+ target,
152827
+ ...depthOf(scope)
152828
+ });
152517
152829
  await execSteps(
152518
152830
  state3,
152519
152831
  fragment.steps,
152520
- childScope(scope, { flow: target, runStack: [...scope.runStack, target] })
152832
+ childScope(scope, { runStack: [...scope.runStack, { canonical, display }] })
152521
152833
  );
152522
152834
  }
152523
152835
  async function execLeafStep(state3, step, index, scope) {
152524
152836
  const base = {
152525
152837
  index,
152526
152838
  kind: step.kind,
152527
- flow: scope.flow,
152839
+ flow: scopeFlow(scope),
152528
152840
  target: stepTarget(step),
152529
152841
  ...depthOf(scope)
152530
152842
  };
@@ -152563,7 +152875,7 @@ async function execLeafStep(state3, step, index, scope) {
152563
152875
  try {
152564
152876
  const r = await runSnapshot(deviceEnv(state3), {
152565
152877
  flowsDir: state3.flowsDir,
152566
- flowName: state3.topFlowName,
152878
+ flowName: state3.baselineKey,
152567
152879
  name: step.name,
152568
152880
  maxMismatch: step.maxMismatch ?? DEFAULT_MAX_MISMATCH,
152569
152881
  updateBaselines: state3.updateBaselines,
@@ -152621,13 +152933,98 @@ async function execLeafStep(state3, step, index, scope) {
152621
152933
  function errMsg2(err) {
152622
152934
  return err instanceof Error ? err.message : String(err);
152623
152935
  }
152624
- function resolveFlowFilePath(params, fileInput) {
152625
- assertSafeFlowName(params.name);
152936
+ async function resolveFlowSource(params, fileInput, flowPathInput) {
152937
+ if (params.name === void 0 === (params.flow_path === void 0)) {
152938
+ throw new FailureError("Pass exactly one flow source: name or flow_path.", {
152939
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152940
+ failure_stage: "flow_source",
152941
+ failure_area: "tool_server",
152942
+ error_kind: "validation"
152943
+ });
152944
+ }
152626
152945
  setActiveProjectRoot(params.project_root);
152627
- const expected = getFlowPath(params.name);
152628
- if (!params.flow_file) return expected;
152629
- if (fileInput?.viaUpload) return params.flow_file;
152630
- if (!path35.isAbsolute(params.flow_file) || params.flow_file.split(/[\\/]+/).includes("..") || path35.resolve(params.flow_file) !== path35.resolve(expected)) {
152946
+ if (params.flow_path !== void 0) {
152947
+ if (flowPathInput?.viaUpload) {
152948
+ throw new FailureError(
152949
+ `Invalid flow_path "${flowPathInput.clientPath}": explicit flow paths require a co-located client and tool server with a shared filesystem, and this one arrived as an upload \u2014 sibling run: files, baselines, and baseline write-back all resolve beside the copy this server materialized, alone in a temp directory. Pass name + project_root to run a self-contained flow from a remote client; name uploads the same way, so a flow with run: or snapshot: steps needs the client and tool server on one filesystem.`,
152950
+ {
152951
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152952
+ failure_stage: "flow_path_shared_filesystem",
152953
+ failure_area: "tool_server",
152954
+ error_kind: "validation"
152955
+ }
152956
+ );
152957
+ }
152958
+ const isVerifiedHostPath = flowPathInput?.presentOnHost === true && flowPathInput.statVerified === true && path35.resolve(params.flow_path) === path35.resolve(flowPathInput.clientPath);
152959
+ if (!isVerifiedHostPath) {
152960
+ throw new FailureError(
152961
+ `Invalid flow_path "${params.flow_path}": explicit flow paths must be supplied through the flow_path file-input boundary. Pass the client-local path and let the argent client resolve it.`,
152962
+ {
152963
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152964
+ failure_stage: "flow_path_boundary",
152965
+ failure_area: "tool_server",
152966
+ error_kind: "validation"
152967
+ }
152968
+ );
152969
+ }
152970
+ if (!path35.isAbsolute(params.flow_path)) {
152971
+ throw new FailureError(
152972
+ `Invalid flow_path "${params.flow_path}": flow paths must be absolute \u2014 a relative path is resolved against the tool server's working directory, not the caller's. Pass the absolute path to the flow's YAML.`,
152973
+ {
152974
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152975
+ failure_stage: "flow_path_absolute",
152976
+ failure_area: "tool_server",
152977
+ error_kind: "validation"
152978
+ }
152979
+ );
152980
+ }
152981
+ if (params.flow_path.split(/[\\/]+/).includes("..")) {
152982
+ throw new FailureError(
152983
+ `Invalid flow_path "${params.flow_path}": flow paths must not contain ".." segments \u2014 a ".." after a symlinked directory can name a different file than the spelling suggests, and the argent client always sends fully resolved paths. Pass the fully resolved absolute path to the flow's YAML.`,
152984
+ {
152985
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152986
+ failure_stage: "flow_path_dotdot",
152987
+ failure_area: "tool_server",
152988
+ error_kind: "validation"
152989
+ }
152990
+ );
152991
+ }
152992
+ const clientPath = flowPathInput.clientPath;
152993
+ const clientExt = path35.extname(clientPath);
152994
+ const bareExtension = path35.basename(clientPath).toLowerCase() === ".yaml";
152995
+ if (!bareExtension && clientExt !== ".yaml") {
152996
+ const detail = clientExt.toLowerCase() === ".yaml" ? `flow files must use the lowercase .yaml extension, not "${clientExt}".` : `flow files must use the .yaml extension.`;
152997
+ throw new FailureError(`Invalid flow_path "${clientPath}": ${detail}`, {
152998
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
152999
+ failure_stage: "flow_path_extension",
153000
+ failure_area: "tool_server",
153001
+ error_kind: "validation"
153002
+ });
153003
+ }
153004
+ const flowName2 = bareExtension ? "" : path35.basename(clientPath, ".yaml");
153005
+ assertSafeFlowName(flowName2);
153006
+ const suppliedBase = path35.basename(clientPath);
153007
+ const spelling2 = await classifyOnDiskSpelling(path35.dirname(params.flow_path), suppliedBase);
153008
+ if (spelling2.state !== "listed") {
153009
+ const recovery = spelling2.state === "absent" ? `Pass the basename exactly as it appears on disk.` : spelling2.addressable ? `Pass flow_path with the on-disk basename "${spelling2.actual}".` : `Rename "${spelling2.actual}" to "${suppliedBase}" to run it \u2014 flow files must be lowercase .yaml.`;
153010
+ throw new FailureError(
153011
+ `Invalid flow_path "${clientPath}": the file must be named as it appears on disk \u2014 this filesystem matched "${suppliedBase}" case-insensitively` + (spelling2.state === "case_folded" ? ` to "${spelling2.actual}"` : "") + `, so the flow name (which keys the report and __baselines__/) would be one no directory entry carries. ${recovery}`,
153012
+ {
153013
+ error_code: FAILURE_CODES.FLOW_FILE_INVALID,
153014
+ failure_stage: "flow_path_casing",
153015
+ failure_area: "tool_server",
153016
+ error_kind: "validation"
153017
+ }
153018
+ );
153019
+ }
153020
+ return { filePath: params.flow_path, flowName: flowName2, viaUpload: false };
153021
+ }
153022
+ const flowName = params.name;
153023
+ assertSafeFlowName(flowName);
153024
+ const expected = getFlowPath(flowName);
153025
+ if (params.flow_file && fileInput?.viaUpload)
153026
+ return { filePath: params.flow_file, flowName, viaUpload: true };
153027
+ if (params.flow_file && (!path35.isAbsolute(params.flow_file) || params.flow_file.split(/[\\/]+/).includes("..") || path35.resolve(params.flow_file) !== path35.resolve(expected))) {
152631
153028
  throw new FailureError(
152632
153029
  `Invalid flow_file "${params.flow_file}": it must resolve to the flow's path under the project root ("${expected}"). flow_file is internal \u2014 leave it unset and pass project_root + name.`,
152633
153030
  {
@@ -152638,23 +153035,70 @@ function resolveFlowFilePath(params, fileInput) {
152638
153035
  }
152639
153036
  );
152640
153037
  }
152641
- return params.flow_file;
153038
+ const spelling = await classifyOnDiskSpelling(path35.dirname(expected), `${flowName}.yaml`);
153039
+ if (spelling.state === "case_folded") {
153040
+ const recovery = spelling.addressable ? `Pass name "${path35.basename(spelling.actual, ".yaml")}".` : `Rename "${spelling.actual}" to "${flowName}.yaml" to run it \u2014 flow files must be lowercase .yaml.`;
153041
+ throw new FailureError(
153042
+ `Invalid flow name "${flowName}": no saved flow is named "${flowName}.yaml" \u2014 this filesystem matched it case-insensitively to "${spelling.actual}", so the flow name (which keys the report and __baselines__/) would be one no directory entry carries. ` + recovery,
153043
+ {
153044
+ error_code: FAILURE_CODES.FLOW_NAME_INVALID,
153045
+ failure_stage: "flow_name_casing",
153046
+ failure_area: "tool_server",
153047
+ error_kind: "validation"
153048
+ }
153049
+ );
153050
+ }
153051
+ return { filePath: params.flow_file || expected, flowName, viaUpload: false };
152642
153052
  }
152643
153053
 
152644
153054
  // ../tool-server/src/tools/flows/flow-read-prerequisite.ts
152645
153055
  init_zod();
152646
153056
  var fs50 = __toESM(require("node:fs/promises"));
153057
+ init_src();
152647
153058
  var zodSchema65 = external_exports.object({
152648
- name: external_exports.string().describe('Name of the flow to inspect (e.g. "settings-explore")'),
153059
+ name: external_exports.string().optional().describe(
153060
+ 'Name of a saved flow to inspect from `.argent/flows` (e.g. "settings-explore"). Omit when flow_path is set.'
153061
+ ),
152649
153062
  project_root: external_exports.string().describe(
152650
- "Absolute path to the project root directory that contains `.argent/flows/<name>.yaml`."
153063
+ "Absolute path to the calling agent's project root \u2014 the cwd it is working in. With name, the saved flow is read from `.argent/flows/<name>.yaml` under this root; with flow_path, the prerequisite is read from that YAML instead, so pass the agent's cwd."
152651
153064
  ),
152652
153065
  flow_file: external_exports.string().optional().describe(
152653
153066
  "Path to the flow .yaml as readable by the tool-server. Internal \u2014 the argent client derives it from project_root and name automatically; leave unset."
153067
+ ),
153068
+ flow_path: external_exports.string().optional().describe(
153069
+ "Absolute path to a co-located flow .yaml on the client and tool server's shared filesystem. This must be supplied through the file-input boundary. Pass the same flow source here as to flow-execute, so the prerequisite you read belongs to the flow that will run; for remote reads, pass name + project_root instead."
152654
153070
  )
152655
- });
153071
+ }).superRefine((params, ctx) => {
153072
+ if (params.name === void 0 === (params.flow_path === void 0)) {
153073
+ ctx.addIssue({
153074
+ code: external_exports.ZodIssueCode.custom,
153075
+ message: "Pass exactly one flow source: name or flow_path.",
153076
+ path: ["flow_path"]
153077
+ });
153078
+ }
153079
+ });
153080
+ var inputSchema3 = {
153081
+ ...zodObjectToJsonSchema(zodSchema65),
153082
+ // Zod's JSON Schema conversion cannot represent superRefine. `oneOf` makes
153083
+ // the same exactly-one source rule visible to MCP and HTTP clients — the
153084
+ // identical addition flow-execute makes, so the pre-flight read advertises
153085
+ // the same contract as the run it precedes.
153086
+ oneOf: [{ required: ["name"] }, { required: ["flow_path"] }]
153087
+ };
152656
153088
  var fileInputs4 = [
152657
- { target: "flow_file", path: "${project_root}/.argent/flows/${name}.yaml", kind: "file" }
153089
+ {
153090
+ target: "flow_path",
153091
+ path: "${flow_path}",
153092
+ kind: "file",
153093
+ optional: true,
153094
+ unwrapWhenSet: "name"
153095
+ },
153096
+ {
153097
+ target: "flow_file",
153098
+ path: "${project_root}/.argent/flows/${name}.yaml",
153099
+ kind: "file",
153100
+ skipWhenSet: "flow_path"
153101
+ }
152658
153102
  ];
152659
153103
  var flowReadPrerequisiteTool = {
152660
153104
  id: "flow-read-prerequisite",
@@ -152663,19 +153107,25 @@ var flowReadPrerequisiteTool = {
152663
153107
  completedMsg: () => "Read flow prerequisite",
152664
153108
  failedMsg: ({ failureSignal: failureSignal2 }) => `Failed to read flow prerequisite: ${failureSignal2.error_code}`
152665
153109
  },
152666
- description: `Read the execution prerequisite of a saved flow without running it.
153110
+ description: `Read the execution prerequisite of a flow without running it \u2014 a saved flow from the .argent/flows/ directory, or an explicit boundary-managed flow_path.
152667
153111
  Returns the prerequisite description so you can verify the required state is met before calling flow-execute.
152668
- Use when you need to check what app/simulator state is required before executing a flow.
152669
- Fails if the flow file does not exist in the .argent/flows/ directory.`,
153112
+ Use when you need to check what app/simulator state is required before executing a flow; pass the same flow
153113
+ source (name or flow_path) you will pass to flow-execute, so the prerequisite you read is the contract of
153114
+ the flow that will actually run.
153115
+ Fails if the flow file does not exist.`,
152670
153116
  zodSchema: zodSchema65,
153117
+ inputSchema: inputSchema3,
152671
153118
  fileInputs: fileInputs4,
152672
153119
  services: () => ({}),
152673
153120
  async execute(_services, params, ctx) {
152674
- const filePath = resolveFlowFilePath(params, ctx?.fileInputs?.flow_file);
152675
- const fileContent = await fs50.readFile(filePath, "utf8");
152676
- const flow = parseFlow(fileContent);
153121
+ const { filePath, flowName } = await resolveFlowSource(
153122
+ params,
153123
+ ctx?.fileInputs?.flow_file,
153124
+ ctx?.fileInputs?.flow_path
153125
+ );
153126
+ const flow = parseFlow(await fs50.readFile(filePath, "utf8"));
152677
153127
  return {
152678
- flow: params.name,
153128
+ flow: flowName,
152679
153129
  executionPrerequisite: flow.executionPrerequisite
152680
153130
  };
152681
153131
  }
@@ -152730,15 +153180,15 @@ async function listDir(path40) {
152730
153180
  }
152731
153181
  var COMMAND_TIMEOUT_MS = 3e3;
152732
153182
  function runVersionCommand(cmd, args, cwd) {
152733
- return new Promise((resolve9) => {
153183
+ return new Promise((resolve10) => {
152734
153184
  const child = (0, import_node_child_process28.execFile)(cmd, args, { cwd, timeout: COMMAND_TIMEOUT_MS }, (err, stdout) => {
152735
153185
  if (err) {
152736
- resolve9(null);
153186
+ resolve10(null);
152737
153187
  return;
152738
153188
  }
152739
- resolve9(stdout.trim().replace(/^v/, ""));
153189
+ resolve10(stdout.trim().replace(/^v/, ""));
152740
153190
  });
152741
- child.on("error", () => resolve9(null));
153191
+ child.on("error", () => resolve10(null));
152742
153192
  });
152743
153193
  }
152744
153194
  var METRO_PORT_PATTERNS = [/server\s*:\s*\{[^}]*?port\s*:\s*(\d+)/s, /port\s*:\s*(\d+)/];
@@ -153439,7 +153889,7 @@ function findElementMatch(tree, match) {
153439
153889
  return { frame: candidates[0].frame, exact: candidates[0].exact };
153440
153890
  }
153441
153891
  function delay(ms) {
153442
- return new Promise((resolve9) => setTimeout(resolve9, ms));
153892
+ return new Promise((resolve10) => setTimeout(resolve10, ms));
153443
153893
  }
153444
153894
  var CAPTURE_ATTEMPTS = 8;
153445
153895
  var CAPTURE_RETRY_MS = 300;
@@ -154052,19 +154502,19 @@ function createRegistry() {
154052
154502
  // ../tool-server/src/utils/probe-argent-tool-server.ts
154053
154503
  var http4 = __toESM(require("node:http"));
154054
154504
  function probeArgentToolServer(host, port, timeoutMs = 500) {
154055
- return new Promise((resolve9) => {
154505
+ return new Promise((resolve10) => {
154056
154506
  const req = http4.request(
154057
154507
  { host, port, path: "/tools", method: "GET", timeout: timeoutMs },
154058
154508
  (res) => {
154059
154509
  const isArgentPeer = res.statusCode === 200 || res.statusCode === 401;
154060
154510
  res.resume();
154061
- resolve9(isArgentPeer);
154511
+ resolve10(isArgentPeer);
154062
154512
  }
154063
154513
  );
154064
- req.on("error", () => resolve9(false));
154514
+ req.on("error", () => resolve10(false));
154065
154515
  req.on("timeout", () => {
154066
154516
  req.destroy();
154067
- resolve9(false);
154517
+ resolve10(false);
154068
154518
  });
154069
154519
  req.end();
154070
154520
  });
@@ -154508,7 +154958,7 @@ function start() {
154508
154958
  }
154509
154959
  if (server) {
154510
154960
  const forceExit = setTimeout(() => process.exit(finalExitCode), PROCESS_TIMEOUT_MS);
154511
- await new Promise((resolve9) => server.close(() => resolve9()));
154961
+ await new Promise((resolve10) => server.close(() => resolve10()));
154512
154962
  clearTimeout(forceExit);
154513
154963
  }
154514
154964
  variantProposalStore.events.off("awaitParked", onAwaitParked);