@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
@@ -1,17 +1,19 @@
1
- import type { Credential, CredentialSource, MintFailed, MintTarget } from "../sdk/extension/index.ts";
1
+ import type { Credential, CredentialFailure, CredentialSource, MintFailed, MintTarget, VercelProject } from "../sdk/extension/index.ts";
2
2
  import type { CredentialProgress } from "./events.ts";
3
- import type { CredentialGateway, GitHubActionsTokenGateway, MintOutcome } from "./gateways.ts";
3
+ import type { CredentialGateway, GitHubActionsTokenGateway, MintOutcome, VercelOidcTokenGateway } from "./gateways.ts";
4
4
  /** The progress line a GitHub Actions OIDC token request prints as it starts. */
5
5
  export declare const REQUESTING_TOKEN_LINE = "Requesting a GitHub Actions OIDC token\u2026";
6
6
  /**
7
- * Which credential source a run or an extension's command gets its credential from, picked with `--credential`: the mint, for
8
- * `target`, or a GitHub Actions OIDC token request.
7
+ * Which credential source a run or an extension's command gets its credential from, picked with `--credential`: the
8
+ * mint, for `target`; a GitHub Actions OIDC token request; or `VERCEL_OIDC_TOKEN`.
9
9
  */
10
10
  export type CredentialSourceChoice = {
11
11
  readonly source: "mint";
12
12
  readonly target: MintTarget;
13
13
  } | {
14
14
  readonly source: "github-actions";
15
+ } | {
16
+ readonly source: "vercel-oidc";
15
17
  };
16
18
  /** A clock as a credential source reads it; structural so this module needs no other module's time seams. */
17
19
  interface SourceClock {
@@ -22,12 +24,14 @@ interface SourceTimer {
22
24
  sleep(ms: number, signal?: AbortSignal): Promise<void>;
23
25
  }
24
26
  /**
25
- * What a credential source reaches the world through: the mint, GitHub Actions' OIDC token issuer, the clock a token's
26
- * age is read from and the timer a token request's retries wait on.
27
+ * What a credential source reaches the world through: the mint, GitHub Actions' OIDC token issuer, the
28
+ * `VERCEL_OIDC_TOKEN` environment reader, the clock a token's age is read from, and the timer a token request's
29
+ * retries wait on.
27
30
  */
28
31
  export interface CredentialContext {
29
32
  readonly credentials: CredentialGateway;
30
33
  readonly githubActionsTokens: GitHubActionsTokenGateway;
34
+ readonly vercelOidcTokens: VercelOidcTokenGateway;
31
35
  readonly clock: SourceClock;
32
36
  readonly timer: SourceTimer;
33
37
  }
@@ -41,6 +45,24 @@ export interface MintSource extends CredentialSource {
41
45
  readonly failure: MintFailed;
42
46
  }>;
43
47
  }
48
+ /** Why the `VERCEL_OIDC_TOKEN` source obtained no credential. */
49
+ export type VercelOidcFailed = Extract<CredentialFailure, {
50
+ readonly source: "vercel-oidc";
51
+ }>;
52
+ /**
53
+ * `VERCEL_OIDC_TOKEN` as a credential source: it refuses a token that names no team and project, so what it obtains
54
+ * carries them (`project`).
55
+ */
56
+ export interface VercelOidcSource extends CredentialSource {
57
+ obtain(): Promise<{
58
+ readonly ok: true;
59
+ readonly credential: Credential;
60
+ readonly project: VercelProject;
61
+ } | {
62
+ readonly ok: false;
63
+ readonly failure: VercelOidcFailed;
64
+ }>;
65
+ }
44
66
  /**
45
67
  * The credential source `choice` names, over `context`, reporting to `progress`: the mint emits `minting` before its
46
68
  * one mint and `minted` after it, and a GitHub Actions OIDC token request emits `requesting-token` before each
@@ -50,6 +72,9 @@ export interface MintSource extends CredentialSource {
50
72
  export declare function credentialSourceFor(choice: Extract<CredentialSourceChoice, {
51
73
  readonly source: "mint";
52
74
  }>, context: CredentialContext, progress: CredentialProgress): MintSource;
75
+ export declare function credentialSourceFor(choice: Extract<CredentialSourceChoice, {
76
+ readonly source: "vercel-oidc";
77
+ }>, context: CredentialContext, progress: CredentialProgress): VercelOidcSource;
53
78
  export declare function credentialSourceFor(choice: CredentialSourceChoice, context: CredentialContext, progress: CredentialProgress): CredentialSource;
54
79
  /**
55
80
  * The mint as a credential source: it mints at most once. The first `obtain()` calls `mint`; every later call,
@@ -76,4 +101,46 @@ export declare function githubActionsSource(context: {
76
101
  readonly timer: SourceTimer;
77
102
  readonly progress: CredentialProgress;
78
103
  }): CredentialSource;
104
+ /**
105
+ * A pre-minted Vercel project OIDC token (`VERCEL_OIDC_TOKEN`) as a credential source. The first `obtain()` reads
106
+ * through `gateway` and checks `credential.vercelProject()` (requiring a valid JWT with `owner_id` and `project_id`
107
+ * claims), handing the team and project on with the credential; every later call returns the same outcome. Never
108
+ * logs, prints, or exposes the raw token.
109
+ */
110
+ export declare function vercelOidcSource(gateway: VercelOidcTokenGateway): VercelOidcSource;
111
+ /**
112
+ * How obtaining a credential for a Vercel Sandbox ended: the credential with the team and project it names; the
113
+ * mint's or `VERCEL_OIDC_TOKEN`'s failure; or `claims-missing`, a minted credential that names no team and project,
114
+ * for the mint's `target`.
115
+ */
116
+ export type VercelProjectOutcome = {
117
+ readonly ok: true;
118
+ readonly credential: Credential;
119
+ readonly project: VercelProject;
120
+ } | {
121
+ readonly ok: false;
122
+ readonly failure: MintFailed | VercelOidcFailed;
123
+ } | {
124
+ readonly ok: false;
125
+ readonly failure: {
126
+ readonly source: "claims-missing";
127
+ readonly target: MintTarget;
128
+ };
129
+ };
130
+ /**
131
+ * The credential source a Vercel Sandbox runs with (`source`, which the run's resources share), and `obtain`, which
132
+ * obtains its credential with the team and project it names (`VercelProjectOutcome`).
133
+ */
134
+ export interface VercelProjectSource {
135
+ readonly source: CredentialSource;
136
+ readonly obtain: () => Promise<VercelProjectOutcome>;
137
+ }
138
+ /**
139
+ * The credential source `choice` names for a Vercel Sandbox, which needs the team and project a credential names. The
140
+ * `VERCEL_OIDC_TOKEN` source checks them itself; this checks the mint's, the one place a credential without them ends
141
+ * as `claims-missing`.
142
+ */
143
+ export declare function vercelProjectSource(choice: Extract<CredentialSourceChoice, {
144
+ readonly source: "mint" | "vercel-oidc";
145
+ }>, context: CredentialContext, progress: CredentialProgress): VercelProjectSource;
79
146
  export {};
@@ -1,6 +1,7 @@
1
1
  // The credential sources, built by one factory (`credentialSourceFor`) from the credential choice, over the
2
- // credential gateways, a clock and a timer, reporting each mint and token request to a `CredentialProgress`. The mint
3
- // source and the GitHub Actions source it builds are exported for this module's own tests only.
2
+ // credential gateways, a clock and a timer, reporting each mint and token request to a `CredentialProgress`. A Vercel
3
+ // Sandbox gets its source through `vercelProjectSource`, the one place that checks the team and project a credential
4
+ // names. The mint source and the GitHub Actions source it builds are exported for this module's own tests only.
4
5
  /** The progress line a GitHub Actions OIDC token request prints as it starts. */
5
6
  export const REQUESTING_TOKEN_LINE = "Requesting a GitHub Actions OIDC token…";
6
7
  export function credentialSourceFor(choice, context, progress) {
@@ -11,6 +12,8 @@ export function credentialSourceFor(choice, context, progress) {
11
12
  timer: context.timer,
12
13
  progress,
13
14
  });
15
+ if (choice.source === "vercel-oidc")
16
+ return vercelOidcSource(context.vercelOidcTokens);
14
17
  const { target } = choice;
15
18
  return mintSource(target, async () => {
16
19
  await progress.emit({ kind: "minting", target });
@@ -117,3 +120,53 @@ function isRetryable(failure) {
117
120
  return false;
118
121
  }
119
122
  }
123
+ /**
124
+ * A pre-minted Vercel project OIDC token (`VERCEL_OIDC_TOKEN`) as a credential source. The first `obtain()` reads
125
+ * through `gateway` and checks `credential.vercelProject()` (requiring a valid JWT with `owner_id` and `project_id`
126
+ * claims), handing the team and project on with the credential; every later call returns the same outcome. Never
127
+ * logs, prints, or exposes the raw token.
128
+ */
129
+ export function vercelOidcSource(gateway) {
130
+ let outcome;
131
+ return {
132
+ obtain() {
133
+ outcome ??= (async () => {
134
+ const read = await gateway.read();
135
+ if (!read.ok)
136
+ return { ok: false, failure: { source: "vercel-oidc", failure: read.failure } };
137
+ const project = read.credential.vercelProject();
138
+ if (project === undefined)
139
+ return { ok: false, failure: { source: "vercel-oidc", failure: { kind: "invalid-token" } } };
140
+ return { ok: true, credential: read.credential, project };
141
+ })();
142
+ return outcome;
143
+ },
144
+ origin() {
145
+ return { source: "vercel-oidc" };
146
+ },
147
+ };
148
+ }
149
+ /**
150
+ * The credential source `choice` names for a Vercel Sandbox, which needs the team and project a credential names. The
151
+ * `VERCEL_OIDC_TOKEN` source checks them itself; this checks the mint's, the one place a credential without them ends
152
+ * as `claims-missing`.
153
+ */
154
+ export function vercelProjectSource(choice, context, progress) {
155
+ if (choice.source === "vercel-oidc") {
156
+ const source = credentialSourceFor(choice, context, progress);
157
+ return { source, obtain: () => source.obtain() };
158
+ }
159
+ const source = credentialSourceFor(choice, context, progress);
160
+ return {
161
+ source,
162
+ obtain: async () => {
163
+ const got = await source.obtain();
164
+ if (!got.ok)
165
+ return got;
166
+ const project = got.credential.vercelProject();
167
+ return project === undefined
168
+ ? { ok: false, failure: { source: "claims-missing", target: choice.target } }
169
+ : { ok: true, credential: got.credential, project };
170
+ },
171
+ };
172
+ }
@@ -1,4 +1,4 @@
1
- import type { Mount } from "@vercel/clinkr";
1
+ import type { ManifestEntry, Mount } from "@vercel/clinkr";
2
2
  import type { StormApp } from "./context.ts";
3
3
  import type { ExtensionCommands } from "./sdk/extension/commands.ts";
4
4
  /** One extension's command tree, and the command path storm mounts it at. */
@@ -18,3 +18,8 @@ export declare const EXTENSION_COMMANDS: readonly ExtensionCommandsEntry[];
18
18
  * Clinkr refuses a path that collides with a command of storm's own or another mount.
19
19
  */
20
20
  export declare function extensionMounts(root: string): readonly Mount<StormApp>[];
21
+ /**
22
+ * Every extension's command tree, mounted from pre-built static manifests (keyed by each extension's `directory`), for
23
+ * single-file compiled builds that do not scan directories at runtime.
24
+ */
25
+ export declare function extensionManifestMounts(manifests: Readonly<Record<string, Readonly<Record<string, ManifestEntry>>>>): readonly Mount<StormApp>[];
@@ -4,7 +4,8 @@
4
4
  // resources, the runner, or the SDK. This file places each tree, not its extension: the tree of an extension that
5
5
  // brings a resource goes under `ext <name>`, so its storm commands can't collide with storm's own. `.oxlintrc.json`
6
6
  // holds this file to `command-tree.ts`; `test/unit/extension-commands.test.ts` holds its list to the extensions'
7
- // `commands`. `scripts/bundle.js` reads the list from tsc's build to bundle each tree's commands.
7
+ // `commands`. `scripts/bundle.js` reads the list from tsc's build to bundle each tree's commands, and
8
+ // `scripts/build-bun-entry.js` reads it to emit static manifests mounted via `extensionManifestMounts`.
8
9
  import { testserverExtensionCommands } from "./extensions/testserver/command-tree.js";
9
10
  /**
10
11
  * Every extension's command tree, in extension order, with its path, checked against the app Clinkr hands their
@@ -21,3 +22,16 @@ export const EXTENSION_COMMANDS = [
21
22
  export function extensionMounts(root) {
22
23
  return EXTENSION_COMMANDS.map(({ commands, path }) => commands.mount({ path, root }));
23
24
  }
25
+ /**
26
+ * Every extension's command tree, mounted from pre-built static manifests (keyed by each extension's `directory`), for
27
+ * single-file compiled builds that do not scan directories at runtime.
28
+ */
29
+ export function extensionManifestMounts(manifests) {
30
+ return EXTENSION_COMMANDS.map(({ commands, path }) => {
31
+ const manifest = manifests[commands.directory];
32
+ if (manifest === undefined) {
33
+ throw new Error(`Missing bundled command manifest for extension directory "${commands.directory}".`);
34
+ }
35
+ return commands.mount({ path, manifest });
36
+ });
37
+ }
@@ -30,6 +30,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
30
30
  credential: z.ZodDefault<z.ZodEnum<{
31
31
  "github-actions": "github-actions";
32
32
  mint: "mint";
33
+ "vercel-oidc": "vercel-oidc";
33
34
  }>>;
34
35
  }, z.core.$strip>, import("@vercel/clinkr").Outcomes<{
35
36
  created: z.ZodObject<{
@@ -113,6 +114,8 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
113
114
  aud: z.ZodString;
114
115
  repository: z.ZodString;
115
116
  }, z.core.$strip>>;
117
+ }, z.core.$strip>, z.ZodObject<{
118
+ source: z.ZodLiteral<"vercel-oidc">;
116
119
  }, z.core.$strip>], "source">;
117
120
  fix: z.ZodString;
118
121
  status: z.ZodNumber;
@@ -193,6 +196,11 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
193
196
  detail: string;
194
197
  fix: string;
195
198
  }]>;
199
+ vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
200
+ cause: "invalid-token" | "missing-token";
201
+ detail: string;
202
+ fix: string;
203
+ }]>;
196
204
  }, {
197
205
  readonly pullRequestUnreadable: {
198
206
  readonly exitCode: 1;
@@ -343,6 +351,8 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
343
351
  aud: z.ZodString;
344
352
  repository: z.ZodString;
345
353
  }, z.core.$strip>>;
354
+ }, z.core.$strip>, z.ZodObject<{
355
+ source: z.ZodLiteral<"vercel-oidc">;
346
356
  }, z.core.$strip>], "source">;
347
357
  fix: z.ZodString;
348
358
  status: z.ZodNumber;
@@ -359,13 +369,15 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
359
369
  aud: string;
360
370
  repository: string;
361
371
  } | null;
372
+ } | {
373
+ source: "vercel-oidc";
362
374
  };
363
375
  fix: string;
364
376
  status: number;
365
377
  vercelId: string | null;
366
378
  }) => {
367
379
  message: string;
368
- rows: (readonly ["Project", string] | readonly ["Team", string])[] | (readonly ["aud", string] | readonly ["repository", string])[];
380
+ rows: (readonly ["Credential", "VERCEL_OIDC_TOKEN"])[] | (readonly ["Project", string] | readonly ["Team", string])[] | (readonly ["aud", string] | readonly ["repository", string])[];
369
381
  next: {
370
382
  type: "text";
371
383
  text: string;
@@ -506,6 +518,11 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
506
518
  detail: string;
507
519
  fix: string;
508
520
  }]>;
521
+ readonly vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
522
+ cause: "invalid-token" | "missing-token";
523
+ detail: string;
524
+ fix: string;
525
+ }]>;
509
526
  }>, import("@vercel/clinkr").OutcomeOf<import("@vercel/clinkr").Outcomes<{
510
527
  created: z.ZodObject<{
511
528
  testserverUrl: z.ZodString;
@@ -588,6 +605,8 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
588
605
  aud: z.ZodString;
589
606
  repository: z.ZodString;
590
607
  }, z.core.$strip>>;
608
+ }, z.core.$strip>, z.ZodObject<{
609
+ source: z.ZodLiteral<"vercel-oidc">;
591
610
  }, z.core.$strip>], "source">;
592
611
  fix: z.ZodString;
593
612
  status: z.ZodNumber;
@@ -668,6 +687,11 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
668
687
  detail: string;
669
688
  fix: string;
670
689
  }]>;
690
+ vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
691
+ cause: "invalid-token" | "missing-token";
692
+ detail: string;
693
+ fix: string;
694
+ }]>;
671
695
  }, {
672
696
  readonly pullRequestUnreadable: {
673
697
  readonly exitCode: 1;
@@ -818,6 +842,8 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
818
842
  aud: z.ZodString;
819
843
  repository: z.ZodString;
820
844
  }, z.core.$strip>>;
845
+ }, z.core.$strip>, z.ZodObject<{
846
+ source: z.ZodLiteral<"vercel-oidc">;
821
847
  }, z.core.$strip>], "source">;
822
848
  fix: z.ZodString;
823
849
  status: z.ZodNumber;
@@ -834,13 +860,15 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
834
860
  aud: string;
835
861
  repository: string;
836
862
  } | null;
863
+ } | {
864
+ source: "vercel-oidc";
837
865
  };
838
866
  fix: string;
839
867
  status: number;
840
868
  vercelId: string | null;
841
869
  }) => {
842
870
  message: string;
843
- rows: (readonly ["Project", string] | readonly ["Team", string])[] | (readonly ["aud", string] | readonly ["repository", string])[];
871
+ rows: (readonly ["Credential", "VERCEL_OIDC_TOKEN"])[] | (readonly ["Project", string] | readonly ["Team", string])[] | (readonly ["aud", string] | readonly ["repository", string])[];
844
872
  next: {
845
873
  type: "text";
846
874
  text: string;
@@ -981,5 +1009,10 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
981
1009
  detail: string;
982
1010
  fix: string;
983
1011
  }]>;
1012
+ readonly vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
1013
+ cause: "invalid-token" | "missing-token";
1014
+ detail: string;
1015
+ fix: string;
1016
+ }]>;
984
1017
  }>>, import("../../app.ts").TestserverCommandApp, false>;
985
1018
  export default _default;
@@ -6,7 +6,7 @@ import {
6
6
  rejectedCredentialShape,
7
7
  rejectedCredentialText,
8
8
  testserverPoolDefinition
9
- } from "../../../../../chunks/chunk-R7XVBZOY.js";
9
+ } from "../../../../../chunks/chunk-EEENLQHE.js";
10
10
  import {
11
11
  CREATE_ATTEMPTS,
12
12
  DEFAULT_TTL_MINUTES,
@@ -19,20 +19,20 @@ import {
19
19
  parseTtl,
20
20
  resolvePrBuild,
21
21
  shortSha
22
- } from "../../../../../chunks/chunk-CN4EFA5J.js";
22
+ } from "../../../../../chunks/chunk-72ZFEMAW.js";
23
23
  import {
24
24
  testserverCommands
25
- } from "../../../../../chunks/chunk-5CCP36QQ.js";
25
+ } from "../../../../../chunks/chunk-2RNDPDTJ.js";
26
26
  import {
27
27
  configErrors,
28
28
  credentialErrors,
29
29
  credentialSourceErrors
30
- } from "../../../../../chunks/chunk-DC2CDHNK.js";
31
- import "../../../../../chunks/chunk-AWBSONHB.js";
30
+ } from "../../../../../chunks/chunk-RNAS7JHE.js";
31
+ import "../../../../../chunks/chunk-XBDRVFEV.js";
32
32
  import {
33
33
  defineOutcomes,
34
34
  renderOutcome
35
- } from "../../../../../chunks/chunk-VL7WFTVQ.js";
35
+ } from "../../../../../chunks/chunk-4WAMTUWZ.js";
36
36
 
37
37
  // src/extensions/testserver/commands/pool/create/command.ts
38
38
  import { z as z2 } from "zod";
@@ -201,7 +201,7 @@ var command_default = testserverCommands.define({
201
201
  project: z2.string().min(1).optional(),
202
202
  build: z2.string().min(1).optional(),
203
203
  ttl: z2.string().optional(),
204
- credential: z2.enum(["mint", "github-actions"]).default("mint")
204
+ credential: z2.enum(["mint", "github-actions", "vercel-oidc"]).default("mint")
205
205
  }),
206
206
  cli: { options: { project: { short: "p" } } },
207
207
  response: outcomes,
@@ -1,20 +1,20 @@
1
1
  // src/extensions/testserver/commands/pool/create/metadata.ts
2
2
  var metadata = {
3
- description: "Get a credential (mint one, or with --credential github-actions request a GitHub Actions OIDC token), create one Testserver sandbox with the TTL --ttl gives, and add it to the pool, unleased. Prints its Testserver URL, log viewer URL, and the build it resolved to; for a vercel/api pull request, also the head commit. A flag overrides storm.config.ts, found in the working directory or a parent up to the git worktree's root and checked whole, which overrides the built-in default.",
3
+ description: "Get a credential (mint one, read VERCEL_OIDC_TOKEN with --credential vercel-oidc, or request a GitHub Actions OIDC token with --credential github-actions), create one Testserver sandbox with the TTL --ttl gives, and add it to the pool, unleased. Prints its Testserver URL, log viewer URL, and the build it resolved to; for a vercel/api pull request, also the head commit. A flag overrides storm.config.ts, found in the working directory or a parent up to the git worktree's root and checked whole, which overrides the built-in default.",
4
4
  help: {
5
5
  usages: ["[--build <BUILD>] [--ttl <DURATION>] [--credential <SOURCE>] [--scope <TEAM> --project <PROJECT>]"],
6
6
  fields: {
7
7
  scope: {
8
8
  valueLabel: "TEAM",
9
- description: "The control plane team: the Vercel team whose project's development OIDC tokens the Testserver control plane trusts. Required with the mint, from this flag or scope in storm.config.ts; unused with --credential github-actions."
9
+ description: "The control plane team: the Vercel team whose project's development OIDC tokens the Testserver control plane trusts. Required with the mint, from this flag or scope in storm.config.ts; unused with --credential vercel-oidc or --credential github-actions."
10
10
  },
11
11
  project: {
12
12
  valueLabel: "PROJECT",
13
- description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required with the mint, from this flag or project in storm.config.ts; unused with --credential github-actions."
13
+ description: "The control plane project: the Vercel project, within the team, to mint the credential for. Required with the mint, from this flag or project in storm.config.ts; unused with --credential vercel-oidc or --credential github-actions."
14
14
  },
15
15
  build: {
16
16
  valueLabel: "BUILD",
17
- description: "The build to create the Testserver sandbox on: a build name, the build channel stable or latest_main, or a vercel/api pull request as pr:<N> or its URL. A pull request creates on the newest build made from its head commit, which storm reads from GitHub with GITHUB_TOKEN, GH_TOKEN or gh auth token, or refuses. Default stable, or resources.testserverPool.build in storm.config.ts."
17
+ description: "The build to create the Testserver sandbox on: a build name, the build channel stable or latest_main, or a vercel/api pull request as pr:<N> or its URL. A pull request creates on the newest build made from its head commit, which storm reads from GitHub with GITHUB_TOKEN, GH_TOKEN, or gh auth token, or refuses. Default stable, or resources.testserverPool.build in storm.config.ts."
18
18
  },
19
19
  ttl: {
20
20
  valueLabel: "DURATION",
@@ -22,7 +22,7 @@ var metadata = {
22
22
  },
23
23
  credential: {
24
24
  valueLabel: "SOURCE",
25
- description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, and needs no --scope or --project. No config key."
25
+ description: "The credential source: mint, the default, mints one with the vercel CLI for --scope and --project; vercel-oidc reads a pre-minted Vercel project OIDC token from VERCEL_OIDC_TOKEN and needs no --scope or --project; github-actions requests a GitHub Actions OIDC token, in a GitHub Actions job with permissions id-token: write, and needs no --scope or --project. No config key."
26
26
  }
27
27
  },
28
28
  examples: [
@@ -82,6 +82,8 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
82
82
  aud: z.ZodString;
83
83
  repository: z.ZodString;
84
84
  }, z.core.$strip>>;
85
+ }, z.core.$strip>, z.ZodObject<{
86
+ source: z.ZodLiteral<"vercel-oidc">;
85
87
  }, z.core.$strip>], "source">;
86
88
  fix: z.ZodString;
87
89
  status: z.ZodNumber;
@@ -162,6 +164,11 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
162
164
  detail: string;
163
165
  fix: string;
164
166
  }]>;
167
+ vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
168
+ cause: "invalid-token" | "missing-token";
169
+ detail: string;
170
+ fix: string;
171
+ }]>;
165
172
  }, {
166
173
  readonly pullRequestUnreadable: {
167
174
  readonly exitCode: 1;
@@ -312,6 +319,8 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
312
319
  aud: z.ZodString;
313
320
  repository: z.ZodString;
314
321
  }, z.core.$strip>>;
322
+ }, z.core.$strip>, z.ZodObject<{
323
+ source: z.ZodLiteral<"vercel-oidc">;
315
324
  }, z.core.$strip>], "source">;
316
325
  fix: z.ZodString;
317
326
  status: z.ZodNumber;
@@ -328,13 +337,15 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
328
337
  aud: string;
329
338
  repository: string;
330
339
  } | null;
340
+ } | {
341
+ source: "vercel-oidc";
331
342
  };
332
343
  fix: string;
333
344
  status: number;
334
345
  vercelId: string | null;
335
346
  }) => {
336
347
  message: string;
337
- rows: (readonly ["Project", string] | readonly ["Team", string])[] | (readonly ["aud", string] | readonly ["repository", string])[];
348
+ rows: (readonly ["Credential", "VERCEL_OIDC_TOKEN"])[] | (readonly ["Project", string] | readonly ["Team", string])[] | (readonly ["aud", string] | readonly ["repository", string])[];
338
349
  next: {
339
350
  type: "text";
340
351
  text: string;
@@ -475,4 +486,9 @@ export declare const outcomes: import("@vercel/clinkr").Outcomes<{
475
486
  detail: string;
476
487
  fix: string;
477
488
  }]>;
489
+ readonly vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
490
+ cause: "invalid-token" | "missing-token";
491
+ detail: string;
492
+ fix: string;
493
+ }]>;
478
494
  }>;
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  inspectPool
3
- } from "../../../../../chunks/chunk-CN4EFA5J.js";
3
+ } from "../../../../../chunks/chunk-72ZFEMAW.js";
4
4
  import {
5
5
  testserverCommands
6
- } from "../../../../../chunks/chunk-5CCP36QQ.js";
7
- import "../../../../../chunks/chunk-AWBSONHB.js";
6
+ } from "../../../../../chunks/chunk-2RNDPDTJ.js";
7
+ import "../../../../../chunks/chunk-XBDRVFEV.js";
8
8
  import {
9
9
  defineOutcomes,
10
10
  renderOutcome
11
- } from "../../../../../chunks/chunk-VL7WFTVQ.js";
11
+ } from "../../../../../chunks/chunk-4WAMTUWZ.js";
12
12
 
13
13
  // src/extensions/testserver/commands/pool/list/command.ts
14
14
  import { z as z2 } from "zod";
@@ -11,6 +11,8 @@ export declare const credentialOriginSchema: z.ZodDiscriminatedUnion<[z.ZodObjec
11
11
  aud: z.ZodString;
12
12
  repository: z.ZodString;
13
13
  }, z.core.$strip>>;
14
+ }, z.core.$strip>, z.ZodObject<{
15
+ source: z.ZodLiteral<"vercel-oidc">;
14
16
  }, z.core.$strip>], "source">;
15
17
  type CredentialOriginFacts = z.infer<typeof credentialOriginSchema>;
16
18
  /** The facts of a rejected credential that `credential_rejected` carries: where it came from, and the one fix. */
@@ -25,8 +27,10 @@ export declare const rejectedCredentialShape: {
25
27
  aud: z.ZodString;
26
28
  repository: z.ZodString;
27
29
  }, z.core.$strip>>;
30
+ }, z.core.$strip>, z.ZodObject<{
31
+ source: z.ZodLiteral<"vercel-oidc">;
28
32
  }, z.core.$strip>], "source">;
29
- /** The one fix: a trusted team and project for the mint, a Trusted Source rule for a GitHub Actions OIDC token. */
33
+ /** The one fix: a trusted team and project for the mint, a Trusted Source rule for a GitHub Actions OIDC token, or a trusted project's token for VERCEL_OIDC_TOKEN. */
30
34
  fix: z.ZodString;
31
35
  };
32
36
  /** Where a rejected credential came from, and its fix, as `credential_rejected` reports them. */
@@ -42,5 +46,5 @@ export declare function rejectedCredentialFix(origin: CredentialOrigin): string;
42
46
  /** The opening of `credential_rejected`'s message: which credential the Testserver control plane rejected. */
43
47
  export declare function rejectedCredentialText(origin: CredentialOriginFacts): string;
44
48
  /** The rows `credential_rejected` shows for where the credential came from. */
45
- export declare function credentialOriginRows(origin: CredentialOriginFacts): (readonly ["Project", string] | readonly ["Team", string])[] | (readonly ["aud", string] | readonly ["repository", string])[];
49
+ export declare function credentialOriginRows(origin: CredentialOriginFacts): (readonly ["Credential", "VERCEL_OIDC_TOKEN"])[] | (readonly ["Project", string] | readonly ["Team", string])[] | (readonly ["aud", string] | readonly ["repository", string])[];
46
50
  export {};
@@ -17,11 +17,15 @@ export const credentialOriginSchema = z.discriminatedUnion("source", [
17
17
  /** The token's aud and repository claims; null when they can't be read. */
18
18
  claims: z.object({ aud: z.string(), repository: z.string() }).nullable(),
19
19
  }),
20
+ z.object({
21
+ /** A pre-minted Vercel project OIDC token from VERCEL_OIDC_TOKEN. */
22
+ source: z.literal("vercel-oidc"),
23
+ }),
20
24
  ]);
21
25
  /** The facts of a rejected credential that `credential_rejected` carries: where it came from, and the one fix. */
22
26
  export const rejectedCredentialShape = {
23
27
  origin: credentialOriginSchema,
24
- /** The one fix: a trusted team and project for the mint, a Trusted Source rule for a GitHub Actions OIDC token. */
28
+ /** The one fix: a trusted team and project for the mint, a Trusted Source rule for a GitHub Actions OIDC token, or a trusted project's token for VERCEL_OIDC_TOKEN. */
25
29
  fix: z.string(),
26
30
  };
27
31
  /** Where a rejected credential came from, and its fix, as `credential_rejected` reports them. */
@@ -29,7 +33,9 @@ export function rejectedCredentialFacts(origin) {
29
33
  return {
30
34
  origin: origin.source === "mint"
31
35
  ? { source: "mint", ...origin.target }
32
- : { source: "github-actions", claims: origin.claims === undefined ? null : { ...origin.claims } },
36
+ : origin.source === "vercel-oidc"
37
+ ? { source: "vercel-oidc" }
38
+ : { source: "github-actions", claims: origin.claims === undefined ? null : { ...origin.claims } },
33
39
  fix: rejectedCredentialFix(origin),
34
40
  };
35
41
  }
@@ -40,22 +46,34 @@ export function rejectedCredentialFacts(origin) {
40
46
  export function rejectedCredentialFix(origin) {
41
47
  if (origin.source === "mint")
42
48
  return "The Testserver control plane trusts development OIDC tokens only from projects in its Trusted Sources; vercel-internal mints for project vercel on team vercel. Use a trusted team and project, then retry.";
49
+ if (origin.source === "vercel-oidc")
50
+ return "The Testserver control plane trusts development OIDC tokens only from projects in its Trusted Sources. Set VERCEL_OIDC_TOKEN to a token from a trusted project, then retry.";
43
51
  const aud = origin.claims?.aud ?? "https://github.com/<owner>";
44
52
  const repository = origin.claims?.repository ?? "<owner>/<repo>";
45
53
  return `The Testserver control plane trusts GitHub Actions OIDC tokens only from repositories in its Trusted Sources. Ask the \`vercel/testserver\` owners for a Trusted Source rule matching \`aud: ${aud}\` and \`repository: ${repository}\`, then rerun the job.`;
46
54
  }
47
55
  /** The opening of `credential_rejected`'s message: which credential the Testserver control plane rejected. */
48
56
  export function rejectedCredentialText(origin) {
49
- return origin.source === "mint"
50
- ? `the credential minted for project ${origin.project} on team ${origin.team}`
51
- : "the GitHub Actions OIDC token";
57
+ switch (origin.source) {
58
+ case "mint":
59
+ return `the credential minted for project ${origin.project} on team ${origin.team}`;
60
+ case "github-actions":
61
+ return "the GitHub Actions OIDC token";
62
+ case "vercel-oidc":
63
+ return "the Vercel OIDC token from VERCEL_OIDC_TOKEN";
64
+ }
52
65
  }
53
66
  /** The rows `credential_rejected` shows for where the credential came from. */
54
67
  export function credentialOriginRows(origin) {
55
- return origin.source === "mint"
56
- ? [["Team", origin.team], ["Project", origin.project]]
57
- : [
58
- ["aud", origin.claims?.aud ?? "unreadable"],
59
- ["repository", origin.claims?.repository ?? "unreadable"],
60
- ];
68
+ switch (origin.source) {
69
+ case "mint":
70
+ return [["Team", origin.team], ["Project", origin.project]];
71
+ case "github-actions":
72
+ return [
73
+ ["aud", origin.claims?.aud ?? "unreadable"],
74
+ ["repository", origin.claims?.repository ?? "unreadable"],
75
+ ];
76
+ case "vercel-oidc":
77
+ return [["Credential", "VERCEL_OIDC_TOKEN"]];
78
+ }
61
79
  }
@@ -9,7 +9,7 @@ import { testserverCanceledLines } from "./canceled.js";
9
9
  import { dropLeasedEntries, releaseLeases } from "./pool/index.js";
10
10
  import { prBuildRefusal } from "./pr-build-facts.js";
11
11
  import { createWith, failedCreateFacts, provision, testserverCanceledFacts, unpooledFacts, } from "./provision.js";
12
- import { credentialRejected, noSandboxes, noUsableSandboxes, poolUnavailable, poolUnreadable, tokenRequestFailed, } from "./refusals.js";
12
+ import { credentialRejected, noSandboxes, noUsableSandboxes, poolUnavailable, poolUnreadable, tokenRequestFailed, vercelOidcTokenFailed, } from "./refusals.js";
13
13
  import { testserverPoolDropped, testserverPoolDroppedText, testserverPoolDropWarnings, testserverPoolReleased, testserverPoolReleasedText, testserverPoolReleaseWarnings, } from "./release.js";
14
14
  import { testserverPoolResult, testserverPoolResultWarnings } from "./result.js";
15
15
  import { STALE_TESTSERVER_VARIABLES, testserverConnectionOf } from "./run-sandbox.js";
@@ -110,6 +110,12 @@ function acquireRefusal(refusal) {
110
110
  failedCreates: failedCreateFacts(refusal.failedCreates),
111
111
  sandboxMayExist: refusal.failedCreates.some(mayLeaveSandbox),
112
112
  });
113
+ case "vercel-oidc-token-failed":
114
+ return vercelOidcTokenFailed(refusal.failure, {
115
+ ttlMinutes: refusal.ttlMinutes,
116
+ failedCreates: failedCreateFacts(refusal.failedCreates),
117
+ sandboxMayExist: refusal.failedCreates.some(mayLeaveSandbox),
118
+ });
113
119
  case "credential-rejected":
114
120
  return credentialRejected(refusal.origin, {
115
121
  status: refusal.failure.status,