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,21 +1,19 @@
1
- import { D as withConfigLock$1, E as upsertProject, H as parseDeviceSlotKey, K as validateDeviceSlot, U as parseDeviceSlotOption, V as deviceSlotPlatforms, W as projectDeviceSlots, j as ownership_claim_exports, k as process_identity_exports, o as clearSupervisor, p as getProject } from "./config-BYDxlMY3.mjs";
2
- import { r as debugLog } from "./exec-DqKo9GKJ.mjs";
3
- import { n as fileLeaseIo, u as releaseWorkspaceLeases } from "./device-lease-BX1sJQ2E.mjs";
4
- import { a as updateWorkspaceState, c as writeWorkspaceState, n as clearWorkspaceStateKeys, o as withWorkspaceStateLock, r as readWorkspaceState$1, x as workspaceDir } from "./workspace-state-DJt_MMvf.mjs";
5
- import { f as refuseNoProject, l as phaseLine, p as releasedLeaseFact, u as plural } from "./command-output-BTy8hZ0F.mjs";
6
- import { A as clearWorkspaceSupervisor, D as clearManagedMetroTunnel, N as readRemoteSession, O as clearRemoteSession, j as readMetroTunnel, k as clearWorkspaceLaunches, n as findCommandWorkspace, w as MODE_COMMAND } from "./project-_phNIJfs.mjs";
7
- import { d as signalProcessTree, r as killMetroTree, s as pidExists, u as resolveProjectMetro } from "./metro-DnCEjCxs.mjs";
8
- import { D as stopTunnel, P as resolveSupervisorTarget, b as teardownOwnedIosSim, v as teardownOwnedAvd, y as teardownOwnedBrowser } from "./workspaces-C36s2jb9.mjs";
9
- import { _t as withdrawDevServerStopRequest, ht as requestDevServerStop, pt as logVanishedSupervisor } from "./budget-f7516Zk0.mjs";
10
- import { a as withWorkspaceProcessLock } from "./named-ports-4WopRPg-.mjs";
11
- import { _ as nativeRunHolder, d as NATIVE_RUN_LOCK, f as NATIVE_RUN_WAIT_MS, g as describeNativeRunHolder, h as decideStopAction, m as clearNativeRunCancel, v as nativeRunWaitNotice, y as requestNativeRunCancel } from "./tailnet-Dh-qiYzG.mjs";
12
- import { f as resolveEasCliBin } from "./remote-cache-OyOyVIS3.mjs";
13
- import { t as macosAppPresent } from "./state-CG_OFoaA.mjs";
14
- import { i as stopHostedAndroid } from "./hosted-android-C3MHGld1.mjs";
15
- import { i as endRecordedSession } from "./device-remote-xRT0Vmo9.mjs";
16
- import { n as verifyCollectorOwnership } from "./ownership-DCtw_2IA.mjs";
17
- import { r as stopHostedIos } from "./hosted-ios-l-o3iM9J.mjs";
18
- import { n as stopMacosApp } from "./stop-DPEhunlw.mjs";
1
+ import { b as debugLog, g as process_identity_exports, i as withWorkspaceProcessLock, x as ownership_claim_exports } from "./exec-DEoAhcze.mjs";
2
+ import { d as workspaceDir } from "./paths-DQtTgsBf.mjs";
3
+ import { E as upsertProject, G as projectDeviceSlots, H as deviceSlotPlatforms, O as withConfigLockAsync$1, U as parseDeviceSlotKey, W as parseDeviceSlotOption, o as clearSupervisor, p as getProject, q as validateDeviceSlot } from "./config-DlrsduwG.mjs";
4
+ import { f as refuseNoProject, l as phaseLine, p as releasedLeaseFact, u as plural } from "./command-output-gwpm28fu.mjs";
5
+ import { c as withWorkspaceStateLock, d as writeWorkspaceState, l as withWorkspaceStateLockAsync, n as clearWorkspaceStateKeys, r as readWorkspaceState$1, s as updateWorkspaceStateAsync } from "./workspace-state-U08dEzhG.mjs";
6
+ import { A as clearWorkspaceLaunches, M as readMetroTunnel, O as clearManagedMetroTunnel, P as readRemoteSession, T as MODE_COMMAND, j as clearWorkspaceSupervisor, k as clearRemoteSession, n as findCommandWorkspace } from "./project-wM_XFTvE.mjs";
7
+ import { t as macosAppPresent } from "./state-08I3hw3_.mjs";
8
+ import { a as listeningPidsAsync, c as pidExists, d as resolveProjectMetro, h as isMetroRunning, p as signalProcessTreeAsync, r as killMetroTreeAsync, u as processCwds } from "./metro-DiXtA3Ty.mjs";
9
+ import { S as withdrawDevServerStopRequest, b as requestDevServerStop, qn as resolveEasCliBin, v as logVanishedSupervisor, zt as endRecordedSession } from "./budget-Cvwn54qV.mjs";
10
+ import { a as decideStopAction, c as nativeRunWaitNotice, i as clearNativeRunCancel, l as requestNativeRunCancel, n as NATIVE_RUN_WAIT_MS, o as describeNativeRunHolder, s as nativeRunHolder, t as NATIVE_RUN_LOCK } from "./native-run-NwUuxbkg.mjs";
11
+ import { D as teardownOwnedAvd, O as teardownOwnedBrowser, _ as stopTunnel, h as resolveSupervisorTarget, k as teardownOwnedIosSim } from "./workspaces-CpANmBlq.mjs";
12
+ import { O as releaseWorkspaceLeasesAsync, y as fileLeaseIo } from "./activity-CMLmzp7o.mjs";
13
+ import { i as stopHostedAndroid } from "./hosted-android-B-9f-jkd.mjs";
14
+ import { r as stopHostedIos } from "./hosted-ios-CsCS21hn.mjs";
15
+ import { n as stopMacosApp } from "./stop-Dky10AEJ.mjs";
16
+ import { n as verifyCollectorOwnership } from "./ownership-C5fo5Edb.mjs";
19
17
  import { hostedAndroidDeviceName, hostedAndroidRecords, hostedIosRecords, hostedNativeRecords, isJsonObject, parseHostedNativePlacement } from "@stim-cli/core/state";
20
18
  import chalk from "chalk";
21
19
  //#region src/commands/stop.ts
@@ -103,20 +101,21 @@ function resolveCollectorTargets({ root, collectors, isAlive = pidExists, selfPi
103
101
  }
104
102
  return targets;
105
103
  }
106
- function defaultTeardownRemoteSession(root, sessionId) {
104
+ async function defaultTeardownRemoteSession(root, sessionId, operation) {
107
105
  return endRecordedSession({
108
106
  root,
109
107
  sessionId,
110
- easBin: resolveEasCliBin(root)?.file ?? null
108
+ easBin: resolveEasCliBin(root)?.file ?? null,
109
+ operation
111
110
  });
112
111
  }
113
- function endRemoteSession(root, sessionId, { teardownRemoteSession, report }) {
114
- const result = teardownRemoteSession(root, sessionId);
112
+ async function endRemoteSession(root, sessionId, { teardownRemoteSession, report }) {
113
+ const result = await teardownRemoteSession(root, sessionId);
115
114
  if (result.status === "failed") report(chalk.red(phaseLine("device", result.reason ?? `could not stop remote session ${sessionId}`)));
116
115
  else {
117
116
  report(chalk.dim(phaseLine("device", `stopped remote session ${sessionId}`)));
118
117
  if (result.reason) report(chalk.yellow(phaseLine("device", result.reason)));
119
- else clearRemoteSession(root, sessionId);
118
+ else await withWorkspaceStateLockAsync(root, () => clearRemoteSession(root, sessionId));
120
119
  }
121
120
  return {
122
121
  status: result.status,
@@ -148,19 +147,19 @@ async function runStop(options) {
148
147
  collectors,
149
148
  remoteDevice: null,
150
149
  metroTunnel: null,
151
- clearCollectors: (projectRoot, expected) => withWorkspaceStateLock(projectRoot, () => {
150
+ clearCollectors: (projectRoot, expected) => withWorkspaceStateLockAsync(projectRoot, () => {
152
151
  clearCollectorState(projectRoot, expected);
153
152
  return !Object.keys(readCollectorState(projectRoot)).some((key) => parseDeviceSlotKey(key)?.slot === slot);
154
153
  }),
155
- clearState: (projectRoot) => {
154
+ clearState: (projectRoot) => withWorkspaceStateLockAsync(projectRoot, () => {
156
155
  clearWorkspaceLaunches(projectRoot, slot);
157
156
  return true;
158
- },
157
+ }),
159
158
  clearRegistration: async () => true,
160
159
  teardownBrowser: null,
161
160
  stopMacos: false,
162
161
  hostedSlot: slot,
163
- releaseLeases: (projectRoot) => releaseWorkspaceLeases(projectRoot, { slot })
162
+ releaseLeases: (projectRoot) => releaseWorkspaceLeasesAsync(projectRoot, { slot })
164
163
  });
165
164
  result.outcomes.port = {
166
165
  status: "kept",
@@ -262,7 +261,11 @@ async function stopWorkspaceMacos(root, failed, enabled) {
262
261
  };
263
262
  }
264
263
  }
265
- async function stopWorkspace({ root, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => signalProcessTree(pid), verifyCollector = verifyCollectorOwnership, clearCollectors = clearCollectorState, isAlive = pidExists, killGroup = killMetroTree, signalServer = (pid, group) => signalProcessTree(pid, "SIGTERM", { group }), inspectIdentity = process_identity_exports.inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = resolveProjectMetro, teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, teardownBrowser = (projectRoot) => teardownOwnedBrowser(projectRoot), stopMacos, hostedSlot, remoteDevice = void 0, teardownRemoteSession = defaultTeardownRemoteSession, metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeases, freePort = defaultFreePort, clearRegistration = defaultClearRegistration, clearState = clearSupervisorState, report = (line) => console.error(line) }) {
264
+ async function stopWorkspace({ root, operation, project = void 0, state = void 0, collectors = void 0, signalCollector = (pid) => signalProcessTreeAsync(pid), verifyCollector = verifyCollectorOwnership, clearCollectors = (projectRoot, expected) => withWorkspaceStateLockAsync(projectRoot, () => clearCollectorState(projectRoot, expected)), isAlive = pidExists, killGroup = killMetroTreeAsync, signalServer = (pid, group) => signalProcessTreeAsync(pid, "SIGTERM", { group }), inspectIdentity = process_identity_exports.inspectProcessIdentity, waitForDeath = void 0, waitMs = DEFAULT_WAIT_MS, resolveMetro = (port, projectRoot) => resolveProjectMetro(port, projectRoot, {
265
+ probe: (candidatePort) => isMetroRunning(candidatePort, operation?.signal),
266
+ pidsOf: listeningPidsAsync,
267
+ cwdOf: async (pid) => (await processCwds([pid])).get(pid) ?? null
268
+ }), teardownIos = teardownOwnedIosSim, teardownAvd = teardownOwnedAvd, teardownBrowser = (projectRoot) => teardownOwnedBrowser(projectRoot), stopMacos, hostedSlot, remoteDevice = void 0, teardownRemoteSession = (projectRoot, id) => defaultTeardownRemoteSession(projectRoot, id, operation), metroTunnel = void 0, stopMetroTunnel = stopTunnel, releaseLeases = releaseWorkspaceLeasesAsync, freePort = defaultFreePort, clearRegistration = (projectRoot, expected) => defaultClearRegistration(projectRoot, expected, report), clearState = (projectRoot, expected) => withWorkspaceStateLockAsync(projectRoot, () => clearSupervisorState(projectRoot, expected)), report = (line) => console.error(line) }) {
266
269
  const proj = project === void 0 ? getProject(root) : project;
267
270
  const sup = state === void 0 ? readSupervisorState(root) : state;
268
271
  const collectorRecords = collectors === void 0 ? readCollectorState(root) : collectors;
@@ -352,7 +355,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
352
355
  stillHolding ??= "a collector could not be stopped";
353
356
  } else if (outcomes.collectors.entries.length) {
354
357
  debugLog.log("stop.phase.start", { phase: "clear-collectors" });
355
- const cleared = clearCollectors(root, collectorRecords);
358
+ const cleared = await clearCollectors(root, collectorRecords);
356
359
  debugLog.log("stop.phase.end", {
357
360
  phase: "clear-collectors",
358
361
  cleared
@@ -389,8 +392,17 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
389
392
  }
390
393
  }
391
394
  const releaseStoppedSupervisor = async () => {
392
- const stateCleared = clearState(root, sup);
395
+ const stateCleared = await clearState(root, sup);
393
396
  const registrationCleared = await clearRegistration(root, proj?.supervisor ?? null);
397
+ if (typeof registrationCleared === "object") {
398
+ ok = false;
399
+ outcomes.port = {
400
+ status: "kept",
401
+ port: reservedPort,
402
+ reason: registrationCleared.error
403
+ };
404
+ return;
405
+ }
394
406
  if (stateCleared === false || registrationCleared === false) {
395
407
  ok = false;
396
408
  outcomes.port = {
@@ -410,7 +422,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
410
422
  report(chalk.dim(phaseLine("port", `keeping reservation ${reservedPort} -- ${keepPort}`)));
411
423
  return;
412
424
  }
413
- if (freePort(root, reservedPort) === false) {
425
+ if (await freePort(root, reservedPort) === false) {
414
426
  ok = false;
415
427
  outcomes.port = {
416
428
  status: "kept",
@@ -428,7 +440,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
428
440
  };
429
441
  if (stillHolding) report(chalk.dim(phaseLine("device", "left alone (something is still running)")));
430
442
  else {
431
- outcomes.device = shutDownDevices(proj, root, {
443
+ outcomes.device = await shutDownDevices(proj, root, {
432
444
  teardownIos,
433
445
  teardownAvd,
434
446
  report
@@ -445,7 +457,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
445
457
  ok = false;
446
458
  });
447
459
  Object.assign(outcomes.device, hosted.devices);
448
- updateWorkspaceState(root, (workspace) => {
460
+ await updateWorkspaceStateAsync(root, (workspace) => {
449
461
  const slots = isJsonObject(workspace.deviceSlots) ? workspace.deviceSlots : {};
450
462
  for (const name of ["default", ...Object.keys(slots)]) {
451
463
  if (hostedSlot !== void 0 && name !== hostedSlot) continue;
@@ -463,7 +475,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
463
475
  const remote = remoteDevice === void 0 ? readRemoteSession(root) : remoteDevice;
464
476
  const sessionId = typeof remote?.sessionId === "string" ? remote.sessionId : null;
465
477
  if (sessionId) {
466
- outcomes.device.remote = endRemoteSession(root, sessionId, {
478
+ outcomes.device.remote = await endRemoteSession(root, sessionId, {
467
479
  teardownRemoteSession,
468
480
  report
469
481
  });
@@ -483,7 +495,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
483
495
  tunnelHolding = result.reason ?? `could not stop the ${tunnel.provider} tunnel`;
484
496
  if (!stillHolding) stillHolding = tunnelHolding;
485
497
  report(chalk.red(phaseLine("lan", tunnelHolding)));
486
- } else if (!clearManagedMetroTunnel(root, tunnel)) {
498
+ } else if (!await withWorkspaceStateLockAsync(root, () => clearManagedMetroTunnel(root, tunnel))) {
487
499
  tunnelHolding = "a replacement managed tunnel record appeared during cleanup and remains active";
488
500
  stillHolding = stillHolding ?? tunnelHolding;
489
501
  ok = false;
@@ -495,7 +507,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
495
507
  report(chalk.red(phaseLine("lan", tunnelHolding)));
496
508
  } else report(chalk.dim(phaseLine("lan", result.status === "missing" ? "tunnel already gone" : `stopped the ${tunnel.provider} tunnel`)));
497
509
  } else if (tunnel?.kind === "expo") outcomes.metroTunnel = { status: "not-managed" };
498
- outcomes.releasedLeases = releaseLeases(root);
510
+ outcomes.releasedLeases = await releaseLeases(root);
499
511
  for (const lease of outcomes.releasedLeases) report(chalk.dim(phaseLine("lease", releasedLeaseFact(lease))));
500
512
  if (stillHolding) {
501
513
  outcomes.port = {
@@ -510,7 +522,7 @@ async function stopWorkspace({ root, project = void 0, state = void 0, collector
510
522
  "stopped"
511
523
  ].includes(outcomes.supervisor.status) && !["refused", "failed"].includes(outcomes.metro.status);
512
524
  if (tunnelHolding && serverIsDown) {
513
- clearState(root, sup);
525
+ await clearState(root, sup);
514
526
  await clearRegistration(root, proj?.supervisor ?? null);
515
527
  }
516
528
  } else await releaseStoppedSupervisor();
@@ -574,7 +586,7 @@ async function reapCollectors(root, collectors, { isAlive, signal, report, verif
574
586
  });
575
587
  continue;
576
588
  }
577
- signal(target.pid);
589
+ await signal(target.pid);
578
590
  if (!await waiter(target.pid, collectors?.[target.platform]?.processToken)) {
579
591
  entries.push({
580
592
  platform: target.platform,
@@ -614,16 +626,20 @@ async function reapCollectors(root, collectors, { isAlive, signal, report, verif
614
626
  }
615
627
  async function stopSupervisor(target, { root, killGroup, waiter, report }) {
616
628
  report(chalk.dim(phaseLine("stop", `sending SIGTERM to supervisor process group ${target.pid}`)));
617
- requestDevServerStop(root, target.processToken, { by: "stim stop" });
629
+ try {
630
+ await withWorkspaceStateLockAsync(root, () => requestDevServerStop(root, target.processToken, { by: "stim stop" }));
631
+ } catch {}
618
632
  let signalled = false;
619
633
  try {
620
- signalled = killGroup(target.pid, target.processToken);
634
+ signalled = await killGroup(target.pid, target.processToken);
621
635
  } catch (e) {
622
636
  signalled = false;
623
637
  report(chalk.red(phaseLine("stop", `could not signal supervisor pid ${target.pid}: ${String(e?.message || e)}`)));
624
638
  }
625
639
  if (!signalled) {
626
- withdrawDevServerStopRequest(root, target.processToken);
640
+ try {
641
+ await withWorkspaceStateLockAsync(root, () => withdrawDevServerStopRequest(root, target.processToken));
642
+ } catch {}
627
643
  const reason = `could not signal supervisor pid ${target.pid}`;
628
644
  report(chalk.red(phaseLine("stop", reason)));
629
645
  return {
@@ -678,7 +694,7 @@ async function stopMetro(port, root, { server, supervisorGone, signalServer, ins
678
694
  report(chalk.dim(phaseLine("metro", `sending SIGTERM to dev server pid ${serverPid} left by the supervisor`)));
679
695
  let signalled = false;
680
696
  try {
681
- signalled = signalServer(serverPid, server?.mode === MODE_COMMAND);
697
+ signalled = await signalServer(serverPid, server?.mode === MODE_COMMAND);
682
698
  } catch {}
683
699
  if (signalled ? await waiter(serverPid, serverProcessToken) : ["gone", "different"].includes(inspectIdentity(serverRecord))) {
684
700
  report(chalk.green(phaseLine("metro", `dev server pid ${serverPid}`)));
@@ -730,7 +746,7 @@ function occupiedSkipReason(reason, holders) {
730
746
  const named = (holders || []).filter(Boolean);
731
747
  return named.length ? `${reason} -- held by UI-test runner ${named.join(", ")}` : `${reason} -- ${OCCUPANCY_HINT}`;
732
748
  }
733
- function shutDownDevices(project, workspace, { teardownIos, teardownAvd, report }) {
749
+ async function shutDownDevices(project, workspace, { teardownIos, teardownAvd, report }) {
734
750
  const device = {
735
751
  ios: null,
736
752
  android: null
@@ -756,7 +772,7 @@ function shutDownDevices(project, workspace, { teardownIos, teardownAvd, report
756
772
  slot,
757
773
  deviceId: iosUdid
758
774
  });
759
- const result = teardownIos(iosUdid, {
775
+ const result = await teardownIos(iosUdid, {
760
776
  del: false,
761
777
  label: iosName,
762
778
  workspace
@@ -786,7 +802,7 @@ function shutDownDevices(project, workspace, { teardownIos, teardownAvd, report
786
802
  slot,
787
803
  deviceId: android.avdName
788
804
  });
789
- const result = teardownAvd(android.avdName, {
805
+ const result = await teardownAvd(android.avdName, {
790
806
  del: false,
791
807
  workspace
792
808
  });
@@ -895,7 +911,7 @@ function summarize(root, outcomes, ok) {
895
911
  return `${ok ? "Stopped" : "Stopped with problems"}: ${what} (${root})`;
896
912
  }
897
913
  function defaultFreePort(root, port) {
898
- return withConfigLock$1(() => {
914
+ return withConfigLockAsync$1(() => {
899
915
  const current = getProject(root);
900
916
  if (!current) return true;
901
917
  if (current.supervisor || current.metroPort !== port) return false;
@@ -903,11 +919,13 @@ function defaultFreePort(root, port) {
903
919
  return true;
904
920
  });
905
921
  }
906
- async function defaultClearRegistration(root, expected) {
922
+ async function defaultClearRegistration(root, expected, report) {
907
923
  try {
908
- return clearSupervisor(root, expected);
909
- } catch {
910
- return false;
924
+ return await withConfigLockAsync$1(() => clearSupervisor(root, expected));
925
+ } catch (error) {
926
+ const message = `Could not clear workspace registration: ${error instanceof Error ? error.message : String(error)}`;
927
+ report(chalk.red(phaseLine("stop", message)));
928
+ return { error: message };
911
929
  }
912
930
  }
913
931
  const INTERRUPT_WAIT_MS = 6e4;
@@ -951,22 +969,30 @@ function workspaceDeviceSlots(root) {
951
969
  if (typeof readRemoteSession(root)?.sessionId === "string" && !slots.includes("default")) slots.push("default");
952
970
  return slots;
953
971
  }
954
- function readRemoteSessionEntry(root, report) {
972
+ async function readRemoteSessionEntry(root, report, operation) {
955
973
  const sessionId = readRemoteSession(root)?.sessionId;
956
974
  if (typeof sessionId !== "string") return null;
957
975
  report(chalk.dim(phaseLine("device", `ending remote session ${sessionId} without waiting on the build lock`)));
958
976
  return endRemoteSession(root, sessionId, {
959
- teardownRemoteSession: defaultTeardownRemoteSession,
977
+ teardownRemoteSession: (projectRoot, id) => defaultTeardownRemoteSession(projectRoot, id, operation),
960
978
  report
961
979
  });
962
980
  }
981
+ function signalledHolder(holder) {
982
+ return nativeRunHolder(holder).takesSignals && holder.owner.pid !== process.pid;
983
+ }
963
984
  /**
964
985
  * `stop` under the workspace's native-run lock. A billable remote session is ended as soon as the lock is
965
- * seen held; a live `ios` or `android` run that the stop leaves nothing to deploy to is interrupted with
966
- * SIGINT and given INTERRUPT_WAIT_MS to exit; a build for another slot that stays is left running while
986
+ * seen held; a live `ios` or `android` run that the stop leaves nothing to deploy to is asked to cancel through
987
+ * its workspace state, sent SIGINT when its holder is a CLI process, and given INTERRUPT_WAIT_MS to exit; a build
988
+ * for another slot that stays is left running while
967
989
  * the slot stops without the lock; any other holder is waited on with a visible notice.
968
990
  */
969
- async function stopWorkspaceNow({ root, slot, report = (line) => console.error(line), now = Date.now, sleep, waitMs = NATIVE_RUN_WAIT_MS, interruptWaitMs = INTERRUPT_WAIT_MS, inspectIdentity = process_identity_exports.inspectProcessIdentity, interrupt = (pid) => process.kill(pid, "SIGINT"), endRemote = (projectRoot) => readRemoteSessionEntry(projectRoot, report), deviceSlots = workspaceDeviceSlots, recordedSlots = recordedDeviceSlots, stop = (options) => runStop(options) }) {
991
+ async function stopWorkspaceNow({ root, operation, slot, report = (line) => console.error(line), now = Date.now, sleep, waitMs = NATIVE_RUN_WAIT_MS, interruptWaitMs = INTERRUPT_WAIT_MS, inspectIdentity = process_identity_exports.inspectProcessIdentity, interrupt = (pid) => process.kill(pid, "SIGINT"), endRemote = (projectRoot) => readRemoteSessionEntry(projectRoot, report, operation), deviceSlots = workspaceDeviceSlots, recordedSlots = recordedDeviceSlots, stop = (options) => runStop({
992
+ ...options,
993
+ operation,
994
+ report
995
+ }) }) {
970
996
  if (slot === "web") return stop({
971
997
  root,
972
998
  slot
@@ -983,10 +1009,10 @@ async function stopWorkspaceNow({ root, slot, report = (line) => console.error(l
983
1009
  };
984
1010
  let remote = null;
985
1011
  let remoteHandled = slot !== void 0;
986
- const endRemoteNow = () => {
1012
+ const endRemoteNow = async () => {
987
1013
  if (remoteHandled) return;
988
1014
  remoteHandled = true;
989
- remote = endRemote(root);
1015
+ remote = await endRemote(root);
990
1016
  };
991
1017
  const notice = nativeRunWaitNotice({
992
1018
  write: (line) => report(chalk.dim(phaseLine("lock", line))),
@@ -994,62 +1020,71 @@ async function stopWorkspaceNow({ root, slot, report = (line) => console.error(l
994
1020
  });
995
1021
  let seen = null;
996
1022
  const interrupted = [];
997
- const onHeld = (holder) => {
1023
+ const onHeld = async (holder) => {
998
1024
  const at = now();
999
1025
  if (seen?.claimId === holder.claimId) {
1000
1026
  if (seen.action === "interrupt" && at >= seen.deadline) {
1001
1027
  if (inspectIdentity(holder.owner) !== "same") throw ownerGoneRefusal(holder, at);
1028
+ const signalled = signalledHolder(holder);
1002
1029
  throw new StopBlocked({
1003
1030
  code: "STIM_STOP_BLOCKED",
1004
- message: `${describeNativeRunHolder(holder, at)} did not exit within ${Math.round(interruptWaitMs / 1e3)}s of SIGINT; it still holds this workspace's native-run claim at ${holder.path}.`,
1005
- remedy: `Wait for it to finish, or end it with \`kill ${holder.owner.pid}\`, then run \`stim stop\` again.`
1031
+ message: `${describeNativeRunHolder(holder, at)} did not exit within ${Math.round(interruptWaitMs / 1e3)}s of ${signalled ? "SIGINT" : "the stop request"}; it still holds this workspace's native-run claim at ${holder.path}.`,
1032
+ remedy: signalled ? `Wait for it to finish, or end it with \`kill ${holder.owner.pid}\`, then run \`stim stop\` again.` : `It runs inside process ${holder.owner.pid}, which embeds Stim (such as stim-server) and runs other work too. Wait for the run to finish, or cancel it from the client that started it, then run \`stim stop\` again.`
1006
1033
  });
1007
1034
  }
1008
1035
  notice(holder);
1009
1036
  return;
1010
1037
  }
1011
- endRemoteNow();
1012
- const target = nativeRunHolder(holder);
1013
- if (unknownSlot) {
1014
- const refusal = target.slot === slot ? null : stillUnknown();
1015
- if (refusal) throw refusal;
1016
- unknownSlot = false;
1017
- }
1018
- const { action } = decideStopAction({
1019
- stopSlot: slot,
1020
- holder: target,
1021
- ownerIdentity: inspectIdentity(holder.owner),
1022
- deviceSlots: deviceSlots(root)
1023
- });
1024
- seen = {
1025
- claimId: holder.claimId,
1026
- action,
1027
- deadline: Number.POSITIVE_INFINITY
1028
- };
1029
- const who = describeNativeRunHolder(holder, at);
1030
- if (action === "proceed") {
1031
- notice(holder, `leaving ${who} running: slot ${target.slot} stays, so slot ${slot} stops without the build lock`);
1032
- throw new LeaveBuildRunning();
1033
- }
1034
- if (action === "refuse") throw ownerGoneRefusal(holder, at);
1035
- if (action === "interrupt") {
1036
- requestNativeRunCancel(root, holder.claimId);
1037
- interrupted.push(holder.claimId);
1038
+ try {
1039
+ const target = nativeRunHolder(holder);
1040
+ if (unknownSlot) {
1041
+ const refusal = target.slot === slot ? null : stillUnknown();
1042
+ if (refusal) throw refusal;
1043
+ unknownSlot = false;
1044
+ }
1045
+ const { action } = decideStopAction({
1046
+ stopSlot: slot,
1047
+ holder: target,
1048
+ ownerIdentity: inspectIdentity(holder.owner),
1049
+ deviceSlots: deviceSlots(root)
1050
+ });
1038
1051
  seen = {
1039
1052
  claimId: holder.claimId,
1040
1053
  action,
1041
- deadline: now() + interruptWaitMs
1054
+ deadline: Number.POSITIVE_INFINITY
1042
1055
  };
1043
- if (inspectIdentity(holder.owner) !== "same") return;
1044
- try {
1045
- interrupt(holder.owner.pid);
1046
- } catch (error) {
1047
- if (error?.code !== "ESRCH") throw error;
1056
+ const who = describeNativeRunHolder(holder, at);
1057
+ if (action === "proceed") {
1058
+ notice(holder, `leaving ${who} running: slot ${target.slot} stays, so slot ${slot} stops without the build lock`);
1059
+ throw new LeaveBuildRunning();
1048
1060
  }
1049
- notice(holder, `interrupting ${who}: sent SIGINT, waiting up to ${Math.round(interruptWaitMs / 1e3)}s for it to exit`);
1050
- return;
1061
+ if (action === "refuse") throw ownerGoneRefusal(holder, at);
1062
+ if (action === "interrupt") {
1063
+ await withWorkspaceStateLockAsync(root, () => requestNativeRunCancel(root, holder.claimId));
1064
+ interrupted.push(holder.claimId);
1065
+ seen = {
1066
+ claimId: holder.claimId,
1067
+ action,
1068
+ deadline: now() + interruptWaitMs
1069
+ };
1070
+ if (inspectIdentity(holder.owner) !== "same") return;
1071
+ const wait = `waiting up to ${Math.round(interruptWaitMs / 1e3)}s for it to exit`;
1072
+ if (!signalledHolder(holder)) {
1073
+ notice(holder, `interrupting ${who}: asked it to stop, ${wait}`);
1074
+ return;
1075
+ }
1076
+ try {
1077
+ interrupt(holder.owner.pid);
1078
+ } catch (error) {
1079
+ if (error?.code !== "ESRCH") throw error;
1080
+ }
1081
+ notice(holder, `interrupting ${who}: sent SIGINT, ${wait}`);
1082
+ return;
1083
+ }
1084
+ notice(holder);
1085
+ } finally {
1086
+ await endRemoteNow();
1051
1087
  }
1052
- notice(holder);
1053
1088
  };
1054
1089
  const withRemote = (result) => {
1055
1090
  if (!remote || result.outcomes.device.remote) return result;
@@ -1067,9 +1102,11 @@ async function stopWorkspaceNow({ root, slot, report = (line) => console.error(l
1067
1102
  });
1068
1103
  }, {
1069
1104
  external: true,
1105
+ signal: operation?.signal,
1070
1106
  waitMs,
1071
1107
  now,
1072
1108
  ...sleep ? { sleep } : {},
1109
+ declareSpawnsFor: operation,
1073
1110
  details: {
1074
1111
  command: "stop",
1075
1112
  ...slot === void 0 ? {} : { slot }
@@ -1085,10 +1122,12 @@ async function stopWorkspaceNow({ root, slot, report = (line) => console.error(l
1085
1122
  refusal: error.refusal,
1086
1123
  remote
1087
1124
  };
1088
- if ((0, ownership_claim_exports.isClaimRefusal)(error)) endRemoteNow();
1125
+ if ((0, ownership_claim_exports.isClaimRefusal)(error)) await endRemoteNow();
1089
1126
  throw error;
1090
1127
  } finally {
1091
- for (const claimId of interrupted) clearNativeRunCancel(root, claimId);
1128
+ for (const claimId of interrupted) try {
1129
+ await withWorkspaceStateLockAsync(root, () => clearNativeRunCancel(root, claimId));
1130
+ } catch {}
1092
1131
  }
1093
1132
  }
1094
1133
  function stopCommand(program) {
@@ -1,6 +1,10 @@
1
- import { a as clearWorkspaceSupervisor, i as clearExpoMetroTunnel, n as MODE_BARE, o as readPidFile, r as MODE_EXPO, s as writePidFile, t as SettingsObject } from "./settings-vk3mJGSm.mjs";
2
- import { t as NdjsonWriter } from "./ndjson-Du3j0AQ9.mjs";
3
- import { DevServerStopRecord, DeviceActivity, DeviceIdleShutdownRecord, IOS_SIMULATOR_APPS } from "@stim-cli/core/state";
1
+ import { c as readPidFile, i as MODE_EXPO, l as writePidFile, n as SettingsObject, o as clearExpoMetroTunnel, r as MODE_BARE, s as clearWorkspaceSupervisor } from "./ios-CDvlmUs7.mjs";
2
+ import { n as NdjsonWriter } from "./exec-DnYc4HGH.mjs";
3
+ import { n as OwnedDeviceActivity } from "./idle-C4cZ757K.mjs";
4
+ import { DevServerStopRecord, DeviceIdleShutdownRecord } from "@stim-cli/core/state";
5
+ //#region src/watchman.d.ts
6
+ type WatchmanCommand = (args: string[], timeoutMs: number) => Promise<unknown>;
7
+ //#endregion
4
8
  //#region src/supervisor/types.d.ts
5
9
  interface ServerExitInfo {
6
10
  code?: number | null;
@@ -30,16 +34,6 @@ interface IdleProbe {
30
34
  blocker(): string | null;
31
35
  }
32
36
  //#endregion
33
- //#region src/commands/gc/idle.d.ts
34
- interface OwnedDeviceActivity {
35
- kind: "ios" | "android";
36
- id: string;
37
- name: string;
38
- project: string;
39
- slot: string;
40
- activity: DeviceActivity;
41
- }
42
- //#endregion
43
37
  //#region src/devices/idle-shutdown.d.ts
44
38
  interface DueDevice {
45
39
  device: OwnedDeviceActivity;
@@ -60,10 +54,7 @@ interface IdleShutdownEvent {
60
54
  declare function shutDownIdleDevices(root: string, idleMs: number, log: (event: IdleShutdownEvent) => void, now?: number, { only, reason }?: {
61
55
  only?: OwnedDeviceActivity;
62
56
  reason?: DeviceIdleShutdownRecord["reason"];
63
- }): number;
64
- //#endregion
65
- //#region src/watchman.d.ts
66
- type WatchmanCommand = (args: string[], timeoutMs: number) => Promise<unknown>;
57
+ }): Promise<number>;
67
58
  //#endregion
68
59
  //#region src/supervisor/run.d.ts
69
60
  interface ParsedSupervisorArgs {