@cnc-tools/storm 0.15.0 → 0.17.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 (305) hide show
  1. package/dist/application.d.ts +22 -13
  2. package/dist/application.js +21 -10
  3. package/dist/bin/run.d.ts +18 -0
  4. package/dist/bin/run.js +31 -0
  5. package/dist/bin/storm.js +42 -26
  6. package/dist/build-info.js +1 -1
  7. package/dist/chunks/{chunk-5CCP36QQ.js → chunk-2RNDPDTJ.js} +2 -2
  8. package/dist/chunks/chunk-2VP4GRJM.js +1219 -0
  9. package/dist/chunks/{chunk-SZEURWRS.js → chunk-4O5C2XGJ.js} +18 -15
  10. package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
  11. package/dist/chunks/{chunk-QVS7HRU7.js → chunk-6UHIJXZG.js} +3 -3
  12. package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
  13. package/dist/chunks/{chunk-4U4DZ7VG.js → chunk-7DZE67QM.js} +2 -2
  14. package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
  15. package/dist/chunks/{chunk-QUHY6FGN.js → chunk-CKGZA25H.js} +1 -18
  16. package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
  17. package/dist/chunks/{chunk-KC4KDJ5K.js → chunk-DADEYJDW.js} +174 -153
  18. package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
  19. package/dist/chunks/chunk-F4MOYHRY.js +198 -0
  20. package/dist/chunks/{chunk-CXAT7ZKP.js → chunk-FNBB6V4R.js} +1 -1
  21. package/dist/chunks/{chunk-OX7X4B2L.js → chunk-GRT3UIBV.js} +18 -1
  22. package/dist/chunks/chunk-HP3CURSZ.js +88 -0
  23. package/dist/chunks/{chunk-PN5ULTTH.js → chunk-HWIQ2S7K.js} +5 -5
  24. package/dist/chunks/chunk-JN3YY6ZH.js +2166 -0
  25. package/dist/chunks/{chunk-TJNFVNKR.js → chunk-LKTZ5OXS.js} +1 -1
  26. package/dist/chunks/{chunk-XEVHP5ZW.js → chunk-M7EKRGVD.js} +8 -8
  27. package/dist/chunks/chunk-MR77L2GK.js +340 -0
  28. package/dist/chunks/{chunk-L36GBUBB.js → chunk-RNAS7JHE.js} +1755 -522
  29. package/dist/chunks/{chunk-5GBMR4HM.js → chunk-RWIXDDCK.js} +4 -192
  30. package/dist/chunks/{chunk-5VXBKPW6.js → chunk-WV3DP6NR.js} +1 -1
  31. package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
  32. package/dist/chunks/{chunk-YV7GE6EV.js → chunk-YEPFSLQR.js} +480 -375
  33. package/dist/chunks/{live-app-PI3BAN6Y.js → live-app-R76JQXZL.js} +15 -13
  34. package/dist/commands/exec/across-sandboxes-outcomes.d.ts +1 -1
  35. package/dist/commands/exec/across-sandboxes-outcomes.js +4 -3
  36. package/dist/commands/exec/before-run.d.ts +123 -0
  37. package/dist/commands/exec/before-run.js +105 -0
  38. package/dist/commands/exec/command.d.ts +39 -4
  39. package/dist/commands/exec/command.js +31 -95
  40. package/dist/commands/exec/driver-plan.d.ts +9 -4
  41. package/dist/commands/exec/driver-plan.js +8 -8
  42. package/dist/commands/exec/exec-words.js +1 -1
  43. package/dist/commands/exec/execute-run.d.ts +39 -0
  44. package/dist/commands/exec/execute-run.js +325 -0
  45. package/dist/commands/exec/live-view.d.ts +3 -3
  46. package/dist/commands/exec/live-view.js +16 -15
  47. package/dist/commands/exec/metadata.js +1 -1
  48. package/dist/commands/exec/mint-failed.d.ts +38 -0
  49. package/dist/commands/exec/mint-failed.js +27 -4
  50. package/dist/commands/exec/outcomes.d.ts +38 -9
  51. package/dist/commands/exec/outcomes.js +32 -25
  52. package/dist/commands/exec/plan-run.d.ts +58 -150
  53. package/dist/commands/exec/plan-run.js +232 -88
  54. package/dist/commands/exec/planned-outcome.js +8 -1
  55. package/dist/commands/exec/progress.d.ts +10 -6
  56. package/dist/commands/exec/progress.js +38 -25
  57. package/dist/commands/exec/run-bin.d.ts +11 -11
  58. package/dist/commands/exec/run-bin.js +9 -9
  59. package/dist/commands/exec/run-flags.d.ts +69 -0
  60. package/dist/commands/exec/run-flags.js +58 -0
  61. package/dist/commands/exec/run-metadata.js +5 -5
  62. package/dist/commands/exec/run-summary.d.ts +58 -0
  63. package/dist/commands/exec/run-summary.js +205 -0
  64. package/dist/commands/exec/runner-refusals.d.ts +82 -0
  65. package/dist/commands/exec/runner-refusals.js +71 -0
  66. package/dist/commands/exec/sandbox-progress.js +3 -0
  67. package/dist/commands/exec/stopped-outcome.d.ts +12 -0
  68. package/dist/commands/exec/stopped-outcome.js +77 -0
  69. package/dist/commands/exec/view.d.ts +20 -11
  70. package/dist/commands/exec/view.js +103 -47
  71. package/dist/commands/runs/facts.d.ts +9 -4
  72. package/dist/commands/runs/facts.js +28 -11
  73. package/dist/commands/runs/list/command.d.ts +16 -6
  74. package/dist/commands/runs/list/command.js +10 -10
  75. package/dist/commands/runs/list/outcomes.d.ts +8 -3
  76. package/dist/commands/runs/logs/command.d.ts +6 -2
  77. package/dist/commands/runs/logs/command.js +10 -10
  78. package/dist/commands/runs/logs/outcomes.d.ts +3 -1
  79. package/dist/commands/runs/past-run.d.ts +14 -5
  80. package/dist/commands/runs/past-run.js +16 -5
  81. package/dist/commands/runs/show/command.d.ts +20 -8
  82. package/dist/commands/runs/show/command.js +30 -28
  83. package/dist/commands/runs/show/outcomes.d.ts +10 -4
  84. package/dist/commands/runs/show/outcomes.js +7 -5
  85. package/dist/commands/snapshots/access.d.ts +111 -0
  86. package/dist/commands/snapshots/access.js +96 -0
  87. package/dist/commands/snapshots/build/command.d.ts +360 -93
  88. package/dist/commands/snapshots/build/command.js +446 -150
  89. package/dist/commands/snapshots/build/metadata.d.ts +10 -0
  90. package/dist/commands/snapshots/build/metadata.js +31 -11
  91. package/dist/commands/snapshots/build/outcomes.d.ts +234 -43
  92. package/dist/commands/snapshots/build/outcomes.js +200 -36
  93. package/dist/commands/snapshots/list/command.d.ts +368 -27
  94. package/dist/commands/snapshots/list/command.js +296 -66
  95. package/dist/commands/snapshots/list/metadata.d.ts +16 -0
  96. package/dist/commands/snapshots/list/metadata.js +29 -6
  97. package/dist/commands/snapshots/list/outcomes.d.ts +245 -13
  98. package/dist/commands/snapshots/list/outcomes.js +221 -50
  99. package/dist/commands/snapshots/metadata.js +1 -1
  100. package/dist/commands/snapshots/prune/command.d.ts +430 -0
  101. package/dist/commands/snapshots/prune/command.js +161 -0
  102. package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
  103. package/dist/commands/snapshots/prune/metadata.js +39 -0
  104. package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
  105. package/dist/commands/snapshots/prune/outcomes.js +78 -0
  106. package/dist/commands/suites/list/command.js +19 -18
  107. package/dist/commands/suites/list/outcomes.js +4 -4
  108. package/dist/commands/test/command.d.ts +39 -4
  109. package/dist/commands/test/command.js +50 -255
  110. package/dist/commands/test/metadata.js +1 -1
  111. package/dist/commands/test/outcomes.d.ts +19 -2
  112. package/dist/commands/test/outcomes.js +2 -2
  113. package/dist/config/check-runner.d.ts +5 -3
  114. package/dist/config/check-runner.js +33 -7
  115. package/dist/config/check-suites.js +1 -0
  116. package/dist/config/credential-resolver.d.ts +50 -5
  117. package/dist/config/credential-resolver.js +51 -19
  118. package/dist/config/credential-settle.d.ts +6 -2
  119. package/dist/config/credential-settle.js +11 -5
  120. package/dist/config/gateways.d.ts +7 -3
  121. package/dist/config/index.d.ts +4 -5
  122. package/dist/config/index.js +3 -4
  123. package/dist/config/live/config-gateway.js +5 -2
  124. package/dist/config/load.d.ts +21 -4
  125. package/dist/config/load.js +129 -15
  126. package/dist/config/runner.d.ts +7 -8
  127. package/dist/config/runner.js +1 -1
  128. package/dist/config/schema.d.ts +17 -5
  129. package/dist/config/schema.js +11 -3
  130. package/dist/config/typed-options.d.ts +1 -6
  131. package/dist/config/typed-options.js +2 -10
  132. package/dist/config-file/define.d.ts +1 -11
  133. package/dist/config-file/define.js +3 -3
  134. package/dist/config-file/runner.d.ts +5 -6
  135. package/dist/config-file/toolchain.d.ts +13 -7
  136. package/dist/config-file/toolchain.js +53 -37
  137. package/dist/context.d.ts +8 -6
  138. package/dist/context.js +7 -6
  139. package/dist/core/across-sandboxes.d.ts +7 -6
  140. package/dist/core/across-sandboxes.js +123 -152
  141. package/dist/core/coordinator.d.ts +166 -0
  142. package/dist/core/coordinator.js +233 -0
  143. package/dist/core/events.d.ts +2 -2
  144. package/dist/core/index.d.ts +4 -2
  145. package/dist/core/index.js +1 -1
  146. package/dist/core/outcomes.d.ts +148 -0
  147. package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
  148. package/dist/core/resources.d.ts +31 -53
  149. package/dist/core/resources.js +32 -70
  150. package/dist/core/run-state.d.ts +7 -1
  151. package/dist/core/run-state.js +2 -0
  152. package/dist/core/run.d.ts +32 -236
  153. package/dist/core/run.js +106 -266
  154. package/dist/core/state-directory.d.ts +1 -1
  155. package/dist/core/state-directory.js +2 -2
  156. package/dist/credential/gateways.d.ts +15 -1
  157. package/dist/credential/index.d.ts +4 -3
  158. package/dist/credential/index.js +3 -2
  159. package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
  160. package/dist/credential/live/vercel-cli-gateway.js +1 -1
  161. package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
  162. package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
  163. package/dist/credential/source.d.ts +73 -6
  164. package/dist/credential/source.js +55 -2
  165. package/dist/extension-commands.d.ts +6 -1
  166. package/dist/extension-commands.js +15 -1
  167. package/dist/extensions/github/resource.d.ts +1 -1
  168. package/dist/extensions/github/resource.js +1 -1
  169. package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
  170. package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
  171. package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
  172. package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
  173. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  174. package/dist/extensions/testserver/credential-facts.d.ts +6 -2
  175. package/dist/extensions/testserver/credential-facts.js +29 -11
  176. package/dist/extensions/testserver/lifecycle.js +7 -1
  177. package/dist/extensions/testserver/limit.d.ts +3 -0
  178. package/dist/extensions/testserver/limit.js +3 -0
  179. package/dist/extensions/testserver/provision.d.ts +8 -1
  180. package/dist/extensions/testserver/provision.js +8 -3
  181. package/dist/extensions/testserver/refusals.d.ts +6 -1
  182. package/dist/extensions/testserver/refusals.js +16 -1
  183. package/dist/extensions/testserver/resource.d.ts +2 -2
  184. package/dist/extensions/testserver/resource.js +2 -2
  185. package/dist/extensions/testserver/result.d.ts +1 -1
  186. package/dist/extensions/testserver/result.js +9 -4
  187. package/dist/planning/driver-file-lists.d.ts +0 -15
  188. package/dist/planning/driver-file-lists.js +2 -21
  189. package/dist/planning/plan-only.d.ts +7 -15
  190. package/dist/planning/plan-only.js +16 -22
  191. package/dist/planning/run-kind-flags.js +2 -2
  192. package/dist/planning/run-plan.d.ts +45 -13
  193. package/dist/planning/run-plan.js +4 -3
  194. package/dist/planning/suites.d.ts +1 -1
  195. package/dist/planning/suites.js +2 -2
  196. package/dist/planning/test-plan.d.ts +9 -0
  197. package/dist/planning/test-plan.js +10 -2
  198. package/dist/run-directory/recording.js +2 -2
  199. package/dist/run-directory/run-record.d.ts +21 -6
  200. package/dist/run-directory/run-record.js +12 -9
  201. package/dist/runner/base.d.ts +0 -6
  202. package/dist/runner/base.js +1 -16
  203. package/dist/runner/build-snapshots.d.ts +55 -29
  204. package/dist/runner/build-snapshots.js +135 -35
  205. package/dist/runner/context.d.ts +15 -7
  206. package/dist/runner/context.js +19 -6
  207. package/dist/runner/events.d.ts +16 -10
  208. package/dist/runner/gateways.d.ts +92 -21
  209. package/dist/runner/gateways.js +1 -1
  210. package/dist/runner/index.d.ts +11 -7
  211. package/dist/runner/index.js +9 -4
  212. package/dist/runner/live/sandbox-errors.d.ts +2 -0
  213. package/dist/runner/live/sandbox-errors.js +4 -0
  214. package/dist/runner/live/sandbox-gateway.js +141 -3
  215. package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
  216. package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
  217. package/dist/runner/live/snapshot-records.js +6 -7
  218. package/dist/runner/local-snapshot-index.d.ts +199 -0
  219. package/dist/runner/local-snapshot-index.js +211 -0
  220. package/dist/runner/network-policy.d.ts +6 -6
  221. package/dist/runner/network-policy.js +7 -7
  222. package/dist/runner/policy-writes.d.ts +1 -1
  223. package/dist/runner/policy-writes.js +1 -1
  224. package/dist/runner/prepare.d.ts +25 -24
  225. package/dist/runner/prepare.js +28 -20
  226. package/dist/runner/ready.d.ts +18 -10
  227. package/dist/runner/ready.js +104 -33
  228. package/dist/runner/sandboxed-command.d.ts +3 -3
  229. package/dist/runner/sandboxed-command.js +3 -3
  230. package/dist/runner/scope.d.ts +10 -6
  231. package/dist/runner/scope.js +10 -3
  232. package/dist/runner/secrets.d.ts +13 -13
  233. package/dist/runner/secrets.js +18 -15
  234. package/dist/runner/session.d.ts +8 -8
  235. package/dist/runner/session.js +3 -3
  236. package/dist/runner/shared-snapshot-entry.d.ts +92 -0
  237. package/dist/runner/shared-snapshot-entry.js +168 -0
  238. package/dist/runner/shared-snapshot-list.d.ts +81 -0
  239. package/dist/runner/shared-snapshot-list.js +155 -0
  240. package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
  241. package/dist/runner/shared-snapshot-lookup.js +118 -0
  242. package/dist/runner/shared-snapshot-prune.d.ts +58 -0
  243. package/dist/runner/shared-snapshot-prune.js +133 -0
  244. package/dist/runner/snapshot-build.d.ts +42 -14
  245. package/dist/runner/snapshot-build.js +38 -28
  246. package/dist/runner/snapshot-choice.js +1 -1
  247. package/dist/runner/snapshot-inspect.d.ts +39 -40
  248. package/dist/runner/snapshot-inspect.js +58 -38
  249. package/dist/runner/snapshot-key.d.ts +30 -21
  250. package/dist/runner/snapshot-key.js +49 -29
  251. package/dist/runner/steps.d.ts +1 -1
  252. package/dist/runner/steps.js +1 -1
  253. package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +2 -2
  254. package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
  255. package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +82 -82
  256. package/dist/runner/vercel-sandbox-options.js +510 -0
  257. package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
  258. package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
  259. package/dist/sdk/extension/commands.d.ts +8 -3
  260. package/dist/sdk/extension/commands.js +3 -1
  261. package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
  262. package/dist/sdk/extension/credential-diagnosis.js +25 -5
  263. package/dist/sdk/extension/credential-source.d.ts +20 -3
  264. package/dist/sdk/extension/credential-source.js +4 -4
  265. package/dist/sdk/extension/index.d.ts +3 -2
  266. package/dist/sdk/extension/index.js +2 -1
  267. package/dist/sdk/extension/resource-definition.d.ts +4 -3
  268. package/dist/sdk/extension/resource-definition.js +3 -2
  269. package/dist/sdk/extension/resource-factory.js +3 -4
  270. package/dist/sdk/extension/secret-source.d.ts +1 -1
  271. package/dist/sdk/extension/secret-source.js +1 -1
  272. package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
  273. package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
  274. package/dist/sdk/run/present.d.ts +3 -3
  275. package/dist/sdk/run/present.js +1 -3
  276. package/dist/shared/cleanup.d.ts +3 -3
  277. package/dist/shared/cleanup.js +15 -5
  278. package/dist/shared/snapshot-text.d.ts +4 -4
  279. package/dist/shared/snapshot-text.js +11 -11
  280. package/dist/time/duration.js +1 -1
  281. package/package.json +3 -2
  282. package/skills/overview.md +6 -4
  283. package/skills/plan-runs.md +2 -2
  284. package/skills/read-run-output.md +6 -6
  285. package/dist/chunks/chunk-E4PJNZVG.js +0 -783
  286. package/dist/chunks/chunk-RAQEXKL6.js +0 -2591
  287. package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
  288. package/dist/commands/exec/across-sandboxes-run.js +0 -339
  289. package/dist/commands/exec/plan-only.d.ts +0 -10
  290. package/dist/commands/exec/plan-only.js +0 -46
  291. package/dist/commands/exec/run-command.d.ts +0 -476
  292. package/dist/commands/exec/run-command.js +0 -604
  293. package/dist/commands/exec/run-planned.d.ts +0 -20
  294. package/dist/commands/exec/run-planned.js +0 -22
  295. package/dist/commands/exec/sandbox-view.d.ts +0 -19
  296. package/dist/commands/exec/sandbox-view.js +0 -72
  297. package/dist/commands/test/plan.d.ts +0 -92
  298. package/dist/commands/test/plan.js +0 -128
  299. package/dist/config/recipe-run.d.ts +0 -33
  300. package/dist/config/recipe-run.js +0 -28
  301. package/dist/core/sandbox-end.d.ts +0 -64
  302. package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
  303. package/dist/runner/recipe.js +0 -425
  304. package/dist/runner/snapshot-cache.d.ts +0 -148
  305. package/dist/runner/snapshot-cache.js +0 -126
@@ -1,19 +0,0 @@
1
- import type { StormApp } from "../../context.ts";
2
- import type { RunObserver } from "../../core/index.ts";
3
- import type { SandboxProgress } from "./sandbox-progress.ts";
4
- /**
5
- * The view of a run across runner sandboxes: the observer that shows each event, and `finish`, which ends what it
6
- * started.
7
- */
8
- export interface SandboxView {
9
- readonly observer: RunObserver;
10
- finish(): void;
11
- }
12
- /** How long the plain view waits before it asks again for the progress lines that came due. */
13
- export declare const PROGRESS_TICK_MS = 1000;
14
- /**
15
- * The view of a run across runner sandboxes over `status`, by the app's presentation; `progress` undefined shows
16
- * nothing. The plain view waits on the app's timer between its asks, from when it is made until `finish`, which ends
17
- * the wait at once.
18
- */
19
- export declare function sandboxView(app: Pick<StormApp, "context" | "presentation">, progress: ((line: string) => Promise<void>) | undefined, status: SandboxProgress): SandboxView;
@@ -1,72 +0,0 @@
1
- // What a run across runner sandboxes shows while it runs, from its progress (`sandbox-progress.ts`). On a terminal a
2
- // person watches: status lines above a live area with a row for each runner sandbox, which the terminal redraws.
3
- // Elsewhere: plain status lines, and each running runner sandbox's progress line as it comes due, which the view asks
4
- // for once a second on the app's timer. Under `--json` it shows nothing.
5
- import { paint } from "../../shared/text.js";
6
- /** How long the plain view waits before it asks again for the progress lines that came due. */
7
- export const PROGRESS_TICK_MS = 1_000;
8
- /**
9
- * The view of a run across runner sandboxes over `status`, by the app's presentation; `progress` undefined shows
10
- * nothing. The plain view waits on the app's timer between its asks, from when it is made until `finish`, which ends
11
- * the wait at once.
12
- */
13
- export function sandboxView(app, progress, status) {
14
- if (progress === undefined)
15
- return { observer: { observe: async () => { } }, finish: () => { } };
16
- const { clock, timer } = app.context;
17
- if (app.presentation.kind === "live") {
18
- const terminal = app.context.progressTerminal;
19
- const style = paint(app.presentation.colorDepth !== "none");
20
- let shown = false;
21
- let finished = false;
22
- return {
23
- observer: {
24
- observe: async (timed) => {
25
- if (finished)
26
- return;
27
- const lines = status.lines(timed);
28
- if (lines.length > 0)
29
- terminal.print("stderr", lines.map((line) => `${line}\n`).join(""));
30
- if (!shown && timed.event.kind === "sandboxes-started") {
31
- shown = true;
32
- terminal.show(() => (finished ? [] : status.rows(clock.now().getTime(), style)));
33
- }
34
- },
35
- },
36
- finish: () => {
37
- if (finished)
38
- return;
39
- finished = true;
40
- if (shown)
41
- terminal.settle();
42
- },
43
- };
44
- }
45
- let failed = false;
46
- const write = async (lines) => {
47
- for (const line of lines) {
48
- if (failed)
49
- return;
50
- try {
51
- await progress(line);
52
- }
53
- catch {
54
- failed = true;
55
- }
56
- }
57
- };
58
- const finished = new AbortController();
59
- const tick = async () => {
60
- for (;;) {
61
- await timer.sleep(PROGRESS_TICK_MS, finished.signal);
62
- if (finished.signal.aborted)
63
- return;
64
- await write(status.tick(clock.now().getTime()));
65
- }
66
- };
67
- void tick();
68
- return {
69
- observer: { observe: async (timed) => await write(status.lines(timed)) },
70
- finish: () => finished.abort(),
71
- };
72
- }
@@ -1,92 +0,0 @@
1
- import { type ArgumentIssue, type ExecutionContext } from "@vercel/clinkr";
2
- import type { StormApp } from "../../context.ts";
3
- import type { DriverRefusals } from "../../planning/driver-refusals.ts";
4
- import type { PlannedSandboxesRun, PlannedWhere } from "../../planning/run-plan.ts";
5
- import type { Driver, RunTestPlan } from "../../sdk/extension/index.ts";
6
- import { type DriverPlanRefusal } from "../exec/driver-plan.ts";
7
- import { type RunPlanRequest } from "../exec/run-command.ts";
8
- /** What `storm test` asks of its run beside the run's request: whether to count each test, and its runner sandboxes. */
9
- export interface TestRunOptions {
10
- readonly countTests: boolean;
11
- readonly sandboxes: number | undefined;
12
- readonly fileLists: string | undefined;
13
- }
14
- /**
15
- * What is wrong with `--sandboxes` or `--file-lists` for `driver` and the run's arguments `args` (the command line's,
16
- * then the config file's): a driver without file list support (`Driver.fileLists`) takes neither, and a driver with it
17
- * checks the arguments (`fileLists.validate`). Undefined without either flag, or when the driver takes them.
18
- */
19
- export declare function driverSandboxesProblem(driver: Driver, args: readonly string[], asks: Pick<TestRunOptions, "sandboxes" | "fileLists">): {
20
- readonly kind: "unsupported" | "args";
21
- readonly flag: "--sandboxes" | "--file-lists";
22
- readonly problem: string;
23
- } | undefined;
24
- /** What is wrong with `storm test`'s `--sandboxes` whatever the driver, as `validate` reports it. */
25
- export declare function testSandboxesProblems(request: {
26
- readonly sandboxes?: number | undefined;
27
- }): readonly ArgumentIssue[];
28
- /**
29
- * Plans `storm test`'s run of `driver` with `args`, before anything is minted, acquired, or started, in the one of three
30
- * ways its request asks:
31
- *
32
- * - With `--sandboxes` or `--file-lists`, a run with the runner sandboxes asked for (`planAskedSandboxesRun`): storm's
33
- * file lists for `--sandboxes`, or the caller's, which it reads first and refuses when it can't use them
34
- * (`file_lists_unreadable`, `invalid_file_lists`, `file_lists_unlisted`). The caller checked the driver takes them
35
- * (`driverSandboxesProblem`).
36
- * - For a driver without file list support, a run that is not across runner sandboxes (`planCommandRun`):
37
- * `runner.sandboxes.default` never applies to it.
38
- * - Otherwise by `runner.sandboxes.default` (`planDefaultSandboxesRun`): a run across runner sandboxes when the
39
- * effective runner is `vercelSandbox({ … })` with the default, and else a run that is not across runner sandboxes.
40
- */
41
- export declare function planTestRun({ app, signal }: ExecutionContext<StormApp>, driver: Driver, errors: DriverRefusals, args: readonly string[], request: RunPlanRequest, asks: TestRunOptions): Promise<{
42
- readonly ok: false;
43
- readonly refusal: import("@vercel/clinkr").CommandError<"invalid_resource_options">;
44
- } | {
45
- readonly ok: false;
46
- readonly refusal: import("@vercel/clinkr").CommandError<"missing_target">;
47
- } | {
48
- readonly ok: false;
49
- readonly refusal: import("@vercel/clinkr").CommandError<"conflicting_options">;
50
- } | {
51
- readonly ok: false;
52
- readonly refusal: import("@vercel/clinkr").CommandError<"credentials_invalid">;
53
- } | {
54
- readonly ok: false;
55
- readonly refusal: import("@vercel/clinkr").CommandError<"keep_sandbox_unsafe_secret_env_vars">;
56
- } | {
57
- readonly ok: false;
58
- readonly refusal: import("@vercel/clinkr").CommandError<"missing_runner">;
59
- } | {
60
- readonly ok: false;
61
- readonly refusal: import("@vercel/clinkr").CommandError<"unsafe_secret_env_vars_invalid">;
62
- } | {
63
- readonly ok: false;
64
- readonly refusal: import("@vercel/clinkr").CommandError<"file_lists_unlisted"> | DriverPlanRefusal | (import("@vercel/clinkr").CommandError<"missing_sandboxes_max"> | import("@vercel/clinkr").CommandError<"sandboxes_over_max">);
65
- } | {
66
- readonly ok: false;
67
- readonly refusal: import("@vercel/clinkr").CommandError<"invalid_config"> | import("@vercel/clinkr").CommandError<"sandboxes_default_refused"> | DriverPlanRefusal;
68
- } | {
69
- readonly ok: false;
70
- readonly refusal: import("@vercel/clinkr").CommandError<"file_lists_unreadable"> | import("@vercel/clinkr").CommandError<"invalid_file_lists">;
71
- } | {
72
- readonly ok: true;
73
- readonly planned: {
74
- readonly ok: true;
75
- readonly configFile: string | null;
76
- readonly settings: import("../../config/resolve.ts").ResolvedSettings;
77
- readonly where: PlannedWhere;
78
- readonly argv: readonly string[];
79
- readonly testPlan: RunTestPlan;
80
- readonly testFiles: readonly string[] | undefined;
81
- readonly sandboxes: PlannedSandboxesRun | undefined;
82
- readonly resources: {
83
- readonly [key: string]: import("../../config/resolve.ts").ResolvedResourceRecord;
84
- };
85
- readonly planOptions: Readonly<{
86
- path: string;
87
- value: string | number | boolean;
88
- from: "default" | "file" | "flag";
89
- }>[];
90
- };
91
- readonly lifecycles: import("../../core/before-run.ts").ResourceLifecycles;
92
- }>;
@@ -1,128 +0,0 @@
1
- // How `storm test` plans its run with the selected driver, in the one way its request asks (`planTestRun`): with
2
- // `--sandboxes` or `--file-lists` a run across the runner sandboxes asked for, for a driver without file list support a
3
- // run that is not across runner sandboxes, and otherwise by `runner.sandboxes.default` in the effective runner. Each
4
- // way plans through `planDriverCommand`, and everything after the plan is the run every command shares (`runPlanned`).
5
- import { refused } from "@vercel/clinkr";
6
- import { invalidConfig } from "../../config/index.js";
7
- import { driverCallerFileListsRun, driverSandboxesRun } from "../../planning/driver-file-lists.js";
8
- import { readFileListsFile } from "../../planning/file-lists-file.js";
9
- import { resolveSandboxCountDefault } from "../../runner/index.js";
10
- import { fileListErrors, sandboxesDefaultErrors } from "../exec/across-sandboxes-outcomes.js";
11
- import { planAskedSandboxesRun, planDefaultSandboxesRun, SANDBOXES_DEFAULT_KEY, } from "../exec/across-sandboxes-run.js";
12
- import { driverCount, planDriverCommand } from "../exec/driver-plan.js";
13
- import { planCommandRun } from "../exec/run-command.js";
14
- /**
15
- * What is wrong with `--sandboxes` or `--file-lists` for `driver` and the run's arguments `args` (the command line's,
16
- * then the config file's): a driver without file list support (`Driver.fileLists`) takes neither, and a driver with it
17
- * checks the arguments (`fileLists.validate`). Undefined without either flag, or when the driver takes them.
18
- */
19
- export function driverSandboxesProblem(driver, args, asks) {
20
- const flag = asks.fileLists !== undefined ? "--file-lists" : asks.sandboxes !== undefined ? "--sandboxes" : undefined;
21
- if (flag === undefined)
22
- return undefined;
23
- if (driver.fileLists === undefined)
24
- return {
25
- kind: "unsupported",
26
- flag,
27
- problem: `The ${driver.name} driver has no file list support, so storm test can't run it across runner sandboxes.`,
28
- };
29
- const checked = driver.fileLists.validate(args);
30
- return checked.ok ? undefined : { kind: "args", flag, problem: checked.problem };
31
- }
32
- /** What is wrong with `storm test`'s `--sandboxes` whatever the driver, as `validate` reports it. */
33
- export function testSandboxesProblems(request) {
34
- const { sandboxes } = request;
35
- return sandboxes === undefined || (Number.isInteger(sandboxes) && sandboxes >= 1)
36
- ? []
37
- : [{ field: "sandboxes", message: `--sandboxes takes a whole number from 1, not ${sandboxes}.` }];
38
- }
39
- /**
40
- * Plans `storm test`'s run of `driver` with `args`, before anything is minted, acquired, or started, in the one of three
41
- * ways its request asks:
42
- *
43
- * - With `--sandboxes` or `--file-lists`, a run with the runner sandboxes asked for (`planAskedSandboxesRun`): storm's
44
- * file lists for `--sandboxes`, or the caller's, which it reads first and refuses when it can't use them
45
- * (`file_lists_unreadable`, `invalid_file_lists`, `file_lists_unlisted`). The caller checked the driver takes them
46
- * (`driverSandboxesProblem`).
47
- * - For a driver without file list support, a run that is not across runner sandboxes (`planCommandRun`):
48
- * `runner.sandboxes.default` never applies to it.
49
- * - Otherwise by `runner.sandboxes.default` (`planDefaultSandboxesRun`): a run across runner sandboxes when the
50
- * effective runner is `vercelSandbox({ … })` with the default, and else a run that is not across runner sandboxes.
51
- */
52
- export async function planTestRun({ app, signal }, driver, errors, args, request, asks) {
53
- const { countTests, sandboxes, fileLists: listsPath } = asks;
54
- // The driver's part of planning a run across runner sandboxes: its plan step lists the run's test files, and `make`
55
- // deals them into the runner sandboxes.
56
- const planDriverSandboxes = (make) => async (plan, planSignal) => {
57
- const planned = await planDriverCommand(app, driver, errors, args, { countTests: driver.countsFilesOnly !== true || countTests }, plan.where, planSignal);
58
- if (!planned.ok)
59
- return planned;
60
- const { argv, testPlan, testFiles } = planned;
61
- if (testFiles === undefined)
62
- throw new Error(`planTestRun: driver ${driver.name} has file list support, and its plan step answered no test files`);
63
- const made = make({ argv, testFiles, testPlan }, plan);
64
- if (!made.ok)
65
- return made;
66
- return { ok: true, argv, testPlan, testFiles, sandboxes: made.sandboxes };
67
- };
68
- let lists;
69
- if (listsPath !== undefined) {
70
- const read = await readFileListsFile(app.context.fileListsFiles, { path: listsPath, cwd: app.cwd, sandboxes });
71
- if (!read.ok)
72
- return refused(read.kind === "unreadable"
73
- ? fileListErrors.fileListsUnreadable({ path: read.path, problem: read.problem, message: read.message })
74
- : fileListErrors.invalidFileLists({
75
- path: read.path,
76
- problems: read.problems.map((problem) => problem.kind === "in-two-lists" ? { ...problem, sandboxes: [...problem.sandboxes] } : { ...problem }),
77
- }));
78
- lists = read.lists;
79
- }
80
- const asked = lists !== undefined
81
- ? { count: lists.lists.length, flag: "--file-lists" }
82
- : sandboxes === undefined
83
- ? undefined
84
- : { count: sandboxes, flag: "--sandboxes" };
85
- if (asked !== undefined) {
86
- const planSandboxes = planDriverSandboxes(({ argv, testFiles }, { max }) => {
87
- if (lists === undefined)
88
- return {
89
- ok: true,
90
- sandboxes: driverSandboxesRun({ argv, testFiles, asked: { from: "flag", count: asked.count }, max }),
91
- };
92
- const resolved = driverCallerFileListsRun({ argv, testFiles, lists, max });
93
- return resolved.ok
94
- ? resolved
95
- : refused(fileListErrors.fileListsUnlisted({
96
- path: lists.path,
97
- files: [...resolved.unlisted],
98
- listed: resolved.listed,
99
- }));
100
- });
101
- return await planAskedSandboxesRun(app, request, asked, planSandboxes, signal);
102
- }
103
- const planCommand = async (where, planSignal, { testPlan }) => await planDriverCommand(app, driver, errors, args, driverCount(driver, testPlan, countTests), where, planSignal);
104
- if (driver.fileLists === undefined)
105
- return await planCommandRun(app, request, planCommand, signal);
106
- const planDefaultSandboxes = planDriverSandboxes(({ argv, testFiles, testPlan }, { where, max, settings }) => {
107
- const sandboxesDefault = where.recipe.sandboxes?.default;
108
- if (sandboxesDefault === undefined)
109
- throw new Error("planTestRun: a run across runner sandboxes from the default needs runner.sandboxes.default");
110
- const resolved = resolveSandboxCountDefault(sandboxesDefault, testPlan);
111
- if (!resolved.ok)
112
- return refused(invalidConfig(where.configFile, [{ key: SANDBOXES_DEFAULT_KEY, location: null, problem: resolved.problem }]));
113
- const checked = driver.fileLists?.validate(args);
114
- if (checked !== undefined && !checked.ok)
115
- return refused(sandboxesDefaultErrors.sandboxesDefaultRefused({
116
- key: SANDBOXES_DEFAULT_KEY,
117
- sandboxes: Math.min(resolved.sandboxes, max, testFiles.length),
118
- field: "args",
119
- problem: checked.problem,
120
- configFile: settings.configFile,
121
- }));
122
- return {
123
- ok: true,
124
- sandboxes: driverSandboxesRun({ argv, testFiles, asked: { from: "default", default: resolved.sandboxes }, max }),
125
- };
126
- });
127
- return await planDefaultSandboxesRun(app, request, planCommand, planDefaultSandboxes, signal);
128
- }
@@ -1,33 +0,0 @@
1
- import type { VcpusRun } from "../runner/recipe.ts";
2
- import type { Present } from "../sdk/run/launcher.ts";
3
- import { type OptionsOf, type ResourceDefinition, type ResourceFactory } from "../sdk/extension/index.ts";
4
- /** The run, as a runner recipe's `vcpus` function sees it. */
5
- export interface RecipeRun {
6
- /**
7
- * The default resource of the resource factory `factory`'s definition (`run.get(<name>)`), the resource keyed by
8
- * the definition's name: `present: true` with its options, the plain values once its defaults (a function default's
9
- * value included), the file and the flags are merged, when the run has it, and `present: false` when the run
10
- * doesn't, such as a resource nothing gives or whose `beforeRun` skipped it.
11
- */
12
- get<D extends ResourceDefinition>(factory: ResourceFactory<D>): Present<OptionsOf<D>>;
13
- /**
14
- * The run's number of runner sandboxes: 1 unless the run is across runner sandboxes. storm calls the function once
15
- * for the run, and every runner sandbox has the size it gives, while a resource's option, such as a count of what the
16
- * resource provides, is the run's total. So a recipe that sizes the runner sandbox from such an option divides it by
17
- * this: `Math.ceil(count / run.sandboxes)`.
18
- */
19
- readonly sandboxes: number;
20
- }
21
- /** One of the run's resources, as a recipe's `vcpus` function reads it: its definition's name and its options. */
22
- export interface RecipeResource {
23
- readonly definition: string;
24
- readonly options: object;
25
- }
26
- /**
27
- * The run a recipe's `vcpus` function is called with, for a run with `resources`, each by its resource key, in order,
28
- * and the resource keys a problem with the function names. Each value `get` returns is a frozen copy, so a function
29
- * can't change the run's resources.
30
- */
31
- export declare function recipeRun(resources: {
32
- readonly [key: string]: RecipeResource;
33
- }, sandboxes?: number): VcpusRun<RecipeRun>;
@@ -1,28 +0,0 @@
1
- // What a runner recipe's `vcpus` function is called with: the run, which reads each of its resources by its resource
2
- // factory, `run.get(<name>)`, the factory's definition's default resource. The runner module calls the
3
- // function and names no resource or definition, so it takes the run as a type parameter; this module declares the run,
4
- // since it knows the definitions.
5
- import { defaultResourceKey, } from "../sdk/extension/index.js";
6
- import { resourceOptionsOf } from "./typed-options.js";
7
- const NOT_PRESENT = Object.freeze({ present: false });
8
- /**
9
- * The run a recipe's `vcpus` function is called with, for a run with `resources`, each by its resource key, in order,
10
- * and the resource keys a problem with the function names. Each value `get` returns is a frozen copy, so a function
11
- * can't change the run's resources.
12
- */
13
- export function recipeRun(resources, sandboxes = 1) {
14
- const run = {
15
- sandboxes,
16
- get: ({ definition }) => {
17
- const key = defaultResourceKey(definition);
18
- const resource = Object.hasOwn(resources, key) ? resources[key] : undefined;
19
- if (resource === undefined || resource.definition !== definition.name)
20
- return NOT_PRESENT;
21
- return Object.freeze({
22
- present: true,
23
- value: resourceOptionsOf(definition, Object.freeze({ ...resource.options })),
24
- });
25
- },
26
- };
27
- return { run: Object.freeze(run), resourceKeys: Object.keys(resources) };
28
- }
@@ -1,64 +0,0 @@
1
- import type { ChosenSnapshot, RunnerCleanupFacts } from "../runner/index.ts";
2
- import type { SandboxEndFacts } from "./events.ts";
3
- import type { ResourceRanRecords } from "./resource.ts";
4
- import type { RunCleanup, RunStopped } from "./run.ts";
5
- import type { RanCommand } from "./timing.ts";
6
- /**
7
- * How one runner sandbox ended, in the kinds any other run ends with, and one more:
8
- *
9
- * - `ran`: its command ran and ended.
10
- * - a run's stop (`RunStopped`): `canceled` when a signal stopped it; `runner_failed` when its runner sandbox's start,
11
- * upload, apply, install, build, or command call failed, or a step that runs once failed; `snapshot_gone` when the
12
- * chosen runner snapshot was gone as its runner sandbox started; `mint_failed` when the run's mint failed;
13
- * `resource_refused` when a resource's acquire or split refused the run.
14
- * - `threw`: something in the runner sandbox threw, a mistake in storm, with the error's message.
15
- */
16
- export type SandboxEnd = {
17
- readonly kind: "ran";
18
- readonly command: RanCommand;
19
- } | RunStopped | {
20
- readonly kind: "threw";
21
- readonly message: string;
22
- };
23
- /**
24
- * One runner sandbox once it ended: its runner sandbox index, its command, how it ended (`end`), its runner sandbox
25
- * state, exit code, and cause from that, and what closing its runner sandbox scope left (null when its session never
26
- * opened).
27
- */
28
- export interface EndedSandbox extends SandboxEndFacts {
29
- readonly sandbox: number;
30
- readonly argv: readonly string[];
31
- readonly end: SandboxEnd;
32
- readonly runnerCleanup: RunnerCleanupFacts | null;
33
- }
34
- /**
35
- * Every runner sandbox of a run across runner sandboxes ended, and no signal stopped one: each runner sandbox's end, in
36
- * order of runner sandbox index (`sandboxes`), the runner snapshot each started from, and what it reports of each
37
- * acquired resource instance that reports something (`resources`), for the whole run, as a `ran` outcome does. Its
38
- * `runnerCleanup` sums what every runner sandbox scope of the run couldn't stop or delete, and names no kept runner
39
- * sandbox of its own: each runner sandbox's is in its own `runnerCleanup`.
40
- */
41
- export interface SandboxesRanRun extends RunCleanup {
42
- readonly kind: "sandboxes_ran";
43
- readonly sandboxes: readonly EndedSandbox[];
44
- readonly snapshot: ChosenSnapshot;
45
- readonly resources: ResourceRanRecords;
46
- }
47
- /**
48
- * How a run across runner sandboxes ended: its runner sandboxes ran (`SandboxesRanRun`), or the run stopped before
49
- * then, in one of the ways any run stops (`RunStopped`). It never ends as `ran`, which is the outcome of a run's one
50
- * command.
51
- */
52
- export type AcrossSandboxesOutcome = SandboxesRanRun | (RunStopped & RunCleanup);
53
- /**
54
- * The status storm exits with once a run's runner sandboxes ran: 0 when every runner sandbox passed, else 1. A cleanup
55
- * failure never changes it.
56
- */
57
- export declare function acrossSandboxesExitStatus(sandboxes: readonly Pick<SandboxEndFacts, "state">[]): number;
58
- /**
59
- * A runner sandbox's state, exit code, and cause, from how it ended and whether its command started: a command that
60
- * started and did not exit 0 is `failed`, a command that never started is `not-started`, and a signal makes the runner
61
- * sandbox `canceled`. The Sandbox call that runs the command failing means the command started, whether or not its start
62
- * was heard.
63
- */
64
- export declare function sandboxEndFacts(end: SandboxEnd, commandStarted: boolean): SandboxEndFacts;
@@ -1,12 +0,0 @@
1
- import type { RunnerSnapshotCacheGateway } from "../gateways.ts";
2
- export interface LiveRunnerSnapshotCacheOptions {
3
- /** The cache directory, `$XDG_STATE_HOME/storm/runner/snapshots`. */
4
- readonly directory: string;
5
- }
6
- /** The runner snapshot cache in `options.directory`. */
7
- export declare function liveRunnerSnapshotCacheGateway(options: LiveRunnerSnapshotCacheOptions): RunnerSnapshotCacheGateway;
8
- /**
9
- * A cache that can't be found, because neither `XDG_STATE_HOME` nor `HOME` names a place for it. Every operation
10
- * fails with `reason`, at `location`.
11
- */
12
- export declare function unavailableRunnerSnapshotCacheGateway(location: string, reason: string): RunnerSnapshotCacheGateway;