stim 1.36.0 → 1.38.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 (167) hide show
  1. package/README.md +3 -1
  2. package/dist/{acquire-artifact-DGTHCd0Q.mjs → acquire-artifact-QKPDkesw.mjs} +2 -2
  3. package/dist/{act-CvN9xyV6.mjs → act-Bh3t-NuH.mjs} +28 -34
  4. package/dist/{activity-BpdDvA8Q.mjs → activity-CANftndU.mjs} +6 -6
  5. package/dist/{agent-device-usage-output-pbhaW7_k.mjs → agent-device-usage-output-CuROXefb.mjs} +5 -5
  6. package/dist/{android-SJx1V3R3.mjs → android-27_JgJ1T.mjs} +7 -7
  7. package/dist/{android-B0qTdwnt.mjs → android-Biwc4Dck.mjs} +5 -5
  8. package/dist/{android-5wkcMFDG.mjs → android-DGLG_VQ3.mjs} +2 -2
  9. package/dist/{android-e9WP10cE.mjs → android-Z6Eev9rL.mjs} +51 -42
  10. package/dist/{android-cas-BS9_55U5.mjs → android-cas-BDAwwL82.mjs} +4 -4
  11. package/dist/android-cas-compiler.mjs +1 -1
  12. package/dist/{android-image-BZ57YL6R.mjs → android-image-BcUD6bPi.mjs} +3 -3
  13. package/dist/api.d.mts +12 -5
  14. package/dist/api.mjs +34 -31
  15. package/dist/{apk-signed-tail-eZyXIrnc.mjs → apk-signed-tail-DHMkXs4s.mjs} +2 -2
  16. package/dist/{artifact-C3srrGVU.mjs → artifact-Dc1GsK7o.mjs} +29 -15
  17. package/dist/{artifact-platform-DqCWUieN.mjs → artifact-platform-BaGL1i1X.mjs} +1 -1
  18. package/dist/{artifact-ubNdxo_K.mjs → artifact-sGoFVK1q.mjs} +12 -12
  19. package/dist/{auto-placement-CKFpFCuq.mjs → auto-placement-RNh4kx2T.mjs} +7 -7
  20. package/dist/{browser-web-B63vLrj6.mjs → browser-web-7Oj57Roa.mjs} +15 -15
  21. package/dist/{build-B_Dx9SKJ.mjs → build-DkE5vjp1.mjs} +29 -28
  22. package/dist/{build-cache-BW8T4oD2.mjs → build-cache-CJ65Efv7.mjs} +10 -7
  23. package/dist/{build-plan-CeIooJqn.mjs → build-plan-DWajg5l_.mjs} +8 -7
  24. package/dist/{cache-manifest-CxWkZmUr.mjs → cache-manifest-BO0TIcPV.mjs} +1 -1
  25. package/dist/cache-manifest.mjs +1 -1
  26. package/dist/{cdp-C216kOAn.mjs → cdp-CgT47_9A.mjs} +1 -1
  27. package/dist/{chrome-C8sC5tdl.mjs → chrome-DL5znvmo.mjs} +1 -1
  28. package/dist/{cli-COdXswmc.mjs → cli-BSlwv9hI.mjs} +21 -21
  29. package/dist/cli.mjs +1 -1
  30. package/dist/{client-KSWIeQLA.mjs → client-qwmHFSga.mjs} +16 -12
  31. package/dist/collector-run.mjs +7 -7
  32. package/dist/{command-output-T3cDctRE.mjs → command-output-DsjhOzJ3.mjs} +1 -1
  33. package/dist/{config-BA3TgoIP.mjs → config-CNmN-ndb.mjs} +2 -2
  34. package/dist/{dependencies-LH-7k1Vr.mjs → dependencies-oku1ZLep.mjs} +144 -71
  35. package/dist/{dependency-state-Blfp3AkG.mjs → dependency-state-CBhPJAs_.mjs} +2 -2
  36. package/dist/{detached-entry-tfrgGVWb.mjs → detached-entry-VqFeEE9W.mjs} +1 -1
  37. package/dist/{dev-client-MO_DjTZr.mjs → dev-client-DL5UtVdx.mjs} +2 -2
  38. package/dist/{device-DNTWFFB1.mjs → device-CxMwX0VO.mjs} +17 -16
  39. package/dist/{device-android-BB9Lugr8.mjs → device-android-CSlBXuh_.mjs} +9 -9
  40. package/dist/{device-capacity-CpAVcKgq.mjs → device-capacity-D_IlxZRL.mjs} +84 -37
  41. package/dist/device-host-worker.mjs +28 -16
  42. package/dist/{device-pool-BJToGG-q.mjs → device-pool-BEaTdtss.mjs} +3 -3
  43. package/dist/{device-provision-CxQDCtrc.mjs → device-provision-C9NPdCne.mjs} +10 -10
  44. package/dist/{device-BZWt_aPJ.mjs → device-yfuJ-v4s.mjs} +11 -11
  45. package/dist/{doctor-C-46SkBe.mjs → doctor-BAA3zN5U.mjs} +1 -1
  46. package/dist/{doctor-DV639Iw_.mjs → doctor-BQ1Kl44s.mjs} +15 -21
  47. package/dist/{doctor-CYZ45LnX.mjs → doctor-QNzDE4aW.mjs} +24 -24
  48. package/dist/{doctor-fingerprint-DqWvIhMb.mjs → doctor-fingerprint-Bo4z8YNP.mjs} +1 -1
  49. package/dist/doctor-fingerprint.mjs +1 -1
  50. package/dist/{doctor-watchman-TZxYt_98.mjs → doctor-watchman-B8e3s9ko.mjs} +5 -5
  51. package/dist/{eas-build-Xf5Jd6LR.mjs → eas-build-4rg9WpEg.mjs} +4 -4
  52. package/dist/{eas-fallback-DNYPNinw.mjs → eas-fallback-UGo0SG7T.mjs} +6 -6
  53. package/dist/{eas-session-ledger-CXZ4aix0.mjs → eas-session-ledger-BDpSdFDM.mjs} +6 -6
  54. package/dist/{error-diagnostics-CvB5bpPU.mjs → error-diagnostics-CW9xl6ot.mjs} +10 -10
  55. package/dist/{exec-CGuDzt40.mjs → exec-L37dbiIb.mjs} +7 -1
  56. package/dist/{gc-DiUhrVFo.mjs → gc-3DHVCn-k.mjs} +52 -36
  57. package/dist/{gc-8Qm_K1iy.mjs → gc-BQ5dXnC7.mjs} +2 -2
  58. package/dist/{guide-CuvHRP53.mjs → guide-DqJCc4vW.mjs} +209 -78
  59. package/dist/{hosted-android-D__HGVIO.mjs → hosted-android-gwLspaz6.mjs} +4 -4
  60. package/dist/{hosted-client-DMOOu8vD.mjs → hosted-client-B_h_bTlz.mjs} +4 -4
  61. package/dist/{hosted-logs-CClIktQM.mjs → hosted-logs-BpQSRDRU.mjs} +17 -10
  62. package/dist/{hosted-logs-sync-B7XCeqVm.mjs → hosted-logs-sync-D3L1hDpM.mjs} +5 -5
  63. package/dist/{hosted-macos-D4sDJIbB.mjs → hosted-macos-GK4O1s7x.mjs} +6 -6
  64. package/dist/{hosted-native-BiiUG_Q6.mjs → hosted-native-B6ur_0OJ.mjs} +8 -8
  65. package/dist/{ios-Qam0bT9n.mjs → ios-2Qr4_Zu2.mjs} +1 -1
  66. package/dist/{ios-BZuhvLGr.mjs → ios-Bi0bQiZ_.mjs} +8 -8
  67. package/dist/{ios-BhfpRfNf.mjs → ios-DQEzde6f.mjs} +23 -10
  68. package/dist/{ios-BhpUWyN7.mjs → ios-M7nRVb33.mjs} +100 -37
  69. package/dist/{ios-device-vhYL1N--.mjs → ios-device-BLm1BZB4.mjs} +3 -3
  70. package/dist/{ios-device-DLdEDWJj.mjs → ios-device-ygijU78G.mjs} +1 -1
  71. package/dist/{ios-project-Cz0S1Sz-.mjs → ios-project-Bsm-eqwv.mjs} +7 -7
  72. package/dist/ios-runtime-DLiKoOkd.mjs +150 -0
  73. package/dist/{ios-signing-BcH88ecn.mjs → ios-signing-rWR_Mu5Z.mjs} +3 -3
  74. package/dist/{ios-state-Avwz2cbZ.mjs → ios-state-tzD0s7pt.mjs} +1 -1
  75. package/dist/{js-swap-Desu2iII.mjs → js-swap-Cuky0ZAQ.mjs} +60 -13
  76. package/dist/{launch-6ckG9UrC.mjs → launch-B-pkNlqg.mjs} +48 -28
  77. package/dist/{lightened-B6TnpHMX.mjs → lightened-KHWHmzGs.mjs} +5 -5
  78. package/dist/{logs-B-DMy1K0.mjs → logs-B0etn-BD.mjs} +7 -7
  79. package/dist/{logs-CO0CJRiC.mjs → logs-HomiqPhV.mjs} +6 -6
  80. package/dist/{macos-CduEmWAK.mjs → macos-C5liDnbP.mjs} +1 -1
  81. package/dist/macos-run.mjs +1 -1
  82. package/dist/{macos-B1aCXhem.mjs → macos-zMxSibx5.mjs} +22 -23
  83. package/dist/maintenance-run.mjs +6 -6
  84. package/dist/{metro-DM3yJL1M.mjs → metro-Cj6W4qOO.mjs} +4 -4
  85. package/dist/{metro-request-O8Q-JvBg.mjs → metro-request-BWCl3Zco.mjs} +2 -2
  86. package/dist/{prebuild-Di2IhUue.mjs → miss-reason-CeHvzeVm.mjs} +12 -272
  87. package/dist/{named-ports-BvB_CO9B.mjs → named-ports-DZ8DrkH1.mjs} +3 -3
  88. package/dist/{native-android-28NOG2-y.mjs → native-android-DtWLzg6g.mjs} +18 -18
  89. package/dist/{native-gradle-artifact-inputs-DxVEtS6_.mjs → native-gradle-artifact-inputs-D4w20_6d.mjs} +5 -5
  90. package/dist/{native-runtime-C3_NkUlW.mjs → native-runtime-BfvvAJLd.mjs} +6 -6
  91. package/dist/{native-source-ChAGj7R1.mjs → native-source-D2ZfiQ6U.mjs} +1 -1
  92. package/dist/{native-xcode-inputs-BWFTw5cJ.mjs → native-xcode-inputs-BHvnAq4o.mjs} +3 -3
  93. package/dist/{native-xcode-ios-B4Qoc7-U.mjs → native-xcode-ios-CYxrg_kK.mjs} +18 -19
  94. package/dist/offload-worker.mjs +23 -22
  95. package/dist/{operation-exec-DKlBcKAL.mjs → operation-exec-DNynwpqO.mjs} +1 -1
  96. package/dist/{ownership-C3y8wLSl.mjs → ownership-BLgOimfp.mjs} +3 -3
  97. package/dist/{page-Dj8IqvGM.mjs → page-CoN9al_x.mjs} +2 -2
  98. package/dist/{phone-reverses-BhSxbqom.mjs → phone-reverses-vRveZKSG.mjs} +4 -4
  99. package/dist/{placement-log-B8RCSzOm.mjs → placement-log-CM0DSELs.mjs} +1 -1
  100. package/dist/{plan-placement-BI4r55aP.mjs → plan-placement-CIrvKq8y.mjs} +6 -6
  101. package/dist/{ports-DhOSyWm9.mjs → ports-CKORWlC0.mjs} +3 -3
  102. package/dist/{project-Clk1JAWL.mjs → project-DIo71tGq.mjs} +16 -16
  103. package/dist/{pull-request-BpMTNkMB.mjs → pull-request-m8cMZ3aE.mjs} +2 -2
  104. package/dist/pull-requests.mjs +1 -1
  105. package/dist/{react-native-android-bdHBMrnf.mjs → react-native-android-B7VYSlKj.mjs} +41 -36
  106. package/dist/{react-native-build-CJega_NM.mjs → react-native-build-CFYTYmG4.mjs} +13 -10
  107. package/dist/{react-native-doctor-CY7BGITE.mjs → react-native-doctor-CnpVfE0k.mjs} +6 -6
  108. package/dist/{react-native-ios-Bo5EDVel.mjs → react-native-ios-ByeXo_NP.mjs} +18 -18
  109. package/dist/{recorded-build-BuGL_fnm.mjs → recorded-build-B4prJjSD.mjs} +20 -2
  110. package/dist/{recordings-6i2-x8LU.mjs → recordings-Byu5SzlI.mjs} +1 -1
  111. package/dist/{registration-DKjJGQ6p.mjs → registration-C-3PDR3X.mjs} +1 -1
  112. package/dist/{reload-BvDuvygc.mjs → reload-DANrKhQR.mjs} +1 -1
  113. package/dist/{reload-A_axEbeS.mjs → reload-DTd9g1EG.mjs} +16 -16
  114. package/dist/{remote-PD6CM0xp.mjs → remote-BWuq9qHV.mjs} +4 -4
  115. package/dist/{remote-WK_swZEw.mjs → remote-NOM82XE0.mjs} +10 -10
  116. package/dist/{result-BkDpN5Mz.mjs → result-C-ISEJ5F.mjs} +17 -17
  117. package/dist/{run-CTFi4Nq2.mjs → run-DQwx6djG.mjs} +2 -2
  118. package/dist/{server-bare-W0aPsRZE.mjs → server-bare-B_wRfchQ.mjs} +2 -2
  119. package/dist/{server-command-S00-ddjK.mjs → server-command-DgXYowQf.mjs} +6 -6
  120. package/dist/{server-expo-cc-cmfsl.mjs → server-expo-ByBM8DVv.mjs} +10 -8
  121. package/dist/server-expo-D7rwjAFp.mjs +2 -0
  122. package/dist/{settings-C_Xu4RNZ.mjs → settings-BthPoY3t.mjs} +2 -2
  123. package/dist/{settings-Bap-qjnp.mjs → settings-Cz8kQJzr.mjs} +49 -12
  124. package/dist/{settings-payload-D5jjhmrw.mjs → settings-payload-BOcxsZ6k.mjs} +5 -5
  125. package/dist/{settings-write-C5huI-iS.mjs → settings-write-BuMPL1rd.mjs} +6 -6
  126. package/dist/settings.schema.json +32 -2
  127. package/dist/{simslim-DlBvwgeF.mjs → simslim-BMgpTRWe.mjs} +2 -2
  128. package/dist/{slot-launch-qEQVTth7.mjs → slot-launch-BIm9w8kH.mjs} +6 -6
  129. package/dist/{stage-CxVI_MlP.mjs → stage-CX1Byp3n.mjs} +6 -5
  130. package/dist/{start-CVzivp35.mjs → start-BZWr85b2.mjs} +1 -1
  131. package/dist/{start-YpT_JpQQ.mjs → start-DI0ofPO-.mjs} +12 -12
  132. package/dist/{state-B4B5P4LU.mjs → state-45P8Kd6Z.mjs} +2 -2
  133. package/dist/{state-B9VFI6r0.mjs → state-C2vELPyr.mjs} +4 -4
  134. package/dist/{stats-COoePEri.mjs → stats-BDljWVWU.mjs} +5 -5
  135. package/dist/{stats-report-BVRCqwWA.mjs → stats-report-Ci6TAfFm.mjs} +1 -1
  136. package/dist/{status-CIvU5-TF.mjs → status-BG2S-a1d.mjs} +1 -1
  137. package/dist/{status-CQWmNl1f.mjs → status-C2PdxK6q.mjs} +1 -1
  138. package/dist/{status-CIg0k7Qb.mjs → status-DEZjHP4q.mjs} +32 -34
  139. package/dist/{status-watch--rfZynD_.mjs → status-watch-Cs18eFkQ.mjs} +5 -5
  140. package/dist/status-worker.mjs +1 -1
  141. package/dist/{stim-desktop-D0P_bzmd.mjs → stim-desktop-DWGAfaud.mjs} +2 -2
  142. package/dist/{stop-BiI4_VFG.mjs → stop-B2zDplJa.mjs} +2 -2
  143. package/dist/{stop-C3d5qG7C.mjs → stop-BPrTEOaz.mjs} +16 -16
  144. package/dist/{stop-BEBBruvD.mjs → stop-DrxHVVX9.mjs} +5 -5
  145. package/dist/supervisor-run.mjs +15 -15
  146. package/dist/{support-BJbXovoO.mjs → support-BeVRaMWT.mjs} +13 -14
  147. package/dist/{support-Vckdzrmk.mjs → support-DBKG3Yyb.mjs} +7 -7
  148. package/dist/{swiftpm-artifact-inputs-DbuF-Yrr.mjs → swiftpm-artifact-inputs-CfNAb6Vm.mjs} +4 -4
  149. package/dist/{swiftpm-macos-Bu8xeBfM.mjs → swiftpm-macos-xdHjJHIj.mjs} +11 -11
  150. package/dist/toolchain-CTsPS5tL.mjs +2 -0
  151. package/dist/{toolchain-DCnWAxQL.mjs → toolchain-CZvtCZ-m.mjs} +11 -8
  152. package/dist/trigger-Bp3lruF2.mjs +2 -0
  153. package/dist/{trigger-BtB4kbe0.mjs → trigger-G_gbfIVB.mjs} +2 -2
  154. package/dist/{warm-progress-DwsGBpph.mjs → warm-progress-D3a0KviW.mjs} +20 -16
  155. package/dist/{web-D2En0Wa5.mjs → web-BvAweypa.mjs} +9 -9
  156. package/dist/web-DDL3usMb.mjs +2 -0
  157. package/dist/web-run.mjs +8 -8
  158. package/dist/windows-report.mjs +1 -1
  159. package/dist/{workspace-state-BhwAJBgA.mjs → workspace-state-CHEN_xzy.mjs} +3 -3
  160. package/dist/{workspaces-Dh5N70qW.mjs → workspaces-BgAYIccE.mjs} +218 -54
  161. package/dist/{worktree-DLm4s2Ib.mjs → worktree-C0YZ6mnk.mjs} +1 -1
  162. package/dist/{worktree-Yw3EW77B.mjs → worktree-kGPE9Pcw.mjs} +339 -37
  163. package/package.json +7 -7
  164. package/dist/server-expo-BWJDa7Qb.mjs +0 -2
  165. package/dist/toolchain-CIRdNl-c.mjs +0 -2
  166. package/dist/trigger-D8B7QR0q.mjs +0 -2
  167. package/dist/web-Dpj70t4p.mjs +0 -2
@@ -1,11 +1,11 @@
1
- import { t as getExecutor } from "./exec-CGuDzt40.mjs";
2
- import { E as workspaceDir, k as workspaceLogsDir$1 } from "./workspace-state-BhwAJBgA.mjs";
3
- import { l as phaseLine } from "./command-output-T3cDctRE.mjs";
4
- import { W as parseMachine$1, dt as deviceSlotFileKey, vt as validateDeviceSlot } from "./config-BA3TgoIP.mjs";
5
- import { n as macosDir } from "./state-B4B5P4LU.mjs";
6
- import { n as androidLogGroups, r as isAndroidCrashText } from "./android-5wkcMFDG.mjs";
1
+ import { t as getExecutor } from "./exec-L37dbiIb.mjs";
2
+ import { E as workspaceDir, k as workspaceLogsDir$1 } from "./workspace-state-CHEN_xzy.mjs";
3
+ import { l as phaseLine } from "./command-output-DsjhOzJ3.mjs";
4
+ import { W as parseMachine$1, dt as deviceSlotFileKey, vt as validateDeviceSlot } from "./config-CNmN-ndb.mjs";
5
+ import { n as macosDir } from "./state-45P8Kd6Z.mjs";
6
+ import { n as androidLogGroups, r as isAndroidCrashText } from "./android-DGLG_VQ3.mjs";
7
7
  import { c as readNdjsonGenerations$1, i as createNdjsonWriter } from "./ndjson-CrjIsGzw.mjs";
8
- import { l as call } from "./hosted-client-DMOOu8vD.mjs";
8
+ import { l as call } from "./hosted-client-B_h_bTlz.mjs";
9
9
  import { mkdirSync, readFileSync, realpathSync, renameSync, rmSync, writeFileSync } from "node:fs";
10
10
  import { dirname, join } from "node:path";
11
11
  import { LOG_ROTATE_BYTES, ambientWrite, withDirLockAsync } from "@stim-cli/core";
@@ -39,6 +39,9 @@ function agentClientFiles() {
39
39
  }
40
40
  //#endregion
41
41
  //#region src/device-host/hosted-agent.ts
42
+ function hostedAgentLine(agent, machine) {
43
+ return "command" in agent ? agent.command : `Agent control is unavailable on ${machine}. On that machine, check \`hosting.agentDriver\` (\`agent-device\` enables it) and the installed agent-device version.`;
44
+ }
42
45
  /** Removes every driver's client file beside `file`, the placement's agent-device config path. */
43
46
  async function removeAgentAccess(file, keep) {
44
47
  for (const name of agentClientFiles()) {
@@ -54,15 +57,19 @@ async function removeAgentAccess(file, keep) {
54
57
  async function agentAccess(file, credential, grant, note, platform = "macos", relay = `Agent control of apps hosted on ${credential.machine} over the local network is relayed only for hosted iOS and Android Debug runs.`) {
55
58
  const machine = parseMachine$1(credential.machine);
56
59
  const local = machine?.transport === "local";
60
+ const parsed = grant === void 0 ? null : parseHostedAgentGrant(grant);
61
+ if (parsed?.driver === "none") note(hostedAgentLine({
62
+ driver: "none",
63
+ setting: "hosting.agentDriver"
64
+ }, credential.machine));
57
65
  if (local && typeof relay === "string") {
58
- if (grant !== void 0) note(relay);
66
+ if (grant !== void 0 && parsed?.driver !== "none") note(relay);
59
67
  await removeAgentAccess(file);
60
68
  return {
61
69
  driver: "none",
62
70
  setting: "hosting.agentDriver"
63
71
  };
64
72
  }
65
- const parsed = grant === void 0 ? null : parseHostedAgentGrant(grant);
66
73
  const issued = parsed && "token" in parsed ? parsed : null;
67
74
  const loaded = issued ? await agentDriverClient(issued.driver) : null;
68
75
  if (grant !== void 0 && !parsed || loaded && "unavailable" in loaded) note(`${credential.machine} offered agent control this Stim does not support.`);
@@ -244,4 +251,4 @@ function readHostedNativeLogs(root, platform, slot) {
244
251
  }));
245
252
  }
246
253
  //#endregion
247
- export { agentAccess as a, closeAgentConnection as i, pullHostedNativeLogs as n, removeAgentAccess as o, readHostedNativeLogs as r, pullHostedMacosLogs as t };
254
+ export { agentAccess as a, closeAgentConnection as i, pullHostedNativeLogs as n, hostedAgentLine as o, readHostedNativeLogs as r, removeAgentAccess as s, pullHostedMacosLogs as t };
@@ -1,8 +1,8 @@
1
- import { l as phaseLine } from "./command-output-T3cDctRE.mjs";
2
- import { n as pullHostedNativeLogs, r as readHostedNativeLogs, t as pullHostedMacosLogs } from "./hosted-logs-CClIktQM.mjs";
3
- import { u as connectHost } from "./hosted-client-DMOOu8vD.mjs";
4
- import { n as readHostedIos, t as readHostedAndroid } from "./ios-state-Avwz2cbZ.mjs";
5
- import "./hosted-macos-D4sDJIbB.mjs";
1
+ import { l as phaseLine } from "./command-output-DsjhOzJ3.mjs";
2
+ import { n as pullHostedNativeLogs, r as readHostedNativeLogs, t as pullHostedMacosLogs } from "./hosted-logs-BpQSRDRU.mjs";
3
+ import { u as connectHost } from "./hosted-client-B_h_bTlz.mjs";
4
+ import { n as readHostedIos, t as readHostedAndroid } from "./ios-state-tzD0s7pt.mjs";
5
+ import "./hosted-macos-GK4O1s7x.mjs";
6
6
  import { watch } from "node:fs";
7
7
  import { dirname, relative, resolve, sep } from "node:path";
8
8
  import { ambientWrite, configDir } from "@stim-cli/core";
@@ -1,9 +1,9 @@
1
- import { l as cancellableSleep } from "./exec-CGuDzt40.mjs";
2
- import { l as phaseLine } from "./command-output-T3cDctRE.mjs";
3
- import { a as agentAccess, i as closeAgentConnection, o as removeAgentAccess, t as pullHostedMacosLogs } from "./hosted-logs-CClIktQM.mjs";
4
- import { n as macosDir } from "./state-B4B5P4LU.mjs";
5
- import { _t as runCancellationSignal } from "./toolchain-DCnWAxQL.mjs";
6
- import { _ as sha256, a as RESERVE_TIMEOUT_MS, b as upload, c as bundleManifest, d as heldNoLonger, g as settle, i as PREPARE_TIMEOUT_MS, l as call, n as INSTALL_TIMEOUT_MS, o as SESSION_TIMEOUT_MS, p as hostedSession, s as attach, u as connectHost, v as stoppedSession, y as unknownSession } from "./hosted-client-DMOOu8vD.mjs";
1
+ import { l as cancellableSleep } from "./exec-L37dbiIb.mjs";
2
+ import { l as phaseLine } from "./command-output-DsjhOzJ3.mjs";
3
+ import { a as agentAccess, i as closeAgentConnection, s as removeAgentAccess, t as pullHostedMacosLogs } from "./hosted-logs-BpQSRDRU.mjs";
4
+ import { n as macosDir } from "./state-45P8Kd6Z.mjs";
5
+ import { mt as runCancellationSignal } from "./toolchain-CZvtCZ-m.mjs";
6
+ import { _ as sha256, a as RESERVE_TIMEOUT_MS, b as upload, c as bundleManifest, d as heldNoLonger, g as settle, i as PREPARE_TIMEOUT_MS, l as call, n as INSTALL_TIMEOUT_MS, o as SESSION_TIMEOUT_MS, p as hostedSession, s as attach, u as connectHost, v as stoppedSession, y as unknownSession } from "./hosted-client-B_h_bTlz.mjs";
7
7
  import { randomUUID } from "node:crypto";
8
8
  import { join } from "node:path";
9
9
  import { ambientContext, ambientWrite } from "@stim-cli/core";
@@ -1,11 +1,11 @@
1
- import { l as cancellableSleep, w as withDrainingCancellation } from "./exec-CGuDzt40.mjs";
2
- import { E as workspaceDir, l as withWorkspaceStateLockAsync, r as readWorkspaceState$1 } from "./workspace-state-BhwAJBgA.mjs";
3
- import { l as phaseLine } from "./command-output-T3cDctRE.mjs";
4
- import { a as agentAccess, i as closeAgentConnection, n as pullHostedNativeLogs, o as removeAgentAccess } from "./hosted-logs-CClIktQM.mjs";
5
- import { _t as runCancellationSignal } from "./toolchain-DCnWAxQL.mjs";
6
- import { _ as sha256, a as RESERVE_TIMEOUT_MS, b as upload, c as bundleManifest, d as heldNoLonger, g as settle, h as requireHostedAppMode, i as PREPARE_TIMEOUT_MS, l as call, n as INSTALL_TIMEOUT_MS, o as SESSION_TIMEOUT_MS, p as hostedSession, r as OFFER_TIMEOUT_MS, s as attach, t as IMAGE_INSTALL_TIMEOUT_MS, u as connectHost, v as stoppedSession, y as unknownSession } from "./hosted-client-DMOOu8vD.mjs";
7
- import { a as requestHostedMetro, n as closeHostedMetro, o as requireHostedMetro, r as hostedAgentPort } from "./metro-request-O8Q-JvBg.mjs";
8
- import { s as writeHostedNative } from "./ios-state-Avwz2cbZ.mjs";
1
+ import { l as cancellableSleep, w as withDrainingCancellation } from "./exec-L37dbiIb.mjs";
2
+ import { E as workspaceDir, l as withWorkspaceStateLockAsync, r as readWorkspaceState$1 } from "./workspace-state-CHEN_xzy.mjs";
3
+ import { l as phaseLine } from "./command-output-DsjhOzJ3.mjs";
4
+ import { a as agentAccess, i as closeAgentConnection, n as pullHostedNativeLogs, s as removeAgentAccess } from "./hosted-logs-BpQSRDRU.mjs";
5
+ import { mt as runCancellationSignal } from "./toolchain-CZvtCZ-m.mjs";
6
+ import { _ as sha256, a as RESERVE_TIMEOUT_MS, b as upload, c as bundleManifest, d as heldNoLonger, g as settle, h as requireHostedAppMode, i as PREPARE_TIMEOUT_MS, l as call, n as INSTALL_TIMEOUT_MS, o as SESSION_TIMEOUT_MS, p as hostedSession, r as OFFER_TIMEOUT_MS, s as attach, t as IMAGE_INSTALL_TIMEOUT_MS, u as connectHost, v as stoppedSession, y as unknownSession } from "./hosted-client-B_h_bTlz.mjs";
7
+ import { a as requestHostedMetro, n as closeHostedMetro, o as requireHostedMetro, r as hostedAgentPort } from "./metro-request-BWCl3Zco.mjs";
8
+ import { s as writeHostedNative } from "./ios-state-tzD0s7pt.mjs";
9
9
  import { randomUUID } from "node:crypto";
10
10
  import { readFileSync } from "node:fs";
11
11
  import { join } from "node:path";
@@ -1,4 +1,4 @@
1
- import { t as getExecutor } from "./exec-CGuDzt40.mjs";
1
+ import { t as getExecutor } from "./exec-L37dbiIb.mjs";
2
2
  //#region src/collector/ios.ts
3
3
  const MESSAGE_TYPE_LEVEL = {
4
4
  Debug: "debug",
@@ -1,9 +1,9 @@
1
- import { h as shortUdid, i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-T3cDctRE.mjs";
2
- import { Q as pickDevClientScheme, et as schemesFromInfoPlist } from "./toolchain-DCnWAxQL.mjs";
3
- import { f as podAction, h as resolveDeviceType, i as deviceLabel, m as resolveConfiguration, n as buildLogFile, s as iosConfigurationSetting, t as appNameFromPath, u as isReleaseConfiguration, v as resolveRuntime } from "./support-BJbXovoO.mjs";
4
- import { n as ensureWorkspaceStorageSafely } from "./native-runtime-C3_NkUlW.mjs";
5
- import { t as devClientScheme } from "./dev-client-MO_DjTZr.mjs";
6
- import { c as writeLastBuild, i as iosFacts, n as cacheDescription, o as lastBuildRecord } from "./ios-project-Cz0S1Sz-.mjs";
7
- import { d as replaceCollector, u as collectorEntry } from "./dependencies-LH-7k1Vr.mjs";
8
- import { n as registerIos, r as runIosOperation, t as iosCommand } from "./ios-BhpUWyN7.mjs";
1
+ import { h as shortUdid, i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-DsjhOzJ3.mjs";
2
+ import { Y as pickDevClientScheme, Z as schemesFromInfoPlist } from "./toolchain-CZvtCZ-m.mjs";
3
+ import { f as podAction, h as resolveDeviceType, i as deviceLabel, m as resolveConfiguration, n as buildLogFile, s as iosConfigurationSetting, t as appNameFromPath, u as isReleaseConfiguration, v as resolveRuntime } from "./support-BeVRaMWT.mjs";
4
+ import { n as ensureWorkspaceStorageSafely } from "./native-runtime-BfvvAJLd.mjs";
5
+ import { t as devClientScheme } from "./dev-client-DL5UtVdx.mjs";
6
+ import { c as writeLastBuild, i as iosFacts, n as cacheDescription, o as lastBuildRecord } from "./ios-project-Bsm-eqwv.mjs";
7
+ import { n as registerIos, r as runIosOperation, t as iosCommand } from "./ios-M7nRVb33.mjs";
8
+ import { d as replaceCollector, u as collectorEntry } from "./dependencies-oku1ZLep.mjs";
9
9
  export { appNameFromPath, buildLogFile, cacheDescription, collectorEntry, iosCommand as default, devClientScheme, deviceLabel, ensureWorkspaceStorageSafely, formatDuration, iosConfigurationSetting, iosFacts, isReleaseConfiguration, lastBuildRecord, phaseLine, pickDevClientScheme, podAction, registerIos, replaceCollector, resolveConfiguration, resolveDeviceType, resolveRuntime, runIosOperation, schemesFromInfoPlist, shortHash, shortUdid, writeLastBuild };
@@ -1,10 +1,10 @@
1
- import { f as WorkspaceProcessCleanupError, l as cancellableSleep, n as isTimeoutError, t as getExecutor } from "./exec-CGuDzt40.mjs";
1
+ import { f as WorkspaceProcessCleanupError, l as cancellableSleep, n as isTimeoutError, t as getExecutor } from "./exec-L37dbiIb.mjs";
2
2
  import { n as stripAnsi, r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
3
- import { it as formatBytes, v as loadConfig$1 } from "./config-BA3TgoIP.mjs";
4
- import { n as runOperationFileQuiet, t as runOperationFile } from "./operation-exec-DKlBcKAL.mjs";
5
- import { i as stimDesktopInstalledAsync, n as settingDefault, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-D0P_bzmd.mjs";
6
- import { Ot as recordCreatedDeviceAsync, Tt as forgetCreatedDeviceAsync, pt as isStimOwnedSim } from "./android-SJx1V3R3.mjs";
7
- import { n as signedTailFor } from "./apk-signed-tail-eZyXIrnc.mjs";
3
+ import { it as formatBytes, v as loadConfig$1 } from "./config-CNmN-ndb.mjs";
4
+ import { n as runOperationFileQuiet, t as runOperationFile } from "./operation-exec-DNynwpqO.mjs";
5
+ import { i as stimDesktopInstalledAsync, n as settingDefault, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-DWGAfaud.mjs";
6
+ import { Ot as recordCreatedDeviceAsync, Tt as forgetCreatedDeviceAsync, pt as isStimOwnedSim } from "./android-27_JgJ1T.mjs";
7
+ import { n as signedTailFor } from "./apk-signed-tail-DHMkXs4s.mjs";
8
8
  import { createHash } from "node:crypto";
9
9
  import { closeSync, existsSync, lstatSync, mkdtempSync, openSync, readSync, readdirSync, rmSync, writeFileSync } from "node:fs";
10
10
  import { tmpdir, totalmem } from "node:os";
@@ -932,7 +932,7 @@ async function resolveIosCreation({ deviceType, runtime } = {}) {
932
932
  deviceType,
933
933
  runtime
934
934
  });
935
- if (!pick) throw new Error("No matching simulator device type / runtime is installed. Install one via Xcode, or pass --device-type / --runtime.");
935
+ if (!pick) throw new Error(runtime && /^(?:iOS )?\d+\.\d+(?:\.\d+)?$/.test(runtime) && !runtimes.some((item) => iosRuntimeMatches(item, runtime)) ? `No installed simulator runtime matches "${runtime}". Retry with --runtime "${runtime}" --install-runtime on this named Mac, or run \`xcodebuild -downloadPlatform iOS -buildVersion ${runtime.replace(/^iOS /, "")} -architectureVariant ${process.arch === "arm64" ? "arm64" : "universal"}\` on it. Xcode Settings > Components lists available versions.` : "No matching simulator device type / runtime is installed. Install one via Xcode, or pass --device-type / --runtime.");
936
936
  return {
937
937
  deviceTypeId: pick.deviceTypeId,
938
938
  runtimeId: pick.runtimeId,
@@ -1013,6 +1013,16 @@ const CLEARED_CONTAINER_DIRS = [
1013
1013
  ];
1014
1014
  async function clearIosAppData(udid, bundleId, { defaultsPlist = null } = {}) {
1015
1015
  const exec = getExecutor();
1016
+ try {
1017
+ await exec.runFileAsync("xcrun", [
1018
+ "simctl",
1019
+ "terminate",
1020
+ udid,
1021
+ bundleId
1022
+ ], SIMCTL_OPTIONS);
1023
+ } catch (error) {
1024
+ if (!/found nothing to terminate/.test(error instanceof Error ? error.message : String(error))) throw error;
1025
+ }
1016
1026
  if (defaultsPlist) await exec.runFileAsync("xcrun", [
1017
1027
  "simctl",
1018
1028
  "spawn",
@@ -1166,9 +1176,12 @@ const LIST_RUNTIMES_OPTIONS = {
1166
1176
  function listIosRuntimes() {
1167
1177
  return parseIosRuntimes(getExecutor().runFile("xcrun", LIST_RUNTIMES_ARGS, LIST_RUNTIMES_OPTIONS));
1168
1178
  }
1169
- async function listIosRuntimesAsync({ signal, snapshot } = {}) {
1170
- if (snapshot?.runtimes) return snapshot.runtimes({ signal });
1171
- return parseIosRuntimes(await getExecutor().runFileAsync("xcrun", LIST_RUNTIMES_ARGS, {
1179
+ async function listIosRuntimesAsync({ signal, snapshot, operation } = {}) {
1180
+ if (snapshot?.runtimes) return snapshot.runtimes({
1181
+ signal,
1182
+ operation
1183
+ });
1184
+ return parseIosRuntimes(await runOperationFile(operation, getExecutor(), "xcrun", LIST_RUNTIMES_ARGS, {
1172
1185
  ...LIST_RUNTIMES_OPTIONS,
1173
1186
  signal
1174
1187
  }));
@@ -1,37 +1,77 @@
1
- import { a as recordWorkspaceUseAsync, k as workspaceLogsDir$1 } from "./workspace-state-BhwAJBgA.mjs";
2
- import { _ as stepTimer, g as stepClock, i as formatDuration, l as phaseLine } from "./command-output-T3cDctRE.mjs";
3
- import { dt as deviceSlotFileKey, ht as parseDeviceSlotOption, vt as validateDeviceSlot } from "./config-BA3TgoIP.mjs";
4
- import { B as publicUrlSetting, C as iosSigningIdentitySettingError, F as metroWarmupUrlSetting, N as metroPortSetting, S as iosSigningIdentitySetting, T as iosSigningIdentitySha1SettingError, a as SETTING_SHAPE_REMEDY, g as deviceReclaimIdleMinutesSetting, ot as tunnelModeSetting, v as iosLanHostSetting, w as iosSigningIdentitySha1Setting, y as iosLanHostSettingError, z as projectSettingsContextAsync } from "./settings-Bap-qjnp.mjs";
5
- import { t as NO_PROJECT_REFUSAL } from "./project-Clk1JAWL.mjs";
6
- import { bt as parkedMaxSetting, mt as POOL_SETTING_REMEDY } from "./android-SJx1V3R3.mjs";
7
- import { Hn as exitAfterFlush, Wn as runProcessOperation, dr as ownedSessionName, qt as binOnPath, yn as DEFAULT_METRO_PORT } from "./device-capacity-CpAVcKgq.mjs";
8
- import { $ as tapBuildLog, H as NO_BUILD_PROGRESS, Q as startBuildProgress, Z as runFailureRecord, et as thrownRunFailureRecord, lt as statsProjectKey$1, rt as createRunRecorder } from "./workspaces-Dh5N70qW.mjs";
9
- import { A as COMPILATION_CACHE_NOT_RUN, _t as runCancellationSignal, gt as runCancellation, lt as cancelledFailure, vt as withNativeBuildRun } from "./toolchain-DCnWAxQL.mjs";
10
- import { i as createIosSimSnapshot } from "./ios-BhfpRfNf.mjs";
1
+ import { a as recordWorkspaceUseAsync, k as workspaceLogsDir$1 } from "./workspace-state-CHEN_xzy.mjs";
2
+ import { _ as stepTimer, g as stepClock, i as formatDuration, l as phaseLine } from "./command-output-DsjhOzJ3.mjs";
3
+ import { dt as deviceSlotFileKey, ht as parseDeviceSlotOption, vt as validateDeviceSlot } from "./config-CNmN-ndb.mjs";
4
+ import { B as publicUrlSetting, C as iosSigningIdentitySettingError, F as metroWarmupUrlSetting, N as metroPortSetting, S as iosSigningIdentitySetting, T as iosSigningIdentitySha1SettingError, a as SETTING_SHAPE_REMEDY, g as deviceReclaimIdleMinutesSetting, it as settingValueAt, ot as tunnelModeSetting, v as iosLanHostSetting, w as iosSigningIdentitySha1Setting, y as iosLanHostSettingError, z as projectSettingsContextAsync } from "./settings-Cz8kQJzr.mjs";
5
+ import { t as NO_PROJECT_REFUSAL } from "./project-DIo71tGq.mjs";
6
+ import { bt as parkedMaxSetting, mt as POOL_SETTING_REMEDY } from "./android-27_JgJ1T.mjs";
7
+ import { Gn as exitAfterFlush, Sn as DEFAULT_METRO_PORT, Xt as binOnPath, mr as ownedSessionName, qn as runProcessOperation } from "./device-capacity-D_IlxZRL.mjs";
8
+ import { $ as startBuildProgress, Q as runFailureRecord, U as NO_BUILD_PROGRESS, et as tapBuildLog, it as createRunRecorder, tt as thrownRunFailureRecord, ut as statsProjectKey$1 } from "./workspaces-BgAYIccE.mjs";
9
+ import { D as COMPILATION_CACHE_NOT_RUN, ht as withNativeBuildRun, mt as runCancellationSignal, ot as cancelledFailure, pt as runCancellation } from "./toolchain-CZvtCZ-m.mjs";
10
+ import { i as createIosSimSnapshot } from "./ios-DQEzde6f.mjs";
11
11
  import { d as optimizationBuildProfile, l as artifactCachePolicy } from "./errors-DHm_U5gv.mjs";
12
- import { C as setRemoteLogSink, d as simulatorRuntime } from "./client-KSWIeQLA.mjs";
13
- import { N as parseBuildMachineOption, W as leaseExpiryText, X as waitFlagConflict, _ as resolveIosWait, a as deviceModelRefusal, b as resolveSimulatorAppFlag, c as iosProjectPathError, d as ownedSimFailure, g as resolveIosBuildSetup, h as resolveDeviceType, i as deviceLabel, m as resolveConfiguration, n as buildLogFile, r as createIosDeviceWaitRun, u as isReleaseConfiguration, v as resolveRuntime, x as simulatorBuildArch, y as resolveSchemeSelection } from "./support-BJbXovoO.mjs";
14
- import { i as hostedMetroSettings } from "./metro-request-O8Q-JvBg.mjs";
15
- import { i as writeDevicePlacementAsync } from "./ios-state-Avwz2cbZ.mjs";
16
- import { t as devClientPortBusy } from "./hosted-native-BiiUG_Q6.mjs";
17
- import { i as restoreLightenedDependencies, n as printLightenedFailure } from "./lightened-B6TnpHMX.mjs";
18
- import { r as isEasBuildFailure } from "./eas-build-Xf5Jd6LR.mjs";
19
- import { a as iosPoolCandidates, c as isWirelessIosDevice, f as resolveIosPhysicalDevice, o as iosPoolNoCandidatesRefusal, r as iosDeviceBounds } from "./ios-device-vhYL1N--.mjs";
20
- import { i as launchOutcomeRecord, r as isPhysicalDeviceRequest, t as ensureDevServer } from "./native-runtime-C3_NkUlW.mjs";
21
- import { t as lookupRecordedBuild } from "./recorded-build-BuGL_fnm.mjs";
22
- import "./dev-client-MO_DjTZr.mjs";
23
- import { t as didSetUpDevice } from "./device-BZWt_aPJ.mjs";
12
+ import { C as setRemoteLogSink, d as simulatorRuntime } from "./client-qwmHFSga.mjs";
13
+ import { N as parseBuildMachineOption, W as leaseExpiryText, X as waitFlagConflict, _ as resolveIosWait, a as deviceModelRefusal, b as resolveSimulatorAppFlag, c as iosProjectPathError, d as ownedSimFailure, g as resolveIosBuildSetup, h as resolveDeviceType, i as deviceLabel, m as resolveConfiguration, n as buildLogFile, r as createIosDeviceWaitRun, u as isReleaseConfiguration, v as resolveRuntime, x as simulatorBuildArch, y as resolveSchemeSelection } from "./support-BeVRaMWT.mjs";
14
+ import { i as hostedMetroSettings } from "./metro-request-BWCl3Zco.mjs";
15
+ import { i as writeDevicePlacementAsync } from "./ios-state-tzD0s7pt.mjs";
16
+ import { t as devClientPortBusy } from "./hosted-native-B6ur_0OJ.mjs";
17
+ import { i as restoreLightenedDependencies, n as printLightenedFailure } from "./lightened-KHWHmzGs.mjs";
18
+ import { r as isEasBuildFailure } from "./eas-build-4rg9WpEg.mjs";
19
+ import { a as iosPoolCandidates, c as isWirelessIosDevice, f as resolveIosPhysicalDevice, o as iosPoolNoCandidatesRefusal, r as iosDeviceBounds } from "./ios-device-BLm1BZB4.mjs";
20
+ import { i as launchOutcomeRecord, r as isPhysicalDeviceRequest, t as ensureDevServer } from "./native-runtime-BfvvAJLd.mjs";
21
+ import { t as lookupRecordedBuild } from "./recorded-build-B4prJjSD.mjs";
22
+ import "./dev-client-DL5UtVdx.mjs";
23
+ import { t as didSetUpDevice } from "./device-yfuJ-v4s.mjs";
24
24
  import { t as unsupportedPlan } from "./project-plan-BPwbLwQu.mjs";
25
- import { a as refusePlan, i as printPlan, n as planFlagRefusal } from "./build-plan-CeIooJqn.mjs";
26
- import { a as iosLedgerDevice, c as writeLastBuild, o as lastBuildRecord, s as reportIosResult } from "./ios-project-Cz0S1Sz-.mjs";
27
- import { n as acquireIosArtifactOrRecorded } from "./artifact-ubNdxo_K.mjs";
28
- import { a as hostedIosSelectors, i as hostedIosMetroNote, n as connectIosTarget, o as iosPlacementBudget, r as deviceRemoteConflict, s as selectIosPlacement, t as connectIosBackend } from "./remote-WK_swZEw.mjs";
29
- import { i as lanOriginUrlFor, l as verifyIosMetroRun, n as chooseLanAddress, o as finishIosRun, t as DEFAULT_DEPS } from "./dependencies-LH-7k1Vr.mjs";
25
+ import { a as refusePlan, i as printPlan, n as planFlagRefusal } from "./build-plan-DWajg5l_.mjs";
26
+ import { a as iosLedgerDevice, c as writeLastBuild, o as lastBuildRecord, s as reportIosResult } from "./ios-project-Bsm-eqwv.mjs";
27
+ import { n as acquireIosArtifactOrRecorded } from "./artifact-sGoFVK1q.mjs";
28
+ import { a as hostedIosSelectors, c as selectIosTarget, i as hostedIosMetroNote, n as connectIosTarget, o as iosPlacementBudget, r as deviceRemoteConflict, s as selectIosPlacement, t as connectIosBackend } from "./remote-NOM82XE0.mjs";
29
+ import { i as lanOriginUrlFor, l as verifyIosMetroRun, n as chooseLanAddress, o as finishIosRun, t as DEFAULT_DEPS } from "./dependencies-oku1ZLep.mjs";
30
30
  import { join } from "node:path";
31
31
  import { workspaceId } from "@stim-cli/core";
32
32
  import { hostedIosStatus, parseMachine } from "@stim-cli/core/state";
33
33
  import chalk from "chalk";
34
34
  import { InvalidArgumentError } from "commander";
35
+ //#region src/commands/ios/runtime.ts
36
+ async function installRequestedIosRuntime(args) {
37
+ const { targetRefusal, opts, settings, physical, runtime, d, progress, note, context } = args;
38
+ if (targetRefusal) return targetRefusal;
39
+ if (opts.installRuntime === true || !physical && runtime !== null && settingValueAt(settings, "ios.autoInstallRuntime") === true) {
40
+ const selected = selectIosTarget(args);
41
+ if ("failure" in selected) return selected.failure;
42
+ if (physical || selected.backend || selected.placement || selected.machine === "auto" || !runtime) return {
43
+ code: "STIM_BAD_ARG",
44
+ message: "Installing an iOS runtime requires an explicit runtime and a local or named Mac simulator target.",
45
+ remedy: "Pass --runtime <version> --install-runtime with --remote local or --remote <mac>; automatic placement, eas, proxy and physical phones do not install runtimes."
46
+ };
47
+ const recordedRuntime = selected.recorded?.device?.runtime;
48
+ if (recordedRuntime && recordedRuntime.replace(/^iOS /, "") !== runtime.replace(/^iOS /, "")) return {
49
+ code: "STIM_BAD_ARG",
50
+ message: `This workspace already records iOS ${recordedRuntime.replace(/^iOS /, "")} on ${selected.machine}; run stim stop first before installing another runtime.`,
51
+ remedy: "Run stim stop, then retry with the requested runtime."
52
+ };
53
+ const installSignal = runCancellationSignal(context) ?? context.signal;
54
+ progress.step("install");
55
+ if (selected.machine) progress.place({
56
+ host: selected.machine,
57
+ phase: "runtime-install"
58
+ });
59
+ try {
60
+ const installed = selected.machine ? await d.installHostedIosRuntime(selected.machine, runtime, note, installSignal) : await d.ensureIosRuntime({
61
+ requested: runtime,
62
+ signal: installSignal,
63
+ operation: context,
64
+ note
65
+ });
66
+ if (!installed.ok) return installed;
67
+ } finally {
68
+ progress.place(null);
69
+ progress.step("prepare");
70
+ }
71
+ }
72
+ return null;
73
+ }
74
+ //#endregion
35
75
  //#region src/commands/ios/hosted.ts
36
76
  async function finishHostedIosRun({ target, operation, d, artifact, root, slot, release, appMode, isExpo, metroCheck, metroPort, logsDir, fail, note, phase, enterPhase, enterActivity, selectors, projectBundleId, logWriter, ...report }) {
37
77
  const bundleId = artifact.bundleId ?? (await d.readBundleId(artifact.path) || await projectBundleId());
@@ -197,6 +237,7 @@ async function finishHostedIosRun({ target, operation, d, artifact, root, slot,
197
237
  function runOnlyFlag(opts) {
198
238
  if (isPhysicalDeviceRequest(opts.device)) return "--device";
199
239
  if (opts.remote) return "--remote";
240
+ if (opts.installRuntime) return "--install-runtime";
200
241
  if (opts.wait !== void 0) return opts.wait === false ? "--no-wait" : "--wait";
201
242
  if (opts.simulatorApp !== void 0) return "--simulator-app";
202
243
  if (opts.metroCheck === false) return "--no-metro-check";
@@ -238,7 +279,7 @@ function iosCommand(program) {
238
279
  registerIos(program);
239
280
  }
240
281
  function registerIos(program, deps = {}) {
241
- program.command("ios").description("Build (or restore from the fingerprint cache), install and launch this workspace's app on its owned simulator. React Native and Expo Debug runs start the dev server when it is not running.").option("--eas-profile <name>", "Download a matching EAS development build; on a miss, print the build command without running it").option("--slot <name>", "Reusable device slot within this workspace (default: default)", parseDeviceSlotOption).option("--remote-build <value>", "Build on local, auto, remote (remote machines first), remote-only (never here), or one named machine; a name refuses without fallback", parseBuildMachineOption).option("--json", "Emit the facts as a single JSON line on stdout; every other line goes to stderr").option("--plan", "Predict the next build without building, booting or installing: resolve the fingerprint, check the local then remote cache, and print the expected cache result and duration. Writes no Stim state.").option("--scheme <name>", "Shared Xcode app scheme to build; overrides automatic scheme selection, not the app URL scheme").option("--no-metro-check", "Skip the \"is this workspace's dev server running?\" check: do not start it, and build anyway").option("--no-build-cache", "Build fresh, ignoring cached artifacts (local and the project's build-cache provider); the fresh build still replaces the cache entry").option("--configuration <name>", "Xcode configuration to build (e.g. Release). A non-Debug configuration embeds the JS bundle and skips Metro entirely. Overrides the ios.configuration setting. Default: Debug").option("--device-type <name>", "Simulator model to create this workspace's owned sim as, exactly as `xcrun simctl list devicetypes` names it (e.g. \"iPad Pro 13-inch (M5)\"). Overrides the ios.deviceType setting for this invocation. A model no installed runtime can create refuses with STIM_BAD_ARG and prints the models they do offer.").option("--runtime <version>", "Simulator runtime to create this workspace's owned sim on, as a version (\"18.5\") or a runtime's full name (\"iOS 18.5\"); nothing else matches. Overrides the ios.runtime setting for this invocation. An unknown version refuses with STIM_BAD_ARG and prints the installed runtimes.").option("--simulator-app <app>", "Open the owned simulator in xcode, siniulator, or stim-desktop for this run, overriding the machine iosSimulatorApp setting. Also opens an already running simulator; local simulators only.").option("--device [udid]", "Build the iphoneos slice for a connected iPhone, install it, and launch it, instead of using this workspace's owned simulator. The phone can be cabled or paired over Wi-Fi. With no UDID, the first cabled device this workspace can lease is used, waiting for one that is busy; a Wi-Fi device is used only when no cabled one is connected and ready. In Debug the app is wired to this workspace's Metro over the LAN. Stim never creates, boots, or deletes a physical device.").option("--remote <target>", "Run on eas, proxy, or an approved Mac in remote.machines; named Macs never fall back locally. auto places on an approved Mac when this machine is full or busy. remote tries remote.machines in order first and runs here only when none takes it. remote-only never runs here. local runs here, whatever ios.remote says.", (value) => {
282
+ program.command("ios").description("Build (or restore from the fingerprint cache), install and launch this workspace's app on its owned simulator. React Native and Expo Debug runs start the dev server when it is not running.").option("--eas-profile <name>", "Download a matching EAS development build; on a miss, print the build command without running it").option("--slot <name>", "Reusable device slot within this workspace (default: default)", parseDeviceSlotOption).option("--remote-build <value>", "Build on local, auto, remote (remote machines first), remote-only (never here), or one named machine; a name refuses without fallback", parseBuildMachineOption).option("--json", "Emit the facts as a single JSON line on stdout; every other line goes to stderr").option("--plan", "Predict the next build without building, booting or installing: resolve the fingerprint, check the local then remote cache, and print the expected cache result and duration. Writes no Stim state.").option("--scheme <name>", "Shared Xcode app scheme to build; overrides automatic scheme selection, not the app URL scheme").option("--no-metro-check", "Skip the \"is this workspace's dev server running?\" check: do not start it, and build anyway").option("--no-build-cache", "Build fresh, ignoring cached artifacts (local and the project's build-cache provider); the fresh build still replaces the cache entry").option("--configuration <name>", "Xcode configuration to build (e.g. Release). A non-Debug configuration embeds the JS bundle and skips Metro entirely. Overrides the ios.configuration setting. Default: Debug").option("--device-type <name>", "Simulator model to create this workspace's owned sim as, exactly as `xcrun simctl list devicetypes` names it (e.g. \"iPad Pro 13-inch (M5)\"). Overrides the ios.deviceType setting for this invocation. A model no installed runtime can create refuses with STIM_BAD_ARG and prints the models they do offer.").option("--runtime <version>", "Simulator runtime to create this workspace's owned sim on, as a version (\"18.5\") or a runtime's full name (\"iOS 18.5\"); nothing else matches. Overrides the ios.runtime setting for this invocation. An unknown version refuses with STIM_BAD_ARG and prints the installed runtimes.").option("--install-runtime", "Install the explicitly requested missing iOS runtime with Xcode on the local or named approved Mac (about 8-10 GB; shared by all workspaces)").option("--simulator-app <app>", "Open the owned simulator in xcode, siniulator, or stim-desktop for this run, overriding the machine iosSimulatorApp setting. Also opens an already running simulator; local simulators only.").option("--device [udid]", "Build the iphoneos slice for a connected iPhone, install it, and launch it, instead of using this workspace's owned simulator. The phone can be cabled or paired over Wi-Fi. With no UDID, the first cabled device this workspace can lease is used, waiting for one that is busy; a Wi-Fi device is used only when no cabled one is connected and ready. In Debug the app is wired to this workspace's Metro over the LAN. Stim never creates, boots, or deletes a physical device.").option("--remote <target>", "Run on eas, proxy, or an approved Mac in remote.machines; named Macs never fall back locally. auto places on an approved Mac when this machine is full or busy. remote tries remote.machines in order first and runs here only when none takes it. remote-only never runs here. local runs here, whatever ios.remote says.", (value) => {
242
283
  if (parseMachine(value)) return value.trim();
243
284
  throw new InvalidArgumentError("expected eas, proxy, local, auto, remote, remote-only, or a remote Mac name");
244
285
  }).option("--wait <seconds>", "How long to wait for another workspace to release the phone it leases, before refusing with STIM_DEVICE_BUSY (default 60, 0 refuses at once). Without --device, wait for an owned-device slot (default 600 seconds; --no-wait refuses immediately).").option("--no-wait", "Install on a phone another workspace leases instead of waiting: this run takes no lease and, when both workspaces build the same app id, the install terminates the holder's running app. Without --device, refuse a full device cap or existing slot queue immediately.").action(async (opts) => {
@@ -312,13 +353,13 @@ function iosProjectTargetRefusal(project, { physical, easProfile, placement, rec
312
353
  };
313
354
  return null;
314
355
  }
315
- function iosArtifactTargetInputs({ udid, physical, remote, hosted, simulatorArch, lanAddress, metroPort, settings }) {
356
+ function iosArtifactTargetInputs({ udid, physical, remote, hosted, simulatorArch, configuration, lanAddress, metroPort, settings }) {
316
357
  return {
317
358
  target: {
318
359
  udid,
319
360
  destination: remote || hosted ? "generic/platform=iOS Simulator" : null,
320
361
  sdk: physical ? "iphoneos" : "iphonesimulator",
321
- arch: remote || hosted ? simulatorArch : null,
362
+ arch: remote || hosted || isReleaseConfiguration(configuration) ? simulatorArch : null,
322
363
  keyArch: simulatorArch,
323
364
  offloadRuntime: () => hosted?.choice.runtimeId ?? (remote ? null : simulatorRuntime(udid)),
324
365
  hostedArchitecture: hosted?.choice.architecture,
@@ -642,10 +683,25 @@ async function runIos(context, projectRoot, opts = {}, overrides = {}, progress
642
683
  scheme: buildScheme,
643
684
  configuration: builtConfiguration
644
685
  });
645
- const capabilityRefusal = iosProjectTargetRefusal(integration, {
686
+ const capabilityRefusal = await installRequestedIosRuntime({
687
+ targetRefusal: iosProjectTargetRefusal(integration, {
688
+ physical,
689
+ easProfile: opts.easProfile,
690
+ recordedRefusal: recordedLookup.refusal
691
+ }),
692
+ root,
693
+ slot,
694
+ release,
695
+ appMode,
696
+ metroCheck,
697
+ opts,
698
+ settings,
646
699
  physical,
647
- easProfile: opts.easProfile,
648
- recordedRefusal: recordedLookup.refusal
700
+ runtime,
701
+ d,
702
+ progress,
703
+ note,
704
+ context
649
705
  });
650
706
  if (capabilityRefusal) return fail(capabilityRefusal);
651
707
  const simSnapshot = createIosSimSnapshot();
@@ -1087,8 +1143,7 @@ async function runIos(context, projectRoot, opts = {}, overrides = {}, progress
1087
1143
  const simulatorArch = simulatorBuildArch({
1088
1144
  physical,
1089
1145
  remoteArch,
1090
- hostArch: d.hostSimulatorArch(),
1091
- configuration
1146
+ hostArch: d.hostSimulatorArch()
1092
1147
  });
1093
1148
  const acquiredArtifact = unlessCancelled(context, await acquireIosArtifactOrRecorded(recordedLookup.build, {
1094
1149
  context,
@@ -1110,6 +1165,7 @@ async function runIos(context, projectRoot, opts = {}, overrides = {}, progress
1110
1165
  remote: Boolean(remoteDevice),
1111
1166
  hosted: hostedTarget,
1112
1167
  simulatorArch,
1168
+ configuration,
1113
1169
  lanAddress,
1114
1170
  metroPort,
1115
1171
  settings
@@ -1177,7 +1233,10 @@ async function runIos(context, projectRoot, opts = {}, overrides = {}, progress
1177
1233
  startedAt,
1178
1234
  closeWriter: () => writer?.close(),
1179
1235
  devicePlacement,
1180
- recordRun,
1236
+ recordRun: (outcome) => recordRun({
1237
+ ...outcome,
1238
+ remoteDevice: true
1239
+ }),
1181
1240
  reclaimed,
1182
1241
  devServer,
1183
1242
  fail,
@@ -1251,6 +1310,7 @@ async function runIos(context, projectRoot, opts = {}, overrides = {}, progress
1251
1310
  lanAddress,
1252
1311
  lanOriginUrl,
1253
1312
  remoteDevice,
1313
+ cleanAppState: Boolean(opts.cleanAppState),
1254
1314
  bootPromise,
1255
1315
  bootDuration: () => bootDuration,
1256
1316
  bootPending: () => bootPending,
@@ -1265,7 +1325,10 @@ async function runIos(context, projectRoot, opts = {}, overrides = {}, progress
1265
1325
  lease: leaseHandle,
1266
1326
  releaseLease,
1267
1327
  devicePlacement,
1268
- recordRun,
1328
+ recordRun: (outcome) => recordRun({
1329
+ ...outcome,
1330
+ remoteDevice: Boolean(remoteDevice)
1331
+ }),
1269
1332
  reclaimed,
1270
1333
  devServer,
1271
1334
  enterPhase: progress.step,
@@ -1,6 +1,6 @@
1
- import { t as getExecutor } from "./exec-CGuDzt40.mjs";
2
- import { bn as INSTALL_ERROR, wn as appProcessFromPid } from "./device-capacity-CpAVcKgq.mjs";
3
- import { n as TOOL_ERROR_PREFIX } from "./ios-device-DLdEDWJj.mjs";
1
+ import { t as getExecutor } from "./exec-L37dbiIb.mjs";
2
+ import { Cn as INSTALL_ERROR, Dn as appProcessFromPid } from "./device-capacity-D_IlxZRL.mjs";
3
+ import { n as TOOL_ERROR_PREFIX } from "./ios-device-ygijU78G.mjs";
4
4
  import { mkdtempSync, readFileSync, rmSync } from "node:fs";
5
5
  import { tmpdir } from "node:os";
6
6
  import { join } from "node:path";
@@ -1,4 +1,4 @@
1
- import { t as getExecutor } from "./exec-CGuDzt40.mjs";
1
+ import { t as getExecutor } from "./exec-L37dbiIb.mjs";
2
2
  //#region src/collector/ios-device.ts
3
3
  const CONSOLE_ENV = { OS_ACTIVITY_DT_MODE: "enable" };
4
4
  const DEV_MENU_LAUNCH_ARGS = [
@@ -1,10 +1,10 @@
1
- import { w as workspaceAgentDeviceDir } from "./workspace-state-BhwAJBgA.mjs";
2
- import { i as formatDuration, l as phaseLine } from "./command-output-T3cDctRE.mjs";
3
- import { a as workspaceLinkLine } from "./stim-desktop-D0P_bzmd.mjs";
4
- import { Kn as UPLOAD_TIMEOUT_MS, Xn as isEasAuthFailureText, Yn as easAuthNote, qn as cacheLevel } from "./device-capacity-CpAVcKgq.mjs";
5
- import { X as recordFinishedBuild } from "./workspaces-Dh5N70qW.mjs";
6
- import { A as COMPILATION_CACHE_NOT_RUN, F as compilationCacheActivityLine } from "./toolchain-DCnWAxQL.mjs";
7
- import { i as deviceLabel } from "./support-BJbXovoO.mjs";
1
+ import { w as workspaceAgentDeviceDir } from "./workspace-state-CHEN_xzy.mjs";
2
+ import { i as formatDuration, l as phaseLine } from "./command-output-DsjhOzJ3.mjs";
3
+ import { a as workspaceLinkLine } from "./stim-desktop-DWGAfaud.mjs";
4
+ import { $n as isEasAuthFailureText, Qn as easAuthNote, Xn as cacheLevel, Yn as UPLOAD_TIMEOUT_MS } from "./device-capacity-D_IlxZRL.mjs";
5
+ import { Z as recordFinishedBuild } from "./workspaces-BgAYIccE.mjs";
6
+ import { D as COMPILATION_CACHE_NOT_RUN, M as compilationCacheActivityLine } from "./toolchain-CZvtCZ-m.mjs";
7
+ import { i as deviceLabel } from "./support-BeVRaMWT.mjs";
8
8
  import { buildDiagnostics } from "@stim-cli/core/state";
9
9
  import chalk from "chalk";
10
10
  //#region src/commands/ios/result.ts
@@ -0,0 +1,150 @@
1
+ import { D as ownership_claim_exports, T as process_identity_exports, l as cancellableSleep, t as getExecutor } from "./exec-L37dbiIb.mjs";
2
+ import { n as stripAnsi, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
3
+ import { u as getConcurrencyLimits } from "./config-CNmN-ndb.mjs";
4
+ import { t as runOperationFile } from "./operation-exec-DNynwpqO.mjs";
5
+ import { Ct as acquireBuildSlot, Et as releaseBuildSlot } from "./workspaces-BgAYIccE.mjs";
6
+ import { h as listIosRuntimesAsync, l as iosRuntimeMatches } from "./ios-DQEzde6f.mjs";
7
+ import { existsSync, statfsSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ import { configDir } from "@stim-cli/core";
10
+ //#region src/devices/ios-runtime.ts
11
+ const INSTALL_TIMEOUT_MS = 18e5;
12
+ const REQUIRED_FREE_BYTES = 20 * 1024 ** 3;
13
+ const RUNTIME_VERSION = /^(?:iOS )?(\d+\.\d+(?:\.\d+)?)$/;
14
+ const refuse = (message, remedy) => ({
15
+ ok: false,
16
+ code: "STIM_NO_DEVICE",
17
+ message,
18
+ remedy
19
+ });
20
+ /** Installs only an explicit missing iOS version; runtimes remain shared Xcode components, never Stim-owned devices. */
21
+ async function ensureIosRuntime({ requested, signal, operation, workerProcessGroup, note }) {
22
+ const version = RUNTIME_VERSION.exec(requested)?.[1];
23
+ if (!version) return {
24
+ ok: false,
25
+ code: "STIM_BAD_ARG",
26
+ message: "Runtime installation needs an exact iOS version, such as 26.5 or iOS 26.5.",
27
+ remedy: "Pass --runtime <major.minor[.patch]>."
28
+ };
29
+ const installed = async () => (await listIosRuntimesAsync({
30
+ signal,
31
+ operation
32
+ })).some((runtime) => iosRuntimeMatches(runtime, requested));
33
+ if (await installed()) return { ok: true };
34
+ if (process.platform !== "darwin") return refuse("iOS runtimes can be installed only on a Mac.", "Use --remote <mac> with an approved Mac.");
35
+ const manual = `xcodebuild -downloadPlatform iOS -buildVersion ${version} -architectureVariant ${process.arch === "arm64" ? "arm64" : "universal"}`;
36
+ const root = join(configDir(), "ios-runtime-install");
37
+ let held;
38
+ let waited = false;
39
+ while (!held) {
40
+ signal?.throwIfAborted();
41
+ try {
42
+ const attempt = (0, ownership_claim_exports.tryAcquireClaim)({
43
+ root,
44
+ mode: "exclusive",
45
+ label: "iOS runtime install",
46
+ details: { runtime: version }
47
+ });
48
+ held = attempt.acquired;
49
+ if (attempt.pending) (0, ownership_claim_exports.releaseClaim)(attempt.pending);
50
+ } catch (error) {
51
+ const failure = (0, ownership_claim_exports.claimFailure)(error, null);
52
+ if (failure) return {
53
+ ok: false,
54
+ ...failure
55
+ };
56
+ throw error;
57
+ }
58
+ if (!held) {
59
+ if (!waited) note("Waiting for another Stim iOS runtime installation on this Mac.");
60
+ waited = true;
61
+ await cancellableSleep(2e3, {
62
+ signal,
63
+ what: "iOS runtime installation"
64
+ });
65
+ }
66
+ }
67
+ const claim = held;
68
+ let unresolved = false;
69
+ let workerChild = false;
70
+ let slot;
71
+ try {
72
+ if (await installed()) return { ok: true };
73
+ const volume = existsSync("/Library/Developer/CoreSimulator") ? "/Library/Developer/CoreSimulator" : "/Library";
74
+ let free;
75
+ try {
76
+ const disk = statfsSync(volume);
77
+ free = disk.bavail * disk.bsize;
78
+ } catch (error) {
79
+ return refuse(`Cannot establish free disk space on ${volume}: ${error instanceof Error ? error.message : String(error)}`, "Check free space on the Mac before installing the runtime through Xcode.");
80
+ }
81
+ if (free < REQUIRED_FREE_BYTES) return refuse(`${(free / 1024 ** 3).toFixed(1)} GB free on ${volume}; installing iOS ${version} requires at least 20 GB for download and unpacking.`, "Free space on that volume, then retry. Stim does not delete shared runtimes.");
82
+ slot = await acquireBuildSlot({
83
+ max: getConcurrencyLimits().maxBuilds,
84
+ signal,
85
+ out: note
86
+ });
87
+ note(`Installing iOS ${version} with Xcode (typically 8-10 GB; actual size varies). This runtime is shared by every workspace on this Mac.`);
88
+ const reader = createLineReader((line) => {
89
+ if (line.trim()) note(stripAnsi(line).replace(/\r/g, "\n").slice(-1e3));
90
+ });
91
+ const heartbeat = setInterval(() => note(`Still installing iOS ${version}; Xcode downloads can take several minutes.`), 3e4);
92
+ heartbeat.unref();
93
+ try {
94
+ (0, ownership_claim_exports.markClaimChildPending)(held);
95
+ if (slot?.claim) (0, ownership_claim_exports.markClaimChildPending)(slot.claim);
96
+ await runOperationFile(operation, getExecutor(), "xcodebuild", [
97
+ "-downloadPlatform",
98
+ "iOS",
99
+ "-buildVersion",
100
+ version,
101
+ "-architectureVariant",
102
+ process.arch === "arm64" ? "arm64" : "universal"
103
+ ], {
104
+ timeoutMs: INSTALL_TIMEOUT_MS,
105
+ signal,
106
+ containProcessTree: true,
107
+ onSpawn: (child) => {
108
+ if (child.pid === void 0) return;
109
+ if (workerProcessGroup) {
110
+ workerChild = true;
111
+ (0, ownership_claim_exports.setClaimChild)(claim, claim.owner);
112
+ if (slot?.claim) (0, ownership_claim_exports.setClaimChild)(slot.claim, claim.owner);
113
+ } else {
114
+ const captured = (0, process_identity_exports.captureProcessIdentity)(child.pid);
115
+ if (!captured.ok) throw new Error(`Cannot record the Xcode runtime installer: ${captured.reason}`);
116
+ const identity = {
117
+ pid: child.pid,
118
+ processToken: captured.token
119
+ };
120
+ (0, ownership_claim_exports.setClaimChild)(claim, identity);
121
+ if (slot?.claim) (0, ownership_claim_exports.setClaimChild)(slot.claim, identity);
122
+ }
123
+ child.stdout?.on("data", (chunk) => reader.push(String(chunk).replace(/\r/g, "\n")));
124
+ child.stderr?.on("data", (chunk) => reader.push(String(chunk).replace(/\r/g, "\n")));
125
+ }
126
+ });
127
+ } catch (error) {
128
+ if (error instanceof Error && "reportCleanup" in error) {
129
+ unresolved = true;
130
+ throw error;
131
+ }
132
+ signal?.throwIfAborted();
133
+ return refuse(`Xcode could not install iOS ${version}: ${(error instanceof Error ? error.message : String(error)).slice(-4e3)}`, `Run \`${manual}\` on the simulator Mac for the full error. Xcode Settings > Components lists versions supported by its selected Xcode; update Xcode if the requested runtime is unsupported.`);
134
+ } finally {
135
+ clearInterval(heartbeat);
136
+ reader.flush();
137
+ if (!unresolved && !workerChild) (0, ownership_claim_exports.clearClaimChild)(held);
138
+ }
139
+ if (!await installed()) return refuse(`Xcode finished but iOS ${version} is not available in simctl.`, `Run \`xcrun simctl list runtimes\` and \`${manual}\` on the simulator Mac to inspect the installation.`);
140
+ note(`iOS ${version} is installed. Remove shared runtimes manually in Xcode Settings > Components when no workspace needs them.`);
141
+ return { ok: true };
142
+ } finally {
143
+ if (!unresolved && !workerChild) {
144
+ releaseBuildSlot(slot);
145
+ (0, ownership_claim_exports.releaseClaim)(held);
146
+ }
147
+ }
148
+ }
149
+ //#endregion
150
+ export { ensureIosRuntime as t };