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/logs-BGrEUaEs.mjs
DELETED
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
import { U as parseDeviceSlotOption, W as projectDeviceSlots, _ as loadConfig$1, g as isPathPrefix, k as process_identity_exports } from "./config-BYDxlMY3.mjs";
|
|
2
|
-
import { r as readWorkspaceState$1, w as workspaceLogsDir$1 } from "./workspace-state-DJt_MMvf.mjs";
|
|
3
|
-
import { f as refuseNoProject, l as phaseLine, v as launchErrorPreview } from "./command-output-BTy8hZ0F.mjs";
|
|
4
|
-
import { n as findCommandWorkspace } from "./project-_phNIJfs.mjs";
|
|
5
|
-
import { n as SOURCES, t as LEVELS } from "./ndjson-GOnbyvso.mjs";
|
|
6
|
-
import { n as agentDeviceLiveness, u as readAgentDeviceRecords } from "./activity-BSV745Kz.mjs";
|
|
7
|
-
import { c as connectHost } from "./hosted-client-ZEKpS9vw.mjs";
|
|
8
|
-
import { n as pullHostedNativeLogs, t as pullHostedMacosLogs } from "./hosted-logs-EzQM7-3Z.mjs";
|
|
9
|
-
import { n as readHostedIos, t as readHostedAndroid } from "./ios-state-CBLe1xYw.mjs";
|
|
10
|
-
import { i as captureWorkspaceCrashes, t as errorDiagnostics } from "./error-diagnostics-BR677IDM.mjs";
|
|
11
|
-
import "./hosted-macos-BACVAVqE.mjs";
|
|
12
|
-
import { t as watchStdoutReader } from "./stdout-reader-C8yjre1x.mjs";
|
|
13
|
-
import { realpathSync } from "node:fs";
|
|
14
|
-
import { dirname, join, relative, resolve, sep } from "node:path";
|
|
15
|
-
import { agentDeviceStateDirs, buildCriteria, compileGrep, createAgentActionReader, fileSizes, followLogs, logFiles, parseSince, queryJsonLogs, queryLogs, readLogRecords, readMacosRecord, recordMatches, sortByTs } from "@stim-cli/core/state";
|
|
16
|
-
import { homedir } from "node:os";
|
|
17
|
-
import chalk from "chalk";
|
|
18
|
-
//#region src/devices/agent-actions.ts
|
|
19
|
-
function workspaceAgentTargets(project, macos) {
|
|
20
|
-
const targets = [];
|
|
21
|
-
if (macos?.app && macos.bundleId) targets.push({
|
|
22
|
-
platform: "macos",
|
|
23
|
-
id: macos.launchId,
|
|
24
|
-
slot: "default",
|
|
25
|
-
bundleId: macos.bundleId,
|
|
26
|
-
launchedAt: macos.app.startedAtMicros / 1e3
|
|
27
|
-
});
|
|
28
|
-
let slots;
|
|
29
|
-
try {
|
|
30
|
-
slots = projectDeviceSlots(project);
|
|
31
|
-
} catch {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
for (const { slot, platforms } of slots) {
|
|
35
|
-
const { ios, android } = platforms;
|
|
36
|
-
if (ios?.owned && typeof ios.deviceUdid === "string") targets.push({
|
|
37
|
-
platform: "ios",
|
|
38
|
-
id: ios.deviceUdid,
|
|
39
|
-
slot
|
|
40
|
-
});
|
|
41
|
-
if (android?.owned && typeof android.consolePort === "number" && typeof android.avdName === "string") targets.push({
|
|
42
|
-
platform: "android",
|
|
43
|
-
id: `emulator-${android.consolePort}`,
|
|
44
|
-
slot,
|
|
45
|
-
name: android.avdName
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
return targets;
|
|
49
|
-
}
|
|
50
|
-
function canonicalDir(path) {
|
|
51
|
-
try {
|
|
52
|
-
return realpathSync(path);
|
|
53
|
-
} catch {
|
|
54
|
-
return resolve(path);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function createAgentActionReader$1({ targets, sinceTs, home = homedir(), now, startOf = process_identity_exports.inspectProcessStart }) {
|
|
58
|
-
let claimed;
|
|
59
|
-
const read = createAgentActionReader({
|
|
60
|
-
sessionsDirs: () => agentDeviceStateDirs(home).map((root) => join(root, "sessions")),
|
|
61
|
-
targets,
|
|
62
|
-
sinceTs,
|
|
63
|
-
now,
|
|
64
|
-
claimedDevice: (session, sessionsDir) => {
|
|
65
|
-
const byId = claimed ? /* @__PURE__ */ new Map() : new Map((typeof targets === "function" ? targets() : targets).map((target) => [target.id, target]));
|
|
66
|
-
claimed ??= new Map(readAgentDeviceRecords(home).filter((record) => record.kind === "claim" && record.session && record.deviceId).filter((record) => {
|
|
67
|
-
const target = byId.get(record.deviceId);
|
|
68
|
-
return target?.platform !== "macos" && (target?.name === void 0 || target.name === record.deviceName);
|
|
69
|
-
}).filter((record) => agentDeviceLiveness(record, startOf) === "live").map((record) => [`${record.stateDir ? canonicalDir(record.stateDir) : ""}\0${record.session}`, record.deviceId]));
|
|
70
|
-
return claimed.get(`${canonicalDir(dirname(sessionsDir))}\0${session}`) ?? claimed.get(`\0${session}`) ?? null;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
return () => {
|
|
74
|
-
claimed = void 0;
|
|
75
|
-
return read();
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
79
|
-
//#region src/device-host/hosted-logs-sync.ts
|
|
80
|
-
function warning(machine, error) {
|
|
81
|
-
const message = error.message.replace(/\.$/, "");
|
|
82
|
-
const hint = message.includes("refused device-host.logs.query") ? ` If ${machine} runs an older stim-server, update it.` : "";
|
|
83
|
-
return phaseLine("device", `Could not read the app's logs from ${machine}: ${message}. Showing the logs already copied here.${hint}`);
|
|
84
|
-
}
|
|
85
|
-
async function syncHostedMacosLogs(root, placement, slot, warnings, platform = "ios") {
|
|
86
|
-
let host;
|
|
87
|
-
try {
|
|
88
|
-
host = await connectHost(placement.machine);
|
|
89
|
-
if (slot !== void 0) await pullHostedNativeLogs(root, slot, placement, host, false, platform);
|
|
90
|
-
else await pullHostedMacosLogs(root, placement, host);
|
|
91
|
-
return true;
|
|
92
|
-
} catch (error) {
|
|
93
|
-
if (!warnings?.has(placement.machine)) {
|
|
94
|
-
process.stderr.write(`${warning(placement.machine, error)}\n`);
|
|
95
|
-
warnings?.add(placement.machine);
|
|
96
|
-
}
|
|
97
|
-
return false;
|
|
98
|
-
} finally {
|
|
99
|
-
host?.connection.close();
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
function followHostedMacosLogs(root, { failing = false, intervalMs = 500, retryMs = 5e3, slot, platform = "ios" } = {}) {
|
|
103
|
-
let host;
|
|
104
|
-
let retryAt = 0;
|
|
105
|
-
let stopped = false;
|
|
106
|
-
let running = false;
|
|
107
|
-
const tick = async () => {
|
|
108
|
-
if (running || stopped || Date.now() < retryAt) return;
|
|
109
|
-
running = true;
|
|
110
|
-
try {
|
|
111
|
-
const placement = slot !== void 0 ? (platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))[slot] : readMacosRecord(root)?.host;
|
|
112
|
-
if (!placement) {
|
|
113
|
-
host?.connection.close();
|
|
114
|
-
host = void 0;
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
host ??= await connectHost(placement.machine);
|
|
118
|
-
if (slot !== void 0) await pullHostedNativeLogs(root, slot, placement, host, false, platform);
|
|
119
|
-
else await pullHostedMacosLogs(root, placement, host);
|
|
120
|
-
failing = false;
|
|
121
|
-
} catch (error) {
|
|
122
|
-
host?.connection.close();
|
|
123
|
-
host = void 0;
|
|
124
|
-
if (!failing) process.stderr.write(`${warning((slot !== void 0 ? (platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))[slot] : readMacosRecord(root)?.host)?.machine ?? "the host", error)}\n`);
|
|
125
|
-
failing = true;
|
|
126
|
-
retryAt = Date.now() + retryMs;
|
|
127
|
-
} finally {
|
|
128
|
-
running = false;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
const timer = setInterval(() => void tick(), intervalMs);
|
|
132
|
-
return () => {
|
|
133
|
-
stopped = true;
|
|
134
|
-
clearInterval(timer);
|
|
135
|
-
host?.connection.close();
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
async function syncHostedLogs(root) {
|
|
139
|
-
const macos = readMacosRecord(root)?.host;
|
|
140
|
-
const warnings = /* @__PURE__ */ new Set();
|
|
141
|
-
return (await Promise.all([
|
|
142
|
-
...macos ? [syncHostedMacosLogs(root, macos)] : [],
|
|
143
|
-
...Object.entries(readHostedIos(root)).map(([slot, placement]) => syncHostedMacosLogs(root, placement, slot, warnings)),
|
|
144
|
-
...Object.entries(readHostedAndroid(root)).map(([slot, placement]) => syncHostedMacosLogs(root, placement, slot, warnings, "android"))
|
|
145
|
-
])).every(Boolean);
|
|
146
|
-
}
|
|
147
|
-
function followHostedLogs(root, failing) {
|
|
148
|
-
const stops = /* @__PURE__ */ new Map();
|
|
149
|
-
const refresh = () => {
|
|
150
|
-
if (readMacosRecord(root)?.host && !stops.has("macos")) stops.set("macos", followHostedMacosLogs(root, { failing }));
|
|
151
|
-
for (const platform of ["ios", "android"]) for (const slot of Object.keys(platform === "ios" ? readHostedIos(root) : readHostedAndroid(root))) {
|
|
152
|
-
const key = `${platform}:${slot}`;
|
|
153
|
-
if (!stops.has(key)) stops.set(key, followHostedMacosLogs(root, {
|
|
154
|
-
failing,
|
|
155
|
-
slot,
|
|
156
|
-
platform
|
|
157
|
-
}));
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
refresh();
|
|
161
|
-
const timer = setInterval(refresh, 500);
|
|
162
|
-
return () => {
|
|
163
|
-
clearInterval(timer);
|
|
164
|
-
for (const stop of stops.values()) stop();
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
|
-
//#endregion
|
|
168
|
-
//#region src/commands/logs.ts
|
|
169
|
-
const LEVEL_WIDTH = 5;
|
|
170
|
-
const SRC_WIDTH = 6;
|
|
171
|
-
const INDENT = " ";
|
|
172
|
-
function padTimePart(value, width = 2) {
|
|
173
|
-
return String(value).padStart(width, "0");
|
|
174
|
-
}
|
|
175
|
-
function formatTime(ts) {
|
|
176
|
-
if (typeof ts !== "number" || !Number.isFinite(ts)) return "--:--:--.---";
|
|
177
|
-
const d = new Date(ts);
|
|
178
|
-
return `${padTimePart(d.getHours())}:${padTimePart(d.getMinutes())}:${padTimePart(d.getSeconds())}.${padTimePart(d.getMilliseconds(), 3)}`;
|
|
179
|
-
}
|
|
180
|
-
function formatStackFrame(frame) {
|
|
181
|
-
if (!frame || typeof frame !== "object") return null;
|
|
182
|
-
const where = [
|
|
183
|
-
frame.file,
|
|
184
|
-
frame.line,
|
|
185
|
-
frame.column
|
|
186
|
-
].filter((p) => p !== void 0 && p !== null && p !== "").join(":");
|
|
187
|
-
if (frame.fn && where) return `at ${frame.fn} (${where})`;
|
|
188
|
-
if (frame.fn) return `at ${frame.fn}`;
|
|
189
|
-
if (where) return `at ${where}`;
|
|
190
|
-
return null;
|
|
191
|
-
}
|
|
192
|
-
function formatRecord(record, { paint } = {}) {
|
|
193
|
-
const colour = paint || ((t) => t);
|
|
194
|
-
const level = String(record?.level ?? "").padEnd(LEVEL_WIDTH);
|
|
195
|
-
const src = String(record?.src ?? "").padEnd(SRC_WIDTH);
|
|
196
|
-
const [first, ...rest] = (record?.msg === void 0 || record?.msg === null ? "" : String(record.msg)).split("\n");
|
|
197
|
-
const lines = [`${formatTime(record?.ts)} ${colour(level)} ${src} ${first}`];
|
|
198
|
-
for (const line of rest) lines.push(`${INDENT}${line}`);
|
|
199
|
-
for (const frame of Array.isArray(record?.stack) ? record.stack : []) {
|
|
200
|
-
const rendered = formatStackFrame(frame);
|
|
201
|
-
if (rendered) lines.push(`${INDENT}${rendered}`);
|
|
202
|
-
}
|
|
203
|
-
return lines.join("\n");
|
|
204
|
-
}
|
|
205
|
-
function parseTail(value) {
|
|
206
|
-
if (typeof value === "number" && Number.isInteger(value) && value >= 0) return { n: value };
|
|
207
|
-
if (typeof value !== "string" || !/^\d+$/.test(value.trim())) return { error: `Invalid --tail value ${JSON.stringify(value)}. Use a non-negative whole number, e.g. --tail 50.` };
|
|
208
|
-
return { n: parseInt(value.trim(), 10) };
|
|
209
|
-
}
|
|
210
|
-
function validateSources(sources) {
|
|
211
|
-
if (sources === void 0 || sources === null) return { sources: void 0 };
|
|
212
|
-
const list = Array.isArray(sources) ? sources : [sources];
|
|
213
|
-
if (list.includes("all")) return { sources: [...SOURCES] };
|
|
214
|
-
const unknown = list.filter((s) => !SOURCES.includes(s));
|
|
215
|
-
if (unknown.length > 0) return { error: `Unknown --source value(s): ${unknown.join(", ")}. Use one or more of: ${SOURCES.join(", ")}, or all.` };
|
|
216
|
-
return { sources: list };
|
|
217
|
-
}
|
|
218
|
-
function validateLevel(level) {
|
|
219
|
-
if (LEVELS.includes(level)) return { level };
|
|
220
|
-
return { error: `Invalid --level value ${JSON.stringify(level)}. Use one of: ${LEVELS.join(", ")}.` };
|
|
221
|
-
}
|
|
222
|
-
const ERRORS_PRINT_CAP = 20;
|
|
223
|
-
function nearestRegisteredLogsProject(root, candidates) {
|
|
224
|
-
return candidates.filter((candidate) => candidate !== root && isPathPrefix(root, candidate)).toSorted((a, b) => {
|
|
225
|
-
const depth = (path) => relative(root, path).split(sep).length;
|
|
226
|
-
return depth(a) - depth(b) || a.length - b.length || a.localeCompare(b);
|
|
227
|
-
})[0] ?? null;
|
|
228
|
-
}
|
|
229
|
-
function registeredDescendantWithLogs(root) {
|
|
230
|
-
const candidates = Object.keys(loadConfig$1()?.projects ?? {}).flatMap((path) => {
|
|
231
|
-
try {
|
|
232
|
-
const canonical = realpathSync(path);
|
|
233
|
-
return logFiles(workspaceLogsDir$1(canonical)).length > 0 ? [canonical] : [];
|
|
234
|
-
} catch {
|
|
235
|
-
return [];
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
return nearestRegisteredLogsProject(root, [...new Set(candidates)]);
|
|
239
|
-
}
|
|
240
|
-
function requireLogsWorkspace(root, dir) {
|
|
241
|
-
if (logFiles(dir).length > 0) return;
|
|
242
|
-
const descendant = registeredDescendantWithLogs(root);
|
|
243
|
-
fail(`STIM_NO_PROJECT: No Stim workspace has run in ${root}.${descendant ? ` The nearest registered app with logs is ${descendant}; run this command from there.` : " Run `stim start`, `stim ios`, or `stim android` in the app first."}`);
|
|
244
|
-
}
|
|
245
|
-
const LEVEL_COLOURS = {
|
|
246
|
-
debug: chalk.dim,
|
|
247
|
-
info: chalk.reset,
|
|
248
|
-
warn: chalk.yellow,
|
|
249
|
-
error: chalk.red,
|
|
250
|
-
fatal: chalk.bgRed
|
|
251
|
-
};
|
|
252
|
-
function logsCommand(program) {
|
|
253
|
-
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) => {
|
|
254
|
-
const root = findCommandWorkspace(process.cwd());
|
|
255
|
-
if (!root) {
|
|
256
|
-
refuseNoProject({ json: false });
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
const dir = workspaceLogsDir$1(root);
|
|
260
|
-
let sources;
|
|
261
|
-
if (opts.source !== void 0) {
|
|
262
|
-
const checked = validateSources(opts.source);
|
|
263
|
-
if (checked.error) fail(checked.error);
|
|
264
|
-
sources = checked.sources;
|
|
265
|
-
}
|
|
266
|
-
let minLevel;
|
|
267
|
-
if (opts.level !== void 0) {
|
|
268
|
-
const checked = validateLevel(opts.level);
|
|
269
|
-
if (checked.error) fail(checked.error);
|
|
270
|
-
minLevel = checked.level;
|
|
271
|
-
}
|
|
272
|
-
if (opts.since !== void 0) {
|
|
273
|
-
const parsed = parseSince(opts.since);
|
|
274
|
-
if (parsed.error) fail(parsed.error);
|
|
275
|
-
}
|
|
276
|
-
let tail;
|
|
277
|
-
if (opts.tail !== void 0) {
|
|
278
|
-
const parsed = parseTail(opts.tail);
|
|
279
|
-
if (parsed.error) fail(parsed.error);
|
|
280
|
-
tail = parsed.n;
|
|
281
|
-
}
|
|
282
|
-
if (opts.grep !== void 0) {
|
|
283
|
-
const compiled = compileGrep(opts.grep);
|
|
284
|
-
if (compiled.error) fail(compiled.error);
|
|
285
|
-
}
|
|
286
|
-
requireLogsWorkspace(root, dir);
|
|
287
|
-
const hostedReachable = await syncHostedLogs(root);
|
|
288
|
-
const query = {
|
|
289
|
-
slot: opts.slot,
|
|
290
|
-
dir,
|
|
291
|
-
sources,
|
|
292
|
-
minLevel,
|
|
293
|
-
since: opts.since,
|
|
294
|
-
grep: opts.grep,
|
|
295
|
-
tail,
|
|
296
|
-
errorsOnly: Boolean(opts.errors),
|
|
297
|
-
errorContext: Boolean(opts.errors && !opts.json && !opts.follow)
|
|
298
|
-
};
|
|
299
|
-
const emit = (record) => {
|
|
300
|
-
if (opts.json) {
|
|
301
|
-
console.log(JSON.stringify(record));
|
|
302
|
-
return;
|
|
303
|
-
}
|
|
304
|
-
const rendered = {
|
|
305
|
-
...record,
|
|
306
|
-
msg: launchErrorPreview([record], root, { full: true }).join("\n"),
|
|
307
|
-
stack: void 0
|
|
308
|
-
};
|
|
309
|
-
console.log(formatRecord(rendered, { paint: record?.level ? LEVEL_COLOURS[record.level] : void 0 }));
|
|
310
|
-
};
|
|
311
|
-
const captured = captureWorkspaceCrashes(root, dir);
|
|
312
|
-
const offsets = opts.follow ? fileSizes(dir) : null;
|
|
313
|
-
const workspaceTimeline = opts.follow ? readLogRecords(dir) : captured;
|
|
314
|
-
const agentSince = workspaceTimeline[0]?.ts ?? (opts.follow ? Date.now() : void 0);
|
|
315
|
-
const project = loadConfig$1()?.projects?.[root];
|
|
316
|
-
const readAgent = (sources ? sources.includes("agent") : !opts.errors) && agentSince !== void 0 ? createAgentActionReader$1({
|
|
317
|
-
targets: () => workspaceAgentTargets(project, readMacosRecord(root)),
|
|
318
|
-
sinceTs: agentSince
|
|
319
|
-
}) : null;
|
|
320
|
-
const timeline = readAgent ? sortByTs([...workspaceTimeline, ...readAgent()]) : workspaceTimeline;
|
|
321
|
-
const rawRecords = (opts.json ? queryJsonLogs : queryLogs)({
|
|
322
|
-
...query,
|
|
323
|
-
records: timeline
|
|
324
|
-
});
|
|
325
|
-
const supervisorPort = readWorkspaceState$1(root)?.supervisor?.port;
|
|
326
|
-
const records = opts.json ? rawRecords : await errorDiagnostics(rawRecords, {
|
|
327
|
-
root,
|
|
328
|
-
logsDir: dir,
|
|
329
|
-
port: typeof supervisorPort === "number" ? supervisorPort : null,
|
|
330
|
-
allowRequest: true,
|
|
331
|
-
timeline
|
|
332
|
-
});
|
|
333
|
-
const errorCount = records.filter((record) => record.errorContext !== true).length;
|
|
334
|
-
let seenErrors = 0;
|
|
335
|
-
const capped = opts.errors && !opts.json && tail === void 0 && errorCount > 20 ? records.filter((record) => {
|
|
336
|
-
if (record.errorContext === true) return seenErrors <= 20;
|
|
337
|
-
seenErrors += 1;
|
|
338
|
-
return seenErrors <= 20;
|
|
339
|
-
}) : records;
|
|
340
|
-
for (const record of capped) emit(record);
|
|
341
|
-
const hidden = errorCount - capped.filter((record) => record.errorContext !== true).length;
|
|
342
|
-
if (hidden > 0) console.log(chalk.dim(`Showing 20 of ${errorCount} matching error records; ${hidden} not shown. Add --tail ${rawRecords.length} to include all captured records before grouping, or --json for raw records. Stacks are shown in full.`));
|
|
343
|
-
if (!opts.follow) {
|
|
344
|
-
if (records.length === 0 && !opts.json) console.error(chalk.dim(`No matching log records in ${dir}`));
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
const criteria = buildCriteria({
|
|
348
|
-
slot: opts.slot,
|
|
349
|
-
sources,
|
|
350
|
-
minLevel,
|
|
351
|
-
since: opts.since,
|
|
352
|
-
grep: opts.grep,
|
|
353
|
-
errorsOnly: Boolean(opts.errors)
|
|
354
|
-
});
|
|
355
|
-
const stop = followLogs({
|
|
356
|
-
dir,
|
|
357
|
-
offsets,
|
|
358
|
-
criteria,
|
|
359
|
-
onRecord: emit,
|
|
360
|
-
errorContext: opts.errors ? opts.json ? "field" : "msg" : void 0
|
|
361
|
-
});
|
|
362
|
-
const agentTimer = readAgent ? setInterval(() => {
|
|
363
|
-
for (const record of readAgent()) if (recordMatches(record, criteria)) emit(record);
|
|
364
|
-
}, 500) : null;
|
|
365
|
-
const stopHosted = followHostedLogs(root, !hostedReachable);
|
|
366
|
-
const finish = () => {
|
|
367
|
-
stop();
|
|
368
|
-
stopHosted?.();
|
|
369
|
-
stopReader();
|
|
370
|
-
if (agentTimer) clearInterval(agentTimer);
|
|
371
|
-
process.exit(0);
|
|
372
|
-
};
|
|
373
|
-
const stopReader = watchStdoutReader(finish);
|
|
374
|
-
process.on("SIGINT", finish);
|
|
375
|
-
process.on("SIGTERM", finish);
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
function fail(message) {
|
|
379
|
-
console.error(chalk.red(message));
|
|
380
|
-
process.exit(1);
|
|
381
|
-
}
|
|
382
|
-
//#endregion
|
|
383
|
-
export { ERRORS_PRINT_CAP, logsCommand as default, formatRecord, formatStackFrame, formatTime, parseTail, validateLevel, validateSources };
|