stim 1.25.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 (158) hide show
  1. package/README.md +1 -1
  2. package/dist/{acquire-artifact-zA4S7RHE.mjs → acquire-artifact-DVsvSwf7.mjs} +1 -1
  3. package/dist/{act-BbHS3oV8.mjs → act-C-BqJEpu.mjs} +157 -35
  4. package/dist/{activity-BpjwrQXU.mjs → activity-Lnb_EoRY.mjs} +4 -5
  5. package/dist/{agent-device-usage-output-Bnkerfod.mjs → agent-device-usage-output-DbXy5tg8.mjs} +4 -4
  6. package/dist/{android-saBeB4lr.mjs → android-B5P81yI-.mjs} +1 -1
  7. package/dist/{android-CNZgRC-4.mjs → android-CSbLRD53.mjs} +5 -5
  8. package/dist/{android-BGwuK3Mc.mjs → android-CiNQw3kq.mjs} +73 -49
  9. package/dist/{android-Cjcj8MCw.mjs → android-DTAcRwBC.mjs} +81 -34
  10. package/dist/{android-cas-BVqh2Zep.mjs → android-cas-BTVhZ0Qs.mjs} +4 -4
  11. package/dist/{android-project-CTYaETc0.d.mts → android-project-DUGMbq28.d.mts} +55 -1
  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-Co8zixVx.mjs → artifact-BxREhAaV.mjs} +23 -18
  16. package/dist/{artifact-DN8JNwqS.mjs → artifact-CsAP6AGK.mjs} +35 -20
  17. package/dist/{attempt-DW-mQqM7.mjs → attempt-ClyJlZPT.mjs} +4 -2
  18. package/dist/{browser-web-CCgZsHmI.mjs → browser-web-rYPyqhTf.mjs} +11 -12
  19. package/dist/{budget-HyShrIpL.mjs → budget-k2mZGvvk.mjs} +196 -33
  20. package/dist/{build-CAiw8Ezm.mjs → build-DPhApsjV.mjs} +26 -23
  21. package/dist/{build-cache-CKCzxzxA.mjs → build-cache-DrXNCy3T.mjs} +103 -21
  22. package/dist/{build-plan-zCuHGlA8.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-h1FKhZeg.mjs → ccache-Bx5TbxwG.mjs} +6 -6
  26. package/dist/{cli-C4w607Pz.mjs → cli-BBKFGOFl.mjs} +19 -19
  27. package/dist/cli.mjs +1 -1
  28. package/dist/{client-BQsmyp_-.mjs → client-D9CaRks-.mjs} +36 -61
  29. package/dist/collector-run.mjs +4 -4
  30. package/dist/{command-output-BBvS1H6v.mjs → command-output-BF5AR2dL.mjs} +1 -1
  31. package/dist/{config-BZhXY15H.mjs → config-BktkY_zC.mjs} +321 -15
  32. package/dist/{launch-DscF1QfM.mjs → dependencies-Dw6wfQdv.mjs} +258 -255
  33. package/dist/{dependency-state-BwNCYG5Q.mjs → dependency-state-DFB41vfr.mjs} +1 -1
  34. package/dist/{dev-client-CHoXXZeg.mjs → dev-client-DXR_tPVY.mjs} +2 -2
  35. package/dist/{device-B9FqTBYW.mjs → device-BK-zwyd_.mjs} +13 -13
  36. package/dist/{device-F5-4z9ef.mjs → device-BcYeHSFu.mjs} +14 -14
  37. package/dist/{device-capacity-ZYaRALv5.mjs → device-capacity-DCSvUF0l.mjs} +10 -17
  38. package/dist/device-host-worker.mjs +11 -13
  39. package/dist/{device-ios-DkHBrmvH.mjs → device-ios-BLGfXQeK.mjs} +49 -17
  40. package/dist/{device-lease-run-ogEeJ62K.mjs → device-lease-run-BmvIl7bI.mjs} +4 -4
  41. package/dist/{device-pool-BIg8MU8l.mjs → device-pool-Dluix4H3.mjs} +3 -3
  42. package/dist/{doctor-k3P3PizH.mjs → doctor-Bhg1ii70.mjs} +14 -14
  43. package/dist/{doctor-A_Nr_fDe.mjs → doctor-Cp-BhzTS.mjs} +1 -1
  44. package/dist/{doctor-Bm8TVpGn.mjs → doctor-OnwP94ne.mjs} +72 -23
  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-BovI1y3-.mjs → doctor-watchman-BStK05nt.mjs} +4 -4
  48. package/dist/{eas-build-CyDKNTBP.mjs → eas-build-Dsj93iM9.mjs} +2 -2
  49. package/dist/{eas-fallback-gaZi-dJL.mjs → eas-fallback-FwkeqqGi.mjs} +10 -10
  50. package/dist/{eas-session-ledger-BMCA1gdO.mjs → eas-session-ledger-B5vygTiD.mjs} +5 -5
  51. package/dist/{error-diagnostics-B1Mj_-7h.mjs → error-diagnostics-BOOm9Db7.mjs} +8 -8
  52. package/dist/{gc-eaz403W6.mjs → gc-C_79zvz4.mjs} +2 -2
  53. package/dist/{gc-B9jcnmIk.mjs → gc-ldgr-hXU.mjs} +74 -43
  54. package/dist/{guide-DR0K0xW9.mjs → guide-D7K0X6KG.mjs} +272 -52
  55. package/dist/{hosted-android-Bvb2-ZxD.mjs → hosted-android-Bk54ej6n.mjs} +3 -3
  56. package/dist/{hosted-client-rsRqysJc.mjs → hosted-client-fHO8yqzc.mjs} +5 -5
  57. package/dist/{hosted-ios-RtVcJH3u.mjs → hosted-ios-D55QhYaD.mjs} +1 -1
  58. package/dist/{hosted-logs-CWKGYWNX.mjs → hosted-logs-BfbmDM4M.mjs} +17 -11
  59. package/dist/hosted-logs-sync-B0pvmOk-.mjs +195 -0
  60. package/dist/{hosted-macos-d0pv9Tth.mjs → hosted-macos-CPl0OZ9h.mjs} +5 -5
  61. package/dist/{hosted-native-BxTizGU2.mjs → hosted-native-CpDB3-PO.mjs} +6 -7
  62. package/dist/{idle-shutdown-BIyfl0Zj.mjs → idle-shutdown-FfxL1KdG.mjs} +22 -9
  63. package/dist/{ios-Dvt97HgQ.mjs → ios-B7-lToDu.mjs} +8 -8
  64. package/dist/{ios-BQzvJlzw.mjs → ios-WxpDJ5T1.mjs} +72 -5
  65. package/dist/{ios-device-CKSvk0bu.mjs → ios-device-CsyryvpT.mjs} +1 -1
  66. package/dist/{ios-BRVM8b0P.mjs → ios-ftxdQbJS.mjs} +74 -46
  67. package/dist/{ios-project-DCUDo06I.mjs → ios-project-Ty5pHl9O.mjs} +6 -6
  68. package/dist/{ios-state-CT9nV5SP.mjs → ios-state-Cw7-WQf2.mjs} +1 -1
  69. package/dist/{js-swap-Z9HbC4cj.mjs → js-swap-BMhXYVDS.mjs} +4 -4
  70. package/dist/{launch-D0lPvFFu.mjs → launch-DOp8RjDz.mjs} +31 -26
  71. package/dist/{logs-BsIRre8x.mjs → logs-dQDki6Tt.mjs} +9 -173
  72. package/dist/{logs-Crs9y34Z.mjs → logs-s1dRIG1E.mjs} +85 -36
  73. package/dist/{macos-CcUlJPMu.mjs → macos-B0VEV3Gf.mjs} +1 -1
  74. package/dist/{macos-D477nfzH.mjs → macos-DBBPNnIA.mjs} +18 -19
  75. package/dist/macos-run.mjs +1 -1
  76. package/dist/maintenance-run.mjs +28 -11
  77. package/dist/{metro-1pJgCX4U.mjs → metro-CjC10t6E.mjs} +2 -2
  78. package/dist/{metro-gateway-Bp9gJQAN.mjs → metro-gateway-B6_PgD0L.mjs} +2 -3
  79. package/dist/{named-ports-BVbn8SvC.mjs → named-ports-BG0j1X4g.mjs} +2 -2
  80. package/dist/{native-android-BvMizJn1.mjs → native-android-CL2NGiik.mjs} +17 -17
  81. package/dist/{native-gradle-artifact-inputs-BJscK4vN.mjs → native-gradle-artifact-inputs-btSUulme.mjs} +3 -3
  82. package/dist/{native-run-D5OJsGwA.mjs → native-run-BfIDFKLH.mjs} +2 -3
  83. package/dist/{native-runtime-B9w_Qyz3.mjs → native-runtime-Dq3RBcON.mjs} +6 -7
  84. package/dist/{native-xcode-inputs-Cv4l-obn.mjs → native-xcode-inputs-BW7H8JGu.mjs} +2 -2
  85. package/dist/{native-xcode-ios-DGrg90hE.mjs → native-xcode-ios-CBXJAxfC.mjs} +15 -16
  86. package/dist/offload-worker.d.mts +3 -1
  87. package/dist/offload-worker.mjs +31 -21
  88. package/dist/{ownership-jxxz-19m.mjs → ownership-BjYvMNX_.mjs} +2 -2
  89. package/dist/{phone-reverses-CYb7RRAx.mjs → phone-reverses-lmj6kcPm.mjs} +3 -3
  90. package/dist/{placement-log-DjOXJRIH.mjs → placement-log-DIFPQAXp.mjs} +1 -1
  91. package/dist/{plan-placement-BqKgKHCi.mjs → plan-placement-IiiSQhtz.mjs} +3 -3
  92. package/dist/{ports-DtS1Amb0.mjs → ports-C2_w1Z0Z.mjs} +3 -3
  93. package/dist/prebuild-gmouvmJZ.mjs +1247 -0
  94. package/dist/{project-BiC68mIp.mjs → project-BUu6Is4k.mjs} +15 -16
  95. package/dist/{react-native-android-DRYqoJc4.mjs → react-native-android-Cgg99REN.mjs} +47 -33
  96. package/dist/{react-native-build-CwZB-agu.mjs → react-native-build-oNwqF5Wb.mjs} +7 -7
  97. package/dist/{react-native-doctor-BCrytK7h.mjs → react-native-doctor-BhA3KUte.mjs} +49 -8
  98. package/dist/{react-native-ios-Cr1buNFo.mjs → react-native-ios-B-nf4rjN.mjs} +37 -23
  99. package/dist/{recordings-BaoQ0t-J.mjs → recordings-BldzVKq0.mjs} +1 -1
  100. package/dist/{reload-Beftw2X3.mjs → reload-C9OduiNc.mjs} +1 -1
  101. package/dist/{reload-FbSgMF8x.mjs → reload-CCR7KC_l.mjs} +14 -14
  102. package/dist/{remote-BuZj6AyU.mjs → remote-C8S7FlPF.mjs} +7 -7
  103. package/dist/{result-CR2vk2cj.mjs → result-7F5hEwQJ.mjs} +16 -16
  104. package/dist/{run-BtzE09Dl.mjs → run-BqB0v3pt.mjs} +1 -1
  105. package/dist/{selection-D5cxEl3t.mjs → selection-BNPBZ6T5.mjs} +155 -42
  106. package/dist/{server-bare-CH9X0RLn.mjs → server-bare-A75rDIdD.mjs} +1 -1
  107. package/dist/{server-command-CaBbDNU2.mjs → server-command-CssKFOD7.mjs} +4 -4
  108. package/dist/{server-expo-Ck8EIidM.mjs → server-expo-eQfOdydb.mjs} +2 -2
  109. package/dist/server-expo-wvcj5tiZ.mjs +2 -0
  110. package/dist/{settings-B5tCoq9N.mjs → settings-CosW5X-S.mjs} +1 -1
  111. package/dist/{settings-DzH9mGQZ.mjs → settings-OaGQF-ri.mjs} +1 -1
  112. package/dist/{settings-write-n0zwfohx.mjs → settings-write-QjYfSrjF.mjs} +5 -5
  113. package/dist/settings.schema.json +33 -6
  114. package/dist/{simslim-BjxszUAb.mjs → simslim-Bax1qcxu.mjs} +3 -2
  115. package/dist/{slot-launch-QeuJMlnJ.mjs → slot-launch-CYCEhfBY.mjs} +6 -6
  116. package/dist/{stage-D8xlRU2D.mjs → stage-jKQ7CP_B.mjs} +1 -1
  117. package/dist/{start-C1JLjkNw.mjs → start-C_wefNKB.mjs} +1 -1
  118. package/dist/{start-YMpNwLhh.mjs → start-_BdJ32cZ.mjs} +9 -10
  119. package/dist/{state-DMRNP7-4.mjs → state-C1i2nMOP.mjs} +2 -3
  120. package/dist/{state-DPaM3u5K.mjs → state-C4OdpOTF.mjs} +1 -2
  121. package/dist/{stats-CP7STzZw.mjs → stats-tEpEEH-u.mjs} +4 -4
  122. package/dist/{status-cNw6i0_t.mjs → status-B9M7x4CZ.mjs} +1 -1
  123. package/dist/{status-Fect2w9R.mjs → status-CRXz-Gtj.mjs} +1 -1
  124. package/dist/{status-CRLiJ-O_.mjs → status-DQrqodLj.mjs} +22 -23
  125. package/dist/{status-watch-Bc2J4TZn.mjs → status-watch-B5wDIH_o.mjs} +4 -4
  126. package/dist/status-worker.mjs +1 -1
  127. package/dist/{stim-desktop-DS0mzR8U.mjs → stim-desktop-6Dqp-gjX.mjs} +1 -1
  128. package/dist/{stop-Br7LKxBE.mjs → stop-CmdNhGlC.mjs} +2 -2
  129. package/dist/{stop-Db9Kh-UA.mjs → stop-DRqQVqDJ.mjs} +21 -19
  130. package/dist/{stop-COP6PQqw.mjs → stop-ySNQHXMG.mjs} +4 -5
  131. package/dist/supervisor-run.d.mts +1 -0
  132. package/dist/supervisor-run.mjs +14 -15
  133. package/dist/{support-Cxj9CmII.mjs → support-BGSCBoib.mjs} +4 -4
  134. package/dist/{support-qKcbgmI5.mjs → support-CVOCp0Ft.mjs} +9 -9
  135. package/dist/{swiftpm-artifact-inputs-iY9fsmOc.mjs → swiftpm-artifact-inputs-CfUzt_0Z.mjs} +1 -1
  136. package/dist/{swiftpm-macos-Bp_sn9P4.mjs → swiftpm-macos-x6HPpl_2.mjs} +9 -9
  137. package/dist/toolchain-DoavrvIA.mjs +2 -0
  138. package/dist/toolchain-J4J8MrAr.mjs +2107 -0
  139. package/dist/trigger-DzJu208Q.mjs +2 -0
  140. package/dist/{trigger-CBMe2YLH.mjs → trigger-KVaWWNyn.mjs} +1 -1
  141. package/dist/{warm-progress-BV3ZPmcY.mjs → warm-progress-DvhTX_eu.mjs} +3 -4
  142. package/dist/web-BFLueSh-.mjs +2 -0
  143. package/dist/{web-B4Yjyt1G.mjs → web-Bihbf7-u.mjs} +8 -9
  144. package/dist/web-run.mjs +4 -4
  145. package/dist/{workspace-state-CPSp3mav.mjs → workspace-state-pUg3_RRA.mjs} +45 -7
  146. package/dist/{workspaces-C9w4aeXF.mjs → workspaces-g2lhdBXF.mjs} +17 -17
  147. package/dist/{worktree-CclFIe1Z.mjs → worktree-BKuklFh_.mjs} +34 -31
  148. package/dist/{worktree-Ct9Gk3KL.mjs → worktree-Bm4cb-nU.mjs} +1 -1
  149. package/package.json +8 -8
  150. package/dist/created-devices-D2Aca-xu.mjs +0 -52
  151. package/dist/paths-DQtTgsBf.mjs +0 -42
  152. package/dist/prebuild-JUaqOLpc.mjs +0 -501
  153. package/dist/server-expo-C16Zf2k7.mjs +0 -2
  154. package/dist/toolchain-DB1aeqxO.mjs +0 -2
  155. package/dist/toolchain-VzLJzZ7O.mjs +0 -908
  156. package/dist/trigger-BLsHgAGR.mjs +0 -2
  157. package/dist/web-DS4UDWvf.mjs +0 -2
  158. package/dist/xcode-CiIIDnuD.mjs +0 -910
@@ -1,16 +1,16 @@
1
- import { m as workspaceLogsDir$1 } from "./paths-DQtTgsBf.mjs";
2
- import { W as parseDeviceSlotOption, _ as loadConfig$1, g as isPathPrefix } from "./config-BZhXY15H.mjs";
3
- import { f as refuseNoProject, v as launchErrorPreview } from "./command-output-BBvS1H6v.mjs";
4
- import { r as readWorkspaceState$1 } from "./workspace-state-CPSp3mav.mjs";
5
- import { n as findCommandWorkspace } from "./project-BiC68mIp.mjs";
1
+ import { k as workspaceLogsDir$1, r as readWorkspaceState$1 } from "./workspace-state-pUg3_RRA.mjs";
2
+ import { W as parseDeviceSlotOption, _ as loadConfig$1, g as isPathPrefix } from "./config-BktkY_zC.mjs";
3
+ import { f as refuseNoProject, v as launchErrorPreview } from "./command-output-BF5AR2dL.mjs";
4
+ import { n as findCommandWorkspace } from "./project-BUu6Is4k.mjs";
6
5
  import { n as SOURCES$1, t as LEVELS$1 } from "./ndjson-CgE_o3Dl.mjs";
7
- import { a as followAgentActions, i as followHostedLogs, n as openWorkspaceLogs } from "./logs-BsIRre8x.mjs";
8
- import { t as errorDiagnostics } from "./error-diagnostics-B1Mj_-7h.mjs";
6
+ import { i as followAgentActions, n as openWorkspaceLogs } from "./logs-dQDki6Tt.mjs";
7
+ import { t as errorDiagnostics } from "./error-diagnostics-BOOm9Db7.mjs";
8
+ import { n as followHostedLogs } from "./hosted-logs-sync-B0pvmOk-.mjs";
9
9
  import { t as watchStdoutReader } from "./stdout-reader-C8yjre1x.mjs";
10
10
  import { realpathSync } from "node:fs";
11
11
  import { relative, sep } from "node:path";
12
12
  import { configDir } from "@stim-cli/core";
13
- import { buildCriteria, compileGrep, followLogs, logFiles, parseSince, queryLogs, recordMatches, runId, sortByTs } from "@stim-cli/core/state";
13
+ import { buildCriteria, compileGrep, fileSizes, followLogs, gcLogDir, logFiles, parseSince, queryLogs, readGcLog, recordMatches, runId, sortByTs } from "@stim-cli/core/state";
14
14
  import chalk from "chalk";
15
15
  //#region src/commands/logs.ts
16
16
  const LEVEL_WIDTH = 5;
@@ -57,7 +57,8 @@ function parseTail(value) {
57
57
  function validateSources(sources) {
58
58
  if (sources === void 0 || sources === null) return { sources: void 0 };
59
59
  const list = Array.isArray(sources) ? sources : [sources];
60
- if (list.includes("all")) return { sources: [...SOURCES$1] };
60
+ if (list.includes("gc") && list.length > 1) return { error: "--source gc reads the machine-wide gc log and cannot be combined with other sources." };
61
+ if (list.includes("all")) return { sources: SOURCES$1.filter((source) => source !== "gc") };
61
62
  const unknown = list.filter((s) => !SOURCES$1.includes(s));
62
63
  if (unknown.length > 0) return { error: `Unknown --source value(s): ${unknown.join(", ")}. Use one or more of: ${SOURCES$1.join(", ")}, or all.` };
63
64
  return { sources: list };
@@ -97,39 +98,20 @@ const LEVEL_COLOURS = {
97
98
  fatal: chalk.bgRed
98
99
  };
99
100
  function logsCommand(program) {
100
- program.command("logs").description("Query this workspace's merged NDJSON log timeline (bundler, client, device, build, agent actions, maintenance). Prints and exits; an existing timeline with nothing matching is a successful, empty result. Use --follow to stream.").option("--slot <name>", "Only this device slot's records, plus the shared Metro and app client records once it has launched", parseDeviceSlotOption).option("--source <s...>", "Only these sources: metro, client, device, build, agent, maintenance, placement, or all").option("--level <l>", `Minimum level: ${LEVELS$1.join(", ")}`).option("--since <d>", "Only records newer than this, e.g. 30s, 5m, 2h").option("--grep <re>", "Only records whose message matches this regular expression").option("--tail <n>", "Only the last n matching records").option("--errors", "Errors and fatals since the last marker, from metro, client and build, plus confirmed native app-crash reports and stim web browser errors. Add --source maintenance for maintenance failures, or --source device or --source all for general device errors.").option("--follow", "Keep streaming new records until interrupted").option("--json", "Emit the raw records, one per line (valid NDJSON; zero matches is zero bytes, exit 0)").action(async (opts) => {
101
+ program.command("logs").description("Query this workspace's merged NDJSON log timeline (bundler, client, device, build, agent actions, maintenance). Prints and exits; an existing timeline with nothing matching is a successful, empty result. Use --follow to stream.").option("--slot <name>", "Only this device slot's records, plus the shared Metro and app client records once it has launched", parseDeviceSlotOption).option("--source <s...>", "Only these sources: metro, client, device, build, agent, maintenance, placement, or all; gc alone reads the machine-wide gc log of what gc and maintenance cleared").option("--level <l>", `Minimum level: ${LEVELS$1.join(", ")}`).option("--since <d>", "Only records newer than this, e.g. 30s, 5m, 2h").option("--grep <re>", "Only records whose message matches this regular expression").option("--tail <n>", "Only the last n matching records").option("--errors", "Errors and fatals since the last marker, from metro, client and build, plus confirmed native app-crash reports and stim web browser errors. Add --source maintenance for maintenance failures, or --source device or --source all for general device errors.").option("--follow", "Keep streaming new records until interrupted").option("--json", "Emit the raw records, one per line (valid NDJSON; zero matches is zero bytes, exit 0)").action(async (opts) => {
102
+ const requested = [opts.source ?? []].flat();
103
+ if (requested.length === 1 && requested[0] === "gc") {
104
+ const { minLevel, tail } = validateOptions(opts);
105
+ printGcLog(opts, opts.errors ? "error" : minLevel, tail);
106
+ return;
107
+ }
101
108
  const root = findCommandWorkspace(process.cwd());
102
109
  if (!root) {
103
110
  refuseNoProject({ json: false });
104
111
  return;
105
112
  }
106
113
  const dir = workspaceLogsDir$1(root);
107
- let sources;
108
- if (opts.source !== void 0) {
109
- const checked = validateSources(opts.source);
110
- if (checked.error) fail(checked.error);
111
- sources = checked.sources;
112
- }
113
- let minLevel;
114
- if (opts.level !== void 0) {
115
- const checked = validateLevel(opts.level);
116
- if (checked.error) fail(checked.error);
117
- minLevel = checked.level;
118
- }
119
- if (opts.since !== void 0) {
120
- const parsed = parseSince(opts.since);
121
- if (parsed.error) fail(parsed.error);
122
- }
123
- let tail;
124
- if (opts.tail !== void 0) {
125
- const parsed = parseTail(opts.tail);
126
- if (parsed.error) fail(parsed.error);
127
- tail = parsed.n;
128
- }
129
- if (opts.grep !== void 0) {
130
- const compiled = compileGrep(opts.grep);
131
- if (compiled.error) fail(compiled.error);
132
- }
114
+ const { sources, minLevel, tail } = validateOptions(opts);
133
115
  requireLogsWorkspace(root, dir);
134
116
  const query = {
135
117
  slot: opts.slot,
@@ -242,6 +224,73 @@ function logsCommand(program) {
242
224
  process.on("SIGTERM", finish);
243
225
  });
244
226
  }
227
+ function validateOptions(opts) {
228
+ let sources;
229
+ if (opts.source !== void 0) {
230
+ const checked = validateSources(opts.source);
231
+ if (checked.error) fail(checked.error);
232
+ sources = checked.sources;
233
+ }
234
+ let minLevel;
235
+ if (opts.level !== void 0) {
236
+ const checked = validateLevel(opts.level);
237
+ if (checked.error) fail(checked.error);
238
+ minLevel = checked.level;
239
+ }
240
+ if (opts.since !== void 0) {
241
+ const parsed = parseSince(opts.since);
242
+ if (parsed.error) fail(parsed.error);
243
+ }
244
+ let tail;
245
+ if (opts.tail !== void 0) {
246
+ const parsed = parseTail(opts.tail);
247
+ if (parsed.error) fail(parsed.error);
248
+ tail = parsed.n;
249
+ }
250
+ if (opts.grep !== void 0) {
251
+ const compiled = compileGrep(opts.grep);
252
+ if (compiled.error) fail(compiled.error);
253
+ }
254
+ return {
255
+ sources,
256
+ minLevel,
257
+ tail
258
+ };
259
+ }
260
+ function printGcLog(opts, minLevel, tail) {
261
+ const emit = (record) => console.log(opts.json ? JSON.stringify(record) : formatRecord(record, { paint: record.level ? LEVEL_COLOURS[record.level] : void 0 }));
262
+ const query = {
263
+ sources: ["gc"],
264
+ minLevel,
265
+ since: opts.since,
266
+ grep: opts.grep
267
+ };
268
+ const offsets = opts.follow ? fileSizes(gcLogDir()) : null;
269
+ const records = queryLogs({
270
+ ...query,
271
+ records: readGcLog(),
272
+ tail
273
+ });
274
+ for (const record of records) emit(record);
275
+ if (!opts.follow) {
276
+ if (records.length === 0 && !opts.json) console.error(chalk.dim(`No matching log records in ${gcLogDir()}`));
277
+ return;
278
+ }
279
+ const stop = followLogs({
280
+ dir: gcLogDir(),
281
+ offsets,
282
+ criteria: buildCriteria(query),
283
+ onRecord: emit
284
+ });
285
+ const finish = () => {
286
+ stop();
287
+ stopReader();
288
+ process.exit(0);
289
+ };
290
+ const stopReader = watchStdoutReader(finish);
291
+ process.on("SIGINT", finish);
292
+ process.on("SIGTERM", finish);
293
+ }
245
294
  function fail(message) {
246
295
  console.error(chalk.red(message));
247
296
  process.exit(1);
@@ -1,2 +1,2 @@
1
- import { n as runMacos, r as waitForLaunchServices, t as macosCommand } from "./macos-D477nfzH.mjs";
1
+ import { n as runMacos, r as waitForLaunchServices, t as macosCommand } from "./macos-DBBPNnIA.mjs";
2
2
  export { macosCommand as default, runMacos, waitForLaunchServices };
@@ -1,24 +1,23 @@
1
1
  import { _ as spawnDeclared, c as throwIfCancelled, t as getExecutor, u as withWorkspaceProcessLock, x as withDrainingCancellation } from "./exec-VFRpu1iA.mjs";
2
- import { d as workspaceDir, l as workspaceAgentDeviceDir, m as workspaceLogsDir$1, r as ensureWorkspaceStorageAsync } from "./paths-DQtTgsBf.mjs";
3
- import { E as upsertProject, O as withConfigLockAsync$1, u as getConcurrencyLimits } from "./config-BZhXY15H.mjs";
4
- import { l as phaseLine } from "./command-output-BBvS1H6v.mjs";
5
- import { a as recordWorkspaceUseAsync, f as writeWorkspaceStateAsync } from "./workspace-state-CPSp3mav.mjs";
6
- import { Y as resolveProjectSettingsAsync, a as SETTING_SHAPE_REMEDY, tt as settingShapeErrors } from "./settings-B5tCoq9N.mjs";
7
- import { f as projectRegistry, i as findProjectRoot$1, s as ownedDeviceLabel } from "./project-BiC68mIp.mjs";
8
- import { i as macosProcess, n as macosDir, o as requiredMacosRecord, r as macosLogFile } from "./state-DPaM3u5K.mjs";
2
+ import { E as workspaceDir, a as recordWorkspaceUseAsync, f as writeWorkspaceStateAsync, k as workspaceLogsDir$1, v as ensureWorkspaceStorageAsync, w as workspaceAgentDeviceDir } from "./workspace-state-pUg3_RRA.mjs";
3
+ import { E as upsertProject, O as withConfigLockAsync$1, u as getConcurrencyLimits } from "./config-BktkY_zC.mjs";
4
+ import { l as phaseLine } from "./command-output-BF5AR2dL.mjs";
5
+ import { Y as resolveProjectSettingsAsync, a as SETTING_SHAPE_REMEDY, tt as settingShapeErrors } from "./settings-CosW5X-S.mjs";
6
+ import { f as projectRegistry, i as findProjectRoot$1, s as ownedDeviceLabel } from "./project-BUu6Is4k.mjs";
7
+ import { i as macosProcess, n as macosDir, o as requiredMacosRecord, r as macosLogFile } from "./state-C4OdpOTF.mjs";
9
8
  import { r as createNdjsonWriter } from "./ndjson-CgE_o3Dl.mjs";
10
- import { B as recordFinishedBuild, H as startBuildProgress, M as NO_BUILD_PROGRESS, Rn as processContext, U as tapBuildLog, z as recordBuildPhase, zn as runProcessOperation } from "./budget-HyShrIpL.mjs";
11
- import { d as runCancellationSignal, f as withNativeBuildRun } from "./native-run-D5OJsGwA.mjs";
12
- import { L as acquireBuildSlot, z as releaseBuildSlot } from "./workspaces-C9w4aeXF.mjs";
13
- import { D as sanitizeDeviceLabel } from "./ios-BQzvJlzw.mjs";
14
- import { S as setRemoteLogSink, c as offloadPlacement, i as closeOffload, l as placementLoad, n as buildPlacementCandidates, o as offloadBuild, r as chooseBuildMachine, u as remotePhaseText } from "./client-BQsmyp_-.mjs";
15
- import { a as parseBuildMachineOption, c as resolveBuildPlacement, i as namedBuildMachine, o as requireLocalBuild, t as OffloadRefusal } from "./selection-D5cxEl3t.mjs";
16
- import { l as connectHost } from "./hosted-client-rsRqysJc.mjs";
17
- import { t as placeHostedMacos } from "./hosted-macos-d0pv9Tth.mjs";
18
- import { r as stopMacosAppHeld, t as stopBundleInstances } from "./stop-COP6PQqw.mjs";
9
+ import { Hn as processContext, I as NO_BUILD_PROGRESS, K as startBuildProgress, U as recordBuildPhase, Un as runProcessOperation, W as recordFinishedBuild, q as tapBuildLog } from "./budget-k2mZGvvk.mjs";
10
+ import { d as runCancellationSignal, f as withNativeBuildRun } from "./native-run-BfIDFKLH.mjs";
11
+ import { L as acquireBuildSlot, z as releaseBuildSlot } from "./workspaces-g2lhdBXF.mjs";
12
+ import { O as sanitizeDeviceLabel } from "./ios-WxpDJ5T1.mjs";
13
+ import { S as setRemoteLogSink, c as offloadPlacement, i as closeOffload, l as placementLoad, n as buildPlacementCandidates, o as offloadBuild, r as chooseBuildMachine, u as remotePhaseText } from "./client-D9CaRks-.mjs";
14
+ import { a as parseBuildMachineOption, i as namedBuildMachine, l as resolveBuildPlacement, s as requireLocalBuild, t as OffloadRefusal } from "./selection-BNPBZ6T5.mjs";
15
+ import { l as connectHost } from "./hosted-client-fHO8yqzc.mjs";
16
+ import { t as placeHostedMacos } from "./hosted-macos-CPl0OZ9h.mjs";
17
+ import { r as stopMacosAppHeld, t as stopBundleInstances } from "./stop-ySNQHXMG.mjs";
19
18
  import { t as spawnEntry } from "./spawn-entry-jw19m8Nl.mjs";
20
- import { t as buildPlacementRecord } from "./placement-log-DjOXJRIH.mjs";
21
- import { t as reidentifyBundle } from "./stage-D8xlRU2D.mjs";
19
+ import { t as buildPlacementRecord } from "./placement-log-DIFPQAXp.mjs";
20
+ import { t as reidentifyBundle } from "./stage-jKQ7CP_B.mjs";
22
21
  import { t as validateMacosArtifactPlatform } from "./artifact-platform-CMRc0M_r.mjs";
23
22
  import { t as waitForMacosRegistration } from "./registration-CN6nlhcD.mjs";
24
23
  import { createHash, randomUUID } from "node:crypto";
@@ -346,7 +345,7 @@ async function planMacos(context, root, buildMachineFlag) {
346
345
  if (selected.failure) throw Object.assign(new Error(selected.failure.message), selected.failure);
347
346
  const macos = settings.macos;
348
347
  if (!macos?.product || !macos.infoPlist) throw Object.assign(/* @__PURE__ */ new Error("Set macos.product and macos.infoPlist explicitly in .stim.json. See stim guide macos."), { code: "STIM_BAD_ARG" });
349
- const { swiftpmMacosProject } = await import("./swiftpm-macos-Bp_sn9P4.mjs");
348
+ const { swiftpmMacosProject } = await import("./swiftpm-macos-x6HPpl_2.mjs");
350
349
  const recipe = await swiftpmMacosProject(root).prepare(context, settings);
351
350
  let identity = null;
352
351
  let cacheHit = false;
@@ -1,2 +1,2 @@
1
- import { n as runMacosSupervisor, t as logLines } from "./run-BtzE09Dl.mjs";
1
+ import { n as runMacosSupervisor, t as logLines } from "./run-BqB0v3pt.mjs";
2
2
  export { logLines, runMacosSupervisor };
@@ -1,12 +1,11 @@
1
- import { P as formatBytes } from "./config-BZhXY15H.mjs";
2
- import { Dt as deviceSweepIsScoped, u as resolveBudget } from "./budget-HyShrIpL.mjs";
3
- import { P as memoryCulpritsUnder, z as memoryCulpritAdvice } from "./ios-BQzvJlzw.mjs";
4
- import { T as maintenanceLogger } from "./client-BQsmyp_-.mjs";
1
+ import { P as formatBytes } from "./config-BktkY_zC.mjs";
2
+ import { E as maintenanceLogger, T as openGcLog, jt as deviceSweepIsScoped, u as resolveBudget, w as maintenanceItem } from "./budget-k2mZGvvk.mjs";
3
+ import { B as memoryCulpritAdvice, F as memoryCulpritsUnder } from "./ios-WxpDJ5T1.mjs";
5
4
  import { t as resolveMaintenanceSettings } from "./settings-Djl-mpjX.mjs";
6
5
  import { t as relaunchWithLogFile } from "./detached-entry-KmieOKgN.mjs";
7
- import { D as measureDisk, F as levelStillShort, I as lowestFree, M as sizeScanDeferred, N as diskPressureLevel, P as levelFloors, j as measureSizes, k as measurePressure } from "./worktree-CclFIe1Z.mjs";
8
- import { i as plannedMaintenance, m as measureOwnedDevices, n as diskRecovered, o as triggeringRoot, r as executeAction } from "./act-BbHS3oV8.mjs";
9
- import { r as due, t as capChildLog } from "./attempt-DW-mQqM7.mjs";
6
+ import { D as measureDisk, F as levelStillShort, I as lowestFree, M as sizeScanDeferred, N as diskPressureLevel, P as levelFloors, j as measureSizes, k as measurePressure } from "./worktree-BKuklFh_.mjs";
7
+ import { i as plannedMaintenance, m as measureOwnedDevices, n as diskRecovered, o as triggeringRoot, r as executeAction } from "./act-C-BqJEpu.mjs";
8
+ import { r as due, t as capChildLog } from "./attempt-ClyJlZPT.mjs";
10
9
  import { releaseClaim, tryAcquireClaim } from "@stim-cli/core/ownership-claim";
11
10
  import { randomBytes } from "node:crypto";
12
11
  import { appendFileSync, mkdirSync, renameSync, rmSync, statSync, unlinkSync, writeFileSync } from "node:fs";
@@ -82,6 +81,7 @@ const EXECUTION_ORDER = {
82
81
  "would-clear-build-dirs": 3,
83
82
  "would-empty-cache": 3,
84
83
  "would-remove-worktree": 4,
84
+ "would-shutdown-device": 5,
85
85
  "would-stop-workspace": 5,
86
86
  "would-delete-devices": 5,
87
87
  "would-delete-dependencies": 6,
@@ -118,6 +118,7 @@ function describeDone(action) {
118
118
  case "would-stop-gradle-daemons": return "Stopped idle Gradle and Kotlin daemons";
119
119
  case "would-delete-gradle-version": return `Deleted the unpinned Gradle ${action.target} caches and distributions`;
120
120
  case "would-stop-workspace": return `Stopped ${name} and deleted its owned devices`;
121
+ case "would-shutdown-device": return `Shut down the idle device ${action.target} of ${name}`;
121
122
  default: return `Unregistered the stale cache ${action.target}`;
122
123
  }
123
124
  }
@@ -135,6 +136,7 @@ async function runMaintenance(trigger) {
135
136
  }
136
137
  if (!claim) return;
137
138
  let logger;
139
+ let gcLog;
138
140
  try {
139
141
  const settings = resolveMaintenanceSettings();
140
142
  if (settings.mode === "off") return;
@@ -165,6 +167,11 @@ async function runMaintenance(trigger) {
165
167
  } catch (error) {
166
168
  noteWriteError(error);
167
169
  }
170
+ gcLog = openGcLog({
171
+ trigger: "maintenance",
172
+ runId: `p-${claim.claimId}`,
173
+ via: trigger
174
+ });
168
175
  const record = (event, level, msg, fields = {}) => {
169
176
  let entry = null;
170
177
  try {
@@ -196,7 +203,7 @@ async function runMaintenance(trigger) {
196
203
  delete state.deferredAt?.[check];
197
204
  keepState();
198
205
  try {
199
- if (check === "worktree" || check === "sweep") continue;
206
+ if (check === "worktree" || check === "sweep" || check === "idle") continue;
200
207
  if (check === "pressure") {
201
208
  state.pressure = measurePressure(settings, state.pressure, state.lastAt[check]);
202
209
  state.pressure.diskLevel = diskPressureLevel(lowestFree(state.pressure.disk), budget, settings);
@@ -245,11 +252,13 @@ async function runMaintenance(trigger) {
245
252
  });
246
253
  }
247
254
  }
255
+ const plannedWorktrees = ran.has("worktree") || ran.has("sweep") && settings.removeFinishedWorktrees && settings.removeIdleWorktrees;
248
256
  let result;
249
257
  try {
250
258
  result = await plannedMaintenance(state.pressure, state.sizes, settings, {
251
259
  sweep: ran.has("sweep"),
252
- worktrees: ran.has("worktree")
260
+ worktrees: plannedWorktrees,
261
+ idle: ran.has("idle")
253
262
  });
254
263
  } catch (error) {
255
264
  const message = error instanceof Error ? error.message : String(error);
@@ -299,6 +308,7 @@ async function runMaintenance(trigger) {
299
308
  action,
300
309
  outcome
301
310
  });
311
+ if (outcome.status !== "kept") gcLog?.record(maintenanceItem(action, outcome));
302
312
  const fields = {
303
313
  action: {
304
314
  kind: executedKind(action),
@@ -318,6 +328,7 @@ async function runMaintenance(trigger) {
318
328
  });
319
329
  } else if (!loggedSkips.has(action.target)) {
320
330
  loggedSkips.add(action.target);
331
+ gcLog?.record(maintenanceItem(action, outcome));
321
332
  record("maintenance_skip", "info", `Kept ${action.target}: ${outcome.detail}`, {
322
333
  target: action.target,
323
334
  reason: outcome.detail,
@@ -327,7 +338,7 @@ async function runMaintenance(trigger) {
327
338
  }
328
339
  return results;
329
340
  }
330
- const retained = state.plan.filter((action) => (action.check === "sweep" || action.check === "worktree") && !ran.has(action.check));
341
+ const retained = state.plan.filter((action) => action.check === "sweep" && !ran.has("sweep") || action.check === "worktree" && !plannedWorktrees || action.kind === "would-shutdown-device" && action.check === void 0 && !ran.has("idle"));
331
342
  const previousActions = new Set(state.plan.map(actionKey));
332
343
  const previousSkips = new Set(state.skipKeys ?? []);
333
344
  const nextSkips = new Set(result.skips.map((skip) => skip.target));
@@ -371,7 +382,13 @@ async function runMaintenance(trigger) {
371
382
  if (done.length || measuredSizes || blockedChanged || (state.pressure?.diskLevel ?? 0) > 0) record("maintenance_pass", state.lastPass.blocked.length ? "warn" : "info", `Pass: ${done.length} actions, ${formatBytes(freedBytes)} freed${state.lastPass.blocked.length ? `; ${state.lastPass.blocked.join("; ")}` : ""}`, { ...state.lastPass });
372
383
  } else {
373
384
  const blocked = [...result.blocked, ...failures];
374
- const planned = [...result.actions, ...retained];
385
+ const keys = /* @__PURE__ */ new Set();
386
+ const planned = [...result.actions, ...retained].filter((action) => {
387
+ const key = actionKey(action);
388
+ if (keys.has(key)) return false;
389
+ keys.add(key);
390
+ return true;
391
+ });
375
392
  const nextActions = new Set(planned.map(actionKey));
376
393
  const changed = !state.lastPass || !sameSet(previousActions, nextActions) || !sameSet(previousSkips, nextSkips) || !sameSet(new Set(state.lastPass.blocked.map(stableText)), new Set(blocked.map(stableText)));
377
394
  for (const action of result.actions) {
@@ -1,7 +1,7 @@
1
1
  import { S as process_identity_exports, l as WorkspaceProcessCleanupError, t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { F as isOnMountedVolume, I as listMountedVolumes, O as withConfigLockAsync, _ as loadConfig, n as allMetroPorts, r as claimMetroPort, x as releaseMetroPort } from "./config-BZhXY15H.mjs";
2
+ import { r as readWorkspaceState } from "./workspace-state-pUg3_RRA.mjs";
3
+ import { F as isOnMountedVolume, I as listMountedVolumes, O as withConfigLockAsync, _ as loadConfig, n as allMetroPorts, r as claimMetroPort, x as releaseMetroPort } from "./config-BktkY_zC.mjs";
3
4
  import { t as runOperationFile } from "./operation-exec-CUZifp6Z.mjs";
4
- import { r as readWorkspaceState } from "./workspace-state-CPSp3mav.mjs";
5
5
  import { sep } from "path";
6
6
  import { existsSync, readlinkSync, realpathSync } from "fs";
7
7
  import { readFile } from "node:fs/promises";
@@ -1,7 +1,6 @@
1
1
  import { S as process_identity_exports, c as throwIfCancelled, s as cancelledError } from "./exec-VFRpu1iA.mjs";
2
- import { g as workspaceStateFile$1 } from "./paths-DQtTgsBf.mjs";
3
- import { ot as tailscaleStatusAsync } from "./config-BZhXY15H.mjs";
4
- import { l as withWorkspaceStateLockAsync, o as updateWorkspaceState, r as readWorkspaceState$1, s as updateWorkspaceStateAsync } from "./workspace-state-CPSp3mav.mjs";
2
+ import { j as workspaceStateFile$1, l as withWorkspaceStateLockAsync, o as updateWorkspaceState, r as readWorkspaceState$1, s as updateWorkspaceStateAsync } from "./workspace-state-pUg3_RRA.mjs";
3
+ import { ct as tailscaleStatusAsync } from "./config-BktkY_zC.mjs";
5
4
  import { randomBytes, randomUUID } from "node:crypto";
6
5
  import { statSync, watch } from "node:fs";
7
6
  import { HOSTED_METRO_REQUESTS_KEY, findPeer, hostedMetroGateways, hostedMetroRequests, isJsonObject, parseMachine } from "@stim-cli/core/state";
@@ -1,6 +1,6 @@
1
1
  import { S as process_identity_exports, t as getExecutor, u as withWorkspaceProcessLock } from "./exec-VFRpu1iA.mjs";
2
- import { C as saveConfig, O as withConfigLockAsync, _ as loadConfig, c as ensureConfig, d as getConfigDir, p as getProject } from "./config-BZhXY15H.mjs";
3
- import { f as signalProcessTree, m as createPortProbe, s as parseNetstatPids } from "./metro-1pJgCX4U.mjs";
2
+ import { C as saveConfig, O as withConfigLockAsync, _ as loadConfig, c as ensureConfig, d as getConfigDir, p as getProject } from "./config-BktkY_zC.mjs";
3
+ import { f as signalProcessTree, m as createPortProbe, s as parseNetstatPids } from "./metro-CjC10t6E.mjs";
4
4
  import { realpathSync } from "node:fs";
5
5
  //#region src/named-ports.ts
6
6
  const FIRST_PORT = 8900;
@@ -1,21 +1,21 @@
1
1
  import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { d as workspaceDir, i as sharedBuildCache } from "./paths-DQtTgsBf.mjs";
3
- import { H as deviceSlotPlatforms, p as getProject, q as validateDeviceSlot } from "./config-BZhXY15H.mjs";
4
- import { nt as settingValueAt } from "./settings-B5tCoq9N.mjs";
5
- import { B as ownedAvdDeviceProfile, E as findBuildTool, I as listInstalledSystemImages, K as ownedAvdSystemImage, V as ownedAvdDirectory, X as pickDefaultSystemImage, l as androidSystemImageAbi, o as androidHome } from "./android-Cjcj8MCw.mjs";
6
- import { r as register } from "./cache-manifest-BPXRONJz.mjs";
7
- import { Z as statsProjectKey } from "./budget-HyShrIpL.mjs";
8
- import { d as runCancellationSignal } from "./native-run-D5OJsGwA.mjs";
9
- import { s as entryDir, t as artifactIn, y as resolveBuild } from "./build-cache-CKCzxzxA.mjs";
10
- import { o as resolveCcache } from "./ccache-h1FKhZeg.mjs";
11
- import { h as gradleOffloadInputs, y as nativeGradleTransfer } from "./client-BQsmyp_-.mjs";
12
- import { r as androidToolchainAsync } from "./toolchain-VzLJzZ7O.mjs";
13
- import { d as buildGradle, l as androidSdkRefusal } from "./react-native-build-CwZB-agu.mjs";
14
- import { s as explainBuildMiss, u as skippedMissReason } from "./prebuild-JUaqOLpc.mjs";
15
- import { u as resolveAndroidRunPlan } from "./result-CR2vk2cj.mjs";
16
- import { n as androidProcessRuntime } from "./launch-D0lPvFFu.mjs";
17
- import { n as planFlagRefusal, r as planPayload } from "./build-plan-zCuHGlA8.mjs";
18
- import { a as nativeGradleWorkerArtifactIdentity, n as gradleArtifactInputs, r as nativeGradleArtifactSnapshot, t as NATIVE_GRADLE_CACHE_LIMIT } from "./native-gradle-artifact-inputs-BJscK4vN.mjs";
2
+ import { E as workspaceDir, y as sharedBuildCache } from "./workspace-state-pUg3_RRA.mjs";
3
+ import { H as deviceSlotPlatforms, p as getProject, q as validateDeviceSlot } from "./config-BktkY_zC.mjs";
4
+ import { nt as settingValueAt } from "./settings-CosW5X-S.mjs";
5
+ import { B as ownedAvdDeviceProfile, E as findBuildTool, I as listInstalledSystemImages, K as ownedAvdSystemImage, V as ownedAvdDirectory, X as pickDefaultSystemImage, l as androidSystemImageAbi, o as androidHome } from "./android-DTAcRwBC.mjs";
6
+ import { r as register } from "./cache-manifest-BEZ9Bpl1.mjs";
7
+ import { tt as statsProjectKey } from "./budget-k2mZGvvk.mjs";
8
+ import { d as runCancellationSignal } from "./native-run-BfIDFKLH.mjs";
9
+ import { S as resolveBuild, s as entryDir, t as artifactIn } from "./build-cache-DrXNCy3T.mjs";
10
+ import { o as resolveCcache } from "./ccache-Bx5TbxwG.mjs";
11
+ import { r as androidToolchainAsync } from "./toolchain-J4J8MrAr.mjs";
12
+ import { h as gradleOffloadInputs, y as nativeGradleTransfer } from "./client-D9CaRks-.mjs";
13
+ import { d as buildGradle, l as androidSdkRefusal } from "./react-native-build-oNwqF5Wb.mjs";
14
+ import { s as explainBuildMiss, u as skippedMissReason } from "./prebuild-gmouvmJZ.mjs";
15
+ import { u as resolveAndroidRunPlan } from "./result-7F5hEwQJ.mjs";
16
+ import { n as androidProcessRuntime } from "./launch-DOp8RjDz.mjs";
17
+ import { n as planFlagRefusal, r as planPayload } from "./build-plan-DrMMdayj.mjs";
18
+ import { a as nativeGradleWorkerArtifactIdentity, n as gradleArtifactInputs, r as nativeGradleArtifactSnapshot, t as NATIVE_GRADLE_CACHE_LIMIT } from "./native-gradle-artifact-inputs-btSUulme.mjs";
19
19
  import { createHash } from "node:crypto";
20
20
  import { createReadStream, createWriteStream, existsSync, readFileSync, statSync } from "node:fs";
21
21
  import { tmpdir } from "node:os";
@@ -1,8 +1,8 @@
1
1
  import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
2
  import { r as childEnvironment } from "./operation-exec-CUZifp6Z.mjs";
3
- import { o as androidHome } from "./android-Cjcj8MCw.mjs";
4
- import { n as buildCacheKey } from "./build-cache-CKCzxzxA.mjs";
5
- import { _ as nativeGradleLocalSourceDigest, h as gradleOffloadInputs } from "./client-BQsmyp_-.mjs";
3
+ import { o as androidHome } from "./android-DTAcRwBC.mjs";
4
+ import { n as buildCacheKey } from "./build-cache-DrXNCy3T.mjs";
5
+ import { _ as nativeGradleLocalSourceDigest, h as gradleOffloadInputs } from "./client-D9CaRks-.mjs";
6
6
  import { n as fingerprintNativeInputs } from "./native-inputs-TRTTTRxt.mjs";
7
7
  import { createHash } from "node:crypto";
8
8
  import { homedir } from "node:os";
@@ -1,7 +1,6 @@
1
1
  import { D as ownership_claim_exports, b as operationState, g as signalDeclaredSpawns, h as refuseDeclaredSpawns, p as allowDeclaredSpawns, u as withWorkspaceProcessLock, y as isTermination } from "./exec-VFRpu1iA.mjs";
2
- import { d as workspaceDir } from "./paths-DQtTgsBf.mjs";
3
- import { a as formatElapsed, l as phaseLine } from "./command-output-BBvS1H6v.mjs";
4
- import { l as withWorkspaceStateLockAsync, o as updateWorkspaceState, r as readWorkspaceState, t as clearWorkspaceStateKey } from "./workspace-state-CPSp3mav.mjs";
2
+ import { E as workspaceDir, l as withWorkspaceStateLockAsync, o as updateWorkspaceState, r as readWorkspaceState, t as clearWorkspaceStateKey } from "./workspace-state-pUg3_RRA.mjs";
3
+ import { a as formatElapsed, l as phaseLine } from "./command-output-BF5AR2dL.mjs";
5
4
  import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
6
5
  import { existsSync, mkdirSync } from "node:fs";
7
6
  import { basename, dirname, join } from "node:path";
@@ -1,10 +1,9 @@
1
- import { r as ensureWorkspaceStorageAsync } from "./paths-DQtTgsBf.mjs";
2
- import { l as phaseLine } from "./command-output-BBvS1H6v.mjs";
3
- import { r as readWorkspaceState$1 } from "./workspace-state-CPSp3mav.mjs";
4
- import { M as metroPortSetting } from "./settings-B5tCoq9N.mjs";
5
- import { d as resolveProjectMetro } from "./metro-1pJgCX4U.mjs";
6
- import { Yt as LAUNCH_BUNDLING, Zt as LAUNCH_UNVERIFIED } from "./budget-HyShrIpL.mjs";
7
- import { c as startDevServer } from "./start-YMpNwLhh.mjs";
1
+ import { r as readWorkspaceState$1, v as ensureWorkspaceStorageAsync } from "./workspace-state-pUg3_RRA.mjs";
2
+ import { l as phaseLine } from "./command-output-BF5AR2dL.mjs";
3
+ import { M as metroPortSetting } from "./settings-CosW5X-S.mjs";
4
+ import { d as resolveProjectMetro } from "./metro-CjC10t6E.mjs";
5
+ import { $t as LAUNCH_BUNDLING, tn as LAUNCH_UNVERIFIED } from "./budget-k2mZGvvk.mjs";
6
+ import { c as startDevServer } from "./start-_BdJ32cZ.mjs";
8
7
  import { readIdleStop } from "@stim-cli/core/state";
9
8
  import chalk from "chalk";
10
9
  //#region src/commands/native-runtime.ts
@@ -1,6 +1,6 @@
1
- import { d as workspaceDir, u as workspaceDerivedData } from "./paths-DQtTgsBf.mjs";
1
+ import { E as workspaceDir, T as workspaceDerivedData } from "./workspace-state-pUg3_RRA.mjs";
2
2
  import { a as killOnAbort, l as gitQuietAsync, r as childEnvironment } from "./operation-exec-CUZifp6Z.mjs";
3
- import { h as pbxString, m as pbxReferences } from "./project-BiC68mIp.mjs";
3
+ import { h as pbxString, m as pbxReferences } from "./project-BUu6Is4k.mjs";
4
4
  import { n as fingerprintNativeInputs, t as NativeInputError } from "./native-inputs-TRTTTRxt.mjs";
5
5
  import { createHash } from "node:crypto";
6
6
  import { existsSync, readFileSync, realpathSync } from "node:fs";
@@ -1,22 +1,21 @@
1
1
  import { t as getExecutor } from "./exec-VFRpu1iA.mjs";
2
- import { o as sharedCompilationCache } from "./paths-DQtTgsBf.mjs";
3
- import { K as resolveCacheProviderConfig, Pt as repoRootAsync, W as remoteIosSetting, tt as settingShapeErrors } from "./settings-B5tCoq9N.mjs";
4
- import { g as selectNativeXcodeProject, h as pbxString, p as NativeXcodeError } from "./project-BiC68mIp.mjs";
5
- import { r as register } from "./cache-manifest-BPXRONJz.mjs";
6
- import { Rn as processContext, Z as statsProjectKey } from "./budget-HyShrIpL.mjs";
7
- import { d as runCancellationSignal } from "./native-run-D5OJsGwA.mjs";
8
- import { l as filesystemBuildCapability, n as buildCacheKey } from "./build-cache-CKCzxzxA.mjs";
2
+ import { x as sharedCompilationCache } from "./workspace-state-pUg3_RRA.mjs";
3
+ import { K as resolveCacheProviderConfig, Pt as repoRootAsync, W as remoteIosSetting, tt as settingShapeErrors } from "./settings-CosW5X-S.mjs";
4
+ import { g as selectNativeXcodeProject, h as pbxString, p as NativeXcodeError } from "./project-BUu6Is4k.mjs";
5
+ import { r as register } from "./cache-manifest-BEZ9Bpl1.mjs";
6
+ import { Hn as processContext, tt as statsProjectKey } from "./budget-k2mZGvvk.mjs";
7
+ import { d as runCancellationSignal } from "./native-run-BfIDFKLH.mjs";
8
+ import { n as buildCacheKey, u as filesystemBuildCapability } from "./build-cache-DrXNCy3T.mjs";
9
9
  import { l as artifactCachePolicy, p as resolveOptimizations } from "./errors-DHm_U5gv.mjs";
10
- import { a as buildXcode, l as parseSwiftVersion, p as readBundleId, r as HEARTBEAT_INTERVAL_MS, s as compilationCacheSettings, u as parseXcodeMajor } from "./xcode-CiIIDnuD.mjs";
11
- import { a as nativeTransferRefusal } from "./client-BQsmyp_-.mjs";
12
- import { _ as runCaptured, a as iosToolchainAsync, h as readPodState, m as podsAreStale, v as runPodInstall } from "./toolchain-VzLJzZ7O.mjs";
13
- import { a as deviceModelRefusal, h as resolveDeviceType, m as resolveConfiguration, v as resolveRuntime, x as simulatorBuildArch, y as resolveSchemeSelection } from "./support-qKcbgmI5.mjs";
10
+ import { D as runCaptured, F as compilationCacheSettings, L as parseSwiftVersion, N as buildXcode, O as runPodInstall, R as parseXcodeMajor, T as readPodState, V as readBundleId, j as HEARTBEAT_INTERVAL_MS, s as iosToolchainAsync, w as podsAreStale } from "./toolchain-J4J8MrAr.mjs";
11
+ import { a as nativeTransferRefusal } from "./client-D9CaRks-.mjs";
12
+ import { a as deviceModelRefusal, h as resolveDeviceType, m as resolveConfiguration, v as resolveRuntime, x as simulatorBuildArch, y as resolveSchemeSelection } from "./support-CVOCp0Ft.mjs";
14
13
  import { r as gateProfileForDevice } from "./ios-signing-4c_qXvQm.mjs";
15
- import { s as explainBuildMiss, u as skippedMissReason } from "./prebuild-JUaqOLpc.mjs";
16
- import { n as planFlagRefusal, t as planCachedBuild } from "./build-plan-zCuHGlA8.mjs";
17
- import { t as IosRecipeRefusal } from "./ios-project-DCUDo06I.mjs";
18
- import { i as DEFAULT_DEPS, r as iosProcessRuntime } from "./launch-DscF1QfM.mjs";
19
- import { a as nativeXcodeSources, i as nativeXcodePackages, n as nativeXcodeInputSnapshot, t as nativeXcodeHasPackages } from "./native-xcode-inputs-Cv4l-obn.mjs";
14
+ import { s as explainBuildMiss, u as skippedMissReason } from "./prebuild-gmouvmJZ.mjs";
15
+ import { n as planFlagRefusal, t as planCachedBuild } from "./build-plan-DrMMdayj.mjs";
16
+ import { t as IosRecipeRefusal } from "./ios-project-Ty5pHl9O.mjs";
17
+ import { c as iosProcessRuntime, t as DEFAULT_DEPS } from "./dependencies-Dw6wfQdv.mjs";
18
+ import { a as nativeXcodeSources, i as nativeXcodePackages, n as nativeXcodeInputSnapshot, t as nativeXcodeHasPackages } from "./native-xcode-inputs-BW7H8JGu.mjs";
20
19
  import { existsSync } from "node:fs";
21
20
  import { join } from "node:path";
22
21
  //#region src/integrations/native-xcode-ios.ts
@@ -1,4 +1,4 @@
1
- import { c as IosToolchain, g as CompilationCacheActivity, h as CcacheActivity, i as AndroidBuildOptions, l as WorkerToolchain, p as Optimizations, r as SwiftpmArtifactToolchain, t as NativeGradleArtifactReceipt } from "./android-project-CTYaETc0.mjs";
1
+ import { c as IosToolchain, g as CompilationCacheActivity, h as CcacheActivity, i as AndroidBuildOptions, l as WorkerToolchain, p as Optimizations, r as SwiftpmArtifactToolchain, t as NativeGradleArtifactReceipt } from "./android-project-DUGMbq28.mjs";
2
2
  import { StimContext } from "@stim-cli/core";
3
3
  import { BuildFingerprintSource, BuildReactNativeArtifactQuery, BuildStartParams, BuildSwiftpmArtifactQuery } from "@stim-cli/core/protocol";
4
4
  //#region src/offload/react-native-artifact.d.ts
@@ -94,6 +94,8 @@ interface WorkerJob {
94
94
  cacheArtifact?: boolean;
95
95
  stimBuild?: string;
96
96
  compat?: number;
97
+ /** The JDK major the client builds on; the build runs on an installed JDK of it when the default differs. */
98
+ jdk?: string;
97
99
  native?: BuildStartParams["native"];
98
100
  optimizations: Optimizations["ios"] | null;
99
101
  /** How long the client's Gradle daemon stays warm after an Android build; 0 or absent stops it when the build ends. */
@@ -1,29 +1,29 @@
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 { k as writeConfigSetting } from "./config-BZhXY15H.mjs";
2
+ import { E as workspaceDir, k as workspaceLogsDir$1 } from "./workspace-state-pUg3_RRA.mjs";
3
+ import { k as writeConfigSetting } from "./config-BktkY_zC.mjs";
4
4
  import { n as stripAnsi } from "./process-output-Fpl8PYi8.mjs";
5
5
  import { o as git, s as gitAsync } from "./operation-exec-CUZifp6Z.mjs";
6
- import { d as androidLayoutSetting, y as iosProjectDirSetting } from "./settings-B5tCoq9N.mjs";
7
- import { f as projectRegistry, g as selectNativeXcodeProject } from "./project-BiC68mIp.mjs";
6
+ import { d as androidLayoutSetting, y as iosProjectDirSetting } from "./settings-CosW5X-S.mjs";
7
+ import { f as projectRegistry, g as selectNativeXcodeProject } from "./project-BUu6Is4k.mjs";
8
8
  import { o as parseNdjsonText } from "./ndjson-CgE_o3Dl.mjs";
9
- import { Rn as processContext } from "./budget-HyShrIpL.mjs";
10
- import { d as fingerprintProject, i as compareSourceLists, v as refingerprintAfterMutation } from "./build-cache-CKCzxzxA.mjs";
11
- import { _ as unmetNodePin, g as projectNodeLine, h as pathNodeVersion, v as withProjectNode } from "./server-expo-Ck8EIidM.mjs";
12
- import { n as CCACHE_UNAVAILABLE, o as resolveCcache } from "./ccache-h1FKhZeg.mjs";
13
- import { C as COMPILATION_CACHE_CORRUPT, b as validateGradleManifest, f as reactNativeArtifactReceipt, g as gradleStateDirectories, h as gradleOffloadInputs, m as reactNativeBuildQuery, p as reactNativeArtifactToolchain, v as nativeGradleOutputs, w as clearCorruptCompilationCache, x as verifyGradleTransfer } from "./client-BQsmyp_-.mjs";
14
- import { f as workerToolchain, h as readPodState, i as availableIphone, m as podsAreStale, v as runPodInstall } from "./toolchain-VzLJzZ7O.mjs";
9
+ import { Hn as processContext } from "./budget-k2mZGvvk.mjs";
10
+ import { i as compareSourceLists, p as fingerprintProject, x as refingerprintAfterMutation } from "./build-cache-DrXNCy3T.mjs";
11
+ import { _ as unmetNodePin, g as projectNodeLine, h as pathNodeVersion, v as withProjectNode } from "./server-expo-eQfOdydb.mjs";
12
+ import { n as CCACHE_UNAVAILABLE, o as resolveCcache } from "./ccache-Bx5TbxwG.mjs";
13
+ import { O as runPodInstall, T as readPodState, b as useJdkMajor, i as availableIphone, w as podsAreStale, x as workerToolchain } from "./toolchain-J4J8MrAr.mjs";
14
+ import { C as COMPILATION_CACHE_CORRUPT, b as validateGradleManifest, f as reactNativeArtifactReceipt, g as gradleStateDirectories, h as gradleOffloadInputs, m as reactNativeBuildQuery, p as reactNativeArtifactToolchain, v as nativeGradleOutputs, w as clearCorruptCompilationCache, x as verifyGradleTransfer } from "./client-D9CaRks-.mjs";
15
15
  import { n as fingerprintNativeInputs, r as manifestDigest } from "./native-inputs-TRTTTRxt.mjs";
16
16
  import { a as sourceManifest, o as verifyNativeTransfer } from "./native-source-D-4Dh4JU.mjs";
17
- import { n as buildAndroid, o as gradlewPath, r as buildIos, u as assembleTaskFor } from "./react-native-build-CwZB-agu.mjs";
18
- import { f as podAction } from "./support-qKcbgmI5.mjs";
19
- import { a as runPrebuild, r as recordPrebuild, t as planPrebuild } from "./prebuild-JUaqOLpc.mjs";
20
- import { g as dumpApkManifest, p as apkPackage } from "./support-Cxj9CmII.mjs";
21
- import { n as buildAndroidOperation, t as buildIosOperation } from "./build-CAiw8Ezm.mjs";
22
- import { i as stageBundle, n as resolveBundleExtras } from "./stage-D8xlRU2D.mjs";
23
- import { t as logLines } from "./run-BtzE09Dl.mjs";
24
- import { r as nativeXcodeMetadataDirectories } from "./native-xcode-inputs-Cv4l-obn.mjs";
25
- import { n as swiftpmArtifactInputs, r as swiftpmArtifactSnapshot, t as readSwiftpmArtifactToolchain } from "./swiftpm-artifact-inputs-iY9fsmOc.mjs";
26
- import { a as nativeGradleWorkerArtifactIdentity, i as nativeGradleArtifactSnapshotFromReceipt, o as nativeGradleWorkerScope } from "./native-gradle-artifact-inputs-BJscK4vN.mjs";
17
+ import { n as buildAndroid, o as gradlewPath, r as buildIos, u as assembleTaskFor } from "./react-native-build-oNwqF5Wb.mjs";
18
+ import { f as podAction } from "./support-CVOCp0Ft.mjs";
19
+ import { a as runPrebuild, r as recordPrebuild, t as planPrebuild } from "./prebuild-gmouvmJZ.mjs";
20
+ import { g as dumpApkManifest, p as apkPackage } from "./support-BGSCBoib.mjs";
21
+ import { n as buildAndroidOperation, t as buildIosOperation } from "./build-DPhApsjV.mjs";
22
+ import { i as stageBundle, n as resolveBundleExtras } from "./stage-jKQ7CP_B.mjs";
23
+ import { t as logLines } from "./run-BqB0v3pt.mjs";
24
+ import { r as nativeXcodeMetadataDirectories } from "./native-xcode-inputs-BW7H8JGu.mjs";
25
+ import { n as swiftpmArtifactInputs, r as swiftpmArtifactSnapshot, t as readSwiftpmArtifactToolchain } from "./swiftpm-artifact-inputs-CfUzt_0Z.mjs";
26
+ import { a as nativeGradleWorkerArtifactIdentity, i as nativeGradleArtifactSnapshotFromReceipt, o as nativeGradleWorkerScope } from "./native-gradle-artifact-inputs-btSUulme.mjs";
27
27
  import { createHash } from "node:crypto";
28
28
  import { chmodSync, constants, copyFileSync, cpSync, createReadStream, createWriteStream, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, readlinkSync, realpathSync, renameSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
29
29
  import { isDeepStrictEqual } from "node:util";
@@ -1342,9 +1342,19 @@ async function main() {
1342
1342
  if (mode === "build") {
1343
1343
  const chunks = [];
1344
1344
  for await (const chunk of process.stdin) chunks.push(chunk);
1345
+ const job = JSON.parse(Buffer.concat(chunks).toString("utf8"));
1346
+ if (job.platform === "android" && job.jdk) {
1347
+ const unavailable = useJdkMajor(job.jdk);
1348
+ if (unavailable) return emit({
1349
+ type: "result",
1350
+ ok: false,
1351
+ code: "build-refused",
1352
+ message: unavailable
1353
+ });
1354
+ }
1345
1355
  return emit({
1346
1356
  type: "result",
1347
- ...await build(JSON.parse(Buffer.concat(chunks).toString("utf8")))
1357
+ ...await build(job)
1348
1358
  });
1349
1359
  }
1350
1360
  process.stderr.write("usage: offload-worker offer | offer-native-xcode | offer-native-gradle | native-gradle-artifact | build < job.json\n");