@cnc-tools/storm 0.12.0 → 0.14.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 (188) hide show
  1. package/dist/application.js +5 -1
  2. package/dist/bin/storm.js +6 -2
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/{chunk-FK4RLDEK.js → chunk-27P2QSIM.js} +1 -1
  5. package/dist/chunks/{chunk-ODQHQJLE.js → chunk-5ED3IDUJ.js} +749 -1121
  6. package/dist/chunks/{chunk-FSP3SJ35.js → chunk-5TMHYH7G.js} +16 -46
  7. package/dist/chunks/{chunk-Y3BUNNRG.js → chunk-BFLYGMG3.js} +12 -7
  8. package/dist/chunks/{chunk-LQKNI3EG.js → chunk-BRUIATTR.js} +6 -6
  9. package/dist/chunks/{chunk-RYRJNHL7.js → chunk-HOKDKP5A.js} +3 -9
  10. package/dist/chunks/{chunk-SXW6XN4R.js → chunk-IVRRGGCD.js} +60 -20
  11. package/dist/chunks/{chunk-TMQQYHUX.js → chunk-QBR5VHJ7.js} +1 -1
  12. package/dist/chunks/{chunk-YT5OROR7.js → chunk-RA4L2ACU.js} +12 -2
  13. package/dist/chunks/{chunk-TEEZL3GA.js → chunk-RKONDLPS.js} +17 -71
  14. package/dist/chunks/{chunk-IYM44FUX.js → chunk-UC6DULWY.js} +2 -2
  15. package/dist/chunks/{chunk-4XT5RC5T.js → chunk-XPCUINWS.js} +6 -42
  16. package/dist/chunks/{chunk-U7M3ZB3Z.js → chunk-YBPTMJUM.js} +123 -180
  17. package/dist/chunks/{chunk-ISGQJIQM.js → chunk-Z5OXOZD3.js} +125 -83
  18. package/dist/chunks/{chunk-7D6LC5JY.js → chunk-ZH5R7W4A.js} +7 -39
  19. package/dist/chunks/{live-app-AZ5N5HBD.js → live-app-FBVWUUMT.js} +7 -7
  20. package/dist/commands/exec/command.d.ts +4 -90
  21. package/dist/commands/exec/command.js +15 -41
  22. package/dist/commands/exec/define-run-command.d.ts +19 -100
  23. package/dist/commands/exec/define-run-command.js +48 -15
  24. package/dist/commands/exec/driver-plan.d.ts +24 -16
  25. package/dist/commands/exec/driver-plan.js +34 -15
  26. package/dist/commands/exec/driver-refusals.js +7 -6
  27. package/dist/commands/exec/exec-words.d.ts +1 -1
  28. package/dist/commands/exec/exec-words.js +8 -2
  29. package/dist/commands/exec/final-results.d.ts +39 -0
  30. package/dist/commands/exec/final-results.js +29 -0
  31. package/dist/commands/exec/live-view.js +18 -22
  32. package/dist/commands/exec/metadata.js +1 -1
  33. package/dist/commands/exec/outcomes.d.ts +15 -109
  34. package/dist/commands/exec/outcomes.js +25 -39
  35. package/dist/commands/exec/plan-run.d.ts +11 -3
  36. package/dist/commands/exec/plan-run.js +3 -2
  37. package/dist/commands/exec/progress.d.ts +3 -19
  38. package/dist/commands/exec/progress.js +16 -60
  39. package/dist/commands/exec/run-command.d.ts +5 -24
  40. package/dist/commands/exec/run-command.js +32 -84
  41. package/dist/commands/exec/run-metadata.d.ts +0 -6
  42. package/dist/commands/exec/run-metadata.js +2 -8
  43. package/dist/commands/exec/snapshot-text.d.ts +7 -16
  44. package/dist/commands/exec/snapshot-text.js +9 -49
  45. package/dist/commands/exec/test-plan.d.ts +2 -1
  46. package/dist/commands/exec/test-plan.js +13 -4
  47. package/dist/commands/exec/tests-summary.d.ts +2 -2
  48. package/dist/commands/exec/view.js +2 -12
  49. package/dist/commands/exec/worker-chart.d.ts +1 -1
  50. package/dist/commands/playwright/command.d.ts +12 -97
  51. package/dist/commands/playwright/command.js +14 -14
  52. package/dist/commands/playwright/metadata.js +2 -2
  53. package/dist/commands/runs/facts.d.ts +1 -37
  54. package/dist/commands/runs/facts.js +4 -36
  55. package/dist/commands/runs/list/command.d.ts +0 -72
  56. package/dist/commands/runs/list/command.js +6 -6
  57. package/dist/commands/runs/list/outcomes.d.ts +0 -36
  58. package/dist/commands/runs/logs/command.js +6 -6
  59. package/dist/commands/runs/show/command.d.ts +2 -74
  60. package/dist/commands/runs/show/command.js +16 -43
  61. package/dist/commands/runs/show/metadata.js +1 -1
  62. package/dist/commands/runs/show/outcomes.d.ts +1 -37
  63. package/dist/commands/runs/show/outcomes.js +8 -42
  64. package/dist/commands/snapshots/build/command.d.ts +14 -411
  65. package/dist/commands/snapshots/build/command.js +59 -234
  66. package/dist/commands/snapshots/build/metadata.js +10 -7
  67. package/dist/commands/snapshots/build/outcomes.d.ts +11 -241
  68. package/dist/commands/snapshots/build/outcomes.js +29 -196
  69. package/dist/commands/snapshots/list/command.d.ts +2 -36
  70. package/dist/commands/snapshots/list/command.js +20 -56
  71. package/dist/commands/snapshots/list/metadata.js +1 -1
  72. package/dist/commands/snapshots/list/outcomes.d.ts +2 -37
  73. package/dist/commands/snapshots/list/outcomes.js +13 -53
  74. package/dist/commands/vitest/command.d.ts +14 -98
  75. package/dist/commands/vitest/command.js +14 -14
  76. package/dist/commands/vitest/metadata.js +2 -2
  77. package/dist/config/resolve.d.ts +1 -1
  78. package/dist/config/resolve.js +2 -1
  79. package/dist/config/schema.d.ts +8 -0
  80. package/dist/config/schema.js +5 -4
  81. package/dist/core/events.d.ts +5 -6
  82. package/dist/core/run-state.d.ts +7 -29
  83. package/dist/core/run-state.js +3 -26
  84. package/dist/core/run.d.ts +6 -14
  85. package/dist/core/run.js +17 -28
  86. package/dist/extensions/playwright/driver.js +17 -10
  87. package/dist/extensions/testserver/commands/pool/create/command.js +4 -4
  88. package/dist/extensions/testserver/commands/pool/list/command.js +2 -2
  89. package/dist/extensions/testserver/definition.d.ts +1 -1
  90. package/dist/extensions/testserver/extension.d.ts +1 -1
  91. package/dist/extensions/testserver/options/rules.d.ts +3 -3
  92. package/dist/extensions/testserver/options/rules.js +5 -5
  93. package/dist/extensions/testserver/resource.d.ts +1 -1
  94. package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -0
  95. package/dist/extensions/testserver/vercel-cli/index.js +1 -0
  96. package/dist/extensions/testserver/vercel-cli/report.js +5 -2
  97. package/dist/extensions/testserver/vercel-cli/session-id.d.ts +8 -0
  98. package/dist/extensions/testserver/vercel-cli/session-id.js +16 -0
  99. package/dist/extensions/testserver/vitest/config.d.ts +2 -2
  100. package/dist/extensions/testserver/vitest/config.js +2 -2
  101. package/dist/extensions/testserver/vitest/container-scope.d.ts +25 -16
  102. package/dist/extensions/testserver/vitest/container-scope.js +32 -13
  103. package/dist/extensions/testserver/vitest/diagnostics.d.ts +5 -4
  104. package/dist/extensions/testserver/vitest/diagnostics.js +15 -8
  105. package/dist/extensions/testserver/vitest/fixtures.d.ts +10 -1
  106. package/dist/extensions/testserver/vitest/fixtures.js +36 -10
  107. package/dist/extensions/testserver/vitest/types.d.ts +9 -0
  108. package/dist/extensions/vitest/driver.js +28 -14
  109. package/dist/extensions/vitest/plan/gateways.d.ts +28 -5
  110. package/dist/extensions/vitest/plan/gateways.js +2 -2
  111. package/dist/extensions/vitest/plan/list-output.d.ts +5 -0
  112. package/dist/extensions/vitest/plan/list-output.js +23 -9
  113. package/dist/extensions/vitest/plan/live/list-gateway.d.ts +3 -2
  114. package/dist/extensions/vitest/plan/live/list-gateway.js +77 -64
  115. package/dist/extensions/vitest/plan/plan-over.d.ts +19 -7
  116. package/dist/extensions/vitest/plan/plan-over.js +18 -7
  117. package/dist/extensions/vitest/plan/plan.d.ts +14 -5
  118. package/dist/extensions/vitest/plan/plan.js +23 -9
  119. package/dist/extensions.d.ts +2 -2
  120. package/dist/run-directory/index.d.ts +1 -1
  121. package/dist/run-directory/index.js +0 -1
  122. package/dist/run-directory/plan.d.ts +3 -2
  123. package/dist/run-directory/plan.js +6 -3
  124. package/dist/run-directory/recording.js +2 -2
  125. package/dist/run-directory/run-record.d.ts +18 -135
  126. package/dist/run-directory/run-record.js +8 -68
  127. package/dist/runner/build-snapshots.d.ts +50 -114
  128. package/dist/runner/build-snapshots.js +70 -159
  129. package/dist/runner/events.d.ts +4 -88
  130. package/dist/runner/gateways.d.ts +5 -23
  131. package/dist/runner/index.d.ts +5 -6
  132. package/dist/runner/index.js +1 -1
  133. package/dist/runner/live/snapshot-records.js +7 -18
  134. package/dist/runner/prepare.d.ts +11 -22
  135. package/dist/runner/prepare.js +6 -17
  136. package/dist/runner/ready.d.ts +16 -45
  137. package/dist/runner/ready.js +34 -59
  138. package/dist/runner/recipe.d.ts +5 -45
  139. package/dist/runner/recipe.js +0 -41
  140. package/dist/runner/sandboxed-command.d.ts +5 -3
  141. package/dist/runner/sandboxed-command.js +10 -4
  142. package/dist/runner/scope.d.ts +8 -25
  143. package/dist/runner/scope.js +4 -8
  144. package/dist/runner/session.d.ts +18 -65
  145. package/dist/runner/session.js +15 -83
  146. package/dist/runner/snapshot-build.d.ts +2 -2
  147. package/dist/runner/snapshot-cache.d.ts +22 -74
  148. package/dist/runner/snapshot-cache.js +15 -107
  149. package/dist/runner/snapshot-inspect.d.ts +9 -13
  150. package/dist/runner/snapshot-inspect.js +48 -57
  151. package/dist/runner/snapshot-key.d.ts +9 -14
  152. package/dist/runner/snapshot-key.js +15 -22
  153. package/dist/sdk/extension/driver.d.ts +32 -6
  154. package/dist/sdk/extension/driver.js +12 -2
  155. package/dist/sdk/extension/index.d.ts +1 -1
  156. package/dist/sdk/extension/index.js +2 -1
  157. package/dist/sdk/extension/resource-definition.d.ts +6 -5
  158. package/dist/vendor/testserver-sdk/container/api-request.d.ts +2 -3
  159. package/dist/vendor/testserver-sdk/container/api-request.js +2 -3
  160. package/dist/vendor/testserver-sdk/container/container.d.ts +12 -2
  161. package/dist/vendor/testserver-sdk/container/container.js +10 -7
  162. package/dist/vendor/testserver-sdk/container/recorder.d.ts +29 -7
  163. package/dist/vendor/testserver-sdk/container/recorder.js +26 -14
  164. package/dist/vendor/testserver-sdk/index.d.ts +1 -1
  165. package/dist/vendor/testserver-sdk/index.js +1 -1
  166. package/dist/vendor/testserver-sdk/proxy/exchange.d.ts +24 -5
  167. package/dist/vendor/testserver-sdk/proxy/exchange.js +43 -25
  168. package/dist/vendor/testserver-sdk/proxy/faulted-exchange.js +15 -10
  169. package/dist/vendor/testserver-sdk/proxy/faults.d.ts +6 -5
  170. package/dist/vendor/testserver-sdk/proxy/proxy.d.ts +10 -1
  171. package/dist/vendor/testserver-sdk/proxy/proxy.js +5 -3
  172. package/dist/vendor/testserver-sdk/proxy/records.d.ts +17 -17
  173. package/dist/vendor/testserver-sdk/proxy/records.js +18 -17
  174. package/dist/vendor/testserver-sdk/records/body.d.ts +7 -9
  175. package/dist/vendor/testserver-sdk/records/body.js +10 -15
  176. package/dist/vendor/testserver-sdk/records/headers.d.ts +79 -0
  177. package/dist/vendor/testserver-sdk/records/headers.js +162 -0
  178. package/dist/vendor/testserver-sdk/records/index.d.ts +2 -1
  179. package/dist/vendor/testserver-sdk/records/index.js +4 -2
  180. package/dist/vendor/testserver-sdk/records/records.d.ts +19 -10
  181. package/package.json +5 -4
  182. package/skills/overview.md +5 -5
  183. package/skills/read-run-output.md +8 -9
  184. package/dist/runner/snapshot-save.d.ts +0 -70
  185. package/dist/runner/snapshot-save.js +0 -160
  186. package/dist/runner/snapshot-start.d.ts +0 -25
  187. package/dist/runner/snapshot-start.js +0 -16
  188. package/skills/testserver-builds.md +0 -82
@@ -47,9 +47,8 @@ export type SnapshotBuildReason = {
47
47
  /**
48
48
  * What the runner reports, in order.
49
49
  *
50
- * - `snapshot-reused`: the run starts from cached runner snapshot `snapshotId`, of `base`; for a dev snapshot,
51
- * saved at HEAD commit `head` by a run on `branch`, which is null when that run's HEAD was detached. Both are null
52
- * for a base snapshot. `snapshot` says its kind, its built-at commit and how far it is behind the run.
50
+ * - `snapshot-reused`: the run starts from cached runner snapshot `snapshotId`, built at `base`; `builtBehind` is how
51
+ * many commits HEAD has that `base` lacks.
53
52
  * - `snapshot-build-started`: a base snapshot of `base` is being built, and `why` (`SnapshotBuildReason`); `summary`
54
53
  * says what the build does.
55
54
  * - `runner-sandbox-starting`: the runner sandbox is starting from runner snapshot `snapshotId`.
@@ -58,7 +57,7 @@ export type SnapshotBuildReason = {
58
57
  * - `step-started`, `step-output` (one line, without its newline) and `step-finished`: a step's progress.
59
58
  * - `snapshot-saving`: the build sandbox is being saved as a runner snapshot.
60
59
  * - `snapshot-built`: it was, in `ms` from the build's start; `builtBehind` is how many commits HEAD has that `base`
61
- * lacks, null for a `storm snapshots build --base` commit that isn't in HEAD's history.
60
+ * lacks, null for a `storm snapshots build --base` commit that isn't HEAD's merge-base.
62
61
  * - `snapshot-entry-not-written`: the cache couldn't record the new snapshot; the run goes on.
63
62
  * - `uploading`: the run's changes are being uploaded to the runner sandbox.
64
63
  * - `uploaded`: the run's changes, `bytes` in all, reached the runner sandbox.
@@ -70,22 +69,12 @@ export type SnapshotBuildReason = {
70
69
  * and releasing the run's resources.
71
70
  * - `waiting-for-snapshot`: closing waits up to `settleMs` for a runner snapshot still saving.
72
71
  * - `sandbox-kept`: closing kept runner sandbox `name` running until `stopsAt`, an ISO time.
73
- * - `dev-snapshot-saving`: the run saves the runner sandbox as a dev snapshot, once the command ended; `branch` is
74
- * HEAD's branch, null when detached.
75
- * - `dev-snapshot-saved`: it did, as runner snapshot `snapshotId` at HEAD commit `head`, in `ms`.
76
- * - `dev-snapshot-not-saved`: it didn't, and `save` says why.
77
- * - `dev-snapshot-skipped`: the command ended on its own and the run starts no save, for `reason`.
78
- * - `dev-snapshots-dropped`: `storm snapshots build --full` removed the cache entries of the dev snapshots built on
79
- * the base snapshot it replaced, from any checkout.
80
- * - `dev-snapshots-not-dropped`: it couldn't list the cache or remove an entry; `message` says which.
81
72
  */
82
73
  export type RunnerEvent = {
83
74
  readonly kind: "snapshot-reused";
84
75
  readonly snapshotId: string;
85
76
  readonly base: string;
86
- readonly branch: string | null;
87
- readonly head: string | null;
88
- readonly snapshot: StartedFromSnapshot;
77
+ readonly builtBehind: number;
89
78
  } | {
90
79
  readonly kind: "snapshot-build-started";
91
80
  readonly base: string;
@@ -160,30 +149,6 @@ export type RunnerEvent = {
160
149
  readonly kind: "sandbox-kept";
161
150
  readonly name: string;
162
151
  readonly stopsAt: string;
163
- } | {
164
- readonly kind: "dev-snapshot-saving";
165
- readonly branch: string | null;
166
- } | {
167
- readonly kind: "dev-snapshot-saved";
168
- readonly snapshotId: string;
169
- readonly branch: string | null;
170
- readonly head: string;
171
- readonly ms: number;
172
- readonly sizeBytes: number;
173
- } | {
174
- readonly kind: "dev-snapshot-not-saved";
175
- readonly save: Exclude<RunnerSave, {
176
- readonly kind: "saved";
177
- }>;
178
- } | {
179
- readonly kind: "dev-snapshot-skipped";
180
- readonly reason: RunnerNoSaveReason;
181
- } | {
182
- readonly kind: "dev-snapshots-dropped";
183
- readonly snapshotIds: readonly string[];
184
- } | {
185
- readonly kind: "dev-snapshots-not-dropped";
186
- readonly message: string;
187
152
  };
188
153
  /** Hears the runner's events as they happen. */
189
154
  export interface RunnerProgress {
@@ -213,55 +178,6 @@ export type RunnerFailure = {
213
178
  readonly kind: "checkout-failed";
214
179
  readonly failure: CheckoutFailure;
215
180
  };
216
- /**
217
- * The runner snapshot a run starts from, in commits: its kind, the commit it was built at (a base snapshot's base, or
218
- * the commit that saved a dev snapshot), and how many commits HEAD has that its built-at commit lacks
219
- * (`builtBehind`). The count is null when the commit isn't in HEAD's history, as for a `storm snapshots build --base`
220
- * build, or when an older run record holds none.
221
- */
222
- export interface StartedFromSnapshot {
223
- readonly kind: "base" | "dev";
224
- readonly builtAt: string;
225
- readonly builtBehind: number | null;
226
- }
227
- /**
228
- * Why a run saves never, decided before it starts: `--save-dev-snapshot=false` (`no-save-flag`), the recipe's
229
- * `saveDevSnapshot: false` (`recipe`), a `--keep-sandbox` above 0 (`keep-sandbox`), `CI` set (`ci`), or a recipe
230
- * whose install or build step names a runner secret and that doesn't set `trustDevSnapshots` (`not-trusted`).
231
- */
232
- export type NeverSaveReason = "no-save-flag" | "recipe" | "keep-sandbox" | "ci" | "not-trusted";
233
- /**
234
- * Why a run whose command ended on its own started no save: it saves never (`NeverSaveReason`), the command didn't
235
- * exit 0 (`command-failed`), or the run started from a dev snapshot built at HEAD's commit (`already-saved`).
236
- */
237
- export type RunnerNoSaveReason = NeverSaveReason | "command-failed" | "already-saved";
238
- /**
239
- * How saving the runner sandbox as a dev snapshot ended.
240
- *
241
- * - `saved`: it is runner snapshot `snapshotId` of `base`, at HEAD commit `head` on `branch`, null when HEAD was
242
- * detached, saved in `ms` from the save's start; `entryWritten` says whether the cache recorded it.
243
- * - `failed`: the scrub or the save failed with `message`.
244
- * - `stopped`: a signal stopped it before it saved, or before the cache recorded the snapshot.
245
- *
246
- * A run whose save started never keeps its runner sandbox, however the save ended; a run whose save never started
247
- * has none of these, and keeps its runner sandbox for the keep time (`RunnerSandboxPlan`).
248
- */
249
- export type RunnerSave = {
250
- readonly kind: "saved";
251
- readonly snapshotId: string;
252
- readonly base: string;
253
- readonly branch: string | null;
254
- readonly head: string;
255
- readonly ms: number;
256
- readonly sizeBytes: number;
257
- readonly entryWritten: boolean;
258
- } | {
259
- readonly kind: "failed";
260
- readonly step: "scrub" | "save-snapshot";
261
- readonly message: string;
262
- } | {
263
- readonly kind: "stopped";
264
- };
265
181
  /** How one stage of readying the runner ended: its value, a failure, or a stop because the run was aborted. */
266
182
  export type RunnerStage<T> = {
267
183
  readonly kind: "ok";
@@ -134,9 +134,7 @@ export interface CheckoutGateway {
134
134
  }
135
135
  /**
136
136
  * One runner snapshot the cache records: who it belongs to, what it was built from, and when it expires. Times
137
- * are ISO strings. An entry with `head` and `repoRoot` records a dev snapshot, saved from a run's runner sandbox; one
138
- * without them records a base snapshot, built from its base. An entry has both or neither, and `branch` only with
139
- * them.
137
+ * are ISO strings. Every entry records a base snapshot, built at its base, which may be any commit.
140
138
  */
141
139
  export interface RunnerSnapshotEntry {
142
140
  readonly teamId: string;
@@ -146,23 +144,8 @@ export interface RunnerSnapshotEntry {
146
144
  readonly recipeName: string;
147
145
  /** The snapshot key at `base` (`snapshotKey`). */
148
146
  readonly snapshotKey: string;
149
- /** The base commit's full SHA, whose tracked files the snapshot's repository commits first, in either kind. */
147
+ /** The base commit's full SHA: the commit the snapshot was built at, whose tracked files its repository commits. */
150
148
  readonly base: string;
151
- /**
152
- * For a dev snapshot, the local branch of the run that saved it, for display; absent when that run's HEAD was
153
- * detached. No lookup reads it.
154
- */
155
- readonly branch?: string;
156
- /**
157
- * For a dev snapshot, the full SHA of the HEAD commit of the run that saved it, the commit it was built at. A run
158
- * starts from it only while that commit is HEAD or in HEAD's history.
159
- */
160
- readonly head?: string;
161
- /**
162
- * For a dev snapshot, the root of the checkout the run that saved it ran from. Only a run from that checkout
163
- * starts from it, so another checkout never inherits what this run left.
164
- */
165
- readonly repoRoot?: string;
166
149
  readonly snapshotId: string;
167
150
  readonly createdAt: string;
168
151
  readonly expiresAt: string;
@@ -199,8 +182,7 @@ export type RunnerSnapshotCacheOperation = {
199
182
  };
200
183
  /**
201
184
  * The per-machine runner snapshot cache: one record per runner snapshot, keyed by the entry's identity (team,
202
- * project, region, runtime, recipe name, snapshot key, and a base snapshot's base or a dev snapshot's checkout root
203
- * and commit).
185
+ * project, region, runtime, recipe name, snapshot key and base).
204
186
  * Every method returns its expected failures and never rejects. Which entries a run may use, and when one has
205
187
  * expired, is the caller's.
206
188
  */
@@ -291,7 +273,7 @@ export interface StagedFile {
291
273
  readonly name: string;
292
274
  readonly content: Uint8Array;
293
275
  }
294
- /** A runner snapshot a build sandbox or a runner sandbox was saved as. */
276
+ /** A runner snapshot a build sandbox was saved as. */
295
277
  export interface SavedSnapshot {
296
278
  readonly snapshotId: string;
297
279
  /** When the Sandbox API says it expires, as an ISO string, when it says. */
@@ -350,7 +332,7 @@ export interface RunnerSandboxGateway {
350
332
  readonly path: string;
351
333
  readonly fromLine: number;
352
334
  }, onOutput: (chunk: SandboxOutputChunk) => void, signal?: AbortSignal): Promise<RunnerSandboxOperation>;
353
- /** Saves a build or runner sandbox as a runner snapshot that expires after `expirationMs`; that stops the sandbox. */
335
+ /** Saves a build sandbox as a runner snapshot that expires after `expirationMs`; that stops the sandbox. */
354
336
  saveSnapshot(sandbox: RunnerSandbox, request: {
355
337
  readonly expirationMs: number;
356
338
  }): Promise<RunnerSandboxResult<SavedSnapshot>>;
@@ -1,6 +1,6 @@
1
1
  export type { RunnerContext } from "./context.ts";
2
- export { buildSnapshots, prepareSnapshotBuild, type PrepareSnapshotBuildOutcome, type SnapshotBuildMode, type SnapshotBuildOutcome, type SnapshotBuildWarning, } from "./build-snapshots.ts";
3
- export { type KeptSandbox, type NeverSaveReason, type RunnerEvent, type RunnerFailure, type RunnerNoSaveReason, type RunnerProgress, type RunnerSave, type RunnerStepPhase, type SnapshotBuildReason, type StartedFromSnapshot, } from "./events.ts";
2
+ export { buildSnapshots, prepareSnapshotBuild, type PrepareSnapshotBuildOutcome, type SnapshotBuildOutcome, } from "./build-snapshots.ts";
3
+ export { type KeptSandbox, type RunnerEvent, type RunnerFailure, type RunnerProgress, type RunnerStepPhase, type SnapshotBuildReason, } from "./events.ts";
4
4
  export type { CheckoutFailure, CheckoutGateway, RunnerSandboxGateway, RunnerSnapshotCacheFailure, RunnerSnapshotCacheGateway, RunnerSnapshotEntry, RunnerTerminal, } from "./gateways.ts";
5
5
  export { liveCheckoutGateway } from "./live/checkout-gateway.ts";
6
6
  export { liveRunnerSandboxGateway } from "./live/sandbox-gateway.ts";
@@ -10,10 +10,9 @@ export { liveRunnerSnapshotCacheGateway, unavailableRunnerSnapshotCacheGateway,
10
10
  export { lineSplitter } from "./output.ts";
11
11
  export { prepareRunner, type PrepareRunnerOutcome } from "./prepare.ts";
12
12
  export type { ReadyRunnerOutcome } from "./ready.ts";
13
- export { type CheckedRecipe, checkRecipe, type DevSnapshotReuse, devSnapshotsTrusted, runStepTakesSecret, } from "./recipe.ts";
13
+ export { type CheckedRecipe, checkRecipe } from "./recipe.ts";
14
14
  export { SANDBOX_TEST_EVENTS_PATH } from "./sandboxed-command.ts";
15
15
  export { declaredSecretValues, readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH, type RunnerSecrets } from "./secrets.ts";
16
- export type { RunnerSandboxPlan } from "./scope.ts";
17
- export { type RunnerCleanupFacts, openRunnerSession, type RunnerSaveMode, type RunnerSession, type RunnerSessionRequest, } from "./session.ts";
16
+ export { type RunnerCleanupFacts, openRunnerSession, type RunnerSession, type RunnerSessionCleanup, type RunnerSessionRequest, } from "./session.ts";
18
17
  export { type InspectedSnapshot, inspectSnapshotCache, type SnapshotCacheInspection, type UnpickedReason, } from "./snapshot-inspect.ts";
19
- export { type DevSnapshotDrop, type RejectedSnapshot, RUNNER_SNAPSHOTS_SUBPATH, type SnapshotCacheNote, type SnapshotRejectionReason, } from "./snapshot-cache.ts";
18
+ export { type RejectedSnapshot, RUNNER_SNAPSHOTS_SUBPATH, type SnapshotCacheNote, type SnapshotRejectionReason, } from "./snapshot-cache.ts";
@@ -10,7 +10,7 @@ export { localUserName } from "./live/user.js";
10
10
  export { liveRunnerSnapshotCacheGateway, unavailableRunnerSnapshotCacheGateway, } from "./live/snapshot-cache-gateway.js";
11
11
  export { lineSplitter } from "./output.js";
12
12
  export { prepareRunner } from "./prepare.js";
13
- export { checkRecipe, devSnapshotsTrusted, runStepTakesSecret, } from "./recipe.js";
13
+ export { checkRecipe } from "./recipe.js";
14
14
  export { SANDBOX_TEST_EVENTS_PATH } from "./sandboxed-command.js";
15
15
  export { declaredSecretValues, readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH } from "./secrets.js";
16
16
  export { openRunnerSession, } from "./session.js";
@@ -1,15 +1,12 @@
1
1
  // The runner snapshot cache's file format: one JSON object per runner snapshot, carrying `version: 1`. A reader
2
- // rejects a version it doesn't know. A dev snapshot's record adds `head` and `repoRoot`, both or neither, and, when
3
- // the run that saved it was on a branch, `branch`, which only a record with those two has. A file is named for its
4
- // entry's identity (`snapshotEntryIdentity`), and the gateway lists a file whose name isn't as unreadable. So a storm
5
- // that names a dev snapshot's file by another identity, an older one that keyed it by branch and base, or one that
6
- // predates dev snapshots and drops the fields as it reads, never starts from it, and this storm never starts from an
7
- // older storm's dev snapshot file: there is no migration, and each file stays until its snapshot expires.
2
+ // rejects a version it doesn't know, and drops keys it doesn't know. A file is named for its entry's identity
3
+ // (`snapshotEntryIdentity`), and the gateway lists a file whose name isn't as unreadable. So a file an older storm
4
+ // wrote for a dev snapshot, named for an identity that held its checkout's root and commit, is listed as unreadable,
5
+ // and no run starts from it: there is no migration.
8
6
  import { z } from "zod";
9
7
  const isoTime = z.string().refine((value) => !Number.isNaN(Date.parse(value)), { message: "not a time" });
10
8
  const nonEmpty = z.string().min(1);
11
- const entrySchema = z
12
- .object({
9
+ const entrySchema = z.object({
13
10
  version: z.literal(1),
14
11
  teamId: nonEmpty,
15
12
  projectId: nonEmpty,
@@ -18,15 +15,10 @@ const entrySchema = z
18
15
  recipeName: nonEmpty,
19
16
  snapshotKey: nonEmpty,
20
17
  base: nonEmpty,
21
- branch: nonEmpty.exactOptional(),
22
- head: nonEmpty.exactOptional(),
23
- repoRoot: nonEmpty.exactOptional(),
24
18
  snapshotId: nonEmpty,
25
19
  createdAt: isoTime,
26
20
  expiresAt: isoTime,
27
- })
28
- .refine((entry) => (entry.head === undefined) === (entry.repoRoot === undefined) &&
29
- (entry.branch === undefined || entry.head !== undefined), { message: "has some of branch, head and repoRoot without head and repoRoot together" });
21
+ });
30
22
  /** The entry a cache file holds, or why it holds none. */
31
23
  export function parseSnapshotEntry(text) {
32
24
  let json;
@@ -50,7 +42,7 @@ export function parseSnapshotEntry(text) {
50
42
  }
51
43
  /** The text of the file that records `entry`. */
52
44
  export function snapshotEntryText(entry) {
53
- const { teamId, projectId, region, runtime, recipeName, snapshotKey, base, branch, head, repoRoot } = entry;
45
+ const { teamId, projectId, region, runtime, recipeName, snapshotKey, base } = entry;
54
46
  const { snapshotId, createdAt, expiresAt } = entry;
55
47
  const record = {
56
48
  version: 1,
@@ -61,9 +53,6 @@ export function snapshotEntryText(entry) {
61
53
  recipeName,
62
54
  snapshotKey,
63
55
  base,
64
- ...(branch === undefined ? {} : { branch }),
65
- ...(head === undefined ? {} : { head }),
66
- ...(repoRoot === undefined ? {} : { repoRoot }),
67
56
  snapshotId,
68
57
  createdAt,
69
58
  expiresAt,
@@ -1,6 +1,6 @@
1
1
  import { type RefusedBaseRef } from "./base.ts";
2
- import type { CheckoutFailure, CheckoutHead, CheckoutUpload } from "./gateways.ts";
3
- import { type CheckedRecipe, type ResolvedRunnerStep, type DevSnapshotReuse, type VcpusRun } from "./recipe.ts";
2
+ import type { CheckoutFailure, CheckoutUpload } from "./gateways.ts";
3
+ import { type CheckedRecipe, type ResolvedRunnerStep, type VcpusRun } from "./recipe.ts";
4
4
  import { type RejectedSnapshot, type RunnerSnapshotCandidate, type SnapshotCacheContext, type SnapshotCacheNote } from "./snapshot-cache.ts";
5
5
  /** What `prepareRunner` needs: the checkout, the runner snapshot cache and the clock. */
6
6
  export type RunnerPrepareContext = SnapshotCacheContext;
@@ -11,21 +11,12 @@ export interface PrepareRunnerRequest<Run> {
11
11
  readonly recipe: CheckedRecipe<Run>;
12
12
  /** The run, for the recipe's `vcpus`, with the keys of its resources. */
13
13
  readonly vcpusRun: VcpusRun<Run>;
14
- /**
15
- * Whether the run may start from a dev snapshot: false under `--no-reuse-dev-snapshot` or the recipe's
16
- * `reuseDevSnapshot: false`, which start it from a base snapshot. Whatever this says, a recipe whose install or
17
- * build step names a runner secret starts only from a base snapshot unless its `trustDevSnapshots` is true
18
- * (`devSnapshotReuse`).
19
- */
20
- readonly reuseDevSnapshots: boolean;
21
14
  }
22
15
  /** The runner, checked on this machine, ready for the runner sandbox. */
23
16
  export interface PreparedRunner {
24
17
  readonly recipe: CheckedRecipe;
25
18
  readonly repoRoot: string;
26
- /** Where HEAD is: its commit, which a run's dev snapshot is for, and its branch, null when detached. */
27
- readonly head: CheckoutHead;
28
- /** The run's base, a full SHA, and the ref it is HEAD's merge-base with. */
19
+ /** The run's base, HEAD's merge-base with a base ref, as a full SHA, and that ref. */
29
20
  readonly base: string;
30
21
  readonly baseRef: string;
31
22
  /** The recipe's snapshot steps at the base, each with the runner secret names it gets, and their snapshot key. */
@@ -34,10 +25,11 @@ export interface PreparedRunner {
34
25
  readonly snapshotKey: string;
35
26
  /** The runner sandbox's vCPUs for the run. */
36
27
  readonly vcpus: number;
28
+ /** What the run uploads on top of the base. */
37
29
  readonly upload: CheckoutUpload;
38
30
  /**
39
- * The cached runner snapshots the run may start from, base snapshots at the base with the run's snapshot key and
40
- * this checkout's dev snapshots on them in HEAD's history, before the team and project filter (`pickSnapshot`).
31
+ * The cached runner snapshots the run may start from, each at the run's base with its snapshot key, before the team
32
+ * and project filter (`pickSnapshot`).
41
33
  */
42
34
  readonly candidates: readonly RunnerSnapshotCandidate[];
43
35
  /** The recipe's other cached snapshots, each with why the run doesn't start from it, before that filter. */
@@ -46,8 +38,6 @@ export interface PreparedRunner {
46
38
  readonly commitsAfterBase: number;
47
39
  /** What removing expired entries noticed (`removeExpiredEntries`), for the run to report. */
48
40
  readonly notes: readonly SnapshotCacheNote[];
49
- /** Whether the run uses dev snapshots, which the cache read went by (`devSnapshotReuse`). */
50
- readonly devSnapshots: DevSnapshotReuse;
51
41
  }
52
42
  /**
53
43
  * How the local checks ended.
@@ -58,8 +48,7 @@ export interface PreparedRunner {
58
48
  * - `invalid-recipe`: a step function or `vcpus` failed or returned something storm can't use, such as a step naming
59
49
  * a runner secret the recipe's `secrets` doesn't declare, at the run's base or for the run; `path` is the key inside
60
50
  * the recipe.
61
- * - `checkout-failed`: git or tar failed, such as outside a Git checkout, or git failed while the cache read checked a
62
- * dev snapshot's commit.
51
+ * - `checkout-failed`: git or tar failed, such as outside a Git checkout.
63
52
  */
64
53
  export type PrepareRunnerOutcome = {
65
54
  readonly kind: "ok";
@@ -79,10 +68,10 @@ export type PrepareRunnerOutcome = {
79
68
  readonly failure: CheckoutFailure;
80
69
  };
81
70
  /**
82
- * Runs the local checks in order: the repository's root, HEAD, the base, the submodule refusal, the snapshot steps at
71
+ * Runs the local checks in order: the repository's root, the base, the submodule refusal, the snapshot steps at
83
72
  * the base and their key, the runner's vCPUs, the upload, HEAD's count of commits after the base, and the cache read,
84
- * which removes expired entries' files (`removeExpiredEntries`) and classifies the rest (`classifySnapshotEntries`),
85
- * refusing when git fails there. It never mints, acquires or creates, and decides nothing about saving a dev
86
- * snapshot: the runner session owns the save mode. A run that reuses no dev snapshot, and an untrusted recipe whose install or build step names a runner secret, get no dev snapshot candidates.
73
+ * which removes expired entries' files (`removeExpiredEntries`) and classifies the rest (`classifySnapshotEntries`)
74
+ * against the merge-base and its snapshot key. So every git call and step function call happens here, before anything
75
+ * is minted. It never mints, acquires or creates.
87
76
  */
88
77
  export declare function prepareRunner<Run>(context: RunnerPrepareContext, request: PrepareRunnerRequest<Run>): Promise<PrepareRunnerOutcome>;
@@ -2,15 +2,15 @@
2
2
  // anything, so a missing base, a checkout with submodules or a recipe storm can't use fails with nothing to
3
3
  // clean up.
4
4
  import { resolveBase } from "./base.js";
5
- import { devSnapshotReuse, resolveVcpus, } from "./recipe.js";
5
+ import { resolveVcpus } from "./recipe.js";
6
6
  import { classifySnapshotEntries, removeExpiredEntries, } from "./snapshot-cache.js";
7
7
  import { snapshotStepsAt } from "./snapshot-key.js";
8
8
  /**
9
- * Runs the local checks in order: the repository's root, HEAD, the base, the submodule refusal, the snapshot steps at
9
+ * Runs the local checks in order: the repository's root, the base, the submodule refusal, the snapshot steps at
10
10
  * the base and their key, the runner's vCPUs, the upload, HEAD's count of commits after the base, and the cache read,
11
- * which removes expired entries' files (`removeExpiredEntries`) and classifies the rest (`classifySnapshotEntries`),
12
- * refusing when git fails there. It never mints, acquires or creates, and decides nothing about saving a dev
13
- * snapshot: the runner session owns the save mode. A run that reuses no dev snapshot, and an untrusted recipe whose install or build step names a runner secret, get no dev snapshot candidates.
11
+ * which removes expired entries' files (`removeExpiredEntries`) and classifies the rest (`classifySnapshotEntries`)
12
+ * against the merge-base and its snapshot key. So every git call and step function call happens here, before anything
13
+ * is minted. It never mints, acquires or creates.
14
14
  */
15
15
  export async function prepareRunner(context, request) {
16
16
  const { checkout } = context;
@@ -19,9 +19,6 @@ export async function prepareRunner(context, request) {
19
19
  if (!root.ok)
20
20
  return { kind: "checkout-failed", failure: root.failure };
21
21
  const repoRoot = root.value;
22
- const head = await checkout.head({ repoRoot });
23
- if (!head.ok)
24
- return { kind: "checkout-failed", failure: head.failure };
25
22
  const resolved = await resolveBase(checkout, { repoRoot, baseRefs: recipe.baseRefs });
26
23
  if (resolved.kind === "failed")
27
24
  return { kind: "checkout-failed", failure: resolved.failure };
@@ -45,26 +42,19 @@ export async function prepareRunner(context, request) {
45
42
  const afterBase = await checkout.commitCount({ repoRoot, from: base, to: "HEAD" });
46
43
  if (!afterBase.ok)
47
44
  return { kind: "checkout-failed", failure: afterBase.failure };
48
- const devSnapshots = devSnapshotReuse(recipe, request.reuseDevSnapshots);
49
45
  const listing = await removeExpiredEntries(context);
50
- const classified = await classifySnapshotEntries(context, {
46
+ const cache = classifySnapshotEntries(context, {
51
47
  entries: listing.entries,
52
- repoRoot,
53
48
  recipe,
54
49
  base,
55
50
  snapshotKey: steps.key,
56
51
  commitsAfterBase: afterBase.value,
57
- devSnapshots,
58
52
  });
59
- if (!classified.ok)
60
- return { kind: "checkout-failed", failure: classified.failure };
61
- const cache = classified.value;
62
53
  return {
63
54
  kind: "ok",
64
55
  prepared: {
65
56
  recipe,
66
57
  repoRoot,
67
- head: head.value,
68
58
  base,
69
59
  baseRef: resolved.ref,
70
60
  toolchains: steps.toolchains,
@@ -76,7 +66,6 @@ export async function prepareRunner(context, request) {
76
66
  rejected: cache.rejected,
77
67
  commitsAfterBase: afterBase.value,
78
68
  notes: listing.notes,
79
- devSnapshots,
80
69
  },
81
70
  };
82
71
  }
@@ -1,25 +1,21 @@
1
1
  import { type RunnerContext } from "./context.ts";
2
- import type { RunnerFailure, RunnerProgress, RunnerStage, StartedFromSnapshot } from "./events.ts";
2
+ import type { RunnerFailure, RunnerProgress } from "./events.ts";
3
3
  import type { CheckoutUpload, RunnerSandbox, RunnerSnapshotCacheFailure, RunnerSnapshotEntry, SandboxAccess, StagedFile } from "./gateways.ts";
4
4
  import type { PreparedRunner } from "./prepare.ts";
5
5
  import type { RunnerSandboxScope } from "./scope.ts";
6
6
  import { type RunnerSecrets } from "./secrets.ts";
7
- import { type BuiltSnapshot } from "./snapshot-build.ts";
8
- import type { SnapshotStart } from "./snapshot-start.ts";
9
7
  /** The label of the step that applies and commits the run's changes in the runner sandbox. */
10
8
  export declare const APPLY_LABEL = "Applying your changes";
11
9
  /** A runner sandbox ready for the command. */
12
10
  export interface ReadyRunner {
13
11
  readonly sandbox: RunnerSandbox;
14
- /**
15
- * The cache entry of the runner snapshot it started from: a base snapshot or a dev snapshot, whose base its
16
- * repository holds as its first commit.
17
- */
18
- readonly startedFrom: RunnerSnapshotEntry;
12
+ /** The base snapshot it started from, and its base, which its repository holds as its first commit. */
13
+ readonly snapshotId: string;
14
+ readonly base: string;
19
15
  /** Whether this run built the runner snapshot. */
20
16
  readonly built: boolean;
21
- /** That snapshot in commits: its kind, its built-at commit and how far it is behind the run. */
22
- readonly snapshot: StartedFromSnapshot;
17
+ /** How many commits HEAD has that the snapshot's base lacks. */
18
+ readonly builtBehind: number;
23
19
  /** How many bytes of changes the run uploaded on top of the snapshot's base. */
24
20
  readonly uploadBytes: number;
25
21
  /** How long the build step took, in milliseconds. */
@@ -60,48 +56,23 @@ export type ReadyRunnerOutcome = {
60
56
  } | {
61
57
  readonly kind: "aborted";
62
58
  };
63
- /**
64
- * The runner snapshot a runner sandbox starts from, once obtained: its cache entry, where it was built in commits
65
- * (`snapshot`), and the base snapshot build that made it, null for a cached one it reuses.
66
- */
67
- export interface ObtainedSnapshot {
68
- readonly entry: RunnerSnapshotEntry;
69
- readonly snapshot: StartedFromSnapshot;
70
- readonly built: BuiltSnapshot | null;
71
- }
72
- /** What obtaining the start needs: the prepared run, where and as whom it builds, the secrets, and what it chose. */
73
- export interface ObtainSnapshotRequest {
74
- readonly prepared: PreparedRunner;
75
- readonly access: SandboxAccess;
76
- /** The local user, for the build sandbox's `user` tag. */
77
- readonly user: string;
78
- /** Every runner secret's value, of which each toolchain and prebuild step of a build gets the ones it names. */
79
- readonly secrets: RunnerSecrets;
80
- /** What `chooseSnapshotStart` chose. */
81
- readonly start: SnapshotStart;
82
- }
83
- /**
84
- * Carries out what `chooseSnapshotStart` chose. To reuse a cached candidate it reports `snapshot-reused`, with where
85
- * that snapshot was built; to build, it builds a base snapshot at the run's base, saying why (`buildSnapshot`).
86
- */
87
- export declare function obtainSnapshot(context: RunnerContext, request: ObtainSnapshotRequest, control: {
88
- readonly scope: RunnerSandboxScope;
89
- readonly signal: AbortSignal;
90
- }, progress: RunnerProgress): Promise<RunnerStage<ObtainedSnapshot>>;
91
59
  export interface ReadyRunnerRequest {
92
60
  readonly prepared: PreparedRunner;
93
61
  readonly access: SandboxAccess;
94
- /** The local user, for the runner sandbox's `user` tag. */
62
+ /** The local user, for the build sandbox's and the runner sandbox's `user` tag. */
95
63
  readonly user: string;
96
- /** Every runner secret's value, of which the install and build steps each get the ones they name. */
64
+ /**
65
+ * Every runner secret's value, of which each toolchain and prebuild step of a build, and the install and build
66
+ * steps, get the ones they name.
67
+ */
97
68
  readonly secrets: RunnerSecrets;
98
- /** The runner snapshot it starts from, which `obtainSnapshot` obtained. */
99
- readonly start: ObtainedSnapshot;
100
69
  }
101
70
  /**
102
- * Readies the runner sandbox for a prepared run, from the runner snapshot `start` names: it starts the runner sandbox
103
- * from it, uploads what the checkout changes on top of the snapshot's base, applies it, and runs the install and the
104
- * build. It chooses nothing: `chooseSnapshotStart` chose the snapshot, and `obtainSnapshot` obtained it.
71
+ * Readies the runner sandbox for a prepared run. It picks, of the prepared candidates, the one for the access's team
72
+ * and project (`pickSnapshot`) and reports `snapshot-reused`; with no pick, it builds a base
73
+ * snapshot at the run's base, saying why each cached snapshot of the recipe doesn't fit (`no-snapshot`,
74
+ * `snapshotRejections`; `buildSnapshot`). Then it starts the runner sandbox from that snapshot, uploads what the
75
+ * checkout changes on top of the run's base, applies it, and runs the install and the build.
105
76
  */
106
77
  export declare function readyRunner(context: RunnerContext, request: ReadyRunnerRequest, control: {
107
78
  readonly scope: RunnerSandboxScope;