stim 1.20.2 → 1.22.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.
- package/README.md +141 -8
- package/dist/acquire-artifact-Co2k4f7O.mjs +171 -0
- package/dist/act-DsuqEkiM.mjs +2801 -0
- package/dist/activity-CMLmzp7o.mjs +1397 -0
- package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-DUFaTMdd.mjs} +23 -67
- package/dist/{android-DCKZrNvV.mjs → android-ByRMUoiJ.mjs} +157 -93
- package/dist/{android-Mz_Inn3w.mjs → android-C7sVmyI9.mjs} +299 -116
- package/dist/{android-Dlzxshgp.mjs → android-DGkNqa_c.mjs} +5 -5
- package/dist/{android-HqP1_vB_.mjs → android-DR5lZ2Az.mjs} +2 -2
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-ngferVq2.mjs} +7 -6
- package/dist/android-project-BCAAmMwz.mjs +12 -0
- package/dist/android-project-DVWyCbWU.d.mts +391 -0
- package/dist/api.d.mts +810 -64
- package/dist/api.mjs +782 -1
- package/dist/{artifact-HSwkIWEQ.mjs → artifact-8EY8SAPw.mjs} +240 -213
- package/dist/{artifact-D3czlUvT.mjs → artifact-DJPy518Y.mjs} +203 -164
- package/dist/artifact-platform-CXcmX_j3.mjs +27 -0
- package/dist/{browser-web-CA-F1GQo.mjs → browser-web-Bcv99PBM.mjs} +194 -64
- package/dist/budget-Cvwn54qV.mjs +9285 -0
- package/dist/{build-DYDbfkk5.mjs → build-CabC3G23.mjs} +153 -98
- package/dist/build-cache-Dv7RN200.mjs +602 -0
- package/dist/build-plan-DUC8Ka9y.mjs +248 -0
- package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DSeQjt-Q.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-zdKiYQ3E.mjs → ccache-Btwc36-I.mjs} +10 -9
- package/dist/{cdp-Dq_ypAlJ.mjs → cdp-3fwICjzi.mjs} +18 -5
- package/dist/{chrome-BnzZMqsR.mjs → chrome-Bbw689-6.mjs} +7 -4
- package/dist/{cli-CLP3diBm.mjs → cli-CHZa9Lvk.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/client-OyRoEuSr.mjs +1577 -0
- package/dist/collector-run.d.mts +4 -40
- package/dist/collector-run.mjs +9 -8
- package/dist/{command-output-BTy8hZ0F.mjs → command-output-gwpm28fu.mjs} +1 -1
- package/dist/config-DlrsduwG.mjs +955 -0
- package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-x9rN6bhs.mjs} +14 -4
- package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-1I9KZT1Y.mjs} +20 -5
- package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-BwNEtIrP.mjs} +1 -1
- package/dist/{dev-client-DAWVIGBu.mjs → dev-client-BSDR5h3F.mjs} +2 -2
- package/dist/{device-BECOiufl.mjs → device-B-L3Fbxy.mjs} +91 -34
- package/dist/device-DklWZLqb.mjs +1068 -0
- package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-DK5_EwRS.mjs} +42 -13
- package/dist/device-host-worker.mjs +76 -79
- package/dist/{device-ios-COSi6oS1.mjs → device-ios-DoB6KFCO.mjs} +77 -51
- package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-xJPQ_QQG.mjs} +14 -26
- package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-BMkdsefq.mjs} +5 -5
- package/dist/{doctor-kfMBnUw6.mjs → doctor-Bo7BXLux.mjs} +271 -320
- package/dist/{doctor-CB8oZKCk.mjs → doctor-D5_EzwfA.mjs} +186 -91
- package/dist/doctor-fingerprint-DZLoYFVb.mjs +16 -0
- package/dist/doctor-fingerprint.mjs +19 -0
- package/dist/doctor-thjWAV0z.mjs +2 -0
- package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-N2wDotwQ.mjs} +40 -21
- package/dist/{eas-build-JyfqyHfC.mjs → eas-build-CwknaQYj.mjs} +53 -20
- package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-CSgAulr5.mjs} +41 -214
- package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-DlY_serQ.mjs} +230 -11
- package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-DBWO2rxE.mjs} +172 -82
- package/dist/exec-DEoAhcze.mjs +858 -0
- package/dist/exec-DnYc4HGH.d.mts +78 -0
- package/dist/{gc-qWOMdnER.mjs → gc-CXxN-4SE.mjs} +1091 -1029
- package/dist/gc-DnNDQyaP.mjs +3 -0
- package/dist/{guide-G9cAbVAc.mjs → guide-Br0LEfKy.mjs} +1165 -297
- package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-B-9f-jkd.mjs} +10 -8
- package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DZAPrcro.mjs} +34 -19
- package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CsCS21hn.mjs} +1 -1
- package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-FIRx9X2f.mjs} +77 -43
- package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-_awYSpfv.mjs} +35 -22
- package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-BdzE668-.mjs} +49 -27
- package/dist/idle-C4cZ757K.d.mts +24 -0
- package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DDg3SdvY.mjs} +11 -10
- package/dist/ios-CDvlmUs7.d.mts +24 -0
- package/dist/{ios-BwVCF7oA.mjs → ios-Ds1clbIt.mjs} +8 -8
- package/dist/{ios-device-D7pi2Sca.mjs → ios-device--h_-8ENa.mjs} +51 -26
- package/dist/{ios-device-B5veSDDQ.mjs → ios-device-BXZ0c7Kb.mjs} +1 -1
- package/dist/{ios-RkW4pnQf.mjs → ios-hcBpnEGk.mjs} +200 -93
- package/dist/{ios-Ce7bc7br.mjs → ios-pm4nL6By.mjs} +160 -108
- package/dist/{ios-project-K9hY_Jab.mjs → ios-project-CZhKODF3.mjs} +13 -13
- package/dist/ios-signing-BtAffm0A.mjs +489 -0
- package/dist/{ios-state-CBLe1xYw.mjs → ios-state-Dtw5K2aI.mjs} +1 -1
- package/dist/{ios-nOLJGVdy.mjs → ios-xtlRHaeB.mjs} +1 -1
- package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Bwhh4S7V.mjs} +30 -25
- package/dist/{launch-C3qJ6Agb.mjs → launch-BjxemNpK.mjs} +85 -543
- package/dist/{launch-F4sOqAhB.mjs → launch-CCzXlc8r.mjs} +91 -90
- package/dist/logs-BfwwadsZ.mjs +479 -0
- package/dist/logs-jTS_lHSo.mjs +248 -0
- package/dist/{macos-D7uDvO-z.mjs → macos-DVlSSyUg.mjs} +1 -1
- package/dist/macos-NfV2D7dO.mjs +694 -0
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +123 -248
- package/dist/{metro-DnCEjCxs.mjs → metro-DiXtA3Ty.mjs} +107 -30
- package/dist/metro-gateway-CKZqKqx7.mjs +209 -0
- package/dist/{named-ports-4WopRPg-.mjs → named-ports-DkEzOfzO.mjs} +42 -90
- package/dist/native-android-CqgnOgsT.mjs +645 -0
- package/dist/native-gradle-artifact-inputs-DHFnmrVf.mjs +270 -0
- package/dist/native-gradle-inputs-Dnh84Zbd.mjs +211 -0
- package/dist/native-inputs-TRTTTRxt.mjs +91 -0
- package/dist/native-run-NwUuxbkg.mjs +276 -0
- package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-B7KIafpM.mjs} +11 -9
- package/dist/native-source-Y0yLhFyQ.mjs +133 -0
- package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-D_VOfFL7.mjs} +26 -18
- package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-BYDOHWLN.mjs} +104 -60
- package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
- package/dist/offload-worker.d.mts +59 -41
- package/dist/offload-worker.mjs +478 -115
- package/dist/operation-exec-BW0em61G.mjs +171 -0
- package/dist/{ownership-DCtw_2IA.mjs → ownership-C5fo5Edb.mjs} +3 -3
- package/dist/{page-DRHy329N.mjs → page-DBL2PiUU.mjs} +12 -5
- package/dist/paths-BsJMoPP2.mjs +12 -0
- package/dist/paths-DQtTgsBf.mjs +42 -0
- package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BnGgJRRZ.mjs} +5 -5
- package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-DIsMtN-d.mjs} +15 -11
- package/dist/{ports-DdSUicVo.mjs → ports-Cy1RkmuQ.mjs} +3 -3
- package/dist/prebuild-D4JoEAEs.mjs +484 -0
- package/dist/{project-_phNIJfs.mjs → project-wM_XFTvE.mjs} +65 -37
- package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-W1IuLXDt.mjs} +102 -20
- package/dist/pull-request-eODyIqZF.d.mts +124 -0
- package/dist/pull-requests.d.mts +2 -120
- package/dist/pull-requests.mjs +2 -2
- package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-6OZ7MSM7.mjs} +121 -72
- package/dist/{gradle-DSrXb6lG.mjs → react-native-build-Dvd8hC21.mjs} +292 -15
- package/dist/react-native-doctor-DsoSF1Y9.mjs +234 -0
- package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-4u1Rn-GR.mjs} +71 -39
- package/dist/{recordings-D0d5aQt0.mjs → recordings-CQmfzAh7.mjs} +12 -9
- package/dist/registration-BcRgF6Ox.mjs +51 -0
- package/dist/{reload-C8JhxjSh.mjs → reload-BzkYabB-.mjs} +94 -47
- package/dist/reload-D7AVlb8N.mjs +2 -0
- package/dist/{remote-BiR6aYjy.mjs → remote-DjGDmlTZ.mjs} +26 -18
- package/dist/result-D2Ykz_iD.mjs +435 -0
- package/dist/{run-BtPgpKks.mjs → run-DidHghD1.mjs} +5 -5
- package/dist/selection-DSMbWEX2.mjs +620 -0
- package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CafzuyFB.mjs} +3 -4
- package/dist/{server-command-CTtCkmcQ.mjs → server-command-C6QjeupS.mjs} +14 -7
- package/dist/{server-expo-DsguMGUF.mjs → server-expo-CrjB29pq.mjs} +54 -11
- package/dist/server-expo-D58c9L0M.mjs +2 -0
- package/dist/{settings-B717odTD.mjs → settings-C7O8A6ZI.mjs} +309 -119
- package/dist/settings-DpR-1Wnn.mjs +114 -0
- package/dist/settings-write-CzD60rOD.mjs +360 -0
- package/dist/settings.schema.json +176 -16
- package/dist/{simslim-CCr3rE-A.mjs → simslim-BNckWpXi.mjs} +14 -12
- package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-CbfmNgM6.mjs} +15 -20
- package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
- package/dist/stage-Bps5oius.mjs +200 -0
- package/dist/{start-TXeMmmO2.mjs → start-Br-oxqMD.mjs} +1 -1
- package/dist/start-EojN4WFz.mjs +1364 -0
- package/dist/{state-D1Icyjlu.mjs → state--smjFSTL.mjs} +55 -13
- package/dist/{state-CG_OFoaA.mjs → state-08I3hw3_.mjs} +3 -2
- package/dist/{stats-BoY5sEPU.mjs → stats-D3GerlFW.mjs} +7 -13
- package/dist/stats-report-BzaPrRm6.mjs +16 -0
- package/dist/{status-BTA7kKiQ.mjs → status-BRROykC8.mjs} +7 -5
- package/dist/status-EvrK72L2.mjs +2 -0
- package/dist/{status-WgFbkRzj.mjs → status-WBDajew2.mjs} +554 -452
- package/dist/{status-watch-C23ILtf9.mjs → status-watch-Bg_u-pwR.mjs} +222 -25
- package/dist/status-worker.d.mts +1 -0
- package/dist/status-worker.mjs +19 -0
- package/dist/stim-desktop-D5OGpYZM.mjs +112 -0
- package/dist/{stop-DR6VoDIk.mjs → stop-DTZ9uTw3.mjs} +2 -2
- package/dist/{stop-DPEhunlw.mjs → stop-Dky10AEJ.mjs} +33 -23
- package/dist/{stop-BNmBMi1F.mjs → stop-Mv6W9FAk.mjs} +137 -98
- package/dist/supervisor-run.d.mts +8 -17
- package/dist/supervisor-run.mjs +56 -28
- package/dist/{support-CwjbFs9H.mjs → support-CNioewsd.mjs} +14 -14
- package/dist/{support-DMTqj3Hm.mjs → support-yUiOjnVY.mjs} +20 -13
- package/dist/swiftpm-artifact-inputs-DFcGsXDP.mjs +153 -0
- package/dist/swiftpm-macos-BIak-Rxv.mjs +532 -0
- package/dist/toolchain-BY8X8HXx.mjs +2 -0
- package/dist/toolchain-DpJMHq0n.mjs +876 -0
- package/dist/{trigger-CigAYjeL.mjs → trigger-Cbyc41d_.mjs} +21 -6
- package/dist/trigger-yb_nFzPF.mjs +2 -0
- package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-CA3TgT3-.mjs} +263 -156
- package/dist/web-CZ07gd77.mjs +2 -0
- package/dist/{web-BDBMxDpx.mjs → web-DKx6yoFA.mjs} +20 -14
- package/dist/web-run.mjs +13 -12
- package/dist/windows-report.d.mts +1 -0
- package/dist/windows-report.mjs +18 -0
- package/dist/windows-report.ps1 +43 -0
- package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-U08dEzhG.mjs} +62 -58
- package/dist/{workspaces-C36s2jb9.mjs → workspaces-CpANmBlq.mjs} +1723 -1286
- package/dist/{worktree-CgvJYJ-Q.mjs → worktree-CHecZ4Oq.mjs} +1097 -547
- package/dist/worktree-ZqZVjD9K.mjs +2 -0
- package/dist/xcode-BXn9-xYx.mjs +896 -0
- package/package.json +7 -5
- package/shim/android-audio/Main.java +24 -0
- package/shim/android-audio/README.md +17 -0
- package/shim/android-audio.jar +0 -0
- package/shim/android-optimizations.gradle +7 -5
- package/dist/activity-BSV745Kz.mjs +0 -629
- package/dist/api-qvOzWyfO.mjs +0 -154
- package/dist/api-run.mjs +0 -294
- package/dist/app-install-BIKtMfPq.mjs +0 -896
- package/dist/artifact-lifecycle-DzPpBYvK.mjs +0 -30
- package/dist/budget-f7516Zk0.mjs +0 -4106
- package/dist/build-facts-DcLv2HSd.d.mts +0 -111
- package/dist/cancellation-C_22VQTH.mjs +0 -24
- package/dist/client-qQAaXSUs.mjs +0 -1771
- package/dist/config-BYDxlMY3.mjs +0 -562
- package/dist/device-DuiPJQSn.mjs +0 -290
- package/dist/device-lease-BX1sJQ2E.mjs +0 -1224
- package/dist/device-remote-xRT0Vmo9.mjs +0 -1272
- package/dist/eas-session-ledger-Cm0Gwq2F.mjs +0 -207
- package/dist/exec-DqKo9GKJ.mjs +0 -268
- package/dist/git-DDfFzkMm.mjs +0 -45
- package/dist/launch-verify-B6Q8hZP-.mjs +0 -428
- package/dist/logs-BGrEUaEs.mjs +0 -383
- package/dist/macos-Ch5VJmcS.mjs +0 -584
- package/dist/metro-gateway-CX9Xlkq2.mjs +0 -103
- package/dist/miss-reason-mKzZ4VvN.mjs +0 -238
- package/dist/native-android-D5qc3-_v.mjs +0 -226
- package/dist/native-gradle-inputs-BsLRrl7u.mjs +0 -349
- package/dist/ndjson-Du3j0AQ9.d.mts +0 -17
- package/dist/plan-C4TjdPsR.mjs +0 -260
- package/dist/prebuild-DYbucPXy.mjs +0 -212
- package/dist/preview-78a9kR_-.mjs +0 -1011
- package/dist/react-native-build-CtCccJtb.mjs +0 -239
- package/dist/react-native-doctor-CfRnFfjs.mjs +0 -78
- package/dist/remote-cache-OyOyVIS3.mjs +0 -526
- package/dist/result-CaJg5Iat.mjs +0 -186
- package/dist/server-expo-Bigriskl.mjs +0 -2
- package/dist/settings-BORNaaCO.mjs +0 -402
- package/dist/settings-vk3mJGSm.d.mts +0 -13
- package/dist/spawn-claims-DVS5RkMS.mjs +0 -72
- package/dist/stage-KNTQopqv.mjs +0 -157
- package/dist/start-BWqzODpb.mjs +0 -1116
- package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
- package/dist/swiftpm-macos-DRNVJWlb.mjs +0 -119
- package/dist/tailnet-Dh-qiYzG.mjs +0 -265
- package/dist/toolchain-BFkAcstd.mjs +0 -2
- package/dist/toolchain-DxSsNssu.mjs +0 -1657
- package/dist/trigger-9_USgmxz.mjs +0 -2
- package/dist/web-Dq-i3wzJ.mjs +0 -2
- package/dist/worktree-DpLdCHga.mjs +0 -2
- package/dist/{api-run.d.mts → doctor-fingerprint.d.mts} +0 -0
- package/dist/{errors-DzkMYh8Q.mjs → errors-ccaPc4ox.mjs} +2 -2
package/dist/macos-Ch5VJmcS.mjs
DELETED
|
@@ -1,584 +0,0 @@
|
|
|
1
|
-
import { E as upsertProject, k as process_identity_exports, u as getConcurrencyLimits } from "./config-BYDxlMY3.mjs";
|
|
2
|
-
import { t as getExecutor } from "./exec-DqKo9GKJ.mjs";
|
|
3
|
-
import { t as spawnEntry } from "./spawn-entry-Dcb7sDUz.mjs";
|
|
4
|
-
import { K as resolveProjectSettings, Q as settingShapeErrors, a as SETTING_SHAPE_REMEDY } from "./settings-B717odTD.mjs";
|
|
5
|
-
import { c as writeWorkspaceState, i as recordWorkspaceUse, p as ensureWorkspaceStorage, w as workspaceLogsDir$1, x as workspaceDir, y as workspaceAgentDeviceDir } from "./workspace-state-DJt_MMvf.mjs";
|
|
6
|
-
import { l as phaseLine } from "./command-output-BTy8hZ0F.mjs";
|
|
7
|
-
import { d as projectRegistry, o as ownedDeviceLabel, r as findProjectRoot } from "./project-_phNIJfs.mjs";
|
|
8
|
-
import { a as spawnDeclared } from "./spawn-claims-DVS5RkMS.mjs";
|
|
9
|
-
import { F as acquireBuildSlot, L as releaseBuildSlot } from "./workspaces-C36s2jb9.mjs";
|
|
10
|
-
import { Dt as recordFinishedBuild, Et as recordBuildPhase, Ot as startBuildProgress, kt as tapBuildLog, yt as NO_BUILD_PROGRESS } from "./budget-f7516Zk0.mjs";
|
|
11
|
-
import { a as withWorkspaceProcessLock } from "./named-ports-4WopRPg-.mjs";
|
|
12
|
-
import { S as withNativeBuildRun } from "./tailnet-Dh-qiYzG.mjs";
|
|
13
|
-
import { r as createNdjsonWriter } from "./ndjson-GOnbyvso.mjs";
|
|
14
|
-
import { _ as requireLocalBuild, c as offloadPlacement, f as setRemoteLogSink, g as parseBuildMachineOption, h as namedBuildMachine, i as closeOffload, l as placementLoad, n as buildPlacementCandidates, o as offloadBuild, p as OffloadRefusal, r as chooseBuildMachine, u as remotePhaseText, y as resolveBuildPlacement } from "./client-qQAaXSUs.mjs";
|
|
15
|
-
import { D as sanitizeDeviceLabel } from "./ios-RkW4pnQf.mjs";
|
|
16
|
-
import { i as macosProcess, n as macosDir, o as requiredMacosRecord, r as macosLogFile } from "./state-CG_OFoaA.mjs";
|
|
17
|
-
import { t as buildPlacementRecord } from "./placement-log-MOfPVgaM.mjs";
|
|
18
|
-
import { c as connectHost } from "./hosted-client-ZEKpS9vw.mjs";
|
|
19
|
-
import { t as placeHostedMacos } from "./hosted-macos-BACVAVqE.mjs";
|
|
20
|
-
import { i as validateInfoPlist, t as resolveBundleExtras } from "./stage-KNTQopqv.mjs";
|
|
21
|
-
import { r as stopMacosAppHeld, t as stopBundleInstances } from "./stop-DPEhunlw.mjs";
|
|
22
|
-
import { closeSync, existsSync, mkdirSync, mkdtempSync, openSync, realpathSync, renameSync, rmSync } from "node:fs";
|
|
23
|
-
import { join } from "node:path";
|
|
24
|
-
import { machineCapacity, readMacosRecord, validHostedAppArguments } from "@stim-cli/core/state";
|
|
25
|
-
import { LOG_ROTATE_BYTES } from "@stim-cli/core";
|
|
26
|
-
import { createHash, randomUUID } from "node:crypto";
|
|
27
|
-
//#region src/macos/build.ts
|
|
28
|
-
async function buildMacosBundle({ root, recipe, bundle, bundleId, displayName, scratch, writer, note, record, buildMachine, progress = NO_BUILD_PROGRESS }) {
|
|
29
|
-
if (record) record.buildMachine = buildMachine;
|
|
30
|
-
setRemoteLogSink((entry) => writer.write({
|
|
31
|
-
...entry,
|
|
32
|
-
platform: "macos"
|
|
33
|
-
}));
|
|
34
|
-
const write = (msg) => {
|
|
35
|
-
writer.write({
|
|
36
|
-
src: "build",
|
|
37
|
-
platform: "macos",
|
|
38
|
-
level: "info",
|
|
39
|
-
msg
|
|
40
|
-
});
|
|
41
|
-
note(msg);
|
|
42
|
-
};
|
|
43
|
-
let offloadFallback = null;
|
|
44
|
-
let asked = [];
|
|
45
|
-
let failedMachine;
|
|
46
|
-
const fallBack = (reason) => {
|
|
47
|
-
writer.write(buildPlacementRecord({
|
|
48
|
-
platform: "macos",
|
|
49
|
-
buildMachine,
|
|
50
|
-
candidates: asked,
|
|
51
|
-
event: "placement_fallback",
|
|
52
|
-
fallback: {
|
|
53
|
-
code: failedMachine ? "offload-failed" : "no-remote-mac-took-it",
|
|
54
|
-
reason,
|
|
55
|
-
machine: failedMachine
|
|
56
|
-
}
|
|
57
|
-
}));
|
|
58
|
-
if (namedBuildMachine(buildMachine)) throw new OffloadRefusal(buildMachine, reason);
|
|
59
|
-
requireLocalBuild(buildMachine);
|
|
60
|
-
offloadFallback = reason;
|
|
61
|
-
if (record) record.offloadFallback = reason;
|
|
62
|
-
writer.write({
|
|
63
|
-
src: "build",
|
|
64
|
-
platform: "macos",
|
|
65
|
-
level: "warn",
|
|
66
|
-
event: "offload_failed",
|
|
67
|
-
msg: reason
|
|
68
|
-
});
|
|
69
|
-
write(`${reason} -> building here`);
|
|
70
|
-
write(`placement: here (${reason})`);
|
|
71
|
-
};
|
|
72
|
-
mkdirSync(macosDir(root), { recursive: true });
|
|
73
|
-
const staging = mkdtempSync(join(macosDir(root), "staging-"));
|
|
74
|
-
const promote = (path) => {
|
|
75
|
-
const backup = join(staging, "previous.app");
|
|
76
|
-
const previous = existsSync(bundle);
|
|
77
|
-
if (previous) renameSync(bundle, backup);
|
|
78
|
-
try {
|
|
79
|
-
renameSync(path, bundle);
|
|
80
|
-
} catch (error) {
|
|
81
|
-
if (previous) renameSync(backup, bundle);
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
let choice = null;
|
|
86
|
-
try {
|
|
87
|
-
try {
|
|
88
|
-
const { mode, machines, localEnabled } = buildPlacementCandidates(buildMachine);
|
|
89
|
-
const here = machineCapacity();
|
|
90
|
-
const placement = offloadPlacement({
|
|
91
|
-
mode,
|
|
92
|
-
localEnabled,
|
|
93
|
-
machines: machines.length,
|
|
94
|
-
here,
|
|
95
|
-
unsupported: null,
|
|
96
|
-
selected: buildMachine
|
|
97
|
-
});
|
|
98
|
-
if (placement.offload) {
|
|
99
|
-
const chosen = await chooseBuildMachine({
|
|
100
|
-
projectRoot: root,
|
|
101
|
-
target: recipe.offload.target(),
|
|
102
|
-
mode,
|
|
103
|
-
here,
|
|
104
|
-
machines,
|
|
105
|
-
selected: buildMachine,
|
|
106
|
-
note: (line) => write(`offload: ${line}`),
|
|
107
|
-
onCandidates: (each) => asked = each
|
|
108
|
-
});
|
|
109
|
-
if (typeof chosen === "string") throw new Error(chosen);
|
|
110
|
-
choice = chosen;
|
|
111
|
-
failedMachine = chosen.machine;
|
|
112
|
-
writer.write(buildPlacementRecord({
|
|
113
|
-
platform: "macos",
|
|
114
|
-
buildMachine,
|
|
115
|
-
candidates: asked,
|
|
116
|
-
chose: {
|
|
117
|
-
machine: chosen.machine,
|
|
118
|
-
reason: `${placement.reason}${placementLoad(chosen)}`
|
|
119
|
-
}
|
|
120
|
-
}));
|
|
121
|
-
write(`placement: ${choice.machine} (${placement.reason}${placementLoad(choice)})`);
|
|
122
|
-
const outcome = await offloadBuild({
|
|
123
|
-
choice,
|
|
124
|
-
request: recipe.offload.request(bundleId),
|
|
125
|
-
stagingDir: join(staging, "offload"),
|
|
126
|
-
onPhase: (phase, line) => note(remotePhaseText(phase, line, choice.machine)),
|
|
127
|
-
onEnter: (phase) => {
|
|
128
|
-
if (record && [
|
|
129
|
-
"compile",
|
|
130
|
-
"build",
|
|
131
|
-
"prebuild",
|
|
132
|
-
"pods"
|
|
133
|
-
].includes(phase)) record.builtOn = choice.machine;
|
|
134
|
-
progress.place({
|
|
135
|
-
host: choice.machine,
|
|
136
|
-
phase
|
|
137
|
-
});
|
|
138
|
-
progress.step(phase === "fetch" ? "install" : "compile");
|
|
139
|
-
},
|
|
140
|
-
onRecord: (entry) => writer.write({
|
|
141
|
-
...entry,
|
|
142
|
-
offloadedTo: choice.machine
|
|
143
|
-
}),
|
|
144
|
-
note: write
|
|
145
|
-
});
|
|
146
|
-
progress.place(null);
|
|
147
|
-
if (!outcome.ok) throw new Error(`${outcome.machine}: ${outcome.reason}`);
|
|
148
|
-
progress.step("install");
|
|
149
|
-
recipe.validateFetched(outcome.artifactPath, bundleId, displayName);
|
|
150
|
-
promote(outcome.artifactPath);
|
|
151
|
-
if (record) {
|
|
152
|
-
record.offloadedTo = outcome.machine;
|
|
153
|
-
record.builtOn = outcome.machine;
|
|
154
|
-
}
|
|
155
|
-
return {
|
|
156
|
-
bundleId,
|
|
157
|
-
offloadedTo: outcome.machine,
|
|
158
|
-
offloadFallback: null,
|
|
159
|
-
handoff: outcome.handoff ?? null
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
writer.write(buildPlacementRecord({
|
|
163
|
-
platform: "macos",
|
|
164
|
-
buildMachine,
|
|
165
|
-
stays: {
|
|
166
|
-
code: placement.code,
|
|
167
|
-
reason: placement.reason
|
|
168
|
-
}
|
|
169
|
-
}));
|
|
170
|
-
write(`placement: here (${placement.reason})`);
|
|
171
|
-
} catch (error) {
|
|
172
|
-
fallBack(error instanceof Error ? error.message : String(error));
|
|
173
|
-
} finally {
|
|
174
|
-
if (choice) closeOffload(choice);
|
|
175
|
-
}
|
|
176
|
-
let slot;
|
|
177
|
-
try {
|
|
178
|
-
slot = await acquireBuildSlot({
|
|
179
|
-
automatic: buildMachine === "auto",
|
|
180
|
-
max: getConcurrencyLimits().maxBuilds,
|
|
181
|
-
root,
|
|
182
|
-
logFile: writer.file,
|
|
183
|
-
out: note,
|
|
184
|
-
waitingFor: (info) => progress.waitingFor(info, "build-slot")
|
|
185
|
-
});
|
|
186
|
-
requireLocalBuild(buildMachine);
|
|
187
|
-
if (record) record.builtOn = "here";
|
|
188
|
-
progress.step("compile");
|
|
189
|
-
const bin = await recipe.compile({
|
|
190
|
-
scratch,
|
|
191
|
-
writer,
|
|
192
|
-
note
|
|
193
|
-
});
|
|
194
|
-
progress.step("install");
|
|
195
|
-
const staged = join(staging, `${recipe.product}.app`);
|
|
196
|
-
recipe.stage(bin, staged, bundleId, displayName);
|
|
197
|
-
promote(staged);
|
|
198
|
-
return {
|
|
199
|
-
bundleId,
|
|
200
|
-
offloadedTo: null,
|
|
201
|
-
offloadFallback,
|
|
202
|
-
handoff: null
|
|
203
|
-
};
|
|
204
|
-
} finally {
|
|
205
|
-
releaseBuildSlot(slot);
|
|
206
|
-
}
|
|
207
|
-
} finally {
|
|
208
|
-
try {
|
|
209
|
-
rmSync(staging, {
|
|
210
|
-
recursive: true,
|
|
211
|
-
force: true
|
|
212
|
-
});
|
|
213
|
-
} catch {}
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
//#endregion
|
|
217
|
-
//#region src/macos/app-name.ts
|
|
218
|
-
const DOT = String.fromCodePoint(183);
|
|
219
|
-
const ELLIPSIS = String.fromCodePoint(8230);
|
|
220
|
-
const LABEL_MAX = 24;
|
|
221
|
-
const PRODUCT_MAX = 40;
|
|
222
|
-
function clip(text, max) {
|
|
223
|
-
const chars = [...text];
|
|
224
|
-
return chars.length <= max ? text : `${chars.slice(0, max - 1).join("")}${ELLIPSIS}`;
|
|
225
|
-
}
|
|
226
|
-
/** The visible app name for a run: `<product> <dot> <label>`, or just the product when the label is empty. */
|
|
227
|
-
function macosAppName(product, label) {
|
|
228
|
-
const name = clip(product.replace(/[\p{Cc}/:\\]+/gu, " ").trim(), PRODUCT_MAX) || "App";
|
|
229
|
-
const suffix = clip(sanitizeDeviceLabel(label), LABEL_MAX);
|
|
230
|
-
return suffix ? `${name} ${DOT} ${suffix}` : name;
|
|
231
|
-
}
|
|
232
|
-
function workspaceAppName(root, product) {
|
|
233
|
-
return macosAppName(product, ownedDeviceLabel(root));
|
|
234
|
-
}
|
|
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 { context, settings } = resolveProjectSettings(root);
|
|
242
|
-
const [shape] = settingShapeErrors(settings);
|
|
243
|
-
if (shape) throw new Error(`${shape} ${SETTING_SHAPE_REMEDY}`);
|
|
244
|
-
const selected = resolveBuildPlacement(buildMachineFlag);
|
|
245
|
-
if (selected.failure) throw Object.assign(new Error(selected.failure.message), selected.failure);
|
|
246
|
-
const macos = settings.macos;
|
|
247
|
-
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" });
|
|
248
|
-
validateInfoPlist(root, macos.product, macos.infoPlist);
|
|
249
|
-
resolveBundleExtras(root, context.repoRoot ?? root, macos.resources, macos.assetCatalog);
|
|
250
|
-
return {
|
|
251
|
-
platform: "macos",
|
|
252
|
-
product: macos.product,
|
|
253
|
-
buildMachine: selected.selected,
|
|
254
|
-
fingerprint: null,
|
|
255
|
-
cacheKey: null,
|
|
256
|
-
cacheHit: false,
|
|
257
|
-
provider: null,
|
|
258
|
-
cacheSkipped: false,
|
|
259
|
-
prebuild: null,
|
|
260
|
-
outcome: null,
|
|
261
|
-
expectedMs: null,
|
|
262
|
-
basis: 0
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
//#endregion
|
|
266
|
-
//#region src/commands/macos.ts
|
|
267
|
-
/**
|
|
268
|
-
* Builds the Debug app and launches it here, or with `remote` on that approved remote Mac. A named host never falls
|
|
269
|
-
* back to a local launch.
|
|
270
|
-
*/
|
|
271
|
-
async function runMacos(root, note = console.error, remote, buildMachineFlag) {
|
|
272
|
-
const backend = remote?.trim().toLowerCase();
|
|
273
|
-
if (backend === "eas" || backend === "proxy") throw Object.assign(/* @__PURE__ */ new Error("stim macos --remote takes a remote Mac name from remote.machines; macOS has no eas or proxy backend."), { code: "STIM_BAD_ARG" });
|
|
274
|
-
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" });
|
|
275
|
-
if (process.platform !== "darwin") throw new Error("stim macos requires a Mac with Swift installed.");
|
|
276
|
-
root = realpathSync(root);
|
|
277
|
-
const operation = projectRegistry.selectMacos(root);
|
|
278
|
-
if ("problem" in operation) throw Object.assign(new Error(operation.problem.message), {
|
|
279
|
-
code: "STIM_NO_PROJECT",
|
|
280
|
-
remedy: operation.problem.remedy
|
|
281
|
-
});
|
|
282
|
-
const { settings } = resolveProjectSettings(root);
|
|
283
|
-
const [shape] = settingShapeErrors(settings);
|
|
284
|
-
if (shape) throw new Error(`${shape} ${SETTING_SHAPE_REMEDY}`);
|
|
285
|
-
const selected = resolveBuildPlacement(buildMachineFlag);
|
|
286
|
-
if (selected.failure) throw Object.assign(new Error(selected.failure.message), selected.failure);
|
|
287
|
-
const buildMachine = selected.selected;
|
|
288
|
-
const macos = (await operation.load()).prepare(settings);
|
|
289
|
-
ensureWorkspaceStorage(root);
|
|
290
|
-
return withNativeBuildRun(root, {
|
|
291
|
-
command: "macos",
|
|
292
|
-
platform: "macos"
|
|
293
|
-
}, async (claim) => {
|
|
294
|
-
const progress = startBuildProgress({
|
|
295
|
-
root,
|
|
296
|
-
platform: "macos",
|
|
297
|
-
slot: "default",
|
|
298
|
-
claim,
|
|
299
|
-
note
|
|
300
|
-
});
|
|
301
|
-
return withWorkspaceProcessLock(workspaceDir(root), "macos-launch", async () => {
|
|
302
|
-
const previous = requiredMacosRecord(root);
|
|
303
|
-
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}` : ""}.`);
|
|
304
|
-
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.");
|
|
305
|
-
if (remote) (await connectHost(remote)).connection.close();
|
|
306
|
-
if (!previous?.host) await stopMacosAppHeld(root);
|
|
307
|
-
upsertProject(root, {});
|
|
308
|
-
recordWorkspaceUse(root);
|
|
309
|
-
const bundle = join(macosDir(root), `${macos.product}.app`);
|
|
310
|
-
const record = {
|
|
311
|
-
product: macos.product,
|
|
312
|
-
bundle,
|
|
313
|
-
bundleId: "",
|
|
314
|
-
executable: join(bundle, "Contents", "MacOS", macos.product),
|
|
315
|
-
launchId: randomUUID(),
|
|
316
|
-
arguments: macos.arguments,
|
|
317
|
-
supervisor: macosProcess(process.pid),
|
|
318
|
-
build: {
|
|
319
|
-
state: "running",
|
|
320
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
321
|
-
buildMachine
|
|
322
|
-
},
|
|
323
|
-
...previous?.host ? {
|
|
324
|
-
host: previous.host,
|
|
325
|
-
hostLaunched: previous.hostLaunched ?? false
|
|
326
|
-
} : {}
|
|
327
|
-
};
|
|
328
|
-
const handoff = await buildBundle(root, macos, record, remote !== void 0, note, progress);
|
|
329
|
-
progress.step("launch");
|
|
330
|
-
const launched = () => {
|
|
331
|
-
try {
|
|
332
|
-
recordBuildPhase(root, "macos", record.build.startedAt, "launch", progress.durations().launch ?? 0);
|
|
333
|
-
} catch (error) {
|
|
334
|
-
note(`The launch time could not be recorded in the build history: ${error?.message || error}`);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
if (!remote) {
|
|
338
|
-
const here = await launchHere(root, record, note);
|
|
339
|
-
launched();
|
|
340
|
-
return here;
|
|
341
|
-
}
|
|
342
|
-
const connection = await connectHost(remote);
|
|
343
|
-
const write = (patch) => writeWorkspaceState(root, { macos: {
|
|
344
|
-
...record,
|
|
345
|
-
...patch
|
|
346
|
-
} });
|
|
347
|
-
let placement = record.host;
|
|
348
|
-
try {
|
|
349
|
-
const run = await placeHostedMacos(connection, {
|
|
350
|
-
root,
|
|
351
|
-
bundle: record.bundle,
|
|
352
|
-
bundleId: record.bundleId,
|
|
353
|
-
handoff,
|
|
354
|
-
arguments: macos.arguments,
|
|
355
|
-
recorded: previous?.host,
|
|
356
|
-
reserved: (reserved) => {
|
|
357
|
-
placement = reserved;
|
|
358
|
-
write({
|
|
359
|
-
host: reserved,
|
|
360
|
-
hostLaunched: false
|
|
361
|
-
});
|
|
362
|
-
},
|
|
363
|
-
note
|
|
364
|
-
});
|
|
365
|
-
const placed = {
|
|
366
|
-
...record,
|
|
367
|
-
supervisor: void 0,
|
|
368
|
-
arguments: run.arguments,
|
|
369
|
-
host: run.placement,
|
|
370
|
-
hostLaunched: run.launched
|
|
371
|
-
};
|
|
372
|
-
writeWorkspaceState(root, { macos: placed });
|
|
373
|
-
launched();
|
|
374
|
-
return placed;
|
|
375
|
-
} catch (error) {
|
|
376
|
-
write({
|
|
377
|
-
supervisor: void 0,
|
|
378
|
-
...placement ? {
|
|
379
|
-
host: placement,
|
|
380
|
-
hostLaunched: false
|
|
381
|
-
} : {}
|
|
382
|
-
});
|
|
383
|
-
throw error;
|
|
384
|
-
} finally {
|
|
385
|
-
connection.connection.close();
|
|
386
|
-
}
|
|
387
|
-
}, {
|
|
388
|
-
external: true,
|
|
389
|
-
declareSpawns: true,
|
|
390
|
-
ownerPurpose: "build and launch macOS app"
|
|
391
|
-
}).finally(() => progress.clear());
|
|
392
|
-
}, { write: note });
|
|
393
|
-
}
|
|
394
|
-
async function buildBundle(root, recipe, record, hosted, note, progress = NO_BUILD_PROGRESS) {
|
|
395
|
-
const started = Date.parse(record.build.startedAt);
|
|
396
|
-
const scratch = join(macosDir(root), "build");
|
|
397
|
-
writeWorkspaceState(root, { macos: record });
|
|
398
|
-
const writer = tapBuildLog(createNdjsonWriter(macosLogFile(root), { maxBytes: LOG_ROTATE_BYTES }), progress);
|
|
399
|
-
try {
|
|
400
|
-
const base = recipe.bundleId;
|
|
401
|
-
const bundleId = hosted ? base : `${base}.stim.${createHash("sha256").update(root).digest("hex").slice(0, 12)}`;
|
|
402
|
-
const displayName = workspaceAppName(root, record.product);
|
|
403
|
-
const built = await buildMacosBundle({
|
|
404
|
-
root,
|
|
405
|
-
recipe,
|
|
406
|
-
bundle: record.bundle,
|
|
407
|
-
bundleId,
|
|
408
|
-
displayName,
|
|
409
|
-
scratch,
|
|
410
|
-
writer,
|
|
411
|
-
note,
|
|
412
|
-
progress,
|
|
413
|
-
record: record.build,
|
|
414
|
-
buildMachine: record.build.buildMachine
|
|
415
|
-
});
|
|
416
|
-
record.bundleId = built.bundleId;
|
|
417
|
-
record.displayName = displayName;
|
|
418
|
-
record.bundle = realpathSync(record.bundle);
|
|
419
|
-
record.executable = realpathSync(join(record.bundle, "Contents", "MacOS", record.product));
|
|
420
|
-
record.build = {
|
|
421
|
-
...record.build,
|
|
422
|
-
state: "ok",
|
|
423
|
-
finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
424
|
-
durationMs: Date.now() - started
|
|
425
|
-
};
|
|
426
|
-
writeWorkspaceState(root, { macos: record });
|
|
427
|
-
recordMacosBuild(root, record.build, progress.steps());
|
|
428
|
-
return built.handoff;
|
|
429
|
-
} catch (error) {
|
|
430
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
431
|
-
writer.write({
|
|
432
|
-
src: "build",
|
|
433
|
-
platform: "macos",
|
|
434
|
-
level: "error",
|
|
435
|
-
msg: message
|
|
436
|
-
});
|
|
437
|
-
const build = {
|
|
438
|
-
...record.build,
|
|
439
|
-
state: "failed",
|
|
440
|
-
finishedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
441
|
-
durationMs: Date.now() - started,
|
|
442
|
-
error: message,
|
|
443
|
-
..."code" in Object(error) && typeof error.code === "string" ? { errorCode: error.code } : {}
|
|
444
|
-
};
|
|
445
|
-
writeWorkspaceState(root, { macos: {
|
|
446
|
-
...record,
|
|
447
|
-
supervisor: void 0,
|
|
448
|
-
build
|
|
449
|
-
} });
|
|
450
|
-
recordMacosBuild(root, build, progress.steps());
|
|
451
|
-
throw error;
|
|
452
|
-
} finally {
|
|
453
|
-
writer.close();
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
function recordMacosBuild(root, build, compileSteps) {
|
|
457
|
-
recordFinishedBuild(root, {
|
|
458
|
-
platform: "macos",
|
|
459
|
-
status: build.state === "ok" ? "ok" : "failed",
|
|
460
|
-
configuration: "Debug",
|
|
461
|
-
fingerprint: null,
|
|
462
|
-
cacheKey: null,
|
|
463
|
-
cacheHit: false,
|
|
464
|
-
cacheSkipped: false,
|
|
465
|
-
durationMs: build.durationMs,
|
|
466
|
-
startedAt: build.startedAt,
|
|
467
|
-
errorCode: build.errorCode,
|
|
468
|
-
buildMachine: build.buildMachine,
|
|
469
|
-
builtOn: build.builtOn,
|
|
470
|
-
offloadedTo: build.offloadedTo,
|
|
471
|
-
offloadFallback: build.offloadFallback,
|
|
472
|
-
...compileSteps === null ? {} : { compileSteps }
|
|
473
|
-
});
|
|
474
|
-
}
|
|
475
|
-
const LAUNCH_SERVICES_CALL_MS = 2e3;
|
|
476
|
-
async function waitForLaunchServices(record, deadline) {
|
|
477
|
-
if (record.host || !record.app) return "skipped";
|
|
478
|
-
const args = [
|
|
479
|
-
"find",
|
|
480
|
-
`bundleid=${record.bundleId}`,
|
|
481
|
-
`pid=${record.app.pid}`
|
|
482
|
-
];
|
|
483
|
-
while (Date.now() < deadline) {
|
|
484
|
-
if ((await getExecutor().runFileAsync("lsappinfo", args, { timeoutMs: LAUNCH_SERVICES_CALL_MS }).catch(() => "")).includes("ASN:")) return "listed";
|
|
485
|
-
await new Promise((done) => setTimeout(done, 100));
|
|
486
|
-
}
|
|
487
|
-
return "timeout";
|
|
488
|
-
}
|
|
489
|
-
async function launchHere(root, record, note) {
|
|
490
|
-
await stopBundleInstances(root);
|
|
491
|
-
const fd = openSync(join(workspaceLogsDir$1(root), "macos-supervisor.log"), "a");
|
|
492
|
-
let child;
|
|
493
|
-
try {
|
|
494
|
-
child = spawnDeclared(() => getExecutor().spawn(process.execPath, [
|
|
495
|
-
spawnEntry("macos-run"),
|
|
496
|
-
root,
|
|
497
|
-
record.launchId
|
|
498
|
-
], {
|
|
499
|
-
cwd: root,
|
|
500
|
-
detached: true,
|
|
501
|
-
stdio: [
|
|
502
|
-
"ignore",
|
|
503
|
-
fd,
|
|
504
|
-
fd
|
|
505
|
-
],
|
|
506
|
-
env: {
|
|
507
|
-
...process.env,
|
|
508
|
-
STIM_BACKGROUND_LAUNCH: "1"
|
|
509
|
-
}
|
|
510
|
-
}));
|
|
511
|
-
child.unref();
|
|
512
|
-
} finally {
|
|
513
|
-
closeSync(fd);
|
|
514
|
-
}
|
|
515
|
-
const deadline = Date.now() + 2e4;
|
|
516
|
-
while (Date.now() < deadline) {
|
|
517
|
-
const current = readMacosRecord(root);
|
|
518
|
-
if (current?.launchId === record.launchId && current.app && current.supervisor && (0, process_identity_exports.inspectProcessIdentity)(current.app) === "same" && (0, process_identity_exports.inspectProcessIdentity)(current.supervisor) === "same") {
|
|
519
|
-
if (await waitForLaunchServices(current, deadline) === "timeout") note("macOS LaunchServices does not list the app yet. agent-device open may start a second copy; wait and check lsappinfo.");
|
|
520
|
-
return current;
|
|
521
|
-
}
|
|
522
|
-
if (child.exitCode !== null || child.signalCode !== null) break;
|
|
523
|
-
await new Promise((done) => setTimeout(done, 100));
|
|
524
|
-
}
|
|
525
|
-
throw new Error("The macOS app did not register. See macos-supervisor.log in the workspace logs.");
|
|
526
|
-
}
|
|
527
|
-
function launchPayload(root, record) {
|
|
528
|
-
const agentDevice = { stateDir: workspaceAgentDeviceDir(root) };
|
|
529
|
-
if (!record.host) return {
|
|
530
|
-
agentDevice,
|
|
531
|
-
platform: "macos",
|
|
532
|
-
...record
|
|
533
|
-
};
|
|
534
|
-
const { product, displayName, launchId, build, host } = record;
|
|
535
|
-
return {
|
|
536
|
-
agentDevice,
|
|
537
|
-
platform: "macos",
|
|
538
|
-
product,
|
|
539
|
-
displayName,
|
|
540
|
-
launchId,
|
|
541
|
-
build,
|
|
542
|
-
host
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
function macosCommand(program) {
|
|
546
|
-
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) => {
|
|
547
|
-
const root = findProjectRoot(process.cwd());
|
|
548
|
-
if (options.plan) {
|
|
549
|
-
try {
|
|
550
|
-
if (!root) throw new Error("Run stim macos from the Swift Package directory.");
|
|
551
|
-
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" });
|
|
552
|
-
const plan = planMacos(root, options.remoteBuild);
|
|
553
|
-
if (options.json) console.log(JSON.stringify(plan));
|
|
554
|
-
else {
|
|
555
|
-
console.log(phaseLine("plan", `macos ${plan.product}: SwiftPM Debug build, then stage and launch`));
|
|
556
|
-
console.log(phaseLine("build", `selection: ${plan.buildMachine}; worker availability is not checked`));
|
|
557
|
-
console.log(phaseLine("expect", "unknown: SwiftPM determines incremental work when the build runs"));
|
|
558
|
-
}
|
|
559
|
-
} catch (error) {
|
|
560
|
-
const failure = {
|
|
561
|
-
code: error.code ?? "STIM_BAD_ARG",
|
|
562
|
-
message: error instanceof Error ? error.message : String(error),
|
|
563
|
-
remedy: error.remedy ?? "Check the macOS project settings in stim guide macos."
|
|
564
|
-
};
|
|
565
|
-
console.error(failure.message);
|
|
566
|
-
if (options.json) console.log(JSON.stringify(failure));
|
|
567
|
-
process.exitCode = 1;
|
|
568
|
-
}
|
|
569
|
-
return;
|
|
570
|
-
}
|
|
571
|
-
if (!root) throw new Error("Run stim macos from the Swift Package directory.");
|
|
572
|
-
const record = await runMacos(root, console.error, options.remote, options.remoteBuild).catch((error) => {
|
|
573
|
-
const remedy = error.remedy;
|
|
574
|
-
if (typeof remedy === "string") console.error(`remedy: ${remedy}`);
|
|
575
|
-
throw error;
|
|
576
|
-
});
|
|
577
|
-
if (options.json) console.log(JSON.stringify(launchPayload(root, record)));
|
|
578
|
-
else if (record.host) console.log(`Started ${record.product} on ${record.host.machine} as ${record.host.bundleId}${record.hostLaunched === true ? "" : " (launch not confirmed)"}.`);
|
|
579
|
-
else console.log(`Started ${record.product} (pid ${record.app?.pid}).`);
|
|
580
|
-
if (!options.json) console.log(phaseLine("agent-device", `AGENT_DEVICE_STATE_DIR=${workspaceAgentDeviceDir(root)}`));
|
|
581
|
-
});
|
|
582
|
-
}
|
|
583
|
-
//#endregion
|
|
584
|
-
export { buildMacosBundle as i, runMacos as n, waitForLaunchServices as r, macosCommand as t };
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { k as process_identity_exports } from "./config-BYDxlMY3.mjs";
|
|
2
|
-
import { a as updateWorkspaceState, r as readWorkspaceState$1 } from "./workspace-state-DJt_MMvf.mjs";
|
|
3
|
-
import { l as realIo } from "./tailnet-Dh-qiYzG.mjs";
|
|
4
|
-
import { HOSTED_METRO_REQUESTS_KEY, findPeer, hostedMetroGateways, hostedMetroRequests, isJsonObject, parseMachine } from "@stim-cli/core/state";
|
|
5
|
-
import { randomBytes, randomUUID } from "node:crypto";
|
|
6
|
-
import { isIP } from "node:net";
|
|
7
|
-
//#region src/device-host/metro-gateway.ts
|
|
8
|
-
function gatewayAddresses(credential, status) {
|
|
9
|
-
const machine = parseMachine(credential.machine);
|
|
10
|
-
const peer = machine ? findPeer(status, machine.name) : "missing";
|
|
11
|
-
if (typeof peer === "string" || peer.nodeId !== credential.nodeId) throw new Error(`${credential.machine} no longer resolves to its pinned tailnet node. Run stim doctor.`);
|
|
12
|
-
const self = isJsonObject(status) && isJsonObject(status.Self) ? status.Self : null;
|
|
13
|
-
const address = (Array.isArray(self?.TailscaleIPs) ? self.TailscaleIPs : []).find((ip) => typeof ip === "string" && isIP(ip) === isIP(peer.address) && isIP(ip) !== 0);
|
|
14
|
-
if (!address) throw new Error("This Mac has no Tailscale address compatible with the hosting Mac.");
|
|
15
|
-
return {
|
|
16
|
-
address,
|
|
17
|
-
peer: peer.address
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function requireHostedMetro(root) {
|
|
21
|
-
const supervisor = readWorkspaceState$1(root)?.supervisor;
|
|
22
|
-
if (supervisor?.hostedMetro === true && (0, process_identity_exports.inspectProcessIdentity)(supervisor) === "same") return;
|
|
23
|
-
throw Object.assign(/* @__PURE__ */ new Error("Hosted Debug runs require a running Metro supervisor with private gateway support. Run stim stop; stim start, then retry."), {
|
|
24
|
-
code: "STIM_HOSTING_REFUSED",
|
|
25
|
-
remedy: "Run stim stop; stim start, then retry."
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
async function requestHostedMetro(root, session, credential) {
|
|
29
|
-
requireHostedMetro(root);
|
|
30
|
-
const addresses = gatewayAddresses(credential, realIo.status());
|
|
31
|
-
const previous = hostedMetroRequests(readWorkspaceState$1(root))[session];
|
|
32
|
-
const request = previous && previous.address === addresses.address && previous.peer === addresses.peer ? previous : {
|
|
33
|
-
id: randomUUID(),
|
|
34
|
-
machine: credential.machine,
|
|
35
|
-
...addresses,
|
|
36
|
-
secret: randomBytes(32).toString("hex")
|
|
37
|
-
};
|
|
38
|
-
updateWorkspaceState(root, (state) => ({
|
|
39
|
-
...state,
|
|
40
|
-
[HOSTED_METRO_REQUESTS_KEY]: {
|
|
41
|
-
...hostedMetroRequests(state),
|
|
42
|
-
[session]: request
|
|
43
|
-
}
|
|
44
|
-
}));
|
|
45
|
-
const deadline = Date.now() + 15e3;
|
|
46
|
-
while (Date.now() < deadline) {
|
|
47
|
-
const state = readWorkspaceState$1(root);
|
|
48
|
-
const gateway = hostedMetroGateways(state)[session];
|
|
49
|
-
if (gateway?.id === request.id && gateway.processToken === state?.supervisor?.processToken) {
|
|
50
|
-
if (gateway.error) throw new Error(gateway.error);
|
|
51
|
-
if (gateway.port) return {
|
|
52
|
-
gatewayPort: gateway.port,
|
|
53
|
-
secret: request.secret
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
await new Promise((done) => setTimeout(done, 100));
|
|
57
|
-
}
|
|
58
|
-
throw new Error(`The Metro supervisor did not open a private gateway for ${credential.machine}. Run stim stop; stim start, then retry.`);
|
|
59
|
-
}
|
|
60
|
-
function clearHostedMetro(root, session) {
|
|
61
|
-
updateWorkspaceState(root, (state) => {
|
|
62
|
-
const requests = { ...hostedMetroRequests(state) };
|
|
63
|
-
delete requests[session];
|
|
64
|
-
return {
|
|
65
|
-
...state,
|
|
66
|
-
[HOSTED_METRO_REQUESTS_KEY]: requests
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
async function closeHostedMetro(root, session) {
|
|
71
|
-
clearHostedMetro(root, session);
|
|
72
|
-
const deadline = Date.now() + 5e3;
|
|
73
|
-
while (true) {
|
|
74
|
-
const state = readWorkspaceState$1(root);
|
|
75
|
-
const gateway = hostedMetroGateways(state)[session];
|
|
76
|
-
const supervisor = state?.supervisor;
|
|
77
|
-
if (!gateway?.port || !supervisor || gateway.processToken !== supervisor.processToken) return;
|
|
78
|
-
if ((0, process_identity_exports.inspectProcessIdentity)(supervisor) === "gone") return;
|
|
79
|
-
if (Date.now() >= deadline) throw new Error("The Metro supervisor did not close its private gateway. Restart Metro, then retry stim stop.");
|
|
80
|
-
await new Promise((done) => setTimeout(done, 100));
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
function hostedMetroSettings(settings, hosted) {
|
|
84
|
-
return hosted ? {
|
|
85
|
-
...settings,
|
|
86
|
-
ios: {
|
|
87
|
-
...isJsonObject(settings.ios) ? settings.ios : {},
|
|
88
|
-
remote: void 0
|
|
89
|
-
},
|
|
90
|
-
android: {
|
|
91
|
-
...isJsonObject(settings.android) ? settings.android : {},
|
|
92
|
-
remote: void 0
|
|
93
|
-
},
|
|
94
|
-
metro: {
|
|
95
|
-
...isJsonObject(settings.metro) ? settings.metro : {},
|
|
96
|
-
tunnel: void 0,
|
|
97
|
-
publicUrl: void 0,
|
|
98
|
-
ngrokUrl: void 0
|
|
99
|
-
}
|
|
100
|
-
} : settings;
|
|
101
|
-
}
|
|
102
|
-
//#endregion
|
|
103
|
-
export { requireHostedMetro as a, requestHostedMetro as i, closeHostedMetro as n, hostedMetroSettings as r, clearHostedMetro as t };
|