@cnc-tools/storm 0.9.1 → 0.10.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 (654) 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 +24 -20
  5. package/dist/build-info.js +1 -1
  6. package/dist/chunks/chunk-AGWW3HDT.js +2559 -0
  7. package/dist/chunks/{chunk-RRQ2ZGSE.js → chunk-AKKNF3WZ.js} +847 -336
  8. package/dist/chunks/chunk-H2VCSNVU.js +351 -0
  9. package/dist/chunks/chunk-J6ZNYUDV.js +21 -0
  10. package/dist/chunks/{chunk-WV6WQFC6.js → chunk-JQ2HK4RN.js} +15 -26
  11. package/dist/chunks/chunk-OVXD7GES.js +841 -0
  12. package/dist/chunks/chunk-VJQLMGOH.js +4716 -0
  13. package/dist/chunks/chunk-WF4KJ7YG.js +431 -0
  14. package/dist/chunks/chunk-XHJGHJBW.js +1509 -0
  15. package/dist/chunks/chunk-YF3ICDBY.js +10 -0
  16. package/dist/chunks/chunk-ZJ2USLAT.js +4420 -0
  17. package/dist/chunks/{live-app-X3PW2W42.js → live-app-RIJM3QFD.js} +30 -22
  18. package/dist/command-tree.d.ts +3 -0
  19. package/dist/command-tree.js +3 -0
  20. package/dist/commands/dashboard.d.ts +1 -1
  21. package/dist/commands/dashboard.js +1 -1
  22. package/dist/commands/exec/cleanup.d.ts +27 -43
  23. package/dist/commands/exec/cleanup.js +20 -54
  24. package/dist/commands/exec/command.d.ts +72 -544
  25. package/dist/commands/exec/command.js +58 -25
  26. package/dist/commands/exec/job-summary.d.ts +2 -2
  27. package/dist/commands/exec/job-summary.js +3 -3
  28. package/dist/commands/exec/live-view.d.ts +9 -9
  29. package/dist/commands/exec/live-view.js +48 -41
  30. package/dist/commands/exec/metadata.d.ts +0 -65
  31. package/dist/commands/exec/metadata.js +2 -61
  32. package/dist/commands/exec/mint-failed.d.ts +1 -1
  33. package/dist/commands/exec/mint-failed.js +8 -8
  34. package/dist/commands/exec/outcomes.d.ts +63 -468
  35. package/dist/commands/exec/outcomes.js +42 -69
  36. package/dist/commands/exec/plan-run.d.ts +150 -0
  37. package/dist/commands/exec/plan-run.js +121 -0
  38. package/dist/commands/exec/progress.d.ts +25 -15
  39. package/dist/commands/exec/progress.js +61 -40
  40. package/dist/commands/exec/redaction.d.ts +3 -3
  41. package/dist/commands/exec/redaction.js +4 -4
  42. package/dist/commands/exec/resource-flags.d.ts +50 -0
  43. package/dist/commands/exec/resource-flags.js +125 -0
  44. package/dist/commands/exec/resource-refusals.d.ts +64 -0
  45. package/dist/commands/exec/resource-refusals.js +58 -0
  46. package/dist/commands/exec/run-collector.d.ts +15 -10
  47. package/dist/commands/exec/run-collector.js +5 -5
  48. package/dist/commands/exec/run-command.d.ts +80 -165
  49. package/dist/commands/exec/run-command.js +264 -275
  50. package/dist/commands/exec/run-metadata.d.ts +20 -43
  51. package/dist/commands/exec/run-metadata.js +18 -37
  52. package/dist/commands/exec/run-record.d.ts +67 -58
  53. package/dist/commands/exec/run-record.js +15 -32
  54. package/dist/commands/exec/test-plan.d.ts +45 -0
  55. package/dist/commands/exec/test-plan.js +59 -0
  56. package/dist/commands/exec/tests-summary.d.ts +5 -5
  57. package/dist/commands/exec/tests-summary.js +2 -2
  58. package/dist/commands/exec/text.d.ts +8 -2
  59. package/dist/commands/exec/text.js +8 -0
  60. package/dist/commands/exec/timeline-facts.d.ts +57 -0
  61. package/dist/commands/exec/timeline-facts.js +92 -0
  62. package/dist/commands/exec/view.d.ts +5 -7
  63. package/dist/commands/exec/view.js +21 -13
  64. package/dist/commands/exec/waterfall.d.ts +2 -9
  65. package/dist/commands/exec/waterfall.js +9 -30
  66. package/dist/commands/exec/worker-chart.d.ts +1 -1
  67. package/dist/commands/ext/metadata.d.ts +4 -0
  68. package/dist/commands/ext/metadata.js +8 -0
  69. package/dist/commands/runs/facts.d.ts +9 -5
  70. package/dist/commands/runs/facts.js +26 -14
  71. package/dist/commands/runs/list/command.d.ts +15 -8
  72. package/dist/commands/runs/list/command.js +38 -32
  73. package/dist/commands/runs/list/metadata.d.ts +16 -14
  74. package/dist/commands/runs/list/metadata.js +17 -15
  75. package/dist/commands/runs/list/outcomes.d.ts +6 -2
  76. package/dist/commands/runs/logs/command.d.ts +3 -4
  77. package/dist/commands/runs/logs/command.js +44 -41
  78. package/dist/commands/runs/logs/metadata.d.ts +17 -15
  79. package/dist/commands/runs/logs/metadata.js +20 -18
  80. package/dist/commands/runs/past-run.d.ts +3 -9
  81. package/dist/commands/runs/past-run.js +2 -17
  82. package/dist/commands/runs/show/command.d.ts +57 -42
  83. package/dist/commands/runs/show/command.js +87 -79
  84. package/dist/commands/runs/show/metadata.d.ts +20 -18
  85. package/dist/commands/runs/show/metadata.js +20 -18
  86. package/dist/commands/runs/show/outcomes.d.ts +27 -19
  87. package/dist/commands/runs/show/outcomes.js +8 -6
  88. package/dist/commands/vitest/command.d.ts +94 -559
  89. package/dist/commands/vitest/command.js +71 -94
  90. package/dist/commands/vitest/metadata.d.ts +0 -65
  91. package/dist/commands/vitest/metadata.js +2 -41
  92. package/dist/commands/vitest/outcomes.d.ts +44 -274
  93. package/dist/commands/vitest/outcomes.js +7 -14
  94. package/dist/config/credential-resolver.d.ts +131 -0
  95. package/dist/config/credential-resolver.js +69 -0
  96. package/dist/{credential/settle.d.ts → config/credential-settle.d.ts} +1 -2
  97. package/dist/config/errors.d.ts +1 -1
  98. package/dist/config/errors.js +5 -5
  99. package/dist/config/index.d.ts +7 -6
  100. package/dist/config/index.js +13 -9
  101. package/dist/config/load.d.ts +16 -13
  102. package/dist/config/load.js +55 -40
  103. package/dist/config/recipe-run.d.ts +26 -0
  104. package/dist/config/recipe-run.js +27 -0
  105. package/dist/config/resolve.d.ts +103 -15
  106. package/dist/config/resolve.js +137 -47
  107. package/dist/config/resolver.d.ts +40 -0
  108. package/dist/config/resolver.js +31 -0
  109. package/dist/config/schema.d.ts +13 -17
  110. package/dist/config/schema.js +14 -35
  111. package/dist/config/settings-file.d.ts +28 -16
  112. package/dist/config/settings-file.js +39 -24
  113. package/dist/config/typed-options.d.ts +21 -0
  114. package/dist/config/typed-options.js +28 -0
  115. package/dist/config-file/define.d.ts +33 -31
  116. package/dist/config-file/define.js +14 -4
  117. package/dist/config-file/toolchain.d.ts +1 -1
  118. package/dist/context.d.ts +37 -24
  119. package/dist/context.js +16 -8
  120. package/dist/core/before-run.d.ts +37 -0
  121. package/dist/core/before-run.js +44 -0
  122. package/dist/core/events.d.ts +55 -46
  123. package/dist/core/gateways.d.ts +17 -18
  124. package/dist/core/index.d.ts +12 -12
  125. package/dist/core/index.js +12 -8
  126. package/dist/core/launcher-supplies.d.ts +11 -0
  127. package/dist/core/launcher-supplies.js +28 -0
  128. package/dist/core/mint.js +2 -2
  129. package/dist/core/payload.d.ts +13 -14
  130. package/dist/core/payload.js +9 -8
  131. package/dist/core/presentations.d.ts +37 -37
  132. package/dist/core/presentations.js +49 -56
  133. package/dist/core/reports.d.ts +5 -0
  134. package/dist/core/reports.js +13 -0
  135. package/dist/core/resource-registry.d.ts +54 -0
  136. package/dist/core/resource-registry.js +57 -0
  137. package/dist/core/resource-reports.d.ts +36 -0
  138. package/dist/core/resource-reports.js +38 -0
  139. package/dist/core/resource.d.ts +135 -243
  140. package/dist/core/resource.js +7 -5
  141. package/dist/core/resources-of.d.ts +16 -0
  142. package/dist/core/resources-of.js +8 -0
  143. package/dist/core/resources.d.ts +96 -84
  144. package/dist/core/resources.js +168 -165
  145. package/dist/core/run-directory.d.ts +10 -11
  146. package/dist/core/run-directory.js +9 -9
  147. package/dist/core/run-state.d.ts +29 -41
  148. package/dist/core/run-state.js +56 -60
  149. package/dist/core/run.d.ts +77 -66
  150. package/dist/core/run.js +83 -74
  151. package/dist/core/state-directory.js +4 -3
  152. package/dist/core/timeline.d.ts +42 -24
  153. package/dist/core/timeline.js +45 -27
  154. package/dist/core/timing.d.ts +3 -3
  155. package/dist/core/timing.js +1 -1
  156. package/dist/credential/gateways.d.ts +1 -80
  157. package/dist/credential/index.d.ts +3 -5
  158. package/dist/credential/index.js +7 -5
  159. package/dist/credential/live/github-actions-token-response.js +1 -1
  160. package/dist/credential/live/vercel-cli-gateway.d.ts +2 -1
  161. package/dist/credential/live/vercel-cli-gateway.js +1 -1
  162. package/dist/credential/live/vercel-output.d.ts +1 -1
  163. package/dist/credential/source.d.ts +16 -59
  164. package/dist/credential/source.js +21 -7
  165. package/dist/credential/target.d.ts +1 -1
  166. package/dist/extension-commands.d.ts +14 -0
  167. package/dist/extension-commands.js +20 -0
  168. package/dist/extensions/github/definition.d.ts +26 -0
  169. package/dist/extensions/github/definition.js +29 -0
  170. package/dist/extensions/github/extension.d.ts +18 -0
  171. package/dist/extensions/github/extension.js +6 -0
  172. package/dist/{resources → extensions}/github/fixture-repo.d.ts +11 -8
  173. package/dist/{resources → extensions}/github/fixture-repo.js +8 -4
  174. package/dist/extensions/github/index.d.ts +13 -0
  175. package/dist/extensions/github/index.js +17 -0
  176. package/dist/extensions/github/lifecycle.d.ts +30 -0
  177. package/dist/extensions/github/lifecycle.js +69 -0
  178. package/dist/extensions/github/live/world.d.ts +6 -0
  179. package/dist/extensions/github/live/world.js +16 -0
  180. package/dist/extensions/github/options.d.ts +36 -0
  181. package/dist/extensions/github/options.js +36 -0
  182. package/dist/extensions/github/refusals.d.ts +32 -0
  183. package/dist/extensions/github/refusals.js +43 -0
  184. package/dist/extensions/github/release.d.ts +17 -0
  185. package/dist/extensions/github/release.js +34 -0
  186. package/dist/extensions/github/resource.d.ts +36 -0
  187. package/dist/extensions/github/resource.js +21 -0
  188. package/dist/extensions/github/run/payload.d.ts +27 -0
  189. package/dist/extensions/github/run/payload.js +42 -0
  190. package/dist/extensions/github/world.d.ts +15 -0
  191. package/dist/extensions/github/world.js +3 -0
  192. package/dist/extensions/testserver/canceled.d.ts +7 -0
  193. package/dist/extensions/testserver/canceled.js +27 -0
  194. package/dist/extensions/testserver/command-tree.d.ts +6 -0
  195. package/dist/extensions/testserver/command-tree.js +21 -0
  196. package/dist/extensions/testserver/commands/app.d.ts +22 -0
  197. package/dist/extensions/testserver/commands/app.js +5 -0
  198. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/command.d.ts +277 -237
  199. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/command.js +105 -140
  200. package/dist/extensions/testserver/commands/pool/create/metadata.d.ts +33 -0
  201. package/dist/extensions/testserver/commands/pool/create/metadata.js +55 -0
  202. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/outcomes.d.ts +132 -112
  203. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/outcomes.js +6 -24
  204. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/command.d.ts +3 -4
  205. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/command.js +30 -28
  206. package/dist/extensions/testserver/commands/pool/list/metadata.d.ts +11 -0
  207. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/metadata.js +7 -5
  208. package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/outcomes.js +1 -1
  209. package/dist/extensions/testserver/commands/pool/metadata.d.ts +3 -0
  210. package/dist/extensions/testserver/commands/pool/metadata.js +7 -0
  211. package/dist/extensions/testserver/commands/tree.d.ts +2 -0
  212. package/dist/extensions/testserver/commands/tree.js +6 -0
  213. package/dist/{resources → extensions}/testserver/credential-facts.d.ts +6 -40
  214. package/dist/{resources → extensions}/testserver/credential-facts.js +13 -35
  215. package/dist/extensions/testserver/definition.d.ts +57 -0
  216. package/dist/extensions/testserver/definition.js +71 -0
  217. package/dist/{resources → extensions}/testserver/events.d.ts +5 -4
  218. package/dist/extensions/testserver/events.js +4 -0
  219. package/dist/extensions/testserver/extension.d.ts +46 -0
  220. package/dist/extensions/testserver/extension.js +68 -0
  221. package/dist/extensions/testserver/index.d.ts +20 -0
  222. package/dist/extensions/testserver/index.js +31 -0
  223. package/dist/extensions/testserver/lifecycle.d.ts +24 -0
  224. package/dist/extensions/testserver/lifecycle.js +116 -0
  225. package/dist/{core → extensions/testserver}/limit.js +1 -0
  226. package/dist/extensions/testserver/live/world.d.ts +8 -0
  227. package/dist/extensions/testserver/live/world.js +38 -0
  228. package/dist/{resources/testserver/sandbox → extensions/testserver/options}/channels.d.ts +1 -1
  229. package/dist/extensions/testserver/options/index.d.ts +5 -0
  230. package/dist/extensions/testserver/options/index.js +11 -0
  231. package/dist/extensions/testserver/options/rules.d.ts +69 -0
  232. package/dist/extensions/testserver/options/rules.js +92 -0
  233. package/dist/extensions/testserver/options/sandboxes.d.ts +29 -0
  234. package/dist/extensions/testserver/options/sandboxes.js +33 -0
  235. package/dist/extensions/testserver/options/ttl.d.ts +23 -0
  236. package/dist/extensions/testserver/options/ttl.js +42 -0
  237. package/dist/{resources → extensions}/testserver/pool/channels.d.ts +3 -3
  238. package/dist/{resources → extensions}/testserver/pool/channels.js +2 -2
  239. package/dist/{resources → extensions}/testserver/pool/create.d.ts +1 -2
  240. package/dist/{resources → extensions}/testserver/pool/create.js +2 -1
  241. package/dist/{resources → extensions}/testserver/pool/index.d.ts +0 -1
  242. package/dist/{resources → extensions}/testserver/pool/index.js +2 -3
  243. package/dist/{resources → extensions}/testserver/pool/inspect.d.ts +1 -1
  244. package/dist/{resources → extensions}/testserver/pool/lease.d.ts +1 -1
  245. package/dist/extensions/testserver/pool/live/pool-store-gateway.d.ts +12 -0
  246. package/dist/{resources → extensions}/testserver/pool/live/pool-store-gateway.js +4 -4
  247. package/dist/{resources → extensions}/testserver/pool/pull-request.d.ts +8 -5
  248. package/dist/{resources → extensions}/testserver/pool/pull-request.js +2 -2
  249. package/dist/extensions/testserver/pr-build-facts.d.ts +156 -0
  250. package/dist/extensions/testserver/pr-build-facts.js +309 -0
  251. package/dist/extensions/testserver/presentation.d.ts +11 -0
  252. package/dist/{resources → extensions}/testserver/presentation.js +35 -56
  253. package/dist/{resources/testserver/lane.d.ts → extensions/testserver/progress.d.ts} +10 -6
  254. package/dist/{resources/testserver/lane.js → extensions/testserver/progress.js} +21 -16
  255. package/dist/extensions/testserver/provision.d.ts +160 -0
  256. package/dist/{resources/testserver/provider.js → extensions/testserver/provision.js} +80 -108
  257. package/dist/{resources → extensions}/testserver/pull-request/gateways.d.ts +1 -1
  258. package/dist/extensions/testserver/pull-request/gateways.js +5 -0
  259. package/dist/{resources → extensions}/testserver/pull-request/index.js +2 -2
  260. package/dist/{resources → extensions}/testserver/pull-request/live/github-token-gateway.d.ts +4 -4
  261. package/dist/{resources → extensions}/testserver/pull-request/live/github-token-gateway.js +4 -4
  262. package/dist/extensions/testserver/refusals.d.ts +72 -0
  263. package/dist/extensions/testserver/refusals.js +117 -0
  264. package/dist/extensions/testserver/release.d.ts +14 -0
  265. package/dist/extensions/testserver/release.js +26 -0
  266. package/dist/extensions/testserver/resource.d.ts +57 -0
  267. package/dist/extensions/testserver/resource.js +19 -0
  268. package/dist/extensions/testserver/result.d.ts +55 -0
  269. package/dist/extensions/testserver/result.js +98 -0
  270. package/dist/extensions/testserver/run/connection.d.ts +21 -0
  271. package/dist/extensions/testserver/run/connection.js +39 -0
  272. package/dist/extensions/testserver/run-sandbox.d.ts +16 -0
  273. package/dist/extensions/testserver/run-sandbox.js +11 -0
  274. package/dist/{resources → extensions}/testserver/sandbox/create.d.ts +1 -11
  275. package/dist/{resources → extensions}/testserver/sandbox/create.js +0 -15
  276. package/dist/{resources → extensions}/testserver/sandbox/gateways.d.ts +1 -1
  277. package/dist/{resources → extensions}/testserver/sandbox/index.d.ts +1 -3
  278. package/dist/extensions/testserver/sandbox/index.js +6 -0
  279. package/dist/extensions/testserver/testserver-sdk.d.ts +1 -0
  280. package/dist/extensions/testserver/testserver-sdk.js +4 -0
  281. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/arguments.js +1 -1
  282. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/context.js +1 -1
  283. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/driver.d.ts +1 -1
  284. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/gateways.js +1 -1
  285. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/index.js +4 -4
  286. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/invocation.d.ts +1 -1
  287. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/invocation.js +1 -1
  288. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/redaction.js +1 -1
  289. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/report.d.ts +1 -1
  290. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/report.js +1 -1
  291. package/dist/{vercel-cli → extensions/testserver/vercel-cli}/verbose.js +1 -1
  292. package/dist/extensions/testserver/vitest/config.d.ts +28 -0
  293. package/dist/extensions/testserver/vitest/config.js +39 -0
  294. package/dist/{vitest → extensions/testserver/vitest}/container-scope.d.ts +25 -14
  295. package/dist/{vitest → extensions/testserver/vitest}/container-scope.js +55 -17
  296. package/dist/extensions/testserver/vitest/container-start.d.ts +19 -0
  297. package/dist/extensions/testserver/vitest/container-start.js +31 -0
  298. package/dist/{vitest → extensions/testserver/vitest}/diagnostics.d.ts +66 -29
  299. package/dist/{vitest → extensions/testserver/vitest}/diagnostics.js +146 -50
  300. package/dist/{vitest → extensions/testserver/vitest}/fixtures.d.ts +5 -5
  301. package/dist/{vitest → extensions/testserver/vitest}/fixtures.js +33 -21
  302. package/dist/extensions/testserver/vitest/index.d.ts +3 -0
  303. package/dist/extensions/testserver/vitest/index.js +10 -0
  304. package/dist/extensions/testserver/vitest/sandbox.d.ts +25 -0
  305. package/dist/extensions/testserver/vitest/sandbox.js +43 -0
  306. package/dist/{vitest → extensions/testserver/vitest}/types.d.ts +1 -1
  307. package/dist/extensions/testserver/world.d.ts +25 -0
  308. package/dist/extensions/testserver/world.js +4 -0
  309. package/dist/extensions.d.ts +153 -0
  310. package/dist/extensions.js +53 -0
  311. package/dist/help-logo.js +5 -5
  312. package/dist/launch.js +46 -0
  313. package/dist/launcher-resolvers/index.d.ts +1 -0
  314. package/dist/launcher-resolvers/index.js +7 -0
  315. package/dist/live-app.js +11 -7
  316. package/dist/presentation.js +2 -2
  317. package/dist/runner/base.js +1 -1
  318. package/dist/runner/context.js +1 -1
  319. package/dist/runner/events.js +1 -1
  320. package/dist/runner/gateways.d.ts +11 -11
  321. package/dist/runner/gateways.js +1 -1
  322. package/dist/runner/index.d.ts +4 -4
  323. package/dist/runner/index.js +1 -1
  324. package/dist/runner/live/sandbox-gateway.js +4 -4
  325. package/dist/runner/live/terminal.d.ts +1 -1
  326. package/dist/runner/live/terminal.js +1 -1
  327. package/dist/runner/prepare.d.ts +13 -12
  328. package/dist/runner/prepare.js +3 -3
  329. package/dist/runner/ready.js +2 -2
  330. package/dist/runner/recipe.d.ts +24 -20
  331. package/dist/runner/recipe.js +19 -17
  332. package/dist/runner/{remote-command.d.ts → sandboxed-command.d.ts} +18 -19
  333. package/dist/runner/{remote-command.js → sandboxed-command.js} +21 -22
  334. package/dist/runner/scope.d.ts +3 -3
  335. package/dist/runner/secrets.js +1 -1
  336. package/dist/runner/snapshot-key.d.ts +1 -1
  337. package/dist/runner/snapshot-key.js +4 -4
  338. package/dist/runner/snapshot-save.js +3 -3
  339. package/dist/sdk/extension/commands.d.ts +71 -0
  340. package/dist/sdk/extension/commands.js +31 -0
  341. package/dist/{credential/diagnosis.d.ts → sdk/extension/credential-diagnosis.d.ts} +1 -7
  342. package/dist/{credential/diagnosis.js → sdk/extension/credential-diagnosis.js} +2 -11
  343. package/dist/sdk/extension/credential-source.d.ts +132 -0
  344. package/dist/sdk/extension/credential-source.js +5 -0
  345. package/dist/{credential → sdk/extension}/credential.d.ts +8 -7
  346. package/dist/{credential → sdk/extension}/credential.js +9 -6
  347. package/dist/sdk/extension/index.d.ts +15 -0
  348. package/dist/sdk/extension/index.js +39 -0
  349. package/dist/sdk/extension/launcher-supplies.d.ts +24 -0
  350. package/dist/sdk/extension/launcher-supplies.js +3 -0
  351. package/dist/sdk/extension/lifecycle.d.ts +211 -0
  352. package/dist/sdk/extension/lifecycle.js +9 -0
  353. package/dist/sdk/extension/presentation.d.ts +31 -0
  354. package/dist/sdk/extension/presentation.js +7 -0
  355. package/dist/sdk/extension/progress.d.ts +75 -0
  356. package/dist/sdk/extension/progress.js +8 -0
  357. package/dist/sdk/extension/reports.d.ts +15 -0
  358. package/dist/sdk/extension/reports.js +5 -0
  359. package/dist/sdk/extension/resource-definition.d.ts +204 -0
  360. package/dist/sdk/extension/resource-definition.js +24 -0
  361. package/dist/sdk/extension/resource-factory.d.ts +10 -0
  362. package/dist/sdk/extension/resource-factory.js +15 -0
  363. package/dist/sdk/extension/resource.d.ts +60 -0
  364. package/dist/sdk/extension/resource.js +42 -0
  365. package/dist/sdk/extension/rules.d.ts +16 -0
  366. package/dist/sdk/extension/rules.js +30 -0
  367. package/dist/sdk/extension/span.d.ts +8 -0
  368. package/dist/sdk/extension/span.js +4 -0
  369. package/dist/sdk/extension/time.d.ts +11 -0
  370. package/dist/sdk/extension/time.js +4 -0
  371. package/dist/sdk/extension/token-request-facts.d.ts +39 -0
  372. package/dist/sdk/extension/token-request-facts.js +35 -0
  373. package/dist/sdk/index.d.ts +4 -7
  374. package/dist/sdk/index.js +7 -15
  375. package/dist/sdk/run/contract.d.ts +32 -0
  376. package/dist/sdk/run/contract.js +12 -0
  377. package/dist/sdk/run/launcher.d.ts +5 -0
  378. package/dist/sdk/run/launcher.js +6 -0
  379. package/dist/sdk/run/payload.d.ts +58 -0
  380. package/dist/sdk/run/payload.js +73 -0
  381. package/dist/sdk/run/present.d.ts +11 -0
  382. package/dist/sdk/run/present.js +4 -0
  383. package/dist/sdk/run/redact.d.ts +5 -0
  384. package/dist/sdk/run/redact.js +12 -0
  385. package/dist/time/duration.js +2 -2
  386. package/dist/time/index.js +2 -1
  387. package/dist/time/time.d.ts +2 -11
  388. package/dist/time/time.js +2 -2
  389. package/dist/{sdk → vendor/testserver-sdk}/container/api-request.d.ts +14 -2
  390. package/dist/vendor/testserver-sdk/container/api-request.js +68 -0
  391. package/dist/{sdk → vendor/testserver-sdk}/container/container.d.ts +74 -24
  392. package/dist/{sdk → vendor/testserver-sdk}/container/container.js +180 -90
  393. package/dist/vendor/testserver-sdk/container/external.d.ts +111 -0
  394. package/dist/vendor/testserver-sdk/container/external.js +76 -0
  395. package/dist/vendor/testserver-sdk/container/gateways.d.ts +156 -0
  396. package/dist/{sdk → vendor/testserver-sdk}/container/index.d.ts +2 -1
  397. package/dist/{sdk → vendor/testserver-sdk}/container/index.js +2 -1
  398. package/dist/vendor/testserver-sdk/container/live/container-gateway.d.ts +22 -0
  399. package/dist/vendor/testserver-sdk/container/live/container-gateway.js +165 -0
  400. package/dist/vendor/testserver-sdk/container/recorder.d.ts +69 -0
  401. package/dist/vendor/testserver-sdk/container/recorder.js +121 -0
  402. package/dist/{sdk → vendor/testserver-sdk}/factories/build.d.ts +33 -12
  403. package/dist/{sdk → vendor/testserver-sdk}/factories/build.js +36 -14
  404. package/dist/vendor/testserver-sdk/factories/definition.d.ts +39 -0
  405. package/dist/{sdk → vendor/testserver-sdk}/factories/definition.js +1 -1
  406. package/dist/{sdk → vendor/testserver-sdk}/factories/definitions.d.ts +7 -4
  407. package/dist/{sdk → vendor/testserver-sdk}/factories/definitions.js +10 -0
  408. package/dist/vendor/testserver-sdk/factories/gateways.d.ts +31 -0
  409. package/dist/vendor/testserver-sdk/factories/index.d.ts +4 -0
  410. package/dist/{sdk → vendor/testserver-sdk}/factories/index.js +3 -3
  411. package/dist/vendor/testserver-sdk/index.d.ts +6 -0
  412. package/dist/vendor/testserver-sdk/index.js +11 -0
  413. package/dist/{sdk → vendor/testserver-sdk}/proxy/exchange.d.ts +2 -1
  414. package/dist/{sdk → vendor/testserver-sdk}/proxy/exchange.js +8 -4
  415. package/dist/{sdk → vendor/testserver-sdk}/proxy/faulted-exchange.js +7 -2
  416. package/dist/{sdk → vendor/testserver-sdk}/proxy/faults.d.ts +2 -1
  417. package/dist/{sdk → vendor/testserver-sdk}/proxy/records.d.ts +10 -1
  418. package/dist/{sdk → vendor/testserver-sdk}/proxy/records.js +13 -0
  419. package/dist/{sdk → vendor/testserver-sdk}/records/index.d.ts +1 -1
  420. package/dist/{sdk → vendor/testserver-sdk}/records/records.d.ts +17 -1
  421. package/dist/vendor/testserver-sdk/testserver/external-ids.d.ts +38 -0
  422. package/dist/vendor/testserver-sdk/testserver/external-ids.js +46 -0
  423. package/dist/vendor/testserver-sdk/testserver/failure.d.ts +101 -0
  424. package/dist/vendor/testserver-sdk/testserver/failure.js +108 -0
  425. package/dist/vendor/testserver-sdk/testserver/index.d.ts +7 -0
  426. package/dist/vendor/testserver-sdk/testserver/index.js +11 -0
  427. package/dist/{sdk → vendor/testserver-sdk}/testserver/live/request.d.ts +8 -10
  428. package/dist/{sdk → vendor/testserver-sdk}/testserver/live/request.js +8 -6
  429. package/dist/vendor/testserver-sdk/testserver/routes.d.ts +60 -0
  430. package/dist/vendor/testserver-sdk/testserver/routes.js +84 -0
  431. package/dist/vendor/testserver-sdk/testserver/service-ids.d.ts +31 -0
  432. package/dist/{sdk → vendor/testserver-sdk}/testserver/service-ids.js +27 -4
  433. package/dist/vitest/config.d.ts +2 -28
  434. package/dist/vitest/config.js +6 -36
  435. package/dist/vitest/gateways.js +1 -1
  436. package/dist/vitest/index.d.ts +2 -3
  437. package/dist/vitest/index.js +5 -9
  438. package/dist/vitest/plan.d.ts +1 -16
  439. package/dist/vitest/plan.js +4 -36
  440. package/dist/vitest/test-events.d.ts +1 -18
  441. package/dist/vitest/test-events.js +2 -31
  442. package/package.json +52 -23
  443. package/skills/overview.md +9 -9
  444. package/skills/read-run-output.md +25 -2
  445. package/skills/testserver-builds.md +8 -8
  446. package/dist/chunks/chunk-5CQCRX2L.js +0 -5768
  447. package/dist/chunks/chunk-5U5Q6VZR.js +0 -556
  448. package/dist/chunks/chunk-7O6UN63H.js +0 -63
  449. package/dist/chunks/chunk-NX55IJ5S.js +0 -1842
  450. package/dist/chunks/chunk-OCZJE5XV.js +0 -910
  451. package/dist/chunks/chunk-S5NAIZYS.js +0 -13
  452. package/dist/chunks/chunk-UHO5OCEX.js +0 -360
  453. package/dist/chunks/chunk-WBIHJM7D.js +0 -188
  454. package/dist/combine-errors.d.ts +0 -11
  455. package/dist/combine-errors.js +0 -19
  456. package/dist/commands/exec/testserver-flags.d.ts +0 -48
  457. package/dist/commands/exec/testserver-flags.js +0 -80
  458. package/dist/config/by-name.d.ts +0 -24
  459. package/dist/config/by-name.js +0 -26
  460. package/dist/config/resource-config.d.ts +0 -132
  461. package/dist/config/resource-config.js +0 -19
  462. package/dist/config/set.d.ts +0 -27
  463. package/dist/config/set.js +0 -71
  464. package/dist/core/command-provider.d.ts +0 -126
  465. package/dist/core/command-provider.js +0 -13
  466. package/dist/core/command-slots.d.ts +0 -73
  467. package/dist/core/command-slots.js +0 -140
  468. package/dist/core/keyed.d.ts +0 -12
  469. package/dist/core/keyed.js +0 -24
  470. package/dist/core/lane.d.ts +0 -46
  471. package/dist/core/lane.js +0 -5
  472. package/dist/core/presentation.d.ts +0 -87
  473. package/dist/core/presentation.js +0 -5
  474. package/dist/core/provider.d.ts +0 -79
  475. package/dist/core/provider.js +0 -5
  476. package/dist/resource-commands.d.ts +0 -13
  477. package/dist/resource-commands.js +0 -22
  478. package/dist/resources/github/cleanup.d.ts +0 -23
  479. package/dist/resources/github/cleanup.js +0 -39
  480. package/dist/resources/github/command.d.ts +0 -126
  481. package/dist/resources/github/command.js +0 -117
  482. package/dist/resources/github/config.d.ts +0 -16
  483. package/dist/resources/github/config.js +0 -37
  484. package/dist/resources/github/events.d.ts +0 -26
  485. package/dist/resources/github/events.js +0 -2
  486. package/dist/resources/github/index.d.ts +0 -12
  487. package/dist/resources/github/index.js +0 -15
  488. package/dist/resources/github/live/gateways.d.ts +0 -6
  489. package/dist/resources/github/live/gateways.js +0 -13
  490. package/dist/resources/github/presentation.d.ts +0 -13
  491. package/dist/resources/github/presentation.js +0 -43
  492. package/dist/resources/github/provider.d.ts +0 -66
  493. package/dist/resources/github/provider.js +0 -58
  494. package/dist/resources/github/resource-provider.d.ts +0 -6
  495. package/dist/resources/github/resource-provider.js +0 -20
  496. package/dist/resources/github/resource.d.ts +0 -33
  497. package/dist/resources/github/resource.js +0 -12
  498. package/dist/resources/testserver/cleanup.d.ts +0 -14
  499. package/dist/resources/testserver/cleanup.js +0 -22
  500. package/dist/resources/testserver/command-tree.d.ts +0 -4
  501. package/dist/resources/testserver/command-tree.js +0 -12
  502. package/dist/resources/testserver/command.d.ts +0 -520
  503. package/dist/resources/testserver/command.js +0 -252
  504. package/dist/resources/testserver/commands/app.d.ts +0 -18
  505. package/dist/resources/testserver/commands/app.js +0 -3
  506. package/dist/resources/testserver/commands/create/metadata.d.ts +0 -31
  507. package/dist/resources/testserver/commands/create/metadata.js +0 -53
  508. package/dist/resources/testserver/commands/list/metadata.d.ts +0 -9
  509. package/dist/resources/testserver/config.d.ts +0 -18
  510. package/dist/resources/testserver/config.js +0 -88
  511. package/dist/resources/testserver/events.js +0 -4
  512. package/dist/resources/testserver/index.d.ts +0 -16
  513. package/dist/resources/testserver/index.js +0 -25
  514. package/dist/resources/testserver/live/gateways.d.ts +0 -8
  515. package/dist/resources/testserver/live/gateways.js +0 -39
  516. package/dist/resources/testserver/options.d.ts +0 -5
  517. package/dist/resources/testserver/options.js +0 -5
  518. package/dist/resources/testserver/pool/directory.d.ts +0 -4
  519. package/dist/resources/testserver/pool/directory.js +0 -5
  520. package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +0 -12
  521. package/dist/resources/testserver/pr-build-facts.d.ts +0 -130
  522. package/dist/resources/testserver/pr-build-facts.js +0 -261
  523. package/dist/resources/testserver/presentation.d.ts +0 -9
  524. package/dist/resources/testserver/provider.d.ts +0 -187
  525. package/dist/resources/testserver/pull-request/gateways.js +0 -5
  526. package/dist/resources/testserver/ran.d.ts +0 -92
  527. package/dist/resources/testserver/ran.js +0 -156
  528. package/dist/resources/testserver/resource-provider.d.ts +0 -12
  529. package/dist/resources/testserver/resource-provider.js +0 -32
  530. package/dist/resources/testserver/resource.d.ts +0 -36
  531. package/dist/resources/testserver/resource.js +0 -10
  532. package/dist/resources/testserver/run-sandbox.d.ts +0 -13
  533. package/dist/resources/testserver/run-sandbox.js +0 -6
  534. package/dist/resources/testserver/sandbox/index.js +0 -8
  535. package/dist/resources.d.ts +0 -702
  536. package/dist/resources.js +0 -83
  537. package/dist/sdk/container/api-request.js +0 -46
  538. package/dist/sdk/container/gateways.d.ts +0 -108
  539. package/dist/sdk/container/live/container-gateway.d.ts +0 -17
  540. package/dist/sdk/container/live/container-gateway.js +0 -114
  541. package/dist/sdk/factories/definition.d.ts +0 -28
  542. package/dist/sdk/factories/gateways.d.ts +0 -25
  543. package/dist/sdk/factories/index.d.ts +0 -5
  544. package/dist/sdk/factories/live/factory-gateway.d.ts +0 -10
  545. package/dist/sdk/factories/live/factory-gateway.js +0 -29
  546. package/dist/sdk/host.d.ts +0 -2
  547. package/dist/sdk/host.js +0 -7
  548. package/dist/sdk/payload/index.d.ts +0 -2
  549. package/dist/sdk/payload/index.js +0 -4
  550. package/dist/sdk/payload/payload.d.ts +0 -47
  551. package/dist/sdk/payload/payload.js +0 -74
  552. package/dist/sdk/testserver/failure.d.ts +0 -73
  553. package/dist/sdk/testserver/failure.js +0 -61
  554. package/dist/sdk/testserver/index.d.ts +0 -5
  555. package/dist/sdk/testserver/index.js +0 -8
  556. package/dist/sdk/testserver/service-ids.d.ts +0 -19
  557. package/dist/vitest/sandbox.d.ts +0 -22
  558. package/dist/vitest/sandbox.js +0 -41
  559. /package/dist/{credential/settle.js → config/credential-settle.js} +0 -0
  560. /package/dist/{resources → extensions}/github/gateways.d.ts +0 -0
  561. /package/dist/{resources → extensions}/github/gateways.js +0 -0
  562. /package/dist/{resources → extensions}/github/live/fixture-repo-gateway.d.ts +0 -0
  563. /package/dist/{resources → extensions}/github/live/fixture-repo-gateway.js +0 -0
  564. /package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/outcomes.d.ts +0 -0
  565. /package/dist/{core → extensions/testserver}/limit.d.ts +0 -0
  566. /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/build-reference.d.ts +0 -0
  567. /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/build-reference.js +0 -0
  568. /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/channels.js +0 -0
  569. /package/dist/{resources → extensions}/testserver/pool/gateways.d.ts +0 -0
  570. /package/dist/{resources → extensions}/testserver/pool/gateways.js +0 -0
  571. /package/dist/{resources → extensions}/testserver/pool/host.d.ts +0 -0
  572. /package/dist/{resources → extensions}/testserver/pool/host.js +0 -0
  573. /package/dist/{resources → extensions}/testserver/pool/inspect.js +0 -0
  574. /package/dist/{resources → extensions}/testserver/pool/lease.js +0 -0
  575. /package/dist/{resources → extensions}/testserver/pool/live/pool-records.d.ts +0 -0
  576. /package/dist/{resources → extensions}/testserver/pool/live/pool-records.js +0 -0
  577. /package/dist/{resources → extensions}/testserver/pool/staleness.d.ts +0 -0
  578. /package/dist/{resources → extensions}/testserver/pool/staleness.js +0 -0
  579. /package/dist/{resources → extensions}/testserver/pull-request/index.d.ts +0 -0
  580. /package/dist/{resources → extensions}/testserver/pull-request/live/github-rest.d.ts +0 -0
  581. /package/dist/{resources → extensions}/testserver/pull-request/live/github-rest.js +0 -0
  582. /package/dist/{resources → extensions}/testserver/pull-request/live/pull-request-gateway.d.ts +0 -0
  583. /package/dist/{resources → extensions}/testserver/pull-request/live/pull-request-gateway.js +0 -0
  584. /package/dist/{resources → extensions}/testserver/pull-request/live/testserver-workflow-gateway.d.ts +0 -0
  585. /package/dist/{resources → extensions}/testserver/pull-request/live/testserver-workflow-gateway.js +0 -0
  586. /package/dist/{resources → extensions}/testserver/sandbox/create-failure.d.ts +0 -0
  587. /package/dist/{resources → extensions}/testserver/sandbox/create-failure.js +0 -0
  588. /package/dist/{resources → extensions}/testserver/sandbox/gateways.js +0 -0
  589. /package/dist/{resources → extensions}/testserver/sandbox/live/builds-response.d.ts +0 -0
  590. /package/dist/{resources → extensions}/testserver/sandbox/live/builds-response.js +0 -0
  591. /package/dist/{resources → extensions}/testserver/sandbox/live/control-plane-gateway.d.ts +0 -0
  592. /package/dist/{resources → extensions}/testserver/sandbox/live/control-plane-gateway.js +0 -0
  593. /package/dist/{resources → extensions}/testserver/sandbox/live/create-response.d.ts +0 -0
  594. /package/dist/{resources → extensions}/testserver/sandbox/live/create-response.js +0 -0
  595. /package/dist/{resources → extensions}/testserver/sandbox/live/fetch-failure.d.ts +0 -0
  596. /package/dist/{resources → extensions}/testserver/sandbox/live/fetch-failure.js +0 -0
  597. /package/dist/{resources → extensions}/testserver/sandbox/live/health-check-gateway.d.ts +0 -0
  598. /package/dist/{resources → extensions}/testserver/sandbox/live/health-check-gateway.js +0 -0
  599. /package/dist/{resources → extensions}/testserver/sandbox/live/sse.d.ts +0 -0
  600. /package/dist/{resources → extensions}/testserver/sandbox/live/sse.js +0 -0
  601. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/ansi.d.ts +0 -0
  602. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/ansi.js +0 -0
  603. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/arguments.d.ts +0 -0
  604. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/auth-config.d.ts +0 -0
  605. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/auth-config.js +0 -0
  606. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/clock.d.ts +0 -0
  607. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/clock.js +0 -0
  608. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/config-files.d.ts +0 -0
  609. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/config-files.js +0 -0
  610. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/context.d.ts +0 -0
  611. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/driver.js +0 -0
  612. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/entry.d.ts +0 -0
  613. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/entry.js +0 -0
  614. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/environment.d.ts +0 -0
  615. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/environment.js +0 -0
  616. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/errors.d.ts +0 -0
  617. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/errors.js +0 -0
  618. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/gateways.d.ts +0 -0
  619. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/index.d.ts +0 -0
  620. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/keys.d.ts +0 -0
  621. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/keys.js +0 -0
  622. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/config-files.d.ts +0 -0
  623. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/config-files.js +0 -0
  624. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/process-gateway.d.ts +0 -0
  625. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/process-gateway.js +0 -0
  626. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/redaction.d.ts +0 -0
  627. /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/verbose.d.ts +0 -0
  628. /package/dist/{vitest → extensions/testserver/vitest}/types.js +0 -0
  629. /package/dist/sdk/{payload → run}/test-events.d.ts +0 -0
  630. /package/dist/sdk/{payload → run}/test-events.js +0 -0
  631. /package/dist/{sdk → vendor/testserver-sdk}/container/feature-flags.d.ts +0 -0
  632. /package/dist/{sdk → vendor/testserver-sdk}/container/feature-flags.js +0 -0
  633. /package/dist/{sdk → vendor/testserver-sdk}/container/gateways.js +0 -0
  634. /package/dist/{sdk → vendor/testserver-sdk}/factories/gateways.js +0 -0
  635. /package/dist/{sdk → vendor/testserver-sdk}/proxy/faulted-exchange.d.ts +0 -0
  636. /package/dist/{sdk → vendor/testserver-sdk}/proxy/faults.js +0 -0
  637. /package/dist/{sdk → vendor/testserver-sdk}/proxy/index.d.ts +0 -0
  638. /package/dist/{sdk → vendor/testserver-sdk}/proxy/index.js +0 -0
  639. /package/dist/{sdk → vendor/testserver-sdk}/proxy/proxy.d.ts +0 -0
  640. /package/dist/{sdk → vendor/testserver-sdk}/proxy/proxy.js +0 -0
  641. /package/dist/{sdk → vendor/testserver-sdk}/records/body.d.ts +0 -0
  642. /package/dist/{sdk → vendor/testserver-sdk}/records/body.js +0 -0
  643. /package/dist/{sdk → vendor/testserver-sdk}/records/index.js +0 -0
  644. /package/dist/{sdk → vendor/testserver-sdk}/records/records.js +0 -0
  645. /package/dist/{sdk → vendor/testserver-sdk}/seed/index.d.ts +0 -0
  646. /package/dist/{sdk → vendor/testserver-sdk}/seed/index.js +0 -0
  647. /package/dist/{sdk → vendor/testserver-sdk}/seed/seed.d.ts +0 -0
  648. /package/dist/{sdk → vendor/testserver-sdk}/seed/seed.js +0 -0
  649. /package/dist/{sdk → vendor/testserver-sdk}/testserver/clock.d.ts +0 -0
  650. /package/dist/{sdk → vendor/testserver-sdk}/testserver/clock.js +0 -0
  651. /package/dist/{sdk → vendor/testserver-sdk}/testserver/live/connect-failure.d.ts +0 -0
  652. /package/dist/{sdk → vendor/testserver-sdk}/testserver/live/connect-failure.js +0 -0
  653. /package/dist/{sdk → vendor/testserver-sdk}/testserver/test-id.d.ts +0 -0
  654. /package/dist/{sdk → vendor/testserver-sdk}/testserver/test-id.js +0 -0
@@ -2,135 +2,615 @@ import {
2
2
  versionText
3
3
  } from "./chunk-I5GZLOLQ.js";
4
4
  import {
5
- criticalPathStep,
6
- laneLabel,
7
5
  testsChart,
8
6
  testsSummaryLines,
9
7
  waterfallLines
10
- } from "./chunk-WV6WQFC6.js";
8
+ } from "./chunk-JQ2HK4RN.js";
11
9
  import {
12
- mintFailedErrors,
13
- outcomes,
14
- runErrors,
10
+ NodeSignalCancellation
11
+ } from "./chunk-WF4KJ7YG.js";
12
+ import {
13
+ RESOURCE_FLAG_HELP,
14
+ RESOURCE_USAGE_FLAGS,
15
+ criticalPathStep,
16
+ recordedPlan,
17
+ resourceFlagFields,
18
+ resourceFlagProblems,
19
+ resourceFlagValues,
15
20
  runRecordText,
16
- testTotals
17
- } from "./chunk-5U5Q6VZR.js";
21
+ saveSchema,
22
+ testPlanLine,
23
+ testTotals,
24
+ timelineFacts,
25
+ timelineSchema
26
+ } from "./chunk-H2VCSNVU.js";
18
27
  import {
28
+ EMPTY_RUN_STATE,
19
29
  RESOURCES,
20
- RESOURCE_COMMANDS,
21
- RESOURCE_CONFIGS,
22
30
  RESOURCE_PRESENTATIONS,
23
31
  RESOURCE_REPORTS,
24
32
  RUN_CLEANUP,
25
- applyStormRunEvent,
33
+ RUN_DIRECTORIES_KEPT,
34
+ applyStormEvent,
35
+ cleanupProblems,
36
+ commandExitStatus,
37
+ executeRun,
26
38
  isoSecondsText,
27
39
  keepTimeText,
28
40
  keptText,
41
+ megabytesText,
29
42
  notDeletedText,
30
43
  notKeptText,
31
44
  notStoppedText,
45
+ observeAll,
32
46
  paint,
47
+ releaseText,
48
+ resourceLifecycles,
49
+ runDirectoryObserver,
50
+ runnerCleanupWarnings,
33
51
  seconds,
52
+ secondsOf,
53
+ secondsText,
34
54
  short,
35
55
  shortFile,
36
56
  spread,
57
+ stepLog,
37
58
  stormTimeline,
59
+ testEventsPath,
60
+ timedProgress,
38
61
  truncate,
39
- visibleLength
40
- } from "./chunk-NX55IJ5S.js";
62
+ visibleLength,
63
+ warningTally
64
+ } from "./chunk-AGWW3HDT.js";
41
65
  import {
42
- fileOptions,
66
+ RUNNER_SECRET_MIN_LENGTH,
67
+ configErrors,
68
+ credentialErrors,
43
69
  fileSettings,
44
- givenOptionsOf,
45
70
  invalidConfig,
46
71
  loadSettingsFile,
47
- optionKeyPath,
48
- parseSetFlags,
49
- settleResourceOptions
50
- } from "./chunk-OCZJE5XV.js";
51
- import {
52
- EMPTY_RUN_STATE,
53
- RUNNER_SECRET_MIN_LENGTH,
54
- RUN_DIRECTORIES_KEPT,
55
- cleanupProblems,
56
- commandExitStatus,
57
- describeMintFailure,
58
- executeRun,
59
- megabytesText,
60
72
  mintTargetText,
61
- observeAll,
62
73
  parseKeepTime,
63
74
  parseTestEvent,
64
75
  prepareRunner,
65
76
  readRunnerSecrets,
77
+ recipeRun,
66
78
  redactSecrets,
67
79
  requireTarget,
68
- runDirectoryObserver,
69
- secondsOf,
70
- secondsText,
71
80
  settleCredential,
72
- stepLog,
73
- testEventLine,
74
- testEventsPath,
75
- timedProgress
76
- } from "./chunk-5CQCRX2L.js";
81
+ settleRunResources,
82
+ testEventLine
83
+ } from "./chunk-VJQLMGOH.js";
84
+ import {
85
+ describeMintFailure
86
+ } from "./chunk-XHJGHJBW.js";
87
+ import {
88
+ defineErrors,
89
+ defineOutcomes,
90
+ refused,
91
+ renderOutcome
92
+ } from "./chunk-ZJ2USLAT.js";
77
93
 
78
- // src/commands/exec/testserver-flags.ts
79
- var TESTSERVER_FLAGS = {
80
- sandboxes: { field: "testserverSandboxes", flag: "--testserver-sandboxes" },
81
- build: { field: "testserverBuild", flag: "--testserver-build" },
82
- minTimeLeft: { field: "testserverMinTimeLeft", flag: "--testserver-min-time-left" },
83
- ttl: { field: "testserverTtl", flag: "--testserver-ttl" },
84
- noCreate: { field: "testserverNoCreate", flag: "--testserver-no-create" }
94
+ // src/commands/exec/outcomes.ts
95
+ import { z as z3 } from "zod";
96
+
97
+ // src/commands/exec/mint-failed.ts
98
+ import { z } from "zod";
99
+ var mintFailedErrors = defineErrors({
100
+ mintFailed: {
101
+ exitCode: 1,
102
+ 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.",
103
+ schema: z.object({
104
+ team: z.string(),
105
+ project: z.string(),
106
+ cause: z.string(),
107
+ fix: z.string(),
108
+ /** Whether the credential was for the runner sandbox, not for a resource. */
109
+ runner: z.boolean(),
110
+ /** What the run couldn't clean up. */
111
+ cleanup: RUN_CLEANUP.schema
112
+ }),
113
+ render: ({ cause, fix, runner, cleanup }) => {
114
+ const rows = RUN_CLEANUP.rows(cleanup);
115
+ return {
116
+ 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.`,
117
+ ...rows.length === 0 ? {} : { rows },
118
+ next: [{ type: "text", text: fix }]
119
+ };
120
+ }
121
+ }
122
+ });
123
+
124
+ // src/commands/exec/resource-refusals.ts
125
+ import { z as z2 } from "zod";
126
+ var refusalShape = {
127
+ /** The resource instance that refused, by its resource key. */
128
+ resource: z2.string().min(1),
129
+ /** The resource's own snake_case reason for refusing. */
130
+ refusal: z2.string(),
131
+ /** The resource's own data about the refusal, which differs by resource and reason. */
132
+ data: z2.record(z2.string(), z2.unknown())
85
133
  };
86
- function isTestserverPoolConfig(config) {
87
- return config.name === "testserverPool";
88
- }
89
- function testserverPoolConfig() {
90
- const config = RESOURCE_CONFIGS.find(isTestserverPoolConfig);
91
- if (config === void 0) throw new Error("The registry has no testserverPool resource config");
92
- return config;
93
- }
94
- var CONFIG = testserverPoolConfig();
95
- var RULES = CONFIG.options;
96
- var TESTSERVER_OWN_FLAGS = Object.fromEntries(
97
- Object.entries(TESTSERVER_FLAGS).map(([option, { flag }]) => [optionKeyPath(CONFIG.name, option), flag])
98
- );
99
- function readTestserverFlags(request) {
100
- const values = {};
101
- const problems = [];
102
- for (const [option, { field, flag }] of Object.entries(TESTSERVER_FLAGS)) {
103
- const value = request[field];
104
- if (value === void 0) continue;
105
- const rule = RULES[option];
106
- if (rule === void 0) throw new Error(`testserverPool has no option ${option}`);
107
- const checked = rule.check(value);
108
- if (checked.ok) values[option] = checked.value;
109
- else problems.push(...checked.problems.map(({ problem }) => ({ field, message: `${flag} ${problem}.` })));
134
+ function contentOf({ message, next, rows: own = [] }, rows) {
135
+ const all = [...own, ...rows];
136
+ return { message, ...next === void 0 ? {} : { next }, ...all.length === 0 ? {} : { rows: all } };
137
+ }
138
+ var resourceRefusalErrors = defineErrors({
139
+ resourceRefusedBeforeRun: {
140
+ exitCode: 2,
141
+ 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.",
142
+ schema: z2.object({
143
+ ...refusalShape,
144
+ /** The config file that applied (its absolute path); null when none did. */
145
+ configFile: z2.string().nullable()
146
+ }),
147
+ render: (_data, refusal) => contentOf(refusal, [])
148
+ },
149
+ resourceRefused: {
150
+ exitCode: 1,
151
+ 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.",
152
+ schema: z2.object({
153
+ ...refusalShape,
154
+ /** What the run couldn't clean up. */
155
+ cleanup: RUN_CLEANUP.schema
156
+ }),
157
+ render: ({ cleanup }, refusal) => contentOf(refusal, RUN_CLEANUP.rows(cleanup))
158
+ }
159
+ });
160
+ function resourceRefusedBeforeRun(resource, refusal, configFile) {
161
+ const { refused: refused2, data, ...content } = refusal;
162
+ return resourceRefusalErrors.resourceRefusedBeforeRun(
163
+ { resource, refusal: refused2, data: { ...data }, configFile },
164
+ content
165
+ );
166
+ }
167
+ function resourceRefused(outcome, cleanup) {
168
+ const { refused: refused2, data, ...content } = outcome.refusal;
169
+ return resourceRefusalErrors.resourceRefused(
170
+ { resource: outcome.resource, refusal: refused2, data: { ...data }, cleanup },
171
+ content
172
+ );
173
+ }
174
+
175
+ // src/commands/exec/outcomes.ts
176
+ var runnerFailureSchema = z3.union([
177
+ z3.object({
178
+ kind: z3.enum(["snapshot-build-step-failed", "apply-failed", "install-failed", "build-failed"]),
179
+ /** The step's label. */
180
+ label: z3.string(),
181
+ /** Its exit code; null when it ended without one. */
182
+ exitCode: z3.number().nullable(),
183
+ /** Its last 40 output lines. */
184
+ tail: z3.array(z3.string())
185
+ }),
186
+ z3.object({
187
+ kind: z3.literal("sandbox-api-failed"),
188
+ /** The Sandbox call that failed. */
189
+ operation: z3.string(),
190
+ /** The HTTP status the Sandbox API answered; null when it answered none. */
191
+ status: z3.number().nullable(),
192
+ message: z3.string()
193
+ }),
194
+ z3.object({
195
+ kind: z3.literal("checkout-failed"),
196
+ /** What git or tar said. */
197
+ message: z3.string(),
198
+ /** The failed command; null when there was none. */
199
+ command: z3.string().nullable()
200
+ }),
201
+ z3.object({ kind: z3.literal("credential-claims-missing"), team: z3.string(), project: z3.string() })
202
+ ]);
203
+ function listed(names) {
204
+ if (names.length <= 1) return names.join("");
205
+ return `${names.slice(0, -1).join(", ")} and ${names.at(-1) ?? ""}`;
206
+ }
207
+ function stepEnded(exitCode) {
208
+ return exitCode === null ? "ended without an exit code" : `exited ${exitCode}`;
209
+ }
210
+ function runnerFailureText(failure) {
211
+ switch (failure.kind) {
212
+ case "snapshot-build-step-failed":
213
+ return {
214
+ message: `The runner snapshot build's step "${failure.label}" ${stepEnded(failure.exitCode)}. The command didn't run.`,
215
+ next: "Fix the step in the runner recipe, then retry. A failed build records no runner snapshot."
216
+ };
217
+ case "apply-failed":
218
+ return {
219
+ message: `Couldn't apply your changes in the runner sandbox: "${failure.label}" ${stepEnded(failure.exitCode)}. The command didn't run.`,
220
+ next: "Check the output for the file that didn't apply, then retry."
221
+ };
222
+ case "install-failed":
223
+ return {
224
+ message: `The runner's install, "${failure.label}", ${stepEnded(failure.exitCode)}. The command didn't run.`,
225
+ next: "Fix run.install in the runner recipe, or what it installs, then retry."
226
+ };
227
+ case "build-failed":
228
+ return {
229
+ message: `The runner's build, "${failure.label}", ${stepEnded(failure.exitCode)}. The command didn't run.`,
230
+ next: "Fix the build, or run.build in the runner recipe, then retry."
231
+ };
232
+ case "sandbox-api-failed":
233
+ return {
234
+ 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."}`,
235
+ next: "Retry; if it keeps failing, check the Vercel Sandbox status and the project's Sandbox access."
236
+ };
237
+ case "checkout-failed":
238
+ return {
239
+ message: `git or tar failed on this machine: ${failure.message}. The command didn't run.`,
240
+ next: "Fix the checkout, then retry."
241
+ };
242
+ case "credential-claims-missing":
243
+ return {
244
+ 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.`,
245
+ next: "Mint for a Vercel project whose development OIDC tokens carry owner_id and project_id, then retry."
246
+ };
247
+ }
248
+ }
249
+ var ranSchema = z3.object({
250
+ /** storm's version. */
251
+ version: z3.string(),
252
+ /** 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. */
253
+ commit: z3.string().nullable(),
254
+ /** The config file the run's settings came from (its absolute path); null when none applied. */
255
+ configFile: z3.string().nullable(),
256
+ /**
257
+ * What each acquired resource instance that reports something says of itself, keyed by resource key: its
258
+ * definition's name (`definition`), its facts (`facts`, what its acquire answered, unknown to the schema, or null
259
+ * when it answered none) and the warnings its acquire reported (`warnings`).
260
+ */
261
+ resources: RESOURCE_REPORTS.ranSchema,
262
+ /**
263
+ * What the run's cleanup left: the runner sandbox it kept running and the runner's sandboxes it couldn't stop or
264
+ * delete (`runner`, null without a runner sandbox), and what releasing each of its resource instances couldn't do,
265
+ * its warnings, keyed by resource key, each with its definition's name (`resources`, `{}` when it took none).
266
+ */
267
+ cleanup: RUN_CLEANUP.schema,
268
+ /**
269
+ * How the command ended: its exit code, or the signal that ended it; both null for a command in the runner sandbox
270
+ * that ended without an exit code.
271
+ */
272
+ command: z3.object({ exitCode: z3.number().nullable(), signal: z3.string().nullable() }),
273
+ /** The runner sandbox the command ran in; null without one. */
274
+ runner: z3.object({
275
+ /** The runner snapshot it started from. */
276
+ snapshotId: z3.string(),
277
+ /** The runner snapshot's base, a full SHA. */
278
+ base: z3.string(),
279
+ /** For a branch snapshot, the local branch of the run that saved it; null for a base snapshot. */
280
+ snapshotBranch: z3.string().nullable(),
281
+ /** For a branch snapshot, the HEAD commit of the run that saved it, a full SHA; null for a base snapshot. */
282
+ snapshotHead: z3.string().nullable(),
283
+ /** Whether this run built the runner snapshot. */
284
+ built: z3.boolean(),
285
+ vcpus: z3.number(),
286
+ region: z3.string(),
287
+ runtime: z3.string(),
288
+ /** How long the build step took, in milliseconds. */
289
+ buildMs: z3.number(),
290
+ /** How saving the runner sandbox as a branch snapshot ended (--save-snapshot); null without the flag. */
291
+ save: saveSchema.nullable()
292
+ }).nullable(),
293
+ /** 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. */
294
+ timeline: timelineSchema,
295
+ /** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
296
+ runId: z3.string().nullable()
297
+ });
298
+ 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.";
299
+ function renderRan(ran) {
300
+ const warnings = [
301
+ ...RESOURCE_REPORTS.ranWarnings(ran.resources),
302
+ ...ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null ? [
303
+ {
304
+ reason: "sandboxed_no_exit_code",
305
+ message: "The command ended in the runner sandbox without an exit code, so storm exits 1."
306
+ }
307
+ ] : [],
308
+ ...runnerCleanupWarnings(ran.cleanup.runner),
309
+ ...RESOURCE_REPORTS.cleanupWarnings(ran.cleanup.resources)
310
+ ];
311
+ const kept = ran.cleanup.runner?.kept ?? null;
312
+ return renderOutcome({
313
+ ...kept === null ? {} : { message: keptText(kept) },
314
+ ...warnings.length === 0 ? {} : { warnings }
315
+ });
316
+ }
317
+ var runErrors = defineErrors({
318
+ credentialUnused: {
319
+ exitCode: 2,
320
+ description: "--credential was given to a run with no resource that takes a credential.",
321
+ schema: z3.object({
322
+ /** The flags given that none of the run's resources takes, as typed, such as --credential. */
323
+ flags: z3.array(z3.string()),
324
+ /** The config file that applied; null when none did. */
325
+ configFile: z3.string().nullable()
326
+ }),
327
+ render: ({ flags }) => ({
328
+ message: `${flags.join(", ")} ${flags.length === 1 ? "applies" : "apply"} only to a run with a resource that takes a credential, and this run has none.`,
329
+ next: [
330
+ {
331
+ type: "text",
332
+ text: `Drop ${flags.join(" and ")}, or give the run a resource that takes a credential, in storm.config.ts or on the command line.`
333
+ }
334
+ ]
335
+ })
336
+ },
337
+ missingRunner: {
338
+ exitCode: 2,
339
+ description: "A sandboxed run (no --unsandboxed) needs a runner recipe, and no storm.config.ts gives a runner key.",
340
+ schema: z3.object({
341
+ /** The config file that applied; null when none did. */
342
+ configFile: z3.string().nullable()
343
+ }),
344
+ render: ({ configFile }) => ({
345
+ 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.`,
346
+ next: [
347
+ {
348
+ type: "text",
349
+ text: "Add a runner recipe under the runner key of storm.config.ts, or run on this machine with --unsandboxed."
350
+ }
351
+ ]
352
+ })
353
+ },
354
+ runnerSecretsInvalid: {
355
+ exitCode: 2,
356
+ 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.",
357
+ schema: z3.object({
358
+ /** Each variable storm can't use and why, in the recipe's order. */
359
+ variables: z3.array(z3.object({ name: z3.string(), problem: z3.enum(["missing", "multiline", "short"]) })),
360
+ /** The fewest characters a runner secret's value may have. */
361
+ minLength: z3.number(),
362
+ /** The config file that gave the runner recipe. */
363
+ configFile: z3.string().nullable()
364
+ }),
365
+ render: ({ variables, minLength, configFile }) => {
366
+ const named = (problem) => variables.filter((variable) => variable.problem === problem).map(({ name }) => name);
367
+ const [missing, multiline, short2] = [named("missing"), named("multiline"), named("short")];
368
+ return {
369
+ message: `runner.secrets${configFile === null ? "" : ` in ${configFile}`} names ${variables.length === 1 ? "a variable" : "variables"} storm can't use. The run didn't start.`,
370
+ rows: [
371
+ [
372
+ "Runner secrets",
373
+ variables.map(
374
+ ({ 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`
375
+ )
376
+ ]
377
+ ],
378
+ next: [
379
+ {
380
+ type: "text",
381
+ text: [
382
+ ...missing.length === 0 ? [] : [`Set ${listed(missing)} in this machine's environment.`],
383
+ ...multiline.length === 0 ? [] : [
384
+ `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.`
385
+ ],
386
+ ...short2.length === 0 ? [] : [`Set ${listed(short2)} to the whole secret.`]
387
+ ].join(" ")
388
+ },
389
+ { type: "text", text: "Or run on this machine with --unsandboxed, which reads no runner secret." }
390
+ ]
391
+ };
392
+ }
393
+ },
394
+ noBaseRef: {
395
+ exitCode: 1,
396
+ 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.",
397
+ schema: z3.object({
398
+ /** Each ref in baseRefs, and why it gave no base. */
399
+ refs: z3.array(z3.object({ ref: z3.string(), reason: z3.enum(["missing", "unrelated"]) }))
400
+ }),
401
+ render: ({ refs }) => ({
402
+ 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.`,
403
+ rows: [
404
+ [
405
+ "Base refs",
406
+ refs.map(
407
+ ({ ref, reason }) => reason === "missing" ? `${ref}: no such local ref` : `${ref}: shares no history with HEAD`
408
+ )
409
+ ]
410
+ ],
411
+ next: [
412
+ {
413
+ type: "text",
414
+ 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.`
415
+ }
416
+ ]
417
+ })
418
+ },
419
+ submodulesRefused: {
420
+ exitCode: 1,
421
+ description: "In a sandboxed run, the checkout has Git submodules, which neither the upload nor the base's files carry.",
422
+ schema: z3.object({ paths: z3.array(z3.string()) }),
423
+ render: ({ paths }) => ({
424
+ message: `The checkout has Git submodules, which the runner can't carry: ${paths.join(", ")}. The command didn't run.`,
425
+ next: [{ type: "text", text: "Run on this machine with --unsandboxed." }]
426
+ })
427
+ },
428
+ snapshotGone: {
429
+ exitCode: 1,
430
+ 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.",
431
+ schema: z3.object({
432
+ snapshotId: z3.string(),
433
+ /** The runner snapshot's base, a full SHA. */
434
+ base: z3.string(),
435
+ /** Why its cache entry couldn't be removed; null when it was. */
436
+ removal: z3.object({ path: z3.string(), message: z3.string() }).nullable(),
437
+ /** What the run couldn't clean up. */
438
+ cleanup: RUN_CLEANUP.schema
439
+ }),
440
+ render: ({ snapshotId, removal, cleanup }) => {
441
+ const rows = RUN_CLEANUP.rows(cleanup);
442
+ return {
443
+ 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.`,
444
+ ...rows.length === 0 ? {} : { rows },
445
+ next: [
446
+ {
447
+ type: "text",
448
+ text: removal === null ? "Run again: the next run picks another runner snapshot or builds one." : `Remove ${removal.path}, then run again.`
449
+ }
450
+ ]
451
+ };
452
+ }
453
+ },
454
+ runnerFailed: {
455
+ exitCode: 1,
456
+ 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.",
457
+ schema: z3.object({
458
+ failure: runnerFailureSchema,
459
+ /** What the run couldn't clean up; its `runner` is null when the run failed before it started a sandbox. */
460
+ cleanup: RUN_CLEANUP.schema
461
+ }),
462
+ render: ({ failure, cleanup }) => {
463
+ const { message, next } = runnerFailureText(failure);
464
+ const rows = [
465
+ ..."tail" in failure && failure.tail.length > 0 ? [["Last output", failure.tail]] : [],
466
+ ...failure.kind === "checkout-failed" && failure.command !== null ? [["Command", failure.command]] : [],
467
+ ...RUN_CLEANUP.rows(cleanup)
468
+ ];
469
+ return { message, ...rows.length === 0 ? {} : { rows }, next: [{ type: "text", text: next }] };
470
+ }
471
+ },
472
+ spawnFailed: {
473
+ exitCode: 1,
474
+ description: "The command couldn't start.",
475
+ schema: z3.object({
476
+ /** The command's first argument: what storm tried to run. */
477
+ executable: z3.string(),
478
+ /** What the OS said. */
479
+ message: z3.string(),
480
+ /**
481
+ * What the run couldn't clean up; its `runner` is null, since only a run without a runner sandbox spawns its
482
+ * command here.
483
+ */
484
+ cleanup: RUN_CLEANUP.schema
485
+ }),
486
+ render: ({ executable, message, cleanup }) => {
487
+ const rows = RUN_CLEANUP.rows(cleanup);
488
+ return {
489
+ message: `Couldn't start the command ${executable}: ${message}`,
490
+ ...rows.length === 0 ? {} : { rows },
491
+ next: [
492
+ { type: "text", text: "Check the command after --; it runs with no shell, as the argument list given." }
493
+ ]
494
+ };
495
+ }
496
+ }
497
+ });
498
+ var RUN_ERRORS = {
499
+ ...configErrors,
500
+ ...credentialErrors,
501
+ // A resource's refusal, before the run starts or while it acquires.
502
+ ...resourceRefusalErrors,
503
+ ...mintFailedErrors,
504
+ ...runErrors
505
+ };
506
+ var outcomes = defineOutcomes({
507
+ results: { ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: renderRan } },
508
+ errors: RUN_ERRORS
509
+ });
510
+
511
+ // src/commands/exec/redaction.ts
512
+ function redactor(secrets) {
513
+ const kept = secrets.filter((secret) => secret !== "");
514
+ return kept.length === 0 ? (text) => text : (text) => redactSecrets(text, kept);
515
+ }
516
+ function redactStrings(value, redact) {
517
+ if (typeof value === "string") return redact(value);
518
+ if (Array.isArray(value)) return value.map((each) => redactStrings(each, redact));
519
+ if (typeof value === "object" && value !== null) {
520
+ const prototype = Object.getPrototypeOf(value);
521
+ if (prototype !== Object.prototype && prototype !== null) return value;
522
+ return Object.fromEntries(
523
+ Object.entries(value).map(([key, each]) => [key, redactStrings(each, redact)])
524
+ );
525
+ }
526
+ return value;
527
+ }
528
+ function redactingObserver(observer, redact) {
529
+ return {
530
+ observe: async (timed) => await observer.observe({ event: redactStrings(timed.event, redact), at: timed.at })
531
+ };
532
+ }
533
+ function redactingTerminal(terminal, redact) {
534
+ return {
535
+ color: terminal.color,
536
+ writeStdout: (text) => terminal.writeStdout(redact(text)),
537
+ writeStderr: (text) => terminal.writeStderr(redact(text))
538
+ };
539
+ }
540
+
541
+ // src/commands/exec/plan-run.ts
542
+ async function planRun(app, lifecycles, request, planCommand, signal) {
543
+ const file = await loadSettingsFile(app.context.config, app.cwd, RESOURCES);
544
+ if (!file.ok) return file;
545
+ const configFile = file.path;
546
+ const settings = fileSettings(file, request);
547
+ let where;
548
+ if (request.unsandboxed) where = { kind: "unsandboxed" };
549
+ else {
550
+ if (settings.runner === void 0) return refused(runErrors.missingRunner({ configFile }));
551
+ const required = requireTarget(settings.scope, settings.project);
552
+ if (!required.ok) return required;
553
+ const recipe = settings.runner.value;
554
+ const secrets = readRunnerSecrets(recipe, app.env);
555
+ if (!secrets.ok)
556
+ return refused(
557
+ runErrors.runnerSecretsInvalid({
558
+ variables: secrets.variables.map(({ name, problem }) => ({ name, problem })),
559
+ minLength: RUNNER_SECRET_MIN_LENGTH,
560
+ configFile
561
+ })
562
+ );
563
+ where = { kind: "runner", recipe, target: required.target, secrets: secrets.values };
110
564
  }
111
- if (problems.length > 0) return { ok: false, problems };
112
- return { ok: true, values: Object.keys(values).length === 0 ? void 0 : givenOptionsOf(CONFIG, values) };
565
+ const merged = settleRunResources(file, request.given);
566
+ if (!merged.ok) return merged;
567
+ const command = await planCommand(where, signal);
568
+ if (signal.aborted) return refused(canceledBeforeStart());
569
+ if (!command.ok) {
570
+ const secrets = [
571
+ ...where.kind === "runner" ? Object.values(where.secrets) : [],
572
+ ...lifecycles.secrets(merged.options)
573
+ ];
574
+ return refused(secrets.length === 0 ? command.refusal : redactStrings(command.refusal, redactor(secrets)));
575
+ }
576
+ const run = Object.freeze({ testPlan: command.testPlan });
577
+ const resolved = merged.plan(run);
578
+ if (!resolved.ok) return resolved;
579
+ return {
580
+ ok: true,
581
+ configFile,
582
+ settings,
583
+ where,
584
+ argv: command.argv,
585
+ testPlan: command.testPlan,
586
+ resources: resolved.resources,
587
+ planOptions: resolved.planned.map(planOption)
588
+ };
113
589
  }
114
- function testserverFlagProblems(request) {
115
- const read = readTestserverFlags(request);
116
- return read.ok ? [] : read.problems;
590
+ function planOption({ path, value, source }) {
591
+ return { path, value, from: source };
117
592
  }
118
- function withTestserverFlags(sets, request) {
119
- const read = readTestserverFlags(request);
120
- if (!read.ok) throw new Error(`The flags should have been refused: ${read.problems.map((p) => p.message).join(" ")}`);
121
- return read.values === void 0 ? sets : { ...sets, testserverPool: read.values };
593
+ async function resourcesBeforeRun(lifecycles, plan, request) {
594
+ const { configFile, resources, settings } = plan;
595
+ const used = await lifecycles.beforeRun(resources);
596
+ if (!used.ok) return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
597
+ if (request.credential !== void 0 && !used.needsVercelCredential)
598
+ return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
599
+ let where;
600
+ if (plan.where.kind === "runner") where = plan.where;
601
+ else if (used.needsVercelCredential) {
602
+ const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
603
+ if (!chosen.ok) return chosen;
604
+ where = { kind: "unsandboxed", credential: chosen.credential };
605
+ } else where = { kind: "unsandboxed", credential: void 0 };
606
+ return { ok: true, where, used };
122
607
  }
123
- function testserverSandboxesSource(request, file) {
124
- if (request[TESTSERVER_FLAGS.sandboxes.field] !== void 0) return "flag";
125
- return fileOptions(file, CONFIG)?.sandboxes === void 0 ? "default" : "file";
608
+ function canceledBeforeStart() {
609
+ return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, acquired or started." });
126
610
  }
127
611
 
128
612
  // src/commands/exec/run-command.ts
129
- import {
130
- refused
131
- } from "@vercel/clinkr";
132
- import { NodeSignalCancellation } from "@vercel/clinkr/node";
133
- import { z } from "zod";
613
+ import { z as z4 } from "zod";
134
614
 
135
615
  // src/commands/exec/job-summary.ts
136
616
  function jobSummaryMarkdown(timeline, extras) {
@@ -141,7 +621,7 @@ function jobSummaryMarkdown(timeline, extras) {
141
621
  lines.push("");
142
622
  }
143
623
  if (timeline.criticalPath.length > 0) {
144
- const path = timeline.criticalPath.map((name) => criticalPathStep(name, timeline));
624
+ const path = timeline.criticalPath.map((step) => criticalPathStep(step, timeline));
145
625
  lines.push(`Critical path: ${path.join(" \u2192 ")}`, "");
146
626
  }
147
627
  for (const detail of extras.details ?? []) lines.push(`${detail.trim()} `);
@@ -153,7 +633,7 @@ function tableRow(row) {
153
633
  const outcome = row.outcome === "done" ? "" : ` (${row.outcome})`;
154
634
  const steps = row.steps.map((step) => `${step.name} ${seconds(step.endMs - step.startMs)}`).join(" \xB7 ");
155
635
  const idle = row.idleMs > 0 ? seconds(row.idleMs) : "";
156
- return `| ${laneLabel(row.name)}${outcome} | +${seconds(row.startMs)} | ${seconds(row.endMs - row.startMs)} | ${idle} | ${steps} |`;
636
+ return `| ${row.label}${outcome} | +${seconds(row.startMs)} | ${seconds(row.endMs - row.startMs)} | ${idle} | ${steps} |`;
157
637
  }
158
638
 
159
639
  // src/commands/exec/progress.ts
@@ -176,11 +656,11 @@ function lineProgress(write, options = { github: false }) {
176
656
  function plainRenderer(options) {
177
657
  const state = {
178
658
  origin: void 0,
179
- resourceLanes: RESOURCE_PRESENTATIONS.lanes.map(({ lane }) => lane),
180
- heldResources: [],
659
+ resourceLanes: [],
660
+ instances: [],
181
661
  mintStartedAt: void 0,
182
662
  lanesStartedAt: void 0,
183
- readyAt: {},
663
+ readyAt: { runner: void 0, resources: {} },
184
664
  cleanupStartedAt: void 0,
185
665
  folded: false
186
666
  };
@@ -198,7 +678,7 @@ function progressLine(elapsedMs, lane, text) {
198
678
  return `[+${secondsText(secondsOf(elapsedMs))}] ${lane.padEnd(LANE_WIDTH)} ${text}`;
199
679
  }
200
680
  var LANE_WIDTH = Math.max(
201
- ...["run", "mint", "runner", "command", "cleanup", ...RESOURCE_PRESENTATIONS.lanes.map(({ lane }) => lane)].map(
681
+ ...["run", "mint", "runner", "command", "cleanup", ...RESOURCE_PRESENTATIONS.laneKinds.map(({ lane }) => lane)].map(
202
682
  (lane) => lane.length
203
683
  )
204
684
  );
@@ -206,12 +686,24 @@ function eventLines(event, now, state, line, options) {
206
686
  const since = (start) => seconds(now - (start ?? now));
207
687
  switch (event.kind) {
208
688
  case "started":
209
- state.resourceLanes = event.lanes;
210
- state.heldResources = event.resources;
689
+ state.resourceLanes = event.resources.flatMap(
690
+ ({ resource, lane }) => lane === null ? [] : [{ lane, resource }]
691
+ );
692
+ state.instances = event.resources;
211
693
  return [
212
694
  line("run", `storm ${versionText(event.version, event.commit)}`),
213
695
  ...event.configFile === null ? [] : [line("run", `config ${event.configFile}`)]
214
696
  ];
697
+ case "resource-skipped":
698
+ return [line("run", skippedText(event))];
699
+ // An acquired resource says what it holds in its acquire's `announce`, the progress event that follows.
700
+ case "resource-acquired":
701
+ return [];
702
+ // A line a resource instance reported, in the run's lane or the cleanup's, and a warning, marked as one.
703
+ case "resource-notice":
704
+ return [line(event.lane, event.text)];
705
+ case "resource-warning":
706
+ return [line(event.lane, resourceWarningText(event))];
215
707
  case "minting":
216
708
  state.mintStartedAt = now;
217
709
  return [line("mint", `credential for ${mintTargetText(event.target)}\u2026`)];
@@ -226,18 +718,20 @@ function eventLines(event, now, state, line, options) {
226
718
  return [line("mint", "requesting a GitHub Actions OIDC token\u2026")];
227
719
  case "lanes-started":
228
720
  state.lanesStartedAt = now;
229
- return state.resourceLanes.length === 0 ? [] : [line("run", `${[...state.resourceLanes, "runner"].join(" \u2016 ")} start together`)];
721
+ return state.resourceLanes.length === 0 ? [] : [line("run", `${[...state.resourceLanes.map(({ lane }) => lane), "runner"].join(" \u2016 ")} start together`)];
230
722
  case "lane-ended": {
231
723
  const ran = since(state.lanesStartedAt ?? state.origin);
232
724
  if (event.outcome !== "ready") return [line(event.lane, `${event.outcome} (${ran})`)];
233
725
  if (state.lanesStartedAt === void 0) return [];
234
- state.readyAt[event.lane] = now;
726
+ if (event.resource === null) state.readyAt.runner = now;
727
+ else state.readyAt.resources[event.resource] = now;
235
728
  const ready = `ready (${ran})`;
236
729
  if (state.resourceLanes.length === 0) return [line(event.lane, ready)];
237
- const others = event.lane === "runner" ? state.resourceLanes : ["runner"];
238
- const waiting = others.filter((other) => state.readyAt[other] === void 0);
730
+ const others = event.resource === null ? state.resourceLanes : [{ lane: "runner", resource: null }];
731
+ const readyAt = (lane) => lane.resource === null ? state.readyAt.runner : state.readyAt.resources[lane.resource];
732
+ const waiting = others.filter((other) => readyAt(other) === void 0).map(({ lane }) => lane);
239
733
  if (waiting.length > 0) return [line(event.lane, `${ready}; waiting for ${waiting.join(", ")}`)];
240
- const waited = others.map((other) => `${other} waited ${seconds(now - (state.readyAt[other] ?? now))}`);
734
+ const waited = others.map((other) => `${other.lane} waited ${seconds(now - (readyAt(other) ?? now))}`);
241
735
  return [line(event.lane, `${ready}; ${waited.join(", ")}`)];
242
736
  }
243
737
  // A resource lane's start shows in its first line of its own.
@@ -249,14 +743,12 @@ function eventLines(event, now, state, line, options) {
249
743
  return [line("command", `${event.command} ${commandEnd(event.outcome)} after ${seconds(event.ms)}`)];
250
744
  case "cleanup-started":
251
745
  state.cleanupStartedAt = now;
252
- return [
253
- line("cleanup", cleanupText(event.runnerSandbox, RESOURCE_PRESENTATIONS.releaseTexts(event.holdings, "doing")))
254
- ];
746
+ return [line("cleanup", cleanupText(event.runnerSandbox, releaseText(event.resources, false)))];
255
747
  case "cleanup-finished": {
256
748
  const problems = [
257
749
  ...event.notStopped === 0 ? [] : [`${event.notStopped} not stopped`],
258
750
  ...event.notDeleted === 0 ? [] : [`${event.notDeleted} not deleted`],
259
- ...RESOURCE_REPORTS.failuresTexts(event.resourceFailures)
751
+ ...event.resourceWarnings === 0 ? [] : [warningTally(event.resourceWarnings)]
260
752
  ];
261
753
  return [
262
754
  line(
@@ -337,7 +829,7 @@ function runnerLines(event, state, line, options) {
337
829
  return [
338
830
  line(
339
831
  "cleanup",
340
- `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.heldResources)}\u2026`
832
+ `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`
341
833
  )
342
834
  ];
343
835
  case "waiting-for-snapshot":
@@ -384,16 +876,19 @@ function branchSnapshotsDropText(event) {
384
876
  const count = event.snapshotIds.length;
385
877
  return `dropped ${count} branch ${count === 1 ? "snapshot" : "snapshots"} of ${event.branch} from the cache: ${event.snapshotIds.join(", ")}`;
386
878
  }
387
- function releasingText(held) {
388
- return RESOURCE_PRESENTATIONS.stoppingTexts(held).map((text) => ` and ${text}`).join("");
879
+ function releasingText(instances) {
880
+ const release = releaseText(
881
+ instances.map(({ resource }) => resource),
882
+ false
883
+ );
884
+ return release === void 0 ? "" : ` and ${release}`;
389
885
  }
390
886
  function closeFold(state) {
391
887
  if (!state.folded) return [];
392
888
  state.folded = false;
393
889
  return ["::endgroup::"];
394
890
  }
395
- function cleanupText(sandbox, releases) {
396
- const release = releases.length === 0 ? void 0 : releases.join(", ");
891
+ function cleanupText(sandbox, release) {
397
892
  if (sandbox === null) return release === void 0 ? "nothing to release" : `${release}\u2026`;
398
893
  if (sandbox.kind === "save")
399
894
  return `saving a branch snapshot of ${sandbox.branch}${release === void 0 ? "" : ` while ${release}`}\u2026`;
@@ -422,6 +917,12 @@ function noteText(note) {
422
917
  return `not reusing cached runner snapshots of base ${short(note.base)}: ${note.failure.message.replace(/\.$/, "")}`;
423
918
  }
424
919
  }
920
+ function resourceWarningText(warning) {
921
+ return `warning: ${warning.message}`;
922
+ }
923
+ function skippedText(skipped) {
924
+ return `no ${skipped.resource}: ${skipped.notice}`;
925
+ }
425
926
  function preparedNoteTexts(prepared) {
426
927
  return [
427
928
  ...prepared.nestedRepositories.length === 0 ? [] : [`leaving out untracked nested Git repositories: ${prepared.nestedRepositories.join(", ")}`],
@@ -447,9 +948,13 @@ function activePhase(state) {
447
948
  if (state.mint !== void 0) return "credential";
448
949
  return void 0;
449
950
  }
450
- function heldLanes(state) {
451
- const held = state.lanes;
452
- return RESOURCE_PRESENTATIONS.lanes.filter(({ lane }) => held?.includes(lane) ?? true);
951
+ function instanceLanes(state) {
952
+ return RESOURCE_PRESENTATIONS.lanes(state.instances ?? []);
953
+ }
954
+ function startedLanes(state) {
955
+ return RESOURCE_PRESENTATIONS.lanes(
956
+ Object.entries(state.resources).map(([resource, { definition }]) => ({ resource, definition }))
957
+ );
453
958
  }
454
959
  function headerLine(state, paint2) {
455
960
  const version = state.version === void 0 ? "" : versionText(state.version.version, state.version.commit);
@@ -475,7 +980,7 @@ function phaseFrame(state, phase, now, width, paint2) {
475
980
  case "lanes":
476
981
  return lanesFrame(state, view);
477
982
  case "resources":
478
- return localResourcesFrame(state, view);
983
+ return unsandboxedResourcesFrame(state, view);
479
984
  case "tests":
480
985
  return testsFrame(state, view);
481
986
  case "cleanup":
@@ -497,7 +1002,7 @@ function phaseRecord(state, phase, width, paint2) {
497
1002
  case "lanes":
498
1003
  return lanesRecord(state, view);
499
1004
  case "resources":
500
- return localResourcesRecord(state, view);
1005
+ return unsandboxedResourcesRecord(state, view);
501
1006
  case "tests":
502
1007
  return state.command === void 0 ? [] : [testsLine(state, state.command, view, false)];
503
1008
  case "cleanup":
@@ -530,12 +1035,16 @@ function lanesFrame(state, view) {
530
1035
  const { paint: paint2 } = view;
531
1036
  const stopping = (status) => state.stopping && status === "running";
532
1037
  const draw = laneDraw(view);
533
- const resourceRows = heldLanes(state).map((lane) => {
534
- const { status, text, right } = lane.lanesRow(state.resources, draw, {
535
- stopping: state.stopping,
536
- runnerRunning: runner.status === "running"
537
- });
538
- return view.row(`${laneHead(view.glyph(status ?? "running"), lane.lane)}${text}`, right);
1038
+ const resourceRows = instanceLanes(state).map((lane) => {
1039
+ const live = lane.live(state.resources, draw);
1040
+ if (live === void 0) return view.row(laneHead(view.glyph("running"), lane.lane), "");
1041
+ const { span } = live;
1042
+ const text = stopping(span.status) ? "stopping" : live.detail ?? live.text;
1043
+ 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)}`)} ` : "";
1044
+ return view.row(
1045
+ `${laneHead(view.glyph(span.status), lane.lane)}${text}`,
1046
+ `${waiting}${elapsed(view, span.startedAt, span.endedAt)}`
1047
+ );
539
1048
  });
540
1049
  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);
541
1050
  const currentText = current === void 0 ? "" : [
@@ -561,7 +1070,7 @@ function lanesRecord(state, view) {
561
1070
  const { runner } = state;
562
1071
  const lines = [];
563
1072
  const draw = laneDraw(view);
564
- for (const lane of RESOURCE_PRESENTATIONS.lanes) {
1073
+ for (const lane of startedLanes(state)) {
565
1074
  const record = lane.record(state.resources, draw);
566
1075
  if (record === void 0) continue;
567
1076
  const { span } = record;
@@ -635,26 +1144,26 @@ function stepsText(steps, view) {
635
1144
  return `${step.name} ${seconds((step.endedAt ?? 0) - (step.startedAt ?? 0))}${mark}`;
636
1145
  }).join(" \xB7 ");
637
1146
  }
638
- function localResourcesFrame(state, view) {
1147
+ function unsandboxedResourcesFrame(state, view) {
639
1148
  const { mint } = state;
640
1149
  const draw = laneDraw(view);
641
1150
  const mintRow = mint !== void 0 && mint.status === "running" ? view.row(
642
1151
  ` ${view.glyph("running")} minting a credential for ${mintTargetText(mint.target)}`,
643
1152
  elapsed(view, mint.startedAt, mint.endedAt)
644
1153
  ) : void 0;
645
- const rows = RESOURCE_PRESENTATIONS.lanes.flatMap((lane) => {
646
- const row = lane.localRow(state.resources, draw);
1154
+ const rows = startedLanes(state).flatMap((lane) => {
1155
+ const row = lane.live(state.resources, draw);
647
1156
  return row === void 0 ? [] : [{ lane: lane.lane, ...row }];
648
1157
  });
649
- return rows.flatMap(({ lane, span, text, below }, index) => [
1158
+ return rows.flatMap(({ lane, span, text, detail }, index) => [
650
1159
  view.row(`${laneHead(view.glyph(span.status), lane)}${text}`, elapsed(view, span.startedAt, span.endedAt)),
651
- index === 0 && mintRow !== void 0 ? mintRow : below !== void 0 ? view.line(` ${view.glyph("running")} ${below}`) : ""
1160
+ index === 0 && mintRow !== void 0 ? mintRow : detail !== void 0 ? view.line(` ${view.glyph("running")} ${detail}`) : ""
652
1161
  ]);
653
1162
  }
654
- function localResourcesRecord(state, view) {
1163
+ function unsandboxedResourcesRecord(state, view) {
655
1164
  const { mint } = state;
656
1165
  const draw = laneDraw(view);
657
- const lanes = RESOURCE_PRESENTATIONS.lanes.flatMap((lane) => {
1166
+ const lanes = startedLanes(state).flatMap((lane) => {
658
1167
  const record = lane.record(state.resources, draw);
659
1168
  if (record === void 0) return [];
660
1169
  const { span } = record;
@@ -702,8 +1211,7 @@ function testsProgress(tests, view, room) {
702
1211
  }
703
1212
  function cleanupLine(cleanup, runner, view, record) {
704
1213
  const done = record || cleanup.status !== "running";
705
- const releases = RESOURCE_PRESENTATIONS.releaseTexts(cleanup.holdings, done ? "done" : "doing");
706
- const release = releases.length === 0 ? void 0 : releases.join(", ");
1214
+ const release = releaseText(cleanup.resources, done);
707
1215
  const { runnerSandbox } = cleanup;
708
1216
  const text = !done && cleanup.waiting ? `${WAITING_FOR_SNAPSHOT}\u2026` : runnerSandbox === null ? release ?? "nothing to release" : `${runnerSandboxText(runnerSandbox, runner, done)}${release === void 0 ? "" : `, ${release}`}`;
709
1217
  const leftBehind = cleanupProblems(cleanup);
@@ -810,7 +1318,7 @@ function liveView(context, colors, options) {
810
1318
  observer: {
811
1319
  observe: async (timed) => {
812
1320
  if (finished) return;
813
- state = applyStormRunEvent(state, timed);
1321
+ state = applyStormEvent(state, timed);
814
1322
  const next = activePhase(state);
815
1323
  if (next !== phase) {
816
1324
  print([
@@ -856,6 +1364,15 @@ function noticeLines(timed, origin, verbose) {
856
1364
  return runnerNoticeLines(event.event, line);
857
1365
  case "resource":
858
1366
  return RESOURCE_PRESENTATIONS.notices(event, { verbose }).map(({ lane, text }) => line(lane, text));
1367
+ // A line a resource instance reported prints as it is, in its lane, and a warning marked as one.
1368
+ case "resource-notice":
1369
+ return [line(event.lane, event.text)];
1370
+ case "resource-warning":
1371
+ return [line(event.lane, resourceWarningText(event))];
1372
+ case "resource-skipped":
1373
+ return [line("run", skippedText(event))];
1374
+ // The live view draws what an acquired resource holds from its lane's state.
1375
+ case "resource-acquired":
859
1376
  case "started":
860
1377
  case "requesting-token":
861
1378
  case "minting":
@@ -907,36 +1424,6 @@ function runnerNoticeLines(event, line) {
907
1424
  }
908
1425
  }
909
1426
 
910
- // src/commands/exec/redaction.ts
911
- function redactor(secrets) {
912
- const kept = secrets.filter((secret) => secret !== "");
913
- return kept.length === 0 ? (text) => text : (text) => redactSecrets(text, kept);
914
- }
915
- function redactStrings(value, redact) {
916
- if (typeof value === "string") return redact(value);
917
- if (Array.isArray(value)) return value.map((each) => redactStrings(each, redact));
918
- if (typeof value === "object" && value !== null) {
919
- const prototype = Object.getPrototypeOf(value);
920
- if (prototype !== Object.prototype && prototype !== null) return value;
921
- return Object.fromEntries(
922
- Object.entries(value).map(([key, each]) => [key, redactStrings(each, redact)])
923
- );
924
- }
925
- return value;
926
- }
927
- function redactingObserver(observer, redact) {
928
- return {
929
- observe: async (timed) => await observer.observe({ event: redactStrings(timed.event, redact), at: timed.at })
930
- };
931
- }
932
- function redactingTerminal(terminal, redact) {
933
- return {
934
- color: terminal.color,
935
- writeStdout: (text) => terminal.writeStdout(redact(text)),
936
- writeStderr: (text) => terminal.writeStderr(redact(text))
937
- };
938
- }
939
-
940
1427
  // src/commands/exec/run-collector.ts
941
1428
  function runCollector(directory) {
942
1429
  let state = EMPTY_RUN_STATE;
@@ -953,7 +1440,7 @@ function runCollector(directory) {
953
1440
  observe: async (timed) => {
954
1441
  const { event } = timed;
955
1442
  if (event.kind === "runner" && event.event.kind === "step-output") return;
956
- state = applyStormRunEvent(state, timed);
1443
+ state = applyStormEvent(state, timed);
957
1444
  if (event.kind === "test") {
958
1445
  collect(event.event);
959
1446
  if (event.event.kind !== "test-result")
@@ -962,8 +1449,8 @@ function runCollector(directory) {
962
1449
  else if (event.kind === "test-events-incomplete") incomplete ??= event.message;
963
1450
  }
964
1451
  },
965
- readLocal: async (localDirectory, redact) => {
966
- const read = await localDirectory.readTestEvents((line) => {
1452
+ readStaged: async (runDirectory, redact) => {
1453
+ const read = await runDirectory.readTestEvents((line) => {
967
1454
  const event = parseTestEvent(line);
968
1455
  if (event === void 0) unreadable += 1;
969
1456
  else collect(redactStrings(event, redact));
@@ -992,95 +1479,59 @@ function summaryEvent(event) {
992
1479
  }
993
1480
 
994
1481
  // src/commands/exec/run-command.ts
995
- var RUN_REQUEST_FIELDS = {
996
- set: z.array(z.string()).default([]),
997
- testserverSandboxes: z.number().optional(),
998
- testserverBuild: z.string().optional(),
999
- testserverMinTimeLeft: z.string().optional(),
1000
- testserverTtl: z.string().optional(),
1001
- testserverNoCreate: z.boolean().optional(),
1002
- scope: z.string().min(1).optional(),
1003
- project: z.string().min(1).optional(),
1004
- credential: z.enum(["mint", "github-actions"]).optional(),
1005
- local: z.boolean().default(false),
1006
- rebuildSnapshot: z.boolean().default(false),
1007
- saveSnapshot: z.boolean().default(false),
1008
- showOutput: z.boolean().default(false),
1009
- keepSandbox: z.string().optional(),
1010
- verbose: z.boolean().default(false)
1482
+ var OWN_RUN_FIELDS = {
1483
+ scope: z4.string().min(1).optional(),
1484
+ project: z4.string().min(1).optional(),
1485
+ credential: z4.enum(["mint", "github-actions"]).optional(),
1486
+ unsandboxed: z4.boolean().default(false),
1487
+ rebuildSnapshot: z4.boolean().default(false),
1488
+ saveSnapshot: z4.boolean().default(false),
1489
+ showOutput: z4.boolean().default(false),
1490
+ keepSandbox: z4.string().optional(),
1491
+ verbose: z4.boolean().default(false)
1011
1492
  };
1493
+ var RUN_REQUEST_FIELDS = { ...OWN_RUN_FIELDS, ...resourceFlagFields(Object.keys(OWN_RUN_FIELDS)) };
1012
1494
  var RUN_CLI_OPTIONS = { project: { short: "p" } };
1013
- var runRequestSchema = z.object(RUN_REQUEST_FIELDS);
1495
+ var runRequestSchema = z4.object(RUN_REQUEST_FIELDS);
1014
1496
  async function runCommand({ app, ui, signal }, request, spec) {
1015
- const sets = parseSetFlags(request.set, RESOURCE_CONFIGS, TESTSERVER_OWN_FLAGS);
1016
- if (!sets.ok) throw new Error(`--set should have been refused: ${sets.problems.join("; ")}`);
1017
- const settled = await settleRun(app, { ...request, given: withTestserverFlags(sets.values, request) });
1018
- if (!settled.ok) return settled.refusal;
1019
- const secrets = [
1020
- ...settled.settlement.secrets,
1021
- ...settled.where.kind === "runner" ? Object.values(settled.where.secrets) : []
1022
- ];
1023
- const redact = redactor(secrets);
1024
- const ready = await spec.prepare(settled, signal);
1497
+ const lifecycles = resourceLifecycles(app.worlds);
1498
+ const planned = await planRun(
1499
+ app,
1500
+ lifecycles,
1501
+ { ...request, given: resourceFlagValues(request) },
1502
+ spec.planCommand,
1503
+ signal
1504
+ );
1505
+ if (!planned.ok) return planned.refusal;
1506
+ const { configFile, argv, testPlan, planOptions } = planned;
1507
+ const before = await resourcesBeforeRun(lifecycles, planned, request);
1508
+ if (!before.ok) return before.refusal;
1025
1509
  if (signal.aborted) return canceledBeforeStart();
1026
- if (!ready.ok) return secrets.length === 0 ? ready.refusal : redactStrings(ready.refusal, redact);
1027
- const { argv, plan } = ready;
1028
- const { configFile, options, where, settlement } = ready.settled;
1029
- if (settlement.secrets !== settled.settlement.secrets || where !== settled.where)
1030
- throw new Error("spec.prepare changed the run's secrets");
1510
+ const { where, used } = before;
1511
+ const plan = recordedPlan(testPlan, planOptions);
1512
+ if (plan !== void 0) await ui.progress?.(testPlanLine(plan));
1031
1513
  const base = {
1032
1514
  argv,
1033
- // A resource can name host variables that could point the command at something else than the run payload
1034
- // names, so the command never sees one.
1035
- env: Object.fromEntries(
1036
- Object.entries(app.env).filter(([name]) => !RESOURCE_REPORTS.hostVariablesToDrop.includes(name))
1037
- ),
1515
+ // A resource the run uses can hide launcher environment variables that could point the command at something else
1516
+ // than the run payload names, so the command never sees one.
1517
+ env: Object.fromEntries(Object.entries(app.env).filter(([name]) => !used.hiddenVariables.includes(name))),
1038
1518
  version: app.version,
1039
1519
  commit: app.commit,
1040
1520
  configFile,
1041
1521
  verbose: request.verbose
1042
1522
  };
1043
- let run;
1044
- if (where.kind === "local")
1045
- run = {
1046
- ...base,
1047
- resources: settlement.requests,
1048
- ...where.credential === void 0 ? {} : { credential: where.credential }
1049
- };
1050
- else {
1051
- const prepared = await prepareRunner(app.context, {
1052
- cwd: app.cwd,
1053
- recipe: where.recipe,
1054
- resources: RESOURCE_REPORTS.runnerResources(options),
1055
- rebuild: request.rebuildSnapshot,
1056
- saveSnapshot: request.saveSnapshot
1057
- });
1058
- if (prepared.kind !== "ok") {
1059
- const refusal = prepareRefusal(prepared, configFile);
1060
- return secrets.length === 0 ? refusal : redactStrings(refusal, redact);
1061
- }
1062
- const { save } = prepared.prepared;
1063
- run = {
1064
- ...base,
1065
- resources: settlement.requests,
1066
- runner: {
1067
- prepared: prepared.prepared,
1068
- target: where.target,
1069
- user: app.user,
1070
- secrets: where.secrets,
1071
- sandbox: save?.kind === "branch" ? { kind: "save", branch: save.branch } : { kind: "keep", ms: keepSandboxMinutes(request.keepSandbox, where.recipe, app.env) * 6e4 }
1072
- }
1073
- };
1074
- }
1523
+ const requested = await runRequestFor(app, { where, used, base, request, configFile });
1524
+ if (!requested.ok) return requested.refusal;
1525
+ const { run } = requested;
1526
+ const secrets = [...used.secrets, ...Object.values(run.runner?.secrets ?? {})];
1527
+ const redact = redactor(secrets);
1075
1528
  const terminate = new AbortController();
1076
1529
  const forward = () => {
1077
1530
  const reason = signal.reason;
1078
1531
  if (reason instanceof NodeSignalCancellation && reason.signal === "SIGTERM") terminate.abort(reason);
1079
1532
  };
1080
- if (run.runner === void 0) {
1081
- if (signal.aborted) forward();
1082
- else signal.addEventListener("abort", forward, { once: true });
1083
- }
1533
+ if (signal.aborted) forward();
1534
+ else signal.addEventListener("abort", forward, { once: true });
1084
1535
  const view = runView({
1085
1536
  presentation: app.presentation,
1086
1537
  progress: ui.progress,
@@ -1092,13 +1543,13 @@ async function runCommand({ app, ui, signal }, request, spec) {
1092
1543
  const startedAt = app.context.clock.now();
1093
1544
  const record = redactStrings(
1094
1545
  {
1095
- version: 1,
1546
+ version: 3,
1096
1547
  startedAt: startedAt.toISOString(),
1097
1548
  cwd: app.cwd,
1098
1549
  configFile,
1099
1550
  argv,
1100
1551
  ...plan === void 0 ? {} : { plan },
1101
- where: run.runner === void 0 ? { kind: "local" } : startedWhere(run.runner),
1552
+ where: startedWhere(run),
1102
1553
  git
1103
1554
  },
1104
1555
  redact
@@ -1119,6 +1570,7 @@ async function runCommand({ app, ui, signal }, request, spec) {
1119
1570
  const ended = await executeRun(
1120
1571
  RESOURCES,
1121
1572
  { ...app.context, runnerTerminal: secrets.length === 0 ? terminal : redactingTerminal(terminal, redact) },
1573
+ app.worlds,
1122
1574
  run.runner === void 0 && directory !== void 0 ? { ...run, testEvents: testEventsPath(directory.path) } : run,
1123
1575
  { signal, terminate: terminate.signal },
1124
1576
  timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))
@@ -1135,11 +1587,9 @@ async function runCommand({ app, ui, signal }, request, spec) {
1135
1587
  view,
1136
1588
  collector,
1137
1589
  opened,
1138
- local: run.runner === void 0,
1139
1590
  redact,
1140
1591
  record,
1141
- outcome,
1142
- requests: run.resources
1592
+ outcome
1143
1593
  });
1144
1594
  switch (outcome.kind) {
1145
1595
  case "ran": {
@@ -1150,7 +1600,7 @@ async function runCommand({ app, ui, signal }, request, spec) {
1150
1600
  version: app.version,
1151
1601
  commit: app.commit,
1152
1602
  configFile,
1153
- resources: RESOURCE_REPORTS.ranFacts(outcome.resources, run.resources),
1603
+ resources: RESOURCE_REPORTS.ranFacts(outcome.resources),
1154
1604
  cleanup: RUN_CLEANUP.facts(outcome),
1155
1605
  command: command.kind === "exited" ? { exitCode: command.code, signal: null } : command.kind === "signaled" ? { exitCode: null, signal: command.signal } : { exitCode: null, signal: null },
1156
1606
  runner: outcome.runner === void 0 ? null : {
@@ -1165,17 +1615,16 @@ async function runCommand({ app, ui, signal }, request, spec) {
1165
1615
  buildMs: outcome.runner.buildMs,
1166
1616
  save: outcome.runner.save
1167
1617
  },
1168
- timeline: timelineFacts(ran),
1618
+ timeline: ran,
1169
1619
  runId: directory?.id ?? null
1170
1620
  },
1171
- plan
1621
+ { testPlan, options: planOptions }
1172
1622
  );
1173
1623
  }
1174
- case "resource-unprepared":
1175
- return RESOURCE_COMMANDS.unpreparedError(outcome);
1176
1624
  case "resource-refused":
1177
- return RESOURCE_COMMANDS.refusedError(outcome, RUN_CLEANUP.facts(outcome));
1178
- // The run's mint: in a runner run for the runner sandbox, in a local run for a resource that needed it.
1625
+ return resourceRefused(outcome, RUN_CLEANUP.facts(outcome));
1626
+ // The run's mint: in a sandboxed run for the runner sandbox, in an unsandboxed run for a resource that needed it:
1627
+ // its `acquireForRun` answered `mintFailed`, which the launcher owns.
1179
1628
  case "mint-failed":
1180
1629
  return mintFailedErrors.mintFailed({
1181
1630
  ...outcome.target,
@@ -1187,7 +1636,7 @@ async function runCommand({ app, ui, signal }, request, spec) {
1187
1636
  return runErrors.spawnFailed({
1188
1637
  executable: outcome.executable,
1189
1638
  message: outcome.message,
1190
- // Only a local run spawns its command on this machine, so it holds no runner sandbox.
1639
+ // Only an unsandboxed run spawns its command on this machine, so it holds no runner sandbox.
1191
1640
  cleanup: RUN_CLEANUP.facts({ runnerCleanup: null, resourceCleanup: outcome.resourceCleanup })
1192
1641
  });
1193
1642
  case "canceled":
@@ -1206,35 +1655,46 @@ async function runCommand({ app, ui, signal }, request, spec) {
1206
1655
  });
1207
1656
  }
1208
1657
  }
1209
- function runProblems({
1210
- set,
1211
- credential,
1212
- local,
1213
- rebuildSnapshot,
1214
- saveSnapshot,
1215
- showOutput,
1216
- keepSandbox,
1217
- ...rest
1218
- }) {
1658
+ function runProblems(request) {
1659
+ const { credential, unsandboxed, rebuildSnapshot, saveSnapshot, showOutput, keepSandbox } = request;
1219
1660
  return [
1220
- ...setProblems(set).map((problem) => ({ field: "set", message: `${problem}.` })),
1221
- ...testserverFlagProblems(rest),
1222
- ...rebuildSnapshot && local ? [{ field: "rebuildSnapshot", message: "--rebuild-snapshot builds a runner snapshot; drop it or --local." }] : [],
1223
- ...!local && credential === "github-actions" ? [
1661
+ ...resourceFlagProblems(request),
1662
+ ...rebuildSnapshot && unsandboxed ? [
1663
+ {
1664
+ field: "rebuildSnapshot",
1665
+ message: "--rebuild-snapshot builds a runner snapshot; drop it or --unsandboxed."
1666
+ }
1667
+ ] : [],
1668
+ ...!unsandboxed && credential === "github-actions" ? [
1224
1669
  {
1225
1670
  field: "credential",
1226
- message: "A runner run needs the mint: the runner sandbox uses a minted Vercel token. Add --local, or drop --credential github-actions."
1671
+ message: "A sandboxed run needs the mint: the runner sandbox uses a minted Vercel token. Add --unsandboxed, or drop --credential github-actions."
1672
+ }
1673
+ ] : [],
1674
+ ...showOutput && unsandboxed ? [
1675
+ {
1676
+ field: "showOutput",
1677
+ message: "--show-output prints a sandboxed run's step output; drop it or --unsandboxed."
1227
1678
  }
1228
1679
  ] : [],
1229
- ...showOutput && local ? [{ field: "showOutput", message: "--show-output prints a runner run's step output; drop it or --local." }] : [],
1230
1680
  ...keepSandbox !== void 0 && parseKeepTime(keepSandbox) === void 0 ? [
1231
1681
  {
1232
1682
  field: "keepSandbox",
1233
1683
  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)}.`
1234
1684
  }
1235
1685
  ] : [],
1236
- ...keepSandbox !== void 0 && local ? [{ field: "keepSandbox", message: "--keep-sandbox keeps a runner run's runner sandbox; drop it or --local." }] : [],
1237
- ...saveSnapshot && local ? [{ field: "saveSnapshot", message: "--save-snapshot saves a runner run's runner sandbox; drop it or --local." }] : [],
1686
+ ...keepSandbox !== void 0 && unsandboxed ? [
1687
+ {
1688
+ field: "keepSandbox",
1689
+ message: "--keep-sandbox keeps a sandboxed run's runner sandbox; drop it or --unsandboxed."
1690
+ }
1691
+ ] : [],
1692
+ ...saveSnapshot && unsandboxed ? [
1693
+ {
1694
+ field: "saveSnapshot",
1695
+ message: "--save-snapshot saves a sandboxed run's runner sandbox; drop it or --unsandboxed."
1696
+ }
1697
+ ] : [],
1238
1698
  ...saveSnapshot && keepSandbox !== void 0 && (parseKeepTime(keepSandbox) ?? 0) > 0 ? [
1239
1699
  {
1240
1700
  field: "saveSnapshot",
@@ -1243,6 +1703,48 @@ function runProblems({
1243
1703
  ] : []
1244
1704
  ];
1245
1705
  }
1706
+ async function runRequestFor(app, options) {
1707
+ const { where, used, base, request, configFile } = options;
1708
+ if (where.kind === "unsandboxed") {
1709
+ const run2 = {
1710
+ ...base,
1711
+ resources: used.requests,
1712
+ skipped: used.skipped,
1713
+ ...where.credential === void 0 ? {} : { credential: where.credential }
1714
+ };
1715
+ return { ok: true, run: run2 };
1716
+ }
1717
+ const prepared = await prepareRunner(app.context, {
1718
+ cwd: app.cwd,
1719
+ recipe: where.recipe,
1720
+ // The recipe's `vcpus` reads each of the run's resources by its definition: one its `beforeRun` skipped isn't.
1721
+ vcpusRun: recipeRun(recipeResources(used.requests)),
1722
+ rebuild: request.rebuildSnapshot,
1723
+ saveSnapshot: request.saveSnapshot
1724
+ });
1725
+ if (prepared.kind !== "ok") {
1726
+ const refusal = prepareRefusal(prepared, configFile);
1727
+ const secrets = [...used.secrets, ...Object.values(where.secrets)];
1728
+ return {
1729
+ ok: false,
1730
+ refusal: secrets.length === 0 ? refusal : redactStrings(refusal, redactor(secrets))
1731
+ };
1732
+ }
1733
+ const { save } = prepared.prepared;
1734
+ const run = {
1735
+ ...base,
1736
+ resources: used.requests,
1737
+ skipped: used.skipped,
1738
+ runner: {
1739
+ prepared: prepared.prepared,
1740
+ target: where.target,
1741
+ user: app.user,
1742
+ secrets: where.secrets,
1743
+ sandbox: save?.kind === "branch" ? { kind: "save", branch: save.branch } : { kind: "keep", ms: keepSandboxMinutes(request.keepSandbox, where.recipe, app.env) * 6e4 }
1744
+ }
1745
+ };
1746
+ return { ok: true, run };
1747
+ }
1246
1748
  function prepareRefusal(prepared, configFile) {
1247
1749
  switch (prepared.kind) {
1248
1750
  case "no-base-ref":
@@ -1257,24 +1759,22 @@ function prepareRefusal(prepared, configFile) {
1257
1759
  return checkoutFailedRefusal(prepared.failure);
1258
1760
  }
1259
1761
  }
1260
- function canceledBeforeStart() {
1261
- return outcomes.canceled({ changed: "The command didn't run.\nNothing was minted, leased or started." });
1262
- }
1263
1762
  function checkoutFailedRefusal(failure) {
1264
1763
  return runErrors.runnerFailed({
1265
1764
  failure: runnerFailureFacts({ kind: "checkout-failed", failure }),
1266
- cleanup: RUN_CLEANUP.facts(NOTHING_HELD)
1765
+ cleanup: RUN_CLEANUP.facts(NOTHING_RELEASED)
1267
1766
  });
1268
1767
  }
1269
1768
  async function summarize(app, run) {
1270
1769
  const { view, opened } = run;
1271
1770
  const directory = opened.ok ? opened.directory : void 0;
1272
- if (run.local && directory !== void 0) await run.collector.readLocal(directory, run.redact);
1771
+ if (directory !== void 0) await run.collector.readStaged(directory, run.redact);
1273
1772
  const collected = run.collector.finish();
1274
1773
  const { state, tests } = collected;
1275
1774
  const ran = stormTimeline(state);
1775
+ const timeline = timelineFacts(ran);
1276
1776
  directory?.publishTestEvents();
1277
- directory?.writeTimeline(JSON.stringify(ran, null, 2));
1777
+ directory?.writeTimeline(JSON.stringify(timeline, null, 2));
1278
1778
  directory?.writeRun(
1279
1779
  runRecordText({
1280
1780
  ...run.record,
@@ -1283,20 +1783,24 @@ async function summarize(app, run) {
1283
1783
  state.runner,
1284
1784
  run.outcome.kind === "ran" ? run.outcome.runner?.save ?? null : null
1285
1785
  ),
1286
- ended: runEnd(run.outcome, state.command, tests, run.requests)
1786
+ ended: runEnd(run.outcome, state.command, tests)
1287
1787
  })
1288
1788
  );
1289
1789
  const writeFailure = await directory?.close();
1290
1790
  const failed = tests.events.some((event) => event.kind === "test-result" && event.state === "fail");
1291
1791
  const testsLines = testsSummaryLines(tests.events, tests.unreadable, tests.incomplete);
1292
1792
  const stepLogs = failedStepLogs(ran, directory?.path, app.env);
1293
- const clock = workerClock(ran, collected, run.local);
1793
+ const clock = workerClock(ran, collected);
1294
1794
  const charted = clock === void 0 ? void 0 : testsChart(tests.events, tests.unreadable, clock, tests.incomplete);
1295
1795
  const summarized = await app.context.jobSummary.appendJobSummary(
1296
- jobSummaryMarkdown(ran, { command: run.command, logs: directory?.path, details: [...testsLines, ...stepLogs] })
1796
+ jobSummaryMarkdown(timeline, {
1797
+ command: run.command,
1798
+ logs: directory?.path,
1799
+ details: [...testsLines, ...stepLogs]
1800
+ })
1297
1801
  );
1298
1802
  await view.finish(
1299
- waterfallLines(ran, {
1803
+ waterfallLines(timeline, {
1300
1804
  width: view.width,
1301
1805
  paint: view.paint,
1302
1806
  logs: logsText(opened, writeFailure, app.env, failed),
@@ -1308,12 +1812,12 @@ async function summarize(app, run) {
1308
1812
  ]
1309
1813
  })
1310
1814
  );
1311
- return ran;
1815
+ return timeline;
1312
1816
  }
1313
- function workerClock(ran, collected, local) {
1817
+ function workerClock(ran, collected) {
1314
1818
  const tests = ran.rows.find((row) => row.name === "tests");
1315
1819
  if (tests === void 0) return void 0;
1316
- return { runStartedAt: Date.parse(ran.startedAt), offsetMs: local ? 0 : collected.workerOffsetMs, tests };
1820
+ return { runStartedAt: Date.parse(ran.startedAt), offsetMs: collected.workerOffsetMs, tests };
1317
1821
  }
1318
1822
  function teeTerminal(terminal, directory) {
1319
1823
  if (directory === void 0) return terminal;
@@ -1344,8 +1848,9 @@ function logsText(opened, writeFailure, env, failed) {
1344
1848
  const show = `storm runs show ${opened.directory.id}${failed ? " --failed" : ""}`;
1345
1849
  return `${problems.length === 0 ? path : `${path} (${problems.join("; ")})`} \xB7 ${show}`;
1346
1850
  }
1347
- function runEnd(outcome, ran, tests, requests) {
1851
+ function runEnd(outcome, ran, tests) {
1348
1852
  const command = outcome.kind === "ran" ? outcome.command : void 0;
1853
+ const ranRecords = outcome.kind === "ran" ? outcome.resources : void 0;
1349
1854
  const ms = ran?.outcome === void 0 || ran.outcome === "stopped" || ran.endedAt === void 0 ? null : ran.endedAt - ran.startedAt;
1350
1855
  return {
1351
1856
  outcome: outcome.kind,
@@ -1354,7 +1859,8 @@ function runEnd(outcome, ran, tests, requests) {
1354
1859
  ms,
1355
1860
  tests: testTotals(tests.events),
1356
1861
  testsIncomplete: tests.incomplete ?? null,
1357
- resources: outcome.kind === "ran" ? RESOURCE_REPORTS.ranFacts(outcome.resources, requests) : null
1862
+ resources: ranRecords === void 0 ? null : RESOURCE_REPORTS.ranFacts(ranRecords),
1863
+ resourceRows: ranRecords === void 0 ? [] : RESOURCE_REPORTS.ranRows(ranRecords)
1358
1864
  };
1359
1865
  }
1360
1866
  async function checkoutGit(checkout, cwd) {
@@ -1363,6 +1869,14 @@ async function checkoutGit(checkout, cwd) {
1363
1869
  const head = await checkout.head({ repoRoot: root.value });
1364
1870
  return head.ok ? { ...head.value } : null;
1365
1871
  }
1872
+ function recipeResources(requests) {
1873
+ return Object.fromEntries(
1874
+ Object.entries(requests).map(([key, { definition, options }]) => {
1875
+ if (typeof options !== "object" || options === null) throw new Error(`${key}'s options are not an object`);
1876
+ return [key, { definition, options }];
1877
+ })
1878
+ );
1879
+ }
1366
1880
  var DEFAULT_KEEP_SANDBOX_MINUTES = 30;
1367
1881
  function keepSandboxMinutes(flag, recipe, env) {
1368
1882
  const fromFlag = flag === void 0 ? void 0 : parseKeepTime(flag);
@@ -1372,8 +1886,9 @@ function isCi(env) {
1372
1886
  const ci = env["CI"];
1373
1887
  return ci !== void 0 && ci !== "" && ci !== "0" && ci.toLowerCase() !== "false";
1374
1888
  }
1375
- function startedWhere(runner) {
1376
- const { prepared, target } = runner;
1889
+ function startedWhere(run) {
1890
+ if (run.runner === void 0) return { kind: "unsandboxed" };
1891
+ const { prepared, target } = run.runner;
1377
1892
  return {
1378
1893
  kind: "runner",
1379
1894
  team: target.team,
@@ -1390,7 +1905,7 @@ function startedWhere(runner) {
1390
1905
  };
1391
1906
  }
1392
1907
  function endedWhere(where, runner, save) {
1393
- if (where.kind === "local") return where;
1908
+ if (where.kind === "unsandboxed") return where;
1394
1909
  const snapshot = runner?.snapshot;
1395
1910
  return {
1396
1911
  ...where,
@@ -1414,13 +1929,6 @@ function failedStepLogs(ran, directory, env) {
1414
1929
  return log === void 0 ? [] : [` failed ${step.name}, whole output: ${displayPath(log, env)}`];
1415
1930
  });
1416
1931
  }
1417
- function timelineFacts(ran) {
1418
- return {
1419
- ...ran,
1420
- rows: ran.rows.map((row) => ({ ...row, steps: row.steps.map((step) => ({ ...step })) })),
1421
- criticalPath: [...ran.criticalPath]
1422
- };
1423
- }
1424
1932
  function runnerFailureFacts(failure) {
1425
1933
  switch (failure.kind) {
1426
1934
  case "snapshot-build-step-failed":
@@ -1436,47 +1944,7 @@ function runnerFailureFacts(failure) {
1436
1944
  return { kind: failure.kind, ...failure.target };
1437
1945
  }
1438
1946
  }
1439
- var NOTHING_HELD = { runnerCleanup: null, resourceCleanup: {} };
1440
- function setProblems(texts) {
1441
- const parsed = parseSetFlags(texts, RESOURCE_CONFIGS, TESTSERVER_OWN_FLAGS);
1442
- return parsed.ok ? [] : parsed.problems;
1443
- }
1444
- async function settleRun(app, request) {
1445
- const file = await loadSettingsFile(app.context.config, app.cwd, RESOURCE_CONFIGS);
1446
- if (!file.ok) return file;
1447
- const configFile = file.path;
1448
- const resolved = settleResourceOptions(file, request.given);
1449
- if (!resolved.ok) return resolved;
1450
- const { options } = resolved;
1451
- const takesCredential = RESOURCE_COMMANDS.takesCredential(options);
1452
- if (request.credential !== void 0 && !takesCredential)
1453
- return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
1454
- const settings = fileSettings(file, request);
1455
- let where;
1456
- if (!request.local) {
1457
- if (settings.runner === void 0) return refused(runErrors.missingRunner({ configFile }));
1458
- const required = requireTarget(settings.scope, settings.project);
1459
- if (!required.ok) return required;
1460
- const recipe = settings.runner.value;
1461
- const secrets = readRunnerSecrets(recipe, app.env);
1462
- if (!secrets.ok)
1463
- return refused(
1464
- runErrors.runnerSecretsInvalid({
1465
- variables: secrets.variables.map(({ name, problem }) => ({ name, problem })),
1466
- minLength: RUNNER_SECRET_MIN_LENGTH,
1467
- configFile
1468
- })
1469
- );
1470
- where = { kind: "runner", recipe, target: required.target, secrets: secrets.values };
1471
- } else if (takesCredential) {
1472
- const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
1473
- if (!chosen.ok) return chosen;
1474
- where = { kind: "local", credential: chosen.credential };
1475
- } else where = { kind: "local", credential: void 0 };
1476
- const settlement = RESOURCE_COMMANDS.settle(options, app.env, configFile);
1477
- if (!settlement.ok) return settlement;
1478
- return { ok: true, configFile, file, options, where, settlement };
1479
- }
1947
+ var NOTHING_RELEASED = { runnerCleanup: null, resourceCleanup: {} };
1480
1948
  function canceledChanges(outcome) {
1481
1949
  const { commandStopped } = outcome;
1482
1950
  const lines = [
@@ -1484,7 +1952,7 @@ function canceledChanges(outcome) {
1484
1952
  ];
1485
1953
  const cleanup = RUN_CLEANUP.facts(outcome).runner;
1486
1954
  if (cleanup !== null) lines.push(...runnerCleanupLines(cleanup));
1487
- lines.push(...RESOURCE_COMMANDS.canceledLines(outcome.resources, outcome.resourceCleanup));
1955
+ lines.push(...RESOURCE_REPORTS.canceledLines(outcome.resourceCleanup));
1488
1956
  return lines.join("\n");
1489
1957
  }
1490
1958
  function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
@@ -1501,12 +1969,55 @@ function runnerCleanupLines({ kept, notKept, notStopped, notDeleted }) {
1501
1969
  ];
1502
1970
  }
1503
1971
 
1972
+ // src/commands/exec/run-metadata.ts
1973
+ var RUN_USAGE_FLAGS = `${RESOURCE_USAGE_FLAGS} [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>] [--unsandboxed | [--rebuild-snapshot] [--save-snapshot] [--show-output] [--keep-sandbox <DURATION>]] [--verbose]`;
1974
+ var OWN_RUN_FIELDS2 = {
1975
+ credential: {
1976
+ valueLabel: "SOURCE",
1977
+ 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."
1978
+ },
1979
+ unsandboxed: {
1980
+ 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."
1981
+ },
1982
+ rebuildSnapshot: {
1983
+ 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."
1984
+ },
1985
+ saveSnapshot: {
1986
+ description: "Once the command ends on its own after a successful install and build, save the runner sandbox as this branch's runner snapshot, so the next run on the branch starts from this run's install and build outputs. The run 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 with it on a branch keeps no runner sandbox, even when it fails or stops before the save. With a detached HEAD it says so as it starts and keeps the runner sandbox as without the flag. Not with --unsandboxed, or with --keep-sandbox above 0. No config key."
1987
+ },
1988
+ keepSandbox: {
1989
+ valueLabel: "DURATION",
1990
+ 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). 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."
1991
+ },
1992
+ showOutput: {
1993
+ 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."
1994
+ },
1995
+ verbose: {
1996
+ 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."
1997
+ },
1998
+ scope: {
1999
+ valueLabel: "TEAM",
2000
+ 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."
2001
+ },
2002
+ project: {
2003
+ valueLabel: "PROJECT",
2004
+ 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."
2005
+ }
2006
+ };
2007
+ var RUN_FIELDS = { ...RESOURCE_FLAG_HELP, ...OWN_RUN_FIELDS2 };
2008
+
1504
2009
  export {
1505
- testserverSandboxesSource,
2010
+ ranSchema,
2011
+ RAN_DESCRIPTION,
2012
+ renderRan,
2013
+ RUN_ERRORS,
2014
+ outcomes,
2015
+ canceledBeforeStart,
1506
2016
  RUN_REQUEST_FIELDS,
1507
2017
  RUN_CLI_OPTIONS,
1508
2018
  runCommand,
1509
2019
  runProblems,
1510
- canceledBeforeStart,
1511
- checkoutFailedRefusal
2020
+ checkoutFailedRefusal,
2021
+ RUN_USAGE_FLAGS,
2022
+ RUN_FIELDS
1512
2023
  };