@cnc-tools/storm 0.0.0 → 0.5.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 (513) 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/run/cleanup.d.ts +135 -0
  15. package/dist/commands/run/cleanup.js +171 -0
  16. package/dist/commands/run/command.d.ts +327 -0
  17. package/dist/commands/run/command.js +620 -0
  18. package/dist/commands/run/job-summary.d.ts +6 -0
  19. package/dist/commands/run/job-summary.js +31 -0
  20. package/dist/commands/run/live-view.d.ts +22 -0
  21. package/dist/commands/run/live-view.js +395 -0
  22. package/dist/commands/run/metadata.d.ts +47 -0
  23. package/dist/commands/run/metadata.js +83 -0
  24. package/dist/commands/run/mint-failed.d.ts +11 -0
  25. package/dist/commands/run/mint-failed.js +33 -0
  26. package/dist/commands/run/outcomes.d.ts +307 -0
  27. package/dist/commands/run/outcomes.js +332 -0
  28. package/dist/commands/run/progress.d.ts +44 -0
  29. package/dist/commands/run/progress.js +277 -0
  30. package/dist/commands/run/redaction.d.ts +15 -0
  31. package/dist/commands/run/redaction.js +40 -0
  32. package/dist/commands/run/run-collector.d.ts +30 -0
  33. package/dist/commands/run/run-collector.js +73 -0
  34. package/dist/commands/run/run-record.d.ts +144 -0
  35. package/dist/commands/run/run-record.js +96 -0
  36. package/dist/commands/run/tests-summary.d.ts +34 -0
  37. package/dist/commands/run/tests-summary.js +141 -0
  38. package/dist/commands/run/text.d.ts +22 -0
  39. package/dist/commands/run/text.js +74 -0
  40. package/dist/commands/run/view.d.ts +35 -0
  41. package/dist/commands/run/view.js +163 -0
  42. package/dist/commands/run/waterfall.d.ts +25 -0
  43. package/dist/commands/run/waterfall.js +108 -0
  44. package/dist/commands/run/worker-chart.d.ts +79 -0
  45. package/dist/commands/run/worker-chart.js +313 -0
  46. package/dist/commands/runs/facts.d.ts +150 -0
  47. package/dist/commands/runs/facts.js +292 -0
  48. package/dist/commands/runs/list/command.d.ts +86 -0
  49. package/dist/commands/runs/list/command.js +36 -0
  50. package/dist/commands/runs/list/metadata.d.ts +22 -0
  51. package/dist/commands/runs/list/metadata.js +19 -0
  52. package/dist/commands/runs/list/outcomes.d.ts +74 -0
  53. package/dist/commands/runs/list/outcomes.js +89 -0
  54. package/dist/commands/runs/logs/command.d.ts +72 -0
  55. package/dist/commands/runs/logs/command.js +51 -0
  56. package/dist/commands/runs/logs/metadata.d.ts +22 -0
  57. package/dist/commands/runs/logs/metadata.js +22 -0
  58. package/dist/commands/runs/logs/outcomes.d.ts +55 -0
  59. package/dist/commands/runs/logs/outcomes.js +77 -0
  60. package/dist/commands/runs/metadata.d.ts +3 -0
  61. package/dist/commands/runs/metadata.js +3 -0
  62. package/dist/commands/runs/past-run.d.ts +72 -0
  63. package/dist/commands/runs/past-run.js +99 -0
  64. package/dist/commands/runs/show/command.d.ts +176 -0
  65. package/dist/commands/runs/show/command.js +76 -0
  66. package/dist/commands/runs/show/metadata.d.ts +25 -0
  67. package/dist/commands/runs/show/metadata.js +22 -0
  68. package/dist/commands/runs/show/outcomes.d.ts +164 -0
  69. package/dist/commands/runs/show/outcomes.js +317 -0
  70. package/dist/config/by-name.d.ts +24 -0
  71. package/dist/config/by-name.js +26 -0
  72. package/dist/config/errors.d.ts +58 -0
  73. package/dist/config/errors.js +101 -0
  74. package/dist/config/gateways.d.ts +32 -0
  75. package/dist/config/gateways.js +1 -0
  76. package/dist/config/index.d.ts +9 -0
  77. package/dist/config/index.js +12 -0
  78. package/dist/config/live/config-gateway.d.ts +6 -0
  79. package/dist/config/live/config-gateway.js +71 -0
  80. package/dist/config/load.d.ts +54 -0
  81. package/dist/config/load.js +175 -0
  82. package/dist/config/resolve.d.ts +49 -0
  83. package/dist/config/resolve.js +94 -0
  84. package/dist/config/resource-config.d.ts +132 -0
  85. package/dist/config/resource-config.js +19 -0
  86. package/dist/config/schema.d.ts +64 -0
  87. package/dist/config/schema.js +57 -0
  88. package/dist/config/set.d.ts +16 -0
  89. package/dist/config/set.js +55 -0
  90. package/dist/config/settings-file.d.ts +41 -0
  91. package/dist/config/settings-file.js +72 -0
  92. package/dist/config-file/define.d.ts +37 -0
  93. package/dist/config-file/define.js +9 -0
  94. package/dist/config-file/toolchain.d.ts +9 -0
  95. package/dist/config-file/toolchain.js +41 -0
  96. package/dist/context.d.ts +86 -0
  97. package/dist/context.js +43 -0
  98. package/dist/core/command-provider.d.ts +126 -0
  99. package/dist/core/command-provider.js +13 -0
  100. package/dist/core/command-slots.d.ts +67 -0
  101. package/dist/core/command-slots.js +136 -0
  102. package/dist/core/events.d.ts +128 -0
  103. package/dist/core/events.js +15 -0
  104. package/dist/core/gateways.d.ts +249 -0
  105. package/dist/core/gateways.js +1 -0
  106. package/dist/core/index.d.ts +20 -0
  107. package/dist/core/index.js +18 -0
  108. package/dist/core/keyed.d.ts +12 -0
  109. package/dist/core/keyed.js +24 -0
  110. package/dist/core/lane.d.ts +46 -0
  111. package/dist/core/lane.js +5 -0
  112. package/dist/core/limit.d.ts +9 -0
  113. package/dist/core/limit.js +29 -0
  114. package/dist/core/live/command-gateway.d.ts +11 -0
  115. package/dist/core/live/command-gateway.js +83 -0
  116. package/dist/core/live/job-summary-gateway.d.ts +5 -0
  117. package/dist/core/live/job-summary-gateway.js +20 -0
  118. package/dist/core/live/progress-terminal.d.ts +20 -0
  119. package/dist/core/live/progress-terminal.js +173 -0
  120. package/dist/core/live/run-directory-gateway.d.ts +24 -0
  121. package/dist/core/live/run-directory-gateway.js +437 -0
  122. package/dist/core/mint.d.ts +10 -0
  123. package/dist/core/mint.js +14 -0
  124. package/dist/core/payload.d.ts +26 -0
  125. package/dist/core/payload.js +33 -0
  126. package/dist/core/presentation.d.ts +87 -0
  127. package/dist/core/presentation.js +5 -0
  128. package/dist/core/presentations.d.ts +56 -0
  129. package/dist/core/presentations.js +66 -0
  130. package/dist/core/provider.d.ts +69 -0
  131. package/dist/core/provider.js +5 -0
  132. package/dist/core/resource.d.ts +262 -0
  133. package/dist/core/resource.js +6 -0
  134. package/dist/core/resources.d.ts +131 -0
  135. package/dist/core/resources.js +254 -0
  136. package/dist/core/run-directory.d.ts +69 -0
  137. package/dist/core/run-directory.js +94 -0
  138. package/dist/core/run-state.d.ts +152 -0
  139. package/dist/core/run-state.js +313 -0
  140. package/dist/core/run.d.ts +187 -0
  141. package/dist/core/run.js +321 -0
  142. package/dist/core/state-directory.d.ts +19 -0
  143. package/dist/core/state-directory.js +29 -0
  144. package/dist/core/timeline.d.ts +63 -0
  145. package/dist/core/timeline.js +97 -0
  146. package/dist/core/timing.d.ts +22 -0
  147. package/dist/core/timing.js +26 -0
  148. package/dist/credential/credential.d.ts +46 -0
  149. package/dist/credential/credential.js +80 -0
  150. package/dist/credential/diagnosis.d.ts +18 -0
  151. package/dist/credential/diagnosis.js +99 -0
  152. package/dist/credential/gateways.d.ts +109 -0
  153. package/dist/credential/gateways.js +1 -0
  154. package/dist/credential/index.d.ts +7 -0
  155. package/dist/credential/index.js +7 -0
  156. package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
  157. package/dist/credential/live/github-actions-token-gateway.js +43 -0
  158. package/dist/credential/live/github-actions-token-response.d.ts +19 -0
  159. package/dist/credential/live/github-actions-token-response.js +49 -0
  160. package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
  161. package/dist/credential/live/vercel-cli-gateway.js +64 -0
  162. package/dist/credential/live/vercel-output.d.ts +60 -0
  163. package/dist/credential/live/vercel-output.js +122 -0
  164. package/dist/credential/live/vercel-process.d.ts +14 -0
  165. package/dist/credential/live/vercel-process.js +3 -0
  166. package/dist/credential/settle.d.ts +31 -0
  167. package/dist/credential/settle.js +49 -0
  168. package/dist/credential/source.d.ts +110 -0
  169. package/dist/credential/source.js +114 -0
  170. package/dist/help-logo.d.ts +11 -0
  171. package/dist/help-logo.js +56 -0
  172. package/dist/presentation.d.ts +26 -0
  173. package/dist/presentation.js +21 -0
  174. package/dist/resources/github/cleanup.d.ts +23 -0
  175. package/dist/resources/github/cleanup.js +39 -0
  176. package/dist/resources/github/command.d.ts +74 -0
  177. package/dist/resources/github/command.js +117 -0
  178. package/dist/resources/github/config.d.ts +16 -0
  179. package/dist/resources/github/config.js +37 -0
  180. package/dist/resources/github/events.d.ts +26 -0
  181. package/dist/resources/github/events.js +2 -0
  182. package/dist/resources/github/fixture-repo.d.ts +69 -0
  183. package/dist/resources/github/fixture-repo.js +60 -0
  184. package/dist/resources/github/gateways.d.ts +62 -0
  185. package/dist/resources/github/gateways.js +1 -0
  186. package/dist/resources/github/index.d.ts +12 -0
  187. package/dist/resources/github/index.js +15 -0
  188. package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
  189. package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
  190. package/dist/resources/github/live/gateways.d.ts +6 -0
  191. package/dist/resources/github/live/gateways.js +13 -0
  192. package/dist/resources/github/presentation.d.ts +13 -0
  193. package/dist/resources/github/presentation.js +43 -0
  194. package/dist/resources/github/provider.d.ts +66 -0
  195. package/dist/resources/github/provider.js +58 -0
  196. package/dist/resources/github/resource-provider.d.ts +6 -0
  197. package/dist/resources/github/resource-provider.js +20 -0
  198. package/dist/resources/github/resource.d.ts +33 -0
  199. package/dist/resources/github/resource.js +12 -0
  200. package/dist/resources/testserver/cleanup.d.ts +14 -0
  201. package/dist/resources/testserver/cleanup.js +22 -0
  202. package/dist/resources/testserver/command.d.ts +322 -0
  203. package/dist/resources/testserver/command.js +245 -0
  204. package/dist/resources/testserver/commands/app.d.ts +18 -0
  205. package/dist/resources/testserver/commands/app.js +3 -0
  206. package/dist/resources/testserver/commands/create/command.d.ts +136 -0
  207. package/dist/resources/testserver/commands/create/command.js +158 -0
  208. package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
  209. package/dist/resources/testserver/commands/create/metadata.js +45 -0
  210. package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
  211. package/dist/resources/testserver/commands/create/outcomes.js +172 -0
  212. package/dist/resources/testserver/commands/list/command.d.ts +60 -0
  213. package/dist/resources/testserver/commands/list/command.js +56 -0
  214. package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
  215. package/dist/resources/testserver/commands/list/metadata.js +9 -0
  216. package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
  217. package/dist/resources/testserver/commands/list/outcomes.js +152 -0
  218. package/dist/resources/testserver/config.d.ts +18 -0
  219. package/dist/resources/testserver/config.js +77 -0
  220. package/dist/resources/testserver/credential-facts.d.ts +80 -0
  221. package/dist/resources/testserver/credential-facts.js +83 -0
  222. package/dist/resources/testserver/events.d.ts +59 -0
  223. package/dist/resources/testserver/events.js +4 -0
  224. package/dist/resources/testserver/index.d.ts +16 -0
  225. package/dist/resources/testserver/index.js +24 -0
  226. package/dist/resources/testserver/lane.d.ts +28 -0
  227. package/dist/resources/testserver/lane.js +139 -0
  228. package/dist/resources/testserver/live/gateways.d.ts +6 -0
  229. package/dist/resources/testserver/live/gateways.js +26 -0
  230. package/dist/resources/testserver/options.d.ts +5 -0
  231. package/dist/resources/testserver/options.js +5 -0
  232. package/dist/resources/testserver/pool/channels.d.ts +80 -0
  233. package/dist/resources/testserver/pool/channels.js +48 -0
  234. package/dist/resources/testserver/pool/create.d.ts +48 -0
  235. package/dist/resources/testserver/pool/create.js +45 -0
  236. package/dist/resources/testserver/pool/directory.d.ts +4 -0
  237. package/dist/resources/testserver/pool/directory.js +5 -0
  238. package/dist/resources/testserver/pool/gateways.d.ts +190 -0
  239. package/dist/resources/testserver/pool/gateways.js +1 -0
  240. package/dist/resources/testserver/pool/host.d.ts +8 -0
  241. package/dist/resources/testserver/pool/host.js +21 -0
  242. package/dist/resources/testserver/pool/index.d.ts +9 -0
  243. package/dist/resources/testserver/pool/index.js +10 -0
  244. package/dist/resources/testserver/pool/inspect.d.ts +53 -0
  245. package/dist/resources/testserver/pool/inspect.js +45 -0
  246. package/dist/resources/testserver/pool/lease.d.ts +84 -0
  247. package/dist/resources/testserver/pool/lease.js +125 -0
  248. package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
  249. package/dist/resources/testserver/pool/live/pool-records.js +70 -0
  250. package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
  251. package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
  252. package/dist/resources/testserver/pool/staleness.d.ts +16 -0
  253. package/dist/resources/testserver/pool/staleness.js +27 -0
  254. package/dist/resources/testserver/presentation.d.ts +9 -0
  255. package/dist/resources/testserver/presentation.js +217 -0
  256. package/dist/resources/testserver/provider.d.ts +177 -0
  257. package/dist/resources/testserver/provider.js +254 -0
  258. package/dist/resources/testserver/ran.d.ts +87 -0
  259. package/dist/resources/testserver/ran.js +140 -0
  260. package/dist/resources/testserver/resource-provider.d.ts +12 -0
  261. package/dist/resources/testserver/resource-provider.js +38 -0
  262. package/dist/resources/testserver/resource.d.ts +32 -0
  263. package/dist/resources/testserver/resource.js +10 -0
  264. package/dist/resources/testserver/run-sandbox.d.ts +13 -0
  265. package/dist/resources/testserver/run-sandbox.js +6 -0
  266. package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
  267. package/dist/resources/testserver/sandbox/channels.js +21 -0
  268. package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
  269. package/dist/resources/testserver/sandbox/create-failure.js +65 -0
  270. package/dist/resources/testserver/sandbox/create.d.ts +29 -0
  271. package/dist/resources/testserver/sandbox/create.js +37 -0
  272. package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
  273. package/dist/resources/testserver/sandbox/gateways.js +1 -0
  274. package/dist/resources/testserver/sandbox/index.d.ts +6 -0
  275. package/dist/resources/testserver/sandbox/index.js +7 -0
  276. package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
  277. package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
  278. package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
  279. package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
  280. package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
  281. package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
  282. package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
  283. package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
  284. package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
  285. package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
  286. package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
  287. package/dist/resources/testserver/sandbox/live/sse.js +32 -0
  288. package/dist/resources.d.ts +452 -0
  289. package/dist/resources.js +88 -0
  290. package/dist/runner/base.d.ts +40 -0
  291. package/dist/runner/base.js +52 -0
  292. package/dist/runner/context.d.ts +13 -0
  293. package/dist/runner/context.js +9 -0
  294. package/dist/runner/events.d.ts +179 -0
  295. package/dist/runner/events.js +16 -0
  296. package/dist/runner/gateways.d.ts +351 -0
  297. package/dist/runner/gateways.js +3 -0
  298. package/dist/runner/index.d.ts +19 -0
  299. package/dist/runner/index.js +18 -0
  300. package/dist/runner/live/checkout-gateway.d.ts +3 -0
  301. package/dist/runner/live/checkout-gateway.js +206 -0
  302. package/dist/runner/live/git-output.d.ts +14 -0
  303. package/dist/runner/live/git-output.js +32 -0
  304. package/dist/runner/live/sandbox-errors.d.ts +7 -0
  305. package/dist/runner/live/sandbox-errors.js +21 -0
  306. package/dist/runner/live/sandbox-gateway.d.ts +7 -0
  307. package/dist/runner/live/sandbox-gateway.js +427 -0
  308. package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
  309. package/dist/runner/live/snapshot-cache-gateway.js +104 -0
  310. package/dist/runner/live/snapshot-records.d.ts +11 -0
  311. package/dist/runner/live/snapshot-records.js +57 -0
  312. package/dist/runner/live/terminal.d.ts +16 -0
  313. package/dist/runner/live/terminal.js +37 -0
  314. package/dist/runner/live/user.d.ts +2 -0
  315. package/dist/runner/live/user.js +11 -0
  316. package/dist/runner/output.d.ts +23 -0
  317. package/dist/runner/output.js +58 -0
  318. package/dist/runner/prepare.d.ts +67 -0
  319. package/dist/runner/prepare.js +59 -0
  320. package/dist/runner/ready.d.ts +68 -0
  321. package/dist/runner/ready.js +159 -0
  322. package/dist/runner/recipe.d.ts +126 -0
  323. package/dist/runner/recipe.js +302 -0
  324. package/dist/runner/remote-command.d.ts +77 -0
  325. package/dist/runner/remote-command.js +127 -0
  326. package/dist/runner/scope.d.ts +58 -0
  327. package/dist/runner/scope.js +117 -0
  328. package/dist/runner/snapshot-build.d.ts +33 -0
  329. package/dist/runner/snapshot-build.js +112 -0
  330. package/dist/runner/snapshot-cache.d.ts +84 -0
  331. package/dist/runner/snapshot-cache.js +126 -0
  332. package/dist/runner/snapshot-key.d.ts +52 -0
  333. package/dist/runner/snapshot-key.js +91 -0
  334. package/dist/runner/steps.d.ts +41 -0
  335. package/dist/runner/steps.js +49 -0
  336. package/dist/sdk/container/api-request.d.ts +32 -0
  337. package/dist/sdk/container/api-request.js +46 -0
  338. package/dist/sdk/container/container.d.ts +144 -0
  339. package/dist/sdk/container/container.js +346 -0
  340. package/dist/sdk/container/feature-flags.d.ts +37 -0
  341. package/dist/sdk/container/feature-flags.js +118 -0
  342. package/dist/sdk/container/gateways.d.ts +108 -0
  343. package/dist/sdk/container/gateways.js +1 -0
  344. package/dist/sdk/container/index.d.ts +5 -0
  345. package/dist/sdk/container/index.js +5 -0
  346. package/dist/sdk/container/live/container-gateway.d.ts +17 -0
  347. package/dist/sdk/container/live/container-gateway.js +114 -0
  348. package/dist/sdk/factories/build.d.ts +66 -0
  349. package/dist/sdk/factories/build.js +98 -0
  350. package/dist/sdk/factories/definition.d.ts +28 -0
  351. package/dist/sdk/factories/definition.js +16 -0
  352. package/dist/sdk/factories/definitions.d.ts +166 -0
  353. package/dist/sdk/factories/definitions.js +235 -0
  354. package/dist/sdk/factories/gateways.d.ts +25 -0
  355. package/dist/sdk/factories/gateways.js +1 -0
  356. package/dist/sdk/factories/index.d.ts +5 -0
  357. package/dist/sdk/factories/index.js +5 -0
  358. package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
  359. package/dist/sdk/factories/live/factory-gateway.js +29 -0
  360. package/dist/sdk/index.d.ts +7 -0
  361. package/dist/sdk/index.js +15 -0
  362. package/dist/sdk/payload/index.d.ts +2 -0
  363. package/dist/sdk/payload/index.js +4 -0
  364. package/dist/sdk/payload/payload.d.ts +47 -0
  365. package/dist/sdk/payload/payload.js +74 -0
  366. package/dist/sdk/payload/test-events.d.ts +102 -0
  367. package/dist/sdk/payload/test-events.js +59 -0
  368. package/dist/sdk/proxy/exchange.d.ts +58 -0
  369. package/dist/sdk/proxy/exchange.js +173 -0
  370. package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
  371. package/dist/sdk/proxy/faulted-exchange.js +106 -0
  372. package/dist/sdk/proxy/faults.d.ts +133 -0
  373. package/dist/sdk/proxy/faults.js +147 -0
  374. package/dist/sdk/proxy/index.d.ts +3 -0
  375. package/dist/sdk/proxy/index.js +3 -0
  376. package/dist/sdk/proxy/proxy.d.ts +93 -0
  377. package/dist/sdk/proxy/proxy.js +99 -0
  378. package/dist/sdk/proxy/records.d.ts +56 -0
  379. package/dist/sdk/proxy/records.js +56 -0
  380. package/dist/sdk/records/body.d.ts +89 -0
  381. package/dist/sdk/records/body.js +236 -0
  382. package/dist/sdk/records/index.d.ts +2 -0
  383. package/dist/sdk/records/index.js +4 -0
  384. package/dist/sdk/records/records.d.ts +49 -0
  385. package/dist/sdk/records/records.js +16 -0
  386. package/dist/sdk/seed/index.d.ts +1 -0
  387. package/dist/sdk/seed/index.js +3 -0
  388. package/dist/sdk/seed/seed.d.ts +221 -0
  389. package/dist/sdk/seed/seed.js +171 -0
  390. package/dist/sdk/testserver/clock.d.ts +8 -0
  391. package/dist/sdk/testserver/clock.js +10 -0
  392. package/dist/sdk/testserver/failure.d.ts +73 -0
  393. package/dist/sdk/testserver/failure.js +61 -0
  394. package/dist/sdk/testserver/index.d.ts +5 -0
  395. package/dist/sdk/testserver/index.js +8 -0
  396. package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
  397. package/dist/sdk/testserver/live/connect-failure.js +30 -0
  398. package/dist/sdk/testserver/live/request.d.ts +69 -0
  399. package/dist/sdk/testserver/live/request.js +89 -0
  400. package/dist/sdk/testserver/service-ids.d.ts +19 -0
  401. package/dist/sdk/testserver/service-ids.js +77 -0
  402. package/dist/sdk/testserver/test-id.d.ts +15 -0
  403. package/dist/sdk/testserver/test-id.js +28 -0
  404. package/dist/story/align.d.ts +37 -0
  405. package/dist/story/align.js +39 -0
  406. package/dist/story/artifact.d.ts +60 -0
  407. package/dist/story/artifact.js +93 -0
  408. package/dist/story/definition.d.ts +52 -0
  409. package/dist/story/definition.js +9 -0
  410. package/dist/story/diff.d.ts +9 -0
  411. package/dist/story/diff.js +97 -0
  412. package/dist/story/errors.d.ts +14 -0
  413. package/dist/story/errors.js +21 -0
  414. package/dist/story/gateways.d.ts +74 -0
  415. package/dist/story/gateways.js +3 -0
  416. package/dist/story/host.d.ts +27 -0
  417. package/dist/story/host.js +97 -0
  418. package/dist/story/index.d.ts +7 -0
  419. package/dist/story/index.js +9 -0
  420. package/dist/story/json.d.ts +16 -0
  421. package/dist/story/json.js +59 -0
  422. package/dist/story/live/artifact-gateway.d.ts +2 -0
  423. package/dist/story/live/artifact-gateway.js +82 -0
  424. package/dist/story/mode.d.ts +17 -0
  425. package/dist/story/mode.js +21 -0
  426. package/dist/story/orphans.d.ts +17 -0
  427. package/dist/story/orphans.js +15 -0
  428. package/dist/story/report.d.ts +30 -0
  429. package/dist/story/report.js +118 -0
  430. package/dist/story/run.d.ts +49 -0
  431. package/dist/story/run.js +160 -0
  432. package/dist/story/sequence.d.ts +30 -0
  433. package/dist/story/sequence.js +74 -0
  434. package/dist/story/settle.d.ts +94 -0
  435. package/dist/story/settle.js +70 -0
  436. package/dist/time/duration.d.ts +19 -0
  437. package/dist/time/duration.js +37 -0
  438. package/dist/time/index.d.ts +2 -0
  439. package/dist/time/index.js +4 -0
  440. package/dist/time/time.d.ts +15 -0
  441. package/dist/time/time.js +23 -0
  442. package/dist/vercel-cli/ansi.d.ts +13 -0
  443. package/dist/vercel-cli/ansi.js +32 -0
  444. package/dist/vercel-cli/arguments.d.ts +25 -0
  445. package/dist/vercel-cli/arguments.js +78 -0
  446. package/dist/vercel-cli/auth-config.d.ts +43 -0
  447. package/dist/vercel-cli/auth-config.js +36 -0
  448. package/dist/vercel-cli/clock.d.ts +9 -0
  449. package/dist/vercel-cli/clock.js +10 -0
  450. package/dist/vercel-cli/config-files.d.ts +24 -0
  451. package/dist/vercel-cli/config-files.js +40 -0
  452. package/dist/vercel-cli/context.d.ts +12 -0
  453. package/dist/vercel-cli/context.js +12 -0
  454. package/dist/vercel-cli/driver.d.ts +218 -0
  455. package/dist/vercel-cli/driver.js +364 -0
  456. package/dist/vercel-cli/entry.d.ts +8 -0
  457. package/dist/vercel-cli/entry.js +13 -0
  458. package/dist/vercel-cli/environment.d.ts +33 -0
  459. package/dist/vercel-cli/environment.js +72 -0
  460. package/dist/vercel-cli/errors.d.ts +8 -0
  461. package/dist/vercel-cli/errors.js +8 -0
  462. package/dist/vercel-cli/gateways.d.ts +103 -0
  463. package/dist/vercel-cli/gateways.js +4 -0
  464. package/dist/vercel-cli/index.d.ts +10 -0
  465. package/dist/vercel-cli/index.js +15 -0
  466. package/dist/vercel-cli/invocation.d.ts +234 -0
  467. package/dist/vercel-cli/invocation.js +397 -0
  468. package/dist/vercel-cli/keys.d.ts +14 -0
  469. package/dist/vercel-cli/keys.js +12 -0
  470. package/dist/vercel-cli/live/config-files.d.ts +28 -0
  471. package/dist/vercel-cli/live/config-files.js +66 -0
  472. package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
  473. package/dist/vercel-cli/live/process-gateway.js +178 -0
  474. package/dist/vercel-cli/redaction.d.ts +13 -0
  475. package/dist/vercel-cli/redaction.js +22 -0
  476. package/dist/vercel-cli/report.d.ts +22 -0
  477. package/dist/vercel-cli/report.js +110 -0
  478. package/dist/vercel-cli/verbose.d.ts +7 -0
  479. package/dist/vercel-cli/verbose.js +24 -0
  480. package/dist/version.d.ts +20 -0
  481. package/dist/version.js +57 -0
  482. package/dist/vitest/config.d.ts +51 -0
  483. package/dist/vitest/config.js +61 -0
  484. package/dist/vitest/container-scope.d.ts +108 -0
  485. package/dist/vitest/container-scope.js +234 -0
  486. package/dist/vitest/diagnostics.d.ts +146 -0
  487. package/dist/vitest/diagnostics.js +306 -0
  488. package/dist/vitest/fixtures.d.ts +64 -0
  489. package/dist/vitest/fixtures.js +172 -0
  490. package/dist/vitest/gateways.d.ts +47 -0
  491. package/dist/vitest/gateways.js +3 -0
  492. package/dist/vitest/index.d.ts +3 -0
  493. package/dist/vitest/index.js +9 -0
  494. package/dist/vitest/list-output.d.ts +3 -0
  495. package/dist/vitest/list-output.js +19 -0
  496. package/dist/vitest/live/list-gateway.d.ts +7 -0
  497. package/dist/vitest/live/list-gateway.js +60 -0
  498. package/dist/vitest/ownership.d.ts +29 -0
  499. package/dist/vitest/ownership.js +68 -0
  500. package/dist/vitest/plan.d.ts +33 -0
  501. package/dist/vitest/plan.js +73 -0
  502. package/dist/vitest/sandbox.d.ts +16 -0
  503. package/dist/vitest/sandbox.js +35 -0
  504. package/dist/vitest/test-events.d.ts +41 -0
  505. package/dist/vitest/test-events.js +92 -0
  506. package/dist/vitest/test-results.d.ts +84 -0
  507. package/dist/vitest/test-results.js +160 -0
  508. package/dist/vitest/types.d.ts +68 -0
  509. package/dist/vitest/types.js +4 -0
  510. package/package.json +119 -3
  511. package/skills/overview.md +32 -0
  512. package/skills/read-run-output.md +65 -0
  513. package/README.md +0 -3
@@ -0,0 +1,254 @@
1
+ // The Testserver pool resource's run provider: a run with a Testserver side prepares the pool, resolves the build,
2
+ // leases usable Testserver sandboxes, creates the rest, hands the command their Testserver URLs, and releases every
3
+ // lease once the command has stopped. Its lane is `testserver`, and its facts feed the `ran` and `canceled` outcomes.
4
+ // It is written against its own kind only.
5
+ import { runLimited, } from "../../core/index.js";
6
+ import { buildMatch, createPooledSandbox, leaseUsable, minutesSince, releaseLeases, resolveBuild, } from "./pool/index.js";
7
+ import { CREATE_CONCURRENCY } from "./options.js";
8
+ /**
9
+ * The run provider of the Testserver pool resource.
10
+ *
11
+ * - Preparing it prepares the pool's files; a pool that can't be prepared ends the run `pool-unavailable`.
12
+ * - Acquiring it provisions (`provision`): it resolves the build, leases, and creates the rest with the run's
13
+ * credential source: in a local run the one its credential choice names, in a runner run the run's one mint. Each
14
+ * host leased goes onto `owned` as it is leased. A mint that fails with no Testserver sandbox in hand ends the run
15
+ * as the run's own `mint-failed`.
16
+ * - Once the run is ready, it reports the sandbox list.
17
+ * - Releasing it releases every lease, and answers the releases that failed.
18
+ * - A canceled run says what an acquired one created, what a canceled acquire created, and otherwise nothing; with the
19
+ * TTL its request asked creates for.
20
+ */
21
+ export const testserverPoolRunProvider = {
22
+ name: "testserverPool",
23
+ lane: "testserver",
24
+ requested: (request) => request,
25
+ prepare: async (context) => {
26
+ const prepared = await context.pool.prepare();
27
+ return prepared.ok ? undefined : { kind: "pool-unavailable", failure: prepared.failure };
28
+ },
29
+ acquire: async ({ context, request, signal, progress, owned, credential }) => {
30
+ const provisioned = await provision(context, request, createWith(request, credential), signal, progress, owned);
31
+ if (provisioned.kind === "canceled") {
32
+ const { kind: _kind, ...facts } = provisioned;
33
+ return { kind: "canceled", facts };
34
+ }
35
+ if (provisioned.kind === "mint-failed")
36
+ return provisioned;
37
+ if (provisioned.kind !== "provisioned")
38
+ return { kind: "refused", refusal: provisioned };
39
+ const { kind: _kind, ...facts } = provisioned;
40
+ return { kind: "acquired", connection: facts.sandboxes, facts };
41
+ },
42
+ ready: async ({ connection, progress }) => {
43
+ await progress.emit({ kind: "sandbox-list", sandboxes: connection });
44
+ },
45
+ // The leases it holds, as its presentation counts them.
46
+ holding: (owned) => (owned.length === 0 ? undefined : owned.length),
47
+ release: async (context, owned) => ({ releaseFailures: await releaseLeases(context, owned) }),
48
+ failures: (cleanup) => cleanup.releaseFailures.length,
49
+ payload: (sandboxes) => ({
50
+ sandboxes: [...new Set(sandboxes.map((sandbox) => sandbox.testserverUrl))].map((url) => ({ url })),
51
+ }),
52
+ canceledFacts: (request, facts) => {
53
+ const ttlMinutes = request.provisioning.kind === "create" ? request.provisioning.ttlMinutes : undefined;
54
+ if (facts !== undefined)
55
+ return canceledAfter(facts, ttlMinutes);
56
+ return { pooled: 0, unpooled: [], failedCreates: [], ttlMinutes };
57
+ },
58
+ };
59
+ /**
60
+ * How the run creates Testserver sandboxes, if it may: under `no-create`, never; otherwise with the run's credential
61
+ * source, `credential`.
62
+ */
63
+ function createWith(request, credential) {
64
+ const { provisioning } = request;
65
+ if (provisioning.kind === "no-create")
66
+ return undefined;
67
+ // The command half says a pool that creates takes the credential (`takesCredential`), and a run settles a credential
68
+ // choice whenever a held resource takes it, so a run that creates always has a source.
69
+ if (credential === undefined)
70
+ throw new Error("A Testserver pool that creates takes the credential, so its run settles a credential choice.");
71
+ return { source: credential, ttlMinutes: provisioning.ttlMinutes };
72
+ }
73
+ /**
74
+ * The outcome of a run whose credential source failed with no Testserver sandbox in hand, after `failedCreates`
75
+ * failed: the run's own `mint-failed`, or `token-request-failed`, which reports the creates that failed before it.
76
+ */
77
+ function credentialFailed(failure, ttlMinutes, failedCreates) {
78
+ return failure.source === "mint"
79
+ ? { kind: "mint-failed", failure: failure.failure, target: failure.target }
80
+ : { kind: "token-request-failed", failure: failure.failure, ttlMinutes, failedCreates };
81
+ }
82
+ /** What a canceled run that had provisioned `facts` says of them: what it created, pooled or not. */
83
+ function canceledAfter(facts, ttlMinutes) {
84
+ const created = facts.sandboxes.filter((sandbox) => sandbox.origin === "created").length;
85
+ return {
86
+ pooled: created - facts.unpooled.length,
87
+ unpooled: facts.unpooled,
88
+ failedCreates: facts.failedCreates,
89
+ ttlMinutes,
90
+ };
91
+ }
92
+ /**
93
+ * Leases from the pool and creates the rest: everything a run does before its command. `create` is how it gets a
94
+ * credential and creates; undefined under `no-create`. Each host leased is pushed onto `held`.
95
+ */
96
+ async function provision(context, request, create, signal, progress, held) {
97
+ let tally = { created: [], failedCreates: [], unpooled: [] };
98
+ const canceled = () => ({
99
+ kind: "canceled",
100
+ pooled: tally.created.length - tally.unpooled.length,
101
+ unpooled: tally.unpooled,
102
+ failedCreates: tally.failedCreates,
103
+ ttlMinutes: create?.ttlMinutes,
104
+ });
105
+ if (signal.aborted)
106
+ return canceled();
107
+ const resolution = await resolveBuild(context, { build: request.build, credential: create?.source });
108
+ if (resolution.kind === "as-written")
109
+ await progress.emit({ kind: "build-unresolved", channel: resolution.channel, reason: resolution.reason });
110
+ if (resolution.kind === "old-channel-resolution")
111
+ await progress.emit({
112
+ kind: "old-channel-resolution",
113
+ channel: resolution.channel,
114
+ build: resolution.build,
115
+ ageMinutes: minutesSince(resolution.learnedAt, context.clock.now()),
116
+ });
117
+ if (signal.aborted)
118
+ return canceled();
119
+ const match = buildMatch(resolution);
120
+ await progress.emit({ kind: "leasing", match, requested: request.sandboxes });
121
+ const leasedOutcome = await leaseUsable(context, {
122
+ match,
123
+ count: request.sandboxes,
124
+ minTimeLeftMinutes: request.minTimeLeftMinutes,
125
+ });
126
+ if (!leasedOutcome.ok)
127
+ return { kind: "pool-unreadable", failure: leasedOutcome.failure };
128
+ const { report } = leasedOutcome;
129
+ held.push(...report.leased.map(({ host }) => host));
130
+ await progress.emit({ kind: "leased", match, requested: request.sandboxes, report });
131
+ const reused = report.leased.map(({ entry }) => ({
132
+ testserverUrl: entry.testserverUrl,
133
+ logViewerUrl: entry.logViewerUrl,
134
+ origin: "reused",
135
+ }));
136
+ let uncreated;
137
+ let notCreated = 0;
138
+ const missing = request.sandboxes - reused.length;
139
+ if (missing > 0 && create === undefined) {
140
+ if (reused.length === 0)
141
+ return { kind: "no-usable-sandboxes", requested: request.sandboxes, match };
142
+ notCreated = missing;
143
+ }
144
+ else if (missing > 0 && create !== undefined) {
145
+ if (signal.aborted)
146
+ return canceled();
147
+ const { rejected, credentialFailure, uncreatedCount, ...made } = await createMissing(context, { source: create.source, build: request.build, ttlMinutes: create.ttlMinutes, count: missing }, signal, progress, held);
148
+ tally = made;
149
+ if (rejected !== undefined)
150
+ return {
151
+ kind: "credential-rejected",
152
+ failure: rejected.failure,
153
+ origin: create.source.origin(rejected.credential),
154
+ ttlMinutes: create.ttlMinutes,
155
+ failedCreates: tally.failedCreates,
156
+ unpooled: tally.unpooled,
157
+ };
158
+ if (signal.aborted)
159
+ return canceled();
160
+ if (credentialFailure !== undefined) {
161
+ if (reused.length === 0 && tally.created.length === 0)
162
+ return credentialFailed(credentialFailure, create.ttlMinutes, tally.failedCreates);
163
+ uncreated = { count: uncreatedCount, failure: credentialFailure };
164
+ }
165
+ if (reused.length === 0 && tally.created.length === 0)
166
+ return {
167
+ kind: "no-sandboxes",
168
+ requested: request.sandboxes,
169
+ ttlMinutes: create.ttlMinutes,
170
+ failedCreates: tally.failedCreates,
171
+ };
172
+ }
173
+ const sandboxes = [...reused, ...tally.created];
174
+ if (signal.aborted)
175
+ return canceled();
176
+ return {
177
+ kind: "provisioned",
178
+ resolution,
179
+ sandboxes,
180
+ failedCreates: tally.failedCreates,
181
+ unpooled: tally.unpooled,
182
+ uncreated,
183
+ notCreated,
184
+ };
185
+ }
186
+ /**
187
+ * Creates `count` Testserver sandboxes, 8 at a time, each leased as it exists. It asks `source` for a credential
188
+ * once before it reports the creates, so a source that can't give one stops it before any create, with every create
189
+ * uncreated. Each create asks `source` for a credential again first, and keeps that one through its retries. Each
190
+ * host leased is pushed onto `held` inside its create, before anything can throw, so the run releases it however it
191
+ * ends. A rejection, the source failing or `signal` aborting starts no more creates, and the creates in flight
192
+ * settle. A task admitted before one of those checks again once it has its credential, since getting one can wait on
193
+ * a token request and its retries. Every create that started is tallied before it returns, so whichever way the run
194
+ * goes on, it can report what was created and what may be left behind. `rejected` is the first rejection, if any,
195
+ * with the credential it was refused; no rejection is among `failedCreates`. `credentialFailure` is the source's
196
+ * first failure, if any, and `uncreatedCount` how many creates never ran.
197
+ */
198
+ async function createMissing(context, request, signal, progress, held) {
199
+ const { source, build, ttlMinutes, count } = request;
200
+ const first = await source.get();
201
+ if (!first.ok)
202
+ return {
203
+ created: [],
204
+ failedCreates: [],
205
+ unpooled: [],
206
+ rejected: undefined,
207
+ credentialFailure: first.failure,
208
+ uncreatedCount: count,
209
+ };
210
+ await progress.emit({ kind: "creating", count, build });
211
+ let rejected;
212
+ let credentialFailure;
213
+ const mayCreate = () => rejected === undefined && credentialFailure === undefined && !signal.aborted;
214
+ const outcomes = await runLimited(count, CREATE_CONCURRENCY, mayCreate, async (index) => {
215
+ const got = await source.get();
216
+ if (!got.ok) {
217
+ credentialFailure ??= got.failure;
218
+ return undefined;
219
+ }
220
+ // Getting the credential can wait on a token request and its retries, and the run may have stopped meanwhile.
221
+ if (!mayCreate())
222
+ return undefined;
223
+ const { credential } = got;
224
+ await progress.emit({ kind: "create-started", index, count });
225
+ const outcome = await createPooledSandbox(context, { credential, build, ttlMinutes, lease: true }, { onProgress: (message) => progress.emit({ kind: "create-progress", index, count, message }) });
226
+ if (outcome.kind === "pooled")
227
+ held.push(outcome.host);
228
+ if (outcome.kind === "create-failed" && outcome.failure.kind === "rejected")
229
+ rejected ??= { failure: outcome.failure, credential };
230
+ await progress.emit({ kind: "create-finished", index, count, outcome });
231
+ return outcome;
232
+ });
233
+ const created = [];
234
+ const failedCreates = [];
235
+ const unpooled = [];
236
+ let uncreatedCount = 0;
237
+ for (const outcome of outcomes) {
238
+ if (outcome === undefined) {
239
+ uncreatedCount += 1;
240
+ continue;
241
+ }
242
+ if (outcome.kind === "create-failed") {
243
+ const { failure } = outcome;
244
+ if (failure.kind !== "rejected")
245
+ failedCreates.push(failure);
246
+ continue;
247
+ }
248
+ const { testserverUrl, logViewerUrl } = outcome.entry;
249
+ created.push({ testserverUrl, logViewerUrl, origin: "created" });
250
+ if (outcome.kind === "pool-write-failed")
251
+ unpooled.push({ testserverUrl, failure: outcome.failure });
252
+ }
253
+ return { created, failedCreates, unpooled, rejected, credentialFailure, uncreatedCount };
254
+ }
@@ -0,0 +1,87 @@
1
+ import { z } from "zod";
2
+ import type { ResourceRanReport } from "../../core/index.ts";
3
+ import type { FailedCreate, TestserverPoolKind, UnpooledSandbox } from "./provider.ts";
4
+ /** One create that failed: its kind, and what the Testserver control plane or the connection said, if anything. */
5
+ export declare const createFailureSchema: z.ZodObject<{
6
+ kind: z.ZodEnum<{
7
+ "connect-failed": "connect-failed";
8
+ dropped: "dropped";
9
+ "http-error": "http-error";
10
+ malformed: "malformed";
11
+ "stream-ended": "stream-ended";
12
+ "stream-error": "stream-error";
13
+ timeout: "timeout";
14
+ }>;
15
+ detail: z.ZodNullable<z.ZodString>;
16
+ }, z.core.$strip>;
17
+ /** A created Testserver sandbox the run couldn't add to the pool: the pool path and what the OS said. */
18
+ export declare const unpooledSchema: z.ZodObject<{
19
+ testserverUrl: z.ZodString;
20
+ path: z.ZodString;
21
+ message: z.ZodString;
22
+ }, z.core.$strip>;
23
+ /** The created Testserver sandboxes a run couldn't add to the pool, as outcomes report them. */
24
+ export declare function unpooledFacts(unpooled: readonly UnpooledSandbox[]): {
25
+ path: string;
26
+ message: string;
27
+ testserverUrl: string;
28
+ }[];
29
+ /** The failed creates a run went on without, as outcomes report them. */
30
+ export declare function failedCreateFacts(failures: readonly FailedCreate[]): {
31
+ kind: "connect-failed" | "dropped" | "http-error" | "malformed" | "stream-ended" | "stream-error" | "timeout";
32
+ detail: string | null;
33
+ }[];
34
+ /** What a ran outcome says of the Testserver pool, under `resources.testserverPool`. */
35
+ declare const schema: z.ZodObject<{
36
+ build: z.ZodObject<{
37
+ requested: z.ZodString;
38
+ resolved: z.ZodNullable<z.ZodString>;
39
+ }, z.core.$strip>;
40
+ sandboxes: z.ZodArray<z.ZodObject<{
41
+ testserverUrl: z.ZodString;
42
+ logViewerUrl: z.ZodString;
43
+ origin: z.ZodEnum<{
44
+ created: "created";
45
+ reused: "reused";
46
+ }>;
47
+ }, z.core.$strip>>;
48
+ reused: z.ZodNumber;
49
+ created: z.ZodNumber;
50
+ failedCreates: z.ZodArray<z.ZodObject<{
51
+ kind: z.ZodEnum<{
52
+ "connect-failed": "connect-failed";
53
+ dropped: "dropped";
54
+ "http-error": "http-error";
55
+ malformed: "malformed";
56
+ "stream-ended": "stream-ended";
57
+ "stream-error": "stream-error";
58
+ timeout: "timeout";
59
+ }>;
60
+ detail: z.ZodNullable<z.ZodString>;
61
+ }, z.core.$strip>>;
62
+ unpooled: z.ZodArray<z.ZodObject<{
63
+ testserverUrl: z.ZodString;
64
+ path: z.ZodString;
65
+ message: z.ZodString;
66
+ }, z.core.$strip>>;
67
+ uncreated: z.ZodNullable<z.ZodObject<{
68
+ count: z.ZodNumber;
69
+ source: z.ZodEnum<{
70
+ "github-actions": "github-actions";
71
+ mint: "mint";
72
+ }>;
73
+ cause: z.ZodString;
74
+ fix: z.ZodString;
75
+ }, z.core.$strip>>;
76
+ notCreated: z.ZodNumber;
77
+ }, z.core.$strip>;
78
+ /** What a ran outcome says of the Testserver pool, as its schema holds it. */
79
+ export type TestserverRanFacts = z.output<typeof schema>;
80
+ /**
81
+ * The Testserver pool's ran report. Its facts come from what provisioning held and its request's build; its warnings
82
+ * name failed creates, created Testserver sandboxes it couldn't pool, more it couldn't create when the credential
83
+ * source failed, and, under noCreate, how many it couldn't lease. Its row lists each Testserver sandbox with its log
84
+ * viewer URL, as the sandbox list did.
85
+ */
86
+ export declare const testserverPoolRanReport: ResourceRanReport<TestserverPoolKind>;
87
+ export {};
@@ -0,0 +1,140 @@
1
+ // The Testserver pool resource's ran report: what a `ran` outcome says of it under `resources.testserverPool`, the
2
+ // Testserver sandboxes and how the run got them, and the warnings it gives for what the pool couldn't do. It also holds
3
+ // how outcomes report a failed create and an unpooled Testserver sandbox, which its errors (`command.ts`) report too.
4
+ import { z } from "zod";
5
+ import { describeCredentialFailure } from "../../credential/index.js";
6
+ import { createFailureText, describeCreateFailure } from "./sandbox/index.js";
7
+ const createFailureKinds = [
8
+ "connect-failed",
9
+ "http-error",
10
+ "stream-error",
11
+ "stream-ended",
12
+ "dropped",
13
+ "timeout",
14
+ "malformed",
15
+ ];
16
+ /** One create that failed: its kind, and what the Testserver control plane or the connection said, if anything. */
17
+ export const createFailureSchema = z.object({
18
+ kind: z.enum(createFailureKinds),
19
+ detail: z.string().nullable(),
20
+ });
21
+ /** A created Testserver sandbox the run couldn't add to the pool: the pool path and what the OS said. */
22
+ export const unpooledSchema = z.object({ testserverUrl: z.string(), path: z.string(), message: z.string() });
23
+ /** The created Testserver sandboxes a run couldn't add to the pool, as outcomes report them. */
24
+ export function unpooledFacts(unpooled) {
25
+ return unpooled.map(({ testserverUrl, failure }) => ({ testserverUrl, ...failure }));
26
+ }
27
+ /** The failed creates a run went on without, as outcomes report them. */
28
+ export function failedCreateFacts(failures) {
29
+ return failures.map((failure) => {
30
+ const { kind, detail } = describeCreateFailure(failure);
31
+ return { kind, detail };
32
+ });
33
+ }
34
+ /** What a ran outcome says of the Testserver pool, under `resources.testserverPool`. */
35
+ const schema = z.object({
36
+ /** What the build setting asked for and the build it resolved to. */
37
+ build: z.object({
38
+ /** The build or build channel the build setting gave. */
39
+ requested: z.string(),
40
+ /** The build it resolved to; null when a build channel couldn't be resolved and was matched as written. */
41
+ resolved: z.string().nullable(),
42
+ }),
43
+ /** The sandbox list: reused Testserver sandboxes first, freshest first, then created ones. */
44
+ sandboxes: z.array(z.object({
45
+ testserverUrl: z.string(),
46
+ logViewerUrl: z.string(),
47
+ origin: z.enum(["reused", "created"]),
48
+ })),
49
+ reused: z.number(),
50
+ created: z.number(),
51
+ /** The creates that failed, which the run went on without. */
52
+ failedCreates: z.array(createFailureSchema),
53
+ /** Created Testserver sandboxes the run used but couldn't add to the pool. */
54
+ unpooled: z.array(unpooledSchema),
55
+ /** When the credential source failed with some Testserver sandboxes in hand: how many more weren't created, which source failed, and why. */
56
+ uncreated: z
57
+ .object({
58
+ count: z.number(),
59
+ source: z.enum(["mint", "github-actions"]),
60
+ cause: z.string(),
61
+ fix: z.string(),
62
+ })
63
+ .nullable(),
64
+ /** Under noCreate, how many of the requested Testserver sandboxes the pool couldn't supply, which the run didn't create; 0 otherwise. */
65
+ notCreated: z.number(),
66
+ });
67
+ /**
68
+ * The Testserver pool's ran report. Its facts come from what provisioning held and its request's build; its warnings
69
+ * name failed creates, created Testserver sandboxes it couldn't pool, more it couldn't create when the credential
70
+ * source failed, and, under noCreate, how many it couldn't lease. Its row lists each Testserver sandbox with its log
71
+ * viewer URL, as the sandbox list did.
72
+ */
73
+ export const testserverPoolRanReport = {
74
+ schema,
75
+ facts: (facts, request) => {
76
+ const { resolution, sandboxes } = facts;
77
+ return {
78
+ build: { requested: request.build, resolved: resolution.kind === "as-written" ? null : resolution.build },
79
+ sandboxes: sandboxes.map(({ testserverUrl, logViewerUrl, origin }) => ({ testserverUrl, logViewerUrl, origin })),
80
+ reused: sandboxes.filter((sandbox) => sandbox.origin === "reused").length,
81
+ created: sandboxes.filter((sandbox) => sandbox.origin === "created").length,
82
+ failedCreates: failedCreateFacts(facts.failedCreates),
83
+ unpooled: unpooledFacts(facts.unpooled),
84
+ uncreated: facts.uncreated === undefined
85
+ ? null
86
+ : {
87
+ count: facts.uncreated.count,
88
+ source: facts.uncreated.failure.source,
89
+ ...describeCredentialFailure(facts.uncreated.failure),
90
+ },
91
+ notCreated: facts.notCreated,
92
+ };
93
+ },
94
+ warnings: (ran) => [
95
+ ...(ran.failedCreates.length === 0
96
+ ? []
97
+ : [
98
+ {
99
+ reason: "creates_failed",
100
+ message: `${ran.failedCreates.length} of ${ran.failedCreates.length + ran.created} creates failed (${ran.failedCreates.map(createFailureText).join("; ")}); the command ran on ${ran.sandboxes.length} Testserver sandboxes.`,
101
+ },
102
+ ]),
103
+ ...ran.unpooled.map(({ testserverUrl, message }) => ({
104
+ reason: "sandbox_not_pooled",
105
+ message: `Used the Testserver sandbox ${testserverUrl}, but couldn't add it to the pool: ${message}`,
106
+ })),
107
+ ...(ran.uncreated === null
108
+ ? []
109
+ : [
110
+ ran.uncreated.source === "mint"
111
+ ? {
112
+ reason: "mint_failed",
113
+ message: `Couldn't create ${ran.uncreated.count} more Testserver sandboxes: couldn't mint a credential: ${ran.uncreated.cause}. ${ran.uncreated.fix}`,
114
+ }
115
+ : {
116
+ reason: "token_request_failed",
117
+ message: `Couldn't create ${ran.uncreated.count} more Testserver sandboxes: couldn't request a GitHub Actions OIDC token: ${ran.uncreated.cause}. ${ran.uncreated.fix}`,
118
+ },
119
+ ]),
120
+ ...(ran.notCreated === 0
121
+ ? []
122
+ : [
123
+ {
124
+ reason: "sandboxes_not_created",
125
+ message: `noCreate: ${ran.notCreated} of ${ran.notCreated + ran.sandboxes.length} Testserver sandboxes couldn't be leased, and none were created; the command ran on ${ran.sandboxes.length}.`,
126
+ },
127
+ ]),
128
+ ],
129
+ rows: (ran) => ran.sandboxes.length === 0
130
+ ? []
131
+ : [
132
+ [
133
+ "Testserver",
134
+ ran.sandboxes.flatMap(({ testserverUrl, logViewerUrl, origin }) => [
135
+ `${testserverUrl} (${origin})`,
136
+ ` logs ${logViewerUrl}`,
137
+ ]),
138
+ ],
139
+ ],
140
+ };
@@ -0,0 +1,12 @@
1
+ import type { Provider } from "../../core/index.ts";
2
+ import type { TestserverCommandApp } from "./commands/app.ts";
3
+ import { testserverPoolCommand } from "./command.ts";
4
+ import { testserverPoolConfig } from "./config.ts";
5
+ import { type TestserverPoolKind } from "./provider.ts";
6
+ /**
7
+ * The Testserver pool resource, `resources.testserverPool`. A stale Testserver variable from the host could point the
8
+ * command at other Testserver sandboxes than the run payload names, so the command never sees one; a runner recipe's
9
+ * `vcpus` function sees its sandbox count. Its own commands, `pool create` and `pool list`, are `commands/`, mounted as
10
+ * `storm pool`.
11
+ */
12
+ export declare const testserverPoolProvider: Provider<"testserverPool", TestserverPoolKind, typeof testserverPoolCommand, typeof testserverPoolConfig, TestserverCommandApp>;
@@ -0,0 +1,38 @@
1
+ // The Testserver pool resource's provider: the one value the folder hands the host, which only the registry
2
+ // (`src/resources.ts`) takes.
3
+ import { join } from "node:path";
4
+ import { testserverPoolCleanupReport } from "./cleanup.js";
5
+ import { testserverPoolCommand } from "./command.js";
6
+ import { testserverPoolConfig } from "./config.js";
7
+ import { testserverPoolLane } from "./lane.js";
8
+ import { liveTestserverPoolGateways } from "./live/gateways.js";
9
+ import { testserverPoolPresentation } from "./presentation.js";
10
+ import { testserverPoolRunProvider } from "./provider.js";
11
+ import { testserverPoolRanReport } from "./ran.js";
12
+ import { STALE_TESTSERVER_VARIABLES } from "./run-sandbox.js";
13
+ /**
14
+ * The Testserver pool resource, `resources.testserverPool`. A stale Testserver variable from the host could point the
15
+ * command at other Testserver sandboxes than the run payload names, so the command never sees one; a runner recipe's
16
+ * `vcpus` function sees its sandbox count. Its own commands, `pool create` and `pool list`, are `commands/`, mounted as
17
+ * `storm pool`.
18
+ */
19
+ export const testserverPoolProvider = {
20
+ name: "testserverPool",
21
+ run: testserverPoolRunProvider,
22
+ command: testserverPoolCommand,
23
+ config: testserverPoolConfig,
24
+ cleanup: testserverPoolCleanupReport,
25
+ ran: testserverPoolRanReport,
26
+ lane: testserverPoolLane,
27
+ presentation: testserverPoolPresentation,
28
+ liveGateways: liveTestserverPoolGateways,
29
+ hostVariablesToDrop: STALE_TESTSERVER_VARIABLES,
30
+ runnerResources: ({ sandboxes }) => ({ testserverPool: { sandboxes } }),
31
+ commands: {
32
+ mount: {
33
+ source: { id: "testserver", directory: join(import.meta.dirname, "commands") },
34
+ path: ["pool"],
35
+ description: "Inspect and maintain your pool of Testserver sandboxes.",
36
+ },
37
+ },
38
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The Testserver pool resource's options: the Testserver sandboxes a run holds for its command. `storm run
3
+ * --set resources.testserverPool.<option>=<value>` overrides each one, and `pool create` reads `build` and `ttl`.
4
+ */
5
+ export interface TestserverPoolOptions {
6
+ /** How many Testserver sandboxes a run gets: 1 to 32; 1 by default. */
7
+ readonly sandboxes?: number;
8
+ /** A build name, or the build channel `stable` or `latest_main`; `stable` by default. */
9
+ readonly build?: string;
10
+ /** The least time left a Testserver sandbox from the pool needs, such as `30m` or `2h`; `30m` by default. */
11
+ readonly minTimeLeft?: string;
12
+ /** How long each Testserver sandbox created lives, from `10m` to `5h`; `5h` by default. Longer than `minTimeLeft`. */
13
+ readonly ttl?: string;
14
+ /**
15
+ * Run only on Testserver sandboxes already in the pool: never mint for Testserver and never create. `ttl` doesn't
16
+ * apply. `false` by default.
17
+ */
18
+ readonly noCreate?: boolean;
19
+ }
20
+ /**
21
+ * The Testserver pool resource, which `testserverPool()` makes: a value storm reads under
22
+ * `resources.testserverPool`. Treat it as opaque; make it only with `testserverPool()`.
23
+ */
24
+ export interface TestserverPoolResource {
25
+ readonly kind: "testserverPool";
26
+ readonly options: TestserverPoolOptions;
27
+ }
28
+ /**
29
+ * The Testserver pool resource for `resources.testserverPool` in `storm.config.ts`. Its presence gives a run a
30
+ * Testserver side; `testserverPool()` takes every default.
31
+ */
32
+ export declare function testserverPool(options?: TestserverPoolOptions): TestserverPoolResource;
@@ -0,0 +1,10 @@
1
+ // The Testserver pool resource's published surface, `@cnc-tools/storm/testserver`. A user's `storm.config.ts`
2
+ // imports it, so, like `@cnc-tools/storm/config`, it imports nothing at run time: loading a config file pulls in no
3
+ // Clinkr, zod or CLI code.
4
+ /**
5
+ * The Testserver pool resource for `resources.testserverPool` in `storm.config.ts`. Its presence gives a run a
6
+ * Testserver side; `testserverPool()` takes every default.
7
+ */
8
+ export function testserverPool(options = {}) {
9
+ return { kind: "testserverPool", options: { ...options } };
10
+ }
@@ -0,0 +1,13 @@
1
+ /** Where a Testserver sandbox a run holds came from: taken from the pool, or made for this run. */
2
+ export type SandboxOrigin = "reused" | "created";
3
+ /** One Testserver sandbox in a run's sandbox list. */
4
+ export interface RunSandbox {
5
+ readonly testserverUrl: string;
6
+ readonly logViewerUrl: string;
7
+ readonly origin: SandboxOrigin;
8
+ }
9
+ /**
10
+ * Variables a run leaves out of its command's environment, so a stale value can't point the command at other
11
+ * Testserver sandboxes than the run payload names.
12
+ */
13
+ export declare const STALE_TESTSERVER_VARIABLES: readonly string[];
@@ -0,0 +1,6 @@
1
+ // The Testserver sandboxes a run holds, as its sandbox list, its facts and its command's connection name them.
2
+ /**
3
+ * Variables a run leaves out of its command's environment, so a stale value can't point the command at other
4
+ * Testserver sandboxes than the run payload names.
5
+ */
6
+ export const STALE_TESTSERVER_VARIABLES = ["TESTSERVER_BASES", "TESTSERVER_BASE"];
@@ -0,0 +1,12 @@
1
+ import type { Builds } from "./gateways.ts";
2
+ /** The build channels: moving names the Testserver control plane resolves to a build. */
3
+ export declare const BUILD_CHANNELS: readonly ["stable", "latest_main"];
4
+ export type BuildChannel = (typeof BUILD_CHANNELS)[number];
5
+ /** Whether `build` is a build channel rather than a build named directly. */
6
+ export declare function isBuildChannel(build: string): build is BuildChannel;
7
+ /**
8
+ * The build `build` names, according to `builds`: `stable` resolves to `builds.stable`, `latest_main` to the
9
+ * newest main build, and anything else is a build named directly, which resolves to itself. `undefined` when
10
+ * the channel points to no build.
11
+ */
12
+ export declare function resolveChannel(builds: Builds, build: string): string | undefined;
@@ -0,0 +1,21 @@
1
+ /** The build channels: moving names the Testserver control plane resolves to a build. */
2
+ export const BUILD_CHANNELS = ["stable", "latest_main"];
3
+ /** Whether `build` is a build channel rather than a build named directly. */
4
+ export function isBuildChannel(build) {
5
+ return BUILD_CHANNELS.includes(build);
6
+ }
7
+ /**
8
+ * The build `build` names, according to `builds`: `stable` resolves to `builds.stable`, `latest_main` to the
9
+ * newest main build, and anything else is a build named directly, which resolves to itself. `undefined` when
10
+ * the channel points to no build.
11
+ */
12
+ export function resolveChannel(builds, build) {
13
+ switch (build) {
14
+ case "stable":
15
+ return builds.stable?.name;
16
+ case "latest_main":
17
+ return builds.main[0]?.name;
18
+ default:
19
+ return build;
20
+ }
21
+ }