stim 1.15.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/dist/{activity-B2-kb7k0.mjs → activity-IRvJY_ru.mjs} +49 -16
  2. package/dist/agent-device-usage-output-BK41vnzN.mjs +411 -0
  3. package/dist/{android-Cu_L4RpL.mjs → android--GorydsK.mjs} +692 -321
  4. package/dist/{android-Db2eEMaf.mjs → android-B_YNZy61.mjs} +25 -60
  5. package/dist/{android-CYmq0jNi.mjs → android-DE4v59Mb.mjs} +12 -3
  6. package/dist/{android-cas-PnKfAdB2.mjs → android-cas-ZFpjJBL_.mjs} +6 -5
  7. package/dist/{app-install-CAAplXAt.mjs → app-install-VPkI5WEg.mjs} +52 -8
  8. package/dist/attempt-Bk2ouQVL.mjs +39 -0
  9. package/dist/{budget-CMiqghig.mjs → budget-DM984mnd.mjs} +372 -366
  10. package/dist/{build-plan-aeGMFX7e.mjs → build-plan-CmQCoyT-.mjs} +346 -88
  11. package/dist/{build-slots-Df1ApSuH.mjs → build-slots-41v_d2x9.mjs} +36 -21
  12. package/dist/{cli-0cX5s4NM.mjs → cli-Daxug5-K.mjs} +23 -17
  13. package/dist/cli.mjs +1 -1
  14. package/dist/collector-run.mjs +5 -192
  15. package/dist/{command-output-CliHHn7a.mjs → command-output-CDAIFD-8.mjs} +3 -3
  16. package/dist/{created-devices-BwVb3liH.mjs → created-devices-CpvzBL25.mjs} +1 -1
  17. package/dist/{dependency-state-BmsjKZ2H.mjs → dependency-state-CLcBHH2M.mjs} +1 -1
  18. package/dist/{deps-BFlKbOIp.mjs → deps-DNWaQs4V.mjs} +2 -2
  19. package/dist/{dev-client-CjzLoNs0.mjs → dev-client-B-XC4uRH.mjs} +3 -40
  20. package/dist/{device-BZ1IyS5A.mjs → device-C8IOoJPv.mjs} +7 -6
  21. package/dist/device-capacity-D0GWHnTM.mjs +580 -0
  22. package/dist/device-host-worker.mjs +587 -110
  23. package/dist/{device-ios-DMQBUPus.mjs → device-ios-Bc7vbGwl.mjs} +75 -44
  24. package/dist/{device-lease-W5Pi1q38.mjs → device-lease-DpoS36_u.mjs} +2 -2
  25. package/dist/{device-pool-B2r38YjS.mjs → device-lease-run-B8YltIH_.mjs} +5 -125
  26. package/dist/device-pool-3o7s5lo4.mjs +125 -0
  27. package/dist/{device-remote-9ulPsdhY.mjs → device-remote-hFSkpfQu.mjs} +13 -13
  28. package/dist/{doctor-BcE5xsBn.mjs → doctor-Cnk9d7Hm.mjs} +86 -59
  29. package/dist/{error-diagnostics-Cb0P1WLS.mjs → error-diagnostics-C-NMnhrk.mjs} +11 -15
  30. package/dist/{gc-BuL1Genr.mjs → gc-DxCL2A46.mjs} +478 -33
  31. package/dist/{gradle-CmdOBq1d.mjs → gradle-D7-L2Th3.mjs} +4 -4
  32. package/dist/{guide-cCSGRFd3.mjs → guide-DjrTQGik.mjs} +2198 -566
  33. package/dist/{guide-status-CIoWK6mG.mjs → guide-status-Du-ZQ3FD.mjs} +1 -1
  34. package/dist/hosted-android-DwLS4Mse.mjs +32 -0
  35. package/dist/hosted-client-wk1W_CNW.mjs +196 -0
  36. package/dist/hosted-ios-aMo7Cljf.mjs +15 -0
  37. package/dist/hosted-logs-DqYmWtXc.mjs +187 -0
  38. package/dist/hosted-macos-dlHXEeF5.mjs +135 -0
  39. package/dist/hosted-native-C9xJ9rpA.mjs +255 -0
  40. package/dist/{build-progress-C2Jv1AtA.mjs → idle-B2m-Ovod.mjs} +300 -9
  41. package/dist/{idle-shutdown-B5LPaNyY.mjs → idle-shutdown-_3oOV1V_.mjs} +25 -17
  42. package/dist/{in-use-CndPMilN.mjs → in-use-CvGOUn-x.mjs} +30 -10
  43. package/dist/ios-Cr1h5gnO.mjs +189 -0
  44. package/dist/{ios-Chob8ny7.mjs → ios-DE6duQoz.mjs} +819 -460
  45. package/dist/{ios-3CtCRhwr.mjs → ios-DSfnPfse.mjs} +4 -4
  46. package/dist/{ios-device-DERmMmk-.mjs → ios-device-pAN4t54-.mjs} +1 -1
  47. package/dist/ios-state-8L3lgum6.mjs +89 -0
  48. package/dist/{launch-verify-CLlofxRt.mjs → launch-verify-lTnWZikR.mjs} +3 -3
  49. package/dist/logs-DUoKlDoS.mjs +384 -0
  50. package/dist/{client-C2IS36Qf.mjs → machines-C2XiNwh9.mjs} +330 -37
  51. package/dist/{macos-BwtbUtTN.mjs → macos-32po3kUq.mjs} +23 -18
  52. package/dist/macos-run.mjs +1 -1
  53. package/dist/maintenance-run.d.mts +4 -0
  54. package/dist/maintenance-run.mjs +254 -0
  55. package/dist/{metro-Di8EN2Tb.mjs → metro-g8NqiJp-.mjs} +1 -1
  56. package/dist/metro-gateway-DmslUM30.mjs +103 -0
  57. package/dist/{named-ports-Dj_XBNaL.mjs → named-ports-C8m8EQs2.mjs} +2 -2
  58. package/dist/{native-run-DFDoIRbY.mjs → native-run-D1Q56rAD.mjs} +17 -6
  59. package/dist/{native-runtime-i6OkVg-w.mjs → native-runtime-DhJI3IVQ.mjs} +6 -6
  60. package/dist/{ndjson-CDY9IkVC.mjs → ndjson-PclOIwVY.mjs} +2 -2
  61. package/dist/offload-worker.d.mts +1 -0
  62. package/dist/offload-worker.mjs +13 -8
  63. package/dist/{teardown-BYuQafiA.mjs → ownership-BMLqyBgJ.mjs} +639 -53
  64. package/dist/{ownership-BkYxUtuj.mjs → ownership-DyRQru0q.mjs} +2 -2
  65. package/dist/{ports-DddwttKM.mjs → ports-4nYqxPWC.mjs} +2 -2
  66. package/dist/{prebuild-BvxDlD6C.mjs → prebuild-D7RUMkwN.mjs} +4 -4
  67. package/dist/preview-CxPRIEht.mjs +318 -0
  68. package/dist/{project-CV3tDFHl.mjs → project-D47Rh0ly.mjs} +72 -3
  69. package/dist/{recordings-GEXp4iBT.mjs → recordings-BNgsD1Tr.mjs} +1 -1
  70. package/dist/{reload-ChPiwvot.mjs → reload-qZei6iWn.mjs} +77 -13
  71. package/dist/{remote-cache-CO2elm_b.mjs → remote-cache-Ci4DQYYj.mjs} +4 -4
  72. package/dist/{run-B-xqRrsg.mjs → run-CkE9y0nc.mjs} +2 -2
  73. package/dist/{server-bare-X7PUgizL.mjs → server-bare-BkrSxSsZ.mjs} +1 -1
  74. package/dist/{server-expo-DhtX6bom.mjs → server-expo-CHTyXD0G.mjs} +4 -4
  75. package/dist/server-expo-CeakhI8P.mjs +2 -0
  76. package/dist/settings-BBpMcDbD.mjs +25 -0
  77. package/dist/settings-Cfd-0r2d.mjs +1440 -0
  78. package/dist/{settings-DbL6uhH8.mjs → settings-SR9OmW9h.mjs} +10 -4
  79. package/dist/settings.schema.json +472 -50
  80. package/dist/{simslim-Ciluxlq4.mjs → simslim-BWNrc3M3.mjs} +3 -3
  81. package/dist/{slot-launch-BY0BrOLh.mjs → slot-launch-DmjBmpQV.mjs} +10 -7
  82. package/dist/{spawn-entry-DncpJvWL.mjs → spawn-entry-jw19m8Nl.mjs} +1 -0
  83. package/dist/{start-CPO4wRg7.mjs → start-BopZcr4n.mjs} +1 -1
  84. package/dist/{start-CUD9nasA.mjs → start-uee1wWjY.mjs} +21 -17
  85. package/dist/{state-CaeaHbDA.mjs → state-BKa8wNN5.mjs} +1 -1
  86. package/dist/{state-BxCgeTQu.mjs → state-DyaNTgfR.mjs} +2 -2
  87. package/dist/{state-DFm77wRn.mjs → state-PeQiJuIu.mjs} +5 -5
  88. package/dist/{stats-DBLLFmKd.mjs → stats-Bq4fJOdB.mjs} +19 -5
  89. package/dist/{status-l84Gbvp2.mjs → status-CzS4bPO9.mjs} +5 -3
  90. package/dist/status-DlKvVJBE.mjs +49 -0
  91. package/dist/{status-DYXxNOT0.mjs → status-dXX2JX1C.mjs} +244 -50
  92. package/dist/{stop-CceYh1yG.mjs → stop-BCwvvs7F.mjs} +2 -2
  93. package/dist/{stop-Bad61z_2.mjs → stop-BjizrQwv.mjs} +83 -21
  94. package/dist/{stop-Bvf1MflS.mjs → stop-Cr1d8DSE.mjs} +4 -4
  95. package/dist/stop-cause-rhmGfwvt.mjs +97 -0
  96. package/dist/supervisor-run.d.mts +7 -4
  97. package/dist/supervisor-run.mjs +156 -27
  98. package/dist/{support-WLOzVKUv.mjs → support-BJPgYCu-.mjs} +61 -11
  99. package/dist/{support-CDQbDkL5.mjs → support-F9-sr0Oi.mjs} +6 -5
  100. package/dist/{toolchain-DmeYjXD9.mjs → toolchain-CNIBTIOv.mjs} +11 -11
  101. package/dist/trigger-Bemu8ytw.mjs +65 -0
  102. package/dist/trigger-CXts6qt1.mjs +2 -0
  103. package/dist/{warm-progress-DVHLN4uC.mjs → warm-progress-DF4JRvYI.mjs} +274 -5
  104. package/dist/watchman-APYjXSQa.mjs +48 -0
  105. package/dist/{web-k6w8-HnE.mjs → web-exQtGkoc.mjs} +14 -16
  106. package/dist/web-run.mjs +5 -5
  107. package/dist/{workspace-process-lock-BL7Q0HCO.mjs → workspace-process-lock-2mNzOlaB.mjs} +3 -2
  108. package/dist/{workspace-state-CL2V2Ons.mjs → workspace-state-DqcCbpE7.mjs} +34 -34
  109. package/dist/workspaces-Bcib97-6.mjs +306 -0
  110. package/dist/{worktree-BT_uULFx.mjs → worktree-Dc98cE6_.mjs} +1 -1
  111. package/dist/{worktree-qXKzADSC.mjs → worktree-ZpZR3S1k.mjs} +601 -33
  112. package/package.json +5 -5
  113. package/dist/device-capacity-DMuKC7nx.mjs +0 -136
  114. package/dist/hosted-macos-DwowNU7W.mjs +0 -447
  115. package/dist/logs-h9h6MUvE.mjs +0 -568
  116. package/dist/machine-usage-D_YYMzfR.mjs +0 -283
  117. package/dist/machines-CYtOCqcj.mjs +0 -259
  118. package/dist/merge-state-BnxLNQiM.mjs +0 -272
  119. package/dist/server-expo-KJeD109I.mjs +0 -2
  120. package/dist/settings-CduVcoxj.mjs +0 -680
  121. package/dist/stop-cause-CZ_Mr-v9.mjs +0 -665
  122. package/dist/watchman-Bx0wceoF.mjs +0 -238
  123. package/dist/worktree-C0c5Udwa.mjs +0 -753
@@ -1,238 +0,0 @@
1
- import { t as getExecutor } from "./exec-CaErVv7t.mjs";
2
- import { H as projectDeviceSlots } from "./config-D0DbpZtM.mjs";
3
- import { r as readWorkspaceState } from "./workspace-state-CL2V2Ons.mjs";
4
- import { i as idleForMs, n as createActivityReader } from "./activity-B2-kb7k0.mjs";
5
- import { o as formatLongDuration } from "./command-output-CliHHn7a.mjs";
6
- import { z as ownedAvdSerialResolver } from "./android-Db2eEMaf.mjs";
7
- import { i as teardownOwnedAvd, o as teardownOwnedIosSim } from "./teardown-BYuQafiA.mjs";
8
- import { r as activeBuildState, s as parseActiveBuild, t as ACTIVE_BUILD_KEY } from "./build-progress-C2Jv1AtA.mjs";
9
- import chalk from "chalk";
10
- //#region src/commands/gc/results.ts
11
- const results = [];
12
- function recordGcResult(kind, status, label, { id = null, bytes = null, detail = null } = {}) {
13
- results.push({
14
- kind,
15
- status,
16
- label,
17
- id,
18
- bytes,
19
- detail
20
- });
21
- }
22
- function takeGcResults() {
23
- return results.splice(0);
24
- }
25
- //#endregion
26
- //#region src/commands/gc/idle.ts
27
- function findOwnedDeviceActivity({ config, sims, androidSerial, readActivity, deadProjects = [] }) {
28
- const booted = new Map(sims.filter((sim) => sim.state === "Booted").map((sim) => [sim.udid, sim.name]));
29
- const dead = new Set(deadProjects);
30
- const found = [];
31
- for (const [project, record] of Object.entries(config?.projects ?? {})) {
32
- if (dead.has(project)) continue;
33
- for (const { slot, platforms } of projectDeviceSlots(record)) {
34
- const ios = platforms.ios;
35
- if (ios?.owned && ios.deviceUdid && booted.has(ios.deviceUdid)) found.push({
36
- kind: "ios",
37
- id: ios.deviceUdid,
38
- name: booted.get(ios.deviceUdid) ?? ios.deviceUdid,
39
- project,
40
- slot,
41
- activity: readActivity({
42
- platform: "ios",
43
- id: ios.deviceUdid,
44
- slot,
45
- workspace: project
46
- })
47
- });
48
- const android = platforms.android;
49
- const serial = android?.owned && android.avdName ? androidSerial(android.avdName) : null;
50
- if (android?.avdName && serial) found.push({
51
- kind: "android",
52
- id: android.avdName,
53
- name: android.avdName,
54
- project,
55
- slot,
56
- activity: readActivity({
57
- platform: "android",
58
- id: serial,
59
- slot,
60
- workspace: project
61
- })
62
- });
63
- }
64
- }
65
- return found;
66
- }
67
- function findIdleDevices({ buildInProgress, now, ...inputs }) {
68
- return findOwnedDeviceActivity(inputs).filter((device) => device.activity.state === "idle").map(({ kind, id, name, project, slot, activity }) => ({
69
- kind,
70
- id,
71
- name,
72
- project,
73
- slot,
74
- lastActivityAt: activity.lastActivityAt ?? null,
75
- idleForMs: idleForMs(activity, now),
76
- buildInProgress: buildInProgress(project)
77
- }));
78
- }
79
- function idleShutdownCandidates(devices, idleMs) {
80
- return devices.filter((d) => !d.buildInProgress && d.idleForMs !== null && d.idleForMs >= idleMs);
81
- }
82
- function parseIdleDuration(value) {
83
- const match = /^([1-9][0-9]*)(m|h|d)$/.exec(value.trim());
84
- if (!match) return null;
85
- const unit = {
86
- m: 6e4,
87
- h: 36e5,
88
- d: 864e5
89
- }[match[2]];
90
- return Number(match[1]) * unit;
91
- }
92
- function workspaceBuildInProgress(project) {
93
- const record = parseActiveBuild(readWorkspaceState(project)?.[ACTIVE_BUILD_KEY]);
94
- if (!record) return false;
95
- try {
96
- return activeBuildState(record.claim) !== "stale";
97
- } catch {
98
- return true;
99
- }
100
- }
101
- function deviceActivityInputs(config, sims, now) {
102
- const resolve = ownedAvdSerialResolver({ timeoutMs: 5e3 });
103
- return {
104
- config,
105
- sims,
106
- readActivity: createActivityReader({ now }),
107
- androidSerial: (avdName) => {
108
- try {
109
- return resolve(avdName).serial ?? null;
110
- } catch {
111
- return null;
112
- }
113
- }
114
- };
115
- }
116
- function collectOwnedDeviceActivity(config, sims, now = Date.now()) {
117
- return findOwnedDeviceActivity(deviceActivityInputs(config, sims, now));
118
- }
119
- function collectIdleDevices(config, sims, deadProjects, now = Date.now()) {
120
- return findIdleDevices({
121
- ...deviceActivityInputs(config, sims, now),
122
- deadProjects,
123
- now,
124
- buildInProgress: workspaceBuildInProgress
125
- });
126
- }
127
- function idleDeviceLines(devices) {
128
- if (devices.length === 0) return [];
129
- return [`Idle owned devices (${devices.length}) - booted with no driver, claim, or recent activity:`, ...devices.map((d) => {
130
- const slot = d.slot === "default" ? "" : ` [${d.slot}]`;
131
- const idle = d.idleForMs === null ? "idle for an unknown time" : `idle ${formatLongDuration(d.idleForMs)}`;
132
- const build = d.buildInProgress ? ", build in progress" : "";
133
- return ` ${d.kind}${slot} ${d.name} (${d.project}) -- ${idle}${build}`;
134
- })];
135
- }
136
- function shutDownIdleDevices(devices, idleMs, recollect) {
137
- const candidates = idleShutdownCandidates(devices, idleMs);
138
- const shutDown = [];
139
- if (candidates.length === 0) {
140
- console.log(chalk.dim(`No owned device has been idle for ${formatLongDuration(idleMs)} or more.`));
141
- return {
142
- failures: 0,
143
- shutDown
144
- };
145
- }
146
- const fresh = idleShutdownCandidates(recollect(), idleMs);
147
- let failures = 0;
148
- for (const device of candidates) {
149
- const what = `${device.kind} ${device.name}`;
150
- const current = fresh.find((d) => d.kind === device.kind && d.id === device.id && d.project === device.project && d.slot === device.slot);
151
- if (!current) {
152
- console.log(chalk.dim(`Kept ${what}: it is no longer idle for ${formatLongDuration(idleMs)}.`));
153
- recordGcResult("idleDevice", "kept", device.name, {
154
- id: device.id,
155
- detail: `it is no longer idle for ${formatLongDuration(idleMs)}`
156
- });
157
- continue;
158
- }
159
- const outcome = device.kind === "ios" ? teardownOwnedIosSim(device.id, { label: device.name }) : teardownOwnedAvd(device.id, { owner: {
160
- projectPath: device.project,
161
- slot: device.slot
162
- } });
163
- if (outcome.status === "torn-down") {
164
- shutDown.push(device);
165
- console.log(chalk.green(`Shut down ${what}, idle ${formatLongDuration(current.idleForMs)}`));
166
- recordGcResult("idleDevice", "done", device.name, {
167
- id: device.id,
168
- detail: `idle ${formatLongDuration(current.idleForMs)}`
169
- });
170
- } else if (outcome.status === "missing") console.log(chalk.dim(`${what} is already gone; nothing to shut down.`));
171
- else if (outcome.status === "skipped") {
172
- console.log(chalk.yellow(`Skipped ${what}: ${outcome.reason}`));
173
- recordGcResult("idleDevice", "kept", device.name, {
174
- id: device.id,
175
- detail: outcome.reason
176
- });
177
- } else {
178
- failures++;
179
- console.log(chalk.red(`Failed to shut down ${what}: ${outcome.reason}`));
180
- recordGcResult("idleDevice", "failed", device.name, {
181
- id: device.id,
182
- detail: outcome.reason
183
- });
184
- }
185
- }
186
- return {
187
- failures,
188
- shutDown
189
- };
190
- }
191
- //#endregion
192
- //#region src/watchman.ts
193
- /** Runs one watchman command with `--no-spawn`, so Stim never starts a daemon, and parses its JSON answer. */
194
- const runWatchman = async (args, timeoutMs) => JSON.parse(await getExecutor().runFileAsync("watchman", ["--no-spawn", ...args], { timeoutMs }));
195
- function parseWatchRoots(payload) {
196
- const roots = payload?.roots;
197
- if (!Array.isArray(roots)) return null;
198
- return roots.filter((root) => typeof root === "string");
199
- }
200
- function parseSubscriberNames(payload) {
201
- if (!payload || typeof payload !== "object" || "error" in payload) return null;
202
- const subscribers = payload.subscribers;
203
- if (subscribers === void 0) return [];
204
- if (!Array.isArray(subscribers)) return null;
205
- const names = [];
206
- for (const subscriber of subscribers) {
207
- const name = subscriber?.info?.name;
208
- if (typeof name !== "string") return null;
209
- names.push(name);
210
- }
211
- return names;
212
- }
213
- function parseTriggerCount(payload) {
214
- const triggers = payload?.triggers;
215
- return Array.isArray(triggers) ? triggers.length : null;
216
- }
217
- function parseWatchmanPid(payload) {
218
- const pid = payload?.pid;
219
- return typeof pid === "number" && Number.isInteger(pid) && pid > 0 ? pid : null;
220
- }
221
- /** The connected clients in a `debug-status` answer, or null when the answer does not list them. */
222
- function parseWatchmanClients(payload) {
223
- if (!payload || typeof payload !== "object" || "error" in payload) return null;
224
- const clients = payload.clients;
225
- if (!Array.isArray(clients)) return null;
226
- const parsed = [];
227
- for (const client of clients) {
228
- const peer = client?.peer;
229
- if (typeof peer?.pid !== "number") return null;
230
- parsed.push({
231
- pid: peer.pid,
232
- name: typeof peer.name === "string" ? peer.name : null
233
- });
234
- }
235
- return parsed;
236
- }
237
- //#endregion
238
- export { parseWatchmanPid as a, collectOwnedDeviceActivity as c, parseIdleDuration as d, shutDownIdleDevices as f, takeGcResults as h, parseWatchmanClients as i, idleDeviceLines as l, recordGcResult as m, parseTriggerCount as n, runWatchman as o, workspaceBuildInProgress as p, parseWatchRoots as r, collectIdleDevices as s, parseSubscriberNames as t, idleShutdownCandidates as u };