@cnc-tools/storm 0.16.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 (281) 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-P357TZAY.js → chunk-4O5C2XGJ.js} +18 -15
  10. package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-4WAMTUWZ.js} +419 -340
  11. package/dist/chunks/{chunk-OIY3DMF2.js → chunk-6UHIJXZG.js} +3 -3
  12. package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
  13. package/dist/chunks/{chunk-CK2GZEPK.js → chunk-7DZE67QM.js} +2 -2
  14. package/dist/chunks/{chunk-VUPZH7J2.js → chunk-BCBKYOHW.js} +1 -1
  15. package/dist/chunks/{chunk-2MAD5NKK.js → chunk-CKGZA25H.js} +1 -18
  16. package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-D27KILIA.js} +1 -1
  17. package/dist/chunks/{chunk-V4IKA3WI.js → chunk-DADEYJDW.js} +24 -17
  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-HVNK3I45.js → chunk-FNBB6V4R.js} +1 -1
  21. package/dist/chunks/{chunk-G3PHMXH5.js → chunk-GRT3UIBV.js} +18 -1
  22. package/dist/chunks/chunk-HP3CURSZ.js +88 -0
  23. package/dist/chunks/{chunk-DWEAHX4T.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-3L52KNQA.js → chunk-M7EKRGVD.js} +8 -8
  27. package/dist/chunks/chunk-MR77L2GK.js +340 -0
  28. package/dist/chunks/{chunk-DC2CDHNK.js → chunk-RNAS7JHE.js} +1438 -445
  29. package/dist/chunks/{chunk-FCQUJDA4.js → chunk-RWIXDDCK.js} +4 -189
  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-FOZWA52V.js → chunk-YEPFSLQR.js} +480 -375
  33. package/dist/chunks/{live-app-WECQOQ4C.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 +2 -2
  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 +31 -2
  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 +34 -8
  51. package/dist/commands/exec/outcomes.js +30 -23
  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/progress.d.ts +10 -6
  55. package/dist/commands/exec/progress.js +38 -25
  56. package/dist/commands/exec/run-bin.d.ts +11 -11
  57. package/dist/commands/exec/run-bin.js +9 -9
  58. package/dist/commands/exec/run-flags.d.ts +69 -0
  59. package/dist/commands/exec/run-flags.js +58 -0
  60. package/dist/commands/exec/run-metadata.js +4 -4
  61. package/dist/commands/exec/run-summary.d.ts +58 -0
  62. package/dist/commands/exec/run-summary.js +205 -0
  63. package/dist/commands/exec/runner-refusals.d.ts +82 -0
  64. package/dist/commands/exec/runner-refusals.js +71 -0
  65. package/dist/commands/exec/sandbox-progress.js +3 -0
  66. package/dist/commands/exec/stopped-outcome.d.ts +12 -0
  67. package/dist/commands/exec/stopped-outcome.js +77 -0
  68. package/dist/commands/exec/view.d.ts +20 -11
  69. package/dist/commands/exec/view.js +103 -47
  70. package/dist/commands/runs/facts.d.ts +7 -3
  71. package/dist/commands/runs/facts.js +17 -8
  72. package/dist/commands/runs/list/command.d.ts +14 -6
  73. package/dist/commands/runs/list/command.js +10 -10
  74. package/dist/commands/runs/list/outcomes.d.ts +7 -3
  75. package/dist/commands/runs/logs/command.js +10 -10
  76. package/dist/commands/runs/show/command.d.ts +14 -6
  77. package/dist/commands/runs/show/command.js +30 -28
  78. package/dist/commands/runs/show/outcomes.d.ts +7 -3
  79. package/dist/commands/runs/show/outcomes.js +7 -5
  80. package/dist/commands/snapshots/access.d.ts +111 -0
  81. package/dist/commands/snapshots/access.js +96 -0
  82. package/dist/commands/snapshots/build/command.d.ts +360 -93
  83. package/dist/commands/snapshots/build/command.js +446 -150
  84. package/dist/commands/snapshots/build/metadata.d.ts +10 -0
  85. package/dist/commands/snapshots/build/metadata.js +31 -11
  86. package/dist/commands/snapshots/build/outcomes.d.ts +234 -43
  87. package/dist/commands/snapshots/build/outcomes.js +200 -36
  88. package/dist/commands/snapshots/list/command.d.ts +366 -25
  89. package/dist/commands/snapshots/list/command.js +296 -66
  90. package/dist/commands/snapshots/list/metadata.d.ts +16 -0
  91. package/dist/commands/snapshots/list/metadata.js +29 -6
  92. package/dist/commands/snapshots/list/outcomes.d.ts +245 -13
  93. package/dist/commands/snapshots/list/outcomes.js +221 -50
  94. package/dist/commands/snapshots/metadata.js +1 -1
  95. package/dist/commands/snapshots/prune/command.d.ts +430 -0
  96. package/dist/commands/snapshots/prune/command.js +161 -0
  97. package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
  98. package/dist/commands/snapshots/prune/metadata.js +39 -0
  99. package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
  100. package/dist/commands/snapshots/prune/outcomes.js +78 -0
  101. package/dist/commands/suites/list/command.js +17 -17
  102. package/dist/commands/suites/list/outcomes.js +2 -2
  103. package/dist/commands/test/command.d.ts +31 -2
  104. package/dist/commands/test/command.js +49 -252
  105. package/dist/commands/test/outcomes.d.ts +15 -1
  106. package/dist/config/check-runner.d.ts +3 -3
  107. package/dist/config/check-runner.js +8 -7
  108. package/dist/config/credential-resolver.d.ts +50 -5
  109. package/dist/config/credential-resolver.js +51 -19
  110. package/dist/config/credential-settle.d.ts +6 -2
  111. package/dist/config/credential-settle.js +11 -5
  112. package/dist/config/index.d.ts +2 -2
  113. package/dist/config/index.js +1 -1
  114. package/dist/config/runner.d.ts +5 -5
  115. package/dist/config/runner.js +1 -1
  116. package/dist/config/schema.d.ts +2 -2
  117. package/dist/config/schema.js +1 -1
  118. package/dist/config-file/define.d.ts +1 -1
  119. package/dist/config-file/define.js +1 -1
  120. package/dist/config-file/runner.d.ts +5 -5
  121. package/dist/config-file/toolchain.d.ts +1 -1
  122. package/dist/config-file/toolchain.js +2 -2
  123. package/dist/context.d.ts +8 -6
  124. package/dist/context.js +7 -6
  125. package/dist/core/across-sandboxes.d.ts +7 -6
  126. package/dist/core/across-sandboxes.js +123 -152
  127. package/dist/core/coordinator.d.ts +166 -0
  128. package/dist/core/coordinator.js +233 -0
  129. package/dist/core/events.d.ts +2 -2
  130. package/dist/core/index.d.ts +4 -2
  131. package/dist/core/index.js +1 -1
  132. package/dist/core/outcomes.d.ts +148 -0
  133. package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
  134. package/dist/core/resources.d.ts +31 -53
  135. package/dist/core/resources.js +32 -70
  136. package/dist/core/run-state.d.ts +7 -1
  137. package/dist/core/run-state.js +2 -0
  138. package/dist/core/run.d.ts +32 -236
  139. package/dist/core/run.js +106 -266
  140. package/dist/core/state-directory.d.ts +1 -1
  141. package/dist/core/state-directory.js +2 -2
  142. package/dist/credential/gateways.d.ts +15 -1
  143. package/dist/credential/index.d.ts +4 -3
  144. package/dist/credential/index.js +3 -2
  145. package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
  146. package/dist/credential/live/vercel-cli-gateway.js +1 -1
  147. package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
  148. package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
  149. package/dist/credential/source.d.ts +73 -6
  150. package/dist/credential/source.js +55 -2
  151. package/dist/extension-commands.d.ts +6 -1
  152. package/dist/extension-commands.js +15 -1
  153. package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
  154. package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
  155. package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
  156. package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
  157. package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
  158. package/dist/extensions/testserver/credential-facts.d.ts +6 -2
  159. package/dist/extensions/testserver/credential-facts.js +29 -11
  160. package/dist/extensions/testserver/lifecycle.js +7 -1
  161. package/dist/extensions/testserver/limit.d.ts +3 -0
  162. package/dist/extensions/testserver/limit.js +3 -0
  163. package/dist/extensions/testserver/provision.d.ts +8 -1
  164. package/dist/extensions/testserver/provision.js +8 -3
  165. package/dist/extensions/testserver/refusals.d.ts +6 -1
  166. package/dist/extensions/testserver/refusals.js +16 -1
  167. package/dist/extensions/testserver/resource.d.ts +1 -1
  168. package/dist/extensions/testserver/resource.js +1 -1
  169. package/dist/extensions/testserver/result.d.ts +1 -1
  170. package/dist/extensions/testserver/result.js +9 -4
  171. package/dist/planning/driver-file-lists.d.ts +0 -15
  172. package/dist/planning/driver-file-lists.js +2 -21
  173. package/dist/planning/plan-only.d.ts +3 -14
  174. package/dist/planning/plan-only.js +11 -20
  175. package/dist/planning/run-kind-flags.js +2 -2
  176. package/dist/planning/run-plan.d.ts +45 -12
  177. package/dist/planning/run-plan.js +4 -3
  178. package/dist/planning/suites.d.ts +1 -1
  179. package/dist/planning/suites.js +2 -2
  180. package/dist/planning/test-plan.d.ts +9 -0
  181. package/dist/planning/test-plan.js +9 -0
  182. package/dist/run-directory/recording.js +2 -2
  183. package/dist/run-directory/run-record.d.ts +21 -6
  184. package/dist/run-directory/run-record.js +12 -9
  185. package/dist/runner/base.js +1 -1
  186. package/dist/runner/build-snapshots.d.ts +55 -29
  187. package/dist/runner/build-snapshots.js +130 -29
  188. package/dist/runner/context.d.ts +15 -7
  189. package/dist/runner/context.js +19 -6
  190. package/dist/runner/events.d.ts +16 -10
  191. package/dist/runner/gateways.d.ts +87 -21
  192. package/dist/runner/gateways.js +1 -1
  193. package/dist/runner/index.d.ts +11 -7
  194. package/dist/runner/index.js +9 -4
  195. package/dist/runner/live/sandbox-errors.d.ts +2 -0
  196. package/dist/runner/live/sandbox-errors.js +4 -0
  197. package/dist/runner/live/sandbox-gateway.js +129 -3
  198. package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
  199. package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
  200. package/dist/runner/live/snapshot-records.js +6 -7
  201. package/dist/runner/local-snapshot-index.d.ts +199 -0
  202. package/dist/runner/local-snapshot-index.js +211 -0
  203. package/dist/runner/network-policy.d.ts +6 -6
  204. package/dist/runner/network-policy.js +7 -7
  205. package/dist/runner/policy-writes.d.ts +1 -1
  206. package/dist/runner/policy-writes.js +1 -1
  207. package/dist/runner/prepare.d.ts +14 -14
  208. package/dist/runner/prepare.js +20 -11
  209. package/dist/runner/ready.d.ts +18 -10
  210. package/dist/runner/ready.js +104 -33
  211. package/dist/runner/sandboxed-command.d.ts +3 -3
  212. package/dist/runner/sandboxed-command.js +3 -3
  213. package/dist/runner/scope.d.ts +10 -6
  214. package/dist/runner/scope.js +10 -3
  215. package/dist/runner/secrets.d.ts +13 -13
  216. package/dist/runner/secrets.js +18 -15
  217. package/dist/runner/session.d.ts +8 -8
  218. package/dist/runner/session.js +3 -3
  219. package/dist/runner/shared-snapshot-entry.d.ts +92 -0
  220. package/dist/runner/shared-snapshot-entry.js +168 -0
  221. package/dist/runner/shared-snapshot-list.d.ts +81 -0
  222. package/dist/runner/shared-snapshot-list.js +155 -0
  223. package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
  224. package/dist/runner/shared-snapshot-lookup.js +118 -0
  225. package/dist/runner/shared-snapshot-prune.d.ts +58 -0
  226. package/dist/runner/shared-snapshot-prune.js +133 -0
  227. package/dist/runner/snapshot-build.d.ts +42 -14
  228. package/dist/runner/snapshot-build.js +32 -29
  229. package/dist/runner/snapshot-choice.js +1 -1
  230. package/dist/runner/snapshot-inspect.d.ts +39 -40
  231. package/dist/runner/snapshot-inspect.js +55 -35
  232. package/dist/runner/snapshot-key.d.ts +13 -12
  233. package/dist/runner/snapshot-key.js +13 -12
  234. package/dist/runner/steps.d.ts +1 -1
  235. package/dist/runner/steps.js +1 -1
  236. package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +2 -2
  237. package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +3 -2
  238. package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +24 -23
  239. package/dist/runner/{recipe.js → vercel-sandbox-options.js} +70 -69
  240. package/dist/runner/{recipe-secrets.d.ts → vercel-sandbox-secrets.d.ts} +6 -6
  241. package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +20 -20
  242. package/dist/sdk/extension/commands.d.ts +8 -3
  243. package/dist/sdk/extension/commands.js +3 -1
  244. package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
  245. package/dist/sdk/extension/credential-diagnosis.js +25 -5
  246. package/dist/sdk/extension/credential-source.d.ts +20 -3
  247. package/dist/sdk/extension/credential-source.js +4 -4
  248. package/dist/sdk/extension/index.d.ts +3 -2
  249. package/dist/sdk/extension/index.js +2 -1
  250. package/dist/sdk/extension/resource-definition.d.ts +1 -1
  251. package/dist/sdk/extension/secret-source.d.ts +1 -1
  252. package/dist/sdk/extension/secret-source.js +1 -1
  253. package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
  254. package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
  255. package/dist/shared/cleanup.d.ts +3 -3
  256. package/dist/shared/cleanup.js +15 -5
  257. package/dist/shared/snapshot-text.d.ts +4 -4
  258. package/dist/shared/snapshot-text.js +11 -11
  259. package/dist/time/duration.js +1 -1
  260. package/package.json +3 -2
  261. package/skills/overview.md +4 -4
  262. package/skills/plan-runs.md +1 -1
  263. package/skills/read-run-output.md +6 -6
  264. package/dist/chunks/chunk-7EENF73W.js +0 -782
  265. package/dist/chunks/chunk-Z5PBVG3Y.js +0 -2599
  266. package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
  267. package/dist/commands/exec/across-sandboxes-run.js +0 -339
  268. package/dist/commands/exec/plan-only.d.ts +0 -10
  269. package/dist/commands/exec/plan-only.js +0 -45
  270. package/dist/commands/exec/run-command.d.ts +0 -475
  271. package/dist/commands/exec/run-command.js +0 -603
  272. package/dist/commands/exec/run-planned.d.ts +0 -20
  273. package/dist/commands/exec/run-planned.js +0 -22
  274. package/dist/commands/exec/sandbox-view.d.ts +0 -19
  275. package/dist/commands/exec/sandbox-view.js +0 -72
  276. package/dist/commands/test/plan.d.ts +0 -92
  277. package/dist/commands/test/plan.js +0 -125
  278. package/dist/core/sandbox-end.d.ts +0 -64
  279. package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
  280. package/dist/runner/snapshot-cache.d.ts +0 -148
  281. package/dist/runner/snapshot-cache.js +0 -126
@@ -0,0 +1,39 @@
1
+ import type { CommandResult, ExecutionContext } from "@vercel/clinkr";
2
+ import type { StormApp } from "../../context.ts";
3
+ import { type ResourceLifecycles } from "../../core/index.ts";
4
+ import { type PlannedFacts } from "../../planning/plan-only.ts";
5
+ import type { RunPlan } from "../../planning/run-plan.ts";
6
+ import { type TestPlanFacts } from "../../run-directory/index.ts";
7
+ import type { DriverHints } from "../../sdk/extension/index.ts";
8
+ import type { RunCommandRequest } from "./run-flags.ts";
9
+ import { type RanFacts, type SandboxesRanFacts } from "./run-summary.ts";
10
+ /**
11
+ * A run once it is planned: its plan, across runner sandboxes or not (`RunPlan.sandboxes`), and the resources'
12
+ * lifecycles, bound once over the run's Contexts, which planning and `beforeRun` share.
13
+ */
14
+ export interface PlannedRun {
15
+ readonly planned: RunPlan;
16
+ readonly lifecycles: ResourceLifecycles;
17
+ }
18
+ /**
19
+ * How one command ends its planned run: its name, optional test metadata, driver hints, and outcome builders for
20
+ * `ran`, `sandboxes_ran`, and `--plan-only`'s `planned`.
21
+ */
22
+ export interface RunSpec<TRan, TSandboxesRan, TPlanned> {
23
+ readonly name: string;
24
+ readonly test?: {
25
+ readonly driver: string;
26
+ readonly suite: string | null;
27
+ } | undefined;
28
+ readonly hints: Pick<DriverHints, "noFinalResults">;
29
+ readonly extraMismatchHint?: string;
30
+ ran(facts: RanFacts, plan: TestPlanFacts | undefined, noFinalTestResults: boolean): TRan;
31
+ sandboxesRan(facts: SandboxesRanFacts, noFinalTestResults: boolean): TSandboxesRan;
32
+ planned(facts: PlannedFacts): TPlanned;
33
+ }
34
+ /**
35
+ * Executes a planned run: with `--plan-only` answers the planned run without starting anything; otherwise runs
36
+ * `beforeRun`, prepares the runner, records and renders progress, and maps outcomes for either a single run or a run
37
+ * across runner sandboxes.
38
+ */
39
+ export declare function executePlannedRun<TRan extends CommandResult, TSandboxesRan, TPlanned>(context: ExecutionContext<StormApp>, request: RunCommandRequest, spec: RunSpec<TRan, TSandboxesRan, TPlanned>, plan: PlannedRun): Promise<TPlanned | TRan | TSandboxesRan | import("@vercel/clinkr").ClinkrError<"canceled"> | import("@vercel/clinkr").CommandError<"credential_unused"> | import("@vercel/clinkr").CommandError<"invalid_config"> | import("@vercel/clinkr").CommandError<"mint_failed"> | import("@vercel/clinkr").CommandError<"missing_target"> | import("@vercel/clinkr").CommandError<"no_base_ref"> | import("@vercel/clinkr").CommandError<"resource_needs_runner_sandbox"> | import("@vercel/clinkr").CommandError<"resource_refused"> | import("@vercel/clinkr").CommandError<"resource_refused_before_run"> | import("@vercel/clinkr").CommandError<"runner_failed"> | import("@vercel/clinkr").CommandError<"snapshot_gone"> | import("@vercel/clinkr").CommandError<"spawn_failed"> | import("@vercel/clinkr").CommandError<"submodules_refused"> | import("@vercel/clinkr").CommandError<"vercel_oidc_token_failed">>;
@@ -0,0 +1,325 @@
1
+ // Orchestrates a planned run for `storm test` and `storm exec`: `--plan-only`, single-run execution, and multi-sandbox
2
+ // execution. Delegates pre-start resource/runner checks to `before-run.ts`, end-of-run summaries and fact builders to
3
+ // `run-summary.ts`, and stopped-outcome mapping to `stopped-outcome.ts`.
4
+ import { acrossSandboxesExitStatus, commandExitStatus, executeAcrossSandboxes, executeRun, timedProgress, } from "../../core/index.js";
5
+ import { DEFINITION_SET } from "../../extensions.js";
6
+ import { forwardSigterm } from "../../forward-sigterm.js";
7
+ import { lacksFinalResults } from "../../planning/final-results.js";
8
+ import { buildPlannedFacts, plannedSecrets } from "../../planning/plan-only.js";
9
+ import { redactingObserver, redactingTerminal, redactor, redactStrings, } from "../../planning/redaction.js";
10
+ import { plannedTestPlan } from "../../planning/test-plan.js";
11
+ import { recordAcrossSandboxes, recordRun } from "../../run-directory/index.js";
12
+ import { RUN_CLEANUP } from "../../shared/cleanup.js";
13
+ import { isoSecondsText } from "../../shared/text.js";
14
+ import { beforeRunStarts, prepareRunnerForRun, resolveKeepMs, runnerRequestFor } from "./before-run.js";
15
+ import { countFinalResults, displayPath, listMismatches, sandboxesRanFacts, summarizeAcrossSandboxes, summarizeSingle, } from "./run-summary.js";
16
+ import { acrossSandboxesHeaderLines } from "./sandbox-lines.js";
17
+ import { sandboxProgress } from "./sandbox-progress.js";
18
+ import { mapStoppedOutcome } from "./stopped-outcome.js";
19
+ import { runView } from "./view.js";
20
+ /**
21
+ * Executes a planned run: with `--plan-only` answers the planned run without starting anything; otherwise runs
22
+ * `beforeRun`, prepares the runner, records and renders progress, and maps outcomes for either a single run or a run
23
+ * across runner sandboxes.
24
+ */
25
+ export async function executePlannedRun(context, request, spec, plan) {
26
+ const { planned, lifecycles } = plan;
27
+ if (request.planOnly)
28
+ return await runPlanOnly(context.app, planned, lifecycles, spec);
29
+ if (planned.sandboxes === undefined)
30
+ return await runSingle(context, request, spec, planned, lifecycles);
31
+ return await runAcrossSandboxes(context, request, spec, planned, lifecycles);
32
+ }
33
+ /** `--plan-only`: checks runner preparation and returns redacted `PlannedFacts` without starting anything. */
34
+ async function runPlanOnly(app, plan, lifecycles, spec) {
35
+ let vcpus = null;
36
+ if (plan.runner.kind === "vercel-sandbox") {
37
+ const prepared = await prepareRunnerForRun(app, plan.runner, {
38
+ configFile: plan.configFile,
39
+ resources: plan.resources,
40
+ sandboxes: plan.sandboxes?.sandboxes.length ?? 1,
41
+ secrets: plannedSecrets(lifecycles, plan.runner, plan.resources),
42
+ });
43
+ if (!prepared.ok)
44
+ return prepared.refusal;
45
+ vcpus = prepared.prepared.vcpus;
46
+ }
47
+ return spec.planned(buildPlannedFacts({
48
+ version: app.version,
49
+ commit: app.commit,
50
+ plan,
51
+ lifecycles,
52
+ vcpus,
53
+ }));
54
+ }
55
+ /** Runs a single planned run (on the launch machine or in one runner sandbox). */
56
+ async function runSingle(context, request, spec, planned, lifecycles) {
57
+ const { app, ui, signal } = context;
58
+ const { configFile, argv } = planned;
59
+ const plan = plannedTestPlan(planned);
60
+ const before = await beforeRunStarts(context, lifecycles, planned, request, plan);
61
+ if (!before.ok)
62
+ return before.refusal;
63
+ const { runner: resolvedRunner, used } = before;
64
+ const base = {
65
+ argv,
66
+ version: app.version,
67
+ commit: app.commit,
68
+ configFile,
69
+ verbose: request.verbose,
70
+ resources: used.requests,
71
+ skipped: used.skipped,
72
+ };
73
+ let run;
74
+ if (resolvedRunner.kind === "vercel-sandbox") {
75
+ const keepMs = resolveKeepMs(request.keepSandbox, resolvedRunner.options, "single");
76
+ const requested = await runnerRequestFor(app, resolvedRunner, used, { configFile, sandboxes: 1, keepMs });
77
+ if (!requested.ok)
78
+ return requested.refusal;
79
+ run = {
80
+ ...base,
81
+ runner: { kind: "vercel-sandbox", session: requested.runner, credential: resolvedRunner.credential },
82
+ };
83
+ }
84
+ else {
85
+ const env = Object.fromEntries(Object.entries(app.env).filter(([name]) => !used.hiddenVariables.includes(name)));
86
+ run = {
87
+ ...base,
88
+ runner: {
89
+ kind: "launch-machine",
90
+ env,
91
+ ...(resolvedRunner.credential === undefined ? {} : { credential: resolvedRunner.credential }),
92
+ },
93
+ };
94
+ }
95
+ const secrets = [...used.secrets, ...(resolvedRunner.kind === "vercel-sandbox" ? resolvedRunner.secrets : [])];
96
+ const redact = redactor(secrets);
97
+ const git = await checkoutGit(app.context.checkout, app.cwd);
98
+ // Only launch-machine runs forward SIGTERM directly to the child process; a run in a runner sandbox handles signals
99
+ // through `signal` alone and ignores `terminate`.
100
+ const sigterm = resolvedRunner.kind === "launch-machine" ? forwardSigterm(signal) : undefined;
101
+ const terminate = sigterm?.terminate ?? new AbortController().signal;
102
+ const view = runView({
103
+ presentation: app.presentation,
104
+ progress: ui.progress,
105
+ context: app.context,
106
+ mode: { kind: "single", showOutput: request.showOutput, verbose: request.verbose },
107
+ });
108
+ const recording = await recordRun(app.context.runDirectories, {
109
+ definitionSet: DEFINITION_SET,
110
+ clock: app.context.clock,
111
+ cwd: app.cwd,
112
+ configFile,
113
+ argv,
114
+ ...(spec.test === undefined ? {} : { test: spec.test }),
115
+ plan,
116
+ run,
117
+ git,
118
+ redact: (value) => redactStrings(value, redact),
119
+ });
120
+ const observer = recording.observer(view.observer);
121
+ const terminal = recording.terminal(view.runnerTerminal);
122
+ const collected = run.runner.kind === "vercel-sandbox" || recording.testEvents !== undefined;
123
+ const runRequest = run.runner.kind === "launch-machine" && recording.testEvents !== undefined
124
+ ? { ...run, runner: { ...run.runner, testEvents: recording.testEvents } }
125
+ : run;
126
+ let outcome;
127
+ try {
128
+ outcome = await runLifecycle({
129
+ execute: async () => await executeRun(DEFINITION_SET, { ...app.context, runnerTerminal: secrets.length === 0 ? terminal : redactingTerminal(terminal, redact) }, app.resourceContexts, runRequest, { signal, terminate }, timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))),
130
+ redact,
131
+ hasSecrets: secrets.length > 0,
132
+ finishView: async () => await view.finish(),
133
+ abandonRecording: async () => await recording.abandon(),
134
+ });
135
+ }
136
+ finally {
137
+ sigterm?.release();
138
+ }
139
+ const { timeline: ran, finalResults } = await summarizeSingle(app, {
140
+ command: spec.name,
141
+ hints: spec.hints,
142
+ view,
143
+ recording,
144
+ outcome,
145
+ });
146
+ if (outcome.kind !== "ran")
147
+ return mapStoppedOutcome(outcome);
148
+ const { command } = outcome;
149
+ const runId = recording.opened.ok ? recording.opened.id : null;
150
+ app.exit.status = commandExitStatus(outcome.command);
151
+ const facts = {
152
+ version: app.version,
153
+ commit: app.commit,
154
+ configFile,
155
+ resources: DEFINITION_SET.reports.ranFacts(outcome.resources),
156
+ cleanup: RUN_CLEANUP.facts(outcome),
157
+ command: command.kind === "exited"
158
+ ? { exitCode: command.code, signal: null }
159
+ : command.kind === "signaled"
160
+ ? { exitCode: null, signal: command.signal }
161
+ : { exitCode: null, signal: null },
162
+ runner: outcome.runner === undefined
163
+ ? null
164
+ : {
165
+ snapshotId: outcome.runner.snapshotId,
166
+ base: outcome.runner.base,
167
+ builtBehind: outcome.runner.builtBehind,
168
+ uploadBytes: outcome.runner.uploadBytes,
169
+ built: outcome.runner.built,
170
+ vcpus: outcome.runner.vcpus,
171
+ region: outcome.runner.region,
172
+ runtime: outcome.runner.runtime,
173
+ buildMs: outcome.runner.buildMs,
174
+ },
175
+ timeline: ran,
176
+ runId,
177
+ };
178
+ return spec.ran(secrets.length === 0 ? facts : redactStrings(facts, redact), plan, lacksFinalResults(command.kind === "exited" ? command.code : null, {
179
+ ...finalResults,
180
+ collected,
181
+ }));
182
+ }
183
+ /** Runs a planned run across runner sandboxes. */
184
+ async function runAcrossSandboxes(context, request, spec, planned, lifecycles) {
185
+ const { app, ui, signal } = context;
186
+ const { configFile, argv, runner: plannedRunner } = planned;
187
+ const sandboxes = planned.sandboxes.sandboxes;
188
+ const count = sandboxes.length;
189
+ const plan = plannedTestPlan(planned);
190
+ const before = await beforeRunStarts(context, lifecycles, planned, request, plan);
191
+ if (!before.ok)
192
+ return before.refusal;
193
+ const { used } = before;
194
+ const requested = await runnerRequestFor(app, plannedRunner, used, {
195
+ configFile,
196
+ sandboxes: count,
197
+ keepMs: resolveKeepMs(request.keepSandbox, plannedRunner.options, "sandboxes"),
198
+ });
199
+ if (!requested.ok)
200
+ return requested.refusal;
201
+ const { runner } = requested;
202
+ const secrets = [...used.secrets, ...plannedRunner.secrets];
203
+ const redact = redactor(secrets);
204
+ const git = await checkoutGit(app.context.checkout, app.cwd);
205
+ const recording = await recordAcrossSandboxes(app.context.runDirectories, {
206
+ definitionSet: DEFINITION_SET,
207
+ clock: app.context.clock,
208
+ cwd: app.cwd,
209
+ configFile,
210
+ argv,
211
+ ...(spec.test === undefined ? {} : { test: spec.test }),
212
+ plan,
213
+ runner,
214
+ sandboxes,
215
+ git,
216
+ redact: (value) => redactStrings(value, redact),
217
+ });
218
+ const runDirectory = recording.opened.ok
219
+ ? `${displayPath(recording.opened.path, app.env)}/`
220
+ : `none: couldn't make ${recording.opened.failure.path}: ${recording.opened.failure.message}`;
221
+ // Redact raw argv elements before shell-quoting so secrets containing apostrophes cannot bypass literal masking,
222
+ // and keep final header redaction for other fields such as runDirectory.
223
+ const view = runView({
224
+ presentation: app.presentation,
225
+ progress: ui.progress,
226
+ context: app.context,
227
+ mode: {
228
+ kind: "sandboxes",
229
+ progress: sandboxProgress({
230
+ count,
231
+ listed: sandboxes.map(({ files }) => (files === null ? null : files.length)),
232
+ header: acrossSandboxesHeaderLines({
233
+ version: app.version,
234
+ commit: app.commit,
235
+ argv: argv.map(redact),
236
+ count,
237
+ runDirectory,
238
+ }).map(redact),
239
+ }),
240
+ },
241
+ });
242
+ const observer = recording.observer(view.observer);
243
+ const outcome = await runLifecycle({
244
+ execute: async () => await executeAcrossSandboxes(DEFINITION_SET, {
245
+ ...app.context,
246
+ sandboxTerminal: (sandbox) => {
247
+ const terminal = recording.terminal(sandbox, app.context.runnerTerminal);
248
+ return secrets.length === 0 ? terminal : redactingTerminal(terminal, redact);
249
+ },
250
+ }, app.resourceContexts, {
251
+ version: app.version,
252
+ commit: app.commit,
253
+ configFile,
254
+ verbose: request.verbose,
255
+ runner,
256
+ credential: plannedRunner.credential,
257
+ sandboxes: sandboxes.map((sandbox) => ({
258
+ argv: sandbox.argv,
259
+ ...(sandbox.files === null ? {} : { files: sandbox.files }),
260
+ })),
261
+ resources: used.requests,
262
+ skipped: used.skipped,
263
+ }, { signal }, timedProgress(app.context.clock, secrets.length === 0 ? observer : redactingObserver(observer, redact))),
264
+ redact,
265
+ hasSecrets: secrets.length > 0,
266
+ finishView: async () => await view.finish(),
267
+ abandonRecording: async () => await recording.abandon(),
268
+ });
269
+ const recorded = await recording.end(outcome);
270
+ const mismatches = outcome.kind === "sandboxes_ran" ? listMismatches(recorded) : [];
271
+ await summarizeAcrossSandboxes(app, {
272
+ command: spec.name,
273
+ hints: spec.hints,
274
+ ...(spec.extraMismatchHint === undefined ? {} : { extraMismatchHint: spec.extraMismatchHint }),
275
+ view,
276
+ recording,
277
+ recorded,
278
+ outcome,
279
+ mismatches,
280
+ });
281
+ if (outcome.kind === "sandboxes_ran") {
282
+ app.exit.status = acrossSandboxesExitStatus(outcome.sandboxes);
283
+ const facts = sandboxesRanFacts(app, { outcome, recorded, recording, plan, runner, configFile, mismatches });
284
+ const everyExited0 = outcome.sandboxes.every(({ state, exitCode }) => state === "passed" && exitCode === 0);
285
+ const noFinalTestResults = lacksFinalResults(everyExited0 ? 0 : null, {
286
+ ...countFinalResults(recorded.tests),
287
+ collected: true,
288
+ });
289
+ return spec.sandboxesRan(secrets.length === 0 ? facts : redactStrings(facts, redact), noFinalTestResults);
290
+ }
291
+ const keptLines = recorded.sandboxes.flatMap(({ record }) => record.name === null || record.keptUntil === null
292
+ ? []
293
+ : [`Kept runner sandbox ${record.sandbox}, ${record.name}, running until ${isoSecondsText(record.keptUntil)}.`]);
294
+ return mapStoppedOutcome(outcome, {
295
+ commandLine: outcome.kind === "canceled" && outcome.commandStopped === true
296
+ ? "Each command that was running was stopped in its runner sandbox."
297
+ : "The command didn't run.",
298
+ keptLines,
299
+ });
300
+ }
301
+ /**
302
+ * Executes a run inside the shared lifecycle guard: redacts the returned outcome when the run carries secrets, and
303
+ * ensures the view finishes and the recording is abandoned if execution throws.
304
+ */
305
+ async function runLifecycle(options) {
306
+ try {
307
+ const ended = await options.execute();
308
+ // An outcome's facts, such as a failed Sandbox call's message, can quote what the run handed its command.
309
+ return options.hasSecrets ? redactStrings(ended, options.redact) : ended;
310
+ }
311
+ catch (error) {
312
+ // A live region must not outlive the run, however it ends, and abandoning the recording completes the run
313
+ // directory and removes any staged test events left there unredacted. They are never saved: the run didn't end.
314
+ await options.finishView();
315
+ await options.abandonRecording();
316
+ throw error;
317
+ }
318
+ }
319
+ async function checkoutGit(checkout, cwd) {
320
+ const root = await checkout.repositoryRoot({ cwd });
321
+ if (!root.ok)
322
+ return null;
323
+ const head = await checkout.head({ repoRoot: root.value });
324
+ return head.ok ? { ...head.value } : null;
325
+ }
@@ -1,13 +1,13 @@
1
1
  import { type RunState } from "../../core/index.ts";
2
2
  import { type Paint } from "../../shared/text.ts";
3
3
  /**
4
- * A run's phases, in order. In a sandboxed run the resources' lanes and the runner run at once, as `lanes`;
5
- * unsandboxed, the resources' lanes run alone, as `resources`.
4
+ * A run's phases, in order. When a runner lane runs beside the resources' lanes, both render together as `lanes`;
5
+ * when the resources' lanes run alone, they render as `resources`.
6
6
  */
7
7
  export type LivePhase = "credential" | "lanes" | "resources" | "command" | "cleanup";
8
8
  /** The phase that runs now; undefined before the first. */
9
9
  export declare function activePhase(state: RunState): LivePhase | undefined;
10
- /** The run's first line: storm's version and, in a sandboxed run, the base. Like a final form, it isn't cut. */
10
+ /** The run's first line: storm's version and, when a merge-base is present, the base. Like a final form, it isn't cut. */
11
11
  export declare function headerLine(state: RunState, paint: Paint): string;
12
12
  /**
13
13
  * Phase `phase`'s live block at `now`, `width` columns wide. Its height stays the same while the phase runs.
@@ -1,9 +1,9 @@
1
1
  // The live view of a run on a terminal: its phases drawn by pure renderers from the run's state (`RunState`, built
2
2
  // by `DEFINITION_SET.applyEvent`). A run goes through its phases in order: the credential, then the resources' lanes
3
- // and the runner side by side (or the resources' lanes alone, unsandboxed; or the runner alone without a resource
4
- // lane), then the command and the cleanup. The phase that runs shows live in a block of fixed height; once the next one
5
- // starts, it is printed above for good in its final form. Each resource lane's rows are its presentation's text
6
- // (`DEFINITION_SET.presentations`), laid out here.
3
+ // and the runner side by side (or the resources' lanes alone without a runner lane; or the runner alone without a
4
+ // resource lane), then the command and the cleanup. The phase that runs shows live in a block of fixed height; once
5
+ // the next one starts, it is printed above for good in its final form. Each resource lane's rows are its
6
+ // presentation's text (`DEFINITION_SET.presentations`), laid out here.
7
7
  import { cleanupProblems, megabytesText, setupPhaseKey, setupPhaseWords, } from "../../core/index.js";
8
8
  import { mintTargetText } from "../../credential/index.js";
9
9
  import { DEFINITION_SET } from "../../extensions.js";
@@ -41,7 +41,7 @@ function instanceLanes(state) {
41
41
  function startedLanes(state) {
42
42
  return DEFINITION_SET.presentations.lanes(Object.entries(state.resources).map(([resource, { definition }]) => ({ resource, definition })));
43
43
  }
44
- /** The run's first line: storm's version and, in a sandboxed run, the base. Like a final form, it isn't cut. */
44
+ /** The run's first line: storm's version and, when a merge-base is present, the base. Like a final form, it isn't cut. */
45
45
  export function headerLine(state, paint) {
46
46
  const version = state.version === undefined ? "" : versionText(state.version.version, state.version.commit);
47
47
  const header = [
@@ -69,7 +69,7 @@ export function phaseFrame(state, phase, now, width, paint) {
69
69
  case "lanes":
70
70
  return lanesFrame(state, view);
71
71
  case "resources":
72
- return unsandboxedResourcesFrame(state, view);
72
+ return resourceLanesFrame(state, view);
73
73
  case "command":
74
74
  return commandFrame(state, view);
75
75
  case "cleanup":
@@ -99,7 +99,7 @@ export function phaseRecord(state, phase, width, paint) {
99
99
  case "lanes":
100
100
  return lanesRecord(state, view);
101
101
  case "resources":
102
- return unsandboxedResourcesRecord(state, view);
102
+ return resourceLanesRecord(state, view);
103
103
  case "command":
104
104
  return state.command === undefined ? [] : [commandLine(state, state.command, view, false)];
105
105
  case "cleanup":
@@ -219,8 +219,9 @@ function snapshotText(step, runner, mergeBase) {
219
219
  if (runner.snapshot?.kind === "built")
220
220
  return "snapshot built";
221
221
  if (runner.snapshot?.kind === "reused") {
222
- const { base, builtBehind } = runner.snapshot;
223
- return `snapshot ${builtAtText({ base, builtBehind, mergeBase })}`;
222
+ const { base, builtBehind, source } = runner.snapshot;
223
+ const from = source === "shared" ? ", from the shared snapshot index" : "";
224
+ return `snapshot ${builtAtText({ base, builtBehind, mergeBase })}${from}`;
224
225
  }
225
226
  return `snapshot build ${step.status === "running" ? "stopped" : step.status}`;
226
227
  }
@@ -282,11 +283,11 @@ function stepsText(steps, view, uploadBytes) {
282
283
  .join(" · ");
283
284
  }
284
285
  /**
285
- * The unsandboxed run's resources block: each started resource lane's row, and under it what the lane says goes under
286
- * its row, such as the creates in flight, else blank. A mint in flight, which the run makes once for whichever resource
287
- * asked, takes the row under the first lane's.
286
+ * Resource lanes running alone (without a runner lane): each started resource lane's row, and under it what the lane
287
+ * says goes under its row, such as work in flight, else blank. A mint in flight, which the run makes once for
288
+ * whichever resource asked, takes the row under the first lane's.
288
289
  */
289
- function unsandboxedResourcesFrame(state, view) {
290
+ function resourceLanesFrame(state, view) {
290
291
  const { mint } = state;
291
292
  const draw = laneDraw(view);
292
293
  const mintRow = mint !== undefined && mint.status === "running"
@@ -306,10 +307,10 @@ function unsandboxedResourcesFrame(state, view) {
306
307
  ]);
307
308
  }
308
309
  /**
309
- * The unsandboxed run's resources' final form: the mint they waited on, if any, then each lane's line and the lines
310
+ * Final form of resource lanes running alone: the mint they waited on, if any, then each lane's line and the lines
310
311
  * under it.
311
312
  */
312
- function unsandboxedResourcesRecord(state, view) {
313
+ function resourceLanesRecord(state, view) {
313
314
  const { mint } = state;
314
315
  const draw = laneDraw(view);
315
316
  const lanes = startedLanes(state).flatMap((lane) => {
@@ -1,6 +1,6 @@
1
1
  // src/commands/exec/metadata.ts
2
2
  var metadata = {
3
- description: `Run any command, the argument list after --, as it is, with the run payload in STORM_RUN. For a project's tests declared in storm.config.ts, use storm test, which finds the driver's program and can count the tests and size the run first (testPlan in storm.config.ts or --count-tests); exec counts nothing and sizes nothing. Where the command runs is the runner declared at the top level of storm.config.ts (launchMachine() or vercelSandbox({ \u2026 })), or --runner launch-machine, which runs on the launch machine and needs no config file. On the launch machine, the command runs on this machine in the working directory, with this machine's environment less the launcher environment variables the run's resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color. With vercelSandbox({ \u2026 }), it runs in a runner sandbox, a Vercel Sandbox readied from the runner recipe in storm.config.ts, in the recipe's cwd, with the runner sandbox's own environment, a PATH that starts with node_modules/.bin of that cwd and of the repository's root, the recipe's env, FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color (a plain non-TTY launcher gets neither), any variables declared in the recipe's unsafeSecretEnvVars (each read from its source, { kind: "env", name }; command-only, never in steps or snapshots, and incompatible with keeping the runner sandbox), and STORM_RUN, and nothing else from this machine's environment; during the toolchain and prebuild steps of a snapshot build, then from the install until the command has ended, never during the upload or the apply, the Sandbox firewall adds each credential the recipe's credentials key declares\u2014the value read from its source ({ kind: "env", name })\u2014as its header to the requests to its domain, GET and HEAD only by default, answering every other request to that domain with 403, or every request with requests: "all", so the value never enters the runner sandbox; storm shows each value as <token> in what it prints and writes, and a run in a runner sandbox refuses before it starts when one of them is unset, holds a line break, or is shorter than 8 characters; each path under the repository's root in its arguments points at the runner sandbox's copy, and each in its output back at this checkout. The run has each resource that storm.config.ts declares under resources or that one of the resource's own flags names, unless the resource skips itself: it first acquires each one, while the Vercel Sandbox runner readies its runner sandbox, hands it to the command under the run payload's resources, and releases it once the command has stopped; without one, the run payload names no resource. While the command runs in a runner sandbox, and only then, the Sandbox firewall adds each sandbox credential a resource gives the command to the requests to its domain, replacing a header of that name the request carries, so the value never enters the runner sandbox; a resource that gives one needs a runner sandbox, so a run on the launch machine that uses it is refused with resource_needs_runner_sandbox before it starts. Each resource's flags and examples are below, and its own commands are under storm ext. Shows on stderr what runs when and what runs at once, live on a terminal and one line at a time elsewhere, then a waterfall of the run's lanes naming its critical path, and exits with the command's code. Each run writes what it was and how it ended, its events, its steps' output, its command's output, its test events, and its timeline to a run directory under \${XDG_STATE_HOME:-~/.local/state}/storm/runs/, named for its run id, keeping the newest 1000 completed ones and every one whose run is still going; the summary names the run id, storm runs show reads the run back, and storm runs logs prints its command's output and its steps' logs. A flag overrides storm.config.ts, found in the working directory or a parent up to the git worktree's root and checked whole, which overrides the built-in default; storm.config.mts works the same, always loads as an ES module, and suits a package.json without "type": "module", and one directory may hold only one of the two. A resource's secrets, such as a token it reads from this machine's environment, show as <token> in what the run prints and writes. With --sandboxes <n> and the Vercel Sandbox runner, it is a run across runner sandboxes: one mint and one runner snapshot serve n runner sandboxes, which start at once, and each runner sandbox runs the command with {sandbox} replaced by its runner sandbox index (from 0), {sandbox+1} by its index plus one, and {sandboxes} by n; storm.config.ts must set runner.sandboxes.max; each resource of the run is acquired once and split across the runner sandboxes, each runner sandbox getting its own part; it prints status lines and no command output, each runner sandbox's output goes to its own command log in the run directory, and storm exits 0 when every runner sandbox passed, else 1.`,
3
+ description: `Run any command, the argument list after --, as it is, with the run payload in STORM_RUN. For a project's tests declared in storm.config.ts, use storm test, which finds the driver's program and can count the tests and size the run first (testPlan in storm.config.ts or --count-tests); exec counts nothing and sizes nothing. Where the command runs is the runner declared at the top level of storm.config.ts (launchMachine() or vercelSandbox({ \u2026 })), or --runner launch-machine, which runs on the launch machine and needs no config file. On the launch machine, the command runs on this machine in the working directory, with this machine's environment less the launcher environment variables the run's resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color. With vercelSandbox({ \u2026 }), it runs in a runner sandbox, a Vercel Sandbox readied from the Vercel Sandbox runner in storm.config.ts, in the runner's cwd, with the runner sandbox's own environment, a PATH that starts with node_modules/.bin of that cwd and of the repository's root, the runner's env, FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color (a plain non-TTY launcher gets neither), any variables declared in the runner's unsafeSecretEnvVars (each read from its source, { kind: "env", name }; command-only, never in steps or snapshots, and incompatible with keeping the runner sandbox), and STORM_RUN, and nothing else from this machine's environment; during the toolchain and prebuild steps of a snapshot build, then from the install until the command has ended, never during the upload or the apply, the Sandbox firewall adds each credential the runner's credentials key declares\u2014the value read from its source ({ kind: "env", name })\u2014as its header to the requests to its domain, GET and HEAD only by default, answering every other request to that domain with 403, or every request with requests: "all", so the value never enters the runner sandbox; storm shows each value as <token> in what it prints and writes, and a run in a runner sandbox refuses before it starts when one of them is unset, holds a line break, or is shorter than 8 characters; each path under the repository's root in its arguments points at the runner sandbox's copy, and each in its output back at this checkout. The run has each resource that storm.config.ts declares under resources or that one of the resource's own flags names, unless the resource skips itself: it first acquires each one, while the Vercel Sandbox runner readies its runner sandbox, hands it to the command under the run payload's resources, and releases it once the command has stopped; without one, the run payload names no resource. While the command runs in a runner sandbox, and only then, the Sandbox firewall adds each sandbox credential a resource gives the command to the requests to its domain, replacing a header of that name the request carries, so the value never enters the runner sandbox; a resource that gives one needs a runner sandbox, so a run on the launch machine that uses it is refused with resource_needs_runner_sandbox before it starts. Each resource's flags and examples are below, and its own commands are under storm ext. Shows on stderr what runs when and what runs at once, live on a terminal and one line at a time elsewhere, then a waterfall of the run's lanes naming its critical path, and exits with the command's code. Each run writes what it was and how it ended, its events, its steps' output, its command's output, its test events, and its timeline to a run directory under \${XDG_STATE_HOME:-~/.local/state}/storm/runs/, named for its run id, keeping the newest 1000 completed ones and every one whose run is still going; the summary names the run id, storm runs show reads the run back, and storm runs logs prints its command's output and its steps' logs. A flag overrides storm.config.ts, found in the working directory or a parent up to the git worktree's root and checked whole, which overrides the built-in default; storm.config.mts works the same, always loads as an ES module, and suits a package.json without "type": "module", and one directory may hold only one of the two. A resource's secrets, such as a token it reads from this machine's environment, show as <token> in what the run prints and writes. With --sandboxes <n> and the Vercel Sandbox runner, it is a run across runner sandboxes: one mint and one runner snapshot serve n runner sandboxes, which start at once, and each runner sandbox runs the command with {sandbox} replaced by its runner sandbox index (from 0), {sandbox+1} by its index plus one, and {sandboxes} by n; storm.config.ts must set runner.sandboxes.max; each resource of the run is acquired once and split across the runner sandboxes, each runner sandbox getting its own part; it prints status lines and no command output, each runner sandbox's output goes to its own command log in the run directory, and storm exits 0 when every runner sandbox passed, else 1.`,
4
4
  summary: "Run any command with the declared runner or on the launch machine."
5
5
  };
6
6
  export {
@@ -8,6 +8,16 @@ export declare const mintFailedErrors: import("@vercel/clinkr").SharedErrors<{
8
8
  runner: z.ZodBoolean;
9
9
  cleanup: z.ZodType<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts>>;
10
10
  }, z.core.$strip>;
11
+ vercelOidcTokenFailed: z.ZodObject<{
12
+ cause: z.ZodEnum<{
13
+ "invalid-token": "invalid-token";
14
+ "missing-token": "missing-token";
15
+ }>;
16
+ detail: z.ZodString;
17
+ fix: z.ZodString;
18
+ runner: z.ZodBoolean;
19
+ cleanup: z.ZodType<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts>>;
20
+ }, z.core.$strip>;
11
21
  }, {
12
22
  readonly mintFailed: {
13
23
  readonly exitCode: 1;
@@ -36,4 +46,32 @@ export declare const mintFailedErrors: import("@vercel/clinkr").SharedErrors<{
36
46
  }[];
37
47
  };
38
48
  };
49
+ readonly vercelOidcTokenFailed: {
50
+ readonly exitCode: 1;
51
+ readonly description: "With --credential vercel-oidc, VERCEL_OIDC_TOKEN is missing, empty, or not a valid Vercel project OIDC token, so the command didn't run.";
52
+ readonly schema: z.ZodObject<{
53
+ cause: z.ZodEnum<{
54
+ "invalid-token": "invalid-token";
55
+ "missing-token": "missing-token";
56
+ }>;
57
+ detail: z.ZodString;
58
+ fix: z.ZodString;
59
+ runner: z.ZodBoolean;
60
+ cleanup: z.ZodType<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts>>;
61
+ }, z.core.$strip>;
62
+ readonly render: ({ detail, fix, runner, cleanup }: {
63
+ cause: "invalid-token" | "missing-token";
64
+ detail: string;
65
+ fix: string;
66
+ runner: boolean;
67
+ cleanup: import("../../shared/cleanup.ts").StormCleanupFacts;
68
+ }) => {
69
+ message: string;
70
+ rows?: readonly import("@vercel/clinkr").Row[];
71
+ next: {
72
+ type: "text";
73
+ text: string;
74
+ }[];
75
+ };
76
+ };
39
77
  }>;
@@ -1,9 +1,11 @@
1
- // A run's `mint_failed`, shared by `storm test` and `storm exec`: the run's mint failed. With the Vercel Sandbox
2
- // runner, the core mints for the runner sandbox first, whatever the resources are (`runner: true`); on the launch
3
- // machine, when the run settled the mint, the core's credential source mints when a resource first asks for a
4
- // credential, and the run ends this way when that resource can't go on without it (`runner: false`).
1
+ // A run's `mint_failed` and `vercel_oidc_token_failed`, shared by `storm test` and `storm exec`: obtaining the run's
2
+ // Vercel credential failed. With the Vercel Sandbox runner, the core obtains the credential for the runner sandbox
3
+ // first, whatever the resources are (`runner: true`); on the launch machine, when the run settled the mint, the core's
4
+ // credential source mints when a resource first asks for a credential, and the run ends this way when that resource
5
+ // can't go on without it (`runner: false`).
5
6
  import { defineErrors } from "@vercel/clinkr";
6
7
  import { z } from "zod";
8
+ import { vercelOidcTokenFailureShape } from "../../credential/index.js";
7
9
  import { RUN_CLEANUP } from "../../shared/cleanup.js";
8
10
  export const mintFailedErrors = defineErrors({
9
11
  mintFailed: {
@@ -30,4 +32,25 @@ export const mintFailedErrors = defineErrors({
30
32
  };
31
33
  },
32
34
  },
35
+ vercelOidcTokenFailed: {
36
+ exitCode: 1,
37
+ description: "With --credential vercel-oidc, VERCEL_OIDC_TOKEN is missing, empty, or not a valid Vercel project OIDC token, so the command didn't run.",
38
+ schema: z.object({
39
+ ...vercelOidcTokenFailureShape,
40
+ /** Whether the credential was for the runner sandbox, not for a resource. */
41
+ runner: z.boolean(),
42
+ /** What the run couldn't clean up. */
43
+ cleanup: RUN_CLEANUP.schema,
44
+ }),
45
+ render: ({ detail, fix, runner, cleanup }) => {
46
+ const rows = RUN_CLEANUP.rows(cleanup);
47
+ return {
48
+ message: runner
49
+ ? `Couldn't use VERCEL_OIDC_TOKEN for the runner sandbox: ${detail}. The command didn't run.`
50
+ : `Couldn't use VERCEL_OIDC_TOKEN: ${detail}. One of the run's resources needed it, so the command didn't run.`,
51
+ ...(rows.length === 0 ? {} : { rows }),
52
+ next: [{ type: "text", text: fix }],
53
+ };
54
+ },
55
+ },
33
56
  });