@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,321 @@
1
+ import { posix } from "node:path";
2
+ import { credentialSourceFor, mintSource, } from "../credential/index.js";
3
+ import { readyRunner, runnerSandboxScope, REMOTE_TEST_EVENTS_PATH, lineSplitter, runRemote, } from "../runner/index.js";
4
+ import { parseTestEvent } from "../sdk/index.js";
5
+ import { mintReported, mintSourceReported } from "./mint.js";
6
+ import { colorEnvironment, commandEnvironment, runPayload } from "./payload.js";
7
+ import { acquireResources, canceledHolding, heldLanes, heldResources, prepareResources, readyResources, releaseResources, resourceFailures, resourceHoldings, resourceSlots, resourcesFacts, resourcesPayload, } from "./resources.js";
8
+ /**
9
+ * Runs `request.argv` with the resources it asks for, through `providers`, the registry's providers in order. It
10
+ * prepares each resource, acquires them all at once (`acquireResources`), runs the command with the run payload in
11
+ * `STORM_RUN`, waits for it, and releases every resource it held. It reports each step to `progress`. What
12
+ * preparing, acquiring and releasing do is each resource's own: see its provider. A run that asks for no resource goes
13
+ * straight to its command. It hands `context` to every provider as it is.
14
+ *
15
+ * In a runner run (`request.runner`), the command runs in a runner sandbox, readied beside the resources (see
16
+ * `provisionAndRunRemote`).
17
+ *
18
+ * Release happens in `finally`, however the run ended, a throw included: once the command has stopped and, in a
19
+ * runner run, the runner's sandboxes are closed, each resource is released in reverse order, even when the
20
+ * `cleanup-started` event can't be reported.
21
+ */
22
+ export async function executeRun(providers, context, request, control, progress) {
23
+ const slots = resourceSlots(providers, context, request.resources);
24
+ await progress.emit({
25
+ kind: "started",
26
+ version: request.version,
27
+ commit: request.commit,
28
+ configFile: request.configFile,
29
+ lanes: heldLanes(slots),
30
+ resources: heldResources(slots),
31
+ });
32
+ if (request.runner !== undefined) {
33
+ const { prepared } = request.runner;
34
+ await progress.emit({
35
+ kind: "runner-prepared",
36
+ base: prepared.base,
37
+ baseRef: prepared.baseRef,
38
+ nestedRepositories: prepared.upload.nestedRepositories,
39
+ notes: prepared.notes,
40
+ });
41
+ }
42
+ const unprepared = await prepareResources(slots, progress);
43
+ if (unprepared !== undefined)
44
+ return unprepared;
45
+ // Each slot keeps what its resource holds, pushed as it is acquired: the run releases all of it however it ends.
46
+ let cleanupStarted = false;
47
+ // Said once, before the runner's sandboxes are stopped in a runner run, else before the resources are released.
48
+ const startCleanup = async () => {
49
+ if (cleanupStarted)
50
+ return;
51
+ cleanupStarted = true;
52
+ await progress.emit({
53
+ kind: "cleanup-started",
54
+ runner: request.runner !== undefined,
55
+ keepSandboxMs: request.runner?.keepSandboxMs ?? 0,
56
+ holdings: resourceHoldings(slots),
57
+ });
58
+ };
59
+ let ended;
60
+ let runnerCleanup = null;
61
+ let resourceCleanup = {};
62
+ try {
63
+ ({ ended, runnerCleanup } =
64
+ request.runner === undefined
65
+ ? { ended: await provisionAndRun(context, request, slots, control, progress), runnerCleanup: null }
66
+ : await provisionAndRunRemote(context, request, slots, control, progress, startCleanup));
67
+ }
68
+ finally {
69
+ // Reporting cleanup's start can fail; releasing what the run holds must not depend on it.
70
+ try {
71
+ await startCleanup();
72
+ }
73
+ finally {
74
+ resourceCleanup = await releaseResources(slots, progress);
75
+ }
76
+ }
77
+ await progress.emit({
78
+ kind: "cleanup-finished",
79
+ resourceFailures: resourceFailures(slots, resourceCleanup),
80
+ notStopped: runnerCleanup?.notStopped.length ?? 0,
81
+ notDeleted: runnerCleanup?.notDeleted.length ?? 0,
82
+ });
83
+ if (ended.kind !== "command-ended")
84
+ return { ...ended, runnerCleanup, resourceCleanup };
85
+ const { kind: _kind, ...ran } = ended;
86
+ return {
87
+ kind: "ran",
88
+ ...ran,
89
+ runnerCleanup,
90
+ resourceCleanup,
91
+ };
92
+ }
93
+ /**
94
+ * Everything between preparing the resources and releasing them, in a local run: it acquires every resource the run
95
+ * holds (`acquireResources`), each pushing what it holds into its slot, then runs the command once all are acquired.
96
+ * The command's stdout and stderr reach `runnerTerminal` a line at a time per stream, and its environment says whether
97
+ * to color them (`colorEnvironment`), since the command writes to pipes.
98
+ */
99
+ async function provisionAndRun(context, request, slots, control, progress) {
100
+ const acquisition = await acquireResources(slots, {
101
+ credential: request.credential === undefined ? undefined : localSource(context, request.credential, progress),
102
+ signal: control.signal,
103
+ progress,
104
+ });
105
+ if (acquisition.kind === "stopped")
106
+ return acquisition.outcome;
107
+ await readyResources(slots, progress);
108
+ const terminal = context.runnerTerminal;
109
+ const env = commandEnvironment(colorEnvironment(request.env, terminal.color), runPayload(resourcesPayload(slots), {
110
+ ...(request.testEvents === undefined ? {} : { testEvents: request.testEvents }),
111
+ ...(request.verbose === undefined ? {} : { verbose: request.verbose }),
112
+ }));
113
+ await progress.emit({ kind: "command-started", argv: request.argv });
114
+ // A signal during either progress write must still keep the command from starting.
115
+ if (control.signal.aborted)
116
+ return canceledHolding(slots);
117
+ const commandStartedAt = context.clock.now();
118
+ // The command's output reaches the terminal a line at a time per stream, as a runner run's does, the rest once it
119
+ // ends.
120
+ const splitters = { stdout: lineSplitter(), stderr: lineSplitter() };
121
+ const write = (stream, text) => {
122
+ if (text === "")
123
+ return;
124
+ if (stream === "stdout")
125
+ terminal.writeStdout(text);
126
+ else
127
+ terminal.writeStderr(text);
128
+ };
129
+ const command = await context.commands.run({
130
+ argv: request.argv,
131
+ env,
132
+ terminate: control.terminate,
133
+ onOutput: ({ stream, data }) => write(stream, splitters[stream].push(data)),
134
+ });
135
+ const commandEndedAt = context.clock.now();
136
+ write("stdout", splitters.stdout.flush());
137
+ write("stderr", splitters.stderr.flush());
138
+ if (command.kind === "spawn-failed")
139
+ return { kind: "spawn-failed", executable: request.argv[0] ?? "", message: command.message };
140
+ await progress.emit({
141
+ kind: "command-ended",
142
+ command: posix.basename(request.argv[0] ?? ""),
143
+ outcome: command,
144
+ ms: commandEndedAt.getTime() - commandStartedAt.getTime(),
145
+ });
146
+ return { kind: "command-ended", resources: resourcesFacts(slots), command, runner: undefined };
147
+ }
148
+ /**
149
+ * A local run's credential source, which `choice` names: the mint reports its start and end, and a GitHub Actions OIDC
150
+ * token request each request's start. The mint is lazy, so a run mints only when a resource asks for a credential.
151
+ */
152
+ function localSource(context, choice, progress) {
153
+ if (choice.source === "mint")
154
+ return mintSourceReported(context, choice.target, progress);
155
+ return credentialSourceFor(choice, context, {
156
+ onMint: (target) => progress.emit({ kind: "minting", target }),
157
+ onRequest: () => progress.emit({ kind: "requesting-token" }),
158
+ });
159
+ }
160
+ /** How the runner lane ended, by how readying did: stopped when aborted, failed when it failed or its snapshot was gone. */
161
+ function runnerLaneOutcome(outcome) {
162
+ if (outcome.kind === "ready")
163
+ return "ready";
164
+ return outcome.kind === "aborted" ? "stopped" : "failed";
165
+ }
166
+ /** The outcome a runner that couldn't get ready ends the run with; undefined when it is ready or was stopped. */
167
+ function runnerStopped(outcome) {
168
+ if (outcome.kind === "failed")
169
+ return { kind: "runner-failed", failure: outcome.failure };
170
+ if (outcome.kind === "snapshot-gone")
171
+ return { kind: "snapshot-gone", entry: outcome.entry, removal: outcome.removal };
172
+ return undefined;
173
+ }
174
+ /**
175
+ * In a runner run, everything between preparing the resources and releasing them, and the one owner of the runner's
176
+ * sandbox scope. It opens the scope before the mint, runs `mintAndRunRemote` in it, and closes it before it returns,
177
+ * so the runner's sandboxes are stopped and deleted before the resources are released, and every outcome carries the
178
+ * close's report. The first signal says at once that the run is stopping, then starts closing the scope, so its waits
179
+ * for a create in flight and a snapshot still saving run while readying winds down; the close the run awaits later
180
+ * gets that close's report, or its error. A runner run always mints, whatever resources it holds, so its request names
181
+ * no credential source: the command layer refuses `--credential github-actions` with it.
182
+ */
183
+ async function provisionAndRunRemote(context, request, slots, control, progress, startCleanup) {
184
+ const runnerProgress = { emit: (event) => progress.emit({ kind: "runner", event }) };
185
+ const keepMs = request.runner.keepSandboxMs;
186
+ const scope = runnerSandboxScope(context, runnerProgress, { keepMs });
187
+ let commandRunning = false;
188
+ // Said before the close starts, so the stopping line comes before any line the close's waits print.
189
+ const stop = () => {
190
+ void progress.emit({ kind: "runner", event: { kind: "stopping", commandRunning, keepMs } }).catch(() => undefined);
191
+ void scope.close().catch(() => undefined);
192
+ };
193
+ if (control.signal.aborted)
194
+ stop();
195
+ else
196
+ control.signal.addEventListener("abort", stop, { once: true });
197
+ try {
198
+ const ended = await mintAndRunRemote(context, request, slots, {
199
+ ...control,
200
+ scope,
201
+ commandStarted: () => {
202
+ commandRunning = true;
203
+ },
204
+ }, progress, runnerProgress);
205
+ await startCleanup();
206
+ const runnerCleanup = { ...(await scope.close()), target: request.runner.target };
207
+ return { ended, runnerCleanup };
208
+ }
209
+ finally {
210
+ control.signal.removeEventListener("abort", stop);
211
+ // Memoized: a no-op once the run closed it, and the cleanup when the run threw.
212
+ await scope.close();
213
+ }
214
+ }
215
+ /**
216
+ * The body of `provisionAndRunRemote`, in its sandbox scope. It mints first, whatever the resources hold, since the
217
+ * runner sandbox needs the run's credential; resources that create share that one mint, through a mint source that
218
+ * hands out its outcome. Then it acquires the resources and readies the runner sandbox at once (`readyBoth`), and runs
219
+ * the command in the runner sandbox once all are ready, calling `commandStarted` as it starts. Each resource pushes
220
+ * what it holds into its slot.
221
+ */
222
+ async function mintAndRunRemote(context, request, slots, control, progress, runnerProgress) {
223
+ const { runner } = request;
224
+ // Canceled before a command started in the runner sandbox, holding what the slots say.
225
+ const canceled = () => ({ ...canceledHolding(slots), commandStopped: false });
226
+ if (control.signal.aborted)
227
+ return canceled();
228
+ const minted = await mintReported(context, runner.target, progress);
229
+ if (!minted.ok)
230
+ return { kind: "mint-failed", failure: minted.failure, target: runner.target, runner: true };
231
+ const project = minted.credential.vercelProject();
232
+ if (project === undefined)
233
+ return { kind: "runner-failed", failure: { kind: "credential-claims-missing", target: runner.target } };
234
+ if (control.signal.aborted)
235
+ return canceled();
236
+ const acquisition = await readyBoth(context, {
237
+ request,
238
+ slots,
239
+ credential: mintSource(runner.target, async () => minted),
240
+ access: { credential: minted.credential, ...project },
241
+ }, control, progress, runnerProgress);
242
+ if (acquisition.kind === "stopped") {
243
+ const { outcome } = acquisition;
244
+ return outcome.kind === "canceled" ? { ...outcome, commandStopped: false } : outcome;
245
+ }
246
+ const { beside: readied } = acquisition;
247
+ // No resource refused and no signal arrived, so the runner wasn't stopped.
248
+ if (readied?.kind !== "ready")
249
+ return canceled();
250
+ const ready = readied.runner;
251
+ await readyResources(slots, progress);
252
+ await progress.emit({ kind: "command-started", argv: request.argv });
253
+ if (control.signal.aborted)
254
+ return canceled();
255
+ control.commandStarted();
256
+ // Test events arrive from a callback that can't wait, so they are emitted in order through a chain.
257
+ let testEvents = Promise.resolve();
258
+ const remote = await runRemote(context, {
259
+ runner: ready,
260
+ argv: request.argv,
261
+ runPayload: JSON.stringify(runPayload(resourcesPayload(slots), {
262
+ testEvents: REMOTE_TEST_EVENTS_PATH,
263
+ ...(request.verbose === undefined ? {} : { verbose: request.verbose }),
264
+ })),
265
+ testEvents: {
266
+ onLine: (line) => {
267
+ const event = parseTestEvent(line);
268
+ testEvents = testEvents.then(() => progress.emit(event === undefined ? { kind: "test-event-unreadable" } : { kind: "test", event }));
269
+ },
270
+ onIncomplete: (message) => {
271
+ testEvents = testEvents.then(() => progress.emit({ kind: "test-events-incomplete", message }));
272
+ },
273
+ },
274
+ }, { kill: control.signal }, runnerProgress);
275
+ await testEvents;
276
+ // Closing on a signal can stop the runner sandbox under the command, so a failed call then is the stop too.
277
+ if (remote.kind === "killed" || (remote.kind === "failed" && control.signal.aborted))
278
+ return { ...canceledHolding(slots), commandStopped: true };
279
+ if (remote.kind === "failed")
280
+ return { kind: "runner-failed", failure: remote.failure };
281
+ const command = remote.exitCode === null ? { kind: "no-exit-code" } : { kind: "exited", code: remote.exitCode };
282
+ await progress.emit({
283
+ kind: "command-ended",
284
+ command: posix.basename(request.argv[0] ?? ""),
285
+ outcome: command,
286
+ ms: remote.ms,
287
+ });
288
+ return {
289
+ kind: "command-ended",
290
+ resources: resourcesFacts(slots),
291
+ command,
292
+ runner: {
293
+ snapshotId: ready.snapshotId,
294
+ base: ready.base,
295
+ built: ready.built,
296
+ vcpus: ready.vcpus,
297
+ region: ready.region,
298
+ runtime: ready.runtime,
299
+ },
300
+ };
301
+ }
302
+ /**
303
+ * Acquires the resources and readies the runner sandbox at once, through `acquireResources` with the runner lane
304
+ * beside the resources: a resource's refusal or throw stops readying the runner, and the runner's failure stops
305
+ * acquiring the resources. Without any resource, the runner lane runs alone.
306
+ */
307
+ async function readyBoth(context, request, control, progress, runnerProgress) {
308
+ const { runner } = request.request;
309
+ await progress.emit({ kind: "lanes-started" });
310
+ return await acquireResources(request.slots, {
311
+ credential: request.credential,
312
+ signal: control.signal,
313
+ progress,
314
+ beside: {
315
+ lane: "runner",
316
+ start: (signal) => readyRunner(context, { prepared: runner.prepared, access: request.access, user: runner.user }, { scope: control.scope, signal }, runnerProgress),
317
+ outcomeOf: runnerLaneOutcome,
318
+ stopped: runnerStopped,
319
+ },
320
+ });
321
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * How `resolveStateDirectory` names a location when it can't resolve it, such as
3
+ * `${XDG_STATE_HOME:-~/.local/state}/storm/runs`.
4
+ */
5
+ export declare function stateDirectoryPattern(subpath: readonly string[]): string;
6
+ /**
7
+ * Where one kind of state storm keeps lives: `subpath` under `$XDG_STATE_HOME/storm` when
8
+ * `XDG_STATE_HOME` is absolute, else under `$HOME/.local/state/storm`, which needs an absolute `HOME`. Each
9
+ * kind gets its own subdirectory: the run directories `["runs"]`, the runner snapshot cache `["runner", "snapshots"]`. A
10
+ * relative `XDG_STATE_HOME` is ignored, as the XDG spec says. Without either, the directory can't be found, and
11
+ * `reason` says why.
12
+ */
13
+ export declare function resolveStateDirectory(env: Readonly<Record<string, string | undefined>>, subpath: readonly string[]): {
14
+ readonly ok: true;
15
+ readonly directory: string;
16
+ } | {
17
+ readonly ok: false;
18
+ readonly reason: string;
19
+ };
@@ -0,0 +1,29 @@
1
+ // Where storm keeps its state: one directory under XDG's state home, with a subdirectory for each kind of state,
2
+ // such as the run directories (`runs`), the runner snapshot cache (`runner/snapshots`) and a resource's own. It names
3
+ // no resource; each kind names its own subpath.
4
+ import { isAbsolute, join } from "node:path";
5
+ /**
6
+ * How `resolveStateDirectory` names a location when it can't resolve it, such as
7
+ * `${XDG_STATE_HOME:-~/.local/state}/storm/runs`.
8
+ */
9
+ export function stateDirectoryPattern(subpath) {
10
+ return ["${XDG_STATE_HOME:-~/.local/state}/storm", ...subpath].join("/");
11
+ }
12
+ /**
13
+ * Where one kind of state storm keeps lives: `subpath` under `$XDG_STATE_HOME/storm` when
14
+ * `XDG_STATE_HOME` is absolute, else under `$HOME/.local/state/storm`, which needs an absolute `HOME`. Each
15
+ * kind gets its own subdirectory: the run directories `["runs"]`, the runner snapshot cache `["runner", "snapshots"]`. A
16
+ * relative `XDG_STATE_HOME` is ignored, as the XDG spec says. Without either, the directory can't be found, and
17
+ * `reason` says why.
18
+ */
19
+ export function resolveStateDirectory(env, subpath) {
20
+ const state = env["XDG_STATE_HOME"];
21
+ if (state !== undefined && state !== "" && isAbsolute(state))
22
+ return { ok: true, directory: join(state, "storm", ...subpath) };
23
+ const home = env["HOME"];
24
+ if (home === undefined || home === "")
25
+ return { ok: false, reason: "HOME isn't set, and XDG_STATE_HOME isn't an absolute path" };
26
+ if (!isAbsolute(home))
27
+ return { ok: false, reason: `HOME isn't an absolute path (${home}), and XDG_STATE_HOME isn't either` };
28
+ return { ok: true, directory: join(home, ".local", "state", "storm", ...subpath) };
29
+ }
@@ -0,0 +1,63 @@
1
+ import type { ResourceLanes } from "./lane.ts";
2
+ import type { KindAt, RunLane } from "./resource.ts";
3
+ import type { RunnerStepName, RunState } from "./run-state.ts";
4
+ /** A stretch of a run, in milliseconds since it started. */
5
+ export interface TimelineSpan {
6
+ readonly startMs: number;
7
+ readonly endMs: number;
8
+ }
9
+ /** How a lane or step ended: done, failed, stopped by a signal, or still going when the run ended. */
10
+ export type TimelineOutcome = "done" | "failed" | "stopped" | "unfinished";
11
+ /** A step of a lane: a runner step, or a step of a resource's lane. */
12
+ export type TimelineStepName<K> = RunnerStepName | KindAt<K, keyof K>["laneStep"];
13
+ /** One step of a lane: the runner's `start`, `upload`, `install` and so on, or a step of a resource's lane. */
14
+ export interface TimelineStep<K> extends TimelineSpan {
15
+ readonly name: TimelineStepName<K>;
16
+ readonly outcome: TimelineOutcome;
17
+ }
18
+ /**
19
+ * The rows of a waterfall: `mint`, the run's one mint; each resource lane, by its lane's name; `runner`, readying the
20
+ * runner sandbox in a runner run; `tests`, the command; `cleanup`, stopping the runner's sandboxes and releasing the
21
+ * resources.
22
+ */
23
+ export type TimelineRowName<K> = "mint" | RunLane<K> | "tests" | "cleanup";
24
+ /** One row of a waterfall. */
25
+ export interface TimelineRow<K> extends TimelineSpan {
26
+ readonly name: TimelineRowName<K>;
27
+ readonly outcome: TimelineOutcome;
28
+ readonly steps: readonly TimelineStep<K>[];
29
+ /** How long the lane, once ready, waited for the lane ready last before the command started; 0 when it didn't. */
30
+ readonly idleMs: number;
31
+ /** The runner row's: whether it reused or built its runner snapshot; undefined on any other row, or neither. */
32
+ readonly snapshot: "reused" | "built" | undefined;
33
+ /**
34
+ * A resource lane's row's: how many things the lane holds that it reused and created, when its lane counts them;
35
+ * undefined on any other row.
36
+ */
37
+ readonly sandboxes: {
38
+ readonly reused: number;
39
+ readonly created: number;
40
+ } | undefined;
41
+ }
42
+ /** A run's waterfall. */
43
+ export interface Timeline<K> {
44
+ /** When the run started. */
45
+ readonly startedAt: string;
46
+ /** From the run's start to its last event. */
47
+ readonly totalMs: number;
48
+ /**
49
+ * The rows in order: mint, each resource lane in the registry's order, runner, tests, cleanup; each only when the
50
+ * run got that far.
51
+ */
52
+ readonly rows: readonly TimelineRow<K>[];
53
+ /**
54
+ * The lane the command waited on, then the command: `["runner", "tests"]` when the runner was ready last or ran
55
+ * alone; `["tests"]` when the run had no lane; empty when the command didn't start.
56
+ */
57
+ readonly criticalPath: readonly TimelineRowName<K>[];
58
+ }
59
+ /**
60
+ * A run's waterfall, from its final state, with each resource lane's row from `lanes`, the registry's resource lanes.
61
+ * A span still running when the run ended is `unfinished`, ending at the run's last event.
62
+ */
63
+ export declare function timeline<K>(lanes: ResourceLanes<K>, state: RunState<K>): Timeline<K>;
@@ -0,0 +1,97 @@
1
+ // A run's waterfall, projected from its final state: when each lane ran, what it did, how long a ready lane waited
2
+ // for the last one, and the critical path to the command's end. Each resource lane projects its own row's steps and
3
+ // counts (`ResourceLane.row`); the core lays out every row.
4
+ /**
5
+ * A run's waterfall, from its final state, with each resource lane's row from `lanes`, the registry's resource lanes.
6
+ * A span still running when the run ended is `unfinished`, ending at the run's last event.
7
+ */
8
+ export function timeline(lanes, state) {
9
+ const { origin } = state;
10
+ if (origin === undefined)
11
+ return { startedAt: new Date(0).toISOString(), totalMs: 0, rows: [], criticalPath: [] };
12
+ const totalMs = (state.lastAt ?? origin) - origin;
13
+ const span = (from) => ({
14
+ startMs: from.startedAt - origin,
15
+ endMs: from.endedAt === undefined || from.status === "running" ? totalMs : from.endedAt - origin,
16
+ outcome: outcomeOf(from.status),
17
+ });
18
+ const row = (name, from, extra = {}) => ({
19
+ name,
20
+ ...span(from),
21
+ steps: extra.steps ?? [],
22
+ idleMs: 0,
23
+ snapshot: extra.snapshot,
24
+ sandboxes: extra.sandboxes,
25
+ });
26
+ const rows = [];
27
+ const { mint, runner, command, cleanup } = state;
28
+ if (mint !== undefined)
29
+ rows.push(row("mint", mint));
30
+ /** Each resource lane that started, in the registry's order, with its state's span. */
31
+ const started = [];
32
+ for (const lane of lanes) {
33
+ const projected = laneRow(lane, state.resources, span);
34
+ if (projected === undefined)
35
+ continue;
36
+ started.push({ name: projected.name, span: projected.state });
37
+ rows.push(row(projected.name, projected.state, {
38
+ steps: projected.steps,
39
+ sandboxes: projected.sandboxes,
40
+ }));
41
+ }
42
+ // The runner lane is on the waterfall once it started; a reused runner snapshot took no time, so it isn't a step.
43
+ const runnerStarted = runner !== undefined && runner.status !== "pending";
44
+ if (runnerStarted) {
45
+ const steps = runner.steps
46
+ .filter((step) => step.status !== "pending" && !(step.name === "snapshot" && runner.snapshot?.kind === "reused"))
47
+ .flatMap((step) => step.startedAt === undefined
48
+ ? []
49
+ : [{ name: step.name, ...span({ status: step.status, startedAt: step.startedAt, endedAt: step.endedAt }) }])
50
+ .toSorted((a, b) => a.startMs - b.startMs);
51
+ const snapshot = runner.snapshot?.kind === "building" ? undefined : runner.snapshot?.kind;
52
+ rows.push(row("runner", runner, { steps, snapshot }));
53
+ }
54
+ // The lanes that got ready, the runner last, so that it is the one the command waited on when it ties.
55
+ const ready = [...started, ...(runner === undefined ? [] : [{ name: "runner", span: runner }])].flatMap(({ name, span: from }) => from.status === "done" && from.endedAt !== undefined ? [{ name, readyAt: from.endedAt }] : []);
56
+ // With two or more lanes ready, the one ready last is what the command waited on; each other waited for it.
57
+ const last = ready.length < 2 ? undefined : ready.reduce((later, lane) => (lane.readyAt >= later.readyAt ? lane : later));
58
+ if (last !== undefined)
59
+ for (const lane of ready) {
60
+ if (lane === last)
61
+ continue;
62
+ const index = rows.findIndex((candidate) => candidate.name === lane.name);
63
+ const waited = rows[index];
64
+ if (waited !== undefined)
65
+ rows[index] = { ...waited, idleMs: last.readyAt - lane.readyAt };
66
+ }
67
+ if (command !== undefined)
68
+ rows.push(row("tests", command));
69
+ if (cleanup !== undefined)
70
+ rows.push(row("cleanup", cleanup));
71
+ // The lane the command waited on last: the one ready last when it had two or more, else the first resource lane it
72
+ // had, else the runner's, if it had any lane.
73
+ const waitedOn = last?.name ?? started[0]?.name ?? (runnerStarted ? "runner" : undefined);
74
+ return {
75
+ startedAt: new Date(origin).toISOString(),
76
+ totalMs,
77
+ rows,
78
+ criticalPath: command === undefined ? [] : waitedOn === undefined ? ["tests"] : [waitedOn, "tests"],
79
+ };
80
+ }
81
+ /** `lane`'s row, once it started: its name, its state's span, its steps and its counts; undefined before it started. */
82
+ function laneRow(lane, resources, span) {
83
+ const state = resources[lane.resource];
84
+ if (state === undefined)
85
+ return undefined;
86
+ const { steps, sandboxes } = lane.row(state);
87
+ return {
88
+ name: lane.lane,
89
+ state,
90
+ steps: steps.map(({ name, span: from }) => ({ name, ...span(from) })),
91
+ sandboxes,
92
+ };
93
+ }
94
+ /** A span's status as the waterfall says it; one still running when the run ended is unfinished. */
95
+ function outcomeOf(status) {
96
+ return status === "running" || status === "pending" ? "unfinished" : status;
97
+ }
@@ -0,0 +1,22 @@
1
+ import type { CommandOutcome } from "./gateways.ts";
2
+ /**
3
+ * How a command that ran ended: as a local command ends, or, for a remote command, without an exit code
4
+ * (`no-exit-code`), which a run exits 1 for.
5
+ */
6
+ export type RanCommand = Exclude<CommandOutcome, {
7
+ readonly kind: "spawn-failed";
8
+ }> | {
9
+ readonly kind: "no-exit-code";
10
+ };
11
+ /** Milliseconds as seconds, to one decimal. */
12
+ export declare function secondsOf(ms: number): number;
13
+ /** `value` seconds as progress and the waterfall show them: one decimal and `s`. */
14
+ export declare function secondsText(value: number): string;
15
+ /** `bytes` as progress shows them: megabytes to one decimal and ` MB`. */
16
+ export declare function megabytesText(bytes: number): string;
17
+ /**
18
+ * The status a run exits with once its command ran: the command's code, or `128 + n` when signal `n` ended it
19
+ * (129, 130 and 143 for SIGHUP, SIGINT and SIGTERM). A signal Node doesn't know the number of exits 1, and so does a
20
+ * remote command that ended without an exit code.
21
+ */
22
+ export declare function commandExitStatus(outcome: RanCommand): number;
@@ -0,0 +1,26 @@
1
+ import { constants } from "node:os";
2
+ /** Milliseconds as seconds, to one decimal. */
3
+ export function secondsOf(ms) {
4
+ return Math.round(ms / 100) / 10;
5
+ }
6
+ /** `value` seconds as progress and the waterfall show them: one decimal and `s`. */
7
+ export function secondsText(value) {
8
+ return `${value.toFixed(1)}s`;
9
+ }
10
+ /** `bytes` as progress shows them: megabytes to one decimal and ` MB`. */
11
+ export function megabytesText(bytes) {
12
+ return `${(bytes / 1_000_000).toFixed(1)} MB`;
13
+ }
14
+ /**
15
+ * The status a run exits with once its command ran: the command's code, or `128 + n` when signal `n` ended it
16
+ * (129, 130 and 143 for SIGHUP, SIGINT and SIGTERM). A signal Node doesn't know the number of exits 1, and so does a
17
+ * remote command that ended without an exit code.
18
+ */
19
+ export function commandExitStatus(outcome) {
20
+ if (outcome.kind === "exited")
21
+ return outcome.code;
22
+ if (outcome.kind === "no-exit-code")
23
+ return 1;
24
+ const number = constants.signals[outcome.signal];
25
+ return number === undefined ? 1 : 128 + number;
26
+ }
@@ -0,0 +1,46 @@
1
+ import { inspect } from "node:util";
2
+ /** The Vercel team and project a credential's token was minted for, by id. */
3
+ export interface VercelProject {
4
+ readonly teamId: string;
5
+ readonly projectId: string;
6
+ }
7
+ /**
8
+ * The claims of a GitHub Actions OIDC token that Testserver's Trusted Sources match on: `aud`, the audience (by
9
+ * default the repository owner's URL, such as `https://github.com/vercel`), and `repository`, such as
10
+ * `vercel/vercel-internal`.
11
+ */
12
+ export interface GitHubActionsClaims {
13
+ readonly aud: string;
14
+ readonly repository: string;
15
+ }
16
+ /**
17
+ * A credential: an OIDC token the Testserver control plane accepts for creating Testserver sandboxes.
18
+ *
19
+ * It renders as `[credential]` everywhere (`String`, template literals, `JSON.stringify`, `util.inspect`
20
+ * and so `console.log`), so storm never prints one by accident. Only a credential gateway constructs
21
+ * one. `reveal()` is for the Testserver control plane's request header and the runner's live Sandbox gateway, and
22
+ * nothing else.
23
+ */
24
+ export declare class Credential {
25
+ #private;
26
+ constructor(token: string);
27
+ /**
28
+ * The token itself, for the Testserver control plane's request header and the runner's live Sandbox gateway (which
29
+ * hands it to `@vercel/sandbox`) only.
30
+ */
31
+ reveal(): string;
32
+ /**
33
+ * The team and project the token was minted for, from its `owner_id` and `project_id` JWT claims, decoded once.
34
+ * `undefined` when the token isn't a JWT or lacks either claim. The token itself never leaves the credential.
35
+ */
36
+ vercelProject(): VercelProject | undefined;
37
+ /**
38
+ * The `aud` and `repository` claims of a GitHub Actions OIDC token, which Testserver's Trusted Sources match on.
39
+ * `undefined` when the token isn't a JWT or lacks either claim as a non-empty string. The token itself never
40
+ * leaves the credential.
41
+ */
42
+ githubActionsClaims(): GitHubActionsClaims | undefined;
43
+ toString(): string;
44
+ toJSON(): string;
45
+ [inspect.custom](): string;
46
+ }