@cnc-tools/storm 0.14.2 → 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 (401) hide show
  1. package/dist/application.js +3 -1
  2. package/dist/bin/storm.js +9 -7
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/chunk-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-3HBPNQ4Y.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-RUPD4TLT.js → chunk-KC4KDJ5K.js} +147 -26
  14. package/dist/chunks/{chunk-I7AN3DIJ.js → chunk-L36GBUBB.js} +1626 -676
  15. package/dist/chunks/{chunk-XZCDA5PE.js → chunk-OX7X4B2L.js} +7 -2
  16. package/dist/chunks/{chunk-UUBZTGLV.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-LUOHJ3LB.js → chunk-RAQEXKL6.js} +1120 -465
  21. package/dist/chunks/{chunk-GJOEPJJL.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-HDL4WKIB.js → chunk-XEVHP5ZW.js} +2 -2
  25. package/dist/chunks/{chunk-VH2POPW5.js → chunk-YV7GE6EV.js} +635 -79
  26. package/dist/chunks/{chunk-GQIL3AHY.js → chunk-ZG3WQ4UF.js} +1 -1
  27. package/dist/chunks/{live-app-SZGEILCQ.js → live-app-PI3BAN6Y.js} +28 -23
  28. package/dist/command-tree.d.ts +2 -2
  29. package/dist/command-tree.js +2 -2
  30. package/dist/commands/exec/across-sandboxes-outcomes.d.ts +364 -0
  31. package/dist/commands/exec/across-sandboxes-outcomes.js +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 +12 -8
  153. package/dist/context.js +9 -3
  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 +2 -1
  163. package/dist/core/payload.js +2 -1
  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.js +4 -3
  239. package/dist/local-services.js +1 -1
  240. package/dist/planning/driver-file-lists.d.ts +61 -0
  241. package/dist/planning/driver-file-lists.js +66 -0
  242. package/dist/{commands/exec → planning}/driver-refusals.d.ts +11 -10
  243. package/dist/{commands/exec → planning}/driver-refusals.js +18 -14
  244. package/dist/planning/file-lists-file.d.ts +58 -0
  245. package/dist/planning/file-lists-file.js +105 -0
  246. package/dist/planning/file-lists.d.ts +28 -0
  247. package/dist/planning/file-lists.js +52 -0
  248. package/dist/{commands/exec → planning}/final-results.d.ts +1 -1
  249. package/dist/{commands/exec → planning}/final-results.js +6 -6
  250. package/dist/planning/plan-only.d.ts +81 -0
  251. package/dist/planning/plan-only.js +83 -0
  252. package/dist/{commands/exec → planning}/redaction.d.ts +2 -2
  253. package/dist/{commands/exec → planning}/redaction.js +5 -4
  254. package/dist/{commands/exec → planning}/resource-flags.d.ts +5 -12
  255. package/dist/{commands/exec → planning}/resource-flags.js +6 -16
  256. package/dist/planning/run-kind-flags.d.ts +20 -0
  257. package/dist/planning/run-kind-flags.js +48 -0
  258. package/dist/planning/run-plan.d.ts +30 -0
  259. package/dist/planning/run-plan.js +4 -0
  260. package/dist/planning/sandbox-placeholders.d.ts +22 -0
  261. package/dist/planning/sandbox-placeholders.js +60 -0
  262. package/dist/planning/suite-not-found.d.ts +37 -0
  263. package/dist/planning/suite-not-found.js +36 -0
  264. package/dist/planning/suites.d.ts +43 -0
  265. package/dist/planning/suites.js +89 -0
  266. package/dist/{commands/exec → planning}/test-plan.d.ts +8 -3
  267. package/dist/{commands/exec → planning}/test-plan.js +32 -4
  268. package/dist/playwright/reporter.d.ts +20 -8
  269. package/dist/playwright/reporter.js +195 -15
  270. package/dist/presentation.d.ts +10 -6
  271. package/dist/presentation.js +13 -15
  272. package/dist/run-directory/gateways.d.ts +60 -4
  273. package/dist/run-directory/index.d.ts +4 -4
  274. package/dist/run-directory/index.js +2 -1
  275. package/dist/run-directory/live/run-directory-gateway.js +92 -16
  276. package/dist/run-directory/plan.d.ts +35 -2
  277. package/dist/run-directory/plan.js +44 -7
  278. package/dist/run-directory/reader.d.ts +26 -5
  279. package/dist/run-directory/reader.js +24 -1
  280. package/dist/run-directory/recording.d.ts +75 -49
  281. package/dist/run-directory/recording.js +214 -28
  282. package/dist/run-directory/run-directory.d.ts +22 -1
  283. package/dist/run-directory/run-directory.js +24 -0
  284. package/dist/run-directory/run-record.d.ts +144 -21
  285. package/dist/run-directory/run-record.js +118 -19
  286. package/dist/run-directory/timeline-facts.js +4 -4
  287. package/dist/runner/build-snapshots.d.ts +7 -7
  288. package/dist/runner/build-snapshots.js +12 -16
  289. package/dist/runner/events.d.ts +29 -8
  290. package/dist/runner/gateways.d.ts +49 -6
  291. package/dist/runner/index.d.ts +6 -4
  292. package/dist/runner/index.js +3 -2
  293. package/dist/runner/live/sandbox-gateway.js +161 -31
  294. package/dist/runner/network-policy.d.ts +55 -0
  295. package/dist/runner/network-policy.js +46 -0
  296. package/dist/runner/policy-writes.d.ts +40 -0
  297. package/dist/runner/policy-writes.js +124 -0
  298. package/dist/runner/prepare.d.ts +6 -7
  299. package/dist/runner/ready.d.ts +39 -10
  300. package/dist/runner/ready.js +59 -47
  301. package/dist/runner/recipe-check.d.ts +6 -0
  302. package/dist/runner/recipe-check.js +29 -0
  303. package/dist/runner/recipe-secrets.d.ts +67 -0
  304. package/dist/runner/recipe-secrets.js +230 -0
  305. package/dist/runner/recipe.d.ts +115 -26
  306. package/dist/runner/recipe.js +147 -154
  307. package/dist/runner/sandboxed-command.d.ts +22 -8
  308. package/dist/runner/sandboxed-command.js +33 -10
  309. package/dist/runner/scope.d.ts +107 -21
  310. package/dist/runner/scope.js +274 -54
  311. package/dist/runner/secrets.d.ts +42 -31
  312. package/dist/runner/secrets.js +62 -40
  313. package/dist/runner/session.d.ts +59 -26
  314. package/dist/runner/session.js +82 -41
  315. package/dist/runner/snapshot-build.d.ts +7 -4
  316. package/dist/runner/snapshot-build.js +48 -28
  317. package/dist/runner/snapshot-choice.d.ts +37 -0
  318. package/dist/runner/snapshot-choice.js +38 -0
  319. package/dist/runner/snapshot-key.d.ts +16 -14
  320. package/dist/runner/snapshot-key.js +24 -18
  321. package/dist/runner/steps.d.ts +13 -5
  322. package/dist/runner/steps.js +34 -4
  323. package/dist/runner/time-limit.d.ts +10 -0
  324. package/dist/runner/time-limit.js +43 -0
  325. package/dist/sdk/extension/commands.d.ts +1 -7
  326. package/dist/sdk/extension/driver.d.ts +39 -46
  327. package/dist/sdk/extension/driver.js +6 -6
  328. package/dist/sdk/extension/index.d.ts +3 -3
  329. package/dist/sdk/extension/index.js +3 -4
  330. package/dist/sdk/extension/lifecycle.d.ts +52 -9
  331. package/dist/sdk/extension/lifecycle.js +1 -1
  332. package/dist/sdk/extension/resource-definition.d.ts +13 -10
  333. package/dist/sdk/extension/resource-definition.js +7 -2
  334. package/dist/sdk/extension/resource.d.ts +2 -2
  335. package/dist/sdk/extension/secret-source.d.ts +58 -0
  336. package/dist/sdk/extension/secret-source.js +78 -0
  337. package/dist/sdk/index.d.ts +2 -2
  338. package/dist/sdk/index.js +1 -1
  339. package/dist/sdk/run/launcher.d.ts +1 -1
  340. package/dist/sdk/run/launcher.js +1 -1
  341. package/dist/sdk/run/payload.d.ts +16 -1
  342. package/dist/sdk/run/payload.js +17 -2
  343. package/dist/sdk/run/redact.js +2 -2
  344. package/dist/sdk/run/test-events.d.ts +23 -6
  345. package/dist/sdk/run/test-events.js +6 -4
  346. package/dist/sdk/run/test-result-writer.d.ts +8 -3
  347. package/dist/sdk/run/test-result-writer.js +22 -2
  348. package/dist/{commands/exec → shared}/cleanup.d.ts +3 -3
  349. package/dist/{commands/exec → shared}/cleanup.js +11 -6
  350. package/dist/shared/job-summary.d.ts +19 -0
  351. package/dist/{commands/exec → shared}/job-summary.js +17 -0
  352. package/dist/shared/sandbox-table.d.ts +48 -0
  353. package/dist/shared/sandbox-table.js +109 -0
  354. package/dist/{commands/exec → shared}/snapshot-text.d.ts +1 -1
  355. package/dist/{commands/exec → shared}/tests-summary.d.ts +22 -6
  356. package/dist/{commands/exec → shared}/tests-summary.js +74 -31
  357. package/dist/{commands/exec → shared}/text.d.ts +7 -2
  358. package/dist/{commands/exec → shared}/text.js +9 -1
  359. package/dist/{commands/exec → shared}/waterfall.d.ts +8 -6
  360. package/dist/{commands/exec → shared}/waterfall.js +71 -24
  361. package/dist/shared/worker-chart.d.ts +172 -0
  362. package/dist/shared/worker-chart.js +623 -0
  363. package/dist/vitest/config.d.ts +35 -11
  364. package/dist/vitest/config.js +47 -14
  365. package/dist/vitest/index.d.ts +1 -1
  366. package/dist/vitest/index.js +3 -3
  367. package/dist/vitest/sequencer.d.ts +23 -0
  368. package/dist/vitest/sequencer.js +73 -0
  369. package/dist/vitest/setup.d.ts +1 -0
  370. package/dist/vitest/setup.js +34 -0
  371. package/dist/vitest/test-events.d.ts +32 -6
  372. package/dist/vitest/test-events.js +25 -5
  373. package/dist/vitest/test-results.d.ts +8 -3
  374. package/dist/vitest/test-results.js +6 -0
  375. package/package.json +7 -2
  376. package/skills/overview.md +21 -17
  377. package/skills/plan-runs.md +67 -0
  378. package/skills/read-run-output.md +51 -19
  379. package/dist/chunks/chunk-E3QU74NX.js +0 -49
  380. package/dist/chunks/chunk-HP54VHGY.js +0 -201
  381. package/dist/chunks/chunk-NMVODY3P.js +0 -19
  382. package/dist/chunks/chunk-TVMEKVOW.js +0 -607
  383. package/dist/commands/exec/define-run-command.d.ts +0 -671
  384. package/dist/commands/exec/define-run-command.js +0 -91
  385. package/dist/commands/exec/job-summary.d.ts +0 -10
  386. package/dist/commands/exec/worker-chart.d.ts +0 -87
  387. package/dist/commands/exec/worker-chart.js +0 -343
  388. package/dist/commands/playwright/command.d.ts +0 -661
  389. package/dist/commands/playwright/command.js +0 -31
  390. package/dist/commands/playwright/metadata.js +0 -8
  391. package/dist/commands/vitest/command.d.ts +0 -662
  392. package/dist/commands/vitest/command.js +0 -31
  393. package/dist/commands/vitest/metadata.js +0 -8
  394. package/dist/sdk/extension/ci.d.ts +0 -2
  395. package/dist/sdk/extension/ci.js +0 -6
  396. package/dist/chunks/{chunk-YM6TZV4L.js → chunk-VL7WFTVQ.js} +52 -52
  397. package/dist/commands/{playwright → suites}/metadata.d.ts +1 -1
  398. package/dist/commands/{vitest → test}/metadata.d.ts +1 -1
  399. /package/dist/{commands → shared}/dashboard.d.ts +0 -0
  400. /package/dist/{commands → shared}/dashboard.js +0 -0
  401. /package/dist/{commands/exec → shared}/snapshot-text.js +0 -0
@@ -1,12 +1,18 @@
1
1
  import {
2
2
  EMPTY_RUN_STATE,
3
+ SANDBOX_FAILED_STAGES,
4
+ acrossSandboxesExitStatus,
3
5
  commandExitStatus,
4
- observeAll
5
- } from "./chunk-VH2POPW5.js";
6
+ observeAll,
7
+ sandboxEndFacts
8
+ } from "./chunk-YV7GE6EV.js";
6
9
  import {
7
10
  parseTestEvent,
8
11
  testEventLine
9
- } from "./chunk-I7AN3DIJ.js";
12
+ } from "./chunk-L36GBUBB.js";
13
+
14
+ // src/run-directory/reader.ts
15
+ import { z as z4 } from "zod";
10
16
 
11
17
  // src/run-directory/run-directory.ts
12
18
  import { join } from "node:path";
@@ -23,6 +29,15 @@ var RUN_LOGS = ["snapshot", "apply", "install", "build", "command"];
23
29
  function runLogFile(log) {
24
30
  return log === "command" ? COMMAND_LOG : `${log}.log`;
25
31
  }
32
+ var SANDBOXES_DIRECTORY = "sandboxes";
33
+ var SANDBOX_NAME_PATTERN = /^(?:0|[1-9]\d*)$/;
34
+ var SANDBOX_LOGS = ["apply", "install", "build", "command"];
35
+ function sandboxEntryPath(path, sandbox) {
36
+ return join(path, SANDBOXES_DIRECTORY, String(sandbox));
37
+ }
38
+ function sandboxTestEventLine(sandbox, event) {
39
+ return JSON.stringify({ sandbox, ...event });
40
+ }
26
41
  var ACTIVE_MARKER = "active.json";
27
42
  var RUN_ID_PATTERN = /^\d{8}T\d{6}-[0-9a-z]+$/;
28
43
  function runIdPrefix(startedAt) {
@@ -62,19 +77,52 @@ var planOptionSchema = z.object({
62
77
  /** Where the value came from: its flag (`flag`), storm.config.ts (`file`), or its default, given the test plan (`default`). */
63
78
  from: z.enum(["flag", "file", "default"])
64
79
  });
80
+ var plannedSandboxCountSchema = z.object({
81
+ /** The number of runner sandboxes. */
82
+ count: z.number().int().positive(),
83
+ /**
84
+ * Where the number came from: the `--sandboxes` flag (`flag`), the number of lists in a caller's file lists file,
85
+ * `--file-lists` (`file-lists`), or `runner.sandboxes.default` in storm.config.ts (`default`), for a run with neither
86
+ * flag.
87
+ */
88
+ from: z.enum(["flag", "file-lists", "default"]),
89
+ /** The limit, `runner.sandboxes.max` in storm.config.ts. */
90
+ max: z.number().int().positive(),
91
+ /**
92
+ * For a run whose number came from `runner.sandboxes.default` (`default`), the number the default gave for this run,
93
+ * its function's value over the run's test plan. Above `max`, the run lowered it to `max`. Absent for any other run.
94
+ */
95
+ default: z.number().int().positive().optional(),
96
+ /**
97
+ * The number of runner sandboxes asked for, when the run has fewer test files than that, so it has one runner sandbox
98
+ * for each test file: `count` is then lowered to the number of test files. For a run from the default, it is the
99
+ * default once lowered to the limit. Absent when the run has the number asked for.
100
+ */
101
+ requested: z.number().int().positive().optional(),
102
+ /**
103
+ * For a run with a caller's file lists (`file-lists`), how many of the run's test files are in no list, so the run
104
+ * leaves them out; 0 when every test file is in a list. Absent for any other run.
105
+ */
106
+ leftOut: z.number().int().nonnegative().optional()
107
+ });
65
108
  var planSchema = z.object({
66
109
  /**
67
110
  * How many tests `vitest list <args> --json` or `playwright test <args> --list` counted; absent when the run counted
68
- * only the test files, as `storm vitest` does without `--count-tests`.
111
+ * only the test files, as `storm test` does without `--count-tests`.
69
112
  */
70
113
  tests: z.number().int().nonnegative().optional(),
71
- /** How many distinct test files the run counted. */
72
- files: z.number().int().nonnegative(),
114
+ /** How many distinct test files the run counted; absent for a run that counted nothing, such as `storm exec`'s. */
115
+ files: z.number().int().nonnegative().optional(),
73
116
  /**
74
117
  * Each resource option whose default is a function of the test plan, with its value and where that came from; empty
75
118
  * when the run has none.
76
119
  */
77
- options: z.array(planOptionSchema)
120
+ options: z.array(planOptionSchema),
121
+ /**
122
+ * For a run across runner sandboxes, the number of runner sandboxes, where it came from, and its limit; absent for
123
+ * any other run.
124
+ */
125
+ sandboxes: plannedSandboxCountSchema.optional()
78
126
  });
79
127
 
80
128
  // src/run-directory/run-record.ts
@@ -88,6 +136,8 @@ var endedSchema = z2.object({
88
136
  exitCode: z2.number().int().nullable(),
89
137
  signal: z2.string().nullable(),
90
138
  ms: z2.number().nonnegative().nullable(),
139
+ // Absent in a record that storm 0.13.0 wrote.
140
+ wallMs: z2.number().nonnegative().exactOptional(),
91
141
  tests: testTotalsSchema.nullable(),
92
142
  testsIncomplete: z2.string().nullable(),
93
143
  resources: z2.record(z2.string(), z2.object({ definition: z2.string(), facts: z2.unknown() })).nullable(),
@@ -100,9 +150,9 @@ var snapshotSchema = z2.object({
100
150
  builtBehind: z2.number().nullable()
101
151
  });
102
152
  var whereSchema = z2.discriminatedUnion("kind", [
103
- z2.object({ kind: z2.literal("unsandboxed") }),
153
+ z2.object({ kind: z2.literal("launch-machine") }),
104
154
  z2.object({
105
- kind: z2.literal("runner"),
155
+ kind: z2.literal("vercel-sandbox"),
106
156
  team: z2.string(),
107
157
  project: z2.string(),
108
158
  region: z2.string(),
@@ -117,16 +167,58 @@ var whereSchema = z2.discriminatedUnion("kind", [
117
167
  })
118
168
  ]);
119
169
  var gitSchema = z2.object({ branch: z2.string().nullable(), commit: z2.string(), dirty: z2.boolean() });
170
+ var sandboxRecordSchema = z2.object({
171
+ /** The runner sandbox index, from 0. */
172
+ sandbox: z2.number().int().nonnegative(),
173
+ /** The runner sandbox's command. */
174
+ argv: z2.array(z2.string()).readonly(),
175
+ /**
176
+ * The file list: the test files the runner sandbox runs, as paths relative to the project; null for a storm exec run.
177
+ */
178
+ files: z2.array(z2.string()).readonly().nullable(),
179
+ /** The runner sandbox state: passed, failed, not-started, canceled, or pending while the run goes on. */
180
+ state: z2.enum(["pending", "passed", "failed", "not-started", "canceled"]),
181
+ /** The factual stage that failed; null when passed, canceled, pending, or recorded by an older storm. */
182
+ failedStage: z2.enum(SANDBOX_FAILED_STAGES).nullable(),
183
+ /** The command's exit code; null when no command ended with one. */
184
+ exitCode: z2.number().int().nullable(),
185
+ /**
186
+ * One line that says why the runner sandbox is failed without an exit code, not-started, or canceled; null otherwise.
187
+ */
188
+ cause: z2.string().nullable(),
189
+ /** The runner sandbox's name; null when none started. */
190
+ name: z2.string().nullable(),
191
+ /** When the runner sandbox the run kept stops, as an ISO time; null when it was not kept. */
192
+ keptUntil: z2.string().nullable(),
193
+ /**
194
+ * From the run's start to the start of the runner sandbox's command, in milliseconds; null when the command never
195
+ * started.
196
+ */
197
+ preparedMs: z2.number().nonnegative().nullable(),
198
+ /** How long the command took, in milliseconds; null when it did not end on its own. */
199
+ commandMs: z2.number().nonnegative().nullable(),
200
+ /** The runner sandbox's tests' totals, by their final results; null without one. */
201
+ tests: testTotalsSchema.nullable(),
202
+ /** The last lines of the runner sandbox's command log, for a runner sandbox that is not passed; empty otherwise. */
203
+ tail: z2.array(z2.string()).readonly()
204
+ });
205
+ var SANDBOX_TAIL_LINES = 20;
120
206
  var runRecordSchema = z2.object({
121
207
  version: z2.literal(5),
122
208
  startedAt: z2.string(),
123
209
  cwd: z2.string(),
124
210
  configFile: z2.string().nullable(),
125
211
  argv: z2.array(z2.string()).readonly(),
126
- // Only a `storm vitest` run has one.
212
+ /** The driver name for a driver run (`vitest`, `playwright`); absent for a run with no driver (`storm exec`). */
213
+ driver: z2.string().exactOptional(),
214
+ /** The suite name for a `storm test` run (`null` for the project's tests); absent for other run commands. */
215
+ suite: z2.string().nullable().exactOptional(),
216
+ // Only a run that counted tests has one.
127
217
  plan: planSchema.exactOptional(),
128
218
  where: whereSchema,
129
219
  git: gitSchema.nullable(),
220
+ // Only a run across runner sandboxes has it.
221
+ sandboxes: z2.array(sandboxRecordSchema).readonly().exactOptional(),
130
222
  ended: endedSchema.exactOptional()
131
223
  });
132
224
  function runRecordText(record) {
@@ -157,26 +249,29 @@ function testTotals(events) {
157
249
  }
158
250
  return any ? { passed, failed, skipped } : null;
159
251
  }
160
- function runEnd(outcome, ran, tests, reports) {
252
+ function runEnd(outcome, ran, tests, reports, wallMs) {
161
253
  const command = outcome.kind === "ran" ? outcome.command : void 0;
162
- const ranRecords = outcome.kind === "ran" ? outcome.resources : void 0;
163
- const ms = ran?.outcome === void 0 || ran.outcome === "stopped" || ran.endedAt === void 0 ? null : ran.endedAt - ran.startedAt;
254
+ const ranRecords = outcome.kind === "ran" || outcome.kind === "sandboxes_ran" ? outcome.resources : void 0;
164
255
  return {
165
256
  outcome: outcome.kind,
166
- exitCode: command === void 0 ? null : commandExitStatus(command),
257
+ exitCode: outcome.kind === "sandboxes_ran" ? acrossSandboxesExitStatus(outcome.sandboxes) : command === void 0 ? null : commandExitStatus(command),
167
258
  signal: command?.kind === "signaled" ? command.signal : null,
168
- ms,
259
+ ms: commandMs(ran),
260
+ wallMs,
169
261
  tests: testTotals(tests.events),
170
262
  testsIncomplete: tests.incomplete ?? null,
171
263
  resources: ranRecords === void 0 ? null : reports.ranFacts(ranRecords),
172
264
  resourceRows: ranRecords === void 0 ? [] : reports.ranRows(ranRecords)
173
265
  };
174
266
  }
267
+ function commandMs(ran) {
268
+ return ran?.outcome === void 0 || ran.outcome === "stopped" || ran.endedAt === void 0 ? null : ran.endedAt - ran.startedAt;
269
+ }
175
270
  function startedWhere(run) {
176
- if (run.runner === void 0) return { kind: "unsandboxed" };
271
+ if (run.runner === void 0) return { kind: "launch-machine" };
177
272
  const { prepared, target } = run.runner;
178
273
  return {
179
- kind: "runner",
274
+ kind: "vercel-sandbox",
180
275
  team: target.team,
181
276
  project: target.project,
182
277
  region: prepared.recipe.region,
@@ -191,7 +286,7 @@ function startedWhere(run) {
191
286
  };
192
287
  }
193
288
  function endedWhere(where, runner) {
194
- if (where.kind === "unsandboxed") return where;
289
+ if (where.kind === "launch-machine") return where;
195
290
  const snapshot = runner?.snapshot;
196
291
  return {
197
292
  ...where,
@@ -206,11 +301,47 @@ function endedWhere(where, runner) {
206
301
  uploadBytes: runner?.uploadBytes ?? null
207
302
  };
208
303
  }
304
+ function pendingSandboxRecord(request) {
305
+ return {
306
+ sandbox: request.sandbox,
307
+ argv: [...request.argv],
308
+ files: request.files === null ? null : [...request.files],
309
+ state: "pending",
310
+ failedStage: null,
311
+ exitCode: null,
312
+ cause: null,
313
+ name: null,
314
+ keptUntil: null,
315
+ preparedMs: null,
316
+ commandMs: null,
317
+ tests: null,
318
+ tail: []
319
+ };
320
+ }
321
+ function sandboxRecord(request) {
322
+ const { command, runner } = request.state;
323
+ const { state, failedStage, exitCode, cause } = request.ended;
324
+ return {
325
+ sandbox: request.sandbox,
326
+ argv: [...request.argv],
327
+ files: request.files === null ? null : [...request.files],
328
+ state,
329
+ failedStage,
330
+ exitCode,
331
+ cause,
332
+ name: runner?.sandbox?.name ?? null,
333
+ keptUntil: runner?.kept?.stopsAt ?? null,
334
+ preparedMs: command === void 0 ? null : Math.max(0, command.startedAt - request.startedAt.getTime()),
335
+ commandMs: commandMs(command),
336
+ tests: request.tests === null ? null : { ...request.tests },
337
+ tail: state === "passed" ? [] : request.tail.slice(-SANDBOX_TAIL_LINES)
338
+ };
339
+ }
209
340
 
210
341
  // src/run-directory/timeline-facts.ts
211
342
  import { z as z3 } from "zod";
212
343
  var rowRefShape = {
213
- /** The row's name: `mint`, a resource lane's name, `runner`, `tests` or `cleanup`. */
344
+ /** The row's name: `mint`, a resource lane's name, `runner`, `command`, or `cleanup`. */
214
345
  name: z3.string(),
215
346
  /** For a resource instance's lane, the resource key; null for every other row. */
216
347
  resource: z3.string().nullable()
@@ -222,7 +353,7 @@ var timelineSchema = z3.object({
222
353
  /** From the run's start to its last event. */
223
354
  totalMs: z3.number(),
224
355
  /**
225
- * The lanes in order: mint, each resource instance's lane, runner, tests, cleanup; each only when the run got that
356
+ * The rows in order: mint, each resource instance's lane, runner, command, cleanup; each only when the run got that
226
357
  * far.
227
358
  */
228
359
  rows: z3.array(
@@ -291,16 +422,32 @@ function listedRun({ id, path, active, run }) {
291
422
  return { id, path, active, record: parseRunRecord(run) };
292
423
  }
293
424
  function pastRun(directory) {
294
- const parsed = (directory.tests ?? []).map(parseTestEvent);
425
+ const parsed = (directory.tests ?? []).map(pastTestEvent);
295
426
  return {
296
427
  ...listedRun(directory),
297
428
  finished: directory.tests !== void 0,
298
429
  events: parsed.filter((event) => event !== void 0),
299
430
  unreadableTestLines: parsed.filter((event) => event === void 0).length,
300
431
  timeline: parseTimeline(directory.timeline),
301
- logs: directory.logs.map((log) => ({ log, path: `${directory.path}/${runLogFile(log)}` }))
432
+ logs: directory.logs.map((log) => ({ log, path: `${directory.path}/${runLogFile(log)}` })),
433
+ sandboxes: directory.sandboxes.map(pastSandbox)
434
+ };
435
+ }
436
+ function pastSandbox(entry) {
437
+ return {
438
+ sandbox: entry.sandbox,
439
+ path: entry.path,
440
+ timeline: parseTimeline(entry.timeline),
441
+ logs: entry.logs.map((log) => ({ log, path: `${entry.path}/${runLogFile(log)}` }))
302
442
  };
303
443
  }
444
+ var sandboxTagSchema = z4.object({ sandbox: z4.number().int().nonnegative() });
445
+ function pastTestEvent(line) {
446
+ const event = parseTestEvent(line);
447
+ if (event === void 0) return void 0;
448
+ const sandbox = sandboxTagSchema.safeParse(JSON.parse(line));
449
+ return sandbox.success ? { ...event, sandbox: sandbox.data.sandbox } : event;
450
+ }
304
451
  function parseTimeline(text) {
305
452
  if (text === void 0) return void 0;
306
453
  let json;
@@ -315,11 +462,11 @@ function parseTimeline(text) {
315
462
 
316
463
  // src/run-directory/live/run-directory-gateway.ts
317
464
  import { randomBytes } from "node:crypto";
318
- import { createReadStream, createWriteStream } from "node:fs";
465
+ import { createReadStream, createWriteStream, mkdirSync } from "node:fs";
319
466
  import { mkdir, readdir, readFile, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
320
467
  import { hostname as osHostname } from "node:os";
321
468
  import { join as join2 } from "node:path";
322
- import { z as z4 } from "zod";
469
+ import { z as z5 } from "zod";
323
470
  var DIRECTORY_MODE = 448;
324
471
  var FILE_MODE = 384;
325
472
  var ACTIVE_MARKER_TRUST_MS = 24 * 60 * 60 * 1e3;
@@ -345,10 +492,10 @@ function unavailableRunDirectoryGateway(location, reason) {
345
492
  readLog: async () => ({ kind: "failed", failure: failure() })
346
493
  };
347
494
  }
348
- var markerSchema = z4.object({
349
- pid: z4.number().int().positive(),
350
- hostname: z4.string().min(1),
351
- startedAt: z4.iso.datetime()
495
+ var markerSchema = z5.object({
496
+ pid: z5.number().int().positive(),
497
+ hostname: z5.string().min(1),
498
+ startedAt: z5.iso.datetime()
352
499
  });
353
500
  async function open(root, holders, request) {
354
501
  const id = `${runIdPrefix(request.startedAt)}-${randomBytes(2).toString("hex")}`;
@@ -456,6 +603,8 @@ async function read(root, holders, request) {
456
603
  const text = (file) => file?.kind === "found" ? file.text : void 0;
457
604
  const testsText = text(tests);
458
605
  const held = await Promise.all(RUN_LOGS.map(async (log) => await exists(join2(path, runLogFile(log))) ? log : []));
606
+ const sandboxes = await readSandboxEntries(path);
607
+ if (!sandboxes.ok) return { kind: "failed", failure: sandboxes.failure };
459
608
  return {
460
609
  kind: "found",
461
610
  directory: {
@@ -465,10 +614,37 @@ async function read(root, holders, request) {
465
614
  run: text(run),
466
615
  tests: testsText === void 0 ? void 0 : testsText.split("\n").filter((line) => line !== ""),
467
616
  timeline: text(timeline),
468
- logs: held.flat()
617
+ logs: held.flat(),
618
+ sandboxes: sandboxes.entries
469
619
  }
470
620
  };
471
621
  }
622
+ async function readSandboxEntries(path) {
623
+ const directory = join2(path, SANDBOXES_DIRECTORY);
624
+ let sandboxes;
625
+ try {
626
+ sandboxes = (await readdir(directory, { withFileTypes: true })).filter((entry) => entry.isDirectory() && SANDBOX_NAME_PATTERN.test(entry.name)).map((entry) => Number(entry.name)).toSorted((a, b) => a - b);
627
+ } catch (error) {
628
+ if (errorCode(error) === "ENOENT") return { ok: true, entries: [] };
629
+ return { ok: false, failure: { path: directory, message: messageOf(error) } };
630
+ }
631
+ const entries = [];
632
+ for (const sandbox of sandboxes) {
633
+ const entry = sandboxEntryPath(path, sandbox);
634
+ const timeline = await readOptional(join2(entry, TIMELINE_FILE));
635
+ if (timeline.kind === "failed") return { ok: false, failure: timeline.failure };
636
+ const held = await Promise.all(
637
+ SANDBOX_LOGS.map(async (log) => await exists(join2(entry, runLogFile(log))) ? log : [])
638
+ );
639
+ entries.push({
640
+ sandbox,
641
+ path: entry,
642
+ timeline: timeline.kind === "found" ? timeline.text : void 0,
643
+ logs: held.flat()
644
+ });
645
+ }
646
+ return { ok: true, entries };
647
+ }
472
648
  async function exists(file) {
473
649
  try {
474
650
  await stat(file);
@@ -479,7 +655,12 @@ async function exists(file) {
479
655
  }
480
656
  async function readLog(root, request) {
481
657
  if (!RUN_ID_PATTERN.test(request.id)) return { kind: "not-found" };
482
- const file = join2(root, request.id, runLogFile(request.log));
658
+ if (request.sandbox !== void 0) {
659
+ if (!Number.isInteger(request.sandbox) || request.sandbox < 0 || request.log === "snapshot")
660
+ return { kind: "not-found" };
661
+ }
662
+ const directory = request.sandbox === void 0 ? join2(root, request.id) : sandboxEntryPath(join2(root, request.id), request.sandbox);
663
+ const file = join2(directory, runLogFile(request.log));
483
664
  try {
484
665
  return { kind: "found", path: file, text: completeUtf8(await readFile(file)).toString("utf8") };
485
666
  } catch (error) {
@@ -561,10 +742,10 @@ function runDirectory(path, id) {
561
742
  }
562
743
  });
563
744
  };
564
- const replace = (name, text) => {
565
- const file = join2(path, name);
745
+ const replace = (name, text, directory = path) => {
746
+ const file = join2(directory, name);
566
747
  inTurn(file, async () => {
567
- const temporary = join2(path, `.${name}.${randomBytes(4).toString("hex")}.tmp`);
748
+ const temporary = join2(directory, `.${name}.${randomBytes(4).toString("hex")}.tmp`);
568
749
  try {
569
750
  await writeFile(temporary, text, { mode: FILE_MODE, flag: "wx" });
570
751
  await rename(temporary, file);
@@ -574,26 +755,47 @@ function runDirectory(path, id) {
574
755
  }
575
756
  });
576
757
  };
577
- const stream = (name) => {
758
+ const stream = (file) => {
578
759
  if (failure !== void 0 || closed) return void 0;
579
- let opened = streams.get(name);
760
+ let opened = streams.get(file);
580
761
  if (opened === void 0) {
581
- const file = join2(path, name);
582
762
  opened = createWriteStream(file, { flags: "a", mode: FILE_MODE });
583
763
  opened.on("error", (error) => {
584
764
  failure ??= { path: file, message: messageOf(error) };
585
765
  });
586
- streams.set(name, opened);
766
+ streams.set(file, opened);
587
767
  }
588
768
  return opened;
589
769
  };
590
- const append = (name, text) => void stream(name)?.write(text);
591
- const endStream = async (name) => {
592
- const opened = streams.get(name);
770
+ const append = (name, text, directory = path) => void stream(join2(directory, name))?.write(text);
771
+ const endStream = async (file) => {
772
+ const opened = streams.get(file);
593
773
  if (opened === void 0) return;
594
- streams.delete(name);
774
+ streams.delete(file);
595
775
  await ended(opened);
596
776
  };
777
+ const sandboxes = /* @__PURE__ */ new Map();
778
+ const sandboxEntry = (sandbox) => {
779
+ const entry = sandboxEntryPath(path, sandbox);
780
+ if (failure === void 0 && !closed) {
781
+ try {
782
+ mkdirSync(entry, { recursive: true, mode: DIRECTORY_MODE });
783
+ } catch (error) {
784
+ failure = { path: entry, message: messageOf(error) };
785
+ }
786
+ }
787
+ return {
788
+ path: entry,
789
+ sandbox,
790
+ appendEvent: (line) => append(EVENTS_FILE, `${line}
791
+ `, entry),
792
+ appendStepOutput: (step, line) => append(runLogFile(step), `${line}
793
+ `, entry),
794
+ appendCommandOutput: (text) => append(COMMAND_LOG, text, entry),
795
+ writeTimeline: (text) => replace(TIMELINE_FILE, `${text}
796
+ `, entry)
797
+ };
798
+ };
597
799
  return {
598
800
  path,
599
801
  id,
@@ -613,7 +815,7 @@ function runDirectory(path, id) {
613
815
  testsPublished = true;
614
816
  const partial = join2(path, TESTS_PARTIAL_FILE);
615
817
  inTurn(join2(path, TESTS_FILE), async () => {
616
- await endStream(TESTS_PARTIAL_FILE);
818
+ await endStream(partial);
617
819
  if (failure !== void 0) return;
618
820
  await writeFile(partial, "", { mode: FILE_MODE, flag: "a" });
619
821
  await rename(partial, join2(path, TESTS_FILE));
@@ -622,6 +824,16 @@ function runDirectory(path, id) {
622
824
  writeTimeline: (text) => replace(TIMELINE_FILE, `${text}
623
825
  `),
624
826
  readTestEvents: (onLine) => readStagedTestEvents(join2(path, TEST_EVENTS_STAGING_FILE), onLine),
827
+ sandbox: (sandbox) => {
828
+ if (!Number.isInteger(sandbox) || sandbox < 0)
829
+ throw new RangeError(`a runner sandbox index is a whole number from 0: ${sandbox}`);
830
+ let entry = sandboxes.get(sandbox);
831
+ if (entry === void 0) {
832
+ entry = sandboxEntry(sandbox);
833
+ sandboxes.set(sandbox, entry);
834
+ }
835
+ return entry;
836
+ },
625
837
  close: async () => {
626
838
  closed = true;
627
839
  await changing;
@@ -728,25 +940,38 @@ function summaryEvent(event) {
728
940
  }
729
941
 
730
942
  // src/run-directory/recording.ts
731
- async function recordRun(gateway, start) {
732
- const { definitionSet } = start;
943
+ async function openRecording(gateway, start, extra) {
944
+ const startedAt = start.clock.now();
733
945
  const record = start.redact({
734
946
  version: 5,
735
- startedAt: start.startedAt.toISOString(),
947
+ startedAt: startedAt.toISOString(),
736
948
  cwd: start.cwd,
737
949
  configFile: start.configFile,
738
950
  argv: start.argv,
951
+ ...start.test === void 0 ? {} : { driver: start.test.driver, suite: start.test.suite },
739
952
  ...start.plan === void 0 ? {} : { plan: start.plan },
740
- where: startedWhere(start.run),
741
- git: start.git
953
+ where: extra.where,
954
+ git: start.git,
955
+ ...extra.sandboxes === void 0 ? {} : { sandboxes: extra.sandboxes }
742
956
  });
743
957
  const result = await gateway.open({
744
- startedAt: start.startedAt,
958
+ startedAt,
745
959
  keep: RUN_DIRECTORIES_KEPT,
746
960
  run: runRecordText(record)
747
961
  });
748
962
  const directory = result.ok ? result.directory : void 0;
749
963
  const opened = result.ok ? { ok: true, id: result.directory.id, path: result.directory.path, pruneFailures: result.pruneFailures } : { ok: false, failure: result.failure };
964
+ const wallMs = () => Math.max(0, start.clock.now().getTime() - startedAt.getTime());
965
+ const abandon = async () => {
966
+ await directory?.close();
967
+ };
968
+ return { startedAt, record, directory, opened, wallMs, abandon };
969
+ }
970
+ async function recordRun(gateway, start) {
971
+ const { definitionSet } = start;
972
+ const { record, directory, opened, wallMs, abandon } = await openRecording(gateway, start, {
973
+ where: startedWhere(start.run)
974
+ });
750
975
  const collector = runCollector(definitionSet, directory);
751
976
  return {
752
977
  opened,
@@ -765,6 +990,7 @@ async function recordRun(gateway, start) {
765
990
  },
766
991
  stepLog: (step) => directory === void 0 ? void 0 : stepLog(directory.path, step),
767
992
  end: async (outcome) => {
993
+ const elapsed = wallMs();
768
994
  if (directory !== void 0) await collector.readStaged(directory, start.redact);
769
995
  const { state, tests, workerOffsetMs } = collector.finish();
770
996
  const timeline = timelineFacts(definitionSet.timeline(state), definitionSet.presentations.laneKinds);
@@ -774,16 +1000,182 @@ async function recordRun(gateway, start) {
774
1000
  runRecordText({
775
1001
  ...record,
776
1002
  where: endedWhere(record.where, state.runner),
777
- ended: runEnd(outcome, state.command, tests, definitionSet.reports)
1003
+ ended: runEnd(outcome, state.command, tests, definitionSet.reports, elapsed)
778
1004
  })
779
1005
  );
780
1006
  const writeFailure = await directory?.close();
781
- return { state, timeline, tests, workerOffsetMs, writeFailure };
1007
+ return { state, timeline, tests, workerOffsetMs, writeFailure, wallMs: elapsed };
782
1008
  },
783
- abandon: async () => {
784
- await directory?.close();
1009
+ abandon
1010
+ };
1011
+ }
1012
+ async function recordAcrossSandboxes(gateway, start) {
1013
+ const { definitionSet, redact } = start;
1014
+ const { startedAt, record, directory, opened, wallMs, abandon } = await openRecording(gateway, start, {
1015
+ where: startedWhere({ runner: start.runner }),
1016
+ sandboxes: start.sandboxes.map(
1017
+ (sandbox, index) => pendingSandboxRecord({ sandbox: index, argv: sandbox.argv, files: sandbox.files })
1018
+ )
1019
+ });
1020
+ const run = runCollector(definitionSet, void 0);
1021
+ const tracks = start.sandboxes.map((sandboxStart, index) => ({
1022
+ sandbox: index,
1023
+ start: sandboxStart,
1024
+ collector: runCollector(definitionSet, void 0),
1025
+ tail: "",
1026
+ record: void 0
1027
+ }));
1028
+ const trackOf = (sandbox) => {
1029
+ const track = tracks[sandbox];
1030
+ if (track === void 0) throw new Error(`recordAcrossSandboxes: the run has no runner sandbox ${sandbox}`);
1031
+ return track;
1032
+ };
1033
+ const pendingRecord = (sandbox, sandboxStart) => redact(pendingSandboxRecord({ sandbox, argv: sandboxStart.argv, files: sandboxStart.files }));
1034
+ const sandboxRecords = () => tracks.map(
1035
+ ({ sandbox, start: sandboxStart, record: sandboxEnd }) => sandboxEnd ?? pendingRecord(sandbox, sandboxStart)
1036
+ );
1037
+ const finalRecord = (track, ended2) => {
1038
+ const { state, tests } = track.collector.finish();
1039
+ return redact(
1040
+ sandboxRecord({
1041
+ sandbox: track.sandbox,
1042
+ argv: track.start.argv,
1043
+ files: track.start.files,
1044
+ ended: ended2,
1045
+ state,
1046
+ startedAt,
1047
+ tests: testTotals(tests.events),
1048
+ tail: tailLines(track.tail)
1049
+ })
1050
+ );
1051
+ };
1052
+ let runCleanupStarted = false;
1053
+ const fold = {
1054
+ observe: async (timed) => {
1055
+ const { event } = timed;
1056
+ if (event.kind === "sandbox") {
1057
+ await trackOf(event.sandbox).collector.observer.observe({ event: event.event, at: timed.at });
1058
+ return;
1059
+ }
1060
+ await run.observer.observe(timed);
1061
+ if (event.kind === "cleanup-started") runCleanupStarted = true;
1062
+ if (runCleanupStarted || !reachesSandboxes(event)) return;
1063
+ for (const track of tracks) await track.collector.observer.observe({ event, at: timed.at });
1064
+ }
1065
+ };
1066
+ const recordEnd = (event) => {
1067
+ if (event.kind !== "sandbox-ended") return false;
1068
+ const track = trackOf(event.sandbox);
1069
+ track.record = finalRecord(track, {
1070
+ state: event.state,
1071
+ failedStage: event.failedStage,
1072
+ exitCode: event.exitCode,
1073
+ cause: event.cause
1074
+ });
1075
+ return true;
1076
+ };
1077
+ const write = (runDirectory2) => {
1078
+ const own = runDirectoryObserver(runDirectory2);
1079
+ return {
1080
+ observe: async (timed) => {
1081
+ const { event } = timed;
1082
+ if (event.kind === "sandbox") {
1083
+ writeSandboxEvent(runDirectory2, event.sandbox, event.event, timed.at);
1084
+ return;
1085
+ }
1086
+ await own.observe(timed);
1087
+ if (recordEnd(event)) runDirectory2.writeRun(runRecordText({ ...record, sandboxes: sandboxRecords() }));
1088
+ }
1089
+ };
1090
+ };
1091
+ const keepEnds = {
1092
+ observe: async ({ event }) => {
1093
+ recordEnd(event);
785
1094
  }
786
1095
  };
1096
+ return {
1097
+ opened,
1098
+ observer: (beside) => directory === void 0 ? observeAll(fold, beside, keepEnds) : observeAll(fold, beside, write(directory)),
1099
+ terminal: (sandbox, terminal) => {
1100
+ const track = trackOf(sandbox);
1101
+ const append = (text) => {
1102
+ track.tail = keptTail(track.tail + text);
1103
+ directory?.sandbox(sandbox).appendCommandOutput(text);
1104
+ };
1105
+ return { color: terminal.color, writeStdout: append, writeStderr: append };
1106
+ },
1107
+ end: async (outcome) => {
1108
+ const elapsed = wallMs();
1109
+ for (const track of tracks)
1110
+ if (track.record === void 0 && outcome.kind !== "sandboxes_ran")
1111
+ track.record = finalRecord(
1112
+ track,
1113
+ sandboxEndFacts(outcome, track.collector.finish().state.command !== void 0)
1114
+ );
1115
+ const { state } = run.finish();
1116
+ const sandboxes = tracks.map((track) => {
1117
+ const collected = track.collector.finish();
1118
+ return {
1119
+ record: track.record ?? pendingRecord(track.sandbox, track.start),
1120
+ state: collected.state,
1121
+ timeline: timelineFacts(definitionSet.timeline(collected.state), definitionSet.presentations.laneKinds),
1122
+ tests: collected.tests,
1123
+ workerOffsetMs: collected.workerOffsetMs
1124
+ };
1125
+ });
1126
+ directory?.publishTestEvents();
1127
+ for (const sandbox of sandboxes)
1128
+ directory?.sandbox(sandbox.record.sandbox).writeTimeline(JSON.stringify(sandbox.timeline, null, 2));
1129
+ const tests = {
1130
+ events: sandboxes.flatMap((sandbox) => sandbox.tests.events),
1131
+ unreadable: sandboxes.reduce((sum, sandbox) => sum + sandbox.tests.unreadable, 0),
1132
+ incomplete: sandboxes.find((sandbox) => sandbox.tests.incomplete !== void 0)?.tests.incomplete
1133
+ };
1134
+ const commandTimes = sandboxes.flatMap(({ record: { commandMs: commandMs2 } }) => commandMs2 === null ? [] : [commandMs2]);
1135
+ const ended2 = {
1136
+ ...runEnd(outcome, void 0, tests, definitionSet.reports, elapsed),
1137
+ ms: commandTimes.length === 0 ? null : Math.max(...commandTimes)
1138
+ };
1139
+ const where = endedWhere(record.where, state.runner);
1140
+ const uploadBytes = sandboxes.find(({ state: sandboxState }) => sandboxState.runner?.uploadBytes !== void 0)?.state.runner?.uploadBytes ?? null;
1141
+ directory?.writeRun(
1142
+ runRecordText(
1143
+ redact({
1144
+ ...record,
1145
+ where: where.kind === "vercel-sandbox" ? { ...where, uploadBytes } : where,
1146
+ sandboxes: sandboxes.map((sandbox) => sandbox.record),
1147
+ ended: ended2
1148
+ })
1149
+ )
1150
+ );
1151
+ const writeFailure = await directory?.close();
1152
+ return { state, sandboxes, tests, uploadBytes, writeFailure, wallMs: elapsed };
1153
+ },
1154
+ abandon
1155
+ };
1156
+ }
1157
+ function reachesSandboxes(event) {
1158
+ return event.kind !== "sandboxes-started" && event.kind !== "sandbox-ended" && event.kind !== "cleanup-started" && event.kind !== "cleanup-finished";
1159
+ }
1160
+ function writeSandboxEvent(directory, sandbox, event, at) {
1161
+ if (event.kind === "runner" && event.event.kind === "step-output") {
1162
+ const { phase, line } = event.event;
1163
+ const text = `${at.toISOString()} ${line}`;
1164
+ if (phase === "snapshot") directory.appendStepOutput(phase, text);
1165
+ else directory.sandbox(sandbox).appendStepOutput(phase, text);
1166
+ return;
1167
+ }
1168
+ directory.sandbox(sandbox).appendEvent(JSON.stringify({ at: at.toISOString(), ...event }));
1169
+ if (event.kind === "test") directory.appendTestEvent(sandboxTestEventLine(sandbox, event.event));
1170
+ }
1171
+ function keptTail(text) {
1172
+ const lines = text.split("\n");
1173
+ return lines.length <= SANDBOX_TAIL_LINES + 1 ? text : lines.slice(-(SANDBOX_TAIL_LINES + 1)).join("\n");
1174
+ }
1175
+ function tailLines(text) {
1176
+ const lines = text.split("\n");
1177
+ if (lines.at(-1) === "") lines.pop();
1178
+ return lines.slice(-SANDBOX_TAIL_LINES);
787
1179
  }
788
1180
 
789
1181
  export {
@@ -791,7 +1183,9 @@ export {
791
1183
  liveRunDirectoryGateway,
792
1184
  unavailableRunDirectoryGateway,
793
1185
  planSchema,
1186
+ sandboxRecordSchema,
794
1187
  timelineSchema,
795
1188
  recordRun,
1189
+ recordAcrossSandboxes,
796
1190
  pastRuns
797
1191
  };