@swmansion/argent 0.22.2-next.2 → 0.22.2-next.4

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.2";
7213
+ return "0.22.2-next.4";
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.2";
16431
+ return "0.22.2-next.4";
16432
16432
  }
16433
16433
  return "0.0.0";
16434
16434
  }
@@ -93886,7 +93886,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
93886
93886
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
93887
93887
  function readCliVersion() {
93888
93888
  if (true) {
93889
- return "0.22.2-next.2";
93889
+ return "0.22.2-next.4";
93890
93890
  }
93891
93891
  return "0.0.0";
93892
93892
  }
@@ -95398,13 +95398,56 @@ var import_express = __toESM(require_express2());
95398
95398
 
95399
95399
  // ../tool-server/src/blueprints/simulator-server.ts
95400
95400
  var import_node_child_process10 = require("node:child_process");
95401
- var readline2 = __toESM(require("node:readline"));
95401
+ var readline = __toESM(require("node:readline"));
95402
95402
  init_src();
95403
95403
 
95404
95404
  // ../tool-server/src/blueprints/ax-service.ts
95405
95405
  var net = __toESM(require("node:net"));
95406
95406
  var fs13 = __toESM(require("node:fs"));
95407
- 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
95408
95451
  init_src();
95409
95452
 
95410
95453
  // ../tool-server/src/utils/ios-host.ts
@@ -96240,37 +96283,33 @@ var axServiceBlueprint = {
96240
96283
  daemonSocket.destroy();
96241
96284
  }
96242
96285
  daemonSocket = socket;
96243
- const rl = readline.createInterface({ input: socket });
96244
- rl.on("line", (raw) => {
96245
- let msg;
96246
- try {
96247
- msg = JSON.parse(raw);
96248
- } catch {
96249
- return;
96250
- }
96251
- if (typeof msg.id !== "number") return;
96252
- const pending = pendingRpc.get(msg.id);
96253
- if (!pending) return;
96254
- pendingRpc.delete(msg.id);
96255
- clearTimeout(pending.timer);
96256
- if (msg.error !== void 0 && msg.error !== null) {
96257
- pending.reject(
96258
- new FailureError(
96259
- typeof msg.error === "string" ? msg.error : JSON.stringify(msg.error),
96260
- {
96261
- error_code: FAILURE_CODES.AX_QUERY_FAILED,
96262
- failure_stage: "ax_service_query_rpc",
96263
- failure_area: "tool_server",
96264
- error_kind: "unknown"
96265
- }
96266
- )
96267
- );
96268
- } else {
96269
- 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
+ }
96270
96310
  }
96271
96311
  });
96272
96312
  socket.on("close", () => {
96273
- rl.close();
96274
96313
  if (daemonSocket === socket) {
96275
96314
  daemonSocket = null;
96276
96315
  if (!disposed) {
@@ -106592,7 +106631,7 @@ async function spawnSimulatorServerProcess(udid, subcommand) {
106592
106631
  let settled = false;
106593
106632
  const STREAM_GRACE_MS = 500;
106594
106633
  let apiReadyTimer = null;
106595
- const rl = readline2.createInterface({ input: proc.stdout });
106634
+ const rl = readline.createInterface({ input: proc.stdout });
106596
106635
  const settle = (fn, cleanup) => {
106597
106636
  if (settled) return;
106598
106637
  settled = true;
@@ -109240,7 +109279,6 @@ var variantProposalStore = new VariantProposalStore();
109240
109279
  // ../tool-server/src/blueprints/native-devtools.ts
109241
109280
  var net2 = __toESM(require("node:net"));
109242
109281
  var fs18 = __toESM(require("node:fs"));
109243
- var readline3 = __toESM(require("node:readline"));
109244
109282
  init_src();
109245
109283
  var NATIVE_DEVTOOLS_NAMESPACE = "NativeDevtools";
109246
109284
  function isInjectableBundleId(bundleId) {
@@ -109507,67 +109545,63 @@ var nativeDevtoolsBlueprint = {
109507
109545
  }
109508
109546
  const server = net2.createServer((socket) => {
109509
109547
  let bundleId = null;
109510
- const rl = readline3.createInterface({ input: socket });
109511
- rl.on("line", (raw) => {
109512
- let msg;
109513
- try {
109514
- msg = JSON.parse(raw);
109515
- } catch {
109516
- return;
109517
- }
109518
- if (bundleId === null) {
109519
- if (msg.type !== "Control") return;
109520
- bundleId = msg.payload.bundleId;
109521
- const existing = connections2.get(bundleId);
109522
- if (existing) {
109523
- existing.socket.destroy();
109524
- }
109525
- connections2.set(bundleId, { socket, networkLog: [] });
109526
- if (activatedBundleIds.has(bundleId)) {
109527
- socket.write(
109528
- JSON.stringify({
109529
- type: "Control",
109530
- payload: { command: "activateNetworkInspection" }
109531
- }) + "\n"
109532
- );
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;
109533
109569
  }
109534
- return;
109535
- }
109536
- if (msg.type === "CDP") {
109537
- const p = msg.payload;
109538
- if (p.method && p.id === void 0) {
109539
- const conn = connections2.get(bundleId);
109540
- if (conn) {
109541
- if (conn.networkLog.length >= MAX_LOG_ENTRIES) {
109542
- 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
+ });
109543
109583
  }
109544
- conn.networkLog.push({
109545
- method: p.method,
109546
- params: p.params,
109547
- timestamp: Date.now()
109548
- });
109549
109584
  }
109550
109585
  }
109551
- }
109552
- if (msg.type === "ViewInspector") {
109553
- const p = msg.payload;
109554
- const pending = pendingRpc.get(p.id);
109555
- if (!pending) return;
109556
- pendingRpc.delete(p.id);
109557
- if (p.error) {
109558
- pending.reject(
109559
- new FailureError(p.error.message, {
109560
- error_code: FAILURE_CODES.NATIVE_DEVTOOLS_RPC_ERROR,
109561
- failure_stage: "native_devtools_rpc_response",
109562
- failure_area: "tool_server",
109563
- error_kind: "subprocess"
109564
- })
109565
- );
109566
- } 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
+ }
109567
109602
  }
109568
109603
  });
109569
109604
  socket.on("close", () => {
109570
- rl.close();
109571
109605
  if (bundleId !== null) {
109572
109606
  if (connections2.get(bundleId)?.socket === socket) {
109573
109607
  connections2.delete(bundleId);
@@ -110011,22 +110045,28 @@ async function describeIos(registry2, device, params, options = {}) {
110011
110045
  if (isTvOs) {
110012
110046
  return { tree: emptyTree(), source: "ax-service", hint: TVOS_HINT };
110013
110047
  }
110014
- let tree;
110048
+ let tree = emptyTree();
110015
110049
  let degraded;
110016
110050
  let resolverHint;
110051
+ let readFailureHint;
110052
+ let axApi;
110017
110053
  try {
110018
110054
  const axRef = axServiceRef(device);
110019
- const axApi = await registry2.resolveService(axRef.urn, axRef.options);
110020
- const response = await axApi.describe();
110021
- tree = adaptAXDescribeToDescribeResult(response);
110055
+ axApi = await registry2.resolveService(axRef.urn, axRef.options);
110022
110056
  degraded = axApi.degraded;
110023
110057
  } catch (err) {
110024
- tree = emptyTree();
110025
110058
  resolverHint = tcpArtifactHint(err);
110026
110059
  degraded = resolverHint === void 0;
110027
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
+ }
110028
110068
  const degradedHint = !degraded ? void 0 : tree.children.length === 0 ? DEGRADED_BLIND_HINT : DEGRADED_STANDING_HINT;
110029
- const hint = resolverHint ?? degradedHint;
110069
+ const hint = resolverHint ?? (readFailureHint ? degradedHint ? `${degradedHint}. ${readFailureHint}` : readFailureHint : degradedHint);
110030
110070
  if (tree.children.length > 0) {
110031
110071
  return { tree, source: "ax-service", hint };
110032
110072
  }
@@ -110518,7 +110558,7 @@ function parseUiAutomatorDump(rawOutput, screenW, screenH, options = {}) {
110518
110558
 
110519
110559
  // ../tool-server/src/blueprints/android-devtools.ts
110520
110560
  var import_node_child_process13 = require("node:child_process");
110521
- var readline5 = __toESM(require("node:readline"));
110561
+ var readline2 = __toESM(require("node:readline"));
110522
110562
  init_src();
110523
110563
 
110524
110564
  // ../native-devtools-android/src/index.ts
@@ -110915,7 +110955,6 @@ async function ensureAndroidDevtoolsInstalled(serial) {
110915
110955
 
110916
110956
  // ../tool-server/src/utils/android-devtools-client.ts
110917
110957
  var net3 = __toESM(require("node:net"));
110918
- var readline4 = __toESM(require("node:readline"));
110919
110958
  init_src();
110920
110959
  var DEFAULT_RPC_TIMEOUT_MS = 5e3;
110921
110960
  var LONG_RPC_TIMEOUT_MS = 15e3;
@@ -110949,36 +110988,32 @@ function connectAndroidDevtoolsClient(localPort, onTerminated) {
110949
110988
  onTerminated(error52);
110950
110989
  };
110951
110990
  socket.once("connect", () => {
110952
- const rl = readline4.createInterface({ input: socket });
110953
- rl.on("line", (line) => {
110954
- if (!line.trim()) return;
110955
- let parsed;
110956
- try {
110957
- parsed = JSON.parse(line);
110958
- } catch {
110959
- return;
110960
- }
110961
- if (typeof parsed.id !== "number") return;
110962
- const req = pending.get(parsed.id);
110963
- if (!req) return;
110964
- pending.delete(parsed.id);
110965
- clearTimeout(req.timer);
110966
- if (parsed.error) {
110967
- const message = parsed.error.message ?? "Unknown helper error";
110968
- const type = parsed.error.type ?? "HelperError";
110969
- req.reject(
110970
- new FailureError(`${type}: ${message}`, {
110971
- error_code: FAILURE_CODES.ANDROID_DEVTOOLS_RPC_ERROR,
110972
- failure_stage: "android_devtools_rpc_response",
110973
- failure_area: "tool_server",
110974
- error_kind: "subprocess"
110975
- })
110976
- );
110977
- } else {
110978
- 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
+ }
110979
111014
  }
110980
111015
  });
110981
- rl.on("close", () => cleanup());
111016
+ socket.on("close", () => cleanup());
110982
111017
  resolve12({
110983
111018
  request(method, params = {}) {
110984
111019
  const send = () => {
@@ -111093,7 +111128,7 @@ async function spawnHelper(serial) {
111093
111128
  cleanup?.();
111094
111129
  fn();
111095
111130
  };
111096
- const rl = readline5.createInterface({ input: proc.stdout });
111131
+ const rl = readline2.createInterface({ input: proc.stdout });
111097
111132
  rl.on("line", async (rawLine) => {
111098
111133
  const line = rawLine.trim();
111099
111134
  const portMatch = HELPER_PORT_MARKER.exec(line);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.22.2-next.2",
3
+ "version": "0.22.2-next.4",
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",