stim 1.25.0 → 1.27.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 (182) hide show
  1. package/README.md +1 -1
  2. package/dist/{acquire-artifact-zA4S7RHE.mjs → acquire-artifact-BKN2Yuhg.mjs} +2 -2
  3. package/dist/{act-BbHS3oV8.mjs → act-ROviTF_t.mjs} +415 -118
  4. package/dist/{activity-BpjwrQXU.mjs → activity-Cd-ysFes.mjs} +6 -7
  5. package/dist/{agent-device-usage-output-Bnkerfod.mjs → agent-device-usage-output-C5nCKWp9.mjs} +5 -5
  6. package/dist/{android-CNZgRC-4.mjs → android--HBgpvpW.mjs} +5 -5
  7. package/dist/{android-BGwuK3Mc.mjs → android-Cd6w7_qw.mjs} +134 -57
  8. package/dist/{android-saBeB4lr.mjs → android-Deb9X3_Y.mjs} +37 -15
  9. package/dist/{android-Cjcj8MCw.mjs → android-DriNoAVy.mjs} +99 -47
  10. package/dist/{android-cas-BVqh2Zep.mjs → android-cas-D5e6ecUg.mjs} +4 -4
  11. package/dist/android-cas-compiler.mjs +1 -1
  12. package/dist/{android-project-CTYaETc0.d.mts → android-project-DUGMbq28.d.mts} +55 -1
  13. package/dist/api.d.mts +20 -7
  14. package/dist/api.mjs +42 -32
  15. package/dist/apk-signed-tail-BHQHx3Rm.mjs +142 -0
  16. package/dist/{artifact-Co8zixVx.mjs → artifact-0AGJYB9O.mjs} +28 -28
  17. package/dist/{artifact-DN8JNwqS.mjs → artifact-faemIZv5.mjs} +40 -30
  18. package/dist/{artifact-platform-CMRc0M_r.mjs → artifact-platform-BO2Uvk_A.mjs} +1 -1
  19. package/dist/{attempt-DW-mQqM7.mjs → attempt-ClyJlZPT.mjs} +4 -2
  20. package/dist/auto-placement-z-H5pJza.mjs +350 -0
  21. package/dist/{browser-web-CCgZsHmI.mjs → browser-web-slD8AvLp.mjs} +16 -17
  22. package/dist/{build-cache-CKCzxzxA.mjs → build-cache-gBJ-WKzA.mjs} +141 -37
  23. package/dist/{build-CAiw8Ezm.mjs → build-hS0QyFlQ.mjs} +38 -31
  24. package/dist/{build-plan-zCuHGlA8.mjs → build-plan-CBqYbzYM.mjs} +7 -6
  25. package/dist/{cache-manifest-BPXRONJz.mjs → cache-manifest-DEjqGGat.mjs} +1 -1
  26. package/dist/cache-manifest.mjs +1 -1
  27. package/dist/{budget-HyShrIpL.mjs → ccache-BWTze1Ls.mjs} +634 -1514
  28. package/dist/{cdp-BG3FJCCx.mjs → cdp-C3svvXiE.mjs} +1 -1
  29. package/dist/{chrome-BvV8ssI3.mjs → chrome-DyDWurWG.mjs} +1 -1
  30. package/dist/{cli-C4w607Pz.mjs → cli-ftXDLto1.mjs} +24 -23
  31. package/dist/cli.mjs +1 -1
  32. package/dist/{client-BQsmyp_-.mjs → client-xsdxrhWA.mjs} +77 -116
  33. package/dist/collector-run.d.mts +10 -9
  34. package/dist/collector-run.mjs +42 -27
  35. package/dist/{command-output-BBvS1H6v.mjs → command-output-Dj-WT4BP.mjs} +1 -1
  36. package/dist/{config-BZhXY15H.mjs → config-Cn94Jc0g.mjs} +343 -18
  37. package/dist/{launch-DscF1QfM.mjs → dependencies-BGokZ-Ng.mjs} +330 -279
  38. package/dist/{dependency-state-BwNCYG5Q.mjs → dependency-state-C3OtgG94.mjs} +14 -7
  39. package/dist/{detached-entry-KmieOKgN.mjs → detached-entry-BPlSaCwC.mjs} +1 -1
  40. package/dist/{dev-client-CHoXXZeg.mjs → dev-client-BMca82xo.mjs} +2 -2
  41. package/dist/{device-F5-4z9ef.mjs → device-BJm0irrq.mjs} +16 -16
  42. package/dist/{device-capacity-ZYaRALv5.mjs → device-capacity-6LP7QsaA.mjs} +103 -25
  43. package/dist/device-host-worker.mjs +19 -21
  44. package/dist/{device-ios-DkHBrmvH.mjs → device-ios-534c14fz.mjs} +288 -28
  45. package/dist/{device-lease-run-ogEeJ62K.mjs → device-lease-run-DwsGfjUN.mjs} +5 -5
  46. package/dist/{device-pool-BIg8MU8l.mjs → device-pool-BnQqvs6o.mjs} +3 -3
  47. package/dist/{device-B9FqTBYW.mjs → device-tM41-TUq.mjs} +25 -24
  48. package/dist/{doctor-A_Nr_fDe.mjs → doctor-Dbx1ZpD2.mjs} +1 -1
  49. package/dist/{doctor-k3P3PizH.mjs → doctor-DyqE9n1J.mjs} +28 -16
  50. package/dist/{doctor-Bm8TVpGn.mjs → doctor-F-3VUUyN.mjs} +128 -35
  51. package/dist/{doctor-fingerprint-zlujA1Gs.mjs → doctor-fingerprint-o7ZI9YLn.mjs} +9 -3
  52. package/dist/doctor-fingerprint.mjs +1 -1
  53. package/dist/{doctor-watchman-BovI1y3-.mjs → doctor-watchman-CxDbyrrt.mjs} +5 -5
  54. package/dist/{eas-build-CyDKNTBP.mjs → eas-build-CjNSWmjo.mjs} +4 -4
  55. package/dist/eas-fallback-9fqb46kW.mjs +87 -0
  56. package/dist/{eas-session-ledger-BMCA1gdO.mjs → eas-session-ledger-DrP4OuuM.mjs} +6 -6
  57. package/dist/{error-diagnostics-B1Mj_-7h.mjs → error-diagnostics-snej9k4j.mjs} +51 -25
  58. package/dist/{exec-VFRpu1iA.mjs → exec-aULwtNly.mjs} +57 -6
  59. package/dist/{gc-eaz403W6.mjs → gc-BRwAY3qT.mjs} +2 -2
  60. package/dist/{gc-B9jcnmIk.mjs → gc-CGZ1Yg88.mjs} +218 -72
  61. package/dist/{guide-DR0K0xW9.mjs → guide-_rfEh_zM.mjs} +839 -222
  62. package/dist/{hosted-android-Bvb2-ZxD.mjs → hosted-android-BMKzUNnY.mjs} +4 -4
  63. package/dist/{hosted-client-rsRqysJc.mjs → hosted-client-D7Pk_Oo1.mjs} +13 -9
  64. package/dist/{hosted-logs-CWKGYWNX.mjs → hosted-logs-B1gqQuva.mjs} +18 -12
  65. package/dist/hosted-logs-sync-Dg3qrZmV.mjs +195 -0
  66. package/dist/{hosted-macos-d0pv9Tth.mjs → hosted-macos-B9w4H8hc.mjs} +6 -6
  67. package/dist/{hosted-native-BxTizGU2.mjs → hosted-native-CdgaiuyP.mjs} +17 -17
  68. package/dist/{idle-shutdown-BIyfl0Zj.mjs → idle-shutdown-Cbvo5KEh.mjs} +21 -9
  69. package/dist/{ios-BRVM8b0P.mjs → ios-B5HlVMhQ.mjs} +138 -55
  70. package/dist/{ios-Dvt97HgQ.mjs → ios-Bk4mWbtS.mjs} +8 -8
  71. package/dist/{ios-ENC4sRPA.mjs → ios-CsRVik64.mjs} +7 -1
  72. package/dist/{ios-BQzvJlzw.mjs → ios-E26qSpkb.mjs} +94 -11
  73. package/dist/{ios-device-CKSvk0bu.mjs → ios-device-C_QkIf1Z.mjs} +3 -3
  74. package/dist/{ios-device-B6HK951C.mjs → ios-device-CiBA-er9.mjs} +1 -1
  75. package/dist/{ios-project-DCUDo06I.mjs → ios-project-D8Jcy_br.mjs} +22 -9
  76. package/dist/{ios-signing-4c_qXvQm.mjs → ios-signing-BJzvDPfU.mjs} +2 -2
  77. package/dist/{ios-state-CT9nV5SP.mjs → ios-state-BZ03NFgF.mjs} +1 -1
  78. package/dist/{js-swap-Z9HbC4cj.mjs → js-swap-Dg2a945i.mjs} +8 -7
  79. package/dist/{launch-D0lPvFFu.mjs → launch-CRyBeNsA.mjs} +53 -44
  80. package/dist/lightened-BCsdAGj_.mjs +171 -0
  81. package/dist/{logs-BsIRre8x.mjs → logs-CC_-ZzEE.mjs} +10 -174
  82. package/dist/{logs-Crs9y34Z.mjs → logs-aJQb-RDg.mjs} +112 -38
  83. package/dist/{macos-CcUlJPMu.mjs → macos-BGmTpnv9.mjs} +1 -1
  84. package/dist/{macos-D477nfzH.mjs → macos-DlCBhMw5.mjs} +73 -39
  85. package/dist/macos-run.mjs +1 -1
  86. package/dist/maintenance-run.mjs +30 -13
  87. package/dist/{metro-1pJgCX4U.mjs → metro-CvyD-xwe.mjs} +4 -4
  88. package/dist/{metro-gateway-Bp9gJQAN.mjs → metro-gateway-BnHdqMO_.mjs} +3 -4
  89. package/dist/{named-ports-BVbn8SvC.mjs → named-ports-BCyMWA6b.mjs} +3 -3
  90. package/dist/{native-android-BvMizJn1.mjs → native-android-DlpxCyOP.mjs} +17 -18
  91. package/dist/{native-gradle-artifact-inputs-BJscK4vN.mjs → native-gradle-artifact-inputs-C13qT7R_.mjs} +5 -5
  92. package/dist/{native-runtime-B9w_Qyz3.mjs → native-runtime-DqaIBO5w.mjs} +9 -9
  93. package/dist/{native-source-D-4Dh4JU.mjs → native-source-D1AzWiuP.mjs} +1 -1
  94. package/dist/{native-xcode-inputs-Cv4l-obn.mjs → native-xcode-inputs-B1W8SrxB.mjs} +3 -3
  95. package/dist/{native-xcode-ios-DGrg90hE.mjs → native-xcode-ios-QPP0Rm68.mjs} +17 -18
  96. package/dist/{ndjson-CgE_o3Dl.mjs → ndjson-Dy2W4vRa.mjs} +2 -2
  97. package/dist/offload-worker.d.mts +3 -1
  98. package/dist/offload-worker.mjs +34 -25
  99. package/dist/{operation-exec-CUZifp6Z.mjs → operation-exec-Dp4FuIGR.mjs} +1 -1
  100. package/dist/{ownership-jxxz-19m.mjs → ownership-Bx-0cku-.mjs} +3 -3
  101. package/dist/{page-CzEA_-5_.mjs → page-CQJlcj3x.mjs} +2 -2
  102. package/dist/{phone-reverses-CYb7RRAx.mjs → phone-reverses-C9yAaKEv.mjs} +18 -4
  103. package/dist/{placement-log-DjOXJRIH.mjs → placement-log-BXUbiZM6.mjs} +3 -3
  104. package/dist/{plan-placement-BqKgKHCi.mjs → plan-placement-UxnQjv5Z.mjs} +36 -10
  105. package/dist/{ports-DtS1Amb0.mjs → ports-uUrghqWN.mjs} +3 -3
  106. package/dist/prebuild-BDpToDgR.mjs +1246 -0
  107. package/dist/{project-BiC68mIp.mjs → project-DYj-HVx6.mjs} +17 -18
  108. package/dist/{pull-request-CbNlkFok.mjs → pull-request-BzLmzAIQ.mjs} +2 -2
  109. package/dist/pull-requests.mjs +1 -1
  110. package/dist/{react-native-android-DRYqoJc4.mjs → react-native-android-DDBccgJw.mjs} +56 -36
  111. package/dist/{react-native-build-CwZB-agu.mjs → react-native-build-DaK2IFyP.mjs} +9 -9
  112. package/dist/{react-native-doctor-BCrytK7h.mjs → react-native-doctor-B-Mw6DcR.mjs} +50 -9
  113. package/dist/{react-native-ios-Cr1buNFo.mjs → react-native-ios-DjYwUF9U.mjs} +45 -25
  114. package/dist/{recordings-BaoQ0t-J.mjs → recordings-C20iUZfp.mjs} +1 -1
  115. package/dist/{registration-CN6nlhcD.mjs → registration-BwCe64PH.mjs} +1 -1
  116. package/dist/{reload-Beftw2X3.mjs → reload-DJBeF_rC.mjs} +1 -1
  117. package/dist/{reload-FbSgMF8x.mjs → reload-fUdkH2_p.mjs} +16 -16
  118. package/dist/{remote-BuZj6AyU.mjs → remote-y6n99WMW.mjs} +22 -9
  119. package/dist/{result-CR2vk2cj.mjs → result-CTqBw2Te.mjs} +32 -21
  120. package/dist/{run-BtzE09Dl.mjs → run-DaCeNKRm.mjs} +3 -3
  121. package/dist/{selection-D5cxEl3t.mjs → selection-Bs8phwhN.mjs} +183 -62
  122. package/dist/{server-bare-CH9X0RLn.mjs → server-bare-BOh-iZEj.mjs} +2 -2
  123. package/dist/{server-command-CaBbDNU2.mjs → server-command-8CuA51Cv.mjs} +6 -6
  124. package/dist/{server-expo-Ck8EIidM.mjs → server-expo-ABQs2XFA.mjs} +4 -4
  125. package/dist/server-expo-Ba_Y21vB.mjs +2 -0
  126. package/dist/{settings-B5tCoq9N.mjs → settings-BDVI8Ivc.mjs} +331 -62
  127. package/dist/{settings-DzH9mGQZ.mjs → settings-CMHhQNwI.mjs} +24 -3
  128. package/dist/settings-payload-cm60Zhib.mjs +257 -0
  129. package/dist/settings-write-BdNRLlBn.mjs +185 -0
  130. package/dist/settings.schema.json +84 -39
  131. package/dist/{simslim-BjxszUAb.mjs → simslim-DCQwzoPy.mjs} +4 -3
  132. package/dist/{slot-launch-QeuJMlnJ.mjs → slot-launch-0l7RqSpr.mjs} +6 -6
  133. package/dist/{stage-D8xlRU2D.mjs → stage-F4cAfJGi.mjs} +2 -2
  134. package/dist/{start-C1JLjkNw.mjs → start-DcqnF9p8.mjs} +1 -1
  135. package/dist/{start-YMpNwLhh.mjs → start-DrPwER_2.mjs} +27 -23
  136. package/dist/{state-DMRNP7-4.mjs → state-BX1y5syV.mjs} +4 -5
  137. package/dist/{state-DPaM3u5K.mjs → state-CZxLyetD.mjs} +2 -3
  138. package/dist/{stats-CP7STzZw.mjs → stats-GxuCbles.mjs} +5 -5
  139. package/dist/{stats-report-n2U5plhk.mjs → stats-report-B86Cv7Uc.mjs} +1 -1
  140. package/dist/{status-Fect2w9R.mjs → status-7ULDEJ1e.mjs} +1 -1
  141. package/dist/{status-CRLiJ-O_.mjs → status-BfnK9pUd.mjs} +25 -26
  142. package/dist/{status-cNw6i0_t.mjs → status-Bj7ZYvvc.mjs} +1 -1
  143. package/dist/{status-watch-Bc2J4TZn.mjs → status-watch-BfabQn03.mjs} +5 -5
  144. package/dist/status-worker.mjs +1 -1
  145. package/dist/{stim-desktop-DS0mzR8U.mjs → stim-desktop-CbWo21kb.mjs} +2 -2
  146. package/dist/{stop-COP6PQqw.mjs → stop-CH79S3IZ.mjs} +5 -6
  147. package/dist/{stop-Db9Kh-UA.mjs → stop-D-EAr25B.mjs} +25 -22
  148. package/dist/{stop-Br7LKxBE.mjs → stop-x1Yu3He4.mjs} +2 -2
  149. package/dist/supervisor-run.d.mts +1 -0
  150. package/dist/supervisor-run.mjs +17 -18
  151. package/dist/{support-qKcbgmI5.mjs → support-Be0UeVZU.mjs} +10 -10
  152. package/dist/{support-Cxj9CmII.mjs → support-CNg_YsOk.mjs} +6 -6
  153. package/dist/{swiftpm-artifact-inputs-iY9fsmOc.mjs → swiftpm-artifact-inputs-uPqYvGBv.mjs} +4 -4
  154. package/dist/{swiftpm-macos-Bp_sn9P4.mjs → swiftpm-macos-Ch4YjY_A.mjs} +11 -12
  155. package/dist/toolchain-CbCG6C5Z.mjs +2413 -0
  156. package/dist/toolchain-JYAOquPg.mjs +2 -0
  157. package/dist/{trigger-CBMe2YLH.mjs → trigger-DMou-X7j.mjs} +3 -3
  158. package/dist/trigger-qp2ji5wE.mjs +2 -0
  159. package/dist/{warm-progress-BV3ZPmcY.mjs → warm-progress-C0RsbngN.mjs} +731 -728
  160. package/dist/{web-B4Yjyt1G.mjs → web-Cq_AQ4DK.mjs} +9 -10
  161. package/dist/web-Je6abcpz.mjs +2 -0
  162. package/dist/web-run.mjs +9 -9
  163. package/dist/windows-report.mjs +1 -1
  164. package/dist/{workspace-state-CPSp3mav.mjs → workspace-state-BjqdjnJR.mjs} +46 -8
  165. package/dist/{workspaces-C9w4aeXF.mjs → workspaces-DFbj07jp.mjs} +1801 -76
  166. package/dist/{worktree-CclFIe1Z.mjs → worktree-COAJ3-OD.mjs} +934 -511
  167. package/dist/{worktree-Ct9Gk3KL.mjs → worktree-JGUd_53L.mjs} +1 -1
  168. package/package.json +8 -8
  169. package/dist/ccache-h1FKhZeg.mjs +0 -143
  170. package/dist/created-devices-D2Aca-xu.mjs +0 -52
  171. package/dist/eas-fallback-gaZi-dJL.mjs +0 -381
  172. package/dist/hosted-ios-RtVcJH3u.mjs +0 -15
  173. package/dist/native-run-D5OJsGwA.mjs +0 -276
  174. package/dist/paths-DQtTgsBf.mjs +0 -42
  175. package/dist/prebuild-JUaqOLpc.mjs +0 -501
  176. package/dist/server-expo-C16Zf2k7.mjs +0 -2
  177. package/dist/settings-write-n0zwfohx.mjs +0 -360
  178. package/dist/toolchain-DB1aeqxO.mjs +0 -2
  179. package/dist/toolchain-VzLJzZ7O.mjs +0 -908
  180. package/dist/trigger-BLsHgAGR.mjs +0 -2
  181. package/dist/web-DS4UDWvf.mjs +0 -2
  182. package/dist/xcode-CiIIDnuD.mjs +0 -910
@@ -1,17 +1,161 @@
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-BBvS1H6v.mjs";
5
- import { E as iosSimSlimProfileSetting, T as iosSimSlimDefaultSetting } from "./settings-B5tCoq9N.mjs";
6
- import { mt as dropParked, pt as adoptParked, vt as parkedMaxSetting, xt as selectParked, yt as readParked } from "./android-Cjcj8MCw.mjs";
7
- import { M as teardownParkedIosSim } from "./workspaces-C9w4aeXF.mjs";
8
- import { A as waitForSpringBoard, C as resetIosKeychain, E as resolveOwnedIosSim, I as readHostMemoryPressure, N as hostMemoryPressureAdvice, R as reportMemoryCulprits, S as renameIosSim, T as resolveIosCreation, _ as ownedSimName, a as createOwnedIosSim, d as listAllIosSims, f as listAllIosSimsAsync, h as listIosRuntimesAsync, j as configuredIosSimulatorViewer, n as bootIosSim, p as listIosDeviceTypesAsync, u as iosSimulatorFailureAdvice, w as resetIosPrivacy, y as parseRuntimeVersion } from "./ios-BQzvJlzw.mjs";
9
- import { l as runtimeMismatch, m as withDeviceBootAdmission, n as DeviceAdmissionRefusal, o as deviceTypeMismatch } from "./device-capacity-ZYaRALv5.mjs";
10
- import { ambientContext } from "@stim-cli/core";
1
+ import { D as ownership_claim_exports, o as cancellableSleep, t as getExecutor, u as withWorkspaceProcessLock } from "./exec-aULwtNly.mjs";
2
+ import { D as workspaceId$1, k as workspaceLogsDir$1 } from "./workspace-state-BjqdjnJR.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-Cn94Jc0g.mjs";
4
+ import { l as phaseLine } from "./command-output-Dj-WT4BP.mjs";
5
+ import { D as iosSimSlimProfileSetting, E as iosSimSlimDefaultSetting } from "./settings-BDVI8Ivc.mjs";
6
+ import { mt as dropParked, pt as adoptParked, vt as parkedMaxSetting, xt as selectParked, yt as readParked } from "./android-DriNoAVy.mjs";
7
+ import { i as createNdjsonWriter } from "./ndjson-Dy2W4vRa.mjs";
8
+ import { ft as teardownOwnedIosSim, mt as teardownParkedIosSim } from "./workspaces-DFbj07jp.mjs";
9
+ import { A as springBoardRunning, B as reportMemoryCulprits, C as renameIosSim, D as resolveOwnedIosSim, E as resolveIosCreation, F as hostMemoryPressureAdvice, M as waitForSpringBoard, N as configuredIosSimulatorViewer, R as readHostMemoryPressure, S as readSpringBoardPid, T as resetIosPrivacy, _ 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 resetIosKeychain, y as parseRuntimeVersion } from "./ios-E26qSpkb.mjs";
10
+ import { h as withDeviceBootAdmission, n as DeviceAdmissionRefusal, s as deviceTypeMismatch, u as runtimeMismatch } from "./device-capacity-6LP7QsaA.mjs";
11
+ import { createHash } from "node:crypto";
12
+ import { readFileSync } from "node:fs";
13
+ import { homedir } from "node:os";
14
+ import { join } from "node:path";
15
+ import { LOG_ROTATE_BYTES, ambientContext } from "@stim-cli/core";
11
16
  import { isJsonObject } from "@stim-cli/core/state";
12
17
  import chalk from "chalk";
18
+ import { mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
19
+ //#region src/devices/springboard-crash-reports.ts
20
+ const REPORT_WINDOW_MS = 6e5;
21
+ const MAX_CANDIDATES = 100;
22
+ const MAX_STORED = 40;
23
+ const MAX_REPORT_BYTES = 1048576;
24
+ const MAX_COPIED_BYTES = 8388608;
25
+ function selectSpringBoardReports(entries, udid, sinceMs) {
26
+ const owner = `.${udid}`.toLowerCase();
27
+ return entries.flatMap(({ name, text }) => {
28
+ if (!/^SpringBoard-.+\.ips$/.test(name)) return [];
29
+ try {
30
+ const report = JSON.parse(text.slice(text.indexOf("\n") + 1));
31
+ if (!isJsonObject(report)) return [];
32
+ const { coalitionName, captureTime } = report;
33
+ const capturedAt = Date.parse(typeof captureTime === "string" ? captureTime : "");
34
+ return typeof coalitionName === "string" && coalitionName.toLowerCase().endsWith(owner) && capturedAt >= sinceMs ? [name] : [];
35
+ } catch {
36
+ return [];
37
+ }
38
+ });
39
+ }
40
+ /**
41
+ * Copies this simulator's recent SpringBoard crash reports from DiagnosticReports and its Retired folder into
42
+ * `destDir`, which keeps at most 40 of them. The source folders are only read; macOS deletes their reports after
43
+ * about two days. Returns the matching reports now in `destDir`, how many matched but did not fit its limits, and
44
+ * the message of a write that failed.
45
+ */
46
+ async function copySpringBoardCrashReports({ udid, destDir, now = Date.now(), home = homedir() }) {
47
+ const since = now - REPORT_WINDOW_MS;
48
+ const reportsDir = join(home, "Library/Logs/DiagnosticReports");
49
+ const candidates = /* @__PURE__ */ new Map();
50
+ for (const directory of [reportsDir, join(reportsDir, "Retired")]) {
51
+ let names;
52
+ try {
53
+ names = await readdir(directory);
54
+ } catch (error) {
55
+ if (error instanceof Error && "code" in error && error.code === "ENOENT") continue;
56
+ throw error;
57
+ }
58
+ for (const name of names) {
59
+ if (!/^SpringBoard-.+\.ips$/.test(name) || candidates.has(name)) continue;
60
+ try {
61
+ const path = join(directory, name);
62
+ const { mtimeMs, size } = await stat(path);
63
+ if (mtimeMs >= since && size <= MAX_REPORT_BYTES) candidates.set(name, {
64
+ path,
65
+ mtimeMs
66
+ });
67
+ } catch {}
68
+ }
69
+ }
70
+ const newest = [...candidates].toSorted((a, b) => b[1].mtimeMs - a[1].mtimeMs).slice(0, MAX_CANDIDATES);
71
+ const entries = [];
72
+ for (const [name, { path }] of newest) try {
73
+ entries.push({
74
+ name,
75
+ text: await readFile(path, "utf8")
76
+ });
77
+ } catch {}
78
+ const matching = selectSpringBoardReports(entries, udid, since);
79
+ if (matching.length === 0) return {
80
+ files: [],
81
+ dropped: 0
82
+ };
83
+ await mkdir(destDir, {
84
+ recursive: true,
85
+ mode: 448
86
+ });
87
+ const present = new Set(await readdir(destDir));
88
+ let stored = [...present].filter((name) => /^SpringBoard-.+\.ips$/.test(name)).length;
89
+ let copiedBytes = 0;
90
+ const files = [];
91
+ for (const { name, text } of entries) {
92
+ if (!matching.includes(name)) continue;
93
+ if (present.has(name)) {
94
+ files.push(name);
95
+ continue;
96
+ }
97
+ const bytes = Buffer.byteLength(text);
98
+ if (stored >= MAX_STORED || copiedBytes + bytes > MAX_COPIED_BYTES) continue;
99
+ try {
100
+ await writeFile(join(destDir, name), text, {
101
+ flag: "wx",
102
+ mode: 384
103
+ });
104
+ } catch (error) {
105
+ if (error instanceof Error && "code" in error && error.code === "EEXIST") {
106
+ files.push(name);
107
+ continue;
108
+ }
109
+ await rm(join(destDir, name), { force: true }).catch(() => {});
110
+ return {
111
+ files,
112
+ dropped: 0,
113
+ failure: error instanceof Error ? error.message : String(error)
114
+ };
115
+ }
116
+ stored++;
117
+ copiedBytes += bytes;
118
+ files.push(name);
119
+ }
120
+ return {
121
+ files,
122
+ dropped: matching.length - files.length
123
+ };
124
+ }
125
+ //#endregion
126
+ //#region src/engine/ios-boot-log.ts
127
+ function iosBootRecorder(root, slot, udid) {
128
+ return (event, { level = "info", ...fields }) => {
129
+ try {
130
+ const writer = createNdjsonWriter(join(workspaceLogsDir$1(root), "device.ndjson"), { maxBytes: LOG_ROTATE_BYTES });
131
+ writer.write({
132
+ src: "device",
133
+ platform: "ios",
134
+ level,
135
+ event,
136
+ deviceId: udid,
137
+ ...slot && slot !== "default" ? { slot } : {},
138
+ ...fields
139
+ });
140
+ writer.close();
141
+ } catch {}
142
+ };
143
+ }
144
+ //#endregion
13
145
  //#region src/engine/device-ios.ts
14
- function startIosBoot(udid, configure, label, out, simulatorApp, root, deviceSlotWait) {
146
+ function recordBootPhase(record, udid, origin) {
147
+ return (event) => {
148
+ const pid = "pid" in event ? event.pid : void 0;
149
+ const boot = event.phase === "boot_requested" ? origin : void 0;
150
+ record("ios_boot", {
151
+ phase: event.phase,
152
+ ...pid === void 0 ? {} : { pid },
153
+ ...boot === void 0 ? {} : { boot },
154
+ msg: `ios boot ${udid}: ${event.phase}${pid === void 0 ? "" : ` pid ${pid}`}${boot === void 0 ? "" : ` (${boot})`}`
155
+ });
156
+ };
157
+ }
158
+ function startIosBoot(udid, configure, label, out, simulatorApp, root, slot, origin, deviceSlotWait) {
15
159
  const done = withDeviceBootAdmission({
16
160
  platform: "ios",
17
161
  key: udid
@@ -21,7 +165,8 @@ function startIosBoot(udid, configure, label, out, simulatorApp, root, deviceSlo
21
165
  label,
22
166
  out,
23
167
  simulatorApp,
24
- env: ambientContext()?.env
168
+ env: ambientContext()?.env,
169
+ onPhase: recordBootPhase(iosBootRecorder(root, slot, udid), udid, origin)
25
170
  });
26
171
  await configure();
27
172
  await muteBootedSimulator(udid, out);
@@ -93,12 +238,13 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
93
238
  owned: true,
94
239
  deviceName: name,
95
240
  ...record.simslimManaged ? { simslimManaged: true } : {},
241
+ ...record.simslimApplied ? { simslimApplied: record.simslimApplied } : {},
96
242
  ...record.adopted ? { adopted: true } : {},
97
243
  ...record.adoptionPending ? { adoptionPending: true } : {},
98
244
  ...record.parkedCacheKey ? { parkedCacheKey: record.parkedCacheKey } : {},
99
245
  ...record.schemeApprovals ? { schemeApprovals: record.schemeApprovals } : {}
100
246
  };
101
- const configure = async () => {
247
+ const configure = async (freshBoot) => {
102
248
  if (record.adoptionPending) await resetAdoptedSim(sim.udid, out);
103
249
  return configureOwnedIosSim({
104
250
  record: updated,
@@ -106,6 +252,7 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
106
252
  slot,
107
253
  profile: simslimProfile,
108
254
  slimByDefault: simslimDefault,
255
+ freshBoot,
109
256
  out,
110
257
  reconcileIosSimulator
111
258
  });
@@ -116,11 +263,13 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
116
263
  };
117
264
  if (sim.state !== "Booted") return {
118
265
  ...updated,
119
- booting: startIosBoot(sim.udid, configure, name, out, flags.simulatorApp, projectPath, flags.deviceSlotWait),
266
+ booting: startIosBoot(sim.udid, () => configure(true), name, out, flags.simulatorApp, projectPath, slot, record.adoptionPending ? "adopted" : "existing", flags.deviceSlotWait),
120
267
  ...facts
121
268
  };
269
+ const { record: configured, rebooted } = await configure(false);
270
+ if (rebooted) await muteBootedSimulator(sim.udid, out);
122
271
  return {
123
- ...await configure(),
272
+ ...configured,
124
273
  ...facts,
125
274
  booted: sim.udid
126
275
  };
@@ -162,10 +311,11 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
162
311
  slot,
163
312
  profile: simslimProfile,
164
313
  slimByDefault: simslimDefault,
314
+ freshBoot: true,
165
315
  out,
166
316
  reconcileIosSimulator
167
317
  });
168
- }, adopted.deviceName, out, flags.simulatorApp, projectPath, flags.deviceSlotWait);
318
+ }, adopted.deviceName, out, flags.simulatorApp, projectPath, slot, "adopted", flags.deviceSlotWait);
169
319
  return {
170
320
  ...adopted,
171
321
  booting,
@@ -197,9 +347,10 @@ async function ensureOwnedIosDevice({ record, projectPath, slot, settingsRoot, l
197
347
  slot,
198
348
  profile: simslimProfile,
199
349
  slimByDefault: simslimDefault,
350
+ freshBoot: true,
200
351
  out,
201
352
  reconcileIosSimulator
202
- }), created.name, out, flags.simulatorApp, projectPath, flags.deviceSlotWait);
353
+ }), created.name, out, flags.simulatorApp, projectPath, slot, "created", flags.deviceSlotWait);
203
354
  return {
204
355
  ...newRecord,
205
356
  created: true,
@@ -302,16 +453,36 @@ function clearIosAdoptionPending(projectPath, slot = "default") {
302
453
  saveConfig(cfg);
303
454
  });
304
455
  }
305
- async function configureOwnedIosSim({ record, projectPath, slot, profile, slimByDefault, out, reconcileIosSimulator }) {
456
+ function simslimProfileIdentity(profile, slimByDefault) {
457
+ if (profile) return `profile:${createHash("sha256").update(readFileSync(profile)).digest("hex")}`;
458
+ return slimByDefault ? "default" : null;
459
+ }
460
+ async function startedSpringBoardPid(udid) {
461
+ const springBoard = await waitForSpringBoard(udid, Date.now() + SPRINGBOARD_MUTE_WAIT_MS);
462
+ return springBoard.state === "started" ? springBoard.pid : null;
463
+ }
464
+ async function configureOwnedIosSim({ record, projectPath, slot, profile, slimByDefault, freshBoot, out, reconcileIosSimulator }) {
465
+ const identity = simslimProfileIdentity(profile, slimByDefault);
466
+ const slimConfigured = identity !== null || Boolean(record.simslimManaged);
467
+ const applied = record.simslimApplied;
468
+ const springBoardBefore = slimConfigured ? await readSpringBoardPid(record.deviceUdid) : null;
469
+ if (identity !== null && record.simslimManaged && !freshBoot && applied?.profile === identity && springBoardBefore !== null && springBoardBefore === applied.springBoardPid) {
470
+ await withConfigLockAsync$1(() => setDevice(projectPath, "ios", { ...record }, slot));
471
+ return {
472
+ record,
473
+ rebooted: false
474
+ };
475
+ }
306
476
  if (profile) out(chalk.dim(phaseLine("device", `applying the SimSlim profile to ${record.deviceUdid}`)));
307
477
  else if (slimByDefault) out(chalk.dim(phaseLine("device", `applying SimSlim's default services to ${record.deviceUdid}`)));
308
478
  else if (record.simslimManaged) out(chalk.dim(phaseLine("device", `restoring stock simulator services on ${record.deviceUdid}`)));
309
479
  const previouslyManaged = Boolean(record.simslimManaged);
310
- if ((profile || slimByDefault) && !record.simslimManaged) {
311
- const pending = {
312
- ...record,
480
+ if (identity !== null && !record.simslimManaged || applied) {
481
+ const { simslimApplied: _applied, ...rest } = record;
482
+ const pending = identity !== null ? {
483
+ ...rest,
313
484
  simslimManaged: true
314
- };
485
+ } : rest;
315
486
  await withConfigLockAsync$1(() => setDevice(projectPath, "ios", pending, slot));
316
487
  record = pending;
317
488
  }
@@ -326,24 +497,112 @@ async function configureOwnedIosSim({ record, projectPath, slot, profile, slimBy
326
497
  const updated = { ...record };
327
498
  if (result.managed) updated.simslimManaged = true;
328
499
  else delete updated.simslimManaged;
500
+ const springBoardAfter = slimConfigured ? await startedSpringBoardPid(record.deviceUdid) : null;
501
+ if (result.managed && !result.notInstalled && identity !== null && springBoardAfter !== null) updated.simslimApplied = {
502
+ profile: identity,
503
+ springBoardPid: springBoardAfter
504
+ };
329
505
  await withConfigLockAsync$1(() => setDevice(projectPath, "ios", updated, slot));
330
- return updated;
506
+ const rebooted = slimConfigured && springBoardAfter !== springBoardBefore;
507
+ if (rebooted && !result.notInstalled) iosBootRecorder(projectPath, slot, record.deviceUdid)("ios_boot", {
508
+ phase: "simslim_reboot",
509
+ pidBefore: springBoardBefore,
510
+ pidAfter: springBoardAfter,
511
+ msg: `ios boot ${record.deviceUdid}: simslim_reboot (SpringBoard pid ${springBoardBefore ?? "unknown"} to ${springBoardAfter ?? "unknown"})`
512
+ });
513
+ return {
514
+ record: updated,
515
+ rebooted
516
+ };
331
517
  }
332
- async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorApp, timeoutMs, pollMs, out }) {
518
+ const SPRINGBOARD_RESPAWN_POLLS = 20;
519
+ async function ensureIosBooted(args) {
520
+ const { springBoardDown, ...first } = await bootOwnedIosSim(args);
521
+ const { device, projectPath, out } = args;
522
+ const udid = device?.deviceUdid;
523
+ if (!springBoardDown || !device || !udid) return first;
524
+ out(chalk.yellow(phaseLine("device", `SpringBoard is not running on ${udid}; restarting the simulator once`)));
525
+ const record = iosBootRecorder(projectPath, args.slot, udid);
526
+ await preserveSpringBoardReports(record, udid, projectPath);
527
+ const stopped = await teardownOwnedIosSim(udid, { workspace: projectPath });
528
+ if (stopped.status !== "torn-down") return {
529
+ ...first,
530
+ reason: `${first.reason} The restart did not run: ${stopped.reason ?? stopped.status}.`
531
+ };
532
+ record("ios_boot", {
533
+ phase: "restart",
534
+ level: "warn",
535
+ msg: `ios boot ${udid}: restart (SpringBoard is not running after boot; restarting once)`
536
+ });
537
+ const { booted: _booted, booting: _booting, ...unbooted } = device;
538
+ const { springBoardDown: stillDown, ...second } = await bootOwnedIosSim({
539
+ ...args,
540
+ device: unbooted,
541
+ origin: "restart"
542
+ });
543
+ if (stillDown) await preserveSpringBoardReports(record, udid, projectPath);
544
+ return stillDown ? {
545
+ ...second,
546
+ reason: `${second.reason} Stim already restarted the simulator once, so it did not restart it again.`
547
+ } : second;
548
+ }
549
+ async function preserveSpringBoardReports(record, udid, root) {
550
+ const dir = workspaceLogsDir$1(root);
551
+ try {
552
+ const { files, dropped, failure } = await copySpringBoardCrashReports({
553
+ udid,
554
+ destDir: dir
555
+ });
556
+ const limit = dropped ? `; ${dropped} more matched but exceeded the copy limits` : "";
557
+ record("springboard_crash_reports", {
558
+ level: files.length || dropped || failure ? "warn" : "info",
559
+ files,
560
+ dropped,
561
+ ...failure ? { failure } : {},
562
+ dir,
563
+ msg: failure ? `could not copy a SpringBoard crash report for ${udid} (${files.length} copied before it): ${failure}` : files.length ? `copied ${files.length} SpringBoard crash report(s) for ${udid} to ${dir}: ${files.join(", ")}${limit}` : dropped ? `${dropped} SpringBoard crash report(s) for ${udid} matched but exceeded the copy limits` : `no SpringBoard crash report for ${udid} from the last 10 minutes`
564
+ });
565
+ } catch (error) {
566
+ record("springboard_crash_reports", {
567
+ level: "warn",
568
+ files: [],
569
+ dropped: 0,
570
+ failure: error instanceof Error ? error.message : String(error),
571
+ dir,
572
+ msg: `could not copy SpringBoard crash reports for ${udid}: ${error instanceof Error ? error.message : String(error)}`
573
+ });
574
+ }
575
+ }
576
+ async function bootOwnedIosSim({ device, projectPath, slot, origin, deviceSlotWait, simulatorApp, timeoutMs, pollMs, out }) {
333
577
  const udid = device?.deviceUdid;
334
578
  if (!udid) return {
335
579
  failed: true,
336
580
  reason: "No iOS simulator is recorded for this project."
337
581
  };
582
+ const onPhase = recordBootPhase(iosBootRecorder(projectPath, slot, udid), udid, origin ?? (device.adoptionPending ? "adopted" : "existing"));
583
+ const openViewer = async () => {
584
+ await configuredIosSimulatorViewer(simulatorApp, ambientContext()?.env).open(udid);
585
+ onPhase({ phase: "viewer_opened" });
586
+ };
338
587
  const ready = async () => {
339
588
  try {
340
- await getExecutor().runFileAsync("xcrun", [
589
+ const listSpringBoard = () => getExecutor().runFileAsync("xcrun", [
341
590
  "simctl",
342
591
  "spawn",
343
592
  udid,
344
593
  "launchctl",
345
594
  "list"
346
595
  ], { timeoutMs: 3e4 });
596
+ let listing = await listSpringBoard();
597
+ for (let poll = 0; !springBoardRunning(listing) && poll < SPRINGBOARD_RESPAWN_POLLS; poll++) {
598
+ await cancellableSleep(pollMs);
599
+ listing = await listSpringBoard();
600
+ }
601
+ if (!springBoardRunning(listing)) return {
602
+ failed: true,
603
+ springBoardDown: true,
604
+ reason: `Simulator ${udid} reports Booted, but SpringBoard (the system shell) is not running, so apps cannot launch. Run \`stim stop\`, then \`stim ios\` again. If it repeats, look for SpringBoard crash reports in ~/Library/Logs/DiagnosticReports.`
605
+ };
347
606
  return {
348
607
  ok: true,
349
608
  udid
@@ -366,7 +625,7 @@ async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorA
366
625
  }
367
626
  const readiness = device?.booted === udid ? await ready() : null;
368
627
  if (readiness?.ok) {
369
- if (simulatorApp !== void 0) await configuredIosSimulatorViewer(simulatorApp, ambientContext()?.env).open(udid);
628
+ if (simulatorApp !== void 0) await openViewer();
370
629
  return readiness;
371
630
  }
372
631
  let resolved;
@@ -389,7 +648,7 @@ async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorA
389
648
  const sim = resolved.sim;
390
649
  if (sim.state === "Booted") {
391
650
  const result = readiness ?? await ready();
392
- if (result.ok && simulatorApp !== void 0) await configuredIosSimulatorViewer(simulatorApp, ambientContext()?.env).open(udid);
651
+ if (result.ok && simulatorApp !== void 0) await openViewer();
393
652
  return result;
394
653
  }
395
654
  const bootDeadline = Date.now() + timeoutMs;
@@ -404,7 +663,8 @@ async function ensureIosBooted({ device, projectPath, deviceSlotWait, simulatorA
404
663
  label: sim.name,
405
664
  out,
406
665
  simulatorApp,
407
- env: ambientContext()?.env
666
+ env: ambientContext()?.env,
667
+ onPhase
408
668
  });
409
669
  await muteBootedSimulator(udid, out);
410
670
  }, {
@@ -1,8 +1,8 @@
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-BBvS1H6v.mjs";
4
- import { Qt as MANIFEST_VERIFY_TIMEOUT_MS, ln as APP_READINESS_TIMEOUT_MS } from "./budget-HyShrIpL.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-BpjwrQXU.mjs";
1
+ import { b as operationState } from "./exec-aULwtNly.mjs";
2
+ import { V as deviceSlotKey } from "./config-Cn94Jc0g.mjs";
3
+ import { a as formatElapsed, r as clockTime } from "./command-output-Dj-WT4BP.mjs";
4
+ import { Xt as APP_READINESS_TIMEOUT_MS, zt as MANIFEST_VERIFY_TIMEOUT_MS } from "./ccache-BWTze1Ls.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-Cd-ysFes.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 = MANIFEST_VERIFY_TIMEOUT_MS + APP_READINESS_TIMEOUT_MS;
@@ -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-BpjwrQXU.mjs";
3
- import { i as DEVICE_WAIT_POLL_MS, n as DEVICE_BUSY, o as leaseExpiryText } from "./device-lease-run-ogEeJ62K.mjs";
1
+ import { V as deviceSlotKey } from "./config-Cn94Jc0g.mjs";
2
+ import { A as selectPoolDevice, S as parseLease, b as leaseIsExpired, v as deviceLeasePath, y as fileLeaseIo } from "./activity-Cd-ysFes.mjs";
3
+ import { i as DEVICE_WAIT_POLL_MS, n as DEVICE_BUSY, o as leaseExpiryText } from "./device-lease-run-DwsGfjUN.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,17 +1,17 @@
1
- import { D as ownership_claim_exports, t as getExecutor } from "./exec-VFRpu1iA.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-BZhXY15H.mjs";
3
- import { l as phaseLine } from "./command-output-BBvS1H6v.mjs";
4
- import { l as androidDataPartitionSizeGbSetting, o as androidAvdConfigSetting } from "./settings-B5tCoq9N.mjs";
5
- import { s as ownedDeviceLabel } from "./project-BiC68mIp.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-Cjcj8MCw.mjs";
7
- import { c as pidExists } from "./metro-1pJgCX4U.mjs";
8
- import { O as teardownOwnedAvd, j as teardownParkedAvd } from "./workspaces-C9w4aeXF.mjs";
9
- import { h as tailLines } from "./activity-BpjwrQXU.mjs";
10
- import { F as memoryCulpritsUnderAsync, I as readHostMemoryPressure, R as reportMemoryCulprits, d as listAllIosSims, z as memoryCulpritAdvice } from "./ios-BQzvJlzw.mjs";
11
- import { t as clearDeviceIdleShutdown } from "./idle-shutdown-BIyfl0Zj.mjs";
12
- import { i as countLiveOwnedDevices, m as withDeviceBootAdmission, n as DeviceAdmissionRefusal } from "./device-capacity-ZYaRALv5.mjs";
13
- import { i as ensureOwnedIosDevice, r as ensureIosBooted } from "./device-ios-DkHBrmvH.mjs";
14
- import { t as reconcileSimSlim } from "./simslim-BjxszUAb.mjs";
1
+ import { D as ownership_claim_exports, t as getExecutor } from "./exec-aULwtNly.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-Cn94Jc0g.mjs";
3
+ import { l as phaseLine } from "./command-output-Dj-WT4BP.mjs";
4
+ import { l as androidDataPartitionSizeGbSetting, o as androidAvdConfigSetting } from "./settings-BDVI8Ivc.mjs";
5
+ import { s as ownedDeviceLabel } from "./project-DYj-HVx6.mjs";
6
+ import { 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, gt as isLegacyDeletionClaim, j as listAdbDevicesAsync, n as OWNED_AVD_CONFIG_DEFAULTS, nt as resolveOwnedAvdSerialAsync, p as assertOwnedAvdStoppedAsync, 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-DriNoAVy.mjs";
7
+ import { c as pidExists } from "./metro-CvyD-xwe.mjs";
8
+ import { pt as teardownParkedAvd, ut as teardownOwnedAvd } from "./workspaces-DFbj07jp.mjs";
9
+ import { h as tailLines } from "./activity-Cd-ysFes.mjs";
10
+ import { B as reportMemoryCulprits, L as memoryCulpritsUnderAsync, R as readHostMemoryPressure, V as memoryCulpritAdvice, f as listAllIosSimsAsync } from "./ios-E26qSpkb.mjs";
11
+ import { h as withDeviceBootAdmission, n as DeviceAdmissionRefusal, o as countLiveOwnedDevicesFrom } from "./device-capacity-6LP7QsaA.mjs";
12
+ import { t as clearDeviceIdleShutdown } from "./idle-shutdown-Cbvo5KEh.mjs";
13
+ import { i as ensureOwnedIosDevice, r as ensureIosBooted } from "./device-ios-534c14fz.mjs";
14
+ import { t as reconcileSimSlim } from "./simslim-DCQwzoPy.mjs";
15
15
  import { claimRemoveCommand, clearClaimChild, markClaimChildPending, processGroupAlive, releaseClaim, setClaimChild } from "@stim-cli/core/ownership-claim";
16
16
  import { randomUUID } from "node:crypto";
17
17
  import { existsSync } from "node:fs";
@@ -202,7 +202,7 @@ async function prepareOwnedAvd({ projectPath, slot, label, previousAvdName, syst
202
202
  await withConfigLockAsync$1(assertReservation);
203
203
  const resolved = await resolveOwnedAvdSerialAsync(avdName);
204
204
  if (resolved.missing || resolved.notOwned) throw new Error(`AVD ${avdName} could not be verified for recovery. Retry after checking its registration.`, { cause: error });
205
- if (!resolved.serial) assertOwnedAvdStopped(avdName);
205
+ if (!resolved.serial) await assertOwnedAvdStoppedAsync(avdName);
206
206
  prepared = {
207
207
  avdName,
208
208
  created: false,
@@ -377,7 +377,7 @@ async function ensureOwnedAndroidDevice({ record, projectPath, slot, settingsRoo
377
377
  }
378
378
  if (resolved.notOwned || resolved.serial) continue;
379
379
  try {
380
- assertOwnedAvdStopped(parked.name);
380
+ await assertOwnedAvdStoppedAsync(parked.name);
381
381
  } catch (error) {
382
382
  out(phaseLine("device", `kept parked ${parked.name}: ${String(error?.message || error)}`));
383
383
  continue;
@@ -485,8 +485,8 @@ function claimAndroidConsolePort({ projectPath, slot, avdName, deviceName, liveP
485
485
  return claim;
486
486
  });
487
487
  }
488
- function liveAndroidConsolePorts() {
489
- const adbLive = listAdbDevices();
488
+ async function liveAndroidConsolePorts() {
489
+ const adbLive = await listAdbDevicesAsync();
490
490
  return [...adbLive.emulators.map((e) => e.consolePort), ...adbLive.unhealthy.map((u) => u.consolePort).filter((p) => p != null)];
491
491
  }
492
492
  async function bootOwnedAvdOnFreshPort({ avdName, deviceSlotWait, metadata, projectPath, slot, deviceName, out, logFile = null, alive = pidExists }) {
@@ -494,7 +494,7 @@ async function bootOwnedAvdOnFreshPort({ avdName, deviceSlotWait, metadata, proj
494
494
  platform: "android",
495
495
  key: avdName
496
496
  }, async () => {
497
- const livePorts = liveAndroidConsolePorts();
497
+ const livePorts = await liveAndroidConsolePorts();
498
498
  const claim = await withConfigLockAsync$1(() => claimAndroidConsolePort({
499
499
  projectPath,
500
500
  slot,
@@ -599,10 +599,10 @@ function reportAndroidMemoryPressure(out) {
599
599
  async function androidBootRemedy(pressure) {
600
600
  let count = null;
601
601
  try {
602
- const live = countLiveOwnedDevices({
603
- sims: () => process.platform === "darwin" ? listAllIosSims({ timeoutMs: 2e3 }) : [],
604
- adb: () => ({
605
- ...listAdbDevices({ timeoutMs: 2e3 }),
602
+ const live = await countLiveOwnedDevicesFrom({
603
+ sims: () => process.platform === "darwin" ? listAllIosSimsAsync({ timeoutMs: 2e3 }) : [],
604
+ adb: async () => ({
605
+ ...await listAdbDevicesAsync({ timeoutMs: 2e3 }),
606
606
  unhealthy: []
607
607
  }),
608
608
  booting: []
@@ -685,7 +685,7 @@ async function ensureAndroidBooted({ device, deviceSlotWait, projectPath, slot,
685
685
  out
686
686
  }));
687
687
  const boot = async () => {
688
- const livePorts = liveAndroidConsolePorts();
688
+ const livePorts = await liveAndroidConsolePorts();
689
689
  const claim = await withConfigLockAsync$1(() => claimAndroidConsolePort({
690
690
  projectPath,
691
691
  slot,
@@ -785,6 +785,7 @@ async function ensureBooted({ platform, device, simulatorApp, timeoutMs, pollMs
785
785
  if (platform === "ios") return ensureIosBooted({
786
786
  device,
787
787
  projectPath,
788
+ slot,
788
789
  deviceSlotWait,
789
790
  simulatorApp,
790
791
  timeoutMs: timeoutMs ?? 6e5,
@@ -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-k3P3PizH.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-DyqE9n1J.mjs";
2
2
  export { applySandboxFix, doctorCommand as default, doctorSuccessLines, parseDoctorPlatform, readDoctorReport, shadowedStimFinding, toolchainReport };
@@ -1,17 +1,17 @@
1
- import { Y as doctorIo, _ as loadConfig$1, p as getProject } from "./config-BZhXY15H.mjs";
2
- import { f as refuseNoProject, l as phaseLine } from "./command-output-BBvS1H6v.mjs";
3
- import { Nt as repoRoot, R as projectSettingsContextAsync } from "./settings-B5tCoq9N.mjs";
4
- import { f as projectRegistry, t as NO_PROJECT_REFUSAL } from "./project-BiC68mIp.mjs";
5
- import { c as inspectStimVersions, s as compareStimVersions } from "./eas-session-ledger-BMCA1gdO.mjs";
6
- import { a as inspectBudget, dr as inspectWatchmanMemory, hr as memorySweepIsScoped, n as budgetLine } from "./budget-HyShrIpL.mjs";
7
- import { B as memoryCulpritFindings, V as readMemoryCulpritsAsync, f as listAllIosSimsAsync, h as listIosRuntimesAsync, l as iosRuntimeMatches, x as pickDefaultIosCreation } from "./ios-BQzvJlzw.mjs";
8
- import { c as detectXcodeMajorAsync } from "./xcode-CiIIDnuD.mjs";
9
- import { s as offloadCheck } from "./client-BQsmyp_-.mjs";
10
- import { l as inspectBuildMachines, p as inspectDeviceHostMachines } from "./selection-D5cxEl3t.mjs";
11
- import { r as maintenanceStatus, t as maintenanceLine } from "./status-Fect2w9R.mjs";
12
- import { a as writeIgnoreDirs, c as recordDoctorRun, i as watchedCheckouts, n as inspectNestedWorktrees, r as nestedWorktreeFinding } from "./doctor-watchman-BovI1y3-.mjs";
13
- import { c as checkWorktreeStorageLayout, l as readMachineSettings, o as runDoctor } from "./doctor-Bm8TVpGn.mjs";
14
- import { h as resolveDeviceType, v as resolveRuntime } from "./support-qKcbgmI5.mjs";
1
+ import { Q as doctorIo, _ as loadConfig$1, p as getProject } from "./config-Cn94Jc0g.mjs";
2
+ import { f as refuseNoProject, l as phaseLine } from "./command-output-Dj-WT4BP.mjs";
3
+ import { It as repoRoot, z as projectSettingsContextAsync } from "./settings-BDVI8Ivc.mjs";
4
+ import { f as projectRegistry, t as NO_PROJECT_REFUSAL } from "./project-DYj-HVx6.mjs";
5
+ import { Qn as inspectWatchmanMemory, f as inspectBudget, l as budgetLine, nr as memorySweepIsScoped } from "./ccache-BWTze1Ls.mjs";
6
+ import { c as inspectStimVersions, s as compareStimVersions } from "./eas-session-ledger-DrP4OuuM.mjs";
7
+ import { I as detectXcodeMajorAsync } from "./toolchain-CbCG6C5Z.mjs";
8
+ import { H as memoryCulpritFindings, U as readMemoryCulpritsAsync, f as listAllIosSimsAsync, h as listIosRuntimesAsync, l as iosRuntimeMatches, x as pickDefaultIosCreation } from "./ios-E26qSpkb.mjs";
9
+ import { s as offloadCheck } from "./client-xsdxrhWA.mjs";
10
+ import { g as configuredMachines, p as inspectBuildMachines, v as inspectDeviceHostMachines } from "./selection-Bs8phwhN.mjs";
11
+ import { r as maintenanceStatus, t as maintenanceLine } from "./status-7ULDEJ1e.mjs";
12
+ import { a as writeIgnoreDirs, c as recordDoctorRun, i as watchedCheckouts, n as inspectNestedWorktrees, r as nestedWorktreeFinding } from "./doctor-watchman-CxDbyrrt.mjs";
13
+ import { c as checkWorktreeStorageLayout, l as readMachineSettings, o as runDoctor } from "./doctor-F-3VUUyN.mjs";
14
+ import { h as resolveDeviceType, v as resolveRuntime } from "./support-Be0UeVZU.mjs";
15
15
  import { isJsonObject, maintenanceNdjsonFile, readHostedAppMetadata, readHostedSessions } from "@stim-cli/core/state";
16
16
  import { dirname, join, sep } from "path";
17
17
  import chalk from "chalk";
@@ -419,6 +419,16 @@ async function prepareDoctor(root, platform, registry, operation) {
419
419
  doctors: await selected.load()
420
420
  };
421
421
  }
422
+ function withPriority(machines) {
423
+ const order = configuredMachines() ?? [];
424
+ return machines.map((each) => {
425
+ const at = order.indexOf(each.machine);
426
+ return at < 0 ? each : {
427
+ ...each,
428
+ priority: at + 1
429
+ };
430
+ });
431
+ }
422
432
  async function readDoctorReport(operation, platform, version, requestAccess = false) {
423
433
  const found = projectRegistry.findProjectRoot(operation.projectRoot);
424
434
  if (!found) throw Object.assign(new Error(NO_PROJECT_REFUSAL.message), NO_PROJECT_REFUSAL);
@@ -515,8 +525,8 @@ async function assembleDoctorReport(root, opts, version, prepared, inspectVersio
515
525
  ...maintenance,
516
526
  logPath: maintenanceNdjsonFile()
517
527
  },
518
- remoteMachines: remoteMachines.machines,
519
- deviceHosts: deviceHostMachines.machines,
528
+ remoteMachines: withPriority(remoteMachines.machines),
529
+ deviceHosts: withPriority(deviceHostMachines.machines),
520
530
  toolchain,
521
531
  findings
522
532
  };
@@ -568,7 +578,9 @@ function doctorCommand(program, version, inspectVersions = inspectStimVersions,
568
578
  const report = await assembleDoctorReport(root, opts, version, prepared, inspectVersions, host);
569
579
  const { findings, stim, toolchain, maintenance } = report;
570
580
  const budget = { report: report.budget };
581
+ const order = (configuredMachines() ?? []).map((machine, at) => `${at + 1} ${machine}`);
571
582
  const maintenanceLines = [
583
+ ...order.length ? [phaseLine("placement order", `${order.join(", ")} (first with room and load under its limit)`)] : [],
572
584
  phaseLine("maintenance.mode", maintenance.mode),
573
585
  phaseLine("maintenance log", maintenanceNdjsonFile()),
574
586
  phaseLine("last pass", maintenanceLine(maintenance, false) ?? "no pass has run yet")