@cnc-tools/storm 0.9.1 → 0.11.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 (731) hide show
  1. package/bin/storm.js +11 -2
  2. package/dist/application.d.ts +5 -5
  3. package/dist/application.js +11 -9
  4. package/dist/bin/storm.js +32 -20
  5. package/dist/build-info.js +1 -1
  6. package/dist/chunks/chunk-3ZZVZPMG.js +10 -0
  7. package/dist/chunks/{chunk-WV6WQFC6.js → chunk-4EU4AH7E.js} +150 -26
  8. package/dist/chunks/chunk-4PRAB24Y.js +4400 -0
  9. package/dist/chunks/chunk-AMTYHUYB.js +257 -0
  10. package/dist/chunks/chunk-ETCZ6WP7.js +431 -0
  11. package/dist/chunks/chunk-FVMQKYTT.js +10 -0
  12. package/dist/chunks/chunk-GRMD7G4J.js +1267 -0
  13. package/dist/chunks/chunk-ICB4BZJX.js +22 -0
  14. package/dist/chunks/chunk-KR7WIYLG.js +2184 -0
  15. package/dist/chunks/chunk-L4ZPMSKQ.js +808 -0
  16. package/dist/chunks/chunk-NPPJ57W7.js +569 -0
  17. package/dist/chunks/chunk-O4BUT7BE.js +3361 -0
  18. package/dist/chunks/chunk-OJOKQRM6.js +1457 -0
  19. package/dist/chunks/chunk-SLNKW4ZM.js +40 -0
  20. package/dist/chunks/chunk-TRFEAYNC.js +1952 -0
  21. package/dist/chunks/chunk-VZZTHCBW.js +93 -0
  22. package/dist/chunks/chunk-WNIQA5J6.js +19 -0
  23. package/dist/chunks/chunk-WSIF7SR6.js +10 -0
  24. package/dist/chunks/{live-app-X3PW2W42.js → live-app-LOGYUBKB.js} +73 -20
  25. package/dist/command-tree.d.ts +3 -0
  26. package/dist/command-tree.js +3 -0
  27. package/dist/commands/dashboard.d.ts +1 -1
  28. package/dist/commands/dashboard.js +1 -1
  29. package/dist/commands/exec/cleanup.d.ts +28 -44
  30. package/dist/commands/exec/cleanup.js +25 -55
  31. package/dist/commands/exec/command.d.ts +73 -545
  32. package/dist/commands/exec/command.js +65 -25
  33. package/dist/commands/exec/job-summary.d.ts +2 -2
  34. package/dist/commands/exec/job-summary.js +3 -3
  35. package/dist/commands/exec/live-view.d.ts +9 -9
  36. package/dist/commands/exec/live-view.js +49 -42
  37. package/dist/commands/exec/metadata.d.ts +0 -65
  38. package/dist/commands/exec/metadata.js +2 -61
  39. package/dist/commands/exec/mint-failed.d.ts +1 -1
  40. package/dist/commands/exec/mint-failed.js +8 -8
  41. package/dist/commands/exec/outcomes.d.ts +63 -468
  42. package/dist/commands/exec/outcomes.js +47 -75
  43. package/dist/commands/exec/plan-run.d.ts +148 -0
  44. package/dist/commands/exec/plan-run.js +121 -0
  45. package/dist/commands/exec/progress.d.ts +26 -16
  46. package/dist/commands/exec/progress.js +63 -42
  47. package/dist/commands/exec/redaction.d.ts +3 -3
  48. package/dist/commands/exec/redaction.js +4 -4
  49. package/dist/commands/exec/resource-flags.d.ts +50 -0
  50. package/dist/commands/exec/resource-flags.js +125 -0
  51. package/dist/commands/exec/resource-refusals.d.ts +64 -0
  52. package/dist/commands/exec/resource-refusals.js +58 -0
  53. package/dist/commands/exec/run-command.d.ts +87 -167
  54. package/dist/commands/exec/run-command.js +296 -418
  55. package/dist/commands/exec/run-metadata.d.ts +20 -43
  56. package/dist/commands/exec/run-metadata.js +18 -37
  57. package/dist/commands/exec/test-plan.d.ts +11 -0
  58. package/dist/commands/exec/test-plan.js +39 -0
  59. package/dist/commands/exec/tests-summary.d.ts +5 -5
  60. package/dist/commands/exec/tests-summary.js +2 -2
  61. package/dist/commands/exec/text.d.ts +8 -2
  62. package/dist/commands/exec/text.js +8 -0
  63. package/dist/commands/exec/view.d.ts +5 -7
  64. package/dist/commands/exec/view.js +22 -14
  65. package/dist/commands/exec/waterfall.d.ts +4 -9
  66. package/dist/commands/exec/waterfall.js +22 -26
  67. package/dist/commands/exec/worker-chart.d.ts +1 -1
  68. package/dist/commands/ext/metadata.d.ts +4 -0
  69. package/dist/commands/ext/metadata.js +8 -0
  70. package/dist/commands/runs/facts.d.ts +11 -6
  71. package/dist/commands/runs/facts.js +27 -15
  72. package/dist/commands/runs/list/command.d.ts +15 -8
  73. package/dist/commands/runs/list/command.js +39 -32
  74. package/dist/commands/runs/list/metadata.d.ts +16 -14
  75. package/dist/commands/runs/list/metadata.js +17 -15
  76. package/dist/commands/runs/list/outcomes.d.ts +6 -2
  77. package/dist/commands/runs/logs/command.d.ts +3 -4
  78. package/dist/commands/runs/logs/command.js +46 -41
  79. package/dist/commands/runs/logs/metadata.d.ts +17 -15
  80. package/dist/commands/runs/logs/metadata.js +20 -18
  81. package/dist/commands/runs/past-run.d.ts +3 -33
  82. package/dist/commands/runs/past-run.js +3 -52
  83. package/dist/commands/runs/show/command.d.ts +57 -42
  84. package/dist/commands/runs/show/command.js +93 -82
  85. package/dist/commands/runs/show/metadata.d.ts +20 -18
  86. package/dist/commands/runs/show/metadata.js +20 -18
  87. package/dist/commands/runs/show/outcomes.d.ts +27 -19
  88. package/dist/commands/runs/show/outcomes.js +8 -6
  89. package/dist/commands/vitest/command.d.ts +95 -560
  90. package/dist/commands/vitest/command.js +84 -100
  91. package/dist/commands/vitest/metadata.d.ts +0 -65
  92. package/dist/commands/vitest/metadata.js +2 -41
  93. package/dist/commands/vitest/outcomes.d.ts +44 -274
  94. package/dist/commands/vitest/outcomes.js +7 -14
  95. package/dist/config/credential-resolver.d.ts +134 -0
  96. package/dist/config/credential-resolver.js +70 -0
  97. package/dist/{credential/settle.d.ts → config/credential-settle.d.ts} +1 -2
  98. package/dist/config/errors.d.ts +1 -1
  99. package/dist/config/errors.js +5 -5
  100. package/dist/config/index.d.ts +7 -6
  101. package/dist/config/index.js +13 -9
  102. package/dist/config/load.d.ts +16 -13
  103. package/dist/config/load.js +55 -40
  104. package/dist/config/recipe-run.d.ts +26 -0
  105. package/dist/config/recipe-run.js +27 -0
  106. package/dist/config/resolve.d.ts +103 -15
  107. package/dist/config/resolve.js +137 -47
  108. package/dist/config/resolver.d.ts +40 -0
  109. package/dist/config/resolver.js +31 -0
  110. package/dist/config/schema.d.ts +13 -17
  111. package/dist/config/schema.js +14 -35
  112. package/dist/config/settings-file.d.ts +28 -16
  113. package/dist/config/settings-file.js +39 -24
  114. package/dist/config/typed-options.d.ts +21 -0
  115. package/dist/config/typed-options.js +28 -0
  116. package/dist/config-file/define.d.ts +33 -31
  117. package/dist/config-file/define.js +14 -4
  118. package/dist/config-file/toolchain.d.ts +1 -1
  119. package/dist/context.d.ts +60 -29
  120. package/dist/context.js +32 -13
  121. package/dist/core/before-run.d.ts +38 -0
  122. package/dist/core/before-run.js +44 -0
  123. package/dist/core/definition-lookup.d.ts +22 -0
  124. package/dist/core/definition-lookup.js +34 -0
  125. package/dist/core/events.d.ts +59 -64
  126. package/dist/core/gateways.d.ts +23 -164
  127. package/dist/core/index.d.ts +14 -15
  128. package/dist/core/index.js +13 -11
  129. package/dist/core/launcher-supplies.d.ts +11 -0
  130. package/dist/core/launcher-supplies.js +28 -0
  131. package/dist/core/live/terminal-command-gateway.d.ts +8 -0
  132. package/dist/core/live/terminal-command-gateway.js +49 -0
  133. package/dist/core/payload.d.ts +13 -14
  134. package/dist/core/payload.js +9 -8
  135. package/dist/core/presentations.d.ts +38 -37
  136. package/dist/core/presentations.js +48 -56
  137. package/dist/core/reports.d.ts +5 -0
  138. package/dist/core/reports.js +13 -0
  139. package/dist/core/resource-registry.d.ts +38 -0
  140. package/dist/core/resource-registry.js +30 -0
  141. package/dist/core/resource-reports.d.ts +69 -0
  142. package/dist/core/resource-reports.js +67 -0
  143. package/dist/core/resource.d.ts +135 -243
  144. package/dist/core/resource.js +7 -5
  145. package/dist/core/resources-of.d.ts +16 -0
  146. package/dist/core/resources-of.js +8 -0
  147. package/dist/core/resources.d.ts +97 -84
  148. package/dist/core/resources.js +166 -165
  149. package/dist/core/run-state.d.ts +30 -42
  150. package/dist/core/run-state.js +56 -60
  151. package/dist/core/run.d.ts +83 -90
  152. package/dist/core/run.js +109 -155
  153. package/dist/core/state-directory.js +4 -3
  154. package/dist/core/timeline.d.ts +42 -24
  155. package/dist/core/timeline.js +46 -27
  156. package/dist/core/timing.d.ts +3 -3
  157. package/dist/core/timing.js +1 -1
  158. package/dist/credential/events.d.ts +20 -0
  159. package/dist/credential/events.js +4 -0
  160. package/dist/credential/gateways.d.ts +1 -80
  161. package/dist/credential/index.d.ts +4 -5
  162. package/dist/credential/index.js +8 -5
  163. package/dist/credential/live/github-actions-token-response.js +1 -1
  164. package/dist/credential/live/vercel-cli-gateway.d.ts +2 -1
  165. package/dist/credential/live/vercel-cli-gateway.js +1 -1
  166. package/dist/credential/live/vercel-output.d.ts +1 -1
  167. package/dist/credential/source.d.ts +44 -75
  168. package/dist/credential/source.js +33 -28
  169. package/dist/credential/target.d.ts +1 -1
  170. package/dist/extension-commands.d.ts +20 -0
  171. package/dist/extension-commands.js +27 -0
  172. package/dist/extensions/github/definition.d.ts +26 -0
  173. package/dist/extensions/github/definition.js +29 -0
  174. package/dist/extensions/github/extension.d.ts +18 -0
  175. package/dist/extensions/github/extension.js +6 -0
  176. package/dist/{resources → extensions}/github/fixture-repo.d.ts +11 -8
  177. package/dist/{resources → extensions}/github/fixture-repo.js +8 -4
  178. package/dist/extensions/github/index.d.ts +13 -0
  179. package/dist/extensions/github/index.js +17 -0
  180. package/dist/extensions/github/lifecycle.d.ts +30 -0
  181. package/dist/extensions/github/lifecycle.js +69 -0
  182. package/dist/extensions/github/live/world.d.ts +6 -0
  183. package/dist/extensions/github/live/world.js +16 -0
  184. package/dist/extensions/github/options.d.ts +36 -0
  185. package/dist/extensions/github/options.js +36 -0
  186. package/dist/extensions/github/refusals.d.ts +32 -0
  187. package/dist/extensions/github/refusals.js +43 -0
  188. package/dist/extensions/github/release.d.ts +17 -0
  189. package/dist/extensions/github/release.js +34 -0
  190. package/dist/extensions/github/resource.d.ts +36 -0
  191. package/dist/extensions/github/resource.js +21 -0
  192. package/dist/extensions/github/run/payload.d.ts +27 -0
  193. package/dist/extensions/github/run/payload.js +42 -0
  194. package/dist/extensions/github/world.d.ts +15 -0
  195. package/dist/extensions/github/world.js +3 -0
  196. package/dist/extensions/story/command-tree.d.ts +6 -0
  197. package/dist/extensions/story/command-tree.js +21 -0
  198. package/dist/extensions/story/commands/app.d.ts +23 -0
  199. package/dist/extensions/story/commands/app.js +5 -0
  200. package/dist/extensions/story/commands/run/command.d.ts +211 -0
  201. package/dist/extensions/story/commands/run/command.js +259 -0
  202. package/dist/extensions/story/commands/run/metadata.d.ts +4 -0
  203. package/dist/extensions/story/commands/run/metadata.js +8 -0
  204. package/dist/extensions/story/commands/run/outcomes.d.ts +101 -0
  205. package/dist/extensions/story/commands/run/outcomes.js +73 -0
  206. package/dist/extensions/story/commands/tree.d.ts +2 -0
  207. package/dist/extensions/story/commands/tree.js +6 -0
  208. package/dist/extensions/story/extension.d.ts +2 -0
  209. package/dist/extensions/story/extension.js +8 -0
  210. package/dist/extensions/testserver/canceled.d.ts +7 -0
  211. package/dist/extensions/testserver/canceled.js +27 -0
  212. package/dist/extensions/testserver/command-tree.d.ts +6 -0
  213. package/dist/extensions/testserver/command-tree.js +20 -0
  214. package/dist/extensions/testserver/commands/app.d.ts +22 -0
  215. package/dist/extensions/testserver/commands/app.js +5 -0
  216. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/command.d.ts +277 -237
  217. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/command.js +112 -141
  218. package/dist/extensions/testserver/commands/pool/create/metadata.d.ts +33 -0
  219. package/dist/extensions/testserver/commands/pool/create/metadata.js +55 -0
  220. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/outcomes.d.ts +132 -112
  221. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/outcomes.js +6 -24
  222. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/command.d.ts +3 -4
  223. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/command.js +34 -28
  224. package/dist/extensions/testserver/commands/pool/list/metadata.d.ts +11 -0
  225. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/metadata.js +7 -5
  226. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/outcomes.js +1 -1
  227. package/dist/extensions/testserver/commands/pool/metadata.d.ts +3 -0
  228. package/dist/extensions/testserver/commands/pool/metadata.js +7 -0
  229. package/dist/extensions/testserver/commands/tree.d.ts +2 -0
  230. package/dist/extensions/testserver/commands/tree.js +6 -0
  231. package/dist/{resources → extensions}/testserver/credential-facts.d.ts +6 -40
  232. package/dist/{resources → extensions}/testserver/credential-facts.js +13 -35
  233. package/dist/extensions/testserver/definition.d.ts +57 -0
  234. package/dist/extensions/testserver/definition.js +71 -0
  235. package/dist/{resources → extensions}/testserver/events.d.ts +5 -4
  236. package/dist/extensions/testserver/events.js +4 -0
  237. package/dist/extensions/testserver/extension.d.ts +46 -0
  238. package/dist/extensions/testserver/extension.js +68 -0
  239. package/dist/extensions/testserver/index.d.ts +20 -0
  240. package/dist/extensions/testserver/index.js +31 -0
  241. package/dist/extensions/testserver/lifecycle.d.ts +24 -0
  242. package/dist/extensions/testserver/lifecycle.js +116 -0
  243. package/dist/{core → extensions/testserver}/limit.js +1 -0
  244. package/dist/extensions/testserver/live/world.d.ts +8 -0
  245. package/dist/extensions/testserver/live/world.js +38 -0
  246. package/dist/{resources/testserver/sandbox → extensions/testserver/options}/channels.d.ts +1 -1
  247. package/dist/extensions/testserver/options/index.d.ts +5 -0
  248. package/dist/extensions/testserver/options/index.js +11 -0
  249. package/dist/extensions/testserver/options/rules.d.ts +69 -0
  250. package/dist/extensions/testserver/options/rules.js +92 -0
  251. package/dist/extensions/testserver/options/sandboxes.d.ts +29 -0
  252. package/dist/extensions/testserver/options/sandboxes.js +33 -0
  253. package/dist/extensions/testserver/options/ttl.d.ts +23 -0
  254. package/dist/extensions/testserver/options/ttl.js +42 -0
  255. package/dist/{resources → extensions}/testserver/pool/channels.d.ts +3 -3
  256. package/dist/{resources → extensions}/testserver/pool/channels.js +2 -2
  257. package/dist/{resources → extensions}/testserver/pool/create.d.ts +1 -2
  258. package/dist/{resources → extensions}/testserver/pool/create.js +2 -1
  259. package/dist/{resources → extensions}/testserver/pool/index.d.ts +0 -1
  260. package/dist/{resources → extensions}/testserver/pool/index.js +2 -3
  261. package/dist/{resources → extensions}/testserver/pool/inspect.d.ts +1 -1
  262. package/dist/{resources → extensions}/testserver/pool/lease.d.ts +1 -1
  263. package/dist/extensions/testserver/pool/live/pool-store-gateway.d.ts +12 -0
  264. package/dist/{resources → extensions}/testserver/pool/live/pool-store-gateway.js +4 -4
  265. package/dist/{resources → extensions}/testserver/pool/pull-request.d.ts +8 -5
  266. package/dist/{resources → extensions}/testserver/pool/pull-request.js +2 -2
  267. package/dist/extensions/testserver/pr-build-facts.d.ts +156 -0
  268. package/dist/extensions/testserver/pr-build-facts.js +309 -0
  269. package/dist/extensions/testserver/presentation.d.ts +11 -0
  270. package/dist/{resources → extensions}/testserver/presentation.js +35 -56
  271. package/dist/{resources/testserver/lane.d.ts → extensions/testserver/progress.d.ts} +10 -6
  272. package/dist/{resources/testserver/lane.js → extensions/testserver/progress.js} +21 -16
  273. package/dist/extensions/testserver/provision.d.ts +160 -0
  274. package/dist/{resources/testserver/provider.js → extensions/testserver/provision.js} +80 -108
  275. package/dist/{resources → extensions}/testserver/pull-request/gateways.d.ts +1 -1
  276. package/dist/extensions/testserver/pull-request/gateways.js +5 -0
  277. package/dist/{resources → extensions}/testserver/pull-request/index.js +2 -2
  278. package/dist/{resources → extensions}/testserver/pull-request/live/github-token-gateway.d.ts +4 -4
  279. package/dist/{resources → extensions}/testserver/pull-request/live/github-token-gateway.js +4 -4
  280. package/dist/extensions/testserver/refusals.d.ts +72 -0
  281. package/dist/extensions/testserver/refusals.js +117 -0
  282. package/dist/extensions/testserver/release.d.ts +14 -0
  283. package/dist/extensions/testserver/release.js +26 -0
  284. package/dist/extensions/testserver/resource.d.ts +57 -0
  285. package/dist/extensions/testserver/resource.js +19 -0
  286. package/dist/extensions/testserver/result.d.ts +55 -0
  287. package/dist/extensions/testserver/result.js +98 -0
  288. package/dist/extensions/testserver/run/connection.d.ts +21 -0
  289. package/dist/extensions/testserver/run/connection.js +39 -0
  290. package/dist/extensions/testserver/run-sandbox.d.ts +16 -0
  291. package/dist/extensions/testserver/run-sandbox.js +11 -0
  292. package/dist/{resources → extensions}/testserver/sandbox/create.d.ts +1 -11
  293. package/dist/{resources → extensions}/testserver/sandbox/create.js +0 -15
  294. package/dist/{resources → extensions}/testserver/sandbox/gateways.d.ts +1 -1
  295. package/dist/{resources → extensions}/testserver/sandbox/index.d.ts +1 -3
  296. package/dist/extensions/testserver/sandbox/index.js +6 -0
  297. package/dist/extensions/testserver/testserver-sdk.d.ts +1 -0
  298. package/dist/extensions/testserver/testserver-sdk.js +4 -0
  299. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/arguments.js +1 -1
  300. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/context.js +1 -1
  301. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/driver.d.ts +1 -1
  302. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/gateways.js +1 -1
  303. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/index.js +4 -4
  304. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/invocation.d.ts +1 -1
  305. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/invocation.js +1 -1
  306. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/redaction.js +1 -1
  307. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/report.d.ts +1 -1
  308. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/report.js +1 -1
  309. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/verbose.js +1 -1
  310. package/dist/extensions/testserver/vitest/config.d.ts +30 -0
  311. package/dist/extensions/testserver/vitest/config.js +41 -0
  312. package/dist/{vitest → extensions/testserver/vitest}/container-scope.d.ts +25 -14
  313. package/dist/{vitest → extensions/testserver/vitest}/container-scope.js +55 -17
  314. package/dist/extensions/testserver/vitest/container-start.d.ts +19 -0
  315. package/dist/extensions/testserver/vitest/container-start.js +31 -0
  316. package/dist/{vitest → extensions/testserver/vitest}/diagnostics.d.ts +66 -29
  317. package/dist/{vitest → extensions/testserver/vitest}/diagnostics.js +146 -50
  318. package/dist/{vitest → extensions/testserver/vitest}/fixtures.d.ts +7 -5
  319. package/dist/{vitest → extensions/testserver/vitest}/fixtures.js +69 -26
  320. package/dist/extensions/testserver/vitest/index.d.ts +3 -0
  321. package/dist/extensions/testserver/vitest/index.js +10 -0
  322. package/dist/extensions/testserver/vitest/sandbox.d.ts +25 -0
  323. package/dist/extensions/testserver/vitest/sandbox.js +43 -0
  324. package/dist/{vitest → extensions/testserver/vitest}/types.d.ts +1 -1
  325. package/dist/extensions/testserver/world.d.ts +25 -0
  326. package/dist/extensions/testserver/world.js +4 -0
  327. package/dist/extensions.d.ts +144 -0
  328. package/dist/extensions.js +41 -0
  329. package/dist/forward-sigterm.d.ts +8 -0
  330. package/dist/forward-sigterm.js +18 -0
  331. package/dist/help-logo.js +5 -5
  332. package/dist/launch.js +46 -0
  333. package/dist/launcher-resolvers/index.d.ts +2 -0
  334. package/dist/launcher-resolvers/index.js +8 -0
  335. package/dist/launcher-resolvers/local-services.d.ts +57 -0
  336. package/dist/launcher-resolvers/local-services.js +7 -0
  337. package/dist/live-app.js +12 -7
  338. package/dist/local-services.d.ts +19 -0
  339. package/dist/local-services.js +37 -0
  340. package/dist/presentation.js +2 -2
  341. package/dist/run-directory/gateways.d.ts +167 -0
  342. package/dist/run-directory/gateways.js +2 -0
  343. package/dist/run-directory/index.d.ts +8 -0
  344. package/dist/run-directory/index.js +13 -0
  345. package/dist/run-directory/plan.d.ts +35 -0
  346. package/dist/run-directory/plan.js +24 -0
  347. package/dist/run-directory/reader.d.ts +70 -0
  348. package/dist/run-directory/reader.js +51 -0
  349. package/dist/run-directory/recording.d.ts +92 -0
  350. package/dist/run-directory/recording.js +85 -0
  351. package/dist/run-directory/run-collector.d.ts +36 -0
  352. package/dist/{commands/exec → run-directory}/run-collector.js +10 -12
  353. package/dist/{core → run-directory}/run-directory.d.ts +13 -14
  354. package/dist/{core → run-directory}/run-directory.js +11 -11
  355. package/dist/{commands/exec → run-directory}/run-record.d.ts +92 -61
  356. package/dist/run-directory/run-record.js +209 -0
  357. package/dist/run-directory/timeline-facts.d.ts +53 -0
  358. package/dist/run-directory/timeline-facts.js +76 -0
  359. package/dist/runner/base.js +1 -1
  360. package/dist/runner/context.js +1 -1
  361. package/dist/runner/events.d.ts +6 -5
  362. package/dist/runner/events.js +1 -1
  363. package/dist/runner/gateways.d.ts +11 -11
  364. package/dist/runner/gateways.js +1 -1
  365. package/dist/runner/index.d.ts +13 -17
  366. package/dist/runner/index.js +10 -14
  367. package/dist/runner/live/sandbox-gateway.js +4 -4
  368. package/dist/runner/live/terminal.d.ts +1 -1
  369. package/dist/runner/live/terminal.js +1 -1
  370. package/dist/runner/prepare.d.ts +40 -17
  371. package/dist/runner/prepare.js +17 -11
  372. package/dist/runner/ready.js +2 -2
  373. package/dist/runner/recipe.d.ts +38 -20
  374. package/dist/runner/recipe.js +31 -17
  375. package/dist/runner/{remote-command.d.ts → sandboxed-command.d.ts} +18 -19
  376. package/dist/runner/{remote-command.js → sandboxed-command.js} +21 -22
  377. package/dist/runner/scope.d.ts +21 -14
  378. package/dist/runner/scope.js +12 -10
  379. package/dist/runner/secrets.js +1 -1
  380. package/dist/runner/session.d.ts +100 -0
  381. package/dist/runner/session.js +109 -0
  382. package/dist/runner/snapshot-key.d.ts +1 -1
  383. package/dist/runner/snapshot-key.js +4 -4
  384. package/dist/runner/snapshot-save.d.ts +3 -2
  385. package/dist/runner/snapshot-save.js +8 -7
  386. package/dist/sdk/extension/ci.d.ts +2 -0
  387. package/dist/sdk/extension/ci.js +6 -0
  388. package/dist/sdk/extension/commands.d.ts +69 -0
  389. package/dist/sdk/extension/commands.js +31 -0
  390. package/dist/{credential/diagnosis.d.ts → sdk/extension/credential-diagnosis.d.ts} +1 -7
  391. package/dist/{credential/diagnosis.js → sdk/extension/credential-diagnosis.js} +2 -11
  392. package/dist/sdk/extension/credential-source.d.ts +132 -0
  393. package/dist/sdk/extension/credential-source.js +5 -0
  394. package/dist/{credential → sdk/extension}/credential.d.ts +8 -7
  395. package/dist/{credential → sdk/extension}/credential.js +9 -6
  396. package/dist/sdk/extension/index.d.ts +16 -0
  397. package/dist/sdk/extension/index.js +40 -0
  398. package/dist/sdk/extension/launcher-supplies.d.ts +24 -0
  399. package/dist/sdk/extension/launcher-supplies.js +3 -0
  400. package/dist/sdk/extension/lifecycle.d.ts +212 -0
  401. package/dist/sdk/extension/lifecycle.js +9 -0
  402. package/dist/sdk/extension/presentation.d.ts +31 -0
  403. package/dist/sdk/extension/presentation.js +7 -0
  404. package/dist/sdk/extension/progress.d.ts +75 -0
  405. package/dist/sdk/extension/progress.js +8 -0
  406. package/dist/sdk/extension/reports.d.ts +15 -0
  407. package/dist/sdk/extension/reports.js +5 -0
  408. package/dist/sdk/extension/resource-definition.d.ts +204 -0
  409. package/dist/sdk/extension/resource-definition.js +24 -0
  410. package/dist/sdk/extension/resource-factory.d.ts +10 -0
  411. package/dist/sdk/extension/resource-factory.js +15 -0
  412. package/dist/sdk/extension/resource.d.ts +60 -0
  413. package/dist/sdk/extension/resource.js +42 -0
  414. package/dist/sdk/extension/rules.d.ts +16 -0
  415. package/dist/sdk/extension/rules.js +30 -0
  416. package/dist/sdk/extension/span.d.ts +8 -0
  417. package/dist/sdk/extension/span.js +4 -0
  418. package/dist/sdk/extension/time.d.ts +11 -0
  419. package/dist/sdk/extension/time.js +4 -0
  420. package/dist/sdk/extension/token-request-facts.d.ts +39 -0
  421. package/dist/sdk/extension/token-request-facts.js +35 -0
  422. package/dist/sdk/index.d.ts +4 -7
  423. package/dist/sdk/index.js +7 -15
  424. package/dist/sdk/run/contract.d.ts +32 -0
  425. package/dist/sdk/run/contract.js +12 -0
  426. package/dist/sdk/run/launcher.d.ts +5 -0
  427. package/dist/sdk/run/launcher.js +6 -0
  428. package/dist/sdk/run/payload.d.ts +58 -0
  429. package/dist/sdk/run/payload.js +73 -0
  430. package/dist/sdk/run/present.d.ts +11 -0
  431. package/dist/sdk/run/present.js +4 -0
  432. package/dist/sdk/run/redact.d.ts +5 -0
  433. package/dist/sdk/run/redact.js +12 -0
  434. package/dist/story/align.d.ts +1 -1
  435. package/dist/story/align.js +1 -1
  436. package/dist/story/command-line.d.ts +6 -16
  437. package/dist/story/command-line.js +11 -23
  438. package/dist/story/errors.d.ts +1 -1
  439. package/dist/story/errors.js +1 -1
  440. package/dist/story/host.d.ts +1 -1
  441. package/dist/story/host.js +2 -2
  442. package/dist/story/index.d.ts +2 -2
  443. package/dist/story/index.js +4 -3
  444. package/dist/story/launch.d.ts +70 -0
  445. package/dist/story/launch.js +77 -0
  446. package/dist/story/report.d.ts +2 -2
  447. package/dist/story/report.js +3 -4
  448. package/dist/story/settle.d.ts +7 -7
  449. package/dist/story/settle.js +5 -5
  450. package/dist/story/start.d.ts +2 -2
  451. package/dist/time/duration.js +2 -2
  452. package/dist/time/index.js +2 -1
  453. package/dist/time/time.d.ts +2 -11
  454. package/dist/time/time.js +2 -2
  455. package/dist/{sdk → vendor/testserver-sdk}/container/api-request.d.ts +14 -2
  456. package/dist/vendor/testserver-sdk/container/api-request.js +68 -0
  457. package/dist/vendor/testserver-sdk/container/container.d.ts +199 -0
  458. package/dist/vendor/testserver-sdk/container/container.js +458 -0
  459. package/dist/vendor/testserver-sdk/container/external.d.ts +111 -0
  460. package/dist/vendor/testserver-sdk/container/external.js +76 -0
  461. package/dist/vendor/testserver-sdk/container/gateways.d.ts +156 -0
  462. package/dist/{sdk → vendor/testserver-sdk}/container/index.d.ts +2 -1
  463. package/dist/{sdk → vendor/testserver-sdk}/container/index.js +2 -1
  464. package/dist/vendor/testserver-sdk/container/live/container-gateway.d.ts +22 -0
  465. package/dist/vendor/testserver-sdk/container/live/container-gateway.js +165 -0
  466. package/dist/vendor/testserver-sdk/container/recorder.d.ts +69 -0
  467. package/dist/vendor/testserver-sdk/container/recorder.js +121 -0
  468. package/dist/{sdk → vendor/testserver-sdk}/factories/build.d.ts +33 -12
  469. package/dist/{sdk → vendor/testserver-sdk}/factories/build.js +36 -14
  470. package/dist/vendor/testserver-sdk/factories/definition.d.ts +39 -0
  471. package/dist/{sdk → vendor/testserver-sdk}/factories/definition.js +1 -1
  472. package/dist/{sdk → vendor/testserver-sdk}/factories/definitions.d.ts +7 -4
  473. package/dist/{sdk → vendor/testserver-sdk}/factories/definitions.js +10 -0
  474. package/dist/vendor/testserver-sdk/factories/gateways.d.ts +31 -0
  475. package/dist/vendor/testserver-sdk/factories/index.d.ts +4 -0
  476. package/dist/{sdk → vendor/testserver-sdk}/factories/index.js +3 -3
  477. package/dist/vendor/testserver-sdk/index.d.ts +6 -0
  478. package/dist/vendor/testserver-sdk/index.js +11 -0
  479. package/dist/{sdk → vendor/testserver-sdk}/proxy/exchange.d.ts +2 -1
  480. package/dist/{sdk → vendor/testserver-sdk}/proxy/exchange.js +8 -4
  481. package/dist/{sdk → vendor/testserver-sdk}/proxy/faulted-exchange.js +7 -2
  482. package/dist/{sdk → vendor/testserver-sdk}/proxy/faults.d.ts +2 -1
  483. package/dist/{sdk → vendor/testserver-sdk}/proxy/records.d.ts +10 -1
  484. package/dist/{sdk → vendor/testserver-sdk}/proxy/records.js +13 -0
  485. package/dist/{sdk → vendor/testserver-sdk}/records/index.d.ts +1 -1
  486. package/dist/{sdk → vendor/testserver-sdk}/records/records.d.ts +17 -1
  487. package/dist/vendor/testserver-sdk/testserver/external-ids.d.ts +38 -0
  488. package/dist/vendor/testserver-sdk/testserver/external-ids.js +46 -0
  489. package/dist/vendor/testserver-sdk/testserver/failure.d.ts +102 -0
  490. package/dist/vendor/testserver-sdk/testserver/failure.js +109 -0
  491. package/dist/vendor/testserver-sdk/testserver/index.d.ts +7 -0
  492. package/dist/vendor/testserver-sdk/testserver/index.js +11 -0
  493. package/dist/{sdk → vendor/testserver-sdk}/testserver/live/request.d.ts +8 -10
  494. package/dist/{sdk → vendor/testserver-sdk}/testserver/live/request.js +8 -6
  495. package/dist/vendor/testserver-sdk/testserver/routes.d.ts +60 -0
  496. package/dist/vendor/testserver-sdk/testserver/routes.js +84 -0
  497. package/dist/vendor/testserver-sdk/testserver/service-ids.d.ts +31 -0
  498. package/dist/{sdk → vendor/testserver-sdk}/testserver/service-ids.js +27 -4
  499. package/dist/vitest/config.d.ts +2 -28
  500. package/dist/vitest/config.js +6 -36
  501. package/dist/vitest/gateways.js +1 -1
  502. package/dist/vitest/index.d.ts +2 -3
  503. package/dist/vitest/index.js +5 -9
  504. package/dist/vitest/plan.d.ts +1 -16
  505. package/dist/vitest/plan.js +4 -36
  506. package/dist/vitest/test-events.d.ts +1 -18
  507. package/dist/vitest/test-events.js +2 -31
  508. package/package.json +52 -23
  509. package/skills/overview.md +12 -9
  510. package/skills/read-run-output.md +26 -3
  511. package/skills/testserver-builds.md +8 -8
  512. package/dist/chunks/chunk-5CQCRX2L.js +0 -5768
  513. package/dist/chunks/chunk-5U5Q6VZR.js +0 -556
  514. package/dist/chunks/chunk-7O6UN63H.js +0 -63
  515. package/dist/chunks/chunk-NX55IJ5S.js +0 -1842
  516. package/dist/chunks/chunk-OCZJE5XV.js +0 -910
  517. package/dist/chunks/chunk-RRQ2ZGSE.js +0 -1512
  518. package/dist/chunks/chunk-S5NAIZYS.js +0 -13
  519. package/dist/chunks/chunk-UHO5OCEX.js +0 -360
  520. package/dist/chunks/chunk-WBIHJM7D.js +0 -188
  521. package/dist/combine-errors.d.ts +0 -11
  522. package/dist/combine-errors.js +0 -19
  523. package/dist/commands/exec/run-collector.d.ts +0 -30
  524. package/dist/commands/exec/run-record.js +0 -152
  525. package/dist/commands/exec/testserver-flags.d.ts +0 -48
  526. package/dist/commands/exec/testserver-flags.js +0 -80
  527. package/dist/config/by-name.d.ts +0 -24
  528. package/dist/config/by-name.js +0 -26
  529. package/dist/config/resource-config.d.ts +0 -132
  530. package/dist/config/resource-config.js +0 -19
  531. package/dist/config/set.d.ts +0 -27
  532. package/dist/config/set.js +0 -71
  533. package/dist/core/command-provider.d.ts +0 -126
  534. package/dist/core/command-provider.js +0 -13
  535. package/dist/core/command-slots.d.ts +0 -73
  536. package/dist/core/command-slots.js +0 -140
  537. package/dist/core/keyed.d.ts +0 -12
  538. package/dist/core/keyed.js +0 -24
  539. package/dist/core/lane.d.ts +0 -46
  540. package/dist/core/lane.js +0 -5
  541. package/dist/core/mint.d.ts +0 -10
  542. package/dist/core/mint.js +0 -14
  543. package/dist/core/presentation.d.ts +0 -87
  544. package/dist/core/presentation.js +0 -5
  545. package/dist/core/provider.d.ts +0 -79
  546. package/dist/core/provider.js +0 -5
  547. package/dist/resource-commands.d.ts +0 -13
  548. package/dist/resource-commands.js +0 -22
  549. package/dist/resources/github/cleanup.d.ts +0 -23
  550. package/dist/resources/github/cleanup.js +0 -39
  551. package/dist/resources/github/command.d.ts +0 -126
  552. package/dist/resources/github/command.js +0 -117
  553. package/dist/resources/github/config.d.ts +0 -16
  554. package/dist/resources/github/config.js +0 -37
  555. package/dist/resources/github/events.d.ts +0 -26
  556. package/dist/resources/github/events.js +0 -2
  557. package/dist/resources/github/index.d.ts +0 -12
  558. package/dist/resources/github/index.js +0 -15
  559. package/dist/resources/github/live/gateways.d.ts +0 -6
  560. package/dist/resources/github/live/gateways.js +0 -13
  561. package/dist/resources/github/presentation.d.ts +0 -13
  562. package/dist/resources/github/presentation.js +0 -43
  563. package/dist/resources/github/provider.d.ts +0 -66
  564. package/dist/resources/github/provider.js +0 -58
  565. package/dist/resources/github/resource-provider.d.ts +0 -6
  566. package/dist/resources/github/resource-provider.js +0 -20
  567. package/dist/resources/github/resource.d.ts +0 -33
  568. package/dist/resources/github/resource.js +0 -12
  569. package/dist/resources/testserver/cleanup.d.ts +0 -14
  570. package/dist/resources/testserver/cleanup.js +0 -22
  571. package/dist/resources/testserver/command-tree.d.ts +0 -4
  572. package/dist/resources/testserver/command-tree.js +0 -12
  573. package/dist/resources/testserver/command.d.ts +0 -520
  574. package/dist/resources/testserver/command.js +0 -252
  575. package/dist/resources/testserver/commands/app.d.ts +0 -18
  576. package/dist/resources/testserver/commands/app.js +0 -3
  577. package/dist/resources/testserver/commands/create/metadata.d.ts +0 -31
  578. package/dist/resources/testserver/commands/create/metadata.js +0 -53
  579. package/dist/resources/testserver/commands/list/metadata.d.ts +0 -9
  580. package/dist/resources/testserver/config.d.ts +0 -18
  581. package/dist/resources/testserver/config.js +0 -88
  582. package/dist/resources/testserver/events.js +0 -4
  583. package/dist/resources/testserver/index.d.ts +0 -16
  584. package/dist/resources/testserver/index.js +0 -25
  585. package/dist/resources/testserver/live/gateways.d.ts +0 -8
  586. package/dist/resources/testserver/live/gateways.js +0 -39
  587. package/dist/resources/testserver/options.d.ts +0 -5
  588. package/dist/resources/testserver/options.js +0 -5
  589. package/dist/resources/testserver/pool/directory.d.ts +0 -4
  590. package/dist/resources/testserver/pool/directory.js +0 -5
  591. package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +0 -12
  592. package/dist/resources/testserver/pr-build-facts.d.ts +0 -130
  593. package/dist/resources/testserver/pr-build-facts.js +0 -261
  594. package/dist/resources/testserver/presentation.d.ts +0 -9
  595. package/dist/resources/testserver/provider.d.ts +0 -187
  596. package/dist/resources/testserver/pull-request/gateways.js +0 -5
  597. package/dist/resources/testserver/ran.d.ts +0 -92
  598. package/dist/resources/testserver/ran.js +0 -156
  599. package/dist/resources/testserver/resource-provider.d.ts +0 -12
  600. package/dist/resources/testserver/resource-provider.js +0 -32
  601. package/dist/resources/testserver/resource.d.ts +0 -36
  602. package/dist/resources/testserver/resource.js +0 -10
  603. package/dist/resources/testserver/run-sandbox.d.ts +0 -13
  604. package/dist/resources/testserver/run-sandbox.js +0 -6
  605. package/dist/resources/testserver/sandbox/index.js +0 -8
  606. package/dist/resources.d.ts +0 -702
  607. package/dist/resources.js +0 -83
  608. package/dist/sdk/container/api-request.js +0 -46
  609. package/dist/sdk/container/container.d.ts +0 -144
  610. package/dist/sdk/container/container.js +0 -346
  611. package/dist/sdk/container/gateways.d.ts +0 -108
  612. package/dist/sdk/container/live/container-gateway.d.ts +0 -17
  613. package/dist/sdk/container/live/container-gateway.js +0 -114
  614. package/dist/sdk/factories/definition.d.ts +0 -28
  615. package/dist/sdk/factories/gateways.d.ts +0 -25
  616. package/dist/sdk/factories/index.d.ts +0 -5
  617. package/dist/sdk/factories/live/factory-gateway.d.ts +0 -10
  618. package/dist/sdk/factories/live/factory-gateway.js +0 -29
  619. package/dist/sdk/host.d.ts +0 -2
  620. package/dist/sdk/host.js +0 -7
  621. package/dist/sdk/payload/index.d.ts +0 -2
  622. package/dist/sdk/payload/index.js +0 -4
  623. package/dist/sdk/payload/payload.d.ts +0 -47
  624. package/dist/sdk/payload/payload.js +0 -74
  625. package/dist/sdk/testserver/failure.d.ts +0 -73
  626. package/dist/sdk/testserver/failure.js +0 -61
  627. package/dist/sdk/testserver/index.d.ts +0 -5
  628. package/dist/sdk/testserver/index.js +0 -8
  629. package/dist/sdk/testserver/service-ids.d.ts +0 -19
  630. package/dist/story/mode.d.ts +0 -17
  631. package/dist/story/mode.js +0 -21
  632. package/dist/vitest/sandbox.d.ts +0 -22
  633. package/dist/vitest/sandbox.js +0 -41
  634. /package/dist/{credential/settle.js → config/credential-settle.js} +0 -0
  635. /package/dist/{resources → extensions}/github/gateways.d.ts +0 -0
  636. /package/dist/{resources → extensions}/github/gateways.js +0 -0
  637. /package/dist/{resources → extensions}/github/live/fixture-repo-gateway.d.ts +0 -0
  638. /package/dist/{resources → extensions}/github/live/fixture-repo-gateway.js +0 -0
  639. /package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/outcomes.d.ts +0 -0
  640. /package/dist/{core → extensions/testserver}/limit.d.ts +0 -0
  641. /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/build-reference.d.ts +0 -0
  642. /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/build-reference.js +0 -0
  643. /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/channels.js +0 -0
  644. /package/dist/{resources → extensions}/testserver/pool/gateways.d.ts +0 -0
  645. /package/dist/{resources → extensions}/testserver/pool/gateways.js +0 -0
  646. /package/dist/{resources → extensions}/testserver/pool/host.d.ts +0 -0
  647. /package/dist/{resources → extensions}/testserver/pool/host.js +0 -0
  648. /package/dist/{resources → extensions}/testserver/pool/inspect.js +0 -0
  649. /package/dist/{resources → extensions}/testserver/pool/lease.js +0 -0
  650. /package/dist/{resources → extensions}/testserver/pool/live/pool-records.d.ts +0 -0
  651. /package/dist/{resources → extensions}/testserver/pool/live/pool-records.js +0 -0
  652. /package/dist/{resources → extensions}/testserver/pool/staleness.d.ts +0 -0
  653. /package/dist/{resources → extensions}/testserver/pool/staleness.js +0 -0
  654. /package/dist/{resources → extensions}/testserver/pull-request/index.d.ts +0 -0
  655. /package/dist/{resources → extensions}/testserver/pull-request/live/github-rest.d.ts +0 -0
  656. /package/dist/{resources → extensions}/testserver/pull-request/live/github-rest.js +0 -0
  657. /package/dist/{resources → extensions}/testserver/pull-request/live/pull-request-gateway.d.ts +0 -0
  658. /package/dist/{resources → extensions}/testserver/pull-request/live/pull-request-gateway.js +0 -0
  659. /package/dist/{resources → extensions}/testserver/pull-request/live/testserver-workflow-gateway.d.ts +0 -0
  660. /package/dist/{resources → extensions}/testserver/pull-request/live/testserver-workflow-gateway.js +0 -0
  661. /package/dist/{resources → extensions}/testserver/sandbox/create-failure.d.ts +0 -0
  662. /package/dist/{resources → extensions}/testserver/sandbox/create-failure.js +0 -0
  663. /package/dist/{resources → extensions}/testserver/sandbox/gateways.js +0 -0
  664. /package/dist/{resources → extensions}/testserver/sandbox/live/builds-response.d.ts +0 -0
  665. /package/dist/{resources → extensions}/testserver/sandbox/live/builds-response.js +0 -0
  666. /package/dist/{resources → extensions}/testserver/sandbox/live/control-plane-gateway.d.ts +0 -0
  667. /package/dist/{resources → extensions}/testserver/sandbox/live/control-plane-gateway.js +0 -0
  668. /package/dist/{resources → extensions}/testserver/sandbox/live/create-response.d.ts +0 -0
  669. /package/dist/{resources → extensions}/testserver/sandbox/live/create-response.js +0 -0
  670. /package/dist/{resources → extensions}/testserver/sandbox/live/fetch-failure.d.ts +0 -0
  671. /package/dist/{resources → extensions}/testserver/sandbox/live/fetch-failure.js +0 -0
  672. /package/dist/{resources → extensions}/testserver/sandbox/live/health-check-gateway.d.ts +0 -0
  673. /package/dist/{resources → extensions}/testserver/sandbox/live/health-check-gateway.js +0 -0
  674. /package/dist/{resources → extensions}/testserver/sandbox/live/sse.d.ts +0 -0
  675. /package/dist/{resources → extensions}/testserver/sandbox/live/sse.js +0 -0
  676. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/ansi.d.ts +0 -0
  677. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/ansi.js +0 -0
  678. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/arguments.d.ts +0 -0
  679. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/auth-config.d.ts +0 -0
  680. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/auth-config.js +0 -0
  681. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/clock.d.ts +0 -0
  682. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/clock.js +0 -0
  683. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/config-files.d.ts +0 -0
  684. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/config-files.js +0 -0
  685. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/context.d.ts +0 -0
  686. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/driver.js +0 -0
  687. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/entry.d.ts +0 -0
  688. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/entry.js +0 -0
  689. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/environment.d.ts +0 -0
  690. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/environment.js +0 -0
  691. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/errors.d.ts +0 -0
  692. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/errors.js +0 -0
  693. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/gateways.d.ts +0 -0
  694. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/index.d.ts +0 -0
  695. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/keys.d.ts +0 -0
  696. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/keys.js +0 -0
  697. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/config-files.d.ts +0 -0
  698. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/config-files.js +0 -0
  699. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/process-gateway.d.ts +0 -0
  700. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/process-gateway.js +0 -0
  701. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/redaction.d.ts +0 -0
  702. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/verbose.d.ts +0 -0
  703. /package/dist/{vitest → extensions/testserver/vitest}/types.js +0 -0
  704. /package/dist/{core → run-directory}/live/run-directory-gateway.d.ts +0 -0
  705. /package/dist/{core → run-directory}/live/run-directory-gateway.js +0 -0
  706. /package/dist/sdk/{payload → run}/test-events.d.ts +0 -0
  707. /package/dist/sdk/{payload → run}/test-events.js +0 -0
  708. /package/dist/{sdk → vendor/testserver-sdk}/container/feature-flags.d.ts +0 -0
  709. /package/dist/{sdk → vendor/testserver-sdk}/container/feature-flags.js +0 -0
  710. /package/dist/{sdk → vendor/testserver-sdk}/container/gateways.js +0 -0
  711. /package/dist/{sdk → vendor/testserver-sdk}/factories/gateways.js +0 -0
  712. /package/dist/{sdk → vendor/testserver-sdk}/proxy/faulted-exchange.d.ts +0 -0
  713. /package/dist/{sdk → vendor/testserver-sdk}/proxy/faults.js +0 -0
  714. /package/dist/{sdk → vendor/testserver-sdk}/proxy/index.d.ts +0 -0
  715. /package/dist/{sdk → vendor/testserver-sdk}/proxy/index.js +0 -0
  716. /package/dist/{sdk → vendor/testserver-sdk}/proxy/proxy.d.ts +0 -0
  717. /package/dist/{sdk → vendor/testserver-sdk}/proxy/proxy.js +0 -0
  718. /package/dist/{sdk → vendor/testserver-sdk}/records/body.d.ts +0 -0
  719. /package/dist/{sdk → vendor/testserver-sdk}/records/body.js +0 -0
  720. /package/dist/{sdk → vendor/testserver-sdk}/records/index.js +0 -0
  721. /package/dist/{sdk → vendor/testserver-sdk}/records/records.js +0 -0
  722. /package/dist/{sdk → vendor/testserver-sdk}/seed/index.d.ts +0 -0
  723. /package/dist/{sdk → vendor/testserver-sdk}/seed/index.js +0 -0
  724. /package/dist/{sdk → vendor/testserver-sdk}/seed/seed.d.ts +0 -0
  725. /package/dist/{sdk → vendor/testserver-sdk}/seed/seed.js +0 -0
  726. /package/dist/{sdk → vendor/testserver-sdk}/testserver/clock.d.ts +0 -0
  727. /package/dist/{sdk → vendor/testserver-sdk}/testserver/clock.js +0 -0
  728. /package/dist/{sdk → vendor/testserver-sdk}/testserver/live/connect-failure.d.ts +0 -0
  729. /package/dist/{sdk → vendor/testserver-sdk}/testserver/live/connect-failure.js +0 -0
  730. /package/dist/{sdk → vendor/testserver-sdk}/testserver/test-id.d.ts +0 -0
  731. /package/dist/{sdk → vendor/testserver-sdk}/testserver/test-id.js +0 -0
@@ -0,0 +1,1952 @@
1
+ import {
2
+ versionText
3
+ } from "./chunk-I5GZLOLQ.js";
4
+ import {
5
+ forwardSigterm
6
+ } from "./chunk-WNIQA5J6.js";
7
+ import {
8
+ RESOURCE_FLAG_HELP,
9
+ RESOURCE_USAGE_FLAGS,
10
+ criticalPathStep,
11
+ recordedPlan,
12
+ resourceFlagFields,
13
+ resourceFlagProblems,
14
+ resourceFlagValues,
15
+ testPlanLine,
16
+ testsChart,
17
+ testsSummaryLines,
18
+ waterfallLines
19
+ } from "./chunk-4EU4AH7E.js";
20
+ import {
21
+ REGISTRY,
22
+ RESOURCES
23
+ } from "./chunk-NPPJ57W7.js";
24
+ import {
25
+ isoSecondsText,
26
+ keepTimeText,
27
+ paint,
28
+ releaseText,
29
+ sandboxConnectPage,
30
+ seconds,
31
+ short,
32
+ shortFile,
33
+ spread,
34
+ truncate,
35
+ visibleLength
36
+ } from "./chunk-VZZTHCBW.js";
37
+ import {
38
+ EMPTY_RUN_STATE,
39
+ cleanupProblems,
40
+ commandExitStatus,
41
+ executeRun,
42
+ megabytesText,
43
+ recordRun,
44
+ saveSchema,
45
+ secondsOf,
46
+ secondsText,
47
+ timedProgress,
48
+ timelineSchema,
49
+ warningTally
50
+ } from "./chunk-KR7WIYLG.js";
51
+ import {
52
+ RUNNER_SECRET_MIN_LENGTH,
53
+ configErrors,
54
+ credentialErrors,
55
+ fileSettings,
56
+ invalidConfig,
57
+ loadSettingsFile,
58
+ mintTargetText,
59
+ parseKeepTime,
60
+ prepareRunner,
61
+ readRunnerSecrets,
62
+ recipeRun,
63
+ redactSecrets,
64
+ requireTarget,
65
+ runStepTakesSecret,
66
+ settleCredential,
67
+ settleRunResources
68
+ } from "./chunk-O4BUT7BE.js";
69
+ import {
70
+ describeMintFailure,
71
+ isCi
72
+ } from "./chunk-AMTYHUYB.js";
73
+ import {
74
+ defineErrors,
75
+ defineOutcomes,
76
+ refused,
77
+ renderOutcome
78
+ } from "./chunk-4PRAB24Y.js";
79
+
80
+ // src/commands/exec/outcomes.ts
81
+ import { z as z4 } from "zod";
82
+
83
+ // src/commands/exec/cleanup.ts
84
+ import { z } from "zod";
85
+ var notStoppedSchema = z.object({
86
+ name: z.string(),
87
+ role: z.enum(["runner", "snapshot-build"]),
88
+ /** The sandbox's own timeout, in minutes, within which it stops. */
89
+ timeoutMinutes: z.number(),
90
+ message: z.string()
91
+ });
92
+ var notDeletedSchema = z.object({
93
+ name: z.string(),
94
+ role: z.enum(["runner", "snapshot-build"]),
95
+ message: z.string()
96
+ });
97
+ var keptSchema = z.object({
98
+ name: z.string(),
99
+ /** When its timeout stops it, as an ISO time: the keep time from when the run ended, or later. */
100
+ stopsAt: z.string(),
101
+ /** Its Connect page in the Vercel dashboard, which says how to open a shell in it. */
102
+ url: z.string()
103
+ });
104
+ var notKeptSchema = z.object({ name: z.string(), message: z.string() });
105
+ var runnerCleanupSchema = z.object({
106
+ kept: keptSchema.nullable(),
107
+ notKept: notKeptSchema.nullable(),
108
+ notStopped: z.array(notStoppedSchema),
109
+ notDeleted: z.array(notDeletedSchema)
110
+ });
111
+ function sandboxRole(role) {
112
+ return role === "runner" ? "runner sandbox" : "build sandbox";
113
+ }
114
+ function notStoppedText(sandbox) {
115
+ return `Couldn't stop the ${sandboxRole(sandbox.role)} ${sandbox.name}: ${sandbox.message}. Its own timeout stops it within ${sandbox.timeoutMinutes} minutes.`;
116
+ }
117
+ function notDeletedText(sandbox) {
118
+ return `Stopped the ${sandboxRole(sandbox.role)} ${sandbox.name}, but couldn't delete it: ${sandbox.message}. It stays listed in the Vercel project.`;
119
+ }
120
+ function keptText(kept) {
121
+ return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, so you can connect to it: ${kept.url}`;
122
+ }
123
+ function notKeptText(sandbox) {
124
+ return `Couldn't keep the runner sandbox ${sandbox.name} running: ${sandbox.message}. Stopped and deleted it instead.`;
125
+ }
126
+ function runnerCleanupRows(cleanup) {
127
+ if (cleanup === null) return [];
128
+ const { kept, notKept } = cleanup;
129
+ return [
130
+ ...kept === null ? [] : [["Sandbox kept", [`${kept.name}, running until ${isoSecondsText(kept.stopsAt)}`, kept.url]]],
131
+ ...notKept === null ? [] : [["Sandbox not kept", notKeptText(notKept)]],
132
+ ...cleanup.notStopped.length === 0 ? [] : [["Sandboxes not stopped", cleanup.notStopped.map(notStoppedText)]],
133
+ ...cleanup.notDeleted.length === 0 ? [] : [["Sandboxes not deleted", cleanup.notDeleted.map(notDeletedText)]]
134
+ ];
135
+ }
136
+ function runnerCleanupWarnings(cleanup) {
137
+ if (cleanup === null) return [];
138
+ return [
139
+ ...cleanup.notKept === null ? [] : [{ reason: "runner_sandbox_not_kept", message: notKeptText(cleanup.notKept) }],
140
+ ...cleanup.notStopped.map((sandbox) => ({
141
+ reason: "runner_sandbox_not_stopped",
142
+ message: notStoppedText(sandbox)
143
+ })),
144
+ ...cleanup.notDeleted.map((sandbox) => ({
145
+ reason: "runner_sandbox_not_deleted",
146
+ message: notDeletedText(sandbox)
147
+ }))
148
+ ];
149
+ }
150
+ function runCleanupOf(reports) {
151
+ const schema = z.object({ runner: runnerCleanupSchema.nullable(), resources: reports.cleanupSchema });
152
+ const rows = (cleanup) => [
153
+ ...runnerCleanupRows(cleanup.runner),
154
+ ...reports.cleanupRows(cleanup.resources)
155
+ ];
156
+ return {
157
+ schema,
158
+ facts: ({ runnerCleanup, resourceCleanup }) => ({
159
+ runner: runnerCleanupOf(runnerCleanup),
160
+ resources: reports.cleanupFacts(resourceCleanup)
161
+ }),
162
+ rows
163
+ };
164
+ }
165
+ var RUN_CLEANUP = runCleanupOf(REGISTRY.reports);
166
+ function runnerCleanupOf(report) {
167
+ if (report === null) return null;
168
+ const { kept, target } = report;
169
+ return {
170
+ kept: kept === null ? null : { name: kept.name, stopsAt: kept.stopsAt, url: sandboxConnectPage(target, kept.name) },
171
+ notKept: report.notKept === null ? null : { ...report.notKept },
172
+ notStopped: report.notStopped.map(({ name, role, timeoutMinutes, message }) => ({
173
+ name,
174
+ role,
175
+ timeoutMinutes,
176
+ message
177
+ })),
178
+ notDeleted: report.notDeleted.map(({ name, role, message }) => ({ name, role, message }))
179
+ };
180
+ }
181
+
182
+ // src/commands/exec/mint-failed.ts
183
+ import { z as z2 } from "zod";
184
+ var mintFailedErrors = defineErrors({
185
+ mintFailed: {
186
+ exitCode: 1,
187
+ description: "The vercel CLI couldn't mint a credential, so the command didn't run. In a sandboxed run, the credential was for the runner sandbox, which always needs one; in an unsandboxed run, for a resource that couldn't go on without it.",
188
+ schema: z2.object({
189
+ team: z2.string(),
190
+ project: z2.string(),
191
+ cause: z2.string(),
192
+ fix: z2.string(),
193
+ /** Whether the credential was for the runner sandbox, not for a resource. */
194
+ runner: z2.boolean(),
195
+ /** What the run couldn't clean up. */
196
+ cleanup: RUN_CLEANUP.schema
197
+ }),
198
+ render: ({ cause, fix, runner, cleanup }) => {
199
+ const rows = RUN_CLEANUP.rows(cleanup);
200
+ return {
201
+ message: runner ? `Couldn't mint a credential for the runner sandbox: ${cause}. The command didn't run.` : `Couldn't mint a credential: ${cause}. One of the run's resources needed it, so the command didn't run.`,
202
+ ...rows.length === 0 ? {} : { rows },
203
+ next: [{ type: "text", text: fix }]
204
+ };
205
+ }
206
+ }
207
+ });
208
+
209
+ // src/commands/exec/resource-refusals.ts
210
+ import { z as z3 } from "zod";
211
+ var refusalShape = {
212
+ /** The resource instance that refused, by its resource key. */
213
+ resource: z3.string().min(1),
214
+ /** The resource's own snake_case reason for refusing. */
215
+ refusal: z3.string(),
216
+ /** The resource's own data about the refusal, which differs by resource and reason. */
217
+ data: z3.record(z3.string(), z3.unknown())
218
+ };
219
+ function contentOf({ message, next, rows: own = [] }, rows) {
220
+ const all = [...own, ...rows];
221
+ return { message, ...next === void 0 ? {} : { next }, ...all.length === 0 ? {} : { rows: all } };
222
+ }
223
+ var resourceRefusalErrors = defineErrors({
224
+ resourceRefusedBeforeRun: {
225
+ exitCode: 2,
226
+ description: "A resource's beforeRun refused the run before it started, so nothing was minted, acquired or started. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
227
+ schema: z3.object({
228
+ ...refusalShape,
229
+ /** The config file that applied (its absolute path); null when none did. */
230
+ configFile: z3.string().nullable()
231
+ }),
232
+ render: (_data, refusal) => contentOf(refusal, [])
233
+ },
234
+ resourceRefused: {
235
+ exitCode: 1,
236
+ description: "A resource refused while the run acquired its resources, so the command didn't run. data.resource names the resource by its key, data.refusal is the resource's own reason, and data.data its own data.",
237
+ schema: z3.object({
238
+ ...refusalShape,
239
+ /** What the run couldn't clean up. */
240
+ cleanup: RUN_CLEANUP.schema
241
+ }),
242
+ render: ({ cleanup }, refusal) => contentOf(refusal, RUN_CLEANUP.rows(cleanup))
243
+ }
244
+ });
245
+ function resourceRefusedBeforeRun(resource, refusal, configFile) {
246
+ const { refused: refused2, data, ...content } = refusal;
247
+ return resourceRefusalErrors.resourceRefusedBeforeRun(
248
+ { resource, refusal: refused2, data: { ...data }, configFile },
249
+ content
250
+ );
251
+ }
252
+ function resourceRefused(outcome, cleanup) {
253
+ const { refused: refused2, data, ...content } = outcome.refusal;
254
+ return resourceRefusalErrors.resourceRefused(
255
+ { resource: outcome.resource, refusal: refused2, data: { ...data }, cleanup },
256
+ content
257
+ );
258
+ }
259
+
260
+ // src/commands/exec/outcomes.ts
261
+ var runnerFailureSchema = z4.union([
262
+ z4.object({
263
+ kind: z4.enum(["snapshot-build-step-failed", "apply-failed", "install-failed", "build-failed"]),
264
+ /** The step's label. */
265
+ label: z4.string(),
266
+ /** Its exit code; null when it ended without one. */
267
+ exitCode: z4.number().nullable(),
268
+ /** Its last 40 output lines. */
269
+ tail: z4.array(z4.string())
270
+ }),
271
+ z4.object({
272
+ kind: z4.literal("sandbox-api-failed"),
273
+ /** The Sandbox call that failed. */
274
+ operation: z4.string(),
275
+ /** The HTTP status the Sandbox API answered; null when it answered none. */
276
+ status: z4.number().nullable(),
277
+ message: z4.string()
278
+ }),
279
+ z4.object({
280
+ kind: z4.literal("checkout-failed"),
281
+ /** What git or tar said. */
282
+ message: z4.string(),
283
+ /** The failed command; null when there was none. */
284
+ command: z4.string().nullable()
285
+ }),
286
+ z4.object({ kind: z4.literal("credential-claims-missing"), team: z4.string(), project: z4.string() })
287
+ ]);
288
+ function listed(names) {
289
+ if (names.length <= 1) return names.join("");
290
+ return `${names.slice(0, -1).join(", ")} and ${names.at(-1) ?? ""}`;
291
+ }
292
+ function stepEnded(exitCode) {
293
+ return exitCode === null ? "ended without an exit code" : `exited ${exitCode}`;
294
+ }
295
+ function runnerFailureText(failure) {
296
+ switch (failure.kind) {
297
+ case "snapshot-build-step-failed":
298
+ return {
299
+ message: `The runner snapshot build's step "${failure.label}" ${stepEnded(failure.exitCode)}. The command didn't run.`,
300
+ next: "Fix the step in the runner recipe, then retry. A failed build records no runner snapshot."
301
+ };
302
+ case "apply-failed":
303
+ return {
304
+ message: `Couldn't apply your changes in the runner sandbox: "${failure.label}" ${stepEnded(failure.exitCode)}. The command didn't run.`,
305
+ next: "Check the output for the file that didn't apply, then retry."
306
+ };
307
+ case "install-failed":
308
+ return {
309
+ message: `The runner's install, "${failure.label}", ${stepEnded(failure.exitCode)}. The command didn't run.`,
310
+ next: "Fix run.install in the runner recipe, or what it installs, then retry."
311
+ };
312
+ case "build-failed":
313
+ return {
314
+ message: `The runner's build, "${failure.label}", ${stepEnded(failure.exitCode)}. The command didn't run.`,
315
+ next: "Fix the build, or run.build in the runner recipe, then retry."
316
+ };
317
+ case "sandbox-api-failed":
318
+ return {
319
+ message: `A Vercel Sandbox call failed (${failure.operation}${failure.status === null ? "" : `, HTTP ${failure.status}`}): ${failure.message}. ${failure.operation === "run-command" ? "The command's outcome is unknown." : "The command didn't run."}`,
320
+ next: "Retry; if it keeps failing, check the Vercel Sandbox status and the project's Sandbox access."
321
+ };
322
+ case "checkout-failed":
323
+ return {
324
+ message: `git or tar failed on this machine: ${failure.message}. The command didn't run.`,
325
+ next: "Fix the checkout, then retry."
326
+ };
327
+ case "credential-claims-missing":
328
+ return {
329
+ message: `The credential minted for project ${failure.project} on team ${failure.team} names no team and project ids (its owner_id and project_id claims), so the runner sandbox can't use it. The command didn't run.`,
330
+ next: "Mint for a Vercel project whose development OIDC tokens carry owner_id and project_id, then retry."
331
+ };
332
+ }
333
+ }
334
+ var ranSchema = z4.object({
335
+ /** storm's version. */
336
+ version: z4.string(),
337
+ /** The git commit storm was built from, as its version line shows it (`3f2a9c1b7d4e`, `-dirty` appended when built from a tree with uncommitted changes); null when unknown. */
338
+ commit: z4.string().nullable(),
339
+ /** The config file the run's settings came from (its absolute path); null when none applied. */
340
+ configFile: z4.string().nullable(),
341
+ /**
342
+ * What each acquired resource instance that reports something says of itself, keyed by resource key: its
343
+ * definition's name (`definition`), its facts (`facts`, what its acquire answered, unknown to the schema, or null
344
+ * when it answered none) and the warnings its acquire reported (`warnings`).
345
+ */
346
+ resources: REGISTRY.reports.ranSchema,
347
+ /**
348
+ * What the run's cleanup left: the runner sandbox it kept running and the runner's sandboxes it couldn't stop or
349
+ * delete (`runner`, null without a runner sandbox), and what releasing each of its resource instances couldn't do,
350
+ * its warnings, keyed by resource key, each with its definition's name (`resources`, `{}` when it took none).
351
+ */
352
+ cleanup: RUN_CLEANUP.schema,
353
+ /**
354
+ * How the command ended: its exit code, or the signal that ended it; both null for a command in the runner sandbox
355
+ * that ended without an exit code.
356
+ */
357
+ command: z4.object({ exitCode: z4.number().nullable(), signal: z4.string().nullable() }),
358
+ /** The runner sandbox the command ran in; null without one. */
359
+ runner: z4.object({
360
+ /** The runner snapshot it started from. */
361
+ snapshotId: z4.string(),
362
+ /** The runner snapshot's base, a full SHA. */
363
+ base: z4.string(),
364
+ /** For a branch snapshot, the local branch of the run that saved it; null for a base snapshot. */
365
+ snapshotBranch: z4.string().nullable(),
366
+ /** For a branch snapshot, the HEAD commit of the run that saved it, a full SHA; null for a base snapshot. */
367
+ snapshotHead: z4.string().nullable(),
368
+ /** Whether this run built the runner snapshot. */
369
+ built: z4.boolean(),
370
+ vcpus: z4.number(),
371
+ region: z4.string(),
372
+ runtime: z4.string(),
373
+ /** How long the build step took, in milliseconds. */
374
+ buildMs: z4.number(),
375
+ /** How saving the runner sandbox as a branch snapshot ended; null when the run started no save. */
376
+ save: saveSchema.nullable()
377
+ }).nullable(),
378
+ /** The run's waterfall, as the run directory's timeline.json holds it: each lane's label, span and steps in milliseconds since the run started, how they ended, idle time, and the critical path. */
379
+ timeline: timelineSchema,
380
+ /** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
381
+ runId: z4.string().nullable()
382
+ });
383
+ var RAN_DESCRIPTION = "The command ran and ended. storm exits with its code, or 128 + n when signal n ended it, whatever this result's exit code.";
384
+ function renderRan(ran) {
385
+ const warnings = [
386
+ ...REGISTRY.reports.ranWarnings(ran.resources),
387
+ ...ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null ? [
388
+ {
389
+ reason: "sandboxed_no_exit_code",
390
+ message: "The command ended in the runner sandbox without an exit code, so storm exits 1."
391
+ }
392
+ ] : [],
393
+ ...runnerCleanupWarnings(ran.cleanup.runner),
394
+ ...REGISTRY.reports.cleanupWarnings(ran.cleanup.resources)
395
+ ];
396
+ const kept = ran.cleanup.runner?.kept ?? null;
397
+ return renderOutcome({
398
+ ...kept === null ? {} : { message: keptText(kept) },
399
+ ...warnings.length === 0 ? {} : { warnings }
400
+ });
401
+ }
402
+ var runErrors = defineErrors({
403
+ credentialUnused: {
404
+ exitCode: 2,
405
+ description: "--credential was given to a run with no resource that takes a credential.",
406
+ schema: z4.object({
407
+ /** The flags given that none of the run's resources takes, as typed, such as --credential. */
408
+ flags: z4.array(z4.string()),
409
+ /** The config file that applied; null when none did. */
410
+ configFile: z4.string().nullable()
411
+ }),
412
+ render: ({ flags }) => ({
413
+ message: `${flags.join(", ")} ${flags.length === 1 ? "applies" : "apply"} only to a run with a resource that takes a credential, and this run has none.`,
414
+ next: [
415
+ {
416
+ type: "text",
417
+ text: `Drop ${flags.join(" and ")}, or give the run a resource that takes a credential, in storm.config.ts or on the command line.`
418
+ }
419
+ ]
420
+ })
421
+ },
422
+ missingRunner: {
423
+ exitCode: 2,
424
+ description: "A sandboxed run (no --unsandboxed) needs a runner recipe, and no storm.config.ts gives a runner key.",
425
+ schema: z4.object({
426
+ /** The config file that applied; null when none did. */
427
+ configFile: z4.string().nullable()
428
+ }),
429
+ render: ({ configFile }) => ({
430
+ message: configFile === null ? "A sandboxed run needs a runner recipe, and no storm.config.ts applies." : `A sandboxed run needs a runner recipe, and ${configFile} has no runner key.`,
431
+ next: [
432
+ {
433
+ type: "text",
434
+ text: "Add a runner recipe under the runner key of storm.config.ts, or run on this machine with --unsandboxed."
435
+ }
436
+ ]
437
+ })
438
+ },
439
+ runnerSecretsInvalid: {
440
+ exitCode: 2,
441
+ description: "In a sandboxed run, launcher environment variables the runner recipe's secrets key names can't be used, so the run didn't start: it minted, acquired and created nothing. Each variable has one problem, the first of: missing, unset or empty; multiline, its value holds a carriage return or a line feed, which line-by-line output would split past storm's redaction; short, its value holds fewer than 8 characters, and storm shows each value as <token> wherever it appears in what it prints and writes, so a value that short would hide ordinary output.",
442
+ schema: z4.object({
443
+ /** Each variable storm can't use and why, in the recipe's order. */
444
+ variables: z4.array(z4.object({ name: z4.string(), problem: z4.enum(["missing", "multiline", "short"]) })),
445
+ /** The fewest characters a runner secret's value may have. */
446
+ minLength: z4.number(),
447
+ /** The config file that gave the runner recipe. */
448
+ configFile: z4.string().nullable()
449
+ }),
450
+ render: ({ variables, minLength, configFile }) => {
451
+ const named = (problem) => variables.filter((variable) => variable.problem === problem).map(({ name }) => name);
452
+ const [missing, multiline, short2] = [named("missing"), named("multiline"), named("short")];
453
+ return {
454
+ message: `runner.secrets${configFile === null ? "" : ` in ${configFile}`} names ${variables.length === 1 ? "a variable" : "variables"} storm can't use. The run didn't start.`,
455
+ rows: [
456
+ [
457
+ "Runner secrets",
458
+ variables.map(
459
+ ({ name, problem }) => problem === "missing" ? `${name} is not set` : problem === "multiline" ? `${name} holds a carriage return or a line feed` : `${name} holds fewer than ${minLength} characters`
460
+ )
461
+ ]
462
+ ],
463
+ next: [
464
+ {
465
+ type: "text",
466
+ text: [
467
+ ...missing.length === 0 ? [] : [`Set ${listed(missing)} in this machine's environment.`],
468
+ ...multiline.length === 0 ? [] : [
469
+ `Set ${listed(multiline)} to a value on one line: storm hides each value in output a line at a time, and doesn't trim one.`
470
+ ],
471
+ ...short2.length === 0 ? [] : [`Set ${listed(short2)} to the whole secret.`]
472
+ ].join(" ")
473
+ },
474
+ { type: "text", text: "Or run on this machine with --unsandboxed, which reads no runner secret." }
475
+ ]
476
+ };
477
+ }
478
+ },
479
+ noBaseRef: {
480
+ exitCode: 1,
481
+ description: "In a sandboxed run, none of the runner recipe's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.",
482
+ schema: z4.object({
483
+ /** Each ref in baseRefs, and why it gave no base. */
484
+ refs: z4.array(z4.object({ ref: z4.string(), reason: z4.enum(["missing", "unrelated"]) }))
485
+ }),
486
+ render: ({ refs }) => ({
487
+ message: `No base for the runner: none of ${refs.map(({ ref }) => ref).join(", ")} exists locally and shares history with HEAD. The command didn't run.`,
488
+ rows: [
489
+ [
490
+ "Base refs",
491
+ refs.map(
492
+ ({ ref, reason }) => reason === "missing" ? `${ref}: no such local ref` : `${ref}: shares no history with HEAD`
493
+ )
494
+ ]
495
+ ],
496
+ next: [
497
+ {
498
+ type: "text",
499
+ text: refs.some(({ ref }) => ref === "main" || ref === "origin/main") ? "Run git fetch origin main, then retry." : `Fetch or create one of ${refs.map(({ ref }) => ref).join(", ")}, then retry.`
500
+ }
501
+ ]
502
+ })
503
+ },
504
+ submodulesRefused: {
505
+ exitCode: 1,
506
+ description: "In a sandboxed run, the checkout has Git submodules, which neither the upload nor the base's files carry.",
507
+ schema: z4.object({ paths: z4.array(z4.string()) }),
508
+ render: ({ paths }) => ({
509
+ message: `The checkout has Git submodules, which the runner can't carry: ${paths.join(", ")}. The command didn't run.`,
510
+ next: [{ type: "text", text: "Run on this machine with --unsandboxed." }]
511
+ })
512
+ },
513
+ snapshotGone: {
514
+ exitCode: 1,
515
+ description: "In a sandboxed run, the cached runner snapshot the run picked was gone (the Sandbox API answered 410), so its cache entry was removed and the command didn't run. The next run picks another runner snapshot or builds one.",
516
+ schema: z4.object({
517
+ snapshotId: z4.string(),
518
+ /** The runner snapshot's base, a full SHA. */
519
+ base: z4.string(),
520
+ /** Why its cache entry couldn't be removed; null when it was. */
521
+ removal: z4.object({ path: z4.string(), message: z4.string() }).nullable(),
522
+ /** What the run couldn't clean up. */
523
+ cleanup: RUN_CLEANUP.schema
524
+ }),
525
+ render: ({ snapshotId, removal, cleanup }) => {
526
+ const rows = RUN_CLEANUP.rows(cleanup);
527
+ return {
528
+ message: `Runner snapshot ${snapshotId} is gone, before its cache entry said it expires. ${removal === null ? "Removed its cache entry." : `Couldn't remove its cache entry at ${removal.path}: ${removal.message}.`} The command didn't run.`,
529
+ ...rows.length === 0 ? {} : { rows },
530
+ next: [
531
+ {
532
+ type: "text",
533
+ text: removal === null ? "Run again: the next run picks another runner snapshot or builds one." : `Remove ${removal.path}, then run again.`
534
+ }
535
+ ]
536
+ };
537
+ }
538
+ },
539
+ runnerFailed: {
540
+ exitCode: 1,
541
+ description: "In a sandboxed run, the runner couldn't run the command: a snapshot build step, applying the changes, the install or the build failed (with the step's last 40 output lines), a Vercel Sandbox call failed, git or tar failed on this machine, or the credential names no team and project ids.",
542
+ schema: z4.object({
543
+ failure: runnerFailureSchema,
544
+ /** What the run couldn't clean up; its `runner` is null when the run failed before it started a sandbox. */
545
+ cleanup: RUN_CLEANUP.schema
546
+ }),
547
+ render: ({ failure, cleanup }) => {
548
+ const { message, next } = runnerFailureText(failure);
549
+ const rows = [
550
+ ..."tail" in failure && failure.tail.length > 0 ? [["Last output", failure.tail]] : [],
551
+ ...failure.kind === "checkout-failed" && failure.command !== null ? [["Command", failure.command]] : [],
552
+ ...RUN_CLEANUP.rows(cleanup)
553
+ ];
554
+ return { message, ...rows.length === 0 ? {} : { rows }, next: [{ type: "text", text: next }] };
555
+ }
556
+ },
557
+ spawnFailed: {
558
+ exitCode: 1,
559
+ description: "The command couldn't start.",
560
+ schema: z4.object({
561
+ /** The command's first argument: what storm tried to run. */
562
+ executable: z4.string(),
563
+ /** What the OS said. */
564
+ message: z4.string(),
565
+ /**
566
+ * What the run couldn't clean up; its `runner` is null, since only a run without a runner sandbox spawns its
567
+ * command here.
568
+ */
569
+ cleanup: RUN_CLEANUP.schema
570
+ }),
571
+ render: ({ executable, message, cleanup }) => {
572
+ const rows = RUN_CLEANUP.rows(cleanup);
573
+ return {
574
+ message: `Couldn't start the command ${executable}: ${message}`,
575
+ ...rows.length === 0 ? {} : { rows },
576
+ next: [
577
+ { type: "text", text: "Check the command after --; it runs with no shell, as the argument list given." }
578
+ ]
579
+ };
580
+ }
581
+ }
582
+ });
583
+ var RUN_ERRORS = {
584
+ ...configErrors,
585
+ ...credentialErrors,
586
+ // A resource's refusal, before the run starts or while it acquires.
587
+ ...resourceRefusalErrors,
588
+ ...mintFailedErrors,
589
+ ...runErrors
590
+ };
591
+ var outcomes = defineOutcomes({
592
+ results: { ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: renderRan } },
593
+ errors: RUN_ERRORS
594
+ });
595
+
596
+ // src/commands/exec/redaction.ts
597
+ function redactor(secrets) {
598
+ const kept = secrets.filter((secret) => secret !== "");
599
+ return kept.length === 0 ? (text) => text : (text) => redactSecrets(text, kept);
600
+ }
601
+ function redactStrings(value, redact) {
602
+ if (typeof value === "string") return redact(value);
603
+ if (Array.isArray(value)) return value.map((each) => redactStrings(each, redact));
604
+ if (typeof value === "object" && value !== null) {
605
+ const prototype = Object.getPrototypeOf(value);
606
+ if (prototype !== Object.prototype && prototype !== null) return value;
607
+ return Object.fromEntries(
608
+ Object.entries(value).map(([key, each]) => [key, redactStrings(each, redact)])
609
+ );
610
+ }
611
+ return value;
612
+ }
613
+ function redactingObserver(observer, redact) {
614
+ return {
615
+ observe: async (timed) => await observer.observe({ event: redactStrings(timed.event, redact), at: timed.at })
616
+ };
617
+ }
618
+ function redactingTerminal(terminal, redact) {
619
+ return {
620
+ color: terminal.color,
621
+ writeStdout: (text) => terminal.writeStdout(redact(text)),
622
+ writeStderr: (text) => terminal.writeStderr(redact(text))
623
+ };
624
+ }
625
+
626
+ // src/commands/exec/plan-run.ts
627
+ async function planRun(app, lifecycles, request, planCommand, signal) {
628
+ const file = await loadSettingsFile(app.context.config, app.cwd, RESOURCES);
629
+ if (!file.ok) return file;
630
+ const configFile = file.path;
631
+ const settings = fileSettings(file, request);
632
+ let where;
633
+ if (request.unsandboxed) where = { kind: "unsandboxed" };
634
+ else {
635
+ if (settings.runner === void 0) return refused(runErrors.missingRunner({ configFile }));
636
+ const required = requireTarget(settings.scope, settings.project);
637
+ if (!required.ok) return required;
638
+ const recipe = settings.runner.value;
639
+ const secrets = readRunnerSecrets(recipe, app.env);
640
+ if (!secrets.ok)
641
+ return refused(
642
+ runErrors.runnerSecretsInvalid({
643
+ variables: secrets.variables.map(({ name, problem }) => ({ name, problem })),
644
+ minLength: RUNNER_SECRET_MIN_LENGTH,
645
+ configFile
646
+ })
647
+ );
648
+ where = { kind: "runner", recipe, target: required.target, secrets: secrets.values };
649
+ }
650
+ const merged = settleRunResources(file, request.given);
651
+ if (!merged.ok) return merged;
652
+ const command = await planCommand(where, signal);
653
+ if (signal.aborted) return refused(canceledBeforeStart());
654
+ if (!command.ok) {
655
+ const secrets = [
656
+ ...where.kind === "runner" ? Object.values(where.secrets) : [],
657
+ ...lifecycles.secrets(merged.options)
658
+ ];
659
+ return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
660
+ }
661
+ const run = Object.freeze({ testPlan: command.testPlan });
662
+ const resolved = merged.plan(run);
663
+ if (!resolved.ok) return resolved;
664
+ return {
665
+ ok: true,
666
+ configFile,
667
+ settings,
668
+ where,
669
+ argv: command.argv,
670
+ testPlan: command.testPlan,
671
+ resources: resolved.resources,
672
+ planOptions: resolved.planned.map(planOption)
673
+ };
674
+ }
675
+ function planOption({ path, value, source }) {
676
+ return { path, value, from: source };
677
+ }
678
+ async function resourcesBeforeRun(lifecycles, plan, request) {
679
+ const { configFile, resources, settings } = plan;
680
+ const used = await lifecycles.beforeRun(resources);
681
+ if (!used.ok) return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
682
+ if (request.credential !== void 0 && !used.needsVercelCredential)
683
+ return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
684
+ let where;
685
+ if (plan.where.kind === "runner") where = plan.where;
686
+ else if (used.needsVercelCredential) {
687
+ const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
688
+ if (!chosen.ok) return chosen;
689
+ where = { kind: "unsandboxed", credential: chosen.credential };
690
+ } else where = { kind: "unsandboxed", credential: void 0 };
691
+ return { ok: true, where, used };
692
+ }
693
+ function canceledBeforeStart() {
694
+ return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
695
+ }
696
+
697
+ // src/commands/exec/run-command.ts
698
+ import { z as z5 } from "zod";
699
+
700
+ // src/commands/exec/job-summary.ts
701
+ function jobSummaryMarkdown(timeline, extras) {
702
+ const lines = [`### storm ${extras.command}`, ""];
703
+ if (timeline.rows.length > 0) {
704
+ lines.push("| Lane | Start | Duration | Idle | Steps |", "| --- | ---: | ---: | ---: | --- |");
705
+ for (const row of timeline.rows) lines.push(tableRow(row));
706
+ lines.push("");
707
+ }
708
+ if (timeline.criticalPath.length > 0) {
709
+ const path = timeline.criticalPath.map((step) => criticalPathStep(step, timeline));
710
+ lines.push(`Critical path: ${path.join(" \u2192 ")}`, "");
711
+ }
712
+ for (const detail of extras.details ?? []) lines.push(`${detail.trim()} `);
713
+ if ((extras.details ?? []).length > 0) lines.push("");
714
+ if (extras.logs !== void 0) lines.push(`Run directory: \`${extras.logs}\``, "");
715
+ return lines.join("\n");
716
+ }
717
+ function tableRow(row) {
718
+ const outcome = row.outcome === "done" ? "" : ` (${row.outcome})`;
719
+ const steps = row.steps.map((step) => `${step.name} ${seconds(step.endMs - step.startMs)}`).join(" \xB7 ");
720
+ const idle = row.idleMs > 0 ? seconds(row.idleMs) : "";
721
+ return `| ${row.label}${outcome} | +${seconds(row.startMs)} | ${seconds(row.endMs - row.startMs)} | ${idle} | ${steps} |`;
722
+ }
723
+
724
+ // src/commands/exec/progress.ts
725
+ function lineProgress(write, options = { github: false }) {
726
+ let failed = false;
727
+ const render = plainRenderer(options);
728
+ return {
729
+ observe: async (timed) => {
730
+ for (const line of render(timed)) {
731
+ if (failed) return;
732
+ try {
733
+ await write(line);
734
+ } catch {
735
+ failed = true;
736
+ }
737
+ }
738
+ }
739
+ };
740
+ }
741
+ function plainRenderer(options) {
742
+ const state = {
743
+ origin: void 0,
744
+ resourceLanes: [],
745
+ instances: [],
746
+ mintStartedAt: void 0,
747
+ lanesStartedAt: void 0,
748
+ readyAt: { runner: void 0, resources: {} },
749
+ cleanupStartedAt: void 0,
750
+ folded: false
751
+ };
752
+ const resources = REGISTRY.presentations.plain({ verbose: options.verbose === true });
753
+ return ({ event, at }) => {
754
+ const now = at.getTime();
755
+ state.origin ??= now;
756
+ const origin = state.origin;
757
+ const line = (lane, text) => progressLine(now - origin, lane, text);
758
+ if (event.kind === "resource") return resources(event, now).map(({ lane, text }) => line(lane, text));
759
+ return eventLines(event, now, state, line, options);
760
+ };
761
+ }
762
+ function progressLine(elapsedMs, lane, text) {
763
+ return `[+${secondsText(secondsOf(elapsedMs))}] ${lane.padEnd(LANE_WIDTH)} ${text}`;
764
+ }
765
+ var LANE_WIDTH = Math.max(
766
+ ...["run", "mint", "runner", "command", "cleanup", ...REGISTRY.presentations.laneKinds.map(({ lane }) => lane)].map(
767
+ (lane) => lane.length
768
+ )
769
+ );
770
+ function eventLines(event, now, state, line, options) {
771
+ const since = (start) => seconds(now - (start ?? now));
772
+ switch (event.kind) {
773
+ case "started":
774
+ state.resourceLanes = event.resources.flatMap(
775
+ ({ resource, lane }) => lane === null ? [] : [{ lane, resource }]
776
+ );
777
+ state.instances = event.resources;
778
+ return [
779
+ line("run", `storm ${versionText(event.version, event.commit)}`),
780
+ ...event.configFile === null ? [] : [line("run", `config ${event.configFile}`)]
781
+ ];
782
+ case "resource-skipped":
783
+ return [line("run", skippedText(event))];
784
+ // An acquired resource says what it holds in its acquire's `announce`, the progress event that follows.
785
+ case "resource-acquired":
786
+ return [];
787
+ // A line a resource instance reported, in the run's lane or the cleanup's, and a warning, marked as one.
788
+ case "resource-notice":
789
+ return [line(event.lane, event.text)];
790
+ case "resource-warning":
791
+ return [line(event.lane, resourceWarningText(event))];
792
+ case "minting":
793
+ state.mintStartedAt = now;
794
+ return [line("mint", `credential for ${mintTargetText(event.target)}\u2026`)];
795
+ case "minted":
796
+ return [
797
+ line(
798
+ "mint",
799
+ `${event.ok ? "credential" : "no credential"} for ${mintTargetText(event.target)} (${since(state.mintStartedAt)})`
800
+ )
801
+ ];
802
+ case "requesting-token":
803
+ return [line("mint", "requesting a GitHub Actions OIDC token\u2026")];
804
+ case "lanes-started":
805
+ state.lanesStartedAt = now;
806
+ return state.resourceLanes.length === 0 ? [] : [line("run", `${[...state.resourceLanes.map(({ lane }) => lane), "runner"].join(" \u2016 ")} start together`)];
807
+ case "lane-ended": {
808
+ const ran = since(state.lanesStartedAt ?? state.origin);
809
+ if (event.outcome !== "ready") return [line(event.lane, `${event.outcome} (${ran})`)];
810
+ if (state.lanesStartedAt === void 0) return [];
811
+ if (event.resource === null) state.readyAt.runner = now;
812
+ else state.readyAt.resources[event.resource] = now;
813
+ const ready = `ready (${ran})`;
814
+ if (state.resourceLanes.length === 0) return [line(event.lane, ready)];
815
+ const others = event.resource === null ? state.resourceLanes : [{ lane: "runner", resource: null }];
816
+ const readyAt = (lane) => lane.resource === null ? state.readyAt.runner : state.readyAt.resources[lane.resource];
817
+ const waiting = others.filter((other) => readyAt(other) === void 0).map(({ lane }) => lane);
818
+ if (waiting.length > 0) return [line(event.lane, `${ready}; waiting for ${waiting.join(", ")}`)];
819
+ const waited = others.map((other) => `${other.lane} waited ${seconds(now - (readyAt(other) ?? now))}`);
820
+ return [line(event.lane, `${ready}; ${waited.join(", ")}`)];
821
+ }
822
+ // A resource lane's start shows in its first line of its own.
823
+ case "lane-started":
824
+ return [];
825
+ case "command-started":
826
+ return [line("command", `running ${event.argv.join(" ")}`)];
827
+ case "command-ended":
828
+ return [line("command", `${event.command} ${commandEnd(event.outcome)} after ${seconds(event.ms)}`)];
829
+ case "cleanup-started":
830
+ state.cleanupStartedAt = now;
831
+ return [line("cleanup", cleanupText(event.runnerSandbox, releaseText(event.resources, false)))];
832
+ case "cleanup-finished": {
833
+ const problems = [
834
+ ...event.notStopped === 0 ? [] : [`${event.notStopped} not stopped`],
835
+ ...event.notDeleted === 0 ? [] : [`${event.notDeleted} not deleted`],
836
+ ...event.resourceWarnings === 0 ? [] : [warningTally(event.resourceWarnings)]
837
+ ];
838
+ return [
839
+ line(
840
+ "cleanup",
841
+ `${problems.length === 0 ? "done" : `done: ${problems.join(", ")}`} (${since(state.cleanupStartedAt)})`
842
+ )
843
+ ];
844
+ }
845
+ case "runner-prepared":
846
+ return [
847
+ line("runner", `base ${short(event.base)}, HEAD's merge-base with ${event.baseRef}`),
848
+ ...preparedNoteTexts(event).map((text) => line("runner", text))
849
+ ];
850
+ // The command's own output carries its tests' results; the summary counts them.
851
+ // The summary says when the test results may be incomplete.
852
+ case "test":
853
+ case "test-event-unreadable":
854
+ case "test-events-incomplete":
855
+ return [];
856
+ case "runner":
857
+ return runnerLines(event.event, state, line, options);
858
+ }
859
+ }
860
+ function runnerLines(event, state, line, options) {
861
+ switch (event.kind) {
862
+ case "snapshot-reused":
863
+ return [line("runner", snapshotReusedText(event))];
864
+ case "snapshot-build-started":
865
+ return [
866
+ line(
867
+ "runner",
868
+ `building a runner snapshot of base ${short(event.base)} (${event.reason === "rebuild" ? "--rebuild-snapshot" : "no cached runner snapshot fits"}); this takes a few minutes: ${event.summary}`
869
+ )
870
+ ];
871
+ case "runner-sandbox-starting":
872
+ return [];
873
+ case "sandbox-started":
874
+ return [
875
+ line(
876
+ "runner",
877
+ `started the ${event.role === "runner" ? "runner" : "build"} sandbox ${event.name} in ${event.region}, ${event.vcpus} vCPUs (${seconds(event.ms)})`
878
+ )
879
+ ];
880
+ case "output-started":
881
+ return [];
882
+ case "output-ended":
883
+ return event.outcome === "finished" ? [] : [...closeFold(state), line("runner", `${event.section} ${event.outcome}`)];
884
+ case "step-started": {
885
+ const text = `${event.phase}: ${event.label}`;
886
+ if (!options.github) return [line("runner", text)];
887
+ state.folded = true;
888
+ return [`::group::${line("runner", text)}`];
889
+ }
890
+ case "step-output":
891
+ return [event.line];
892
+ case "step-finished":
893
+ return [...closeFold(state), line("runner", `${event.phase}: ${event.label}, done in ${seconds(event.ms)}`)];
894
+ case "snapshot-saving":
895
+ return [line("runner", "saving the build sandbox as a runner snapshot\u2026")];
896
+ case "snapshot-built":
897
+ return [
898
+ line(
899
+ "runner",
900
+ `built runner snapshot ${event.snapshotId} of base ${short(event.base)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`
901
+ )
902
+ ];
903
+ case "snapshot-entry-not-written":
904
+ return [line("runner", cacheWriteFailureText(event.failure))];
905
+ case "uploading":
906
+ return [];
907
+ case "uploaded":
908
+ return [line("runner", `uploaded your changes, ${megabytesText(event.bytes)} (${seconds(event.ms)})`)];
909
+ case "command-output-started":
910
+ return [line("command", `in the runner sandbox ${event.sandbox} (${event.region})`)];
911
+ case "command-stopped":
912
+ return [line("command", `${event.command} stopped`)];
913
+ case "stopping":
914
+ return [
915
+ line(
916
+ "cleanup",
917
+ `stopping: ${event.commandRunning ? "killing the command, then " : ""}${event.keepMs > 0 ? `keeping the runner sandbox running ${keepTimeText(event.keepMs)}` : "stopping and deleting the runner's sandboxes"}${releasingText(state.instances)}\u2026`
918
+ )
919
+ ];
920
+ case "waiting-for-snapshot":
921
+ return [
922
+ line(
923
+ "cleanup",
924
+ `waiting up to ${Math.round(event.settleMs / 6e4)} minutes for the runner snapshot still saving\u2026`
925
+ )
926
+ ];
927
+ case "sandbox-kept":
928
+ return [line("cleanup", `kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}`)];
929
+ // The cleanup line says the run saves a branch snapshot.
930
+ case "branch-snapshot-saving":
931
+ return [];
932
+ case "branch-snapshot-saved":
933
+ case "branch-snapshot-not-saved":
934
+ return [line("cleanup", branchSnapshotSaveText(event))];
935
+ case "branch-snapshots-dropped":
936
+ case "branch-snapshots-not-dropped":
937
+ return [line("runner", branchSnapshotsDropText(event))];
938
+ }
939
+ }
940
+ function snapshotReusedText(event) {
941
+ const reused = `reusing runner snapshot ${event.snapshotId} of base ${short(event.base)}`;
942
+ return event.branch === null || event.head === null ? reused : `${reused} (branch ${event.branch} at ${short(event.head)})`;
943
+ }
944
+ function branchSnapshotSaveText(event) {
945
+ if (event.kind === "branch-snapshot-saved") {
946
+ return `saved branch snapshot ${event.snapshotId} for ${event.branch} at ${short(event.head)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`;
947
+ }
948
+ return `not saving a branch snapshot: ${notSavedReason(event.save)}`;
949
+ }
950
+ function notSavedReason(save) {
951
+ switch (save.kind) {
952
+ case "failed":
953
+ return `the ${save.step === "scrub" ? "scrub" : "save"} failed: ${save.message}`;
954
+ case "stopped":
955
+ return "the run is stopping";
956
+ }
957
+ }
958
+ function branchSnapshotsDropText(event) {
959
+ if (event.kind === "branch-snapshots-not-dropped")
960
+ return `couldn't drop a branch snapshot of ${event.branch} from the cache at ${event.failure.path}: ${event.failure.message}; a later run on the branch may start from it`;
961
+ const count = event.snapshotIds.length;
962
+ return `dropped ${count} branch ${count === 1 ? "snapshot" : "snapshots"} of ${event.branch} from the cache: ${event.snapshotIds.join(", ")}`;
963
+ }
964
+ function releasingText(instances) {
965
+ const release = releaseText(
966
+ instances.map(({ resource }) => resource),
967
+ false
968
+ );
969
+ return release === void 0 ? "" : ` and ${release}`;
970
+ }
971
+ function closeFold(state) {
972
+ if (!state.folded) return [];
973
+ state.folded = false;
974
+ return ["::endgroup::"];
975
+ }
976
+ function cleanupText(sandbox, release) {
977
+ if (sandbox === null) return release === void 0 ? "nothing to release" : `${release}\u2026`;
978
+ if (sandbox.kind === "save")
979
+ return `saving a branch snapshot of ${sandbox.branch}${release === void 0 ? "" : ` while ${release}`}\u2026`;
980
+ const sandboxes = sandbox.ms > 0 ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}` : "stopping and deleting the runner's sandboxes";
981
+ return `${sandboxes}${release === void 0 ? "" : `, then ${release}`}\u2026`;
982
+ }
983
+ function commandEnd(outcome) {
984
+ switch (outcome.kind) {
985
+ case "exited":
986
+ return `exited ${outcome.code}`;
987
+ case "signaled":
988
+ return `ended on ${outcome.signal}`;
989
+ case "no-exit-code":
990
+ return "ended without an exit code";
991
+ }
992
+ }
993
+ function noteText(note) {
994
+ switch (note.kind) {
995
+ case "cache-unreadable":
996
+ return `couldn't read the runner snapshot cache at ${note.failure.path}: ${note.failure.message}; treating it as empty`;
997
+ case "expired-entry-not-removed":
998
+ return `couldn't remove the expired cache entry for runner snapshot ${note.entry.snapshotId} at ${note.failure.path}: ${note.failure.message}`;
999
+ case "candidate-steps-failed":
1000
+ return `not reusing cached runner snapshots of base ${short(note.base)}: runner.${note.path.join(".")} ${note.problem.replace(/\.$/, "")}`;
1001
+ case "candidate-check-failed":
1002
+ return `not reusing cached runner snapshots of base ${short(note.base)}: ${note.failure.message.replace(/\.$/, "")}`;
1003
+ }
1004
+ }
1005
+ function resourceWarningText(warning) {
1006
+ return `warning: ${warning.message}`;
1007
+ }
1008
+ function skippedText(skipped) {
1009
+ return `no ${skipped.resource}: ${skipped.notice}`;
1010
+ }
1011
+ function preparedNoteTexts(prepared) {
1012
+ return [
1013
+ ...prepared.nestedRepositories.length === 0 ? [] : [`leaving out untracked nested Git repositories: ${prepared.nestedRepositories.join(", ")}`],
1014
+ ...prepared.notes.map(noteText),
1015
+ ...prepared.saveSkipped ? ["not saving a branch snapshot: HEAD is detached"] : []
1016
+ ];
1017
+ }
1018
+ function cacheWriteFailureText(failure) {
1019
+ return `couldn't record the runner snapshot in the cache at ${failure.path}: ${failure.message}; later runs won't reuse it`;
1020
+ }
1021
+
1022
+ // src/commands/exec/live-view.ts
1023
+ var SPINNER = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
1024
+ var INDENT = " ".repeat(LANE_WIDTH + 5);
1025
+ function laneHead(glyph, lane) {
1026
+ return ` ${glyph} ${lane.padEnd(LANE_WIDTH)} `;
1027
+ }
1028
+ function activePhase(state) {
1029
+ if (state.cleanup !== void 0) return "cleanup";
1030
+ if (state.command !== void 0) return "tests";
1031
+ if (state.lanesStartedAt !== void 0 && state.runner !== void 0) return "lanes";
1032
+ if (Object.keys(state.resources).length > 0 && state.runner === void 0) return "resources";
1033
+ if (state.mint !== void 0) return "credential";
1034
+ return void 0;
1035
+ }
1036
+ function instanceLanes(state) {
1037
+ return REGISTRY.presentations.lanes(state.instances ?? []);
1038
+ }
1039
+ function startedLanes(state) {
1040
+ return REGISTRY.presentations.lanes(
1041
+ Object.entries(state.resources).map(([resource, { definition }]) => ({ resource, definition }))
1042
+ );
1043
+ }
1044
+ function headerLine(state, paint2) {
1045
+ const version = state.version === void 0 ? "" : versionText(state.version.version, state.version.commit);
1046
+ const header = [
1047
+ `storm ${version}`.trimEnd(),
1048
+ ...state.base === void 0 ? [] : [`base ${short(state.base.sha)} (merge-base ${state.base.ref})`]
1049
+ ].join(" \xB7 ");
1050
+ return paint2.strong(header);
1051
+ }
1052
+ function phaseFrame(state, phase, now, width, paint2) {
1053
+ const view = {
1054
+ now,
1055
+ width,
1056
+ paint: paint2,
1057
+ glyph: (status) => statusGlyph(status, now, paint2),
1058
+ // A live row is cut to the width: one that wrapped would take a row the next redraw doesn't erase.
1059
+ row: (left, right) => spread(left, right, width),
1060
+ line: (text) => truncate(text, width)
1061
+ };
1062
+ switch (phase) {
1063
+ case "credential":
1064
+ return state.mint === void 0 ? [] : [credentialLine(state.mint, view)];
1065
+ case "lanes":
1066
+ return lanesFrame(state, view);
1067
+ case "resources":
1068
+ return unsandboxedResourcesFrame(state, view);
1069
+ case "tests":
1070
+ return testsFrame(state, view);
1071
+ case "cleanup":
1072
+ return state.cleanup === void 0 ? [] : [cleanupLine(state.cleanup, state.runner, view, false)];
1073
+ }
1074
+ }
1075
+ function phaseRecord(state, phase, width, paint2) {
1076
+ const view = {
1077
+ now: void 0,
1078
+ width,
1079
+ paint: paint2,
1080
+ glyph: (status) => statusGlyph(status === "running" ? "stopped" : status, 0, paint2),
1081
+ row: (left, right) => visibleLength(left) + visibleLength(right) + 1 <= width ? spread(left, right, width) : `${left}${right === "" ? "" : ` ${right}`}`,
1082
+ line: (text) => text
1083
+ };
1084
+ switch (phase) {
1085
+ case "credential":
1086
+ return state.mint === void 0 ? [] : [credentialLine(state.mint, view)];
1087
+ case "lanes":
1088
+ return lanesRecord(state, view);
1089
+ case "resources":
1090
+ return unsandboxedResourcesRecord(state, view);
1091
+ case "tests":
1092
+ return state.command === void 0 ? [] : [testsLine(state, state.command, view, false)];
1093
+ case "cleanup":
1094
+ return state.cleanup === void 0 ? [] : [cleanupLine(state.cleanup, state.runner, view, true)];
1095
+ }
1096
+ }
1097
+ function laneDraw(view) {
1098
+ return {
1099
+ now: view.now,
1100
+ paint: view.paint,
1101
+ glyph: view.glyph,
1102
+ line: view.line,
1103
+ elapsed: (from, to) => elapsed(view, from, to),
1104
+ seconds
1105
+ };
1106
+ }
1107
+ function elapsed(view, from, to) {
1108
+ const end = to ?? view.now;
1109
+ return from === void 0 || end === void 0 ? "" : seconds(end - from);
1110
+ }
1111
+ function credentialLine(mint, view) {
1112
+ return view.row(
1113
+ ` ${view.glyph(mint.status)} credential ${mintTargetText(mint.target)}`,
1114
+ elapsed(view, mint.startedAt, mint.endedAt)
1115
+ );
1116
+ }
1117
+ function lanesFrame(state, view) {
1118
+ const { runner } = state;
1119
+ if (runner === void 0) return [];
1120
+ const { paint: paint2 } = view;
1121
+ const stopping = (status) => state.stopping && status === "running";
1122
+ const draw = laneDraw(view);
1123
+ const resourceRows = instanceLanes(state).map((lane) => {
1124
+ const live = lane.live(state.resources, draw);
1125
+ if (live === void 0) return view.row(laneHead(view.glyph("running"), lane.lane), "");
1126
+ const { span } = live;
1127
+ const text = stopping(span.status) ? "stopping" : live.detail ?? live.text;
1128
+ const waiting = span.status === "done" && runner.status === "running" && span.endedAt !== void 0 && view.now !== void 0 ? `${paint2.faint(`waiting for runner +${seconds(view.now - span.endedAt)}`)} ` : "";
1129
+ return view.row(
1130
+ `${laneHead(view.glyph(span.status), lane.lane)}${text}`,
1131
+ `${waiting}${elapsed(view, span.startedAt, span.endedAt)}`
1132
+ );
1133
+ });
1134
+ const current = runner.steps.find(({ status }) => status === "running") ?? [...runner.steps].filter((step) => step.status !== "pending" && step.endedAt !== void 0).toSorted((a, b) => (a.endedAt ?? 0) - (b.endedAt ?? 0)).at(-1);
1135
+ const currentText = current === void 0 ? "" : [
1136
+ `${current.name}${stepLabel(current, runner) === "" ? "" : ` \xB7 ${stepLabel(current, runner)}`}`,
1137
+ current.startedAt === current.endedAt ? "" : elapsed(view, current.startedAt, current.endedAt),
1138
+ current.status === "failed" || current.status === "stopped" ? view.glyph(current.status) : ""
1139
+ ].filter((part) => part !== "").join(" ");
1140
+ const crumbs = stepsText(
1141
+ runner.steps.filter((step) => step !== current),
1142
+ view
1143
+ );
1144
+ const runnerText = stopping(runner.status) ? `stopping \xB7 ${currentText}` : currentText;
1145
+ const runnerRow = view.row(
1146
+ `${laneHead(runnerGlyph(runner, view), "runner")}${runnerText}${crumbs === "" ? "" : ` ${paint2.faint(crumbs)}`}`,
1147
+ elapsed(view, runner.startedAt, runner.endedAt)
1148
+ );
1149
+ const running = runner.steps.find(({ status }) => status === "running");
1150
+ const latest = running === void 0 ? void 0 : latestLine(running, runner);
1151
+ const output = activityText(runner) ?? (latest === "" ? void 0 : latest);
1152
+ return [...resourceRows, runnerRow, output === void 0 ? "" : view.line(`${INDENT}${paint2.faint(output)}`)];
1153
+ }
1154
+ function lanesRecord(state, view) {
1155
+ const { runner } = state;
1156
+ const lines = [];
1157
+ const draw = laneDraw(view);
1158
+ for (const lane of startedLanes(state)) {
1159
+ const record = lane.record(state.resources, draw);
1160
+ if (record === void 0) continue;
1161
+ const { span } = record;
1162
+ const waited = span.status === "done" && span.endedAt !== void 0 && runner?.endedAt !== void 0 && runner.endedAt > span.endedAt ? ` \xB7 waited ${seconds(runner.endedAt - span.endedAt)}` : "";
1163
+ lines.push(
1164
+ view.row(
1165
+ `${laneHead(view.glyph(span.status), lane.lane)}${record.text}`,
1166
+ `${elapsed(view, span.startedAt, span.endedAt)}${waited}`
1167
+ ),
1168
+ ...record.lines
1169
+ );
1170
+ }
1171
+ if (runner !== void 0) {
1172
+ const snapshot = runner.steps.find(({ name }) => name === "snapshot");
1173
+ const parts = [
1174
+ ...runner.sandbox === void 0 ? [] : [`${runner.sandbox.name} \xB7 ${runner.sandbox.region} \xB7 ${runner.sandbox.vcpus} vCPU`],
1175
+ ...snapshot === void 0 || snapshot.status === "pending" ? [] : [snapshotText(snapshot, runner)],
1176
+ ...runner.status === "failed" || runner.status === "stopped" ? [runner.status] : []
1177
+ ];
1178
+ lines.push(
1179
+ view.row(
1180
+ `${laneHead(runnerGlyph(runner, view), "runner")}${parts.join(" \xB7 ")}`,
1181
+ elapsed(view, runner.startedAt, runner.endedAt)
1182
+ )
1183
+ );
1184
+ const steps = stepsText(runner.steps, view);
1185
+ if (steps !== "") lines.push(view.line(`${INDENT}${steps}`));
1186
+ }
1187
+ return lines;
1188
+ }
1189
+ function runnerGlyph(runner, view) {
1190
+ return view.glyph(runner.steps.some(({ status }) => status === "failed") ? "failed" : runner.status);
1191
+ }
1192
+ function snapshotText(step, runner) {
1193
+ if (runner.snapshot?.kind === "reused" || runner.snapshot?.kind === "built")
1194
+ return `snapshot ${runner.snapshot.kind}`;
1195
+ return `snapshot build ${step.status === "running" ? "stopped" : step.status}`;
1196
+ }
1197
+ function stepLabel(step, runner) {
1198
+ if (step.name === "snapshot") {
1199
+ const { snapshot } = runner;
1200
+ if (snapshot === void 0) return step.label;
1201
+ if (snapshot.kind !== "building") return `${snapshot.id} ${snapshot.kind}`;
1202
+ return step.label === "" ? `building: ${snapshot.summary}` : step.label;
1203
+ }
1204
+ if (step.name === "upload" && runner.uploadBytes !== void 0) return megabytesText(runner.uploadBytes);
1205
+ return step.label;
1206
+ }
1207
+ function latestLine(step, runner) {
1208
+ if (step.latest !== void 0) return step.latest.trim();
1209
+ if (step.name === "snapshot" && step.label === "" && runner.buildSandbox !== void 0)
1210
+ return `build sandbox ${runner.buildSandbox} started`;
1211
+ return void 0;
1212
+ }
1213
+ function activityText(runner) {
1214
+ switch (runner.activity) {
1215
+ case "saving-snapshot":
1216
+ return "saving the build sandbox as a runner snapshot";
1217
+ case "waiting-for-snapshot":
1218
+ return WAITING_FOR_SNAPSHOT;
1219
+ case void 0:
1220
+ return void 0;
1221
+ }
1222
+ }
1223
+ var WAITING_FOR_SNAPSHOT = "waiting for the runner snapshot still saving";
1224
+ function stepsText(steps, view) {
1225
+ return steps.filter(
1226
+ (step) => step.status !== "pending" && step.status !== "running" && step.startedAt !== void 0 && step.endedAt !== void 0 && (step.endedAt > step.startedAt || step.status !== "done")
1227
+ ).map((step) => {
1228
+ const mark = step.status === "done" ? "" : ` ${view.glyph(step.status)}`;
1229
+ return `${step.name} ${seconds((step.endedAt ?? 0) - (step.startedAt ?? 0))}${mark}`;
1230
+ }).join(" \xB7 ");
1231
+ }
1232
+ function unsandboxedResourcesFrame(state, view) {
1233
+ const { mint } = state;
1234
+ const draw = laneDraw(view);
1235
+ const mintRow = mint !== void 0 && mint.status === "running" ? view.row(
1236
+ ` ${view.glyph("running")} minting a credential for ${mintTargetText(mint.target)}`,
1237
+ elapsed(view, mint.startedAt, mint.endedAt)
1238
+ ) : void 0;
1239
+ const rows = startedLanes(state).flatMap((lane) => {
1240
+ const row = lane.live(state.resources, draw);
1241
+ return row === void 0 ? [] : [{ lane: lane.lane, ...row }];
1242
+ });
1243
+ return rows.flatMap(({ lane, span, text, detail }, index) => [
1244
+ view.row(`${laneHead(view.glyph(span.status), lane)}${text}`, elapsed(view, span.startedAt, span.endedAt)),
1245
+ index === 0 && mintRow !== void 0 ? mintRow : detail !== void 0 ? view.line(` ${view.glyph("running")} ${detail}`) : ""
1246
+ ]);
1247
+ }
1248
+ function unsandboxedResourcesRecord(state, view) {
1249
+ const { mint } = state;
1250
+ const draw = laneDraw(view);
1251
+ const lanes = startedLanes(state).flatMap((lane) => {
1252
+ const record = lane.record(state.resources, draw);
1253
+ if (record === void 0) return [];
1254
+ const { span } = record;
1255
+ return [
1256
+ view.row(
1257
+ `${laneHead(view.glyph(span.status), lane.lane)}${record.text}`,
1258
+ elapsed(view, span.startedAt, span.endedAt)
1259
+ ),
1260
+ ...record.lines
1261
+ ];
1262
+ });
1263
+ if (lanes.length === 0) return [];
1264
+ return [...mint === void 0 ? [] : [credentialLine(mint, view)], ...lanes];
1265
+ }
1266
+ function testsFrame(state, view) {
1267
+ return state.command === void 0 ? [] : [testsLine(state, state.command, view, true)];
1268
+ }
1269
+ var LONG_FILE_MS = 1e4;
1270
+ function testsLine(state, command, view, live) {
1271
+ const { tests } = state;
1272
+ const end = command.outcome === void 0 ? void 0 : endText(command.outcome);
1273
+ const parts = [command.argv.join(" ")];
1274
+ if (end !== void 0) parts.push(end);
1275
+ else if (live && state.stopping) parts.push("stopping");
1276
+ const head = ` ${view.glyph(command.status)} tests `;
1277
+ const time = elapsed(view, command.startedAt, command.endedAt);
1278
+ const text = live && end === void 0 && !state.stopping && tests !== void 0 ? testsProgress(tests, view, view.width - visibleLength(head) - visibleLength(time) - 1) : parts.join(" ");
1279
+ return view.row(`${head}${text}`, time);
1280
+ }
1281
+ function testsProgress(tests, view, room) {
1282
+ const { paint: paint2, now } = view;
1283
+ const running = tests.workers.filter((worker) => worker.file !== void 0 || worker.containerSince !== void 0);
1284
+ const waiting = tests.workers.filter((worker) => worker.containerSince !== void 0).length;
1285
+ const longest = [...running].toSorted((a, b) => (a.fileStartedAt ?? 0) - (b.fileStartedAt ?? 0))[0];
1286
+ const longestMs = longest?.fileStartedAt === void 0 || now === void 0 ? void 0 : now - longest.fileStartedAt;
1287
+ const text = (showWaiting) => [
1288
+ `${tests.passed} passed`,
1289
+ ...tests.failed === 0 ? [] : [paint2.failed(`${tests.failed} failed`)],
1290
+ `${tests.filesDone} ${tests.filesDone === 1 ? "file" : "files"} done`,
1291
+ `${running.length} running${waiting === 0 || !showWaiting ? "" : ` (${waiting} waiting on a container)`}`,
1292
+ ...longest?.file === void 0 || longestMs === void 0 || longestMs < LONG_FILE_MS ? [] : [`longest: ${shortFile(longest.file)} ${seconds(longestMs)}`]
1293
+ ].join(" \xB7 ");
1294
+ const full = text(true);
1295
+ return visibleLength(full) <= room ? full : text(false);
1296
+ }
1297
+ function cleanupLine(cleanup, runner, view, record) {
1298
+ const done = record || cleanup.status !== "running";
1299
+ const release = releaseText(cleanup.resources, done);
1300
+ const { runnerSandbox } = cleanup;
1301
+ const text = !done && cleanup.waiting ? `${WAITING_FOR_SNAPSHOT}\u2026` : runnerSandbox === null ? release ?? "nothing to release" : `${runnerSandboxText(runnerSandbox, runner, done)}${release === void 0 ? "" : `, ${release}`}`;
1302
+ const leftBehind = cleanupProblems(cleanup);
1303
+ const ending = done ? leftBehind === 0 ? "" : `: ${leftBehind} left behind` : "\u2026";
1304
+ return view.row(
1305
+ ` ${view.glyph(cleanup.status)} cleanup ${text}${!done && cleanup.waiting ? "" : ending}`,
1306
+ elapsed(view, cleanup.startedAt, cleanup.endedAt)
1307
+ );
1308
+ }
1309
+ function runnerSandboxText(sandbox, runner, done) {
1310
+ const kept = runner?.kept;
1311
+ if (kept !== void 0) return `kept the runner sandbox until ${isoSecondsText(kept.stopsAt)}`;
1312
+ const removed = `${done ? "stopped and deleted" : "stopping and deleting"} the runner sandbox`;
1313
+ switch (sandbox.kind) {
1314
+ case "keep":
1315
+ return !done && sandbox.ms > 0 ? `keeping the runner sandbox running ${keepTimeText(sandbox.ms)}` : removed;
1316
+ case "save": {
1317
+ const save = runner?.save;
1318
+ if (save?.kind === "saved") return `saved branch snapshot ${save.id} of ${save.branch}`;
1319
+ return !done && save?.kind !== "not-saved" ? `saving a branch snapshot of ${sandbox.branch}` : removed;
1320
+ }
1321
+ }
1322
+ }
1323
+ function statusGlyph(status, now, paint2) {
1324
+ switch (status) {
1325
+ case "pending":
1326
+ return paint2.faint("\xB7");
1327
+ case "running":
1328
+ return paint2.active(SPINNER[Math.floor(now / 90) % SPINNER.length] ?? "\xB7");
1329
+ case "done":
1330
+ return paint2.done("\u2713");
1331
+ case "failed":
1332
+ return paint2.failed("\u2717");
1333
+ case "stopped":
1334
+ return paint2.stopped("\u25A0");
1335
+ }
1336
+ }
1337
+ function endText(outcome) {
1338
+ return outcome === "stopped" ? "stopped" : commandEnd(outcome);
1339
+ }
1340
+
1341
+ // src/commands/exec/view.ts
1342
+ var PLAIN_WIDTH = 80;
1343
+ function runView(options) {
1344
+ const { presentation, progress, context } = options;
1345
+ if (progress === void 0)
1346
+ return {
1347
+ observer: { observe: async () => {
1348
+ } },
1349
+ runnerTerminal: context.runnerTerminal,
1350
+ width: PLAIN_WIDTH,
1351
+ paint: paint(false),
1352
+ finish: async () => {
1353
+ }
1354
+ };
1355
+ if (presentation.kind === "plain") {
1356
+ const writer = droppingWriter(progress);
1357
+ return {
1358
+ observer: lineProgress(writer, { github: presentation.github, verbose: options.verbose }),
1359
+ runnerTerminal: context.runnerTerminal,
1360
+ width: Math.min(Math.max(presentation.columns ?? PLAIN_WIDTH, 60), 120),
1361
+ paint: paint(presentation.color),
1362
+ finish: async (summary) => {
1363
+ for (const line of summary) await writer(line);
1364
+ }
1365
+ };
1366
+ }
1367
+ return liveView(context, paint(presentation.color), {
1368
+ showOutput: options.showOutput || options.verbose,
1369
+ verbose: options.verbose
1370
+ });
1371
+ }
1372
+ function droppingWriter(write) {
1373
+ let failed = false;
1374
+ return async (line) => {
1375
+ if (failed) return;
1376
+ try {
1377
+ await write(line);
1378
+ } catch {
1379
+ failed = true;
1380
+ }
1381
+ };
1382
+ }
1383
+ function liveView(context, colors, options) {
1384
+ const { showOutput } = options;
1385
+ const terminal = context.progressTerminal;
1386
+ let state = EMPTY_RUN_STATE;
1387
+ let phase;
1388
+ let headerPrinted = false;
1389
+ let live = false;
1390
+ let finished = false;
1391
+ const width = () => terminal.columns() - 1;
1392
+ const frame = () => phase === void 0 || finished ? [] : phaseFrame(state, phase, context.clock.now().getTime(), width(), colors);
1393
+ const print = (lines) => {
1394
+ if (lines.length > 0) terminal.print("stderr", lines.map((line) => `${line}
1395
+ `).join(""));
1396
+ };
1397
+ const header = () => {
1398
+ if (headerPrinted) return [];
1399
+ headerPrinted = true;
1400
+ return [headerLine(state, colors)];
1401
+ };
1402
+ return {
1403
+ observer: {
1404
+ observe: async (timed) => {
1405
+ if (finished) return;
1406
+ state = REGISTRY.applyEvent(state, timed);
1407
+ const next = activePhase(state);
1408
+ if (next !== phase) {
1409
+ print([
1410
+ ...next === void 0 ? [] : header(),
1411
+ ...phase === void 0 ? [] : phaseRecord(state, phase, width(), colors)
1412
+ ]);
1413
+ phase = next;
1414
+ }
1415
+ print(noticeLines(timed, state.origin ?? timed.at.getTime(), options.verbose));
1416
+ const { event } = timed;
1417
+ if (showOutput && event.kind === "runner" && event.event.kind === "step-output") print([event.event.line]);
1418
+ if (!live) {
1419
+ terminal.show(frame);
1420
+ live = true;
1421
+ }
1422
+ }
1423
+ },
1424
+ runnerTerminal: {
1425
+ color: context.runnerTerminal.color,
1426
+ writeStdout: (text) => terminal.print("stdout", text),
1427
+ writeStderr: (text) => terminal.print("stderr", text)
1428
+ },
1429
+ // The terminal may have been resized by the time the summary prints.
1430
+ get width() {
1431
+ return terminal.columns();
1432
+ },
1433
+ paint: colors,
1434
+ finish: async (summary) => {
1435
+ if (finished) return;
1436
+ finished = true;
1437
+ print([...header(), ...phase === void 0 ? [] : phaseRecord(state, phase, width(), colors), ...summary]);
1438
+ terminal.settle();
1439
+ }
1440
+ };
1441
+ }
1442
+ function noticeLines(timed, origin, verbose) {
1443
+ const line = (lane, text) => progressLine(timed.at.getTime() - origin, lane, text);
1444
+ const { event } = timed;
1445
+ switch (event.kind) {
1446
+ case "runner-prepared":
1447
+ return preparedNoteTexts(event).map((text) => line("runner", text));
1448
+ case "runner":
1449
+ return runnerNoticeLines(event.event, line);
1450
+ case "resource":
1451
+ return REGISTRY.presentations.notices(event, { verbose }).map(({ lane, text }) => line(lane, text));
1452
+ // A line a resource instance reported prints as it is, in its lane, and a warning marked as one.
1453
+ case "resource-notice":
1454
+ return [line(event.lane, event.text)];
1455
+ case "resource-warning":
1456
+ return [line(event.lane, resourceWarningText(event))];
1457
+ case "resource-skipped":
1458
+ return [line("run", skippedText(event))];
1459
+ // The live view draws what an acquired resource holds from its lane's state.
1460
+ case "resource-acquired":
1461
+ case "started":
1462
+ case "requesting-token":
1463
+ case "minting":
1464
+ case "minted":
1465
+ case "cleanup-started":
1466
+ case "cleanup-finished":
1467
+ case "command-started":
1468
+ case "command-ended":
1469
+ case "lanes-started":
1470
+ case "lane-started":
1471
+ case "lane-ended":
1472
+ case "test":
1473
+ case "test-event-unreadable":
1474
+ case "test-events-incomplete":
1475
+ return [];
1476
+ }
1477
+ }
1478
+ function runnerNoticeLines(event, line) {
1479
+ switch (event.kind) {
1480
+ case "snapshot-entry-not-written":
1481
+ return [line("runner", cacheWriteFailureText(event.failure))];
1482
+ case "branch-snapshots-dropped":
1483
+ case "branch-snapshots-not-dropped":
1484
+ return [line("runner", branchSnapshotsDropText(event))];
1485
+ case "branch-snapshot-saved":
1486
+ case "branch-snapshot-not-saved":
1487
+ return [line("cleanup", branchSnapshotSaveText(event))];
1488
+ // The live view's phases show the rest.
1489
+ case "snapshot-reused":
1490
+ case "snapshot-build-started":
1491
+ case "runner-sandbox-starting":
1492
+ case "sandbox-started":
1493
+ case "output-started":
1494
+ case "output-ended":
1495
+ case "step-started":
1496
+ case "step-output":
1497
+ case "step-finished":
1498
+ case "snapshot-saving":
1499
+ case "snapshot-built":
1500
+ case "uploading":
1501
+ case "uploaded":
1502
+ case "command-output-started":
1503
+ case "command-stopped":
1504
+ case "stopping":
1505
+ case "waiting-for-snapshot":
1506
+ case "sandbox-kept":
1507
+ case "branch-snapshot-saving":
1508
+ return [];
1509
+ }
1510
+ }
1511
+
1512
+ // src/commands/exec/run-command.ts
1513
+ var OWN_RUN_FIELDS = {
1514
+ scope: z5.string().min(1).optional(),
1515
+ project: z5.string().min(1).optional(),
1516
+ credential: z5.enum(["mint", "github-actions"]).optional(),
1517
+ unsandboxed: z5.boolean().default(false),
1518
+ rebuildSnapshot: z5.boolean().default(false),
1519
+ saveSnapshot: z5.boolean().optional(),
1520
+ showOutput: z5.boolean().default(false),
1521
+ keepSandbox: z5.string().optional(),
1522
+ verbose: z5.boolean().default(false)
1523
+ };
1524
+ var RUN_REQUEST_FIELDS = { ...OWN_RUN_FIELDS, ...resourceFlagFields(Object.keys(OWN_RUN_FIELDS)) };
1525
+ var RUN_CLI_OPTIONS = { project: { short: "p" } };
1526
+ var runRequestSchema = z5.object(RUN_REQUEST_FIELDS);
1527
+ async function runCommand({ app, ui, signal }, request, spec) {
1528
+ const lifecycles = REGISTRY.lifecycles(app.worlds);
1529
+ const planned = await planRun(
1530
+ app,
1531
+ lifecycles,
1532
+ { ...request, given: resourceFlagValues(request) },
1533
+ spec.planCommand,
1534
+ signal
1535
+ );
1536
+ if (!planned.ok) return planned.refusal;
1537
+ const { configFile, argv, testPlan, planOptions } = planned;
1538
+ const before = await resourcesBeforeRun(lifecycles, planned, request);
1539
+ if (!before.ok) return before.refusal;
1540
+ if (signal.aborted) return canceledBeforeStart();
1541
+ const { where, used } = before;
1542
+ const plan = recordedPlan(testPlan, planOptions);
1543
+ if (plan !== void 0) await ui.progress?.(testPlanLine(plan));
1544
+ const base = {
1545
+ argv,
1546
+ // A resource the run uses can hide launcher environment variables that could point the command at something else
1547
+ // than the run payload names, so the command never sees one.
1548
+ env: Object.fromEntries(Object.entries(app.env).filter(([name]) => !used.hiddenVariables.includes(name))),
1549
+ version: app.version,
1550
+ commit: app.commit,
1551
+ configFile,
1552
+ verbose: request.verbose
1553
+ };
1554
+ const requested = await runRequestFor(app, { where, used, base, request, configFile });
1555
+ if (!requested.ok) return requested.refusal;
1556
+ const { run } = requested;
1557
+ const secrets = [...used.secrets, ...Object.values(run.runner?.secrets ?? {})];
1558
+ const redact = redactor(secrets);
1559
+ const sigterm = forwardSigterm(signal);
1560
+ const view = runView({
1561
+ presentation: app.presentation,
1562
+ progress: ui.progress,
1563
+ context: app.context,
1564
+ showOutput: request.showOutput,
1565
+ verbose: request.verbose
1566
+ });
1567
+ const git = await checkoutGit(app.context.checkout, app.cwd);
1568
+ const recording = await recordRun(app.context.runDirectories, {
1569
+ registry: REGISTRY,
1570
+ startedAt: app.context.clock.now(),
1571
+ cwd: app.cwd,
1572
+ configFile,
1573
+ argv,
1574
+ plan,
1575
+ run,
1576
+ git,
1577
+ redact: (value) => redactStrings(value, redact)
1578
+ });
1579
+ const observer = recording.observer(view.observer);
1580
+ const terminal = recording.terminal(view.runnerTerminal);
1581
+ let outcome;
1582
+ try {
1583
+ const ended = await executeRun(
1584
+ REGISTRY,
1585
+ { ...app.context, runnerTerminal: secrets.length === 0 ? terminal : redactingTerminal(terminal, redact) },
1586
+ app.worlds,
1587
+ run.runner === void 0 && recording.testEvents !== void 0 ? { ...run, testEvents: recording.testEvents } : run,
1588
+ { signal, terminate: sigterm.terminate },
1589
+ timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))
1590
+ );
1591
+ outcome = secrets.length === 0 ? ended : redactStrings(ended, redact);
1592
+ } catch (error) {
1593
+ await view.finish([]);
1594
+ await recording.abandon();
1595
+ throw error;
1596
+ }
1597
+ sigterm.release();
1598
+ const ran = await summarize(app, { command: spec.name, view, recording, outcome });
1599
+ switch (outcome.kind) {
1600
+ case "ran": {
1601
+ app.exit.status = commandExitStatus(outcome.command);
1602
+ const { command } = outcome;
1603
+ return spec.ran(
1604
+ {
1605
+ version: app.version,
1606
+ commit: app.commit,
1607
+ configFile,
1608
+ resources: REGISTRY.reports.ranFacts(outcome.resources),
1609
+ cleanup: RUN_CLEANUP.facts(outcome),
1610
+ command: command.kind === "exited" ? { exitCode: command.code, signal: null } : command.kind === "signaled" ? { exitCode: null, signal: command.signal } : { exitCode: null, signal: null },
1611
+ runner: outcome.runner === void 0 ? null : {
1612
+ snapshotId: outcome.runner.snapshotId,
1613
+ base: outcome.runner.base,
1614
+ snapshotBranch: outcome.runner.snapshotBranch,
1615
+ snapshotHead: outcome.runner.snapshotHead,
1616
+ built: outcome.runner.built,
1617
+ vcpus: outcome.runner.vcpus,
1618
+ region: outcome.runner.region,
1619
+ runtime: outcome.runner.runtime,
1620
+ buildMs: outcome.runner.buildMs,
1621
+ save: outcome.runner.save
1622
+ },
1623
+ timeline: ran,
1624
+ runId: recording.opened.ok ? recording.opened.id : null
1625
+ },
1626
+ { testPlan, options: planOptions }
1627
+ );
1628
+ }
1629
+ case "resource-refused":
1630
+ return resourceRefused(outcome, RUN_CLEANUP.facts(outcome));
1631
+ // The run's mint: in a sandboxed run for the runner sandbox, in an unsandboxed run for a resource that needed it:
1632
+ // its `acquireForRun` answered `mintFailed`, which the launcher owns.
1633
+ case "mint-failed":
1634
+ return mintFailedErrors.mintFailed({
1635
+ ...outcome.target,
1636
+ ...describeMintFailure(outcome.failure, outcome.target),
1637
+ runner: outcome.runner,
1638
+ cleanup: RUN_CLEANUP.facts(outcome)
1639
+ });
1640
+ case "spawn-failed":
1641
+ return runErrors.spawnFailed({
1642
+ executable: outcome.executable,
1643
+ message: outcome.message,
1644
+ // Only an unsandboxed run spawns its command on this machine, so it holds no runner sandbox.
1645
+ cleanup: RUN_CLEANUP.facts({ runnerCleanup: null, resourceCleanup: outcome.resourceCleanup })
1646
+ });
1647
+ case "canceled":
1648
+ return outcomes.canceled({ changed: canceledChanges(outcome) });
1649
+ case "runner-failed":
1650
+ return runErrors.runnerFailed({
1651
+ failure: runnerFailureFacts(outcome.failure),
1652
+ cleanup: RUN_CLEANUP.facts(outcome)
1653
+ });
1654
+ case "snapshot-gone":
1655
+ return runErrors.snapshotGone({
1656
+ snapshotId: outcome.entry.snapshotId,
1657
+ base: outcome.entry.base,
1658
+ removal: outcome.removal === void 0 ? null : { ...outcome.removal },
1659
+ cleanup: RUN_CLEANUP.facts(outcome)
1660
+ });
1661
+ }
1662
+ }
1663
+ function runProblems(request) {
1664
+ const { credential, unsandboxed, rebuildSnapshot, saveSnapshot, showOutput, keepSandbox } = request;
1665
+ return [
1666
+ ...resourceFlagProblems(request),
1667
+ ...rebuildSnapshot && unsandboxed ? [
1668
+ {
1669
+ field: "rebuildSnapshot",
1670
+ message: "--rebuild-snapshot builds a runner snapshot; drop it or --unsandboxed."
1671
+ }
1672
+ ] : [],
1673
+ ...!unsandboxed && credential === "github-actions" ? [
1674
+ {
1675
+ field: "credential",
1676
+ message: "A sandboxed run needs the mint: the runner sandbox uses a minted Vercel token. Add --unsandboxed, or drop --credential github-actions."
1677
+ }
1678
+ ] : [],
1679
+ ...showOutput && unsandboxed ? [
1680
+ {
1681
+ field: "showOutput",
1682
+ message: "--show-output prints a sandboxed run's step output; drop it or --unsandboxed."
1683
+ }
1684
+ ] : [],
1685
+ ...keepSandbox !== void 0 && parseKeepTime(keepSandbox) === void 0 ? [
1686
+ {
1687
+ field: "keepSandbox",
1688
+ message: `--keep-sandbox takes 0, or a whole number of minutes or hours up to 5h, such as 30m or 2h, not ${JSON.stringify(keepSandbox)}.`
1689
+ }
1690
+ ] : [],
1691
+ ...keepSandbox !== void 0 && unsandboxed ? [
1692
+ {
1693
+ field: "keepSandbox",
1694
+ message: "--keep-sandbox keeps a sandboxed run's runner sandbox; drop it or --unsandboxed."
1695
+ }
1696
+ ] : [],
1697
+ ...saveSnapshot === true && unsandboxed ? [
1698
+ {
1699
+ field: "saveSnapshot",
1700
+ message: "--save-snapshot saves a sandboxed run's runner sandbox; drop it or --unsandboxed."
1701
+ }
1702
+ ] : [],
1703
+ ...saveSnapshot === true && keepsSandbox(keepSandbox) ? [
1704
+ {
1705
+ field: "saveSnapshot",
1706
+ message: "--save-snapshot saves the runner sandbox instead of keeping it; drop --keep-sandbox or set it to 0."
1707
+ }
1708
+ ] : []
1709
+ ];
1710
+ }
1711
+ async function runRequestFor(app, options) {
1712
+ const { where, used, base, request, configFile } = options;
1713
+ if (where.kind === "unsandboxed") {
1714
+ const run2 = {
1715
+ ...base,
1716
+ resources: used.requests,
1717
+ skipped: used.skipped,
1718
+ ...where.credential === void 0 ? {} : { credential: where.credential }
1719
+ };
1720
+ return { ok: true, run: run2 };
1721
+ }
1722
+ const prepared = await prepareRunner(app.context, {
1723
+ cwd: app.cwd,
1724
+ recipe: where.recipe,
1725
+ // The recipe's `vcpus` reads each of the run's resources by its definition: one its `beforeRun` skipped isn't.
1726
+ vcpusRun: recipeRun(recipeResources(used.requests)),
1727
+ rebuild: request.rebuildSnapshot,
1728
+ save: saveMode(request, where.recipe, app.env),
1729
+ trustBranchSnapshots: request.saveSnapshot ?? where.recipe.saveSnapshot === true
1730
+ });
1731
+ if (prepared.kind !== "ok") {
1732
+ const refusal = prepareRefusal(prepared, configFile);
1733
+ const secrets = [...used.secrets, ...Object.values(where.secrets)];
1734
+ return {
1735
+ ok: false,
1736
+ refusal: secrets.length === 0 ? refusal : redactStrings(refusal, redactor(secrets))
1737
+ };
1738
+ }
1739
+ const { save } = prepared.prepared;
1740
+ const keepMs = keepSandboxMinutes(request.keepSandbox, where.recipe, app.env) * 6e4;
1741
+ const run = {
1742
+ ...base,
1743
+ resources: used.requests,
1744
+ skipped: used.skipped,
1745
+ runner: {
1746
+ prepared: prepared.prepared,
1747
+ target: where.target,
1748
+ user: app.user,
1749
+ secrets: where.secrets,
1750
+ sandbox: save?.kind === "branch" ? { kind: "save", branch: save.branch, always: save.always, otherwiseKeepMs: keepMs } : { kind: "keep", ms: keepMs }
1751
+ }
1752
+ };
1753
+ return { ok: true, run };
1754
+ }
1755
+ function prepareRefusal(prepared, configFile) {
1756
+ switch (prepared.kind) {
1757
+ case "no-base-ref":
1758
+ return runErrors.noBaseRef({ refs: prepared.refs.map(({ ref, reason }) => ({ ref, reason })) });
1759
+ case "submodules":
1760
+ return runErrors.submodulesRefused({ paths: [...prepared.paths] });
1761
+ case "invalid-recipe":
1762
+ return invalidConfig(configFile ?? "", [
1763
+ { key: ["runner", ...prepared.path].join("."), location: null, problem: prepared.problem }
1764
+ ]);
1765
+ case "checkout-failed":
1766
+ return checkoutFailedRefusal(prepared.failure);
1767
+ }
1768
+ }
1769
+ function checkoutFailedRefusal(failure) {
1770
+ return runErrors.runnerFailed({
1771
+ failure: runnerFailureFacts({ kind: "checkout-failed", failure }),
1772
+ cleanup: RUN_CLEANUP.facts(NOTHING_RELEASED)
1773
+ });
1774
+ }
1775
+ async function summarize(app, run) {
1776
+ const { view, recording } = run;
1777
+ const recorded = await recording.end(run.outcome);
1778
+ const { timeline, tests } = recorded;
1779
+ const logs = recording.opened.ok ? recording.opened.path : void 0;
1780
+ const failed = tests.events.some((event) => event.kind === "test-result" && event.state === "fail");
1781
+ const testsLines = testsSummaryLines(tests.events, tests.unreadable, tests.incomplete);
1782
+ const stepLogs = failedStepLogs(timeline, recording, app.env);
1783
+ const clock = workerClock(recorded);
1784
+ const charted = clock === void 0 ? void 0 : testsChart(tests.events, tests.unreadable, clock, tests.incomplete);
1785
+ const summarized = await app.context.jobSummary.appendJobSummary(
1786
+ jobSummaryMarkdown(timeline, {
1787
+ command: run.command,
1788
+ logs,
1789
+ details: [...testsLines, ...stepLogs]
1790
+ })
1791
+ );
1792
+ await view.finish(
1793
+ waterfallLines(timeline, {
1794
+ width: view.width,
1795
+ paint: view.paint,
1796
+ logs: logsText(recording, recorded.writeFailure, app.env, failed),
1797
+ ...charted === void 0 ? {} : { workers: charted.lanes },
1798
+ details: [
1799
+ ...charted?.notes ?? testsLines,
1800
+ ...stepLogs,
1801
+ ...summarized.kind === "failed" ? [` couldn't append to the job summary at ${summarized.failure.path}: ${summarized.failure.message}`] : []
1802
+ ]
1803
+ })
1804
+ );
1805
+ return timeline;
1806
+ }
1807
+ function workerClock({ timeline, workerOffsetMs }) {
1808
+ const tests = timeline.rows.find((row) => row.name === "tests");
1809
+ if (tests === void 0) return void 0;
1810
+ return { runStartedAt: Date.parse(timeline.startedAt), offsetMs: workerOffsetMs, tests };
1811
+ }
1812
+ function displayPath(path, env) {
1813
+ const home = env["HOME"];
1814
+ if (home === void 0 || home === "" || !path.startsWith(`${home}/`)) return path;
1815
+ return `~${path.slice(home.length)}`;
1816
+ }
1817
+ function logsText({ opened }, writeFailure, env, failed) {
1818
+ if (!opened.ok) return `none: couldn't make ${opened.failure.path}: ${opened.failure.message}`;
1819
+ const path = `${displayPath(opened.path, env)}/`;
1820
+ const problems = [
1821
+ ...writeFailure === void 0 ? [] : [`couldn't write ${writeFailure.path}: ${writeFailure.message}`],
1822
+ ...opened.pruneFailures.slice(0, 1).map((failure) => `couldn't remove ${failure.path}: ${failure.message}`)
1823
+ ];
1824
+ const show = `storm runs show ${opened.id}${failed ? " --failed" : ""}`;
1825
+ return `${problems.length === 0 ? path : `${path} (${problems.join("; ")})`} \xB7 ${show}`;
1826
+ }
1827
+ async function checkoutGit(checkout, cwd) {
1828
+ const root = await checkout.repositoryRoot({ cwd });
1829
+ if (!root.ok) return null;
1830
+ const head = await checkout.head({ repoRoot: root.value });
1831
+ return head.ok ? { ...head.value } : null;
1832
+ }
1833
+ function recipeResources(requests) {
1834
+ return Object.fromEntries(
1835
+ Object.entries(requests).map(([key, { definition, options }]) => {
1836
+ if (typeof options !== "object" || options === null) throw new Error(`${key}'s options are not an object`);
1837
+ return [key, { definition, options }];
1838
+ })
1839
+ );
1840
+ }
1841
+ function keepsSandbox(flag) {
1842
+ return flag !== void 0 && (parseKeepTime(flag) ?? 0) > 0;
1843
+ }
1844
+ function saveMode(request, recipe, env) {
1845
+ const choice = request.saveSnapshot ?? (keepsSandbox(request.keepSandbox) ? false : recipe.saveSnapshot);
1846
+ if (choice !== void 0) return choice ? "always" : "never";
1847
+ return isCi(env) || runStepTakesSecret(recipe) ? "never" : "new-head";
1848
+ }
1849
+ var DEFAULT_KEEP_SANDBOX_MINUTES = 30;
1850
+ function keepSandboxMinutes(flag, recipe, env) {
1851
+ const fromFlag = flag === void 0 ? void 0 : parseKeepTime(flag);
1852
+ return fromFlag ?? recipe.keepSandboxMinutes ?? (isCi(env) ? 0 : DEFAULT_KEEP_SANDBOX_MINUTES);
1853
+ }
1854
+ function failedStepLogs(timeline, recording, env) {
1855
+ const runner = timeline.rows.find((row) => row.name === "runner");
1856
+ return (runner?.steps ?? []).filter((step) => step.outcome === "failed").flatMap((step) => {
1857
+ const log = recording.stepLog(step.name);
1858
+ return log === void 0 ? [] : [` failed ${step.name}, whole output: ${displayPath(log, env)}`];
1859
+ });
1860
+ }
1861
+ function runnerFailureFacts(failure) {
1862
+ switch (failure.kind) {
1863
+ case "snapshot-build-step-failed":
1864
+ case "apply-failed":
1865
+ case "install-failed":
1866
+ case "build-failed":
1867
+ return { kind: failure.kind, label: failure.label, exitCode: failure.exitCode, tail: [...failure.tail] };
1868
+ case "sandbox-api-failed":
1869
+ return { kind: failure.kind, operation: failure.operation, status: failure.status, message: failure.message };
1870
+ case "checkout-failed":
1871
+ return { kind: failure.kind, message: failure.failure.message, command: failure.failure.displayCommand ?? null };
1872
+ case "credential-claims-missing":
1873
+ return { kind: failure.kind, ...failure.target };
1874
+ }
1875
+ }
1876
+ var NOTHING_RELEASED = { runnerCleanup: null, resourceCleanup: {} };
1877
+ function canceledChanges(outcome) {
1878
+ const { commandStopped } = outcome;
1879
+ const lines = [
1880
+ commandStopped === true ? "The command was stopped in the runner sandbox." : "The command didn't run."
1881
+ ];
1882
+ const cleanup = RUN_CLEANUP.facts(outcome).runner;
1883
+ if (cleanup !== null) lines.push(...runnerCleanupLines(cleanup));
1884
+ lines.push(...REGISTRY.reports.canceledLines(outcome.resourceCleanup));
1885
+ return lines.join("\n");
1886
+ }
1887
+ function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
1888
+ const problems = [
1889
+ ...notKept === null ? [] : [notKeptText(notKept)],
1890
+ ...notStopped.map(notStoppedText),
1891
+ ...notDeleted.map(notDeletedText)
1892
+ ];
1893
+ if (kept === null)
1894
+ return problems.length === 0 ? ["Every sandbox the runner started is stopped and deleted."] : problems;
1895
+ return [
1896
+ keptText(kept),
1897
+ ...problems.length === 0 ? ["Every other sandbox the runner started is stopped and deleted."] : problems
1898
+ ];
1899
+ }
1900
+
1901
+ // src/commands/exec/run-metadata.ts
1902
+ var RUN_USAGE_FLAGS = `${RESOURCE_USAGE_FLAGS} [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--unsandboxed | [--rebuild-snapshot] [--save-snapshot[=false]] [--show-output] [--keep-sandbox <DURATION>]] [--verbose]`;
1903
+ var OWN_RUN_FIELDS2 = {
1904
+ credential: {
1905
+ valueLabel: "SOURCE",
1906
+ description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, anew once it is 4 minutes old, and needs no --scope or --project. Only --unsandboxed takes it: a sandboxed run needs the mint. Only a run with a resource that takes a credential takes it, as that resource's options decide; otherwise it is credential_unused. No config key."
1907
+ },
1908
+ unsandboxed: {
1909
+ description: "Run the command on this machine, with no isolation: it sees this machine's files and environment, less the variables the resources drop. Without it, the command runs in a Vercel Sandbox started from a runner snapshot of the base, with this checkout's changes applied, installed and built, from the runner key of storm.config.ts, and its output streams back with paths rewritten to this checkout's. No config key."
1910
+ },
1911
+ rebuildSnapshot: {
1912
+ description: "Build a runner snapshot of the base whatever the runner snapshot cache holds, replacing an entry for the same base, and drop this branch's saved branch snapshots from the cache. Not with --unsandboxed. No config key."
1913
+ },
1914
+ saveSnapshot: {
1915
+ description: "Whether the run saves the runner sandbox as this branch's runner snapshot once the command ends on its own, after a successful install and build, so the next run on the branch starts from this run's install and build outputs. Without the flag, a sandboxed run on a branch saves one when the command exits 0, unless it started from a branch snapshot that HEAD's commit saved, so each commit saves once; it saves none when the command fails, when CI is set, with --keep-sandbox above 0, with a detached HEAD, or when the runner recipe's install or build step names a runner secret, since those steps would run in a later run on top of what this run's command wrote; such a recipe also reuses no branch snapshot unless --save-snapshot or saveSnapshot: true trusts it. --save-snapshot saves whatever the command's exit code and whatever the run started from, under CI too, and with a detached HEAD says as the run starts that it saves nothing; not with --unsandboxed, or with --keep-sandbox above 0. --save-snapshot=false saves none. The save resets the working tree to the snapshot's base, keeps .git and ignored files such as node_modules and build outputs, and empties /tmp; the snapshot keeps whatever the command wrote there and to $HOME, a resource's token included. A run that starts a save keeps no runner sandbox, however the save ends; a run that starts none, such as one a signal stops, one whose install or build fails, or, without the flag, one whose command fails, keeps it for the keep time. Without the flag and without --keep-sandbox above 0, saveSnapshot in the runner recipe says the same as the flag for every run: false saves none, true saves as --save-snapshot does."
1916
+ },
1917
+ keepSandbox: {
1918
+ valueLabel: "DURATION",
1919
+ description: "How long the runner sandbox keeps running once the run ends, however it ends, so you can connect to it from its page in the Vercel dashboard: 0, which stops and deletes it with the run's other sandboxes, or a whole number of minutes or hours up to 5h (30m, 2h). A run that starts saving a branch snapshot keeps no runner sandbox (see --save-snapshot); given above 0, this flag has the run save none. The run asks Vercel Sandbox to extend the runner sandbox's timeout when it would stop sooner; it never shortens it, so the sandbox may run past the keep time until its own timeout. The run says until when it runs, and storm runs show and runs list say so too. Default: keepSandbox in the runner recipe, else 30m, or 0 when CI is set. Not with --unsandboxed."
1920
+ },
1921
+ showOutput: {
1922
+ description: "In a sandboxed run on a terminal, print the runner's step output (a snapshot build, the install, the build) above the live view instead of keeping only each step's last line there. Plain output always prints it. Either way, the run directory keeps it whole. Not with --unsandboxed. No config key."
1923
+ },
1924
+ verbose: {
1925
+ description: "Print more as it happens: each resource's detailed progress, the runner's step output as with --show-output, and verbose in the run payload, which has the Vitest adapter's reporters print each test as it finishes and its fixtures print each container start, proxied request and vercel invocation, for passing tests too. No config key."
1926
+ },
1927
+ scope: {
1928
+ valueLabel: "TEAM",
1929
+ description: "The control plane team: the Vercel team whose project the credential is minted for and a sandboxed run's sandboxes run in. Required, from this flag or scope in storm.config.ts, unless an unsandboxed run has no resource that takes a credential or takes --credential github-actions."
1930
+ },
1931
+ project: {
1932
+ valueLabel: "PROJECT",
1933
+ description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required, from this flag or project in storm.config.ts, unless an unsandboxed run has no resource that takes a credential or takes --credential github-actions."
1934
+ }
1935
+ };
1936
+ var RUN_FIELDS = { ...RESOURCE_FLAG_HELP, ...OWN_RUN_FIELDS2 };
1937
+
1938
+ export {
1939
+ ranSchema,
1940
+ RAN_DESCRIPTION,
1941
+ renderRan,
1942
+ RUN_ERRORS,
1943
+ outcomes,
1944
+ canceledBeforeStart,
1945
+ RUN_REQUEST_FIELDS,
1946
+ RUN_CLI_OPTIONS,
1947
+ runCommand,
1948
+ runProblems,
1949
+ checkoutFailedRefusal,
1950
+ RUN_USAGE_FLAGS,
1951
+ RUN_FIELDS
1952
+ };