@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,12 +1,17 @@
|
|
|
1
|
-
// Secret declarations on a runner
|
|
2
|
-
// and `runner.unsafeSecretEnvVars` (environment variables exposed to the command alone).
|
|
3
|
-
// `
|
|
1
|
+
// Secret declarations on a Vercel Sandbox runner: `runner.credentials` (sandbox credentials injected by the Sandbox
|
|
2
|
+
// firewall) and `runner.unsafeSecretEnvVars` (environment variables exposed to the command alone).
|
|
3
|
+
// `vercel-sandbox-options.ts` coordinates `checkVercelSandboxOptions` and delegates both secret keys here.
|
|
4
4
|
import { ENV_VAR_NAME_PATTERN, ENV_VAR_NAME_RULE, secretSourceId } from "../sdk/extension/index.js";
|
|
5
5
|
import { RUN_PAYLOAD_VARIABLE } from "../sdk/run/launcher.js";
|
|
6
|
-
import {
|
|
6
|
+
import { DEFAULT_GH_HOST } from "./gh.js";
|
|
7
|
+
import { describeOptionValue, reportUnknownKeys } from "./vercel-sandbox-check.js";
|
|
7
8
|
const CREDENTIAL_KEYS = new Set(["domain", "header", "source", "requests"]);
|
|
9
|
+
const MANAGED_CREDENTIALS = new Set(["npm"]);
|
|
10
|
+
/** The default npm registry domain whose `authorization` header conflicts with Vercel-managed npm credentials. */
|
|
11
|
+
const MANAGED_NPM_DOMAIN = "registry.npmjs.org";
|
|
8
12
|
const UNSAFE_SECRET_ENV_VAR_KEYS = new Set(["name", "source"]);
|
|
9
13
|
const ENV_SOURCE_KEYS = new Set(["kind", "name"]);
|
|
14
|
+
const GH_SOURCE_KEYS = new Set(["kind", "env", "host", "format"]);
|
|
10
15
|
/** The header a credential goes to when it names none. */
|
|
11
16
|
const DEFAULT_CREDENTIAL_HEADER = "authorization";
|
|
12
17
|
/** A bare hostname: dot-separated labels of lowercase letters, digits, and inner hyphens, at least two of them. */
|
|
@@ -38,11 +43,78 @@ const RESERVED_UNSAFE_SECRET_ENV_VAR_NAMES = new Set([
|
|
|
38
43
|
/** Prefixes of the dynamic loader's variables, which an unsafe secret environment variable's name can't start with. */
|
|
39
44
|
const RESERVED_UNSAFE_SECRET_ENV_VAR_PREFIXES = ["LD_", "DYLD_"];
|
|
40
45
|
/**
|
|
41
|
-
*
|
|
42
|
-
*
|
|
46
|
+
* A stable, value-free identity string for one `SandboxCredentialSource`, for hashing into runner snapshot keys:
|
|
47
|
+
* `"env:<name>"` for `{ kind: "env", name }`, and `"gh[:host=<host>][:env=<NAME>][:format=<format>]"` for
|
|
48
|
+
* `{ kind: "gh" }` (omitting `host` when it is the default `"github.com"`). Never contains secret values or file
|
|
49
|
+
* paths.
|
|
43
50
|
*/
|
|
44
|
-
export function
|
|
45
|
-
|
|
51
|
+
export function sandboxCredentialSourceId(source) {
|
|
52
|
+
switch (source.kind) {
|
|
53
|
+
case "env":
|
|
54
|
+
return secretSourceId(source);
|
|
55
|
+
case "gh": {
|
|
56
|
+
const parts = ["gh"];
|
|
57
|
+
if (source.host !== undefined && source.host !== DEFAULT_GH_HOST)
|
|
58
|
+
parts.push(`host=${source.host}`);
|
|
59
|
+
if (source.env !== undefined)
|
|
60
|
+
parts.push(`env=${source.env}`);
|
|
61
|
+
if (source.format !== undefined)
|
|
62
|
+
parts.push(`format=${source.format}`);
|
|
63
|
+
return parts.join(":");
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* The sorted, unique sandbox credential source identities checked runner options' credentials and managed credentials
|
|
69
|
+
* read from (such as `"env:NPM_AUTH"`, `"gh"`, or `"managed:npm"`), for hashing into the runner snapshot key.
|
|
70
|
+
*/
|
|
71
|
+
export function credentialSourceIds(options) {
|
|
72
|
+
return [
|
|
73
|
+
...new Set([
|
|
74
|
+
...options.credentials.map(({ source }) => sandboxCredentialSourceId(source)),
|
|
75
|
+
...(options.managedCredentials ?? []).map((provider) => `managed:${provider}`),
|
|
76
|
+
]),
|
|
77
|
+
].toSorted();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Validates `runner.managedCredentials`: a list of distinct supported Vercel-managed credential providers (today
|
|
81
|
+
* `"npm"`). Refuses combining `"npm"` with a `runner.credentials` entry setting `authorization` on
|
|
82
|
+
* `registry.npmjs.org`, because a custom domain rule overrides the Vercel-managed npm header.
|
|
83
|
+
*/
|
|
84
|
+
export function checkManagedCredentials(value, credentials, report) {
|
|
85
|
+
if (value === undefined)
|
|
86
|
+
return [];
|
|
87
|
+
if (!Array.isArray(value)) {
|
|
88
|
+
report(["managedCredentials"], `must be a list of Vercel-managed credentials, such as ["npm"], not ${describeOptionValue(value)}`);
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
let ok = true;
|
|
92
|
+
const checked = [];
|
|
93
|
+
const seen = new Set();
|
|
94
|
+
value.forEach((entry, index) => {
|
|
95
|
+
const path = ["managedCredentials", String(index)];
|
|
96
|
+
if (typeof entry !== "string" || !MANAGED_CREDENTIALS.has(entry)) {
|
|
97
|
+
report(path, `must be "npm", not ${describeOptionValue(entry)}`);
|
|
98
|
+
ok = false;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (seen.has(entry)) {
|
|
102
|
+
report(path, `names ${entry} again`);
|
|
103
|
+
ok = false;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
seen.add(entry);
|
|
107
|
+
checked.push(entry);
|
|
108
|
+
});
|
|
109
|
+
if (checked.includes("npm") && credentials !== undefined) {
|
|
110
|
+
credentials.forEach((credential, index) => {
|
|
111
|
+
if (credential.domain === MANAGED_NPM_DOMAIN && credential.header === DEFAULT_CREDENTIAL_HEADER) {
|
|
112
|
+
report(["credentials", String(index)], `can't set ${DEFAULT_CREDENTIAL_HEADER} on ${MANAGED_NPM_DOMAIN} when runner.managedCredentials includes "npm": a sandbox credential on ${MANAGED_NPM_DOMAIN} overrides the Vercel-managed npm token`);
|
|
113
|
+
ok = false;
|
|
114
|
+
}
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
return ok ? checked : undefined;
|
|
46
118
|
}
|
|
47
119
|
/**
|
|
48
120
|
* The sandbox credentials: a list of `{ domain, header?, source, requests? }` (`checkCredential`), with no two going
|
|
@@ -54,7 +126,7 @@ export function checkCredentials(value, report) {
|
|
|
54
126
|
if (value === undefined)
|
|
55
127
|
return [];
|
|
56
128
|
if (!Array.isArray(value)) {
|
|
57
|
-
report(["credentials"], `must be a list of credentials, each { domain, header?, source, requests? }, not ${
|
|
129
|
+
report(["credentials"], `must be a list of credentials, each { domain, header?, source, requests? }, not ${describeOptionValue(value)}`);
|
|
58
130
|
return undefined;
|
|
59
131
|
}
|
|
60
132
|
let ok = true;
|
|
@@ -89,35 +161,43 @@ export function checkCredentials(value, report) {
|
|
|
89
161
|
}
|
|
90
162
|
/**
|
|
91
163
|
* One credential: `domain`, a bare hostname (`HOST_PATTERN`); `header`, an HTTP field name that neither the firewall
|
|
92
|
-
* nor HTTP sets (`REFUSED_HEADERS`), lowercased, `authorization` when absent
|
|
93
|
-
*
|
|
164
|
+
* nor HTTP sets (`REFUSED_HEADERS`), lowercased, `authorization` when absent (and required to be `authorization` for
|
|
165
|
+
* `{ kind: "gh" }`); `source`, a `SandboxCredentialSource` (`{ kind: "env", name }` or
|
|
166
|
+
* `{ kind: "gh", env?, host?, format? }`); and `requests`, `read` or `all`, `read` when absent.
|
|
94
167
|
*/
|
|
95
168
|
function checkCredential(value, path, report) {
|
|
96
169
|
if (!isPlainObject(value)) {
|
|
97
|
-
report(path, `must be { domain, header?, source, requests? }, not ${
|
|
170
|
+
report(path, `must be { domain, header?, source, requests? }, not ${describeOptionValue(value)}`);
|
|
98
171
|
return undefined;
|
|
99
172
|
}
|
|
100
173
|
let ok = reportUnknownKeys(value, CREDENTIAL_KEYS, path, "a credential key", report);
|
|
101
174
|
const domain = value["domain"];
|
|
102
175
|
if (typeof domain !== "string" || !HOST_PATTERN.test(domain)) {
|
|
103
|
-
report([...path, "domain"], `must be a bare hostname, such as registry.example.com: lowercase letters, digits, dots, and hyphens, with at least one dot, and no scheme, port, path, or wildcard, not ${
|
|
176
|
+
report([...path, "domain"], `must be a bare hostname, such as registry.example.com: lowercase letters, digits, dots, and hyphens, with at least one dot, and no scheme, port, path, or wildcard, not ${describeOptionValue(domain)}`);
|
|
104
177
|
ok = false;
|
|
105
178
|
}
|
|
106
179
|
const header = value["header"] === undefined ? DEFAULT_CREDENTIAL_HEADER : value["header"];
|
|
180
|
+
let headerValid = true;
|
|
107
181
|
if (typeof header !== "string" || !HEADER_PATTERN.test(header)) {
|
|
108
|
-
report([...path, "header"], `must be an HTTP header name, such as authorization, not ${
|
|
182
|
+
report([...path, "header"], `must be an HTTP header name, such as authorization, not ${describeOptionValue(header)}`);
|
|
109
183
|
ok = false;
|
|
184
|
+
headerValid = false;
|
|
110
185
|
}
|
|
111
186
|
else if (REFUSED_HEADERS.has(header.toLowerCase())) {
|
|
112
187
|
report([...path, "header"], `can't be ${header}: the firewall or HTTP sets it`);
|
|
113
188
|
ok = false;
|
|
189
|
+
headerValid = false;
|
|
114
190
|
}
|
|
115
|
-
const source =
|
|
191
|
+
const source = checkSandboxCredentialSource(value["source"], [...path, "source"], report);
|
|
116
192
|
if (source === undefined)
|
|
117
193
|
ok = false;
|
|
194
|
+
else if (headerValid && source.kind === "gh" && header.toLowerCase() !== DEFAULT_CREDENTIAL_HEADER) {
|
|
195
|
+
report([...path, "header"], `can't be ${header}: a gh credential always sets the authorization header`);
|
|
196
|
+
ok = false;
|
|
197
|
+
}
|
|
118
198
|
const requests = value["requests"] === undefined ? "read" : value["requests"];
|
|
119
199
|
if (requests !== "read" && requests !== "all") {
|
|
120
|
-
report([...path, "requests"], `must be "read" or "all", not ${
|
|
200
|
+
report([...path, "requests"], `must be "read" or "all", not ${describeOptionValue(requests)}`);
|
|
121
201
|
ok = false;
|
|
122
202
|
}
|
|
123
203
|
return ok && source !== undefined
|
|
@@ -129,30 +209,76 @@ function checkCredential(value, path, report) {
|
|
|
129
209
|
}
|
|
130
210
|
: undefined;
|
|
131
211
|
}
|
|
212
|
+
/** One sandbox credential source: `{ kind: "env", name }` or `{ kind: "gh", env?, host?, format? }`. */
|
|
213
|
+
function checkSandboxCredentialSource(value, path, report) {
|
|
214
|
+
if (!isPlainObject(value)) {
|
|
215
|
+
report(path, `must be a sandbox credential source, { kind: "env", name } or { kind: "gh", env?, host?, format? }, not ${describeOptionValue(value)}`);
|
|
216
|
+
return undefined;
|
|
217
|
+
}
|
|
218
|
+
const kind = value["kind"];
|
|
219
|
+
if (kind === "env") {
|
|
220
|
+
return checkEnvSecretSource(value, path, report);
|
|
221
|
+
}
|
|
222
|
+
if (kind === "gh") {
|
|
223
|
+
return checkGhCredentialSource(value, path, report);
|
|
224
|
+
}
|
|
225
|
+
report([...path, "kind"], `must be "env" or "gh", not ${describeOptionValue(kind)}`);
|
|
226
|
+
return undefined;
|
|
227
|
+
}
|
|
228
|
+
/** Validates `{ kind: "gh", env?, host?, format? }`. */
|
|
229
|
+
function checkGhCredentialSource(value, path, report) {
|
|
230
|
+
let ok = reportUnknownKeys(value, GH_SOURCE_KEYS, path, "a sandbox credential source key", report);
|
|
231
|
+
const env = value["env"];
|
|
232
|
+
if (env !== undefined && (typeof env !== "string" || !ENV_VAR_NAME_PATTERN.test(env))) {
|
|
233
|
+
report([...path, "env"], `must be ${ENV_VAR_NAME_RULE}, not ${describeOptionValue(env)}`);
|
|
234
|
+
ok = false;
|
|
235
|
+
}
|
|
236
|
+
const host = value["host"];
|
|
237
|
+
if (host !== undefined && (typeof host !== "string" || !HOST_PATTERN.test(host))) {
|
|
238
|
+
report([...path, "host"], `must be a bare hostname, such as github.com: lowercase letters, digits, dots, and hyphens, with at least one dot, and no scheme, port, path, or wildcard, not ${describeOptionValue(host)}`);
|
|
239
|
+
ok = false;
|
|
240
|
+
}
|
|
241
|
+
const format = value["format"];
|
|
242
|
+
if (format !== undefined && format !== "basic" && format !== "bearer") {
|
|
243
|
+
report([...path, "format"], `must be "basic" or "bearer", not ${describeOptionValue(format)}`);
|
|
244
|
+
ok = false;
|
|
245
|
+
}
|
|
246
|
+
if (!ok)
|
|
247
|
+
return undefined;
|
|
248
|
+
return {
|
|
249
|
+
kind: "gh",
|
|
250
|
+
...(env === undefined ? {} : { env: env }),
|
|
251
|
+
...(host === undefined ? {} : { host: host }),
|
|
252
|
+
...(format === undefined ? {} : { format: format }),
|
|
253
|
+
};
|
|
254
|
+
}
|
|
132
255
|
/** One secret source: a plain object with exact keys `{ kind: "env", name: <environment variable name> }`. */
|
|
133
256
|
function checkSecretSource(value, path, report) {
|
|
134
257
|
if (!isPlainObject(value)) {
|
|
135
|
-
report(path, `must be a secret source, { kind: "env", name }, not ${
|
|
258
|
+
report(path, `must be a secret source, { kind: "env", name }, not ${describeOptionValue(value)}`);
|
|
136
259
|
return undefined;
|
|
137
260
|
}
|
|
138
261
|
const kind = value["kind"];
|
|
139
262
|
if (kind !== "env") {
|
|
140
|
-
report([...path, "kind"], `must be "env", not ${
|
|
263
|
+
report([...path, "kind"], `must be "env", not ${describeOptionValue(kind)}`);
|
|
141
264
|
if (kind !== undefined)
|
|
142
265
|
return undefined;
|
|
143
266
|
}
|
|
144
|
-
|
|
267
|
+
return checkEnvSecretSource(value, path, report, kind === "env");
|
|
268
|
+
}
|
|
269
|
+
function checkEnvSecretSource(value, path, report, kindOk = true) {
|
|
270
|
+
let ok = kindOk;
|
|
145
271
|
if (!reportUnknownKeys(value, ENV_SOURCE_KEYS, path, "a secret source key", report))
|
|
146
272
|
ok = false;
|
|
147
273
|
const name = value["name"];
|
|
148
274
|
if (typeof name !== "string" || !ENV_VAR_NAME_PATTERN.test(name)) {
|
|
149
|
-
report([...path, "name"], `must be ${ENV_VAR_NAME_RULE}, not ${
|
|
275
|
+
report([...path, "name"], `must be ${ENV_VAR_NAME_RULE}, not ${describeOptionValue(name)}`);
|
|
150
276
|
ok = false;
|
|
151
277
|
}
|
|
152
278
|
return ok ? { kind: "env", name: name } : undefined;
|
|
153
279
|
}
|
|
154
280
|
/**
|
|
155
|
-
* The
|
|
281
|
+
* The runner's `unsafeSecretEnvVars`: a list of `{ name, source }` plain objects, each exposing a distinct environment
|
|
156
282
|
* variable `name` that neither storm sets for the command (`STORM_RUN`, `RESERVED_UNSAFE_SECRET_ENV_VAR_NAMES`,
|
|
157
283
|
* `LD_*`, `DYLD_*`) nor `runner.env` sets, read from a `SecretSource` that `runner.credentials` doesn't already read.
|
|
158
284
|
*/
|
|
@@ -160,17 +286,24 @@ export function checkUnsafeSecretEnvVars(value, env, credentials, report) {
|
|
|
160
286
|
if (value === undefined)
|
|
161
287
|
return [];
|
|
162
288
|
if (!Array.isArray(value)) {
|
|
163
|
-
report(["unsafeSecretEnvVars"], `must be a list of unsafe secret environment variables, each { name, source }, not ${
|
|
289
|
+
report(["unsafeSecretEnvVars"], `must be a list of unsafe secret environment variables, each { name, source }, not ${describeOptionValue(value)}`);
|
|
164
290
|
return undefined;
|
|
165
291
|
}
|
|
166
292
|
let ok = true;
|
|
167
293
|
const checked = [];
|
|
168
294
|
const seen = new Set();
|
|
169
|
-
const
|
|
295
|
+
const credentialEnvSources = new Set((credentials ?? []).flatMap(({ source }) => {
|
|
296
|
+
switch (source.kind) {
|
|
297
|
+
case "env":
|
|
298
|
+
return [secretSourceId(source)];
|
|
299
|
+
case "gh":
|
|
300
|
+
return source.env === undefined ? [] : [`env:${source.env}`];
|
|
301
|
+
}
|
|
302
|
+
}));
|
|
170
303
|
value.forEach((entry, index) => {
|
|
171
304
|
const path = ["unsafeSecretEnvVars", String(index)];
|
|
172
305
|
if (!isPlainObject(entry)) {
|
|
173
|
-
report(path, `must be { name, source }, not ${
|
|
306
|
+
report(path, `must be { name, source }, not ${describeOptionValue(entry)}`);
|
|
174
307
|
ok = false;
|
|
175
308
|
return;
|
|
176
309
|
}
|
|
@@ -178,7 +311,7 @@ export function checkUnsafeSecretEnvVars(value, env, credentials, report) {
|
|
|
178
311
|
const name = entry["name"];
|
|
179
312
|
const namePath = [...path, "name"];
|
|
180
313
|
if (typeof name !== "string" || !ENV_VAR_NAME_PATTERN.test(name)) {
|
|
181
|
-
report(namePath, `must be ${ENV_VAR_NAME_RULE}, not ${
|
|
314
|
+
report(namePath, `must be ${ENV_VAR_NAME_RULE}, not ${describeOptionValue(name)}`);
|
|
182
315
|
entryOk = false;
|
|
183
316
|
}
|
|
184
317
|
else if (name === RUN_PAYLOAD_VARIABLE) {
|
|
@@ -207,7 +340,7 @@ export function checkUnsafeSecretEnvVars(value, env, credentials, report) {
|
|
|
207
340
|
if (source === undefined) {
|
|
208
341
|
entryOk = false;
|
|
209
342
|
}
|
|
210
|
-
else if (
|
|
343
|
+
else if (credentialEnvSources.has(secretSourceId(source))) {
|
|
211
344
|
report([...path, "source"], `can't use ${secretSourceId(source)}: runner.credentials already reads it`);
|
|
212
345
|
entryOk = false;
|
|
213
346
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CredentialFailure, MintFailure, MintTarget, TokenRequestFailure } from "./credential-source.ts";
|
|
1
|
+
import type { CredentialFailure, MintFailure, MintTarget, TokenRequestFailure, VercelOidcTokenFailure } from "./credential-source.ts";
|
|
2
2
|
/** One cause and one fix for a credential source's failure, worded for the person running storm. */
|
|
3
3
|
export interface CredentialDiagnosis {
|
|
4
4
|
readonly cause: string;
|
|
@@ -8,5 +8,7 @@ export interface CredentialDiagnosis {
|
|
|
8
8
|
export declare function describeMintFailure(failure: MintFailure, target: MintTarget): CredentialDiagnosis;
|
|
9
9
|
/** Names the cause of a failed GitHub Actions OIDC token request and the one fix for it. */
|
|
10
10
|
export declare function describeTokenRequestFailure(failure: TokenRequestFailure): CredentialDiagnosis;
|
|
11
|
+
/** Names the cause of a failed `VERCEL_OIDC_TOKEN` read and the one fix for it. */
|
|
12
|
+
export declare function describeVercelOidcTokenFailure(failure: VercelOidcTokenFailure): CredentialDiagnosis;
|
|
11
13
|
/** Names the cause of a credential source's failure and the one fix for it, for whichever source it was. */
|
|
12
14
|
export declare function describeCredentialFailure(failure: CredentialFailure): CredentialDiagnosis;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// How a credential source's failure is worded for the person running storm: one cause and one fix, for a failed mint
|
|
2
|
-
//
|
|
1
|
+
// How a credential source's failure is worded for the person running storm: one cause and one fix, for a failed mint,
|
|
2
|
+
// a failed GitHub Actions OIDC token request, or an unreadable `VERCEL_OIDC_TOKEN`.
|
|
3
3
|
/** Names the cause of a failed mint and the one fix for it. */
|
|
4
4
|
export function describeMintFailure(failure, target) {
|
|
5
5
|
const loginStep = `\`vercel login\` with an account on the \`${target.team}\` team`;
|
|
@@ -79,11 +79,31 @@ export function describeTokenRequestFailure(failure) {
|
|
|
79
79
|
return { cause: `GitHub's answer to the token request held no token: ${last.said}`, fix };
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
+
/** Names the cause of a failed `VERCEL_OIDC_TOKEN` read and the one fix for it. */
|
|
83
|
+
export function describeVercelOidcTokenFailure(failure) {
|
|
84
|
+
switch (failure.kind) {
|
|
85
|
+
case "missing-token":
|
|
86
|
+
return {
|
|
87
|
+
cause: "`VERCEL_OIDC_TOKEN` is not set or is empty",
|
|
88
|
+
fix: "Set `VERCEL_OIDC_TOKEN` to a Vercel project OIDC token (for example, from `vercel project token` or Vercel OIDC in CI), or use `--credential mint`, then retry.",
|
|
89
|
+
};
|
|
90
|
+
case "invalid-token":
|
|
91
|
+
return {
|
|
92
|
+
cause: "`VERCEL_OIDC_TOKEN` is not a valid Vercel project OIDC token (expected a JWT with `owner_id` and `project_id` claims)",
|
|
93
|
+
fix: "Set `VERCEL_OIDC_TOKEN` to a Vercel project OIDC token from `vercel project token` or Vercel OIDC, then retry.",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
82
97
|
/** Names the cause of a credential source's failure and the one fix for it, for whichever source it was. */
|
|
83
98
|
export function describeCredentialFailure(failure) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
99
|
+
switch (failure.source) {
|
|
100
|
+
case "mint":
|
|
101
|
+
return describeMintFailure(failure.failure, failure.target);
|
|
102
|
+
case "github-actions":
|
|
103
|
+
return describeTokenRequestFailure(failure.failure);
|
|
104
|
+
case "vercel-oidc":
|
|
105
|
+
return describeVercelOidcTokenFailure(failure.failure);
|
|
106
|
+
}
|
|
87
107
|
}
|
|
88
108
|
function variablesText(missing) {
|
|
89
109
|
return missing.map((name) => `\`${name}\``).join(" and ");
|
|
@@ -92,6 +92,18 @@ export type TokenRequestFailure = {
|
|
|
92
92
|
readonly kind: "variables-missing";
|
|
93
93
|
}>;
|
|
94
94
|
};
|
|
95
|
+
/**
|
|
96
|
+
* Why reading a Vercel OIDC token from `VERCEL_OIDC_TOKEN` failed. Never carries the raw token.
|
|
97
|
+
*
|
|
98
|
+
* - `missing-token`: `VERCEL_OIDC_TOKEN` is unset or empty.
|
|
99
|
+
* - `invalid-token`: `VERCEL_OIDC_TOKEN` is not a valid Vercel project OIDC token (a JWT with `owner_id` and
|
|
100
|
+
* `project_id` claims).
|
|
101
|
+
*/
|
|
102
|
+
export type VercelOidcTokenFailure = {
|
|
103
|
+
readonly kind: "missing-token";
|
|
104
|
+
} | {
|
|
105
|
+
readonly kind: "invalid-token";
|
|
106
|
+
};
|
|
95
107
|
/** Why a credential source couldn't give a credential, tagged by the source. */
|
|
96
108
|
export type CredentialFailure = {
|
|
97
109
|
readonly source: "mint";
|
|
@@ -100,6 +112,9 @@ export type CredentialFailure = {
|
|
|
100
112
|
} | {
|
|
101
113
|
readonly source: "github-actions";
|
|
102
114
|
readonly failure: TokenRequestFailure;
|
|
115
|
+
} | {
|
|
116
|
+
readonly source: "vercel-oidc";
|
|
117
|
+
readonly failure: VercelOidcTokenFailure;
|
|
103
118
|
};
|
|
104
119
|
export type CredentialOutcome = {
|
|
105
120
|
readonly ok: true;
|
|
@@ -109,9 +124,9 @@ export type CredentialOutcome = {
|
|
|
109
124
|
readonly failure: CredentialFailure;
|
|
110
125
|
};
|
|
111
126
|
/**
|
|
112
|
-
* Where a credential a service rejected came from: the mint, for `target
|
|
113
|
-
* claims a service's trust rules match on (`undefined` when they can't be read)
|
|
114
|
-
* from it.
|
|
127
|
+
* Where a credential a service rejected came from: the mint, for `target`; a GitHub Actions OIDC token, with the
|
|
128
|
+
* claims a service's trust rules match on (`undefined` when they can't be read); or `VERCEL_OIDC_TOKEN`. A resource
|
|
129
|
+
* words its own rejection from it.
|
|
115
130
|
*/
|
|
116
131
|
export type CredentialOrigin = {
|
|
117
132
|
readonly source: "mint";
|
|
@@ -119,6 +134,8 @@ export type CredentialOrigin = {
|
|
|
119
134
|
} | {
|
|
120
135
|
readonly source: "github-actions";
|
|
121
136
|
readonly claims: GitHubActionsClaims | undefined;
|
|
137
|
+
} | {
|
|
138
|
+
readonly source: "vercel-oidc";
|
|
122
139
|
};
|
|
123
140
|
/**
|
|
124
141
|
* Where a run gets its credential. A caller obtains one with `obtain()` right before each request that needs one, and
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// The credential a resource's acquire gets, and the declarations around it: where a credential source gets one (the
|
|
2
|
-
// for a target,
|
|
3
|
-
// extension API declares them, since its lifecycle hands them to a resource; the launcher's
|
|
4
|
-
// implements the sources over its gateways. Types only.
|
|
1
|
+
// The credential a resource's acquire gets, and the declarations around it: where a credential source gets one (the
|
|
2
|
+
// mint for a target, a GitHub Actions OIDC token request, or `VERCEL_OIDC_TOKEN`), why one failed, and where a
|
|
3
|
+
// credential came from. The extension API declares them, since its lifecycle hands them to a resource; the launcher's
|
|
4
|
+
// `credential` module implements the sources over its gateways. Types only.
|
|
5
5
|
export {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { Credential, type GitHubActionsClaims, type VercelProject } from "./credential.ts";
|
|
2
|
-
export { type CredentialDiagnosis, describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, } from "./credential-diagnosis.ts";
|
|
3
|
-
export type { CredentialFailure, CredentialOrigin, CredentialOutcome, CredentialSource, MintFailure, MintStep, MintTarget, TokenAttemptFailure, TokenRequestFailure, TokenRequestVariable, } from "./credential-source.ts";
|
|
2
|
+
export { type CredentialDiagnosis, describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, describeVercelOidcTokenFailure, } from "./credential-diagnosis.ts";
|
|
3
|
+
export type { CredentialFailure, CredentialOrigin, CredentialOutcome, CredentialSource, MintFailure, MintStep, MintTarget, TokenAttemptFailure, TokenRequestFailure, TokenRequestVariable, VercelOidcTokenFailure, } from "./credential-source.ts";
|
|
4
4
|
export { tokenRequestFailureFacts, tokenRequestFailureShape } from "./token-request-facts.ts";
|
|
5
|
+
export { vercelOidcTokenFailureFacts, vercelOidcTokenFailureShape } from "./vercel-oidc-facts.ts";
|
|
5
6
|
export type { Clock, Timer } from "./time.ts";
|
|
6
7
|
export { defineResource, type ResourceSpec } from "./resource.ts";
|
|
7
8
|
export { argsText, defineDriver, type Driver, DRIVER_PLAN_FAILURE_KINDS, type DriverHints, type DriverPlanAnswer, type DriverPlanFailureKind, type DriverPlanned, type DriverPlanRequest, type DriverRefusalWords, type DriverFileListSupport, type DriverFileListValidation, type DriverSpec, } from "./driver.ts";
|
|
@@ -36,8 +36,9 @@
|
|
|
36
36
|
// `commands.ts`, even for types, so its declarations reach no Clinkr either
|
|
37
37
|
// (`test/integration/package-types.integration.test.ts`).
|
|
38
38
|
export { Credential } from "./credential.js";
|
|
39
|
-
export { describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, } from "./credential-diagnosis.js";
|
|
39
|
+
export { describeCredentialFailure, describeMintFailure, describeTokenRequestFailure, describeVercelOidcTokenFailure, } from "./credential-diagnosis.js";
|
|
40
40
|
export { tokenRequestFailureFacts, tokenRequestFailureShape } from "./token-request-facts.js";
|
|
41
|
+
export { vercelOidcTokenFailureFacts, vercelOidcTokenFailureShape } from "./vercel-oidc-facts.js";
|
|
41
42
|
export { defineResource } from "./resource.js";
|
|
42
43
|
export { argsText, defineDriver, DRIVER_PLAN_FAILURE_KINDS, } from "./driver.js";
|
|
43
44
|
export { defaultResourceKey, resourceCall, NOT_COUNTED, optionKeyPath, } from "./resource-definition.js";
|
|
@@ -106,7 +106,7 @@ type OptionValues<Rules> = {
|
|
|
106
106
|
export type WrittenOptions<Rules> = Pick<OptionInputs<Rules>, RequiredOption<Rules>> & Partial<Pick<OptionInputs<Rules>, Exclude<keyof Rules, RequiredOption<Rules>>>>;
|
|
107
107
|
/**
|
|
108
108
|
* A resource's options: the plain values, shaped as in the config file, once defaults, the file and the flags are
|
|
109
|
-
* merged. Its lifecycle,
|
|
109
|
+
* merged. Its lifecycle, the Vercel Sandbox runner options and the run payload all see these. An option with neither a default nor
|
|
110
110
|
* `required` may be absent.
|
|
111
111
|
*/
|
|
112
112
|
export type ResolvedOptions<Rules> = Pick<OptionValues<Rules>, PresentOption<Rules>> & Partial<Pick<OptionValues<Rules>, Exclude<keyof Rules, PresentOption<Rules>>>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
/** An environment variable name: ASCII letters, digits, and underscores, not starting with a digit. */
|
|
3
3
|
export declare const ENV_VAR_NAME_PATTERN: RegExp;
|
|
4
|
-
/** The human-readable rule for an environment variable name, shared by Zod and
|
|
4
|
+
/** The human-readable rule for an environment variable name, shared by Zod and the runner options' checks. */
|
|
5
5
|
export declare const ENV_VAR_NAME_RULE = "an environment variable name, letters, digits, and underscores, not starting with a digit";
|
|
6
6
|
/**
|
|
7
7
|
* The fewest characters a secret value may have. The run replaces each value wherever it appears in what it prints and
|
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { mustBe } from "./rules.js";
|
|
6
6
|
/** An environment variable name: ASCII letters, digits, and underscores, not starting with a digit. */
|
|
7
7
|
export const ENV_VAR_NAME_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
8
|
-
/** The human-readable rule for an environment variable name, shared by Zod and
|
|
8
|
+
/** The human-readable rule for an environment variable name, shared by Zod and the runner options' checks. */
|
|
9
9
|
export const ENV_VAR_NAME_RULE = "an environment variable name, letters, digits, and underscores, not starting with a digit";
|
|
10
10
|
/**
|
|
11
11
|
* The fewest characters a secret value may have. The run replaces each value wherever it appears in what it prints and
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { VercelOidcTokenFailure } from "./credential-source.ts";
|
|
3
|
+
/** The facts of a failed `VERCEL_OIDC_TOKEN` read that `vercel_oidc_token_failed` carries. */
|
|
4
|
+
export declare const vercelOidcTokenFailureShape: {
|
|
5
|
+
/** Why reading `VERCEL_OIDC_TOKEN` failed: unset/empty, or not a valid Vercel project OIDC token. */
|
|
6
|
+
cause: z.ZodEnum<{
|
|
7
|
+
"invalid-token": "invalid-token";
|
|
8
|
+
"missing-token": "missing-token";
|
|
9
|
+
}>;
|
|
10
|
+
/** The cause, for a person. */
|
|
11
|
+
detail: z.ZodString;
|
|
12
|
+
/** The one fix. */
|
|
13
|
+
fix: z.ZodString;
|
|
14
|
+
};
|
|
15
|
+
/** A failed `VERCEL_OIDC_TOKEN` read as `vercel_oidc_token_failed` reports it. */
|
|
16
|
+
export declare function vercelOidcTokenFailureFacts(failure: VercelOidcTokenFailure): {
|
|
17
|
+
cause: "invalid-token" | "missing-token";
|
|
18
|
+
detail: string;
|
|
19
|
+
fix: string;
|
|
20
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// A failed `VERCEL_OIDC_TOKEN` read as an error reports it: its facts (`vercelOidcTokenFailureShape`,
|
|
2
|
+
// `vercelOidcTokenFailureFacts`), which the credential launcher resolver's `vercel_oidc_token_failed` carries
|
|
3
|
+
// (`config/credential-resolver.ts`), a run's `vercel_oidc_token_failed` carries, and a resource's own errors reuse
|
|
4
|
+
// with theirs beside them. It loads no Clinkr.
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { describeVercelOidcTokenFailure } from "./credential-diagnosis.js";
|
|
7
|
+
/** The facts of a failed `VERCEL_OIDC_TOKEN` read that `vercel_oidc_token_failed` carries. */
|
|
8
|
+
export const vercelOidcTokenFailureShape = {
|
|
9
|
+
/** Why reading `VERCEL_OIDC_TOKEN` failed: unset/empty, or not a valid Vercel project OIDC token. */
|
|
10
|
+
cause: z.enum(["missing-token", "invalid-token"]),
|
|
11
|
+
/** The cause, for a person. */
|
|
12
|
+
detail: z.string(),
|
|
13
|
+
/** The one fix. */
|
|
14
|
+
fix: z.string(),
|
|
15
|
+
};
|
|
16
|
+
/** A failed `VERCEL_OIDC_TOKEN` read as `vercel_oidc_token_failed` reports it. */
|
|
17
|
+
export function vercelOidcTokenFailureFacts(failure) {
|
|
18
|
+
const { cause: detail, fix } = describeVercelOidcTokenFailure(failure);
|
|
19
|
+
return { cause: failure.kind, detail, fix };
|
|
20
|
+
}
|
package/dist/shared/cleanup.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ declare const notDeletedSchema: z.ZodObject<{
|
|
|
24
24
|
declare const keptSchema: z.ZodObject<{
|
|
25
25
|
name: z.ZodString;
|
|
26
26
|
stopsAt: z.ZodString;
|
|
27
|
-
url: z.ZodString
|
|
27
|
+
url: z.ZodNullable<z.ZodString>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
/** The runner sandbox the run couldn't keep running, so it stopped and deleted it. */
|
|
30
30
|
declare const notKeptSchema: z.ZodObject<{
|
|
@@ -40,7 +40,7 @@ export declare const runnerCleanupSchema: z.ZodObject<{
|
|
|
40
40
|
kept: z.ZodNullable<z.ZodObject<{
|
|
41
41
|
name: z.ZodString;
|
|
42
42
|
stopsAt: z.ZodString;
|
|
43
|
-
url: z.ZodString
|
|
43
|
+
url: z.ZodNullable<z.ZodString>;
|
|
44
44
|
}, z.core.$strip>>;
|
|
45
45
|
notKept: z.ZodNullable<z.ZodObject<{
|
|
46
46
|
name: z.ZodString;
|
|
@@ -77,7 +77,7 @@ export declare function notKeptText(sandbox: z.infer<typeof notKeptSchema>): str
|
|
|
77
77
|
* Rows for the runner sandbox the run kept running, or couldn't keep, and the runner's sandboxes that couldn't be
|
|
78
78
|
* stopped or deleted, when there are any.
|
|
79
79
|
*/
|
|
80
|
-
export declare function runnerCleanupRows(cleanup: RunnerCleanup | null): (readonly ["Runner sandbox kept", readonly [`${string}, running until ${string}, with no network access`, string]] | readonly ["Runner sandbox not kept", string] | readonly ["Sandboxes not deleted", string[]] | readonly ["Sandboxes not stopped", string[]])[];
|
|
80
|
+
export declare function runnerCleanupRows(cleanup: RunnerCleanup | null): (readonly ["Runner sandbox kept", readonly [`${string}, running until ${string}, with no network access`, ...string[]]] | readonly ["Runner sandbox not kept", string] | readonly ["Sandboxes not deleted", string[]] | readonly ["Sandboxes not stopped", string[]])[];
|
|
81
81
|
/** Warnings for the runner sandbox the run couldn't keep running, and the sandboxes that couldn't be stopped or deleted. */
|
|
82
82
|
export declare function runnerCleanupWarnings(cleanup: RunnerCleanup | null): {
|
|
83
83
|
reason: string;
|
package/dist/shared/cleanup.js
CHANGED
|
@@ -29,8 +29,8 @@ const keptSchema = z.object({
|
|
|
29
29
|
name: z.string(),
|
|
30
30
|
/** When its timeout stops it, as an ISO time: the keep time from when the run ended, or later. */
|
|
31
31
|
stopsAt: z.string(),
|
|
32
|
-
/** Its Connect page in the Vercel dashboard, which says how to open a shell in it. */
|
|
33
|
-
url: z.string(),
|
|
32
|
+
/** Its Connect page in the Vercel dashboard, which says how to open a shell in it; null when team or project slug is unknown. */
|
|
33
|
+
url: z.string().nullable(),
|
|
34
34
|
});
|
|
35
35
|
/** The runner sandbox the run couldn't keep running, so it stopped and deleted it. */
|
|
36
36
|
const notKeptSchema = z.object({ name: z.string(), message: z.string() });
|
|
@@ -58,7 +58,8 @@ export function notDeletedText(sandbox) {
|
|
|
58
58
|
}
|
|
59
59
|
/** The runner sandbox a run kept running, as a sentence. */
|
|
60
60
|
export function keptText(kept) {
|
|
61
|
-
|
|
61
|
+
const suffix = kept.url === null ? "" : `: ${kept.url}`;
|
|
62
|
+
return `Kept the runner sandbox ${kept.name} running until ${isoSecondsText(kept.stopsAt)}, with no network access, so you can connect to it${suffix}`;
|
|
62
63
|
}
|
|
63
64
|
/** The runner sandbox a run couldn't keep running, as a sentence. */
|
|
64
65
|
export function notKeptText(sandbox) {
|
|
@@ -78,7 +79,10 @@ export function runnerCleanupRows(cleanup) {
|
|
|
78
79
|
: [
|
|
79
80
|
[
|
|
80
81
|
"Runner sandbox kept",
|
|
81
|
-
[
|
|
82
|
+
[
|
|
83
|
+
`${kept.name}, running until ${isoSecondsText(kept.stopsAt)}, with no network access`,
|
|
84
|
+
...(kept.url === null ? [] : [kept.url]),
|
|
85
|
+
],
|
|
82
86
|
],
|
|
83
87
|
]),
|
|
84
88
|
...(notKept === null ? [] : [["Runner sandbox not kept", notKeptText(notKept)]]),
|
|
@@ -133,7 +137,13 @@ function runnerCleanupOf(report) {
|
|
|
133
137
|
return null;
|
|
134
138
|
const { kept, target } = report;
|
|
135
139
|
return {
|
|
136
|
-
kept: kept === null
|
|
140
|
+
kept: kept === null
|
|
141
|
+
? null
|
|
142
|
+
: {
|
|
143
|
+
name: kept.name,
|
|
144
|
+
stopsAt: kept.stopsAt,
|
|
145
|
+
url: target === null ? null : sandboxConnectPage(target, kept.name),
|
|
146
|
+
},
|
|
137
147
|
notKept: report.notKept === null ? null : { ...report.notKept },
|
|
138
148
|
notStopped: report.notStopped.map(({ name, role, timeoutMinutes, message }) => ({
|
|
139
149
|
name,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RejectedSnapshot,
|
|
1
|
+
import type { RejectedSnapshot, SnapshotIndexNote, SnapshotRejectionReason } from "../runner/index.ts";
|
|
2
2
|
/** How many of the snapshots a run doesn't start from its build line lists, before it counts the rest. */
|
|
3
3
|
export declare const REJECTIONS_SHOWN = 5;
|
|
4
4
|
/** `count` commits, as text: `1 commit`, `24 commits`. */
|
|
@@ -18,14 +18,14 @@ export declare function rejectionText(reason: SnapshotRejectionReason, snapshot:
|
|
|
18
18
|
readonly base: string;
|
|
19
19
|
}): string;
|
|
20
20
|
/**
|
|
21
|
-
* The lines under a run's build line: why each cached snapshot of the
|
|
21
|
+
* The lines under a run's build line: why each cached snapshot of the runner doesn't fit, `REJECTIONS_SHOWN` of them
|
|
22
22
|
* at most, then how many more `storm snapshots list` shows.
|
|
23
23
|
*/
|
|
24
24
|
export declare function rejectionLines(rejected: readonly RejectedSnapshot[]): string[];
|
|
25
25
|
/** Every reason a run doesn't start from a cached snapshot, for a schema. */
|
|
26
26
|
export declare const REJECTION_REASONS: readonly ["expired", "expires-soon", "other-base", "steps-changed", "other-owner"];
|
|
27
27
|
/**
|
|
28
|
-
* What removing expired entries from the
|
|
28
|
+
* What removing expired entries from the local snapshot index noticed, as a run's and `storm snapshots build`'s
|
|
29
29
|
* progress line.
|
|
30
30
|
*/
|
|
31
|
-
export declare function
|
|
31
|
+
export declare function snapshotIndexNoteText(note: SnapshotIndexNote): string;
|