@swmansion/argent 0.16.2-next.0 → 0.16.2-next.2

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.
@@ -34918,7 +34918,7 @@ var require_view = __commonJS({
34918
34918
  var dirname14 = path36.dirname;
34919
34919
  var basename9 = path36.basename;
34920
34920
  var extname4 = path36.extname;
34921
- var join44 = path36.join;
34921
+ var join45 = path36.join;
34922
34922
  var resolve7 = path36.resolve;
34923
34923
  module2.exports = View;
34924
34924
  function View(name, options) {
@@ -34980,12 +34980,12 @@ var require_view = __commonJS({
34980
34980
  };
34981
34981
  View.prototype.resolve = function resolve8(dir, file2) {
34982
34982
  var ext = this.ext;
34983
- var path37 = join44(dir, file2);
34983
+ var path37 = join45(dir, file2);
34984
34984
  var stat4 = tryStat(path37);
34985
34985
  if (stat4 && stat4.isFile()) {
34986
34986
  return path37;
34987
34987
  }
34988
- path37 = join44(dir, basename9(file2, ext), "index" + ext);
34988
+ path37 = join45(dir, basename9(file2, ext), "index" + ext);
34989
34989
  stat4 = tryStat(path37);
34990
34990
  if (stat4 && stat4.isFile()) {
34991
34991
  return path37;
@@ -46737,7 +46737,7 @@ var require_application = __commonJS({
46737
46737
  var finalhandler = require_finalhandler();
46738
46738
  var debug = require_src()("express:application");
46739
46739
  var View = require_view();
46740
- var http3 = require("node:http");
46740
+ var http4 = require("node:http");
46741
46741
  var methods = require_utils3().methods;
46742
46742
  var compileETag = require_utils3().compileETag;
46743
46743
  var compileQueryParser = require_utils3().compileQueryParser;
@@ -46970,7 +46970,7 @@ var require_application = __commonJS({
46970
46970
  tryRender(view, renderOptions, done);
46971
46971
  };
46972
46972
  app.listen = function listen() {
46973
- var server = http3.createServer(this);
46973
+ var server = http4.createServer(this);
46974
46974
  var args = slice.call(arguments);
46975
46975
  if (typeof args[args.length - 1] === "function") {
46976
46976
  var done = args[args.length - 1] = once(args[args.length - 1]);
@@ -47458,11 +47458,11 @@ var require_negotiator = __commonJS({
47458
47458
  var preferredMediaTypes = require_mediaType();
47459
47459
  module2.exports = Negotiator;
47460
47460
  module2.exports.Negotiator = Negotiator;
47461
- function Negotiator(request2) {
47461
+ function Negotiator(request3) {
47462
47462
  if (!(this instanceof Negotiator)) {
47463
- return new Negotiator(request2);
47463
+ return new Negotiator(request3);
47464
47464
  }
47465
- this.request = request2;
47465
+ this.request = request3;
47466
47466
  }
47467
47467
  Negotiator.prototype.charset = function charset(available) {
47468
47468
  var set2 = this.charsets(available);
@@ -57250,12 +57250,12 @@ var require_request = __commonJS({
57250
57250
  var accepts = require_accepts();
57251
57251
  var isIP = require("node:net").isIP;
57252
57252
  var typeis = require_type_is();
57253
- var http3 = require("node:http");
57253
+ var http4 = require("node:http");
57254
57254
  var fresh = require_fresh();
57255
57255
  var parseRange = require_range_parser();
57256
57256
  var parse4 = require_parseurl();
57257
57257
  var proxyaddr = require_proxy_addr();
57258
- var req = Object.create(http3.IncomingMessage.prototype);
57258
+ var req = Object.create(http4.IncomingMessage.prototype);
57259
57259
  module2.exports = req;
57260
57260
  req.get = req.header = function header(name) {
57261
57261
  if (!name) {
@@ -67309,7 +67309,7 @@ var require_send = __commonJS({
67309
67309
  var Stream2 = require("stream");
67310
67310
  var util = require("util");
67311
67311
  var extname4 = path36.extname;
67312
- var join44 = path36.join;
67312
+ var join45 = path36.join;
67313
67313
  var normalize = path36.normalize;
67314
67314
  var resolve7 = path36.resolve;
67315
67315
  var sep6 = path36.sep;
@@ -67481,7 +67481,7 @@ var require_send = __commonJS({
67481
67481
  return res;
67482
67482
  }
67483
67483
  parts = path37.split(sep6);
67484
- path37 = normalize(join44(root2, path37));
67484
+ path37 = normalize(join45(root2, path37));
67485
67485
  } else {
67486
67486
  if (UP_PATH_REGEXP.test(path37)) {
67487
67487
  debug('malicious path "%s"', path37);
@@ -67614,7 +67614,7 @@ var require_send = __commonJS({
67614
67614
  if (err) return self2.onStatError(err);
67615
67615
  return self2.error(404);
67616
67616
  }
67617
- var p = join44(path37, self2._index[i]);
67617
+ var p = join45(path37, self2._index[i]);
67618
67618
  debug('stat "%s"', p);
67619
67619
  fs46.stat(p, function(err2, stat4) {
67620
67620
  if (err2) return next(err2);
@@ -67854,7 +67854,7 @@ var require_response = __commonJS({
67854
67854
  var deprecate = require_depd()("express");
67855
67855
  var encodeUrl = require_encodeurl();
67856
67856
  var escapeHtml = require_escape_html();
67857
- var http3 = require("node:http");
67857
+ var http4 = require("node:http");
67858
67858
  var onFinished = require_on_finished();
67859
67859
  var mime = require_mime_types2();
67860
67860
  var path36 = require("node:path");
@@ -67870,7 +67870,7 @@ var require_response = __commonJS({
67870
67870
  var resolve7 = path36.resolve;
67871
67871
  var vary = require_vary();
67872
67872
  var { Buffer: Buffer2 } = require("node:buffer");
67873
- var res = Object.create(http3.ServerResponse.prototype);
67873
+ var res = Object.create(http4.ServerResponse.prototype);
67874
67874
  module2.exports = res;
67875
67875
  res.status = function status(code) {
67876
67876
  if (!Number.isInteger(code)) {
@@ -68467,7 +68467,40 @@ var require_express2 = __commonJS({
68467
68467
  }
68468
68468
  });
68469
68469
 
68470
+ // ../tool-server/src/utils/command-on-path.ts
68471
+ async function commandOnPath(name) {
68472
+ if (!/^[A-Za-z0-9_.-]+$/.test(name)) return null;
68473
+ try {
68474
+ if (process.platform === "win32") {
68475
+ const { stdout: stdout2 } = await execFileAsync("where", [name], { timeout: 2e3 });
68476
+ const cwd = import_node_path2.win32.resolve(process.cwd()).toLowerCase();
68477
+ const match = stdout2.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).find((candidate) => import_node_path2.win32.resolve(import_node_path2.win32.dirname(candidate)).toLowerCase() !== cwd);
68478
+ return match ?? null;
68479
+ }
68480
+ const { stdout } = await execFileAsync("/bin/sh", ["-c", `command -v ${name}`], {
68481
+ timeout: 2e3
68482
+ });
68483
+ const trimmed = stdout.trim();
68484
+ return trimmed || null;
68485
+ } catch {
68486
+ return null;
68487
+ }
68488
+ }
68489
+ var import_node_child_process2, import_node_util, import_node_path2, execFileAsync;
68490
+ var init_command_on_path = __esm({
68491
+ "../tool-server/src/utils/command-on-path.ts"() {
68492
+ "use strict";
68493
+ import_node_child_process2 = require("node:child_process");
68494
+ import_node_util = require("node:util");
68495
+ import_node_path2 = require("node:path");
68496
+ execFileAsync = (0, import_node_util.promisify)(import_node_child_process2.execFile);
68497
+ }
68498
+ });
68499
+
68470
68500
  // ../tool-server/src/utils/android-binary.ts
68501
+ function binFileName(name) {
68502
+ return `${name}${BIN_EXT}`;
68503
+ }
68471
68504
  async function resolveAndroidBinary(name) {
68472
68505
  const now = Date.now();
68473
68506
  const cached3 = cache2.get(name);
@@ -68477,16 +68510,10 @@ async function resolveAndroidBinary(name) {
68477
68510
  return resolved;
68478
68511
  }
68479
68512
  async function probe(name) {
68480
- try {
68481
- const { stdout } = await execFileAsync("/bin/sh", ["-c", `command -v ${name}`], {
68482
- timeout: 2e3
68483
- });
68484
- const trimmed = stdout.trim();
68485
- if (trimmed) return trimmed;
68486
- } catch {
68487
- }
68513
+ const onPath = await commandOnPath(name);
68514
+ if (onPath) return onPath;
68488
68515
  for (const root2 of androidRoots()) {
68489
- const candidate = (0, import_node_path2.join)(root2, SUBDIR[name], name);
68516
+ const candidate = (0, import_node_path3.join)(root2, SUBDIR[name], binFileName(name));
68490
68517
  try {
68491
68518
  await (0, import_promises2.access)(candidate, import_node_fs3.constants.X_OK);
68492
68519
  return candidate;
@@ -68504,15 +68531,15 @@ function androidRoots() {
68504
68531
  function defaultAndroidRoots() {
68505
68532
  const home = (0, import_node_os2.homedir)();
68506
68533
  const roots = [
68507
- // Android Studio defaults (the two big ones — covers the majority of
68508
- // user installs that arrive without any env-var setup).
68509
- (0, import_node_path2.join)(home, "Library", "Android", "sdk"),
68534
+ // Android Studio defaults (the big ones — cover the majority of user
68535
+ // installs that arrive without any env-var setup).
68536
+ (0, import_node_path3.join)(home, "Library", "Android", "sdk"),
68510
68537
  // macOS Android Studio default
68511
- (0, import_node_path2.join)(home, "Android", "Sdk"),
68538
+ (0, import_node_path3.join)(home, "Android", "Sdk"),
68512
68539
  // Linux Android Studio default
68513
68540
  // Common manual install convention. Not picked by any installer but used
68514
68541
  // often enough in tutorials and Dockerfiles that probing it costs little.
68515
- (0, import_node_path2.join)(home, "android-sdk"),
68542
+ (0, import_node_path3.join)(home, "android-sdk"),
68516
68543
  // System-wide locations (Linux package managers, Homebrew on macOS).
68517
68544
  "/opt/android-sdk",
68518
68545
  "/usr/lib/android-sdk",
@@ -68520,23 +68547,27 @@ function defaultAndroidRoots() {
68520
68547
  "/usr/local/share/android-sdk"
68521
68548
  // Homebrew cask
68522
68549
  ];
68550
+ if (process.platform === "win32") {
68551
+ const localAppData = process.env.LOCALAPPDATA?.trim();
68552
+ if (localAppData) roots.push((0, import_node_path3.join)(localAppData, "Android", "Sdk"));
68553
+ roots.push((0, import_node_path3.join)(home, "AppData", "Local", "Android", "Sdk"));
68554
+ }
68523
68555
  return roots;
68524
68556
  }
68525
- var import_node_child_process2, import_promises2, import_node_fs3, import_node_os2, import_node_path2, import_node_util, execFileAsync, SUBDIR, CACHE_TTL_MS, cache2;
68557
+ var import_promises2, import_node_fs3, import_node_os2, import_node_path3, SUBDIR, BIN_EXT, CACHE_TTL_MS, cache2;
68526
68558
  var init_android_binary = __esm({
68527
68559
  "../tool-server/src/utils/android-binary.ts"() {
68528
68560
  "use strict";
68529
- import_node_child_process2 = require("node:child_process");
68530
68561
  import_promises2 = require("node:fs/promises");
68531
68562
  import_node_fs3 = require("node:fs");
68532
68563
  import_node_os2 = require("node:os");
68533
- import_node_path2 = require("node:path");
68534
- import_node_util = require("node:util");
68535
- execFileAsync = (0, import_node_util.promisify)(import_node_child_process2.execFile);
68564
+ import_node_path3 = require("node:path");
68565
+ init_command_on_path();
68536
68566
  SUBDIR = {
68537
68567
  adb: "platform-tools",
68538
68568
  emulator: "emulator"
68539
68569
  };
68570
+ BIN_EXT = process.platform === "win32" ? ".exe" : "";
68540
68571
  CACHE_TTL_MS = 6e4;
68541
68572
  cache2 = /* @__PURE__ */ new Map();
68542
68573
  }
@@ -74596,12 +74627,12 @@ var require_service = __commonJS({
74596
74627
  this.requestDelimited = Boolean(requestDelimited);
74597
74628
  this.responseDelimited = Boolean(responseDelimited);
74598
74629
  }
74599
- Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request2, callback) {
74600
- if (!request2)
74630
+ Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request3, callback) {
74631
+ if (!request3)
74601
74632
  throw TypeError("request must be specified");
74602
74633
  var self2 = this;
74603
74634
  if (!callback)
74604
- return util.asPromise(rpcCall, self2, method, requestCtor, responseCtor, request2);
74635
+ return util.asPromise(rpcCall, self2, method, requestCtor, responseCtor, request3);
74605
74636
  if (!self2.rpcImpl) {
74606
74637
  setTimeout(function() {
74607
74638
  callback(Error("already ended"));
@@ -74611,7 +74642,7 @@ var require_service = __commonJS({
74611
74642
  try {
74612
74643
  return self2.rpcImpl(
74613
74644
  method,
74614
- requestCtor[self2.requestDelimited ? "encodeDelimited" : "encode"](request2).finish(),
74645
+ requestCtor[self2.requestDelimited ? "encodeDelimited" : "encode"](request3).finish(),
74615
74646
  function rpcCallback(err, response) {
74616
74647
  if (err) {
74617
74648
  self2.emit("error", err, method);
@@ -74842,13 +74873,13 @@ var require_path = __commonJS({
74842
74873
  "../../node_modules/@protobufjs/path/index.js"(exports2) {
74843
74874
  "use strict";
74844
74875
  var path36 = exports2;
74845
- var isAbsolute5 = (
74876
+ var isAbsolute6 = (
74846
74877
  /**
74847
74878
  * Tests if the specified path is absolute.
74848
74879
  * @param {string} path Path to test
74849
74880
  * @returns {boolean} `true` if path is absolute
74850
74881
  */
74851
- path36.isAbsolute = function isAbsolute6(path37) {
74882
+ path36.isAbsolute = function isAbsolute7(path37) {
74852
74883
  return /^(?:\/|\w+:)/.test(path37);
74853
74884
  }
74854
74885
  );
@@ -74860,7 +74891,7 @@ var require_path = __commonJS({
74860
74891
  */
74861
74892
  path36.normalize = function normalize2(path37) {
74862
74893
  path37 = path37.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
74863
- var parts = path37.split("/"), absolute = isAbsolute5(path37), prefix = "";
74894
+ var parts = path37.split("/"), absolute = isAbsolute6(path37), prefix = "";
74864
74895
  if (absolute)
74865
74896
  prefix = parts.shift() + "/";
74866
74897
  for (var i = 0; i < parts.length; ) {
@@ -74882,7 +74913,7 @@ var require_path = __commonJS({
74882
74913
  path36.resolve = function resolve7(originPath, includePath, alreadyNormalized) {
74883
74914
  if (!alreadyNormalized)
74884
74915
  includePath = normalize(includePath);
74885
- if (isAbsolute5(includePath))
74916
+ if (isAbsolute6(includePath))
74886
74917
  return includePath;
74887
74918
  if (!alreadyNormalized)
74888
74919
  originPath = normalize(originPath);
@@ -75426,8 +75457,8 @@ var require_service2 = __commonJS({
75426
75457
  this.methodsArray.length; ++i) {
75427
75458
  var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, "");
75428
75459
  rpcService[methodName] = /* @__PURE__ */ (function(method2, requestType, responseType) {
75429
- return function rpcMethod(request2, callback) {
75430
- return rpc.Service.prototype.rpcCall.call(this, method2, requestType, responseType, request2, callback);
75460
+ return function rpcMethod(request3, callback) {
75461
+ return rpc.Service.prototype.rpcCall.call(this, method2, requestType, responseType, request3, callback);
75431
75462
  };
75432
75463
  })(method, method.resolvedRequestType.ctor, method.resolvedResponseType.ctor);
75433
75464
  }
@@ -81111,7 +81142,7 @@ var require_websocket = __commonJS({
81111
81142
  "use strict";
81112
81143
  var EventEmitter2 = require("events");
81113
81144
  var https = require("https");
81114
- var http3 = require("http");
81145
+ var http4 = require("http");
81115
81146
  var net6 = require("net");
81116
81147
  var tls = require("tls");
81117
81148
  var { randomBytes, createHash: createHash3 } = require("crypto");
@@ -81653,7 +81684,7 @@ var require_websocket = __commonJS({
81653
81684
  }
81654
81685
  const defaultPort = isSecure ? 443 : 80;
81655
81686
  const key = randomBytes(16).toString("base64");
81656
- const request2 = isSecure ? https.request : http3.request;
81687
+ const request3 = isSecure ? https.request : http4.request;
81657
81688
  const protocolSet = /* @__PURE__ */ new Set();
81658
81689
  let perMessageDeflate;
81659
81690
  opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
@@ -81730,12 +81761,12 @@ var require_websocket = __commonJS({
81730
81761
  if (opts.auth && !options.headers.authorization) {
81731
81762
  options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
81732
81763
  }
81733
- req = websocket._req = request2(opts);
81764
+ req = websocket._req = request3(opts);
81734
81765
  if (websocket._redirects) {
81735
81766
  websocket.emit("redirect", websocket.url, req);
81736
81767
  }
81737
81768
  } else {
81738
- req = websocket._req = request2(opts);
81769
+ req = websocket._req = request3(opts);
81739
81770
  }
81740
81771
  if (opts.timeout) {
81741
81772
  req.on("timeout", () => {
@@ -82149,7 +82180,7 @@ var require_websocket_server = __commonJS({
82149
82180
  "../../node_modules/ws/lib/websocket-server.js"(exports2, module2) {
82150
82181
  "use strict";
82151
82182
  var EventEmitter2 = require("events");
82152
- var http3 = require("http");
82183
+ var http4 = require("http");
82153
82184
  var { Duplex } = require("stream");
82154
82185
  var { createHash: createHash3 } = require("crypto");
82155
82186
  var extension2 = require_extension();
@@ -82230,8 +82261,8 @@ var require_websocket_server = __commonJS({
82230
82261
  );
82231
82262
  }
82232
82263
  if (options.port != null) {
82233
- this._server = http3.createServer((req, res) => {
82234
- const body = http3.STATUS_CODES[426];
82264
+ this._server = http4.createServer((req, res) => {
82265
+ const body = http4.STATUS_CODES[426];
82235
82266
  res.writeHead(426, {
82236
82267
  "Content-Length": body.length,
82237
82268
  "Content-Type": "text/plain"
@@ -82520,7 +82551,7 @@ var require_websocket_server = __commonJS({
82520
82551
  this.destroy();
82521
82552
  }
82522
82553
  function abortHandshake(socket, code, message, headers) {
82523
- message = message || http3.STATUS_CODES[code];
82554
+ message = message || http4.STATUS_CODES[code];
82524
82555
  headers = {
82525
82556
  Connection: "close",
82526
82557
  "Content-Type": "text/html",
@@ -82529,7 +82560,7 @@ var require_websocket_server = __commonJS({
82529
82560
  };
82530
82561
  socket.once("finish", socket.destroy);
82531
82562
  socket.end(
82532
- `HTTP/1.1 ${code} ${http3.STATUS_CODES[code]}\r
82563
+ `HTTP/1.1 ${code} ${http4.STATUS_CODES[code]}\r
82533
82564
  ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
82534
82565
  );
82535
82566
  }
@@ -82852,7 +82883,7 @@ async function emulatorSupportsFlag(flag, options = {}) {
82852
82883
  if (cached3 !== void 0) return cached3;
82853
82884
  let output;
82854
82885
  try {
82855
- const { stdout, stderr } = await execFileAsync9(emulatorPath, ["-help"], {
82886
+ const { stdout, stderr } = await execFileAsync8(emulatorPath, ["-help"], {
82856
82887
  timeout: options.timeoutMs ?? 1e4,
82857
82888
  maxBuffer: 8 * 1024 * 1024
82858
82889
  });
@@ -82879,7 +82910,7 @@ function describeAdbFailure(args, err) {
82879
82910
  async function runAdb(args, options = {}) {
82880
82911
  const adbPath = await resolveAdbOrThrow();
82881
82912
  try {
82882
- const { stdout, stderr } = await execFileAsync9(adbPath, args, {
82913
+ const { stdout, stderr } = await execFileAsync8(adbPath, args, {
82883
82914
  timeout: options.timeoutMs ?? 3e4,
82884
82915
  killSignal: ADB_KILL_SIGNAL,
82885
82916
  maxBuffer: 64 * 1024 * 1024,
@@ -82893,7 +82924,7 @@ async function runAdb(args, options = {}) {
82893
82924
  async function runAdbBinary(args, options = {}) {
82894
82925
  const adbPath = await resolveAdbOrThrow();
82895
82926
  try {
82896
- const { stdout } = await execFileAsync9(adbPath, args, {
82927
+ const { stdout } = await execFileAsync8(adbPath, args, {
82897
82928
  timeout: options.timeoutMs ?? 3e4,
82898
82929
  killSignal: ADB_KILL_SIGNAL,
82899
82930
  maxBuffer: 64 * 1024 * 1024,
@@ -83069,7 +83100,7 @@ async function listAvds() {
83069
83100
  const emulatorPath = await resolveAndroidBinary("emulator");
83070
83101
  if (!emulatorPath) return [];
83071
83102
  try {
83072
- const { stdout } = await execFileAsync9(emulatorPath, ["-list-avds"], { timeout: 5e3 });
83103
+ const { stdout } = await execFileAsync8(emulatorPath, ["-list-avds"], { timeout: 5e3 });
83073
83104
  return stdout.split("\n").map((l) => l.trim()).filter((l) => l && AVD_NAME_PATTERN.test(l)).map((name) => ({ name }));
83074
83105
  } catch {
83075
83106
  return [];
@@ -83085,7 +83116,7 @@ async function checkSnapshotLoadable(avdName, snapshotName = "default_boot", opt
83085
83116
  "-check-snapshot-loadable",
83086
83117
  snapshotName
83087
83118
  ];
83088
- const { stdout } = await execFileAsync9(emulatorPath, args, {
83119
+ const { stdout } = await execFileAsync8(emulatorPath, args, {
83089
83120
  timeout: options.timeoutMs ?? 1e4,
83090
83121
  maxBuffer: 4 * 1024 * 1024
83091
83122
  });
@@ -83101,7 +83132,7 @@ async function checkSnapshotLoadable(avdName, snapshotName = "default_boot", opt
83101
83132
  }
83102
83133
  }
83103
83134
  function avdRootCandidates() {
83104
- const home = process.env.HOME ?? "";
83135
+ const home = (0, import_node_os5.homedir)();
83105
83136
  const candidates = [
83106
83137
  process.env.ANDROID_USER_HOME ? `${process.env.ANDROID_USER_HOME}/avd` : null,
83107
83138
  process.env.ANDROID_AVD_HOME,
@@ -83109,7 +83140,7 @@ function avdRootCandidates() {
83109
83140
  process.env.ANDROID_SDK_HOME ? `${process.env.ANDROID_SDK_HOME}/.android/avd` : null,
83110
83141
  home ? `${home}/.android/avd` : null
83111
83142
  ];
83112
- return candidates.filter((p) => Boolean(p && p.startsWith("/")));
83143
+ return candidates.filter((p) => Boolean(p && (0, import_node_path6.isAbsolute)(p)));
83113
83144
  }
83114
83145
  async function resolveAvdPath(avdName) {
83115
83146
  const { readFile: readFile11 } = await import("node:fs/promises");
@@ -83119,7 +83150,7 @@ async function resolveAvdPath(avdName) {
83119
83150
  const raw = (0, import_ini.parse)(content).path;
83120
83151
  if (typeof raw !== "string") continue;
83121
83152
  const trimmed = raw.trim();
83122
- if (!trimmed.startsWith("/")) continue;
83153
+ if (!(0, import_node_path6.isAbsolute)(trimmed)) continue;
83123
83154
  return trimmed;
83124
83155
  } catch {
83125
83156
  }
@@ -83143,17 +83174,19 @@ async function hasDefaultBootSnapshot(avdName) {
83143
83174
  return false;
83144
83175
  }
83145
83176
  }
83146
- var import_node_child_process11, import_node_util9, import_ini, execFileAsync9, emulatorFlagSupportCache, ADB_KILL_SIGNAL, ADB_DEVICE_STATES, ADB_DEVICES_TIMEOUT_MS, ENRICH_TIMEOUT_MS, androidRuntimeKindCache, TERMINAL_ADB_ERROR_PATTERNS, AVD_NAME_PATTERN;
83177
+ var import_node_child_process10, import_node_util8, import_node_os5, import_node_path6, import_ini, execFileAsync8, emulatorFlagSupportCache, ADB_KILL_SIGNAL, ADB_DEVICE_STATES, ADB_DEVICES_TIMEOUT_MS, ENRICH_TIMEOUT_MS, androidRuntimeKindCache, TERMINAL_ADB_ERROR_PATTERNS, AVD_NAME_PATTERN;
83147
83178
  var init_adb = __esm({
83148
83179
  "../tool-server/src/utils/adb.ts"() {
83149
83180
  "use strict";
83150
- import_node_child_process11 = require("node:child_process");
83151
- import_node_util9 = require("node:util");
83181
+ import_node_child_process10 = require("node:child_process");
83182
+ import_node_util8 = require("node:util");
83183
+ import_node_os5 = require("node:os");
83184
+ import_node_path6 = require("node:path");
83152
83185
  import_ini = __toESM(require_ini());
83153
83186
  init_src();
83154
83187
  init_android_binary();
83155
83188
  init_subprocess_error();
83156
- execFileAsync9 = (0, import_node_util9.promisify)(import_node_child_process11.execFile);
83189
+ execFileAsync8 = (0, import_node_util8.promisify)(import_node_child_process10.execFile);
83157
83190
  emulatorFlagSupportCache = /* @__PURE__ */ new Map();
83158
83191
  ADB_KILL_SIGNAL = "SIGKILL";
83159
83192
  ADB_DEVICE_STATES = /* @__PURE__ */ new Set([
@@ -84386,7 +84419,7 @@ var require_common3 = __commonJS({
84386
84419
  }
84387
84420
  var path36 = require("path");
84388
84421
  var minimatch = require_minimatch();
84389
- var isAbsolute5 = require_path_is_absolute();
84422
+ var isAbsolute6 = require_path_is_absolute();
84390
84423
  var Minimatch = minimatch.Minimatch;
84391
84424
  function alphasorti(a, b) {
84392
84425
  return a.toLowerCase().localeCompare(b.toLowerCase());
@@ -84529,7 +84562,7 @@ var require_common3 = __commonJS({
84529
84562
  var abs = f;
84530
84563
  if (f.charAt(0) === "/") {
84531
84564
  abs = path36.join(self2.root, f);
84532
- } else if (isAbsolute5(f) || f === "") {
84565
+ } else if (isAbsolute6(f) || f === "") {
84533
84566
  abs = f;
84534
84567
  } else if (self2.changedCwd) {
84535
84568
  abs = path36.resolve(self2.cwd, f);
@@ -84567,7 +84600,7 @@ var require_sync = __commonJS({
84567
84600
  var util = require("util");
84568
84601
  var path36 = require("path");
84569
84602
  var assert2 = require("assert");
84570
- var isAbsolute5 = require_path_is_absolute();
84603
+ var isAbsolute6 = require_path_is_absolute();
84571
84604
  var common = require_common3();
84572
84605
  var alphasort = common.alphasort;
84573
84606
  var alphasorti = common.alphasorti;
@@ -84641,8 +84674,8 @@ var require_sync = __commonJS({
84641
84674
  var read;
84642
84675
  if (prefix === null)
84643
84676
  read = ".";
84644
- else if (isAbsolute5(prefix) || isAbsolute5(pattern.join("/"))) {
84645
- if (!prefix || !isAbsolute5(prefix))
84677
+ else if (isAbsolute6(prefix) || isAbsolute6(pattern.join("/"))) {
84678
+ if (!prefix || !isAbsolute6(prefix))
84646
84679
  prefix = "/" + prefix;
84647
84680
  read = prefix;
84648
84681
  } else
@@ -84827,7 +84860,7 @@ var require_sync = __commonJS({
84827
84860
  this.matches[index] = /* @__PURE__ */ Object.create(null);
84828
84861
  if (!exists2)
84829
84862
  return;
84830
- if (prefix && isAbsolute5(prefix) && !this.nomount) {
84863
+ if (prefix && isAbsolute6(prefix) && !this.nomount) {
84831
84864
  var trail = /[\/\\]$/.test(prefix);
84832
84865
  if (prefix.charAt(0) === "/") {
84833
84866
  prefix = path36.join(this.root, prefix);
@@ -84947,7 +84980,7 @@ var require_glob = __commonJS({
84947
84980
  var EE = require("events").EventEmitter;
84948
84981
  var path36 = require("path");
84949
84982
  var assert2 = require("assert");
84950
- var isAbsolute5 = require_path_is_absolute();
84983
+ var isAbsolute6 = require_path_is_absolute();
84951
84984
  var globSync = require_sync();
84952
84985
  var common = require_common3();
84953
84986
  var alphasort = common.alphasort;
@@ -85161,8 +85194,8 @@ var require_glob = __commonJS({
85161
85194
  var read;
85162
85195
  if (prefix === null)
85163
85196
  read = ".";
85164
- else if (isAbsolute5(prefix) || isAbsolute5(pattern.join("/"))) {
85165
- if (!prefix || !isAbsolute5(prefix))
85197
+ else if (isAbsolute6(prefix) || isAbsolute6(pattern.join("/"))) {
85198
+ if (!prefix || !isAbsolute6(prefix))
85166
85199
  prefix = "/" + prefix;
85167
85200
  read = prefix;
85168
85201
  } else
@@ -85394,7 +85427,7 @@ var require_glob = __commonJS({
85394
85427
  this.matches[index] = /* @__PURE__ */ Object.create(null);
85395
85428
  if (!exists2)
85396
85429
  return cb();
85397
- if (prefix && isAbsolute5(prefix) && !this.nomount) {
85430
+ if (prefix && isAbsolute6(prefix) && !this.nomount) {
85398
85431
  var trail = /[\/\\]$/.test(prefix);
85399
85432
  if (prefix.charAt(0) === "/") {
85400
85433
  prefix = path36.join(this.root, prefix);
@@ -87231,7 +87264,7 @@ var require_util2 = __commonJS({
87231
87264
  }
87232
87265
  path36 = url2.path;
87233
87266
  }
87234
- var isAbsolute5 = exports2.isAbsolute(path36);
87267
+ var isAbsolute6 = exports2.isAbsolute(path36);
87235
87268
  var parts = [];
87236
87269
  var start2 = 0;
87237
87270
  var i = 0;
@@ -87266,7 +87299,7 @@ var require_util2 = __commonJS({
87266
87299
  }
87267
87300
  path36 = parts.join("/");
87268
87301
  if (path36 === "") {
87269
- path36 = isAbsolute5 ? "/" : ".";
87302
+ path36 = isAbsolute6 ? "/" : ".";
87270
87303
  }
87271
87304
  if (url2) {
87272
87305
  url2.path = path36;
@@ -87275,7 +87308,7 @@ var require_util2 = __commonJS({
87275
87308
  return path36;
87276
87309
  });
87277
87310
  exports2.normalize = normalize;
87278
- function join44(aRoot, aPath) {
87311
+ function join45(aRoot, aPath) {
87279
87312
  if (aRoot === "") {
87280
87313
  aRoot = ".";
87281
87314
  }
@@ -87307,7 +87340,7 @@ var require_util2 = __commonJS({
87307
87340
  }
87308
87341
  return joined;
87309
87342
  }
87310
- exports2.join = join44;
87343
+ exports2.join = join45;
87311
87344
  exports2.isAbsolute = function(aPath) {
87312
87345
  return aPath.charAt(0) === "/" || urlRegexp.test(aPath);
87313
87346
  };
@@ -87521,7 +87554,7 @@ var require_util2 = __commonJS({
87521
87554
  parsed.path = parsed.path.substring(0, index + 1);
87522
87555
  }
87523
87556
  }
87524
- sourceURL = join44(urlGenerate(parsed), sourceURL);
87557
+ sourceURL = join45(urlGenerate(parsed), sourceURL);
87525
87558
  }
87526
87559
  return normalize(sourceURL);
87527
87560
  }
@@ -98699,7 +98732,7 @@ __export(index_exports, {
98699
98732
  });
98700
98733
  module.exports = __toCommonJS(index_exports);
98701
98734
  var path35 = __toESM(require("node:path"));
98702
- var import_node_os12 = require("node:os");
98735
+ var import_node_os14 = require("node:os");
98703
98736
 
98704
98737
  // ../configuration-core/src/flags.ts
98705
98738
  var fs = __toESM(require("node:fs"), 1);
@@ -103895,7 +103928,7 @@ var ALLOWED = {
103895
103928
  },
103896
103929
  "toolserver:start": {},
103897
103930
  "toolserver:stop": {
103898
- reason: oneOf(["idle", "signal", "crash"]),
103931
+ reason: oneOf(["idle", "signal", "crash", "deferred"]),
103899
103932
  uptime_ms: DURATION_MS,
103900
103933
  total_tool_calls: COUNT,
103901
103934
  ...FAILURE_SIGNAL2,
@@ -104768,6 +104801,9 @@ function hostPlatformKey() {
104768
104801
  }
104769
104802
  return process.platform;
104770
104803
  }
104804
+ function simulatorServerBinaryName() {
104805
+ return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
104806
+ }
104771
104807
  function platformBinDir() {
104772
104808
  return path5.join(BIN_DIR, hostPlatformKey());
104773
104809
  }
@@ -104775,12 +104811,13 @@ function tcpBinDir() {
104775
104811
  return process.env.ARGENT_SIMULATOR_SERVER_TCP_DIR ?? path5.join(BIN_DIR, "tcp");
104776
104812
  }
104777
104813
  function simulatorServerBinaryPath() {
104778
- const p = path5.join(platformBinDir(), "simulator-server");
104814
+ const binaryName = simulatorServerBinaryName();
104815
+ const p = path5.join(platformBinDir(), binaryName);
104779
104816
  if (!fs3.existsSync(p)) {
104780
- const flat = path5.join(BIN_DIR, "simulator-server");
104817
+ const flat = path5.join(BIN_DIR, binaryName);
104781
104818
  const migrationHint = fs3.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
104782
104819
  throw new Error(
104783
- `simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64).${migrationHint}`
104820
+ `simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
104784
104821
  );
104785
104822
  }
104786
104823
  return p;
@@ -105253,8 +105290,8 @@ var import_express3 = __toESM(require_express2());
105253
105290
  var import_bytes2 = __toESM(require_bytes());
105254
105291
  var import_node_fs11 = require("node:fs");
105255
105292
  var import_promises9 = require("node:fs/promises");
105256
- var import_node_os8 = require("node:os");
105257
- var import_node_path9 = require("node:path");
105293
+ var import_node_os9 = require("node:os");
105294
+ var import_node_path11 = require("node:path");
105258
105295
  var import_node_crypto6 = require("node:crypto");
105259
105296
  init_src();
105260
105297
  init_src();
@@ -105294,8 +105331,6 @@ function createIdleTimer(timeoutMs, onIdle) {
105294
105331
  }
105295
105332
 
105296
105333
  // ../tool-server/src/utils/check-deps.ts
105297
- var import_node_child_process5 = require("node:child_process");
105298
- var import_node_util4 = require("node:util");
105299
105334
  init_src();
105300
105335
  init_android_binary();
105301
105336
 
@@ -105305,7 +105340,7 @@ var import_node_util3 = require("node:util");
105305
105340
  var import_node_fs5 = require("node:fs");
105306
105341
  var import_promises3 = require("node:fs/promises");
105307
105342
  var import_node_os3 = require("node:os");
105308
- var import_node_path3 = require("node:path");
105343
+ var import_node_path4 = require("node:path");
105309
105344
  init_src();
105310
105345
  init_subprocess_error();
105311
105346
 
@@ -105378,6 +105413,7 @@ async function listRunningVvdPids() {
105378
105413
  }
105379
105414
 
105380
105415
  // ../tool-server/src/utils/vega-cli.ts
105416
+ init_command_on_path();
105381
105417
  var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process4.execFile);
105382
105418
  var VEGA_BINARY_TTL_MS = 6e4;
105383
105419
  var cachedVegaBinary;
@@ -105389,24 +105425,13 @@ async function isExecutable(p) {
105389
105425
  return false;
105390
105426
  }
105391
105427
  }
105392
- async function commandOnPath(name) {
105393
- try {
105394
- const { stdout } = await execFileAsync3("/bin/sh", ["-c", `command -v ${name}`], {
105395
- timeout: 2e3
105396
- });
105397
- const path36 = stdout.trim();
105398
- return path36 || null;
105399
- } catch {
105400
- return null;
105401
- }
105402
- }
105403
105428
  async function resolveVegaBinary() {
105404
105429
  const now = Date.now();
105405
105430
  if (cachedVegaBinary && now - cachedVegaBinary.checkedAt < VEGA_BINARY_TTL_MS) {
105406
105431
  return cachedVegaBinary.path;
105407
105432
  }
105408
105433
  const onPath = await commandOnPath("vega") ?? await commandOnPath("kepler");
105409
- const fallback = (0, import_node_path3.join)((0, import_node_os3.homedir)(), "vega", "bin", "vega");
105434
+ const fallback = (0, import_node_path4.join)((0, import_node_os3.homedir)(), "vega", "bin", "vega");
105410
105435
  const path36 = onPath ?? (await isExecutable(fallback) ? fallback : null);
105411
105436
  cachedVegaBinary = { path: path36, checkedAt: now };
105412
105437
  return path36;
@@ -105686,7 +105711,7 @@ async function vegaDevice(serial, subcommand, options = {}) {
105686
105711
  }
105687
105712
 
105688
105713
  // ../tool-server/src/utils/check-deps.ts
105689
- var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process5.execFile);
105714
+ init_command_on_path();
105690
105715
  var DependencyMissingError = class extends Error {
105691
105716
  missing;
105692
105717
  constructor(missing, message) {
@@ -105717,12 +105742,7 @@ async function probe2(dep) {
105717
105742
  if (dep === "vega") {
105718
105743
  return await resolveVegaBinary() !== null;
105719
105744
  }
105720
- try {
105721
- await execFileAsync4("/bin/sh", ["-c", `command -v ${dep}`], { timeout: 2e3 });
105722
- return true;
105723
- } catch {
105724
- return false;
105725
- }
105745
+ return await commandOnPath(dep) !== null;
105726
105746
  }
105727
105747
  async function isAvailable(dep) {
105728
105748
  const now = Date.now();
@@ -105806,7 +105826,7 @@ function toSimulatorNetworkError(toolLabel, err, apiUrl, fallbackHint) {
105806
105826
  // ../tool-server/src/utils/update-checker.ts
105807
105827
  var import_node_fs6 = __toESM(require("node:fs"));
105808
105828
  var import_node_os4 = __toESM(require("node:os"));
105809
- var import_node_path4 = __toESM(require("node:path"));
105829
+ var import_node_path5 = __toESM(require("node:path"));
105810
105830
  var import_semver = __toESM(require_semver2());
105811
105831
 
105812
105832
  // ../tool-server/package.json
@@ -105818,7 +105838,7 @@ var PACKAGE_NAME = "@swmansion/argent";
105818
105838
  var REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}`;
105819
105839
  var CHECK_INTERVAL_MS = 60 * 60 * 1e3 * 24;
105820
105840
  function getSuppressionFilePath() {
105821
- return import_node_path4.default.join(import_node_os4.default.homedir(), ".argent", "update-suppression.json");
105841
+ return import_node_path5.default.join(import_node_os4.default.homedir(), ".argent", "update-suppression.json");
105822
105842
  }
105823
105843
  function loadSuppressUntil() {
105824
105844
  try {
@@ -105832,7 +105852,7 @@ function loadSuppressUntil() {
105832
105852
  }
105833
105853
  function persistSuppressUntil(value) {
105834
105854
  const filePath = getSuppressionFilePath();
105835
- import_node_fs6.default.mkdirSync(import_node_path4.default.dirname(filePath), { recursive: true });
105855
+ import_node_fs6.default.mkdirSync(import_node_path5.default.dirname(filePath), { recursive: true });
105836
105856
  import_node_fs6.default.writeFileSync(filePath, JSON.stringify({ suppressUntil: value }));
105837
105857
  }
105838
105858
  var state2 = {
@@ -105926,12 +105946,12 @@ ACTION REQUIRED: Save a note (via TODO, task list) that an Argent update to v${l
105926
105946
 
105927
105947
  // ../tool-server/src/preview.ts
105928
105948
  var import_node_fs9 = __toESM(require("node:fs"));
105929
- var import_node_os6 = __toESM(require("node:os"));
105930
- var import_node_path6 = __toESM(require("node:path"));
105949
+ var import_node_os7 = __toESM(require("node:os"));
105950
+ var import_node_path8 = __toESM(require("node:path"));
105931
105951
  var import_express = __toESM(require_express2());
105932
105952
 
105933
105953
  // ../tool-server/src/blueprints/simulator-server.ts
105934
- var import_node_child_process10 = require("node:child_process");
105954
+ var import_node_child_process9 = require("node:child_process");
105935
105955
  var readline2 = __toESM(require("node:readline"));
105936
105956
  init_src();
105937
105957
 
@@ -105942,23 +105962,23 @@ var readline = __toESM(require("node:readline"));
105942
105962
  init_src();
105943
105963
 
105944
105964
  // ../tool-server/src/utils/ios-host.ts
105945
- var import_node_child_process9 = require("node:child_process");
105965
+ var import_node_child_process8 = require("node:child_process");
105946
105966
  var import_node_events = require("node:events");
105947
105967
  var fs7 = __toESM(require("node:fs"));
105948
105968
  var path8 = __toESM(require("node:path"));
105949
- var import_node_util8 = require("node:util");
105969
+ var import_node_util7 = require("node:util");
105950
105970
 
105951
105971
  // ../tool-server/src/utils/simctl-config.ts
105952
105972
  var SIMCTL_SPAWN_TIMEOUT_MS = 1e4;
105953
105973
  var SIMCTL_KILL_SIGNAL = "SIGKILL";
105954
105974
 
105955
105975
  // ../tool-server/src/utils/ios-devices.ts
105956
- var import_node_child_process6 = require("node:child_process");
105957
- var import_node_util5 = require("node:util");
105958
- var execFileAsync5 = (0, import_node_util5.promisify)(import_node_child_process6.execFile);
105976
+ var import_node_child_process5 = require("node:child_process");
105977
+ var import_node_util4 = require("node:util");
105978
+ var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process5.execFile);
105959
105979
  async function listIosSimulators() {
105960
105980
  try {
105961
- const { stdout } = await execFileAsync5("xcrun", ["simctl", "list", "devices", "--json"], {
105981
+ const { stdout } = await execFileAsync4("xcrun", ["simctl", "list", "devices", "--json"], {
105962
105982
  timeout: 1e4,
105963
105983
  killSignal: SIMCTL_KILL_SIGNAL
105964
105984
  });
@@ -106005,11 +106025,11 @@ function getCachedSimulatorRuntimeKind(udid) {
106005
106025
  var fsAsync = __toESM(require("node:fs/promises"));
106006
106026
  var os3 = __toESM(require("node:os"));
106007
106027
  var path7 = __toESM(require("node:path"));
106008
- var import_node_child_process7 = require("node:child_process");
106009
- var import_node_util6 = require("node:util");
106010
- var execFileAsync6 = (0, import_node_util6.promisify)(import_node_child_process7.execFile);
106028
+ var import_node_child_process6 = require("node:child_process");
106029
+ var import_node_util5 = require("node:util");
106030
+ var execFileAsync5 = (0, import_node_util5.promisify)(import_node_child_process6.execFile);
106011
106031
  async function ensureAutomationEnabled(udid) {
106012
- await execFileAsync6(
106032
+ await execFileAsync5(
106013
106033
  "xcrun",
106014
106034
  [
106015
106035
  "simctl",
@@ -106026,7 +106046,7 @@ async function ensureAutomationEnabled(udid) {
106026
106046
  );
106027
106047
  }
106028
106048
  async function isEntitlementBypassActive(udid) {
106029
- return execFileAsync6(
106049
+ return execFileAsync5(
106030
106050
  "xcrun",
106031
106051
  [
106032
106052
  "simctl",
@@ -106053,7 +106073,7 @@ async function setAccessibilityPrefsPreBoot(udid) {
106053
106073
  await fsAsync.mkdir(path7.dirname(plistPath), { recursive: true });
106054
106074
  const exists2 = await fsAsync.access(plistPath).then(() => true).catch(() => false);
106055
106075
  if (!exists2) {
106056
- await execFileAsync6("plutil", ["-create", "binary1", plistPath]);
106076
+ await execFileAsync5("plutil", ["-create", "binary1", plistPath]);
106057
106077
  }
106058
106078
  for (const key of [
106059
106079
  "AutomationEnabled",
@@ -106061,13 +106081,13 @@ async function setAccessibilityPrefsPreBoot(udid) {
106061
106081
  "AccessibilityEnabled",
106062
106082
  "ApplicationAccessibilityEnabled"
106063
106083
  ]) {
106064
- await execFileAsync6("plutil", ["-replace", key, "-bool", "true", plistPath]);
106084
+ await execFileAsync5("plutil", ["-replace", key, "-bool", "true", plistPath]);
106065
106085
  }
106066
106086
  }
106067
106087
 
106068
106088
  // ../tool-server/src/utils/sim-remote.ts
106069
- var import_node_child_process8 = require("node:child_process");
106070
- var import_node_util7 = require("node:util");
106089
+ var import_node_child_process7 = require("node:child_process");
106090
+ var import_node_util6 = require("node:util");
106071
106091
 
106072
106092
  // ../tool-server/src/utils/device-info.ts
106073
106093
  var IOS_UDID_SHAPE = /^[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}$/;
@@ -106107,11 +106127,11 @@ function chromiumIdFromPort(port) {
106107
106127
  }
106108
106128
 
106109
106129
  // ../tool-server/src/utils/sim-remote.ts
106110
- var execFileAsync7 = (0, import_node_util7.promisify)(import_node_child_process8.execFile);
106130
+ var execFileAsync6 = (0, import_node_util6.promisify)(import_node_child_process7.execFile);
106111
106131
  var DEFAULT_TIMEOUT_MS = 3e4;
106112
106132
  async function run(args, options) {
106113
106133
  try {
106114
- const { stdout } = await execFileAsync7("sim-remote", args, {
106134
+ const { stdout } = await execFileAsync6("sim-remote", args, {
106115
106135
  timeout: options?.timeoutMs ?? DEFAULT_TIMEOUT_MS,
106116
106136
  maxBuffer: 16 * 1024 * 1024,
106117
106137
  encoding: "utf8",
@@ -106230,7 +106250,7 @@ async function moqInfo(udid) {
106230
106250
  }
106231
106251
 
106232
106252
  // ../tool-server/src/utils/ios-host.ts
106233
- var execFileAsync8 = (0, import_node_util8.promisify)(import_node_child_process9.execFile);
106253
+ var execFileAsync7 = (0, import_node_util7.promisify)(import_node_child_process8.execFile);
106234
106254
  var ARGENT_BOOTSTRAP_DYLIB_BASENAMES = /* @__PURE__ */ new Set([
106235
106255
  "libArgentInjectionBootstrap.dylib",
106236
106256
  "libInjectionBootstrap.dylib"
@@ -106260,7 +106280,7 @@ async function ensureAccessibilityEnabled(udid) {
106260
106280
  const flags = ["AccessibilityEnabled", "ApplicationAccessibilityEnabled"];
106261
106281
  await Promise.all(
106262
106282
  flags.map(
106263
- (flag) => execFileAsync8(
106283
+ (flag) => execFileAsync7(
106264
106284
  "xcrun",
106265
106285
  [
106266
106286
  "simctl",
@@ -106280,7 +106300,7 @@ async function ensureAccessibilityEnabled(udid) {
106280
106300
  }
106281
106301
  async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
106282
106302
  const bootstrapPath = await isTvOsSimulator(udid) ? bootstrapDylibPathTvos() : endpoint.transport === "tcp" ? bootstrapDylibPathTcp() : bootstrapDylibPath();
106283
- const result = await execFileAsync8(
106303
+ const result = await execFileAsync7(
106284
106304
  "xcrun",
106285
106305
  ["simctl", "spawn", udid, "launchctl", "getenv", "DYLD_INSERT_LIBRARIES"],
106286
106306
  { encoding: "utf8", timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
@@ -106288,7 +106308,7 @@ async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
106288
106308
  const existing = (result.stdout ?? "").trim();
106289
106309
  const updated = buildDyldInsertLibraries(existing, bootstrapPath);
106290
106310
  if (updated !== existing) {
106291
- await execFileAsync8(
106311
+ await execFileAsync7(
106292
106312
  "xcrun",
106293
106313
  ["simctl", "spawn", udid, "launchctl", "setenv", "DYLD_INSERT_LIBRARIES", updated],
106294
106314
  { timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
@@ -106298,7 +106318,7 @@ async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
106298
106318
  if (endpoint.port === void 0) {
106299
106319
  throw new Error("native-devtools TCP endpoint reached host setup before its port was bound");
106300
106320
  }
106301
- await execFileAsync8(
106321
+ await execFileAsync7(
106302
106322
  "xcrun",
106303
106323
  [
106304
106324
  "simctl",
@@ -106312,7 +106332,7 @@ async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
106312
106332
  { timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
106313
106333
  );
106314
106334
  } else {
106315
- await execFileAsync8(
106335
+ await execFileAsync7(
106316
106336
  "xcrun",
106317
106337
  [
106318
106338
  "simctl",
@@ -106352,7 +106372,7 @@ function parseUIKitApplicationBundleIds(stdout) {
106352
106372
  return bundleIds;
106353
106373
  }
106354
106374
  async function listRunningUIKitApplicationBundleIds(udid) {
106355
- const { stdout } = await execFileAsync8("xcrun", ["simctl", "spawn", udid, "launchctl", "list"], {
106375
+ const { stdout } = await execFileAsync7("xcrun", ["simctl", "spawn", udid, "launchctl", "list"], {
106356
106376
  encoding: "utf8",
106357
106377
  timeout: SIMCTL_SPAWN_TIMEOUT_MS,
106358
106378
  killSignal: SIMCTL_KILL_SIGNAL
@@ -106365,7 +106385,7 @@ function spawnAxDaemonLocal(udid, endpoint) {
106365
106385
  throw new Error("ax-service TCP endpoint reached spawn before its port was bound");
106366
106386
  }
106367
106387
  const endpointArgs = endpoint.transport === "tcp" ? ["--port", String(endpoint.port)] : ["--socket", endpoint.socketPath];
106368
- const proc = (0, import_node_child_process9.execFile)(
106388
+ const proc = (0, import_node_child_process8.execFile)(
106369
106389
  "xcrun",
106370
106390
  ["simctl", "spawn", udid, binaryPath, ...endpointArgs, "--timeout", "3600"],
106371
106391
  { encoding: "utf8" }
@@ -109766,22 +109786,22 @@ var Subscriber = class {
109766
109786
  const broadcast = new Broadcast();
109767
109787
  void (async () => {
109768
109788
  for (; ; ) {
109769
- const request2 = await broadcast.requested();
109770
- if (!request2)
109789
+ const request3 = await broadcast.requested();
109790
+ if (!request3)
109771
109791
  break;
109772
- void this.#runSubscribe(path36, request2);
109792
+ void this.#runSubscribe(path36, request3);
109773
109793
  }
109774
109794
  })();
109775
109795
  return broadcast;
109776
109796
  }
109777
- async #runSubscribe(broadcast, request2) {
109797
+ async #runSubscribe(broadcast, request3) {
109778
109798
  const version4 = this.#session.version;
109779
109799
  const requestId = await this.#session.nextRequestId();
109780
109800
  if (requestId === void 0) {
109781
- request2.track.close(new Error("session closed"));
109801
+ request3.track.close(new Error("session closed"));
109782
109802
  return;
109783
109803
  }
109784
- console.debug(`subscribe start: id=${requestId} broadcast=${broadcast} track=${request2.track.name}`);
109804
+ console.debug(`subscribe start: id=${requestId} broadcast=${broadcast} track=${request3.track.name}`);
109785
109805
  try {
109786
109806
  const stream = await this.#session.openBi();
109787
109807
  try {
@@ -109789,22 +109809,22 @@ var Subscriber = class {
109789
109809
  const msg = new Subscribe({
109790
109810
  requestId,
109791
109811
  trackNamespace: broadcast,
109792
- trackName: request2.track.name,
109793
- subscriberPriority: request2.priority
109812
+ trackName: request3.track.name,
109813
+ subscriberPriority: request3.priority
109794
109814
  });
109795
109815
  await msg.encode(stream.writer, version4);
109796
- console.debug(`subscribe written: id=${requestId} broadcast=${broadcast} track=${request2.track.name}`);
109797
- this.#subscribes.set(requestId, request2.track);
109816
+ console.debug(`subscribe written: id=${requestId} broadcast=${broadcast} track=${request3.track.name}`);
109817
+ this.#subscribes.set(requestId, request3.track);
109798
109818
  const respTypeId = await stream.reader.u53();
109799
109819
  if (respTypeId === SubscribeOk.id) {
109800
109820
  const ok = await SubscribeOk.decode(stream.reader, version4);
109801
109821
  if (ok.trackAlias !== requestId) {
109802
109822
  this.#subscribes.delete(requestId);
109803
- this.#subscribes.set(ok.trackAlias, request2.track);
109823
+ this.#subscribes.set(ok.trackAlias, request3.track);
109804
109824
  }
109805
- console.debug(`subscribe ok: id=${requestId} broadcast=${broadcast} track=${request2.track.name}`);
109825
+ console.debug(`subscribe ok: id=${requestId} broadcast=${broadcast} track=${request3.track.name}`);
109806
109826
  try {
109807
- await Promise.race([stream.reader.closed, request2.track.closed]);
109827
+ await Promise.race([stream.reader.closed, request3.track.closed]);
109808
109828
  if (version4 === Version.DRAFT_14 || version4 === Version.DRAFT_15 || version4 === Version.DRAFT_16) {
109809
109829
  try {
109810
109830
  await stream.writer.u53(Unsubscribe.id);
@@ -109813,9 +109833,9 @@ var Subscriber = class {
109813
109833
  } catch {
109814
109834
  }
109815
109835
  }
109816
- request2.track.close();
109836
+ request3.track.close();
109817
109837
  stream.close();
109818
- console.debug(`subscribe close: id=${requestId} broadcast=${broadcast} track=${request2.track.name}`);
109838
+ console.debug(`subscribe close: id=${requestId} broadcast=${broadcast} track=${request3.track.name}`);
109819
109839
  } finally {
109820
109840
  this.#subscribes.delete(ok.trackAlias);
109821
109841
  }
@@ -109838,8 +109858,8 @@ var Subscriber = class {
109838
109858
  }
109839
109859
  } catch (err) {
109840
109860
  const e = error51(err);
109841
- request2.track.close(e);
109842
- console.warn(`subscribe error: id=${requestId} broadcast=${broadcast} track=${request2.track.name} error=${e.message}`);
109861
+ request3.track.close(e);
109862
+ console.warn(`subscribe error: id=${requestId} broadcast=${broadcast} track=${request3.track.name} error=${e.message}`);
109843
109863
  }
109844
109864
  }
109845
109865
  /**
@@ -111381,19 +111401,19 @@ var Subscriber2 = class {
111381
111401
  const broadcast = new Broadcast();
111382
111402
  void (async () => {
111383
111403
  for (; ; ) {
111384
- const request2 = await broadcast.requested();
111385
- if (!request2)
111404
+ const request3 = await broadcast.requested();
111405
+ if (!request3)
111386
111406
  break;
111387
- void this.#runSubscribe(path36, request2);
111407
+ void this.#runSubscribe(path36, request3);
111388
111408
  }
111389
111409
  })();
111390
111410
  return broadcast;
111391
111411
  }
111392
- async #runSubscribe(broadcast, request2) {
111412
+ async #runSubscribe(broadcast, request3) {
111393
111413
  const id = this.#subscribeNext++;
111394
- this.#subscribes.set(id, request2.track);
111395
- console.debug(`subscribe start: id=${id} broadcast=${broadcast} track=${request2.track.name}`);
111396
- const msg = new Subscribe2({ id, broadcast, track: request2.track.name, priority: request2.priority });
111414
+ this.#subscribes.set(id, request3.track);
111415
+ console.debug(`subscribe start: id=${id} broadcast=${broadcast} track=${request3.track.name}`);
111416
+ const msg = new Subscribe2({ id, broadcast, track: request3.track.name, priority: request3.priority });
111397
111417
  const stream = await Stream.open(this.#quic);
111398
111418
  await stream.writer.u53(StreamId.Subscribe);
111399
111419
  await msg.encode(stream.writer, this.version);
@@ -111402,24 +111422,24 @@ var Subscriber2 = class {
111402
111422
  if (!("ok" in resp)) {
111403
111423
  throw new Error("first subscribe response must be SUBSCRIBE_OK");
111404
111424
  }
111405
- console.debug(`subscribe ok: id=${id} broadcast=${broadcast} track=${request2.track.name}`);
111406
- const waits = [stream.reader.closed, request2.track.closed];
111425
+ console.debug(`subscribe ok: id=${id} broadcast=${broadcast} track=${request3.track.name}`);
111426
+ const waits = [stream.reader.closed, request3.track.closed];
111407
111427
  switch (this.version) {
111408
111428
  case Version2.DRAFT_01:
111409
111429
  case Version2.DRAFT_02:
111410
111430
  break;
111411
111431
  default:
111412
- waits.push(this.#runPriorityUpdates(id, broadcast, request2.track, msg, stream));
111432
+ waits.push(this.#runPriorityUpdates(id, broadcast, request3.track, msg, stream));
111413
111433
  break;
111414
111434
  }
111415
111435
  await Promise.race(waits);
111416
- request2.track.close();
111436
+ request3.track.close();
111417
111437
  stream.close();
111418
- console.debug(`subscribe close: id=${id} broadcast=${broadcast} track=${request2.track.name}`);
111438
+ console.debug(`subscribe close: id=${id} broadcast=${broadcast} track=${request3.track.name}`);
111419
111439
  } catch (err) {
111420
111440
  const e = error51(err);
111421
- request2.track.close(e);
111422
- console.warn(`subscribe error: id=${id} broadcast=${broadcast} track=${request2.track.name} error=${e.message}`);
111441
+ request3.track.close(e);
111442
+ console.warn(`subscribe error: id=${id} broadcast=${broadcast} track=${request3.track.name} error=${e.message}`);
111423
111443
  stream.abort(e);
111424
111444
  } finally {
111425
111445
  this.#subscribes.delete(id);
@@ -114151,7 +114171,7 @@ function spawnSimulatorServerProcess(udid, subcommand) {
114151
114171
  const { BINARY_PATH, BINARY_DIR } = getPaths();
114152
114172
  return new Promise((resolve7, reject) => {
114153
114173
  const args = [subcommand, "--id", udid];
114154
- const proc = (0, import_node_child_process10.spawn)(BINARY_PATH, args, {
114174
+ const proc = (0, import_node_child_process9.spawn)(BINARY_PATH, args, {
114155
114175
  cwd: BINARY_DIR,
114156
114176
  stdio: ["pipe", "pipe", "pipe"]
114157
114177
  });
@@ -114368,9 +114388,10 @@ function classifyDeviceForTelemetry(deviceId) {
114368
114388
  }
114369
114389
 
114370
114390
  // ../tool-server/src/utils/device-shutdown.ts
114371
- var import_node_child_process12 = require("node:child_process");
114372
- var import_node_util10 = require("node:util");
114373
- var execFileAsync10 = (0, import_node_util10.promisify)(import_node_child_process12.execFile);
114391
+ var import_node_child_process11 = require("node:child_process");
114392
+ var import_node_util9 = require("node:util");
114393
+ init_android_binary();
114394
+ var execFileAsync9 = (0, import_node_util9.promisify)(import_node_child_process11.execFile);
114374
114395
  async function shutdownOwnedDevice(id) {
114375
114396
  let platform;
114376
114397
  try {
@@ -114379,10 +114400,11 @@ async function shutdownOwnedDevice(id) {
114379
114400
  return;
114380
114401
  }
114381
114402
  if (platform === "ios") {
114382
- await execFileAsync10("xcrun", ["simctl", "shutdown", id]).catch(() => {
114403
+ await execFileAsync9("xcrun", ["simctl", "shutdown", id]).catch(() => {
114383
114404
  });
114384
114405
  } else if (platform === "android") {
114385
- await execFileAsync10("adb", ["-s", id, "emu", "kill"]).catch(() => {
114406
+ const adb = await resolveAndroidBinary("adb") ?? "adb";
114407
+ await execFileAsync9(adb, ["-s", id, "emu", "kill"]).catch(() => {
114386
114408
  });
114387
114409
  }
114388
114410
  }
@@ -114398,11 +114420,12 @@ async function shutdownDevice(id) {
114398
114420
  }
114399
114421
  try {
114400
114422
  if (device.platform === "ios") {
114401
- await execFileAsync10("xcrun", ["simctl", "shutdown", id]);
114423
+ await execFileAsync9("xcrun", ["simctl", "shutdown", id]);
114402
114424
  return { ok: true };
114403
114425
  }
114404
114426
  if (device.platform === "android" && device.kind === "emulator") {
114405
- await execFileAsync10("adb", ["-s", id, "emu", "kill"]);
114427
+ const adb = await resolveAndroidBinary("adb") ?? "adb";
114428
+ await execFileAsync9(adb, ["-s", id, "emu", "kill"]);
114406
114429
  return { ok: true };
114407
114430
  }
114408
114431
  return {
@@ -115974,12 +115997,12 @@ init_src();
115974
115997
  // ../tool-server/src/utils/vega-sdk.ts
115975
115998
  var import_promises4 = require("node:fs/promises");
115976
115999
  var import_node_fs7 = require("node:fs");
115977
- var import_node_os5 = require("node:os");
115978
- var import_node_path5 = require("node:path");
116000
+ var import_node_os6 = require("node:os");
116001
+ var import_node_path7 = require("node:path");
115979
116002
  var import_semver2 = __toESM(require_semver2());
115980
116003
  async function readVegaConfig() {
115981
116004
  try {
115982
- const raw = await (0, import_promises4.readFile)((0, import_node_path5.join)((0, import_node_os5.homedir)(), "vega", "config.json"), "utf-8");
116005
+ const raw = await (0, import_promises4.readFile)((0, import_node_path7.join)((0, import_node_os6.homedir)(), "vega", "config.json"), "utf-8");
115983
116006
  return JSON.parse(raw);
115984
116007
  } catch {
115985
116008
  return {};
@@ -115990,13 +116013,13 @@ function bareVersion(version4) {
115990
116013
  }
115991
116014
  function sdkComponentRoots(config2) {
115992
116015
  const roots = [
115993
- config2.sdkPath && (0, import_node_path5.join)(config2.sdkPath, "vega-sdk"),
115994
- (0, import_node_path5.join)((0, import_node_os5.homedir)(), "vega", "sdk", "vega-sdk")
116016
+ config2.sdkPath && (0, import_node_path7.join)(config2.sdkPath, "vega-sdk"),
116017
+ (0, import_node_path7.join)((0, import_node_os6.homedir)(), "vega", "sdk", "vega-sdk")
115995
116018
  ].filter((p) => Boolean(p));
115996
116019
  return Array.from(new Set(roots));
115997
116020
  }
115998
116021
  async function resolveVersion(channelDir, preferred) {
115999
- if (preferred && (0, import_node_fs7.existsSync)((0, import_node_path5.join)(channelDir, preferred))) return preferred;
116022
+ if (preferred && (0, import_node_fs7.existsSync)((0, import_node_path7.join)(channelDir, preferred))) return preferred;
116000
116023
  try {
116001
116024
  const versions = (await (0, import_promises4.readdir)(channelDir)).filter((e) => import_semver2.default.valid(e)).sort(import_semver2.default.rcompare);
116002
116025
  return versions[0] ?? null;
@@ -116010,10 +116033,10 @@ async function resolveVegaSdkImagesDir() {
116010
116033
  const channel = config2.defaultChannel || "main";
116011
116034
  const preferred = bareVersion(config2.defaultVersion);
116012
116035
  for (const root2 of sdkComponentRoots(config2)) {
116013
- const channelDir = (0, import_node_path5.join)(root2, channel);
116036
+ const channelDir = (0, import_node_path7.join)(root2, channel);
116014
116037
  const version4 = await resolveVersion(channelDir, preferred);
116015
116038
  if (!version4) continue;
116016
- const imagesDir = (0, import_node_path5.join)(channelDir, version4, "vvd", "images");
116039
+ const imagesDir = (0, import_node_path7.join)(channelDir, version4, "vvd", "images");
116017
116040
  if ((0, import_node_fs7.existsSync)(imagesDir)) return imagesDir;
116018
116041
  }
116019
116042
  return null;
@@ -116023,7 +116046,7 @@ async function listVvdImages() {
116023
116046
  if (!dir) return [];
116024
116047
  try {
116025
116048
  const entries = await (0, import_promises4.readdir)(dir, { withFileTypes: true });
116026
- return entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, path: (0, import_node_path5.join)(dir, e.name) })).sort((a, b) => a.name.localeCompare(b.name));
116049
+ return entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name, path: (0, import_node_path7.join)(dir, e.name) })).sort((a, b) => a.name.localeCompare(b.name));
116027
116050
  } catch {
116028
116051
  return [];
116029
116052
  }
@@ -117956,7 +117979,7 @@ function parseUiAutomatorDump(rawOutput, screenW, screenH, options = {}) {
117956
117979
  }
117957
117980
 
117958
117981
  // ../tool-server/src/blueprints/android-devtools.ts
117959
- var import_node_child_process13 = require("node:child_process");
117982
+ var import_node_child_process12 = require("node:child_process");
117960
117983
  var readline5 = __toESM(require("node:readline"));
117961
117984
  init_src();
117962
117985
 
@@ -118515,7 +118538,7 @@ async function spawnHelper(serial) {
118515
118538
  }
118516
118539
  );
118517
118540
  }
118518
- const proc = (0, import_node_child_process13.spawn)(
118541
+ const proc = (0, import_node_child_process12.spawn)(
118519
118542
  adbPath,
118520
118543
  ["-s", serial, "shell", "am", "instrument", "-w", manifest.instrumentationRunner],
118521
118544
  { stdio: ["ignore", "pipe", "pipe"] }
@@ -118817,9 +118840,9 @@ async function describeAndroid(registry2, serial, _bundleId, isTv) {
118817
118840
  // ../tool-server/src/preview.ts
118818
118841
  function findUiFile(name) {
118819
118842
  const candidates = [
118820
- import_node_path6.default.join(__dirname, "preview-ui", name),
118821
- import_node_path6.default.resolve(__dirname, "..", "..", "..", "ui", name),
118822
- import_node_path6.default.resolve(__dirname, "..", "..", "ui", name)
118843
+ import_node_path8.default.join(__dirname, "preview-ui", name),
118844
+ import_node_path8.default.resolve(__dirname, "..", "..", "..", "ui", name),
118845
+ import_node_path8.default.resolve(__dirname, "..", "..", "ui", name)
118823
118846
  ];
118824
118847
  for (const p of candidates) {
118825
118848
  if (import_node_fs9.default.existsSync(p)) return p;
@@ -118828,7 +118851,7 @@ function findUiFile(name) {
118828
118851
  }
118829
118852
  function serveUiFile(res, filePath, contentType) {
118830
118853
  res.set("Cache-Control", "no-store, must-revalidate");
118831
- res.type(contentType).sendFile(import_node_path6.default.basename(filePath), { root: import_node_path6.default.dirname(filePath) });
118854
+ res.type(contentType).sendFile(import_node_path8.default.basename(filePath), { root: import_node_path8.default.dirname(filePath) });
118832
118855
  }
118833
118856
  function wsUrlFromHttp(httpUrl2) {
118834
118857
  const u = new URL(httpUrl2);
@@ -119143,7 +119166,7 @@ data: ${JSON.stringify(data)}
119143
119166
  const MAX_PREVIEW_BYTES = 25 * 1024 * 1024;
119144
119167
  const allowedRoots = (() => {
119145
119168
  const roots = /* @__PURE__ */ new Set();
119146
- for (const r of [import_node_os6.default.tmpdir(), process.cwd(), "/tmp"]) {
119169
+ for (const r of [import_node_os7.default.tmpdir(), process.cwd(), "/tmp"]) {
119147
119170
  try {
119148
119171
  roots.add(import_node_fs9.default.realpathSync(r));
119149
119172
  } catch {
@@ -119173,9 +119196,9 @@ data: ${JSON.stringify(data)}
119173
119196
  return;
119174
119197
  }
119175
119198
  const contained = allowedRoots.some(
119176
- (root2) => real === root2 || real.startsWith(root2 + import_node_path6.default.sep)
119199
+ (root2) => real === root2 || real.startsWith(root2 + import_node_path8.default.sep)
119177
119200
  );
119178
- const mime = IMG_MIME[import_node_path6.default.extname(real).toLowerCase()];
119201
+ const mime = IMG_MIME[import_node_path8.default.extname(real).toLowerCase()];
119179
119202
  if (!contained || !mime || size > MAX_PREVIEW_BYTES) {
119180
119203
  res.status(404).end();
119181
119204
  return;
@@ -119236,18 +119259,18 @@ data: ${JSON.stringify(data)}
119236
119259
  // ../tool-server/src/artifacts.ts
119237
119260
  var import_node_fs10 = require("node:fs");
119238
119261
  var import_promises7 = require("node:fs/promises");
119239
- var import_node_child_process15 = require("node:child_process");
119262
+ var import_node_child_process14 = require("node:child_process");
119240
119263
 
119241
119264
  // ../archive/src/index.ts
119242
- var import_node_child_process14 = require("node:child_process");
119265
+ var import_node_child_process13 = require("node:child_process");
119243
119266
  var import_promises6 = require("node:fs/promises");
119244
- var import_node_path7 = require("node:path");
119245
- var import_node_util11 = require("node:util");
119246
- var execFileAsync11 = (0, import_node_util11.promisify)(import_node_child_process14.execFile);
119267
+ var import_node_path9 = require("node:path");
119268
+ var import_node_util10 = require("node:util");
119269
+ var execFileAsync10 = (0, import_node_util10.promisify)(import_node_child_process13.execFile);
119247
119270
  var ArchiveError = class extends Error {
119248
119271
  };
119249
119272
  function createTarGzArgs(sourcePath, target) {
119250
- return ["-czf", target, "-C", (0, import_node_path7.dirname)(sourcePath), (0, import_node_path7.basename)(sourcePath)];
119273
+ return ["-czf", target, "-C", (0, import_node_path9.dirname)(sourcePath), (0, import_node_path9.basename)(sourcePath)];
119251
119274
  }
119252
119275
  function normalizeTarMemberPath(memberPath) {
119253
119276
  return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
@@ -119256,24 +119279,24 @@ function isSafeTarMember(memberPath, destDir) {
119256
119279
  const normalized = normalizeTarMemberPath(memberPath);
119257
119280
  if (!normalized || normalized === "." || normalized === "./") return false;
119258
119281
  if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
119259
- const relative4 = import_node_path7.posix.normalize(normalized);
119282
+ const relative4 = import_node_path9.posix.normalize(normalized);
119260
119283
  if (relative4 === ".." || relative4.startsWith("../") || relative4.split("/").includes("..")) {
119261
119284
  return false;
119262
119285
  }
119263
- const root2 = (0, import_node_path7.resolve)(destDir);
119264
- const resolved = (0, import_node_path7.resolve)(destDir, relative4);
119265
- return resolved === root2 || resolved.startsWith(root2 + import_node_path7.sep);
119286
+ const root2 = (0, import_node_path9.resolve)(destDir);
119287
+ const resolved = (0, import_node_path9.resolve)(destDir, relative4);
119288
+ return resolved === root2 || resolved.startsWith(root2 + import_node_path9.sep);
119266
119289
  }
119267
119290
  async function listTarMembers(tarPath) {
119268
- const { stdout } = await execFileAsync11("tar", ["-tzf", tarPath]);
119291
+ const { stdout } = await execFileAsync10("tar", ["-tzf", tarPath]);
119269
119292
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
119270
119293
  }
119271
119294
  function isEscapingLinkTarget(target) {
119272
119295
  if (target.startsWith("/") || /^[A-Za-z]:[\\/]/.test(target)) return true;
119273
- return import_node_path7.posix.normalize(target.replace(/\\/g, "/")).split("/").includes("..");
119296
+ return import_node_path9.posix.normalize(target.replace(/\\/g, "/")).split("/").includes("..");
119274
119297
  }
119275
119298
  async function assertSafeMemberTypes(tarPath) {
119276
- const { stdout } = await execFileAsync11("tar", ["-tzvf", tarPath]);
119299
+ const { stdout } = await execFileAsync10("tar", ["-tzvf", tarPath]);
119277
119300
  for (const line of stdout.split("\n")) {
119278
119301
  if (!line.trim()) continue;
119279
119302
  const type = line[0];
@@ -119315,7 +119338,7 @@ async function assertSafeArchive(tarPath, destDir) {
119315
119338
  async function resolveMember(destDir, expectedName) {
119316
119339
  const entries = await (0, import_promises6.readdir)(destDir);
119317
119340
  if (entries.includes(expectedName)) {
119318
- return (0, import_node_path7.join)(destDir, expectedName);
119341
+ return (0, import_node_path9.join)(destDir, expectedName);
119319
119342
  }
119320
119343
  const real = entries.filter((e) => !e.startsWith("._"));
119321
119344
  if (real.length !== 1) {
@@ -119323,11 +119346,11 @@ async function resolveMember(destDir, expectedName) {
119323
119346
  `Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
119324
119347
  );
119325
119348
  }
119326
- return (0, import_node_path7.join)(destDir, real[0]);
119349
+ return (0, import_node_path9.join)(destDir, real[0]);
119327
119350
  }
119328
119351
  async function safeExtractTarGz(tarPath, destDir, expectedName) {
119329
119352
  await assertSafeArchive(tarPath, destDir);
119330
- await execFileAsync11("tar", ["-xzf", tarPath, "-C", destDir]);
119353
+ await execFileAsync10("tar", ["-xzf", tarPath, "-C", destDir]);
119331
119354
  return resolveMember(destDir, expectedName);
119332
119355
  }
119333
119356
 
@@ -119379,7 +119402,7 @@ function makeArtifactListRoute(registry2) {
119379
119402
  function streamDirectoryAsTarGz(id, entry, res) {
119380
119403
  res.setHeader("Content-Type", "application/gzip");
119381
119404
  res.setHeader("Content-Disposition", `attachment; filename="${entry.filename}.tar.gz"`);
119382
- const child = (0, import_node_child_process15.spawn)("tar", createTarGzArgs(entry.path, "-"), {
119405
+ const child = (0, import_node_child_process14.spawn)("tar", createTarGzArgs(entry.path, "-"), {
119383
119406
  stdio: ["ignore", "pipe", "ignore"]
119384
119407
  });
119385
119408
  child.on("error", (err) => {
@@ -119399,8 +119422,8 @@ function streamDirectoryAsTarGz(id, entry, res) {
119399
119422
 
119400
119423
  // ../tool-server/src/file-inputs.ts
119401
119424
  var import_promises8 = require("node:fs/promises");
119402
- var import_node_os7 = require("node:os");
119403
- var import_node_path8 = require("node:path");
119425
+ var import_node_os8 = require("node:os");
119426
+ var import_node_path10 = require("node:path");
119404
119427
  var import_bytes = __toESM(require_bytes());
119405
119428
  init_src();
119406
119429
  var MAX_UPLOAD_BYTES = 32 * 1024 * 1024;
@@ -119453,8 +119476,8 @@ async function materializeUpload(wire) {
119453
119476
  `Uploaded content for "${wire.path}" is ${data.length} bytes but the client recorded ${wire.size} \u2014 refusing a truncated or corrupted upload.`
119454
119477
  );
119455
119478
  }
119456
- const dir = await (0, import_promises8.mkdtemp)((0, import_node_path8.join)((0, import_node_os7.tmpdir)(), "argent-file-input-"));
119457
- const filePath = (0, import_node_path8.join)(dir, sanitizeFilename((0, import_node_path8.basename)(wire.path)));
119479
+ const dir = await (0, import_promises8.mkdtemp)((0, import_node_path10.join)((0, import_node_os8.tmpdir)(), "argent-file-input-"));
119480
+ const filePath = (0, import_node_path10.join)(dir, sanitizeFilename((0, import_node_path10.basename)(wire.path)));
119458
119481
  await (0, import_promises8.writeFile)(filePath, data);
119459
119482
  return { filePath, dir };
119460
119483
  }
@@ -119477,10 +119500,10 @@ async function extractTarUpload(wire, uploadId, meta3, tempDirs, lookupUpload) {
119477
119500
  );
119478
119501
  }
119479
119502
  const extractDir = await (0, import_promises8.mkdtemp)(
119480
- (0, import_node_path8.join)((0, import_node_os7.tmpdir)(), `argent-tar-upload-${entry.sha256.slice(0, 16)}-`)
119503
+ (0, import_node_path10.join)((0, import_node_os8.tmpdir)(), `argent-tar-upload-${entry.sha256.slice(0, 16)}-`)
119481
119504
  );
119482
119505
  tempDirs.push(extractDir);
119483
- const uploaded = await safeExtractTarGz(entry.tarPath, extractDir, (0, import_node_path8.basename)(wire.path));
119506
+ const uploaded = await safeExtractTarGz(entry.tarPath, extractDir, (0, import_node_path10.basename)(wire.path));
119484
119507
  return { value: uploaded, meta: { ...meta3, viaUpload: true } };
119485
119508
  } catch (err) {
119486
119509
  if (err instanceof FileInputError) throw err;
@@ -120028,7 +120051,7 @@ function createHttpApp(registry2, options) {
120028
120051
  return;
120029
120052
  }
120030
120053
  const id = (0, import_node_crypto6.randomUUID)();
120031
- const tarPath = (0, import_node_path9.join)((0, import_node_os8.tmpdir)(), `argent-upload-${id}.tar.gz`);
120054
+ const tarPath = (0, import_node_path11.join)((0, import_node_os9.tmpdir)(), `argent-upload-${id}.tar.gz`);
120032
120055
  const ws = (0, import_node_fs11.createWriteStream)(tarPath);
120033
120056
  let received = 0;
120034
120057
  let released = false;
@@ -120368,12 +120391,12 @@ function createHttpApp(registry2, options) {
120368
120391
  // ../tool-server/src/event-log.ts
120369
120392
  var import_bunyan = __toESM(require_bunyan());
120370
120393
  var import_node_fs12 = require("node:fs");
120371
- var import_node_path10 = require("node:path");
120394
+ var import_node_path12 = require("node:path");
120372
120395
  init_src();
120373
120396
  function createToolServerEventLog({
120374
120397
  filePath
120375
120398
  }) {
120376
- (0, import_node_fs12.mkdirSync)((0, import_node_path10.dirname)(filePath), { recursive: true });
120399
+ (0, import_node_fs12.mkdirSync)((0, import_node_path12.dirname)(filePath), { recursive: true });
120377
120400
  (0, import_node_fs12.writeFileSync)(filePath, "");
120378
120401
  const fileStream = (0, import_node_fs12.createWriteStream)(filePath, { flags: "a" });
120379
120402
  let disposed = false;
@@ -121036,7 +121059,7 @@ var chromiumJsRuntimeDebuggerBlueprint = {
121036
121059
  // ../tool-server/src/blueprints/tv-control.ts
121037
121060
  var net4 = __toESM(require("node:net"));
121038
121061
  var fs17 = __toESM(require("node:fs"));
121039
- var import_node_child_process16 = require("node:child_process");
121062
+ var import_node_child_process15 = require("node:child_process");
121040
121063
  init_src();
121041
121064
  var TV_CONTROL_NAMESPACE = "TvControl";
121042
121065
  function tvControlRef(device) {
@@ -121092,7 +121115,7 @@ async function sendJson(socketPath, command, timeoutMs) {
121092
121115
  }
121093
121116
  }
121094
121117
  function spawnAxDaemon(udid, socketPath) {
121095
- const proc = (0, import_node_child_process16.execFile)(
121118
+ const proc = (0, import_node_child_process15.execFile)(
121096
121119
  "xcrun",
121097
121120
  [
121098
121121
  "simctl",
@@ -121111,7 +121134,7 @@ function spawnAxDaemon(udid, socketPath) {
121111
121134
  return proc;
121112
121135
  }
121113
121136
  function spawnHidDaemon(udid, socketPath) {
121114
- const proc = (0, import_node_child_process16.execFile)(
121137
+ const proc = (0, import_node_child_process15.execFile)(
121115
121138
  tvosHidDaemonBinaryPath(),
121116
121139
  ["--udid", udid, "--socket", socketPath, "--timeout", "3600"],
121117
121140
  { encoding: "utf8" }
@@ -123576,16 +123599,19 @@ function clearCachedProfilerPaths(port, deviceId) {
123576
123599
  }
123577
123600
 
123578
123601
  // ../tool-server/src/tools/devices/boot-device.ts
123579
- var import_node_child_process18 = require("node:child_process");
123580
- var import_node_util12 = require("node:util");
123602
+ var import_node_child_process17 = require("node:child_process");
123603
+ var import_node_fs13 = require("node:fs");
123604
+ var import_node_os11 = require("node:os");
123605
+ var import_node_path14 = require("node:path");
123606
+ var import_node_util11 = require("node:util");
123581
123607
  init_zod();
123582
123608
  init_src();
123583
123609
  init_adb();
123584
123610
 
123585
123611
  // ../tool-server/src/utils/linux-preflight.ts
123586
123612
  var fs19 = __toESM(require("node:fs"));
123587
- var import_node_os9 = require("node:os");
123588
- var import_node_path11 = require("node:path");
123613
+ var import_node_os10 = require("node:os");
123614
+ var import_node_path13 = require("node:path");
123589
123615
  var import_ini2 = __toESM(require_ini());
123590
123616
  function linuxBootDiagnostics(avdName) {
123591
123617
  if (process.platform !== "linux") return null;
@@ -123613,7 +123639,7 @@ function checkKvm() {
123613
123639
  var MIN_RAM_MB = 4096;
123614
123640
  var MIN_HEAP_MB = 512;
123615
123641
  function checkAvdSizing(avdName) {
123616
- const configPath = (0, import_node_path11.join)((0, import_node_os9.homedir)(), ".android", "avd", `${avdName}.avd`, "config.ini");
123642
+ const configPath = (0, import_node_path13.join)((0, import_node_os10.homedir)(), ".android", "avd", `${avdName}.avd`, "config.ini");
123617
123643
  let content;
123618
123644
  try {
123619
123645
  content = fs19.readFileSync(configPath, "utf8");
@@ -123779,7 +123805,7 @@ async function waitForVvdRunning(timeoutMs) {
123779
123805
  }
123780
123806
 
123781
123807
  // ../tool-server/src/tools/devices/boot-electron.ts
123782
- var import_node_child_process17 = require("node:child_process");
123808
+ var import_node_child_process16 = require("node:child_process");
123783
123809
  var fs20 = __toESM(require("node:fs"));
123784
123810
  var net5 = __toESM(require("node:net"));
123785
123811
  var path18 = __toESM(require("node:path"));
@@ -123942,7 +123968,7 @@ async function bootElectronApp(options) {
123942
123968
  const args = [...launcher.args, `--remote-debugging-port=${port}`, ...extra];
123943
123969
  let child;
123944
123970
  try {
123945
- child = (0, import_node_child_process17.spawn)(launcher.command, args, {
123971
+ child = (0, import_node_child_process16.spawn)(launcher.command, args, {
123946
123972
  detached: true,
123947
123973
  stdio: ["ignore", "pipe", "pipe"],
123948
123974
  // Strip ELECTRON_RUN_AS_NODE (see electronGuiChildEnv): if the tool-server
@@ -124062,7 +124088,7 @@ async function bootElectronApp(options) {
124062
124088
  }
124063
124089
 
124064
124090
  // ../tool-server/src/tools/devices/boot-device.ts
124065
- var execFileAsync12 = (0, import_node_util12.promisify)(import_node_child_process18.execFile);
124091
+ var execFileAsync11 = (0, import_node_util11.promisify)(import_node_child_process17.execFile);
124066
124092
  var zodSchema9 = external_exports.object({
124067
124093
  udid: external_exports.string().optional().describe(
124068
124094
  "iOS: simulator UDID to boot (from `list-devices`). Provide exactly one of `udid`, `avdName`, `vvdImage`, or `electronAppPath`."
@@ -124272,7 +124298,7 @@ async function bootIos(udid, registry2, force, headless) {
124272
124298
  const simState = simMatch?.state;
124273
124299
  const isTvOs = simMatch?.runtimeKind === "tv";
124274
124300
  if (force && simState === "Booted") {
124275
- await execFileAsync12("xcrun", ["simctl", "shutdown", udid]);
124301
+ await execFileAsync11("xcrun", ["simctl", "shutdown", udid]);
124276
124302
  }
124277
124303
  const needsPreBoot = simState === "Shutdown" || force && simState === "Booted";
124278
124304
  if (needsPreBoot) {
@@ -124283,13 +124309,13 @@ async function bootIos(udid, registry2, force, headless) {
124283
124309
  );
124284
124310
  });
124285
124311
  }
124286
- await execFileAsync12("xcrun", ["simctl", "boot", udid]).catch((err) => {
124312
+ await execFileAsync11("xcrun", ["simctl", "boot", udid]).catch((err) => {
124287
124313
  const message = err instanceof Error ? err.message : String(err);
124288
124314
  if (!message.includes("Unable to boot device in current state: Booted")) {
124289
124315
  throw err;
124290
124316
  }
124291
124317
  });
124292
- await execFileAsync12("xcrun", ["simctl", "bootstatus", udid, "-b"]);
124318
+ await execFileAsync11("xcrun", ["simctl", "bootstatus", udid, "-b"]);
124293
124319
  if (isTvOs && needsPreBoot) {
124294
124320
  await registry2.disposeService(`${TV_CONTROL_NAMESPACE}:${udid}`).catch((err) => {
124295
124321
  if (err instanceof ServiceNotFoundError) return;
@@ -124316,7 +124342,7 @@ async function bootIos(udid, registry2, force, headless) {
124316
124342
  if (initFailure?.givenUp) {
124317
124343
  return buildInitFailedResult(udid, initFailure);
124318
124344
  }
124319
- await execFileAsync12("defaults", [
124345
+ await execFileAsync11("defaults", [
124320
124346
  "write",
124321
124347
  "com.apple.iphonesimulator",
124322
124348
  "CurrentDeviceUDID",
@@ -124324,7 +124350,7 @@ async function bootIos(udid, registry2, force, headless) {
124324
124350
  ]).catch(() => {
124325
124351
  });
124326
124352
  if (!headless && !iosHeadlessFromEnv()) {
124327
- await execFileAsync12("open", ["-a", "Simulator.app"]).catch(() => execFileAsync12("open", ["-b", "com.apple.dt.Devices"])).catch(() => {
124353
+ await execFileAsync11("open", ["-a", "Simulator.app"]).catch(() => execFileAsync11("open", ["-b", "com.apple.dt.Devices"])).catch(() => {
124328
124354
  });
124329
124355
  }
124330
124356
  return { platform: "ios", udid, booted: true };
@@ -124363,11 +124389,25 @@ async function bootIosRemote(id, registry2, force) {
124363
124389
  }
124364
124390
  var HOT_BOOT_BUDGET_MS = 9e4;
124365
124391
  async function attemptBoot(params) {
124366
- const child = (0, import_node_child_process18.spawn)(params.emulatorBinary, params.emulatorArgs, {
124392
+ let emulatorLogFd;
124393
+ let stdio = "ignore";
124394
+ if (process.platform === "win32") {
124395
+ const safeName = params.avdName.replace(/[^\w.-]/g, "_");
124396
+ const logPath = (0, import_node_path14.join)((0, import_node_os11.tmpdir)(), `argent-emulator-${safeName}.log`);
124397
+ emulatorLogFd = (0, import_node_fs13.openSync)(logPath, "w");
124398
+ stdio = ["ignore", emulatorLogFd, emulatorLogFd];
124399
+ }
124400
+ const child = (0, import_node_child_process17.spawn)(params.emulatorBinary, params.emulatorArgs, {
124367
124401
  detached: true,
124368
- stdio: "ignore"
124402
+ stdio
124369
124403
  });
124370
124404
  child.unref();
124405
+ if (emulatorLogFd !== void 0) {
124406
+ try {
124407
+ (0, import_node_fs13.closeSync)(emulatorLogFd);
124408
+ } catch {
124409
+ }
124410
+ }
124371
124411
  let earlyExitError = null;
124372
124412
  child.on("exit", (code, signal) => {
124373
124413
  if (signal) {
@@ -124935,10 +124975,10 @@ function dispatchByPlatform(opts) {
124935
124975
  }
124936
124976
 
124937
124977
  // ../tool-server/src/tools/launch-app/platforms/ios.ts
124938
- var import_node_child_process19 = require("node:child_process");
124939
- var import_node_util13 = require("node:util");
124978
+ var import_node_child_process18 = require("node:child_process");
124979
+ var import_node_util12 = require("node:util");
124940
124980
  init_src();
124941
- var execFileAsync13 = (0, import_node_util13.promisify)(import_node_child_process19.execFile);
124981
+ var execFileAsync12 = (0, import_node_util12.promisify)(import_node_child_process18.execFile);
124942
124982
  function makeIosImpl(registry2) {
124943
124983
  return {
124944
124984
  requires: ["xcrun"],
@@ -124951,7 +124991,7 @@ function makeIosImpl(registry2) {
124951
124991
  const blocked = await precheckNativeDevtools(nativeDevtools, params.udid);
124952
124992
  if (blocked) return blocked;
124953
124993
  try {
124954
- await execFileAsync13("xcrun", ["simctl", "launch", params.udid, params.bundleId]);
124994
+ await execFileAsync12("xcrun", ["simctl", "launch", params.udid, params.bundleId]);
124955
124995
  } catch (err) {
124956
124996
  throw new FailureError(
124957
124997
  `Failed to launch iOS app ${params.bundleId} on ${params.udid}.`,
@@ -124971,9 +125011,9 @@ function makeIosImpl(registry2) {
124971
125011
  }
124972
125012
 
124973
125013
  // ../tool-server/src/utils/simctl-backend.ts
124974
- var import_node_child_process20 = require("node:child_process");
124975
- var import_node_util14 = require("node:util");
124976
- var execFileAsync14 = (0, import_node_util14.promisify)(import_node_child_process20.execFile);
125014
+ var import_node_child_process19 = require("node:child_process");
125015
+ var import_node_util13 = require("node:util");
125016
+ var execFileAsync13 = (0, import_node_util13.promisify)(import_node_child_process19.execFile);
124977
125017
  var remoteSimctl = {
124978
125018
  launch: simctlLaunch,
124979
125019
  terminate: simctlTerminate
@@ -125173,10 +125213,10 @@ Common Android packages: com.android.settings, com.android.chrome, com.google.an
125173
125213
  init_zod();
125174
125214
 
125175
125215
  // ../tool-server/src/tools/restart-app/platforms/ios.ts
125176
- var import_node_child_process21 = require("node:child_process");
125177
- var import_node_util15 = require("node:util");
125216
+ var import_node_child_process20 = require("node:child_process");
125217
+ var import_node_util14 = require("node:util");
125178
125218
  init_src();
125179
- var execFileAsync15 = (0, import_node_util15.promisify)(import_node_child_process21.execFile);
125219
+ var execFileAsync14 = (0, import_node_util14.promisify)(import_node_child_process20.execFile);
125180
125220
  function makeIosImpl2(registry2) {
125181
125221
  return {
125182
125222
  requires: ["xcrun"],
@@ -125190,11 +125230,11 @@ function makeIosImpl2(registry2) {
125190
125230
  const blocked = await precheckNativeDevtools(nativeDevtools, udid);
125191
125231
  if (blocked) return blocked;
125192
125232
  try {
125193
- await execFileAsync15("xcrun", ["simctl", "terminate", udid, bundleId]);
125233
+ await execFileAsync14("xcrun", ["simctl", "terminate", udid, bundleId]);
125194
125234
  } catch {
125195
125235
  }
125196
125236
  try {
125197
- await execFileAsync15("xcrun", ["simctl", "launch", udid, bundleId]);
125237
+ await execFileAsync14("xcrun", ["simctl", "launch", udid, bundleId]);
125198
125238
  } catch (err) {
125199
125239
  throw new FailureError(
125200
125240
  `Failed to restart iOS app ${bundleId} on ${udid}.`,
@@ -125351,22 +125391,22 @@ Returns { restarted, bundleId }. Fails if the app is not installed.`,
125351
125391
  init_zod();
125352
125392
 
125353
125393
  // ../tool-server/src/tools/reinstall-app/platforms/ios.ts
125354
- var import_node_child_process22 = require("node:child_process");
125355
- var import_node_util16 = require("node:util");
125356
- var import_node_path12 = require("node:path");
125394
+ var import_node_child_process21 = require("node:child_process");
125395
+ var import_node_util15 = require("node:util");
125396
+ var import_node_path15 = require("node:path");
125357
125397
  init_src();
125358
- var execFileAsync16 = (0, import_node_util16.promisify)(import_node_child_process22.execFile);
125398
+ var execFileAsync15 = (0, import_node_util15.promisify)(import_node_child_process21.execFile);
125359
125399
  var iosImpl = {
125360
125400
  requires: ["xcrun"],
125361
125401
  handler: async (_services, params) => {
125362
125402
  const { udid, bundleId, appPath } = params;
125363
- const absolute = (0, import_node_path12.resolve)(appPath);
125403
+ const absolute = (0, import_node_path15.resolve)(appPath);
125364
125404
  try {
125365
- await execFileAsync16("xcrun", ["simctl", "uninstall", udid, bundleId]);
125405
+ await execFileAsync15("xcrun", ["simctl", "uninstall", udid, bundleId]);
125366
125406
  } catch {
125367
125407
  }
125368
125408
  try {
125369
- await execFileAsync16("xcrun", ["simctl", "install", udid, absolute]);
125409
+ await execFileAsync15("xcrun", ["simctl", "install", udid, absolute]);
125370
125410
  } catch (err) {
125371
125411
  throw new FailureError(
125372
125412
  `Failed to install iOS app bundle on ${udid}.`,
@@ -125385,14 +125425,14 @@ var iosImpl = {
125385
125425
  };
125386
125426
 
125387
125427
  // ../tool-server/src/tools/reinstall-app/platforms/android.ts
125388
- var import_node_path13 = require("node:path");
125428
+ var import_node_path16 = require("node:path");
125389
125429
  init_src();
125390
125430
  init_adb();
125391
125431
  var androidImpl3 = {
125392
125432
  requires: ["adb"],
125393
125433
  handler: async (_services, params) => {
125394
125434
  const { udid, bundleId, appPath } = params;
125395
- const absolute = (0, import_node_path13.resolve)(appPath);
125435
+ const absolute = (0, import_node_path16.resolve)(appPath);
125396
125436
  try {
125397
125437
  await runAdb(["-s", udid, "uninstall", bundleId], { timeoutMs: 3e4 });
125398
125438
  } catch {
@@ -125414,12 +125454,12 @@ ${stderr}`;
125414
125454
  };
125415
125455
 
125416
125456
  // ../tool-server/src/tools/reinstall-app/platforms/ios-remote.ts
125417
- var import_node_path14 = require("node:path");
125457
+ var import_node_path17 = require("node:path");
125418
125458
  var iosRemoteImpl3 = {
125419
125459
  requires: ["sim-remote"],
125420
125460
  handler: async (_services, params) => {
125421
125461
  const { udid, bundleId, appPath } = params;
125422
- const absolute = (0, import_node_path14.resolve)(appPath);
125462
+ const absolute = (0, import_node_path17.resolve)(appPath);
125423
125463
  try {
125424
125464
  await simctlUninstall(udid, bundleId);
125425
125465
  } catch {
@@ -125430,13 +125470,13 @@ var iosRemoteImpl3 = {
125430
125470
  };
125431
125471
 
125432
125472
  // ../tool-server/src/tools/reinstall-app/platforms/vega.ts
125433
- var import_node_path15 = require("node:path");
125473
+ var import_node_path18 = require("node:path");
125434
125474
  init_src();
125435
125475
  var vegaImpl3 = {
125436
125476
  requires: ["vega"],
125437
125477
  handler: async (_services, params) => {
125438
125478
  const { udid, bundleId, appPath } = params;
125439
- const absolute = (0, import_node_path15.resolve)(appPath);
125479
+ const absolute = (0, import_node_path18.resolve)(appPath);
125440
125480
  await vegaDevice(udid, ["uninstall-app", "-a", bundleId], { timeoutMs: 6e4 }).catch(
125441
125481
  () => {
125442
125482
  }
@@ -125517,10 +125557,10 @@ var PERMISSION_NAMES = [
125517
125557
  ];
125518
125558
 
125519
125559
  // ../tool-server/src/tools/settings-permissions/platforms/ios.ts
125520
- var import_node_child_process23 = require("node:child_process");
125521
- var import_node_util17 = require("node:util");
125560
+ var import_node_child_process22 = require("node:child_process");
125561
+ var import_node_util16 = require("node:util");
125522
125562
  init_src();
125523
- var execFileAsync17 = (0, import_node_util17.promisify)(import_node_child_process23.execFile);
125563
+ var execFileAsync16 = (0, import_node_util16.promisify)(import_node_child_process22.execFile);
125524
125564
  var SIMCTL_ACTION = {
125525
125565
  grant: "grant",
125526
125566
  deny: "revoke",
@@ -125545,13 +125585,13 @@ var NON_TCC_GRANT_NEEDS_INSTALL = /* @__PURE__ */ new Set([
125545
125585
  ]);
125546
125586
  var localBackend = {
125547
125587
  async run(udid, simctlAction, service, bundleId) {
125548
- await execFileAsync17("xcrun", ["simctl", "privacy", udid, simctlAction, service, bundleId], {
125588
+ await execFileAsync16("xcrun", ["simctl", "privacy", udid, simctlAction, service, bundleId], {
125549
125589
  timeout: 3e4
125550
125590
  });
125551
125591
  },
125552
125592
  async isInstalled(udid, bundleId) {
125553
125593
  try {
125554
- await execFileAsync17("xcrun", ["simctl", "get_app_container", udid, bundleId], {
125594
+ await execFileAsync16("xcrun", ["simctl", "get_app_container", udid, bundleId], {
125555
125595
  timeout: 15e3
125556
125596
  });
125557
125597
  return true;
@@ -125823,8 +125863,8 @@ Returns { action, permission, bundleId, applied, skipped? }: \`applied\` lists t
125823
125863
  init_zod();
125824
125864
 
125825
125865
  // ../tool-server/src/tools/open-url/platforms/ios.ts
125826
- var import_node_child_process24 = require("node:child_process");
125827
- var import_node_util18 = require("node:util");
125866
+ var import_node_child_process23 = require("node:child_process");
125867
+ var import_node_util17 = require("node:util");
125828
125868
  init_src();
125829
125869
 
125830
125870
  // ../tool-server/src/tools/open-url/deep-link-note.ts
@@ -125834,12 +125874,12 @@ function httpDeepLinkNote(url2) {
125834
125874
  }
125835
125875
 
125836
125876
  // ../tool-server/src/tools/open-url/platforms/ios.ts
125837
- var execFileAsync18 = (0, import_node_util18.promisify)(import_node_child_process24.execFile);
125877
+ var execFileAsync17 = (0, import_node_util17.promisify)(import_node_child_process23.execFile);
125838
125878
  var iosImpl3 = {
125839
125879
  requires: ["xcrun"],
125840
125880
  handler: async (_services, params) => {
125841
125881
  try {
125842
- await execFileAsync18("xcrun", ["simctl", "openurl", params.udid, params.url]);
125882
+ await execFileAsync17("xcrun", ["simctl", "openurl", params.udid, params.url]);
125843
125883
  } catch (err) {
125844
125884
  throw new FailureError(
125845
125885
  `Failed to open URL on iOS simulator ${params.udid}.`,
@@ -125939,16 +125979,16 @@ Returns { opened, url, note? }. note carries the deep-linking caveat when a web
125939
125979
  };
125940
125980
 
125941
125981
  // ../tool-server/src/tools/screenshot/index.ts
125942
- var import_node_child_process25 = require("node:child_process");
125943
- var import_node_util19 = require("node:util");
125982
+ var import_node_child_process24 = require("node:child_process");
125983
+ var import_node_util18 = require("node:util");
125944
125984
  var os9 = __toESM(require("node:os"));
125945
125985
  var path19 = __toESM(require("node:path"));
125946
125986
  init_zod();
125947
125987
 
125948
125988
  // ../tool-server/src/utils/vega-screen.ts
125949
125989
  var import_promises10 = require("node:fs/promises");
125950
- var import_node_os10 = require("node:os");
125951
- var import_node_path16 = require("node:path");
125990
+ var import_node_os12 = require("node:os");
125991
+ var import_node_path19 = require("node:path");
125952
125992
  var import_pngjs = __toESM(require_png());
125953
125993
  init_src();
125954
125994
  init_adb();
@@ -126115,7 +126155,7 @@ async function captureVegaScreenshotPng(opts = {}) {
126115
126155
  async function captureViaEmulatorConsole(opts) {
126116
126156
  const port = await discoverVegaConsolePort();
126117
126157
  const serial = `emulator-${port}`;
126118
- const outDir = await (0, import_promises10.mkdtemp)((0, import_node_path16.join)((0, import_node_os10.tmpdir)(), "vega-shot-"));
126158
+ const outDir = await (0, import_promises10.mkdtemp)((0, import_node_path19.join)((0, import_node_os12.tmpdir)(), "vega-shot-"));
126119
126159
  try {
126120
126160
  await runAdb(["-s", serial, "emu", "screenrecord", "screenshot", outDir], {
126121
126161
  timeoutMs: 2e4
@@ -126129,9 +126169,9 @@ async function captureViaEmulatorConsole(opts) {
126129
126169
  error_kind: "unknown"
126130
126170
  });
126131
126171
  }
126132
- const decoded = import_pngjs.PNG.sync.read(await (0, import_promises10.readFile)((0, import_node_path16.join)(outDir, pngName)));
126172
+ const decoded = import_pngjs.PNG.sync.read(await (0, import_promises10.readFile)((0, import_node_path19.join)(outDir, pngName)));
126133
126173
  const scaled = scalePng(decoded, opts.scale);
126134
- const outPath = (0, import_node_path16.join)((0, import_node_os10.tmpdir)(), `vega-screenshot-${process.hrtime.bigint()}.png`);
126174
+ const outPath = (0, import_node_path19.join)((0, import_node_os12.tmpdir)(), `vega-screenshot-${process.hrtime.bigint()}.png`);
126135
126175
  await (0, import_promises10.writeFile)(outPath, import_pngjs.PNG.sync.write(scaled));
126136
126176
  return outPath;
126137
126177
  } finally {
@@ -126155,7 +126195,7 @@ function scalePng(src, scale) {
126155
126195
  }
126156
126196
 
126157
126197
  // ../tool-server/src/tools/screenshot/index.ts
126158
- var execFileAsync19 = (0, import_node_util19.promisify)(import_node_child_process25.execFile);
126198
+ var execFileAsync18 = (0, import_node_util18.promisify)(import_node_child_process24.execFile);
126159
126199
  var zodSchema15 = external_exports.object({
126160
126200
  udid: external_exports.string().describe(
126161
126201
  "Target device id from `list-devices` (iOS UDID, Android serial, Apple TV UDID, Vega serial, or Chromium id)."
@@ -126185,9 +126225,9 @@ async function tvScreenshot(udid, scale, signal) {
126185
126225
  os9.tmpdir(),
126186
126226
  `argent-tv-screenshot-${udid.slice(0, 8)}-${process.hrtime.bigint()}.png`
126187
126227
  );
126188
- await execFileAsync19("xcrun", ["simctl", "io", udid, "screenshot", file2], { signal });
126228
+ await execFileAsync18("xcrun", ["simctl", "io", udid, "screenshot", file2], { signal });
126189
126229
  if (scale < 1) {
126190
- await execFileAsync19("sips", ["-Z", String(await tvTargetLongSide(file2, scale)), file2], {
126230
+ await execFileAsync18("sips", ["-Z", String(await tvTargetLongSide(file2, scale)), file2], {
126191
126231
  signal
126192
126232
  }).catch(() => {
126193
126233
  });
@@ -126197,7 +126237,7 @@ async function tvScreenshot(udid, scale, signal) {
126197
126237
  async function tvTargetLongSide(file2, scale) {
126198
126238
  let longSide = 3840;
126199
126239
  try {
126200
- const { stdout } = await execFileAsync19("sips", ["-g", "pixelWidth", "-g", "pixelHeight", file2]);
126240
+ const { stdout } = await execFileAsync18("sips", ["-g", "pixelWidth", "-g", "pixelHeight", file2]);
126201
126241
  const width = Number(/pixelWidth:\s*(\d+)/.exec(stdout)?.[1]);
126202
126242
  const height = Number(/pixelHeight:\s*(\d+)/.exec(stdout)?.[1]);
126203
126243
  if (Number.isFinite(width) && Number.isFinite(height) && width > 0 && height > 0) {
@@ -139245,7 +139285,7 @@ var nativeProfilerSessionBlueprint = {
139245
139285
  var import_child_process4 = require("child_process");
139246
139286
  init_src();
139247
139287
  var import_fs9 = require("fs");
139248
- var import_node_fs13 = require("node:fs");
139288
+ var import_node_fs14 = require("node:fs");
139249
139289
  var path22 = __toESM(require("path"));
139250
139290
 
139251
139291
  // ../tool-server/src/utils/ios-profiler/notify.ts
@@ -139392,8 +139432,8 @@ var import_util6 = require("util");
139392
139432
  var DEFAULT_EXEC_TIMEOUT_MS = 6e4;
139393
139433
  var DEFAULT_EXEC_MAX_BUFFER = 256 * 1024 * 1024;
139394
139434
  async function execFileAsyncWithTimeout(file2, args, options = {}) {
139395
- const execFileAsync23 = (0, import_util6.promisify)(import_child_process2.execFile);
139396
- const { stdout, stderr } = await execFileAsync23(file2, args, {
139435
+ const execFileAsync22 = (0, import_util6.promisify)(import_child_process2.execFile);
139436
+ const { stdout, stderr } = await execFileAsync22(file2, args, {
139397
139437
  encoding: "utf-8",
139398
139438
  ...options,
139399
139439
  // The timeout and maxBuffer are this wrapper's whole purpose (the
@@ -140894,7 +140934,7 @@ function resolveDefaultTemplatePath() {
140894
140934
  )
140895
140935
  ];
140896
140936
  for (const candidate of candidates) {
140897
- if ((0, import_node_fs13.existsSync)(candidate)) return candidate;
140937
+ if ((0, import_node_fs14.existsSync)(candidate)) return candidate;
140898
140938
  }
140899
140939
  throw new FailureError(
140900
140940
  `Argent.tracetemplate not found. Looked in:
@@ -144615,7 +144655,39 @@ function createStopAllSimulatorServersTool(registry2) {
144615
144655
 
144616
144656
  // ../tool-server/src/tools/simulator/stop-metro.ts
144617
144657
  init_zod();
144618
- var import_node_child_process26 = require("node:child_process");
144658
+ var import_node_child_process25 = require("node:child_process");
144659
+ function parseNetstatListeningPids(netstatOutput, port) {
144660
+ const pids = /* @__PURE__ */ new Set();
144661
+ for (const line of netstatOutput.split(/\r?\n/)) {
144662
+ const cols = line.trim().split(/\s+/);
144663
+ if (cols.length < 5 || cols[0].toUpperCase() !== "TCP") continue;
144664
+ if (!cols[1].endsWith(`:${port}`)) continue;
144665
+ const foreign = cols[2];
144666
+ if (foreign !== "*:*" && !foreign.endsWith(":0")) continue;
144667
+ const pid = parseInt(cols[cols.length - 1], 10);
144668
+ if (!Number.isNaN(pid) && pid > 0) pids.add(pid);
144669
+ }
144670
+ return [...pids];
144671
+ }
144672
+ function listeningPids(port) {
144673
+ if (process.platform === "win32") {
144674
+ const output2 = (0, import_node_child_process25.execFileSync)("netstat", ["-ano"], {
144675
+ encoding: "utf-8",
144676
+ timeout: 5e3,
144677
+ // `netstat -ano` dumps every socket on the host; a busy box easily
144678
+ // exceeds Node's default 1 MiB maxBuffer, and the resulting ENOBUFS
144679
+ // throw would misread as "port is free" (stopped:false).
144680
+ maxBuffer: 16 * 1024 * 1024
144681
+ });
144682
+ return parseNetstatListeningPids(output2, port);
144683
+ }
144684
+ const output = (0, import_node_child_process25.execFileSync)("lsof", ["-ti", `tcp:${port}`, "-sTCP:LISTEN"], {
144685
+ encoding: "utf-8",
144686
+ timeout: 5e3
144687
+ }).trim();
144688
+ if (!output) return [];
144689
+ return output.split("\n").map((s) => parseInt(s.trim(), 10)).filter((n) => !Number.isNaN(n));
144690
+ }
144619
144691
  var zodSchema57 = external_exports.object({
144620
144692
  port: external_exports.number().int().min(1).max(65535).default(8081).describe("TCP port Metro is listening on (default 8081)")
144621
144693
  });
@@ -144627,14 +144699,7 @@ var stopMetroTool = {
144627
144699
  async execute(_services, params) {
144628
144700
  const port = params.port;
144629
144701
  try {
144630
- const output = (0, import_node_child_process26.execFileSync)("lsof", ["-ti", `tcp:${port}`, "-sTCP:LISTEN"], {
144631
- encoding: "utf-8",
144632
- timeout: 5e3
144633
- }).trim();
144634
- if (!output) {
144635
- return { stopped: false, port, pids: [] };
144636
- }
144637
- const pids = output.split("\n").map((s) => parseInt(s.trim(), 10)).filter((n) => !isNaN(n));
144702
+ const pids = listeningPids(port);
144638
144703
  if (pids.length === 0) {
144639
144704
  return { stopped: false, port, pids: [] };
144640
144705
  }
@@ -146826,7 +146891,7 @@ var import_pngjs2 = __toESM(require_png());
146826
146891
  // ../tool-server/src/tools/screenshot-diff/screenshot-diff-ocr.ts
146827
146892
  var import_child_process6 = require("child_process");
146828
146893
  var import_util7 = require("util");
146829
- var execFileAsync20 = (0, import_util7.promisify)(import_child_process6.execFile);
146894
+ var execFileAsync19 = (0, import_util7.promisify)(import_child_process6.execFile);
146830
146895
  var OCR_TIMEOUT_MS = 1e4;
146831
146896
  var OCR_MAX_BUFFER_BYTES = 32 * 1024 * 1024;
146832
146897
  var TESSERACT_BINARY = "tesseract";
@@ -146871,7 +146936,7 @@ async function extractOcrTextBlocks(imagePath) {
146871
146936
  }
146872
146937
  }
146873
146938
  async function recognizeTsv(imagePath) {
146874
- const { stdout } = await execFileAsync20(
146939
+ const { stdout } = await execFileAsync19(
146875
146940
  TESSERACT_BINARY,
146876
146941
  [
146877
146942
  imagePath,
@@ -148959,15 +149024,15 @@ async function runSnapshot(env, opts) {
148959
149024
  }
148960
149025
 
148961
149026
  // ../tool-server/src/utils/status-bar.ts
148962
- var import_node_child_process27 = require("node:child_process");
148963
- var import_node_util20 = require("node:util");
149027
+ var import_node_child_process26 = require("node:child_process");
149028
+ var import_node_util19 = require("node:util");
148964
149029
  init_adb();
148965
- var execFileAsync21 = (0, import_node_util20.promisify)(import_node_child_process27.execFile);
149030
+ var execFileAsync20 = (0, import_node_util19.promisify)(import_node_child_process26.execFile);
148966
149031
  var DEMO_BROADCAST = "am broadcast -a com.android.systemui.demo";
148967
149032
  async function pinStatusBar(device) {
148968
149033
  try {
148969
149034
  if (device.platform === "ios") {
148970
- await execFileAsync21("xcrun", [
149035
+ await execFileAsync20("xcrun", [
148971
149036
  "simctl",
148972
149037
  "status_bar",
148973
149038
  device.id,
@@ -149008,7 +149073,7 @@ async function pinStatusBar(device) {
149008
149073
  async function restoreStatusBar(device) {
149009
149074
  try {
149010
149075
  if (device.platform === "ios") {
149011
- await execFileAsync21("xcrun", ["simctl", "status_bar", device.id, "clear"]);
149076
+ await execFileAsync20("xcrun", ["simctl", "status_bar", device.id, "clear"]);
149012
149077
  } else if (device.platform === "android") {
149013
149078
  try {
149014
149079
  await adbShell(device.id, `${DEMO_BROADCAST} -e command exit`);
@@ -149655,8 +149720,8 @@ init_zod();
149655
149720
 
149656
149721
  // ../tool-server/src/utils/workspace-reader.ts
149657
149722
  var import_promises12 = require("node:fs/promises");
149658
- var import_node_path17 = require("node:path");
149659
- var import_node_child_process28 = require("node:child_process");
149723
+ var import_node_path20 = require("node:path");
149724
+ var import_node_child_process27 = require("node:child_process");
149660
149725
  var import_dotenv = __toESM(require_main());
149661
149726
  async function exists(path36) {
149662
149727
  try {
@@ -149700,7 +149765,7 @@ async function listDir(path36) {
149700
149765
  var COMMAND_TIMEOUT_MS = 3e3;
149701
149766
  function runVersionCommand(cmd, args, cwd) {
149702
149767
  return new Promise((resolve7) => {
149703
- const child = (0, import_node_child_process28.execFile)(cmd, args, { cwd, timeout: COMMAND_TIMEOUT_MS }, (err, stdout) => {
149768
+ const child = (0, import_node_child_process27.execFile)(cmd, args, { cwd, timeout: COMMAND_TIMEOUT_MS }, (err, stdout) => {
149704
149769
  if (err) {
149705
149770
  resolve7(null);
149706
149771
  return;
@@ -149743,7 +149808,7 @@ async function detectLockfile(workspacePath) {
149743
149808
  const checks = await Promise.all(
149744
149809
  LOCKFILES.map(async (name) => ({
149745
149810
  name,
149746
- exists: await exists((0, import_node_path17.join)(workspacePath, name))
149811
+ exists: await exists((0, import_node_path20.join)(workspacePath, name))
149747
149812
  }))
149748
149813
  );
149749
149814
  return checks.find((c) => c.exists)?.name ?? null;
@@ -149762,7 +149827,7 @@ var CI_CONFIGS = [
149762
149827
  ];
149763
149828
  async function detectCiConfig(workspacePath) {
149764
149829
  for (const ci of CI_CONFIGS) {
149765
- if (await exists((0, import_node_path17.join)(workspacePath, ci.path))) return ci.label;
149830
+ if (await exists((0, import_node_path20.join)(workspacePath, ci.path))) return ci.label;
149766
149831
  }
149767
149832
  return null;
149768
149833
  }
@@ -149783,7 +149848,7 @@ async function detectLintStagedConfig(workspacePath, packageJson) {
149783
149848
  return packageJson["lint-staged"];
149784
149849
  }
149785
149850
  for (const file2 of LINT_STAGED_FILES) {
149786
- const full = (0, import_node_path17.join)(workspacePath, file2);
149851
+ const full = (0, import_node_path20.join)(workspacePath, file2);
149787
149852
  if (await exists(full)) {
149788
149853
  if (file2.endsWith(".json") || file2 === ".lintstagedrc") {
149789
149854
  return readJsonFile(full);
@@ -149825,7 +149890,7 @@ var CONFIG_FILES = [
149825
149890
  async function detectConfigFiles(workspacePath) {
149826
149891
  const results = await Promise.allSettled(
149827
149892
  CONFIG_FILES.map(async (file2) => {
149828
- if (await exists((0, import_node_path17.join)(workspacePath, file2))) return file2;
149893
+ if (await exists((0, import_node_path20.join)(workspacePath, file2))) return file2;
149829
149894
  return null;
149830
149895
  })
149831
149896
  );
@@ -149864,7 +149929,7 @@ async function detectEnvFiles(workspacePath) {
149864
149929
  const envFileNames = entries.filter((e) => e === ".env" || e.startsWith(".env."));
149865
149930
  const results = await Promise.all(
149866
149931
  envFileNames.map(async (name) => {
149867
- const content = await readTextFile((0, import_node_path17.join)(workspacePath, name));
149932
+ const content = await readTextFile((0, import_node_path20.join)(workspacePath, name));
149868
149933
  return {
149869
149934
  name,
149870
149935
  keys: content ? extractEnvKeys(content) : []
@@ -149891,34 +149956,34 @@ async function readWorkspaceSnapshot(workspacePath) {
149891
149956
  ciConfig,
149892
149957
  configFilesFound
149893
149958
  ] = await Promise.all([
149894
- readJsonFile((0, import_node_path17.join)(workspacePath, "package.json")),
149895
- readJsonFile((0, import_node_path17.join)(workspacePath, "app.json")),
149896
- readJsonFile((0, import_node_path17.join)(workspacePath, "eas.json")),
149897
- readJsonFile((0, import_node_path17.join)(workspacePath, "tsconfig.json")),
149898
- readTextFile((0, import_node_path17.join)(workspacePath, "metro.config.js")).then(
149899
- (r) => r ?? readTextFile((0, import_node_path17.join)(workspacePath, "metro.config.ts"))
149959
+ readJsonFile((0, import_node_path20.join)(workspacePath, "package.json")),
149960
+ readJsonFile((0, import_node_path20.join)(workspacePath, "app.json")),
149961
+ readJsonFile((0, import_node_path20.join)(workspacePath, "eas.json")),
149962
+ readJsonFile((0, import_node_path20.join)(workspacePath, "tsconfig.json")),
149963
+ readTextFile((0, import_node_path20.join)(workspacePath, "metro.config.js")).then(
149964
+ (r) => r ?? readTextFile((0, import_node_path20.join)(workspacePath, "metro.config.ts"))
149900
149965
  ),
149901
- readTextFile((0, import_node_path17.join)(workspacePath, "babel.config.js")).then(
149902
- (r) => r ?? readTextFile((0, import_node_path17.join)(workspacePath, "babel.config.cjs"))
149966
+ readTextFile((0, import_node_path20.join)(workspacePath, "babel.config.js")).then(
149967
+ (r) => r ?? readTextFile((0, import_node_path20.join)(workspacePath, "babel.config.cjs"))
149903
149968
  ),
149904
- isDirectory((0, import_node_path17.join)(workspacePath, "ios")),
149905
- isDirectory((0, import_node_path17.join)(workspacePath, "android")),
149969
+ isDirectory((0, import_node_path20.join)(workspacePath, "ios")),
149970
+ isDirectory((0, import_node_path20.join)(workspacePath, "android")),
149906
149971
  detectLockfile(workspacePath),
149907
149972
  detectEnvFiles(workspacePath),
149908
149973
  detectToolVersions(workspacePath),
149909
- listDir((0, import_node_path17.join)(workspacePath, "scripts")),
149910
- listDir((0, import_node_path17.join)(workspacePath, ".husky")),
149974
+ listDir((0, import_node_path20.join)(workspacePath, "scripts")),
149975
+ listDir((0, import_node_path20.join)(workspacePath, ".husky")),
149911
149976
  detectCiConfig(workspacePath),
149912
149977
  detectConfigFiles(workspacePath)
149913
149978
  ]);
149914
- const iosDir = (0, import_node_path17.join)(workspacePath, "ios");
149915
- const androidDir = (0, import_node_path17.join)(workspacePath, "android");
149979
+ const iosDir = (0, import_node_path20.join)(workspacePath, "ios");
149980
+ const androidDir = (0, import_node_path20.join)(workspacePath, "android");
149916
149981
  const [iosWorkspace, iosHasPodfile, makefileText, lintStagedConfig, androidHasGradle] = await Promise.all([
149917
149982
  hasIosDir ? findIosWorkspace(iosDir) : Promise.resolve(null),
149918
- exists((0, import_node_path17.join)(workspacePath, "ios", "Podfile")),
149919
- readTextFile((0, import_node_path17.join)(workspacePath, "Makefile")),
149983
+ exists((0, import_node_path20.join)(workspacePath, "ios", "Podfile")),
149984
+ readTextFile((0, import_node_path20.join)(workspacePath, "Makefile")),
149920
149985
  detectLintStagedConfig(workspacePath, packageJson),
149921
- hasAndroidDir ? exists((0, import_node_path17.join)(androidDir, "gradlew")) : Promise.resolve(false)
149986
+ hasAndroidDir ? exists((0, import_node_path20.join)(androidDir, "gradlew")) : Promise.resolve(false)
149922
149987
  ]);
149923
149988
  const metroPort = metroConfigRaw ? extractMetroPort(metroConfigRaw) : null;
149924
149989
  const makefileTargets = makefileText ? extractMakefileTargets(makefileText) : null;
@@ -149984,7 +150049,7 @@ Fails if the workspacePath is not an absolute path or the directory cannot be ac
149984
150049
  };
149985
150050
 
149986
150051
  // ../tool-server/src/tools/system/update-argent.ts
149987
- var import_node_child_process29 = require("node:child_process");
150052
+ var import_node_child_process28 = require("node:child_process");
149988
150053
  var fs43 = __toESM(require("node:fs"));
149989
150054
  var path32 = __toESM(require("node:path"));
149990
150055
  init_zod();
@@ -150114,7 +150179,7 @@ var updateArgentTool = {
150114
150179
  if (spawnRoot) updateArgs.push("--project-root", spawnRoot);
150115
150180
  const cmd = cliEntry ? process.execPath : "argent";
150116
150181
  const args = cliEntry ? [cliEntry, ...updateArgs] : updateArgs;
150117
- const child = (0, import_node_child_process29.spawn)(cmd, args, {
150182
+ const child = (0, import_node_child_process28.spawn)(cmd, args, {
150118
150183
  detached: true,
150119
150184
  stdio: "ignore",
150120
150185
  env: { ...process.env, ARGENT_UPDATE_TRIGGER: "mcp_update" }
@@ -150163,7 +150228,7 @@ var dismissUpdateTool = {
150163
150228
  // ../tool-server/src/tools/screenshot-diff/index.ts
150164
150229
  var import_node_crypto8 = __toESM(require("node:crypto"));
150165
150230
  var import_promises13 = __toESM(require("fs/promises"));
150166
- var import_node_os11 = __toESM(require("node:os"));
150231
+ var import_node_os13 = __toESM(require("node:os"));
150167
150232
  var import_path9 = __toESM(require("path"));
150168
150233
  init_zod();
150169
150234
  init_src();
@@ -150245,7 +150310,7 @@ async function resolveOutputDir(params, options) {
150245
150310
  return params.outputDir;
150246
150311
  }
150247
150312
  const dir = import_path9.default.join(
150248
- import_node_os11.default.tmpdir(),
150313
+ import_node_os13.default.tmpdir(),
150249
150314
  "argent-screenshot-diff",
150250
150315
  import_node_crypto8.default.randomBytes(6).toString("hex")
150251
150316
  );
@@ -150936,13 +151001,34 @@ function createRegistry() {
150936
151001
  return registry2;
150937
151002
  }
150938
151003
 
151004
+ // ../tool-server/src/utils/probe-argent-tool-server.ts
151005
+ var http3 = __toESM(require("node:http"));
151006
+ function probeArgentToolServer(host, port, timeoutMs = 500) {
151007
+ return new Promise((resolve7) => {
151008
+ const req = http3.request(
151009
+ { host, port, path: "/tools", method: "GET", timeout: timeoutMs },
151010
+ (res) => {
151011
+ const isArgentPeer = res.statusCode === 200 || res.statusCode === 401;
151012
+ res.resume();
151013
+ resolve7(isArgentPeer);
151014
+ }
151015
+ );
151016
+ req.on("error", () => resolve7(false));
151017
+ req.on("timeout", () => {
151018
+ req.destroy();
151019
+ resolve7(false);
151020
+ });
151021
+ req.end();
151022
+ });
151023
+ }
151024
+
150939
151025
  // ../tool-server/src/utils/simulator-watcher.ts
150940
- var import_node_child_process30 = require("node:child_process");
150941
- var import_node_util21 = require("node:util");
150942
- var execFileAsync22 = (0, import_node_util21.promisify)(import_node_child_process30.execFile);
151026
+ var import_node_child_process29 = require("node:child_process");
151027
+ var import_node_util20 = require("node:util");
151028
+ var execFileAsync21 = (0, import_node_util20.promisify)(import_node_child_process29.execFile);
150943
151029
  var POLL_INTERVAL_MS2 = 1e4;
150944
151030
  async function getBootedUdids() {
150945
- const { stdout } = await execFileAsync22("xcrun", ["simctl", "list", "devices", "--json"]);
151031
+ const { stdout } = await execFileAsync21("xcrun", ["simctl", "list", "devices", "--json"]);
150946
151032
  const data = JSON.parse(stdout);
150947
151033
  const udids = /* @__PURE__ */ new Set();
150948
151034
  for (const devices of Object.values(data.devices)) {
@@ -150999,7 +151085,7 @@ function startSimulatorWatcher(registry2) {
150999
151085
  }
151000
151086
 
151001
151087
  // ../tool-server/src/utils/preview-window.ts
151002
- var import_node_child_process31 = require("node:child_process");
151088
+ var import_node_child_process30 = require("node:child_process");
151003
151089
  var fs45 = __toESM(require("node:fs"));
151004
151090
  var os12 = __toESM(require("node:os"));
151005
151091
  var path34 = __toESM(require("node:path"));
@@ -151031,10 +151117,10 @@ function ensureLensAppBundle(electronBin) {
151031
151117
  fs45.copyFileSync(path34.join(realContents, "Info.plist"), plist);
151032
151118
  const setPlist = (entry, value) => {
151033
151119
  try {
151034
- (0, import_node_child_process31.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Set :${entry} ${value}`, plist]);
151120
+ (0, import_node_child_process30.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Set :${entry} ${value}`, plist]);
151035
151121
  } catch {
151036
151122
  try {
151037
- (0, import_node_child_process31.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Add :${entry} string ${value}`, plist]);
151123
+ (0, import_node_child_process30.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Add :${entry} string ${value}`, plist]);
151038
151124
  } catch {
151039
151125
  }
151040
151126
  }
@@ -151093,7 +151179,7 @@ function createPreviewWindowManager(opts = {}) {
151093
151179
  const wrapperBin = ensureLensAppBundle(electronBin);
151094
151180
  const launchBin = wrapperBin ?? electronBin;
151095
151181
  const launchArgs = wrapperBin ? ["--no-sandbox", mainScript] : [mainScript];
151096
- const next = (0, import_node_child_process31.spawn)(launchBin, launchArgs, {
151182
+ const next = (0, import_node_child_process30.spawn)(launchBin, launchArgs, {
151097
151183
  // Strip ELECTRON_RUN_AS_NODE so the child boots as a GUI Electron app, not
151098
151184
  // a bare Node runtime (see electronGuiChildEnv). An Electron-based MCP
151099
151185
  // host puts it in our env, and inheriting it makes main.cjs crash at
@@ -151218,7 +151304,7 @@ function start() {
151218
151304
  attachRegistryLogger(registry2);
151219
151305
  let eventLog = null;
151220
151306
  if (isFlagEnabled("tool-server-event-log")) {
151221
- const eventLogPath = process.env.ARGENT_EVENT_LOG || path35.join((0, import_node_os12.homedir)(), ".argent", "tool-server-events.jsonl");
151307
+ const eventLogPath = process.env.ARGENT_EVENT_LOG || path35.join((0, import_node_os14.homedir)(), ".argent", "tool-server-events.jsonl");
151222
151308
  try {
151223
151309
  eventLog = createToolServerEventLog({ filePath: eventLogPath });
151224
151310
  } catch (err) {
@@ -151415,31 +151501,51 @@ function start() {
151415
151501
  } catch {
151416
151502
  }
151417
151503
  });
151504
+ const bindSignal = {
151505
+ error_code: FAILURE_CODES.ARGENT_UNCLASSIFIED_FAILURE,
151506
+ failure_stage: "toolserver_bind",
151507
+ failure_area: "tool_server",
151508
+ error_kind: "crash"
151509
+ };
151418
151510
  server.on("error", (err) => {
151419
- eventLog?.error({
151420
- type: "tool_server.bind_failed",
151421
- msg: `Tool server failed to bind ${HOST}:${PORT}.`,
151422
- host: HOST,
151423
- port: PORT,
151424
- failureSignal: {
151425
- error_code: FAILURE_CODES.ARGENT_UNCLASSIFIED_FAILURE,
151426
- failure_stage: "toolserver_bind",
151427
- failure_area: "tool_server",
151428
- error_kind: "crash"
151429
- }
151430
- });
151431
151511
  const code = err.code ? `${err.code}: ` : "";
151432
- crashShutdown(
151433
- `Failed to bind ${HOST}:${PORT}`,
151434
- `${code}${err.message}`,
151435
- {
151436
- error_code: FAILURE_CODES.ARGENT_UNCLASSIFIED_FAILURE,
151437
- failure_stage: "toolserver_bind",
151438
- failure_area: "tool_server",
151439
- error_kind: "crash"
151440
- },
151441
- err
151442
- );
151512
+ const crashBind = () => {
151513
+ eventLog?.error({
151514
+ type: "tool_server.bind_failed",
151515
+ msg: `Tool server failed to bind ${HOST}:${PORT}.`,
151516
+ host: HOST,
151517
+ port: PORT,
151518
+ failureSignal: {
151519
+ error_code: bindSignal.error_code,
151520
+ failure_stage: bindSignal.failure_stage,
151521
+ failure_area: bindSignal.failure_area,
151522
+ error_kind: bindSignal.error_kind
151523
+ }
151524
+ });
151525
+ crashShutdown(`Failed to bind ${HOST}:${PORT}`, `${code}${err.message}`, bindSignal, err);
151526
+ };
151527
+ if (err.code === "EADDRINUSE") {
151528
+ void probeArgentToolServer(HOST, PORT).then((isArgentPeer) => {
151529
+ if (!isArgentPeer) {
151530
+ crashBind();
151531
+ return;
151532
+ }
151533
+ process.stderr.write(
151534
+ `Another argent tool-server already owns ${HOST}:${PORT}; deferring to it (redundant instance).
151535
+ `
151536
+ );
151537
+ eventLog?.info({
151538
+ type: "tool_server.deferred_to_existing",
151539
+ msg: `Deferred to an existing tool-server on ${HOST}:${PORT}.`,
151540
+ host: HOST,
151541
+ port: PORT
151542
+ });
151543
+ shutdownReason = "deferred";
151544
+ void shutdown2?.(0);
151545
+ });
151546
+ return;
151547
+ }
151548
+ crashBind();
151443
151549
  });
151444
151550
  httpHandle.attachChromiumWebsockets(server);
151445
151551
  }).catch((err) => {