@cnc-tools/storm 0.14.2 → 0.16.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 (414) hide show
  1. package/dist/application.js +3 -1
  2. package/dist/bin/storm.js +9 -7
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/chunk-2MAD5NKK.js +108 -0
  5. package/dist/chunks/{chunk-HDL4WKIB.js → chunk-3L52KNQA.js} +2 -2
  6. package/dist/chunks/{chunk-GSC6SRTW.js → chunk-5CCP36QQ.js} +1 -1
  7. package/dist/chunks/{chunk-43MWZLJR.js → chunk-5VXBKPW6.js} +1 -1
  8. package/dist/chunks/chunk-7EENF73W.js +782 -0
  9. package/dist/chunks/{chunk-RA4L2ACU.js → chunk-AWBSONHB.js} +88 -34
  10. package/dist/chunks/chunk-CK2GZEPK.js +40 -0
  11. package/dist/chunks/{chunk-BRUIATTR.js → chunk-CN4EFA5J.js} +59 -12
  12. package/dist/chunks/{chunk-I7AN3DIJ.js → chunk-DC2CDHNK.js} +1928 -738
  13. package/dist/chunks/{chunk-UUBZTGLV.js → chunk-DWEAHX4T.js} +140 -130
  14. package/dist/chunks/{chunk-T6AZIDZD.js → chunk-F6N34UWB.js} +12 -244
  15. package/dist/chunks/chunk-FCQUJDA4.js +963 -0
  16. package/dist/chunks/{chunk-VH2POPW5.js → chunk-FOZWA52V.js} +635 -79
  17. package/dist/chunks/{chunk-XZCDA5PE.js → chunk-G3PHMXH5.js} +7 -2
  18. package/dist/chunks/{chunk-3HBPNQ4Y.js → chunk-HVNK3I45.js} +2 -2
  19. package/dist/chunks/chunk-OIY3DMF2.js +74 -0
  20. package/dist/chunks/{chunk-GJOEPJJL.js → chunk-P357TZAY.js} +446 -52
  21. package/dist/chunks/{chunk-UC6DULWY.js → chunk-R7XVBZOY.js} +130 -39
  22. package/dist/chunks/chunk-TJNFVNKR.js +246 -0
  23. package/dist/chunks/{chunk-RUPD4TLT.js → chunk-V4IKA3WI.js} +198 -63
  24. package/dist/chunks/{chunk-BW2ADH7U.js → chunk-VUPZH7J2.js} +1 -1
  25. package/dist/chunks/{chunk-LUOHJ3LB.js → chunk-Z5PBVG3Y.js} +1131 -468
  26. package/dist/chunks/{chunk-GQIL3AHY.js → chunk-ZG3WQ4UF.js} +1 -1
  27. package/dist/chunks/{live-app-SZGEILCQ.js → live-app-WECQOQ4C.js} +28 -23
  28. package/dist/command-tree.d.ts +2 -2
  29. package/dist/command-tree.js +2 -2
  30. package/dist/commands/exec/across-sandboxes-outcomes.d.ts +364 -0
  31. package/dist/commands/exec/across-sandboxes-outcomes.js +230 -0
  32. package/dist/commands/exec/across-sandboxes-run.d.ts +180 -0
  33. package/dist/commands/exec/across-sandboxes-run.js +339 -0
  34. package/dist/commands/exec/command.d.ts +583 -75
  35. package/dist/commands/exec/command.js +165 -32
  36. package/dist/commands/exec/driver-plan.d.ts +8 -2
  37. package/dist/commands/exec/driver-plan.js +13 -3
  38. package/dist/commands/exec/exec-words.d.ts +17 -3
  39. package/dist/commands/exec/exec-words.js +27 -16
  40. package/dist/commands/exec/live-view.d.ts +3 -4
  41. package/dist/commands/exec/live-view.js +37 -28
  42. package/dist/commands/exec/metadata.js +2 -2
  43. package/dist/commands/exec/mint-failed.d.ts +4 -4
  44. package/dist/commands/exec/mint-failed.js +6 -6
  45. package/dist/commands/exec/outcomes.d.ts +533 -73
  46. package/dist/commands/exec/outcomes.js +203 -67
  47. package/dist/commands/exec/plan-only.d.ts +10 -0
  48. package/dist/commands/exec/plan-only.js +45 -0
  49. package/dist/commands/exec/plan-run.d.ts +54 -35
  50. package/dist/commands/exec/plan-run.js +81 -38
  51. package/dist/commands/exec/planned-outcome.d.ts +15 -0
  52. package/dist/commands/exec/planned-outcome.js +42 -0
  53. package/dist/commands/exec/progress.d.ts +2 -2
  54. package/dist/commands/exec/progress.js +35 -18
  55. package/dist/commands/exec/resource-refusals.d.ts +2 -2
  56. package/dist/commands/exec/resource-refusals.js +3 -3
  57. package/dist/commands/exec/run-bin.d.ts +1 -1
  58. package/dist/commands/exec/run-bin.js +2 -2
  59. package/dist/commands/exec/run-command.d.ts +344 -63
  60. package/dist/commands/exec/run-command.js +312 -263
  61. package/dist/commands/exec/run-metadata.d.ts +42 -8
  62. package/dist/commands/exec/run-metadata.js +40 -21
  63. package/dist/commands/exec/run-planned.d.ts +20 -0
  64. package/dist/commands/exec/run-planned.js +22 -0
  65. package/dist/commands/exec/sandbox-lines.d.ts +42 -0
  66. package/dist/commands/exec/sandbox-lines.js +59 -0
  67. package/dist/commands/exec/sandbox-progress.d.ts +30 -0
  68. package/dist/commands/exec/sandbox-progress.js +232 -0
  69. package/dist/commands/exec/sandbox-view.d.ts +19 -0
  70. package/dist/commands/exec/sandbox-view.js +72 -0
  71. package/dist/commands/exec/view.d.ts +3 -2
  72. package/dist/commands/exec/view.js +10 -6
  73. package/dist/commands/runs/facts.d.ts +53 -10
  74. package/dist/commands/runs/facts.js +60 -32
  75. package/dist/commands/runs/list/command.d.ts +82 -4
  76. package/dist/commands/runs/list/command.js +11 -10
  77. package/dist/commands/runs/list/metadata.js +1 -1
  78. package/dist/commands/runs/list/outcomes.d.ts +41 -2
  79. package/dist/commands/runs/logs/command.d.ts +109 -10
  80. package/dist/commands/runs/logs/command.js +139 -24
  81. package/dist/commands/runs/logs/metadata.d.ts +4 -0
  82. package/dist/commands/runs/logs/metadata.js +14 -7
  83. package/dist/commands/runs/logs/outcomes.d.ts +52 -3
  84. package/dist/commands/runs/logs/outcomes.js +110 -6
  85. package/dist/commands/runs/past-run.d.ts +91 -11
  86. package/dist/commands/runs/past-run.js +149 -9
  87. package/dist/commands/runs/show/command.d.ts +574 -12
  88. package/dist/commands/runs/show/command.js +634 -119
  89. package/dist/commands/runs/show/metadata.d.ts +17 -0
  90. package/dist/commands/runs/show/metadata.js +48 -7
  91. package/dist/commands/runs/show/outcomes.d.ts +279 -6
  92. package/dist/commands/runs/show/outcomes.js +484 -96
  93. package/dist/commands/snapshots/build/command.d.ts +109 -18
  94. package/dist/commands/snapshots/build/command.js +72 -36
  95. package/dist/commands/snapshots/build/metadata.d.ts +4 -0
  96. package/dist/commands/snapshots/build/metadata.js +5 -1
  97. package/dist/commands/snapshots/build/outcomes.d.ts +53 -8
  98. package/dist/commands/snapshots/build/outcomes.js +26 -3
  99. package/dist/commands/snapshots/list/command.d.ts +72 -7
  100. package/dist/commands/snapshots/list/command.js +57 -24
  101. package/dist/commands/snapshots/list/metadata.d.ts +4 -0
  102. package/dist/commands/snapshots/list/metadata.js +5 -1
  103. package/dist/commands/snapshots/list/outcomes.d.ts +31 -0
  104. package/dist/commands/snapshots/list/outcomes.js +25 -2
  105. package/dist/commands/suites/list/command.d.ts +129 -0
  106. package/dist/commands/suites/list/command.js +163 -0
  107. package/dist/commands/suites/list/metadata.d.ts +11 -0
  108. package/dist/commands/suites/list/metadata.js +15 -0
  109. package/dist/commands/suites/list/outcomes.d.ts +91 -0
  110. package/dist/commands/suites/list/outcomes.js +122 -0
  111. package/dist/commands/suites/metadata.js +8 -0
  112. package/dist/commands/test/command.d.ts +1395 -0
  113. package/dist/commands/test/command.js +581 -0
  114. package/dist/commands/test/metadata.js +8 -0
  115. package/dist/commands/test/outcomes.d.ts +768 -0
  116. package/dist/commands/test/outcomes.js +140 -0
  117. package/dist/commands/test/plan.d.ts +92 -0
  118. package/dist/commands/test/plan.js +125 -0
  119. package/dist/commands/test/test-words.d.ts +12 -0
  120. package/dist/commands/test/test-words.js +42 -0
  121. package/dist/config/check-resources.d.ts +14 -0
  122. package/dist/config/check-resources.js +98 -0
  123. package/dist/config/check-runner.d.ts +15 -0
  124. package/dist/config/check-runner.js +79 -0
  125. package/dist/config/check-suites.d.ts +14 -0
  126. package/dist/config/check-suites.js +100 -0
  127. package/dist/config/gateways.d.ts +31 -3
  128. package/dist/config/index.d.ts +8 -6
  129. package/dist/config/index.js +5 -4
  130. package/dist/config/live/config-gateway.js +5 -2
  131. package/dist/config/live/file-lists-file-gateway.d.ts +4 -0
  132. package/dist/config/live/file-lists-file-gateway.js +27 -0
  133. package/dist/config/load.d.ts +32 -14
  134. package/dist/config/load.js +162 -116
  135. package/dist/config/resolve.d.ts +3 -2
  136. package/dist/config/resolve.js +6 -3
  137. package/dist/config/resolver.d.ts +20 -6
  138. package/dist/config/resolver.js +11 -8
  139. package/dist/config/runner.d.ts +23 -0
  140. package/dist/config/runner.js +4 -0
  141. package/dist/config/schema.d.ts +39 -19
  142. package/dist/config/schema.js +50 -10
  143. package/dist/config/settings-file.d.ts +9 -3
  144. package/dist/config/settings-file.js +41 -4
  145. package/dist/config/suite.d.ts +39 -0
  146. package/dist/config/suite.js +5 -0
  147. package/dist/config/typed-options.d.ts +1 -6
  148. package/dist/config/typed-options.js +2 -10
  149. package/dist/config-file/define.d.ts +45 -24
  150. package/dist/config-file/define.js +9 -8
  151. package/dist/config-file/runner.d.ts +11 -0
  152. package/dist/config-file/runner.js +9 -0
  153. package/dist/config-file/toolchain.d.ts +13 -7
  154. package/dist/config-file/toolchain.js +51 -35
  155. package/dist/context.d.ts +12 -8
  156. package/dist/context.js +9 -3
  157. package/dist/core/across-sandboxes.d.ts +43 -0
  158. package/dist/core/across-sandboxes.js +319 -0
  159. package/dist/core/before-run.d.ts +5 -3
  160. package/dist/core/before-run.js +12 -1
  161. package/dist/core/events.d.ts +62 -6
  162. package/dist/core/events.js +14 -0
  163. package/dist/core/index.d.ts +4 -2
  164. package/dist/core/index.js +3 -1
  165. package/dist/core/payload.d.ts +2 -1
  166. package/dist/core/payload.js +2 -1
  167. package/dist/core/presentations.js +1 -1
  168. package/dist/core/resource.d.ts +1 -1
  169. package/dist/core/resources.d.ts +56 -6
  170. package/dist/core/resources.js +81 -5
  171. package/dist/core/run-state.js +9 -0
  172. package/dist/core/run.d.ts +77 -15
  173. package/dist/core/run.js +150 -86
  174. package/dist/core/sandbox-end.d.ts +64 -0
  175. package/dist/core/sandbox-end.js +128 -0
  176. package/dist/core/timeline.d.ts +4 -4
  177. package/dist/core/timeline.js +3 -3
  178. package/dist/credential/live/vercel-cli-gateway.d.ts +7 -0
  179. package/dist/credential/live/vercel-cli-gateway.js +14 -1
  180. package/dist/extensions/github/context.d.ts +1 -1
  181. package/dist/extensions/github/definition.d.ts +11 -9
  182. package/dist/extensions/github/definition.js +8 -6
  183. package/dist/extensions/github/extension.d.ts +3 -3
  184. package/dist/extensions/github/fixture-repo.d.ts +21 -2
  185. package/dist/extensions/github/fixture-repo.js +31 -2
  186. package/dist/extensions/github/index.d.ts +2 -2
  187. package/dist/extensions/github/index.js +2 -2
  188. package/dist/extensions/github/lifecycle.d.ts +16 -6
  189. package/dist/extensions/github/lifecycle.js +42 -25
  190. package/dist/extensions/github/options.d.ts +17 -11
  191. package/dist/extensions/github/options.js +14 -13
  192. package/dist/extensions/github/refusals.d.ts +23 -6
  193. package/dist/extensions/github/refusals.js +34 -12
  194. package/dist/extensions/github/resource.d.ts +21 -12
  195. package/dist/extensions/github/resource.js +16 -8
  196. package/dist/extensions/github/run/payload.d.ts +6 -6
  197. package/dist/extensions/github/run/payload.js +3 -5
  198. package/dist/extensions/github/split.d.ts +10 -0
  199. package/dist/extensions/github/split.js +12 -0
  200. package/dist/extensions/playwright/driver.js +6 -26
  201. package/dist/extensions/playwright/extension.js +1 -1
  202. package/dist/extensions/testserver/commands/pool/create/command.js +8 -8
  203. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  204. package/dist/extensions/testserver/definition.d.ts +4 -4
  205. package/dist/extensions/testserver/definition.js +41 -31
  206. package/dist/extensions/testserver/extension.d.ts +4 -5
  207. package/dist/extensions/testserver/extension.js +14 -41
  208. package/dist/extensions/testserver/index.d.ts +1 -1
  209. package/dist/extensions/testserver/index.js +1 -1
  210. package/dist/extensions/testserver/lifecycle.d.ts +10 -2
  211. package/dist/extensions/testserver/lifecycle.js +29 -6
  212. package/dist/extensions/testserver/options/rules.d.ts +5 -5
  213. package/dist/extensions/testserver/options/rules.js +10 -8
  214. package/dist/extensions/testserver/options/sandboxes.d.ts +4 -2
  215. package/dist/extensions/testserver/options/sandboxes.js +8 -3
  216. package/dist/extensions/testserver/pool/gateways.d.ts +29 -4
  217. package/dist/extensions/testserver/pool/index.d.ts +2 -2
  218. package/dist/extensions/testserver/pool/index.js +1 -1
  219. package/dist/extensions/testserver/pool/lease.d.ts +10 -0
  220. package/dist/extensions/testserver/pool/lease.js +21 -0
  221. package/dist/extensions/testserver/pool/live/pool-store-gateway.js +38 -3
  222. package/dist/extensions/testserver/refusals.d.ts +12 -0
  223. package/dist/extensions/testserver/refusals.js +18 -0
  224. package/dist/extensions/testserver/release.d.ts +16 -0
  225. package/dist/extensions/testserver/release.js +56 -4
  226. package/dist/extensions/testserver/resource.d.ts +6 -6
  227. package/dist/extensions/testserver/resource.js +3 -3
  228. package/dist/extensions/testserver/split.d.ts +9 -0
  229. package/dist/extensions/testserver/split.js +22 -0
  230. package/dist/extensions/testserver/vitest/fixtures.d.ts +5 -5
  231. package/dist/extensions/testserver/vitest/fixtures.js +9 -38
  232. package/dist/extensions/vitest/driver.d.ts +7 -0
  233. package/dist/extensions/vitest/driver.js +33 -37
  234. package/dist/extensions/vitest/extension.js +1 -1
  235. package/dist/extensions/vitest/plan/plan-over.d.ts +8 -1
  236. package/dist/extensions/vitest/plan/plan-over.js +16 -2
  237. package/dist/extensions.d.ts +17 -16
  238. package/dist/extensions.js +5 -4
  239. package/dist/forward-sigterm.js +1 -1
  240. package/dist/launcher-resolvers/local-services.d.ts +1 -1
  241. package/dist/live-app.js +4 -3
  242. package/dist/local-services.js +1 -1
  243. package/dist/planning/driver-file-lists.d.ts +61 -0
  244. package/dist/planning/driver-file-lists.js +66 -0
  245. package/dist/{commands/exec → planning}/driver-refusals.d.ts +11 -10
  246. package/dist/{commands/exec → planning}/driver-refusals.js +18 -14
  247. package/dist/planning/file-lists-file.d.ts +58 -0
  248. package/dist/planning/file-lists-file.js +105 -0
  249. package/dist/planning/file-lists.d.ts +28 -0
  250. package/dist/planning/file-lists.js +52 -0
  251. package/dist/{commands/exec → planning}/final-results.d.ts +1 -1
  252. package/dist/{commands/exec → planning}/final-results.js +6 -6
  253. package/dist/planning/plan-only.d.ts +84 -0
  254. package/dist/planning/plan-only.js +86 -0
  255. package/dist/{commands/exec → planning}/redaction.d.ts +2 -2
  256. package/dist/{commands/exec → planning}/redaction.js +5 -4
  257. package/dist/{commands/exec → planning}/resource-flags.d.ts +5 -12
  258. package/dist/{commands/exec → planning}/resource-flags.js +6 -16
  259. package/dist/planning/run-kind-flags.d.ts +20 -0
  260. package/dist/planning/run-kind-flags.js +48 -0
  261. package/dist/planning/run-plan.d.ts +29 -0
  262. package/dist/planning/run-plan.js +4 -0
  263. package/dist/planning/sandbox-placeholders.d.ts +22 -0
  264. package/dist/planning/sandbox-placeholders.js +60 -0
  265. package/dist/planning/suite-not-found.d.ts +37 -0
  266. package/dist/planning/suite-not-found.js +36 -0
  267. package/dist/planning/suites.d.ts +43 -0
  268. package/dist/planning/suites.js +89 -0
  269. package/dist/{commands/exec → planning}/test-plan.d.ts +8 -3
  270. package/dist/{commands/exec → planning}/test-plan.js +32 -5
  271. package/dist/playwright/reporter.d.ts +20 -8
  272. package/dist/playwright/reporter.js +195 -15
  273. package/dist/presentation.d.ts +10 -6
  274. package/dist/presentation.js +13 -15
  275. package/dist/run-directory/gateways.d.ts +60 -4
  276. package/dist/run-directory/index.d.ts +4 -4
  277. package/dist/run-directory/index.js +2 -1
  278. package/dist/run-directory/live/run-directory-gateway.js +92 -16
  279. package/dist/run-directory/plan.d.ts +35 -2
  280. package/dist/run-directory/plan.js +44 -7
  281. package/dist/run-directory/reader.d.ts +26 -5
  282. package/dist/run-directory/reader.js +24 -1
  283. package/dist/run-directory/recording.d.ts +75 -49
  284. package/dist/run-directory/recording.js +214 -28
  285. package/dist/run-directory/run-directory.d.ts +22 -1
  286. package/dist/run-directory/run-directory.js +24 -0
  287. package/dist/run-directory/run-record.d.ts +144 -21
  288. package/dist/run-directory/run-record.js +118 -19
  289. package/dist/run-directory/timeline-facts.js +4 -4
  290. package/dist/runner/base.d.ts +0 -6
  291. package/dist/runner/base.js +0 -15
  292. package/dist/runner/build-snapshots.d.ts +7 -7
  293. package/dist/runner/build-snapshots.js +19 -24
  294. package/dist/runner/events.d.ts +29 -8
  295. package/dist/runner/gateways.d.ts +54 -6
  296. package/dist/runner/index.d.ts +6 -4
  297. package/dist/runner/index.js +3 -2
  298. package/dist/runner/live/sandbox-gateway.js +173 -31
  299. package/dist/runner/network-policy.d.ts +55 -0
  300. package/dist/runner/network-policy.js +46 -0
  301. package/dist/runner/policy-writes.d.ts +40 -0
  302. package/dist/runner/policy-writes.js +124 -0
  303. package/dist/runner/prepare.d.ts +16 -16
  304. package/dist/runner/prepare.js +11 -12
  305. package/dist/runner/ready.d.ts +39 -10
  306. package/dist/runner/ready.js +59 -47
  307. package/dist/runner/recipe-check.d.ts +6 -0
  308. package/dist/runner/recipe-check.js +29 -0
  309. package/dist/runner/recipe-secrets.d.ts +67 -0
  310. package/dist/runner/recipe-secrets.js +230 -0
  311. package/dist/runner/recipe.d.ts +151 -63
  312. package/dist/runner/recipe.js +277 -200
  313. package/dist/runner/sandboxed-command.d.ts +22 -8
  314. package/dist/runner/sandboxed-command.js +33 -10
  315. package/dist/runner/scope.d.ts +107 -21
  316. package/dist/runner/scope.js +274 -54
  317. package/dist/runner/secrets.d.ts +42 -31
  318. package/dist/runner/secrets.js +62 -40
  319. package/dist/runner/session.d.ts +59 -26
  320. package/dist/runner/session.js +82 -41
  321. package/dist/runner/snapshot-build.d.ts +8 -5
  322. package/dist/runner/snapshot-build.js +56 -29
  323. package/dist/runner/snapshot-choice.d.ts +37 -0
  324. package/dist/runner/snapshot-choice.js +38 -0
  325. package/dist/runner/snapshot-inspect.d.ts +4 -4
  326. package/dist/runner/snapshot-inspect.js +7 -7
  327. package/dist/runner/snapshot-key.d.ts +27 -17
  328. package/dist/runner/snapshot-key.js +51 -26
  329. package/dist/runner/steps.d.ts +13 -5
  330. package/dist/runner/steps.js +34 -4
  331. package/dist/runner/time-limit.d.ts +10 -0
  332. package/dist/runner/time-limit.js +43 -0
  333. package/dist/sdk/extension/commands.d.ts +1 -7
  334. package/dist/sdk/extension/driver.d.ts +39 -46
  335. package/dist/sdk/extension/driver.js +6 -6
  336. package/dist/sdk/extension/index.d.ts +3 -3
  337. package/dist/sdk/extension/index.js +3 -4
  338. package/dist/sdk/extension/lifecycle.d.ts +52 -9
  339. package/dist/sdk/extension/lifecycle.js +1 -1
  340. package/dist/sdk/extension/resource-definition.d.ts +16 -12
  341. package/dist/sdk/extension/resource-definition.js +10 -4
  342. package/dist/sdk/extension/resource-factory.js +3 -4
  343. package/dist/sdk/extension/resource.d.ts +2 -2
  344. package/dist/sdk/extension/secret-source.d.ts +58 -0
  345. package/dist/sdk/extension/secret-source.js +78 -0
  346. package/dist/sdk/index.d.ts +2 -2
  347. package/dist/sdk/index.js +1 -1
  348. package/dist/sdk/run/launcher.d.ts +1 -1
  349. package/dist/sdk/run/launcher.js +1 -1
  350. package/dist/sdk/run/payload.d.ts +16 -1
  351. package/dist/sdk/run/payload.js +17 -2
  352. package/dist/sdk/run/present.d.ts +3 -3
  353. package/dist/sdk/run/present.js +1 -3
  354. package/dist/sdk/run/redact.js +2 -2
  355. package/dist/sdk/run/test-events.d.ts +23 -6
  356. package/dist/sdk/run/test-events.js +6 -4
  357. package/dist/sdk/run/test-result-writer.d.ts +8 -3
  358. package/dist/sdk/run/test-result-writer.js +22 -2
  359. package/dist/{commands/exec → shared}/cleanup.d.ts +3 -3
  360. package/dist/{commands/exec → shared}/cleanup.js +11 -6
  361. package/dist/shared/job-summary.d.ts +19 -0
  362. package/dist/{commands/exec → shared}/job-summary.js +17 -0
  363. package/dist/shared/sandbox-table.d.ts +48 -0
  364. package/dist/shared/sandbox-table.js +109 -0
  365. package/dist/{commands/exec → shared}/snapshot-text.d.ts +1 -1
  366. package/dist/{commands/exec → shared}/tests-summary.d.ts +22 -6
  367. package/dist/{commands/exec → shared}/tests-summary.js +74 -31
  368. package/dist/{commands/exec → shared}/text.d.ts +7 -2
  369. package/dist/{commands/exec → shared}/text.js +9 -1
  370. package/dist/{commands/exec → shared}/waterfall.d.ts +8 -6
  371. package/dist/{commands/exec → shared}/waterfall.js +71 -24
  372. package/dist/shared/worker-chart.d.ts +172 -0
  373. package/dist/shared/worker-chart.js +623 -0
  374. package/dist/vitest/config.d.ts +35 -11
  375. package/dist/vitest/config.js +47 -14
  376. package/dist/vitest/index.d.ts +1 -1
  377. package/dist/vitest/index.js +3 -3
  378. package/dist/vitest/sequencer.d.ts +23 -0
  379. package/dist/vitest/sequencer.js +73 -0
  380. package/dist/vitest/setup.d.ts +1 -0
  381. package/dist/vitest/setup.js +34 -0
  382. package/dist/vitest/test-events.d.ts +32 -6
  383. package/dist/vitest/test-events.js +25 -5
  384. package/dist/vitest/test-results.d.ts +8 -3
  385. package/dist/vitest/test-results.js +6 -0
  386. package/package.json +7 -2
  387. package/skills/overview.md +23 -17
  388. package/skills/plan-runs.md +67 -0
  389. package/skills/read-run-output.md +51 -19
  390. package/dist/chunks/chunk-E3QU74NX.js +0 -49
  391. package/dist/chunks/chunk-HP54VHGY.js +0 -201
  392. package/dist/chunks/chunk-NMVODY3P.js +0 -19
  393. package/dist/chunks/chunk-TVMEKVOW.js +0 -607
  394. package/dist/commands/exec/define-run-command.d.ts +0 -671
  395. package/dist/commands/exec/define-run-command.js +0 -91
  396. package/dist/commands/exec/job-summary.d.ts +0 -10
  397. package/dist/commands/exec/worker-chart.d.ts +0 -87
  398. package/dist/commands/exec/worker-chart.js +0 -343
  399. package/dist/commands/playwright/command.d.ts +0 -661
  400. package/dist/commands/playwright/command.js +0 -31
  401. package/dist/commands/playwright/metadata.js +0 -8
  402. package/dist/commands/vitest/command.d.ts +0 -662
  403. package/dist/commands/vitest/command.js +0 -31
  404. package/dist/commands/vitest/metadata.js +0 -8
  405. package/dist/config/recipe-run.d.ts +0 -26
  406. package/dist/config/recipe-run.js +0 -27
  407. package/dist/sdk/extension/ci.d.ts +0 -2
  408. package/dist/sdk/extension/ci.js +0 -6
  409. package/dist/chunks/{chunk-YM6TZV4L.js → chunk-VL7WFTVQ.js} +52 -52
  410. package/dist/commands/{playwright → suites}/metadata.d.ts +1 -1
  411. package/dist/commands/{vitest → test}/metadata.d.ts +1 -1
  412. /package/dist/{commands → shared}/dashboard.d.ts +0 -0
  413. /package/dist/{commands → shared}/dashboard.js +0 -0
  414. /package/dist/{commands/exec → shared}/snapshot-text.js +0 -0
package/dist/core/run.js CHANGED
@@ -12,27 +12,12 @@ import { lineSplitter, openRunnerSession, SANDBOX_TEST_EVENTS_PATH, } from "../r
12
12
  import { parseTestEvent } from "../sdk/run/launcher.js";
13
13
  import { colorEnvironment, commandEnvironment, runPayload } from "./payload.js";
14
14
  import { LOOKUP } from "./resource-definition-set.js";
15
- import { acquireResources, announceAcquired, canceledStop, runInstances, releaseResources, resourceWarnings, releasedResources, resourceInstances, resourcesPayload, resourcesRan, } from "./resources.js";
15
+ import { acquireResources, announceAcquired, canceledStop, runInstances, releaseResources, resourceWarnings, releasedResources, resourceInstances, resourcesCredentials, resourcesPayload, resourcesRan, } from "./resources.js";
16
16
  /**
17
- * Runs `request.argv` with the resources it asks for, through `definitionSet`'s resource definitions, in definition
18
- * order. Each resource's `beforeRun` has run already, before the run started: the request holds what it answered. It
19
- * says each resource `beforeRun` skipped right after it starts (`resource-skipped`), acquires the other resource
20
- * instances all at once through their `acquireForRun` (`acquireResources`), says each acquired (`resource-acquired`),
21
- * runs the command with the run payload in `STORM_RUN`, waits for it, and hands each instance what its acquire took to
22
- * its `releaseAfterRun`. It reports each step to `progress`. What acquiring and releasing do is each resource
23
- * definition's own: see its lifecycle. A run that asks for no resource goes straight to its command. It calls each
24
- * definition's lifecycle with its own Context from `resourceContexts`, and hands `context` to none.
25
- *
26
- * In a sandboxed run (`request.runner`), the command runs in a runner sandbox, readied beside the resources (see
27
- * `runSandboxed`).
28
- *
29
- * Release happens however the run ended, a throw included: once the command has stopped and, in a sandboxed run, the
30
- * runner session has closed its sandbox scope, each resource instance is released in reverse order, even when the
31
- * `cleanup-started` event can't be reported. An unsandboxed run releases them in `finally`; a sandboxed run's runner
32
- * session does, as it finishes or closes.
17
+ * Shared opening events emitted at the start of every run (across runner sandboxes or not): `started`, skips, and
18
+ * `runner-prepared`.
33
19
  */
34
- export async function executeRun(definitionSet, context, resourceContexts, request, control, progress) {
35
- const instances = resourceInstances(definitionSet[LOOKUP], resourceContexts, request.resources);
20
+ export async function emitRunOpening(progress, request, instances) {
36
21
  await progress.emit({
37
22
  kind: "started",
38
23
  version: request.version,
@@ -52,12 +37,77 @@ export async function executeRun(definitionSet, context, resourceContexts, reque
52
37
  notes: prepared.notes,
53
38
  });
54
39
  }
55
- // Each instance keeps what its acquire took, as `acquireForRun` hands it over: the run releases all of it however
56
- // it ends.
40
+ }
41
+ /**
42
+ * Mints a Vercel OIDC credential for `target`, checks its team and project claims, and honors `signal`. Every run
43
+ * shares it, across runner sandboxes or not.
44
+ */
45
+ export async function mintCredential(context, target, signal, progress) {
46
+ const canceled = () => ({ ...canceledStop(), commandStopped: false });
47
+ if (signal.aborted)
48
+ return { ok: false, outcome: canceled() };
49
+ const mint = credentialSourceFor({ source: "mint", target }, context, progress);
50
+ const minted = await mint.obtain();
51
+ if (!minted.ok)
52
+ return { ok: false, outcome: { kind: "mint_failed", failure: minted.failure.failure, target, runner: true } };
53
+ const project = minted.credential.vercelProject();
54
+ if (project === undefined)
55
+ return {
56
+ ok: false,
57
+ outcome: { kind: "runner_failed", failure: { kind: "credential-claims-missing", target } },
58
+ };
59
+ if (signal.aborted)
60
+ return { ok: false, outcome: canceled() };
61
+ return { ok: true, mint, access: { credential: minted.credential, ...project } };
62
+ }
63
+ /**
64
+ * Runs `request.argv` in `session` with `request.runPayload`, pumping test events in arrival order and mapping sandbox
65
+ * exit/kill/failure outcomes into `RanCommand` or `RunStopped`. Every run shares it, across runner sandboxes or not.
66
+ */
67
+ export async function runCommandInSandbox(session, request, signal, progress, onStarted) {
68
+ await progress.emit({ kind: "command-started", argv: request.argv });
69
+ if (signal.aborted)
70
+ return { ok: false, outcome: { ...canceledStop(), commandStopped: false } };
71
+ onStarted?.();
72
+ // Test events arrive from a callback that can't wait, so they are emitted in order through a chain.
73
+ let testEvents = Promise.resolve();
74
+ const sandboxed = await session.runCommand({
75
+ argv: request.argv,
76
+ runPayload: request.runPayload,
77
+ ...(request.credentials === undefined ? {} : { credentials: request.credentials }),
78
+ testEvents: {
79
+ onLine: (line) => {
80
+ const event = parseTestEvent(line);
81
+ testEvents = testEvents.then(() => progress.emit(event === undefined ? { kind: "test-event-unreadable" } : { kind: "test", event }));
82
+ },
83
+ onIncomplete: (message) => {
84
+ testEvents = testEvents.then(() => progress.emit({ kind: "test-events-incomplete", message }));
85
+ },
86
+ },
87
+ });
88
+ await testEvents;
89
+ // Closing on a signal can stop the runner sandbox under the command, so a failed call then is the stop too.
90
+ if (sandboxed.kind === "killed" || (sandboxed.kind === "failed" && signal.aborted))
91
+ return { ok: false, outcome: { ...canceledStop(), commandStopped: true } };
92
+ if (sandboxed.kind === "failed")
93
+ return { ok: false, outcome: { kind: "runner_failed", failure: sandboxed.failure } };
94
+ const command = sandboxed.exitCode === null ? { kind: "no-exit-code" } : { kind: "exited", code: sandboxed.exitCode };
95
+ await progress.emit({
96
+ kind: "command-ended",
97
+ command: posix.basename(request.argv[0] ?? ""),
98
+ outcome: command,
99
+ ms: sandboxed.ms,
100
+ });
101
+ return { ok: true, command };
102
+ }
103
+ /**
104
+ * Runs `body` with idempotent `startCleanup` / `release` hooks, guarantees every acquired resource instance is
105
+ * released in `finally`, and returns both `body`'s result and the collected `resourceCleanup`.
106
+ */
107
+ export async function withResourceCleanup(instances, keepMs, progress, body) {
57
108
  let cleanupStarted = false;
58
- // Said once, before the runner's sandboxes are stopped in a sandboxed run, else before the resources are released,
59
- // with how long cleanup keeps the runner sandbox running, if the run has one.
60
- const keepMs = request.runner === undefined ? null : request.runner.keepMs;
109
+ // Said once, before the runner's sandboxes are fenced in a sandboxed run, else before the resources are released,
110
+ // with how long cleanup keeps the runner sandbox running, if the run has one (`keepMs`, null for a run with no runner).
61
111
  const startCleanup = async () => {
62
112
  if (cleanupStarted)
63
113
  return;
@@ -66,27 +116,59 @@ export async function executeRun(definitionSet, context, resourceContexts, reque
66
116
  };
67
117
  let resourceCleanup = {};
68
118
  let releasing;
69
- // Once: reporting cleanup's start can fail, and releasing what the acquires took must not depend on it.
70
- const release = () => (releasing ??= (async () => {
119
+ // Once: reporting cleanup's start can fail, and releasing what the acquires took must not depend on it. The first
120
+ // call's `runner` is the one every release gets: whether the launcher fenced the run's runner sandbox.
121
+ const release = (runner) => (releasing ??= (async () => {
71
122
  try {
72
123
  await startCleanup();
73
124
  }
74
125
  finally {
75
- resourceCleanup = await releaseResources(instances, progress);
126
+ resourceCleanup = await releaseResources(instances, progress, runner);
76
127
  }
77
128
  })());
78
- let ended;
79
- let runnerCleanup = null;
129
+ let value;
80
130
  try {
81
- ({ ended, runnerCleanup } =
82
- request.runner === undefined
83
- ? { ended: await runUnsandboxed(context, request, instances, control, progress), runnerCleanup: null }
84
- : await runSandboxed(context, request, instances, control, progress, { startCleanup, release }));
131
+ value = await body({ startCleanup, release });
85
132
  }
86
133
  finally {
87
- // A no-op in a sandboxed run: its runner session released the resources once it closed its scope.
88
- await release();
134
+ // A run with no runner (`keepMs` null) has nothing to fence, so the release hears true. With a runner this is a
135
+ // no-op: its runner session released the resources once it fenced its sandboxes, saying whether it fenced the runner
136
+ // sandbox. Should a session ever end without releasing, nothing has confirmed the fence, so the release hears false.
137
+ await release({ runnerSandboxFenced: keepMs === null });
89
138
  }
139
+ return { value, resourceCleanup };
140
+ }
141
+ /**
142
+ * Runs `request.argv` with the resources it asks for, through `definitionSet`'s resource definitions, in definition
143
+ * order. Each resource's `beforeRun` has run already, before the run started: the request holds what it answered. It
144
+ * says each resource `beforeRun` skipped right after it starts (`resource-skipped`), acquires the other resource
145
+ * instances all at once through their `acquireForRun` (`acquireResources`), says each acquired (`resource-acquired`),
146
+ * runs the command with the run payload in `STORM_RUN`, waits for it, and hands each instance what its acquire took to
147
+ * its `releaseAfterRun`. It reports each step to `progress`. What acquiring and releasing do is each resource
148
+ * definition's own: see its lifecycle. A run that asks for no resource goes straight to its command. It calls each
149
+ * definition's lifecycle with its own Context from `resourceContexts`, and hands `context` to none.
150
+ *
151
+ * In a sandboxed run (`request.runner`), the command runs in a runner sandbox, readied beside the resources (see
152
+ * `runSandboxed`).
153
+ *
154
+ * Release happens however the run ended, a throw included: once the command has stopped and, in a sandboxed run, the
155
+ * runner session has fenced the run's sandboxes, each resource instance is released in reverse order, even when the
156
+ * `cleanup-started` event can't be reported. An unsandboxed run releases them in `finally`; a sandboxed run's runner
157
+ * session does, as it finishes or closes, between the fence and the scope's close: the fence stops every sandbox the
158
+ * run doesn't keep and leaves the runner sandbox it keeps with no network access; the close then deletes the stopped
159
+ * sandboxes and keeps the kept one running. Each release hears whether the launcher fenced the run's runner sandbox
160
+ * (`ReleaseAfterRunInput.runnerSandboxFenced`): what the runner session says once the fence answered, and true in an
161
+ * unsandboxed run, which has nothing to fence.
162
+ */
163
+ export async function executeRun(definitionSet, context, resourceContexts, request, control, progress) {
164
+ const instances = resourceInstances(definitionSet[LOOKUP], resourceContexts, request.resources);
165
+ await emitRunOpening(progress, request, instances);
166
+ // Each instance keeps what its acquire took, as `acquireForRun` hands it over: the run releases all of it however
167
+ // it ends.
168
+ const keepMs = request.runner === undefined ? null : request.runner.keepMs;
169
+ const { value: { ended, runnerCleanup }, resourceCleanup, } = await withResourceCleanup(instances, keepMs, progress, async (cleanup) => request.runner === undefined
170
+ ? { ended: await runUnsandboxed(context, request, instances, control, progress), runnerCleanup: null }
171
+ : await runSandboxed(context, request, instances, control, progress, cleanup));
90
172
  await progress.emit({
91
173
  kind: "cleanup-finished",
92
174
  resourceWarnings: resourceWarnings(resourceCleanup),
@@ -110,7 +192,8 @@ export async function executeRun(definitionSet, context, resourceContexts, reque
110
192
  * request as the run's own event, and handed to every instance; the mint is lazy, so a run mints only when a resource
111
193
  * asks for a credential.
112
194
  * The command's stdout and stderr reach `runnerTerminal` a line at a time per stream, and its environment says whether
113
- * to color them (`colorEnvironment`), since the command writes to pipes.
195
+ * to color them (`colorEnvironment`), since the command writes to pipes. A run with no runner has no firewall, so a
196
+ * resource that answered sandbox credentials throws: the launcher refuses such a run before it starts.
114
197
  */
115
198
  async function runUnsandboxed(context, request, instances, control, progress) {
116
199
  const acquisition = await acquireResources(instances, {
@@ -120,6 +203,11 @@ async function runUnsandboxed(context, request, instances, control, progress) {
120
203
  });
121
204
  if (acquisition.kind === "stopped")
122
205
  return acquisition.outcome;
206
+ // Only a runner sandbox's firewall can add a credential: the launcher refuses a run with no runner whose resources
207
+ // need a runner sandbox before it starts, so a resource that answers credentials here is a programmer error.
208
+ const crediting = resourcesCredentials(instances);
209
+ if (crediting.length > 0)
210
+ throw new Error(`resource ${crediting[0]?.resource ?? ""} answered sandbox credentials in a run with no runner sandbox; its beforeRun must say it needs one`);
123
211
  await announceAcquired(instances, progress);
124
212
  const terminal = context.runnerTerminal;
125
213
  const env = commandEnvironment(colorEnvironment(request.env, terminal.color), runPayload(resourcesPayload(instances), {
@@ -179,21 +267,21 @@ function runnerStopped(outcome) {
179
267
  /**
180
268
  * In a sandboxed run, everything between the run's start and releasing its resources. It opens the run's runner session
181
269
  * (`openRunnerSession`) before the mint, which owns the runner's sandbox scope and the order its stages run in, runs
182
- * `runInSandbox` in it, and finishes the session, which closes the scope and releases the resources. A run that throws
183
- * closes the session in `finally`, which closes the scope, then releases the resources. A sandboxed run always mints,
184
- * whatever its resources are, so its request names no credential source: the command layer refuses
185
- * `--credential github-actions` with it.
270
+ * `runInSandbox` in it, and cleans up the session, which fences the run's sandboxes, releases the resources, saying
271
+ * whether it fenced the runner sandbox, and closes the scope. A run that throws cleans up the session in `finally`,
272
+ * which does the same. A sandboxed run always mints, whatever its resources are, so its request names no credential
273
+ * source: the command layer refuses `--credential github-actions` with it.
186
274
  */
187
275
  async function runSandboxed(context, request, instances, control, progress, cleanup) {
188
276
  const runnerProgress = { emit: (event) => progress.emit({ kind: "runner", event }) };
189
277
  const session = openRunnerSession(context, request.runner, { signal: control.signal, cleanup }, runnerProgress);
190
278
  try {
191
279
  const ended = await runInSandbox(context, request, instances, session, control, progress);
192
- return { ended, runnerCleanup: await session.finish() };
280
+ return { ended, runnerCleanup: await session.cleanUp() };
193
281
  }
194
282
  finally {
195
- // Memoized: a no-op once the session finished, and the cleanup when the run threw.
196
- await session.close();
283
+ // Memoized: a no-op once the session cleaned up, and the cleanup when the run threw.
284
+ await session.cleanUp();
197
285
  }
198
286
  }
199
287
  /**
@@ -201,27 +289,23 @@ async function runSandboxed(context, request, instances, control, progress, clea
201
289
  * runner sandbox needs the run's credential: it builds the mint's source (`credentialSourceFor`) and obtains from it
202
290
  * once, and hands the same source to the resources, so one that asks for a credential gets the one mint's outcome and
203
291
  * the run reports no other mint. Then it acquires the resources and readies the runner sandbox at once (`readyBoth`),
204
- * and runs the command in the runner sandbox once all are ready, saying each resource acquired first.
292
+ * and runs the command in the runner sandbox once all are ready, saying each resource acquired first. The sandbox
293
+ * credentials the acquired resources answered (`Acquired.credentials`) go to the runner session, which has the firewall
294
+ * add each to the requests to its domain for the length of the command, beside the run's own; two credentials, of two
295
+ * resources or of a resource and the run's config (`runner.credentials`), for the same domain and header, or for one
296
+ * domain with different `requests`, throw before the command starts (`resourcesCredentials`).
205
297
  */
206
298
  async function runInSandbox(context, request, instances, session, control, progress) {
207
299
  const { runner } = request;
208
300
  // Canceled before a command started in the runner sandbox.
209
301
  const canceled = () => ({ ...canceledStop(), commandStopped: false });
210
- if (control.signal.aborted)
211
- return canceled();
212
- const mint = credentialSourceFor({ source: "mint", target: runner.target }, context, progress);
213
- const minted = await mint.obtain();
214
- if (!minted.ok)
215
- return { kind: "mint_failed", failure: minted.failure.failure, target: runner.target, runner: true };
216
- const project = minted.credential.vercelProject();
217
- if (project === undefined)
218
- return { kind: "runner_failed", failure: { kind: "credential-claims-missing", target: runner.target } };
219
- if (control.signal.aborted)
220
- return canceled();
302
+ const credential = await mintCredential(context, runner.target, control.signal, progress);
303
+ if (!credential.ok)
304
+ return credential.outcome;
221
305
  const acquisition = await readyBoth({
222
306
  instances,
223
- credential: mint,
224
- ready: (signal) => session.ready({ credential: minted.credential, ...project }, signal),
307
+ credential: credential.mint,
308
+ ready: (signal) => session.ready(credential.access, signal),
225
309
  }, control, progress);
226
310
  if (acquisition.kind === "stopped") {
227
311
  const { outcome } = acquisition;
@@ -232,41 +316,21 @@ async function runInSandbox(context, request, instances, session, control, progr
232
316
  if (readied?.kind !== "ready")
233
317
  return canceled();
234
318
  const ready = readied.runner;
319
+ // Each sandbox credential a resource gives the command, which the runner session puts on the requests to its domain
320
+ // while the command runs; a clash with another resource's or the config's throws here, before the command starts.
321
+ const credentials = resourcesCredentials(instances, runner.credentials).map(({ credential }) => credential);
235
322
  await announceAcquired(instances, progress);
236
- await progress.emit({ kind: "command-started", argv: request.argv });
237
- if (control.signal.aborted)
238
- return canceled();
239
- // Test events arrive from a callback that can't wait, so they are emitted in order through a chain.
240
- let testEvents = Promise.resolve();
241
- const sandboxed = await session.runCommand({
323
+ const ran = await runCommandInSandbox(session, {
242
324
  argv: request.argv,
243
325
  runPayload: JSON.stringify(runPayload(resourcesPayload(instances), {
244
326
  testEvents: SANDBOX_TEST_EVENTS_PATH,
245
327
  ...(request.verbose === undefined ? {} : { verbose: request.verbose }),
246
328
  })),
247
- testEvents: {
248
- onLine: (line) => {
249
- const event = parseTestEvent(line);
250
- testEvents = testEvents.then(() => progress.emit(event === undefined ? { kind: "test-event-unreadable" } : { kind: "test", event }));
251
- },
252
- onIncomplete: (message) => {
253
- testEvents = testEvents.then(() => progress.emit({ kind: "test-events-incomplete", message }));
254
- },
255
- },
256
- });
257
- await testEvents;
258
- // Closing on a signal can stop the runner sandbox under the command, so a failed call then is the stop too.
259
- if (sandboxed.kind === "killed" || (sandboxed.kind === "failed" && control.signal.aborted))
260
- return { ...canceledStop(), commandStopped: true };
261
- if (sandboxed.kind === "failed")
262
- return { kind: "runner_failed", failure: sandboxed.failure };
263
- const command = sandboxed.exitCode === null ? { kind: "no-exit-code" } : { kind: "exited", code: sandboxed.exitCode };
264
- await progress.emit({
265
- kind: "command-ended",
266
- command: posix.basename(request.argv[0] ?? ""),
267
- outcome: command,
268
- ms: sandboxed.ms,
269
- });
329
+ credentials,
330
+ }, control.signal, progress);
331
+ if (!ran.ok)
332
+ return ran.outcome;
333
+ const { command } = ran;
270
334
  return {
271
335
  kind: "command-ended",
272
336
  resources: resourcesRan(instances),
@@ -0,0 +1,64 @@
1
+ import type { ChosenSnapshot, RunnerCleanupFacts } from "../runner/index.ts";
2
+ import type { SandboxEndFacts } from "./events.ts";
3
+ import type { ResourceRanRecords } from "./resource.ts";
4
+ import type { RunCleanup, RunStopped } from "./run.ts";
5
+ import type { RanCommand } from "./timing.ts";
6
+ /**
7
+ * How one runner sandbox ended, in the kinds any other run ends with, and one more:
8
+ *
9
+ * - `ran`: its command ran and ended.
10
+ * - a run's stop (`RunStopped`): `canceled` when a signal stopped it; `runner_failed` when its runner sandbox's start,
11
+ * upload, apply, install, build, or command call failed, or a step that runs once failed; `snapshot_gone` when the
12
+ * chosen runner snapshot was gone as its runner sandbox started; `mint_failed` when the run's mint failed;
13
+ * `resource_refused` when a resource's acquire or split refused the run.
14
+ * - `threw`: something in the runner sandbox threw, a mistake in storm, with the error's message.
15
+ */
16
+ export type SandboxEnd = {
17
+ readonly kind: "ran";
18
+ readonly command: RanCommand;
19
+ } | RunStopped | {
20
+ readonly kind: "threw";
21
+ readonly message: string;
22
+ };
23
+ /**
24
+ * One runner sandbox once it ended: its runner sandbox index, its command, how it ended (`end`), its runner sandbox
25
+ * state, exit code, and cause from that, and what closing its runner sandbox scope left (null when its session never
26
+ * opened).
27
+ */
28
+ export interface EndedSandbox extends SandboxEndFacts {
29
+ readonly sandbox: number;
30
+ readonly argv: readonly string[];
31
+ readonly end: SandboxEnd;
32
+ readonly runnerCleanup: RunnerCleanupFacts | null;
33
+ }
34
+ /**
35
+ * Every runner sandbox of a run across runner sandboxes ended, and no signal stopped one: each runner sandbox's end, in
36
+ * order of runner sandbox index (`sandboxes`), the runner snapshot each started from, and what it reports of each
37
+ * acquired resource instance that reports something (`resources`), for the whole run, as a `ran` outcome does. Its
38
+ * `runnerCleanup` sums what every runner sandbox scope of the run couldn't stop or delete, and names no kept runner
39
+ * sandbox of its own: each runner sandbox's is in its own `runnerCleanup`.
40
+ */
41
+ export interface SandboxesRanRun extends RunCleanup {
42
+ readonly kind: "sandboxes_ran";
43
+ readonly sandboxes: readonly EndedSandbox[];
44
+ readonly snapshot: ChosenSnapshot;
45
+ readonly resources: ResourceRanRecords;
46
+ }
47
+ /**
48
+ * How a run across runner sandboxes ended: its runner sandboxes ran (`SandboxesRanRun`), or the run stopped before
49
+ * then, in one of the ways any run stops (`RunStopped`). It never ends as `ran`, which is the outcome of a run's one
50
+ * command.
51
+ */
52
+ export type AcrossSandboxesOutcome = SandboxesRanRun | (RunStopped & RunCleanup);
53
+ /**
54
+ * The status storm exits with once a run's runner sandboxes ran: 0 when every runner sandbox passed, else 1. A cleanup
55
+ * failure never changes it.
56
+ */
57
+ export declare function acrossSandboxesExitStatus(sandboxes: readonly Pick<SandboxEndFacts, "state">[]): number;
58
+ /**
59
+ * A runner sandbox's state, exit code, and cause, from how it ended and whether its command started: a command that
60
+ * started and did not exit 0 is `failed`, a command that never started is `not-started`, and a signal makes the runner
61
+ * sandbox `canceled`. The Sandbox call that runs the command failing means the command started, whether or not its start
62
+ * was heard.
63
+ */
64
+ export declare function sandboxEndFacts(end: SandboxEnd, commandStarted: boolean): SandboxEndFacts;
@@ -0,0 +1,128 @@
1
+ // Pure types and helpers for how a runner sandbox ends, shared by `core/across-sandboxes.ts`, `run-directory/`, and the
2
+ // composition layer: how one runner sandbox ends, the exit status of a run across runner sandboxes, and the one-line
3
+ // cause for a runner sandbox that did not pass.
4
+ import { describeMintFailure } from "../credential/index.js";
5
+ /**
6
+ * The status storm exits with once a run's runner sandboxes ran: 0 when every runner sandbox passed, else 1. A cleanup
7
+ * failure never changes it.
8
+ */
9
+ export function acrossSandboxesExitStatus(sandboxes) {
10
+ return sandboxes.every(({ state }) => state === "passed") ? 0 : 1;
11
+ }
12
+ /**
13
+ * A runner sandbox's state, exit code, and cause, from how it ended and whether its command started: a command that
14
+ * started and did not exit 0 is `failed`, a command that never started is `not-started`, and a signal makes the runner
15
+ * sandbox `canceled`. The Sandbox call that runs the command failing means the command started, whether or not its start
16
+ * was heard.
17
+ */
18
+ export function sandboxEndFacts(end, commandStarted) {
19
+ const short = (cause, failedStage, started = commandStarted) => ({
20
+ state: started ? "failed" : "not-started",
21
+ failedStage,
22
+ exitCode: null,
23
+ cause: oneLine(cause),
24
+ });
25
+ switch (end.kind) {
26
+ case "ran": {
27
+ const { command } = end;
28
+ if (command.kind === "exited")
29
+ return {
30
+ state: command.code === 0 ? "passed" : "failed",
31
+ failedStage: command.code === 0 ? null : "command",
32
+ exitCode: command.code,
33
+ cause: null,
34
+ };
35
+ return {
36
+ state: "failed",
37
+ failedStage: "command",
38
+ exitCode: null,
39
+ cause: command.kind === "signaled" ? `signaled: ${command.signal}` : "no-exit-code",
40
+ };
41
+ }
42
+ case "canceled":
43
+ return { state: "canceled", failedStage: null, exitCode: null, cause: "canceled" };
44
+ case "runner_failed": {
45
+ const { failure } = end;
46
+ const ranCommand = failure.kind === "sandbox-api-failed" && failure.operation === "run-command";
47
+ return short(runnerFailureCause(failure), runnerFailureStage(failure), commandStarted || ranCommand);
48
+ }
49
+ case "mint_failed":
50
+ return short(`mint-failed: ${describeMintFailure(end.failure, end.target).cause}`, "mint");
51
+ case "snapshot_gone":
52
+ return short("snapshot-gone", "snapshot");
53
+ case "spawn_failed":
54
+ return short(`spawn-failed: ${end.message}`, "command");
55
+ case "resource_refused":
56
+ return short(`resource-refused: ${end.resource}: ${end.refusal.message}`, "resource");
57
+ case "threw":
58
+ return short(`threw: ${end.message}`, "storm");
59
+ }
60
+ }
61
+ /** The factual runner stage that failed. */
62
+ function runnerFailureStage(failure) {
63
+ switch (failure.kind) {
64
+ case "snapshot-build-step-failed":
65
+ return "snapshot";
66
+ case "apply-failed":
67
+ return "apply";
68
+ case "install-failed":
69
+ return "install";
70
+ case "build-failed":
71
+ return "build";
72
+ case "checkout-failed":
73
+ return "checkout";
74
+ case "credential-claims-missing":
75
+ return "mint";
76
+ case "sandbox-api-failed":
77
+ switch (failure.operation) {
78
+ case "start-build-sandbox":
79
+ case "save-snapshot":
80
+ return "snapshot";
81
+ case "start-runner-sandbox":
82
+ case "login-path":
83
+ case "run-script":
84
+ return "start";
85
+ case "upload":
86
+ return "upload";
87
+ case "run-command":
88
+ return "command";
89
+ }
90
+ // A policy write fails at the stage it guards: a snapshot build's steps or save, the install and build steps, or
91
+ // the command.
92
+ case "network-policy-failed":
93
+ switch (failure.around) {
94
+ case "snapshot-steps":
95
+ case "snapshot-save":
96
+ return "snapshot";
97
+ case "run-steps":
98
+ return "install";
99
+ case "command":
100
+ return "command";
101
+ }
102
+ }
103
+ }
104
+ /**
105
+ * Why the runner couldn't run a runner sandbox's command, as one line: the failure's kind or the Sandbox call, then
106
+ * what it said.
107
+ */
108
+ function runnerFailureCause(failure) {
109
+ switch (failure.kind) {
110
+ case "sandbox-api-failed":
111
+ return `${failure.operation}: ${failure.message}`;
112
+ case "checkout-failed":
113
+ return `checkout-failed: ${failure.failure.message}`;
114
+ case "credential-claims-missing":
115
+ return `credential-claims-missing: ${failure.target.team}/${failure.target.project}`;
116
+ case "snapshot-build-step-failed":
117
+ case "apply-failed":
118
+ case "install-failed":
119
+ case "build-failed":
120
+ return `${failure.kind}: ${failure.exitCode === null ? "no exit code" : `exited ${failure.exitCode}`}`;
121
+ case "network-policy-failed":
122
+ return `network-policy-failed: ${failure.operation} around ${failure.around}: ${failure.status === null ? "" : `HTTP ${failure.status}: `}${failure.message}`;
123
+ }
124
+ }
125
+ /** `text` as one line: each line break, with the spaces around it, becomes one space. */
126
+ function oneLine(text) {
127
+ return text.trim().replace(/\s*\n\s*/g, " ");
128
+ }
@@ -18,7 +18,7 @@ export interface TimelineStep extends TimelineSpan {
18
18
  }
19
19
  /**
20
20
  * The rows of a waterfall, by name: `mint`, the run's one mint; each resource instance's lane, by its lane's name;
21
- * `runner`, readying the runner sandbox; `tests`, the command; `cleanup`, stopping the runner's
21
+ * `runner`, readying the runner sandbox; `command`, the command; `cleanup`, stopping the runner's
22
22
  * sandboxes and releasing the resources.
23
23
  */
24
24
  export type TimelineRowName = string;
@@ -54,13 +54,13 @@ export interface Timeline {
54
54
  /** From the run's start to its last event. */
55
55
  readonly totalMs: number;
56
56
  /**
57
- * The rows in order: mint, each resource instance's lane in the order the lanes started, runner, tests, cleanup;
57
+ * The rows in order: mint, each resource instance's lane in the order the lanes started, runner, command, cleanup;
58
58
  * each only when the run got that far.
59
59
  */
60
60
  readonly rows: readonly TimelineRow[];
61
61
  /**
62
- * The lane the command waited on, then the command, each by its row: the runner, then the tests, when the runner
63
- * was ready last or ran alone; the tests alone when the run had no lane; empty when the command didn't start.
62
+ * The lane the command waited on, then the command, each by its row: the runner, then the command, when the runner
63
+ * was ready last or ran alone; the command alone when the run had no lane; empty when the command didn't start.
64
64
  */
65
65
  readonly criticalPath: readonly TimelineRowRef[];
66
66
  }
@@ -74,7 +74,7 @@ export function timeline(resources, state) {
74
74
  rows[index] = { ...waited, idleMs: last.readyAt - lane.readyAt };
75
75
  }
76
76
  if (command !== undefined)
77
- rows.push(row(TESTS, command));
77
+ rows.push(row(COMMAND, command));
78
78
  if (cleanup !== undefined)
79
79
  rows.push(row(CLEANUP, cleanup));
80
80
  // The lane the command waited on last: the one ready last when it had two or more, else the first resource lane it
@@ -84,13 +84,13 @@ export function timeline(resources, state) {
84
84
  startedAt: new Date(origin).toISOString(),
85
85
  totalMs,
86
86
  rows,
87
- criticalPath: command === undefined ? [] : waitedOn === undefined ? [TESTS] : [waitedOn, TESTS],
87
+ criticalPath: command === undefined ? [] : waitedOn === undefined ? [COMMAND] : [waitedOn, COMMAND],
88
88
  };
89
89
  }
90
90
  /** The rows no resource instance owns. */
91
91
  const MINT = { name: "mint", resource: null };
92
92
  const RUNNER = { name: "runner", resource: null };
93
- const TESTS = { name: "tests", resource: null };
93
+ const COMMAND = { name: "command", resource: null };
94
94
  const CLEANUP = { name: "cleanup", resource: null };
95
95
  /**
96
96
  * Whether `a` and `b` are the same row: by name, and for a resource instance's lane by the resource key. It takes any
@@ -8,3 +8,10 @@ export declare function mintArgs(target: MintTarget): readonly string[];
8
8
  * soon as it has one.
9
9
  */
10
10
  export declare function liveCredentialGateway(): CredentialGateway;
11
+ /**
12
+ * The environment of a `vercel` invocation: `host` without `VERCEL_TOKEN`, with color and the update notifier off.
13
+ * `vercel` reads `VERCEL_TOKEN` when there's no `--token`, and then ignores its saved login. An inherited token, such
14
+ * as a test account's token that `vtest teams run` hands its command, would make `vercel` mint the credential as that
15
+ * identity, and not as the person or CI job that runs storm.
16
+ */
17
+ export declare function vercelEnvironment(host: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
@@ -31,6 +31,8 @@ export function liveCredentialGateway() {
31
31
  * Runs `vercel` with `args`, with no shell, in `os.tmpdir()` so no linked project in the working directory
32
32
  * changes what it does, with color and the update notifier off and a 30s timeout. Never rejects.
33
33
  *
34
+ * It passes on storm's own environment without `VERCEL_TOKEN` (`vercelEnvironment`).
35
+ *
34
36
  * It uses `execFile`'s callback form rather than `promisify(execFile)`, whose stdout-and-stderr result
35
37
  * depends on `util.promisify.custom`.
36
38
  */
@@ -39,7 +41,7 @@ function runVercel(args) {
39
41
  try {
40
42
  execFile("vercel", args, {
41
43
  cwd: tmpdir(),
42
- env: { ...process.env, NO_COLOR: "1", NO_UPDATE_NOTIFIER: "1" },
44
+ env: vercelEnvironment(process.env),
43
45
  timeout: VERCEL_TIMEOUT_MS,
44
46
  maxBuffer: 16 * 1024 * 1024,
45
47
  encoding: "utf8",
@@ -52,6 +54,17 @@ function runVercel(args) {
52
54
  }
53
55
  });
54
56
  }
57
+ /**
58
+ * The environment of a `vercel` invocation: `host` without `VERCEL_TOKEN`, with color and the update notifier off.
59
+ * `vercel` reads `VERCEL_TOKEN` when there's no `--token`, and then ignores its saved login. An inherited token, such
60
+ * as a test account's token that `vtest teams run` hands its command, would make `vercel` mint the credential as that
61
+ * identity, and not as the person or CI job that runs storm.
62
+ */
63
+ export function vercelEnvironment(host) {
64
+ const env = { ...host, NO_COLOR: "1", NO_UPDATE_NOTIFIER: "1" };
65
+ delete env["VERCEL_TOKEN"];
66
+ return env;
67
+ }
55
68
  function failedRun(error, stdout, stderr) {
56
69
  const fields = typeof error === "object" && error !== null ? error : {};
57
70
  const out = typeof stdout === "string" ? stdout : "";
@@ -5,7 +5,7 @@ import type { Clock } from "../../sdk/extension/index.ts";
5
5
  * GitHub's REST API, the random suffix a run prefix ends with, and the clock its time comes from.
6
6
  */
7
7
  export interface GitHubFixtureRepoContext {
8
- /** The launcher environment, which holds the token in the variable its `tokenEnv` names. */
8
+ /** The launcher environment, which holds the token when `token.source` is `{ kind: "env", name }`. */
9
9
  readonly env: Readonly<Record<string, string | undefined>>;
10
10
  /** GitHub's REST API. */
11
11
  readonly githubFixtureRepos: GitHubFixtureRepoGateway;