@swmansion/argent 0.35.1-next.1 → 0.35.1-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
@@ -38575,7 +38575,7 @@ function isCi(env = process.env) {
38575
38575
  var SESSION_ID2 = randomUUID5();
38576
38576
  function readCliVersion() {
38577
38577
  if (true) {
38578
- return "0.35.1-next.1";
38578
+ return "0.35.1-next.2";
38579
38579
  }
38580
38580
  return "0.0.0";
38581
38581
  }
@@ -16998,7 +16998,7 @@ function isCi(env = process.env) {
16998
16998
  var SESSION_ID = randomUUID4();
16999
16999
  function readCliVersion() {
17000
17000
  if (true) {
17001
- return "0.35.1-next.1";
17001
+ return "0.35.1-next.2";
17002
17002
  }
17003
17003
  return "0.0.0";
17004
17004
  }
@@ -72948,7 +72948,7 @@ function isCi(env = process.env) {
72948
72948
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
72949
72949
  function readCliVersion() {
72950
72950
  if (true) {
72951
- return "0.35.1-next.1";
72951
+ return "0.35.1-next.2";
72952
72952
  }
72953
72953
  return "0.0.0";
72954
72954
  }
@@ -97218,10 +97218,16 @@ var nativeDevtoolsBlueprint = {
97218
97218
  attachNdjsonReader(socket, {
97219
97219
  onDropped: reportDroppedFrameToStderr(`native-devtools ${udid.slice(0, 8)}`),
97220
97220
  onMessage: (parsed2) => {
97221
+ if (socket.destroyed) return;
97221
97222
  const msg = parsed2;
97222
97223
  if (bundleId === null) {
97223
97224
  if (msg.type !== "Control") return;
97224
- bundleId = msg.payload.bundleId;
97225
+ const id = msg.payload?.bundleId;
97226
+ if (typeof id !== "string" || !isInjectableBundleId(id)) {
97227
+ socket.destroy();
97228
+ return;
97229
+ }
97230
+ bundleId = id;
97225
97231
  const existing = connections3.get(bundleId);
97226
97232
  if (existing) {
97227
97233
  closeConnection(bundleId, existing);
@@ -97805,6 +97811,8 @@ async function initUdid(registry2, udid, trackedServices) {
97805
97811
  }
97806
97812
  }
97807
97813
  function startSimulatorWatcher(registry2) {
97814
+ const configuredUdids = process.env.ARGENT_SIMULATOR_WATCH_UDIDS;
97815
+ const allowedUdids = configuredUdids === void 0 ? void 0 : new Set(configuredUdids.split(",").map((id) => id.trim().toUpperCase()));
97808
97816
  const trackedServices = /* @__PURE__ */ new Map();
97809
97817
  const reportedSkips = /* @__PURE__ */ new Set();
97810
97818
  const stopController = new AbortController();
@@ -97838,6 +97846,7 @@ function startSimulatorWatcher(registry2) {
97838
97846
  const ours = /* @__PURE__ */ new Set();
97839
97847
  const claimed = /* @__PURE__ */ new Set();
97840
97848
  for (const udid of booted) {
97849
+ if (allowedUdids && !allowedUdids.has(udid.toUpperCase())) continue;
97841
97850
  const claim2 = externalClaimForNativeId(udid);
97842
97851
  if (!claim2) {
97843
97852
  reportedSkips.delete(udid);
@@ -103633,10 +103642,11 @@ var axServiceBlueprint = {
103633
103642
 
103634
103643
  // ../tool-server/src/utils/native-target-app.ts
103635
103644
  init_src2();
103645
+ function isForegroundActive(app) {
103646
+ return app.applicationState === "active" || app.foregroundActiveSceneCount > 0;
103647
+ }
103636
103648
  function chooseFrontmostConnectedApp(apps) {
103637
- const strongCandidates = apps.filter(
103638
- (app) => app.applicationState === "active" || app.foregroundActiveSceneCount > 0
103639
- );
103649
+ const strongCandidates = apps.filter(isForegroundActive);
103640
103650
  if (strongCandidates.length === 1) {
103641
103651
  return strongCandidates[0];
103642
103652
  }
@@ -103648,16 +103658,31 @@ function chooseFrontmostConnectedApp(apps) {
103648
103658
  }
103649
103659
  return null;
103650
103660
  }
103651
- async function inspectConnectedNativeApps(api) {
103652
- const bundleIds = api.listConnectedBundleIds();
103653
- const appStates = await Promise.all(bundleIds.map((bundleId) => api.getAppState(bundleId)));
103661
+ async function inspectConnectedNativeApps(api, bundleIds = api.listConnectedBundleIds()) {
103662
+ let timeout;
103663
+ const responses = await Promise.all(
103664
+ bundleIds.map(async (bundleId) => {
103665
+ try {
103666
+ return await api.getAppState(bundleId);
103667
+ } catch (err) {
103668
+ if (!(err instanceof Error) || getFailureSignal(err)?.error_code !== FAILURE_CODES.NATIVE_DEVTOOLS_RPC_TIMEOUT) {
103669
+ throw err;
103670
+ }
103671
+ timeout ??= err;
103672
+ return null;
103673
+ }
103674
+ })
103675
+ );
103676
+ const appStates = responses.filter((state3) => state3 !== null);
103677
+ if (timeout && appStates.filter(isForegroundActive).length !== 1) throw timeout;
103654
103678
  return appStates.sort((a, b) => a.bundleId.localeCompare(b.bundleId));
103655
103679
  }
103656
103680
  async function resolveNativeTargetApp(api, bundleId) {
103657
103681
  if (bundleId) {
103658
103682
  return { bundleId, source: "explicit" };
103659
103683
  }
103660
- const connectedApps = await inspectConnectedNativeApps(api);
103684
+ const bundleIds = api.listConnectedBundleIds();
103685
+ const connectedApps = await inspectConnectedNativeApps(api, bundleIds);
103661
103686
  if (connectedApps.length === 0) {
103662
103687
  throw new FailureError(
103663
103688
  "No native-devtools-connected apps are available for auto-targeting. Launch or restart the app first, provide bundleId explicitly, or use screenshot to inspect visible Home/system UI.",
@@ -103670,7 +103695,7 @@ async function resolveNativeTargetApp(api, bundleId) {
103670
103695
  );
103671
103696
  }
103672
103697
  const frontmost2 = chooseFrontmostConnectedApp(connectedApps);
103673
- if (connectedApps.length === 1) {
103698
+ if (bundleIds.length === 1) {
103674
103699
  if (frontmost2) {
103675
103700
  return {
103676
103701
  bundleId: connectedApps[0].bundleId,
@@ -162773,7 +162798,7 @@ async function queryFullHierarchyTree(registry2, device, target) {
162773
162798
  }
162774
162799
  if (target.probeAnswered) {
162775
162800
  throw new FailureError(
162776
- `${bundleId} (the launched app) stopped answering Application.getState - the probe timed out although an earlier one in this run answered, so the app's main queue is no longer being serviced. For a pinned app that is usually the suspension iOS applies once an e2e test leaves it (e.g. a tap that opened another app), and a suspended app's hierarchy is not what is on screen; in-app work blocking the main thread past the probe timeout looks the same from here. Reading anyway parks on that same unserviced queue: certain to time out if the app is suspended, and paying the longer hierarchy timeout to find that out if it is not. If this e2e test's subject IS the other app, give the e2e test a \`launch:\` step for that app - it re-pins reads to it, and a pinned read probes only the app it names, so the silent ${bundleId} is never touched; \`tool: launch-app\` or \`tool: restart-app\` naming that app works too - each re-targets reads at the app it starts, and is how a recorded e2e test switches apps. A foreground-NEUTRAL raw \`tool:\` step does not work here, because demoting the pin sends reads back to auto-resolve, which probes every connection at once and is sunk by this same silent one. If the e2e test left ${bundleId} but is still about it, make it return before reading the UI. If it never left, the main thread is busy: raise the step's \`timeout:\` so the poll re-reads past the work, or \`launch\` ${bundleId} again.`,
162801
+ `${bundleId} (the launched app) stopped answering Application.getState - the probe timed out although an earlier one in this run answered, so the app's main queue is no longer being serviced. For a pinned app that is usually the suspension iOS applies once an e2e test leaves it (e.g. a tap that opened another app), and a suspended app's hierarchy is not what is on screen; in-app work blocking the main thread past the probe timeout looks the same from here. Reading anyway parks on that same unserviced queue: certain to time out if the app is suspended, and paying the longer hierarchy timeout to find that out if it is not. If this e2e test's subject IS the other app, give the e2e test a \`launch:\` step for that app - it re-pins reads to it, and a pinned read probes only the app it names, so the silent ${bundleId} is never touched; \`tool: launch-app\` or \`tool: restart-app\` naming that app works too - each re-targets reads at the app it starts, and is how a recorded e2e test switches apps. A raw \`tool:\` step that only demotes the pin leaves the choice to auto-resolve: if a connection times out, it needs exactly one foreground-active response. If the e2e test left ${bundleId} but is still about it, make it return before reading the UI. If it never left, the main thread is busy: raise the step's \`timeout:\` so the poll re-reads past the work, or \`launch\` ${bundleId} again.`,
162777
162802
  {
162778
162803
  // The timeout's own code, NOT
162779
162804
  // NATIVE_TARGET_SINGLE_APP_NOT_FOREGROUND: nothing answered, so no
@@ -162789,7 +162814,7 @@ async function queryFullHierarchyTree(registry2, device, target) {
162789
162814
  }
162790
162815
  if (pinnedState && !chooseFrontmostConnectedApp([pinnedState])) {
162791
162816
  throw new FailureError(
162792
- `${bundleId} (the launched app) has no foreground presence at all (applicationState=${pinnedState.applicationState}, foregroundActiveScenes=${pinnedState.foregroundActiveSceneCount}, foregroundInactiveScenes=${pinnedState.foregroundInactiveSceneCount}) - a step in this e2e test left the app (e.g. a tap that opened another app), so a read of its hierarchy would describe a screen that is not on screen. Transitional states are NOT refused here: an \`inactive\` app, or one still holding a foreground scene, is read as usual - under a system alert or mid-transition it is still the app on screen. If this e2e test's subject IS another app, give the e2e test a \`launch:\` step for that app - it re-pins reads to it, and no wedged sibling connection can sink a pinned read; a raw \`tool:\` step demotes the pin and returns reads to frontmost auto-resolve, which works when the app on screen answers but is sunk by a single wedged connection. Otherwise make the e2e test return to ${bundleId} before reading the UI, or \`launch\` it again.`,
162817
+ `${bundleId} (the launched app) has no foreground presence at all (applicationState=${pinnedState.applicationState}, foregroundActiveScenes=${pinnedState.foregroundActiveSceneCount}, foregroundInactiveScenes=${pinnedState.foregroundInactiveSceneCount}) - a step in this e2e test left the app (e.g. a tap that opened another app), so a read of its hierarchy would describe a screen that is not on screen. Transitional states are NOT refused here: an \`inactive\` app, or one still holding a foreground scene, is read as usual - under a system alert or mid-transition it is still the app on screen. If this e2e test's subject IS another app, give the e2e test a \`launch:\` step for that app - it re-pins reads to it, and no wedged sibling connection can sink a pinned read; a raw \`tool:\` step demotes the pin and returns reads to frontmost auto-resolve, which needs exactly one foreground-active response if a connection times out. Otherwise make the e2e test return to ${bundleId} before reading the UI, or \`launch\` it again.`,
162793
162818
  {
162794
162819
  error_code: FAILURE_CODES.NATIVE_TARGET_SINGLE_APP_NOT_FOREGROUND,
162795
162820
  failure_stage: "flow_tree_pinned_target",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.35.1-next.1",
3
+ "version": "0.35.1-next.3",
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",
@@ -98,5 +98,5 @@
98
98
  "vitest": "^5.0.5",
99
99
  "yaml": "^2.9.1"
100
100
  },
101
- "gitHead": "388fdd0f278aa1ee5959e75e2442add0ea979d58"
101
+ "gitHead": "2b7297fe520b77cef6a60d0986239570353543a0"
102
102
  }