stim 1.20.2 → 1.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/README.md +88 -8
  2. package/dist/acquire-artifact-CD4lbiWE.mjs +153 -0
  3. package/dist/act-DHAw2A2S.mjs +2667 -0
  4. package/dist/activity-BzVfHSrY.mjs +1376 -0
  5. package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -65
  6. package/dist/{android-HqP1_vB_.mjs → android-BEJ8Jpl7.mjs} +2 -2
  7. package/dist/{android-DCKZrNvV.mjs → android-BLgbNqox.mjs} +128 -78
  8. package/dist/{android-Dlzxshgp.mjs → android-CV_GCELZ.mjs} +5 -5
  9. package/dist/{android-Mz_Inn3w.mjs → android-DUYkNF4u.mjs} +184 -102
  10. package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-Ct5b1xCK.mjs} +7 -6
  11. package/dist/android-cas-compiler.mjs +2 -2
  12. package/dist/android-project-BCAAmMwz.mjs +12 -0
  13. package/dist/api.d.mts +740 -8
  14. package/dist/api.mjs +585 -1
  15. package/dist/{artifact-HSwkIWEQ.mjs → artifact-B8T3S5gi.mjs} +223 -201
  16. package/dist/{artifact-D3czlUvT.mjs → artifact-DAuZ-FNU.mjs} +158 -148
  17. package/dist/{browser-web-CA-F1GQo.mjs → browser-web-QQzVjz3O.mjs} +26 -24
  18. package/dist/budget-Bs6SxxzO.mjs +9154 -0
  19. package/dist/{build-DYDbfkk5.mjs → build-CoPzQRNw.mjs} +144 -96
  20. package/dist/build-cache-DmyR9Zzc.mjs +602 -0
  21. package/dist/build-plan-CaFskB7_.mjs +188 -0
  22. package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DkkqguoK.mjs} +2 -2
  23. package/dist/cache-manifest.mjs +1 -1
  24. package/dist/{ccache-zdKiYQ3E.mjs → ccache-BJRZ9pG3.mjs} +10 -9
  25. package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
  26. package/dist/{chrome-BnzZMqsR.mjs → chrome-B6tfCta1.mjs} +7 -4
  27. package/dist/{cli-CLP3diBm.mjs → cli-0DYf8QhQ.mjs} +20 -20
  28. package/dist/cli.mjs +1 -1
  29. package/dist/client-B7QVOlCr.d.mts +253 -0
  30. package/dist/client-UXD70ZbM.mjs +1406 -0
  31. package/dist/collector-run.d.mts +4 -40
  32. package/dist/collector-run.mjs +9 -8
  33. package/dist/{command-output-BTy8hZ0F.mjs → command-output-B1UrjZHL.mjs} +1 -1
  34. package/dist/config-CYcBF478.mjs +949 -0
  35. package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-CqeBlrEn.mjs} +3 -3
  36. package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-BbKQW83h.mjs} +20 -5
  37. package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
  38. package/dist/{dev-client-DAWVIGBu.mjs → dev-client-UOeESKm6.mjs} +2 -2
  39. package/dist/device-DCxH7_By.mjs +1068 -0
  40. package/dist/{device-BECOiufl.mjs → device-ExJq8Ei7.mjs} +35 -35
  41. package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-CMlqEcvw.mjs} +43 -13
  42. package/dist/device-host-worker.mjs +65 -61
  43. package/dist/{device-ios-COSi6oS1.mjs → device-ios-DRUeKaFV.mjs} +48 -45
  44. package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
  45. package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-DMRpVX9a.mjs} +5 -5
  46. package/dist/doctor-BLHCYxzi.mjs +2 -0
  47. package/dist/{doctor-kfMBnUw6.mjs → doctor-DTvaDOda.mjs} +281 -317
  48. package/dist/{doctor-CB8oZKCk.mjs → doctor-Dhqebm0q.mjs} +183 -91
  49. package/dist/doctor-fingerprint.mjs +19 -0
  50. package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -21
  51. package/dist/{eas-build-JyfqyHfC.mjs → eas-build-BomfRnFT.mjs} +53 -20
  52. package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
  53. package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
  54. package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-Bf0rZvG9.mjs} +172 -82
  55. package/dist/exec-H20xSg2T.d.mts +65 -0
  56. package/dist/exec-_UbtCQcG.mjs +750 -0
  57. package/dist/gc-C-WwL0yi.mjs +3 -0
  58. package/dist/{gc-qWOMdnER.mjs → gc-_-dCXdyL.mjs} +584 -796
  59. package/dist/git-C3iTsJaZ.mjs +73 -0
  60. package/dist/{guide-G9cAbVAc.mjs → guide-Yqwt2bd6.mjs} +941 -269
  61. package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-Bw-honsd.mjs} +8 -6
  62. package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DB_gBPfY.mjs} +34 -19
  63. package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
  64. package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
  65. package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-QI141yKk.mjs} +21 -17
  66. package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-Ksyjgzq-.mjs} +30 -21
  67. package/dist/idle-BVeRGroT.d.mts +24 -0
  68. package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
  69. package/dist/{ios-BwVCF7oA.mjs → ios-CQ68hG9s.mjs} +8 -8
  70. package/dist/{ios-RkW4pnQf.mjs → ios-CpByZy12.mjs} +140 -80
  71. package/dist/{ios-device-B5veSDDQ.mjs → ios-device-CXGP1bsD.mjs} +1 -1
  72. package/dist/{ios-device-D7pi2Sca.mjs → ios-device-CwFMehUS.mjs} +51 -26
  73. package/dist/{ios-project-K9hY_Jab.mjs → ios-project-WuwwBdvW.mjs} +13 -13
  74. package/dist/{ios-nOLJGVdy.mjs → ios-qNJt4dFm.mjs} +1 -1
  75. package/dist/ios-signing-DTTIChGs.mjs +489 -0
  76. package/dist/{ios-state-CBLe1xYw.mjs → ios-state-DvFX-K_l.mjs} +1 -1
  77. package/dist/{ios-Ce7bc7br.mjs → ios-ubFsBzwq.mjs} +129 -86
  78. package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Cc1dttps.mjs} +53 -26
  79. package/dist/{launch-F4sOqAhB.mjs → launch-CD1yVc7U.mjs} +91 -90
  80. package/dist/{launch-C3qJ6Agb.mjs → launch-Zq2mOSDy.mjs} +82 -541
  81. package/dist/logs-BS00Anxf.mjs +352 -0
  82. package/dist/logs-CMm05HxN.mjs +255 -0
  83. package/dist/{macos-D7uDvO-z.mjs → macos-B65--pPd.mjs} +1 -1
  84. package/dist/{macos-Ch5VJmcS.mjs → macos-C-0qJ6zq.mjs} +225 -212
  85. package/dist/macos-run.mjs +1 -1
  86. package/dist/maintenance-run.mjs +122 -247
  87. package/dist/{metro-DnCEjCxs.mjs → metro-DEXpIhHC.mjs} +67 -12
  88. package/dist/{metro-gateway-CX9Xlkq2.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
  89. package/dist/{named-ports-4WopRPg-.mjs → named-ports-BWTzt6mu.mjs} +8 -63
  90. package/dist/native-android-JACyjTZs.mjs +844 -0
  91. package/dist/{native-gradle-inputs-BsLRrl7u.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -140
  92. package/dist/native-inputs-TRTTTRxt.mjs +91 -0
  93. package/dist/native-run-DY_RLx3C.mjs +277 -0
  94. package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-Dg1Q7tfF.mjs} +9 -8
  95. package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-CB2iQeWq.mjs} +27 -18
  96. package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-CXX39F7o.mjs} +96 -47
  97. package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
  98. package/dist/offload-worker.d.mts +1 -46
  99. package/dist/offload-worker.mjs +197 -66
  100. package/dist/{ownership-DCtw_2IA.mjs → ownership-DEmM5vhh.mjs} +3 -3
  101. package/dist/{page-DRHy329N.mjs → page-CPaHeYqj.mjs} +7 -4
  102. package/dist/paths-BsJMoPP2.mjs +12 -0
  103. package/dist/paths-DQtTgsBf.mjs +42 -0
  104. package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BqGbTa61.mjs} +5 -5
  105. package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
  106. package/dist/{ports-DdSUicVo.mjs → ports-D-MmCTdv.mjs} +3 -3
  107. package/dist/prebuild-uD_ipCxF.mjs +449 -0
  108. package/dist/{project-_phNIJfs.mjs → project-BZNjmW_8.mjs} +65 -37
  109. package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-Lfetn8Kr.mjs} +2 -2
  110. package/dist/pull-request-zjCSAryH.d.mts +120 -0
  111. package/dist/pull-requests.d.mts +1 -119
  112. package/dist/pull-requests.mjs +1 -1
  113. package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-DuzH0cn3.mjs} +74 -48
  114. package/dist/{gradle-DSrXb6lG.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
  115. package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
  116. package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
  117. package/dist/{recordings-D0d5aQt0.mjs → recordings-DYteQSu4.mjs} +12 -9
  118. package/dist/{reload-C8JhxjSh.mjs → reload-CmTRFJaX.mjs} +93 -47
  119. package/dist/reload-DzjSl5P_.mjs +2 -0
  120. package/dist/{remote-BiR6aYjy.mjs → remote-ByYkXdGD.mjs} +15 -10
  121. package/dist/result-DNiS-tTP.mjs +434 -0
  122. package/dist/{run-BtPgpKks.mjs → run-D23HmJMs.mjs} +4 -5
  123. package/dist/selection-CSl9i5qU.mjs +619 -0
  124. package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CxTrvDg8.mjs} +3 -4
  125. package/dist/{server-command-CTtCkmcQ.mjs → server-command-CtzloH3v.mjs} +14 -7
  126. package/dist/server-expo-C-90EhcG.mjs +2 -0
  127. package/dist/{server-expo-DsguMGUF.mjs → server-expo-DT_F_uVI.mjs} +50 -9
  128. package/dist/{settings-B717odTD.mjs → settings-CsJDEXgK.mjs} +234 -24
  129. package/dist/{settings-vk3mJGSm.d.mts → settings-DkdmlelE.d.mts} +6 -4
  130. package/dist/settings-T1gtc3bf.mjs +114 -0
  131. package/dist/settings-write-HyVZ8eQ8.mjs +359 -0
  132. package/dist/settings.schema.json +163 -16
  133. package/dist/{simslim-CCr3rE-A.mjs → simslim-Cgk17SXV.mjs} +14 -12
  134. package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-DF8VfT64.mjs} +15 -20
  135. package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
  136. package/dist/stage-BIS0ydsV.mjs +183 -0
  137. package/dist/{start-BWqzODpb.mjs → start-7lpH7hmN.mjs} +63 -44
  138. package/dist/{start-TXeMmmO2.mjs → start-RChynRDp.mjs} +1 -1
  139. package/dist/{state-D1Icyjlu.mjs → state-C4ZtUisW.mjs} +40 -13
  140. package/dist/{state-CG_OFoaA.mjs → state-XMziexv2.mjs} +3 -2
  141. package/dist/{stats-BoY5sEPU.mjs → stats-53T7OTb9.mjs} +7 -13
  142. package/dist/stats-report-BFfMpWWF.mjs +16 -0
  143. package/dist/{status-WgFbkRzj.mjs → status-BL7jVyAB.mjs} +535 -447
  144. package/dist/status-CSi6tlRq.mjs +2 -0
  145. package/dist/{status-BTA7kKiQ.mjs → status-DqEUSSxs.mjs} +6 -4
  146. package/dist/{status-watch-C23ILtf9.mjs → status-watch-GDCfqpTE.mjs} +187 -22
  147. package/dist/status-worker.d.mts +1 -0
  148. package/dist/status-worker.mjs +19 -0
  149. package/dist/stim-desktop-C12we7lz.mjs +112 -0
  150. package/dist/{stop-DR6VoDIk.mjs → stop-Bk_1qiV6.mjs} +2 -2
  151. package/dist/{stop-BNmBMi1F.mjs → stop-CPzlM1L-.mjs} +138 -98
  152. package/dist/{stop-DPEhunlw.mjs → stop-D7h6jAXQ.mjs} +11 -10
  153. package/dist/supervisor-run.d.mts +8 -17
  154. package/dist/supervisor-run.mjs +63 -27
  155. package/dist/{support-DMTqj3Hm.mjs → support-67vraa1Q.mjs} +18 -11
  156. package/dist/{support-CwjbFs9H.mjs → support-Dlu37g6H.mjs} +12 -12
  157. package/dist/{swiftpm-macos-DRNVJWlb.mjs → swiftpm-macos-p8WZbxKU.mjs} +35 -24
  158. package/dist/toolchain-DhKwp9iI.mjs +2 -0
  159. package/dist/toolchain-Hp9sCpK4.mjs +873 -0
  160. package/dist/{trigger-CigAYjeL.mjs → trigger-BAahxUPq.mjs} +20 -5
  161. package/dist/trigger-Bf3uDcpv.mjs +2 -0
  162. package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-BHX5r0Ei.mjs} +250 -156
  163. package/dist/{web-BDBMxDpx.mjs → web-CJmIj6AI.mjs} +18 -13
  164. package/dist/web-DknQETPs.mjs +2 -0
  165. package/dist/web-run.mjs +11 -12
  166. package/dist/windows-report.d.mts +1 -0
  167. package/dist/windows-report.mjs +18 -0
  168. package/dist/windows-report.ps1 +43 -0
  169. package/dist/workspace-process-lock-1_1OoVW5.mjs +57 -0
  170. package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-Cjuigeeu.mjs} +62 -58
  171. package/dist/{workspaces-C36s2jb9.mjs → workspaces-BccMFmGQ.mjs} +1188 -1079
  172. package/dist/worktree-CK2MpJW5.mjs +2 -0
  173. package/dist/{worktree-CgvJYJ-Q.mjs → worktree-DQ6Zi2Mv.mjs} +304 -53
  174. package/dist/xcode-Zlx3qjEs.mjs +896 -0
  175. package/package.json +7 -5
  176. package/shim/android-optimizations.gradle +7 -5
  177. package/dist/activity-BSV745Kz.mjs +0 -629
  178. package/dist/api-qvOzWyfO.mjs +0 -154
  179. package/dist/api-run.mjs +0 -294
  180. package/dist/app-install-BIKtMfPq.mjs +0 -896
  181. package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
  182. package/dist/budget-f7516Zk0.mjs +0 -4106
  183. package/dist/build-facts-DcLv2HSd.d.mts +0 -111
  184. package/dist/cancellation-C_22VQTH.mjs +0 -24
  185. package/dist/client-qQAaXSUs.mjs +0 -1771
  186. package/dist/config-BYDxlMY3.mjs +0 -562
  187. package/dist/device-DuiPJQSn.mjs +0 -290
  188. package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
  189. package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
  190. package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
  191. package/dist/exec-DqKo9GKJ.mjs +0 -268
  192. package/dist/git-DDfFzkMm.mjs +0 -45
  193. package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
  194. package/dist/logs-BGrEUaEs.mjs +0 -383
  195. package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
  196. package/dist/native-android-D5qc3-_v.mjs +0 -226
  197. package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
  198. package/dist/plan-C4TjdPsR.mjs +0 -260
  199. package/dist/prebuild-DYbucPXy.mjs +0 -212
  200. package/dist/preview-78a9kR_-.mjs +0 -1011
  201. package/dist/react-native-build-CtCccJtb.mjs +0 -239
  202. package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
  203. package/dist/remote-cache-OyOyVIS3.mjs +0 -526
  204. package/dist/result-CaJg5Iat.mjs +0 -186
  205. package/dist/server-expo-Bigriskl.mjs +0 -2
  206. package/dist/settings-BORNaaCO.mjs +0 -402
  207. package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
  208. package/dist/stage-KNTQopqv.mjs +0 -157
  209. package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
  210. package/dist/tailnet-Dh-qiYzG.mjs +0 -265
  211. package/dist/toolchain-BFkAcstd.mjs +0 -2
  212. package/dist/toolchain-DxSsNssu.mjs +0 -1657
  213. package/dist/trigger-9_USgmxz.mjs +0 -2
  214. package/dist/web-Dq-i3wzJ.mjs +0 -2
  215. package/dist/worktree-DpLdCHga.mjs +0 -2
  216. package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
  217. package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
package/dist/web-run.mjs CHANGED
@@ -1,19 +1,18 @@
1
- import { j as ownership_claim_exports, k as process_identity_exports } from "./config-BYDxlMY3.mjs";
2
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
3
- import { r as recordCreatedDevice } from "./created-devices-Dzd5C2LF.mjs";
4
- import { d as signalProcessTree } from "./metro-DnCEjCxs.mjs";
5
- import { t as cancellableSleep } from "./cancellation-C_22VQTH.mjs";
6
- import { r as createNdjsonWriter } from "./ndjson-GOnbyvso.mjs";
7
- import { t as relaunchWithLogFile } from "./detached-entry-B9C_zeQC.mjs";
8
- import { _ as removeSingletonFiles, c as webClaimRoot, d as webLogFile, f as webProfileDir, g as liveProfileHolder, h as chromeProcessState, i as clearWebRecord, l as webDir, m as writeWebRecord, n as browserLogFile, s as updateWebRecord } from "./state-D1Icyjlu.mjs";
9
- import { c as probeWebDrivers } from "./activity-BSV745Kz.mjs";
10
- import { t as connectOwnedBrowser } from "./cdp-Dq_ypAlJ.mjs";
11
- import { i as chromeArgs, n as DESKTOP_PAGE, r as PHONE_SCREEN } from "./chrome-BnzZMqsR.mjs";
1
+ import { f as ownership_claim_exports, p as process_identity_exports, t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
+ import { Qt as cancellableSleep } from "./settings-CsJDEXgK.mjs";
3
+ import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
4
+ import { p as signalProcessTree } from "./metro-DEXpIhHC.mjs";
5
+ import { c as webClaimRoot, f as webLogFile, g as chromeProcessState, h as writeWebRecord, i as clearWebRecord, l as webDir, n as browserLogFile, p as webProfileDir, s as updateWebRecord, v as liveProfileHolder, y as removeSingletonFiles } from "./state-C4ZtUisW.mjs";
6
+ import { l as probeWebDrivers } from "./activity-BzVfHSrY.mjs";
7
+ import { r as recordCreatedDevice } from "./created-devices-CqeBlrEn.mjs";
8
+ import { t as connectOwnedBrowser } from "./cdp-CWmIUMbw.mjs";
9
+ import { i as chromeArgs, n as DESKTOP_PAGE, r as PHONE_SCREEN } from "./chrome-B6tfCta1.mjs";
10
+ import { t as relaunchWithLogFile } from "./detached-entry-DFRyG1_o.mjs";
12
11
  import { existsSync, mkdirSync, openSync, realpathSync } from "node:fs";
13
12
  import { isAbsolute, resolve } from "node:path";
13
+ import { LOG_ROTATE_BYTES } from "@stim-cli/core";
14
14
  import { WEB_VIEWPORTS } from "@stim-cli/core/state";
15
15
  import { fileURLToPath } from "node:url";
16
- import { LOG_ROTATE_BYTES } from "@stim-cli/core";
17
16
  //#region src/web/events.ts
18
17
  const MAX_FRAMES = 20;
19
18
  const CONSOLE_LEVELS = {
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,18 @@
1
+ import { t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
+ //#region bin/windows-report.ts
3
+ const request = JSON.parse(process.env.STIM_REPORT_CHILD ?? "");
4
+ const env = { ...process.env };
5
+ delete env.STIM_REPORT_CHILD;
6
+ const child = getExecutor().spawn(request.file, request.args, {
7
+ stdio: "inherit",
8
+ env
9
+ });
10
+ child.once("error", (error) => {
11
+ console.error(error.message);
12
+ process.exitCode = 1;
13
+ });
14
+ child.once("close", (status) => {
15
+ process.exitCode = status ?? 1;
16
+ });
17
+ //#endregion
18
+ export {};
@@ -0,0 +1,43 @@
1
+ $ErrorActionPreference = 'Stop'
2
+ $assembly = [AppDomain]::CurrentDomain.DefineDynamicAssembly(
3
+ [Reflection.AssemblyName]::new('StimReportJob'), [Reflection.Emit.AssemblyBuilderAccess]::Run)
4
+ $module = $assembly.DefineDynamicModule('StimReportJob')
5
+ $builder = $module.DefineType('StimReportNative', [Reflection.TypeAttributes]'Public, Sealed, Abstract')
6
+ function Define-Native([string]$name, [type]$returns, [type[]]$parameters) {
7
+ $method = $builder.DefinePInvokeMethod($name, 'kernel32.dll',
8
+ [Reflection.MethodAttributes]'Public, Static, PinvokeImpl',
9
+ [Reflection.CallingConventions]::Standard, $returns, $parameters,
10
+ [Runtime.InteropServices.CallingConvention]::Winapi, [Runtime.InteropServices.CharSet]::Unicode)
11
+ $method.SetImplementationFlags([Reflection.MethodImplAttributes]::PreserveSig)
12
+ }
13
+ Define-Native 'CreateJobObjectW' ([IntPtr]) ([type[]]@([IntPtr], [string]))
14
+ Define-Native 'SetInformationJobObject' ([bool]) ([type[]]@([IntPtr], [int], [IntPtr], [uint32]))
15
+ Define-Native 'AssignProcessToJobObject' ([bool]) ([type[]]@([IntPtr], [IntPtr]))
16
+ $native = $builder.CreateType()
17
+ $job = $native::CreateJobObjectW([IntPtr]::Zero, $null)
18
+ if ($job -eq [IntPtr]::Zero) { throw 'Could not create the report process job.' }
19
+ # Win32 JOBOBJECT_EXTENDED_LIMIT_INFORMATION is 144 bytes on 64-bit and 112 on 32-bit;
20
+ # its BasicLimitInformation.LimitFlags field is at offset 16 on both.
21
+ # https://learn.microsoft.com/windows/win32/api/winnt/ns-winnt-jobobject_extended_limit_information
22
+ $size = if ([IntPtr]::Size -eq 8) { 144 } else { 112 }
23
+ $limits = [Runtime.InteropServices.Marshal]::AllocHGlobal($size)
24
+ try {
25
+ [Runtime.InteropServices.Marshal]::Copy([byte[]]::new($size), 0, $limits, $size)
26
+ [Runtime.InteropServices.Marshal]::WriteInt32($limits, 16, 0x2000)
27
+ if (!$native::SetInformationJobObject($job, 9, $limits, $size) -or
28
+ !$native::AssignProcessToJobObject($job, [IntPtr](-1))) {
29
+ throw 'Could not contain the report process job.'
30
+ }
31
+ } finally {
32
+ [Runtime.InteropServices.Marshal]::FreeHGlobal($limits)
33
+ }
34
+ # Child jobs inherit containment; closing the helper's sole job handle kills descendants.
35
+ # https://learn.microsoft.com/windows/win32/procthread/job-objects
36
+ $request = $env:STIM_REPORT_CHILD | ConvertFrom-Json
37
+ $start = [System.Diagnostics.ProcessStartInfo]::new()
38
+ $start.FileName = $request.node
39
+ $start.Arguments = '"' + $request.entry + '"'
40
+ $start.UseShellExecute = $false
41
+ $child = [System.Diagnostics.Process]::Start($start)
42
+ $child.WaitForExit()
43
+ [System.Environment]::Exit($child.ExitCode)
@@ -0,0 +1,57 @@
1
+ import { c as stopDeclaringSpawnsOn, f as ownership_claim_exports, i as declareSpawnsOn } from "./exec-_UbtCQcG.mjs";
2
+ import { join } from "node:path";
3
+ import { setTimeout } from "node:timers/promises";
4
+ //#region src/engine/workspace-process-lock.ts
5
+ const DEFAULT_WAIT_MS = 6e4;
6
+ const POLL_MS = 25;
7
+ function workspaceProcessLockError(err) {
8
+ const code = err?.code;
9
+ if (code === "STIM_LOCK_REFUSED") return "refused";
10
+ if (code === "STIM_LOCK_TIMEOUT") return "timeout";
11
+ return null;
12
+ }
13
+ function workspaceProcessLockPath(root, name, external) {
14
+ return external ? join(root, `${name}.lock`) : join(root, ".stim", `${name}.lock`);
15
+ }
16
+ async function withWorkspaceProcessLock(root, name, fn, { now = Date.now, signal, sleep = (ms) => setTimeout(ms, void 0, { signal }), waitMs = DEFAULT_WAIT_MS, ownerPurpose, details = {}, onHeld, rejectOwnerPurposes = [], external = false, declareSpawnsFor } = {}) {
17
+ const path = workspaceProcessLockPath(root, name, external);
18
+ const deadline = now() + waitMs;
19
+ for (;;) {
20
+ signal?.throwIfAborted();
21
+ const attempt = (0, ownership_claim_exports.tryAcquireClaim)({
22
+ root: path,
23
+ mode: "exclusive",
24
+ label: `${name} lock`,
25
+ details: ownerPurpose ? {
26
+ ...details,
27
+ purpose: ownerPurpose
28
+ } : details
29
+ });
30
+ if (attempt.pending) (0, ownership_claim_exports.releaseClaim)(attempt.pending);
31
+ if (attempt.acquired) {
32
+ if (declareSpawnsFor) declareSpawnsOn(declareSpawnsFor, attempt.acquired);
33
+ try {
34
+ return await fn(attempt.acquired);
35
+ } finally {
36
+ if (declareSpawnsFor) stopDeclaringSpawnsOn(declareSpawnsFor, attempt.acquired);
37
+ (0, ownership_claim_exports.releaseClaim)(attempt.acquired);
38
+ }
39
+ }
40
+ const holder = attempt.held ?? attempt.waitingFor?.[0];
41
+ const purpose = holder?.details.purpose;
42
+ if (typeof purpose === "string" && rejectOwnerPurposes.includes(purpose)) {
43
+ const error = /* @__PURE__ */ new Error(`The ${name} lock at ${path} is held for ${purpose}.`);
44
+ error.code = "STIM_LOCK_REFUSED";
45
+ throw error;
46
+ }
47
+ if (holder && onHeld) await onHeld(holder);
48
+ if (now() >= deadline) {
49
+ const error = /* @__PURE__ */ new Error(`Timed out waiting for the ${name} lock at ${path}.`);
50
+ error.code = "STIM_LOCK_TIMEOUT";
51
+ throw error;
52
+ }
53
+ await sleep(POLL_MS);
54
+ }
55
+ }
56
+ //#endregion
57
+ export { workspaceProcessLockError as n, workspaceProcessLockPath as r, withWorkspaceProcessLock as t };
@@ -1,43 +1,12 @@
1
- import { O as writeConfigSetting, k as process_identity_exports, m as getProjectSettings } from "./config-BYDxlMY3.mjs";
2
- import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
3
- import { it as workspaceHiddenSetting } from "./settings-B717odTD.mjs";
1
+ import { p as process_identity_exports, t as getExecutor } from "./exec-_UbtCQcG.mjs";
2
+ import { _ as workspaceStateLock, g as workspaceStateFile$1, n as ensureWorkspaceStorage, r as ensureWorkspaceStorageAsync, v as withDirLock, y as withDirLockAsync } from "./paths-DQtTgsBf.mjs";
3
+ import { A as writeConfigSettingAsync, k as writeConfigSetting, m as getProjectSettings } from "./config-CYcBF478.mjs";
4
+ import { ot as workspaceHiddenSetting } from "./settings-CsJDEXgK.mjs";
4
5
  import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
5
- import { dirname, isAbsolute, join, relative } from "node:path";
6
- import { join as join$1, resolve as resolve$1 } from "path";
7
- import { WORKSPACE_AGENT_KEY, emulatorLogFile, isJsonObject, readJsonObject, readWorkspaceState, readWorkspaceState as readWorkspaceState$1, sharedCcache as sharedCcache$1, sharedCompilationCache as sharedCompilationCache$1, supervisorLogFile, supervisorPidFile, workspaceAgentDeviceDir, workspaceDerivedData, workspaceLastUsed, workspaceLogErrorIndex, workspaceLogsDir as workspaceLogsDir$1, workspaceMetadataFile, workspaceStateFile, workspaceStateLock } from "@stim-cli/core/state";
8
- import { buildCacheRoot as sharedBuildCache, ensurePrivateDir, withDirLock as withDirLock$1, workspaceId as workspaceId$1, workspaceName as workspaceName$1, workspaceStateDir as workspaceDir } from "@stim-cli/core";
9
6
  import { homedir } from "node:os";
7
+ import { dirname, isAbsolute, join, relative } from "node:path";
8
+ import { WORKSPACE_AGENT_KEY, isJsonObject, readWorkspaceState, readWorkspaceState as readWorkspaceState$1, workspaceLastUsed } from "@stim-cli/core/state";
10
9
  import { readFile, readdir } from "node:fs/promises";
11
- //#region src/workspace/paths.ts
12
- function ensureWorkspaceStorage(projectRoot) {
13
- const canonicalRoot = resolve$1(projectRoot);
14
- const dir = workspaceDir(canonicalRoot);
15
- const file = workspaceMetadataFile(canonicalRoot);
16
- ensurePrivateDir(dir);
17
- return withDirLock$1(join$1(dir, "metadata.lock"), () => {
18
- if (!existsSync(file)) {
19
- const metadata = {
20
- projectRoot: canonicalRoot,
21
- workspace: workspaceName$1(canonicalRoot),
22
- version: 1
23
- };
24
- const tmp = `${file}.${process.pid}.${Math.random().toString(36).slice(2)}.tmp`;
25
- writeFileSync(tmp, `${JSON.stringify(metadata, null, 2)}\n`);
26
- try {
27
- renameSync(tmp, file);
28
- } catch (error) {
29
- rmSync(tmp, { force: true });
30
- throw error;
31
- }
32
- return dir;
33
- }
34
- if (readJsonObject(file)?.projectRoot === canonicalRoot) return dir;
35
- const error = /* @__PURE__ */ new Error(`Stim workspace collision at ${dir}: its workspace.json does not belong to ${canonicalRoot}.`);
36
- error.code = "STIM_WORKSPACE_COLLISION";
37
- throw error;
38
- });
39
- }
40
- //#endregion
41
10
  //#region src/agent-sessions.ts
42
11
  const TITLE_MAX_LENGTH = 120;
43
12
  const SESSION_ID = /^[A-Za-z0-9._:-]{1,128}$/;
@@ -285,12 +254,21 @@ function attributeAgentSessions(workspaces, sessions, now) {
285
254
  //#endregion
286
255
  //#region src/workspace/workspace-state.ts
287
256
  function withWorkspaceStateLock(root, fn) {
288
- const file = workspaceStateFile(root);
289
- return withDirLock$1(workspaceStateLock(root), fn, { ensureParent: () => {
257
+ const file = workspaceStateFile$1(root);
258
+ return withDirLock(workspaceStateLock(root), fn, { ensureParent: () => {
290
259
  ensureWorkspaceStorage(root);
291
260
  mkdirSync(dirname(file), { recursive: true });
292
261
  } });
293
262
  }
263
+ /** Waits for the workspace state lock asynchronously; the transaction remains synchronous and reentrant. */
264
+ async function withWorkspaceStateLockAsync(root, fn, signal) {
265
+ await ensureWorkspaceStorageAsync(root, signal);
266
+ const file = workspaceStateFile$1(root);
267
+ return withDirLockAsync(workspaceStateLock(root), fn, {
268
+ ensureParent: () => mkdirSync(dirname(file), { recursive: true }),
269
+ signal
270
+ });
271
+ }
294
272
  function writeWorkspaceState(root, patch) {
295
273
  return updateWorkspaceState(root, (state) => ({
296
274
  ...state,
@@ -300,8 +278,12 @@ function writeWorkspaceState(root, patch) {
300
278
  function updateWorkspaceState(root, update) {
301
279
  return withWorkspaceStateLock(root, () => replaceWorkspaceState(root, update(readWorkspaceState(root) ?? {})));
302
280
  }
281
+ /** Updates workspace state atomically after asynchronously acquiring its lock. */
282
+ function updateWorkspaceStateAsync(root, update, signal) {
283
+ return withWorkspaceStateLockAsync(root, () => replaceWorkspaceState(root, update(readWorkspaceState(root) ?? {})), signal);
284
+ }
303
285
  function replaceWorkspaceState(root, state) {
304
- const file = workspaceStateFile(root);
286
+ const file = workspaceStateFile$1(root);
305
287
  mkdirSync(dirname(file), { recursive: true });
306
288
  const tmp = `${file}.tmp-${process.pid}`;
307
289
  writeFileSync(tmp, `${JSON.stringify(state, null, 2)}\n`, { mode: 384 });
@@ -309,10 +291,10 @@ function replaceWorkspaceState(root, state) {
309
291
  return state;
310
292
  }
311
293
  function clearWorkspaceStateKeys(root, keys) {
312
- if (!existsSync(workspaceStateFile(root))) return;
294
+ if (!existsSync(workspaceStateFile$1(root))) return;
313
295
  withWorkspaceStateLock(root, () => {
314
296
  const state = readWorkspaceState(root);
315
- const file = workspaceStateFile(root);
297
+ const file = workspaceStateFile$1(root);
316
298
  if (!state) {
317
299
  try {
318
300
  rmSync(file, { force: true });
@@ -339,7 +321,7 @@ function clearWorkspaceStateKey(root, key, shouldClear) {
339
321
  if (!state || !(key in state)) return true;
340
322
  if (!shouldClear(state[key])) return false;
341
323
  delete state[key];
342
- const file = workspaceStateFile(root);
324
+ const file = workspaceStateFile$1(root);
343
325
  if (Object.keys(state).length === 0) {
344
326
  try {
345
327
  rmSync(file, { force: true });
@@ -354,21 +336,9 @@ function clearWorkspaceStateKey(root, key, shouldClear) {
354
336
  * Records a command's use of the workspace, and the agent session whose shell ran it when there is one, and
355
337
  * clears `workspace.hidden`.
356
338
  */
357
- function recordWorkspaceUse(root, now = /* @__PURE__ */ new Date(), env = process.env) {
358
- const agent = agentFromEnv(env);
359
- let cwd = process.cwd();
339
+ function recordWorkspaceUse(root, now = /* @__PURE__ */ new Date(), env = process.env, commandCwd = process.cwd()) {
360
340
  try {
361
- cwd = realpathSync(cwd);
362
- } catch {}
363
- try {
364
- writeWorkspaceState(root, {
365
- lastUsedAt: now.toISOString(),
366
- ...agent ? { [WORKSPACE_AGENT_KEY]: {
367
- ...agent,
368
- cwd,
369
- lastActiveAt: now.toISOString()
370
- } } : {}
371
- });
341
+ writeWorkspaceState(root, workspaceUsePatch(now, env, commandCwd));
372
342
  } catch {}
373
343
  try {
374
344
  if (workspaceHiddenSetting(getProjectSettings(root))) writeConfigSetting({
@@ -377,5 +347,39 @@ function recordWorkspaceUse(root, now = /* @__PURE__ */ new Date(), env = proces
377
347
  }, "workspace.hidden", void 0);
378
348
  } catch {}
379
349
  }
350
+ /** Records workspace use and clears workspace.hidden after asynchronously acquiring the state and config locks. */
351
+ async function recordWorkspaceUseAsync(root, now = /* @__PURE__ */ new Date(), env = process.env, commandCwd = process.cwd(), signal) {
352
+ signal?.throwIfAborted();
353
+ try {
354
+ const patch = workspaceUsePatch(now, env, commandCwd);
355
+ await updateWorkspaceStateAsync(root, (state) => ({
356
+ ...state,
357
+ ...patch
358
+ }), signal);
359
+ } catch {}
360
+ signal?.throwIfAborted();
361
+ try {
362
+ if (workspaceHiddenSetting(getProjectSettings(root))) await writeConfigSettingAsync({
363
+ scope: "workspace",
364
+ projectPath: root
365
+ }, "workspace.hidden", void 0, signal);
366
+ } catch {}
367
+ signal?.throwIfAborted();
368
+ }
369
+ function workspaceUsePatch(now, env, commandCwd) {
370
+ const agent = agentFromEnv(env);
371
+ let cwd = commandCwd;
372
+ try {
373
+ cwd = realpathSync(cwd);
374
+ } catch {}
375
+ return {
376
+ lastUsedAt: now.toISOString(),
377
+ ...agent ? { [WORKSPACE_AGENT_KEY]: {
378
+ ...agent,
379
+ cwd,
380
+ lastActiveAt: now.toISOString()
381
+ } } : {}
382
+ };
383
+ }
380
384
  //#endregion
381
- export { workspaceLogErrorIndex as C, withDirLock$1 as D, workspaceStateFile as E, workspaceId$1 as S, workspaceName$1 as T, supervisorLogFile as _, updateWorkspaceState as a, workspaceDerivedData as b, writeWorkspaceState as c, discoverAgentSessions as d, emulatorLogFile as f, sharedCompilationCache$1 as g, sharedCcache$1 as h, recordWorkspaceUse as i, agentKey as l, sharedBuildCache as m, clearWorkspaceStateKeys as n, withWorkspaceStateLock as o, ensureWorkspaceStorage as p, readWorkspaceState$1 as r, workspaceLastUsed as s, clearWorkspaceStateKey as t, attributeAgentSessions as u, supervisorPidFile as v, workspaceLogsDir$1 as w, workspaceDir as x, workspaceAgentDeviceDir as y };
385
+ export { recordWorkspaceUseAsync as a, withWorkspaceStateLock as c, writeWorkspaceState as d, agentKey as f, recordWorkspaceUse as i, withWorkspaceStateLockAsync as l, discoverAgentSessions as m, clearWorkspaceStateKeys as n, updateWorkspaceState as o, attributeAgentSessions as p, readWorkspaceState$1 as r, updateWorkspaceStateAsync as s, clearWorkspaceStateKey as t, workspaceLastUsed as u };