stim 1.16.0 → 1.17.1

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 (108) hide show
  1. package/dist/{activity-BxwdD81S.mjs → activity-IRvJY_ru.mjs} +23 -3
  2. package/dist/{agent-device-usage-output-Dpih1Tfa.mjs → agent-device-usage-output-BK41vnzN.mjs} +3 -3
  3. package/dist/{android-Ift4kVvt.mjs → android-B6rDWrTm.mjs} +681 -319
  4. package/dist/{android-B_NumVyQ.mjs → android-B_YNZy61.mjs} +7 -43
  5. package/dist/{android-r2rBL8kV.mjs → android-DE4v59Mb.mjs} +12 -3
  6. package/dist/{android-cas-8U4DPqeR.mjs → android-cas-ZFpjJBL_.mjs} +6 -5
  7. package/dist/{app-install-CKWdbXIX.mjs → app-install-VPkI5WEg.mjs} +6 -5
  8. package/dist/{budget-DjrURfQn.mjs → budget-CUDz870h.mjs} +62 -25
  9. package/dist/{build-plan-DjeSb2Xl.mjs → build-plan-BJSXzsCL.mjs} +345 -86
  10. package/dist/{idle-DYVymG92.mjs → build-progress-D0WkjCPd.mjs} +170 -233
  11. package/dist/{build-slots-rUk77xqh.mjs → build-slots-41v_d2x9.mjs} +35 -25
  12. package/dist/{cli-BkYZ_6hy.mjs → cli-BLQqDGlX.mjs} +17 -17
  13. package/dist/cli.mjs +1 -1
  14. package/dist/{client-BTY686R6.mjs → client-CxNotugx.mjs} +313 -44
  15. package/dist/collector-run.mjs +3 -3
  16. package/dist/{command-output-DnJMdEY-.mjs → command-output-CDAIFD-8.mjs} +3 -3
  17. package/dist/{created-devices-D5owjN4C.mjs → created-devices-CpvzBL25.mjs} +1 -1
  18. package/dist/{dependency-state-B6cMXZab.mjs → dependency-state-CLcBHH2M.mjs} +1 -1
  19. package/dist/{deps-urbmfXig.mjs → deps-CVxlsRFn.mjs} +1 -1
  20. package/dist/{dev-client-CroAIjjj.mjs → dev-client-B-XC4uRH.mjs} +2 -2
  21. package/dist/{device-DZQjF7H5.mjs → device-C8IOoJPv.mjs} +7 -7
  22. package/dist/device-capacity-ZC4XSZ4R.mjs +580 -0
  23. package/dist/device-host-worker.mjs +436 -154
  24. package/dist/{device-ios-BadmeL2V.mjs → device-ios-C2Um-XUR.mjs} +75 -44
  25. package/dist/{device-lease-D-hLqx1b.mjs → device-lease-DpoS36_u.mjs} +2 -2
  26. package/dist/{device-lease-run-CqjShqWW.mjs → device-lease-run-B8YltIH_.mjs} +3 -3
  27. package/dist/{device-pool-CUaEWMMm.mjs → device-pool-3o7s5lo4.mjs} +2 -2
  28. package/dist/{device-remote-D5WVWqOq.mjs → device-remote-hFSkpfQu.mjs} +12 -12
  29. package/dist/{doctor-Cimf-gGB.mjs → doctor-BF_435OC.mjs} +40 -58
  30. package/dist/{error-diagnostics-B9L4Ae0x.mjs → error-diagnostics-C-NMnhrk.mjs} +7 -7
  31. package/dist/{gc-Bqy4bjEu.mjs → gc-BsWKa_-d.mjs} +313 -30
  32. package/dist/{gradle-BsO1MdsH.mjs → gradle-bsBRy6i9.mjs} +3 -3
  33. package/dist/{guide-B_uyKTxW.mjs → guide-DC3n6-NH.mjs} +1776 -655
  34. package/dist/{guide-status-CjEZMAD4.mjs → guide-status-Du-ZQ3FD.mjs} +1 -1
  35. package/dist/hosted-android-DgU31wY3.mjs +32 -0
  36. package/dist/{hosted-client-a-WmqE2L.mjs → hosted-client-CdSoH-G6.mjs} +5 -6
  37. package/dist/hosted-ios-BTaVj4Jb.mjs +15 -0
  38. package/dist/{hosted-logs-D5g041Q3.mjs → hosted-logs-SxfBvSvc.mjs} +16 -16
  39. package/dist/{hosted-macos-BSZyIb3y.mjs → hosted-macos-CT9E3meL.mjs} +4 -4
  40. package/dist/{hosted-ios-CIWelIqf.mjs → hosted-native-CZLOrMrN.mjs} +77 -42
  41. package/dist/idle-BXG__1BA.mjs +176 -0
  42. package/dist/{idle-shutdown-CTsDnAde.mjs → idle-shutdown-IGyNV8Cr.mjs} +25 -17
  43. package/dist/{in-use-DvBw0Kxo.mjs → in-use-CvGOUn-x.mjs} +11 -11
  44. package/dist/{ios-aq3QoGI3.mjs → ios-C7JuT1bI.mjs} +173 -91
  45. package/dist/{ios-BaInn3sW.mjs → ios-DSfnPfse.mjs} +4 -4
  46. package/dist/{ios-device-FfCN_C8p.mjs → ios-device-pAN4t54-.mjs} +1 -1
  47. package/dist/ios-state-8L3lgum6.mjs +89 -0
  48. package/dist/{launch-verify-2DBRizjo.mjs → launch-verify-lTnWZikR.mjs} +2 -2
  49. package/dist/{logs-CHEVK8zD.mjs → logs-DNxKcok9.mjs} +36 -23
  50. package/dist/{macos-CSYEAFmF.mjs → macos-BEs8cwKx.mjs} +75 -34
  51. package/dist/macos-run.mjs +1 -1
  52. package/dist/maintenance-run.mjs +2 -2
  53. package/dist/{metro-BeK1ZPz1.mjs → metro-g8NqiJp-.mjs} +1 -1
  54. package/dist/{metro-gateway-BJ-rxQAB.mjs → metro-gateway-CHqK0p-a.mjs} +22 -3
  55. package/dist/{named-ports-Bk_YXEmE.mjs → named-ports-C8m8EQs2.mjs} +2 -2
  56. package/dist/{native-run-NaBrRFtQ.mjs → native-run-D1Q56rAD.mjs} +17 -6
  57. package/dist/{native-runtime-DBzRnEKS.mjs → native-runtime-YhaSxP4v.mjs} +6 -6
  58. package/dist/offload-worker.mjs +9 -9
  59. package/dist/{teardown-CL6vDs2Y.mjs → ownership-BMLqyBgJ.mjs} +603 -26
  60. package/dist/{ownership-DiA16AsN.mjs → ownership-DyRQru0q.mjs} +2 -2
  61. package/dist/{ports-R2k4Knz3.mjs → ports-4nYqxPWC.mjs} +2 -2
  62. package/dist/{prebuild-D2fsca_Z.mjs → prebuild-D7RUMkwN.mjs} +3 -3
  63. package/dist/{preview-DhVbvPAZ.mjs → preview-C_JjkEy4.mjs} +7 -7
  64. package/dist/{project-Du91Ilvc.mjs → project-D47Rh0ly.mjs} +7 -2
  65. package/dist/{recordings-BIXOzVnr.mjs → recordings-BNgsD1Tr.mjs} +1 -1
  66. package/dist/{reload-rM9jV1fz.mjs → reload-byOjE3P4.mjs} +62 -35
  67. package/dist/{remote-cache-C8-V13XN.mjs → remote-cache-Ci4DQYYj.mjs} +3 -3
  68. package/dist/{run-f4vI6EnK.mjs → run-CkE9y0nc.mjs} +1 -1
  69. package/dist/{server-bare-CpPGmnmO.mjs → server-bare-BkrSxSsZ.mjs} +1 -1
  70. package/dist/{server-expo-MC0rHlOC.mjs → server-expo-CHTyXD0G.mjs} +2 -2
  71. package/dist/server-expo-CeakhI8P.mjs +2 -0
  72. package/dist/{settings-oTSkkNrM.mjs → settings-Cfd-0r2d.mjs} +10 -9
  73. package/dist/{settings-ZkDzkzvB.mjs → settings-SR9OmW9h.mjs} +3 -3
  74. package/dist/settings.schema.json +123 -76
  75. package/dist/{simslim-B8-7AoTI.mjs → simslim-BWNrc3M3.mjs} +3 -3
  76. package/dist/{slot-launch-B8VrHxn1.mjs → slot-launch-DmjBmpQV.mjs} +8 -8
  77. package/dist/{start-CX8Ig-U2.mjs → start-BEP-XmEA.mjs} +1 -1
  78. package/dist/{start-ClDfwXa4.mjs → start-BHIersSm.mjs} +11 -11
  79. package/dist/{state-DcW6vOd_.mjs → state-BKa8wNN5.mjs} +1 -1
  80. package/dist/{state-3DwSQIBK.mjs → state-DyaNTgfR.mjs} +1 -1
  81. package/dist/{state-C1jB7Q8q.mjs → state-PeQiJuIu.mjs} +2 -2
  82. package/dist/{stats-CEZ_i5je.mjs → stats-Bq4fJOdB.mjs} +7 -4
  83. package/dist/{status-Cs7VLg9D.mjs → status-CqeWbIWW.mjs} +128 -38
  84. package/dist/{status-BuvBFeII.mjs → status-CzS4bPO9.mjs} +4 -4
  85. package/dist/{stop-Bffozsac.mjs → stop-Cj01je8D.mjs} +48 -27
  86. package/dist/{stop-B0Yxtmiy.mjs → stop-D03prQnW.mjs} +4 -4
  87. package/dist/{stop-Dt_dM16A.mjs → stop-DOxwkH4j.mjs} +2 -2
  88. package/dist/{stop-cause-CidxIqup.mjs → stop-cause-rhmGfwvt.mjs} +1 -1
  89. package/dist/supervisor-run.d.mts +7 -4
  90. package/dist/supervisor-run.mjs +26 -28
  91. package/dist/{support-D4aYJniO.mjs → support-BE-tbOP9.mjs} +45 -20
  92. package/dist/{support-CAP8qDUF.mjs → support-WvD__tSV.mjs} +7 -7
  93. package/dist/{toolchain-DkUflduf.mjs → toolchain-CdrxgUeA.mjs} +8 -8
  94. package/dist/{warm-progress-CpGv3Wb6.mjs → warm-progress-DF4JRvYI.mjs} +3 -3
  95. package/dist/watchman-APYjXSQa.mjs +48 -0
  96. package/dist/{web-DWUaMp8P.mjs → web-DddUdJzr.mjs} +12 -13
  97. package/dist/web-run.mjs +4 -4
  98. package/dist/{workspace-process-lock-BL7Q0HCO.mjs → workspace-process-lock-2mNzOlaB.mjs} +3 -2
  99. package/dist/{workspace-state-B8-aJ1_5.mjs → workspace-state-DqcCbpE7.mjs} +2 -2
  100. package/dist/{workspaces-BV4pdHFz.mjs → workspaces-Bcib97-6.mjs} +3 -3
  101. package/dist/{worktree-K-xj9Db0.mjs → worktree-AK_m-d_m.mjs} +141 -40
  102. package/dist/{worktree-jnG8Iph5.mjs → worktree-CsAjSmEo.mjs} +1 -1
  103. package/package.json +5 -5
  104. package/dist/device-capacity-BHwxNBlu.mjs +0 -136
  105. package/dist/ios-state-DS5UpYTH.mjs +0 -48
  106. package/dist/machines-BIBUdhpj.mjs +0 -265
  107. package/dist/ownership-hCkPzGmr.mjs +0 -571
  108. package/dist/server-expo-CVqO2c35.mjs +0 -2
@@ -1,56 +1,20 @@
1
1
  import { t as getExecutor } from "./exec-CaErVv7t.mjs";
2
2
  import { C as saveConfig, D as withConfigLock$1, H as projectDeviceSlots, I as assignSlotDevice, U as removeSlotDevice, _ as loadConfig$1, c as ensureConfig, d as getConfigDir, f as getConfigPath$1, z as deviceSlotPlatforms } from "./config-D0DbpZtM.mjs";
3
3
  import { n as ownership_claim_exports, t as process_identity_exports } from "./process-identity-BmRm1qV0.mjs";
4
- import { c as androidDataPartitionSizeBytes } from "./settings-oTSkkNrM.mjs";
5
- import { o as pidExists, u as signalProcessTree } from "./metro-BeK1ZPz1.mjs";
6
- import { n as readCreatedDevices$1, r as recordCreatedDevice, t as forgetCreatedDevice } from "./created-devices-D5owjN4C.mjs";
4
+ import { s as androidDataPartitionSizeBytes } from "./settings-Cfd-0r2d.mjs";
5
+ import { o as pidExists, u as signalProcessTree } from "./metro-g8NqiJp-.mjs";
6
+ import { n as readCreatedDevices$1, r as recordCreatedDevice, t as forgetCreatedDevice } from "./created-devices-CpvzBL25.mjs";
7
7
  import { n as settingDefault, r as stimDesktopInstalled, t as STIM_DESKTOP_OPEN_OPTIONS } from "./stim-desktop-Cnz8CPnl.mjs";
8
8
  import { join } from "node:path";
9
9
  import { existsSync, lstatSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "fs";
10
10
  import { homedir, tmpdir } from "os";
11
11
  import { dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, resolve as resolve$1 } from "path";
12
- import { ANDROID_EMULATOR_APPS, loadConfig, settingDefinition } from "@stim-cli/core/state";
12
+ import { ANDROID_EMULATOR_APPS, getParkedMax, loadConfig, settingDefinition } from "@stim-cli/core/state";
13
13
  import { isDeepStrictEqual } from "node:util";
14
+ //#region src/devices/sim-pool.ts
14
15
  const POOL_SETTING_REMEDY = "Run `stim guide settings` for the device pool bounds and where it can be set.";
15
- const MAX_SETTING = {
16
- ios: {
17
- key: "iosParkedMax",
18
- env: "STIM_POOL_IOS_PARKED_MAX"
19
- },
20
- android: {
21
- key: "androidParkedMax",
22
- env: "STIM_POOL_ANDROID_PARKED_MAX"
23
- }
24
- };
25
- function parseMax(raw, strings) {
26
- const value = strings && typeof raw === "string" ? /^\d+$/.test(raw.trim()) ? Number(raw.trim()) : NaN : raw;
27
- if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 0) return null;
28
- return value;
29
- }
30
- function parkedMaxSetting(platform, { config, env = process.env } = {}) {
31
- const { key, env: envKey } = MAX_SETTING[platform];
32
- const fromEnv = env[envKey];
33
- const explicit = fromEnv !== void 0 && fromEnv !== "";
34
- const pool = (config === void 0 ? loadConfig$1() : config)?.pool;
35
- if (!explicit && pool !== void 0 && (pool === null || typeof pool !== "object" || Array.isArray(pool))) return {
36
- max: 0,
37
- error: "Invalid pool value. Expected an object with simulator and emulator bounds."
38
- };
39
- const fromConfig = pool !== null && typeof pool === "object" && !Array.isArray(pool) ? pool[key] : void 0;
40
- const raw = explicit ? fromEnv : fromConfig;
41
- if (raw === void 0) return {
42
- max: env.STIM_HOME ? 0 : 3,
43
- error: null
44
- };
45
- const parsed = parseMax(raw, explicit);
46
- if (parsed === null) return {
47
- max: 0,
48
- error: `Invalid ${explicit ? envKey : `pool.${key}`} value ${JSON.stringify(raw)}. Expected a whole number of parked ${platform === "ios" ? "simulators" : "emulators"}, 0 or more.`
49
- };
50
- return {
51
- max: explicit ? parsed : env.STIM_HOME ? 0 : parsed,
52
- error: null
53
- };
16
+ function parkedMaxSetting(platform, options = {}) {
17
+ return getParkedMax(platform, options);
54
18
  }
55
19
  function isParkedRecord(value, platform) {
56
20
  if (value === null || typeof value !== "object" || Array.isArray(value)) return false;
@@ -1,5 +1,5 @@
1
1
  import { t as getExecutor } from "./exec-CaErVv7t.mjs";
2
- import { u as androidToolCwd } from "./android-B_NumVyQ.mjs";
2
+ import { u as androidToolCwd } from "./android-B_YNZy61.mjs";
3
3
  //#region src/collector/android.ts
4
4
  const LEVEL_BY_LETTER = {
5
5
  V: "debug",
@@ -45,7 +45,16 @@ function parseLogcatTimestamp({ month, day, hour, minute, second, millis }, now
45
45
  }
46
46
  function parseLogcatLine(line, { now = Date.now, clockOffsetMs = null } = {}) {
47
47
  if (typeof line !== "string") return null;
48
- const epoch = LOGCAT_EPOCH.exec(line.trimEnd());
48
+ const thread = /^\s*(\d+)\.(\d{3,6})\s+(\d+)\s+\d+\s+([A-Z])\s+(.*?):\s?(.*)$/.exec(line.trimEnd());
49
+ const epoch = thread ? [
50
+ thread[0],
51
+ thread[1],
52
+ thread[2],
53
+ thread[4],
54
+ thread[5],
55
+ thread[3],
56
+ thread[6]
57
+ ] : LOGCAT_EPOCH.exec(line.trimEnd());
49
58
  if (epoch) {
50
59
  const [, seconds, fraction, letter, tag, pid, msg] = epoch;
51
60
  if (!letter || !tag || !msg?.trim()) return null;
@@ -205,4 +214,4 @@ function watchAppPid({ serial, packageName, pid, intervalMs = null, exec = null,
205
214
  };
206
215
  }
207
216
  //#endregion
208
- export { watchAppPid as a, waitForAppPid as i, parseLogcatLine as n, startAndroidLogcat as r, androidClockOffset as t };
217
+ export { waitForAppPid as a, startAndroidLogcat as i, parseLogcatLine as n, watchAppPid as o, parsePidof as r, androidClockOffset as t };
@@ -1,11 +1,12 @@
1
1
  import { d as getConfigDir } from "./config-D0DbpZtM.mjs";
2
2
  import { r as register } from "./cache-manifest-DnUHBJaU.mjs";
3
- import { u as ensureWorkspaceStorage, w as withDirLock } from "./workspace-state-B8-aJ1_5.mjs";
3
+ import { u as ensureWorkspaceStorage, w as withDirLock$1 } from "./workspace-state-DqcCbpE7.mjs";
4
4
  import { createHash, randomUUID } from "node:crypto";
5
- import { accessSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, symlinkSync, writeFileSync } from "node:fs";
5
+ import { accessSync, constants, existsSync, mkdirSync, readFileSync, realpathSync, renameSync, statSync, writeFileSync } from "node:fs";
6
6
  import { join } from "node:path";
7
+ import { quotedPath } from "@stim-cli/core";
7
8
  import { isJsonObject, readJsonFile } from "@stim-cli/core/state";
8
- import { fileURLToPath } from "node:url";
9
+ import { fileURLToPath, pathToFileURL } from "node:url";
9
10
  //#region src/engine/android-cas.ts
10
11
  const CAS_TOOLCHAIN_FIELDS = [
11
12
  "clang",
@@ -121,11 +122,11 @@ function resolveAndroidCas(root, env = process.env) {
121
122
  const context = join(state, "context.json");
122
123
  mkdirSync(state, { recursive: true });
123
124
  mkdirSync(dir, { recursive: true });
124
- withDirLock(join(state, "setup.lock"), () => {
125
+ withDirLock$1(join(state, "setup.lock"), () => {
125
126
  for (const name of ["clang", "clang++"]) {
126
127
  const path = join(state, name);
127
128
  const temporary = `${path}.${randomUUID()}.tmp`;
128
- symlinkSync(scripts[3], temporary);
129
+ writeFileSync(temporary, `#!/bin/sh\nexec ${quotedPath(process.execPath)} --input-type=module --eval ${quotedPath(`import ${JSON.stringify(pathToFileURL(scripts[3]).href)}`)} "$0" "$@"\n`, { mode: 493 });
129
130
  renameSync(temporary, path);
130
131
  }
131
132
  const temporary = `${context}.${process.pid}.tmp`;
@@ -1,5 +1,5 @@
1
1
  import { t as getExecutor } from "./exec-CaErVv7t.mjs";
2
- import { D as uninstallIosApp, M as deviceHoldsApk, N as deviceHoldsBundle, l as iosSimulatorFailureAdvice, m as listUserApps } from "./ios-BaInn3sW.mjs";
2
+ import { D as uninstallIosApp, M as deviceHoldsApk, N as deviceHoldsBundle, l as iosSimulatorFailureAdvice, m as listUserApps } from "./ios-DSfnPfse.mjs";
3
3
  import { t as DEV_MENU_LAUNCH_ARGS } from "./ios-device-Ee7sDXfp.mjs";
4
4
  import { join } from "node:path";
5
5
  //#region src/engine/app-schemes.ts
@@ -656,13 +656,14 @@ function stopRunningAndroidApp(serial, packageName, exec) {
656
656
  }
657
657
  return { restartedPid: pid };
658
658
  }
659
- function launchAndroidApp({ serial, packageName, metroPort, devClientScheme = null, physical = false }, { exec = null } = {}) {
659
+ function launchAndroidApp({ serial, packageName, metroPort, devClientScheme = null, physical = false, bridgePort }, { exec = null } = {}) {
660
660
  const e = exec || getExecutor();
661
661
  const restart = stopRunningAndroidApp(serial, packageName, e);
662
662
  if (restart.failed) return restart;
663
663
  const reversed = reverseMetroPorts({
664
664
  serial,
665
- metroPort
665
+ metroPort: bridgePort ?? metroPort,
666
+ devicePorts: [metroPort]
666
667
  }, { exec: e });
667
668
  if (reversed.failed) return reversed;
668
669
  const prefs = writeDebugHttpHost({
@@ -675,7 +676,7 @@ function launchAndroidApp({ serial, packageName, metroPort, devClientScheme = nu
675
676
  if (!prefs.ok && Number(metroPort) !== 8081) {
676
677
  const fallback = reverseMetroPorts({
677
678
  serial,
678
- metroPort,
679
+ metroPort: bridgePort ?? metroPort,
679
680
  devicePorts: [DEFAULT_METRO_PORT]
680
681
  }, { exec: e });
681
682
  if (fallback.failed) return fallback;
@@ -848,4 +849,4 @@ function androidAppProcess(serial, packageName, { exec = null } = {}) {
848
849
  }
849
850
  }
850
851
  //#endregion
851
- export { pickDevClientScheme as C, restartedAppNote as S, schemesFromInfoPlist as T, installIosApp as _, IOS_DEV_MENU_OFF_DEFAULTS_PLIST as a, launchAndroidReleaseApp as b, androidDevClientUrl as c, devClientUrl as d, deviceShellArg as f, installConflictKind as g, installAndroidApp as h, INSTALL_ERROR as i, clearOtherUserApps as l, hasMetroReverse as m, ANDROID_DISABLE_AUTO_LAUNCH_EXTRA as n, LAUNCH_ERROR as o, ensureMetroReverse as p, DEFAULT_METRO_PORT as r, androidAppProcess as s, ADB_INSTALL_TIMEOUT_MS as t, devClientDeepLink as u, iosAppProcess as v, readBundleSchemes as w, launchIosApp as x, launchAndroidApp as y };
852
+ export { reverseMetroPorts as C, schemesFromInfoPlist as D, readBundleSchemes as E, restartedAppNote as S, pickDevClientScheme as T, installIosApp as _, IOS_DEV_MENU_OFF_DEFAULTS_PLIST as a, launchAndroidReleaseApp as b, androidDevClientUrl as c, devClientUrl as d, deviceShellArg as f, installConflictKind as g, installAndroidApp as h, INSTALL_ERROR as i, clearOtherUserApps as l, hasMetroReverse as m, ANDROID_DISABLE_AUTO_LAUNCH_EXTRA as n, LAUNCH_ERROR as o, ensureMetroReverse as p, DEFAULT_METRO_PORT as r, androidAppProcess as s, ADB_INSTALL_TIMEOUT_MS as t, devClientDeepLink as u, iosAppProcess as v, writeDebugHttpHost as w, launchIosApp as x, launchAndroidApp as y };
@@ -2,24 +2,24 @@ import { t as getExecutor } from "./exec-CaErVv7t.mjs";
2
2
  import { A as directorySize, D as withConfigLock$1, F as volumeRootFor, H as projectDeviceSlots, M as isOnMountedVolume, P as measuredDirectorySize, _ as loadConfig$1, a as clearDevice, d as getConfigDir, j as formatBytes, o as clearSupervisor, p as getProject, z as deviceSlotPlatforms } from "./config-D0DbpZtM.mjs";
3
3
  import { t as process_identity_exports } from "./process-identity-BmRm1qV0.mjs";
4
4
  import { i as registeredCaches } from "./cache-manifest-DnUHBJaU.mjs";
5
- import { l as phaseLine, o as formatLongDuration, u as plural } from "./command-output-DnJMdEY-.mjs";
6
- import { l as resolveProjectMetro, r as killMetroTree } from "./metro-BeK1ZPz1.mjs";
7
- import { d as sharedBuildCache, r as readWorkspaceState$1, v as workspaceDir } from "./workspace-state-B8-aJ1_5.mjs";
8
- import { a as capacity, l as environmentState, u as formatSpace } from "./status-BuvBFeII.mjs";
9
- import { i as recordGcResult, n as withIdleWorkspace, o as canonicalPath } from "./in-use-DvBw0Kxo.mjs";
10
- import { i as createDeviceProcessTables, p as workspaceActivity } from "./activity-BxwdD81S.mjs";
11
- import { h as listBuildLocks, i as listLeaseFiles, r as leaseIsExpired } from "./device-lease-D-hLqx1b.mjs";
12
- import { n as listBuildSlots } from "./build-slots-rUk77xqh.mjs";
13
- import { l as readPidFile, s as clearWorkspaceSupervisor } from "./state-DcW6vOd_.mjs";
14
- import { C as parseSubscriberNames, D as parseWatchmanPid, E as parseWatchmanClients, T as parseWatchRoots, i as idleShutdownCandidates, n as collectOwnedDeviceActivity, o as shutDownIdleDevices, s as workspaceBuildInProgress, t as collectIdleDevices, w as parseTriggerCount } from "./idle-DYVymG92.mjs";
15
- import { A as listAvds, I as ownedAvdDirectory, at as isStimOwnedSim, ct as dropParked, it as isStimOwnedAvd, pt as readParked, z as ownedAvdSerialResolver } from "./android-B_NumVyQ.mjs";
16
- import { _ as parseRuntimeVersion, f as listIosDeviceTypes, u as listAllIosSims } from "./ios-BaInn3sW.mjs";
17
- import { c as teardownParkedIosSim, i as teardownOwnedAvd, n as eraseParkedIosSim, o as teardownOwnedIosSim, s as teardownParkedAvd, t as eraseParkedAvd } from "./teardown-CL6vDs2Y.mjs";
18
- import { n as workspaceProcessLockError, t as withWorkspaceProcessLock } from "./workspace-process-lock-BL7Q0HCO.mjs";
19
- import { t as resolveSupervisorTarget } from "./ownership-hCkPzGmr.mjs";
20
- import { a as collectWorkspaceOutputs, r as clearWorkspaceOutputs } from "./workspaces-BV4pdHFz.mjs";
5
+ import { l as phaseLine, o as formatLongDuration, u as plural } from "./command-output-CDAIFD-8.mjs";
6
+ import { l as resolveProjectMetro, r as killMetroTree } from "./metro-g8NqiJp-.mjs";
7
+ import { d as sharedBuildCache, r as readWorkspaceState$1, v as workspaceDir } from "./workspace-state-DqcCbpE7.mjs";
8
+ import { a as capacity, l as environmentState, u as formatSpace } from "./status-CzS4bPO9.mjs";
9
+ import { i as recordGcResult, n as withIdleWorkspace, o as canonicalPath } from "./in-use-CvGOUn-x.mjs";
10
+ import { i as createDeviceProcessTables, p as workspaceActivity } from "./activity-IRvJY_ru.mjs";
11
+ import { h as listBuildLocks, i as listLeaseFiles, r as leaseIsExpired } from "./device-lease-DpoS36_u.mjs";
12
+ import { n as listBuildSlots } from "./build-slots-41v_d2x9.mjs";
13
+ import { l as readPidFile, s as clearWorkspaceSupervisor } from "./state-BKa8wNN5.mjs";
14
+ import { a as parseWatchmanPid, i as parseWatchmanClients, n as parseTriggerCount, r as parseWatchRoots, t as parseSubscriberNames } from "./watchman-APYjXSQa.mjs";
15
+ import { A as listAvds, I as ownedAvdDirectory, at as isStimOwnedSim, ct as dropParked, it as isStimOwnedAvd, pt as readParked, z as ownedAvdSerialResolver } from "./android-B_YNZy61.mjs";
16
+ import { _ as parseRuntimeVersion, f as listIosDeviceTypes, u as listAllIosSims } from "./ios-DSfnPfse.mjs";
17
+ import { _ as teardownParkedAvd, d as eraseParkedAvd, f as eraseParkedIosSim, g as teardownOwnedIosSim, m as teardownOwnedAvd, t as resolveSupervisorTarget, v as teardownParkedIosSim } from "./ownership-BMLqyBgJ.mjs";
18
+ import { n as workspaceProcessLockError, t as withWorkspaceProcessLock } from "./workspace-process-lock-2mNzOlaB.mjs";
19
+ import { i as idleShutdownCandidates, n as collectOwnedDeviceActivity, o as shutDownIdleDevices, s as workspaceBuildInProgress, t as collectIdleDevices } from "./idle-BXG__1BA.mjs";
20
+ import { a as collectWorkspaceOutputs, r as clearWorkspaceOutputs } from "./workspaces-Bcib97-6.mjs";
21
21
  import { n as supervisorError } from "./errors-B6W7FkxQ.mjs";
22
- import { l as withdrawDevServerStopRequest, s as requestDevServerStop } from "./stop-cause-CidxIqup.mjs";
22
+ import { l as withdrawDevServerStopRequest, s as requestDevServerStop } from "./stop-cause-rhmGfwvt.mjs";
23
23
  import { existsSync, readFileSync, statSync, statfsSync } from "node:fs";
24
24
  import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
25
25
  import { existsSync as existsSync$1, readdirSync as readdirSync$1, realpathSync as realpathSync$1, rmSync as rmSync$1, statSync as statSync$1 } from "fs";
@@ -490,7 +490,11 @@ function attributeMachineUsage({ processes, footprints, environments, roots, sim
490
490
  claim(pid, `metro:${env.path}`, workspaceOwner("metro", env, port ? `Metro :${port}` : "Metro", port ? String(port) : null));
491
491
  }
492
492
  if (root.build && present.has(root.build.pid)) {
493
- const label = root.build.platform === "ios" ? "iOS build" : "Android build";
493
+ const label = {
494
+ ios: "iOS build",
495
+ android: "Android build",
496
+ macos: "macOS build"
497
+ }[root.build.platform];
494
498
  claim(root.build.pid, `build:${env.path}`, workspaceOwner("build", env, label, root.build.platform));
495
499
  }
496
500
  for (const pid of root.macosPids ?? []) if (present.has(pid)) claim(pid, `macos:${env.path}`, workspaceOwner("macos", env, env.macos?.product ?? "macOS app", null));
@@ -1418,6 +1422,28 @@ async function inspectWatchmanMemory() {
1418
1422
  }));
1419
1423
  }
1420
1424
  //#endregion
1425
+ //#region src/commands/gc/archive-selector.ts
1426
+ const KIND_SELECTORS = {
1427
+ "archived-logs": "logs",
1428
+ "archived-recordings": "recordings",
1429
+ "archived-agent": "agentActions"
1430
+ };
1431
+ function parseArchiveSelector(scope) {
1432
+ const trimmed = scope.trim();
1433
+ const colon = trimmed.indexOf(":");
1434
+ const name = (colon === -1 ? trimmed : trimmed.slice(0, colon)).toLowerCase();
1435
+ const id = colon === -1 ? null : trimmed.slice(colon + 1);
1436
+ if (name === "archived") return {
1437
+ kind: null,
1438
+ id
1439
+ };
1440
+ const kind = KIND_SELECTORS[name];
1441
+ return kind ? {
1442
+ kind,
1443
+ id
1444
+ } : null;
1445
+ }
1446
+ //#endregion
1421
1447
  //#region src/commands/gc/caches.ts
1422
1448
  const DAY_MS$1 = 864e5;
1423
1449
  function cacheSweepIsScoped() {
@@ -1440,12 +1466,7 @@ const WORKSPACE_OUTPUTS = "workspaces";
1440
1466
  const RECORDINGS = "recordings";
1441
1467
  const PARKED_DEVICES = "parked";
1442
1468
  function includesArchives(name) {
1443
- const wanted = name?.trim().toLowerCase();
1444
- return Boolean(wanted && (wanted === "archived" || wanted.startsWith("archived:") || [
1445
- "archived-logs",
1446
- "archived-recordings",
1447
- "archived-agent"
1448
- ].includes(wanted)));
1469
+ return name ? parseArchiveSelector(name) !== null : false;
1449
1470
  }
1450
1471
  function includesParkedDevices(name) {
1451
1472
  return name?.trim().toLowerCase() === PARKED_DEVICES;
@@ -2614,6 +2635,22 @@ async function enforceBudget({ root, note, dryRun = false, budget: resolved }, o
2614
2635
  short
2615
2636
  };
2616
2637
  }
2638
+ async function peekBudget(root, overrides = {}) {
2639
+ const outcome = await enforceBudget({
2640
+ root,
2641
+ note: () => {},
2642
+ dryRun: true
2643
+ }, {
2644
+ ...overrides,
2645
+ step: async () => ({
2646
+ targets: [],
2647
+ failures: 0
2648
+ })
2649
+ });
2650
+ if (outcome.status !== "ok") return outcome.refusal.message;
2651
+ const shortfall = describeShortfall(outcome.budget, outcome.measure, outcome.short);
2652
+ return shortfall.length ? shortfall.join("; ") : null;
2653
+ }
2617
2654
  async function budgetGate(args, overrides = {}) {
2618
2655
  const outcome = await enforceBudget(args, overrides);
2619
2656
  return {
@@ -2697,4 +2734,4 @@ function budgetLine(report) {
2697
2734
  return `${report.volumes.length ? `${report.volumes.map((v) => `${v.freeGb} GB free on ${v.volume}`).join(", ")} (reclaims below ${Math.max(budget.minFreeDiskGb, budget.hardFloorDiskGb)} GB, ${budget.hardFloorDiskGb ? `refuses below ${budget.hardFloorDiskGb} GB` : "never refuses"})` : "disk budget off"}; ${report.memory ? `roughly ${report.memory.committedGb} GB of a ${budget.maxCommittedMemoryGb} GB memory budget committed` : "memory budget off"}`;
2698
2735
  }
2699
2736
  //#endregion
2700
- export { isWorkspacesScope as A, memoryCacheKind as B, unverifiedDeviceCommand as C, includesParkedDevices as D, includesArchives as E, trimCaches as F, reclaimMemory as G, memoryScope as H, GRADLE_DAEMONS_KIND as I, attributeMachineUsage as J, scopedMemoryReport as K, WATCHMAN_KIND as L, previewScopedEmptying as M, selectCaches as N, includesRecordings as O, selectsBeyondCaches as P, collectMemoryReport as R, findStaleProjectDevices as S, emptyCaches as T, memorySweepIsScoped as U, memoryLines as V, memoryWorkPending as W, discoverCaches as X, readFootprints as Y, sizeCaches as Z, describeUnverifiableDevices as _, machineNumber as a, findOrphanedDevices as b, stopOwnedMetroForReset as c, collectParkedAvds as d, collectParkedSims as f, describeParkedSims as g, deleteProjectDevices as h, inspectBudget as i, planCacheEmptying as j, includesWorkspaceOutputs as k, DEVICE_LIST_TIMEOUT_MS$1 as l, deleteParkedSims as m, budgetLine as n, readVolumeSpace as o, deleteParkedAvds as p, phase as q, enforceBudget as r, resolveBudget as s, budgetGate as t, collectDeviceLeases as u, deviceSweepIsScoped as v, withAndroidAvdSizes as w, findStaleDeviceRecords as x, eraseParkedDevices as y, inspectWatchmanMemory as z };
2737
+ export { sizeCaches as $, includesWorkspaceOutputs as A, collectMemoryReport as B, findStaleProjectDevices as C, includesArchives as D, emptyCaches as E, selectsBeyondCaches as F, memorySweepIsScoped as G, memoryCacheKind as H, trimCaches as I, scopedMemoryReport as J, memoryWorkPending as K, parseArchiveSelector as L, planCacheEmptying as M, previewScopedEmptying as N, includesParkedDevices as O, selectCaches as P, discoverCaches as Q, GRADLE_DAEMONS_KIND as R, findStaleDeviceRecords as S, withAndroidAvdSizes as T, memoryLines as U, inspectWatchmanMemory as V, memoryScope as W, attributeMachineUsage as X, phase as Y, readFootprints as Z, describeParkedSims as _, machineNumber as a, eraseParkedDevices as b, resolveBudget as c, collectDeviceLeases as d, collectParkedAvds as f, deleteProjectDevices as g, deleteParkedSims as h, inspectBudget as i, isWorkspacesScope as j, includesRecordings as k, stopOwnedMetroForReset as l, deleteParkedAvds as m, budgetLine as n, peekBudget as o, collectParkedSims as p, reclaimMemory as q, enforceBudget as r, readVolumeSpace as s, budgetGate as t, DEVICE_LIST_TIMEOUT_MS$1 as u, describeUnverifiableDevices as v, unverifiedDeviceCommand as w, findOrphanedDevices as x, deviceSweepIsScoped as y, WATCHMAN_KIND as z };