stim 1.25.0 → 1.27.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 (182) hide show
  1. package/README.md +1 -1
  2. package/dist/{acquire-artifact-zA4S7RHE.mjs → acquire-artifact-BKN2Yuhg.mjs} +2 -2
  3. package/dist/{act-BbHS3oV8.mjs → act-ROviTF_t.mjs} +415 -118
  4. package/dist/{activity-BpjwrQXU.mjs → activity-Cd-ysFes.mjs} +6 -7
  5. package/dist/{agent-device-usage-output-Bnkerfod.mjs → agent-device-usage-output-C5nCKWp9.mjs} +5 -5
  6. package/dist/{android-CNZgRC-4.mjs → android--HBgpvpW.mjs} +5 -5
  7. package/dist/{android-BGwuK3Mc.mjs → android-Cd6w7_qw.mjs} +134 -57
  8. package/dist/{android-saBeB4lr.mjs → android-Deb9X3_Y.mjs} +37 -15
  9. package/dist/{android-Cjcj8MCw.mjs → android-DriNoAVy.mjs} +99 -47
  10. package/dist/{android-cas-BVqh2Zep.mjs → android-cas-D5e6ecUg.mjs} +4 -4
  11. package/dist/android-cas-compiler.mjs +1 -1
  12. package/dist/{android-project-CTYaETc0.d.mts → android-project-DUGMbq28.d.mts} +55 -1
  13. package/dist/api.d.mts +20 -7
  14. package/dist/api.mjs +42 -32
  15. package/dist/apk-signed-tail-BHQHx3Rm.mjs +142 -0
  16. package/dist/{artifact-Co8zixVx.mjs → artifact-0AGJYB9O.mjs} +28 -28
  17. package/dist/{artifact-DN8JNwqS.mjs → artifact-faemIZv5.mjs} +40 -30
  18. package/dist/{artifact-platform-CMRc0M_r.mjs → artifact-platform-BO2Uvk_A.mjs} +1 -1
  19. package/dist/{attempt-DW-mQqM7.mjs → attempt-ClyJlZPT.mjs} +4 -2
  20. package/dist/auto-placement-z-H5pJza.mjs +350 -0
  21. package/dist/{browser-web-CCgZsHmI.mjs → browser-web-slD8AvLp.mjs} +16 -17
  22. package/dist/{build-cache-CKCzxzxA.mjs → build-cache-gBJ-WKzA.mjs} +141 -37
  23. package/dist/{build-CAiw8Ezm.mjs → build-hS0QyFlQ.mjs} +38 -31
  24. package/dist/{build-plan-zCuHGlA8.mjs → build-plan-CBqYbzYM.mjs} +7 -6
  25. package/dist/{cache-manifest-BPXRONJz.mjs → cache-manifest-DEjqGGat.mjs} +1 -1
  26. package/dist/cache-manifest.mjs +1 -1
  27. package/dist/{budget-HyShrIpL.mjs → ccache-BWTze1Ls.mjs} +634 -1514
  28. package/dist/{cdp-BG3FJCCx.mjs → cdp-C3svvXiE.mjs} +1 -1
  29. package/dist/{chrome-BvV8ssI3.mjs → chrome-DyDWurWG.mjs} +1 -1
  30. package/dist/{cli-C4w607Pz.mjs → cli-ftXDLto1.mjs} +24 -23
  31. package/dist/cli.mjs +1 -1
  32. package/dist/{client-BQsmyp_-.mjs → client-xsdxrhWA.mjs} +77 -116
  33. package/dist/collector-run.d.mts +10 -9
  34. package/dist/collector-run.mjs +42 -27
  35. package/dist/{command-output-BBvS1H6v.mjs → command-output-Dj-WT4BP.mjs} +1 -1
  36. package/dist/{config-BZhXY15H.mjs → config-Cn94Jc0g.mjs} +343 -18
  37. package/dist/{launch-DscF1QfM.mjs → dependencies-BGokZ-Ng.mjs} +330 -279
  38. package/dist/{dependency-state-BwNCYG5Q.mjs → dependency-state-C3OtgG94.mjs} +14 -7
  39. package/dist/{detached-entry-KmieOKgN.mjs → detached-entry-BPlSaCwC.mjs} +1 -1
  40. package/dist/{dev-client-CHoXXZeg.mjs → dev-client-BMca82xo.mjs} +2 -2
  41. package/dist/{device-F5-4z9ef.mjs → device-BJm0irrq.mjs} +16 -16
  42. package/dist/{device-capacity-ZYaRALv5.mjs → device-capacity-6LP7QsaA.mjs} +103 -25
  43. package/dist/device-host-worker.mjs +19 -21
  44. package/dist/{device-ios-DkHBrmvH.mjs → device-ios-534c14fz.mjs} +288 -28
  45. package/dist/{device-lease-run-ogEeJ62K.mjs → device-lease-run-DwsGfjUN.mjs} +5 -5
  46. package/dist/{device-pool-BIg8MU8l.mjs → device-pool-BnQqvs6o.mjs} +3 -3
  47. package/dist/{device-B9FqTBYW.mjs → device-tM41-TUq.mjs} +25 -24
  48. package/dist/{doctor-A_Nr_fDe.mjs → doctor-Dbx1ZpD2.mjs} +1 -1
  49. package/dist/{doctor-k3P3PizH.mjs → doctor-DyqE9n1J.mjs} +28 -16
  50. package/dist/{doctor-Bm8TVpGn.mjs → doctor-F-3VUUyN.mjs} +128 -35
  51. package/dist/{doctor-fingerprint-zlujA1Gs.mjs → doctor-fingerprint-o7ZI9YLn.mjs} +9 -3
  52. package/dist/doctor-fingerprint.mjs +1 -1
  53. package/dist/{doctor-watchman-BovI1y3-.mjs → doctor-watchman-CxDbyrrt.mjs} +5 -5
  54. package/dist/{eas-build-CyDKNTBP.mjs → eas-build-CjNSWmjo.mjs} +4 -4
  55. package/dist/eas-fallback-9fqb46kW.mjs +87 -0
  56. package/dist/{eas-session-ledger-BMCA1gdO.mjs → eas-session-ledger-DrP4OuuM.mjs} +6 -6
  57. package/dist/{error-diagnostics-B1Mj_-7h.mjs → error-diagnostics-snej9k4j.mjs} +51 -25
  58. package/dist/{exec-VFRpu1iA.mjs → exec-aULwtNly.mjs} +57 -6
  59. package/dist/{gc-eaz403W6.mjs → gc-BRwAY3qT.mjs} +2 -2
  60. package/dist/{gc-B9jcnmIk.mjs → gc-CGZ1Yg88.mjs} +218 -72
  61. package/dist/{guide-DR0K0xW9.mjs → guide-_rfEh_zM.mjs} +839 -222
  62. package/dist/{hosted-android-Bvb2-ZxD.mjs → hosted-android-BMKzUNnY.mjs} +4 -4
  63. package/dist/{hosted-client-rsRqysJc.mjs → hosted-client-D7Pk_Oo1.mjs} +13 -9
  64. package/dist/{hosted-logs-CWKGYWNX.mjs → hosted-logs-B1gqQuva.mjs} +18 -12
  65. package/dist/hosted-logs-sync-Dg3qrZmV.mjs +195 -0
  66. package/dist/{hosted-macos-d0pv9Tth.mjs → hosted-macos-B9w4H8hc.mjs} +6 -6
  67. package/dist/{hosted-native-BxTizGU2.mjs → hosted-native-CdgaiuyP.mjs} +17 -17
  68. package/dist/{idle-shutdown-BIyfl0Zj.mjs → idle-shutdown-Cbvo5KEh.mjs} +21 -9
  69. package/dist/{ios-BRVM8b0P.mjs → ios-B5HlVMhQ.mjs} +138 -55
  70. package/dist/{ios-Dvt97HgQ.mjs → ios-Bk4mWbtS.mjs} +8 -8
  71. package/dist/{ios-ENC4sRPA.mjs → ios-CsRVik64.mjs} +7 -1
  72. package/dist/{ios-BQzvJlzw.mjs → ios-E26qSpkb.mjs} +94 -11
  73. package/dist/{ios-device-CKSvk0bu.mjs → ios-device-C_QkIf1Z.mjs} +3 -3
  74. package/dist/{ios-device-B6HK951C.mjs → ios-device-CiBA-er9.mjs} +1 -1
  75. package/dist/{ios-project-DCUDo06I.mjs → ios-project-D8Jcy_br.mjs} +22 -9
  76. package/dist/{ios-signing-4c_qXvQm.mjs → ios-signing-BJzvDPfU.mjs} +2 -2
  77. package/dist/{ios-state-CT9nV5SP.mjs → ios-state-BZ03NFgF.mjs} +1 -1
  78. package/dist/{js-swap-Z9HbC4cj.mjs → js-swap-Dg2a945i.mjs} +8 -7
  79. package/dist/{launch-D0lPvFFu.mjs → launch-CRyBeNsA.mjs} +53 -44
  80. package/dist/lightened-BCsdAGj_.mjs +171 -0
  81. package/dist/{logs-BsIRre8x.mjs → logs-CC_-ZzEE.mjs} +10 -174
  82. package/dist/{logs-Crs9y34Z.mjs → logs-aJQb-RDg.mjs} +112 -38
  83. package/dist/{macos-CcUlJPMu.mjs → macos-BGmTpnv9.mjs} +1 -1
  84. package/dist/{macos-D477nfzH.mjs → macos-DlCBhMw5.mjs} +73 -39
  85. package/dist/macos-run.mjs +1 -1
  86. package/dist/maintenance-run.mjs +30 -13
  87. package/dist/{metro-1pJgCX4U.mjs → metro-CvyD-xwe.mjs} +4 -4
  88. package/dist/{metro-gateway-Bp9gJQAN.mjs → metro-gateway-BnHdqMO_.mjs} +3 -4
  89. package/dist/{named-ports-BVbn8SvC.mjs → named-ports-BCyMWA6b.mjs} +3 -3
  90. package/dist/{native-android-BvMizJn1.mjs → native-android-DlpxCyOP.mjs} +17 -18
  91. package/dist/{native-gradle-artifact-inputs-BJscK4vN.mjs → native-gradle-artifact-inputs-C13qT7R_.mjs} +5 -5
  92. package/dist/{native-runtime-B9w_Qyz3.mjs → native-runtime-DqaIBO5w.mjs} +9 -9
  93. package/dist/{native-source-D-4Dh4JU.mjs → native-source-D1AzWiuP.mjs} +1 -1
  94. package/dist/{native-xcode-inputs-Cv4l-obn.mjs → native-xcode-inputs-B1W8SrxB.mjs} +3 -3
  95. package/dist/{native-xcode-ios-DGrg90hE.mjs → native-xcode-ios-QPP0Rm68.mjs} +17 -18
  96. package/dist/{ndjson-CgE_o3Dl.mjs → ndjson-Dy2W4vRa.mjs} +2 -2
  97. package/dist/offload-worker.d.mts +3 -1
  98. package/dist/offload-worker.mjs +34 -25
  99. package/dist/{operation-exec-CUZifp6Z.mjs → operation-exec-Dp4FuIGR.mjs} +1 -1
  100. package/dist/{ownership-jxxz-19m.mjs → ownership-Bx-0cku-.mjs} +3 -3
  101. package/dist/{page-CzEA_-5_.mjs → page-CQJlcj3x.mjs} +2 -2
  102. package/dist/{phone-reverses-CYb7RRAx.mjs → phone-reverses-C9yAaKEv.mjs} +18 -4
  103. package/dist/{placement-log-DjOXJRIH.mjs → placement-log-BXUbiZM6.mjs} +3 -3
  104. package/dist/{plan-placement-BqKgKHCi.mjs → plan-placement-UxnQjv5Z.mjs} +36 -10
  105. package/dist/{ports-DtS1Amb0.mjs → ports-uUrghqWN.mjs} +3 -3
  106. package/dist/prebuild-BDpToDgR.mjs +1246 -0
  107. package/dist/{project-BiC68mIp.mjs → project-DYj-HVx6.mjs} +17 -18
  108. package/dist/{pull-request-CbNlkFok.mjs → pull-request-BzLmzAIQ.mjs} +2 -2
  109. package/dist/pull-requests.mjs +1 -1
  110. package/dist/{react-native-android-DRYqoJc4.mjs → react-native-android-DDBccgJw.mjs} +56 -36
  111. package/dist/{react-native-build-CwZB-agu.mjs → react-native-build-DaK2IFyP.mjs} +9 -9
  112. package/dist/{react-native-doctor-BCrytK7h.mjs → react-native-doctor-B-Mw6DcR.mjs} +50 -9
  113. package/dist/{react-native-ios-Cr1buNFo.mjs → react-native-ios-DjYwUF9U.mjs} +45 -25
  114. package/dist/{recordings-BaoQ0t-J.mjs → recordings-C20iUZfp.mjs} +1 -1
  115. package/dist/{registration-CN6nlhcD.mjs → registration-BwCe64PH.mjs} +1 -1
  116. package/dist/{reload-Beftw2X3.mjs → reload-DJBeF_rC.mjs} +1 -1
  117. package/dist/{reload-FbSgMF8x.mjs → reload-fUdkH2_p.mjs} +16 -16
  118. package/dist/{remote-BuZj6AyU.mjs → remote-y6n99WMW.mjs} +22 -9
  119. package/dist/{result-CR2vk2cj.mjs → result-CTqBw2Te.mjs} +32 -21
  120. package/dist/{run-BtzE09Dl.mjs → run-DaCeNKRm.mjs} +3 -3
  121. package/dist/{selection-D5cxEl3t.mjs → selection-Bs8phwhN.mjs} +183 -62
  122. package/dist/{server-bare-CH9X0RLn.mjs → server-bare-BOh-iZEj.mjs} +2 -2
  123. package/dist/{server-command-CaBbDNU2.mjs → server-command-8CuA51Cv.mjs} +6 -6
  124. package/dist/{server-expo-Ck8EIidM.mjs → server-expo-ABQs2XFA.mjs} +4 -4
  125. package/dist/server-expo-Ba_Y21vB.mjs +2 -0
  126. package/dist/{settings-B5tCoq9N.mjs → settings-BDVI8Ivc.mjs} +331 -62
  127. package/dist/{settings-DzH9mGQZ.mjs → settings-CMHhQNwI.mjs} +24 -3
  128. package/dist/settings-payload-cm60Zhib.mjs +257 -0
  129. package/dist/settings-write-BdNRLlBn.mjs +185 -0
  130. package/dist/settings.schema.json +84 -39
  131. package/dist/{simslim-BjxszUAb.mjs → simslim-DCQwzoPy.mjs} +4 -3
  132. package/dist/{slot-launch-QeuJMlnJ.mjs → slot-launch-0l7RqSpr.mjs} +6 -6
  133. package/dist/{stage-D8xlRU2D.mjs → stage-F4cAfJGi.mjs} +2 -2
  134. package/dist/{start-C1JLjkNw.mjs → start-DcqnF9p8.mjs} +1 -1
  135. package/dist/{start-YMpNwLhh.mjs → start-DrPwER_2.mjs} +27 -23
  136. package/dist/{state-DMRNP7-4.mjs → state-BX1y5syV.mjs} +4 -5
  137. package/dist/{state-DPaM3u5K.mjs → state-CZxLyetD.mjs} +2 -3
  138. package/dist/{stats-CP7STzZw.mjs → stats-GxuCbles.mjs} +5 -5
  139. package/dist/{stats-report-n2U5plhk.mjs → stats-report-B86Cv7Uc.mjs} +1 -1
  140. package/dist/{status-Fect2w9R.mjs → status-7ULDEJ1e.mjs} +1 -1
  141. package/dist/{status-CRLiJ-O_.mjs → status-BfnK9pUd.mjs} +25 -26
  142. package/dist/{status-cNw6i0_t.mjs → status-Bj7ZYvvc.mjs} +1 -1
  143. package/dist/{status-watch-Bc2J4TZn.mjs → status-watch-BfabQn03.mjs} +5 -5
  144. package/dist/status-worker.mjs +1 -1
  145. package/dist/{stim-desktop-DS0mzR8U.mjs → stim-desktop-CbWo21kb.mjs} +2 -2
  146. package/dist/{stop-COP6PQqw.mjs → stop-CH79S3IZ.mjs} +5 -6
  147. package/dist/{stop-Db9Kh-UA.mjs → stop-D-EAr25B.mjs} +25 -22
  148. package/dist/{stop-Br7LKxBE.mjs → stop-x1Yu3He4.mjs} +2 -2
  149. package/dist/supervisor-run.d.mts +1 -0
  150. package/dist/supervisor-run.mjs +17 -18
  151. package/dist/{support-qKcbgmI5.mjs → support-Be0UeVZU.mjs} +10 -10
  152. package/dist/{support-Cxj9CmII.mjs → support-CNg_YsOk.mjs} +6 -6
  153. package/dist/{swiftpm-artifact-inputs-iY9fsmOc.mjs → swiftpm-artifact-inputs-uPqYvGBv.mjs} +4 -4
  154. package/dist/{swiftpm-macos-Bp_sn9P4.mjs → swiftpm-macos-Ch4YjY_A.mjs} +11 -12
  155. package/dist/toolchain-CbCG6C5Z.mjs +2413 -0
  156. package/dist/toolchain-JYAOquPg.mjs +2 -0
  157. package/dist/{trigger-CBMe2YLH.mjs → trigger-DMou-X7j.mjs} +3 -3
  158. package/dist/trigger-qp2ji5wE.mjs +2 -0
  159. package/dist/{warm-progress-BV3ZPmcY.mjs → warm-progress-C0RsbngN.mjs} +731 -728
  160. package/dist/{web-B4Yjyt1G.mjs → web-Cq_AQ4DK.mjs} +9 -10
  161. package/dist/web-Je6abcpz.mjs +2 -0
  162. package/dist/web-run.mjs +9 -9
  163. package/dist/windows-report.mjs +1 -1
  164. package/dist/{workspace-state-CPSp3mav.mjs → workspace-state-BjqdjnJR.mjs} +46 -8
  165. package/dist/{workspaces-C9w4aeXF.mjs → workspaces-DFbj07jp.mjs} +1801 -76
  166. package/dist/{worktree-CclFIe1Z.mjs → worktree-COAJ3-OD.mjs} +934 -511
  167. package/dist/{worktree-Ct9Gk3KL.mjs → worktree-JGUd_53L.mjs} +1 -1
  168. package/package.json +8 -8
  169. package/dist/ccache-h1FKhZeg.mjs +0 -143
  170. package/dist/created-devices-D2Aca-xu.mjs +0 -52
  171. package/dist/eas-fallback-gaZi-dJL.mjs +0 -381
  172. package/dist/hosted-ios-RtVcJH3u.mjs +0 -15
  173. package/dist/native-run-D5OJsGwA.mjs +0 -276
  174. package/dist/paths-DQtTgsBf.mjs +0 -42
  175. package/dist/prebuild-JUaqOLpc.mjs +0 -501
  176. package/dist/server-expo-C16Zf2k7.mjs +0 -2
  177. package/dist/settings-write-n0zwfohx.mjs +0 -360
  178. package/dist/toolchain-DB1aeqxO.mjs +0 -2
  179. package/dist/toolchain-VzLJzZ7O.mjs +0 -908
  180. package/dist/trigger-BLsHgAGR.mjs +0 -2
  181. package/dist/web-DS4UDWvf.mjs +0 -2
  182. package/dist/xcode-CiIIDnuD.mjs +0 -910
@@ -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-CPSp3mav.mjs";
1
+ import { l as withWorkspaceStateLockAsync, o as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-BjqdjnJR.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) {
@@ -1,10 +1,10 @@
1
- import { _ as spawnDeclared, b as operationState, c as throwIfCancelled, t as getExecutor } from "./exec-VFRpu1iA.mjs";
1
+ import { _ as spawnDeclared, b as operationState, c as throwIfCancelled, t as getExecutor } from "./exec-aULwtNly.mjs";
2
2
  import { r as waitForChild, t as createLineReader } from "./process-output-Fpl8PYi8.mjs";
3
- import { a as killOnAbort, t as runOperationFile } from "./operation-exec-CUZifp6Z.mjs";
4
- import { Ut as makeTemporaryDirectory, Wt as removeTemporaryEntry } from "./settings-B5tCoq9N.mjs";
5
- import { $n as bundleInvocation } from "./budget-HyShrIpL.mjs";
6
- import { s as expoTelemetryEnv, t as cleanLine } from "./server-expo-Ck8EIidM.mjs";
7
- import { _ as tailLines, h as startBuildHeartbeat, r as HEARTBEAT_INTERVAL_MS } from "./xcode-CiIIDnuD.mjs";
3
+ import { a as killOnAbort, t as runOperationFile } from "./operation-exec-Dp4FuIGR.mjs";
4
+ import { $t as makeTemporaryDirectory, en as removeTemporaryEntry } from "./settings-BDVI8Ivc.mjs";
5
+ import { Bn as bundleInvocation } from "./ccache-BWTze1Ls.mjs";
6
+ import { G as tailLines, U as startBuildHeartbeat, j as HEARTBEAT_INTERVAL_MS } from "./toolchain-CbCG6C5Z.mjs";
7
+ import { s as expoTelemetryEnv, t as cleanLine } from "./server-expo-ABQs2XFA.mjs";
8
8
  import { randomUUID } from "node:crypto";
9
9
  import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
10
10
  import { basename, join } from "node:path";
@@ -120,7 +120,8 @@ async function readPlistKey(context, e, plist, key, format) {
120
120
  plist
121
121
  ], { timeoutMs: 1e4 });
122
122
  } catch (err) {
123
- if (/No value at that key path/.test(describe(err))) return null;
123
+ const stdout = typeof err === "object" && err !== null && "stdout" in err ? String(err.stdout) : "";
124
+ if (/No value at that key path/.test(`${describe(err)}\n${stdout}`)) return null;
124
125
  throw err;
125
126
  }
126
127
  }
@@ -1,22 +1,24 @@
1
- import { m as workspaceLogsDir } from "./paths-DQtTgsBf.mjs";
2
- import { B as deviceSlotFileKey, C as saveConfig, E as upsertProject, H as deviceSlotPlatforms, O as withConfigLockAsync, P as formatBytes, V as deviceSlotKey, _ as loadConfig, w as setDevice } from "./config-BZhXY15H.mjs";
3
- import { _ as stepTimer, c as launchErrorReport, i as formatDuration, l as phaseLine, n as appReadinessMessage, v as launchErrorPreview } from "./command-output-BBvS1H6v.mjs";
4
- import { L as workspaceDevServerMode } from "./project-BiC68mIp.mjs";
5
- import { o as workspaceLinks } from "./stim-desktop-DS0mzR8U.mjs";
6
- import { i as androidDataFreeBytes, ot as trimAndroidCaches, tt as resetAdoptedAvd, u as androidToolCwd } from "./android-Cjcj8MCw.mjs";
7
- import { c as pidExists, f as signalProcessTree } from "./metro-1pJgCX4U.mjs";
8
- import { $t as RELEASE_VERIFY_WAIT_MS, Cn as installConflictKind, Xt as LAUNCH_FATAL, Yt as LAUNCH_BUNDLING, Zt as LAUNCH_UNVERIFIED, an as unverifiedLaunchLines, en as VERIFY_TIMEOUT_MS, hn as androidDevClientUrl, in as unattributedLaunchLines, kn as restartedAppNote, mn as androidAppProcess, un as ADB_INSTALL_TIMEOUT_MS } from "./budget-HyShrIpL.mjs";
9
- import { O as teardownOwnedAvd } from "./workspaces-C9w4aeXF.mjs";
10
- import { _ as providerUploadOutcome } from "./build-cache-CKCzxzxA.mjs";
11
- import { n as verifyCollectorOwnership, r as readCollectors } from "./ownership-jxxz-19m.mjs";
12
- import { t as recordPhoneReverse } from "./phone-reverses-CYb7RRAx.mjs";
13
- import { n as nativeRunCommand, r as siblingPlatformSlots, t as launchSlotScope } from "./slot-launch-QeuJMlnJ.mjs";
1
+ import { x as withDrainingCancellation } from "./exec-aULwtNly.mjs";
2
+ import { k as workspaceLogsDir } from "./workspace-state-BjqdjnJR.mjs";
3
+ import { B as deviceSlotFileKey, C as saveConfig, E as upsertProject, H as deviceSlotPlatforms, O as withConfigLockAsync, P as formatBytes, V as deviceSlotKey, _ as loadConfig, w as setDevice } from "./config-Cn94Jc0g.mjs";
4
+ import { _ as stepTimer, c as launchErrorReport, i as formatDuration, l as phaseLine, n as appReadinessMessage, v as launchErrorPreview } from "./command-output-Dj-WT4BP.mjs";
5
+ import { L as workspaceDevServerMode } from "./project-DYj-HVx6.mjs";
6
+ import { o as workspaceLinks } from "./stim-desktop-CbWo21kb.mjs";
7
+ import { i as androidDataFreeBytes, ot as trimAndroidCaches, tt as resetAdoptedAvd, u as androidToolCwd } from "./android-DriNoAVy.mjs";
8
+ import { c as pidExists, f as signalProcessTree } from "./metro-CvyD-xwe.mjs";
9
+ import { Bt as RELEASE_VERIFY_WAIT_MS, Gt as unattributedLaunchLines, It as LAUNCH_BUNDLING, Kt as unverifiedLaunchLines, Lt as LAUNCH_FATAL, Rt as LAUNCH_UNVERIFIED, Vt as VERIFY_TIMEOUT_MS, Zt as ADB_INSTALL_TIMEOUT_MS, gn as restartedAppNote, nn as androidDevClientUrl, tn as androidAppProcess, un as installConflictKind } from "./ccache-BWTze1Ls.mjs";
10
+ import { ut as teardownOwnedAvd } from "./workspaces-DFbj07jp.mjs";
11
+ import { x as providerUploadOutcome } from "./build-cache-gBJ-WKzA.mjs";
12
+ import { t as recordPhoneReverse } from "./phone-reverses-C9yAaKEv.mjs";
13
+ import { n as verifyCollectorOwnership, r as readCollectors } from "./ownership-Bx-0cku-.mjs";
14
+ import { n as nativeRunCommand, r as siblingPlatformSlots, t as launchSlotScope } from "./slot-launch-0l7RqSpr.mjs";
14
15
  import { t as spawnEntry } from "./spawn-entry-jw19m8Nl.mjs";
15
- import { c as lostRefusal, s as lostLine, t as DEBUG_VERIFY_STEP_MS } from "./device-lease-run-ogEeJ62K.mjs";
16
- import { a as printNativeCrashReport, r as captureNativeCrashes, t as errorDiagnostics } from "./error-diagnostics-B1Mj_-7h.mjs";
17
- import { i as launchOutcomeRecord } from "./native-runtime-B9w_Qyz3.mjs";
18
- import { a as PLATFORM, b as noDeviceDiagnostic, h as displayPath, n as LAUNCH_FAILED, r as NO_DEVICE, t as INSTALL_FAILED } from "./support-Cxj9CmII.mjs";
19
- import { a as persistLastBuild, n as finishAndroidUpload, s as reportAndroidResult } from "./result-CR2vk2cj.mjs";
16
+ import { c as lostRefusal, s as lostLine, t as DEBUG_VERIFY_STEP_MS } from "./device-lease-run-DwsGfjUN.mjs";
17
+ import { a as captureNativeCrashes, r as androidCrashClockOffset, s as printNativeCrashReport, t as errorDiagnostics } from "./error-diagnostics-snej9k4j.mjs";
18
+ import { f as settleFingerprintCheck } from "./prebuild-BDpToDgR.mjs";
19
+ import { i as launchOutcomeRecord } from "./native-runtime-DqaIBO5w.mjs";
20
+ import { a as PLATFORM, b as noDeviceDiagnostic, h as displayPath, n as LAUNCH_FAILED, r as NO_DEVICE, t as INSTALL_FAILED } from "./support-CNg_YsOk.mjs";
21
+ import { a as persistLastBuild, n as finishAndroidUpload, s as reportAndroidResult } from "./result-CTqBw2Te.mjs";
20
22
  import { mkdirSync, openSync, statSync } from "node:fs";
21
23
  import { basename, join } from "node:path";
22
24
  import { ambientEnv } from "@stim-cli/core";
@@ -103,17 +105,11 @@ async function startCollector({ root, slot = "default", serial, packageName, spa
103
105
  //#endregion
104
106
  //#region src/commands/android/launch.ts
105
107
  function androidLaunchOutcomeRecord(kind, args) {
106
- if (kind !== "process") return launchOutcomeRecord({
108
+ return launchOutcomeRecord({
107
109
  ...args,
108
- release: kind === "embedded-js"
110
+ release: kind === "embedded-js",
111
+ process: kind === "process"
109
112
  });
110
- const unverified = args.launchState === LAUNCH_UNVERIFIED;
111
- return {
112
- src: "build",
113
- level: unverified ? "warn" : "info",
114
- event: unverified ? "launch_unverified" : "launch_verified",
115
- msg: unverified ? `${args.bundleId} could not be verified as running` : `${args.bundleId} is running its native process`
116
- };
117
113
  }
118
114
  function androidProcessRuntime(prepare, kind = "process") {
119
115
  return {
@@ -186,24 +182,33 @@ async function verifyAndroidProcessRun({ operation, root, slot, remoteDevice, ve
186
182
  phase("", chalk.yellow(`${embeddedJavaScript ? "A release process" : "The app process"} exited before readiness. Run \`stim logs --errors\` for captured crash reports, or \`stim logs --source device\` for the full device output.`));
187
183
  return { state: LAUNCH_FATAL };
188
184
  }
189
- async function verifyAndroidMetroRun({ operation, root, slot, remoteDevice, verifyLaunched, serial, androidPackage, metroCheck, logsDir, launchedAt, metroPort, isExpo, physical, device, scheme, component = null, phase, enterActivity }) {
190
- const runCommand = nativeRunCommand("android", slot, {
185
+ async function verifyAndroidMetroRun({ operation, root, slot, remoteDevice, verifyLaunched, serial, androidPackage, metroCheck, logsDir, launchedAt, metroPort, isExpo, physical, device, scheme, component = null, phase, enterActivity, hostedLogs, hostedRunCommand }) {
186
+ const runCommand = hostedRunCommand ?? nativeRunCommand("android", slot, {
191
187
  physical,
192
188
  deviceId: serial
193
189
  });
194
- const readNativeCrashes = () => remoteDevice ? [] : captureNativeCrashes({
195
- root,
196
- slot,
197
- platform: "android",
198
- deviceId: serial,
199
- appId: androidPackage,
200
- since: launchedAt
201
- }, logsDir, operation?.signal, operation?.env);
190
+ let clockOffsetMs;
191
+ const readNativeCrashes = async () => {
192
+ if (hostedLogs) return hostedLogs.readNativeCrashes();
193
+ if (remoteDevice) return [];
194
+ const measured = clockOffsetMs ?? await androidCrashClockOffset(serial, operation?.signal);
195
+ if (measured !== null) clockOffsetMs = measured;
196
+ return captureNativeCrashes({
197
+ root,
198
+ slot,
199
+ platform: "android",
200
+ deviceId: serial,
201
+ appId: androidPackage,
202
+ since: launchedAt,
203
+ clockOffsetMs: measured
204
+ }, logsDir, operation?.signal, operation?.env);
205
+ };
202
206
  const freshEmulator = Boolean((device.created || device.adoptionPending) && device.owned && !remoteDevice);
203
207
  const timeoutMs = freshEmulator ? 6e4 : VERIFY_TIMEOUT_MS;
204
208
  if (metroCheck && freshEmulator) phase("verify", `waiting up to 60s for bundle load (${device.created ? "new" : "adopted"} emulator)`);
205
209
  const siblings = metroCheck ? await siblingPlatformSlots(root, "android", slot) : [];
206
- const verification = metroCheck ? await verifyLaunched({
210
+ const verification = metroCheck ? await withDrainingCancellation(operation, operation?.signal, () => verifyLaunched({
211
+ signal: operation?.signal,
207
212
  timeoutMs,
208
213
  requireBundleResponse: true,
209
214
  slot: launchSlotScope(root, slot),
@@ -216,11 +221,13 @@ async function verifyAndroidMetroRun({ operation, root, slot, remoteDevice, veri
216
221
  platform: "android",
217
222
  mode: workspaceDevServerMode(root, isExpo),
218
223
  readNativeCrashes,
219
- processAlive: async () => {
224
+ readDeviceRecords: hostedLogs?.readDeviceRecords,
225
+ deviceLogsThrough: hostedLogs?.deviceLogsThrough,
226
+ processAlive: hostedLogs ? null : async () => {
220
227
  const running = await androidAppProcess(serial, androidPackage);
221
228
  return running.state === "unknown" ? null : running.state === "running";
222
229
  }
223
- }) : {
230
+ })) : {
224
231
  verified: false,
225
232
  skipped: true
226
233
  };
@@ -240,7 +247,7 @@ async function verifyAndroidMetroRun({ operation, root, slot, remoteDevice, veri
240
247
  phase("verify", chalk.red(`FATAL after ${formatDuration(verification.waitedMs ?? 0)}: ${reason}`));
241
248
  for (const line of launchErrorPreview(verification.errors ?? [], root)) phase("", chalk.red(line));
242
249
  if (verification.processAlive === false && !verification.errors?.some((record) => record.event === "native_crash")) phase("logs", "No attributable native crash report captured yet. Run `stim logs --errors` again for delayed reports, or `stim logs --source device` for available output.");
243
- if (nativeFatal || verification.processAlive === false) phase("remedy", chalk.yellow(`Fix the crash, then run \`${runCommand}\` again; it force-stops a crashed process that remains alive behind the system crash dialog. Metro reload cannot recover it.`));
250
+ if (nativeFatal || verification.processAlive === false) phase("remedy", chalk.yellow(hostedRunCommand ? `Fix the crash, then run \`${runCommand}\` again. Metro reload cannot recover it.` : `Fix the crash, then run \`${runCommand}\` again; it force-stops a crashed process that remains alive behind the system crash dialog. Metro reload cannot recover it.`));
244
251
  else if (verification.processAlive === true && metroPort !== null) phase("remedy", chalk.yellow(`The native app is still running. ${deliveryFailed ? "Check the Metro logs and device connection, then" : "Fix the JavaScript or TypeScript error, then"} run \`stim reload android\`. Do not run \`${runCommand}\` unless native inputs changed or the app process exits.`));
245
252
  return { state: LAUNCH_FATAL };
246
253
  }
@@ -288,7 +295,8 @@ async function verifyAndroidMetroRun({ operation, root, slot, remoteDevice, veri
288
295
  component,
289
296
  devClientUrl: scheme ? androidDevClientUrl(scheme, metroPort ?? 8081, physical) : null,
290
297
  devClient: Boolean(scheme),
291
- mode: workspaceDevServerMode(root, isExpo)
298
+ mode: workspaceDevServerMode(root, isExpo),
299
+ remote: Boolean(hostedLogs)
292
300
  })) phase("", chalk.yellow(line));
293
301
  return { state: LAUNCH_UNVERIFIED };
294
302
  }
@@ -374,7 +382,7 @@ async function resolveInstallSerial({ root, slot, device, physical, remoteDevice
374
382
  });
375
383
  return resolved.serial;
376
384
  }
377
- async function finishAndroidRun({ operation, runtime, runtimePreparation, lease, releaseLease, root, slot, json, metroCheck, useBuildCache, variant, release, isExpo, metroPort, logsDir, emuLog, device, physical, remoteDevice, bootPromise, resolveAvdSerial, waitForDeviceBoot, bootDuration, bootPending, apkPath, androidPackage: initialPackage, androidPackageProblem, record, waitedForBuild, ccache, uploadPending, providerUpload, providerName, remote, abandonedRemote: remoteWasAbandoned, started, startedAt, writer, phase, fail, readApkPackage, readProjectPackage, packageRemedy, install, launch, launchRelease, resolveDevClientScheme, verifyLaunched, verifyReleaseLaunched, spawn, kill, pidAlive, verifyCollector, writeLaunch, recordBuild, now, out, emit, recordRun, reclaimed, devServer, enterPhase, enterActivity, rebootDevice, dataFreeBytes = androidDataFreeBytes, trimCaches = trimAndroidCaches, wipeDevice = teardownOwnedAvd }) {
385
+ async function finishAndroidRun({ operation, runtime, runtimePreparation, lease, releaseLease, root, slot, json, metroCheck, useBuildCache, variant, release, isExpo, metroPort, logsDir, emuLog, device, physical, remoteDevice, bootPromise, resolveAvdSerial, waitForDeviceBoot, bootDuration, bootPending, apkPath, androidPackage: initialPackage, androidPackageProblem, record, waitedForBuild, ccache, uploadPending, fingerprintCheck, providerUpload, providerName, remote, abandonedRemote: remoteWasAbandoned, started, startedAt, writer, phase, fail, readApkPackage, readProjectPackage, packageRemedy, install, launch, launchRelease, resolveDevClientScheme, verifyLaunched, verifyReleaseLaunched, spawn, kill, pidAlive, verifyCollector, writeLaunch, recordBuild, now, out, emit, recordRun, reclaimed, devServer, enterPhase, enterActivity, rebootDevice, dataFreeBytes = androidDataFreeBytes, trimCaches = trimAndroidCaches, wipeDevice = teardownOwnedAvd }) {
378
386
  const { env, signal } = operation ?? {};
379
387
  let androidPackage = initialPackage;
380
388
  let leaseWarned = false;
@@ -590,6 +598,7 @@ async function finishAndroidRun({ operation, runtime, runtimePreparation, lease,
590
598
  const uploadWasAbandoned = await finishAndroidUpload(uploadPending, remote, phase);
591
599
  const providerOutcome = providerUploadOutcome(providerUpload ? await providerUpload : null, providerName, env);
592
600
  if (providerOutcome) phase("cache", providerOutcome.warn ? chalk.yellow(providerOutcome.line) : providerOutcome.line);
601
+ await settleFingerprintCheck(fingerprintCheck, "android", (line) => phase("fingerprint", chalk.yellow(line)), (entry) => writer.write(entry));
593
602
  persistLastBuild({
594
603
  recordBuild,
595
604
  root,
@@ -762,4 +771,4 @@ function diagnoseBootFailure(booted, logFile, runCommand, physical) {
762
771
  };
763
772
  }
764
773
  //#endregion
765
- export { killPreviousCollector as a, collectorLogFile as i, androidProcessRuntime as n, startCollector as o, finishAndroidRun as r, androidMetroRuntime as t };
774
+ export { collectorLogFile as a, verifyAndroidMetroRun as i, androidProcessRuntime as n, killPreviousCollector as o, finishAndroidRun as r, startCollector as s, androidMetroRuntime as t };
@@ -0,0 +1,171 @@
1
+ import { l as WorkspaceProcessCleanupError } from "./exec-aULwtNly.mjs";
2
+ import { c as withWorkspaceStateLock } from "./workspace-state-BjqdjnJR.mjs";
3
+ import { l as phaseLine } from "./command-output-Dj-WT4BP.mjs";
4
+ import { Nt as podsOutOfSync, Ot as listCarryableIgnoredEntries, Pt as readWorktreeExclude, Q as resolveSettings, Wt as warmWorktreePaths, _t as depsOutOfSync } from "./settings-BDVI8Ivc.mjs";
5
+ import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
6
+ import { h as warmWorktreeTarget } from "./worktree-COAJ3-OD.mjs";
7
+ import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
8
+ import { basename, dirname, join, relative } from "node:path";
9
+ import { isJsonObject, readJsonObject, workspaceLightenedFile, workspaceMetadataFile } from "@stim-cli/core/state";
10
+ //#region src/workspace/lightened.ts
11
+ function strings(value) {
12
+ return Array.isArray(value) ? value.filter((entry) => typeof entry === "string") : [];
13
+ }
14
+ function readRecord(root) {
15
+ const record = readJsonObject(workspaceLightenedFile(root));
16
+ return isJsonObject(record) ? {
17
+ dirs: strings(record.dirs),
18
+ pending: strings(record.pending)
19
+ } : {
20
+ dirs: [],
21
+ pending: []
22
+ };
23
+ }
24
+ /** The keys among `keys` that have a Stim workspace, which is what restores a lightened worktree. */
25
+ function workspaceKeys(keys) {
26
+ return keys.filter((key) => existsSync(workspaceMetadataFile(key)));
27
+ }
28
+ const LOCKFILES = [
29
+ "pnpm-lock.yaml",
30
+ "package-lock.json",
31
+ "yarn.lock",
32
+ "bun.lock",
33
+ "bun.lockb"
34
+ ];
35
+ function readOrNull(path) {
36
+ try {
37
+ return readFileSync(path);
38
+ } catch {
39
+ return null;
40
+ }
41
+ }
42
+ async function sourceFacts(worktree, operation) {
43
+ try {
44
+ const { root: source, common } = await warmWorktreePaths(worktree, operation);
45
+ const settings = resolveSettings({
46
+ gitCommonDir: common,
47
+ repoRoot: source
48
+ }).worktree;
49
+ const configured = isJsonObject(settings) && Array.isArray(settings.exclude) ? settings.exclude.filter((entry) => typeof entry === "string") : [];
50
+ const excluded = readWorktreeExclude(source);
51
+ const patterns = excluded?.length ? excluded : configured;
52
+ return {
53
+ source,
54
+ carryable: new Set(await listCarryableIgnoredEntries(source, patterns, {
55
+ env: operation?.env,
56
+ signal: operation?.signal,
57
+ declareFor: operation
58
+ }))
59
+ };
60
+ } catch (error) {
61
+ operation?.signal.throwIfAborted();
62
+ if (error instanceof WorkspaceProcessCleanupError) throw error;
63
+ return null;
64
+ }
65
+ }
66
+ /**
67
+ * Why `worktree warm` could not put back what is deleted at `path`, or null when it copies the same versions back: it
68
+ * carries that directory from the source checkout, and both hold the same lockfile.
69
+ */
70
+ async function restoreProblem({ worktree, path }, cache = /* @__PURE__ */ new Map(), operation) {
71
+ let pending = cache.get(worktree);
72
+ if (!pending) cache.set(worktree, pending = sourceFacts(worktree, operation));
73
+ const facts = await pending;
74
+ if (!facts) return "its source checkout cannot be resolved, so worktree warm could not restore it";
75
+ const rel = relative(worktree, path);
76
+ if (!facts.carryable.has(rel)) return `worktree warm would not copy ${rel} back from the source checkout`;
77
+ const pods = basename(rel) === "Pods";
78
+ if ((pods ? podsOutOfSync(facts.source, [rel]) : depsOutOfSync(facts.source, facts.source, [rel])).length) return `the source checkout's ${rel} was not installed from its own lockfile, so worktree warm would restore other versions`;
79
+ const differs = (pods ? [join(dirname(rel), "Podfile.lock")] : [.../* @__PURE__ */ new Set([".", dirname(rel)])].flatMap((dir) => LOCKFILES.map((name) => join(dir, name)))).find((lock) => {
80
+ const mine = readOrNull(join(worktree, lock));
81
+ const theirs = readOrNull(join(facts.source, lock));
82
+ return mine === null ? theirs !== null : theirs === null || !mine.equals(theirs);
83
+ });
84
+ return differs ? `its ${differs} differs from the source checkout's, so worktree warm would restore other versions` : null;
85
+ }
86
+ function writeRecord(key, update) {
87
+ withWorkspaceStateLock(key, () => {
88
+ const file = workspaceLightenedFile(key);
89
+ mkdirSync(dirname(file), { recursive: true });
90
+ const tmp = `${file}.tmp-${process.pid}`;
91
+ writeFileSync(tmp, `${JSON.stringify({
92
+ at: (/* @__PURE__ */ new Date()).toISOString(),
93
+ ...update(readRecord(key))
94
+ }, null, 2)}\n`, { mode: 384 });
95
+ renameSync(tmp, file);
96
+ });
97
+ }
98
+ /**
99
+ * Records in each Stim workspace among `keys` that `dir` is being deleted to lighten its worktree, before the deletion;
100
+ * it stays pending until `finishLightened`, so a deletion that stops part-way is still restored.
101
+ */
102
+ function recordLightened(keys, dir) {
103
+ for (const key of workspaceKeys(keys)) writeRecord(key, ({ dirs, pending }) => ({
104
+ dirs: [.../* @__PURE__ */ new Set([...dirs, dir])],
105
+ pending: [.../* @__PURE__ */ new Set([...pending, dir])]
106
+ }));
107
+ }
108
+ function finishLightened(keys, dir) {
109
+ for (const key of workspaceKeys(keys)) writeRecord(key, ({ dirs, pending }) => ({
110
+ dirs,
111
+ pending: pending.filter((entry) => entry !== dir)
112
+ }));
113
+ }
114
+ function depsFailure(root, message, remedy = `Run \`stim worktree warm\` in ${root}, or install the project's dependencies, then retry.`) {
115
+ return {
116
+ code: "STIM_DEPS_FAILED",
117
+ message: `gc lightened this worktree, and ${message}`,
118
+ remedy: `${remedy} If you installed them yourself, delete ${workspaceLightenedFile(root)} so Stim stops restoring them.`
119
+ };
120
+ }
121
+ /**
122
+ * Restores the dependencies gc deleted from this workspace's worktree through `stim worktree warm`, or returns the
123
+ * failure to report. A workspace gc never lightened is left alone.
124
+ */
125
+ async function restoreLightenedDependencies(root, operation) {
126
+ const { dirs, pending } = readRecord(root);
127
+ if (!dirs.length) return null;
128
+ const missing = () => dirs.filter((dir) => pending.includes(dir) || !existsSync(dir));
129
+ if (missing().length) {
130
+ const cache = /* @__PURE__ */ new Map();
131
+ const worktree = (await warmWorktreePaths(root, operation).catch(() => null))?.target;
132
+ for (const dir of missing()) {
133
+ const problem = worktree ? await restoreProblem({
134
+ worktree,
135
+ path: dir
136
+ }, cache, operation) : "its worktree cannot be resolved";
137
+ if (problem) return depsFailure(root, `${dir} cannot be restored by worktree warm: ${problem}.`, `Install the project's dependencies in ${root} (for example \`pnpm install\` or \`pod install\`), then retry.`);
138
+ }
139
+ operation.output("stderr", `${phaseLine("deps", `gc lightened this worktree; restoring ${missing().join(", ")} with worktree warm`)}\n`);
140
+ for (const dir of pending) {
141
+ if (!worktree || canonicalPath(dir) !== join(canonicalPath(worktree), relative(worktree, dir))) return depsFailure(root, `${dir} is reached through a link or lies outside its worktree, so it was not removed.`);
142
+ rmSync(dir, {
143
+ recursive: true,
144
+ force: true
145
+ });
146
+ }
147
+ let exitCode;
148
+ try {
149
+ ({exitCode} = await warmWorktreeTarget({
150
+ cwd: root,
151
+ operation
152
+ }));
153
+ } catch (error) {
154
+ operation.signal.throwIfAborted();
155
+ if (error instanceof WorkspaceProcessCleanupError) throw error;
156
+ return depsFailure(root, `worktree warm failed: ${error instanceof Error ? error.message : String(error)}`);
157
+ }
158
+ const left = dirs.filter((dir) => !existsSync(dir));
159
+ if (exitCode !== 0 || left.length) return depsFailure(root, `worktree warm did not restore ${left.join(", ") || "its dependencies"}.`);
160
+ }
161
+ withWorkspaceStateLock(root, () => rmSync(workspaceLightenedFile(root), { force: true }));
162
+ return null;
163
+ }
164
+ /** Prints a restore failure the way a native run reports a refusal, with the JSON line on stdout when asked. */
165
+ function printLightenedFailure(operation, failure, json) {
166
+ operation.output("stderr", `${phaseLine("error", `${failure.code}: ${failure.message}`)}\n`);
167
+ operation.output("stderr", `${phaseLine("remedy", failure.remedy)}\n`);
168
+ if (json) operation.output("stdout", `${JSON.stringify(failure)}\n`);
169
+ }
170
+ //#endregion
171
+ export { restoreProblem as a, restoreLightenedDependencies as i, printLightenedFailure as n, workspaceKeys as o, recordLightened as r, finishLightened as t };
@@ -1,18 +1,13 @@
1
- import { S as process_identity_exports } from "./exec-VFRpu1iA.mjs";
2
- import { m as workspaceLogsDir$1 } from "./paths-DQtTgsBf.mjs";
3
- import { G as projectDeviceSlots, _ as loadConfig$1 } from "./config-BZhXY15H.mjs";
4
- import { n as pullHostedNativeLogs, t as pullHostedMacosLogs } from "./hosted-logs-CWKGYWNX.mjs";
5
- import { l as phaseLine } from "./command-output-BBvS1H6v.mjs";
6
- import { f as readAgentDeviceRecordsAsync, n as agentDeviceLiveness, o as envDir } from "./activity-BpjwrQXU.mjs";
7
- import { l as connectHost } from "./hosted-client-rsRqysJc.mjs";
8
- import { n as readHostedIos, t as readHostedAndroid } from "./ios-state-CT9nV5SP.mjs";
9
- import "./hosted-macos-d0pv9Tth.mjs";
10
- import { i as captureWorkspaceCrashes } from "./error-diagnostics-B1Mj_-7h.mjs";
1
+ import { S as process_identity_exports } from "./exec-aULwtNly.mjs";
2
+ import { k as workspaceLogsDir$1 } from "./workspace-state-BjqdjnJR.mjs";
3
+ import { G as projectDeviceSlots, _ as loadConfig$1 } from "./config-Cn94Jc0g.mjs";
4
+ import { f as readAgentDeviceRecordsAsync, n as agentDeviceLiveness, o as envDir } from "./activity-Cd-ysFes.mjs";
5
+ import { o as captureWorkspaceCrashes } from "./error-diagnostics-snej9k4j.mjs";
6
+ import { n as followHostedLogs, r as syncHostedLogs } from "./hosted-logs-sync-Dg3qrZmV.mjs";
11
7
  import { readdirSync, statSync, watch } from "node:fs";
12
8
  import { homedir } from "node:os";
13
9
  import { dirname, join, relative, resolve, sep } from "node:path";
14
- import { ambientWrite, configDir } from "@stim-cli/core";
15
- import { LEVELS, SOURCES, agentDeviceStateDirsAsync, buildCriteria, compileGrep, createAsyncAgentActionReader, followLogs, logFiles, openLogDir, parseSince, readMacosRecord, recordMatches, workspaceStateFile } from "@stim-cli/core/state";
10
+ import { LEVELS, SOURCES, agentDeviceStateDirsAsync, buildCriteria, compileGrep, createAsyncAgentActionReader, followLogs, logFiles, openLogDir, parseSince, readMacosRecord, recordMatches } from "@stim-cli/core/state";
16
11
  import { setImmediate } from "node:timers/promises";
17
12
  import { realpath } from "node:fs/promises";
18
13
  //#region src/devices/agent-actions.ts
@@ -221,166 +216,6 @@ function followAgentActions(context, read, onRecord) {
221
216
  return stop;
222
217
  }
223
218
  //#endregion
224
- //#region src/device-host/hosted-logs-sync.ts
225
- const WATCH_RECHECK_MS = 100;
226
- function warn(context, machine, error) {
227
- const text = `${warning(machine, error)}\n`;
228
- if (context) context.output("stderr", text);
229
- else ambientWrite("stderr", text);
230
- }
231
- function warning(machine, error) {
232
- const message = error.message.replace(/\.$/, "");
233
- const hint = message.includes("refused device-host.logs.query") ? ` If ${machine} runs an older stim-server, update it.` : "";
234
- return phaseLine("device", `Could not read the app's logs from ${machine}: ${message}. Showing the logs already copied here.${hint}`);
235
- }
236
- async function syncHostedMacosLogs(root, placement, slot, warnings, platform = "ios", context) {
237
- let host;
238
- const cancel = () => host?.connection.close();
239
- context?.signal.addEventListener("abort", cancel, { once: true });
240
- try {
241
- host = await connectHost(placement.machine, void 0, false, context?.signal);
242
- if (slot !== void 0) await pullHostedNativeLogs(root, slot, placement, host, false, platform, context?.signal);
243
- else await pullHostedMacosLogs(root, placement, host, void 0, void 0, false, context?.signal);
244
- return true;
245
- } catch (error) {
246
- context?.signal.throwIfAborted();
247
- if (!warnings?.has(placement.machine)) {
248
- warn(context, placement.machine, error);
249
- warnings?.add(placement.machine);
250
- }
251
- return false;
252
- } finally {
253
- context?.signal.removeEventListener("abort", cancel);
254
- host?.connection.close();
255
- }
256
- }
257
- function followHostedMacosLogs(root, { failing = false, intervalMs = 500, retryMs = 5e3, slot, platform = "ios", context } = {}) {
258
- let host;
259
- const controller = new AbortController();
260
- const signal = context ? AbortSignal.any([context.signal, controller.signal]) : controller.signal;
261
- const cancel = () => host?.connection.close();
262
- signal.addEventListener("abort", cancel, { once: true });
263
- let retryAt = 0;
264
- let stopped = false;
265
- let running = false;
266
- const tick = async () => {
267
- if (running || stopped || signal.aborted || Date.now() < retryAt) return;
268
- running = true;
269
- try {
270
- const placement = slot !== void 0 ? (platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))[slot] : readMacosRecord(root)?.host;
271
- if (!placement) {
272
- host?.connection.close();
273
- host = void 0;
274
- return;
275
- }
276
- host ??= await connectHost(placement.machine, void 0, false, signal);
277
- if (slot !== void 0) await pullHostedNativeLogs(root, slot, placement, host, false, platform, signal);
278
- else await pullHostedMacosLogs(root, placement, host, void 0, void 0, false, signal);
279
- failing = false;
280
- } catch (error) {
281
- host?.connection.close();
282
- host = void 0;
283
- if (signal.aborted) return;
284
- if (!failing) warn(context, (slot !== void 0 ? (platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))[slot] : readMacosRecord(root)?.host)?.machine ?? "the host", error);
285
- failing = true;
286
- retryAt = Date.now() + retryMs;
287
- } finally {
288
- running = false;
289
- }
290
- };
291
- const timer = setInterval(() => void tick(), intervalMs);
292
- return () => {
293
- stopped = true;
294
- controller.abort();
295
- signal.removeEventListener("abort", cancel);
296
- clearInterval(timer);
297
- host?.connection.close();
298
- };
299
- }
300
- async function syncHostedLogs(root, context) {
301
- const macos = readMacosRecord(root)?.host;
302
- const warnings = /* @__PURE__ */ new Set();
303
- return (await Promise.all([
304
- ...macos ? [syncHostedMacosLogs(root, macos, void 0, warnings, "ios", context)] : [],
305
- ...Object.entries(readHostedIos(root)).map(([slot, placement]) => syncHostedMacosLogs(root, placement, slot, warnings, "ios", context)),
306
- ...Object.entries(readHostedAndroid(root)).map(([slot, placement]) => syncHostedMacosLogs(root, placement, slot, warnings, "android", context))
307
- ])).every(Boolean);
308
- }
309
- function followHostedLogs(root, failing, context) {
310
- const stops = /* @__PURE__ */ new Map();
311
- let closed = false;
312
- const refresh = () => {
313
- if (closed) return;
314
- const active = /* @__PURE__ */ new Set();
315
- if (readMacosRecord(root)?.host) {
316
- active.add("macos");
317
- if (!stops.has("macos")) stops.set("macos", followHostedMacosLogs(root, {
318
- failing,
319
- context
320
- }));
321
- }
322
- for (const platform of ["ios", "android"]) for (const slot of Object.keys(platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))) {
323
- const key = `${platform}:${slot}`;
324
- active.add(key);
325
- if (!stops.has(key)) stops.set(key, followHostedMacosLogs(root, {
326
- failing,
327
- slot,
328
- platform,
329
- context
330
- }));
331
- }
332
- for (const [key, stop] of stops) {
333
- if (active.has(key)) continue;
334
- stop();
335
- stops.delete(key);
336
- }
337
- };
338
- const stateFile = workspaceStateFile(root);
339
- const home = resolve(configDir());
340
- let watcher = null;
341
- let recheck;
342
- const observe = () => {
343
- if (closed) return;
344
- watcher?.close();
345
- watcher = null;
346
- clearTimeout(recheck);
347
- let directory = dirname(stateFile);
348
- for (;;) try {
349
- const entry = relative(directory, stateFile).split(sep)[0];
350
- const next = watch(directory, (_event, name) => {
351
- if (name !== null && name.toString() !== entry) return;
352
- if (directory !== dirname(stateFile)) observe();
353
- refresh();
354
- });
355
- next.on("error", () => {
356
- next.close();
357
- if (watcher === next) watcher = null;
358
- });
359
- next.unref();
360
- watcher = next;
361
- recheck = setTimeout(refresh, WATCH_RECHECK_MS);
362
- recheck.unref();
363
- return;
364
- } catch (error) {
365
- if (directory === home || !(error instanceof Error && "code" in error && error.code === "ENOENT")) return;
366
- directory = dirname(directory);
367
- }
368
- };
369
- observe();
370
- refresh();
371
- const timer = setInterval(() => {
372
- observe();
373
- refresh();
374
- }, 1e4);
375
- return () => {
376
- closed = true;
377
- watcher?.close();
378
- clearTimeout(recheck);
379
- clearInterval(timer);
380
- for (const stop of stops.values()) stop();
381
- };
382
- }
383
- //#endregion
384
219
  //#region src/engine/logs.ts
385
220
  async function openWorkspaceLogs(context, options = {}, follow = false) {
386
221
  context.signal.throwIfAborted();
@@ -429,8 +264,9 @@ async function readWorkspaceLogs(context, options = {}) {
429
264
  await view.close();
430
265
  }
431
266
  }
267
+ const WORKSPACE_SOURCES = SOURCES.filter((source) => source !== "gc" && source !== "builds");
432
268
  function validateLogOptions(options) {
433
- const invalid = (options.tail !== void 0 && (!Number.isSafeInteger(options.tail) || options.tail < 0) ? "tail must be a non-negative integer." : options.sources?.some((source) => !SOURCES.includes(source)) ? `sources must contain only ${SOURCES.join(", ")}.` : options.minLevel !== void 0 && !LEVELS.includes(options.minLevel) ? `minLevel must be one of ${LEVELS.join(", ")}.` : void 0) ?? (options.since !== void 0 ? parseSince(options.since).error : void 0) ?? (options.grep !== void 0 ? compileGrep(options.grep).error : void 0);
269
+ const invalid = (options.tail !== void 0 && (!Number.isSafeInteger(options.tail) || options.tail < 0) ? "tail must be a non-negative integer." : options.sources?.some((source) => !WORKSPACE_SOURCES.includes(source)) ? `sources must contain only ${WORKSPACE_SOURCES.join(", ")}.` : options.minLevel !== void 0 && !LEVELS.includes(options.minLevel) ? `minLevel must be one of ${LEVELS.join(", ")}.` : void 0) ?? (options.since !== void 0 ? parseSince(options.since).error : void 0) ?? (options.grep !== void 0 ? compileGrep(options.grep).error : void 0);
434
270
  if (invalid) throw Object.assign(new Error(invalid), { code: "STIM_BAD_ARG" });
435
271
  }
436
272
  async function followWorkspaceLogs(context, options, onRecord, onBackfill) {
@@ -483,4 +319,4 @@ async function followWorkspaceLogs(context, options, onRecord, onBackfill) {
483
319
  return stop;
484
320
  }
485
321
  //#endregion
486
- export { followAgentActions as a, followHostedLogs as i, openWorkspaceLogs as n, readWorkspaceLogs as r, followWorkspaceLogs as t };
322
+ export { followAgentActions as i, openWorkspaceLogs as n, readWorkspaceLogs as r, followWorkspaceLogs as t };