@cnc-tools/storm 0.14.1 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (404) hide show
  1. package/dist/application.js +3 -1
  2. package/dist/bin/storm.js +18 -8
  3. package/dist/build-info.js +1 -1
  4. package/dist/chunks/chunk-4U4DZ7VG.js +40 -0
  5. package/dist/chunks/{chunk-GSC6SRTW.js → chunk-5CCP36QQ.js} +1 -1
  6. package/dist/chunks/chunk-5GBMR4HM.js +966 -0
  7. package/dist/chunks/{chunk-43MWZLJR.js → chunk-5VXBKPW6.js} +1 -1
  8. package/dist/chunks/{chunk-RA4L2ACU.js → chunk-AWBSONHB.js} +88 -34
  9. package/dist/chunks/{chunk-BRUIATTR.js → chunk-CN4EFA5J.js} +59 -12
  10. package/dist/chunks/{chunk-27P2QSIM.js → chunk-CXAT7ZKP.js} +2 -2
  11. package/dist/chunks/chunk-E4PJNZVG.js +783 -0
  12. package/dist/chunks/{chunk-T6AZIDZD.js → chunk-F6N34UWB.js} +12 -244
  13. package/dist/chunks/{chunk-ZH5R7W4A.js → chunk-KC4KDJ5K.js} +147 -26
  14. package/dist/chunks/{chunk-5ED3IDUJ.js → chunk-L36GBUBB.js} +1652 -681
  15. package/dist/chunks/{chunk-QBR5VHJ7.js → chunk-OX7X4B2L.js} +7 -2
  16. package/dist/chunks/{chunk-Z5OXOZD3.js → chunk-PN5ULTTH.js} +140 -130
  17. package/dist/chunks/chunk-QUHY6FGN.js +108 -0
  18. package/dist/chunks/chunk-QVS7HRU7.js +74 -0
  19. package/dist/chunks/{chunk-UC6DULWY.js → chunk-R7XVBZOY.js} +130 -39
  20. package/dist/chunks/{chunk-YBPTMJUM.js → chunk-RAQEXKL6.js} +1120 -465
  21. package/dist/chunks/{chunk-RKONDLPS.js → chunk-SZEURWRS.js} +446 -52
  22. package/dist/chunks/chunk-TJNFVNKR.js +246 -0
  23. package/dist/chunks/{chunk-BW2ADH7U.js → chunk-VUPZH7J2.js} +1 -1
  24. package/dist/chunks/{chunk-XPCUINWS.js → chunk-XEVHP5ZW.js} +2 -2
  25. package/dist/chunks/{chunk-5TMHYH7G.js → chunk-YV7GE6EV.js} +638 -80
  26. package/dist/chunks/{chunk-GQIL3AHY.js → chunk-ZG3WQ4UF.js} +1 -1
  27. package/dist/chunks/{live-app-FBVWUUMT.js → live-app-PI3BAN6Y.js} +37 -26
  28. package/dist/command-tree.d.ts +2 -2
  29. package/dist/command-tree.js +2 -2
  30. package/dist/commands/exec/across-sandboxes-outcomes.d.ts +364 -0
  31. package/dist/commands/exec/across-sandboxes-outcomes.js +229 -0
  32. package/dist/commands/exec/across-sandboxes-run.d.ts +180 -0
  33. package/dist/commands/exec/across-sandboxes-run.js +339 -0
  34. package/dist/commands/exec/command.d.ts +577 -75
  35. package/dist/commands/exec/command.js +165 -32
  36. package/dist/commands/exec/driver-plan.d.ts +8 -2
  37. package/dist/commands/exec/driver-plan.js +13 -3
  38. package/dist/commands/exec/exec-words.d.ts +17 -3
  39. package/dist/commands/exec/exec-words.js +27 -16
  40. package/dist/commands/exec/live-view.d.ts +3 -4
  41. package/dist/commands/exec/live-view.js +37 -28
  42. package/dist/commands/exec/metadata.js +2 -2
  43. package/dist/commands/exec/mint-failed.d.ts +4 -4
  44. package/dist/commands/exec/mint-failed.js +6 -6
  45. package/dist/commands/exec/outcomes.d.ts +530 -73
  46. package/dist/commands/exec/outcomes.js +202 -66
  47. package/dist/commands/exec/plan-only.d.ts +10 -0
  48. package/dist/commands/exec/plan-only.js +46 -0
  49. package/dist/commands/exec/plan-run.d.ts +54 -35
  50. package/dist/commands/exec/plan-run.js +81 -38
  51. package/dist/commands/exec/planned-outcome.d.ts +15 -0
  52. package/dist/commands/exec/planned-outcome.js +35 -0
  53. package/dist/commands/exec/progress.d.ts +2 -2
  54. package/dist/commands/exec/progress.js +35 -18
  55. package/dist/commands/exec/resource-refusals.d.ts +2 -2
  56. package/dist/commands/exec/resource-refusals.js +3 -3
  57. package/dist/commands/exec/run-bin.d.ts +1 -1
  58. package/dist/commands/exec/run-bin.js +2 -2
  59. package/dist/commands/exec/run-command.d.ts +345 -63
  60. package/dist/commands/exec/run-command.js +308 -258
  61. package/dist/commands/exec/run-metadata.d.ts +42 -8
  62. package/dist/commands/exec/run-metadata.js +40 -21
  63. package/dist/commands/exec/run-planned.d.ts +20 -0
  64. package/dist/commands/exec/run-planned.js +22 -0
  65. package/dist/commands/exec/sandbox-lines.d.ts +42 -0
  66. package/dist/commands/exec/sandbox-lines.js +59 -0
  67. package/dist/commands/exec/sandbox-progress.d.ts +30 -0
  68. package/dist/commands/exec/sandbox-progress.js +232 -0
  69. package/dist/commands/exec/sandbox-view.d.ts +19 -0
  70. package/dist/commands/exec/sandbox-view.js +72 -0
  71. package/dist/commands/exec/view.d.ts +3 -2
  72. package/dist/commands/exec/view.js +10 -6
  73. package/dist/commands/runs/facts.d.ts +51 -9
  74. package/dist/commands/runs/facts.js +49 -29
  75. package/dist/commands/runs/list/command.d.ts +80 -4
  76. package/dist/commands/runs/list/command.js +11 -10
  77. package/dist/commands/runs/list/metadata.js +1 -1
  78. package/dist/commands/runs/list/outcomes.d.ts +40 -2
  79. package/dist/commands/runs/logs/command.d.ts +103 -8
  80. package/dist/commands/runs/logs/command.js +139 -24
  81. package/dist/commands/runs/logs/metadata.d.ts +4 -0
  82. package/dist/commands/runs/logs/metadata.js +14 -7
  83. package/dist/commands/runs/logs/outcomes.d.ts +49 -2
  84. package/dist/commands/runs/logs/outcomes.js +110 -6
  85. package/dist/commands/runs/past-run.d.ts +77 -6
  86. package/dist/commands/runs/past-run.js +133 -4
  87. package/dist/commands/runs/show/command.d.ts +568 -10
  88. package/dist/commands/runs/show/command.js +634 -119
  89. package/dist/commands/runs/show/metadata.d.ts +17 -0
  90. package/dist/commands/runs/show/metadata.js +48 -7
  91. package/dist/commands/runs/show/outcomes.d.ts +276 -5
  92. package/dist/commands/runs/show/outcomes.js +484 -96
  93. package/dist/commands/snapshots/build/command.d.ts +109 -18
  94. package/dist/commands/snapshots/build/command.js +72 -36
  95. package/dist/commands/snapshots/build/metadata.d.ts +4 -0
  96. package/dist/commands/snapshots/build/metadata.js +5 -1
  97. package/dist/commands/snapshots/build/outcomes.d.ts +53 -8
  98. package/dist/commands/snapshots/build/outcomes.js +26 -3
  99. package/dist/commands/snapshots/list/command.d.ts +72 -7
  100. package/dist/commands/snapshots/list/command.js +57 -24
  101. package/dist/commands/snapshots/list/metadata.d.ts +4 -0
  102. package/dist/commands/snapshots/list/metadata.js +4 -0
  103. package/dist/commands/snapshots/list/outcomes.d.ts +31 -0
  104. package/dist/commands/snapshots/list/outcomes.js +25 -2
  105. package/dist/commands/suites/list/command.d.ts +129 -0
  106. package/dist/commands/suites/list/command.js +162 -0
  107. package/dist/commands/suites/list/metadata.d.ts +11 -0
  108. package/dist/commands/suites/list/metadata.js +15 -0
  109. package/dist/commands/suites/list/outcomes.d.ts +91 -0
  110. package/dist/commands/suites/list/outcomes.js +122 -0
  111. package/dist/commands/suites/metadata.js +8 -0
  112. package/dist/commands/test/command.d.ts +1389 -0
  113. package/dist/commands/test/command.js +583 -0
  114. package/dist/commands/test/metadata.js +8 -0
  115. package/dist/commands/test/outcomes.d.ts +765 -0
  116. package/dist/commands/test/outcomes.js +140 -0
  117. package/dist/commands/test/plan.d.ts +92 -0
  118. package/dist/commands/test/plan.js +128 -0
  119. package/dist/commands/test/test-words.d.ts +12 -0
  120. package/dist/commands/test/test-words.js +42 -0
  121. package/dist/config/check-resources.d.ts +14 -0
  122. package/dist/config/check-resources.js +98 -0
  123. package/dist/config/check-runner.d.ts +13 -0
  124. package/dist/config/check-runner.js +54 -0
  125. package/dist/config/check-suites.d.ts +14 -0
  126. package/dist/config/check-suites.js +99 -0
  127. package/dist/config/gateways.d.ts +24 -0
  128. package/dist/config/index.d.ts +6 -3
  129. package/dist/config/index.js +3 -1
  130. package/dist/config/live/file-lists-file-gateway.d.ts +4 -0
  131. package/dist/config/live/file-lists-file-gateway.js +27 -0
  132. package/dist/config/load.d.ts +11 -10
  133. package/dist/config/load.js +35 -103
  134. package/dist/config/recipe-run.d.ts +8 -1
  135. package/dist/config/recipe-run.js +2 -1
  136. package/dist/config/resolve.d.ts +3 -2
  137. package/dist/config/resolve.js +6 -3
  138. package/dist/config/resolver.d.ts +20 -6
  139. package/dist/config/resolver.js +11 -8
  140. package/dist/config/runner.d.ts +24 -0
  141. package/dist/config/runner.js +4 -0
  142. package/dist/config/schema.d.ts +26 -18
  143. package/dist/config/schema.js +41 -9
  144. package/dist/config/settings-file.d.ts +9 -3
  145. package/dist/config/settings-file.js +41 -4
  146. package/dist/config/suite.d.ts +39 -0
  147. package/dist/config/suite.js +5 -0
  148. package/dist/config-file/define.d.ts +49 -18
  149. package/dist/config-file/define.js +9 -8
  150. package/dist/config-file/runner.d.ts +12 -0
  151. package/dist/config-file/runner.js +9 -0
  152. package/dist/context.d.ts +13 -8
  153. package/dist/context.js +13 -4
  154. package/dist/core/across-sandboxes.d.ts +43 -0
  155. package/dist/core/across-sandboxes.js +319 -0
  156. package/dist/core/before-run.d.ts +5 -3
  157. package/dist/core/before-run.js +12 -1
  158. package/dist/core/events.d.ts +62 -6
  159. package/dist/core/events.js +14 -0
  160. package/dist/core/index.d.ts +4 -2
  161. package/dist/core/index.js +3 -1
  162. package/dist/core/payload.d.ts +7 -4
  163. package/dist/core/payload.js +10 -4
  164. package/dist/core/presentations.js +1 -1
  165. package/dist/core/resource.d.ts +1 -1
  166. package/dist/core/resources.d.ts +56 -6
  167. package/dist/core/resources.js +81 -5
  168. package/dist/core/run-state.js +9 -0
  169. package/dist/core/run.d.ts +77 -15
  170. package/dist/core/run.js +150 -86
  171. package/dist/core/sandbox-end.d.ts +64 -0
  172. package/dist/core/sandbox-end.js +128 -0
  173. package/dist/core/timeline.d.ts +4 -4
  174. package/dist/core/timeline.js +3 -3
  175. package/dist/credential/live/vercel-cli-gateway.d.ts +7 -0
  176. package/dist/credential/live/vercel-cli-gateway.js +14 -1
  177. package/dist/extensions/github/context.d.ts +1 -1
  178. package/dist/extensions/github/definition.d.ts +11 -9
  179. package/dist/extensions/github/definition.js +8 -6
  180. package/dist/extensions/github/extension.d.ts +3 -3
  181. package/dist/extensions/github/fixture-repo.d.ts +21 -2
  182. package/dist/extensions/github/fixture-repo.js +31 -2
  183. package/dist/extensions/github/index.d.ts +2 -2
  184. package/dist/extensions/github/index.js +2 -2
  185. package/dist/extensions/github/lifecycle.d.ts +16 -6
  186. package/dist/extensions/github/lifecycle.js +42 -25
  187. package/dist/extensions/github/options.d.ts +17 -11
  188. package/dist/extensions/github/options.js +14 -13
  189. package/dist/extensions/github/refusals.d.ts +23 -6
  190. package/dist/extensions/github/refusals.js +34 -12
  191. package/dist/extensions/github/resource.d.ts +21 -12
  192. package/dist/extensions/github/resource.js +16 -8
  193. package/dist/extensions/github/run/payload.d.ts +6 -6
  194. package/dist/extensions/github/run/payload.js +3 -5
  195. package/dist/extensions/github/split.d.ts +10 -0
  196. package/dist/extensions/github/split.js +12 -0
  197. package/dist/extensions/playwright/driver.js +6 -26
  198. package/dist/extensions/playwright/extension.js +1 -1
  199. package/dist/extensions/testserver/commands/pool/create/command.js +8 -8
  200. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  201. package/dist/extensions/testserver/definition.d.ts +4 -4
  202. package/dist/extensions/testserver/definition.js +41 -31
  203. package/dist/extensions/testserver/extension.d.ts +4 -5
  204. package/dist/extensions/testserver/extension.js +14 -41
  205. package/dist/extensions/testserver/index.d.ts +1 -1
  206. package/dist/extensions/testserver/index.js +1 -1
  207. package/dist/extensions/testserver/lifecycle.d.ts +10 -2
  208. package/dist/extensions/testserver/lifecycle.js +29 -6
  209. package/dist/extensions/testserver/options/rules.d.ts +5 -5
  210. package/dist/extensions/testserver/options/rules.js +10 -8
  211. package/dist/extensions/testserver/options/sandboxes.d.ts +4 -2
  212. package/dist/extensions/testserver/options/sandboxes.js +8 -3
  213. package/dist/extensions/testserver/pool/gateways.d.ts +29 -4
  214. package/dist/extensions/testserver/pool/index.d.ts +2 -2
  215. package/dist/extensions/testserver/pool/index.js +1 -1
  216. package/dist/extensions/testserver/pool/lease.d.ts +10 -0
  217. package/dist/extensions/testserver/pool/lease.js +21 -0
  218. package/dist/extensions/testserver/pool/live/pool-store-gateway.js +38 -3
  219. package/dist/extensions/testserver/refusals.d.ts +12 -0
  220. package/dist/extensions/testserver/refusals.js +18 -0
  221. package/dist/extensions/testserver/release.d.ts +16 -0
  222. package/dist/extensions/testserver/release.js +56 -4
  223. package/dist/extensions/testserver/resource.d.ts +4 -4
  224. package/dist/extensions/testserver/resource.js +1 -1
  225. package/dist/extensions/testserver/split.d.ts +9 -0
  226. package/dist/extensions/testserver/split.js +22 -0
  227. package/dist/extensions/testserver/vitest/fixtures.d.ts +5 -5
  228. package/dist/extensions/testserver/vitest/fixtures.js +9 -38
  229. package/dist/extensions/vitest/driver.d.ts +7 -0
  230. package/dist/extensions/vitest/driver.js +33 -37
  231. package/dist/extensions/vitest/extension.js +1 -1
  232. package/dist/extensions/vitest/plan/plan-over.d.ts +8 -1
  233. package/dist/extensions/vitest/plan/plan-over.js +16 -2
  234. package/dist/extensions.d.ts +17 -16
  235. package/dist/extensions.js +5 -4
  236. package/dist/forward-sigterm.js +1 -1
  237. package/dist/launcher-resolvers/local-services.d.ts +1 -1
  238. package/dist/live-app.d.ts +3 -1
  239. package/dist/live-app.js +9 -5
  240. package/dist/local-services.js +1 -1
  241. package/dist/planning/driver-file-lists.d.ts +61 -0
  242. package/dist/planning/driver-file-lists.js +66 -0
  243. package/dist/{commands/exec → planning}/driver-refusals.d.ts +11 -10
  244. package/dist/{commands/exec → planning}/driver-refusals.js +18 -14
  245. package/dist/planning/file-lists-file.d.ts +58 -0
  246. package/dist/planning/file-lists-file.js +105 -0
  247. package/dist/planning/file-lists.d.ts +28 -0
  248. package/dist/planning/file-lists.js +52 -0
  249. package/dist/{commands/exec → planning}/final-results.d.ts +1 -1
  250. package/dist/{commands/exec → planning}/final-results.js +6 -6
  251. package/dist/planning/plan-only.d.ts +81 -0
  252. package/dist/planning/plan-only.js +83 -0
  253. package/dist/{commands/exec → planning}/redaction.d.ts +2 -2
  254. package/dist/{commands/exec → planning}/redaction.js +5 -4
  255. package/dist/{commands/exec → planning}/resource-flags.d.ts +5 -12
  256. package/dist/{commands/exec → planning}/resource-flags.js +6 -16
  257. package/dist/planning/run-kind-flags.d.ts +20 -0
  258. package/dist/planning/run-kind-flags.js +48 -0
  259. package/dist/planning/run-plan.d.ts +30 -0
  260. package/dist/planning/run-plan.js +4 -0
  261. package/dist/planning/sandbox-placeholders.d.ts +22 -0
  262. package/dist/planning/sandbox-placeholders.js +60 -0
  263. package/dist/planning/suite-not-found.d.ts +37 -0
  264. package/dist/planning/suite-not-found.js +36 -0
  265. package/dist/planning/suites.d.ts +43 -0
  266. package/dist/planning/suites.js +89 -0
  267. package/dist/{commands/exec → planning}/test-plan.d.ts +8 -3
  268. package/dist/{commands/exec → planning}/test-plan.js +32 -4
  269. package/dist/playwright/reporter.d.ts +20 -8
  270. package/dist/playwright/reporter.js +195 -15
  271. package/dist/presentation.d.ts +10 -6
  272. package/dist/presentation.js +13 -15
  273. package/dist/run-directory/gateways.d.ts +60 -4
  274. package/dist/run-directory/index.d.ts +4 -4
  275. package/dist/run-directory/index.js +2 -1
  276. package/dist/run-directory/live/run-directory-gateway.js +92 -16
  277. package/dist/run-directory/plan.d.ts +35 -2
  278. package/dist/run-directory/plan.js +44 -7
  279. package/dist/run-directory/reader.d.ts +26 -5
  280. package/dist/run-directory/reader.js +24 -1
  281. package/dist/run-directory/recording.d.ts +75 -49
  282. package/dist/run-directory/recording.js +214 -28
  283. package/dist/run-directory/run-directory.d.ts +22 -1
  284. package/dist/run-directory/run-directory.js +24 -0
  285. package/dist/run-directory/run-record.d.ts +144 -21
  286. package/dist/run-directory/run-record.js +118 -19
  287. package/dist/run-directory/timeline-facts.js +4 -4
  288. package/dist/runner/build-snapshots.d.ts +7 -7
  289. package/dist/runner/build-snapshots.js +12 -16
  290. package/dist/runner/events.d.ts +29 -8
  291. package/dist/runner/gateways.d.ts +59 -8
  292. package/dist/runner/index.d.ts +6 -4
  293. package/dist/runner/index.js +3 -2
  294. package/dist/runner/live/sandbox-gateway.js +177 -33
  295. package/dist/runner/live/terminal.d.ts +15 -3
  296. package/dist/runner/live/terminal.js +25 -3
  297. package/dist/runner/network-policy.d.ts +55 -0
  298. package/dist/runner/network-policy.js +46 -0
  299. package/dist/runner/policy-writes.d.ts +40 -0
  300. package/dist/runner/policy-writes.js +124 -0
  301. package/dist/runner/prepare.d.ts +6 -7
  302. package/dist/runner/ready.d.ts +39 -10
  303. package/dist/runner/ready.js +59 -47
  304. package/dist/runner/recipe-check.d.ts +6 -0
  305. package/dist/runner/recipe-check.js +29 -0
  306. package/dist/runner/recipe-secrets.d.ts +67 -0
  307. package/dist/runner/recipe-secrets.js +230 -0
  308. package/dist/runner/recipe.d.ts +118 -28
  309. package/dist/runner/recipe.js +147 -154
  310. package/dist/runner/sandboxed-command.d.ts +24 -10
  311. package/dist/runner/sandboxed-command.js +37 -12
  312. package/dist/runner/scope.d.ts +107 -21
  313. package/dist/runner/scope.js +274 -54
  314. package/dist/runner/secrets.d.ts +42 -31
  315. package/dist/runner/secrets.js +62 -40
  316. package/dist/runner/session.d.ts +59 -26
  317. package/dist/runner/session.js +82 -41
  318. package/dist/runner/snapshot-build.d.ts +7 -4
  319. package/dist/runner/snapshot-build.js +48 -28
  320. package/dist/runner/snapshot-choice.d.ts +37 -0
  321. package/dist/runner/snapshot-choice.js +38 -0
  322. package/dist/runner/snapshot-key.d.ts +16 -14
  323. package/dist/runner/snapshot-key.js +24 -18
  324. package/dist/runner/steps.d.ts +13 -5
  325. package/dist/runner/steps.js +34 -4
  326. package/dist/runner/time-limit.d.ts +10 -0
  327. package/dist/runner/time-limit.js +43 -0
  328. package/dist/sdk/extension/commands.d.ts +1 -7
  329. package/dist/sdk/extension/driver.d.ts +39 -46
  330. package/dist/sdk/extension/driver.js +6 -6
  331. package/dist/sdk/extension/index.d.ts +3 -3
  332. package/dist/sdk/extension/index.js +3 -4
  333. package/dist/sdk/extension/lifecycle.d.ts +52 -9
  334. package/dist/sdk/extension/lifecycle.js +1 -1
  335. package/dist/sdk/extension/resource-definition.d.ts +13 -10
  336. package/dist/sdk/extension/resource-definition.js +7 -2
  337. package/dist/sdk/extension/resource.d.ts +2 -2
  338. package/dist/sdk/extension/secret-source.d.ts +58 -0
  339. package/dist/sdk/extension/secret-source.js +78 -0
  340. package/dist/sdk/index.d.ts +2 -2
  341. package/dist/sdk/index.js +1 -1
  342. package/dist/sdk/run/launcher.d.ts +1 -1
  343. package/dist/sdk/run/launcher.js +1 -1
  344. package/dist/sdk/run/payload.d.ts +16 -1
  345. package/dist/sdk/run/payload.js +17 -2
  346. package/dist/sdk/run/redact.js +2 -2
  347. package/dist/sdk/run/test-events.d.ts +23 -6
  348. package/dist/sdk/run/test-events.js +6 -4
  349. package/dist/sdk/run/test-result-writer.d.ts +8 -3
  350. package/dist/sdk/run/test-result-writer.js +22 -2
  351. package/dist/{commands/exec → shared}/cleanup.d.ts +3 -3
  352. package/dist/{commands/exec → shared}/cleanup.js +11 -6
  353. package/dist/shared/job-summary.d.ts +19 -0
  354. package/dist/{commands/exec → shared}/job-summary.js +17 -0
  355. package/dist/shared/sandbox-table.d.ts +48 -0
  356. package/dist/shared/sandbox-table.js +109 -0
  357. package/dist/{commands/exec → shared}/snapshot-text.d.ts +1 -1
  358. package/dist/{commands/exec → shared}/tests-summary.d.ts +22 -6
  359. package/dist/{commands/exec → shared}/tests-summary.js +74 -31
  360. package/dist/{commands/exec → shared}/text.d.ts +7 -2
  361. package/dist/{commands/exec → shared}/text.js +9 -1
  362. package/dist/{commands/exec → shared}/waterfall.d.ts +8 -6
  363. package/dist/{commands/exec → shared}/waterfall.js +71 -24
  364. package/dist/shared/worker-chart.d.ts +172 -0
  365. package/dist/shared/worker-chart.js +623 -0
  366. package/dist/vitest/config.d.ts +35 -11
  367. package/dist/vitest/config.js +47 -14
  368. package/dist/vitest/index.d.ts +1 -1
  369. package/dist/vitest/index.js +3 -3
  370. package/dist/vitest/sequencer.d.ts +23 -0
  371. package/dist/vitest/sequencer.js +73 -0
  372. package/dist/vitest/setup.d.ts +1 -0
  373. package/dist/vitest/setup.js +34 -0
  374. package/dist/vitest/test-events.d.ts +32 -6
  375. package/dist/vitest/test-events.js +25 -5
  376. package/dist/vitest/test-results.d.ts +8 -3
  377. package/dist/vitest/test-results.js +6 -0
  378. package/package.json +7 -2
  379. package/skills/overview.md +21 -17
  380. package/skills/plan-runs.md +67 -0
  381. package/skills/read-run-output.md +51 -19
  382. package/dist/chunks/chunk-BFLYGMG3.js +0 -607
  383. package/dist/chunks/chunk-HOKDKP5A.js +0 -49
  384. package/dist/chunks/chunk-IVRRGGCD.js +0 -201
  385. package/dist/chunks/chunk-NMVODY3P.js +0 -19
  386. package/dist/commands/exec/define-run-command.d.ts +0 -671
  387. package/dist/commands/exec/define-run-command.js +0 -91
  388. package/dist/commands/exec/job-summary.d.ts +0 -10
  389. package/dist/commands/exec/worker-chart.d.ts +0 -87
  390. package/dist/commands/exec/worker-chart.js +0 -343
  391. package/dist/commands/playwright/command.d.ts +0 -661
  392. package/dist/commands/playwright/command.js +0 -31
  393. package/dist/commands/playwright/metadata.js +0 -8
  394. package/dist/commands/vitest/command.d.ts +0 -662
  395. package/dist/commands/vitest/command.js +0 -31
  396. package/dist/commands/vitest/metadata.js +0 -8
  397. package/dist/sdk/extension/ci.d.ts +0 -2
  398. package/dist/sdk/extension/ci.js +0 -6
  399. package/dist/chunks/{chunk-YM6TZV4L.js → chunk-VL7WFTVQ.js} +52 -52
  400. package/dist/commands/{playwright → suites}/metadata.d.ts +1 -1
  401. package/dist/commands/{vitest → test}/metadata.d.ts +1 -1
  402. /package/dist/{commands → shared}/dashboard.d.ts +0 -0
  403. /package/dist/{commands → shared}/dashboard.js +0 -0
  404. /package/dist/{commands/exec → shared}/snapshot-text.js +0 -0
@@ -0,0 +1,966 @@
1
+ import {
2
+ DEFINITION_SET,
3
+ EXTENSIONS,
4
+ RESOURCES
5
+ } from "./chunk-PN5ULTTH.js";
6
+ import {
7
+ median,
8
+ seconds,
9
+ shortFile,
10
+ truncate,
11
+ visibleLength
12
+ } from "./chunk-OX7X4B2L.js";
13
+ import {
14
+ PALETTE,
15
+ paintSwatch
16
+ } from "./chunk-F6N34UWB.js";
17
+ import {
18
+ megabytesText,
19
+ sameRow,
20
+ setupPhaseKey,
21
+ setupPhaseWords
22
+ } from "./chunk-YV7GE6EV.js";
23
+ import {
24
+ CONFIG_FILE_NAME
25
+ } from "./chunk-L36GBUBB.js";
26
+ import {
27
+ defaultResourceKey,
28
+ optionKeyPath
29
+ } from "./chunk-AWBSONHB.js";
30
+
31
+ // src/planning/file-lists.ts
32
+ function byCodeUnits(a, b) {
33
+ return a < b ? -1 : a > b ? 1 : 0;
34
+ }
35
+ function dealFileLists(files, count) {
36
+ const sorted = [...new Set(files)].toSorted(byCodeUnits);
37
+ const lists = Array.from({ length: Math.min(count, sorted.length) }, () => []);
38
+ sorted.forEach((file, index) => lists[index % lists.length]?.push(file));
39
+ return lists;
40
+ }
41
+ function comparedPath(path) {
42
+ let normal = path.replaceAll("\\", "/").replace(/\/{2,}/g, "/");
43
+ while (normal.startsWith("./")) normal = normal.slice(2);
44
+ return normal;
45
+ }
46
+ function fileListMismatches(sandboxes) {
47
+ return sandboxes.flatMap(({ sandbox, files, exitCode, reported, whole }) => {
48
+ if (files === null || exitCode === null || !whole) return [];
49
+ const listed = new Set(files.map(comparedPath));
50
+ const seen = new Set(reported.map(comparedPath));
51
+ const missing = [...listed].filter((file) => !seen.has(file)).toSorted(byCodeUnits);
52
+ const extra = [...seen].filter((file) => !listed.has(file)).toSorted(byCodeUnits);
53
+ return missing.length === 0 && extra.length === 0 ? [] : [{ sandbox, missing, extra }];
54
+ });
55
+ }
56
+ var NAMED_PATHS = 3;
57
+ function pathsText(paths) {
58
+ const named = paths.slice(0, NAMED_PATHS).join(", ");
59
+ return paths.length > NAMED_PATHS ? `${named}, and ${paths.length - NAMED_PATHS} more` : named;
60
+ }
61
+ function fileListMismatchText({ sandbox, missing, extra }, options = {}) {
62
+ const files = (n) => `${n} test ${n === 1 ? "file" : "files"}`;
63
+ const parts = [
64
+ ...missing.length === 0 ? [] : [`reported nothing for ${files(missing.length)} of its file list: ${pathsText(missing)}`],
65
+ ...extra.length === 0 ? [] : [`reported ${files(extra.length)} not in its file list: ${pathsText(extra)}`]
66
+ ];
67
+ const hint = extra.length > 0 && options.extraHint !== void 0 ? ` ${options.extraHint}` : "";
68
+ return `Runner sandbox ${sandbox} ${parts.join("; it ")}.${hint}`;
69
+ }
70
+
71
+ // src/planning/resource-flags.ts
72
+ import { z } from "zod";
73
+ function flagField(prefix, option) {
74
+ return `${prefix}${option.charAt(0).toUpperCase()}${option.slice(1)}`;
75
+ }
76
+ function flagSpelling(field) {
77
+ return `--${field.replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2").replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
78
+ }
79
+ var RESOURCE_FLAGS = RESOURCES.flatMap((definition) => {
80
+ const options = definition.options;
81
+ return Object.entries(options).flatMap(([option, rule]) => {
82
+ const help = rule.flag;
83
+ if (help === void 0) return [];
84
+ const field = flagField(definition.flagPrefix, option);
85
+ return [
86
+ {
87
+ definition: definition.name,
88
+ resource: defaultResourceKey(definition),
89
+ option,
90
+ field,
91
+ flag: flagSpelling(field),
92
+ rule,
93
+ help
94
+ }
95
+ ];
96
+ });
97
+ });
98
+ var RESOURCE_FLAG_HELP = Object.fromEntries(
99
+ RESOURCE_FLAGS.map(({ field, help }) => [field, help])
100
+ );
101
+ var RESOURCE_USAGE_FLAGS = RESOURCE_FLAGS.map(({ flag, help, rule }) => {
102
+ if (help.valueLabel !== void 0) return `[${flag} <${help.valueLabel}>]`;
103
+ return rule.default === true ? `[${flag}=false]` : `[${flag}]`;
104
+ }).join(" ");
105
+ function resourceRunExamples() {
106
+ return EXTENSIONS.flatMap(({ examples }) => examples?.exec ?? []);
107
+ }
108
+ function baseType(schema, field) {
109
+ let input = schema;
110
+ while (input instanceof z.ZodPipe) input = input.in;
111
+ if (input instanceof z.ZodNumber) return z.number();
112
+ if (input instanceof z.ZodString) return z.string();
113
+ if (input instanceof z.ZodBoolean) return z.boolean();
114
+ if (input instanceof z.ZodEnum) return input;
115
+ throw new Error(`The run flag ${field}'s option schema has no number, string, boolean or enum base`);
116
+ }
117
+ function resourceFlagFields(taken) {
118
+ const fields = {};
119
+ for (const { field, rule } of RESOURCE_FLAGS) {
120
+ if (Object.hasOwn(fields, field) || taken.includes(field))
121
+ throw new Error(`Two run flags share the request field ${field}`);
122
+ fields[field] = baseType(rule.schema, field).optional();
123
+ }
124
+ return fields;
125
+ }
126
+ function readResourceFlags(request) {
127
+ const values = {};
128
+ const problems = [];
129
+ for (const { definition, option, field, flag, rule } of RESOURCE_FLAGS) {
130
+ const value = request[field];
131
+ if (value === void 0) continue;
132
+ const checked = rule.schema.safeParse(value);
133
+ if (checked.success) values[definition] = { ...values[definition], [option]: checked.data };
134
+ else problems.push(...checked.error.issues.map(({ message }) => ({ field, message: `${flag} ${message}.` })));
135
+ }
136
+ if (problems.length > 0) return { ok: false, problems };
137
+ return { ok: true, values };
138
+ }
139
+ function resourceFlagProblems(request) {
140
+ const read = readResourceFlags(request);
141
+ return read.ok ? [] : read.problems;
142
+ }
143
+ function resourceFlagValues(request) {
144
+ const read = readResourceFlags(request);
145
+ if (!read.ok) throw new Error(`The flags should have been refused: ${read.problems.map((p) => p.message).join(" ")}`);
146
+ return read.values;
147
+ }
148
+
149
+ // src/planning/test-plan.ts
150
+ function recordedPlan(testPlan, options) {
151
+ return testPlan.kind === "counted" ? {
152
+ ...testPlan.tests === void 0 ? {} : { tests: testPlan.tests },
153
+ files: testPlan.files,
154
+ options: options.map((option) => ({ ...option }))
155
+ } : void 0;
156
+ }
157
+ function testPlanLine(plan) {
158
+ return `Running ${testPlanText(plan)}`;
159
+ }
160
+ function testPlanText(plan) {
161
+ const sandboxes = plan.sandboxes === void 0 ? void 0 : sandboxCountText(plan.sandboxes);
162
+ const leftOut = plan.sandboxes?.leftOut ?? 0;
163
+ const count = plan.files === void 0 ? void 0 : leftOut > 0 ? `${plan.files - leftOut} of ${plan.files} test files` : plan.sandboxes !== void 0 && plan.tests === void 0 ? `${plan.files} test ${plan.files === 1 ? "file" : "files"}` : countText({ tests: plan.tests, files: plan.files });
164
+ const head = count === void 0 ? sandboxes : sandboxes === void 0 ? count : `${count} in ${sandboxes}`;
165
+ return [...head === void 0 ? [] : [head], ...plan.options.map(planOptionText)].join("; ");
166
+ }
167
+ function sandboxCountText({ count, from, max, requested, default: given }) {
168
+ const sandboxes = `${count} ${count === 1 ? "runner sandbox" : "runner sandboxes"}`;
169
+ if (from === "default" && given !== void 0 && given > max)
170
+ return `${sandboxes} (${SANDBOX_COUNT_FROM.default} ${given}, lowered to the max ${max}${requested === void 0 ? "" : ", then to the number of test files"})`;
171
+ const source = requested === void 0 ? SANDBOX_COUNT_FROM[from] : `${SANDBOX_COUNT_FROM[from]} ${requested}, lowered to the number of test files`;
172
+ return `${sandboxes} (${source}, max ${max})`;
173
+ }
174
+ var SANDBOX_COUNT_FROM = {
175
+ flag: "--sandboxes",
176
+ "file-lists": "--file-lists",
177
+ default: "runner.sandboxes.default"
178
+ };
179
+ function countText({ tests, files }) {
180
+ const inFiles = `in ${files} ${files === 1 ? "file" : "files"}`;
181
+ return tests === void 0 ? `tests ${inFiles}` : `${tests} ${tests === 1 ? "test" : "tests"} ${inFiles}`;
182
+ }
183
+ function planOptionText({ path, value, from }) {
184
+ return `${path} ${String(value)} (${fromText(path, from)})`;
185
+ }
186
+ function fromText(path, from) {
187
+ switch (from) {
188
+ case "flag":
189
+ return RESOURCE_FLAGS.find(({ resource, option }) => optionKeyPath(resource, option) === path)?.flag ?? "a flag";
190
+ case "file":
191
+ return CONFIG_FILE_NAME;
192
+ case "default":
193
+ return "default";
194
+ }
195
+ }
196
+
197
+ // src/shared/tests-summary.ts
198
+ var SLOWEST_FILES = 3;
199
+ function testsSummaryLines(events, hints, unreadable = 0, incomplete) {
200
+ const summary = testsSummary(events, hints, unreadable, incomplete);
201
+ return [
202
+ summary.tests,
203
+ ...summary.setups.map((line) => ` ${line}`),
204
+ summary.slowest === void 0 ? void 0 : ` ${summary.slowest}`,
205
+ summary.unreadable,
206
+ summary.incomplete
207
+ ].filter((line) => line !== void 0);
208
+ }
209
+ function incompleteText(message) {
210
+ return `the test results may be incomplete: couldn't read the test events file once the command ended: ${message}`;
211
+ }
212
+ function noFinalResultsText(hint) {
213
+ return `no final test results: ${hint}`;
214
+ }
215
+ function testsSummary(events, hints, unreadable = 0, incomplete) {
216
+ const results = [];
217
+ const reported = [];
218
+ for (const event of events) {
219
+ if (event.kind === "test-result") results.push(event);
220
+ else if ("worker" in event && event.worker !== void 0) reported.push(event);
221
+ }
222
+ let tests;
223
+ let setups = [];
224
+ let slowestText;
225
+ if (events.length > 0) {
226
+ const attempts = reported.flatMap((event) => event.kind === "test-attempt-finished" ? [event] : []);
227
+ const testMs = attempts.reduce((sum, event) => sum + event.ms, 0);
228
+ const workersBySandbox = /* @__PURE__ */ new Map();
229
+ let first = Infinity;
230
+ let last = -Infinity;
231
+ for (const event of reported) {
232
+ const sandbox = event.sandbox ?? -1;
233
+ workersBySandbox.set(sandbox, Math.max(workersBySandbox.get(sandbox) ?? 0, event.worker + 1));
234
+ first = Math.min(first, event.at);
235
+ last = Math.max(last, event.at);
236
+ }
237
+ let workers = 0;
238
+ for (const count of workersBySandbox.values()) workers += count;
239
+ const wallMs = reported.length === 0 ? 0 : last - first;
240
+ const files = new Set(events.map((event) => event.file)).size;
241
+ const filesText = `${files} ${files === 1 ? "file" : "files"}`;
242
+ const outcome = results.length === 0 ? [
243
+ noFinalResultsText(hints.noFinalResults),
244
+ ...attempts.length === 0 ? [] : [`${attempts.length} test ${attempts.length === 1 ? "attempt" : "attempts"}`],
245
+ filesText
246
+ ] : resultTotals(results, filesText);
247
+ const busy = wallMs > 0 && workers > 0 ? ` (${Math.round(testMs / (wallMs * workers) * 100)}% busy)` : "";
248
+ const timing = workers === 0 ? [] : [
249
+ `${seconds(testMs)} of attempts on ${workers} ${workers === 1 ? "worker" : "workers"} in ${seconds(wallMs)}${busy}`
250
+ ];
251
+ tests = ` tests ${[...outcome, ...timing].join(" \xB7 ")}`;
252
+ setups = setupsText(reported, testMs);
253
+ const slowest = slowestFiles(events);
254
+ if (slowest.length > 0)
255
+ slowestText = `slowest: ${slowest.map(({ file, ms }) => `${shortFile(file)} ${seconds(ms)}`).join(", ")}`;
256
+ }
257
+ return {
258
+ tests,
259
+ setups,
260
+ slowest: slowestText,
261
+ unreadable: unreadable > 0 ? ` tests skipped ${unreadable} unreadable test event ${unreadable === 1 ? "line" : "lines"}` : void 0,
262
+ incomplete: incomplete === void 0 ? void 0 : ` tests ${incompleteText(incomplete)}`
263
+ };
264
+ }
265
+ function setupWordsOf(events) {
266
+ return setupPhaseWords(
267
+ events.flatMap((event) => event.kind === "setup-started" || event.kind === "setup-finished" ? [event] : [])
268
+ );
269
+ }
270
+ function formatSetupPhases(phases, allPhases, testMs) {
271
+ const words = setupPhaseWords(allPhases);
272
+ const groups = /* @__PURE__ */ new Map();
273
+ for (const phase of phases) {
274
+ const key = setupPhaseKey(phase);
275
+ const group = groups.get(key) ?? { label: words(phase), starts: [], warmups: [] };
276
+ groups.set(key, group);
277
+ group.starts.push(phase.ms);
278
+ if (phase.warmupMs !== void 0) group.warmups.push(phase.warmupMs);
279
+ }
280
+ return [...groups.values()].map(({ label, starts, warmups }) => {
281
+ let startMs = 0;
282
+ let fastest = Infinity;
283
+ let slowest = -Infinity;
284
+ for (const ms of starts) {
285
+ startMs += ms;
286
+ fastest = Math.min(fastest, ms);
287
+ slowest = Math.max(slowest, ms);
288
+ }
289
+ const share = testMs > 0 ? ` \xB7 ~${Math.round(startMs / testMs * 100)}% of attempt time` : "";
290
+ const warmup = warmups.length === 0 ? "" : ` \xB7 warmup median ${seconds(median(warmups) ?? 0)}`;
291
+ return `${label} starts ${starts.length} \xB7 ${seconds(fastest)}\u2013${seconds(slowest)} \xB7 median ${seconds(median(starts) ?? 0)}${share}${warmup}`;
292
+ });
293
+ }
294
+ function setupsText(events, testMs) {
295
+ const allPhases = events.flatMap(
296
+ (event) => event.kind === "setup-started" || event.kind === "setup-finished" ? [event] : []
297
+ );
298
+ const succeeded = events.flatMap(
299
+ (event) => event.kind === "setup-finished" && event.ok ? [{ label: event.label, resource: event.resource, ms: event.ms, warmupMs: event.warmupMs }] : []
300
+ );
301
+ return formatSetupPhases(succeeded, allPhases, testMs);
302
+ }
303
+ function resultTotals(results, filesText) {
304
+ const count = (state) => results.filter((event) => event.state === state).length;
305
+ const failed = count("fail");
306
+ const skipped = count("skip");
307
+ return [
308
+ `${count("pass")} passed`,
309
+ ...failed === 0 ? [] : [`${failed} failed`],
310
+ ...skipped === 0 ? [] : [`${skipped} skipped`],
311
+ filesText
312
+ ];
313
+ }
314
+ function slowestFiles(events) {
315
+ const workerStarted = /* @__PURE__ */ new Map();
316
+ const workerDurations = [];
317
+ const workerFiles = /* @__PURE__ */ new Set();
318
+ const mainSpan = /* @__PURE__ */ new Map();
319
+ for (const event of events) {
320
+ if (event.kind !== "file-started" && event.kind !== "file-finished") continue;
321
+ const sandbox = event.sandbox ?? -1;
322
+ const fileKey = `${sandbox}\0${event.file}`;
323
+ if ("worker" in event && event.worker !== void 0) {
324
+ const key = `${sandbox}\0${event.worker}\0${event.file}`;
325
+ if (event.kind === "file-started") workerStarted.set(key, event.at);
326
+ else {
327
+ const at = workerStarted.get(key);
328
+ if (at !== void 0) {
329
+ workerFiles.add(fileKey);
330
+ workerDurations.push({ sandbox, file: event.file, ms: Math.max(0, event.at - at) });
331
+ }
332
+ }
333
+ } else {
334
+ const held = mainSpan.get(fileKey) ?? { sandbox, file: event.file };
335
+ mainSpan.set(fileKey, held);
336
+ if (event.kind === "file-started") held.started = Math.min(held.started ?? event.at, event.at);
337
+ else held.finished = Math.max(held.finished ?? event.at, event.at);
338
+ }
339
+ }
340
+ const durations = workerDurations.map(({ file, ms }) => ({ file, ms }));
341
+ for (const [fileKey, span] of mainSpan) {
342
+ if (workerFiles.has(fileKey)) continue;
343
+ if (span.started !== void 0 && span.finished !== void 0)
344
+ durations.push({ file: span.file, ms: Math.max(0, span.finished - span.started) });
345
+ }
346
+ return durations.toSorted((a, b) => b.ms - a.ms).slice(0, SLOWEST_FILES);
347
+ }
348
+
349
+ // src/shared/worker-chart.ts
350
+ var MAX_WORKER_ROWS = 16;
351
+ var MAX_LABEL_SHARE = 0.3;
352
+ var MAX_LABEL_WIDTH = 32;
353
+ var INDENT = " ";
354
+ var SPARK_GLYPHS = ["\u2581", "\u2582", "\u2583", "\u2584", "\u2585", "\u2586", "\u2587", "\u2588"];
355
+ function testsChart(events, hints, unreadable, clock, incomplete, view = "sparkline") {
356
+ const lanes = workerLanes(events, clock);
357
+ const parallelism = workerParallelism(lanes, clock.tests);
358
+ if (lanes.length === 0 || parallelism === void 0) return void 0;
359
+ const summary = testsSummary(events, hints, unreadable, incomplete);
360
+ const notes = [
361
+ summary.tests,
362
+ ...summary.setups.map((line) => ` \u2591 ${line}`),
363
+ ...failedSetupsText(lanes, setupWordsOf(events)).map((line) => ` \xD7 ${line}`),
364
+ view === "lanes" && lanes.some((lane) => lane.files.length > 1) ? " \u2588\u2593 a worker's files, in turn" : void 0,
365
+ summary.unreadable,
366
+ summary.incomplete
367
+ ].filter((line) => line !== void 0);
368
+ return { lanes, parallelism, notes };
369
+ }
370
+ function workerLaneNotes(lanes, attemptMs) {
371
+ const allSetups = lanes.flatMap((lane) => lane.setups);
372
+ const words = setupPhaseWords(allSetups);
373
+ const succeeded = allSetups.flatMap(
374
+ (setup) => setup.ok && setup.setupMs !== void 0 ? [{ label: setup.label, resource: setup.resource, ms: setup.setupMs, warmupMs: setup.warmupMs }] : []
375
+ );
376
+ return [
377
+ ...formatSetupPhases(succeeded, allSetups, attemptMs).map((line) => ` \u2591 ${line}`),
378
+ ...failedSetupsText(lanes, words).map((line) => ` \xD7 ${line}`),
379
+ ...lanes.some((lane) => lane.files.length > 1) ? [" \u2588\u2593 a worker's files, in turn"] : []
380
+ ];
381
+ }
382
+ function failedSetupsText(lanes, words) {
383
+ const failed = /* @__PURE__ */ new Map();
384
+ for (const setup of lanes.flatMap((lane) => lane.setups)) {
385
+ if (setup.ok) continue;
386
+ const key = setupPhaseKey(setup);
387
+ const group = failed.get(key) ?? { label: words(setup), count: 0 };
388
+ failed.set(key, group);
389
+ group.count += 1;
390
+ }
391
+ return [...failed.values()].map(({ label, count }) => `${count} ${label} ${count === 1 ? "start" : "starts"} failed`);
392
+ }
393
+ function workerLanes(events, clock) {
394
+ const reported = events.filter(
395
+ (event) => event.kind !== "test-result" && "worker" in event && event.worker !== void 0
396
+ );
397
+ const lanes = lanesOf(reported, clock.runStartedAt - clock.offsetMs);
398
+ if (lanes.length === 0) return [];
399
+ let first = Infinity;
400
+ let last = -Infinity;
401
+ for (const lane of lanes) {
402
+ first = Math.min(first, lane.startMs);
403
+ last = Math.max(last, lane.endMs);
404
+ }
405
+ const { startMs, endMs } = clock.tests;
406
+ const shift = first < startMs ? startMs - first : last > endMs ? Math.max(startMs - first, endMs - last) : 0;
407
+ const within = (ms) => Math.min(Math.max(ms + shift, startMs), endMs);
408
+ const moved = (span) => ({ ...span, startMs: within(span.startMs), endMs: within(span.endMs) });
409
+ const names = fileNames(lanes.flatMap((lane) => lane.files.map((run) => run.file)));
410
+ return lanes.map((lane) => ({
411
+ ...moved(lane),
412
+ files: lane.files.map((run) => ({ ...moved(run), name: names.get(run.file) ?? run.file })),
413
+ setups: lane.setups.map(moved)
414
+ }));
415
+ }
416
+ function workerLanesFromRecords(records) {
417
+ const names = fileNames(records.flatMap((record) => record.files.map((run) => run.file)));
418
+ return records.map((record) => ({
419
+ worker: record.worker,
420
+ startMs: record.startMs,
421
+ endMs: record.endMs,
422
+ tests: record.tests,
423
+ files: record.files.map((run) => ({
424
+ file: run.file,
425
+ name: names.get(run.file) ?? run.file,
426
+ startMs: run.startMs,
427
+ endMs: run.endMs
428
+ })),
429
+ setups: record.setups.map((setup) => ({
430
+ label: setup.label,
431
+ resource: setup.resource,
432
+ startMs: setup.startMs,
433
+ endMs: setup.endMs,
434
+ ok: setup.ok,
435
+ ...setup.setupMs === null ? {} : { setupMs: setup.setupMs },
436
+ ...setup.warmupMs === null ? {} : { warmupMs: setup.warmupMs }
437
+ }))
438
+ }));
439
+ }
440
+ function fileNames(files) {
441
+ const distinct = [...new Set(files)];
442
+ const parts = new Map(distinct.map((file) => [file, file.split("/").filter((part) => part !== "")]));
443
+ const names = /* @__PURE__ */ new Map();
444
+ for (const file of distinct) {
445
+ const own = parts.get(file) ?? [file];
446
+ for (let depth = 1; depth <= own.length; depth += 1) {
447
+ const name = own.slice(-depth).join("/");
448
+ const shared = distinct.some(
449
+ (other) => other !== file && (parts.get(other) ?? []).slice(-depth).join("/") === name
450
+ );
451
+ if (!shared || depth === own.length) {
452
+ names.set(file, name);
453
+ break;
454
+ }
455
+ }
456
+ }
457
+ return names;
458
+ }
459
+ function mergeSpans(spans) {
460
+ const positive = spans.filter((span) => span.endMs > span.startMs).toSorted((a, b) => a.startMs - b.startMs || a.endMs - b.endMs);
461
+ const merged = [];
462
+ for (const span of positive) {
463
+ const previous = merged.at(-1);
464
+ if (previous === void 0 || span.startMs > previous.endMs) merged.push({ ...span });
465
+ else if (span.endMs > previous.endMs) merged[merged.length - 1] = { startMs: previous.startMs, endMs: span.endMs };
466
+ }
467
+ return merged;
468
+ }
469
+ function subtractSpans(base, subtract) {
470
+ if (base.length === 0 || subtract.length === 0) return [...base];
471
+ const result = [];
472
+ for (const interval of base) {
473
+ let cursor = interval.startMs;
474
+ for (const cut of subtract) {
475
+ if (cut.endMs <= cursor) continue;
476
+ if (cut.startMs >= interval.endMs) break;
477
+ if (cut.startMs > cursor) result.push({ startMs: cursor, endMs: cut.startMs });
478
+ cursor = Math.max(cursor, cut.endMs);
479
+ if (cursor >= interval.endMs) break;
480
+ }
481
+ if (cursor < interval.endMs) result.push({ startMs: cursor, endMs: interval.endMs });
482
+ }
483
+ return result;
484
+ }
485
+ function activeSpans(lane) {
486
+ return subtractSpans(mergeSpans(lane.files), mergeSpans(lane.setups));
487
+ }
488
+ function workerSetupMs(lane) {
489
+ return mergeSpans(lane.setups).reduce((sum, span) => sum + (span.endMs - span.startMs), 0);
490
+ }
491
+ function workerParallelism(lanes, tests) {
492
+ if (lanes.length === 0) return void 0;
493
+ const testsWallMs = Math.max(0, tests.endMs - tests.startMs);
494
+ const active = lanes.flatMap(activeSpans);
495
+ const totalActiveMs = active.reduce((sum, span) => sum + (span.endMs - span.startMs), 0);
496
+ const avgConcurrency = testsWallMs > 0 ? totalActiveMs / testsWallMs : 0;
497
+ const edges = [];
498
+ for (const span of active) {
499
+ edges.push({ at: span.startMs, delta: 1 }, { at: span.endMs, delta: -1 });
500
+ }
501
+ edges.sort((a, b) => a.at - b.at || a.delta - b.delta);
502
+ let current = 0;
503
+ let peakConcurrency = 0;
504
+ for (const edge of edges) {
505
+ current += edge.delta;
506
+ if (current > peakConcurrency) peakConcurrency = current;
507
+ }
508
+ const byFinish = [...lanes].toSorted((a, b) => b.endMs - a.endMs || a.worker - b.worker);
509
+ const [last, secondLast] = byFinish;
510
+ if (last === void 0) return void 0;
511
+ const singleWorkerTailMs = secondLast === void 0 ? 0 : Math.max(0, last.endMs - secondLast.endMs);
512
+ let chosenFile = last.files[0];
513
+ for (const run of last.files) {
514
+ if (chosenFile === void 0 || run.endMs - run.startMs >= chosenFile.endMs - chosenFile.startMs) chosenFile = run;
515
+ }
516
+ return {
517
+ workerCount: lanes.length,
518
+ testsWallMs,
519
+ totalActiveMs,
520
+ avgConcurrency,
521
+ peakConcurrency,
522
+ singleWorkerTailMs,
523
+ waitedOn: {
524
+ worker: last.worker,
525
+ file: chosenFile?.file ?? "",
526
+ fileName: chosenFile?.name ?? "",
527
+ fileDurationMs: chosenFile === void 0 ? 0 : chosenFile.endMs - chosenFile.startMs,
528
+ fileCount: last.files.length,
529
+ durationMs: last.endMs - last.startMs,
530
+ setupMs: workerSetupMs(last)
531
+ }
532
+ };
533
+ }
534
+ function hasPoorParallelism(parallelism) {
535
+ if (parallelism.workerCount <= 1 || parallelism.testsWallMs <= 0) return false;
536
+ if (parallelism.singleWorkerTailMs / parallelism.testsWallMs >= 0.2) return true;
537
+ if (parallelism.peakConcurrency > 0 && parallelism.avgConcurrency / parallelism.peakConcurrency < 0.5) return true;
538
+ return false;
539
+ }
540
+ function sparklineLabel(lanes) {
541
+ return `${INDENT}workers (${lanes.length})`;
542
+ }
543
+ function sparklineLabelWidth(lanes) {
544
+ return sparklineLabel(lanes).length + 1;
545
+ }
546
+ function sparklineTailText(parallelism) {
547
+ const avg = `${parallelism.avgConcurrency.toFixed(1)}\xD7 avg`;
548
+ return parallelism.workerCount === 1 ? ` ${avg}` : ` ${avg} \xB7 peak ${parallelism.peakConcurrency}`;
549
+ }
550
+ function sparklineTailWidth(lanes, tests) {
551
+ const parallelism = workerParallelism(lanes, tests);
552
+ return parallelism === void 0 ? 0 : sparklineTailText(parallelism).length + 1;
553
+ }
554
+ function sparklineBreakdownText(parallelism, room) {
555
+ const { waitedOn, workerCount, singleWorkerTailMs } = parallelism;
556
+ const more = waitedOn.fileCount > 1 ? ` +${waitedOn.fileCount - 1}` : "";
557
+ const tailSuffix = workerCount > 1 && singleWorkerTailMs >= 1e3 ? ` \xB7 1-worker tail ${seconds(singleWorkerTailMs)}` : "";
558
+ const prefix = `waited on w${waitedOn.worker} (`;
559
+ const fileSuffix = ` ${seconds(waitedOn.fileDurationMs)}${more})${tailSuffix}`;
560
+ const full = `${prefix}${waitedOn.fileName}${fileSuffix}`;
561
+ if (full.length <= room) return full;
562
+ const nameRoom = room - prefix.length - fileSuffix.length;
563
+ if (nameRoom >= 1) return `${prefix}${shortened(waitedOn.fileName, nameRoom)}${fileSuffix}`;
564
+ return truncate(full, room);
565
+ }
566
+ function overlapMs(span, startMs, endMs) {
567
+ return Math.max(0, Math.min(span.endMs, endMs) - Math.max(span.startMs, startMs));
568
+ }
569
+ function workerSparklineLines(lanes, tests, layout) {
570
+ const parallelism = workerParallelism(lanes, tests);
571
+ if (parallelism === void 0) return [];
572
+ const { labelWidth, column, width, paint: paint2 } = layout;
573
+ const startCol = column(tests.startMs);
574
+ const endCol = Math.max(startCol, column(tests.endMs));
575
+ const spanCols = endCol - startCol;
576
+ const laneActives = lanes.map(activeSpans);
577
+ const laneSetups = lanes.map((lane) => mergeSpans(lane.setups));
578
+ const bucketMs = spanCols > 0 ? (tests.endMs - tests.startMs) / spanCols : 0;
579
+ const maxScale = Math.max(lanes.length, 1);
580
+ const cells = [];
581
+ for (let col = 0; col < spanCols; col += 1) {
582
+ const bucketStart = tests.startMs + col * bucketMs;
583
+ const bucketEnd = tests.startMs + (col + 1) * bucketMs;
584
+ let activeOverlap = 0;
585
+ for (const spans of laneActives) {
586
+ for (const span of spans) activeOverlap += overlapMs(span, bucketStart, bucketEnd);
587
+ }
588
+ const v = bucketMs > 0 ? activeOverlap / bucketMs : 0;
589
+ if (v > 0) {
590
+ const ratio = Math.min(1, v / maxScale);
591
+ const level = Math.min(SPARK_GLYPHS.length - 1, Math.max(0, Math.ceil(ratio * SPARK_GLYPHS.length - 1e-9) - 1));
592
+ cells.push({ kind: "active", glyph: SPARK_GLYPHS[level] ?? "\u2581" });
593
+ } else {
594
+ const inSetup = laneSetups.some((spans) => spans.some((span) => overlapMs(span, bucketStart, bucketEnd) > 0));
595
+ cells.push(inSetup ? { kind: "setup", glyph: "\u2591" } : { kind: "empty", glyph: " " });
596
+ }
597
+ }
598
+ let sparkBar = "";
599
+ let index = 0;
600
+ while (index < cells.length) {
601
+ const kind = cells[index]?.kind ?? "empty";
602
+ let end = index + 1;
603
+ let run = cells[index]?.glyph ?? " ";
604
+ while (end < cells.length && cells[end]?.kind === kind) {
605
+ run += cells[end]?.glyph ?? " ";
606
+ end += 1;
607
+ }
608
+ if (kind === "active") sparkBar += paint2.waitedOn(run);
609
+ else if (kind === "setup") sparkBar += paint2.muted(run);
610
+ else sparkBar += run;
611
+ index = end;
612
+ }
613
+ const head = `${sparklineLabel(lanes).padEnd(labelWidth)}${" ".repeat(startCol)}`;
614
+ const tail = sparklineTailText(parallelism);
615
+ const line = `${head}${sparkBar}\u258F${tail}`;
616
+ const plainWidth = head.length + spanCols + 1 + tail.length;
617
+ const sameLine = sparklineBreakdownText(parallelism, width);
618
+ if (plainWidth + 3 + sameLine.length <= width) return [`${line} ${sameLine}`];
619
+ return [line, `${" ".repeat(labelWidth)}${sparklineBreakdownText(parallelism, width - labelWidth)}`];
620
+ }
621
+ function workerLabelWidth(lanes, width) {
622
+ const digits = digitsOf(lanes);
623
+ const most = labelRoom(width);
624
+ let widest = 0;
625
+ for (const lane of shownLanes(lanes)) widest = Math.max(widest, labelText(lane, digits, most).length);
626
+ return widest + 1;
627
+ }
628
+ function labelRoom(width) {
629
+ return Math.min(MAX_LABEL_WIDTH, Math.floor(width * MAX_LABEL_SHARE));
630
+ }
631
+ function workerLaneLines(lanes, layout) {
632
+ const shown = shownLanes(lanes);
633
+ const digits = digitsOf(lanes);
634
+ let lastMs = -Infinity;
635
+ for (const lane of lanes) lastMs = Math.max(lastMs, lane.endMs);
636
+ const lines = shown.flatMap((lane) => laneLines(lane, digits, layout, lane.endMs === lastMs));
637
+ const shownSet = new Set(shown);
638
+ const hidden = lanes.filter((lane) => !shownSet.has(lane));
639
+ if (hidden.length > 0) {
640
+ let doneMs = -Infinity;
641
+ for (const lane of hidden) doneMs = Math.max(doneMs, lane.endMs - lane.startMs);
642
+ lines.push(
643
+ `${" ".repeat(layout.labelWidth)}+${hidden.length} earlier ${hidden.length === 1 ? "worker" : "workers"}, each done within ${seconds(doneMs)}`
644
+ );
645
+ }
646
+ return lines;
647
+ }
648
+ function lanesOf(events, origin) {
649
+ const byWorker = /* @__PURE__ */ new Map();
650
+ for (const event of events) {
651
+ const own = byWorker.get(event.worker);
652
+ if (own === void 0) byWorker.set(event.worker, [event]);
653
+ else own.push(event);
654
+ }
655
+ const lanes = [];
656
+ for (const [worker, own] of [...byWorker].toSorted(([a], [b]) => a - b)) {
657
+ const files = [];
658
+ const setups = [];
659
+ const tests = /* @__PURE__ */ new Set();
660
+ const openFiles = /* @__PURE__ */ new Map();
661
+ const settingUp = /* @__PURE__ */ new Map();
662
+ const phase = (event) => `${event.file}\0${setupPhaseKey(event)}`;
663
+ let lastMs = -Infinity;
664
+ for (const event of own) {
665
+ const atMs = event.at - origin;
666
+ lastMs = Math.max(lastMs, atMs);
667
+ switch (event.kind) {
668
+ case "file-started":
669
+ openFiles.set(event.file, atMs);
670
+ break;
671
+ case "file-finished": {
672
+ const startMs2 = openFiles.get(event.file);
673
+ if (startMs2 !== void 0) files.push({ file: event.file, startMs: startMs2, endMs: atMs });
674
+ openFiles.delete(event.file);
675
+ break;
676
+ }
677
+ case "setup-started":
678
+ settingUp.set(phase(event), { startMs: atMs, label: event.label, resource: event.resource });
679
+ break;
680
+ case "setup-finished":
681
+ setups.push({
682
+ startMs: atMs - event.ms - (event.warmupMs ?? 0),
683
+ endMs: atMs,
684
+ ok: event.ok,
685
+ label: event.label,
686
+ resource: event.resource,
687
+ setupMs: event.ms,
688
+ ...event.warmupMs === void 0 ? {} : { warmupMs: event.warmupMs }
689
+ });
690
+ settingUp.delete(phase(event));
691
+ break;
692
+ case "test-started":
693
+ tests.add(event.id);
694
+ break;
695
+ case "test-attempt-finished":
696
+ break;
697
+ }
698
+ }
699
+ for (const [file, startMs2] of openFiles) files.push({ file, startMs: startMs2, endMs: lastMs });
700
+ for (const setup of settingUp.values()) setups.push({ ...setup, endMs: lastMs, ok: true });
701
+ if (files.length === 0) continue;
702
+ files.sort((a, b) => a.startMs - b.startMs);
703
+ let startMs = Infinity;
704
+ let endMs = -Infinity;
705
+ for (const run of files) {
706
+ startMs = Math.min(startMs, run.startMs);
707
+ endMs = Math.max(endMs, run.endMs);
708
+ }
709
+ lanes.push({
710
+ worker,
711
+ files: files.map((run) => ({ ...run, name: run.file })),
712
+ setups,
713
+ startMs,
714
+ endMs,
715
+ tests: tests.size
716
+ });
717
+ }
718
+ return lanes;
719
+ }
720
+ function shownLanes(lanes) {
721
+ return [...lanes].toSorted((a, b) => b.endMs - a.endMs || a.worker - b.worker).slice(0, MAX_WORKER_ROWS);
722
+ }
723
+ function digitsOf(lanes) {
724
+ let worker = 0;
725
+ for (const lane of lanes) worker = Math.max(worker, lane.worker);
726
+ return String(worker).length;
727
+ }
728
+ function labelText(lane, digits, room) {
729
+ const [first] = lane.files;
730
+ const more = lane.files.length > 1 ? ` +${lane.files.length - 1}` : "";
731
+ const head = `${INDENT}w${String(lane.worker).padEnd(digits)} `;
732
+ const name = first?.name ?? "";
733
+ return `${head}${shortened(name, Math.max(1, room - head.length - more.length))}${more}`;
734
+ }
735
+ function shortened(name, room) {
736
+ if (name.length <= room) return name;
737
+ const extension = /(\.(test|spec))?\.[cm]?[jt]sx?$/.exec(name)?.[0] ?? "";
738
+ const stemRoom = room - extension.length - 1;
739
+ if (extension === "" || stemRoom < 1) return truncate(name, room);
740
+ return `${name.slice(0, stemRoom)}\u2026${extension}`;
741
+ }
742
+ function tailText(lane) {
743
+ const tests = lane.tests === 0 ? "" : ` \xB7 ${lane.tests} ${lane.tests === 1 ? "test" : "tests"}`;
744
+ return ` ${seconds(lane.endMs - lane.startMs)}${tests}`;
745
+ }
746
+ function workerTailWidth(lanes) {
747
+ let widest = 0;
748
+ for (const lane of shownLanes(lanes)) widest = Math.max(widest, tailText(lane).length);
749
+ return widest + 1;
750
+ }
751
+ var GLYPH = { file: "\u2588", "next-file": "\u2593", setup: "\u2591", "failed-setup": "\xD7" };
752
+ function laneLines(lane, digits, layout, waitedOn) {
753
+ const { labelWidth, column, width, paint: paint2 } = layout;
754
+ const startColumn = column(lane.startMs);
755
+ const endColumn = Math.max(startColumn, column(lane.endMs));
756
+ const cells = Array.from({ length: endColumn }, () => void 0);
757
+ const fill = (span, cell2, atLeastOne = false) => {
758
+ const from = Math.min(Math.max(column(span.startMs), startColumn), endColumn);
759
+ const to = Math.min(Math.max(column(span.endMs), atLeastOne ? from + 1 : from), endColumn);
760
+ for (let index = from; index < to; index += 1) cells[index] = cell2;
761
+ };
762
+ lane.files.forEach((run, index) => fill(run, index % 2 === 0 ? "file" : "next-file"));
763
+ for (const setup of lane.setups) fill(setup, setup.ok ? "setup" : "failed-setup", !setup.ok);
764
+ const label = labelText(lane, digits, Math.min(labelWidth - 1, labelRoom(width))).padEnd(labelWidth);
765
+ const text = tailText(lane);
766
+ const line = `${label}${paintedBar(cells, paint2, waitedOn)}\u258F${text}`;
767
+ const laneSetupMs = workerSetupMs(lane);
768
+ const setupPart = laneSetupMs > 0 ? `setup ${seconds(laneSetupMs)}` : void 0;
769
+ const fileParts = lane.files.length > 1 ? lane.files.map((run) => `${run.name} ${seconds(run.endMs - run.startMs)}`) : [];
770
+ if (fileParts.length === 0 && setupPart === void 0) return [line];
771
+ const plainWidth = label.length + cells.length + 1 + text.length;
772
+ const sameLine = [...fileParts, ...setupPart === void 0 ? [] : [setupPart]].join(" \xB7 ");
773
+ if (plainWidth + 3 + visibleLength(sameLine) <= width) return [`${line} ${sameLine}`];
774
+ if (!waitedOn) return [line];
775
+ return [line, `${" ".repeat(labelWidth)}${fittingBreakdown(fileParts, setupPart, width - labelWidth)}`];
776
+ }
777
+ function paintedBar(cells, paint2, waitedOn) {
778
+ let text = "";
779
+ let index = 0;
780
+ while (index < cells.length) {
781
+ const cell2 = cells[index];
782
+ let end = index + 1;
783
+ while (end < cells.length && cells[end] === cell2) end += 1;
784
+ const run = cell2 === void 0 ? " ".repeat(end - index) : GLYPH[cell2].repeat(end - index);
785
+ if (cell2 === "setup") text += paint2.muted(run);
786
+ else if (cell2 === "failed-setup") text += paint2.failed(run);
787
+ else if (cell2 !== void 0) text += waitedOn ? paint2.waitedOn(run) : paint2.muted(run);
788
+ else text += run;
789
+ index = end;
790
+ }
791
+ return text;
792
+ }
793
+ function fittingBreakdown(names, setupPart, room) {
794
+ if (names.length === 0) return setupPart === void 0 ? "" : truncate(setupPart, room);
795
+ const suffix = setupPart === void 0 ? [] : [setupPart];
796
+ for (let count = names.length; count > 0; count -= 1) {
797
+ const kept = [
798
+ ...names.slice(0, count),
799
+ ...count < names.length ? [`+${names.length - count} more`] : [],
800
+ ...suffix
801
+ ];
802
+ const text = kept.join(" \xB7 ");
803
+ if (visibleLength(text) <= room) return text;
804
+ }
805
+ if (setupPart !== void 0) {
806
+ const withSetup = `+${names.length} more \xB7 ${setupPart}`;
807
+ if (visibleLength(withSetup) <= room) return withSetup;
808
+ for (let count = names.length; count > 0; count -= 1) {
809
+ const kept = [...names.slice(0, count), ...count < names.length ? [`+${names.length - count} more`] : []];
810
+ const text = kept.join(" \xB7 ");
811
+ if (visibleLength(text) <= room) return text;
812
+ }
813
+ }
814
+ return `+${names.length} more`;
815
+ }
816
+
817
+ // src/shared/waterfall.ts
818
+ var LANE_LABELS = [
819
+ "credential",
820
+ "runner-setup",
821
+ "command",
822
+ "cleanup",
823
+ ...DEFINITION_SET.presentations.laneKinds.map(({ label }) => label)
824
+ ];
825
+ function criticalPathStep(step, timeline) {
826
+ const row = timeline.rows.find((candidate) => sameRow(candidate, step));
827
+ const label = row?.label ?? step.name;
828
+ return row?.snapshot === void 0 ? label : `${label} (snapshot ${row.snapshot})`;
829
+ }
830
+ var LABEL_WIDTH = Math.max(...LANE_LABELS.map((label) => label.length)) + 2;
831
+ var TAIL_WIDTH = 14;
832
+ var AXIS_STEPS = [1, 2, 5, 10, 15, 20, 30, 60, 120, 300, 600, 900, 1800, 3600, 7200];
833
+ var SWATCHES = {
834
+ setup: { rgb: [104, 166, 248], x256: 75, x16: "94" },
835
+ // #68a6f8
836
+ command: { rgb: [122, 190, 122], x256: 114, x16: "92" },
837
+ // #7abe7a
838
+ failed: { rgb: [229, 105, 108], x256: 167, x16: "91" },
839
+ // #e5696c
840
+ stopped: PALETTE.warn,
841
+ // #d29922
842
+ muted: PALETTE.muted
843
+ // #8b949e
844
+ };
845
+ function swatchPainter(colorDepth) {
846
+ if (colorDepth === "none") return (_swatch, text) => text;
847
+ const caps = { isTty: true, colorDepth, columns: 80, canRenderUnicode: true };
848
+ return (swatch, text) => text === "" ? text : paintSwatch(caps, SWATCHES[swatch], text);
849
+ }
850
+ function waterfallLines(timeline, extras) {
851
+ const paint2 = swatchPainter(extras.colorDepth ?? "none");
852
+ const width = Math.max(60, extras.width);
853
+ const workers = extras.workers ?? [];
854
+ const workerView = extras.workerView ?? "sparkline";
855
+ const commandRow = timeline.rows.find((row) => row.name === "command");
856
+ const hasWorkers = workers.length > 0 && commandRow !== void 0;
857
+ const labelWidth = Math.max(
858
+ LABEL_WIDTH,
859
+ ...timeline.rows.map(({ label }) => label.length + 2),
860
+ hasWorkers ? Math.max(sparklineLabelWidth(workers), workerView === "lanes" ? workerLabelWidth(workers, width) : 0) : 0
861
+ );
862
+ const tailWidth = Math.max(
863
+ TAIL_WIDTH,
864
+ hasWorkers ? Math.max(sparklineTailWidth(workers, commandRow), workerView === "lanes" ? workerTailWidth(workers) : 0) : 0
865
+ );
866
+ const barWidth = Math.max(1, width - labelWidth - tailWidth);
867
+ const total = Math.max(timeline.totalMs, 1);
868
+ const column = (ms) => Math.round(ms / total * barWidth);
869
+ const lines = [];
870
+ if (timeline.rows.length > 0) {
871
+ lines.push(paint2("muted", axis(total, labelWidth, barWidth, tailWidth, column)));
872
+ for (const row of timeline.rows) {
873
+ const swatch = rowSwatch(row);
874
+ lines.push(...rowLines(row, swatch, { labelWidth, column, width, paint: paint2 }));
875
+ if (row.name === "command" && workers.length > 0) {
876
+ const workerLayout = {
877
+ labelWidth,
878
+ column,
879
+ width,
880
+ paint: {
881
+ waitedOn: (text) => paint2(swatch, text),
882
+ failed: (text) => paint2("failed", text),
883
+ muted: (text) => paint2("muted", text)
884
+ }
885
+ };
886
+ lines.push(...workerSparklineLines(workers, row, workerLayout));
887
+ if (workerView === "lanes") lines.push(...workerLaneLines(workers, workerLayout));
888
+ }
889
+ }
890
+ }
891
+ if (timeline.criticalPath.length > 0)
892
+ lines.push(` critical path: ${timeline.criticalPath.map((step) => criticalPathStep(step, timeline)).join(" \u2192 ")}`);
893
+ lines.push(...extras.details ?? []);
894
+ if (extras.logs !== void 0) lines.push(` logs ${extras.logs}`);
895
+ return lines;
896
+ }
897
+ function axis(total, labelWidth, barWidth, tailWidth, column) {
898
+ const stepSeconds = AXIS_STEPS.find((candidate) => candidate * 1e3 * barWidth / total >= 10) ?? AXIS_STEPS.at(-1) ?? 1;
899
+ const cells = Array.from({ length: barWidth + tailWidth }, () => " ");
900
+ for (let at = 0; at * 1e3 <= total; at += stepSeconds) {
901
+ const label = stepSeconds >= 60 ? `${at / 60}m` : `${at}s`;
902
+ const start = column(at * 1e3);
903
+ if (start + label.length > cells.length) break;
904
+ for (let index = 0; index < label.length; index += 1) cells[start + index] = label[index] ?? " ";
905
+ }
906
+ return `${" ".repeat(labelWidth)}${cells.join("").trimEnd()}`;
907
+ }
908
+ function rowSwatch(row) {
909
+ if (row.outcome === "failed") return "failed";
910
+ if (row.outcome === "stopped" || row.outcome === "unfinished") return "stopped";
911
+ if (row.name === "command") return "command";
912
+ if (row.name === "runner" || row.resource !== null) return "setup";
913
+ return "muted";
914
+ }
915
+ function rowLines(row, swatch, layout) {
916
+ const { labelWidth, column, width, paint: paint2 } = layout;
917
+ const start = column(row.startMs);
918
+ const end = Math.max(start, column(row.endMs));
919
+ const idleEnd = Math.max(end, column(row.endMs + row.idleMs));
920
+ const bar = "\u2588".repeat(end - start);
921
+ const idle = "\u2591".repeat(idleEnd - end);
922
+ const outcome = row.outcome === "done" ? "" : ` ${paint2(swatch, row.outcome)}`;
923
+ const idleText = row.idleMs > 0 ? ` \xB7 idle ${seconds(row.idleMs)}` : "";
924
+ const head = `${` ${row.label}`.padEnd(labelWidth)}${" ".repeat(start)}`;
925
+ const text = ` ${seconds(row.endMs - row.startMs)}${idleText}${outcome}`;
926
+ const line = `${head}${paint2(swatch, bar)}${paint2("muted", idle)}\u258F${text}`;
927
+ const breakdown = breakdownText(row);
928
+ if (breakdown === "") return [line];
929
+ const plainWidth = head.length + bar.length + idle.length + 1 + visibleLength(text);
930
+ if (plainWidth + 3 + breakdown.length <= width) return [`${line} ${breakdown}`];
931
+ return [line, `${" ".repeat(labelWidth)}${breakdown}`];
932
+ }
933
+ function breakdownText(row) {
934
+ const steps = row.steps.map(
935
+ (step) => `${step.name} ${seconds(step.endMs - step.startMs)}${step.bytes === void 0 ? "" : ` (${megabytesText(step.bytes)})`}${step.outcome === "done" ? "" : ` ${step.outcome}`}`
936
+ );
937
+ if (row.sandboxes === void 0) return steps.join(" \xB7 ");
938
+ const counts = `${row.sandboxes.reused} reused, ${row.sandboxes.created} created`;
939
+ return [counts, ...steps.length > 1 ? steps : []].join(" \xB7 ");
940
+ }
941
+
942
+ export {
943
+ dealFileLists,
944
+ comparedPath,
945
+ fileListMismatches,
946
+ fileListMismatchText,
947
+ RESOURCE_FLAG_HELP,
948
+ RESOURCE_USAGE_FLAGS,
949
+ resourceRunExamples,
950
+ resourceFlagFields,
951
+ resourceFlagProblems,
952
+ resourceFlagValues,
953
+ recordedPlan,
954
+ testPlanLine,
955
+ testPlanText,
956
+ testsSummaryLines,
957
+ testsChart,
958
+ workerLaneNotes,
959
+ workerLanes,
960
+ workerLanesFromRecords,
961
+ workerSetupMs,
962
+ workerParallelism,
963
+ hasPoorParallelism,
964
+ criticalPathStep,
965
+ waterfallLines
966
+ };