stim 1.20.2 → 1.21.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 (217) hide show
  1. package/README.md +88 -8
  2. package/dist/acquire-artifact-CD4lbiWE.mjs +153 -0
  3. package/dist/act-DHAw2A2S.mjs +2667 -0
  4. package/dist/activity-BzVfHSrY.mjs +1376 -0
  5. package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -65
  6. package/dist/{android-HqP1_vB_.mjs → android-BEJ8Jpl7.mjs} +2 -2
  7. package/dist/{android-DCKZrNvV.mjs → android-BLgbNqox.mjs} +128 -78
  8. package/dist/{android-Dlzxshgp.mjs → android-CV_GCELZ.mjs} +5 -5
  9. package/dist/{android-Mz_Inn3w.mjs → android-DUYkNF4u.mjs} +184 -102
  10. package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-Ct5b1xCK.mjs} +7 -6
  11. package/dist/android-cas-compiler.mjs +2 -2
  12. package/dist/android-project-BCAAmMwz.mjs +12 -0
  13. package/dist/api.d.mts +740 -8
  14. package/dist/api.mjs +585 -1
  15. package/dist/{artifact-HSwkIWEQ.mjs → artifact-B8T3S5gi.mjs} +223 -201
  16. package/dist/{artifact-D3czlUvT.mjs → artifact-DAuZ-FNU.mjs} +158 -148
  17. package/dist/{browser-web-CA-F1GQo.mjs → browser-web-QQzVjz3O.mjs} +26 -24
  18. package/dist/budget-Bs6SxxzO.mjs +9154 -0
  19. package/dist/{build-DYDbfkk5.mjs → build-CoPzQRNw.mjs} +144 -96
  20. package/dist/build-cache-DmyR9Zzc.mjs +602 -0
  21. package/dist/build-plan-CaFskB7_.mjs +188 -0
  22. package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DkkqguoK.mjs} +2 -2
  23. package/dist/cache-manifest.mjs +1 -1
  24. package/dist/{ccache-zdKiYQ3E.mjs → ccache-BJRZ9pG3.mjs} +10 -9
  25. package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
  26. package/dist/{chrome-BnzZMqsR.mjs → chrome-B6tfCta1.mjs} +7 -4
  27. package/dist/{cli-CLP3diBm.mjs → cli-0DYf8QhQ.mjs} +20 -20
  28. package/dist/cli.mjs +1 -1
  29. package/dist/client-B7QVOlCr.d.mts +253 -0
  30. package/dist/client-UXD70ZbM.mjs +1406 -0
  31. package/dist/collector-run.d.mts +4 -40
  32. package/dist/collector-run.mjs +9 -8
  33. package/dist/{command-output-BTy8hZ0F.mjs → command-output-B1UrjZHL.mjs} +1 -1
  34. package/dist/config-CYcBF478.mjs +949 -0
  35. package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-CqeBlrEn.mjs} +3 -3
  36. package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-BbKQW83h.mjs} +20 -5
  37. package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
  38. package/dist/{dev-client-DAWVIGBu.mjs → dev-client-UOeESKm6.mjs} +2 -2
  39. package/dist/device-DCxH7_By.mjs +1068 -0
  40. package/dist/{device-BECOiufl.mjs → device-ExJq8Ei7.mjs} +35 -35
  41. package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-CMlqEcvw.mjs} +43 -13
  42. package/dist/device-host-worker.mjs +65 -61
  43. package/dist/{device-ios-COSi6oS1.mjs → device-ios-DRUeKaFV.mjs} +48 -45
  44. package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
  45. package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-DMRpVX9a.mjs} +5 -5
  46. package/dist/doctor-BLHCYxzi.mjs +2 -0
  47. package/dist/{doctor-kfMBnUw6.mjs → doctor-DTvaDOda.mjs} +281 -317
  48. package/dist/{doctor-CB8oZKCk.mjs → doctor-Dhqebm0q.mjs} +183 -91
  49. package/dist/doctor-fingerprint.mjs +19 -0
  50. package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -21
  51. package/dist/{eas-build-JyfqyHfC.mjs → eas-build-BomfRnFT.mjs} +53 -20
  52. package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
  53. package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
  54. package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-Bf0rZvG9.mjs} +172 -82
  55. package/dist/exec-H20xSg2T.d.mts +65 -0
  56. package/dist/exec-_UbtCQcG.mjs +750 -0
  57. package/dist/gc-C-WwL0yi.mjs +3 -0
  58. package/dist/{gc-qWOMdnER.mjs → gc-_-dCXdyL.mjs} +584 -796
  59. package/dist/git-C3iTsJaZ.mjs +73 -0
  60. package/dist/{guide-G9cAbVAc.mjs → guide-Yqwt2bd6.mjs} +941 -269
  61. package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-Bw-honsd.mjs} +8 -6
  62. package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DB_gBPfY.mjs} +34 -19
  63. package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
  64. package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
  65. package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-QI141yKk.mjs} +21 -17
  66. package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-Ksyjgzq-.mjs} +30 -21
  67. package/dist/idle-BVeRGroT.d.mts +24 -0
  68. package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
  69. package/dist/{ios-BwVCF7oA.mjs → ios-CQ68hG9s.mjs} +8 -8
  70. package/dist/{ios-RkW4pnQf.mjs → ios-CpByZy12.mjs} +140 -80
  71. package/dist/{ios-device-B5veSDDQ.mjs → ios-device-CXGP1bsD.mjs} +1 -1
  72. package/dist/{ios-device-D7pi2Sca.mjs → ios-device-CwFMehUS.mjs} +51 -26
  73. package/dist/{ios-project-K9hY_Jab.mjs → ios-project-WuwwBdvW.mjs} +13 -13
  74. package/dist/{ios-nOLJGVdy.mjs → ios-qNJt4dFm.mjs} +1 -1
  75. package/dist/ios-signing-DTTIChGs.mjs +489 -0
  76. package/dist/{ios-state-CBLe1xYw.mjs → ios-state-DvFX-K_l.mjs} +1 -1
  77. package/dist/{ios-Ce7bc7br.mjs → ios-ubFsBzwq.mjs} +129 -86
  78. package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Cc1dttps.mjs} +53 -26
  79. package/dist/{launch-F4sOqAhB.mjs → launch-CD1yVc7U.mjs} +91 -90
  80. package/dist/{launch-C3qJ6Agb.mjs → launch-Zq2mOSDy.mjs} +82 -541
  81. package/dist/logs-BS00Anxf.mjs +352 -0
  82. package/dist/logs-CMm05HxN.mjs +255 -0
  83. package/dist/{macos-D7uDvO-z.mjs → macos-B65--pPd.mjs} +1 -1
  84. package/dist/{macos-Ch5VJmcS.mjs → macos-C-0qJ6zq.mjs} +225 -212
  85. package/dist/macos-run.mjs +1 -1
  86. package/dist/maintenance-run.mjs +122 -247
  87. package/dist/{metro-DnCEjCxs.mjs → metro-DEXpIhHC.mjs} +67 -12
  88. package/dist/{metro-gateway-CX9Xlkq2.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
  89. package/dist/{named-ports-4WopRPg-.mjs → named-ports-BWTzt6mu.mjs} +8 -63
  90. package/dist/native-android-JACyjTZs.mjs +844 -0
  91. package/dist/{native-gradle-inputs-BsLRrl7u.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -140
  92. package/dist/native-inputs-TRTTTRxt.mjs +91 -0
  93. package/dist/native-run-DY_RLx3C.mjs +277 -0
  94. package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-Dg1Q7tfF.mjs} +9 -8
  95. package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-CB2iQeWq.mjs} +27 -18
  96. package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-CXX39F7o.mjs} +96 -47
  97. package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
  98. package/dist/offload-worker.d.mts +1 -46
  99. package/dist/offload-worker.mjs +197 -66
  100. package/dist/{ownership-DCtw_2IA.mjs → ownership-DEmM5vhh.mjs} +3 -3
  101. package/dist/{page-DRHy329N.mjs → page-CPaHeYqj.mjs} +7 -4
  102. package/dist/paths-BsJMoPP2.mjs +12 -0
  103. package/dist/paths-DQtTgsBf.mjs +42 -0
  104. package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BqGbTa61.mjs} +5 -5
  105. package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
  106. package/dist/{ports-DdSUicVo.mjs → ports-D-MmCTdv.mjs} +3 -3
  107. package/dist/prebuild-uD_ipCxF.mjs +449 -0
  108. package/dist/{project-_phNIJfs.mjs → project-BZNjmW_8.mjs} +65 -37
  109. package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-Lfetn8Kr.mjs} +2 -2
  110. package/dist/pull-request-zjCSAryH.d.mts +120 -0
  111. package/dist/pull-requests.d.mts +1 -119
  112. package/dist/pull-requests.mjs +1 -1
  113. package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-DuzH0cn3.mjs} +74 -48
  114. package/dist/{gradle-DSrXb6lG.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
  115. package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
  116. package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
  117. package/dist/{recordings-D0d5aQt0.mjs → recordings-DYteQSu4.mjs} +12 -9
  118. package/dist/{reload-C8JhxjSh.mjs → reload-CmTRFJaX.mjs} +93 -47
  119. package/dist/reload-DzjSl5P_.mjs +2 -0
  120. package/dist/{remote-BiR6aYjy.mjs → remote-ByYkXdGD.mjs} +15 -10
  121. package/dist/result-DNiS-tTP.mjs +434 -0
  122. package/dist/{run-BtPgpKks.mjs → run-D23HmJMs.mjs} +4 -5
  123. package/dist/selection-CSl9i5qU.mjs +619 -0
  124. package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CxTrvDg8.mjs} +3 -4
  125. package/dist/{server-command-CTtCkmcQ.mjs → server-command-CtzloH3v.mjs} +14 -7
  126. package/dist/server-expo-C-90EhcG.mjs +2 -0
  127. package/dist/{server-expo-DsguMGUF.mjs → server-expo-DT_F_uVI.mjs} +50 -9
  128. package/dist/{settings-B717odTD.mjs → settings-CsJDEXgK.mjs} +234 -24
  129. package/dist/{settings-vk3mJGSm.d.mts → settings-DkdmlelE.d.mts} +6 -4
  130. package/dist/settings-T1gtc3bf.mjs +114 -0
  131. package/dist/settings-write-HyVZ8eQ8.mjs +359 -0
  132. package/dist/settings.schema.json +163 -16
  133. package/dist/{simslim-CCr3rE-A.mjs → simslim-Cgk17SXV.mjs} +14 -12
  134. package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-DF8VfT64.mjs} +15 -20
  135. package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
  136. package/dist/stage-BIS0ydsV.mjs +183 -0
  137. package/dist/{start-BWqzODpb.mjs → start-7lpH7hmN.mjs} +63 -44
  138. package/dist/{start-TXeMmmO2.mjs → start-RChynRDp.mjs} +1 -1
  139. package/dist/{state-D1Icyjlu.mjs → state-C4ZtUisW.mjs} +40 -13
  140. package/dist/{state-CG_OFoaA.mjs → state-XMziexv2.mjs} +3 -2
  141. package/dist/{stats-BoY5sEPU.mjs → stats-53T7OTb9.mjs} +7 -13
  142. package/dist/stats-report-BFfMpWWF.mjs +16 -0
  143. package/dist/{status-WgFbkRzj.mjs → status-BL7jVyAB.mjs} +535 -447
  144. package/dist/status-CSi6tlRq.mjs +2 -0
  145. package/dist/{status-BTA7kKiQ.mjs → status-DqEUSSxs.mjs} +6 -4
  146. package/dist/{status-watch-C23ILtf9.mjs → status-watch-GDCfqpTE.mjs} +187 -22
  147. package/dist/status-worker.d.mts +1 -0
  148. package/dist/status-worker.mjs +19 -0
  149. package/dist/stim-desktop-C12we7lz.mjs +112 -0
  150. package/dist/{stop-DR6VoDIk.mjs → stop-Bk_1qiV6.mjs} +2 -2
  151. package/dist/{stop-BNmBMi1F.mjs → stop-CPzlM1L-.mjs} +138 -98
  152. package/dist/{stop-DPEhunlw.mjs → stop-D7h6jAXQ.mjs} +11 -10
  153. package/dist/supervisor-run.d.mts +8 -17
  154. package/dist/supervisor-run.mjs +63 -27
  155. package/dist/{support-DMTqj3Hm.mjs → support-67vraa1Q.mjs} +18 -11
  156. package/dist/{support-CwjbFs9H.mjs → support-Dlu37g6H.mjs} +12 -12
  157. package/dist/{swiftpm-macos-DRNVJWlb.mjs → swiftpm-macos-p8WZbxKU.mjs} +35 -24
  158. package/dist/toolchain-DhKwp9iI.mjs +2 -0
  159. package/dist/toolchain-Hp9sCpK4.mjs +873 -0
  160. package/dist/{trigger-CigAYjeL.mjs → trigger-BAahxUPq.mjs} +20 -5
  161. package/dist/trigger-Bf3uDcpv.mjs +2 -0
  162. package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-BHX5r0Ei.mjs} +250 -156
  163. package/dist/{web-BDBMxDpx.mjs → web-CJmIj6AI.mjs} +18 -13
  164. package/dist/web-DknQETPs.mjs +2 -0
  165. package/dist/web-run.mjs +11 -12
  166. package/dist/windows-report.d.mts +1 -0
  167. package/dist/windows-report.mjs +18 -0
  168. package/dist/windows-report.ps1 +43 -0
  169. package/dist/workspace-process-lock-1_1OoVW5.mjs +57 -0
  170. package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-Cjuigeeu.mjs} +62 -58
  171. package/dist/{workspaces-C36s2jb9.mjs → workspaces-BccMFmGQ.mjs} +1188 -1079
  172. package/dist/worktree-CK2MpJW5.mjs +2 -0
  173. package/dist/{worktree-CgvJYJ-Q.mjs → worktree-DQ6Zi2Mv.mjs} +304 -53
  174. package/dist/xcode-Zlx3qjEs.mjs +896 -0
  175. package/package.json +7 -5
  176. package/shim/android-optimizations.gradle +7 -5
  177. package/dist/activity-BSV745Kz.mjs +0 -629
  178. package/dist/api-qvOzWyfO.mjs +0 -154
  179. package/dist/api-run.mjs +0 -294
  180. package/dist/app-install-BIKtMfPq.mjs +0 -896
  181. package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
  182. package/dist/budget-f7516Zk0.mjs +0 -4106
  183. package/dist/build-facts-DcLv2HSd.d.mts +0 -111
  184. package/dist/cancellation-C_22VQTH.mjs +0 -24
  185. package/dist/client-qQAaXSUs.mjs +0 -1771
  186. package/dist/config-BYDxlMY3.mjs +0 -562
  187. package/dist/device-DuiPJQSn.mjs +0 -290
  188. package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
  189. package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
  190. package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
  191. package/dist/exec-DqKo9GKJ.mjs +0 -268
  192. package/dist/git-DDfFzkMm.mjs +0 -45
  193. package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
  194. package/dist/logs-BGrEUaEs.mjs +0 -383
  195. package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
  196. package/dist/native-android-D5qc3-_v.mjs +0 -226
  197. package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
  198. package/dist/plan-C4TjdPsR.mjs +0 -260
  199. package/dist/prebuild-DYbucPXy.mjs +0 -212
  200. package/dist/preview-78a9kR_-.mjs +0 -1011
  201. package/dist/react-native-build-CtCccJtb.mjs +0 -239
  202. package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
  203. package/dist/remote-cache-OyOyVIS3.mjs +0 -526
  204. package/dist/result-CaJg5Iat.mjs +0 -186
  205. package/dist/server-expo-Bigriskl.mjs +0 -2
  206. package/dist/settings-BORNaaCO.mjs +0 -402
  207. package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
  208. package/dist/stage-KNTQopqv.mjs +0 -157
  209. package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
  210. package/dist/tailnet-Dh-qiYzG.mjs +0 -265
  211. package/dist/toolchain-BFkAcstd.mjs +0 -2
  212. package/dist/toolchain-DxSsNssu.mjs +0 -1657
  213. package/dist/trigger-9_USgmxz.mjs +0 -2
  214. package/dist/web-Dq-i3wzJ.mjs +0 -2
  215. package/dist/worktree-DpLdCHga.mjs +0 -2
  216. package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
  217. package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
@@ -0,0 +1,2 @@
1
+ import { a as matchWorktreeEntry, c as reclaimKeys, d as removalBlockers, f as removalPath, g as worktreeCommand, h as warmedWorkspace, i as excludeWatchmanCookies, l as registerRemove, m as removeWorktreeTarget, n as dependencyInstallCommand, o as nestedWorktrees, p as removalRemedy, r as excludePodChurn, s as porcelainPath, t as customIosDirs, u as registerWarm } from "./worktree-DQ6Zi2Mv.mjs";
2
+ export { customIosDirs, worktreeCommand as default, dependencyInstallCommand, excludePodChurn, excludeWatchmanCookies, matchWorktreeEntry, nestedWorktrees, porcelainPath, reclaimKeys, registerRemove, registerWarm, removalBlockers, removalPath, removalRemedy, removeWorktreeTarget, warmedWorkspace };
@@ -1,43 +1,200 @@
1
- import { A as acquireAvdClaim, E as upsertProject, S as removeProject, W as projectDeviceSlots, _ as loadConfig$1, a as clearDevice, d as getConfigDir, g as isPathPrefix, j as ownership_claim_exports, k as process_identity_exports, p as getProject } from "./config-BYDxlMY3.mjs";
2
- import { n as isTimeoutError, t as getExecutor } from "./exec-DqKo9GKJ.mjs";
3
- import { r as gitQuiet, t as git } from "./git-DDfFzkMm.mjs";
4
- import { At as restoreFile, Ct as locallyKnownUpstream, Et as removeWorktree, G as resolveIosProjectDir, K as resolveProjectSettings, Mt as unpushedCommits, Nt as warmWorktreePaths, Ot as resolveFullRef, Q as settingShapeErrors, R as readCommittedSettings, St as listWorktrees, Tt as readWorktreeExclude, _t as hasPopulatedSubmodules, a as SETTING_SHAPE_REMEDY, bt as isPodInstallChurn, dt as deleteBranch, ft as depsOutOfSync, gt as gitCommonDirOnDisk, ht as gitCommonDir, jt as sourceCheckoutOf, lt as branchExists, mt as dirtyPaths, nt as unknownSettingKeys, q as resolveSettings, ut as cloneIgnoredEntries, vt as hasRemote, wt as podsOutOfSync, yt as hasUncommittedWork } from "./settings-B717odTD.mjs";
5
- import { u as releaseWorkspaceLeases } from "./device-lease-BX1sJQ2E.mjs";
6
- import { i as recordWorkspaceUse, r as readWorkspaceState$1, x as workspaceDir, y as workspaceAgentDeviceDir } from "./workspace-state-DJt_MMvf.mjs";
7
- import { a as formatElapsed, h as shortUdid, i as formatDuration, l as phaseLine, p as releasedLeaseFact, u as plural } from "./command-output-BTy8hZ0F.mjs";
8
- import { D as clearManagedMetroTunnel, N as readRemoteSession, O as clearRemoteSession, P as readRemoteSessionId, a as isMobileProject, j as readMetroTunnel, r as findProjectRoot, w as MODE_COMMAND } from "./project-_phNIJfs.mjs";
9
- import { a as workspaceLinks, i as workspaceLinkLine } from "./stim-desktop-BzBN2Em2.mjs";
10
- import { at as POOL_SETTING_REMEDY, dt as parkedMaxSetting } from "./android-Mz_Inn3w.mjs";
11
- import { d as signalProcessTree, r as killMetroTree, s as pidExists, u as resolveProjectMetro } from "./metro-DnCEjCxs.mjs";
12
- import { A as withManagedRemoteWorktreeRemovalLock, D as stopTunnel, M as withManagedTunnelRemovalLock, P as resolveSupervisorTarget, b as teardownOwnedIosSim, d as emptyWorkspaceDir, f as withIdleWorkspace, v as teardownOwnedAvd, y as teardownOwnedBrowser } from "./workspaces-C36s2jb9.mjs";
13
- import { _t as withdrawDevServerStopRequest, ht as requestDevServerStop, o as machineNumber } from "./budget-f7516Zk0.mjs";
14
- import { t as clearNamedPorts } from "./named-ports-4WopRPg-.mjs";
15
- import { f as resolveEasCliBin } from "./remote-cache-OyOyVIS3.mjs";
16
- import { o as readWebRecord } from "./state-D1Icyjlu.mjs";
17
- import { t as agentDeviceDaemon } from "./activity-BSV745Kz.mjs";
18
- import { t as macosAppPresent } from "./state-CG_OFoaA.mjs";
19
- import { L as podInstallCommand, d as DEPS_ERROR, f as podsAreStale, g as runPodInstall, h as runCaptured, p as readPodState, y as HEARTBEAT_INTERVAL_MS } from "./toolchain-DxSsNssu.mjs";
20
- import { a as discoverXcodeProject } from "./react-native-build-CtCccJtb.mjs";
21
- import { i as stopHostedAndroid } from "./hosted-android-C3MHGld1.mjs";
22
- import { i as endRecordedSession } from "./device-remote-xRT0Vmo9.mjs";
23
- import { n as verifyCollectorOwnership } from "./ownership-DCtw_2IA.mjs";
24
- import { r as stopHostedIos } from "./hosted-ios-l-o3iM9J.mjs";
25
- import { n as stopMacosApp } from "./stop-DPEhunlw.mjs";
26
- import { a as pullRequestLookup, r as endedPullRequest } from "./pull-request-CQ8sPbZa.mjs";
27
- import { a as forgetStatusMeasures, s as mergeState, t as startWarmProgress } from "./warm-progress-BuY-Fvfn.mjs";
28
- import { r as workspaceRecordingEnabled } from "./recordings-D0d5aQt0.mjs";
29
- import { n as hasInstalledDependencies, r as installedNpmTreeIsValid, t as dependencyState } from "./dependency-state-DG0p31-y.mjs";
1
+ import { f as ownership_claim_exports, n as isTimeoutError, p as process_identity_exports, t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
+ import { d as workspaceDir, l as workspaceAgentDeviceDir } from "./paths-DQtTgsBf.mjs";
3
+ import { E as upsertProject, K as projectDeviceSlots, R as measuredDirectorySizeAsync, S as removeProject, _ as loadConfig$1, a as clearDevice, d as getConfigDir, g as isPathPrefix, j as acquireAvdClaim, p as getProject } from "./config-CYcBF478.mjs";
4
+ import { a as formatElapsed, h as shortUdid, i as formatDuration, l as phaseLine, p as releasedLeaseFact, u as plural } from "./command-output-B1UrjZHL.mjs";
5
+ import { i as recordWorkspaceUse, r as readWorkspaceState$1 } from "./workspace-state-Cjuigeeu.mjs";
6
+ import { At as locallyKnownUpstream, Bt as restoreFile, Ct as hasRemote, Et as isPodInstallChurn, Ht as unpushedCommits, K as resolveIosProjectDir, Lt as resolveFullRef, Mt as podsOutOfSync, Nt as readWorktreeExclude, Ot as listWorktrees, Pt as removeWorktree, Vt as sourceCheckoutOf, Wt as warmWorktreePaths, Y as resolveSettings, a as SETTING_SHAPE_REMEDY, bt as gitCommonDirOnDisk, dt as branchExists, et as settingShapeErrors, ft as cloneIgnoredEntries, gt as dirtyPaths, it as unknownSettingKeys, mt as depsOutOfSync, pt as deleteBranch, q as resolveProjectSettings, vt as gitCommonDir, wt as hasUncommittedWork, xt as hasPopulatedSubmodules, z as readCommittedSettings } from "./settings-CsJDEXgK.mjs";
7
+ import { r as gitQuiet, t as git } from "./git-C3iTsJaZ.mjs";
8
+ import { F as readRemoteSessionId, M as readMetroTunnel, O as clearManagedMetroTunnel, P as readRemoteSession, T as MODE_COMMAND, i as findProjectRoot$1, k as clearRemoteSession, o as isMobileProject } from "./project-BZNjmW_8.mjs";
9
+ import { t as macosAppPresent } from "./state-XMziexv2.mjs";
10
+ import { f as resolveProjectMetro, l as pidExists, p as signalProcessTree, r as killMetroTree } from "./metro-DEXpIhHC.mjs";
11
+ import { o as readWebRecord } from "./state-C4ZtUisW.mjs";
12
+ import { S as withdrawDevServerStopRequest, b as requestDevServerStop, br as discoverCaches, c as readVolumeSpace, l as readVolumeSpaceAsync, nt as planCacheEmptying, o as machineNumber, qn as resolveEasCliBin, u as resolveBudget, zt as endRecordedSession } from "./budget-Bs6SxxzO.mjs";
13
+ import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
14
+ import { p as cacheUser } from "./native-run-DY_RLx3C.mjs";
15
+ import { D as teardownOwnedBrowser, E as teardownOwnedAvd, O as teardownOwnedIosSim, a as collectWorkspaceOutputs, d as emptyWorkspaceDir, f as withIdleWorkspace, g as stopTunnel, m as resolveSupervisorTarget, x as withManagedTunnelRemovalLock, y as withManagedRemoteWorktreeRemovalLock } from "./workspaces-BccMFmGQ.mjs";
16
+ import { D as releaseWorkspaceLeases, t as agentDeviceDaemon } from "./activity-BzVfHSrY.mjs";
17
+ import { ht as parkedMaxSetting, lt as POOL_SETTING_REMEDY } from "./android-DUYkNF4u.mjs";
18
+ import { F as readHostMemoryPressureAsync, P as readHostMemoryPressure } from "./ios-CpByZy12.mjs";
19
+ import { a as workspaceLinkLine, o as workspaceLinks } from "./stim-desktop-C12we7lz.mjs";
20
+ import { t as clearNamedPorts } from "./named-ports-BWTzt6mu.mjs";
21
+ import { r as HEARTBEAT_INTERVAL_MS, x as podInstallCommand } from "./xcode-Zlx3qjEs.mjs";
22
+ import { t as resolveMaintenanceSettings } from "./settings-Djl-mpjX.mjs";
23
+ import { _ as runPodInstall, f as DEPS_ERROR, g as runCaptured, m as readPodState, p as podsAreStale } from "./toolchain-Hp9sCpK4.mjs";
24
+ import { i as stopHostedAndroid } from "./hosted-android-Bw-honsd.mjs";
25
+ import { r as stopHostedIos } from "./hosted-ios-CUvOf4Vr.mjs";
26
+ import { n as stopMacosApp } from "./stop-D7h6jAXQ.mjs";
27
+ import { n as verifyCollectorOwnership } from "./ownership-DEmM5vhh.mjs";
28
+ import { a as discoverXcodeProject } from "./react-native-build-rhk4smwQ.mjs";
29
+ import { n as hasInstalledDependencies, r as installedNpmTreeIsValid, t as dependencyState } from "./dependency-state-BbKQW83h.mjs";
30
+ import { a as forgetStatusMeasures, f as mergeState, t as startWarmProgress } from "./warm-progress-BHX5r0Ei.mjs";
31
+ import { a as pullRequestLookup, r as endedPullRequest } from "./pull-request-Lfetn8Kr.mjs";
32
+ import { r as workspaceRecordingEnabled } from "./recordings-DYteQSu4.mjs";
33
+ import { createHash, randomUUID } from "node:crypto";
30
34
  import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, utimesSync, writeFileSync } from "node:fs";
35
+ import { cpus, freemem, homedir, loadavg, totalmem } from "node:os";
31
36
  import { basename, dirname, join, relative } from "node:path";
37
+ import { buildCacheRoot, configDir, metroCacheRoot, unitLines, unitWords, withDirLock, workspaceName } from "@stim-cli/core";
38
+ import { LAST_BUILD_KEYS, archiveDir, archiveEnabled, archiveLock, archiveRoot, archivedUsage, buildWorkerRoot, countErrorEntries, endedAgentSessionOf, isJsonObject, listRecordedDevices, loadConfig, queryLogs, readArchives, readBuildHistory, readJsonObject, readLastBuilds, readMacosRecord, readPullRequestCache, readWorkspaceState, recordingEnabled, sharedCcache, sharedCompilationCache, sortByTs } from "@stim-cli/core/state";
32
39
  import { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, relative as relative$1, resolve as resolve$1 } from "path";
33
- import { LAST_BUILD_KEYS, archiveDir, archiveEnabled, archiveLock, archiveRoot, archivedUsage, countErrorEntries, endedAgentSessionOf, isJsonObject, listRecordedDevices, loadConfig, queryLogs, readArchives, readBuildHistory, readJsonObject, readLastBuilds, readMacosRecord, readPullRequestCache, readWorkspaceState, recordingEnabled, sortByTs } from "@stim-cli/core/state";
34
- import { existsSync as existsSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, readlinkSync as readlinkSync$1, realpathSync as realpathSync$1, renameSync as renameSync$1, rmSync as rmSync$1, symlinkSync as symlinkSync$1, unlinkSync as unlinkSync$1, writeFileSync as writeFileSync$1 } from "fs";
35
- import { withDirLock, workspaceName } from "@stim-cli/core";
36
40
  import { claimRemoveCommand, clearFreeClaimSet, readClaimSet, releaseClaim, tryAcquireClaim } from "@stim-cli/core/ownership-claim";
37
- import { createHash, randomUUID } from "node:crypto";
38
- import { homedir } from "node:os";
39
41
  import chalk from "chalk";
42
+ import { existsSync as existsSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, readlinkSync as readlinkSync$1, realpathSync as realpathSync$1, renameSync as renameSync$1, rmSync as rmSync$1, symlinkSync as symlinkSync$1, unlinkSync as unlinkSync$1, writeFileSync as writeFileSync$1 } from "fs";
40
43
  import { createHash as createHash$1 } from "crypto";
44
+ //#region src/maintenance/pressure.ts
45
+ /**
46
+ * The free-disk floor of each level in MiB. Level 2 has no floor of its own: it runs when level 1 left free disk
47
+ * under the budget floor, and stops once free disk is back above it. Its urgent threshold only sets the reported level.
48
+ */
49
+ function levelFloors(budget, settings) {
50
+ const floor = Math.max(budget.minFreeDiskMb, budget.hardFloorDiskMb);
51
+ return {
52
+ 1: floor,
53
+ 2: floor,
54
+ 3: Math.max(settings.criticalFreeDiskGb * 1024, budget.hardFloorDiskMb),
55
+ urgent: settings.urgentFreeDiskGb * 1024
56
+ };
57
+ }
58
+ function diskPressureLevel(freeMb, budget, settings) {
59
+ const floors = levelFloors(budget, settings);
60
+ if (freeMb < floors[3]) return 3;
61
+ if (freeMb < floors.urgent) return 2;
62
+ return freeMb < floors[1] ? 1 : 0;
63
+ }
64
+ function lowestFree(disk) {
65
+ return disk.length ? Math.min(...disk.map((volume) => volume.freeMb)) : Infinity;
66
+ }
67
+ /** Whether an action planned at a pressure level may still run with this much free disk. */
68
+ function levelStillShort(action, freeMb, budget, settings) {
69
+ return action.level === void 0 || freeMb < levelFloors(budget, settings)[action.level];
70
+ }
71
+ /** The protection window in milliseconds: protectRecentHours, or maintenance.pressureProtectMinutes for actions of level 2 and 3. */
72
+ function protectWindowMs(action, settings) {
73
+ return action.level === void 0 ? settings.protectRecentHours * 36e5 : settings.pressureProtectMinutes * 6e4;
74
+ }
75
+ //#endregion
76
+ //#region src/maintenance/measure.ts
77
+ function measureDisk() {
78
+ return readVolumeSpace([
79
+ configDir(),
80
+ ...Object.keys(loadConfig()?.projects ?? {}),
81
+ buildWorkerRoot(loadConfig())
82
+ ]);
83
+ }
84
+ /** The disk pressure level of the fullest volume Stim writes to, measured now. */
85
+ function currentDiskLevel() {
86
+ return diskPressureLevel(lowestFree(measureDisk()), resolveBudget().budget, resolveMaintenanceSettings());
87
+ }
88
+ function measurePressure(settings, previous, now) {
89
+ return pressureFromObservations(settings, previous, now, readHostMemoryPressure(), measureDisk());
90
+ }
91
+ async function measurePressureAsync(settings, previous, now, operation) {
92
+ return pressureFromObservations(settings, previous, now, await readHostMemoryPressureAsync(), await readVolumeSpaceAsync([
93
+ configDir(),
94
+ ...Object.keys(loadConfig()?.projects ?? {}),
95
+ buildWorkerRoot(loadConfig())
96
+ ], operation.signal));
97
+ }
98
+ function pressureFromObservations(settings, previous, now, level, disk) {
99
+ const availableBytes = process.platform === "darwin" ? null : freemem();
100
+ const warningSince = level === "warning" ? previous?.warningSince ?? now : null;
101
+ return {
102
+ disk,
103
+ memory: {
104
+ level,
105
+ availableBytes,
106
+ pressured: settings.memoryPressureLevel !== "off" && (level === "critical" || settings.memoryPressureLevel === "warning" && warningSince !== null && now - warningSince >= settings.memoryWarningMinutes * 6e4 || availableBytes !== null && availableBytes < (settings.minAvailableMemoryGb === void 0 ? totalmem() * .1 : settings.minAvailableMemoryGb * 1024 ** 3))
107
+ },
108
+ warningSince
109
+ };
110
+ }
111
+ function sizeScanDeferred(settings) {
112
+ return loadavg()[0] / Math.max(1, cpus().length) > settings.maxLoadPerCore;
113
+ }
114
+ function cacheBlocked(entry, discovered = discoverCaches(), env = process.env) {
115
+ return planCacheEmptying([{
116
+ ...entry,
117
+ note: "",
118
+ prune: "entries",
119
+ ...discovered.some((cache) => canonicalPath(cache.dir) === canonicalPath(entry.dir) && cache.source === "registered") ? { source: "registered" } : {}
120
+ }], false, env)[0]?.machineGlobal ?? (entry.category === "compilation-cache" ? cacheUser(entry.dir) : void 0);
121
+ }
122
+ async function measureSizes(now, failure) {
123
+ const sizes = [];
124
+ const outputs = await collectWorkspaceOutputs({
125
+ olderThan: null,
126
+ now,
127
+ sizeTimeoutMs: 12e4
128
+ });
129
+ for (const entry of outputs.workspaces) {
130
+ if (entry.bytes === null) {
131
+ failure(entry.dir, entry.projectRoot ?? void 0);
132
+ continue;
133
+ }
134
+ sizes.push({
135
+ name: "workspace build outputs",
136
+ category: "workspace-outputs",
137
+ dir: entry.dir,
138
+ bytes: entry.bytes,
139
+ measuredAt: now,
140
+ ...entry.projectRoot ? { workspace: canonicalPath(entry.projectRoot) } : {},
141
+ idleDays: entry.idleDays,
142
+ ...!entry.willClear ? { blocked: entry.keptReason ?? "workspace ownership is unresolved" } : {}
143
+ });
144
+ }
145
+ const known = [
146
+ {
147
+ name: "shared build cache",
148
+ dir: buildCacheRoot(),
149
+ category: "build-cache"
150
+ },
151
+ {
152
+ name: "Metro transform caches",
153
+ dir: metroCacheRoot(),
154
+ category: "metro-cache"
155
+ },
156
+ {
157
+ name: "ccache",
158
+ dir: sharedCcache(),
159
+ category: "ccache"
160
+ },
161
+ {
162
+ name: "Swift compilation cache",
163
+ dir: sharedCompilationCache(),
164
+ category: "compilation-cache"
165
+ }
166
+ ];
167
+ const discovered = discoverCaches();
168
+ for (const cache of discovered) {
169
+ if (cache.source !== "registered" && !canonicalPath(cache.dir).startsWith(`${canonicalPath(configDir())}/`)) continue;
170
+ if (cache.prune === "report-only") continue;
171
+ const dir = canonicalPath(cache.dir);
172
+ if (known.some((item) => dir === canonicalPath(item.dir) || dir.startsWith(`${canonicalPath(item.dir)}/`))) continue;
173
+ const category = cache.name.startsWith("Metro transform cache") ? "metro-cache" : /^(Expo build cache|native build cache|Build cache)$/.test(cache.name) ? "build-cache" : "other";
174
+ known.push({
175
+ name: cache.name,
176
+ dir: cache.dir,
177
+ category
178
+ });
179
+ }
180
+ for (const entry of known) {
181
+ if (!existsSync(entry.dir)) continue;
182
+ const bytes = await measuredDirectorySizeAsync(entry.dir, { timeoutMs: 12e4 });
183
+ if (bytes === null) {
184
+ failure(entry.dir);
185
+ continue;
186
+ }
187
+ const blocked = cacheBlocked(entry, discovered);
188
+ sizes.push({
189
+ ...entry,
190
+ bytes,
191
+ measuredAt: now,
192
+ ...blocked ? { blocked } : {}
193
+ });
194
+ }
195
+ return sizes;
196
+ }
197
+ //#endregion
41
198
  //#region src/workspace/pods-relocate.ts
42
199
  const CHECKSUMS_HEADER = "SPEC CHECKSUMS:\n";
43
200
  const GENERATED_DIRS = [
@@ -700,7 +857,7 @@ async function reapCollectors(root, { verify = verifyCollectorOwnership, collect
700
857
  failedDevices
701
858
  };
702
859
  }
703
- function reclaimRemoteSession(root, { stopSession = defaultStopSession } = {}) {
860
+ async function reclaimRemoteSession(root, { stopSession = defaultStopSession } = {}) {
704
861
  const sessionId = readRemoteSessionId(root);
705
862
  if (!sessionId) return {
706
863
  stopped: null,
@@ -708,7 +865,7 @@ function reclaimRemoteSession(root, { stopSession = defaultStopSession } = {}) {
708
865
  };
709
866
  let result;
710
867
  try {
711
- result = stopSession(root, sessionId);
868
+ result = await stopSession(root, sessionId);
712
869
  } catch (err) {
713
870
  result = {
714
871
  status: "failed",
@@ -814,7 +971,7 @@ function parkRequest(project, projectPath, slot, simslimManaged) {
814
971
  cacheKey: lastBuildCacheKey(projectPath, "ios")
815
972
  };
816
973
  }
817
- function reclaimOwnedDevices(project, projectPath, { park = false } = {}) {
974
+ async function reclaimOwnedDevices(project, projectPath, { park = false } = {}) {
818
975
  const deletedDevices = [];
819
976
  const parkedDevices = [];
820
977
  const evictedDevices = [];
@@ -826,7 +983,7 @@ function reclaimOwnedDevices(project, projectPath, { park = false } = {}) {
826
983
  if (ios?.owned && ios.deviceUdid) {
827
984
  const udid = ios.deviceUdid;
828
985
  const label = ios.deviceName || udid;
829
- const r = teardownOwnedIosSim(udid, {
986
+ const r = await teardownOwnedIosSim(udid, {
830
987
  del: true,
831
988
  label,
832
989
  ...park ? { park: parkRequest(project, projectPath, slot, Boolean(ios.simslimManaged)) } : {}
@@ -858,7 +1015,7 @@ function reclaimOwnedDevices(project, projectPath, { park = false } = {}) {
858
1015
  const android = platforms.android;
859
1016
  if (android?.owned && android.avdName) {
860
1017
  const bound = parkedMaxSetting("android");
861
- const r = teardownOwnedAvd(android.avdName, {
1018
+ const r = await teardownOwnedAvd(android.avdName, {
862
1019
  del: true,
863
1020
  owner: {
864
1021
  projectPath,
@@ -1008,7 +1165,7 @@ async function reclaimIdleProject(path, workspaceExisted, { archive, deleteOwned
1008
1165
  }
1009
1166
  }
1010
1167
  retainReplacementProcesses();
1011
- const { deletedDevices, parkedDevices, evictedDevices, poolNotes, skippedDevices, failedDevices } = deleteOwnedDevices && !supervisorHeld && failedCollectors.length === 0 ? reclaimOwnedDevices(project, path, { park: parkOwnedDevices }) : {
1168
+ const { deletedDevices, parkedDevices, evictedDevices, poolNotes, skippedDevices, failedDevices } = deleteOwnedDevices && !supervisorHeld && failedCollectors.length === 0 ? await reclaimOwnedDevices(project, path, { park: parkOwnedDevices }) : {
1012
1169
  deletedDevices: [],
1013
1170
  parkedDevices: [],
1014
1171
  evictedDevices: [],
@@ -1029,7 +1186,7 @@ async function reclaimIdleProject(path, workspaceExisted, { archive, deleteOwned
1029
1186
  failedDevices.push(failed);
1030
1187
  skippedDevices.push(failed);
1031
1188
  }
1032
- const remote = reclaimRemoteSession(path, { stopSession });
1189
+ const remote = await reclaimRemoteSession(path, { stopSession });
1033
1190
  if (remote.failed) {
1034
1191
  skippedDevices.push(remote.failed);
1035
1192
  failedDevices.push(remote.failed);
@@ -1117,11 +1274,14 @@ async function reclaimIdleProject(path, workspaceExisted, { archive, deleteOwned
1117
1274
  //#endregion
1118
1275
  //#region src/workspace/service-guard.ts
1119
1276
  const SERVICE_IN_USE = { code: "STIM_WORKTREE_SERVICE" };
1277
+ function inside(folder, canonical) {
1278
+ return (value) => typeof value === "string" && value.startsWith("/") && isPathPrefix(folder, canonical(value));
1279
+ }
1120
1280
  function serviceUseOf(plist, file, folder, canonical) {
1121
1281
  if (typeof plist !== "object" || plist === null) return null;
1122
1282
  const job = plist;
1123
1283
  if (typeof job.StimService !== "object" || job.StimService === null || !Array.isArray(job.ProgramArguments)) return null;
1124
- const argument = job.ProgramArguments.find((value) => typeof value === "string" && value.startsWith("/") && isPathPrefix(folder, canonical(value)));
1284
+ const argument = job.ProgramArguments.find(inside(folder, canonical));
1125
1285
  if (argument === void 0) return null;
1126
1286
  return {
1127
1287
  label: typeof job.Label === "string" ? job.Label : file,
@@ -1129,9 +1289,61 @@ function serviceUseOf(plist, file, folder, canonical) {
1129
1289
  argument
1130
1290
  };
1131
1291
  }
1132
- /** The first installed stim-server service that runs from inside `folder`, or null. macOS only. */
1133
- function serviceRunningFrom(folder, canonical, agentsDir = join(homedir(), "Library", "LaunchAgents")) {
1134
- if (process.platform !== "darwin") return null;
1292
+ /** The launch argument inside `folder` of a unit `stim-server service install` wrote, or null when it has none. */
1293
+ function unitArgument(text, folder, canonical) {
1294
+ const lines = unitLines(text);
1295
+ if (!lines.some((line) => line.section === "X-Stim" && line.key === "Managed" && line.value === "true")) return null;
1296
+ const exec = lines.findLast((line) => line.section === "Service" && line.key === "ExecStart")?.value;
1297
+ const args = exec === void 0 ? null : unitWords(exec, true);
1298
+ if (!args) return void 0;
1299
+ return args.find(inside(folder, canonical)) ?? null;
1300
+ }
1301
+ function unitRunningFrom(folder, canonical, unitsDir) {
1302
+ let names;
1303
+ try {
1304
+ names = readdirSync(unitsDir).filter((name) => name.endsWith(".service"));
1305
+ } catch (error) {
1306
+ return error instanceof Error && "code" in error && error.code === "ENOENT" ? null : {
1307
+ label: "unknown",
1308
+ plist: unitsDir,
1309
+ argument: null
1310
+ };
1311
+ }
1312
+ for (const name of names) {
1313
+ const file = join(unitsDir, name);
1314
+ const label = name.replace(/\.service$/, "");
1315
+ let text;
1316
+ try {
1317
+ text = readFileSync(file, "utf8");
1318
+ } catch {
1319
+ return {
1320
+ label,
1321
+ plist: file,
1322
+ argument: null
1323
+ };
1324
+ }
1325
+ if (!text.includes("[X-Stim]")) continue;
1326
+ const argument = unitArgument(text, folder, canonical);
1327
+ if (argument === void 0) return {
1328
+ label,
1329
+ plist: file,
1330
+ argument: null
1331
+ };
1332
+ if (argument) return {
1333
+ label,
1334
+ plist: file,
1335
+ argument
1336
+ };
1337
+ }
1338
+ return null;
1339
+ }
1340
+ /**
1341
+ * The first installed stim-server service that runs from inside `folder`, or null: a LaunchAgent on macOS, a systemd
1342
+ * user unit on Linux. A service file that cannot be read counts as one, with a null `argument`.
1343
+ */
1344
+ function serviceRunningFrom(folder, canonical, agentsDir = join(homedir(), "Library", "LaunchAgents"), unitsDir = join(homedir(), ".config", "systemd", "user"), platform = process.platform) {
1345
+ if (platform === "linux") return unitRunningFrom(folder, canonical, unitsDir);
1346
+ if (platform !== "darwin") return null;
1135
1347
  let names;
1136
1348
  try {
1137
1349
  names = readdirSync(agentsDir).filter((name) => name.endsWith(".plist"));
@@ -1927,7 +2139,7 @@ function reportRefreshFailure(failure) {
1927
2139
  process.exitCode = 1;
1928
2140
  }
1929
2141
  function mainCheckoutAppDir(root, target) {
1930
- const app = findProjectRoot(process.cwd());
2142
+ const app = findProjectRoot$1(process.cwd());
1931
2143
  if (!app) return root;
1932
2144
  const rel = relative$1(target, app);
1933
2145
  if (!rel || rel.startsWith("..") || isAbsolute$1(rel)) return root;
@@ -1939,7 +2151,7 @@ function mainCheckoutAppDir(root, target) {
1939
2151
  * root can declare react-native without being the app.
1940
2152
  */
1941
2153
  function warmedWorkspace(root, target, cwd) {
1942
- const nearest = findProjectRoot(cwd);
2154
+ const nearest = findProjectRoot$1(cwd);
1943
2155
  const app = nearest && isPathPrefix(target, nearest) && isMobileProject(nearest) ? nearest : null;
1944
2156
  if (app && app !== target) return app;
1945
2157
  const apps = /* @__PURE__ */ new Set();
@@ -1964,7 +2176,7 @@ function registerWarm(worktree) {
1964
2176
  let workspace = null;
1965
2177
  try {
1966
2178
  const { root, target, common } = warmWorktreePaths(process.cwd());
1967
- const app = findProjectRoot(process.cwd());
2179
+ const app = findProjectRoot$1(process.cwd());
1968
2180
  if (app) recordWorkspaceUse(app);
1969
2181
  workspace = warmedWorkspace(root, target, process.cwd());
1970
2182
  if (workspace && workspace !== app) recordWorkspaceUse(workspace);
@@ -2091,7 +2303,7 @@ function registerWarm(worktree) {
2091
2303
  process.exitCode = 1;
2092
2304
  } finally {
2093
2305
  progress?.finish(!process.exitCode);
2094
- const links = workspace && !process.exitCode ? workspaceLinks(workspace) : void 0;
2306
+ const links = workspace && !process.exitCode ? await workspaceLinks(workspace) : void 0;
2095
2307
  if (links) console.error(chalk.dim(workspaceLinkLine(links)));
2096
2308
  }
2097
2309
  });
@@ -2180,6 +2392,11 @@ function nativeCanonicalPath(path) {
2180
2392
  missing.unshift(basename$1(existing));
2181
2393
  }
2182
2394
  }
2395
+ /** Other worktrees git lists inside `path`, which removing `path` would delete with it. */
2396
+ function nestedWorktrees(entries, path) {
2397
+ const root = nativeCanonicalPath(path);
2398
+ return entries.filter((candidate) => !candidate.bare && nativeCanonicalPath(candidate.path) !== root).filter((candidate) => isPathPrefix(root, nativeCanonicalPath(candidate.path))).map((candidate) => candidate.path);
2399
+ }
2183
2400
  function matchWorktreeEntry(entries, path) {
2184
2401
  let best = null;
2185
2402
  const target = nativeCanonicalPath(path);
@@ -2259,13 +2476,14 @@ async function reclaimAll(rootPath, keys = reclaimKeys(rootPath), { preserveRoot
2259
2476
  const releasedLeases = [];
2260
2477
  const removedWorkspaceDirs = [];
2261
2478
  const failedWorkspaceDirs = [];
2479
+ const pressure = currentDiskLevel();
2262
2480
  for (const key of keys) {
2263
2481
  let r;
2264
2482
  try {
2265
2483
  r = await reclaimProject(key, {
2266
2484
  archive: removedBy ? { removedBy } : void 0,
2267
2485
  deleteOwnedDevices: true,
2268
- parkOwnedDevices: true,
2486
+ parkOwnedDevices: pressure < 2,
2269
2487
  preserveProjectRecord: preserveRootProject && key === rootPath,
2270
2488
  stopRequester: { by: "stim worktree remove" }
2271
2489
  });
@@ -2298,6 +2516,7 @@ async function reclaimAll(rootPath, keys = reclaimKeys(rootPath), { preserveRoot
2298
2516
  });
2299
2517
  }
2300
2518
  }
2519
+ if (pressure >= 2 && deletedDevices.length) poolNotes.push(`disk pressure level ${pressure}: deleted the owned devices instead of parking them`);
2301
2520
  for (const key of keys) {
2302
2521
  if (keptEntries.includes(key)) continue;
2303
2522
  const tunnel = readMetroTunnel(key);
@@ -2608,6 +2827,13 @@ async function removeOrRefuse(target, opts, onRemoved) {
2608
2827
  process.exitCode = 1;
2609
2828
  return;
2610
2829
  }
2830
+ const nested = nestedWorktrees(worktrees, entry.path);
2831
+ if (nested.length) {
2832
+ console.error(chalk.red(`Refusing to remove ${path}: it contains the worktree ${nested.join(", ")}.`));
2833
+ console.error(chalk.dim("Remove the nested worktree first, then retry."));
2834
+ process.exitCode = 1;
2835
+ return;
2836
+ }
2611
2837
  const service = serviceRunningFrom(path, nativeCanonicalPath);
2612
2838
  if (service) {
2613
2839
  console.error(chalk.red(service.argument ? `Refusing to remove ${path}: it runs the stim-server service ${service.label} (${service.argument}). ${SERVICE_IN_USE.code}` : `Refusing to remove ${path}: could not read ${service.plist} to check whether the stim-server service ${service.label} runs from it. ${SERVICE_IN_USE.code}`));
@@ -2640,6 +2866,11 @@ async function removeOrRefuse(target, opts, onRemoved) {
2640
2866
  await withManagedRemoteWorktreeRemovalLock(path, () => withReclaimLocks(path, async (lockedKeys) => {
2641
2867
  if (opts.guard?.(lockedKeys).length) return;
2642
2868
  const inspectedHead = resolveFullRef(path, "HEAD", { removal: true });
2869
+ if (opts.expectedHead && inspectedHead !== opts.expectedHead) {
2870
+ console.error(chalk.red(`Refusing to remove ${path}: its HEAD moved since it was checked.`));
2871
+ process.exitCode = 1;
2872
+ return;
2873
+ }
2643
2874
  const current = inspectRemoval(path, mergedHead);
2644
2875
  if (current.blockers.length && !opts.force) {
2645
2876
  printRemovalRefusal(path, current);
@@ -2653,7 +2884,17 @@ async function removeOrRefuse(target, opts, onRemoved) {
2653
2884
  reportRetainedResources(path, result);
2654
2885
  return;
2655
2886
  }
2656
- if (!opts.force && resolveFullRef(path, "HEAD", { removal: true }) !== inspectedHead) {
2887
+ let headMoved = false;
2888
+ if (!opts.force) try {
2889
+ headMoved = resolveFullRef(path, "HEAD", { removal: true }) !== inspectedHead;
2890
+ } catch (error) {
2891
+ if (!isTimeoutError(error)) throw error;
2892
+ printRemovalRefusal(path, timedOutInspection(error));
2893
+ console.error(chalk.dim(`The directory and Stim ownership record for ${path} were kept.`));
2894
+ printRemovalCleanup(result, true);
2895
+ return;
2896
+ }
2897
+ if (headMoved) {
2657
2898
  console.error(chalk.red(`Refusing to remove ${path}: its HEAD moved while its environment was reclaimed.`));
2658
2899
  console.error(chalk.dim(`The directory and Stim ownership record for ${path} were kept.`));
2659
2900
  printRemovalCleanup(result, true);
@@ -2693,7 +2934,17 @@ async function removeOrRefuse(target, opts, onRemoved) {
2693
2934
  worktreeRemovalComplete: true,
2694
2935
  worktreePendingBranchSha: approvedBranchSha
2695
2936
  });
2696
- const checkedOutAt = listWorktrees(branchDeleteCwd).find((candidate) => candidate.branch === branch && resolve$1(candidate.path) !== resolve$1(path))?.path;
2937
+ let checkedOutAt;
2938
+ try {
2939
+ checkedOutAt = listWorktrees(branchDeleteCwd, { removal: true }).find((candidate) => candidate.branch === branch && resolve$1(candidate.path) !== resolve$1(path))?.path;
2940
+ } catch (error) {
2941
+ if (!isTimeoutError(error)) throw error;
2942
+ console.error(chalk.yellow(phaseLine("branch", `kept ${branch} (git did not list the worktrees in time to check it)`)));
2943
+ console.error(chalk.dim(` Retry: stim worktree remove ${path}`));
2944
+ process.exitCode = 1;
2945
+ finish();
2946
+ return;
2947
+ }
2697
2948
  if (checkedOutAt) {
2698
2949
  console.error(chalk.yellow(phaseLine("branch", `kept ${branch} (it is checked out at ${checkedOutAt})`)));
2699
2950
  console.error(chalk.dim(` Switch that worktree to another branch, then retry: stim worktree remove ${path}`));
@@ -2727,4 +2978,4 @@ function worktreeCommand(program) {
2727
2978
  registerRemove(worktree);
2728
2979
  }
2729
2980
  //#endregion
2730
- export { reclaimProject as _, matchWorktreeEntry as a, registerRemove as c, removalPath as d, removalRemedy as f, describeDereferenced as g, worktreeCommand as h, excludeWatchmanCookies as i, registerWarm as l, warmedWorkspace as m, dependencyInstallCommand as n, porcelainPath as o, removeWorktreeTarget as p, excludePodChurn as r, reclaimKeys as s, customIosDirs as t, removalBlockers as u, deleteSelectedArchives as v, sweepArchiveStaging as y };
2981
+ export { lowestFree as A, measurePressure as C, diskPressureLevel as D, sizeScanDeferred as E, levelFloors as O, measureDisk as S, measureSizes as T, describeDereferenced as _, matchWorktreeEntry as a, sweepArchiveStaging as b, reclaimKeys as c, removalBlockers as d, removalPath as f, worktreeCommand as g, warmedWorkspace as h, excludeWatchmanCookies as i, protectWindowMs as j, levelStillShort as k, registerRemove as l, removeWorktreeTarget as m, dependencyInstallCommand as n, nestedWorktrees as o, removalRemedy as p, excludePodChurn as r, porcelainPath as s, customIosDirs as t, registerWarm as u, reclaimProject as v, measurePressureAsync as w, cacheBlocked as x, deleteSelectedArchives as y };