@cnc-tools/storm 0.16.0 → 0.18.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.
- package/dist/bin/storm.js +54 -40
- package/dist/build-info.js +1 -1
- package/dist/chunks/{chunk-VL7WFTVQ.js → chunk-24UYAK4R.js} +465 -365
- package/dist/chunks/{chunk-DC2CDHNK.js → chunk-2JMWUKH3.js} +2074 -473
- package/dist/chunks/{chunk-FOZWA52V.js → chunk-3VXZONGE.js} +481 -376
- package/dist/chunks/{chunk-ZG3WQ4UF.js → chunk-55O4FCN4.js} +1 -1
- package/dist/chunks/{chunk-CN4EFA5J.js → chunk-72ZFEMAW.js} +1 -1
- package/dist/chunks/chunk-AS37D43E.js +2173 -0
- package/dist/chunks/chunk-CQAY6GLP.js +1260 -0
- package/dist/chunks/chunk-DZLU7BYK.js +340 -0
- package/dist/chunks/{chunk-R7XVBZOY.js → chunk-EEENLQHE.js} +59 -11
- package/dist/chunks/{chunk-TJNFVNKR.js → chunk-EI3XDCEI.js} +1 -1
- package/dist/chunks/{chunk-HVNK3I45.js → chunk-FDUY3BNF.js} +1 -1
- package/dist/chunks/{chunk-FCQUJDA4.js → chunk-GUCCYCIO.js} +4 -189
- package/dist/chunks/{chunk-OIY3DMF2.js → chunk-HBI4LEMH.js} +3 -3
- package/dist/chunks/{chunk-2MAD5NKK.js → chunk-K4MDQPLW.js} +1 -18
- package/dist/chunks/chunk-KK7PAWIZ.js +198 -0
- package/dist/chunks/{chunk-G3PHMXH5.js → chunk-KQ5FXRUD.js} +18 -1
- package/dist/chunks/{chunk-5VXBKPW6.js → chunk-LKXHGGGX.js} +1 -1
- package/dist/chunks/{chunk-P357TZAY.js → chunk-LOGHIUUB.js} +21 -18
- package/dist/chunks/{chunk-CK2GZEPK.js → chunk-OEPFINFT.js} +2 -2
- package/dist/chunks/{chunk-DWEAHX4T.js → chunk-OI4AP6Z7.js} +5 -5
- package/dist/chunks/{chunk-V4IKA3WI.js → chunk-PMBQWVTW.js} +26 -19
- package/dist/chunks/chunk-SZMYIIG2.js +88 -0
- package/dist/chunks/{chunk-5CCP36QQ.js → chunk-TXCOFC7N.js} +1 -1
- package/dist/chunks/{chunk-VUPZH7J2.js → chunk-UXD3TVWM.js} +1 -1
- package/dist/chunks/{chunk-3L52KNQA.js → chunk-WNW2QXQK.js} +8 -8
- package/dist/chunks/{chunk-AWBSONHB.js → chunk-XBDRVFEV.js} +55 -16
- package/dist/chunks/{live-app-WECQOQ4C.js → live-app-UY7BEDUN.js} +17 -13
- package/dist/cli.d.ts +28 -0
- package/dist/cli.js +64 -0
- package/dist/commands/exec/across-sandboxes-outcomes.d.ts +2 -2
- package/dist/commands/exec/across-sandboxes-outcomes.js +3 -3
- package/dist/commands/exec/before-run.d.ts +123 -0
- package/dist/commands/exec/before-run.js +105 -0
- package/dist/commands/exec/command.d.ts +67 -14
- package/dist/commands/exec/command.js +31 -95
- package/dist/commands/exec/driver-plan.d.ts +9 -4
- package/dist/commands/exec/driver-plan.js +8 -8
- package/dist/commands/exec/exec-words.js +1 -1
- package/dist/commands/exec/execute-run.d.ts +39 -0
- package/dist/commands/exec/execute-run.js +325 -0
- package/dist/commands/exec/live-view.d.ts +3 -3
- package/dist/commands/exec/live-view.js +16 -15
- package/dist/commands/exec/metadata.js +1 -1
- package/dist/commands/exec/mint-failed.d.ts +38 -0
- package/dist/commands/exec/mint-failed.js +27 -4
- package/dist/commands/exec/outcomes.d.ts +104 -22
- package/dist/commands/exec/outcomes.js +73 -26
- package/dist/commands/exec/plan-run.d.ts +58 -150
- package/dist/commands/exec/plan-run.js +239 -90
- package/dist/commands/exec/progress.d.ts +10 -6
- package/dist/commands/exec/progress.js +38 -25
- package/dist/commands/exec/run-bin.d.ts +11 -11
- package/dist/commands/exec/run-bin.js +9 -9
- package/dist/commands/exec/run-flags.d.ts +69 -0
- package/dist/commands/exec/run-flags.js +58 -0
- package/dist/commands/exec/run-metadata.js +4 -4
- package/dist/commands/exec/run-summary.d.ts +58 -0
- package/dist/commands/exec/run-summary.js +205 -0
- package/dist/commands/exec/runner-refusals.d.ts +82 -0
- package/dist/commands/exec/runner-refusals.js +71 -0
- package/dist/commands/exec/sandbox-progress.js +3 -0
- package/dist/commands/exec/stopped-outcome.d.ts +12 -0
- package/dist/commands/exec/stopped-outcome.js +77 -0
- package/dist/commands/exec/view.d.ts +20 -11
- package/dist/commands/exec/view.js +103 -47
- package/dist/commands/runs/facts.d.ts +8 -4
- package/dist/commands/runs/facts.js +19 -10
- package/dist/commands/runs/list/command.d.ts +16 -8
- package/dist/commands/runs/list/command.js +10 -10
- package/dist/commands/runs/list/outcomes.d.ts +8 -4
- package/dist/commands/runs/logs/command.js +10 -10
- package/dist/commands/runs/show/command.d.ts +16 -8
- package/dist/commands/runs/show/command.js +31 -29
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +8 -4
- package/dist/commands/runs/show/outcomes.js +8 -6
- package/dist/commands/snapshots/access.d.ts +111 -0
- package/dist/commands/snapshots/access.js +96 -0
- package/dist/commands/snapshots/build/command.d.ts +376 -101
- package/dist/commands/snapshots/build/command.js +447 -149
- package/dist/commands/snapshots/build/metadata.d.ts +10 -0
- package/dist/commands/snapshots/build/metadata.js +31 -11
- package/dist/commands/snapshots/build/outcomes.d.ts +242 -47
- package/dist/commands/snapshots/build/outcomes.js +200 -36
- package/dist/commands/snapshots/list/command.d.ts +368 -27
- package/dist/commands/snapshots/list/command.js +298 -68
- package/dist/commands/snapshots/list/metadata.d.ts +16 -0
- package/dist/commands/snapshots/list/metadata.js +29 -6
- package/dist/commands/snapshots/list/outcomes.d.ts +247 -15
- package/dist/commands/snapshots/list/outcomes.js +223 -52
- package/dist/commands/snapshots/metadata.js +1 -1
- package/dist/commands/snapshots/prune/command.d.ts +430 -0
- package/dist/commands/snapshots/prune/command.js +161 -0
- package/dist/commands/snapshots/prune/metadata.d.ts +28 -0
- package/dist/commands/snapshots/prune/metadata.js +39 -0
- package/dist/commands/snapshots/prune/outcomes.d.ts +208 -0
- package/dist/commands/snapshots/prune/outcomes.js +78 -0
- package/dist/commands/suites/list/command.js +17 -17
- package/dist/commands/suites/list/outcomes.js +2 -2
- package/dist/commands/test/command.d.ts +67 -14
- package/dist/commands/test/command.js +49 -252
- package/dist/commands/test/outcomes.d.ts +33 -7
- package/dist/config/check-runner.d.ts +3 -3
- package/dist/config/check-runner.js +8 -7
- package/dist/config/credential-resolver.d.ts +50 -5
- package/dist/config/credential-resolver.js +51 -19
- package/dist/config/credential-settle.d.ts +6 -2
- package/dist/config/credential-settle.js +11 -5
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +1 -1
- package/dist/config/runner.d.ts +5 -5
- package/dist/config/runner.js +1 -1
- package/dist/config/schema.d.ts +2 -2
- package/dist/config/schema.js +1 -1
- package/dist/config-file/define.d.ts +1 -1
- package/dist/config-file/define.js +1 -1
- package/dist/config-file/runner.d.ts +5 -5
- package/dist/config-file/toolchain.d.ts +14 -4
- package/dist/config-file/toolchain.js +43 -7
- package/dist/context.d.ts +10 -6
- package/dist/context.js +8 -6
- package/dist/core/across-sandboxes.d.ts +7 -6
- package/dist/core/across-sandboxes.js +123 -152
- package/dist/core/coordinator.d.ts +166 -0
- package/dist/core/coordinator.js +233 -0
- package/dist/core/events.d.ts +2 -2
- package/dist/core/index.d.ts +4 -2
- package/dist/core/index.js +1 -1
- package/dist/core/outcomes.d.ts +148 -0
- package/dist/core/{sandbox-end.js → outcomes.js} +28 -4
- package/dist/core/resources.d.ts +31 -53
- package/dist/core/resources.js +32 -70
- package/dist/core/run-state.d.ts +7 -1
- package/dist/core/run-state.js +2 -0
- package/dist/core/run.d.ts +32 -236
- package/dist/core/run.js +107 -267
- package/dist/core/state-directory.d.ts +1 -1
- package/dist/core/state-directory.js +2 -2
- package/dist/credential/gateways.d.ts +15 -1
- package/dist/credential/index.d.ts +4 -3
- package/dist/credential/index.js +3 -2
- package/dist/credential/live/vercel-cli-gateway.d.ts +1 -1
- package/dist/credential/live/vercel-cli-gateway.js +1 -1
- package/dist/credential/live/vercel-oidc-token-gateway.d.ts +11 -0
- package/dist/credential/live/vercel-oidc-token-gateway.js +16 -0
- package/dist/credential/source.d.ts +73 -6
- package/dist/credential/source.js +55 -2
- package/dist/extension-commands.d.ts +1 -1
- package/dist/extension-commands.js +2 -2
- package/dist/extensions/testserver/commands/pool/create/command.d.ts +35 -2
- package/dist/extensions/testserver/commands/pool/create/command.js +7 -7
- package/dist/extensions/testserver/commands/pool/create/metadata.js +5 -5
- package/dist/extensions/testserver/commands/pool/create/outcomes.d.ts +17 -1
- package/dist/extensions/testserver/commands/pool/list/command.js +4 -4
- package/dist/extensions/testserver/credential-facts.d.ts +6 -2
- package/dist/extensions/testserver/credential-facts.js +29 -11
- package/dist/extensions/testserver/lifecycle.js +7 -1
- package/dist/extensions/testserver/limit.d.ts +3 -0
- package/dist/extensions/testserver/limit.js +3 -0
- package/dist/extensions/testserver/provision.d.ts +8 -1
- package/dist/extensions/testserver/provision.js +8 -3
- package/dist/extensions/testserver/refusals.d.ts +6 -1
- package/dist/extensions/testserver/refusals.js +16 -1
- package/dist/extensions/testserver/resource.d.ts +1 -1
- package/dist/extensions/testserver/resource.js +1 -1
- package/dist/extensions/testserver/result.d.ts +1 -1
- package/dist/extensions/testserver/result.js +9 -4
- package/dist/planning/driver-file-lists.d.ts +0 -15
- package/dist/planning/driver-file-lists.js +2 -21
- package/dist/planning/plan-only.d.ts +3 -14
- package/dist/planning/plan-only.js +11 -20
- package/dist/planning/run-kind-flags.js +2 -2
- package/dist/planning/run-plan.d.ts +45 -12
- package/dist/planning/run-plan.js +4 -3
- package/dist/planning/suites.d.ts +1 -1
- package/dist/planning/suites.js +2 -2
- package/dist/planning/test-plan.d.ts +9 -0
- package/dist/planning/test-plan.js +9 -0
- package/dist/run-directory/recording.js +3 -3
- package/dist/run-directory/run-record.d.ts +26 -11
- package/dist/run-directory/run-record.js +16 -13
- package/dist/runner/base.js +1 -1
- package/dist/runner/build-snapshots.d.ts +60 -29
- package/dist/runner/build-snapshots.js +136 -29
- package/dist/runner/context.d.ts +15 -7
- package/dist/runner/context.js +19 -6
- package/dist/runner/events.d.ts +16 -10
- package/dist/runner/gateways.d.ts +122 -23
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/gh.d.ts +42 -0
- package/dist/runner/gh.js +58 -0
- package/dist/runner/index.d.ts +13 -8
- package/dist/runner/index.js +12 -6
- package/dist/runner/live/checkout-gateway.js +7 -0
- package/dist/runner/live/gh-output.d.ts +17 -0
- package/dist/runner/live/gh-output.js +37 -0
- package/dist/runner/live/gh-token-gateway.d.ts +13 -0
- package/dist/runner/live/gh-token-gateway.js +51 -0
- package/dist/runner/live/sandbox-errors.d.ts +2 -0
- package/dist/runner/live/sandbox-errors.js +4 -0
- package/dist/runner/live/sandbox-gateway.js +140 -4
- package/dist/runner/live/snapshot-index-gateway.d.ts +12 -0
- package/dist/runner/live/{snapshot-cache-gateway.js → snapshot-index-gateway.js} +11 -11
- package/dist/runner/live/snapshot-records.js +12 -12
- package/dist/runner/local-snapshot-index.d.ts +205 -0
- package/dist/runner/local-snapshot-index.js +210 -0
- package/dist/runner/network-policy.d.ts +6 -6
- package/dist/runner/network-policy.js +7 -7
- package/dist/runner/policy-writes.d.ts +1 -1
- package/dist/runner/policy-writes.js +1 -1
- package/dist/runner/prepare.d.ts +14 -14
- package/dist/runner/prepare.js +20 -11
- package/dist/runner/ready.d.ts +19 -11
- package/dist/runner/ready.js +104 -33
- package/dist/runner/sandboxed-command.d.ts +3 -3
- package/dist/runner/sandboxed-command.js +3 -3
- package/dist/runner/scope.d.ts +15 -8
- package/dist/runner/scope.js +16 -5
- package/dist/runner/secrets.d.ts +41 -18
- package/dist/runner/secrets.js +226 -30
- package/dist/runner/session.d.ts +8 -8
- package/dist/runner/session.js +6 -3
- package/dist/runner/shared-snapshot-entry.d.ts +92 -0
- package/dist/runner/shared-snapshot-entry.js +168 -0
- package/dist/runner/shared-snapshot-list.d.ts +81 -0
- package/dist/runner/shared-snapshot-list.js +155 -0
- package/dist/runner/shared-snapshot-lookup.d.ts +51 -0
- package/dist/runner/shared-snapshot-lookup.js +118 -0
- package/dist/runner/shared-snapshot-prune.d.ts +58 -0
- package/dist/runner/shared-snapshot-prune.js +133 -0
- package/dist/runner/snapshot-build.d.ts +42 -14
- package/dist/runner/snapshot-build.js +79 -47
- package/dist/runner/snapshot-choice.js +2 -1
- package/dist/runner/snapshot-inspect.d.ts +39 -40
- package/dist/runner/snapshot-inspect.js +52 -35
- package/dist/runner/snapshot-key.d.ts +32 -17
- package/dist/runner/snapshot-key.js +43 -18
- package/dist/runner/snapshot-source.d.ts +31 -0
- package/dist/runner/snapshot-source.js +122 -0
- package/dist/runner/steps.d.ts +1 -1
- package/dist/runner/steps.js +1 -1
- package/dist/runner/{recipe-check.d.ts → vercel-sandbox-check.d.ts} +4 -2
- package/dist/runner/{recipe-check.js → vercel-sandbox-check.js} +7 -2
- package/dist/runner/{recipe.d.ts → vercel-sandbox-options.d.ts} +59 -28
- package/dist/runner/{recipe.js → vercel-sandbox-options.js} +128 -84
- package/dist/runner/vercel-sandbox-secrets.d.ts +116 -0
- package/dist/runner/{recipe-secrets.js → vercel-sandbox-secrets.js} +159 -26
- package/dist/sdk/extension/credential-diagnosis.d.ts +3 -1
- package/dist/sdk/extension/credential-diagnosis.js +25 -5
- package/dist/sdk/extension/credential-source.d.ts +20 -3
- package/dist/sdk/extension/credential-source.js +4 -4
- package/dist/sdk/extension/index.d.ts +3 -2
- package/dist/sdk/extension/index.js +2 -1
- package/dist/sdk/extension/resource-definition.d.ts +1 -1
- package/dist/sdk/extension/secret-source.d.ts +1 -1
- package/dist/sdk/extension/secret-source.js +1 -1
- package/dist/sdk/extension/vercel-oidc-facts.d.ts +20 -0
- package/dist/sdk/extension/vercel-oidc-facts.js +20 -0
- package/dist/shared/cleanup.d.ts +3 -3
- package/dist/shared/cleanup.js +15 -5
- package/dist/shared/snapshot-text.d.ts +4 -4
- package/dist/shared/snapshot-text.js +11 -11
- package/dist/time/duration.js +1 -1
- package/package.json +5 -3
- package/skills/overview.md +4 -4
- package/skills/plan-runs.md +1 -1
- package/skills/read-run-output.md +6 -6
- package/dist/application.d.ts +0 -21
- package/dist/application.js +0 -30
- package/dist/chunks/chunk-7EENF73W.js +0 -782
- package/dist/chunks/chunk-Z5PBVG3Y.js +0 -2599
- package/dist/commands/exec/across-sandboxes-run.d.ts +0 -180
- package/dist/commands/exec/across-sandboxes-run.js +0 -339
- package/dist/commands/exec/plan-only.d.ts +0 -10
- package/dist/commands/exec/plan-only.js +0 -45
- package/dist/commands/exec/run-command.d.ts +0 -475
- package/dist/commands/exec/run-command.js +0 -603
- package/dist/commands/exec/run-planned.d.ts +0 -20
- package/dist/commands/exec/run-planned.js +0 -22
- package/dist/commands/exec/sandbox-view.d.ts +0 -19
- package/dist/commands/exec/sandbox-view.js +0 -72
- package/dist/commands/test/plan.d.ts +0 -92
- package/dist/commands/test/plan.js +0 -125
- package/dist/core/sandbox-end.d.ts +0 -64
- package/dist/runner/live/snapshot-cache-gateway.d.ts +0 -12
- package/dist/runner/recipe-secrets.d.ts +0 -67
- package/dist/runner/snapshot-cache.d.ts +0 -148
- package/dist/runner/snapshot-cache.js +0 -126
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
// The credential launcher resolver: how a command gets the credential source `--credential` names, and then a
|
|
2
2
|
// credential, without settling the choice or building the source itself, and the errors a source's `obtain()` refuses
|
|
3
|
-
// a command with: the mint failed (`mint_failed`),
|
|
4
|
-
// (`token_request_failed`)
|
|
5
|
-
//
|
|
6
|
-
// Clinkr and the `credential` module loads none.
|
|
3
|
+
// a command with: the mint failed (`mint_failed`), the GitHub Actions OIDC token request failed
|
|
4
|
+
// (`token_request_failed`), or reading `VERCEL_OIDC_TOKEN` failed (`vercel_oidc_token_failed`). The launcher builds
|
|
5
|
+
// it once, over its credential gateways, clock, and timer, and hands it to every command. It lives in `config`, beside
|
|
6
|
+
// the config launcher resolver, and not in `credential`, since it loads Clinkr and the `credential` module loads none.
|
|
7
7
|
import { defineErrors } from "@vercel/clinkr";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
import { credentialSourceFor, describeMintFailure, mintTargetText, REQUESTING_TOKEN_LINE, tokenRequestFailureFacts, tokenRequestFailureShape, } from "../credential/index.js";
|
|
10
|
-
import { settleCredential } from "./credential-settle.js";
|
|
9
|
+
import { credentialSourceFor, describeMintFailure, mintTargetText, REQUESTING_TOKEN_LINE, tokenRequestFailureFacts, tokenRequestFailureShape, vercelOidcTokenFailureFacts, vercelOidcTokenFailureShape, vercelProjectSource, } from "../credential/index.js";
|
|
10
|
+
import { requireTarget, settleCredential } from "./credential-settle.js";
|
|
11
11
|
/**
|
|
12
12
|
* The errors a credential source's `obtain()` refuses with. A command that obtains a credential spreads them into its
|
|
13
13
|
* outcomes.
|
|
@@ -31,12 +31,29 @@ export const credentialSourceErrors = defineErrors({
|
|
|
31
31
|
next: [{ type: "text", text: fix }],
|
|
32
32
|
}),
|
|
33
33
|
},
|
|
34
|
+
vercelOidcTokenFailed: {
|
|
35
|
+
exitCode: 1,
|
|
36
|
+
description: "With --credential vercel-oidc, VERCEL_OIDC_TOKEN is missing, empty, or not a valid Vercel project OIDC token.",
|
|
37
|
+
schema: z.object(vercelOidcTokenFailureShape),
|
|
38
|
+
render: ({ detail, fix }) => ({
|
|
39
|
+
message: `Couldn't use VERCEL_OIDC_TOKEN: ${detail}.`,
|
|
40
|
+
next: [{ type: "text", text: fix }],
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
34
43
|
});
|
|
35
44
|
/** A credential source's failure as the error `obtain()` refuses with. */
|
|
36
45
|
export function credentialSourceError(failure) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
switch (failure.source) {
|
|
47
|
+
case "mint":
|
|
48
|
+
return credentialSourceErrors.mintFailed({
|
|
49
|
+
...failure.target,
|
|
50
|
+
...describeMintFailure(failure.failure, failure.target),
|
|
51
|
+
});
|
|
52
|
+
case "github-actions":
|
|
53
|
+
return credentialSourceErrors.tokenRequestFailed(tokenRequestFailureFacts(failure.failure));
|
|
54
|
+
case "vercel-oidc":
|
|
55
|
+
return credentialSourceErrors.vercelOidcTokenFailed(vercelOidcTokenFailureFacts(failure.failure));
|
|
56
|
+
}
|
|
40
57
|
}
|
|
41
58
|
/** The credential launcher resolver over `gateways`. */
|
|
42
59
|
export function credentialResolver(gateways) {
|
|
@@ -45,16 +62,7 @@ export function credentialResolver(gateways) {
|
|
|
45
62
|
const chosen = settleCredential(choice, target.scope, target.project);
|
|
46
63
|
if (!chosen.ok)
|
|
47
64
|
return chosen;
|
|
48
|
-
const
|
|
49
|
-
// The source's events as the command's lines: one before the mint and one before each token request.
|
|
50
|
-
const source = credentialSourceFor(chosen.credential, gateways, {
|
|
51
|
-
emit: async (event) => {
|
|
52
|
-
if (event.kind === "minting")
|
|
53
|
-
await progress?.(`Minting a credential for ${mintTargetText(event.target)}…`);
|
|
54
|
-
else if (event.kind === "requesting-token")
|
|
55
|
-
await progress?.(REQUESTING_TOKEN_LINE);
|
|
56
|
-
},
|
|
57
|
-
});
|
|
65
|
+
const source = credentialSourceFor(chosen.credential, gateways, commandLines(report));
|
|
58
66
|
return {
|
|
59
67
|
ok: true,
|
|
60
68
|
source: {
|
|
@@ -66,5 +74,29 @@ export function credentialResolver(gateways) {
|
|
|
66
74
|
},
|
|
67
75
|
};
|
|
68
76
|
},
|
|
77
|
+
vercelProjectSource(choice, target, report = {}) {
|
|
78
|
+
let credential;
|
|
79
|
+
if (choice === "vercel-oidc")
|
|
80
|
+
credential = { source: choice };
|
|
81
|
+
else {
|
|
82
|
+
const required = requireTarget(target.scope, target.project);
|
|
83
|
+
if (!required.ok)
|
|
84
|
+
return required;
|
|
85
|
+
credential = { source: choice, target: required.target };
|
|
86
|
+
}
|
|
87
|
+
const { obtain } = vercelProjectSource(credential, gateways, commandLines(report));
|
|
88
|
+
return { ok: true, source: { obtain } };
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/** A credential source's events as a command's lines: one before the mint and one before each token request. */
|
|
93
|
+
function commandLines({ progress }) {
|
|
94
|
+
return {
|
|
95
|
+
emit: async (event) => {
|
|
96
|
+
if (event.kind === "minting")
|
|
97
|
+
await progress?.(`Minting a credential for ${mintTargetText(event.target)}…`);
|
|
98
|
+
else if (event.kind === "requesting-token")
|
|
99
|
+
await progress?.(REQUESTING_TOKEN_LINE);
|
|
100
|
+
},
|
|
69
101
|
};
|
|
70
102
|
}
|
|
@@ -39,10 +39,14 @@ interface GivenSetting {
|
|
|
39
39
|
export declare function requireTarget(scope: GivenSetting | undefined, project: GivenSetting | undefined): Refusable<{
|
|
40
40
|
readonly target: MintTarget;
|
|
41
41
|
}, MissingTarget>;
|
|
42
|
+
/**
|
|
43
|
+
* The control plane team and project the flags or the config file give, as a command shows them, or null when either
|
|
44
|
+
* is unset. With `--credential mint` they are the mint's target.
|
|
45
|
+
*/
|
|
46
|
+
export declare function givenTarget(scope: GivenSetting | undefined, project: GivenSetting | undefined): MintTarget | null;
|
|
42
47
|
/**
|
|
43
48
|
* The credential source `--credential` names: the mint needs the control plane team and project, refusing with
|
|
44
|
-
* `missing_target` when either is unset;
|
|
45
|
-
* unused.
|
|
49
|
+
* `missing_target` when either is unset; `github-actions` and `vercel-oidc` need neither, and leave any given unused.
|
|
46
50
|
*/
|
|
47
51
|
export declare function settleCredential(source: CredentialSourceChoice["source"], scope: GivenSetting | undefined, project: GivenSetting | undefined): Refusable<{
|
|
48
52
|
readonly credential: CredentialSourceChoice;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// How a command settles the credential source `--credential` names, before it gets a credential: the mint needs the
|
|
2
|
-
// control plane team and project, and refuses with `missing_target` without either; a GitHub Actions OIDC token
|
|
3
|
-
// needs neither.
|
|
2
|
+
// control plane team and project, and refuses with `missing_target` without either; a GitHub Actions OIDC token
|
|
3
|
+
// request or `VERCEL_OIDC_TOKEN` needs neither.
|
|
4
4
|
import { defineErrors, refused } from "@vercel/clinkr";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
/** The errors settling a credential source refuses a command with. */
|
|
@@ -34,13 +34,19 @@ export function requireTarget(scope, project) {
|
|
|
34
34
|
}));
|
|
35
35
|
return { ok: true, target: { team: scope.value, project: project.value } };
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The control plane team and project the flags or the config file give, as a command shows them, or null when either
|
|
39
|
+
* is unset. With `--credential mint` they are the mint's target.
|
|
40
|
+
*/
|
|
41
|
+
export function givenTarget(scope, project) {
|
|
42
|
+
return scope === undefined || project === undefined ? null : { team: scope.value, project: project.value };
|
|
43
|
+
}
|
|
37
44
|
/**
|
|
38
45
|
* The credential source `--credential` names: the mint needs the control plane team and project, refusing with
|
|
39
|
-
* `missing_target` when either is unset;
|
|
40
|
-
* unused.
|
|
46
|
+
* `missing_target` when either is unset; `github-actions` and `vercel-oidc` need neither, and leave any given unused.
|
|
41
47
|
*/
|
|
42
48
|
export function settleCredential(source, scope, project) {
|
|
43
|
-
if (source === "github-actions")
|
|
49
|
+
if (source === "github-actions" || source === "vercel-oidc")
|
|
44
50
|
return { ok: true, credential: { source } };
|
|
45
51
|
const required = requireTarget(scope, project);
|
|
46
52
|
if (!required.ok)
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { type CommandCredentialSource, type CredentialReport, credentialResolver, type CredentialResolver, credentialSourceError, type CredentialSourceError, credentialSourceErrors, type CredentialTarget, } from "./credential-resolver.ts";
|
|
2
|
-
export { credentialErrors, requireTarget, settleCredential } from "./credential-settle.ts";
|
|
1
|
+
export { type CommandCredentialSource, type CommandVercelProjectSource, type CredentialReport, credentialResolver, type CredentialResolver, credentialSourceError, type CredentialSourceError, credentialSourceErrors, type CredentialTarget, } from "./credential-resolver.ts";
|
|
2
|
+
export { credentialErrors, givenTarget, requireTarget, settleCredential } from "./credential-settle.ts";
|
|
3
3
|
export { configErrors, configProblemLine, optionProblemLine } from "./errors.ts";
|
|
4
4
|
export type { ConfigGateway, ConfigImport, ConfigLocation, FileListsFileGateway, FileListsFileRead, } from "./gateways.ts";
|
|
5
5
|
export { liveConfigGateway } from "./live/config-gateway.ts";
|
package/dist/config/index.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// definition's own names (`defineResource`, the option rules and helpers, the merged options' types) are the extension
|
|
7
7
|
// API's, which a caller imports from `sdk/extension/index.ts`.
|
|
8
8
|
export { credentialResolver, credentialSourceError, credentialSourceErrors, } from "./credential-resolver.js";
|
|
9
|
-
export { credentialErrors, requireTarget, settleCredential } from "./credential-settle.js";
|
|
9
|
+
export { credentialErrors, givenTarget, requireTarget, settleCredential } from "./credential-settle.js";
|
|
10
10
|
export { configErrors, configProblemLine, optionProblemLine } from "./errors.js";
|
|
11
11
|
export { liveConfigGateway } from "./live/config-gateway.js";
|
|
12
12
|
export { liveFileListsFileGateway } from "./live/file-lists-file-gateway.js";
|
package/dist/config/runner.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CheckedVercelSandboxOptions, VercelSandboxOptions } from "../runner/vercel-sandbox-options.ts";
|
|
2
2
|
/** One runner kind storm supports. */
|
|
3
3
|
export type RunnerKind = "launch-machine" | "vercel-sandbox";
|
|
4
4
|
/** The launch machine runner value, made by `launchMachine()`. */
|
|
@@ -6,18 +6,18 @@ export interface LaunchMachineRunner {
|
|
|
6
6
|
readonly kind: "launch-machine";
|
|
7
7
|
}
|
|
8
8
|
/** The Vercel Sandbox runner value, made by `vercelSandbox(options)`. */
|
|
9
|
-
export interface VercelSandboxRunner<TOptions =
|
|
9
|
+
export interface VercelSandboxRunner<TOptions = VercelSandboxOptions> {
|
|
10
10
|
readonly kind: "vercel-sandbox";
|
|
11
11
|
readonly options: TOptions;
|
|
12
12
|
}
|
|
13
13
|
/** A top-level `runner` value in `storm.config.ts`: complete Vercel Sandbox options, or the launch machine. */
|
|
14
14
|
export type RunnerConfig = LaunchMachineRunner | VercelSandboxRunner;
|
|
15
15
|
/** A suite's `runner` value in `storm.config.ts`: complete or partial Vercel Sandbox options, or the launch machine. */
|
|
16
|
-
export type SuiteRunnerConfig = LaunchMachineRunner | VercelSandboxRunner<Partial<
|
|
17
|
-
/** A checked `runner` value after loading `storm.config.ts`, with defaults filled in on
|
|
16
|
+
export type SuiteRunnerConfig = LaunchMachineRunner | VercelSandboxRunner<Partial<VercelSandboxOptions>>;
|
|
17
|
+
/** A checked `runner` value after loading `storm.config.ts`, with defaults filled in on Vercel Sandbox options. */
|
|
18
18
|
export type CheckedRunner = {
|
|
19
19
|
readonly kind: "launch-machine";
|
|
20
20
|
} | {
|
|
21
21
|
readonly kind: "vercel-sandbox";
|
|
22
|
-
readonly
|
|
22
|
+
readonly options: CheckedVercelSandboxOptions;
|
|
23
23
|
};
|
package/dist/config/runner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// The declared `runner` value in `storm.config.ts` and its checked form: two peer runner kinds, the launch machine
|
|
2
2
|
// (`launchMachine()`) and Vercel Sandbox (`vercelSandbox(options)`). Type-only so `@vercel/storm/config`'s
|
|
3
|
-
// declarations reach only `runner/
|
|
3
|
+
// declarations reach only `runner/vercel-sandbox-options.ts`, never Clinkr or zod.
|
|
4
4
|
export {};
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export interface ConfigSettings {
|
|
|
44
44
|
export type ConfigSettingKey = keyof ConfigSettings;
|
|
45
45
|
/** A top-level key of `storm.config.ts`: a setting, `resources`, or `suites`. */
|
|
46
46
|
export type ConfigKey = ConfigSettingKey | "resources" | "suites";
|
|
47
|
-
/** The keys whose checked value differs from what the file gives:
|
|
47
|
+
/** The keys whose checked value differs from what the file gives: the Vercel Sandbox runner options gain their defaults. */
|
|
48
48
|
interface CheckedSettingValues {
|
|
49
49
|
readonly runner: CheckedRunner;
|
|
50
50
|
}
|
|
@@ -56,7 +56,7 @@ export type CheckedSettings = {
|
|
|
56
56
|
};
|
|
57
57
|
/**
|
|
58
58
|
* One thing wrong with a value: the path inside the value (empty for the value itself, `["snapshot", "vcpus"]` inside
|
|
59
|
-
*
|
|
59
|
+
* the Vercel Sandbox runner options), and what is wrong, worded to follow the key (`must be …, not …`).
|
|
60
60
|
*/
|
|
61
61
|
export interface ValueProblem {
|
|
62
62
|
readonly path: readonly string[];
|
package/dist/config/schema.js
CHANGED
|
@@ -48,7 +48,7 @@ function checkDriver(value, drivers) {
|
|
|
48
48
|
}
|
|
49
49
|
/**
|
|
50
50
|
* Each top-level setting's rule. Typed against `ConfigSettings`, so a key it gains or loses, or a value type that
|
|
51
|
-
* changes, fails to compile here until its rule follows. A runner
|
|
51
|
+
* changes, fails to compile here until its rule follows. A Vercel Sandbox runner's problems name the key inside the runner options.
|
|
52
52
|
*/
|
|
53
53
|
const SETTING_CHECKS = {
|
|
54
54
|
scope: (value) => checkWith(nonEmptyString, value),
|
|
@@ -6,7 +6,7 @@ export { launchMachine, vercelSandbox } from "./runner.ts";
|
|
|
6
6
|
export { pnpmToolchains } from "./toolchain.ts";
|
|
7
7
|
export type { LaunchMachineRunner, RunnerConfig, RunnerKind, SuiteRunnerConfig, VercelSandboxRunner, } from "../config/runner.ts";
|
|
8
8
|
export type { SuiteConfig, SuiteConfigMap } from "../config/suite.ts";
|
|
9
|
-
export type { CredentialDeclaration,
|
|
9
|
+
export type { CredentialDeclaration, GhCredentialSource, GhTokenFormat, ManagedCredential, RunnerSandboxCount, RunnerStep, RunnerVcpuCount, RunnerVcpuRule, SandboxCountDefault, SandboxCountDefaultRule, SandboxCredentialSource, SnapshotSource, ToolchainStep, UnsafeSecretEnvVar, VercelSandboxOptions, } from "../runner/vercel-sandbox-options.ts";
|
|
10
10
|
export type { Resource } from "../sdk/extension/resource-definition.ts";
|
|
11
11
|
export type { SecretSource } from "../sdk/extension/secret-source.ts";
|
|
12
12
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// The config file's published surface, `@vercel/storm/config`. A user's `storm.config.ts` imports it, so it
|
|
2
2
|
// imports nothing at run time outside `src/config-file/` (`runner.ts` and `toolchain.ts`, which import nothing
|
|
3
3
|
// either): loading it pulls in no Clinkr, zod, or CLI code. Everything it takes from the modules, the top-level
|
|
4
|
-
// settings, the runner value types, the suite types, the runner
|
|
4
|
+
// settings, the runner value types, the suite types, the Vercel Sandbox runner options' types, and the resource's type, is a
|
|
5
5
|
// type-only import, erased at run time. A resource comes from its resource factory, which the config file imports from
|
|
6
6
|
// the resource's own export, `@vercel/storm/<resource>`.
|
|
7
7
|
//
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { LaunchMachineRunner, VercelSandboxRunner } from "../config/runner.ts";
|
|
2
|
-
import type {
|
|
2
|
+
import type { VercelSandboxOptions } from "../runner/vercel-sandbox-options.ts";
|
|
3
3
|
/** Declares the launch machine runner: runs the command on the launch machine as it is, with no isolation. */
|
|
4
4
|
export declare function launchMachine(): LaunchMachineRunner;
|
|
5
5
|
/**
|
|
6
|
-
* Declares the Vercel Sandbox runner with `options`. At the top level of `storm.config.ts`, `options` must be
|
|
7
|
-
*
|
|
6
|
+
* Declares the Vercel Sandbox runner with `options`. At the top level of `storm.config.ts`, `options` must be complete
|
|
7
|
+
* `VercelSandboxOptions`; in a suite under `suites`, `options` may override only the top-level option keys that
|
|
8
8
|
* differ.
|
|
9
9
|
*/
|
|
10
|
-
export declare function vercelSandbox(options:
|
|
11
|
-
export declare function vercelSandbox(options: Partial<
|
|
10
|
+
export declare function vercelSandbox(options: VercelSandboxOptions): VercelSandboxRunner;
|
|
11
|
+
export declare function vercelSandbox(options: Partial<VercelSandboxOptions>): VercelSandboxRunner<Partial<VercelSandboxOptions>>;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import type { ToolchainStep } from "../runner/
|
|
1
|
+
import type { ToolchainStep } from "../runner/vercel-sandbox-options.ts";
|
|
2
2
|
/**
|
|
3
3
|
* Node program run inside `pnpmToolchains` to read `packageManager` and `engines.node` from the staged `package.json`
|
|
4
4
|
* and print `<nodeMin> <pnpmVersion>`. Exported from this file (not `@vercel/storm/config`) so tests can run it
|
|
5
5
|
* directly without slicing the shell script.
|
|
6
6
|
*/
|
|
7
7
|
export declare const PNPM_TOOLCHAINS_MANIFEST_SCRIPT: string;
|
|
8
|
+
/**
|
|
9
|
+
* Bash snippet run at the start of `pnpmToolchains` to put `$HOME/.local/bin` first on `PATH` and persist it
|
|
10
|
+
* idempotently in `$HOME/.bash_profile` and `$HOME/.bashrc`, preserving any pre-existing `$HOME/.bash_login` or
|
|
11
|
+
* `$HOME/.profile`. Uses a storm-owned marker comment so an image's earlier `PATH` export never stops storm from
|
|
12
|
+
* appending at the end of the file. Exported from this file (not `@vercel/storm/config`) so tests can run it
|
|
13
|
+
* directly under `bash -lc` against synthetic `$HOME` fixtures.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PNPM_TOOLCHAINS_PROFILE_SCRIPT: string;
|
|
8
16
|
/**
|
|
9
17
|
* Plain-data toolchain step for a pnpm workspace whose root `package.json` declares `packageManager` (`pnpm@<x.y.z>`)
|
|
10
18
|
* and `engines.node` (`>=<x.y.z>`). storm stages `package.json` into `/vercel/sandbox/package.json` before toolchain
|
|
11
|
-
* steps run, and the script puts `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
19
|
+
* steps run, and the script puts `$HOME/.local/bin` first on `PATH` (persisting it idempotently to `$HOME/.bash_profile`
|
|
20
|
+
* and `$HOME/.bashrc` so pre-installed shims such as `~/.global/pnpm/bin` never shadow installed tools), installs `git`
|
|
21
|
+
* when absent via `dnf` or `apt-get`, downloads Node into `$HOME/.local/bin` when the image's Node is older than
|
|
22
|
+
* `engines.node`, and installs the `packageManager` pnpm through corepack. Give it as `snapshot.toolchains`, or spread
|
|
23
|
+
* it alongside other toolchain steps (`[...pnpmToolchains, ...]`).
|
|
14
24
|
*/
|
|
15
25
|
export declare const pnpmToolchains: readonly ToolchainStep[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// The toolchain steps a pnpm workspace's runner
|
|
2
|
-
// `define.ts`, it imports nothing at run time, so a config file that uses it loads no Clinkr, zod or CLI code.
|
|
1
|
+
// The toolchain steps a pnpm workspace's Vercel Sandbox runner can use, exported from `@vercel/storm/config`. Like
|
|
2
|
+
// `define.ts`, it imports nothing at run time, so a config file that uses it loads no Clinkr, zod, or CLI code.
|
|
3
3
|
/**
|
|
4
4
|
* Node program run inside `pnpmToolchains` to read `packageManager` and `engines.node` from the staged `package.json`
|
|
5
5
|
* and print `<nodeMin> <pnpmVersion>`. Exported from this file (not `@vercel/storm/config`) so tests can run it
|
|
@@ -23,12 +23,39 @@ if (node === undefined) {
|
|
|
23
23
|
}
|
|
24
24
|
process.stdout.write(node + " " + pnpm + "\n");
|
|
25
25
|
`.trim();
|
|
26
|
+
/**
|
|
27
|
+
* Bash snippet run at the start of `pnpmToolchains` to put `$HOME/.local/bin` first on `PATH` and persist it
|
|
28
|
+
* idempotently in `$HOME/.bash_profile` and `$HOME/.bashrc`, preserving any pre-existing `$HOME/.bash_login` or
|
|
29
|
+
* `$HOME/.profile`. Uses a storm-owned marker comment so an image's earlier `PATH` export never stops storm from
|
|
30
|
+
* appending at the end of the file. Exported from this file (not `@vercel/storm/config`) so tests can run it
|
|
31
|
+
* directly under `bash -lc` against synthetic `$HOME` fixtures.
|
|
32
|
+
*/
|
|
33
|
+
export const PNPM_TOOLCHAINS_PROFILE_SCRIPT = [
|
|
34
|
+
'mkdir -p "$HOME/.local/bin"',
|
|
35
|
+
'export PATH="$HOME/.local/bin:$PATH"',
|
|
36
|
+
// A login shell reads only the first of these files it finds, so a new `.bash_profile` sources the one it hides.
|
|
37
|
+
'if [ ! -f "$HOME/.bash_profile" ]; then',
|
|
38
|
+
" for STORM_LOGIN in .bash_login .profile; do",
|
|
39
|
+
' if [ -f "$HOME/$STORM_LOGIN" ]; then',
|
|
40
|
+
' printf \'[ -f "$HOME/%s" ] && . "$HOME/%s"\\n\' "$STORM_LOGIN" "$STORM_LOGIN" > "$HOME/.bash_profile"',
|
|
41
|
+
" break",
|
|
42
|
+
" fi",
|
|
43
|
+
" done",
|
|
44
|
+
"fi",
|
|
45
|
+
"STORM_LOCAL_BIN_EXPORT='export PATH=\"$HOME/.local/bin:$PATH\" # storm:local-bin'",
|
|
46
|
+
'for STORM_PROFILE in "$HOME/.bash_profile" "$HOME/.bashrc"; do',
|
|
47
|
+
' touch "$STORM_PROFILE"',
|
|
48
|
+
' grep -Fqx "$STORM_LOCAL_BIN_EXPORT" "$STORM_PROFILE" || printf \'\\n%s\\n\' "$STORM_LOCAL_BIN_EXPORT" >> "$STORM_PROFILE"',
|
|
49
|
+
"done",
|
|
50
|
+
].join("\n");
|
|
26
51
|
/**
|
|
27
52
|
* Plain-data toolchain step for a pnpm workspace whose root `package.json` declares `packageManager` (`pnpm@<x.y.z>`)
|
|
28
53
|
* and `engines.node` (`>=<x.y.z>`). storm stages `package.json` into `/vercel/sandbox/package.json` before toolchain
|
|
29
|
-
* steps run, and the script puts `
|
|
30
|
-
*
|
|
31
|
-
*
|
|
54
|
+
* steps run, and the script puts `$HOME/.local/bin` first on `PATH` (persisting it idempotently to `$HOME/.bash_profile`
|
|
55
|
+
* and `$HOME/.bashrc` so pre-installed shims such as `~/.global/pnpm/bin` never shadow installed tools), installs `git`
|
|
56
|
+
* when absent via `dnf` or `apt-get`, downloads Node into `$HOME/.local/bin` when the image's Node is older than
|
|
57
|
+
* `engines.node`, and installs the `packageManager` pnpm through corepack. Give it as `snapshot.toolchains`, or spread
|
|
58
|
+
* it alongside other toolchain steps (`[...pnpmToolchains, ...]`).
|
|
32
59
|
*/
|
|
33
60
|
export const pnpmToolchains = [
|
|
34
61
|
{
|
|
@@ -36,8 +63,17 @@ export const pnpmToolchains = [
|
|
|
36
63
|
baseFiles: ["package.json"],
|
|
37
64
|
script: [
|
|
38
65
|
"set -euo pipefail",
|
|
39
|
-
|
|
40
|
-
"command -v git >/dev/null
|
|
66
|
+
PNPM_TOOLCHAINS_PROFILE_SCRIPT,
|
|
67
|
+
"if ! command -v git >/dev/null; then",
|
|
68
|
+
" if command -v dnf >/dev/null; then",
|
|
69
|
+
" sudo dnf install -y -q git",
|
|
70
|
+
" elif command -v apt-get >/dev/null; then",
|
|
71
|
+
" sudo apt-get update -qq && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq git",
|
|
72
|
+
" else",
|
|
73
|
+
' echo "git is not installed and neither dnf nor apt-get is available" >&2',
|
|
74
|
+
" exit 1",
|
|
75
|
+
" fi",
|
|
76
|
+
"fi",
|
|
41
77
|
"git --version",
|
|
42
78
|
`STORM_TOOLCHAINS="$(node - <<'STORM_MANIFEST_EOF'\n${PNPM_TOOLCHAINS_MANIFEST_SCRIPT}\nSTORM_MANIFEST_EOF\n)"`,
|
|
43
79
|
'read -r STORM_NODE_MIN STORM_PNPM_VERSION <<< "$STORM_TOOLCHAINS"',
|
package/dist/context.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type ConfigGateway, type CredentialResolver, type FileListsFileGateway, type StormConfigResolver } from "./config/index.ts";
|
|
2
|
-
import { type CredentialGateway, type GitHubActionsTokenGateway } from "./credential/index.ts";
|
|
2
|
+
import { type CredentialGateway, type GitHubActionsTokenGateway, type VercelOidcTokenGateway } from "./credential/index.ts";
|
|
3
3
|
import type { PackageBinService } from "./launcher-resolvers/index.ts";
|
|
4
4
|
import type { Presentation } from "./presentation.ts";
|
|
5
5
|
import type { RESOURCES, StormDriverContextMap, StormResourceContextMap } from "./extensions.ts";
|
|
6
6
|
import { type CommandGateway, type JobSummaryGateway, type PackageBinGateway, type ProgressTerminal } from "./core/index.ts";
|
|
7
7
|
import { type RunDirectoryGateway } from "./run-directory/index.ts";
|
|
8
|
-
import { type CheckoutGateway, type RunnerSandboxGateway, type
|
|
8
|
+
import { type CheckoutGateway, type GhTokenGateway, type RunnerSandboxGateway, type RunnerSnapshotIndexGateway, type RunnerTerminal } from "./runner/index.ts";
|
|
9
9
|
import { type Clock, type Timer } from "./time/index.ts";
|
|
10
10
|
/**
|
|
11
11
|
* The gateways and DI seams storm's commands reach the outside through. Each resource reaches it through its own
|
|
@@ -16,14 +16,18 @@ export interface StormContext {
|
|
|
16
16
|
readonly credentials: CredentialGateway;
|
|
17
17
|
/** GitHub Actions' OIDC token issuer, for `--credential github-actions`. */
|
|
18
18
|
readonly githubActionsTokens: GitHubActionsTokenGateway;
|
|
19
|
+
/** `VERCEL_OIDC_TOKEN` reader, for `--credential vercel-oidc`. */
|
|
20
|
+
readonly vercelOidcTokens: VercelOidcTokenGateway;
|
|
19
21
|
readonly commands: CommandGateway;
|
|
20
22
|
readonly config: ConfigGateway;
|
|
21
23
|
/** The file lists file a run's `--file-lists` names. */
|
|
22
24
|
readonly fileListsFiles: FileListsFileGateway;
|
|
23
25
|
/** The local Git checkout the runner uploads from. */
|
|
24
26
|
readonly checkout: CheckoutGateway;
|
|
25
|
-
/**
|
|
26
|
-
readonly
|
|
27
|
+
/** Reads a GitHub token via `gh auth token` for `{ kind: "gh" }` sandbox credentials. */
|
|
28
|
+
readonly ghTokens: GhTokenGateway;
|
|
29
|
+
/** The per-machine local snapshot index. */
|
|
30
|
+
readonly runnerSnapshots: RunnerSnapshotIndexGateway;
|
|
27
31
|
/** Vercel Sandbox, where runner and build sandboxes run. */
|
|
28
32
|
readonly runnerSandboxes: RunnerSandboxGateway;
|
|
29
33
|
/** The terminal the command's output reaches, wherever the command runs. */
|
|
@@ -113,9 +117,9 @@ export declare function localServices(launcher: {
|
|
|
113
117
|
* The live Context: `vercel` for credentials, and for `--credential github-actions` GitHub Actions' token request, read
|
|
114
118
|
* from `env`'s `ACTIONS_ID_TOKEN_REQUEST_*` at each request, with a 10-second timeout; the command spawned as a
|
|
115
119
|
* real process; `storm.config.ts`
|
|
116
|
-
* imported by Node; for the runner, git and tar on the local checkout, the
|
|
120
|
+
* imported by Node; for the runner, git and tar on the local checkout, the local snapshot index under `env`'s
|
|
117
121
|
* `XDG_STATE_HOME` or `HOME`, Vercel Sandbox through `@vercel/sandbox` (loaded only when the runner first calls it) and
|
|
118
|
-
* this process's stdout and stderr; the run directories beside the
|
|
122
|
+
* this process's stdout and stderr; the run directories beside the local snapshot index; the live view on this
|
|
119
123
|
* process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any; a package's binary found in
|
|
120
124
|
* `node_modules/.bin`; and the system timer and clock. When `env` names no place for the state directory, every runner
|
|
121
125
|
* snapshot cache operation fails and says why, which a run treats as an empty cache, and so does opening a run
|
package/dist/context.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Context (`liveResourceContexts`, through the registry), and each driver its own (`liveDriverContexts`), which the app
|
|
3
3
|
// holds beside the context, so this file names no resource and no driver's gateway.
|
|
4
4
|
import { configResolver, credentialResolver, liveConfigGateway, liveFileListsFileGateway, } from "./config/index.js";
|
|
5
|
-
import { liveCredentialGateway, liveGitHubActionsTokenGateway, } from "./credential/index.js";
|
|
5
|
+
import { liveCredentialGateway, liveGitHubActionsTokenGateway, liveVercelOidcTokenGateway, } from "./credential/index.js";
|
|
6
6
|
import { packageBinService } from "./local-services.js";
|
|
7
7
|
import { liveCommandGateway, liveJobSummaryGateway, livePackageBinGateway, liveProgressTerminal, resolveStateDirectory, stateDirectoryPattern, } from "./core/index.js";
|
|
8
8
|
import { liveRunDirectoryGateway, RUNS_SUBPATH, unavailableRunDirectoryGateway, } from "./run-directory/index.js";
|
|
9
|
-
import { liveCheckoutGateway, liveRunnerSandboxGateway,
|
|
9
|
+
import { liveCheckoutGateway, liveGhTokenGateway, liveRunnerSandboxGateway, liveRunnerSnapshotIndexGateway, liveRunnerTerminal, RUNNER_SNAPSHOTS_SUBPATH, unavailableRunnerSnapshotIndexGateway, } from "./runner/index.js";
|
|
10
10
|
import { systemClock, systemTimer } from "./time/index.js";
|
|
11
11
|
/**
|
|
12
12
|
* The launcher resolvers over an app's context, from its working directory, checking the file against every resource
|
|
@@ -31,9 +31,9 @@ export function localServices(launcher) {
|
|
|
31
31
|
* The live Context: `vercel` for credentials, and for `--credential github-actions` GitHub Actions' token request, read
|
|
32
32
|
* from `env`'s `ACTIONS_ID_TOKEN_REQUEST_*` at each request, with a 10-second timeout; the command spawned as a
|
|
33
33
|
* real process; `storm.config.ts`
|
|
34
|
-
* imported by Node; for the runner, git and tar on the local checkout, the
|
|
34
|
+
* imported by Node; for the runner, git and tar on the local checkout, the local snapshot index under `env`'s
|
|
35
35
|
* `XDG_STATE_HOME` or `HOME`, Vercel Sandbox through `@vercel/sandbox` (loaded only when the runner first calls it) and
|
|
36
|
-
* this process's stdout and stderr; the run directories beside the
|
|
36
|
+
* this process's stdout and stderr; the run directories beside the local snapshot index; the live view on this
|
|
37
37
|
* process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any; a package's binary found in
|
|
38
38
|
* `node_modules/.bin`; and the system timer and clock. When `env` names no place for the state directory, every runner
|
|
39
39
|
* snapshot cache operation fails and says why, which a run treats as an empty cache, and so does opening a run
|
|
@@ -45,13 +45,15 @@ export function liveContext(options) {
|
|
|
45
45
|
return {
|
|
46
46
|
credentials: liveCredentialGateway(),
|
|
47
47
|
githubActionsTokens: liveGitHubActionsTokenGateway({ env: options.env, timeoutMs: 10_000 }),
|
|
48
|
+
vercelOidcTokens: liveVercelOidcTokenGateway({ env: options.env }),
|
|
48
49
|
commands: liveCommandGateway(),
|
|
49
50
|
config: liveConfigGateway(),
|
|
50
51
|
fileListsFiles: liveFileListsFileGateway(),
|
|
51
52
|
checkout: liveCheckoutGateway(),
|
|
53
|
+
ghTokens: liveGhTokenGateway({ env: options.env }),
|
|
52
54
|
runnerSnapshots: snapshots.ok
|
|
53
|
-
?
|
|
54
|
-
:
|
|
55
|
+
? liveRunnerSnapshotIndexGateway({ directory: snapshots.directory })
|
|
56
|
+
: unavailableRunnerSnapshotIndexGateway(stateDirectoryPattern(RUNNER_SNAPSHOTS_SUBPATH), snapshots.reason),
|
|
55
57
|
runnerSandboxes: liveRunnerSandboxGateway(),
|
|
56
58
|
runnerTerminal: liveRunnerTerminal({
|
|
57
59
|
env: options.env,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type RunnerTerminal } from "../runner/index.ts";
|
|
2
|
+
import { type RunContext, type RunControl, type RunnerCredentialChoice, type RunRunnerRequest } from "./coordinator.ts";
|
|
2
3
|
import type { RunProgress } from "./events.ts";
|
|
4
|
+
import { type AcrossSandboxesOutcome } from "./outcomes.ts";
|
|
3
5
|
import { type ResourceDefinitionSet } from "./resource-definition-set.ts";
|
|
4
6
|
import type { ResourceContextMap, ResourceRequests, ResourceSkip } from "./resource.ts";
|
|
5
|
-
import { type RunContext, type RunControl, type RunRunnerRequest } from "./run.ts";
|
|
6
|
-
import { type AcrossSandboxesOutcome } from "./sandbox-end.ts";
|
|
7
7
|
/** One runner sandbox's command and optional test file list. */
|
|
8
8
|
export interface SandboxCommand {
|
|
9
9
|
readonly argv: readonly string[];
|
|
@@ -22,6 +22,8 @@ export interface AcrossSandboxesRequest {
|
|
|
22
22
|
*/
|
|
23
23
|
readonly sandboxes: readonly SandboxCommand[];
|
|
24
24
|
readonly resources: ResourceRequests;
|
|
25
|
+
/** The credential source the run uses for the runner sandboxes and its resources (`mint` or `vercel-oidc`). */
|
|
26
|
+
readonly credential: RunnerCredentialChoice;
|
|
25
27
|
readonly skipped?: readonly ResourceSkip[];
|
|
26
28
|
}
|
|
27
29
|
/** The gateways and seams a run across runner sandboxes reaches the outside through. */
|
|
@@ -32,10 +34,9 @@ export interface AcrossSandboxesContext extends RunContext {
|
|
|
32
34
|
/**
|
|
33
35
|
* Runs a run across runner sandboxes (`request.sandboxes`) with the resources it asks for (`request.resources`).
|
|
34
36
|
*
|
|
35
|
-
* -
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* runner snapshot failure, then resource refusal.
|
|
37
|
+
* - Opening, credential obtainment, snapshot choice, resource acquire/split, and final release run once for the run.
|
|
38
|
+
* - Snapshot choice and resource acquire/split run concurrently under `coordinateSetup`; sandboxes start readying from
|
|
39
|
+
* the chosen snapshot while resources finish acquiring and splitting.
|
|
39
40
|
* - One runner sandbox's failure or throw never stops the others.
|
|
40
41
|
* - `snapshot_gone` ends the run with `snapshot_gone` only when every runner sandbox reports it; partial
|
|
41
42
|
* `snapshot_gone` ends as `sandboxes_ran` with affected runner sandboxes `not-started`.
|