@stim-cli/core 1.15.0 → 1.16.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.
@@ -1,4 +1,126 @@
1
1
  import { o as ClaimHandle } from "./ownership-claim-Xxxr9MPp.mjs";
2
+ //#region state/ndjson.d.ts
3
+ interface NdjsonRecord {
4
+ ts?: number;
5
+ src?: string;
6
+ level?: string;
7
+ msg?: string;
8
+ /** With `logs --errors --json`: the code frame and stack lines Expo printed after this error. */
9
+ context?: string[];
10
+ [key: string]: unknown;
11
+ }
12
+ declare const LEVELS: string[];
13
+ declare const SOURCES: string[];
14
+ declare function levelRank(level?: string): number;
15
+ declare function parseNdjsonLine(line: unknown): NdjsonRecord | null;
16
+ declare function parseNdjsonText(text: unknown): NdjsonRecord[];
17
+ declare function readNdjsonGenerations(file: string): NdjsonRecord[];
18
+ //#endregion
19
+ //#region state/agent-actions.d.ts
20
+ interface AgentTarget {
21
+ platform: "ios" | "android";
22
+ id: string;
23
+ slot: string;
24
+ name?: string;
25
+ }
26
+ interface AgentActionReaderOptions {
27
+ sessionsDirs: readonly string[] | (() => readonly string[]);
28
+ targets?: AgentTarget[];
29
+ sinceTs?: number;
30
+ now?: () => number;
31
+ claimedDevice?: (session: string, sessionsDir: string) => string | null;
32
+ }
33
+ /**
34
+ * Reads agent-device session actions incrementally from the supplied sessions directories. With targets,
35
+ * records are restricted to those devices; without targets, retained session metadata supplies attribution.
36
+ * Missing directories and unreadable files yield no records.
37
+ */
38
+ declare function createAgentActionReader({ sessionsDirs, targets, sinceTs, now, claimedDevice }: AgentActionReaderOptions): () => NdjsonRecord[];
39
+ //#endregion
40
+ //#region state/agent-device-usage.d.ts
41
+ interface AgentDeviceUsage {
42
+ version: 1;
43
+ measuredAt: string;
44
+ bytes: number;
45
+ complete: boolean;
46
+ stateDir: {
47
+ dir: string;
48
+ present: boolean;
49
+ bytes: number | null;
50
+ sessions: {
51
+ dir: string;
52
+ bytes: number | null;
53
+ count: number;
54
+ };
55
+ logs: {
56
+ dir: string;
57
+ bytes: number | null;
58
+ };
59
+ other: {
60
+ bytes: number | null;
61
+ largest: {
62
+ name: string;
63
+ bytes: number | null;
64
+ }[];
65
+ };
66
+ };
67
+ runnerBuilds: {
68
+ dir: string;
69
+ present: boolean;
70
+ bytes: number | null;
71
+ sharedBytes: number | null;
72
+ platforms: {
73
+ platform: string;
74
+ dir: string;
75
+ bytes: number | null;
76
+ entries: {
77
+ name: string;
78
+ dir: string;
79
+ bytes: number | null;
80
+ lastUsedAt: string | null;
81
+ packageVersion: string | null;
82
+ xcodeBuildVersion: string | null;
83
+ inUse: boolean;
84
+ inUseReason: "lease" | "lock" | "unreadable" | null;
85
+ }[];
86
+ }[];
87
+ };
88
+ workspaces: {
89
+ dir: string;
90
+ projectRoot: string | null;
91
+ bytes: number | null;
92
+ }[];
93
+ hosted: {
94
+ dir: string;
95
+ bytes: number | null;
96
+ sessions: number;
97
+ } | null;
98
+ }
99
+ interface AgentDeviceUsageRoots {
100
+ stateDir: string;
101
+ runnerRoot: string;
102
+ hostedDir: string;
103
+ workspaceDirs: string[];
104
+ }
105
+ declare function agentDeviceUsageFile(): string;
106
+ declare function readAgentDeviceUsageCache(): {
107
+ usage: AgentDeviceUsage;
108
+ roots: AgentDeviceUsageRoots;
109
+ } | null;
110
+ declare function readAgentDeviceUsage(): AgentDeviceUsage | null;
111
+ //#endregion
112
+ //#region state/swiftpm-cache-usage.d.ts
113
+ interface SwiftpmCacheUsage {
114
+ version: 1;
115
+ measuredAt: string;
116
+ dir: string;
117
+ present: boolean;
118
+ bytes: number | null;
119
+ complete: boolean;
120
+ }
121
+ declare function swiftpmCacheUsageFile(): string;
122
+ declare function readSwiftpmCacheUsage(): SwiftpmCacheUsage | null;
123
+ //#endregion
2
124
  //#region state/build-capacity.d.ts
3
125
  declare function buildSlotsDir(): string;
4
126
  declare function buildSlotPath(index: number): string;
@@ -44,6 +166,7 @@ interface BuildMachineCredential {
44
166
  deviceToken: string;
45
167
  state: "pending" | "approved";
46
168
  requestedAt: string;
169
+ ticketHash?: string;
47
170
  }
48
171
  declare function readBuildMachines(): BuildMachineCredential[];
49
172
  //#endregion
@@ -216,23 +339,6 @@ interface EasSessionLedgerRead {
216
339
  declare function validEasSessionClaim(id: string, value: unknown): EasSessionClaim | null;
217
340
  declare function readEasSessionLedger(root?: string): EasSessionLedgerRead;
218
341
  //#endregion
219
- //#region state/ndjson.d.ts
220
- interface NdjsonRecord {
221
- ts?: number;
222
- src?: string;
223
- level?: string;
224
- msg?: string;
225
- /** With `logs --errors --json`: the code frame and stack lines Expo printed after this error. */
226
- context?: string[];
227
- [key: string]: unknown;
228
- }
229
- declare const LEVELS: string[];
230
- declare const SOURCES: string[];
231
- declare function levelRank(level?: string): number;
232
- declare function parseNdjsonLine(line: unknown): NdjsonRecord | null;
233
- declare function parseNdjsonText(text: unknown): NdjsonRecord[];
234
- declare function readNdjsonGenerations(file: string): NdjsonRecord[];
235
- //#endregion
236
342
  //#region state/error-entries.d.ts
237
343
  /**
238
344
  * The number of rows a log list shows for `records`, an error query's result in log order. Stim Desktop's
@@ -295,6 +401,9 @@ declare function buildCriteria({ slot, sources, minLevel, since, grep, errorsOnl
295
401
  declare function logFiles(dir: string): string[];
296
402
  declare function fileSizes(dir: string): Record<string, number>;
297
403
  declare function readLogRecords(dir: string, include?: (name: string) => boolean): NdjsonRecord[];
404
+ declare const NATIVE_CRASH_LOG_PREFIX = "native-crash-";
405
+ /** Reads the CLI timeline with retained native crash records after other records at the same timestamp. */
406
+ declare function readLogTimeline(dir: string, records?: NdjsonRecord[]): NdjsonRecord[];
298
407
  type ExpoContextTarget = "msg" | "field";
299
408
  /**
300
409
  * Adds the code frame and stack lines Expo printed after each Expo error record, either joined into
@@ -314,6 +423,8 @@ declare function queryLogs({ slot, dir, records, sources, minLevel, since, grep,
314
423
  errorContext?: boolean;
315
424
  now?: number;
316
425
  }): NdjsonRecord[];
426
+ /** Queries the JSON timeline, including Expo context fields on errors as `stim logs --json` does. */
427
+ declare function queryJsonLogs(options?: Parameters<typeof queryLogs>[0]): NdjsonRecord[];
317
428
  declare function tailRead(prev: TailState | null | undefined, size: number): {
318
429
  start: number;
319
430
  prev: TailState;
@@ -337,6 +448,7 @@ declare function sortByTs(records: NdjsonRecord[]): NdjsonRecord[];
337
448
  declare function getConfigPath(): string;
338
449
  declare function configLockPath(): string;
339
450
  declare function workspaceMetadataFile(projectRoot: string): string;
451
+ declare function workspaceAgentDeviceDir(projectRoot: string): string;
340
452
  declare function workspaceLogsDir(projectRoot: string): string;
341
453
  /** Device screen footage stim-server records for the workspace, one directory per platform and slot. */
342
454
  declare function workspaceRecordingsDir(projectRoot: string): string;
@@ -376,6 +488,17 @@ declare function easSessionLedgerLock(root?: string): string;
376
488
  /** Where stim-server records, one file per server process, the devices whose frames a client subscribes to. */
377
489
  declare function deviceViewersDir(): string;
378
490
  declare function statsFile(): string;
491
+ declare function maintenanceDir(): string;
492
+ declare function maintenanceStateFile(): string;
493
+ declare function maintenanceAttemptFile(): string;
494
+ declare function maintenanceNdjsonFile(): string;
495
+ declare function maintenanceChildLogFile(): string;
496
+ declare function maintenanceRunClaims(): string;
497
+ declare function archiveRoot(): string;
498
+ declare function archiveDir(id: string): string;
499
+ declare function archiveLock(): string;
500
+ declare function serverSetupDir(): string;
501
+ declare function setupJournalFile(hash: string): string | null;
379
502
  //#endregion
380
503
  //#region state/recordings.d.ts
381
504
  /** The footage stim-server keeps per device: the last 15 minutes recorded, however long ago. */
@@ -407,8 +530,8 @@ declare function recordingDeviceName(platform: RecordingPlatform, slot: string):
407
530
  /** Segment names hold whole milliseconds: the start rounded down and the end rounded up. */
408
531
  declare function closedSegmentName(start: number, end: number): string;
409
532
  declare function openSegmentName(start: number): string;
410
- /** The segments in one device directory, oldest first. Files that are not segments are left out. */
411
- declare function listSegments(dir: string): RecordedSegment[];
533
+ /** The segments in one device directory, oldest first. Files that are not segments are left out; `closedOnly` excludes files still being written. */
534
+ declare function listSegments(dir: string, closedOnly?: boolean): RecordedSegment[];
412
535
  /** Every device slot recorded under a workspace's recordings directory. */
413
536
  declare function listRecordedDevices(recordingsDir: string): RecordedDevice[];
414
537
  declare function recordedBytes(devices: readonly RecordedDevice[]): number;
@@ -447,6 +570,7 @@ type SettingType = {
447
570
  kind: "number";
448
571
  integer?: boolean;
449
572
  minimum?: number;
573
+ exclusiveMinimum?: number;
450
574
  maximum?: number;
451
575
  } | {
452
576
  kind: "boolean";
@@ -464,6 +588,7 @@ type SettingType = {
464
588
  * `.stim.json` instead of the app's. A `sensitive` value is never printed and is
465
589
  * written to `.stim.json` only as an `env:` or `file:` reference. `scopedHomeValue`
466
590
  * replaces every layer and the default while STIM_HOME is set and `env` is not.
591
+ * `ciValue` replaces every layer and the default while CI is set and `env` is not.
467
592
  * `desktopDefault` replaces `default` on macOS while Stim Desktop is installed.
468
593
  */
469
594
  interface SettingDefinition {
@@ -475,7 +600,8 @@ interface SettingDefinition {
475
600
  env?: string;
476
601
  sensitive?: boolean;
477
602
  committedAt?: "repository";
478
- scopedHomeValue?: number;
603
+ scopedHomeValue?: string | number | boolean;
604
+ ciValue?: string | number | boolean;
479
605
  desktopDefault?: string;
480
606
  }
481
607
  interface SettingEntry {
@@ -568,6 +694,17 @@ interface HostedAppRecord extends HostedAppDelivery {
568
694
  declare const HOSTED_APP_CHUNK_BYTES: number;
569
695
  declare function hostedAppAttempt(value: unknown): value is string;
570
696
  declare function hostedAppArea(session: string, attempt: string, workerHome?: string): string;
697
+ declare function hostedAppBlobs(session: string, workerHome?: string): string;
698
+ /** Transfers cached verification after a rename, only for the same inode, size, mtime and digest. */
699
+ declare function rememberHostedAppBlobRename(from: string, to: string, file: {
700
+ size: number;
701
+ sha256: string;
702
+ }): void;
703
+ /** Checks regular blob bytes, including their size, before content-addressed reuse. */
704
+ declare function validHostedAppBlob(path: string, file: {
705
+ size: number;
706
+ sha256: string;
707
+ }): boolean;
571
708
  /** At most 32 plain arguments of 1024 characters (8192 in total), with no NUL, CR or LF. */
572
709
  declare function validHostedAppArguments(value: unknown): value is string[];
573
710
  declare function parseHostedAppOffer(value: unknown): HostedAppOffer | null;
@@ -592,20 +729,21 @@ interface HostedMacosDevice extends HostedMacosChoice {
592
729
  appSlot: number;
593
730
  }
594
731
  /**
595
- * The rest of an agent-device `macos-app` lease's owner scope, which a client names on every request:
596
- * `deviceKey` is `<bundleId>@<pid>` of the hosted app.
732
+ * The agent-device lease owner scope a client names on every request. `deviceKey` is `<bundleId>@<pid>`
733
+ * for a macOS app, or `ios:mobile:<udid>` with `backend: ios-instance` for a hosted simulator.
597
734
  */
598
735
  interface HostedAgentLease {
599
736
  tenant: string;
600
737
  runId: string;
601
738
  clientId: string;
602
739
  deviceKey: string;
740
+ backend?: "ios-instance";
603
741
  }
604
742
  /**
605
743
  * Agent control the host grants a client for one installed hosted app, sent only over that client's approved
606
744
  * device-host connection and never journaled. `none` means the host's `hosting.agentDriver` starts no driver.
607
745
  * `path` is the session's base route on the host, `scope` the driver's handle that limits it to this one app,
608
- * and `lease` the scope the driver's lease was allocated with.
746
+ * and `lease` the scope that pins the driver's lease allocation.
609
747
  */
610
748
  type HostedAgentGrant = {
611
749
  driver: "none";
@@ -649,48 +787,118 @@ declare function parseHostedMacosChoice(value: unknown): HostedMacosChoice | nul
649
787
  declare function parseHostedMacosDevice(value: unknown): HostedMacosDevice | null;
650
788
  /** A grant naming a driver this client does not know is not usable; it parses as null. */
651
789
  declare function parseHostedAgentGrant(value: unknown): HostedAgentGrant | null;
790
+ declare function parseHostedAgentAccess(value: unknown): HostedAgentAccess | null;
652
791
  declare function parseHostedMacosPlacement(value: unknown): HostedMacosPlacement | null;
653
792
  //#endregion
654
- //#region state/macos.d.ts
655
- interface MacosProcess {
656
- pid: number;
657
- processToken: string;
658
- startedAtMicros: number;
793
+ //#region state/device-host.d.ts
794
+ type HostedDevicePlatform = "ios" | "android" | "macos";
795
+ interface HostedIosChoice {
796
+ deviceTypeId: string;
797
+ runtimeId: string;
798
+ deviceType: string;
799
+ runtime: string;
800
+ architecture: "arm64" | "x86_64";
659
801
  }
660
- interface MacosBuild {
661
- state: "running" | "ok" | "failed";
662
- startedAt: string;
663
- finishedAt?: string;
664
- durationMs?: number;
665
- error?: string;
666
- errorCode?: string;
667
- buildMachine?: string;
668
- builtOn?: string;
669
- offloadedTo?: string;
670
- offloadFallback?: string;
802
+ interface HostedIosDevice extends HostedIosChoice {
803
+ udid: string;
804
+ name: string;
671
805
  }
672
- interface MacosAppRecord {
673
- launchId: string;
674
- arguments: string[];
675
- product: string;
676
- bundle: string;
677
- bundleId: string;
678
- executable: string;
679
- build: MacosBuild;
680
- supervisor?: MacosProcess;
681
- app?: MacosProcess;
682
- /** Set when `stim macos --remote` reserved a session on another Mac; the app then has no local process. */
683
- host?: HostedMacosPlacement;
684
- /** Host launch evidence: true for a live app; status can override it in memory after probing the session. */
685
- hostLaunched?: boolean | "unverified";
806
+ interface HostedAndroidChoice {
807
+ systemImage: string;
808
+ deviceProfile: string;
809
+ architecture: "arm64-v8a" | "x86_64";
686
810
  }
687
- interface MacosAppState extends MacosAppRecord {
688
- state: "running" | "orphaned" | "stopped" | "unverified";
811
+ interface HostedAndroidDevice extends HostedAndroidChoice {
812
+ avdName: string;
813
+ serial: string;
814
+ consolePort: number;
689
815
  }
690
- declare function parseMacosRecord(value: unknown): MacosAppRecord | null;
691
- declare function readMacosRecord(root: string): MacosAppRecord | null;
692
- declare function readHostedMacosApp(home: string): MacosAppRecord | null;
693
- declare function macosAppState(record: MacosAppRecord | null): MacosAppState | null;
816
+ type HostedDevice = HostedIosDevice | HostedAndroidDevice | HostedMacosDevice;
817
+ interface HostedDeviceSelectors {
818
+ deviceType?: string;
819
+ runtime?: string;
820
+ systemImage?: string;
821
+ deviceProfile?: string;
822
+ }
823
+ interface HostedDeviceOfferRequest extends HostedDeviceSelectors {
824
+ platform: HostedDevicePlatform;
825
+ }
826
+ type HostedNativeOffer = {
827
+ resources: {
828
+ cpus: number;
829
+ /** Five-minute system load divided by available CPU count. */
830
+ loadPerCore: number;
831
+ memoryFreeBytes: number;
832
+ memoryPressure: "normal" | "warning" | "critical" | null;
833
+ /** Available bytes on the Stim home volume, not necessarily the Android AVD volume. */
834
+ workerDiskFreeBytes: number | null;
835
+ };
836
+ declined: string | null;
837
+ } & ({
838
+ platform: "ios";
839
+ choice: HostedIosChoice | null;
840
+ } | {
841
+ platform: "android";
842
+ choice: HostedAndroidChoice | null;
843
+ } | {
844
+ platform: "macos";
845
+ choice: HostedMacosChoice | null;
846
+ });
847
+ type HostedDeviceOffer = HostedNativeOffer & {
848
+ capacity: {
849
+ running: number;
850
+ max: number;
851
+ available: number | null;
852
+ };
853
+ };
854
+ interface HostedDeviceRequest extends HostedDeviceOfferRequest {
855
+ workspace: string;
856
+ slot: string;
857
+ attempt: string;
858
+ }
859
+ type HostedDevicePhase = "preparing" | "ready" | "stopping" | "stopped" | "unknown";
860
+ interface HostedDeviceSession extends HostedDeviceRequest {
861
+ id: string;
862
+ client: string;
863
+ state: HostedDevicePhase;
864
+ device: HostedDevice | null;
865
+ consolePort?: number;
866
+ appSlot?: number;
867
+ createdAt: string;
868
+ notice?: string;
869
+ appAttempt?: string;
870
+ metroPort?: number;
871
+ }
872
+ declare function deviceHostRoot(): string;
873
+ declare function deviceHostArea(id: string): string;
874
+ declare function parseHostedChoice(value: unknown): HostedIosChoice | null;
875
+ declare function parseHostedDevice(value: unknown): HostedIosDevice | null;
876
+ declare function parseHostedAndroidDevice(value: unknown): HostedAndroidDevice | null;
877
+ /** Android Emulator -help-port defines the supported even console ports as 5554 through 5584. */
878
+ declare function hostedConsolePort(value: unknown): value is number;
879
+ declare function parseHostedPlatformDevice(value: unknown, platform: HostedDevicePlatform): HostedDevice | null;
880
+ declare function hostedDeviceId(device: HostedDevice): string;
881
+ declare function parseHostedRequest(value: unknown): HostedDeviceRequest | null;
882
+ declare function parseHostedOfferRequest(value: unknown): HostedDeviceOfferRequest | null;
883
+ declare function parseHostedNativeOffer(value: unknown): HostedNativeOffer | null;
884
+ /** A missing established journal or malformed record is a refusal, never an empty reservation set. */
885
+ declare function readHostedSessions(): HostedDeviceSession[];
886
+ /** The private worker's exact device record; an absent record is unresolved after creation started. */
887
+ declare function readHostedDevice(home: string): HostedIosDevice;
888
+ declare function readHostedDevice(home: string, platform: "android"): HostedAndroidDevice;
889
+ declare function readHostedDevice(home: string, platform: "macos"): HostedMacosDevice;
890
+ declare function readHostedDevice(home: string, platform: HostedDevicePlatform): HostedDevice;
891
+ declare function readHostedDeviceLedger(home: string, options?: {
892
+ required?: boolean;
893
+ }): {
894
+ ios: string[];
895
+ android: string[];
896
+ web: string[];
897
+ } | null;
898
+ /** Hosted sessions use isolated homes: only one exact device of their platform may appear in this ledger. */
899
+ declare function assertHostedDeviceLedger(home: string, id: string, platform?: HostedDevicePlatform, options?: {
900
+ allowEmpty?: boolean;
901
+ }): "listed" | "empty";
694
902
  //#endregion
695
903
  //#region state/workspace-state.d.ts
696
904
  interface WorkspaceState {
@@ -801,6 +1009,225 @@ declare const WORKSPACE_AGENT_KEY = "agentSession";
801
1009
  */
802
1010
  declare function readWorkspaceAgent(state: WorkspaceState | null | undefined): AgentSession | null;
803
1011
  //#endregion
1012
+ //#region state/hosted-ios.d.ts
1013
+ /** A workspace slot's placement; null device means its reservation has not reached ready yet. */
1014
+ interface HostedIosPlacement {
1015
+ machine: string;
1016
+ session: string;
1017
+ appAttempt: string;
1018
+ device: HostedIosDevice | null;
1019
+ selected: string;
1020
+ agent: HostedAgentAccess;
1021
+ }
1022
+ /** Public hosting facts; the host's UDID and private Metro gateway are excluded. */
1023
+ type HostedIosStatus = Pick<HostedIosPlacement, "machine" | "session" | "selected" | "agent"> & {
1024
+ device: {
1025
+ name: string;
1026
+ runtime: string;
1027
+ } | null;
1028
+ /** The latest session probe in status, independent of a conflicting local simulator's state. */
1029
+ state?: string;
1030
+ };
1031
+ declare function parseHostedIosPlacement(value: unknown): HostedIosPlacement | null;
1032
+ declare function hostedIosStatus(placement: HostedIosPlacement): HostedIosStatus;
1033
+ /** Includes unreadable placements so callers retain every recorded hosting slot. */
1034
+ declare function hostedIosRecords(state: WorkspaceState | null): Record<string, unknown>;
1035
+ declare function unreadableHostedIos(slot: string): string;
1036
+ declare function hostedIosPlacements(state: WorkspaceState | null): Record<string, HostedIosPlacement>;
1037
+ //#endregion
1038
+ //#region state/maintenance.d.ts
1039
+ type MaintenanceMode = "off" | "report";
1040
+ type MaintenanceCheck = "pressure" | "size";
1041
+ type MaintenanceActionKind = "would-clear-outputs" | "would-trim-cache" | "would-empty-cache" | "would-shutdown-device" | "would-stop-workspace";
1042
+ interface MaintenanceAction {
1043
+ kind: MaintenanceActionKind;
1044
+ target: string;
1045
+ bytes: number;
1046
+ reason: string;
1047
+ workspace?: string;
1048
+ }
1049
+ interface MaintenanceSize {
1050
+ name: string;
1051
+ dir: string;
1052
+ bytes: number;
1053
+ measuredAt: number;
1054
+ category: "workspace-outputs" | "build-cache" | "metro-cache" | "compilation-cache" | "ccache" | "other";
1055
+ workspace?: string;
1056
+ idleDays?: number | null;
1057
+ blocked?: string;
1058
+ }
1059
+ interface MaintenancePressure {
1060
+ disk: {
1061
+ volume: string;
1062
+ freeMb: number;
1063
+ }[];
1064
+ memory: {
1065
+ level: "normal" | "warning" | "critical" | null;
1066
+ availableBytes: number | null;
1067
+ pressured: boolean;
1068
+ };
1069
+ warningSince: number | null;
1070
+ }
1071
+ interface MaintenancePass {
1072
+ startedAt: number;
1073
+ durationMs: number;
1074
+ trigger: string;
1075
+ mode: "report";
1076
+ freedBytes: 0;
1077
+ actions: number;
1078
+ stopped: 0;
1079
+ blocked: string[];
1080
+ }
1081
+ interface MaintenanceRecord extends NdjsonRecord {
1082
+ ts: number;
1083
+ src: "maintenance";
1084
+ level: "debug" | "info" | "warn" | "error";
1085
+ msg: string;
1086
+ event: "maintenance_pass" | "maintenance_action" | "maintenance_skip" | "maintenance_failure" | "maintenance_check";
1087
+ pass: string;
1088
+ trigger: string;
1089
+ mode: "report";
1090
+ }
1091
+ /** Version 1 contains report-only observations; every action is a plan and no resource was reclaimed. */
1092
+ interface MaintenanceState {
1093
+ version: 1;
1094
+ lastAt: Partial<Record<MaintenanceCheck, number>>;
1095
+ deferredAt?: Partial<Record<MaintenanceCheck, number>>;
1096
+ pressure: MaintenancePressure | null;
1097
+ sizes: MaintenanceSize[];
1098
+ lastPass: MaintenancePass | null;
1099
+ recent: MaintenanceRecord[];
1100
+ plan: MaintenanceAction[];
1101
+ skipKeys?: string[];
1102
+ }
1103
+ interface MaintenanceStatus {
1104
+ mode: MaintenanceMode;
1105
+ invalid?: string;
1106
+ claim?: {
1107
+ unresolved: string;
1108
+ removeCommand: string;
1109
+ };
1110
+ lastChecks: {
1111
+ pressure: number | null;
1112
+ size: number | null;
1113
+ };
1114
+ pressure: MaintenancePressure | null;
1115
+ sizes: MaintenanceSize[];
1116
+ lastPass: MaintenancePass | null;
1117
+ running: {
1118
+ startedAt: string;
1119
+ trigger: string;
1120
+ } | null;
1121
+ recent: MaintenanceRecord[];
1122
+ plan: MaintenanceAction[];
1123
+ }
1124
+ /** Rejects missing, corrupt or unsupported payloads without throwing. */
1125
+ declare function parseMaintenanceState(value: unknown): MaintenanceState | null;
1126
+ declare function readMaintenanceState(): MaintenanceState | null;
1127
+ declare function readMaintenanceAttempt(): number | undefined;
1128
+ //#endregion
1129
+ //#region state/archive.d.ts
1130
+ interface ArchivedBytes {
1131
+ logs: number;
1132
+ recordings: number;
1133
+ agentActions: number;
1134
+ record: number;
1135
+ total: number;
1136
+ }
1137
+ interface ArchivedWorkspace {
1138
+ id: string;
1139
+ projectRoot: string;
1140
+ project: string;
1141
+ workspace: string;
1142
+ worktree: {
1143
+ repository: string | null;
1144
+ branch: string | null;
1145
+ head: string | null;
1146
+ subject: string | null;
1147
+ merged: boolean | null;
1148
+ pullRequest: {
1149
+ number: number;
1150
+ state: string;
1151
+ title: string;
1152
+ url: string;
1153
+ } | null;
1154
+ };
1155
+ removedAt: string;
1156
+ removedBy: string;
1157
+ lastUsedAt: string | null;
1158
+ builds: {
1159
+ count: number;
1160
+ last: LastBuildReport | null;
1161
+ lastErrorCount: number;
1162
+ };
1163
+ agents: EndedAgentSession[];
1164
+ bytes: ArchivedBytes;
1165
+ expires: {
1166
+ logs: string | null;
1167
+ recordings: string | null;
1168
+ agentActions: string | null;
1169
+ record: string | null;
1170
+ };
1171
+ version: number;
1172
+ replacedBy?: string;
1173
+ }
1174
+ interface ArchivedUsage {
1175
+ count: number;
1176
+ bytes: number;
1177
+ byKind: {
1178
+ logs: number;
1179
+ recordings: number;
1180
+ agentActions: number;
1181
+ record: number;
1182
+ };
1183
+ }
1184
+ declare function readArchives(): ArchivedWorkspace[];
1185
+ declare function readArchive(id: string): ArchivedWorkspace | null;
1186
+ declare function archivedUsage(archives: readonly ArchivedWorkspace[]): ArchivedUsage;
1187
+ declare function linkReplacedArchives(archives: readonly ArchivedWorkspace[], paths: readonly string[]): ArchivedWorkspace[];
1188
+ declare function archiveEnabled(env: NodeJS.ProcessEnv, layers: readonly unknown[]): boolean;
1189
+ //#endregion
1190
+ //#region state/macos.d.ts
1191
+ interface MacosProcess {
1192
+ pid: number;
1193
+ processToken: string;
1194
+ startedAtMicros: number;
1195
+ }
1196
+ interface MacosBuild {
1197
+ state: "running" | "ok" | "failed";
1198
+ startedAt: string;
1199
+ finishedAt?: string;
1200
+ durationMs?: number;
1201
+ error?: string;
1202
+ errorCode?: string;
1203
+ buildMachine?: string;
1204
+ builtOn?: string;
1205
+ offloadedTo?: string;
1206
+ offloadFallback?: string;
1207
+ }
1208
+ interface MacosAppRecord {
1209
+ launchId: string;
1210
+ arguments: string[];
1211
+ product: string;
1212
+ bundle: string;
1213
+ bundleId: string;
1214
+ executable: string;
1215
+ build: MacosBuild;
1216
+ supervisor?: MacosProcess;
1217
+ app?: MacosProcess;
1218
+ /** Set when `stim macos --remote` reserved a session on another Mac; the app then has no local process. */
1219
+ host?: HostedMacosPlacement;
1220
+ /** Host launch evidence: true for a live app; status can override it in memory after probing the session. */
1221
+ hostLaunched?: boolean | "unverified";
1222
+ }
1223
+ interface MacosAppState extends MacosAppRecord {
1224
+ state: "running" | "orphaned" | "stopped" | "unverified";
1225
+ }
1226
+ declare function parseMacosRecord(value: unknown): MacosAppRecord | null;
1227
+ declare function readMacosRecord(root: string): MacosAppRecord | null;
1228
+ declare function readHostedMacosApp(home: string): MacosAppRecord | null;
1229
+ declare function macosAppState(record: MacosAppRecord | null): MacosAppState | null;
1230
+ //#endregion
804
1231
  //#region state/status.d.ts
805
1232
  type StatsPlatform = "ios" | "android";
806
1233
  type RunOutcomeKind = "hit" | "cold";
@@ -831,6 +1258,8 @@ interface BuildReport {
831
1258
  cacheLookupOutcome?: "hit" | "miss";
832
1259
  expectedMs: number | null;
833
1260
  expectedPhaseMs: number | null;
1261
+ /** Milliseconds spent in phases already left; sums repeat visits, excludes the current visit, and is omitted before any phase completes and by older Stim. */
1262
+ completedPhaseMs?: Partial<Record<BuildPhase, number>>;
834
1263
  basis: number;
835
1264
  /**
836
1265
  * The phases a run like this one goes through, in order, with each one's median in milliseconds, from the same
@@ -1274,6 +1703,7 @@ interface MetroBundleState {
1274
1703
  };
1275
1704
  }
1276
1705
  interface SimulatorState {
1706
+ host?: HostedIosStatus;
1277
1707
  name: string | null;
1278
1708
  udid: string;
1279
1709
  owned: boolean;
@@ -1308,6 +1738,8 @@ interface EnvironmentState {
1308
1738
  android: AndroidDeviceState | null | undefined;
1309
1739
  }[];
1310
1740
  path: string;
1741
+ /** Statically detected app platforms; always set by status, empty when none are detected. */
1742
+ platforms?: string[];
1311
1743
  live: boolean;
1312
1744
  phase?: WorkspacePhase;
1313
1745
  /** When the warm started (`warming`) or finished (`ready`); null for `live` and `idle`. */
@@ -1362,6 +1794,9 @@ interface EnvironmentState {
1362
1794
  dir: string;
1363
1795
  errorsSinceMarker: number;
1364
1796
  } | null;
1797
+ agentDevice?: {
1798
+ stateDir: string;
1799
+ };
1365
1800
  worktree?: WorktreeFacts | null;
1366
1801
  remoteDevices?: RemoteDeviceState[];
1367
1802
  /** The physical devices this workspace leases, in every slot; absent when it leases none. */
@@ -1438,6 +1873,9 @@ interface MachineUsageState {
1438
1873
  }
1439
1874
  /** The payload `stim status --json` prints, and `status --watch --json` prints on each change. */
1440
1875
  interface StatusPayload {
1876
+ maintenance?: MaintenanceStatus;
1877
+ archived?: ArchivedWorkspace[];
1878
+ archivedUsage?: ArchivedUsage;
1441
1879
  environments: (EnvironmentState & {
1442
1880
  labelOnly?: true;
1443
1881
  })[];
@@ -1564,6 +2002,7 @@ interface StatsPlacement {
1564
2002
  reason: string;
1565
2003
  machine?: string;
1566
2004
  buildMs?: number;
2005
+ slotWaitMs?: number;
1567
2006
  /** The project's last cold build here before this run. */
1568
2007
  localEstimateMs?: number;
1569
2008
  failed?: true;
@@ -1646,6 +2085,8 @@ interface StatsReport {
1646
2085
  android: StatsBucket | null;
1647
2086
  };
1648
2087
  offload: OffloadSummary;
2088
+ agentDevice: AgentDeviceUsage | null;
2089
+ swiftpmCache: SwiftpmCacheUsage | null;
1649
2090
  }
1650
2091
  declare function readStatsReport(key: string | null, now: number): {
1651
2092
  report: StatsReport;
@@ -1653,107 +2094,6 @@ declare function readStatsReport(key: string | null, now: number): {
1653
2094
  };
1654
2095
  declare function findProjectRoot(startDir: string): string | null;
1655
2096
  //#endregion
1656
- //#region state/device-host.d.ts
1657
- type HostedDevicePlatform = "ios" | "android" | "macos";
1658
- interface HostedIosChoice {
1659
- deviceTypeId: string;
1660
- runtimeId: string;
1661
- deviceType: string;
1662
- runtime: string;
1663
- architecture: "arm64" | "x86_64";
1664
- }
1665
- interface HostedIosDevice extends HostedIosChoice {
1666
- udid: string;
1667
- name: string;
1668
- }
1669
- interface HostedAndroidChoice {
1670
- systemImage: string;
1671
- deviceProfile: string;
1672
- architecture: "arm64-v8a" | "x86_64";
1673
- }
1674
- interface HostedAndroidDevice extends HostedAndroidChoice {
1675
- avdName: string;
1676
- serial: string;
1677
- consolePort: number;
1678
- }
1679
- type HostedDevice = HostedIosDevice | HostedAndroidDevice | HostedMacosDevice;
1680
- interface HostedDeviceSelectors {
1681
- deviceType?: string;
1682
- runtime?: string;
1683
- systemImage?: string;
1684
- deviceProfile?: string;
1685
- }
1686
- interface HostedDeviceOfferRequest extends HostedDeviceSelectors {
1687
- platform: HostedDevicePlatform;
1688
- }
1689
- type HostedNativeOffer = {
1690
- resources: {
1691
- cpus: number;
1692
- /** Five-minute system load divided by available CPU count. */
1693
- loadPerCore: number;
1694
- memoryFreeBytes: number;
1695
- memoryPressure: "normal" | "warning" | "critical" | null;
1696
- /** Available bytes on the Stim home volume, not necessarily the Android AVD volume. */
1697
- workerDiskFreeBytes: number | null;
1698
- };
1699
- declined: string | null;
1700
- } & ({
1701
- platform: "ios";
1702
- choice: HostedIosChoice | null;
1703
- } | {
1704
- platform: "android";
1705
- choice: HostedAndroidChoice | null;
1706
- } | {
1707
- platform: "macos";
1708
- choice: HostedMacosChoice | null;
1709
- });
1710
- type HostedDeviceOffer = HostedNativeOffer & {
1711
- capacity: {
1712
- running: number;
1713
- max: number;
1714
- available: number | null;
1715
- };
1716
- };
1717
- interface HostedDeviceRequest extends HostedDeviceOfferRequest {
1718
- workspace: string;
1719
- slot: string;
1720
- attempt: string;
1721
- }
1722
- type HostedDevicePhase = "preparing" | "ready" | "stopping" | "stopped" | "unknown";
1723
- interface HostedDeviceSession extends HostedDeviceRequest {
1724
- id: string;
1725
- client: string;
1726
- state: HostedDevicePhase;
1727
- device: HostedDevice | null;
1728
- consolePort?: number;
1729
- appSlot?: number;
1730
- createdAt: string;
1731
- notice?: string;
1732
- appAttempt?: string;
1733
- metroPort?: number;
1734
- }
1735
- declare function deviceHostRoot(): string;
1736
- declare function deviceHostArea(id: string): string;
1737
- declare function parseHostedChoice(value: unknown): HostedIosChoice | null;
1738
- declare function parseHostedDevice(value: unknown): HostedIosDevice | null;
1739
- declare function parseHostedAndroidDevice(value: unknown): HostedAndroidDevice | null;
1740
- /** Android Emulator -help-port defines the supported even console ports as 5554 through 5584. */
1741
- declare function hostedConsolePort(value: unknown): value is number;
1742
- declare function parseHostedPlatformDevice(value: unknown, platform: HostedDevicePlatform): HostedDevice | null;
1743
- declare function hostedDeviceId(device: HostedDevice): string;
1744
- declare function parseHostedRequest(value: unknown): HostedDeviceRequest | null;
1745
- declare function parseHostedOfferRequest(value: unknown): HostedDeviceOfferRequest | null;
1746
- declare function parseHostedNativeOffer(value: unknown): HostedNativeOffer | null;
1747
- /** A missing established journal or malformed record is a refusal, never an empty reservation set. */
1748
- declare function readHostedSessions(): HostedDeviceSession[];
1749
- /** The private worker's exact device record; an absent record is unresolved after creation started. */
1750
- declare function readHostedDevice(home: string): HostedIosDevice;
1751
- declare function readHostedDevice(home: string, platform: "android"): HostedAndroidDevice;
1752
- declare function readHostedDevice(home: string, platform: "macos"): HostedMacosDevice;
1753
- declare function readHostedDevice(home: string, platform: HostedDevicePlatform): HostedDevice;
1754
- /** Hosted sessions use isolated homes: only one exact device of their platform may appear in this ledger. */
1755
- declare function assertHostedDeviceLedger(home: string, id: string, platform?: HostedDevicePlatform): void;
1756
- //#endregion
1757
2097
  //#region state/device-host-machines.d.ts
1758
2098
  /** A separately approved hosting machine, pinned before sending its device token. */
1759
2099
  interface DeviceHostMachineCredential {
@@ -1764,11 +2104,33 @@ interface DeviceHostMachineCredential {
1764
2104
  deviceToken: string;
1765
2105
  state: "pending" | "approved";
1766
2106
  requestedAt: string;
2107
+ ticketHash?: string;
1767
2108
  }
1768
2109
  /** An absent store is empty; unreadable or malformed credentials refuse access without discarding pins. */
1769
2110
  declare function readDeviceHostMachines(): DeviceHostMachineCredential[];
1770
2111
  //#endregion
2112
+ //#region state/hosted-metro.d.ts
2113
+ declare const HOSTED_METRO_REQUESTS_KEY = "hostedMetroRequests";
2114
+ declare const HOSTED_METRO_GATEWAYS_KEY = "hostedMetroGateways";
2115
+ /** Private supervisor request, keyed by hosted session; never part of a public payload. */
2116
+ interface HostedMetroRequest {
2117
+ id: string;
2118
+ machine: string;
2119
+ address: string;
2120
+ peer: string;
2121
+ secret: string;
2122
+ }
2123
+ interface HostedMetroGateway {
2124
+ id: string;
2125
+ processToken: string;
2126
+ port?: number;
2127
+ error?: string;
2128
+ }
2129
+ declare function hostedMetroRequests(state: WorkspaceState | null): Record<string, HostedMetroRequest>;
2130
+ declare function hostedMetroGateways(state: WorkspaceState | null): Record<string, HostedMetroGateway>;
2131
+ //#endregion
1771
2132
  //#region state/tailnet.d.ts
2133
+ declare const TAILNET_MACHINE_PATTERN: string;
1772
2134
  interface TailnetPeer {
1773
2135
  nodeId: string;
1774
2136
  dnsName: string;
@@ -1809,6 +2171,8 @@ type HostedLogsCursor = Record<string, number>;
1809
2171
  interface HostedLogsPage {
1810
2172
  records: NdjsonRecord[];
1811
2173
  cursor: HostedLogsCursor;
2174
+ /** Last completed iOS collection window, for detecting catch-up progress independently of file offsets. */
2175
+ checkpoint?: number;
1812
2176
  /** True when the budget ended this page before the end of the logs; ask again with `cursor`. */
1813
2177
  more: boolean;
1814
2178
  }
@@ -1816,6 +2180,13 @@ declare const HOSTED_LOGS_PAGE_BYTES: number;
1816
2180
  declare const HOSTED_LOGS_FIRST_BYTES: number;
1817
2181
  declare function parseHostedLogsCursor(value: unknown): HostedLogsCursor | null;
1818
2182
  declare function hostedMacosLogsDir(home: string): string | null;
2183
+ declare const hostedIosLogsDir: (home: string) => string;
2184
+ /** The completed query window and overlap digests, or null for a missing, malformed or unreadable checkpoint. */
2185
+ declare function readHostedIosLogsCheckpoint(home: string): {
2186
+ until: number;
2187
+ boundary: string[];
2188
+ windowMs?: number;
2189
+ } | null;
1819
2190
  /**
1820
2191
  * The records in `dir` after `cursor`, in file order. A file without a cursor entry starts at most
1821
2192
  * {@link HOSTED_LOGS_FIRST_BYTES} before its end. A file that shrank since the cursor was taken was rotated: the end of
@@ -1823,4 +2194,35 @@ declare function hostedMacosLogsDir(home: string): string | null;
1823
2194
  */
1824
2195
  declare function readLogsSince(dir: string, cursor: HostedLogsCursor): HostedLogsPage;
1825
2196
  //#endregion
1826
- export { StatsPlacement as $, levelRank as $a, configLockPath as $i, DevServerStopRequest as $n, hostedAppAttempt as $r, BuildPhase as $t, deviceHostArea as A, workspaceStateFile as Aa, expectedShape as Ai, STATUS_ISSUE_CODES as An, DeviceRecord as Ao, readMacosRecord as Ar, withDerivedFacts as At, parseHostedRequest as B, followLogs as Ba, RecordingPlatform as Bi, WarmStep as Bn, MachineCapacity as Bo, HostedMacosPlacement as Br, AndroidDeviceState as Bt, HostedDeviceRequest as C, workspaceEndedAgentsFile as Ca, SettingsPayload as Ci, NativeBuildStep as Cn, getProjectSettings as Co, MacosAppRecord as Cr, listStatusCacheEntries as Ct, HostedIosDevice as D, workspaceLogsDir as Da, WebViewport as Di, PlannedPhase as Dn, withConfigLock as Do, macosAppState as Dr, readDiskUsage as Dt, HostedIosChoice as E, workspaceLogErrorIndex as Ea, WEB_VIEWPORTS as Ei, PhysicalDeviceState as En, loadConfig as Eo, MacosProcess as Er, readBuildDetail as Et, parseHostedChoice as F, attachExpoErrorContext as Fa, RECORDING_CAP_BYTES as Fi, StatusIssueCode as Fn, SettingsObject as Fo, HostedAgentGrant as Fr, ActiveBuildState as Ft, OffloadSummary as G, readLogRecords as Ga, listSegments as Gi, WorktreeFacts as Gn, tryAcquireBuildSlotClaim as Go, parseHostedMacosDevice as Gr, BuildCacheHit as Gt, readHostedSessions as H, markerWindow as Ha, closedSegmentName as Hi, WebPageState as Hn, buildSlotsDir as Ho, hostedMacosBundleId as Hr, AppPresence as Ht, parseHostedDevice as I, buildCriteria as Ia, RECORDING_FOOTAGE_MS as Ii, StatusPayload as In, StimConfig as Io, HostedAgentLease as Ir, ActivityDriver as It, RunEstimates as J, tailRead as Ja, recordingDeviceName as Ji, BUILD_HISTORY_KEY as Jn, HostedAppDelivery as Jr, BuildDiagnostic as Jt, PLACEMENT_DECISIONS as K, recordMatches as Ka, openSegmentName as Ki, WorktreeGit as Kn, parseHostedMacosPlacement as Kr, BuildCause as Kt, parseHostedNativeOffer as L, bundleMarkerPlatform as La, RECORDING_PLATFORMS as Li, WEB_PAGE_STATES as Ln, SupervisorRecord as Lo, HostedAppLaunch as Lr, ActivityRecencyBasis as Lt, hostedConsolePort as M, ERROR_SOURCES as Ma, isSensitiveReference as Mi, StatsPlatform as Mn, PlatformRecords as Mo, HOSTED_MACOS_APP_SLOTS as Mr, ACTIVITY_RECENCY_BASES as Mt, hostedDeviceId as N, QueryCriteria as Na, settingDefinition as Ni, StatusCapacity as Nn, ProjectRecord as No, HostedAgentAccess as Nr, AGENT_TOOLS as Nt, HostedNativeOffer as O, workspaceMetadataFile as Oa, acceptsShape as Oi, RemoteDeviceState as On, ConcurrencyLimits as Oo, parseMacosRecord as Or, readEndedAgentSessions as Ot, parseHostedAndroidDevice as P, advanceTail as Pa, settingValueError as Pi, StatusIssue as Pn, RepoRecord as Po, HostedAgentDriverName as Pr, APP_PROCESS_STATES as Pt, StatsBucket as Q, SOURCES as Qa, buildMachinesLock as Qi, DevServerStopRecord as Qn, hostedAppArea as Qr, BuildMissReason as Qt, parseHostedOfferRequest as R, compileGrep as Ra, RecordedDevice as Ri, WORKSPACE_PHASES as Rn, BuildMachineCredential as Ro, HostedMacosChoice as Rr, AgentSession as Rt, HostedDevicePlatform as S, workspaceDerivedData as Sa, SettingType as Si, NATIVE_BUILD_STEPS as Sn, getProjectSetting as So, workspaceLastUsed as Sr, endedAgentSessionOf as St, HostedDeviceSession as T, workspaceGradleBuild as Ta, TunnelMode as Ti, PhysicalDeviceConnection as Tn, isPathPrefix as To, MacosBuild as Tr, readAgentSessionsCache as Tt, BuildMachineTotals as U, parseSince as Ua, footageDrops as Ui, WorkspacePhase as Un, machineCapacity as Uo, parseHostedAgentGrant as Ur, BUILD_PHASES as Ut, readHostedDevice as V, logFiles as Va, capDrops as Vi, WebBrowserState as Vn, buildSlotPath as Vo, hostedMacosAppSlot as Vr, AndroidRuntimeFacts as Vt, HISTORY_LIMIT as W, queryLogs as Wa, listRecordedDevices as Wi, WorkspaceStage as Wn, saturation as Wo, parseHostedMacosChoice as Wr, BUILD_RESULTS as Wt, RunSample as X, LEVELS as Xa, agentSessionsCacheFile as Xi, DEVICE_IDLE_SHUTDOWN_KEY as Xn, HostedAppOffer as Xr, BuildMissCategory as Xt, RunHistory as Y, countErrorEntries as Ya, recordingEnabled as Yi, BUILD_HISTORY_LIMIT as Yn, HostedAppFile as Yr, BuildHistoryEntry as Yt, STATS_VERSION as Z, NdjsonRecord as Za, buildMachinesFile as Zi, DEV_SERVER_STOP_REQUEST_KEY as Zn, HostedAppRecord as Zr, BuildMissChange as Zt, HostedAndroidDevice as _, sharedPods as _a, SETTING_GROUPS as _i, MachineOwner as _n, configCorruptRepair as _o, readIdleStop as _r, ENDED_AGENT_RETENTION_MS as _t, hostedMacosLogsDir as a, deviceViewersDir as aa, SETTINGS_SCHEMA_FILE as ai, DeviceActivity as an, EasSessionClaim as ao, READY_PHASE_MS as ar, offloadSummary as at, HostedDeviceOfferRequest as b, supervisorPidFile as ba, SettingEntry as bi, MemorySource as bn, getConcurrencyLimits as bo, readWorkspaceAgent as br, agentSessionOf as bt, Endpoint as c, easSessionLedgerFile as ca, ANDROID_COMPILER_CACHE_CHOICES as ci, DiskMeasure as cn, readEasSessionLedger as co, WarmRecord as cr, readStatsReport as ct, findPeer as d, getConfigPath as da, IOS_SIMULATOR_APPS as di, EnvironmentState as dn, readJsonFile as do, lastUseFrom as dr, wholePhases as dt, createdDevicesFile as ea, parseHostedAppManifest as ei, BuildPlacement as en, parseNdjsonLine as eo, DeviceIdleShutdownRecord as er, StatsRecord as et, parseMachine as f, gitMergeCacheDir as fa, OFFLOAD_MODES as fi, GitChip as fn, readJsonObject as fo, parseMissReason as fr, DeviceViewersRecord as ft, HostedAndroidChoice as g, sharedGradle as ga, SETTINGS as gi, MEMORY_SOURCES as gn, buildWorkerRoot as go, readDeviceIdleShutdowns as gr, AgentSessionsCache as gt, readDeviceHostMachines as h, sharedCompilationCache as ha, RemoteDeviceBackend as hi, MACHINE_OWNER_KINDS as hn, allMetroPorts as ho, readDevServerStopRequest as hr, stimBuildDigest as ht, HostedLogsPage as i, deviceHostMachinesLock as ia, validHostedAppArguments as ii, ChecksState as in, CreatedDevices as io, MetroLastStop as ir, findProjectRoot as it, deviceHostRoot as j, workspaceStateLock as ja, isLayeredSetting as ji, SimulatorState as jn, DoctorRunRecord as jo, HOSTED_AGENT_DRIVERS as jr, withGitChip as jt, assertHostedDeviceLedger as k, workspaceRecordingsDir as ka, coerceSettingText as ki, RunOutcomeKind as kn, Config as ko, readHostedMacosApp as kr, readPullRequestCache as kt, TailnetPeer as l, easSessionLedgerLock as la, ANDROID_EMULATOR_APPS as li, EndedAgentSession as ln, validEasSessionClaim as lo, WorkspaceState as lr, statsProjectKey as lt, DeviceHostMachineCredential as m, sharedCcache as ma, REMOTE_DEVICE_BACKENDS as mi, LastBuildReport as mn, withStateReadCache as mo, readDevServerStop as mr, readViewedDevices as mt, HOSTED_LOGS_PAGE_BYTES as n, deviceHostMachinesClaims as na, readHostedApp as ni, BuildReport as nn, readNdjsonGenerations as no, IdleStopRecord as nr, StatsScope as nt, parseHostedLogsCursor as o, diskUsageCacheDir as oa, SETTINGS_SCHEMA_URL as oi, DeviceAppProcess as on, EasSessionLedgerRead as oo, WARM_KEY as or, readRunEstimates as ot, pinnedEndpoint as p, pullRequestCacheDir as pa, OffloadMode as pi, GitChipPart as pn, readStateFile as po, readBuildHistory as pr, ViewedDevice as pt, ReadStatsResult as q, sortByTs as qa, recordedBytes as qi, WorktreePullRequest as qn, HOSTED_APP_CHUNK_BYTES as qr, BuildDetail as qt, HostedLogsCursor as r, deviceHostMachinesFile as ra, readHostedAppMetadata as ri, BuildResult as rn, CreatedDevicePlatform as ro, LAST_BUILD_KEYS as rr, decodeStats as rt, readLogsSince as s, easMachineStateRoot as sa, settingsJsonSchema as si, DeviceLeaseState as sn, readCreatedDevices as so, WORKSPACE_AGENT_KEY as sr, readStats as st, HOSTED_LOGS_FIRST_BYTES as t, createdDevicesLock as ta, parseHostedAppOffer as ti, BuildPlanPayload as tn, parseNdjsonText as to, IDLE_STOP_KEY as tr, StatsReport as tt, endpoint as u, emulatorLogFile as ua, ANDROID_PCH_CHOICES as ui, EnvironmentDisk as un, isJsonObject as uo, buildDiagnostics as ur, trimSamples as ut, HostedDevice as v, statsFile as va, SETTING_SCOPES as vi, MachineOwnerKind as vn, findEnclosingWorktreeRoot as vo, readLastBuilds as vr, PullRequestCacheEntry as vt, HostedDeviceSelectors as w, workspaceEndedAgentsLock as wa, TUNNEL_MODES as wi, PHYSICAL_DEVICE_CONNECTIONS as wn, getRepoSettings as wo, MacosAppState as wr, pullRequestCacheFile as wt, HostedDevicePhase as x, workspaceBuildDetailFile as xa, SettingScope as xi, MetroBundleState as xn, getProject as xo, readWorkspaceState as xr, diskUsageCacheFile as xt, HostedDeviceOffer as y, supervisorLogFile as ya, SettingDefinition as yi, MachineUsageState as yn, findProjectByMetroPort as yo, readWarmRecord as yr, StatusCacheEntry as yt, parseHostedPlatformDevice as z, fileSizes as za, RecordedSegment as zi, WORKSPACE_STAGE_KINDS as zn, readBuildMachines as zo, HostedMacosDevice as zr, AgentTool as zt };
2197
+ //#region state/agent-device.d.ts
2198
+ declare function agentDeviceStateDirs(home?: string): string[];
2199
+ //#endregion
2200
+ //#region state/setup-journal.d.ts
2201
+ type SetupCapability = "build" | "device-host";
2202
+ interface SetupJournal {
2203
+ v: 1;
2204
+ client: {
2205
+ nodeId: string;
2206
+ };
2207
+ expiresAt: string;
2208
+ capabilities: SetupCapability[];
2209
+ steps: {
2210
+ id: string;
2211
+ state: "pending" | "running" | "ok" | "skipped" | "failed";
2212
+ title: string;
2213
+ detail?: string;
2214
+ fix?: string;
2215
+ }[];
2216
+ granted: {
2217
+ capability: SetupCapability;
2218
+ id: string;
2219
+ }[];
2220
+ done: boolean;
2221
+ exit?: number;
2222
+ }
2223
+ declare function parseSetupJournal(value: unknown): SetupJournal | null;
2224
+ declare function readSetupJournal(hash: string): SetupJournal | null;
2225
+ declare function isJournalExpired(journal: SetupJournal, now?: number): boolean;
2226
+ declare function isSetupJournalPrunable(journal: SetupJournal, now: number): boolean;
2227
+ //#endregion
2228
+ export { trimSamples as $, createdDevicesLock as $a, validHostedAppBlob as $i, MaintenanceAction as $n, queryLogs as $o, HostedDevicePhase as $r, AgentDeviceUsageRoots as $s, EnvironmentDisk as $t, DeviceHostMachineCredential as A, RECORDING_CAP_BYTES as Aa, HostedMacosDevice as Ai, WebBrowserState as An, workspaceEndedAgentsFile as Ao, READY_PHASE_MS as Ar, withConfigLock as As, AndroidRuntimeFacts as At, STATS_VERSION as B, listSegments as Ba, HostedAppDelivery as Bi, MacosProcess as Bn, NATIVE_CRASH_LOG_PREFIX as Bo, readDevServerStopRequest as Br, SupervisorRecord as Bs, BuildMissChange as Bt, pinnedEndpoint as C, acceptsShape as Ca, HOSTED_MACOS_APP_SLOTS as Ci, StatusIssue as Cn, sharedPods as Co, DevServerStopRecord as Cr, getConcurrencyLimits as Cs, APP_PROCESS_STATES as Ct, HostedMetroRequest as D, isSensitiveReference as Da, HostedAgentLease as Di, WORKSPACE_PHASES as Dn, workspaceAgentDeviceDir as Do, IdleStopRecord as Dr, getRepoSettings as Ds, AgentSession as Dt, HostedMetroGateway as E, isLayeredSetting as Ea, HostedAgentGrant as Ei, WEB_PAGE_STATES as En, supervisorPidFile as Eo, IDLE_STOP_KEY as Er, getProjectSettings as Es, ActivityRecencyBasis as Et, PLACEMENT_DECISIONS as F, RecordingPlatform as Fa, parseHostedAgentGrant as Fi, WorktreeGit as Fn, workspaceMetadataFile as Fo, buildDiagnostics as Fr, PlatformRecords as Fs, BuildCause as Ft, StatsScope as G, agentSessionsCacheFile as Ga, hostedAppAttempt as Gi, ArchivedBytes as Gn, bundleMarkerPlatform as Go, readWorkspaceAgent as Gr, buildSlotsDir as Gs, BuildReport as Gt, StatsPlacement as H, recordedBytes as Ha, HostedAppOffer as Hi, parseMacosRecord as Hn, advanceTail as Ho, readIdleStop as Hr, readBuildMachines as Hs, BuildPhase as Ht, ReadStatsResult as I, capDrops as Ia, parseHostedMacosChoice as Ii, WorktreePullRequest as In, workspaceRecordingsDir as Io, lastUseFrom as Ir, ProjectRecord as Is, BuildDetail as It, offloadSummary as J, archiveRoot as Ja, parseHostedAppOffer as Ji, archiveEnabled as Jn, followLogs as Jo, HostedAndroidChoice as Jr, tryAcquireBuildSlotClaim as Js, DeviceActivity as Jt, decodeStats as K, archiveDir as Ka, hostedAppBlobs as Ki, ArchivedUsage as Kn, compileGrep as Ko, readWorkspaceState as Kr, machineCapacity as Ks, BuildResult as Kt, RunEstimates as L, closedSegmentName as La, parseHostedMacosDevice as Li, MacosAppRecord as Ln, workspaceStateFile as Lo, parseMissReason as Lr, RepoRecord as Ls, BuildDiagnostic as Lt, BuildMachineTotals as M, RECORDING_PLATFORMS as Ma, hostedMacosAppSlot as Mi, WorkspacePhase as Mn, workspaceGradleBuild as Mo, WORKSPACE_AGENT_KEY as Mr, Config as Ms, BUILD_PHASES as Mt, HISTORY_LIMIT as N, RecordedDevice as Na, hostedMacosBundleId as Ni, WorkspaceStage as Nn, workspaceLogErrorIndex as No, WarmRecord as Nr, DeviceRecord as Ns, BUILD_RESULTS as Nt, hostedMetroGateways as O, settingDefinition as Oa, HostedAppLaunch as Oi, WORKSPACE_STAGE_KINDS as On, workspaceBuildDetailFile as Oo, LAST_BUILD_KEYS as Or, isPathPrefix as Os, AgentTool as Ot, OffloadSummary as P, RecordedSegment as Pa, parseHostedAgentAccess as Pi, WorktreeFacts as Pn, workspaceLogsDir as Po, WorkspaceState as Pr, DoctorRunRecord as Ps, BuildCacheHit as Pt, statsProjectKey as Q, createdDevicesFile as Qa, validHostedAppArguments as Qi, readArchives as Qn, queryJsonLogs as Qo, HostedDeviceOfferRequest as Qr, AgentDeviceUsage as Qs, EndedAgentSession as Qt, RunHistory as R, footageDrops as Ra, parseHostedMacosPlacement as Ri, MacosAppState as Rn, workspaceStateLock as Ro, readBuildHistory as Rr, SettingsObject as Rs, BuildHistoryEntry as Rt, parseMachine as S, WebViewport as Sa, HOSTED_AGENT_DRIVERS as Si, StatusCapacity as Sn, sharedGradle as So, DEV_SERVER_STOP_REQUEST_KEY as Sr, findProjectByMetroPort as Ss, AGENT_TOOLS as St, HOSTED_METRO_REQUESTS_KEY as T, expectedShape as Ta, HostedAgentDriverName as Ti, StatusPayload as Tn, supervisorLogFile as To, DeviceIdleShutdownRecord as Tr, getProjectSetting as Ts, ActivityDriver as Tt, StatsRecord as U, recordingDeviceName as Ua, HostedAppRecord as Ui, readHostedMacosApp as Un, attachExpoErrorContext as Uo, readLastBuilds as Ur, MachineCapacity as Us, BuildPlacement as Ut, StatsBucket as V, openSegmentName as Va, HostedAppFile as Vi, macosAppState as Vn, QueryCriteria as Vo, readDeviceIdleShutdowns as Vr, BuildMachineCredential as Vs, BuildMissReason as Vt, StatsReport as W, recordingEnabled as Wa, hostedAppArea as Wi, readMacosRecord as Wn, buildCriteria as Wo, readWarmRecord as Wr, buildSlotPath as Ws, BuildPlanPayload as Wt, readStats as X, buildMachinesLock as Xa, readHostedAppMetadata as Xi, linkReplacedArchives as Xn, markerWindow as Xo, HostedDevice as Xr, readSwiftpmCacheUsage as Xs, DeviceLeaseState as Xt, readRunEstimates as Y, buildMachinesFile as Ya, readHostedApp as Yi, archivedUsage as Yn, logFiles as Yo, HostedAndroidDevice as Yr, SwiftpmCacheUsage as Ys, DeviceAppProcess as Yt, readStatsReport as Z, configLockPath as Za, rememberHostedAppBlobRename as Zi, readArchive as Zn, parseSince as Zo, HostedDeviceOffer as Zr, swiftpmCacheUsageFile as Zs, DiskMeasure as Zt, Endpoint as _, SettingType as _a, parseHostedPlatformDevice as _i, RemoteDeviceState as _n, pullRequestCacheDir as _o, parseHostedIosPlacement as _r, withStateReadCache as _s, readEndedAgentSessions as _t, parseSetupJournal as a, ANDROID_PCH_CHOICES as aa, createAgentActionReader as ac, HostedIosDevice as ai, MEMORY_SOURCES as an, easMachineStateRoot as ao, MaintenanceRecord as ar, countErrorEntries as as, AgentSessionsCache as at, endpoint as b, TunnelMode as ba, readHostedDeviceLedger as bi, SimulatorState as bn, sharedCcache as bo, BUILD_HISTORY_LIMIT as br, configCorruptRepair as bs, withGitChip as bt, HOSTED_LOGS_FIRST_BYTES as c, OffloadMode as ca, SOURCES as cc, deviceHostArea as ci, MachineUsageState as cn, emulatorLogFile as co, MaintenanceStatus as cr, EasSessionClaim as cs, StatusCacheEntry as ct, HostedLogsPage as d, SETTINGS as da, parseNdjsonText as dc, hostedDeviceId as di, NATIVE_BUILD_STEPS as dn, maintenanceAttemptFile as do, readMaintenanceState as dr, readEasSessionLedger as ds, endedAgentSessionOf as dt, SETTINGS_SCHEMA_FILE as ea, agentDeviceUsageFile as ec, HostedDevicePlatform as ei, EnvironmentState as en, deviceHostMachinesClaims as eo, MaintenanceActionKind as er, readLogRecords as es, wholePhases as et, hostedIosLogsDir as f, SETTING_GROUPS as fa, readNdjsonGenerations as fc, parseHostedAndroidDevice as fi, NativeBuildStep as fn, maintenanceChildLogFile as fo, HostedIosPlacement as fr, validEasSessionClaim as fs, listStatusCacheEntries as ft, readLogsSince as g, SettingScope as ga, parseHostedOfferRequest as gi, PlannedPhase as gn, maintenanceStateFile as go, hostedIosStatus as gr, readStateFile as gs, readDiskUsage as gt, readHostedIosLogsCheckpoint as h, SettingEntry as ha, parseHostedNativeOffer as hi, PhysicalDeviceState as hn, maintenanceRunClaims as ho, hostedIosRecords as hr, readJsonObject as hs, readBuildDetail as ht, isSetupJournalPrunable as i, ANDROID_EMULATOR_APPS as ia, AgentTarget as ic, HostedIosChoice as ii, MACHINE_OWNER_KINDS as in, diskUsageCacheDir as io, MaintenancePressure as ir, tailRead as is, stimBuildDigest as it, readDeviceHostMachines as j, RECORDING_FOOTAGE_MS as ja, HostedMacosPlacement as ji, WebPageState as jn, workspaceEndedAgentsLock as jo, WARM_KEY as jr, ConcurrencyLimits as js, AppPresence as jt, hostedMetroRequests as k, settingValueError as ka, HostedMacosChoice as ki, WarmStep as kn, workspaceDerivedData as ko, MetroLastStop as kr, loadConfig as ks, AndroidDeviceState as kt, HOSTED_LOGS_PAGE_BYTES as l, REMOTE_DEVICE_BACKENDS as la, levelRank as lc, deviceHostRoot as li, MemorySource as ln, getConfigPath as lo, parseMaintenanceState as lr, EasSessionLedgerRead as ls, agentSessionOf as lt, parseHostedLogsCursor as m, SettingDefinition as ma, parseHostedDevice as mi, PhysicalDeviceConnection as mn, maintenanceNdjsonFile as mo, hostedIosPlacements as mr, readJsonFile as ms, readAgentSessionsCache as mt, SetupJournal as n, settingsJsonSchema as na, readAgentDeviceUsageCache as nc, HostedDeviceSelectors as ni, GitChipPart as nn, deviceHostMachinesLock as no, MaintenanceMode as nr, recordMatches as ns, ViewedDevice as nt, readSetupJournal as o, IOS_SIMULATOR_APPS as oa, LEVELS as oc, HostedNativeOffer as oi, MachineOwner as on, easSessionLedgerFile as oo, MaintenanceSize as or, CreatedDevicePlatform as os, ENDED_AGENT_RETENTION_MS as ot, hostedMacosLogsDir as p, SETTING_SCOPES as pa, parseHostedChoice as pi, PHYSICAL_DEVICE_CONNECTIONS as pn, maintenanceDir as po, HostedIosStatus as pr, isJsonObject as ps, pullRequestCacheFile as pt, findProjectRoot as q, archiveLock as qa, parseHostedAppManifest as qi, ArchivedWorkspace as qn, fileSizes as qo, workspaceLastUsed as qr, saturation as qs, ChecksState as qt, isJournalExpired as r, ANDROID_COMPILER_CACHE_CHOICES as ra, AgentActionReaderOptions as rc, HostedDeviceSession as ri, LastBuildReport as rn, deviceViewersDir as ro, MaintenancePass as rr, sortByTs as rs, readViewedDevices as rt, agentDeviceStateDirs as s, OFFLOAD_MODES as sa, NdjsonRecord as sc, assertHostedDeviceLedger as si, MachineOwnerKind as sn, easSessionLedgerLock as so, MaintenanceState as sr, CreatedDevices as ss, PullRequestCacheEntry as st, SetupCapability as t, SETTINGS_SCHEMA_URL as ta, readAgentDeviceUsage as tc, HostedDeviceRequest as ti, GitChip as tn, deviceHostMachinesFile as to, MaintenanceCheck as tr, readLogTimeline as ts, DeviceViewersRecord as tt, HostedLogsCursor as u, RemoteDeviceBackend as ua, parseNdjsonLine as uc, hostedConsolePort as ui, MetroBundleState as un, gitMergeCacheDir as uo, readMaintenanceAttempt as ur, readCreatedDevices as us, diskUsageCacheFile as ut, TAILNET_MACHINE_PATTERN as v, SettingsPayload as va, parseHostedRequest as vi, RunOutcomeKind as vn, serverSetupDir as vo, unreadableHostedIos as vr, allMetroPorts as vs, readPullRequestCache as vt, HOSTED_METRO_GATEWAYS_KEY as w, coerceSettingText as wa, HostedAgentAccess as wi, StatusIssueCode as wn, statsFile as wo, DevServerStopRequest as wr, getProject as ws, ActiveBuildState as wt, findPeer as x, WEB_VIEWPORTS as xa, readHostedSessions as xi, StatsPlatform as xn, sharedCompilationCache as xo, DEVICE_IDLE_SHUTDOWN_KEY as xr, findEnclosingWorktreeRoot as xs, ACTIVITY_RECENCY_BASES as xt, TailnetPeer as y, TUNNEL_MODES as ya, readHostedDevice as yi, STATUS_ISSUE_CODES as yn, setupJournalFile as yo, BUILD_HISTORY_KEY as yr, buildWorkerRoot as ys, withDerivedFacts as yt, RunSample as z, listRecordedDevices as za, HOSTED_APP_CHUNK_BYTES as zi, MacosBuild as zn, ERROR_SOURCES as zo, readDevServerStop as zr, StimConfig as zs, BuildMissCategory as zt };