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 { n as runStatusWatch, r as statusCommand, t as readVolumes } from "./status-BL7jVyAB.mjs";
2
+ export { statusCommand as default, readVolumes, runStatusWatch };
@@ -1,14 +1,14 @@
1
- import { N as formatBytes } from "./config-BYDxlMY3.mjs";
1
+ import { P as formatBytes } from "./config-CYcBF478.mjs";
2
2
  import { t as resolveMaintenanceSettings } from "./settings-Djl-mpjX.mjs";
3
3
  import { maintenanceRunClaims, readMaintenanceState } from "@stim-cli/core/state";
4
4
  import { claimRemoveCommand, readClaimSet } from "@stim-cli/core/ownership-claim";
5
5
  //#region src/maintenance/status.ts
6
- function maintenanceStatus() {
6
+ function maintenanceStatus(env = process.env) {
7
7
  const state = readMaintenanceState();
8
8
  const claims = readClaimSet(maintenanceRunClaims());
9
9
  const holder = claims.live[0];
10
10
  const unresolved = claims.unresolved[0];
11
- const settings = resolveMaintenanceSettings();
11
+ const settings = resolveMaintenanceSettings(void 0, env);
12
12
  return {
13
13
  mode: settings.mode,
14
14
  ...settings.invalid ? { invalid: settings.invalid } : {},
@@ -42,8 +42,10 @@ function maintenanceLine(status, includeLabel = true) {
42
42
  const outputs = status.plan.filter((action) => action.kind === "would-clear-outputs");
43
43
  const summary = status.mode === "on" && status.lastPass ? `${status.lastPass.actions} actions, ${(status.lastPass.freedBytes / 1024 ** 3).toFixed(1)} GB freed` : outputs.length ? `would clear build outputs of ${outputs.length} ${outputs.length === 1 ? "workspace" : "workspaces"} (${(outputs.reduce((sum, action) => sum + action.bytes, 0) / 1024 ** 3).toFixed(1)} GB)` : `${status.plan.length} planned actions`;
44
44
  const disk = status.pressure?.disk.map((volume) => `disk ${(volume.freeMb / 1024).toFixed(1)} GB free on ${volume.volume}`).join(", ");
45
+ const devices = status.sizes.filter((size) => size.category === "owned-devices");
46
+ const deviceDisk = devices.length ? `owned devices ${formatBytes(devices.reduce((sum, size) => sum + size.bytes, 0))}` : null;
45
47
  const culprits = (status.mode === "off" ? void 0 : status.pressure?.memory.culprits)?.map((culprit) => `${culprit.name} uses ${formatBytes(culprit.bytes)}${culprit.command ? ` (\`${culprit.command}\`)` : ""}`).join(", ");
46
- return `${includeLabel ? `Auto maintenance (${status.mode === "report" ? "report only" : status.mode}): ` : ""}${at ? `${at}: ` : ""}${status.lastPass ? summary : "no pass has run yet"}${disk ? `; ${disk}` : ""}${culprits ? `; memory: ${culprits}` : ""}${status.running ? "; running" : ""}${status.lastPass?.blocked.length ? `; ${status.lastPass.blocked.join("; ")}` : ""}${status.invalid ? `; invalid: ${status.invalid}` : ""}${status.claim ? `; unresolved claim: ${status.claim.unresolved}; ${status.claim.removeCommand}` : ""}`;
48
+ return `${includeLabel ? `Auto maintenance (${status.mode === "report" ? "report only" : status.mode}): ` : ""}${at ? `${at}: ` : ""}${status.lastPass ? summary : "no pass has run yet"}${disk ? `; ${disk}` : ""}${deviceDisk ? `; ${deviceDisk}` : ""}${status.pressure?.diskLevel ? `; disk pressure level ${status.pressure.diskLevel}` : ""}${culprits ? `; memory: ${culprits}` : ""}${status.running ? "; running" : ""}${status.lastPass?.blocked.length ? `; ${status.lastPass.blocked.join("; ")}` : ""}${status.invalid ? `; invalid: ${status.invalid}` : ""}${status.claim ? `; unresolved claim: ${status.claim.unresolved}; ${status.claim.removeCommand}` : ""}`;
47
49
  }
48
50
  function maintenanceLines(status) {
49
51
  const line = maintenanceLine(status);
@@ -1,13 +1,17 @@
1
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
2
- import { d as androidToolPath } from "./android-Mz_Inn3w.mjs";
3
- import { b as parseSimctlList } from "./ios-RkW4pnQf.mjs";
4
- import { n as easMachineStateRoot } from "./eas-session-ledger-Cm0Gwq2F.mjs";
5
- import { readdirSync, watch } from "node:fs";
6
- import { join } from "node:path";
1
+ import { t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
+ import { l as pidExists } from "./metro-DEXpIhHC.mjs";
3
+ import { n as easMachineStateRoot } from "./eas-session-ledger-op6A54yi.mjs";
4
+ import { d as androidToolPath } from "./android-DUYkNF4u.mjs";
5
+ import { b as parseSimctlList } from "./ios-CpByZy12.mjs";
6
+ import { readdirSync, statSync, watch } from "node:fs";
7
+ import { dirname, join } from "node:path";
7
8
  //#region src/status-watch.ts
8
9
  const WATCH_FALLBACK_MS = 3e4;
9
- const WATCH_LIGHT_INTERVAL_MS = 15e3;
10
- const WATCH_SIMCTL_INTERVAL_MS = 5e3;
10
+ const WATCH_LIGHT_INTERVAL_MS = 1e3;
11
+ const WATCH_TABLES_INTERVAL_MS = 5e3;
12
+ const WATCH_MACHINE_INTERVAL_MS = 15e3;
13
+ const WATCH_PROCESS_INTERVAL_MS = 2e3;
14
+ const WATCH_SIMCTL_INTERVAL_MS = 3e4;
11
15
  const ADB_RESTART_MIN_MS = 1e3;
12
16
  const ADB_RESTART_MAX_MS = 6e4;
13
17
  const SIMCTL_TIMEOUT_MS = 1e4;
@@ -86,6 +90,16 @@ function statusChange(dir, name) {
86
90
  default: return "full";
87
91
  }
88
92
  }
93
+ /**
94
+ * Whether a change to `name`, relative to a repository's git common directory, can change a worktree's git summary:
95
+ * its HEAD, index or a ref, in the main worktree or a linked one. Objects, logs and lock files cannot on their own.
96
+ */
97
+ function gitChange(name) {
98
+ if (name === null) return true;
99
+ const path = name.replaceAll("\\", "/");
100
+ if (path.endsWith(".lock")) return false;
101
+ return /^(HEAD|index|packed-refs|FETCH_HEAD)$/.test(path) || path.startsWith("refs/") || /^worktrees\/[^/]+(\/(HEAD|index))?$/.test(path) || path === "worktrees";
102
+ }
89
103
  /** A stable summary of every simulator's state, or null when the listing is unreadable. */
90
104
  function simulatorSignature(simctlJson) {
91
105
  try {
@@ -94,12 +108,18 @@ function simulatorSignature(simctlJson) {
94
108
  return null;
95
109
  }
96
110
  }
111
+ const SIMULATOR_DIR = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i;
97
112
  /**
98
113
  * Calls `onChange` when anything `stim status` reports may have changed:
99
- * `$STIM_HOME` files, adb device arrivals and departures, and simulator
100
- * state. simctl has no push API reachable from Node, so it is polled.
114
+ * `$STIM_HOME` files, git HEADs, indexes and refs of the watched repositories,
115
+ * exits of the watched processes, adb device arrivals and departures, and
116
+ * simulator state. Process liveness is polled with a signal 0 that spawns
117
+ * nothing. simctl has no push API reachable from Node, so a simulator change is
118
+ * a write CoreSimulator makes in `deviceSet`: to `device_set.plist`, a device
119
+ * directory, or a device's `device.plist`, which carries its state. A slow
120
+ * simctl poll covers events FSEvents drops and a device set that cannot be watched.
101
121
  */
102
- function watchStatusSources({ home, onChange, platform = process.platform, simctlIntervalMs = WATCH_SIMCTL_INTERVAL_MS }) {
122
+ function watchStatusSources({ home, deviceSet, onChange, platform = process.platform, simctlIntervalMs = WATCH_SIMCTL_INTERVAL_MS }) {
103
123
  let stopped = false;
104
124
  const watchers = /* @__PURE__ */ new Map();
105
125
  const desiredDirs = () => {
@@ -136,7 +156,7 @@ function watchStatusSources({ home, onChange, platform = process.platform, simct
136
156
  const change = statusChange(kind, name === null ? null : String(name));
137
157
  if (!change) return;
138
158
  if (kind === "home" || kind === "workspaces" || kind === "workspace") {
139
- listingStaleBefore = Date.now();
159
+ listingVersion++;
140
160
  reconcile();
141
161
  }
142
162
  onChange(change);
@@ -149,16 +169,98 @@ function watchStatusSources({ home, onChange, platform = process.platform, simct
149
169
  } catch {}
150
170
  }
151
171
  };
172
+ const repositories = /* @__PURE__ */ new Map();
173
+ const watchRepositories = (commonDirs) => {
174
+ if (stopped) return;
175
+ const wanted = new Set(commonDirs);
176
+ for (const [dir, watcher] of repositories) {
177
+ if (wanted.has(dir)) continue;
178
+ watcher.close();
179
+ repositories.delete(dir);
180
+ }
181
+ for (const dir of wanted) {
182
+ if (repositories.has(dir)) continue;
183
+ try {
184
+ const watcher = watch(dir, { recursive: true }, (_event, name) => {
185
+ if (gitChange(name === null ? null : String(name))) onChange("full");
186
+ });
187
+ watcher.on("error", () => {
188
+ watcher.close();
189
+ repositories.delete(dir);
190
+ });
191
+ repositories.set(dir, watcher);
192
+ } catch {}
193
+ }
194
+ };
195
+ let processes = [];
196
+ const processTimer = setInterval(() => {
197
+ if (processes.some((pid) => !pidExists(pid))) {
198
+ processes = [];
199
+ onChange("full");
200
+ }
201
+ }, WATCH_PROCESS_INTERVAL_MS);
202
+ processTimer.unref();
152
203
  const adb = trackAdbDevices(() => onChange("full"));
153
204
  let simctl = null;
154
205
  let listing = null;
155
- let listingStaleBefore = 0;
206
+ let listingVersion = 0;
156
207
  let simTimer = null;
157
- if (platform === "darwin") {
208
+ const deviceWatchers = /* @__PURE__ */ new Map();
209
+ if (platform === "darwin" && deviceSet) {
210
+ const changed = () => {
211
+ listingVersion++;
212
+ check();
213
+ onChange("full");
214
+ };
215
+ const watchDir = (dir, listener) => {
216
+ if (deviceWatchers.has(dir)) return;
217
+ try {
218
+ const watcher = watch(dir, (_event, name) => listener(name === null ? null : String(name)));
219
+ watcher.on("error", () => {
220
+ watcher.close();
221
+ deviceWatchers.delete(dir);
222
+ });
223
+ deviceWatchers.set(dir, watcher);
224
+ } catch {}
225
+ };
226
+ const watchDeviceSet = () => {
227
+ if (stopped) return;
228
+ let names = null;
229
+ try {
230
+ names = readdirSync(deviceSet);
231
+ } catch {}
232
+ const wanted = /* @__PURE__ */ new Set();
233
+ if (names) {
234
+ wanted.add(deviceSet);
235
+ for (const name of names) if (SIMULATOR_DIR.test(name)) wanted.add(join(deviceSet, name));
236
+ } else {
237
+ let dir = dirname(deviceSet);
238
+ while (dirname(dir) !== dir && !isDirectory(dir)) dir = dirname(dir);
239
+ wanted.add(dir);
240
+ }
241
+ for (const [dir, watcher] of deviceWatchers) {
242
+ if (wanted.has(dir)) continue;
243
+ watcher.close();
244
+ deviceWatchers.delete(dir);
245
+ }
246
+ for (const dir of wanted) if (dir === deviceSet) watchDir(dir, () => {
247
+ watchDeviceSet();
248
+ changed();
249
+ });
250
+ else if (dirname(dir) === deviceSet) watchDir(dir, (name) => {
251
+ if (name === null || name === "device.plist") changed();
252
+ });
253
+ else watchDir(dir, () => {
254
+ watchDeviceSet();
255
+ if (deviceWatchers.has(deviceSet)) changed();
256
+ });
257
+ };
158
258
  let last = null;
159
259
  const check = () => {
260
+ watchDeviceSet();
160
261
  if (simctl || stopped) return;
161
262
  const startedAt = Date.now();
263
+ const version = listingVersion;
162
264
  let out = "";
163
265
  const child = getExecutor().spawn("xcrun", [
164
266
  "simctl",
@@ -176,18 +278,23 @@ function watchStatusSources({ home, onChange, platform = process.platform, simct
176
278
  });
177
279
  simctl = child;
178
280
  child.stdout?.on("data", (chunk) => out += chunk.toString());
179
- child.on("error", () => {
180
- simctl = null;
181
- });
281
+ child.on("error", () => {});
182
282
  child.on("close", () => {
183
283
  simctl = null;
284
+ if (stopped) return;
285
+ if (version !== listingVersion) {
286
+ check();
287
+ return;
288
+ }
184
289
  const signature = simulatorSignature(out);
185
- if (signature === null || stopped) return;
290
+ if (signature === null) return;
291
+ const wasStale = listing?.version !== version;
186
292
  listing = {
187
293
  at: startedAt,
294
+ version,
188
295
  json: out
189
296
  };
190
- if (last !== null && signature !== last) onChange("full");
297
+ if (last !== null && (signature !== last || wasStale)) onChange("full");
191
298
  last = signature;
192
299
  });
193
300
  };
@@ -197,12 +304,21 @@ function watchStatusSources({ home, onChange, platform = process.platform, simct
197
304
  reconcile();
198
305
  return {
199
306
  reconcile,
200
- simulatorListing: () => listing && listing.at > listingStaleBefore && Date.now() - listing.at <= 2 * simctlIntervalMs ? listing.json : null,
307
+ watchRepositories,
308
+ watchProcesses(pids) {
309
+ processes = [...new Set(pids)];
310
+ },
311
+ simulatorListing: () => listing && listing.version === listingVersion && Date.now() - listing.at <= 2 * simctlIntervalMs ? listing.json : null,
201
312
  stop() {
202
313
  stopped = true;
203
314
  for (const watcher of watchers.values()) watcher.close();
204
315
  watchers.clear();
316
+ for (const watcher of repositories.values()) watcher.close();
317
+ repositories.clear();
318
+ clearInterval(processTimer);
205
319
  if (simTimer) clearInterval(simTimer);
320
+ for (const watcher of deviceWatchers.values()) watcher.close();
321
+ deviceWatchers.clear();
206
322
  simctl?.kill("SIGKILL");
207
323
  adb.stop();
208
324
  }
@@ -249,6 +365,13 @@ function trackAdbDevices(onChange) {
249
365
  child?.kill("SIGTERM");
250
366
  } };
251
367
  }
368
+ function isDirectory(path) {
369
+ try {
370
+ return statSync(path).isDirectory();
371
+ } catch {
372
+ return false;
373
+ }
374
+ }
252
375
  function ownerKey(owner) {
253
376
  return JSON.stringify([
254
377
  owner.kind,
@@ -265,7 +388,7 @@ function ownerSteady(before, after) {
265
388
  /**
266
389
  * The payload `status --watch --json` prints. A usage figure keeps its value from the `previous` printed payload until it moves by a step: an owner's `cpuPercent`
267
390
  * and `memoryMb`, an environment's `memoryMb` and `capacity.committedMb`. An owner's row is kept whole, `residentMb`
268
- * and `processes` included, until one of its two figures moves, so a Mac whose processes only jitter prints no new line.
391
+ * and `processes` included, until one of its two figures moves, so a machine whose processes only jitter prints no new line.
269
392
  */
270
393
  function watchPayload(previous, next) {
271
394
  const payload = { ...next };
@@ -292,5 +415,47 @@ function watchPayload(previous, next) {
292
415
  if (capacity.overCapacity === next.capacity.overCapacity && capacity.liveCount === next.capacity.liveCount && capacity.totalMemoryMb === next.capacity.totalMemoryMb && Math.abs(next.capacity.committedMb - capacity.committedMb) < 16) payload.capacity = capacity;
293
416
  return payload;
294
417
  }
418
+ const holdPullRequest = (worktree) => worktree.pullRequest ? {
419
+ ...worktree,
420
+ pullRequest: {
421
+ ...worktree.pullRequest,
422
+ checkedAt: ""
423
+ }
424
+ } : worktree;
425
+ /**
426
+ * The string `status --watch --json` compares to decide whether a line is new. It is the payload with the bookkeeping
427
+ * timestamps masked: each `pullRequest.checkedAt`, `maintenance.lastChecks`, `maintenance.lastPass.startedAt` and
428
+ * `durationMs`, and `maintenance.running.startedAt`. A change in only those fields prints no line; any printed line
429
+ * carries the current values.
430
+ */
431
+ function watchChangeKey(payload) {
432
+ const { maintenance } = payload;
433
+ return JSON.stringify({
434
+ ...payload,
435
+ environments: payload.environments.map((env) => env.worktree ? {
436
+ ...env,
437
+ worktree: holdPullRequest(env.worktree)
438
+ } : env),
439
+ unprovisionedWorktrees: payload.unprovisionedWorktrees.map(holdPullRequest),
440
+ maintenance: maintenance && {
441
+ ...maintenance,
442
+ lastChecks: {
443
+ pressure: null,
444
+ size: null,
445
+ worktree: null,
446
+ sweep: null
447
+ },
448
+ lastPass: maintenance.lastPass && {
449
+ ...maintenance.lastPass,
450
+ startedAt: 0,
451
+ durationMs: 0
452
+ },
453
+ running: maintenance.running && {
454
+ ...maintenance.running,
455
+ startedAt: ""
456
+ }
457
+ }
458
+ });
459
+ }
295
460
  //#endregion
296
- export { watchStatusSources as a, watchPayload as i, WATCH_LIGHT_INTERVAL_MS as n, createRefreshScheduler as r, WATCH_FALLBACK_MS as t };
461
+ export { createRefreshScheduler as a, watchStatusSources as c, WATCH_TABLES_INTERVAL_MS as i, WATCH_LIGHT_INTERVAL_MS as n, watchChangeKey as o, WATCH_MACHINE_INTERVAL_MS as r, watchPayload as s, WATCH_FALLBACK_MS as t };
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,19 @@
1
+ import { n as runStatusWatch } from "./status-BL7jVyAB.mjs";
2
+ import { parentPort, workerData } from "node:worker_threads";
3
+ //#region src/status-worker.ts
4
+ const STOP_EXIT_MS = 500;
5
+ const cwd = workerData?.cwd;
6
+ const watch = runStatusWatch({
7
+ json: true,
8
+ ...typeof cwd === "string" ? { cwd } : {},
9
+ emit: (line) => parentPort?.postMessage({ line }),
10
+ failed: (message) => parentPort?.postMessage({ failed: message })
11
+ });
12
+ parentPort?.on("message", (message) => {
13
+ if (message !== "stop") return;
14
+ watch.stop();
15
+ parentPort?.close();
16
+ setTimeout(() => process.exit(0), STOP_EXIT_MS);
17
+ });
18
+ //#endregion
19
+ export {};
@@ -0,0 +1,112 @@
1
+ import { t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
+ import { C as saveConfig, c as ensureConfig } from "./config-CYcBF478.mjs";
3
+ import { randomUUID } from "node:crypto";
4
+ import { workspaceId } from "@stim-cli/core";
5
+ import { readHomeIdentity, withConfigLockAsync } from "@stim-cli/core/state";
6
+ import { realpath } from "node:fs/promises";
7
+ import { sharedWorkspaceURL } from "@stim-cli/core/workspace-link";
8
+ //#region src/workspace/home-identity.ts
9
+ function ensureHomeIdentity(signal) {
10
+ return withConfigLockAsync(() => {
11
+ signal?.throwIfAborted();
12
+ const config = ensureConfig();
13
+ const existing = readHomeIdentity(config);
14
+ if (existing) return existing;
15
+ const id = randomUUID();
16
+ config.homeId = id;
17
+ saveConfig(config);
18
+ return id;
19
+ });
20
+ }
21
+ //#endregion
22
+ //#region src/devices/stim-desktop.ts
23
+ const LAUNCH_SERVICES_LOOKUP = `ObjC.import('AppKit'); const url = $.NSWorkspace.sharedWorkspace.URLForApplicationWithBundleIdentifier('dev.stim.desktop'); url.isNil() ? '' : url.path.js`;
24
+ const SCHEME_HANDLER_LOOKUP = `ObjC.import('AppKit'); const url = $.NSWorkspace.sharedWorkspace.URLForApplicationToOpenURL($.NSURL.URLWithString('stim-desktop://workspace')); url.isNil() ? '' : url.path.js`;
25
+ const STIM_DESKTOP_INSTALLED = "Stim Desktop installed";
26
+ /**
27
+ * macOS `open` passes its environment to an app it launches, so Stim Desktop
28
+ * started by a command run under a scoped `STIM_HOME` would serve that home.
29
+ */
30
+ const STIM_DESKTOP_OPEN_OPTIONS = {
31
+ timeoutMs: 5e3,
32
+ killSignal: "SIGKILL",
33
+ omitEnv: ["STIM_HOME"]
34
+ };
35
+ /** Stim Desktop sets `STIM_DESKTOP_APP` to its bundle path for every command it runs; a non-empty value means Desktop is installed. */
36
+ function stimDesktopInstalled(platform = process.platform, env = process.env) {
37
+ if (platform !== "darwin") return false;
38
+ if (env.STIM_DESKTOP_APP) return true;
39
+ return launchServicesFinds(LAUNCH_SERVICES_LOOKUP);
40
+ }
41
+ /** `stimDesktopInstalled` without blocking the event loop. */
42
+ async function stimDesktopInstalledAsync(platform = process.platform, env = process.env, onSpawn) {
43
+ if (platform !== "darwin") return false;
44
+ if (env.STIM_DESKTOP_APP) return true;
45
+ const found = await getExecutor().runFileAsync("osascript", [
46
+ "-l",
47
+ "JavaScript",
48
+ "-e",
49
+ LAUNCH_SERVICES_LOOKUP
50
+ ], {
51
+ timeoutMs: 5e3,
52
+ killSignal: "SIGKILL",
53
+ onSpawn
54
+ }).catch(() => "");
55
+ return Boolean(found);
56
+ }
57
+ function launchServicesFinds(script) {
58
+ return Boolean(getExecutor().runFileQuiet("osascript", [
59
+ "-l",
60
+ "JavaScript",
61
+ "-e",
62
+ script
63
+ ], {
64
+ timeoutMs: 5e3,
65
+ killSignal: "SIGKILL"
66
+ }));
67
+ }
68
+ async function stimDesktopHandlesLinks(platform = process.platform, env = process.env) {
69
+ if (platform !== "darwin") return false;
70
+ if (env.STIM_DESKTOP_APP) return true;
71
+ return Boolean(await getExecutor().runFileAsync("osascript", [
72
+ "-l",
73
+ "JavaScript",
74
+ "-e",
75
+ SCHEME_HANDLER_LOOKUP
76
+ ], {
77
+ timeoutMs: 5e3,
78
+ killSignal: "SIGKILL"
79
+ }).catch(() => ""));
80
+ }
81
+ /**
82
+ * The links that open this workspace for a human, or undefined when no app on this Mac handles
83
+ * `stim-desktop://`. `target` names the device Stim Desktop focuses when the user opens the workspace.
84
+ */
85
+ async function workspaceLinks(root, target, handlesLinks = stimDesktopHandlesLinks) {
86
+ if (!await handlesLinks()) return void 0;
87
+ return { desktop: await workspaceShareURL(root, target) };
88
+ }
89
+ /** A share URL for the canonical workspace in this Stim home, usable by its already-paired phone or Desktop. */
90
+ async function workspaceShareURL(root, target, signal) {
91
+ const canonical = await realpath(root);
92
+ return sharedWorkspaceURL({
93
+ machine: await ensureHomeIdentity(signal),
94
+ workspace: workspaceId(canonical),
95
+ ...target
96
+ });
97
+ }
98
+ function workspaceLinkLine(links) {
99
+ return `Open in Stim: ${links.desktop}`;
100
+ }
101
+ function settingDefault(setting, desktopInstalled = stimDesktopInstalled) {
102
+ if (setting.desktopDefault !== void 0 && desktopInstalled()) return {
103
+ value: setting.desktopDefault,
104
+ reason: STIM_DESKTOP_INSTALLED
105
+ };
106
+ return {
107
+ value: setting.default,
108
+ reason: null
109
+ };
110
+ }
111
+ //#endregion
112
+ export { workspaceLinkLine as a, ensureHomeIdentity as c, stimDesktopInstalledAsync as i, settingDefault as n, workspaceLinks as o, stimDesktopInstalled as r, workspaceShareURL as s, STIM_DESKTOP_OPEN_OPTIONS as t };
@@ -1,3 +1,3 @@
1
- import { P as resolveSupervisorTarget } from "./workspaces-C36s2jb9.mjs";
2
- import { a as resolveCollectorTargets, c as stopWorkspaceNow, i as readSupervisorState, n as clearSupervisorState, o as runStop, r as readCollectorState, s as stopCommand, t as clearCollectorState } from "./stop-BNmBMi1F.mjs";
1
+ import { m as resolveSupervisorTarget } from "./workspaces-BccMFmGQ.mjs";
2
+ import { a as resolveCollectorTargets, c as stopWorkspaceNow, i as readSupervisorState, n as clearSupervisorState, o as runStop, r as readCollectorState, s as stopCommand, t as clearCollectorState } from "./stop-CPzlM1L-.mjs";
3
3
  export { clearCollectorState, clearSupervisorState, stopCommand as default, readCollectorState, readSupervisorState, resolveCollectorTargets, resolveSupervisorTarget, runStop, stopWorkspaceNow };