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,7 +1,7 @@
1
- import { c as throwIfCancelled } from "./exec-VFRpu1iA.mjs";
2
- import { c as call, l as connectHost } from "./hosted-client-fHO8yqzc.mjs";
3
- import { i as requestHostedMetro } from "./metro-gateway-B6_PgD0L.mjs";
4
- import { a as stopHostedNative, i as prepareHostedNative, r as placeHostedNative } from "./hosted-native-CpDB3-PO.mjs";
1
+ import { c as throwIfCancelled } from "./exec-aULwtNly.mjs";
2
+ import { c as call, l as connectHost } from "./hosted-client-DDRm9hPJ.mjs";
3
+ import { i as requestHostedMetro } from "./metro-request-DXyKjVDF.mjs";
4
+ import { a as stopHostedNative, i as prepareHostedNative, r as placeHostedNative } from "./hosted-native-CDe33CSr.mjs";
5
5
  //#region src/device-host/hosted-android.ts
6
6
  async function prepareHostedAndroid(machine, selectors, recorded, mode) {
7
7
  return await prepareHostedNative(machine, selectors, recorded, "android", false, mode);
@@ -19,12 +19,11 @@ async function stopHostedAndroid(root, slot, signal) {
19
19
  async function reopenHostedAndroidMetro(root, placement, clientMetroPort, signal) {
20
20
  const host = await connectHost(placement.machine, void 0, true, signal);
21
21
  try {
22
- const gateway = await requestHostedMetro(root, placement.session, host.credential, signal);
22
+ await requestHostedMetro(root, placement.session, host.credential, signal);
23
23
  throwIfCancelled(signal, "reload");
24
24
  await call(host, "device-host.metro.open", {
25
25
  session: placement.session,
26
- clientMetroPort,
27
- ...gateway
26
+ clientMetroPort
28
27
  });
29
28
  } finally {
30
29
  host.connection.close();
@@ -1,7 +1,7 @@
1
- import { c as throwIfCancelled, o as cancellableSleep } from "./exec-VFRpu1iA.mjs";
2
- import { at as resolveEndpoint } from "./config-BktkY_zC.mjs";
3
- import { t as BuildConnection } from "./client-D9CaRks-.mjs";
4
- import { m as configuredMachines } from "./selection-BNPBZ6T5.mjs";
1
+ import { c as throwIfCancelled, o as cancellableSleep } from "./exec-aULwtNly.mjs";
2
+ import { Y as diagnoseConnectFailure, ot as resolveEndpoint } from "./config-Cn94Jc0g.mjs";
3
+ import { t as BuildConnection } from "./client-YxCer6ab.mjs";
4
+ import { g as configuredMachines } from "./selection-CXgM_VK_.mjs";
5
5
  import { createHash } from "node:crypto";
6
6
  import { lstatSync, readFileSync, readdirSync, readlinkSync } from "node:fs";
7
7
  import { join } from "node:path";
@@ -42,6 +42,11 @@ function hostingCredential(machine) {
42
42
  }
43
43
  return credential;
44
44
  }
45
+ function turnedAway(machine, opened) {
46
+ if (opened.code === "server-outdated") return `${machine} runs a stim-server that speaks an older protocol than this Stim. Run stim doctor for the command that updates it there, then retry.`;
47
+ if (opened.refused) return `${machine} refused this machine: ${opened.failure.replace(/\.+$/, "")}. Run stim doctor.`;
48
+ return null;
49
+ }
45
50
  /** Connects only to the stim-server that proves it holds the approved machine's pinned key, and only for `device-host`. */
46
51
  async function connectHost(machine, timeoutMs = CONNECT_TIMEOUT_MS, strict = false, signal) {
47
52
  signal?.throwIfAborted();
@@ -54,34 +59,60 @@ async function connectHost(machine, timeoutMs = CONNECT_TIMEOUT_MS, strict = fal
54
59
  });
55
60
  if (signal?.aborted && opened instanceof BuildConnection) opened.close();
56
61
  signal?.throwIfAborted();
57
- if (!(opened instanceof BuildConnection)) throw Object.assign(/* @__PURE__ */ new Error(opened.code === "server-outdated" ? `${machine} runs a stim-server that speaks an older protocol than this Stim. Run stim doctor for the command that updates it there, then retry.` : opened.refused ? `${machine} refused this machine: ${opened.failure.replace(/\.+$/, "")}. Run stim doctor.` : `${machine} is unreachable: ${opened.failure}. Run stim doctor to see which layer failed.`), {
58
- code: strict ? "STIM_HOSTING_REFUSED" : opened.refused ? "STIM_HOSTING_REFUSED" : opened.code ?? "closed",
59
- hostCode: opened.code
60
- });
62
+ if (!(opened instanceof BuildConnection)) {
63
+ const refusal = turnedAway(machine, opened);
64
+ const diagnosis = refusal === null ? await diagnoseConnectFailure(machine, opened, signal) : null;
65
+ throw Object.assign(new Error(refusal ?? diagnosis?.message ?? `${machine} is unreachable: ${opened.failure}. Run stim doctor to see which layer failed.`), {
66
+ code: strict ? "STIM_HOSTING_REFUSED" : opened.refused ? "STIM_HOSTING_REFUSED" : opened.code ?? "closed",
67
+ hostCode: opened.code,
68
+ ...diagnosis ? { remedy: diagnosis.remedy } : {}
69
+ });
70
+ }
61
71
  return {
62
72
  machine,
63
73
  credential,
64
74
  connection: opened
65
75
  };
66
76
  }
77
+ /**
78
+ * Opens `device-host` connections to `machine` for a caller that retries on its own, as `connectHost` does but without
79
+ * diagnosing failures, resolving the machine's address again only after one fails. Only a failure a retry cannot fix,
80
+ * such as a refusal or a missing approval, carries a `STIM_` code; Tailscale not running or not listing the machine is
81
+ * worth retrying.
82
+ */
83
+ function hostConnector(machine) {
84
+ let resolving;
85
+ return async () => {
86
+ const credential = hostingCredential(machine);
87
+ const pending = resolving ??= resolveEndpoint(credential);
88
+ const target = await pending.catch((error) => {
89
+ if (resolving === pending) resolving = void 0;
90
+ throw error;
91
+ });
92
+ if (typeof target === "string") {
93
+ if (resolving === pending) resolving = void 0;
94
+ throw Object.assign(/* @__PURE__ */ new Error(`Stim does not connect to ${machine}: ${target}.`), { code: "closed" });
95
+ }
96
+ const opened = await BuildConnection.open(target, credential.serverKey, CONNECT_TIMEOUT_MS, "device-host").catch((error) => ({
97
+ failure: error instanceof Error ? error.message : String(error),
98
+ refused: false
99
+ }));
100
+ if (opened instanceof BuildConnection) return opened;
101
+ const refusal = turnedAway(machine, opened);
102
+ if (refusal !== null) throw credentialRefusal(refusal);
103
+ if (resolving === pending) resolving = void 0;
104
+ throw Object.assign(/* @__PURE__ */ new Error(`${machine} is unreachable: ${opened.failure}. Run stim doctor to see which layer failed.`), { code: opened.code ?? "closed" });
105
+ };
106
+ }
67
107
  function requireHostedAppMode(host, platform, mode) {
68
108
  if (mode !== "process") return;
69
109
  if (!host.connection.supports(platform === "ios" ? "hosted-ios-process" : "hosted-android-process")) throw credentialRefusal(`${host.machine} does not support hosted ${platform} process apps.`, `Update stim-server on ${host.machine} to a version supporting hosted ${platform} process apps, then retry.`);
70
110
  }
71
- const gatewaySecrets = /* @__PURE__ */ new WeakMap();
72
- function redactHostText(host, message) {
73
- const secret = gatewaySecrets.get(host);
74
- return secret ? message.replaceAll(secret, "[redacted]") : message;
75
- }
76
111
  async function call(host, method, params, timeoutMs) {
77
- if (method === "device-host.metro.open" && isJsonObject(params) && typeof params.secret === "string") gatewaySecrets.set(host, params.secret);
78
112
  const reply = await host.connection.request(method, params, timeoutMs);
79
- if ("error" in reply) throw Object.assign(/* @__PURE__ */ new Error(`${host.machine} refused ${method}: ${redactHostText(host, reply.error.message)}`), { code: reply.error.code });
113
+ if ("error" in reply) throw Object.assign(/* @__PURE__ */ new Error(`${host.machine} refused ${method}: ${reply.error.message}`), { code: reply.error.code });
80
114
  if (!isJsonObject(reply.result)) throw new Error(`${host.machine} answered ${method} without a result.`);
81
- return typeof reply.result.notice === "string" ? {
82
- ...reply.result,
83
- notice: redactHostText(host, reply.result.notice)
84
- } : reply.result;
115
+ return reply.result;
85
116
  }
86
117
  function hostedSession(host, value, platform = "macos") {
87
118
  if (typeof value.id !== "string" || typeof value.state !== "string" || value.platform !== platform) throw new Error(`${host.machine} answered with a session that is not a hosted ${platform} session.`);
@@ -222,4 +253,4 @@ async function upload(host, ids, missing, content) {
222
253
  }
223
254
  }
224
255
  //#endregion
225
- export { unknownSession as _, SESSION_TIMEOUT_MS as a, call as c, hostedSession as d, probeHostedSession as f, stoppedSession as g, sha256 as h, RESERVE_TIMEOUT_MS as i, connectHost as l, settle as m, OFFER_TIMEOUT_MS as n, attach as o, requireHostedAppMode as p, PREPARE_TIMEOUT_MS as r, bundleManifest as s, INSTALL_TIMEOUT_MS as t, heldNoLonger as u, upload as v };
256
+ export { stoppedSession as _, SESSION_TIMEOUT_MS as a, call as c, hostConnector as d, hostedSession as f, sha256 as g, settle as h, RESERVE_TIMEOUT_MS as i, connectHost as l, requireHostedAppMode as m, OFFER_TIMEOUT_MS as n, attach as o, probeHostedSession as p, PREPARE_TIMEOUT_MS as r, bundleManifest as s, INSTALL_TIMEOUT_MS as t, heldNoLonger as u, unknownSession as v, upload as y };
@@ -1,11 +1,11 @@
1
- import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { E as workspaceDir, k as workspaceLogsDir$1 } from "./workspace-state-pUg3_RRA.mjs";
3
- import { B as deviceSlotFileKey, nt as parseMachine$1, q as validateDeviceSlot } from "./config-BktkY_zC.mjs";
4
- import { l as phaseLine } from "./command-output-BF5AR2dL.mjs";
5
- import { n as macosDir } from "./state-C4OdpOTF.mjs";
6
- import { n as androidLogGroups, r as isAndroidCrashText } from "./android-B5P81yI-.mjs";
7
- import { r as createNdjsonWriter, s as readNdjsonGenerations$1 } from "./ndjson-CgE_o3Dl.mjs";
8
- import { c as call } from "./hosted-client-fHO8yqzc.mjs";
1
+ import { t as getExecutor } from "./exec-aULwtNly.mjs";
2
+ import { E as workspaceDir, k as workspaceLogsDir$1 } from "./workspace-state-kIZrdlSg.mjs";
3
+ import { B as deviceSlotFileKey, q as validateDeviceSlot, rt as parseMachine$1 } from "./config-Cn94Jc0g.mjs";
4
+ import { l as phaseLine } from "./command-output-C8R1KIvi.mjs";
5
+ import { n as macosDir } from "./state-BXC1Lfxw.mjs";
6
+ import { n as androidLogGroups, r as isAndroidCrashText } from "./android-D577ApKG.mjs";
7
+ import { c as readNdjsonGenerations$1, i as createNdjsonWriter } from "./ndjson-Dy2W4vRa.mjs";
8
+ import { c as call } from "./hosted-client-DDRm9hPJ.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";
@@ -1,8 +1,8 @@
1
- import { n as pullHostedNativeLogs, r as readHostedNativeLogs, t as pullHostedMacosLogs } from "./hosted-logs-BfbmDM4M.mjs";
2
- import { l as phaseLine } from "./command-output-BF5AR2dL.mjs";
3
- import { l as connectHost } from "./hosted-client-fHO8yqzc.mjs";
4
- import { n as readHostedIos, t as readHostedAndroid } from "./ios-state-Cw7-WQf2.mjs";
5
- import "./hosted-macos-CPl0OZ9h.mjs";
1
+ import { n as pullHostedNativeLogs, r as readHostedNativeLogs, t as pullHostedMacosLogs } from "./hosted-logs-bSebOKbz.mjs";
2
+ import { l as phaseLine } from "./command-output-C8R1KIvi.mjs";
3
+ import { l as connectHost } from "./hosted-client-DDRm9hPJ.mjs";
4
+ import { n as readHostedIos, t as readHostedAndroid } from "./ios-state-BPHqMDdZ.mjs";
5
+ import "./hosted-macos-B7-8Pv4H.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 { o as cancellableSleep } from "./exec-VFRpu1iA.mjs";
2
- import { a as agentAccess, i as closeAgentConnection, o as removeAgentAccess, t as pullHostedMacosLogs } from "./hosted-logs-BfbmDM4M.mjs";
3
- import { l as phaseLine } from "./command-output-BF5AR2dL.mjs";
4
- import { n as macosDir } from "./state-C4OdpOTF.mjs";
5
- import { d as runCancellationSignal } from "./native-run-BfIDFKLH.mjs";
6
- import { _ as unknownSession, a as SESSION_TIMEOUT_MS, c as call, d as hostedSession, g as stoppedSession, h as sha256, i as RESERVE_TIMEOUT_MS, l as connectHost, m as settle, o as attach, r as PREPARE_TIMEOUT_MS, s as bundleManifest, t as INSTALL_TIMEOUT_MS, u as heldNoLonger, v as upload } from "./hosted-client-fHO8yqzc.mjs";
1
+ import { o as cancellableSleep } from "./exec-aULwtNly.mjs";
2
+ import { a as agentAccess, i as closeAgentConnection, o as removeAgentAccess, t as pullHostedMacosLogs } from "./hosted-logs-bSebOKbz.mjs";
3
+ import { l as phaseLine } from "./command-output-C8R1KIvi.mjs";
4
+ import { n as macosDir } from "./state-BXC1Lfxw.mjs";
5
+ import { ot as runCancellationSignal } from "./toolchain-mLA_km-b.mjs";
6
+ import { _ as stoppedSession, a as SESSION_TIMEOUT_MS, c as call, f as hostedSession, g as sha256, h as settle, i as RESERVE_TIMEOUT_MS, l as connectHost, o as attach, r as PREPARE_TIMEOUT_MS, s as bundleManifest, t as INSTALL_TIMEOUT_MS, u as heldNoLonger, v as unknownSession, y as upload } from "./hosted-client-DDRm9hPJ.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,10 +1,10 @@
1
- import { o as cancellableSleep } from "./exec-VFRpu1iA.mjs";
2
- import { E as workspaceDir, l as withWorkspaceStateLockAsync, r as readWorkspaceState$1 } from "./workspace-state-pUg3_RRA.mjs";
3
- import { a as agentAccess, i as closeAgentConnection, n as pullHostedNativeLogs, o as removeAgentAccess } from "./hosted-logs-BfbmDM4M.mjs";
4
- import { d as runCancellationSignal } from "./native-run-BfIDFKLH.mjs";
5
- import { _ as unknownSession, a as SESSION_TIMEOUT_MS, c as call, d as hostedSession, g as stoppedSession, h as sha256, i as RESERVE_TIMEOUT_MS, l as connectHost, m as settle, n as OFFER_TIMEOUT_MS, o as attach, p as requireHostedAppMode, r as PREPARE_TIMEOUT_MS, s as bundleManifest, t as INSTALL_TIMEOUT_MS, u as heldNoLonger, v as upload } from "./hosted-client-fHO8yqzc.mjs";
6
- import { a as requireHostedMetro, i as requestHostedMetro, n as closeHostedMetro } from "./metro-gateway-B6_PgD0L.mjs";
7
- import { s as writeHostedNative } from "./ios-state-Cw7-WQf2.mjs";
1
+ import { o as cancellableSleep, x as withDrainingCancellation } from "./exec-aULwtNly.mjs";
2
+ import { E as workspaceDir, l as withWorkspaceStateLockAsync, r as readWorkspaceState$1 } from "./workspace-state-kIZrdlSg.mjs";
3
+ import { a as agentAccess, i as closeAgentConnection, n as pullHostedNativeLogs, o as removeAgentAccess } from "./hosted-logs-bSebOKbz.mjs";
4
+ import { ot as runCancellationSignal } from "./toolchain-mLA_km-b.mjs";
5
+ import { _ as stoppedSession, a as SESSION_TIMEOUT_MS, c as call, f as hostedSession, g as sha256, h as settle, i as RESERVE_TIMEOUT_MS, l as connectHost, m as requireHostedAppMode, n as OFFER_TIMEOUT_MS, o as attach, r as PREPARE_TIMEOUT_MS, s as bundleManifest, t as INSTALL_TIMEOUT_MS, u as heldNoLonger, v as unknownSession, y as upload } from "./hosted-client-DDRm9hPJ.mjs";
6
+ import { a as requireHostedMetro, i as requestHostedMetro, n as closeHostedMetro } from "./metro-request-DXyKjVDF.mjs";
7
+ import { s as writeHostedNative } from "./ios-state-BPHqMDdZ.mjs";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { readFileSync } from "node:fs";
10
10
  import { join } from "node:path";
@@ -124,14 +124,25 @@ function hostedMetroPortProbe(machine, note) {
124
124
  return !window.busy.has(port);
125
125
  };
126
126
  }
127
- async function placeHostedNative(target, { root, slot, bundle, handoff, bundleId, selectors, release, mode = release ? "release" : "development", devClientScheme, reserved, note, enterPhase = () => {}, metro = requestHostedMetro, metroPort, platform = "ios" }) {
127
+ function placeHostedNative(target, options) {
128
+ const context = ambientContext();
129
+ return withDrainingCancellation(context, runCancellationSignal(context), () => placeHostedNativeOnce(target, options));
130
+ }
131
+ async function placeHostedNativeOnce(target, { root, slot, bundle, handoff, bundleId, selectors, release, mode = release ? "release" : "development", devClientScheme, reserved, note, enterPhase = () => {}, metro = requestHostedMetro, metroPort, platform = "ios" }) {
128
132
  let host = target.host;
133
+ const signal = runCancellationSignal(ambientContext());
134
+ const closeOnAbort = () => host.connection.close();
135
+ signal?.addEventListener("abort", closeOnAbort, { once: true });
129
136
  try {
130
137
  if (mode === "development" && metro === requestHostedMetro) requireHostedMetro(root);
131
138
  enterPhase("device");
132
- host = await connectHost(host.machine, void 0, true);
139
+ host = await connectHost(host.machine, void 0, true, signal);
133
140
  target.host = host;
134
141
  requireHostedAppMode(host, platform, mode);
142
+ if (mode === "development" && !host.connection.supports("hosted-metro-link")) throw Object.assign(/* @__PURE__ */ new Error(`${host.machine} runs a stim-server that cannot link Metro.`), {
143
+ code: "STIM_HOSTING_REFUSED",
144
+ remedy: `Update stim-server on ${host.machine}, then retry.`
145
+ });
135
146
  let session = (target.session ? await attach(host, target.session.id, void 0, platform) : null) ?? await reserveHostedNative(host, target, {
136
147
  platform,
137
148
  workspace: root,
@@ -167,10 +178,9 @@ async function placeHostedNative(target, { root, slot, bundle, handoff, bundleId
167
178
  };
168
179
  await reserved(placement);
169
180
  if (mode === "development") {
170
- const gateway = await metro(root, session.id, host.credential);
181
+ await metro(root, session.id, host.credential);
171
182
  await call(host, "device-host.metro.open", {
172
183
  session: session.id,
173
- ...gateway,
174
184
  ...platform === "android" || devClientScheme ? { clientMetroPort: metroPort } : {}
175
185
  }).catch((error) => {
176
186
  if (platform === "ios" && devClientScheme && error.code === "device-busy") throw Object.assign(error, { remedy: devClientPortRemedy(host.machine) });
@@ -266,6 +276,7 @@ async function placeHostedNative(target, { root, slot, bundle, handoff, bundleId
266
276
  } catch (error) {
267
277
  throw hostingRefusal(host.machine, error);
268
278
  } finally {
279
+ signal?.removeEventListener("abort", closeOnAbort);
269
280
  if (platform === "android") host.connection.close();
270
281
  }
271
282
  }
@@ -286,13 +297,6 @@ async function stopHostedNative(root, slot, signal, platform = "ios") {
286
297
  signal?.addEventListener("abort", cancel, { once: true });
287
298
  try {
288
299
  host = await connectHost(placement.machine, void 0, false, signal);
289
- try {
290
- await pullHostedNativeLogs(root, name, placement, host, true, platform, signal);
291
- } catch (error) {
292
- signal?.throwIfAborted();
293
- ambientWrite("stderr", `Could not copy final native logs from ${placement.machine}: ${error.message}\n`);
294
- }
295
- signal?.throwIfAborted();
296
300
  const stopped = await settle(host, hostedSession(host, await call(host, "device-host.stop", { session: placement.session }), platform), ["stopping"], SESSION_TIMEOUT_MS, platform, signal);
297
301
  signal?.throwIfAborted();
298
302
  if (stopped.state !== "stopped") throw unknownSession(host, stopped);
@@ -1,12 +1,11 @@
1
- import { k as workspaceLogsDir$1, r as readWorkspaceState$1, s as updateWorkspaceStateAsync } from "./workspace-state-pUg3_RRA.mjs";
2
- import { V as deviceSlotKey, _ as loadConfig$1 } from "./config-BktkY_zC.mjs";
3
- import { o as formatLongDuration } from "./command-output-BF5AR2dL.mjs";
4
- import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
5
- import { P as workspaceBuildInProgress, k as collectOwnedDeviceActivity } from "./budget-k2mZGvvk.mjs";
1
+ import { k as workspaceLogsDir$1, r as readWorkspaceState$1, s as updateWorkspaceStateAsync } from "./workspace-state-kIZrdlSg.mjs";
2
+ import { V as deviceSlotKey, _ as loadConfig$1 } from "./config-Cn94Jc0g.mjs";
3
+ import { o as formatLongDuration } from "./command-output-C8R1KIvi.mjs";
4
+ import { i as createNdjsonWriter } from "./ndjson-Dy2W4vRa.mjs";
5
+ import { B as workspaceBuildInProgress, P as collectOwnedDeviceActivity, ht as teardownOwnedIosSim, pt as teardownOwnedAvd } from "./workspaces-CmOcceDN.mjs";
6
6
  import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
7
- import { A as teardownOwnedIosSim, O as teardownOwnedAvd } from "./workspaces-g2lhdBXF.mjs";
8
- import { _ as workspaceDeviceLastUseAt } from "./activity-Lnb_EoRY.mjs";
9
- import { d as listAllIosSims } from "./ios-WxpDJ5T1.mjs";
7
+ import { _ as workspaceDeviceLastUseAt } from "./activity-DRMg4_mD.mjs";
8
+ import { d as listAllIosSims } from "./ios-B1DYuOjh.mjs";
10
9
  import { join } from "node:path";
11
10
  import { LOG_ROTATE_BYTES } from "@stim-cli/core";
12
11
  import { DEVICE_IDLE_SHUTDOWN_KEY, DEVICE_RECLAIM_REASON, readDeviceIdleShutdowns } from "@stim-cli/core/state";
@@ -1,10 +1,10 @@
1
- import { l as WorkspaceProcessCleanupError, n as isTimeoutError, o as cancellableSleep, t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { P as formatBytes, _ as loadConfig$1 } from "./config-BktkY_zC.mjs";
1
+ import { l as WorkspaceProcessCleanupError, n as isTimeoutError, o as cancellableSleep, t as getExecutor } from "./exec-aULwtNly.mjs";
2
+ import { P as formatBytes, _ as loadConfig$1 } from "./config-Cn94Jc0g.mjs";
3
3
  import { n as stripAnsi, r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
4
- import { n as runOperationFileQuiet, t as runOperationFile } from "./operation-exec-CUZifp6Z.mjs";
5
- import { i as stimDesktopInstalledAsync, n as settingDefault, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-6Dqp-gjX.mjs";
6
- import { Ct as forgetCreatedDeviceAsync, Et as recordCreatedDeviceAsync, dt as isStimOwnedSim } from "./android-DTAcRwBC.mjs";
7
- import { n as signedTailFor } from "./apk-signed-tail-B46U9hXc.mjs";
4
+ import { n as runOperationFileQuiet, t as runOperationFile } from "./operation-exec-Dp4FuIGR.mjs";
5
+ import { i as stimDesktopInstalledAsync, n as settingDefault, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-CbWo21kb.mjs";
6
+ import { Ct as forgetCreatedDeviceAsync, Et as recordCreatedDeviceAsync, dt as isStimOwnedSim } from "./android-CsPs-7Mg.mjs";
7
+ import { n as signedTailFor } from "./apk-signed-tail-CQbwM0qO.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";
@@ -621,6 +621,9 @@ async function readSpringBoardPid(udid) {
621
621
  return null;
622
622
  }
623
623
  }
624
+ function springBoardRunning(launchctlList) {
625
+ return /^\d+[ \t]+\S+[ \t]+com\.apple\.SpringBoard$/m.test(launchctlList);
626
+ }
624
627
  async function waitForSpringBoard(udid, deadline) {
625
628
  for (;;) {
626
629
  let output = null;
@@ -645,7 +648,10 @@ async function waitForSpringBoard(udid, deadline) {
645
648
  state: "unreadable",
646
649
  reason: `Could not read SpringBoard's startup state: ${output.trim() || "no output"}.`
647
650
  };
648
- if (Number(state[1]) > 0) return { state: "started" };
651
+ if (Number(state[1]) > 0) return {
652
+ state: "started",
653
+ pid: Number(state[1])
654
+ };
649
655
  }
650
656
  if (Date.now() >= deadline) return { state: "timed-out" };
651
657
  await cancellableSleep(SPRINGBOARD_POLL_MS);
@@ -706,7 +712,7 @@ async function awaitBootCommand(args, attemptMs, onLine) {
706
712
  const detail = lines.length ? `: ${lines.join(" | ")}` : "";
707
713
  throw new Error(`${command} failed with exit code ${result.code ?? "unknown"}${detail}`);
708
714
  }
709
- async function bootIosSim(udid, { timeoutMs = IOS_BOOT_TIMEOUT_MS, attemptMs = BOOTSTATUS_ATTEMPT_MS, simulatorApp, env, openViewer = true, label = udid, out = () => {} } = {}) {
715
+ async function bootIosSim(udid, { timeoutMs = IOS_BOOT_TIMEOUT_MS, attemptMs = BOOTSTATUS_ATTEMPT_MS, simulatorApp, env, openViewer = true, label = udid, out = () => {}, onPhase } = {}) {
710
716
  const exec = getExecutor();
711
717
  const viewer = configuredIosSimulatorViewer(simulatorApp, env);
712
718
  const started = Date.now();
@@ -747,6 +753,7 @@ async function bootIosSim(udid, { timeoutMs = IOS_BOOT_TIMEOUT_MS, attemptMs = B
747
753
  monitor.unref();
748
754
  try {
749
755
  try {
756
+ onPhase?.({ phase: "boot_requested" });
750
757
  await awaitBootCommand([
751
758
  "simctl",
752
759
  "boot",
@@ -779,15 +786,24 @@ async function bootIosSim(udid, { timeoutMs = IOS_BOOT_TIMEOUT_MS, attemptMs = B
779
786
  if (state !== "Booting" && state !== "Booted" && state !== void 0) throw new Error(`Simulator ${udid} reports "${state ?? "missing"}" after ${waited}s of boot wait.`);
780
787
  if (deadline - Date.now() <= 0) throw new Error(`Simulator ${udid} did not finish booting within ${Math.round(timeoutMs / 1e3)}s.`);
781
788
  }
789
+ onPhase?.({ phase: "bootstatus_done" });
782
790
  phase = "waiting for SpringBoard";
783
- if ((await waitForSpringBoard(udid, deadline)).state === "timed-out") throw new Error(`Simulator ${udid} did not finish booting within ${Math.round(timeoutMs / 1e3)}s.`);
791
+ const springBoard = await waitForSpringBoard(udid, deadline);
792
+ if (springBoard.state === "timed-out") throw new Error(`Simulator ${udid} did not finish booting within ${Math.round(timeoutMs / 1e3)}s.`);
793
+ if (springBoard.state === "started") onPhase?.({
794
+ phase: "springboard_started",
795
+ pid: springBoard.pid
796
+ });
784
797
  } catch (error) {
785
798
  const named = memoryCulpritAdvice(await memoryCulpritsUnderAsync(sample(), exec));
786
799
  throw new Error(`${error?.message || error} Last boot output: ${phase}. Highest observed memory pressure: ${worst ?? "unknown"}; unavailable samples: ${unknown}.${coverage()}${named ? ` ${named}` : ""} ${recovery} These observations do not establish an OOM crash.`, { cause: error });
787
800
  } finally {
788
801
  clearInterval(monitor);
789
802
  }
790
- if (openViewer) await viewer.open(udid);
803
+ if (openViewer) {
804
+ await viewer.open(udid);
805
+ onPhase?.({ phase: "viewer_opened" });
806
+ }
791
807
  }
792
808
  async function shutdownIosSim(udid, operation) {
793
809
  if (!operation) {
@@ -1168,4 +1184,4 @@ function parseIosRuntimes(out) {
1168
1184
  }] : []);
1169
1185
  }
1170
1186
  //#endregion
1171
- export { uninstallIosApp as A, memoryCulpritAdvice as B, renameIosSim as C, resolveOwnedIosSim as D, resolveIosCreation as E, memoryCulpritsUnder as F, readMemoryCulpritsAsync as H, memoryCulpritsUnderAsync as I, readHostMemoryPressure as L, configuredIosSimulatorViewer as M, parseIosSimulatorApp as N, sanitizeDeviceLabel as O, hostMemoryPressureAdvice as P, readHostMemoryPressureAsync as R, readSpringBoardPid as S, resetIosPrivacy as T, deviceHoldsApk as U, memoryCulpritFindings as V, deviceHoldsBundle as W, ownedSimName as _, createOwnedIosSim as a, parseSimctlList as b, eraseIosSim as c, listAllIosSims as d, listAllIosSimsAsync as f, listUserApps as g, listIosRuntimesAsync as h, createIosSimSnapshot as i, waitForSpringBoard as j, shutdownIosSim as k, iosRuntimeMatches as l, listIosRuntimes as m, bootIosSim as n, deleteIosSim as o, listIosDeviceTypesAsync as p, clearIosAppData as r, deleteParkedIosSim as s, IOS_BOOT_TIMEOUT_MS as t, iosSimulatorFailureAdvice as u, parkedSimName as v, resetIosKeychain as w, pickDefaultIosCreation as x, parseRuntimeVersion as y, reportMemoryCulprits as z };
1187
+ export { springBoardRunning as A, reportMemoryCulprits as B, renameIosSim as C, resolveOwnedIosSim as D, resolveIosCreation as E, hostMemoryPressureAdvice as F, deviceHoldsBundle as G, memoryCulpritFindings as H, memoryCulpritsUnder as I, memoryCulpritsUnderAsync as L, waitForSpringBoard as M, configuredIosSimulatorViewer as N, sanitizeDeviceLabel as O, parseIosSimulatorApp as P, readHostMemoryPressure as R, readSpringBoardPid as S, resetIosPrivacy as T, readMemoryCulpritsAsync as U, memoryCulpritAdvice as V, deviceHoldsApk as W, ownedSimName as _, createOwnedIosSim as a, parseSimctlList as b, eraseIosSim as c, listAllIosSims as d, listAllIosSimsAsync as f, listUserApps as g, listIosRuntimesAsync as h, createIosSimSnapshot as i, uninstallIosApp as j, shutdownIosSim as k, iosRuntimeMatches as l, listIosRuntimes as m, bootIosSim as n, deleteIosSim as o, listIosDeviceTypesAsync as p, clearIosAppData as r, deleteParkedIosSim as s, IOS_BOOT_TIMEOUT_MS as t, iosSimulatorFailureAdvice as u, parkedSimName as v, resetIosKeychain as w, pickDefaultIosCreation as x, parseRuntimeVersion as y, readHostMemoryPressureAsync as z };
@@ -1,9 +1,9 @@
1
- import { h as shortUdid, i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-BF5AR2dL.mjs";
2
- import { In as pickDevClientScheme, Rn as schemesFromInfoPlist } from "./budget-k2mZGvvk.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-CVOCp0Ft.mjs";
4
- import { n as ensureWorkspaceStorageSafely } from "./native-runtime-Dq3RBcON.mjs";
5
- import { t as devClientScheme } from "./dev-client-DXR_tPVY.mjs";
6
- import { a as lastBuildRecord, i as iosFacts, n as cacheDescription, s as writeLastBuild } from "./ios-project-Ty5pHl9O.mjs";
7
- import { d as replaceCollector, u as collectorEntry } from "./dependencies-Dw6wfQdv.mjs";
8
- import { n as registerIos, r as runIosOperation, t as iosCommand } from "./ios-ftxdQbJS.mjs";
1
+ import { h as shortUdid, i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-C8R1KIvi.mjs";
2
+ import { xn as schemesFromInfoPlist, yn as pickDevClientScheme } from "./ccache-Bm_A1xX9.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-BtlJKjyQ.mjs";
4
+ import { n as ensureWorkspaceStorageSafely } from "./native-runtime-DG4Rodzj.mjs";
5
+ import { t as devClientScheme } from "./dev-client-D-BW5uiq.mjs";
6
+ import { c as writeLastBuild, i as iosFacts, n as cacheDescription, o as lastBuildRecord } from "./ios-project-CR4mZ7CH.mjs";
7
+ import { d as replaceCollector, u as collectorEntry } from "./dependencies-DKeMzwXY.mjs";
8
+ import { n as registerIos, r as runIosOperation, t as iosCommand } from "./ios-tg4tp3q1.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,4 +1,4 @@
1
- import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
1
+ import { t as getExecutor } from "./exec-aULwtNly.mjs";
2
2
  //#region src/collector/ios.ts
3
3
  const MESSAGE_TYPE_LEVEL = {
4
4
  Debug: "debug",
@@ -90,6 +90,12 @@ const NOISE_RULES = [
90
90
  exactSubsystem: "com.apple.runtime-issues",
91
91
  category: "CFNetwork Performance Diagnostic",
92
92
  level: "warn"
93
+ },
94
+ {
95
+ id: "swiftui-invalid-configuration",
96
+ exactSubsystem: "com.apple.SwiftUI",
97
+ category: "Invalid Configuration",
98
+ level: "warn"
93
99
  }
94
100
  ];
95
101
  function ruleMatches(rule, { subsystem, category, message }) {
@@ -1,6 +1,6 @@
1
- import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { bn as appProcessFromPid, gn as INSTALL_ERROR } from "./budget-k2mZGvvk.mjs";
3
- import { n as TOOL_ERROR_PREFIX } from "./ios-device-B6HK951C.mjs";
1
+ import { t as getExecutor } from "./exec-aULwtNly.mjs";
2
+ import { $t as INSTALL_ERROR, rn as appProcessFromPid } from "./ccache-Bm_A1xX9.mjs";
3
+ import { n as TOOL_ERROR_PREFIX } from "./ios-device-CiBA-er9.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-VFRpu1iA.mjs";
1
+ import { t as getExecutor } from "./exec-aULwtNly.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,13 +1,14 @@
1
- import { w as workspaceAgentDeviceDir } from "./workspace-state-pUg3_RRA.mjs";
2
- import { i as formatDuration, l as phaseLine } from "./command-output-BF5AR2dL.mjs";
3
- import { a as workspaceLinkLine } from "./stim-desktop-6Dqp-gjX.mjs";
4
- import { Gn as UPLOAD_TIMEOUT_MS, Jn as easAuthNote, Kn as cacheLevel, W as recordFinishedBuild, Yn as isEasAuthFailureText } from "./budget-k2mZGvvk.mjs";
5
- import { P as compilationCacheActivityLine, k as COMPILATION_CACHE_NOT_RUN } from "./toolchain-J4J8MrAr.mjs";
6
- import { i as deviceLabel } from "./support-CVOCp0Ft.mjs";
1
+ import { w as workspaceAgentDeviceDir } from "./workspace-state-kIZrdlSg.mjs";
2
+ import { i as formatDuration, l as phaseLine } from "./command-output-C8R1KIvi.mjs";
3
+ import { a as workspaceLinkLine } from "./stim-desktop-CbWo21kb.mjs";
4
+ import { Mn as isEasAuthFailureText, On as UPLOAD_TIMEOUT_MS, jn as easAuthNote, kn as cacheLevel } from "./ccache-Bm_A1xX9.mjs";
5
+ import { X as recordFinishedBuild } from "./workspaces-CmOcceDN.mjs";
6
+ import { P as compilationCacheActivityLine, k as COMPILATION_CACHE_NOT_RUN } from "./toolchain-mLA_km-b.mjs";
7
+ import { i as deviceLabel } from "./support-BtlJKjyQ.mjs";
7
8
  import { buildDiagnostics } from "@stim-cli/core/state";
8
9
  import chalk from "chalk";
9
10
  //#region src/commands/ios/result.ts
10
- function lastBuildRecord({ devicePlacement, fingerprint = null, cacheKey = null, cacheHit = false, cacheSkipped = false, durationMs = 0, appPath = null, bundleId = null, startedAt, status, errorCode = null, missReason = null, diagnostics = null, configuration = null, buildMachine = "auto", builtOn, offloadedTo = null, offloadFallback = null }) {
11
+ function lastBuildRecord({ devicePlacement, fingerprint = null, cacheKey = null, cacheHit = false, cacheSkipped = false, durationMs = 0, appPath = null, bundleId = null, startedAt, status, errorCode = null, missReason = null, diagnostics = null, configuration = null, buildMachine = "auto", builtOn, offloadedTo = null, offloadFallback = null, ledger }) {
11
12
  const record = {
12
13
  platform: "ios",
13
14
  fingerprint,
@@ -30,6 +31,7 @@ function lastBuildRecord({ devicePlacement, fingerprint = null, cacheKey = null,
30
31
  if (missReason && !cacheLevel(cacheHit)) record.missReason = missReason;
31
32
  const recorded = status === "failed" ? buildDiagnostics(diagnostics) : [];
32
33
  if (recorded.length) record.diagnostics = recorded;
34
+ if (ledger) record.ledger = ledger;
33
35
  return record;
34
36
  }
35
37
  function iosFacts({ root, slot, udid, deviceName, deviceType = null, runtime = null, fingerprint, configuration = null, scheme = null, cacheKey, cacheHit, cacheSkipped = false, compilationCache = COMPILATION_CACHE_NOT_RUN, waitedForBuild = null, appPath, bundleId, installSkipped = false, metroPort, logsDir, durationMs, launched = true, webPreviewUrl = null, lease, devServer = null, buildMachine = "auto", builtOn, offloadedTo = null, offloadFallback = null }) {
@@ -68,6 +70,13 @@ function iosFacts({ root, slot, udid, deviceName, deviceType = null, runtime = n
68
70
  ...devServer ? { devServer } : {}
69
71
  };
70
72
  }
73
+ function iosLedgerDevice(device) {
74
+ const name = device?.deviceName ?? device?.name;
75
+ return name && name !== device?.deviceUdid ? {
76
+ name,
77
+ runtime: device?.runtime ?? null
78
+ } : null;
79
+ }
71
80
  function writeLastBuild(root, record, { record: recordBuild = recordFinishedBuild } = {}) {
72
81
  try {
73
82
  recordBuild(root, record);
@@ -118,7 +127,11 @@ function reportIosResult({ output, devicePlacement, host, slot, root, json, rele
118
127
  buildMachine,
119
128
  builtOn,
120
129
  offloadedTo,
121
- offloadFallback
130
+ offloadFallback,
131
+ ledger: {
132
+ scheme: buildScheme,
133
+ device: iosLedgerDevice(device)
134
+ }
122
135
  }));
123
136
  closeWriter();
124
137
  const facts = iosFacts({
@@ -194,4 +207,4 @@ var IosRecipeRefusal = class extends Error {
194
207
  }
195
208
  };
196
209
  //#endregion
197
- export { lastBuildRecord as a, iosFacts as i, cacheDescription as n, reportIosResult as o, finishIosUpload as r, writeLastBuild as s, IosRecipeRefusal as t };
210
+ export { iosLedgerDevice as a, writeLastBuild as c, iosFacts as i, cacheDescription as n, lastBuildRecord as o, finishIosUpload as r, reportIosResult as s, IosRecipeRefusal as t };
@@ -1,5 +1,5 @@
1
- import { c as throwIfCancelled, t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { a as killOnAbort, r as childEnvironment } from "./operation-exec-CUZifp6Z.mjs";
1
+ import { c as throwIfCancelled, t as getExecutor } from "./exec-aULwtNly.mjs";
2
+ import { a as killOnAbort, r as childEnvironment } from "./operation-exec-Dp4FuIGR.mjs";
3
3
  import { X509Certificate } from "node:crypto";
4
4
  import { existsSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
5
5
  import { tmpdir } from "node:os";
@@ -1,4 +1,4 @@
1
- import { l as withWorkspaceStateLockAsync, o as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-pUg3_RRA.mjs";
1
+ import { l as withWorkspaceStateLockAsync, o as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-kIZrdlSg.mjs";
2
2
  import { HOSTED_METRO_REQUESTS_KEY, hostedMetroRequests, hostedNativeRecords, isJsonObject, parseHostedNativePlacement, unreadableHostedNative } from "@stim-cli/core/state";
3
3
  //#region src/device-host/ios-state.ts
4
4
  function readHostedNative(root, platform, slot) {