stim 1.20.2 → 1.22.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 (231) hide show
  1. package/README.md +141 -8
  2. package/dist/acquire-artifact-Co2k4f7O.mjs +171 -0
  3. package/dist/act-DsuqEkiM.mjs +2801 -0
  4. package/dist/activity-CMLmzp7o.mjs +1397 -0
  5. package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-DUFaTMdd.mjs} +23 -67
  6. package/dist/{android-DCKZrNvV.mjs → android-ByRMUoiJ.mjs} +157 -93
  7. package/dist/{android-Mz_Inn3w.mjs → android-C7sVmyI9.mjs} +299 -116
  8. package/dist/{android-Dlzxshgp.mjs → android-DGkNqa_c.mjs} +5 -5
  9. package/dist/{android-HqP1_vB_.mjs → android-DR5lZ2Az.mjs} +2 -2
  10. package/dist/android-cas-compiler.mjs +2 -2
  11. package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-ngferVq2.mjs} +7 -6
  12. package/dist/android-project-BCAAmMwz.mjs +12 -0
  13. package/dist/android-project-DVWyCbWU.d.mts +391 -0
  14. package/dist/api.d.mts +810 -64
  15. package/dist/api.mjs +782 -1
  16. package/dist/{artifact-HSwkIWEQ.mjs → artifact-8EY8SAPw.mjs} +240 -213
  17. package/dist/{artifact-D3czlUvT.mjs → artifact-DJPy518Y.mjs} +203 -164
  18. package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
  19. package/dist/{browser-web-CA-F1GQo.mjs → browser-web-Bcv99PBM.mjs} +194 -64
  20. package/dist/budget-Cvwn54qV.mjs +9285 -0
  21. package/dist/{build-DYDbfkk5.mjs → build-CabC3G23.mjs} +153 -98
  22. package/dist/build-cache-Dv7RN200.mjs +602 -0
  23. package/dist/build-plan-DUC8Ka9y.mjs +248 -0
  24. package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DSeQjt-Q.mjs} +2 -2
  25. package/dist/cache-manifest.mjs +1 -1
  26. package/dist/{ccache-zdKiYQ3E.mjs → ccache-Btwc36-I.mjs} +10 -9
  27. package/dist/{cdp-Dq_ypAlJ.mjs → cdp-3fwICjzi.mjs} +18 -5
  28. package/dist/{chrome-BnzZMqsR.mjs → chrome-Bbw689-6.mjs} +7 -4
  29. package/dist/{cli-CLP3diBm.mjs → cli-CHZa9Lvk.mjs} +20 -20
  30. package/dist/cli.mjs +1 -1
  31. package/dist/client-OyRoEuSr.mjs +1577 -0
  32. package/dist/collector-run.d.mts +4 -40
  33. package/dist/collector-run.mjs +9 -8
  34. package/dist/{command-output-BTy8hZ0F.mjs → command-output-gwpm28fu.mjs} +1 -1
  35. package/dist/config-DlrsduwG.mjs +955 -0
  36. package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-x9rN6bhs.mjs} +14 -4
  37. package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-1I9KZT1Y.mjs} +20 -5
  38. package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
  39. package/dist/{dev-client-DAWVIGBu.mjs → dev-client-BSDR5h3F.mjs} +2 -2
  40. package/dist/{device-BECOiufl.mjs → device-B-L3Fbxy.mjs} +91 -34
  41. package/dist/device-DklWZLqb.mjs +1068 -0
  42. package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-DK5_EwRS.mjs} +42 -13
  43. package/dist/device-host-worker.mjs +76 -79
  44. package/dist/{device-ios-COSi6oS1.mjs → device-ios-DoB6KFCO.mjs} +77 -51
  45. package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-xJPQ_QQG.mjs} +14 -26
  46. package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-BMkdsefq.mjs} +5 -5
  47. package/dist/{doctor-kfMBnUw6.mjs → doctor-Bo7BXLux.mjs} +271 -320
  48. package/dist/{doctor-CB8oZKCk.mjs → doctor-D5_EzwfA.mjs} +186 -91
  49. package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
  50. package/dist/doctor-fingerprint.mjs +19 -0
  51. package/dist/doctor-thjWAV0z.mjs +2 -0
  52. package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-N2wDotwQ.mjs} +40 -21
  53. package/dist/{eas-build-JyfqyHfC.mjs → eas-build-CwknaQYj.mjs} +53 -20
  54. package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-CSgAulr5.mjs} +41 -214
  55. package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-DlY_serQ.mjs} +230 -11
  56. package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-DBWO2rxE.mjs} +172 -82
  57. package/dist/exec-DEoAhcze.mjs +858 -0
  58. package/dist/exec-DnYc4HGH.d.mts +78 -0
  59. package/dist/{gc-qWOMdnER.mjs → gc-CXxN-4SE.mjs} +1091 -1029
  60. package/dist/gc-DnNDQyaP.mjs +3 -0
  61. package/dist/{guide-G9cAbVAc.mjs → guide-Br0LEfKy.mjs} +1165 -297
  62. package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-B-9f-jkd.mjs} +10 -8
  63. package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DZAPrcro.mjs} +34 -19
  64. package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CsCS21hn.mjs} +1 -1
  65. package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-FIRx9X2f.mjs} +77 -43
  66. package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-_awYSpfv.mjs} +35 -22
  67. package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-BdzE668-.mjs} +49 -27
  68. package/dist/idle-C4cZ757K.d.mts +24 -0
  69. package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DDg3SdvY.mjs} +11 -10
  70. package/dist/ios-CDvlmUs7.d.mts +24 -0
  71. package/dist/{ios-BwVCF7oA.mjs → ios-Ds1clbIt.mjs} +8 -8
  72. package/dist/{ios-device-D7pi2Sca.mjs → ios-device--h_-8ENa.mjs} +51 -26
  73. package/dist/{ios-device-B5veSDDQ.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
  74. package/dist/{ios-RkW4pnQf.mjs → ios-hcBpnEGk.mjs} +200 -93
  75. package/dist/{ios-Ce7bc7br.mjs → ios-pm4nL6By.mjs} +160 -108
  76. package/dist/{ios-project-K9hY_Jab.mjs → ios-project-CZhKODF3.mjs} +13 -13
  77. package/dist/ios-signing-BtAffm0A.mjs +489 -0
  78. package/dist/{ios-state-CBLe1xYw.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
  79. package/dist/{ios-nOLJGVdy.mjs → ios-xtlRHaeB.mjs} +1 -1
  80. package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Bwhh4S7V.mjs} +30 -25
  81. package/dist/{launch-C3qJ6Agb.mjs → launch-BjxemNpK.mjs} +85 -543
  82. package/dist/{launch-F4sOqAhB.mjs → launch-CCzXlc8r.mjs} +91 -90
  83. package/dist/logs-BfwwadsZ.mjs +479 -0
  84. package/dist/logs-jTS_lHSo.mjs +248 -0
  85. package/dist/{macos-D7uDvO-z.mjs → macos-DVlSSyUg.mjs} +1 -1
  86. package/dist/macos-NfV2D7dO.mjs +694 -0
  87. package/dist/macos-run.mjs +1 -1
  88. package/dist/maintenance-run.mjs +123 -248
  89. package/dist/{metro-DnCEjCxs.mjs → metro-DiXtA3Ty.mjs} +107 -30
  90. package/dist/metro-gateway-CKZqKqx7.mjs +209 -0
  91. package/dist/{named-ports-4WopRPg-.mjs → named-ports-DkEzOfzO.mjs} +42 -90
  92. package/dist/native-android-CqgnOgsT.mjs +645 -0
  93. package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
  94. package/dist/native-gradle-inputs-Dnh84Zbd.mjs +211 -0
  95. package/dist/native-inputs-TRTTTRxt.mjs +91 -0
  96. package/dist/native-run-NwUuxbkg.mjs +276 -0
  97. package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-B7KIafpM.mjs} +11 -9
  98. package/dist/native-source-Y0yLhFyQ.mjs +133 -0
  99. package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-D_VOfFL7.mjs} +26 -18
  100. package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-BYDOHWLN.mjs} +104 -60
  101. package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
  102. package/dist/offload-worker.d.mts +59 -41
  103. package/dist/offload-worker.mjs +478 -115
  104. package/dist/operation-exec-BW0em61G.mjs +171 -0
  105. package/dist/{ownership-DCtw_2IA.mjs → ownership-C5fo5Edb.mjs} +3 -3
  106. package/dist/{page-DRHy329N.mjs → page-DBL2PiUU.mjs} +12 -5
  107. package/dist/paths-BsJMoPP2.mjs +12 -0
  108. package/dist/paths-DQtTgsBf.mjs +42 -0
  109. package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BnGgJRRZ.mjs} +5 -5
  110. package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-DIsMtN-d.mjs} +15 -11
  111. package/dist/{ports-DdSUicVo.mjs → ports-Cy1RkmuQ.mjs} +3 -3
  112. package/dist/prebuild-D4JoEAEs.mjs +484 -0
  113. package/dist/{project-_phNIJfs.mjs → project-wM_XFTvE.mjs} +65 -37
  114. package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-W1IuLXDt.mjs} +102 -20
  115. package/dist/pull-request-eODyIqZF.d.mts +124 -0
  116. package/dist/pull-requests.d.mts +2 -120
  117. package/dist/pull-requests.mjs +2 -2
  118. package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-6OZ7MSM7.mjs} +121 -72
  119. package/dist/{gradle-DSrXb6lG.mjs → react-native-build-Dvd8hC21.mjs} +292 -15
  120. package/dist/react-native-doctor-DsoSF1Y9.mjs +234 -0
  121. package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-4u1Rn-GR.mjs} +71 -39
  122. package/dist/{recordings-D0d5aQt0.mjs → recordings-CQmfzAh7.mjs} +12 -9
  123. package/dist/registration-BcRgF6Ox.mjs +51 -0
  124. package/dist/{reload-C8JhxjSh.mjs → reload-BzkYabB-.mjs} +94 -47
  125. package/dist/reload-D7AVlb8N.mjs +2 -0
  126. package/dist/{remote-BiR6aYjy.mjs → remote-DjGDmlTZ.mjs} +26 -18
  127. package/dist/result-D2Ykz_iD.mjs +435 -0
  128. package/dist/{run-BtPgpKks.mjs → run-DidHghD1.mjs} +5 -5
  129. package/dist/selection-DSMbWEX2.mjs +620 -0
  130. package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CafzuyFB.mjs} +3 -4
  131. package/dist/{server-command-CTtCkmcQ.mjs → server-command-C6QjeupS.mjs} +14 -7
  132. package/dist/{server-expo-DsguMGUF.mjs → server-expo-CrjB29pq.mjs} +54 -11
  133. package/dist/server-expo-D58c9L0M.mjs +2 -0
  134. package/dist/{settings-B717odTD.mjs → settings-C7O8A6ZI.mjs} +309 -119
  135. package/dist/settings-DpR-1Wnn.mjs +114 -0
  136. package/dist/settings-write-CzD60rOD.mjs +360 -0
  137. package/dist/settings.schema.json +176 -16
  138. package/dist/{simslim-CCr3rE-A.mjs → simslim-BNckWpXi.mjs} +14 -12
  139. package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-CbfmNgM6.mjs} +15 -20
  140. package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
  141. package/dist/stage-Bps5oius.mjs +200 -0
  142. package/dist/{start-TXeMmmO2.mjs → start-Br-oxqMD.mjs} +1 -1
  143. package/dist/start-EojN4WFz.mjs +1364 -0
  144. package/dist/{state-D1Icyjlu.mjs → state--smjFSTL.mjs} +55 -13
  145. package/dist/{state-CG_OFoaA.mjs → state-08I3hw3_.mjs} +3 -2
  146. package/dist/{stats-BoY5sEPU.mjs → stats-D3GerlFW.mjs} +7 -13
  147. package/dist/stats-report-BzaPrRm6.mjs +16 -0
  148. package/dist/{status-BTA7kKiQ.mjs → status-BRROykC8.mjs} +7 -5
  149. package/dist/status-EvrK72L2.mjs +2 -0
  150. package/dist/{status-WgFbkRzj.mjs → status-WBDajew2.mjs} +554 -452
  151. package/dist/{status-watch-C23ILtf9.mjs → status-watch-Bg_u-pwR.mjs} +222 -25
  152. package/dist/status-worker.d.mts +1 -0
  153. package/dist/status-worker.mjs +19 -0
  154. package/dist/stim-desktop-D5OGpYZM.mjs +112 -0
  155. package/dist/{stop-DR6VoDIk.mjs → stop-DTZ9uTw3.mjs} +2 -2
  156. package/dist/{stop-DPEhunlw.mjs → stop-Dky10AEJ.mjs} +33 -23
  157. package/dist/{stop-BNmBMi1F.mjs → stop-Mv6W9FAk.mjs} +137 -98
  158. package/dist/supervisor-run.d.mts +8 -17
  159. package/dist/supervisor-run.mjs +56 -28
  160. package/dist/{support-CwjbFs9H.mjs → support-CNioewsd.mjs} +14 -14
  161. package/dist/{support-DMTqj3Hm.mjs → support-yUiOjnVY.mjs} +20 -13
  162. package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
  163. package/dist/swiftpm-macos-BIak-Rxv.mjs +532 -0
  164. package/dist/toolchain-BY8X8HXx.mjs +2 -0
  165. package/dist/toolchain-DpJMHq0n.mjs +876 -0
  166. package/dist/{trigger-CigAYjeL.mjs → trigger-Cbyc41d_.mjs} +21 -6
  167. package/dist/trigger-yb_nFzPF.mjs +2 -0
  168. package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-CA3TgT3-.mjs} +263 -156
  169. package/dist/web-CZ07gd77.mjs +2 -0
  170. package/dist/{web-BDBMxDpx.mjs → web-DKx6yoFA.mjs} +20 -14
  171. package/dist/web-run.mjs +13 -12
  172. package/dist/windows-report.d.mts +1 -0
  173. package/dist/windows-report.mjs +18 -0
  174. package/dist/windows-report.ps1 +43 -0
  175. package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-U08dEzhG.mjs} +62 -58
  176. package/dist/{workspaces-C36s2jb9.mjs → workspaces-CpANmBlq.mjs} +1723 -1286
  177. package/dist/{worktree-CgvJYJ-Q.mjs → worktree-CHecZ4Oq.mjs} +1097 -547
  178. package/dist/worktree-ZqZVjD9K.mjs +2 -0
  179. package/dist/xcode-BXn9-xYx.mjs +896 -0
  180. package/package.json +7 -5
  181. package/shim/android-audio/Main.java +24 -0
  182. package/shim/android-audio/README.md +17 -0
  183. package/shim/android-audio.jar +0 -0
  184. package/shim/android-optimizations.gradle +7 -5
  185. package/dist/activity-BSV745Kz.mjs +0 -629
  186. package/dist/api-qvOzWyfO.mjs +0 -154
  187. package/dist/api-run.mjs +0 -294
  188. package/dist/app-install-BIKtMfPq.mjs +0 -896
  189. package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
  190. package/dist/budget-f7516Zk0.mjs +0 -4106
  191. package/dist/build-facts-DcLv2HSd.d.mts +0 -111
  192. package/dist/cancellation-C_22VQTH.mjs +0 -24
  193. package/dist/client-qQAaXSUs.mjs +0 -1771
  194. package/dist/config-BYDxlMY3.mjs +0 -562
  195. package/dist/device-DuiPJQSn.mjs +0 -290
  196. package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
  197. package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
  198. package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
  199. package/dist/exec-DqKo9GKJ.mjs +0 -268
  200. package/dist/git-DDfFzkMm.mjs +0 -45
  201. package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
  202. package/dist/logs-BGrEUaEs.mjs +0 -383
  203. package/dist/macos-Ch5VJmcS.mjs +0 -584
  204. package/dist/metro-gateway-CX9Xlkq2.mjs +0 -103
  205. package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
  206. package/dist/native-android-D5qc3-_v.mjs +0 -226
  207. package/dist/native-gradle-inputs-BsLRrl7u.mjs +0 -349
  208. package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
  209. package/dist/plan-C4TjdPsR.mjs +0 -260
  210. package/dist/prebuild-DYbucPXy.mjs +0 -212
  211. package/dist/preview-78a9kR_-.mjs +0 -1011
  212. package/dist/react-native-build-CtCccJtb.mjs +0 -239
  213. package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
  214. package/dist/remote-cache-OyOyVIS3.mjs +0 -526
  215. package/dist/result-CaJg5Iat.mjs +0 -186
  216. package/dist/server-expo-Bigriskl.mjs +0 -2
  217. package/dist/settings-BORNaaCO.mjs +0 -402
  218. package/dist/settings-vk3mJGSm.d.mts +0 -13
  219. package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
  220. package/dist/stage-KNTQopqv.mjs +0 -157
  221. package/dist/start-BWqzODpb.mjs +0 -1116
  222. package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
  223. package/dist/swiftpm-macos-DRNVJWlb.mjs +0 -119
  224. package/dist/tailnet-Dh-qiYzG.mjs +0 -265
  225. package/dist/toolchain-BFkAcstd.mjs +0 -2
  226. package/dist/toolchain-DxSsNssu.mjs +0 -1657
  227. package/dist/trigger-9_USgmxz.mjs +0 -2
  228. package/dist/web-Dq-i3wzJ.mjs +0 -2
  229. package/dist/worktree-DpLdCHga.mjs +0 -2
  230. package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
  231. package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
@@ -1,23 +1,17 @@
1
- import { _ as loadConfig$1, p as getProject } from "./config-BYDxlMY3.mjs";
2
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
3
- import { Ft as makeTemporaryDirectory, It as removeTemporaryEntry, ot as detectProviders, st as planMetroReach } from "./settings-B717odTD.mjs";
4
- import { w as entryDir, y as artifactIn } from "./device-lease-BX1sJQ2E.mjs";
5
- import { i as formatDuration, l as phaseLine, m as shortHash, u as plural } from "./command-output-BTy8hZ0F.mjs";
6
- import { N as readRemoteSession, j as readMetroTunnel } from "./project-_phNIJfs.mjs";
7
- import { Mt as readStats$1, s as peekBudget, wt as estimateBuild } from "./budget-f7516Zk0.mjs";
8
- import { a as easAuthNote, f as resolveEasCliBin, s as isEasAuthFailureText } from "./remote-cache-OyOyVIS3.mjs";
9
- import { S as hostingMachines, h as namedBuildMachine, v as resolveBuildMachine } from "./client-qQAaXSUs.mjs";
10
- import { P as readHostMemoryPressure } from "./ios-RkW4pnQf.mjs";
11
- import { r as predictBuildMiss } from "./miss-reason-mKzZ4VvN.mjs";
12
- import { s as peekDeviceSlots } from "./device-capacity-CBUAcRyQ.mjs";
13
- import { c as connectHost, f as requireHostedAppMode, s as call } from "./hosted-client-ZEKpS9vw.mjs";
14
- import { r as readHostedNative, s as writeHostedNative } from "./ios-state-CBLe1xYw.mjs";
15
- import { n as prepareHostedNative } from "./hosted-native-A4s1QPXe.mjs";
16
- import { h as easCliSupport, m as MIN_EAS_CLI_SIMULATOR_VERSION, p as MIN_EAS_CLI_DEVICE_VERSION, s as readInstalledEasCliVersion } from "./device-remote-xRT0Vmo9.mjs";
17
- import { i as staleNativeDirRefusal } from "./prebuild-DYbucPXy.mjs";
1
+ import { t as getExecutor } from "./exec-DEoAhcze.mjs";
2
+ import { _ as loadConfig$1, p as getProject } from "./config-DlrsduwG.mjs";
3
+ import { f as throwIfCancelled, r as childEnvironment } from "./operation-exec-BW0em61G.mjs";
4
+ import { ct as detectProviders, lt as planMetroReach } from "./settings-C7O8A6ZI.mjs";
5
+ import { M as readMetroTunnel, P as readRemoteSession } from "./project-wM_XFTvE.mjs";
6
+ import { $n as MIN_EAS_CLI_DEVICE_VERSION, Hn as isEasAuthFailureText, Ht as readInstalledEasCliVersionAsync, Qn as remoteCommand, er as MIN_EAS_CLI_SIMULATOR_VERSION, qn as resolveEasCliBin, s as peekBudget, tr as easCliSupport } from "./budget-Cvwn54qV.mjs";
7
+ import { F as readHostMemoryPressureAsync } from "./ios-hcBpnEGk.mjs";
8
+ import { d as hostingMachines, o as resolveBuildMachine, r as namedBuildMachine } from "./selection-DSMbWEX2.mjs";
9
+ import { c as call, l as connectHost, p as requireHostedAppMode } from "./hosted-client-DZAPrcro.mjs";
10
+ import { r as readHostedNative, s as writeHostedNative } from "./ios-state-Dtw5K2aI.mjs";
11
+ import { n as prepareHostedNative } from "./hosted-native-BdzE668-.mjs";
12
+ import { c as peekDeviceSlots } from "./device-capacity-DK5_EwRS.mjs";
13
+ import { ambientEnv } from "@stim-cli/core";
18
14
  import { automaticMachineEnabled, isJsonObject, machineCapacity, parseHostedChoice, parseHostedNativeOffer } from "@stim-cli/core/state";
19
- import { resolveTieredBuild } from "@stim-cli/cache";
20
- import chalk from "chalk";
21
15
  //#region src/device-host/placement.ts
22
16
  function local$1(code, reason, skipped = [], atCapacity = false) {
23
17
  return {
@@ -85,7 +79,7 @@ function decideDevicePlacement(inputs) {
85
79
  atCapacity: true
86
80
  };
87
81
  };
88
- if (!offers.length) return nowhere("no-remote-mac", "no remote Macs configured; " + localReason);
82
+ if (!offers.length) return nowhere("no-remote-mac", "no remote machines configured; " + localReason);
89
83
  if (localEnabled && count === null) return local$1("device-count-unknown", localReason);
90
84
  if (!cannotTake && here.memoryPressure === "normal" && !here.budgetRefusal && here.loadPerCore < here.maxLoadPerCore) return local$1("this-mac-free", localReason);
91
85
  const skipped = [];
@@ -100,7 +94,7 @@ function decideDevicePlacement(inputs) {
100
94
  else if (offer.platform !== platform || !offer.choice) [code, reason] = ["no-matching-device", `no matching ${platform} device choice`];
101
95
  else if (offer.resources.memoryPressure !== "normal") [code, reason] = ["memory", "host memory pressure unknown or elevated"];
102
96
  else if (offer.capacity.available === 0) [code, reason] = ["no-capacity", "no hosted device capacity available"];
103
- else if (!cannotTake && (offer.resources.loadPerCore === null || offer.resources.loadPerCore >= here.loadPerCore)) [code, reason] = ["load", offer.resources.loadPerCore === null ? "host load unknown while this Mac has room" : "host is not less loaded than this Mac"];
97
+ else if (!cannotTake && (offer.resources.loadPerCore === null || offer.resources.loadPerCore >= here.loadPerCore)) [code, reason] = ["load", offer.resources.loadPerCore === null ? "host load unknown while this machine has room" : "host is not less loaded than this machine"];
104
98
  else admitted.push({
105
99
  machine: probe.machine,
106
100
  offer,
@@ -117,7 +111,7 @@ function decideDevicePlacement(inputs) {
117
111
  if (!admitted.length) return nowhere("no-host-admits", `${localReason}; no host admits`, skipped, localEnabled && cannotTake && !noWait ? "; waiting locally if needed" : "");
118
112
  const machines = admitted.map(({ machine, offer }) => ({
119
113
  machine,
120
- reason: `${localReason}; ${machine}${machine === buildMachine ? " is the explicit remote Mac," : ""} load ${offer.resources.loadPerCore === null ? "unknown" : offer.resources.loadPerCore.toFixed(1) + "/core"}`
114
+ reason: `${localReason}; ${machine}${machine === buildMachine ? " is the explicit remote machine," : ""} load ${offer.resources.loadPerCore === null ? "unknown" : offer.resources.loadPerCore.toFixed(1) + "/core"}`
121
115
  }));
122
116
  return {
123
117
  kind: "host",
@@ -129,16 +123,20 @@ function decideDevicePlacement(inputs) {
129
123
  }
130
124
  //#endregion
131
125
  //#region src/device-host/auto-placement.ts
132
- async function probeHost(machine, platform, selectors, appMode) {
126
+ async function probeHost(machine, platform, selectors, appMode, signal) {
133
127
  let host;
134
128
  const deadline = Date.now() + 3e3;
129
+ const cancel = () => host?.connection.close();
135
130
  try {
136
- host = await connectHost(machine, 3e3, true);
131
+ host = await connectHost(machine, 3e3, true, signal);
132
+ signal?.addEventListener("abort", cancel, { once: true });
133
+ signal?.throwIfAborted();
137
134
  requireHostedAppMode(host, platform, appMode);
138
135
  const offer = await call(host, "device-host.offer", {
139
136
  platform,
140
137
  ...selectors
141
138
  }, Math.max(1, deadline - Date.now()));
139
+ signal?.throwIfAborted();
142
140
  const resources = isJsonObject(offer.resources) ? offer.resources : {};
143
141
  const parsed = parseHostedNativeOffer({
144
142
  ...offer,
@@ -172,11 +170,13 @@ async function probeHost(machine, platform, selectors, appMode) {
172
170
  } } : {}
173
171
  };
174
172
  } catch (error) {
173
+ signal?.throwIfAborted();
175
174
  return { probe: {
176
175
  machine,
177
176
  failure: error instanceof Error ? error.message : String(error)
178
177
  } };
179
178
  } finally {
179
+ signal?.removeEventListener("abort", cancel);
180
180
  host?.connection.close();
181
181
  }
182
182
  }
@@ -219,11 +219,11 @@ function viaEas(code, reason, skipped) {
219
219
  skipped
220
220
  };
221
221
  }
222
- async function automaticDevicePlacement({ root, slot, platform, selectors, appMode, buildMachine, noWait, eas }, { machines = hostingMachines, read = readHostedNative, write = writeHostedNative, resume = prepareHostedNative, peek = () => peekDeviceSlots({
222
+ async function automaticDevicePlacement({ root, slot, platform, selectors, appMode, buildMachine, noWait, eas, signal }, { machines = () => hostingMachines(void 0, signal), read = readHostedNative, write = writeHostedNative, resume = prepareHostedNative, peek = () => peekDeviceSlots({
223
223
  platform,
224
224
  project: getProject(root),
225
225
  slot
226
- }), capacity = machineCapacity, memory = readHostMemoryPressure, probe = probeHost, budget = peekBudget } = {}) {
226
+ }), capacity = machineCapacity, memory = () => readHostMemoryPressureAsync(void 0, void 0, signal), probe = probeHost, budget = (projectRoot) => peekBudget(projectRoot, {}, ambientEnv(), signal) } = {}) {
227
227
  const recorded = read(root, platform, slot)[slot];
228
228
  if (recorded) {
229
229
  const target = await resume(recorded.machine, selectors, recorded, platform, true, appMode);
@@ -245,21 +245,23 @@ async function automaticDevicePlacement({ root, slot, platform, selectors, appMo
245
245
  ...local("sticky", decideDevicePlacement({ sticky: { local: true } }).reason),
246
246
  sticky: true
247
247
  };
248
- const configured = machines();
248
+ const configured = await machines();
249
+ signal?.throwIfAborted();
249
250
  if (configured === null) throw Object.assign(/* @__PURE__ */ new Error("remote.machines is invalid. Run stim guide settings and correct it."), { code: "STIM_HOSTING_REFUSED" });
250
251
  const config = loadConfig$1();
251
252
  const entries = configured.filter((machine) => automaticMachineEnabled("device", machine, config));
252
- const preference = resolveBuildMachine(buildMachine, process.env.STIM_REMOTE_BUILD, config?.remote?.build);
253
+ const preference = resolveBuildMachine(buildMachine, ambientEnv().STIM_REMOTE_BUILD, config?.remote?.build);
253
254
  buildMachine = namedBuildMachine(preference) ? preference : void 0;
254
255
  const load = capacity();
255
256
  const here = {
256
257
  localEnabled: automaticMachineEnabled("device", "local", config),
257
258
  loadPerCore: load.loadPerCore,
258
259
  maxLoadPerCore: load.maxLoadPerCore,
259
- memoryPressure: memory(),
260
+ memoryPressure: await memory(),
260
261
  devices,
261
262
  budgetRefusal: await budget(root)
262
263
  };
264
+ signal?.throwIfAborted();
263
265
  const inputs = (offers) => ({
264
266
  platform,
265
267
  here,
@@ -272,7 +274,7 @@ async function automaticDevicePlacement({ root, slot, platform, selectors, appMo
272
274
  failure: "not probed"
273
275
  }));
274
276
  const early = decideDevicePlacement(inputs(notProbed));
275
- const probes = early.kind === "local" && early.skipped.length === 0 ? [] : await Promise.all(entries.map((machine) => probe(machine, platform, selectors, appMode)));
277
+ const probes = early.kind === "local" && early.skipped.length === 0 ? [] : await Promise.all(entries.map((machine) => probe(machine, platform, selectors, appMode, signal)));
276
278
  const offers = probes.length ? probes.map((each) => each.probe) : notProbed;
277
279
  let decision = decideDevicePlacement(inputs(offers));
278
280
  if ((decision.kind === "local" || decision.kind === "refused") && decision.atCapacity && eas) decision = decideDevicePlacement({
@@ -323,14 +325,18 @@ function parseSimulatorAvailability(outcome) {
323
325
  * Whether this run could use an EAS Simulator the way `--remote eas` does, without starting a session or a build.
324
326
  * Each refusal names what `--remote eas` would refuse later, so automatic placement falls through instead.
325
327
  */
326
- async function checkEasFallback({ root, platform, slot, release, isExpo, tunnelMode, publicUrl, deviceTypeFlag, localOnlyFlags, env = process.env, resolveBin = resolveEasCliBin, readVersion = readInstalledEasCliVersion, onPath = (bin) => getExecutor().findExecutable(bin) !== null, readTunnel = readMetroTunnel, readSession = readRemoteSession, metroPort = () => getProject(root)?.metroPort ?? null, availability = async (bin) => {
328
+ async function checkEasFallback({ root, platform, slot, release, isExpo, tunnelMode, publicUrl, deviceTypeFlag, localOnlyFlags, env = process.env, resolveBin = resolveEasCliBin, readVersion = readInstalledEasCliVersionAsync, operation, onPath = (bin) => getExecutor().findExecutable(bin) !== null, readTunnel = readMetroTunnel, readSession = readRemoteSession, metroPort = () => getProject(root)?.metroPort ?? null, availability = async (bin) => {
327
329
  try {
328
- return { stdout: await getExecutor().runFileAsync(bin, [
330
+ return { stdout: await remoteCommand({
331
+ operation,
332
+ easBin: bin
333
+ }, bin, [
329
334
  "simulator:availability",
330
335
  "--json",
331
336
  "--non-interactive"
332
337
  ], {
333
338
  cwd: root,
339
+ ...childEnvironment(env),
334
340
  timeoutMs: AVAILABILITY_TIMEOUT_MS
335
341
  }) };
336
342
  } catch (error) {
@@ -347,9 +353,10 @@ async function checkEasFallback({ root, platform, slot, release, isExpo, tunnelM
347
353
  if (session && session.platform !== platform) return unusable("eas-session-busy", `this workspace's EAS Simulator session ${session.sessionId} runs ${session.platform ?? "another platform"}`);
348
354
  if (session && deviceTypeFlag?.trim() && session.deviceType !== deviceTypeFlag.trim()) return unusable("eas-session-busy", `this workspace's EAS Simulator session ${session.sessionId} runs ${session.deviceType ?? "the model EAS chose"}, not ${deviceTypeFlag.trim()}`);
349
355
  if (!onPath("agent-device")) return unusable("eas-no-agent-device", "agent-device is not on PATH");
356
+ throwIfCancelled(operation?.signal, "EAS availability");
350
357
  const bin = resolveBin(root);
351
358
  if (!bin) return unusable("eas-no-cli", "eas-cli is not installed for this project or on PATH");
352
- const versionOutput = readVersion(bin.file, root);
359
+ const versionOutput = await readVersion(bin.file, root, operation);
353
360
  const minimum = platform === "ios" && deviceTypeFlag?.trim() ? MIN_EAS_CLI_DEVICE_VERSION : MIN_EAS_CLI_SIMULATOR_VERSION;
354
361
  const { supported, version } = easCliSupport(versionOutput, minimum);
355
362
  if (!supported) return unusable("eas-cli-too-old", `eas-cli ${version ?? "(unknown version)"} is older than ${minimum}`);
@@ -370,184 +377,4 @@ async function checkEasFallback({ root, platform, slot, release, isExpo, tunnelM
370
377
  return parseSimulatorAvailability(await availability(bin.file));
371
378
  }
372
379
  //#endregion
373
- //#region src/commands/build-plan.ts
374
- const DISCARD = {
375
- file: "",
376
- written: 0,
377
- dropped: 0,
378
- lastError: null,
379
- write: () => true,
380
- close: () => ({
381
- file: "",
382
- written: 0,
383
- dropped: 0,
384
- lastError: null
385
- })
386
- };
387
- async function providerHit({ root, platform, cacheKey, providerConfig }, deps) {
388
- if (!providerConfig) return null;
389
- let destinationDir;
390
- try {
391
- destinationDir = makeTemporaryDirectory(root, "stim-plan-");
392
- } catch (error) {
393
- deps.note(chalk.yellow(phaseLine("cache", `provider not checked: ${error?.message || error}`)));
394
- return null;
395
- }
396
- try {
397
- const found = await resolveTieredBuild({
398
- local: {
399
- resolve: () => null,
400
- store: () => null
401
- },
402
- loadProvider: () => deps.loadCacheProvider({
403
- projectRoot: root,
404
- config: providerConfig
405
- }),
406
- target: {
407
- projectRoot: root,
408
- platform,
409
- key: cacheKey
410
- },
411
- destinationDir,
412
- warn: (_code, message) => deps.note(chalk.yellow(phaseLine("cache", message)))
413
- });
414
- return found ? found.providerName ?? "the cache provider" : null;
415
- } finally {
416
- removeTemporaryEntry(destinationDir);
417
- }
418
- }
419
- async function expoRemoteHit(lookup, deps) {
420
- if (!lookup.expoRemote) return null;
421
- const { root, platform, isExpo, fingerprint } = lookup;
422
- const loaded = await deps.loadProjectProvider(root, { isExpo });
423
- if (loaded?.unavailable) {
424
- deps.note(chalk.yellow(phaseLine("cache", `provider not usable: ${loaded.unavailable}`)));
425
- return null;
426
- }
427
- if (!loaded?.provider) return null;
428
- const name = loaded.name ?? "the build cache provider";
429
- if (name === "eas") {
430
- const auth = deps.checkEasAuth({
431
- projectRoot: root,
432
- owner: loaded.owner || null
433
- });
434
- const authNote = easAuthNote(auth);
435
- if (authNote) deps.note(chalk.yellow(phaseLine("cache", authNote)));
436
- if (auth?.code === "logged-out") return null;
437
- }
438
- const hit = await deps.resolveRemote({
439
- provider: loaded.provider,
440
- platform,
441
- projectRoot: root,
442
- fingerprintHash: fingerprint,
443
- runOptions: lookup.expoRemote.runOptions,
444
- logWriter: DISCARD
445
- });
446
- if (hit?.timedOut) deps.note(chalk.yellow(phaseLine("cache", `${name} did not answer; counted as a miss`)));
447
- else if (hit?.failed) deps.note(chalk.yellow(phaseLine("cache", `${name} could not be used: ${hit.failed}`)));
448
- return hit?.appPath ? name : null;
449
- }
450
- async function planCachedBuild(lookup, deps) {
451
- const { root, platform, isExpo, fingerprint, sources, cacheKey, cachePolicy } = lookup;
452
- let cacheHit = false;
453
- let provider = null;
454
- if (cachePolicy.read) {
455
- if (artifactIn(entryDir(platform, cacheKey))) cacheHit = "local";
456
- else {
457
- provider = (cachePolicy.remote ? await providerHit(lookup, deps) : null) ?? await expoRemoteHit(lookup, deps);
458
- if (provider) cacheHit = "remote";
459
- }
460
- }
461
- let prebuild = null;
462
- let refusal = null;
463
- let missReason;
464
- if (!cacheHit) {
465
- prebuild = deps.planPrebuild(root, platform, {
466
- isExpo,
467
- fingerprint,
468
- sources
469
- });
470
- if (prebuild === "refuse") refusal = staleNativeDirRefusal(platform);
471
- else if (cachePolicy.read) missReason = predictBuildMiss({
472
- root,
473
- platform,
474
- current: {
475
- hash: fingerprint,
476
- sources
477
- },
478
- prebuild: prebuild === "generate" || prebuild === "regenerate" ? prebuild : null
479
- });
480
- }
481
- return planPayload(lookup, {
482
- fingerprint,
483
- cacheKey,
484
- cacheHit,
485
- provider,
486
- cacheSkipped: !cachePolicy.read,
487
- prebuild,
488
- ...missReason ? { missReason } : {},
489
- refusal
490
- });
491
- }
492
- function planPayload({ platform, slot, projectKey }, found) {
493
- const { refusal, missReason, ...rest } = found;
494
- const outcome = refusal ? null : found.cacheHit ? "hit" : "cold";
495
- const estimate = outcome ? estimateBuild(readStats$1().record?.history?.[projectKey], platform, outcome) : {
496
- expectedMs: null,
497
- basis: 0
498
- };
499
- return {
500
- platform,
501
- ...slot === "default" ? {} : { slot },
502
- ...rest,
503
- outcome,
504
- expectedMs: estimate.expectedMs,
505
- basis: estimate.basis,
506
- ...missReason ? { missReason } : {},
507
- ...refusal ? { refusal } : {}
508
- };
509
- }
510
- function cacheLine(plan) {
511
- if (plan.refusal) return `the build would refuse with ${plan.refusal.code}`;
512
- if (plan.cacheHit === "local") return "local cache hit";
513
- if (plan.cacheHit === "remote") return `remote cache hit (${plan.provider})`;
514
- return `${plan.cacheSkipped ? "cache reads are off" : "cache miss"}: compiles${plan.prebuild === "generate" || plan.prebuild === "regenerate" ? `, ${plan.prebuild}s the native dir` : ""}`;
515
- }
516
- function printPlan(plan, json) {
517
- if (json) {
518
- console.log(JSON.stringify(plan));
519
- return;
520
- }
521
- const slot = plan.slot ? ` [${plan.slot}]` : "";
522
- console.log(phaseLine("plan", `${plan.platform}${slot} ${shortHash(plan.fingerprint)} -> ${cacheLine(plan)}`));
523
- if (plan.placement) console.log(phaseLine("placement", plan.placement));
524
- if (plan.missReason) console.log(phaseLine("cache", `miss: ${plan.missReason.summary}`));
525
- if (plan.refusal) {
526
- console.log(phaseLine("error", plan.refusal.message));
527
- console.log(phaseLine("remedy", plan.refusal.remedy));
528
- return;
529
- }
530
- console.log(phaseLine("expect", plan.expectedMs === null ? `unknown: no ${plan.outcome} run of this project is recorded yet` : `~${formatDuration(plan.expectedMs)} (median of ${plural(plan.basis, `${plan.outcome} run`)})`));
531
- }
532
- function refusePlan({ code, message, remedy }, json, lines = []) {
533
- console.error(chalk.red(phaseLine("error", message)));
534
- for (const line of lines) console.error(chalk.dim(phaseLine("", line)));
535
- console.error(chalk.dim(phaseLine("remedy", remedy)));
536
- console.error(chalk.red(phaseLine("failed", code)));
537
- if (json) console.log(JSON.stringify({
538
- code,
539
- message,
540
- remedy
541
- }));
542
- process.exitCode = 1;
543
- }
544
- const PLAN_ONLY_REMEDY = "Drop the flag to plan the owned simulator or emulator build, or run the command without --plan.";
545
- function planFlagRefusal(flag) {
546
- return {
547
- code: "STIM_BAD_ARG",
548
- message: `${flag} does not apply to --plan, which predicts the next local build without choosing a device.`,
549
- remedy: PLAN_ONLY_REMEDY
550
- };
551
- }
552
- //#endregion
553
- export { refusePlan as a, devicePlacementLine as c, printPlan as i, probeHost as l, planFlagRefusal as n, checkEasFallback as o, planPayload as r, automaticDevicePlacement as s, planCachedBuild as t };
380
+ export { probeHost as i, automaticDevicePlacement as n, devicePlacementLine as r, checkEasFallback as t };
@@ -1,11 +1,14 @@
1
- import { B as deviceSlotKey, W as projectDeviceSlots } from "./config-BYDxlMY3.mjs";
2
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
3
- import { y as workspaceAgentDeviceDir } from "./workspace-state-DJt_MMvf.mjs";
4
- import { a as formatElapsed, o as formatLongDuration, r as clockTime, u as plural } from "./command-output-BTy8hZ0F.mjs";
5
- import { n as isInsideProject } from "./metro-DnCEjCxs.mjs";
6
- import { r as cdpEndpoint } from "./state-D1Icyjlu.mjs";
7
- import { basename, sep } from "path";
8
- import { ACTIVITY_RECENCY_BASES } from "@stim-cli/core/state";
1
+ import { _ as reportSignal, t as getExecutor } from "./exec-DEoAhcze.mjs";
2
+ import { l as workspaceAgentDeviceDir, v as withDirLock$1, y as withDirLockAsync$1 } from "./paths-DQtTgsBf.mjs";
3
+ import { G as projectDeviceSlots, V as deviceSlotKey } from "./config-DlrsduwG.mjs";
4
+ import { a as formatElapsed, o as formatLongDuration, r as clockTime, u as plural } from "./command-output-gwpm28fu.mjs";
5
+ import { n as isInsideProject } from "./metro-DiXtA3Ty.mjs";
6
+ import { r as cdpEndpoint } from "./state--smjFSTL.mjs";
7
+ import { accessSync, constants, existsSync, mkdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
8
+ import { delimiter, dirname, join, resolve } from "node:path";
9
+ import { workspaceId } from "@stim-cli/core";
10
+ import { ACTIVITY_RECENCY_BASES, easMachineStateRoot, easMachineStateRoot as easMachineStateRoot$1, easSessionLedgerFile, easSessionLedgerLock, readEasSessionLedger, readEasSessionLedger as readEasSessionLedger$1, validEasSessionClaim } from "@stim-cli/core/state";
11
+ import { basename as basename$1, sep as sep$1 } from "path";
9
12
  //#region src/status.ts
10
13
  const IOS_SIM_MB = 1500;
11
14
  const ANDROID_EMULATOR_MB = 2500;
@@ -127,6 +130,7 @@ function environmentState(project, { simsByUdid = {}, metro = null, worktrees =
127
130
  }
128
131
  return {
129
132
  path: project.__path,
133
+ workspaceId: workspaceId(project.__path),
130
134
  ...slots.length ? { slots } : {},
131
135
  live,
132
136
  memoryMb,
@@ -292,7 +296,7 @@ function warningTexts(issues) {
292
296
  function portHolder(cwd, self, workspaces = []) {
293
297
  if (!cwd) return "another app";
294
298
  const owner = workspaces.filter((path) => path !== self && isInsideProject(cwd, path)).toSorted((a, b) => b.length - a.length)[0];
295
- if (owner) return `Metro for workspace ${basename(owner)}`;
299
+ if (owner) return `Metro for workspace ${basename$1(owner)}`;
296
300
  return `a dev server in ${cwd.split(/[\\/]/).filter(Boolean).slice(-3).join("/")}`;
297
301
  }
298
302
  function issueText(issue) {
@@ -383,7 +387,7 @@ function tightVolumes(volumes) {
383
387
  return (volumes || []).filter((v) => v && diskIsTight(v.disk));
384
388
  }
385
389
  function contains(dir, path) {
386
- return path === dir || path.startsWith(dir.endsWith(sep) ? dir : dir + sep);
390
+ return path === dir || path.startsWith(dir.endsWith(sep$1) ? dir : dir + sep$1);
387
391
  }
388
392
  function enclosingWorktree(worktrees, path) {
389
393
  return worktrees.filter((w) => contains(w.path, path)).toSorted((a, b) => b.path.length - a.path.length)[0] ?? null;
@@ -501,4 +505,219 @@ function parseWatchmanClients(payload) {
501
505
  return parsed;
502
506
  }
503
507
  //#endregion
504
- export { statusActivity as C, withWebFacts as E, remoteDeviceState as S, unprovisionedWorktrees as T, gitSummaryText as _, parseWatchmanPid as a, poolLine as b, activityLabel as c, capacity as d, deviceLeaseLines as f, formatSpace as g, environmentState as h, parseWatchmanClients as i, addReverseMissingIssue as l, diskLine as m, parseTriggerCount as n, runWatchman as o, deviceLeaseStates as p, parseWatchRoots as r, RECENT_LAUNCH_MS as s, parseSubscriberNames as t, applyMachineMemory as u, metroReverseTargets as v, tightVolumes as w, remoteDeviceLine as x, parseDfFree as y };
508
+ //#region src/diagnostics/stim-installations.ts
509
+ const VERSION_OUTPUT_LIMIT = 4096;
510
+ function parsedVersion(version) {
511
+ const match = /^v?(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/.exec(version);
512
+ if (!match) return null;
513
+ const core = [
514
+ match[1],
515
+ match[2],
516
+ match[3]
517
+ ];
518
+ if (core.some((part) => part.length > 1 && part.startsWith("0"))) return null;
519
+ const prereleaseParts = match[4]?.split(".");
520
+ if (prereleaseParts?.some((part) => !part || /^\d+$/.test(part) && part.length > 1 && part.startsWith("0"))) return null;
521
+ const prerelease = prereleaseParts?.map((part) => /^\d+$/.test(part) ? Number(part) : part);
522
+ return {
523
+ core: core.map(Number),
524
+ prerelease: prerelease ?? null
525
+ };
526
+ }
527
+ function compareStimVersions(left, right) {
528
+ const a = parsedVersion(left);
529
+ const b = parsedVersion(right);
530
+ if (!a || !b) return null;
531
+ for (let index = 0; index < a.core.length; index += 1) {
532
+ const difference = (a.core[index] ?? 0) - (b.core[index] ?? 0);
533
+ if (difference !== 0) return difference;
534
+ }
535
+ if (!a.prerelease && !b.prerelease) return 0;
536
+ if (!a.prerelease) return 1;
537
+ if (!b.prerelease) return -1;
538
+ for (let index = 0; index < Math.max(a.prerelease.length, b.prerelease.length); index += 1) {
539
+ const x = a.prerelease[index];
540
+ const y = b.prerelease[index];
541
+ if (x === void 0) return -1;
542
+ if (y === void 0) return 1;
543
+ if (x === y) continue;
544
+ if (typeof x === "number" && typeof y === "number") return x - y;
545
+ if (typeof x === "number") return -1;
546
+ if (typeof y === "number") return 1;
547
+ return x < y ? -1 : 1;
548
+ }
549
+ return 0;
550
+ }
551
+ function parseStimVersionOutput(output) {
552
+ const version = output?.split("\n")[0]?.trim() ?? "";
553
+ return parsedVersion(version) ? version.replace(/^v/, "") : null;
554
+ }
555
+ function executableNames(platform) {
556
+ return platform === "win32" ? [
557
+ "stim.cmd",
558
+ "stim.exe",
559
+ "stim"
560
+ ] : ["stim"];
561
+ }
562
+ function stimExecutablePaths(pathValue, { platform = process.platform, cwd = process.cwd() } = {}) {
563
+ const found = [];
564
+ const seen = /* @__PURE__ */ new Set();
565
+ for (const entry of pathValue.split(delimiter)) {
566
+ const directory = resolve(cwd, entry || ".");
567
+ for (const name of executableNames(platform)) {
568
+ const path = join(directory, name);
569
+ try {
570
+ accessSync(path, platform === "win32" ? constants.F_OK : constants.X_OK);
571
+ if (!statSync(path).isFile()) continue;
572
+ const realPath = realpathSync(path);
573
+ if (seen.has(realPath)) continue;
574
+ seen.add(realPath);
575
+ found.push({
576
+ path,
577
+ realPath
578
+ });
579
+ } catch {}
580
+ }
581
+ }
582
+ return found;
583
+ }
584
+ function canonicalPath(path, cwd) {
585
+ if (!path) return null;
586
+ try {
587
+ return realpathSync(resolve(cwd, path));
588
+ } catch {
589
+ return resolve(cwd, path);
590
+ }
591
+ }
592
+ function analyzeStimVersions(runningVersion, runningPath, installations) {
593
+ const candidates = [runningVersion, ...installations.map((entry) => entry.version)];
594
+ const versions = [...new Set(candidates)].filter((version) => version !== null && compareStimVersions(version, version) !== null).toSorted((left, right) => -(compareStimVersions(left, right) ?? 0));
595
+ const highestVersion = versions[0] ?? null;
596
+ const resolved = installations[0] ?? null;
597
+ return {
598
+ runningVersion,
599
+ runningPath,
600
+ resolved,
601
+ installations,
602
+ versions,
603
+ highestVersion,
604
+ resolvedIsOlder: Boolean(resolved?.version && highestVersion && (compareStimVersions(resolved.version, highestVersion) ?? 0) < 0)
605
+ };
606
+ }
607
+ function probeStimVersion(path, timeoutMs, cwd, env, operation) {
608
+ if (reportSignal(operation)) return getExecutor().runFileQuietAsync(path, ["--version"], {
609
+ timeoutMs,
610
+ cwd,
611
+ env: Object.fromEntries(Object.entries(env).filter((entry) => entry[1] !== void 0))
612
+ }).then((output) => output === null ? null : parseStimVersionOutput(output.slice(0, VERSION_OUTPUT_LIMIT)));
613
+ return new Promise((resolveProbe) => {
614
+ let settled = false;
615
+ let output = "";
616
+ const finish = (version) => {
617
+ if (settled) return;
618
+ settled = true;
619
+ clearTimeout(timer);
620
+ resolveProbe(version);
621
+ };
622
+ let child;
623
+ try {
624
+ child = getExecutor().spawn(path, ["--version"], {
625
+ cwd,
626
+ env,
627
+ stdio: [
628
+ "ignore",
629
+ "pipe",
630
+ "ignore"
631
+ ],
632
+ detached: process.platform !== "win32"
633
+ });
634
+ } catch {
635
+ resolveProbe(null);
636
+ return;
637
+ }
638
+ const timer = setTimeout(() => {
639
+ try {
640
+ if (process.platform !== "win32" && child.pid) process.kill(-child.pid, "SIGKILL");
641
+ else child.kill("SIGKILL");
642
+ } catch {}
643
+ finish(null);
644
+ }, timeoutMs);
645
+ child.stdout?.on("data", (chunk) => {
646
+ if (output.length < VERSION_OUTPUT_LIMIT) output += String(chunk).slice(0, VERSION_OUTPUT_LIMIT - output.length);
647
+ });
648
+ child.on("error", () => finish(null));
649
+ child.on("close", (code) => finish(code === 0 ? parseStimVersionOutput(output) : null));
650
+ });
651
+ }
652
+ async function inspectStimVersions(runningVersion, { cwd = process.cwd(), env = process.env, pathValue = env[process.platform === "win32" ? Object.keys(env).toSorted().find((key) => key.toUpperCase() === "PATH") ?? "PATH" : "PATH"] ?? "", runningPath = process.argv[1], probeTimeoutMs = 5e3, operation } = {}) {
653
+ const paths = stimExecutablePaths(pathValue, { cwd });
654
+ const versions = await Promise.all(paths.map((entry) => probeStimVersion(entry.path, probeTimeoutMs, cwd, env, operation)));
655
+ const installations = paths.map((entry, index) => ({
656
+ path: entry.path,
657
+ realPath: entry.realPath,
658
+ version: versions[index] ?? null
659
+ }));
660
+ return analyzeStimVersions(runningVersion, canonicalPath(runningPath, cwd), installations);
661
+ }
662
+ //#endregion
663
+ //#region src/engine/eas-machine-root-guard-env.ts
664
+ const EAS_TEST_GUARD_ROOT_ENV = "STIM_TEST_GUARD_REAL_EAS_ROOT";
665
+ //#endregion
666
+ //#region src/engine/eas-session-ledger.ts
667
+ function assertEasMachineRootWritable(root) {
668
+ const guardedRoot = process.env[EAS_TEST_GUARD_ROOT_ENV];
669
+ if (!guardedRoot || resolve(root) !== resolve(guardedRoot)) return;
670
+ throw new Error(`Refusing to write the real EAS machine root ${root} from a test process. Pass a temporary ledgerRoot, machineRoot, or easLedgerRoot, or point HOME (and USERPROFILE on Windows) at a temporary directory.`);
671
+ }
672
+ function writeLedger(root, ledger) {
673
+ mkdirSync(root, { recursive: true });
674
+ const file = easSessionLedgerFile(root);
675
+ const tmp = `${file}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
676
+ writeFileSync(tmp, `${JSON.stringify(ledger, null, 2)}\n`);
677
+ try {
678
+ renameSync(tmp, file);
679
+ } catch (error) {
680
+ rmSync(tmp, { force: true });
681
+ throw error;
682
+ }
683
+ }
684
+ function recordEasSessionClaim(claim, root = easMachineStateRoot()) {
685
+ assertEasMachineRootWritable(root);
686
+ const normalized = validEasSessionClaim(claim.sessionId, claim);
687
+ if (!normalized) throw new Error(`Invalid EAS session claim for ${claim.sessionId}.`);
688
+ withDirLock$1(easSessionLedgerLock(root), () => {
689
+ const current = readEasSessionLedger(root);
690
+ if (!current.safe) throw new Error(current.notice ?? "EAS ownership ledger is unreadable.");
691
+ current.claims.set(normalized.sessionId, normalized);
692
+ writeLedger(root, {
693
+ version: 1,
694
+ claims: Object.fromEntries(current.claims)
695
+ });
696
+ }, { ensureParent: () => mkdirSync(dirname(easSessionLedgerLock(root)), { recursive: true }) });
697
+ }
698
+ function removeEasSessionClaim(sessionId, root = easMachineStateRoot(), when = () => true) {
699
+ const file = easSessionLedgerFile(root);
700
+ if (!existsSync(file)) return false;
701
+ assertEasMachineRootWritable(root);
702
+ return withDirLock$1(easSessionLedgerLock(root), () => {
703
+ const current = readEasSessionLedger(root);
704
+ if (!current.safe) return false;
705
+ const claim = current.claims.get(sessionId);
706
+ if (!claim || !when(claim)) return false;
707
+ current.claims.delete(sessionId);
708
+ writeLedger(root, {
709
+ version: 1,
710
+ claims: Object.fromEntries(current.claims)
711
+ });
712
+ return true;
713
+ });
714
+ }
715
+ /** Removes a matching EAS session claim after asynchronously acquiring the ownership ledger lock. */
716
+ async function removeEasSessionClaimAsync(sessionId, root = easMachineStateRoot(), when = () => true, signal) {
717
+ signal?.throwIfAborted();
718
+ if (!existsSync(easSessionLedgerFile(root))) return false;
719
+ assertEasMachineRootWritable(root);
720
+ return withDirLockAsync$1(easSessionLedgerLock(root), () => removeEasSessionClaim(sessionId, root, when), { signal });
721
+ }
722
+ //#endregion
723
+ export { remoteDeviceState as A, environmentState as C, parseDfFree as D, metroReverseTargets as E, tightVolumes as M, unprovisionedWorktrees as N, poolLine as O, withWebFacts as P, diskLine as S, gitSummaryText as T, addReverseMissingIssue as _, removeEasSessionClaim as a, deviceLeaseLines as b, inspectStimVersions as c, parseWatchRoots as d, parseWatchmanClients as f, activityLabel as g, RECENT_LAUNCH_MS as h, recordEasSessionClaim as i, statusActivity as j, remoteDeviceLine as k, parseSubscriberNames as l, runWatchman as m, easMachineStateRoot$1 as n, removeEasSessionClaimAsync as o, parseWatchmanPid as p, readEasSessionLedger$1 as r, compareStimVersions as s, assertEasMachineRootWritable as t, parseTriggerCount as u, applyMachineMemory as v, formatSpace as w, deviceLeaseStates as x, capacity as y };