@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
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { type ExecutionContext } from "@vercel/clinkr";
|
|
2
|
+
import type { StormApp } from "../../context.ts";
|
|
3
|
+
import type { CredentialSourceChoice } from "../../credential/index.ts";
|
|
4
|
+
import type { ResourceLifecycles } from "../../core/index.ts";
|
|
5
|
+
import type { RunPlan, VercelSandboxPlannedRunner } from "../../planning/run-plan.ts";
|
|
6
|
+
import type { TestPlanFacts } from "../../run-directory/index.ts";
|
|
7
|
+
import { type CheckedVercelSandboxOptions } from "../../runner/index.ts";
|
|
8
|
+
import type { RunCommandRequest } from "./run-flags.ts";
|
|
9
|
+
/**
|
|
10
|
+
* Resolved runner once the run's resources' `beforeRun` let it go on: on the launch machine, with the credential source
|
|
11
|
+
* it chose when a resource needs the Vercel credential; or in a Vercel Sandbox, whose one mint the resources share.
|
|
12
|
+
*/
|
|
13
|
+
export type ResolvedRunRunner = {
|
|
14
|
+
readonly kind: "launch-machine";
|
|
15
|
+
readonly credential: CredentialSourceChoice | undefined;
|
|
16
|
+
} | VercelSandboxPlannedRunner;
|
|
17
|
+
/**
|
|
18
|
+
* Calls each resource's `beforeRun` in registry order, with its options and their sources, then chooses the credential
|
|
19
|
+
* source, refusing in order: a resource's `beforeRun` refusal (`resource_refused_before_run`), with the config file
|
|
20
|
+
* beside it, which stops the resources after it from being asked; a `--credential` no used resource needs
|
|
21
|
+
* (`credential_unused`); on the launch machine, a used resource that needs a runner sandbox
|
|
22
|
+
* (`resource_needs_runner_sandbox`, naming every such resource by its key; a skipped resource never refuses); and on
|
|
23
|
+
* the launch machine where a used resource needs the Vercel credential, the credential source (`missing_target` for
|
|
24
|
+
* the mint). Each refusal ends the command before the run starts, so it leaves no run directory.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resourcesBeforeRun(lifecycles: ResourceLifecycles, plan: RunPlan, request: Pick<RunCommandRequest, "credential">): Promise<{
|
|
27
|
+
readonly ok: false;
|
|
28
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"missing_target">;
|
|
29
|
+
} | {
|
|
30
|
+
readonly ok: false;
|
|
31
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"credential_unused">;
|
|
32
|
+
} | {
|
|
33
|
+
readonly ok: false;
|
|
34
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"resource_needs_runner_sandbox">;
|
|
35
|
+
} | {
|
|
36
|
+
readonly ok: false;
|
|
37
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"resource_refused_before_run">;
|
|
38
|
+
} | {
|
|
39
|
+
readonly ok: true;
|
|
40
|
+
readonly runner: ResolvedRunRunner;
|
|
41
|
+
readonly used: {
|
|
42
|
+
readonly ok: true;
|
|
43
|
+
readonly requests: import("../../core/resource.ts").ResourceRequests;
|
|
44
|
+
readonly skipped: readonly import("../../core/resource.ts").ResourceSkip[];
|
|
45
|
+
readonly secrets: readonly string[];
|
|
46
|
+
readonly needsVercelCredential: boolean;
|
|
47
|
+
readonly needRunnerSandbox: readonly string[];
|
|
48
|
+
readonly hiddenVariables: readonly string[];
|
|
49
|
+
};
|
|
50
|
+
}>;
|
|
51
|
+
/** What the resources' `beforeRun` answered, once they let the run go on. */
|
|
52
|
+
export type BeforeRun = Extract<Awaited<ReturnType<typeof resourcesBeforeRun>>, {
|
|
53
|
+
readonly ok: true;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Keep time of each runner sandbox, in milliseconds:
|
|
57
|
+
* - `"single"`: `--keep-sandbox`, else `runner.keepSandbox`, else 0.
|
|
58
|
+
* - `"sandboxes"`: `--keep-sandbox`, else 0 (multi-sandbox runs intentionally ignore `runner.keepSandbox`).
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveKeepMs(flag: string | undefined, options: CheckedVercelSandboxOptions, mode: "single" | "sandboxes"): number;
|
|
61
|
+
/**
|
|
62
|
+
* Runs `prepareRunner` for a Vercel Sandbox runner and redacts any preparation refusal with `secrets`. Shared by
|
|
63
|
+
* `--plan-only`, single-run execution, and multi-sandbox execution.
|
|
64
|
+
*/
|
|
65
|
+
export declare function prepareRunnerForRun(app: StormApp, runner: VercelSandboxPlannedRunner, input: {
|
|
66
|
+
readonly configFile: string | null;
|
|
67
|
+
readonly resources: Readonly<Record<string, {
|
|
68
|
+
readonly definition: string;
|
|
69
|
+
readonly options: unknown;
|
|
70
|
+
}>>;
|
|
71
|
+
readonly sandboxes: number;
|
|
72
|
+
readonly secrets: readonly string[];
|
|
73
|
+
}): Promise<{
|
|
74
|
+
refusal?: never;
|
|
75
|
+
readonly ok: true;
|
|
76
|
+
readonly prepared: import("../../runner/prepare.ts").PreparedRunner;
|
|
77
|
+
} | {
|
|
78
|
+
readonly prepared?: never;
|
|
79
|
+
readonly ok: false;
|
|
80
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"invalid_config"> | import("@vercel/clinkr").CommandError<"no_base_ref"> | import("@vercel/clinkr").CommandError<"runner_failed"> | import("@vercel/clinkr").CommandError<"submodules_refused">;
|
|
81
|
+
}>;
|
|
82
|
+
/** Shared pre-start sequence: `resourcesBeforeRun`, signal cancel check, and test-plan progress line. */
|
|
83
|
+
export declare function beforeRunStarts({ ui, signal }: ExecutionContext<StormApp>, lifecycles: ResourceLifecycles, planned: RunPlan, request: Pick<RunCommandRequest, "credential">, plan: TestPlanFacts | undefined): Promise<{
|
|
84
|
+
readonly ok: false;
|
|
85
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"missing_target">;
|
|
86
|
+
} | {
|
|
87
|
+
readonly ok: false;
|
|
88
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"credential_unused">;
|
|
89
|
+
} | {
|
|
90
|
+
readonly ok: false;
|
|
91
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"resource_needs_runner_sandbox">;
|
|
92
|
+
} | {
|
|
93
|
+
readonly ok: false;
|
|
94
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"resource_refused_before_run">;
|
|
95
|
+
} | {
|
|
96
|
+
readonly ok: true;
|
|
97
|
+
readonly runner: ResolvedRunRunner;
|
|
98
|
+
readonly used: {
|
|
99
|
+
readonly ok: true;
|
|
100
|
+
readonly requests: import("../../core/resource.ts").ResourceRequests;
|
|
101
|
+
readonly skipped: readonly import("../../core/resource.ts").ResourceSkip[];
|
|
102
|
+
readonly secrets: readonly string[];
|
|
103
|
+
readonly needsVercelCredential: boolean;
|
|
104
|
+
readonly needRunnerSandbox: readonly string[];
|
|
105
|
+
readonly hiddenVariables: readonly string[];
|
|
106
|
+
};
|
|
107
|
+
} | {
|
|
108
|
+
readonly ok: false;
|
|
109
|
+
readonly refusal: import("@vercel/clinkr").ClinkrError<"canceled">;
|
|
110
|
+
}>;
|
|
111
|
+
/** Builds a `RunRunnerRequest` from a prepared Vercel Sandbox runner. */
|
|
112
|
+
export declare function runnerRequestFor(app: StormApp, runner: VercelSandboxPlannedRunner, used: BeforeRun["used"], options: {
|
|
113
|
+
readonly configFile: string | null;
|
|
114
|
+
readonly sandboxes: number;
|
|
115
|
+
readonly keepMs: number;
|
|
116
|
+
}): Promise<{
|
|
117
|
+
readonly prepared?: never;
|
|
118
|
+
readonly ok: false;
|
|
119
|
+
readonly refusal: import("@vercel/clinkr").CommandError<"invalid_config"> | import("@vercel/clinkr").CommandError<"no_base_ref"> | import("@vercel/clinkr").CommandError<"runner_failed"> | import("@vercel/clinkr").CommandError<"submodules_refused">;
|
|
120
|
+
} | {
|
|
121
|
+
readonly ok: true;
|
|
122
|
+
readonly runner: import("../../runner/session.ts").RunnerSessionRequest;
|
|
123
|
+
}>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// Pre-start resource checks and Vercel Sandbox runner preparation shared by `--plan-only`, single runs, and runs
|
|
2
|
+
// across runner sandboxes: calling each resource's `beforeRun`, settling the launch-machine credential source,
|
|
3
|
+
// resolving runner keep time, and running redacted `prepareRunner`.
|
|
4
|
+
import { refused } from "@vercel/clinkr";
|
|
5
|
+
import { settleCredential } from "../../config/index.js";
|
|
6
|
+
import { redactor, redactStrings } from "../../planning/redaction.js";
|
|
7
|
+
import { testPlanLine } from "../../planning/test-plan.js";
|
|
8
|
+
import { prepareRunner } from "../../runner/index.js";
|
|
9
|
+
import { parseKeepTime } from "../../time/index.js";
|
|
10
|
+
import { canceledBeforeStart, runErrors } from "./outcomes.js";
|
|
11
|
+
import { resourceRefusedBeforeRun } from "./resource-refusals.js";
|
|
12
|
+
import { prepareRefusal, vcpuResources } from "./runner-refusals.js";
|
|
13
|
+
/**
|
|
14
|
+
* Calls each resource's `beforeRun` in registry order, with its options and their sources, then chooses the credential
|
|
15
|
+
* source, refusing in order: a resource's `beforeRun` refusal (`resource_refused_before_run`), with the config file
|
|
16
|
+
* beside it, which stops the resources after it from being asked; a `--credential` no used resource needs
|
|
17
|
+
* (`credential_unused`); on the launch machine, a used resource that needs a runner sandbox
|
|
18
|
+
* (`resource_needs_runner_sandbox`, naming every such resource by its key; a skipped resource never refuses); and on
|
|
19
|
+
* the launch machine where a used resource needs the Vercel credential, the credential source (`missing_target` for
|
|
20
|
+
* the mint). Each refusal ends the command before the run starts, so it leaves no run directory.
|
|
21
|
+
*/
|
|
22
|
+
export async function resourcesBeforeRun(lifecycles, plan, request) {
|
|
23
|
+
const { configFile, resources, settings } = plan;
|
|
24
|
+
const used = await lifecycles.beforeRun(resources);
|
|
25
|
+
if (!used.ok)
|
|
26
|
+
return refused(resourceRefusedBeforeRun(used.resource, used.refusal, configFile));
|
|
27
|
+
if (plan.runner.kind === "launch-machine" && request.credential !== undefined && !used.needsVercelCredential)
|
|
28
|
+
return refused(runErrors.credentialUnused({ flags: ["--credential"], configFile }));
|
|
29
|
+
if (plan.runner.kind === "launch-machine" && used.needRunnerSandbox.length > 0)
|
|
30
|
+
return refused(runErrors.resourceNeedsRunnerSandbox({ resources: [...used.needRunnerSandbox], configFile }));
|
|
31
|
+
let runner;
|
|
32
|
+
if (plan.runner.kind === "vercel-sandbox")
|
|
33
|
+
runner = plan.runner;
|
|
34
|
+
else if (used.needsVercelCredential) {
|
|
35
|
+
const chosen = settleCredential(request.credential ?? "mint", settings.scope, settings.project);
|
|
36
|
+
if (!chosen.ok)
|
|
37
|
+
return chosen;
|
|
38
|
+
runner = { kind: "launch-machine", credential: chosen.credential };
|
|
39
|
+
}
|
|
40
|
+
else
|
|
41
|
+
runner = { kind: "launch-machine", credential: undefined };
|
|
42
|
+
return { ok: true, runner, used };
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Keep time of each runner sandbox, in milliseconds:
|
|
46
|
+
* - `"single"`: `--keep-sandbox`, else `runner.keepSandbox`, else 0.
|
|
47
|
+
* - `"sandboxes"`: `--keep-sandbox`, else 0 (multi-sandbox runs intentionally ignore `runner.keepSandbox`).
|
|
48
|
+
*/
|
|
49
|
+
export function resolveKeepMs(flag, options, mode) {
|
|
50
|
+
const fromFlag = flag === undefined ? undefined : parseKeepTime(flag);
|
|
51
|
+
const minutes = mode === "single" ? (fromFlag ?? options.keepSandboxMinutes ?? 0) : (fromFlag ?? 0);
|
|
52
|
+
return minutes * 60_000;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Runs `prepareRunner` for a Vercel Sandbox runner and redacts any preparation refusal with `secrets`. Shared by
|
|
56
|
+
* `--plan-only`, single-run execution, and multi-sandbox execution.
|
|
57
|
+
*/
|
|
58
|
+
export async function prepareRunnerForRun(app, runner, input) {
|
|
59
|
+
const prepared = await prepareRunner(app.context, {
|
|
60
|
+
cwd: app.cwd,
|
|
61
|
+
options: runner.options,
|
|
62
|
+
vcpuRun: { resources: vcpuResources(input.resources), sandboxes: input.sandboxes },
|
|
63
|
+
});
|
|
64
|
+
if (prepared.kind === "ok")
|
|
65
|
+
return { ok: true, prepared: prepared.prepared };
|
|
66
|
+
const refusal = prepareRefusal(prepared, input.configFile);
|
|
67
|
+
return {
|
|
68
|
+
ok: false,
|
|
69
|
+
refusal: input.secrets.length === 0 ? refusal : redactStrings(refusal, redactor(input.secrets)),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** Shared pre-start sequence: `resourcesBeforeRun`, signal cancel check, and test-plan progress line. */
|
|
73
|
+
export async function beforeRunStarts({ ui, signal }, lifecycles, planned, request, plan) {
|
|
74
|
+
const before = await resourcesBeforeRun(lifecycles, planned, request);
|
|
75
|
+
if (!before.ok)
|
|
76
|
+
return before;
|
|
77
|
+
if (signal.aborted)
|
|
78
|
+
return { ok: false, refusal: canceledBeforeStart() };
|
|
79
|
+
if (plan !== undefined)
|
|
80
|
+
await ui.progress?.(testPlanLine(plan));
|
|
81
|
+
return before;
|
|
82
|
+
}
|
|
83
|
+
/** Builds a `RunRunnerRequest` from a prepared Vercel Sandbox runner. */
|
|
84
|
+
export async function runnerRequestFor(app, runner, used, options) {
|
|
85
|
+
const secrets = [...used.secrets, ...runner.secrets];
|
|
86
|
+
const prepared = await prepareRunnerForRun(app, runner, {
|
|
87
|
+
configFile: options.configFile,
|
|
88
|
+
resources: used.requests,
|
|
89
|
+
sandboxes: options.sandboxes,
|
|
90
|
+
secrets,
|
|
91
|
+
});
|
|
92
|
+
if (!prepared.ok)
|
|
93
|
+
return prepared;
|
|
94
|
+
const session = {
|
|
95
|
+
prepared: prepared.prepared,
|
|
96
|
+
target: runner.target,
|
|
97
|
+
user: app.user,
|
|
98
|
+
credentials: runner.credentials,
|
|
99
|
+
...(Object.keys(runner.unsafeSecretEnvVars).length === 0
|
|
100
|
+
? {}
|
|
101
|
+
: { unsafeSecretEnvVars: runner.unsafeSecretEnvVars }),
|
|
102
|
+
keepMs: options.keepMs,
|
|
103
|
+
};
|
|
104
|
+
return { ok: true, runner: session };
|
|
105
|
+
}
|
|
@@ -5,6 +5,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
5
5
|
credential: z.ZodOptional<z.ZodEnum<{
|
|
6
6
|
"github-actions": "github-actions";
|
|
7
7
|
mint: "mint";
|
|
8
|
+
"vercel-oidc": "vercel-oidc";
|
|
8
9
|
}>>;
|
|
9
10
|
showOutput: z.ZodDefault<z.ZodBoolean>;
|
|
10
11
|
keepSandbox: z.ZodOptional<z.ZodString>;
|
|
@@ -34,7 +35,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
34
35
|
built: z.ZodBoolean;
|
|
35
36
|
vcpus: z.ZodNumber;
|
|
36
37
|
region: z.ZodString;
|
|
37
|
-
|
|
38
|
+
image: z.ZodString;
|
|
38
39
|
buildMs: z.ZodNumber;
|
|
39
40
|
}, z.core.$strip>>;
|
|
40
41
|
timeline: z.ZodObject<{
|
|
@@ -169,7 +170,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
169
170
|
built: z.ZodBoolean;
|
|
170
171
|
vcpus: z.ZodNumber;
|
|
171
172
|
region: z.ZodString;
|
|
172
|
-
|
|
173
|
+
image: z.ZodString;
|
|
173
174
|
uploadBytes: z.ZodNullable<z.ZodNumber>;
|
|
174
175
|
}, z.core.$strip>;
|
|
175
176
|
cleanup: z.ZodType<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts>>;
|
|
@@ -177,7 +178,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
177
178
|
sandbox: z.ZodNumber;
|
|
178
179
|
name: z.ZodString;
|
|
179
180
|
stopsAt: z.ZodString;
|
|
180
|
-
url: z.ZodString
|
|
181
|
+
url: z.ZodNullable<z.ZodString>;
|
|
181
182
|
}, z.core.$strip>>;
|
|
182
183
|
notKept: z.ZodArray<z.ZodObject<{
|
|
183
184
|
sandbox: z.ZodNumber;
|
|
@@ -263,9 +264,11 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
263
264
|
configFile: string | null;
|
|
264
265
|
}]>;
|
|
265
266
|
credentialsInvalid: import("@vercel/clinkr").SharedError<"credentials_invalid", [data: {
|
|
266
|
-
|
|
267
|
+
problems: {
|
|
267
268
|
name: string;
|
|
268
|
-
problem: "missing" | "multiline" | "short";
|
|
269
|
+
problem: "gh-failed" | "gh-not-authenticated" | "gh-not-installed" | "gh-preframed" | "gh-timed-out" | "missing" | "multiline" | "short";
|
|
270
|
+
detail: string;
|
|
271
|
+
hint: string;
|
|
269
272
|
}[];
|
|
270
273
|
minLength: number;
|
|
271
274
|
configFile: string | null;
|
|
@@ -293,6 +296,10 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
293
296
|
}[];
|
|
294
297
|
}[];
|
|
295
298
|
}]>;
|
|
299
|
+
keepSandboxManagedCredentials: import("@vercel/clinkr").SharedError<"keep_sandbox_managed_credentials", [data: {
|
|
300
|
+
providers: string[];
|
|
301
|
+
configFile: string | null;
|
|
302
|
+
}]>;
|
|
296
303
|
keepSandboxUnsafeSecretEnvVars: import("@vercel/clinkr").SharedError<"keep_sandbox_unsafe_secret_env_vars", [data: {
|
|
297
304
|
variables: string[];
|
|
298
305
|
configFile: string | null;
|
|
@@ -399,6 +406,13 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
399
406
|
minLength: number;
|
|
400
407
|
configFile: string | null;
|
|
401
408
|
}]>;
|
|
409
|
+
vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
|
|
410
|
+
cause: "invalid-token" | "missing-token";
|
|
411
|
+
detail: string;
|
|
412
|
+
fix: string;
|
|
413
|
+
runner: boolean;
|
|
414
|
+
cleanup: import("../../shared/cleanup.ts").StormCleanupFacts;
|
|
415
|
+
}]>;
|
|
402
416
|
}, {
|
|
403
417
|
readonly conflictingOptions: import("@vercel/clinkr").SharedError<"conflicting_options", [data: {
|
|
404
418
|
conflicts: {
|
|
@@ -414,9 +428,11 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
414
428
|
configFile: string | null;
|
|
415
429
|
}]>;
|
|
416
430
|
readonly credentialsInvalid: import("@vercel/clinkr").SharedError<"credentials_invalid", [data: {
|
|
417
|
-
|
|
431
|
+
problems: {
|
|
418
432
|
name: string;
|
|
419
|
-
problem: "missing" | "multiline" | "short";
|
|
433
|
+
problem: "gh-failed" | "gh-not-authenticated" | "gh-not-installed" | "gh-preframed" | "gh-timed-out" | "missing" | "multiline" | "short";
|
|
434
|
+
detail: string;
|
|
435
|
+
hint: string;
|
|
420
436
|
}[];
|
|
421
437
|
minLength: number;
|
|
422
438
|
configFile: string | null;
|
|
@@ -444,6 +460,10 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
444
460
|
}[];
|
|
445
461
|
}[];
|
|
446
462
|
}]>;
|
|
463
|
+
readonly keepSandboxManagedCredentials: import("@vercel/clinkr").SharedError<"keep_sandbox_managed_credentials", [data: {
|
|
464
|
+
providers: string[];
|
|
465
|
+
configFile: string | null;
|
|
466
|
+
}]>;
|
|
447
467
|
readonly keepSandboxUnsafeSecretEnvVars: import("@vercel/clinkr").SharedError<"keep_sandbox_unsafe_secret_env_vars", [data: {
|
|
448
468
|
variables: string[];
|
|
449
469
|
configFile: string | null;
|
|
@@ -550,6 +570,13 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
550
570
|
minLength: number;
|
|
551
571
|
configFile: string | null;
|
|
552
572
|
}]>;
|
|
573
|
+
readonly vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
|
|
574
|
+
cause: "invalid-token" | "missing-token";
|
|
575
|
+
detail: string;
|
|
576
|
+
fix: string;
|
|
577
|
+
runner: boolean;
|
|
578
|
+
cleanup: import("../../shared/cleanup.ts").StormCleanupFacts;
|
|
579
|
+
}]>;
|
|
553
580
|
}>, import("@vercel/clinkr").OutcomeOf<import("@vercel/clinkr").Outcomes<{
|
|
554
581
|
ran: z.ZodObject<{
|
|
555
582
|
version: z.ZodString;
|
|
@@ -569,7 +596,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
569
596
|
built: z.ZodBoolean;
|
|
570
597
|
vcpus: z.ZodNumber;
|
|
571
598
|
region: z.ZodString;
|
|
572
|
-
|
|
599
|
+
image: z.ZodString;
|
|
573
600
|
buildMs: z.ZodNumber;
|
|
574
601
|
}, z.core.$strip>>;
|
|
575
602
|
timeline: z.ZodObject<{
|
|
@@ -704,7 +731,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
704
731
|
built: z.ZodBoolean;
|
|
705
732
|
vcpus: z.ZodNumber;
|
|
706
733
|
region: z.ZodString;
|
|
707
|
-
|
|
734
|
+
image: z.ZodString;
|
|
708
735
|
uploadBytes: z.ZodNullable<z.ZodNumber>;
|
|
709
736
|
}, z.core.$strip>;
|
|
710
737
|
cleanup: z.ZodType<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts, z.core.$ZodTypeInternals<import("../../shared/cleanup.ts").StormCleanupFacts, import("../../shared/cleanup.ts").StormCleanupFacts>>;
|
|
@@ -712,7 +739,7 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
712
739
|
sandbox: z.ZodNumber;
|
|
713
740
|
name: z.ZodString;
|
|
714
741
|
stopsAt: z.ZodString;
|
|
715
|
-
url: z.ZodString
|
|
742
|
+
url: z.ZodNullable<z.ZodString>;
|
|
716
743
|
}, z.core.$strip>>;
|
|
717
744
|
notKept: z.ZodArray<z.ZodObject<{
|
|
718
745
|
sandbox: z.ZodNumber;
|
|
@@ -798,9 +825,11 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
798
825
|
configFile: string | null;
|
|
799
826
|
}]>;
|
|
800
827
|
credentialsInvalid: import("@vercel/clinkr").SharedError<"credentials_invalid", [data: {
|
|
801
|
-
|
|
828
|
+
problems: {
|
|
802
829
|
name: string;
|
|
803
|
-
problem: "missing" | "multiline" | "short";
|
|
830
|
+
problem: "gh-failed" | "gh-not-authenticated" | "gh-not-installed" | "gh-preframed" | "gh-timed-out" | "missing" | "multiline" | "short";
|
|
831
|
+
detail: string;
|
|
832
|
+
hint: string;
|
|
804
833
|
}[];
|
|
805
834
|
minLength: number;
|
|
806
835
|
configFile: string | null;
|
|
@@ -828,6 +857,10 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
828
857
|
}[];
|
|
829
858
|
}[];
|
|
830
859
|
}]>;
|
|
860
|
+
keepSandboxManagedCredentials: import("@vercel/clinkr").SharedError<"keep_sandbox_managed_credentials", [data: {
|
|
861
|
+
providers: string[];
|
|
862
|
+
configFile: string | null;
|
|
863
|
+
}]>;
|
|
831
864
|
keepSandboxUnsafeSecretEnvVars: import("@vercel/clinkr").SharedError<"keep_sandbox_unsafe_secret_env_vars", [data: {
|
|
832
865
|
variables: string[];
|
|
833
866
|
configFile: string | null;
|
|
@@ -934,6 +967,13 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
934
967
|
minLength: number;
|
|
935
968
|
configFile: string | null;
|
|
936
969
|
}]>;
|
|
970
|
+
vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
|
|
971
|
+
cause: "invalid-token" | "missing-token";
|
|
972
|
+
detail: string;
|
|
973
|
+
fix: string;
|
|
974
|
+
runner: boolean;
|
|
975
|
+
cleanup: import("../../shared/cleanup.ts").StormCleanupFacts;
|
|
976
|
+
}]>;
|
|
937
977
|
}, {
|
|
938
978
|
readonly conflictingOptions: import("@vercel/clinkr").SharedError<"conflicting_options", [data: {
|
|
939
979
|
conflicts: {
|
|
@@ -949,9 +989,11 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
949
989
|
configFile: string | null;
|
|
950
990
|
}]>;
|
|
951
991
|
readonly credentialsInvalid: import("@vercel/clinkr").SharedError<"credentials_invalid", [data: {
|
|
952
|
-
|
|
992
|
+
problems: {
|
|
953
993
|
name: string;
|
|
954
|
-
problem: "missing" | "multiline" | "short";
|
|
994
|
+
problem: "gh-failed" | "gh-not-authenticated" | "gh-not-installed" | "gh-preframed" | "gh-timed-out" | "missing" | "multiline" | "short";
|
|
995
|
+
detail: string;
|
|
996
|
+
hint: string;
|
|
955
997
|
}[];
|
|
956
998
|
minLength: number;
|
|
957
999
|
configFile: string | null;
|
|
@@ -979,6 +1021,10 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
979
1021
|
}[];
|
|
980
1022
|
}[];
|
|
981
1023
|
}]>;
|
|
1024
|
+
readonly keepSandboxManagedCredentials: import("@vercel/clinkr").SharedError<"keep_sandbox_managed_credentials", [data: {
|
|
1025
|
+
providers: string[];
|
|
1026
|
+
configFile: string | null;
|
|
1027
|
+
}]>;
|
|
982
1028
|
readonly keepSandboxUnsafeSecretEnvVars: import("@vercel/clinkr").SharedError<"keep_sandbox_unsafe_secret_env_vars", [data: {
|
|
983
1029
|
variables: string[];
|
|
984
1030
|
configFile: string | null;
|
|
@@ -1085,5 +1131,12 @@ declare const _default: import("@vercel/clinkr").CommandDefinition<z.ZodObject<{
|
|
|
1085
1131
|
minLength: number;
|
|
1086
1132
|
configFile: string | null;
|
|
1087
1133
|
}]>;
|
|
1134
|
+
readonly vercelOidcTokenFailed: import("@vercel/clinkr").SharedError<"vercel_oidc_token_failed", [data: {
|
|
1135
|
+
cause: "invalid-token" | "missing-token";
|
|
1136
|
+
detail: string;
|
|
1137
|
+
fix: string;
|
|
1138
|
+
runner: boolean;
|
|
1139
|
+
cleanup: import("../../shared/cleanup.ts").StormCleanupFacts;
|
|
1140
|
+
}]>;
|
|
1088
1141
|
}>>, import("../../context.ts").StormApp, false>;
|
|
1089
1142
|
export default _default;
|
|
@@ -1,93 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
planAskedSandboxesRun,
|
|
3
|
-
runHelp,
|
|
4
|
-
runPlanned
|
|
5
|
-
} from "../../chunks/chunk-7EENF73W.js";
|
|
6
1
|
import {
|
|
7
2
|
RUN_CLI_OPTIONS,
|
|
8
3
|
RUN_REQUEST_FIELDS,
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
executePlannedRun,
|
|
5
|
+
placeholderProblems,
|
|
6
|
+
planRun,
|
|
11
7
|
runFlagProblems,
|
|
8
|
+
runHelp,
|
|
12
9
|
sandboxesFlagProblems
|
|
13
|
-
} from "../../chunks/chunk-
|
|
10
|
+
} from "../../chunks/chunk-AS37D43E.js";
|
|
11
|
+
import "../../chunks/chunk-GUCCYCIO.js";
|
|
12
|
+
import "../../chunks/chunk-DZLU7BYK.js";
|
|
14
13
|
import "../../chunks/chunk-I5GZLOLQ.js";
|
|
15
|
-
import
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import "../../chunks/chunk-
|
|
19
|
-
import "../../chunks/chunk-
|
|
20
|
-
import "../../chunks/chunk-
|
|
21
|
-
import "../../chunks/chunk-
|
|
22
|
-
import "../../chunks/chunk-
|
|
23
|
-
import "../../chunks/chunk-
|
|
24
|
-
import "../../chunks/chunk-
|
|
25
|
-
import "../../chunks/chunk-
|
|
26
|
-
import "../../chunks/chunk-
|
|
14
|
+
import {
|
|
15
|
+
outcomes
|
|
16
|
+
} from "../../chunks/chunk-CQAY6GLP.js";
|
|
17
|
+
import "../../chunks/chunk-FDUY3BNF.js";
|
|
18
|
+
import "../../chunks/chunk-WNW2QXQK.js";
|
|
19
|
+
import "../../chunks/chunk-KK7PAWIZ.js";
|
|
20
|
+
import "../../chunks/chunk-OI4AP6Z7.js";
|
|
21
|
+
import "../../chunks/chunk-EEENLQHE.js";
|
|
22
|
+
import "../../chunks/chunk-72ZFEMAW.js";
|
|
23
|
+
import "../../chunks/chunk-UXD3TVWM.js";
|
|
24
|
+
import "../../chunks/chunk-55O4FCN4.js";
|
|
25
|
+
import "../../chunks/chunk-TXCOFC7N.js";
|
|
26
|
+
import "../../chunks/chunk-K4MDQPLW.js";
|
|
27
|
+
import "../../chunks/chunk-KQ5FXRUD.js";
|
|
28
|
+
import "../../chunks/chunk-LOGHIUUB.js";
|
|
27
29
|
import "../../chunks/chunk-F6N34UWB.js";
|
|
28
|
-
import "../../chunks/chunk-
|
|
30
|
+
import "../../chunks/chunk-3VXZONGE.js";
|
|
29
31
|
import {
|
|
30
32
|
effectiveConfig
|
|
31
|
-
} from "../../chunks/chunk-
|
|
32
|
-
import
|
|
33
|
-
NOT_COUNTED
|
|
34
|
-
} from "../../chunks/chunk-AWBSONHB.js";
|
|
33
|
+
} from "../../chunks/chunk-2JMWUKH3.js";
|
|
34
|
+
import "../../chunks/chunk-XBDRVFEV.js";
|
|
35
35
|
import {
|
|
36
36
|
stormCommands
|
|
37
|
-
} from "../../chunks/chunk-
|
|
38
|
-
import "../../chunks/chunk-
|
|
37
|
+
} from "../../chunks/chunk-LKXHGGGX.js";
|
|
38
|
+
import "../../chunks/chunk-24UYAK4R.js";
|
|
39
39
|
|
|
40
40
|
// src/commands/exec/command.ts
|
|
41
41
|
import { z } from "zod";
|
|
42
42
|
|
|
43
|
-
// src/planning/sandbox-placeholders.ts
|
|
44
|
-
var PLACEHOLDER = /(?<!\$)\{(sandbox\+1|sandbox(?:es)?)\}/g;
|
|
45
|
-
function placeholdersOf(argv) {
|
|
46
|
-
return new Set(
|
|
47
|
-
argv.flatMap((argument) => [...argument.matchAll(PLACEHOLDER)].map(([, name]) => name))
|
|
48
|
-
);
|
|
49
|
-
}
|
|
50
|
-
function commandForSandbox(argv, sandbox, count) {
|
|
51
|
-
return argv.map(
|
|
52
|
-
(argument) => argument.replace(
|
|
53
|
-
PLACEHOLDER,
|
|
54
|
-
(_match, name) => String(name === "sandbox" ? sandbox : name === "sandbox+1" ? sandbox + 1 : count)
|
|
55
|
-
)
|
|
56
|
-
);
|
|
57
|
-
}
|
|
58
|
-
function commandsForSandboxes(argv, count) {
|
|
59
|
-
return Array.from({ length: count }, (_, index) => commandForSandbox(argv, index, count));
|
|
60
|
-
}
|
|
61
|
-
function placeholderListText(names) {
|
|
62
|
-
const words = names.map((name) => `{${name}}`);
|
|
63
|
-
if (words.length <= 2) return words.join(" and ");
|
|
64
|
-
return `${words.slice(0, -1).join(", ")}, and ${words.at(-1) ?? ""}`;
|
|
65
|
-
}
|
|
66
|
-
function placeholderProblems(request) {
|
|
67
|
-
const { sandboxes, command } = request;
|
|
68
|
-
const held = placeholdersOf(command);
|
|
69
|
-
if (sandboxes === void 0)
|
|
70
|
-
return held.size === 0 ? [] : [
|
|
71
|
-
{
|
|
72
|
-
field: "command",
|
|
73
|
-
message: `The command holds ${placeholderListText([...held])}, which only --sandboxes replaces. Add --sandboxes <n>, or write $ before the brace to keep it as it is.`
|
|
74
|
-
}
|
|
75
|
-
];
|
|
76
|
-
return [
|
|
77
|
-
...Number.isInteger(sandboxes) && sandboxes >= 1 ? [] : [{ field: "sandboxes", message: `--sandboxes takes a whole number from 1, not ${sandboxes}.` }],
|
|
78
|
-
...held.has("sandbox") || held.has("sandbox+1") ? [] : [
|
|
79
|
-
{
|
|
80
|
-
field: "command",
|
|
81
|
-
message: "--sandboxes needs {sandbox} or {sandbox+1} in an argument of the command, such as -g {sandbox+1}/{sandboxes}: without it, every runner sandbox runs the same command."
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
43
|
// src/commands/exec/exec-words.ts
|
|
88
44
|
var EXEC_HELP = {
|
|
89
45
|
usage: "[--sandboxes <N>] -- <command...>",
|
|
90
|
-
args: "The command to run, after --, as an argument list with no shell. On the launch machine, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color; in a runner sandbox, the runner
|
|
46
|
+
args: "The command to run, after --, as an argument list with no shell. On the launch machine, it gets this machine's working directory and environment, less the launcher variables its resources hide, plus STORM_RUN, and FORCE_COLOR or NO_COLOR only when neither is set and the launcher asks for or opts out of color; in a runner sandbox, the Vercel Sandbox runner's cwd, its env, the runner's PATH, STORM_RUN, and FORCE_COLOR or NO_COLOR only when that env sets neither and the launcher asks for or opts out of color, with paths under the repository's root rewritten.",
|
|
91
47
|
verbose: "which asks the command to print what each test does as it happens, for passing tests too",
|
|
92
48
|
examples: [
|
|
93
49
|
{
|
|
@@ -146,31 +102,11 @@ var command_default = stormCommands.define({
|
|
|
146
102
|
const { app, signal } = context;
|
|
147
103
|
const file = await app.config.loadFile();
|
|
148
104
|
if (!file.ok) return file.refusal;
|
|
149
|
-
const {
|
|
105
|
+
const { command } = request;
|
|
150
106
|
const planRequest = { ...request, settingsFile: effectiveConfig(file, null), suite: null };
|
|
151
|
-
const
|
|
152
|
-
ok: true,
|
|
153
|
-
argv: command,
|
|
154
|
-
testPlan: NOT_COUNTED.testPlan
|
|
155
|
-
});
|
|
156
|
-
const planSandboxes = (count) => async ({ max }) => ({
|
|
157
|
-
ok: true,
|
|
158
|
-
argv: command,
|
|
159
|
-
testPlan: NOT_COUNTED.testPlan,
|
|
160
|
-
sandboxes: {
|
|
161
|
-
count: { count, from: "flag", max },
|
|
162
|
-
sandboxes: commandsForSandboxes(command, count).map((argv) => ({ argv, files: null }))
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
const plan = sandboxes === void 0 ? await planCommandRun(app, planRequest, planCommand, signal) : await planAskedSandboxesRun(
|
|
166
|
-
app,
|
|
167
|
-
planRequest,
|
|
168
|
-
{ count: sandboxes, flag: "--sandboxes" },
|
|
169
|
-
planSandboxes(sandboxes),
|
|
170
|
-
signal
|
|
171
|
-
);
|
|
107
|
+
const plan = await planRun(app, planRequest, { kind: "exec", command }, signal);
|
|
172
108
|
if (!plan.ok) return plan.refusal;
|
|
173
|
-
return await
|
|
109
|
+
return await executePlannedRun(
|
|
174
110
|
context,
|
|
175
111
|
request,
|
|
176
112
|
{
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { StormApp } from "../../context.ts";
|
|
2
2
|
import { type Driver, type RunTestPlan } from "../../sdk/extension/index.ts";
|
|
3
3
|
import type { DriverRefusals } from "../../planning/driver-refusals.ts";
|
|
4
|
-
import type {
|
|
5
|
-
import { canceledBeforeStart
|
|
6
|
-
import { checkoutFailedRefusal } from "./
|
|
4
|
+
import type { PlannedRunner } from "../../planning/run-plan.ts";
|
|
5
|
+
import { canceledBeforeStart } from "./outcomes.ts";
|
|
6
|
+
import { checkoutFailedRefusal } from "./runner-refusals.ts";
|
|
7
7
|
/**
|
|
8
8
|
* Whether a driver run counts before it starts: nothing when neither `testPlan` nor `--count-tests` asks; otherwise
|
|
9
9
|
* each test when `--count-tests` was passed or the driver always counts each test (`driver.countsFilesOnly !== true`).
|
|
@@ -38,7 +38,12 @@ export type DriverPlanRefusal = ReturnType<typeof canceledBeforeStart> | ReturnT
|
|
|
38
38
|
* the driver's argv (`launch`) over the binary the run starts. `errors` are the builders of the driver's two errors
|
|
39
39
|
* (`driverRefusals`), the ones its command's outcomes list, which `driver.refusals`, the driver's words, word.
|
|
40
40
|
*/
|
|
41
|
-
export declare function planDriverCommand(app: Pick<StormApp, "context" | "cwd" | "packageBins" | "driverContexts">, driver: Driver, errors: DriverRefusals, args: readonly string[], count: DriverCount,
|
|
41
|
+
export declare function planDriverCommand(app: Pick<StormApp, "context" | "cwd" | "packageBins" | "driverContexts">, driver: Driver, errors: DriverRefusals, args: readonly string[], count: DriverCount, runner: PlannedRunner, signal: AbortSignal): Promise<{
|
|
42
|
+
readonly ok: true;
|
|
43
|
+
readonly argv: readonly string[];
|
|
44
|
+
readonly testPlan: RunTestPlan;
|
|
45
|
+
readonly testFiles?: readonly string[];
|
|
46
|
+
} | {
|
|
42
47
|
readonly ok: false;
|
|
43
48
|
readonly refusal: DriverPlanRefusal;
|
|
44
49
|
}>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
// A program driver's part of planning a run (
|
|
2
|
-
// plan step for the test plan when the run counts, and the refusals that end the run there. Every driver of a program
|
|
3
|
-
// no command holds planning or refusal logic of its own.
|
|
1
|
+
// A program driver's part of planning a run (called from `plan-run.ts`): finding the program, asking the driver's
|
|
2
|
+
// plan step for the test plan when the run counts, and the refusals that end the run there. Every driver of a program
|
|
3
|
+
// plans through it, so no command holds planning or refusal logic of its own.
|
|
4
4
|
import { refused } from "@vercel/clinkr";
|
|
5
5
|
import { NOT_COUNTED } from "../../sdk/extension/index.js";
|
|
6
|
-
import { canceledBeforeStart } from "./
|
|
6
|
+
import { canceledBeforeStart } from "./outcomes.js";
|
|
7
7
|
import { findRunBin } from "./run-bin.js";
|
|
8
|
-
import { checkoutFailedRefusal } from "./
|
|
8
|
+
import { checkoutFailedRefusal } from "./runner-refusals.js";
|
|
9
9
|
/**
|
|
10
10
|
* Whether a driver run counts before it starts: nothing when neither `testPlan` nor `--count-tests` asks; otherwise
|
|
11
11
|
* each test when `--count-tests` was passed or the driver always counts each test (`driver.countsFilesOnly !== true`).
|
|
@@ -35,11 +35,11 @@ export function driverCount(driver, testPlan, countTests) {
|
|
|
35
35
|
* the driver's argv (`launch`) over the binary the run starts. `errors` are the builders of the driver's two errors
|
|
36
36
|
* (`driverRefusals`), the ones its command's outcomes list, which `driver.refusals`, the driver's words, word.
|
|
37
37
|
*/
|
|
38
|
-
export async function planDriverCommand(app, driver, errors, args, count,
|
|
38
|
+
export async function planDriverCommand(app, driver, errors, args, count, runner, signal) {
|
|
39
39
|
const { bin: name } = driver.program;
|
|
40
|
-
if (count === undefined &&
|
|
40
|
+
if (count === undefined && runner.kind === "vercel-sandbox")
|
|
41
41
|
return { ok: true, argv: driver.launch(name, args), testPlan: NOT_COUNTED.testPlan };
|
|
42
|
-
const bin = await findRunBin(app, name,
|
|
42
|
+
const bin = await findRunBin(app, name, runner);
|
|
43
43
|
if (bin.kind === "checkout-failed")
|
|
44
44
|
return refused(checkoutFailedRefusal(bin.failure));
|
|
45
45
|
const planned = { args, cwd: bin.cwd };
|