stim 1.21.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. package/README.md +60 -7
  2. package/dist/{acquire-artifact-CD4lbiWE.mjs → acquire-artifact-Co2k4f7O.mjs} +21 -3
  3. package/dist/{act-DHAw2A2S.mjs → act-DsuqEkiM.mjs} +298 -164
  4. package/dist/{activity-BzVfHSrY.mjs → activity-CMLmzp7o.mjs} +33 -12
  5. package/dist/{agent-device-usage-output-zh1vhbLp.mjs → agent-device-usage-output-DUFaTMdd.mjs} +7 -7
  6. package/dist/{android-BLgbNqox.mjs → android-ByRMUoiJ.mjs} +66 -52
  7. package/dist/{android-DUYkNF4u.mjs → android-C7sVmyI9.mjs} +160 -59
  8. package/dist/{android-CV_GCELZ.mjs → android-DGkNqa_c.mjs} +5 -5
  9. package/dist/{android-BEJ8Jpl7.mjs → android-DR5lZ2Az.mjs} +2 -2
  10. package/dist/android-cas-compiler.mjs +1 -1
  11. package/dist/{android-cas-Ct5b1xCK.mjs → android-cas-ngferVq2.mjs} +3 -3
  12. package/dist/{client-B7QVOlCr.d.mts → android-project-DVWyCbWU.d.mts} +145 -7
  13. package/dist/api.d.mts +132 -118
  14. package/dist/api.mjs +239 -42
  15. package/dist/{artifact-B8T3S5gi.mjs → artifact-8EY8SAPw.mjs} +40 -35
  16. package/dist/{artifact-DAuZ-FNU.mjs → artifact-DJPy518Y.mjs} +69 -40
  17. package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
  18. package/dist/{browser-web-QQzVjz3O.mjs → browser-web-Bcv99PBM.mjs} +187 -59
  19. package/dist/{budget-Bs6SxxzO.mjs → budget-Cvwn54qV.mjs} +830 -699
  20. package/dist/{build-CoPzQRNw.mjs → build-CabC3G23.mjs} +34 -27
  21. package/dist/{build-cache-DmyR9Zzc.mjs → build-cache-Dv7RN200.mjs} +4 -4
  22. package/dist/{build-plan-CaFskB7_.mjs → build-plan-DUC8Ka9y.mjs} +74 -14
  23. package/dist/{cache-manifest-DkkqguoK.mjs → cache-manifest-DSeQjt-Q.mjs} +1 -1
  24. package/dist/cache-manifest.mjs +1 -1
  25. package/dist/{ccache-BJRZ9pG3.mjs → ccache-Btwc36-I.mjs} +6 -6
  26. package/dist/{cdp-CWmIUMbw.mjs → cdp-3fwICjzi.mjs} +1 -1
  27. package/dist/{chrome-B6tfCta1.mjs → chrome-Bbw689-6.mjs} +1 -1
  28. package/dist/{cli-0DYf8QhQ.mjs → cli-CHZa9Lvk.mjs} +20 -20
  29. package/dist/cli.mjs +1 -1
  30. package/dist/{client-UXD70ZbM.mjs → client-OyRoEuSr.mjs} +218 -47
  31. package/dist/collector-run.d.mts +1 -1
  32. package/dist/collector-run.mjs +6 -6
  33. package/dist/{command-output-B1UrjZHL.mjs → command-output-gwpm28fu.mjs} +1 -1
  34. package/dist/{config-CYcBF478.mjs → config-DlrsduwG.mjs} +17 -11
  35. package/dist/{created-devices-CqeBlrEn.mjs → created-devices-x9rN6bhs.mjs} +13 -3
  36. package/dist/{dependency-state-BbKQW83h.mjs → dependency-state-1I9KZT1Y.mjs} +2 -2
  37. package/dist/{detached-entry-DFRyG1_o.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
  38. package/dist/{dev-client-UOeESKm6.mjs → dev-client-BSDR5h3F.mjs} +2 -2
  39. package/dist/{device-ExJq8Ei7.mjs → device-B-L3Fbxy.mjs} +71 -14
  40. package/dist/{device-DCxH7_By.mjs → device-DklWZLqb.mjs} +16 -16
  41. package/dist/{device-capacity-CMlqEcvw.mjs → device-capacity-DK5_EwRS.mjs} +9 -10
  42. package/dist/device-host-worker.mjs +25 -32
  43. package/dist/{device-ios-DRUeKaFV.mjs → device-ios-DoB6KFCO.mjs} +39 -16
  44. package/dist/{device-lease-run-C8raGFoP.mjs → device-lease-run-xJPQ_QQG.mjs} +5 -5
  45. package/dist/{device-pool-DMRpVX9a.mjs → device-pool-BMkdsefq.mjs} +3 -3
  46. package/dist/{doctor-DTvaDOda.mjs → doctor-Bo7BXLux.mjs} +24 -37
  47. package/dist/{doctor-Dhqebm0q.mjs → doctor-D5_EzwfA.mjs} +19 -16
  48. package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
  49. package/dist/doctor-fingerprint.mjs +1 -1
  50. package/dist/{doctor-BLHCYxzi.mjs → doctor-thjWAV0z.mjs} +1 -1
  51. package/dist/{doctor-watchman-Cv1F10Kj.mjs → doctor-watchman-N2wDotwQ.mjs} +5 -5
  52. package/dist/{eas-build-BomfRnFT.mjs → eas-build-CwknaQYj.mjs} +4 -4
  53. package/dist/{eas-fallback-DJwZpy0c.mjs → eas-fallback-CSgAulr5.mjs} +27 -18
  54. package/dist/{eas-session-ledger-op6A54yi.mjs → eas-session-ledger-DlY_serQ.mjs} +8 -7
  55. package/dist/{error-diagnostics-Bf0rZvG9.mjs → error-diagnostics-DBWO2rxE.mjs} +10 -10
  56. package/dist/{exec-_UbtCQcG.mjs → exec-DEoAhcze.mjs} +155 -47
  57. package/dist/{exec-H20xSg2T.d.mts → exec-DnYc4HGH.d.mts} +17 -4
  58. package/dist/{gc-_-dCXdyL.mjs → gc-CXxN-4SE.mjs} +587 -313
  59. package/dist/gc-DnNDQyaP.mjs +3 -0
  60. package/dist/{guide-Yqwt2bd6.mjs → guide-Br0LEfKy.mjs} +239 -43
  61. package/dist/{hosted-android-Bw-honsd.mjs → hosted-android-B-9f-jkd.mjs} +6 -6
  62. package/dist/{hosted-client-DB_gBPfY.mjs → hosted-client-DZAPrcro.mjs} +4 -4
  63. package/dist/{hosted-ios-CUvOf4Vr.mjs → hosted-ios-CsCS21hn.mjs} +1 -1
  64. package/dist/{hosted-logs-DL_P5AdN.mjs → hosted-logs-FIRx9X2f.mjs} +5 -5
  65. package/dist/{hosted-macos-QI141yKk.mjs → hosted-macos-_awYSpfv.mjs} +21 -12
  66. package/dist/{hosted-native-Ksyjgzq-.mjs → hosted-native-BdzE668-.mjs} +27 -14
  67. package/dist/{idle-BVeRGroT.d.mts → idle-C4cZ757K.d.mts} +3 -3
  68. package/dist/{idle-shutdown-DaKmZi0z.mjs → idle-shutdown-DDg3SdvY.mjs} +7 -7
  69. package/dist/ios-CDvlmUs7.d.mts +24 -0
  70. package/dist/{ios-CQ68hG9s.mjs → ios-Ds1clbIt.mjs} +8 -8
  71. package/dist/{ios-device-CwFMehUS.mjs → ios-device--h_-8ENa.mjs} +3 -3
  72. package/dist/{ios-device-CXGP1bsD.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
  73. package/dist/{ios-CpByZy12.mjs → ios-hcBpnEGk.mjs} +81 -34
  74. package/dist/{ios-ubFsBzwq.mjs → ios-pm4nL6By.mjs} +59 -50
  75. package/dist/{ios-project-WuwwBdvW.mjs → ios-project-CZhKODF3.mjs} +5 -5
  76. package/dist/{ios-signing-DTTIChGs.mjs → ios-signing-BtAffm0A.mjs} +2 -2
  77. package/dist/{ios-state-DvFX-K_l.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
  78. package/dist/{ios-qNJt4dFm.mjs → ios-xtlRHaeB.mjs} +1 -1
  79. package/dist/{js-swap-Cc1dttps.mjs → js-swap-Bwhh4S7V.mjs} +7 -29
  80. package/dist/{launch-Zq2mOSDy.mjs → launch-BjxemNpK.mjs} +40 -39
  81. package/dist/{launch-CD1yVc7U.mjs → launch-CCzXlc8r.mjs} +16 -16
  82. package/dist/{logs-BS00Anxf.mjs → logs-BfwwadsZ.mjs} +151 -24
  83. package/dist/{logs-CMm05HxN.mjs → logs-jTS_lHSo.mjs} +10 -17
  84. package/dist/{macos-B65--pPd.mjs → macos-DVlSSyUg.mjs} +1 -1
  85. package/dist/{macos-C-0qJ6zq.mjs → macos-NfV2D7dO.mjs} +143 -46
  86. package/dist/macos-run.mjs +1 -1
  87. package/dist/maintenance-run.mjs +8 -8
  88. package/dist/{metro-DEXpIhHC.mjs → metro-DiXtA3Ty.mjs} +59 -37
  89. package/dist/{metro-gateway-BMJNlj3E.mjs → metro-gateway-CKZqKqx7.mjs} +120 -22
  90. package/dist/{named-ports-BWTzt6mu.mjs → named-ports-DkEzOfzO.mjs} +40 -33
  91. package/dist/{native-android-JACyjTZs.mjs → native-android-CqgnOgsT.mjs} +43 -242
  92. package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
  93. package/dist/{native-gradle-inputs-Bep9JcSF.mjs → native-gradle-inputs-Dnh84Zbd.mjs} +3 -129
  94. package/dist/{native-run-DY_RLx3C.mjs → native-run-NwUuxbkg.mjs} +4 -5
  95. package/dist/{native-runtime-Dg1Q7tfF.mjs → native-runtime-B7KIafpM.mjs} +8 -7
  96. package/dist/native-source-Y0yLhFyQ.mjs +133 -0
  97. package/dist/{native-xcode-inputs-CB2iQeWq.mjs → native-xcode-inputs-D_VOfFL7.mjs} +2 -3
  98. package/dist/{native-xcode-ios-CXX39F7o.mjs → native-xcode-ios-BYDOHWLN.mjs} +27 -32
  99. package/dist/offload-worker.d.mts +65 -2
  100. package/dist/offload-worker.mjs +305 -73
  101. package/dist/operation-exec-BW0em61G.mjs +171 -0
  102. package/dist/{ownership-DEmM5vhh.mjs → ownership-C5fo5Edb.mjs} +3 -3
  103. package/dist/{page-CPaHeYqj.mjs → page-DBL2PiUU.mjs} +8 -4
  104. package/dist/{placement-log-BqGbTa61.mjs → placement-log-BnGgJRRZ.mjs} +1 -1
  105. package/dist/{plan-placement-Bwj-IjY1.mjs → plan-placement-DIsMtN-d.mjs} +12 -8
  106. package/dist/{ports-D-MmCTdv.mjs → ports-Cy1RkmuQ.mjs} +3 -3
  107. package/dist/{prebuild-uD_ipCxF.mjs → prebuild-D4JoEAEs.mjs} +49 -14
  108. package/dist/{project-BZNjmW_8.mjs → project-wM_XFTvE.mjs} +16 -16
  109. package/dist/{pull-request-Lfetn8Kr.mjs → pull-request-W1IuLXDt.mjs} +102 -20
  110. package/dist/{pull-request-zjCSAryH.d.mts → pull-request-eODyIqZF.d.mts} +6 -2
  111. package/dist/pull-requests.d.mts +2 -2
  112. package/dist/pull-requests.mjs +2 -2
  113. package/dist/{react-native-android-DuzH0cn3.mjs → react-native-android-6OZ7MSM7.mjs} +71 -48
  114. package/dist/{react-native-build-rhk4smwQ.mjs → react-native-build-Dvd8hC21.mjs} +8 -8
  115. package/dist/{react-native-doctor-CQpuIMso.mjs → react-native-doctor-DsoSF1Y9.mjs} +7 -7
  116. package/dist/{react-native-ios-Bhq1rJeV.mjs → react-native-ios-4u1Rn-GR.mjs} +40 -26
  117. package/dist/{recordings-DYteQSu4.mjs → recordings-CQmfzAh7.mjs} +1 -1
  118. package/dist/registration-BcRgF6Ox.mjs +51 -0
  119. package/dist/{reload-CmTRFJaX.mjs → reload-BzkYabB-.mjs} +16 -15
  120. package/dist/{reload-DzjSl5P_.mjs → reload-D7AVlb8N.mjs} +1 -1
  121. package/dist/{remote-ByYkXdGD.mjs → remote-DjGDmlTZ.mjs} +18 -15
  122. package/dist/{result-DNiS-tTP.mjs → result-D2Ykz_iD.mjs} +24 -23
  123. package/dist/{run-D23HmJMs.mjs → run-DidHghD1.mjs} +3 -2
  124. package/dist/{selection-CSl9i5qU.mjs → selection-DSMbWEX2.mjs} +6 -5
  125. package/dist/{server-bare-CxTrvDg8.mjs → server-bare-CafzuyFB.mjs} +2 -2
  126. package/dist/{server-command-CtzloH3v.mjs → server-command-C6QjeupS.mjs} +5 -5
  127. package/dist/{server-expo-DT_F_uVI.mjs → server-expo-CrjB29pq.mjs} +7 -5
  128. package/dist/server-expo-D58c9L0M.mjs +2 -0
  129. package/dist/{settings-CsJDEXgK.mjs → settings-C7O8A6ZI.mjs} +223 -243
  130. package/dist/{settings-T1gtc3bf.mjs → settings-DpR-1Wnn.mjs} +1 -1
  131. package/dist/{settings-write-HyVZ8eQ8.mjs → settings-write-CzD60rOD.mjs} +7 -6
  132. package/dist/settings.schema.json +13 -0
  133. package/dist/{simslim-Cgk17SXV.mjs → simslim-BNckWpXi.mjs} +2 -2
  134. package/dist/{slot-launch-DF8VfT64.mjs → slot-launch-CbfmNgM6.mjs} +6 -6
  135. package/dist/{stage-BIS0ydsV.mjs → stage-Bps5oius.mjs} +21 -4
  136. package/dist/{start-RChynRDp.mjs → start-Br-oxqMD.mjs} +1 -1
  137. package/dist/{start-7lpH7hmN.mjs → start-EojN4WFz.mjs} +622 -393
  138. package/dist/{state-C4ZtUisW.mjs → state--smjFSTL.mjs} +22 -7
  139. package/dist/{state-XMziexv2.mjs → state-08I3hw3_.mjs} +2 -2
  140. package/dist/{stats-53T7OTb9.mjs → stats-D3GerlFW.mjs} +5 -5
  141. package/dist/{stats-report-BFfMpWWF.mjs → stats-report-BzaPrRm6.mjs} +1 -1
  142. package/dist/{status-DqEUSSxs.mjs → status-BRROykC8.mjs} +2 -2
  143. package/dist/{status-CSi6tlRq.mjs → status-EvrK72L2.mjs} +1 -1
  144. package/dist/{status-BL7jVyAB.mjs → status-WBDajew2.mjs} +43 -29
  145. package/dist/{status-watch-GDCfqpTE.mjs → status-watch-Bg_u-pwR.mjs} +48 -16
  146. package/dist/status-worker.mjs +1 -1
  147. package/dist/{stim-desktop-C12we7lz.mjs → stim-desktop-D5OGpYZM.mjs} +2 -2
  148. package/dist/{stop-Bk_1qiV6.mjs → stop-DTZ9uTw3.mjs} +2 -2
  149. package/dist/{stop-D7h6jAXQ.mjs → stop-Dky10AEJ.mjs} +31 -22
  150. package/dist/{stop-CPzlM1L-.mjs → stop-Mv6W9FAk.mjs} +15 -16
  151. package/dist/supervisor-run.d.mts +3 -3
  152. package/dist/supervisor-run.mjs +28 -36
  153. package/dist/{support-Dlu37g6H.mjs → support-CNioewsd.mjs} +10 -10
  154. package/dist/{support-67vraa1Q.mjs → support-yUiOjnVY.mjs} +8 -8
  155. package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
  156. package/dist/swiftpm-macos-BIak-Rxv.mjs +532 -0
  157. package/dist/toolchain-BY8X8HXx.mjs +2 -0
  158. package/dist/{toolchain-Hp9sCpK4.mjs → toolchain-DpJMHq0n.mjs} +9 -6
  159. package/dist/{trigger-BAahxUPq.mjs → trigger-Cbyc41d_.mjs} +3 -3
  160. package/dist/trigger-yb_nFzPF.mjs +2 -0
  161. package/dist/{warm-progress-BHX5r0Ei.mjs → warm-progress-CA3TgT3-.mjs} +29 -16
  162. package/dist/web-CZ07gd77.mjs +2 -0
  163. package/dist/{web-CJmIj6AI.mjs → web-DKx6yoFA.mjs} +11 -10
  164. package/dist/web-run.mjs +11 -9
  165. package/dist/windows-report.mjs +1 -1
  166. package/dist/{workspace-state-Cjuigeeu.mjs → workspace-state-U08dEzhG.mjs} +3 -3
  167. package/dist/{workspaces-BccMFmGQ.mjs → workspaces-CpANmBlq.mjs} +594 -266
  168. package/dist/{worktree-DQ6Zi2Mv.mjs → worktree-CHecZ4Oq.mjs} +850 -551
  169. package/dist/worktree-ZqZVjD9K.mjs +2 -0
  170. package/dist/{xcode-Zlx3qjEs.mjs → xcode-BXn9-xYx.mjs} +5 -5
  171. package/package.json +7 -7
  172. package/shim/android-audio/Main.java +24 -0
  173. package/shim/android-audio/README.md +17 -0
  174. package/shim/android-audio.jar +0 -0
  175. package/dist/gc-C-WwL0yi.mjs +0 -3
  176. package/dist/git-C3iTsJaZ.mjs +0 -73
  177. package/dist/server-expo-C-90EhcG.mjs +0 -2
  178. package/dist/settings-DkdmlelE.d.mts +0 -15
  179. package/dist/swiftpm-macos-p8WZbxKU.mjs +0 -130
  180. package/dist/toolchain-DhKwp9iI.mjs +0 -2
  181. package/dist/trigger-Bf3uDcpv.mjs +0 -2
  182. package/dist/web-DknQETPs.mjs +0 -2
  183. package/dist/workspace-process-lock-1_1OoVW5.mjs +0 -57
  184. package/dist/worktree-CK2MpJW5.mjs +0 -2
@@ -1,15 +1,17 @@
1
- import { f as ownership_claim_exports, p as process_identity_exports, t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
- import { B as assignSlotDevice, C as saveConfig, D as withConfigLock$1, K as projectDeviceSlots, O as withConfigLockAsync$1, U as deviceSlotPlatforms, _ as loadConfig$1, c as ensureConfig, d as getConfigDir, f as getConfigPath$1, q as removeSlotDevice } from "./config-CYcBF478.mjs";
3
- import { c as androidDataPartitionSizeBytes } from "./settings-CsJDEXgK.mjs";
4
- import { l as pidExists, m as signalProcessTreeAsync } from "./metro-DEXpIhHC.mjs";
5
- import { n as readCreatedDevices$1, r as recordCreatedDevice, t as forgetCreatedDevice } from "./created-devices-CqeBlrEn.mjs";
6
- import { i as stimDesktopInstalledAsync, n as settingDefault, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-C12we7lz.mjs";
1
+ import { c as declareSpawnsOn, f as stopDeclaringSpawnsOn, g as process_identity_exports, r as WorkspaceProcessCleanupError, t as getExecutor, x as ownership_claim_exports } from "./exec-DEoAhcze.mjs";
2
+ import { C as saveConfig, D as withConfigLock$1, G as projectDeviceSlots, H as deviceSlotPlatforms, K as removeSlotDevice, O as withConfigLockAsync$1, _ as loadConfig$1, c as ensureConfig, d as getConfigDir, f as getConfigPath$1, z as assignSlotDevice } from "./config-DlrsduwG.mjs";
3
+ import { n as runOperationFileQuiet, t as runOperationFile, u as cancellableSleep } from "./operation-exec-BW0em61G.mjs";
4
+ import { c as androidDataPartitionSizeBytes } from "./settings-C7O8A6ZI.mjs";
5
+ import { c as pidExists, p as signalProcessTreeAsync } from "./metro-DiXtA3Ty.mjs";
6
+ import { i as recordCreatedDevice, r as readCreatedDevices$1, t as forgetCreatedDevice } from "./created-devices-x9rN6bhs.mjs";
7
+ import { i as stimDesktopInstalledAsync, n as settingDefault, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-D5OGpYZM.mjs";
7
8
  import { isDeepStrictEqual } from "node:util";
8
9
  import { join } from "node:path";
9
10
  import { ambientEnv, ambientWrite } from "@stim-cli/core";
10
11
  import { ANDROID_EMULATOR_APPS, getParkedMax, isJsonObject, loadConfig, settingDefinition } from "@stim-cli/core/state";
11
12
  import { dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$1 } from "path";
12
13
  import { existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
14
+ import { rm } from "node:fs/promises";
13
15
  import { homedir, tmpdir } from "os";
14
16
  //#region src/devices/sim-pool.ts
15
17
  const POOL_SETTING_REMEDY = "Run `stim guide settings` for the device pool bounds and where it can be set.";
@@ -124,11 +126,11 @@ function claimParkedOperation(platform, udid) {
124
126
  if (attempt.pending) (0, ownership_claim_exports.releaseClaim)(attempt.pending);
125
127
  return attempt.acquired ?? null;
126
128
  }
127
- function removeParkedAfter(platform, udid, beforeRemove) {
128
- return settleParkedAfter(platform, udid, beforeRemove, null);
129
+ function removeParkedAfter(platform, udid, beforeRemove, operation) {
130
+ return settleParkedAfter(platform, udid, beforeRemove, null, operation);
129
131
  }
130
- function eraseParkedAfter(platform, udid, erase) {
131
- return settleParkedAfter(platform, udid, erase, erasedRecord);
132
+ function eraseParkedAfter(platform, udid, erase, operation) {
133
+ return settleParkedAfter(platform, udid, erase, erasedRecord, operation);
132
134
  }
133
135
  function erasedRecord(record) {
134
136
  const erased = { ...record };
@@ -138,9 +140,12 @@ function erasedRecord(record) {
138
140
  delete erased.schemeApprovals;
139
141
  return erased;
140
142
  }
141
- async function settleParkedAfter(platform, udid, action, keep) {
143
+ async function settleParkedAfter(platform, udid, action, keep, operation) {
144
+ operation?.signal.throwIfAborted();
142
145
  const claim = claimParkedOperation(platform, udid);
143
146
  if (!claim) return null;
147
+ let retained = false;
148
+ if (operation) declareSpawnsOn(operation, claim);
144
149
  try {
145
150
  const claimed = await withConfigLockAsync$1(() => {
146
151
  const cfg = loadConfig$1();
@@ -164,23 +169,30 @@ async function settleParkedAfter(platform, udid, action, keep) {
164
169
  record,
165
170
  marked
166
171
  };
167
- });
172
+ }, operation?.signal);
168
173
  if (!claimed) return null;
169
174
  let completed = false;
170
175
  let started = false;
171
176
  let settled = null;
172
177
  try {
178
+ operation?.signal.throwIfAborted();
173
179
  (0, ownership_claim_exports.markClaimChildPending)(claim);
174
180
  try {
175
181
  await action(claimed.record, () => {
176
182
  started = true;
177
183
  });
184
+ } catch (cause) {
185
+ if (cause instanceof WorkspaceProcessCleanupError || cause instanceof Error && "reportCleanup" in cause) {
186
+ retained = true;
187
+ throw Object.assign(new WorkspaceProcessCleanupError([.../* @__PURE__ */ new Set([claim, ...cause instanceof WorkspaceProcessCleanupError ? cause.claims : []])], cause.message, "Verify the parked-device operation and its descendants have stopped."), { reportCleanup: true });
188
+ }
189
+ throw cause;
178
190
  } finally {
179
- (0, ownership_claim_exports.clearClaimChild)(claim);
191
+ if (!retained) (0, ownership_claim_exports.clearClaimChild)(claim);
180
192
  }
181
193
  completed = true;
182
194
  } finally {
183
- await withConfigLockAsync$1(() => {
195
+ if (!retained) await withConfigLockAsync$1(() => {
184
196
  const cfg = loadConfig$1();
185
197
  if (!cfg) return;
186
198
  const records = readParked(platform, { config: cfg });
@@ -194,11 +206,12 @@ async function settleParkedAfter(platform, udid, action, keep) {
194
206
  }
195
207
  return settled;
196
208
  } finally {
197
- (0, ownership_claim_exports.releaseClaim)(claim);
209
+ if (operation) stopDeclaringSpawnsOn(operation, claim);
210
+ if (!retained) (0, ownership_claim_exports.releaseClaim)(claim);
198
211
  }
199
212
  }
200
- async function dropParked(platform, udid) {
201
- return await removeParkedAfter(platform, udid, () => {}) !== null;
213
+ async function dropParked(platform, udid, operation) {
214
+ return await removeParkedAfter(platform, udid, () => {}, operation) !== null;
202
215
  }
203
216
  //#endregion
204
217
  //#region src/devices/device-ownership.ts
@@ -487,6 +500,16 @@ function listAvdDeviceProfiles() {
487
500
  "-c"
488
501
  ], { timeoutMs: AVDMANAGER_LIST_TIMEOUT_MS }));
489
502
  }
503
+ async function listAvdDeviceProfilesAsync({ signal } = {}) {
504
+ return parseAvdList(await getExecutor().runFileAsync(androidToolPath("avdmanager"), [
505
+ "list",
506
+ "device",
507
+ "-c"
508
+ ], {
509
+ signal,
510
+ timeoutMs: AVDMANAGER_LIST_TIMEOUT_MS
511
+ }));
512
+ }
490
513
  function sanitizeAvdLabel(label) {
491
514
  return String(label).replace(/[^A-Za-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "");
492
515
  }
@@ -503,10 +526,12 @@ function ownedAvdName(label) {
503
526
  return `stim-${clean.startsWith("stim-") ? clean.slice(5) : clean}`;
504
527
  }
505
528
  const AVDMANAGER_DELETE_TIMEOUT_MS = 12e4;
506
- async function deleteAvd(avdName) {
529
+ async function deleteAvd(avdName, operation) {
530
+ operation?.signal.throwIfAborted();
507
531
  if (!isStimOwnedAvd(avdName)) throw new Error(`Refusing to delete AVD "${avdName}": not a Stim-owned AVD; Stim has no record of creating it.`);
508
- const root = ambientEnv().ANDROID_AVD_HOME ? void 0 : avdStorageRoots().find((candidate) => avdPathExists(join$1(candidate, `${avdName}.ini`)));
509
- await getExecutor().runFileAsync(androidToolPath("avdmanager"), [
532
+ const env = operation?.env ?? ambientEnv();
533
+ const root = env.ANDROID_AVD_HOME ? void 0 : avdStorageRoots(env).find((candidate) => avdPathExists(join$1(candidate, `${avdName}.ini`)));
534
+ await runOperationFile(operation, getExecutor(), androidToolPath("avdmanager", process.platform, env), [
510
535
  "delete",
511
536
  "avd",
512
537
  "-n",
@@ -514,6 +539,7 @@ async function deleteAvd(avdName) {
514
539
  ], {
515
540
  timeoutMs: AVDMANAGER_DELETE_TIMEOUT_MS,
516
541
  killSignal: "SIGKILL",
542
+ cwd: operation?.cwd,
517
543
  ...root ? { env: { ANDROID_AVD_HOME: root } } : {}
518
544
  });
519
545
  forgetCreatedDevice("android", avdName);
@@ -566,10 +592,12 @@ function listAvds({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS } = {}) {
566
592
  killSignal: "SIGKILL"
567
593
  }));
568
594
  }
569
- async function listAvdsAsync({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS } = {}) {
570
- return parseAvdList(await getExecutor().runFileAsync(androidToolPath("emulator"), ["-list-avds"], {
595
+ async function listAvdsAsync({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS, signal, operation } = {}) {
596
+ return parseAvdList(await runOperationFile(operation, getExecutor(), androidToolPath("emulator", process.platform, operation?.env), ["-list-avds"], {
571
597
  timeoutMs,
572
- killSignal: "SIGKILL"
598
+ killSignal: "SIGKILL",
599
+ signal,
600
+ cwd: operation?.cwd
573
601
  }));
574
602
  }
575
603
  /**
@@ -590,11 +618,12 @@ function listAdbDevices({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS, platform = pro
590
618
  cwd: androidToolCwd(platform)
591
619
  }));
592
620
  }
593
- async function listAdbDevicesAsync({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS, platform = process.platform } = {}) {
594
- return parseAdbDevices(await getExecutor().runFileAsync(androidToolPath("adb"), ["devices"], {
621
+ async function listAdbDevicesAsync({ timeoutMs = ANDROID_LISTING_TIMEOUT_MS, platform = process.platform, signal, operation } = {}) {
622
+ return parseAdbDevices(await runOperationFile(operation, getExecutor(), androidToolPath("adb", platform, operation?.env), ["devices"], {
595
623
  timeoutMs,
596
624
  killSignal: "SIGKILL",
597
- cwd: androidToolCwd(platform)
625
+ cwd: androidToolCwd(platform) ?? operation?.cwd,
626
+ signal
598
627
  }));
599
628
  }
600
629
  const ADB_PROP_TIMEOUT_MS = 5e3;
@@ -851,11 +880,14 @@ const AVD_USER_DATA = [
851
880
  "cache.img.qcow2",
852
881
  "snapshots"
853
882
  ];
854
- function wipeAvdUserData(directory) {
855
- for (const name of AVD_USER_DATA) rmSync(join$1(directory, name), {
856
- recursive: true,
857
- force: true
858
- });
883
+ async function wipeAvdUserData(directory, signal) {
884
+ for (const name of AVD_USER_DATA) {
885
+ signal?.throwIfAborted();
886
+ await rm(join$1(directory, name), {
887
+ recursive: true,
888
+ force: true
889
+ });
890
+ }
859
891
  }
860
892
  function withAvdConfigOverrides(contents, overrides) {
861
893
  const newline = contents.includes("\r\n") ? "\r\n" : "\n";
@@ -1214,27 +1246,42 @@ async function waitForBoot(serial, timeoutMs = 6e4, { aborted = () => false, pol
1214
1246
  }
1215
1247
  const ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS = 6e4;
1216
1248
  const ANDROID_EMULATOR_SHUTDOWN_POLL_MS = 100;
1217
- async function shutdownAndroidEmulator(serial, timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS) {
1249
+ async function shutdownAndroidEmulator(serial, timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS, operation) {
1218
1250
  const exec = getExecutor();
1219
1251
  const started = Date.now();
1220
- if (await exec.runFileQuietAsync(androidToolPath("adb"), [
1252
+ const run = async (args, budget) => {
1253
+ const options = {
1254
+ timeoutMs: budget,
1255
+ killSignal: "SIGKILL"
1256
+ };
1257
+ if (!operation) return exec.runFileQuietAsync(androidToolPath("adb"), args, options);
1258
+ try {
1259
+ return await runOperationFile(operation, exec, androidToolPath("adb", process.platform, operation.env), args, {
1260
+ ...options,
1261
+ cwd: operation.cwd
1262
+ });
1263
+ } catch (cause) {
1264
+ if (cause instanceof WorkspaceProcessCleanupError) throw cause;
1265
+ operation.signal.throwIfAborted();
1266
+ return null;
1267
+ }
1268
+ };
1269
+ if (await run([
1221
1270
  "-s",
1222
1271
  serial,
1223
1272
  "shell",
1224
1273
  "sync"
1225
- ], {
1226
- timeoutMs: Math.min(5e3, timeoutMs),
1227
- killSignal: "SIGKILL"
1228
- }) === null) ambientWrite("stderr", `warning: could not flush ${serial} before shutdown; shutting it down anyway\n`);
1229
- await exec.runFileQuietAsync(androidToolPath("adb"), [
1274
+ ], Math.min(5e3, timeoutMs)) === null) {
1275
+ const warning = `warning: could not flush ${serial} before shutdown; shutting it down anyway\n`;
1276
+ if (operation) operation.output("stderr", warning);
1277
+ else ambientWrite("stderr", warning);
1278
+ }
1279
+ await run([
1230
1280
  "-s",
1231
1281
  serial,
1232
1282
  "emu",
1233
1283
  "kill"
1234
- ], {
1235
- timeoutMs: Math.max(1, timeoutMs - (Date.now() - started)),
1236
- killSignal: "SIGKILL"
1237
- });
1284
+ ], Math.max(1, timeoutMs - (Date.now() - started)));
1238
1285
  }
1239
1286
  function avdProcessLockPaths(avdDirectory, platform) {
1240
1287
  return ["hardware-qemu.ini.lock", "userdata-qemu.img.lock"].map((name) => join$1(avdDirectory, name, ...platform === "win32" ? ["pid"] : []));
@@ -1286,9 +1333,9 @@ function listAvdEmulatorProcesses(avdName, platform) {
1286
1333
  ], { timeoutMs: 5e3 });
1287
1334
  return out === null ? null : parseAvdEmulatorProcesses(out, avdName);
1288
1335
  }
1289
- async function listAvdEmulatorProcessesAsync(avdName, platform) {
1336
+ async function listAvdEmulatorProcessesAsync(avdName, platform, operation) {
1290
1337
  if (platform === "win32") return [];
1291
- const out = await getExecutor().runFileQuietAsync("ps", [
1338
+ const out = await runOperationFileQuiet(operation, getExecutor(), "ps", [
1292
1339
  "-axww",
1293
1340
  "-o",
1294
1341
  "pid=,command="
@@ -1320,14 +1367,36 @@ function assertOwnedAvdStopped(avdName, { processAlive = emulatorProcessRunning,
1320
1367
  if (processId !== null && processAlive(processId)) live.add(processId);
1321
1368
  if (live.size) throw new Error(`Owned AVD ${avdName} still has a live emulator process (${[...live].join(", ")}).`);
1322
1369
  }
1370
+ /** Async stopped-emulator verification; cancellation and unresolved probe cleanup propagate. */
1371
+ async function assertOwnedAvdStoppedAsync(avdName, operation, resolveDirectory = ownedAvdDirectory) {
1372
+ operation?.signal.throwIfAborted();
1373
+ const { processId } = resolveAvdProcess(avdName, { resolveDirectory });
1374
+ const processes = await listAvdEmulatorProcessesAsync(avdName, process.platform, operation);
1375
+ if (processes === null) throw new Error(`Could not read the process table to verify that owned AVD ${avdName} stopped.`);
1376
+ const live = new Set(processes);
1377
+ if (processId !== null && pidExists(processId)) {
1378
+ const stat = process.platform === "win32" ? null : await runOperationFileQuiet(operation, getExecutor(), "ps", [
1379
+ "-o",
1380
+ "stat=",
1381
+ "-p",
1382
+ String(processId)
1383
+ ], {
1384
+ timeoutMs: 5e3,
1385
+ killSignal: "SIGKILL",
1386
+ cwd: operation?.cwd
1387
+ });
1388
+ if (stat === null || !stat.trim().startsWith("Z")) live.add(processId);
1389
+ }
1390
+ if (live.size) throw new Error(`Owned AVD ${avdName} still has a live emulator process (${[...live].join(", ")}).`);
1391
+ }
1323
1392
  const CRASH_HANDLER_EXIT_TIMEOUT_MS = 15e3;
1324
1393
  /**
1325
1394
  * The crashpad handler qemu forks on Windows. It outlives an emulator that crashes on exit while
1326
1395
  * it writes the dump, so a `stop` that returns on qemu's exit leaves it running.
1327
1396
  * https://github.com/appandflow/stim/issues/918
1328
1397
  */
1329
- async function emulatorCrashHandlerPids(qemuPid) {
1330
- const out = await getExecutor().runFileQuietAsync("powershell.exe", [
1398
+ async function emulatorCrashHandlerPids(qemuPid, operation) {
1399
+ const out = await runOperationFileQuiet(operation, getExecutor(), "powershell.exe", [
1331
1400
  "-NoProfile",
1332
1401
  "-NonInteractive",
1333
1402
  "-Command",
@@ -1346,14 +1415,26 @@ const EMULATOR_SIGNAL_GRACE_MS = 5e3;
1346
1415
  * grace, but only a process whose command line names this AVD and whose identity, captured before
1347
1416
  * shutdown, still matches. Windows has no process-table scan, so there nothing is signalled.
1348
1417
  */
1349
- async function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS, pollMs = ANDROID_EMULATOR_SHUTDOWN_POLL_MS, signalGraceMs = EMULATOR_SIGNAL_GRACE_MS, platform = process.platform, resolveDirectory = ownedAvdDirectory, readProcessId = readAvdProcessId, processAlive = pidExists, listProcesses = listAvdEmulatorProcessesAsync, captureIdentity = process_identity_exports.captureProcessIdentity, inspectIdentity = process_identity_exports.inspectProcessIdentity, signal = (pid, name) => signalProcessTreeAsync(pid, name, { platform }), directoryExists = (path) => statSync(path).isDirectory(), crashHandlerPids = emulatorCrashHandlerPids, killCrashHandler = (pid) => signalProcessTreeAsync(pid, "SIGKILL", { platform }), now = Date.now, sleep = (ms) => new Promise((done) => setTimeout(done, ms)) } = {}) {
1418
+ async function waitForAndroidEmulatorShutdown(avdName, shutdown, { operation, timeoutMs = ANDROID_EMULATOR_SHUTDOWN_TIMEOUT_MS, pollMs = ANDROID_EMULATOR_SHUTDOWN_POLL_MS, signalGraceMs = EMULATOR_SIGNAL_GRACE_MS, platform = process.platform, resolveDirectory = ownedAvdDirectory, readProcessId = readAvdProcessId, processAlive = pidExists, listProcesses = (name, host) => listAvdEmulatorProcessesAsync(name, host, operation), captureIdentity = process_identity_exports.captureProcessIdentity, inspectIdentity = process_identity_exports.inspectProcessIdentity, signal = (pid, name) => signalProcessTreeAsync(pid, name, {
1419
+ platform,
1420
+ operation
1421
+ }), directoryExists = (path) => statSync(path).isDirectory(), crashHandlerPids = (pid) => emulatorCrashHandlerPids(pid, operation), killCrashHandler = (pid) => signalProcessTreeAsync(pid, "SIGKILL", {
1422
+ platform,
1423
+ operation
1424
+ }), now = Date.now, sleep = (ms) => cancellableSleep(ms, {
1425
+ signal: operation?.signal,
1426
+ what: "emulator shutdown"
1427
+ }) } = {}) {
1428
+ operation?.signal.throwIfAborted();
1350
1429
  const { directory, processId } = resolveAvdProcess(avdName, {
1351
1430
  platform,
1352
1431
  resolveDirectory,
1353
1432
  readProcessId
1354
1433
  });
1355
1434
  const scan = async () => {
1435
+ operation?.signal.throwIfAborted();
1356
1436
  const pids = await listProcesses(avdName, platform);
1437
+ operation?.signal.throwIfAborted();
1357
1438
  if (pids === null) throw new Error(`Could not read the process table to verify that owned AVD ${avdName} stopped.`);
1358
1439
  return pids;
1359
1440
  };
@@ -1382,6 +1463,7 @@ async function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = A
1382
1463
  };
1383
1464
  const waitUntil = async (until) => {
1384
1465
  for (;;) {
1466
+ operation?.signal.throwIfAborted();
1385
1467
  if (running().length === 0) return true;
1386
1468
  const remaining = until - now();
1387
1469
  if (remaining <= 0) return false;
@@ -1396,14 +1478,18 @@ async function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = A
1396
1478
  await waitUntil(deadline);
1397
1479
  }
1398
1480
  for (const name of ["SIGTERM", "SIGKILL"]) {
1481
+ operation?.signal.throwIfAborted();
1399
1482
  const verified = running().filter((pid) => {
1400
1483
  const record = identities.get(pid);
1401
1484
  return record && inspectIdentity(record) === "same";
1402
1485
  });
1403
1486
  if (verified.length === 0) break;
1404
- for (const pid of verified) try {
1405
- await signal(pid, name);
1406
- } catch {}
1487
+ for (const pid of verified) {
1488
+ operation?.signal.throwIfAborted();
1489
+ try {
1490
+ await signal(pid, name);
1491
+ } catch {}
1492
+ }
1407
1493
  const graceMs = name === "SIGTERM" && !shutdown ? timeoutMs : signalGraceMs;
1408
1494
  if (await waitUntil(now() + graceMs)) break;
1409
1495
  }
@@ -1424,7 +1510,11 @@ async function waitForAndroidEmulatorShutdown(avdName, shutdown, { timeoutMs = A
1424
1510
  if (platform === "win32" && processId !== null) {
1425
1511
  const handlerDeadline = now() + CRASH_HANDLER_EXIT_TIMEOUT_MS;
1426
1512
  for (const handler of await crashHandlerPids(processId)) {
1427
- while (processAlive(handler) && now() < handlerDeadline) await sleep(pollMs);
1513
+ while (processAlive(handler) && now() < handlerDeadline) {
1514
+ operation?.signal.throwIfAborted();
1515
+ await sleep(pollMs);
1516
+ }
1517
+ operation?.signal.throwIfAborted();
1428
1518
  if (processAlive(handler)) {
1429
1519
  await killCrashHandler(handler);
1430
1520
  if (processAlive(handler)) throw new Error(`Crashpad handler ${handler} for owned AVD ${avdName} stayed alive.`);
@@ -1448,17 +1538,22 @@ function getAvdNameForSerial(serial, { timeoutMs = EMU_AVD_NAME_TIMEOUT_MS } = {
1448
1538
  if (!out) return null;
1449
1539
  return out.split("\n")[0]?.trim() || null;
1450
1540
  }
1451
- async function getAvdNameForSerialAsync(serial, { timeoutMs = EMU_AVD_NAME_TIMEOUT_MS } = {}) {
1452
- const out = await getExecutor().runFileQuietAsync(androidToolPath("adb"), [
1541
+ async function getAvdNameForSerialAsync(serial, { timeoutMs = EMU_AVD_NAME_TIMEOUT_MS, signal, operation } = {}) {
1542
+ const tool = androidToolPath("adb", process.platform, operation?.env);
1543
+ const args = [
1453
1544
  "-s",
1454
1545
  serial,
1455
1546
  "emu",
1456
1547
  "avd",
1457
1548
  "name"
1458
- ], {
1549
+ ];
1550
+ const options = {
1459
1551
  timeoutMs: Math.min(timeoutMs, EMU_AVD_NAME_TIMEOUT_MS),
1460
- killSignal: "SIGKILL"
1461
- });
1552
+ killSignal: "SIGKILL",
1553
+ signal,
1554
+ cwd: androidToolCwd() ?? operation?.cwd
1555
+ };
1556
+ const out = await runOperationFileQuiet(operation, getExecutor(), tool, args, options);
1462
1557
  if (!out) return null;
1463
1558
  return out.split("\n")[0]?.trim() || null;
1464
1559
  }
@@ -1467,9 +1562,13 @@ async function resolveOwnedAvdSerialAsync(avdName, opts = {}) {
1467
1562
  return ownedAvdSerialResolverAsync(opts)(avdName);
1468
1563
  }
1469
1564
  /** Shares bounded asynchronous AVD, adb and emulator-name reads across the requested AVDs. */
1470
- function ownedAvdSerialResolverAsync({ timeoutMs } = {}) {
1565
+ function ownedAvdSerialResolverAsync({ timeoutMs, signal, operation } = {}) {
1471
1566
  const started = Date.now();
1472
- const remaining = () => ({ timeoutMs: timeoutMs === void 0 ? void 0 : Math.max(MIN_LOOKUP_TIMEOUT_MS, timeoutMs - (Date.now() - started)) });
1567
+ const remaining = () => ({
1568
+ signal,
1569
+ operation,
1570
+ timeoutMs: timeoutMs === void 0 ? void 0 : Math.max(MIN_LOOKUP_TIMEOUT_MS, timeoutMs - (Date.now() - started))
1571
+ });
1473
1572
  const avds = once(() => listAvdsAsync(remaining()));
1474
1573
  const adb = once(() => listAdbDevicesAsync(remaining()));
1475
1574
  const names = /* @__PURE__ */ new Map();
@@ -1482,9 +1581,11 @@ function ownedAvdSerialResolverAsync({ timeoutMs } = {}) {
1482
1581
  return name;
1483
1582
  };
1484
1583
  return async (avdName) => {
1584
+ signal?.throwIfAborted();
1485
1585
  if (!(await avds()).includes(avdName)) return { missing: true };
1486
1586
  if (!isStimOwnedAvd(avdName)) return { notOwned: true };
1487
1587
  const devices = await adb();
1588
+ signal?.throwIfAborted();
1488
1589
  const candidates = [...devices.emulators, ...devices.unhealthy.filter((entry) => entry.kind === "emulator" && entry.consolePort !== void 0)];
1489
1590
  for (const candidate of candidates) if (await avdNameOf(candidate.serial) === avdName) return { serial: candidate.serial };
1490
1591
  return { notRunning: true };
@@ -1530,4 +1631,4 @@ function ownedAvdSerialResolver({ timeoutMs } = {}) {
1530
1631
  };
1531
1632
  }
1532
1633
  //#endregion
1533
- export { resolvePhysicalDevice as $, listAdbDevicesAsync as A, ownedAvdMatchesConfiguration as B, emulatorFailureRemedy as C, getAvdNameForSerialAsync as D, getAvdNameForSerial as E, listOrphanedAvdDirectories as F, parseAvdDeviceProfile as G, ownedAvdSerialResolver as H, memoizeEmulatorProbe as I, pickDefaultSystemImage as J, parseAvdSystemImage as K, nextConsolePort as L, listAvds as M, listAvdsAsync as N, hostSystemImageArch as O, listInstalledSystemImages as P, resolveOwnedAvdSerialAsync as Q, ownedAvdDeviceProfile as R, emulatorDiskSpaceRemedy as S, findBuildTool as T, ownedAvdSerialResolverAsync as U, ownedAvdName as V, ownedAvdSystemImage as W, profileNeedsFoldFeature as X, probeEmulatorSerial as Y, resetAdoptedAvd as Z, avdStorageRoots as _, removeParkedAfter as _t, androidDeviceAbi as a, wipeAvdUserData as at, createOwnedAvd as b, androidPoolNoCandidatesRefusal as c, isStimOwnedSim as ct, androidToolPath as d, dropParked as dt, shutdownAndroidEmulator as et, assertOwnedAvdStopped as f, eraseParkedAfter as ft, avdPoolConfiguration as g, readParked as gt, avdPathExists as h, parkedMaxSetting as ht, androidDataFreeBytes as i, waitForBoot as it, listAvdDeviceProfiles as j, listAdbDevices as k, androidSystemImageAbi as l, POOL_SETTING_REMEDY as lt, avdNameAbsent as m, parkSim as mt, OWNED_AVD_CONFIG_DEFAULTS as n, trimAndroidCaches as nt, androidHome as o, configuredAndroidEmulatorApp as ot, avdIniPaths as p, isLegacyDeletionClaim as pt, physicalDeviceModel as q, androidBuildToolName as r, waitForAndroidEmulatorShutdown as rt, androidPoolCandidates as s, isStimOwnedAvd as st, DEFAULT_AVD_DEVICE_PROFILE as t, systemImageSupportsFold as tt, androidToolCwd as u, adoptParked as ut, bootAndroidEmulator as v, selectParked as vt, extractEmulatorFailure as w, deleteAvd as x, configureNewOwnedAvd as y, ownedAvdDirectory as z };
1634
+ export { resetAdoptedAvd as $, listAdbDevices as A, ownedAvdDeviceProfile as B, emulatorDiskSpaceRemedy as C, getAvdNameForSerial as D, findBuildTool as E, listAvdsAsync as F, ownedAvdSerialResolverAsync as G, ownedAvdMatchesConfiguration as H, listInstalledSystemImages as I, parseAvdSystemImage as J, ownedAvdSystemImage as K, listOrphanedAvdDirectories as L, listAvdDeviceProfiles as M, listAvdDeviceProfilesAsync as N, getAvdNameForSerialAsync as O, listAvds as P, profileNeedsFoldFeature as Q, memoizeEmulatorProbe as R, deleteAvd as S, extractEmulatorFailure as T, ownedAvdName as U, ownedAvdDirectory as V, ownedAvdSerialResolver as W, pickDefaultSystemImage as X, physicalDeviceModel as Y, probeEmulatorSerial as Z, avdPoolConfiguration as _, parkedMaxSetting as _t, androidDeviceAbi as a, waitForAndroidEmulatorShutdown as at, configureNewOwnedAvd as b, selectParked as bt, androidPoolNoCandidatesRefusal as c, configuredAndroidEmulatorApp as ct, androidToolPath as d, POOL_SETTING_REMEDY as dt, resolveOwnedAvdSerialAsync as et, assertOwnedAvdStopped as f, adoptParked as ft, avdPathExists as g, parkSim as gt, avdNameAbsent as h, isLegacyDeletionClaim as ht, androidDataFreeBytes as i, trimAndroidCaches as it, listAdbDevicesAsync as j, hostSystemImageArch as k, androidSystemImageAbi as l, isStimOwnedAvd as lt, avdIniPaths as m, eraseParkedAfter as mt, OWNED_AVD_CONFIG_DEFAULTS as n, shutdownAndroidEmulator as nt, androidHome as o, waitForBoot as ot, assertOwnedAvdStoppedAsync as p, dropParked as pt, parseAvdDeviceProfile as q, androidBuildToolName as r, systemImageSupportsFold as rt, androidPoolCandidates as s, wipeAvdUserData as st, DEFAULT_AVD_DEVICE_PROFILE as t, resolvePhysicalDevice as tt, androidToolCwd as u, isStimOwnedSim as ut, avdStorageRoots as v, readParked as vt, emulatorFailureRemedy as w, createOwnedAvd as x, bootAndroidEmulator as y, removeParkedAfter as yt, nextConsolePort as z };
@@ -1,6 +1,6 @@
1
- import { i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-B1UrjZHL.mjs";
2
- import { E as resolveVariant, T as resolveSystemImage, _ as findAapt, b as noDeviceDiagnostic, d as androidVariantSetting, f as apkDevClientFacts, g as dumpApkManifest, h as displayPath, i as NO_FINGERPRINT, p as apkPackage, r as NO_DEVICE, s as androidDevClientScheme, u as androidSystemImageSetting, x as parseXmltree, y as isReleaseVariant } from "./support-67vraa1Q.mjs";
3
- import { r as lastBuildRecord, t as androidFacts } from "./result-DNiS-tTP.mjs";
4
- import { i as runAndroidOperation, n as registerAndroid, r as runAndroid, t as androidCommand } from "./android-BLgbNqox.mjs";
5
- import { a as killPreviousCollector, i as collectorLogFile, o as startCollector } from "./launch-CD1yVc7U.mjs";
1
+ import { i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-gwpm28fu.mjs";
2
+ import { E as resolveVariant, T as resolveSystemImage, _ as findAapt, b as noDeviceDiagnostic, d as androidVariantSetting, f as apkDevClientFacts, g as dumpApkManifest, h as displayPath, i as NO_FINGERPRINT, p as apkPackage, r as NO_DEVICE, s as androidDevClientScheme, u as androidSystemImageSetting, x as parseXmltree, y as isReleaseVariant } from "./support-yUiOjnVY.mjs";
3
+ import { r as lastBuildRecord, t as androidFacts } from "./result-D2Ykz_iD.mjs";
4
+ import { i as runAndroidOperation, n as registerAndroid, r as runAndroid, t as androidCommand } from "./android-ByRMUoiJ.mjs";
5
+ import { a as killPreviousCollector, i as collectorLogFile, o as startCollector } from "./launch-CCzXlc8r.mjs";
6
6
  export { NO_DEVICE, NO_FINGERPRINT, androidDevClientScheme, androidFacts, androidSystemImageSetting, androidVariantSetting, apkDevClientFacts, apkPackage, collectorLogFile, androidCommand as default, displayPath, dumpApkManifest, findAapt, formatDuration, isReleaseVariant, killPreviousCollector, lastBuildRecord, noDeviceDiagnostic, parseXmltree, phaseLine, registerAndroid, resolveSystemImage, resolveVariant, runAndroid, runAndroidOperation, shortHash, startCollector };
@@ -1,5 +1,5 @@
1
- import { t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
- import { u as androidToolCwd } from "./android-DUYkNF4u.mjs";
1
+ import { t as getExecutor } from "./exec-DEoAhcze.mjs";
2
+ import { u as androidToolCwd } from "./android-C7sVmyI9.mjs";
3
3
  //#region src/collector/android.ts
4
4
  const LEVEL_BY_LETTER = {
5
5
  V: "debug",
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
+ import { t as getExecutor } from "./exec-DEoAhcze.mjs";
3
3
  import { createHash, randomUUID } from "node:crypto";
4
4
  import { appendFileSync, existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
5
5
  import { join } from "node:path";
@@ -1,7 +1,7 @@
1
1
  import { n as ensureWorkspaceStorage, v as withDirLock$1 } from "./paths-DQtTgsBf.mjs";
2
- import { d as getConfigDir } from "./config-CYcBF478.mjs";
3
- import { m as defaultAndroidLayout } from "./settings-CsJDEXgK.mjs";
4
- import { r as register } from "./cache-manifest-DkkqguoK.mjs";
2
+ import { d as getConfigDir } from "./config-DlrsduwG.mjs";
3
+ import { m as defaultAndroidLayout } from "./settings-C7O8A6ZI.mjs";
4
+ import { r as register } from "./cache-manifest-DSeQjt-Q.mjs";
5
5
  import { createHash, randomUUID } from "node:crypto";
6
6
  import { accessSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
7
7
  import { join } from "node:path";
@@ -1,11 +1,15 @@
1
- import "./settings-DkdmlelE.mjs";
2
- import "./exec-H20xSg2T.mjs";
3
- import { StimContext } from "@stim-cli/core";
4
- import { Endpoint } from "@stim-cli/core/state";
1
+ import { n as SettingsObject, t as AndroidLayout } from "./ios-CDvlmUs7.mjs";
2
+ import { r as createNdjsonWriter } from "./exec-DnYc4HGH.mjs";
3
+ import { readFileSync, writeFileSync } from "node:fs";
4
+ import { StimContext, hostSimulatorArch } from "@stim-cli/core";
5
+ import { ANDROID_EMULATOR_APPS, BuildPhase, BuildPlanPayload, Endpoint, RunEstimates, SettingScope, WebViewport, machineCapacity } from "@stim-cli/core/state";
5
6
  import "@stim-cli/core/noise-session";
6
- import { readFileSync } from "fs";
7
+ import { readFileSync as readFileSync$1 } from "fs";
8
+ import { Command } from "commander";
7
9
  import "@expo/fingerprint";
8
- import { HelloResult } from "@stim-cli/core/protocol";
10
+ import { CacheProviderConfig, loadCacheProvider } from "@stim-cli/cache";
11
+ import { BuildReactNativeArtifactQuery, BuildSwiftpmArtifactQuery, GradleOffloadInputs, HelloResult } from "@stim-cli/core/protocol";
12
+ import { ChildProcess } from "node:child_process";
9
13
  //#region src/engine/build-facts.d.ts
10
14
  type CacheHitLevel = "local" | "remote" | false;
11
15
  type LaunchStatus = boolean | "unverified" | "bundling";
@@ -143,6 +147,23 @@ interface CompilerCacheFallback {
143
147
  fromEnvironment: boolean;
144
148
  manifest: string | null;
145
149
  }
150
+ declare function artifactCachePolicy(options: Optimizations, reuse: boolean, release: boolean): {
151
+ read: boolean;
152
+ write: boolean;
153
+ remote: boolean;
154
+ };
155
+ //#endregion
156
+ //#region src/engine/android-cas.d.ts
157
+ interface AndroidCasSetup {
158
+ id: string;
159
+ dir: string;
160
+ initScript: string;
161
+ env: Record<string, string>;
162
+ }
163
+ declare function resolveAndroidCas(root: string, env?: NodeJS.ProcessEnv, layout?: AndroidLayout): AndroidCasSetup | null;
164
+ //#endregion
165
+ //#region src/commands/android/types.d.ts
166
+ type AndroidWriter = ReturnType<typeof createNdjsonWriter>;
146
167
  //#endregion
147
168
  //#region src/diagnostics/doctor.d.ts
148
169
  interface Finding {
@@ -154,7 +175,73 @@ interface Finding {
154
175
  }
155
176
  type DoctorPlatform = "ios" | "android";
156
177
  //#endregion
178
+ //#region src/budget.d.ts
179
+ type ReclaimStepName = "idle-devices" | "idle-dev-servers" | "workspace-outputs" | "stale-cache-entries";
180
+ interface ReclaimedStep {
181
+ step: ReclaimStepName;
182
+ targets: string[];
183
+ failures: number;
184
+ freedMb?: number;
185
+ }
186
+ interface BudgetReport {
187
+ budget: {
188
+ minFreeDiskGb: number;
189
+ hardFloorDiskGb: number;
190
+ maxCommittedMemoryGb: number;
191
+ maxLiveWorkspaces: number;
192
+ };
193
+ volumes: {
194
+ volume: string;
195
+ freeGb: number;
196
+ }[];
197
+ memory: {
198
+ committedGb: number;
199
+ liveWorkspaces: number;
200
+ } | null;
201
+ plan: ReclaimedStep[];
202
+ }
203
+ //#endregion
204
+ //#region src/commands/android/plan.d.ts
205
+ interface AndroidBuildPlan {
206
+ readonly build: {
207
+ readonly variant: string | null;
208
+ readonly release: boolean;
209
+ readonly profile: string | undefined;
210
+ readonly cas: ReturnType<typeof resolveAndroidCas>;
211
+ readonly cache: Readonly<ReturnType<typeof artifactCachePolicy>>;
212
+ readonly compilerCache: Optimizations["android"]["compilerCache"];
213
+ readonly gradleBuildCache: boolean;
214
+ readonly pch: Optimizations["android"]["pch"];
215
+ readonly targetAbiOnly: boolean;
216
+ };
217
+ readonly metroWarmup: boolean;
218
+ readonly cacheProviderConfig: CacheProviderConfig | null;
219
+ }
220
+ //#endregion
157
221
  //#region src/offload/toolchain.d.ts
222
+ /** What must be identical on this Mac and a remote Mac for an iOS simulator build to come out the same. */
223
+ interface IosToolchain {
224
+ /** A digest of Stim's built code, so both sides prove they run the same Stim. */
225
+ stimBuild: string | null;
226
+ arch: string;
227
+ xcode: string | null;
228
+ simulatorSdk: string | null;
229
+ cocoapods: string | null;
230
+ }
231
+ /** A remote machine's toolchain, the simulator runtimes it can build for, and its JDK and Android SDK packages. */
232
+ interface WorkerToolchain extends IosToolchain {
233
+ /** The OS stim-server runs on, as Node names it; absent from a stim-server older than this field. */
234
+ os?: string;
235
+ macosSdk: string | null;
236
+ bundler: string | null;
237
+ runtimes: string[];
238
+ jdk: string | null;
239
+ androidSdk: {
240
+ ndk: string[];
241
+ buildTools: string[];
242
+ platforms: string[];
243
+ } | null;
244
+ }
158
245
  /** One reason a remote machine cannot take this build now, with a stable `code` for doctor's JSON. */
159
246
  interface OffloadProblem {
160
247
  code: "unreachable" | "checkout" | "stim-build" | "arch" | "xcode" | "macos-sdk" | "simulator-sdk" | "cocoapods" | "bundler" | "runtime" | "jdk" | "android-sdk" | "ndk" | "build-tools" | "compile-sdk" | "disk" | "busy" | "platform";
@@ -250,4 +337,55 @@ interface AndroidBuildOptions {
250
337
  module?: string | null;
251
338
  }
252
339
  //#endregion
253
- export { DoctorPlatform as a, AndroidFacts as c, IosFacts as d, TailnetMachineIo as i, CcacheActivity as l, BuildMachinesInspection as n, Finding as o, GeneratedTickets as r, Optimizations as s, AndroidBuildOptions as t, CompilationCacheActivity as u };
340
+ //#region src/integrations/swiftpm-artifact-inputs.d.ts
341
+ interface SwiftpmArtifactToolchain {
342
+ swift: string;
343
+ sdk: string;
344
+ arch: string;
345
+ xcode: string;
346
+ }
347
+ //#endregion
348
+ //#region src/web/launch.d.ts
349
+ type WebLaunched = true | "bundling" | "unverified";
350
+ //#endregion
351
+ //#region src/integrations/native-gradle-artifact-inputs.d.ts
352
+ interface GradleArtifactInputs extends GradleOffloadInputs {
353
+ localFiles: string[];
354
+ environment: string[];
355
+ }
356
+ type GradleArtifactBuild = Pick<AndroidArtifactContext["buildPlan"], "variant" | "compilerCache" | "gradleBuildCache" | "pch" | "cas">;
357
+ interface NativeGradleArtifactReceipt {
358
+ source: string;
359
+ declaration: GradleArtifactInputs;
360
+ build: GradleArtifactBuild;
361
+ abi: string | null;
362
+ }
363
+ //#endregion
364
+ //#region src/integrations/android-project.d.ts
365
+ interface AndroidBuildTarget {
366
+ abi: string | null;
367
+ }
368
+ interface AndroidArtifactIdentity {
369
+ hash: string;
370
+ key: string;
371
+ }
372
+ interface AndroidArtifactContext {
373
+ operation?: StimContext;
374
+ artifactScope?: {
375
+ key: string;
376
+ validate(): Promise<void>;
377
+ record?(identity: AndroidArtifactIdentity, receipt: NativeGradleArtifactReceipt): void;
378
+ };
379
+ root: string;
380
+ buildLog: string;
381
+ writer: AndroidWriter;
382
+ settings: SettingsObject;
383
+ buildPlan: AndroidBuildPlan["build"];
384
+ target: AndroidBuildTarget;
385
+ phase: (label: unknown, text: string) => void;
386
+ out: (line: string) => void;
387
+ step: (phase: BuildPhase) => void;
388
+ estimates: () => RunEstimates;
389
+ }
390
+ //#endregion
391
+ export { IosFacts as _, BuildMachinesInspection as a, IosToolchain as c, DoctorPlatform as d, Finding as f, CompilationCacheActivity as g, CcacheActivity as h, AndroidBuildOptions as i, WorkerToolchain as l, AndroidFacts as m, WebLaunched as n, GeneratedTickets as o, Optimizations as p, SwiftpmArtifactToolchain as r, TailnetMachineIo as s, NativeGradleArtifactReceipt as t, BudgetReport as u };