@cnc-tools/storm 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (461) hide show
  1. package/dist/bin/storm.js +12 -9
  2. package/dist/build-info.js +1 -1
  3. package/dist/chunks/{chunk-YF3ICDBY.js → chunk-43MWZLJR.js} +1 -1
  4. package/dist/chunks/chunk-4XT5RC5T.js +98 -0
  5. package/dist/chunks/chunk-7D6LC5JY.js +340 -0
  6. package/dist/chunks/{chunk-WF4KJ7YG.js → chunk-BW2ADH7U.js} +1 -1
  7. package/dist/chunks/chunk-FK4RLDEK.js +40 -0
  8. package/dist/chunks/chunk-FSP3SJ35.js +1429 -0
  9. package/dist/chunks/{chunk-J6ZNYUDV.js → chunk-GQIL3AHY.js} +2 -3
  10. package/dist/chunks/chunk-GSC6SRTW.js +27 -0
  11. package/dist/chunks/chunk-ISGQJIQM.js +852 -0
  12. package/dist/chunks/chunk-IYM44FUX.js +1461 -0
  13. package/dist/chunks/{chunk-XHJGHJBW.js → chunk-LQKNI3EG.js} +38 -279
  14. package/dist/chunks/chunk-NMVODY3P.js +19 -0
  15. package/dist/chunks/{chunk-VJQLMGOH.js → chunk-ODQHQJLE.js} +2761 -3699
  16. package/dist/chunks/chunk-RYRJNHL7.js +55 -0
  17. package/dist/chunks/chunk-SXW6XN4R.js +161 -0
  18. package/dist/chunks/{chunk-OVXD7GES.js → chunk-T6AZIDZD.js} +43 -396
  19. package/dist/chunks/chunk-TEEZL3GA.js +851 -0
  20. package/dist/chunks/chunk-TMQQYHUX.js +80 -0
  21. package/dist/chunks/{chunk-AKKNF3WZ.js → chunk-U7M3ZB3Z.js} +565 -595
  22. package/dist/chunks/{chunk-JQ2HK4RN.js → chunk-Y3BUNNRG.js} +234 -57
  23. package/dist/chunks/{chunk-ZJ2USLAT.js → chunk-YM6TZV4L.js} +394 -416
  24. package/dist/chunks/chunk-YT5OROR7.js +271 -0
  25. package/dist/chunks/{live-app-RIJM3QFD.js → live-app-AZ5N5HBD.js} +36 -12
  26. package/dist/command-tree.d.ts +4 -1
  27. package/dist/command-tree.js +4 -1
  28. package/dist/commands/exec/cleanup.d.ts +3 -3
  29. package/dist/commands/exec/cleanup.js +6 -2
  30. package/dist/commands/exec/command.d.ts +56 -17
  31. package/dist/commands/exec/command.js +51 -39
  32. package/dist/commands/exec/define-run-command.d.ts +752 -0
  33. package/dist/commands/exec/define-run-command.js +58 -0
  34. package/dist/commands/exec/driver-plan.d.ts +30 -0
  35. package/dist/commands/exec/driver-plan.js +44 -0
  36. package/dist/commands/exec/driver-refusals.d.ts +89 -0
  37. package/dist/commands/exec/driver-refusals.js +65 -0
  38. package/dist/commands/exec/exec-words.d.ts +5 -0
  39. package/dist/commands/exec/exec-words.js +31 -0
  40. package/dist/commands/exec/job-summary.d.ts +1 -1
  41. package/dist/commands/exec/job-summary.js +1 -1
  42. package/dist/commands/exec/live-view.js +58 -28
  43. package/dist/commands/exec/mint-failed.js +5 -5
  44. package/dist/commands/exec/outcomes.d.ts +72 -10
  45. package/dist/commands/exec/outcomes.js +38 -10
  46. package/dist/commands/exec/plan-run.d.ts +3 -5
  47. package/dist/commands/exec/plan-run.js +3 -3
  48. package/dist/commands/exec/progress.d.ts +35 -15
  49. package/dist/commands/exec/progress.js +82 -57
  50. package/dist/commands/exec/resource-flags.d.ts +10 -3
  51. package/dist/commands/exec/resource-flags.js +25 -14
  52. package/dist/commands/exec/resource-refusals.d.ts +2 -2
  53. package/dist/commands/exec/resource-refusals.js +10 -10
  54. package/dist/commands/exec/run-bin.d.ts +35 -0
  55. package/dist/commands/exec/run-bin.js +32 -0
  56. package/dist/commands/exec/run-command.d.ts +85 -20
  57. package/dist/commands/exec/run-command.js +142 -238
  58. package/dist/commands/exec/run-metadata.d.ts +29 -17
  59. package/dist/commands/exec/run-metadata.js +38 -16
  60. package/dist/commands/exec/snapshot-text.d.ts +40 -0
  61. package/dist/commands/exec/snapshot-text.js +112 -0
  62. package/dist/commands/exec/test-plan.d.ts +3 -37
  63. package/dist/commands/exec/test-plan.js +11 -28
  64. package/dist/commands/exec/tests-summary.d.ts +21 -12
  65. package/dist/commands/exec/tests-summary.js +67 -39
  66. package/dist/commands/exec/text.d.ts +5 -0
  67. package/dist/commands/exec/text.js +7 -0
  68. package/dist/commands/exec/view.js +22 -13
  69. package/dist/commands/exec/waterfall.d.ts +3 -1
  70. package/dist/commands/exec/waterfall.js +20 -3
  71. package/dist/commands/exec/worker-chart.d.ts +19 -11
  72. package/dist/commands/exec/worker-chart.js +66 -36
  73. package/dist/commands/playwright/command.d.ts +746 -0
  74. package/dist/commands/playwright/command.js +31 -0
  75. package/dist/commands/playwright/metadata.d.ts +4 -0
  76. package/dist/commands/playwright/metadata.js +8 -0
  77. package/dist/commands/runs/facts.d.ts +22 -8
  78. package/dist/commands/runs/facts.js +19 -9
  79. package/dist/commands/runs/list/command.d.ts +34 -8
  80. package/dist/commands/runs/list/command.js +18 -13
  81. package/dist/commands/runs/list/outcomes.d.ts +17 -4
  82. package/dist/commands/runs/logs/command.js +20 -14
  83. package/dist/commands/runs/logs/outcomes.js +1 -1
  84. package/dist/commands/runs/past-run.d.ts +3 -27
  85. package/dist/commands/runs/past-run.js +3 -37
  86. package/dist/commands/runs/show/command.d.ts +36 -8
  87. package/dist/commands/runs/show/command.js +53 -33
  88. package/dist/commands/runs/show/metadata.js +1 -1
  89. package/dist/commands/runs/show/outcomes.d.ts +18 -4
  90. package/dist/commands/runs/show/outcomes.js +37 -16
  91. package/dist/commands/snapshots/build/command.d.ts +898 -0
  92. package/dist/commands/snapshots/build/command.js +511 -0
  93. package/dist/commands/snapshots/build/metadata.d.ts +28 -0
  94. package/dist/commands/snapshots/build/metadata.js +34 -0
  95. package/dist/commands/snapshots/build/outcomes.d.ts +484 -0
  96. package/dist/commands/snapshots/build/outcomes.js +322 -0
  97. package/dist/commands/snapshots/list/command.d.ts +272 -0
  98. package/dist/commands/snapshots/list/command.js +305 -0
  99. package/dist/commands/snapshots/list/metadata.d.ts +16 -0
  100. package/dist/commands/snapshots/list/metadata.js +24 -0
  101. package/dist/commands/snapshots/list/outcomes.d.ts +183 -0
  102. package/dist/commands/snapshots/list/outcomes.js +257 -0
  103. package/dist/commands/snapshots/metadata.d.ts +3 -0
  104. package/dist/commands/snapshots/metadata.js +7 -0
  105. package/dist/commands/vitest/command.d.ts +267 -298
  106. package/dist/commands/vitest/command.js +23 -174
  107. package/dist/commands/vitest/metadata.js +1 -1
  108. package/dist/config/credential-resolver.d.ts +6 -3
  109. package/dist/config/credential-resolver.js +6 -5
  110. package/dist/config-file/define.d.ts +1 -1
  111. package/dist/context.d.ts +44 -24
  112. package/dist/context.js +20 -13
  113. package/dist/core/before-run.d.ts +7 -6
  114. package/dist/core/before-run.js +9 -9
  115. package/dist/core/definition-lookup.d.ts +22 -0
  116. package/dist/core/definition-lookup.js +35 -0
  117. package/dist/core/drivers-of.d.ts +23 -0
  118. package/dist/core/drivers-of.js +13 -0
  119. package/dist/core/events.d.ts +6 -22
  120. package/dist/core/gateways.d.ts +38 -170
  121. package/dist/core/index.d.ts +13 -12
  122. package/dist/core/index.js +12 -11
  123. package/dist/core/launcher-context.d.ts +11 -0
  124. package/dist/core/launcher-context.js +31 -0
  125. package/dist/core/live/package-bin-gateway.d.ts +6 -0
  126. package/dist/core/live/package-bin-gateway.js +24 -0
  127. package/dist/core/package-bin.d.ts +7 -0
  128. package/dist/core/package-bin.js +30 -0
  129. package/dist/core/presentations.d.ts +5 -4
  130. package/dist/core/presentations.js +9 -9
  131. package/dist/core/resource-definition-set.d.ts +39 -0
  132. package/dist/core/resource-definition-set.js +31 -0
  133. package/dist/core/resource-reports.d.ts +38 -5
  134. package/dist/core/resource-reports.js +47 -17
  135. package/dist/core/resource.d.ts +4 -4
  136. package/dist/core/resources.d.ts +8 -7
  137. package/dist/core/resources.js +11 -13
  138. package/dist/core/run-state.d.ts +27 -16
  139. package/dist/core/run-state.js +50 -18
  140. package/dist/core/run.d.ts +42 -54
  141. package/dist/core/run.js +72 -122
  142. package/dist/core/setup-phases.d.ts +14 -0
  143. package/dist/core/setup-phases.js +24 -0
  144. package/dist/core/state-directory.d.ts +2 -2
  145. package/dist/core/state-directory.js +3 -3
  146. package/dist/core/timeline.d.ts +4 -2
  147. package/dist/core/timeline.js +11 -4
  148. package/dist/credential/events.d.ts +20 -0
  149. package/dist/credential/events.js +4 -0
  150. package/dist/credential/index.d.ts +2 -1
  151. package/dist/credential/index.js +6 -5
  152. package/dist/credential/source.d.ts +38 -26
  153. package/dist/credential/source.js +25 -34
  154. package/dist/extension-commands.d.ts +12 -6
  155. package/dist/extension-commands.js +16 -13
  156. package/dist/extensions/github/{world.d.ts → context.d.ts} +1 -1
  157. package/dist/extensions/github/context.js +3 -0
  158. package/dist/extensions/github/definition.d.ts +1 -1
  159. package/dist/extensions/github/definition.js +3 -3
  160. package/dist/extensions/github/extension.d.ts +1 -1
  161. package/dist/extensions/github/index.d.ts +2 -2
  162. package/dist/extensions/github/index.js +4 -4
  163. package/dist/extensions/github/lifecycle.d.ts +3 -3
  164. package/dist/extensions/github/lifecycle.js +14 -14
  165. package/dist/extensions/github/live/context.d.ts +6 -0
  166. package/dist/extensions/github/live/context.js +16 -0
  167. package/dist/extensions/github/resource.d.ts +1 -1
  168. package/dist/extensions/playwright/driver.d.ts +8 -0
  169. package/dist/extensions/playwright/driver.js +60 -0
  170. package/dist/extensions/playwright/extension.d.ts +2 -0
  171. package/dist/extensions/playwright/extension.js +12 -0
  172. package/dist/extensions/playwright/plan/gateways.d.ts +62 -0
  173. package/dist/extensions/playwright/plan/gateways.js +4 -0
  174. package/dist/extensions/playwright/plan/list-output.d.ts +26 -0
  175. package/dist/extensions/playwright/plan/list-output.js +101 -0
  176. package/dist/extensions/playwright/plan/live/list-gateway.d.ts +15 -0
  177. package/dist/extensions/playwright/plan/live/list-gateway.js +100 -0
  178. package/dist/extensions/playwright/plan/plan.d.ts +44 -0
  179. package/dist/extensions/playwright/plan/plan.js +53 -0
  180. package/dist/extensions/testserver/command-tree.d.ts +2 -2
  181. package/dist/extensions/testserver/command-tree.js +2 -3
  182. package/dist/extensions/testserver/commands/app.d.ts +7 -7
  183. package/dist/extensions/testserver/commands/pool/create/command.d.ts +5 -5
  184. package/dist/extensions/testserver/commands/pool/create/command.js +17 -12
  185. package/dist/extensions/testserver/commands/pool/list/command.js +8 -5
  186. package/dist/extensions/testserver/{world.d.ts → context.d.ts} +1 -1
  187. package/dist/extensions/testserver/context.js +4 -0
  188. package/dist/extensions/testserver/definition.d.ts +2 -2
  189. package/dist/extensions/testserver/definition.js +8 -7
  190. package/dist/extensions/testserver/events.d.ts +1 -1
  191. package/dist/extensions/testserver/extension.d.ts +4 -3
  192. package/dist/extensions/testserver/extension.js +33 -20
  193. package/dist/extensions/testserver/index.d.ts +2 -2
  194. package/dist/extensions/testserver/index.js +2 -2
  195. package/dist/extensions/testserver/lifecycle.d.ts +6 -5
  196. package/dist/extensions/testserver/lifecycle.js +9 -8
  197. package/dist/extensions/testserver/live/context.d.ts +8 -0
  198. package/dist/extensions/testserver/live/{world.js → context.js} +6 -7
  199. package/dist/extensions/testserver/options/rules.d.ts +3 -3
  200. package/dist/extensions/testserver/options/rules.js +5 -4
  201. package/dist/extensions/testserver/options/sandboxes.d.ts +3 -2
  202. package/dist/extensions/testserver/options/sandboxes.js +3 -2
  203. package/dist/extensions/testserver/playwright/index.d.ts +33 -0
  204. package/dist/extensions/testserver/playwright/index.js +43 -0
  205. package/dist/extensions/testserver/presentation.d.ts +4 -4
  206. package/dist/extensions/testserver/presentation.js +7 -7
  207. package/dist/extensions/testserver/progress.d.ts +3 -3
  208. package/dist/extensions/testserver/progress.js +3 -3
  209. package/dist/extensions/testserver/provision.d.ts +2 -2
  210. package/dist/extensions/testserver/provision.js +10 -10
  211. package/dist/extensions/testserver/resource.d.ts +2 -2
  212. package/dist/extensions/testserver/result.d.ts +2 -2
  213. package/dist/extensions/testserver/result.js +1 -1
  214. package/dist/extensions/testserver/run/connection.d.ts +1 -1
  215. package/dist/extensions/testserver/run/connection.js +3 -3
  216. package/dist/extensions/testserver/run/sandbox.d.ts +31 -0
  217. package/dist/extensions/testserver/run/sandbox.js +58 -0
  218. package/dist/extensions/testserver/run-sandbox.d.ts +2 -2
  219. package/dist/extensions/testserver/run-sandbox.js +3 -3
  220. package/dist/extensions/testserver/vercel-cli/arguments.d.ts +2 -2
  221. package/dist/extensions/testserver/vercel-cli/arguments.js +6 -6
  222. package/dist/extensions/testserver/vercel-cli/auth-config.d.ts +7 -7
  223. package/dist/extensions/testserver/vercel-cli/auth-config.js +4 -4
  224. package/dist/extensions/testserver/vercel-cli/clock.js +1 -1
  225. package/dist/extensions/testserver/vercel-cli/config-files.js +1 -1
  226. package/dist/extensions/testserver/vercel-cli/context.d.ts +1 -1
  227. package/dist/extensions/testserver/vercel-cli/context.js +2 -2
  228. package/dist/extensions/testserver/vercel-cli/entry.d.ts +1 -1
  229. package/dist/extensions/testserver/vercel-cli/entry.js +1 -1
  230. package/dist/extensions/testserver/vercel-cli/environment.d.ts +5 -5
  231. package/dist/extensions/testserver/vercel-cli/environment.js +6 -6
  232. package/dist/extensions/testserver/vercel-cli/gateways.d.ts +1 -1
  233. package/dist/extensions/testserver/vercel-cli/gateways.js +3 -3
  234. package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -1
  235. package/dist/extensions/testserver/vercel-cli/index.js +8 -9
  236. package/dist/extensions/testserver/vercel-cli/invocation.d.ts +13 -12
  237. package/dist/extensions/testserver/vercel-cli/invocation.js +1 -1
  238. package/dist/extensions/testserver/vercel-cli/{driver.d.ts → invoker.d.ts} +18 -17
  239. package/dist/extensions/testserver/vercel-cli/{driver.js → invoker.js} +8 -8
  240. package/dist/extensions/testserver/vercel-cli/live/config-files.d.ts +2 -2
  241. package/dist/extensions/testserver/vercel-cli/live/config-files.js +2 -2
  242. package/dist/extensions/testserver/vercel-cli/live/process-gateway.js +1 -1
  243. package/dist/extensions/testserver/vercel-cli/report.js +2 -2
  244. package/dist/extensions/testserver/vercel-cli/verbose.js +1 -1
  245. package/dist/extensions/testserver/vitest/config.d.ts +8 -6
  246. package/dist/extensions/testserver/vitest/config.js +10 -16
  247. package/dist/extensions/testserver/vitest/container-scope.d.ts +11 -11
  248. package/dist/extensions/testserver/vitest/container-scope.js +9 -9
  249. package/dist/extensions/testserver/vitest/container-start.d.ts +6 -6
  250. package/dist/extensions/testserver/vitest/container-start.js +14 -11
  251. package/dist/extensions/testserver/vitest/diagnostics.d.ts +1 -1
  252. package/dist/extensions/testserver/vitest/fixtures.d.ts +12 -10
  253. package/dist/extensions/testserver/vitest/fixtures.js +44 -22
  254. package/dist/extensions/testserver/vitest/index.d.ts +1 -1
  255. package/dist/extensions/testserver/vitest/index.js +4 -4
  256. package/dist/extensions/testserver/vitest/types.d.ts +16 -18
  257. package/dist/extensions/testserver/vitest/types.js +2 -2
  258. package/dist/extensions/testserver/vitest/worker-sandbox.d.ts +8 -0
  259. package/dist/extensions/testserver/vitest/worker-sandbox.js +17 -0
  260. package/dist/extensions/vitest/driver.d.ts +8 -0
  261. package/dist/extensions/vitest/driver.js +62 -0
  262. package/dist/extensions/vitest/extension.d.ts +2 -0
  263. package/dist/extensions/vitest/extension.js +8 -0
  264. package/dist/{vitest → extensions/vitest/plan}/gateways.d.ts +1 -26
  265. package/dist/extensions/vitest/plan/gateways.js +3 -0
  266. package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.d.ts +1 -2
  267. package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.js +1 -20
  268. package/dist/extensions/vitest/plan/plan-over.d.ts +38 -0
  269. package/dist/extensions/vitest/plan/plan-over.js +31 -0
  270. package/dist/extensions/vitest/plan/plan.d.ts +24 -0
  271. package/dist/{vitest → extensions/vitest/plan}/plan.js +11 -26
  272. package/dist/extensions.d.ts +43 -30
  273. package/dist/extensions.js +50 -35
  274. package/dist/forward-sigterm.d.ts +8 -0
  275. package/dist/forward-sigterm.js +18 -0
  276. package/dist/launcher-resolvers/index.d.ts +1 -0
  277. package/dist/launcher-resolvers/index.js +2 -1
  278. package/dist/launcher-resolvers/local-services.d.ts +22 -0
  279. package/dist/launcher-resolvers/local-services.js +6 -0
  280. package/dist/live-app.js +9 -7
  281. package/dist/local-services.d.ts +11 -0
  282. package/dist/local-services.js +16 -0
  283. package/dist/playwright/index.d.ts +1 -0
  284. package/dist/playwright/index.js +4 -0
  285. package/dist/playwright/reporter.d.ts +96 -0
  286. package/dist/playwright/reporter.js +162 -0
  287. package/dist/playwright/worker-index.d.ts +7 -0
  288. package/dist/playwright/worker-index.js +20 -0
  289. package/dist/run-directory/gateways.d.ts +167 -0
  290. package/dist/run-directory/gateways.js +2 -0
  291. package/dist/run-directory/index.d.ts +8 -0
  292. package/dist/run-directory/index.js +13 -0
  293. package/dist/run-directory/plan.d.ts +35 -0
  294. package/dist/run-directory/plan.js +24 -0
  295. package/dist/run-directory/reader.d.ts +70 -0
  296. package/dist/run-directory/reader.js +51 -0
  297. package/dist/run-directory/recording.d.ts +95 -0
  298. package/dist/run-directory/recording.js +85 -0
  299. package/dist/{commands/exec → run-directory}/run-collector.d.ts +9 -8
  300. package/dist/{commands/exec → run-directory}/run-collector.js +8 -10
  301. package/dist/{core → run-directory}/run-directory.d.ts +3 -3
  302. package/dist/{core → run-directory}/run-directory.js +2 -2
  303. package/dist/{commands/exec → run-directory}/run-record.d.ts +94 -27
  304. package/dist/run-directory/run-record.js +229 -0
  305. package/dist/{commands/exec → run-directory}/timeline-facts.d.ts +5 -8
  306. package/dist/{commands/exec → run-directory}/timeline-facts.js +11 -25
  307. package/dist/runner/build-snapshots.d.ts +179 -0
  308. package/dist/runner/build-snapshots.js +235 -0
  309. package/dist/runner/context.js +2 -1
  310. package/dist/runner/events.d.ts +73 -33
  311. package/dist/runner/gateways.d.ts +30 -10
  312. package/dist/runner/index.d.ts +15 -17
  313. package/dist/runner/index.js +12 -14
  314. package/dist/runner/live/checkout-gateway.js +15 -7
  315. package/dist/runner/live/snapshot-records.js +8 -7
  316. package/dist/runner/prepare.d.ts +26 -26
  317. package/dist/runner/prepare.js +27 -14
  318. package/dist/runner/ready.d.ts +43 -10
  319. package/dist/runner/ready.js +51 -34
  320. package/dist/runner/recipe.d.ts +48 -4
  321. package/dist/runner/recipe.js +42 -1
  322. package/dist/runner/scope.d.ts +13 -13
  323. package/dist/runner/scope.js +9 -11
  324. package/dist/runner/secrets.d.ts +6 -0
  325. package/dist/runner/secrets.js +10 -0
  326. package/dist/runner/session.d.ts +128 -0
  327. package/dist/runner/session.js +138 -0
  328. package/dist/runner/snapshot-build.d.ts +21 -11
  329. package/dist/runner/snapshot-build.js +11 -16
  330. package/dist/runner/snapshot-cache.d.ts +140 -62
  331. package/dist/runner/snapshot-cache.js +145 -102
  332. package/dist/runner/snapshot-inspect.d.ts +89 -0
  333. package/dist/runner/snapshot-inspect.js +173 -0
  334. package/dist/runner/snapshot-key.d.ts +5 -2
  335. package/dist/runner/snapshot-key.js +1 -1
  336. package/dist/runner/snapshot-save.d.ts +35 -20
  337. package/dist/runner/snapshot-save.js +47 -37
  338. package/dist/runner/snapshot-start.d.ts +25 -0
  339. package/dist/runner/snapshot-start.js +16 -0
  340. package/dist/sdk/extension/ci.d.ts +2 -0
  341. package/dist/sdk/extension/ci.js +6 -0
  342. package/dist/sdk/extension/commands.d.ts +44 -28
  343. package/dist/sdk/extension/commands.js +15 -13
  344. package/dist/sdk/extension/driver.d.ts +143 -0
  345. package/dist/sdk/extension/driver.js +28 -0
  346. package/dist/sdk/extension/index.d.ts +3 -1
  347. package/dist/sdk/extension/index.js +16 -9
  348. package/dist/sdk/extension/{launcher-supplies.d.ts → launcher-context.d.ts} +3 -3
  349. package/dist/sdk/extension/launcher-context.js +5 -0
  350. package/dist/sdk/extension/lifecycle.d.ts +10 -8
  351. package/dist/sdk/extension/lifecycle.js +2 -2
  352. package/dist/sdk/extension/progress.js +2 -2
  353. package/dist/sdk/extension/resource-definition.d.ts +13 -13
  354. package/dist/sdk/extension/resource-definition.js +2 -2
  355. package/dist/sdk/extension/resource.d.ts +13 -13
  356. package/dist/sdk/extension/resource.js +11 -11
  357. package/dist/sdk/extension/time.js +2 -2
  358. package/dist/sdk/index.d.ts +2 -0
  359. package/dist/sdk/index.js +3 -1
  360. package/dist/sdk/run/launcher.d.ts +1 -1
  361. package/dist/sdk/run/launcher.js +4 -3
  362. package/dist/sdk/run/payload.js +1 -1
  363. package/dist/sdk/run/test-events.d.ts +24 -18
  364. package/dist/sdk/run/test-events.js +5 -4
  365. package/dist/sdk/run/test-result-writer.d.ts +77 -0
  366. package/dist/sdk/run/test-result-writer.js +143 -0
  367. package/dist/sdk/run/worker-test-event-writer.d.ts +13 -0
  368. package/dist/sdk/run/worker-test-event-writer.js +31 -0
  369. package/dist/vendor/testserver-sdk/container/container.d.ts +12 -12
  370. package/dist/vendor/testserver-sdk/container/container.js +39 -21
  371. package/dist/vendor/testserver-sdk/factories/build.d.ts +12 -40
  372. package/dist/vendor/testserver-sdk/factories/build.js +15 -66
  373. package/dist/vendor/testserver-sdk/factories/gateways.d.ts +1 -2
  374. package/dist/vendor/testserver-sdk/factories/index.d.ts +1 -3
  375. package/dist/vendor/testserver-sdk/factories/index.js +3 -5
  376. package/dist/vendor/testserver-sdk/index.d.ts +1 -2
  377. package/dist/vendor/testserver-sdk/index.js +5 -6
  378. package/dist/vendor/testserver-sdk/records/body.d.ts +1 -1
  379. package/dist/vendor/testserver-sdk/records/body.js +1 -1
  380. package/dist/vendor/testserver-sdk/testserver/failure.d.ts +4 -3
  381. package/dist/vendor/testserver-sdk/testserver/failure.js +4 -3
  382. package/dist/vitest/index.d.ts +2 -1
  383. package/dist/vitest/index.js +6 -4
  384. package/dist/vitest/test-events.d.ts +6 -16
  385. package/dist/vitest/test-events.js +15 -40
  386. package/dist/vitest/test-results.d.ts +9 -31
  387. package/dist/vitest/test-results.js +34 -105
  388. package/dist/vitest/worker-index.d.ts +6 -0
  389. package/dist/vitest/worker-index.js +17 -0
  390. package/package.json +23 -9
  391. package/skills/overview.md +6 -5
  392. package/skills/read-run-output.md +22 -7
  393. package/dist/chunks/chunk-AGWW3HDT.js +0 -2559
  394. package/dist/chunks/chunk-H2VCSNVU.js +0 -351
  395. package/dist/commands/exec/run-record.js +0 -135
  396. package/dist/commands/vitest/outcomes.d.ts +0 -379
  397. package/dist/commands/vitest/outcomes.js +0 -70
  398. package/dist/core/launcher-supplies.d.ts +0 -11
  399. package/dist/core/launcher-supplies.js +0 -28
  400. package/dist/core/mint.d.ts +0 -10
  401. package/dist/core/mint.js +0 -14
  402. package/dist/core/resource-registry.d.ts +0 -54
  403. package/dist/core/resource-registry.js +0 -57
  404. package/dist/extensions/github/live/world.d.ts +0 -6
  405. package/dist/extensions/github/live/world.js +0 -16
  406. package/dist/extensions/github/world.js +0 -3
  407. package/dist/extensions/testserver/live/world.d.ts +0 -8
  408. package/dist/extensions/testserver/vitest/sandbox.d.ts +0 -25
  409. package/dist/extensions/testserver/vitest/sandbox.js +0 -43
  410. package/dist/extensions/testserver/world.js +0 -4
  411. package/dist/sdk/extension/launcher-supplies.js +0 -3
  412. package/dist/story/align.d.ts +0 -37
  413. package/dist/story/align.js +0 -39
  414. package/dist/story/command-line.d.ts +0 -34
  415. package/dist/story/command-line.js +0 -100
  416. package/dist/story/definition.d.ts +0 -59
  417. package/dist/story/definition.js +0 -9
  418. package/dist/story/diff.d.ts +0 -9
  419. package/dist/story/diff.js +0 -97
  420. package/dist/story/errors.d.ts +0 -14
  421. package/dist/story/errors.js +0 -21
  422. package/dist/story/gateways.d.ts +0 -94
  423. package/dist/story/gateways.js +0 -3
  424. package/dist/story/host.d.ts +0 -30
  425. package/dist/story/host.js +0 -97
  426. package/dist/story/index.d.ts +0 -8
  427. package/dist/story/index.js +0 -10
  428. package/dist/story/json.d.ts +0 -16
  429. package/dist/story/json.js +0 -59
  430. package/dist/story/live/recording-gateway.d.ts +0 -2
  431. package/dist/story/live/recording-gateway.js +0 -103
  432. package/dist/story/mode.d.ts +0 -17
  433. package/dist/story/mode.js +0 -21
  434. package/dist/story/orphans.d.ts +0 -35
  435. package/dist/story/orphans.js +0 -51
  436. package/dist/story/recording.d.ts +0 -62
  437. package/dist/story/recording.js +0 -97
  438. package/dist/story/report.d.ts +0 -42
  439. package/dist/story/report.js +0 -130
  440. package/dist/story/sequence.d.ts +0 -30
  441. package/dist/story/sequence.js +0 -74
  442. package/dist/story/settle.d.ts +0 -96
  443. package/dist/story/settle.js +0 -71
  444. package/dist/story/start.d.ts +0 -50
  445. package/dist/story/start.js +0 -183
  446. package/dist/vendor/testserver-sdk/factories/definition.d.ts +0 -39
  447. package/dist/vendor/testserver-sdk/factories/definition.js +0 -16
  448. package/dist/vendor/testserver-sdk/factories/definitions.d.ts +0 -169
  449. package/dist/vendor/testserver-sdk/factories/definitions.js +0 -245
  450. package/dist/vendor/testserver-sdk/seed/index.d.ts +0 -1
  451. package/dist/vendor/testserver-sdk/seed/index.js +0 -3
  452. package/dist/vendor/testserver-sdk/seed/seed.d.ts +0 -221
  453. package/dist/vendor/testserver-sdk/seed/seed.js +0 -171
  454. package/dist/vitest/find-vitest.d.ts +0 -7
  455. package/dist/vitest/find-vitest.js +0 -28
  456. package/dist/vitest/gateways.js +0 -4
  457. package/dist/vitest/plan.d.ts +0 -51
  458. /package/dist/{vitest → extensions/vitest/plan}/list-output.d.ts +0 -0
  459. /package/dist/{vitest → extensions/vitest/plan}/list-output.js +0 -0
  460. /package/dist/{core → run-directory}/live/run-directory-gateway.d.ts +0 -0
  461. /package/dist/{core → run-directory}/live/run-directory-gateway.js +0 -0
@@ -0,0 +1,162 @@
1
+ // storm's Playwright reporter, exported as `@vercel/storm/playwright/reporter`: a reporter in Playwright's main
2
+ // process that appends each test's final result to the run payload's `testEvents` file as a `test-result` test event,
3
+ // through the SDK's test result writer. A Playwright config lists it by its module name, beside the reporter a person
4
+ // reads. Nothing here imports Playwright: the reporter's types are the parts of Playwright's `FullConfig`, `Suite`,
5
+ // `TestCase` and `TestResult` it reads.
6
+ import { relative, sep } from "node:path";
7
+ import { testResultWriter, } from "../sdk/index.js";
8
+ /**
9
+ * A Playwright reporter for a project's config under a storm run: it appends each test's final result, retries
10
+ * settled, to the run payload's `testEvents` file, which the run counts the tests from. It prints nothing, so list it
11
+ * beside the reporter a person reads:
12
+ *
13
+ * ```ts
14
+ * reporter: [["line"], ["@vercel/storm/playwright/reporter"]],
15
+ * ```
16
+ *
17
+ * A `--reporter` given to Playwright on the command line replaces both. Outside a storm run, or when the run payload
18
+ * names no test events file, it reports nothing, and once an append fails it drops every later result: it never fails
19
+ * a test.
20
+ */
21
+ export default class StormReporter {
22
+ #reporter;
23
+ constructor(options = {}) {
24
+ this.#reporter = playwrightResultReporter(options.env ?? process.env);
25
+ }
26
+ /** Playwright adds its own terminal reporter when none of a config's reporters prints. */
27
+ printsToStdio() {
28
+ return false;
29
+ }
30
+ onBegin(config, suite) {
31
+ this.#reporter.onBegin(config, suite);
32
+ }
33
+ // Playwright declares the test as `void | TestCase`: none outside a test.
34
+ onStdOut(chunk, test) {
35
+ this.#reporter.onOutput(chunk, test ?? undefined);
36
+ }
37
+ onStdErr(chunk, test) {
38
+ this.#reporter.onOutput(chunk, test ?? undefined);
39
+ }
40
+ onTestEnd(test, result) {
41
+ this.#reporter.onTestEnd(test, result);
42
+ }
43
+ onEnd() {
44
+ this.#reporter.onEnd();
45
+ }
46
+ }
47
+ /**
48
+ * The reporter: once for each test, by Playwright's id for it, writes its final result with the SDK's test result
49
+ * writer (`testResultWriter`).
50
+ *
51
+ * - When: once an attempt ends after which Playwright can't run the test again (`onTestEnd`): an interrupted attempt,
52
+ * or any attempt of a test with no retry left. Playwright runs a passed or skipped test again when it retries the
53
+ * serial group the test is in, and its reporter API doesn't say which tests are in one, so an attempt with a retry
54
+ * left isn't final, whatever its status. When the run ends (`onEnd`), every test not yet reported is: one Playwright
55
+ * never ran, as after `--max-failures` or an interrupt, reads as skipped, and any other with its outcome so far, a
56
+ * failure whose retry never came as failed.
57
+ * - State: Playwright's outcome over every attempt. `expected` is a pass, a test marked `test.fail()` that failed
58
+ * among them; `flaky`, a pass after a failed attempt, is a pass with `flaky`; `unexpected` is a failure; `skipped` is
59
+ * a skip. `retryCount` is the attempts after the first.
60
+ * - Name: `[<Playwright project>] <describe titles> > <title>`, without the brackets when the project has no name.
61
+ * - File: the test file's path relative to the config's `rootDir`.
62
+ * - Errors: a failed test's last attempt's, or a flaky pass's failed attempts', each without the terminal colors
63
+ * Playwright writes into them, the error class its message starts with as its name and the rest as its message. The
64
+ * writer keeps the first of them and cuts each to size.
65
+ * - Test output: each chunk Playwright hands `onStdOut` and `onStdErr` for the test, in arrival order, every attempt's.
66
+ * A chunk no test was running for belongs to none and is dropped.
67
+ */
68
+ export function playwrightResultReporter(env, append, now) {
69
+ const writer = testResultWriter(env, append, now);
70
+ let rootDir;
71
+ let all;
72
+ const report = (test) => {
73
+ if (!writer.accepts(test.id))
74
+ return;
75
+ let reported;
76
+ try {
77
+ reported = finalResult(test, rootDir);
78
+ }
79
+ catch {
80
+ // A test Playwright can't describe is dropped alone.
81
+ return;
82
+ }
83
+ writer.write(reported);
84
+ };
85
+ return {
86
+ onBegin: (config, suite) => {
87
+ rootDir = config.rootDir;
88
+ all = suite;
89
+ },
90
+ onOutput: (chunk, test) => {
91
+ if (test === undefined)
92
+ return;
93
+ writer.output(test.id, typeof chunk === "string" ? chunk : Buffer.from(chunk).toString("utf8"));
94
+ },
95
+ onTestEnd: (test, result) => {
96
+ if (!mayRunAgain(test, result))
97
+ report(test);
98
+ },
99
+ onEnd: () => {
100
+ for (const test of all?.allTests() ?? [])
101
+ report(test);
102
+ writer.end();
103
+ },
104
+ };
105
+ }
106
+ /**
107
+ * Whether Playwright may run `test` again after the attempt `result`: the attempt was not interrupted and the test has
108
+ * a retry left. A failed test is retried; a passed or skipped one runs again when Playwright retries its serial group.
109
+ */
110
+ function mayRunAgain(test, result) {
111
+ return result.status !== "interrupted" && test.results.length <= test.retries;
112
+ }
113
+ /** `test`'s final result, over every attempt at it. */
114
+ function finalResult(test, rootDir) {
115
+ const outcome = test.outcome();
116
+ const failedAttempts = test.results.filter(({ status }) => status !== "passed" && status !== "skipped");
117
+ const errors = outcome === "flaky" ? failedAttempts.flatMap((attempt) => attempt.errors) : lastErrors(test, outcome);
118
+ return {
119
+ id: test.id,
120
+ file: relativeFile(test.location.file, rootDir),
121
+ test: fullName(test.titlePath()),
122
+ state: outcome === "skipped" ? "skip" : outcome === "unexpected" ? "fail" : "pass",
123
+ retryCount: Math.max(0, test.results.length - 1),
124
+ flaky: outcome === "flaky",
125
+ errors: errors.map(resultError),
126
+ };
127
+ }
128
+ /** A failed test's last attempt's errors; none for a test that didn't fail. */
129
+ function lastErrors(test, outcome) {
130
+ return outcome === "unexpected" ? (test.results.at(-1)?.errors ?? []) : [];
131
+ }
132
+ /** `file` relative to `rootDir`, with `/` between its parts; `file` itself before Playwright said the config. */
133
+ function relativeFile(file, rootDir) {
134
+ return rootDir === undefined ? file : relative(rootDir, file).split(sep).join("/");
135
+ }
136
+ /**
137
+ * A test's name from its title path, which starts with the root's empty title, the Playwright project's name and the
138
+ * file: `[<project>] <describe titles> > <title>`.
139
+ */
140
+ function fullName(titlePath) {
141
+ const [, project, , ...titles] = titlePath;
142
+ const name = titles.join(" > ");
143
+ return project === undefined || project === "" ? name : `[${project}] ${name}`;
144
+ }
145
+ /** The terminal color and style sequences Playwright writes into an error's message and stack. */
146
+ // oxlint-disable-next-line no-control-regex -- the escape character starts each sequence
147
+ const ANSI = /\u001b\[[0-9;]*m/g;
148
+ /** The error class a message starts with, and the message after it: `TimeoutError: page.click: …`. */
149
+ const ERROR_CLASS = /^((?:[A-Za-z_$][\w$]*)?Error): /;
150
+ /**
151
+ * One of Playwright's errors as the writer takes it: without colors, and with the error class its message starts with
152
+ * as its name and the rest as its message, as a test runner that gives the two apart reports them.
153
+ */
154
+ function resultError(error) {
155
+ const text = (error.message ?? error.value ?? "").replace(ANSI, "");
156
+ const classed = ERROR_CLASS.exec(text);
157
+ const stack = error.stack?.replace(ANSI, "");
158
+ return {
159
+ ...(classed === null ? { message: text } : { name: classed[1], message: text.slice(classed[0].length) }),
160
+ ...(stack === undefined ? {} : { stack }),
161
+ };
162
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * This Playwright worker's worker index, a number from 0 to `workers - 1`: its parallel index, `TEST_PARALLEL_INDEX`
3
+ * in `env`, which Playwright counts from 0 and reuses for a failed worker's replacement. Where `TEST_PARALLEL_INDEX`
4
+ * is unset or empty it is 0: Playwright's main process, which loads the config file too, has no parallel index. Throws
5
+ * when `TEST_PARALLEL_INDEX` is not a non-negative integer.
6
+ */
7
+ export declare function workerIndex(env?: Readonly<Record<string, string | undefined>>): number;
@@ -0,0 +1,20 @@
1
+ // A Playwright worker's worker index: which of the run's workers this process is, counted from 0. An extension's
2
+ // support library spreads what its resource hands the run over the workers by it. It imports nothing, and no
3
+ // Playwright, and has no top-level `await`, so a CommonJS project's files may `require` what loads it.
4
+ /** The variable Playwright sets in a worker process to the worker's parallel index, before it loads the config. */
5
+ const PARALLEL_INDEX_VARIABLE = "TEST_PARALLEL_INDEX";
6
+ /**
7
+ * This Playwright worker's worker index, a number from 0 to `workers - 1`: its parallel index, `TEST_PARALLEL_INDEX`
8
+ * in `env`, which Playwright counts from 0 and reuses for a failed worker's replacement. Where `TEST_PARALLEL_INDEX`
9
+ * is unset or empty it is 0: Playwright's main process, which loads the config file too, has no parallel index. Throws
10
+ * when `TEST_PARALLEL_INDEX` is not a non-negative integer.
11
+ */
12
+ export function workerIndex(env = process.env) {
13
+ const raw = env[PARALLEL_INDEX_VARIABLE];
14
+ if (raw === undefined || raw === "")
15
+ return 0;
16
+ if (!/^(?:0|[1-9][0-9]*)$/.test(raw)) {
17
+ throw new Error(`${PARALLEL_INDEX_VARIABLE} is ${JSON.stringify(raw)}, not a non-negative integer`);
18
+ }
19
+ return Number(raw);
20
+ }
@@ -0,0 +1,167 @@
1
+ import type { RunnerStepPhase } from "../runner/index.ts";
2
+ /** What a run directory operation couldn't do: the path and what the OS said, or why there is no place for it. */
3
+ export interface RunDirectoryFailure {
4
+ readonly path: string;
5
+ readonly message: string;
6
+ }
7
+ /** The output of a step in a run directory: a snapshot build's steps, applying the changes, the install, the build. */
8
+ export type RunDirectoryStep = RunnerStepPhase;
9
+ /** A run log: a step's log, or the command log (`command`), the command's output, in a run directory. */
10
+ export type RunLog = RunDirectoryStep | "command";
11
+ /**
12
+ * One run's run directory, open for writing: `run.json` (what the run was, and once it ended how), `events.jsonl` (the
13
+ * run's events, one JSON object a line), a log of each step's output (`snapshot.log`, `apply.log`, `install.log`,
14
+ * `build.log`), `command.log` (the command's stdout and stderr in arrival order, wherever it runs),
15
+ * `.test-events.jsonl` (the test events the command stages here, unredacted, while it runs, which `close` removes),
16
+ * `.tests.jsonl.partial` (the run's redacted test events as storm gets them), `tests.jsonl` (that file, published once
17
+ * the run is over) and `timeline.json`. While it is open, `active.json` marks it active, so no run prunes it. Writes
18
+ * never throw; `run.json`, `tests.jsonl` and `timeline.json` each appear whole, one after another in the order asked,
19
+ * so a reader sees a file whole or not at all; the first write that fails stops the rest, and `close` answers it.
20
+ */
21
+ export interface RunDirectory {
22
+ readonly path: string;
23
+ /** Its run id, the directory's name. */
24
+ readonly id: string;
25
+ /** Replaces `run.json` whole. */
26
+ writeRun(text: string): void;
27
+ /** Appends one line to `events.jsonl`. */
28
+ appendEvent(line: string): void;
29
+ /** Appends one line of a step's output to its log. */
30
+ appendStepOutput(step: RunDirectoryStep, line: string): void;
31
+ /** Appends the command's output, as it came. */
32
+ appendCommandOutput(text: string): void;
33
+ /** Appends one redacted test event line to the private file that becomes `tests.jsonl`. */
34
+ appendTestEvent(line: string): void;
35
+ /**
36
+ * Publishes the redacted test events appended so far as `tests.jsonl`, after any earlier replacement. A run that
37
+ * appended none publishes an empty file. Appends after this are dropped.
38
+ */
39
+ publishTestEvents(): void;
40
+ /** Writes `timeline.json` whole, after any earlier replacement. */
41
+ writeTimeline(text: string): void;
42
+ /**
43
+ * Streams the non-empty lines the command staged in `.test-events.jsonl`, the test events file its run payload names,
44
+ * to `onLine`, in order. A file that doesn't exist reads as empty; any other read failure is returned after the lines
45
+ * read before it.
46
+ */
47
+ readTestEvents(onLine: (line: string) => void): Promise<StagedTestEventsRead>;
48
+ /**
49
+ * Waits for every write so far, ends writing, removes the test events the command staged whatever failed before, and
50
+ * removes the active marker, so the run directory is completed; answers the first write that failed, or else a staged
51
+ * test events file or a marker it couldn't remove, if any.
52
+ */
53
+ close(): Promise<RunDirectoryFailure | undefined>;
54
+ }
55
+ /** How reading the command's staged test events went: read whole, or stopped by a failure. */
56
+ export type StagedTestEventsRead = {
57
+ readonly ok: true;
58
+ } | {
59
+ readonly ok: false;
60
+ readonly failure: RunDirectoryFailure;
61
+ };
62
+ /** How opening a run directory went: the directory, and what pruning older ones couldn't remove; or a failure. */
63
+ export type OpenRunDirectoryResult = {
64
+ readonly ok: true;
65
+ readonly directory: RunDirectory;
66
+ readonly pruneFailures: readonly RunDirectoryFailure[];
67
+ } | {
68
+ readonly ok: false;
69
+ readonly failure: RunDirectoryFailure;
70
+ };
71
+ /** A run directory as a listing finds it: its run id, path, whether it is active, and its `run.json`, if readable. */
72
+ export interface ListedRunDirectory {
73
+ readonly id: string;
74
+ readonly path: string;
75
+ readonly active: boolean;
76
+ /** `run.json` as it reads; undefined when the run directory has none or it can't be read. */
77
+ readonly run: string | undefined;
78
+ }
79
+ /** How listing the run directories went: each one, newest first; or a failure. */
80
+ export type ListRunDirectoriesResult = {
81
+ readonly ok: true;
82
+ readonly runs: readonly ListedRunDirectory[];
83
+ } | {
84
+ readonly ok: false;
85
+ readonly failure: RunDirectoryFailure;
86
+ };
87
+ /**
88
+ * A run directory as reading it finds it: its listing, its test events and timeline as they read, and the run logs it
89
+ * holds.
90
+ */
91
+ export interface PastRunDirectory extends ListedRunDirectory {
92
+ /**
93
+ * The lines of `tests.jsonl`, the run's redacted test events; undefined until the run has written it, once it was
94
+ * over. The test events the command stages while it runs are never read back.
95
+ */
96
+ readonly tests: readonly string[] | undefined;
97
+ /** `timeline.json` as it reads; undefined when there is none. */
98
+ readonly timeline: string | undefined;
99
+ /** The run logs it holds, in `RUN_LOGS`' order. */
100
+ readonly logs: readonly RunLog[];
101
+ }
102
+ /**
103
+ * How reading a run log went: `found`, its `text` as it is now, less a UTF-8 character still being written at its end;
104
+ * `not-found` when the run directory or the log doesn't exist; or a failure.
105
+ */
106
+ export type ReadRunLogResult = {
107
+ readonly kind: "found";
108
+ readonly path: string;
109
+ readonly text: string;
110
+ } | {
111
+ readonly kind: "not-found";
112
+ } | {
113
+ readonly kind: "failed";
114
+ readonly failure: RunDirectoryFailure;
115
+ };
116
+ /** How reading one run directory went: found, not found, or a failure. */
117
+ export type ReadRunDirectoryResult = {
118
+ readonly kind: "found";
119
+ readonly directory: PastRunDirectory;
120
+ } | {
121
+ readonly kind: "not-found";
122
+ } | {
123
+ readonly kind: "failed";
124
+ readonly failure: RunDirectoryFailure;
125
+ };
126
+ /**
127
+ * The run directories: `${XDG_STATE_HOME:-~/.local/state}/storm/runs/<run id>/`, one for each recent run. A
128
+ * run id is the run's start in UTC, `YYYYMMDDTHHMMSS`, a dash and a short random suffix, so runs started in the
129
+ * same second from different worktrees don't collide.
130
+ *
131
+ * A run directory is active from when it is opened until it is closed, and completed after. One whose run ended
132
+ * without closing it, its holder gone, is completed too: on the same host, once its process no longer runs; held on
133
+ * another host, or with a marker that can't be read, 24 hours after.
134
+ */
135
+ export interface RunDirectoryGateway {
136
+ /**
137
+ * Makes a run directory for a run started at `startedAt`, active, holding `run` as its `run.json`, then removes
138
+ * every completed run directory but the newest `keep`, and removes the private test event files a run that ended without
139
+ * closing its run directory left in each completed one it keeps. Active run directories, this one among them, all
140
+ * stay as they are.
141
+ */
142
+ open(request: {
143
+ readonly startedAt: Date;
144
+ readonly keep: number;
145
+ readonly run: string;
146
+ }): Promise<OpenRunDirectoryResult>;
147
+ /**
148
+ * Every run directory, newest first, with whether it is active at `now` and its `run.json`. A run directory whose
149
+ * `run.json` can't be read is listed without it. No run directories yet is an empty list.
150
+ */
151
+ list(request: {
152
+ readonly now: Date;
153
+ }): Promise<ListRunDirectoriesResult>;
154
+ /**
155
+ * Run directory `id`, with whether it is active at `now`, its `run.json`, test events and timeline, and the run logs
156
+ * it holds.
157
+ */
158
+ read(request: {
159
+ readonly id: string;
160
+ readonly now: Date;
161
+ }): Promise<ReadRunDirectoryResult>;
162
+ /** Run log `log` of run directory `id`, as it is now. */
163
+ readLog(request: {
164
+ readonly id: string;
165
+ readonly log: RunLog;
166
+ }): Promise<ReadRunLogResult>;
167
+ }
@@ -0,0 +1,2 @@
1
+ // The run directory module's gateway: the run directories on disk, which a run writes and `storm runs` reads back.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ export type { RunDirectoryFailure, RunDirectoryGateway, RunLog } from "./gateways.ts";
2
+ export { liveRunDirectoryGateway, unavailableRunDirectoryGateway } from "./live/run-directory-gateway.ts";
3
+ export { RUNS_SUBPATH } from "./run-directory.ts";
4
+ export { recordRun, type RunRecorded, type RunRecording } from "./recording.ts";
5
+ export { type ListedRun, pastRuns } from "./reader.ts";
6
+ export { type PlanOption, planSchema, type TestPlanFacts } from "./plan.ts";
7
+ export { noSaveReasonSchema, type RunRecordGit, type RunRecordWhere, saveSchema } from "./run-record.ts";
8
+ export { type TimelineFacts, type TimelineFactsRow, timelineSchema } from "./timeline-facts.ts";
@@ -0,0 +1,13 @@
1
+ // The `run-directory` module's caller-facing interface: a run's record in its run directory, which `storm runs` reads
2
+ // back. Two things: the recording of one run (`recordRun`), which the composition layer starts once the run is
3
+ // planned, and the reader of past runs (`pastRuns`). Beside them, the shapes of what they hold, which outcomes report
4
+ // and `--json-schema` shows (`run.json`'s, `timeline.json`'s and the test plan's), and the gateway the context holds,
5
+ // with its live gateway. It holds only what another module under `src/` imports; the module's own tests and fakes
6
+ // import its internal files. It names no resource, and reading a past run asks the resource definition set nothing.
7
+ export { liveRunDirectoryGateway, unavailableRunDirectoryGateway } from "./live/run-directory-gateway.js";
8
+ export { RUNS_SUBPATH } from "./run-directory.js";
9
+ export { recordRun } from "./recording.js";
10
+ export { pastRuns } from "./reader.js";
11
+ export { planSchema } from "./plan.js";
12
+ export { noSaveReasonSchema, saveSchema } from "./run-record.js";
13
+ export { timelineSchema } from "./timeline-facts.js";
@@ -0,0 +1,35 @@
1
+ import { z } from "zod";
2
+ declare const planOptionSchema: z.ZodObject<{
3
+ path: z.ZodString;
4
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
5
+ from: z.ZodEnum<{
6
+ default: "default";
7
+ file: "file";
8
+ flag: "flag";
9
+ }>;
10
+ }, z.core.$strip>;
11
+ /**
12
+ * One resource option whose default is a function of the planned run: its key path, value and where the value came
13
+ * from.
14
+ */
15
+ export type PlanOption = Readonly<z.output<typeof planOptionSchema>>;
16
+ /** A run's test plan, as `vitest`'s and `playwright`'s `ran` outcomes, `run.json` and `runs show` hold it. */
17
+ export declare const planSchema: z.ZodObject<{
18
+ tests: z.ZodNumber;
19
+ files: z.ZodNumber;
20
+ options: z.ZodArray<z.ZodObject<{
21
+ path: z.ZodString;
22
+ value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
23
+ from: z.ZodEnum<{
24
+ default: "default";
25
+ file: "file";
26
+ flag: "flag";
27
+ }>;
28
+ }, z.core.$strip>>;
29
+ }, z.core.$strip>;
30
+ /**
31
+ * A run's test plan: how many tests `vitest list` or `playwright test --list` counted, in how many files, and each
32
+ * resource option whose default is a function of the planned run, with its value and where that came from.
33
+ */
34
+ export type TestPlanFacts = Readonly<z.output<typeof planSchema>>;
35
+ export {};
@@ -0,0 +1,24 @@
1
+ // A run's test plan as storm records it: what `vitest` or `playwright` counted before the run, and each resource
2
+ // option whose default is a function of the planned run, with its value and where that came from. Their `ran`
3
+ // outcomes, `run.json` and `runs show` share its shape; the composition layer says it (`commands/exec/test-plan.ts`).
4
+ import { z } from "zod";
5
+ const planOptionSchema = z.object({
6
+ /** The option's key path, `resources.<key>.<option>`, under its resource key. */
7
+ path: z.string(),
8
+ /** Its value. */
9
+ value: z.union([z.string(), z.number(), z.boolean()]),
10
+ /** Where the value came from: its flag (`flag`), storm.config.ts (`file`), or its default, given the test plan (`default`). */
11
+ from: z.enum(["flag", "file", "default"]),
12
+ });
13
+ /** A run's test plan, as `vitest`'s and `playwright`'s `ran` outcomes, `run.json` and `runs show` hold it. */
14
+ export const planSchema = z.object({
15
+ /** How many tests `vitest list --json <args>` or `playwright test <args> --list` counted. */
16
+ tests: z.number().int().nonnegative(),
17
+ /** How many distinct test files they are in. */
18
+ files: z.number().int().nonnegative(),
19
+ /**
20
+ * Each resource option whose default is a function of the test plan, with its value and where that came from; empty
21
+ * when the run has none.
22
+ */
23
+ options: z.array(planOptionSchema),
24
+ });
@@ -0,0 +1,70 @@
1
+ import { type TestEvent } from "../sdk/run/launcher.ts";
2
+ import type { ReadRunLogResult, RunDirectoryFailure, RunDirectoryGateway, RunLog } from "./gateways.ts";
3
+ import { type RunRecord } from "./run-record.ts";
4
+ import { type TimelineFacts } from "./timeline-facts.ts";
5
+ /** A listed run directory with what its `run.json` records; `record` undefined when it has none it can read. */
6
+ export interface ListedRun {
7
+ /** Its run id, the run directory's name. */
8
+ readonly id: string;
9
+ readonly path: string;
10
+ /** Whether its run is still going. */
11
+ readonly active: boolean;
12
+ readonly record: RunRecord | undefined;
13
+ }
14
+ /** A run log a past run holds, and where it is. */
15
+ export interface PastRunLog {
16
+ readonly log: RunLog;
17
+ readonly path: string;
18
+ }
19
+ /**
20
+ * A past run read whole: its listing and record; its tests' final results, from its `tests.jsonl`, which storm
21
+ * writes only once the run is over and only redacted, with how many lines held no test event; its timeline's facts,
22
+ * when it parses, which the waterfall draws as they are; and the run logs it holds.
23
+ */
24
+ export interface PastRun extends ListedRun {
25
+ /** Whether its test results were saved: it finished, so its `tests.jsonl` exists. */
26
+ readonly finished: boolean;
27
+ /** Its test events, in the order its `tests.jsonl` holds them; empty unless `finished`. */
28
+ readonly events: readonly TestEvent[];
29
+ readonly unreadableTestLines: number;
30
+ readonly timeline: TimelineFacts | undefined;
31
+ /** The run logs it holds, in the order the run writes them: each step's, then the command's. */
32
+ readonly logs: readonly PastRunLog[];
33
+ }
34
+ /** How listing the past runs went: each one, newest first; or a failure. */
35
+ export type ListedRuns = {
36
+ readonly ok: true;
37
+ readonly runs: readonly ListedRun[];
38
+ } | {
39
+ readonly ok: false;
40
+ readonly failure: RunDirectoryFailure;
41
+ };
42
+ /** How reading one past run went: found, not found, or a failure. */
43
+ export type ReadPastRun = {
44
+ readonly kind: "found";
45
+ readonly run: PastRun;
46
+ } | {
47
+ readonly kind: "not-found";
48
+ } | {
49
+ readonly kind: "failed";
50
+ readonly failure: RunDirectoryFailure;
51
+ };
52
+ /** The past runs in the run directories. */
53
+ export interface PastRuns {
54
+ /** Every past run, newest first, with whether it is active at `now` and what its `run.json` records. */
55
+ list(request: {
56
+ readonly now: Date;
57
+ }): Promise<ListedRuns>;
58
+ /** Past run `id`, read whole, with whether it is active at `now`. */
59
+ read(request: {
60
+ readonly id: string;
61
+ readonly now: Date;
62
+ }): Promise<ReadPastRun>;
63
+ /** Run log `log` of past run `id`, as it is now. */
64
+ readLog(request: {
65
+ readonly id: string;
66
+ readonly log: RunLog;
67
+ }): Promise<ReadRunLogResult>;
68
+ }
69
+ /** The past runs in the run directories `gateway` reads. */
70
+ export declare function pastRuns(gateway: RunDirectoryGateway): PastRuns;
@@ -0,0 +1,51 @@
1
+ // Past runs as `storm runs` reads them back from their run directories: the run directory module's reading half. It
2
+ // lists the run directories with what each one's `run.json` records, and reads one whole: its record, its test
3
+ // events from `tests.jsonl`, its timeline from `timeline.json`, and the run logs it holds; and it reads one run log.
4
+ // Reading asks the resource definition set nothing: rows and step names read as plain strings, and each resource
5
+ // instance's facts as recorded. Files it can't read, or from an older storm, leave facts unknown, never an error.
6
+ import { parseTestEvent } from "../sdk/run/launcher.js";
7
+ import { runLogFile } from "./run-directory.js";
8
+ import { parseRunRecord } from "./run-record.js";
9
+ import { timelineSchema } from "./timeline-facts.js";
10
+ /** The past runs in the run directories `gateway` reads. */
11
+ export function pastRuns(gateway) {
12
+ return {
13
+ list: async (request) => {
14
+ const listed = await gateway.list(request);
15
+ return listed.ok ? { ok: true, runs: listed.runs.map(listedRun) } : listed;
16
+ },
17
+ read: async (request) => {
18
+ const read = await gateway.read(request);
19
+ return read.kind === "found" ? { kind: "found", run: pastRun(read.directory) } : read;
20
+ },
21
+ readLog: async (request) => await gateway.readLog(request),
22
+ };
23
+ }
24
+ function listedRun({ id, path, active, run }) {
25
+ return { id, path, active, record: parseRunRecord(run) };
26
+ }
27
+ function pastRun(directory) {
28
+ const parsed = (directory.tests ?? []).map(parseTestEvent);
29
+ return {
30
+ ...listedRun(directory),
31
+ finished: directory.tests !== undefined,
32
+ events: parsed.filter((event) => event !== undefined),
33
+ unreadableTestLines: parsed.filter((event) => event === undefined).length,
34
+ timeline: parseTimeline(directory.timeline),
35
+ logs: directory.logs.map((log) => ({ log, path: `${directory.path}/${runLogFile(log)}` })),
36
+ };
37
+ }
38
+ /** `timeline.json`'s text as timeline facts; undefined when there is none, or it doesn't parse. */
39
+ function parseTimeline(text) {
40
+ if (text === undefined)
41
+ return undefined;
42
+ let json;
43
+ try {
44
+ json = JSON.parse(text);
45
+ }
46
+ catch {
47
+ return undefined;
48
+ }
49
+ const parsed = timelineSchema.safeParse(json);
50
+ return parsed.success ? parsed.data : undefined;
51
+ }