stim 1.27.0 → 1.29.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 (154) hide show
  1. package/dist/{acquire-artifact-BKN2Yuhg.mjs → acquire-artifact-C2DKfenN.mjs} +1 -1
  2. package/dist/{act-ROviTF_t.mjs → act-CrTcskiE.mjs} +502 -34
  3. package/dist/{activity-Cd-ysFes.mjs → activity-BR5oHSO5.mjs} +6 -5
  4. package/dist/{agent-device-usage-output-C5nCKWp9.mjs → agent-device-usage-output-W0x4SoC7.mjs} +4 -4
  5. package/dist/{android-DriNoAVy.mjs → android-BHKgeOuq.mjs} +5 -5
  6. package/dist/{android--HBgpvpW.mjs → android-BPmCmyAy.mjs} +5 -5
  7. package/dist/{android-Deb9X3_Y.mjs → android-CLU_MMnb.mjs} +1 -1
  8. package/dist/{android-cas-D5e6ecUg.mjs → android-cas-BH6K12__.mjs} +4 -4
  9. package/dist/{android-Cd6w7_qw.mjs → android-l616dRP1.mjs} +42 -39
  10. package/dist/{android-project-DUGMbq28.d.mts → android-project-CCEQyYJK.d.mts} +6 -2
  11. package/dist/api.d.mts +8 -5
  12. package/dist/api.mjs +27 -27
  13. package/dist/{apk-signed-tail-BHQHx3Rm.mjs → apk-signed-tail-B-wKoF_8.mjs} +2 -2
  14. package/dist/{artifact-0AGJYB9O.mjs → artifact-DHuFYfhD.mjs} +12 -12
  15. package/dist/{artifact-faemIZv5.mjs → artifact-Dm9ScLrh.mjs} +12 -12
  16. package/dist/{auto-placement-z-H5pJza.mjs → auto-placement-C8sJsyMN.mjs} +8 -8
  17. package/dist/{browser-web-slD8AvLp.mjs → browser-web-_tQTbQUs.mjs} +12 -12
  18. package/dist/{build-hS0QyFlQ.mjs → build-DtCU9Kim.mjs} +23 -23
  19. package/dist/{build-cache-gBJ-WKzA.mjs → build-cache-BGwTsIEa.mjs} +4 -4
  20. package/dist/{build-plan-CBqYbzYM.mjs → build-plan-CWyjMPKo.mjs} +6 -6
  21. package/dist/{cache-manifest-DEjqGGat.mjs → cache-manifest-evF_zJ9U.mjs} +1 -1
  22. package/dist/cache-manifest.mjs +1 -1
  23. package/dist/{ccache-BWTze1Ls.mjs → ccache-DsDkdP72.mjs} +19 -18
  24. package/dist/{cli-ftXDLto1.mjs → cli-3fjOg-Oc.mjs} +19 -19
  25. package/dist/cli.mjs +1 -1
  26. package/dist/{client-xsdxrhWA.mjs → client-BTUH8TF1.mjs} +41 -8
  27. package/dist/collector-run.mjs +5 -5
  28. package/dist/{command-output-Dj-WT4BP.mjs → command-output-DjCsmzLZ.mjs} +1 -1
  29. package/dist/{config-Cn94Jc0g.mjs → config-AbUjIBOQ.mjs} +121 -19
  30. package/dist/{dependencies-BGokZ-Ng.mjs → dependencies-CHNqX6Pr.mjs} +38 -38
  31. package/dist/{dependency-state-C3OtgG94.mjs → dependency-state-CPKAKCZ8.mjs} +1 -1
  32. package/dist/{dev-client-BMca82xo.mjs → dev-client-CROrxj1x.mjs} +2 -2
  33. package/dist/{device-tM41-TUq.mjs → device-Bmm5qjM-.mjs} +14 -14
  34. package/dist/device-BvpasThQ.mjs +297 -0
  35. package/dist/{device-capacity-6LP7QsaA.mjs → device-capacity-B2ChA-bz.mjs} +86 -18
  36. package/dist/device-host-worker.mjs +15 -13
  37. package/dist/{device-ios-534c14fz.mjs → device-ios-CYzivd31.mjs} +9 -9
  38. package/dist/{device-lease-run-DwsGfjUN.mjs → device-lease-run-qRq_2W2V.mjs} +4 -4
  39. package/dist/{device-pool-BnQqvs6o.mjs → device-pool-CrmiE4_x.mjs} +3 -3
  40. package/dist/{device-BJm0irrq.mjs → device-provision-CK2XiEp1.mjs} +11 -302
  41. package/dist/{doctor-Dbx1ZpD2.mjs → doctor-BO_kaFWX.mjs} +1 -1
  42. package/dist/{doctor-DyqE9n1J.mjs → doctor-Cp4-HN1f.mjs} +20 -15
  43. package/dist/{doctor-F-3VUUyN.mjs → doctor-Dr3C1iXV.mjs} +19 -19
  44. package/dist/doctor-fingerprint.mjs +1 -1
  45. package/dist/{doctor-watchman-CxDbyrrt.mjs → doctor-watchman-CJr2aXXv.mjs} +4 -4
  46. package/dist/{eas-build-CjNSWmjo.mjs → eas-build-D-9HmGZS.mjs} +2 -2
  47. package/dist/{eas-fallback-9fqb46kW.mjs → eas-fallback-Cemt2GVL.mjs} +4 -4
  48. package/dist/{eas-session-ledger-DrP4OuuM.mjs → eas-session-ledger-B0KLZx5m.mjs} +36 -7
  49. package/dist/{error-diagnostics-snej9k4j.mjs → error-diagnostics-CV_1RoEH.mjs} +8 -8
  50. package/dist/{gc-CGZ1Yg88.mjs → gc-CKHqL4aS.mjs} +81 -18
  51. package/dist/{gc-BRwAY3qT.mjs → gc-DjXwQXHK.mjs} +2 -2
  52. package/dist/{guide-_rfEh_zM.mjs → guide-CeRlWVsS.mjs} +230 -62
  53. package/dist/{hosted-android-BMKzUNnY.mjs → hosted-android-DI_vvv7U.mjs} +5 -6
  54. package/dist/{hosted-client-D7Pk_Oo1.mjs → hosted-client-CgoxdU9j.mjs} +44 -17
  55. package/dist/{hosted-logs-B1gqQuva.mjs → hosted-logs-C-4INmkn.mjs} +17 -8
  56. package/dist/{hosted-logs-sync-Dg3qrZmV.mjs → hosted-logs-sync-Bf5s02fi.mjs} +5 -5
  57. package/dist/{hosted-macos-B9w4H8hc.mjs → hosted-macos-Doh85YUM.mjs} +5 -5
  58. package/dist/{hosted-native-CdgaiuyP.mjs → hosted-native-DvZENAL-.mjs} +11 -8
  59. package/dist/{idle-shutdown-Cbvo5KEh.mjs → idle-shutdown-BM37gMfU.mjs} +7 -7
  60. package/dist/{ios-Bk4mWbtS.mjs → ios-CNDH6fNF.mjs} +8 -8
  61. package/dist/{ios-E26qSpkb.mjs → ios-CoMCWfub.mjs} +4 -4
  62. package/dist/{ios-B5HlVMhQ.mjs → ios-UM_dManb.mjs} +31 -29
  63. package/dist/{ios-device-C_QkIf1Z.mjs → ios-device-L1-pota_.mjs} +1 -1
  64. package/dist/{ios-project-D8Jcy_br.mjs → ios-project-DJYptOCh.mjs} +7 -7
  65. package/dist/{ios-state-BZ03NFgF.mjs → ios-state-Ce_dystM.mjs} +1 -1
  66. package/dist/{js-swap-Dg2a945i.mjs → js-swap-BthE4kZC.mjs} +4 -4
  67. package/dist/{launch-CRyBeNsA.mjs → launch-D798aSm8.mjs} +19 -19
  68. package/dist/{lightened-BCsdAGj_.mjs → lightened-vSxkstg6.mjs} +4 -4
  69. package/dist/{logs-aJQb-RDg.mjs → logs-BND8MiBq.mjs} +9 -8
  70. package/dist/{logs-CC_-ZzEE.mjs → logs-CilPftm3.mjs} +5 -5
  71. package/dist/{macos-BGmTpnv9.mjs → macos-BOQrKYeJ.mjs} +1 -1
  72. package/dist/{macos-DlCBhMw5.mjs → macos-CxUi9xcE.mjs} +20 -20
  73. package/dist/macos-run.mjs +1 -1
  74. package/dist/maintenance-run.mjs +13 -9
  75. package/dist/{metro-CvyD-xwe.mjs → metro-BMQHczcf.mjs} +2 -2
  76. package/dist/{metro-gateway-BnHdqMO_.mjs → metro-request-BtF7ox53.mjs} +25 -46
  77. package/dist/{named-ports-BCyMWA6b.mjs → named-ports-DcktE2Pw.mjs} +2 -2
  78. package/dist/{native-android-DlpxCyOP.mjs → native-android-BkhrCjdX.mjs} +16 -16
  79. package/dist/{native-gradle-artifact-inputs-C13qT7R_.mjs → native-gradle-artifact-inputs-Cw4P6Gyr.mjs} +3 -3
  80. package/dist/{native-runtime-DqaIBO5w.mjs → native-runtime-DyH2gkXK.mjs} +6 -6
  81. package/dist/{native-xcode-inputs-B1W8SrxB.mjs → native-xcode-inputs-DV8jr3kJ.mjs} +2 -2
  82. package/dist/{native-xcode-ios-QPP0Rm68.mjs → native-xcode-ios-DdpPG2iT.mjs} +15 -15
  83. package/dist/{ndjson-Dy2W4vRa.mjs → ndjson-CrjIsGzw.mjs} +2 -2
  84. package/dist/offload-worker.d.mts +1 -1
  85. package/dist/offload-worker.mjs +22 -22
  86. package/dist/{ownership-Bx-0cku-.mjs → ownership-Dtz9G5Gl.mjs} +2 -2
  87. package/dist/{phone-reverses-C9yAaKEv.mjs → phone-reverses-DZRad8HT.mjs} +4 -4
  88. package/dist/{placement-log-BXUbiZM6.mjs → placement-log-CoN6xrjY.mjs} +1 -1
  89. package/dist/{plan-placement-UxnQjv5Z.mjs → plan-placement-7sHuqR-r.mjs} +6 -6
  90. package/dist/{ports-uUrghqWN.mjs → ports-VQSAPZhl.mjs} +3 -3
  91. package/dist/{prebuild-BDpToDgR.mjs → prebuild-Bqp0LFGN.mjs} +9 -9
  92. package/dist/{project-DYj-HVx6.mjs → project-D1n0K4yg.mjs} +15 -15
  93. package/dist/{react-native-android-DDBccgJw.mjs → react-native-android-FQ-yX3Mv.mjs} +22 -22
  94. package/dist/{react-native-build-DaK2IFyP.mjs → react-native-build-D58bIqV9.mjs} +7 -7
  95. package/dist/{react-native-doctor-B-Mw6DcR.mjs → react-native-doctor-AkUH2aca.mjs} +5 -5
  96. package/dist/{react-native-ios-DjYwUF9U.mjs → react-native-ios-Dmsv8j7T.mjs} +14 -14
  97. package/dist/{recordings-C20iUZfp.mjs → recordings-CHMaF73C.mjs} +1 -1
  98. package/dist/{reload-fUdkH2_p.mjs → reload-BV0nD-k9.mjs} +14 -14
  99. package/dist/{reload-DJBeF_rC.mjs → reload-CDKEzzaf.mjs} +1 -1
  100. package/dist/{remote-y6n99WMW.mjs → remote-C8xyslUa.mjs} +9 -9
  101. package/dist/{result-CTqBw2Te.mjs → result-9fqcJ90W.mjs} +16 -16
  102. package/dist/{run-DaCeNKRm.mjs → run-BQAmrohh.mjs} +2 -2
  103. package/dist/{selection-Bs8phwhN.mjs → selection-D1ZDzHFX.mjs} +105 -62
  104. package/dist/{server-bare-BOh-iZEj.mjs → server-bare-CEQdB_F4.mjs} +37 -1
  105. package/dist/{server-command-8CuA51Cv.mjs → server-command-RlS-Kl4a.mjs} +5 -5
  106. package/dist/server-expo-BVV9qy31.mjs +2 -0
  107. package/dist/{server-expo-ABQs2XFA.mjs → server-expo-bB1VV2k-.mjs} +8 -5
  108. package/dist/{settings-CMHhQNwI.mjs → settings-BcVCcAT5.mjs} +2 -2
  109. package/dist/{settings-BDVI8Ivc.mjs → settings-D776ygML.mjs} +47 -3
  110. package/dist/{settings-Djl-mpjX.mjs → settings-D9LtQaUw.mjs} +2 -1
  111. package/dist/{settings-payload-cm60Zhib.mjs → settings-payload-_aatELz2.mjs} +4 -4
  112. package/dist/{settings-write-BdNRLlBn.mjs → settings-write-CkTVGQ4O.mjs} +5 -5
  113. package/dist/settings.schema.json +58 -9
  114. package/dist/{simslim-DCQwzoPy.mjs → simslim-CbpHERcv.mjs} +1 -1
  115. package/dist/{slot-launch-0l7RqSpr.mjs → slot-launch-Dbgfh8gc.mjs} +6 -6
  116. package/dist/{stage-F4cAfJGi.mjs → stage-BuHuRj1y.mjs} +1 -1
  117. package/dist/{start-DcqnF9p8.mjs → start-Cr-c3Xhq.mjs} +1 -1
  118. package/dist/{start-DrPwER_2.mjs → start-Dlv4XXTP.mjs} +11 -11
  119. package/dist/{state-CZxLyetD.mjs → state-C2AUjjhg.mjs} +1 -1
  120. package/dist/{state-BX1y5syV.mjs → state-D5ZxwCGJ.mjs} +2 -2
  121. package/dist/{stats-GxuCbles.mjs → stats-D5c-uIBp.mjs} +4 -4
  122. package/dist/{status-7ULDEJ1e.mjs → status-CK7ZoEhV.mjs} +2 -2
  123. package/dist/{status-BfnK9pUd.mjs → status-D6PBK6_-.mjs} +49 -26
  124. package/dist/{status-Bj7ZYvvc.mjs → status-DbQv--Yb.mjs} +1 -1
  125. package/dist/{status-watch-BfabQn03.mjs → status-watch-okrpea4i.mjs} +17 -6
  126. package/dist/status-worker.mjs +1 -1
  127. package/dist/{stim-desktop-CbWo21kb.mjs → stim-desktop-CYXLFpFS.mjs} +1 -1
  128. package/dist/{stop-x1Yu3He4.mjs → stop-CHtAiv79.mjs} +2 -2
  129. package/dist/{stop-D-EAr25B.mjs → stop-p9uSKuGE.mjs} +20 -19
  130. package/dist/{stop-CH79S3IZ.mjs → stop-uRQ-zYcl.mjs} +9 -5
  131. package/dist/supervisor-run.d.mts +1 -0
  132. package/dist/supervisor-run.mjs +243 -65
  133. package/dist/{support-Be0UeVZU.mjs → support-BMpQIug0.mjs} +11 -10
  134. package/dist/{support-CNg_YsOk.mjs → support-PFyTkrnr.mjs} +4 -4
  135. package/dist/{swiftpm-artifact-inputs-uPqYvGBv.mjs → swiftpm-artifact-inputs-Cddq6jN2.mjs} +1 -1
  136. package/dist/{swiftpm-macos-Ch4YjY_A.mjs → swiftpm-macos-BSj9iZlI.mjs} +8 -8
  137. package/dist/{toolchain-JYAOquPg.mjs → toolchain-B-mzR9Rh.mjs} +1 -1
  138. package/dist/{toolchain-CbCG6C5Z.mjs → toolchain-CLGnEUgT.mjs} +4 -4
  139. package/dist/{trigger-DMou-X7j.mjs → trigger-CfnOfpDd.mjs} +1 -1
  140. package/dist/trigger-DBZ-GBrl.mjs +2 -0
  141. package/dist/{warm-progress-C0RsbngN.mjs → warm-progress--KkkBBaq.mjs} +3 -3
  142. package/dist/web-BxSo493O.mjs +2 -0
  143. package/dist/web-run.mjs +5 -5
  144. package/dist/{web-Cq_AQ4DK.mjs → web-xlVssjQf.mjs} +8 -8
  145. package/dist/{workspace-state-BjqdjnJR.mjs → workspace-state-DGwkPXwq.mjs} +2 -2
  146. package/dist/{workspaces-DFbj07jp.mjs → workspaces-CvSYD_78.mjs} +106 -26
  147. package/dist/{worktree-COAJ3-OD.mjs → worktree-CaQBf6kh.mjs} +26 -47
  148. package/dist/worktree-DTOIohFe.mjs +2 -0
  149. package/package.json +7 -7
  150. package/shim/bundle-response.cjs +37 -0
  151. package/dist/server-expo-Ba_Y21vB.mjs +0 -2
  152. package/dist/trigger-qp2ji5wE.mjs +0 -2
  153. package/dist/web-Je6abcpz.mjs +0 -2
  154. package/dist/worktree-JGUd_53L.mjs +0 -2
@@ -1,13 +1,13 @@
1
1
  import { C as reportSignal, t as getExecutor } from "./exec-aULwtNly.mjs";
2
- import { M as withDirLock$1, N as withDirLockAsync$1, w as workspaceAgentDeviceDir } from "./workspace-state-BjqdjnJR.mjs";
3
- import { G as projectDeviceSlots, V as deviceSlotKey } from "./config-Cn94Jc0g.mjs";
4
- import { a as formatElapsed, o as formatLongDuration, r as clockTime, u as plural } from "./command-output-Dj-WT4BP.mjs";
5
- import { n as isInsideProject } from "./metro-CvyD-xwe.mjs";
6
- import { r as cdpEndpoint } from "./state-BX1y5syV.mjs";
2
+ import { M as withDirLock$1, N as withDirLockAsync$1, w as workspaceAgentDeviceDir } from "./workspace-state-DGwkPXwq.mjs";
3
+ import { G as projectDeviceSlots, V as deviceSlotKey } from "./config-AbUjIBOQ.mjs";
4
+ import { a as formatElapsed, o as formatLongDuration, r as clockTime, u as plural } from "./command-output-DjCsmzLZ.mjs";
5
+ import { n as isInsideProject } from "./metro-BMQHczcf.mjs";
6
+ import { r as cdpEndpoint } from "./state-D5ZxwCGJ.mjs";
7
7
  import { accessSync, constants, existsSync, mkdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
8
8
  import { delimiter, dirname, join, resolve } from "node:path";
9
9
  import { workspaceId } from "@stim-cli/core";
10
- import { ACTIVITY_RECENCY_BASES, easMachineStateRoot, easMachineStateRoot as easMachineStateRoot$1, easSessionLedgerFile, easSessionLedgerLock, readEasSessionLedger, readEasSessionLedger as readEasSessionLedger$1, validEasSessionClaim } from "@stim-cli/core/state";
10
+ import { ACTIVITY_RECENCY_BASES, easMachineStateRoot, easMachineStateRoot as easMachineStateRoot$1, easSessionLedgerFile, easSessionLedgerLock, loadState, readEasSessionLedger, readEasSessionLedger as readEasSessionLedger$1, validEasSessionClaim } from "@stim-cli/core/state";
11
11
  import { basename as basename$1, sep as sep$1 } from "path";
12
12
  //#region src/status.ts
13
13
  const IOS_SIM_MB = 1500;
@@ -348,6 +348,35 @@ function capacity(states, totalMemoryMb) {
348
348
  overCapacity: Boolean(totalMemoryMb && committedMb > totalMemoryMb * .6)
349
349
  };
350
350
  }
351
+ /** `capacity.load` from a load reading, the `server.maxLoadPerCore` it is busy at, and the configured limit. */
352
+ function capacityLoad({ cpus, loadPerCore }, busyAt, limit) {
353
+ return {
354
+ cpus,
355
+ loadPerCore,
356
+ busyAt,
357
+ limit,
358
+ state: loadState(loadPerCore, busyAt, limit)
359
+ };
360
+ }
361
+ function loadLine({ loadPerCore, busyAt, limit }) {
362
+ return `load ${loadPerCore}/core (busy at ${busyAt}${limit === null ? "" : `, holding at ${limit}`})`;
363
+ }
364
+ /** The plain status lines for the `concurrency.maxBuilds` and `concurrency.maxDevices` caps that are set. */
365
+ function slotUsageLines({ builds, devices }) {
366
+ const lines = [];
367
+ if (builds) {
368
+ const holders = builds.holders.map((holder) => holder.unresolved ? `slot ${holder.slot} unresolved` : holder.client ? `offloaded for ${holder.client}` : holder.workspace ? basename$1(holder.workspace) : `slot ${holder.slot}`);
369
+ lines.push(`builds ${builds.inUse}/${builds.max} (concurrency.maxBuilds)${holders.length ? `: ${holders.join(", ")}` : ""}`);
370
+ }
371
+ if (devices) {
372
+ if (devices.inUse === null) lines.push(`devices ?/${devices.max} (concurrency.maxDevices): ${devices.unknown ?? "not counted"}`);
373
+ else {
374
+ const holders = devices.holders.map((holder) => `${holder.label} ${holder.platform}${holder.slot && holder.slot !== "default" ? ` [${holder.slot}]` : ""}${holder.booting ? " (booting)" : ""}`);
375
+ lines.push(`devices ${devices.inUse}/${devices.max} (concurrency.maxDevices)${holders.length ? `: ${holders.join(", ")}` : ""}`);
376
+ }
377
+ }
378
+ return lines;
379
+ }
351
380
  function parseDfFree(output) {
352
381
  const lines = String(output || "").trim().split("\n");
353
382
  if (lines.length < 2) return null;
@@ -724,4 +753,4 @@ async function removeEasSessionClaimAsync(sessionId, root = easMachineStateRoot(
724
753
  return withDirLockAsync$1(easSessionLedgerLock(root), () => removeEasSessionClaim(sessionId, root, when), { signal });
725
754
  }
726
755
  //#endregion
727
- export { remoteDeviceState as A, environmentState as C, parseDfFree as D, metroReverseTargets as E, tightVolumes as M, unprovisionedWorktrees as N, poolLine as O, withWebFacts as P, diskLine as S, gitSummaryText as T, addReverseMissingIssue as _, removeEasSessionClaim as a, deviceLeaseLines as b, inspectStimVersions as c, parseWatchRoots as d, parseWatchmanClients as f, activityLabel as g, RECENT_LAUNCH_MS as h, recordEasSessionClaim as i, statusActivity as j, remoteDeviceLine as k, parseSubscriberNames as l, runWatchman as m, easMachineStateRoot$1 as n, removeEasSessionClaimAsync as o, parseWatchmanPid as p, readEasSessionLedger$1 as r, compareStimVersions as s, assertEasMachineRootWritable as t, parseTriggerCount as u, applyMachineMemory as v, formatSpace as w, deviceLeaseStates as x, capacity as y };
756
+ export { poolLine as A, diskLine as C, loadLine as D, gitSummaryText as E, tightVolumes as F, unprovisionedWorktrees as I, withWebFacts as L, remoteDeviceState as M, slotUsageLines as N, metroReverseTargets as O, statusActivity as P, deviceLeaseStates as S, formatSpace as T, addReverseMissingIssue as _, removeEasSessionClaim as a, capacityLoad as b, inspectStimVersions as c, parseWatchRoots as d, parseWatchmanClients as f, activityLabel as g, RECENT_LAUNCH_MS as h, recordEasSessionClaim as i, remoteDeviceLine as j, parseDfFree as k, parseSubscriberNames as l, runWatchman as m, easMachineStateRoot$1 as n, removeEasSessionClaimAsync as o, parseWatchmanPid as p, readEasSessionLedger$1 as r, compareStimVersions as s, assertEasMachineRootWritable as t, parseTriggerCount as u, applyMachineMemory as v, environmentState as w, deviceLeaseLines as x, capacity as y };
@@ -1,12 +1,12 @@
1
1
  import { t as getExecutor } from "./exec-aULwtNly.mjs";
2
- import { r as readWorkspaceState$1 } from "./workspace-state-BjqdjnJR.mjs";
3
- import { H as deviceSlotPlatforms, V as deviceSlotKey, p as getProject } from "./config-Cn94Jc0g.mjs";
4
- import { v as launchErrorPreview } from "./command-output-Dj-WT4BP.mjs";
5
- import { I as readWorkspaceLaunches } from "./project-DYj-HVx6.mjs";
6
- import { o as androidHome, u as androidToolCwd } from "./android-DriNoAVy.mjs";
7
- import { d as resolveProjectMetro } from "./metro-CvyD-xwe.mjs";
8
- import { i as parseLogcatLine, n as androidLogGroups, r as isAndroidCrashText } from "./android-Deb9X3_Y.mjs";
9
- import { S as parseLease, v as deviceLeasePath, y as fileLeaseIo } from "./activity-Cd-ysFes.mjs";
2
+ import { r as readWorkspaceState$1 } from "./workspace-state-DGwkPXwq.mjs";
3
+ import { H as deviceSlotPlatforms, V as deviceSlotKey, p as getProject } from "./config-AbUjIBOQ.mjs";
4
+ import { v as launchErrorPreview } from "./command-output-DjCsmzLZ.mjs";
5
+ import { I as readWorkspaceLaunches } from "./project-D1n0K4yg.mjs";
6
+ import { o as androidHome, u as androidToolCwd } from "./android-BHKgeOuq.mjs";
7
+ import { d as resolveProjectMetro } from "./metro-BMQHczcf.mjs";
8
+ import { i as parseLogcatLine, n as androidLogGroups, r as isAndroidCrashText } from "./android-CLU_MMnb.mjs";
9
+ import { S as parseLease, v as deviceLeasePath, y as fileLeaseIo } from "./activity-BR5oHSO5.mjs";
10
10
  import { r as deviceConsoleLevel } from "./ios-device-CiBA-er9.mjs";
11
11
  import { createHash, randomUUID } from "node:crypto";
12
12
  import { existsSync, readFileSync, renameSync } from "node:fs";
@@ -1,23 +1,24 @@
1
1
  import { D as ownership_claim_exports, S as process_identity_exports, c as throwIfCancelled, l as WorkspaceProcessCleanupError, m as declareSpawnsOn, t as getExecutor, v as stopDeclaringSpawnsOn, x as withDrainingCancellation } from "./exec-aULwtNly.mjs";
2
- import { E as workspaceDir, u as workspaceLastUsed } from "./workspace-state-BjqdjnJR.mjs";
3
- import { F as isOnMountedVolume, G as projectDeviceSlots, I as listMountedVolumes, L as measuredDirectorySizeAsync, N as directorySizeAsync, O as withConfigLockAsync$1, P as formatBytes, R as volumeRootFor, S as removeProject, _ as loadConfig$1, d as getConfigDir, j as acquireAvdClaim } from "./config-Cn94Jc0g.mjs";
4
- import { d as quotedPath$1, h as shortUdid, o as formatLongDuration, u as plural } from "./command-output-Dj-WT4BP.mjs";
2
+ import { E as workspaceDir, u as workspaceLastUsed } from "./workspace-state-DGwkPXwq.mjs";
3
+ import { F as isOnMountedVolume, G as projectDeviceSlots, I as listMountedVolumes, L as measuredDirectorySizeAsync, N as directorySizeAsync, O as withConfigLockAsync$1, P as formatBytes, R as volumeRootFor, S as removeProject, _ as loadConfig$1, d as getConfigDir, j as acquireAvdClaim } from "./config-AbUjIBOQ.mjs";
4
+ import { d as quotedPath$1, h as shortUdid, o as formatLongDuration, u as plural } from "./command-output-DjCsmzLZ.mjs";
5
5
  import { t as runOperationFile } from "./operation-exec-Dp4FuIGR.mjs";
6
- import { At as listWorktreesAsync, Bt as resolveSourceCheckoutAsync, Gt as TRASH_CLAIMS, Jt as deleteTrashEntry, qt as TRASH_MANIFEST } from "./settings-BDVI8Ivc.mjs";
7
- import { i as findProjectRoot$1, v as detectIsExpo } from "./project-DYj-HVx6.mjs";
8
- import { Ct as forgetCreatedDeviceAsync, F as listAvdsAsync, L as listOrphanedAvdDirectories, V as ownedAvdDirectory, ft as POOL_SETTING_REMEDY, h as avdNameAbsent, vt as parkedMaxSetting, wt as readCreatedDevices$1 } from "./android-DriNoAVy.mjs";
9
- import { $ as gradleVersionLines, $n as memoryCacheKind, B as includesArchives, Ct as describeError, En as runProcessOperation, F as gcOptionsOf, Ft as withEasProjectLock, G as planCacheEmptying, H as includesRecordings, J as selectsBeyondCaches, Jn as parseArchiveSelector, K as previewScopedEmptying, L as openGcLog, Q as deleteGradleVersions, St as deleteEasSessions, U as includesWorkspaceOutputs, V as includesParkedDevices, W as isWorkspacesScope, X as collectGradleVersions, Y as trimCaches, Zn as collectMemoryReport, _t as findStaleDeviceRecords, ar as scopedMemoryReport, at as DEVICE_LIST_TIMEOUT_MS, bt as withAndroidAvdSizes, ct as collectParkedSims, dt as deleteProjectDevices, er as memoryLines, et as gradleVersionsPending, fr as sizeCaches, gt as findOrphanedDevices, ht as eraseParkedDevices, ir as reclaimMemory, it as collectInventory, lt as deleteParkedAvds, mt as deviceSweepIsScoped, nr as memorySweepIsScoped, ot as collectDeviceLeases, pt as describeUnverifiableDevices, q as selectCaches, rr as memoryWorkPending, rt as getMachineCacheReport, sr as phase, st as collectParkedAvds, tr as memoryScope, tt as includesGradleVersions, ur as discoverCaches, ut as deleteParkedSims, vt as findStaleProjectDevices, wt as withRemoteSessionGcLocks, xt as collectEasSessionSweep, yt as unverifiedDeviceCommand, z as emptyCaches } from "./ccache-BWTze1Ls.mjs";
10
- import { n as easMachineStateRoot$1, o as removeEasSessionClaimAsync, r as readEasSessionLedger$1 } from "./eas-session-ledger-DrP4OuuM.mjs";
11
- import { A as collectIdleDevicesAsync, Ct as createGcResults, Dt as readConcurrency, Et as mapLimited, F as parseIdleDuration, I as shutDownIdleDevices, N as idleDeviceLines, Ot as sizeConcurrency, St as GC_OUTPUT, Tt as eachLimited, _ as withIdleWorkspace, a as collectOrphanedWorkspaces, bt as listBuildSlots, c as isInsideWorkspaces, d as rootPresence, f as sizeText, h as ARTIFACT_DIRS, i as clearWorkspaceOutputs, k as collectIdleDevices, l as listWorkspaceDirs, n as REBUILD_COST, o as collectWorkspaceOutputs, r as WORKSPACE_OUTPUT_DIRS, s as deleteOrphanedWorkspaces, t as LIGHTEN_AFTER_MS, y as workspaceInUseAsync } from "./workspaces-DFbj07jp.mjs";
6
+ import { $t as TRASH_MANIFEST, Ft as matchWorktreeEntry, Wt as resolveSourceCheckoutAsync, Zt as TRASH_CLAIMS, en as deleteTrashEntry, jt as listWorktreesAsync } from "./settings-D776ygML.mjs";
7
+ import { i as findProjectRoot$1, v as detectIsExpo } from "./project-D1n0K4yg.mjs";
8
+ import { Ct as forgetCreatedDeviceAsync, F as listAvdsAsync, L as listOrphanedAvdDirectories, V as ownedAvdDirectory, ft as POOL_SETTING_REMEDY, h as avdNameAbsent, vt as parkedMaxSetting, wt as readCreatedDevices$1 } from "./android-BHKgeOuq.mjs";
9
+ import { $ as gradleVersionLines, $n as memoryCacheKind, B as includesArchives, Ct as describeError, En as runProcessOperation, F as gcOptionsOf, Ft as withEasProjectLock, G as planCacheEmptying, H as includesRecordings, J as selectsBeyondCaches, Jn as parseArchiveSelector, K as previewScopedEmptying, L as openGcLog, Q as deleteGradleVersions, St as deleteEasSessions, U as includesWorkspaceOutputs, V as includesParkedDevices, W as isWorkspacesScope, X as collectGradleVersions, Y as trimCaches, Zn as collectMemoryReport, _t as findStaleDeviceRecords, ar as scopedMemoryReport, at as DEVICE_LIST_TIMEOUT_MS, bt as withAndroidAvdSizes, ct as collectParkedSims, dt as deleteProjectDevices, er as memoryLines, et as gradleVersionsPending, fr as sizeCaches, gt as findOrphanedDevices, ht as eraseParkedDevices, ir as reclaimMemory, it as collectInventory, lt as deleteParkedAvds, mt as deviceSweepIsScoped, nr as memorySweepIsScoped, ot as collectDeviceLeases, pt as describeUnverifiableDevices, q as selectCaches, rr as memoryWorkPending, rt as getMachineCacheReport, sr as phase, st as collectParkedAvds, tr as memoryScope, tt as includesGradleVersions, ur as discoverCaches, ut as deleteParkedSims, vt as findStaleProjectDevices, wt as withRemoteSessionGcLocks, xt as collectEasSessionSweep, yt as unverifiedDeviceCommand, z as emptyCaches } from "./ccache-DsDkdP72.mjs";
10
+ import { n as easMachineStateRoot$1, o as removeEasSessionClaimAsync, r as readEasSessionLedger$1 } from "./eas-session-ledger-B0KLZx5m.mjs";
11
+ import { At as mapLimited, Dt as createGcResults, Et as GC_OUTPUT, I as idleDeviceLines, M as collectIdleDevices, Mt as sizeConcurrency, N as collectIdleDevicesAsync, R as parseIdleDuration, a as collectOrphanedWorkspaces, b as workspaceInUseAsync, c as isInsideWorkspaces, f as rootPresence, g as ARTIFACT_DIRS, i as clearWorkspaceOutputs, jt as readConcurrency, kt as eachLimited, n as REBUILD_COST, o as collectWorkspaceOutputs, p as sizeText, r as WORKSPACE_OUTPUT_DIRS, s as deleteOrphanedWorkspaces, t as LIGHTEN_AFTER_MS, u as listWorkspaceDirs, v as withIdleWorkspace, wt as listBuildSlots, z as shutDownIdleDevices } from "./workspaces-CvSYD_78.mjs";
12
12
  import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
13
- import { N as listBuildLocks, k as removeExpiredLease } from "./activity-Cd-ysFes.mjs";
14
- import { d as listAllIosSims, f as listAllIosSimsAsync } from "./ios-E26qSpkb.mjs";
15
- import { r as readCollectors } from "./ownership-Bx-0cku-.mjs";
16
- import { A as reclaimProject, M as sweepArchiveStaging, a as matchWorktreeEntry, j as deleteSelectedArchives, k as describeDereferenced } from "./worktree-COAJ3-OD.mjs";
17
- import { p as writeCacheFile } from "./warm-progress-C0RsbngN.mjs";
18
- import { a as restoreProblem, o as workspaceKeys } from "./lightened-BCsdAGj_.mjs";
19
- import { C as worktreeRemovalReason, S as worktreePullRequestNote, _ as ownedDeviceUsage, a as previewMaintenance, b as collectWorktreeSweep, c as deleteTempLeftovers, d as appRoots, f as artifactWorktrees, h as finishedWorkspaces, l as tempLeftoverLines, m as collectArtifactsAsync, o as triggeringRoot, p as clearArtifact, s as collectTempLeftovers, t as deleteIdleWorkspaceDevices, u as tempLeftoverSection, v as maintenancePinned, x as removeWorktrees, y as candidateRootsAsync } from "./act-ROviTF_t.mjs";
20
- import { i as getSwiftpmCacheUsage, n as swiftpmCacheLines, r as getAgentDeviceUsage, t as agentDeviceLines } from "./agent-device-usage-output-C5nCKWp9.mjs";
13
+ import { N as listBuildLocks, k as removeExpiredLease } from "./activity-BR5oHSO5.mjs";
14
+ import { d as listAllIosSims, f as listAllIosSimsAsync } from "./ios-CoMCWfub.mjs";
15
+ import { t as resolveMaintenanceSettings } from "./settings-D9LtQaUw.mjs";
16
+ import { r as readCollectors } from "./ownership-Dtz9G5Gl.mjs";
17
+ import { A as deleteSelectedArchives, O as describeDereferenced, j as sweepArchiveStaging, k as reclaimProject } from "./worktree-CaQBf6kh.mjs";
18
+ import { p as writeCacheFile } from "./warm-progress--KkkBBaq.mjs";
19
+ import { a as restoreProblem, o as workspaceKeys } from "./lightened-vSxkstg6.mjs";
20
+ import { C as candidateRootsAsync, D as worktreeRemovalReason, E as worktreePullRequestNote, S as maintenancePinned, T as removeWorktrees, _ as finishedWorkspaces, a as previewMaintenance, b as cachedDeviceActivity, c as deleteTempLeftovers, d as appRoots, f as artifactWorktrees, g as stopIdleWorkspace, h as planIdleStop, l as tempLeftoverLines, m as collectArtifactsAsync, o as triggeringRoot, p as clearArtifact, s as collectTempLeftovers, t as deleteIdleWorkspaceDevices, u as tempLeftoverSection, w as collectWorktreeSweep, x as cachedDeviceActivityAsync, y as ownedDeviceUsage } from "./act-CrTcskiE.mjs";
21
+ import { i as getSwiftpmCacheUsage, n as swiftpmCacheLines, r as getAgentDeviceUsage, t as agentDeviceLines } from "./agent-device-usage-output-W0x4SoC7.mjs";
21
22
  import { claimRemoveCommand, isClaimRefusal, isClaimUnavailable, readClaimSet, releaseClaim, tryAcquireClaim } from "@stim-cli/core/ownership-claim";
22
23
  import { existsSync, lstatSync, readFileSync, readdirSync, statSync } from "node:fs";
23
24
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
@@ -1453,6 +1454,7 @@ async function buildStateDirs(path, keys, operation) {
1453
1454
  const worktree = {
1454
1455
  path,
1455
1456
  linked: true,
1457
+ locked: Boolean(matchWorktreeEntry(entries, path)?.locked),
1456
1458
  keys: own
1457
1459
  };
1458
1460
  const dirs = /* @__PURE__ */ new Map();
@@ -2191,6 +2193,65 @@ async function deleteParkedHostedDevices(devices, { listAvds: list, operation }
2191
2193
  return failures;
2192
2194
  }
2193
2195
  //#endregion
2196
+ //#region src/commands/gc/idle-workspaces.ts
2197
+ /**
2198
+ * Stops each workspace idle past its maintenance.idleStopHours, as automatic maintenance does, unless
2199
+ * maintenance.mode is off, so the dry run's maintenance plan lists every stop; returns failures.
2200
+ */
2201
+ async function stopIdleWorkspaces(output, operation) {
2202
+ const env = operation?.env ?? process.env;
2203
+ if (resolveMaintenanceSettings(void 0, env).mode === "off") return 0;
2204
+ const devices = () => {
2205
+ const now = Date.now();
2206
+ return operation ? cachedDeviceActivityAsync(now, env, operation.signal, operation) : cachedDeviceActivity(now);
2207
+ };
2208
+ const protectedRoot = triggeringRoot(operation);
2209
+ let plan;
2210
+ try {
2211
+ plan = await planIdleStop({
2212
+ protectedRoot,
2213
+ now: Date.now(),
2214
+ env,
2215
+ devices: devices(),
2216
+ operation
2217
+ });
2218
+ } catch (error) {
2219
+ if (error instanceof WorkspaceProcessCleanupError || error instanceof Error && "reportCleanup" in error) throw error;
2220
+ operation?.signal.throwIfAborted();
2221
+ output.log(chalk.red(`Could not plan idle workspace stops: ${error instanceof Error ? error.message : String(error)}`));
2222
+ return 1;
2223
+ }
2224
+ let failures = 0;
2225
+ for (const action of plan.actions) {
2226
+ operation?.signal.throwIfAborted();
2227
+ let outcome;
2228
+ try {
2229
+ outcome = await stopIdleWorkspace(action, {
2230
+ protectedRoot,
2231
+ devices,
2232
+ operation,
2233
+ by: "stim gc --delete"
2234
+ });
2235
+ } catch (error) {
2236
+ if (error instanceof WorkspaceProcessCleanupError || error instanceof Error && "reportCleanup" in error) throw error;
2237
+ operation?.signal.throwIfAborted();
2238
+ outcome = {
2239
+ status: "failed",
2240
+ bytes: 0,
2241
+ detail: error instanceof Error ? error.message : String(error)
2242
+ };
2243
+ }
2244
+ output.record("devServer", outcome.status, action.target, { detail: outcome.status === "done" ? action.reason : outcome.detail });
2245
+ if (outcome.status === "done") output.log(chalk.green(`Stopped the idle workspace ${action.target}: ${action.reason}`));
2246
+ else if (outcome.status === "kept") output.log(chalk.dim(`Kept the workspace ${action.target}: ${outcome.detail}`));
2247
+ else {
2248
+ failures++;
2249
+ output.log(chalk.red(`Could not stop the idle workspace ${action.target}: ${outcome.detail}`));
2250
+ }
2251
+ }
2252
+ return failures;
2253
+ }
2254
+ //#endregion
2194
2255
  //#region src/commands/gc.ts
2195
2256
  function readGcReport(options = {}, deps = {}) {
2196
2257
  return sweep({
@@ -3008,6 +3069,8 @@ async function runGcCore(opts, deps, execution, reportOnly = false) {
3008
3069
  }
3009
3070
  let deleteFailures = idleFailures;
3010
3071
  throwIfCancelled(signal, "GC");
3072
+ if (cache === null) deleteFailures += await stopIdleWorkspaces(output, deps.operation);
3073
+ throwIfCancelled(signal, "GC");
3011
3074
  deleteFailures += await deleteArchives(report.archives, output, signal);
3012
3075
  throwIfCancelled(signal, "GC");
3013
3076
  deleteFailures += report.workspaceOutputs ? (await clearWorkspaceOutputs(report.workspaceOutputs, {
@@ -3142,7 +3205,7 @@ async function runGcCore(opts, deps, execution, reportOnly = false) {
3142
3205
  return payload(deleteFailures);
3143
3206
  }
3144
3207
  function gcCommand(program) {
3145
- program.command("gc").description("Report what Stim has left behind: dead project entries, orphaned workspace directories, clean Stim-managed linked worktrees whose branch is merged or whose pull request was merged or closed, orphaned owned devices and EAS sessions, records of devices that no longer exist, build locks whose builder is gone, expired physical-device leases, the shared build caches, the build outputs and logs of each workspace, the memory of watchman and of the Gradle and Kotlin daemons, and recognized leftovers in TMPDIR. Reports by default; pass --delete to act.").option("--worktrees", "also remove clean, idle Stim-managed linked worktrees, not only merged ones: with --delete run `stim worktree remove` (never --force) on each; idle means unused for --older-than days, 7 without it").option("--delete", "actually prune the reported entries, reap the reported devices, lighten every workspace that is not building and ran no ios, android or macos command in the last 15 minutes by clearing its build outputs, a running dev server or booted device included, and trim its Metro, client and device logs to their newest 8 MiB").option("--older-than <days>", "also reap owned devices whose workspace has not been used this long, trim shared cache entries nothing has used in that time and device recordings made before it, and clear workspace build outputs only for workspaces idle this long and parked devices only once parked this long", (v) => {
3208
+ program.command("gc").description("Report what Stim has left behind: dead project entries, orphaned workspace directories, clean Stim-managed linked worktrees whose branch is merged or whose pull request was merged or closed, orphaned owned devices and EAS sessions, records of devices that no longer exist, build locks whose builder is gone, expired physical-device leases, the shared build caches, the build outputs and logs of each workspace, the memory of watchman and of the Gradle and Kotlin daemons, and recognized leftovers in TMPDIR. Reports by default; pass --delete to act.").option("--worktrees", "also remove clean, idle Stim-managed linked worktrees, not only merged ones: with --delete run `stim worktree remove` (never --force) on each; idle means unused for --older-than days, 7 without it").option("--delete", "actually prune the reported entries, reap the reported devices, lighten every workspace that is not building and ran no ios, android or macos command in the last 15 minutes by clearing its build outputs, a running dev server or booted device included, trim its Metro, client and device logs to their newest 8 MiB, and, unless maintenance.mode is off, stop each workspace idle past maintenance.idleStopHours as stim stop does").option("--older-than <days>", "also reap owned devices whose workspace has not been used this long, trim shared cache entries nothing has used in that time and device recordings made before it, and clear workspace build outputs only for workspaces idle this long and parked devices only once parked this long", (v) => {
3146
3209
  const n = parseInt(v, 10);
3147
3210
  if (!Number.isFinite(n) || String(n) !== String(v).trim()) throw new InvalidArgumentError("must be a whole number of days, e.g. --older-than 30");
3148
3211
  return n;
@@ -1,3 +1,3 @@
1
- import { _t as findStaleDeviceRecords, ft as describeParkedSims, gt as findOrphanedDevices, pt as describeUnverifiableDevices, q as selectCaches, ut as deleteParkedSims, vt as findStaleProjectDevices } from "./ccache-BWTze1Ls.mjs";
2
- import { a as runGc, i as readGcReport, n as executeGc, o as withGcMaintenanceClaim, r as gcCommand, s as formatGcReport, t as collectGcReport } from "./gc-CGZ1Yg88.mjs";
1
+ import { _t as findStaleDeviceRecords, ft as describeParkedSims, gt as findOrphanedDevices, pt as describeUnverifiableDevices, q as selectCaches, ut as deleteParkedSims, vt as findStaleProjectDevices } from "./ccache-DsDkdP72.mjs";
2
+ import { a as runGc, i as readGcReport, n as executeGc, o as withGcMaintenanceClaim, r as gcCommand, s as formatGcReport, t as collectGcReport } from "./gc-CKHqL4aS.mjs";
3
3
  export { collectGcReport, gcCommand as default, deleteParkedSims, describeParkedSims, describeUnverifiableDevices, executeGc, findOrphanedDevices, findStaleDeviceRecords, findStaleProjectDevices, formatGcReport, readGcReport, runGc, selectCaches, withGcMaintenanceClaim };