@swmansion/argent 0.35.1-next.1 → 0.35.1-next.2

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);
@@ -103633,10 +103639,11 @@ var axServiceBlueprint = {
103633
103639
 
103634
103640
  // ../tool-server/src/utils/native-target-app.ts
103635
103641
  init_src2();
103642
+ function isForegroundActive(app) {
103643
+ return app.applicationState === "active" || app.foregroundActiveSceneCount > 0;
103644
+ }
103636
103645
  function chooseFrontmostConnectedApp(apps) {
103637
- const strongCandidates = apps.filter(
103638
- (app) => app.applicationState === "active" || app.foregroundActiveSceneCount > 0
103639
- );
103646
+ const strongCandidates = apps.filter(isForegroundActive);
103640
103647
  if (strongCandidates.length === 1) {
103641
103648
  return strongCandidates[0];
103642
103649
  }
@@ -103648,16 +103655,31 @@ function chooseFrontmostConnectedApp(apps) {
103648
103655
  }
103649
103656
  return null;
103650
103657
  }
103651
- async function inspectConnectedNativeApps(api) {
103652
- const bundleIds = api.listConnectedBundleIds();
103653
- const appStates = await Promise.all(bundleIds.map((bundleId) => api.getAppState(bundleId)));
103658
+ async function inspectConnectedNativeApps(api, bundleIds = api.listConnectedBundleIds()) {
103659
+ let timeout;
103660
+ const responses = await Promise.all(
103661
+ bundleIds.map(async (bundleId) => {
103662
+ try {
103663
+ return await api.getAppState(bundleId);
103664
+ } catch (err) {
103665
+ if (!(err instanceof Error) || getFailureSignal(err)?.error_code !== FAILURE_CODES.NATIVE_DEVTOOLS_RPC_TIMEOUT) {
103666
+ throw err;
103667
+ }
103668
+ timeout ??= err;
103669
+ return null;
103670
+ }
103671
+ })
103672
+ );
103673
+ const appStates = responses.filter((state3) => state3 !== null);
103674
+ if (timeout && appStates.filter(isForegroundActive).length !== 1) throw timeout;
103654
103675
  return appStates.sort((a, b) => a.bundleId.localeCompare(b.bundleId));
103655
103676
  }
103656
103677
  async function resolveNativeTargetApp(api, bundleId) {
103657
103678
  if (bundleId) {
103658
103679
  return { bundleId, source: "explicit" };
103659
103680
  }
103660
- const connectedApps = await inspectConnectedNativeApps(api);
103681
+ const bundleIds = api.listConnectedBundleIds();
103682
+ const connectedApps = await inspectConnectedNativeApps(api, bundleIds);
103661
103683
  if (connectedApps.length === 0) {
103662
103684
  throw new FailureError(
103663
103685
  "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 +103692,7 @@ async function resolveNativeTargetApp(api, bundleId) {
103670
103692
  );
103671
103693
  }
103672
103694
  const frontmost2 = chooseFrontmostConnectedApp(connectedApps);
103673
- if (connectedApps.length === 1) {
103695
+ if (bundleIds.length === 1) {
103674
103696
  if (frontmost2) {
103675
103697
  return {
103676
103698
  bundleId: connectedApps[0].bundleId,
@@ -162773,7 +162795,7 @@ async function queryFullHierarchyTree(registry2, device, target) {
162773
162795
  }
162774
162796
  if (target.probeAnswered) {
162775
162797
  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.`,
162798
+ `${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
162799
  {
162778
162800
  // The timeout's own code, NOT
162779
162801
  // NATIVE_TARGET_SINGLE_APP_NOT_FOREGROUND: nothing answered, so no
@@ -162789,7 +162811,7 @@ async function queryFullHierarchyTree(registry2, device, target) {
162789
162811
  }
162790
162812
  if (pinnedState && !chooseFrontmostConnectedApp([pinnedState])) {
162791
162813
  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.`,
162814
+ `${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
162815
  {
162794
162816
  error_code: FAILURE_CODES.NATIVE_TARGET_SINGLE_APP_NOT_FOREGROUND,
162795
162817
  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.2",
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": "0f5f4c7e93d51e328f5231c48e5fa4dc1ae64c36"
102
102
  }