@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,4 +1,4 @@
1
- import { type CommandTree, type Mount } from "@vercel/clinkr";
1
+ import { type CommandTree, type ManifestEntry, type Mount } from "@vercel/clinkr";
2
2
  export { type CommandMetadata, type CommandTree, commandTree, defineOutcomes, renderOutcome, type Row, type Warning, } from "@vercel/clinkr";
3
3
  /**
4
4
  * What an extension's author declares of its commands: its command tree, whose commands take `App`, the tree's own app;
@@ -33,12 +33,17 @@ export interface ExtensionCommands<LauncherApp> {
33
33
  readonly mount: (placement: ExtensionCommandsPlacement) => Mount<LauncherApp>;
34
34
  }
35
35
  /** Where the launcher mounts an extension's commands: the launcher's choice, never the extension's. */
36
- export interface ExtensionCommandsPlacement {
36
+ export type ExtensionCommandsPlacement = {
37
37
  /** Where the tree's commands sit in `storm`, such as `["ext", "<name>"]`. */
38
38
  readonly path: readonly string[];
39
39
  /** Storm's code root (`src/` or `dist/`), which the tree's directory is under. */
40
40
  readonly root: string;
41
- }
41
+ } | {
42
+ /** Where the tree's commands sit in `storm`, such as `["ext", "<name>"]`. */
43
+ readonly path: readonly string[];
44
+ /** Pre-built static manifest entries for compiled or bundled builds. */
45
+ readonly manifest: Readonly<Record<string, ManifestEntry>>;
46
+ };
42
47
  /** Declares an extension's commands. Only this function calls Clinkr's `mount`, since it knows the tree's app type. */
43
48
  export declare function defineExtensionCommands<LauncherApp, App>(definition: ExtensionCommandsDefinition<LauncherApp, App>): ExtensionCommands<LauncherApp>;
44
49
  /** A Clinkr example written as `{ argv, description? }`: the arguments after the command's name, and what it does. */
@@ -20,7 +20,9 @@ export function defineExtensionCommands(definition) {
20
20
  return {
21
21
  description,
22
22
  directory,
23
- mount: ({ path, root }) => mount(tree.directory(join(root, directory)), { path, description, app }),
23
+ mount: (placement) => "manifest" in placement
24
+ ? mount(tree.manifest(placement.manifest), { path: placement.path, description, app })
25
+ : mount(tree.directory(join(placement.root, directory)), { path: placement.path, description, app }),
24
26
  };
25
27
  }
26
28
  /**
@@ -1,4 +1,4 @@
1
- import type { CredentialFailure, MintFailure, MintTarget, TokenRequestFailure } from "./credential-source.ts";
1
+ import type { CredentialFailure, MintFailure, MintTarget, TokenRequestFailure, VercelOidcTokenFailure } from "./credential-source.ts";
2
2
  /** One cause and one fix for a credential source's failure, worded for the person running storm. */
3
3
  export interface CredentialDiagnosis {
4
4
  readonly cause: string;
@@ -8,5 +8,7 @@ export interface CredentialDiagnosis {
8
8
  export declare function describeMintFailure(failure: MintFailure, target: MintTarget): CredentialDiagnosis;
9
9
  /** Names the cause of a failed GitHub Actions OIDC token request and the one fix for it. */
10
10
  export declare function describeTokenRequestFailure(failure: TokenRequestFailure): CredentialDiagnosis;
11
+ /** Names the cause of a failed `VERCEL_OIDC_TOKEN` read and the one fix for it. */
12
+ export declare function describeVercelOidcTokenFailure(failure: VercelOidcTokenFailure): CredentialDiagnosis;
11
13
  /** Names the cause of a credential source's failure and the one fix for it, for whichever source it was. */
12
14
  export declare function describeCredentialFailure(failure: CredentialFailure): CredentialDiagnosis;
@@ -1,5 +1,5 @@
1
- // How a credential source's failure is worded for the person running storm: one cause and one fix, for a failed mint
2
- // or a failed GitHub Actions OIDC token request.
1
+ // How a credential source's failure is worded for the person running storm: one cause and one fix, for a failed mint,
2
+ // a failed GitHub Actions OIDC token request, or an unreadable `VERCEL_OIDC_TOKEN`.
3
3
  /** Names the cause of a failed mint and the one fix for it. */
4
4
  export function describeMintFailure(failure, target) {
5
5
  const loginStep = `\`vercel login\` with an account on the \`${target.team}\` team`;
@@ -79,11 +79,31 @@ export function describeTokenRequestFailure(failure) {
79
79
  return { cause: `GitHub's answer to the token request held no token: ${last.said}`, fix };
80
80
  }
81
81
  }
82
+ /** Names the cause of a failed `VERCEL_OIDC_TOKEN` read and the one fix for it. */
83
+ export function describeVercelOidcTokenFailure(failure) {
84
+ switch (failure.kind) {
85
+ case "missing-token":
86
+ return {
87
+ cause: "`VERCEL_OIDC_TOKEN` is not set or is empty",
88
+ fix: "Set `VERCEL_OIDC_TOKEN` to a Vercel project OIDC token (for example, from `vercel project token` or Vercel OIDC in CI), or use `--credential mint`, then retry.",
89
+ };
90
+ case "invalid-token":
91
+ return {
92
+ cause: "`VERCEL_OIDC_TOKEN` is not a valid Vercel project OIDC token (expected a JWT with `owner_id` and `project_id` claims)",
93
+ fix: "Set `VERCEL_OIDC_TOKEN` to a Vercel project OIDC token from `vercel project token` or Vercel OIDC, then retry.",
94
+ };
95
+ }
96
+ }
82
97
  /** Names the cause of a credential source's failure and the one fix for it, for whichever source it was. */
83
98
  export function describeCredentialFailure(failure) {
84
- return failure.source === "mint"
85
- ? describeMintFailure(failure.failure, failure.target)
86
- : describeTokenRequestFailure(failure.failure);
99
+ switch (failure.source) {
100
+ case "mint":
101
+ return describeMintFailure(failure.failure, failure.target);
102
+ case "github-actions":
103
+ return describeTokenRequestFailure(failure.failure);
104
+ case "vercel-oidc":
105
+ return describeVercelOidcTokenFailure(failure.failure);
106
+ }
87
107
  }
88
108
  function variablesText(missing) {
89
109
  return missing.map((name) => `\`${name}\``).join(" and ");
@@ -92,6 +92,18 @@ export type TokenRequestFailure = {
92
92
  readonly kind: "variables-missing";
93
93
  }>;
94
94
  };
95
+ /**
96
+ * Why reading a Vercel OIDC token from `VERCEL_OIDC_TOKEN` failed. Never carries the raw token.
97
+ *
98
+ * - `missing-token`: `VERCEL_OIDC_TOKEN` is unset or empty.
99
+ * - `invalid-token`: `VERCEL_OIDC_TOKEN` is not a valid Vercel project OIDC token (a JWT with `owner_id` and
100
+ * `project_id` claims).
101
+ */
102
+ export type VercelOidcTokenFailure = {
103
+ readonly kind: "missing-token";
104
+ } | {
105
+ readonly kind: "invalid-token";
106
+ };
95
107
  /** Why a credential source couldn't give a credential, tagged by the source. */
96
108
  export type CredentialFailure = {
97
109
  readonly source: "mint";
@@ -100,6 +112,9 @@ export type CredentialFailure = {
100
112
  } | {
101
113
  readonly source: "github-actions";
102
114
  readonly failure: TokenRequestFailure;
115
+ } | {
116
+ readonly source: "vercel-oidc";
117
+ readonly failure: VercelOidcTokenFailure;
103
118
  };
104
119
  export type CredentialOutcome = {
105
120
  readonly ok: true;
@@ -109,9 +124,9 @@ export type CredentialOutcome = {
109
124
  readonly failure: CredentialFailure;
110
125
  };
111
126
  /**
112
- * Where a credential a service rejected came from: the mint, for `target`, or a GitHub Actions OIDC token, with the
113
- * claims a service's trust rules match on (`undefined` when they can't be read). A resource words its own rejection
114
- * from it.
127
+ * Where a credential a service rejected came from: the mint, for `target`; a GitHub Actions OIDC token, with the
128
+ * claims a service's trust rules match on (`undefined` when they can't be read); or `VERCEL_OIDC_TOKEN`. A resource
129
+ * words its own rejection from it.
115
130
  */
116
131
  export type CredentialOrigin = {
117
132
  readonly source: "mint";
@@ -119,6 +134,8 @@ export type CredentialOrigin = {
119
134
  } | {
120
135
  readonly source: "github-actions";
121
136
  readonly claims: GitHubActionsClaims | undefined;
137
+ } | {
138
+ readonly source: "vercel-oidc";
122
139
  };
123
140
  /**
124
141
  * Where a run gets its credential. A caller obtains one with `obtain()` right before each request that needs one, and
@@ -1,5 +1,5 @@
1
- // The credential a resource's acquire gets, and the declarations around it: where a credential source gets one (the mint
2
- // for a target, or a GitHub Actions OIDC token request), why one failed, and where a credential came from. The
3
- // extension API declares them, since its lifecycle hands them to a resource; the launcher's `credential` module
4
- // implements the sources over its gateways. Types only.
1
+ // The credential a resource's acquire gets, and the declarations around it: where a credential source gets one (the
2
+ // mint for a target, a GitHub Actions OIDC token request, or `VERCEL_OIDC_TOKEN`), why one failed, and where a
3
+ // credential came from. The extension API declares them, since its lifecycle hands them to a resource; the launcher's
4
+ // `credential` module implements the sources over its gateways. Types only.
5
5
  export {};
@@ -1,7 +1,8 @@
1
1
  export { Credential, type GitHubActionsClaims, type VercelProject } from "./credential.ts";
2
- export { type CredentialDiagnosis, describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, } from "./credential-diagnosis.ts";
3
- export type { CredentialFailure, CredentialOrigin, CredentialOutcome, CredentialSource, MintFailure, MintStep, MintTarget, TokenAttemptFailure, TokenRequestFailure, TokenRequestVariable, } from "./credential-source.ts";
2
+ export { type CredentialDiagnosis, describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, describeVercelOidcTokenFailure, } from "./credential-diagnosis.ts";
3
+ export type { CredentialFailure, CredentialOrigin, CredentialOutcome, CredentialSource, MintFailure, MintStep, MintTarget, TokenAttemptFailure, TokenRequestFailure, TokenRequestVariable, VercelOidcTokenFailure, } from "./credential-source.ts";
4
4
  export { tokenRequestFailureFacts, tokenRequestFailureShape } from "./token-request-facts.ts";
5
+ export { vercelOidcTokenFailureFacts, vercelOidcTokenFailureShape } from "./vercel-oidc-facts.ts";
5
6
  export type { Clock, Timer } from "./time.ts";
6
7
  export { defineResource, type ResourceSpec } from "./resource.ts";
7
8
  export { argsText, defineDriver, type Driver, DRIVER_PLAN_FAILURE_KINDS, type DriverHints, type DriverPlanAnswer, type DriverPlanFailureKind, type DriverPlanned, type DriverPlanRequest, type DriverRefusalWords, type DriverFileListSupport, type DriverFileListValidation, type DriverSpec, } from "./driver.ts";
@@ -36,8 +36,9 @@
36
36
  // `commands.ts`, even for types, so its declarations reach no Clinkr either
37
37
  // (`test/integration/package-types.integration.test.ts`).
38
38
  export { Credential } from "./credential.js";
39
- export { describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, } from "./credential-diagnosis.js";
39
+ export { describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, describeVercelOidcTokenFailure, } from "./credential-diagnosis.js";
40
40
  export { tokenRequestFailureFacts, tokenRequestFailureShape } from "./token-request-facts.js";
41
+ export { vercelOidcTokenFailureFacts, vercelOidcTokenFailureShape } from "./vercel-oidc-facts.js";
41
42
  export { defineResource } from "./resource.js";
42
43
  export { argsText, defineDriver, DRIVER_PLAN_FAILURE_KINDS, } from "./driver.js";
43
44
  export { defaultResourceKey, resourceCall, NOT_COUNTED, optionKeyPath, } from "./resource-definition.js";
@@ -106,7 +106,7 @@ type OptionValues<Rules> = {
106
106
  export type WrittenOptions<Rules> = Pick<OptionInputs<Rules>, RequiredOption<Rules>> & Partial<Pick<OptionInputs<Rules>, Exclude<keyof Rules, RequiredOption<Rules>>>>;
107
107
  /**
108
108
  * A resource's options: the plain values, shaped as in the config file, once defaults, the file and the flags are
109
- * merged. Its lifecycle, a runner recipe and the run payload all see these. An option with neither a default nor
109
+ * merged. Its lifecycle, the Vercel Sandbox runner options and the run payload all see these. An option with neither a default nor
110
110
  * `required` may be absent.
111
111
  */
112
112
  export type ResolvedOptions<Rules> = Pick<OptionValues<Rules>, PresentOption<Rules>> & Partial<Pick<OptionValues<Rules>, Exclude<keyof Rules, PresentOption<Rules>>>>;
@@ -195,8 +195,9 @@ export type PayloadOf<D extends ResourceDefinition> = D["payload"] extends Paylo
195
195
  export type SourcesOf<D extends ResourceDefinition> = OptionSources<D["options"]>;
196
196
  /**
197
197
  * The key of definition `definition`'s default resource under `resources`: its name. A run's own flags for the
198
- * definition's options set this resource, and a read that names no key, such as a runner recipe's `run.get(<name>)`,
199
- * reads it. For now a config file may hold only default resources (`defineConfig` and `loadConfig` check each key).
198
+ * definition's options set this resource, and a read that names no key, such as a command's
199
+ * `readRunPayload().get(contract)`, reads it. For now a config file may hold only default resources (`defineConfig`
200
+ * and `loadConfig` check each key).
200
201
  */
201
202
  export declare function defaultResourceKey(definition: {
202
203
  readonly name: string;
@@ -13,8 +13,9 @@ export const NOT_COUNTED = Object.freeze({
13
13
  });
14
14
  /**
15
15
  * The key of definition `definition`'s default resource under `resources`: its name. A run's own flags for the
16
- * definition's options set this resource, and a read that names no key, such as a runner recipe's `run.get(<name>)`,
17
- * reads it. For now a config file may hold only default resources (`defineConfig` and `loadConfig` check each key).
16
+ * definition's options set this resource, and a read that names no key, such as a command's
17
+ * `readRunPayload().get(contract)`, reads it. For now a config file may hold only default resources (`defineConfig`
18
+ * and `loadConfig` check each key).
18
19
  */
19
20
  export function defaultResourceKey(definition) {
20
21
  return definition.name;
@@ -1,9 +1,8 @@
1
1
  // A resource factory (`GLOSSARY.md`, **Resource factory**): what a config file calls to make a resource
2
2
  // (`<name>({ … })`). Each extension folder's `resource.ts`, its published export, makes its factory from its definition
3
- // with `resourceFactory`. The factory holds its definition, which a runner recipe reads a resource by
4
- // (`run.get(<name>)`, `config/recipe-run.ts`). A list of definitions holds definitions, not factories: a
5
- // factory's call signature checks its options contravariantly, so a definition with a required option wouldn't fit a
6
- // list of factories. It names no resource.
3
+ // with `resourceFactory`. The factory holds its definition (`definition`). A list of definitions holds definitions, not
4
+ // factories: a factory's call signature checks its options contravariantly, so a definition with a required option
5
+ // wouldn't fit a list of factories. It names no resource.
7
6
  /** The resource factory of `definition`: what a config file calls to make a resource of it. */
8
7
  export function resourceFactory(definition) {
9
8
  const make = (given = {}) => ({
@@ -1,7 +1,7 @@
1
1
  import { z } from "zod";
2
2
  /** An environment variable name: ASCII letters, digits, and underscores, not starting with a digit. */
3
3
  export declare const ENV_VAR_NAME_PATTERN: RegExp;
4
- /** The human-readable rule for an environment variable name, shared by Zod and recipe checks. */
4
+ /** The human-readable rule for an environment variable name, shared by Zod and the runner options' checks. */
5
5
  export declare const ENV_VAR_NAME_RULE = "an environment variable name, letters, digits, and underscores, not starting with a digit";
6
6
  /**
7
7
  * The fewest characters a secret value may have. The run replaces each value wherever it appears in what it prints and
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  import { mustBe } from "./rules.js";
6
6
  /** An environment variable name: ASCII letters, digits, and underscores, not starting with a digit. */
7
7
  export const ENV_VAR_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
8
- /** The human-readable rule for an environment variable name, shared by Zod and recipe checks. */
8
+ /** The human-readable rule for an environment variable name, shared by Zod and the runner options' checks. */
9
9
  export const ENV_VAR_NAME_RULE = "an environment variable name, letters, digits, and underscores, not starting with a digit";
10
10
  /**
11
11
  * The fewest characters a secret value may have. The run replaces each value wherever it appears in what it prints and
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ import type { VercelOidcTokenFailure } from "./credential-source.ts";
3
+ /** The facts of a failed `VERCEL_OIDC_TOKEN` read that `vercel_oidc_token_failed` carries. */
4
+ export declare const vercelOidcTokenFailureShape: {
5
+ /** Why reading `VERCEL_OIDC_TOKEN` failed: unset/empty, or not a valid Vercel project OIDC token. */
6
+ cause: z.ZodEnum<{
7
+ "invalid-token": "invalid-token";
8
+ "missing-token": "missing-token";
9
+ }>;
10
+ /** The cause, for a person. */
11
+ detail: z.ZodString;
12
+ /** The one fix. */
13
+ fix: z.ZodString;
14
+ };
15
+ /** A failed `VERCEL_OIDC_TOKEN` read as `vercel_oidc_token_failed` reports it. */
16
+ export declare function vercelOidcTokenFailureFacts(failure: VercelOidcTokenFailure): {
17
+ cause: "invalid-token" | "missing-token";
18
+ detail: string;
19
+ fix: string;
20
+ };
@@ -0,0 +1,20 @@
1
+ // A failed `VERCEL_OIDC_TOKEN` read as an error reports it: its facts (`vercelOidcTokenFailureShape`,
2
+ // `vercelOidcTokenFailureFacts`), which the credential launcher resolver's `vercel_oidc_token_failed` carries
3
+ // (`config/credential-resolver.ts`), a run's `vercel_oidc_token_failed` carries, and a resource's own errors reuse
4
+ // with theirs beside them. It loads no Clinkr.
5
+ import { z } from "zod";
6
+ import { describeVercelOidcTokenFailure } from "./credential-diagnosis.js";
7
+ /** The facts of a failed `VERCEL_OIDC_TOKEN` read that `vercel_oidc_token_failed` carries. */
8
+ export const vercelOidcTokenFailureShape = {
9
+ /** Why reading `VERCEL_OIDC_TOKEN` failed: unset/empty, or not a valid Vercel project OIDC token. */
10
+ cause: z.enum(["missing-token", "invalid-token"]),
11
+ /** The cause, for a person. */
12
+ detail: z.string(),
13
+ /** The one fix. */
14
+ fix: z.string(),
15
+ };
16
+ /** A failed `VERCEL_OIDC_TOKEN` read as `vercel_oidc_token_failed` reports it. */
17
+ export function vercelOidcTokenFailureFacts(failure) {
18
+ const { cause: detail, fix } = describeVercelOidcTokenFailure(failure);
19
+ return { cause: failure.kind, detail, fix };
20
+ }
@@ -1,7 +1,7 @@
1
1
  /**
2
- * A resource read by its resource factory or its payload contract: `present: true` with `value`, what the reader gets
3
- * of it, when the run has the resource; `present: false` when the run doesn't, such as a run whose config file and
4
- * flags give it nothing, or whose `beforeRun` skipped it.
2
+ * A resource read by its payload contract: `present: true` with `value`, what the reader gets of it, when the run has
3
+ * the resource; `present: false` when the run doesn't, such as a run whose config file and flags give it nothing, or
4
+ * whose `beforeRun` skipped it.
5
5
  */
6
6
  export type Present<T> = {
7
7
  readonly present: true;
@@ -1,4 +1,2 @@
1
- // Whether a run has a resource, and what of it the reader gets when it does. A runner recipe's `vcpus` function
2
- // reads a resource's options by its resource factory, `run.get(<name>)`, which returns one; it lives in the SDK, which
3
- // imports nothing outside `src/sdk/`, so the run payload's reads can return it too.
1
+ // Whether a run has a resource, and what of it the reader gets when it does. A command's run payload reads return one.
4
2
  export {};
@@ -24,7 +24,7 @@ declare const notDeletedSchema: z.ZodObject<{
24
24
  declare const keptSchema: z.ZodObject<{
25
25
  name: z.ZodString;
26
26
  stopsAt: z.ZodString;
27
- url: z.ZodString;
27
+ url: z.ZodNullable<z.ZodString>;
28
28
  }, z.core.$strip>;
29
29
  /** The runner sandbox the run couldn't keep running, so it stopped and deleted it. */
30
30
  declare const notKeptSchema: z.ZodObject<{
@@ -40,7 +40,7 @@ export declare const runnerCleanupSchema: z.ZodObject<{
40
40
  kept: z.ZodNullable<z.ZodObject<{
41
41
  name: z.ZodString;
42
42
  stopsAt: z.ZodString;
43
- url: z.ZodString;
43
+ url: z.ZodNullable<z.ZodString>;
44
44
  }, z.core.$strip>>;
45
45
  notKept: z.ZodNullable<z.ZodObject<{
46
46
  name: z.ZodString;
@@ -77,7 +77,7 @@ export declare function notKeptText(sandbox: z.infer<typeof notKeptSchema>): str
77
77
  * Rows for the runner sandbox the run kept running, or couldn't keep, and the runner's sandboxes that couldn't be
78
78
  * stopped or deleted, when there are any.
79
79
  */
80
- export declare function runnerCleanupRows(cleanup: RunnerCleanup | null): (readonly ["Runner sandbox kept", readonly [`${string}, running until ${string}, with no network access`, string]] | readonly ["Runner sandbox not kept", string] | readonly ["Sandboxes not deleted", string[]] | readonly ["Sandboxes not stopped", string[]])[];
80
+ export declare function runnerCleanupRows(cleanup: RunnerCleanup | null): (readonly ["Runner sandbox kept", readonly [`${string}, running until ${string}, with no network access`, ...string[]]] | readonly ["Runner sandbox not kept", string] | readonly ["Sandboxes not deleted", string[]] | readonly ["Sandboxes not stopped", string[]])[];
81
81
  /** Warnings for the runner sandbox the run couldn't keep running, and the sandboxes that couldn't be stopped or deleted. */
82
82
  export declare function runnerCleanupWarnings(cleanup: RunnerCleanup | null): {
83
83
  reason: string;
@@ -29,8 +29,8 @@ const keptSchema = z.object({
29
29
  name: z.string(),
30
30
  /** When its timeout stops it, as an ISO time: the keep time from when the run ended, or later. */
31
31
  stopsAt: z.string(),
32
- /** Its Connect page in the Vercel dashboard, which says how to open a shell in it. */
33
- url: z.string(),
32
+ /** Its Connect page in the Vercel dashboard, which says how to open a shell in it; null when team or project slug is unknown. */
33
+ url: z.string().nullable(),
34
34
  });
35
35
  /** The runner sandbox the run couldn't keep running, so it stopped and deleted it. */
36
36
  const notKeptSchema = z.object({ name: z.string(), message: z.string() });
@@ -58,7 +58,8 @@ export function notDeletedText(sandbox) {
58
58
  }
59
59
  /** The runner sandbox a run kept running, as a sentence. */
60
60
  export function keptText(kept) {
61
- return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, with no network access, so you can connect to it: ${kept.url}`;
61
+ const suffix = kept.url === null ? "" : `: ${kept.url}`;
62
+ return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, with no network access, so you can connect to it${suffix}`;
62
63
  }
63
64
  /** The runner sandbox a run couldn't keep running, as a sentence. */
64
65
  export function notKeptText(sandbox) {
@@ -78,7 +79,10 @@ export function runnerCleanupRows(cleanup) {
78
79
  : [
79
80
  [
80
81
  "Runner sandbox kept",
81
- [`${kept.name}, running until ${isoSecondsText(kept.stopsAt)}, with no network access`, kept.url],
82
+ [
83
+ `${kept.name}, running until ${isoSecondsText(kept.stopsAt)}, with no network access`,
84
+ ...(kept.url === null ? [] : [kept.url]),
85
+ ],
82
86
  ],
83
87
  ]),
84
88
  ...(notKept === null ? [] : [["Runner sandbox not kept", notKeptText(notKept)]]),
@@ -133,7 +137,13 @@ function runnerCleanupOf(report) {
133
137
  return null;
134
138
  const { kept, target } = report;
135
139
  return {
136
- kept: kept === null ? null : { name: kept.name, stopsAt: kept.stopsAt, url: sandboxConnectPage(target, kept.name) },
140
+ kept: kept === null
141
+ ? null
142
+ : {
143
+ name: kept.name,
144
+ stopsAt: kept.stopsAt,
145
+ url: target === null ? null : sandboxConnectPage(target, kept.name),
146
+ },
137
147
  notKept: report.notKept === null ? null : { ...report.notKept },
138
148
  notStopped: report.notStopped.map(({ name, role, timeoutMinutes, message }) => ({
139
149
  name,
@@ -1,4 +1,4 @@
1
- import type { RejectedSnapshot, SnapshotCacheNote, SnapshotRejectionReason } from "../runner/index.ts";
1
+ import type { RejectedSnapshot, SnapshotIndexNote, SnapshotRejectionReason } from "../runner/index.ts";
2
2
  /** How many of the snapshots a run doesn't start from its build line lists, before it counts the rest. */
3
3
  export declare const REJECTIONS_SHOWN = 5;
4
4
  /** `count` commits, as text: `1 commit`, `24 commits`. */
@@ -18,14 +18,14 @@ export declare function rejectionText(reason: SnapshotRejectionReason, snapshot:
18
18
  readonly base: string;
19
19
  }): string;
20
20
  /**
21
- * The lines under a run's build line: why each cached snapshot of the recipe doesn't fit, `REJECTIONS_SHOWN` of them
21
+ * The lines under a run's build line: why each cached snapshot of the runner doesn't fit, `REJECTIONS_SHOWN` of them
22
22
  * at most, then how many more `storm snapshots list` shows.
23
23
  */
24
24
  export declare function rejectionLines(rejected: readonly RejectedSnapshot[]): string[];
25
25
  /** Every reason a run doesn't start from a cached snapshot, for a schema. */
26
26
  export declare const REJECTION_REASONS: readonly ["expired", "expires-soon", "other-base", "steps-changed", "other-owner"];
27
27
  /**
28
- * What removing expired entries from the runner snapshot cache noticed, as a run's and `storm snapshots build`'s
28
+ * What removing expired entries from the local snapshot index noticed, as a run's and `storm snapshots build`'s
29
29
  * progress line.
30
30
  */
31
- export declare function snapshotCacheNoteText(note: SnapshotCacheNote): string;
31
+ export declare function snapshotIndexNoteText(note: SnapshotIndexNote): string;
@@ -1,6 +1,6 @@
1
- // What a run, `storm runs show` and `storm snapshots list` say about a runner snapshot: where it was built, in
2
- // commits a person knows, why a run doesn't start from one, and what the cache read noticed. Each text says only what
3
- // storm checked.
1
+ // What a run, `storm runs show`, and `storm snapshots list` say about a runner snapshot: where it was built, in
2
+ // commits a person knows, why a run doesn't start from one, and what reading the local snapshot index noticed. Each
3
+ // text says only what storm checked.
4
4
  import { short } from "./text.js";
5
5
  /** How many of the snapshots a run doesn't start from its build line lists, before it counts the rest. */
6
6
  export const REJECTIONS_SHOWN = 5;
@@ -31,15 +31,15 @@ export function rejectionText(reason, snapshot) {
31
31
  case "expires-soon":
32
32
  return "expires within the hour";
33
33
  case "other-base":
34
- return `its base ${short(snapshot.base)} is not the merge-base`;
34
+ return `its base ${short(snapshot.base)} is neither the merge-base nor an ancestor of it`;
35
35
  case "steps-changed":
36
- return "the recipe's snapshot steps changed since it was built";
36
+ return "the runner's snapshot steps changed since it was built";
37
37
  case "other-owner":
38
38
  return "built for another team or project";
39
39
  }
40
40
  }
41
41
  /**
42
- * The lines under a run's build line: why each cached snapshot of the recipe doesn't fit, `REJECTIONS_SHOWN` of them
42
+ * The lines under a run's build line: why each cached snapshot of the runner doesn't fit, `REJECTIONS_SHOWN` of them
43
43
  * at most, then how many more `storm snapshots list` shows.
44
44
  */
45
45
  export function rejectionLines(rejected) {
@@ -59,14 +59,14 @@ export const REJECTION_REASONS = [
59
59
  "other-owner",
60
60
  ];
61
61
  /**
62
- * What removing expired entries from the runner snapshot cache noticed, as a run's and `storm snapshots build`'s
62
+ * What removing expired entries from the local snapshot index noticed, as a run's and `storm snapshots build`'s
63
63
  * progress line.
64
64
  */
65
- export function snapshotCacheNoteText(note) {
65
+ export function snapshotIndexNoteText(note) {
66
66
  switch (note.kind) {
67
- case "cache-unreadable":
68
- return `couldn't read the runner snapshot cache at ${note.failure.path}: ${note.failure.message}; treating it as empty`;
67
+ case "local-index-unreadable":
68
+ return `couldn't read the local snapshot index at ${note.failure.path}: ${note.failure.message}; treating it as empty`;
69
69
  case "expired-entry-not-removed":
70
- return `couldn't remove the expired cache entry for runner snapshot ${note.entry.snapshotId} at ${note.failure.path}: ${note.failure.message}`;
70
+ return `couldn't remove the expired local snapshot index entry for runner snapshot ${note.entry.snapshotId} at ${note.failure.path}: ${note.failure.message}`;
71
71
  }
72
72
  }
@@ -1,4 +1,4 @@
1
- // Durations as the runner's settings write them: a runner recipe's `timeout` and `keepSandbox` (and
1
+ // Durations as the runner's settings write them: a Vercel Sandbox runner's `timeout` and `keepSandbox` (and
2
2
  // `--keep-sandbox`). A resource parses its own options' durations itself.
3
3
  /** The shortest TTL storm gives a Vercel Sandbox: 10 minutes. */
4
4
  export const MIN_TTL_MINUTES = 10;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cnc-tools/storm",
3
- "version": "0.15.0",
3
+ "version": "0.17.0",
4
4
  "description": "A test orchestrator: run your tests in the inner loop of development, in the cloud, in a test environment that you define",
5
5
  "repository": {
6
6
  "type": "git",
@@ -159,11 +159,12 @@
159
159
  },
160
160
  "scripts": {
161
161
  "build": "tsc -p tsconfig.build.json && node scripts/embed-testserver-sdk.js && node scripts/bundle.js && node scripts/write-build-info.js",
162
+ "build:bun-entry": "node scripts/build-bun-entry.js",
162
163
  "typecheck": "tsc --noEmit && tsc -p tsconfig.sdk.json",
163
164
  "test": "pnpm run test:default && pnpm run test:integration",
164
165
  "test:default": "vitest run --project default --project sanity",
165
166
  "test:integration": "vitest run --project integration --passWithNoTests",
166
- "test:testserver": "node bin/storm.js test --suite testserver",
167
+ "test:testserver": "node bin/storm.js test --suite testserver --scope vercel --project vercel",
167
168
  "live:allowed-domains": "node scripts/live/allowed-domains-check.ts",
168
169
  "live:credential": "node scripts/live/credential-check.ts",
169
170
  "live:network-policy": "node scripts/live/network-policy-check.ts",
@@ -7,21 +7,23 @@ description: Start here. What a run, a run id, a run directory, test output, and
7
7
 
8
8
  `storm test` runs the project's tests declared in `storm.config.ts`, or a named suite with `--suite <name>`, in a runner sandbox or on this machine. When `storm.config.ts` sets `testPlan: true` or the command takes `--count-tests`, it first counts the test files (or each test) on this machine, and a resource can size itself from that count. `storm exec` runs any other command, such as `pnpm test`, in the same way, without counting tests. After the run, the `runs` commands read the run back on this machine.
9
9
 
10
+ storm finds `storm.config.ts` in the working directory or the nearest parent up to the git worktree's root. It also takes `storm.config.mts`, which Node always loads as an ES module: use it in a package whose `package.json` has no `"type": "module"`, where Node warns `MODULE_TYPELESS_PACKAGE_JSON` for a `storm.config.ts`. One directory may hold only one of the two, else every command that reads the file refuses with `invalid_config`. This text names the file `storm.config.ts`.
11
+
10
12
  ## Concepts
11
13
 
12
14
  - A **run** is one `storm test` or one `storm exec`. It runs one command: the driver's program with arguments from the command line and `storm.config.ts` for `storm test`, or the command after `--` for `storm exec`.
13
15
  - The **project's tests** are the tests and test environment declared at the top level of `storm.config.ts` (`driver`, `args`, `runner`, and `resources`). `storm test` runs them when no `--suite` is given.
14
16
  - A **suite** is a named variation of the project's tests declared under `suites` in `storm.config.ts`. A suite inherits every top-level setting it does not set, the runner included. Select it with `storm test --suite <name>`, or inspect all suites with `storm suites list`.
15
- - A **runner** is where the command runs, declared under `runner` in `storm.config.ts` with one of two peer factories from `@vercel/storm/config`: `vercelSandbox({ … })` (the **Vercel Sandbox runner**, which readies a **runner sandbox** from the runner recipe and runs the command in it) or `launchMachine()` (the **launch machine runner**, which runs the command on this machine with no isolation). There is no built-in default runner: a run whose effective config declares no `runner` is refused with `missing_runner`. `storm test` has no runner flag; `storm exec` takes `--runner launch-machine` to run on the launch machine without a config file or ignoring the top-level runner.
17
+ - A **runner** is where the command runs, declared under `runner` in `storm.config.ts` with one of two peer factories from `@vercel/storm/config`: `vercelSandbox({ … })` (the **Vercel Sandbox runner**, which readies a **runner sandbox** and runs the command in it) or `launchMachine()` (the **launch machine runner**, which runs the command on this machine with no isolation). There is no built-in default runner: a run whose effective config declares no `runner` is refused with `missing_runner`. `storm test` has no runner flag; `storm exec` takes `--runner launch-machine` to run on the launch machine without a config file or ignoring the top-level runner.
16
18
  - A **resource** is a thing that a run gets for its command, such as a set of test servers. Declare it under `resources` in `storm.config.ts`, under its resource key, or give one of its flags. The run acquires the resource before the command starts, gives the command what it needs of it in the run payload, and releases it after the command stops. Each resource adds its flags to the help of `storm test` and `storm exec`. Its own commands are under `storm ext`.
17
19
  - A **run id** is the name of a run, such as `20261103T192655-8277`. It is the start time of the run in UTC and a short suffix. `storm test` and `storm exec` print it at the end, in the `logs` line. With `--json`, the result gives it as `runId`.
18
20
  - A **run directory** is the directory where a run writes what it did, on the machine that started the run. This is true for every run, whether on the launch machine or in a runner sandbox. Its name is the run id. Do not read its files directly. Use the `runs` commands.
19
21
  - A run is **active** while it goes on. A run is **finished** when it has ended and saved its test results. `runs show` shows test results only for a finished run.
20
22
  - A **test result** is the final result of one test: `pass`, `fail`, or `skip`, with its errors. The command saves test results only with a storm reporter in the config of its test runner: `stormReporter` for vitest, `@vercel/storm/playwright/reporter` for Playwright. When the command of a `storm test` run exits 0 but reports no test result, the run warns `no_final_test_results`. The exit code does not change. Do the steps in its `next`: they name the config file and the code to add. Then run the same command again.
21
23
  - **Test output** is what one test printed to the console, stdout and stderr together. storm keeps the last 8 MiB of the test output of each test. `droppedChars` counts the characters that storm did not keep.
22
- - A **sandbox credential** is a secret that the `credentials` key of the runner recipe declares, such as a token for a private npm registry: `credentials: [{ domain: "registry.npmjs.org", source: { kind: "env", name: "NPM_AUTH" } }]`. `source` is a `SecretSource` plain object (`{ kind: "env", name }`) naming a variable in your environment that holds the whole header value, such as `Bearer …`. `header` is the name of the header, `authorization` by default. `requests` is `read`, the default, for `GET` and `HEAD` only, or `all`. A run in a runner sandbox reads the variable on the machine that starts the run. The run does not start, with `credentials_invalid`, when the variable is not set, is empty, holds a line break, or has fewer than 8 characters. The value never goes into a sandbox: the firewall of the sandbox adds the header to the requests to the domain. Vercel calls this "credentials brokering". The credentials are in place for the toolchain and prebuild steps of a snapshot build, and from before the install step of a run until the command has ended. The upload and the apply step do not get them. A resource can give credentials too, for the command only. With `read`, the firewall refuses every other request to the domain. Code that runs while a credential is in place, the command included, can send requests with the header to the domain, but it cannot read the value. Each install must find the registry configuration that names the domain: `npm --prefix <dir>` reads the `.npmrc` of that directory, not the project's. storm shows the value as `<token>` in all that it prints and writes, and does not write it to a file or a snapshot. A sandbox credential is not the credential that `--credential` picks, the Vercel OIDC token that storm uses for its own calls: the word has both uses until a rename.
23
- - An **unsafe secret environment variable** is a secret declared in the `unsafeSecretEnvVars` key of the runner recipe as `{ name, source: { kind: "env", name } }`, for a secret that cannot travel as an HTTPS header. A run in a runner sandbox reads `source` on the machine that starts the run and passes `name` into the command's environment alone, never into a step or a snapshot, and forbids keeping the runner sandbox. The run does not start, with `unsafe_secret_env_vars_invalid`, when the source variable is not set, is empty, holds a line break, or has fewer than 8 characters.
24
- - An **allowed domain** is a domain that the `allowedDomains` key of the runner recipe lists, such as `example.com` or `*.example.com`. With the list, the sandboxes of a run in a runner sandbox, every step and the command, reach only the allowed domains, and the domain of each sandbox credential while it is in place. A host outside them does not resolve: `curl` exits 6. A host that a resource gives the command must be in the list too. Without the list, every host is reachable.
24
+ - A **sandbox credential** is a secret that `credentials` in `vercelSandbox({ … })` declares, such as a token for a private npm registry: `credentials: [{ domain: "registry.npmjs.org", source: { kind: "env", name: "NPM_AUTH" } }]`. `source` is a `SecretSource` plain object (`{ kind: "env", name }`) naming a variable in your environment that holds the whole header value, such as `Bearer …`. `header` is the name of the header, `authorization` by default. `requests` is `read`, the default, for `GET` and `HEAD` only, or `all`. A run in a runner sandbox reads the variable on the machine that starts the run. The run does not start, with `credentials_invalid`, when the variable is not set, is empty, holds a line break, or has fewer than 8 characters. The value never goes into a sandbox: the firewall of the sandbox adds the header to the requests to the domain. Vercel calls this "credentials brokering". The credentials are in place for the toolchain and prebuild steps of a snapshot build, and from before the install step of a run until the command has ended. The upload and the apply step do not get them. A resource can give credentials too, for the command only. With `read`, the firewall refuses every other request to the domain. Code that runs while a credential is in place, the command included, can send requests with the header to the domain, but it cannot read the value. Each install must find the registry configuration that names the domain: `npm --prefix <dir>` reads the `.npmrc` of that directory, not the project's. storm shows the value as `<token>` in all that it prints and writes, and does not write it to a file or a snapshot. A sandbox credential is not the credential that `--credential` picks, the Vercel OIDC token that storm uses for its own calls: the word has both uses until a rename.
25
+ - An **unsafe secret environment variable** is a secret declared in `unsafeSecretEnvVars` in `vercelSandbox({ … })` as `{ name, source: { kind: "env", name } }`, for a secret that cannot travel as an HTTPS header. A run in a runner sandbox reads `source` on the machine that starts the run and passes `name` into the command's environment alone, never into a step or a snapshot, and forbids keeping the runner sandbox. The run does not start, with `unsafe_secret_env_vars_invalid`, when the source variable is not set, is empty, holds a line break, or has fewer than 8 characters.
26
+ - An **allowed domain** is a domain that `allowedDomains` in `vercelSandbox({ … })` lists, such as `example.com` or `*.example.com`. With the list, the sandboxes of a run in a runner sandbox, every step and the command, reach only the allowed domains, and the domain of each sandbox credential while it is in place. A host outside them does not resolve: `curl` exits 6. A host that a resource gives the command must be in the list too. Without the list, every host is reachable.
25
27
  - A **run log** is a log in the run directory. The **command log** (`command`) holds all the output of the command. It also holds output that no test owns: output from a `beforeAll`, a global setup, a raw `process.stdout.write`, or a child process. A **step log** (`install`, `build`, `apply`, `snapshot`) holds the output of one step of a run in a runner sandbox.
26
28
 
27
29
  ## Commands
@@ -20,11 +20,11 @@ The parts are:
20
20
  2. storm loads `storm.config.ts`, does the local checks, and lists the test files on this machine. It mints nothing, acquires no resource, starts no sandbox, and opens no run directory. It does not need a credential. It exits 0.
21
21
  3. Read the result. Its `outcome` is `planned`. Read these fields:
22
22
  - `testFiles`: the test files of the run, as paths relative to the project. Use these paths in your lists. It is `null` when the run lists no test files: a `storm exec` run, or a run that is not across runner sandboxes and counts nothing. Add `--sandboxes 1` to list them.
23
- - `runnerSandboxes`: `sandboxes` in the run's `vercelSandbox({ … })` runner (`runner.sandboxes`), the suite's laid over the top level's. `max` is the most runner sandboxes a run can have. `default` is the number of runner sandboxes of a `storm test` run with no `--sandboxes` and no `--file-lists`: a number, `"function"` when `storm.config.ts` gives a function of the test plan, or `null` when it gives no default. `runnerSandboxes` is `null` when the runner has no `sandboxes`, or is `launchMachine()`. Then no run can be a run across runner sandboxes.
23
+ - `runnerSandboxes`: `sandboxes` in the run's `vercelSandbox({ … })` runner (`runner.sandboxes`), the suite's laid over the top level's. `max` is the most runner sandboxes a run can have. `default` is the number of runner sandboxes of a `storm test` run with no `--sandboxes` and no `--file-lists`: a number, a `{ filesPerSandbox, max? }` rule object when `storm.config.ts` declares one, or `null` when it gives no default. `runnerSandboxes` is `null` when the runner has no `sandboxes`, or is `launchMachine()`. Then no run can be a run across runner sandboxes.
24
24
  - `plan.sandboxes`: the number of runner sandboxes (`count`), where it came from (`from`: `flag` for `--sandboxes`, `file-lists` for `--file-lists`, `default` for `runner.sandboxes.default`), and its max (`max`). For `default`, `default` is the number that the default gave for this run. When that number is more than `max`, the run has `max` runner sandboxes. `requested` is the number asked for when the run has fewer test files than that. `leftOut` is the number of test files that your lists leave out.
25
25
  - `sandboxes`: one item for each runner sandbox, with `sandbox` (the runner sandbox index, from 0), `argv` (the command of the runner sandbox, unchanged across runner sandboxes for `storm test`), and `files` (its file list, delivered in `STORM_RUN.sandbox.files`, or `null` for `storm exec`).
26
26
  - `options`: each option of each resource, with its `value` and where the value came from (`from`: `flag`, `file`, or `default`). With `--sandboxes` or `--file-lists`, a default is the total for the whole run with that number of runner sandboxes, and each runner sandbox gets its own part of the resource.
27
- - `vcpus`: the vCPUs of each runner sandbox, as the recipe gives them for that number of runner sandboxes. It is `null` for a run on the launch machine runner.
27
+ - `vcpus`: the vCPUs of each runner sandbox, as the runner configures them for that number of runner sandboxes. It is `null` for a run on the launch machine runner.
28
28
  4. A refusal that a run gets before it mints, `--plan-only` gets too. Read `reason` in the error document, as for a run.
29
29
 
30
30
  ## 2. Give your own file lists
@@ -47,21 +47,21 @@ With the Vercel Sandbox runner, storm installs and builds before it runs the com
47
47
 
48
48
  ## 6. Read why the setup was fast or slow
49
49
 
50
- With the Vercel Sandbox runner, the runner sandbox starts from a runner snapshot: a base snapshot at the merge-base, or one at a commit on the branch that `storm snapshots build --base` built. The snapshot decides how much the run uploads, installs, and builds.
50
+ With the Vercel Sandbox runner, the runner sandbox starts from a runner snapshot at the run's merge-base or an ancestor of its merge-base, reused from the local snapshot index or the Vercel project's shared snapshot index, or built at the merge-base when none fits. The snapshot decides how much the run uploads, installs, and builds.
51
51
 
52
52
  1. Run `storm runs show <run-id> --json`. Read `where.snapshot`.
53
53
  2. Read `base`: the commit the snapshot was built at.
54
- 3. Read `builtBehind`: how many commits HEAD has after `base`, the run's merge-base. A large number means more work for the install and build.
54
+ 3. Read `builtBehind`: how many commits HEAD has after `base`. A large number means more work for the install and build.
55
55
  4. Read `where.uploadBytes`: how many bytes of changes the run uploaded on top of the snapshot's base. The run's merge-base is `where.base`.
56
- 5. Read `built`. If it is `true`, the run built a base snapshot first, which takes a few minutes.
57
- 6. To see which snapshot the next run here starts from, and why it does not start from each other one, run `storm snapshots list --json`. Read `snapshots`: the one with `picked` `true` is the snapshot, and `reason` says why each other one is not. When none has `picked` `true`, a run here builds a base snapshot at the merge-base. A snapshot with `reason` `other-base` has a base that is not the merge-base, so no run here starts from it: a run starts only from a snapshot at its merge-base.
58
- 7. To build a base snapshot before the next run, without a test run, run `storm snapshots build --json`. Read `outcome`: `built` or `up_to_date`.
56
+ 5. Read `built` and `source`. If `built` is `true`, the run built a runner snapshot first, which takes a few minutes. If `built` is `false`, `source` says whether the reused snapshot came from `"local"` or `"shared"` (the shared snapshot index).
57
+ 6. To see which snapshot the next run here starts from, and why it does not start from each other one, run `storm snapshots list --json` (add `--shared` to include the project's shared snapshot index). Read `local` (and `shared.entries` with `--shared`): the entry with `picked` `true` is the snapshot, and `reason` says why each other local entry is not. When none has `picked` `true`, a run here builds a runner snapshot at the merge-base. A snapshot with `reason` `other-base` has a base that is neither the merge-base nor an ancestor of it, so no run here starts from it: a run starts only from a snapshot at its merge-base or at a commit behind it on the base ref.
58
+ 7. To build a runner snapshot before the next run, without a test run, run `storm snapshots build --json`. Read `outcome`: `built` or `up_to_date`.
59
59
 
60
60
  A field is `null` when storm does not know it, such as in a run that an older storm recorded.
61
61
 
62
62
  ## 7. Run one test again in the runner sandbox
63
63
 
64
- A run in a runner sandbox keeps its runner sandbox running after it ends only when you ask, with `--keep-sandbox` or the recipe's `keepSandbox` (never when `runner.unsafeSecretEnvVars` is set). Without a request, the run stops and deletes it, also after a failure. A kept runner sandbox holds the checkout, the installed packages, and everything the command wrote, including test output. It holds no secret. Anyone who can update the Vercel project can connect to it. The kept runner sandbox has no network access, whether or not the run took a resource, so a test that needs the network can't run again in it.
64
+ A run in a runner sandbox keeps its runner sandbox running after it ends only when you ask, with `--keep-sandbox` or `keepSandbox` in `vercelSandbox({ … })` (never when `runner.unsafeSecretEnvVars` is set). Without a request, the run stops and deletes it, also after a failure. A kept runner sandbox holds the checkout, the installed packages, and everything the command wrote, including test output. It holds no secret. Anyone who can update the Vercel project can connect to it. The kept runner sandbox has no network access, whether or not the run took a resource, so a test that needs the network can't run again in it.
65
65
 
66
66
  1. Run `storm runs show <run-id> --json`.
67
67
  2. Read `where.keptMinutesLeft`. If it is `null` or 0, the runner sandbox is not running. Start a new run with `storm test` or `storm exec`, and add `--keep-sandbox 30m`. With that flag, the run keeps its runner sandbox for 30 minutes.