@cnc-tools/storm 0.14.1 → 0.15.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 (404) hide show
  1. package/dist/application.js +3 -1
  2. package/dist/bin/storm.js +18 -8
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/chunk-4U4DZ7VG.js +40 -0
  5. package/dist/chunks/{chunk-GSC6SRTW.js → chunk-5CCP36QQ.js} +1 -1
  6. package/dist/chunks/chunk-5GBMR4HM.js +966 -0
  7. package/dist/chunks/{chunk-43MWZLJR.js → chunk-5VXBKPW6.js} +1 -1
  8. package/dist/chunks/{chunk-RA4L2ACU.js → chunk-AWBSONHB.js} +88 -34
  9. package/dist/chunks/{chunk-BRUIATTR.js → chunk-CN4EFA5J.js} +59 -12
  10. package/dist/chunks/{chunk-27P2QSIM.js → chunk-CXAT7ZKP.js} +2 -2
  11. package/dist/chunks/chunk-E4PJNZVG.js +783 -0
  12. package/dist/chunks/{chunk-T6AZIDZD.js → chunk-F6N34UWB.js} +12 -244
  13. package/dist/chunks/{chunk-ZH5R7W4A.js → chunk-KC4KDJ5K.js} +147 -26
  14. package/dist/chunks/{chunk-5ED3IDUJ.js → chunk-L36GBUBB.js} +1652 -681
  15. package/dist/chunks/{chunk-QBR5VHJ7.js → chunk-OX7X4B2L.js} +7 -2
  16. package/dist/chunks/{chunk-Z5OXOZD3.js → chunk-PN5ULTTH.js} +140 -130
  17. package/dist/chunks/chunk-QUHY6FGN.js +108 -0
  18. package/dist/chunks/chunk-QVS7HRU7.js +74 -0
  19. package/dist/chunks/{chunk-UC6DULWY.js → chunk-R7XVBZOY.js} +130 -39
  20. package/dist/chunks/{chunk-YBPTMJUM.js → chunk-RAQEXKL6.js} +1120 -465
  21. package/dist/chunks/{chunk-RKONDLPS.js → chunk-SZEURWRS.js} +446 -52
  22. package/dist/chunks/chunk-TJNFVNKR.js +246 -0
  23. package/dist/chunks/{chunk-BW2ADH7U.js → chunk-VUPZH7J2.js} +1 -1
  24. package/dist/chunks/{chunk-XPCUINWS.js → chunk-XEVHP5ZW.js} +2 -2
  25. package/dist/chunks/{chunk-5TMHYH7G.js → chunk-YV7GE6EV.js} +638 -80
  26. package/dist/chunks/{chunk-GQIL3AHY.js → chunk-ZG3WQ4UF.js} +1 -1
  27. package/dist/chunks/{live-app-FBVWUUMT.js → live-app-PI3BAN6Y.js} +37 -26
  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 +229 -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 +577 -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 +530 -73
  46. package/dist/commands/exec/outcomes.js +202 -66
  47. package/dist/commands/exec/plan-only.d.ts +10 -0
  48. package/dist/commands/exec/plan-only.js +46 -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 +35 -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 +345 -63
  60. package/dist/commands/exec/run-command.js +308 -258
  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 +51 -9
  74. package/dist/commands/runs/facts.js +49 -29
  75. package/dist/commands/runs/list/command.d.ts +80 -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 +40 -2
  79. package/dist/commands/runs/logs/command.d.ts +103 -8
  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 +49 -2
  84. package/dist/commands/runs/logs/outcomes.js +110 -6
  85. package/dist/commands/runs/past-run.d.ts +77 -6
  86. package/dist/commands/runs/past-run.js +133 -4
  87. package/dist/commands/runs/show/command.d.ts +568 -10
  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 +276 -5
  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 +4 -0
  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 +162 -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 +1389 -0
  113. package/dist/commands/test/command.js +583 -0
  114. package/dist/commands/test/metadata.js +8 -0
  115. package/dist/commands/test/outcomes.d.ts +765 -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 +128 -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 +13 -0
  124. package/dist/config/check-runner.js +54 -0
  125. package/dist/config/check-suites.d.ts +14 -0
  126. package/dist/config/check-suites.js +99 -0
  127. package/dist/config/gateways.d.ts +24 -0
  128. package/dist/config/index.d.ts +6 -3
  129. package/dist/config/index.js +3 -1
  130. package/dist/config/live/file-lists-file-gateway.d.ts +4 -0
  131. package/dist/config/live/file-lists-file-gateway.js +27 -0
  132. package/dist/config/load.d.ts +11 -10
  133. package/dist/config/load.js +35 -103
  134. package/dist/config/recipe-run.d.ts +8 -1
  135. package/dist/config/recipe-run.js +2 -1
  136. package/dist/config/resolve.d.ts +3 -2
  137. package/dist/config/resolve.js +6 -3
  138. package/dist/config/resolver.d.ts +20 -6
  139. package/dist/config/resolver.js +11 -8
  140. package/dist/config/runner.d.ts +24 -0
  141. package/dist/config/runner.js +4 -0
  142. package/dist/config/schema.d.ts +26 -18
  143. package/dist/config/schema.js +41 -9
  144. package/dist/config/settings-file.d.ts +9 -3
  145. package/dist/config/settings-file.js +41 -4
  146. package/dist/config/suite.d.ts +39 -0
  147. package/dist/config/suite.js +5 -0
  148. package/dist/config-file/define.d.ts +49 -18
  149. package/dist/config-file/define.js +9 -8
  150. package/dist/config-file/runner.d.ts +12 -0
  151. package/dist/config-file/runner.js +9 -0
  152. package/dist/context.d.ts +13 -8
  153. package/dist/context.js +13 -4
  154. package/dist/core/across-sandboxes.d.ts +43 -0
  155. package/dist/core/across-sandboxes.js +319 -0
  156. package/dist/core/before-run.d.ts +5 -3
  157. package/dist/core/before-run.js +12 -1
  158. package/dist/core/events.d.ts +62 -6
  159. package/dist/core/events.js +14 -0
  160. package/dist/core/index.d.ts +4 -2
  161. package/dist/core/index.js +3 -1
  162. package/dist/core/payload.d.ts +7 -4
  163. package/dist/core/payload.js +10 -4
  164. package/dist/core/presentations.js +1 -1
  165. package/dist/core/resource.d.ts +1 -1
  166. package/dist/core/resources.d.ts +56 -6
  167. package/dist/core/resources.js +81 -5
  168. package/dist/core/run-state.js +9 -0
  169. package/dist/core/run.d.ts +77 -15
  170. package/dist/core/run.js +150 -86
  171. package/dist/core/sandbox-end.d.ts +64 -0
  172. package/dist/core/sandbox-end.js +128 -0
  173. package/dist/core/timeline.d.ts +4 -4
  174. package/dist/core/timeline.js +3 -3
  175. package/dist/credential/live/vercel-cli-gateway.d.ts +7 -0
  176. package/dist/credential/live/vercel-cli-gateway.js +14 -1
  177. package/dist/extensions/github/context.d.ts +1 -1
  178. package/dist/extensions/github/definition.d.ts +11 -9
  179. package/dist/extensions/github/definition.js +8 -6
  180. package/dist/extensions/github/extension.d.ts +3 -3
  181. package/dist/extensions/github/fixture-repo.d.ts +21 -2
  182. package/dist/extensions/github/fixture-repo.js +31 -2
  183. package/dist/extensions/github/index.d.ts +2 -2
  184. package/dist/extensions/github/index.js +2 -2
  185. package/dist/extensions/github/lifecycle.d.ts +16 -6
  186. package/dist/extensions/github/lifecycle.js +42 -25
  187. package/dist/extensions/github/options.d.ts +17 -11
  188. package/dist/extensions/github/options.js +14 -13
  189. package/dist/extensions/github/refusals.d.ts +23 -6
  190. package/dist/extensions/github/refusals.js +34 -12
  191. package/dist/extensions/github/resource.d.ts +21 -12
  192. package/dist/extensions/github/resource.js +16 -8
  193. package/dist/extensions/github/run/payload.d.ts +6 -6
  194. package/dist/extensions/github/run/payload.js +3 -5
  195. package/dist/extensions/github/split.d.ts +10 -0
  196. package/dist/extensions/github/split.js +12 -0
  197. package/dist/extensions/playwright/driver.js +6 -26
  198. package/dist/extensions/playwright/extension.js +1 -1
  199. package/dist/extensions/testserver/commands/pool/create/command.js +8 -8
  200. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  201. package/dist/extensions/testserver/definition.d.ts +4 -4
  202. package/dist/extensions/testserver/definition.js +41 -31
  203. package/dist/extensions/testserver/extension.d.ts +4 -5
  204. package/dist/extensions/testserver/extension.js +14 -41
  205. package/dist/extensions/testserver/index.d.ts +1 -1
  206. package/dist/extensions/testserver/index.js +1 -1
  207. package/dist/extensions/testserver/lifecycle.d.ts +10 -2
  208. package/dist/extensions/testserver/lifecycle.js +29 -6
  209. package/dist/extensions/testserver/options/rules.d.ts +5 -5
  210. package/dist/extensions/testserver/options/rules.js +10 -8
  211. package/dist/extensions/testserver/options/sandboxes.d.ts +4 -2
  212. package/dist/extensions/testserver/options/sandboxes.js +8 -3
  213. package/dist/extensions/testserver/pool/gateways.d.ts +29 -4
  214. package/dist/extensions/testserver/pool/index.d.ts +2 -2
  215. package/dist/extensions/testserver/pool/index.js +1 -1
  216. package/dist/extensions/testserver/pool/lease.d.ts +10 -0
  217. package/dist/extensions/testserver/pool/lease.js +21 -0
  218. package/dist/extensions/testserver/pool/live/pool-store-gateway.js +38 -3
  219. package/dist/extensions/testserver/refusals.d.ts +12 -0
  220. package/dist/extensions/testserver/refusals.js +18 -0
  221. package/dist/extensions/testserver/release.d.ts +16 -0
  222. package/dist/extensions/testserver/release.js +56 -4
  223. package/dist/extensions/testserver/resource.d.ts +4 -4
  224. package/dist/extensions/testserver/resource.js +1 -1
  225. package/dist/extensions/testserver/split.d.ts +9 -0
  226. package/dist/extensions/testserver/split.js +22 -0
  227. package/dist/extensions/testserver/vitest/fixtures.d.ts +5 -5
  228. package/dist/extensions/testserver/vitest/fixtures.js +9 -38
  229. package/dist/extensions/vitest/driver.d.ts +7 -0
  230. package/dist/extensions/vitest/driver.js +33 -37
  231. package/dist/extensions/vitest/extension.js +1 -1
  232. package/dist/extensions/vitest/plan/plan-over.d.ts +8 -1
  233. package/dist/extensions/vitest/plan/plan-over.js +16 -2
  234. package/dist/extensions.d.ts +17 -16
  235. package/dist/extensions.js +5 -4
  236. package/dist/forward-sigterm.js +1 -1
  237. package/dist/launcher-resolvers/local-services.d.ts +1 -1
  238. package/dist/live-app.d.ts +3 -1
  239. package/dist/live-app.js +9 -5
  240. package/dist/local-services.js +1 -1
  241. package/dist/planning/driver-file-lists.d.ts +61 -0
  242. package/dist/planning/driver-file-lists.js +66 -0
  243. package/dist/{commands/exec → planning}/driver-refusals.d.ts +11 -10
  244. package/dist/{commands/exec → planning}/driver-refusals.js +18 -14
  245. package/dist/planning/file-lists-file.d.ts +58 -0
  246. package/dist/planning/file-lists-file.js +105 -0
  247. package/dist/planning/file-lists.d.ts +28 -0
  248. package/dist/planning/file-lists.js +52 -0
  249. package/dist/{commands/exec → planning}/final-results.d.ts +1 -1
  250. package/dist/{commands/exec → planning}/final-results.js +6 -6
  251. package/dist/planning/plan-only.d.ts +81 -0
  252. package/dist/planning/plan-only.js +83 -0
  253. package/dist/{commands/exec → planning}/redaction.d.ts +2 -2
  254. package/dist/{commands/exec → planning}/redaction.js +5 -4
  255. package/dist/{commands/exec → planning}/resource-flags.d.ts +5 -12
  256. package/dist/{commands/exec → planning}/resource-flags.js +6 -16
  257. package/dist/planning/run-kind-flags.d.ts +20 -0
  258. package/dist/planning/run-kind-flags.js +48 -0
  259. package/dist/planning/run-plan.d.ts +30 -0
  260. package/dist/planning/run-plan.js +4 -0
  261. package/dist/planning/sandbox-placeholders.d.ts +22 -0
  262. package/dist/planning/sandbox-placeholders.js +60 -0
  263. package/dist/planning/suite-not-found.d.ts +37 -0
  264. package/dist/planning/suite-not-found.js +36 -0
  265. package/dist/planning/suites.d.ts +43 -0
  266. package/dist/planning/suites.js +89 -0
  267. package/dist/{commands/exec → planning}/test-plan.d.ts +8 -3
  268. package/dist/{commands/exec → planning}/test-plan.js +32 -4
  269. package/dist/playwright/reporter.d.ts +20 -8
  270. package/dist/playwright/reporter.js +195 -15
  271. package/dist/presentation.d.ts +10 -6
  272. package/dist/presentation.js +13 -15
  273. package/dist/run-directory/gateways.d.ts +60 -4
  274. package/dist/run-directory/index.d.ts +4 -4
  275. package/dist/run-directory/index.js +2 -1
  276. package/dist/run-directory/live/run-directory-gateway.js +92 -16
  277. package/dist/run-directory/plan.d.ts +35 -2
  278. package/dist/run-directory/plan.js +44 -7
  279. package/dist/run-directory/reader.d.ts +26 -5
  280. package/dist/run-directory/reader.js +24 -1
  281. package/dist/run-directory/recording.d.ts +75 -49
  282. package/dist/run-directory/recording.js +214 -28
  283. package/dist/run-directory/run-directory.d.ts +22 -1
  284. package/dist/run-directory/run-directory.js +24 -0
  285. package/dist/run-directory/run-record.d.ts +144 -21
  286. package/dist/run-directory/run-record.js +118 -19
  287. package/dist/run-directory/timeline-facts.js +4 -4
  288. package/dist/runner/build-snapshots.d.ts +7 -7
  289. package/dist/runner/build-snapshots.js +12 -16
  290. package/dist/runner/events.d.ts +29 -8
  291. package/dist/runner/gateways.d.ts +59 -8
  292. package/dist/runner/index.d.ts +6 -4
  293. package/dist/runner/index.js +3 -2
  294. package/dist/runner/live/sandbox-gateway.js +177 -33
  295. package/dist/runner/live/terminal.d.ts +15 -3
  296. package/dist/runner/live/terminal.js +25 -3
  297. package/dist/runner/network-policy.d.ts +55 -0
  298. package/dist/runner/network-policy.js +46 -0
  299. package/dist/runner/policy-writes.d.ts +40 -0
  300. package/dist/runner/policy-writes.js +124 -0
  301. package/dist/runner/prepare.d.ts +6 -7
  302. package/dist/runner/ready.d.ts +39 -10
  303. package/dist/runner/ready.js +59 -47
  304. package/dist/runner/recipe-check.d.ts +6 -0
  305. package/dist/runner/recipe-check.js +29 -0
  306. package/dist/runner/recipe-secrets.d.ts +67 -0
  307. package/dist/runner/recipe-secrets.js +230 -0
  308. package/dist/runner/recipe.d.ts +118 -28
  309. package/dist/runner/recipe.js +147 -154
  310. package/dist/runner/sandboxed-command.d.ts +24 -10
  311. package/dist/runner/sandboxed-command.js +37 -12
  312. package/dist/runner/scope.d.ts +107 -21
  313. package/dist/runner/scope.js +274 -54
  314. package/dist/runner/secrets.d.ts +42 -31
  315. package/dist/runner/secrets.js +62 -40
  316. package/dist/runner/session.d.ts +59 -26
  317. package/dist/runner/session.js +82 -41
  318. package/dist/runner/snapshot-build.d.ts +7 -4
  319. package/dist/runner/snapshot-build.js +48 -28
  320. package/dist/runner/snapshot-choice.d.ts +37 -0
  321. package/dist/runner/snapshot-choice.js +38 -0
  322. package/dist/runner/snapshot-key.d.ts +16 -14
  323. package/dist/runner/snapshot-key.js +24 -18
  324. package/dist/runner/steps.d.ts +13 -5
  325. package/dist/runner/steps.js +34 -4
  326. package/dist/runner/time-limit.d.ts +10 -0
  327. package/dist/runner/time-limit.js +43 -0
  328. package/dist/sdk/extension/commands.d.ts +1 -7
  329. package/dist/sdk/extension/driver.d.ts +39 -46
  330. package/dist/sdk/extension/driver.js +6 -6
  331. package/dist/sdk/extension/index.d.ts +3 -3
  332. package/dist/sdk/extension/index.js +3 -4
  333. package/dist/sdk/extension/lifecycle.d.ts +52 -9
  334. package/dist/sdk/extension/lifecycle.js +1 -1
  335. package/dist/sdk/extension/resource-definition.d.ts +13 -10
  336. package/dist/sdk/extension/resource-definition.js +7 -2
  337. package/dist/sdk/extension/resource.d.ts +2 -2
  338. package/dist/sdk/extension/secret-source.d.ts +58 -0
  339. package/dist/sdk/extension/secret-source.js +78 -0
  340. package/dist/sdk/index.d.ts +2 -2
  341. package/dist/sdk/index.js +1 -1
  342. package/dist/sdk/run/launcher.d.ts +1 -1
  343. package/dist/sdk/run/launcher.js +1 -1
  344. package/dist/sdk/run/payload.d.ts +16 -1
  345. package/dist/sdk/run/payload.js +17 -2
  346. package/dist/sdk/run/redact.js +2 -2
  347. package/dist/sdk/run/test-events.d.ts +23 -6
  348. package/dist/sdk/run/test-events.js +6 -4
  349. package/dist/sdk/run/test-result-writer.d.ts +8 -3
  350. package/dist/sdk/run/test-result-writer.js +22 -2
  351. package/dist/{commands/exec → shared}/cleanup.d.ts +3 -3
  352. package/dist/{commands/exec → shared}/cleanup.js +11 -6
  353. package/dist/shared/job-summary.d.ts +19 -0
  354. package/dist/{commands/exec → shared}/job-summary.js +17 -0
  355. package/dist/shared/sandbox-table.d.ts +48 -0
  356. package/dist/shared/sandbox-table.js +109 -0
  357. package/dist/{commands/exec → shared}/snapshot-text.d.ts +1 -1
  358. package/dist/{commands/exec → shared}/tests-summary.d.ts +22 -6
  359. package/dist/{commands/exec → shared}/tests-summary.js +74 -31
  360. package/dist/{commands/exec → shared}/text.d.ts +7 -2
  361. package/dist/{commands/exec → shared}/text.js +9 -1
  362. package/dist/{commands/exec → shared}/waterfall.d.ts +8 -6
  363. package/dist/{commands/exec → shared}/waterfall.js +71 -24
  364. package/dist/shared/worker-chart.d.ts +172 -0
  365. package/dist/shared/worker-chart.js +623 -0
  366. package/dist/vitest/config.d.ts +35 -11
  367. package/dist/vitest/config.js +47 -14
  368. package/dist/vitest/index.d.ts +1 -1
  369. package/dist/vitest/index.js +3 -3
  370. package/dist/vitest/sequencer.d.ts +23 -0
  371. package/dist/vitest/sequencer.js +73 -0
  372. package/dist/vitest/setup.d.ts +1 -0
  373. package/dist/vitest/setup.js +34 -0
  374. package/dist/vitest/test-events.d.ts +32 -6
  375. package/dist/vitest/test-events.js +25 -5
  376. package/dist/vitest/test-results.d.ts +8 -3
  377. package/dist/vitest/test-results.js +6 -0
  378. package/package.json +7 -2
  379. package/skills/overview.md +21 -17
  380. package/skills/plan-runs.md +67 -0
  381. package/skills/read-run-output.md +51 -19
  382. package/dist/chunks/chunk-BFLYGMG3.js +0 -607
  383. package/dist/chunks/chunk-HOKDKP5A.js +0 -49
  384. package/dist/chunks/chunk-IVRRGGCD.js +0 -201
  385. package/dist/chunks/chunk-NMVODY3P.js +0 -19
  386. package/dist/commands/exec/define-run-command.d.ts +0 -671
  387. package/dist/commands/exec/define-run-command.js +0 -91
  388. package/dist/commands/exec/job-summary.d.ts +0 -10
  389. package/dist/commands/exec/worker-chart.d.ts +0 -87
  390. package/dist/commands/exec/worker-chart.js +0 -343
  391. package/dist/commands/playwright/command.d.ts +0 -661
  392. package/dist/commands/playwright/command.js +0 -31
  393. package/dist/commands/playwright/metadata.js +0 -8
  394. package/dist/commands/vitest/command.d.ts +0 -662
  395. package/dist/commands/vitest/command.js +0 -31
  396. package/dist/commands/vitest/metadata.js +0 -8
  397. package/dist/sdk/extension/ci.d.ts +0 -2
  398. package/dist/sdk/extension/ci.js +0 -6
  399. package/dist/chunks/{chunk-YM6TZV4L.js → chunk-VL7WFTVQ.js} +52 -52
  400. package/dist/commands/{playwright → suites}/metadata.d.ts +1 -1
  401. package/dist/commands/{vitest → test}/metadata.d.ts +1 -1
  402. /package/dist/{commands → shared}/dashboard.d.ts +0 -0
  403. /package/dist/{commands → shared}/dashboard.js +0 -0
  404. /package/dist/{commands/exec → shared}/snapshot-text.js +0 -0
@@ -2,13 +2,10 @@ import {
2
2
  versionText
3
3
  } from "./chunk-I5GZLOLQ.js";
4
4
  import {
5
- redactStrings,
6
- redactingObserver,
7
- redactingTerminal,
8
- redactor
9
- } from "./chunk-27P2QSIM.js";
10
- import {
5
+ comparedPath,
11
6
  criticalPathStep,
7
+ fileListMismatchText,
8
+ hasPoorParallelism,
12
9
  recordedPlan,
13
10
  resourceFlagFields,
14
11
  resourceFlagProblems,
@@ -17,26 +14,40 @@ import {
17
14
  testsChart,
18
15
  testsSummaryLines,
19
16
  waterfallLines
20
- } from "./chunk-BFLYGMG3.js";
17
+ } from "./chunk-5GBMR4HM.js";
18
+ import {
19
+ DEFINITION_SET
20
+ } from "./chunk-PN5ULTTH.js";
21
+ import {
22
+ redactStrings,
23
+ redactingObserver,
24
+ redactingTerminal,
25
+ redactor
26
+ } from "./chunk-CXAT7ZKP.js";
21
27
  import {
22
28
  builtAtText,
23
29
  rejectionLines,
24
30
  snapshotCacheNoteText
25
- } from "./chunk-XPCUINWS.js";
31
+ } from "./chunk-XEVHP5ZW.js";
26
32
  import {
27
- DEFINITION_SET,
28
- RESOURCES
29
- } from "./chunk-Z5OXOZD3.js";
33
+ NodeSignalCancellation
34
+ } from "./chunk-VUPZH7J2.js";
30
35
  import {
31
- sandboxConnectPage
32
- } from "./chunk-NMVODY3P.js";
36
+ SANDBOX_TABLE_HEADER,
37
+ sandboxConnectPage,
38
+ sandboxTableRows,
39
+ sandboxTotalsLine
40
+ } from "./chunk-QUHY6FGN.js";
33
41
  import {
42
+ planSchema,
34
43
  recordRun,
44
+ sandboxRecordSchema,
35
45
  timelineSchema
36
- } from "./chunk-RKONDLPS.js";
46
+ } from "./chunk-SZEURWRS.js";
37
47
  import {
38
48
  isoSecondsText,
39
49
  keepTimeText,
50
+ orderText,
40
51
  paint,
41
52
  releaseText,
42
53
  seconds,
@@ -46,7 +57,7 @@ import {
46
57
  truncate,
47
58
  visibleLength,
48
59
  withArticle
49
- } from "./chunk-QBR5VHJ7.js";
60
+ } from "./chunk-OX7X4B2L.js";
50
61
  import {
51
62
  EMPTY_RUN_STATE,
52
63
  cleanupProblems,
@@ -59,70 +70,36 @@ import {
59
70
  setupPhaseWords,
60
71
  timedProgress,
61
72
  warningTally
62
- } from "./chunk-5TMHYH7G.js";
73
+ } from "./chunk-YV7GE6EV.js";
63
74
  import {
64
- RUNNER_SECRET_MIN_LENGTH,
75
+ MAX_RUNNER_SANDBOXES,
65
76
  configErrors,
66
77
  credentialErrors,
67
78
  fileSettings,
68
79
  invalidConfig,
69
- loadSettingsFile,
70
80
  mintTargetText,
71
81
  parseKeepTime,
72
82
  prepareRunner,
73
- readRunnerSecrets,
83
+ readCredentials,
84
+ readUnsafeSecretEnvVars,
74
85
  recipeRun,
75
86
  requireTarget,
76
87
  settleCredential,
77
88
  settleRunResources
78
- } from "./chunk-5ED3IDUJ.js";
89
+ } from "./chunk-L36GBUBB.js";
79
90
  import {
91
+ SECRET_MIN_LENGTH,
80
92
  describeMintFailure,
81
- isCi
82
- } from "./chunk-RA4L2ACU.js";
83
- import {
84
- NodeSignalCancellation
85
- } from "./chunk-BW2ADH7U.js";
93
+ optionKeyPath
94
+ } from "./chunk-AWBSONHB.js";
86
95
  import {
87
96
  defineErrors,
88
97
  defineOutcomes,
89
98
  refused,
90
99
  renderOutcome
91
- } from "./chunk-YM6TZV4L.js";
92
-
93
- // src/commands/exec/exec-words.ts
94
- var EXEC_HELP = {
95
- usage: "-- <command...>",
96
- args: "The command to run, after --, as an argument list with no shell. Unsandboxed, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR when neither is set; in a sandboxed run, the runner recipe's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR when that env sets neither, with paths under the repository's root rewritten.",
97
- verbose: "which asks the command to print what each test does as it happens, for passing tests too",
98
- examples: [
99
- {
100
- argv: "-- pnpm test",
101
- description: "Run the package's test script in a runner sandbox, with the runner recipe, team, project and resources from storm.config.ts."
102
- },
103
- {
104
- argv: "--keep-sandbox 2h -- pnpm test",
105
- description: "Run the tests in a runner sandbox and keep it running 2 hours after the run, to debug in it."
106
- },
107
- {
108
- argv: "--unsandboxed -- node scripts/smoke.mjs",
109
- description: "Run a Node.js script on this machine, with the resources storm.config.ts declares, if any."
110
- }
111
- ]
112
- };
113
- var EXEC_HINTS = {
114
- // The command's test runner reported no final result. Which one it is the launcher can't tell, so the hint names
115
- // storm's reporter for each: the Vitest one and the Playwright one, by their published paths.
116
- noFinalResults: "add storm's reporter to the test runner's config (stormReporter() from @vercel/storm/vitest/config for Vitest, @vercel/storm/playwright/reporter for Playwright)",
117
- // The command may run no test at all, so the steps say they apply if it does, and name storm's reporter for each test
118
- // runner, under either npm name.
119
- addReporter: [
120
- `If the command runs tests, add storm's reporter to its test runner's config: for Vitest, set test.reporters to stormReporters() from "@vercel/storm/vitest/config"; for Playwright, add ["@vercel/storm/playwright/reporter"] to the reporter list. In a package that installs storm as @cnc-tools/storm, use "@cnc-tools/storm/vitest/config" or "@cnc-tools/storm/playwright/reporter".`,
121
- "Remove any --reporter from the test runner's arguments, since it replaces the config's reporters, storm's among them. Then run the same storm exec command again."
122
- ]
123
- };
100
+ } from "./chunk-VL7WFTVQ.js";
124
101
 
125
- // src/commands/exec/cleanup.ts
102
+ // src/shared/cleanup.ts
126
103
  import { z } from "zod";
127
104
  var notStoppedSchema = z.object({
128
105
  name: z.string(),
@@ -160,7 +137,7 @@ function notDeletedText(sandbox) {
160
137
  return `Stopped the ${sandboxRole(sandbox.role)} ${sandbox.name}, but couldn't delete it: ${sandbox.message}. It stays listed in the Vercel project.`;
161
138
  }
162
139
  function keptText(kept) {
163
- return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, so you can connect to it: ${kept.url}`;
140
+ return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, with no network access, so you can connect to it: ${kept.url}`;
164
141
  }
165
142
  function notKeptText(sandbox) {
166
143
  return `Couldn't keep the runner sandbox ${sandbox.name} running: ${sandbox.message}. Stopped and deleted it instead.`;
@@ -169,8 +146,13 @@ function runnerCleanupRows(cleanup) {
169
146
  if (cleanup === null) return [];
170
147
  const { kept, notKept } = cleanup;
171
148
  return [
172
- ...kept === null ? [] : [["Sandbox kept", [`${kept.name}, running until ${isoSecondsText(kept.stopsAt)}`, kept.url]]],
173
- ...notKept === null ? [] : [["Sandbox not kept", notKeptText(notKept)]],
149
+ ...kept === null ? [] : [
150
+ [
151
+ "Runner sandbox kept",
152
+ [`${kept.name}, running until ${isoSecondsText(kept.stopsAt)}, with no network access`, kept.url]
153
+ ]
154
+ ],
155
+ ...notKept === null ? [] : [["Runner sandbox not kept", notKeptText(notKept)]],
174
156
  ...cleanup.notStopped.length === 0 ? [] : [["Sandboxes not stopped", cleanup.notStopped.map(notStoppedText)]],
175
157
  ...cleanup.notDeleted.length === 0 ? [] : [["Sandboxes not deleted", cleanup.notDeleted.map(notDeletedText)]]
176
158
  ];
@@ -222,9 +204,9 @@ function runnerCleanupOf(report) {
222
204
  }
223
205
 
224
206
  // src/commands/exec/outcomes.ts
225
- import { z as z4 } from "zod";
207
+ import { z as z6 } from "zod";
226
208
 
227
- // src/commands/exec/final-results.ts
209
+ // src/planning/final-results.ts
228
210
  function lacksFinalResults(exitCode, read) {
229
211
  return exitCode === 0 && read.collected && read.finalResults === 0 && !read.partial;
230
212
  }
@@ -237,19 +219,82 @@ function noFinalResultsContent(noFinalTestResults, hints) {
237
219
  };
238
220
  }
239
221
 
240
- // src/commands/exec/mint-failed.ts
222
+ // src/planning/plan-only.ts
241
223
  import { z as z2 } from "zod";
224
+ var plannedOptionSchema = z2.object({
225
+ /** The option's key path, `resources.<key>.<option>`. */
226
+ path: z2.string(),
227
+ /** Its value; a value that is not a string, a number, or a boolean as its JSON text. */
228
+ value: z2.union([z2.string(), z2.number(), z2.boolean()]),
229
+ /** Where the value came from: its flag (`flag`), storm.config.ts (`file`), or its default (`default`). */
230
+ from: z2.enum(["flag", "file", "default"])
231
+ });
232
+ var plannedSchema = z2.object({
233
+ version: z2.string(),
234
+ commit: z2.string().nullable(),
235
+ configFile: z2.string().nullable(),
236
+ argv: z2.array(z2.string()),
237
+ plan: planSchema.nullable(),
238
+ testFiles: z2.array(z2.string()).nullable(),
239
+ runnerSandboxes: z2.object({ max: z2.number(), default: z2.union([z2.number(), z2.literal("function")]).nullable() }).nullable(),
240
+ sandboxes: z2.array(z2.object({ sandbox: z2.number(), argv: z2.array(z2.string()), files: z2.array(z2.string()).nullable() })).nullable(),
241
+ options: z2.array(plannedOptionSchema),
242
+ vcpus: z2.number().nullable()
243
+ });
244
+ function plannedSecrets(lifecycles, where, resources) {
245
+ return [...lifecycles.secrets(resources), ...where.kind === "runner" ? where.secrets : []];
246
+ }
247
+ function buildPlannedFacts(input) {
248
+ const { where, sandboxes, resources, lifecycles } = input;
249
+ const policy = where.kind === "runner" ? where.recipe.sandboxes : void 0;
250
+ const basePlan = recordedPlan(input.testPlan, input.planOptions);
251
+ const plan = sandboxes !== void 0 ? {
252
+ ...basePlan ?? { options: [] },
253
+ options: (basePlan?.options ?? []).map((option) => ({ ...option })),
254
+ sandboxes: { ...sandboxes.count }
255
+ } : basePlan === void 0 ? null : { ...basePlan, options: basePlan.options.map((option) => ({ ...option })) };
256
+ const facts = {
257
+ version: input.version,
258
+ commit: input.commit,
259
+ configFile: input.configFile,
260
+ argv: [...input.argv],
261
+ plan,
262
+ testFiles: input.testFiles === void 0 ? null : [...input.testFiles],
263
+ runnerSandboxes: policy === void 0 ? null : {
264
+ max: policy.max,
265
+ default: policy.default === void 0 ? null : typeof policy.default === "function" ? "function" : policy.default
266
+ },
267
+ sandboxes: sandboxes === void 0 ? null : sandboxes.sandboxes.map(({ argv, files }, index) => ({
268
+ sandbox: index,
269
+ argv: [...argv],
270
+ files: files === null ? null : [...files]
271
+ })),
272
+ options: Object.entries(resources).flatMap(
273
+ ([key, { options, sources }]) => Object.entries(options).map(([option, value]) => ({
274
+ path: optionKeyPath(key, option),
275
+ value: typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? value : JSON.stringify(value) ?? String(value),
276
+ from: sources[option] ?? "default"
277
+ }))
278
+ ),
279
+ vcpus: input.vcpus
280
+ };
281
+ const redact = redactor(plannedSecrets(lifecycles, where, resources));
282
+ return redactStrings(facts, redact);
283
+ }
284
+
285
+ // src/commands/exec/mint-failed.ts
286
+ import { z as z3 } from "zod";
242
287
  var mintFailedErrors = defineErrors({
243
288
  mintFailed: {
244
289
  exitCode: 1,
245
- description: "The vercel CLI couldn't mint a credential, so the command didn't run. In a sandboxed run, the credential was for the runner sandbox, which always needs one; in an unsandboxed run, for a resource that couldn't go on without it.",
246
- schema: z2.object({
247
- team: z2.string(),
248
- project: z2.string(),
249
- cause: z2.string(),
250
- fix: z2.string(),
290
+ description: "The vercel CLI couldn't mint a credential, so the command didn't run. With the Vercel Sandbox runner, the credential was for the runner sandbox, which always needs one; on the launch machine, for a resource that couldn't go on without it.",
291
+ schema: z3.object({
292
+ team: z3.string(),
293
+ project: z3.string(),
294
+ cause: z3.string(),
295
+ fix: z3.string(),
251
296
  /** Whether the credential was for the runner sandbox, not for a resource. */
252
- runner: z2.boolean(),
297
+ runner: z3.boolean(),
253
298
  /** What the run couldn't clean up. */
254
299
  cleanup: RUN_CLEANUP.schema
255
300
  }),
@@ -264,15 +309,42 @@ var mintFailedErrors = defineErrors({
264
309
  }
265
310
  });
266
311
 
312
+ // src/commands/exec/planned-outcome.ts
313
+ var PLANNED_DESCRIPTION = "With --plan-only: storm did the local checks and the plan step, and printed the planned run. It minted nothing, acquired no resource, started no sandbox, and opened no run directory. Each refusal a run gets before it mints, --plan-only gets too.";
314
+ function plannedText(planned) {
315
+ const files = (n) => `${n} test ${n === 1 ? "file" : "files"}`;
316
+ return [
317
+ ...planned.plan === null ? [] : [testPlanLine(planned.plan)],
318
+ ...(planned.sandboxes ?? []).map(
319
+ ({ sandbox, argv, files: list }) => `runner sandbox ${sandbox}: ${list === null ? argv.join(" ") : files(list.length)}`
320
+ ),
321
+ ...planned.sandboxes === null ? [`command: ${planned.argv.join(" ")}`] : [],
322
+ ...planned.vcpus === null ? [] : [
323
+ planned.sandboxes === null ? `runner sandbox: ${planned.vcpus} vCPUs` : `runner sandboxes: ${planned.vcpus} vCPUs each`
324
+ ],
325
+ ...planned.runnerSandboxes === null || planned.runnerSandboxes.default === null ? [] : [
326
+ `runner.sandboxes: default ${planned.runnerSandboxes.default === "function" ? "a function of the test plan" : planned.runnerSandboxes.default}, max ${planned.runnerSandboxes.max}`
327
+ ],
328
+ ...planned.options.map(({ path, value, from }) => `${path}: ${String(value)} (${from})`)
329
+ ].join("\n");
330
+ }
331
+ function renderPlanned(planned) {
332
+ return renderOutcome({
333
+ text: plannedText(planned),
334
+ message: "Nothing was minted, acquired, or started.",
335
+ next: [{ type: "text", text: "Run the same command without --plan-only to start the run." }]
336
+ });
337
+ }
338
+
267
339
  // src/commands/exec/resource-refusals.ts
268
- import { z as z3 } from "zod";
340
+ import { z as z4 } from "zod";
269
341
  var refusalShape = {
270
342
  /** The resource instance that refused, by its resource key. */
271
- resource: z3.string().min(1),
343
+ resource: z4.string().min(1),
272
344
  /** The resource's own snake_case reason for refusing. */
273
- refusal: z3.string(),
345
+ refusal: z4.string(),
274
346
  /** The resource's own data about the refusal, which differs by resource and reason. */
275
- data: z3.record(z3.string(), z3.unknown())
347
+ data: z4.record(z4.string(), z4.unknown())
276
348
  };
277
349
  function contentOf({ message, next, rows: own = [] }, rows) {
278
350
  const all = [...own, ...rows];
@@ -282,17 +354,17 @@ var resourceRefusalErrors = defineErrors({
282
354
  resourceRefusedBeforeRun: {
283
355
  exitCode: 2,
284
356
  description: "A resource's beforeRun refused the run before it started, so nothing was minted, acquired or started. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
285
- schema: z3.object({
357
+ schema: z4.object({
286
358
  ...refusalShape,
287
359
  /** The config file that applied (its absolute path); null when none did. */
288
- configFile: z3.string().nullable()
360
+ configFile: z4.string().nullable()
289
361
  }),
290
362
  render: (_data, refusal) => contentOf(refusal, [])
291
363
  },
292
364
  resourceRefused: {
293
365
  exitCode: 1,
294
366
  description: "A resource refused while the run acquired its resources, so the command didn't run. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
295
- schema: z3.object({
367
+ schema: z4.object({
296
368
  ...refusalShape,
297
369
  /** What the run couldn't clean up. */
298
370
  cleanup: RUN_CLEANUP.schema
@@ -315,38 +387,372 @@ function resourceRefused(outcome, cleanup) {
315
387
  );
316
388
  }
317
389
 
390
+ // src/commands/exec/across-sandboxes-outcomes.ts
391
+ import { z as z5 } from "zod";
392
+
393
+ // src/planning/file-lists-file.ts
394
+ import { isAbsolute, resolve } from "node:path";
395
+ async function readFileListsFile(gateway, request) {
396
+ const { path, cwd, sandboxes } = request;
397
+ const resolvedPath = path === "-" ? "-" : isAbsolute(path) ? path : resolve(cwd, path);
398
+ const read = await gateway.readFileListsFile({ path: resolvedPath });
399
+ if (read.kind !== "read") return { ok: false, kind: "unreadable", path, problem: read.kind, message: read.message };
400
+ const lists = fileListsOf(read.value);
401
+ if (!lists.ok) return { ok: false, kind: "unreadable", path, problem: "not-lists", message: lists.problem };
402
+ const problems = fileListsProblems(lists.lists, sandboxes);
403
+ if (problems.length > 0) return { ok: false, kind: "invalid", path, problems };
404
+ return { ok: true, lists: { path, lists: lists.lists } };
405
+ }
406
+ function fileListsOf(value) {
407
+ const shape = "an array with one array of test file paths for each runner sandbox";
408
+ if (!Array.isArray(value)) return { ok: false, problem: `holds ${describe(value)}, not ${shape}` };
409
+ if (value.length === 0) return { ok: false, problem: `holds an empty array, not ${shape}, at least one` };
410
+ const lists = [];
411
+ for (const [index, list] of value.entries()) {
412
+ if (!Array.isArray(list))
413
+ return {
414
+ ok: false,
415
+ problem: `holds ${describe(list)} as the list of runner sandbox ${index}, not an array of paths`
416
+ };
417
+ const bad = list.findIndex((file) => typeof file !== "string" || file === "");
418
+ if (bad !== -1)
419
+ return {
420
+ ok: false,
421
+ problem: `holds ${describe(list[bad])} in the list of runner sandbox ${index}, at item ${bad + 1}, not a test file's path`
422
+ };
423
+ lists.push(list);
424
+ }
425
+ return { ok: true, lists };
426
+ }
427
+ function describe(value) {
428
+ if (value === null) return "null";
429
+ if (Array.isArray(value)) return "an array";
430
+ if (typeof value === "string") return value === "" ? "an empty string" : `the string ${JSON.stringify(value)}`;
431
+ if (typeof value === "object") return "an object";
432
+ return `${typeof value} ${JSON.stringify(value) ?? typeof value}`;
433
+ }
434
+ function fileListsProblems(lists, sandboxes) {
435
+ const named = /* @__PURE__ */ new Map();
436
+ lists.forEach((list, index) => {
437
+ for (const file of list) {
438
+ const key = comparedPath(file);
439
+ named.set(key, [...named.get(key) ?? [], index]);
440
+ }
441
+ });
442
+ return [
443
+ ...lists.flatMap((list, index) => list.length === 0 ? [{ kind: "empty-list", sandbox: index }] : []),
444
+ ...[...named].flatMap(
445
+ ([file, at]) => at.length > 1 ? [{ kind: "in-two-lists", file, sandboxes: at }] : []
446
+ ),
447
+ ...sandboxes !== void 0 && sandboxes !== lists.length ? [{ kind: "count-mismatch", lists: lists.length, sandboxes }] : []
448
+ ];
449
+ }
450
+ function numbersText(numbers) {
451
+ const words = numbers.map(String);
452
+ if (words.length <= 2) return words.join(" and ");
453
+ return `${words.slice(0, -1).join(", ")}, and ${words.at(-1) ?? ""}`;
454
+ }
455
+ function fileListsProblemText(problem) {
456
+ switch (problem.kind) {
457
+ case "empty-list":
458
+ return `The list of runner sandbox ${problem.sandbox} holds no test file.`;
459
+ case "in-two-lists": {
460
+ const distinct = [...new Set(problem.sandboxes)];
461
+ return distinct.length === 1 ? `${problem.file} is in the list of runner sandbox ${distinct[0] ?? ""} ${problem.sandboxes.length} times.` : `${problem.file} is in the lists of runner sandboxes ${numbersText(problem.sandboxes)}.`;
462
+ }
463
+ case "count-mismatch":
464
+ return `The file holds ${problem.lists} ${problem.lists === 1 ? "list" : "lists"}, and --sandboxes asks for ${problem.sandboxes} ${problem.sandboxes === 1 ? "runner sandbox" : "runner sandboxes"}.`;
465
+ }
466
+ }
467
+ function resolveCallerFileLists(testFiles, caller) {
468
+ const listed2 = new Map(testFiles.map((file) => [comparedPath(file), file]));
469
+ const unlisted = caller.lists.flat().filter((file) => !listed2.has(comparedPath(file)));
470
+ if (unlisted.length > 0) return { ok: false, unlisted, listed: listed2.size };
471
+ const lists = caller.lists.map((list) => list.map((file) => listed2.get(comparedPath(file)) ?? file));
472
+ const held = lists.reduce((sum, list) => sum + list.length, 0);
473
+ return { ok: true, lists, leftOut: listed2.size - held };
474
+ }
475
+
476
+ // src/commands/exec/across-sandboxes-outcomes.ts
477
+ var keptSandboxSchema = z5.object({
478
+ sandbox: z5.number(),
479
+ name: z5.string(),
480
+ stopsAt: z5.string(),
481
+ url: z5.string()
482
+ });
483
+ var notKeptSandboxSchema = z5.object({ sandbox: z5.number(), name: z5.string(), message: z5.string() });
484
+ var sandboxesRanSchema = z5.object({
485
+ version: z5.string(),
486
+ commit: z5.string().nullable(),
487
+ configFile: z5.string().nullable(),
488
+ runId: z5.string().nullable(),
489
+ runDirectory: z5.string().nullable(),
490
+ sandboxes: z5.array(sandboxRecordSchema),
491
+ /** How many runner sandboxes are in each runner sandbox state, keyed by the state. */
492
+ states: z5.object({
493
+ passed: z5.number(),
494
+ failed: z5.number(),
495
+ "not-started": z5.number(),
496
+ canceled: z5.number()
497
+ }),
498
+ tests: z5.object({ passed: z5.number(), failed: z5.number(), skipped: z5.number() }).nullable(),
499
+ plan: planSchema,
500
+ resources: DEFINITION_SET.reports.ranSchema,
501
+ wallMs: z5.number(),
502
+ runner: z5.object({
503
+ snapshotId: z5.string(),
504
+ base: z5.string(),
505
+ builtBehind: z5.number().nullable(),
506
+ built: z5.boolean(),
507
+ vcpus: z5.number(),
508
+ region: z5.string(),
509
+ runtime: z5.string(),
510
+ uploadBytes: z5.number().nullable()
511
+ }),
512
+ cleanup: RUN_CLEANUP.schema,
513
+ kept: z5.array(keptSandboxSchema),
514
+ notKept: z5.array(notKeptSandboxSchema),
515
+ fileListMismatches: z5.array(
516
+ z5.object({ sandbox: z5.number(), missing: z5.array(z5.string()), extra: z5.array(z5.string()) })
517
+ )
518
+ });
519
+ var SANDBOXES_RAN_DESCRIPTION = "Every runner sandbox of a run across runner sandboxes ended. storm exits 0 when every runner sandbox passed, else 1, whatever this result's exit code. A runner sandbox with a file list whose command ended, and which reported nothing for a test file of its list or reported a test file not in its list, warns file_list_mismatch; the exit status is the same.";
520
+ function renderSandboxesRan(ran, options = {}) {
521
+ const noFinal = options.noFinal === void 0 ? { warnings: [], next: [] } : noFinalResultsContent(options.noFinal.noFinalTestResults, options.noFinal.hints);
522
+ const warnings = [
523
+ ...ran.notKept.map((sandbox) => ({
524
+ reason: "runner_sandbox_not_kept",
525
+ message: `Runner sandbox ${sandbox.sandbox}: ${notKeptText(sandbox)}`
526
+ })),
527
+ ...runnerCleanupWarnings(ran.cleanup.runner),
528
+ ...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources),
529
+ ...ran.fileListMismatches.map((mismatch) => ({
530
+ reason: "file_list_mismatch",
531
+ message: fileListMismatchText(
532
+ mismatch,
533
+ options.extraMismatchHint === void 0 ? {} : { extraHint: options.extraMismatchHint }
534
+ )
535
+ })),
536
+ ...noFinal.warnings
537
+ ];
538
+ const kept = ran.kept.map(
539
+ ({ sandbox, name, stopsAt, url }) => `Kept runner sandbox ${sandbox}, ${name}, running until ${isoSecondsText(stopsAt)}, so you can connect to it: ${url}`
540
+ );
541
+ return renderOutcome({
542
+ ...kept.length === 0 ? {} : { message: kept.join("\n") },
543
+ ...warnings.length === 0 ? {} : { warnings },
544
+ ...noFinal.next.length === 0 ? {} : { next: [...noFinal.next] }
545
+ });
546
+ }
547
+ var sandboxesFlagSchema = z5.enum(["--sandboxes", "--file-lists"]);
548
+ var fileListsProblemSchema = z5.discriminatedUnion("kind", [
549
+ z5.object({ kind: z5.literal("empty-list"), sandbox: z5.number() }),
550
+ z5.object({ kind: z5.literal("in-two-lists"), file: z5.string(), sandboxes: z5.array(z5.number()) }),
551
+ z5.object({ kind: z5.literal("count-mismatch"), lists: z5.number(), sandboxes: z5.number() })
552
+ ]);
553
+ var NAMED_PATHS = 10;
554
+ function namedPaths(paths) {
555
+ return paths.length > NAMED_PATHS ? [...paths.slice(0, NAMED_PATHS), `and ${paths.length - NAMED_PATHS} more`] : paths;
556
+ }
557
+ var sandboxesErrors = defineErrors({
558
+ missingSandboxesMax: {
559
+ exitCode: 2,
560
+ description: "--sandboxes or --file-lists was given, and storm.config.ts has no runner.sandboxes key, which sets the most runner sandboxes a run can have. A repository opts in to runs across runner sandboxes. Nothing was minted, acquired, or started.",
561
+ schema: z5.object({
562
+ flag: sandboxesFlagSchema,
563
+ key: z5.string(),
564
+ configFile: z5.string().nullable()
565
+ }),
566
+ render: ({ flag, configFile }) => ({
567
+ message: `${flag} needs runner.sandboxes in storm.config.ts, and ${configFile ?? "no storm.config.ts"} has none. The run didn't start.`,
568
+ next: [
569
+ {
570
+ type: "text",
571
+ text: `Add runner: { sandboxes: { max: <n> } } to storm.config.ts, with n from 1 to ${MAX_RUNNER_SANDBOXES}: the most runner sandboxes a run can have. Or drop ${flag}.`
572
+ }
573
+ ]
574
+ })
575
+ },
576
+ sandboxesOverMax: {
577
+ exitCode: 2,
578
+ description: "--sandboxes asked for more runner sandboxes than runner.sandboxes.max in storm.config.ts allows, or the file --file-lists names holds more lists than that. Nothing was minted, acquired, or started.",
579
+ schema: z5.object({
580
+ flag: sandboxesFlagSchema,
581
+ sandboxes: z5.number(),
582
+ key: z5.string(),
583
+ max: z5.number(),
584
+ configFile: z5.string().nullable()
585
+ }),
586
+ render: ({ flag, sandboxes, key, max }) => {
587
+ const raise = max < MAX_RUNNER_SANDBOXES ? `, or raise ${key} in storm.config.ts, up to ${MAX_RUNNER_SANDBOXES}` : "";
588
+ return {
589
+ message: flag === "--sandboxes" ? `--sandboxes ${sandboxes} asks for more runner sandboxes than ${key} allows: ${max}. The run didn't start.` : `--file-lists gives ${sandboxes} file lists, more than ${key} allows: ${max}. The run didn't start.`,
590
+ next: [
591
+ {
592
+ type: "text",
593
+ text: flag === "--sandboxes" ? `Give --sandboxes a number from 1 to ${max}${raise}.` : `Give at most ${max} lists in the file${raise}.`
594
+ }
595
+ ]
596
+ };
597
+ }
598
+ }
599
+ });
600
+ var sandboxesDefaultErrors = defineErrors({
601
+ sandboxesDefaultRefused: {
602
+ exitCode: 2,
603
+ description: "runner.sandboxes.default in storm.config.ts makes this a run across runner sandboxes, and the run was given something a run across runner sandboxes can't take: --show-output or an argument its driver refuses in a run across runner sandboxes. Nothing was minted, acquired, or started.",
604
+ schema: z5.object({
605
+ key: z5.string(),
606
+ sandboxes: z5.number(),
607
+ field: z5.enum(["showOutput", "args"]),
608
+ problem: z5.string(),
609
+ configFile: z5.string().nullable()
610
+ }),
611
+ render: ({ key, sandboxes, problem }) => ({
612
+ message: `${key} in storm.config.ts makes this a run across ${sandboxes} ${sandboxes === 1 ? "runner sandbox" : "runner sandboxes"}, which can't take what the run was given: ${problem} The run didn't start.`,
613
+ next: [
614
+ {
615
+ type: "text",
616
+ text: `Drop what the problem names, or remove ${key} from storm.config.ts.`
617
+ }
618
+ ]
619
+ })
620
+ }
621
+ });
622
+ var fileListErrors = defineErrors({
623
+ fileListsUnreadable: {
624
+ exitCode: 2,
625
+ description: "The file --file-lists names can't be read, its text isn't JSON, or its JSON isn't an array with one array of test file paths for each runner sandbox, at least one. Nothing was minted, acquired, or started.",
626
+ schema: z5.object({
627
+ path: z5.string(),
628
+ problem: z5.enum(["unreadable", "not-json", "not-lists"]),
629
+ message: z5.string()
630
+ }),
631
+ render: ({ path, problem, message }) => ({
632
+ message: problem === "unreadable" ? `Couldn't read the file lists file ${path}: ${message}. The run didn't start.` : problem === "not-json" ? `The file lists file ${path} isn't JSON: ${message}. The run didn't start.` : `The file lists file ${path} ${message}. The run didn't start.`,
633
+ next: [
634
+ {
635
+ type: "text",
636
+ text: 'Give --file-lists a JSON file that holds an array with one array of test file paths for each runner sandbox, in order of runner sandbox index, such as [["test/a.test.ts"], ["test/b.test.ts"]].'
637
+ }
638
+ ]
639
+ })
640
+ },
641
+ invalidFileLists: {
642
+ exitCode: 2,
643
+ description: "The lists in the file --file-lists names can't be a run's file lists: a list holds no test file, a test file is in two lists or two times in one, or the number of lists differs from --sandboxes. Nothing was minted, acquired, or started.",
644
+ schema: z5.object({
645
+ path: z5.string(),
646
+ problems: z5.array(fileListsProblemSchema)
647
+ }),
648
+ render: ({ path, problems }) => ({
649
+ message: `The file lists in ${path} can't be used. The run didn't start.`,
650
+ rows: [["Problems", problems.map(fileListsProblemText)]],
651
+ next: [
652
+ {
653
+ type: "text",
654
+ text: "Give each runner sandbox a list with at least one test file, name each test file in one list at most, and drop --sandboxes or give it the number of lists."
655
+ }
656
+ ]
657
+ })
658
+ },
659
+ fileListsUnlisted: {
660
+ exitCode: 2,
661
+ description: "A list in the file --file-lists names holds a path that the run's own listing of its test files doesn't have. Nothing was minted, acquired, or started.",
662
+ schema: z5.object({
663
+ path: z5.string(),
664
+ files: z5.array(z5.string()),
665
+ listed: z5.number()
666
+ }),
667
+ render: ({ path, files, listed: listed2 }) => ({
668
+ message: `The file lists in ${path} name ${files.length === 1 ? "a path" : `${files.length} paths`} that the run's listing of its ${listed2} test ${listed2 === 1 ? "file" : "files"} doesn't have. The run didn't start.`,
669
+ rows: [["Not listed", [...namedPaths(files)]]],
670
+ next: [
671
+ {
672
+ type: "text",
673
+ text: "Name each test file as the listing does, relative to the project, such as test/a.test.ts, and only test files the run's arguments select. Run the same command with --plan-only --json, and read testFiles."
674
+ }
675
+ ]
676
+ })
677
+ }
678
+ });
679
+
318
680
  // src/commands/exec/outcomes.ts
319
- var runnerFailureSchema = z4.union([
320
- z4.object({
321
- kind: z4.enum(["snapshot-build-step-failed", "apply-failed", "install-failed", "build-failed"]),
681
+ var runnerFailureSchema = z6.union([
682
+ z6.object({
683
+ kind: z6.enum(["snapshot-build-step-failed", "apply-failed", "install-failed", "build-failed"]),
322
684
  /** The step's label. */
323
- label: z4.string(),
685
+ label: z6.string(),
324
686
  /** Its exit code; null when it ended without one. */
325
- exitCode: z4.number().nullable(),
687
+ exitCode: z6.number().nullable(),
326
688
  /** Its last 40 output lines. */
327
- tail: z4.array(z4.string())
689
+ tail: z6.array(z6.string())
328
690
  }),
329
- z4.object({
330
- kind: z4.literal("sandbox-api-failed"),
691
+ z6.object({
692
+ kind: z6.literal("sandbox-api-failed"),
331
693
  /** The Sandbox call that failed. */
332
- operation: z4.string(),
694
+ operation: z6.string(),
333
695
  /** The HTTP status the Sandbox API answered; null when it answered none. */
334
- status: z4.number().nullable(),
335
- message: z4.string()
696
+ status: z6.number().nullable(),
697
+ message: z6.string()
336
698
  }),
337
- z4.object({
338
- kind: z4.literal("checkout-failed"),
699
+ z6.object({
700
+ kind: z6.literal("checkout-failed"),
339
701
  /** What git or tar said. */
340
- message: z4.string(),
702
+ message: z6.string(),
341
703
  /** The failed command; null when there was none. */
342
- command: z4.string().nullable()
704
+ command: z6.string().nullable()
343
705
  }),
344
- z4.object({ kind: z4.literal("credential-claims-missing"), team: z4.string(), project: z4.string() })
706
+ z6.object({ kind: z6.literal("credential-claims-missing"), team: z6.string(), project: z6.string() }),
707
+ z6.object({
708
+ kind: z6.literal("network-policy-failed"),
709
+ /** The write that failed: the one that puts credentials in place, or the one that removes them. */
710
+ operation: z6.enum(["inject", "remove"]),
711
+ /** Where the write was: around the recipe's snapshot steps or its run steps and their credentials, before a runner snapshot is saved, or as the command starts, with the credentials its resources give it beside the recipe's. */
712
+ around: z6.enum(["snapshot-steps", "run-steps", "snapshot-save", "command"]),
713
+ /** `api` when the Sandbox API refused or failed, `timed-out` when it didn't answer in time. */
714
+ reason: z6.enum(["api", "timed-out"]),
715
+ /** The HTTP status the Sandbox API answered; null when it answered none. */
716
+ status: z6.number().nullable(),
717
+ /** What failed, without any credential's value. */
718
+ message: z6.string()
719
+ })
345
720
  ]);
346
721
  function listed(names) {
347
722
  if (names.length <= 1) return names.join("");
348
723
  return `${names.slice(0, -1).join(", ")} and ${names.at(-1) ?? ""}`;
349
724
  }
725
+ function renderInvalidSecretVariables(key, rowLabel, variables, minLength, configFile) {
726
+ const named = (problem) => variables.filter((variable) => variable.problem === problem).map(({ name }) => name);
727
+ const [missing, multiline, short2] = [named("missing"), named("multiline"), named("short")];
728
+ return {
729
+ message: `${key}${configFile === null ? "" : ` in ${configFile}`} names ${variables.length === 1 ? "a variable" : "variables"} storm can't use. The run didn't start.`,
730
+ rows: [
731
+ [
732
+ rowLabel,
733
+ variables.map(
734
+ ({ name, problem }) => problem === "missing" ? `${name} is not set` : problem === "multiline" ? `${name} holds a carriage return or a line feed` : `${name} holds fewer than ${minLength} characters`
735
+ )
736
+ ]
737
+ ],
738
+ next: [
739
+ {
740
+ type: "text",
741
+ text: [
742
+ ...missing.length === 0 ? [] : [`Set ${listed(missing)} in this machine's environment.`],
743
+ ...multiline.length === 0 ? [] : [
744
+ `Set ${listed(multiline)} to a value on one line: storm hides each value in output a line at a time, and doesn't trim one.`
745
+ ],
746
+ ...short2.length === 0 ? [] : [`Set ${listed(short2)} to the whole secret.`]
747
+ ].join(" ")
748
+ },
749
+ {
750
+ type: "text",
751
+ text: "Or run on the launch machine with runner: launchMachine() (or --runner launch-machine for storm exec), which reads none of these variables."
752
+ }
753
+ ]
754
+ };
755
+ }
350
756
  function stepEnded(exitCode) {
351
757
  return exitCode === null ? "ended without an exit code" : `exited ${exitCode}`;
352
758
  }
@@ -382,6 +788,25 @@ function runnerFailureText(failure) {
382
788
  message: `git or tar failed on this machine: ${failure.message}. The command didn't run.`,
383
789
  next: "Fix the checkout, then retry."
384
790
  };
791
+ case "network-policy-failed": {
792
+ const detail = failure.status === null ? failure.message : `HTTP ${failure.status}: ${failure.message}`;
793
+ const next = "Retry; if it keeps failing, check the Vercel Sandbox status and the project's Sandbox access.";
794
+ if (failure.around === "command")
795
+ return {
796
+ message: `Couldn't give the command the credentials its resources give it, beside the recipe's: writing the runner sandbox's network policy failed (${detail}). The command didn't run.`,
797
+ next
798
+ };
799
+ if (failure.operation === "remove")
800
+ return {
801
+ message: `Couldn't remove the recipe's credentials from the sandbox's network policy before saving the runner snapshot (${detail}). storm stops and deletes the sandbox, and keeps neither it nor a runner snapshot of it. The command didn't run.`,
802
+ next
803
+ };
804
+ const steps = failure.around === "snapshot-steps" ? "the snapshot build's toolchain and prebuild steps" : "the install and build steps";
805
+ return {
806
+ message: `Couldn't give ${steps} the recipe's credentials: writing the sandbox's network policy failed (${detail}). None of those steps ran, and the command didn't run.`,
807
+ next
808
+ };
809
+ }
385
810
  case "credential-claims-missing":
386
811
  return {
387
812
  message: `The credential minted for project ${failure.project} on team ${failure.team} names no team and project ids (its owner_id and project_id claims), so the runner sandbox can't use it. The command didn't run.`,
@@ -389,13 +814,13 @@ function runnerFailureText(failure) {
389
814
  };
390
815
  }
391
816
  }
392
- var ranSchema = z4.object({
817
+ var ranSchema = z6.object({
393
818
  /** storm's version. */
394
- version: z4.string(),
819
+ version: z6.string(),
395
820
  /** The git commit storm was built from, as its version line shows it (`3f2a9c1b7d4e`, `-dirty` appended when built from a tree with uncommitted changes); null when unknown. */
396
- commit: z4.string().nullable(),
821
+ commit: z6.string().nullable(),
397
822
  /** The config file the run's settings came from (its absolute path); null when none applied. */
398
- configFile: z4.string().nullable(),
823
+ configFile: z6.string().nullable(),
399
824
  /**
400
825
  * What each acquired resource instance that reports something says of itself, keyed by resource key: its
401
826
  * definition's name (`definition`), its facts (`facts`, what its acquire answered, unknown to the schema, or null
@@ -412,42 +837,33 @@ var ranSchema = z4.object({
412
837
  * How the command ended: its exit code, or the signal that ended it; both null for a command in the runner sandbox
413
838
  * that ended without an exit code.
414
839
  */
415
- command: z4.object({ exitCode: z4.number().nullable(), signal: z4.string().nullable() }),
840
+ command: z6.object({ exitCode: z6.number().nullable(), signal: z6.string().nullable() }),
416
841
  /** The runner sandbox the command ran in; null without one. */
417
- runner: z4.object({
842
+ runner: z6.object({
418
843
  /** The runner snapshot it started from. */
419
- snapshotId: z4.string(),
844
+ snapshotId: z6.string(),
420
845
  /** The runner snapshot's base, a full SHA: the commit it was built at. */
421
- base: z4.string(),
846
+ base: z6.string(),
422
847
  /** How many commits HEAD has that the snapshot's base lacks, 0 for a snapshot built at HEAD's commit. */
423
- builtBehind: z4.number(),
848
+ builtBehind: z6.number(),
424
849
  /** How many bytes of changes the run uploaded on top of the snapshot's base. */
425
- uploadBytes: z4.number(),
850
+ uploadBytes: z6.number(),
426
851
  /** Whether this run built the runner snapshot. */
427
- built: z4.boolean(),
428
- vcpus: z4.number(),
429
- region: z4.string(),
430
- runtime: z4.string(),
852
+ built: z6.boolean(),
853
+ vcpus: z6.number(),
854
+ region: z6.string(),
855
+ runtime: z6.string(),
431
856
  /** How long the build step took, in milliseconds. */
432
- buildMs: z4.number()
857
+ buildMs: z6.number()
433
858
  }).nullable(),
434
859
  /** The run's waterfall, as the run directory's timeline.json holds it: each lane's label, span and steps in milliseconds since the run started, how they ended, idle time, and the critical path. */
435
860
  timeline: timelineSchema,
436
861
  /** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
437
- runId: z4.string().nullable(),
438
- /**
439
- * Whether the run saved no final test result though its command exited 0: storm handed the command a test events
440
- * file and read every line of it, and none was a final result. Then the result warns `no_final_test_results`, whose
441
- * next steps add storm's reporter to the test runner's config.
442
- */
443
- noFinalTestResults: z4.boolean()
862
+ runId: z6.string().nullable()
444
863
  });
445
- var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code. A run whose command exited 0 but saved no final test result warns no_final_test_results.";
446
- function ranRenderer(hints) {
447
- return (ran) => renderRan(ran, hints);
448
- }
449
- function renderRan(ran, hints) {
450
- const noFinal = noFinalResultsContent(ran.noFinalTestResults, hints);
864
+ var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code.";
865
+ function renderRan(ran, noFinal) {
866
+ const noFinalContent = noFinal === void 0 ? { warnings: [], next: [] } : noFinalResultsContent(noFinal.noFinalTestResults, noFinal.hints);
451
867
  const warnings = [
452
868
  ...DEFINITION_SET.reports.ranWarnings(ran.resources),
453
869
  ...ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null ? [
@@ -458,24 +874,52 @@ function renderRan(ran, hints) {
458
874
  ] : [],
459
875
  ...runnerCleanupWarnings(ran.cleanup.runner),
460
876
  ...DEFINITION_SET.reports.cleanupWarnings(ran.cleanup.resources),
461
- ...noFinal.warnings
877
+ ...noFinalContent.warnings
462
878
  ];
463
879
  const kept = ran.cleanup.runner?.kept ?? null;
464
880
  return renderOutcome({
465
881
  ...kept === null ? {} : { message: keptText(kept) },
466
882
  ...warnings.length === 0 ? {} : { warnings },
467
- ...noFinal.next.length === 0 ? {} : { next: [...noFinal.next] }
883
+ ...noFinalContent.next.length === 0 ? {} : { next: [...noFinalContent.next] }
468
884
  });
469
885
  }
470
886
  var runErrors = defineErrors({
887
+ conflictingOptions: {
888
+ exitCode: 2,
889
+ description: "A run flag doesn't fit the effective runner: --show-output and --keep-sandbox fit the Vercel Sandbox runner, and --credential github-actions fits the launch machine runner.",
890
+ schema: z6.object({
891
+ /** Each conflicting flag, as typed, and why it doesn't fit. */
892
+ conflicts: z6.array(z6.object({ flag: z6.string(), message: z6.string() })),
893
+ /** The effective runner kind for the run: `launch-machine` or `vercel-sandbox`. */
894
+ runner: z6.enum(["launch-machine", "vercel-sandbox"]),
895
+ /** The selected suite's name, or null when no suite was selected. */
896
+ suite: z6.string().nullable(),
897
+ /** The config file that applied; null when none did. */
898
+ configFile: z6.string().nullable()
899
+ }),
900
+ render: ({ conflicts, runner, suite }) => ({
901
+ message: conflicts.map(({ message }) => message).join(" "),
902
+ rows: [
903
+ ["Conflicts", conflicts.map(({ flag }) => flag)],
904
+ ["Runner", runner],
905
+ ...suite === null ? [] : [["Suite", suite]]
906
+ ],
907
+ next: [
908
+ {
909
+ type: "text",
910
+ text: runner === "launch-machine" ? `Drop ${listed(conflicts.map(({ flag }) => flag))}, or run with a vercelSandbox({ \u2026 }) runner.` : `Drop ${listed(conflicts.map(({ flag }) => flag))}, or run on the launch machine with launchMachine() (or --runner launch-machine for storm exec).`
911
+ }
912
+ ]
913
+ })
914
+ },
471
915
  credentialUnused: {
472
916
  exitCode: 2,
473
917
  description: "--credential was given to a run with no resource that takes a credential.",
474
- schema: z4.object({
918
+ schema: z6.object({
475
919
  /** The flags given that none of the run's resources takes, as typed, such as --credential. */
476
- flags: z4.array(z4.string()),
920
+ flags: z6.array(z6.string()),
477
921
  /** The config file that applied; null when none did. */
478
- configFile: z4.string().nullable()
922
+ configFile: z6.string().nullable()
479
923
  }),
480
924
  render: ({ flags }) => ({
481
925
  message: `${flags.join(", ")} ${flags.length === 1 ? "applies" : "apply"} only to a run with a resource that takes a credential, and this run has none.`,
@@ -487,69 +931,107 @@ var runErrors = defineErrors({
487
931
  ]
488
932
  })
489
933
  },
934
+ resourceNeedsRunnerSandbox: {
935
+ exitCode: 2,
936
+ description: "A run on the launch machine uses a resource that needs a runner sandbox, such as one that gives the command a sandbox credential the runner sandbox's firewall adds, so the run didn't start: it minted, acquired, and started nothing.",
937
+ schema: z6.object({
938
+ /** The keys of the resources that need a runner sandbox, as storm.config.ts names them, in the run's order. */
939
+ resources: z6.array(z6.string()),
940
+ /** The config file that applied; null when none did. */
941
+ configFile: z6.string().nullable()
942
+ }),
943
+ render: ({ resources }) => ({
944
+ message: `${listed(resources.map((key) => `resources.${key}`))} ${resources.length === 1 ? "needs" : "need"} a runner sandbox, and this run uses the launch machine runner, with no firewall to add the sandbox credentials ${resources.length === 1 ? "it gives" : "they give"} the command. The run didn't start.`,
945
+ next: [
946
+ {
947
+ type: "text",
948
+ text: "Use runner: vercelSandbox({ \u2026 }) in storm.config.ts (without --runner launch-machine), or run without the resource."
949
+ }
950
+ ]
951
+ })
952
+ },
490
953
  missingRunner: {
491
954
  exitCode: 2,
492
- description: "A sandboxed run (no --unsandboxed) needs a runner recipe, and no storm.config.ts gives a runner key.",
493
- schema: z4.object({
955
+ description: "No runner is declared: neither storm.config.ts (nor the selected suite) declares runner with vercelSandbox({ \u2026 }) or launchMachine(), and --runner launch-machine wasn't passed.",
956
+ schema: z6.object({
494
957
  /** The config file that applied; null when none did. */
495
- configFile: z4.string().nullable()
958
+ configFile: z6.string().nullable()
496
959
  }),
497
960
  render: ({ configFile }) => ({
498
- message: configFile === null ? "A sandboxed run needs a runner recipe, and no storm.config.ts applies." : `A sandboxed run needs a runner recipe, and ${configFile} has no runner key.`,
961
+ message: configFile === null ? "No runner is declared, and no storm.config.ts applies." : `No runner is declared in ${configFile}.`,
499
962
  next: [
500
963
  {
501
964
  type: "text",
502
- text: "Add a runner recipe under the runner key of storm.config.ts, or run on this machine with --unsandboxed."
965
+ text: "Add runner: vercelSandbox({ \u2026 }) or runner: launchMachine() to storm.config.ts (or to a suite under suites)."
966
+ },
967
+ {
968
+ type: "text",
969
+ text: "Or, for storm exec, pass --runner launch-machine to run on the launch machine."
503
970
  }
504
971
  ]
505
972
  })
506
973
  },
507
- runnerSecretsInvalid: {
974
+ credentialsInvalid: {
508
975
  exitCode: 2,
509
- description: "In a sandboxed run, launcher environment variables the runner recipe's secrets key names can't be used, so the run didn't start: it minted, acquired and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.",
510
- schema: z4.object({
511
- /** Each variable storm can't use and why, in the recipe's order. */
512
- variables: z4.array(z4.object({ name: z4.string(), problem: z4.enum(["missing", "multiline", "short"]) })),
513
- /** The fewest characters a runner secret's value may have. */
514
- minLength: z4.number(),
976
+ description: `With the Vercel Sandbox runner, launcher environment variables named by the runner recipe's credentials key (source: { kind: "env", name }) can't be used, so the run didn't start: it minted, acquired, and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.`,
977
+ schema: z6.object({
978
+ /** Each variable storm can't use and why, once, in the order the recipe first names it. */
979
+ variables: z6.array(z6.object({ name: z6.string(), problem: z6.enum(["missing", "multiline", "short"]) })),
980
+ /** The fewest characters a credential's value may have. */
981
+ minLength: z6.number(),
515
982
  /** The config file that gave the runner recipe. */
516
- configFile: z4.string().nullable()
983
+ configFile: z6.string().nullable()
517
984
  }),
518
- render: ({ variables, minLength, configFile }) => {
519
- const named = (problem) => variables.filter((variable) => variable.problem === problem).map(({ name }) => name);
520
- const [missing, multiline, short2] = [named("missing"), named("multiline"), named("short")];
521
- return {
522
- message: `runner.secrets${configFile === null ? "" : ` in ${configFile}`} names ${variables.length === 1 ? "a variable" : "variables"} storm can't use. The run didn't start.`,
523
- rows: [
524
- [
525
- "Runner secrets",
526
- variables.map(
527
- ({ name, problem }) => problem === "missing" ? `${name} is not set` : problem === "multiline" ? `${name} holds a carriage return or a line feed` : `${name} holds fewer than ${minLength} characters`
528
- )
529
- ]
530
- ],
531
- next: [
532
- {
533
- type: "text",
534
- text: [
535
- ...missing.length === 0 ? [] : [`Set ${listed(missing)} in this machine's environment.`],
536
- ...multiline.length === 0 ? [] : [
537
- `Set ${listed(multiline)} to a value on one line: storm hides each value in output a line at a time, and doesn't trim one.`
538
- ],
539
- ...short2.length === 0 ? [] : [`Set ${listed(short2)} to the whole secret.`]
540
- ].join(" ")
541
- },
542
- { type: "text", text: "Or run on this machine with --unsandboxed, which reads no runner secret." }
543
- ]
544
- };
545
- }
985
+ render: ({ variables, minLength, configFile }) => renderInvalidSecretVariables("runner.credentials", "Credentials", variables, minLength, configFile)
986
+ },
987
+ keepSandboxUnsafeSecretEnvVars: {
988
+ exitCode: 2,
989
+ description: "With the Vercel Sandbox runner, --keep-sandbox asked to keep the runner sandbox for a recipe whose unsafeSecretEnvVars passes secrets into the command's environment, so the run didn't start: it minted, acquired, and created nothing. Anyone who can update the Vercel project can connect to a kept runner sandbox and read what the command wrote.",
990
+ schema: z6.object({
991
+ /** The environment variable names the recipe's unsafeSecretEnvVars exposes to the command, in the recipe's order. */
992
+ variables: z6.array(z6.string()),
993
+ /** The config file that gave the runner recipe. */
994
+ configFile: z6.string().nullable()
995
+ }),
996
+ render: ({ variables, configFile }) => ({
997
+ message: `Can't keep the runner sandbox when runner.unsafeSecretEnvVars${configFile === null ? "" : ` in ${configFile}`} is set (${listed(variables)}). Anyone who can update the Vercel project can connect to a kept runner sandbox and read what the command wrote. The run didn't start.`,
998
+ next: [
999
+ {
1000
+ type: "text",
1001
+ text: "Drop --keep-sandbox, or pass --keep-sandbox 0, so the runner sandbox stops and deletes."
1002
+ },
1003
+ {
1004
+ type: "text",
1005
+ text: "Or, when the secret travels as an HTTPS header, declare it under runner.credentials (a sandbox credential) instead of runner.unsafeSecretEnvVars."
1006
+ }
1007
+ ]
1008
+ })
1009
+ },
1010
+ unsafeSecretEnvVarsInvalid: {
1011
+ exitCode: 2,
1012
+ description: `With the Vercel Sandbox runner, launcher environment variables named by the runner recipe's unsafeSecretEnvVars key (source: { kind: "env", name }) can't be used, so the run didn't start: it minted, acquired, and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.`,
1013
+ schema: z6.object({
1014
+ /** Each variable storm can't use and why, once, in the order the recipe first names it. */
1015
+ variables: z6.array(z6.object({ name: z6.string(), problem: z6.enum(["missing", "multiline", "short"]) })),
1016
+ /** The fewest characters an unsafe secret environment variable's value may have. */
1017
+ minLength: z6.number(),
1018
+ /** The config file that gave the runner recipe. */
1019
+ configFile: z6.string().nullable()
1020
+ }),
1021
+ render: ({ variables, minLength, configFile }) => renderInvalidSecretVariables(
1022
+ "runner.unsafeSecretEnvVars",
1023
+ "Unsafe secret environment variables",
1024
+ variables,
1025
+ minLength,
1026
+ configFile
1027
+ )
546
1028
  },
547
1029
  noBaseRef: {
548
1030
  exitCode: 1,
549
- description: "In a sandboxed run, none of the runner recipe's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.",
550
- schema: z4.object({
1031
+ description: "With the Vercel Sandbox runner, none of the runner recipe's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.",
1032
+ schema: z6.object({
551
1033
  /** Each ref in baseRefs, and why it gave no base. */
552
- refs: z4.array(z4.object({ ref: z4.string(), reason: z4.enum(["missing", "unrelated"]) }))
1034
+ refs: z6.array(z6.object({ ref: z6.string(), reason: z6.enum(["missing", "unrelated"]) }))
553
1035
  }),
554
1036
  render: ({ refs }) => ({
555
1037
  message: `No base for the runner: none of ${refs.map(({ ref }) => ref).join(", ")} exists locally and shares history with HEAD. The command didn't run.`,
@@ -571,22 +1053,27 @@ var runErrors = defineErrors({
571
1053
  },
572
1054
  submodulesRefused: {
573
1055
  exitCode: 1,
574
- description: "In a sandboxed run, the checkout has Git submodules, which neither the upload nor the base's files carry.",
575
- schema: z4.object({ paths: z4.array(z4.string()) }),
1056
+ description: "With the Vercel Sandbox runner, the checkout has Git submodules, which neither the upload nor the base's files carry.",
1057
+ schema: z6.object({ paths: z6.array(z6.string()) }),
576
1058
  render: ({ paths }) => ({
577
1059
  message: `The checkout has Git submodules, which the runner can't carry: ${paths.join(", ")}. The command didn't run.`,
578
- next: [{ type: "text", text: "Run on this machine with --unsandboxed." }]
1060
+ next: [
1061
+ {
1062
+ type: "text",
1063
+ text: "Run on the launch machine with runner: launchMachine() (or --runner launch-machine for storm exec)."
1064
+ }
1065
+ ]
579
1066
  })
580
1067
  },
581
1068
  snapshotGone: {
582
1069
  exitCode: 1,
583
- description: "In a sandboxed run, the cached runner snapshot the run picked was gone (the Sandbox API answered 410), so its cache entry was removed and the command didn't run. The next run picks another runner snapshot or builds one.",
584
- schema: z4.object({
585
- snapshotId: z4.string(),
1070
+ description: "With the Vercel Sandbox runner, the cached runner snapshot the run picked was gone (the Sandbox API answered 410), so its cache entry was removed and the command didn't run. The next run picks another runner snapshot or builds one.",
1071
+ schema: z6.object({
1072
+ snapshotId: z6.string(),
586
1073
  /** The runner snapshot's base, a full SHA. */
587
- base: z4.string(),
1074
+ base: z6.string(),
588
1075
  /** Why its cache entry couldn't be removed; null when it was. */
589
- removal: z4.object({ path: z4.string(), message: z4.string() }).nullable(),
1076
+ removal: z6.object({ path: z6.string(), message: z6.string() }).nullable(),
590
1077
  /** What the run couldn't clean up. */
591
1078
  cleanup: RUN_CLEANUP.schema
592
1079
  }),
@@ -606,8 +1093,8 @@ var runErrors = defineErrors({
606
1093
  },
607
1094
  runnerFailed: {
608
1095
  exitCode: 1,
609
- description: "In a sandboxed run, the runner couldn't run the command: a snapshot build step, applying the changes, the install or the build failed (with the step's last 40 output lines), a Vercel Sandbox call failed, git or tar failed on this machine, or the credential names no team and project ids.",
610
- schema: z4.object({
1096
+ description: "With the Vercel Sandbox runner, the runner couldn't run the command: a snapshot build step, applying the changes, the install, or the build failed (with the step's last 40 output lines), a Vercel Sandbox call failed, a network policy write that puts the recipe steps' credentials in place or removes them failed, git or tar failed on this machine, or the credential names no team and project ids.",
1097
+ schema: z6.object({
611
1098
  failure: runnerFailureSchema,
612
1099
  /** What the run couldn't clean up; its `runner` is null when the run failed before it started a sandbox. */
613
1100
  cleanup: RUN_CLEANUP.schema
@@ -625,11 +1112,11 @@ var runErrors = defineErrors({
625
1112
  spawnFailed: {
626
1113
  exitCode: 1,
627
1114
  description: "The command couldn't start.",
628
- schema: z4.object({
1115
+ schema: z6.object({
629
1116
  /** The command's first argument: what storm tried to run. */
630
- executable: z4.string(),
1117
+ executable: z6.string(),
631
1118
  /** What the OS said. */
632
- message: z4.string(),
1119
+ message: z6.string(),
633
1120
  /**
634
1121
  * What the run couldn't clean up; its `runner` is null, since only a run without a runner sandbox spawns its
635
1122
  * command here.
@@ -657,8 +1144,16 @@ var RUN_ERRORS = {
657
1144
  ...runErrors
658
1145
  };
659
1146
  var outcomes = defineOutcomes({
660
- results: { ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: ranRenderer(EXEC_HINTS) } },
661
- errors: RUN_ERRORS
1147
+ results: {
1148
+ ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: (ran) => renderRan(ran) },
1149
+ sandboxesRan: {
1150
+ schema: sandboxesRanSchema,
1151
+ description: SANDBOXES_RAN_DESCRIPTION,
1152
+ render: (ran) => renderSandboxesRan(ran)
1153
+ },
1154
+ planned: { schema: plannedSchema, description: PLANNED_DESCRIPTION, render: renderPlanned }
1155
+ },
1156
+ errors: { ...RUN_ERRORS, ...sandboxesErrors }
662
1157
  });
663
1158
 
664
1159
  // src/commands/exec/progress.ts
@@ -799,6 +1294,9 @@ function eventLines(event, now, state, line, options) {
799
1294
  case "test":
800
1295
  case "test-event-unreadable":
801
1296
  case "test-events-incomplete":
1297
+ case "sandboxes-started":
1298
+ case "sandbox":
1299
+ case "sandbox-ended":
802
1300
  return [];
803
1301
  case "runner":
804
1302
  return runnerLines(event.event, state, line, options);
@@ -856,7 +1354,10 @@ function runnerLines(event, state, line, options) {
856
1354
  return [
857
1355
  line(
858
1356
  "cleanup",
859
- `stopping: ${event.commandRunning ? "killing the command, then " : ""}${event.keepMs > 0 ? `keeping the runner sandbox running ${keepTimeText(event.keepMs)}` : "stopping and deleting the runner's sandboxes"}${releasingText(state.instances)}\u2026`
1357
+ `stopping: ${orderText([
1358
+ ...event.commandRunning ? ["killing the command"] : [],
1359
+ ...sandboxSteps(event.keepMs, stoppingReleaseText(state.instances))
1360
+ ])}\u2026`
860
1361
  )
861
1362
  ];
862
1363
  case "waiting-for-snapshot":
@@ -867,7 +1368,12 @@ function runnerLines(event, state, line, options) {
867
1368
  )
868
1369
  ];
869
1370
  case "sandbox-kept":
870
- return [line("cleanup", `kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}`)];
1371
+ return [
1372
+ line(
1373
+ "cleanup",
1374
+ `kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}, with no network access`
1375
+ )
1376
+ ];
871
1377
  }
872
1378
  }
873
1379
  function snapshotReusedText(event, mergeBase) {
@@ -890,12 +1396,11 @@ var SNAPSHOT_BUILD_REASON_TEXT = {
890
1396
  full: "--full",
891
1397
  base: "the cache has no base snapshot at that commit"
892
1398
  };
893
- function releasingText(instances) {
894
- const release = releaseText(
1399
+ function stoppingReleaseText(instances) {
1400
+ return releaseText(
895
1401
  instances.map(({ resource }) => resource),
896
1402
  false
897
1403
  );
898
- return release === void 0 ? "" : ` and ${release}`;
899
1404
  }
900
1405
  function closeFold(state) {
901
1406
  if (!state.folded) return [];
@@ -904,8 +1409,13 @@ function closeFold(state) {
904
1409
  }
905
1410
  function cleanupText(keepMs, release) {
906
1411
  if (keepMs === null) return release === void 0 ? "nothing to release" : `${release}\u2026`;
907
- const sandboxes = keepMs > 0 ? `keeping the runner sandbox running ${keepTimeText(keepMs)}` : "stopping and deleting the runner's sandboxes";
908
- return `${sandboxes}${release === void 0 ? "" : `, then ${release}`}\u2026`;
1412
+ return `${orderText(sandboxSteps(keepMs, release))}\u2026`;
1413
+ }
1414
+ function sandboxSteps(keepMs, release) {
1415
+ const released = release === void 0 ? [] : [release];
1416
+ if (keepMs > 0)
1417
+ return ["giving the runner sandbox no network access", ...released, `keeping it running ${keepTimeText(keepMs)}`];
1418
+ return release === void 0 ? ["stopping and deleting the runner's sandboxes"] : ["stopping the runner's sandboxes", release, "deleting the sandboxes"];
909
1419
  }
910
1420
  function commandEnd(outcome) {
911
1421
  switch (outcome.kind) {
@@ -934,7 +1444,7 @@ function cacheWriteFailureText(failure) {
934
1444
  }
935
1445
 
936
1446
  // src/commands/exec/run-command.ts
937
- import { z as z5 } from "zod";
1447
+ import { z as z7 } from "zod";
938
1448
 
939
1449
  // src/forward-sigterm.ts
940
1450
  function forwardSigterm(signal) {
@@ -948,7 +1458,7 @@ function forwardSigterm(signal) {
948
1458
  return { terminate: terminate.signal, release: () => signal.removeEventListener("abort", forward) };
949
1459
  }
950
1460
 
951
- // src/commands/exec/job-summary.ts
1461
+ // src/shared/job-summary.ts
952
1462
  function jobSummaryMarkdown(timeline, extras) {
953
1463
  const lines = [`### storm ${extras.command}`, ""];
954
1464
  if (timeline.rows.length > 0) {
@@ -971,6 +1481,173 @@ function tableRow(row) {
971
1481
  const idle = row.idleMs > 0 ? seconds(row.idleMs) : "";
972
1482
  return `| ${row.label}${outcome} | +${seconds(row.startMs)} | ${seconds(row.endMs - row.startMs)} | ${idle} | ${steps} |`;
973
1483
  }
1484
+ function acrossSandboxesJobSummaryMarkdown(records, extras) {
1485
+ const lines = [`### storm ${extras.command}`, ""];
1486
+ const rows = sandboxTableRows(records);
1487
+ lines.push(
1488
+ `| ${SANDBOX_TABLE_HEADER.join(" | ")} |`,
1489
+ `| ${SANDBOX_TABLE_HEADER.map((_, column) => column >= 2 && column <= 4 ? "---:" : "---").join(" | ")} |`,
1490
+ ...rows.map((row) => `| ${row.map((cell) => cell.replaceAll("|", "\\|")).join(" | ")} |`),
1491
+ "",
1492
+ sandboxTotalsLine(records),
1493
+ ""
1494
+ );
1495
+ for (const detail of extras.details ?? []) lines.push(`${detail.trim()} `);
1496
+ if ((extras.details ?? []).length > 0) lines.push("");
1497
+ if (extras.logs !== void 0) lines.push(`Run directory: \`${extras.logs}\``, "");
1498
+ return lines.join("\n");
1499
+ }
1500
+
1501
+ // src/planning/run-kind-flags.ts
1502
+ function unfitRunFlags(runner, flags) {
1503
+ if (runner === "vercel-sandbox") return flags.credential === "github-actions" ? ["credential"] : [];
1504
+ return [
1505
+ ...flags.showOutput ? ["showOutput"] : [],
1506
+ ...flags.keepSandbox === void 0 ? [] : ["keepSandbox"],
1507
+ ...flags.sandboxes === void 0 ? [] : ["sandboxes"],
1508
+ ...flags.fileLists === void 0 ? [] : ["fileLists"]
1509
+ ];
1510
+ }
1511
+ function runKindFlagName(flag) {
1512
+ switch (flag) {
1513
+ case "credential":
1514
+ return "--credential github-actions";
1515
+ case "showOutput":
1516
+ return "--show-output";
1517
+ case "keepSandbox":
1518
+ return "--keep-sandbox";
1519
+ case "sandboxes":
1520
+ return "--sandboxes";
1521
+ case "fileLists":
1522
+ return "--file-lists";
1523
+ }
1524
+ }
1525
+ function runKindFlagMessage(flag) {
1526
+ switch (flag) {
1527
+ case "credential":
1528
+ return "The Vercel Sandbox runner needs a minted Vercel credential, so it can't use --credential github-actions.";
1529
+ case "showOutput":
1530
+ return "--show-output prints the Vercel Sandbox runner's step output, and this run uses the launch machine runner.";
1531
+ case "keepSandbox":
1532
+ return "--keep-sandbox keeps a Vercel Sandbox runner's sandbox, and this run uses the launch machine runner.";
1533
+ case "sandboxes":
1534
+ return "--sandboxes runs the command in several Vercel Sandbox runner sandboxes, and this run uses the launch machine runner.";
1535
+ case "fileLists":
1536
+ return "--file-lists runs each file list in its own Vercel Sandbox runner sandbox, and this run uses the launch machine runner.";
1537
+ }
1538
+ }
1539
+
1540
+ // src/commands/exec/plan-run.ts
1541
+ async function planRun(app, lifecycles, request, planCommand, signal) {
1542
+ const file = request.settingsFile;
1543
+ const configFile = file.path;
1544
+ const settings = fileSettings(file, request);
1545
+ const runner = request.runner === "launch-machine" ? { kind: "launch-machine" } : settings.runner?.value;
1546
+ if (runner === void 0) return refused(runErrors.missingRunner({ configFile }));
1547
+ const unfit = unfitRunFlags(runner.kind, request);
1548
+ if (unfit.length > 0) {
1549
+ return refused(
1550
+ runErrors.conflictingOptions({
1551
+ conflicts: unfit.map((flag) => ({ flag: runKindFlagName(flag), message: runKindFlagMessage(flag) })),
1552
+ runner: runner.kind,
1553
+ suite: request.suite,
1554
+ configFile
1555
+ })
1556
+ );
1557
+ }
1558
+ let where;
1559
+ if (runner.kind === "launch-machine") where = { kind: "unsandboxed" };
1560
+ else {
1561
+ if (configFile === null) throw new Error("planRun: the Vercel Sandbox runner comes from a config file");
1562
+ const required = requireTarget(settings.scope, settings.project);
1563
+ if (!required.ok) return required;
1564
+ const { recipe } = runner;
1565
+ const credentials = readCredentials(recipe, app.env);
1566
+ if (!credentials.ok)
1567
+ return refused(
1568
+ runErrors.credentialsInvalid({
1569
+ variables: credentials.variables.map(({ name, problem }) => ({ name, problem })),
1570
+ minLength: SECRET_MIN_LENGTH,
1571
+ configFile
1572
+ })
1573
+ );
1574
+ const keepFlagMinutes = request.keepSandbox === void 0 ? 0 : parseKeepTime(request.keepSandbox) ?? 0;
1575
+ if (recipe.unsafeSecretEnvVars.length > 0 && keepFlagMinutes > 0)
1576
+ return refused(
1577
+ runErrors.keepSandboxUnsafeSecretEnvVars({
1578
+ variables: recipe.unsafeSecretEnvVars.map(({ name }) => name),
1579
+ configFile
1580
+ })
1581
+ );
1582
+ const unsafeSecretEnvVars = readUnsafeSecretEnvVars(recipe, app.env);
1583
+ if (!unsafeSecretEnvVars.ok)
1584
+ return refused(
1585
+ runErrors.unsafeSecretEnvVarsInvalid({
1586
+ variables: unsafeSecretEnvVars.variables.map(({ name, problem }) => ({ name, problem })),
1587
+ minLength: SECRET_MIN_LENGTH,
1588
+ configFile
1589
+ })
1590
+ );
1591
+ where = {
1592
+ kind: "runner",
1593
+ configFile,
1594
+ recipe,
1595
+ target: required.target,
1596
+ credentials: credentials.credentials,
1597
+ unsafeSecretEnvVars: unsafeSecretEnvVars.values,
1598
+ secrets: [...credentials.credentials.map(({ value }) => value), ...Object.values(unsafeSecretEnvVars.values)]
1599
+ };
1600
+ }
1601
+ const merged = settleRunResources(file, request.given);
1602
+ if (!merged.ok) return merged;
1603
+ const command = await planCommand(where, signal, { testPlan: settings.testPlan?.value === true, configFile });
1604
+ if (signal.aborted) return refused(canceledBeforeStart());
1605
+ if (!command.ok) {
1606
+ const secrets = [...where.kind === "runner" ? where.secrets : [], ...lifecycles.secrets(merged.options)];
1607
+ return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
1608
+ }
1609
+ const run = Object.freeze({
1610
+ testPlan: command.testPlan,
1611
+ sandboxes: command.sandboxes?.sandboxes.length ?? 1
1612
+ });
1613
+ const resolved = merged.plan(run);
1614
+ if (!resolved.ok) return resolved;
1615
+ return {
1616
+ ok: true,
1617
+ configFile,
1618
+ settings,
1619
+ where,
1620
+ argv: command.argv,
1621
+ testPlan: command.testPlan,
1622
+ testFiles: command.testFiles,
1623
+ sandboxes: command.sandboxes,
1624
+ resources: resolved.resources,
1625
+ planOptions: resolved.planned.map(planOption)
1626
+ };
1627
+ }
1628
+ function planOption({ path, value, source }) {
1629
+ return { path, value, from: source };
1630
+ }
1631
+ async function resourcesBeforeRun(lifecycles, plan, request) {
1632
+ const { configFile, resources, settings } = plan;
1633
+ const used = await lifecycles.beforeRun(resources);
1634
+ if (!used.ok) return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
1635
+ if (request.credential !== void 0 && !used.needsVercelCredential)
1636
+ return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
1637
+ if (plan.where.kind !== "runner" && used.needRunnerSandbox.length > 0)
1638
+ return refused(runErrors.resourceNeedsRunnerSandbox({ resources: [...used.needRunnerSandbox], configFile }));
1639
+ let where;
1640
+ if (plan.where.kind === "runner") where = plan.where;
1641
+ else if (used.needsVercelCredential) {
1642
+ const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
1643
+ if (!chosen.ok) return chosen;
1644
+ where = { kind: "unsandboxed", credential: chosen.credential };
1645
+ } else where = { kind: "unsandboxed", credential: void 0 };
1646
+ return { ok: true, where, used };
1647
+ }
1648
+ function canceledBeforeStart() {
1649
+ return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
1650
+ }
974
1651
 
975
1652
  // src/commands/exec/live-view.ts
976
1653
  var SPINNER = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
@@ -980,7 +1657,7 @@ function laneHead(glyph, lane) {
980
1657
  }
981
1658
  function activePhase(state) {
982
1659
  if (state.cleanup !== void 0) return "cleanup";
983
- if (state.command !== void 0) return "tests";
1660
+ if (state.command !== void 0) return "command";
984
1661
  if (state.lanesStartedAt !== void 0 && state.runner !== void 0) return "lanes";
985
1662
  if (Object.keys(state.resources).length > 0 && state.runner === void 0) return "resources";
986
1663
  if (state.mint !== void 0) return "credential";
@@ -1019,8 +1696,8 @@ function phaseFrame(state, phase, now, width, paint2) {
1019
1696
  return lanesFrame(state, view);
1020
1697
  case "resources":
1021
1698
  return unsandboxedResourcesFrame(state, view);
1022
- case "tests":
1023
- return testsFrame(state, view);
1699
+ case "command":
1700
+ return commandFrame(state, view);
1024
1701
  case "cleanup":
1025
1702
  return state.cleanup === void 0 ? [] : [cleanupLine(state.cleanup, state.runner, view, false)];
1026
1703
  }
@@ -1041,8 +1718,8 @@ function phaseRecord(state, phase, width, paint2) {
1041
1718
  return lanesRecord(state, view);
1042
1719
  case "resources":
1043
1720
  return unsandboxedResourcesRecord(state, view);
1044
- case "tests":
1045
- return state.command === void 0 ? [] : [testsLine(state, state.command, view, false)];
1721
+ case "command":
1722
+ return state.command === void 0 ? [] : [commandLine(state, state.command, view, false)];
1046
1723
  case "cleanup":
1047
1724
  return state.cleanup === void 0 ? [] : [cleanupLine(state.cleanup, state.runner, view, true)];
1048
1725
  }
@@ -1221,17 +1898,17 @@ function unsandboxedResourcesRecord(state, view) {
1221
1898
  if (lanes.length === 0) return [];
1222
1899
  return [...mint === void 0 ? [] : [credentialLine(mint, view)], ...lanes];
1223
1900
  }
1224
- function testsFrame(state, view) {
1225
- return state.command === void 0 ? [] : [testsLine(state, state.command, view, true)];
1901
+ function commandFrame(state, view) {
1902
+ return state.command === void 0 ? [] : [commandLine(state, state.command, view, true)];
1226
1903
  }
1227
1904
  var LONG_FILE_MS = 1e4;
1228
- function testsLine(state, command, view, live) {
1905
+ function commandLine(state, command, view, live) {
1229
1906
  const { tests } = state;
1230
1907
  const end = command.outcome === void 0 ? void 0 : endText(command.outcome);
1231
1908
  const parts = [command.argv.join(" ")];
1232
1909
  if (end !== void 0) parts.push(end);
1233
1910
  else if (live && state.stopping) parts.push("stopping");
1234
- const head = ` ${view.glyph(command.status)} tests `;
1911
+ const head = laneHead(view.glyph(command.status), "command");
1235
1912
  const time = elapsed(view, command.startedAt, command.endedAt);
1236
1913
  const text = live && end === void 0 && !state.stopping && tests !== void 0 ? testsProgress(tests, view, view.width - visibleLength(head) - visibleLength(time) - 1) : parts.join(" ");
1237
1914
  return view.row(`${head}${text}`, time);
@@ -1267,9 +1944,8 @@ function waitingText(waiting) {
1267
1944
  }
1268
1945
  function cleanupLine(cleanup, runner, view, record) {
1269
1946
  const done = record || cleanup.status !== "running";
1270
- const release = releaseText(cleanup.resources, done);
1271
- const { keepMs } = cleanup;
1272
- const text = !done && cleanup.waiting ? `${WAITING_FOR_SNAPSHOT}\u2026` : keepMs === null ? release ?? "nothing to release" : `${runnerSandboxText(keepMs, runner, done)}${release === void 0 ? "" : `, ${release}`}`;
1947
+ const { keepMs, resources } = cleanup;
1948
+ const text = !done && cleanup.waiting ? `${WAITING_FOR_SNAPSHOT}\u2026` : keepMs === null ? releaseText(resources, done) ?? "nothing to release" : orderText(runnerSandboxSteps(keepMs, resources, runner, done));
1273
1949
  const leftBehind = cleanupProblems(cleanup);
1274
1950
  const ending = done ? leftBehind === 0 ? "" : `: ${leftBehind} left behind` : "\u2026";
1275
1951
  return view.row(
@@ -1277,11 +1953,16 @@ function cleanupLine(cleanup, runner, view, record) {
1277
1953
  elapsed(view, cleanup.startedAt, cleanup.endedAt)
1278
1954
  );
1279
1955
  }
1280
- function runnerSandboxText(keepMs, runner, done) {
1956
+ function runnerSandboxSteps(keepMs, resources, runner, done) {
1281
1957
  const kept = runner?.kept;
1282
- if (kept !== void 0) return `kept the runner sandbox until ${isoSecondsText(kept.stopsAt)}`;
1283
- const removed = `${done ? "stopped and deleted" : "stopping and deleting"} the runner sandbox`;
1284
- return !done && keepMs > 0 ? `keeping the runner sandbox running ${keepTimeText(keepMs)}` : removed;
1958
+ const release = releaseText(resources, done || kept !== void 0);
1959
+ const released = release === void 0 ? [] : [release];
1960
+ if (kept !== void 0)
1961
+ return [...released, `kept the runner sandbox until ${isoSecondsText(kept.stopsAt)}, with no network access`];
1962
+ if (!done && keepMs > 0)
1963
+ return ["giving the runner sandbox no network access", ...released, `keeping it running ${keepTimeText(keepMs)}`];
1964
+ if (release === void 0) return [`${done ? "stopped and deleted" : "stopping and deleting"} the runner sandbox`];
1965
+ return done ? ["stopped the runner sandbox", release, "deleted it"] : ["stopping the runner sandbox", release, "deleting it"];
1285
1966
  }
1286
1967
  function statusGlyph(status, now, paint2) {
1287
1968
  switch (status) {
@@ -1311,7 +1992,7 @@ function runView(options) {
1311
1992
  } },
1312
1993
  runnerTerminal: context.runnerTerminal,
1313
1994
  width: PLAIN_WIDTH,
1314
- paint: paint(false),
1995
+ colorDepth: "none",
1315
1996
  finish: async () => {
1316
1997
  }
1317
1998
  };
@@ -1321,13 +2002,13 @@ function runView(options) {
1321
2002
  observer: lineProgress(writer, { github: presentation.github, verbose: options.verbose }),
1322
2003
  runnerTerminal: context.runnerTerminal,
1323
2004
  width: Math.min(Math.max(presentation.columns ?? PLAIN_WIDTH, 60), 120),
1324
- paint: paint(presentation.color),
2005
+ colorDepth: presentation.colorDepth,
1325
2006
  finish: async (summary) => {
1326
2007
  for (const line of summary) await writer(line);
1327
2008
  }
1328
2009
  };
1329
2010
  }
1330
- return liveView(context, paint(presentation.color), {
2011
+ return liveView(context, presentation.colorDepth, {
1331
2012
  showOutput: options.showOutput || options.verbose,
1332
2013
  verbose: options.verbose
1333
2014
  });
@@ -1343,8 +2024,9 @@ function droppingWriter(write) {
1343
2024
  }
1344
2025
  };
1345
2026
  }
1346
- function liveView(context, colors, options) {
2027
+ function liveView(context, colorDepth, options) {
1347
2028
  const { showOutput } = options;
2029
+ const colors = paint(colorDepth !== "none");
1348
2030
  const terminal = context.progressTerminal;
1349
2031
  let state = EMPTY_RUN_STATE;
1350
2032
  let phase;
@@ -1393,7 +2075,7 @@ function liveView(context, colors, options) {
1393
2075
  get width() {
1394
2076
  return terminal.columns();
1395
2077
  },
1396
- paint: colors,
2078
+ colorDepth,
1397
2079
  finish: async (summary) => {
1398
2080
  if (finished) return;
1399
2081
  finished = true;
@@ -1435,6 +2117,9 @@ function noticeLines(timed, origin, verbose) {
1435
2117
  case "test":
1436
2118
  case "test-event-unreadable":
1437
2119
  case "test-events-incomplete":
2120
+ case "sandboxes-started":
2121
+ case "sandbox":
2122
+ case "sandbox-ended":
1438
2123
  return [];
1439
2124
  }
1440
2125
  }
@@ -1467,122 +2152,115 @@ function runnerNoticeLines(event, line) {
1467
2152
  }
1468
2153
  }
1469
2154
 
1470
- // src/commands/exec/plan-run.ts
1471
- async function planRun(app, lifecycles, request, planCommand, signal) {
1472
- const file = await loadSettingsFile(app.context.config, app.cwd, RESOURCES);
1473
- if (!file.ok) return file;
1474
- const configFile = file.path;
1475
- const settings = fileSettings(file, request);
1476
- let where;
1477
- if (request.unsandboxed) where = { kind: "unsandboxed" };
1478
- else {
1479
- if (settings.runner === void 0) return refused(runErrors.missingRunner({ configFile }));
1480
- const required = requireTarget(settings.scope, settings.project);
1481
- if (!required.ok) return required;
1482
- const recipe = settings.runner.value;
1483
- const secrets = readRunnerSecrets(recipe, app.env);
1484
- if (!secrets.ok)
1485
- return refused(
1486
- runErrors.runnerSecretsInvalid({
1487
- variables: secrets.variables.map(({ name, problem }) => ({ name, problem })),
1488
- minLength: RUNNER_SECRET_MIN_LENGTH,
1489
- configFile
1490
- })
1491
- );
1492
- where = { kind: "runner", recipe, target: required.target, secrets: secrets.values };
1493
- }
1494
- const merged = settleRunResources(file, request.given);
1495
- if (!merged.ok) return merged;
1496
- const command = await planCommand(where, signal, { testPlan: settings.testPlan?.value === true });
1497
- if (signal.aborted) return refused(canceledBeforeStart());
1498
- if (!command.ok) {
1499
- const secrets = [
1500
- ...where.kind === "runner" ? Object.values(where.secrets) : [],
1501
- ...lifecycles.secrets(merged.options)
1502
- ];
1503
- return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
1504
- }
1505
- const run = Object.freeze({ testPlan: command.testPlan });
1506
- const resolved = merged.plan(run);
1507
- if (!resolved.ok) return resolved;
1508
- return {
1509
- ok: true,
1510
- configFile,
1511
- settings,
1512
- where,
1513
- argv: command.argv,
1514
- testPlan: command.testPlan,
1515
- resources: resolved.resources,
1516
- planOptions: resolved.planned.map(planOption)
1517
- };
1518
- }
1519
- function planOption({ path, value, source }) {
1520
- return { path, value, from: source };
1521
- }
1522
- async function resourcesBeforeRun(lifecycles, plan, request) {
1523
- const { configFile, resources, settings } = plan;
1524
- const used = await lifecycles.beforeRun(resources);
1525
- if (!used.ok) return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
1526
- if (request.credential !== void 0 && !used.needsVercelCredential)
1527
- return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
1528
- let where;
1529
- if (plan.where.kind === "runner") where = plan.where;
1530
- else if (used.needsVercelCredential) {
1531
- const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
1532
- if (!chosen.ok) return chosen;
1533
- where = { kind: "unsandboxed", credential: chosen.credential };
1534
- } else where = { kind: "unsandboxed", credential: void 0 };
1535
- return { ok: true, where, used };
1536
- }
1537
- function canceledBeforeStart() {
1538
- return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
1539
- }
1540
-
1541
2155
  // src/commands/exec/run-command.ts
1542
2156
  var OWN_RUN_FIELDS = {
1543
- scope: z5.string().min(1).optional(),
1544
- project: z5.string().min(1).optional(),
1545
- credential: z5.enum(["mint", "github-actions"]).optional(),
1546
- unsandboxed: z5.boolean().default(false),
1547
- showOutput: z5.boolean().default(false),
1548
- keepSandbox: z5.string().optional(),
1549
- verbose: z5.boolean().default(false)
2157
+ scope: z7.string().min(1).optional(),
2158
+ project: z7.string().min(1).optional(),
2159
+ credential: z7.enum(["mint", "github-actions"]).optional(),
2160
+ showOutput: z7.boolean().default(false),
2161
+ keepSandbox: z7.string().optional(),
2162
+ verbose: z7.boolean().default(false),
2163
+ planOnly: z7.boolean().default(false)
1550
2164
  };
1551
2165
  var RUN_REQUEST_FIELDS = { ...OWN_RUN_FIELDS, ...resourceFlagFields(Object.keys(OWN_RUN_FIELDS)) };
1552
2166
  var RUN_CLI_OPTIONS = { project: { short: "p" } };
1553
- var runRequestSchema = z5.object(RUN_REQUEST_FIELDS);
1554
- async function runCommand({ app, ui, signal }, request, spec) {
1555
- const lifecycles = DEFINITION_SET.lifecycles(app.resourceContexts);
1556
- const planned = await planRun(
1557
- app,
1558
- lifecycles,
1559
- { ...request, given: resourceFlagValues(request) },
1560
- spec.planCommand,
1561
- signal
1562
- );
1563
- if (!planned.ok) return planned.refusal;
1564
- const { configFile, argv, testPlan, planOptions } = planned;
2167
+ var runRequestSchema = z7.object(RUN_REQUEST_FIELDS);
2168
+ async function beforeRunStarts({ ui, signal }, lifecycles, planned, request, plan) {
1565
2169
  const before = await resourcesBeforeRun(lifecycles, planned, request);
1566
- if (!before.ok) return before.refusal;
1567
- if (signal.aborted) return canceledBeforeStart();
1568
- const { where, used } = before;
1569
- const plan = recordedPlan(testPlan, planOptions);
2170
+ if (!before.ok) return before;
2171
+ if (signal.aborted) return { ok: false, refusal: canceledBeforeStart() };
1570
2172
  if (plan !== void 0) await ui.progress?.(testPlanLine(plan));
2173
+ return before;
2174
+ }
2175
+ async function prepareRunSession(context, lifecycles, planned, request) {
2176
+ const { app } = context;
2177
+ const { configFile, argv, testPlan, planOptions } = planned;
2178
+ const plan = recordedPlan(testPlan, planOptions);
2179
+ const before = await beforeRunStarts(context, lifecycles, planned, request, plan);
2180
+ if (!before.ok) return before;
2181
+ const { where, used } = before;
1571
2182
  const base = {
1572
2183
  argv,
1573
- // A resource the run uses can hide launcher environment variables that could point the command at something else
1574
- // than the run payload names, so the command never sees one.
1575
2184
  env: Object.fromEntries(Object.entries(app.env).filter(([name]) => !used.hiddenVariables.includes(name))),
1576
2185
  version: app.version,
1577
2186
  commit: app.commit,
1578
2187
  configFile,
1579
- verbose: request.verbose
2188
+ verbose: request.verbose,
2189
+ resources: used.requests,
2190
+ skipped: used.skipped
1580
2191
  };
1581
- const requested = await runRequestFor(app, { where, used, base, request, configFile });
1582
- if (!requested.ok) return requested.refusal;
1583
- const { run } = requested;
1584
- const secrets = [...used.secrets, ...Object.values(run.runner?.secrets ?? {})];
1585
- const redact = redactor(secrets);
2192
+ let run;
2193
+ if (where.kind === "runner") {
2194
+ const keepMs = keepSandboxMinutes(request.keepSandbox, where.recipe) * 6e4;
2195
+ const requested = await runnerRequestFor(app, where, used, { configFile, sandboxes: 1, keepMs });
2196
+ if (!requested.ok) return requested;
2197
+ run = { ...base, runner: requested.runner };
2198
+ } else run = { ...base, ...where.credential === void 0 ? {} : { credential: where.credential } };
2199
+ const secrets = [...used.secrets, ...where.kind === "runner" ? where.secrets : []];
2200
+ const git = await checkoutGit(app.context.checkout, app.cwd);
2201
+ return { ok: true, plan, run, secrets, redact: redactor(secrets), git };
2202
+ }
2203
+ async function runLifecycle(options) {
2204
+ try {
2205
+ const ended = await options.execute();
2206
+ return options.hasSecrets ? redactStrings(ended, options.redact) : ended;
2207
+ } catch (error) {
2208
+ await options.finishView();
2209
+ await options.abandonRecording();
2210
+ throw error;
2211
+ }
2212
+ }
2213
+ function mapStoppedOutcome(outcome, canceledOptions) {
2214
+ switch (outcome.kind) {
2215
+ case "resource_refused":
2216
+ return resourceRefused(outcome, RUN_CLEANUP.facts(outcome));
2217
+ case "mint_failed":
2218
+ return mintFailedErrors.mintFailed({
2219
+ ...outcome.target,
2220
+ ...describeMintFailure(outcome.failure, outcome.target),
2221
+ runner: outcome.runner,
2222
+ cleanup: RUN_CLEANUP.facts(outcome)
2223
+ });
2224
+ case "spawn_failed":
2225
+ return runErrors.spawnFailed({
2226
+ executable: outcome.executable,
2227
+ message: outcome.message,
2228
+ cleanup: RUN_CLEANUP.facts({ runnerCleanup: null, resourceCleanup: outcome.resourceCleanup })
2229
+ });
2230
+ case "canceled":
2231
+ return outcomes.canceled({ changed: canceledChanges(outcome, canceledOptions) });
2232
+ case "runner_failed":
2233
+ return runErrors.runnerFailed({
2234
+ failure: runnerFailureFacts(outcome.failure),
2235
+ cleanup: RUN_CLEANUP.facts(outcome)
2236
+ });
2237
+ case "snapshot_gone":
2238
+ return runErrors.snapshotGone({
2239
+ snapshotId: outcome.entry.snapshotId,
2240
+ base: outcome.entry.base,
2241
+ removal: outcome.removal === void 0 ? null : { ...outcome.removal },
2242
+ cleanup: RUN_CLEANUP.facts(outcome)
2243
+ });
2244
+ }
2245
+ }
2246
+ async function planCommandRun(app, request, planCommand, signal) {
2247
+ const lifecycles = DEFINITION_SET.lifecycles(app.resourceContexts);
2248
+ const planned = await planRun(
2249
+ app,
2250
+ lifecycles,
2251
+ { ...request, given: resourceFlagValues(request) },
2252
+ planCommand,
2253
+ signal
2254
+ );
2255
+ if (!planned.ok) return planned;
2256
+ return { ok: true, planned, lifecycles };
2257
+ }
2258
+ async function runPlannedCommand(context, request, spec, planned, lifecycles) {
2259
+ const { app, ui, signal } = context;
2260
+ const { configFile, argv, testPlan, planOptions } = planned;
2261
+ const session = await prepareRunSession(context, lifecycles, planned, request);
2262
+ if (!session.ok) return session.refusal;
2263
+ const { plan, run, secrets, redact, git } = session;
1586
2264
  const sigterm = forwardSigterm(signal);
1587
2265
  const view = runView({
1588
2266
  presentation: app.presentation,
@@ -1591,13 +2269,13 @@ async function runCommand({ app, ui, signal }, request, spec) {
1591
2269
  showOutput: request.showOutput,
1592
2270
  verbose: request.verbose
1593
2271
  });
1594
- const git = await checkoutGit(app.context.checkout, app.cwd);
1595
2272
  const recording = await recordRun(app.context.runDirectories, {
1596
2273
  definitionSet: DEFINITION_SET,
1597
- startedAt: app.context.clock.now(),
2274
+ clock: app.context.clock,
1598
2275
  cwd: app.cwd,
1599
2276
  configFile,
1600
2277
  argv,
2278
+ ...spec.test === void 0 ? {} : { test: spec.test },
1601
2279
  plan,
1602
2280
  run,
1603
2281
  git,
@@ -1606,22 +2284,20 @@ async function runCommand({ app, ui, signal }, request, spec) {
1606
2284
  const observer = recording.observer(view.observer);
1607
2285
  const terminal = recording.terminal(view.runnerTerminal);
1608
2286
  const collected = run.runner !== void 0 || recording.testEvents !== void 0;
1609
- let outcome;
1610
- try {
1611
- const ended = await executeRun(
2287
+ const outcome = await runLifecycle({
2288
+ execute: async () => await executeRun(
1612
2289
  DEFINITION_SET,
1613
2290
  { ...app.context, runnerTerminal: secrets.length === 0 ? terminal : redactingTerminal(terminal, redact) },
1614
2291
  app.resourceContexts,
1615
2292
  run.runner === void 0 && recording.testEvents !== void 0 ? { ...run, testEvents: recording.testEvents } : run,
1616
2293
  { signal, terminate: sigterm.terminate },
1617
2294
  timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))
1618
- );
1619
- outcome = secrets.length === 0 ? ended : redactStrings(ended, redact);
1620
- } catch (error) {
1621
- await view.finish([]);
1622
- await recording.abandon();
1623
- throw error;
1624
- }
2295
+ ),
2296
+ redact,
2297
+ hasSecrets: secrets.length > 0,
2298
+ finishView: async () => await view.finish([]),
2299
+ abandonRecording: async () => await recording.abandon()
2300
+ });
1625
2301
  sigterm.release();
1626
2302
  const { timeline: ran, finalResults } = await summarize(app, {
1627
2303
  command: spec.name,
@@ -1630,143 +2306,84 @@ async function runCommand({ app, ui, signal }, request, spec) {
1630
2306
  recording,
1631
2307
  outcome
1632
2308
  });
1633
- switch (outcome.kind) {
1634
- case "ran": {
1635
- const { command } = outcome;
1636
- const runId = recording.opened.ok ? recording.opened.id : null;
1637
- app.exit.status = commandExitStatus(outcome.command);
1638
- return spec.ran(
1639
- {
1640
- version: app.version,
1641
- commit: app.commit,
1642
- configFile,
1643
- resources: DEFINITION_SET.reports.ranFacts(outcome.resources),
1644
- cleanup: RUN_CLEANUP.facts(outcome),
1645
- command: command.kind === "exited" ? { exitCode: command.code, signal: null } : command.kind === "signaled" ? { exitCode: null, signal: command.signal } : { exitCode: null, signal: null },
1646
- runner: outcome.runner === void 0 ? null : {
1647
- snapshotId: outcome.runner.snapshotId,
1648
- base: outcome.runner.base,
1649
- builtBehind: outcome.runner.builtBehind,
1650
- uploadBytes: outcome.runner.uploadBytes,
1651
- built: outcome.runner.built,
1652
- vcpus: outcome.runner.vcpus,
1653
- region: outcome.runner.region,
1654
- runtime: outcome.runner.runtime,
1655
- buildMs: outcome.runner.buildMs
1656
- },
1657
- timeline: ran,
1658
- runId,
1659
- noFinalTestResults: lacksFinalResults(command.kind === "exited" ? command.code : null, {
1660
- ...finalResults,
1661
- collected
1662
- })
1663
- },
1664
- { testPlan, options: planOptions }
1665
- );
2309
+ if (outcome.kind !== "ran") return mapStoppedOutcome(outcome);
2310
+ const { command } = outcome;
2311
+ const runId = recording.opened.ok ? recording.opened.id : null;
2312
+ app.exit.status = commandExitStatus(outcome.command);
2313
+ return spec.ran(
2314
+ {
2315
+ version: app.version,
2316
+ commit: app.commit,
2317
+ configFile,
2318
+ resources: DEFINITION_SET.reports.ranFacts(outcome.resources),
2319
+ cleanup: RUN_CLEANUP.facts(outcome),
2320
+ command: command.kind === "exited" ? { exitCode: command.code, signal: null } : command.kind === "signaled" ? { exitCode: null, signal: command.signal } : { exitCode: null, signal: null },
2321
+ runner: outcome.runner === void 0 ? null : {
2322
+ snapshotId: outcome.runner.snapshotId,
2323
+ base: outcome.runner.base,
2324
+ builtBehind: outcome.runner.builtBehind,
2325
+ uploadBytes: outcome.runner.uploadBytes,
2326
+ built: outcome.runner.built,
2327
+ vcpus: outcome.runner.vcpus,
2328
+ region: outcome.runner.region,
2329
+ runtime: outcome.runner.runtime,
2330
+ buildMs: outcome.runner.buildMs
2331
+ },
2332
+ timeline: ran,
2333
+ runId
2334
+ },
2335
+ { testPlan, options: planOptions },
2336
+ lacksFinalResults(command.kind === "exited" ? command.code : null, {
2337
+ ...finalResults,
2338
+ collected
2339
+ })
2340
+ );
2341
+ }
2342
+ function sandboxesFlagProblems(request) {
2343
+ const flag = request.sandboxes !== void 0 ? "--sandboxes" : request.fileLists !== void 0 ? "--file-lists" : void 0;
2344
+ if (flag === void 0) return [];
2345
+ return request.showOutput ? [
2346
+ {
2347
+ field: "showOutput",
2348
+ message: `A run with ${flag} prints status lines and no step output, and each runner sandbox entry of its run directory keeps its step logs; drop --show-output.`
1666
2349
  }
1667
- case "resource_refused":
1668
- return resourceRefused(outcome, RUN_CLEANUP.facts(outcome));
1669
- // The run's mint: in a sandboxed run for the runner sandbox, in an unsandboxed run for a resource that needed it:
1670
- // its `acquireForRun` answered `mintFailed`, which the launcher owns.
1671
- case "mint_failed":
1672
- return mintFailedErrors.mintFailed({
1673
- ...outcome.target,
1674
- ...describeMintFailure(outcome.failure, outcome.target),
1675
- runner: outcome.runner,
1676
- cleanup: RUN_CLEANUP.facts(outcome)
1677
- });
1678
- case "spawn_failed":
1679
- return runErrors.spawnFailed({
1680
- executable: outcome.executable,
1681
- message: outcome.message,
1682
- // Only an unsandboxed run spawns its command on this machine, so it holds no runner sandbox.
1683
- cleanup: RUN_CLEANUP.facts({ runnerCleanup: null, resourceCleanup: outcome.resourceCleanup })
1684
- });
1685
- case "canceled":
1686
- return outcomes.canceled({ changed: canceledChanges(outcome) });
1687
- case "runner_failed":
1688
- return runErrors.runnerFailed({
1689
- failure: runnerFailureFacts(outcome.failure),
1690
- cleanup: RUN_CLEANUP.facts(outcome)
1691
- });
1692
- case "snapshot_gone":
1693
- return runErrors.snapshotGone({
1694
- snapshotId: outcome.entry.snapshotId,
1695
- base: outcome.entry.base,
1696
- removal: outcome.removal === void 0 ? null : { ...outcome.removal },
1697
- cleanup: RUN_CLEANUP.facts(outcome)
1698
- });
1699
- }
2350
+ ] : [];
1700
2351
  }
1701
- function runProblems(request) {
1702
- const { credential, unsandboxed, showOutput, keepSandbox } = request;
2352
+ function runFlagProblems(request) {
2353
+ const { keepSandbox } = request;
1703
2354
  return [
1704
2355
  ...resourceFlagProblems(request),
1705
- ...!unsandboxed && credential === "github-actions" ? [
1706
- {
1707
- field: "credential",
1708
- message: "A sandboxed run needs the mint: the runner sandbox uses a minted Vercel token. Add --unsandboxed, or drop --credential github-actions."
1709
- }
1710
- ] : [],
1711
- ...showOutput && unsandboxed ? [
1712
- {
1713
- field: "showOutput",
1714
- message: "--show-output prints a sandboxed run's step output; drop it or --unsandboxed."
1715
- }
1716
- ] : [],
1717
2356
  ...keepSandbox !== void 0 && parseKeepTime(keepSandbox) === void 0 ? [
1718
2357
  {
1719
2358
  field: "keepSandbox",
1720
2359
  message: `--keep-sandbox takes 0, or a whole number of minutes or hours up to 5h, such as 30m or 2h, not ${JSON.stringify(keepSandbox)}.`
1721
2360
  }
1722
- ] : [],
1723
- ...keepSandbox !== void 0 && unsandboxed ? [
1724
- {
1725
- field: "keepSandbox",
1726
- message: "--keep-sandbox keeps a sandboxed run's runner sandbox; drop it or --unsandboxed."
1727
- }
1728
2361
  ] : []
1729
2362
  ];
1730
2363
  }
1731
- async function runRequestFor(app, options) {
1732
- const { where, used, base, request, configFile } = options;
1733
- if (where.kind === "unsandboxed") {
1734
- const run2 = {
1735
- ...base,
1736
- resources: used.requests,
1737
- skipped: used.skipped,
1738
- ...where.credential === void 0 ? {} : { credential: where.credential }
1739
- };
1740
- return { ok: true, run: run2 };
1741
- }
2364
+ async function runnerRequestFor(app, where, used, options) {
1742
2365
  const prepared = await prepareRunner(app.context, {
1743
2366
  cwd: app.cwd,
1744
2367
  recipe: where.recipe,
1745
- // The recipe's `vcpus` reads each of the run's resources by its definition: one its `beforeRun` skipped isn't.
1746
- vcpusRun: recipeRun(recipeResources(used.requests))
2368
+ vcpusRun: recipeRun(recipeResources(used.requests), options.sandboxes)
1747
2369
  });
1748
2370
  if (prepared.kind !== "ok") {
1749
- const refusal = prepareRefusal(prepared, configFile);
1750
- const secrets = [...used.secrets, ...Object.values(where.secrets)];
2371
+ const refusal = prepareRefusal(prepared, options.configFile);
2372
+ const secrets = [...used.secrets, ...where.secrets];
1751
2373
  return {
1752
2374
  ok: false,
1753
2375
  refusal: secrets.length === 0 ? refusal : redactStrings(refusal, redactor(secrets))
1754
2376
  };
1755
2377
  }
1756
- const keepMs = keepSandboxMinutes(request.keepSandbox, where.recipe, app.env) * 6e4;
1757
- const run = {
1758
- ...base,
1759
- resources: used.requests,
1760
- skipped: used.skipped,
1761
- runner: {
1762
- prepared: prepared.prepared,
1763
- target: where.target,
1764
- user: app.user,
1765
- secrets: where.secrets,
1766
- keepMs
1767
- }
2378
+ const runner = {
2379
+ prepared: prepared.prepared,
2380
+ target: where.target,
2381
+ user: app.user,
2382
+ credentials: where.credentials,
2383
+ ...Object.keys(where.unsafeSecretEnvVars).length === 0 ? {} : { unsafeSecretEnvVars: where.unsafeSecretEnvVars },
2384
+ keepMs: options.keepMs
1768
2385
  };
1769
- return { ok: true, run };
2386
+ return { ok: true, runner };
1770
2387
  }
1771
2388
  function prepareRefusal(prepared, configFile) {
1772
2389
  switch (prepared.kind) {
@@ -1798,6 +2415,7 @@ async function summarize(app, run) {
1798
2415
  const stepLogs = failedStepLogs(timeline, recording, app.env);
1799
2416
  const clock = workerClock(recorded);
1800
2417
  const charted = clock === void 0 ? void 0 : testsChart(tests.events, run.hints, tests.unreadable, clock, tests.incomplete);
2418
+ const workersHint = charted !== void 0 && hasPoorParallelism(charted.parallelism);
1801
2419
  const summarized = await app.context.jobSummary.appendJobSummary(
1802
2420
  jobSummaryMarkdown(timeline, {
1803
2421
  command: run.command,
@@ -1808,8 +2426,8 @@ async function summarize(app, run) {
1808
2426
  await view.finish(
1809
2427
  waterfallLines(timeline, {
1810
2428
  width: view.width,
1811
- paint: view.paint,
1812
- logs: logsText(recording, recorded.writeFailure, app.env, failed),
2429
+ colorDepth: view.colorDepth,
2430
+ logs: logsText(recording, recorded.writeFailure, app.env, failed, workersHint),
1813
2431
  ...charted === void 0 ? {} : { workers: charted.lanes },
1814
2432
  details: [
1815
2433
  ...charted?.notes ?? testsLines,
@@ -1827,7 +2445,7 @@ async function summarize(app, run) {
1827
2445
  };
1828
2446
  }
1829
2447
  function workerClock({ timeline, workerOffsetMs }) {
1830
- const tests = timeline.rows.find((row) => row.name === "tests");
2448
+ const tests = timeline.rows.find((row) => row.name === "command");
1831
2449
  if (tests === void 0) return void 0;
1832
2450
  return { runStartedAt: Date.parse(timeline.startedAt), offsetMs: workerOffsetMs, tests };
1833
2451
  }
@@ -1836,14 +2454,15 @@ function displayPath(path, env) {
1836
2454
  if (home === void 0 || home === "" || !path.startsWith(`${home}/`)) return path;
1837
2455
  return `~${path.slice(home.length)}`;
1838
2456
  }
1839
- function logsText({ opened }, writeFailure, env, failed) {
2457
+ function logsText({ opened }, writeFailure, env, failed, workersHint) {
1840
2458
  if (!opened.ok) return `none: couldn't make ${opened.failure.path}: ${opened.failure.message}`;
1841
2459
  const path = `${displayPath(opened.path, env)}/`;
1842
2460
  const problems = [
1843
2461
  ...writeFailure === void 0 ? [] : [`couldn't write ${writeFailure.path}: ${writeFailure.message}`],
1844
2462
  ...opened.pruneFailures.slice(0, 1).map((failure) => `couldn't remove ${failure.path}: ${failure.message}`)
1845
2463
  ];
1846
- const show = `storm runs show ${opened.id}${failed ? " --failed" : ""}`;
2464
+ const flags = `${failed ? " --failed" : ""}${workersHint ? " --workers" : ""}`;
2465
+ const show = `storm runs show ${opened.id}${flags}`;
1847
2466
  return `${problems.length === 0 ? path : `${path} (${problems.join("; ")})`} \xB7 ${show}`;
1848
2467
  }
1849
2468
  async function checkoutGit(checkout, cwd) {
@@ -1860,10 +2479,9 @@ function recipeResources(requests) {
1860
2479
  })
1861
2480
  );
1862
2481
  }
1863
- var DEFAULT_KEEP_SANDBOX_MINUTES = 30;
1864
- function keepSandboxMinutes(flag, recipe, env) {
2482
+ function keepSandboxMinutes(flag, recipe) {
1865
2483
  const fromFlag = flag === void 0 ? void 0 : parseKeepTime(flag);
1866
- return fromFlag ?? recipe.keepSandboxMinutes ?? (isCi(env) ? 0 : DEFAULT_KEEP_SANDBOX_MINUTES);
2484
+ return fromFlag ?? recipe.keepSandboxMinutes ?? 0;
1867
2485
  }
1868
2486
  function failedStepLogs(timeline, recording, env) {
1869
2487
  const runner = timeline.rows.find((row) => row.name === "runner");
@@ -1883,54 +2501,91 @@ function runnerFailureFacts(failure) {
1883
2501
  return { kind: failure.kind, operation: failure.operation, status: failure.status, message: failure.message };
1884
2502
  case "checkout-failed":
1885
2503
  return { kind: failure.kind, message: failure.failure.message, command: failure.failure.displayCommand ?? null };
2504
+ case "network-policy-failed":
2505
+ return {
2506
+ kind: failure.kind,
2507
+ operation: failure.operation,
2508
+ around: failure.around,
2509
+ reason: failure.reason,
2510
+ status: failure.status,
2511
+ message: failure.message
2512
+ };
1886
2513
  case "credential-claims-missing":
1887
2514
  return { kind: failure.kind, ...failure.target };
1888
2515
  }
1889
2516
  }
1890
2517
  var NOTHING_RELEASED = { runnerCleanup: null, resourceCleanup: {} };
1891
- function canceledChanges(outcome) {
2518
+ function canceledChanges(outcome, options = {}) {
1892
2519
  const { commandStopped } = outcome;
1893
2520
  const lines = [
1894
- commandStopped === true ? "The command was stopped in the runner sandbox." : "The command didn't run."
2521
+ options.commandLine ?? (commandStopped === true ? "The command was stopped in the runner sandbox." : "The command didn't run.")
1895
2522
  ];
1896
2523
  const cleanup = RUN_CLEANUP.facts(outcome).runner;
1897
- if (cleanup !== null) lines.push(...runnerCleanupLines(cleanup));
2524
+ if (cleanup !== null) lines.push(...runnerCleanupLines(cleanup, options.keptLines));
2525
+ else if (options.keptLines !== void 0) lines.push(...options.keptLines);
1898
2526
  lines.push(...DEFINITION_SET.reports.canceledLines(outcome.resourceCleanup));
1899
2527
  return lines.join("\n");
1900
2528
  }
1901
- function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
2529
+ function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }, keptLines) {
1902
2530
  const problems = [
1903
2531
  ...notKept === null ? [] : [notKeptText(notKept)],
1904
2532
  ...notStopped.map(notStoppedText),
1905
2533
  ...notDeleted.map(notDeletedText)
1906
2534
  ];
1907
- if (kept === null)
2535
+ const allKept = [...kept === null ? [] : [keptText(kept)], ...keptLines ?? []];
2536
+ if (allKept.length === 0)
1908
2537
  return problems.length === 0 ? ["Every sandbox the runner started is stopped and deleted."] : problems;
1909
2538
  return [
1910
- keptText(kept),
2539
+ ...allKept,
1911
2540
  ...problems.length === 0 ? ["Every other sandbox the runner started is stopped and deleted."] : problems
1912
2541
  ];
1913
2542
  }
1914
2543
 
1915
2544
  export {
1916
- EXEC_HELP,
1917
- EXEC_HINTS,
2545
+ lacksFinalResults,
1918
2546
  notStoppedText,
1919
2547
  notDeletedText,
1920
2548
  RUN_CLEANUP,
2549
+ acrossSandboxesJobSummaryMarkdown,
2550
+ plannedSchema,
2551
+ plannedSecrets,
2552
+ buildPlannedFacts,
2553
+ PLANNED_DESCRIPTION,
2554
+ renderPlanned,
2555
+ readFileListsFile,
2556
+ resolveCallerFileLists,
2557
+ sandboxesRanSchema,
2558
+ SANDBOXES_RAN_DESCRIPTION,
2559
+ renderSandboxesRan,
2560
+ sandboxesErrors,
2561
+ sandboxesDefaultErrors,
2562
+ fileListErrors,
1921
2563
  ranSchema,
1922
2564
  RAN_DESCRIPTION,
1923
- ranRenderer,
2565
+ renderRan,
1924
2566
  runErrors,
1925
2567
  RUN_ERRORS,
1926
2568
  outcomes,
1927
- lineProgress,
1928
2569
  canceledBeforeStart,
2570
+ lineProgress,
2571
+ plainRenderer,
2572
+ progressLine,
2573
+ commandEnd,
1929
2574
  RUN_REQUEST_FIELDS,
1930
2575
  RUN_CLI_OPTIONS,
1931
- runCommand,
1932
- runProblems,
2576
+ beforeRunStarts,
2577
+ runLifecycle,
2578
+ mapStoppedOutcome,
2579
+ planCommandRun,
2580
+ runPlannedCommand,
2581
+ sandboxesFlagProblems,
2582
+ runFlagProblems,
2583
+ runnerRequestFor,
1933
2584
  prepareRefusal,
1934
2585
  checkoutFailedRefusal,
2586
+ displayPath,
2587
+ logsText,
2588
+ checkoutGit,
2589
+ recipeResources,
1935
2590
  runnerFailureFacts
1936
2591
  };