@cnc-tools/storm 0.0.0-stage → 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 +123 -4
  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,351 @@
1
+ import type { Credential } from "../credential/index.ts";
2
+ /** Why a checkout operation failed: what git or tar said, and the command that failed when there was one. */
3
+ export interface CheckoutFailure {
4
+ readonly message: string;
5
+ /** The failed command as a person would type it, such as `git -C /repo diff --binary …`. */
6
+ readonly displayCommand?: string;
7
+ }
8
+ export type CheckoutResult<T> = {
9
+ readonly ok: true;
10
+ readonly value: T;
11
+ } | {
12
+ readonly ok: false;
13
+ readonly failure: CheckoutFailure;
14
+ };
15
+ /**
16
+ * What `baseCandidate` found for one ref.
17
+ *
18
+ * - `merge-base`: the ref exists, and `base` is HEAD's merge-base with it, a full SHA.
19
+ * - `missing-ref`: no local ref by that name resolves to a commit.
20
+ * - `unrelated`: the ref exists but shares no history with HEAD.
21
+ */
22
+ export type BaseCandidate = {
23
+ readonly kind: "merge-base";
24
+ readonly base: string;
25
+ } | {
26
+ readonly kind: "missing-ref";
27
+ } | {
28
+ readonly kind: "unrelated";
29
+ } | {
30
+ readonly kind: "failed";
31
+ readonly failure: CheckoutFailure;
32
+ };
33
+ /** A file at a commit: its text, or `missing` when the commit has no file at that path. */
34
+ export type FileAtCommit = {
35
+ readonly kind: "found";
36
+ readonly text: string;
37
+ } | {
38
+ readonly kind: "missing";
39
+ } | {
40
+ readonly kind: "failed";
41
+ readonly failure: CheckoutFailure;
42
+ };
43
+ /** Where a checkout's HEAD is: its branch, null when detached, its commit, a full SHA, and whether the working tree has changes `git status` reports, untracked files included. */
44
+ export interface CheckoutHead {
45
+ readonly branch: string | null;
46
+ readonly commit: string;
47
+ readonly dirty: boolean;
48
+ }
49
+ /** What one run uploads on top of the runner snapshot of its base. */
50
+ export interface CheckoutUpload {
51
+ /** `git diff --binary <base>` of the working tree: staged and unstaged changes, deletions, modes, binaries. Empty when unchanged. */
52
+ readonly patch: Uint8Array;
53
+ /** The untracked files Git doesn't ignore, relative to the repository's root. */
54
+ readonly untracked: readonly string[];
55
+ /** A gzip tarball of `untracked`, or `undefined` when there are none. */
56
+ readonly untrackedTarball: Uint8Array | undefined;
57
+ /** The untracked nested Git repositories left out, relative to the repository's root, without a trailing slash. */
58
+ readonly nestedRepositories: readonly string[];
59
+ }
60
+ /** A base's tracked files, for a runner snapshot build. */
61
+ export interface BaseArchive {
62
+ /** `git archive --format=tar.gz <base>`, with LF line endings whatever the checkout's `core.autocrlf`. */
63
+ readonly tarball: Uint8Array;
64
+ /** The base's tracked paths, each followed by a NUL. */
65
+ readonly fileList: Uint8Array;
66
+ /** How many paths `fileList` holds. */
67
+ readonly files: number;
68
+ }
69
+ /**
70
+ * The local Git checkout a runner run uploads from, and whose HEAD every run records. Every method returns its
71
+ * expected failures and never rejects.
72
+ * The live gateway runs git and tar; what a base is, which one wins, and what counts as a refusal are the caller's.
73
+ */
74
+ export interface CheckoutGateway {
75
+ /** The root of the Git worktree `cwd` is in. */
76
+ repositoryRoot(request: {
77
+ readonly cwd: string;
78
+ }): Promise<CheckoutResult<string>>;
79
+ /** Where HEAD is; a failure for an unborn HEAD. */
80
+ head(request: {
81
+ readonly repoRoot: string;
82
+ }): Promise<CheckoutResult<CheckoutHead>>;
83
+ /** Whether local ref `ref` exists, and HEAD's merge-base with it. */
84
+ baseCandidate(request: {
85
+ readonly repoRoot: string;
86
+ readonly ref: string;
87
+ }): Promise<BaseCandidate>;
88
+ /**
89
+ * Whether commit `ancestor` is `descendant` or one of its ancestors (`git merge-base --is-ancestor`). An
90
+ * `ancestor` missing from the clone is not. `descendant` may be `HEAD`.
91
+ */
92
+ contains(request: {
93
+ readonly repoRoot: string;
94
+ readonly ancestor: string;
95
+ readonly descendant: string;
96
+ }): Promise<CheckoutResult<boolean>>;
97
+ /** When `commit` was committed, in milliseconds since the epoch. */
98
+ commitTime(request: {
99
+ readonly repoRoot: string;
100
+ readonly commit: string;
101
+ }): Promise<CheckoutResult<number>>;
102
+ /** The text of `path`, relative to the repository's root, at `commit`. */
103
+ readFileAt(request: {
104
+ readonly repoRoot: string;
105
+ readonly commit: string;
106
+ readonly path: string;
107
+ }): Promise<FileAtCommit>;
108
+ /** The paths of the checkout's Git submodules (gitlinks in the index). */
109
+ submodules(request: {
110
+ readonly repoRoot: string;
111
+ }): Promise<CheckoutResult<readonly string[]>>;
112
+ /** What a run uploads on top of `base`. */
113
+ assembleUpload(request: {
114
+ readonly repoRoot: string;
115
+ readonly base: string;
116
+ }): Promise<CheckoutResult<CheckoutUpload>>;
117
+ /** `base`'s tracked files. */
118
+ baseArchive(request: {
119
+ readonly repoRoot: string;
120
+ readonly base: string;
121
+ }): Promise<CheckoutResult<BaseArchive>>;
122
+ }
123
+ /**
124
+ * One runner snapshot the cache records: who it belongs to, what it was built from, and when it expires. Times
125
+ * are ISO strings.
126
+ */
127
+ export interface RunnerSnapshotEntry {
128
+ readonly teamId: string;
129
+ readonly projectId: string;
130
+ readonly region: string;
131
+ readonly runtime: string;
132
+ readonly recipeName: string;
133
+ /** The snapshot key at `base` (`snapshotKey`). */
134
+ readonly snapshotKey: string;
135
+ /** The base commit's full SHA. */
136
+ readonly base: string;
137
+ readonly snapshotId: string;
138
+ readonly createdAt: string;
139
+ readonly expiresAt: string;
140
+ }
141
+ /** A cache file storm can't read: not JSON, of an unknown version, invalid, or misnamed. */
142
+ export interface UnreadableSnapshotEntry {
143
+ readonly file: string;
144
+ readonly reason: string;
145
+ }
146
+ /** What `listEntries` found. */
147
+ export interface RunnerSnapshotListing {
148
+ /** Where the cache lives. */
149
+ readonly directory: string;
150
+ readonly entries: readonly RunnerSnapshotEntry[];
151
+ readonly unreadable: readonly UnreadableSnapshotEntry[];
152
+ }
153
+ /** Why a cache operation failed: the path it failed on and what the OS said. */
154
+ export interface RunnerSnapshotCacheFailure {
155
+ readonly path: string;
156
+ readonly message: string;
157
+ }
158
+ export type RunnerSnapshotCacheResult<T> = {
159
+ readonly ok: true;
160
+ readonly value: T;
161
+ } | {
162
+ readonly ok: false;
163
+ readonly failure: RunnerSnapshotCacheFailure;
164
+ };
165
+ export type RunnerSnapshotCacheOperation = {
166
+ readonly ok: true;
167
+ } | {
168
+ readonly ok: false;
169
+ readonly failure: RunnerSnapshotCacheFailure;
170
+ };
171
+ /**
172
+ * The per-machine runner snapshot cache: one record per runner snapshot, keyed by the entry's identity (team,
173
+ * project, region, runtime, recipe name, snapshot key and base). Every method returns its expected failures and
174
+ * never rejects. Which entries a run may use, and when one has expired, is the caller's.
175
+ */
176
+ export interface RunnerSnapshotCacheGateway {
177
+ /** Every readable entry, and the files it couldn't read. A cache never written is empty. */
178
+ listEntries(): Promise<RunnerSnapshotCacheResult<RunnerSnapshotListing>>;
179
+ /** Records `entry`, replacing any entry with the same identity. */
180
+ writeEntry(entry: RunnerSnapshotEntry): Promise<RunnerSnapshotCacheOperation>;
181
+ /** Removes the entry with `entry`'s identity. Removing one that isn't there succeeds. */
182
+ removeEntry(entry: RunnerSnapshotEntry): Promise<RunnerSnapshotCacheOperation>;
183
+ }
184
+ /** What every Sandbox call runs as: the run's credential, and the team and project its token names. */
185
+ export interface SandboxAccess {
186
+ readonly credential: Credential;
187
+ readonly teamId: string;
188
+ readonly projectId: string;
189
+ }
190
+ /** What a sandbox is for: running the command, or building a runner snapshot. */
191
+ export type RunnerSandboxRole = "runner" | "snapshot-build";
192
+ /**
193
+ * A sandbox a runner gateway started, bound to the access it was started with. Only the gateway that returned it
194
+ * may be handed it back.
195
+ */
196
+ export interface RunnerSandbox {
197
+ readonly name: string;
198
+ readonly role: RunnerSandboxRole;
199
+ /** How long it may live, in milliseconds, after which the Sandbox API stops it. */
200
+ readonly timeoutMs: number;
201
+ }
202
+ /** What every sandbox is created with, whatever it starts from. */
203
+ export interface RunnerSandboxPlacement {
204
+ readonly region: string;
205
+ readonly vcpus: number;
206
+ readonly timeoutMs: number;
207
+ /** At most 5: `purpose`, `user` and `role`. */
208
+ readonly tags: Readonly<Record<string, string>>;
209
+ }
210
+ /**
211
+ * Why a Sandbox call failed.
212
+ *
213
+ * - `api`: the Sandbox API refused or failed; `status` is the HTTP status when it answered one.
214
+ * - `aborted`: the caller's signal aborted the call.
215
+ */
216
+ export type RunnerSandboxFailure = {
217
+ readonly kind: "api";
218
+ readonly status: number | undefined;
219
+ readonly message: string;
220
+ } | {
221
+ readonly kind: "aborted";
222
+ };
223
+ /**
224
+ * Why keeping a sandbox running failed: any Sandbox failure, or `processes-running` when a process the gateway started
225
+ * in it didn't end when it was told to, so the sandbox can't be handed to a person as idle.
226
+ */
227
+ export type RunnerKeepFailure = RunnerSandboxFailure | {
228
+ readonly kind: "processes-running";
229
+ readonly message: string;
230
+ };
231
+ /** Why a start from a runner snapshot failed: any Sandbox failure, or `snapshot-gone` on the API's 410. */
232
+ export type RunnerStartFailure = RunnerSandboxFailure | {
233
+ readonly kind: "snapshot-gone";
234
+ readonly message: string;
235
+ };
236
+ export type RunnerSandboxResult<T, F = RunnerSandboxFailure> = {
237
+ readonly ok: true;
238
+ readonly value: T;
239
+ } | {
240
+ readonly ok: false;
241
+ readonly failure: F;
242
+ };
243
+ export type RunnerSandboxOperation = {
244
+ readonly ok: true;
245
+ } | {
246
+ readonly ok: false;
247
+ readonly failure: RunnerSandboxFailure;
248
+ };
249
+ /** One chunk of a remote process's output, as it arrives; a chunk may hold part of a line, or several. */
250
+ export interface RemoteOutputChunk {
251
+ readonly stream: "stdout" | "stderr";
252
+ readonly data: string;
253
+ }
254
+ /** How a remote process ended: its exit code, or `null` when the Sandbox API reported none. */
255
+ export interface RemoteExit {
256
+ readonly exitCode: number | null;
257
+ }
258
+ /** A file to stage in a sandbox: its name in the staging directory and its bytes. */
259
+ export interface StagedFile {
260
+ readonly name: string;
261
+ readonly content: Uint8Array;
262
+ }
263
+ /** A runner snapshot a build sandbox was saved as. */
264
+ export interface SavedSnapshot {
265
+ readonly snapshotId: string;
266
+ /** When the Sandbox API says it expires, as an ISO string, when it says. */
267
+ readonly expiresAt: string | undefined;
268
+ readonly sizeBytes: number;
269
+ }
270
+ /**
271
+ * Vercel Sandbox, as the runner uses it. Every method returns its expected failures and never rejects. Which
272
+ * snapshot to start from, what the scripts say, and who stops what when are the caller's. Aborting a script, the
273
+ * command or a follow stops the gateway waiting for it, not always the process: a process the gateway started can
274
+ * outlive the call, and only `keepRunning` and `stop` end every one.
275
+ */
276
+ export interface RunnerSandboxGateway {
277
+ /** Starts a fresh build sandbox on `runtime`, not persistent. */
278
+ startBuildSandbox(access: SandboxAccess, request: RunnerSandboxPlacement & {
279
+ readonly runtime: string;
280
+ }, signal?: AbortSignal): Promise<RunnerSandboxResult<RunnerSandbox>>;
281
+ /** Starts a runner sandbox from runner snapshot `snapshotId`, not persistent; `snapshot-gone` when it is gone. */
282
+ startRunnerSandbox(access: SandboxAccess, request: RunnerSandboxPlacement & {
283
+ readonly snapshotId: string;
284
+ }, signal?: AbortSignal): Promise<RunnerSandboxResult<RunnerSandbox, RunnerStartFailure>>;
285
+ /** Writes `files` to the sandbox's own staging directory, made once per sandbox, and answers its path. */
286
+ upload(sandbox: RunnerSandbox, files: readonly StagedFile[], signal?: AbortSignal): Promise<RunnerSandboxResult<{
287
+ readonly directory: string;
288
+ }>>;
289
+ /** Runs a bash script with `bash -lc` in the repository's root, streaming its output to `onOutput`. */
290
+ runScript(sandbox: RunnerSandbox, request: {
291
+ readonly script: string;
292
+ readonly env: Readonly<Record<string, string>>;
293
+ }, onOutput: (chunk: RemoteOutputChunk) => void, signal?: AbortSignal): Promise<RunnerSandboxResult<RemoteExit>>;
294
+ /** The `PATH` a login shell has in the sandbox. */
295
+ loginPath(sandbox: RunnerSandbox, signal?: AbortSignal): Promise<RunnerSandboxResult<string>>;
296
+ /**
297
+ * Runs `cmd` with `args` in `cwd`, without a shell or stdin, its environment the sandbox's own with `env` on top,
298
+ * streaming its output to `onOutput`. A bare `cmd` is looked up on `env`'s `PATH`. When `kill` aborts, it sends the
299
+ * command SIGTERM and answers `aborted`.
300
+ */
301
+ runCommand(sandbox: RunnerSandbox, request: {
302
+ readonly cmd: string;
303
+ readonly args: readonly string[];
304
+ readonly cwd: string;
305
+ readonly env: Readonly<Record<string, string>>;
306
+ }, onOutput: (chunk: RemoteOutputChunk) => void, kill: AbortSignal): Promise<RunnerSandboxResult<RemoteExit>>;
307
+ /**
308
+ * Follows the test events file at `path` in the sandbox from its first line as it grows, streaming what is
309
+ * appended to `onOutput`, until `stop` aborts; the file needn't exist yet. Answers once it has stopped following.
310
+ */
311
+ followTestEvents(sandbox: RunnerSandbox, request: {
312
+ readonly path: string;
313
+ }, onOutput: (chunk: RemoteOutputChunk) => void, stop: AbortSignal): Promise<RunnerSandboxOperation>;
314
+ /**
315
+ * Streams the test events file at `path` in the sandbox from 1-based line `fromLine` to its end, as stdout chunks
316
+ * to `onOutput`; a file that doesn't exist reads as empty. Aborting `signal` stops the read and answers `aborted`.
317
+ */
318
+ readTestEvents(sandbox: RunnerSandbox, request: {
319
+ readonly path: string;
320
+ readonly fromLine: number;
321
+ }, onOutput: (chunk: RemoteOutputChunk) => void, signal?: AbortSignal): Promise<RunnerSandboxOperation>;
322
+ /** Saves a build sandbox as a runner snapshot that expires after `expirationMs`; that stops the sandbox. */
323
+ saveSnapshot(sandbox: RunnerSandbox, request: {
324
+ readonly expirationMs: number;
325
+ }): Promise<RunnerSandboxResult<SavedSnapshot>>;
326
+ /**
327
+ * Hands a running sandbox over idle, for a person to connect to: it first ends every process the gateway started in
328
+ * it that may still run (a script, the command or a follow, aborted or not), each with SIGTERM and then SIGKILL, and
329
+ * fails with `processes-running` when it can't confirm one ended. A script or command asked to start once it began
330
+ * answers `aborted` and starts nothing. Then it keeps the sandbox running at least `until`, extending its timeout
331
+ * when it would stop sooner, and answers when it stops: `until`, or later when its timeout already reached past it.
332
+ * The Sandbox API can extend a running sandbox's timeout but never shorten it.
333
+ */
334
+ keepRunning(sandbox: RunnerSandbox, request: {
335
+ readonly until: Date;
336
+ }): Promise<RunnerSandboxResult<{
337
+ readonly stopsAt: Date;
338
+ }, RunnerKeepFailure>>;
339
+ stop(sandbox: RunnerSandbox): Promise<RunnerSandboxOperation>;
340
+ /** Deletes a sandbox, keeping every snapshot it was started from or saved as. */
341
+ delete(sandbox: RunnerSandbox): Promise<RunnerSandboxOperation>;
342
+ }
343
+ /**
344
+ * The terminal a remote command's output reaches, a DI seam: stdout and stderr, and whether the terminal shows
345
+ * color. Writes never throw. A local command's output reaches it too: the name stays from when only a runner run's did.
346
+ */
347
+ export interface RunnerTerminal {
348
+ readonly color: boolean;
349
+ writeStdout(text: string): void;
350
+ writeStderr(text: string): void;
351
+ }
@@ -0,0 +1,3 @@
1
+ // The runner's gateways: on this machine, the Git checkout a run uploads from and the runner snapshot cache; remotely,
2
+ // Vercel Sandbox, where runner and build sandboxes run. And the terminal a remote command's output reaches.
3
+ export {};
@@ -0,0 +1,19 @@
1
+ export { type BaseResolution, type RefusedBaseRef, resolveBase } from "./base.ts";
2
+ export type { RunnerContext } from "./context.ts";
3
+ export { type KeptSandbox, type NotDeletedSandbox, type NotKeptSandbox, type NotStoppedSandbox, type RunnerEvent, type RunnerFailure, type RunnerOutputSection, type RunnerProgress, type RunnerSandboxCall, type RunnerStage, type RunnerStepPhase, } from "./events.ts";
4
+ export type { BaseArchive, BaseCandidate, CheckoutFailure, CheckoutHead, CheckoutGateway, CheckoutResult, CheckoutUpload, FileAtCommit, RemoteExit, RemoteOutputChunk, RunnerKeepFailure, RunnerSandbox, RunnerSandboxFailure, RunnerSandboxGateway, RunnerSandboxOperation, RunnerSandboxPlacement, RunnerSandboxResult, RunnerSandboxRole, RunnerSnapshotCacheFailure, RunnerSnapshotCacheGateway, RunnerSnapshotCacheOperation, RunnerSnapshotCacheResult, RunnerSnapshotEntry, RunnerSnapshotListing, RunnerStartFailure, RunnerTerminal, SandboxAccess, SavedSnapshot, StagedFile, UnreadableSnapshotEntry, } from "./gateways.ts";
5
+ export { liveCheckoutGateway } from "./live/checkout-gateway.ts";
6
+ export { liveRunnerSandboxGateway } from "./live/sandbox-gateway.ts";
7
+ export { liveRunnerTerminal, type TerminalStream } from "./live/terminal.ts";
8
+ export { localUserName } from "./live/user.ts";
9
+ export { liveRunnerSnapshotCacheGateway, type LiveRunnerSnapshotCacheOptions, unavailableRunnerSnapshotCacheGateway, } from "./live/snapshot-cache-gateway.ts";
10
+ export { lineSplitter, type LineSplitter, OUTPUT_TAIL_LINES, outputRule, outputTail, type OutputTail, rewritePaths, splitLines, } from "./output.ts";
11
+ export { type PreparedRunner, prepareRunner, type PrepareRunnerOutcome, type PrepareRunnerRequest, type RunnerPrepareContext, } from "./prepare.ts";
12
+ export { APPLY_LABEL, type ReadyRunner, readyRunner, type ReadyRunnerOutcome, type ReadyRunnerRequest, } from "./ready.ts";
13
+ export { type CheckedRecipe, checkRecipe, type RecipeCheck, type RecipeProblem, resolveSteps, resolveVcpus, type RunnerRecipe, type RunnerResources, type RunnerStep, type RunnerStepContext, type RunnerSteps, } from "./recipe.ts";
14
+ export { REMOTE_TEST_EVENTS_PATH, type RemoteCommandOutcome, remoteCommand, remoteEnvironment, type RemoteTestEvents, runRemote, } from "./remote-command.ts";
15
+ export { CREATE_SETTLE_MS, type RunnerSandboxScope, runnerSandboxScope, type RunnerScopeReport, SNAPSHOT_SETTLE_MS, } from "./scope.ts";
16
+ export { BASE_INDEX_LABEL, buildSnapshot, type BuildSnapshotRequest, type BuiltSnapshot } from "./snapshot-build.ts";
17
+ export { findSnapshotCandidates, pickSnapshot, RUNNER_SNAPSHOTS_SUBPATH, type RunnerSnapshotCandidate, SNAPSHOT_EXPIRATION_MS, type SnapshotCacheContext, type SnapshotCacheNote, snapshotEntryFileName, snapshotEntryIdentity, } from "./snapshot-cache.ts";
18
+ export { applyScript, baseIndexScript, snapshotKey, type SnapshotStepsAt, snapshotStepsAt } from "./snapshot-key.ts";
19
+ export { STEP_ENV, type StepOutcome } from "./steps.ts";
@@ -0,0 +1,18 @@
1
+ // The `runner` module's public surface: running a command in a runner sandbox. Other modules import only from here.
2
+ export { resolveBase } from "./base.js";
3
+ export {} from "./events.js";
4
+ export { liveCheckoutGateway } from "./live/checkout-gateway.js";
5
+ export { liveRunnerSandboxGateway } from "./live/sandbox-gateway.js";
6
+ export { liveRunnerTerminal } from "./live/terminal.js";
7
+ export { localUserName } from "./live/user.js";
8
+ export { liveRunnerSnapshotCacheGateway, unavailableRunnerSnapshotCacheGateway, } from "./live/snapshot-cache-gateway.js";
9
+ export { lineSplitter, OUTPUT_TAIL_LINES, outputRule, outputTail, rewritePaths, splitLines, } from "./output.js";
10
+ export { prepareRunner, } from "./prepare.js";
11
+ export { APPLY_LABEL, readyRunner, } from "./ready.js";
12
+ export { checkRecipe, resolveSteps, resolveVcpus, } from "./recipe.js";
13
+ export { REMOTE_TEST_EVENTS_PATH, remoteCommand, remoteEnvironment, runRemote, } from "./remote-command.js";
14
+ export { CREATE_SETTLE_MS, runnerSandboxScope, SNAPSHOT_SETTLE_MS, } from "./scope.js";
15
+ export { BASE_INDEX_LABEL, buildSnapshot } from "./snapshot-build.js";
16
+ export { findSnapshotCandidates, pickSnapshot, RUNNER_SNAPSHOTS_SUBPATH, SNAPSHOT_EXPIRATION_MS, snapshotEntryFileName, snapshotEntryIdentity, } from "./snapshot-cache.js";
17
+ export { applyScript, baseIndexScript, snapshotKey, snapshotStepsAt } from "./snapshot-key.js";
18
+ export { STEP_ENV } from "./steps.js";
@@ -0,0 +1,3 @@
1
+ import type { CheckoutGateway } from "../gateways.ts";
2
+ /** The checkout through the `git` and `tar` on `PATH`. */
3
+ export declare function liveCheckoutGateway(): CheckoutGateway;
@@ -0,0 +1,206 @@
1
+ // The live checkout gateway: git and tar on this machine. Every git call is `git -C <repoRoot> …` with
2
+ // `GIT_OPTIONAL_LOCKS=0`, so a read never takes the index lock, and a 1 GiB output buffer, since a base's archive
3
+ // can be about 74 MB.
4
+ import { execFile, spawn } from "node:child_process";
5
+ import { displayCommand, partitionUntracked, splitNul, submodulePaths } from "./git-output.js";
6
+ const GIT_MAX_BUFFER = 1024 * 1024 * 1024;
7
+ /** Diff options that keep a user's git config from changing the patch. */
8
+ const DIFF_OPTIONS = [
9
+ "--no-color",
10
+ "--no-ext-diff",
11
+ "--no-textconv",
12
+ "--no-renames",
13
+ "--no-relative",
14
+ "--ignore-submodules",
15
+ ];
16
+ /** The checkout through the `git` and `tar` on `PATH`. */
17
+ export function liveCheckoutGateway() {
18
+ return {
19
+ repositoryRoot: ({ cwd }) => repositoryRoot(cwd),
20
+ head: ({ repoRoot }) => head(repoRoot),
21
+ baseCandidate: ({ repoRoot, ref }) => baseCandidate(repoRoot, ref),
22
+ contains: ({ repoRoot, ancestor, descendant }) => contains(repoRoot, ancestor, descendant),
23
+ commitTime: ({ repoRoot, commit }) => commitTime(repoRoot, commit),
24
+ readFileAt: ({ repoRoot, commit, path }) => readFileAt(repoRoot, commit, path),
25
+ submodules: ({ repoRoot }) => submodules(repoRoot),
26
+ assembleUpload: ({ repoRoot, base }) => assembleUpload(repoRoot, base),
27
+ baseArchive: ({ repoRoot, base }) => baseArchive(repoRoot, base),
28
+ };
29
+ }
30
+ async function repositoryRoot(cwd) {
31
+ const run = await git(cwd, ["rev-parse", "--show-toplevel"]);
32
+ return run.ok ? { ok: true, value: run.stdout.toString("utf8").trim() } : run;
33
+ }
34
+ async function head(repoRoot) {
35
+ const [commit, branch, status] = await Promise.all([
36
+ git(repoRoot, ["rev-parse", "--verify", "HEAD"]),
37
+ git(repoRoot, ["symbolic-ref", "--quiet", "--short", "HEAD"]),
38
+ git(repoRoot, ["status", "--porcelain", "-z", "--untracked-files=normal"]),
39
+ ]);
40
+ if (!commit.ok)
41
+ return commit;
42
+ // `symbolic-ref --quiet` exits 1, saying nothing, when HEAD is detached.
43
+ if (!branch.ok && branch.exitCode !== 1)
44
+ return branch;
45
+ if (!status.ok)
46
+ return status;
47
+ return {
48
+ ok: true,
49
+ value: {
50
+ branch: branch.ok ? branch.stdout.toString("utf8").trim() : null,
51
+ commit: commit.stdout.toString("utf8").trim(),
52
+ dirty: status.stdout.length > 0,
53
+ },
54
+ };
55
+ }
56
+ async function baseCandidate(repoRoot, ref) {
57
+ const exists = await git(repoRoot, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`]);
58
+ if (!exists.ok)
59
+ return exists.exitCode === 1 ? { kind: "missing-ref" } : { kind: "failed", failure: exists.failure };
60
+ const mergeBase = await git(repoRoot, ["merge-base", "HEAD", ref]);
61
+ if (!mergeBase.ok)
62
+ return mergeBase.exitCode === 1 ? { kind: "unrelated" } : { kind: "failed", failure: mergeBase.failure };
63
+ return { kind: "merge-base", base: mergeBase.stdout.toString("utf8").trim() };
64
+ }
65
+ async function contains(repoRoot, ancestor, descendant) {
66
+ // A base missing from the clone (`cat-file -e` exits non-zero) is no ancestor of anything here.
67
+ const present = await git(repoRoot, ["cat-file", "-e", `${ancestor}^{commit}`]);
68
+ if (!present.ok)
69
+ return { ok: true, value: false };
70
+ const run = await git(repoRoot, ["merge-base", "--is-ancestor", ancestor, descendant]);
71
+ if (run.ok)
72
+ return { ok: true, value: true };
73
+ return run.exitCode === 1 ? { ok: true, value: false } : run;
74
+ }
75
+ async function commitTime(repoRoot, commit) {
76
+ const run = await git(repoRoot, ["show", "-s", "--format=%ct", `${commit}^{commit}`]);
77
+ if (!run.ok)
78
+ return run;
79
+ const seconds = Number(run.stdout.toString("utf8").trim());
80
+ return Number.isSafeInteger(seconds)
81
+ ? { ok: true, value: seconds * 1000 }
82
+ : { ok: false, failure: { message: `git show printed no commit time for ${commit}` } };
83
+ }
84
+ async function readFileAt(repoRoot, commit, path) {
85
+ const object = `${commit}:${path}`;
86
+ const type = await git(repoRoot, ["cat-file", "-t", object]);
87
+ if (!type.ok || type.stdout.toString("utf8").trim() !== "blob")
88
+ return { kind: "missing" };
89
+ const run = await git(repoRoot, ["cat-file", "blob", object]);
90
+ return run.ok ? { kind: "found", text: run.stdout.toString("utf8") } : { kind: "failed", failure: run.failure };
91
+ }
92
+ async function submodules(repoRoot) {
93
+ const run = await git(repoRoot, ["ls-files", "--stage", "-z"]);
94
+ return run.ok ? { ok: true, value: submodulePaths(splitNul(run.stdout)) } : run;
95
+ }
96
+ async function assembleUpload(repoRoot, base) {
97
+ const [patch, others] = await Promise.all([
98
+ git(repoRoot, [
99
+ "diff",
100
+ "--binary",
101
+ // A user's `diff.context=0` makes patches that need special flags to apply.
102
+ "--unified=3",
103
+ ...DIFF_OPTIONS,
104
+ "--src-prefix=a/",
105
+ "--dst-prefix=b/",
106
+ base,
107
+ ]),
108
+ git(repoRoot, ["ls-files", "--others", "--exclude-standard", "-z"]),
109
+ ]);
110
+ if (!patch.ok)
111
+ return patch;
112
+ if (!others.ok)
113
+ return others;
114
+ // `ls-files --others` lists an untracked nested repository as one `dir/` entry. Packing it would upload the whole
115
+ // directory, its `.git` and ignored files included, so it is left out and named.
116
+ const { files, nestedRepositories } = partitionUntracked(splitNul(others.stdout));
117
+ let untrackedTarball;
118
+ if (files.length > 0) {
119
+ const tarball = await createTarball(repoRoot, files);
120
+ if (!tarball.ok)
121
+ return tarball;
122
+ untrackedTarball = tarball.value;
123
+ }
124
+ return { ok: true, value: { patch: patch.stdout, untracked: files, untrackedTarball, nestedRepositories } };
125
+ }
126
+ async function baseArchive(repoRoot, base) {
127
+ const [tarball, fileList] = await Promise.all([
128
+ // LF line endings, as the patch has them: with `core.autocrlf=true`, the Git for Windows default, `git archive`
129
+ // writes CRLF files the patch doesn't apply to.
130
+ git(repoRoot, ["-c", "core.autocrlf=false", "-c", "core.eol=lf", "archive", "--format=tar.gz", base]),
131
+ git(repoRoot, ["ls-tree", "-r", "--name-only", "-z", "--full-tree", base]),
132
+ ]);
133
+ if (!tarball.ok)
134
+ return tarball;
135
+ if (!fileList.ok)
136
+ return fileList;
137
+ return {
138
+ ok: true,
139
+ value: { tarball: tarball.stdout, fileList: fileList.stdout, files: splitNul(fileList.stdout).length },
140
+ };
141
+ }
142
+ /** `git -C <repoRoot> <args>`: its stdout, or its exit code and what it said on stderr. */
143
+ function git(repoRoot, args) {
144
+ const argv = ["-C", repoRoot, ...args];
145
+ return new Promise((resolve) => {
146
+ execFile("git", argv, { encoding: "buffer", maxBuffer: GIT_MAX_BUFFER, env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" } }, (error, stdout, stderr) => {
147
+ if (error === null) {
148
+ resolve({ ok: true, stdout });
149
+ return;
150
+ }
151
+ // The subcommand follows any `-c <name>=<value>` options.
152
+ const subcommand = args.find((arg, index) => arg !== "-c" && args[index - 1] !== "-c") ?? "";
153
+ const detail = stderr.toString("utf8").trim() || error.message;
154
+ resolve({
155
+ ok: false,
156
+ exitCode: typeof error.code === "number" ? error.code : undefined,
157
+ failure: { message: `git ${subcommand} failed: ${detail}`, displayCommand: displayCommand("git", argv) },
158
+ });
159
+ });
160
+ });
161
+ }
162
+ /**
163
+ * A gzip tarball of `paths`, relative to `repoRoot`, from the system tar, in memory. `COPYFILE_DISABLE=1` keeps
164
+ * macOS tar from adding AppleDouble `._*` files. A tar that exits 0 without reading every path (its stdin failed
165
+ * with EPIPE) made an incomplete tarball, which is a failure.
166
+ */
167
+ function createTarball(repoRoot, paths) {
168
+ const args = ["--null", "-czf", "-", "-C", repoRoot, "-T", "-"];
169
+ const command = displayCommand("tar", args);
170
+ return new Promise((resolve) => {
171
+ const child = spawn("tar", args, {
172
+ stdio: ["pipe", "pipe", "pipe"],
173
+ env: { ...process.env, COPYFILE_DISABLE: "1" },
174
+ });
175
+ const chunks = [];
176
+ const errors = [];
177
+ let stdinError;
178
+ let spawnError;
179
+ child.stdout.on("data", (chunk) => chunks.push(chunk));
180
+ child.stderr.on("data", (chunk) => errors.push(chunk));
181
+ child.stdin.on("error", (error) => {
182
+ stdinError = error;
183
+ });
184
+ child.once("error", (error) => {
185
+ spawnError = error;
186
+ });
187
+ child.once("close", (code) => {
188
+ const stderr = Buffer.concat(errors).toString("utf8").trim();
189
+ if (spawnError !== undefined)
190
+ resolve({ ok: false, failure: { message: `tar failed: ${spawnError.message}`, displayCommand: command } });
191
+ else if (code !== 0)
192
+ resolve({
193
+ ok: false,
194
+ failure: { message: `tar failed (exit ${code ?? "none"}): ${stderr}`, displayCommand: command },
195
+ });
196
+ else if (stdinError !== undefined)
197
+ resolve({
198
+ ok: false,
199
+ failure: { message: `tar didn't read the whole path list: ${stdinError.message}`, displayCommand: command },
200
+ });
201
+ else
202
+ resolve({ ok: true, value: Buffer.concat(chunks) });
203
+ });
204
+ child.stdin.end(paths.map((path) => `${path}\0`).join(""));
205
+ });
206
+ }
@@ -0,0 +1,14 @@
1
+ /** The entries of NUL-separated git output (`-z`), without the empty tail. */
2
+ export declare function splitNul(output: Uint8Array | string): string[];
3
+ /** The paths of the gitlinks (mode 160000), the submodules, in `git ls-files --stage -z` entries. */
4
+ export declare function submodulePaths(entries: readonly string[]): string[];
5
+ /**
6
+ * Splits `git ls-files --others` entries into files and untracked nested Git repositories, which git lists as one
7
+ * `dir/` entry; the repositories lose the slash.
8
+ */
9
+ export declare function partitionUntracked(entries: readonly string[]): {
10
+ readonly files: string[];
11
+ readonly nestedRepositories: string[];
12
+ };
13
+ /** A command as a person would type it, each argument that needs it single-quoted. */
14
+ export declare function displayCommand(command: string, args: readonly string[]): string;
@@ -0,0 +1,32 @@
1
+ // Pure helpers beneath the live checkout gateway: parsing git's NUL-separated output and rendering a failed command.
2
+ /** The entries of NUL-separated git output (`-z`), without the empty tail. */
3
+ export function splitNul(output) {
4
+ const text = typeof output === "string" ? output : Buffer.from(output).toString("utf8");
5
+ return text.split("\0").filter((entry) => entry.length > 0);
6
+ }
7
+ /** The paths of the gitlinks (mode 160000), the submodules, in `git ls-files --stage -z` entries. */
8
+ export function submodulePaths(entries) {
9
+ return entries.filter((entry) => entry.startsWith("160000 ")).map((entry) => entry.slice(entry.indexOf("\t") + 1));
10
+ }
11
+ /**
12
+ * Splits `git ls-files --others` entries into files and untracked nested Git repositories, which git lists as one
13
+ * `dir/` entry; the repositories lose the slash.
14
+ */
15
+ export function partitionUntracked(entries) {
16
+ const files = [];
17
+ const nestedRepositories = [];
18
+ for (const entry of entries) {
19
+ if (entry.endsWith("/"))
20
+ nestedRepositories.push(entry.slice(0, -1));
21
+ else
22
+ files.push(entry);
23
+ }
24
+ return { files, nestedRepositories };
25
+ }
26
+ /** A command as a person would type it, each argument that needs it single-quoted. */
27
+ export function displayCommand(command, args) {
28
+ return [command, ...args].map(shellQuote).join(" ");
29
+ }
30
+ function shellQuote(argument) {
31
+ return /^[\w@%+=:,./^{}-]+$/.test(argument) ? argument : `'${argument.replaceAll("'", `'\\''`)}'`;
32
+ }
@@ -0,0 +1,7 @@
1
+ import type { RunnerSandboxFailure } from "../gateways.ts";
2
+ /** The HTTP status a Sandbox API error carries (`error.response.status`), if it carries one. */
3
+ export declare function apiStatus(error: unknown): number | undefined;
4
+ /** Whether `error` is an abort: a DOM `AbortError`, as `fetch` and the SDK throw when a signal aborts. */
5
+ export declare function isAbortError(error: unknown): boolean;
6
+ /** What a thrown Sandbox error means: an abort when `signal` aborted or the error is one, otherwise an API failure. */
7
+ export declare function sandboxFailure(error: unknown, signal: AbortSignal | undefined): RunnerSandboxFailure;