stim 1.20.2 → 1.21.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 +88 -8
- package/dist/acquire-artifact-CD4lbiWE.mjs +153 -0
- package/dist/act-DHAw2A2S.mjs +2667 -0
- package/dist/activity-BzVfHSrY.mjs +1376 -0
- package/dist/{agent-device-usage-output-Dzgv6lgR.mjs → agent-device-usage-output-zh1vhbLp.mjs} +21 -65
- package/dist/{android-HqP1_vB_.mjs → android-BEJ8Jpl7.mjs} +2 -2
- package/dist/{android-DCKZrNvV.mjs → android-BLgbNqox.mjs} +128 -78
- package/dist/{android-Dlzxshgp.mjs → android-CV_GCELZ.mjs} +5 -5
- package/dist/{android-Mz_Inn3w.mjs → android-DUYkNF4u.mjs} +184 -102
- package/dist/{android-cas-Bl-cLJBk.mjs → android-cas-Ct5b1xCK.mjs} +7 -6
- package/dist/android-cas-compiler.mjs +2 -2
- package/dist/android-project-BCAAmMwz.mjs +12 -0
- package/dist/api.d.mts +740 -8
- package/dist/api.mjs +585 -1
- package/dist/{artifact-HSwkIWEQ.mjs → artifact-B8T3S5gi.mjs} +223 -201
- package/dist/{artifact-D3czlUvT.mjs → artifact-DAuZ-FNU.mjs} +158 -148
- package/dist/{browser-web-CA-F1GQo.mjs → browser-web-QQzVjz3O.mjs} +26 -24
- package/dist/budget-Bs6SxxzO.mjs +9154 -0
- package/dist/{build-DYDbfkk5.mjs → build-CoPzQRNw.mjs} +144 -96
- package/dist/build-cache-DmyR9Zzc.mjs +602 -0
- package/dist/build-plan-CaFskB7_.mjs +188 -0
- package/dist/{cache-manifest-XH-fvDUj.mjs → cache-manifest-DkkqguoK.mjs} +2 -2
- package/dist/cache-manifest.mjs +1 -1
- package/dist/{ccache-zdKiYQ3E.mjs → ccache-BJRZ9pG3.mjs} +10 -9
- package/dist/{cdp-Dq_ypAlJ.mjs → cdp-CWmIUMbw.mjs} +18 -5
- package/dist/{chrome-BnzZMqsR.mjs → chrome-B6tfCta1.mjs} +7 -4
- package/dist/{cli-CLP3diBm.mjs → cli-0DYf8QhQ.mjs} +20 -20
- package/dist/cli.mjs +1 -1
- package/dist/client-B7QVOlCr.d.mts +253 -0
- package/dist/client-UXD70ZbM.mjs +1406 -0
- package/dist/collector-run.d.mts +4 -40
- package/dist/collector-run.mjs +9 -8
- package/dist/{command-output-BTy8hZ0F.mjs → command-output-B1UrjZHL.mjs} +1 -1
- package/dist/config-CYcBF478.mjs +949 -0
- package/dist/{created-devices-Dzd5C2LF.mjs → created-devices-CqeBlrEn.mjs} +3 -3
- package/dist/{dependency-state-DG0p31-y.mjs → dependency-state-BbKQW83h.mjs} +20 -5
- package/dist/{detached-entry-B9C_zeQC.mjs → detached-entry-DFRyG1_o.mjs} +1 -1
- package/dist/{dev-client-DAWVIGBu.mjs → dev-client-UOeESKm6.mjs} +2 -2
- package/dist/device-DCxH7_By.mjs +1068 -0
- package/dist/{device-BECOiufl.mjs → device-ExJq8Ei7.mjs} +35 -35
- package/dist/{device-capacity-CBUAcRyQ.mjs → device-capacity-CMlqEcvw.mjs} +43 -13
- package/dist/device-host-worker.mjs +65 -61
- package/dist/{device-ios-COSi6oS1.mjs → device-ios-DRUeKaFV.mjs} +48 -45
- package/dist/{device-lease-run-Cw2M4z51.mjs → device-lease-run-C8raGFoP.mjs} +14 -26
- package/dist/{device-pool-Bf-pOhSw.mjs → device-pool-DMRpVX9a.mjs} +5 -5
- package/dist/doctor-BLHCYxzi.mjs +2 -0
- package/dist/{doctor-kfMBnUw6.mjs → doctor-DTvaDOda.mjs} +281 -317
- package/dist/{doctor-CB8oZKCk.mjs → doctor-Dhqebm0q.mjs} +183 -91
- package/dist/doctor-fingerprint.mjs +19 -0
- package/dist/{doctor-watchman-BRyV2adA.mjs → doctor-watchman-Cv1F10Kj.mjs} +40 -21
- package/dist/{eas-build-JyfqyHfC.mjs → eas-build-BomfRnFT.mjs} +53 -20
- package/dist/{build-plan-B7SZsc2N.mjs → eas-fallback-DJwZpy0c.mjs} +26 -208
- package/dist/{watchman-CPQFZLXY.mjs → eas-session-ledger-op6A54yi.mjs} +229 -11
- package/dist/{error-diagnostics-BR677IDM.mjs → error-diagnostics-Bf0rZvG9.mjs} +172 -82
- package/dist/exec-H20xSg2T.d.mts +65 -0
- package/dist/exec-_UbtCQcG.mjs +750 -0
- package/dist/gc-C-WwL0yi.mjs +3 -0
- package/dist/{gc-qWOMdnER.mjs → gc-_-dCXdyL.mjs} +584 -796
- package/dist/git-C3iTsJaZ.mjs +73 -0
- package/dist/{guide-G9cAbVAc.mjs → guide-Yqwt2bd6.mjs} +941 -269
- package/dist/{hosted-android-C3MHGld1.mjs → hosted-android-Bw-honsd.mjs} +8 -6
- package/dist/{hosted-client-ZEKpS9vw.mjs → hosted-client-DB_gBPfY.mjs} +34 -19
- package/dist/{hosted-ios-l-o3iM9J.mjs → hosted-ios-CUvOf4Vr.mjs} +1 -1
- package/dist/{hosted-logs-EzQM7-3Z.mjs → hosted-logs-DL_P5AdN.mjs} +77 -43
- package/dist/{hosted-macos-BACVAVqE.mjs → hosted-macos-QI141yKk.mjs} +21 -17
- package/dist/{hosted-native-A4s1QPXe.mjs → hosted-native-Ksyjgzq-.mjs} +30 -21
- package/dist/idle-BVeRGroT.d.mts +24 -0
- package/dist/{idle-shutdown-DtxhPTKe.mjs → idle-shutdown-DaKmZi0z.mjs} +11 -10
- package/dist/{ios-BwVCF7oA.mjs → ios-CQ68hG9s.mjs} +8 -8
- package/dist/{ios-RkW4pnQf.mjs → ios-CpByZy12.mjs} +140 -80
- package/dist/{ios-device-B5veSDDQ.mjs → ios-device-CXGP1bsD.mjs} +1 -1
- package/dist/{ios-device-D7pi2Sca.mjs → ios-device-CwFMehUS.mjs} +51 -26
- package/dist/{ios-project-K9hY_Jab.mjs → ios-project-WuwwBdvW.mjs} +13 -13
- package/dist/{ios-nOLJGVdy.mjs → ios-qNJt4dFm.mjs} +1 -1
- package/dist/ios-signing-DTTIChGs.mjs +489 -0
- package/dist/{ios-state-CBLe1xYw.mjs → ios-state-DvFX-K_l.mjs} +1 -1
- package/dist/{ios-Ce7bc7br.mjs → ios-ubFsBzwq.mjs} +129 -86
- package/dist/{js-swap-Bb3nsS07.mjs → js-swap-Cc1dttps.mjs} +53 -26
- package/dist/{launch-F4sOqAhB.mjs → launch-CD1yVc7U.mjs} +91 -90
- package/dist/{launch-C3qJ6Agb.mjs → launch-Zq2mOSDy.mjs} +82 -541
- package/dist/logs-BS00Anxf.mjs +352 -0
- package/dist/logs-CMm05HxN.mjs +255 -0
- package/dist/{macos-D7uDvO-z.mjs → macos-B65--pPd.mjs} +1 -1
- package/dist/{macos-Ch5VJmcS.mjs → macos-C-0qJ6zq.mjs} +225 -212
- package/dist/macos-run.mjs +1 -1
- package/dist/maintenance-run.mjs +122 -247
- package/dist/{metro-DnCEjCxs.mjs → metro-DEXpIhHC.mjs} +67 -12
- package/dist/{metro-gateway-CX9Xlkq2.mjs → metro-gateway-BMJNlj3E.mjs} +20 -12
- package/dist/{named-ports-4WopRPg-.mjs → named-ports-BWTzt6mu.mjs} +8 -63
- package/dist/native-android-JACyjTZs.mjs +844 -0
- package/dist/{native-gradle-inputs-BsLRrl7u.mjs → native-gradle-inputs-Bep9JcSF.mjs} +128 -140
- package/dist/native-inputs-TRTTTRxt.mjs +91 -0
- package/dist/native-run-DY_RLx3C.mjs +277 -0
- package/dist/{native-runtime-k8dTIrbK.mjs → native-runtime-Dg1Q7tfF.mjs} +9 -8
- package/dist/{native-xcode-inputs-CykopJdM.mjs → native-xcode-inputs-CB2iQeWq.mjs} +27 -18
- package/dist/{native-xcode-ios-Bbf30Gm0.mjs → native-xcode-ios-CXX39F7o.mjs} +96 -47
- package/dist/{ndjson-GOnbyvso.mjs → ndjson-CgE_o3Dl.mjs} +3 -3
- package/dist/offload-worker.d.mts +1 -46
- package/dist/offload-worker.mjs +197 -66
- package/dist/{ownership-DCtw_2IA.mjs → ownership-DEmM5vhh.mjs} +3 -3
- package/dist/{page-DRHy329N.mjs → page-CPaHeYqj.mjs} +7 -4
- package/dist/paths-BsJMoPP2.mjs +12 -0
- package/dist/paths-DQtTgsBf.mjs +42 -0
- package/dist/{placement-log-MOfPVgaM.mjs → placement-log-BqGbTa61.mjs} +5 -5
- package/dist/{plan-placement-V0TdzYXp.mjs → plan-placement-Bwj-IjY1.mjs} +6 -6
- package/dist/{ports-DdSUicVo.mjs → ports-D-MmCTdv.mjs} +3 -3
- package/dist/prebuild-uD_ipCxF.mjs +449 -0
- package/dist/{project-_phNIJfs.mjs → project-BZNjmW_8.mjs} +65 -37
- package/dist/{pull-request-CQ8sPbZa.mjs → pull-request-Lfetn8Kr.mjs} +2 -2
- package/dist/pull-request-zjCSAryH.d.mts +120 -0
- package/dist/pull-requests.d.mts +1 -119
- package/dist/pull-requests.mjs +1 -1
- package/dist/{react-native-android-CM1XRDwv.mjs → react-native-android-DuzH0cn3.mjs} +74 -48
- package/dist/{gradle-DSrXb6lG.mjs → react-native-build-rhk4smwQ.mjs} +292 -15
- package/dist/react-native-doctor-CQpuIMso.mjs +234 -0
- package/dist/{react-native-ios-Dhq_eiYQ.mjs → react-native-ios-Bhq1rJeV.mjs} +46 -28
- package/dist/{recordings-D0d5aQt0.mjs → recordings-DYteQSu4.mjs} +12 -9
- package/dist/{reload-C8JhxjSh.mjs → reload-CmTRFJaX.mjs} +93 -47
- package/dist/reload-DzjSl5P_.mjs +2 -0
- package/dist/{remote-BiR6aYjy.mjs → remote-ByYkXdGD.mjs} +15 -10
- package/dist/result-DNiS-tTP.mjs +434 -0
- package/dist/{run-BtPgpKks.mjs → run-D23HmJMs.mjs} +4 -5
- package/dist/selection-CSl9i5qU.mjs +619 -0
- package/dist/{server-bare-R2m_gsH8.mjs → server-bare-CxTrvDg8.mjs} +3 -4
- package/dist/{server-command-CTtCkmcQ.mjs → server-command-CtzloH3v.mjs} +14 -7
- package/dist/server-expo-C-90EhcG.mjs +2 -0
- package/dist/{server-expo-DsguMGUF.mjs → server-expo-DT_F_uVI.mjs} +50 -9
- package/dist/{settings-B717odTD.mjs → settings-CsJDEXgK.mjs} +234 -24
- package/dist/{settings-vk3mJGSm.d.mts → settings-DkdmlelE.d.mts} +6 -4
- package/dist/settings-T1gtc3bf.mjs +114 -0
- package/dist/settings-write-HyVZ8eQ8.mjs +359 -0
- package/dist/settings.schema.json +163 -16
- package/dist/{simslim-CCr3rE-A.mjs → simslim-Cgk17SXV.mjs} +14 -12
- package/dist/{slot-launch-DPt0m9Nd.mjs → slot-launch-DF8VfT64.mjs} +15 -20
- package/dist/{spawn-entry-Dcb7sDUz.mjs → spawn-entry-jw19m8Nl.mjs} +0 -1
- package/dist/stage-BIS0ydsV.mjs +183 -0
- package/dist/{start-BWqzODpb.mjs → start-7lpH7hmN.mjs} +63 -44
- package/dist/{start-TXeMmmO2.mjs → start-RChynRDp.mjs} +1 -1
- package/dist/{state-D1Icyjlu.mjs → state-C4ZtUisW.mjs} +40 -13
- package/dist/{state-CG_OFoaA.mjs → state-XMziexv2.mjs} +3 -2
- package/dist/{stats-BoY5sEPU.mjs → stats-53T7OTb9.mjs} +7 -13
- package/dist/stats-report-BFfMpWWF.mjs +16 -0
- package/dist/{status-WgFbkRzj.mjs → status-BL7jVyAB.mjs} +535 -447
- package/dist/status-CSi6tlRq.mjs +2 -0
- package/dist/{status-BTA7kKiQ.mjs → status-DqEUSSxs.mjs} +6 -4
- package/dist/{status-watch-C23ILtf9.mjs → status-watch-GDCfqpTE.mjs} +187 -22
- package/dist/status-worker.d.mts +1 -0
- package/dist/status-worker.mjs +19 -0
- package/dist/stim-desktop-C12we7lz.mjs +112 -0
- package/dist/{stop-DR6VoDIk.mjs → stop-Bk_1qiV6.mjs} +2 -2
- package/dist/{stop-BNmBMi1F.mjs → stop-CPzlM1L-.mjs} +138 -98
- package/dist/{stop-DPEhunlw.mjs → stop-D7h6jAXQ.mjs} +11 -10
- package/dist/supervisor-run.d.mts +8 -17
- package/dist/supervisor-run.mjs +63 -27
- package/dist/{support-DMTqj3Hm.mjs → support-67vraa1Q.mjs} +18 -11
- package/dist/{support-CwjbFs9H.mjs → support-Dlu37g6H.mjs} +12 -12
- package/dist/{swiftpm-macos-DRNVJWlb.mjs → swiftpm-macos-p8WZbxKU.mjs} +35 -24
- package/dist/toolchain-DhKwp9iI.mjs +2 -0
- package/dist/toolchain-Hp9sCpK4.mjs +873 -0
- package/dist/{trigger-CigAYjeL.mjs → trigger-BAahxUPq.mjs} +20 -5
- package/dist/trigger-Bf3uDcpv.mjs +2 -0
- package/dist/{warm-progress-BuY-Fvfn.mjs → warm-progress-BHX5r0Ei.mjs} +250 -156
- package/dist/{web-BDBMxDpx.mjs → web-CJmIj6AI.mjs} +18 -13
- package/dist/web-DknQETPs.mjs +2 -0
- package/dist/web-run.mjs +11 -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-process-lock-1_1OoVW5.mjs +57 -0
- package/dist/{workspace-state-DJt_MMvf.mjs → workspace-state-Cjuigeeu.mjs} +62 -58
- package/dist/{workspaces-C36s2jb9.mjs → workspaces-BccMFmGQ.mjs} +1188 -1079
- package/dist/worktree-CK2MpJW5.mjs +2 -0
- package/dist/{worktree-CgvJYJ-Q.mjs → worktree-DQ6Zi2Mv.mjs} +304 -53
- package/dist/xcode-Zlx3qjEs.mjs +896 -0
- package/package.json +7 -5
- 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/miss-reason-mKzZ4VvN.mjs +0 -238
- package/dist/native-android-D5qc3-_v.mjs +0 -226
- 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/spawn-claims-DVS5RkMS.mjs +0 -72
- package/dist/stage-KNTQopqv.mjs +0 -157
- package/dist/stim-desktop-BzBN2Em2.mjs +0 -63
- 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/device-DuiPJQSn.mjs
DELETED
|
@@ -1,290 +0,0 @@
|
|
|
1
|
-
import { B as deviceSlotKey, U as parseDeviceSlotOption, W as projectDeviceSlots, p as getProject } from "./config-BYDxlMY3.mjs";
|
|
2
|
-
import { n as fileLeaseIo, o as parseLeaseDuration, p as takeLease, u as releaseWorkspaceLeases } from "./device-lease-BX1sJQ2E.mjs";
|
|
3
|
-
import { r as clockTime } from "./command-output-BTy8hZ0F.mjs";
|
|
4
|
-
import { r as findProjectRoot, t as NO_PROJECT_REFUSAL } from "./project-_phNIJfs.mjs";
|
|
5
|
-
import { E as getAvdNameForSerial, G as probeEmulatorSerial, N as memoizeEmulatorProbe, O as listAdbDevices, U as physicalDeviceModel, Y as resolvePhysicalDevice, c as androidPoolNoCandidatesRefusal, s as androidPoolCandidates } from "./android-Mz_Inn3w.mjs";
|
|
6
|
-
import { l as parseDeviceWait, p as waitForDevice } from "./device-lease-run-Cw2M4z51.mjs";
|
|
7
|
-
import { t as selectFromPool } from "./device-pool-Bf-pOhSw.mjs";
|
|
8
|
-
import { a as iosPoolCandidates, c as isWirelessIosDevice, f as resolveIosPhysicalDevice, l as listIosDevices, o as iosPoolNoCandidatesRefusal } from "./ios-device-D7pi2Sca.mjs";
|
|
9
|
-
import chalk from "chalk";
|
|
10
|
-
//#region src/commands/device.ts
|
|
11
|
-
const DEFAULT_FOR = "5m";
|
|
12
|
-
const DEFAULT_DEPS = {
|
|
13
|
-
findProjectRoot,
|
|
14
|
-
getProject,
|
|
15
|
-
avdNameOf: getAvdNameForSerial,
|
|
16
|
-
listIosDevices,
|
|
17
|
-
listAdbDevices,
|
|
18
|
-
physicalDeviceModel,
|
|
19
|
-
probeEmulatorSerial,
|
|
20
|
-
takeLease,
|
|
21
|
-
releaseLeases: releaseWorkspaceLeases,
|
|
22
|
-
waitForDevice,
|
|
23
|
-
selectFromPool,
|
|
24
|
-
io: fileLeaseIo,
|
|
25
|
-
now: () => Date.now(),
|
|
26
|
-
sleep: (ms) => new Promise((r) => setTimeout(r, ms)),
|
|
27
|
-
out: (line) => console.log(line),
|
|
28
|
-
note: (line) => console.error(line)
|
|
29
|
-
};
|
|
30
|
-
function grantLine(facts, durationText) {
|
|
31
|
-
return `locked ${facts.deviceName ? `${facts.deviceName} (${facts.id})` : facts.id} for ${facts.holder} until ${clockTime(facts.expiresAt)} (${durationText}). Renew: stim device lock ${facts.platform}${facts.slot ? ` --slot ${facts.slot}` : ""} --for ${durationText}. Release: stim device unlock${facts.slot ? ` --slot ${facts.slot}` : ""}.`;
|
|
32
|
-
}
|
|
33
|
-
function releasedLine(lease) {
|
|
34
|
-
return `unlocked ${lease.deviceName ? `${lease.deviceName} (${lease.id})` : lease.id} -- the ${lease.platform} lease ran until ${clockTime(lease.expiresAt)}.`;
|
|
35
|
-
}
|
|
36
|
-
function readPlatform(value) {
|
|
37
|
-
return value === "ios" || value === "android" ? value : null;
|
|
38
|
-
}
|
|
39
|
-
function resolveDevice(platform, requested, d) {
|
|
40
|
-
if (platform === "ios") {
|
|
41
|
-
const resolved = resolveIosPhysicalDevice(requested, d.listIosDevices());
|
|
42
|
-
if (!resolved.udid) return {
|
|
43
|
-
code: "STIM_NO_DEVICE",
|
|
44
|
-
message: resolved.error,
|
|
45
|
-
remedy: resolved.remedy ?? null
|
|
46
|
-
};
|
|
47
|
-
return {
|
|
48
|
-
id: resolved.udid,
|
|
49
|
-
deviceName: resolved.name ?? resolved.udid
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
const resolved = resolvePhysicalDevice(requested, d.listAdbDevices(), d.probeEmulatorSerial);
|
|
53
|
-
if (!resolved.serial) return {
|
|
54
|
-
code: "STIM_NO_DEVICE",
|
|
55
|
-
message: resolved.error,
|
|
56
|
-
remedy: resolved.remedy ?? null
|
|
57
|
-
};
|
|
58
|
-
return {
|
|
59
|
-
id: resolved.serial,
|
|
60
|
-
deviceName: d.physicalDeviceModel(resolved.serial) ?? resolved.serial
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
function findOwnedVirtualDevice(project, platform, id, avdNameOf) {
|
|
64
|
-
let running;
|
|
65
|
-
for (const { slot, platforms } of projectDeviceSlots(project)) {
|
|
66
|
-
if (platform === "ios") {
|
|
67
|
-
const sim = platforms.ios;
|
|
68
|
-
if (sim?.owned && sim.deviceUdid && sim.deviceUdid.toLowerCase() === id.toLowerCase()) return {
|
|
69
|
-
id: sim.deviceUdid,
|
|
70
|
-
deviceName: sim.deviceName ?? null,
|
|
71
|
-
slot
|
|
72
|
-
};
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
const emulator = platforms.android;
|
|
76
|
-
if (!emulator?.owned || !emulator.avdName || !/^emulator-\d+$/.test(id)) continue;
|
|
77
|
-
running ??= { name: avdNameOf(id) };
|
|
78
|
-
if (running.name === emulator.avdName) return {
|
|
79
|
-
id,
|
|
80
|
-
deviceName: emulator.deviceName ?? emulator.avdName,
|
|
81
|
-
slot
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
function isFailure(value) {
|
|
87
|
-
return "code" in value;
|
|
88
|
-
}
|
|
89
|
-
async function poolDevice(platform, idLabel, waitSeconds, deadline, root, d, slot) {
|
|
90
|
-
const isEmulator = memoizeEmulatorProbe(d.probeEmulatorSerial);
|
|
91
|
-
const pooled = await d.selectFromPool({
|
|
92
|
-
...slot ? { slot } : {},
|
|
93
|
-
root,
|
|
94
|
-
platform,
|
|
95
|
-
idLabel,
|
|
96
|
-
list: () => platform === "ios" ? iosPoolCandidates(d.listIosDevices()).map((entry) => ({
|
|
97
|
-
id: entry.udid,
|
|
98
|
-
name: entry.name,
|
|
99
|
-
fallback: isWirelessIosDevice(entry)
|
|
100
|
-
})) : androidPoolCandidates(d.listAdbDevices(), isEmulator).map((entry) => ({ id: entry.serial })),
|
|
101
|
-
noCandidates: () => {
|
|
102
|
-
const resolved = platform === "ios" ? iosPoolNoCandidatesRefusal(d.listIosDevices()) : androidPoolNoCandidatesRefusal(d.listAdbDevices(), isEmulator);
|
|
103
|
-
return {
|
|
104
|
-
message: resolved.error,
|
|
105
|
-
remedy: resolved.remedy
|
|
106
|
-
};
|
|
107
|
-
},
|
|
108
|
-
waitSeconds,
|
|
109
|
-
deadline,
|
|
110
|
-
now: d.now,
|
|
111
|
-
sleep: d.sleep,
|
|
112
|
-
warn: (line) => d.note(chalk.yellow(line)),
|
|
113
|
-
io: d.io
|
|
114
|
-
});
|
|
115
|
-
if (pooled.status === "refused") return {
|
|
116
|
-
code: pooled.refusal.code,
|
|
117
|
-
message: pooled.refusal.message,
|
|
118
|
-
remedy: pooled.refusal.remedy,
|
|
119
|
-
...pooled.refusal.lease === null ? {} : { lease: pooled.refusal.lease }
|
|
120
|
-
};
|
|
121
|
-
const name = pooled.candidate.name ?? (platform === "ios" ? pooled.candidate.id : d.physicalDeviceModel(pooled.candidate.id));
|
|
122
|
-
return {
|
|
123
|
-
id: pooled.candidate.id,
|
|
124
|
-
deviceName: name ?? pooled.candidate.id
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
async function runLock(platformArg, idArg, opts = {}, overrides = {}) {
|
|
128
|
-
const d = {
|
|
129
|
-
...DEFAULT_DEPS,
|
|
130
|
-
...overrides
|
|
131
|
-
};
|
|
132
|
-
const json = Boolean(opts.json);
|
|
133
|
-
const report = (failure) => {
|
|
134
|
-
d.note(chalk.red(`${failure.code}: ${failure.message}`));
|
|
135
|
-
if (failure.remedy) d.note(chalk.dim(failure.remedy));
|
|
136
|
-
if (json) d.out(JSON.stringify({
|
|
137
|
-
code: failure.code,
|
|
138
|
-
message: failure.message,
|
|
139
|
-
remedy: failure.remedy,
|
|
140
|
-
...failure.lease === void 0 ? {} : { lease: failure.lease }
|
|
141
|
-
}));
|
|
142
|
-
return failure;
|
|
143
|
-
};
|
|
144
|
-
const platform = readPlatform(platformArg);
|
|
145
|
-
if (!platform) return report({
|
|
146
|
-
code: "STIM_BAD_ARG",
|
|
147
|
-
message: `\`stim device lock\` takes ios or android, not ${JSON.stringify(platformArg)}.`,
|
|
148
|
-
remedy: "Run `stim device lock ios` or `stim device lock android`."
|
|
149
|
-
});
|
|
150
|
-
const root = d.findProjectRoot(process.cwd());
|
|
151
|
-
if (!root) return report(NO_PROJECT_REFUSAL);
|
|
152
|
-
const durationText = String(opts.for ?? DEFAULT_FOR).trim();
|
|
153
|
-
const duration = parseLeaseDuration(durationText);
|
|
154
|
-
if ("error" in duration) return report({
|
|
155
|
-
code: "STIM_BAD_ARG",
|
|
156
|
-
message: duration.error,
|
|
157
|
-
remedy: "Pass a whole number of seconds or minutes from 10s to 30m, e.g. --for 90s or --for 10m."
|
|
158
|
-
});
|
|
159
|
-
const wait = parseDeviceWait(opts.wait);
|
|
160
|
-
if ("error" in wait) return report({
|
|
161
|
-
code: "STIM_BAD_ARG",
|
|
162
|
-
message: wait.error,
|
|
163
|
-
remedy: "Pass a whole number of seconds, e.g. --wait 90. `--wait 0` refuses a leased device at once."
|
|
164
|
-
});
|
|
165
|
-
const idLabel = platform === "ios" ? "udid" : "serial";
|
|
166
|
-
const deadline = d.now() + wait.seconds * 1e3;
|
|
167
|
-
const lastLine = { at: null };
|
|
168
|
-
const owned = idArg ? findOwnedVirtualDevice(d.getProject(root), platform, idArg, d.avdNameOf) : null;
|
|
169
|
-
if (owned && opts.slot && opts.slot !== owned.slot) return report({
|
|
170
|
-
code: "STIM_BAD_ARG",
|
|
171
|
-
message: `${owned.id} is this workspace's ${platform} device in slot ${owned.slot}, not ${opts.slot}.`,
|
|
172
|
-
remedy: `Run \`stim device lock ${platform} ${owned.id}\` without --slot, or with --slot ${owned.slot}.`
|
|
173
|
-
});
|
|
174
|
-
const held = owned ? d.io.readHolder(root)[deviceSlotKey(platform, owned.slot)] : void 0;
|
|
175
|
-
if (owned && held && held.id !== owned.id) return report({
|
|
176
|
-
code: "STIM_DEVICE_BUSY",
|
|
177
|
-
message: `This workspace already leases ${held.id} for ${platform} in slot ${owned.slot}, and a workspace holds one lease per platform and slot.`,
|
|
178
|
-
remedy: `Release it with \`stim device unlock ${platform}${owned.slot === "default" ? "" : ` --slot ${owned.slot}`}\` once nothing depends on it, then lock ${owned.id}.`
|
|
179
|
-
});
|
|
180
|
-
const slot = owned ? owned.slot === "default" ? void 0 : owned.slot : opts.slot;
|
|
181
|
-
const device = owned ? owned : idArg ? resolveDevice(platform, idArg, d) : await poolDevice(platform, idLabel, wait.seconds, deadline, root, d, opts.slot);
|
|
182
|
-
if (isFailure(device)) return report(device);
|
|
183
|
-
for (;;) {
|
|
184
|
-
const outcome = await d.waitForDevice({
|
|
185
|
-
...slot ? { slot } : {},
|
|
186
|
-
root,
|
|
187
|
-
platform,
|
|
188
|
-
id: device.id,
|
|
189
|
-
idLabel,
|
|
190
|
-
waitSeconds: wait.seconds,
|
|
191
|
-
now: d.now,
|
|
192
|
-
sleep: d.sleep,
|
|
193
|
-
warn: (line) => d.note(chalk.yellow(line)),
|
|
194
|
-
io: d.io,
|
|
195
|
-
deadline,
|
|
196
|
-
lastLine
|
|
197
|
-
});
|
|
198
|
-
if (outcome.status === "refused") return report({
|
|
199
|
-
...outcome.refusal,
|
|
200
|
-
lease: outcome.refusal.lease
|
|
201
|
-
});
|
|
202
|
-
const taken = d.takeLease({
|
|
203
|
-
...slot ? { slot } : {},
|
|
204
|
-
root,
|
|
205
|
-
platform,
|
|
206
|
-
id: device.id,
|
|
207
|
-
deviceName: device.deviceName,
|
|
208
|
-
kind: "declared",
|
|
209
|
-
durationMs: duration.ms
|
|
210
|
-
}, d.io);
|
|
211
|
-
if (taken.status === "unreadable") return report({
|
|
212
|
-
code: "STIM_DEVICE_BUSY",
|
|
213
|
-
message: `The lease file at ${taken.path} does not parse, so Stim cannot tell who holds that device.`,
|
|
214
|
-
remedy: `Read ${taken.path} and, once you know no run depends on it, delete it. \`stim gc\` reports it on every run.`,
|
|
215
|
-
lease: {
|
|
216
|
-
platform: null,
|
|
217
|
-
id: null,
|
|
218
|
-
deviceName: null,
|
|
219
|
-
holder: null,
|
|
220
|
-
expiresAt: null
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
if (taken.status === "held") continue;
|
|
224
|
-
const facts = {
|
|
225
|
-
...taken.lease.slot ? { slot: taken.lease.slot } : {},
|
|
226
|
-
platform,
|
|
227
|
-
id: taken.lease.id,
|
|
228
|
-
deviceName: taken.lease.deviceName,
|
|
229
|
-
holder: taken.lease.holder,
|
|
230
|
-
kind: "declared",
|
|
231
|
-
grantedAt: taken.lease.grantedAt,
|
|
232
|
-
expiresAt: taken.lease.expiresAt,
|
|
233
|
-
leaseSeconds: Math.round(duration.ms / 1e3)
|
|
234
|
-
};
|
|
235
|
-
if (json) d.out(JSON.stringify(facts));
|
|
236
|
-
else d.out(chalk.green(grantLine(facts, durationText)));
|
|
237
|
-
return facts;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
async function runUnlock(platformArg, opts = {}, overrides = {}) {
|
|
241
|
-
const d = {
|
|
242
|
-
...DEFAULT_DEPS,
|
|
243
|
-
...overrides
|
|
244
|
-
};
|
|
245
|
-
const json = Boolean(opts.json);
|
|
246
|
-
const report = (failure) => {
|
|
247
|
-
d.note(chalk.red(`${failure.code}: ${failure.message}`));
|
|
248
|
-
if (failure.remedy) d.note(chalk.dim(failure.remedy));
|
|
249
|
-
if (json) d.out(JSON.stringify({
|
|
250
|
-
code: failure.code,
|
|
251
|
-
message: failure.message,
|
|
252
|
-
remedy: failure.remedy
|
|
253
|
-
}));
|
|
254
|
-
return failure;
|
|
255
|
-
};
|
|
256
|
-
const platform = platformArg === void 0 ? null : readPlatform(platformArg);
|
|
257
|
-
if (platformArg !== void 0 && !platform) return report({
|
|
258
|
-
code: "STIM_BAD_ARG",
|
|
259
|
-
message: `\`stim device unlock\` takes ios or android, not ${JSON.stringify(platformArg)}.`,
|
|
260
|
-
remedy: "Run `stim device unlock` for every lease this workspace holds, or name one platform."
|
|
261
|
-
});
|
|
262
|
-
const root = d.findProjectRoot(process.cwd());
|
|
263
|
-
if (!root) return report(NO_PROJECT_REFUSAL);
|
|
264
|
-
const released = d.releaseLeases(root, {
|
|
265
|
-
platform,
|
|
266
|
-
...opts.slot ? { slot: opts.slot } : {}
|
|
267
|
-
}, d.io);
|
|
268
|
-
if (released.length === 0) d.note(chalk.dim(`No ${platform ? `${platform} ` : ""}device lease to release for ${root}. \`stim status\` lists every lease on this machine.`));
|
|
269
|
-
if (json) d.out(JSON.stringify(released.map((lease) => ({
|
|
270
|
-
...lease,
|
|
271
|
-
holder: root
|
|
272
|
-
}))));
|
|
273
|
-
else for (const lease of released) d.out(chalk.green(releasedLine(lease)));
|
|
274
|
-
return released;
|
|
275
|
-
}
|
|
276
|
-
function registerDevice(program, deps = {}) {
|
|
277
|
-
const device = program.command("device").description("Lease a connected physical device to this workspace, and give it back");
|
|
278
|
-
device.command("lock").argument("<platform>", "ios or android").argument("[id]", "the UDID or serial to lease, a connected device or this workspace's own simulator or emulator; without one, the first free connected device is used").description("Lease a connected physical device, or this workspace's own simulator or emulator, to this workspace for a declared time, so another workspace's `--device` run waits and agents see the device as driven. Nothing but this command and a `--device` run moves the expiry.").option("--for <duration>", `How long to hold it: a whole number of seconds or minutes from 10s to 30m (default ${DEFAULT_FOR})`).option("--wait <seconds>", "How long to wait for a device another workspace holds, before refusing with STIM_DEVICE_BUSY (default 60, 0 refuses at once)").option("--slot <name>", "Use this workspace device slot", parseDeviceSlotOption).option("--json", "print the lease as JSON on stdout").action(async (platform, id, opts) => {
|
|
279
|
-
if ("code" in await runLock(platform, id, opts, deps)) process.exit(1);
|
|
280
|
-
});
|
|
281
|
-
device.command("unlock").argument("[platform]", "ios or android; without one, every lease this workspace holds is released").description("Release the device lease or leases this workspace holds. Releasing nothing is not an error.").option("--slot <name>", "Use this workspace device slot", parseDeviceSlotOption).option("--json", "print the released leases as JSON on stdout").action(async (platform, opts) => {
|
|
282
|
-
const result = await runUnlock(platform, opts, deps);
|
|
283
|
-
if (!Array.isArray(result)) process.exit(1);
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
function deviceCommand(program) {
|
|
287
|
-
registerDevice(program);
|
|
288
|
-
}
|
|
289
|
-
//#endregion
|
|
290
|
-
export { deviceCommand as default, grantLine, registerDevice, releasedLine, runLock, runUnlock };
|