@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,41 @@
|
|
|
1
|
+
// The toolchain steps a pnpm workspace's runner recipe can use, exported from `@cnc-tools/storm/config`. Like
|
|
2
|
+
// `define.ts`, it imports nothing at run time, so a config file that uses it loads no Clinkr, zod or CLI code.
|
|
3
|
+
/**
|
|
4
|
+
* The runner snapshot's toolchain step for the root `package.json` at the base: `git` on `PATH`, a Node that meets
|
|
5
|
+
* `engines.node`'s minimum when the runtime's is older, and the `packageManager`'s pnpm through corepack. Shims and a
|
|
6
|
+
* downloaded Node go in `~/.local/bin`, which the login shell's `PATH` puts first. Give it as a recipe's
|
|
7
|
+
* `snapshot.toolchains`. It rejects when `packageManager` isn't `pnpm@<x.y.z>` or `engines.node` isn't `>=<x.y.z>`,
|
|
8
|
+
* which keeps a cached runner snapshot at that base from being used.
|
|
9
|
+
*/
|
|
10
|
+
export async function pnpmToolchains({ readBaseFile }) {
|
|
11
|
+
const manifest = JSON.parse(await readBaseFile("package.json"));
|
|
12
|
+
return [{ label: "Installing the toolchains", script: toolchainScript(manifest) }];
|
|
13
|
+
}
|
|
14
|
+
function toolchainScript(manifest) {
|
|
15
|
+
const fields = typeof manifest === "object" && manifest !== null ? manifest : {};
|
|
16
|
+
const { packageManager, engines } = fields;
|
|
17
|
+
const pnpm = typeof packageManager === "string" ? /^pnpm@(\d+\.\d+\.\d+)/.exec(packageManager)?.[1] : undefined;
|
|
18
|
+
if (pnpm === undefined)
|
|
19
|
+
throw new Error(`package.json's packageManager isn't a pnpm version: ${String(packageManager)}`);
|
|
20
|
+
const engine = typeof engines === "object" && engines !== null ? engines["node"] : undefined;
|
|
21
|
+
const node = typeof engine === "string" ? /^>=\s*(\d+\.\d+\.\d+)$/.exec(engine)?.[1] : undefined;
|
|
22
|
+
if (node === undefined)
|
|
23
|
+
throw new Error("package.json's engines.node isn't a >= minimum");
|
|
24
|
+
return [
|
|
25
|
+
"set -euo pipefail",
|
|
26
|
+
'mkdir -p "$HOME/.local/bin"',
|
|
27
|
+
"command -v git >/dev/null || sudo dnf install -y -q git",
|
|
28
|
+
"git --version",
|
|
29
|
+
`if ! node -e 'const [a, b, c] = process.versions.node.split(".").map(Number); const [x, y, z] = "${node}".split(".").map(Number); process.exit(a !== x ? (a > x ? 0 : 1) : b !== y ? (b > y ? 0 : 1) : c >= z ? 0 : 1)'; then`,
|
|
30
|
+
' case "$(uname -m)" in aarch64) arch=arm64 ;; *) arch=x64 ;; esac',
|
|
31
|
+
` curl -fsSL "https://nodejs.org/dist/v${node}/node-v${node}-linux-$arch.tar.gz" | tar -xz -C "$HOME/.local"`,
|
|
32
|
+
` ln -sf "$HOME/.local/node-v${node}-linux-$arch/bin/"* "$HOME/.local/bin/"`,
|
|
33
|
+
"fi",
|
|
34
|
+
"hash -r",
|
|
35
|
+
"node --version",
|
|
36
|
+
'corepack enable --install-directory "$HOME/.local/bin" pnpm',
|
|
37
|
+
`corepack install -g pnpm@${pnpm}`,
|
|
38
|
+
"hash -r",
|
|
39
|
+
"pnpm --version",
|
|
40
|
+
].join("\n");
|
|
41
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { type ConfigGateway } from "./config/index.ts";
|
|
2
|
+
import { type CredentialGateway, type GitHubActionsTokenGateway } from "./credential/index.ts";
|
|
3
|
+
import type { Presentation } from "./presentation.ts";
|
|
4
|
+
import { type RESOURCE_CONFIGS, type StormResourceGateways } from "./resources.ts";
|
|
5
|
+
import { type CommandGateway, type JobSummaryGateway, type ProgressTerminal, type RunDirectoryGateway } from "./core/index.ts";
|
|
6
|
+
import { type CheckoutGateway, type RunnerSandboxGateway, type RunnerSnapshotCacheGateway, type RunnerTerminal } from "./runner/index.ts";
|
|
7
|
+
import { type Clock, type Timer } from "./time/index.ts";
|
|
8
|
+
/**
|
|
9
|
+
* The gateways and DI seams storm's commands reach the world through, beside the resources' own
|
|
10
|
+
* (`StormContext`).
|
|
11
|
+
*/
|
|
12
|
+
export interface StormCoreContext {
|
|
13
|
+
readonly credentials: CredentialGateway;
|
|
14
|
+
/** GitHub Actions' OIDC token issuer, for `--credential github-actions`. */
|
|
15
|
+
readonly githubActionsTokens: GitHubActionsTokenGateway;
|
|
16
|
+
readonly commands: CommandGateway;
|
|
17
|
+
readonly config: ConfigGateway;
|
|
18
|
+
/** The local Git checkout a runner run uploads from. */
|
|
19
|
+
readonly checkout: CheckoutGateway;
|
|
20
|
+
/** The per-machine runner snapshot cache. */
|
|
21
|
+
readonly runnerSnapshots: RunnerSnapshotCacheGateway;
|
|
22
|
+
/** Vercel Sandbox, where runner and build sandboxes run. */
|
|
23
|
+
readonly runnerSandboxes: RunnerSandboxGateway;
|
|
24
|
+
/** The terminal a remote command's output reaches. */
|
|
25
|
+
readonly runnerTerminal: RunnerTerminal;
|
|
26
|
+
/** Where each run writes its events, its steps' output, the command's output and its timeline. */
|
|
27
|
+
readonly runDirectories: RunDirectoryGateway;
|
|
28
|
+
/** The terminal a run's live view shows on, when its presentation is `live`. */
|
|
29
|
+
readonly progressTerminal: ProgressTerminal;
|
|
30
|
+
/** The GitHub Actions job summary a run appends its summary to, in a step that has one. */
|
|
31
|
+
readonly jobSummary: JobSummaryGateway;
|
|
32
|
+
readonly timer: Timer;
|
|
33
|
+
readonly clock: Clock;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The gateways and DI seams storm's commands reach the world through: the core's, and each resource's, which its
|
|
37
|
+
* kind declares. Tests build it over fakes.
|
|
38
|
+
*/
|
|
39
|
+
export type StormContext = StormCoreContext & StormResourceGateways;
|
|
40
|
+
/**
|
|
41
|
+
* Where a command records the status the process exits with, past Clinkr's: a Clinkr handler's result exits only
|
|
42
|
+
* 0 or 1, so `run` records its command's code (or `128 + n` for a signal) here, and `bin/storm.ts` exits with
|
|
43
|
+
* it when it is set.
|
|
44
|
+
*/
|
|
45
|
+
export interface StormExit {
|
|
46
|
+
status: number | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The Clinkr application context (`app`) every command receives, the resources' own commands among them, which the
|
|
50
|
+
* registry checks it against (`RESOURCE_MOUNTS`).
|
|
51
|
+
*/
|
|
52
|
+
export interface StormApp {
|
|
53
|
+
readonly context: StormContext;
|
|
54
|
+
/** Every resource config, which a command checks `storm.config.ts` against. */
|
|
55
|
+
readonly resourceConfigs: typeof RESOURCE_CONFIGS;
|
|
56
|
+
/** The host's environment: the base of a run's command's environment. */
|
|
57
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
58
|
+
/** The host's working directory, where the search for `storm.config.ts` starts. */
|
|
59
|
+
readonly cwd: string;
|
|
60
|
+
/** storm's version, which a run prints first. */
|
|
61
|
+
readonly version: string;
|
|
62
|
+
/**
|
|
63
|
+
* The git commit storm was built from, as the version line shows it: 12 hex characters, `-dirty` appended when
|
|
64
|
+
* the tree had uncommitted changes. Null when unknown.
|
|
65
|
+
*/
|
|
66
|
+
readonly commit: string | null;
|
|
67
|
+
/** The local user name, which tags each sandbox a runner run starts. */
|
|
68
|
+
readonly user: string;
|
|
69
|
+
/** How a run's progress shows on stderr, resolved once from the host. */
|
|
70
|
+
readonly presentation: Presentation;
|
|
71
|
+
readonly exit: StormExit;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The live Context: `vercel` for credentials, and for `--credential github-actions` GitHub Actions' token request, read
|
|
75
|
+
* from `env`'s `ACTIONS_ID_TOKEN_REQUEST_*` at each request, with a 10-second timeout; a run's command spawned as a
|
|
76
|
+
* real process; `storm.config.ts` imported by Node; for a runner run, git and tar on the local checkout, the
|
|
77
|
+
* runner snapshot cache under `env`'s `XDG_STATE_HOME` or `HOME`, Vercel Sandbox through `@vercel/sandbox` (loaded
|
|
78
|
+
* only when a runner run first calls it) and this process's stdout and stderr; the run directories beside the runner
|
|
79
|
+
* snapshot cache; the live view on this process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any; the
|
|
80
|
+
* system timer and clock; and each resource's own live gateways, which its folder builds from `env`. When `env` names
|
|
81
|
+
* no place for the state directory, every runner snapshot cache operation fails and says why, which a run treats as an
|
|
82
|
+
* empty cache, and so does opening a run directory, which a run goes on without.
|
|
83
|
+
*/
|
|
84
|
+
export declare function liveContext(options: {
|
|
85
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
86
|
+
}): StormContext;
|
package/dist/context.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// The composition layer's wiring: the one place storm's live gateways are built. Each resource builds its own
|
|
2
|
+
// (`liveResourceGateways`, through the registry), so this file names no resource.
|
|
3
|
+
import { liveConfigGateway } from "./config/index.js";
|
|
4
|
+
import { liveCredentialGateway, liveGitHubActionsTokenGateway, } from "./credential/index.js";
|
|
5
|
+
import { liveResourceGateways } from "./resources.js";
|
|
6
|
+
import { liveCommandGateway, liveJobSummaryGateway, liveProgressTerminal, liveRunDirectoryGateway, resolveStateDirectory, RUNS_SUBPATH, stateDirectoryPattern, unavailableRunDirectoryGateway, } from "./core/index.js";
|
|
7
|
+
import { liveCheckoutGateway, liveRunnerSandboxGateway, liveRunnerSnapshotCacheGateway, liveRunnerTerminal, RUNNER_SNAPSHOTS_SUBPATH, unavailableRunnerSnapshotCacheGateway, } from "./runner/index.js";
|
|
8
|
+
import { systemClock, systemTimer } from "./time/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* The live Context: `vercel` for credentials, and for `--credential github-actions` GitHub Actions' token request, read
|
|
11
|
+
* from `env`'s `ACTIONS_ID_TOKEN_REQUEST_*` at each request, with a 10-second timeout; a run's command spawned as a
|
|
12
|
+
* real process; `storm.config.ts` imported by Node; for a runner run, git and tar on the local checkout, the
|
|
13
|
+
* runner snapshot cache under `env`'s `XDG_STATE_HOME` or `HOME`, Vercel Sandbox through `@vercel/sandbox` (loaded
|
|
14
|
+
* only when a runner run first calls it) and this process's stdout and stderr; the run directories beside the runner
|
|
15
|
+
* snapshot cache; the live view on this process's stderr; the job summary `GITHUB_STEP_SUMMARY` names, if any; the
|
|
16
|
+
* system timer and clock; and each resource's own live gateways, which its folder builds from `env`. When `env` names
|
|
17
|
+
* no place for the state directory, every runner snapshot cache operation fails and says why, which a run treats as an
|
|
18
|
+
* empty cache, and so does opening a run directory, which a run goes on without.
|
|
19
|
+
*/
|
|
20
|
+
export function liveContext(options) {
|
|
21
|
+
const snapshots = resolveStateDirectory(options.env, RUNNER_SNAPSHOTS_SUBPATH);
|
|
22
|
+
const runs = resolveStateDirectory(options.env, RUNS_SUBPATH);
|
|
23
|
+
return {
|
|
24
|
+
...liveResourceGateways({ env: options.env }),
|
|
25
|
+
credentials: liveCredentialGateway(),
|
|
26
|
+
githubActionsTokens: liveGitHubActionsTokenGateway({ env: options.env, timeoutMs: 10_000 }),
|
|
27
|
+
commands: liveCommandGateway(),
|
|
28
|
+
config: liveConfigGateway(),
|
|
29
|
+
checkout: liveCheckoutGateway(),
|
|
30
|
+
runnerSnapshots: snapshots.ok
|
|
31
|
+
? liveRunnerSnapshotCacheGateway({ directory: snapshots.directory })
|
|
32
|
+
: unavailableRunnerSnapshotCacheGateway(stateDirectoryPattern(RUNNER_SNAPSHOTS_SUBPATH), snapshots.reason),
|
|
33
|
+
runnerSandboxes: liveRunnerSandboxGateway(),
|
|
34
|
+
runnerTerminal: liveRunnerTerminal({ env: options.env }),
|
|
35
|
+
runDirectories: runs.ok
|
|
36
|
+
? liveRunDirectoryGateway({ directory: runs.directory })
|
|
37
|
+
: unavailableRunDirectoryGateway(stateDirectoryPattern(RUNS_SUBPATH), runs.reason),
|
|
38
|
+
progressTerminal: liveProgressTerminal(),
|
|
39
|
+
jobSummary: liveJobSummaryGateway({ path: options.env["GITHUB_STEP_SUMMARY"] }),
|
|
40
|
+
timer: systemTimer,
|
|
41
|
+
clock: systemClock,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { CommandError, DataErrorDefinition, Refusable, Row, SharedError, Warning } from "@vercel/clinkr";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { ResourceKind } from "./resource.ts";
|
|
4
|
+
/** Any named error a resource's command half defines, whatever its facts. */
|
|
5
|
+
export type AnyResourceError = SharedError<string, never[]>;
|
|
6
|
+
/**
|
|
7
|
+
* What settling a resource works from: its resolved options, the host's environment, and the config file that
|
|
8
|
+
* applied, which its errors name; null when none did.
|
|
9
|
+
*/
|
|
10
|
+
export interface ResourceSettleInput<Kind extends ResourceKind> {
|
|
11
|
+
readonly options: Kind["options"];
|
|
12
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
13
|
+
readonly configFile: string | null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* What settling a resource answers: the secrets the run hides as `<token>` in what it prints and writes, such as a
|
|
17
|
+
* token the resource hands its command, and its part of the run request, the same in either kind of run. The run, not
|
|
18
|
+
* the resource, holds the credential choice: it settles one when some resource takes it
|
|
19
|
+
* (`CommandProvider.takesCredential`), and the core hands each resource the source it names.
|
|
20
|
+
*/
|
|
21
|
+
export interface ResourceSettlement<Kind extends ResourceKind> {
|
|
22
|
+
readonly secrets: readonly string[];
|
|
23
|
+
readonly request: Kind["request"];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* One resource's cleanup as outcomes report it, under `cleanup.resources.<name>`, and as the progress cleanup line
|
|
27
|
+
* counts it. `Cleanup` is what its release answers; `Facts` is what `schema` holds, as both its input and its output:
|
|
28
|
+
* its kind's `cleanup` and `cleanupFacts`.
|
|
29
|
+
*/
|
|
30
|
+
export interface ResourceCleanupReport<Cleanup, Facts> {
|
|
31
|
+
readonly schema: z.ZodType<Facts, Facts>;
|
|
32
|
+
/** The run's cleanup of this resource, as outcomes report it. */
|
|
33
|
+
facts(cleanup: Cleanup): Facts;
|
|
34
|
+
/** The rows an error lists for what the cleanup couldn't do; none when it did everything. */
|
|
35
|
+
rows(facts: Facts): readonly Row[];
|
|
36
|
+
/** The warnings a ran outcome gives for what the cleanup couldn't do. */
|
|
37
|
+
warnings(facts: Facts): readonly Warning[];
|
|
38
|
+
/** The progress cleanup line's words for `failures` things the cleanup couldn't do, such as `2 leases not released`. */
|
|
39
|
+
failuresText(failures: number): string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* What a `ran` outcome reports of one acquired resource, under `resources.<name>`: `schema` holds its kind's
|
|
43
|
+
* `ranFacts`, as both its input and its output; `facts` makes them from its facts and its request; `warnings` are the
|
|
44
|
+
* warnings a ran outcome gives for what acquiring it couldn't do; `rows` are the rows `storm runs show` lists for
|
|
45
|
+
* it, from the ran facts the run directory's `run.json` keeps: what the run used, and where to look at it.
|
|
46
|
+
*/
|
|
47
|
+
export interface ResourceRanReport<Kind extends ResourceKind> {
|
|
48
|
+
readonly schema: z.ZodType<Kind["ranFacts"], Kind["ranFacts"]>;
|
|
49
|
+
facts(facts: Kind["facts"], request: Kind["request"]): Kind["ranFacts"];
|
|
50
|
+
warnings(ran: Kind["ranFacts"]): readonly Warning[];
|
|
51
|
+
rows(ran: Kind["ranFacts"]): readonly Row[];
|
|
52
|
+
}
|
|
53
|
+
/** Named errors a resource's command half defines, by key. */
|
|
54
|
+
export interface ResourceErrors {
|
|
55
|
+
readonly [key: string]: AnyResourceError;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Any one refusal error's definition, whatever its data: what `defineRefusals` makes, with a schema, so the host can
|
|
59
|
+
* add the run's cleanup beside its data. `render` is a method, so a definition whose `render` takes its own schema's
|
|
60
|
+
* data fits: a method's parameter is checked both ways. The host calls it only with data its schema parsed.
|
|
61
|
+
*/
|
|
62
|
+
export type RefusalDefinition = Omit<DataErrorDefinition, "render"> & {
|
|
63
|
+
render(data: Readonly<Record<string, unknown>>): ReturnType<DataErrorDefinition["render"]>;
|
|
64
|
+
};
|
|
65
|
+
/** A resource's refusal errors, as definitions, by key. */
|
|
66
|
+
export interface RefusalDefinitions {
|
|
67
|
+
readonly [key: string]: RefusalDefinition;
|
|
68
|
+
}
|
|
69
|
+
/** The schema refusal definition `D` declares. */
|
|
70
|
+
export type RefusalSchemaOf<D> = D extends {
|
|
71
|
+
readonly schema: infer Schema extends z.ZodObject;
|
|
72
|
+
} ? Schema : never;
|
|
73
|
+
/**
|
|
74
|
+
* What a refusal ends a run with, of refusal definitions `R`: the key of one of them, and its data, without the run's
|
|
75
|
+
* cleanup, which the host adds. One union member per key, so `key` narrows `data`.
|
|
76
|
+
*/
|
|
77
|
+
export type RefusalFactOf<R> = {
|
|
78
|
+
readonly [Key in keyof R & string]: {
|
|
79
|
+
readonly key: Key;
|
|
80
|
+
readonly data: z.input<RefusalSchemaOf<R[Key]>>;
|
|
81
|
+
};
|
|
82
|
+
}[keyof R & string];
|
|
83
|
+
/** Any resource's refusal fact, whatever its definitions: what the host builds a refusal error from. */
|
|
84
|
+
export type RefusalFact = RefusalFactOf<RefusalDefinitions>;
|
|
85
|
+
/**
|
|
86
|
+
* A resource's refusal errors as definitions, each with a schema: `defineErrors`' input, which types each `render` by
|
|
87
|
+
* its schema. The host defines them, with the run's cleanup beside each one's data.
|
|
88
|
+
*/
|
|
89
|
+
export declare function defineRefusals<const Schemas extends Readonly<Record<string, z.ZodObject>>>(definitions: {
|
|
90
|
+
readonly [Key in keyof Schemas]: DataErrorDefinition<Schemas[Key]>;
|
|
91
|
+
}): {
|
|
92
|
+
readonly [Key in keyof Schemas]: DataErrorDefinition<Schemas[Key]>;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* The error a run ends with when a resource's prepare refused it, of kind `Kind`: none for a kind whose prepare never
|
|
96
|
+
* refuses (`prepareRefusal` is `never`), required for every other.
|
|
97
|
+
*/
|
|
98
|
+
export type UnpreparedErrorOf<Kind extends ResourceKind> = [Kind["prepareRefusal"]] extends [never] ? undefined : (refusal: Kind["prepareRefusal"]) => CommandError<Kind["reason"]>;
|
|
99
|
+
/**
|
|
100
|
+
* The command half of one resource, of kind `Kind`, whose refusal errors are `Refusals`. Every error a run ends with
|
|
101
|
+
* for it is one of `errors` or `refusalErrors`, which the `run` command lists, and its reason is one of the kind's
|
|
102
|
+
* (`Kind["reason"]`), which the run's own outcomes check both ways. It knows nothing of the run's cleanup: the host
|
|
103
|
+
* defines each refusal error with the run's cleanup beside its data.
|
|
104
|
+
*
|
|
105
|
+
* - `errors`: the errors that end a run before it holds anything: its settle's and its prepare's.
|
|
106
|
+
* - `refusalErrors`: the definitions of the errors its acquire's refusals end a run with (`defineRefusals`). The host
|
|
107
|
+
* defines each with the run's cleanup beside its data, and builds the one a refusal names.
|
|
108
|
+
* - `settle`: before the run starts, its resolved options and the host's environment as its part of the run request
|
|
109
|
+
* and its secrets (`ResourceSettlement`), or the error that refuses the run, such as a token missing from the host.
|
|
110
|
+
* - `takesCredential`: whether, with these options, it needs the run's credential: in a local run, the credential
|
|
111
|
+
* source `--credential` names.
|
|
112
|
+
* - `refusalFacts`: which of `refusalErrors` a run its acquire refused ends with, and its data.
|
|
113
|
+
* - `unpreparedError`: the error, one of `errors`, a run its prepare refused ends with; none for a kind whose prepare
|
|
114
|
+
* never refuses.
|
|
115
|
+
* - `canceledLines`: what a canceled run says it changed in this resource, from its canceled facts and its cleanup;
|
|
116
|
+
* each is undefined when the run didn't hold it.
|
|
117
|
+
*/
|
|
118
|
+
export interface CommandProvider<Kind extends ResourceKind, Refusals extends RefusalDefinitions = RefusalDefinitions> {
|
|
119
|
+
readonly errors: ResourceErrors;
|
|
120
|
+
readonly refusalErrors: Refusals;
|
|
121
|
+
settle(input: ResourceSettleInput<Kind>): Refusable<ResourceSettlement<Kind>, CommandError<Kind["reason"]>>;
|
|
122
|
+
takesCredential(options: Kind["options"]): boolean;
|
|
123
|
+
refusalFacts(refusal: Kind["refusal"]): RefusalFactOf<Refusals>;
|
|
124
|
+
readonly unpreparedError: UnpreparedErrorOf<Kind>;
|
|
125
|
+
canceledLines(facts: Kind["canceledFacts"] | undefined, cleanup: Kind["cleanup"] | undefined): readonly string[];
|
|
126
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// The command half of a resource provider: what the composition layer asks each resource for when it settles a run
|
|
2
|
+
// and when it reports a run's outcome and progress, and the reports beside it: its cleanup report and its ran report.
|
|
3
|
+
// `resource.ts` holds the run half. Each resource folder implements them, and its provider value (`provider.ts`)
|
|
4
|
+
// carries them to the registry, which binds them to their names (`command-slots.ts`). It imports only Clinkr's and
|
|
5
|
+
// zod's types, so a resource folder can implement it without reaching into the composition layer. Users never see the
|
|
6
|
+
// word "provider": they see the resource's key under `resources`.
|
|
7
|
+
/**
|
|
8
|
+
* A resource's refusal errors as definitions, each with a schema: `defineErrors`' input, which types each `render` by
|
|
9
|
+
* its schema. The host defines them, with the run's cleanup beside each one's data.
|
|
10
|
+
*/
|
|
11
|
+
export function defineRefusals(definitions) {
|
|
12
|
+
return definitions;
|
|
13
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { CommandError, Refusable, Row, Warning } from "@vercel/clinkr";
|
|
2
|
+
import type { z } from "zod";
|
|
3
|
+
import type { RunnerResources } from "../runner/index.ts";
|
|
4
|
+
import type { RefusalFact } from "./command-provider.ts";
|
|
5
|
+
import type { ProviderList } from "./provider.ts";
|
|
6
|
+
import type { ResourceCanceledFacts, ResourceCleanup, ResourceCleanupFacts, ResourceFacts, ResourceFailures, ResourceOptions, ResourceRanFacts, ResourceReason, ResourceRefusal, ResourceRequests, ResourceUnprepared } from "./resource.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Every resource's reports, in provider order, over kinds map `K`.
|
|
9
|
+
*
|
|
10
|
+
* - `cleanupSchema`: the run cleanup's `resources`, each resource's cleanup facts under its name, present once the run
|
|
11
|
+
* held it.
|
|
12
|
+
* - `cleanupFacts`: the run's resource cleanup as outcomes report it.
|
|
13
|
+
* - `cleanupRows` and `cleanupWarnings`: the rows an error lists and the warnings a ran outcome gives for what
|
|
14
|
+
* releasing the resources couldn't do, resource by resource.
|
|
15
|
+
* - `failuresTexts`: the progress cleanup line's words for each resource whose release couldn't do something.
|
|
16
|
+
* - `ranSchema`: a ran outcome's `resources`, each acquired resource's ran facts under its name, for the resources
|
|
17
|
+
* that report any.
|
|
18
|
+
* - `ranFacts` and `ranWarnings`: a ran outcome's `resources`, from the acquired resources' facts and their requests,
|
|
19
|
+
* and the warnings they give.
|
|
20
|
+
* - `ranRows`: the rows `storm runs show` lists for a past run's `resources`, resource by resource.
|
|
21
|
+
* - `runnerResources`: what a runner recipe's `vcpus` function sees of the resources the run holds.
|
|
22
|
+
* - `hostVariablesToDrop`: every resource's host variables the run's command must not see.
|
|
23
|
+
*/
|
|
24
|
+
export interface ResourceReports<K> {
|
|
25
|
+
readonly cleanupSchema: z.ZodType<ResourceCleanupFacts<K>, ResourceCleanupFacts<K>>;
|
|
26
|
+
cleanupFacts(cleanup: ResourceCleanup<K>): ResourceCleanupFacts<K>;
|
|
27
|
+
cleanupRows(facts: ResourceCleanupFacts<K>): readonly Row[];
|
|
28
|
+
cleanupWarnings(facts: ResourceCleanupFacts<K>): readonly Warning[];
|
|
29
|
+
failuresTexts(failures: ResourceFailures<K>): readonly string[];
|
|
30
|
+
readonly ranSchema: z.ZodType<ResourceRanFacts<K>, ResourceRanFacts<K>>;
|
|
31
|
+
ranFacts(facts: ResourceFacts<K>, requests: ResourceRequests<K>): ResourceRanFacts<K>;
|
|
32
|
+
ranWarnings(ran: ResourceRanFacts<K>): readonly Warning[];
|
|
33
|
+
ranRows(ran: ResourceRanFacts<K>): readonly Row[];
|
|
34
|
+
runnerResources(options: ResourceOptions<K>): RunnerResources;
|
|
35
|
+
readonly hostVariablesToDrop: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
/** Every one of `providers`' reports, bound to their names, in order. */
|
|
38
|
+
export declare function resourceReports<K>(providers: ProviderList<K>): ResourceReports<K>;
|
|
39
|
+
/**
|
|
40
|
+
* Every held resource settled: the secrets the run hides as `<token>` in what it prints and writes, and the
|
|
41
|
+
* resources' part of the run request, the same in either kind of run.
|
|
42
|
+
*/
|
|
43
|
+
export interface ResourcesSettlement<K> {
|
|
44
|
+
readonly secrets: readonly string[];
|
|
45
|
+
readonly requests: ResourceRequests<K>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Every resource's command half, bound to its name, in provider order, over kinds map `K`. Every error is one of the
|
|
49
|
+
* resources' (`ResourceReason<K>`).
|
|
50
|
+
*
|
|
51
|
+
* - `settle`: settles every held resource, in provider order: their parts of the run request and their secrets, or
|
|
52
|
+
* the first refusal. `configFile` is the config file that applied, which a settle's error names.
|
|
53
|
+
* - `takesCredential`: whether any held resource, with its resolved options, takes the run's credential.
|
|
54
|
+
* - `refusalFacts`: which of its refusal errors a run a resource refused while it acquired ends with, and that error's
|
|
55
|
+
* data, without the run's cleanup, which the composition layer builds the error with.
|
|
56
|
+
* - `unpreparedError`: the error a run a resource refused before it held anything ends with.
|
|
57
|
+
* - `canceledLines`: what a canceled run changed in its resources, for a person, resource by resource.
|
|
58
|
+
*/
|
|
59
|
+
export interface ResourceCommands<K> {
|
|
60
|
+
settle(options: ResourceOptions<K>, env: Readonly<Record<string, string | undefined>>, configFile: string | null): Refusable<ResourcesSettlement<K>, CommandError<ResourceReason<K>>>;
|
|
61
|
+
takesCredential(options: ResourceOptions<K>): boolean;
|
|
62
|
+
refusalFacts(outcome: ResourceRefusal<K>): RefusalFact;
|
|
63
|
+
unpreparedError(outcome: ResourceUnprepared<K>): CommandError<ResourceReason<K>>;
|
|
64
|
+
canceledLines(resources: ResourceCanceledFacts<K>, cleanup: ResourceCleanup<K>): readonly string[];
|
|
65
|
+
}
|
|
66
|
+
/** Every one of `providers`' command halves, bound to their names, in order. */
|
|
67
|
+
export declare function bindCommands<K>(providers: ProviderList<K>): ResourceCommands<K>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// How the composition layer asks every resource the same thing at once, through each resource's provider value: the
|
|
2
|
+
// command-side counterpart of `resources.ts`, which binds the run halves. `reportSlotOf` and `commandSlotOf` bind one
|
|
3
|
+
// provider to its name; their closures keep the provider's kind tied to its name, so every function below loops over
|
|
4
|
+
// slots in provider order and never relates a name to the kinds map. The only places a name meets the map are the
|
|
5
|
+
// helpers in `keyed.ts`.
|
|
6
|
+
//
|
|
7
|
+
// The reports are what outcomes report of each resource's cleanup and what a `ran` outcome reports of each resource
|
|
8
|
+
// (`resourceReports`); the command halves settle the resources and say which error ends a run a resource refused
|
|
9
|
+
// (`bindCommands`). A command half knows nothing of the run's cleanup: the composition layer builds each refusal error
|
|
10
|
+
// with it.
|
|
11
|
+
import { entry, keyedSchema } from "./keyed.js";
|
|
12
|
+
/** `provider`'s reports, bound to its name. */
|
|
13
|
+
function reportSlotOf(provider) {
|
|
14
|
+
const { name, cleanup } = provider;
|
|
15
|
+
const ran = provider.ran;
|
|
16
|
+
return {
|
|
17
|
+
cleanupSchema: [name, cleanup.schema.optional()],
|
|
18
|
+
ranSchema: ran === undefined ? undefined : [name, ran.schema.optional()],
|
|
19
|
+
cleanupFacts: (released) => {
|
|
20
|
+
const one = released[name];
|
|
21
|
+
return one === undefined ? {} : entry(name, cleanup.facts(one));
|
|
22
|
+
},
|
|
23
|
+
cleanupRows: (facts) => {
|
|
24
|
+
const one = facts[name];
|
|
25
|
+
return one === undefined ? [] : cleanup.rows(one);
|
|
26
|
+
},
|
|
27
|
+
cleanupWarnings: (facts) => {
|
|
28
|
+
const one = facts[name];
|
|
29
|
+
return one === undefined ? [] : cleanup.warnings(one);
|
|
30
|
+
},
|
|
31
|
+
failuresText: (failures) => {
|
|
32
|
+
const count = failures[name] ?? 0;
|
|
33
|
+
return count === 0 ? [] : [cleanup.failuresText(count)];
|
|
34
|
+
},
|
|
35
|
+
ranFacts: (facts, requests) => {
|
|
36
|
+
const request = requests[name];
|
|
37
|
+
// A resource's facts can be `undefined`, so whether it was acquired is whether its name is there.
|
|
38
|
+
if (ran === undefined || request === undefined || !Object.hasOwn(facts, name))
|
|
39
|
+
return {};
|
|
40
|
+
return entry(name, ran.facts(facts[name], request));
|
|
41
|
+
},
|
|
42
|
+
ranWarnings: (reported) => {
|
|
43
|
+
const one = reported[name];
|
|
44
|
+
return ran === undefined || one === undefined ? [] : ran.warnings(one);
|
|
45
|
+
},
|
|
46
|
+
ranRows: (reported) => {
|
|
47
|
+
const one = reported[name];
|
|
48
|
+
return ran === undefined || one === undefined ? [] : ran.rows(one);
|
|
49
|
+
},
|
|
50
|
+
runnerResources: (options) => {
|
|
51
|
+
const one = options[name];
|
|
52
|
+
return one === undefined || provider.runnerResources === undefined ? {} : provider.runnerResources(one);
|
|
53
|
+
},
|
|
54
|
+
hostVariablesToDrop: provider.hostVariablesToDrop ?? [],
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** Every one of `providers`' reports, bound to their names, in order. */
|
|
58
|
+
export function resourceReports(providers) {
|
|
59
|
+
const slots = providers.map((provider) => reportSlotOf(provider));
|
|
60
|
+
return {
|
|
61
|
+
cleanupSchema: keyedSchema(slots.map((slot) => slot.cleanupSchema)),
|
|
62
|
+
cleanupFacts: (cleanup) => merged(slots.map((slot) => slot.cleanupFacts(cleanup))),
|
|
63
|
+
cleanupRows: (facts) => slots.flatMap((slot) => slot.cleanupRows(facts)),
|
|
64
|
+
cleanupWarnings: (facts) => slots.flatMap((slot) => slot.cleanupWarnings(facts)),
|
|
65
|
+
failuresTexts: (failures) => slots.flatMap((slot) => slot.failuresText(failures)),
|
|
66
|
+
ranSchema: keyedSchema(slots.flatMap((slot) => (slot.ranSchema === undefined ? [] : [slot.ranSchema]))),
|
|
67
|
+
ranFacts: (facts, requests) => merged(slots.map((slot) => slot.ranFacts(facts, requests))),
|
|
68
|
+
ranWarnings: (ran) => slots.flatMap((slot) => slot.ranWarnings(ran)),
|
|
69
|
+
ranRows: (ran) => slots.flatMap((slot) => slot.ranRows(ran)),
|
|
70
|
+
runnerResources: (options) => merged(slots.map((slot) => slot.runnerResources(options))),
|
|
71
|
+
hostVariablesToDrop: slots.flatMap((slot) => slot.hostVariablesToDrop),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
/** One map from `parts`, each keyed by one resource's name, in order. */
|
|
75
|
+
function merged(parts) {
|
|
76
|
+
let all = {};
|
|
77
|
+
for (const part of parts)
|
|
78
|
+
all = { ...all, ...part };
|
|
79
|
+
return all;
|
|
80
|
+
}
|
|
81
|
+
/** `provider`'s command half, bound to its name. */
|
|
82
|
+
function commandSlotOf(provider) {
|
|
83
|
+
const { name, command: half } = provider;
|
|
84
|
+
// None for a kind whose prepare never refuses, whose prepare refusal, and so its outcome, can't exist.
|
|
85
|
+
const unprepared = half.unpreparedError;
|
|
86
|
+
return {
|
|
87
|
+
settle: (options, env, configFile) => {
|
|
88
|
+
const one = options[name];
|
|
89
|
+
if (one === undefined)
|
|
90
|
+
return undefined;
|
|
91
|
+
const settled = half.settle({ options: one, env, configFile });
|
|
92
|
+
if (!settled.ok)
|
|
93
|
+
return settled;
|
|
94
|
+
return { ok: true, secrets: settled.secrets, requests: entry(name, settled.request) };
|
|
95
|
+
},
|
|
96
|
+
takesCredential: (options) => {
|
|
97
|
+
const one = options[name];
|
|
98
|
+
return one !== undefined && half.takesCredential(one);
|
|
99
|
+
},
|
|
100
|
+
// Each union is distributed over every name, so its member whose `resource` is `name` carries this resource's
|
|
101
|
+
// refusal.
|
|
102
|
+
refusalFacts: (outcome) => (outcome.resource === name ? half.refusalFacts(outcome.refusal) : undefined),
|
|
103
|
+
unpreparedError: (outcome) => (outcome.resource === name ? unprepared?.(outcome.refusal) : undefined),
|
|
104
|
+
canceledLines: (resources, cleanup) => half.canceledLines(resources[name], cleanup[name]),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/** Every one of `providers`' command halves, bound to their names, in order. */
|
|
108
|
+
export function bindCommands(providers) {
|
|
109
|
+
const slots = providers.map((provider) => commandSlotOf(provider));
|
|
110
|
+
const first = (answers, what) => {
|
|
111
|
+
const found = answers.find((answer) => answer !== undefined);
|
|
112
|
+
if (found === undefined)
|
|
113
|
+
throw new Error(`No resource answered ${what}`);
|
|
114
|
+
return found;
|
|
115
|
+
};
|
|
116
|
+
return {
|
|
117
|
+
settle: (options, env, configFile) => {
|
|
118
|
+
let secrets = [];
|
|
119
|
+
let requests = {};
|
|
120
|
+
for (const slot of slots) {
|
|
121
|
+
const settled = slot.settle(options, env, configFile);
|
|
122
|
+
if (settled === undefined)
|
|
123
|
+
continue;
|
|
124
|
+
if (!settled.ok)
|
|
125
|
+
return settled;
|
|
126
|
+
secrets = [...secrets, ...settled.secrets];
|
|
127
|
+
requests = { ...requests, ...settled.requests };
|
|
128
|
+
}
|
|
129
|
+
return { ok: true, secrets, requests };
|
|
130
|
+
},
|
|
131
|
+
takesCredential: (options) => slots.some((slot) => slot.takesCredential(options)),
|
|
132
|
+
refusalFacts: (outcome) => first(slots.map((slot) => slot.refusalFacts(outcome)), `${outcome.resource}'s refusal`),
|
|
133
|
+
unpreparedError: (outcome) => first(slots.map((slot) => slot.unpreparedError(outcome)), `${outcome.resource}'s prepare refusal`),
|
|
134
|
+
canceledLines: (resources, released) => slots.flatMap((slot) => slot.canceledLines(resources, released)),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { MintTarget } from "../credential/index.ts";
|
|
2
|
+
import type { RunnerEvent, SnapshotCacheNote } from "../runner/index.ts";
|
|
3
|
+
import type { Clock } from "../time/index.ts";
|
|
4
|
+
import type { TestEvent } from "../sdk/index.ts";
|
|
5
|
+
import type { AnyResources, ResourceEvent, ResourceFailures, ResourceHoldings, RunLane } from "./resource.ts";
|
|
6
|
+
import type { RanCommand } from "./timing.ts";
|
|
7
|
+
/** How a lane ended: ready for the command, failed, or stopped short of ready. */
|
|
8
|
+
export type LaneOutcome = "ready" | "failed" | "stopped";
|
|
9
|
+
/**
|
|
10
|
+
* What a run reports as it goes, in order, over the registry's kinds `K`. A run emits them; how they look is the
|
|
11
|
+
* caller's (`RunProgress`).
|
|
12
|
+
*
|
|
13
|
+
* - `started`: the run began; `version` is storm's, `commit` the git commit it was built from, if known,
|
|
14
|
+
* `configFile` the config file its settings came from, if any, `lanes` the lanes of the resources it holds, in
|
|
15
|
+
* provider order: none when it holds no resource with a lane, and `resources` the resources it holds, by name, in
|
|
16
|
+
* provider order.
|
|
17
|
+
* - `runner-prepared`: in a runner run, what the local checks found: the base, a full SHA, and the ref it is HEAD's
|
|
18
|
+
* merge-base with; the untracked nested Git repositories the upload leaves out; and what the cache read noticed.
|
|
19
|
+
* - `minting`, `minted` and `requesting-token`: a credential's events (`CredentialEvent`): the run's one mint, which a
|
|
20
|
+
* runner run makes for its runner sandbox and a resource makes in a local run, and a GitHub Actions OIDC token
|
|
21
|
+
* request.
|
|
22
|
+
* - `lanes-started`: in a runner run, acquiring the resources and readying the runner sandbox started together, after
|
|
23
|
+
* the mint; without a resource, readying the runner sandbox started alone.
|
|
24
|
+
* - `lane-started`: acquiring a resource with a lane started, in either kind of run; the runner lane starts with
|
|
25
|
+
* `lanes-started` instead.
|
|
26
|
+
* - `lane-ended`: one lane ended: `ready`, `failed`, or `stopped` by a signal or because another lane failed. In a
|
|
27
|
+
* runner run each lane ends this way, and the command starts once every lane it has is ready; with `--local` a
|
|
28
|
+
* resource's lane ends once acquiring it does. A run that doesn't ask for a resource reports no lane of its.
|
|
29
|
+
* - `command-started`: the command started, or in a runner run is about to start in the runner sandbox.
|
|
30
|
+
* - `command-ended`: the command ended as `outcome` after `ms`; `command` is its executable's name. A command the
|
|
31
|
+
* run killed reports the runner's `command-stopped` instead.
|
|
32
|
+
* - `cleanup-started`: the run is cleaning up: in a runner run (`runner`) stopping and deleting the runner's
|
|
33
|
+
* sandboxes, but for the runner sandbox it keeps running `keepSandboxMs` when that is above 0 (always 0 in a local
|
|
34
|
+
* run), then releasing its resources, holding what `holdings` says of each.
|
|
35
|
+
* - `cleanup-finished`: it is done; `resourceFailures` counts, for each resource the run held, what releasing it
|
|
36
|
+
* couldn't do, and in a runner run `notStopped` and `notDeleted` sandboxes couldn't be stopped or deleted.
|
|
37
|
+
* - `test`: in a runner run, a test event the command appended to the run payload's `testEvents` file, as it
|
|
38
|
+
* arrived; `test-event-unreadable`: a line there that holds none; `test-events-incomplete`: the final read of the
|
|
39
|
+
* file, once the command ended, failed with `message`, so the test events followed may not be all of them.
|
|
40
|
+
* - `runner`: in a runner run, what readying the runner sandbox and running the command in it reported.
|
|
41
|
+
* - `resource`: what one resource reported, nested with its name (`ResourceEvent`).
|
|
42
|
+
*/
|
|
43
|
+
export type RunEvent<K> = {
|
|
44
|
+
readonly kind: "started";
|
|
45
|
+
readonly version: string;
|
|
46
|
+
readonly commit: string | null;
|
|
47
|
+
readonly configFile: string | null;
|
|
48
|
+
readonly lanes: readonly RunLane<K>[];
|
|
49
|
+
readonly resources: readonly (keyof K & string)[];
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: "runner-prepared";
|
|
52
|
+
readonly base: string;
|
|
53
|
+
readonly baseRef: string;
|
|
54
|
+
readonly nestedRepositories: readonly string[];
|
|
55
|
+
readonly notes: readonly SnapshotCacheNote[];
|
|
56
|
+
} | CredentialEvent | {
|
|
57
|
+
readonly kind: "lanes-started";
|
|
58
|
+
} | {
|
|
59
|
+
readonly kind: "lane-started";
|
|
60
|
+
readonly lane: RunLane<K>;
|
|
61
|
+
} | {
|
|
62
|
+
readonly kind: "lane-ended";
|
|
63
|
+
readonly lane: RunLane<K>;
|
|
64
|
+
readonly outcome: LaneOutcome;
|
|
65
|
+
} | {
|
|
66
|
+
readonly kind: "command-started";
|
|
67
|
+
readonly argv: readonly string[];
|
|
68
|
+
} | {
|
|
69
|
+
readonly kind: "command-ended";
|
|
70
|
+
readonly command: string;
|
|
71
|
+
readonly outcome: RanCommand;
|
|
72
|
+
readonly ms: number;
|
|
73
|
+
} | {
|
|
74
|
+
readonly kind: "cleanup-started";
|
|
75
|
+
readonly runner: boolean;
|
|
76
|
+
readonly keepSandboxMs: number;
|
|
77
|
+
readonly holdings: ResourceHoldings<K>;
|
|
78
|
+
} | {
|
|
79
|
+
readonly kind: "cleanup-finished";
|
|
80
|
+
readonly resourceFailures: ResourceFailures<K>;
|
|
81
|
+
readonly notStopped: number;
|
|
82
|
+
readonly notDeleted: number;
|
|
83
|
+
} | {
|
|
84
|
+
readonly kind: "test";
|
|
85
|
+
readonly event: TestEvent;
|
|
86
|
+
} | {
|
|
87
|
+
readonly kind: "test-event-unreadable";
|
|
88
|
+
} | {
|
|
89
|
+
readonly kind: "test-events-incomplete";
|
|
90
|
+
readonly message: string;
|
|
91
|
+
} | {
|
|
92
|
+
readonly kind: "runner";
|
|
93
|
+
readonly event: RunnerEvent;
|
|
94
|
+
} | ResourceEvent<K>;
|
|
95
|
+
/** A credential's events: the run's one mint, and a GitHub Actions OIDC token request. */
|
|
96
|
+
export type CredentialEvent = {
|
|
97
|
+
readonly kind: "minting";
|
|
98
|
+
readonly target: MintTarget;
|
|
99
|
+
} | {
|
|
100
|
+
readonly kind: "minted";
|
|
101
|
+
readonly target: MintTarget;
|
|
102
|
+
readonly ok: boolean;
|
|
103
|
+
} | {
|
|
104
|
+
readonly kind: "requesting-token";
|
|
105
|
+
};
|
|
106
|
+
/** Hears a credential's events. */
|
|
107
|
+
export interface CredentialProgress {
|
|
108
|
+
emit(event: CredentialEvent): Promise<void>;
|
|
109
|
+
}
|
|
110
|
+
/** Hears a run's events as they happen. */
|
|
111
|
+
export interface RunProgress<K> {
|
|
112
|
+
emit(event: RunEvent<K>): Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
/** Progress that reports nothing. */
|
|
115
|
+
export declare const silentProgress: RunProgress<AnyResources>;
|
|
116
|
+
/** A run event and when it happened, by the run's clock. */
|
|
117
|
+
export interface TimedRunEvent<K> {
|
|
118
|
+
readonly event: RunEvent<K>;
|
|
119
|
+
readonly at: Date;
|
|
120
|
+
}
|
|
121
|
+
/** Hears a run's events with the time each happened: what renders a run's progress and writes its run directory. */
|
|
122
|
+
export interface RunObserver<K> {
|
|
123
|
+
observe(timed: TimedRunEvent<K>): Promise<void>;
|
|
124
|
+
}
|
|
125
|
+
/** Progress that stamps each event with `clock`'s time as it is emitted, and hands it to `observer`. */
|
|
126
|
+
export declare function timedProgress<K>(clock: Clock, observer: RunObserver<K>): RunProgress<K>;
|
|
127
|
+
/** An observer that hands each event to every one of `observers`, in order. */
|
|
128
|
+
export declare function observeAll<K>(...observers: readonly RunObserver<K>[]): RunObserver<K>;
|