stim 1.17.2 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (162) hide show
  1. package/README.md +50 -1
  2. package/dist/{activity-IRvJY_ru.mjs → activity-BSw0x84R.mjs} +4 -4
  3. package/dist/{agent-device-usage-output-BK41vnzN.mjs → agent-device-usage-output-Bjxu_VmX.mjs} +8 -8
  4. package/dist/{android-B9yaNKwa.mjs → android-BXc6BmEi.mjs} +658 -404
  5. package/dist/{android-B_YNZy61.mjs → android-BdQC6zs1.mjs} +9 -9
  6. package/dist/android-BvV1gGdN.mjs +4 -0
  7. package/dist/{android-DE4v59Mb.mjs → android-DE5g_5gv.mjs} +2 -2
  8. package/dist/{android-cas-ZFpjJBL_.mjs → android-cas-C87geAg-.mjs} +5 -5
  9. package/dist/android-cas-compiler.mjs +2 -2
  10. package/dist/api-DIf_s86s.mjs +150 -0
  11. package/dist/api-run.d.mts +1 -0
  12. package/dist/api-run.mjs +145 -0
  13. package/dist/api.d.mts +218 -0
  14. package/dist/api.mjs +2 -0
  15. package/dist/{app-install-VPkI5WEg.mjs → app-install-CFI4ptUL.mjs} +33 -13
  16. package/dist/{attempt-Bk2ouQVL.mjs → attempt-DW-mQqM7.mjs} +14 -4
  17. package/dist/{web-Dl0KSRHf.mjs → browser-web-CDhqQxhv.mjs} +138 -176
  18. package/dist/{budget-DfcgFdQB.mjs → budget-Dz-kyXLv.mjs} +1391 -58
  19. package/dist/build-facts-B87vo-Im.d.mts +142 -0
  20. package/dist/{cache-manifest-DnUHBJaU.mjs → cache-manifest-DiwKSyv9.mjs} +3 -3
  21. package/dist/cache-manifest.mjs +1 -1
  22. package/dist/{chrome-BrcVWQyD.mjs → chrome-BTUOo8p2.mjs} +1 -1
  23. package/dist/cli-C9Zvgbdc.mjs +68 -0
  24. package/dist/cli.mjs +1 -1
  25. package/dist/{client-SvBdgObD.mjs → client-CuUo8Nvg.mjs} +381 -49
  26. package/dist/collector-run.d.mts +6 -0
  27. package/dist/collector-run.mjs +9 -9
  28. package/dist/{command-output-CDAIFD-8.mjs → command-output-Bt8ygHE7.mjs} +2 -2
  29. package/dist/{config-D0DbpZtM.mjs → config-DC5jEtd1.mjs} +9 -5
  30. package/dist/{created-devices-CpvzBL25.mjs → created-devices-D0s26Hx5.mjs} +2 -2
  31. package/dist/{dependency-state-CLcBHH2M.mjs → dependency-state-DKaS1OM9.mjs} +2 -2
  32. package/dist/{detached-entry-CiTEgMR1.mjs → detached-entry-pB_IPfV4.mjs} +1 -1
  33. package/dist/{dev-client-B-XC4uRH.mjs → dev-client-CDY_zAmD.mjs} +2 -2
  34. package/dist/{device-C8IOoJPv.mjs → device-BHw0WlHl.mjs} +8 -8
  35. package/dist/{device-capacity-ZC4XSZ4R.mjs → device-capacity-BoN1jQkO.mjs} +25 -14
  36. package/dist/device-host-worker.mjs +19 -19
  37. package/dist/{gradle-dJpre3Yn.mjs → device-ios-B2ruohE-.mjs} +661 -107
  38. package/dist/{device-lease-DpoS36_u.mjs → device-lease-Cu7PtQpZ.mjs} +9 -9
  39. package/dist/{device-lease-run-B8YltIH_.mjs → device-lease-run-D38SnZtt.mjs} +4 -4
  40. package/dist/{device-pool-3o7s5lo4.mjs → device-pool-CP4rAsHx.mjs} +3 -3
  41. package/dist/{device-remote-hFSkpfQu.mjs → device-remote-B5GiUifk.mjs} +15 -16
  42. package/dist/{doctor-CFv1fCrF.mjs → doctor-PRJH94v6.mjs} +61 -34
  43. package/dist/doctor-watchman-wZhyTdp4.mjs +259 -0
  44. package/dist/{error-diagnostics-C-NMnhrk.mjs → error-diagnostics--v5HGOU0.mjs} +11 -11
  45. package/dist/{exec-CaErVv7t.mjs → exec-i8GDPwq9.mjs} +93 -6
  46. package/dist/{gc-DEmkg3Xh.mjs → gc-CyHMcKcn.mjs} +25 -471
  47. package/dist/{guide-CSmhMTf8.mjs → guide-dRaQJJk9.mjs} +681 -507
  48. package/dist/{hosted-android-E1Heoqnv.mjs → hosted-android-Bs7fytj7.mjs} +3 -3
  49. package/dist/{hosted-client-Bp4knSwu.mjs → hosted-client-C5G4h_OJ.mjs} +2 -2
  50. package/dist/{hosted-ios-BnbeYOUD.mjs → hosted-ios-Bik035eL.mjs} +1 -1
  51. package/dist/{hosted-logs-OcgIBvCT.mjs → hosted-logs-CI9Az9a4.mjs} +9 -9
  52. package/dist/{hosted-macos-DcxKjtfH.mjs → hosted-macos-DABm3ScO.mjs} +5 -5
  53. package/dist/{hosted-native-1Ebbig4w.mjs → hosted-native-DbV2aUVw.mjs} +13 -9
  54. package/dist/{idle-shutdown-IGyNV8Cr.mjs → idle-shutdown-DYiMBn34.mjs} +7 -8
  55. package/dist/{ios-DSfnPfse.mjs → ios-BWbHFZVz.mjs} +19 -7
  56. package/dist/{ios-Cr1h5gnO.mjs → ios-DCrkgXEM.mjs} +1 -1
  57. package/dist/ios-DYUr9LGc.mjs +8 -0
  58. package/dist/ios-ITYno9rO.mjs +2241 -0
  59. package/dist/{ios-device-pAN4t54-.mjs → ios-device-CJ_ZOGky.mjs} +3 -3
  60. package/dist/{ios-device-Ee7sDXfp.mjs → ios-device-CrW8aMb5.mjs} +1 -1
  61. package/dist/{ios-state-8L3lgum6.mjs → ios-state-By0XuLTQ.mjs} +1 -1
  62. package/dist/{launch-verify-lTnWZikR.mjs → launch-verify-DCveSE6d.mjs} +5 -5
  63. package/dist/{logs-BAaS7gS2.mjs → logs-Bao1HOMy.mjs} +13 -13
  64. package/dist/{macos-BIRQS90f.mjs → macos-ciyBdTY5.mjs} +194 -132
  65. package/dist/macos-nIOATJmR.mjs +2 -0
  66. package/dist/macos-run.mjs +1 -1
  67. package/dist/maintenance-run.mjs +349 -47
  68. package/dist/manifest-CX0d1IkZ.mjs +148 -0
  69. package/dist/{metro-g8NqiJp-.mjs → metro-DI2AjPF_.mjs} +196 -43
  70. package/dist/{metro-gateway-C-ijGI2F.mjs → metro-gateway-BxpJLIwh.mjs} +4 -4
  71. package/dist/{metro-store-CDDZHtPl.mjs → metro-store-BAHFcJm6.mjs} +16 -2
  72. package/dist/{build-plan-BDsSi09V.mjs → miss-reason-CjQCOKqq.mjs} +207 -249
  73. package/dist/{named-ports-C8m8EQs2.mjs → named-ports-B4iWH4E-.mjs} +70 -8
  74. package/dist/{native-runtime-BEK171xQ.mjs → native-runtime-BGxsbfny.mjs} +6 -6
  75. package/dist/{ndjson-PclOIwVY.mjs → ndjson-LGZAMsqa.mjs} +8 -4
  76. package/dist/offload-worker.d.mts +3 -45
  77. package/dist/offload-worker.mjs +11 -11
  78. package/dist/{ownership-DyRQru0q.mjs → ownership-EB0ySdGK.mjs} +3 -3
  79. package/dist/{page-QF_Ke10s.mjs → page-Bv9s2KwY.mjs} +1 -1
  80. package/dist/placement-log-Dxe34rJm.mjs +88 -0
  81. package/dist/plan-placement-BVY59qa8.mjs +290 -0
  82. package/dist/{ports-4nYqxPWC.mjs → ports-ByPc0_97.mjs} +3 -3
  83. package/dist/{prebuild-D7RUMkwN.mjs → prebuild-BKJ3wJI1.mjs} +5 -5
  84. package/dist/preview-BbSottmO.mjs +986 -0
  85. package/dist/{rolldown-runtime-BsOwBuO_.mjs → process-identity-Biv3arCO.mjs} +11 -1
  86. package/dist/project-B5eQ1USs.mjs +612 -0
  87. package/dist/{pull-request-pxnDCQzn.mjs → pull-request-IHNdMnG8.mjs} +1 -1
  88. package/dist/pull-requests.mjs +1 -1
  89. package/dist/react-native-ios-BMh2i25I.mjs +2 -0
  90. package/dist/react-native-ios-CSpIxexZ.mjs +2083 -0
  91. package/dist/{recordings-BNgsD1Tr.mjs → recordings-Bv8McZN4.mjs} +1 -1
  92. package/dist/{reload-DcRxj3qG.mjs → reload-rAPdqeRR.mjs} +14 -15
  93. package/dist/{remote-cache-Ci4DQYYj.mjs → remote-cache-N3hAEaAL.mjs} +5 -5
  94. package/dist/{run-CkE9y0nc.mjs → run-lAkle1-c.mjs} +5 -5
  95. package/dist/{server-bare-BkrSxSsZ.mjs → server-bare-CkIjnegq.mjs} +5 -6
  96. package/dist/server-expo-DGsdUGX2.mjs +2 -0
  97. package/dist/{server-expo-CHTyXD0G.mjs → server-expo-n3tUi3Em.mjs} +5 -6
  98. package/dist/{settings-SR9OmW9h.mjs → settings-2am7TSxp.mjs} +5 -5
  99. package/dist/{settings-Cfd-0r2d.mjs → settings-CxgngUZk.mjs} +116 -103
  100. package/dist/{settings-BBpMcDbD.mjs → settings-Djl-mpjX.mjs} +1 -1
  101. package/dist/settings.schema.json +198 -9
  102. package/dist/{simslim-BWNrc3M3.mjs → simslim-D9LkJxIO.mjs} +7 -7
  103. package/dist/{slot-launch-DmjBmpQV.mjs → slot-launch-HV_KtPIw.mjs} +6 -6
  104. package/dist/{spawn-claims-D0XfSe8u.mjs → spawn-claims-Kqiifsk2.mjs} +1 -1
  105. package/dist/{spawn-entry-jw19m8Nl.mjs → spawn-entry-Dcb7sDUz.mjs} +1 -0
  106. package/dist/{stage-CzaiwFsI.mjs → stage-BgaZJVZY.mjs} +14 -3
  107. package/dist/{start-AlfCPRVU.mjs → start-D8NbxNBb.mjs} +1 -1
  108. package/dist/{start-DUz3mYdb.mjs → start-DtxthMfI.mjs} +34 -27
  109. package/dist/{state-PeQiJuIu.mjs → state-D2KtnALG.mjs} +4 -4
  110. package/dist/{state-DyaNTgfR.mjs → state-Tp4uImDS.mjs} +5 -3
  111. package/dist/{state-B4PQFXMW.d.mts → state-lKh8shBp.d.mts} +2 -3
  112. package/dist/{stats-Bq4fJOdB.mjs → stats-8EJ5ivFT.mjs} +6 -6
  113. package/dist/{status-DlKvVJBE.mjs → status-BEeL6IKz.mjs} +6 -4
  114. package/dist/{status-BA2pehwf.mjs → status-BOyp0CUl.mjs} +31 -34
  115. package/dist/{stim-desktop-Cnz8CPnl.mjs → stim-desktop-C65jk_q2.mjs} +1 -1
  116. package/dist/{stim-installations-QMEI32v1.mjs → stim-installations-DbmUjsLv.mjs} +1 -1
  117. package/dist/stop-D0UIpZuh.mjs +72 -0
  118. package/dist/{stop-zF1y04f2.mjs → stop-DRipAg-e.mjs} +2 -2
  119. package/dist/{stop-DQIasgKp.mjs → stop-zDlknFoz.mjs} +79 -33
  120. package/dist/supervisor-run.d.mts +24 -22
  121. package/dist/supervisor-run.mjs +21 -22
  122. package/dist/{support-CsJNVfOc.mjs → support-CNqYkV0y.mjs} +7 -7
  123. package/dist/{support-WvD__tSV.mjs → support-DsNaFg6D.mjs} +5 -5
  124. package/dist/swiftpm-macos-aJzPAj1t.mjs +119 -0
  125. package/dist/{toolchain-DNyR3NPq.mjs → toolchain-C3xSoyUl.mjs} +475 -269
  126. package/dist/{trigger-Bemu8ytw.mjs → trigger-CAhmG-4s.mjs} +6 -6
  127. package/dist/trigger-CoalsMTV.mjs +2 -0
  128. package/dist/{warm-progress-DF4JRvYI.mjs → warm-progress-pFLB2e6P.mjs} +135 -38
  129. package/dist/{status-CzS4bPO9.mjs → watchman-BL1IdOtq.mjs} +75 -7
  130. package/dist/web-DFpFeZu5.mjs +2 -0
  131. package/dist/web-DbbrPUn0.mjs +127 -0
  132. package/dist/web-run.mjs +10 -10
  133. package/dist/{workspace-state-DqcCbpE7.mjs → workspace-state-CR9X86xJ.mjs} +3 -3
  134. package/dist/{ownership-BMLqyBgJ.mjs → workspaces-Djb2gfi9.mjs} +661 -23
  135. package/dist/{worktree-Be_7NLKy.mjs → worktree-BL4M1rhB.mjs} +252 -50
  136. package/dist/{worktree-j3IcFAI5.mjs → worktree-DV-A0LNL.mjs} +1 -1
  137. package/package.json +10 -5
  138. package/shim/bundle-response.cjs +2 -1
  139. package/shim/bundle-response.d.cts +1 -1
  140. package/shim/expo-metro-config.cjs +1 -1
  141. package/dist/build-progress-D0WkjCPd.mjs +0 -1036
  142. package/dist/build-slots-41v_d2x9.mjs +0 -142
  143. package/dist/cli-CYXb29oE.mjs +0 -51
  144. package/dist/deps-iKw0eD4P.mjs +0 -438
  145. package/dist/device-ios-C2Um-XUR.mjs +0 -412
  146. package/dist/errors-B6W7FkxQ.mjs +0 -15
  147. package/dist/guide-status-Du-ZQ3FD.mjs +0 -125
  148. package/dist/idle-BXG__1BA.mjs +0 -176
  149. package/dist/in-use-CvGOUn-x.mjs +0 -130
  150. package/dist/ios-BJ4XUSe1.mjs +0 -3867
  151. package/dist/native-run-D1Q56rAD.mjs +0 -158
  152. package/dist/preview-B-g9d7kV.mjs +0 -318
  153. package/dist/process-identity-BmRm1qV0.mjs +0 -12
  154. package/dist/project-D47Rh0ly.mjs +0 -276
  155. package/dist/server-expo-CeakhI8P.mjs +0 -2
  156. package/dist/state-BKa8wNN5.mjs +0 -148
  157. package/dist/stop-BIiM49EY.mjs +0 -48
  158. package/dist/stop-cause-rhmGfwvt.mjs +0 -97
  159. package/dist/trigger-CXts6qt1.mjs +0 -2
  160. package/dist/watchman-APYjXSQa.mjs +0 -48
  161. package/dist/workspace-process-lock-2mNzOlaB.mjs +0 -58
  162. package/dist/workspaces-Bcib97-6.mjs +0 -306
@@ -1,6 +1,6 @@
1
- import { t as getExecutor } from "./exec-CaErVv7t.mjs";
2
- import { n as TOOL_ERROR_PREFIX } from "./ios-device-Ee7sDXfp.mjs";
3
- import { i as INSTALL_ERROR } from "./app-install-VPkI5WEg.mjs";
1
+ import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
2
+ import { i as INSTALL_ERROR } from "./app-install-CFI4ptUL.mjs";
3
+ import { n as TOOL_ERROR_PREFIX } from "./ios-device-CrW8aMb5.mjs";
4
4
  import { mkdtempSync, readFileSync, rmSync } from "node:fs";
5
5
  import { join } from "node:path";
6
6
  import { tmpdir } from "node:os";
@@ -1,4 +1,4 @@
1
- import { t as getExecutor } from "./exec-CaErVv7t.mjs";
1
+ import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
2
2
  //#region src/collector/ios-device.ts
3
3
  const CONSOLE_ENV = { OS_ACTIVITY_DT_MODE: "enable" };
4
4
  const DEV_MENU_LAUNCH_ARGS = [
@@ -1,4 +1,4 @@
1
- import { a as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-DqcCbpE7.mjs";
1
+ import { a as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-CR9X86xJ.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,8 +1,8 @@
1
- import { t as getExecutor } from "./exec-CaErVv7t.mjs";
2
- import { s as isAppLaunchError } from "./command-output-CDAIFD-8.mjs";
3
- import { o as readNdjsonGenerations } from "./ndjson-PclOIwVY.mjs";
4
- import { t as DEV_MENU_LAUNCH_ARGS } from "./ios-device-Ee7sDXfp.mjs";
5
- import { f as deviceShellArg, n as ANDROID_DISABLE_AUTO_LAUNCH_EXTRA, s as androidAppProcess } from "./app-install-VPkI5WEg.mjs";
1
+ import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
2
+ import { s as isAppLaunchError } from "./command-output-Bt8ygHE7.mjs";
3
+ import { o as readNdjsonGenerations } from "./ndjson-LGZAMsqa.mjs";
4
+ import { f as deviceShellArg, n as ANDROID_DISABLE_AUTO_LAUNCH_EXTRA, s as androidAppProcess } from "./app-install-CFI4ptUL.mjs";
5
+ import { t as DEV_MENU_LAUNCH_ARGS } from "./ios-device-CrW8aMb5.mjs";
6
6
  import { join } from "node:path";
7
7
  //#region src/engine/app-readiness.ts
8
8
  const APP_READINESS_TIMEOUT_MS = 3e4;
@@ -1,15 +1,15 @@
1
- import { H as projectDeviceSlots, V as parseDeviceSlotOption, _ as loadConfig$1, g as isPathPrefix } from "./config-D0DbpZtM.mjs";
2
- import { t as process_identity_exports } from "./process-identity-BmRm1qV0.mjs";
3
- import { f as refuseNoProject, l as phaseLine, v as launchErrorPreview } from "./command-output-CDAIFD-8.mjs";
4
- import { o as findCommandWorkspace } from "./project-D47Rh0ly.mjs";
5
- import { r as readWorkspaceState$1, x as workspaceLogsDir$1 } from "./workspace-state-DqcCbpE7.mjs";
6
- import { n as agentDeviceLiveness, u as readAgentDeviceRecords } from "./activity-IRvJY_ru.mjs";
7
- import { n as SOURCES, t as LEVELS } from "./ndjson-PclOIwVY.mjs";
8
- import { o as connectHost } from "./hosted-client-Bp4knSwu.mjs";
9
- import { n as pullHostedNativeLogs, t as pullHostedMacosLogs } from "./hosted-logs-OcgIBvCT.mjs";
10
- import "./hosted-macos-DcxKjtfH.mjs";
11
- import { n as readHostedIos, t as readHostedAndroid } from "./ios-state-8L3lgum6.mjs";
12
- import { i as captureWorkspaceCrashes, t as errorDiagnostics } from "./error-diagnostics-C-NMnhrk.mjs";
1
+ import { t as process_identity_exports } from "./process-identity-Biv3arCO.mjs";
2
+ import { f as refuseNoProject, l as phaseLine, v as launchErrorPreview } from "./command-output-Bt8ygHE7.mjs";
3
+ import { H as projectDeviceSlots, V as parseDeviceSlotOption, _ as loadConfig$1, g as isPathPrefix } from "./config-DC5jEtd1.mjs";
4
+ import { r as readWorkspaceState$1, x as workspaceLogsDir$1 } from "./workspace-state-CR9X86xJ.mjs";
5
+ import { n as findCommandWorkspace } from "./project-B5eQ1USs.mjs";
6
+ import { n as agentDeviceLiveness, u as readAgentDeviceRecords } from "./activity-BSw0x84R.mjs";
7
+ import { n as SOURCES, t as LEVELS } from "./ndjson-LGZAMsqa.mjs";
8
+ import { o as connectHost } from "./hosted-client-C5G4h_OJ.mjs";
9
+ import { n as pullHostedNativeLogs, t as pullHostedMacosLogs } from "./hosted-logs-CI9Az9a4.mjs";
10
+ import { n as readHostedIos, t as readHostedAndroid } from "./ios-state-By0XuLTQ.mjs";
11
+ import { i as captureWorkspaceCrashes, t as errorDiagnostics } from "./error-diagnostics--v5HGOU0.mjs";
12
+ import "./hosted-macos-DABm3ScO.mjs";
13
13
  import { t as watchStdoutReader } from "./stdout-reader-C8yjre1x.mjs";
14
14
  import { realpathSync } from "node:fs";
15
15
  import { dirname, join, relative, resolve, sep } from "node:path";
@@ -251,7 +251,7 @@ const LEVEL_COLOURS = {
251
251
  fatal: chalk.bgRed
252
252
  };
253
253
  function logsCommand(program) {
254
- 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, or all").option("--level <l>", `Minimum level: ${LEVELS.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) => {
254
+ 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.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) => {
255
255
  const root = findCommandWorkspace(process.cwd());
256
256
  if (!root) {
257
257
  refuseNoProject({ json: false });
@@ -1,67 +1,55 @@
1
- import { t as getExecutor } from "./exec-CaErVv7t.mjs";
2
- import { E as upsertProject, u as getConcurrencyLimits } from "./config-D0DbpZtM.mjs";
3
- import { t as process_identity_exports } from "./process-identity-BmRm1qV0.mjs";
4
- import { l as phaseLine } from "./command-output-CDAIFD-8.mjs";
5
- import { P as resolveSettings, R as settingShapeErrors, gt as repoRoot, i as SETTING_SHAPE_REMEDY, it as gitCommonDir } from "./settings-Cfd-0r2d.mjs";
6
- import { s as findProjectRoot$1 } from "./project-D47Rh0ly.mjs";
7
- import { c as writeWorkspaceState, g as workspaceAgentDeviceDir, i as recordWorkspaceUse, u as ensureWorkspaceStorage, v as workspaceDir, x as workspaceLogsDir$1 } from "./workspace-state-DqcCbpE7.mjs";
8
- import { a as spawnDeclared } from "./spawn-claims-D0XfSe8u.mjs";
9
- import { r as releaseBuildSlot, t as acquireBuildSlot } from "./build-slots-41v_d2x9.mjs";
10
- import { t as withWorkspaceProcessLock } from "./workspace-process-lock-2mNzOlaB.mjs";
11
- import { c as recordFinishedBuild, l as startBuildProgress, n as NO_BUILD_PROGRESS, u as tapBuildLog } from "./build-progress-D0WkjCPd.mjs";
12
- import { a as requiredMacosRecord, n as macosLogFile, r as macosProcess, t as macosDir } from "./state-DyaNTgfR.mjs";
13
- import { r as createNdjsonWriter } from "./ndjson-PclOIwVY.mjs";
14
- import { i as macosToolchain } from "./toolchain-DNyR3NPq.mjs";
15
- import { a as offloadBuild, c as placementLoad, d as OffloadRefusal, f as namedBuildMachine, h as resolveBuildPlacement, i as closeOffload, l as remotePhaseText, n as buildPlacementCandidates, p as parseBuildMachineOption, r as chooseBuildMachine, s as offloadPlacement } from "./client-SvBdgObD.mjs";
16
- import { o as connectHost } from "./hosted-client-Bp4knSwu.mjs";
17
- import { t as logLines } from "./run-CkE9y0nc.mjs";
18
- import { t as placeHostedMacos } from "./hosted-macos-DcxKjtfH.mjs";
19
- import { n as stopMacosAppHeld } from "./stop-BIiM49EY.mjs";
20
- import { t as spawnEntry } from "./spawn-entry-jw19m8Nl.mjs";
21
- import { n as stageBundle, r as validateInfoPlist, t as resolveBundleExtras } from "./stage-CzaiwFsI.mjs";
22
- import { f as withNativeBuildRun } from "./native-run-D1Q56rAD.mjs";
23
- import { createHash, randomUUID } from "node:crypto";
1
+ import { t as process_identity_exports } from "./process-identity-Biv3arCO.mjs";
2
+ import { t as getExecutor } from "./exec-i8GDPwq9.mjs";
3
+ import { t as spawnEntry } from "./spawn-entry-Dcb7sDUz.mjs";
4
+ import { l as phaseLine } from "./command-output-Bt8ygHE7.mjs";
5
+ import { E as upsertProject, u as getConcurrencyLimits } from "./config-DC5jEtd1.mjs";
6
+ import { c as writeWorkspaceState, g as workspaceAgentDeviceDir, i as recordWorkspaceUse, u as ensureWorkspaceStorage, v as workspaceDir, x as workspaceLogsDir$1 } from "./workspace-state-CR9X86xJ.mjs";
7
+ import { d as projectRegistry, o as ownedDeviceLabel, r as findProjectRoot } from "./project-B5eQ1USs.mjs";
8
+ import { B as settingShapeErrors, I as resolveSettings, i as SETTING_SHAPE_REMEDY, mt as repoRoot, nt as gitCommonDir } from "./settings-CxgngUZk.mjs";
9
+ import { F as recordFinishedBuild, I as startBuildProgress, L as tapBuildLog, O as NO_BUILD_PROGRESS, P as recordBuildPhase } from "./budget-Dz-kyXLv.mjs";
10
+ import { M as acquireBuildSlot, P as releaseBuildSlot } from "./workspaces-Djb2gfi9.mjs";
11
+ import { a as spawnDeclared } from "./spawn-claims-Kqiifsk2.mjs";
12
+ import { E as sanitizeDeviceLabel } from "./ios-BWbHFZVz.mjs";
13
+ import { a as withWorkspaceProcessLock } from "./named-ports-B4iWH4E-.mjs";
14
+ import { i as macosProcess, n as macosDir, o as requiredMacosRecord, r as macosLogFile } from "./state-Tp4uImDS.mjs";
15
+ import { r as createNdjsonWriter } from "./ndjson-LGZAMsqa.mjs";
16
+ import { A as resolveBuildPlacement, C as setRemoteLogSink, D as parseBuildMachineOption, E as namedBuildMachine, O as requireLocalBuild, S as withNativeBuildRun, a as offloadBuild, c as placementLoad, i as closeOffload, l as remotePhaseText, n as buildPlacementCandidates, r as chooseBuildMachine, s as offloadPlacement, w as OffloadRefusal } from "./client-CuUo8Nvg.mjs";
17
+ import { o as connectHost } from "./hosted-client-C5G4h_OJ.mjs";
18
+ import { t as buildPlacementRecord } from "./placement-log-Dxe34rJm.mjs";
19
+ import { t as placeHostedMacos } from "./hosted-macos-DABm3ScO.mjs";
20
+ import { i as validateInfoPlist, t as resolveBundleExtras } from "./stage-BgaZJVZY.mjs";
21
+ import { r as stopMacosAppHeld, t as stopBundleInstances } from "./stop-D0UIpZuh.mjs";
24
22
  import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, realpathSync, renameSync, rmSync } from "node:fs";
25
- import { join, relative, resolve } from "node:path";
26
- import { LOG_ROTATE_BYTES } from "@stim-cli/core";
23
+ import { join } from "node:path";
27
24
  import { machineCapacity, readMacosRecord, validHostedAppArguments } from "@stim-cli/core/state";
28
- //#region src/macos/build.ts
29
- async function tool(root, args, writer, note, capture = false) {
30
- const child = spawnDeclared(() => getExecutor().spawn("swift", args, {
31
- cwd: root,
32
- detached: true,
33
- stdio: [
34
- "ignore",
35
- "pipe",
36
- "pipe"
37
- ]
38
- }));
39
- let stdout = "";
40
- child.stdout?.on("data", (chunk) => {
41
- if (capture) stdout += chunk.toString("utf8");
42
- });
43
- const write = (msg) => {
44
- writer.write({
45
- src: "build",
46
- platform: "macos",
47
- level: "debug",
48
- msg
49
- });
50
- note(msg);
51
- };
52
- if (child.stdout) logLines(child.stdout, write);
53
- if (child.stderr) logLines(child.stderr, write);
54
- await new Promise((done, reject) => {
55
- child.once("error", reject);
56
- child.once("close", (code) => code === 0 ? done() : reject(/* @__PURE__ */ new Error(`swift ${args[0]} failed (${code}). See stim logs --source build.`)));
57
- });
58
- return stdout.trim();
25
+ import { LOG_ROTATE_BYTES } from "@stim-cli/core";
26
+ import { createHash, randomUUID } from "node:crypto";
27
+ //#region src/macos/app-name.ts
28
+ const DOT = String.fromCodePoint(183);
29
+ const ELLIPSIS = String.fromCodePoint(8230);
30
+ const LABEL_MAX = 24;
31
+ const PRODUCT_MAX = 40;
32
+ function clip(text, max) {
33
+ const chars = [...text];
34
+ return chars.length <= max ? text : `${chars.slice(0, max - 1).join("")}${ELLIPSIS}`;
35
+ }
36
+ /** The visible app name for a run: `<product> <dot> <label>`, or just the product when the label is empty. */
37
+ function macosAppName(product, label) {
38
+ const name = clip(product.replace(/[\p{Cc}/:\\]+/gu, " ").trim(), PRODUCT_MAX) || "App";
39
+ const suffix = clip(sanitizeDeviceLabel(label), LABEL_MAX);
40
+ return suffix ? `${name} ${DOT} ${suffix}` : name;
59
41
  }
60
- async function buildMacosBundle({ root, product, infoPlist, bundle, bundleId, scratch, writer, note, record, buildMachine, resources, assetCatalog, progress = NO_BUILD_PROGRESS }) {
42
+ function workspaceAppName(root, product) {
43
+ return macosAppName(product, ownedDeviceLabel(root));
44
+ }
45
+ //#endregion
46
+ //#region src/macos/build.ts
47
+ async function buildMacosBundle({ root, recipe, bundle, bundleId, displayName, scratch, writer, note, record, buildMachine, progress = NO_BUILD_PROGRESS }) {
61
48
  if (record) record.buildMachine = buildMachine;
62
- validateInfoPlist(root, product, infoPlist);
63
- const repository = realpathSync(repoRoot(root) ?? root);
64
- const extras = resolveBundleExtras(root, repository, resources, assetCatalog);
49
+ setRemoteLogSink((entry) => writer.write({
50
+ ...entry,
51
+ platform: "macos"
52
+ }));
65
53
  const write = (msg) => {
66
54
  writer.write({
67
55
  src: "build",
@@ -72,8 +60,22 @@ async function buildMacosBundle({ root, product, infoPlist, bundle, bundleId, sc
72
60
  note(msg);
73
61
  };
74
62
  let offloadFallback = null;
63
+ let asked = [];
64
+ let failedMachine;
75
65
  const fallBack = (reason) => {
66
+ writer.write(buildPlacementRecord({
67
+ platform: "macos",
68
+ buildMachine,
69
+ candidates: asked,
70
+ event: "placement_fallback",
71
+ fallback: {
72
+ code: failedMachine ? "offload-failed" : "no-remote-mac-took-it",
73
+ reason,
74
+ machine: failedMachine
75
+ }
76
+ }));
76
77
  if (namedBuildMachine(buildMachine)) throw new OffloadRefusal(buildMachine, reason);
78
+ requireLocalBuild(buildMachine);
77
79
  offloadFallback = reason;
78
80
  if (record) record.offloadFallback = reason;
79
81
  writer.write({
@@ -102,10 +104,11 @@ async function buildMacosBundle({ root, product, infoPlist, bundle, bundleId, sc
102
104
  let choice = null;
103
105
  try {
104
106
  try {
105
- const { mode, machines } = buildPlacementCandidates(buildMachine);
107
+ const { mode, machines, localEnabled } = buildPlacementCandidates(buildMachine);
106
108
  const here = machineCapacity();
107
109
  const placement = offloadPlacement({
108
110
  mode,
111
+ localEnabled,
109
112
  machines: machines.length,
110
113
  here,
111
114
  unsupported: null,
@@ -114,29 +117,30 @@ async function buildMacosBundle({ root, product, infoPlist, bundle, bundleId, sc
114
117
  if (placement.offload) {
115
118
  const chosen = await chooseBuildMachine({
116
119
  projectRoot: root,
117
- target: {
118
- platform: "macos",
119
- local: macosToolchain()
120
- },
120
+ target: recipe.offload.target(),
121
121
  mode,
122
122
  here,
123
123
  machines,
124
124
  selected: buildMachine,
125
- note: (line) => write(`offload: ${line}`)
125
+ note: (line) => write(`offload: ${line}`),
126
+ onCandidates: (each) => asked = each
126
127
  });
127
128
  if (typeof chosen === "string") throw new Error(chosen);
128
129
  choice = chosen;
130
+ failedMachine = chosen.machine;
131
+ writer.write(buildPlacementRecord({
132
+ platform: "macos",
133
+ buildMachine,
134
+ candidates: asked,
135
+ chose: {
136
+ machine: chosen.machine,
137
+ reason: `${placement.reason}${placementLoad(chosen)}`
138
+ }
139
+ }));
129
140
  write(`placement: ${choice.machine} (${placement.reason}${placementLoad(choice)})`);
130
141
  const outcome = await offloadBuild({
131
142
  choice,
132
- request: {
133
- platform: "macos",
134
- product,
135
- infoPlist: relative(root, resolve(root, infoPlist)),
136
- bundleId,
137
- resources: Object.fromEntries(Object.entries(extras.resources).map(([destination, source]) => [destination, relative(repository, source)])),
138
- assetCatalog: extras.assetCatalog ? relative(repository, extras.assetCatalog) : null
139
- },
143
+ request: recipe.offload.request(bundleId),
140
144
  stagingDir: join(staging, "offload"),
141
145
  onPhase: (phase, line) => note(remotePhaseText(phase, line, choice.machine)),
142
146
  onEnter: (phase) => {
@@ -161,21 +165,7 @@ async function buildMacosBundle({ root, product, infoPlist, bundle, bundleId, sc
161
165
  progress.place(null);
162
166
  if (!outcome.ok) throw new Error(`${outcome.machine}: ${outcome.reason}`);
163
167
  progress.step("install");
164
- const executable = join(outcome.artifactPath, "Contents", "MacOS", product);
165
- const plist = JSON.parse(getExecutor().runFile("plutil", [
166
- "-convert",
167
- "json",
168
- "-o",
169
- "-",
170
- join(outcome.artifactPath, "Contents", "Info.plist")
171
- ]));
172
- if (plist.CFBundleIdentifier !== bundleId || plist.CFBundleExecutable !== product || !existsSync(executable)) throw new Error("The fetched macOS bundle does not match the requested identity and executable.");
173
- for (const destination of [...Object.keys(extras.resources), ...extras.assetCatalog ? ["Assets.car"] : []]) if (!existsSync(join(outcome.artifactPath, "Contents", "Resources", destination))) throw new Error(`The fetched macOS bundle lacks declared resource ${destination}.`);
174
- getExecutor().runFile("codesign", [
175
- "--verify",
176
- "--strict",
177
- outcome.artifactPath
178
- ]);
168
+ recipe.validateFetched(outcome.artifactPath, bundleId, displayName);
179
169
  promote(outcome.artifactPath);
180
170
  if (record) {
181
171
  record.offloadedTo = outcome.machine;
@@ -188,6 +178,14 @@ async function buildMacosBundle({ root, product, infoPlist, bundle, bundleId, sc
188
178
  handoff: outcome.handoff ?? null
189
179
  };
190
180
  }
181
+ writer.write(buildPlacementRecord({
182
+ platform: "macos",
183
+ buildMachine,
184
+ stays: {
185
+ code: placement.code,
186
+ reason: placement.reason
187
+ }
188
+ }));
191
189
  write(`placement: here (${placement.reason})`);
192
190
  } catch (error) {
193
191
  fallBack(error instanceof Error ? error.message : String(error));
@@ -197,36 +195,24 @@ async function buildMacosBundle({ root, product, infoPlist, bundle, bundleId, sc
197
195
  let slot;
198
196
  try {
199
197
  slot = await acquireBuildSlot({
198
+ automatic: buildMachine === "auto",
200
199
  max: getConcurrencyLimits().maxBuilds,
201
200
  root,
202
201
  logFile: writer.file,
203
202
  out: note,
204
203
  waitingFor: (info) => progress.waitingFor(info, "build-slot")
205
204
  });
205
+ requireLocalBuild(buildMachine);
206
206
  if (record) record.builtOn = "here";
207
207
  progress.step("compile");
208
- await tool(root, [
209
- "build",
210
- "-c",
211
- "debug",
212
- "--product",
213
- product,
214
- "--scratch-path",
215
- scratch,
216
- "--jobs",
217
- "2"
218
- ], writer, note);
219
- const bin = await tool(root, [
220
- "build",
221
- "-c",
222
- "debug",
223
- "--scratch-path",
208
+ const bin = await recipe.compile({
224
209
  scratch,
225
- "--show-bin-path"
226
- ], writer, () => {}, true);
210
+ writer,
211
+ note
212
+ });
227
213
  progress.step("install");
228
- const staged = join(staging, `${product}.app`);
229
- stageBundle(root, product, infoPlist, bin, staged, bundleId, extras);
214
+ const staged = join(staging, `${recipe.product}.app`);
215
+ recipe.stage(bin, staged, bundleId, displayName);
230
216
  promote(staged);
231
217
  return {
232
218
  bundleId,
@@ -247,6 +233,41 @@ async function buildMacosBundle({ root, product, infoPlist, bundle, bundleId, sc
247
233
  }
248
234
  }
249
235
  //#endregion
236
+ //#region src/macos/plan.ts
237
+ function planMacos(root, buildMachineFlag) {
238
+ if (process.platform !== "darwin") throw new Error("stim macos requires a Mac with Swift installed.");
239
+ root = realpathSync(root);
240
+ if (!existsSync(join(root, "Package.swift"))) throw new Error("Run stim macos from the directory containing Package.swift.");
241
+ const repository = repoRoot(root);
242
+ const settings = resolveSettings({
243
+ projectPath: root,
244
+ gitCommonDir: gitCommonDir(root),
245
+ repoRoot: repository
246
+ });
247
+ const [shape] = settingShapeErrors(settings);
248
+ if (shape) throw new Error(`${shape} ${SETTING_SHAPE_REMEDY}`);
249
+ const selected = resolveBuildPlacement(buildMachineFlag);
250
+ if (selected.failure) throw Object.assign(new Error(selected.failure.message), selected.failure);
251
+ const macos = settings.macos;
252
+ 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" });
253
+ validateInfoPlist(root, macos.product, macos.infoPlist);
254
+ resolveBundleExtras(root, repository ?? root, macos.resources, macos.assetCatalog);
255
+ return {
256
+ platform: "macos",
257
+ product: macos.product,
258
+ buildMachine: selected.selected,
259
+ fingerprint: null,
260
+ cacheKey: null,
261
+ cacheHit: false,
262
+ provider: null,
263
+ cacheSkipped: false,
264
+ prebuild: null,
265
+ outcome: null,
266
+ expectedMs: null,
267
+ basis: 0
268
+ };
269
+ }
270
+ //#endregion
250
271
  //#region src/commands/macos.ts
251
272
  /**
252
273
  * Builds the Debug app and launches it here, or with `remote` on that approved remote Mac. A named host never falls
@@ -258,7 +279,11 @@ async function runMacos(root, note = console.error, remote, buildMachineFlag) {
258
279
  if (backend === "auto") throw Object.assign(/* @__PURE__ */ new Error("stim macos --remote auto is not available yet: automatic placement has not shipped. Name a hosting Mac from remote.machines."), { code: "STIM_BAD_ARG" });
259
280
  if (process.platform !== "darwin") throw new Error("stim macos requires a Mac with Swift installed.");
260
281
  root = realpathSync(root);
261
- if (!existsSync(join(root, "Package.swift"))) throw new Error("Run stim macos from the directory containing Package.swift.");
282
+ const operation = projectRegistry.selectMacos(root);
283
+ if ("problem" in operation) throw Object.assign(new Error(operation.problem.message), {
284
+ code: "STIM_NO_PROJECT",
285
+ remedy: operation.problem.remedy
286
+ });
262
287
  const settings = resolveSettings({
263
288
  projectPath: root,
264
289
  gitCommonDir: gitCommonDir(root),
@@ -269,8 +294,7 @@ async function runMacos(root, note = console.error, remote, buildMachineFlag) {
269
294
  const selected = resolveBuildPlacement(buildMachineFlag);
270
295
  if (selected.failure) throw Object.assign(new Error(selected.failure.message), selected.failure);
271
296
  const buildMachine = selected.selected;
272
- const macos = settings.macos;
273
- 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" });
297
+ const macos = (await operation.load()).prepare(settings);
274
298
  ensureWorkspaceStorage(root);
275
299
  return withNativeBuildRun(root, {
276
300
  command: "macos",
@@ -286,7 +310,7 @@ async function runMacos(root, note = console.error, remote, buildMachineFlag) {
286
310
  return withWorkspaceProcessLock(workspaceDir(root), "macos-launch", async () => {
287
311
  const previous = requiredMacosRecord(root);
288
312
  if (previous?.host && previous.host.machine !== remote) throw new Error(`This workspace's macOS app runs on ${previous.host.machine}. Run stim stop first, then stim macos${remote ? ` --remote ${remote}` : ""}.`);
289
- if (remote && !validHostedAppArguments(macos.arguments ?? [])) throw new Error("macos.arguments is too large for a hosted app: at most 32 arguments of 1024 characters (8192 in total), without NUL or line breaks.");
313
+ if (remote && !validHostedAppArguments(macos.arguments)) throw new Error("macos.arguments is too large for a hosted app: at most 32 arguments of 1024 characters (8192 in total), without NUL or line breaks.");
290
314
  if (remote) (await connectHost(remote)).connection.close();
291
315
  if (!previous?.host) await stopMacosAppHeld(root);
292
316
  upsertProject(root, {});
@@ -298,7 +322,7 @@ async function runMacos(root, note = console.error, remote, buildMachineFlag) {
298
322
  bundleId: "",
299
323
  executable: join(bundle, "Contents", "MacOS", macos.product),
300
324
  launchId: randomUUID(),
301
- arguments: macos.arguments ?? [],
325
+ arguments: macos.arguments,
302
326
  supervisor: macosProcess(process.pid),
303
327
  build: {
304
328
  state: "running",
@@ -310,9 +334,20 @@ async function runMacos(root, note = console.error, remote, buildMachineFlag) {
310
334
  hostLaunched: previous.hostLaunched ?? false
311
335
  } : {}
312
336
  };
313
- const handoff = await buildBundle(root, macos.infoPlist, record, remote !== void 0, note, macos, progress);
337
+ const handoff = await buildBundle(root, macos, record, remote !== void 0, note, progress);
314
338
  progress.step("launch");
315
- if (!remote) return launchHere(root, record);
339
+ const launched = () => {
340
+ try {
341
+ recordBuildPhase(root, "macos", record.build.startedAt, "launch", progress.durations().launch ?? 0);
342
+ } catch (error) {
343
+ note(`The launch time could not be recorded in the build history: ${error?.message || error}`);
344
+ }
345
+ };
346
+ if (!remote) {
347
+ const here = await launchHere(root, record);
348
+ launched();
349
+ return here;
350
+ }
316
351
  const connection = await connectHost(remote);
317
352
  const write = (patch) => writeWorkspaceState(root, { macos: {
318
353
  ...record,
@@ -325,7 +360,7 @@ async function runMacos(root, note = console.error, remote, buildMachineFlag) {
325
360
  bundle: record.bundle,
326
361
  bundleId: record.bundleId,
327
362
  handoff,
328
- arguments: macos.arguments ?? [],
363
+ arguments: macos.arguments,
329
364
  recorded: previous?.host,
330
365
  reserved: (reserved) => {
331
366
  placement = reserved;
@@ -344,6 +379,7 @@ async function runMacos(root, note = console.error, remote, buildMachineFlag) {
344
379
  hostLaunched: run.launched
345
380
  };
346
381
  writeWorkspaceState(root, { macos: placed });
382
+ launched();
347
383
  return placed;
348
384
  } catch (error) {
349
385
  write({
@@ -364,30 +400,30 @@ async function runMacos(root, note = console.error, remote, buildMachineFlag) {
364
400
  }).finally(() => progress.clear());
365
401
  }, { write: note });
366
402
  }
367
- async function buildBundle(root, infoPlist, record, hosted, note, extras, progress = NO_BUILD_PROGRESS) {
403
+ async function buildBundle(root, recipe, record, hosted, note, progress = NO_BUILD_PROGRESS) {
368
404
  const started = Date.parse(record.build.startedAt);
369
405
  const scratch = join(macosDir(root), "build");
370
406
  writeWorkspaceState(root, { macos: record });
371
407
  const writer = tapBuildLog(createNdjsonWriter(macosLogFile(root), { maxBytes: LOG_ROTATE_BYTES }), progress);
372
408
  try {
373
- const { bundleId: base } = validateInfoPlist(root, record.product, infoPlist);
409
+ const base = recipe.bundleId;
374
410
  const bundleId = hosted ? base : `${base}.stim.${createHash("sha256").update(root).digest("hex").slice(0, 12)}`;
411
+ const displayName = workspaceAppName(root, record.product);
375
412
  const built = await buildMacosBundle({
376
413
  root,
377
- product: record.product,
378
- infoPlist,
414
+ recipe,
379
415
  bundle: record.bundle,
380
416
  bundleId,
417
+ displayName,
381
418
  scratch,
382
419
  writer,
383
420
  note,
384
421
  progress,
385
422
  record: record.build,
386
- buildMachine: record.build.buildMachine,
387
- resources: extras.resources,
388
- assetCatalog: extras.assetCatalog
423
+ buildMachine: record.build.buildMachine
389
424
  });
390
425
  record.bundleId = built.bundleId;
426
+ record.displayName = displayName;
391
427
  record.bundle = realpathSync(record.bundle);
392
428
  record.executable = realpathSync(join(record.bundle, "Contents", "MacOS", record.product));
393
429
  record.build = {
@@ -397,7 +433,7 @@ async function buildBundle(root, infoPlist, record, hosted, note, extras, progre
397
433
  durationMs: Date.now() - started
398
434
  };
399
435
  writeWorkspaceState(root, { macos: record });
400
- recordMacosBuild(root, record.build);
436
+ recordMacosBuild(root, record.build, progress.steps());
401
437
  return built.handoff;
402
438
  } catch (error) {
403
439
  const message = error instanceof Error ? error.message : String(error);
@@ -420,13 +456,13 @@ async function buildBundle(root, infoPlist, record, hosted, note, extras, progre
420
456
  supervisor: void 0,
421
457
  build
422
458
  } });
423
- recordMacosBuild(root, build);
459
+ recordMacosBuild(root, build, progress.steps());
424
460
  throw error;
425
461
  } finally {
426
462
  writer.close();
427
463
  }
428
464
  }
429
- function recordMacosBuild(root, build) {
465
+ function recordMacosBuild(root, build, compileSteps) {
430
466
  recordFinishedBuild(root, {
431
467
  platform: "macos",
432
468
  status: build.state === "ok" ? "ok" : "failed",
@@ -441,10 +477,12 @@ function recordMacosBuild(root, build) {
441
477
  buildMachine: build.buildMachine,
442
478
  builtOn: build.builtOn,
443
479
  offloadedTo: build.offloadedTo,
444
- offloadFallback: build.offloadFallback
480
+ offloadFallback: build.offloadFallback,
481
+ ...compileSteps === null ? {} : { compileSteps }
445
482
  });
446
483
  }
447
484
  async function launchHere(root, record) {
485
+ await stopBundleInstances(root);
448
486
  const fd = openSync(join(workspaceLogsDir$1(root), "macos-supervisor.log"), "a");
449
487
  let child;
450
488
  try {
@@ -485,19 +523,43 @@ function launchPayload(root, record) {
485
523
  platform: "macos",
486
524
  ...record
487
525
  };
488
- const { product, launchId, build, host } = record;
526
+ const { product, displayName, launchId, build, host } = record;
489
527
  return {
490
528
  agentDevice,
491
529
  platform: "macos",
492
530
  product,
531
+ displayName,
493
532
  launchId,
494
533
  build,
495
534
  host
496
535
  };
497
536
  }
498
537
  function macosCommand(program) {
499
- program.command("macos").description("Build and launch an owned Swift Package macOS Debug app.").option("--remote-build <value>", "Build on auto, local, or one named machine; a name refuses without fallback", parseBuildMachineOption).option("--json", "print one launch payload; build output goes to stderr").option("--remote <machine>", "run it on this approved remote Mac from remote.machines").action(async (options) => {
500
- const root = findProjectRoot$1(process.cwd());
538
+ program.command("macos").description("Build and launch an owned Swift Package macOS Debug app.").option("--remote-build <value>", "Build on auto, local, or one named machine; a name refuses without fallback", parseBuildMachineOption).option("--json", "print one launch or plan payload; build output goes to stderr").option("--plan", "validate the next SwiftPM Debug build without building or launching").option("--remote <machine>", "run it on this approved remote Mac from remote.machines").action(async (options) => {
539
+ const root = findProjectRoot(process.cwd());
540
+ if (options.plan) {
541
+ try {
542
+ if (!root) throw new Error("Run stim macos from the Swift Package directory.");
543
+ if (options.remote !== void 0) throw Object.assign(/* @__PURE__ */ new Error("--remote selects a launch host and does not apply to --plan."), { code: "STIM_BAD_ARG" });
544
+ const plan = planMacos(root, options.remoteBuild);
545
+ if (options.json) console.log(JSON.stringify(plan));
546
+ else {
547
+ console.log(phaseLine("plan", `macos ${plan.product}: SwiftPM Debug build, then stage and launch`));
548
+ console.log(phaseLine("build", `selection: ${plan.buildMachine}; worker availability is not checked`));
549
+ console.log(phaseLine("expect", "unknown: SwiftPM determines incremental work when the build runs"));
550
+ }
551
+ } catch (error) {
552
+ const failure = {
553
+ code: error.code ?? "STIM_BAD_ARG",
554
+ message: error instanceof Error ? error.message : String(error),
555
+ remedy: error.remedy ?? "Check the macOS project settings in stim guide macos."
556
+ };
557
+ console.error(failure.message);
558
+ if (options.json) console.log(JSON.stringify(failure));
559
+ process.exitCode = 1;
560
+ }
561
+ return;
562
+ }
501
563
  if (!root) throw new Error("Run stim macos from the Swift Package directory.");
502
564
  const record = await runMacos(root, console.error, options.remote, options.remoteBuild).catch((error) => {
503
565
  const remedy = error.remedy;
@@ -511,4 +573,4 @@ function macosCommand(program) {
511
573
  });
512
574
  }
513
575
  //#endregion
514
- export { macosCommand as default, runMacos };
576
+ export { runMacos as n, macosCommand as t };
@@ -0,0 +1,2 @@
1
+ import { n as runMacos, t as macosCommand } from "./macos-ciyBdTY5.mjs";
2
+ export { macosCommand as default, runMacos };
@@ -1,2 +1,2 @@
1
- import { n as runMacosSupervisor, t as logLines } from "./run-CkE9y0nc.mjs";
1
+ import { n as runMacosSupervisor, t as logLines } from "./run-lAkle1-c.mjs";
2
2
  export { logLines, runMacosSupervisor };