@swmansion/argent 0.35.1-next.76 → 0.35.1-next.77

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
@@ -38906,7 +38906,7 @@ function isCi(env = process.env) {
38906
38906
  var SESSION_ID2 = randomUUID5();
38907
38907
  function readCliVersion() {
38908
38908
  if (true) {
38909
- return "0.35.1-next.76";
38909
+ return "0.35.1-next.77";
38910
38910
  }
38911
38911
  return "0.0.0";
38912
38912
  }
@@ -17138,7 +17138,7 @@ function isCi(env = process.env) {
17138
17138
  var SESSION_ID = randomUUID4();
17139
17139
  function readCliVersion() {
17140
17140
  if (true) {
17141
- return "0.35.1-next.76";
17141
+ return "0.35.1-next.77";
17142
17142
  }
17143
17143
  return "0.0.0";
17144
17144
  }
@@ -38473,7 +38473,7 @@ async function startMcpServer(options) {
38473
38473
  const autoDescribeOn = autoDescribeEnabled();
38474
38474
  const whatsNewOn = whatsNewEnabled();
38475
38475
  const installedVersion = getInstalledVersion();
38476
- const highlightsVersion = true ? "0.35.1-next.76" : installedVersion;
38476
+ const highlightsVersion = true ? "0.35.1-next.77" : installedVersion;
38477
38477
  const captureTimeoutMs = options.captureTimeoutMs ?? CAPTURE_TIMEOUT_MS;
38478
38478
  const trees = createTreeMemory();
38479
38479
  const screenshots = createScreenshotMemory();
@@ -73359,7 +73359,7 @@ function isCi(env = process.env) {
73359
73359
  var SESSION_ID = (0, import_node_crypto3.randomUUID)();
73360
73360
  function readCliVersion() {
73361
73361
  if (true) {
73362
- return "0.35.1-next.76";
73362
+ return "0.35.1-next.77";
73363
73363
  }
73364
73364
  return "0.0.0";
73365
73365
  }
@@ -103029,6 +103029,7 @@ function isInjectableBundleId(bundleId) {
103029
103029
  var NON_INJECTABLE_NATIVE_WARNING = "Do not fall back to the native-devtools feature tools (native-find-views, native-full-hierarchy, native-network-logs, native-view-at-point): they run the same injection precheck and fail with the same non-injectable error.";
103030
103030
  var NON_INJECTABLE_RECOVERY = "Use the standard `describe` tool (its accessibility path reads the screen without injection) or `screenshot` (then interact by coordinate). " + NON_INJECTABLE_NATIVE_WARNING;
103031
103031
  var MAX_NATIVE_DEVTOOLS_INIT_ATTEMPTS = 3;
103032
+ var NATIVE_DEVTOOLS_INIT_RETRY_COOLDOWN_MS = 3e4;
103032
103033
  var NATIVE_DEVTOOLS_AGE_SLOP_MS = 3e3;
103033
103034
  var NATIVE_DEVTOOLS_CONNECT_BUDGET_MS = 15e3;
103034
103035
  var LENT_RELEASE_TIMEOUT_MS = 1e3;
@@ -103048,10 +103049,12 @@ function buildAppStateMessage(bundleId, state3) {
103048
103049
  return `Native devtools here are an external provider's agent, which serves only the app that provider chose to lend. ${bundleId} is either not that app or its connection has not landed yet. argent did not launch this process and cannot re-point it, so restarting anything is the provider's call rather than argent's. Retry if the app has just started; otherwise read the screen with describe or screenshot and drive it by coordinate.`;
103049
103050
  }
103050
103051
  }
103051
- function buildInitFailedResult(udid, failure3) {
103052
+ function buildInitFailedResult(udid, failure3, { afterBoot = false } = {}) {
103052
103053
  return {
103053
103054
  status: "init_failed",
103054
- message: `Native devtools failed to initialize for ${udid} after ${failure3.attempts} attempts. Last error: ${failure3.lastError}. Try shutting down and re-booting the simulator, or restart CoreSimulatorService.`,
103055
+ message: `Native devtools failed to initialize for ${udid} after ${failure3.attempts} attempts. Last error: ${failure3.lastError}. ` + // boot-device has just booted the simulator and retried, so its own
103056
+ // answer must not send the agent back to boot-device: that would loop.
103057
+ (afterBoot ? `boot-device already retried the setup on the booted simulator, so calling it again does not help on its own. Restart CoreSimulatorService, then call boot-device again.` : `Try shutting down and re-booting the simulator, or restart CoreSimulatorService.`) + (failure3.givenUp ? ` Argent retries the setup in the background at most every ${NATIVE_DEVTOOLS_INIT_RETRY_COOLDOWN_MS / 1e3} s, and a later call picks up a success.` : ""),
103055
103058
  attempts: failure3.attempts
103056
103059
  };
103057
103060
  }
@@ -103095,7 +103098,11 @@ async function precheckNativeDevtools(api, udid, bundleId) {
103095
103098
  throw nonInjectableError(bundleId);
103096
103099
  }
103097
103100
  const existing = api.getInitFailure();
103098
- if (existing?.givenUp) return buildInitFailedResult(udid, existing);
103101
+ if (existing?.givenUp) {
103102
+ void api.ensureEnvReady().catch(() => {
103103
+ });
103104
+ return buildInitFailedResult(udid, existing);
103105
+ }
103099
103106
  try {
103100
103107
  await api.ensureEnvReady();
103101
103108
  } catch (err) {
@@ -103258,6 +103265,7 @@ var nativeDevtoolsBlueprint = {
103258
103265
  let nextRpcId = 1;
103259
103266
  let envSetup = false;
103260
103267
  let initFailure = null;
103268
+ let initRetryAt = 0;
103261
103269
  let inFlight5 = null;
103262
103270
  let envRetired = false;
103263
103271
  const activatedBundleIds = /* @__PURE__ */ new Set();
@@ -103281,7 +103289,8 @@ var nativeDevtoolsBlueprint = {
103281
103289
  const attempts = (initFailure?.attempts ?? 0) + 1;
103282
103290
  const givenUp = attempts >= MAX_NATIVE_DEVTOOLS_INIT_ATTEMPTS;
103283
103291
  initFailure = { attempts, lastError, givenUp };
103284
- const message = givenUp ? `[native-devtools] giving up on ${udid} after ${attempts} attempts: ${lastError}
103292
+ if (givenUp) initRetryAt = performance.now() + NATIVE_DEVTOOLS_INIT_RETRY_COOLDOWN_MS;
103293
+ const message = givenUp ? `[native-devtools] giving up on ${udid} after ${attempts} attempts, retrying in ${NATIVE_DEVTOOLS_INIT_RETRY_COOLDOWN_MS / 1e3}s: ${lastError}
103285
103294
  ` : `[native-devtools] init attempt ${attempts}/${MAX_NATIVE_DEVTOOLS_INIT_ATTEMPTS} failed for ${udid}: ${lastError}
103286
103295
  `;
103287
103296
  process.stderr.write(message);
@@ -103300,12 +103309,18 @@ var nativeDevtoolsBlueprint = {
103300
103309
  });
103301
103310
  return inFlight5;
103302
103311
  };
103312
+ const retryInBackground = () => {
103313
+ if (!inFlight5 && performance.now() >= initRetryAt) void runEnsureEnv().catch(() => {
103314
+ });
103315
+ return Promise.resolve();
103316
+ };
103303
103317
  const ensureEnvReady = () => {
103304
- if (envSetup || initFailure?.givenUp) return Promise.resolve();
103318
+ if (envSetup) return Promise.resolve();
103319
+ if (initFailure?.givenUp) return retryInBackground();
103305
103320
  return runEnsureEnv();
103306
103321
  };
103307
103322
  const reverifyEnv = () => {
103308
- if (initFailure?.givenUp) return Promise.resolve();
103323
+ if (initFailure?.givenUp) return retryInBackground();
103309
103324
  return runEnsureEnv();
103310
103325
  };
103311
103326
  const writeMessage = (socket, type, payload) => {
@@ -103810,6 +103825,7 @@ var nativeDevtoolsBlueprint = {
103810
103825
  socketPath: lentSocketPath ?? socketPath,
103811
103826
  ensureEnvReady: lentSocketPath ? () => Promise.resolve() : ensureEnvReady,
103812
103827
  reverifyEnv: lentSocketPath ? () => Promise.resolve() : reverifyEnv,
103828
+ retryEnvNow: lentSocketPath ? () => Promise.resolve() : runEnsureEnv,
103813
103829
  armsEnv: !lentSocketPath,
103814
103830
  withdrawEnv: lentSocketPath ? () => Promise.resolve() : async () => {
103815
103831
  envRetired = true;
@@ -104359,7 +104375,7 @@ function startSimulatorWatcher(registry2) {
104359
104375
  );
104360
104376
  for (const [udid, service] of trackedServices) {
104361
104377
  if (!booted.has(udid)) continue;
104362
- if (!service.isEnvSetup() && !service.getInitFailure()?.givenUp) {
104378
+ if (!service.isEnvSetup()) {
104363
104379
  pendingAttempts.push(service.ensureEnvReady().catch(() => {
104364
104380
  }));
104365
104381
  }
@@ -137128,11 +137144,11 @@ async function bootIos(udid, registry2, force, headless, prepareOnly) {
137128
137144
  else await clearAutomationEnabledOrWarn(udid);
137129
137145
  const ndRef = nativeDevtoolsRef({ id: udid, platform: "ios", kind: "simulator" });
137130
137146
  const ndApi = await registry2.resolveService(ndRef.urn, ndRef.options);
137131
- await ndApi.reverifyEnv().catch(() => {
137147
+ await ndApi.retryEnvNow().catch(() => {
137132
137148
  });
137133
137149
  const initFailure = ndApi.getInitFailure();
137134
137150
  if (initFailure?.givenUp) {
137135
- return buildInitFailedResult(udid, initFailure);
137151
+ return buildInitFailedResult(udid, initFailure, { afterBoot: true });
137136
137152
  }
137137
137153
  if (!deviceSet) {
137138
137154
  await execFileAsync27("defaults", [
@@ -137197,9 +137213,11 @@ async function bootIosRemote(id, registry2, force) {
137197
137213
  await simctlBootstatus(id, { boot: true });
137198
137214
  const ndRef = nativeDevtoolsRef({ id, platform: "ios-remote", kind: "simulator" });
137199
137215
  const ndApi = await registry2.resolveService(ndRef.urn, ndRef.options);
137216
+ if (ndApi.getInitFailure()?.givenUp) await ndApi.retryEnvNow().catch(() => {
137217
+ });
137200
137218
  const initFailure = ndApi.getInitFailure();
137201
137219
  if (initFailure?.givenUp) {
137202
- return buildInitFailedResult(id, initFailure);
137220
+ return buildInitFailedResult(id, initFailure, { afterBoot: true });
137203
137221
  }
137204
137222
  return { platform: "ios-remote", udid: id, booted: true };
137205
137223
  }
Binary file
Binary file
Binary file
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.35.1-next.76",
3
+ "version": "0.35.1-next.77",
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": "6f98184e8b546c472c52e62c70feef3d220bf0f9"
101
+ "gitHead": "1befac5953342e6f8a16df657df7a38aa6ba37b9"
102
102
  }