stim 1.32.0 → 1.34.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 (173) hide show
  1. package/dist/{acquire-artifact-CI9fIokp.mjs → acquire-artifact-B0SWoVNt.mjs} +2 -2
  2. package/dist/{act-BfChMxcU.mjs → act-7f7wIvCQ.mjs} +22 -22
  3. package/dist/{activity-yjH7Q3zn.mjs → activity-DkS-Ir6V.mjs} +6 -6
  4. package/dist/{agent-device-usage-output-DO412bsG.mjs → agent-device-usage-output-BVdgKbfz.mjs} +5 -5
  5. package/dist/{android-BeeC15Ve.mjs → android-B2DSKg-A.mjs} +2 -2
  6. package/dist/{android-D56S_GX3.mjs → android-BU4uBX8I.mjs} +5 -5
  7. package/dist/{android-BNm5A40S.mjs → android-D7qjT2fq.mjs} +87 -53
  8. package/dist/{android-DsEj2CCs.mjs → android-Iq0M2t2d.mjs} +27 -15
  9. package/dist/{android-cas-CbumHXIq.mjs → android-cas-Dhcjkys1.mjs} +4 -4
  10. package/dist/android-cas-compiler.mjs +1 -1
  11. package/dist/android-image-DFk26aY6.mjs +254 -0
  12. package/dist/{android-project-CCEQyYJK.d.mts → android-project-DhO6el8N.d.mts} +2 -2
  13. package/dist/api.d.mts +2 -1
  14. package/dist/api.mjs +28 -28
  15. package/dist/{apk-signed-tail-B9Usseps.mjs → apk-signed-tail-CPpA-3vu.mjs} +2 -2
  16. package/dist/{artifact-k1x9Jrn0.mjs → artifact-CNnTZs3R.mjs} +34 -21
  17. package/dist/{artifact-C8Nvp07y.mjs → artifact-DmRtKFXW.mjs} +13 -13
  18. package/dist/{artifact-platform-BO2Uvk_A.mjs → artifact-platform-DqCWUieN.mjs} +1 -1
  19. package/dist/{auto-placement--nfdQ9rp.mjs → auto-placement-DA65VQH7.mjs} +11 -9
  20. package/dist/{browser-web-6RDAeH0z.mjs → browser-web-Dn_hgKZC.mjs} +15 -15
  21. package/dist/{build-VXX_dtl5.mjs → build-D7SuVoRX.mjs} +23 -23
  22. package/dist/build-artifact-cache-D7B6seMj.mjs +174 -0
  23. package/dist/build-artifact-cache.d.mts +25 -0
  24. package/dist/build-artifact-cache.mjs +2 -0
  25. package/dist/{build-cache-BsKim4V7.mjs → build-cache-Cqj4FGnX.mjs} +20 -8
  26. package/dist/{build-plan-BK34X2iY.mjs → build-plan-Ct1FiA3E.mjs} +7 -7
  27. package/dist/{cache-manifest-CfiEny4T.mjs → cache-manifest-8JX9S1QJ.mjs} +1 -1
  28. package/dist/cache-manifest.mjs +1 -1
  29. package/dist/{ccache-BrwGIxmV.mjs → ccache-ChBMXlBq.mjs} +35 -67
  30. package/dist/{cdp-C3svvXiE.mjs → cdp-C216kOAn.mjs} +1 -1
  31. package/dist/{chrome-DyDWurWG.mjs → chrome-C8sC5tdl.mjs} +1 -1
  32. package/dist/{cli-Jc7obreB.mjs → cli-DjdvQG5U.mjs} +20 -20
  33. package/dist/cli.mjs +1 -1
  34. package/dist/{client-lDmA-5jx.mjs → client-kU37gURU.mjs} +70 -13
  35. package/dist/collector-run.mjs +7 -7
  36. package/dist/{command-output-CfPW1bKP.mjs → command-output-DjExb_tZ.mjs} +1 -1
  37. package/dist/{config-D5qNWJEP.mjs → config-BW0fAtoK.mjs} +256 -246
  38. package/dist/{dependencies-DkZ8681S.mjs → dependencies-CZ7c8XX_.mjs} +39 -39
  39. package/dist/{dependency-state-DZVln1P9.mjs → dependency-state-mL5g4H6K.mjs} +2 -2
  40. package/dist/{detached-entry-BPlSaCwC.mjs → detached-entry-tfrgGVWb.mjs} +1 -1
  41. package/dist/{dev-client-eDZy6RoX.mjs → dev-client-D3wOllNd.mjs} +2 -2
  42. package/dist/{device-CeIikWac.mjs → device-CWPFAqs0.mjs} +13 -13
  43. package/dist/{device-CTozKhU0.mjs → device-DH5yf6TU.mjs} +11 -11
  44. package/dist/{device-android-zgD9We85.mjs → device-android-ChfF5I9A.mjs} +10 -10
  45. package/dist/{device-capacity-Bki6B-7h.mjs → device-capacity-CHC3dKWg.mjs} +9 -9
  46. package/dist/device-host-worker.mjs +58 -17
  47. package/dist/{device-ios-TE5ejeXx.mjs → device-ios-B3-Ah--R.mjs} +9 -9
  48. package/dist/{device-lease-run-DeNGjJZM.mjs → device-lease-run-i3FNX4OE.mjs} +5 -5
  49. package/dist/{device-pool-mjyUYaau.mjs → device-pool-EZziQ0uS.mjs} +3 -3
  50. package/dist/{device-provision-j_B7G0e6.mjs → device-provision-CfpEy-Vm.mjs} +10 -10
  51. package/dist/{doctor-sSLtn-j1.mjs → doctor-B5uEZiKp.mjs} +30 -17
  52. package/dist/{doctor-CNZuvTSe.mjs → doctor-CGBsS_68.mjs} +1 -1
  53. package/dist/{doctor-BlrcoQ7B.mjs → doctor-dwRboaXx.mjs} +54 -25
  54. package/dist/{doctor-fingerprint-o7ZI9YLn.mjs → doctor-fingerprint-DqWvIhMb.mjs} +1 -1
  55. package/dist/doctor-fingerprint.mjs +1 -1
  56. package/dist/{doctor-watchman-CCuboyj1.mjs → doctor-watchman-r7M9UPi0.mjs} +5 -5
  57. package/dist/{eas-build-CaG-Sfs9.mjs → eas-build-BpHIt_M3.mjs} +4 -4
  58. package/dist/{eas-fallback-BpX1lpco.mjs → eas-fallback-CNPcjq3K.mjs} +6 -6
  59. package/dist/{eas-session-ledger-B-nTfdfk.mjs → eas-session-ledger-CXwagcQ7.mjs} +6 -6
  60. package/dist/{error-diagnostics-q56Im4D8.mjs → error-diagnostics-Ym2mjmJ0.mjs} +10 -10
  61. package/dist/{exec-aULwtNly.mjs → exec-CGuDzt40.mjs} +103 -103
  62. package/dist/{gc-By2Kc-Ek.mjs → gc-B464w_a5.mjs} +2 -2
  63. package/dist/{gc-Dv6nb9nf.mjs → gc-C7YxKNci.mjs} +25 -54
  64. package/dist/{guide-CwpsGWTJ.mjs → guide-BFW-cB7R.mjs} +141 -44
  65. package/dist/{hosted-android-c5nPJA6S.mjs → hosted-android-B7yfqXEy.mjs} +4 -4
  66. package/dist/{hosted-client-Hs-fD4L3.mjs → hosted-client-CQuzZwAu.mjs} +6 -5
  67. package/dist/{hosted-logs-BteXG8rm.mjs → hosted-logs-DfYCqrrR.mjs} +7 -7
  68. package/dist/{hosted-logs-sync-B8bjLEMs.mjs → hosted-logs-sync-Dlpa2mQF.mjs} +5 -5
  69. package/dist/{hosted-macos-B4byscei.mjs → hosted-macos-JKefapEm.mjs} +6 -6
  70. package/dist/{hosted-native-Bh9IJ_t5.mjs → hosted-native-B7OFt5gB.mjs} +14 -10
  71. package/dist/{idle-shutdown-BaeCo4ps.mjs → idle-shutdown-DPD8oV36.mjs} +6 -6
  72. package/dist/{ios-CdAV4-1E.mjs → ios-BdZdNsAj.mjs} +6 -6
  73. package/dist/{ios-D3oK9-O4.mjs → ios-DSBs9c6d.mjs} +28 -28
  74. package/dist/{ios-CsRVik64.mjs → ios-Qam0bT9n.mjs} +1 -1
  75. package/dist/{ios-device-CiBA-er9.mjs → ios-device-DLdEDWJj.mjs} +1 -1
  76. package/dist/{ios-device-D7Gi3e1I.mjs → ios-device-Drplrgzo.mjs} +3 -3
  77. package/dist/{ios-project-DDQlX_jX.mjs → ios-project-DoTQYghg.mjs} +7 -7
  78. package/dist/{ios-D1XKSITX.mjs → ios-sUPbWqEh.mjs} +8 -8
  79. package/dist/ios-signing-R34vbrNU.mjs +202 -0
  80. package/dist/{ios-state-BEIJRJ7P.mjs → ios-state-CWsBysyN.mjs} +1 -1
  81. package/dist/{js-swap-C8N5DXHl.mjs → js-swap-DrokhOfo.mjs} +6 -6
  82. package/dist/{launch-DxpvL6il.mjs → launch-Cy-MWEZc.mjs} +20 -20
  83. package/dist/{lightened-Df6II_XI.mjs → lightened-ALwQcQtV.mjs} +5 -5
  84. package/dist/{logs-zv3ge7c6.mjs → logs-DWT7jGpF.mjs} +6 -6
  85. package/dist/{logs-CuWJWF88.mjs → logs-DuED-01Z.mjs} +7 -7
  86. package/dist/{macos-C6U-4Iip.mjs → macos-CtBtA_hW.mjs} +22 -22
  87. package/dist/{macos-CbRZheLw.mjs → macos-kWGcfLzx.mjs} +1 -1
  88. package/dist/macos-run.mjs +1 -1
  89. package/dist/maintenance-run.mjs +6 -6
  90. package/dist/{metro-mKHEMO-a.mjs → metro-B5PVz0Wv.mjs} +4 -4
  91. package/dist/{metro-request-DODHNXCN.mjs → metro-request-2LmFpC1z.mjs} +2 -2
  92. package/dist/{named-ports-B0hCk2v-.mjs → named-ports-CA0nB9Yw.mjs} +3 -3
  93. package/dist/{native-android-9dVFqvTT.mjs → native-android-tISP2EVp.mjs} +29 -19
  94. package/dist/{native-gradle-artifact-inputs-BlY97pt8.mjs → native-gradle-artifact-inputs-DVoeZkrw.mjs} +5 -5
  95. package/dist/{native-runtime-DQfxW5Au.mjs → native-runtime-CNgxeOCG.mjs} +6 -6
  96. package/dist/{native-source-D1AzWiuP.mjs → native-source-ChAGj7R1.mjs} +1 -1
  97. package/dist/{native-xcode-inputs-tDuUvSU8.mjs → native-xcode-inputs-DGzkhpu4.mjs} +3 -3
  98. package/dist/{native-xcode-ios-CG-PD-7g.mjs → native-xcode-ios-B9nsfId2.mjs} +17 -17
  99. package/dist/offload-worker.d.mts +8 -1
  100. package/dist/offload-worker.mjs +62 -23
  101. package/dist/{operation-exec-Dp4FuIGR.mjs → operation-exec-DKlBcKAL.mjs} +1 -1
  102. package/dist/{ownership-CCfiBfOP.mjs → ownership-hC7xvvxF.mjs} +3 -3
  103. package/dist/{page-CQJlcj3x.mjs → page-Dj8IqvGM.mjs} +2 -2
  104. package/dist/{phone-reverses-CnNwdz9A.mjs → phone-reverses-Bo0EzJ-P.mjs} +4 -4
  105. package/dist/{placement-log-CRL0IY-k.mjs → placement-log-BsGvKLtU.mjs} +1 -1
  106. package/dist/{plan-placement-2imvnlWP.mjs → plan-placement-Am0IjuxB.mjs} +6 -6
  107. package/dist/{ports-CKktj5lV.mjs → ports-CNzg1LYD.mjs} +3 -3
  108. package/dist/{prebuild-CyNrUWgV.mjs → prebuild-BfJII57G.mjs} +12 -12
  109. package/dist/{project-Crtcbfl0.mjs → project-DU3jjnBE.mjs} +16 -16
  110. package/dist/{pull-request-BzLmzAIQ.mjs → pull-request-BpMTNkMB.mjs} +2 -2
  111. package/dist/pull-requests.mjs +1 -1
  112. package/dist/{react-native-android-Cabe2YER.mjs → react-native-android-3dZiJv-4.mjs} +37 -33
  113. package/dist/{react-native-build-DhWBUV_H.mjs → react-native-build-CuvNPt-q.mjs} +10 -10
  114. package/dist/{react-native-doctor-D-twmBon.mjs → react-native-doctor-a35BwMUO.mjs} +6 -6
  115. package/dist/{react-native-ios-u_ley41B.mjs → react-native-ios-CqnReM1t.mjs} +22 -17
  116. package/dist/{recordings-BWnIlhZH.mjs → recordings-AKZfsW2W.mjs} +1 -1
  117. package/dist/{registration-BwCe64PH.mjs → registration-DKjJGQ6p.mjs} +1 -1
  118. package/dist/{reload-D2TpUlns.mjs → reload-CC3sNo10.mjs} +17 -17
  119. package/dist/{reload-f9hvEHE9.mjs → reload-YPnvXGlB.mjs} +1 -1
  120. package/dist/{remote-BsBAjlD2.mjs → remote-BfaIHnhM.mjs} +9 -9
  121. package/dist/{result-EOsWV6sp.mjs → result-H-AxY7Ud.mjs} +24 -20
  122. package/dist/{run-2CHAJ9Oj.mjs → run-N-BbRxnC.mjs} +2 -2
  123. package/dist/{selection-C4ZQz_ER.mjs → selection-CH-MUVGD.mjs} +5 -4
  124. package/dist/{server-bare-CFyVFZXJ.mjs → server-bare-BTlICuaX.mjs} +2 -2
  125. package/dist/{server-command-BMyKtnjH.mjs → server-command-Bn_gOObU.mjs} +5 -5
  126. package/dist/server-expo-B59N16uT.mjs +2 -0
  127. package/dist/{server-expo-BLxcN2x2.mjs → server-expo-CUJ2fuv1.mjs} +3 -3
  128. package/dist/{settings-C6UTYW2K.mjs → settings-B5IBDfTx.mjs} +4 -4
  129. package/dist/{settings-jeS0WmUF.mjs → settings-DoWHJopy.mjs} +2 -2
  130. package/dist/{settings-payload-CrX933Xi.mjs → settings-payload-Bxw3hid5.mjs} +5 -5
  131. package/dist/{settings-write-DMcT23Kl.mjs → settings-write-C6d7EC54.mjs} +6 -6
  132. package/dist/settings.schema.json +38 -0
  133. package/dist/{simslim-93xmPh-d.mjs → simslim-DKdJx0LL.mjs} +2 -2
  134. package/dist/{slot-launch-CSpQcFZw.mjs → slot-launch-kq0-7w9C.mjs} +6 -6
  135. package/dist/{stage-Cf9uSM1a.mjs → stage-CBfMTUK3.mjs} +2 -2
  136. package/dist/{start-CquYgzVf.mjs → start-Diu8q6_U.mjs} +1 -1
  137. package/dist/{start-CLN_r9EG.mjs → start-WTMumMHi.mjs} +12 -12
  138. package/dist/{state-CM_HvvkS.mjs → state-CtmYTRWm.mjs} +4 -4
  139. package/dist/{state-CiflgxTP.mjs → state-DSOUqO-o.mjs} +2 -2
  140. package/dist/{stats-BVEZuSlg.mjs → stats-D4cW247z.mjs} +5 -5
  141. package/dist/{stats-report-B86Cv7Uc.mjs → stats-report-BVRCqwWA.mjs} +1 -1
  142. package/dist/{status-Bhdy07v0.mjs → status-B-oeWS0Z.mjs} +1 -1
  143. package/dist/{status-D0ruTmPl.mjs → status-CEwxo-PS.mjs} +37 -28
  144. package/dist/{status-GQ-JqvRi.mjs → status-DTFhDnd1.mjs} +1 -1
  145. package/dist/{status-watch-DSu_hhg6.mjs → status-watch-D63R5nSI.mjs} +5 -5
  146. package/dist/status-worker.mjs +1 -1
  147. package/dist/{stim-desktop-1XxET4S8.mjs → stim-desktop-_WTria-r.mjs} +2 -2
  148. package/dist/{stop-RZqER_Ww.mjs → stop-Dm9ON6Os.mjs} +2 -2
  149. package/dist/{stop-B616ZyTv.mjs → stop-HL2RvhrE.mjs} +5 -5
  150. package/dist/{stop-W4DK8qZq.mjs → stop-vX4w3_8V.mjs} +16 -16
  151. package/dist/supervisor-run.mjs +16 -16
  152. package/dist/{support-S_5nkkzs.mjs → support-BNe1_Hg7.mjs} +18 -8
  153. package/dist/{support-NxnD8QXd.mjs → support-ivsfDj0v.mjs} +9 -9
  154. package/dist/{swiftpm-artifact-inputs-yp8D5LE4.mjs → swiftpm-artifact-inputs-uq5oV7xR.mjs} +4 -4
  155. package/dist/{swiftpm-macos-Gtq9bNQb.mjs → swiftpm-macos-ClF203_2.mjs} +11 -11
  156. package/dist/{toolchain-B2bN8jEo.mjs → toolchain-CECahBDa.mjs} +1 -1
  157. package/dist/{toolchain-Bnm8vUCV.mjs → toolchain-CYonNjd_.mjs} +429 -20
  158. package/dist/{trigger-CfnOfpDd.mjs → trigger-BtB4kbe0.mjs} +2 -2
  159. package/dist/trigger-D8B7QR0q.mjs +2 -0
  160. package/dist/{warm-progress-_aTMvkIH.mjs → warm-progress-q11Vdvhh.mjs} +6 -6
  161. package/dist/{web-BdWG8b5_.mjs → web-BdaMBr2O.mjs} +9 -9
  162. package/dist/web-CIpHpGp8.mjs +2 -0
  163. package/dist/web-run.mjs +8 -8
  164. package/dist/windows-report.mjs +1 -1
  165. package/dist/{workspace-state-3bF4TB8P.mjs → workspace-state-BdZ-QgmB.mjs} +3 -3
  166. package/dist/{workspaces-C59v9bpD.mjs → workspaces-B9v5V7Es.mjs} +14 -14
  167. package/dist/{worktree-CinoSsGy.mjs → worktree-C3N86KpI.mjs} +77 -31
  168. package/dist/{worktree-K9F50fD_.mjs → worktree-C4MBOMz7.mjs} +1 -1
  169. package/package.json +12 -7
  170. package/dist/ios-signing-BJzvDPfU.mjs +0 -489
  171. package/dist/server-expo-DwR3eD-a.mjs +0 -2
  172. package/dist/trigger-DBZ-GBrl.mjs +0 -2
  173. package/dist/web-DwuluWJt.mjs +0 -2
@@ -0,0 +1,174 @@
1
+ import { createHash, randomUUID } from "node:crypto";
2
+ import { createReadStream } from "node:fs";
3
+ import { isDeepStrictEqual } from "node:util";
4
+ import { basename, join } from "node:path";
5
+ import { reactNativeArtifactIdentity } from "@stim-cli/core";
6
+ import { isJsonObject } from "@stim-cli/core/state";
7
+ import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
8
+ import { createFilesystemFileCache } from "@stim-cli/cache";
9
+ //#region src/offload/build-artifact-cache.ts
10
+ const androidPackage = (value) => typeof value === "string" && /^[A-Za-z_][\w]*(?:\.[A-Za-z_][\w]*)+$/.test(value);
11
+ function gradleQueryKey(query) {
12
+ const { android, inputs } = query;
13
+ return createHash("sha256").update(JSON.stringify([
14
+ query.project,
15
+ query.sourceDigest,
16
+ inputs.ignored,
17
+ inputs.outputs,
18
+ android.variant,
19
+ android.abi === "all" ? null : android.abi,
20
+ android.compilerCache,
21
+ android.gradleBuildCache,
22
+ android.pch,
23
+ android.gradleRoot ?? null,
24
+ android.module ?? null
25
+ ])).digest("hex");
26
+ }
27
+ const completedKind = (query) => "build" in query ? "swiftpm" : "sourceDigest" in query ? "gradle" : "react-native";
28
+ const completedKey = (query) => "sourceDigest" in query && !("build" in query) ? gradleQueryKey(query) : createHash("sha256").update(JSON.stringify(query)).digest("hex");
29
+ function validArtifactIdentity(value) {
30
+ return isJsonObject(value) && typeof value.fingerprint === "string" && value.fingerprint.length > 0 && value.fingerprint.length <= 256 && typeof value.cacheKey === "string" && value.cacheKey.length > 0 && value.cacheKey.length <= 1024;
31
+ }
32
+ async function verified(path, artifact, signal) {
33
+ const digest = createHash("sha256");
34
+ let size = 0;
35
+ for await (const chunk of createReadStream(path, { signal })) {
36
+ size += chunk.length;
37
+ digest.update(chunk);
38
+ }
39
+ return size === artifact.size && digest.digest("hex") === artifact.sha256;
40
+ }
41
+ /** Completed immutable archives within one authenticated client's repository area. */
42
+ var BuildArtifactCache = class {
43
+ files;
44
+ directory;
45
+ constructor(directory) {
46
+ this.directory = directory;
47
+ this.files = createFilesystemFileCache(join(directory, "files"));
48
+ }
49
+ record(identity) {
50
+ const key = createHash("sha256").update(JSON.stringify([identity.fingerprint, identity.cacheKey])).digest("hex");
51
+ return join(this.directory, `${key}.json`);
52
+ }
53
+ async lookup(identity, signal) {
54
+ signal.throwIfAborted();
55
+ try {
56
+ const record = JSON.parse(await readFile(this.record(identity), {
57
+ encoding: "utf8",
58
+ signal
59
+ }));
60
+ if (!isJsonObject(record) || record.fingerprint !== identity.fingerprint || record.cacheKey !== identity.cacheKey || typeof record.name !== "string" || basename(record.name) !== record.name || !(record.name.endsWith(".app") || record.name.endsWith(".apk") && androidPackage(record.androidPackage)) || typeof record.size !== "number" || !Number.isSafeInteger(record.size) || record.size <= 0 || typeof record.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(record.sha256)) return null;
61
+ if ((await this.files.stat({
62
+ key: record.sha256,
63
+ signal
64
+ }))?.size !== record.size) return null;
65
+ return {
66
+ ...identity,
67
+ name: record.name,
68
+ size: record.size,
69
+ sha256: record.sha256,
70
+ ...record.name.endsWith(".apk") && androidPackage(record.androidPackage) ? { androidPackage: record.androidPackage } : {}
71
+ };
72
+ } catch {
73
+ signal.throwIfAborted();
74
+ return null;
75
+ }
76
+ }
77
+ async store(identity, parameters, archive, artifact, signal) {
78
+ if (!validArtifactIdentity(identity) || !await verified(archive, artifact, signal)) return false;
79
+ await this.files.store({
80
+ key: artifact.sha256,
81
+ sourcePath: archive,
82
+ overwrite: true,
83
+ signal
84
+ });
85
+ await mkdir(this.directory, {
86
+ recursive: true,
87
+ mode: 448
88
+ });
89
+ const temporary = join(this.directory, `${randomUUID()}.partial`);
90
+ try {
91
+ await writeFile(temporary, JSON.stringify({
92
+ ...identity,
93
+ ...artifact,
94
+ parameters
95
+ }), {
96
+ mode: 384,
97
+ signal
98
+ });
99
+ signal.throwIfAborted();
100
+ await rename(temporary, this.record(identity));
101
+ return true;
102
+ } finally {
103
+ await rm(temporary, { force: true });
104
+ }
105
+ }
106
+ async storeCompleted(query, identity, receipt, archive, artifact, signal) {
107
+ if (!("build" in query) && ("sourceDigest" in query || query.platform === "android")) {
108
+ if (!artifact.name.endsWith(".apk") || !androidPackage(artifact.androidPackage)) return;
109
+ } else if (!artifact.name.endsWith(".app")) return;
110
+ if (!await this.store(identity, { ...query }, archive, artifact, signal)) return;
111
+ const key = completedKey(query);
112
+ const temporary = join(this.directory, `${randomUUID()}.partial`);
113
+ try {
114
+ await writeFile(temporary, JSON.stringify({
115
+ query: key,
116
+ receipt
117
+ }), {
118
+ mode: 384,
119
+ signal
120
+ });
121
+ signal.throwIfAborted();
122
+ await rename(temporary, join(this.directory, `${key}.${completedKind(query)}.json`));
123
+ } finally {
124
+ await rm(temporary, { force: true });
125
+ }
126
+ }
127
+ async completedRecord(query, signal) {
128
+ signal.throwIfAborted();
129
+ try {
130
+ const key = completedKey(query);
131
+ const record = JSON.parse(await readFile(join(this.directory, `${key}.${completedKind(query)}.json`), {
132
+ encoding: "utf8",
133
+ signal
134
+ }));
135
+ return isJsonObject(record) && record.query === key && isJsonObject(record.receipt) ? record : null;
136
+ } catch {
137
+ signal.throwIfAborted();
138
+ return null;
139
+ }
140
+ }
141
+ async receipt(query, signal) {
142
+ return (await this.completedRecord(query, signal))?.receipt ?? null;
143
+ }
144
+ async lookupReactNative(query, signal) {
145
+ const record = await this.completedRecord(query, signal);
146
+ if (!record || !isJsonObject(record.receipt) || !isJsonObject(record.receipt.toolchain) || !isDeepStrictEqual(record.receipt.query, query)) return null;
147
+ return this.lookup(reactNativeArtifactIdentity({
148
+ query,
149
+ toolchain: record.receipt.toolchain
150
+ }), signal);
151
+ }
152
+ async fetch(identity, destinationDir, signal) {
153
+ const artifact = await this.lookup(identity, signal);
154
+ if (!artifact) return null;
155
+ const path = await this.files.resolve({
156
+ key: artifact.sha256,
157
+ destinationDir,
158
+ signal
159
+ });
160
+ if (!path) return null;
161
+ let complete = false;
162
+ try {
163
+ complete = await verified(path, artifact, signal);
164
+ return complete ? {
165
+ path,
166
+ artifact
167
+ } : null;
168
+ } finally {
169
+ if (!complete) await rm(path, { force: true });
170
+ }
171
+ }
172
+ };
173
+ //#endregion
174
+ export { validArtifactIdentity as n, BuildArtifactCache as t };
@@ -0,0 +1,25 @@
1
+ import { BuildArtifactIdentity, BuildArtifactResult, BuildGradleArtifactQuery, BuildReactNativeArtifactQuery, BuildSwiftpmArtifactQuery, CachedBuildArtifact } from "@stim-cli/core/protocol";
2
+ //#region src/offload/build-artifact-cache.d.ts
3
+ type CompletedQuery = BuildGradleArtifactQuery | BuildReactNativeArtifactQuery | BuildSwiftpmArtifactQuery;
4
+ declare function validArtifactIdentity(value: unknown): value is BuildArtifactIdentity;
5
+ /** Completed immutable archives within one authenticated client's repository area. */
6
+ declare class BuildArtifactCache {
7
+ private readonly files;
8
+ private readonly directory;
9
+ constructor(directory: string);
10
+ private record;
11
+ lookup(identity: BuildArtifactIdentity, signal: AbortSignal): Promise<CachedBuildArtifact | null>;
12
+ store(identity: BuildArtifactIdentity, parameters: Record<string, unknown>, archive: string, artifact: BuildArtifactResult, signal: AbortSignal): Promise<boolean>;
13
+ storeCompleted(query: CompletedQuery, identity: BuildArtifactIdentity, receipt: unknown, archive: string, artifact: BuildArtifactResult & {
14
+ androidPackage?: string;
15
+ }, signal: AbortSignal): Promise<void>;
16
+ private completedRecord;
17
+ receipt(query: CompletedQuery, signal: AbortSignal): Promise<unknown | null>;
18
+ lookupReactNative(query: BuildReactNativeArtifactQuery, signal: AbortSignal): Promise<CachedBuildArtifact | null>;
19
+ fetch(identity: BuildArtifactIdentity, destinationDir: string, signal: AbortSignal): Promise<{
20
+ path: string;
21
+ artifact: CachedBuildArtifact;
22
+ } | null>;
23
+ }
24
+ //#endregion
25
+ export { BuildArtifactCache, validArtifactIdentity };
@@ -0,0 +1,2 @@
1
+ import { n as validArtifactIdentity, t as BuildArtifactCache } from "./build-artifact-cache-D7B6seMj.mjs";
2
+ export { BuildArtifactCache, validArtifactIdentity };
@@ -1,9 +1,9 @@
1
- import { c as throwIfCancelled, t as getExecutor, x as withDrainingCancellation } from "./exec-aULwtNly.mjs";
2
- import { y as sharedBuildCache } from "./workspace-state-3bF4TB8P.mjs";
3
- import { a as killOnAbort, c as gitQuiet, o as git, r as childEnvironment, s as gitAsync } from "./operation-exec-Dp4FuIGR.mjs";
4
- import { m as defaultAndroidLayout } from "./settings-C6UTYW2K.mjs";
5
- import { r as register } from "./cache-manifest-CfiEny4T.mjs";
6
- import { r as writeSignedTail, t as computeSignedTail } from "./apk-signed-tail-B9Usseps.mjs";
1
+ import { d as throwIfCancelled, t as getExecutor, w as withDrainingCancellation } from "./exec-CGuDzt40.mjs";
2
+ import { y as sharedBuildCache } from "./workspace-state-BdZ-QgmB.mjs";
3
+ import { a as killOnAbort, c as gitQuiet, o as git, r as childEnvironment, s as gitAsync } from "./operation-exec-DKlBcKAL.mjs";
4
+ import { m as defaultAndroidLayout } from "./settings-B5IBDfTx.mjs";
5
+ import { r as register } from "./cache-manifest-8JX9S1QJ.mjs";
6
+ import { r as writeSignedTail, t as computeSignedTail } from "./apk-signed-tail-CPpA-3vu.mjs";
7
7
  import { createHash } from "node:crypto";
8
8
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
9
9
  import { join } from "node:path";
@@ -701,6 +701,9 @@ function mergeMovedPackages(changes) {
701
701
  return kept;
702
702
  }
703
703
  function compareSourceLists(previous, current) {
704
+ return mergeMovedPackages(sourceListChanges(previous, current));
705
+ }
706
+ function sourceListChanges(previous, current) {
704
707
  const previousByName = /* @__PURE__ */ new Map();
705
708
  for (const source of previous) {
706
709
  const name = sourceName(source);
@@ -733,7 +736,16 @@ function compareSourceLists(previous, current) {
733
736
  change: "removed",
734
737
  reasons: before.reasons
735
738
  });
736
- return mergeMovedPackages(changes);
739
+ return changes;
740
+ }
741
+ /**
742
+ * Whether `current` differs from `previous` in at least one source, and only in file or directory sources whose
743
+ * normalized path lies inside `dir`.
744
+ */
745
+ function changedOnlyInside(previous, current, dir) {
746
+ const contents = new Set(current.flatMap((source) => typeof source === "object" && source !== null && "type" in source && source.type === "contents" && "id" in source && typeof source.id === "string" ? [source.id] : []));
747
+ const changes = sourceListChanges(previous, current);
748
+ return dir !== "." && changes.length > 0 && changes.every(({ name }) => !contents.has(name) && posix$1.normalize(name) === name && (name === dir || name.startsWith(`${dir}/`)));
737
749
  }
738
750
  function diffFingerprintSources({ previous, previousHash = null, current, differ = null }) {
739
751
  if (typeof differ === "function") try {
@@ -854,4 +866,4 @@ function fingerprintDiffRecord({ changed, previousHash, hash }) {
854
866
  };
855
867
  }
856
868
  //#endregion
857
- export { untrackedNativeFiles as A, resolveBuild as C, storedSources as D, storedAssetManifest as E, captureAssetManifest as M, compareAssetManifests as N, trackedFingerprintPaths as O, readAssetManifest as P, refingerprintAfterMutation as S, storedAppId as T, inputsChangedDuringBuild as _, configInputsChanged as a, providerDownloadPath as b, evictBuild as c, filesystemBuildCapability as d, fingerprintDiffRecord as f, ignoredFingerprintPaths as g, gitignoredFingerprintInputs as h, compareSourceLists as i, assetDiffReason as j, untrackedMissLine as k, expoConfigContents as l, fingerprintProject as m, buildCacheKey as n, diffFingerprintSources as o, fingerprintOptions as p, changedDuringBuildLine as r, entryDir as s, artifactIn as t, expoEnvFiles as u, packageIn as v, storeBuild as w, providerUploadOutcome as x, prepareProviderDownloadDir as y };
869
+ export { untrackedMissLine as A, refingerprintAfterMutation as C, storedAssetManifest as D, storedAppId as E, readAssetManifest as F, assetDiffReason as M, captureAssetManifest as N, storedSources as O, compareAssetManifests as P, providerUploadOutcome as S, storeBuild as T, ignoredFingerprintPaths as _, compareSourceLists as a, prepareProviderDownloadDir as b, entryDir as c, expoEnvFiles as d, filesystemBuildCapability as f, gitignoredFingerprintInputs as g, fingerprintProject as h, changedOnlyInside as i, untrackedNativeFiles as j, trackedFingerprintPaths as k, evictBuild as l, fingerprintOptions as m, buildCacheKey as n, configInputsChanged as o, fingerprintDiffRecord as p, changedDuringBuildLine as r, diffFingerprintSources as s, artifactIn as t, expoConfigContents as u, inputsChangedDuringBuild as v, resolveBuild as w, providerDownloadPath as x, packageIn as y };
@@ -1,10 +1,10 @@
1
- import { T as trackReportResource } from "./exec-aULwtNly.mjs";
2
- import { i as formatDuration, l as phaseLine, m as shortHash, u as plural } from "./command-output-CfPW1bKP.mjs";
3
- import { an as makeTemporaryDirectory, sn as removeTemporaryEntryAsync } from "./settings-C6UTYW2K.mjs";
4
- import { jn as easAuthNote } from "./ccache-BrwGIxmV.mjs";
5
- import { at as readStats, q as estimateBuild } from "./workspaces-C59v9bpD.mjs";
6
- import { s as entryDir, t as artifactIn } from "./build-cache-BsKim4V7.mjs";
7
- import { l as predictBuildMiss, o as staleNativeDirRefusal } from "./prebuild-CyNrUWgV.mjs";
1
+ import { a as trackReportResource } from "./exec-CGuDzt40.mjs";
2
+ import { i as formatDuration, l as phaseLine, m as shortHash, u as plural } from "./command-output-DjExb_tZ.mjs";
3
+ import { an as makeTemporaryDirectory, sn as removeTemporaryEntryAsync } from "./settings-B5IBDfTx.mjs";
4
+ import { On as easAuthNote } from "./ccache-ChBMXlBq.mjs";
5
+ import { at as readStats, q as estimateBuild } from "./workspaces-B9v5V7Es.mjs";
6
+ import { c as entryDir, t as artifactIn } from "./build-cache-Cqj4FGnX.mjs";
7
+ import { l as predictBuildMiss, o as staleNativeDirRefusal } from "./prebuild-BfJII57G.mjs";
8
8
  import chalk from "chalk";
9
9
  import { PROVIDER_LOAD_TIMEOUT_ENV, PROVIDER_LOAD_TIMEOUT_MS, buildResolveTimeoutMs, resolveTieredBuild, timeoutFromEnv } from "@stim-cli/cache";
10
10
  //#region src/commands/build-plan.ts
@@ -1,4 +1,4 @@
1
- import { d as getConfigDir } from "./config-D5qNWJEP.mjs";
1
+ import { d as getConfigDir } from "./config-BW0fAtoK.mjs";
2
2
  import { cacheDirRefusal, readCacheManifest, updateCacheManifest } from "@stim-cli/core";
3
3
  import { join, resolve } from "path";
4
4
  import { existsSync } from "fs";
@@ -1,2 +1,2 @@
1
- import { a as unregister, i as registeredCaches, n as readManifest, r as register, t as manifestPath } from "./cache-manifest-CfiEny4T.mjs";
1
+ import { a as unregister, i as registeredCaches, n as readManifest, r as register, t as manifestPath } from "./cache-manifest-8JX9S1QJ.mjs";
2
2
  export { manifestPath, readManifest, register, registeredCaches, unregister };
@@ -1,25 +1,25 @@
1
- import { D as ownership_claim_exports, E as debugLog, S as process_identity_exports, b as operationState, c as throwIfCancelled, d as workspaceProcessLockError, l as WorkspaceProcessCleanupError, n as isTimeoutError, o as cancellableSleep, s as cancelledError, t as getExecutor, u as withWorkspaceProcessLock, y as isTermination } from "./exec-aULwtNly.mjs";
2
- import { D as workspaceId$1, E as workspaceDir, M as withDirLock$1, b as sharedCcache$1, d as writeWorkspaceState, j as workspaceStateFile$1, k as workspaceLogsDir$1, l as withWorkspaceStateLockAsync, r as readWorkspaceState$1, t as clearWorkspaceStateKey, y as sharedBuildCache } from "./workspace-state-3bF4TB8P.mjs";
3
- import { F as formatBytes, I as isOnMountedVolume, K as projectDeviceSlots, N as directorySize, P as directorySizeAsync, R as measuredDirectorySizeAsync, U as deviceSlotPlatforms, a as clearDevice, d as getConfigDir, k as withConfigLockAsync$1, m as getProject, o as clearSupervisor, v as loadConfig$1, z as volumeRootFor } from "./config-D5qNWJEP.mjs";
1
+ import { C as operationState, D as ownership_claim_exports, E as debugLog, S as isTermination, T as process_identity_exports, d as throwIfCancelled, f as WorkspaceProcessCleanupError, l as cancellableSleep, m as workspaceProcessLockError, n as isTimeoutError, p as withWorkspaceProcessLock, t as getExecutor, u as cancelledError } from "./exec-CGuDzt40.mjs";
2
+ import { D as workspaceId$1, E as workspaceDir, M as withDirLock$1, b as sharedCcache$1, d as writeWorkspaceState, j as workspaceStateFile$1, k as workspaceLogsDir$1, l as withWorkspaceStateLockAsync, r as readWorkspaceState$1, t as clearWorkspaceStateKey, y as sharedBuildCache } from "./workspace-state-BdZ-QgmB.mjs";
4
3
  import { n as stripAnsi } from "./process-output-Fpl8PYi8.mjs";
5
- import { a as formatElapsed, l as phaseLine, o as formatLongDuration, s as isAppLaunchError, u as plural } from "./command-output-CfPW1bKP.mjs";
6
- import { a as killOnAbort, n as runOperationFileQuiet, r as childEnvironment, t as runOperationFile } from "./operation-exec-Dp4FuIGR.mjs";
7
- import { Z as resolveProjectSettingsAsync, d as androidLayoutSetting, ft as planMetroReach, m as defaultAndroidLayout } from "./settings-C6UTYW2K.mjs";
8
- import { C as resolvePackageJson, M as readMetroTunnel, N as readPidFile, P as readRemoteSession, i as findProjectRoot$1, j as clearWorkspaceSupervisor, k as clearRemoteSession, s as ownedDeviceLabel, v as detectIsExpo } from "./project-Crtcbfl0.mjs";
9
- import { R as listAvdsAsync, U as ownedAvdDirectory, X as parseAvdSystemImage, Y as parseAvdDeviceProfile, d as androidToolPath, ft as isStimOwnedAvd, gt as dropParked, m as avdIniPaths, o as androidHome, pt as isStimOwnedSim, q as ownedAvdSerialResolverAsync, xt as readParked, y as avdStorageRoots, z as listInstalledSystemImages } from "./android-DsEj2CCs.mjs";
10
- import { a as listeningPidsAsync, c as pidExists, d as resolveProjectMetro, h as isMetroRunning, r as killMetroTreeAsync, u as processCwds } from "./metro-mKHEMO-a.mjs";
4
+ import { a as formatElapsed, l as phaseLine, o as formatLongDuration, s as isAppLaunchError, u as plural } from "./command-output-DjExb_tZ.mjs";
5
+ import { a as clearDevice, at as isOnMountedVolume, ct as volumeRootFor, d as getConfigDir, ft as deviceSlotPlatforms, ht as projectDeviceSlots, k as withConfigLockAsync$1, m as getProject, nt as directorySizeAsync, o as clearSupervisor, rt as formatBytes, st as measuredDirectorySizeAsync, tt as directorySize, v as loadConfig$1 } from "./config-BW0fAtoK.mjs";
6
+ import { a as killOnAbort, n as runOperationFileQuiet, r as childEnvironment, t as runOperationFile } from "./operation-exec-DKlBcKAL.mjs";
7
+ import { Z as resolveProjectSettingsAsync, d as androidLayoutSetting, ft as planMetroReach, m as defaultAndroidLayout } from "./settings-B5IBDfTx.mjs";
8
+ import { C as resolvePackageJson, M as readMetroTunnel, N as readPidFile, P as readRemoteSession, i as findProjectRoot$1, j as clearWorkspaceSupervisor, k as clearRemoteSession, s as ownedDeviceLabel, v as detectIsExpo } from "./project-DU3jjnBE.mjs";
9
+ import { R as listAvdsAsync, U as ownedAvdDirectory, X as parseAvdSystemImage, Y as parseAvdDeviceProfile, d as androidToolPath, ft as isStimOwnedAvd, gt as dropParked, m as avdIniPaths, o as androidHome, pt as isStimOwnedSim, q as ownedAvdSerialResolverAsync, xt as readParked, y as avdStorageRoots, z as listInstalledSystemImages } from "./android-Iq0M2t2d.mjs";
10
+ import { a as listeningPidsAsync, c as pidExists, d as resolveProjectMetro, h as isMetroRunning, r as killMetroTreeAsync, u as processCwds } from "./metro-B5PVz0Wv.mjs";
11
11
  import { c as readNdjsonGenerations$1, i as createNdjsonWriter, r as createNdjsonTail } from "./ndjson-CrjIsGzw.mjs";
12
- import { T as formatSpace, a as removeEasSessionClaim, d as parseWatchRoots, f as parseWatchmanClients, i as recordEasSessionClaim, l as parseSubscriberNames, n as easMachineStateRoot$1, o as removeEasSessionClaimAsync, p as parseWatchmanPid, r as readEasSessionLedger$1, s as compareStimVersions, t as assertEasMachineRootWritable, u as parseTriggerCount, w as environmentState, y as capacity } from "./eas-session-ledger-B-nTfdfk.mjs";
13
- import { i as registeredCaches, r as register } from "./cache-manifest-CfiEny4T.mjs";
14
- import { At as mapLimited, B as workspaceBuildInProgress, Dt as createGcResults, Et as GC_OUTPUT, F as collectOwnedDeviceActivityAsync, L as idleShutdownCandidates, Mt as sizeConcurrency, N as collectIdleDevicesAsync, _t as teardownParkedIosSim, bt as measureDu, dt as eraseParkedIosSim, gt as teardownParkedAvd, ht as teardownOwnedIosSim, i as clearWorkspaceOutputs, l as keptByLock, o as collectWorkspaceOutputs, pt as teardownOwnedAvd, ut as eraseParkedAvd, v as withIdleWorkspace, vt as probePublicHttp, wt as listBuildSlots, x as resolveSupervisorTarget, xt as writeUsageCache, yt as canonical$1, z as shutDownIdleDevices } from "./workspaces-C59v9bpD.mjs";
12
+ import { T as formatSpace, a as removeEasSessionClaim, d as parseWatchRoots, f as parseWatchmanClients, i as recordEasSessionClaim, l as parseSubscriberNames, n as easMachineStateRoot$1, o as removeEasSessionClaimAsync, p as parseWatchmanPid, r as readEasSessionLedger$1, s as compareStimVersions, t as assertEasMachineRootWritable, u as parseTriggerCount, w as environmentState, y as capacity } from "./eas-session-ledger-CXwagcQ7.mjs";
13
+ import { i as registeredCaches, r as register } from "./cache-manifest-8JX9S1QJ.mjs";
14
+ import { At as mapLimited, B as workspaceBuildInProgress, Dt as createGcResults, Et as GC_OUTPUT, F as collectOwnedDeviceActivityAsync, L as idleShutdownCandidates, Mt as sizeConcurrency, N as collectIdleDevicesAsync, _t as teardownParkedIosSim, bt as measureDu, dt as eraseParkedIosSim, gt as teardownParkedAvd, ht as teardownOwnedIosSim, i as clearWorkspaceOutputs, l as keptByLock, o as collectWorkspaceOutputs, pt as teardownOwnedAvd, ut as eraseParkedAvd, v as withIdleWorkspace, vt as probePublicHttp, wt as listBuildSlots, x as resolveSupervisorTarget, xt as writeUsageCache, yt as canonical$1, z as shutDownIdleDevices } from "./workspaces-B9v5V7Es.mjs";
15
15
  import { t as canonicalPath } from "./paths-BsJMoPP2.mjs";
16
- import { it as nativeRunWaitNotice, st as runCancellationSignal, ut as claimForEmptying } from "./toolchain-Bnm8vUCV.mjs";
17
- import { N as listBuildLocks, b as leaseIsExpired, g as workspaceActivity, o as envDir, p as readHostProcessTableAsync, x as listLeaseFiles } from "./activity-yjH7Q3zn.mjs";
18
- import { l as expoConfigContents } from "./build-cache-BsKim4V7.mjs";
19
- import { G as deviceHoldsBundle, O as sanitizeDeviceLabel, W as deviceHoldsApk, b as parseSimctlList, f as listAllIosSimsAsync, g as listUserApps, j as uninstallIosApp, p as listIosDeviceTypesAsync, u as iosSimulatorFailureAdvice, y as parseRuntimeVersion } from "./ios-CdAV4-1E.mjs";
16
+ import { $ as readBundleSchemes, Z as approvableSchemes, _t as runCancellationSignal, bt as claimForEmptying, mt as nativeRunWaitNotice } from "./toolchain-CYonNjd_.mjs";
17
+ import { N as listBuildLocks, b as leaseIsExpired, g as workspaceActivity, o as envDir, p as readHostProcessTableAsync, x as listLeaseFiles } from "./activity-DkS-Ir6V.mjs";
18
+ import { u as expoConfigContents } from "./build-cache-Cqj4FGnX.mjs";
19
+ import { G as deviceHoldsBundle, O as sanitizeDeviceLabel, W as deviceHoldsApk, b as parseSimctlList, f as listAllIosSimsAsync, g as listUserApps, j as uninstallIosApp, p as listIosDeviceTypesAsync, u as iosSimulatorFailureAdvice, y as parseRuntimeVersion } from "./ios-BdZdNsAj.mjs";
20
20
  import { n as supervisorError } from "./errors-DHm_U5gv.mjs";
21
- import { c as findBinUpward, n as expoBinFromPackage, r as expoBinPath, s as expoTelemetryEnv } from "./server-expo-BLxcN2x2.mjs";
22
- import { t as DEV_MENU_LAUNCH_ARGS } from "./ios-device-CiBA-er9.mjs";
21
+ import { c as findBinUpward, n as expoBinFromPackage, r as expoBinPath, s as expoTelemetryEnv } from "./server-expo-CUJ2fuv1.mjs";
22
+ import { t as DEV_MENU_LAUNCH_ARGS } from "./ios-device-DLdEDWJj.mjs";
23
23
  import { t as resolveMaintenanceSettings } from "./settings-D9LtQaUw.mjs";
24
24
  import { createRequire } from "node:module";
25
25
  import { createHash, randomUUID } from "node:crypto";
@@ -27,11 +27,11 @@ import { closeSync, existsSync, lstatSync, mkdirSync, openSync, readFileSync, re
27
27
  import { homedir, platform, totalmem } from "node:os";
28
28
  import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
29
29
  import { LOG_ROTATE_BYTES, METRO_NAMED_CACHE_LAYOUT, ambientContext, cacheDirRefusal, compiledHelper, configDir, ensurePrivateDir, rotatedLogPath, withAmbientContext, withDirLock } from "@stim-cli/core";
30
- import { DEV_SERVER_STOP_REQUEST_KEY, MACHINE_OWNER_KINDS, MAINTENANCE_LOG_NAME, budgetSweepFile, budgetSweepLock, buildWorkerRoot, gcLogFile, isJsonObject, loadConfig, machineCacheUsageFile, maintenanceNdjsonFile, readDevServerStop, readDevServerStopRequest, readJsonObject, readMachineCacheUsage, runId, settingDefinition, settingValueError, workspaceLogsDir } from "@stim-cli/core/state";
30
+ import { DEV_SERVER_STOP_REQUEST_KEY, MACHINE_OWNER_KINDS, MAINTENANCE_LOG_NAME, budgetSweepFile, budgetSweepLock, buildWorkerRoot, gcLogFile, isJsonObject, loadConfig, machineCacheUsageFile, maintenanceNdjsonFile, readCreatedDevices, readDevServerStop, readDevServerStopRequest, readJsonObject, readMachineCacheUsage, runId, settingDefinition, settingValueError, workspaceLogsDir } from "@stim-cli/core/state";
31
31
  import { basename as basename$1, dirname as dirname$1, isAbsolute as isAbsolute$1, join as join$1, relative as relative$1, resolve as resolve$1 } from "path";
32
- import { fileURLToPath } from "node:url";
33
32
  import chalk from "chalk";
34
33
  import { existsSync as existsSync$1, readFileSync as readFileSync$1, readdirSync as readdirSync$1, realpathSync as realpathSync$1, rmSync as rmSync$1, statSync as statSync$1 } from "fs";
34
+ import { fileURLToPath } from "node:url";
35
35
  import { access, lstat, readFile, readdir, rm, stat, statfs } from "node:fs/promises";
36
36
  import { homedir as homedir$1, tmpdir as tmpdir$1 } from "os";
37
37
  //#region src/budget-sweep.ts
@@ -2761,48 +2761,6 @@ async function readRemoteSimulatorArch(daemon, { fetch: fetchImpl = fetch, timeo
2761
2761
  }
2762
2762
  }
2763
2763
  //#endregion
2764
- //#region src/engine/app-schemes.ts
2765
- function schemesFromInfoPlist(plist) {
2766
- const types = plist?.CFBundleURLTypes;
2767
- if (!Array.isArray(types)) return [];
2768
- const out = [];
2769
- for (const type of types) {
2770
- const schemes = type?.CFBundleURLSchemes;
2771
- if (Array.isArray(schemes)) out.push(...schemes.filter((s) => typeof s === "string" && s.trim() !== ""));
2772
- }
2773
- return out;
2774
- }
2775
- function readBundleSchemes(appPath, { exec = null } = {}) {
2776
- if (typeof appPath !== "string" || appPath.trim() === "") return [];
2777
- const e = exec || getExecutor();
2778
- let out;
2779
- try {
2780
- out = e.runFile("plutil", [
2781
- "-convert",
2782
- "json",
2783
- "-o",
2784
- "-",
2785
- join(appPath, "Info.plist")
2786
- ], { timeoutMs: 1e4 });
2787
- } catch {
2788
- return [];
2789
- }
2790
- try {
2791
- return schemesFromInfoPlist(JSON.parse(String(out)));
2792
- } catch {
2793
- return [];
2794
- }
2795
- }
2796
- const THIRD_PARTY_SCHEME = /^(?:fb\d+|com\.googleusercontent\.apps\.|msauth\.|msauthv2|twitterkit-|db-[a-z0-9]+$|spotify|snapchat|com\.facebook)/i;
2797
- function approvableSchemes(schemes) {
2798
- return (Array.isArray(schemes) ? schemes : []).filter((s) => typeof s === "string" && s.trim() !== "").map((s) => s.trim()).filter((s) => !/^(?:https?|mailto|tel|sms|itms(?:-apps)?)$/i.test(s) && !THIRD_PARTY_SCHEME.test(s));
2799
- }
2800
- function pickDevClientScheme(schemes) {
2801
- const all = approvableSchemes(schemes);
2802
- const expo = all.filter((s) => s.startsWith("exp+"));
2803
- return (expo.length ? expo : all).toSorted((a, b) => b.length - a.length)[0] ?? null;
2804
- }
2805
- //#endregion
2806
2764
  //#region src/engine/app-install.ts
2807
2765
  const INSTALL_ERROR = "STIM_INSTALL_FAILED";
2808
2766
  const LAUNCH_ERROR = "STIM_LAUNCH_FAILED";
@@ -6184,6 +6142,7 @@ function buildInventory({ sims, avds, runtimes, systemImages, config, deadProjec
6184
6142
  package: image.pkg,
6185
6143
  directory: image.directory,
6186
6144
  avdCount: avdsByImage.get(image.pkg) ?? 0,
6145
+ stimInstalled: image.stimInstalled,
6187
6146
  command: sdkmanagerCommand(image.pkg, env)
6188
6147
  }))
6189
6148
  };
@@ -6297,10 +6256,19 @@ async function collectInventory(config, deadProjects, env = process.env, operati
6297
6256
  }
6298
6257
  }
6299
6258
  const imagesRoot = join(androidHome(env), "system-images");
6300
- const images = listInstalledSystemImages((error) => notices.push(unreadableNotice("Android system images", error, env)), env).map((image) => ({
6301
- pkg: image.pkg,
6302
- directory: join(imagesRoot, `android-${image.api}`, image.tag, image.arch)
6303
- }));
6259
+ const installedByStim = readCreatedDevices().systemImages;
6260
+ const images = listInstalledSystemImages((error) => notices.push(unreadableNotice("Android system images", error, env)), env, { includePartial: true }).map((image) => {
6261
+ const directory = join(imagesRoot, `android-${image.api}`, image.tag, image.arch);
6262
+ let canonical = directory;
6263
+ try {
6264
+ canonical = realpathSync(directory);
6265
+ } catch {}
6266
+ return {
6267
+ pkg: image.pkg,
6268
+ directory,
6269
+ stimInstalled: installedByStim.has(canonical)
6270
+ };
6271
+ });
6304
6272
  return {
6305
6273
  ...buildInventory({
6306
6274
  sims,
@@ -8505,4 +8473,4 @@ function resolveCcache({ root, layout = defaultAndroidLayout(root), dir = shared
8505
8473
  };
8506
8474
  }
8507
8475
  //#endregion
8508
- export { gradleVersionLines as $, memoryCacheKind as $n, INSTALL_ERROR as $t, diskPressureLevel as A, checkEasAuth as An, ensureRemoteBootOwned as At, includesArchives as B, bundleInvocation as Bn, RELEASE_VERIFY_WAIT_MS as Bt, devServerStopLevel as C, gateMetroOrigin as Cn, describeError as Ct, requestDevServerStop as D, RESOLVE_TIMEOUT_MS as Dn, bundleEntryPoint as Dt, metroLastStop as E, runProcessOperation as En, binOnPath as Et, gcOptionsOf as F, providerFromConfig as Fn, withEasProjectLock as Ft, planCacheEmptying as G, easCliSupport as Gn, unattributedLaunchLines as Gt, includesRecordings as H, remoteCommand as Hn, isBundleProof as Ht, maintenanceItem as I, readProjectConfig as In, LAUNCH_BUNDLING as It, selectsBeyondCaches as J, parseArchiveSelector as Jn, verifyLaunch as Jt, previewScopedEmptying as K, easCliUpgradeRemedy as Kn, unverifiedLaunchLines as Kt, openGcLog as L, resolveEasCliBin as Ln, LAUNCH_FATAL as Lt, levelStillShort as M, isEasAuthFailureText as Mn, remoteAndroidDeps as Mt, lowestFree as N, loadProjectProvider as Nn, remoteIosDeps as Nt, vanishedSupervisorMessage as O, UPLOAD_TIMEOUT_MS as On, endRecordedSession as Ot, protectWindowMs as P, ownerFromConfig as Pn, resolveRemoteContext as Pt, deleteGradleVersions as Q, inspectWatchmanMemory as Qn, DEFAULT_METRO_PORT as Qt, maintenanceLogger as R, resolveRemote as Rn, LAUNCH_UNVERIFIED as Rt, describeMetroLastStop as S, readRemoteSimulatorArch as Sn, deleteEasSessions as St, logVanishedSupervisor as T, processContext as Tn, REMOTE_SESSION_ERROR as Tt, includesWorkspaceOutputs as U, MIN_EAS_CLI_DEVICE_VERSION as Un, readCollectorRecords as Ut, includesParkedDevices as V, remoteCliInvocation as Vn, VERIFY_TIMEOUT_MS as Vt, isWorkspacesScope as W, MIN_EAS_CLI_SIMULATOR_VERSION as Wn, readMetroRecords as Wt, collectGradleVersions as X, WATCHMAN_KIND as Xn, APP_READINESS_TIMEOUT_MS as Xt, trimCaches as Y, GRADLE_DAEMONS_KIND as Yn, verifyReleaseLaunch as Yt, deleteGradleVersion as Z, collectMemoryReport as Zn, ADB_INSTALL_TIMEOUT_MS as Zt, resolveBudget as _, reverseMetroPorts as _n, findStaleDeviceRecords as _t, projectCmakeLauncher as a, devClientUrl as an, scopedMemoryReport as ar, DEVICE_LIST_TIMEOUT_MS$1 as at, stopOwnedMetroForReset as b, readBundleSchemes as bn, withAndroidAvdSizes as bt, budgetGate as c, hasMetroReverse as cn, attributeMachineUsage as cr, collectParkedSims as ct, enforceBudget as d, installIosApp as dn, pruneCache as dr, deleteProjectDevices as dt, IOS_DEV_MENU_OFF_DEFAULTS_PLIST as en, memoryLines as er, gradleVersionsPending as et, inspectBudget as f, iosAppProcess as fn, sizeCaches as fr, describeParkedSims as ft, readVolumeSpaceAsync as g, restartedAppNote as gn, findOrphanedDevices as gt, readVolumeSpace as h, launchIosApp as hn, eraseParkedDevices as ht, ccacheInstallCommand as i, clearOtherUserApps as in, reclaimMemory as ir, collectInventory as it, levelFloors as j, easAuthNote as jn, readInstalledEasCliVersionAsync as jt, withdrawDevServerStopRequest as k, cacheLevel as kn, ensureMetroReachable as kt, budgetLine as l, installAndroidApp as ln, readFootprints as lr, deleteParkedAvds as lt, peekBudget as m, launchAndroidReleaseApp as mn, deviceSweepIsScoped as mt, CCACHE_UNAVAILABLE as n, androidDevClientUrl as nn, memorySweepIsScoped as nr, waitForGradleExit as nt, readCcacheActivity as o, deviceShellArg as on, stopIdleGradleDaemons as or, collectDeviceLeases as ot, machineNumber as p, launchAndroidApp as pn, describeUnverifiableDevices as pt, selectCaches as q, ownedSessionName as qn, verifyAndroidReleaseLaunch as qt, ccacheActivityLine as r, appProcessFromPid as rn, memoryWorkPending as rr, getMachineCacheReport as rt, resolveCcache as s, ensureMetroReverse as sn, phase as sr, collectParkedAvds as st, CCACHE_NOT_RUN as t, androidAppProcess as tn, memoryScope as tr, includesGradleVersions as tt, cacheLabel as u, installConflictKind as un, discoverCaches as ur, deleteParkedSims as ut, trimmableCaches as v, writeDebugHttpHost as vn, findStaleProjectDevices as vt, devServerStopRecord as w, exitAfterFlush as wn, withRemoteSessionGcLocks as wt, describeDevServerStop as x, schemesFromInfoPlist as xn, collectEasSessionSweep as xt, stopOwnedMetro as y, pickDevClientScheme as yn, unverifiedDeviceCommand as yt, emptyCaches as z, uploadRemote as zn, MANIFEST_VERIFY_TIMEOUT_MS as zt };
8476
+ export { gradleVersionLines as $, memorySweepIsScoped as $n, INSTALL_ERROR as $t, diskPressureLevel as A, loadProjectProvider as An, ensureRemoteBootOwned as At, includesArchives as B, MIN_EAS_CLI_DEVICE_VERSION as Bn, RELEASE_VERIFY_WAIT_MS as Bt, devServerStopLevel as C, runProcessOperation as Cn, describeError as Ct, requestDevServerStop as D, checkEasAuth as Dn, bundleEntryPoint as Dt, metroLastStop as E, cacheLevel as En, binOnPath as Et, gcOptionsOf as F, resolveRemote as Fn, withEasProjectLock as Ft, planCacheEmptying as G, parseArchiveSelector as Gn, unattributedLaunchLines as Gt, includesRecordings as H, easCliSupport as Hn, isBundleProof as Ht, maintenanceItem as I, uploadRemote as In, LAUNCH_BUNDLING as It, selectsBeyondCaches as J, collectMemoryReport as Jn, verifyLaunch as Jt, previewScopedEmptying as K, GRADLE_DAEMONS_KIND as Kn, unverifiedLaunchLines as Kt, openGcLog as L, bundleInvocation as Ln, LAUNCH_FATAL as Lt, levelStillShort as M, providerFromConfig as Mn, remoteAndroidDeps as Mt, lowestFree as N, readProjectConfig as Nn, remoteIosDeps as Nt, vanishedSupervisorMessage as O, easAuthNote as On, endRecordedSession as Ot, protectWindowMs as P, resolveEasCliBin as Pn, resolveRemoteContext as Pt, deleteGradleVersions as Q, memoryScope as Qn, DEFAULT_METRO_PORT as Qt, maintenanceLogger as R, remoteCliInvocation as Rn, LAUNCH_UNVERIFIED as Rt, describeMetroLastStop as S, processContext as Sn, deleteEasSessions as St, logVanishedSupervisor as T, UPLOAD_TIMEOUT_MS as Tn, REMOTE_SESSION_ERROR as Tt, includesWorkspaceOutputs as U, easCliUpgradeRemedy as Un, readCollectorRecords as Ut, includesParkedDevices as V, MIN_EAS_CLI_SIMULATOR_VERSION as Vn, VERIFY_TIMEOUT_MS as Vt, isWorkspacesScope as W, ownedSessionName as Wn, readMetroRecords as Wt, collectGradleVersions as X, memoryCacheKind as Xn, APP_READINESS_TIMEOUT_MS as Xt, trimCaches as Y, inspectWatchmanMemory as Yn, verifyReleaseLaunch as Yt, deleteGradleVersion as Z, memoryLines as Zn, ADB_INSTALL_TIMEOUT_MS as Zt, resolveBudget as _, reverseMetroPorts as _n, findStaleDeviceRecords as _t, projectCmakeLauncher as a, devClientUrl as an, attributeMachineUsage as ar, DEVICE_LIST_TIMEOUT_MS$1 as at, stopOwnedMetroForReset as b, gateMetroOrigin as bn, withAndroidAvdSizes as bt, budgetGate as c, hasMetroReverse as cn, pruneCache as cr, collectParkedSims as ct, enforceBudget as d, installIosApp as dn, deleteProjectDevices as dt, IOS_DEV_MENU_OFF_DEFAULTS_PLIST as en, memoryWorkPending as er, gradleVersionsPending as et, inspectBudget as f, iosAppProcess as fn, describeParkedSims as ft, readVolumeSpaceAsync as g, restartedAppNote as gn, findOrphanedDevices as gt, readVolumeSpace as h, launchIosApp as hn, eraseParkedDevices as ht, ccacheInstallCommand as i, clearOtherUserApps as in, phase as ir, collectInventory as it, levelFloors as j, ownerFromConfig as jn, readInstalledEasCliVersionAsync as jt, withdrawDevServerStopRequest as k, isEasAuthFailureText as kn, ensureMetroReachable as kt, budgetLine as l, installAndroidApp as ln, sizeCaches as lr, deleteParkedAvds as lt, peekBudget as m, launchAndroidReleaseApp as mn, deviceSweepIsScoped as mt, CCACHE_UNAVAILABLE as n, androidDevClientUrl as nn, scopedMemoryReport as nr, waitForGradleExit as nt, readCcacheActivity as o, deviceShellArg as on, readFootprints as or, collectDeviceLeases as ot, machineNumber as p, launchAndroidApp as pn, describeUnverifiableDevices as pt, selectCaches as q, WATCHMAN_KIND as qn, verifyAndroidReleaseLaunch as qt, ccacheActivityLine as r, appProcessFromPid as rn, stopIdleGradleDaemons as rr, getMachineCacheReport as rt, resolveCcache as s, ensureMetroReverse as sn, discoverCaches as sr, collectParkedAvds as st, CCACHE_NOT_RUN as t, androidAppProcess as tn, reclaimMemory as tr, includesGradleVersions as tt, cacheLabel as u, installConflictKind as un, deleteParkedSims as ut, trimmableCaches as v, writeDebugHttpHost as vn, findStaleProjectDevices as vt, devServerStopRecord as w, RESOLVE_TIMEOUT_MS as wn, withRemoteSessionGcLocks as wt, describeDevServerStop as x, exitAfterFlush as xn, collectEasSessionSweep as xt, stopOwnedMetro as y, readRemoteSimulatorArch as yn, unverifiedDeviceCommand as yt, emptyCaches as z, remoteCommand as zn, MANIFEST_VERIFY_TIMEOUT_MS as zt };
@@ -1,4 +1,4 @@
1
- import { c as throwIfCancelled, s as cancelledError } from "./exec-aULwtNly.mjs";
1
+ import { d as throwIfCancelled, u as cancelledError } from "./exec-CGuDzt40.mjs";
2
2
  import { WebSocket } from "ws";
3
3
  //#region src/web/cdp.ts
4
4
  const COMMAND_TIMEOUT_MS = 15e3;
@@ -1,4 +1,4 @@
1
- import { t as getExecutor } from "./exec-aULwtNly.mjs";
1
+ import { t as getExecutor } from "./exec-CGuDzt40.mjs";
2
2
  import { existsSync } from "node:fs";
3
3
  import { homedir } from "node:os";
4
4
  import { join } from "node:path";
@@ -1,27 +1,27 @@
1
- import { E as debugLog } from "./exec-aULwtNly.mjs";
2
- import { b as refuseRelativeStimPaths } from "./config-D5qNWJEP.mjs";
1
+ import { E as debugLog } from "./exec-CGuDzt40.mjs";
2
+ import { b as refuseRelativeStimPaths } from "./config-BW0fAtoK.mjs";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { runId, trace } from "@stim-cli/core/state";
5
5
  import { Command } from "commander";
6
6
  //#region bin/cli.ts
7
7
  const commands = /* @__PURE__ */ new Map([
8
- ["doctor", () => import("./doctor-CNZuvTSe.mjs")],
9
- ["worktree", () => import("./worktree-K9F50fD_.mjs")],
10
- ["start", () => import("./start-CquYgzVf.mjs")],
11
- ["ports", () => import("./ports-CKktj5lV.mjs")],
12
- ["stop", () => import("./stop-RZqER_Ww.mjs")],
13
- ["ios", () => import("./ios-D1XKSITX.mjs")],
14
- ["android", () => import("./android-D56S_GX3.mjs")],
15
- ["web", () => import("./web-DwuluWJt.mjs")],
16
- ["macos", () => import("./macos-CbRZheLw.mjs")],
17
- ["reload", () => import("./reload-f9hvEHE9.mjs")],
18
- ["device", () => import("./device-CeIikWac.mjs")],
19
- ["logs", () => import("./logs-CuWJWF88.mjs")],
20
- ["settings", () => import("./settings-jeS0WmUF.mjs")],
21
- ["status", () => import("./status-Bhdy07v0.mjs")],
22
- ["stats", () => import("./stats-BVEZuSlg.mjs")],
23
- ["gc", () => import("./gc-By2Kc-Ek.mjs")],
24
- ["guide", () => import("./guide-CwpsGWTJ.mjs")]
8
+ ["doctor", () => import("./doctor-CGBsS_68.mjs")],
9
+ ["worktree", () => import("./worktree-C4MBOMz7.mjs")],
10
+ ["start", () => import("./start-Diu8q6_U.mjs")],
11
+ ["ports", () => import("./ports-CNzg1LYD.mjs")],
12
+ ["stop", () => import("./stop-Dm9ON6Os.mjs")],
13
+ ["ios", () => import("./ios-sUPbWqEh.mjs")],
14
+ ["android", () => import("./android-BU4uBX8I.mjs")],
15
+ ["web", () => import("./web-CIpHpGp8.mjs")],
16
+ ["macos", () => import("./macos-kWGcfLzx.mjs")],
17
+ ["reload", () => import("./reload-YPnvXGlB.mjs")],
18
+ ["device", () => import("./device-CWPFAqs0.mjs")],
19
+ ["logs", () => import("./logs-DuED-01Z.mjs")],
20
+ ["settings", () => import("./settings-DoWHJopy.mjs")],
21
+ ["status", () => import("./status-B-oeWS0Z.mjs")],
22
+ ["stats", () => import("./stats-D4cW247z.mjs")],
23
+ ["gc", () => import("./gc-B464w_a5.mjs")],
24
+ ["guide", () => import("./guide-BFW-cB7R.mjs")]
25
25
  ]);
26
26
  const pkg = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
27
27
  const program = new Command();
@@ -53,7 +53,7 @@ try {
53
53
  }));
54
54
  }
55
55
  try {
56
- const { triggerMaintenance } = await import("./trigger-DBZ-GBrl.mjs");
56
+ const { triggerMaintenance } = await import("./trigger-D8B7QR0q.mjs");
57
57
  triggerMaintenance(action.name());
58
58
  } catch {}
59
59
  });
package/dist/cli.mjs CHANGED
@@ -4,6 +4,6 @@ const encode = (version) => version.split(".", 3).reduce((sum, part) => sum * 1e
4
4
  if (encode(process.versions.node) < encode("22.12.0")) {
5
5
  process.stderr.write(`STIM_NODE_UNSUPPORTED: Stim needs Node 22.12.0 or later; this is Node ${process.versions.node} at ${process.execPath}. To run Stim where a project pins an older Node, see https://stim.appandflow.com/docs/requirements#older-node-pins\n`);
6
6
  process.exitCode = 1;
7
- } else import("./cli-Jc7obreB.mjs");
7
+ } else import("./cli-DjdvQG5U.mjs");
8
8
  //#endregion
9
9
  export {};