@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,80 @@
1
+ import { inspect } from "node:util";
2
+ const RENDERED = "[credential]";
3
+ /**
4
+ * A credential: an OIDC token the Testserver control plane accepts for creating Testserver sandboxes.
5
+ *
6
+ * It renders as `[credential]` everywhere (`String`, template literals, `JSON.stringify`, `util.inspect`
7
+ * and so `console.log`), so storm never prints one by accident. Only a credential gateway constructs
8
+ * one. `reveal()` is for the Testserver control plane's request header and the runner's live Sandbox gateway, and
9
+ * nothing else.
10
+ */
11
+ export class Credential {
12
+ #token;
13
+ #claims;
14
+ constructor(token) {
15
+ this.#token = token;
16
+ }
17
+ /**
18
+ * The token itself, for the Testserver control plane's request header and the runner's live Sandbox gateway (which
19
+ * hands it to `@vercel/sandbox`) only.
20
+ */
21
+ reveal() {
22
+ return this.#token;
23
+ }
24
+ /**
25
+ * The team and project the token was minted for, from its `owner_id` and `project_id` JWT claims, decoded once.
26
+ * `undefined` when the token isn't a JWT or lacks either claim. The token itself never leaves the credential.
27
+ */
28
+ vercelProject() {
29
+ const { owner_id: teamId, project_id: projectId } = this.#decoded() ?? {};
30
+ if (!isFilled(teamId) || !isFilled(projectId))
31
+ return undefined;
32
+ return { teamId, projectId };
33
+ }
34
+ /**
35
+ * The `aud` and `repository` claims of a GitHub Actions OIDC token, which Testserver's Trusted Sources match on.
36
+ * `undefined` when the token isn't a JWT or lacks either claim as a non-empty string. The token itself never
37
+ * leaves the credential.
38
+ */
39
+ githubActionsClaims() {
40
+ const { aud, repository } = this.#decoded() ?? {};
41
+ if (!isFilled(aud) || !isFilled(repository))
42
+ return undefined;
43
+ return { aud, repository };
44
+ }
45
+ /** The token's JWT claims, decoded once; `undefined` when it isn't a JWT with an object payload. */
46
+ #decoded() {
47
+ if (this.#claims === undefined)
48
+ this.#claims = decodeClaims(this.#token) ?? null;
49
+ return this.#claims ?? undefined;
50
+ }
51
+ toString() {
52
+ return RENDERED;
53
+ }
54
+ toJSON() {
55
+ return RENDERED;
56
+ }
57
+ [inspect.custom]() {
58
+ return RENDERED;
59
+ }
60
+ }
61
+ /** The claims of a JWT's payload, or `undefined` when the token isn't a JWT with an object payload. */
62
+ function decodeClaims(token) {
63
+ const parts = token.split(".");
64
+ const payload = parts[1];
65
+ if (parts.length !== 3 || payload === undefined || payload === "")
66
+ return undefined;
67
+ let claims;
68
+ try {
69
+ claims = JSON.parse(Buffer.from(payload, "base64url").toString("utf8"));
70
+ }
71
+ catch {
72
+ return undefined;
73
+ }
74
+ if (typeof claims !== "object" || claims === null || Array.isArray(claims))
75
+ return undefined;
76
+ return claims;
77
+ }
78
+ function isFilled(value) {
79
+ return typeof value === "string" && value !== "";
80
+ }
@@ -0,0 +1,18 @@
1
+ import type { MintFailure, MintTarget } from "./gateways.ts";
2
+ import type { CredentialFailure, CredentialOrigin, TokenRequestFailure } from "./source.ts";
3
+ /** One cause and one fix for a credential source's failure, worded for the person running storm. */
4
+ export interface CredentialDiagnosis {
5
+ readonly cause: string;
6
+ readonly fix: string;
7
+ }
8
+ /** Names the cause of a failed mint and the one fix for it. */
9
+ export declare function describeMintFailure(failure: MintFailure, target: MintTarget): CredentialDiagnosis;
10
+ /** Names the cause of a failed GitHub Actions OIDC token request and the one fix for it. */
11
+ export declare function describeTokenRequestFailure(failure: TokenRequestFailure): CredentialDiagnosis;
12
+ /** Names the cause of a credential source's failure and the one fix for it, for whichever source it was. */
13
+ export declare function describeCredentialFailure(failure: CredentialFailure): CredentialDiagnosis;
14
+ /**
15
+ * How to fix a credential the Testserver control plane rejected, by where it came from. A GitHub Actions OIDC
16
+ * token's fix names its `aud` and `repository` claims, or placeholders for them when they can't be read.
17
+ */
18
+ export declare function rejectedCredentialFix(origin: CredentialOrigin): string;
@@ -0,0 +1,99 @@
1
+ /** Names the cause of a failed mint and the one fix for it. */
2
+ export function describeMintFailure(failure, target) {
3
+ const loginStep = `\`vercel login\` with an account on the \`${target.team}\` team`;
4
+ const networkFix = "Check your network connection and any VPN or proxy, then retry.";
5
+ switch (failure.kind) {
6
+ case "vercel-not-found":
7
+ return {
8
+ cause: "`vercel` is not on PATH",
9
+ fix: `Install it with \`npm i -g vercel@latest\`, run ${loginStep}, then retry.`,
10
+ };
11
+ case "timeout":
12
+ return {
13
+ cause: failure.step.command === "project token"
14
+ ? `\`vercel project token\` timed out after ${failure.seconds}s`
15
+ : `${whoamiCheck(failure.step.mintSaid)} timed out after ${failure.seconds}s`,
16
+ fix: networkFix,
17
+ };
18
+ case "unreachable":
19
+ return {
20
+ cause: failure.step.command === "project token"
21
+ ? `\`vercel project token\` couldn't reach Vercel: ${failure.said}`
22
+ : `${whoamiCheck(failure.step.mintSaid)} couldn't reach Vercel: ${failure.said}`,
23
+ fix: networkFix,
24
+ };
25
+ case "outdated-cli":
26
+ return {
27
+ cause: `\`vercel\` on PATH is older than 53.3.0, the first with \`project token --format=json\`: ${failure.said}`,
28
+ fix: "Upgrade it with `npm i -g vercel@latest`, then retry.",
29
+ };
30
+ case "project-not-found":
31
+ return {
32
+ cause: `\`vercel\` found no project \`${target.project}\` on team \`${target.team}\`: ${failure.said}`,
33
+ fix: `Check the project name in \`--project\` or \`storm.config.ts\` (\`project\`) for team \`${target.team}\`, then retry.`,
34
+ };
35
+ case "unrecognized":
36
+ return {
37
+ cause: `\`vercel project token\` failed: ${failure.said}`,
38
+ fix: "Retry. If it fails the same way again, act on what `vercel` said.",
39
+ };
40
+ case "login-lapsed":
41
+ return {
42
+ cause: `the saved \`vercel login\` is missing, expired or invalid (\`vercel whoami\`: ${failure.whoamiSaid}). \`vercel project token\` said: ${failure.said}`,
43
+ fix: `Run ${loginStep}, then retry.`,
44
+ };
45
+ case "no-team-access": {
46
+ const user = failure.user ?? "the logged-in account";
47
+ const works = failure.user === undefined ? "`vercel whoami` works" : `\`vercel whoami\` works, as ${failure.user}`;
48
+ return {
49
+ cause: `${failure.said} (${works})`,
50
+ fix: `Check the team name in \`--scope\` or \`storm.config.ts\` (\`scope\`). Then ask an owner of the \`${target.team}\` team to add ${user}; if ${user} is already a member, run \`vercel login\` again, then retry.`,
51
+ };
52
+ }
53
+ }
54
+ }
55
+ /** The start of a cause from the `vercel whoami` step: what the mint said, and why storm ran `whoami`. */
56
+ function whoamiCheck(mintSaid) {
57
+ return `\`vercel project token\` failed: ${mintSaid}. \`vercel whoami\`, run to check the login,`;
58
+ }
59
+ /** Names the cause of a failed GitHub Actions OIDC token request and the one fix for it. */
60
+ export function describeTokenRequestFailure(failure) {
61
+ if (failure.kind === "variables-missing")
62
+ return {
63
+ cause: `${variablesText(failure.missing)} ${failure.missing.length === 1 ? "isn't" : "aren't"} set; GitHub Actions sets them only in a job with \`id-token: write\``,
64
+ fix: "Add `permissions: id-token: write` to the job, then rerun it.",
65
+ };
66
+ const { last, attempts } = failure;
67
+ const tries = attempts === 1 ? "" : ` (${attempts} attempts)`;
68
+ const fix = "Rerun the job. If the request fails again, act on what GitHub answered.";
69
+ switch (last.kind) {
70
+ case "unreachable":
71
+ return { cause: `the token request couldn't reach GitHub${tries}: ${last.said}`, fix };
72
+ case "timeout":
73
+ return { cause: `GitHub didn't answer the token request within ${last.seconds}s${tries}`, fix };
74
+ case "http-error":
75
+ return { cause: `GitHub answered the token request with HTTP ${last.status}${tries}: ${last.said}`, fix };
76
+ case "bad-response":
77
+ return { cause: `GitHub's answer to the token request held no token: ${last.said}`, fix };
78
+ }
79
+ }
80
+ /** Names the cause of a credential source's failure and the one fix for it, for whichever source it was. */
81
+ export function describeCredentialFailure(failure) {
82
+ return failure.source === "mint"
83
+ ? describeMintFailure(failure.failure, failure.target)
84
+ : describeTokenRequestFailure(failure.failure);
85
+ }
86
+ /**
87
+ * How to fix a credential the Testserver control plane rejected, by where it came from. A GitHub Actions OIDC
88
+ * token's fix names its `aud` and `repository` claims, or placeholders for them when they can't be read.
89
+ */
90
+ export function rejectedCredentialFix(origin) {
91
+ if (origin.source === "mint")
92
+ return "The Testserver control plane trusts development OIDC tokens only from projects in its Trusted Sources; vercel-internal mints for project vercel on team vercel. Use a trusted team and project, then retry.";
93
+ const aud = origin.claims?.aud ?? "https://github.com/<owner>";
94
+ const repository = origin.claims?.repository ?? "<owner>/<repo>";
95
+ return `The Testserver control plane trusts GitHub Actions OIDC tokens only from repositories in its Trusted Sources. Ask the \`vercel/testserver\` owners for a Trusted Source rule matching \`aud: ${aud}\` and \`repository: ${repository}\`, then rerun the job.`;
96
+ }
97
+ function variablesText(missing) {
98
+ return missing.map((name) => `\`${name}\``).join(" and ");
99
+ }
@@ -0,0 +1,109 @@
1
+ import type { Credential } from "./credential.ts";
2
+ /** The team and project whose development OIDC tokens the Testserver control plane trusts. */
3
+ export interface MintTarget {
4
+ readonly team: string;
5
+ readonly project: string;
6
+ }
7
+ /**
8
+ * Which `vercel` run a failure came from: the mint, or the `vercel whoami` that checks the login after the
9
+ * mint reported an access failure. `mintSaid` is what the mint said, which is why storm ran `whoami`.
10
+ */
11
+ export type MintStep = {
12
+ readonly command: "project token";
13
+ } | {
14
+ readonly command: "whoami";
15
+ readonly mintSaid: string;
16
+ };
17
+ /**
18
+ * Why a mint failed. `said` is what `vercel` printed: the `message` (and `reason`) of a JSON error on
19
+ * stdout, or else its stderr `Error:` line or last stderr line. It is never raw stdout, which may hold a
20
+ * token. `unrecognized` is a failure storm can't explain; it claims no cause. A timeout or a network
21
+ * failure records its `step`, so one from `vercel whoami` is never taken for a lapsed login.
22
+ */
23
+ export type MintFailure = {
24
+ readonly kind: "vercel-not-found";
25
+ } | {
26
+ readonly kind: "timeout";
27
+ readonly step: MintStep;
28
+ readonly seconds: number;
29
+ } | {
30
+ readonly kind: "unreachable";
31
+ readonly step: MintStep;
32
+ readonly said: string;
33
+ } | {
34
+ readonly kind: "outdated-cli";
35
+ readonly said: string;
36
+ } | {
37
+ readonly kind: "project-not-found";
38
+ readonly said: string;
39
+ } | {
40
+ readonly kind: "unrecognized";
41
+ readonly said: string;
42
+ } | {
43
+ readonly kind: "login-lapsed";
44
+ readonly said: string;
45
+ readonly whoamiSaid: string;
46
+ } | {
47
+ readonly kind: "no-team-access";
48
+ readonly said: string;
49
+ readonly user: string | undefined;
50
+ };
51
+ export type MintOutcome = {
52
+ readonly ok: true;
53
+ readonly credential: Credential;
54
+ } | {
55
+ readonly ok: false;
56
+ readonly failure: MintFailure;
57
+ };
58
+ /**
59
+ * Mints credentials. One call is one mint attempt, and it never rejects: every failure is a
60
+ * `MintFailure`. Callers decide how often to call it (see `mintSource`).
61
+ */
62
+ export interface CredentialGateway {
63
+ mint(target: MintTarget): Promise<MintOutcome>;
64
+ }
65
+ /** The variables GitHub Actions sets in a job with `id-token: write`, which a token request needs. */
66
+ export type TokenRequestVariable = "ACTIONS_ID_TOKEN_REQUEST_URL" | "ACTIONS_ID_TOKEN_REQUEST_TOKEN";
67
+ /**
68
+ * Why one GitHub Actions OIDC token request failed. `said` is what GitHub or the connection said, at most 200
69
+ * characters, with the request token and anything shaped like a token redacted. A 2xx answer, which may hold a
70
+ * token, is only described, never quoted.
71
+ *
72
+ * - `variables-missing`: `missing` aren't set, so there was nothing to request from.
73
+ * - `unreachable`: the request failed before GitHub answered.
74
+ * - `timeout`: GitHub didn't answer within `seconds`.
75
+ * - `http-error`: GitHub answered with a status that isn't 2xx.
76
+ * - `bad-response`: GitHub answered 2xx with a body that isn't JSON or holds no token in `value`.
77
+ */
78
+ export type TokenAttemptFailure = {
79
+ readonly kind: "variables-missing";
80
+ readonly missing: readonly TokenRequestVariable[];
81
+ } | {
82
+ readonly kind: "unreachable";
83
+ readonly said: string;
84
+ } | {
85
+ readonly kind: "timeout";
86
+ readonly seconds: number;
87
+ } | {
88
+ readonly kind: "http-error";
89
+ readonly status: number;
90
+ readonly said: string;
91
+ } | {
92
+ readonly kind: "bad-response";
93
+ readonly said: string;
94
+ };
95
+ export type TokenAttemptOutcome = {
96
+ readonly ok: true;
97
+ readonly credential: Credential;
98
+ } | {
99
+ readonly ok: false;
100
+ readonly failure: TokenAttemptFailure;
101
+ };
102
+ /**
103
+ * Requests GitHub Actions OIDC tokens, with GitHub's default audience. One call is one request, and it never
104
+ * rejects: every failure is a `TokenAttemptFailure`. Callers decide when to call it and whether to retry (see
105
+ * `githubActionsSource`).
106
+ */
107
+ export interface GitHubActionsTokenGateway {
108
+ request(): Promise<TokenAttemptOutcome>;
109
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ export { Credential, type GitHubActionsClaims, type VercelProject } from "./credential.ts";
2
+ export { describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, type CredentialDiagnosis, rejectedCredentialFix, } from "./diagnosis.ts";
3
+ export type { CredentialGateway, GitHubActionsTokenGateway, MintFailure, MintOutcome, MintStep, MintTarget, TokenAttemptFailure, TokenAttemptOutcome, TokenRequestVariable, } from "./gateways.ts";
4
+ export { liveGitHubActionsTokenGateway } from "./live/github-actions-token-gateway.ts";
5
+ export { liveCredentialGateway } from "./live/vercel-cli-gateway.ts";
6
+ export { credentialErrors, requireTarget, settleCredential } from "./settle.ts";
7
+ export { type CredentialFailure, type CredentialOrigin, type CredentialOutcome, type CredentialSource, type CredentialSourceChoice, credentialSourceFor, githubActionsSource, mintSource, type TokenRequestFailure, } from "./source.ts";
@@ -0,0 +1,7 @@
1
+ // The `credential` module's public surface. Other modules import only from here.
2
+ export { Credential } from "./credential.js";
3
+ export { describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, rejectedCredentialFix, } from "./diagnosis.js";
4
+ export { liveGitHubActionsTokenGateway } from "./live/github-actions-token-gateway.js";
5
+ export { liveCredentialGateway } from "./live/vercel-cli-gateway.js";
6
+ export { credentialErrors, requireTarget, settleCredential } from "./settle.js";
7
+ export { credentialSourceFor, githubActionsSource, mintSource, } from "./source.js";
@@ -0,0 +1,15 @@
1
+ import type { GitHubActionsTokenGateway } from "../gateways.ts";
2
+ export interface LiveGitHubActionsTokenOptions {
3
+ /** The environment the two `ACTIONS_ID_TOKEN_REQUEST_*` variables are read from, at each request. */
4
+ readonly env: Readonly<Record<string, string | undefined>>;
5
+ /** How long one request may take, answer included; 10 seconds by default. */
6
+ readonly timeoutMs?: number;
7
+ }
8
+ /**
9
+ * Requests GitHub Actions OIDC tokens over `fetch`, as `@actions/core`'s `getIDToken()` does with no audience:
10
+ * `GET $ACTIONS_ID_TOKEN_REQUEST_URL` with `Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN`, answered with
11
+ * `{ "value": "<jwt>" }`. It reads the two variables only when it requests, wraps the token in a `Credential` as soon
12
+ * as it has one, and puts what GitHub or the connection said in a failure only through `said`, which redacts the
13
+ * request token and anything shaped like a token. Never rejects.
14
+ */
15
+ export declare function liveGitHubActionsTokenGateway(options: LiveGitHubActionsTokenOptions): GitHubActionsTokenGateway;
@@ -0,0 +1,43 @@
1
+ import { classifyTokenResponse, said } from "./github-actions-token-response.js";
2
+ /**
3
+ * Requests GitHub Actions OIDC tokens over `fetch`, as `@actions/core`'s `getIDToken()` does with no audience:
4
+ * `GET $ACTIONS_ID_TOKEN_REQUEST_URL` with `Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN`, answered with
5
+ * `{ "value": "<jwt>" }`. It reads the two variables only when it requests, wraps the token in a `Credential` as soon
6
+ * as it has one, and puts what GitHub or the connection said in a failure only through `said`, which redacts the
7
+ * request token and anything shaped like a token. Never rejects.
8
+ */
9
+ export function liveGitHubActionsTokenGateway(options) {
10
+ const timeoutMs = options.timeoutMs ?? 10_000;
11
+ return { request: () => request(options.env, timeoutMs) };
12
+ }
13
+ async function request(env, timeoutMs) {
14
+ const url = env["ACTIONS_ID_TOKEN_REQUEST_URL"];
15
+ const token = env["ACTIONS_ID_TOKEN_REQUEST_TOKEN"];
16
+ const missing = [
17
+ ...(url === undefined || url === "" ? ["ACTIONS_ID_TOKEN_REQUEST_URL"] : []),
18
+ ...(token === undefined || token === "" ? ["ACTIONS_ID_TOKEN_REQUEST_TOKEN"] : []),
19
+ ];
20
+ if (url === undefined || token === undefined || missing.length > 0)
21
+ return { ok: false, failure: { kind: "variables-missing", missing } };
22
+ const signal = AbortSignal.timeout(timeoutMs);
23
+ const seconds = timeoutMs / 1000;
24
+ try {
25
+ const response = await fetch(url, {
26
+ headers: { authorization: `Bearer ${token}`, accept: "application/json" },
27
+ signal,
28
+ });
29
+ return classifyTokenResponse({ status: response.status, body: await response.text() }, token);
30
+ }
31
+ catch (error) {
32
+ if (signal.aborted)
33
+ return { ok: false, failure: { kind: "timeout", seconds } };
34
+ return { ok: false, failure: { kind: "unreachable", said: said(errorMessage(error), token) } };
35
+ }
36
+ }
37
+ /** An error's message, with its cause's message appended when it has one. */
38
+ function errorMessage(error) {
39
+ if (!(error instanceof Error))
40
+ return String(error);
41
+ const cause = error.cause;
42
+ return cause instanceof Error && cause.message !== "" ? `${error.message}: ${cause.message}` : error.message;
43
+ }
@@ -0,0 +1,19 @@
1
+ import type { TokenAttemptOutcome } from "../gateways.ts";
2
+ /** How much of GitHub's answer a failure quotes. */
3
+ export declare const SAID_LIMIT = 200;
4
+ /**
5
+ * What GitHub's answer to a token request means: a credential when it answered 2xx with JSON whose `value` is a
6
+ * non-empty string; else `http-error` quoting the body, or `bad-response`. A failure never quotes a token: a non-2xx
7
+ * body is quoted through `said`, a 2xx body, which may hold a token, is never quoted, and JSON without a token in
8
+ * `value` is described by its keys.
9
+ */
10
+ export declare function classifyTokenResponse(response: {
11
+ readonly status: number;
12
+ readonly body: string;
13
+ }, requestToken: string): TokenAttemptOutcome;
14
+ /**
15
+ * `text` as a failure may quote it: the request token and anything shaped like a JWT replaced with `[redacted]`,
16
+ * then on one line, trimmed, at most `SAID_LIMIT` characters, marked with `…` when cut. Redacting comes first, so a
17
+ * cut never leaves part of a token behind.
18
+ */
19
+ export declare function said(text: string, requestToken: string): string;
@@ -0,0 +1,49 @@
1
+ import { Credential } from "../credential.js";
2
+ /** How much of GitHub's answer a failure quotes. */
3
+ export const SAID_LIMIT = 200;
4
+ /** A JWT, or the start of one cut short, as a GitHub Actions OIDC token appears in text. */
5
+ const JWT_PATTERN = /eyJ[A-Za-z0-9_-]*(?:\.[A-Za-z0-9_-]*){0,2}/g;
6
+ /**
7
+ * What GitHub's answer to a token request means: a credential when it answered 2xx with JSON whose `value` is a
8
+ * non-empty string; else `http-error` quoting the body, or `bad-response`. A failure never quotes a token: a non-2xx
9
+ * body is quoted through `said`, a 2xx body, which may hold a token, is never quoted, and JSON without a token in
10
+ * `value` is described by its keys.
11
+ */
12
+ export function classifyTokenResponse(response, requestToken) {
13
+ const { status, body } = response;
14
+ if (status < 200 || status >= 300)
15
+ return { ok: false, failure: { kind: "http-error", status, said: said(body, requestToken) } };
16
+ let parsed;
17
+ try {
18
+ parsed = JSON.parse(body);
19
+ }
20
+ catch {
21
+ return {
22
+ ok: false,
23
+ failure: { kind: "bad-response", said: `an answer that isn't JSON (${body.length} characters)` },
24
+ };
25
+ }
26
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
27
+ return { ok: false, failure: { kind: "bad-response", said: "a JSON answer that isn't an object" } };
28
+ const { value } = parsed;
29
+ if (typeof value === "string" && value !== "")
30
+ return { ok: true, credential: new Credential(value) };
31
+ const keys = Object.keys(parsed);
32
+ return {
33
+ ok: false,
34
+ failure: {
35
+ kind: "bad-response",
36
+ said: said(`a JSON answer with no token in "value" (${keys.length === 0 ? "no keys" : `keys: ${keys.join(", ")}`})`, requestToken),
37
+ },
38
+ };
39
+ }
40
+ /**
41
+ * `text` as a failure may quote it: the request token and anything shaped like a JWT replaced with `[redacted]`,
42
+ * then on one line, trimmed, at most `SAID_LIMIT` characters, marked with `…` when cut. Redacting comes first, so a
43
+ * cut never leaves part of a token behind.
44
+ */
45
+ export function said(text, requestToken) {
46
+ const redacted = (requestToken === "" ? text : text.replaceAll(requestToken, "[redacted]")).replace(JWT_PATTERN, "[redacted]");
47
+ const line = redacted.replace(/\s+/g, " ").trim();
48
+ return line.length <= SAID_LIMIT ? line : `${line.slice(0, SAID_LIMIT - 1)}…`;
49
+ }
@@ -0,0 +1,9 @@
1
+ import type { CredentialGateway, MintTarget } from "../gateways.ts";
2
+ /** The arguments of the mint: `vercel project token <project> --scope <team> --format=json`. */
3
+ export declare function mintArgs(target: MintTarget): readonly string[];
4
+ /**
5
+ * Mints with the `vercel` CLI. An access failure (an unknown scope, or no access to the account) runs
6
+ * `vercel whoami` once to tell a lapsed login from missing team access; no other failure runs it. Never rejects, and wraps the token in a `Credential` as
7
+ * soon as it has one.
8
+ */
9
+ export declare function liveCredentialGateway(): CredentialGateway;
@@ -0,0 +1,64 @@
1
+ import { execFile } from "node:child_process";
2
+ import { tmpdir } from "node:os";
3
+ import { Credential } from "../credential.js";
4
+ import { classifyMint, classifyWhoami } from "./vercel-output.js";
5
+ import { VERCEL_TIMEOUT_MS } from "./vercel-process.js";
6
+ /** The arguments of the mint: `vercel project token <project> --scope <team> --format=json`. */
7
+ export function mintArgs(target) {
8
+ return ["project", "token", target.project, "--scope", target.team, "--format=json"];
9
+ }
10
+ /**
11
+ * Mints with the `vercel` CLI. An access failure (an unknown scope, or no access to the account) runs
12
+ * `vercel whoami` once to tell a lapsed login from missing team access; no other failure runs it. Never rejects, and wraps the token in a `Credential` as
13
+ * soon as it has one.
14
+ */
15
+ export function liveCredentialGateway() {
16
+ return {
17
+ async mint(target) {
18
+ const minted = classifyMint(await runVercel(mintArgs(target)));
19
+ switch (minted.kind) {
20
+ case "token":
21
+ return { ok: true, credential: new Credential(minted.token) };
22
+ case "failure":
23
+ return { ok: false, failure: minted.failure };
24
+ case "needs-whoami":
25
+ return { ok: false, failure: classifyWhoami(await runVercel(["whoami"]), minted.said) };
26
+ }
27
+ },
28
+ };
29
+ }
30
+ /**
31
+ * Runs `vercel` with `args`, with no shell, in `os.tmpdir()` so no linked project in the working directory
32
+ * changes what it does, with color and the update notifier off and a 30s timeout. Never rejects.
33
+ *
34
+ * It uses `execFile`'s callback form rather than `promisify(execFile)`, whose stdout-and-stderr result
35
+ * depends on `util.promisify.custom`.
36
+ */
37
+ function runVercel(args) {
38
+ return new Promise((resolve) => {
39
+ try {
40
+ execFile("vercel", args, {
41
+ cwd: tmpdir(),
42
+ env: { ...process.env, NO_COLOR: "1", NO_UPDATE_NOTIFIER: "1" },
43
+ timeout: VERCEL_TIMEOUT_MS,
44
+ maxBuffer: 16 * 1024 * 1024,
45
+ encoding: "utf8",
46
+ }, (error, stdout, stderr) => {
47
+ resolve(error === null ? { ok: true, stdout, stderr } : failedRun(error, stdout, stderr));
48
+ });
49
+ }
50
+ catch (error) {
51
+ resolve(failedRun(error, "", ""));
52
+ }
53
+ });
54
+ }
55
+ function failedRun(error, stdout, stderr) {
56
+ const fields = typeof error === "object" && error !== null ? error : {};
57
+ const out = typeof stdout === "string" ? stdout : "";
58
+ const err = typeof stderr === "string" ? stderr : "";
59
+ if (fields["killed"] === true)
60
+ return { ok: false, reason: "timeout", stdout: out, stderr: err };
61
+ if (fields["code"] === "ENOENT")
62
+ return { ok: false, reason: "not-found", stdout: out, stderr: err };
63
+ return { ok: false, reason: "exit", stdout: out, stderr: err };
64
+ }
@@ -0,0 +1,60 @@
1
+ import type { MintFailure } from "../gateways.ts";
2
+ import { type VercelRun } from "./vercel-process.ts";
3
+ /**
4
+ * `vercel` is older than 53.3.0, the first with `project token --format=json`: 50.25.0 to 53.2.x reject the
5
+ * flag, and older ones have no `project token`.
6
+ */
7
+ export declare const OUTDATED: RegExp;
8
+ /** `vercel` couldn't reach the Vercel API. */
9
+ export declare const UNREACHABLE: RegExp;
10
+ /** The team has no project by that name: the CLI's project lookup, or a 404 from the token endpoint. */
11
+ export declare const PROJECT_NOT_FOUND: RegExp;
12
+ /**
13
+ * The `--scope` matches no team the account belongs to. The CLI prints this for a misspelled team and for a
14
+ * team the account isn't in alike, and for a lapsed login too, so it sends the mint to `vercel whoami`.
15
+ */
16
+ export declare const SCOPE_NOT_FOUND = "The specified scope does not exist";
17
+ /**
18
+ * The account can't reach the team: the CLI reports a lapsed login this way, as well as missing access, so
19
+ * it sends the mint to `vercel whoami`.
20
+ */
21
+ export declare const ACCOUNT_ACCESS = "You do not have access to the specified account";
22
+ /** What a mint run means before `vercel whoami` is consulted; `needs-whoami` only for an access failure. */
23
+ export type MintClassification = {
24
+ readonly kind: "token";
25
+ readonly token: string;
26
+ } | {
27
+ readonly kind: "failure";
28
+ readonly failure: MintFailure;
29
+ } | {
30
+ readonly kind: "needs-whoami";
31
+ readonly said: string;
32
+ };
33
+ /** The `token` field of `vercel project token --format=json` output, when it is a non-empty string. */
34
+ export declare function parseToken(stdout: string): string | undefined;
35
+ /**
36
+ * What `vercel` said went wrong: the `message` of a JSON error on stdout (with its `reason`), else the
37
+ * stderr `Error:` line, else the last stderr line. Never raw stdout, which may hold a token.
38
+ */
39
+ export declare function errorText(run: {
40
+ readonly stdout: string;
41
+ readonly stderr: string;
42
+ }): string;
43
+ /** The account `vercel whoami` names: the last non-empty line of its stdout. */
44
+ export declare function whoamiUser(stdout: string): string | undefined;
45
+ /**
46
+ * Classifies a `vercel project token` run, in order: a token, `vercel` missing, a timeout, an unreachable
47
+ * network, an outdated CLI, an unknown project, and an access failure (an unknown scope, or no access to
48
+ * the account), which needs `vercel whoami` to tell a lapsed login from missing team access. The project
49
+ * check comes before the access check because resolving the project means the login worked. Anything else,
50
+ * including a successful run that printed no token, is `unrecognized`: storm claims no cause for it.
51
+ */
52
+ export declare function classifyMint(run: VercelRun): MintClassification;
53
+ /**
54
+ * Classifies the `vercel whoami` run that follows a mint's access failure; `mintSaid` is what the mint
55
+ * said. A working `whoami` means the account lacks access to the team. A `whoami` that `vercel` itself
56
+ * refuses means the saved login is missing, expired or invalid. A `whoami` that times out or can't reach
57
+ * Vercel is a network failure of the `whoami` step, never a lapsed login, and one that can't run is
58
+ * `vercel-not-found`.
59
+ */
60
+ export declare function classifyWhoami(run: VercelRun, mintSaid: string): MintFailure;