stim 1.26.0 → 1.28.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 (172) hide show
  1. package/dist/{acquire-artifact-DVsvSwf7.mjs → acquire-artifact-CKByBnTD.mjs} +2 -2
  2. package/dist/{act-C-BqJEpu.mjs → act-8iswyfRa.mjs} +319 -126
  3. package/dist/{activity-Lnb_EoRY.mjs → activity-DRMg4_mD.mjs} +6 -6
  4. package/dist/{agent-device-usage-output-DbXy5tg8.mjs → agent-device-usage-output-tE90fDdo.mjs} +5 -5
  5. package/dist/{android-CiNQw3kq.mjs → android-CHmSU4B4.mjs} +101 -45
  6. package/dist/{android-DTAcRwBC.mjs → android-CsPs-7Mg.mjs} +23 -18
  7. package/dist/{android-B5P81yI-.mjs → android-D577ApKG.mjs} +37 -15
  8. package/dist/{android-CSbLRD53.mjs → android-YWCbmkVK.mjs} +5 -5
  9. package/dist/{android-cas-BTVhZ0Qs.mjs → android-cas-_aDifWW0.mjs} +4 -4
  10. package/dist/android-cas-compiler.mjs +1 -1
  11. package/dist/api.d.mts +14 -4
  12. package/dist/api.mjs +39 -29
  13. package/dist/{apk-signed-tail-B46U9hXc.mjs → apk-signed-tail-CQbwM0qO.mjs} +2 -2
  14. package/dist/{artifact-CsAP6AGK.mjs → artifact-DYtHjxsn.mjs} +19 -24
  15. package/dist/{artifact-BxREhAaV.mjs → artifact-bFkfD3vf.mjs} +18 -23
  16. package/dist/{artifact-platform-CMRc0M_r.mjs → artifact-platform-BO2Uvk_A.mjs} +1 -1
  17. package/dist/auto-placement-BVqs8AJi.mjs +350 -0
  18. package/dist/{browser-web-rYPyqhTf.mjs → browser-web-BUaLcafY.mjs} +16 -16
  19. package/dist/{build-DPhApsjV.mjs → build-cQURy_KW.mjs} +35 -31
  20. package/dist/{build-cache-DrXNCy3T.mjs → build-cache-CZULpXVl.mjs} +43 -21
  21. package/dist/{build-plan-DrMMdayj.mjs → build-plan-CxoYfxsc.mjs} +7 -6
  22. package/dist/{cache-manifest-BEZ9Bpl1.mjs → cache-manifest-DEjqGGat.mjs} +1 -1
  23. package/dist/cache-manifest.mjs +1 -1
  24. package/dist/{budget-k2mZGvvk.mjs → ccache-Bm_A1xX9.mjs} +562 -1604
  25. package/dist/{cdp-BG3FJCCx.mjs → cdp-C3svvXiE.mjs} +1 -1
  26. package/dist/{chrome-BvV8ssI3.mjs → chrome-DyDWurWG.mjs} +1 -1
  27. package/dist/{cli-BBKFGOFl.mjs → cli-CpbaLDa7.mjs} +24 -23
  28. package/dist/cli.mjs +1 -1
  29. package/dist/{client-D9CaRks-.mjs → client-YxCer6ab.mjs} +84 -65
  30. package/dist/collector-run.d.mts +10 -9
  31. package/dist/collector-run.mjs +42 -27
  32. package/dist/{command-output-BF5AR2dL.mjs → command-output-C8R1KIvi.mjs} +1 -1
  33. package/dist/{config-BktkY_zC.mjs → config-Cn94Jc0g.mjs} +23 -4
  34. package/dist/{dependencies-Dw6wfQdv.mjs → dependencies-DKeMzwXY.mjs} +108 -60
  35. package/dist/{dependency-state-DFB41vfr.mjs → dependency-state-CojA2o0t.mjs} +14 -7
  36. package/dist/{detached-entry-KmieOKgN.mjs → detached-entry-BPlSaCwC.mjs} +1 -1
  37. package/dist/{dev-client-DXR_tPVY.mjs → dev-client-D-BW5uiq.mjs} +2 -2
  38. package/dist/{device-BK-zwyd_.mjs → device-CgXfbcz5.mjs} +25 -24
  39. package/dist/{device-capacity-DCSvUF0l.mjs → device-capacity-Cd8lMSn3.mjs} +175 -22
  40. package/dist/{device-BcYeHSFu.mjs → device-eeK95Lir.mjs} +16 -16
  41. package/dist/device-host-worker.mjs +22 -20
  42. package/dist/{device-ios-BLGfXQeK.mjs → device-ios-Cc9ulihb.mjs} +251 -23
  43. package/dist/{device-lease-run-BmvIl7bI.mjs → device-lease-run-Mtzp4THX.mjs} +5 -5
  44. package/dist/{device-pool-Dluix4H3.mjs → device-pool-eRz6DtCg.mjs} +3 -3
  45. package/dist/{doctor-Bhg1ii70.mjs → doctor-Bz_ouYAW.mjs} +28 -16
  46. package/dist/{doctor-Cp-BhzTS.mjs → doctor-C2QyhejJ.mjs} +1 -1
  47. package/dist/{doctor-fingerprint-D3a04Mhu.mjs → doctor-fingerprint-o7ZI9YLn.mjs} +1 -1
  48. package/dist/doctor-fingerprint.mjs +1 -1
  49. package/dist/{doctor-watchman-BStK05nt.mjs → doctor-watchman-BTW82PDC.mjs} +5 -5
  50. package/dist/{doctor-OnwP94ne.mjs → doctor-xf7ht-5n.mjs} +76 -32
  51. package/dist/{eas-build-Dsj93iM9.mjs → eas-build-Dm6q68QY.mjs} +4 -4
  52. package/dist/eas-fallback-DajNpxf-.mjs +87 -0
  53. package/dist/{eas-session-ledger-B5vygTiD.mjs → eas-session-ledger-CBFo_Uo1.mjs} +37 -8
  54. package/dist/{error-diagnostics-BOOm9Db7.mjs → error-diagnostics-D1QfyJzQ.mjs} +51 -25
  55. package/dist/{exec-VFRpu1iA.mjs → exec-aULwtNly.mjs} +57 -6
  56. package/dist/{gc-ldgr-hXU.mjs → gc-DM5oMm-J.mjs} +161 -45
  57. package/dist/{gc-C_79zvz4.mjs → gc-PLFwb0k4.mjs} +2 -2
  58. package/dist/{guide-D7K0X6KG.mjs → guide-C4I46XAk.mjs} +674 -213
  59. package/dist/{hosted-android-Bk54ej6n.mjs → hosted-android-DlaKLbW0.mjs} +6 -7
  60. package/dist/{hosted-client-fHO8yqzc.mjs → hosted-client-DDRm9hPJ.mjs} +51 -20
  61. package/dist/{hosted-logs-BfbmDM4M.mjs → hosted-logs-bSebOKbz.mjs} +8 -8
  62. package/dist/{hosted-logs-sync-B0pvmOk-.mjs → hosted-logs-sync-B0c53W_c.mjs} +5 -5
  63. package/dist/{hosted-macos-CPl0OZ9h.mjs → hosted-macos-B7-8Pv4H.mjs} +6 -6
  64. package/dist/{hosted-native-CpDB3-PO.mjs → hosted-native-CDe33CSr.mjs} +22 -18
  65. package/dist/{idle-shutdown-FfxL1KdG.mjs → idle-shutdown-CQ0QwU9J.mjs} +7 -8
  66. package/dist/{ios-WxpDJ5T1.mjs → ios-B1DYuOjh.mjs} +27 -11
  67. package/dist/{ios-B7-lToDu.mjs → ios-B1HvafEG.mjs} +8 -8
  68. package/dist/{ios-ENC4sRPA.mjs → ios-CsRVik64.mjs} +7 -1
  69. package/dist/{ios-device-CsyryvpT.mjs → ios-device-B4elVFKi.mjs} +3 -3
  70. package/dist/{ios-device-B6HK951C.mjs → ios-device-CiBA-er9.mjs} +1 -1
  71. package/dist/{ios-project-Ty5pHl9O.mjs → ios-project-CR4mZ7CH.mjs} +22 -9
  72. package/dist/{ios-signing-4c_qXvQm.mjs → ios-signing-BJzvDPfU.mjs} +2 -2
  73. package/dist/{ios-state-Cw7-WQf2.mjs → ios-state-BPHqMDdZ.mjs} +1 -1
  74. package/dist/{ios-ftxdQbJS.mjs → ios-tg4tp3q1.mjs} +94 -37
  75. package/dist/{js-swap-BMhXYVDS.mjs → js-swap-CVpSW1fn.mjs} +8 -7
  76. package/dist/{launch-DOp8RjDz.mjs → launch-DoySmhjz.mjs} +42 -38
  77. package/dist/lightened-DFAJgfIk.mjs +171 -0
  78. package/dist/{logs-s1dRIG1E.mjs → logs-BGsW7iPe.mjs} +46 -21
  79. package/dist/{logs-dQDki6Tt.mjs → logs-DI5ILkYB.mjs} +7 -7
  80. package/dist/{macos-DBBPNnIA.mjs → macos-Bo9st9Di.mjs} +73 -38
  81. package/dist/{macos-B0VEV3Gf.mjs → macos-C12RMJQF.mjs} +1 -1
  82. package/dist/macos-run.mjs +1 -1
  83. package/dist/maintenance-run.mjs +7 -7
  84. package/dist/{metro-CjC10t6E.mjs → metro-BnhXV2Mj.mjs} +4 -4
  85. package/dist/{metro-gateway-B6_PgD0L.mjs → metro-request-DXyKjVDF.mjs} +26 -47
  86. package/dist/{named-ports-BG0j1X4g.mjs → named-ports-Phoi2POD.mjs} +3 -3
  87. package/dist/{native-android-CL2NGiik.mjs → native-android-vxgtLD7w.mjs} +17 -18
  88. package/dist/{native-gradle-artifact-inputs-btSUulme.mjs → native-gradle-artifact-inputs-BN96IVw8.mjs} +5 -5
  89. package/dist/{native-runtime-Dq3RBcON.mjs → native-runtime-DG4Rodzj.mjs} +9 -8
  90. package/dist/{native-source-D-4Dh4JU.mjs → native-source-D1AzWiuP.mjs} +1 -1
  91. package/dist/{native-xcode-inputs-BW7H8JGu.mjs → native-xcode-inputs-BKarCoKg.mjs} +3 -3
  92. package/dist/{native-xcode-ios-CBXJAxfC.mjs → native-xcode-ios-8A-efGa5.mjs} +17 -17
  93. package/dist/{ndjson-CgE_o3Dl.mjs → ndjson-Dy2W4vRa.mjs} +2 -2
  94. package/dist/offload-worker.mjs +23 -24
  95. package/dist/{operation-exec-CUZifp6Z.mjs → operation-exec-Dp4FuIGR.mjs} +1 -1
  96. package/dist/{ownership-BjYvMNX_.mjs → ownership-DJCq48IJ.mjs} +3 -3
  97. package/dist/{page-CzEA_-5_.mjs → page-CQJlcj3x.mjs} +2 -2
  98. package/dist/{phone-reverses-lmj6kcPm.mjs → phone-reverses-BzTa8g1F.mjs} +18 -4
  99. package/dist/{placement-log-DIFPQAXp.mjs → placement-log-Cvhta5ib.mjs} +3 -3
  100. package/dist/{plan-placement-IiiSQhtz.mjs → plan-placement-WkZdccuN.mjs} +36 -10
  101. package/dist/{ports-C2_w1Z0Z.mjs → ports-UV4mJgyC.mjs} +3 -3
  102. package/dist/{prebuild-gmouvmJZ.mjs → prebuild-k8d_tqOq.mjs} +16 -17
  103. package/dist/{project-BUu6Is4k.mjs → project-Sui52ywT.mjs} +17 -17
  104. package/dist/{pull-request-CbNlkFok.mjs → pull-request-BzLmzAIQ.mjs} +2 -2
  105. package/dist/pull-requests.mjs +1 -1
  106. package/dist/{react-native-android-Cgg99REN.mjs → react-native-android-DANlGGQf.mjs} +32 -26
  107. package/dist/{react-native-build-oNwqF5Wb.mjs → react-native-build-jUHnIfZ9.mjs} +9 -9
  108. package/dist/{react-native-doctor-BhA3KUte.mjs → react-native-doctor-DCWRjS7K.mjs} +6 -6
  109. package/dist/{react-native-ios-B-nf4rjN.mjs → react-native-ios-BwMsFMXi.mjs} +23 -17
  110. package/dist/{recordings-BldzVKq0.mjs → recordings-iy0mkm7b.mjs} +1 -1
  111. package/dist/{registration-CN6nlhcD.mjs → registration-BwCe64PH.mjs} +1 -1
  112. package/dist/{reload-C9OduiNc.mjs → reload-Bj7QyuDy.mjs} +1 -1
  113. package/dist/{reload-CCR7KC_l.mjs → reload-c_uEyc_X.mjs} +16 -16
  114. package/dist/{remote-C8S7FlPF.mjs → remote-DFlpAqdV.mjs} +23 -10
  115. package/dist/{result-7F5hEwQJ.mjs → result-BIcXREyC.mjs} +32 -21
  116. package/dist/{run-BqB0v3pt.mjs → run-y2HwyNvg.mjs} +3 -3
  117. package/dist/{selection-BNPBZ6T5.mjs → selection-CXgM_VK_.mjs} +37 -29
  118. package/dist/{server-bare-A75rDIdD.mjs → server-bare-2N4vSRZG.mjs} +2 -2
  119. package/dist/{server-command-CssKFOD7.mjs → server-command-qneHPcRI.mjs} +6 -6
  120. package/dist/{server-expo-eQfOdydb.mjs → server-expo-Ccm9zB0o.mjs} +4 -4
  121. package/dist/server-expo-WulkyAwT.mjs +2 -0
  122. package/dist/{settings-CosW5X-S.mjs → settings-CY5JZlNN.mjs} +375 -62
  123. package/dist/{settings-OaGQF-ri.mjs → settings-Cfd_Q6ys.mjs} +24 -3
  124. package/dist/settings-payload-DwQiEMCn.mjs +257 -0
  125. package/dist/settings-write-CJpjkeAd.mjs +185 -0
  126. package/dist/settings.schema.json +51 -33
  127. package/dist/{simslim-Bax1qcxu.mjs → simslim-DCQwzoPy.mjs} +2 -2
  128. package/dist/{slot-launch-CYCEhfBY.mjs → slot-launch-BpmanOnk.mjs} +6 -6
  129. package/dist/{stage-jKQ7CP_B.mjs → stage-CmugrSG5.mjs} +2 -2
  130. package/dist/{start-C_wefNKB.mjs → start-CHH3zgIU.mjs} +1 -1
  131. package/dist/{start-_BdJ32cZ.mjs → start-DYLk6GXn.mjs} +27 -22
  132. package/dist/{state-C1i2nMOP.mjs → state-B2QJbDwz.mjs} +4 -4
  133. package/dist/{state-C4OdpOTF.mjs → state-BXC1Lfxw.mjs} +2 -2
  134. package/dist/{stats-tEpEEH-u.mjs → stats-DxKqhcGp.mjs} +5 -5
  135. package/dist/{stats-report-n2U5plhk.mjs → stats-report-B86Cv7Uc.mjs} +1 -1
  136. package/dist/{status-CRXz-Gtj.mjs → status-7ULDEJ1e.mjs} +1 -1
  137. package/dist/{status-DQrqodLj.mjs → status-BHCkOZga.mjs} +51 -28
  138. package/dist/{status-B9M7x4CZ.mjs → status-D_Ljc89p.mjs} +1 -1
  139. package/dist/{status-watch-B5wDIH_o.mjs → status-watch-BmsPqYSU.mjs} +18 -7
  140. package/dist/status-worker.mjs +1 -1
  141. package/dist/{stim-desktop-6Dqp-gjX.mjs → stim-desktop-CbWo21kb.mjs} +2 -2
  142. package/dist/{stop-DRqQVqDJ.mjs → stop-D-dGE9gh.mjs} +21 -20
  143. package/dist/{stop-ySNQHXMG.mjs → stop-DQvE-P76.mjs} +10 -6
  144. package/dist/{stop-CmdNhGlC.mjs → stop-b2pouxAO.mjs} +2 -2
  145. package/dist/supervisor-run.mjs +237 -63
  146. package/dist/{support-BGSCBoib.mjs → support-04IhBUTT.mjs} +6 -6
  147. package/dist/{support-CVOCp0Ft.mjs → support-BtlJKjyQ.mjs} +12 -11
  148. package/dist/{swiftpm-artifact-inputs-CfUzt_0Z.mjs → swiftpm-artifact-inputs-Cj2UpmPN.mjs} +4 -4
  149. package/dist/{swiftpm-macos-x6HPpl_2.mjs → swiftpm-macos-BhF2stxY.mjs} +11 -12
  150. package/dist/{toolchain-J4J8MrAr.mjs → toolchain-mLA_km-b.mjs} +321 -15
  151. package/dist/{toolchain-DoavrvIA.mjs → toolchain-qktiV8xc.mjs} +1 -1
  152. package/dist/{trigger-KVaWWNyn.mjs → trigger-DMou-X7j.mjs} +2 -2
  153. package/dist/trigger-qp2ji5wE.mjs +2 -0
  154. package/dist/{warm-progress-DvhTX_eu.mjs → warm-progress-B0Vpuvpl.mjs} +731 -727
  155. package/dist/{web-Bihbf7-u.mjs → web-BYmK0TjL.mjs} +9 -9
  156. package/dist/web-CrVLVQZY.mjs +2 -0
  157. package/dist/web-run.mjs +9 -9
  158. package/dist/windows-report.mjs +1 -1
  159. package/dist/{workspace-state-pUg3_RRA.mjs → workspace-state-kIZrdlSg.mjs} +3 -3
  160. package/dist/{workspaces-g2lhdBXF.mjs → workspaces-CmOcceDN.mjs} +1879 -74
  161. package/dist/{worktree-BKuklFh_.mjs → worktree-2dk5edza.mjs} +933 -534
  162. package/dist/worktree-nliAoHxB.mjs +2 -0
  163. package/package.json +7 -7
  164. package/dist/ccache-Bx5TbxwG.mjs +0 -143
  165. package/dist/eas-fallback-FwkeqqGi.mjs +0 -381
  166. package/dist/hosted-ios-D55QhYaD.mjs +0 -15
  167. package/dist/native-run-BfIDFKLH.mjs +0 -275
  168. package/dist/server-expo-wvcj5tiZ.mjs +0 -2
  169. package/dist/settings-write-QjYfSrjF.mjs +0 -360
  170. package/dist/trigger-DzJu208Q.mjs +0 -2
  171. package/dist/web-BFLueSh-.mjs +0 -2
  172. package/dist/worktree-Bm4cb-nU.mjs +0 -2
@@ -1,20 +1,288 @@
1
- import { D as ownership_claim_exports, _ as spawnDeclared, m as declareSpawnsOn, t as getExecutor, v as stopDeclaringSpawnsOn } from "./exec-VFRpu1iA.mjs";
2
- import { T as workspaceDerivedData } from "./workspace-state-pUg3_RRA.mjs";
1
+ import { D as ownership_claim_exports, _ as spawnDeclared, b as operationState, g as signalDeclaredSpawns, h as refuseDeclaredSpawns, m as declareSpawnsOn, p as allowDeclaredSpawns, t as getExecutor, u as withWorkspaceProcessLock, v as stopDeclaringSpawnsOn, y as isTermination } from "./exec-aULwtNly.mjs";
2
+ import { E as workspaceDir, T as workspaceDerivedData, l as withWorkspaceStateLockAsync, o as updateWorkspaceState, r as readWorkspaceState$1, t as clearWorkspaceStateKey } from "./workspace-state-kIZrdlSg.mjs";
3
3
  import { n as stripAnsi, r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
4
- import { a as formatElapsed, l as phaseLine } from "./command-output-BF5AR2dL.mjs";
5
- import { a as killOnAbort } from "./operation-exec-CUZifp6Z.mjs";
6
- import { o as androidHome } from "./android-DTAcRwBC.mjs";
7
- import { d as runCancellationSignal, h as shareCompilationCache } from "./native-run-BfIDFKLH.mjs";
4
+ import { a as formatElapsed, l as phaseLine } from "./command-output-C8R1KIvi.mjs";
5
+ import { a as killOnAbort } from "./operation-exec-Dp4FuIGR.mjs";
6
+ import { o as androidHome } from "./android-CsPs-7Mg.mjs";
7
+ import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
8
8
  import { p as resolveOptimizations } from "./errors-DHm_U5gv.mjs";
9
- import { t as cleanLine } from "./server-expo-eQfOdydb.mjs";
9
+ import { t as cleanLine } from "./server-expo-Ccm9zB0o.mjs";
10
10
  import { createRequire } from "node:module";
11
11
  import { createHash } from "node:crypto";
12
- import { existsSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync } from "node:fs";
12
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
13
13
  import { homedir, tmpdir } from "node:os";
14
- import { basename, delimiter, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
14
+ import { basename, delimiter, dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
15
15
  import { ambientContext, ambientEnv } from "@stim-cli/core";
16
16
  import { stimBuildDigest } from "@stim-cli/core/state";
17
17
  import { fileURLToPath } from "node:url";
18
+ import { setTimeout as setTimeout$1 } from "node:timers/promises";
19
+ //#region src/cache/cache-claim.ts
20
+ const LABEL = "cache";
21
+ const POLL_MS = 500;
22
+ const EMPTYING_WAIT_MS = 6e5;
23
+ /**
24
+ * The claim set guarding a cache Stim can only empty whole. It sits beside the cache's resolved directory, so emptying
25
+ * the cache never removes it and every path that reaches the same cache names the same set; before the cache exists,
26
+ * its resolved parent stands in for it.
27
+ */
28
+ function cacheClaimRoot(dir) {
29
+ return `${existsSync(dir) ? canonicalPath(dir) : join(canonicalPath(dirname(dir)), basename(dir))}.claims`;
30
+ }
31
+ function describe(holder) {
32
+ const { platform, projectRoot } = holder.details;
33
+ const where = typeof projectRoot === "string" ? ` in ${projectRoot}` : "";
34
+ return holder.mode === "shared" ? `the ${typeof platform === "string" ? platform : "iOS"} build (pid ${holder.owner.pid}${where}) may be using it` : `pid ${holder.owner.pid} is emptying it`;
35
+ }
36
+ /** Why the cache at `dir` may be in use, from its claim set, without taking or removing any claim. */
37
+ function cacheUser(dir) {
38
+ const root = cacheClaimRoot(dir);
39
+ const survey = (0, ownership_claim_exports.readClaimSet)(root);
40
+ const problem = survey.unresolved[0];
41
+ if (problem) return `the cache claim ${problem.path} is unresolved, so a build may be using it`;
42
+ const holder = survey.live[0];
43
+ return holder ? describe(holder) : void 0;
44
+ }
45
+ /**
46
+ * Takes the exclusive claim an emptier holds while it removes the cache's contents; a string is why it cannot.
47
+ * It never waits for a build that holds the cache.
48
+ */
49
+ function claimForEmptying(dir) {
50
+ try {
51
+ const attempt = (0, ownership_claim_exports.tryAcquireClaim)({
52
+ root: cacheClaimRoot(dir),
53
+ mode: "exclusive",
54
+ label: LABEL
55
+ });
56
+ if (attempt.acquired) return attempt.acquired;
57
+ if (attempt.pending) (0, ownership_claim_exports.releaseClaim)(attempt.pending);
58
+ const holder = attempt.held ?? attempt.waitingFor?.[0];
59
+ return holder ? describe(holder) : `its claim at ${cacheClaimRoot(dir)} could not be taken`;
60
+ } catch (error) {
61
+ if ((0, ownership_claim_exports.isClaimRefusal)(error) || (0, ownership_claim_exports.isClaimUnavailable)(error)) return error.message;
62
+ return `its claim at ${cacheClaimRoot(dir)} could not be taken: ${error instanceof Error ? error.message : String(error)}`;
63
+ }
64
+ }
65
+ /**
66
+ * Takes the shared claim a build holds on the compilation cache it compiles with, waiting while an emptier holds it.
67
+ * A claim set Stim cannot resolve, or no process identity, is a failure: the build never runs unguarded.
68
+ */
69
+ async function shareCompilationCache({ dir, projectRoot, note, signal }) {
70
+ const started = Date.now();
71
+ let told = false;
72
+ for (;;) {
73
+ signal?.throwIfAborted();
74
+ let attempt;
75
+ let root = `${dir}.claims`;
76
+ try {
77
+ mkdirSync(dirname(dir), { recursive: true });
78
+ root = cacheClaimRoot(dir);
79
+ attempt = (0, ownership_claim_exports.tryAcquireClaim)({
80
+ root,
81
+ mode: "shared",
82
+ label: LABEL,
83
+ details: {
84
+ platform: "ios",
85
+ projectRoot
86
+ }
87
+ });
88
+ } catch (error) {
89
+ return { failure: (0, ownership_claim_exports.claimFailure)(error, null) ?? {
90
+ code: ownership_claim_exports.CLAIM_UNAVAILABLE,
91
+ message: `Stim could not take the compilation cache claim at ${root}: ${error instanceof Error ? error.message : String(error)}.`,
92
+ remedy: `Restore write access to ${dirname(root)}, then retry the same Stim command.`
93
+ } };
94
+ }
95
+ if (attempt.acquired) return { claim: attempt.acquired };
96
+ const emptier = attempt.held ? `pid ${attempt.held.owner.pid}` : "another process";
97
+ const waited = Date.now() - started;
98
+ if (waited >= EMPTYING_WAIT_MS) return { failure: {
99
+ code: "STIM_BUILD_FAILED",
100
+ message: `${emptier} has been emptying the compilation cache at ${dir} for ${formatElapsed(waited)}.`,
101
+ remedy: "Run the same command again once it has finished."
102
+ } };
103
+ if (!told) note(phaseLine("build", `waiting for ${emptier} to finish emptying the compilation cache at ${dir}`));
104
+ told = true;
105
+ await setTimeout$1(POLL_MS);
106
+ }
107
+ }
108
+ //#endregion
109
+ //#region src/engine/native-run.ts
110
+ const NATIVE_RUN_LOCK = "native-run";
111
+ const NATIVE_RUN_WAIT_MS = 18e5;
112
+ const WAIT_HEARTBEAT_MS = 3e4;
113
+ const CANCEL_REQUEST_KEY = "nativeRunCancel";
114
+ const REQUEST_POLL_MS = 250;
115
+ function nativeRunHolder(holder) {
116
+ const { command, platform, slot, interrupt } = holder.details;
117
+ return {
118
+ command: typeof command === "string" ? command : null,
119
+ platform: typeof platform === "string" ? platform : null,
120
+ slot: typeof slot === "string" ? slot : "default",
121
+ takesSignals: interrupt === "signal"
122
+ };
123
+ }
124
+ function describeNativeRunHolder(holder, now) {
125
+ const { command, slot } = nativeRunHolder(holder);
126
+ const started = Date.parse(holder.startedAt);
127
+ const facts = [`pid ${holder.owner.pid}`];
128
+ if (Number.isFinite(started)) facts.push(`running for ${formatElapsed(now - started)}`);
129
+ if (command === null) return `another Stim run (${facts.join(", ")})`;
130
+ if (command === "build") return `an artifact build (${facts.join(", ")})`;
131
+ return `\`stim ${command}${slot === "default" ? "" : ` --slot ${slot}`}\` (${facts.join(", ")})`;
132
+ }
133
+ /**
134
+ * Report a wait on the native-run lock: one line as soon as a holder is seen, a line for each new
135
+ * holder, and a heartbeat every WAIT_HEARTBEAT_MS while the same holder keeps it.
136
+ */
137
+ function nativeRunWaitNotice({ write, now = Date.now, describe = describeNativeRunHolder }) {
138
+ let claimId = null;
139
+ let lastAt = 0;
140
+ return (holder, firstLine) => {
141
+ const at = now();
142
+ if (holder.claimId !== claimId) {
143
+ claimId = holder.claimId;
144
+ lastAt = at;
145
+ write(firstLine ?? `waiting for ${describe(holder, at)} in this workspace to finish`);
146
+ return;
147
+ }
148
+ if (at - lastAt < WAIT_HEARTBEAT_MS) return;
149
+ lastAt = at;
150
+ write(`still waiting for ${describe(holder, at)}`);
151
+ };
152
+ }
153
+ /**
154
+ * What `stop` does about the run holding the native-run lock. A build is interrupted only when the stop
155
+ * leaves it nothing to deploy to: the whole workspace stops, the build targets the stopped slot, or the
156
+ * stopped slot is the workspace's only device. A build for another slot that stays is left running and
157
+ * the stop proceeds without the lock. Only an owner whose identity is proven live is signalled.
158
+ */
159
+ function decideStopAction({ stopSlot, holder, ownerIdentity, deviceSlots }) {
160
+ if (holder.command === "macos" || holder.command === "build") {
161
+ if (stopSlot !== void 0) return { action: "proceed" };
162
+ return ownerIdentity === "same" ? { action: "interrupt" } : { action: "refuse" };
163
+ }
164
+ if (holder.command !== "ios" && holder.command !== "android") return { action: "wait" };
165
+ if (!(stopSlot === void 0 || holder.slot === stopSlot || deviceSlots.includes(stopSlot) && deviceSlots.every((slot) => slot === stopSlot))) return { action: "proceed" };
166
+ return ownerIdentity === "same" ? { action: "interrupt" } : { action: "refuse" };
167
+ }
168
+ const requestListeners = /* @__PURE__ */ new Map();
169
+ /**
170
+ * Ask the run holding `claimId` to cancel: the request is written to the workspace state, where the run's watch
171
+ * finds it, and a run in this process is told at once.
172
+ */
173
+ function requestNativeRunCancel(root, claimId, pid = process.pid) {
174
+ updateWorkspaceState(root, (state) => ({
175
+ ...state,
176
+ [CANCEL_REQUEST_KEY]: {
177
+ claimId,
178
+ pid,
179
+ at: (/* @__PURE__ */ new Date()).toISOString()
180
+ }
181
+ }));
182
+ requestListeners.get(claimId)?.();
183
+ }
184
+ function cancelRequestFor(root, claimId) {
185
+ const request = readWorkspaceState$1(root)?.[CANCEL_REQUEST_KEY];
186
+ if (request?.claimId !== claimId || typeof request.pid !== "number") return null;
187
+ return { pid: request.pid };
188
+ }
189
+ function clearNativeRunCancel(root, claimId) {
190
+ try {
191
+ clearWorkspaceStateKey(root, CANCEL_REQUEST_KEY, (value) => value?.claimId === claimId);
192
+ } catch {}
193
+ }
194
+ /** The active native run of `context`'s operation aborts this signal when it is cancelled. */
195
+ function runCancellationSignal(context) {
196
+ return operationState(context).runSignal;
197
+ }
198
+ /** Why `context`'s native run was cancelled, or null while it was not. */
199
+ function runCancellation(context) {
200
+ return operationState(context).cancelled;
201
+ }
202
+ function cancelledFailure(context, platform, { code, message }) {
203
+ const cancelled = runCancellation(context);
204
+ if (cancelled === null || code === "STIM_CLAIM_UNAVAILABLE") return null;
205
+ return {
206
+ code: "STIM_CANCELLED",
207
+ message: `The ${platform} run was ${cancelled} before it finished.`,
208
+ remedy: `Run \`stim ${platform}\` again when you want the app on a device.`,
209
+ lines: [`it stopped at ${code ?? "an unfinished step"}${message ? `: ${message}` : ""}`]
210
+ };
211
+ }
212
+ function cancelOnAbort({ context, root, claim, write, controller }) {
213
+ const state = operationState(context);
214
+ const cancel = () => {
215
+ if (controller.signal.aborted) return;
216
+ const request = cancelRequestFor(root, claim.claimId);
217
+ const cancelled = request ? `cancelled by \`stim stop\` (pid ${request.pid})` : "cancelled by an interrupt";
218
+ state.cancelled = cancelled;
219
+ state.handled = true;
220
+ controller.abort();
221
+ refuseDeclaredSpawns(context, `the run was ${cancelled}`);
222
+ const signalled = signalDeclaredSpawns(context, "SIGINT");
223
+ if (signalled > 0 || request) state.draining = true;
224
+ write(signalled > 0 ? `${cancelled}; stopping the running build tool` : request ? `${cancelled}; stopping before the next build tool or install` : cancelled);
225
+ };
226
+ const onAbort = () => {
227
+ if (!isTermination(context.signal.reason)) cancel();
228
+ };
229
+ const onRequest = () => {
230
+ if (controller.signal.aborted || !cancelRequestFor(root, claim.claimId)) return;
231
+ cancel();
232
+ state.abortOperation?.("stop");
233
+ };
234
+ context.signal.addEventListener("abort", onAbort);
235
+ if (context.signal.aborted) onAbort();
236
+ requestListeners.set(claim.claimId, onRequest);
237
+ const watch = setInterval(onRequest, REQUEST_POLL_MS);
238
+ watch.unref();
239
+ return async () => {
240
+ clearInterval(watch);
241
+ requestListeners.delete(claim.claimId);
242
+ context.signal.removeEventListener("abort", onAbort);
243
+ allowDeclaredSpawns(context);
244
+ await withWorkspaceStateLockAsync(root, () => clearNativeRunCancel(root, claim.claimId)).catch(() => {});
245
+ };
246
+ }
247
+ /**
248
+ * Run an `ios`, `android` or `macos` invocation under the workspace's native-run lock: the claim records the
249
+ * command, platform and slot, and a wait for another holder is reported on `write`. An abort of `context.signal`
250
+ * forwards an interrupt to the running declared build tool and refuses any later one; a run `stim stop` cancelled
251
+ * stops before its next build tool or install. A `SIGTERM` abort reason is left to the caller.
252
+ */
253
+ function withNativeBuildRun(context, root, details, fn, { write }) {
254
+ const notice = nativeRunWaitNotice({ write });
255
+ const state = operationState(context);
256
+ return withWorkspaceProcessLock(workspaceDir(root), NATIVE_RUN_LOCK, async (claim) => {
257
+ state.cancelled = null;
258
+ const controller = new AbortController();
259
+ state.runSignal = controller.signal;
260
+ const dispose = cancelOnAbort({
261
+ context,
262
+ root,
263
+ claim,
264
+ write,
265
+ controller
266
+ });
267
+ try {
268
+ return await fn(claim);
269
+ } finally {
270
+ await dispose();
271
+ state.runSignal = void 0;
272
+ }
273
+ }, {
274
+ external: true,
275
+ signal: context.signal,
276
+ waitMs: NATIVE_RUN_WAIT_MS,
277
+ declareSpawnsFor: context,
278
+ details: {
279
+ ...details,
280
+ interrupt: state.takesSignals ? "signal" : "request"
281
+ },
282
+ onHeld: (holder) => notice(holder)
283
+ });
284
+ }
285
+ //#endregion
18
286
  //#region src/engine/bundler.ts
19
287
  const COCOAPODS_SPEC = /^ {4}cocoapods \(([^)\s]+)/m;
20
288
  /**
@@ -631,11 +899,12 @@ async function buildXcode({ context = ambientContext(), root, udid = null, logWr
631
899
  derivedDataPath: dd,
632
900
  exec: executor
633
901
  }) : compilationCache || [];
634
- const buildSettings = arch ? [
902
+ const debugSettings = configuration === "Debug" && sdk === "iphonesimulator" ? ["DEBUG_INFORMATION_FORMAT=dwarf"] : [];
903
+ const buildSettings = [
635
904
  ...cacheSettings,
636
- `ARCHS=${arch}`,
637
- "ONLY_ACTIVE_ARCH=YES"
638
- ] : cacheSettings;
905
+ ...debugSettings,
906
+ ...arch ? [`ARCHS=${arch}`, "ONLY_ACTIVE_ARCH=YES"] : []
907
+ ];
639
908
  const casPathSetting = "COMPILATION_CACHE_CAS_PATH=";
640
909
  const casDir = cacheSettings.includes("COMPILATION_CACHE_ENABLE_CACHING=YES") ? cacheSettings.find((setting) => setting.startsWith(casPathSetting))?.slice(27) ?? null : null;
641
910
  const args = xcodebuildArgs({
@@ -914,6 +1183,7 @@ async function buildXcode({ context = ambientContext(), root, udid = null, logWr
914
1183
  //#endregion
915
1184
  //#region src/engine/deps.ts
916
1185
  const DEPS_ERROR = "STIM_DEPS_FAILED";
1186
+ const BUILD_MARKER = ".last_build_configuration";
917
1187
  const TRANSCRIPT_LINES = 2e3;
918
1188
  const MAX_POD_DIAGNOSTIC_LINES = 15;
919
1189
  const POD_MARKER = /^\[!\]/;
@@ -1358,6 +1628,38 @@ function gemInstallRemedy(root, pin) {
1358
1628
  const version = readRubyVersion(root);
1359
1629
  return `${version ? `This repo pins ruby ${version} (.ruby-version), so put that ruby on PATH (rbenv/rvm/asdf/mise) first. ` : ""}Bundler could not install the gems ${pin.lockfile} pins, so \`bundle exec pod install\` cannot run. Run \`cd ${dirname(pin.gemfile)} && bundle install\` and fix what it reports, then run again.`;
1360
1630
  }
1631
+ function readBuildMarkers(podsDir) {
1632
+ let names;
1633
+ try {
1634
+ names = readdirSync(podsDir);
1635
+ } catch {
1636
+ return [];
1637
+ }
1638
+ return names.flatMap((name) => {
1639
+ const dir = join(podsDir, name);
1640
+ try {
1641
+ return [{
1642
+ dir,
1643
+ ino: statSync(dir).ino,
1644
+ content: readFileSync(join(dir, BUILD_MARKER))
1645
+ }];
1646
+ } catch {
1647
+ return [];
1648
+ }
1649
+ });
1650
+ }
1651
+ function restoreBuildMarkers(markers) {
1652
+ const restored = [];
1653
+ for (const { dir, ino, content } of markers) {
1654
+ const file = join(dir, BUILD_MARKER);
1655
+ try {
1656
+ if (existsSync(file) || statSync(dir).ino !== ino) continue;
1657
+ writeFileSync(file, content);
1658
+ restored.push(basename(dir));
1659
+ } catch {}
1660
+ }
1661
+ return restored;
1662
+ }
1361
1663
  async function runPodInstall(root, logWriter, { spawnFn = null, now = Date.now, heartbeatMs = HEARTBEAT_INTERVAL_MS, estimateMs = null, onHeartbeat = (line) => console.error(line), directory = join(root, "ios") } = {}) {
1362
1664
  const iosDir = directory;
1363
1665
  if (!existsSync(iosDir)) return {
@@ -1393,6 +1695,7 @@ async function runPodInstall(root, logWriter, { spawnFn = null, now = Date.now,
1393
1695
  "install"
1394
1696
  ] : ["pod", "install"];
1395
1697
  const command = args.join(" ");
1698
+ const markers = readBuildMarkers(join(iosDir, "Pods"));
1396
1699
  const run = await runCaptured({
1397
1700
  ...ctx,
1398
1701
  cmd: args[0],
@@ -1403,6 +1706,8 @@ async function runPodInstall(root, logWriter, { spawnFn = null, now = Date.now,
1403
1706
  label: "pods",
1404
1707
  estimateMs
1405
1708
  });
1709
+ const restored = restoreBuildMarkers(markers);
1710
+ if (restored.length) notes.push(`kept the ${BUILD_MARKER} that pod install removed from ${restored.join(", ")}`);
1406
1711
  if (run.error) return {
1407
1712
  ...(bundler ? missingBundle(run.error, pin) : missingPod(run.error)) || {
1408
1713
  failed: true,
@@ -1923,6 +2228,7 @@ function cocoapodsInstall(here) {
1923
2228
  }
1924
2229
  function cocoapodsDifference(target, worker) {
1925
2230
  if (target.native || target.cocoapodsPinned) return null;
2231
+ if (worker.os !== void 0 && worker.os !== "darwin") return null;
1926
2232
  const here = target.local.cocoapods;
1927
2233
  if (!worker.cocoapods) return {
1928
2234
  code: "cocoapods",
@@ -1979,7 +2285,7 @@ function compareVersions(a, b) {
1979
2285
  function pickXcodeApp(apps, wanted) {
1980
2286
  return (wanted.build ? apps.find((app) => app.build === wanted.build) : void 0) ?? (wanted.version ? apps.find((app) => app.version === wanted.version) : void 0) ?? apps.toSorted((a, b) => compareVersions(b.version, a.version))[0];
1981
2287
  }
1982
- const developerDirOf = (app) => join(app.path, "Contents", "Developer");
2288
+ const developerDirOf = (app) => posix.join(app.path, "Contents", "Developer");
1983
2289
  function selectXcode(app, selected, worker) {
1984
2290
  const commands = selected ? [] : [`sudo xcode-select -s ${shellQuote(developerDirOf(app), worker.os)}`];
1985
2291
  if (app.license === false && app.firstLaunch === false) commands.push("sudo xcodebuild -license accept && sudo xcodebuild -runFirstLaunch");
@@ -2104,4 +2410,4 @@ function toolchainMismatches(target, worker) {
2104
2410
  return out;
2105
2411
  }
2106
2412
  //#endregion
2107
- export { COMPILATION_CACHE_UNAVAILABLE as A, readBundleExecutable as B, POD_MISSING_REASON as C, runCaptured as D, readRubyVersion as E, compilationCacheSettings as F, tailLines as G, resolveScheme as H, detectXcodeMajorAsync as I, bundlerPin as J, xcodebuildArgs as K, parseSwiftVersion as L, SWIFT_PREFIX_MAPPING_MIN_SWIFT as M, buildXcode as N, runPodInstall as O, compilationCacheActivityLine as P, parseXcodeMajor as R, DEPS_ERROR as S, readPodState as T, startBuildHeartbeat as U, readBundleId as V, swiftPrefixMappingSupported as W, podInstallCommand as Y, sdkDownloadDisabled as _, cocoapodsDifference as a, useJdkMajor as b, iphoneRuntimes as c, jdkMajor as d, listXcodeApps as f, parseXcodeVersionPlist as g, parseAndroidRequirements as h, availableIphone as i, HEARTBEAT_INTERVAL_MS as j, COMPILATION_CACHE_NOT_RUN as k, jdkCandidates as l, macosToolchainAsync as m, androidToolchain as n, cocoapodsInstall as o, macosToolchain as p, describeDiagnostic as q, androidToolchainAsync as r, iosToolchainAsync as s, androidRequirements as t, jdkHomes as u, toolchainMismatches as v, podsAreStale as w, workerToolchain as x, toolchainNotes as y, pickXcodeProject as z };
2413
+ export { clearNativeRunCancel as $, COMPILATION_CACHE_UNAVAILABLE as A, readBundleExecutable as B, POD_MISSING_REASON as C, runCaptured as D, readRubyVersion as E, compilationCacheSettings as F, tailLines as G, resolveScheme as H, detectXcodeMajorAsync as I, bundlerPin as J, xcodebuildArgs as K, parseSwiftVersion as L, SWIFT_PREFIX_MAPPING_MIN_SWIFT as M, buildXcode as N, runPodInstall as O, compilationCacheActivityLine as P, cancelledFailure as Q, parseXcodeMajor as R, DEPS_ERROR as S, readPodState as T, startBuildHeartbeat as U, readBundleId as V, swiftPrefixMappingSupported as W, NATIVE_RUN_LOCK as X, podInstallCommand as Y, NATIVE_RUN_WAIT_MS as Z, sdkDownloadDisabled as _, cocoapodsDifference as a, runCancellation as at, useJdkMajor as b, iphoneRuntimes as c, cacheUser as ct, jdkMajor as d, decideStopAction as et, listXcodeApps as f, parseXcodeVersionPlist as g, parseAndroidRequirements as h, availableIphone as i, requestNativeRunCancel as it, HEARTBEAT_INTERVAL_MS as j, COMPILATION_CACHE_NOT_RUN as k, jdkCandidates as l, claimForEmptying as lt, macosToolchainAsync as m, androidToolchain as n, nativeRunHolder as nt, cocoapodsInstall as o, runCancellationSignal as ot, macosToolchain as p, describeDiagnostic as q, androidToolchainAsync as r, nativeRunWaitNotice as rt, iosToolchainAsync as s, withNativeBuildRun as st, androidRequirements as t, describeNativeRunHolder as tt, jdkHomes as u, toolchainMismatches as v, podsAreStale as w, workerToolchain as x, toolchainNotes as y, pickXcodeProject as z };
@@ -1,2 +1,2 @@
1
- import { m as macosToolchainAsync, p as macosToolchain } from "./toolchain-J4J8MrAr.mjs";
1
+ import { m as macosToolchainAsync, p as macosToolchain } from "./toolchain-mLA_km-b.mjs";
2
2
  export { macosToolchain, macosToolchainAsync };
@@ -1,7 +1,7 @@
1
- import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
1
+ import { t as getExecutor } from "./exec-aULwtNly.mjs";
2
2
  import { t as resolveMaintenanceSettings } from "./settings-Djl-mpjX.mjs";
3
3
  import { t as spawnEntry } from "./spawn-entry-jw19m8Nl.mjs";
4
- import { n as windowsLauncherArgs } from "./detached-entry-KmieOKgN.mjs";
4
+ import { n as windowsLauncherArgs } from "./detached-entry-BPlSaCwC.mjs";
5
5
  import { n as stampAttempt, r as due, t as capChildLog } from "./attempt-ClyJlZPT.mjs";
6
6
  import { readClaimSet } from "@stim-cli/core/ownership-claim";
7
7
  import { closeSync, openSync } from "node:fs";
@@ -0,0 +1,2 @@
1
+ import { t as triggerMaintenance } from "./trigger-DMou-X7j.mjs";
2
+ export { triggerMaintenance };