stim 1.23.1 → 1.24.0

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.
Files changed (169) hide show
  1. package/README.md +3 -2
  2. package/dist/{acquire-artifact-BzYRDgaP.mjs → acquire-artifact-CEs02U2o.mjs} +2 -2
  3. package/dist/{act-vxiMwdf5.mjs → act-Cyvm8xYc.mjs} +40 -25
  4. package/dist/{activity-BpWUPgUm.mjs → activity-Dq3ZcdD8.mjs} +6 -6
  5. package/dist/{agent-device-usage-output-CUlLsbRt.mjs → agent-device-usage-output-CccomeE0.mjs} +5 -5
  6. package/dist/{android-C7sVmyI9.mjs → android-882m4hxX.mjs} +140 -46
  7. package/dist/{android-DtfRGLcc.mjs → android-BZppyPe_.mjs} +66 -46
  8. package/dist/{android-DR5lZ2Az.mjs → android-CX5IcRuf.mjs} +13 -3
  9. package/dist/{android-CLi6DSiS.mjs → android-DcztblCT.mjs} +5 -5
  10. package/dist/{android-cas-ngferVq2.mjs → android-cas-BtCOrNqb.mjs} +3 -3
  11. package/dist/android-cas-compiler.mjs +1 -1
  12. package/dist/api.d.mts +21 -4
  13. package/dist/api.mjs +32 -31
  14. package/dist/{artifact-Xvgibgzq.mjs → artifact-BR5VNArK.mjs} +17 -16
  15. package/dist/{artifact-DBI3DALs.mjs → artifact-Bdt_n9Jc.mjs} +17 -16
  16. package/dist/{artifact-platform-CXcmX_j3.mjs → artifact-platform-CMRc0M_r.mjs} +3 -3
  17. package/dist/{browser-web-BJN9ZHxB.mjs → browser-web-ycg9qWB8.mjs} +16 -17
  18. package/dist/{budget-3ivAK99e.mjs → budget-dPGuhNai.mjs} +101 -40
  19. package/dist/{build-Dv9s8Fz-.mjs → build-CaF574eS.mjs} +31 -28
  20. package/dist/{build-cache-Dv7RN200.mjs → build-cache-HFUQ9eLz.mjs} +152 -19
  21. package/dist/{build-plan-BmbdHQbr.mjs → build-plan-JsDUq4w1.mjs} +8 -7
  22. package/dist/{cache-manifest-DSeQjt-Q.mjs → cache-manifest-BPXRONJz.mjs} +1 -1
  23. package/dist/cache-manifest.mjs +1 -1
  24. package/dist/{ccache-CH2EWGPB.mjs → ccache-CCn1S6qG.mjs} +6 -6
  25. package/dist/{cdp-3fwICjzi.mjs → cdp-BG3FJCCx.mjs} +1 -1
  26. package/dist/{chrome-Bbw689-6.mjs → chrome-BvV8ssI3.mjs} +1 -1
  27. package/dist/{cli-BkK6Wr5i.mjs → cli-xqAidP7O.mjs} +20 -20
  28. package/dist/cli.mjs +1 -1
  29. package/dist/{client-B4MMzfo_.mjs → client-18-ZowoT.mjs} +254 -28
  30. package/dist/collector-run.mjs +6 -6
  31. package/dist/{command-output-YKGWivpG.mjs → command-output-DxC0k2rk.mjs} +3 -2
  32. package/dist/{config-DlrsduwG.mjs → config-BZhXY15H.mjs} +3 -3
  33. package/dist/{created-devices-x9rN6bhs.mjs → created-devices-D2Aca-xu.mjs} +6 -2
  34. package/dist/{dependency-state-1I9KZT1Y.mjs → dependency-state-C56ll9hY.mjs} +2 -2
  35. package/dist/{detached-entry-BwNEtIrP.mjs → detached-entry-KmieOKgN.mjs} +1 -1
  36. package/dist/{dev-client-BFxiDpkf.mjs → dev-client-w_fok0Ek.mjs} +3 -3
  37. package/dist/{device-B7ljwccX.mjs → device-4RUugw5X.mjs} +16 -16
  38. package/dist/{device-CiNYxqp6.mjs → device-BktRGdjS.mjs} +40 -44
  39. package/dist/{device-capacity-DH0QsZYZ.mjs → device-capacity-Ic-kdmEV.mjs} +20 -16
  40. package/dist/device-host-worker.mjs +17 -17
  41. package/dist/{device-ios-CbVDtDIy.mjs → device-ios-DzpSlZyd.mjs} +23 -52
  42. package/dist/{device-lease-run-DXPSwdbb.mjs → device-lease-run-DUtkbqBQ.mjs} +5 -5
  43. package/dist/{device-pool-B4iOXIrD.mjs → device-pool-CgBHk401.mjs} +3 -3
  44. package/dist/{doctor-DRu-8ld6.mjs → doctor-BZ6oxNum.mjs} +1 -1
  45. package/dist/{doctor-HUC1igzw.mjs → doctor-C33AzVfR.mjs} +28 -28
  46. package/dist/{doctor-C6t4Maue.mjs → doctor-DZgpqR6J.mjs} +14 -14
  47. package/dist/{doctor-fingerprint-DZLoYFVb.mjs → doctor-fingerprint-zlujA1Gs.mjs} +1 -1
  48. package/dist/doctor-fingerprint.mjs +1 -1
  49. package/dist/{doctor-watchman-iGBpC6KM.mjs → doctor-watchman-B453A231.mjs} +5 -5
  50. package/dist/{eas-build-DMWSSvxq.mjs → eas-build-CxKUNHsb.mjs} +4 -4
  51. package/dist/{eas-fallback-vKlrqxgE.mjs → eas-fallback-LMxk9Kw0.mjs} +14 -14
  52. package/dist/{eas-session-ledger-BQF9Yyy9.mjs → eas-session-ledger-Ck6YXPAO.mjs} +12 -8
  53. package/dist/{error-diagnostics-DYsjJIHz.mjs → error-diagnostics-BkKCZq4P.mjs} +17 -42
  54. package/dist/{exec-DEoAhcze.mjs → exec-VFRpu1iA.mjs} +116 -28
  55. package/dist/{gc-dDE4QPVu.mjs → gc-DDWEAj0w.mjs} +2 -2
  56. package/dist/{gc-BW8E1uSC.mjs → gc-yVKpAOKM.mjs} +205 -28
  57. package/dist/{guide-DYYEO3Wz.mjs → guide-Bggftwc5.mjs} +222 -59
  58. package/dist/{hosted-android-xcfgCgSF.mjs → hosted-android-D4dweBof.mjs} +4 -4
  59. package/dist/{hosted-client-Bt-tndxV.mjs → hosted-client-BBTVe3X6.mjs} +4 -4
  60. package/dist/{hosted-ios-y19jCYFF.mjs → hosted-ios-Sn0djzg8.mjs} +1 -1
  61. package/dist/{hosted-logs-DzJKzKlj.mjs → hosted-logs-CYIZ5ubJ.mjs} +11 -6
  62. package/dist/{hosted-macos-BJusKvqL.mjs → hosted-macos-CXjsUNBR.mjs} +7 -7
  63. package/dist/{hosted-native-BmQC6U_x.mjs → hosted-native-Doxbfzem.mjs} +58 -11
  64. package/dist/{idle-shutdown-CJmUOV5x.mjs → idle-shutdown-BInjLKqm.mjs} +10 -10
  65. package/dist/{ios-CWjqfSm_.mjs → ios-B1FXRCMX.mjs} +71 -44
  66. package/dist/{ios-DTOYZGMJ.mjs → ios-BItP6lkn.mjs} +8 -8
  67. package/dist/{ios-hcBpnEGk.mjs → ios-CVUFFZ6C.mjs} +70 -13
  68. package/dist/{ios-xtlRHaeB.mjs → ios-ENC4sRPA.mjs} +1 -1
  69. package/dist/{ios-device-BXZ0c7Kb.mjs → ios-device-B6HK951C.mjs} +1 -1
  70. package/dist/{ios-device-DFGuwF4U.mjs → ios-device-BI38NFFH.mjs} +3 -3
  71. package/dist/{ios-project-CSZYI1iu.mjs → ios-project-KYqeJURj.mjs} +5 -5
  72. package/dist/{ios-signing-BtAffm0A.mjs → ios-signing-4c_qXvQm.mjs} +2 -2
  73. package/dist/{ios-state-Dtw5K2aI.mjs → ios-state-DlElquYD.mjs} +15 -7
  74. package/dist/{js-swap-BSBHldmm.mjs → js-swap-BvrQvXHY.mjs} +7 -6
  75. package/dist/{launch-CP2wDCVd.mjs → launch-BVlyQw3T.mjs} +51 -49
  76. package/dist/{launch-D-zq8SHG.mjs → launch-SfzGH_s9.mjs} +48 -29
  77. package/dist/{logs-pNvA2hHK.mjs → logs-DXE32kyb.mjs} +16 -9
  78. package/dist/{logs-By5aw3g9.mjs → logs-ovlU7m7N.mjs} +8 -6
  79. package/dist/{macos-CPMahOC2.mjs → macos-B3BveDrU.mjs} +1 -1
  80. package/dist/{macos-C67FZ2ft.mjs → macos-CCfhb-jT.mjs} +49 -42
  81. package/dist/macos-run.mjs +1 -1
  82. package/dist/maintenance-run.mjs +7 -7
  83. package/dist/{metro-DiXtA3Ty.mjs → metro-Bu8LBfzS.mjs} +4 -4
  84. package/dist/{metro-gateway-CKZqKqx7.mjs → metro-gateway-DtsOy-0P.mjs} +3 -4
  85. package/dist/{named-ports-DkEzOfzO.mjs → named-ports-BWDuU5oQ.mjs} +3 -3
  86. package/dist/{native-android-_MWSs3PP.mjs → native-android-96BBizbq.mjs} +17 -17
  87. package/dist/{native-gradle-artifact-inputs-DHFnmrVf.mjs → native-gradle-artifact-inputs-BcLYBZil.mjs} +5 -5
  88. package/dist/{native-run-Dv88i0aU.mjs → native-run-BmH7U8pr.mjs} +6 -6
  89. package/dist/{native-runtime-DBRfY_PN.mjs → native-runtime-DgtJkzIa.mjs} +10 -9
  90. package/dist/{native-source-Y0yLhFyQ.mjs → native-source-D-4Dh4JU.mjs} +7 -4
  91. package/dist/{native-xcode-inputs-CqViUh3r.mjs → native-xcode-inputs-irplbQb0.mjs} +2 -2
  92. package/dist/{native-xcode-ios-vFgqL_yS.mjs → native-xcode-ios-BY-6hh6M.mjs} +18 -18
  93. package/dist/offload-worker.d.mts +7 -2
  94. package/dist/offload-worker.mjs +75 -41
  95. package/dist/{operation-exec-BW0em61G.mjs → operation-exec-CUZifp6Z.mjs} +2 -25
  96. package/dist/{ownership-C5fo5Edb.mjs → ownership-DxlZGDcV.mjs} +3 -3
  97. package/dist/{page-DBL2PiUU.mjs → page-CzEA_-5_.mjs} +2 -3
  98. package/dist/phone-reverses-BdsdesVF.mjs +57 -0
  99. package/dist/{placement-log-BnGgJRRZ.mjs → placement-log-DUvqqsB-.mjs} +1 -1
  100. package/dist/{plan-placement-cr0fEU7b.mjs → plan-placement-4axc0Hs7.mjs} +3 -3
  101. package/dist/{ports-DpXjKkSV.mjs → ports-D-E_OiAO.mjs} +3 -3
  102. package/dist/{prebuild-BligW0QS.mjs → prebuild-DmVCf5xb.mjs} +14 -9
  103. package/dist/{project-DhCtQWWU.mjs → project-Dz-hWkb-.mjs} +21 -17
  104. package/dist/{pull-request-W1IuLXDt.mjs → pull-request-CbNlkFok.mjs} +2 -2
  105. package/dist/pull-requests.mjs +1 -1
  106. package/dist/{react-native-android-ZlhQfhvq.mjs → react-native-android-DOinxgwB.mjs} +75 -32
  107. package/dist/{react-native-build-CelbTO_y.mjs → react-native-build-AuCu-aAP.mjs} +22 -19
  108. package/dist/{react-native-doctor-LTIaP7lv.mjs → react-native-doctor-2ivJUmwZ.mjs} +10 -9
  109. package/dist/{react-native-ios-C5W0SA6f.mjs → react-native-ios-D5zTIuH8.mjs} +38 -22
  110. package/dist/{recordings-CQmfzAh7.mjs → recordings-CdPwYwvs.mjs} +1 -1
  111. package/dist/{registration-BcRgF6Ox.mjs → registration-CN6nlhcD.mjs} +1 -1
  112. package/dist/{reload-COJWTbae.mjs → reload-C1TTVesC.mjs} +144 -42
  113. package/dist/{reload-QcwnYLYV.mjs → reload-Ck9RJeSq.mjs} +1 -1
  114. package/dist/{remote-DR8qUERM.mjs → remote-DEZ7AOVq.mjs} +7 -7
  115. package/dist/{result-utnBea7x.mjs → result-DqBrb12U.mjs} +40 -17
  116. package/dist/{run-DidHghD1.mjs → run-BIwoU44q.mjs} +2 -2
  117. package/dist/{selection-DSMbWEX2.mjs → selection-BLtvaqxc.mjs} +11 -5
  118. package/dist/{server-bare-CafzuyFB.mjs → server-bare-Z1ToVLPn.mjs} +2 -2
  119. package/dist/{server-command-B9o92sLM.mjs → server-command-C0pmjNdG.mjs} +5 -5
  120. package/dist/server-expo-CEntXzRw.mjs +2 -0
  121. package/dist/{server-expo-BXrWxNYh.mjs → server-expo-Tt_hLRpy.mjs} +8 -5
  122. package/dist/{settings-C7O8A6ZI.mjs → settings-RKwY33wv.mjs} +114 -19
  123. package/dist/{settings-PfJx8uK1.mjs → settings-kkt0vP4w.mjs} +1 -1
  124. package/dist/{settings-write-Chuy7Cte.mjs → settings-write--gj6MACV.mjs} +7 -7
  125. package/dist/settings.schema.json +13 -0
  126. package/dist/{simslim-BNckWpXi.mjs → simslim-CdWKT3vA.mjs} +2 -2
  127. package/dist/{slot-launch-B7AuoWJv.mjs → slot-launch-A1BgotaM.mjs} +6 -6
  128. package/dist/{stage-C4u17aES.mjs → stage-ERTMh88n.mjs} +2 -3
  129. package/dist/{start-CU8mCPC7.mjs → start-BKGrEhzG.mjs} +75 -35
  130. package/dist/{start-BL_BsiWt.mjs → start-Bmg_qmHi.mjs} +1 -1
  131. package/dist/{state--smjFSTL.mjs → state-B1ig0Kqy.mjs} +4 -4
  132. package/dist/{state-08I3hw3_.mjs → state-BfAltYJP.mjs} +2 -2
  133. package/dist/{stats-CO6sK0Nh.mjs → stats-B-ckuiUg.mjs} +5 -5
  134. package/dist/{stats-report-BzaPrRm6.mjs → stats-report-n2U5plhk.mjs} +1 -1
  135. package/dist/{status-_WPHzVft.mjs → status-DfFp6a76.mjs} +24 -24
  136. package/dist/{status-BRROykC8.mjs → status-Fect2w9R.mjs} +1 -1
  137. package/dist/{status-CrJutl6-.mjs → status-Pw-807f0.mjs} +1 -1
  138. package/dist/{status-watch-BHFasOZN.mjs → status-watch-XC7F-AMf.mjs} +5 -5
  139. package/dist/status-worker.mjs +1 -1
  140. package/dist/stim-clonefile.c +18 -0
  141. package/dist/{stim-desktop-D5OGpYZM.mjs → stim-desktop-DS0mzR8U.mjs} +2 -2
  142. package/dist/{stop-iuFHjUST.mjs → stop-BFu7X_Do.mjs} +2 -2
  143. package/dist/{stop-BJ06ipTZ.mjs → stop-CL1kDHds.mjs} +55 -21
  144. package/dist/{stop-CR5689oB.mjs → stop-DhclRwOO.mjs} +5 -5
  145. package/dist/supervisor-run.mjs +16 -16
  146. package/dist/{support-TWuQlHQo.mjs → support-B1W-hmC2.mjs} +8 -8
  147. package/dist/{support-CbXPbUMJ.mjs → support-B3tzVhKn.mjs} +6 -6
  148. package/dist/{swiftpm-artifact-inputs-DFcGsXDP.mjs → swiftpm-artifact-inputs-BWYPj9Sn.mjs} +4 -4
  149. package/dist/{swiftpm-macos-DbwGCpZg.mjs → swiftpm-macos-BVCP5mO4.mjs} +14 -13
  150. package/dist/{toolchain-XkA2PfJZ.mjs → toolchain-BjgKdoEf.mjs} +1 -1
  151. package/dist/{toolchain-B9hCFCQw.mjs → toolchain-D3bmRMia.mjs} +57 -36
  152. package/dist/trigger-BLsHgAGR.mjs +2 -0
  153. package/dist/{trigger-Cbyc41d_.mjs → trigger-CBMe2YLH.mjs} +2 -2
  154. package/dist/{warm-progress-CA3TgT3-.mjs → warm-progress-ol0ZypEu.mjs} +6 -6
  155. package/dist/{web-DRF_oFXk.mjs → web-BH7peScT.mjs} +12 -10
  156. package/dist/web-BdOFlTJr.mjs +2 -0
  157. package/dist/web-run.mjs +8 -9
  158. package/dist/windows-report.mjs +12 -1
  159. package/dist/windows-report.ps1 +1 -1
  160. package/dist/{workspace-state-U08dEzhG.mjs → workspace-state-CeBpIZgr.mjs} +11 -4
  161. package/dist/{workspaces-e41xsjKr.mjs → workspaces-CSV2Orf4.mjs} +36 -32
  162. package/dist/{worktree-BEwxVwKF.mjs → worktree-DEDUzO_L.mjs} +1 -1
  163. package/dist/{worktree-B4Nj3EGS.mjs → worktree-Dw8kfacb.mjs} +324 -99
  164. package/dist/{xcode-Rq744mBF.mjs → xcode-DHu41qQ4.mjs} +41 -27
  165. package/package.json +7 -7
  166. package/dist/native-gradle-inputs-Dnh84Zbd.mjs +0 -211
  167. package/dist/server-expo-Ddr8cG_c.mjs +0 -2
  168. package/dist/trigger-yb_nFzPF.mjs +0 -2
  169. package/dist/web-kDE9Myoy.mjs +0 -2
@@ -1,16 +1,16 @@
1
- import { t as getExecutor, x as ownership_claim_exports } from "./exec-DEoAhcze.mjs";
2
- import { D as withConfigLock, G as projectDeviceSlots, H as deviceSlotPlatforms, O as withConfigLockAsync, _ as loadConfig, a as clearDevice, b as releaseAndroidConsolePort, i as clearAndroidBootPending, j as acquireAvdClaim, t as allConsolePortsAndSerials, w as setDevice } from "./config-DlrsduwG.mjs";
3
- import { l as phaseLine } from "./command-output-YKGWivpG.mjs";
4
- import { l as androidDataPartitionSizeGbSetting, o as androidAvdConfigSetting } from "./settings-C7O8A6ZI.mjs";
5
- import { s as ownedDeviceLabel } from "./project-DhCtQWWU.mjs";
6
- import { c as pidExists } from "./metro-DiXtA3Ty.mjs";
7
- import { A as teardownParkedAvd, D as teardownOwnedAvd } from "./workspaces-e41xsjKr.mjs";
8
- import { A as listAdbDevices, B as ownedAvdDeviceProfile, F as listAvdsAsync, H as ownedAvdMatchesConfiguration, I as listInstalledSystemImages, K as ownedAvdSystemImage, O as getAvdNameForSerialAsync, U as ownedAvdName, X as pickDefaultSystemImage, _ as avdPoolConfiguration, _t as parkedMaxSetting, b as configureNewOwnedAvd, et as resolveOwnedAvdSerialAsync, f as assertOwnedAvdStopped, ft as adoptParked, ht as isLegacyDeletionClaim, j as listAdbDevicesAsync, n as OWNED_AVD_CONFIG_DEFAULTS, ot as waitForBoot, t as DEFAULT_AVD_DEVICE_PROFILE, vt as readParked, x as createOwnedAvd, y as bootAndroidEmulator, z as nextConsolePort } from "./android-C7sVmyI9.mjs";
9
- import { I as memoryCulpritAdvice, N as memoryCulpritsUnder, P as readHostMemoryPressure, d as listAllIosSims } from "./ios-hcBpnEGk.mjs";
10
- import { t as clearDeviceIdleShutdown } from "./idle-shutdown-CJmUOV5x.mjs";
11
- import { i as countLiveOwnedDevices, m as withDeviceBootAdmission, n as DeviceAdmissionRefusal } from "./device-capacity-DH0QsZYZ.mjs";
12
- import { i as ensureOwnedIosDevice, r as ensureIosBooted } from "./device-ios-CbVDtDIy.mjs";
13
- import { t as reconcileSimSlim } from "./simslim-BNckWpXi.mjs";
1
+ import { D as ownership_claim_exports, t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
+ import { D as withConfigLock, G as projectDeviceSlots, H as deviceSlotPlatforms, O as withConfigLockAsync, _ as loadConfig, a as clearDevice, b as releaseAndroidConsolePort, i as clearAndroidBootPending, j as acquireAvdClaim, t as allConsolePortsAndSerials, w as setDevice } from "./config-BZhXY15H.mjs";
3
+ import { l as phaseLine } from "./command-output-DxC0k2rk.mjs";
4
+ import { l as androidDataPartitionSizeGbSetting, o as androidAvdConfigSetting } from "./settings-RKwY33wv.mjs";
5
+ import { s as ownedDeviceLabel } from "./project-Dz-hWkb-.mjs";
6
+ import { A as listAdbDevices, B as ownedAvdDeviceProfile, F as listAvdsAsync, H as ownedAvdMatchesConfiguration, I as listInstalledSystemImages, K as ownedAvdSystemImage, O as getAvdNameForSerialAsync, U as ownedAvdName, X as pickDefaultSystemImage, _ as avdPoolConfiguration, b as configureNewOwnedAvd, ct as waitForBoot, f as assertOwnedAvdStopped, gt as isLegacyDeletionClaim, j as listAdbDevicesAsync, n as OWNED_AVD_CONFIG_DEFAULTS, nt as resolveOwnedAvdSerialAsync, pt as adoptParked, t as DEFAULT_AVD_DEVICE_PROFILE, vt as parkedMaxSetting, x as createOwnedAvd, y as bootAndroidEmulator, yt as readParked, z as nextConsolePort } from "./android-882m4hxX.mjs";
7
+ import { c as pidExists } from "./metro-Bu8LBfzS.mjs";
8
+ import { O as teardownOwnedAvd, j as teardownParkedAvd } from "./workspaces-CSV2Orf4.mjs";
9
+ import { F as readHostMemoryPressure, L as reportMemoryCulprits, P as memoryCulpritsUnderAsync, R as memoryCulpritAdvice, d as listAllIosSims } from "./ios-CVUFFZ6C.mjs";
10
+ import { t as clearDeviceIdleShutdown } from "./idle-shutdown-BInjLKqm.mjs";
11
+ import { i as countLiveOwnedDevices, m as withDeviceBootAdmission, n as DeviceAdmissionRefusal } from "./device-capacity-Ic-kdmEV.mjs";
12
+ import { i as ensureOwnedIosDevice, r as ensureIosBooted } from "./device-ios-DzpSlZyd.mjs";
13
+ import { t as reconcileSimSlim } from "./simslim-CdWKT3vA.mjs";
14
14
  import { claimRemoveCommand, clearClaimChild, markClaimChildPending, processGroupAlive, releaseClaim, setClaimChild } from "@stim-cli/core/ownership-claim";
15
15
  import { randomUUID } from "node:crypto";
16
16
  import { existsSync } from "node:fs";
@@ -227,9 +227,7 @@ async function prepareOwnedAvd({ projectPath, slot, label, previousAvdName, syst
227
227
  slot,
228
228
  expectedRecord: reservation
229
229
  },
230
- onRemoved: () => {
231
- clearDevice(projectPath, "android", slot, avdName);
232
- }
230
+ onRemoved: () => withConfigLockAsync(() => clearDevice(projectPath, "android", slot, avdName))
233
231
  });
234
232
  const orphan = cleanup.status === "failed" || cleanup.status === "skipped" ? ` The owned AVD remains tracked for cleanup (${cleanup.reason || cleanup.status}); fix the cause, then retry or run \`stim gc --delete\`.` : "";
235
233
  throw new Error(`Created owned AVD ${avdName}, but could not configure its AVD settings: ${String(error?.message || error)}${orphan}`, { cause: error });
@@ -257,9 +255,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
257
255
  slot,
258
256
  expectedRecord: record
259
257
  },
260
- onRemoved: () => {
261
- clearDevice(projectPath, "android", slot, avdName);
262
- }
258
+ onRemoved: () => withConfigLockAsync(() => clearDevice(projectPath, "android", slot, avdName))
263
259
  });
264
260
  if (cleanup.status === "failed" || cleanup.status === "skipped") throw new AvdRecoveryError(`Owned AVD ${record.avdName} has incomplete setup and could not be deleted (${cleanup.reason || cleanup.status}). Fix the cause, then retry; Stim kept the device record for cleanup.`, "Wait for any active AVD operation to finish. If the refusal names an unresolved claim, inspect its creator and native processes before removing only that claim. Retry `stim android` to reconcile the incomplete device.");
265
261
  record = null;
@@ -277,9 +273,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
277
273
  slot,
278
274
  expectedRecord: record
279
275
  },
280
- onRemoved: () => {
281
- clearDevice(projectPath, "android", slot, avdName);
282
- }
276
+ onRemoved: () => withConfigLockAsync(() => clearDevice(projectPath, "android", slot, avdName))
283
277
  });
284
278
  if (cleanup.status === "failed" || cleanup.status === "skipped") throw new AvdRecoveryError(`Owned AVD ${avdName} never finished a boot, but could not be deleted to create one on ${requestedImage} (${cleanup.reason || cleanup.status}). Stim kept the device record.`, "Fix the cause, then retry, or pass `--slot <name>` to create the requested emulator beside it.");
285
279
  out(phaseLine("device", `deleted ${avdName}, which never finished a boot, to create one on ${requestedImage}`));
@@ -290,7 +284,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
290
284
  const configurationBeforeDefaults = avdPoolConfiguration(androidDataPartitionSizeGbSetting(settings), projectAvdConfig, deviceProfile);
291
285
  if (record?.avdName) {
292
286
  if (record.owned) {
293
- const resolved = await resolveOwnedAvdSerialAsync(record.avdName);
287
+ const resolved = await resolveOwnedAvdSerialAsync(record.avdName, { preferredSerial: record.consolePort ? `emulator-${record.consolePort}` : void 0 });
294
288
  const currentProfile = resolved.notOwned || resolved.missing ? null : ownedAvdDeviceProfile(record.avdName);
295
289
  if (requestedProfile && currentProfile && currentProfile !== requestedProfile) throw new AvdRecoveryError(`this project's emulator uses device profile ${currentProfile}, but ${requestedProfile} was requested. Stim will not silently boot a different model.`, "Run `stim worktree remove` (or `stim gc --delete`) to reap the current emulator, then `stim android` again to create the requested one, or pass `--slot <name>` to create it beside the current one.");
296
290
  if (resolved.notOwned) note(chalk.yellow(`Note: recorded AVD ${record.avdName} is not Stim-owned -- creating a fresh owned AVD instead of reusing it.`));
@@ -304,7 +298,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
304
298
  owned: true,
305
299
  deviceName: record.deviceName ?? record.avdName
306
300
  };
307
- setDevice(projectPath, "android", updated, slot);
301
+ await withConfigLockAsync(() => setDevice(projectPath, "android", updated, slot));
308
302
  return {
309
303
  ...updated,
310
304
  systemImage: ownedAvdSystemImage(record.avdName),
@@ -369,7 +363,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
369
363
  poolConfiguration: parked.configuration,
370
364
  adoptionPending: true
371
365
  };
372
- if (!adoptParked({
366
+ if (!await adoptParked({
373
367
  platform: "android",
374
368
  projectPath,
375
369
  slot,
@@ -469,14 +463,15 @@ async function bootOwnedAvdOnFreshPort({ avdName, deviceSlotWait, metadata, proj
469
463
  platform: "android",
470
464
  key: avdName
471
465
  }, async () => {
472
- const claim = claimAndroidConsolePort({
466
+ const livePorts = liveAndroidConsolePorts();
467
+ const claim = await withConfigLockAsync(() => claimAndroidConsolePort({
473
468
  projectPath,
474
469
  slot,
475
470
  avdName,
476
471
  deviceName,
477
- livePorts: liveAndroidConsolePorts(),
472
+ livePorts,
478
473
  metadata
479
- });
474
+ }));
480
475
  const serial = `emulator-${claim.consolePort}`;
481
476
  try {
482
477
  reportAndroidMemoryPressure(out);
@@ -492,7 +487,7 @@ async function bootOwnedAvdOnFreshPort({ avdName, deviceSlotWait, metadata, proj
492
487
  if (result.failed) throw new AvdBootError(result.reason, result.remedy);
493
488
  const running = await getAvdNameForSerialAsync(serial);
494
489
  if (running && running !== avdName) throw new Error(`${serial} is running AVD ${running}, not this workspace's owned AVD ${avdName}; refusing to use it.`);
495
- clearAndroidBootPending(projectPath, avdName, slot);
490
+ await withConfigLockAsync(() => clearAndroidBootPending(projectPath, avdName, slot));
496
491
  await muteBootedEmulator(serial, avdName, out);
497
492
  const { bootPending: _booted, ...booted } = claim;
498
493
  return {
@@ -501,7 +496,7 @@ async function bootOwnedAvdOnFreshPort({ avdName, deviceSlotWait, metadata, proj
501
496
  setup: true
502
497
  };
503
498
  } catch (error) {
504
- releaseAndroidConsolePort(projectPath, claim.consolePort, slot);
499
+ await withConfigLockAsync(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
505
500
  throw error;
506
501
  }
507
502
  }, {
@@ -566,11 +561,11 @@ async function muteBootedEmulator(serial, avdName, out) {
566
561
  function reportAndroidMemoryPressure(out) {
567
562
  const pressure = readHostMemoryPressure();
568
563
  if (pressure === "warning" || pressure === "critical") {
569
- const named = memoryCulpritAdvice(memoryCulpritsUnder(pressure));
570
- out(chalk.dim(phaseLine("memory", `macOS reports ${pressure} host memory pressure; emulator boot may be slow.${named ? ` ${named}` : ""} Free memory with \`stim stop\` only in workspaces you own; ask before closing other apps or devices.`)));
564
+ out(chalk.dim(phaseLine("memory", `macOS reports ${pressure} host memory pressure; emulator boot may be slow. Free memory with \`stim stop\` only in workspaces you own; ask before closing other apps or devices.`)));
565
+ reportMemoryCulprits(pressure, (named) => out(chalk.dim(phaseLine("memory", named))));
571
566
  }
572
567
  }
573
- function androidBootRemedy(pressure) {
568
+ async function androidBootRemedy(pressure) {
574
569
  let count = null;
575
570
  try {
576
571
  const live = countLiveOwnedDevices({
@@ -583,7 +578,7 @@ function androidBootRemedy(pressure) {
583
578
  });
584
579
  count = typeof live === "number" ? live : null;
585
580
  } catch {}
586
- const named = memoryCulpritAdvice(memoryCulpritsUnder(pressure));
581
+ const named = memoryCulpritAdvice(await memoryCulpritsUnderAsync(pressure));
587
582
  const observation = pressure === "warning" || pressure === "critical" ? `macOS reports ${pressure} host memory pressure. ${named ? `${named} ` : ""}` : "";
588
583
  const devices = count ? `${count} Stim-owned ${count === 1 ? "device is" : "devices are"} running. ` : "";
589
584
  if (observation || devices) return `${observation}${devices}Stop an unneeded device with \`stim stop\` only in a workspace you own, then run \`stim android\` again; ask before closing other apps or devices. These observations do not establish the cause of the timeout or an OOM crash.`;
@@ -617,7 +612,7 @@ async function waitForAndroidBoot({ serial, timeoutMs, pid = null, alive = pidEx
617
612
  return {
618
613
  failed: true,
619
614
  reason: `${exited ? `The emulator process for ${serial} exited before the device finished booting.` : `Emulator ${serial} did not finish booting within ${Math.round(elapsedMs / 1e3)}s.`} Diagnostic: ${JSON.stringify(result.diagnostic)}`,
620
- remedy: exited ? "Inspect the emulator log for the process exit, fix what it reports, then run `stim android` again." : androidBootRemedy(pressure)
615
+ remedy: exited ? "Inspect the emulator log for the process exit, fix what it reports, then run `stim android` again." : await androidBootRemedy(pressure)
621
616
  };
622
617
  }
623
618
  async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot, timeoutMs, out, logFile = null, alive = pidExists }) {
@@ -627,7 +622,7 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
627
622
  };
628
623
  let resolved;
629
624
  try {
630
- resolved = await resolveOwnedAvdSerialAsync(device.avdName);
625
+ resolved = await resolveOwnedAvdSerialAsync(device.avdName, { preferredSerial: device.consolePort ? `emulator-${device.consolePort}` : void 0 });
631
626
  } catch (e) {
632
627
  return {
633
628
  failed: true,
@@ -643,8 +638,8 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
643
638
  reason: `AVD ${device.avdName} is not Stim-owned; refusing to boot it.`
644
639
  };
645
640
  const avdName = device.avdName;
646
- const booted = (result) => {
647
- if (!result.failed) clearAndroidBootPending(projectPath, avdName, slot);
641
+ const booted = async (result) => {
642
+ if (!result.failed) await withConfigLockAsync(() => clearAndroidBootPending(projectPath, avdName, slot));
648
643
  return result;
649
644
  };
650
645
  if (resolved.serial) return booted(await waitForAndroidBoot({
@@ -659,14 +654,15 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
659
654
  out
660
655
  }));
661
656
  const boot = async () => {
662
- const claim = claimAndroidConsolePort({
657
+ const livePorts = liveAndroidConsolePorts();
658
+ const claim = await withConfigLockAsync(() => claimAndroidConsolePort({
663
659
  projectPath,
664
660
  slot,
665
661
  avdName,
666
662
  deviceName: device.deviceName,
667
- livePorts: liveAndroidConsolePorts(),
663
+ livePorts,
668
664
  metadata: device
669
- });
665
+ }));
670
666
  const serial = `emulator-${claim.consolePort}`;
671
667
  reportAndroidMemoryPressure(out);
672
668
  out(chalk.dim(phaseLine("device", `booting ${avdName} as ${serial}`)));
@@ -674,7 +670,7 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
674
670
  try {
675
671
  pid = await bootAndroidEmulator(avdName, claim.consolePort, { logFile });
676
672
  } catch (e) {
677
- releaseAndroidConsolePort(projectPath, claim.consolePort, slot);
673
+ await withConfigLockAsync(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
678
674
  return {
679
675
  failed: true,
680
676
  reason: `Could not start emulator for AVD ${avdName}: ${e?.message || e}`
@@ -687,7 +683,7 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
687
683
  alive,
688
684
  out
689
685
  });
690
- if (result.failed) releaseAndroidConsolePort(projectPath, claim.consolePort, slot);
686
+ if (result.failed) await withConfigLockAsync(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
691
687
  else await muteBootedEmulator(serial, avdName, out);
692
688
  return booted(result);
693
689
  };
@@ -721,7 +717,7 @@ function didSetUpDevice(device, remote) {
721
717
  return remote ? void 0 : Boolean(device.setup || device.booting);
722
718
  }
723
719
  async function ensureOwnedDevice({ platform, project, projectPath, slot, settingsRoot = projectPath, label = ownedDeviceLabel(projectPath), settings, flags = {}, note = () => {}, out = () => {}, logFile = null, alive = pidExists, configureAvd = configureNewOwnedAvd, teardownAvd = teardownOwnedAvd, reconcileIosSimulator = reconcileSimSlim, simSnapshot }) {
724
- clearDeviceIdleShutdown(projectPath, platform, slot);
720
+ await clearDeviceIdleShutdown(projectPath, platform, slot);
725
721
  if (slot && slot !== "default") label = `${label}-${slot}`;
726
722
  const record = deviceSlotPlatforms(project, slot)?.[platform] ?? null;
727
723
  if (platform === "ios") return ensureOwnedIosDevice({
@@ -1,15 +1,15 @@
1
- import { a as workspaceProcessLockError, i as withWorkspaceProcessLock, x as ownership_claim_exports } from "./exec-DEoAhcze.mjs";
1
+ import { D as ownership_claim_exports, d as workspaceProcessLockError, u as withWorkspaceProcessLock } from "./exec-VFRpu1iA.mjs";
2
2
  import { m as workspaceLogsDir$1 } from "./paths-DQtTgsBf.mjs";
3
- import { G as projectDeviceSlots, H as deviceSlotPlatforms, _ as loadConfig$1, d as getConfigDir, u as getConcurrencyLimits } from "./config-DlrsduwG.mjs";
4
- import { a as formatElapsed, l as phaseLine } from "./command-output-YKGWivpG.mjs";
5
- import { g as deviceReclaimIdleMinutesSetting } from "./settings-C7O8A6ZI.mjs";
3
+ import { G as projectDeviceSlots, H as deviceSlotPlatforms, O as withConfigLockAsync$1, _ as loadConfig$1, d as getConfigDir, u as getConcurrencyLimits } from "./config-BZhXY15H.mjs";
4
+ import { a as formatElapsed, l as phaseLine } from "./command-output-DxC0k2rk.mjs";
5
+ import { g as deviceReclaimIdleMinutesSetting } from "./settings-RKwY33wv.mjs";
6
+ import { A as listAdbDevices, j as listAdbDevicesAsync } from "./android-882m4hxX.mjs";
6
7
  import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
7
- import { K as recordCapacityRefusal, q as recordCapacityWait } from "./budget-3ivAK99e.mjs";
8
+ import { J as recordCapacityRefusal, Y as recordCapacityWait } from "./budget-dPGuhNai.mjs";
8
9
  import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
9
- import { f as withIdleWorkspace } from "./workspaces-e41xsjKr.mjs";
10
- import { A as listAdbDevices, j as listAdbDevicesAsync } from "./android-C7sVmyI9.mjs";
11
- import { d as listAllIosSims, f as listAllIosSimsAsync, l as iosRuntimeMatches, y as parseRuntimeVersion } from "./ios-hcBpnEGk.mjs";
12
- import { n as dueIdleDevices, r as shutDownIdleDevices } from "./idle-shutdown-CJmUOV5x.mjs";
10
+ import { p as withIdleWorkspace } from "./workspaces-CSV2Orf4.mjs";
11
+ import { d as listAllIosSims, f as listAllIosSimsAsync, l as iosRuntimeMatches, y as parseRuntimeVersion } from "./ios-CVUFFZ6C.mjs";
12
+ import { n as dueIdleDevices, r as shutDownIdleDevices } from "./idle-shutdown-BInjLKqm.mjs";
13
13
  import { realpathSync } from "node:fs";
14
14
  import { basename, join } from "node:path";
15
15
  import { LOG_ROTATE_BYTES, workspaceId } from "@stim-cli/core";
@@ -524,24 +524,28 @@ async function withDeviceBootAdmission(device, boot, { root, max = getConcurrenc
524
524
  await sleep(Math.min(2e3, Math.max(0, waitMs - elapsedMs)));
525
525
  }
526
526
  } catch (error) {
527
- if (error instanceof DeviceAdmissionRefusal && error.code === "STIM_AT_CAPACITY") recordCapacityRefusal({
528
- platform: device.platform,
529
- max,
530
- workspace
531
- }, now());
527
+ if (error instanceof DeviceAdmissionRefusal && error.code === "STIM_AT_CAPACITY") {
528
+ const at = now();
529
+ await withConfigLockAsync$1(() => recordCapacityRefusal({
530
+ platform: device.platform,
531
+ max,
532
+ workspace
533
+ }, at)).catch(() => {});
534
+ }
532
535
  throw error;
533
536
  } finally {
534
537
  (0, ownership_claim_exports.releaseClaim)(ticket);
535
538
  if (visibleWait) waitingFor(null);
536
539
  if (started !== void 0) {
537
540
  const ms = Math.max(0, Math.round(now() - started));
538
- recordCapacityWait({
541
+ const at = now();
542
+ await withConfigLockAsync$1(() => recordCapacityWait({
539
543
  platform: device.platform,
540
544
  ms,
541
545
  max,
542
546
  workspace,
543
547
  ...reclaimed ? { reclaimed } : {}
544
- }, now());
548
+ }, at)).catch(() => {});
545
549
  onWait(ms);
546
550
  }
547
551
  }
@@ -1,21 +1,21 @@
1
- import { t as getExecutor } from "./exec-DEoAhcze.mjs";
1
+ import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
2
  import { n as ensureWorkspaceStorage } from "./paths-DQtTgsBf.mjs";
3
- import { O as withConfigLockAsync$1, _ as loadConfig$1, c as ensureConfig } from "./config-DlrsduwG.mjs";
4
- import { d as writeWorkspaceState } from "./workspace-state-U08dEzhG.mjs";
5
- import { i as macosProcess, o as requiredMacosRecord } from "./state-08I3hw3_.mjs";
3
+ import { O as withConfigLockAsync$1, _ as loadConfig$1, c as ensureConfig } from "./config-BZhXY15H.mjs";
4
+ import { d as writeWorkspaceState } from "./workspace-state-CeBpIZgr.mjs";
5
+ import { i as macosProcess, o as requiredMacosRecord } from "./state-BfAltYJP.mjs";
6
+ import { A as listAdbDevices, D as getAvdNameForSerial, F as listAvdsAsync, I as listInstalledSystemImages, K as ownedAvdSystemImage, M as listAvdDeviceProfiles, O as getAvdNameForSerialAsync, U as ownedAvdName, X as pickDefaultSystemImage, a as androidDeviceAbi, ct as waitForBoot, d as androidToolPath, f as assertOwnedAvdStopped, g as avdPathExists, k as hostSystemImageArch, nt as resolveOwnedAvdSerialAsync, t as DEFAULT_AVD_DEVICE_PROFILE, tt as resetAdoptedAvd, v as avdStorageRoots, x as createOwnedAvd, y as bootAndroidEmulator } from "./android-882m4hxX.mjs";
7
+ import { n as forgetCreatedDeviceAsync } from "./created-devices-D2Aca-xu.mjs";
8
+ import { a as parsePidof, i as parseLogcatLine, t as androidClockOffset } from "./android-CX5IcRuf.mjs";
6
9
  import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
7
- import { Cn as launchAndroidApp, Dn as reverseMetroPorts, On as writeDebugHttpHost, Sn as iosAppProcess, Tn as launchIosApp, dn as androidAppProcess, wn as launchAndroidReleaseApp, xn as installIosApp, yn as installAndroidApp } from "./budget-3ivAK99e.mjs";
8
- import { D as teardownOwnedAvd, k as teardownOwnedIosSim } from "./workspaces-e41xsjKr.mjs";
9
- import { t as forgetCreatedDevice } from "./created-devices-x9rN6bhs.mjs";
10
- import { $ as resetAdoptedAvd, A as listAdbDevices, D as getAvdNameForSerial, F as listAvdsAsync, I as listInstalledSystemImages, K as ownedAvdSystemImage, M as listAvdDeviceProfiles, O as getAvdNameForSerialAsync, U as ownedAvdName, X as pickDefaultSystemImage, a as androidDeviceAbi, d as androidToolPath, et as resolveOwnedAvdSerialAsync, f as assertOwnedAvdStopped, g as avdPathExists, k as hostSystemImageArch, ot as waitForBoot, t as DEFAULT_AVD_DEVICE_PROFILE, v as avdStorageRoots, x as createOwnedAvd, y as bootAndroidEmulator } from "./android-C7sVmyI9.mjs";
11
- import { C as resetIosKeychain, P as readHostMemoryPressure, T as resolveIosCreation, a as createOwnedIosSim, d as listAllIosSims, g as listUserApps, k as uninstallIosApp, n as bootIosSim, w as resetIosPrivacy } from "./ios-hcBpnEGk.mjs";
12
- import { r as stopMacosAppHeld } from "./stop-CR5689oB.mjs";
10
+ import { An as writeDebugHttpHost, Cn as installIosApp, Dn as launchIosApp, En as launchAndroidReleaseApp, Tn as launchAndroidApp, kn as reverseMetroPorts, pn as androidAppProcess, wn as iosAppProcess, xn as installAndroidApp } from "./budget-dPGuhNai.mjs";
11
+ import { A as teardownOwnedIosSim, O as teardownOwnedAvd } from "./workspaces-CSV2Orf4.mjs";
12
+ import { C as resetIosKeychain, F as readHostMemoryPressure, T as resolveIosCreation, a as createOwnedIosSim, d as listAllIosSims, g as listUserApps, k as uninstallIosApp, n as bootIosSim, w as resetIosPrivacy } from "./ios-CVUFFZ6C.mjs";
13
+ import { r as stopMacosAppHeld } from "./stop-DhclRwOO.mjs";
13
14
  import { t as spawnEntry } from "./spawn-entry-jw19m8Nl.mjs";
14
- import { i as countLiveOwnedDevices } from "./device-capacity-DH0QsZYZ.mjs";
15
- import { n as parseLogcatLine, r as parsePidof, t as androidClockOffset } from "./android-DR5lZ2Az.mjs";
16
- import { _ as findAapt } from "./support-CbXPbUMJ.mjs";
17
- import { t as waitForMacosRegistration } from "./registration-BcRgF6Ox.mjs";
18
- import { n as parseLogStreamLine } from "./ios-xtlRHaeB.mjs";
15
+ import { i as countLiveOwnedDevices } from "./device-capacity-Ic-kdmEV.mjs";
16
+ import { _ as findAapt } from "./support-B3tzVhKn.mjs";
17
+ import { t as waitForMacosRegistration } from "./registration-CN6nlhcD.mjs";
18
+ import { n as parseLogStreamLine } from "./ios-ENC4sRPA.mjs";
19
19
  import { createHash, randomUUID } from "node:crypto";
20
20
  import { chmodSync, closeSync, copyFileSync, createReadStream, existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statfsSync, symlinkSync, writeFileSync } from "node:fs";
21
21
  import { availableParallelism, freemem, homedir, loadavg } from "node:os";
@@ -652,7 +652,7 @@ async function runHostedDevice(mode, selectors, app) {
652
652
  if (outcome.status !== "torn-down" && outcome.status !== "missing") throw new Error(outcome.reason ?? "Hosted simulator teardown was not established.");
653
653
  const after = inventory().find((sim) => sim.udid === device.udid);
654
654
  if (after) throw new Error(`Hosted simulator ${device.udid} is still listed (${after.state}); deletion could not be verified. If its runtime is unavailable, delete it with xcrun simctl delete and stop the session again.`);
655
- forgetCreatedDevice("ios", device.udid);
655
+ await forgetCreatedDeviceAsync("ios", device.udid);
656
656
  removeHostedAppData(home);
657
657
  return {
658
658
  state: "stopped",
@@ -851,7 +851,7 @@ async function runHostedAndroidDevice(mode, request, app) {
851
851
  const name = device.avdName;
852
852
  if ((await listAvdsAsync({ timeoutMs: 5e3 })).includes(name) || avdStorageRoots().some((root) => avdPathExists(join(root, `${name}.ini`)) || avdPathExists(join(root, `${name}.avd`)))) throw new Error("The hosted AVD or its data still exists; deletion could not be verified.");
853
853
  if (await getAvdNameForSerialAsync(device.serial) === device.avdName) throw new Error("The hosted Android emulator is still running.");
854
- if (ledger === "listed") forgetCreatedDevice("android", device.avdName);
854
+ if (ledger === "listed") await forgetCreatedDeviceAsync("android", device.avdName);
855
855
  removeHostedAppData(home);
856
856
  return {
857
857
  state: "stopped",
@@ -1,13 +1,12 @@
1
- import { i as withWorkspaceProcessLock, n as isTimeoutError, t as getExecutor, x as ownership_claim_exports } from "./exec-DEoAhcze.mjs";
1
+ import { D as ownership_claim_exports, o as cancellableSleep, t as getExecutor, u as withWorkspaceProcessLock } from "./exec-VFRpu1iA.mjs";
2
2
  import { f as workspaceId$1 } from "./paths-DQtTgsBf.mjs";
3
- import { C as saveConfig, D as withConfigLock$1, G as projectDeviceSlots, H as deviceSlotPlatforms, O as withConfigLockAsync$1, _ as loadConfig$1, a as clearDevice, d as getConfigDir, w as setDevice } from "./config-DlrsduwG.mjs";
4
- import { l as phaseLine } from "./command-output-YKGWivpG.mjs";
5
- import { u as cancellableSleep } from "./operation-exec-BW0em61G.mjs";
6
- import { T as iosSimSlimProfileSetting } from "./settings-C7O8A6ZI.mjs";
7
- import { j as teardownParkedIosSim } from "./workspaces-e41xsjKr.mjs";
8
- import { _t as parkedMaxSetting, bt as selectParked, ft as adoptParked, pt as dropParked, vt as readParked } from "./android-C7sVmyI9.mjs";
9
- import { A as configuredIosSimulatorViewer, C as resetIosKeychain, E as resolveOwnedIosSim, M as hostMemoryPressureAdvice, N as memoryCulpritsUnder, P as readHostMemoryPressure, S as renameIosSim, T as resolveIosCreation, _ as ownedSimName, a as createOwnedIosSim, d as listAllIosSims, f as listAllIosSimsAsync, h as listIosRuntimesAsync, n as bootIosSim, p as listIosDeviceTypesAsync, u as iosSimulatorFailureAdvice, w as resetIosPrivacy, y as parseRuntimeVersion } from "./ios-hcBpnEGk.mjs";
10
- import { l as runtimeMismatch, m as withDeviceBootAdmission, n as DeviceAdmissionRefusal, o as deviceTypeMismatch } from "./device-capacity-DH0QsZYZ.mjs";
3
+ import { C as saveConfig, G as projectDeviceSlots, H as deviceSlotPlatforms, O as withConfigLockAsync$1, _ as loadConfig$1, a as clearDevice, d as getConfigDir, w as setDevice } from "./config-BZhXY15H.mjs";
4
+ import { l as phaseLine } from "./command-output-DxC0k2rk.mjs";
5
+ import { T as iosSimSlimProfileSetting } from "./settings-RKwY33wv.mjs";
6
+ import { mt as dropParked, pt as adoptParked, vt as parkedMaxSetting, xt as selectParked, yt as readParked } from "./android-882m4hxX.mjs";
7
+ import { M as teardownParkedIosSim } from "./workspaces-CSV2Orf4.mjs";
8
+ import { A as configuredIosSimulatorViewer, C as resetIosKeychain, E as resolveOwnedIosSim, F as readHostMemoryPressure, L as reportMemoryCulprits, M as hostMemoryPressureAdvice, S as renameIosSim, T as resolveIosCreation, _ as ownedSimName, a as createOwnedIosSim, d as listAllIosSims, f as listAllIosSimsAsync, h as listIosRuntimesAsync, n as bootIosSim, p as listIosDeviceTypesAsync, u as iosSimulatorFailureAdvice, w as resetIosPrivacy, y as parseRuntimeVersion } from "./ios-CVUFFZ6C.mjs";
9
+ import { l as runtimeMismatch, m as withDeviceBootAdmission, n as DeviceAdmissionRefusal, o as deviceTypeMismatch } from "./device-capacity-Ic-kdmEV.mjs";
11
10
  import { ambientContext } from "@stim-cli/core";
12
11
  import { isJsonObject } from "@stim-cli/core/state";
13
12
  import chalk from "chalk";
@@ -18,13 +17,12 @@ function startIosBoot(udid, configure, label, out, simulatorApp, root, deviceSlo
18
17
  key: udid
19
18
  }, async () => {
20
19
  out(chalk.dim(phaseLine("device", `booting ${label} (${udid})`)));
21
- await bootIosSim(udid, {
20
+ await muteBootedSimulator(udid, await bootIosSim(udid, {
22
21
  label,
23
22
  out,
24
23
  simulatorApp,
25
24
  env: ambientContext()?.env
26
- });
27
- await muteBootedSimulator(udid, out);
25
+ }), out);
28
26
  await configure();
29
27
  }, {
30
28
  ...deviceSlotWait,
@@ -37,36 +35,9 @@ function startIosBoot(udid, configure, label, out, simulatorApp, root, deviceSlo
37
35
  done
38
36
  };
39
37
  }
40
- const SPRINGBOARD_STARTUP_TIMEOUT_MS = 3e4;
41
- const SPRINGBOARD_STARTUP_POLL_MS = 250;
42
- async function waitForSpringBoard(udid) {
43
- const deadline = Date.now() + SPRINGBOARD_STARTUP_TIMEOUT_MS;
44
- for (;;) {
45
- let output = null;
46
- try {
47
- output = await getExecutor().runFileAsync("xcrun", [
48
- "simctl",
49
- "spawn",
50
- udid,
51
- "notifyutil",
52
- "-g",
53
- "com.apple.springboard.finishedstartup"
54
- ], { timeoutMs: 1e4 });
55
- } catch (error) {
56
- if (!isTimeoutError(error)) throw error;
57
- }
58
- if (output !== null) {
59
- const state = /^com\.apple\.springboard\.finishedstartup (\d+)$/m.exec(output);
60
- if (!state) throw new Error(`Could not read SpringBoard's startup state: ${output.trim() || "no output"}.`);
61
- if (Number(state[1]) > 0) return;
62
- }
63
- if (Date.now() >= deadline) throw new Error(`SpringBoard did not finish starting within ${SPRINGBOARD_STARTUP_TIMEOUT_MS / 1e3}s.`);
64
- await cancellableSleep(SPRINGBOARD_STARTUP_POLL_MS);
65
- }
66
- }
67
- async function muteBootedSimulator(udid, out) {
38
+ async function muteBootedSimulator(udid, { springBoardUnreadable }, out) {
68
39
  try {
69
- await waitForSpringBoard(udid);
40
+ if (springBoardUnreadable) throw new Error(springBoardUnreadable);
70
41
  const response = JSON.parse(await getExecutor().runFileAsync("xcrun", [
71
42
  "devicectl",
72
43
  "device",
@@ -90,8 +61,9 @@ var IosDeviceMismatchError = class extends Error {
90
61
  };
91
62
  async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, label, settings, flags, note, out, reconcileIosSimulator, simSnapshot }) {
92
63
  const pressure = readHostMemoryPressure();
93
- const memoryAdvice = hostMemoryPressureAdvice(pressure, memoryCulpritsUnder(pressure));
64
+ const memoryAdvice = hostMemoryPressureAdvice(pressure);
94
65
  if (memoryAdvice) out(chalk.yellow(phaseLine("memory", memoryAdvice)));
66
+ reportMemoryCulprits(pressure, (named) => out(chalk.yellow(phaseLine("memory", named))));
95
67
  const simslimProfile = iosSimSlimProfileSetting(settings, settingsRoot);
96
68
  if (record?.deviceUdid) {
97
69
  if (record.owned) {
@@ -200,11 +172,11 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
200
172
  runtime: choice.runtime
201
173
  }, projectPath, void 0, await listAllIosSimsAsync({ includeUnavailable: true }));
202
174
  const result = await createOwnedIosSim(label, { suffix }, choice);
203
- setDevice(projectPath, "ios", {
175
+ await withConfigLockAsync$1(() => setDevice(projectPath, "ios", {
204
176
  deviceUdid: result.udid,
205
177
  owned: true,
206
178
  deviceName: result.name
207
- }, slot);
179
+ }, slot));
208
180
  return result;
209
181
  });
210
182
  const newRecord = {
@@ -293,7 +265,7 @@ async function takeParkedIosSim({ projectPath, slot, label, choice, out }) {
293
265
  ...parked.simslimManaged ? { simslimManaged: true } : {},
294
266
  ...parked.cacheKey ? { parkedCacheKey: parked.cacheKey } : {}
295
267
  };
296
- const adopted = adoptParked({
268
+ const adopted = await adoptParked({
297
269
  platform: "ios",
298
270
  projectPath,
299
271
  slot,
@@ -312,7 +284,7 @@ async function takeParkedIosSim({ projectPath, slot, label, choice, out }) {
312
284
  return null;
313
285
  }
314
286
  function clearIosAdoptionPending(projectPath, slot = "default") {
315
- withConfigLock$1(() => {
287
+ return withConfigLockAsync$1(() => {
316
288
  const cfg = loadConfig$1();
317
289
  const ios = deviceSlotPlatforms(cfg?.projects?.[projectPath], slot)?.ios;
318
290
  if (!cfg || !ios?.adoptionPending) return;
@@ -331,7 +303,7 @@ async function configureOwnedIosSim({ record, projectPath, slot, profile, out, r
331
303
  ...record,
332
304
  simslimManaged: true
333
305
  };
334
- setDevice(projectPath, "ios", pending, slot);
306
+ await withConfigLockAsync$1(() => setDevice(projectPath, "ios", pending, slot));
335
307
  record = pending;
336
308
  }
337
309
  const result = await reconcileIosSimulator({
@@ -344,7 +316,7 @@ async function configureOwnedIosSim({ record, projectPath, slot, profile, out, r
344
316
  const updated = { ...record };
345
317
  if (result.managed) updated.simslimManaged = true;
346
318
  else delete updated.simslimManaged;
347
- setDevice(projectPath, "ios", updated, slot);
319
+ await withConfigLockAsync$1(() => setDevice(projectPath, "ios", updated, slot));
348
320
  return updated;
349
321
  }
350
322
  async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorApp, timeoutMs, pollMs, out }) {
@@ -369,7 +341,7 @@ async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorA
369
341
  } catch (error) {
370
342
  return {
371
343
  failed: true,
372
- reason: `Simulator ${udid} failed its process-spawn readiness check: ${error?.message || error}. ${iosSimulatorFailureAdvice()}`
344
+ reason: `Simulator ${udid} failed its process-spawn readiness check: ${error?.message || error}. ${await iosSimulatorFailureAdvice()}`
373
345
  };
374
346
  }
375
347
  };
@@ -417,14 +389,13 @@ async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorA
417
389
  key: udid
418
390
  }, async () => {
419
391
  out(chalk.dim(phaseLine("device", `booting ${sim.name} (${udid})`)));
420
- await bootIosSim(udid, {
392
+ await muteBootedSimulator(udid, await bootIosSim(udid, {
421
393
  timeoutMs,
422
394
  label: sim.name,
423
395
  out,
424
396
  simulatorApp,
425
397
  env: ambientContext()?.env
426
- });
427
- await muteBootedSimulator(udid, out);
398
+ }), out);
428
399
  }, {
429
400
  ...deviceSlotWait,
430
401
  root: projectPath,
@@ -1,8 +1,8 @@
1
- import { m as operationState } from "./exec-DEoAhcze.mjs";
2
- import { V as deviceSlotKey } from "./config-DlrsduwG.mjs";
3
- import { a as formatElapsed, r as clockTime } from "./command-output-YKGWivpG.mjs";
4
- import { Zt as VERIFY_TIMEOUT_MS, on as APP_READINESS_TIMEOUT_MS } from "./budget-3ivAK99e.mjs";
5
- import { E as releaseRunLease, S as parseLease, T as raiseLease, b as leaseIsExpired, j as takeLease, v as deviceLeasePath, y as fileLeaseIo } from "./activity-BpWUPgUm.mjs";
1
+ import { b as operationState } from "./exec-VFRpu1iA.mjs";
2
+ import { V as deviceSlotKey } from "./config-BZhXY15H.mjs";
3
+ import { a as formatElapsed, r as clockTime } from "./command-output-DxC0k2rk.mjs";
4
+ import { $t as VERIFY_TIMEOUT_MS, cn as APP_READINESS_TIMEOUT_MS } from "./budget-dPGuhNai.mjs";
5
+ import { E as releaseRunLease, S as parseLease, T as raiseLease, b as leaseIsExpired, j as takeLease, v as deviceLeasePath, y as fileLeaseIo } from "./activity-Dq3ZcdD8.mjs";
6
6
  //#region src/engine/device-lease-run.ts
7
7
  const LEASE_STEP_FLOOR_MS = 6e4;
8
8
  const DEBUG_VERIFY_STEP_MS = VERIFY_TIMEOUT_MS + APP_READINESS_TIMEOUT_MS;
@@ -1,6 +1,6 @@
1
- import { V as deviceSlotKey } from "./config-DlrsduwG.mjs";
2
- import { A as selectPoolDevice, S as parseLease, b as leaseIsExpired, v as deviceLeasePath, y as fileLeaseIo } from "./activity-BpWUPgUm.mjs";
3
- import { i as DEVICE_WAIT_POLL_MS, n as DEVICE_BUSY, o as leaseExpiryText } from "./device-lease-run-DXPSwdbb.mjs";
1
+ import { V as deviceSlotKey } from "./config-BZhXY15H.mjs";
2
+ import { A as selectPoolDevice, S as parseLease, b as leaseIsExpired, v as deviceLeasePath, y as fileLeaseIo } from "./activity-Dq3ZcdD8.mjs";
3
+ import { i as DEVICE_WAIT_POLL_MS, n as DEVICE_BUSY, o as leaseExpiryText } from "./device-lease-run-DUtkbqBQ.mjs";
4
4
  //#region src/engine/device-pool.ts
5
5
  function heldPoolId(root, platform, now, io = fileLeaseIo, slot = "default") {
6
6
  const record = io.readHolder(root)[deviceSlotKey(platform, slot)];
@@ -1,2 +1,2 @@
1
- import { a as readDoctorReport, i as parseDoctorPlatform, n as doctorCommand, o as shadowedStimFinding, r as doctorSuccessLines, s as toolchainReport, t as applySandboxFix } from "./doctor-C6t4Maue.mjs";
1
+ import { a as readDoctorReport, i as parseDoctorPlatform, n as doctorCommand, o as shadowedStimFinding, r as doctorSuccessLines, s as toolchainReport, t as applySandboxFix } from "./doctor-DZgpqR6J.mjs";
2
2
  export { applySandboxFix, doctorCommand as default, doctorSuccessLines, parseDoctorPlatform, readDoctorReport, shadowedStimFinding, toolchainReport };