@swmansion/argent 0.16.1 → 0.16.2-next.1

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;
@@ -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);
@@ -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
  }
@@ -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);
@@ -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,25 +98732,27 @@ __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);
98706
98739
  var path = __toESM(require("node:path"), 1);
98707
98740
  var import_node_os = require("node:os");
98708
98741
  var PROJECT_MARKERS = [".argent", ".git", "package.json"];
98709
- function resolveProjectRoot(startDir) {
98710
- const initial = path.resolve(startDir);
98711
- let current = initial;
98742
+ function findProjectRoot(startDir) {
98743
+ let current = path.resolve(startDir);
98712
98744
  while (true) {
98713
98745
  for (const marker of PROJECT_MARKERS) {
98714
98746
  if (fs.existsSync(path.join(current, marker))) return current;
98715
98747
  }
98716
98748
  const parent = path.dirname(current);
98717
- if (parent === current) return initial;
98749
+ if (parent === current) return null;
98718
98750
  current = parent;
98719
98751
  }
98720
98752
  }
98753
+ function resolveProjectRoot(startDir) {
98754
+ return findProjectRoot(startDir) ?? path.resolve(startDir);
98755
+ }
98721
98756
  function getFlagsPath(scope, options = {}) {
98722
98757
  const home = options.homeDir ?? (0, import_node_os.homedir)();
98723
98758
  if (scope === "global") {
@@ -98771,8 +98806,15 @@ function argentHomeDir() {
98771
98806
  const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
98772
98807
  return path2.join(home, ".argent");
98773
98808
  }
98774
- function configFilePath() {
98775
- return path2.join(argentHomeDir(), "config.json");
98809
+ function configDir(scope = "global", options = {}) {
98810
+ if (scope === "global") {
98811
+ return options.homeDir ? path2.join(options.homeDir, ".argent") : argentHomeDir();
98812
+ }
98813
+ const cwd = options.cwd ?? process.cwd();
98814
+ return path2.join(resolveProjectRoot(cwd), ".argent");
98815
+ }
98816
+ function configFilePath(scope = "global", options = {}) {
98817
+ return path2.join(configDir(scope, options), "config.json");
98776
98818
  }
98777
98819
 
98778
98820
  // ../tool-server/src/index.ts
@@ -104759,6 +104801,9 @@ function hostPlatformKey() {
104759
104801
  }
104760
104802
  return process.platform;
104761
104803
  }
104804
+ function simulatorServerBinaryName() {
104805
+ return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
104806
+ }
104762
104807
  function platformBinDir() {
104763
104808
  return path5.join(BIN_DIR, hostPlatformKey());
104764
104809
  }
@@ -104766,12 +104811,13 @@ function tcpBinDir() {
104766
104811
  return process.env.ARGENT_SIMULATOR_SERVER_TCP_DIR ?? path5.join(BIN_DIR, "tcp");
104767
104812
  }
104768
104813
  function simulatorServerBinaryPath() {
104769
- const p = path5.join(platformBinDir(), "simulator-server");
104814
+ const binaryName = simulatorServerBinaryName();
104815
+ const p = path5.join(platformBinDir(), binaryName);
104770
104816
  if (!fs3.existsSync(p)) {
104771
- const flat = path5.join(BIN_DIR, "simulator-server");
104817
+ const flat = path5.join(BIN_DIR, binaryName);
104772
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.` : "";
104773
104819
  throw new Error(
104774
- `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}`
104775
104821
  );
104776
104822
  }
104777
104823
  return p;
@@ -105244,8 +105290,8 @@ var import_express3 = __toESM(require_express2());
105244
105290
  var import_bytes2 = __toESM(require_bytes());
105245
105291
  var import_node_fs11 = require("node:fs");
105246
105292
  var import_promises9 = require("node:fs/promises");
105247
- var import_node_os8 = require("node:os");
105248
- var import_node_path9 = require("node:path");
105293
+ var import_node_os9 = require("node:os");
105294
+ var import_node_path11 = require("node:path");
105249
105295
  var import_node_crypto6 = require("node:crypto");
105250
105296
  init_src();
105251
105297
  init_src();
@@ -105285,8 +105331,6 @@ function createIdleTimer(timeoutMs, onIdle) {
105285
105331
  }
105286
105332
 
105287
105333
  // ../tool-server/src/utils/check-deps.ts
105288
- var import_node_child_process5 = require("node:child_process");
105289
- var import_node_util4 = require("node:util");
105290
105334
  init_src();
105291
105335
  init_android_binary();
105292
105336
 
@@ -105296,7 +105340,7 @@ var import_node_util3 = require("node:util");
105296
105340
  var import_node_fs5 = require("node:fs");
105297
105341
  var import_promises3 = require("node:fs/promises");
105298
105342
  var import_node_os3 = require("node:os");
105299
- var import_node_path3 = require("node:path");
105343
+ var import_node_path4 = require("node:path");
105300
105344
  init_src();
105301
105345
  init_subprocess_error();
105302
105346
 
@@ -105369,6 +105413,7 @@ async function listRunningVvdPids() {
105369
105413
  }
105370
105414
 
105371
105415
  // ../tool-server/src/utils/vega-cli.ts
105416
+ init_command_on_path();
105372
105417
  var execFileAsync3 = (0, import_node_util3.promisify)(import_node_child_process4.execFile);
105373
105418
  var VEGA_BINARY_TTL_MS = 6e4;
105374
105419
  var cachedVegaBinary;
@@ -105380,24 +105425,13 @@ async function isExecutable(p) {
105380
105425
  return false;
105381
105426
  }
105382
105427
  }
105383
- async function commandOnPath(name) {
105384
- try {
105385
- const { stdout } = await execFileAsync3("/bin/sh", ["-c", `command -v ${name}`], {
105386
- timeout: 2e3
105387
- });
105388
- const path36 = stdout.trim();
105389
- return path36 || null;
105390
- } catch {
105391
- return null;
105392
- }
105393
- }
105394
105428
  async function resolveVegaBinary() {
105395
105429
  const now = Date.now();
105396
105430
  if (cachedVegaBinary && now - cachedVegaBinary.checkedAt < VEGA_BINARY_TTL_MS) {
105397
105431
  return cachedVegaBinary.path;
105398
105432
  }
105399
105433
  const onPath = await commandOnPath("vega") ?? await commandOnPath("kepler");
105400
- 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");
105401
105435
  const path36 = onPath ?? (await isExecutable(fallback) ? fallback : null);
105402
105436
  cachedVegaBinary = { path: path36, checkedAt: now };
105403
105437
  return path36;
@@ -105677,7 +105711,7 @@ async function vegaDevice(serial, subcommand, options = {}) {
105677
105711
  }
105678
105712
 
105679
105713
  // ../tool-server/src/utils/check-deps.ts
105680
- var execFileAsync4 = (0, import_node_util4.promisify)(import_node_child_process5.execFile);
105714
+ init_command_on_path();
105681
105715
  var DependencyMissingError = class extends Error {
105682
105716
  missing;
105683
105717
  constructor(missing, message) {
@@ -105708,12 +105742,7 @@ async function probe2(dep) {
105708
105742
  if (dep === "vega") {
105709
105743
  return await resolveVegaBinary() !== null;
105710
105744
  }
105711
- try {
105712
- await execFileAsync4("/bin/sh", ["-c", `command -v ${dep}`], { timeout: 2e3 });
105713
- return true;
105714
- } catch {
105715
- return false;
105716
- }
105745
+ return await commandOnPath(dep) !== null;
105717
105746
  }
105718
105747
  async function isAvailable(dep) {
105719
105748
  const now = Date.now();
@@ -105797,7 +105826,7 @@ function toSimulatorNetworkError(toolLabel, err, apiUrl, fallbackHint) {
105797
105826
  // ../tool-server/src/utils/update-checker.ts
105798
105827
  var import_node_fs6 = __toESM(require("node:fs"));
105799
105828
  var import_node_os4 = __toESM(require("node:os"));
105800
- var import_node_path4 = __toESM(require("node:path"));
105829
+ var import_node_path5 = __toESM(require("node:path"));
105801
105830
  var import_semver = __toESM(require_semver2());
105802
105831
 
105803
105832
  // ../tool-server/package.json
@@ -105809,7 +105838,7 @@ var PACKAGE_NAME = "@swmansion/argent";
105809
105838
  var REGISTRY_URL = `https://registry.npmjs.org/${PACKAGE_NAME}`;
105810
105839
  var CHECK_INTERVAL_MS = 60 * 60 * 1e3 * 24;
105811
105840
  function getSuppressionFilePath() {
105812
- 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");
105813
105842
  }
105814
105843
  function loadSuppressUntil() {
105815
105844
  try {
@@ -105823,7 +105852,7 @@ function loadSuppressUntil() {
105823
105852
  }
105824
105853
  function persistSuppressUntil(value) {
105825
105854
  const filePath = getSuppressionFilePath();
105826
- 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 });
105827
105856
  import_node_fs6.default.writeFileSync(filePath, JSON.stringify({ suppressUntil: value }));
105828
105857
  }
105829
105858
  var state2 = {
@@ -105917,12 +105946,12 @@ ACTION REQUIRED: Save a note (via TODO, task list) that an Argent update to v${l
105917
105946
 
105918
105947
  // ../tool-server/src/preview.ts
105919
105948
  var import_node_fs9 = __toESM(require("node:fs"));
105920
- var import_node_os6 = __toESM(require("node:os"));
105921
- 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"));
105922
105951
  var import_express = __toESM(require_express2());
105923
105952
 
105924
105953
  // ../tool-server/src/blueprints/simulator-server.ts
105925
- var import_node_child_process10 = require("node:child_process");
105954
+ var import_node_child_process9 = require("node:child_process");
105926
105955
  var readline2 = __toESM(require("node:readline"));
105927
105956
  init_src();
105928
105957
 
@@ -105933,23 +105962,23 @@ var readline = __toESM(require("node:readline"));
105933
105962
  init_src();
105934
105963
 
105935
105964
  // ../tool-server/src/utils/ios-host.ts
105936
- var import_node_child_process9 = require("node:child_process");
105965
+ var import_node_child_process8 = require("node:child_process");
105937
105966
  var import_node_events = require("node:events");
105938
105967
  var fs7 = __toESM(require("node:fs"));
105939
105968
  var path8 = __toESM(require("node:path"));
105940
- var import_node_util8 = require("node:util");
105969
+ var import_node_util7 = require("node:util");
105941
105970
 
105942
105971
  // ../tool-server/src/utils/simctl-config.ts
105943
105972
  var SIMCTL_SPAWN_TIMEOUT_MS = 1e4;
105944
105973
  var SIMCTL_KILL_SIGNAL = "SIGKILL";
105945
105974
 
105946
105975
  // ../tool-server/src/utils/ios-devices.ts
105947
- var import_node_child_process6 = require("node:child_process");
105948
- var import_node_util5 = require("node:util");
105949
- 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);
105950
105979
  async function listIosSimulators() {
105951
105980
  try {
105952
- const { stdout } = await execFileAsync5("xcrun", ["simctl", "list", "devices", "--json"], {
105981
+ const { stdout } = await execFileAsync4("xcrun", ["simctl", "list", "devices", "--json"], {
105953
105982
  timeout: 1e4,
105954
105983
  killSignal: SIMCTL_KILL_SIGNAL
105955
105984
  });
@@ -105996,11 +106025,11 @@ function getCachedSimulatorRuntimeKind(udid) {
105996
106025
  var fsAsync = __toESM(require("node:fs/promises"));
105997
106026
  var os3 = __toESM(require("node:os"));
105998
106027
  var path7 = __toESM(require("node:path"));
105999
- var import_node_child_process7 = require("node:child_process");
106000
- var import_node_util6 = require("node:util");
106001
- 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);
106002
106031
  async function ensureAutomationEnabled(udid) {
106003
- await execFileAsync6(
106032
+ await execFileAsync5(
106004
106033
  "xcrun",
106005
106034
  [
106006
106035
  "simctl",
@@ -106017,7 +106046,7 @@ async function ensureAutomationEnabled(udid) {
106017
106046
  );
106018
106047
  }
106019
106048
  async function isEntitlementBypassActive(udid) {
106020
- return execFileAsync6(
106049
+ return execFileAsync5(
106021
106050
  "xcrun",
106022
106051
  [
106023
106052
  "simctl",
@@ -106044,7 +106073,7 @@ async function setAccessibilityPrefsPreBoot(udid) {
106044
106073
  await fsAsync.mkdir(path7.dirname(plistPath), { recursive: true });
106045
106074
  const exists2 = await fsAsync.access(plistPath).then(() => true).catch(() => false);
106046
106075
  if (!exists2) {
106047
- await execFileAsync6("plutil", ["-create", "binary1", plistPath]);
106076
+ await execFileAsync5("plutil", ["-create", "binary1", plistPath]);
106048
106077
  }
106049
106078
  for (const key of [
106050
106079
  "AutomationEnabled",
@@ -106052,13 +106081,13 @@ async function setAccessibilityPrefsPreBoot(udid) {
106052
106081
  "AccessibilityEnabled",
106053
106082
  "ApplicationAccessibilityEnabled"
106054
106083
  ]) {
106055
- await execFileAsync6("plutil", ["-replace", key, "-bool", "true", plistPath]);
106084
+ await execFileAsync5("plutil", ["-replace", key, "-bool", "true", plistPath]);
106056
106085
  }
106057
106086
  }
106058
106087
 
106059
106088
  // ../tool-server/src/utils/sim-remote.ts
106060
- var import_node_child_process8 = require("node:child_process");
106061
- 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");
106062
106091
 
106063
106092
  // ../tool-server/src/utils/device-info.ts
106064
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}$/;
@@ -106098,11 +106127,11 @@ function chromiumIdFromPort(port) {
106098
106127
  }
106099
106128
 
106100
106129
  // ../tool-server/src/utils/sim-remote.ts
106101
- 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);
106102
106131
  var DEFAULT_TIMEOUT_MS = 3e4;
106103
106132
  async function run(args, options) {
106104
106133
  try {
106105
- const { stdout } = await execFileAsync7("sim-remote", args, {
106134
+ const { stdout } = await execFileAsync6("sim-remote", args, {
106106
106135
  timeout: options?.timeoutMs ?? DEFAULT_TIMEOUT_MS,
106107
106136
  maxBuffer: 16 * 1024 * 1024,
106108
106137
  encoding: "utf8",
@@ -106221,7 +106250,7 @@ async function moqInfo(udid) {
106221
106250
  }
106222
106251
 
106223
106252
  // ../tool-server/src/utils/ios-host.ts
106224
- 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);
106225
106254
  var ARGENT_BOOTSTRAP_DYLIB_BASENAMES = /* @__PURE__ */ new Set([
106226
106255
  "libArgentInjectionBootstrap.dylib",
106227
106256
  "libInjectionBootstrap.dylib"
@@ -106251,7 +106280,7 @@ async function ensureAccessibilityEnabled(udid) {
106251
106280
  const flags = ["AccessibilityEnabled", "ApplicationAccessibilityEnabled"];
106252
106281
  await Promise.all(
106253
106282
  flags.map(
106254
- (flag) => execFileAsync8(
106283
+ (flag) => execFileAsync7(
106255
106284
  "xcrun",
106256
106285
  [
106257
106286
  "simctl",
@@ -106271,7 +106300,7 @@ async function ensureAccessibilityEnabled(udid) {
106271
106300
  }
106272
106301
  async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
106273
106302
  const bootstrapPath = await isTvOsSimulator(udid) ? bootstrapDylibPathTvos() : endpoint.transport === "tcp" ? bootstrapDylibPathTcp() : bootstrapDylibPath();
106274
- const result = await execFileAsync8(
106303
+ const result = await execFileAsync7(
106275
106304
  "xcrun",
106276
106305
  ["simctl", "spawn", udid, "launchctl", "getenv", "DYLD_INSERT_LIBRARIES"],
106277
106306
  { encoding: "utf8", timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
@@ -106279,7 +106308,7 @@ async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
106279
106308
  const existing = (result.stdout ?? "").trim();
106280
106309
  const updated = buildDyldInsertLibraries(existing, bootstrapPath);
106281
106310
  if (updated !== existing) {
106282
- await execFileAsync8(
106311
+ await execFileAsync7(
106283
106312
  "xcrun",
106284
106313
  ["simctl", "spawn", udid, "launchctl", "setenv", "DYLD_INSERT_LIBRARIES", updated],
106285
106314
  { timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
@@ -106289,7 +106318,7 @@ async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
106289
106318
  if (endpoint.port === void 0) {
106290
106319
  throw new Error("native-devtools TCP endpoint reached host setup before its port was bound");
106291
106320
  }
106292
- await execFileAsync8(
106321
+ await execFileAsync7(
106293
106322
  "xcrun",
106294
106323
  [
106295
106324
  "simctl",
@@ -106303,7 +106332,7 @@ async function setupNativeDevtoolsEnvLocal(udid, endpoint) {
106303
106332
  { timeout: SIMCTL_SPAWN_TIMEOUT_MS, killSignal: SIMCTL_KILL_SIGNAL }
106304
106333
  );
106305
106334
  } else {
106306
- await execFileAsync8(
106335
+ await execFileAsync7(
106307
106336
  "xcrun",
106308
106337
  [
106309
106338
  "simctl",
@@ -106343,7 +106372,7 @@ function parseUIKitApplicationBundleIds(stdout) {
106343
106372
  return bundleIds;
106344
106373
  }
106345
106374
  async function listRunningUIKitApplicationBundleIds(udid) {
106346
- const { stdout } = await execFileAsync8("xcrun", ["simctl", "spawn", udid, "launchctl", "list"], {
106375
+ const { stdout } = await execFileAsync7("xcrun", ["simctl", "spawn", udid, "launchctl", "list"], {
106347
106376
  encoding: "utf8",
106348
106377
  timeout: SIMCTL_SPAWN_TIMEOUT_MS,
106349
106378
  killSignal: SIMCTL_KILL_SIGNAL
@@ -106356,7 +106385,7 @@ function spawnAxDaemonLocal(udid, endpoint) {
106356
106385
  throw new Error("ax-service TCP endpoint reached spawn before its port was bound");
106357
106386
  }
106358
106387
  const endpointArgs = endpoint.transport === "tcp" ? ["--port", String(endpoint.port)] : ["--socket", endpoint.socketPath];
106359
- const proc = (0, import_node_child_process9.execFile)(
106388
+ const proc = (0, import_node_child_process8.execFile)(
106360
106389
  "xcrun",
106361
106390
  ["simctl", "spawn", udid, binaryPath, ...endpointArgs, "--timeout", "3600"],
106362
106391
  { encoding: "utf8" }
@@ -114142,7 +114171,7 @@ function spawnSimulatorServerProcess(udid, subcommand) {
114142
114171
  const { BINARY_PATH, BINARY_DIR } = getPaths();
114143
114172
  return new Promise((resolve7, reject) => {
114144
114173
  const args = [subcommand, "--id", udid];
114145
- const proc = (0, import_node_child_process10.spawn)(BINARY_PATH, args, {
114174
+ const proc = (0, import_node_child_process9.spawn)(BINARY_PATH, args, {
114146
114175
  cwd: BINARY_DIR,
114147
114176
  stdio: ["pipe", "pipe", "pipe"]
114148
114177
  });
@@ -114359,9 +114388,10 @@ function classifyDeviceForTelemetry(deviceId) {
114359
114388
  }
114360
114389
 
114361
114390
  // ../tool-server/src/utils/device-shutdown.ts
114362
- var import_node_child_process12 = require("node:child_process");
114363
- var import_node_util10 = require("node:util");
114364
- 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);
114365
114395
  async function shutdownOwnedDevice(id) {
114366
114396
  let platform;
114367
114397
  try {
@@ -114370,10 +114400,11 @@ async function shutdownOwnedDevice(id) {
114370
114400
  return;
114371
114401
  }
114372
114402
  if (platform === "ios") {
114373
- await execFileAsync10("xcrun", ["simctl", "shutdown", id]).catch(() => {
114403
+ await execFileAsync9("xcrun", ["simctl", "shutdown", id]).catch(() => {
114374
114404
  });
114375
114405
  } else if (platform === "android") {
114376
- await execFileAsync10("adb", ["-s", id, "emu", "kill"]).catch(() => {
114406
+ const adb = await resolveAndroidBinary("adb") ?? "adb";
114407
+ await execFileAsync9(adb, ["-s", id, "emu", "kill"]).catch(() => {
114377
114408
  });
114378
114409
  }
114379
114410
  }
@@ -114389,11 +114420,12 @@ async function shutdownDevice(id) {
114389
114420
  }
114390
114421
  try {
114391
114422
  if (device.platform === "ios") {
114392
- await execFileAsync10("xcrun", ["simctl", "shutdown", id]);
114423
+ await execFileAsync9("xcrun", ["simctl", "shutdown", id]);
114393
114424
  return { ok: true };
114394
114425
  }
114395
114426
  if (device.platform === "android" && device.kind === "emulator") {
114396
- await execFileAsync10("adb", ["-s", id, "emu", "kill"]);
114427
+ const adb = await resolveAndroidBinary("adb") ?? "adb";
114428
+ await execFileAsync9(adb, ["-s", id, "emu", "kill"]);
114397
114429
  return { ok: true };
114398
114430
  }
114399
114431
  return {
@@ -115965,12 +115997,12 @@ init_src();
115965
115997
  // ../tool-server/src/utils/vega-sdk.ts
115966
115998
  var import_promises4 = require("node:fs/promises");
115967
115999
  var import_node_fs7 = require("node:fs");
115968
- var import_node_os5 = require("node:os");
115969
- var import_node_path5 = require("node:path");
116000
+ var import_node_os6 = require("node:os");
116001
+ var import_node_path7 = require("node:path");
115970
116002
  var import_semver2 = __toESM(require_semver2());
115971
116003
  async function readVegaConfig() {
115972
116004
  try {
115973
- 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");
115974
116006
  return JSON.parse(raw);
115975
116007
  } catch {
115976
116008
  return {};
@@ -115981,13 +116013,13 @@ function bareVersion(version4) {
115981
116013
  }
115982
116014
  function sdkComponentRoots(config2) {
115983
116015
  const roots = [
115984
- config2.sdkPath && (0, import_node_path5.join)(config2.sdkPath, "vega-sdk"),
115985
- (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")
115986
116018
  ].filter((p) => Boolean(p));
115987
116019
  return Array.from(new Set(roots));
115988
116020
  }
115989
116021
  async function resolveVersion(channelDir, preferred) {
115990
- 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;
115991
116023
  try {
115992
116024
  const versions = (await (0, import_promises4.readdir)(channelDir)).filter((e) => import_semver2.default.valid(e)).sort(import_semver2.default.rcompare);
115993
116025
  return versions[0] ?? null;
@@ -116001,10 +116033,10 @@ async function resolveVegaSdkImagesDir() {
116001
116033
  const channel = config2.defaultChannel || "main";
116002
116034
  const preferred = bareVersion(config2.defaultVersion);
116003
116035
  for (const root2 of sdkComponentRoots(config2)) {
116004
- const channelDir = (0, import_node_path5.join)(root2, channel);
116036
+ const channelDir = (0, import_node_path7.join)(root2, channel);
116005
116037
  const version4 = await resolveVersion(channelDir, preferred);
116006
116038
  if (!version4) continue;
116007
- const imagesDir = (0, import_node_path5.join)(channelDir, version4, "vvd", "images");
116039
+ const imagesDir = (0, import_node_path7.join)(channelDir, version4, "vvd", "images");
116008
116040
  if ((0, import_node_fs7.existsSync)(imagesDir)) return imagesDir;
116009
116041
  }
116010
116042
  return null;
@@ -116014,7 +116046,7 @@ async function listVvdImages() {
116014
116046
  if (!dir) return [];
116015
116047
  try {
116016
116048
  const entries = await (0, import_promises4.readdir)(dir, { withFileTypes: true });
116017
- 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));
116018
116050
  } catch {
116019
116051
  return [];
116020
116052
  }
@@ -117947,7 +117979,7 @@ function parseUiAutomatorDump(rawOutput, screenW, screenH, options = {}) {
117947
117979
  }
117948
117980
 
117949
117981
  // ../tool-server/src/blueprints/android-devtools.ts
117950
- var import_node_child_process13 = require("node:child_process");
117982
+ var import_node_child_process12 = require("node:child_process");
117951
117983
  var readline5 = __toESM(require("node:readline"));
117952
117984
  init_src();
117953
117985
 
@@ -118506,7 +118538,7 @@ async function spawnHelper(serial) {
118506
118538
  }
118507
118539
  );
118508
118540
  }
118509
- const proc = (0, import_node_child_process13.spawn)(
118541
+ const proc = (0, import_node_child_process12.spawn)(
118510
118542
  adbPath,
118511
118543
  ["-s", serial, "shell", "am", "instrument", "-w", manifest.instrumentationRunner],
118512
118544
  { stdio: ["ignore", "pipe", "pipe"] }
@@ -118808,9 +118840,9 @@ async function describeAndroid(registry2, serial, _bundleId, isTv) {
118808
118840
  // ../tool-server/src/preview.ts
118809
118841
  function findUiFile(name) {
118810
118842
  const candidates = [
118811
- import_node_path6.default.join(__dirname, "preview-ui", name),
118812
- import_node_path6.default.resolve(__dirname, "..", "..", "..", "ui", name),
118813
- 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)
118814
118846
  ];
118815
118847
  for (const p of candidates) {
118816
118848
  if (import_node_fs9.default.existsSync(p)) return p;
@@ -118819,7 +118851,7 @@ function findUiFile(name) {
118819
118851
  }
118820
118852
  function serveUiFile(res, filePath, contentType) {
118821
118853
  res.set("Cache-Control", "no-store, must-revalidate");
118822
- 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) });
118823
118855
  }
118824
118856
  function wsUrlFromHttp(httpUrl2) {
118825
118857
  const u = new URL(httpUrl2);
@@ -119134,7 +119166,7 @@ data: ${JSON.stringify(data)}
119134
119166
  const MAX_PREVIEW_BYTES = 25 * 1024 * 1024;
119135
119167
  const allowedRoots = (() => {
119136
119168
  const roots = /* @__PURE__ */ new Set();
119137
- 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"]) {
119138
119170
  try {
119139
119171
  roots.add(import_node_fs9.default.realpathSync(r));
119140
119172
  } catch {
@@ -119164,9 +119196,9 @@ data: ${JSON.stringify(data)}
119164
119196
  return;
119165
119197
  }
119166
119198
  const contained = allowedRoots.some(
119167
- (root2) => real === root2 || real.startsWith(root2 + import_node_path6.default.sep)
119199
+ (root2) => real === root2 || real.startsWith(root2 + import_node_path8.default.sep)
119168
119200
  );
119169
- const mime = IMG_MIME[import_node_path6.default.extname(real).toLowerCase()];
119201
+ const mime = IMG_MIME[import_node_path8.default.extname(real).toLowerCase()];
119170
119202
  if (!contained || !mime || size > MAX_PREVIEW_BYTES) {
119171
119203
  res.status(404).end();
119172
119204
  return;
@@ -119227,18 +119259,18 @@ data: ${JSON.stringify(data)}
119227
119259
  // ../tool-server/src/artifacts.ts
119228
119260
  var import_node_fs10 = require("node:fs");
119229
119261
  var import_promises7 = require("node:fs/promises");
119230
- var import_node_child_process15 = require("node:child_process");
119262
+ var import_node_child_process14 = require("node:child_process");
119231
119263
 
119232
119264
  // ../archive/src/index.ts
119233
- var import_node_child_process14 = require("node:child_process");
119265
+ var import_node_child_process13 = require("node:child_process");
119234
119266
  var import_promises6 = require("node:fs/promises");
119235
- var import_node_path7 = require("node:path");
119236
- var import_node_util11 = require("node:util");
119237
- 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);
119238
119270
  var ArchiveError = class extends Error {
119239
119271
  };
119240
119272
  function createTarGzArgs(sourcePath, target) {
119241
- 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)];
119242
119274
  }
119243
119275
  function normalizeTarMemberPath(memberPath) {
119244
119276
  return memberPath.replace(/^\.\//, "").replace(/\\/g, "/");
@@ -119247,24 +119279,24 @@ function isSafeTarMember(memberPath, destDir) {
119247
119279
  const normalized = normalizeTarMemberPath(memberPath);
119248
119280
  if (!normalized || normalized === "." || normalized === "./") return false;
119249
119281
  if (normalized.startsWith("/") || /^[A-Za-z]:[\\/]/.test(normalized)) return false;
119250
- const relative4 = import_node_path7.posix.normalize(normalized);
119282
+ const relative4 = import_node_path9.posix.normalize(normalized);
119251
119283
  if (relative4 === ".." || relative4.startsWith("../") || relative4.split("/").includes("..")) {
119252
119284
  return false;
119253
119285
  }
119254
- const root2 = (0, import_node_path7.resolve)(destDir);
119255
- const resolved = (0, import_node_path7.resolve)(destDir, relative4);
119256
- 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);
119257
119289
  }
119258
119290
  async function listTarMembers(tarPath) {
119259
- const { stdout } = await execFileAsync11("tar", ["-tzf", tarPath]);
119291
+ const { stdout } = await execFileAsync10("tar", ["-tzf", tarPath]);
119260
119292
  return stdout.split("\n").map((line) => line.trim()).filter((line) => line.length > 0);
119261
119293
  }
119262
119294
  function isEscapingLinkTarget(target) {
119263
119295
  if (target.startsWith("/") || /^[A-Za-z]:[\\/]/.test(target)) return true;
119264
- return import_node_path7.posix.normalize(target.replace(/\\/g, "/")).split("/").includes("..");
119296
+ return import_node_path9.posix.normalize(target.replace(/\\/g, "/")).split("/").includes("..");
119265
119297
  }
119266
119298
  async function assertSafeMemberTypes(tarPath) {
119267
- const { stdout } = await execFileAsync11("tar", ["-tzvf", tarPath]);
119299
+ const { stdout } = await execFileAsync10("tar", ["-tzvf", tarPath]);
119268
119300
  for (const line of stdout.split("\n")) {
119269
119301
  if (!line.trim()) continue;
119270
119302
  const type = line[0];
@@ -119306,7 +119338,7 @@ async function assertSafeArchive(tarPath, destDir) {
119306
119338
  async function resolveMember(destDir, expectedName) {
119307
119339
  const entries = await (0, import_promises6.readdir)(destDir);
119308
119340
  if (entries.includes(expectedName)) {
119309
- return (0, import_node_path7.join)(destDir, expectedName);
119341
+ return (0, import_node_path9.join)(destDir, expectedName);
119310
119342
  }
119311
119343
  const real = entries.filter((e) => !e.startsWith("._"));
119312
119344
  if (real.length !== 1) {
@@ -119314,11 +119346,11 @@ async function resolveMember(destDir, expectedName) {
119314
119346
  `Could not identify the extracted member (expected "${expectedName}", found ${real.length} entries).`
119315
119347
  );
119316
119348
  }
119317
- return (0, import_node_path7.join)(destDir, real[0]);
119349
+ return (0, import_node_path9.join)(destDir, real[0]);
119318
119350
  }
119319
119351
  async function safeExtractTarGz(tarPath, destDir, expectedName) {
119320
119352
  await assertSafeArchive(tarPath, destDir);
119321
- await execFileAsync11("tar", ["-xzf", tarPath, "-C", destDir]);
119353
+ await execFileAsync10("tar", ["-xzf", tarPath, "-C", destDir]);
119322
119354
  return resolveMember(destDir, expectedName);
119323
119355
  }
119324
119356
 
@@ -119370,7 +119402,7 @@ function makeArtifactListRoute(registry2) {
119370
119402
  function streamDirectoryAsTarGz(id, entry, res) {
119371
119403
  res.setHeader("Content-Type", "application/gzip");
119372
119404
  res.setHeader("Content-Disposition", `attachment; filename="${entry.filename}.tar.gz"`);
119373
- 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, "-"), {
119374
119406
  stdio: ["ignore", "pipe", "ignore"]
119375
119407
  });
119376
119408
  child.on("error", (err) => {
@@ -119390,8 +119422,8 @@ function streamDirectoryAsTarGz(id, entry, res) {
119390
119422
 
119391
119423
  // ../tool-server/src/file-inputs.ts
119392
119424
  var import_promises8 = require("node:fs/promises");
119393
- var import_node_os7 = require("node:os");
119394
- var import_node_path8 = require("node:path");
119425
+ var import_node_os8 = require("node:os");
119426
+ var import_node_path10 = require("node:path");
119395
119427
  var import_bytes = __toESM(require_bytes());
119396
119428
  init_src();
119397
119429
  var MAX_UPLOAD_BYTES = 32 * 1024 * 1024;
@@ -119444,8 +119476,8 @@ async function materializeUpload(wire) {
119444
119476
  `Uploaded content for "${wire.path}" is ${data.length} bytes but the client recorded ${wire.size} \u2014 refusing a truncated or corrupted upload.`
119445
119477
  );
119446
119478
  }
119447
- const dir = await (0, import_promises8.mkdtemp)((0, import_node_path8.join)((0, import_node_os7.tmpdir)(), "argent-file-input-"));
119448
- 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)));
119449
119481
  await (0, import_promises8.writeFile)(filePath, data);
119450
119482
  return { filePath, dir };
119451
119483
  }
@@ -119468,10 +119500,10 @@ async function extractTarUpload(wire, uploadId, meta3, tempDirs, lookupUpload) {
119468
119500
  );
119469
119501
  }
119470
119502
  const extractDir = await (0, import_promises8.mkdtemp)(
119471
- (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)}-`)
119472
119504
  );
119473
119505
  tempDirs.push(extractDir);
119474
- 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));
119475
119507
  return { value: uploaded, meta: { ...meta3, viaUpload: true } };
119476
119508
  } catch (err) {
119477
119509
  if (err instanceof FileInputError) throw err;
@@ -120019,7 +120051,7 @@ function createHttpApp(registry2, options) {
120019
120051
  return;
120020
120052
  }
120021
120053
  const id = (0, import_node_crypto6.randomUUID)();
120022
- 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`);
120023
120055
  const ws = (0, import_node_fs11.createWriteStream)(tarPath);
120024
120056
  let received = 0;
120025
120057
  let released = false;
@@ -120359,12 +120391,12 @@ function createHttpApp(registry2, options) {
120359
120391
  // ../tool-server/src/event-log.ts
120360
120392
  var import_bunyan = __toESM(require_bunyan());
120361
120393
  var import_node_fs12 = require("node:fs");
120362
- var import_node_path10 = require("node:path");
120394
+ var import_node_path12 = require("node:path");
120363
120395
  init_src();
120364
120396
  function createToolServerEventLog({
120365
120397
  filePath
120366
120398
  }) {
120367
- (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 });
120368
120400
  (0, import_node_fs12.writeFileSync)(filePath, "");
120369
120401
  const fileStream = (0, import_node_fs12.createWriteStream)(filePath, { flags: "a" });
120370
120402
  let disposed = false;
@@ -121027,7 +121059,7 @@ var chromiumJsRuntimeDebuggerBlueprint = {
121027
121059
  // ../tool-server/src/blueprints/tv-control.ts
121028
121060
  var net4 = __toESM(require("node:net"));
121029
121061
  var fs17 = __toESM(require("node:fs"));
121030
- var import_node_child_process16 = require("node:child_process");
121062
+ var import_node_child_process15 = require("node:child_process");
121031
121063
  init_src();
121032
121064
  var TV_CONTROL_NAMESPACE = "TvControl";
121033
121065
  function tvControlRef(device) {
@@ -121083,7 +121115,7 @@ async function sendJson(socketPath, command, timeoutMs) {
121083
121115
  }
121084
121116
  }
121085
121117
  function spawnAxDaemon(udid, socketPath) {
121086
- const proc = (0, import_node_child_process16.execFile)(
121118
+ const proc = (0, import_node_child_process15.execFile)(
121087
121119
  "xcrun",
121088
121120
  [
121089
121121
  "simctl",
@@ -121102,7 +121134,7 @@ function spawnAxDaemon(udid, socketPath) {
121102
121134
  return proc;
121103
121135
  }
121104
121136
  function spawnHidDaemon(udid, socketPath) {
121105
- const proc = (0, import_node_child_process16.execFile)(
121137
+ const proc = (0, import_node_child_process15.execFile)(
121106
121138
  tvosHidDaemonBinaryPath(),
121107
121139
  ["--udid", udid, "--socket", socketPath, "--timeout", "3600"],
121108
121140
  { encoding: "utf8" }
@@ -123567,16 +123599,19 @@ function clearCachedProfilerPaths(port, deviceId) {
123567
123599
  }
123568
123600
 
123569
123601
  // ../tool-server/src/tools/devices/boot-device.ts
123570
- var import_node_child_process18 = require("node:child_process");
123571
- 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");
123572
123607
  init_zod();
123573
123608
  init_src();
123574
123609
  init_adb();
123575
123610
 
123576
123611
  // ../tool-server/src/utils/linux-preflight.ts
123577
123612
  var fs19 = __toESM(require("node:fs"));
123578
- var import_node_os9 = require("node:os");
123579
- var import_node_path11 = require("node:path");
123613
+ var import_node_os10 = require("node:os");
123614
+ var import_node_path13 = require("node:path");
123580
123615
  var import_ini2 = __toESM(require_ini());
123581
123616
  function linuxBootDiagnostics(avdName) {
123582
123617
  if (process.platform !== "linux") return null;
@@ -123604,7 +123639,7 @@ function checkKvm() {
123604
123639
  var MIN_RAM_MB = 4096;
123605
123640
  var MIN_HEAP_MB = 512;
123606
123641
  function checkAvdSizing(avdName) {
123607
- 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");
123608
123643
  let content;
123609
123644
  try {
123610
123645
  content = fs19.readFileSync(configPath, "utf8");
@@ -123770,7 +123805,7 @@ async function waitForVvdRunning(timeoutMs) {
123770
123805
  }
123771
123806
 
123772
123807
  // ../tool-server/src/tools/devices/boot-electron.ts
123773
- var import_node_child_process17 = require("node:child_process");
123808
+ var import_node_child_process16 = require("node:child_process");
123774
123809
  var fs20 = __toESM(require("node:fs"));
123775
123810
  var net5 = __toESM(require("node:net"));
123776
123811
  var path18 = __toESM(require("node:path"));
@@ -123933,7 +123968,7 @@ async function bootElectronApp(options) {
123933
123968
  const args = [...launcher.args, `--remote-debugging-port=${port}`, ...extra];
123934
123969
  let child;
123935
123970
  try {
123936
- child = (0, import_node_child_process17.spawn)(launcher.command, args, {
123971
+ child = (0, import_node_child_process16.spawn)(launcher.command, args, {
123937
123972
  detached: true,
123938
123973
  stdio: ["ignore", "pipe", "pipe"],
123939
123974
  // Strip ELECTRON_RUN_AS_NODE (see electronGuiChildEnv): if the tool-server
@@ -124053,7 +124088,7 @@ async function bootElectronApp(options) {
124053
124088
  }
124054
124089
 
124055
124090
  // ../tool-server/src/tools/devices/boot-device.ts
124056
- 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);
124057
124092
  var zodSchema9 = external_exports.object({
124058
124093
  udid: external_exports.string().optional().describe(
124059
124094
  "iOS: simulator UDID to boot (from `list-devices`). Provide exactly one of `udid`, `avdName`, `vvdImage`, or `electronAppPath`."
@@ -124263,7 +124298,7 @@ async function bootIos(udid, registry2, force, headless) {
124263
124298
  const simState = simMatch?.state;
124264
124299
  const isTvOs = simMatch?.runtimeKind === "tv";
124265
124300
  if (force && simState === "Booted") {
124266
- await execFileAsync12("xcrun", ["simctl", "shutdown", udid]);
124301
+ await execFileAsync11("xcrun", ["simctl", "shutdown", udid]);
124267
124302
  }
124268
124303
  const needsPreBoot = simState === "Shutdown" || force && simState === "Booted";
124269
124304
  if (needsPreBoot) {
@@ -124274,13 +124309,13 @@ async function bootIos(udid, registry2, force, headless) {
124274
124309
  );
124275
124310
  });
124276
124311
  }
124277
- await execFileAsync12("xcrun", ["simctl", "boot", udid]).catch((err) => {
124312
+ await execFileAsync11("xcrun", ["simctl", "boot", udid]).catch((err) => {
124278
124313
  const message = err instanceof Error ? err.message : String(err);
124279
124314
  if (!message.includes("Unable to boot device in current state: Booted")) {
124280
124315
  throw err;
124281
124316
  }
124282
124317
  });
124283
- await execFileAsync12("xcrun", ["simctl", "bootstatus", udid, "-b"]);
124318
+ await execFileAsync11("xcrun", ["simctl", "bootstatus", udid, "-b"]);
124284
124319
  if (isTvOs && needsPreBoot) {
124285
124320
  await registry2.disposeService(`${TV_CONTROL_NAMESPACE}:${udid}`).catch((err) => {
124286
124321
  if (err instanceof ServiceNotFoundError) return;
@@ -124307,7 +124342,7 @@ async function bootIos(udid, registry2, force, headless) {
124307
124342
  if (initFailure?.givenUp) {
124308
124343
  return buildInitFailedResult(udid, initFailure);
124309
124344
  }
124310
- await execFileAsync12("defaults", [
124345
+ await execFileAsync11("defaults", [
124311
124346
  "write",
124312
124347
  "com.apple.iphonesimulator",
124313
124348
  "CurrentDeviceUDID",
@@ -124315,7 +124350,7 @@ async function bootIos(udid, registry2, force, headless) {
124315
124350
  ]).catch(() => {
124316
124351
  });
124317
124352
  if (!headless && !iosHeadlessFromEnv()) {
124318
- 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(() => {
124319
124354
  });
124320
124355
  }
124321
124356
  return { platform: "ios", udid, booted: true };
@@ -124354,11 +124389,25 @@ async function bootIosRemote(id, registry2, force) {
124354
124389
  }
124355
124390
  var HOT_BOOT_BUDGET_MS = 9e4;
124356
124391
  async function attemptBoot(params) {
124357
- 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, {
124358
124401
  detached: true,
124359
- stdio: "ignore"
124402
+ stdio
124360
124403
  });
124361
124404
  child.unref();
124405
+ if (emulatorLogFd !== void 0) {
124406
+ try {
124407
+ (0, import_node_fs13.closeSync)(emulatorLogFd);
124408
+ } catch {
124409
+ }
124410
+ }
124362
124411
  let earlyExitError = null;
124363
124412
  child.on("exit", (code, signal) => {
124364
124413
  if (signal) {
@@ -124926,10 +124975,10 @@ function dispatchByPlatform(opts) {
124926
124975
  }
124927
124976
 
124928
124977
  // ../tool-server/src/tools/launch-app/platforms/ios.ts
124929
- var import_node_child_process19 = require("node:child_process");
124930
- 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");
124931
124980
  init_src();
124932
- 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);
124933
124982
  function makeIosImpl(registry2) {
124934
124983
  return {
124935
124984
  requires: ["xcrun"],
@@ -124942,7 +124991,7 @@ function makeIosImpl(registry2) {
124942
124991
  const blocked = await precheckNativeDevtools(nativeDevtools, params.udid);
124943
124992
  if (blocked) return blocked;
124944
124993
  try {
124945
- await execFileAsync13("xcrun", ["simctl", "launch", params.udid, params.bundleId]);
124994
+ await execFileAsync12("xcrun", ["simctl", "launch", params.udid, params.bundleId]);
124946
124995
  } catch (err) {
124947
124996
  throw new FailureError(
124948
124997
  `Failed to launch iOS app ${params.bundleId} on ${params.udid}.`,
@@ -124962,9 +125011,9 @@ function makeIosImpl(registry2) {
124962
125011
  }
124963
125012
 
124964
125013
  // ../tool-server/src/utils/simctl-backend.ts
124965
- var import_node_child_process20 = require("node:child_process");
124966
- var import_node_util14 = require("node:util");
124967
- 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);
124968
125017
  var remoteSimctl = {
124969
125018
  launch: simctlLaunch,
124970
125019
  terminate: simctlTerminate
@@ -125164,10 +125213,10 @@ Common Android packages: com.android.settings, com.android.chrome, com.google.an
125164
125213
  init_zod();
125165
125214
 
125166
125215
  // ../tool-server/src/tools/restart-app/platforms/ios.ts
125167
- var import_node_child_process21 = require("node:child_process");
125168
- 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");
125169
125218
  init_src();
125170
- 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);
125171
125220
  function makeIosImpl2(registry2) {
125172
125221
  return {
125173
125222
  requires: ["xcrun"],
@@ -125181,11 +125230,11 @@ function makeIosImpl2(registry2) {
125181
125230
  const blocked = await precheckNativeDevtools(nativeDevtools, udid);
125182
125231
  if (blocked) return blocked;
125183
125232
  try {
125184
- await execFileAsync15("xcrun", ["simctl", "terminate", udid, bundleId]);
125233
+ await execFileAsync14("xcrun", ["simctl", "terminate", udid, bundleId]);
125185
125234
  } catch {
125186
125235
  }
125187
125236
  try {
125188
- await execFileAsync15("xcrun", ["simctl", "launch", udid, bundleId]);
125237
+ await execFileAsync14("xcrun", ["simctl", "launch", udid, bundleId]);
125189
125238
  } catch (err) {
125190
125239
  throw new FailureError(
125191
125240
  `Failed to restart iOS app ${bundleId} on ${udid}.`,
@@ -125342,22 +125391,22 @@ Returns { restarted, bundleId }. Fails if the app is not installed.`,
125342
125391
  init_zod();
125343
125392
 
125344
125393
  // ../tool-server/src/tools/reinstall-app/platforms/ios.ts
125345
- var import_node_child_process22 = require("node:child_process");
125346
- var import_node_util16 = require("node:util");
125347
- 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");
125348
125397
  init_src();
125349
- 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);
125350
125399
  var iosImpl = {
125351
125400
  requires: ["xcrun"],
125352
125401
  handler: async (_services, params) => {
125353
125402
  const { udid, bundleId, appPath } = params;
125354
- const absolute = (0, import_node_path12.resolve)(appPath);
125403
+ const absolute = (0, import_node_path15.resolve)(appPath);
125355
125404
  try {
125356
- await execFileAsync16("xcrun", ["simctl", "uninstall", udid, bundleId]);
125405
+ await execFileAsync15("xcrun", ["simctl", "uninstall", udid, bundleId]);
125357
125406
  } catch {
125358
125407
  }
125359
125408
  try {
125360
- await execFileAsync16("xcrun", ["simctl", "install", udid, absolute]);
125409
+ await execFileAsync15("xcrun", ["simctl", "install", udid, absolute]);
125361
125410
  } catch (err) {
125362
125411
  throw new FailureError(
125363
125412
  `Failed to install iOS app bundle on ${udid}.`,
@@ -125376,14 +125425,14 @@ var iosImpl = {
125376
125425
  };
125377
125426
 
125378
125427
  // ../tool-server/src/tools/reinstall-app/platforms/android.ts
125379
- var import_node_path13 = require("node:path");
125428
+ var import_node_path16 = require("node:path");
125380
125429
  init_src();
125381
125430
  init_adb();
125382
125431
  var androidImpl3 = {
125383
125432
  requires: ["adb"],
125384
125433
  handler: async (_services, params) => {
125385
125434
  const { udid, bundleId, appPath } = params;
125386
- const absolute = (0, import_node_path13.resolve)(appPath);
125435
+ const absolute = (0, import_node_path16.resolve)(appPath);
125387
125436
  try {
125388
125437
  await runAdb(["-s", udid, "uninstall", bundleId], { timeoutMs: 3e4 });
125389
125438
  } catch {
@@ -125405,12 +125454,12 @@ ${stderr}`;
125405
125454
  };
125406
125455
 
125407
125456
  // ../tool-server/src/tools/reinstall-app/platforms/ios-remote.ts
125408
- var import_node_path14 = require("node:path");
125457
+ var import_node_path17 = require("node:path");
125409
125458
  var iosRemoteImpl3 = {
125410
125459
  requires: ["sim-remote"],
125411
125460
  handler: async (_services, params) => {
125412
125461
  const { udid, bundleId, appPath } = params;
125413
- const absolute = (0, import_node_path14.resolve)(appPath);
125462
+ const absolute = (0, import_node_path17.resolve)(appPath);
125414
125463
  try {
125415
125464
  await simctlUninstall(udid, bundleId);
125416
125465
  } catch {
@@ -125421,13 +125470,13 @@ var iosRemoteImpl3 = {
125421
125470
  };
125422
125471
 
125423
125472
  // ../tool-server/src/tools/reinstall-app/platforms/vega.ts
125424
- var import_node_path15 = require("node:path");
125473
+ var import_node_path18 = require("node:path");
125425
125474
  init_src();
125426
125475
  var vegaImpl3 = {
125427
125476
  requires: ["vega"],
125428
125477
  handler: async (_services, params) => {
125429
125478
  const { udid, bundleId, appPath } = params;
125430
- const absolute = (0, import_node_path15.resolve)(appPath);
125479
+ const absolute = (0, import_node_path18.resolve)(appPath);
125431
125480
  await vegaDevice(udid, ["uninstall-app", "-a", bundleId], { timeoutMs: 6e4 }).catch(
125432
125481
  () => {
125433
125482
  }
@@ -125508,10 +125557,10 @@ var PERMISSION_NAMES = [
125508
125557
  ];
125509
125558
 
125510
125559
  // ../tool-server/src/tools/settings-permissions/platforms/ios.ts
125511
- var import_node_child_process23 = require("node:child_process");
125512
- 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");
125513
125562
  init_src();
125514
- 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);
125515
125564
  var SIMCTL_ACTION = {
125516
125565
  grant: "grant",
125517
125566
  deny: "revoke",
@@ -125536,13 +125585,13 @@ var NON_TCC_GRANT_NEEDS_INSTALL = /* @__PURE__ */ new Set([
125536
125585
  ]);
125537
125586
  var localBackend = {
125538
125587
  async run(udid, simctlAction, service, bundleId) {
125539
- await execFileAsync17("xcrun", ["simctl", "privacy", udid, simctlAction, service, bundleId], {
125588
+ await execFileAsync16("xcrun", ["simctl", "privacy", udid, simctlAction, service, bundleId], {
125540
125589
  timeout: 3e4
125541
125590
  });
125542
125591
  },
125543
125592
  async isInstalled(udid, bundleId) {
125544
125593
  try {
125545
- await execFileAsync17("xcrun", ["simctl", "get_app_container", udid, bundleId], {
125594
+ await execFileAsync16("xcrun", ["simctl", "get_app_container", udid, bundleId], {
125546
125595
  timeout: 15e3
125547
125596
  });
125548
125597
  return true;
@@ -125814,8 +125863,8 @@ Returns { action, permission, bundleId, applied, skipped? }: \`applied\` lists t
125814
125863
  init_zod();
125815
125864
 
125816
125865
  // ../tool-server/src/tools/open-url/platforms/ios.ts
125817
- var import_node_child_process24 = require("node:child_process");
125818
- 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");
125819
125868
  init_src();
125820
125869
 
125821
125870
  // ../tool-server/src/tools/open-url/deep-link-note.ts
@@ -125825,12 +125874,12 @@ function httpDeepLinkNote(url2) {
125825
125874
  }
125826
125875
 
125827
125876
  // ../tool-server/src/tools/open-url/platforms/ios.ts
125828
- 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);
125829
125878
  var iosImpl3 = {
125830
125879
  requires: ["xcrun"],
125831
125880
  handler: async (_services, params) => {
125832
125881
  try {
125833
- await execFileAsync18("xcrun", ["simctl", "openurl", params.udid, params.url]);
125882
+ await execFileAsync17("xcrun", ["simctl", "openurl", params.udid, params.url]);
125834
125883
  } catch (err) {
125835
125884
  throw new FailureError(
125836
125885
  `Failed to open URL on iOS simulator ${params.udid}.`,
@@ -125930,16 +125979,16 @@ Returns { opened, url, note? }. note carries the deep-linking caveat when a web
125930
125979
  };
125931
125980
 
125932
125981
  // ../tool-server/src/tools/screenshot/index.ts
125933
- var import_node_child_process25 = require("node:child_process");
125934
- 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");
125935
125984
  var os9 = __toESM(require("node:os"));
125936
125985
  var path19 = __toESM(require("node:path"));
125937
125986
  init_zod();
125938
125987
 
125939
125988
  // ../tool-server/src/utils/vega-screen.ts
125940
125989
  var import_promises10 = require("node:fs/promises");
125941
- var import_node_os10 = require("node:os");
125942
- var import_node_path16 = require("node:path");
125990
+ var import_node_os12 = require("node:os");
125991
+ var import_node_path19 = require("node:path");
125943
125992
  var import_pngjs = __toESM(require_png());
125944
125993
  init_src();
125945
125994
  init_adb();
@@ -126106,7 +126155,7 @@ async function captureVegaScreenshotPng(opts = {}) {
126106
126155
  async function captureViaEmulatorConsole(opts) {
126107
126156
  const port = await discoverVegaConsolePort();
126108
126157
  const serial = `emulator-${port}`;
126109
- 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-"));
126110
126159
  try {
126111
126160
  await runAdb(["-s", serial, "emu", "screenrecord", "screenshot", outDir], {
126112
126161
  timeoutMs: 2e4
@@ -126120,9 +126169,9 @@ async function captureViaEmulatorConsole(opts) {
126120
126169
  error_kind: "unknown"
126121
126170
  });
126122
126171
  }
126123
- 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)));
126124
126173
  const scaled = scalePng(decoded, opts.scale);
126125
- 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`);
126126
126175
  await (0, import_promises10.writeFile)(outPath, import_pngjs.PNG.sync.write(scaled));
126127
126176
  return outPath;
126128
126177
  } finally {
@@ -126146,7 +126195,7 @@ function scalePng(src, scale) {
126146
126195
  }
126147
126196
 
126148
126197
  // ../tool-server/src/tools/screenshot/index.ts
126149
- 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);
126150
126199
  var zodSchema15 = external_exports.object({
126151
126200
  udid: external_exports.string().describe(
126152
126201
  "Target device id from `list-devices` (iOS UDID, Android serial, Apple TV UDID, Vega serial, or Chromium id)."
@@ -126176,9 +126225,9 @@ async function tvScreenshot(udid, scale, signal) {
126176
126225
  os9.tmpdir(),
126177
126226
  `argent-tv-screenshot-${udid.slice(0, 8)}-${process.hrtime.bigint()}.png`
126178
126227
  );
126179
- await execFileAsync19("xcrun", ["simctl", "io", udid, "screenshot", file2], { signal });
126228
+ await execFileAsync18("xcrun", ["simctl", "io", udid, "screenshot", file2], { signal });
126180
126229
  if (scale < 1) {
126181
- await execFileAsync19("sips", ["-Z", String(await tvTargetLongSide(file2, scale)), file2], {
126230
+ await execFileAsync18("sips", ["-Z", String(await tvTargetLongSide(file2, scale)), file2], {
126182
126231
  signal
126183
126232
  }).catch(() => {
126184
126233
  });
@@ -126188,7 +126237,7 @@ async function tvScreenshot(udid, scale, signal) {
126188
126237
  async function tvTargetLongSide(file2, scale) {
126189
126238
  let longSide = 3840;
126190
126239
  try {
126191
- const { stdout } = await execFileAsync19("sips", ["-g", "pixelWidth", "-g", "pixelHeight", file2]);
126240
+ const { stdout } = await execFileAsync18("sips", ["-g", "pixelWidth", "-g", "pixelHeight", file2]);
126192
126241
  const width = Number(/pixelWidth:\s*(\d+)/.exec(stdout)?.[1]);
126193
126242
  const height = Number(/pixelHeight:\s*(\d+)/.exec(stdout)?.[1]);
126194
126243
  if (Number.isFinite(width) && Number.isFinite(height) && width > 0 && height > 0) {
@@ -139236,7 +139285,7 @@ var nativeProfilerSessionBlueprint = {
139236
139285
  var import_child_process4 = require("child_process");
139237
139286
  init_src();
139238
139287
  var import_fs9 = require("fs");
139239
- var import_node_fs13 = require("node:fs");
139288
+ var import_node_fs14 = require("node:fs");
139240
139289
  var path22 = __toESM(require("path"));
139241
139290
 
139242
139291
  // ../tool-server/src/utils/ios-profiler/notify.ts
@@ -139383,8 +139432,8 @@ var import_util6 = require("util");
139383
139432
  var DEFAULT_EXEC_TIMEOUT_MS = 6e4;
139384
139433
  var DEFAULT_EXEC_MAX_BUFFER = 256 * 1024 * 1024;
139385
139434
  async function execFileAsyncWithTimeout(file2, args, options = {}) {
139386
- const execFileAsync23 = (0, import_util6.promisify)(import_child_process2.execFile);
139387
- 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, {
139388
139437
  encoding: "utf-8",
139389
139438
  ...options,
139390
139439
  // The timeout and maxBuffer are this wrapper's whole purpose (the
@@ -140885,7 +140934,7 @@ function resolveDefaultTemplatePath() {
140885
140934
  )
140886
140935
  ];
140887
140936
  for (const candidate of candidates) {
140888
- if ((0, import_node_fs13.existsSync)(candidate)) return candidate;
140937
+ if ((0, import_node_fs14.existsSync)(candidate)) return candidate;
140889
140938
  }
140890
140939
  throw new FailureError(
140891
140940
  `Argent.tracetemplate not found. Looked in:
@@ -144606,7 +144655,39 @@ function createStopAllSimulatorServersTool(registry2) {
144606
144655
 
144607
144656
  // ../tool-server/src/tools/simulator/stop-metro.ts
144608
144657
  init_zod();
144609
- 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
+ }
144610
144691
  var zodSchema57 = external_exports.object({
144611
144692
  port: external_exports.number().int().min(1).max(65535).default(8081).describe("TCP port Metro is listening on (default 8081)")
144612
144693
  });
@@ -144618,14 +144699,7 @@ var stopMetroTool = {
144618
144699
  async execute(_services, params) {
144619
144700
  const port = params.port;
144620
144701
  try {
144621
- const output = (0, import_node_child_process26.execFileSync)("lsof", ["-ti", `tcp:${port}`, "-sTCP:LISTEN"], {
144622
- encoding: "utf-8",
144623
- timeout: 5e3
144624
- }).trim();
144625
- if (!output) {
144626
- return { stopped: false, port, pids: [] };
144627
- }
144628
- const pids = output.split("\n").map((s) => parseInt(s.trim(), 10)).filter((n) => !isNaN(n));
144702
+ const pids = listeningPids(port);
144629
144703
  if (pids.length === 0) {
144630
144704
  return { stopped: false, port, pids: [] };
144631
144705
  }
@@ -146817,7 +146891,7 @@ var import_pngjs2 = __toESM(require_png());
146817
146891
  // ../tool-server/src/tools/screenshot-diff/screenshot-diff-ocr.ts
146818
146892
  var import_child_process6 = require("child_process");
146819
146893
  var import_util7 = require("util");
146820
- var execFileAsync20 = (0, import_util7.promisify)(import_child_process6.execFile);
146894
+ var execFileAsync19 = (0, import_util7.promisify)(import_child_process6.execFile);
146821
146895
  var OCR_TIMEOUT_MS = 1e4;
146822
146896
  var OCR_MAX_BUFFER_BYTES = 32 * 1024 * 1024;
146823
146897
  var TESSERACT_BINARY = "tesseract";
@@ -146862,7 +146936,7 @@ async function extractOcrTextBlocks(imagePath) {
146862
146936
  }
146863
146937
  }
146864
146938
  async function recognizeTsv(imagePath) {
146865
- const { stdout } = await execFileAsync20(
146939
+ const { stdout } = await execFileAsync19(
146866
146940
  TESSERACT_BINARY,
146867
146941
  [
146868
146942
  imagePath,
@@ -148950,15 +149024,15 @@ async function runSnapshot(env, opts) {
148950
149024
  }
148951
149025
 
148952
149026
  // ../tool-server/src/utils/status-bar.ts
148953
- var import_node_child_process27 = require("node:child_process");
148954
- 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");
148955
149029
  init_adb();
148956
- 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);
148957
149031
  var DEMO_BROADCAST = "am broadcast -a com.android.systemui.demo";
148958
149032
  async function pinStatusBar(device) {
148959
149033
  try {
148960
149034
  if (device.platform === "ios") {
148961
- await execFileAsync21("xcrun", [
149035
+ await execFileAsync20("xcrun", [
148962
149036
  "simctl",
148963
149037
  "status_bar",
148964
149038
  device.id,
@@ -148999,7 +149073,7 @@ async function pinStatusBar(device) {
148999
149073
  async function restoreStatusBar(device) {
149000
149074
  try {
149001
149075
  if (device.platform === "ios") {
149002
- await execFileAsync21("xcrun", ["simctl", "status_bar", device.id, "clear"]);
149076
+ await execFileAsync20("xcrun", ["simctl", "status_bar", device.id, "clear"]);
149003
149077
  } else if (device.platform === "android") {
149004
149078
  try {
149005
149079
  await adbShell(device.id, `${DEMO_BROADCAST} -e command exit`);
@@ -149646,8 +149720,8 @@ init_zod();
149646
149720
 
149647
149721
  // ../tool-server/src/utils/workspace-reader.ts
149648
149722
  var import_promises12 = require("node:fs/promises");
149649
- var import_node_path17 = require("node:path");
149650
- 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");
149651
149725
  var import_dotenv = __toESM(require_main());
149652
149726
  async function exists(path36) {
149653
149727
  try {
@@ -149691,7 +149765,7 @@ async function listDir(path36) {
149691
149765
  var COMMAND_TIMEOUT_MS = 3e3;
149692
149766
  function runVersionCommand(cmd, args, cwd) {
149693
149767
  return new Promise((resolve7) => {
149694
- 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) => {
149695
149769
  if (err) {
149696
149770
  resolve7(null);
149697
149771
  return;
@@ -149734,7 +149808,7 @@ async function detectLockfile(workspacePath) {
149734
149808
  const checks = await Promise.all(
149735
149809
  LOCKFILES.map(async (name) => ({
149736
149810
  name,
149737
- exists: await exists((0, import_node_path17.join)(workspacePath, name))
149811
+ exists: await exists((0, import_node_path20.join)(workspacePath, name))
149738
149812
  }))
149739
149813
  );
149740
149814
  return checks.find((c) => c.exists)?.name ?? null;
@@ -149753,7 +149827,7 @@ var CI_CONFIGS = [
149753
149827
  ];
149754
149828
  async function detectCiConfig(workspacePath) {
149755
149829
  for (const ci of CI_CONFIGS) {
149756
- 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;
149757
149831
  }
149758
149832
  return null;
149759
149833
  }
@@ -149774,7 +149848,7 @@ async function detectLintStagedConfig(workspacePath, packageJson) {
149774
149848
  return packageJson["lint-staged"];
149775
149849
  }
149776
149850
  for (const file2 of LINT_STAGED_FILES) {
149777
- const full = (0, import_node_path17.join)(workspacePath, file2);
149851
+ const full = (0, import_node_path20.join)(workspacePath, file2);
149778
149852
  if (await exists(full)) {
149779
149853
  if (file2.endsWith(".json") || file2 === ".lintstagedrc") {
149780
149854
  return readJsonFile(full);
@@ -149816,7 +149890,7 @@ var CONFIG_FILES = [
149816
149890
  async function detectConfigFiles(workspacePath) {
149817
149891
  const results = await Promise.allSettled(
149818
149892
  CONFIG_FILES.map(async (file2) => {
149819
- 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;
149820
149894
  return null;
149821
149895
  })
149822
149896
  );
@@ -149855,7 +149929,7 @@ async function detectEnvFiles(workspacePath) {
149855
149929
  const envFileNames = entries.filter((e) => e === ".env" || e.startsWith(".env."));
149856
149930
  const results = await Promise.all(
149857
149931
  envFileNames.map(async (name) => {
149858
- const content = await readTextFile((0, import_node_path17.join)(workspacePath, name));
149932
+ const content = await readTextFile((0, import_node_path20.join)(workspacePath, name));
149859
149933
  return {
149860
149934
  name,
149861
149935
  keys: content ? extractEnvKeys(content) : []
@@ -149882,34 +149956,34 @@ async function readWorkspaceSnapshot(workspacePath) {
149882
149956
  ciConfig,
149883
149957
  configFilesFound
149884
149958
  ] = await Promise.all([
149885
- readJsonFile((0, import_node_path17.join)(workspacePath, "package.json")),
149886
- readJsonFile((0, import_node_path17.join)(workspacePath, "app.json")),
149887
- readJsonFile((0, import_node_path17.join)(workspacePath, "eas.json")),
149888
- readJsonFile((0, import_node_path17.join)(workspacePath, "tsconfig.json")),
149889
- readTextFile((0, import_node_path17.join)(workspacePath, "metro.config.js")).then(
149890
- (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"))
149891
149965
  ),
149892
- readTextFile((0, import_node_path17.join)(workspacePath, "babel.config.js")).then(
149893
- (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"))
149894
149968
  ),
149895
- isDirectory((0, import_node_path17.join)(workspacePath, "ios")),
149896
- 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")),
149897
149971
  detectLockfile(workspacePath),
149898
149972
  detectEnvFiles(workspacePath),
149899
149973
  detectToolVersions(workspacePath),
149900
- listDir((0, import_node_path17.join)(workspacePath, "scripts")),
149901
- 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")),
149902
149976
  detectCiConfig(workspacePath),
149903
149977
  detectConfigFiles(workspacePath)
149904
149978
  ]);
149905
- const iosDir = (0, import_node_path17.join)(workspacePath, "ios");
149906
- 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");
149907
149981
  const [iosWorkspace, iosHasPodfile, makefileText, lintStagedConfig, androidHasGradle] = await Promise.all([
149908
149982
  hasIosDir ? findIosWorkspace(iosDir) : Promise.resolve(null),
149909
- exists((0, import_node_path17.join)(workspacePath, "ios", "Podfile")),
149910
- 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")),
149911
149985
  detectLintStagedConfig(workspacePath, packageJson),
149912
- 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)
149913
149987
  ]);
149914
149988
  const metroPort = metroConfigRaw ? extractMetroPort(metroConfigRaw) : null;
149915
149989
  const makefileTargets = makefileText ? extractMakefileTargets(makefileText) : null;
@@ -149975,7 +150049,7 @@ Fails if the workspacePath is not an absolute path or the directory cannot be ac
149975
150049
  };
149976
150050
 
149977
150051
  // ../tool-server/src/tools/system/update-argent.ts
149978
- var import_node_child_process29 = require("node:child_process");
150052
+ var import_node_child_process28 = require("node:child_process");
149979
150053
  var fs43 = __toESM(require("node:fs"));
149980
150054
  var path32 = __toESM(require("node:path"));
149981
150055
  init_zod();
@@ -150105,7 +150179,7 @@ var updateArgentTool = {
150105
150179
  if (spawnRoot) updateArgs.push("--project-root", spawnRoot);
150106
150180
  const cmd = cliEntry ? process.execPath : "argent";
150107
150181
  const args = cliEntry ? [cliEntry, ...updateArgs] : updateArgs;
150108
- const child = (0, import_node_child_process29.spawn)(cmd, args, {
150182
+ const child = (0, import_node_child_process28.spawn)(cmd, args, {
150109
150183
  detached: true,
150110
150184
  stdio: "ignore",
150111
150185
  env: { ...process.env, ARGENT_UPDATE_TRIGGER: "mcp_update" }
@@ -150154,7 +150228,7 @@ var dismissUpdateTool = {
150154
150228
  // ../tool-server/src/tools/screenshot-diff/index.ts
150155
150229
  var import_node_crypto8 = __toESM(require("node:crypto"));
150156
150230
  var import_promises13 = __toESM(require("fs/promises"));
150157
- var import_node_os11 = __toESM(require("node:os"));
150231
+ var import_node_os13 = __toESM(require("node:os"));
150158
150232
  var import_path9 = __toESM(require("path"));
150159
150233
  init_zod();
150160
150234
  init_src();
@@ -150236,7 +150310,7 @@ async function resolveOutputDir(params, options) {
150236
150310
  return params.outputDir;
150237
150311
  }
150238
150312
  const dir = import_path9.default.join(
150239
- import_node_os11.default.tmpdir(),
150313
+ import_node_os13.default.tmpdir(),
150240
150314
  "argent-screenshot-diff",
150241
150315
  import_node_crypto8.default.randomBytes(6).toString("hex")
150242
150316
  );
@@ -150928,12 +151002,12 @@ function createRegistry() {
150928
151002
  }
150929
151003
 
150930
151004
  // ../tool-server/src/utils/simulator-watcher.ts
150931
- var import_node_child_process30 = require("node:child_process");
150932
- var import_node_util21 = require("node:util");
150933
- var execFileAsync22 = (0, import_node_util21.promisify)(import_node_child_process30.execFile);
151005
+ var import_node_child_process29 = require("node:child_process");
151006
+ var import_node_util20 = require("node:util");
151007
+ var execFileAsync21 = (0, import_node_util20.promisify)(import_node_child_process29.execFile);
150934
151008
  var POLL_INTERVAL_MS2 = 1e4;
150935
151009
  async function getBootedUdids() {
150936
- const { stdout } = await execFileAsync22("xcrun", ["simctl", "list", "devices", "--json"]);
151010
+ const { stdout } = await execFileAsync21("xcrun", ["simctl", "list", "devices", "--json"]);
150937
151011
  const data = JSON.parse(stdout);
150938
151012
  const udids = /* @__PURE__ */ new Set();
150939
151013
  for (const devices of Object.values(data.devices)) {
@@ -150990,7 +151064,7 @@ function startSimulatorWatcher(registry2) {
150990
151064
  }
150991
151065
 
150992
151066
  // ../tool-server/src/utils/preview-window.ts
150993
- var import_node_child_process31 = require("node:child_process");
151067
+ var import_node_child_process30 = require("node:child_process");
150994
151068
  var fs45 = __toESM(require("node:fs"));
150995
151069
  var os12 = __toESM(require("node:os"));
150996
151070
  var path34 = __toESM(require("node:path"));
@@ -151022,10 +151096,10 @@ function ensureLensAppBundle(electronBin) {
151022
151096
  fs45.copyFileSync(path34.join(realContents, "Info.plist"), plist);
151023
151097
  const setPlist = (entry, value) => {
151024
151098
  try {
151025
- (0, import_node_child_process31.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Set :${entry} ${value}`, plist]);
151099
+ (0, import_node_child_process30.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Set :${entry} ${value}`, plist]);
151026
151100
  } catch {
151027
151101
  try {
151028
- (0, import_node_child_process31.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Add :${entry} string ${value}`, plist]);
151102
+ (0, import_node_child_process30.execFileSync)("/usr/libexec/PlistBuddy", ["-c", `Add :${entry} string ${value}`, plist]);
151029
151103
  } catch {
151030
151104
  }
151031
151105
  }
@@ -151084,7 +151158,7 @@ function createPreviewWindowManager(opts = {}) {
151084
151158
  const wrapperBin = ensureLensAppBundle(electronBin);
151085
151159
  const launchBin = wrapperBin ?? electronBin;
151086
151160
  const launchArgs = wrapperBin ? ["--no-sandbox", mainScript] : [mainScript];
151087
- const next = (0, import_node_child_process31.spawn)(launchBin, launchArgs, {
151161
+ const next = (0, import_node_child_process30.spawn)(launchBin, launchArgs, {
151088
151162
  // Strip ELECTRON_RUN_AS_NODE so the child boots as a GUI Electron app, not
151089
151163
  // a bare Node runtime (see electronGuiChildEnv). An Electron-based MCP
151090
151164
  // host puts it in our env, and inheriting it makes main.cjs crash at
@@ -151209,7 +151283,7 @@ function start() {
151209
151283
  attachRegistryLogger(registry2);
151210
151284
  let eventLog = null;
151211
151285
  if (isFlagEnabled("tool-server-event-log")) {
151212
- const eventLogPath = process.env.ARGENT_EVENT_LOG || path35.join((0, import_node_os12.homedir)(), ".argent", "tool-server-events.jsonl");
151286
+ const eventLogPath = process.env.ARGENT_EVENT_LOG || path35.join((0, import_node_os14.homedir)(), ".argent", "tool-server-events.jsonl");
151213
151287
  try {
151214
151288
  eventLog = createToolServerEventLog({ filePath: eventLogPath });
151215
151289
  } catch (err) {