@swmansion/argent 0.22.2-next.1 → 0.22.2-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli-cmds.mjs CHANGED
@@ -7210,7 +7210,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
7210
7210
  var SESSION_ID2 = randomUUID5();
7211
7211
  function readCliVersion() {
7212
7212
  if (true) {
7213
- return "0.22.2-next.1";
7213
+ return "0.22.2-next.3";
7214
7214
  }
7215
7215
  return "0.0.0";
7216
7216
  }
@@ -16428,7 +16428,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
16428
16428
  var SESSION_ID = randomUUID4();
16429
16429
  function readCliVersion() {
16430
16430
  if (true) {
16431
- return "0.22.2-next.1";
16431
+ return "0.22.2-next.3";
16432
16432
  }
16433
16433
  return "0.0.0";
16434
16434
  }
@@ -76339,15 +76339,28 @@ async function emulatorSupportsFlag(flag, options = {}) {
76339
76339
  const cached3 = emulatorFlagSupportCache.get(cacheKey3);
76340
76340
  if (cached3 !== void 0) return cached3;
76341
76341
  let output;
76342
+ let failure = null;
76342
76343
  try {
76343
76344
  const { stdout, stderr } = await execFileAsync9(emulatorPath, ["-help"], {
76344
76345
  timeout: options.timeoutMs ?? 1e4,
76346
+ // Same hazard runAdb guards against: a SIGTERM-immune child (emulator
76347
+ // wedged in Qt/graphics init) leaves execFile unsettled forever, and
76348
+ // this await has no deadline of its own.
76349
+ killSignal: "SIGKILL",
76345
76350
  maxBuffer: 8 * 1024 * 1024
76346
76351
  });
76347
76352
  output = stdout + stderr;
76348
76353
  } catch (err) {
76349
76354
  const e = err;
76350
- output = (e.stdout ?? "") + (e.stderr ?? "");
76355
+ output = e.killed ? "" : (e.stdout ?? "") + (e.stderr ?? "");
76356
+ failure = err instanceof Error ? err.message : String(err);
76357
+ }
76358
+ if (output === "") {
76359
+ process.stderr.write(
76360
+ `[argent] \`${emulatorPath} -help\` produced no complete listing ` + (failure ? `(${failure})` : "but exited successfully") + `; assuming "${flag}" unsupported for this boot and retrying on the next one
76361
+ `
76362
+ );
76363
+ return false;
76351
76364
  }
76352
76365
  const supported = output.includes(flag);
76353
76366
  emulatorFlagSupportCache.set(cacheKey3, supported);
@@ -76557,7 +76570,10 @@ async function listAvds() {
76557
76570
  const emulatorPath = await resolveAndroidBinary("emulator");
76558
76571
  if (!emulatorPath) return [];
76559
76572
  try {
76560
- const { stdout } = await execFileAsync9(emulatorPath, ["-list-avds"], { timeout: 5e3 });
76573
+ const { stdout } = await execFileAsync9(emulatorPath, ["-list-avds"], {
76574
+ timeout: 5e3,
76575
+ killSignal: "SIGKILL"
76576
+ });
76561
76577
  return stdout.split("\n").map((l) => l.trim()).filter((l) => l && AVD_NAME_PATTERN.test(l)).map((name) => ({ name }));
76562
76578
  } catch {
76563
76579
  return [];
@@ -76575,6 +76591,7 @@ async function checkSnapshotLoadable(avdName, snapshotName = "default_boot", opt
76575
76591
  ];
76576
76592
  const { stdout } = await execFileAsync9(emulatorPath, args, {
76577
76593
  timeout: options.timeoutMs ?? 1e4,
76594
+ killSignal: "SIGKILL",
76578
76595
  maxBuffer: 4 * 1024 * 1024
76579
76596
  });
76580
76597
  const tail = stdout.split("\n").slice(-6).join("\n");
@@ -93869,7 +93886,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
93869
93886
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
93870
93887
  function readCliVersion() {
93871
93888
  if (true) {
93872
- return "0.22.2-next.1";
93889
+ return "0.22.2-next.3";
93873
93890
  }
93874
93891
  return "0.0.0";
93875
93892
  }
@@ -95381,13 +95398,56 @@ var import_express = __toESM(require_express2());
95381
95398
 
95382
95399
  // ../tool-server/src/blueprints/simulator-server.ts
95383
95400
  var import_node_child_process10 = require("node:child_process");
95384
- var readline2 = __toESM(require("node:readline"));
95401
+ var readline = __toESM(require("node:readline"));
95385
95402
  init_src();
95386
95403
 
95387
95404
  // ../tool-server/src/blueprints/ax-service.ts
95388
95405
  var net = __toESM(require("node:net"));
95389
95406
  var fs13 = __toESM(require("node:fs"));
95390
- var readline = __toESM(require("node:readline"));
95407
+
95408
+ // ../tool-server/src/utils/ndjson-socket.ts
95409
+ var PREVIEW_CHARS = 80;
95410
+ function preview(raw) {
95411
+ const printable = raw.replace(/[\x00-\x1f\x7f\u2028\u2029]/g, "\xB7");
95412
+ return printable.length > PREVIEW_CHARS ? `${printable.slice(0, PREVIEW_CHARS)}\u2026` : printable;
95413
+ }
95414
+ function reportDroppedFrameToStderr(tag3) {
95415
+ return ({ bytes, preview: preview2 }) => {
95416
+ process.stderr.write(`[${tag3}] dropped unparseable frame (${bytes} bytes): ${preview2}
95417
+ `);
95418
+ };
95419
+ }
95420
+ function attachNdjsonReader(socket, handlers) {
95421
+ socket.setEncoding("utf8");
95422
+ let buf = "";
95423
+ const deliver = (raw) => {
95424
+ if (raw.length === 0 || raw === "\r") return;
95425
+ let msg;
95426
+ try {
95427
+ msg = JSON.parse(raw);
95428
+ } catch {
95429
+ handlers.onDropped({ bytes: Buffer.byteLength(raw, "utf8"), preview: preview(raw) });
95430
+ return;
95431
+ }
95432
+ handlers.onMessage(msg);
95433
+ };
95434
+ socket.on("data", (chunk) => {
95435
+ buf += typeof chunk === "string" ? chunk : chunk.toString("utf8");
95436
+ let nl;
95437
+ while ((nl = buf.indexOf("\n")) !== -1) {
95438
+ const raw = buf.slice(0, nl);
95439
+ buf = buf.slice(nl + 1);
95440
+ deliver(raw);
95441
+ }
95442
+ });
95443
+ socket.on("end", () => {
95444
+ const rest = buf;
95445
+ buf = "";
95446
+ if (rest.length > 0) deliver(rest);
95447
+ });
95448
+ }
95449
+
95450
+ // ../tool-server/src/blueprints/ax-service.ts
95391
95451
  init_src();
95392
95452
 
95393
95453
  // ../tool-server/src/utils/ios-host.ts
@@ -96223,37 +96283,33 @@ var axServiceBlueprint = {
96223
96283
  daemonSocket.destroy();
96224
96284
  }
96225
96285
  daemonSocket = socket;
96226
- const rl = readline.createInterface({ input: socket });
96227
- rl.on("line", (raw) => {
96228
- let msg;
96229
- try {
96230
- msg = JSON.parse(raw);
96231
- } catch {
96232
- return;
96233
- }
96234
- if (typeof msg.id !== "number") return;
96235
- const pending = pendingRpc.get(msg.id);
96236
- if (!pending) return;
96237
- pendingRpc.delete(msg.id);
96238
- clearTimeout(pending.timer);
96239
- if (msg.error !== void 0 && msg.error !== null) {
96240
- pending.reject(
96241
- new FailureError(
96242
- typeof msg.error === "string" ? msg.error : JSON.stringify(msg.error),
96243
- {
96244
- error_code: FAILURE_CODES.AX_QUERY_FAILED,
96245
- failure_stage: "ax_service_query_rpc",
96246
- failure_area: "tool_server",
96247
- error_kind: "unknown"
96248
- }
96249
- )
96250
- );
96251
- } else {
96252
- pending.resolve(msg.result);
96286
+ attachNdjsonReader(socket, {
96287
+ onDropped: reportDroppedFrameToStderr(`ax-service ${udid.slice(0, 8)}`),
96288
+ onMessage: (parsed) => {
96289
+ const msg = parsed;
96290
+ if (typeof msg.id !== "number") return;
96291
+ const pending = pendingRpc.get(msg.id);
96292
+ if (!pending) return;
96293
+ pendingRpc.delete(msg.id);
96294
+ clearTimeout(pending.timer);
96295
+ if (msg.error !== void 0 && msg.error !== null) {
96296
+ pending.reject(
96297
+ new FailureError(
96298
+ typeof msg.error === "string" ? msg.error : JSON.stringify(msg.error),
96299
+ {
96300
+ error_code: FAILURE_CODES.AX_QUERY_FAILED,
96301
+ failure_stage: "ax_service_query_rpc",
96302
+ failure_area: "tool_server",
96303
+ error_kind: "unknown"
96304
+ }
96305
+ )
96306
+ );
96307
+ } else {
96308
+ pending.resolve(msg.result);
96309
+ }
96253
96310
  }
96254
96311
  });
96255
96312
  socket.on("close", () => {
96256
- rl.close();
96257
96313
  if (daemonSocket === socket) {
96258
96314
  daemonSocket = null;
96259
96315
  if (!disposed) {
@@ -106575,7 +106631,7 @@ async function spawnSimulatorServerProcess(udid, subcommand) {
106575
106631
  let settled = false;
106576
106632
  const STREAM_GRACE_MS = 500;
106577
106633
  let apiReadyTimer = null;
106578
- const rl = readline2.createInterface({ input: proc.stdout });
106634
+ const rl = readline.createInterface({ input: proc.stdout });
106579
106635
  const settle = (fn, cleanup) => {
106580
106636
  if (settled) return;
106581
106637
  settled = true;
@@ -109223,7 +109279,6 @@ var variantProposalStore = new VariantProposalStore();
109223
109279
  // ../tool-server/src/blueprints/native-devtools.ts
109224
109280
  var net2 = __toESM(require("node:net"));
109225
109281
  var fs18 = __toESM(require("node:fs"));
109226
- var readline3 = __toESM(require("node:readline"));
109227
109282
  init_src();
109228
109283
  var NATIVE_DEVTOOLS_NAMESPACE = "NativeDevtools";
109229
109284
  function isInjectableBundleId(bundleId) {
@@ -109490,67 +109545,63 @@ var nativeDevtoolsBlueprint = {
109490
109545
  }
109491
109546
  const server = net2.createServer((socket) => {
109492
109547
  let bundleId = null;
109493
- const rl = readline3.createInterface({ input: socket });
109494
- rl.on("line", (raw) => {
109495
- let msg;
109496
- try {
109497
- msg = JSON.parse(raw);
109498
- } catch {
109499
- return;
109500
- }
109501
- if (bundleId === null) {
109502
- if (msg.type !== "Control") return;
109503
- bundleId = msg.payload.bundleId;
109504
- const existing = connections2.get(bundleId);
109505
- if (existing) {
109506
- existing.socket.destroy();
109507
- }
109508
- connections2.set(bundleId, { socket, networkLog: [] });
109509
- if (activatedBundleIds.has(bundleId)) {
109510
- socket.write(
109511
- JSON.stringify({
109512
- type: "Control",
109513
- payload: { command: "activateNetworkInspection" }
109514
- }) + "\n"
109515
- );
109548
+ attachNdjsonReader(socket, {
109549
+ onDropped: reportDroppedFrameToStderr(`native-devtools ${udid.slice(0, 8)}`),
109550
+ onMessage: (parsed) => {
109551
+ const msg = parsed;
109552
+ if (bundleId === null) {
109553
+ if (msg.type !== "Control") return;
109554
+ bundleId = msg.payload.bundleId;
109555
+ const existing = connections2.get(bundleId);
109556
+ if (existing) {
109557
+ existing.socket.destroy();
109558
+ }
109559
+ connections2.set(bundleId, { socket, networkLog: [] });
109560
+ if (activatedBundleIds.has(bundleId)) {
109561
+ socket.write(
109562
+ JSON.stringify({
109563
+ type: "Control",
109564
+ payload: { command: "activateNetworkInspection" }
109565
+ }) + "\n"
109566
+ );
109567
+ }
109568
+ return;
109516
109569
  }
109517
- return;
109518
- }
109519
- if (msg.type === "CDP") {
109520
- const p = msg.payload;
109521
- if (p.method && p.id === void 0) {
109522
- const conn = connections2.get(bundleId);
109523
- if (conn) {
109524
- if (conn.networkLog.length >= MAX_LOG_ENTRIES) {
109525
- conn.networkLog.shift();
109570
+ if (msg.type === "CDP") {
109571
+ const p = msg.payload;
109572
+ if (p.method && p.id === void 0) {
109573
+ const conn = connections2.get(bundleId);
109574
+ if (conn) {
109575
+ if (conn.networkLog.length >= MAX_LOG_ENTRIES) {
109576
+ conn.networkLog.shift();
109577
+ }
109578
+ conn.networkLog.push({
109579
+ method: p.method,
109580
+ params: p.params,
109581
+ timestamp: Date.now()
109582
+ });
109526
109583
  }
109527
- conn.networkLog.push({
109528
- method: p.method,
109529
- params: p.params,
109530
- timestamp: Date.now()
109531
- });
109532
109584
  }
109533
109585
  }
109534
- }
109535
- if (msg.type === "ViewInspector") {
109536
- const p = msg.payload;
109537
- const pending = pendingRpc.get(p.id);
109538
- if (!pending) return;
109539
- pendingRpc.delete(p.id);
109540
- if (p.error) {
109541
- pending.reject(
109542
- new FailureError(p.error.message, {
109543
- error_code: FAILURE_CODES.NATIVE_DEVTOOLS_RPC_ERROR,
109544
- failure_stage: "native_devtools_rpc_response",
109545
- failure_area: "tool_server",
109546
- error_kind: "subprocess"
109547
- })
109548
- );
109549
- } else pending.resolve(p.result);
109586
+ if (msg.type === "ViewInspector") {
109587
+ const p = msg.payload;
109588
+ const pending = pendingRpc.get(p.id);
109589
+ if (!pending) return;
109590
+ pendingRpc.delete(p.id);
109591
+ if (p.error) {
109592
+ pending.reject(
109593
+ new FailureError(p.error.message, {
109594
+ error_code: FAILURE_CODES.NATIVE_DEVTOOLS_RPC_ERROR,
109595
+ failure_stage: "native_devtools_rpc_response",
109596
+ failure_area: "tool_server",
109597
+ error_kind: "subprocess"
109598
+ })
109599
+ );
109600
+ } else pending.resolve(p.result);
109601
+ }
109550
109602
  }
109551
109603
  });
109552
109604
  socket.on("close", () => {
109553
- rl.close();
109554
109605
  if (bundleId !== null) {
109555
109606
  if (connections2.get(bundleId)?.socket === socket) {
109556
109607
  connections2.delete(bundleId);
@@ -109994,22 +110045,28 @@ async function describeIos(registry2, device, params, options = {}) {
109994
110045
  if (isTvOs) {
109995
110046
  return { tree: emptyTree(), source: "ax-service", hint: TVOS_HINT };
109996
110047
  }
109997
- let tree;
110048
+ let tree = emptyTree();
109998
110049
  let degraded;
109999
110050
  let resolverHint;
110051
+ let readFailureHint;
110052
+ let axApi;
110000
110053
  try {
110001
110054
  const axRef = axServiceRef(device);
110002
- const axApi = await registry2.resolveService(axRef.urn, axRef.options);
110003
- const response = await axApi.describe();
110004
- tree = adaptAXDescribeToDescribeResult(response);
110055
+ axApi = await registry2.resolveService(axRef.urn, axRef.options);
110005
110056
  degraded = axApi.degraded;
110006
110057
  } catch (err) {
110007
- tree = emptyTree();
110008
110058
  resolverHint = tcpArtifactHint(err);
110009
110059
  degraded = resolverHint === void 0;
110010
110060
  }
110061
+ if (axApi) {
110062
+ try {
110063
+ tree = adaptAXDescribeToDescribeResult(await axApi.describe());
110064
+ } catch (err) {
110065
+ readFailureHint = `The accessibility read failed (${errMsg(err)}).`;
110066
+ }
110067
+ }
110011
110068
  const degradedHint = !degraded ? void 0 : tree.children.length === 0 ? DEGRADED_BLIND_HINT : DEGRADED_STANDING_HINT;
110012
- const hint = resolverHint ?? degradedHint;
110069
+ const hint = resolverHint ?? (readFailureHint ? degradedHint ? `${degradedHint}. ${readFailureHint}` : readFailureHint : degradedHint);
110013
110070
  if (tree.children.length > 0) {
110014
110071
  return { tree, source: "ax-service", hint };
110015
110072
  }
@@ -110501,7 +110558,7 @@ function parseUiAutomatorDump(rawOutput, screenW, screenH, options = {}) {
110501
110558
 
110502
110559
  // ../tool-server/src/blueprints/android-devtools.ts
110503
110560
  var import_node_child_process13 = require("node:child_process");
110504
- var readline5 = __toESM(require("node:readline"));
110561
+ var readline2 = __toESM(require("node:readline"));
110505
110562
  init_src();
110506
110563
 
110507
110564
  // ../native-devtools-android/src/index.ts
@@ -110898,7 +110955,6 @@ async function ensureAndroidDevtoolsInstalled(serial) {
110898
110955
 
110899
110956
  // ../tool-server/src/utils/android-devtools-client.ts
110900
110957
  var net3 = __toESM(require("node:net"));
110901
- var readline4 = __toESM(require("node:readline"));
110902
110958
  init_src();
110903
110959
  var DEFAULT_RPC_TIMEOUT_MS = 5e3;
110904
110960
  var LONG_RPC_TIMEOUT_MS = 15e3;
@@ -110932,36 +110988,32 @@ function connectAndroidDevtoolsClient(localPort, onTerminated) {
110932
110988
  onTerminated(error52);
110933
110989
  };
110934
110990
  socket.once("connect", () => {
110935
- const rl = readline4.createInterface({ input: socket });
110936
- rl.on("line", (line) => {
110937
- if (!line.trim()) return;
110938
- let parsed;
110939
- try {
110940
- parsed = JSON.parse(line);
110941
- } catch {
110942
- return;
110943
- }
110944
- if (typeof parsed.id !== "number") return;
110945
- const req = pending.get(parsed.id);
110946
- if (!req) return;
110947
- pending.delete(parsed.id);
110948
- clearTimeout(req.timer);
110949
- if (parsed.error) {
110950
- const message = parsed.error.message ?? "Unknown helper error";
110951
- const type = parsed.error.type ?? "HelperError";
110952
- req.reject(
110953
- new FailureError(`${type}: ${message}`, {
110954
- error_code: FAILURE_CODES.ANDROID_DEVTOOLS_RPC_ERROR,
110955
- failure_stage: "android_devtools_rpc_response",
110956
- failure_area: "tool_server",
110957
- error_kind: "subprocess"
110958
- })
110959
- );
110960
- } else {
110961
- req.resolve(parsed.result);
110991
+ attachNdjsonReader(socket, {
110992
+ onDropped: reportDroppedFrameToStderr("android-devtools"),
110993
+ onMessage: (raw) => {
110994
+ const parsed = raw;
110995
+ if (typeof parsed.id !== "number") return;
110996
+ const req = pending.get(parsed.id);
110997
+ if (!req) return;
110998
+ pending.delete(parsed.id);
110999
+ clearTimeout(req.timer);
111000
+ if (parsed.error) {
111001
+ const message = parsed.error.message ?? "Unknown helper error";
111002
+ const type = parsed.error.type ?? "HelperError";
111003
+ req.reject(
111004
+ new FailureError(`${type}: ${message}`, {
111005
+ error_code: FAILURE_CODES.ANDROID_DEVTOOLS_RPC_ERROR,
111006
+ failure_stage: "android_devtools_rpc_response",
111007
+ failure_area: "tool_server",
111008
+ error_kind: "subprocess"
111009
+ })
111010
+ );
111011
+ } else {
111012
+ req.resolve(parsed.result);
111013
+ }
110962
111014
  }
110963
111015
  });
110964
- rl.on("close", () => cleanup());
111016
+ socket.on("close", () => cleanup());
110965
111017
  resolve12({
110966
111018
  request(method, params = {}) {
110967
111019
  const send = () => {
@@ -111076,7 +111128,7 @@ async function spawnHelper(serial) {
111076
111128
  cleanup?.();
111077
111129
  fn();
111078
111130
  };
111079
- const rl = readline5.createInterface({ input: proc.stdout });
111131
+ const rl = readline2.createInterface({ input: proc.stdout });
111080
111132
  rl.on("line", async (rawLine) => {
111081
111133
  const line = rawLine.trim();
111082
111134
  const portMatch = HELPER_PORT_MARKER.exec(line);
@@ -116837,13 +116889,7 @@ var zodSchema9 = external_exports.object({
116837
116889
  function bootTarget(params) {
116838
116890
  return params.udid ?? params.avdName ?? params.vvdImage ?? params.electronAppPath ?? "device";
116839
116891
  }
116840
- var LAUNCH_HARDENING_ARGS = [
116841
- "-no-boot-anim",
116842
- "-netfast",
116843
- "-crash-report-mode",
116844
- "never",
116845
- "-no-metrics"
116846
- ];
116892
+ var LAUNCH_HARDENING_ARGS = ["-no-boot-anim", "-netfast", "-no-metrics"];
116847
116893
  function launchHardeningArgs(sound) {
116848
116894
  return sound ? [...LAUNCH_HARDENING_ARGS] : ["-noaudio", ...LAUNCH_HARDENING_ARGS];
116849
116895
  }
@@ -117357,7 +117403,7 @@ async function bootAndroidImpl(params) {
117357
117403
  } else {
117358
117404
  const RENDERER_ARGS = ["-gpu", gpuMode, ...extraEmulatorArgs];
117359
117405
  const probe3 = await checkSnapshotLoadable(params.avdName, "default_boot", {
117360
- extraArgs: [...RENDERER_ARGS, ...hardeningArgs]
117406
+ extraArgs: [...RENDERER_ARGS, ...hardeningArgs, ...crashReportArgs]
117361
117407
  });
117362
117408
  if (!probe3.loadable) {
117363
117409
  hotBootFailureReason = `-check-snapshot-loadable: ${probe3.reason ?? "unknown"}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.22.2-next.1",
3
+ "version": "0.22.2-next.3",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",