@cnc-tools/storm 0.16.0 → 0.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 (281) hide show
  1. package/dist/application.d.ts +22 -13
  2. package/dist/application.js +21 -10
  3. package/dist/bin/run.d.ts +18 -0
  4. package/dist/bin/run.js +31 -0
  5. package/dist/bin/storm.js +42 -26
  6. package/dist/build-info.js +1 -1
  7. package/dist/chunks/{chunk-5CCP36QQ.js → chunk-2RNDPDTJ.js} +2 -2
  8. package/dist/chunks/chunk-2VP4GRJM.js +1219 -0
  9. package/dist/chunks/{chunk-P357TZAY.js → chunk-4O5C2XGJ.js} +18 -15
  10. package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
  11. package/dist/chunks/{chunk-OIY3DMF2.js → chunk-6UHIJXZG.js} +3 -3
  12. package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
  13. package/dist/chunks/{chunk-CK2GZEPK.js → chunk-7DZE67QM.js} +2 -2
  14. package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
  15. package/dist/chunks/{chunk-2MAD5NKK.js → chunk-CKGZA25H.js} +1 -18
  16. package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
  17. package/dist/chunks/{chunk-V4IKA3WI.js → chunk-DADEYJDW.js} +24 -17
  18. package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
  19. package/dist/chunks/chunk-F4MOYHRY.js +198 -0
  20. package/dist/chunks/{chunk-HVNK3I45.js → chunk-FNBB6V4R.js} +1 -1
  21. package/dist/chunks/{chunk-G3PHMXH5.js → chunk-GRT3UIBV.js} +18 -1
  22. package/dist/chunks/chunk-HP3CURSZ.js +88 -0
  23. package/dist/chunks/{chunk-DWEAHX4T.js → chunk-HWIQ2S7K.js} +5 -5
  24. package/dist/chunks/chunk-JN3YY6ZH.js +2166 -0
  25. package/dist/chunks/{chunk-TJNFVNKR.js → chunk-LKTZ5OXS.js} +1 -1
  26. package/dist/chunks/{chunk-3L52KNQA.js → chunk-M7EKRGVD.js} +8 -8
  27. package/dist/chunks/chunk-MR77L2GK.js +340 -0
  28. package/dist/chunks/{chunk-DC2CDHNK.js → chunk-RNAS7JHE.js} +1438 -445
  29. package/dist/chunks/{chunk-FCQUJDA4.js → chunk-RWIXDDCK.js} +4 -189
  30. package/dist/chunks/{chunk-5VXBKPW6.js → chunk-WV3DP6NR.js} +1 -1
  31. package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
  32. package/dist/chunks/{chunk-FOZWA52V.js → chunk-YEPFSLQR.js} +480 -375
  33. package/dist/chunks/{live-app-WECQOQ4C.js → live-app-R76JQXZL.js} +15 -13
  34. package/dist/commands/exec/across-sandboxes-outcomes.d.ts +1 -1
  35. package/dist/commands/exec/across-sandboxes-outcomes.js +2 -2
  36. package/dist/commands/exec/before-run.d.ts +123 -0
  37. package/dist/commands/exec/before-run.js +105 -0
  38. package/dist/commands/exec/command.d.ts +31 -2
  39. package/dist/commands/exec/command.js +31 -95
  40. package/dist/commands/exec/driver-plan.d.ts +9 -4
  41. package/dist/commands/exec/driver-plan.js +8 -8
  42. package/dist/commands/exec/exec-words.js +1 -1
  43. package/dist/commands/exec/execute-run.d.ts +39 -0
  44. package/dist/commands/exec/execute-run.js +325 -0
  45. package/dist/commands/exec/live-view.d.ts +3 -3
  46. package/dist/commands/exec/live-view.js +16 -15
  47. package/dist/commands/exec/metadata.js +1 -1
  48. package/dist/commands/exec/mint-failed.d.ts +38 -0
  49. package/dist/commands/exec/mint-failed.js +27 -4
  50. package/dist/commands/exec/outcomes.d.ts +34 -8
  51. package/dist/commands/exec/outcomes.js +30 -23
  52. package/dist/commands/exec/plan-run.d.ts +58 -150
  53. package/dist/commands/exec/plan-run.js +232 -88
  54. package/dist/commands/exec/progress.d.ts +10 -6
  55. package/dist/commands/exec/progress.js +38 -25
  56. package/dist/commands/exec/run-bin.d.ts +11 -11
  57. package/dist/commands/exec/run-bin.js +9 -9
  58. package/dist/commands/exec/run-flags.d.ts +69 -0
  59. package/dist/commands/exec/run-flags.js +58 -0
  60. package/dist/commands/exec/run-metadata.js +4 -4
  61. package/dist/commands/exec/run-summary.d.ts +58 -0
  62. package/dist/commands/exec/run-summary.js +205 -0
  63. package/dist/commands/exec/runner-refusals.d.ts +82 -0
  64. package/dist/commands/exec/runner-refusals.js +71 -0
  65. package/dist/commands/exec/sandbox-progress.js +3 -0
  66. package/dist/commands/exec/stopped-outcome.d.ts +12 -0
  67. package/dist/commands/exec/stopped-outcome.js +77 -0
  68. package/dist/commands/exec/view.d.ts +20 -11
  69. package/dist/commands/exec/view.js +103 -47
  70. package/dist/commands/runs/facts.d.ts +7 -3
  71. package/dist/commands/runs/facts.js +17 -8
  72. package/dist/commands/runs/list/command.d.ts +14 -6
  73. package/dist/commands/runs/list/command.js +10 -10
  74. package/dist/commands/runs/list/outcomes.d.ts +7 -3
  75. package/dist/commands/runs/logs/command.js +10 -10
  76. package/dist/commands/runs/show/command.d.ts +14 -6
  77. package/dist/commands/runs/show/command.js +30 -28
  78. package/dist/commands/runs/show/outcomes.d.ts +7 -3
  79. package/dist/commands/runs/show/outcomes.js +7 -5
  80. package/dist/commands/snapshots/access.d.ts +111 -0
  81. package/dist/commands/snapshots/access.js +96 -0
  82. package/dist/commands/snapshots/build/command.d.ts +360 -93
  83. package/dist/commands/snapshots/build/command.js +446 -150
  84. package/dist/commands/snapshots/build/metadata.d.ts +10 -0
  85. package/dist/commands/snapshots/build/metadata.js +31 -11
  86. package/dist/commands/snapshots/build/outcomes.d.ts +234 -43
  87. package/dist/commands/snapshots/build/outcomes.js +200 -36
  88. package/dist/commands/snapshots/list/command.d.ts +366 -25
  89. package/dist/commands/snapshots/list/command.js +296 -66
  90. package/dist/commands/snapshots/list/metadata.d.ts +16 -0
  91. package/dist/commands/snapshots/list/metadata.js +29 -6
  92. package/dist/commands/snapshots/list/outcomes.d.ts +245 -13
  93. package/dist/commands/snapshots/list/outcomes.js +221 -50
  94. package/dist/commands/snapshots/metadata.js +1 -1
  95. package/dist/commands/snapshots/prune/command.d.ts +430 -0
  96. package/dist/commands/snapshots/prune/command.js +161 -0
  97. package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
  98. package/dist/commands/snapshots/prune/metadata.js +39 -0
  99. package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
  100. package/dist/commands/snapshots/prune/outcomes.js +78 -0
  101. package/dist/commands/suites/list/command.js +17 -17
  102. package/dist/commands/suites/list/outcomes.js +2 -2
  103. package/dist/commands/test/command.d.ts +31 -2
  104. package/dist/commands/test/command.js +49 -252
  105. package/dist/commands/test/outcomes.d.ts +15 -1
  106. package/dist/config/check-runner.d.ts +3 -3
  107. package/dist/config/check-runner.js +8 -7
  108. package/dist/config/credential-resolver.d.ts +50 -5
  109. package/dist/config/credential-resolver.js +51 -19
  110. package/dist/config/credential-settle.d.ts +6 -2
  111. package/dist/config/credential-settle.js +11 -5
  112. package/dist/config/index.d.ts +2 -2
  113. package/dist/config/index.js +1 -1
  114. package/dist/config/runner.d.ts +5 -5
  115. package/dist/config/runner.js +1 -1
  116. package/dist/config/schema.d.ts +2 -2
  117. package/dist/config/schema.js +1 -1
  118. package/dist/config-file/define.d.ts +1 -1
  119. package/dist/config-file/define.js +1 -1
  120. package/dist/config-file/runner.d.ts +5 -5
  121. package/dist/config-file/toolchain.d.ts +1 -1
  122. package/dist/config-file/toolchain.js +2 -2
  123. package/dist/context.d.ts +8 -6
  124. package/dist/context.js +7 -6
  125. package/dist/core/across-sandboxes.d.ts +7 -6
  126. package/dist/core/across-sandboxes.js +123 -152
  127. package/dist/core/coordinator.d.ts +166 -0
  128. package/dist/core/coordinator.js +233 -0
  129. package/dist/core/events.d.ts +2 -2
  130. package/dist/core/index.d.ts +4 -2
  131. package/dist/core/index.js +1 -1
  132. package/dist/core/outcomes.d.ts +148 -0
  133. package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
  134. package/dist/core/resources.d.ts +31 -53
  135. package/dist/core/resources.js +32 -70
  136. package/dist/core/run-state.d.ts +7 -1
  137. package/dist/core/run-state.js +2 -0
  138. package/dist/core/run.d.ts +32 -236
  139. package/dist/core/run.js +106 -266
  140. package/dist/core/state-directory.d.ts +1 -1
  141. package/dist/core/state-directory.js +2 -2
  142. package/dist/credential/gateways.d.ts +15 -1
  143. package/dist/credential/index.d.ts +4 -3
  144. package/dist/credential/index.js +3 -2
  145. package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
  146. package/dist/credential/live/vercel-cli-gateway.js +1 -1
  147. package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
  148. package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
  149. package/dist/credential/source.d.ts +73 -6
  150. package/dist/credential/source.js +55 -2
  151. package/dist/extension-commands.d.ts +6 -1
  152. package/dist/extension-commands.js +15 -1
  153. package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
  154. package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
  155. package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
  156. package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
  157. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  158. package/dist/extensions/testserver/credential-facts.d.ts +6 -2
  159. package/dist/extensions/testserver/credential-facts.js +29 -11
  160. package/dist/extensions/testserver/lifecycle.js +7 -1
  161. package/dist/extensions/testserver/limit.d.ts +3 -0
  162. package/dist/extensions/testserver/limit.js +3 -0
  163. package/dist/extensions/testserver/provision.d.ts +8 -1
  164. package/dist/extensions/testserver/provision.js +8 -3
  165. package/dist/extensions/testserver/refusals.d.ts +6 -1
  166. package/dist/extensions/testserver/refusals.js +16 -1
  167. package/dist/extensions/testserver/resource.d.ts +1 -1
  168. package/dist/extensions/testserver/resource.js +1 -1
  169. package/dist/extensions/testserver/result.d.ts +1 -1
  170. package/dist/extensions/testserver/result.js +9 -4
  171. package/dist/planning/driver-file-lists.d.ts +0 -15
  172. package/dist/planning/driver-file-lists.js +2 -21
  173. package/dist/planning/plan-only.d.ts +3 -14
  174. package/dist/planning/plan-only.js +11 -20
  175. package/dist/planning/run-kind-flags.js +2 -2
  176. package/dist/planning/run-plan.d.ts +45 -12
  177. package/dist/planning/run-plan.js +4 -3
  178. package/dist/planning/suites.d.ts +1 -1
  179. package/dist/planning/suites.js +2 -2
  180. package/dist/planning/test-plan.d.ts +9 -0
  181. package/dist/planning/test-plan.js +9 -0
  182. package/dist/run-directory/recording.js +2 -2
  183. package/dist/run-directory/run-record.d.ts +21 -6
  184. package/dist/run-directory/run-record.js +12 -9
  185. package/dist/runner/base.js +1 -1
  186. package/dist/runner/build-snapshots.d.ts +55 -29
  187. package/dist/runner/build-snapshots.js +130 -29
  188. package/dist/runner/context.d.ts +15 -7
  189. package/dist/runner/context.js +19 -6
  190. package/dist/runner/events.d.ts +16 -10
  191. package/dist/runner/gateways.d.ts +87 -21
  192. package/dist/runner/gateways.js +1 -1
  193. package/dist/runner/index.d.ts +11 -7
  194. package/dist/runner/index.js +9 -4
  195. package/dist/runner/live/sandbox-errors.d.ts +2 -0
  196. package/dist/runner/live/sandbox-errors.js +4 -0
  197. package/dist/runner/live/sandbox-gateway.js +129 -3
  198. package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
  199. package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
  200. package/dist/runner/live/snapshot-records.js +6 -7
  201. package/dist/runner/local-snapshot-index.d.ts +199 -0
  202. package/dist/runner/local-snapshot-index.js +211 -0
  203. package/dist/runner/network-policy.d.ts +6 -6
  204. package/dist/runner/network-policy.js +7 -7
  205. package/dist/runner/policy-writes.d.ts +1 -1
  206. package/dist/runner/policy-writes.js +1 -1
  207. package/dist/runner/prepare.d.ts +14 -14
  208. package/dist/runner/prepare.js +20 -11
  209. package/dist/runner/ready.d.ts +18 -10
  210. package/dist/runner/ready.js +104 -33
  211. package/dist/runner/sandboxed-command.d.ts +3 -3
  212. package/dist/runner/sandboxed-command.js +3 -3
  213. package/dist/runner/scope.d.ts +10 -6
  214. package/dist/runner/scope.js +10 -3
  215. package/dist/runner/secrets.d.ts +13 -13
  216. package/dist/runner/secrets.js +18 -15
  217. package/dist/runner/session.d.ts +8 -8
  218. package/dist/runner/session.js +3 -3
  219. package/dist/runner/shared-snapshot-entry.d.ts +92 -0
  220. package/dist/runner/shared-snapshot-entry.js +168 -0
  221. package/dist/runner/shared-snapshot-list.d.ts +81 -0
  222. package/dist/runner/shared-snapshot-list.js +155 -0
  223. package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
  224. package/dist/runner/shared-snapshot-lookup.js +118 -0
  225. package/dist/runner/shared-snapshot-prune.d.ts +58 -0
  226. package/dist/runner/shared-snapshot-prune.js +133 -0
  227. package/dist/runner/snapshot-build.d.ts +42 -14
  228. package/dist/runner/snapshot-build.js +32 -29
  229. package/dist/runner/snapshot-choice.js +1 -1
  230. package/dist/runner/snapshot-inspect.d.ts +39 -40
  231. package/dist/runner/snapshot-inspect.js +55 -35
  232. package/dist/runner/snapshot-key.d.ts +13 -12
  233. package/dist/runner/snapshot-key.js +13 -12
  234. package/dist/runner/steps.d.ts +1 -1
  235. package/dist/runner/steps.js +1 -1
  236. package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +2 -2
  237. package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
  238. package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +24 -23
  239. package/dist/runner/{recipe.js → vercel-sandbox-options.js} +70 -69
  240. package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
  241. package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
  242. package/dist/sdk/extension/commands.d.ts +8 -3
  243. package/dist/sdk/extension/commands.js +3 -1
  244. package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
  245. package/dist/sdk/extension/credential-diagnosis.js +25 -5
  246. package/dist/sdk/extension/credential-source.d.ts +20 -3
  247. package/dist/sdk/extension/credential-source.js +4 -4
  248. package/dist/sdk/extension/index.d.ts +3 -2
  249. package/dist/sdk/extension/index.js +2 -1
  250. package/dist/sdk/extension/resource-definition.d.ts +1 -1
  251. package/dist/sdk/extension/secret-source.d.ts +1 -1
  252. package/dist/sdk/extension/secret-source.js +1 -1
  253. package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
  254. package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
  255. package/dist/shared/cleanup.d.ts +3 -3
  256. package/dist/shared/cleanup.js +15 -5
  257. package/dist/shared/snapshot-text.d.ts +4 -4
  258. package/dist/shared/snapshot-text.js +11 -11
  259. package/dist/time/duration.js +1 -1
  260. package/package.json +3 -2
  261. package/skills/overview.md +4 -4
  262. package/skills/plan-runs.md +1 -1
  263. package/skills/read-run-output.md +6 -6
  264. package/dist/chunks/chunk-7EENF73W.js +0 -782
  265. package/dist/chunks/chunk-Z5PBVG3Y.js +0 -2599
  266. package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
  267. package/dist/commands/exec/across-sandboxes-run.js +0 -339
  268. package/dist/commands/exec/plan-only.d.ts +0 -10
  269. package/dist/commands/exec/plan-only.js +0 -45
  270. package/dist/commands/exec/run-command.d.ts +0 -475
  271. package/dist/commands/exec/run-command.js +0 -603
  272. package/dist/commands/exec/run-planned.d.ts +0 -20
  273. package/dist/commands/exec/run-planned.js +0 -22
  274. package/dist/commands/exec/sandbox-view.d.ts +0 -19
  275. package/dist/commands/exec/sandbox-view.js +0 -72
  276. package/dist/commands/test/plan.d.ts +0 -92
  277. package/dist/commands/test/plan.js +0 -125
  278. package/dist/core/sandbox-end.d.ts +0 -64
  279. package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
  280. package/dist/runner/snapshot-cache.d.ts +0 -148
  281. package/dist/runner/snapshot-cache.js +0 -126
@@ -0,0 +1,58 @@
1
+ import type { SandboxAccess } from "./gateways.ts";
2
+ import type { SharedSnapshotLookupContext } from "./shared-snapshot-lookup.ts";
3
+ /** What `pruneSharedSnapshots` deletes or previews across the project's shared snapshot index. */
4
+ export interface SharedSnapshotPruneRequest {
5
+ readonly access: SandboxAccess;
6
+ readonly dryRun: boolean;
7
+ }
8
+ /** Why a shared snapshot index sandbox is eligible for pruning. */
9
+ export type SharedSnapshotPruneReason = "no-snapshot" | "expired" | "missing" | "failed";
10
+ /** One shared snapshot index sandbox deleted (or marked for deletion under `dryRun`). */
11
+ export type PrunedSharedSnapshot = {
12
+ readonly name: string;
13
+ readonly reason: "no-snapshot";
14
+ } | {
15
+ readonly name: string;
16
+ readonly reason: "failed";
17
+ } | {
18
+ readonly name: string;
19
+ readonly reason: "expired";
20
+ readonly snapshotId: string;
21
+ } | {
22
+ readonly name: string;
23
+ readonly reason: "missing";
24
+ readonly snapshotId: string;
25
+ };
26
+ /** One shared snapshot index sandbox whose verification or deletion failed during pruning. */
27
+ export interface SharedSnapshotPruneFailure {
28
+ readonly name: string;
29
+ readonly message: string;
30
+ }
31
+ /** What `pruneSharedSnapshots` scanned, deleted, skipped, and failed on. */
32
+ export interface SharedSnapshotPruneSummary {
33
+ readonly scanned: number;
34
+ readonly deleted: readonly PrunedSharedSnapshot[];
35
+ readonly skipped: number;
36
+ readonly failed: readonly SharedSnapshotPruneFailure[];
37
+ readonly dryRun: boolean;
38
+ }
39
+ /** How `pruneSharedSnapshots` ended. */
40
+ export type SharedSnapshotPruneResult = {
41
+ readonly kind: "ok";
42
+ readonly summary: SharedSnapshotPruneSummary;
43
+ } | {
44
+ readonly kind: "failed";
45
+ readonly message: string;
46
+ } | {
47
+ readonly kind: "aborted";
48
+ };
49
+ /**
50
+ * Scans every valid `storm-snap-<bucket>-<base>` named sandbox in the project and deletes entries that ended failed or
51
+ * aborted (`failed`), stopped entries without a `currentSnapshotId` (`no-snapshot`), or stopped entries whose snapshot
52
+ * is verified missing or not `created` (`missing`) or expired (`expired`). Active builds (`pending`, `running`,
53
+ * `snapshotting`, or `stopping`) and stopped entries whose `expires-at` tag is still in the future are skipped without
54
+ * calling `getSnapshot` (including entries that expire within the hour and are not yet expired). Non-index sandboxes
55
+ * whose names do not match `storm-snap-<16-hex>-<40-hex>` are ignored. Verification and deletion run with bounded
56
+ * concurrency.
57
+ */
58
+ export declare function pruneSharedSnapshots(context: Pick<SharedSnapshotLookupContext, "runnerSandboxes" | "clock">, request: SharedSnapshotPruneRequest, signal?: AbortSignal): Promise<SharedSnapshotPruneResult>;
@@ -0,0 +1,133 @@
1
+ // Pruning dead entries from the shared snapshot index (`storm snapshots prune`): scans valid
2
+ // `storm-snap-<bucket>-<base>` named sandboxes, skips active builds and stopped entries whose `expires-at` tag is
3
+ // still in the future, classifies the remaining entries through the canonical shared-snapshot classifier, and deletes
4
+ // `failed`, `no-snapshot`, `missing`, and `expired` entries.
5
+ import { classifyUnverifiedSharedSandbox, classifyVerifiedSharedSnapshot, INDEX_CONCURRENCY, parseSharedSnapshotSandboxName, runLimited, SHARED_SNAPSHOT_SANDBOX_PREFIX, } from "./shared-snapshot-entry.js";
6
+ /**
7
+ * Scans every valid `storm-snap-<bucket>-<base>` named sandbox in the project and deletes entries that ended failed or
8
+ * aborted (`failed`), stopped entries without a `currentSnapshotId` (`no-snapshot`), or stopped entries whose snapshot
9
+ * is verified missing or not `created` (`missing`) or expired (`expired`). Active builds (`pending`, `running`,
10
+ * `snapshotting`, or `stopping`) and stopped entries whose `expires-at` tag is still in the future are skipped without
11
+ * calling `getSnapshot` (including entries that expire within the hour and are not yet expired). Non-index sandboxes
12
+ * whose names do not match `storm-snap-<16-hex>-<40-hex>` are ignored. Verification and deletion run with bounded
13
+ * concurrency.
14
+ */
15
+ export async function pruneSharedSnapshots(context, request, signal) {
16
+ const { runnerSandboxes, clock } = context;
17
+ const { access, dryRun } = request;
18
+ const listed = await runnerSandboxes.listNamedSandboxes(access, { namePrefix: SHARED_SNAPSHOT_SANDBOX_PREFIX }, signal);
19
+ if (!listed.ok) {
20
+ return listed.failure.kind === "aborted"
21
+ ? { kind: "aborted" }
22
+ : { kind: "failed", message: listed.failure.message };
23
+ }
24
+ const validRows = listed.value.filter((row) => parseSharedSnapshotSandboxName(row.name) !== null);
25
+ const now = clock.now();
26
+ const nowMs = now.getTime();
27
+ let aborted = false;
28
+ const checked = await runLimited(validRows.length, INDEX_CONCURRENCY, () => !aborted && !isAborted(signal), async (index) => {
29
+ const row = validRows[index];
30
+ const unverified = classifyUnverifiedSharedSandbox(row);
31
+ if (unverified.kind === "settled") {
32
+ switch (unverified.status) {
33
+ case "building":
34
+ return { kind: "skip" };
35
+ case "failed":
36
+ return { kind: "mark", entry: { name: row.name, reason: "failed" } };
37
+ case "no-snapshot":
38
+ return { kind: "mark", entry: { name: row.name, reason: "no-snapshot" } };
39
+ }
40
+ }
41
+ // Fast-path: skip stopped entries whose `expires-at` tag is still in the future without calling `getSnapshot`.
42
+ const tagExpiresAt = row.tags["expires-at"];
43
+ if (tagExpiresAt !== undefined) {
44
+ const tagMs = Date.parse(tagExpiresAt);
45
+ if (!Number.isNaN(tagMs) && tagMs > nowMs)
46
+ return { kind: "skip" };
47
+ }
48
+ const verified = await runnerSandboxes.getSnapshot(access, { snapshotId: unverified.snapshotId }, signal);
49
+ if (!verified.ok) {
50
+ if (verified.failure.kind === "aborted") {
51
+ aborted = true;
52
+ return undefined;
53
+ }
54
+ return { kind: "failed", failure: { name: row.name, message: verified.failure.message } };
55
+ }
56
+ const classified = classifyVerifiedSharedSnapshot({ ...row, currentSnapshotId: unverified.snapshotId }, verified.value, now);
57
+ switch (classified.status) {
58
+ case "missing":
59
+ return { kind: "mark", entry: { name: row.name, reason: "missing", snapshotId: unverified.snapshotId } };
60
+ case "expired":
61
+ return { kind: "mark", entry: { name: row.name, reason: "expired", snapshotId: unverified.snapshotId } };
62
+ case "ready":
63
+ case "expires-soon":
64
+ case "unknown-expiry":
65
+ return { kind: "skip" };
66
+ }
67
+ });
68
+ if (aborted || isAborted(signal))
69
+ return { kind: "aborted" };
70
+ const marked = [];
71
+ const failed = [];
72
+ let skipped = 0;
73
+ for (const outcome of checked) {
74
+ if (outcome === undefined)
75
+ continue;
76
+ switch (outcome.kind) {
77
+ case "skip":
78
+ skipped += 1;
79
+ break;
80
+ case "mark":
81
+ marked.push(outcome.entry);
82
+ break;
83
+ case "failed":
84
+ failed.push(outcome.failure);
85
+ break;
86
+ }
87
+ }
88
+ const deleted = [];
89
+ if (dryRun) {
90
+ deleted.push(...marked);
91
+ }
92
+ else {
93
+ const deleteResults = await runLimited(marked.length, INDEX_CONCURRENCY, () => !aborted && !isAborted(signal), async (index) => {
94
+ const entry = marked[index];
95
+ const removed = await runnerSandboxes.deleteNamedSandbox(access, { name: entry.name }, signal);
96
+ if (removed.ok)
97
+ return { kind: "deleted", entry };
98
+ if (removed.failure.kind === "aborted") {
99
+ aborted = true;
100
+ return undefined;
101
+ }
102
+ return { kind: "failed", failure: { name: entry.name, message: removed.failure.message } };
103
+ });
104
+ if (aborted || isAborted(signal))
105
+ return { kind: "aborted" };
106
+ for (const outcome of deleteResults) {
107
+ if (outcome === undefined)
108
+ continue;
109
+ switch (outcome.kind) {
110
+ case "deleted":
111
+ deleted.push(outcome.entry);
112
+ break;
113
+ case "failed":
114
+ failed.push(outcome.failure);
115
+ break;
116
+ }
117
+ }
118
+ }
119
+ return {
120
+ kind: "ok",
121
+ summary: {
122
+ scanned: validRows.length,
123
+ deleted,
124
+ skipped,
125
+ failed,
126
+ dryRun,
127
+ },
128
+ };
129
+ }
130
+ /** Whether `signal` has aborted now. */
131
+ function isAborted(signal) {
132
+ return signal?.aborted === true;
133
+ }
@@ -1,51 +1,79 @@
1
1
  import type { SandboxCredential } from "../sdk/extension/index.ts";
2
2
  import { type RunnerContext } from "./context.ts";
3
3
  import type { RunnerProgress, RunnerStage, SnapshotBuildReason } from "./events.ts";
4
- import type { RunnerSnapshotCacheFailure, RunnerSnapshotEntry, SandboxAccess } from "./gateways.ts";
4
+ import type { RunnerSnapshotEntry, RunnerSnapshotIndexFailure, SandboxAccess } from "./gateways.ts";
5
5
  import type { PreparedRunner } from "./prepare.ts";
6
6
  import type { RunnerSandboxScope } from "./scope.ts";
7
7
  /** How long a build sandbox may live: 30 minutes. */
8
8
  export declare const BUILD_SANDBOX_TIMEOUT_MS: number;
9
9
  /** The label of the step between the toolchain and prebuild steps that commits the base's files. */
10
10
  export declare const BASE_INDEX_LABEL = "Committing the base's files";
11
- /** A runner snapshot a run built and the cache entry recorded for it, or why the cache couldn't record it. */
11
+ /** A runner snapshot a run built and the local snapshot index entry recorded for it, or why it couldn't record it. */
12
12
  export interface BuiltSnapshot {
13
13
  readonly entry: RunnerSnapshotEntry;
14
- /** How long the build took, from its start to the cache entry. */
14
+ /** How long the build took, from its start to the local snapshot index entry. */
15
15
  readonly ms: number;
16
16
  readonly sizeBytes: number;
17
- /** Why the cache couldn't write `entry`; null when it wrote it. */
18
- readonly cacheFailure: RunnerSnapshotCacheFailure | null;
17
+ /** Why the local snapshot index couldn't write `entry`; null when it wrote it. */
18
+ readonly localIndexFailure: RunnerSnapshotIndexFailure | null;
19
19
  }
20
20
  /**
21
- * What a base snapshot build reads of a prepared run, or of a `storm snapshots build` plan: the recipe, the
21
+ * What a runner snapshot build reads of a prepared run, or of a `storm snapshots build` plan: the runner options, the
22
22
  * checkout, the base, its snapshot steps and key, and how many commits HEAD has after the base.
23
23
  */
24
- export interface BaseSnapshotPlan extends Pick<PreparedRunner, "recipe" | "repoRoot" | "base" | "baseFiles" | "snapshotKey"> {
24
+ export interface RunnerSnapshotPlan extends Pick<PreparedRunner, "options" | "repoRoot" | "base" | "baseFiles" | "snapshotKey"> {
25
25
  /** How many commits HEAD has after the base; null for a `--base` commit that isn't HEAD's merge-base. */
26
26
  readonly commitsAfterBase: number | null;
27
27
  }
28
28
  /** What a snapshot build needs to know: what it builds, who it runs as, the credentials, and why it builds. */
29
29
  export interface BuildSnapshotRequest {
30
- readonly prepared: BaseSnapshotPlan;
30
+ readonly prepared: RunnerSnapshotPlan;
31
31
  readonly access: SandboxAccess;
32
32
  /** The local user, for the sandbox's `user` tag. */
33
33
  readonly user: string;
34
34
  /**
35
- * The recipe's credentials, with their values; the firewall adds each one from before the first toolchain step until
35
+ * The runner's credentials, with their values; the firewall adds each one from before the first toolchain step until
36
36
  * the scope revokes them before the snapshot save, or in its fence if the build ends early.
37
37
  */
38
38
  readonly credentials: readonly Required<SandboxCredential>[];
39
39
  /** Why it builds, for the line that says so. */
40
40
  readonly why: SnapshotBuildReason;
41
+ /**
42
+ * Publish the build to the shared snapshot index: the build sandbox takes `name` and `tags`
43
+ * (`snapshotIndexTags`), and stays in the project, stopped, once saved. Undefined builds an unnamed build sandbox
44
+ * with the runner's tags, which is deleted once saved.
45
+ */
46
+ readonly publish?: SnapshotPublish;
47
+ }
48
+ /** The name and tags of a build sandbox kept stopped as a shared snapshot index entry. */
49
+ export interface SnapshotPublish {
50
+ readonly name: string;
51
+ readonly tags: Readonly<Record<string, string>>;
41
52
  }
42
53
  /**
43
- * Builds a base snapshot of `prepared.base`. The build sandbox starts while the base's files are packed, and is
44
- * deleted once saved; a build that fails leaves it to the scope to stop and delete. Its cache entry replaces one of the
45
- * same identity, a base snapshot of the same owner, recipe, snapshot key and base. A cache entry that can't be written
46
- * is reported, and the build still succeeds, saying why (`BuiltSnapshot.cacheFailure`).
54
+ * How a published snapshot build ended: a build's stage, or `name-taken` when a sandbox named `name` already exists in
55
+ * the project, such as one another build started first, so this build started nothing.
47
56
  */
48
- export declare function buildSnapshot(context: Pick<RunnerContext, "checkout" | "runnerSnapshots" | "runnerSandboxes" | "clock">, request: BuildSnapshotRequest, control: {
57
+ export type PublishedSnapshotStage = RunnerStage<BuiltSnapshot> | {
58
+ readonly kind: "name-taken";
59
+ readonly name: string;
60
+ readonly message: string;
61
+ };
62
+ /**
63
+ * Builds a runner snapshot of `prepared.base`. The build sandbox starts while the base's files are packed, and is
64
+ * deleted once saved; a build that fails leaves it to the scope to stop and delete. Its local snapshot index entry
65
+ * replaces one of the same identity, a runner snapshot of the same owner, runner, snapshot key, and base. A local
66
+ * snapshot index entry that can't be written is reported, and the build still succeeds, saying why
67
+ * (`BuiltSnapshot.localIndexFailure`). With `publish`, the build sandbox takes its name and tags and stays in the
68
+ * project, stopped, once saved, and a name already taken ends the build `name-taken` before anything else starts.
69
+ */
70
+ export declare function buildSnapshot(context: Pick<RunnerContext, "checkout" | "runnerSnapshots" | "runnerSandboxes" | "clock">, request: BuildSnapshotRequest & {
71
+ readonly publish?: undefined;
72
+ }, control: {
49
73
  readonly scope: RunnerSandboxScope;
50
74
  readonly signal: AbortSignal;
51
75
  }, progress: RunnerProgress): Promise<RunnerStage<BuiltSnapshot>>;
76
+ export declare function buildSnapshot(context: Pick<RunnerContext, "checkout" | "runnerSnapshots" | "runnerSandboxes" | "clock">, request: BuildSnapshotRequest, control: {
77
+ readonly scope: RunnerSandboxScope;
78
+ readonly signal: AbortSignal;
79
+ }, progress: RunnerProgress): Promise<PublishedSnapshotStage>;
@@ -1,53 +1,53 @@
1
1
  // Building a runner snapshot of a run's base: a build sandbox runs the toolchain steps, commits exactly the base's
2
- // tracked files, runs the prebuild steps, and is saved as a snapshot, which the cache then records. The sandbox scope
3
- // grants the recipe's credentials before the first toolchain step, and revokes them before the snapshot save (or in the
4
- // scope's fence if the build fails or is canceled).
2
+ // tracked files, runs the prebuild steps, and is saved as a snapshot, which the local snapshot index then records. The
3
+ // sandbox scope grants the runner's credentials before the first toolchain step, and revokes them before the snapshot
4
+ // save (or in the scope's fence if the build fails or is canceled). A published build names its build sandbox and keeps
5
+ // it stopped once saved, as an entry of the shared snapshot index.
5
6
  import { runnerTags } from "./context.js";
6
- import { SNAPSHOT_EXPIRATION_MS } from "./snapshot-cache.js";
7
+ import { SNAPSHOT_EXPIRATION_MS } from "./local-snapshot-index.js";
7
8
  import { baseIndexScript, STAGED_FILES } from "./snapshot-key.js";
8
9
  import { networkPolicyStop, runStep, sandboxStop } from "./steps.js";
9
10
  /** How long a build sandbox may live: 30 minutes. */
10
11
  export const BUILD_SANDBOX_TIMEOUT_MS = 30 * 60_000;
11
12
  /** The label of the step between the toolchain and prebuild steps that commits the base's files. */
12
13
  export const BASE_INDEX_LABEL = "Committing the base's files";
13
- /**
14
- * Builds a base snapshot of `prepared.base`. The build sandbox starts while the base's files are packed, and is
15
- * deleted once saved; a build that fails leaves it to the scope to stop and delete. Its cache entry replaces one of the
16
- * same identity, a base snapshot of the same owner, recipe, snapshot key and base. A cache entry that can't be written
17
- * is reported, and the build still succeeds, saying why (`BuiltSnapshot.cacheFailure`).
18
- */
19
14
  export async function buildSnapshot(context, request, control, progress) {
20
15
  const { prepared, access } = request;
21
- const { recipe, repoRoot, base } = prepared;
16
+ const { options, repoRoot, base } = prepared;
22
17
  const { scope, signal } = control;
18
+ const { publish } = request;
23
19
  const now = () => context.clock.now().getTime();
24
20
  const startedAt = now();
25
21
  await progress.emit({
26
22
  kind: "snapshot-build-started",
27
23
  base,
28
24
  why: request.why,
29
- summary: recipe.snapshot.summary ??
30
- [...recipe.snapshot.toolchains, ...recipe.snapshot.prebuild].map(({ label }) => label).join(", "),
25
+ summary: options.snapshot.summary ??
26
+ [...options.snapshot.toolchains, ...options.snapshot.prebuild].map(({ label }) => label).join(", "),
31
27
  });
32
28
  const [started, archive] = await Promise.all([
33
29
  scope.startBuildSandbox(access, {
34
- region: recipe.region,
35
- runtime: recipe.runtime,
36
- vcpus: recipe.snapshot.vcpus,
30
+ region: options.region,
31
+ runtime: options.runtime,
32
+ vcpus: options.snapshot.vcpus,
37
33
  timeoutMs: BUILD_SANDBOX_TIMEOUT_MS,
38
- tags: runnerTags(recipe.name, "snapshot-build", request.user),
34
+ ...(publish === undefined
35
+ ? { tags: runnerTags(options.name, "snapshot-build", request.user) }
36
+ : { name: publish.name, tags: publish.tags }),
39
37
  }),
40
38
  context.checkout.baseArchive({ repoRoot, base }),
41
39
  ]);
42
40
  if (!started.ok)
43
- return sandboxStop("start-build-sandbox", started.failure);
41
+ return started.failure.kind === "name-taken"
42
+ ? { kind: "name-taken", name: started.failure.name, message: started.failure.message }
43
+ : sandboxStop("start-build-sandbox", started.failure);
44
44
  const sandbox = started.value;
45
45
  await progress.emit({
46
46
  kind: "sandbox-started",
47
47
  role: "snapshot-build",
48
48
  name: sandbox.name,
49
- region: recipe.region,
50
- vcpus: recipe.snapshot.vcpus,
49
+ region: options.region,
50
+ vcpus: options.snapshot.vcpus,
51
51
  ms: now() - startedAt,
52
52
  });
53
53
  if (!archive.ok)
@@ -64,16 +64,16 @@ export async function buildSnapshot(context, request, control, progress) {
64
64
  if (!placed.ok)
65
65
  return sandboxStop("upload", placed.failure);
66
66
  }
67
- // Every credential the recipe declares goes on the steps' requests, from before the first toolchain step until
67
+ // Every credential the runner declares goes on the steps' requests, from before the first toolchain step until
68
68
  // `saveSnapshot` revokes them before saving (or the scope's fence revokes them if a step fails or the build is
69
69
  // canceled). storm's own base-index step falls inside: it runs only tar and git on the uploaded files, so it makes no
70
70
  // request, and revoking and granting again around it would add two writes and their failures for nothing.
71
71
  const steps = [
72
- ...recipe.snapshot.toolchains,
72
+ ...options.snapshot.toolchains,
73
73
  { label: BASE_INDEX_LABEL, script: baseIndexScript(base, staged.value.directory) },
74
- ...recipe.snapshot.prebuild,
74
+ ...options.snapshot.prebuild,
75
75
  ];
76
- await progress.emit({ kind: "output-started", section: "snapshot", sandbox: sandbox.name, region: recipe.region });
76
+ await progress.emit({ kind: "output-started", section: "snapshot", sandbox: sandbox.name, region: options.region });
77
77
  let stop;
78
78
  if (request.credentials.length > 0) {
79
79
  const granted = await scope.grantCredentials(sandbox, request.credentials, signal);
@@ -114,7 +114,10 @@ export async function buildSnapshot(context, request, control, progress) {
114
114
  if (signal.aborted)
115
115
  return { kind: "aborted" };
116
116
  await progress.emit({ kind: "snapshot-saving" });
117
- const saved = await scope.saveSnapshot(sandbox, { expirationMs: SNAPSHOT_EXPIRATION_MS });
117
+ const saved = await scope.saveSnapshot(sandbox, {
118
+ expirationMs: SNAPSHOT_EXPIRATION_MS,
119
+ ...(publish === undefined ? {} : { keepStopped: true }),
120
+ });
118
121
  if (!saved.ok)
119
122
  return saved.failure.kind === "credential-not-revoked"
120
123
  ? networkPolicyStop("remove", "snapshot-save", saved.failure.failure)
@@ -123,9 +126,9 @@ export async function buildSnapshot(context, request, control, progress) {
123
126
  const entry = {
124
127
  teamId: access.teamId,
125
128
  projectId: access.projectId,
126
- region: recipe.region,
127
- runtime: recipe.runtime,
128
- recipeName: recipe.name,
129
+ region: options.region,
130
+ runtime: options.runtime,
131
+ runnerName: options.name,
129
132
  snapshotKey: prepared.snapshotKey,
130
133
  base,
131
134
  snapshotId: saved.value.snapshotId,
@@ -146,6 +149,6 @@ export async function buildSnapshot(context, request, control, progress) {
146
149
  });
147
150
  return {
148
151
  kind: "ok",
149
- value: { entry, ms, sizeBytes: saved.value.sizeBytes, cacheFailure: written.ok ? null : written.failure },
152
+ value: { entry, ms, sizeBytes: saved.value.sizeBytes, localIndexFailure: written.ok ? null : written.failure },
150
153
  };
151
154
  }
@@ -19,7 +19,7 @@ export async function chooseSnapshotForRun(context, request, control, progress)
19
19
  // reporting cancellation or stopping sandboxes outside the running step.
20
20
  const scope = runnerSandboxScope(context, progress, {
21
21
  keepMs: 0,
22
- basePolicy: runnerNetworkPolicy(request.prepared.recipe),
22
+ basePolicy: runnerNetworkPolicy(request.prepared.options),
23
23
  signal,
24
24
  });
25
25
  try {
@@ -1,85 +1,84 @@
1
1
  import type { CheckoutFailure, CheckoutHead, RunnerSnapshotEntry, UnreadableSnapshotEntry } from "./gateways.ts";
2
- import type { CheckedRecipe } from "./recipe.ts";
3
- import { type SnapshotCacheContext, type SnapshotRejectionReason } from "./snapshot-cache.ts";
2
+ import type { CheckedVercelSandboxOptions } from "./vercel-sandbox-options.ts";
3
+ import { type LocalSnapshotIndexContext, type SnapshotRejectionReason } from "./local-snapshot-index.ts";
4
4
  /**
5
- * One cached runner snapshot, as a checkout sees it: from the checkout's Git history, whether HEAD is its base or
6
- * holds it (`inHistory`), which an amend or a rebase can change, and how many commits HEAD has that its base lacks
7
- * (`builtBehind`). `inHistory` is null when storm didn't check it: outside a Git checkout, or without a recipe or a
8
- * base; `builtBehind` is null then too, and when the base isn't in HEAD's history. `picked` says a run here starts
9
- * from it, for its team and project.
10
- * `reason` says why a run here doesn't (`SnapshotRejectionReason`), `other-recipe` for another recipe's, or null for
5
+ * One runner snapshot in the local snapshot index, as a checkout sees it: from the checkout's Git history, whether HEAD
6
+ * is its base or holds it (`inHistory`), which an amend or a rebase can change, and how many commits HEAD has that its
7
+ * base lacks (`builtBehind`). `inHistory` is null when storm didn't check it: outside a Git checkout, or without a
8
+ * runner or a base; `builtBehind` is null then too, and when the base isn't in HEAD's history. `picked` says a run
9
+ * here starts from it, for its team and project.
10
+ * `reason` says why a run here doesn't (`SnapshotRejectionReason`), `other-runner` for another runner's, or null for
11
11
  * a picked one and when storm checked nothing.
12
12
  */
13
13
  export interface InspectedSnapshot {
14
14
  readonly entry: RunnerSnapshotEntry;
15
15
  readonly inHistory: boolean | null;
16
16
  readonly builtBehind: number | null;
17
+ readonly commitsBehindMergeBase: number | null;
17
18
  readonly expired: boolean;
18
19
  readonly picked: boolean;
19
- readonly reason: SnapshotRejectionReason | "other-recipe" | null;
20
+ readonly reason: SnapshotRejectionReason | "other-runner" | null;
20
21
  }
21
22
  /**
22
- * Why the inspection picked for no recipe: the directory is in no Git checkout (`no-checkout`), no runner recipe
23
- * applies there (`no-recipe`), or no base ref of the recipe exists locally and shares history with HEAD (`no-base`).
23
+ * Why the inspection picked for no runner: the directory is in no Git checkout (`no-checkout`), no Vercel Sandbox
24
+ * runner applies there (`no-runner`), or no base ref of the runner exists locally and shares history with HEAD
25
+ * (`no-base`).
24
26
  */
25
- export type UnpickedReason = "no-checkout" | "no-recipe" | "no-base";
26
- /** What `inspectSnapshotCache` found. */
27
- export interface SnapshotCacheInspection {
28
- /** Where the cache lives. */
27
+ export type UnpickedReason = "no-checkout" | "no-runner" | "no-base";
28
+ /** What `inspectLocalSnapshotIndex` found. */
29
+ export interface LocalSnapshotIndexInspection {
30
+ /** Where the local snapshot index lives. */
29
31
  readonly directory: string;
30
- /** The checkout the directory is in: its root, HEAD, and HEAD's merge-base with a base ref; null without one. */
32
+ /**
33
+ * The checkout the directory is in: its root, HEAD, and HEAD's merge-base with a base ref, with how many commits HEAD
34
+ * has that the merge-base lacks; null without one.
35
+ */
31
36
  readonly checkout: {
32
37
  readonly repoRoot: string;
33
38
  readonly head: CheckoutHead;
34
39
  readonly mergeBase: {
35
40
  readonly commit: string;
36
41
  readonly ref: string;
42
+ readonly commitsAfterBase: number;
37
43
  } | null;
38
44
  } | null;
39
- /** The recipe a run here uses, by name, when storm picked for it; else why it picked for none. */
45
+ /** The runner a run here uses, by name, when storm picked for it; else why it picked for none. */
40
46
  readonly picking: {
41
- readonly kind: "recipe";
42
- readonly recipe: string;
47
+ readonly kind: "runner";
48
+ readonly runner: string;
43
49
  } | {
44
50
  readonly kind: "none";
45
51
  readonly why: UnpickedReason;
46
52
  };
47
- /** The recipe's snapshots, and with `all` every other recipe's too. */
53
+ /** The run's snapshot key at the merge-base, when storm picked for a runner; else null. */
54
+ readonly snapshotKey: string | null;
55
+ /** The runner's snapshots, and with `all` every other runner's too. */
48
56
  readonly snapshots: readonly InspectedSnapshot[];
49
57
  readonly unreadable: readonly UnreadableSnapshotEntry[];
50
58
  }
51
59
  /**
52
- * How an inspection ended: what it found; the cache it couldn't list; git failing while it checked the checkout or a
53
- * snapshot (`checkout-failed`); or a declared base file of the recipe that couldn't be read at the merge-base
54
- * (`invalid-recipe`), as a run's local checks refuse it, with `path` the key inside the recipe.
60
+ * How an inspection ended: what it found; the local snapshot index it couldn't list (`local-index-unreadable`); git
61
+ * failing while it checked the checkout or a snapshot (`checkout-failed`); or a declared base file of the runner that
62
+ * couldn't be read at the merge-base (`invalid-runner`), as a run's local checks refuse it, with `path` the key inside
63
+ * the runner options.
55
64
  */
56
- export type SnapshotCacheInspectionOutcome = {
65
+ export type LocalSnapshotIndexInspectionOutcome = {
57
66
  readonly kind: "ok";
58
- readonly inspection: SnapshotCacheInspection;
67
+ readonly inspection: LocalSnapshotIndexInspection;
59
68
  } | {
60
- readonly kind: "cache-unreadable";
69
+ readonly kind: "local-index-unreadable";
61
70
  readonly path: string;
62
71
  readonly message: string;
63
72
  } | {
64
73
  readonly kind: "checkout-failed";
65
74
  readonly failure: CheckoutFailure;
66
75
  } | {
67
- readonly kind: "invalid-recipe";
76
+ readonly kind: "invalid-runner";
68
77
  readonly path: readonly string[];
69
78
  readonly problem: string;
70
79
  };
71
- /**
72
- * Inspects the cache from `cwd` for `recipe`, the runner recipe that applies there, if any. With a recipe, in a Git
73
- * checkout whose HEAD shares history with one of its base refs, it marks for each team and project the snapshot a run
74
- * here starts from, by a run's own rule (`classifySnapshotEntries`, `pickSnapshot`), and gives each other
75
- * snapshot of the recipe the reason it isn't picked. It reads the recipe's declared base files at the merge-base for
76
- * the run's snapshot key, as a run does. Otherwise it picks none and
77
- * says why. `all` adds the snapshots of other recipes, and of the recipe's other regions and runtimes, as
78
- * `other-recipe`. It lists the cache once and classifies that listing, which removes no file, so an expired entry of
79
- * the recipe stays and is `expired`. A git failure ends it with `checkout-failed`, as it ends a run.
80
- */
81
- export declare function inspectSnapshotCache(context: SnapshotCacheContext, request: {
80
+ export declare function inspectLocalSnapshotIndex(context: LocalSnapshotIndexContext, request: {
82
81
  readonly cwd: string;
83
- readonly recipe: CheckedRecipe | undefined;
82
+ readonly options: CheckedVercelSandboxOptions | undefined;
84
83
  readonly all: boolean;
85
- }): Promise<SnapshotCacheInspectionOutcome>;
84
+ }): Promise<LocalSnapshotIndexInspectionOutcome>;