@swmansion/argent 0.34.1-next.17 → 0.34.1-next.18

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.
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/cli-cmds.mjs CHANGED
@@ -36082,7 +36082,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
36082
36082
  var SESSION_ID2 = randomUUID5();
36083
36083
  function readCliVersion() {
36084
36084
  if (true) {
36085
- return "0.34.1-next.17";
36085
+ return "0.34.1-next.18";
36086
36086
  }
36087
36087
  return "0.0.0";
36088
36088
  }
@@ -16881,7 +16881,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16881
16881
  var SESSION_ID = randomUUID4();
16882
16882
  function readCliVersion() {
16883
16883
  if (true) {
16884
- return "0.34.1-next.17";
16884
+ return "0.34.1-next.18";
16885
16885
  }
16886
16886
  return "0.0.0";
16887
16887
  }
@@ -101345,7 +101345,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
101345
101345
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
101346
101346
  function readCliVersion() {
101347
101347
  if (true) {
101348
- return "0.34.1-next.17";
101348
+ return "0.34.1-next.18";
101349
101349
  }
101350
101350
  return "0.0.0";
101351
101351
  }
@@ -125015,8 +125015,6 @@ function execSimctl(args, options = {}) {
125015
125015
  let stdout = "";
125016
125016
  let stderr = "";
125017
125017
  let settled = false;
125018
- child.stdout.setEncoding("utf8").on("data", (chunk) => stdout += chunk);
125019
- child.stderr.setEncoding("utf8").on("data", (chunk) => stderr += chunk);
125020
125018
  const settle3 = (err) => {
125021
125019
  if (settled) return;
125022
125020
  settled = true;
@@ -125038,6 +125036,8 @@ function execSimctl(args, options = {}) {
125038
125036
  }, timeoutMs);
125039
125037
  options.signal?.addEventListener("abort", onAbort, { once: true });
125040
125038
  child.on("error", (err) => settle3(err));
125039
+ child.stdout?.setEncoding("utf8").on("data", (chunk) => stdout += chunk);
125040
+ child.stderr?.setEncoding("utf8").on("data", (chunk) => stderr += chunk);
125041
125041
  child.on("close", (code, sig) => {
125042
125042
  if (code === 0) return settle3(null);
125043
125043
  settle3(
@@ -125396,22 +125396,39 @@ async function spawnSimulatorServerProcess(udid, subcommand) {
125396
125396
  let settled = false;
125397
125397
  const STREAM_GRACE_MS = 500;
125398
125398
  let apiReadyTimer = null;
125399
- const rl = readline.createInterface({ input: proc.stdout });
125400
125399
  const settle3 = (fn, cleanup) => {
125401
125400
  if (settled) return;
125402
125401
  settled = true;
125403
125402
  clearTimeout(timer);
125404
125403
  if (apiReadyTimer) clearTimeout(apiReadyTimer);
125405
- rl.close();
125404
+ rl?.close();
125406
125405
  cleanup?.();
125407
125406
  fn();
125408
125407
  };
125408
+ proc.on("error", (err) => {
125409
+ settle3(
125410
+ () => reject(
125411
+ new FailureError(
125412
+ err instanceof Error ? err.message : String(err),
125413
+ {
125414
+ error_code: FAILURE_CODES.SIMULATOR_SERVER_PROCESS_ERROR,
125415
+ failure_stage: "simulator_server_spawn_process",
125416
+ failure_area: "tool_server",
125417
+ error_kind: "subprocess",
125418
+ ...subprocessFailureMetadata(err, "simulator_server")
125419
+ },
125420
+ { cause: err instanceof Error ? err : new Error(String(err)) }
125421
+ )
125422
+ )
125423
+ );
125424
+ });
125425
+ const rl = proc.stdout ? readline.createInterface({ input: proc.stdout }) : null;
125409
125426
  let exited = false;
125410
125427
  const resolveWhenReady = () => {
125411
125428
  if (apiUrl == null || exited) return;
125412
125429
  settle3(() => resolve19({ proc, apiUrl, streamUrl }));
125413
125430
  };
125414
- rl.on("line", (rawLine) => {
125431
+ rl?.on("line", (rawLine) => {
125415
125432
  const line = rawLine.trim();
125416
125433
  if (line.startsWith("stream_ready ")) {
125417
125434
  const match = line.match(/(http:\/\/[^ ]+)/);
@@ -125472,23 +125489,6 @@ async function spawnSimulatorServerProcess(udid, subcommand) {
125472
125489
  fail();
125473
125490
  });
125474
125491
  });
125475
- proc.on("error", (err) => {
125476
- settle3(
125477
- () => reject(
125478
- new FailureError(
125479
- err instanceof Error ? err.message : String(err),
125480
- {
125481
- error_code: FAILURE_CODES.SIMULATOR_SERVER_PROCESS_ERROR,
125482
- failure_stage: "simulator_server_spawn_process",
125483
- failure_area: "tool_server",
125484
- error_kind: "subprocess",
125485
- ...subprocessFailureMetadata(err, "simulator_server")
125486
- },
125487
- { cause: err instanceof Error ? err : new Error(String(err)) }
125488
- )
125489
- )
125490
- );
125491
- });
125492
125492
  const timer = setTimeout(() => {
125493
125493
  settle3(
125494
125494
  () => reject(
@@ -131660,12 +131660,29 @@ async function spawnHelper(serial) {
131660
131660
  settled = true;
131661
131661
  clearTimeout(timer);
131662
131662
  clearTimeout(exitGrace);
131663
- rl.close();
131663
+ rl?.close();
131664
131664
  cleanup?.();
131665
131665
  fn();
131666
131666
  };
131667
- const rl = readline2.createInterface({ input: proc.stdout });
131668
- rl.on("line", async (rawLine) => {
131667
+ proc.on("error", (err) => {
131668
+ settle3(
131669
+ () => reject(
131670
+ new FailureError(
131671
+ "android-devtools helper process error.",
131672
+ {
131673
+ error_code: FAILURE_CODES.ANDROID_DEVTOOLS_HELPER_PROCESS_ERROR,
131674
+ failure_stage: "android_devtools_helper_process",
131675
+ failure_area: "tool_server",
131676
+ error_kind: "subprocess",
131677
+ ...subprocessFailureMetadata(err, "android_devtools")
131678
+ },
131679
+ { cause: err }
131680
+ )
131681
+ )
131682
+ );
131683
+ });
131684
+ const rl = proc.stdout ? readline2.createInterface({ input: proc.stdout }) : null;
131685
+ rl?.on("line", async (rawLine) => {
131669
131686
  const line = rawLine.trim();
131670
131687
  if (statusBuf.length < HELPER_STATUS_MAX_CHARS && HELPER_STATUS_MARKER.test(line)) {
131671
131688
  statusBuf = (statusBuf ? `${statusBuf} ${line}` : line).slice(0, HELPER_STATUS_MAX_CHARS);
@@ -131723,23 +131740,6 @@ async function spawnHelper(serial) {
131723
131740
  exitGrace = setTimeout(() => settle3(rejectExited), EXIT_GRACE_MS);
131724
131741
  });
131725
131742
  proc.on("close", () => settle3(rejectExited));
131726
- proc.on("error", (err) => {
131727
- settle3(
131728
- () => reject(
131729
- new FailureError(
131730
- "android-devtools helper process error.",
131731
- {
131732
- error_code: FAILURE_CODES.ANDROID_DEVTOOLS_HELPER_PROCESS_ERROR,
131733
- failure_stage: "android_devtools_helper_process",
131734
- failure_area: "tool_server",
131735
- error_kind: "subprocess",
131736
- ...subprocessFailureMetadata(err, "android_devtools")
131737
- },
131738
- { cause: err }
131739
- )
131740
- )
131741
- );
131742
- });
131743
131743
  const timer = setTimeout(() => {
131744
131744
  settle3(
131745
131745
  () => reject(
@@ -132677,6 +132677,7 @@ function streamDirectoryAsArchive(id, entry, req, res) {
132677
132677
  res.destroy();
132678
132678
  }
132679
132679
  });
132680
+ if (!child.stdout) return;
132680
132681
  const compressor = createCompressor(format);
132681
132682
  res.on("close", () => {
132682
132683
  if (res.writableFinished) return;
@@ -141708,9 +141709,6 @@ async function startSuspensionWatch(helperPath, pid) {
141708
141709
  let ended = false;
141709
141710
  let waiters = [];
141710
141711
  let stderr = "";
141711
- child.stderr.on("data", (d) => {
141712
- if (stderr.length < 2e3) stderr += d.toString("utf8");
141713
- });
141714
141712
  const close = (atMs) => {
141715
141713
  if (since !== null) windows.push({ startMs: since, endMs: Math.max(since, atMs) });
141716
141714
  since = null;
@@ -141720,7 +141718,15 @@ async function startSuspensionWatch(helperPath, pid) {
141720
141718
  };
141721
141719
  let reported;
141722
141720
  const firstState = new Promise((resolve19) => reported = resolve19);
141723
- readline3.createInterface({ input: child.stdout }).on("line", (line) => {
141721
+ child.on("error", (err) => {
141722
+ stderr ||= err.message;
141723
+ reported(false);
141724
+ });
141725
+ child.stderr?.on("data", (d) => {
141726
+ if (stderr.length < 2e3) stderr += d.toString("utf8");
141727
+ });
141728
+ const rl = child.stdout ? readline3.createInterface({ input: child.stdout }) : null;
141729
+ rl?.on("line", (line) => {
141724
141730
  let event2;
141725
141731
  try {
141726
141732
  event2 = JSON.parse(line);
@@ -141733,10 +141739,6 @@ async function startSuspensionWatch(helperPath, pid) {
141733
141739
  if (event2.suspended && since === null) since = event2.at;
141734
141740
  else if (!event2.suspended) close(event2.at);
141735
141741
  });
141736
- child.on("error", (err) => {
141737
- stderr ||= err.message;
141738
- reported(false);
141739
- });
141740
141742
  child.on("exit", () => {
141741
141743
  reported(false);
141742
141744
  if (!ended) close(Date.now());
@@ -142096,14 +142098,16 @@ function macosLaunchEnv(bundleId, listenSocketEnv, extra = {}) {
142096
142098
  if (listenSocketEnv) env.NATIVE_DEVTOOLS_LISTEN_SOCKET = listenSocketEnv;
142097
142099
  return env;
142098
142100
  }
142099
- async function helperPid(child, executable) {
142100
- const failed3 = (detail, cause) => macosFailure(
142101
+ function helperLaunchFailure(executable, detail, cause) {
142102
+ return macosFailure(
142101
142103
  `argent-macos-helper could not start ${executable}: ${detail}`,
142102
142104
  FAILURE_CODES.MACOS_APP_SPAWN_FAILED,
142103
142105
  "macos_app_helper_launch",
142104
142106
  "subprocess",
142105
142107
  cause
142106
142108
  );
142109
+ }
142110
+ async function helperPid(child, executable) {
142107
142111
  let stdout = "";
142108
142112
  let stderr = "";
142109
142113
  child.stdout.setEncoding("utf8").on("data", (chunk) => stdout += chunk);
@@ -142122,12 +142126,16 @@ async function helperPid(child, executable) {
142122
142126
  (0, import_node_events4.once)(child.stderr, "close")
142123
142127
  ]);
142124
142128
  } catch (err) {
142125
- throw failed3(errorMessage2(err), err);
142129
+ throw helperLaunchFailure(executable, errorMessage2(err), err);
142126
142130
  } finally {
142127
142131
  clearTimeout(timer);
142128
142132
  }
142129
- if (timedOut3) throw failed3(`no answer within ${HELPER_TIMEOUT_MS} ms`);
142130
- if (code !== 0) throw failed3(stderr.trim() || (signal ? `killed by ${signal}` : `exit ${code}`));
142133
+ if (timedOut3) throw helperLaunchFailure(executable, `no answer within ${HELPER_TIMEOUT_MS} ms`);
142134
+ if (code !== 0)
142135
+ throw helperLaunchFailure(
142136
+ executable,
142137
+ stderr.trim() || (signal ? `killed by ${signal}` : `exit ${code}`)
142138
+ );
142131
142139
  const line = stdout.split("\n").find((l) => l.trim().startsWith("{"));
142132
142140
  let pid;
142133
142141
  try {
@@ -142135,7 +142143,7 @@ async function helperPid(child, executable) {
142135
142143
  } catch {
142136
142144
  }
142137
142145
  if (typeof pid !== "number" || !Number.isInteger(pid) || pid <= 0) {
142138
- throw failed3(`unexpected output ${JSON.stringify(stdout.trim())}`);
142146
+ throw helperLaunchFailure(executable, `unexpected output ${JSON.stringify(stdout.trim())}`);
142139
142147
  }
142140
142148
  return pid;
142141
142149
  }
@@ -142488,6 +142496,11 @@ function createMacosAppApi(bundleId) {
142488
142496
  cwd: "/"
142489
142497
  }
142490
142498
  );
142499
+ try {
142500
+ await (0, import_node_events4.once)(helper, "spawn");
142501
+ } catch (err) {
142502
+ throw helperLaunchFailure(info.executable, errorMessage2(err), err);
142503
+ }
142491
142504
  const ch = new LibraryChannel(
142492
142505
  helper.stdio[3],
142493
142506
  bundleId,
@@ -170283,12 +170296,6 @@ async function startPerfetto(opts) {
170283
170296
  const child = (0, import_child_process7.spawn)(adbPath, adbArgv(args), { stdio: ["pipe", "pipe", "pipe"] });
170284
170297
  let stdout = "";
170285
170298
  let stderr = "";
170286
- child.stdout.on("data", (chunk) => {
170287
- stdout += chunk.toString("utf8");
170288
- });
170289
- child.stderr.on("data", (chunk) => {
170290
- stderr += chunk.toString("utf8");
170291
- });
170292
170299
  const pid = await new Promise((resolve19, reject) => {
170293
170300
  let settled = false;
170294
170301
  const timer = setTimeout(() => {
@@ -170337,7 +170344,7 @@ async function startPerfetto(opts) {
170337
170344
  )
170338
170345
  )
170339
170346
  );
170340
- child.stdin.on(
170347
+ child.stdin?.on(
170341
170348
  "error",
170342
170349
  (err) => fail(
170343
170350
  new FailureError(
@@ -170363,7 +170370,13 @@ async function startPerfetto(opts) {
170363
170370
  if (!Number.isFinite(parsed2) || parsed2 <= 0) return;
170364
170371
  succeed(parsed2);
170365
170372
  };
170366
- child.stdout.on("data", () => tryResolve2());
170373
+ child.stdout?.on("data", (chunk) => {
170374
+ stdout += chunk.toString("utf8");
170375
+ tryResolve2();
170376
+ });
170377
+ child.stderr?.on("data", (chunk) => {
170378
+ stderr += chunk.toString("utf8");
170379
+ });
170367
170380
  child.once("exit", (code, signal) => {
170368
170381
  if (settled) return;
170369
170382
  const reason2 = signal ? `signal ${signal}` : `code ${code ?? "?"}`;
@@ -170397,8 +170410,8 @@ async function startPerfetto(opts) {
170397
170410
  );
170398
170411
  });
170399
170412
  try {
170400
- child.stdin.write(cfgText);
170401
- child.stdin.end();
170413
+ child.stdin?.write(cfgText);
170414
+ child.stdin?.end();
170402
170415
  } catch (err) {
170403
170416
  fail(
170404
170417
  new FailureError(
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.17",
3
+ "version": "0.34.1-next.18",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator, Android Emulator, Chromium app and Mac app control",
6
6
  "license": "Apache-2.0",