stim 1.24.0 → 1.26.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 (162) hide show
  1. package/README.md +1 -1
  2. package/dist/{acquire-artifact-CEs02U2o.mjs → acquire-artifact-DVsvSwf7.mjs} +1 -1
  3. package/dist/{act-Cyvm8xYc.mjs → act-C-BqJEpu.mjs} +158 -36
  4. package/dist/{activity-Dq3ZcdD8.mjs → activity-Lnb_EoRY.mjs} +4 -5
  5. package/dist/{agent-device-usage-output-CccomeE0.mjs → agent-device-usage-output-DbXy5tg8.mjs} +4 -4
  6. package/dist/{android-CX5IcRuf.mjs → android-B5P81yI-.mjs} +1 -1
  7. package/dist/{android-DcztblCT.mjs → android-CSbLRD53.mjs} +5 -5
  8. package/dist/{android-BZppyPe_.mjs → android-CiNQw3kq.mjs} +81 -52
  9. package/dist/{android-882m4hxX.mjs → android-DTAcRwBC.mjs} +81 -34
  10. package/dist/{android-cas-BtCOrNqb.mjs → android-cas-BTVhZ0Qs.mjs} +4 -4
  11. package/dist/{android-project-DVWyCbWU.d.mts → android-project-DUGMbq28.d.mts} +61 -3
  12. package/dist/api.d.mts +8 -5
  13. package/dist/api.mjs +27 -27
  14. package/dist/apk-signed-tail-B46U9hXc.mjs +142 -0
  15. package/dist/{artifact-BR5VNArK.mjs → artifact-BxREhAaV.mjs} +25 -19
  16. package/dist/{artifact-Bdt_n9Jc.mjs → artifact-CsAP6AGK.mjs} +36 -21
  17. package/dist/{attempt-DW-mQqM7.mjs → attempt-ClyJlZPT.mjs} +4 -2
  18. package/dist/{browser-web-ycg9qWB8.mjs → browser-web-rYPyqhTf.mjs} +11 -12
  19. package/dist/{budget-dPGuhNai.mjs → budget-k2mZGvvk.mjs} +242 -38
  20. package/dist/{build-CaF574eS.mjs → build-DPhApsjV.mjs} +28 -24
  21. package/dist/{build-cache-HFUQ9eLz.mjs → build-cache-DrXNCy3T.mjs} +123 -23
  22. package/dist/{build-plan-JsDUq4w1.mjs → build-plan-DrMMdayj.mjs} +5 -5
  23. package/dist/{cache-manifest-BPXRONJz.mjs → cache-manifest-BEZ9Bpl1.mjs} +1 -1
  24. package/dist/cache-manifest.mjs +1 -1
  25. package/dist/{ccache-CCn1S6qG.mjs → ccache-Bx5TbxwG.mjs} +6 -6
  26. package/dist/{cli-xqAidP7O.mjs → cli-BBKFGOFl.mjs} +19 -19
  27. package/dist/cli.mjs +1 -1
  28. package/dist/{client-18-ZowoT.mjs → client-D9CaRks-.mjs} +55 -71
  29. package/dist/collector-run.mjs +4 -4
  30. package/dist/{command-output-DxC0k2rk.mjs → command-output-BF5AR2dL.mjs} +1 -1
  31. package/dist/{config-BZhXY15H.mjs → config-BktkY_zC.mjs} +321 -15
  32. package/dist/{launch-BVlyQw3T.mjs → dependencies-Dw6wfQdv.mjs} +259 -256
  33. package/dist/{dependency-state-C56ll9hY.mjs → dependency-state-DFB41vfr.mjs} +1 -1
  34. package/dist/{dev-client-w_fok0Ek.mjs → dev-client-DXR_tPVY.mjs} +2 -2
  35. package/dist/{device-BktRGdjS.mjs → device-BK-zwyd_.mjs} +64 -33
  36. package/dist/{device-4RUugw5X.mjs → device-BcYeHSFu.mjs} +14 -14
  37. package/dist/{device-capacity-Ic-kdmEV.mjs → device-capacity-DCSvUF0l.mjs} +10 -17
  38. package/dist/device-host-worker.mjs +11 -13
  39. package/dist/{device-ios-DzpSlZyd.mjs → device-ios-BLGfXQeK.mjs} +68 -25
  40. package/dist/{device-lease-run-DUtkbqBQ.mjs → device-lease-run-BmvIl7bI.mjs} +5 -5
  41. package/dist/{device-pool-CgBHk401.mjs → device-pool-Dluix4H3.mjs} +3 -3
  42. package/dist/{doctor-DZgpqR6J.mjs → doctor-Bhg1ii70.mjs} +14 -14
  43. package/dist/{doctor-BZ6oxNum.mjs → doctor-Cp-BhzTS.mjs} +1 -1
  44. package/dist/{doctor-C33AzVfR.mjs → doctor-OnwP94ne.mjs} +81 -26
  45. package/dist/{doctor-fingerprint-zlujA1Gs.mjs → doctor-fingerprint-D3a04Mhu.mjs} +8 -2
  46. package/dist/doctor-fingerprint.mjs +1 -1
  47. package/dist/{doctor-watchman-B453A231.mjs → doctor-watchman-BStK05nt.mjs} +4 -4
  48. package/dist/{eas-build-CxKUNHsb.mjs → eas-build-Dsj93iM9.mjs} +2 -2
  49. package/dist/{eas-fallback-LMxk9Kw0.mjs → eas-fallback-FwkeqqGi.mjs} +13 -12
  50. package/dist/{eas-session-ledger-Ck6YXPAO.mjs → eas-session-ledger-B5vygTiD.mjs} +5 -5
  51. package/dist/{error-diagnostics-BkKCZq4P.mjs → error-diagnostics-BOOm9Db7.mjs} +8 -8
  52. package/dist/{errors-ccaPc4ox.mjs → errors-DHm_U5gv.mjs} +2 -1
  53. package/dist/{gc-DDWEAj0w.mjs → gc-C_79zvz4.mjs} +2 -2
  54. package/dist/{gc-yVKpAOKM.mjs → gc-ldgr-hXU.mjs} +74 -43
  55. package/dist/{guide-Bggftwc5.mjs → guide-D7K0X6KG.mjs} +374 -78
  56. package/dist/{hosted-android-D4dweBof.mjs → hosted-android-Bk54ej6n.mjs} +3 -3
  57. package/dist/{hosted-client-BBTVe3X6.mjs → hosted-client-fHO8yqzc.mjs} +5 -5
  58. package/dist/{hosted-ios-Sn0djzg8.mjs → hosted-ios-D55QhYaD.mjs} +1 -1
  59. package/dist/{hosted-logs-CYIZ5ubJ.mjs → hosted-logs-BfbmDM4M.mjs} +17 -11
  60. package/dist/hosted-logs-sync-B0pvmOk-.mjs +195 -0
  61. package/dist/{hosted-macos-CXjsUNBR.mjs → hosted-macos-CPl0OZ9h.mjs} +5 -5
  62. package/dist/{hosted-native-Doxbfzem.mjs → hosted-native-CpDB3-PO.mjs} +6 -7
  63. package/dist/{idle-shutdown-BInjLKqm.mjs → idle-shutdown-FfxL1KdG.mjs} +22 -9
  64. package/dist/{ios-BItP6lkn.mjs → ios-B7-lToDu.mjs} +8 -8
  65. package/dist/{ios-CVUFFZ6C.mjs → ios-WxpDJ5T1.mjs} +129 -14
  66. package/dist/{ios-device-BI38NFFH.mjs → ios-device-CsyryvpT.mjs} +1 -1
  67. package/dist/{ios-B1FXRCMX.mjs → ios-ftxdQbJS.mjs} +84 -51
  68. package/dist/{ios-project-KYqeJURj.mjs → ios-project-Ty5pHl9O.mjs} +6 -6
  69. package/dist/{ios-state-DlElquYD.mjs → ios-state-Cw7-WQf2.mjs} +1 -1
  70. package/dist/{js-swap-BvrQvXHY.mjs → js-swap-BMhXYVDS.mjs} +4 -4
  71. package/dist/{launch-SfzGH_s9.mjs → launch-DOp8RjDz.mjs} +32 -27
  72. package/dist/{logs-DXE32kyb.mjs → logs-dQDki6Tt.mjs} +9 -173
  73. package/dist/{logs-ovlU7m7N.mjs → logs-s1dRIG1E.mjs} +85 -36
  74. package/dist/{macos-B3BveDrU.mjs → macos-B0VEV3Gf.mjs} +1 -1
  75. package/dist/{macos-CCfhb-jT.mjs → macos-DBBPNnIA.mjs} +18 -19
  76. package/dist/macos-run.mjs +1 -1
  77. package/dist/maintenance-run.mjs +28 -11
  78. package/dist/{metro-Bu8LBfzS.mjs → metro-CjC10t6E.mjs} +2 -2
  79. package/dist/{metro-gateway-DtsOy-0P.mjs → metro-gateway-B6_PgD0L.mjs} +2 -3
  80. package/dist/{named-ports-BWDuU5oQ.mjs → named-ports-BG0j1X4g.mjs} +2 -2
  81. package/dist/{native-android-96BBizbq.mjs → native-android-CL2NGiik.mjs} +17 -17
  82. package/dist/{native-gradle-artifact-inputs-BcLYBZil.mjs → native-gradle-artifact-inputs-btSUulme.mjs} +3 -3
  83. package/dist/{native-run-BmH7U8pr.mjs → native-run-BfIDFKLH.mjs} +2 -3
  84. package/dist/{native-runtime-DgtJkzIa.mjs → native-runtime-Dq3RBcON.mjs} +6 -7
  85. package/dist/{native-xcode-inputs-irplbQb0.mjs → native-xcode-inputs-BW7H8JGu.mjs} +2 -2
  86. package/dist/{native-xcode-ios-BY-6hh6M.mjs → native-xcode-ios-CBXJAxfC.mjs} +18 -18
  87. package/dist/offload-worker.d.mts +7 -2
  88. package/dist/offload-worker.mjs +34 -23
  89. package/dist/{ownership-DxlZGDcV.mjs → ownership-BjYvMNX_.mjs} +2 -2
  90. package/dist/{phone-reverses-BdsdesVF.mjs → phone-reverses-lmj6kcPm.mjs} +3 -3
  91. package/dist/{placement-log-DUvqqsB-.mjs → placement-log-DIFPQAXp.mjs} +1 -1
  92. package/dist/{plan-placement-4axc0Hs7.mjs → plan-placement-IiiSQhtz.mjs} +3 -3
  93. package/dist/{ports-D-E_OiAO.mjs → ports-C2_w1Z0Z.mjs} +3 -3
  94. package/dist/prebuild-gmouvmJZ.mjs +1247 -0
  95. package/dist/{project-Dz-hWkb-.mjs → project-BUu6Is4k.mjs} +15 -16
  96. package/dist/{react-native-android-DOinxgwB.mjs → react-native-android-Cgg99REN.mjs} +48 -33
  97. package/dist/{react-native-build-AuCu-aAP.mjs → react-native-build-oNwqF5Wb.mjs} +8 -8
  98. package/dist/{react-native-doctor-2ivJUmwZ.mjs → react-native-doctor-BhA3KUte.mjs} +49 -8
  99. package/dist/{react-native-ios-D5zTIuH8.mjs → react-native-ios-B-nf4rjN.mjs} +40 -25
  100. package/dist/{recordings-CdPwYwvs.mjs → recordings-BldzVKq0.mjs} +1 -1
  101. package/dist/{reload-Ck9RJeSq.mjs → reload-C9OduiNc.mjs} +1 -1
  102. package/dist/{reload-C1TTVesC.mjs → reload-CCR7KC_l.mjs} +14 -14
  103. package/dist/{remote-DEZ7AOVq.mjs → remote-C8S7FlPF.mjs} +16 -7
  104. package/dist/{result-DqBrb12U.mjs → result-7F5hEwQJ.mjs} +17 -17
  105. package/dist/{run-BIwoU44q.mjs → run-BqB0v3pt.mjs} +1 -1
  106. package/dist/{selection-BLtvaqxc.mjs → selection-BNPBZ6T5.mjs} +157 -44
  107. package/dist/{server-bare-Z1ToVLPn.mjs → server-bare-A75rDIdD.mjs} +55 -3
  108. package/dist/{server-command-C0pmjNdG.mjs → server-command-CssKFOD7.mjs} +4 -4
  109. package/dist/{server-expo-Tt_hLRpy.mjs → server-expo-eQfOdydb.mjs} +8 -6
  110. package/dist/server-expo-wvcj5tiZ.mjs +2 -0
  111. package/dist/{settings-RKwY33wv.mjs → settings-CosW5X-S.mjs} +59 -61
  112. package/dist/{settings-kkt0vP4w.mjs → settings-OaGQF-ri.mjs} +1 -1
  113. package/dist/{settings-write--gj6MACV.mjs → settings-write-QjYfSrjF.mjs} +5 -5
  114. package/dist/settings.schema.json +71 -6
  115. package/dist/{simslim-CdWKT3vA.mjs → simslim-Bax1qcxu.mjs} +22 -6
  116. package/dist/{slot-launch-A1BgotaM.mjs → slot-launch-CYCEhfBY.mjs} +6 -6
  117. package/dist/{stage-ERTMh88n.mjs → stage-jKQ7CP_B.mjs} +1 -1
  118. package/dist/{start-Bmg_qmHi.mjs → start-C_wefNKB.mjs} +1 -1
  119. package/dist/{start-BKGrEhzG.mjs → start-_BdJ32cZ.mjs} +9 -10
  120. package/dist/{state-B1ig0Kqy.mjs → state-C1i2nMOP.mjs} +2 -3
  121. package/dist/{state-BfAltYJP.mjs → state-C4OdpOTF.mjs} +1 -2
  122. package/dist/{stats-B-ckuiUg.mjs → stats-tEpEEH-u.mjs} +4 -4
  123. package/dist/{status-Pw-807f0.mjs → status-B9M7x4CZ.mjs} +1 -1
  124. package/dist/{status-Fect2w9R.mjs → status-CRXz-Gtj.mjs} +1 -1
  125. package/dist/{status-DfFp6a76.mjs → status-DQrqodLj.mjs} +22 -23
  126. package/dist/{status-watch-XC7F-AMf.mjs → status-watch-B5wDIH_o.mjs} +4 -4
  127. package/dist/status-worker.mjs +1 -1
  128. package/dist/{stim-desktop-DS0mzR8U.mjs → stim-desktop-6Dqp-gjX.mjs} +1 -1
  129. package/dist/{stop-BFu7X_Do.mjs → stop-CmdNhGlC.mjs} +2 -2
  130. package/dist/{stop-CL1kDHds.mjs → stop-DRqQVqDJ.mjs} +74 -53
  131. package/dist/{stop-DhclRwOO.mjs → stop-ySNQHXMG.mjs} +4 -5
  132. package/dist/supervisor-run.d.mts +1 -0
  133. package/dist/supervisor-run.mjs +15 -16
  134. package/dist/{support-B3tzVhKn.mjs → support-BGSCBoib.mjs} +4 -4
  135. package/dist/{support-B1W-hmC2.mjs → support-CVOCp0Ft.mjs} +15 -12
  136. package/dist/{swiftpm-artifact-inputs-BWYPj9Sn.mjs → swiftpm-artifact-inputs-CfUzt_0Z.mjs} +1 -1
  137. package/dist/{swiftpm-macos-BVCP5mO4.mjs → swiftpm-macos-x6HPpl_2.mjs} +10 -10
  138. package/dist/toolchain-DoavrvIA.mjs +2 -0
  139. package/dist/toolchain-J4J8MrAr.mjs +2107 -0
  140. package/dist/trigger-DzJu208Q.mjs +2 -0
  141. package/dist/{trigger-CBMe2YLH.mjs → trigger-KVaWWNyn.mjs} +1 -1
  142. package/dist/{warm-progress-ol0ZypEu.mjs → warm-progress-DvhTX_eu.mjs} +3 -4
  143. package/dist/web-BFLueSh-.mjs +2 -0
  144. package/dist/{web-BH7peScT.mjs → web-Bihbf7-u.mjs} +8 -9
  145. package/dist/web-run.mjs +4 -4
  146. package/dist/{workspace-state-CeBpIZgr.mjs → workspace-state-pUg3_RRA.mjs} +45 -7
  147. package/dist/{workspaces-CSV2Orf4.mjs → workspaces-g2lhdBXF.mjs} +17 -17
  148. package/dist/{worktree-Dw8kfacb.mjs → worktree-BKuklFh_.mjs} +34 -31
  149. package/dist/{worktree-DEDUzO_L.mjs → worktree-Bm4cb-nU.mjs} +1 -1
  150. package/package.json +8 -8
  151. package/shim/bundle-response.cjs +53 -1
  152. package/shim/bundle-response.d.cts +1 -1
  153. package/shim/expo-metro-config.cjs +23 -1
  154. package/dist/created-devices-D2Aca-xu.mjs +0 -52
  155. package/dist/paths-DQtTgsBf.mjs +0 -42
  156. package/dist/prebuild-DmVCf5xb.mjs +0 -501
  157. package/dist/server-expo-CEntXzRw.mjs +0 -2
  158. package/dist/toolchain-BjgKdoEf.mjs +0 -2
  159. package/dist/toolchain-D3bmRMia.mjs +0 -897
  160. package/dist/trigger-BLsHgAGR.mjs +0 -2
  161. package/dist/web-BdOFlTJr.mjs +0 -2
  162. package/dist/xcode-DHu41qQ4.mjs +0 -910
@@ -1,7 +1,7 @@
1
1
  import { c as throwIfCancelled } from "./exec-VFRpu1iA.mjs";
2
- import { c as call, l as connectHost } from "./hosted-client-BBTVe3X6.mjs";
3
- import { i as requestHostedMetro } from "./metro-gateway-DtsOy-0P.mjs";
4
- import { a as stopHostedNative, i as prepareHostedNative, r as placeHostedNative } from "./hosted-native-Doxbfzem.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";
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);
@@ -1,7 +1,7 @@
1
1
  import { c as throwIfCancelled, o as cancellableSleep } from "./exec-VFRpu1iA.mjs";
2
- import { rt as resolveEndpoint } from "./config-BZhXY15H.mjs";
3
- import { t as BuildConnection } from "./client-18-ZowoT.mjs";
4
- import { d as configuredMachines } from "./selection-BLtvaqxc.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";
5
5
  import { createHash } from "node:crypto";
6
6
  import { lstatSync, readFileSync, readdirSync, readlinkSync } from "node:fs";
7
7
  import { join } from "node:path";
@@ -50,11 +50,11 @@ async function connectHost(machine, timeoutMs = CONNECT_TIMEOUT_MS, strict = fal
50
50
  signal?.throwIfAborted();
51
51
  if (typeof target === "string") throw Object.assign(/* @__PURE__ */ new Error(`Stim does not connect to ${machine}: ${target}.`), { code: "STIM_HOSTING_REFUSED" });
52
52
  const opened = await BuildConnection.open(target, credential.serverKey, timeoutMs, "device-host", signal).catch((error) => {
53
- throw Object.assign(new Error(`${machine} is unreachable. Check stim-server and its tailnet serve route on ${machine}.`, { cause: error }), { code: strict ? "STIM_HOSTING_REFUSED" : "closed" });
53
+ throw Object.assign(new Error(`${machine} is unreachable. Run stim doctor to see which layer failed.`, { cause: error }), { code: strict ? "STIM_HOSTING_REFUSED" : "closed" });
54
54
  });
55
55
  if (signal?.aborted && opened instanceof BuildConnection) opened.close();
56
56
  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}. Check stim-server and its tailnet serve route on ${machine}.`), {
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
58
  code: strict ? "STIM_HOSTING_REFUSED" : opened.refused ? "STIM_HOSTING_REFUSED" : opened.code ?? "closed",
59
59
  hostCode: opened.code
60
60
  });
@@ -1,4 +1,4 @@
1
- import { a as stopHostedNative, i as prepareHostedNative, r as placeHostedNative } from "./hosted-native-Doxbfzem.mjs";
1
+ import { a as stopHostedNative, i as prepareHostedNative, r as placeHostedNative } from "./hosted-native-CpDB3-PO.mjs";
2
2
  //#region src/device-host/hosted-ios.ts
3
3
  async function prepareHostedIos(machine, selectors, recorded, mode) {
4
4
  return await prepareHostedNative(machine, selectors, recorded, "ios", false, mode);
@@ -1,11 +1,11 @@
1
1
  import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { d as workspaceDir, m as workspaceLogsDir$1 } from "./paths-DQtTgsBf.mjs";
3
- import { B as deviceSlotFileKey, et as parseMachine$1, q as validateDeviceSlot } from "./config-BZhXY15H.mjs";
4
- import { l as phaseLine } from "./command-output-DxC0k2rk.mjs";
5
- import { n as macosDir } from "./state-BfAltYJP.mjs";
6
- import { n as androidLogGroups, r as isAndroidCrashText } from "./android-CX5IcRuf.mjs";
7
- import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
8
- import { c as call } from "./hosted-client-BBTVe3X6.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";
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";
@@ -205,10 +205,10 @@ async function pullHostedMacosLogs(root, placement, host, target = MACOS, maxPag
205
205
  if (!isJsonObject(result) || !cursor || !Array.isArray(result.records) || !result.records.every(isJsonObject) || typeof result.more !== "boolean") throw new Error(`${host.machine} answered device-host.logs.query with an unexpected result.`);
206
206
  signal?.throwIfAborted();
207
207
  await commitPage(root, placement.session, before, result.records, cursor, target);
208
- if (!result.more) return;
209
208
  const nextCheckpoint = typeof result.checkpoint === "number" ? result.checkpoint : void 0;
209
+ if (!result.more) return nextCheckpoint;
210
210
  if (sameCursor(cursor, before) && nextCheckpoint === checkpoint) {
211
- if (target.platform === "macos" && !final) return;
211
+ if (target.platform === "macos" && !final) return void 0;
212
212
  throw new Error("Hosted native logs made no progress; keeping the logs already copied here.");
213
213
  }
214
214
  checkpoint = nextCheckpoint;
@@ -217,10 +217,16 @@ async function pullHostedMacosLogs(root, placement, host, target = MACOS, maxPag
217
217
  }
218
218
  async function pullHostedNativeLogs(root, slot, placement, host, final = false, platform = "ios", signal) {
219
219
  if (!host.connection.supports(platform === "ios" ? "hosted-ios-data" : "hosted-android-data")) throw new Error(`${host.machine} needs a newer stim-server to collect hosted ${platform === "ios" ? "iOS" : "Android"} native logs.`);
220
- await pullHostedMacosLogs(root, placement, host, {
220
+ return await pullHostedMacosLogs(root, placement, host, {
221
221
  platform,
222
222
  slot
223
223
  }, final ? 1024 : MAX_PAGES, final, signal);
224
224
  }
225
+ function readHostedNativeLogs(root, platform, slot) {
226
+ return readNdjsonGenerations$1(hostLogFile(root, {
227
+ platform,
228
+ slot
229
+ }));
230
+ }
225
231
  //#endregion
226
- export { removeAgentAccess as a, agentAccess as i, pullHostedNativeLogs as n, closeAgentConnection as r, pullHostedMacosLogs as t };
232
+ export { agentAccess as a, closeAgentConnection as i, pullHostedNativeLogs as n, removeAgentAccess as o, readHostedNativeLogs as r, pullHostedMacosLogs as t };
@@ -0,0 +1,195 @@
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";
6
+ import { watch } from "node:fs";
7
+ import { dirname, relative, resolve, sep } from "node:path";
8
+ import { ambientWrite, configDir } from "@stim-cli/core";
9
+ import { readMacosRecord, workspaceStateFile } from "@stim-cli/core/state";
10
+ //#region src/device-host/hosted-logs-sync.ts
11
+ const WATCH_RECHECK_MS = 100;
12
+ function warn(context, machine, error) {
13
+ const text = `${warning(machine, error)}\n`;
14
+ if (context) context.output("stderr", text);
15
+ else ambientWrite("stderr", text);
16
+ }
17
+ function warning(machine, error) {
18
+ const message = error.message.replace(/\.$/, "");
19
+ const hint = message.includes("refused device-host.logs.query") ? ` If ${machine} runs an older stim-server, update it.` : "";
20
+ return phaseLine("device", `Could not read the app's logs from ${machine}: ${message}. Showing the logs already copied here.${hint}`);
21
+ }
22
+ async function syncHostedMacosLogs(root, placement, slot, warnings, platform = "ios", context) {
23
+ let host;
24
+ const cancel = () => host?.connection.close();
25
+ context?.signal.addEventListener("abort", cancel, { once: true });
26
+ try {
27
+ host = await connectHost(placement.machine, void 0, false, context?.signal);
28
+ if (slot !== void 0) await pullHostedNativeLogs(root, slot, placement, host, false, platform, context?.signal);
29
+ else await pullHostedMacosLogs(root, placement, host, void 0, void 0, false, context?.signal);
30
+ return true;
31
+ } catch (error) {
32
+ context?.signal.throwIfAborted();
33
+ if (!warnings?.has(placement.machine)) {
34
+ warn(context, placement.machine, error);
35
+ warnings?.add(placement.machine);
36
+ }
37
+ return false;
38
+ } finally {
39
+ context?.signal.removeEventListener("abort", cancel);
40
+ host?.connection.close();
41
+ }
42
+ }
43
+ function followHostedMacosLogs(root, { failing = false, intervalMs = 500, retryMs = 5e3, slot, platform = "ios", context, onPulled, onFailed } = {}) {
44
+ let host;
45
+ const controller = new AbortController();
46
+ const signal = context ? AbortSignal.any([context.signal, controller.signal]) : controller.signal;
47
+ const cancel = () => host?.connection.close();
48
+ signal.addEventListener("abort", cancel, { once: true });
49
+ let retryAt = 0;
50
+ let stopped = false;
51
+ let running = false;
52
+ const tick = async () => {
53
+ if (running || stopped || signal.aborted || Date.now() < retryAt) return;
54
+ running = true;
55
+ try {
56
+ const placement = slot !== void 0 ? (platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))[slot] : readMacosRecord(root)?.host;
57
+ if (!placement) {
58
+ host?.connection.close();
59
+ host = void 0;
60
+ return;
61
+ }
62
+ host ??= await connectHost(placement.machine, void 0, false, signal);
63
+ const through = slot !== void 0 ? await pullHostedNativeLogs(root, slot, placement, host, false, platform, signal) : await pullHostedMacosLogs(root, placement, host, void 0, void 0, false, signal);
64
+ failing = false;
65
+ onPulled?.(through);
66
+ } catch (error) {
67
+ host?.connection.close();
68
+ host = void 0;
69
+ if (signal.aborted) return;
70
+ onFailed?.();
71
+ if (!failing) warn(context, (slot !== void 0 ? (platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))[slot] : readMacosRecord(root)?.host)?.machine ?? "the host", error);
72
+ failing = true;
73
+ retryAt = Date.now() + retryMs;
74
+ } finally {
75
+ running = false;
76
+ }
77
+ };
78
+ const timer = setInterval(() => void tick(), intervalMs);
79
+ return () => {
80
+ stopped = true;
81
+ controller.abort();
82
+ signal.removeEventListener("abort", cancel);
83
+ clearInterval(timer);
84
+ host?.connection.close();
85
+ };
86
+ }
87
+ /** Copies a hosted slot's native logs while its launch is verified; a failed copy stops holding the launch windows. */
88
+ function followHostedLaunchLogs(root, slot, platform, since, context) {
89
+ let through = null;
90
+ let failed = false;
91
+ const stop = followHostedMacosLogs(root, {
92
+ slot,
93
+ platform,
94
+ context,
95
+ onPulled: (covered) => {
96
+ failed = false;
97
+ if (covered !== void 0) through = Math.max(through ?? covered, covered);
98
+ },
99
+ onFailed: () => {
100
+ failed = true;
101
+ }
102
+ });
103
+ const records = () => readHostedNativeLogs(root, platform, slot);
104
+ return {
105
+ readDeviceRecords: records,
106
+ readNativeCrashes: () => records().filter((record) => record.event === "native_crash" && Number(record.ts) >= since),
107
+ deviceLogsThrough: () => failed ? Number.POSITIVE_INFINITY : through,
108
+ stop
109
+ };
110
+ }
111
+ async function syncHostedLogs(root, context) {
112
+ const macos = readMacosRecord(root)?.host;
113
+ const warnings = /* @__PURE__ */ new Set();
114
+ return (await Promise.all([
115
+ ...macos ? [syncHostedMacosLogs(root, macos, void 0, warnings, "ios", context)] : [],
116
+ ...Object.entries(readHostedIos(root)).map(([slot, placement]) => syncHostedMacosLogs(root, placement, slot, warnings, "ios", context)),
117
+ ...Object.entries(readHostedAndroid(root)).map(([slot, placement]) => syncHostedMacosLogs(root, placement, slot, warnings, "android", context))
118
+ ])).every(Boolean);
119
+ }
120
+ function followHostedLogs(root, failing, context) {
121
+ const stops = /* @__PURE__ */ new Map();
122
+ let closed = false;
123
+ const refresh = () => {
124
+ if (closed) return;
125
+ const active = /* @__PURE__ */ new Set();
126
+ if (readMacosRecord(root)?.host) {
127
+ active.add("macos");
128
+ if (!stops.has("macos")) stops.set("macos", followHostedMacosLogs(root, {
129
+ failing,
130
+ context
131
+ }));
132
+ }
133
+ for (const platform of ["ios", "android"]) for (const slot of Object.keys(platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))) {
134
+ const key = `${platform}:${slot}`;
135
+ active.add(key);
136
+ if (!stops.has(key)) stops.set(key, followHostedMacosLogs(root, {
137
+ failing,
138
+ slot,
139
+ platform,
140
+ context
141
+ }));
142
+ }
143
+ for (const [key, stop] of stops) {
144
+ if (active.has(key)) continue;
145
+ stop();
146
+ stops.delete(key);
147
+ }
148
+ };
149
+ const stateFile = workspaceStateFile(root);
150
+ const home = resolve(configDir());
151
+ let watcher = null;
152
+ let recheck;
153
+ const observe = () => {
154
+ if (closed) return;
155
+ watcher?.close();
156
+ watcher = null;
157
+ clearTimeout(recheck);
158
+ let directory = dirname(stateFile);
159
+ for (;;) try {
160
+ const entry = relative(directory, stateFile).split(sep)[0];
161
+ const next = watch(directory, (_event, name) => {
162
+ if (name !== null && name.toString() !== entry) return;
163
+ if (directory !== dirname(stateFile)) observe();
164
+ refresh();
165
+ });
166
+ next.on("error", () => {
167
+ next.close();
168
+ if (watcher === next) watcher = null;
169
+ });
170
+ next.unref();
171
+ watcher = next;
172
+ recheck = setTimeout(refresh, WATCH_RECHECK_MS);
173
+ recheck.unref();
174
+ return;
175
+ } catch (error) {
176
+ if (directory === home || !(error instanceof Error && "code" in error && error.code === "ENOENT")) return;
177
+ directory = dirname(directory);
178
+ }
179
+ };
180
+ observe();
181
+ refresh();
182
+ const timer = setInterval(() => {
183
+ observe();
184
+ refresh();
185
+ }, 1e4);
186
+ return () => {
187
+ closed = true;
188
+ watcher?.close();
189
+ clearTimeout(recheck);
190
+ clearInterval(timer);
191
+ for (const stop of stops.values()) stop();
192
+ };
193
+ }
194
+ //#endregion
195
+ export { followHostedLogs as n, syncHostedLogs as r, followHostedLaunchLogs as t };
@@ -1,9 +1,9 @@
1
1
  import { o as cancellableSleep } from "./exec-VFRpu1iA.mjs";
2
- import { a as removeAgentAccess, i as agentAccess, r as closeAgentConnection, t as pullHostedMacosLogs } from "./hosted-logs-CYIZ5ubJ.mjs";
3
- import { l as phaseLine } from "./command-output-DxC0k2rk.mjs";
4
- import { n as macosDir } from "./state-BfAltYJP.mjs";
5
- import { d as runCancellationSignal } from "./native-run-BmH7U8pr.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-BBTVe3X6.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";
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,10 @@
1
1
  import { o as cancellableSleep } from "./exec-VFRpu1iA.mjs";
2
- import { d as workspaceDir } from "./paths-DQtTgsBf.mjs";
3
- import { a as removeAgentAccess, i as agentAccess, n as pullHostedNativeLogs, r as closeAgentConnection } from "./hosted-logs-CYIZ5ubJ.mjs";
4
- import { l as withWorkspaceStateLockAsync, r as readWorkspaceState$1 } from "./workspace-state-CeBpIZgr.mjs";
5
- import { d as runCancellationSignal } from "./native-run-BmH7U8pr.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, 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-BBTVe3X6.mjs";
7
- import { a as requireHostedMetro, i as requestHostedMetro, n as closeHostedMetro } from "./metro-gateway-DtsOy-0P.mjs";
8
- import { s as writeHostedNative } from "./ios-state-DlElquYD.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";
9
8
  import { randomUUID } from "node:crypto";
10
9
  import { readFileSync } from "node:fs";
11
10
  import { join } from "node:path";
@@ -1,11 +1,14 @@
1
- import { V as deviceSlotKey, _ as loadConfig$1 } from "./config-BZhXY15H.mjs";
2
- import { o as formatLongDuration } from "./command-output-DxC0k2rk.mjs";
3
- import { r as readWorkspaceState$1, s as updateWorkspaceStateAsync } from "./workspace-state-CeBpIZgr.mjs";
4
- import { A as workspaceBuildInProgress, T as collectOwnedDeviceActivity } from "./budget-dPGuhNai.mjs";
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";
5
6
  import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
6
- import { A as teardownOwnedIosSim, O as teardownOwnedAvd } from "./workspaces-CSV2Orf4.mjs";
7
- import { _ as workspaceDeviceLastUseAt } from "./activity-Dq3ZcdD8.mjs";
8
- import { d as listAllIosSims } from "./ios-CVUFFZ6C.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";
10
+ import { join } from "node:path";
11
+ import { LOG_ROTATE_BYTES } from "@stim-cli/core";
9
12
  import { DEVICE_IDLE_SHUTDOWN_KEY, DEVICE_RECLAIM_REASON, readDeviceIdleShutdowns } from "@stim-cli/core/state";
10
13
  //#region src/devices/idle-shutdown.ts
11
14
  const SIM_LIST_TIMEOUT_MS = 1e4;
@@ -58,6 +61,15 @@ function dueIdleDevices(root, idleMs, now = Date.now()) {
58
61
  }];
59
62
  });
60
63
  }
64
+ /** Appends an idle shutdown record to the workspace's metro.ndjson, where the supervisor writes its own. */
65
+ function writeIdleShutdownEvent(root, event) {
66
+ const writer = createNdjsonWriter(join(workspaceLogsDir$1(root), "metro.ndjson"), { maxBytes: LOG_ROTATE_BYTES });
67
+ writer.write({
68
+ src: "metro",
69
+ ...event
70
+ });
71
+ writer.close();
72
+ }
61
73
  /**
62
74
  * Shuts down, through centralized teardown, each of the workspace's owned devices that is still idle for `idleMs`,
63
75
  * and records why. The caller holds the workspace's native-run lock, so no `ios` or `android` run is booting or
@@ -108,7 +120,8 @@ async function shutDownIdleDevices(root, idleMs, log, now = Date.now(), { only,
108
120
  } else if (outcome.status !== "missing") log({
109
121
  level: "warn",
110
122
  event: "device_idle_shutdown_failed",
111
- msg: `could not shut down idle ${what}: ${outcome.reason}`
123
+ msg: `could not shut down idle ${what}: ${outcome.reason}`,
124
+ ...outcome.status === "skipped" ? { skipped: true } : {}
112
125
  });
113
126
  }
114
127
  return shutDown;
@@ -127,4 +140,4 @@ async function clearDeviceIdleShutdown(root, platform, slot = "default") {
127
140
  });
128
141
  }
129
142
  //#endregion
130
- export { dueIdleDevices as n, shutDownIdleDevices as r, clearDeviceIdleShutdown as t };
143
+ export { writeIdleShutdownEvent as i, dueIdleDevices as n, shutDownIdleDevices as r, clearDeviceIdleShutdown as t };
@@ -1,9 +1,9 @@
1
- import { h as shortUdid, i as formatDuration, l as phaseLine, m as shortHash } from "./command-output-DxC0k2rk.mjs";
2
- import { Nn as schemesFromInfoPlist, jn as pickDevClientScheme } from "./budget-dPGuhNai.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-B1W-hmC2.mjs";
4
- import { n as ensureWorkspaceStorageSafely } from "./native-runtime-DgtJkzIa.mjs";
5
- import { t as devClientScheme } from "./dev-client-w_fok0Ek.mjs";
6
- import { a as lastBuildRecord, i as iosFacts, n as cacheDescription, s as writeLastBuild } from "./ios-project-KYqeJURj.mjs";
7
- import { n as registerIos, r as runIosOperation, t as iosCommand } from "./ios-B1FXRCMX.mjs";
8
- import { a as collectorEntry, o as replaceCollector } from "./launch-BVlyQw3T.mjs";
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";
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 };