@cnc-tools/storm 0.0.0 → 0.5.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/bin/node-version.js +24 -0
- package/bin/storm.js +16 -0
- package/dist/application.d.ts +13 -0
- package/dist/application.js +23 -0
- package/dist/bin/storm.d.ts +1 -0
- package/dist/bin/storm.js +45 -0
- package/dist/build-info.js +3 -0
- package/dist/closed-terminal.d.ts +7 -0
- package/dist/closed-terminal.js +18 -0
- package/dist/combine-errors.d.ts +11 -0
- package/dist/combine-errors.js +19 -0
- package/dist/commands/dashboard.d.ts +11 -0
- package/dist/commands/dashboard.js +18 -0
- package/dist/commands/run/cleanup.d.ts +135 -0
- package/dist/commands/run/cleanup.js +171 -0
- package/dist/commands/run/command.d.ts +327 -0
- package/dist/commands/run/command.js +620 -0
- package/dist/commands/run/job-summary.d.ts +6 -0
- package/dist/commands/run/job-summary.js +31 -0
- package/dist/commands/run/live-view.d.ts +22 -0
- package/dist/commands/run/live-view.js +395 -0
- package/dist/commands/run/metadata.d.ts +47 -0
- package/dist/commands/run/metadata.js +83 -0
- package/dist/commands/run/mint-failed.d.ts +11 -0
- package/dist/commands/run/mint-failed.js +33 -0
- package/dist/commands/run/outcomes.d.ts +307 -0
- package/dist/commands/run/outcomes.js +332 -0
- package/dist/commands/run/progress.d.ts +44 -0
- package/dist/commands/run/progress.js +277 -0
- package/dist/commands/run/redaction.d.ts +15 -0
- package/dist/commands/run/redaction.js +40 -0
- package/dist/commands/run/run-collector.d.ts +30 -0
- package/dist/commands/run/run-collector.js +73 -0
- package/dist/commands/run/run-record.d.ts +144 -0
- package/dist/commands/run/run-record.js +96 -0
- package/dist/commands/run/tests-summary.d.ts +34 -0
- package/dist/commands/run/tests-summary.js +141 -0
- package/dist/commands/run/text.d.ts +22 -0
- package/dist/commands/run/text.js +74 -0
- package/dist/commands/run/view.d.ts +35 -0
- package/dist/commands/run/view.js +163 -0
- package/dist/commands/run/waterfall.d.ts +25 -0
- package/dist/commands/run/waterfall.js +108 -0
- package/dist/commands/run/worker-chart.d.ts +79 -0
- package/dist/commands/run/worker-chart.js +313 -0
- package/dist/commands/runs/facts.d.ts +150 -0
- package/dist/commands/runs/facts.js +292 -0
- package/dist/commands/runs/list/command.d.ts +86 -0
- package/dist/commands/runs/list/command.js +36 -0
- package/dist/commands/runs/list/metadata.d.ts +22 -0
- package/dist/commands/runs/list/metadata.js +19 -0
- package/dist/commands/runs/list/outcomes.d.ts +74 -0
- package/dist/commands/runs/list/outcomes.js +89 -0
- package/dist/commands/runs/logs/command.d.ts +72 -0
- package/dist/commands/runs/logs/command.js +51 -0
- package/dist/commands/runs/logs/metadata.d.ts +22 -0
- package/dist/commands/runs/logs/metadata.js +22 -0
- package/dist/commands/runs/logs/outcomes.d.ts +55 -0
- package/dist/commands/runs/logs/outcomes.js +77 -0
- package/dist/commands/runs/metadata.d.ts +3 -0
- package/dist/commands/runs/metadata.js +3 -0
- package/dist/commands/runs/past-run.d.ts +72 -0
- package/dist/commands/runs/past-run.js +99 -0
- package/dist/commands/runs/show/command.d.ts +176 -0
- package/dist/commands/runs/show/command.js +76 -0
- package/dist/commands/runs/show/metadata.d.ts +25 -0
- package/dist/commands/runs/show/metadata.js +22 -0
- package/dist/commands/runs/show/outcomes.d.ts +164 -0
- package/dist/commands/runs/show/outcomes.js +317 -0
- package/dist/config/by-name.d.ts +24 -0
- package/dist/config/by-name.js +26 -0
- package/dist/config/errors.d.ts +58 -0
- package/dist/config/errors.js +101 -0
- package/dist/config/gateways.d.ts +32 -0
- package/dist/config/gateways.js +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +12 -0
- package/dist/config/live/config-gateway.d.ts +6 -0
- package/dist/config/live/config-gateway.js +71 -0
- package/dist/config/load.d.ts +54 -0
- package/dist/config/load.js +175 -0
- package/dist/config/resolve.d.ts +49 -0
- package/dist/config/resolve.js +94 -0
- package/dist/config/resource-config.d.ts +132 -0
- package/dist/config/resource-config.js +19 -0
- package/dist/config/schema.d.ts +64 -0
- package/dist/config/schema.js +57 -0
- package/dist/config/set.d.ts +16 -0
- package/dist/config/set.js +55 -0
- package/dist/config/settings-file.d.ts +41 -0
- package/dist/config/settings-file.js +72 -0
- package/dist/config-file/define.d.ts +37 -0
- package/dist/config-file/define.js +9 -0
- package/dist/config-file/toolchain.d.ts +9 -0
- package/dist/config-file/toolchain.js +41 -0
- package/dist/context.d.ts +86 -0
- package/dist/context.js +43 -0
- package/dist/core/command-provider.d.ts +126 -0
- package/dist/core/command-provider.js +13 -0
- package/dist/core/command-slots.d.ts +67 -0
- package/dist/core/command-slots.js +136 -0
- package/dist/core/events.d.ts +128 -0
- package/dist/core/events.js +15 -0
- package/dist/core/gateways.d.ts +249 -0
- package/dist/core/gateways.js +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.js +18 -0
- package/dist/core/keyed.d.ts +12 -0
- package/dist/core/keyed.js +24 -0
- package/dist/core/lane.d.ts +46 -0
- package/dist/core/lane.js +5 -0
- package/dist/core/limit.d.ts +9 -0
- package/dist/core/limit.js +29 -0
- package/dist/core/live/command-gateway.d.ts +11 -0
- package/dist/core/live/command-gateway.js +83 -0
- package/dist/core/live/job-summary-gateway.d.ts +5 -0
- package/dist/core/live/job-summary-gateway.js +20 -0
- package/dist/core/live/progress-terminal.d.ts +20 -0
- package/dist/core/live/progress-terminal.js +173 -0
- package/dist/core/live/run-directory-gateway.d.ts +24 -0
- package/dist/core/live/run-directory-gateway.js +437 -0
- package/dist/core/mint.d.ts +10 -0
- package/dist/core/mint.js +14 -0
- package/dist/core/payload.d.ts +26 -0
- package/dist/core/payload.js +33 -0
- package/dist/core/presentation.d.ts +87 -0
- package/dist/core/presentation.js +5 -0
- package/dist/core/presentations.d.ts +56 -0
- package/dist/core/presentations.js +66 -0
- package/dist/core/provider.d.ts +69 -0
- package/dist/core/provider.js +5 -0
- package/dist/core/resource.d.ts +262 -0
- package/dist/core/resource.js +6 -0
- package/dist/core/resources.d.ts +131 -0
- package/dist/core/resources.js +254 -0
- package/dist/core/run-directory.d.ts +69 -0
- package/dist/core/run-directory.js +94 -0
- package/dist/core/run-state.d.ts +152 -0
- package/dist/core/run-state.js +313 -0
- package/dist/core/run.d.ts +187 -0
- package/dist/core/run.js +321 -0
- package/dist/core/state-directory.d.ts +19 -0
- package/dist/core/state-directory.js +29 -0
- package/dist/core/timeline.d.ts +63 -0
- package/dist/core/timeline.js +97 -0
- package/dist/core/timing.d.ts +22 -0
- package/dist/core/timing.js +26 -0
- package/dist/credential/credential.d.ts +46 -0
- package/dist/credential/credential.js +80 -0
- package/dist/credential/diagnosis.d.ts +18 -0
- package/dist/credential/diagnosis.js +99 -0
- package/dist/credential/gateways.d.ts +109 -0
- package/dist/credential/gateways.js +1 -0
- package/dist/credential/index.d.ts +7 -0
- package/dist/credential/index.js +7 -0
- package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
- package/dist/credential/live/github-actions-token-gateway.js +43 -0
- package/dist/credential/live/github-actions-token-response.d.ts +19 -0
- package/dist/credential/live/github-actions-token-response.js +49 -0
- package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
- package/dist/credential/live/vercel-cli-gateway.js +64 -0
- package/dist/credential/live/vercel-output.d.ts +60 -0
- package/dist/credential/live/vercel-output.js +122 -0
- package/dist/credential/live/vercel-process.d.ts +14 -0
- package/dist/credential/live/vercel-process.js +3 -0
- package/dist/credential/settle.d.ts +31 -0
- package/dist/credential/settle.js +49 -0
- package/dist/credential/source.d.ts +110 -0
- package/dist/credential/source.js +114 -0
- package/dist/help-logo.d.ts +11 -0
- package/dist/help-logo.js +56 -0
- package/dist/presentation.d.ts +26 -0
- package/dist/presentation.js +21 -0
- package/dist/resources/github/cleanup.d.ts +23 -0
- package/dist/resources/github/cleanup.js +39 -0
- package/dist/resources/github/command.d.ts +74 -0
- package/dist/resources/github/command.js +117 -0
- package/dist/resources/github/config.d.ts +16 -0
- package/dist/resources/github/config.js +37 -0
- package/dist/resources/github/events.d.ts +26 -0
- package/dist/resources/github/events.js +2 -0
- package/dist/resources/github/fixture-repo.d.ts +69 -0
- package/dist/resources/github/fixture-repo.js +60 -0
- package/dist/resources/github/gateways.d.ts +62 -0
- package/dist/resources/github/gateways.js +1 -0
- package/dist/resources/github/index.d.ts +12 -0
- package/dist/resources/github/index.js +15 -0
- package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
- package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
- package/dist/resources/github/live/gateways.d.ts +6 -0
- package/dist/resources/github/live/gateways.js +13 -0
- package/dist/resources/github/presentation.d.ts +13 -0
- package/dist/resources/github/presentation.js +43 -0
- package/dist/resources/github/provider.d.ts +66 -0
- package/dist/resources/github/provider.js +58 -0
- package/dist/resources/github/resource-provider.d.ts +6 -0
- package/dist/resources/github/resource-provider.js +20 -0
- package/dist/resources/github/resource.d.ts +33 -0
- package/dist/resources/github/resource.js +12 -0
- package/dist/resources/testserver/cleanup.d.ts +14 -0
- package/dist/resources/testserver/cleanup.js +22 -0
- package/dist/resources/testserver/command.d.ts +322 -0
- package/dist/resources/testserver/command.js +245 -0
- package/dist/resources/testserver/commands/app.d.ts +18 -0
- package/dist/resources/testserver/commands/app.js +3 -0
- package/dist/resources/testserver/commands/create/command.d.ts +136 -0
- package/dist/resources/testserver/commands/create/command.js +158 -0
- package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
- package/dist/resources/testserver/commands/create/metadata.js +45 -0
- package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
- package/dist/resources/testserver/commands/create/outcomes.js +172 -0
- package/dist/resources/testserver/commands/list/command.d.ts +60 -0
- package/dist/resources/testserver/commands/list/command.js +56 -0
- package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
- package/dist/resources/testserver/commands/list/metadata.js +9 -0
- package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
- package/dist/resources/testserver/commands/list/outcomes.js +152 -0
- package/dist/resources/testserver/config.d.ts +18 -0
- package/dist/resources/testserver/config.js +77 -0
- package/dist/resources/testserver/credential-facts.d.ts +80 -0
- package/dist/resources/testserver/credential-facts.js +83 -0
- package/dist/resources/testserver/events.d.ts +59 -0
- package/dist/resources/testserver/events.js +4 -0
- package/dist/resources/testserver/index.d.ts +16 -0
- package/dist/resources/testserver/index.js +24 -0
- package/dist/resources/testserver/lane.d.ts +28 -0
- package/dist/resources/testserver/lane.js +139 -0
- package/dist/resources/testserver/live/gateways.d.ts +6 -0
- package/dist/resources/testserver/live/gateways.js +26 -0
- package/dist/resources/testserver/options.d.ts +5 -0
- package/dist/resources/testserver/options.js +5 -0
- package/dist/resources/testserver/pool/channels.d.ts +80 -0
- package/dist/resources/testserver/pool/channels.js +48 -0
- package/dist/resources/testserver/pool/create.d.ts +48 -0
- package/dist/resources/testserver/pool/create.js +45 -0
- package/dist/resources/testserver/pool/directory.d.ts +4 -0
- package/dist/resources/testserver/pool/directory.js +5 -0
- package/dist/resources/testserver/pool/gateways.d.ts +190 -0
- package/dist/resources/testserver/pool/gateways.js +1 -0
- package/dist/resources/testserver/pool/host.d.ts +8 -0
- package/dist/resources/testserver/pool/host.js +21 -0
- package/dist/resources/testserver/pool/index.d.ts +9 -0
- package/dist/resources/testserver/pool/index.js +10 -0
- package/dist/resources/testserver/pool/inspect.d.ts +53 -0
- package/dist/resources/testserver/pool/inspect.js +45 -0
- package/dist/resources/testserver/pool/lease.d.ts +84 -0
- package/dist/resources/testserver/pool/lease.js +125 -0
- package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
- package/dist/resources/testserver/pool/live/pool-records.js +70 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
- package/dist/resources/testserver/pool/staleness.d.ts +16 -0
- package/dist/resources/testserver/pool/staleness.js +27 -0
- package/dist/resources/testserver/presentation.d.ts +9 -0
- package/dist/resources/testserver/presentation.js +217 -0
- package/dist/resources/testserver/provider.d.ts +177 -0
- package/dist/resources/testserver/provider.js +254 -0
- package/dist/resources/testserver/ran.d.ts +87 -0
- package/dist/resources/testserver/ran.js +140 -0
- package/dist/resources/testserver/resource-provider.d.ts +12 -0
- package/dist/resources/testserver/resource-provider.js +38 -0
- package/dist/resources/testserver/resource.d.ts +32 -0
- package/dist/resources/testserver/resource.js +10 -0
- package/dist/resources/testserver/run-sandbox.d.ts +13 -0
- package/dist/resources/testserver/run-sandbox.js +6 -0
- package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
- package/dist/resources/testserver/sandbox/channels.js +21 -0
- package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
- package/dist/resources/testserver/sandbox/create-failure.js +65 -0
- package/dist/resources/testserver/sandbox/create.d.ts +29 -0
- package/dist/resources/testserver/sandbox/create.js +37 -0
- package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
- package/dist/resources/testserver/sandbox/gateways.js +1 -0
- package/dist/resources/testserver/sandbox/index.d.ts +6 -0
- package/dist/resources/testserver/sandbox/index.js +7 -0
- package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
- package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
- package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
- package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
- package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
- package/dist/resources/testserver/sandbox/live/sse.js +32 -0
- package/dist/resources.d.ts +452 -0
- package/dist/resources.js +88 -0
- package/dist/runner/base.d.ts +40 -0
- package/dist/runner/base.js +52 -0
- package/dist/runner/context.d.ts +13 -0
- package/dist/runner/context.js +9 -0
- package/dist/runner/events.d.ts +179 -0
- package/dist/runner/events.js +16 -0
- package/dist/runner/gateways.d.ts +351 -0
- package/dist/runner/gateways.js +3 -0
- package/dist/runner/index.d.ts +19 -0
- package/dist/runner/index.js +18 -0
- package/dist/runner/live/checkout-gateway.d.ts +3 -0
- package/dist/runner/live/checkout-gateway.js +206 -0
- package/dist/runner/live/git-output.d.ts +14 -0
- package/dist/runner/live/git-output.js +32 -0
- package/dist/runner/live/sandbox-errors.d.ts +7 -0
- package/dist/runner/live/sandbox-errors.js +21 -0
- package/dist/runner/live/sandbox-gateway.d.ts +7 -0
- package/dist/runner/live/sandbox-gateway.js +427 -0
- package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
- package/dist/runner/live/snapshot-cache-gateway.js +104 -0
- package/dist/runner/live/snapshot-records.d.ts +11 -0
- package/dist/runner/live/snapshot-records.js +57 -0
- package/dist/runner/live/terminal.d.ts +16 -0
- package/dist/runner/live/terminal.js +37 -0
- package/dist/runner/live/user.d.ts +2 -0
- package/dist/runner/live/user.js +11 -0
- package/dist/runner/output.d.ts +23 -0
- package/dist/runner/output.js +58 -0
- package/dist/runner/prepare.d.ts +67 -0
- package/dist/runner/prepare.js +59 -0
- package/dist/runner/ready.d.ts +68 -0
- package/dist/runner/ready.js +159 -0
- package/dist/runner/recipe.d.ts +126 -0
- package/dist/runner/recipe.js +302 -0
- package/dist/runner/remote-command.d.ts +77 -0
- package/dist/runner/remote-command.js +127 -0
- package/dist/runner/scope.d.ts +58 -0
- package/dist/runner/scope.js +117 -0
- package/dist/runner/snapshot-build.d.ts +33 -0
- package/dist/runner/snapshot-build.js +112 -0
- package/dist/runner/snapshot-cache.d.ts +84 -0
- package/dist/runner/snapshot-cache.js +126 -0
- package/dist/runner/snapshot-key.d.ts +52 -0
- package/dist/runner/snapshot-key.js +91 -0
- package/dist/runner/steps.d.ts +41 -0
- package/dist/runner/steps.js +49 -0
- package/dist/sdk/container/api-request.d.ts +32 -0
- package/dist/sdk/container/api-request.js +46 -0
- package/dist/sdk/container/container.d.ts +144 -0
- package/dist/sdk/container/container.js +346 -0
- package/dist/sdk/container/feature-flags.d.ts +37 -0
- package/dist/sdk/container/feature-flags.js +118 -0
- package/dist/sdk/container/gateways.d.ts +108 -0
- package/dist/sdk/container/gateways.js +1 -0
- package/dist/sdk/container/index.d.ts +5 -0
- package/dist/sdk/container/index.js +5 -0
- package/dist/sdk/container/live/container-gateway.d.ts +17 -0
- package/dist/sdk/container/live/container-gateway.js +114 -0
- package/dist/sdk/factories/build.d.ts +66 -0
- package/dist/sdk/factories/build.js +98 -0
- package/dist/sdk/factories/definition.d.ts +28 -0
- package/dist/sdk/factories/definition.js +16 -0
- package/dist/sdk/factories/definitions.d.ts +166 -0
- package/dist/sdk/factories/definitions.js +235 -0
- package/dist/sdk/factories/gateways.d.ts +25 -0
- package/dist/sdk/factories/gateways.js +1 -0
- package/dist/sdk/factories/index.d.ts +5 -0
- package/dist/sdk/factories/index.js +5 -0
- package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
- package/dist/sdk/factories/live/factory-gateway.js +29 -0
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.js +15 -0
- package/dist/sdk/payload/index.d.ts +2 -0
- package/dist/sdk/payload/index.js +4 -0
- package/dist/sdk/payload/payload.d.ts +47 -0
- package/dist/sdk/payload/payload.js +74 -0
- package/dist/sdk/payload/test-events.d.ts +102 -0
- package/dist/sdk/payload/test-events.js +59 -0
- package/dist/sdk/proxy/exchange.d.ts +58 -0
- package/dist/sdk/proxy/exchange.js +173 -0
- package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
- package/dist/sdk/proxy/faulted-exchange.js +106 -0
- package/dist/sdk/proxy/faults.d.ts +133 -0
- package/dist/sdk/proxy/faults.js +147 -0
- package/dist/sdk/proxy/index.d.ts +3 -0
- package/dist/sdk/proxy/index.js +3 -0
- package/dist/sdk/proxy/proxy.d.ts +93 -0
- package/dist/sdk/proxy/proxy.js +99 -0
- package/dist/sdk/proxy/records.d.ts +56 -0
- package/dist/sdk/proxy/records.js +56 -0
- package/dist/sdk/records/body.d.ts +89 -0
- package/dist/sdk/records/body.js +236 -0
- package/dist/sdk/records/index.d.ts +2 -0
- package/dist/sdk/records/index.js +4 -0
- package/dist/sdk/records/records.d.ts +49 -0
- package/dist/sdk/records/records.js +16 -0
- package/dist/sdk/seed/index.d.ts +1 -0
- package/dist/sdk/seed/index.js +3 -0
- package/dist/sdk/seed/seed.d.ts +221 -0
- package/dist/sdk/seed/seed.js +171 -0
- package/dist/sdk/testserver/clock.d.ts +8 -0
- package/dist/sdk/testserver/clock.js +10 -0
- package/dist/sdk/testserver/failure.d.ts +73 -0
- package/dist/sdk/testserver/failure.js +61 -0
- package/dist/sdk/testserver/index.d.ts +5 -0
- package/dist/sdk/testserver/index.js +8 -0
- package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
- package/dist/sdk/testserver/live/connect-failure.js +30 -0
- package/dist/sdk/testserver/live/request.d.ts +69 -0
- package/dist/sdk/testserver/live/request.js +89 -0
- package/dist/sdk/testserver/service-ids.d.ts +19 -0
- package/dist/sdk/testserver/service-ids.js +77 -0
- package/dist/sdk/testserver/test-id.d.ts +15 -0
- package/dist/sdk/testserver/test-id.js +28 -0
- package/dist/story/align.d.ts +37 -0
- package/dist/story/align.js +39 -0
- package/dist/story/artifact.d.ts +60 -0
- package/dist/story/artifact.js +93 -0
- package/dist/story/definition.d.ts +52 -0
- package/dist/story/definition.js +9 -0
- package/dist/story/diff.d.ts +9 -0
- package/dist/story/diff.js +97 -0
- package/dist/story/errors.d.ts +14 -0
- package/dist/story/errors.js +21 -0
- package/dist/story/gateways.d.ts +74 -0
- package/dist/story/gateways.js +3 -0
- package/dist/story/host.d.ts +27 -0
- package/dist/story/host.js +97 -0
- package/dist/story/index.d.ts +7 -0
- package/dist/story/index.js +9 -0
- package/dist/story/json.d.ts +16 -0
- package/dist/story/json.js +59 -0
- package/dist/story/live/artifact-gateway.d.ts +2 -0
- package/dist/story/live/artifact-gateway.js +82 -0
- package/dist/story/mode.d.ts +17 -0
- package/dist/story/mode.js +21 -0
- package/dist/story/orphans.d.ts +17 -0
- package/dist/story/orphans.js +15 -0
- package/dist/story/report.d.ts +30 -0
- package/dist/story/report.js +118 -0
- package/dist/story/run.d.ts +49 -0
- package/dist/story/run.js +160 -0
- package/dist/story/sequence.d.ts +30 -0
- package/dist/story/sequence.js +74 -0
- package/dist/story/settle.d.ts +94 -0
- package/dist/story/settle.js +70 -0
- package/dist/time/duration.d.ts +19 -0
- package/dist/time/duration.js +37 -0
- package/dist/time/index.d.ts +2 -0
- package/dist/time/index.js +4 -0
- package/dist/time/time.d.ts +15 -0
- package/dist/time/time.js +23 -0
- package/dist/vercel-cli/ansi.d.ts +13 -0
- package/dist/vercel-cli/ansi.js +32 -0
- package/dist/vercel-cli/arguments.d.ts +25 -0
- package/dist/vercel-cli/arguments.js +78 -0
- package/dist/vercel-cli/auth-config.d.ts +43 -0
- package/dist/vercel-cli/auth-config.js +36 -0
- package/dist/vercel-cli/clock.d.ts +9 -0
- package/dist/vercel-cli/clock.js +10 -0
- package/dist/vercel-cli/config-files.d.ts +24 -0
- package/dist/vercel-cli/config-files.js +40 -0
- package/dist/vercel-cli/context.d.ts +12 -0
- package/dist/vercel-cli/context.js +12 -0
- package/dist/vercel-cli/driver.d.ts +218 -0
- package/dist/vercel-cli/driver.js +364 -0
- package/dist/vercel-cli/entry.d.ts +8 -0
- package/dist/vercel-cli/entry.js +13 -0
- package/dist/vercel-cli/environment.d.ts +33 -0
- package/dist/vercel-cli/environment.js +72 -0
- package/dist/vercel-cli/errors.d.ts +8 -0
- package/dist/vercel-cli/errors.js +8 -0
- package/dist/vercel-cli/gateways.d.ts +103 -0
- package/dist/vercel-cli/gateways.js +4 -0
- package/dist/vercel-cli/index.d.ts +10 -0
- package/dist/vercel-cli/index.js +15 -0
- package/dist/vercel-cli/invocation.d.ts +234 -0
- package/dist/vercel-cli/invocation.js +397 -0
- package/dist/vercel-cli/keys.d.ts +14 -0
- package/dist/vercel-cli/keys.js +12 -0
- package/dist/vercel-cli/live/config-files.d.ts +28 -0
- package/dist/vercel-cli/live/config-files.js +66 -0
- package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
- package/dist/vercel-cli/live/process-gateway.js +178 -0
- package/dist/vercel-cli/redaction.d.ts +13 -0
- package/dist/vercel-cli/redaction.js +22 -0
- package/dist/vercel-cli/report.d.ts +22 -0
- package/dist/vercel-cli/report.js +110 -0
- package/dist/vercel-cli/verbose.d.ts +7 -0
- package/dist/vercel-cli/verbose.js +24 -0
- package/dist/version.d.ts +20 -0
- package/dist/version.js +57 -0
- package/dist/vitest/config.d.ts +51 -0
- package/dist/vitest/config.js +61 -0
- package/dist/vitest/container-scope.d.ts +108 -0
- package/dist/vitest/container-scope.js +234 -0
- package/dist/vitest/diagnostics.d.ts +146 -0
- package/dist/vitest/diagnostics.js +306 -0
- package/dist/vitest/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +47 -0
- package/dist/vitest/gateways.js +3 -0
- package/dist/vitest/index.d.ts +3 -0
- package/dist/vitest/index.js +9 -0
- package/dist/vitest/list-output.d.ts +3 -0
- package/dist/vitest/list-output.js +19 -0
- package/dist/vitest/live/list-gateway.d.ts +7 -0
- package/dist/vitest/live/list-gateway.js +60 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +33 -0
- package/dist/vitest/plan.js +73 -0
- package/dist/vitest/sandbox.d.ts +16 -0
- package/dist/vitest/sandbox.js +35 -0
- package/dist/vitest/test-events.d.ts +41 -0
- package/dist/vitest/test-events.js +92 -0
- package/dist/vitest/test-results.d.ts +84 -0
- package/dist/vitest/test-results.js +160 -0
- package/dist/vitest/types.d.ts +68 -0
- package/dist/vitest/types.js +4 -0
- package/package.json +119 -3
- package/skills/overview.md +32 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// The live runner terminal: this process's stdout and stderr. Once a write to either fails, as one does with EIO or
|
|
2
|
+
// EPIPE after SIGHUP closes the terminal, it stops writing, so a closed terminal can't crash storm before it
|
|
3
|
+
// cleans up its sandboxes.
|
|
4
|
+
/**
|
|
5
|
+
* A terminal over `stdout` and `stderr`, by default this process's. It shows color when stdout is a TTY and the
|
|
6
|
+
* host environment doesn't set `NO_COLOR`.
|
|
7
|
+
*/
|
|
8
|
+
export function liveRunnerTerminal(options) {
|
|
9
|
+
const stdout = options.stdout ?? process.stdout;
|
|
10
|
+
const stderr = options.stderr ?? process.stderr;
|
|
11
|
+
let failed = false;
|
|
12
|
+
let listening = false;
|
|
13
|
+
const fail = () => {
|
|
14
|
+
failed = true;
|
|
15
|
+
};
|
|
16
|
+
const write = (stream, text) => {
|
|
17
|
+
if (failed)
|
|
18
|
+
return;
|
|
19
|
+
if (!listening) {
|
|
20
|
+
// An asynchronous write error arrives as an `error` event, which would crash the process unheard.
|
|
21
|
+
stdout.on("error", fail);
|
|
22
|
+
stderr.on("error", fail);
|
|
23
|
+
listening = true;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
stream.write(text);
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
fail();
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
color: stdout.isTTY === true && options.env["NO_COLOR"] === undefined,
|
|
34
|
+
writeStdout: (text) => write(stdout, text),
|
|
35
|
+
writeStderr: (text) => write(stderr, text),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// The local user name a runner's sandboxes are tagged with.
|
|
2
|
+
import { userInfo } from "node:os";
|
|
3
|
+
/** This machine's user name, or `unknown` where the OS has none, such as a container without a passwd entry. */
|
|
4
|
+
export function localUserName() {
|
|
5
|
+
try {
|
|
6
|
+
return userInfo().username;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return "unknown";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** How many of a failed step's last output lines its error carries. */
|
|
2
|
+
export declare const OUTPUT_TAIL_LINES = 40;
|
|
3
|
+
/** Splits one stream's chunks into whole lines. */
|
|
4
|
+
export interface LineSplitter {
|
|
5
|
+
/** Adds `chunk`, and answers the whole lines it completes, each with its `\n`, or `""`. */
|
|
6
|
+
push(chunk: string): string;
|
|
7
|
+
/** Answers what is left, a last line without its `\n` or `""`, and empties the splitter. */
|
|
8
|
+
flush(): string;
|
|
9
|
+
}
|
|
10
|
+
/** Splits one stream's chunks into whole lines, of any length: a long line costs its chunks' length, not more. */
|
|
11
|
+
export declare function lineSplitter(): LineSplitter;
|
|
12
|
+
/** Rewrites each `<fromRoot>/` in `text` to `<toRoot>/`, whatever trailing slashes either root is given with. */
|
|
13
|
+
export declare function rewritePaths(text: string, fromRoot: string, toRoot: string): string;
|
|
14
|
+
/** A rule line holding `text`: `── <text> `, padded with `─` to `width` columns, and at least two. */
|
|
15
|
+
export declare function outputRule(text: string, width?: number): string;
|
|
16
|
+
/** Keeps the last `limit` lines it is given. */
|
|
17
|
+
export interface OutputTail {
|
|
18
|
+
add(line: string): void;
|
|
19
|
+
lines(): readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function outputTail(limit?: number): OutputTail;
|
|
22
|
+
/** The lines of `text`, a splitter's output: each line without its `\n`, and no empty tail. */
|
|
23
|
+
export declare function splitLines(text: string): string[];
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// What happens to output streamed back from a sandbox: split into lines per stream, so a path is never cut in half,
|
|
2
|
+
// paths rewritten between the sandbox and this checkout, the last lines kept for an error, and the rule lines that
|
|
3
|
+
// mark where streamed output starts and ends.
|
|
4
|
+
/** How many of a failed step's last output lines its error carries. */
|
|
5
|
+
export const OUTPUT_TAIL_LINES = 40;
|
|
6
|
+
/** Splits one stream's chunks into whole lines, of any length: a long line costs its chunks' length, not more. */
|
|
7
|
+
export function lineSplitter() {
|
|
8
|
+
let buffer = "";
|
|
9
|
+
return {
|
|
10
|
+
push(chunk) {
|
|
11
|
+
// Only the chunk is searched, so a line that spans many chunks isn't searched again for each.
|
|
12
|
+
const end = chunk.lastIndexOf("\n");
|
|
13
|
+
if (end === -1) {
|
|
14
|
+
buffer += chunk;
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
const lines = buffer + chunk.slice(0, end + 1);
|
|
18
|
+
buffer = chunk.slice(end + 1);
|
|
19
|
+
return lines;
|
|
20
|
+
},
|
|
21
|
+
flush() {
|
|
22
|
+
const rest = buffer;
|
|
23
|
+
buffer = "";
|
|
24
|
+
return rest;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** Rewrites each `<fromRoot>/` in `text` to `<toRoot>/`, whatever trailing slashes either root is given with. */
|
|
29
|
+
export function rewritePaths(text, fromRoot, toRoot) {
|
|
30
|
+
const from = `${fromRoot.replace(/\/+$/, "")}/`;
|
|
31
|
+
const to = `${toRoot.replace(/\/+$/, "")}/`;
|
|
32
|
+
return text.split(from).join(to);
|
|
33
|
+
}
|
|
34
|
+
/** A rule line holding `text`: `── <text> `, padded with `─` to `width` columns, and at least two. */
|
|
35
|
+
export function outputRule(text, width = 80) {
|
|
36
|
+
const head = `── ${text} `;
|
|
37
|
+
return head + "─".repeat(Math.max(2, width - head.length));
|
|
38
|
+
}
|
|
39
|
+
export function outputTail(limit = OUTPUT_TAIL_LINES) {
|
|
40
|
+
const kept = [];
|
|
41
|
+
return {
|
|
42
|
+
add(line) {
|
|
43
|
+
kept.push(line);
|
|
44
|
+
if (kept.length > limit)
|
|
45
|
+
kept.shift();
|
|
46
|
+
},
|
|
47
|
+
lines: () => [...kept],
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
/** The lines of `text`, a splitter's output: each line without its `\n`, and no empty tail. */
|
|
51
|
+
export function splitLines(text) {
|
|
52
|
+
if (text === "")
|
|
53
|
+
return [];
|
|
54
|
+
const lines = text.split("\n");
|
|
55
|
+
if (lines.at(-1) === "")
|
|
56
|
+
lines.pop();
|
|
57
|
+
return lines;
|
|
58
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type RefusedBaseRef } from "./base.ts";
|
|
2
|
+
import type { CheckoutFailure, CheckoutUpload } from "./gateways.ts";
|
|
3
|
+
import { type CheckedRecipe, type RunnerResources, type RunnerStep } from "./recipe.ts";
|
|
4
|
+
import { type RunnerSnapshotCandidate, type SnapshotCacheContext, type SnapshotCacheNote } from "./snapshot-cache.ts";
|
|
5
|
+
/** What `prepareRunner` needs: the checkout, the runner snapshot cache and the clock. */
|
|
6
|
+
export type RunnerPrepareContext = SnapshotCacheContext;
|
|
7
|
+
export interface PrepareRunnerRequest {
|
|
8
|
+
/** The directory the run started in, inside the checkout. */
|
|
9
|
+
readonly cwd: string;
|
|
10
|
+
readonly recipe: CheckedRecipe;
|
|
11
|
+
/** The resources the run holds, for the recipe's `vcpus`. */
|
|
12
|
+
readonly resources: RunnerResources;
|
|
13
|
+
/** `--rebuild-snapshot`: the run builds a runner snapshot whatever the cache holds, so the cache isn't read. */
|
|
14
|
+
readonly rebuild: boolean;
|
|
15
|
+
}
|
|
16
|
+
/** A runner run checked on this machine, ready for the remote side. */
|
|
17
|
+
export interface PreparedRunner {
|
|
18
|
+
readonly recipe: CheckedRecipe;
|
|
19
|
+
readonly repoRoot: string;
|
|
20
|
+
/** The run's base, a full SHA, and the ref it is HEAD's merge-base with. */
|
|
21
|
+
readonly base: string;
|
|
22
|
+
readonly baseRef: string;
|
|
23
|
+
/** The recipe's snapshot steps at the base, and their snapshot key. */
|
|
24
|
+
readonly toolchains: readonly RunnerStep[];
|
|
25
|
+
readonly warm: readonly RunnerStep[];
|
|
26
|
+
readonly snapshotKey: string;
|
|
27
|
+
/** The runner sandbox's vCPUs for the run's resources. */
|
|
28
|
+
readonly vcpus: number;
|
|
29
|
+
readonly upload: CheckoutUpload;
|
|
30
|
+
/** The cached runner snapshots the run may start from, before the team and project filter (`pickSnapshot`). */
|
|
31
|
+
readonly candidates: readonly RunnerSnapshotCandidate[];
|
|
32
|
+
readonly rebuild: boolean;
|
|
33
|
+
/** What the cache read noticed, for the run to report. */
|
|
34
|
+
readonly notes: readonly SnapshotCacheNote[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* How the local checks ended.
|
|
38
|
+
*
|
|
39
|
+
* - `ok`: the run is ready for the remote side.
|
|
40
|
+
* - `no-base-ref`: no ref in `baseRefs` exists locally and shares history with HEAD; `refs` says why for each.
|
|
41
|
+
* - `submodules`: the checkout has Git submodules, at `paths`.
|
|
42
|
+
* - `invalid-recipe`: a step function or `vcpus` failed or returned something storm can't use, at the run's
|
|
43
|
+
* base or for its resources; `path` is the key inside the recipe.
|
|
44
|
+
* - `checkout-failed`: git or tar failed, such as outside a Git checkout.
|
|
45
|
+
*/
|
|
46
|
+
export type PrepareRunnerOutcome = {
|
|
47
|
+
readonly kind: "ok";
|
|
48
|
+
readonly prepared: PreparedRunner;
|
|
49
|
+
} | {
|
|
50
|
+
readonly kind: "no-base-ref";
|
|
51
|
+
readonly refs: readonly RefusedBaseRef[];
|
|
52
|
+
} | {
|
|
53
|
+
readonly kind: "submodules";
|
|
54
|
+
readonly paths: readonly string[];
|
|
55
|
+
} | {
|
|
56
|
+
readonly kind: "invalid-recipe";
|
|
57
|
+
readonly path: readonly string[];
|
|
58
|
+
readonly problem: string;
|
|
59
|
+
} | {
|
|
60
|
+
readonly kind: "checkout-failed";
|
|
61
|
+
readonly failure: CheckoutFailure;
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Runs the local checks in order: the repository's root, the base, the submodule refusal, the snapshot steps at the
|
|
65
|
+
* base and their key, the runner's vCPUs, the upload, and the cache read. It never mints, leases or creates.
|
|
66
|
+
*/
|
|
67
|
+
export declare function prepareRunner(context: RunnerPrepareContext, request: PrepareRunnerRequest): Promise<PrepareRunnerOutcome>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// A runner run's local checks: everything it can find out on this machine before it mints, leases or creates
|
|
2
|
+
// anything, so a missing base, a checkout with submodules or a recipe storm can't use fails with nothing to
|
|
3
|
+
// clean up.
|
|
4
|
+
import { resolveBase } from "./base.js";
|
|
5
|
+
import { resolveVcpus } from "./recipe.js";
|
|
6
|
+
import { findSnapshotCandidates, } from "./snapshot-cache.js";
|
|
7
|
+
import { snapshotStepsAt } from "./snapshot-key.js";
|
|
8
|
+
/**
|
|
9
|
+
* Runs the local checks in order: the repository's root, the base, the submodule refusal, the snapshot steps at the
|
|
10
|
+
* base and their key, the runner's vCPUs, the upload, and the cache read. It never mints, leases or creates.
|
|
11
|
+
*/
|
|
12
|
+
export async function prepareRunner(context, request) {
|
|
13
|
+
const { checkout } = context;
|
|
14
|
+
const { recipe } = request;
|
|
15
|
+
const root = await checkout.repositoryRoot({ cwd: request.cwd });
|
|
16
|
+
if (!root.ok)
|
|
17
|
+
return { kind: "checkout-failed", failure: root.failure };
|
|
18
|
+
const repoRoot = root.value;
|
|
19
|
+
const resolved = await resolveBase(checkout, { repoRoot, baseRefs: recipe.baseRefs });
|
|
20
|
+
if (resolved.kind === "failed")
|
|
21
|
+
return { kind: "checkout-failed", failure: resolved.failure };
|
|
22
|
+
if (resolved.kind === "no-base-ref")
|
|
23
|
+
return resolved;
|
|
24
|
+
const { base } = resolved;
|
|
25
|
+
const submodules = await checkout.submodules({ repoRoot });
|
|
26
|
+
if (!submodules.ok)
|
|
27
|
+
return { kind: "checkout-failed", failure: submodules.failure };
|
|
28
|
+
if (submodules.value.length > 0)
|
|
29
|
+
return { kind: "submodules", paths: [...submodules.value] };
|
|
30
|
+
const steps = await snapshotStepsAt(checkout, { repoRoot, base, recipe });
|
|
31
|
+
if (!steps.ok)
|
|
32
|
+
return { kind: "invalid-recipe", path: steps.path, problem: steps.problem };
|
|
33
|
+
const vcpus = resolveVcpus(recipe, request.resources);
|
|
34
|
+
if (!vcpus.ok)
|
|
35
|
+
return { kind: "invalid-recipe", path: ["vcpus"], problem: vcpus.problem };
|
|
36
|
+
const upload = await checkout.assembleUpload({ repoRoot, base });
|
|
37
|
+
if (!upload.ok)
|
|
38
|
+
return { kind: "checkout-failed", failure: upload.failure };
|
|
39
|
+
const cache = request.rebuild
|
|
40
|
+
? { candidates: [], notes: [] }
|
|
41
|
+
: await findSnapshotCandidates(context, { repoRoot, recipe });
|
|
42
|
+
return {
|
|
43
|
+
kind: "ok",
|
|
44
|
+
prepared: {
|
|
45
|
+
recipe,
|
|
46
|
+
repoRoot,
|
|
47
|
+
base,
|
|
48
|
+
baseRef: resolved.ref,
|
|
49
|
+
toolchains: steps.toolchains,
|
|
50
|
+
warm: steps.warm,
|
|
51
|
+
snapshotKey: steps.key,
|
|
52
|
+
vcpus: vcpus.vcpus,
|
|
53
|
+
upload: upload.value,
|
|
54
|
+
candidates: cache.candidates,
|
|
55
|
+
rebuild: request.rebuild,
|
|
56
|
+
notes: cache.notes,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type RunnerContext } from "./context.ts";
|
|
2
|
+
import type { RunnerFailure, RunnerProgress } from "./events.ts";
|
|
3
|
+
import type { CheckoutUpload, RunnerSandbox, RunnerSnapshotCacheFailure, RunnerSnapshotEntry, SandboxAccess, StagedFile } from "./gateways.ts";
|
|
4
|
+
import type { PreparedRunner } from "./prepare.ts";
|
|
5
|
+
import type { RunnerSandboxScope } from "./scope.ts";
|
|
6
|
+
/** The label of the step that applies and commits the run's changes in the runner sandbox. */
|
|
7
|
+
export declare const APPLY_LABEL = "Applying your changes";
|
|
8
|
+
/** A runner sandbox ready for the command. */
|
|
9
|
+
export interface ReadyRunner {
|
|
10
|
+
readonly sandbox: RunnerSandbox;
|
|
11
|
+
readonly snapshotId: string;
|
|
12
|
+
/** The base of the runner snapshot it started from, which its repository holds as its first commit. */
|
|
13
|
+
readonly base: string;
|
|
14
|
+
/** Whether this run built the runner snapshot. */
|
|
15
|
+
readonly built: boolean;
|
|
16
|
+
readonly vcpus: number;
|
|
17
|
+
readonly region: string;
|
|
18
|
+
readonly runtime: string;
|
|
19
|
+
/** The checkout's root on this machine, which `/vercel/sandbox/` in output is rewritten to. */
|
|
20
|
+
readonly repoRoot: string;
|
|
21
|
+
/** The command's directory in the runner sandbox. */
|
|
22
|
+
readonly cwd: string;
|
|
23
|
+
/** The recipe's extra environment for the command. */
|
|
24
|
+
readonly env: Readonly<Record<string, string>>;
|
|
25
|
+
/** A login shell's `PATH` in the runner sandbox. */
|
|
26
|
+
readonly loginPath: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* How readying ended.
|
|
30
|
+
*
|
|
31
|
+
* - `ready`: the runner sandbox is ready for the command.
|
|
32
|
+
* - `snapshot-gone`: starting from cached runner snapshot `entry` answered that it is gone, so its entry was removed;
|
|
33
|
+
* `removal` is why it couldn't be, if it couldn't. The run says to run again.
|
|
34
|
+
* - `failed`: a step, a Sandbox call or the checkout failed.
|
|
35
|
+
* - `aborted`: the run's signal aborted.
|
|
36
|
+
*
|
|
37
|
+
* Whichever way it ends, the sandboxes it started belong to the scope, which the caller closes.
|
|
38
|
+
*/
|
|
39
|
+
export type ReadyRunnerOutcome = {
|
|
40
|
+
readonly kind: "ready";
|
|
41
|
+
readonly runner: ReadyRunner;
|
|
42
|
+
} | {
|
|
43
|
+
readonly kind: "snapshot-gone";
|
|
44
|
+
readonly entry: RunnerSnapshotEntry;
|
|
45
|
+
readonly removal: RunnerSnapshotCacheFailure | undefined;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: "failed";
|
|
48
|
+
readonly failure: RunnerFailure;
|
|
49
|
+
} | {
|
|
50
|
+
readonly kind: "aborted";
|
|
51
|
+
};
|
|
52
|
+
export interface ReadyRunnerRequest {
|
|
53
|
+
readonly prepared: PreparedRunner;
|
|
54
|
+
readonly access: SandboxAccess;
|
|
55
|
+
/** The local user, for each sandbox's `user` tag. */
|
|
56
|
+
readonly user: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Readies the runner sandbox for a prepared run. Of the cached candidates for the access's team and project, it
|
|
60
|
+
* starts from the one whose base is nearest HEAD; with none, or under `--rebuild-snapshot`, it builds a runner
|
|
61
|
+
* snapshot of the run's base first. It uploads what the checkout changes on top of the snapshot's base.
|
|
62
|
+
*/
|
|
63
|
+
export declare function readyRunner(context: RunnerContext, request: ReadyRunnerRequest, control: {
|
|
64
|
+
readonly scope: RunnerSandboxScope;
|
|
65
|
+
readonly signal: AbortSignal;
|
|
66
|
+
}, progress: RunnerProgress): Promise<ReadyRunnerOutcome>;
|
|
67
|
+
/** The files an upload stages: the patch, the untracked files' list and, when there are any, their tarball. */
|
|
68
|
+
export declare function stagedChanges(upload: CheckoutUpload): StagedFile[];
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
// Readying the runner sandbox once the run's credential names its team and project: pick a cached runner snapshot
|
|
2
|
+
// or build one, start the runner sandbox from it, upload and apply the run's changes, then install and build.
|
|
3
|
+
import { posix } from "node:path";
|
|
4
|
+
import { runnerTags } from "./context.js";
|
|
5
|
+
import { buildSnapshot } from "./snapshot-build.js";
|
|
6
|
+
import { pickSnapshot } from "./snapshot-cache.js";
|
|
7
|
+
import { applyScript, REMOTE_ROOT, STAGED_FILES } from "./snapshot-key.js";
|
|
8
|
+
import { runStep, sandboxStop } from "./steps.js";
|
|
9
|
+
/** The label of the step that applies and commits the run's changes in the runner sandbox. */
|
|
10
|
+
export const APPLY_LABEL = "Applying your changes";
|
|
11
|
+
/**
|
|
12
|
+
* Readies the runner sandbox for a prepared run. Of the cached candidates for the access's team and project, it
|
|
13
|
+
* starts from the one whose base is nearest HEAD; with none, or under `--rebuild-snapshot`, it builds a runner
|
|
14
|
+
* snapshot of the run's base first. It uploads what the checkout changes on top of the snapshot's base.
|
|
15
|
+
*/
|
|
16
|
+
export async function readyRunner(context, request, control, progress) {
|
|
17
|
+
const { prepared, access } = request;
|
|
18
|
+
const { recipe, repoRoot } = prepared;
|
|
19
|
+
const { scope, signal } = control;
|
|
20
|
+
const now = () => context.clock.now().getTime();
|
|
21
|
+
if (signal.aborted)
|
|
22
|
+
return { kind: "aborted" };
|
|
23
|
+
const picked = prepared.rebuild ? undefined : pickSnapshot(prepared.candidates, access);
|
|
24
|
+
let entry;
|
|
25
|
+
if (picked !== undefined) {
|
|
26
|
+
entry = picked.entry;
|
|
27
|
+
await progress.emit({ kind: "snapshot-reused", snapshotId: entry.snapshotId, base: entry.base });
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const built = await buildSnapshot(context, { prepared, access, user: request.user, reason: prepared.rebuild ? "rebuild" : "no-snapshot" }, control, progress);
|
|
31
|
+
if (built.kind !== "ok")
|
|
32
|
+
return built;
|
|
33
|
+
entry = built.value.entry;
|
|
34
|
+
}
|
|
35
|
+
if (signal.aborted)
|
|
36
|
+
return { kind: "aborted" };
|
|
37
|
+
await progress.emit({ kind: "runner-sandbox-starting", snapshotId: entry.snapshotId });
|
|
38
|
+
const startedAt = now();
|
|
39
|
+
const started = await scope.startRunnerSandbox(access, {
|
|
40
|
+
snapshotId: entry.snapshotId,
|
|
41
|
+
region: recipe.region,
|
|
42
|
+
vcpus: prepared.vcpus,
|
|
43
|
+
timeoutMs: recipe.timeoutMinutes * 60_000,
|
|
44
|
+
tags: runnerTags(recipe.name, "runner", request.user),
|
|
45
|
+
});
|
|
46
|
+
if (!started.ok) {
|
|
47
|
+
if (started.failure.kind === "snapshot-gone") {
|
|
48
|
+
const removed = await context.runnerSnapshots.removeEntry(entry);
|
|
49
|
+
return { kind: "snapshot-gone", entry, removal: removed.ok ? undefined : removed.failure };
|
|
50
|
+
}
|
|
51
|
+
return sandboxStop("start-runner-sandbox", started.failure);
|
|
52
|
+
}
|
|
53
|
+
const sandbox = started.value;
|
|
54
|
+
await progress.emit({
|
|
55
|
+
kind: "sandbox-started",
|
|
56
|
+
role: "runner",
|
|
57
|
+
name: sandbox.name,
|
|
58
|
+
region: recipe.region,
|
|
59
|
+
vcpus: prepared.vcpus,
|
|
60
|
+
ms: now() - startedAt,
|
|
61
|
+
});
|
|
62
|
+
const changes = await uploadChanges(context, { prepared, sandbox, base: entry.base }, signal, progress);
|
|
63
|
+
if (changes.kind !== "ok")
|
|
64
|
+
return changes;
|
|
65
|
+
const applied = await stage(context, {
|
|
66
|
+
sandbox,
|
|
67
|
+
phase: "apply",
|
|
68
|
+
step: { label: APPLY_LABEL, script: applyScript(changes.value.directory) },
|
|
69
|
+
region: recipe.region,
|
|
70
|
+
}, signal, progress);
|
|
71
|
+
if (applied.kind !== "ok")
|
|
72
|
+
return applied;
|
|
73
|
+
const loginPath = await context.runnerSandboxes.loginPath(sandbox, signal);
|
|
74
|
+
if (!loginPath.ok)
|
|
75
|
+
return sandboxStop("login-path", loginPath.failure);
|
|
76
|
+
const installed = await stage(context, { sandbox, phase: "install", step: recipe.run.install, region: recipe.region }, signal, progress);
|
|
77
|
+
if (installed.kind !== "ok")
|
|
78
|
+
return installed;
|
|
79
|
+
const built = await stage(context, { sandbox, phase: "build", step: recipe.run.build, region: recipe.region }, signal, progress);
|
|
80
|
+
if (built.kind !== "ok")
|
|
81
|
+
return built;
|
|
82
|
+
return {
|
|
83
|
+
kind: "ready",
|
|
84
|
+
runner: {
|
|
85
|
+
sandbox,
|
|
86
|
+
snapshotId: entry.snapshotId,
|
|
87
|
+
base: entry.base,
|
|
88
|
+
built: picked === undefined,
|
|
89
|
+
vcpus: prepared.vcpus,
|
|
90
|
+
region: recipe.region,
|
|
91
|
+
runtime: recipe.runtime,
|
|
92
|
+
repoRoot,
|
|
93
|
+
cwd: posix.join(REMOTE_ROOT, recipe.cwd),
|
|
94
|
+
env: recipe.env,
|
|
95
|
+
loginPath: loginPath.value,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Uploads what the checkout changes on top of `base`: the prepared upload when `base` is the run's base, or one
|
|
101
|
+
* assembled against `base`, an older snapshot's.
|
|
102
|
+
*/
|
|
103
|
+
async function uploadChanges(context, request, signal, progress) {
|
|
104
|
+
const { prepared } = request;
|
|
105
|
+
await progress.emit({ kind: "uploading" });
|
|
106
|
+
const startedAt = context.clock.now().getTime();
|
|
107
|
+
let upload = prepared.upload;
|
|
108
|
+
if (request.base !== prepared.base) {
|
|
109
|
+
const assembled = await context.checkout.assembleUpload({ repoRoot: prepared.repoRoot, base: request.base });
|
|
110
|
+
if (!assembled.ok)
|
|
111
|
+
return { kind: "failed", failure: { kind: "checkout-failed", failure: assembled.failure } };
|
|
112
|
+
upload = assembled.value;
|
|
113
|
+
}
|
|
114
|
+
const files = stagedChanges(upload);
|
|
115
|
+
const staged = await context.runnerSandboxes.upload(request.sandbox, files, signal);
|
|
116
|
+
if (!staged.ok)
|
|
117
|
+
return sandboxStop("upload", staged.failure);
|
|
118
|
+
const bytes = files.reduce((sum, file) => sum + file.content.byteLength, 0);
|
|
119
|
+
await progress.emit({ kind: "uploaded", bytes, ms: context.clock.now().getTime() - startedAt });
|
|
120
|
+
return { kind: "ok", value: { directory: staged.value.directory } };
|
|
121
|
+
}
|
|
122
|
+
/** The files an upload stages: the patch, the untracked files' list and, when there are any, their tarball. */
|
|
123
|
+
export function stagedChanges(upload) {
|
|
124
|
+
const encoder = new TextEncoder();
|
|
125
|
+
return [
|
|
126
|
+
{ name: STAGED_FILES.patch, content: upload.patch },
|
|
127
|
+
{
|
|
128
|
+
name: STAGED_FILES.untrackedFileList,
|
|
129
|
+
content: encoder.encode(upload.untracked.map((path) => `${path}\0`).join("")),
|
|
130
|
+
},
|
|
131
|
+
...(upload.untrackedTarball === undefined
|
|
132
|
+
? []
|
|
133
|
+
: [{ name: STAGED_FILES.untrackedTarball, content: upload.untrackedTarball }]),
|
|
134
|
+
];
|
|
135
|
+
}
|
|
136
|
+
/** Runs the apply, install or build step; the install and build get rule lines. */
|
|
137
|
+
async function stage(context, request, signal, progress) {
|
|
138
|
+
if (signal.aborted)
|
|
139
|
+
return { kind: "aborted" };
|
|
140
|
+
const { sandbox, phase, step } = request;
|
|
141
|
+
const section = phase === "apply" ? undefined : phase;
|
|
142
|
+
if (section !== undefined)
|
|
143
|
+
await progress.emit({ kind: "output-started", section, sandbox: sandbox.name, region: request.region });
|
|
144
|
+
const ran = await runStep(context, { sandbox, phase, ...step }, progress, signal);
|
|
145
|
+
if (ran.kind === "succeeded") {
|
|
146
|
+
if (section !== undefined)
|
|
147
|
+
await progress.emit({ kind: "output-ended", section, outcome: "finished" });
|
|
148
|
+
return { kind: "ok", value: undefined };
|
|
149
|
+
}
|
|
150
|
+
const stop = ran.kind === "exited"
|
|
151
|
+
? {
|
|
152
|
+
kind: "failed",
|
|
153
|
+
failure: { kind: `${phase}-failed`, label: step.label, exitCode: ran.exitCode, tail: ran.tail },
|
|
154
|
+
}
|
|
155
|
+
: sandboxStop("run-script", ran.failure);
|
|
156
|
+
if (section !== undefined)
|
|
157
|
+
await progress.emit({ kind: "output-ended", section, outcome: stop.kind === "aborted" ? "stopped" : "failed" });
|
|
158
|
+
return stop;
|
|
159
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/** A bash script, run with `bash -lc` in the repository's root, and the label that names it in progress and errors. */
|
|
2
|
+
export interface RunnerStep {
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly script: string;
|
|
5
|
+
}
|
|
6
|
+
/** What a step function may read about the base it is evaluated at. */
|
|
7
|
+
export interface RunnerStepContext {
|
|
8
|
+
/** The base's full SHA. */
|
|
9
|
+
readonly base: string;
|
|
10
|
+
/** The text of `path`, relative to the repository's root, at the base. Rejects when the base has no such file. */
|
|
11
|
+
readonly readBaseFile: (path: string) => Promise<string>;
|
|
12
|
+
}
|
|
13
|
+
/** A list of steps, or a function of the base that returns one, sync or async. */
|
|
14
|
+
export type RunnerSteps = readonly RunnerStep[] | ((context: RunnerStepContext) => readonly RunnerStep[] | Promise<readonly RunnerStep[]>);
|
|
15
|
+
/**
|
|
16
|
+
* The resources a run holds, as a recipe's `vcpus` function sees them: `testserverPool` with the run's Testserver
|
|
17
|
+
* sandbox count when the run has a Testserver side, and absent otherwise.
|
|
18
|
+
*/
|
|
19
|
+
export interface RunnerResources {
|
|
20
|
+
readonly testserverPool?: {
|
|
21
|
+
readonly sandboxes: number;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** What a repository declares about its runner snapshot and what each run does on top of it. */
|
|
25
|
+
export interface RunnerRecipe {
|
|
26
|
+
/** Lowercase letters, digits and dashes. Names the recipe's sandboxes (`storm-runner-<name>`) and cache entries. */
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly snapshot: {
|
|
29
|
+
/** The build sandbox's vCPUs. */
|
|
30
|
+
readonly vcpus: number;
|
|
31
|
+
/** A few words on what a snapshot build does; by default the steps' labels. */
|
|
32
|
+
readonly summary?: string;
|
|
33
|
+
/** Steps run before the base's files are committed in the build sandbox. They must put `git` on `PATH`. */
|
|
34
|
+
readonly toolchains: RunnerSteps;
|
|
35
|
+
/** Steps run after the base's files are committed, such as a frozen install and a full build. */
|
|
36
|
+
readonly warm: RunnerSteps;
|
|
37
|
+
};
|
|
38
|
+
readonly run: {
|
|
39
|
+
/** Installs dependencies on every run. */
|
|
40
|
+
readonly install: RunnerStep;
|
|
41
|
+
/** Builds on every run, after the install. */
|
|
42
|
+
readonly build: RunnerStep;
|
|
43
|
+
};
|
|
44
|
+
/** The command's directory, relative to the repository's root, without `..`; `"."` by default. */
|
|
45
|
+
readonly cwd?: string;
|
|
46
|
+
/** The runner sandbox's vCPUs, or a function of the resources the run holds that returns them. */
|
|
47
|
+
readonly vcpus: number | ((resources: RunnerResources) => number);
|
|
48
|
+
/** Extra environment variables for the command. It can't set `STORM_RUN`. */
|
|
49
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
50
|
+
/** How long the runner sandbox may live, from `10m` to `5h`; `60m` by default. */
|
|
51
|
+
readonly timeout?: string;
|
|
52
|
+
/**
|
|
53
|
+
* How long the runner sandbox keeps running once the run ends, so you can connect to it: `0`, which stops and deletes
|
|
54
|
+
* it, or up to `5h`. `run --keep-sandbox` overrides it; without either, `30m`, or `0` when `CI` is set.
|
|
55
|
+
*/
|
|
56
|
+
readonly keepSandbox?: string;
|
|
57
|
+
/** The refs a base can come from, preferred first; `["main", "origin/main"]` by default. */
|
|
58
|
+
readonly baseRefs?: readonly string[];
|
|
59
|
+
/** The Vercel region of the runner sandbox and its snapshots; `iad1` by default. */
|
|
60
|
+
readonly region?: string;
|
|
61
|
+
/** The Vercel Sandbox runtime; `node22` by default. */
|
|
62
|
+
readonly runtime?: string;
|
|
63
|
+
}
|
|
64
|
+
/** The defaults of a recipe's optional keys. */
|
|
65
|
+
export declare const RECIPE_DEFAULTS: {
|
|
66
|
+
readonly cwd: ".";
|
|
67
|
+
readonly timeout: "60m";
|
|
68
|
+
readonly baseRefs: readonly ["main", "origin/main"];
|
|
69
|
+
readonly region: "iad1";
|
|
70
|
+
readonly runtime: "node22";
|
|
71
|
+
};
|
|
72
|
+
/** A recipe that passed `checkRecipe`, with every optional key's default filled in. */
|
|
73
|
+
export interface CheckedRecipe extends RunnerRecipe {
|
|
74
|
+
readonly cwd: string;
|
|
75
|
+
readonly env: Readonly<Record<string, string>>;
|
|
76
|
+
readonly timeout: string;
|
|
77
|
+
/** `timeout` in minutes. */
|
|
78
|
+
readonly timeoutMinutes: number;
|
|
79
|
+
/** `keepSandbox` in minutes; undefined when the recipe doesn't set it. */
|
|
80
|
+
readonly keepSandboxMinutes: number | undefined;
|
|
81
|
+
readonly baseRefs: readonly string[];
|
|
82
|
+
readonly region: string;
|
|
83
|
+
readonly runtime: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* One thing wrong with a recipe: the key path inside the recipe (`["snapshot", "vcpus"]`; empty for the recipe
|
|
87
|
+
* itself), and what is wrong, worded to follow the key (`must be …, not …`).
|
|
88
|
+
*/
|
|
89
|
+
export interface RecipeProblem {
|
|
90
|
+
readonly path: readonly string[];
|
|
91
|
+
readonly problem: string;
|
|
92
|
+
}
|
|
93
|
+
export type RecipeCheck = {
|
|
94
|
+
readonly ok: true;
|
|
95
|
+
readonly value: CheckedRecipe;
|
|
96
|
+
} | {
|
|
97
|
+
readonly ok: false;
|
|
98
|
+
readonly problems: readonly RecipeProblem[];
|
|
99
|
+
};
|
|
100
|
+
/**
|
|
101
|
+
* Checks a recipe against its static rules: the keys it may hold and each value's shape. Functions are checked only
|
|
102
|
+
* for being functions; `resolveSteps` and `resolveVcpus` check what they return. Every problem is reported.
|
|
103
|
+
*/
|
|
104
|
+
export declare function checkRecipe(value: unknown): RecipeCheck;
|
|
105
|
+
/**
|
|
106
|
+
* What a recipe's steps are at one base: the list as given, or what the function returns for `context`, checked.
|
|
107
|
+
* A function that throws or rejects, or returns anything but a list of steps, is a problem worded to follow the key.
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveSteps(steps: RunnerSteps, context: RunnerStepContext): Promise<{
|
|
110
|
+
readonly ok: true;
|
|
111
|
+
readonly steps: readonly RunnerStep[];
|
|
112
|
+
} | {
|
|
113
|
+
readonly ok: false;
|
|
114
|
+
readonly problem: string;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* The runner sandbox's vCPUs for a run holding `resources`: the recipe's number, or what its function returns, which
|
|
118
|
+
* must be a positive whole number.
|
|
119
|
+
*/
|
|
120
|
+
export declare function resolveVcpus(recipe: Pick<RunnerRecipe, "vcpus">, resources: RunnerResources): {
|
|
121
|
+
readonly ok: true;
|
|
122
|
+
readonly vcpus: number;
|
|
123
|
+
} | {
|
|
124
|
+
readonly ok: false;
|
|
125
|
+
readonly problem: string;
|
|
126
|
+
};
|