@swmansion/argent 0.34.1-next.106 → 0.34.1-next.107

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.
@@ -130223,7 +130223,7 @@ function killDetachedEmulator(child) {
130223
130223
  } catch {
130224
130224
  }
130225
130225
  }
130226
- async function assertScreencapAlive(serial, budgetMs = STAGE_BUDGET.firstRealFrameHot) {
130226
+ async function assertScreencapAlive(serial, onFailure, budgetMs = STAGE_BUDGET.firstRealFrameHot) {
130227
130227
  const deadline = Date.now() + budgetMs;
130228
130228
  let lastReading = null;
130229
130229
  while (Date.now() < deadline) {
@@ -130237,9 +130237,9 @@ async function assertScreencapAlive(serial, budgetMs = STAGE_BUDGET.firstRealFra
130237
130237
  if (Date.now() >= deadline) break;
130238
130238
  await new Promise((r) => setTimeout(r, 1500));
130239
130239
  }
130240
- await killEmulatorQuietly(serial);
130240
+ if (onFailure === "replace") await killEmulatorQuietly(serial);
130241
130241
  throw new FailureError(
130242
- `hot-boot composite did not restore within ${budgetMs / 1e3}s \u2014 \`screencap\` last returned ${JSON.stringify(lastReading ?? "no probe response")}. Falling back to cold boot so screenshots are usable.`,
130242
+ `hot-boot composite did not restore within ${budgetMs / 1e3}s \u2014 \`screencap\` last returned ${JSON.stringify(lastReading ?? "no probe response")}. ` + (onFailure === "replace" ? "Falling back to cold boot so screenshots are usable." : `Left ${serial} running. Pass \`force: true\` to replace it.`),
130243
130243
  {
130244
130244
  error_code: FAILURE_CODES.BOOT_ANDROID_HOT_BOOT_FRAME_UNUSABLE,
130245
130245
  failure_stage: "boot_android_hot_boot_frame",
@@ -130789,7 +130789,7 @@ async function avdInstances(avdName, listed) {
130789
130789
  readOnly.add(serial);
130790
130790
  if (boot.pinned) pinned.add(serial);
130791
130791
  }
130792
- return { readOnly, pinned };
130792
+ return { processes, readOnly, pinned };
130793
130793
  }
130794
130794
  function bootsClash(a, b) {
130795
130795
  if (a.port !== void 0 && a.port === b.port) return true;
@@ -130966,16 +130966,18 @@ async function bootAndroidImpl(params, overallDeadline) {
130966
130966
  );
130967
130967
  const blocks = (p) => !params.readOnly || !p.readOnly;
130968
130968
  let alreadyRunning = params.readOnly ? candidates.find((d) => instances.readOnly.has(d.serial)) : candidates.find((d) => !instances.readOnly.has(d.serial)) ?? candidates[0];
130969
- if (params.readOnly && portSerial !== null && !alreadyRunning && candidates[0]) {
130970
- const processes = await readEmulatorProcessesForAvd(params.avdName);
130969
+ let preserveOnProbeFailure = false;
130970
+ if (params.readOnly && !alreadyRunning && candidates[0]) {
130971
+ const { processes } = instances;
130971
130972
  const known = processes !== null && processes.length > 0;
130972
130973
  if (known && processes.every((p) => p.readOnly)) {
130973
130974
  alreadyRunning = candidates[0];
130974
- } else if (!params.force) {
130975
+ preserveOnProbeFailure = portSerial === null;
130976
+ } else if (portSerial !== null && !params.force) {
130975
130977
  throw portInUseError(
130976
130978
  known ? `${portSerial} already runs AVD "${params.avdName}" writable. Pass \`force: true\` to shut it down and boot it read-only, or pick another \`port\`.` : `${portSerial} already runs AVD "${params.avdName}", and Argent cannot tell whether it runs read-only: ${processes === null ? "the process list of this host is not available" : "its process is not in the process list"}. Use that emulator as it is, or pick another \`port\`.`
130977
130979
  );
130978
- } else {
130980
+ } else if (portSerial !== null) {
130979
130981
  alreadyRunning = candidates[0];
130980
130982
  }
130981
130983
  }
@@ -130989,7 +130991,10 @@ async function bootAndroidImpl(params, overallDeadline) {
130989
130991
  killedRunning = true;
130990
130992
  } else {
130991
130993
  try {
130992
- await assertScreencapAlive(alreadyRunning.serial);
130994
+ await assertScreencapAlive(
130995
+ alreadyRunning.serial,
130996
+ preserveOnProbeFailure ? "preserve" : "replace"
130997
+ );
130993
130998
  const note = await runningGuestVulkanNote(alreadyRunning.serial, params.guestVulkan);
130994
130999
  return {
130995
131000
  platform: "android",
@@ -130998,7 +131003,8 @@ async function bootAndroidImpl(params, overallDeadline) {
130998
131003
  booted: true,
130999
131004
  ...note ? { note } : {}
131000
131005
  };
131001
- } catch (_err) {
131006
+ } catch (err) {
131007
+ if (preserveOnProbeFailure) throw err;
131002
131008
  await dropKilledEmulator(alreadyRunning.serial);
131003
131009
  }
131004
131010
  }
@@ -131079,7 +131085,7 @@ async function bootAndroidImpl(params, overallDeadline) {
131079
131085
  expectedSerial,
131080
131086
  pinnedElsewhere
131081
131087
  });
131082
- await assertScreencapAlive(result.serial);
131088
+ await assertScreencapAlive(result.serial, "replace");
131083
131089
  rememberReadOnly(result.serial, result.pid);
131084
131090
  return {
131085
131091
  platform: "android",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.34.1-next.106",
3
+ "version": "0.34.1-next.107",
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": "5a2f357fce11287e8d398318d115299294bf0454"
101
+ "gitHead": "f0dea93a2fc29b298309a896bc3d2177cc7b4004"
102
102
  }