stim 1.24.0 → 1.26.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 (162) hide show
  1. package/README.md +1 -1
  2. package/dist/{acquire-artifact-CEs02U2o.mjs → acquire-artifact-DVsvSwf7.mjs} +1 -1
  3. package/dist/{act-Cyvm8xYc.mjs → act-C-BqJEpu.mjs} +158 -36
  4. package/dist/{activity-Dq3ZcdD8.mjs → activity-Lnb_EoRY.mjs} +4 -5
  5. package/dist/{agent-device-usage-output-CccomeE0.mjs → agent-device-usage-output-DbXy5tg8.mjs} +4 -4
  6. package/dist/{android-CX5IcRuf.mjs → android-B5P81yI-.mjs} +1 -1
  7. package/dist/{android-DcztblCT.mjs → android-CSbLRD53.mjs} +5 -5
  8. package/dist/{android-BZppyPe_.mjs → android-CiNQw3kq.mjs} +81 -52
  9. package/dist/{android-882m4hxX.mjs → android-DTAcRwBC.mjs} +81 -34
  10. package/dist/{android-cas-BtCOrNqb.mjs → android-cas-BTVhZ0Qs.mjs} +4 -4
  11. package/dist/{android-project-DVWyCbWU.d.mts → android-project-DUGMbq28.d.mts} +61 -3
  12. package/dist/api.d.mts +8 -5
  13. package/dist/api.mjs +27 -27
  14. package/dist/apk-signed-tail-B46U9hXc.mjs +142 -0
  15. package/dist/{artifact-BR5VNArK.mjs → artifact-BxREhAaV.mjs} +25 -19
  16. package/dist/{artifact-Bdt_n9Jc.mjs → artifact-CsAP6AGK.mjs} +36 -21
  17. package/dist/{attempt-DW-mQqM7.mjs → attempt-ClyJlZPT.mjs} +4 -2
  18. package/dist/{browser-web-ycg9qWB8.mjs → browser-web-rYPyqhTf.mjs} +11 -12
  19. package/dist/{budget-dPGuhNai.mjs → budget-k2mZGvvk.mjs} +242 -38
  20. package/dist/{build-CaF574eS.mjs → build-DPhApsjV.mjs} +28 -24
  21. package/dist/{build-cache-HFUQ9eLz.mjs → build-cache-DrXNCy3T.mjs} +123 -23
  22. package/dist/{build-plan-JsDUq4w1.mjs → build-plan-DrMMdayj.mjs} +5 -5
  23. package/dist/{cache-manifest-BPXRONJz.mjs → cache-manifest-BEZ9Bpl1.mjs} +1 -1
  24. package/dist/cache-manifest.mjs +1 -1
  25. package/dist/{ccache-CCn1S6qG.mjs → ccache-Bx5TbxwG.mjs} +6 -6
  26. package/dist/{cli-xqAidP7O.mjs → cli-BBKFGOFl.mjs} +19 -19
  27. package/dist/cli.mjs +1 -1
  28. package/dist/{client-18-ZowoT.mjs → client-D9CaRks-.mjs} +55 -71
  29. package/dist/collector-run.mjs +4 -4
  30. package/dist/{command-output-DxC0k2rk.mjs → command-output-BF5AR2dL.mjs} +1 -1
  31. package/dist/{config-BZhXY15H.mjs → config-BktkY_zC.mjs} +321 -15
  32. package/dist/{launch-BVlyQw3T.mjs → dependencies-Dw6wfQdv.mjs} +259 -256
  33. package/dist/{dependency-state-C56ll9hY.mjs → dependency-state-DFB41vfr.mjs} +1 -1
  34. package/dist/{dev-client-w_fok0Ek.mjs → dev-client-DXR_tPVY.mjs} +2 -2
  35. package/dist/{device-BktRGdjS.mjs → device-BK-zwyd_.mjs} +64 -33
  36. package/dist/{device-4RUugw5X.mjs → device-BcYeHSFu.mjs} +14 -14
  37. package/dist/{device-capacity-Ic-kdmEV.mjs → device-capacity-DCSvUF0l.mjs} +10 -17
  38. package/dist/device-host-worker.mjs +11 -13
  39. package/dist/{device-ios-DzpSlZyd.mjs → device-ios-BLGfXQeK.mjs} +68 -25
  40. package/dist/{device-lease-run-DUtkbqBQ.mjs → device-lease-run-BmvIl7bI.mjs} +5 -5
  41. package/dist/{device-pool-CgBHk401.mjs → device-pool-Dluix4H3.mjs} +3 -3
  42. package/dist/{doctor-DZgpqR6J.mjs → doctor-Bhg1ii70.mjs} +14 -14
  43. package/dist/{doctor-BZ6oxNum.mjs → doctor-Cp-BhzTS.mjs} +1 -1
  44. package/dist/{doctor-C33AzVfR.mjs → doctor-OnwP94ne.mjs} +81 -26
  45. package/dist/{doctor-fingerprint-zlujA1Gs.mjs → doctor-fingerprint-D3a04Mhu.mjs} +8 -2
  46. package/dist/doctor-fingerprint.mjs +1 -1
  47. package/dist/{doctor-watchman-B453A231.mjs → doctor-watchman-BStK05nt.mjs} +4 -4
  48. package/dist/{eas-build-CxKUNHsb.mjs → eas-build-Dsj93iM9.mjs} +2 -2
  49. package/dist/{eas-fallback-LMxk9Kw0.mjs → eas-fallback-FwkeqqGi.mjs} +13 -12
  50. package/dist/{eas-session-ledger-Ck6YXPAO.mjs → eas-session-ledger-B5vygTiD.mjs} +5 -5
  51. package/dist/{error-diagnostics-BkKCZq4P.mjs → error-diagnostics-BOOm9Db7.mjs} +8 -8
  52. package/dist/{errors-ccaPc4ox.mjs → errors-DHm_U5gv.mjs} +2 -1
  53. package/dist/{gc-DDWEAj0w.mjs → gc-C_79zvz4.mjs} +2 -2
  54. package/dist/{gc-yVKpAOKM.mjs → gc-ldgr-hXU.mjs} +74 -43
  55. package/dist/{guide-Bggftwc5.mjs → guide-D7K0X6KG.mjs} +374 -78
  56. package/dist/{hosted-android-D4dweBof.mjs → hosted-android-Bk54ej6n.mjs} +3 -3
  57. package/dist/{hosted-client-BBTVe3X6.mjs → hosted-client-fHO8yqzc.mjs} +5 -5
  58. package/dist/{hosted-ios-Sn0djzg8.mjs → hosted-ios-D55QhYaD.mjs} +1 -1
  59. package/dist/{hosted-logs-CYIZ5ubJ.mjs → hosted-logs-BfbmDM4M.mjs} +17 -11
  60. package/dist/hosted-logs-sync-B0pvmOk-.mjs +195 -0
  61. package/dist/{hosted-macos-CXjsUNBR.mjs → hosted-macos-CPl0OZ9h.mjs} +5 -5
  62. package/dist/{hosted-native-Doxbfzem.mjs → hosted-native-CpDB3-PO.mjs} +6 -7
  63. package/dist/{idle-shutdown-BInjLKqm.mjs → idle-shutdown-FfxL1KdG.mjs} +22 -9
  64. package/dist/{ios-BItP6lkn.mjs → ios-B7-lToDu.mjs} +8 -8
  65. package/dist/{ios-CVUFFZ6C.mjs → ios-WxpDJ5T1.mjs} +129 -14
  66. package/dist/{ios-device-BI38NFFH.mjs → ios-device-CsyryvpT.mjs} +1 -1
  67. package/dist/{ios-B1FXRCMX.mjs → ios-ftxdQbJS.mjs} +84 -51
  68. package/dist/{ios-project-KYqeJURj.mjs → ios-project-Ty5pHl9O.mjs} +6 -6
  69. package/dist/{ios-state-DlElquYD.mjs → ios-state-Cw7-WQf2.mjs} +1 -1
  70. package/dist/{js-swap-BvrQvXHY.mjs → js-swap-BMhXYVDS.mjs} +4 -4
  71. package/dist/{launch-SfzGH_s9.mjs → launch-DOp8RjDz.mjs} +32 -27
  72. package/dist/{logs-DXE32kyb.mjs → logs-dQDki6Tt.mjs} +9 -173
  73. package/dist/{logs-ovlU7m7N.mjs → logs-s1dRIG1E.mjs} +85 -36
  74. package/dist/{macos-B3BveDrU.mjs → macos-B0VEV3Gf.mjs} +1 -1
  75. package/dist/{macos-CCfhb-jT.mjs → macos-DBBPNnIA.mjs} +18 -19
  76. package/dist/macos-run.mjs +1 -1
  77. package/dist/maintenance-run.mjs +28 -11
  78. package/dist/{metro-Bu8LBfzS.mjs → metro-CjC10t6E.mjs} +2 -2
  79. package/dist/{metro-gateway-DtsOy-0P.mjs → metro-gateway-B6_PgD0L.mjs} +2 -3
  80. package/dist/{named-ports-BWDuU5oQ.mjs → named-ports-BG0j1X4g.mjs} +2 -2
  81. package/dist/{native-android-96BBizbq.mjs → native-android-CL2NGiik.mjs} +17 -17
  82. package/dist/{native-gradle-artifact-inputs-BcLYBZil.mjs → native-gradle-artifact-inputs-btSUulme.mjs} +3 -3
  83. package/dist/{native-run-BmH7U8pr.mjs → native-run-BfIDFKLH.mjs} +2 -3
  84. package/dist/{native-runtime-DgtJkzIa.mjs → native-runtime-Dq3RBcON.mjs} +6 -7
  85. package/dist/{native-xcode-inputs-irplbQb0.mjs → native-xcode-inputs-BW7H8JGu.mjs} +2 -2
  86. package/dist/{native-xcode-ios-BY-6hh6M.mjs → native-xcode-ios-CBXJAxfC.mjs} +18 -18
  87. package/dist/offload-worker.d.mts +7 -2
  88. package/dist/offload-worker.mjs +34 -23
  89. package/dist/{ownership-DxlZGDcV.mjs → ownership-BjYvMNX_.mjs} +2 -2
  90. package/dist/{phone-reverses-BdsdesVF.mjs → phone-reverses-lmj6kcPm.mjs} +3 -3
  91. package/dist/{placement-log-DUvqqsB-.mjs → placement-log-DIFPQAXp.mjs} +1 -1
  92. package/dist/{plan-placement-4axc0Hs7.mjs → plan-placement-IiiSQhtz.mjs} +3 -3
  93. package/dist/{ports-D-E_OiAO.mjs → ports-C2_w1Z0Z.mjs} +3 -3
  94. package/dist/prebuild-gmouvmJZ.mjs +1247 -0
  95. package/dist/{project-Dz-hWkb-.mjs → project-BUu6Is4k.mjs} +15 -16
  96. package/dist/{react-native-android-DOinxgwB.mjs → react-native-android-Cgg99REN.mjs} +48 -33
  97. package/dist/{react-native-build-AuCu-aAP.mjs → react-native-build-oNwqF5Wb.mjs} +8 -8
  98. package/dist/{react-native-doctor-2ivJUmwZ.mjs → react-native-doctor-BhA3KUte.mjs} +49 -8
  99. package/dist/{react-native-ios-D5zTIuH8.mjs → react-native-ios-B-nf4rjN.mjs} +40 -25
  100. package/dist/{recordings-CdPwYwvs.mjs → recordings-BldzVKq0.mjs} +1 -1
  101. package/dist/{reload-Ck9RJeSq.mjs → reload-C9OduiNc.mjs} +1 -1
  102. package/dist/{reload-C1TTVesC.mjs → reload-CCR7KC_l.mjs} +14 -14
  103. package/dist/{remote-DEZ7AOVq.mjs → remote-C8S7FlPF.mjs} +16 -7
  104. package/dist/{result-DqBrb12U.mjs → result-7F5hEwQJ.mjs} +17 -17
  105. package/dist/{run-BIwoU44q.mjs → run-BqB0v3pt.mjs} +1 -1
  106. package/dist/{selection-BLtvaqxc.mjs → selection-BNPBZ6T5.mjs} +157 -44
  107. package/dist/{server-bare-Z1ToVLPn.mjs → server-bare-A75rDIdD.mjs} +55 -3
  108. package/dist/{server-command-C0pmjNdG.mjs → server-command-CssKFOD7.mjs} +4 -4
  109. package/dist/{server-expo-Tt_hLRpy.mjs → server-expo-eQfOdydb.mjs} +8 -6
  110. package/dist/server-expo-wvcj5tiZ.mjs +2 -0
  111. package/dist/{settings-RKwY33wv.mjs → settings-CosW5X-S.mjs} +59 -61
  112. package/dist/{settings-kkt0vP4w.mjs → settings-OaGQF-ri.mjs} +1 -1
  113. package/dist/{settings-write--gj6MACV.mjs → settings-write-QjYfSrjF.mjs} +5 -5
  114. package/dist/settings.schema.json +71 -6
  115. package/dist/{simslim-CdWKT3vA.mjs → simslim-Bax1qcxu.mjs} +22 -6
  116. package/dist/{slot-launch-A1BgotaM.mjs → slot-launch-CYCEhfBY.mjs} +6 -6
  117. package/dist/{stage-ERTMh88n.mjs → stage-jKQ7CP_B.mjs} +1 -1
  118. package/dist/{start-Bmg_qmHi.mjs → start-C_wefNKB.mjs} +1 -1
  119. package/dist/{start-BKGrEhzG.mjs → start-_BdJ32cZ.mjs} +9 -10
  120. package/dist/{state-B1ig0Kqy.mjs → state-C1i2nMOP.mjs} +2 -3
  121. package/dist/{state-BfAltYJP.mjs → state-C4OdpOTF.mjs} +1 -2
  122. package/dist/{stats-B-ckuiUg.mjs → stats-tEpEEH-u.mjs} +4 -4
  123. package/dist/{status-Pw-807f0.mjs → status-B9M7x4CZ.mjs} +1 -1
  124. package/dist/{status-Fect2w9R.mjs → status-CRXz-Gtj.mjs} +1 -1
  125. package/dist/{status-DfFp6a76.mjs → status-DQrqodLj.mjs} +22 -23
  126. package/dist/{status-watch-XC7F-AMf.mjs → status-watch-B5wDIH_o.mjs} +4 -4
  127. package/dist/status-worker.mjs +1 -1
  128. package/dist/{stim-desktop-DS0mzR8U.mjs → stim-desktop-6Dqp-gjX.mjs} +1 -1
  129. package/dist/{stop-BFu7X_Do.mjs → stop-CmdNhGlC.mjs} +2 -2
  130. package/dist/{stop-CL1kDHds.mjs → stop-DRqQVqDJ.mjs} +74 -53
  131. package/dist/{stop-DhclRwOO.mjs → stop-ySNQHXMG.mjs} +4 -5
  132. package/dist/supervisor-run.d.mts +1 -0
  133. package/dist/supervisor-run.mjs +15 -16
  134. package/dist/{support-B3tzVhKn.mjs → support-BGSCBoib.mjs} +4 -4
  135. package/dist/{support-B1W-hmC2.mjs → support-CVOCp0Ft.mjs} +15 -12
  136. package/dist/{swiftpm-artifact-inputs-BWYPj9Sn.mjs → swiftpm-artifact-inputs-CfUzt_0Z.mjs} +1 -1
  137. package/dist/{swiftpm-macos-BVCP5mO4.mjs → swiftpm-macos-x6HPpl_2.mjs} +10 -10
  138. package/dist/toolchain-DoavrvIA.mjs +2 -0
  139. package/dist/toolchain-J4J8MrAr.mjs +2107 -0
  140. package/dist/trigger-DzJu208Q.mjs +2 -0
  141. package/dist/{trigger-CBMe2YLH.mjs → trigger-KVaWWNyn.mjs} +1 -1
  142. package/dist/{warm-progress-ol0ZypEu.mjs → warm-progress-DvhTX_eu.mjs} +3 -4
  143. package/dist/web-BFLueSh-.mjs +2 -0
  144. package/dist/{web-BH7peScT.mjs → web-Bihbf7-u.mjs} +8 -9
  145. package/dist/web-run.mjs +4 -4
  146. package/dist/{workspace-state-CeBpIZgr.mjs → workspace-state-pUg3_RRA.mjs} +45 -7
  147. package/dist/{workspaces-CSV2Orf4.mjs → workspaces-g2lhdBXF.mjs} +17 -17
  148. package/dist/{worktree-Dw8kfacb.mjs → worktree-BKuklFh_.mjs} +34 -31
  149. package/dist/{worktree-DEDUzO_L.mjs → worktree-Bm4cb-nU.mjs} +1 -1
  150. package/package.json +8 -8
  151. package/shim/bundle-response.cjs +53 -1
  152. package/shim/bundle-response.d.cts +1 -1
  153. package/shim/expo-metro-config.cjs +23 -1
  154. package/dist/created-devices-D2Aca-xu.mjs +0 -52
  155. package/dist/paths-DQtTgsBf.mjs +0 -42
  156. package/dist/prebuild-DmVCf5xb.mjs +0 -501
  157. package/dist/server-expo-CEntXzRw.mjs +0 -2
  158. package/dist/toolchain-BjgKdoEf.mjs +0 -2
  159. package/dist/toolchain-D3bmRMia.mjs +0 -897
  160. package/dist/trigger-BLsHgAGR.mjs +0 -2
  161. package/dist/web-BdOFlTJr.mjs +0 -2
  162. package/dist/xcode-DHu41qQ4.mjs +0 -910
@@ -1,20 +1,24 @@
1
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";
2
+ import { D as withConfigLock$1, G as projectDeviceSlots, H as deviceSlotPlatforms, O as withConfigLockAsync$1, _ as loadConfig$1, a as clearDevice, b as releaseAndroidConsolePort, i as clearAndroidBootPending, j as acquireAvdClaim, t as allConsolePortsAndSerials, w as setDevice } from "./config-BktkY_zC.mjs";
3
+ import { l as phaseLine } from "./command-output-BF5AR2dL.mjs";
4
+ import { l as androidDataPartitionSizeGbSetting, o as androidAvdConfigSetting } from "./settings-CosW5X-S.mjs";
5
+ import { s as ownedDeviceLabel } from "./project-BUu6Is4k.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-DTAcRwBC.mjs";
7
+ import { c as pidExists } from "./metro-CjC10t6E.mjs";
8
+ import { O as teardownOwnedAvd, j as teardownParkedAvd } from "./workspaces-g2lhdBXF.mjs";
9
+ import { h as tailLines } from "./activity-Lnb_EoRY.mjs";
10
+ import { B as memoryCulpritAdvice, I as memoryCulpritsUnderAsync, L as readHostMemoryPressure, d as listAllIosSims, z as reportMemoryCulprits } from "./ios-WxpDJ5T1.mjs";
11
+ import { t as clearDeviceIdleShutdown } from "./idle-shutdown-FfxL1KdG.mjs";
12
+ import { i as countLiveOwnedDevices, m as withDeviceBootAdmission, n as DeviceAdmissionRefusal } from "./device-capacity-DCSvUF0l.mjs";
13
+ import { i as ensureOwnedIosDevice, r as ensureIosBooted } from "./device-ios-BLGfXQeK.mjs";
14
+ import { t as reconcileSimSlim } from "./simslim-Bax1qcxu.mjs";
14
15
  import { claimRemoveCommand, clearClaimChild, markClaimChildPending, processGroupAlive, releaseClaim, setClaimChild } from "@stim-cli/core/ownership-claim";
15
16
  import { randomUUID } from "node:crypto";
16
17
  import { existsSync } from "node:fs";
17
18
  import { isDeepStrictEqual } from "node:util";
19
+ import { dirname, join, resolve, sep } from "node:path";
20
+ import { rotatedLogPath } from "@stim-cli/core";
21
+ import { acceptsShape, settingDefinition } from "@stim-cli/core/state";
18
22
  import { fileURLToPath } from "node:url";
19
23
  import { captureProcessIdentity } from "@stim-cli/core/process-identity";
20
24
  import chalk from "chalk";
@@ -26,7 +30,7 @@ async function requestLocal(url, platform, prefetch) {
26
30
  const req = request(url, { headers: {
27
31
  accept: "application/json",
28
32
  "expo-platform": platform,
29
- ...prefetch ? { "x-stim-metro-warmup": "1" } : {}
33
+ "x-stim-metro-warmup": "1"
30
34
  } });
31
35
  const timer = setTimeout(() => req.destroy(), WARMUP_TIMEOUT_MS);
32
36
  timer.unref();
@@ -48,7 +52,33 @@ async function requestLocal(url, platform, prefetch) {
48
52
  req.end();
49
53
  });
50
54
  }
51
- async function warmMetro({ port, platform, isExpo, appId, bundleUrl }) {
55
+ const ENTRY_EXTENSIONS = [
56
+ "",
57
+ ".js",
58
+ ".jsx",
59
+ ".ts",
60
+ ".tsx"
61
+ ];
62
+ function entryExists(bundlePath, root) {
63
+ const entry = decodeURIComponent(bundlePath.replace(/\.bundle\/*$/, ""));
64
+ if (entry.startsWith("/.expo/")) return true;
65
+ for (let dir = resolve(root);; dir = dirname(dir)) {
66
+ const file = resolve(dir, `.${entry}`);
67
+ if (file.startsWith(dir + sep) && ENTRY_EXTENSIONS.some((ext) => existsSync(file + ext))) return true;
68
+ if (dirname(dir) === dir) return false;
69
+ }
70
+ }
71
+ function recordedBundleUrl(logsDir, root, platform) {
72
+ const setting = settingDefinition(`metro.warmupUrl.${platform}`);
73
+ if (!logsDir || !root || !setting) return null;
74
+ const log = join(logsDir, "metro.ndjson");
75
+ for (const file of [log, rotatedLogPath(log)]) for (const line of (tailLines(file) ?? []).toReversed()) try {
76
+ const record = JSON.parse(line);
77
+ if (record?.event === "bundle_response_started" && record.platform === platform && acceptsShape(setting, record.url) && entryExists(new URL(record.url, "http://localhost").pathname, root)) return record.url;
78
+ } catch {}
79
+ return null;
80
+ }
81
+ async function warmMetro({ port, platform, isExpo, appId, bundleUrl, logsDir, root }) {
52
82
  try {
53
83
  const origin = `http://127.0.0.1:${port}`;
54
84
  if (await requestLocal(new URL("/_stim/metro-warmup", origin), platform, false) !== "ready") return;
@@ -65,6 +95,7 @@ async function warmMetro({ port, platform, isExpo, appId, bundleUrl }) {
65
95
  sourcePaths: "url-server",
66
96
  ...appId ? { app: appId } : {}
67
97
  }).toString();
98
+ bundleUrl ||= recordedBundleUrl(logsDir, root, platform);
68
99
  if (!bundleUrl && isExpo) {
69
100
  const body = await requestLocal(new URL(origin), platform, false);
70
101
  if (body === null) return;
@@ -91,12 +122,12 @@ var AvdBootError = class extends Error {
91
122
  };
92
123
  var AvdRecoveryError = class extends AvdBootError {};
93
124
  function findOtherOwner(avdName, projectPath, selectedSlot = "default") {
94
- for (const [path, project] of Object.entries(loadConfig()?.projects ?? {})) if (projectDeviceSlots(project).some(({ slot, platforms }) => (path !== projectPath || slot !== selectedSlot) && platforms.android?.avdName?.toLowerCase() === avdName.toLowerCase())) return path;
125
+ for (const [path, project] of Object.entries(loadConfig$1()?.projects ?? {})) if (projectDeviceSlots(project).some(({ slot, platforms }) => (path !== projectPath || slot !== selectedSlot) && platforms.android?.avdName?.toLowerCase() === avdName.toLowerCase())) return path;
95
126
  return null;
96
127
  }
97
128
  async function prepareOwnedAvd({ projectPath, slot, label, previousAvdName, systemImage, deviceProfile, configuration, configure, teardown = teardownOwnedAvd }) {
98
- const { claim, reservation, previous, avdName } = await withConfigLockAsync(() => {
99
- const previous = deviceSlotPlatforms(loadConfig()?.projects?.[projectPath], slot)?.android;
129
+ const { claim, reservation, previous, avdName } = await withConfigLockAsync$1(() => {
130
+ const previous = deviceSlotPlatforms(loadConfig$1()?.projects?.[projectPath], slot)?.android;
100
131
  if (previous?.avdName && previous.avdName !== previousAvdName) throw new Error(`Another Stim run assigned AVD ${previous.avdName} to this workspace. Retry to use it.`);
101
132
  if (readParked("android").some((entry) => entry.name === ownedAvdName(label)) || findOtherOwner(ownedAvdName(label), projectPath, slot)) label = `${label}-${randomUUID().slice(0, 8)}`;
102
133
  const avdName = ownedAvdName(label);
@@ -121,7 +152,7 @@ async function prepareOwnedAvd({ projectPath, slot, label, previousAvdName, syst
121
152
  throw error;
122
153
  }
123
154
  });
124
- const currentRecord = () => deviceSlotPlatforms(loadConfig()?.projects?.[projectPath], slot)?.android;
155
+ const currentRecord = () => deviceSlotPlatforms(loadConfig$1()?.projects?.[projectPath], slot)?.android;
125
156
  const assertReservation = () => {
126
157
  if (readParked("android").some((entry) => entry.name === avdName)) throw new Error(`AVD ${avdName} was parked by another Stim run. Retry to adopt it safely.`);
127
158
  const owner = findOtherOwner(avdName, projectPath, slot);
@@ -168,7 +199,7 @@ async function prepareOwnedAvd({ projectPath, slot, label, previousAvdName, syst
168
199
  if (!message.includes("already exists")) throw error;
169
200
  try {
170
201
  if (!(await listAvdsAsync()).includes(avdName)) throw new AvdRecoveryError(`AVD ${avdName} already exists on disk but is not listed by the emulator. ${message}`, "Run `npx stim gc` to inspect orphaned owned AVDs, then `npx stim gc --delete` to reclaim those safe to delete. Retry `stim android` after cleanup; keep any AVD that GC cannot verify.", error);
171
- await withConfigLockAsync(assertReservation);
202
+ await withConfigLockAsync$1(assertReservation);
172
203
  const resolved = await resolveOwnedAvdSerialAsync(avdName);
173
204
  if (resolved.missing || resolved.notOwned) throw new Error(`AVD ${avdName} could not be verified for recovery. Retry after checking its registration.`, { cause: error });
174
205
  if (!resolved.serial) assertOwnedAvdStopped(avdName);
@@ -183,7 +214,7 @@ async function prepareOwnedAvd({ projectPath, slot, label, previousAvdName, syst
183
214
  } : {}
184
215
  };
185
216
  } catch (recoveryError) {
186
- await withConfigLockAsync(() => {
217
+ await withConfigLockAsync$1(() => {
187
218
  if (!isDeepStrictEqual(currentRecord(), reservation)) return;
188
219
  if (previous) setDevice(projectPath, "android", previous, slot);
189
220
  else clearDevice(projectPath, "android", slot, avdName);
@@ -197,7 +228,7 @@ async function prepareOwnedAvd({ projectPath, slot, label, previousAvdName, syst
197
228
  } catch (error) {
198
229
  configurationFailure = { error };
199
230
  }
200
- if (!configurationFailure) await withConfigLockAsync(() => {
231
+ if (!configurationFailure) await withConfigLockAsync$1(() => {
201
232
  assertReservation();
202
233
  setDevice(projectPath, "android", {
203
234
  avdName,
@@ -227,7 +258,7 @@ async function prepareOwnedAvd({ projectPath, slot, label, previousAvdName, syst
227
258
  slot,
228
259
  expectedRecord: reservation
229
260
  },
230
- onRemoved: () => withConfigLockAsync(() => clearDevice(projectPath, "android", slot, avdName))
261
+ onRemoved: () => withConfigLockAsync$1(() => clearDevice(projectPath, "android", slot, avdName))
231
262
  });
232
263
  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\`.` : "";
233
264
  throw new Error(`Created owned AVD ${avdName}, but could not configure its AVD settings: ${String(error?.message || error)}${orphan}`, { cause: error });
@@ -255,7 +286,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
255
286
  slot,
256
287
  expectedRecord: record
257
288
  },
258
- onRemoved: () => withConfigLockAsync(() => clearDevice(projectPath, "android", slot, avdName))
289
+ onRemoved: () => withConfigLockAsync$1(() => clearDevice(projectPath, "android", slot, avdName))
259
290
  });
260
291
  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.");
261
292
  record = null;
@@ -273,7 +304,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
273
304
  slot,
274
305
  expectedRecord: record
275
306
  },
276
- onRemoved: () => withConfigLockAsync(() => clearDevice(projectPath, "android", slot, avdName))
307
+ onRemoved: () => withConfigLockAsync$1(() => clearDevice(projectPath, "android", slot, avdName))
277
308
  });
278
309
  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.");
279
310
  out(phaseLine("device", `deleted ${avdName}, which never finished a boot, to create one on ${requestedImage}`));
@@ -298,7 +329,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
298
329
  owned: true,
299
330
  deviceName: record.deviceName ?? record.avdName
300
331
  };
301
- await withConfigLockAsync(() => setDevice(projectPath, "android", updated, slot));
332
+ await withConfigLockAsync$1(() => setDevice(projectPath, "android", updated, slot));
302
333
  return {
303
334
  ...updated,
304
335
  systemImage: ownedAvdSystemImage(record.avdName),
@@ -438,7 +469,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
438
469
  deviceProfile: created.deviceProfile
439
470
  };
440
471
  }
441
- function claimAndroidConsolePort({ projectPath, slot, avdName, deviceName, livePorts = [], metadata }, { lock = withConfigLock, recordedPorts = () => allConsolePortsAndSerials().androidConsolePorts, record = setDevice } = {}) {
472
+ function claimAndroidConsolePort({ projectPath, slot, avdName, deviceName, livePorts = [], metadata }, { lock = withConfigLock$1, recordedPorts = () => allConsolePortsAndSerials().androidConsolePorts, record = setDevice } = {}) {
442
473
  return lock(() => {
443
474
  const consolePort = nextConsolePort([...recordedPorts(), ...livePorts]);
444
475
  const claim = {
@@ -464,7 +495,7 @@ async function bootOwnedAvdOnFreshPort({ avdName, deviceSlotWait, metadata, proj
464
495
  key: avdName
465
496
  }, async () => {
466
497
  const livePorts = liveAndroidConsolePorts();
467
- const claim = await withConfigLockAsync(() => claimAndroidConsolePort({
498
+ const claim = await withConfigLockAsync$1(() => claimAndroidConsolePort({
468
499
  projectPath,
469
500
  slot,
470
501
  avdName,
@@ -487,7 +518,7 @@ async function bootOwnedAvdOnFreshPort({ avdName, deviceSlotWait, metadata, proj
487
518
  if (result.failed) throw new AvdBootError(result.reason, result.remedy);
488
519
  const running = await getAvdNameForSerialAsync(serial);
489
520
  if (running && running !== avdName) throw new Error(`${serial} is running AVD ${running}, not this workspace's owned AVD ${avdName}; refusing to use it.`);
490
- await withConfigLockAsync(() => clearAndroidBootPending(projectPath, avdName, slot));
521
+ await withConfigLockAsync$1(() => clearAndroidBootPending(projectPath, avdName, slot));
491
522
  await muteBootedEmulator(serial, avdName, out);
492
523
  const { bootPending: _booted, ...booted } = claim;
493
524
  return {
@@ -496,7 +527,7 @@ async function bootOwnedAvdOnFreshPort({ avdName, deviceSlotWait, metadata, proj
496
527
  setup: true
497
528
  };
498
529
  } catch (error) {
499
- await withConfigLockAsync(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
530
+ await withConfigLockAsync$1(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
500
531
  throw error;
501
532
  }
502
533
  }, {
@@ -639,7 +670,7 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
639
670
  };
640
671
  const avdName = device.avdName;
641
672
  const booted = async (result) => {
642
- if (!result.failed) await withConfigLockAsync(() => clearAndroidBootPending(projectPath, avdName, slot));
673
+ if (!result.failed) await withConfigLockAsync$1(() => clearAndroidBootPending(projectPath, avdName, slot));
643
674
  return result;
644
675
  };
645
676
  if (resolved.serial) return booted(await waitForAndroidBoot({
@@ -655,7 +686,7 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
655
686
  }));
656
687
  const boot = async () => {
657
688
  const livePorts = liveAndroidConsolePorts();
658
- const claim = await withConfigLockAsync(() => claimAndroidConsolePort({
689
+ const claim = await withConfigLockAsync$1(() => claimAndroidConsolePort({
659
690
  projectPath,
660
691
  slot,
661
692
  avdName,
@@ -670,7 +701,7 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
670
701
  try {
671
702
  pid = await bootAndroidEmulator(avdName, claim.consolePort, { logFile });
672
703
  } catch (e) {
673
- await withConfigLockAsync(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
704
+ await withConfigLockAsync$1(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
674
705
  return {
675
706
  failed: true,
676
707
  reason: `Could not start emulator for AVD ${avdName}: ${e?.message || e}`
@@ -683,7 +714,7 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
683
714
  alive,
684
715
  out
685
716
  });
686
- if (result.failed) await withConfigLockAsync(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
717
+ if (result.failed) await withConfigLockAsync$1(() => releaseAndroidConsolePort(projectPath, claim.consolePort, slot));
687
718
  else await muteBootedEmulator(serial, avdName, out);
688
719
  return booted(result);
689
720
  };
@@ -1,20 +1,20 @@
1
1
  import { b as operationState, t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { G as projectDeviceSlots, V as deviceSlotKey, W as parseDeviceSlotOption, _ as loadConfig$1, p as getProject } from "./config-BZhXY15H.mjs";
2
+ import { G as projectDeviceSlots, V as deviceSlotKey, W as parseDeviceSlotOption, _ as loadConfig$1, p as getProject } from "./config-BktkY_zC.mjs";
3
3
  import { t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
4
- import { r as clockTime } from "./command-output-DxC0k2rk.mjs";
5
- import { Ht as makeTemporaryDirectory, K as resolveIosProjectDir, Ut as removeTemporaryEntry, q as resolveProjectSettings, tt as settingValueAt } from "./settings-RKwY33wv.mjs";
6
- import { f as projectRegistry, g as selectNativeXcodeProject, i as findProjectRoot$1, p as NativeXcodeError, t as NO_PROJECT_REFUSAL } from "./project-Dz-hWkb-.mjs";
7
- import { A as listAdbDevices, O as getAvdNameForSerialAsync, R as memoizeEmulatorProbe, Y as physicalDeviceModel, Z as probeEmulatorSerial, c as androidPoolNoCandidatesRefusal, rt as resolvePhysicalDevice, s as androidPoolCandidates } from "./android-882m4hxX.mjs";
8
- import { Rn as runProcessOperation } from "./budget-dPGuhNai.mjs";
9
- import { C as parseLeaseDuration, D as releaseWorkspaceLeases, j as takeLease, y as fileLeaseIo } from "./activity-Dq3ZcdD8.mjs";
10
- import { m as resolveScheme, v as xcodebuildArgs } from "./xcode-DHu41qQ4.mjs";
11
- import { a as discoverXcodeProject } from "./react-native-build-AuCu-aAP.mjs";
12
- import { l as parseDeviceWait, p as waitForDevice } from "./device-lease-run-DUtkbqBQ.mjs";
13
- import { m as resolveConfiguration, y as resolveSchemeSelection } from "./support-B1W-hmC2.mjs";
4
+ import { r as clockTime } from "./command-output-BF5AR2dL.mjs";
5
+ import { J as resolveProjectSettings, Ut as makeTemporaryDirectory, Wt as removeTemporaryEntry, nt as settingValueAt, q as resolveIosProjectDir } from "./settings-CosW5X-S.mjs";
6
+ import { f as projectRegistry, g as selectNativeXcodeProject, i as findProjectRoot$1, p as NativeXcodeError, t as NO_PROJECT_REFUSAL } from "./project-BUu6Is4k.mjs";
7
+ import { A as listAdbDevices, O as getAvdNameForSerialAsync, R as memoizeEmulatorProbe, Y as physicalDeviceModel, Z as probeEmulatorSerial, c as androidPoolNoCandidatesRefusal, rt as resolvePhysicalDevice, s as androidPoolCandidates } from "./android-DTAcRwBC.mjs";
8
+ import { Un as runProcessOperation } from "./budget-k2mZGvvk.mjs";
9
+ import { C as parseLeaseDuration, D as releaseWorkspaceLeases, j as takeLease, y as fileLeaseIo } from "./activity-Lnb_EoRY.mjs";
10
+ import { H as resolveScheme, K as xcodebuildArgs } from "./toolchain-J4J8MrAr.mjs";
11
+ import { a as discoverXcodeProject } from "./react-native-build-oNwqF5Wb.mjs";
12
+ import { l as parseDeviceWait, p as waitForDevice } from "./device-lease-run-BmvIl7bI.mjs";
13
+ import { m as resolveConfiguration, y as resolveSchemeSelection } from "./support-CVOCp0Ft.mjs";
14
14
  import { n as findSigningIdentities, o as parsePlist, s as parseProvisioningProfilePlist, t as decodeProvisioningProfile } from "./ios-signing-4c_qXvQm.mjs";
15
- import { t as selectFromPool } from "./device-pool-CgBHk401.mjs";
16
- import { a as iosPoolCandidates, c as isWirelessIosDevice, f as resolveIosPhysicalDevice, l as listIosDevices, o as iosPoolNoCandidatesRefusal } from "./ios-device-BI38NFFH.mjs";
17
- import { i as nativeXcodePackages, t as nativeXcodeHasPackages } from "./native-xcode-inputs-irplbQb0.mjs";
15
+ import { t as selectFromPool } from "./device-pool-Dluix4H3.mjs";
16
+ import { a as iosPoolCandidates, c as isWirelessIosDevice, f as resolveIosPhysicalDevice, l as listIosDevices, o as iosPoolNoCandidatesRefusal } from "./ios-device-CsyryvpT.mjs";
17
+ import { i as nativeXcodePackages, t as nativeXcodeHasPackages } from "./native-xcode-inputs-BW7H8JGu.mjs";
18
18
  import { existsSync, readdirSync, realpathSync, statSync } from "node:fs";
19
19
  import { homedir } from "node:os";
20
20
  import { join } from "node:path";
@@ -1,18 +1,16 @@
1
1
  import { D as ownership_claim_exports, d as workspaceProcessLockError, u as withWorkspaceProcessLock } from "./exec-VFRpu1iA.mjs";
2
- import { m as workspaceLogsDir$1 } from "./paths-DQtTgsBf.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";
7
- import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
8
- import { J as recordCapacityRefusal, Y as recordCapacityWait } from "./budget-dPGuhNai.mjs";
2
+ import { G as projectDeviceSlots, H as deviceSlotPlatforms, O as withConfigLockAsync$1, _ as loadConfig$1, d as getConfigDir, u as getConcurrencyLimits } from "./config-BktkY_zC.mjs";
3
+ import { a as formatElapsed, l as phaseLine } from "./command-output-BF5AR2dL.mjs";
4
+ import { g as deviceReclaimIdleMinutesSetting } from "./settings-CosW5X-S.mjs";
5
+ import { A as listAdbDevices, j as listAdbDevicesAsync } from "./android-DTAcRwBC.mjs";
6
+ import { $ as recordCapacityWait, Q as recordCapacityRefusal } from "./budget-k2mZGvvk.mjs";
9
7
  import { t as canonicalPath } from "./paths-BsJMoPP2.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";
8
+ import { p as withIdleWorkspace } from "./workspaces-g2lhdBXF.mjs";
9
+ import { d as listAllIosSims, f as listAllIosSimsAsync, l as iosRuntimeMatches, y as parseRuntimeVersion } from "./ios-WxpDJ5T1.mjs";
10
+ import { i as writeIdleShutdownEvent, n as dueIdleDevices, r as shutDownIdleDevices } from "./idle-shutdown-FfxL1KdG.mjs";
13
11
  import { realpathSync } from "node:fs";
14
12
  import { basename, join } from "node:path";
15
- import { LOG_ROTATE_BYTES, workspaceId } from "@stim-cli/core";
13
+ import { workspaceId } from "@stim-cli/core";
16
14
  import { DEVICE_RECLAIM_REASON, automaticMachineEnabled } from "@stim-cli/core/state";
17
15
  import { setTimeout } from "node:timers/promises";
18
16
  //#region src/devices/queue-reclaim.ts
@@ -30,12 +28,7 @@ async function reclaimIdleDevice(root, idleMs, out, now, skipped) {
30
28
  const { device, idleForMs } = candidate;
31
29
  const label = loadConfig$1()?.projects[device.project]?.label || basename(device.project);
32
30
  const log = (event) => {
33
- const writer = createNdjsonWriter(join(workspaceLogsDir$1(device.project), "metro.ndjson"), { maxBytes: LOG_ROTATE_BYTES });
34
- writer.write({
35
- src: "metro",
36
- ...event
37
- });
38
- writer.close();
31
+ writeIdleShutdownEvent(device.project, event);
39
32
  if (event.level === "warn") out(`${"device".padEnd(11)} ${event.msg}`);
40
33
  };
41
34
  skipped.add(`${device.kind}:${device.id}`);
@@ -1,19 +1,17 @@
1
1
  import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { n as ensureWorkspaceStorage } from "./paths-DQtTgsBf.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";
2
+ import { _ as ensureWorkspaceStorage, d as writeWorkspaceState } from "./workspace-state-pUg3_RRA.mjs";
3
+ import { O as withConfigLockAsync$1, _ as loadConfig$1, c as ensureConfig } from "./config-BktkY_zC.mjs";
4
+ import { i as macosProcess, o as requiredMacosRecord } from "./state-C4OdpOTF.mjs";
5
+ import { A as listAdbDevices, Ct as forgetCreatedDeviceAsync, 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-DTAcRwBC.mjs";
6
+ import { a as parsePidof, i as parseLogcatLine, t as androidClockOffset } from "./android-B5P81yI-.mjs";
9
7
  import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.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";
8
+ import { An as launchAndroidApp, En as installAndroidApp, Fn as writeDebugHttpHost, Mn as launchIosApp, On as installIosApp, Pn as reverseMetroPorts, jn as launchAndroidReleaseApp, kn as iosAppProcess, vn as androidAppProcess } from "./budget-k2mZGvvk.mjs";
9
+ import { A as teardownOwnedIosSim, O as teardownOwnedAvd } from "./workspaces-g2lhdBXF.mjs";
10
+ import { A as uninstallIosApp, E as resolveIosCreation, L as readHostMemoryPressure, T as resetIosPrivacy, a as createOwnedIosSim, d as listAllIosSims, g as listUserApps, n as bootIosSim, w as resetIosKeychain } from "./ios-WxpDJ5T1.mjs";
11
+ import { r as stopMacosAppHeld } from "./stop-ySNQHXMG.mjs";
14
12
  import { t as spawnEntry } from "./spawn-entry-jw19m8Nl.mjs";
15
- import { i as countLiveOwnedDevices } from "./device-capacity-Ic-kdmEV.mjs";
16
- import { _ as findAapt } from "./support-B3tzVhKn.mjs";
13
+ import { i as countLiveOwnedDevices } from "./device-capacity-DCSvUF0l.mjs";
14
+ import { _ as findAapt } from "./support-BGSCBoib.mjs";
17
15
  import { t as waitForMacosRegistration } from "./registration-CN6nlhcD.mjs";
18
16
  import { n as parseLogStreamLine } from "./ios-ENC4sRPA.mjs";
19
17
  import { createHash, randomUUID } from "node:crypto";
@@ -1,12 +1,14 @@
1
1
  import { D as ownership_claim_exports, o as cancellableSleep, t as getExecutor, u as withWorkspaceProcessLock } from "./exec-VFRpu1iA.mjs";
2
- import { f as workspaceId$1 } from "./paths-DQtTgsBf.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";
2
+ import { D as workspaceId$1 } from "./workspace-state-pUg3_RRA.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-BktkY_zC.mjs";
4
+ import { l as phaseLine } from "./command-output-BF5AR2dL.mjs";
5
+ import { E as iosSimSlimProfileSetting, T as iosSimSlimDefaultSetting } from "./settings-CosW5X-S.mjs";
6
+ import { mt as dropParked, pt as adoptParked, vt as parkedMaxSetting, xt as selectParked, yt as readParked } from "./android-DTAcRwBC.mjs";
7
+ import { M as teardownParkedIosSim } from "./workspaces-g2lhdBXF.mjs";
8
+ import { C as renameIosSim, D as resolveOwnedIosSim, E as resolveIosCreation, L as readHostMemoryPressure, M as configuredIosSimulatorViewer, P as hostMemoryPressureAdvice, S as readSpringBoardPid, T as resetIosPrivacy, _ as ownedSimName, a as createOwnedIosSim, d as listAllIosSims, f as listAllIosSimsAsync, h as listIosRuntimesAsync, j as waitForSpringBoard, n as bootIosSim, p as listIosDeviceTypesAsync, u as iosSimulatorFailureAdvice, w as resetIosKeychain, y as parseRuntimeVersion, z as reportMemoryCulprits } from "./ios-WxpDJ5T1.mjs";
9
+ import { l as runtimeMismatch, m as withDeviceBootAdmission, n as DeviceAdmissionRefusal, o as deviceTypeMismatch } from "./device-capacity-DCSvUF0l.mjs";
10
+ import { createHash } from "node:crypto";
11
+ import { readFileSync } from "node:fs";
10
12
  import { ambientContext } from "@stim-cli/core";
11
13
  import { isJsonObject } from "@stim-cli/core/state";
12
14
  import chalk from "chalk";
@@ -17,13 +19,14 @@ function startIosBoot(udid, configure, label, out, simulatorApp, root, deviceSlo
17
19
  key: udid
18
20
  }, async () => {
19
21
  out(chalk.dim(phaseLine("device", `booting ${label} (${udid})`)));
20
- await muteBootedSimulator(udid, await bootIosSim(udid, {
22
+ await bootIosSim(udid, {
21
23
  label,
22
24
  out,
23
25
  simulatorApp,
24
26
  env: ambientContext()?.env
25
- }), out);
27
+ });
26
28
  await configure();
29
+ await muteBootedSimulator(udid, out);
27
30
  }, {
28
31
  ...deviceSlotWait,
29
32
  root,
@@ -35,9 +38,12 @@ function startIosBoot(udid, configure, label, out, simulatorApp, root, deviceSlo
35
38
  done
36
39
  };
37
40
  }
38
- async function muteBootedSimulator(udid, { springBoardUnreadable }, out) {
41
+ const SPRINGBOARD_MUTE_WAIT_MS = 6e4;
42
+ async function muteBootedSimulator(udid, out) {
39
43
  try {
40
- if (springBoardUnreadable) throw new Error(springBoardUnreadable);
44
+ const springBoard = await waitForSpringBoard(udid, Date.now() + SPRINGBOARD_MUTE_WAIT_MS);
45
+ if (springBoard.state === "unreadable") throw new Error(springBoard.reason);
46
+ if (springBoard.state === "timed-out") throw new Error(`SpringBoard did not finish starting within ${SPRINGBOARD_MUTE_WAIT_MS / 1e3}s.`);
41
47
  const response = JSON.parse(await getExecutor().runFileAsync("xcrun", [
42
48
  "devicectl",
43
49
  "device",
@@ -65,6 +71,7 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
65
71
  if (memoryAdvice) out(chalk.yellow(phaseLine("memory", memoryAdvice)));
66
72
  reportMemoryCulprits(pressure, (named) => out(chalk.yellow(phaseLine("memory", named))));
67
73
  const simslimProfile = iosSimSlimProfileSetting(settings, settingsRoot);
74
+ const simslimDefault = iosSimSlimDefaultSetting(settings);
68
75
  if (record?.deviceUdid) {
69
76
  if (record.owned) {
70
77
  const listed = simSnapshot ? simSnapshot.read() : listAllIosSims({ includeUnavailable: true });
@@ -73,10 +80,10 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
73
80
  else if (resolved.missing) {} else {
74
81
  const sim = resolved.sim;
75
82
  const wantedType = flags.deviceType || settings?.ios?.deviceType;
76
- const deviceTypes = await listIosDeviceTypesAsync();
83
+ const deviceTypes = await listIosDeviceTypesAsync({ snapshot: simSnapshot });
77
84
  const mismatch = deviceTypeMismatch(sim.deviceTypeIdentifier, wantedType, deviceTypes);
78
85
  if (mismatch) throw new IosDeviceMismatchError(`${mismatch}. Stim will not silently boot a different model.`);
79
- const versionMismatch = flags.runtimeFlag ? runtimeMismatch(sim.runtime, flags.runtimeFlag, await listIosRuntimesAsync()) : null;
86
+ const versionMismatch = flags.runtimeFlag ? runtimeMismatch(sim.runtime, flags.runtimeFlag, await listIosRuntimesAsync({ snapshot: simSnapshot })) : null;
80
87
  if (versionMismatch) throw new IosDeviceMismatchError(`${versionMismatch}. Stim will not silently boot a different iOS version.`);
81
88
  const model = {
82
89
  model: deviceTypes.find((d) => d.identifier === sim.deviceTypeIdentifier)?.name ?? null,
@@ -88,18 +95,21 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
88
95
  owned: true,
89
96
  deviceName: name,
90
97
  ...record.simslimManaged ? { simslimManaged: true } : {},
98
+ ...record.simslimApplied ? { simslimApplied: record.simslimApplied } : {},
91
99
  ...record.adopted ? { adopted: true } : {},
92
100
  ...record.adoptionPending ? { adoptionPending: true } : {},
93
101
  ...record.parkedCacheKey ? { parkedCacheKey: record.parkedCacheKey } : {},
94
102
  ...record.schemeApprovals ? { schemeApprovals: record.schemeApprovals } : {}
95
103
  };
96
- const configure = async () => {
104
+ const configure = async (freshBoot) => {
97
105
  if (record.adoptionPending) await resetAdoptedSim(sim.udid, out);
98
106
  return configureOwnedIosSim({
99
107
  record: updated,
100
108
  projectPath,
101
109
  slot,
102
110
  profile: simslimProfile,
111
+ slimByDefault: simslimDefault,
112
+ freshBoot,
103
113
  out,
104
114
  reconcileIosSimulator
105
115
  });
@@ -110,11 +120,13 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
110
120
  };
111
121
  if (sim.state !== "Booted") return {
112
122
  ...updated,
113
- booting: startIosBoot(sim.udid, configure, name, out, flags.simulatorApp, projectPath, flags.deviceSlotWait),
123
+ booting: startIosBoot(sim.udid, () => configure(true), name, out, flags.simulatorApp, projectPath, flags.deviceSlotWait),
114
124
  ...facts
115
125
  };
126
+ const { record: configured, rebooted } = await configure(false);
127
+ if (rebooted) await muteBootedSimulator(sim.udid, out);
116
128
  return {
117
- ...await configure(),
129
+ ...configured,
118
130
  ...facts,
119
131
  booted: sim.udid
120
132
  };
@@ -155,6 +167,8 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
155
167
  projectPath,
156
168
  slot,
157
169
  profile: simslimProfile,
170
+ slimByDefault: simslimDefault,
171
+ freshBoot: true,
158
172
  out,
159
173
  reconcileIosSimulator
160
174
  });
@@ -189,6 +203,8 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
189
203
  projectPath,
190
204
  slot,
191
205
  profile: simslimProfile,
206
+ slimByDefault: simslimDefault,
207
+ freshBoot: true,
192
208
  out,
193
209
  reconcileIosSimulator
194
210
  }), created.name, out, flags.simulatorApp, projectPath, flags.deviceSlotWait);
@@ -294,15 +310,32 @@ function clearIosAdoptionPending(projectPath, slot = "default") {
294
310
  saveConfig(cfg);
295
311
  });
296
312
  }
297
- async function configureOwnedIosSim({ record, projectPath, slot, profile, out, reconcileIosSimulator }) {
313
+ function simslimProfileIdentity(profile, slimByDefault) {
314
+ if (profile) return `profile:${createHash("sha256").update(readFileSync(profile)).digest("hex")}`;
315
+ return slimByDefault ? "default" : null;
316
+ }
317
+ async function configureOwnedIosSim({ record, projectPath, slot, profile, slimByDefault, freshBoot, out, reconcileIosSimulator }) {
318
+ const identity = simslimProfileIdentity(profile, slimByDefault);
319
+ const slimConfigured = identity !== null || Boolean(record.simslimManaged);
320
+ const applied = record.simslimApplied;
321
+ const springBoardBefore = slimConfigured && !freshBoot ? await readSpringBoardPid(record.deviceUdid) : null;
322
+ if (identity !== null && record.simslimManaged && !freshBoot && applied?.profile === identity && springBoardBefore !== null && springBoardBefore === applied.springBoardPid) {
323
+ await withConfigLockAsync$1(() => setDevice(projectPath, "ios", { ...record }, slot));
324
+ return {
325
+ record,
326
+ rebooted: false
327
+ };
328
+ }
298
329
  if (profile) out(chalk.dim(phaseLine("device", `applying the SimSlim profile to ${record.deviceUdid}`)));
330
+ else if (slimByDefault) out(chalk.dim(phaseLine("device", `applying SimSlim's default services to ${record.deviceUdid}`)));
299
331
  else if (record.simslimManaged) out(chalk.dim(phaseLine("device", `restoring stock simulator services on ${record.deviceUdid}`)));
300
332
  const previouslyManaged = Boolean(record.simslimManaged);
301
- if (profile && !record.simslimManaged) {
302
- const pending = {
303
- ...record,
333
+ if (identity !== null && !record.simslimManaged || applied) {
334
+ const { simslimApplied: _applied, ...rest } = record;
335
+ const pending = identity !== null ? {
336
+ ...rest,
304
337
  simslimManaged: true
305
- };
338
+ } : rest;
306
339
  await withConfigLockAsync$1(() => setDevice(projectPath, "ios", pending, slot));
307
340
  record = pending;
308
341
  }
@@ -310,14 +343,23 @@ async function configureOwnedIosSim({ record, projectPath, slot, profile, out, r
310
343
  context: ambientContext(),
311
344
  udid: record.deviceUdid,
312
345
  profile,
346
+ slimByDefault,
313
347
  previouslyManaged,
314
348
  out
315
349
  });
316
350
  const updated = { ...record };
317
351
  if (result.managed) updated.simslimManaged = true;
318
352
  else delete updated.simslimManaged;
353
+ const springBoardAfter = slimConfigured ? await readSpringBoardPid(record.deviceUdid) : null;
354
+ if (result.managed && !result.notInstalled && identity !== null && springBoardAfter !== null) updated.simslimApplied = {
355
+ profile: identity,
356
+ springBoardPid: springBoardAfter
357
+ };
319
358
  await withConfigLockAsync$1(() => setDevice(projectPath, "ios", updated, slot));
320
- return updated;
359
+ return {
360
+ record: updated,
361
+ rebooted: slimConfigured && springBoardAfter !== springBoardBefore
362
+ };
321
363
  }
322
364
  async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorApp, timeoutMs, pollMs, out }) {
323
365
  const udid = device?.deviceUdid;
@@ -389,13 +431,14 @@ async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorA
389
431
  key: udid
390
432
  }, async () => {
391
433
  out(chalk.dim(phaseLine("device", `booting ${sim.name} (${udid})`)));
392
- await muteBootedSimulator(udid, await bootIosSim(udid, {
434
+ await bootIosSim(udid, {
393
435
  timeoutMs,
394
436
  label: sim.name,
395
437
  out,
396
438
  simulatorApp,
397
439
  env: ambientContext()?.env
398
- }), out);
440
+ });
441
+ await muteBootedSimulator(udid, out);
399
442
  }, {
400
443
  ...deviceSlotWait,
401
444
  root: projectPath,
@@ -1,11 +1,11 @@
1
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";
2
+ import { V as deviceSlotKey } from "./config-BktkY_zC.mjs";
3
+ import { a as formatElapsed, r as clockTime } from "./command-output-BF5AR2dL.mjs";
4
+ import { nn as MANIFEST_VERIFY_TIMEOUT_MS, pn as APP_READINESS_TIMEOUT_MS } from "./budget-k2mZGvvk.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-Lnb_EoRY.mjs";
6
6
  //#region src/engine/device-lease-run.ts
7
7
  const LEASE_STEP_FLOOR_MS = 6e4;
8
- const DEBUG_VERIFY_STEP_MS = VERIFY_TIMEOUT_MS + APP_READINESS_TIMEOUT_MS;
8
+ const DEBUG_VERIFY_STEP_MS = MANIFEST_VERIFY_TIMEOUT_MS + APP_READINESS_TIMEOUT_MS;
9
9
  const DEVICE_WAIT_POLL_MS = 2e3;
10
10
  const DEVICE_WAIT_LINE_MS = 3e4;
11
11
  const DEVICE_BUSY = "STIM_DEVICE_BUSY";
@@ -1,6 +1,6 @@
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";
1
+ import { V as deviceSlotKey } from "./config-BktkY_zC.mjs";
2
+ import { A as selectPoolDevice, S as parseLease, b as leaseIsExpired, v as deviceLeasePath, y as fileLeaseIo } from "./activity-Lnb_EoRY.mjs";
3
+ import { i as DEVICE_WAIT_POLL_MS, n as DEVICE_BUSY, o as leaseExpiryText } from "./device-lease-run-BmvIl7bI.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)];