@cnc-tools/storm 0.10.0 → 0.12.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 (461) hide show
  1. package/dist/bin/storm.js +12 -9
  2. package/dist/build-info.js +1 -1
  3. package/dist/chunks/{chunk-YF3ICDBY.js → chunk-43MWZLJR.js} +1 -1
  4. package/dist/chunks/chunk-4XT5RC5T.js +98 -0
  5. package/dist/chunks/chunk-7D6LC5JY.js +340 -0
  6. package/dist/chunks/{chunk-WF4KJ7YG.js → chunk-BW2ADH7U.js} +1 -1
  7. package/dist/chunks/chunk-FK4RLDEK.js +40 -0
  8. package/dist/chunks/chunk-FSP3SJ35.js +1429 -0
  9. package/dist/chunks/{chunk-J6ZNYUDV.js → chunk-GQIL3AHY.js} +2 -3
  10. package/dist/chunks/chunk-GSC6SRTW.js +27 -0
  11. package/dist/chunks/chunk-ISGQJIQM.js +852 -0
  12. package/dist/chunks/chunk-IYM44FUX.js +1461 -0
  13. package/dist/chunks/{chunk-XHJGHJBW.js → chunk-LQKNI3EG.js} +38 -279
  14. package/dist/chunks/chunk-NMVODY3P.js +19 -0
  15. package/dist/chunks/{chunk-VJQLMGOH.js → chunk-ODQHQJLE.js} +2761 -3699
  16. package/dist/chunks/chunk-RYRJNHL7.js +55 -0
  17. package/dist/chunks/chunk-SXW6XN4R.js +161 -0
  18. package/dist/chunks/{chunk-OVXD7GES.js → chunk-T6AZIDZD.js} +43 -396
  19. package/dist/chunks/chunk-TEEZL3GA.js +851 -0
  20. package/dist/chunks/chunk-TMQQYHUX.js +80 -0
  21. package/dist/chunks/{chunk-AKKNF3WZ.js → chunk-U7M3ZB3Z.js} +565 -595
  22. package/dist/chunks/{chunk-JQ2HK4RN.js → chunk-Y3BUNNRG.js} +234 -57
  23. package/dist/chunks/{chunk-ZJ2USLAT.js → chunk-YM6TZV4L.js} +394 -416
  24. package/dist/chunks/chunk-YT5OROR7.js +271 -0
  25. package/dist/chunks/{live-app-RIJM3QFD.js → live-app-AZ5N5HBD.js} +36 -12
  26. package/dist/command-tree.d.ts +4 -1
  27. package/dist/command-tree.js +4 -1
  28. package/dist/commands/exec/cleanup.d.ts +3 -3
  29. package/dist/commands/exec/cleanup.js +6 -2
  30. package/dist/commands/exec/command.d.ts +56 -17
  31. package/dist/commands/exec/command.js +51 -39
  32. package/dist/commands/exec/define-run-command.d.ts +752 -0
  33. package/dist/commands/exec/define-run-command.js +58 -0
  34. package/dist/commands/exec/driver-plan.d.ts +30 -0
  35. package/dist/commands/exec/driver-plan.js +44 -0
  36. package/dist/commands/exec/driver-refusals.d.ts +89 -0
  37. package/dist/commands/exec/driver-refusals.js +65 -0
  38. package/dist/commands/exec/exec-words.d.ts +5 -0
  39. package/dist/commands/exec/exec-words.js +31 -0
  40. package/dist/commands/exec/job-summary.d.ts +1 -1
  41. package/dist/commands/exec/job-summary.js +1 -1
  42. package/dist/commands/exec/live-view.js +58 -28
  43. package/dist/commands/exec/mint-failed.js +5 -5
  44. package/dist/commands/exec/outcomes.d.ts +72 -10
  45. package/dist/commands/exec/outcomes.js +38 -10
  46. package/dist/commands/exec/plan-run.d.ts +3 -5
  47. package/dist/commands/exec/plan-run.js +3 -3
  48. package/dist/commands/exec/progress.d.ts +35 -15
  49. package/dist/commands/exec/progress.js +82 -57
  50. package/dist/commands/exec/resource-flags.d.ts +10 -3
  51. package/dist/commands/exec/resource-flags.js +25 -14
  52. package/dist/commands/exec/resource-refusals.d.ts +2 -2
  53. package/dist/commands/exec/resource-refusals.js +10 -10
  54. package/dist/commands/exec/run-bin.d.ts +35 -0
  55. package/dist/commands/exec/run-bin.js +32 -0
  56. package/dist/commands/exec/run-command.d.ts +85 -20
  57. package/dist/commands/exec/run-command.js +142 -238
  58. package/dist/commands/exec/run-metadata.d.ts +29 -17
  59. package/dist/commands/exec/run-metadata.js +38 -16
  60. package/dist/commands/exec/snapshot-text.d.ts +40 -0
  61. package/dist/commands/exec/snapshot-text.js +112 -0
  62. package/dist/commands/exec/test-plan.d.ts +3 -37
  63. package/dist/commands/exec/test-plan.js +11 -28
  64. package/dist/commands/exec/tests-summary.d.ts +21 -12
  65. package/dist/commands/exec/tests-summary.js +67 -39
  66. package/dist/commands/exec/text.d.ts +5 -0
  67. package/dist/commands/exec/text.js +7 -0
  68. package/dist/commands/exec/view.js +22 -13
  69. package/dist/commands/exec/waterfall.d.ts +3 -1
  70. package/dist/commands/exec/waterfall.js +20 -3
  71. package/dist/commands/exec/worker-chart.d.ts +19 -11
  72. package/dist/commands/exec/worker-chart.js +66 -36
  73. package/dist/commands/playwright/command.d.ts +746 -0
  74. package/dist/commands/playwright/command.js +31 -0
  75. package/dist/commands/playwright/metadata.d.ts +4 -0
  76. package/dist/commands/playwright/metadata.js +8 -0
  77. package/dist/commands/runs/facts.d.ts +22 -8
  78. package/dist/commands/runs/facts.js +19 -9
  79. package/dist/commands/runs/list/command.d.ts +34 -8
  80. package/dist/commands/runs/list/command.js +18 -13
  81. package/dist/commands/runs/list/outcomes.d.ts +17 -4
  82. package/dist/commands/runs/logs/command.js +20 -14
  83. package/dist/commands/runs/logs/outcomes.js +1 -1
  84. package/dist/commands/runs/past-run.d.ts +3 -27
  85. package/dist/commands/runs/past-run.js +3 -37
  86. package/dist/commands/runs/show/command.d.ts +36 -8
  87. package/dist/commands/runs/show/command.js +53 -33
  88. package/dist/commands/runs/show/metadata.js +1 -1
  89. package/dist/commands/runs/show/outcomes.d.ts +18 -4
  90. package/dist/commands/runs/show/outcomes.js +37 -16
  91. package/dist/commands/snapshots/build/command.d.ts +898 -0
  92. package/dist/commands/snapshots/build/command.js +511 -0
  93. package/dist/commands/snapshots/build/metadata.d.ts +28 -0
  94. package/dist/commands/snapshots/build/metadata.js +34 -0
  95. package/dist/commands/snapshots/build/outcomes.d.ts +484 -0
  96. package/dist/commands/snapshots/build/outcomes.js +322 -0
  97. package/dist/commands/snapshots/list/command.d.ts +272 -0
  98. package/dist/commands/snapshots/list/command.js +305 -0
  99. package/dist/commands/snapshots/list/metadata.d.ts +16 -0
  100. package/dist/commands/snapshots/list/metadata.js +24 -0
  101. package/dist/commands/snapshots/list/outcomes.d.ts +183 -0
  102. package/dist/commands/snapshots/list/outcomes.js +257 -0
  103. package/dist/commands/snapshots/metadata.d.ts +3 -0
  104. package/dist/commands/snapshots/metadata.js +7 -0
  105. package/dist/commands/vitest/command.d.ts +267 -298
  106. package/dist/commands/vitest/command.js +23 -174
  107. package/dist/commands/vitest/metadata.js +1 -1
  108. package/dist/config/credential-resolver.d.ts +6 -3
  109. package/dist/config/credential-resolver.js +6 -5
  110. package/dist/config-file/define.d.ts +1 -1
  111. package/dist/context.d.ts +44 -24
  112. package/dist/context.js +20 -13
  113. package/dist/core/before-run.d.ts +7 -6
  114. package/dist/core/before-run.js +9 -9
  115. package/dist/core/definition-lookup.d.ts +22 -0
  116. package/dist/core/definition-lookup.js +35 -0
  117. package/dist/core/drivers-of.d.ts +23 -0
  118. package/dist/core/drivers-of.js +13 -0
  119. package/dist/core/events.d.ts +6 -22
  120. package/dist/core/gateways.d.ts +38 -170
  121. package/dist/core/index.d.ts +13 -12
  122. package/dist/core/index.js +12 -11
  123. package/dist/core/launcher-context.d.ts +11 -0
  124. package/dist/core/launcher-context.js +31 -0
  125. package/dist/core/live/package-bin-gateway.d.ts +6 -0
  126. package/dist/core/live/package-bin-gateway.js +24 -0
  127. package/dist/core/package-bin.d.ts +7 -0
  128. package/dist/core/package-bin.js +30 -0
  129. package/dist/core/presentations.d.ts +5 -4
  130. package/dist/core/presentations.js +9 -9
  131. package/dist/core/resource-definition-set.d.ts +39 -0
  132. package/dist/core/resource-definition-set.js +31 -0
  133. package/dist/core/resource-reports.d.ts +38 -5
  134. package/dist/core/resource-reports.js +47 -17
  135. package/dist/core/resource.d.ts +4 -4
  136. package/dist/core/resources.d.ts +8 -7
  137. package/dist/core/resources.js +11 -13
  138. package/dist/core/run-state.d.ts +27 -16
  139. package/dist/core/run-state.js +50 -18
  140. package/dist/core/run.d.ts +42 -54
  141. package/dist/core/run.js +72 -122
  142. package/dist/core/setup-phases.d.ts +14 -0
  143. package/dist/core/setup-phases.js +24 -0
  144. package/dist/core/state-directory.d.ts +2 -2
  145. package/dist/core/state-directory.js +3 -3
  146. package/dist/core/timeline.d.ts +4 -2
  147. package/dist/core/timeline.js +11 -4
  148. package/dist/credential/events.d.ts +20 -0
  149. package/dist/credential/events.js +4 -0
  150. package/dist/credential/index.d.ts +2 -1
  151. package/dist/credential/index.js +6 -5
  152. package/dist/credential/source.d.ts +38 -26
  153. package/dist/credential/source.js +25 -34
  154. package/dist/extension-commands.d.ts +12 -6
  155. package/dist/extension-commands.js +16 -13
  156. package/dist/extensions/github/{world.d.ts → context.d.ts} +1 -1
  157. package/dist/extensions/github/context.js +3 -0
  158. package/dist/extensions/github/definition.d.ts +1 -1
  159. package/dist/extensions/github/definition.js +3 -3
  160. package/dist/extensions/github/extension.d.ts +1 -1
  161. package/dist/extensions/github/index.d.ts +2 -2
  162. package/dist/extensions/github/index.js +4 -4
  163. package/dist/extensions/github/lifecycle.d.ts +3 -3
  164. package/dist/extensions/github/lifecycle.js +14 -14
  165. package/dist/extensions/github/live/context.d.ts +6 -0
  166. package/dist/extensions/github/live/context.js +16 -0
  167. package/dist/extensions/github/resource.d.ts +1 -1
  168. package/dist/extensions/playwright/driver.d.ts +8 -0
  169. package/dist/extensions/playwright/driver.js +60 -0
  170. package/dist/extensions/playwright/extension.d.ts +2 -0
  171. package/dist/extensions/playwright/extension.js +12 -0
  172. package/dist/extensions/playwright/plan/gateways.d.ts +62 -0
  173. package/dist/extensions/playwright/plan/gateways.js +4 -0
  174. package/dist/extensions/playwright/plan/list-output.d.ts +26 -0
  175. package/dist/extensions/playwright/plan/list-output.js +101 -0
  176. package/dist/extensions/playwright/plan/live/list-gateway.d.ts +15 -0
  177. package/dist/extensions/playwright/plan/live/list-gateway.js +100 -0
  178. package/dist/extensions/playwright/plan/plan.d.ts +44 -0
  179. package/dist/extensions/playwright/plan/plan.js +53 -0
  180. package/dist/extensions/testserver/command-tree.d.ts +2 -2
  181. package/dist/extensions/testserver/command-tree.js +2 -3
  182. package/dist/extensions/testserver/commands/app.d.ts +7 -7
  183. package/dist/extensions/testserver/commands/pool/create/command.d.ts +5 -5
  184. package/dist/extensions/testserver/commands/pool/create/command.js +17 -12
  185. package/dist/extensions/testserver/commands/pool/list/command.js +8 -5
  186. package/dist/extensions/testserver/{world.d.ts → context.d.ts} +1 -1
  187. package/dist/extensions/testserver/context.js +4 -0
  188. package/dist/extensions/testserver/definition.d.ts +2 -2
  189. package/dist/extensions/testserver/definition.js +8 -7
  190. package/dist/extensions/testserver/events.d.ts +1 -1
  191. package/dist/extensions/testserver/extension.d.ts +4 -3
  192. package/dist/extensions/testserver/extension.js +33 -20
  193. package/dist/extensions/testserver/index.d.ts +2 -2
  194. package/dist/extensions/testserver/index.js +2 -2
  195. package/dist/extensions/testserver/lifecycle.d.ts +6 -5
  196. package/dist/extensions/testserver/lifecycle.js +9 -8
  197. package/dist/extensions/testserver/live/context.d.ts +8 -0
  198. package/dist/extensions/testserver/live/{world.js → context.js} +6 -7
  199. package/dist/extensions/testserver/options/rules.d.ts +3 -3
  200. package/dist/extensions/testserver/options/rules.js +5 -4
  201. package/dist/extensions/testserver/options/sandboxes.d.ts +3 -2
  202. package/dist/extensions/testserver/options/sandboxes.js +3 -2
  203. package/dist/extensions/testserver/playwright/index.d.ts +33 -0
  204. package/dist/extensions/testserver/playwright/index.js +43 -0
  205. package/dist/extensions/testserver/presentation.d.ts +4 -4
  206. package/dist/extensions/testserver/presentation.js +7 -7
  207. package/dist/extensions/testserver/progress.d.ts +3 -3
  208. package/dist/extensions/testserver/progress.js +3 -3
  209. package/dist/extensions/testserver/provision.d.ts +2 -2
  210. package/dist/extensions/testserver/provision.js +10 -10
  211. package/dist/extensions/testserver/resource.d.ts +2 -2
  212. package/dist/extensions/testserver/result.d.ts +2 -2
  213. package/dist/extensions/testserver/result.js +1 -1
  214. package/dist/extensions/testserver/run/connection.d.ts +1 -1
  215. package/dist/extensions/testserver/run/connection.js +3 -3
  216. package/dist/extensions/testserver/run/sandbox.d.ts +31 -0
  217. package/dist/extensions/testserver/run/sandbox.js +58 -0
  218. package/dist/extensions/testserver/run-sandbox.d.ts +2 -2
  219. package/dist/extensions/testserver/run-sandbox.js +3 -3
  220. package/dist/extensions/testserver/vercel-cli/arguments.d.ts +2 -2
  221. package/dist/extensions/testserver/vercel-cli/arguments.js +6 -6
  222. package/dist/extensions/testserver/vercel-cli/auth-config.d.ts +7 -7
  223. package/dist/extensions/testserver/vercel-cli/auth-config.js +4 -4
  224. package/dist/extensions/testserver/vercel-cli/clock.js +1 -1
  225. package/dist/extensions/testserver/vercel-cli/config-files.js +1 -1
  226. package/dist/extensions/testserver/vercel-cli/context.d.ts +1 -1
  227. package/dist/extensions/testserver/vercel-cli/context.js +2 -2
  228. package/dist/extensions/testserver/vercel-cli/entry.d.ts +1 -1
  229. package/dist/extensions/testserver/vercel-cli/entry.js +1 -1
  230. package/dist/extensions/testserver/vercel-cli/environment.d.ts +5 -5
  231. package/dist/extensions/testserver/vercel-cli/environment.js +6 -6
  232. package/dist/extensions/testserver/vercel-cli/gateways.d.ts +1 -1
  233. package/dist/extensions/testserver/vercel-cli/gateways.js +3 -3
  234. package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -1
  235. package/dist/extensions/testserver/vercel-cli/index.js +8 -9
  236. package/dist/extensions/testserver/vercel-cli/invocation.d.ts +13 -12
  237. package/dist/extensions/testserver/vercel-cli/invocation.js +1 -1
  238. package/dist/extensions/testserver/vercel-cli/{driver.d.ts → invoker.d.ts} +18 -17
  239. package/dist/extensions/testserver/vercel-cli/{driver.js → invoker.js} +8 -8
  240. package/dist/extensions/testserver/vercel-cli/live/config-files.d.ts +2 -2
  241. package/dist/extensions/testserver/vercel-cli/live/config-files.js +2 -2
  242. package/dist/extensions/testserver/vercel-cli/live/process-gateway.js +1 -1
  243. package/dist/extensions/testserver/vercel-cli/report.js +2 -2
  244. package/dist/extensions/testserver/vercel-cli/verbose.js +1 -1
  245. package/dist/extensions/testserver/vitest/config.d.ts +8 -6
  246. package/dist/extensions/testserver/vitest/config.js +10 -16
  247. package/dist/extensions/testserver/vitest/container-scope.d.ts +11 -11
  248. package/dist/extensions/testserver/vitest/container-scope.js +9 -9
  249. package/dist/extensions/testserver/vitest/container-start.d.ts +6 -6
  250. package/dist/extensions/testserver/vitest/container-start.js +14 -11
  251. package/dist/extensions/testserver/vitest/diagnostics.d.ts +1 -1
  252. package/dist/extensions/testserver/vitest/fixtures.d.ts +12 -10
  253. package/dist/extensions/testserver/vitest/fixtures.js +44 -22
  254. package/dist/extensions/testserver/vitest/index.d.ts +1 -1
  255. package/dist/extensions/testserver/vitest/index.js +4 -4
  256. package/dist/extensions/testserver/vitest/types.d.ts +16 -18
  257. package/dist/extensions/testserver/vitest/types.js +2 -2
  258. package/dist/extensions/testserver/vitest/worker-sandbox.d.ts +8 -0
  259. package/dist/extensions/testserver/vitest/worker-sandbox.js +17 -0
  260. package/dist/extensions/vitest/driver.d.ts +8 -0
  261. package/dist/extensions/vitest/driver.js +62 -0
  262. package/dist/extensions/vitest/extension.d.ts +2 -0
  263. package/dist/extensions/vitest/extension.js +8 -0
  264. package/dist/{vitest → extensions/vitest/plan}/gateways.d.ts +1 -26
  265. package/dist/extensions/vitest/plan/gateways.js +3 -0
  266. package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.d.ts +1 -2
  267. package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.js +1 -20
  268. package/dist/extensions/vitest/plan/plan-over.d.ts +38 -0
  269. package/dist/extensions/vitest/plan/plan-over.js +31 -0
  270. package/dist/extensions/vitest/plan/plan.d.ts +24 -0
  271. package/dist/{vitest → extensions/vitest/plan}/plan.js +11 -26
  272. package/dist/extensions.d.ts +43 -30
  273. package/dist/extensions.js +50 -35
  274. package/dist/forward-sigterm.d.ts +8 -0
  275. package/dist/forward-sigterm.js +18 -0
  276. package/dist/launcher-resolvers/index.d.ts +1 -0
  277. package/dist/launcher-resolvers/index.js +2 -1
  278. package/dist/launcher-resolvers/local-services.d.ts +22 -0
  279. package/dist/launcher-resolvers/local-services.js +6 -0
  280. package/dist/live-app.js +9 -7
  281. package/dist/local-services.d.ts +11 -0
  282. package/dist/local-services.js +16 -0
  283. package/dist/playwright/index.d.ts +1 -0
  284. package/dist/playwright/index.js +4 -0
  285. package/dist/playwright/reporter.d.ts +96 -0
  286. package/dist/playwright/reporter.js +162 -0
  287. package/dist/playwright/worker-index.d.ts +7 -0
  288. package/dist/playwright/worker-index.js +20 -0
  289. package/dist/run-directory/gateways.d.ts +167 -0
  290. package/dist/run-directory/gateways.js +2 -0
  291. package/dist/run-directory/index.d.ts +8 -0
  292. package/dist/run-directory/index.js +13 -0
  293. package/dist/run-directory/plan.d.ts +35 -0
  294. package/dist/run-directory/plan.js +24 -0
  295. package/dist/run-directory/reader.d.ts +70 -0
  296. package/dist/run-directory/reader.js +51 -0
  297. package/dist/run-directory/recording.d.ts +95 -0
  298. package/dist/run-directory/recording.js +85 -0
  299. package/dist/{commands/exec → run-directory}/run-collector.d.ts +9 -8
  300. package/dist/{commands/exec → run-directory}/run-collector.js +8 -10
  301. package/dist/{core → run-directory}/run-directory.d.ts +3 -3
  302. package/dist/{core → run-directory}/run-directory.js +2 -2
  303. package/dist/{commands/exec → run-directory}/run-record.d.ts +94 -27
  304. package/dist/run-directory/run-record.js +229 -0
  305. package/dist/{commands/exec → run-directory}/timeline-facts.d.ts +5 -8
  306. package/dist/{commands/exec → run-directory}/timeline-facts.js +11 -25
  307. package/dist/runner/build-snapshots.d.ts +179 -0
  308. package/dist/runner/build-snapshots.js +235 -0
  309. package/dist/runner/context.js +2 -1
  310. package/dist/runner/events.d.ts +73 -33
  311. package/dist/runner/gateways.d.ts +30 -10
  312. package/dist/runner/index.d.ts +15 -17
  313. package/dist/runner/index.js +12 -14
  314. package/dist/runner/live/checkout-gateway.js +15 -7
  315. package/dist/runner/live/snapshot-records.js +8 -7
  316. package/dist/runner/prepare.d.ts +26 -26
  317. package/dist/runner/prepare.js +27 -14
  318. package/dist/runner/ready.d.ts +43 -10
  319. package/dist/runner/ready.js +51 -34
  320. package/dist/runner/recipe.d.ts +48 -4
  321. package/dist/runner/recipe.js +42 -1
  322. package/dist/runner/scope.d.ts +13 -13
  323. package/dist/runner/scope.js +9 -11
  324. package/dist/runner/secrets.d.ts +6 -0
  325. package/dist/runner/secrets.js +10 -0
  326. package/dist/runner/session.d.ts +128 -0
  327. package/dist/runner/session.js +138 -0
  328. package/dist/runner/snapshot-build.d.ts +21 -11
  329. package/dist/runner/snapshot-build.js +11 -16
  330. package/dist/runner/snapshot-cache.d.ts +140 -62
  331. package/dist/runner/snapshot-cache.js +145 -102
  332. package/dist/runner/snapshot-inspect.d.ts +89 -0
  333. package/dist/runner/snapshot-inspect.js +173 -0
  334. package/dist/runner/snapshot-key.d.ts +5 -2
  335. package/dist/runner/snapshot-key.js +1 -1
  336. package/dist/runner/snapshot-save.d.ts +35 -20
  337. package/dist/runner/snapshot-save.js +47 -37
  338. package/dist/runner/snapshot-start.d.ts +25 -0
  339. package/dist/runner/snapshot-start.js +16 -0
  340. package/dist/sdk/extension/ci.d.ts +2 -0
  341. package/dist/sdk/extension/ci.js +6 -0
  342. package/dist/sdk/extension/commands.d.ts +44 -28
  343. package/dist/sdk/extension/commands.js +15 -13
  344. package/dist/sdk/extension/driver.d.ts +143 -0
  345. package/dist/sdk/extension/driver.js +28 -0
  346. package/dist/sdk/extension/index.d.ts +3 -1
  347. package/dist/sdk/extension/index.js +16 -9
  348. package/dist/sdk/extension/{launcher-supplies.d.ts → launcher-context.d.ts} +3 -3
  349. package/dist/sdk/extension/launcher-context.js +5 -0
  350. package/dist/sdk/extension/lifecycle.d.ts +10 -8
  351. package/dist/sdk/extension/lifecycle.js +2 -2
  352. package/dist/sdk/extension/progress.js +2 -2
  353. package/dist/sdk/extension/resource-definition.d.ts +13 -13
  354. package/dist/sdk/extension/resource-definition.js +2 -2
  355. package/dist/sdk/extension/resource.d.ts +13 -13
  356. package/dist/sdk/extension/resource.js +11 -11
  357. package/dist/sdk/extension/time.js +2 -2
  358. package/dist/sdk/index.d.ts +2 -0
  359. package/dist/sdk/index.js +3 -1
  360. package/dist/sdk/run/launcher.d.ts +1 -1
  361. package/dist/sdk/run/launcher.js +4 -3
  362. package/dist/sdk/run/payload.js +1 -1
  363. package/dist/sdk/run/test-events.d.ts +24 -18
  364. package/dist/sdk/run/test-events.js +5 -4
  365. package/dist/sdk/run/test-result-writer.d.ts +77 -0
  366. package/dist/sdk/run/test-result-writer.js +143 -0
  367. package/dist/sdk/run/worker-test-event-writer.d.ts +13 -0
  368. package/dist/sdk/run/worker-test-event-writer.js +31 -0
  369. package/dist/vendor/testserver-sdk/container/container.d.ts +12 -12
  370. package/dist/vendor/testserver-sdk/container/container.js +39 -21
  371. package/dist/vendor/testserver-sdk/factories/build.d.ts +12 -40
  372. package/dist/vendor/testserver-sdk/factories/build.js +15 -66
  373. package/dist/vendor/testserver-sdk/factories/gateways.d.ts +1 -2
  374. package/dist/vendor/testserver-sdk/factories/index.d.ts +1 -3
  375. package/dist/vendor/testserver-sdk/factories/index.js +3 -5
  376. package/dist/vendor/testserver-sdk/index.d.ts +1 -2
  377. package/dist/vendor/testserver-sdk/index.js +5 -6
  378. package/dist/vendor/testserver-sdk/records/body.d.ts +1 -1
  379. package/dist/vendor/testserver-sdk/records/body.js +1 -1
  380. package/dist/vendor/testserver-sdk/testserver/failure.d.ts +4 -3
  381. package/dist/vendor/testserver-sdk/testserver/failure.js +4 -3
  382. package/dist/vitest/index.d.ts +2 -1
  383. package/dist/vitest/index.js +6 -4
  384. package/dist/vitest/test-events.d.ts +6 -16
  385. package/dist/vitest/test-events.js +15 -40
  386. package/dist/vitest/test-results.d.ts +9 -31
  387. package/dist/vitest/test-results.js +34 -105
  388. package/dist/vitest/worker-index.d.ts +6 -0
  389. package/dist/vitest/worker-index.js +17 -0
  390. package/package.json +23 -9
  391. package/skills/overview.md +6 -5
  392. package/skills/read-run-output.md +22 -7
  393. package/dist/chunks/chunk-AGWW3HDT.js +0 -2559
  394. package/dist/chunks/chunk-H2VCSNVU.js +0 -351
  395. package/dist/commands/exec/run-record.js +0 -135
  396. package/dist/commands/vitest/outcomes.d.ts +0 -379
  397. package/dist/commands/vitest/outcomes.js +0 -70
  398. package/dist/core/launcher-supplies.d.ts +0 -11
  399. package/dist/core/launcher-supplies.js +0 -28
  400. package/dist/core/mint.d.ts +0 -10
  401. package/dist/core/mint.js +0 -14
  402. package/dist/core/resource-registry.d.ts +0 -54
  403. package/dist/core/resource-registry.js +0 -57
  404. package/dist/extensions/github/live/world.d.ts +0 -6
  405. package/dist/extensions/github/live/world.js +0 -16
  406. package/dist/extensions/github/world.js +0 -3
  407. package/dist/extensions/testserver/live/world.d.ts +0 -8
  408. package/dist/extensions/testserver/vitest/sandbox.d.ts +0 -25
  409. package/dist/extensions/testserver/vitest/sandbox.js +0 -43
  410. package/dist/extensions/testserver/world.js +0 -4
  411. package/dist/sdk/extension/launcher-supplies.js +0 -3
  412. package/dist/story/align.d.ts +0 -37
  413. package/dist/story/align.js +0 -39
  414. package/dist/story/command-line.d.ts +0 -34
  415. package/dist/story/command-line.js +0 -100
  416. package/dist/story/definition.d.ts +0 -59
  417. package/dist/story/definition.js +0 -9
  418. package/dist/story/diff.d.ts +0 -9
  419. package/dist/story/diff.js +0 -97
  420. package/dist/story/errors.d.ts +0 -14
  421. package/dist/story/errors.js +0 -21
  422. package/dist/story/gateways.d.ts +0 -94
  423. package/dist/story/gateways.js +0 -3
  424. package/dist/story/host.d.ts +0 -30
  425. package/dist/story/host.js +0 -97
  426. package/dist/story/index.d.ts +0 -8
  427. package/dist/story/index.js +0 -10
  428. package/dist/story/json.d.ts +0 -16
  429. package/dist/story/json.js +0 -59
  430. package/dist/story/live/recording-gateway.d.ts +0 -2
  431. package/dist/story/live/recording-gateway.js +0 -103
  432. package/dist/story/mode.d.ts +0 -17
  433. package/dist/story/mode.js +0 -21
  434. package/dist/story/orphans.d.ts +0 -35
  435. package/dist/story/orphans.js +0 -51
  436. package/dist/story/recording.d.ts +0 -62
  437. package/dist/story/recording.js +0 -97
  438. package/dist/story/report.d.ts +0 -42
  439. package/dist/story/report.js +0 -130
  440. package/dist/story/sequence.d.ts +0 -30
  441. package/dist/story/sequence.js +0 -74
  442. package/dist/story/settle.d.ts +0 -96
  443. package/dist/story/settle.js +0 -71
  444. package/dist/story/start.d.ts +0 -50
  445. package/dist/story/start.js +0 -183
  446. package/dist/vendor/testserver-sdk/factories/definition.d.ts +0 -39
  447. package/dist/vendor/testserver-sdk/factories/definition.js +0 -16
  448. package/dist/vendor/testserver-sdk/factories/definitions.d.ts +0 -169
  449. package/dist/vendor/testserver-sdk/factories/definitions.js +0 -245
  450. package/dist/vendor/testserver-sdk/seed/index.d.ts +0 -1
  451. package/dist/vendor/testserver-sdk/seed/index.js +0 -3
  452. package/dist/vendor/testserver-sdk/seed/seed.d.ts +0 -221
  453. package/dist/vendor/testserver-sdk/seed/seed.js +0 -171
  454. package/dist/vitest/find-vitest.d.ts +0 -7
  455. package/dist/vitest/find-vitest.js +0 -28
  456. package/dist/vitest/gateways.js +0 -4
  457. package/dist/vitest/plan.d.ts +0 -51
  458. /package/dist/{vitest → extensions/vitest/plan}/list-output.d.ts +0 -0
  459. /package/dist/{vitest → extensions/vitest/plan}/list-output.js +0 -0
  460. /package/dist/{core → run-directory}/live/run-directory-gateway.d.ts +0 -0
  461. /package/dist/{core → run-directory}/live/run-directory-gateway.js +0 -0
@@ -0,0 +1,235 @@
1
+ // `storm snapshots build`: building what the runner snapshot cache lacks for a checkout, with no run. It owns its
2
+ // sandbox scope from its first stage to its end, as a run's runner session does, and reuses a run's stages: the choice
3
+ // of what to start from, obtaining it, readying the runner sandbox, and the dev snapshot save. It acquires no
4
+ // resource, runs no command, and keeps no sandbox.
5
+ import { prepareRunner } from "./prepare.js";
6
+ import { obtainSnapshot, readyRunner } from "./ready.js";
7
+ import { runnerSandboxScope } from "./scope.js";
8
+ import { buildSnapshot } from "./snapshot-build.js";
9
+ import { dropDevSnapshotsOn, hasTimeLeft, isDevEntry } from "./snapshot-cache.js";
10
+ import { snapshotStepsAt } from "./snapshot-key.js";
11
+ import { saveDevSnapshot } from "./snapshot-save.js";
12
+ import { chooseSnapshotStart } from "./snapshot-start.js";
13
+ /**
14
+ * Runs a build's local checks, before anything is minted or started. For this checkout, they are a run's
15
+ * (`prepareRunner`), reading dev snapshot candidates as the recipe allows. For `--base`, they are the repository's
16
+ * root, HEAD, the submodule refusal, the commit the ref resolves to locally, its snapshot steps and key, the cache's
17
+ * base snapshots of it, and the warnings. It never mints, acquires or creates.
18
+ */
19
+ export async function prepareSnapshotBuild(context, request) {
20
+ const { recipe, mode } = request;
21
+ if (mode.kind === "checkout") {
22
+ const prepared = await prepareRunner(context, {
23
+ cwd: request.cwd,
24
+ recipe,
25
+ vcpusRun: request.vcpusRun,
26
+ reuseDevSnapshots: recipe.reuseDevSnapshot,
27
+ });
28
+ if (prepared.kind !== "ok")
29
+ return prepared;
30
+ return { kind: "ok", build: { kind: "checkout", prepared: prepared.prepared, full: mode.full } };
31
+ }
32
+ const { checkout } = context;
33
+ const root = await checkout.repositoryRoot({ cwd: request.cwd });
34
+ if (!root.ok)
35
+ return { kind: "checkout-failed", failure: root.failure };
36
+ const repoRoot = root.value;
37
+ const head = await checkout.head({ repoRoot });
38
+ if (!head.ok)
39
+ return { kind: "checkout-failed", failure: head.failure };
40
+ const submodules = await checkout.submodules({ repoRoot });
41
+ if (!submodules.ok)
42
+ return { kind: "checkout-failed", failure: submodules.failure };
43
+ if (submodules.value.length > 0)
44
+ return { kind: "submodules", paths: [...submodules.value] };
45
+ const resolved = await checkout.resolveCommit({ repoRoot, ref: mode.ref });
46
+ if (!resolved.ok)
47
+ return { kind: "checkout-failed", failure: resolved.failure };
48
+ if (resolved.value === null)
49
+ return { kind: "ref-not-found", ref: mode.ref };
50
+ const base = resolved.value;
51
+ const steps = await snapshotStepsAt(checkout, { repoRoot, base, recipe });
52
+ if (!steps.ok)
53
+ return { kind: "invalid-recipe", path: steps.path, problem: steps.problem };
54
+ // An unreadable cache holds nothing to reuse: the build goes on, and builds.
55
+ const listed = await context.runnerSnapshots.listEntries();
56
+ const now = context.clock.now();
57
+ const cached = (listed.ok ? listed.value.entries : []).filter((entry) => !isDevEntry(entry) &&
58
+ entry.base === base &&
59
+ entry.recipeName === recipe.name &&
60
+ entry.region === recipe.region &&
61
+ entry.runtime === recipe.runtime &&
62
+ entry.snapshotKey === steps.key &&
63
+ hasTimeLeft(entry, now));
64
+ const warnings = [];
65
+ if (head.value.dirty)
66
+ warnings.push({ kind: "uncommitted" });
67
+ let onBaseRef = false;
68
+ for (const ref of recipe.baseRefs) {
69
+ const contained = await checkout.contains({ repoRoot, ancestor: base, descendant: ref });
70
+ if (contained.ok && contained.value)
71
+ onBaseRef = true;
72
+ }
73
+ if (!onBaseRef)
74
+ warnings.push({ kind: "not-on-base-ref", refs: recipe.baseRefs });
75
+ const inHistory = await checkout.contains({ repoRoot, ancestor: base, descendant: "HEAD" });
76
+ const afterBase = inHistory.ok && inHistory.value ? await checkout.commitCount({ repoRoot, from: base, to: "HEAD" }) : undefined;
77
+ return {
78
+ kind: "ok",
79
+ build: {
80
+ kind: "base",
81
+ plan: {
82
+ recipe,
83
+ repoRoot,
84
+ base,
85
+ toolchains: steps.toolchains,
86
+ prebuild: steps.prebuild,
87
+ snapshotKey: steps.key,
88
+ commitsAfterBase: afterBase?.ok === true ? afterBase.value : null,
89
+ },
90
+ ref: mode.ref,
91
+ head: head.value,
92
+ cached,
93
+ full: mode.full,
94
+ warnings,
95
+ },
96
+ };
97
+ }
98
+ /** A build that stopped on the signal before it saved anything. */
99
+ const ABORTED_EARLY = { kind: "aborted", baseSnapshot: null, dropped: null };
100
+ /**
101
+ * Builds what a checked build needs, reporting to `progress`, and closes every sandbox it started however it ends,
102
+ * keeping none. `signal` stops it in any stage: it says so, then closes the scope at once.
103
+ *
104
+ * For this checkout, it chooses what to start from by the one rule a run uses (`chooseSnapshotStart`), or, under
105
+ * `full`, builds a base snapshot whatever the cache holds. When it reuses a dev snapshot built at HEAD's commit with a clean working tree, or, for a build that
106
+ * saves no dev snapshot, any snapshot, it is up to date. Otherwise it obtains the start (`obtainSnapshot`), building a
107
+ * base snapshot at the merge-base when it chose to; under `full`, once the cache holds the new base snapshot's entry,
108
+ * it then drops the dev snapshots built on the base snapshot it replaced (`dropDevSnapshotsOn`), before any runner
109
+ * sandbox starts. A build that saves no dev snapshot ends there. Otherwise it readies a runner sandbox on the start
110
+ * (`readyRunner`) and saves it as a dev snapshot at HEAD's commit (`saveDevSnapshot`). For `--base`: a cached base
111
+ * snapshot of the commit for the access's team and project is up to date, unless `full`; otherwise it builds one, and
112
+ * under `full`, once its entry is cached, drops the dev snapshots built on the one it replaced. A base snapshot's save
113
+ * isn't stopped by the signal, so after it the build checks the signal once, after any drop, and ends `aborted` with
114
+ * what it saved.
115
+ */
116
+ export async function buildSnapshots(context, request, control, progress) {
117
+ const { signal } = control;
118
+ const scope = runnerSandboxScope(context, progress, { keepMs: () => 0 });
119
+ const stop = () => {
120
+ void progress.emit({ kind: "stopping", commandRunning: false, keepMs: 0 }).catch(() => undefined);
121
+ void scope.close().catch(() => undefined);
122
+ };
123
+ if (signal.aborted)
124
+ stop();
125
+ else
126
+ signal.addEventListener("abort", stop, { once: true });
127
+ try {
128
+ const ended = await buildIn(context, request, { scope, signal }, progress);
129
+ signal.removeEventListener("abort", stop);
130
+ return { ...ended, cleanup: await scope.close() };
131
+ }
132
+ catch (error) {
133
+ signal.removeEventListener("abort", stop);
134
+ await scope.close();
135
+ throw error;
136
+ }
137
+ }
138
+ async function buildIn(context, request, control, progress) {
139
+ const { build, access, user, secrets } = request;
140
+ const { signal } = control;
141
+ if (signal.aborted)
142
+ return ABORTED_EARLY;
143
+ if (build.kind === "base") {
144
+ const cached = build.cached.find((entry) => entry.teamId === access.teamId && entry.projectId === access.projectId);
145
+ if (!build.full && cached !== undefined)
146
+ return { kind: "up-to-date", snapshot: cached };
147
+ const built = await buildSnapshot(context, { prepared: build.plan, access, user, secrets, why: { kind: build.full ? "full" : "base" } }, control, progress);
148
+ if (built.kind === "aborted")
149
+ return ABORTED_EARLY;
150
+ if (built.kind !== "ok")
151
+ return built;
152
+ const { entry, cacheFailure } = built.value;
153
+ const dropped = build.full && cacheFailure === null ? await dropOn(context, entry, progress) : null;
154
+ if (signal.aborted)
155
+ return { kind: "aborted", baseSnapshot: savedBaseOf(built.value), dropped };
156
+ return baseOnlyEnd(built.value, dropped);
157
+ }
158
+ const { prepared } = build;
159
+ const start = build.full
160
+ ? { kind: "build", why: { kind: "full" } }
161
+ : chooseSnapshotStart(prepared, access);
162
+ if (start.kind === "reuse") {
163
+ const { entry } = start.candidate;
164
+ if (isDevEntry(entry) && entry.head === prepared.head.commit && !prepared.head.dirty)
165
+ return { kind: "up-to-date", snapshot: entry };
166
+ // A build that saves no dev snapshot needs only a snapshot that fits.
167
+ if (prepared.devSnapshots !== "reuse")
168
+ return { kind: "up-to-date", snapshot: entry };
169
+ }
170
+ const obtained = await obtainSnapshot(context, { prepared, access, user, secrets, start }, control, progress);
171
+ if (obtained.kind === "aborted")
172
+ return ABORTED_EARLY;
173
+ if (obtained.kind !== "ok")
174
+ return obtained;
175
+ const { built } = obtained.value;
176
+ // The base snapshot this build built, if any. Only a cached one replaces the old one.
177
+ const baseSnapshot = built === null ? null : savedBaseOf(built);
178
+ const dropped = build.full && baseSnapshot?.cached === true ? await dropOn(context, baseSnapshot.entry, progress) : null;
179
+ const aborted = { kind: "aborted", baseSnapshot, dropped };
180
+ if (signal.aborted)
181
+ return aborted;
182
+ if (prepared.devSnapshots !== "reuse")
183
+ // A build that reuses a snapshot here returned above, but this branch doesn't count on it.
184
+ return built === null ? { kind: "up-to-date", snapshot: obtained.value.entry } : baseOnlyEnd(built, dropped);
185
+ const ready = await readyRunner(context, { prepared, access, user, secrets, start: obtained.value }, control, progress);
186
+ if (ready.kind === "aborted")
187
+ return aborted;
188
+ if (ready.kind !== "ready")
189
+ return ready;
190
+ const { runner } = ready;
191
+ const saved = await saveDevSnapshot(context, { ready: runner, branch: prepared.head.branch, head: prepared.head.commit }, control, progress);
192
+ if (saved.entry === null) {
193
+ const { save } = saved;
194
+ // Only a signal stops a save: its handler is what closes the scope.
195
+ return save.kind === "stopped"
196
+ ? aborted
197
+ : { kind: "dev-snapshot-not-saved", step: save.step, message: save.message, baseSnapshot };
198
+ }
199
+ const { entry, cacheFailure, save } = saved;
200
+ if (cacheFailure !== null)
201
+ return { kind: "not-cached", snapshot: entry, failure: cacheFailure, baseSnapshot, dropped };
202
+ return {
203
+ kind: "built",
204
+ baseSnapshot,
205
+ startedFrom: runner.startedFrom,
206
+ devSnapshot: { entry, ms: save.ms, sizeBytes: save.sizeBytes },
207
+ dropped,
208
+ };
209
+ }
210
+ /** A base snapshot this build built, and whether the cache wrote its entry. */
211
+ function savedBaseOf(built) {
212
+ return { entry: built.entry, cached: built.cacheFailure === null };
213
+ }
214
+ /**
215
+ * How a build that saves no dev snapshot ends once it built base snapshot `built`: `built` when the cache wrote its
216
+ * entry, else `not-cached`, since no run finds it. It takes the base snapshot it built, never one it reused.
217
+ */
218
+ function baseOnlyEnd(built, dropped) {
219
+ const baseSnapshot = savedBaseOf(built);
220
+ return built.cacheFailure === null
221
+ ? { kind: "built", baseSnapshot, startedFrom: null, devSnapshot: null, dropped }
222
+ : { kind: "not-cached", snapshot: built.entry, failure: built.cacheFailure, baseSnapshot, dropped };
223
+ }
224
+ /**
225
+ * Drops the dev snapshots built on the base snapshot `built` replaced, the cache entry of the same identity, and
226
+ * reports what it dropped and what it couldn't.
227
+ */
228
+ async function dropOn(context, built, progress) {
229
+ const dropped = await dropDevSnapshotsOn(context, built);
230
+ if (dropped.snapshotIds.length > 0)
231
+ await progress.emit({ kind: "dev-snapshots-dropped", snapshotIds: dropped.snapshotIds });
232
+ for (const { message } of dropped.failures)
233
+ await progress.emit({ kind: "dev-snapshots-not-dropped", message });
234
+ return dropped;
235
+ }
@@ -1,4 +1,5 @@
1
- // What the runner's sandbox side reaches the world through, and the tags every sandbox it creates carries.
1
+ // What the runner reaches the world through as it readies and uses a runner sandbox, and the tags every sandbox it
2
+ // creates carries.
2
3
  /** The `purpose` tag of a recipe's sandboxes. */
3
4
  export function runnerPurpose(recipeName) {
4
5
  return `storm-runner-${recipeName}`;
@@ -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,35 @@ 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`, 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.
53
+ * - `snapshot-build-started`: a base snapshot of `base` is being built, and `why` (`SnapshotBuildReason`); `summary`
54
+ * says what the build does.
39
55
  * - `runner-sandbox-starting`: the runner sandbox is starting from runner snapshot `snapshotId`.
40
56
  * - `sandbox-started`: a runner or build sandbox started, in `ms`.
41
57
  * - `output-started` and `output-ended`: where a section's streamed output starts and ends, for a rule line.
42
58
  * - `step-started`, `step-output` (one line, without its newline) and `step-finished`: a step's progress.
43
59
  * - `snapshot-saving`: the build sandbox is being saved as a runner snapshot.
44
- * - `snapshot-built`: it was, in `ms` from the build's start.
60
+ * - `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.
45
62
  * - `snapshot-entry-not-written`: the cache couldn't record the new snapshot; the run goes on.
46
63
  * - `uploading`: the run's changes are being uploaded to the runner sandbox.
47
64
  * - `uploaded`: the run's changes, `bytes` in all, reached the runner sandbox.
@@ -53,12 +70,14 @@ export interface NotKeptSandbox {
53
70
  * and releasing the run's resources.
54
71
  * - `waiting-for-snapshot`: closing waits up to `settleMs` for a runner snapshot still saving.
55
72
  * - `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 (`--save-snapshot`).
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.
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.
62
81
  */
63
82
  export type RunnerEvent = {
64
83
  readonly kind: "snapshot-reused";
@@ -66,10 +85,11 @@ export type RunnerEvent = {
66
85
  readonly base: string;
67
86
  readonly branch: string | null;
68
87
  readonly head: string | null;
88
+ readonly snapshot: StartedFromSnapshot;
69
89
  } | {
70
90
  readonly kind: "snapshot-build-started";
71
91
  readonly base: string;
72
- readonly reason: "no-snapshot" | "rebuild";
92
+ readonly why: SnapshotBuildReason;
73
93
  readonly summary: string;
74
94
  } | {
75
95
  readonly kind: "runner-sandbox-starting";
@@ -112,6 +132,7 @@ export type RunnerEvent = {
112
132
  readonly base: string;
113
133
  readonly ms: number;
114
134
  readonly sizeBytes: number;
135
+ readonly builtBehind: number | null;
115
136
  } | {
116
137
  readonly kind: "snapshot-entry-not-written";
117
138
  readonly failure: RunnerSnapshotCacheFailure;
@@ -140,28 +161,29 @@ export type RunnerEvent = {
140
161
  readonly name: string;
141
162
  readonly stopsAt: string;
142
163
  } | {
143
- readonly kind: "branch-snapshot-saving";
144
- readonly branch: string;
164
+ readonly kind: "dev-snapshot-saving";
165
+ readonly branch: string | null;
145
166
  } | {
146
- readonly kind: "branch-snapshot-saved";
167
+ readonly kind: "dev-snapshot-saved";
147
168
  readonly snapshotId: string;
148
- readonly branch: string;
169
+ readonly branch: string | null;
149
170
  readonly head: string;
150
171
  readonly ms: number;
151
172
  readonly sizeBytes: number;
152
173
  } | {
153
- readonly kind: "branch-snapshot-not-saved";
174
+ readonly kind: "dev-snapshot-not-saved";
154
175
  readonly save: Exclude<RunnerSave, {
155
- readonly kind: "saved" | "skipped";
176
+ readonly kind: "saved";
156
177
  }>;
157
178
  } | {
158
- readonly kind: "branch-snapshots-dropped";
159
- readonly branch: string;
179
+ readonly kind: "dev-snapshot-skipped";
180
+ readonly reason: RunnerNoSaveReason;
181
+ } | {
182
+ readonly kind: "dev-snapshots-dropped";
160
183
  readonly snapshotIds: readonly string[];
161
184
  } | {
162
- readonly kind: "branch-snapshots-not-dropped";
163
- readonly branch: string;
164
- readonly failure: RunnerSnapshotCacheFailure;
185
+ readonly kind: "dev-snapshots-not-dropped";
186
+ readonly message: string;
165
187
  };
166
188
  /** Hears the runner's events as they happen. */
167
189
  export interface RunnerProgress {
@@ -192,29 +214,47 @@ export type RunnerFailure = {
192
214
  readonly failure: CheckoutFailure;
193
215
  };
194
216
  /**
195
- * How saving the runner sandbox as a branch snapshot ended (`--save-snapshot`).
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.
196
240
  *
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`: HEAD was detached as the run started, so there is no branch to save it for (`prepareRunner`); the run
200
- * keeps its runner sandbox as without the flag.
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.
201
243
  * - `failed`: the scrub or the save failed with `message`.
202
244
  * - `stopped`: a signal stopped it before it saved, or before the cache recorded the snapshot.
203
245
  *
204
- * A run on a branch never keeps its runner sandbox, whether the save ran or how it ended (`RunnerSandboxPlan`).
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`).
205
248
  */
206
249
  export type RunnerSave = {
207
250
  readonly kind: "saved";
208
251
  readonly snapshotId: string;
209
252
  readonly base: string;
210
- readonly branch: string;
253
+ readonly branch: string | null;
211
254
  readonly head: string;
212
255
  readonly ms: number;
213
256
  readonly sizeBytes: number;
214
257
  readonly entryWritten: boolean;
215
- } | {
216
- readonly kind: "skipped";
217
- readonly reason: "detached-head";
218
258
  } | {
219
259
  readonly kind: "failed";
220
260
  readonly step: "scrub" | "save-snapshot";
@@ -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,9 @@ 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. 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.
127
140
  */
128
141
  export interface RunnerSnapshotEntry {
129
142
  readonly teamId: string;
@@ -135,13 +148,19 @@ export interface RunnerSnapshotEntry {
135
148
  readonly snapshotKey: string;
136
149
  /** The base commit's full SHA, whose tracked files the snapshot's repository commits first, in either kind. */
137
150
  readonly base: string;
138
- /** For a branch snapshot, the local branch of the run that saved it. */
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
+ */
139
155
  readonly branch?: string;
140
- /** For a branch snapshot, the full SHA of the HEAD commit of the run that saved it. */
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
+ */
141
160
  readonly head?: string;
142
161
  /**
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.
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.
145
164
  */
146
165
  readonly repoRoot?: string;
147
166
  readonly snapshotId: string;
@@ -180,7 +199,8 @@ export type RunnerSnapshotCacheOperation = {
180
199
  };
181
200
  /**
182
201
  * 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).
202
+ * project, region, runtime, recipe name, snapshot key, and a base snapshot's base or a dev snapshot's checkout root
203
+ * and commit).
184
204
  * Every method returns its expected failures and never rejects. Which entries a run may use, and when one has
185
205
  * expired, is the caller's.
186
206
  */
@@ -1,21 +1,19 @@
1
- export { type BaseResolution, type RefusedBaseRef, resolveBase } from "./base.ts";
2
1
  export type { RunnerContext } from "./context.ts";
3
- export { type KeptSandbox, type NotDeletedSandbox, type NotKeptSandbox, type NotStoppedSandbox, type RunnerEvent, type RunnerFailure, type RunnerOutputSection, type RunnerProgress, type RunnerSandboxCall, type RunnerSave, type RunnerStage, type RunnerStepPhase, } from "./events.ts";
4
- export type { BaseArchive, BaseCandidate, CheckoutFailure, CheckoutHead, CheckoutGateway, CheckoutResult, CheckoutUpload, FileAtCommit, SandboxExit, SandboxOutputChunk, RunnerKeepFailure, RunnerSandbox, RunnerSandboxFailure, RunnerSandboxGateway, RunnerSandboxOperation, RunnerSandboxPlacement, RunnerSandboxResult, RunnerSandboxRole, RunnerSnapshotCacheFailure, RunnerSnapshotCacheGateway, RunnerSnapshotCacheOperation, RunnerSnapshotCacheResult, RunnerSnapshotEntry, RunnerSnapshotListing, RunnerStartFailure, RunnerTerminal, SandboxAccess, SavedSnapshot, StagedFile, UnreadableSnapshotEntry, } from "./gateways.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";
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";
7
- export { liveRunnerTerminal, type TerminalStream } from "./live/terminal.ts";
7
+ export { liveRunnerTerminal } from "./live/terminal.ts";
8
8
  export { localUserName } from "./live/user.ts";
9
- export { liveRunnerSnapshotCacheGateway, type LiveRunnerSnapshotCacheOptions, unavailableRunnerSnapshotCacheGateway, } from "./live/snapshot-cache-gateway.ts";
10
- export { lineSplitter, type LineSplitter, OUTPUT_TAIL_LINES, outputRule, outputTail, type OutputTail, rewritePaths, splitLines, } from "./output.ts";
11
- export { type PreparedRunner, prepareRunner, type PrepareRunnerOutcome, type PrepareRunnerRequest, type RunnerPrepareContext, } from "./prepare.ts";
12
- export { APPLY_LABEL, type ReadyRunner, readyRunner, type ReadyRunnerOutcome, type ReadyRunnerRequest, } from "./ready.ts";
13
- export { type CheckedRecipe, checkRecipe, type RecipeCheck, type RecipeProblem, resolveSteps, resolveVcpus, type RunnerRecipe, type ResolvedRunnerStep, type RunnerStep, type RunnerStepContext, type RunnerSteps, type VcpusRun, } from "./recipe.ts";
14
- export { SANDBOX_TEST_EVENTS_PATH, type SandboxedCommandOutcome, sandboxedCommand, sandboxEnvironment, type SandboxTestEvents, runCommandInSandbox, } from "./sandboxed-command.ts";
15
- export { readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH, stepSecrets, type RunnerSecretProblem, type RunnerSecrets, type RunnerSecretsRead, } from "./secrets.ts";
16
- export { CREATE_SETTLE_MS, keptMs, type RunnerSandboxPlan, type RunnerSandboxScope, runnerSandboxScope, type RunnerScopeFacts, SNAPSHOT_SETTLE_MS, } from "./scope.ts";
17
- export { BASE_INDEX_LABEL, buildSnapshot, type BuildSnapshotRequest, type BuiltSnapshot } from "./snapshot-build.ts";
18
- export { dropBranchSnapshots, type DroppedBranchSnapshots, findSnapshotCandidates, isBranchEntry, pickSnapshot, RUNNER_SNAPSHOTS_SUBPATH, type RunnerSnapshotCandidate, SNAPSHOT_EXPIRATION_MS, type SnapshotCacheContext, type SnapshotCacheNote, snapshotEntryFileName, snapshotEntryIdentity, } from "./snapshot-cache.ts";
19
- export { applyScript, baseIndexScript, RESET_TO_BASE, snapshotKey, type SnapshotStepsAt, snapshotStepsAt, } from "./snapshot-key.ts";
20
- export { saveBranchSnapshot, type SaveBranchSnapshotRequest, scrubGitScript, scrubTempScript, TEMP_DIRECTORIES, } from "./snapshot-save.ts";
21
- export { STEP_ENV, type StepOutcome } from "./steps.ts";
9
+ export { liveRunnerSnapshotCacheGateway, unavailableRunnerSnapshotCacheGateway, } from "./live/snapshot-cache-gateway.ts";
10
+ export { lineSplitter } from "./output.ts";
11
+ export { prepareRunner, type PrepareRunnerOutcome } from "./prepare.ts";
12
+ export type { ReadyRunnerOutcome } from "./ready.ts";
13
+ export { type CheckedRecipe, checkRecipe, type DevSnapshotReuse, devSnapshotsTrusted, runStepTakesSecret, } from "./recipe.ts";
14
+ export { SANDBOX_TEST_EVENTS_PATH } from "./sandboxed-command.ts";
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";
18
+ 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";
@@ -1,20 +1,18 @@
1
- // The `runner` module's public surface: running a command in a runner sandbox. Other modules import only from here.
2
- export { resolveBase } from "./base.js";
1
+ // The `runner` module's public surface: running a command in a runner sandbox, through a run's runner session. Other
2
+ // modules import only from here, and it holds only what another module under `src/` imports; the runner's own tests
3
+ // import the files that declare the rest (`README.md`).
4
+ export { buildSnapshots, prepareSnapshotBuild, } from "./build-snapshots.js";
3
5
  export {} from "./events.js";
4
6
  export { liveCheckoutGateway } from "./live/checkout-gateway.js";
5
7
  export { liveRunnerSandboxGateway } from "./live/sandbox-gateway.js";
6
8
  export { liveRunnerTerminal } from "./live/terminal.js";
7
9
  export { localUserName } from "./live/user.js";
8
10
  export { liveRunnerSnapshotCacheGateway, unavailableRunnerSnapshotCacheGateway, } from "./live/snapshot-cache-gateway.js";
9
- export { lineSplitter, OUTPUT_TAIL_LINES, outputRule, outputTail, rewritePaths, splitLines, } from "./output.js";
10
- export { prepareRunner, } from "./prepare.js";
11
- export { APPLY_LABEL, readyRunner, } from "./ready.js";
12
- export { checkRecipe, resolveSteps, resolveVcpus, } from "./recipe.js";
13
- export { SANDBOX_TEST_EVENTS_PATH, sandboxedCommand, sandboxEnvironment, runCommandInSandbox, } from "./sandboxed-command.js";
14
- export { readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH, stepSecrets, } from "./secrets.js";
15
- export { CREATE_SETTLE_MS, keptMs, runnerSandboxScope, SNAPSHOT_SETTLE_MS, } from "./scope.js";
16
- export { BASE_INDEX_LABEL, buildSnapshot } from "./snapshot-build.js";
17
- export { dropBranchSnapshots, findSnapshotCandidates, isBranchEntry, pickSnapshot, RUNNER_SNAPSHOTS_SUBPATH, SNAPSHOT_EXPIRATION_MS, snapshotEntryFileName, snapshotEntryIdentity, } from "./snapshot-cache.js";
18
- export { applyScript, baseIndexScript, RESET_TO_BASE, snapshotKey, snapshotStepsAt, } from "./snapshot-key.js";
19
- export { saveBranchSnapshot, scrubGitScript, scrubTempScript, TEMP_DIRECTORIES, } from "./snapshot-save.js";
20
- export { STEP_ENV } from "./steps.js";
11
+ export { lineSplitter } from "./output.js";
12
+ export { prepareRunner } from "./prepare.js";
13
+ export { checkRecipe, devSnapshotsTrusted, runStepTakesSecret, } from "./recipe.js";
14
+ export { SANDBOX_TEST_EVENTS_PATH } from "./sandboxed-command.js";
15
+ export { declaredSecretValues, readRunnerSecrets, RUNNER_SECRET_MIN_LENGTH } from "./secrets.js";
16
+ export { openRunnerSession, } from "./session.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}`;