@cnc-tools/storm 0.0.0 → 0.6.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 (527) hide show
  1. package/bin/node-version.js +24 -0
  2. package/bin/storm.js +16 -0
  3. package/dist/application.d.ts +13 -0
  4. package/dist/application.js +23 -0
  5. package/dist/bin/storm.d.ts +1 -0
  6. package/dist/bin/storm.js +45 -0
  7. package/dist/build-info.js +3 -0
  8. package/dist/closed-terminal.d.ts +7 -0
  9. package/dist/closed-terminal.js +18 -0
  10. package/dist/combine-errors.d.ts +11 -0
  11. package/dist/combine-errors.js +19 -0
  12. package/dist/commands/dashboard.d.ts +11 -0
  13. package/dist/commands/dashboard.js +18 -0
  14. package/dist/commands/exec/cleanup.d.ts +135 -0
  15. package/dist/commands/exec/cleanup.js +171 -0
  16. package/dist/commands/exec/command.d.ts +272 -0
  17. package/dist/commands/exec/command.js +23 -0
  18. package/dist/commands/exec/job-summary.d.ts +10 -0
  19. package/dist/commands/exec/job-summary.js +34 -0
  20. package/dist/commands/exec/live-view.d.ts +22 -0
  21. package/dist/commands/exec/live-view.js +395 -0
  22. package/dist/commands/exec/metadata.d.ts +66 -0
  23. package/dist/commands/exec/metadata.js +55 -0
  24. package/dist/commands/exec/mint-failed.d.ts +11 -0
  25. package/dist/commands/exec/mint-failed.js +33 -0
  26. package/dist/commands/exec/outcomes.d.ts +614 -0
  27. package/dist/commands/exec/outcomes.js +338 -0
  28. package/dist/commands/exec/progress.d.ts +44 -0
  29. package/dist/commands/exec/progress.js +277 -0
  30. package/dist/commands/exec/redaction.d.ts +15 -0
  31. package/dist/commands/exec/redaction.js +40 -0
  32. package/dist/commands/exec/run-collector.d.ts +30 -0
  33. package/dist/commands/exec/run-collector.js +73 -0
  34. package/dist/commands/exec/run-command.d.ts +221 -0
  35. package/dist/commands/exec/run-command.js +663 -0
  36. package/dist/commands/exec/run-metadata.d.ts +56 -0
  37. package/dist/commands/exec/run-metadata.js +58 -0
  38. package/dist/commands/exec/run-record.d.ts +170 -0
  39. package/dist/commands/exec/run-record.js +104 -0
  40. package/dist/commands/exec/tests-summary.d.ts +34 -0
  41. package/dist/commands/exec/tests-summary.js +141 -0
  42. package/dist/commands/exec/testserver-flags.d.ts +48 -0
  43. package/dist/commands/exec/testserver-flags.js +80 -0
  44. package/dist/commands/exec/text.d.ts +22 -0
  45. package/dist/commands/exec/text.js +74 -0
  46. package/dist/commands/exec/view.d.ts +35 -0
  47. package/dist/commands/exec/view.js +163 -0
  48. package/dist/commands/exec/waterfall.d.ts +25 -0
  49. package/dist/commands/exec/waterfall.js +108 -0
  50. package/dist/commands/exec/worker-chart.d.ts +79 -0
  51. package/dist/commands/exec/worker-chart.js +313 -0
  52. package/dist/commands/runs/facts.d.ts +150 -0
  53. package/dist/commands/runs/facts.js +292 -0
  54. package/dist/commands/runs/list/command.d.ts +86 -0
  55. package/dist/commands/runs/list/command.js +36 -0
  56. package/dist/commands/runs/list/metadata.d.ts +22 -0
  57. package/dist/commands/runs/list/metadata.js +19 -0
  58. package/dist/commands/runs/list/outcomes.d.ts +74 -0
  59. package/dist/commands/runs/list/outcomes.js +89 -0
  60. package/dist/commands/runs/logs/command.d.ts +72 -0
  61. package/dist/commands/runs/logs/command.js +51 -0
  62. package/dist/commands/runs/logs/metadata.d.ts +22 -0
  63. package/dist/commands/runs/logs/metadata.js +22 -0
  64. package/dist/commands/runs/logs/outcomes.d.ts +55 -0
  65. package/dist/commands/runs/logs/outcomes.js +80 -0
  66. package/dist/commands/runs/metadata.d.ts +3 -0
  67. package/dist/commands/runs/metadata.js +3 -0
  68. package/dist/commands/runs/past-run.d.ts +72 -0
  69. package/dist/commands/runs/past-run.js +99 -0
  70. package/dist/commands/runs/show/command.d.ts +176 -0
  71. package/dist/commands/runs/show/command.js +76 -0
  72. package/dist/commands/runs/show/metadata.d.ts +25 -0
  73. package/dist/commands/runs/show/metadata.js +22 -0
  74. package/dist/commands/runs/show/outcomes.d.ts +164 -0
  75. package/dist/commands/runs/show/outcomes.js +320 -0
  76. package/dist/commands/vitest/command.d.ts +299 -0
  77. package/dist/commands/vitest/command.js +138 -0
  78. package/dist/commands/vitest/metadata.d.ts +66 -0
  79. package/dist/commands/vitest/metadata.js +35 -0
  80. package/dist/commands/vitest/outcomes.d.ts +273 -0
  81. package/dist/commands/vitest/outcomes.js +77 -0
  82. package/dist/config/by-name.d.ts +24 -0
  83. package/dist/config/by-name.js +26 -0
  84. package/dist/config/errors.d.ts +58 -0
  85. package/dist/config/errors.js +101 -0
  86. package/dist/config/gateways.d.ts +32 -0
  87. package/dist/config/gateways.js +1 -0
  88. package/dist/config/index.d.ts +10 -0
  89. package/dist/config/index.js +13 -0
  90. package/dist/config/live/config-gateway.d.ts +6 -0
  91. package/dist/config/live/config-gateway.js +71 -0
  92. package/dist/config/load.d.ts +54 -0
  93. package/dist/config/load.js +175 -0
  94. package/dist/config/resolve.d.ts +49 -0
  95. package/dist/config/resolve.js +94 -0
  96. package/dist/config/resource-config.d.ts +132 -0
  97. package/dist/config/resource-config.js +19 -0
  98. package/dist/config/schema.d.ts +64 -0
  99. package/dist/config/schema.js +57 -0
  100. package/dist/config/set.d.ts +27 -0
  101. package/dist/config/set.js +71 -0
  102. package/dist/config/settings-file.d.ts +41 -0
  103. package/dist/config/settings-file.js +72 -0
  104. package/dist/config-file/define.d.ts +39 -0
  105. package/dist/config-file/define.js +9 -0
  106. package/dist/config-file/toolchain.d.ts +9 -0
  107. package/dist/config-file/toolchain.js +41 -0
  108. package/dist/context.d.ts +89 -0
  109. package/dist/context.js +45 -0
  110. package/dist/core/command-provider.d.ts +126 -0
  111. package/dist/core/command-provider.js +13 -0
  112. package/dist/core/command-slots.d.ts +67 -0
  113. package/dist/core/command-slots.js +136 -0
  114. package/dist/core/events.d.ts +128 -0
  115. package/dist/core/events.js +15 -0
  116. package/dist/core/gateways.d.ts +249 -0
  117. package/dist/core/gateways.js +1 -0
  118. package/dist/core/index.d.ts +20 -0
  119. package/dist/core/index.js +18 -0
  120. package/dist/core/keyed.d.ts +12 -0
  121. package/dist/core/keyed.js +24 -0
  122. package/dist/core/lane.d.ts +46 -0
  123. package/dist/core/lane.js +5 -0
  124. package/dist/core/limit.d.ts +9 -0
  125. package/dist/core/limit.js +29 -0
  126. package/dist/core/live/command-gateway.d.ts +11 -0
  127. package/dist/core/live/command-gateway.js +83 -0
  128. package/dist/core/live/job-summary-gateway.d.ts +5 -0
  129. package/dist/core/live/job-summary-gateway.js +20 -0
  130. package/dist/core/live/progress-terminal.d.ts +20 -0
  131. package/dist/core/live/progress-terminal.js +173 -0
  132. package/dist/core/live/run-directory-gateway.d.ts +24 -0
  133. package/dist/core/live/run-directory-gateway.js +437 -0
  134. package/dist/core/mint.d.ts +10 -0
  135. package/dist/core/mint.js +14 -0
  136. package/dist/core/payload.d.ts +26 -0
  137. package/dist/core/payload.js +33 -0
  138. package/dist/core/presentation.d.ts +87 -0
  139. package/dist/core/presentation.js +5 -0
  140. package/dist/core/presentations.d.ts +56 -0
  141. package/dist/core/presentations.js +66 -0
  142. package/dist/core/provider.d.ts +69 -0
  143. package/dist/core/provider.js +5 -0
  144. package/dist/core/resource.d.ts +262 -0
  145. package/dist/core/resource.js +6 -0
  146. package/dist/core/resources.d.ts +131 -0
  147. package/dist/core/resources.js +254 -0
  148. package/dist/core/run-directory.d.ts +69 -0
  149. package/dist/core/run-directory.js +94 -0
  150. package/dist/core/run-state.d.ts +152 -0
  151. package/dist/core/run-state.js +313 -0
  152. package/dist/core/run.d.ts +187 -0
  153. package/dist/core/run.js +321 -0
  154. package/dist/core/state-directory.d.ts +19 -0
  155. package/dist/core/state-directory.js +29 -0
  156. package/dist/core/timeline.d.ts +63 -0
  157. package/dist/core/timeline.js +97 -0
  158. package/dist/core/timing.d.ts +22 -0
  159. package/dist/core/timing.js +26 -0
  160. package/dist/credential/credential.d.ts +46 -0
  161. package/dist/credential/credential.js +80 -0
  162. package/dist/credential/diagnosis.d.ts +18 -0
  163. package/dist/credential/diagnosis.js +99 -0
  164. package/dist/credential/gateways.d.ts +109 -0
  165. package/dist/credential/gateways.js +1 -0
  166. package/dist/credential/index.d.ts +7 -0
  167. package/dist/credential/index.js +7 -0
  168. package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
  169. package/dist/credential/live/github-actions-token-gateway.js +43 -0
  170. package/dist/credential/live/github-actions-token-response.d.ts +19 -0
  171. package/dist/credential/live/github-actions-token-response.js +49 -0
  172. package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
  173. package/dist/credential/live/vercel-cli-gateway.js +64 -0
  174. package/dist/credential/live/vercel-output.d.ts +60 -0
  175. package/dist/credential/live/vercel-output.js +122 -0
  176. package/dist/credential/live/vercel-process.d.ts +14 -0
  177. package/dist/credential/live/vercel-process.js +3 -0
  178. package/dist/credential/settle.d.ts +31 -0
  179. package/dist/credential/settle.js +49 -0
  180. package/dist/credential/source.d.ts +110 -0
  181. package/dist/credential/source.js +114 -0
  182. package/dist/help-logo.d.ts +11 -0
  183. package/dist/help-logo.js +56 -0
  184. package/dist/presentation.d.ts +26 -0
  185. package/dist/presentation.js +21 -0
  186. package/dist/resources/github/cleanup.d.ts +23 -0
  187. package/dist/resources/github/cleanup.js +39 -0
  188. package/dist/resources/github/command.d.ts +74 -0
  189. package/dist/resources/github/command.js +117 -0
  190. package/dist/resources/github/config.d.ts +16 -0
  191. package/dist/resources/github/config.js +37 -0
  192. package/dist/resources/github/events.d.ts +26 -0
  193. package/dist/resources/github/events.js +2 -0
  194. package/dist/resources/github/fixture-repo.d.ts +69 -0
  195. package/dist/resources/github/fixture-repo.js +60 -0
  196. package/dist/resources/github/gateways.d.ts +62 -0
  197. package/dist/resources/github/gateways.js +1 -0
  198. package/dist/resources/github/index.d.ts +12 -0
  199. package/dist/resources/github/index.js +15 -0
  200. package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
  201. package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
  202. package/dist/resources/github/live/gateways.d.ts +6 -0
  203. package/dist/resources/github/live/gateways.js +13 -0
  204. package/dist/resources/github/presentation.d.ts +13 -0
  205. package/dist/resources/github/presentation.js +43 -0
  206. package/dist/resources/github/provider.d.ts +66 -0
  207. package/dist/resources/github/provider.js +58 -0
  208. package/dist/resources/github/resource-provider.d.ts +6 -0
  209. package/dist/resources/github/resource-provider.js +20 -0
  210. package/dist/resources/github/resource.d.ts +33 -0
  211. package/dist/resources/github/resource.js +12 -0
  212. package/dist/resources/testserver/cleanup.d.ts +14 -0
  213. package/dist/resources/testserver/cleanup.js +22 -0
  214. package/dist/resources/testserver/command.d.ts +322 -0
  215. package/dist/resources/testserver/command.js +245 -0
  216. package/dist/resources/testserver/commands/app.d.ts +18 -0
  217. package/dist/resources/testserver/commands/app.js +3 -0
  218. package/dist/resources/testserver/commands/create/command.d.ts +136 -0
  219. package/dist/resources/testserver/commands/create/command.js +158 -0
  220. package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
  221. package/dist/resources/testserver/commands/create/metadata.js +45 -0
  222. package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
  223. package/dist/resources/testserver/commands/create/outcomes.js +172 -0
  224. package/dist/resources/testserver/commands/list/command.d.ts +60 -0
  225. package/dist/resources/testserver/commands/list/command.js +56 -0
  226. package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
  227. package/dist/resources/testserver/commands/list/metadata.js +9 -0
  228. package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
  229. package/dist/resources/testserver/commands/list/outcomes.js +152 -0
  230. package/dist/resources/testserver/config.d.ts +18 -0
  231. package/dist/resources/testserver/config.js +78 -0
  232. package/dist/resources/testserver/credential-facts.d.ts +80 -0
  233. package/dist/resources/testserver/credential-facts.js +83 -0
  234. package/dist/resources/testserver/events.d.ts +59 -0
  235. package/dist/resources/testserver/events.js +4 -0
  236. package/dist/resources/testserver/index.d.ts +16 -0
  237. package/dist/resources/testserver/index.js +24 -0
  238. package/dist/resources/testserver/lane.d.ts +28 -0
  239. package/dist/resources/testserver/lane.js +139 -0
  240. package/dist/resources/testserver/live/gateways.d.ts +6 -0
  241. package/dist/resources/testserver/live/gateways.js +26 -0
  242. package/dist/resources/testserver/options.d.ts +5 -0
  243. package/dist/resources/testserver/options.js +5 -0
  244. package/dist/resources/testserver/pool/channels.d.ts +80 -0
  245. package/dist/resources/testserver/pool/channels.js +48 -0
  246. package/dist/resources/testserver/pool/create.d.ts +48 -0
  247. package/dist/resources/testserver/pool/create.js +45 -0
  248. package/dist/resources/testserver/pool/directory.d.ts +4 -0
  249. package/dist/resources/testserver/pool/directory.js +5 -0
  250. package/dist/resources/testserver/pool/gateways.d.ts +190 -0
  251. package/dist/resources/testserver/pool/gateways.js +1 -0
  252. package/dist/resources/testserver/pool/host.d.ts +8 -0
  253. package/dist/resources/testserver/pool/host.js +21 -0
  254. package/dist/resources/testserver/pool/index.d.ts +9 -0
  255. package/dist/resources/testserver/pool/index.js +10 -0
  256. package/dist/resources/testserver/pool/inspect.d.ts +53 -0
  257. package/dist/resources/testserver/pool/inspect.js +45 -0
  258. package/dist/resources/testserver/pool/lease.d.ts +84 -0
  259. package/dist/resources/testserver/pool/lease.js +125 -0
  260. package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
  261. package/dist/resources/testserver/pool/live/pool-records.js +70 -0
  262. package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
  263. package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
  264. package/dist/resources/testserver/pool/staleness.d.ts +16 -0
  265. package/dist/resources/testserver/pool/staleness.js +27 -0
  266. package/dist/resources/testserver/presentation.d.ts +9 -0
  267. package/dist/resources/testserver/presentation.js +217 -0
  268. package/dist/resources/testserver/provider.d.ts +177 -0
  269. package/dist/resources/testserver/provider.js +254 -0
  270. package/dist/resources/testserver/ran.d.ts +87 -0
  271. package/dist/resources/testserver/ran.js +140 -0
  272. package/dist/resources/testserver/resource-provider.d.ts +12 -0
  273. package/dist/resources/testserver/resource-provider.js +38 -0
  274. package/dist/resources/testserver/resource.d.ts +32 -0
  275. package/dist/resources/testserver/resource.js +10 -0
  276. package/dist/resources/testserver/run-sandbox.d.ts +13 -0
  277. package/dist/resources/testserver/run-sandbox.js +6 -0
  278. package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
  279. package/dist/resources/testserver/sandbox/channels.js +21 -0
  280. package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
  281. package/dist/resources/testserver/sandbox/create-failure.js +65 -0
  282. package/dist/resources/testserver/sandbox/create.d.ts +29 -0
  283. package/dist/resources/testserver/sandbox/create.js +37 -0
  284. package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
  285. package/dist/resources/testserver/sandbox/gateways.js +1 -0
  286. package/dist/resources/testserver/sandbox/index.d.ts +6 -0
  287. package/dist/resources/testserver/sandbox/index.js +7 -0
  288. package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
  289. package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
  290. package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
  291. package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
  292. package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
  293. package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
  294. package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
  295. package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
  296. package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
  297. package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
  298. package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
  299. package/dist/resources/testserver/sandbox/live/sse.js +32 -0
  300. package/dist/resources.d.ts +455 -0
  301. package/dist/resources.js +88 -0
  302. package/dist/runner/base.d.ts +40 -0
  303. package/dist/runner/base.js +52 -0
  304. package/dist/runner/context.d.ts +13 -0
  305. package/dist/runner/context.js +9 -0
  306. package/dist/runner/events.d.ts +179 -0
  307. package/dist/runner/events.js +16 -0
  308. package/dist/runner/gateways.d.ts +351 -0
  309. package/dist/runner/gateways.js +3 -0
  310. package/dist/runner/index.d.ts +19 -0
  311. package/dist/runner/index.js +18 -0
  312. package/dist/runner/live/checkout-gateway.d.ts +3 -0
  313. package/dist/runner/live/checkout-gateway.js +206 -0
  314. package/dist/runner/live/git-output.d.ts +14 -0
  315. package/dist/runner/live/git-output.js +32 -0
  316. package/dist/runner/live/sandbox-errors.d.ts +7 -0
  317. package/dist/runner/live/sandbox-errors.js +21 -0
  318. package/dist/runner/live/sandbox-gateway.d.ts +7 -0
  319. package/dist/runner/live/sandbox-gateway.js +427 -0
  320. package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
  321. package/dist/runner/live/snapshot-cache-gateway.js +104 -0
  322. package/dist/runner/live/snapshot-records.d.ts +11 -0
  323. package/dist/runner/live/snapshot-records.js +57 -0
  324. package/dist/runner/live/terminal.d.ts +16 -0
  325. package/dist/runner/live/terminal.js +37 -0
  326. package/dist/runner/live/user.d.ts +2 -0
  327. package/dist/runner/live/user.js +11 -0
  328. package/dist/runner/output.d.ts +23 -0
  329. package/dist/runner/output.js +58 -0
  330. package/dist/runner/prepare.d.ts +67 -0
  331. package/dist/runner/prepare.js +59 -0
  332. package/dist/runner/ready.d.ts +68 -0
  333. package/dist/runner/ready.js +159 -0
  334. package/dist/runner/recipe.d.ts +126 -0
  335. package/dist/runner/recipe.js +302 -0
  336. package/dist/runner/remote-command.d.ts +77 -0
  337. package/dist/runner/remote-command.js +127 -0
  338. package/dist/runner/scope.d.ts +58 -0
  339. package/dist/runner/scope.js +117 -0
  340. package/dist/runner/snapshot-build.d.ts +33 -0
  341. package/dist/runner/snapshot-build.js +112 -0
  342. package/dist/runner/snapshot-cache.d.ts +84 -0
  343. package/dist/runner/snapshot-cache.js +126 -0
  344. package/dist/runner/snapshot-key.d.ts +52 -0
  345. package/dist/runner/snapshot-key.js +91 -0
  346. package/dist/runner/steps.d.ts +41 -0
  347. package/dist/runner/steps.js +49 -0
  348. package/dist/sdk/container/api-request.d.ts +32 -0
  349. package/dist/sdk/container/api-request.js +46 -0
  350. package/dist/sdk/container/container.d.ts +144 -0
  351. package/dist/sdk/container/container.js +346 -0
  352. package/dist/sdk/container/feature-flags.d.ts +37 -0
  353. package/dist/sdk/container/feature-flags.js +118 -0
  354. package/dist/sdk/container/gateways.d.ts +108 -0
  355. package/dist/sdk/container/gateways.js +1 -0
  356. package/dist/sdk/container/index.d.ts +5 -0
  357. package/dist/sdk/container/index.js +5 -0
  358. package/dist/sdk/container/live/container-gateway.d.ts +17 -0
  359. package/dist/sdk/container/live/container-gateway.js +114 -0
  360. package/dist/sdk/factories/build.d.ts +66 -0
  361. package/dist/sdk/factories/build.js +98 -0
  362. package/dist/sdk/factories/definition.d.ts +28 -0
  363. package/dist/sdk/factories/definition.js +16 -0
  364. package/dist/sdk/factories/definitions.d.ts +166 -0
  365. package/dist/sdk/factories/definitions.js +235 -0
  366. package/dist/sdk/factories/gateways.d.ts +25 -0
  367. package/dist/sdk/factories/gateways.js +1 -0
  368. package/dist/sdk/factories/index.d.ts +5 -0
  369. package/dist/sdk/factories/index.js +5 -0
  370. package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
  371. package/dist/sdk/factories/live/factory-gateway.js +29 -0
  372. package/dist/sdk/index.d.ts +7 -0
  373. package/dist/sdk/index.js +15 -0
  374. package/dist/sdk/payload/index.d.ts +2 -0
  375. package/dist/sdk/payload/index.js +4 -0
  376. package/dist/sdk/payload/payload.d.ts +47 -0
  377. package/dist/sdk/payload/payload.js +74 -0
  378. package/dist/sdk/payload/test-events.d.ts +102 -0
  379. package/dist/sdk/payload/test-events.js +59 -0
  380. package/dist/sdk/proxy/exchange.d.ts +58 -0
  381. package/dist/sdk/proxy/exchange.js +173 -0
  382. package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
  383. package/dist/sdk/proxy/faulted-exchange.js +106 -0
  384. package/dist/sdk/proxy/faults.d.ts +133 -0
  385. package/dist/sdk/proxy/faults.js +147 -0
  386. package/dist/sdk/proxy/index.d.ts +3 -0
  387. package/dist/sdk/proxy/index.js +3 -0
  388. package/dist/sdk/proxy/proxy.d.ts +93 -0
  389. package/dist/sdk/proxy/proxy.js +99 -0
  390. package/dist/sdk/proxy/records.d.ts +56 -0
  391. package/dist/sdk/proxy/records.js +56 -0
  392. package/dist/sdk/records/body.d.ts +89 -0
  393. package/dist/sdk/records/body.js +236 -0
  394. package/dist/sdk/records/index.d.ts +2 -0
  395. package/dist/sdk/records/index.js +4 -0
  396. package/dist/sdk/records/records.d.ts +49 -0
  397. package/dist/sdk/records/records.js +16 -0
  398. package/dist/sdk/seed/index.d.ts +1 -0
  399. package/dist/sdk/seed/index.js +3 -0
  400. package/dist/sdk/seed/seed.d.ts +221 -0
  401. package/dist/sdk/seed/seed.js +171 -0
  402. package/dist/sdk/testserver/clock.d.ts +8 -0
  403. package/dist/sdk/testserver/clock.js +10 -0
  404. package/dist/sdk/testserver/failure.d.ts +73 -0
  405. package/dist/sdk/testserver/failure.js +61 -0
  406. package/dist/sdk/testserver/index.d.ts +5 -0
  407. package/dist/sdk/testserver/index.js +8 -0
  408. package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
  409. package/dist/sdk/testserver/live/connect-failure.js +30 -0
  410. package/dist/sdk/testserver/live/request.d.ts +69 -0
  411. package/dist/sdk/testserver/live/request.js +89 -0
  412. package/dist/sdk/testserver/service-ids.d.ts +19 -0
  413. package/dist/sdk/testserver/service-ids.js +77 -0
  414. package/dist/sdk/testserver/test-id.d.ts +15 -0
  415. package/dist/sdk/testserver/test-id.js +28 -0
  416. package/dist/story/align.d.ts +37 -0
  417. package/dist/story/align.js +39 -0
  418. package/dist/story/artifact.d.ts +60 -0
  419. package/dist/story/artifact.js +93 -0
  420. package/dist/story/definition.d.ts +52 -0
  421. package/dist/story/definition.js +9 -0
  422. package/dist/story/diff.d.ts +9 -0
  423. package/dist/story/diff.js +97 -0
  424. package/dist/story/errors.d.ts +14 -0
  425. package/dist/story/errors.js +21 -0
  426. package/dist/story/gateways.d.ts +74 -0
  427. package/dist/story/gateways.js +3 -0
  428. package/dist/story/host.d.ts +27 -0
  429. package/dist/story/host.js +97 -0
  430. package/dist/story/index.d.ts +7 -0
  431. package/dist/story/index.js +9 -0
  432. package/dist/story/json.d.ts +16 -0
  433. package/dist/story/json.js +59 -0
  434. package/dist/story/live/artifact-gateway.d.ts +2 -0
  435. package/dist/story/live/artifact-gateway.js +82 -0
  436. package/dist/story/mode.d.ts +17 -0
  437. package/dist/story/mode.js +21 -0
  438. package/dist/story/orphans.d.ts +17 -0
  439. package/dist/story/orphans.js +15 -0
  440. package/dist/story/report.d.ts +30 -0
  441. package/dist/story/report.js +118 -0
  442. package/dist/story/run.d.ts +49 -0
  443. package/dist/story/run.js +160 -0
  444. package/dist/story/sequence.d.ts +30 -0
  445. package/dist/story/sequence.js +74 -0
  446. package/dist/story/settle.d.ts +94 -0
  447. package/dist/story/settle.js +70 -0
  448. package/dist/time/duration.d.ts +19 -0
  449. package/dist/time/duration.js +37 -0
  450. package/dist/time/index.d.ts +2 -0
  451. package/dist/time/index.js +4 -0
  452. package/dist/time/time.d.ts +15 -0
  453. package/dist/time/time.js +23 -0
  454. package/dist/vercel-cli/ansi.d.ts +13 -0
  455. package/dist/vercel-cli/ansi.js +32 -0
  456. package/dist/vercel-cli/arguments.d.ts +25 -0
  457. package/dist/vercel-cli/arguments.js +78 -0
  458. package/dist/vercel-cli/auth-config.d.ts +43 -0
  459. package/dist/vercel-cli/auth-config.js +36 -0
  460. package/dist/vercel-cli/clock.d.ts +9 -0
  461. package/dist/vercel-cli/clock.js +10 -0
  462. package/dist/vercel-cli/config-files.d.ts +24 -0
  463. package/dist/vercel-cli/config-files.js +40 -0
  464. package/dist/vercel-cli/context.d.ts +12 -0
  465. package/dist/vercel-cli/context.js +12 -0
  466. package/dist/vercel-cli/driver.d.ts +218 -0
  467. package/dist/vercel-cli/driver.js +364 -0
  468. package/dist/vercel-cli/entry.d.ts +8 -0
  469. package/dist/vercel-cli/entry.js +13 -0
  470. package/dist/vercel-cli/environment.d.ts +33 -0
  471. package/dist/vercel-cli/environment.js +72 -0
  472. package/dist/vercel-cli/errors.d.ts +8 -0
  473. package/dist/vercel-cli/errors.js +8 -0
  474. package/dist/vercel-cli/gateways.d.ts +103 -0
  475. package/dist/vercel-cli/gateways.js +4 -0
  476. package/dist/vercel-cli/index.d.ts +10 -0
  477. package/dist/vercel-cli/index.js +15 -0
  478. package/dist/vercel-cli/invocation.d.ts +234 -0
  479. package/dist/vercel-cli/invocation.js +397 -0
  480. package/dist/vercel-cli/keys.d.ts +14 -0
  481. package/dist/vercel-cli/keys.js +12 -0
  482. package/dist/vercel-cli/live/config-files.d.ts +28 -0
  483. package/dist/vercel-cli/live/config-files.js +66 -0
  484. package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
  485. package/dist/vercel-cli/live/process-gateway.js +178 -0
  486. package/dist/vercel-cli/redaction.d.ts +13 -0
  487. package/dist/vercel-cli/redaction.js +22 -0
  488. package/dist/vercel-cli/report.d.ts +22 -0
  489. package/dist/vercel-cli/report.js +110 -0
  490. package/dist/vercel-cli/verbose.d.ts +7 -0
  491. package/dist/vercel-cli/verbose.js +24 -0
  492. package/dist/version.d.ts +20 -0
  493. package/dist/version.js +57 -0
  494. package/dist/vitest/config.d.ts +51 -0
  495. package/dist/vitest/config.js +61 -0
  496. package/dist/vitest/container-scope.d.ts +108 -0
  497. package/dist/vitest/container-scope.js +234 -0
  498. package/dist/vitest/diagnostics.d.ts +146 -0
  499. package/dist/vitest/diagnostics.js +306 -0
  500. package/dist/vitest/find-vitest.d.ts +7 -0
  501. package/dist/vitest/find-vitest.js +28 -0
  502. package/dist/vitest/fixtures.d.ts +64 -0
  503. package/dist/vitest/fixtures.js +172 -0
  504. package/dist/vitest/gateways.d.ts +78 -0
  505. package/dist/vitest/gateways.js +4 -0
  506. package/dist/vitest/index.d.ts +3 -0
  507. package/dist/vitest/index.js +9 -0
  508. package/dist/vitest/list-output.d.ts +3 -0
  509. package/dist/vitest/list-output.js +19 -0
  510. package/dist/vitest/live/list-gateway.d.ts +11 -0
  511. package/dist/vitest/live/list-gateway.js +107 -0
  512. package/dist/vitest/ownership.d.ts +29 -0
  513. package/dist/vitest/ownership.js +68 -0
  514. package/dist/vitest/plan.d.ts +66 -0
  515. package/dist/vitest/plan.js +104 -0
  516. package/dist/vitest/sandbox.d.ts +16 -0
  517. package/dist/vitest/sandbox.js +35 -0
  518. package/dist/vitest/test-events.d.ts +41 -0
  519. package/dist/vitest/test-events.js +92 -0
  520. package/dist/vitest/test-results.d.ts +84 -0
  521. package/dist/vitest/test-results.js +160 -0
  522. package/dist/vitest/types.d.ts +68 -0
  523. package/dist/vitest/types.js +4 -0
  524. package/package.json +119 -3
  525. package/skills/overview.md +33 -0
  526. package/skills/read-run-output.md +65 -0
  527. package/README.md +0 -3
@@ -0,0 +1,338 @@
1
+ import { defineErrors, defineOutcomes, renderOutcome } from "@vercel/clinkr";
2
+ import { z } from "zod";
3
+ import { RUNNER_STEPS } from "../../core/index.js";
4
+ import { RESOURCE_ERRORS, RESOURCE_PRESENTATIONS, RESOURCE_REPORTS, RUN_CLEANUP } from "../../resources.js";
5
+ import { configErrors } from "../../config/index.js";
6
+ import { credentialErrors } from "../../credential/index.js";
7
+ import { keptText, runnerCleanupWarnings } from "./cleanup.js";
8
+ import { mintFailedErrors } from "./mint-failed.js";
9
+ /** Why the runner couldn't run the command. */
10
+ const runnerFailureSchema = z.union([
11
+ z.object({
12
+ kind: z.enum(["snapshot-build-step-failed", "apply-failed", "install-failed", "build-failed"]),
13
+ /** The step's label. */
14
+ label: z.string(),
15
+ /** Its exit code; null when it ended without one. */
16
+ exitCode: z.number().nullable(),
17
+ /** Its last 40 output lines. */
18
+ tail: z.array(z.string()),
19
+ }),
20
+ z.object({
21
+ kind: z.literal("sandbox-api-failed"),
22
+ /** The Sandbox call that failed. */
23
+ operation: z.string(),
24
+ /** The HTTP status the Sandbox API answered; null when it answered none. */
25
+ status: z.number().nullable(),
26
+ message: z.string(),
27
+ }),
28
+ z.object({
29
+ kind: z.literal("checkout-failed"),
30
+ /** What git or tar said. */
31
+ message: z.string(),
32
+ /** The failed command; null when there was none. */
33
+ command: z.string().nullable(),
34
+ }),
35
+ z.object({ kind: z.literal("credential-claims-missing"), team: z.string(), project: z.string() }),
36
+ ]);
37
+ /** How a step ended, as a message says it. */
38
+ function stepEnded(exitCode) {
39
+ return exitCode === null ? "ended without an exit code" : `exited ${exitCode}`;
40
+ }
41
+ /** The headline and the next step for a runner failure. */
42
+ function runnerFailureText(failure) {
43
+ switch (failure.kind) {
44
+ case "snapshot-build-step-failed":
45
+ return {
46
+ message: `The runner snapshot build's step "${failure.label}" ${stepEnded(failure.exitCode)}. The command didn't run.`,
47
+ next: "Fix the step in the runner recipe, then retry. A failed build records no runner snapshot.",
48
+ };
49
+ case "apply-failed":
50
+ return {
51
+ message: `Couldn't apply your changes in the runner sandbox: "${failure.label}" ${stepEnded(failure.exitCode)}. The command didn't run.`,
52
+ next: "Check the output for the file that didn't apply, then retry.",
53
+ };
54
+ case "install-failed":
55
+ return {
56
+ message: `The runner's install, "${failure.label}", ${stepEnded(failure.exitCode)}. The command didn't run.`,
57
+ next: "Fix run.install in the runner recipe, or what it installs, then retry.",
58
+ };
59
+ case "build-failed":
60
+ return {
61
+ message: `The runner's build, "${failure.label}", ${stepEnded(failure.exitCode)}. The command didn't run.`,
62
+ next: "Fix the build, or run.build in the runner recipe, then retry.",
63
+ };
64
+ case "sandbox-api-failed":
65
+ return {
66
+ 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."}`,
67
+ next: "Retry; if it keeps failing, check the Vercel Sandbox status and the project's Sandbox access.",
68
+ };
69
+ case "checkout-failed":
70
+ return {
71
+ message: `git or tar failed on this machine: ${failure.message}. The command didn't run.`,
72
+ next: "Fix the checkout, then retry.",
73
+ };
74
+ case "credential-claims-missing":
75
+ return {
76
+ 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.`,
77
+ next: "Mint for a Vercel project whose development OIDC tokens carry owner_id and project_id, then retry.",
78
+ };
79
+ }
80
+ }
81
+ /** The timeline's rows, in order: the mint, each resource lane in provider order, the runner, the tests, the cleanup. */
82
+ const ROW_NAMES = [
83
+ "mint",
84
+ ...RESOURCE_PRESENTATIONS.lanes.map(({ lane }) => lane),
85
+ "runner",
86
+ "tests",
87
+ "cleanup",
88
+ ];
89
+ /** The timeline's steps: each resource lane's, in provider order, then the runner's. */
90
+ const STEP_NAMES = [...RESOURCE_PRESENTATIONS.lanes.flatMap(({ steps }) => steps), ...RUNNER_STEPS];
91
+ /** How a lane or step ended in the timeline: still going when the run ended is `unfinished`. */
92
+ const timelineOutcomeSchema = z.enum(["done", "failed", "stopped", "unfinished"]);
93
+ /** A run's waterfall (`Timeline`), times in milliseconds since the run started, as `timeline.json` holds it too. */
94
+ export const timelineSchema = z.object({
95
+ /** When the run started, as an ISO time. */
96
+ startedAt: z.string(),
97
+ /** From the run's start to its last event. */
98
+ totalMs: z.number(),
99
+ /** The lanes in order: mint, each resource's lane, runner, tests, cleanup; each only when the run got that far. */
100
+ rows: z.array(z.object({
101
+ name: z.enum(ROW_NAMES),
102
+ startMs: z.number(),
103
+ endMs: z.number(),
104
+ outcome: timelineOutcomeSchema,
105
+ /** The lane's steps: a resource lane's, such as the Testserver side's lease and create, and the runner's snapshot, start, upload, apply, install and build. */
106
+ steps: z.array(z.object({
107
+ name: z.enum(STEP_NAMES),
108
+ startMs: z.number(),
109
+ endMs: z.number(),
110
+ outcome: timelineOutcomeSchema,
111
+ })),
112
+ /** How long the lane, once ready, waited for the other before the command started. */
113
+ idleMs: z.number(),
114
+ /** The runner lane's: whether it reused or built its runner snapshot. */
115
+ snapshot: z.enum(["reused", "built"]).optional(),
116
+ /** A resource lane's that counts them, such as the Testserver lane's: how many it reused and created. */
117
+ sandboxes: z.object({ reused: z.number(), created: z.number() }).optional(),
118
+ })),
119
+ /** The lanes the command waited on, then the command; empty when the command didn't start. */
120
+ criticalPath: z.array(z.enum(ROW_NAMES)),
121
+ });
122
+ /** What a `ran` outcome says of a run whose command ran and ended. No field carries the credential. */
123
+ export const ranSchema = z.object({
124
+ /** storm's version. */
125
+ version: z.string(),
126
+ /** 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. */
127
+ commit: z.string().nullable(),
128
+ /** The config file the run's settings came from (its absolute path); null when none applied. */
129
+ configFile: z.string().nullable(),
130
+ /** What each acquired resource that reports something says of itself, keyed by resource name, such as the Testserver pool's sandboxes and build. */
131
+ resources: RESOURCE_REPORTS.ranSchema,
132
+ /** What the run's cleanup left: in a runner run, the runner sandbox it kept running and the runner's sandboxes it couldn't stop or delete (`runner`, null otherwise), and what releasing each resource it held couldn't do, keyed by resource name (`resources`, `{}` when it held none). */
133
+ cleanup: RUN_CLEANUP.schema,
134
+ /** How the command ended: its exit code, or the signal that ended it; both null for a remote command that ended without an exit code. */
135
+ command: z.object({ exitCode: z.number().nullable(), signal: z.string().nullable() }),
136
+ /** In a runner run, the runner sandbox the command ran in; null otherwise. */
137
+ runner: z
138
+ .object({
139
+ /** The runner snapshot it started from. */
140
+ snapshotId: z.string(),
141
+ /** The runner snapshot's base, a full SHA. */
142
+ base: z.string(),
143
+ /** Whether this run built the runner snapshot. */
144
+ built: z.boolean(),
145
+ vcpus: z.number(),
146
+ region: z.string(),
147
+ runtime: z.string(),
148
+ })
149
+ .nullable(),
150
+ /** The run's waterfall, as the run directory's timeline.json holds it: each lane's span and steps in milliseconds since the run started, how they ended, idle time, and the critical path. */
151
+ timeline: timelineSchema,
152
+ /** The run's run directory's run id, which `storm runs show` takes; null when the run couldn't make one. */
153
+ runId: z.string().nullable(),
154
+ });
155
+ /** What a `ran` outcome is, for its description. */
156
+ export const 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.";
157
+ /** How a `ran` outcome renders: its warnings, and the runner sandbox the run kept running, if any. */
158
+ export function renderRan(ran) {
159
+ const warnings = [
160
+ ...RESOURCE_REPORTS.ranWarnings(ran.resources),
161
+ ...(ran.runner !== null && ran.command.exitCode === null && ran.command.signal === null
162
+ ? [
163
+ {
164
+ reason: "remote_no_exit_code",
165
+ message: "The command ended in the runner sandbox without an exit code, so storm exits 1.",
166
+ },
167
+ ]
168
+ : []),
169
+ ...runnerCleanupWarnings(ran.cleanup.runner),
170
+ ...RESOURCE_REPORTS.cleanupWarnings(ran.cleanup.resources),
171
+ ];
172
+ // The waterfall, which the run prints on stderr before this, is the human summary; the kept runner sandbox
173
+ // follows it, so a person sees where to connect last.
174
+ const kept = ran.cleanup.runner?.kept ?? null;
175
+ return renderOutcome({
176
+ ...(kept === null ? {} : { message: keptText(kept) }),
177
+ ...(warnings.length === 0 ? {} : { warnings }),
178
+ });
179
+ }
180
+ /** The errors only a run ends with, beside the config's, the credential's, the resources' and the mint's. */
181
+ export const runErrors = defineErrors({
182
+ credentialUnused: {
183
+ exitCode: 2,
184
+ description: "--credential was given to a run that holds no resource that takes a credential.",
185
+ schema: z.object({
186
+ /** The flags given that no held resource takes, as typed, such as --credential. */
187
+ flags: z.array(z.string()),
188
+ /** The config file that applied; null when none did. */
189
+ configFile: z.string().nullable(),
190
+ }),
191
+ render: ({ flags }) => ({
192
+ message: `${flags.join(", ")} ${flags.length === 1 ? "applies" : "apply"} only to a run holding a resource that takes a credential, and this run holds none.`,
193
+ next: [
194
+ {
195
+ type: "text",
196
+ text: `Drop ${flags.join(" and ")}, or give the run a resource that takes a credential, in storm.config.ts or on the command line.`,
197
+ },
198
+ ],
199
+ }),
200
+ },
201
+ missingRunner: {
202
+ exitCode: 2,
203
+ description: "A runner run (no --local) needs a runner recipe, and no storm.config.ts gives a runner key.",
204
+ schema: z.object({
205
+ /** The config file that applied; null when none did. */
206
+ configFile: z.string().nullable(),
207
+ }),
208
+ render: ({ configFile }) => ({
209
+ message: configFile === null
210
+ ? "A runner run needs a runner recipe, and no storm.config.ts applies."
211
+ : `A runner run needs a runner recipe, and ${configFile} has no runner key.`,
212
+ next: [
213
+ {
214
+ type: "text",
215
+ text: "Add a runner recipe under the runner key of storm.config.ts, or run on this machine with --local.",
216
+ },
217
+ ],
218
+ }),
219
+ },
220
+ noBaseRef: {
221
+ exitCode: 1,
222
+ description: "In a runner run, none of the runner recipe's baseRefs exists locally and shares history with HEAD, so there is no base. storm never fetches.",
223
+ schema: z.object({
224
+ /** Each ref in baseRefs, and why it gave no base. */
225
+ refs: z.array(z.object({ ref: z.string(), reason: z.enum(["missing", "unrelated"]) })),
226
+ }),
227
+ render: ({ refs }) => ({
228
+ 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.`,
229
+ rows: [
230
+ [
231
+ "Base refs",
232
+ refs.map(({ ref, reason }) => reason === "missing" ? `${ref}: no such local ref` : `${ref}: shares no history with HEAD`),
233
+ ],
234
+ ],
235
+ next: [
236
+ {
237
+ type: "text",
238
+ text: refs.some(({ ref }) => ref === "main" || ref === "origin/main")
239
+ ? "Run git fetch origin main, then retry."
240
+ : `Fetch or create one of ${refs.map(({ ref }) => ref).join(", ")}, then retry.`,
241
+ },
242
+ ],
243
+ }),
244
+ },
245
+ submodulesRefused: {
246
+ exitCode: 1,
247
+ description: "In a runner run, the checkout has Git submodules, which neither the upload nor the base's files carry.",
248
+ schema: z.object({ paths: z.array(z.string()) }),
249
+ render: ({ paths }) => ({
250
+ message: `The checkout has Git submodules, which the runner can't carry: ${paths.join(", ")}. The command didn't run.`,
251
+ next: [{ type: "text", text: "Run on this machine with --local." }],
252
+ }),
253
+ },
254
+ snapshotGone: {
255
+ exitCode: 1,
256
+ description: "In a runner 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.",
257
+ schema: z.object({
258
+ snapshotId: z.string(),
259
+ /** The runner snapshot's base, a full SHA. */
260
+ base: z.string(),
261
+ /** Why its cache entry couldn't be removed; null when it was. */
262
+ removal: z.object({ path: z.string(), message: z.string() }).nullable(),
263
+ /** What the run couldn't clean up. */
264
+ cleanup: RUN_CLEANUP.schema,
265
+ }),
266
+ render: ({ snapshotId, removal, cleanup }) => {
267
+ const rows = RUN_CLEANUP.rows(cleanup);
268
+ return {
269
+ 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.`,
270
+ ...(rows.length === 0 ? {} : { rows }),
271
+ next: [
272
+ {
273
+ type: "text",
274
+ text: removal === null
275
+ ? "Run again: the next run picks another runner snapshot or builds one."
276
+ : `Remove ${removal.path}, then run again.`,
277
+ },
278
+ ],
279
+ };
280
+ },
281
+ },
282
+ runnerFailed: {
283
+ exitCode: 1,
284
+ description: "In a runner 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.",
285
+ schema: z.object({
286
+ failure: runnerFailureSchema,
287
+ /** What the run couldn't clean up; its `runner` is null when the run failed before it started a sandbox. */
288
+ cleanup: RUN_CLEANUP.schema,
289
+ }),
290
+ render: ({ failure, cleanup }) => {
291
+ const { message, next } = runnerFailureText(failure);
292
+ const rows = [
293
+ ...("tail" in failure && failure.tail.length > 0 ? [["Last output", failure.tail]] : []),
294
+ ...(failure.kind === "checkout-failed" && failure.command !== null
295
+ ? [["Command", failure.command]]
296
+ : []),
297
+ ...RUN_CLEANUP.rows(cleanup),
298
+ ];
299
+ return { message, ...(rows.length === 0 ? {} : { rows }), next: [{ type: "text", text: next }] };
300
+ },
301
+ },
302
+ spawnFailed: {
303
+ exitCode: 1,
304
+ description: "The command couldn't start.",
305
+ schema: z.object({
306
+ /** The command's first argument: what storm tried to run. */
307
+ executable: z.string(),
308
+ /** What the OS said. */
309
+ message: z.string(),
310
+ /** What the run couldn't clean up; its `runner` is null, since only a local run spawns its command here. */
311
+ cleanup: RUN_CLEANUP.schema,
312
+ }),
313
+ render: ({ executable, message, cleanup }) => {
314
+ const rows = RUN_CLEANUP.rows(cleanup);
315
+ return {
316
+ message: `Couldn't start the command ${executable}: ${message}`,
317
+ ...(rows.length === 0 ? {} : { rows }),
318
+ next: [
319
+ { type: "text", text: "Check the command after --; it runs with no shell, as the argument list given." },
320
+ ],
321
+ };
322
+ },
323
+ },
324
+ });
325
+ /** Every error a run ends with, in order: the config's, the credential's, each resource's, the mint's, the run's. */
326
+ export const RUN_ERRORS = {
327
+ ...configErrors,
328
+ ...credentialErrors,
329
+ // Every resource's errors, in provider order.
330
+ ...RESOURCE_ERRORS,
331
+ ...mintFailedErrors,
332
+ ...runErrors,
333
+ };
334
+ /** How `exec` ends. No outcome carries the credential. */
335
+ export const outcomes = defineOutcomes({
336
+ results: { ran: { schema: ranSchema, description: RAN_DESCRIPTION, render: renderRan } },
337
+ errors: RUN_ERRORS,
338
+ });
@@ -0,0 +1,44 @@
1
+ import { type RanCommand } from "../../core/index.ts";
2
+ import { type StormRunLane, type StormRunObserver, type StormTimedRunEvent } from "../../resources.ts";
3
+ import type { RunnerSnapshotCacheFailure, SnapshotCacheNote } from "../../runner/index.ts";
4
+ /** The lane a plain progress line names after its elapsed time: what part of the run it is about. */
5
+ export type ProgressLane = "run" | "mint" | StormRunLane | "command" | "cleanup";
6
+ /**
7
+ * How plain progress shows: as plain lines, or for GitHub Actions with each step's output in a fold; and whether the
8
+ * run is verbose, which shows the control plane's progress messages for each create.
9
+ */
10
+ export interface LineProgressOptions {
11
+ readonly github: boolean;
12
+ readonly verbose?: boolean;
13
+ }
14
+ /**
15
+ * A run's progress as plain lines through `write`, one call per line. Each of storm's own lines starts with the
16
+ * time since the run started and its lane: `[+4.2s] testserver leased 2 of 2 …`. Lanes that run at once say so: the
17
+ * run says when the resources' lanes and the runner start together, and each says when it is ready and how long it
18
+ * waits for the others. A runner run without a resource lane readies the runner alone. A resource's own events print
19
+ * as its presentation says (`RESOURCE_PRESENTATIONS`), the Testserver pool's create progress messages only when the
20
+ * run is `verbose`. A step's output (a snapshot build's, applying the changes, the install, the build) streams in
21
+ * full, unprefixed, between its start and end lines; under GitHub Actions (`github`) it is folded in a
22
+ * `::group::`, closed before a failed step's end line, so the failure shows outside the fold. The command's output
23
+ * isn't progress: it reaches the terminal directly, unfolded, between the command's start and end lines.
24
+ *
25
+ * Once a write fails, as one does with EIO after SIGHUP closes the terminal, later lines are dropped and `observe`
26
+ * still resolves: a progress line must never keep a run from stopping and deleting its sandboxes and releasing its
27
+ * resources.
28
+ */
29
+ export declare function lineProgress(write: (line: string) => Promise<void>, options?: LineProgressOptions): StormRunObserver;
30
+ /** A renderer that turns each timed event into its plain lines, remembering what it needs across events. */
31
+ export declare function plainRenderer(options: LineProgressOptions): (timed: StormTimedRunEvent) => readonly string[];
32
+ /** A plain progress line: `[+4.2s] testserver <text>`, `elapsedMs` since the run started, in lane `lane`. */
33
+ export declare function progressLine(elapsedMs: number, lane: ProgressLane, text: string): string;
34
+ /** The widest lane a plain line names: `command`, `cleanup`, or a resource's lane, such as `testserver`. */
35
+ export declare const LANE_WIDTH: number;
36
+ /** How a command ended, as its end line and the live view say. */
37
+ export declare function commandEnd(outcome: RanCommand): string;
38
+ /** In a runner run, what the local checks noticed: nested Git repositories left out, and the cache read's notes. */
39
+ export declare function preparedNoteTexts(prepared: {
40
+ readonly nestedRepositories: readonly string[];
41
+ readonly notes: readonly SnapshotCacheNote[];
42
+ }): string[];
43
+ /** The runner snapshot cache couldn't record a runner snapshot the run built. */
44
+ export declare function cacheWriteFailureText(failure: RunnerSnapshotCacheFailure): string;
@@ -0,0 +1,277 @@
1
+ import { megabytesText, secondsOf, secondsText } from "../../core/index.js";
2
+ import { RESOURCE_PRESENTATIONS, RESOURCE_REPORTS, } from "../../resources.js";
3
+ import { versionText } from "../../version.js";
4
+ import { isoSecondsText, keepTimeText, seconds, short } from "./text.js";
5
+ /**
6
+ * A run's progress as plain lines through `write`, one call per line. Each of storm's own lines starts with the
7
+ * time since the run started and its lane: `[+4.2s] testserver leased 2 of 2 …`. Lanes that run at once say so: the
8
+ * run says when the resources' lanes and the runner start together, and each says when it is ready and how long it
9
+ * waits for the others. A runner run without a resource lane readies the runner alone. A resource's own events print
10
+ * as its presentation says (`RESOURCE_PRESENTATIONS`), the Testserver pool's create progress messages only when the
11
+ * run is `verbose`. A step's output (a snapshot build's, applying the changes, the install, the build) streams in
12
+ * full, unprefixed, between its start and end lines; under GitHub Actions (`github`) it is folded in a
13
+ * `::group::`, closed before a failed step's end line, so the failure shows outside the fold. The command's output
14
+ * isn't progress: it reaches the terminal directly, unfolded, between the command's start and end lines.
15
+ *
16
+ * Once a write fails, as one does with EIO after SIGHUP closes the terminal, later lines are dropped and `observe`
17
+ * still resolves: a progress line must never keep a run from stopping and deleting its sandboxes and releasing its
18
+ * resources.
19
+ */
20
+ export function lineProgress(write, options = { github: false }) {
21
+ let failed = false;
22
+ const render = plainRenderer(options);
23
+ return {
24
+ observe: async (timed) => {
25
+ for (const line of render(timed)) {
26
+ if (failed)
27
+ return;
28
+ try {
29
+ await write(line);
30
+ }
31
+ catch {
32
+ failed = true;
33
+ }
34
+ }
35
+ },
36
+ };
37
+ }
38
+ /** A renderer that turns each timed event into its plain lines, remembering what it needs across events. */
39
+ export function plainRenderer(options) {
40
+ const state = {
41
+ origin: undefined,
42
+ resourceLanes: RESOURCE_PRESENTATIONS.lanes.map(({ lane }) => lane),
43
+ heldResources: [],
44
+ mintStartedAt: undefined,
45
+ lanesStartedAt: undefined,
46
+ readyAt: {},
47
+ cleanupStartedAt: undefined,
48
+ folded: false,
49
+ };
50
+ const resources = RESOURCE_PRESENTATIONS.plain({ verbose: options.verbose === true });
51
+ return ({ event, at }) => {
52
+ const now = at.getTime();
53
+ state.origin ??= now;
54
+ const origin = state.origin;
55
+ const line = (lane, text) => progressLine(now - origin, lane, text);
56
+ if (event.kind === "resource")
57
+ return resources(event, now).map(({ lane, text }) => line(lane, text));
58
+ return eventLines(event, now, state, line, options);
59
+ };
60
+ }
61
+ /** A plain progress line: `[+4.2s] testserver <text>`, `elapsedMs` since the run started, in lane `lane`. */
62
+ export function progressLine(elapsedMs, lane, text) {
63
+ return `[+${secondsText(secondsOf(elapsedMs))}] ${lane.padEnd(LANE_WIDTH)} ${text}`;
64
+ }
65
+ /** The widest lane a plain line names: `command`, `cleanup`, or a resource's lane, such as `testserver`. */
66
+ export const LANE_WIDTH = Math.max(...["run", "mint", "runner", "command", "cleanup", ...RESOURCE_PRESENTATIONS.lanes.map(({ lane }) => lane)].map((lane) => lane.length));
67
+ function eventLines(event, now, state, line, options) {
68
+ const since = (start) => seconds(now - (start ?? now));
69
+ switch (event.kind) {
70
+ case "started":
71
+ state.resourceLanes = event.lanes;
72
+ state.heldResources = event.resources;
73
+ return [
74
+ line("run", `storm ${versionText(event.version, event.commit)}`),
75
+ ...(event.configFile === null ? [] : [line("run", `config ${event.configFile}`)]),
76
+ ];
77
+ case "minting":
78
+ state.mintStartedAt = now;
79
+ return [line("mint", `credential for ${targetText(event.target)}…`)];
80
+ case "minted":
81
+ return [
82
+ line("mint", `${event.ok ? "credential" : "no credential"} for ${targetText(event.target)} (${since(state.mintStartedAt)})`),
83
+ ];
84
+ case "requesting-token":
85
+ return [line("mint", "requesting a GitHub Actions OIDC token…")];
86
+ case "lanes-started":
87
+ state.lanesStartedAt = now;
88
+ // Without a resource lane the runner's own lines say it started.
89
+ return state.resourceLanes.length === 0
90
+ ? []
91
+ : [line("run", `${[...state.resourceLanes, "runner"].join(" ‖ ")} start together`)];
92
+ case "lane-ended": {
93
+ // A lane runs from the lanes' start in a runner run; locally a resource lane runs from the run's start.
94
+ const ran = since(state.lanesStartedAt ?? state.origin);
95
+ if (event.outcome !== "ready")
96
+ return [line(event.lane, `${event.outcome} (${ran})`)];
97
+ // Locally the resource's own lines say its lane is ready.
98
+ if (state.lanesStartedAt === undefined)
99
+ return [];
100
+ state.readyAt[event.lane] = now;
101
+ const ready = `ready (${ran})`;
102
+ if (state.resourceLanes.length === 0)
103
+ return [line(event.lane, ready)];
104
+ // A resource lane waits for the runner; the runner, for the resource lanes.
105
+ const others = event.lane === "runner" ? state.resourceLanes : ["runner"];
106
+ const waiting = others.filter((other) => state.readyAt[other] === undefined);
107
+ if (waiting.length > 0)
108
+ return [line(event.lane, `${ready}; waiting for ${waiting.join(", ")}`)];
109
+ const waited = others.map((other) => `${other} waited ${seconds(now - (state.readyAt[other] ?? now))}`);
110
+ return [line(event.lane, `${ready}; ${waited.join(", ")}`)];
111
+ }
112
+ // A resource lane's start shows in its first line of its own.
113
+ case "lane-started":
114
+ return [];
115
+ case "command-started":
116
+ return [line("command", `running ${event.argv.join(" ")}`)];
117
+ case "command-ended":
118
+ return [line("command", `${event.command} ${commandEnd(event.outcome)} after ${seconds(event.ms)}`)];
119
+ case "cleanup-started":
120
+ state.cleanupStartedAt = now;
121
+ return [
122
+ line("cleanup", cleanupText(event.runner, event.keepSandboxMs, RESOURCE_PRESENTATIONS.releaseTexts(event.holdings, "doing"))),
123
+ ];
124
+ case "cleanup-finished": {
125
+ const problems = [
126
+ ...(event.notStopped === 0 ? [] : [`${event.notStopped} not stopped`]),
127
+ ...(event.notDeleted === 0 ? [] : [`${event.notDeleted} not deleted`]),
128
+ ...RESOURCE_REPORTS.failuresTexts(event.resourceFailures),
129
+ ];
130
+ return [
131
+ line("cleanup", `${problems.length === 0 ? "done" : `done: ${problems.join(", ")}`} (${since(state.cleanupStartedAt)})`),
132
+ ];
133
+ }
134
+ case "runner-prepared":
135
+ return [
136
+ line("runner", `base ${short(event.base)}, HEAD's merge-base with ${event.baseRef}`),
137
+ ...preparedNoteTexts(event).map((text) => line("runner", text)),
138
+ ];
139
+ // The command's own output carries its tests' results; the summary counts them.
140
+ // The summary says when the test results may be incomplete.
141
+ case "test":
142
+ case "test-event-unreadable":
143
+ case "test-events-incomplete":
144
+ return [];
145
+ case "runner":
146
+ return runnerLines(event.event, state, line, options);
147
+ }
148
+ }
149
+ /** A runner event's lines. */
150
+ function runnerLines(event, state, line, options) {
151
+ switch (event.kind) {
152
+ case "snapshot-reused":
153
+ return [line("runner", `reusing runner snapshot ${event.snapshotId} of base ${short(event.base)}`)];
154
+ case "snapshot-build-started":
155
+ return [
156
+ line("runner", `building a runner snapshot of base ${short(event.base)} (${event.reason === "rebuild" ? "--rebuild-snapshot" : "no cached runner snapshot fits"}); this takes a few minutes: ${event.summary}`),
157
+ ];
158
+ case "runner-sandbox-starting":
159
+ return [];
160
+ case "sandbox-started":
161
+ return [
162
+ line("runner", `started the ${event.role === "runner" ? "runner" : "build"} sandbox ${event.name} in ${event.region}, ${event.vcpus} vCPUs (${seconds(event.ms)})`),
163
+ ];
164
+ case "output-started":
165
+ return [];
166
+ case "output-ended":
167
+ return event.outcome === "finished"
168
+ ? []
169
+ : [...closeFold(state), line("runner", `${event.section} ${event.outcome}`)];
170
+ case "step-started": {
171
+ const text = `${event.phase}: ${event.label}`;
172
+ if (!options.github)
173
+ return [line("runner", text)];
174
+ state.folded = true;
175
+ return [`::group::${line("runner", text)}`];
176
+ }
177
+ case "step-output":
178
+ return [event.line];
179
+ case "step-finished":
180
+ return [...closeFold(state), line("runner", `${event.phase}: ${event.label}, done in ${seconds(event.ms)}`)];
181
+ case "snapshot-saving":
182
+ return [line("runner", "saving the build sandbox as a runner snapshot…")];
183
+ case "snapshot-built":
184
+ return [
185
+ line("runner", `built runner snapshot ${event.snapshotId} of base ${short(event.base)} in ${seconds(event.ms)} (${megabytesText(event.sizeBytes)})`),
186
+ ];
187
+ case "snapshot-entry-not-written":
188
+ return [line("runner", cacheWriteFailureText(event.failure))];
189
+ case "uploading":
190
+ return [];
191
+ case "uploaded":
192
+ return [line("runner", `uploaded your changes, ${megabytesText(event.bytes)} (${seconds(event.ms)})`)];
193
+ case "command-output-started":
194
+ return [line("command", `in the runner sandbox ${event.sandbox} (${event.region})`)];
195
+ case "command-stopped":
196
+ return [line("command", `${event.command} stopped`)];
197
+ case "stopping":
198
+ return [
199
+ line("cleanup", `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)}…`),
200
+ ];
201
+ case "waiting-for-snapshot":
202
+ return [
203
+ line("cleanup", `waiting up to ${Math.round(event.settleMs / 60_000)} minutes for the runner snapshot still saving…`),
204
+ ];
205
+ case "sandbox-kept":
206
+ return [line("cleanup", `kept the runner sandbox ${event.name} running until ${isoSecondsText(event.stopsAt)}`)];
207
+ }
208
+ }
209
+ /** What a stopping run says it releases of the resources it holds, such as ` and releasing the leases`. */
210
+ function releasingText(held) {
211
+ return RESOURCE_PRESENTATIONS.stoppingTexts(held)
212
+ .map((text) => ` and ${text}`)
213
+ .join("");
214
+ }
215
+ /** The line that closes an open step fold, if one is open. */
216
+ function closeFold(state) {
217
+ if (!state.folded)
218
+ return [];
219
+ state.folded = false;
220
+ return ["::endgroup::"];
221
+ }
222
+ /**
223
+ * What cleaning up does, as its first line says: in a runner run, keeping the runner sandbox running `keepMs` when that
224
+ * is above 0, else stopping and deleting the runner's sandboxes; then what releasing each resource does (`releases`).
225
+ */
226
+ function cleanupText(runner, keepMs, releases) {
227
+ const release = releases.length === 0 ? undefined : releases.join(", ");
228
+ if (!runner)
229
+ return release === undefined ? "nothing to release" : `${release}…`;
230
+ const sandboxes = keepMs > 0
231
+ ? `keeping the runner sandbox running ${keepTimeText(keepMs)}`
232
+ : "stopping and deleting the runner's sandboxes";
233
+ return `${sandboxes}${release === undefined ? "" : `, then ${release}`}…`;
234
+ }
235
+ /** How a command ended, as its end line and the live view say. */
236
+ export function commandEnd(outcome) {
237
+ switch (outcome.kind) {
238
+ case "exited":
239
+ return `exited ${outcome.code}`;
240
+ case "signaled":
241
+ return `ended on ${outcome.signal}`;
242
+ case "no-exit-code":
243
+ return "ended without an exit code";
244
+ }
245
+ }
246
+ /** What the runner snapshot cache read noticed, as a line. */
247
+ function noteText(note) {
248
+ switch (note.kind) {
249
+ case "cache-unreadable":
250
+ return `couldn't read the runner snapshot cache at ${note.failure.path}: ${note.failure.message}; treating it as empty`;
251
+ case "expired-entry-not-removed":
252
+ return `couldn't remove the expired cache entry for runner snapshot ${note.entry.snapshotId} at ${note.failure.path}: ${note.failure.message}`;
253
+ case "candidate-steps-failed":
254
+ return `not reusing cached runner snapshots of base ${short(note.base)}: runner.${note.path.join(".")} ${note.problem.replace(/\.$/, "")}`;
255
+ case "candidate-check-failed":
256
+ return `not reusing cached runner snapshots of base ${short(note.base)}: ${note.failure.message.replace(/\.$/, "")}`;
257
+ }
258
+ }
259
+ function targetText(target) {
260
+ return `${target.team}/${target.project}`;
261
+ }
262
+ // The notices: what a run reports that the live view's phases can't hold, so it prints them above the live region
263
+ // as plain lines, and plain progress prints among its other lines. Each builder answers the lines' text, which the
264
+ // caller prefixes with the time and the lane (`progressLine`). A resource's own notices are its presentation's.
265
+ /** In a runner run, what the local checks noticed: nested Git repositories left out, and the cache read's notes. */
266
+ export function preparedNoteTexts(prepared) {
267
+ return [
268
+ ...(prepared.nestedRepositories.length === 0
269
+ ? []
270
+ : [`leaving out untracked nested Git repositories: ${prepared.nestedRepositories.join(", ")}`]),
271
+ ...prepared.notes.map(noteText),
272
+ ];
273
+ }
274
+ /** The runner snapshot cache couldn't record a runner snapshot the run built. */
275
+ export function cacheWriteFailureText(failure) {
276
+ return `couldn't record the runner snapshot in the cache at ${failure.path}: ${failure.message}; later runs won't reuse it`;
277
+ }