@cnc-tools/storm 0.11.0 → 0.13.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 (442) hide show
  1. package/dist/bin/storm.js +7 -12
  2. package/dist/build-info.js +1 -1
  3. package/dist/chunks/chunk-2NZXL6OH.js +62 -0
  4. package/dist/chunks/{chunk-3ZZVZPMG.js → chunk-43MWZLJR.js} +1 -1
  5. package/dist/chunks/{chunk-NPPJ57W7.js → chunk-5UMJNVKT.js} +498 -215
  6. package/dist/chunks/{chunk-KR7WIYLG.js → chunk-6EQKA7LI.js} +200 -985
  7. package/dist/chunks/{chunk-4EU4AH7E.js → chunk-AX4EQZUS.js} +186 -144
  8. package/dist/chunks/{chunk-ETCZ6WP7.js → chunk-BW2ADH7U.js} +1 -1
  9. package/dist/chunks/chunk-DOFB2ACU.js +49 -0
  10. package/dist/chunks/chunk-EGNP3S6C.js +161 -0
  11. package/dist/chunks/chunk-GQIL3AHY.js +20 -0
  12. package/dist/chunks/{chunk-ICB4BZJX.js → chunk-GSC6SRTW.js} +7 -2
  13. package/dist/chunks/{chunk-OJOKQRM6.js → chunk-IYM44FUX.js} +30 -26
  14. package/dist/chunks/{chunk-GRMD7G4J.js → chunk-LQKNI3EG.js} +6 -5
  15. package/dist/chunks/chunk-N7E6DAUE.js +40 -0
  16. package/dist/chunks/chunk-NMVODY3P.js +19 -0
  17. package/dist/chunks/{chunk-TRFEAYNC.js → chunk-Q4TKRILH.js} +261 -354
  18. package/dist/chunks/{chunk-VZZTHCBW.js → chunk-RTILVSYQ.js} +5 -18
  19. package/dist/chunks/{chunk-L4ZPMSKQ.js → chunk-T6AZIDZD.js} +43 -363
  20. package/dist/chunks/chunk-X4WBJIOF.js +308 -0
  21. package/dist/chunks/chunk-YGS5VRQT.js +794 -0
  22. package/dist/chunks/{chunk-4PRAB24Y.js → chunk-YM6TZV4L.js} +394 -396
  23. package/dist/chunks/{chunk-AMTYHUYB.js → chunk-YT5OROR7.js} +22 -8
  24. package/dist/chunks/{chunk-O4BUT7BE.js → chunk-ZDJLKF2G.js} +1625 -1583
  25. package/dist/chunks/{live-app-LOGYUBKB.js → live-app-QFHS54SX.js} +25 -46
  26. package/dist/command-tree.d.ts +4 -1
  27. package/dist/command-tree.js +4 -1
  28. package/dist/commands/exec/cleanup.js +4 -4
  29. package/dist/commands/exec/command.d.ts +6 -55
  30. package/dist/commands/exec/command.js +51 -46
  31. package/dist/commands/exec/define-run-command.d.ts +664 -0
  32. package/dist/commands/exec/define-run-command.js +58 -0
  33. package/dist/commands/exec/driver-plan.d.ts +30 -0
  34. package/dist/commands/exec/driver-plan.js +44 -0
  35. package/dist/commands/exec/driver-refusals.d.ts +89 -0
  36. package/dist/commands/exec/driver-refusals.js +65 -0
  37. package/dist/commands/exec/exec-words.d.ts +5 -0
  38. package/dist/commands/exec/exec-words.js +31 -0
  39. package/dist/commands/exec/live-view.js +68 -42
  40. package/dist/commands/exec/mint-failed.js +4 -4
  41. package/dist/commands/exec/outcomes.d.ts +6 -48
  42. package/dist/commands/exec/outcomes.js +10 -12
  43. package/dist/commands/exec/plan-run.js +3 -3
  44. package/dist/commands/exec/progress.d.ts +21 -17
  45. package/dist/commands/exec/progress.js +59 -78
  46. package/dist/commands/exec/resource-flags.d.ts +10 -3
  47. package/dist/commands/exec/resource-flags.js +25 -14
  48. package/dist/commands/exec/resource-refusals.d.ts +1 -1
  49. package/dist/commands/exec/resource-refusals.js +9 -9
  50. package/dist/commands/exec/run-bin.d.ts +35 -0
  51. package/dist/commands/exec/run-bin.js +32 -0
  52. package/dist/commands/exec/run-command.d.ts +64 -23
  53. package/dist/commands/exec/run-command.js +35 -94
  54. package/dist/commands/exec/run-metadata.d.ts +25 -19
  55. package/dist/commands/exec/run-metadata.js +34 -18
  56. package/dist/commands/exec/snapshot-text.d.ts +31 -0
  57. package/dist/commands/exec/snapshot-text.js +72 -0
  58. package/dist/commands/exec/test-plan.d.ts +2 -2
  59. package/dist/commands/exec/test-plan.js +11 -8
  60. package/dist/commands/exec/tests-summary.d.ts +21 -12
  61. package/dist/commands/exec/tests-summary.js +67 -39
  62. package/dist/commands/exec/text.d.ts +5 -0
  63. package/dist/commands/exec/text.js +7 -0
  64. package/dist/commands/exec/view.js +12 -13
  65. package/dist/commands/exec/waterfall.js +4 -4
  66. package/dist/commands/exec/worker-chart.d.ts +19 -11
  67. package/dist/commands/exec/worker-chart.js +66 -36
  68. package/dist/commands/playwright/command.d.ts +658 -0
  69. package/dist/commands/playwright/command.js +31 -0
  70. package/dist/commands/playwright/metadata.js +8 -0
  71. package/dist/commands/runs/facts.d.ts +5 -28
  72. package/dist/commands/runs/facts.js +11 -33
  73. package/dist/commands/runs/list/command.d.ts +4 -50
  74. package/dist/commands/runs/list/command.js +15 -11
  75. package/dist/commands/runs/list/outcomes.d.ts +2 -25
  76. package/dist/commands/runs/logs/command.js +13 -9
  77. package/dist/commands/runs/logs/outcomes.js +1 -1
  78. package/dist/commands/runs/show/command.d.ts +6 -50
  79. package/dist/commands/runs/show/command.js +37 -47
  80. package/dist/commands/runs/show/metadata.js +1 -1
  81. package/dist/commands/runs/show/outcomes.d.ts +3 -25
  82. package/dist/commands/runs/show/outcomes.js +18 -31
  83. package/dist/commands/snapshots/build/command.d.ts +501 -0
  84. package/dist/commands/snapshots/build/command.js +336 -0
  85. package/dist/commands/snapshots/build/metadata.d.ts +28 -0
  86. package/dist/commands/snapshots/build/metadata.js +37 -0
  87. package/dist/commands/snapshots/build/outcomes.d.ts +254 -0
  88. package/dist/commands/snapshots/build/outcomes.js +155 -0
  89. package/dist/commands/snapshots/list/command.d.ts +238 -0
  90. package/dist/commands/snapshots/list/command.js +269 -0
  91. package/dist/commands/snapshots/list/metadata.d.ts +16 -0
  92. package/dist/commands/snapshots/list/metadata.js +24 -0
  93. package/dist/commands/snapshots/list/outcomes.d.ts +148 -0
  94. package/dist/commands/snapshots/list/outcomes.js +217 -0
  95. package/dist/commands/snapshots/metadata.d.ts +3 -0
  96. package/dist/commands/snapshots/metadata.js +7 -0
  97. package/dist/commands/vitest/command.d.ts +185 -304
  98. package/dist/commands/vitest/command.js +23 -181
  99. package/dist/commands/vitest/metadata.js +1 -1
  100. package/dist/config-file/define.d.ts +1 -1
  101. package/dist/context.d.ts +32 -30
  102. package/dist/context.js +13 -17
  103. package/dist/core/before-run.d.ts +5 -5
  104. package/dist/core/before-run.js +8 -8
  105. package/dist/core/definition-lookup.d.ts +5 -5
  106. package/dist/core/definition-lookup.js +13 -12
  107. package/dist/core/drivers-of.d.ts +23 -0
  108. package/dist/core/drivers-of.js +13 -0
  109. package/dist/core/events.d.ts +6 -9
  110. package/dist/core/gateways.d.ts +32 -24
  111. package/dist/core/index.d.ts +7 -5
  112. package/dist/core/index.js +9 -6
  113. package/dist/core/launcher-context.d.ts +11 -0
  114. package/dist/core/launcher-context.js +31 -0
  115. package/dist/core/live/package-bin-gateway.d.ts +6 -0
  116. package/dist/core/live/package-bin-gateway.js +24 -0
  117. package/dist/core/package-bin.d.ts +7 -0
  118. package/dist/core/package-bin.js +30 -0
  119. package/dist/core/presentations.d.ts +1 -1
  120. package/dist/core/presentations.js +6 -5
  121. package/dist/core/{resource-registry.d.ts → resource-definition-set.d.ts} +15 -14
  122. package/dist/core/resource-definition-set.js +31 -0
  123. package/dist/core/resource-reports.d.ts +1 -1
  124. package/dist/core/resource-reports.js +16 -15
  125. package/dist/core/resource.d.ts +4 -4
  126. package/dist/core/resources.d.ts +6 -6
  127. package/dist/core/resources.js +11 -11
  128. package/dist/core/run-state.d.ts +20 -31
  129. package/dist/core/run-state.js +34 -25
  130. package/dist/core/run.d.ts +30 -32
  131. package/dist/core/run.js +33 -39
  132. package/dist/core/setup-phases.d.ts +14 -0
  133. package/dist/core/setup-phases.js +24 -0
  134. package/dist/core/state-directory.d.ts +2 -2
  135. package/dist/core/state-directory.js +3 -3
  136. package/dist/core/timeline.d.ts +4 -2
  137. package/dist/core/timeline.js +11 -5
  138. package/dist/extension-commands.js +6 -10
  139. package/dist/extensions/github/{world.d.ts → context.d.ts} +1 -1
  140. package/dist/extensions/github/context.js +3 -0
  141. package/dist/extensions/github/definition.d.ts +1 -1
  142. package/dist/extensions/github/definition.js +3 -3
  143. package/dist/extensions/github/extension.d.ts +1 -1
  144. package/dist/extensions/github/index.d.ts +2 -2
  145. package/dist/extensions/github/index.js +4 -4
  146. package/dist/extensions/github/lifecycle.d.ts +3 -3
  147. package/dist/extensions/github/lifecycle.js +14 -14
  148. package/dist/extensions/github/live/context.d.ts +6 -0
  149. package/dist/extensions/github/live/context.js +16 -0
  150. package/dist/extensions/github/resource.d.ts +1 -1
  151. package/dist/extensions/playwright/driver.d.ts +8 -0
  152. package/dist/extensions/playwright/driver.js +60 -0
  153. package/dist/extensions/playwright/extension.d.ts +2 -0
  154. package/dist/extensions/playwright/extension.js +12 -0
  155. package/dist/extensions/playwright/plan/gateways.d.ts +62 -0
  156. package/dist/extensions/playwright/plan/gateways.js +4 -0
  157. package/dist/extensions/playwright/plan/list-output.d.ts +26 -0
  158. package/dist/extensions/playwright/plan/list-output.js +101 -0
  159. package/dist/extensions/playwright/plan/live/list-gateway.d.ts +15 -0
  160. package/dist/extensions/playwright/plan/live/list-gateway.js +100 -0
  161. package/dist/extensions/playwright/plan/plan.d.ts +44 -0
  162. package/dist/extensions/playwright/plan/plan.js +53 -0
  163. package/dist/extensions/testserver/command-tree.d.ts +1 -1
  164. package/dist/extensions/testserver/command-tree.js +2 -2
  165. package/dist/extensions/testserver/commands/app.d.ts +7 -7
  166. package/dist/extensions/testserver/commands/pool/create/command.d.ts +5 -5
  167. package/dist/extensions/testserver/commands/pool/create/command.js +12 -13
  168. package/dist/extensions/testserver/commands/pool/list/command.js +5 -6
  169. package/dist/extensions/testserver/{world.d.ts → context.d.ts} +1 -1
  170. package/dist/extensions/testserver/context.js +4 -0
  171. package/dist/extensions/testserver/definition.d.ts +2 -2
  172. package/dist/extensions/testserver/definition.js +8 -7
  173. package/dist/extensions/testserver/events.d.ts +1 -1
  174. package/dist/extensions/testserver/extension.d.ts +4 -3
  175. package/dist/extensions/testserver/extension.js +33 -20
  176. package/dist/extensions/testserver/index.d.ts +2 -2
  177. package/dist/extensions/testserver/index.js +2 -2
  178. package/dist/extensions/testserver/lifecycle.d.ts +6 -5
  179. package/dist/extensions/testserver/lifecycle.js +9 -8
  180. package/dist/extensions/testserver/live/context.d.ts +8 -0
  181. package/dist/extensions/testserver/live/{world.js → context.js} +6 -7
  182. package/dist/extensions/testserver/options/rules.d.ts +3 -3
  183. package/dist/extensions/testserver/options/rules.js +5 -4
  184. package/dist/extensions/testserver/options/sandboxes.d.ts +3 -2
  185. package/dist/extensions/testserver/options/sandboxes.js +3 -2
  186. package/dist/extensions/testserver/playwright/index.d.ts +33 -0
  187. package/dist/extensions/testserver/playwright/index.js +43 -0
  188. package/dist/extensions/testserver/presentation.d.ts +4 -4
  189. package/dist/extensions/testserver/presentation.js +7 -7
  190. package/dist/extensions/testserver/progress.d.ts +3 -3
  191. package/dist/extensions/testserver/progress.js +3 -3
  192. package/dist/extensions/testserver/provision.d.ts +2 -2
  193. package/dist/extensions/testserver/provision.js +10 -10
  194. package/dist/extensions/testserver/resource.d.ts +2 -2
  195. package/dist/extensions/testserver/result.d.ts +2 -2
  196. package/dist/extensions/testserver/result.js +1 -1
  197. package/dist/extensions/testserver/run/connection.d.ts +1 -1
  198. package/dist/extensions/testserver/run/connection.js +3 -3
  199. package/dist/extensions/testserver/run/sandbox.d.ts +31 -0
  200. package/dist/extensions/testserver/run/sandbox.js +58 -0
  201. package/dist/extensions/testserver/run-sandbox.d.ts +2 -2
  202. package/dist/extensions/testserver/run-sandbox.js +3 -3
  203. package/dist/extensions/testserver/vercel-cli/arguments.d.ts +2 -2
  204. package/dist/extensions/testserver/vercel-cli/arguments.js +6 -6
  205. package/dist/extensions/testserver/vercel-cli/auth-config.d.ts +7 -7
  206. package/dist/extensions/testserver/vercel-cli/auth-config.js +4 -4
  207. package/dist/extensions/testserver/vercel-cli/clock.js +1 -1
  208. package/dist/extensions/testserver/vercel-cli/config-files.js +1 -1
  209. package/dist/extensions/testserver/vercel-cli/context.d.ts +1 -1
  210. package/dist/extensions/testserver/vercel-cli/context.js +2 -2
  211. package/dist/extensions/testserver/vercel-cli/entry.d.ts +1 -1
  212. package/dist/extensions/testserver/vercel-cli/entry.js +1 -1
  213. package/dist/extensions/testserver/vercel-cli/environment.d.ts +5 -5
  214. package/dist/extensions/testserver/vercel-cli/environment.js +6 -6
  215. package/dist/extensions/testserver/vercel-cli/gateways.d.ts +1 -1
  216. package/dist/extensions/testserver/vercel-cli/gateways.js +3 -3
  217. package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -1
  218. package/dist/extensions/testserver/vercel-cli/index.js +8 -9
  219. package/dist/extensions/testserver/vercel-cli/invocation.d.ts +13 -12
  220. package/dist/extensions/testserver/vercel-cli/invocation.js +1 -1
  221. package/dist/extensions/testserver/vercel-cli/{driver.d.ts → invoker.d.ts} +18 -17
  222. package/dist/extensions/testserver/vercel-cli/{driver.js → invoker.js} +8 -8
  223. package/dist/extensions/testserver/vercel-cli/live/config-files.d.ts +2 -2
  224. package/dist/extensions/testserver/vercel-cli/live/config-files.js +2 -2
  225. package/dist/extensions/testserver/vercel-cli/live/process-gateway.js +1 -1
  226. package/dist/extensions/testserver/vercel-cli/report.js +2 -2
  227. package/dist/extensions/testserver/vercel-cli/verbose.js +1 -1
  228. package/dist/extensions/testserver/vitest/config.d.ts +3 -3
  229. package/dist/extensions/testserver/vitest/config.js +5 -13
  230. package/dist/extensions/testserver/vitest/container-scope.d.ts +11 -11
  231. package/dist/extensions/testserver/vitest/container-scope.js +9 -9
  232. package/dist/extensions/testserver/vitest/container-start.d.ts +6 -6
  233. package/dist/extensions/testserver/vitest/container-start.js +14 -11
  234. package/dist/extensions/testserver/vitest/diagnostics.d.ts +1 -1
  235. package/dist/extensions/testserver/vitest/fixtures.d.ts +11 -11
  236. package/dist/extensions/testserver/vitest/fixtures.js +14 -23
  237. package/dist/extensions/testserver/vitest/index.d.ts +1 -1
  238. package/dist/extensions/testserver/vitest/index.js +4 -4
  239. package/dist/extensions/testserver/vitest/types.d.ts +16 -18
  240. package/dist/extensions/testserver/vitest/types.js +2 -2
  241. package/dist/extensions/testserver/vitest/worker-sandbox.d.ts +8 -0
  242. package/dist/extensions/testserver/vitest/worker-sandbox.js +17 -0
  243. package/dist/extensions/vitest/driver.d.ts +8 -0
  244. package/dist/extensions/vitest/driver.js +62 -0
  245. package/dist/extensions/vitest/extension.d.ts +2 -0
  246. package/dist/extensions/vitest/extension.js +8 -0
  247. package/dist/{vitest → extensions/vitest/plan}/gateways.d.ts +1 -26
  248. package/dist/extensions/vitest/plan/gateways.js +3 -0
  249. package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.d.ts +1 -2
  250. package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.js +1 -20
  251. package/dist/extensions/vitest/plan/plan-over.d.ts +38 -0
  252. package/dist/extensions/vitest/plan/plan-over.js +31 -0
  253. package/dist/extensions/vitest/plan/plan.d.ts +24 -0
  254. package/dist/{vitest → extensions/vitest/plan}/plan.js +11 -26
  255. package/dist/extensions.d.ts +40 -18
  256. package/dist/extensions.js +49 -22
  257. package/dist/forward-sigterm.js +1 -1
  258. package/dist/launcher-resolvers/index.d.ts +1 -1
  259. package/dist/launcher-resolvers/local-services.d.ts +9 -44
  260. package/dist/launcher-resolvers/local-services.js +4 -5
  261. package/dist/live-app.js +7 -6
  262. package/dist/local-services.d.ts +7 -15
  263. package/dist/local-services.js +8 -29
  264. package/dist/playwright/index.d.ts +1 -0
  265. package/dist/playwright/index.js +4 -0
  266. package/dist/playwright/reporter.d.ts +96 -0
  267. package/dist/playwright/reporter.js +162 -0
  268. package/dist/playwright/worker-index.d.ts +7 -0
  269. package/dist/playwright/worker-index.js +20 -0
  270. package/dist/run-directory/index.d.ts +1 -1
  271. package/dist/run-directory/index.js +2 -3
  272. package/dist/run-directory/plan.d.ts +3 -3
  273. package/dist/run-directory/plan.js +5 -5
  274. package/dist/run-directory/reader.js +2 -2
  275. package/dist/run-directory/recording.d.ts +8 -5
  276. package/dist/run-directory/recording.js +6 -6
  277. package/dist/run-directory/run-collector.d.ts +5 -5
  278. package/dist/run-directory/run-collector.js +5 -5
  279. package/dist/run-directory/run-record.d.ts +17 -90
  280. package/dist/run-directory/run-record.js +15 -55
  281. package/dist/run-directory/timeline-facts.d.ts +2 -1
  282. package/dist/run-directory/timeline-facts.js +4 -2
  283. package/dist/runner/build-snapshots.d.ts +115 -0
  284. package/dist/runner/build-snapshots.js +146 -0
  285. package/dist/runner/context.js +2 -1
  286. package/dist/runner/events.d.ts +24 -69
  287. package/dist/runner/gateways.d.ts +20 -18
  288. package/dist/runner/index.d.ts +8 -7
  289. package/dist/runner/index.js +5 -3
  290. package/dist/runner/live/checkout-gateway.js +15 -7
  291. package/dist/runner/live/snapshot-records.js +7 -17
  292. package/dist/runner/prepare.d.ts +17 -50
  293. package/dist/runner/prepare.js +21 -25
  294. package/dist/runner/ready.d.ts +15 -11
  295. package/dist/runner/ready.js +32 -40
  296. package/dist/runner/recipe.d.ts +4 -18
  297. package/dist/runner/recipe.js +1 -13
  298. package/dist/runner/scope.d.ts +8 -32
  299. package/dist/runner/scope.js +4 -12
  300. package/dist/runner/secrets.d.ts +6 -0
  301. package/dist/runner/secrets.js +10 -0
  302. package/dist/runner/session.d.ts +19 -38
  303. package/dist/runner/session.js +16 -55
  304. package/dist/runner/snapshot-build.d.ts +21 -11
  305. package/dist/runner/snapshot-build.js +11 -16
  306. package/dist/runner/snapshot-cache.d.ts +98 -72
  307. package/dist/runner/snapshot-cache.js +69 -118
  308. package/dist/runner/snapshot-inspect.d.ts +85 -0
  309. package/dist/runner/snapshot-inspect.js +164 -0
  310. package/dist/runner/snapshot-key.d.ts +13 -15
  311. package/dist/runner/snapshot-key.js +15 -22
  312. package/dist/sdk/extension/commands.d.ts +35 -17
  313. package/dist/sdk/extension/commands.js +13 -11
  314. package/dist/sdk/extension/driver.d.ts +143 -0
  315. package/dist/sdk/extension/driver.js +28 -0
  316. package/dist/sdk/extension/index.d.ts +2 -1
  317. package/dist/sdk/extension/index.js +15 -9
  318. package/dist/sdk/extension/{launcher-supplies.d.ts → launcher-context.d.ts} +3 -3
  319. package/dist/sdk/extension/launcher-context.js +5 -0
  320. package/dist/sdk/extension/lifecycle.d.ts +6 -5
  321. package/dist/sdk/extension/lifecycle.js +2 -2
  322. package/dist/sdk/extension/resource-definition.d.ts +13 -13
  323. package/dist/sdk/extension/resource-definition.js +2 -2
  324. package/dist/sdk/extension/resource.d.ts +13 -13
  325. package/dist/sdk/extension/resource.js +11 -11
  326. package/dist/sdk/extension/time.js +2 -2
  327. package/dist/sdk/index.d.ts +2 -0
  328. package/dist/sdk/index.js +3 -1
  329. package/dist/sdk/run/launcher.d.ts +1 -1
  330. package/dist/sdk/run/launcher.js +4 -3
  331. package/dist/sdk/run/payload.js +1 -1
  332. package/dist/sdk/run/test-events.d.ts +24 -18
  333. package/dist/sdk/run/test-events.js +5 -4
  334. package/dist/sdk/run/test-result-writer.d.ts +77 -0
  335. package/dist/sdk/run/test-result-writer.js +143 -0
  336. package/dist/sdk/run/worker-test-event-writer.d.ts +13 -0
  337. package/dist/sdk/run/worker-test-event-writer.js +31 -0
  338. package/dist/vendor/testserver-sdk/container/container.d.ts +1 -6
  339. package/dist/vendor/testserver-sdk/container/container.js +1 -5
  340. package/dist/vendor/testserver-sdk/factories/build.d.ts +12 -40
  341. package/dist/vendor/testserver-sdk/factories/build.js +15 -66
  342. package/dist/vendor/testserver-sdk/factories/gateways.d.ts +1 -2
  343. package/dist/vendor/testserver-sdk/factories/index.d.ts +1 -3
  344. package/dist/vendor/testserver-sdk/factories/index.js +3 -5
  345. package/dist/vendor/testserver-sdk/index.d.ts +1 -2
  346. package/dist/vendor/testserver-sdk/index.js +5 -6
  347. package/dist/vendor/testserver-sdk/records/body.d.ts +1 -1
  348. package/dist/vendor/testserver-sdk/records/body.js +1 -1
  349. package/dist/vitest/index.d.ts +2 -1
  350. package/dist/vitest/index.js +6 -4
  351. package/dist/vitest/test-events.d.ts +6 -16
  352. package/dist/vitest/test-events.js +15 -40
  353. package/dist/vitest/test-results.d.ts +9 -31
  354. package/dist/vitest/test-results.js +34 -105
  355. package/dist/vitest/worker-index.d.ts +6 -0
  356. package/dist/vitest/worker-index.js +17 -0
  357. package/package.json +23 -9
  358. package/skills/overview.md +6 -8
  359. package/skills/read-run-output.md +21 -7
  360. package/dist/chunks/chunk-FVMQKYTT.js +0 -10
  361. package/dist/chunks/chunk-SLNKW4ZM.js +0 -40
  362. package/dist/chunks/chunk-WNIQA5J6.js +0 -19
  363. package/dist/chunks/chunk-WSIF7SR6.js +0 -10
  364. package/dist/commands/vitest/outcomes.d.ts +0 -379
  365. package/dist/commands/vitest/outcomes.js +0 -70
  366. package/dist/core/launcher-supplies.d.ts +0 -11
  367. package/dist/core/launcher-supplies.js +0 -28
  368. package/dist/core/live/terminal-command-gateway.d.ts +0 -8
  369. package/dist/core/live/terminal-command-gateway.js +0 -49
  370. package/dist/core/resource-registry.js +0 -30
  371. package/dist/extensions/github/live/world.d.ts +0 -6
  372. package/dist/extensions/github/live/world.js +0 -16
  373. package/dist/extensions/github/world.js +0 -3
  374. package/dist/extensions/story/command-tree.d.ts +0 -6
  375. package/dist/extensions/story/command-tree.js +0 -21
  376. package/dist/extensions/story/commands/app.d.ts +0 -23
  377. package/dist/extensions/story/commands/app.js +0 -5
  378. package/dist/extensions/story/commands/run/command.d.ts +0 -211
  379. package/dist/extensions/story/commands/run/command.js +0 -259
  380. package/dist/extensions/story/commands/run/metadata.js +0 -8
  381. package/dist/extensions/story/commands/run/outcomes.d.ts +0 -101
  382. package/dist/extensions/story/commands/run/outcomes.js +0 -73
  383. package/dist/extensions/story/commands/tree.d.ts +0 -2
  384. package/dist/extensions/story/commands/tree.js +0 -6
  385. package/dist/extensions/story/extension.d.ts +0 -2
  386. package/dist/extensions/story/extension.js +0 -8
  387. package/dist/extensions/testserver/live/world.d.ts +0 -8
  388. package/dist/extensions/testserver/vitest/sandbox.d.ts +0 -25
  389. package/dist/extensions/testserver/vitest/sandbox.js +0 -43
  390. package/dist/extensions/testserver/world.js +0 -4
  391. package/dist/runner/snapshot-save.d.ts +0 -56
  392. package/dist/runner/snapshot-save.js +0 -151
  393. package/dist/sdk/extension/launcher-supplies.js +0 -3
  394. package/dist/story/align.d.ts +0 -37
  395. package/dist/story/align.js +0 -39
  396. package/dist/story/command-line.d.ts +0 -24
  397. package/dist/story/command-line.js +0 -88
  398. package/dist/story/definition.d.ts +0 -59
  399. package/dist/story/definition.js +0 -9
  400. package/dist/story/diff.d.ts +0 -9
  401. package/dist/story/diff.js +0 -97
  402. package/dist/story/errors.d.ts +0 -14
  403. package/dist/story/errors.js +0 -21
  404. package/dist/story/gateways.d.ts +0 -94
  405. package/dist/story/gateways.js +0 -3
  406. package/dist/story/host.d.ts +0 -30
  407. package/dist/story/host.js +0 -97
  408. package/dist/story/index.d.ts +0 -8
  409. package/dist/story/index.js +0 -11
  410. package/dist/story/json.d.ts +0 -16
  411. package/dist/story/json.js +0 -59
  412. package/dist/story/launch.d.ts +0 -70
  413. package/dist/story/launch.js +0 -77
  414. package/dist/story/live/recording-gateway.d.ts +0 -2
  415. package/dist/story/live/recording-gateway.js +0 -103
  416. package/dist/story/orphans.d.ts +0 -35
  417. package/dist/story/orphans.js +0 -51
  418. package/dist/story/recording.d.ts +0 -62
  419. package/dist/story/recording.js +0 -97
  420. package/dist/story/report.d.ts +0 -42
  421. package/dist/story/report.js +0 -129
  422. package/dist/story/sequence.d.ts +0 -30
  423. package/dist/story/sequence.js +0 -74
  424. package/dist/story/settle.d.ts +0 -96
  425. package/dist/story/settle.js +0 -71
  426. package/dist/story/start.d.ts +0 -50
  427. package/dist/story/start.js +0 -183
  428. package/dist/vendor/testserver-sdk/factories/definition.d.ts +0 -39
  429. package/dist/vendor/testserver-sdk/factories/definition.js +0 -16
  430. package/dist/vendor/testserver-sdk/factories/definitions.d.ts +0 -169
  431. package/dist/vendor/testserver-sdk/factories/definitions.js +0 -245
  432. package/dist/vendor/testserver-sdk/seed/index.d.ts +0 -1
  433. package/dist/vendor/testserver-sdk/seed/index.js +0 -3
  434. package/dist/vendor/testserver-sdk/seed/seed.d.ts +0 -221
  435. package/dist/vendor/testserver-sdk/seed/seed.js +0 -171
  436. package/dist/vitest/find-vitest.d.ts +0 -7
  437. package/dist/vitest/find-vitest.js +0 -28
  438. package/dist/vitest/gateways.js +0 -4
  439. package/dist/vitest/plan.d.ts +0 -51
  440. /package/dist/{extensions/story/commands/run → commands/playwright}/metadata.d.ts +0 -0
  441. /package/dist/{vitest → extensions/vitest/plan}/list-output.d.ts +0 -0
  442. /package/dist/{vitest → extensions/vitest/plan}/list-output.js +0 -0
@@ -1,4 +1,5 @@
1
1
  import type { CheckoutFailure, RunnerSandboxRole, RunnerSnapshotCacheFailure } from "./gateways.ts";
2
+ import type { RejectedSnapshot } from "./snapshot-cache.ts";
2
3
  /**
3
4
  * Where a step runs, which names its progress lines: `snapshot` (`[runner snapshot]`), `apply` (`[runner]`), `install`
4
5
  * (`[runner install]`) and `build` (`[runner build]`).
@@ -29,19 +30,34 @@ export interface NotKeptSandbox {
29
30
  readonly name: string;
30
31
  readonly message: string;
31
32
  }
33
+ /**
34
+ * Why a base snapshot is being built: no cached snapshot fits the run or the checkout (`no-snapshot`), with why each
35
+ * cached snapshot of the recipe didn't (`rejected`); `storm snapshots build --full` asked for a new one whatever the
36
+ * cache holds (`full`); or `storm snapshots build --base <ref>` asked for one at a commit the cache has none of
37
+ * (`base`).
38
+ */
39
+ export type SnapshotBuildReason = {
40
+ readonly kind: "no-snapshot";
41
+ readonly rejected: readonly RejectedSnapshot[];
42
+ } | {
43
+ readonly kind: "full";
44
+ } | {
45
+ readonly kind: "base";
46
+ };
32
47
  /**
33
48
  * What the runner reports, in order.
34
49
  *
35
- * - `snapshot-reused`: the run starts from cached runner snapshot `snapshotId`, of `base`; for a branch snapshot,
36
- * saved by a run on `branch` at HEAD commit `head`, each null for a base snapshot.
37
- * - `snapshot-build-started`: the run builds a runner snapshot of `base`, because no cached one qualified or
38
- * `--rebuild-snapshot` asked; `summary` says what the build does.
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.
52
+ * - `snapshot-build-started`: a base snapshot of `base` is being built, and `why` (`SnapshotBuildReason`); `summary`
53
+ * says what the build does.
39
54
  * - `runner-sandbox-starting`: the runner sandbox is starting from runner snapshot `snapshotId`.
40
55
  * - `sandbox-started`: a runner or build sandbox started, in `ms`.
41
56
  * - `output-started` and `output-ended`: where a section's streamed output starts and ends, for a rule line.
42
57
  * - `step-started`, `step-output` (one line, without its newline) and `step-finished`: a step's progress.
43
58
  * - `snapshot-saving`: the build sandbox is being saved as a runner snapshot.
44
- * - `snapshot-built`: it was, in `ms` from the build's start.
59
+ * - `snapshot-built`: it was, in `ms` from the build's start; `builtBehind` is how many commits HEAD has that `base`
60
+ * lacks, null for a `storm snapshots build --base` commit that isn't HEAD's merge-base.
45
61
  * - `snapshot-entry-not-written`: the cache couldn't record the new snapshot; the run goes on.
46
62
  * - `uploading`: the run's changes are being uploaded to the runner sandbox.
47
63
  * - `uploaded`: the run's changes, `bytes` in all, reached the runner sandbox.
@@ -53,23 +69,16 @@ export interface NotKeptSandbox {
53
69
  * and releasing the run's resources.
54
70
  * - `waiting-for-snapshot`: closing waits up to `settleMs` for a runner snapshot still saving.
55
71
  * - `sandbox-kept`: closing kept runner sandbox `name` running until `stopsAt`, an ISO time.
56
- * - `branch-snapshot-saving`: the run saves the runner sandbox as a branch snapshot of `branch`, once the command
57
- * ended.
58
- * - `branch-snapshot-saved`: it did, as runner snapshot `snapshotId` of `branch` at HEAD commit `head`, in `ms`.
59
- * - `branch-snapshot-not-saved`: it didn't, and `save` says why.
60
- * - `branch-snapshots-dropped`: `--rebuild-snapshot` removed `branch`'s branch snapshot entries from the cache.
61
- * - `branch-snapshots-not-dropped`: it couldn't list the cache or remove one of them.
62
72
  */
63
73
  export type RunnerEvent = {
64
74
  readonly kind: "snapshot-reused";
65
75
  readonly snapshotId: string;
66
76
  readonly base: string;
67
- readonly branch: string | null;
68
- readonly head: string | null;
77
+ readonly builtBehind: number;
69
78
  } | {
70
79
  readonly kind: "snapshot-build-started";
71
80
  readonly base: string;
72
- readonly reason: "no-snapshot" | "rebuild";
81
+ readonly why: SnapshotBuildReason;
73
82
  readonly summary: string;
74
83
  } | {
75
84
  readonly kind: "runner-sandbox-starting";
@@ -112,6 +121,7 @@ export type RunnerEvent = {
112
121
  readonly base: string;
113
122
  readonly ms: number;
114
123
  readonly sizeBytes: number;
124
+ readonly builtBehind: number | null;
115
125
  } | {
116
126
  readonly kind: "snapshot-entry-not-written";
117
127
  readonly failure: RunnerSnapshotCacheFailure;
@@ -139,29 +149,6 @@ export type RunnerEvent = {
139
149
  readonly kind: "sandbox-kept";
140
150
  readonly name: string;
141
151
  readonly stopsAt: string;
142
- } | {
143
- readonly kind: "branch-snapshot-saving";
144
- readonly branch: string;
145
- } | {
146
- readonly kind: "branch-snapshot-saved";
147
- readonly snapshotId: string;
148
- readonly branch: string;
149
- readonly head: string;
150
- readonly ms: number;
151
- readonly sizeBytes: number;
152
- } | {
153
- readonly kind: "branch-snapshot-not-saved";
154
- readonly save: Exclude<RunnerSave, {
155
- readonly kind: "saved" | "skipped";
156
- }>;
157
- } | {
158
- readonly kind: "branch-snapshots-dropped";
159
- readonly branch: string;
160
- readonly snapshotIds: readonly string[];
161
- } | {
162
- readonly kind: "branch-snapshots-not-dropped";
163
- readonly branch: string;
164
- readonly failure: RunnerSnapshotCacheFailure;
165
152
  };
166
153
  /** Hears the runner's events as they happen. */
167
154
  export interface RunnerProgress {
@@ -191,38 +178,6 @@ export type RunnerFailure = {
191
178
  readonly kind: "checkout-failed";
192
179
  readonly failure: CheckoutFailure;
193
180
  };
194
- /**
195
- * How saving the runner sandbox as a branch snapshot ended.
196
- *
197
- * - `saved`: it is runner snapshot `snapshotId` of `base`, for `branch` at HEAD commit `head`, saved in `ms` from the
198
- * save's start; `entryWritten` says whether the cache recorded it.
199
- * - `skipped`: in a run that saves always, HEAD was detached as the run started, so there is no branch to save it for
200
- * (`prepareRunner`); the run keeps its runner sandbox as a run that saves none.
201
- * - `failed`: the scrub or the save failed with `message`.
202
- * - `stopped`: a signal stopped it before it saved, or before the cache recorded the snapshot.
203
- *
204
- * A run whose save started never keeps its runner sandbox, however the save ended; a run whose save never started
205
- * has none of these, and keeps its runner sandbox for the keep time (`RunnerSandboxPlan`).
206
- */
207
- export type RunnerSave = {
208
- readonly kind: "saved";
209
- readonly snapshotId: string;
210
- readonly base: string;
211
- readonly branch: string;
212
- readonly head: string;
213
- readonly ms: number;
214
- readonly sizeBytes: number;
215
- readonly entryWritten: boolean;
216
- } | {
217
- readonly kind: "skipped";
218
- readonly reason: "detached-head";
219
- } | {
220
- readonly kind: "failed";
221
- readonly step: "scrub" | "save-snapshot";
222
- readonly message: string;
223
- } | {
224
- readonly kind: "stopped";
225
- };
226
181
  /** How one stage of readying the runner ended: its value, a failure, or a stop because the run was aborted. */
227
182
  export type RunnerStage<T> = {
228
183
  readonly kind: "ok";
@@ -85,6 +85,14 @@ export interface CheckoutGateway {
85
85
  readonly repoRoot: string;
86
86
  readonly ref: string;
87
87
  }): Promise<BaseCandidate>;
88
+ /**
89
+ * The commit a local ref or a commit name resolves to, a full SHA (`git rev-parse --verify <ref>^{commit}`); null
90
+ * when it names no commit in the clone. It never fetches.
91
+ */
92
+ resolveCommit(request: {
93
+ readonly repoRoot: string;
94
+ readonly ref: string;
95
+ }): Promise<CheckoutResult<string | null>>;
88
96
  /**
89
97
  * Whether commit `ancestor` is `descendant` or one of its ancestors (`git merge-base --is-ancestor`). An
90
98
  * `ancestor` missing from the clone is not. `descendant` may be `HEAD`.
@@ -94,10 +102,14 @@ export interface CheckoutGateway {
94
102
  readonly ancestor: string;
95
103
  readonly descendant: string;
96
104
  }): Promise<CheckoutResult<boolean>>;
97
- /** When `commit` was committed, in milliseconds since the epoch. */
98
- commitTime(request: {
105
+ /**
106
+ * How many commits `to` has in its history that `from` doesn't (`git rev-list --count from..to`): 0 when `to` is
107
+ * `from` or one of its ancestors. Each may be `HEAD`. A commit missing from the clone is a failure.
108
+ */
109
+ commitCount(request: {
99
110
  readonly repoRoot: string;
100
- readonly commit: string;
111
+ readonly from: string;
112
+ readonly to: string;
101
113
  }): Promise<CheckoutResult<number>>;
102
114
  /** The text of `path`, relative to the repository's root, at `commit`. */
103
115
  readFileAt(request: {
@@ -122,8 +134,7 @@ export interface CheckoutGateway {
122
134
  }
123
135
  /**
124
136
  * One runner snapshot the cache records: who it belongs to, what it was built from, and when it expires. Times
125
- * are ISO strings. An entry with `branch` and `head` records a branch snapshot, saved from a run on that branch; one
126
- * without them records a base snapshot, built from its base. An entry has both or neither.
137
+ * are ISO strings. Every entry records a base snapshot, built at its base, which may be any commit.
127
138
  */
128
139
  export interface RunnerSnapshotEntry {
129
140
  readonly teamId: string;
@@ -133,17 +144,8 @@ export interface RunnerSnapshotEntry {
133
144
  readonly recipeName: string;
134
145
  /** The snapshot key at `base` (`snapshotKey`). */
135
146
  readonly snapshotKey: string;
136
- /** 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. */
137
148
  readonly base: string;
138
- /** For a branch snapshot, the local branch of the run that saved it. */
139
- readonly branch?: string;
140
- /** For a branch snapshot, the full SHA of the HEAD commit of the run that saved it. */
141
- readonly head?: string;
142
- /**
143
- * For a branch snapshot, the root of the checkout the run that saved it ran from. Only a run from that checkout
144
- * starts from it, so a branch of the same name in another checkout never inherits what this run left.
145
- */
146
- readonly repoRoot?: string;
147
149
  readonly snapshotId: string;
148
150
  readonly createdAt: string;
149
151
  readonly expiresAt: string;
@@ -180,7 +182,7 @@ export type RunnerSnapshotCacheOperation = {
180
182
  };
181
183
  /**
182
184
  * The per-machine runner snapshot cache: one record per runner snapshot, keyed by the entry's identity (team,
183
- * project, region, runtime, recipe name, snapshot key, base and, for a branch snapshot, branch and checkout root).
185
+ * project, region, runtime, recipe name, snapshot key and base).
184
186
  * Every method returns its expected failures and never rejects. Which entries a run may use, and when one has
185
187
  * expired, is the caller's.
186
188
  */
@@ -271,7 +273,7 @@ export interface StagedFile {
271
273
  readonly name: string;
272
274
  readonly content: Uint8Array;
273
275
  }
274
- /** A runner snapshot a build sandbox or a runner sandbox was saved as. */
276
+ /** A runner snapshot a build sandbox was saved as. */
275
277
  export interface SavedSnapshot {
276
278
  readonly snapshotId: string;
277
279
  /** When the Sandbox API says it expires, as an ISO string, when it says. */
@@ -330,7 +332,7 @@ export interface RunnerSandboxGateway {
330
332
  readonly path: string;
331
333
  readonly fromLine: number;
332
334
  }, onOutput: (chunk: SandboxOutputChunk) => void, signal?: AbortSignal): Promise<RunnerSandboxOperation>;
333
- /** 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. */
334
336
  saveSnapshot(sandbox: RunnerSandbox, request: {
335
337
  readonly expirationMs: number;
336
338
  }): Promise<RunnerSandboxResult<SavedSnapshot>>;
@@ -1,5 +1,6 @@
1
1
  export type { RunnerContext } from "./context.ts";
2
- export { type KeptSandbox, type RunnerEvent, type RunnerFailure, type RunnerProgress, type RunnerSave, type RunnerStepPhase, } 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";
3
4
  export type { CheckoutFailure, CheckoutGateway, RunnerSandboxGateway, RunnerSnapshotCacheFailure, RunnerSnapshotCacheGateway, RunnerSnapshotEntry, RunnerTerminal, } from "./gateways.ts";
4
5
  export { liveCheckoutGateway } from "./live/checkout-gateway.ts";
5
6
  export { liveRunnerSandboxGateway } from "./live/sandbox-gateway.ts";
@@ -7,11 +8,11 @@ export { liveRunnerTerminal } from "./live/terminal.ts";
7
8
  export { localUserName } from "./live/user.ts";
8
9
  export { liveRunnerSnapshotCacheGateway, unavailableRunnerSnapshotCacheGateway, } from "./live/snapshot-cache-gateway.ts";
9
10
  export { lineSplitter } from "./output.ts";
10
- export { prepareRunner, type PrepareRunnerOutcome, type RunnerSaveMode } from "./prepare.ts";
11
+ export { prepareRunner, type PrepareRunnerOutcome } from "./prepare.ts";
11
12
  export type { ReadyRunnerOutcome } from "./ready.ts";
12
- export { type CheckedRecipe, checkRecipe, runStepTakesSecret } from "./recipe.ts";
13
+ export { type CheckedRecipe, checkRecipe } from "./recipe.ts";
13
14
  export { SANDBOX_TEST_EVENTS_PATH } from "./sandboxed-command.ts";
14
- export { readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH, type RunnerSecrets } from "./secrets.ts";
15
- export type { RunnerSandboxPlan } from "./scope.ts";
16
- export { type RunnerCleanupFacts, openRunnerSession, type RunnerSession, type RunnerSessionRequest, } from "./session.ts";
17
- export { RUNNER_SNAPSHOTS_SUBPATH, type SnapshotCacheNote } from "./snapshot-cache.ts";
15
+ export { declaredSecretValues, readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH, type RunnerSecrets } from "./secrets.ts";
16
+ export { type RunnerCleanupFacts, openRunnerSession, type RunnerSession, type RunnerSessionCleanup, type RunnerSessionRequest, } from "./session.ts";
17
+ export { type InspectedSnapshot, inspectSnapshotCache, type SnapshotCacheInspection, type UnpickedReason, } from "./snapshot-inspect.ts";
18
+ export { type RejectedSnapshot, RUNNER_SNAPSHOTS_SUBPATH, type SnapshotCacheNote, type SnapshotRejectionReason, } from "./snapshot-cache.ts";
@@ -1,6 +1,7 @@
1
1
  // The `runner` module's public surface: running a command in a runner sandbox, through a run's runner session. Other
2
2
  // modules import only from here, and it holds only what another module under `src/` imports; the runner's own tests
3
3
  // import the files that declare the rest (`README.md`).
4
+ export { buildSnapshots, prepareSnapshotBuild, } from "./build-snapshots.js";
4
5
  export {} from "./events.js";
5
6
  export { liveCheckoutGateway } from "./live/checkout-gateway.js";
6
7
  export { liveRunnerSandboxGateway } from "./live/sandbox-gateway.js";
@@ -9,8 +10,9 @@ export { localUserName } from "./live/user.js";
9
10
  export { liveRunnerSnapshotCacheGateway, unavailableRunnerSnapshotCacheGateway, } from "./live/snapshot-cache-gateway.js";
10
11
  export { lineSplitter } from "./output.js";
11
12
  export { prepareRunner } from "./prepare.js";
12
- export { checkRecipe, runStepTakesSecret } from "./recipe.js";
13
+ export { checkRecipe } from "./recipe.js";
13
14
  export { SANDBOX_TEST_EVENTS_PATH } from "./sandboxed-command.js";
14
- export { readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH } from "./secrets.js";
15
+ export { declaredSecretValues, readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH } from "./secrets.js";
15
16
  export { openRunnerSession, } from "./session.js";
16
- export { RUNNER_SNAPSHOTS_SUBPATH } from "./snapshot-cache.js";
17
+ export { inspectSnapshotCache, } from "./snapshot-inspect.js";
18
+ export { RUNNER_SNAPSHOTS_SUBPATH, } from "./snapshot-cache.js";
@@ -19,8 +19,9 @@ export function liveCheckoutGateway() {
19
19
  repositoryRoot: ({ cwd }) => repositoryRoot(cwd),
20
20
  head: ({ repoRoot }) => head(repoRoot),
21
21
  baseCandidate: ({ repoRoot, ref }) => baseCandidate(repoRoot, ref),
22
+ resolveCommit: ({ repoRoot, ref }) => resolveCommit(repoRoot, ref),
22
23
  contains: ({ repoRoot, ancestor, descendant }) => contains(repoRoot, ancestor, descendant),
23
- commitTime: ({ repoRoot, commit }) => commitTime(repoRoot, commit),
24
+ commitCount: ({ repoRoot, from, to }) => commitCount(repoRoot, from, to),
24
25
  readFileAt: ({ repoRoot, commit, path }) => readFileAt(repoRoot, commit, path),
25
26
  submodules: ({ repoRoot }) => submodules(repoRoot),
26
27
  assembleUpload: ({ repoRoot, base }) => assembleUpload(repoRoot, base),
@@ -62,6 +63,13 @@ async function baseCandidate(repoRoot, ref) {
62
63
  return mergeBase.exitCode === 1 ? { kind: "unrelated" } : { kind: "failed", failure: mergeBase.failure };
63
64
  return { kind: "merge-base", base: mergeBase.stdout.toString("utf8").trim() };
64
65
  }
66
+ async function resolveCommit(repoRoot, ref) {
67
+ // `--end-of-options` keeps a ref that starts with `-` from reading as an option.
68
+ const run = await git(repoRoot, ["rev-parse", "--verify", "--quiet", "--end-of-options", `${ref}^{commit}`]);
69
+ if (!run.ok)
70
+ return run.exitCode === 1 ? { ok: true, value: null } : run;
71
+ return { ok: true, value: run.stdout.toString("utf8").trim() };
72
+ }
65
73
  async function contains(repoRoot, ancestor, descendant) {
66
74
  // A base missing from the clone (`cat-file -e` exits non-zero) is no ancestor of anything here.
67
75
  const present = await git(repoRoot, ["cat-file", "-e", `${ancestor}^{commit}`]);
@@ -72,14 +80,14 @@ async function contains(repoRoot, ancestor, descendant) {
72
80
  return { ok: true, value: true };
73
81
  return run.exitCode === 1 ? { ok: true, value: false } : run;
74
82
  }
75
- async function commitTime(repoRoot, commit) {
76
- const run = await git(repoRoot, ["show", "-s", "--format=%ct", `${commit}^{commit}`]);
83
+ async function commitCount(repoRoot, from, to) {
84
+ const run = await git(repoRoot, ["rev-list", "--count", `${from}..${to}`]);
77
85
  if (!run.ok)
78
86
  return run;
79
- const seconds = Number(run.stdout.toString("utf8").trim());
80
- return Number.isSafeInteger(seconds)
81
- ? { ok: true, value: seconds * 1000 }
82
- : { ok: false, failure: { message: `git show printed no commit time for ${commit}` } };
87
+ const count = Number(run.stdout.toString("utf8").trim());
88
+ return Number.isSafeInteger(count)
89
+ ? { ok: true, value: count }
90
+ : { ok: false, failure: { message: `git rev-list printed no count for ${from}..${to}` } };
83
91
  }
84
92
  async function readFileAt(repoRoot, commit, path) {
85
93
  const object = `${commit}:${path}`;
@@ -1,12 +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 branch snapshot's record adds `branch`, `head` and `repoRoot`, all three or
3
- // none; a storm that predates them drops them as it reads, so the file's name no longer matches the entry's identity,
4
- // and that storm lists the file as unreadable and never starts from it.
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.
5
6
  import { z } from "zod";
6
7
  const isoTime = z.string().refine((value) => !Number.isNaN(Date.parse(value)), { message: "not a time" });
7
8
  const nonEmpty = z.string().min(1);
8
- const entrySchema = z
9
- .object({
9
+ const entrySchema = z.object({
10
10
  version: z.literal(1),
11
11
  teamId: nonEmpty,
12
12
  projectId: nonEmpty,
@@ -15,17 +15,10 @@ const entrySchema = z
15
15
  recipeName: nonEmpty,
16
16
  snapshotKey: nonEmpty,
17
17
  base: nonEmpty,
18
- branch: nonEmpty.exactOptional(),
19
- head: nonEmpty.exactOptional(),
20
- repoRoot: nonEmpty.exactOptional(),
21
18
  snapshotId: nonEmpty,
22
19
  createdAt: isoTime,
23
20
  expiresAt: isoTime,
24
- })
25
- .refine((entry) => {
26
- const present = [entry.branch, entry.head, entry.repoRoot].filter((value) => value !== undefined).length;
27
- return present === 0 || present === 3;
28
- }, { message: "has some of branch, head and repoRoot without the others" });
21
+ });
29
22
  /** The entry a cache file holds, or why it holds none. */
30
23
  export function parseSnapshotEntry(text) {
31
24
  let json;
@@ -49,7 +42,7 @@ export function parseSnapshotEntry(text) {
49
42
  }
50
43
  /** The text of the file that records `entry`. */
51
44
  export function snapshotEntryText(entry) {
52
- const { teamId, projectId, region, runtime, recipeName, snapshotKey, base, branch, head, repoRoot } = entry;
45
+ const { teamId, projectId, region, runtime, recipeName, snapshotKey, base } = entry;
53
46
  const { snapshotId, createdAt, expiresAt } = entry;
54
47
  const record = {
55
48
  version: 1,
@@ -60,9 +53,6 @@ export function snapshotEntryText(entry) {
60
53
  recipeName,
61
54
  snapshotKey,
62
55
  base,
63
- ...(branch === undefined ? {} : { branch }),
64
- ...(head === undefined ? {} : { head }),
65
- ...(repoRoot === undefined ? {} : { repoRoot }),
66
56
  snapshotId,
67
57
  createdAt,
68
58
  expiresAt,
@@ -1,21 +1,9 @@
1
1
  import { type RefusedBaseRef } from "./base.ts";
2
- import type { CheckoutFailure, CheckoutHead, CheckoutUpload } from "./gateways.ts";
2
+ import type { CheckoutFailure, CheckoutUpload } from "./gateways.ts";
3
3
  import { type CheckedRecipe, type ResolvedRunnerStep, type VcpusRun } from "./recipe.ts";
4
- import { type RunnerSnapshotCandidate, type SnapshotCacheContext, type SnapshotCacheNote } from "./snapshot-cache.ts";
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;
7
- /**
8
- * Whether a run saves its runner sandbox as a branch snapshot of HEAD's branch once the command ends.
9
- *
10
- * - `new-head`: when the command exited 0 and the run didn't start from a branch snapshot HEAD's commit saved;
11
- * nothing, and no word of it, with a detached HEAD. What a run does when neither `--save-snapshot` nor the
12
- * recipe's `saveSnapshot` is given.
13
- * - `always`: whatever the command's exit code and whatever runner snapshot the run started from; with a detached HEAD
14
- * the run says it saves nothing (`--save-snapshot`, or the recipe's `saveSnapshot: true`).
15
- * - `never`: `--save-snapshot=false`, or the recipe's `saveSnapshot: false`; with neither given, `CI` set, or a
16
- * recipe whose install or build step names a runner secret.
17
- */
18
- export type RunnerSaveMode = "new-head" | "always" | "never";
19
7
  /** What `prepareRunner` checks a run with; `Run` is what the recipe's `vcpus` function is called with. */
20
8
  export interface PrepareRunnerRequest<Run> {
21
9
  /** The directory the run started in, inside the checkout. */
@@ -23,24 +11,12 @@ export interface PrepareRunnerRequest<Run> {
23
11
  readonly recipe: CheckedRecipe<Run>;
24
12
  /** The run, for the recipe's `vcpus`, with the keys of its resources. */
25
13
  readonly vcpusRun: VcpusRun<Run>;
26
- /** `--rebuild-snapshot`: the run builds a runner snapshot whatever the cache holds, so the cache isn't read. */
27
- readonly rebuild: boolean;
28
- /** Whether the run saves the runner sandbox as a branch snapshot of HEAD's branch once the command ends. */
29
- readonly save: RunnerSaveMode;
30
- /**
31
- * Whether `--save-snapshot`, or the recipe's `saveSnapshot: true` without `--save-snapshot=false`, trusts commands
32
- * that ran on this branch with the install and build steps' runner secrets. Without that trust, a recipe whose
33
- * install or build step names one starts only from a base snapshot.
34
- */
35
- readonly trustBranchSnapshots: boolean;
36
14
  }
37
15
  /** The runner, checked on this machine, ready for the runner sandbox. */
38
16
  export interface PreparedRunner {
39
17
  readonly recipe: CheckedRecipe;
40
18
  readonly repoRoot: string;
41
- /** Where HEAD is: the branch a run's branch snapshot is for, null when detached, and its commit. */
42
- readonly head: CheckoutHead;
43
- /** 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. */
44
20
  readonly base: string;
45
21
  readonly baseRef: string;
46
22
  /** The recipe's snapshot steps at the base, each with the runner secret names it gets, and their snapshot key. */
@@ -49,34 +25,24 @@ export interface PreparedRunner {
49
25
  readonly snapshotKey: string;
50
26
  /** The runner sandbox's vCPUs for the run. */
51
27
  readonly vcpus: number;
28
+ /** What the run uploads on top of the base. */
52
29
  readonly upload: CheckoutUpload;
53
30
  /**
54
- * The cached runner snapshots the run may start from, base snapshots and HEAD's branch's branch snapshots, before
55
- * 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`).
56
33
  */
57
34
  readonly candidates: readonly RunnerSnapshotCandidate[];
58
- readonly rebuild: boolean;
59
- /** What the cache read noticed, for the run to report. */
35
+ /** The recipe's other cached snapshots, each with why the run doesn't start from it, before that filter. */
36
+ readonly rejected: readonly RejectedSnapshot[];
37
+ /** How many commits HEAD has that the run's base lacks. */
38
+ readonly commitsAfterBase: number;
39
+ /** What removing expired entries noticed (`removeExpiredEntries`), for the run to report. */
60
40
  readonly notes: readonly SnapshotCacheNote[];
61
- /**
62
- * The branch the run saves a branch snapshot of, and whether it saves whatever the command's exit code and whatever
63
- * runner snapshot it started from (`always`) or only when the command exits 0 and that isn't a branch snapshot
64
- * HEAD's commit saved; in a run that saves always, why it saves none (`skipped`, with a detached HEAD); null when
65
- * the run saves none and says nothing of it: a run that saves never, or a detached HEAD in any other.
66
- */
67
- readonly save: {
68
- readonly kind: "branch";
69
- readonly branch: string;
70
- readonly always: boolean;
71
- } | {
72
- readonly kind: "skipped";
73
- readonly reason: "detached-head";
74
- } | null;
75
41
  }
76
42
  /**
77
43
  * How the local checks ended.
78
44
  *
79
- * - `ok`: the run is ready for the sandbox side.
45
+ * - `ok`: the checks passed, so the runner can ready the runner sandbox.
80
46
  * - `no-base-ref`: no ref in `baseRefs` exists locally and shares history with HEAD; `refs` says why for each.
81
47
  * - `submodules`: the checkout has Git submodules, at `paths`.
82
48
  * - `invalid-recipe`: a step function or `vcpus` failed or returned something storm can't use, such as a step naming
@@ -102,9 +68,10 @@ export type PrepareRunnerOutcome = {
102
68
  readonly failure: CheckoutFailure;
103
69
  };
104
70
  /**
105
- * Runs the local checks in order: the repository's root, HEAD, the base, the submodule refusal, the snapshot steps at
106
- * the base and their key, the runner's vCPUs, the upload, and the cache read. It never mints, acquires or creates. It
107
- * decides what the run saves: HEAD's branch, or nothing with a detached HEAD or when the run saves none (`never`). An
108
- * untrusted recipe whose install or build step names a runner secret gets no branch snapshot candidates.
71
+ * Runs the local checks in order: the repository's root, the base, the submodule refusal, the snapshot steps at
72
+ * the base and their key, the runner's vCPUs, the upload, HEAD's count of commits after the base, and the cache read,
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.
109
76
  */
110
77
  export declare function prepareRunner<Run>(context: RunnerPrepareContext, request: PrepareRunnerRequest<Run>): Promise<PrepareRunnerOutcome>;
@@ -2,14 +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 { resolveVcpus, runStepTakesSecret, } from "./recipe.js";
6
- import { findSnapshotCandidates, } from "./snapshot-cache.js";
5
+ import { resolveVcpus } from "./recipe.js";
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
10
- * the base and their key, the runner's vCPUs, the upload, and the cache read. It never mints, acquires or creates. It
11
- * decides what the run saves: HEAD's branch, or nothing with a detached HEAD or when the run saves none (`never`). An
12
- * untrusted recipe whose install or build step names a runner secret gets no branch snapshot candidates.
9
+ * Runs the local checks in order: the repository's root, the base, the submodule refusal, the snapshot steps at
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
+ * 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.
13
14
  */
14
15
  export async function prepareRunner(context, request) {
15
16
  const { checkout } = context;
@@ -18,9 +19,6 @@ export async function prepareRunner(context, request) {
18
19
  if (!root.ok)
19
20
  return { kind: "checkout-failed", failure: root.failure };
20
21
  const repoRoot = root.value;
21
- const head = await checkout.head({ repoRoot });
22
- if (!head.ok)
23
- return { kind: "checkout-failed", failure: head.failure };
24
22
  const resolved = await resolveBase(checkout, { repoRoot, baseRefs: recipe.baseRefs });
25
23
  if (resolved.kind === "failed")
26
24
  return { kind: "checkout-failed", failure: resolved.failure };
@@ -41,16 +39,22 @@ export async function prepareRunner(context, request) {
41
39
  const upload = await checkout.assembleUpload({ repoRoot, base });
42
40
  if (!upload.ok)
43
41
  return { kind: "checkout-failed", failure: upload.failure };
44
- const reuseBranch = request.trustBranchSnapshots || !runStepTakesSecret(recipe);
45
- const cache = request.rebuild
46
- ? { candidates: [], notes: [] }
47
- : await findSnapshotCandidates(context, { repoRoot, recipe, branch: reuseBranch ? head.value.branch : null });
42
+ const afterBase = await checkout.commitCount({ repoRoot, from: base, to: "HEAD" });
43
+ if (!afterBase.ok)
44
+ return { kind: "checkout-failed", failure: afterBase.failure };
45
+ const listing = await removeExpiredEntries(context);
46
+ const cache = classifySnapshotEntries(context, {
47
+ entries: listing.entries,
48
+ recipe,
49
+ base,
50
+ snapshotKey: steps.key,
51
+ commitsAfterBase: afterBase.value,
52
+ });
48
53
  return {
49
54
  kind: "ok",
50
55
  prepared: {
51
56
  recipe,
52
57
  repoRoot,
53
- head: head.value,
54
58
  base,
55
59
  baseRef: resolved.ref,
56
60
  toolchains: steps.toolchains,
@@ -59,17 +63,9 @@ export async function prepareRunner(context, request) {
59
63
  vcpus: vcpus.vcpus,
60
64
  upload: upload.value,
61
65
  candidates: cache.candidates,
62
- rebuild: request.rebuild,
63
- notes: cache.notes,
64
- save: plannedSave(request.save, head.value.branch),
66
+ rejected: cache.rejected,
67
+ commitsAfterBase: afterBase.value,
68
+ notes: listing.notes,
65
69
  },
66
70
  };
67
71
  }
68
- /** What a run in `mode` saves with HEAD on `branch`, null when detached. */
69
- function plannedSave(mode, branch) {
70
- if (mode === "never")
71
- return null;
72
- if (branch !== null)
73
- return { kind: "branch", branch, always: mode === "always" };
74
- return mode === "always" ? { kind: "skipped", reason: "detached-head" } : null;
75
- }
@@ -9,13 +9,15 @@ export declare const APPLY_LABEL = "Applying your changes";
9
9
  /** A runner sandbox ready for the command. */
10
10
  export interface ReadyRunner {
11
11
  readonly sandbox: RunnerSandbox;
12
- /**
13
- * The cache entry of the runner snapshot it started from: a base snapshot or a branch snapshot, whose base its
14
- * repository holds as its first commit.
15
- */
16
- 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;
17
15
  /** Whether this run built the runner snapshot. */
18
16
  readonly built: boolean;
17
+ /** How many commits HEAD has that the snapshot's base lacks. */
18
+ readonly builtBehind: number;
19
+ /** How many bytes of changes the run uploaded on top of the snapshot's base. */
20
+ readonly uploadBytes: number;
19
21
  /** How long the build step took, in milliseconds. */
20
22
  readonly buildMs: number;
21
23
  readonly vcpus: number;
@@ -57,18 +59,20 @@ export type ReadyRunnerOutcome = {
57
59
  export interface ReadyRunnerRequest {
58
60
  readonly prepared: PreparedRunner;
59
61
  readonly access: SandboxAccess;
60
- /** The local user, for each sandbox's `user` tag. */
62
+ /** The local user, for the build sandbox's and the runner sandbox's `user` tag. */
61
63
  readonly user: string;
62
64
  /**
63
- * Every runner secret's value, of which each recipe step, in a snapshot build or the install and build, gets the
64
- * ones it names.
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.
65
67
  */
66
68
  readonly secrets: RunnerSecrets;
67
69
  }
68
70
  /**
69
- * Readies the runner sandbox for a prepared run. Of the cached candidates for the access's team and project, it
70
- * starts from the one whose base is nearest HEAD; with none, or under `--rebuild-snapshot`, it builds a runner
71
- * snapshot of the run's base first. It uploads what the checkout changes on top of the snapshot's base.
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.
72
76
  */
73
77
  export declare function readyRunner(context: RunnerContext, request: ReadyRunnerRequest, control: {
74
78
  readonly scope: RunnerSandboxScope;