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,30 +1,32 @@
1
- import { d as withDrainingCancellation, p as process_identity_exports, s as spawnDeclared, t as getExecutor } from "./exec-_UbtCQcG.mjs";
1
+ import { d as spawnDeclared, h as withDrainingCancellation, i as withWorkspaceProcessLock, t as getExecutor } from "./exec-DEoAhcze.mjs";
2
2
  import { d as workspaceDir, l as workspaceAgentDeviceDir, m as workspaceLogsDir$1, n as ensureWorkspaceStorage } from "./paths-DQtTgsBf.mjs";
3
- import { E as upsertProject, u as getConcurrencyLimits } from "./config-CYcBF478.mjs";
4
- import { l as phaseLine } from "./command-output-B1UrjZHL.mjs";
5
- import { d as writeWorkspaceState, i as recordWorkspaceUse } from "./workspace-state-Cjuigeeu.mjs";
6
- import { J as resolveProjectSettingsAsync, a as SETTING_SHAPE_REMEDY, en as throwIfCancelled, et as settingShapeErrors } from "./settings-CsJDEXgK.mjs";
7
- import { f as projectRegistry, i as findProjectRoot$1, s as ownedDeviceLabel } from "./project-BZNjmW_8.mjs";
8
- import { i as macosProcess, n as macosDir, o as requiredMacosRecord, r as macosLogFile } from "./state-XMziexv2.mjs";
3
+ import { E as upsertProject, u as getConcurrencyLimits } from "./config-DlrsduwG.mjs";
4
+ import { l as phaseLine } from "./command-output-gwpm28fu.mjs";
5
+ import { f as throwIfCancelled } from "./operation-exec-BW0em61G.mjs";
6
+ import { d as writeWorkspaceState, i as recordWorkspaceUse } from "./workspace-state-U08dEzhG.mjs";
7
+ import { J as resolveProjectSettingsAsync, a as SETTING_SHAPE_REMEDY, et as settingShapeErrors } from "./settings-C7O8A6ZI.mjs";
8
+ import { f as projectRegistry, i as findProjectRoot$1, s as ownedDeviceLabel } from "./project-wM_XFTvE.mjs";
9
+ import { i as macosProcess, n as macosDir, o as requiredMacosRecord, r as macosLogFile } from "./state-08I3hw3_.mjs";
9
10
  import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
10
- import { B as recordFinishedBuild, Fn as processContext, H as tapBuildLog, In as runProcessOperation, M as NO_BUILD_PROGRESS, V as startBuildProgress, z as recordBuildPhase } from "./budget-Bs6SxxzO.mjs";
11
- import { d as runCancellationSignal, f as withNativeBuildRun } from "./native-run-DY_RLx3C.mjs";
12
- import { F as acquireBuildSlot, L as releaseBuildSlot } from "./workspaces-BccMFmGQ.mjs";
13
- import { D as sanitizeDeviceLabel } from "./ios-CpByZy12.mjs";
14
- import { t as withWorkspaceProcessLock } from "./workspace-process-lock-1_1OoVW5.mjs";
15
- import { c as offloadPlacement, f as setRemoteLogSink, i as closeOffload, l as placementLoad, n as buildPlacementCandidates, o as offloadBuild, r as chooseBuildMachine, u as remotePhaseText } from "./client-UXD70ZbM.mjs";
16
- import { a as requireLocalBuild, i as parseBuildMachineOption, r as namedBuildMachine, s as resolveBuildPlacement, t as OffloadRefusal } from "./selection-CSl9i5qU.mjs";
17
- import { l as connectHost } from "./hosted-client-DB_gBPfY.mjs";
18
- import { t as placeHostedMacos } from "./hosted-macos-QI141yKk.mjs";
19
- import { r as stopMacosAppHeld, t as stopBundleInstances } from "./stop-D7h6jAXQ.mjs";
11
+ import { B as recordFinishedBuild, Fn as processContext, H as tapBuildLog, In as runProcessOperation, M as NO_BUILD_PROGRESS, V as startBuildProgress, z as recordBuildPhase } from "./budget-Cvwn54qV.mjs";
12
+ import { d as runCancellationSignal, f as withNativeBuildRun } from "./native-run-NwUuxbkg.mjs";
13
+ import { I as acquireBuildSlot, R as releaseBuildSlot } from "./workspaces-CpANmBlq.mjs";
14
+ import { D as sanitizeDeviceLabel } from "./ios-hcBpnEGk.mjs";
15
+ import { c as offloadPlacement, h as setRemoteLogSink, i as closeOffload, l as placementLoad, n as buildPlacementCandidates, o as offloadBuild, r as chooseBuildMachine, u as remotePhaseText } from "./client-OyRoEuSr.mjs";
16
+ import { a as requireLocalBuild, i as parseBuildMachineOption, r as namedBuildMachine, s as resolveBuildPlacement, t as OffloadRefusal } from "./selection-DSMbWEX2.mjs";
17
+ import { l as connectHost } from "./hosted-client-DZAPrcro.mjs";
18
+ import { t as placeHostedMacos } from "./hosted-macos-_awYSpfv.mjs";
19
+ import { r as stopMacosAppHeld, t as stopBundleInstances } from "./stop-Dky10AEJ.mjs";
20
20
  import { t as spawnEntry } from "./spawn-entry-jw19m8Nl.mjs";
21
- import { t as buildPlacementRecord } from "./placement-log-BqGbTa61.mjs";
22
- import { i as validateInfoPlist, t as resolveBundleExtras } from "./stage-BIS0ydsV.mjs";
21
+ import { t as buildPlacementRecord } from "./placement-log-BnGgJRRZ.mjs";
22
+ import { t as reidentifyBundle } from "./stage-Bps5oius.mjs";
23
+ import { t as validateMacosArtifactPlatform } from "./artifact-platform-CXcmX_j3.mjs";
24
+ import { t as waitForMacosRegistration } from "./registration-BcRgF6Ox.mjs";
23
25
  import { createHash, randomUUID } from "node:crypto";
24
26
  import { closeSync, existsSync, openSync, promises, realpathSync, renameSync } from "node:fs";
25
27
  import { join } from "node:path";
26
28
  import { LOG_ROTATE_BYTES, ambientEnv } from "@stim-cli/core";
27
- import { machineCapacity, readMacosRecord, validHostedAppArguments } from "@stim-cli/core/state";
29
+ import { machineCapacity, validHostedAppArguments } from "@stim-cli/core/state";
28
30
  //#region src/macos/build.ts
29
31
  async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displayName, scratch, writer, note, record, buildMachine, progress = NO_BUILD_PROGRESS }) {
30
32
  const signal = runCancellationSignal(context) ?? context.signal;
@@ -87,9 +89,76 @@ async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displ
87
89
  }
88
90
  };
89
91
  let choice = null;
92
+ let retainStaging = false;
93
+ let identity = null;
94
+ const save = async (path) => {
95
+ if (!recipe.cache || !identity) return;
96
+ try {
97
+ if ((await recipe.cache.identity()).hash !== identity.hash) {
98
+ if (record) {
99
+ delete record.fingerprint;
100
+ delete record.cacheKey;
101
+ }
102
+ write("macOS inputs changed during the build; installing without caching.");
103
+ return;
104
+ }
105
+ const directory = join(staging, "cache-store");
106
+ await promises.mkdir(directory);
107
+ await recipe.cache.store(identity.key, path, directory);
108
+ } catch (error) {
109
+ if (error instanceof Error && "reportCleanup" in error) {
110
+ retainStaging = true;
111
+ throw error;
112
+ }
113
+ throwIfCancelled(signal, "macOS cache store");
114
+ write(`macOS cache store skipped: ${error instanceof Error ? error.message : String(error)}`);
115
+ }
116
+ };
90
117
  try {
118
+ if (record) record.cacheHit = false;
119
+ if (recipe.cache) try {
120
+ identity = await recipe.cache.identity();
121
+ if (record) {
122
+ record.fingerprint = identity.hash;
123
+ record.cacheKey = identity.key;
124
+ }
125
+ const hit = await recipe.cache.restore(identity.key, join(staging, "cache-read"));
126
+ if (hit && (await recipe.cache.identity()).hash === identity.hash) {
127
+ await reidentifyBundle(context, hit.bundle, bundleId, displayName);
128
+ await recipe.validateFetched(hit.bundle, bundleId, displayName);
129
+ throwIfCancelled(signal, "macOS cache restore");
130
+ promote(hit.bundle);
131
+ if (record) {
132
+ record.cacheHit = true;
133
+ record.cacheSource = hit.tier;
134
+ }
135
+ write(`macOS cache hit (${hit.tier})`);
136
+ return {
137
+ bundleId,
138
+ offloadedTo: null,
139
+ offloadFallback: null,
140
+ handoff: null
141
+ };
142
+ }
143
+ } catch (error) {
144
+ if (error instanceof Error && "reportCleanup" in error) {
145
+ retainStaging = true;
146
+ throw error;
147
+ }
148
+ throwIfCancelled(signal, "macOS cache lookup");
149
+ write(`macOS cache lookup skipped: ${error instanceof Error ? error.message : String(error)}`);
150
+ }
151
+ let cacheOnly = false;
91
152
  try {
92
153
  const { mode, machines, localEnabled } = buildPlacementCandidates(buildMachine);
154
+ const peer = recipe.cache?.peer?.() ?? null;
155
+ const request = {
156
+ ...recipe.offload.request(bundleId),
157
+ ...peer ? {
158
+ artifactInputs: peer.inputs,
159
+ cacheArtifact: peer.write
160
+ } : {}
161
+ };
93
162
  const here = machineCapacity();
94
163
  const placement = offloadPlacement({
95
164
  mode,
@@ -99,7 +168,8 @@ async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displ
99
168
  unsupported: null,
100
169
  selected: buildMachine
101
170
  });
102
- if (placement.offload) {
171
+ cacheOnly = !placement.offload && placement.code === "this-mac-free" && peer !== null;
172
+ if (placement.offload || cacheOnly) {
103
173
  const chosen = await chooseBuildMachine({
104
174
  projectRoot: root,
105
175
  target: await recipe.offload.target(),
@@ -108,7 +178,9 @@ async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displ
108
178
  machines,
109
179
  selected: buildMachine,
110
180
  note: (line) => write(`offload: ${line}`),
111
- onCandidates: (each) => asked = each
181
+ onCandidates: (each) => asked = each,
182
+ cacheOnly,
183
+ ...peer ? { swiftpmArtifact: request } : {}
112
184
  });
113
185
  if (typeof chosen === "string") throw new Error(chosen);
114
186
  choice = chosen;
@@ -125,7 +197,7 @@ async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displ
125
197
  write(`placement: ${choice.machine} (${placement.reason}${placementLoad(choice)})`);
126
198
  const outcome = await offloadBuild({
127
199
  choice,
128
- request: recipe.offload.request(bundleId),
200
+ request,
129
201
  stagingDir: join(staging, "offload"),
130
202
  onPhase: (phase, line) => note(remotePhaseText(phase, line, choice.machine)),
131
203
  onEnter: (phase) => {
@@ -150,12 +222,20 @@ async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displ
150
222
  progress.place(null);
151
223
  if (!outcome.ok) throw new Error(`${outcome.machine}: ${outcome.reason}`);
152
224
  progress.step("install");
225
+ if (outcome.cacheHit) {
226
+ await reidentifyBundle(context, outcome.artifactPath, bundleId, displayName);
227
+ await validateMacosArtifactPlatform(context, outcome.artifactPath, recipe.product, signal);
228
+ }
153
229
  await recipe.validateFetched(outcome.artifactPath, bundleId, displayName);
154
230
  throwIfCancelled(signal, "macOS build");
155
231
  promote(outcome.artifactPath);
156
232
  if (record) {
233
+ delete record.fingerprint;
234
+ delete record.cacheKey;
157
235
  record.offloadedTo = outcome.machine;
158
236
  record.builtOn = outcome.machine;
237
+ record.cacheHit = outcome.cacheHit === true;
238
+ if (outcome.cacheHit) record.cacheSource = "peer";
159
239
  }
160
240
  return {
161
241
  bundleId,
@@ -174,8 +254,13 @@ async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displ
174
254
  }));
175
255
  write(`placement: here (${placement.reason})`);
176
256
  } catch (error) {
257
+ if (error instanceof Error && "reportCleanup" in error) {
258
+ retainStaging = true;
259
+ throw error;
260
+ }
177
261
  throwIfCancelled(signal, "macOS build");
178
- fallBack(error instanceof Error ? error.message : String(error));
262
+ if (cacheOnly) write(`placement: here (no reusable peer artifact)`);
263
+ else fallBack(error instanceof Error ? error.message : String(error));
179
264
  } finally {
180
265
  if (choice) closeOffload(choice);
181
266
  }
@@ -202,6 +287,9 @@ async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displ
202
287
  const staged = join(staging, `${recipe.product}.app`);
203
288
  await recipe.stage(bin, staged, bundleId, displayName);
204
289
  throwIfCancelled(signal, "macOS build");
290
+ releaseBuildSlot(slot);
291
+ slot = void 0;
292
+ await save(staged);
205
293
  promote(staged);
206
294
  return {
207
295
  bundleId,
@@ -214,7 +302,7 @@ async function buildMacosBundle({ context, root, recipe, bundle, bundleId, displ
214
302
  }
215
303
  } finally {
216
304
  try {
217
- await promises.rm(staging, {
305
+ if (!retainStaging) await promises.rm(staging, {
218
306
  recursive: true,
219
307
  force: true
220
308
  });
@@ -247,24 +335,36 @@ async function planMacos(context, root, buildMachineFlag) {
247
335
  if (process.platform !== "darwin") throw new Error("stim macos requires a Mac with Swift installed.");
248
336
  root = realpathSync(root);
249
337
  if (!existsSync(join(root, "Package.swift"))) throw new Error("Run stim macos from the directory containing Package.swift.");
250
- const { context: projectContext, settings } = await resolveProjectSettingsAsync(root);
338
+ const { settings } = await resolveProjectSettingsAsync(root, {
339
+ env: context.env,
340
+ signal: context.signal
341
+ });
251
342
  const [shape] = settingShapeErrors(settings);
252
343
  if (shape) throw new Error(`${shape} ${SETTING_SHAPE_REMEDY}`);
253
344
  const selected = resolveBuildPlacement(buildMachineFlag);
254
345
  if (selected.failure) throw Object.assign(new Error(selected.failure.message), selected.failure);
255
346
  const macos = settings.macos;
256
347
  if (!macos?.product || !macos.infoPlist) throw Object.assign(/* @__PURE__ */ new Error("Set macos.product and macos.infoPlist explicitly in .stim.json. See stim guide macos."), { code: "STIM_BAD_ARG" });
257
- await validateInfoPlist(context, root, macos.product, macos.infoPlist);
258
- resolveBundleExtras(root, projectContext.repoRoot ?? root, macos.resources, macos.assetCatalog);
348
+ const { swiftpmMacosProject } = await import("./swiftpm-macos-BIak-Rxv.mjs");
349
+ const recipe = await swiftpmMacosProject(root).prepare(context, settings);
350
+ let identity = null;
351
+ let cacheHit = false;
352
+ if (recipe.cache) try {
353
+ identity = await recipe.cache.identity();
354
+ cacheHit = await recipe.cache.has(identity.key);
355
+ } catch (error) {
356
+ if (error instanceof Error && "reportCleanup" in error) throw error;
357
+ context.signal.throwIfAborted();
358
+ }
259
359
  return {
260
360
  platform: "macos",
261
361
  product: macos.product,
262
362
  buildMachine: selected.selected,
263
- fingerprint: null,
264
- cacheKey: null,
265
- cacheHit: false,
363
+ fingerprint: identity?.hash ?? null,
364
+ cacheKey: identity?.key ?? null,
365
+ cacheHit,
266
366
  provider: null,
267
- cacheSkipped: false,
367
+ cacheSkipped: identity === null,
268
368
  prebuild: null,
269
369
  outcome: null,
270
370
  expectedMs: null,
@@ -471,10 +571,10 @@ function recordMacosBuild(root, build, compileSteps) {
471
571
  platform: "macos",
472
572
  status: build.state === "ok" ? "ok" : "failed",
473
573
  configuration: "Debug",
474
- fingerprint: null,
475
- cacheKey: null,
476
- cacheHit: false,
477
- cacheSkipped: false,
574
+ fingerprint: build.fingerprint ?? null,
575
+ cacheKey: build.cacheKey ?? null,
576
+ cacheHit: build.cacheHit ? build.cacheSource === "provider" ? "remote" : "local" : false,
577
+ cacheSkipped: !build.cacheKey,
478
578
  durationMs: build.durationMs,
479
579
  startedAt: build.startedAt,
480
580
  errorCode: build.errorCode,
@@ -514,7 +614,8 @@ async function launchHere(context, root, record, note) {
514
614
  stdio: [
515
615
  "ignore",
516
616
  fd,
517
- fd
617
+ fd,
618
+ "ipc"
518
619
  ],
519
620
  env: {
520
621
  ...ambientEnv(),
@@ -526,14 +627,10 @@ async function launchHere(context, root, record, note) {
526
627
  closeSync(fd);
527
628
  }
528
629
  const deadline = Date.now() + 2e4;
529
- while (Date.now() < deadline) {
530
- const current = readMacosRecord(root);
531
- if (current?.launchId === record.launchId && current.app && current.supervisor && (0, process_identity_exports.inspectProcessIdentity)(current.app) === "same" && (0, process_identity_exports.inspectProcessIdentity)(current.supervisor) === "same") {
532
- if (await waitForLaunchServices(current, deadline) === "timeout") note("macOS LaunchServices does not list the app yet. agent-device open may start a second copy; wait and check lsappinfo.");
533
- return current;
534
- }
535
- if (child.exitCode !== null || child.signalCode !== null) break;
536
- await new Promise((done) => setTimeout(done, 100));
630
+ const current = await waitForMacosRegistration(root, record.launchId, child, deadline);
631
+ if (current) {
632
+ if (await waitForLaunchServices(current, deadline) === "timeout") note("macOS LaunchServices does not list the app yet. agent-device open may start a second copy; wait and check lsappinfo.");
633
+ return current;
537
634
  }
538
635
  throw new Error("The macOS app did not register. See macos-supervisor.log in the workspace logs.");
539
636
  }
@@ -594,4 +691,4 @@ function macosCommand(program) {
594
691
  });
595
692
  }
596
693
  //#endregion
597
- export { buildMacosBundle as i, runMacos as n, waitForLaunchServices as r, macosCommand as t };
694
+ export { buildMacosBundle as a, planMacos as i, runMacos as n, waitForLaunchServices as r, macosCommand as t };
@@ -1,2 +1,2 @@
1
- import { n as runMacosSupervisor, t as logLines } from "./run-D23HmJMs.mjs";
1
+ import { n as runMacosSupervisor, t as logLines } from "./run-DidHghD1.mjs";
2
2
  export { logLines, runMacosSupervisor };
@@ -1,19 +1,19 @@
1
- import { P as formatBytes } from "./config-CYcBF478.mjs";
2
- import { Tt as deviceSweepIsScoped, u as resolveBudget } from "./budget-Bs6SxxzO.mjs";
3
- import { I as memoryCulpritAdvice, N as memoryCulpritsUnder } from "./ios-CpByZy12.mjs";
4
- import { h as maintenanceLogger } from "./client-UXD70ZbM.mjs";
1
+ import { P as formatBytes } from "./config-DlrsduwG.mjs";
2
+ import { Tt as deviceSweepIsScoped, u as resolveBudget } from "./budget-Cvwn54qV.mjs";
3
+ import { I as memoryCulpritAdvice, N as memoryCulpritsUnder } from "./ios-hcBpnEGk.mjs";
4
+ import { v as maintenanceLogger } from "./client-OyRoEuSr.mjs";
5
5
  import { t as resolveMaintenanceSettings } from "./settings-Djl-mpjX.mjs";
6
- import { A as lowestFree, C as measurePressure, D as diskPressureLevel, E as sizeScanDeferred, O as levelFloors, S as measureDisk, T as measureSizes, k as levelStillShort } from "./worktree-DQ6Zi2Mv.mjs";
7
- import { i as plannedMaintenance, m as measureOwnedDevices, n as diskRecovered, o as triggeringRoot, r as executeAction } from "./act-DHAw2A2S.mjs";
8
- import { t as relaunchWithLogFile } from "./detached-entry-DFRyG1_o.mjs";
6
+ import { t as relaunchWithLogFile } from "./detached-entry-BwNEtIrP.mjs";
7
+ import { A as levelFloors, C as measureDisk, D as measureSizes, M as lowestFree, O as sizeScanDeferred, T as measurePressure, j as levelStillShort, k as diskPressureLevel } from "./worktree-CHecZ4Oq.mjs";
8
+ import { i as plannedMaintenance, m as measureOwnedDevices, n as diskRecovered, o as triggeringRoot, r as executeAction } from "./act-DsuqEkiM.mjs";
9
9
  import { r as due, t as capChildLog } from "./attempt-DW-mQqM7.mjs";
10
+ import { releaseClaim, tryAcquireClaim } from "@stim-cli/core/ownership-claim";
10
11
  import { randomBytes } from "node:crypto";
11
12
  import { appendFileSync, mkdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
12
13
  import { basename, join, resolve } from "node:path";
13
14
  import { withDirLock } from "@stim-cli/core";
14
15
  import { maintenanceChildLogFile, maintenanceDir, maintenanceRunClaims, maintenanceStateFile, readMaintenanceState } from "@stim-cli/core/state";
15
16
  import { fileURLToPath } from "node:url";
16
- import { releaseClaim, tryAcquireClaim } from "@stim-cli/core/ownership-claim";
17
17
  //#region src/maintenance/run.ts
18
18
  function writeState(state) {
19
19
  mkdirSync(maintenanceDir(), { recursive: true });
@@ -1,6 +1,7 @@
1
- import { p as process_identity_exports, t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
- import { F as isOnMountedVolume, I as listMountedVolumes, _ as loadConfig, n as allMetroPorts, r as claimMetroPort, x as releaseMetroPort } from "./config-CYcBF478.mjs";
3
- import { r as readWorkspaceState } from "./workspace-state-Cjuigeeu.mjs";
1
+ import { g as process_identity_exports, r as WorkspaceProcessCleanupError, t as getExecutor } from "./exec-DEoAhcze.mjs";
2
+ import { F as isOnMountedVolume, I as listMountedVolumes, O as withConfigLockAsync, _ as loadConfig, n as allMetroPorts, r as claimMetroPort, x as releaseMetroPort } from "./config-DlrsduwG.mjs";
3
+ import { t as runOperationFile } from "./operation-exec-BW0em61G.mjs";
4
+ import { r as readWorkspaceState } from "./workspace-state-U08dEzhG.mjs";
4
5
  import { sep } from "path";
5
6
  import { existsSync, readlinkSync, realpathSync } from "fs";
6
7
  import { readFile } from "node:fs/promises";
@@ -224,15 +225,19 @@ function isMetroRunning(port, signal) {
224
225
  });
225
226
  }
226
227
  const FIRST_PORT = 8082;
227
- async function computeNextPort(isFree = createPortProbe()) {
228
+ async function computeNextPort(isFree = createPortProbe(), signal) {
229
+ signal?.throwIfAborted();
228
230
  const taken = new Set(allMetroPorts());
229
231
  for (let port = FIRST_PORT; port < 8282; port++) {
230
232
  if (taken.has(port)) continue;
231
- if (await isFree(port)) return port;
233
+ const free = await isFree(port);
234
+ signal?.throwIfAborted();
235
+ if (free) return port;
232
236
  }
233
237
  throw new Error(`Found no free Metro port between ${FIRST_PORT} and 8281. Free one up, or stop a stale bundler (\`stim status\`, \`stim stop <port>\`).`);
234
238
  }
235
- async function findReclaimablePort(excludeProjectPath, probe = isMetroRunning, { isMounted = isOnMountedVolume, mountedVolumes } = {}) {
239
+ async function findReclaimablePort(excludeProjectPath, probe = isMetroRunning, { isMounted = isOnMountedVolume, mountedVolumes, signal } = {}) {
240
+ signal?.throwIfAborted();
236
241
  const cfg = loadConfig();
237
242
  if (!cfg?.projects) return null;
238
243
  const mounted = mountedVolumes || listMountedVolumes();
@@ -247,26 +252,31 @@ async function findReclaimablePort(excludeProjectPath, probe = isMetroRunning, {
247
252
  ownerPath: path
248
253
  });
249
254
  }
250
- for (const c of candidates) if (!await probe(c.port)) return c;
255
+ for (const c of candidates) {
256
+ const alive = await probe(c.port);
257
+ signal?.throwIfAborted();
258
+ if (!alive) return c;
259
+ }
251
260
  return null;
252
261
  }
253
- async function allocatePort(projectPath, probe = isMetroRunning, isFree = createPortProbe()) {
254
- const reclaim = await findReclaimablePort(projectPath, probe);
262
+ async function allocatePort(projectPath, probe = isMetroRunning, isFree = createPortProbe(), signal) {
263
+ const reclaim = await findReclaimablePort(projectPath, probe, { signal });
255
264
  if (reclaim && await isFree(reclaim.port)) {
256
- releaseMetroPort(reclaim.ownerPath, reclaim.port);
265
+ await withConfigLockAsync(() => releaseMetroPort(reclaim.ownerPath, reclaim.port), signal);
257
266
  return reclaim.port;
258
267
  }
259
- return computeNextPort(isFree);
268
+ return computeNextPort(isFree, signal);
260
269
  }
261
270
  const RESERVE_ATTEMPTS = 5;
262
- async function reserveMetroPort(projectPath, probe = isMetroRunning, isFree, pinned = null) {
271
+ async function reserveMetroPort(projectPath, probe = (port) => isMetroRunning(port, signal), isFree, pinned = null, signal) {
272
+ signal?.throwIfAborted();
263
273
  if (pinned !== null) {
264
- if (claimMetroPort(projectPath, pinned) !== null) return pinned;
274
+ if (await withConfigLockAsync(() => claimMetroPort(projectPath, pinned), signal) !== null) return pinned;
265
275
  throw new Error(`metro.port ${pinned} is already reserved by another workspace's Metro or named port.`);
266
276
  }
267
277
  for (let attempt = 0; attempt < RESERVE_ATTEMPTS; attempt++) {
268
- const port = await allocatePort(projectPath, probe, isFree);
269
- const claimed = claimMetroPort(projectPath, port);
278
+ const port = await allocatePort(projectPath, probe, isFree, signal);
279
+ const claimed = await withConfigLockAsync(() => claimMetroPort(projectPath, port), signal);
270
280
  if (claimed !== null) return claimed;
271
281
  }
272
282
  throw new Error(`Could not reserve a Metro port after ${RESERVE_ATTEMPTS} attempts: another Stim run claimed each one first. Retry.`);
@@ -315,7 +325,7 @@ function listeningPids(port, platform = process.platform) {
315
325
  return parseNetstatPids(getExecutor().runQuiet("netstat -ano", { timeoutMs: 1e4 }), port);
316
326
  }
317
327
  /** Reads listener pids without blocking on lsof or netstat. */
318
- async function listeningPidsAsync(port, platform = process.platform) {
328
+ async function listeningPidsAsync(port, platform = process.platform, signal) {
319
329
  const pids = parseLsofPids(await getExecutor().runFileQuietAsync("lsof", [
320
330
  "-nP",
321
331
  `-iTCP:${port}`,
@@ -323,12 +333,14 @@ async function listeningPidsAsync(port, platform = process.platform) {
323
333
  "-t"
324
334
  ], {
325
335
  timeoutMs: 1e4,
326
- killSignal: "SIGKILL"
336
+ killSignal: "SIGKILL",
337
+ signal
327
338
  }));
328
339
  if (pids.length > 0 || platform !== "win32") return pids;
329
340
  return parseNetstatPids(await getExecutor().runFileQuietAsync("netstat", ["-ano"], {
330
341
  timeoutMs: 1e4,
331
- killSignal: "SIGKILL"
342
+ killSignal: "SIGKILL",
343
+ signal
332
344
  }), port);
333
345
  }
334
346
  function parseLsofCwd(out) {
@@ -339,10 +351,11 @@ function parseLsofCwd(out) {
339
351
  const nLine = lines.slice(idx + 1).find((l) => l.startsWith("n"));
340
352
  return nLine ? nLine.slice(1) : null;
341
353
  }
342
- function lsofOutput(args) {
354
+ function lsofOutput(args, signal) {
343
355
  return getExecutor().runFileAsync("lsof", args, {
344
356
  timeoutMs: 1e4,
345
- killSignal: "SIGKILL"
357
+ killSignal: "SIGKILL",
358
+ signal
346
359
  }).catch((error) => typeof error?.stdout === "string" ? error.stdout : null);
347
360
  }
348
361
  /**
@@ -375,7 +388,7 @@ function parseLsofCwds(out) {
375
388
  return cwds;
376
389
  }
377
390
  /** `processCwd` for several pids with at most one lsof call. A pid lsof could not be asked about is missing from the map. */
378
- async function processCwds(pids) {
391
+ async function processCwds(pids, signal) {
379
392
  const cwds = /* @__PURE__ */ new Map();
380
393
  const viaLsof = [];
381
394
  for (const pid of new Set(pids)) {
@@ -394,7 +407,7 @@ async function processCwds(pids) {
394
407
  "-d",
395
408
  "cwd",
396
409
  "-Fn"
397
- ]);
410
+ ], signal);
398
411
  if (out === null) return cwds;
399
412
  const found = parseLsofCwds(out);
400
413
  for (const pid of viaLsof) cwds.set(pid, found.get(pid) ?? null);
@@ -488,21 +501,24 @@ function signalProcessTree(pid, signal = "SIGTERM", { group = false, platform =
488
501
  "/F"
489
502
  ], { timeoutMs: 3e4 }) !== null;
490
503
  }
491
- function killMetroTree(leader, processToken) {
492
- if (!leader || leader === process.pid || (0, process_identity_exports.inspectProcessIdentity)({
493
- pid: leader,
494
- processToken
495
- }) !== "same") return false;
496
- try {
497
- return signalProcessTree(leader, "SIGTERM", { group: true });
498
- } catch {
499
- return false;
500
- }
501
- }
502
504
  /** Signals a process tree without blocking on Windows taskkill. */
503
505
  async function signalProcessTreeAsync(pid, signal = "SIGTERM", options = {}) {
506
+ options.operation?.signal.throwIfAborted();
504
507
  if (!Number.isSafeInteger(pid) || pid <= 1) throw new Error(`Refusing to signal pid ${pid}.`);
505
508
  if ((options.platform ?? process.platform) !== "win32") return signalProcessTree(pid, signal, options);
509
+ if (options.operation) {
510
+ await runOperationFile(options.operation, getExecutor(), "taskkill", [
511
+ "/PID",
512
+ String(pid),
513
+ "/T",
514
+ "/F"
515
+ ], {
516
+ cwd: options.operation.cwd,
517
+ timeoutMs: 3e4,
518
+ killSignal: "SIGKILL"
519
+ });
520
+ return true;
521
+ }
506
522
  return await getExecutor().runFileQuietAsync("taskkill", [
507
523
  "/PID",
508
524
  String(pid),
@@ -514,16 +530,22 @@ async function signalProcessTreeAsync(pid, signal = "SIGTERM", options = {}) {
514
530
  }) !== null;
515
531
  }
516
532
  /** Stops the verified Metro process tree without blocking on Windows taskkill. */
517
- async function killMetroTreeAsync(leader, processToken) {
533
+ async function killMetroTreeAsync(leader, processToken, operation) {
534
+ operation?.signal.throwIfAborted();
518
535
  if (!leader || leader === process.pid || (0, process_identity_exports.inspectProcessIdentity)({
519
536
  pid: leader,
520
537
  processToken
521
538
  }) !== "same") return false;
522
539
  try {
523
- return await signalProcessTreeAsync(leader, "SIGTERM", { group: true });
524
- } catch {
540
+ return await signalProcessTreeAsync(leader, "SIGTERM", {
541
+ group: true,
542
+ operation
543
+ });
544
+ } catch (error) {
545
+ if (error instanceof WorkspaceProcessCleanupError) throw error;
546
+ operation?.signal.throwIfAborted();
525
547
  return false;
526
548
  }
527
549
  }
528
550
  //#endregion
529
- export { reserveMetroPort as _, listeningPids as a, parseNetstatPids as c, processCwds as d, resolveProjectMetro as f, isMetroRunning as g, createPortProbe as h, killMetroTreeAsync as i, pidExists as l, signalProcessTreeAsync as m, isInsideProject as n, listeningPidsAsync as o, signalProcessTree as p, killMetroTree as r, listeningPidsByPort as s, NOT_OURS_FOREIGN_CWD as t, processCwd as u, PORT_INSPECTION_REMEDY as v, PortInspectionError as y };
551
+ export { PORT_INSPECTION_REMEDY as _, listeningPidsAsync as a, pidExists as c, resolveProjectMetro as d, signalProcessTree as f, reserveMetroPort as g, isMetroRunning as h, listeningPids as i, processCwd as l, createPortProbe as m, isInsideProject as n, listeningPidsByPort as o, signalProcessTreeAsync as p, killMetroTreeAsync as r, parseNetstatPids as s, NOT_OURS_FOREIGN_CWD as t, processCwds as u, PortInspectionError as v };