@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
@@ -5,5 +5,8 @@
5
5
  *
6
6
  * When a task rejects, no further task starts; once every started task has settled, it rejects with the first
7
7
  * rejection. So nothing it started is still running when it returns or rejects.
8
+ *
9
+ * Its twin is `runLimited` in `src/runner/shared-snapshot-entry.ts`, with the same body: an extension folder imports
10
+ * storm only through the extension API, so the two have no shared home. Change both together.
8
11
  */
9
12
  export declare function runLimited<T>(count: number, limit: number, proceed: () => boolean, task: (index: number) => Promise<T>): Promise<readonly (T | undefined)[]>;
@@ -6,6 +6,9 @@
6
6
  *
7
7
  * When a task rejects, no further task starts; once every started task has settled, it rejects with the first
8
8
  * rejection. So nothing it started is still running when it returns or rejects.
9
+ *
10
+ * Its twin is `runLimited` in `src/runner/shared-snapshot-entry.ts`, with the same body: an extension folder imports
11
+ * storm only through the extension API, so the two have no shared home. Change both together.
9
12
  */
10
13
  export async function runLimited(count, limit, proceed, task) {
11
14
  const results = Array.from({ length: count }, () => undefined);
@@ -1,4 +1,4 @@
1
- import type { CredentialFailure, CredentialOrigin, CredentialSource, MintFailed, TokenRequestFailure } from "../../sdk/extension/index.ts";
1
+ import type { CredentialFailure, CredentialOrigin, CredentialSource, MintFailed, TokenRequestFailure, VercelOidcTokenFailure } from "../../sdk/extension/index.ts";
2
2
  import type { TestserverPoolEvent } from "./events.ts";
3
3
  import { type BuildMatch, type BuildResolution, type PoolStoreFailure, type PrBuildRefusal } from "./pool/index.ts";
4
4
  import { type TestserverPoolOptions } from "./options/index.ts";
@@ -84,6 +84,13 @@ export type TestserverRefusal = {
84
84
  readonly ttlMinutes: number;
85
85
  /** The creates that failed before the token request failed. */
86
86
  readonly failedCreates: readonly FailedCreate[];
87
+ } | {
88
+ readonly kind: "vercel-oidc-token-failed";
89
+ readonly failure: VercelOidcTokenFailure;
90
+ /** The TTL each create asked for, which any Testserver sandbox a failed create left lives. */
91
+ readonly ttlMinutes: number;
92
+ /** The creates that failed before reading `VERCEL_OIDC_TOKEN` failed. */
93
+ readonly failedCreates: readonly FailedCreate[];
87
94
  } | {
88
95
  readonly kind: "credential-rejected";
89
96
  readonly failure: RejectedCreate;
@@ -41,9 +41,14 @@ export function createWith(options, credential) {
41
41
  * failed: the run's own `mint_failed`, or `token-request-failed`, which reports the creates that failed before it.
42
42
  */
43
43
  function credentialFailed(failure, ttlMinutes, failedCreates) {
44
- return failure.source === "mint"
45
- ? { kind: "mint-failed", failed: failure }
46
- : { kind: "token-request-failed", failure: failure.failure, ttlMinutes, failedCreates };
44
+ switch (failure.source) {
45
+ case "mint":
46
+ return { kind: "mint-failed", failed: failure };
47
+ case "github-actions":
48
+ return { kind: "token-request-failed", failure: failure.failure, ttlMinutes, failedCreates };
49
+ case "vercel-oidc":
50
+ return { kind: "vercel-oidc-token-failed", failure: failure.failure, ttlMinutes, failedCreates };
51
+ }
47
52
  }
48
53
  /**
49
54
  * What a canceled run says of the Testserver pool once it provisioned `facts`: what it created, pooled or not, with the
@@ -1,4 +1,4 @@
1
- import { type CredentialOrigin, type Refusal, type TokenRequestFailure } from "../../sdk/extension/index.ts";
1
+ import { type CredentialOrigin, type Refusal, type TokenRequestFailure, type VercelOidcTokenFailure } from "../../sdk/extension/index.ts";
2
2
  import type { CreateFailureFacts, UnpooledFacts } from "./provision.ts";
3
3
  /** Where the pool lives, or would, and what the OS said, or why there is no place for it. */
4
4
  export interface PoolPathFailure {
@@ -26,6 +26,11 @@ export interface TokenRequestFailedData {
26
26
  * before the request did, and says when one may have left a Testserver sandbox.
27
27
  */
28
28
  export declare function tokenRequestFailed(failure: TokenRequestFailure, data: TokenRequestFailedData): Refusal;
29
+ /**
30
+ * With --credential vercel-oidc, reading `VERCEL_OIDC_TOKEN` failed (`failure`), and the run had no usable Testserver
31
+ * sandbox, from the pool or created, so the command didn't run.
32
+ */
33
+ export declare function vercelOidcTokenFailed(failure: VercelOidcTokenFailure, data: TokenRequestFailedData): Refusal;
29
34
  /** `credential_rejected`'s data beside where the credential came from. */
30
35
  export interface CredentialRejectedData {
31
36
  readonly status: number;
@@ -5,7 +5,7 @@
5
5
  // resolved (`prBuildRefusal`, `pr-build-facts.ts`), which storm ends the run with as `resource_refused`, with the
6
6
  // run's cleanup. A failed mint with no Testserver sandbox in hand isn't one of them: it ends the run as the run's own
7
7
  // `mint_failed`.
8
- import { optionKeyPath, tokenRequestFailureFacts, } from "../../sdk/extension/index.js";
8
+ import { optionKeyPath, tokenRequestFailureFacts, vercelOidcTokenFailureFacts, } from "../../sdk/extension/index.js";
9
9
  import { credentialOriginRows, rejectedCredentialFacts, rejectedCredentialText } from "./credential-facts.js";
10
10
  import { describeTtl } from "./options/index.js";
11
11
  import { createFailureText } from "./sandbox/index.js";
@@ -67,6 +67,21 @@ export function tokenRequestFailed(failure, data) {
67
67
  next: [{ type: "text", text: facts.fix }, ...mayExistSteps(mayExist, ttlMinutes)],
68
68
  };
69
69
  }
70
+ /**
71
+ * With --credential vercel-oidc, reading `VERCEL_OIDC_TOKEN` failed (`failure`), and the run had no usable Testserver
72
+ * sandbox, from the pool or created, so the command didn't run.
73
+ */
74
+ export function vercelOidcTokenFailed(failure, data) {
75
+ const facts = vercelOidcTokenFailureFacts(failure);
76
+ const { ttlMinutes, failedCreates, sandboxMayExist: mayExist } = data;
77
+ return {
78
+ refused: "vercel_oidc_token_failed",
79
+ data: { ...facts, ...data },
80
+ message: `Couldn't use VERCEL_OIDC_TOKEN: ${facts.detail}. The pool had no usable Testserver sandbox, so the command didn't run.`,
81
+ rows: failedCreateRows(failedCreates),
82
+ next: [{ type: "text", text: facts.fix }, ...mayExistSteps(mayExist, ttlMinutes)],
83
+ };
84
+ }
70
85
  /**
71
86
  * The Testserver control plane refused the credential, minted or a GitHub Actions OIDC token (a redirect to SSO, a 401
72
87
  * or a 403), so the command didn't run. It lists the other creates that failed and the created Testserver sandboxes
@@ -9,7 +9,7 @@ export type { TestserverPoolOptions } from "./options/index.ts";
9
9
  *
10
10
  * Its presence gives a run the Testserver pool; `testserverPool()` takes every default. `storm test` and
11
11
  * `storm exec` override each option with its own flag, `--testserver-<option>`, and `storm ext testserver pool create`
12
- * reads `build` and `ttl`. A runner recipe's declared `vcpus` rule can scale from its options by resource key
12
+ * reads `build` and `ttl`. A Vercel Sandbox runner's declared `vcpus` rule can scale from its options by resource key
13
13
  * `"testserverPool"`, such as `option: "sandboxes"`.
14
14
  */
15
15
  export declare const testserverPool: import("../../sdk/extension/resource-factory.ts").ResourceFactory<import("../../sdk/extension/resource-definition.ts").ResourceDefinition<"testserverPool", {
@@ -13,7 +13,7 @@ import { testserverPoolDefinition } from "./definition.js";
13
13
  *
14
14
  * Its presence gives a run the Testserver pool; `testserverPool()` takes every default. `storm test` and
15
15
  * `storm exec` override each option with its own flag, `--testserver-<option>`, and `storm ext testserver pool create`
16
- * reads `build` and `ttl`. A runner recipe's declared `vcpus` rule can scale from its options by resource key
16
+ * reads `build` and `ttl`. A Vercel Sandbox runner's declared `vcpus` rule can scale from its options by resource key
17
17
  * `"testserverPool"`, such as `option: "sandboxes"`.
18
18
  */
19
19
  export const testserverPool = resourceFactory(testserverPoolDefinition);
@@ -33,7 +33,7 @@ export interface TestserverPoolResultFacts {
33
33
  /** When the credential source failed with some Testserver sandboxes in hand: how many more weren't created, which source failed, and why. */
34
34
  readonly uncreated: {
35
35
  readonly count: number;
36
- readonly source: "mint" | "github-actions";
36
+ readonly source: "mint" | "github-actions" | "vercel-oidc";
37
37
  readonly cause: string;
38
38
  readonly fix: string;
39
39
  } | null;
@@ -67,10 +67,15 @@ export function testserverPoolResultWarnings(facts) {
67
67
  reason: "mint_failed",
68
68
  message: `Couldn't create ${facts.uncreated.count} more Testserver sandboxes: couldn't mint a credential: ${facts.uncreated.cause}. ${facts.uncreated.fix}`,
69
69
  }
70
- : {
71
- reason: "token_request_failed",
72
- message: `Couldn't create ${facts.uncreated.count} more Testserver sandboxes: couldn't request a GitHub Actions OIDC token: ${facts.uncreated.cause}. ${facts.uncreated.fix}`,
73
- },
70
+ : facts.uncreated.source === "vercel-oidc"
71
+ ? {
72
+ reason: "vercel_oidc_token_failed",
73
+ message: `Couldn't create ${facts.uncreated.count} more Testserver sandboxes: couldn't use VERCEL_OIDC_TOKEN: ${facts.uncreated.cause}. ${facts.uncreated.fix}`,
74
+ }
75
+ : {
76
+ reason: "token_request_failed",
77
+ message: `Couldn't create ${facts.uncreated.count} more Testserver sandboxes: couldn't request a GitHub Actions OIDC token: ${facts.uncreated.cause}. ${facts.uncreated.fix}`,
78
+ },
74
79
  ]),
75
80
  ...(facts.notCreated === 0
76
81
  ? []
@@ -1,20 +1,5 @@
1
- import type { ArgumentIssue } from "@vercel/clinkr";
2
- import type { Driver } from "../sdk/extension/index.ts";
3
1
  import type { PlannedSandboxesRun } from "./run-plan.ts";
4
2
  import { type CallerFileList } from "./file-lists-file.ts";
5
- /** What `driverSandboxesProblems` reads of a driver command's request. */
6
- export interface DriverSandboxesRequest {
7
- readonly sandboxes?: number | undefined;
8
- readonly fileLists?: string | undefined;
9
- readonly args: readonly string[];
10
- }
11
- /**
12
- * What is wrong with a driver command's request for a run across runner sandboxes, as `validate` reports it: a number
13
- * of runner sandboxes that is not a whole number from 1, and any argument problem reported by
14
- * `driver.fileLists.validate`. Returns nothing without `--sandboxes` or `--file-lists`, or for a driver without
15
- * `fileLists`.
16
- */
17
- export declare function driverSandboxesProblems(driver: Driver, request: DriverSandboxesRequest): readonly ArgumentIssue[];
18
3
  /**
19
4
  * The number of runner sandboxes a driver run with storm's file lists asks for, and where it came from: `--sandboxes`
20
5
  * (`flag`), or `runner.sandboxes.default` (`default`), with the number the default gave for the run, which may exceed
@@ -1,27 +1,8 @@
1
1
  // Pure helpers that plan a driver command's run across runner sandboxes (`--sandboxes`, `--file-lists`, and
2
- // `runner.sandboxes.default`). Validates driver arguments through `driver.fileLists.validate`, deals listed test files
3
- // into file lists, and builds `PlannedSandboxesRun` values whose runner sandboxes each run the run's argv unchanged,
4
- // with their file list for `STORM_RUN`. Names no test runner.
2
+ // `runner.sandboxes.default`). Deals listed test files into file lists and builds `PlannedSandboxesRun` values whose
3
+ // runner sandboxes each run the run's argv unchanged, with their file list for `STORM_RUN`. Names no test runner.
5
4
  import { resolveCallerFileLists } from "./file-lists-file.js";
6
5
  import { dealFileLists } from "./file-lists.js";
7
- /**
8
- * What is wrong with a driver command's request for a run across runner sandboxes, as `validate` reports it: a number
9
- * of runner sandboxes that is not a whole number from 1, and any argument problem reported by
10
- * `driver.fileLists.validate`. Returns nothing without `--sandboxes` or `--file-lists`, or for a driver without
11
- * `fileLists`.
12
- */
13
- export function driverSandboxesProblems(driver, request) {
14
- const { sandboxes, fileLists: listsPath, args } = request;
15
- if ((sandboxes === undefined && listsPath === undefined) || driver.fileLists === undefined)
16
- return [];
17
- const checked = driver.fileLists.validate(args);
18
- return [
19
- ...(sandboxes === undefined || (Number.isInteger(sandboxes) && sandboxes >= 1)
20
- ? []
21
- : [{ field: "sandboxes", message: `--sandboxes takes a whole number from 1, not ${sandboxes}.` }]),
22
- ...(checked.ok ? [] : [{ field: "args", message: checked.problem }]),
23
- ];
24
- }
25
6
  /**
26
7
  * Builds the planned runner sandboxes for a driver run that asks for `asked` runner sandboxes within `max`: deals
27
8
  * `testFiles` into round-robin file lists and assigns each list to a runner sandbox running `argv` unchanged. A default
@@ -1,9 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import type { ResolvedResourceRecord } from "../config/index.ts";
3
3
  import type { ResourceLifecycles } from "../core/index.ts";
4
- import { type PlanOption } from "../run-directory/index.ts";
5
- import { type RunTestPlan } from "../sdk/extension/index.ts";
6
- import type { PlannedSandboxesRun, PlannedWhere } from "./run-plan.ts";
4
+ import type { PlannedRunner, RunPlan } from "./run-plan.ts";
7
5
  /** What a `planned` outcome says of the planned run. No field carries the credential. */
8
6
  export declare const plannedSchema: z.ZodObject<{
9
7
  version: z.ZodString;
@@ -62,23 +60,14 @@ export declare const plannedSchema: z.ZodObject<{
62
60
  /** What a `planned` outcome holds. */
63
61
  export type PlannedFacts = z.input<typeof plannedSchema>;
64
62
  /** The secrets a planned run hides as `<token>`: runner secrets and each resource's pure `secrets`. */
65
- export declare function plannedSecrets(lifecycles: ResourceLifecycles, where: PlannedWhere, resources: {
63
+ export declare function plannedSecrets(lifecycles: ResourceLifecycles, runner: PlannedRunner, resources: {
66
64
  readonly [key: string]: ResolvedResourceRecord;
67
65
  }): readonly string[];
68
66
  /** Builds and redacts the `PlannedFacts` for a run, across runner sandboxes or not. */
69
67
  export declare function buildPlannedFacts(input: {
70
68
  readonly version: string;
71
69
  readonly commit: string | null;
72
- readonly configFile: string | null;
73
- readonly argv: readonly string[];
74
- readonly where: PlannedWhere;
75
- readonly testPlan: RunTestPlan;
76
- readonly planOptions: readonly PlanOption[];
77
- readonly testFiles: readonly string[] | undefined;
78
- readonly sandboxes: PlannedSandboxesRun | undefined;
79
- readonly resources: {
80
- readonly [key: string]: ResolvedResourceRecord;
81
- };
70
+ readonly plan: RunPlan;
82
71
  readonly lifecycles: ResourceLifecycles;
83
72
  readonly vcpus: number | null;
84
73
  }): PlannedFacts;
@@ -5,7 +5,7 @@ import { z } from "zod";
5
5
  import { planSchema } from "../run-directory/index.js";
6
6
  import { optionKeyPath } from "../sdk/extension/index.js";
7
7
  import { redactor, redactStrings } from "./redaction.js";
8
- import { recordedPlan } from "./test-plan.js";
8
+ import { plannedTestPlan } from "./test-plan.js";
9
9
  const plannedOptionSchema = z.object({
10
10
  /** The option's key path, `resources.<key>.<option>`. */
11
11
  path: z.string(),
@@ -35,30 +35,21 @@ export const plannedSchema = z.object({
35
35
  vcpus: z.number().nullable(),
36
36
  });
37
37
  /** The secrets a planned run hides as `<token>`: runner secrets and each resource's pure `secrets`. */
38
- export function plannedSecrets(lifecycles, where, resources) {
39
- return [...lifecycles.secrets(resources), ...(where.kind === "runner" ? where.secrets : [])];
38
+ export function plannedSecrets(lifecycles, runner, resources) {
39
+ return [...lifecycles.secrets(resources), ...(runner.kind === "vercel-sandbox" ? runner.secrets : [])];
40
40
  }
41
41
  /** Builds and redacts the `PlannedFacts` for a run, across runner sandboxes or not. */
42
42
  export function buildPlannedFacts(input) {
43
- const { where, sandboxes, resources, lifecycles } = input;
44
- const policy = where.kind === "runner" ? where.recipe.sandboxes : undefined;
45
- const basePlan = recordedPlan(input.testPlan, input.planOptions);
46
- const plan = sandboxes !== undefined
47
- ? {
48
- ...(basePlan ?? { options: [] }),
49
- options: (basePlan?.options ?? []).map((option) => ({ ...option })),
50
- sandboxes: { ...sandboxes.count },
51
- }
52
- : basePlan === undefined
53
- ? null
54
- : { ...basePlan, options: basePlan.options.map((option) => ({ ...option })) };
43
+ const { plan: runPlan, lifecycles } = input;
44
+ const { runner, sandboxes, resources } = runPlan;
45
+ const policy = runner.kind === "vercel-sandbox" ? runner.options.sandboxes : undefined;
55
46
  const facts = {
56
47
  version: input.version,
57
48
  commit: input.commit,
58
- configFile: input.configFile,
59
- argv: [...input.argv],
60
- plan,
61
- testFiles: input.testFiles === undefined ? null : [...input.testFiles],
49
+ configFile: runPlan.configFile,
50
+ argv: [...runPlan.argv],
51
+ plan: plannedTestPlan(runPlan) ?? null,
52
+ testFiles: runPlan.testFiles === undefined ? null : [...runPlan.testFiles],
62
53
  runnerSandboxes: policy === undefined
63
54
  ? null
64
55
  : {
@@ -81,6 +72,6 @@ export function buildPlannedFacts(input) {
81
72
  }))),
82
73
  vcpus: input.vcpus,
83
74
  };
84
- const redact = redactor(plannedSecrets(lifecycles, where, resources));
75
+ const redact = redactor(plannedSecrets(lifecycles, runner, resources));
85
76
  return redactStrings(facts, redact);
86
77
  }
@@ -1,6 +1,6 @@
1
1
  // The run flags that fit only one runner kind: `--show-output`, `--keep-sandbox`, `--sandboxes`, and `--file-lists`
2
2
  // fit the Vercel Sandbox runner, and `--credential github-actions` fits the launch machine runner, since the Vercel
3
- // Sandbox runner needs the mint.
3
+ // Sandbox runner needs a Vercel credential (`mint` or `vercel-oidc`).
4
4
  // `planRun` runs this rule once after the effective runner is settled (`conflicting_options`).
5
5
  /**
6
6
  * Each flag in `flags` that doesn't fit `runner`: `--credential github-actions` for `vercel-sandbox`, and
@@ -35,7 +35,7 @@ export function runKindFlagName(flag) {
35
35
  export function runKindFlagMessage(flag) {
36
36
  switch (flag) {
37
37
  case "credential":
38
- return "The Vercel Sandbox runner needs a minted Vercel credential, so it can't use --credential github-actions.";
38
+ return "The Vercel Sandbox runner needs a Vercel credential (mint or vercel-oidc), so it can't use --credential github-actions.";
39
39
  case "showOutput":
40
40
  return "--show-output prints the Vercel Sandbox runner's step output, and this run uses the launch machine runner.";
41
41
  case "keepSandbox":
@@ -1,24 +1,33 @@
1
- import type { MintTarget } from "../credential/index.ts";
2
- import type { PlannedSandboxCount, RecordedSandboxStart } from "../run-directory/index.ts";
3
- import type { CheckedRecipe, UnsafeSecretEnvVarMap } from "../runner/index.ts";
4
- import type { SandboxCredential } from "../sdk/extension/index.ts";
1
+ import type { ResolvedResourceRecord, ResolvedSettings } from "../config/index.ts";
2
+ import type { CredentialSourceChoice, MintTarget } from "../credential/index.ts";
3
+ import type { PlanOption, PlannedSandboxCount, RecordedSandboxStart } from "../run-directory/index.ts";
4
+ import type { CheckedVercelSandboxOptions, UnsafeSecretEnvVarMap } from "../runner/index.ts";
5
+ import type { RunTestPlan, SandboxCredential } from "../sdk/extension/index.ts";
5
6
  /**
6
- * Where a planned run runs: with `--unsandboxed` on this machine; or by default in a runner sandbox, with the runner
7
- * recipe and the config file it comes from, the team and project the runner sandbox's credential is minted for, whose
8
- * one mint the resources share, the recipe's credentials with their values, and its unsafe secret environment variables.
7
+ * The settled runner of a planned run: on the launch machine (`launch-machine`), or in a Vercel Sandbox
8
+ * (`vercel-sandbox`), with the checked runner options, the config file it comes from, the credential source (`mint` or
9
+ * `vercel-oidc`), the control plane team and project when given, the runner's credentials with their values, and its
10
+ * unsafe secret environment variables.
9
11
  */
10
- export type PlannedWhere = {
11
- readonly kind: "unsandboxed";
12
+ export type PlannedRunner = {
13
+ readonly kind: "launch-machine";
12
14
  } | {
13
- readonly kind: "runner";
15
+ readonly kind: "vercel-sandbox";
14
16
  readonly configFile: string;
15
- readonly recipe: CheckedRecipe;
16
- readonly target: MintTarget;
17
+ readonly options: CheckedVercelSandboxOptions;
18
+ readonly credential: Extract<CredentialSourceChoice, {
19
+ readonly source: "mint" | "vercel-oidc";
20
+ }>;
21
+ readonly target: MintTarget | null;
17
22
  readonly credentials: readonly Required<SandboxCredential>[];
18
23
  readonly unsafeSecretEnvVars: UnsafeSecretEnvVarMap;
19
24
  /** Every secret value the runner declared (credentials and unsafe secret environment variables), for redaction. */
20
25
  readonly secrets: readonly string[];
21
26
  };
27
+ /** A Vercel Sandbox planned runner (`PlannedRunner` narrowed to `"vercel-sandbox"`). */
28
+ export type VercelSandboxPlannedRunner = Extract<PlannedRunner, {
29
+ readonly kind: "vercel-sandbox";
30
+ }>;
22
31
  /**
23
32
  * The planned runner sandboxes of a run across runner sandboxes: their number, with where it came from, and each runner
24
33
  * sandbox's argv and file list.
@@ -27,3 +36,27 @@ export interface PlannedSandboxesRun {
27
36
  readonly count: PlannedSandboxCount;
28
37
  readonly sandboxes: readonly RecordedSandboxStart[];
29
38
  }
39
+ interface RunPlanBase {
40
+ readonly configFile: string | null;
41
+ readonly settings: ResolvedSettings;
42
+ readonly argv: readonly string[];
43
+ readonly testPlan: RunTestPlan;
44
+ readonly testFiles: readonly string[] | undefined;
45
+ readonly resources: {
46
+ readonly [key: string]: ResolvedResourceRecord;
47
+ };
48
+ readonly planOptions: readonly PlanOption[];
49
+ }
50
+ /** A planned single run: on the launch machine or in one Vercel Sandbox. */
51
+ export interface SingleRunPlan extends RunPlanBase {
52
+ readonly runner: PlannedRunner;
53
+ readonly sandboxes: undefined;
54
+ }
55
+ /** A planned run across runner sandboxes: always uses the Vercel Sandbox runner. */
56
+ export interface SandboxesRunPlan extends RunPlanBase {
57
+ readonly runner: VercelSandboxPlannedRunner;
58
+ readonly sandboxes: PlannedSandboxesRun;
59
+ }
60
+ /** A planned run, as `planRun` settles it before any resource `beforeRun` or execution starts. */
61
+ export type RunPlan = SingleRunPlan | SandboxesRunPlan;
62
+ export {};
@@ -1,4 +1,5 @@
1
- // What a run's plan says before anything is minted, acquired or started: where the run runs, and its runner sandboxes
2
- // when it has them. `planRun` (`commands/exec/plan-run.ts`) plans a run over the gateways and answers these; the pure
3
- // planning modules here read them.
1
+ // What a run's plan says before anything is minted, acquired, or started: its peer runner (`PlannedRunner`), its
2
+ // runner sandboxes when it has them (`PlannedSandboxesRun`), and the settled run plan (`RunPlan`, discriminated so a
3
+ // run across runner sandboxes always carries a Vercel Sandbox runner). `planRun` (`commands/exec/plan-run.ts`) plans a
4
+ // run over the gateways and answers these; the pure planning modules here read them.
4
5
  export {};
@@ -27,7 +27,7 @@ export declare function listResolvedSuites(file: SettingsFile, driverByName: (na
27
27
  /** Formats a command argument list as a readable shell-like string for display. */
28
28
  export declare function formatCommandLine(command: readonly string[]): string;
29
29
  /**
30
- * A redaction of each credential and unsafe secret environment variable value that `target`'s effective runner recipe
30
+ * A redaction of each credential and unsafe secret environment variable value that `target`'s effective runner
31
31
  * declares and `env` (the launcher environment) sets, since the config file's `args` can hold one. A launch machine
32
32
  * runner, or none, declares no secret.
33
33
  */
@@ -60,13 +60,13 @@ export function formatCommandLine(command) {
60
60
  return command.map(quoteArg).join(" ");
61
61
  }
62
62
  /**
63
- * A redaction of each credential and unsafe secret environment variable value that `target`'s effective runner recipe
63
+ * A redaction of each credential and unsafe secret environment variable value that `target`'s effective runner
64
64
  * declares and `env` (the launcher environment) sets, since the config file's `args` can hold one. A launch machine
65
65
  * runner, or none, declares no secret.
66
66
  */
67
67
  export function targetRedactor(target, env) {
68
68
  const runner = target.settingsFile.values?.settings.runner;
69
- return redactor(declaredSecretValues(runner?.kind === "vercel-sandbox" ? runner.recipe : undefined, env));
69
+ return redactor(declaredSecretValues(runner?.kind === "vercel-sandbox" ? runner.options : undefined, env));
70
70
  }
71
71
  /**
72
72
  * The pre-run stderr line for `storm test`: `tests: <command>` or `suite <name>: <command>`, plus a count of
@@ -1,7 +1,16 @@
1
1
  import type { PlannedSandboxCount, PlanOption, TestPlanFacts } from "../run-directory/index.ts";
2
2
  import { type RunTestPlan } from "../sdk/extension/index.ts";
3
+ import type { RunPlan, SandboxesRunPlan, SingleRunPlan } from "./run-plan.ts";
3
4
  /** The plan a run records: with a counted test plan, its counts and `options`; none for a run that counted nothing. */
4
5
  export declare function recordedPlan(testPlan: RunTestPlan, options: readonly PlanOption[]): TestPlanFacts | undefined;
6
+ /**
7
+ * The plan facts a planned run records, prints before starting, and reports in `--plan-only`, `ran`, and
8
+ * `sandboxes_ran`: for a run across runner sandboxes, always present with `sandboxes`; for a single run, present only
9
+ * when counted.
10
+ */
11
+ export declare function plannedTestPlan(plan: SandboxesRunPlan): TestPlanFacts;
12
+ export declare function plannedTestPlan(plan: SingleRunPlan): TestPlanFacts | undefined;
13
+ export declare function plannedTestPlan(plan: RunPlan): TestPlanFacts | undefined;
5
14
  /**
6
15
  * The plan as `vitest` and `playwright` say it before the run: `Running 65 tests in 19 files; resources.<key>.<option>
7
16
  * 5 (default)`, each option with where its value came from, or `Running 65 tests in 19 files` without one, and
@@ -14,6 +14,15 @@ export function recordedPlan(testPlan, options) {
14
14
  }
15
15
  : undefined;
16
16
  }
17
+ export function plannedTestPlan(plan) {
18
+ const base = recordedPlan(plan.testPlan, plan.planOptions);
19
+ if (plan.sandboxes === undefined)
20
+ return base;
21
+ return {
22
+ ...(base ?? { options: [] }),
23
+ sandboxes: { ...plan.sandboxes.count },
24
+ };
25
+ }
17
26
  /**
18
27
  * The plan as `vitest` and `playwright` say it before the run: `Running 65 tests in 19 files; resources.<key>.<option>
19
28
  * 5 (default)`, each option with where its value came from, or `Running 65 tests in 19 files` without one, and
@@ -57,7 +57,7 @@ async function openRecording(gateway, start, extra) {
57
57
  export async function recordRun(gateway, start) {
58
58
  const { definitionSet } = start;
59
59
  const { record, directory, opened, wallMs, abandon } = await openRecording(gateway, start, {
60
- where: startedWhere(start.run),
60
+ where: startedWhere(start.run.runner),
61
61
  });
62
62
  const collector = runCollector(definitionSet, directory);
63
63
  return {
@@ -103,7 +103,7 @@ export async function recordRun(gateway, start) {
103
103
  export async function recordAcrossSandboxes(gateway, start) {
104
104
  const { definitionSet, redact } = start;
105
105
  const { startedAt, record, directory, opened, wallMs, abandon } = await openRecording(gateway, start, {
106
- where: startedWhere({ runner: start.runner }),
106
+ where: startedWhere({ kind: "vercel-sandbox", session: start.runner }),
107
107
  sandboxes: start.sandboxes.map((sandbox, index) => pendingSandboxRecord({ sandbox: index, argv: sandbox.argv, files: sandbox.files })),
108
108
  });
109
109
  const run = runCollector(definitionSet, undefined);
@@ -56,6 +56,10 @@ declare const snapshotSchema: z.ZodObject<{
56
56
  base: z.ZodString;
57
57
  built: z.ZodBoolean;
58
58
  builtBehind: z.ZodNullable<z.ZodNumber>;
59
+ source: z.ZodExactOptional<z.ZodNullable<z.ZodEnum<{
60
+ local: "local";
61
+ shared: "shared";
62
+ }>>>;
59
63
  }, z.core.$strip>;
60
64
  /**
61
65
  * The runner snapshot a runner sandbox started from: its id, the base it is of, which the run's changes were uploaded
@@ -68,8 +72,8 @@ declare const whereSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
68
72
  kind: z.ZodLiteral<"launch-machine">;
69
73
  }, z.core.$strip>, z.ZodObject<{
70
74
  kind: z.ZodLiteral<"vercel-sandbox">;
71
- team: z.ZodString;
72
- project: z.ZodString;
75
+ team: z.ZodNullable<z.ZodString>;
76
+ project: z.ZodNullable<z.ZodString>;
73
77
  region: z.ZodString;
74
78
  runtime: z.ZodString;
75
79
  vcpus: z.ZodNumber;
@@ -81,6 +85,10 @@ declare const whereSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
81
85
  base: z.ZodString;
82
86
  built: z.ZodBoolean;
83
87
  builtBehind: z.ZodNullable<z.ZodNumber>;
88
+ source: z.ZodExactOptional<z.ZodNullable<z.ZodEnum<{
89
+ local: "local";
90
+ shared: "shared";
91
+ }>>>;
84
92
  }, z.core.$strip>>;
85
93
  keptUntil: z.ZodNullable<z.ZodString>;
86
94
  uploadBytes: z.ZodNullable<z.ZodNumber>;
@@ -191,8 +199,8 @@ declare const runRecordSchema: z.ZodObject<{
191
199
  kind: z.ZodLiteral<"launch-machine">;
192
200
  }, z.core.$strip>, z.ZodObject<{
193
201
  kind: z.ZodLiteral<"vercel-sandbox">;
194
- team: z.ZodString;
195
- project: z.ZodString;
202
+ team: z.ZodNullable<z.ZodString>;
203
+ project: z.ZodNullable<z.ZodString>;
196
204
  region: z.ZodString;
197
205
  runtime: z.ZodString;
198
206
  vcpus: z.ZodNumber;
@@ -204,6 +212,10 @@ declare const runRecordSchema: z.ZodObject<{
204
212
  base: z.ZodString;
205
213
  built: z.ZodBoolean;
206
214
  builtBehind: z.ZodNullable<z.ZodNumber>;
215
+ source: z.ZodExactOptional<z.ZodNullable<z.ZodEnum<{
216
+ local: "local";
217
+ shared: "shared";
218
+ }>>>;
207
219
  }, z.core.$strip>>;
208
220
  keptUntil: z.ZodNullable<z.ZodString>;
209
221
  uploadBytes: z.ZodNullable<z.ZodNumber>;
@@ -295,8 +307,11 @@ export declare function runEnd(outcome: RunOutcome, ran: RunState["command"], te
295
307
  * Where the command runs, as `run.json` records it as the run starts: on the launch machine (`launch-machine`), or in
296
308
  * a Vercel Sandbox (`vercel-sandbox`), with no sandbox or snapshot yet.
297
309
  */
298
- export declare function startedWhere(run: {
299
- readonly runner?: RunRunnerRequest | undefined;
310
+ export declare function startedWhere(runner: {
311
+ readonly kind: "launch-machine";
312
+ } | {
313
+ readonly kind: "vercel-sandbox";
314
+ readonly session: RunRunnerRequest;
300
315
  }): RunRecordWhere;
301
316
  /**
302
317
  * `where` once the run is over, from the runner's final state: for a run in a runner sandbox, the runner sandbox the
@@ -30,13 +30,15 @@ const snapshotSchema = z.object({
30
30
  base: z.string(),
31
31
  built: z.boolean(),
32
32
  builtBehind: z.number().nullable(),
33
+ /** Where a reused snapshot came from (`local` or `shared`); null when built, or absent in older records. */
34
+ source: z.enum(["local", "shared"]).nullable().exactOptional(),
33
35
  });
34
36
  const whereSchema = z.discriminatedUnion("kind", [
35
37
  z.object({ kind: z.literal("launch-machine") }),
36
38
  z.object({
37
39
  kind: z.literal("vercel-sandbox"),
38
- team: z.string(),
39
- project: z.string(),
40
+ team: z.string().nullable(),
41
+ project: z.string().nullable(),
40
42
  region: z.string(),
41
43
  runtime: z.string(),
42
44
  vcpus: z.number().int().positive(),
@@ -178,16 +180,16 @@ function commandMs(ran) {
178
180
  * Where the command runs, as `run.json` records it as the run starts: on the launch machine (`launch-machine`), or in
179
181
  * a Vercel Sandbox (`vercel-sandbox`), with no sandbox or snapshot yet.
180
182
  */
181
- export function startedWhere(run) {
182
- if (run.runner === undefined)
183
+ export function startedWhere(runner) {
184
+ if (runner.kind === "launch-machine")
183
185
  return { kind: "launch-machine" };
184
- const { prepared, target } = run.runner;
186
+ const { prepared, target } = runner.session;
185
187
  return {
186
188
  kind: "vercel-sandbox",
187
- team: target.team,
188
- project: target.project,
189
- region: prepared.recipe.region,
190
- runtime: prepared.recipe.runtime,
189
+ team: target?.team ?? null,
190
+ project: target?.project ?? null,
191
+ region: prepared.options.region,
192
+ runtime: prepared.options.runtime,
191
193
  vcpus: prepared.vcpus,
192
194
  base: prepared.base,
193
195
  baseRef: prepared.baseRef,
@@ -216,6 +218,7 @@ export function endedWhere(where, runner) {
216
218
  base: snapshot.base,
217
219
  built: snapshot.kind === "built",
218
220
  builtBehind: snapshot.builtBehind,
221
+ source: snapshot.kind === "reused" ? snapshot.source : null,
219
222
  },
220
223
  keptUntil: runner?.kept?.stopsAt ?? null,
221
224
  uploadBytes: runner?.uploadBytes ?? null,
@@ -1,4 +1,4 @@
1
- // The base the runner builds on: HEAD's merge-base with one of the recipe's `baseRefs`, from local refs only.
1
+ // The base the runner builds on: HEAD's merge-base with one of the runner's `baseRefs`, from local refs only.
2
2
  /**
3
3
  * Resolves a run's base from `baseRefs`, local refs only. Of the refs that exist and share history with HEAD, the
4
4
  * newest merge-base wins: a later ref's merge-base replaces the best so far only when the best is its ancestor, so a