@cnc-tools/storm 0.0.0 → 0.6.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/exec/cleanup.d.ts +135 -0
- package/dist/commands/exec/cleanup.js +171 -0
- package/dist/commands/exec/command.d.ts +272 -0
- package/dist/commands/exec/command.js +23 -0
- package/dist/commands/exec/job-summary.d.ts +10 -0
- package/dist/commands/exec/job-summary.js +34 -0
- package/dist/commands/exec/live-view.d.ts +22 -0
- package/dist/commands/exec/live-view.js +395 -0
- package/dist/commands/exec/metadata.d.ts +66 -0
- package/dist/commands/exec/metadata.js +55 -0
- package/dist/commands/exec/mint-failed.d.ts +11 -0
- package/dist/commands/exec/mint-failed.js +33 -0
- package/dist/commands/exec/outcomes.d.ts +614 -0
- package/dist/commands/exec/outcomes.js +338 -0
- package/dist/commands/exec/progress.d.ts +44 -0
- package/dist/commands/exec/progress.js +277 -0
- package/dist/commands/exec/redaction.d.ts +15 -0
- package/dist/commands/exec/redaction.js +40 -0
- package/dist/commands/exec/run-collector.d.ts +30 -0
- package/dist/commands/exec/run-collector.js +73 -0
- package/dist/commands/exec/run-command.d.ts +221 -0
- package/dist/commands/exec/run-command.js +663 -0
- package/dist/commands/exec/run-metadata.d.ts +56 -0
- package/dist/commands/exec/run-metadata.js +58 -0
- package/dist/commands/exec/run-record.d.ts +170 -0
- package/dist/commands/exec/run-record.js +104 -0
- package/dist/commands/exec/tests-summary.d.ts +34 -0
- package/dist/commands/exec/tests-summary.js +141 -0
- package/dist/commands/exec/testserver-flags.d.ts +48 -0
- package/dist/commands/exec/testserver-flags.js +80 -0
- package/dist/commands/exec/text.d.ts +22 -0
- package/dist/commands/exec/text.js +74 -0
- package/dist/commands/exec/view.d.ts +35 -0
- package/dist/commands/exec/view.js +163 -0
- package/dist/commands/exec/waterfall.d.ts +25 -0
- package/dist/commands/exec/waterfall.js +108 -0
- package/dist/commands/exec/worker-chart.d.ts +79 -0
- package/dist/commands/exec/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 +80 -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 +320 -0
- package/dist/commands/vitest/command.d.ts +299 -0
- package/dist/commands/vitest/command.js +138 -0
- package/dist/commands/vitest/metadata.d.ts +66 -0
- package/dist/commands/vitest/metadata.js +35 -0
- package/dist/commands/vitest/outcomes.d.ts +273 -0
- package/dist/commands/vitest/outcomes.js +77 -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 +10 -0
- package/dist/config/index.js +13 -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 +27 -0
- package/dist/config/set.js +71 -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 +39 -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 +89 -0
- package/dist/context.js +45 -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 +78 -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 +455 -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/find-vitest.d.ts +7 -0
- package/dist/vitest/find-vitest.js +28 -0
- package/dist/vitest/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +78 -0
- package/dist/vitest/gateways.js +4 -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 +11 -0
- package/dist/vitest/live/list-gateway.js +107 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +66 -0
- package/dist/vitest/plan.js +104 -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 +33 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
// The run directories on disk: one directory per run, named for its run id, under one root. Each file a run writes
|
|
2
|
+
// is an append stream, so writes stay in order without waiting on each other. Directories are mode 0700 and files
|
|
3
|
+
// 0600: a step's output can hold anything the step printed.
|
|
4
|
+
//
|
|
5
|
+
// The root is shared by every worktree's runs, so a run directory is marked active (`active.json`) while its run goes
|
|
6
|
+
// on, and pruning never removes an active one. A run directory appears under its run id already marked, with its
|
|
7
|
+
// `run.json`: it is made under a hidden temporary name, marked, then renamed. `run.json` and `timeline.json` are each
|
|
8
|
+
// replaced whole, through a temporary file renamed over the old one, so a reader never sees one half written. A local
|
|
9
|
+
// command stages its raw test events in `.test-events.jsonl`, which no reader opens. The run appends redacted test
|
|
10
|
+
// events to `.tests.jsonl.partial`, then renames it to `tests.jsonl` once it is over. Closing the run directory removes
|
|
11
|
+
// both private files whatever failed before, and pruning removes any a run that never closed its run directory left in
|
|
12
|
+
// one it keeps.
|
|
13
|
+
import { randomBytes } from "node:crypto";
|
|
14
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
15
|
+
import { mkdir, readdir, readFile, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
16
|
+
import { hostname as osHostname } from "node:os";
|
|
17
|
+
import { join } from "node:path";
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
import { ACTIVE_MARKER, COMMAND_LOG, EVENTS_FILE, RUN_FILE, RUN_ID_PATTERN, RUN_LOGS, runIdPrefix, runLogFile, TEST_EVENTS_STAGING_FILE, TESTS_FILE, TESTS_PARTIAL_FILE, TIMELINE_FILE, } from "../run-directory.js";
|
|
20
|
+
const DIRECTORY_MODE = 0o700;
|
|
21
|
+
const FILE_MODE = 0o600;
|
|
22
|
+
/**
|
|
23
|
+
* How long an active marker another host holds, or one that can't be read, keeps its run directory active, since no
|
|
24
|
+
* process on this host can tell whether its holder still runs: 24 hours.
|
|
25
|
+
*/
|
|
26
|
+
const ACTIVE_MARKER_TRUST_MS = 24 * 60 * 60 * 1000;
|
|
27
|
+
/** How many run directories a listing reads, or pruning sweeps of staged test events, at once. */
|
|
28
|
+
const LIST_BATCH = 32;
|
|
29
|
+
/** The run directories under `options.directory`. */
|
|
30
|
+
export function liveRunDirectoryGateway(options) {
|
|
31
|
+
const holders = {
|
|
32
|
+
self: options.holder ?? { pid: process.pid, hostname: osHostname() },
|
|
33
|
+
isAlive: options.isAlive ?? isAlive,
|
|
34
|
+
};
|
|
35
|
+
return {
|
|
36
|
+
open: (request) => open(options.directory, holders, request),
|
|
37
|
+
list: (request) => list(options.directory, holders, request.now),
|
|
38
|
+
read: (request) => read(options.directory, holders, request),
|
|
39
|
+
readLog: (request) => readLog(options.directory, request),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Run directories that can't be found, because neither `XDG_STATE_HOME` nor `HOME` names a place for them. Opening,
|
|
44
|
+
* listing or reading one fails with `reason`, at `location`.
|
|
45
|
+
*/
|
|
46
|
+
export function unavailableRunDirectoryGateway(location, reason) {
|
|
47
|
+
const failure = () => ({ path: location, message: reason });
|
|
48
|
+
return {
|
|
49
|
+
open: async () => ({ ok: false, failure: failure() }),
|
|
50
|
+
list: async () => ({ ok: false, failure: failure() }),
|
|
51
|
+
read: async () => ({ kind: "failed", failure: failure() }),
|
|
52
|
+
readLog: async () => ({ kind: "failed", failure: failure() }),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const markerSchema = z.object({
|
|
56
|
+
pid: z.number().int().positive(),
|
|
57
|
+
hostname: z.string().min(1),
|
|
58
|
+
startedAt: z.iso.datetime(),
|
|
59
|
+
});
|
|
60
|
+
async function open(root, holders, request) {
|
|
61
|
+
const id = `${runIdPrefix(request.startedAt)}-${randomBytes(2).toString("hex")}`;
|
|
62
|
+
const path = join(root, id);
|
|
63
|
+
// A hidden name no run id matches, so pruning never sees the directory before it is marked.
|
|
64
|
+
const opening = join(root, `.opening-${id}-${randomBytes(4).toString("hex")}`);
|
|
65
|
+
try {
|
|
66
|
+
await mkdir(root, { recursive: true, mode: DIRECTORY_MODE });
|
|
67
|
+
await mkdir(opening, { mode: DIRECTORY_MODE });
|
|
68
|
+
const marker = { ...holders.self, startedAt: request.startedAt.toISOString() };
|
|
69
|
+
await writeFile(join(opening, ACTIVE_MARKER), `${JSON.stringify(marker)}\n`, { mode: FILE_MODE, flag: "wx" });
|
|
70
|
+
await writeFile(join(opening, RUN_FILE), `${request.run}\n`, { mode: FILE_MODE, flag: "wx" });
|
|
71
|
+
await rename(opening, path);
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
await rm(opening, { recursive: true, force: true }).catch(() => undefined);
|
|
75
|
+
return { ok: false, failure: { path, message: messageOf(error) } };
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
ok: true,
|
|
79
|
+
directory: runDirectory(path, id),
|
|
80
|
+
pruneFailures: await prune(root, request.keep, holders, request.startedAt),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Removes every completed run directory under `root` but the newest `keep`, by run id, and the staged test events left
|
|
85
|
+
* in each completed one it keeps. An active one stays as it is, and doesn't count toward `keep`.
|
|
86
|
+
*/
|
|
87
|
+
async function prune(root, keep, holders, now) {
|
|
88
|
+
let names;
|
|
89
|
+
try {
|
|
90
|
+
names = (await readdir(root)).filter((name) => RUN_ID_PATTERN.test(name));
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
return [{ path: root, message: messageOf(error) }];
|
|
94
|
+
}
|
|
95
|
+
const completed = [];
|
|
96
|
+
for (const name of names)
|
|
97
|
+
if (!(await isActive(join(root, name), holders, now)))
|
|
98
|
+
completed.push(name);
|
|
99
|
+
const failures = [];
|
|
100
|
+
const newestFirst = completed.toSorted().toReversed();
|
|
101
|
+
for (const name of newestFirst.slice(keep)) {
|
|
102
|
+
const path = join(root, name);
|
|
103
|
+
try {
|
|
104
|
+
await rm(path, { recursive: true, force: true });
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
failures.push({ path, message: messageOf(error) });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
// A run that ended without closing its run directory, such as one a second signal ended, left its private test
|
|
111
|
+
// event files. In batches, as a listing reads, so many kept run directories don't remove one at a time.
|
|
112
|
+
const kept = newestFirst.slice(0, keep);
|
|
113
|
+
const leftovers = kept.flatMap((name) => [TEST_EVENTS_STAGING_FILE, TESTS_PARTIAL_FILE].map((file) => join(root, name, file)));
|
|
114
|
+
for (let start = 0; start < leftovers.length; start += LIST_BATCH) {
|
|
115
|
+
const removed = await Promise.all(leftovers.slice(start, start + LIST_BATCH).map(async (file) => {
|
|
116
|
+
try {
|
|
117
|
+
await rm(file, { force: true });
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
return [{ path: file, message: messageOf(error) }];
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
failures.push(...removed.flat());
|
|
125
|
+
}
|
|
126
|
+
return failures;
|
|
127
|
+
}
|
|
128
|
+
/** Every run directory under `root`, newest first, each with whether it is active at `now` and its `run.json`. */
|
|
129
|
+
async function list(root, holders, now) {
|
|
130
|
+
let names;
|
|
131
|
+
try {
|
|
132
|
+
names = (await readdir(root)).filter((name) => RUN_ID_PATTERN.test(name));
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
if (errorCode(error) === "ENOENT")
|
|
136
|
+
return { ok: true, runs: [] };
|
|
137
|
+
return { ok: false, failure: { path: root, message: messageOf(error) } };
|
|
138
|
+
}
|
|
139
|
+
const ordered = names.toSorted().toReversed();
|
|
140
|
+
const runs = [];
|
|
141
|
+
// In batches, so a root with many run directories doesn't open every file at once.
|
|
142
|
+
for (let start = 0; start < ordered.length; start += LIST_BATCH) {
|
|
143
|
+
runs.push(...(await Promise.all(ordered.slice(start, start + LIST_BATCH).map(async (id) => {
|
|
144
|
+
const path = join(root, id);
|
|
145
|
+
const run = await readOptional(join(path, RUN_FILE));
|
|
146
|
+
return {
|
|
147
|
+
id,
|
|
148
|
+
path,
|
|
149
|
+
active: await isActive(path, holders, now),
|
|
150
|
+
run: run.kind === "found" ? run.text : undefined,
|
|
151
|
+
};
|
|
152
|
+
}))));
|
|
153
|
+
}
|
|
154
|
+
return { ok: true, runs };
|
|
155
|
+
}
|
|
156
|
+
/** Run directory `id` under `root`, with whether it is active at `now`, and its files as they read. */
|
|
157
|
+
async function read(root, holders, request) {
|
|
158
|
+
// Anything else, such as `..`, names no run directory.
|
|
159
|
+
if (!RUN_ID_PATTERN.test(request.id))
|
|
160
|
+
return { kind: "not-found" };
|
|
161
|
+
const path = join(root, request.id);
|
|
162
|
+
try {
|
|
163
|
+
if (!(await stat(path)).isDirectory())
|
|
164
|
+
return { kind: "not-found" };
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
if (errorCode(error) === "ENOENT")
|
|
168
|
+
return { kind: "not-found" };
|
|
169
|
+
return { kind: "failed", failure: { path, message: messageOf(error) } };
|
|
170
|
+
}
|
|
171
|
+
const [run, tests, timeline] = await Promise.all([RUN_FILE, TESTS_FILE, TIMELINE_FILE].map((name) => readOptional(join(path, name))));
|
|
172
|
+
for (const file of [run, tests, timeline])
|
|
173
|
+
if (file?.kind === "failed")
|
|
174
|
+
return { kind: "failed", failure: file.failure };
|
|
175
|
+
const text = (file) => (file?.kind === "found" ? file.text : undefined);
|
|
176
|
+
const testsText = text(tests);
|
|
177
|
+
const held = await Promise.all(RUN_LOGS.map(async (log) => ((await exists(join(path, runLogFile(log)))) ? log : [])));
|
|
178
|
+
return {
|
|
179
|
+
kind: "found",
|
|
180
|
+
directory: {
|
|
181
|
+
id: request.id,
|
|
182
|
+
path,
|
|
183
|
+
active: await isActive(path, holders, request.now),
|
|
184
|
+
run: text(run),
|
|
185
|
+
tests: testsText === undefined ? undefined : testsText.split("\n").filter((line) => line !== ""),
|
|
186
|
+
timeline: text(timeline),
|
|
187
|
+
logs: held.flat(),
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
/** Whether `file` exists; a file it can't tell about counts as missing. */
|
|
192
|
+
async function exists(file) {
|
|
193
|
+
try {
|
|
194
|
+
await stat(file);
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
catch {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
/** Run log `log` of run directory `id` under `root`, as it is now. */
|
|
202
|
+
async function readLog(root, request) {
|
|
203
|
+
if (!RUN_ID_PATTERN.test(request.id))
|
|
204
|
+
return { kind: "not-found" };
|
|
205
|
+
const file = join(root, request.id, runLogFile(request.log));
|
|
206
|
+
try {
|
|
207
|
+
return { kind: "found", path: file, text: completeUtf8(await readFile(file)).toString("utf8") };
|
|
208
|
+
}
|
|
209
|
+
catch (error) {
|
|
210
|
+
if (errorCode(error) === "ENOENT")
|
|
211
|
+
return { kind: "not-found" };
|
|
212
|
+
return { kind: "failed", failure: { path: file, message: messageOf(error) } };
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/** `bytes` less a UTF-8 character at its end that isn't whole yet, as one still being written. */
|
|
216
|
+
function completeUtf8(bytes) {
|
|
217
|
+
// A character takes at most 4 bytes, so only the last 3 can start one that isn't whole.
|
|
218
|
+
for (let back = 1; back <= Math.min(3, bytes.length); back += 1) {
|
|
219
|
+
const byte = bytes[bytes.length - back] ?? 0;
|
|
220
|
+
if ((byte & 0b1100_0000) === 0b1000_0000)
|
|
221
|
+
continue;
|
|
222
|
+
const needs = byte >= 0b1111_0000 ? 4 : byte >= 0b1110_0000 ? 3 : byte >= 0b1100_0000 ? 2 : 1;
|
|
223
|
+
return needs > back ? bytes.subarray(0, bytes.length - back) : bytes;
|
|
224
|
+
}
|
|
225
|
+
return bytes;
|
|
226
|
+
}
|
|
227
|
+
/** File `file`'s text, or that there is none, or why it couldn't be read. */
|
|
228
|
+
async function readOptional(file) {
|
|
229
|
+
try {
|
|
230
|
+
return { kind: "found", text: await readFile(file, "utf8") };
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
if (errorCode(error) === "ENOENT")
|
|
234
|
+
return { kind: "missing" };
|
|
235
|
+
return { kind: "failed", failure: { path: file, message: messageOf(error) } };
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Whether run directory `path` is active, as its active marker says at `now`. Without a marker it is completed. A
|
|
240
|
+
* marker this host holds is active while its process runs; one another host holds, while its run started under 24
|
|
241
|
+
* hours ago; and one that can't be read or parsed, while it was written under 24 hours ago.
|
|
242
|
+
*/
|
|
243
|
+
async function isActive(path, holders, now) {
|
|
244
|
+
const file = join(path, ACTIVE_MARKER);
|
|
245
|
+
let text;
|
|
246
|
+
try {
|
|
247
|
+
text = await readFile(file, "utf8");
|
|
248
|
+
}
|
|
249
|
+
catch (error) {
|
|
250
|
+
if (errorCode(error) === "ENOENT")
|
|
251
|
+
return false;
|
|
252
|
+
return trustedSince(file, now);
|
|
253
|
+
}
|
|
254
|
+
const parsed = markerSchema.safeParse(parseJson(text));
|
|
255
|
+
if (!parsed.success)
|
|
256
|
+
return trustedSince(file, now);
|
|
257
|
+
const { pid, hostname, startedAt } = parsed.data;
|
|
258
|
+
if (hostname === holders.self.hostname)
|
|
259
|
+
return holders.isAlive(pid);
|
|
260
|
+
return now.getTime() - Date.parse(startedAt) < ACTIVE_MARKER_TRUST_MS;
|
|
261
|
+
}
|
|
262
|
+
/** Whether marker `file` was written under 24 hours before `now`; false when it is gone. */
|
|
263
|
+
async function trustedSince(file, now) {
|
|
264
|
+
try {
|
|
265
|
+
return now.getTime() - (await stat(file)).mtime.getTime() < ACTIVE_MARKER_TRUST_MS;
|
|
266
|
+
}
|
|
267
|
+
catch {
|
|
268
|
+
return false;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
function parseJson(text) {
|
|
272
|
+
try {
|
|
273
|
+
return JSON.parse(text);
|
|
274
|
+
}
|
|
275
|
+
catch {
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/** Whether process `pid` on this host runs. Only `ESRCH` proves it doesn't: `EPERM` means it runs under another user. */
|
|
280
|
+
function isAlive(pid) {
|
|
281
|
+
try {
|
|
282
|
+
process.kill(pid, 0);
|
|
283
|
+
return true;
|
|
284
|
+
}
|
|
285
|
+
catch (error) {
|
|
286
|
+
return errorCode(error) !== "ESRCH";
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
function errorCode(error) {
|
|
290
|
+
return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : undefined;
|
|
291
|
+
}
|
|
292
|
+
function runDirectory(path, id) {
|
|
293
|
+
const streams = new Map();
|
|
294
|
+
let failure;
|
|
295
|
+
let closed = false;
|
|
296
|
+
let testsPublished = false;
|
|
297
|
+
/** Whole-file changes, replacements and removals, one after another in the order asked. */
|
|
298
|
+
let changing = Promise.resolve();
|
|
299
|
+
const inTurn = (file, change) => {
|
|
300
|
+
if (failure !== undefined || closed)
|
|
301
|
+
return;
|
|
302
|
+
changing = changing.then(async () => {
|
|
303
|
+
if (failure !== undefined)
|
|
304
|
+
return;
|
|
305
|
+
try {
|
|
306
|
+
await change();
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
failure ??= { path: file, message: messageOf(error) };
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
};
|
|
313
|
+
const replace = (name, text) => {
|
|
314
|
+
const file = join(path, name);
|
|
315
|
+
inTurn(file, async () => {
|
|
316
|
+
const temporary = join(path, `.${name}.${randomBytes(4).toString("hex")}.tmp`);
|
|
317
|
+
try {
|
|
318
|
+
await writeFile(temporary, text, { mode: FILE_MODE, flag: "wx" });
|
|
319
|
+
await rename(temporary, file);
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
await rm(temporary, { force: true }).catch(() => undefined);
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
};
|
|
327
|
+
const stream = (name) => {
|
|
328
|
+
if (failure !== undefined || closed)
|
|
329
|
+
return undefined;
|
|
330
|
+
let opened = streams.get(name);
|
|
331
|
+
if (opened === undefined) {
|
|
332
|
+
const file = join(path, name);
|
|
333
|
+
opened = createWriteStream(file, { flags: "a", mode: FILE_MODE });
|
|
334
|
+
opened.on("error", (error) => {
|
|
335
|
+
failure ??= { path: file, message: messageOf(error) };
|
|
336
|
+
});
|
|
337
|
+
streams.set(name, opened);
|
|
338
|
+
}
|
|
339
|
+
return opened;
|
|
340
|
+
};
|
|
341
|
+
const append = (name, text) => void stream(name)?.write(text);
|
|
342
|
+
const endStream = async (name) => {
|
|
343
|
+
const opened = streams.get(name);
|
|
344
|
+
if (opened === undefined)
|
|
345
|
+
return;
|
|
346
|
+
streams.delete(name);
|
|
347
|
+
await ended(opened);
|
|
348
|
+
};
|
|
349
|
+
return {
|
|
350
|
+
path,
|
|
351
|
+
id,
|
|
352
|
+
writeRun: (text) => replace(RUN_FILE, `${text}\n`),
|
|
353
|
+
appendEvent: (line) => append(EVENTS_FILE, `${line}\n`),
|
|
354
|
+
appendStepOutput: (step, line) => append(runLogFile(step), `${line}\n`),
|
|
355
|
+
appendCommandOutput: (text) => append(COMMAND_LOG, text),
|
|
356
|
+
appendTestEvent: (line) => {
|
|
357
|
+
if (!testsPublished)
|
|
358
|
+
append(TESTS_PARTIAL_FILE, `${line}\n`);
|
|
359
|
+
},
|
|
360
|
+
publishTestEvents: () => {
|
|
361
|
+
if (testsPublished)
|
|
362
|
+
return;
|
|
363
|
+
testsPublished = true;
|
|
364
|
+
const partial = join(path, TESTS_PARTIAL_FILE);
|
|
365
|
+
inTurn(join(path, TESTS_FILE), async () => {
|
|
366
|
+
await endStream(TESTS_PARTIAL_FILE);
|
|
367
|
+
if (failure !== undefined)
|
|
368
|
+
return;
|
|
369
|
+
await writeFile(partial, "", { mode: FILE_MODE, flag: "a" });
|
|
370
|
+
await rename(partial, join(path, TESTS_FILE));
|
|
371
|
+
});
|
|
372
|
+
},
|
|
373
|
+
writeTimeline: (text) => replace(TIMELINE_FILE, `${text}\n`),
|
|
374
|
+
readTestEvents: (onLine) => readStagedTestEvents(join(path, TEST_EVENTS_STAGING_FILE), onLine),
|
|
375
|
+
close: async () => {
|
|
376
|
+
closed = true;
|
|
377
|
+
await changing;
|
|
378
|
+
await Promise.all([...streams.values()].map(ended));
|
|
379
|
+
streams.clear();
|
|
380
|
+
// The staged test events are unredacted, so they go whatever failed before, a failed publish of `tests.jsonl`
|
|
381
|
+
// included, and not in turn, which a failure would skip. An unpublished partial file is never a result.
|
|
382
|
+
for (const name of [TEST_EVENTS_STAGING_FILE, TESTS_PARTIAL_FILE]) {
|
|
383
|
+
const file = join(path, name);
|
|
384
|
+
try {
|
|
385
|
+
await rm(file, { force: true });
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
failure ??= { path: file, message: messageOf(error) };
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
// The run is over whatever failed: its run directory is completed.
|
|
392
|
+
const marker = join(path, ACTIVE_MARKER);
|
|
393
|
+
try {
|
|
394
|
+
await unlink(marker);
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
failure ??= { path: marker, message: messageOf(error) };
|
|
398
|
+
}
|
|
399
|
+
return failure;
|
|
400
|
+
},
|
|
401
|
+
};
|
|
402
|
+
}
|
|
403
|
+
/** Resolves once `stream` has closed, ending it first when it is still open. */
|
|
404
|
+
function ended(stream) {
|
|
405
|
+
return new Promise((resolve) => {
|
|
406
|
+
if (stream.closed || stream.destroyed)
|
|
407
|
+
resolve();
|
|
408
|
+
else {
|
|
409
|
+
stream.once("close", () => resolve());
|
|
410
|
+
stream.end();
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
/** Streams `file`'s non-empty lines to `onLine`, a missing file as empty, and returns why a read stopped early. */
|
|
415
|
+
async function readStagedTestEvents(file, onLine) {
|
|
416
|
+
let pending = "";
|
|
417
|
+
try {
|
|
418
|
+
for await (const chunk of createReadStream(file, { encoding: "utf8" })) {
|
|
419
|
+
const lines = `${pending}${String(chunk)}`.split("\n");
|
|
420
|
+
pending = lines.pop() ?? "";
|
|
421
|
+
for (const line of lines)
|
|
422
|
+
if (line !== "")
|
|
423
|
+
onLine(line);
|
|
424
|
+
}
|
|
425
|
+
if (pending !== "")
|
|
426
|
+
onLine(pending);
|
|
427
|
+
return { ok: true };
|
|
428
|
+
}
|
|
429
|
+
catch (error) {
|
|
430
|
+
if (errorCode(error) === "ENOENT")
|
|
431
|
+
return { ok: true };
|
|
432
|
+
return { ok: false, failure: { path: file, message: messageOf(error) } };
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
function messageOf(error) {
|
|
436
|
+
return error instanceof Error ? error.message : String(error);
|
|
437
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CredentialGateway, type CredentialSource, type MintTarget } from "../credential/index.ts";
|
|
2
|
+
import type { CredentialProgress } from "./events.ts";
|
|
3
|
+
/** Mints for `target` through `context`, reporting the mint's start and end to `progress`. */
|
|
4
|
+
export declare function mintReported(context: {
|
|
5
|
+
readonly credentials: CredentialGateway;
|
|
6
|
+
}, target: MintTarget, progress: CredentialProgress): Promise<Awaited<ReturnType<CredentialGateway["mint"]>>>;
|
|
7
|
+
/** The mint for `target` as a credential source, reporting the mint's start and end to `progress`. */
|
|
8
|
+
export declare function mintSourceReported(context: {
|
|
9
|
+
readonly credentials: CredentialGateway;
|
|
10
|
+
}, target: MintTarget, progress: CredentialProgress): CredentialSource;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// A mint, reported: a runner run mints for its runner sandbox, and a local run that settled the mint builds its
|
|
2
|
+
// credential source from it.
|
|
3
|
+
import { mintSource } from "../credential/index.js";
|
|
4
|
+
/** Mints for `target` through `context`, reporting the mint's start and end to `progress`. */
|
|
5
|
+
export async function mintReported(context, target, progress) {
|
|
6
|
+
await progress.emit({ kind: "minting", target });
|
|
7
|
+
const minted = await context.credentials.mint(target);
|
|
8
|
+
await progress.emit({ kind: "minted", target, ok: minted.ok });
|
|
9
|
+
return minted;
|
|
10
|
+
}
|
|
11
|
+
/** The mint for `target` as a credential source, reporting the mint's start and end to `progress`. */
|
|
12
|
+
export function mintSourceReported(context, target, progress) {
|
|
13
|
+
return mintSource(target, () => mintReported(context, target, progress));
|
|
14
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type RunPayload } from "../sdk/index.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The run payload for a run holding `resources`, each resource's entry under its name (the resource providers'
|
|
4
|
+
* `payload`); `{}` for a run that holds none. It names `testEvents` as the file the command appends test events to,
|
|
5
|
+
* when the run follows them, and says whether the run is `verbose`. The registry's test (`registry-types.test.ts`)
|
|
6
|
+
* checks that its resources' entries are the SDK's `RunPayloadResources`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function runPayload<R extends object>(resources: R, options?: {
|
|
9
|
+
readonly testEvents?: string;
|
|
10
|
+
readonly verbose?: boolean;
|
|
11
|
+
}): Omit<RunPayload, "resources"> & {
|
|
12
|
+
readonly resources: R;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* The command's environment: `env` whole, less unset variables, with `STORM_RUN` set to the run payload's JSON. A
|
|
16
|
+
* variable the command must not see is the caller's to leave out of `env`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function commandEnvironment(env: Readonly<Record<string, string | undefined>>, payload: Omit<RunPayload, "resources"> & {
|
|
19
|
+
readonly resources: object;
|
|
20
|
+
}): Readonly<Record<string, string>>;
|
|
21
|
+
/**
|
|
22
|
+
* `env` with color set for a local command whose stdout and stderr are pipes, so it can't tell whether a terminal
|
|
23
|
+
* shows color: `FORCE_COLOR=1` when the terminal storm writes its output to shows color, else `NO_COLOR=1`. An
|
|
24
|
+
* `env` that sets either already is left as it is.
|
|
25
|
+
*/
|
|
26
|
+
export declare function colorEnvironment(env: Readonly<Record<string, string | undefined>>, color: boolean): Readonly<Record<string, string | undefined>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RUN_PAYLOAD_VARIABLE } from "../sdk/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* The run payload for a run holding `resources`, each resource's entry under its name (the resource providers'
|
|
4
|
+
* `payload`); `{}` for a run that holds none. It names `testEvents` as the file the command appends test events to,
|
|
5
|
+
* when the run follows them, and says whether the run is `verbose`. The registry's test (`registry-types.test.ts`)
|
|
6
|
+
* checks that its resources' entries are the SDK's `RunPayloadResources`.
|
|
7
|
+
*/
|
|
8
|
+
export function runPayload(resources, options = {}) {
|
|
9
|
+
return {
|
|
10
|
+
version: 2,
|
|
11
|
+
resources,
|
|
12
|
+
...(options.testEvents === undefined ? {} : { testEvents: options.testEvents }),
|
|
13
|
+
...(options.verbose === true ? { verbose: true } : {}),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The command's environment: `env` whole, less unset variables, with `STORM_RUN` set to the run payload's JSON. A
|
|
18
|
+
* variable the command must not see is the caller's to leave out of `env`.
|
|
19
|
+
*/
|
|
20
|
+
export function commandEnvironment(env, payload) {
|
|
21
|
+
const kept = Object.entries(env).filter((pair) => pair[1] !== undefined);
|
|
22
|
+
return { ...Object.fromEntries(kept), [RUN_PAYLOAD_VARIABLE]: JSON.stringify(payload) };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* `env` with color set for a local command whose stdout and stderr are pipes, so it can't tell whether a terminal
|
|
26
|
+
* shows color: `FORCE_COLOR=1` when the terminal storm writes its output to shows color, else `NO_COLOR=1`. An
|
|
27
|
+
* `env` that sets either already is left as it is.
|
|
28
|
+
*/
|
|
29
|
+
export function colorEnvironment(env, color) {
|
|
30
|
+
if (env["FORCE_COLOR"] !== undefined || env["NO_COLOR"] !== undefined)
|
|
31
|
+
return env;
|
|
32
|
+
return { ...env, ...(color ? { FORCE_COLOR: "1" } : { NO_COLOR: "1" }) };
|
|
33
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import type { ResourceKind } from "./resource.ts";
|
|
2
|
+
import type { SpanStatus } from "./run-state.ts";
|
|
3
|
+
/** How a frame's parts are painted: color codes on a terminal that shows color, the text alone otherwise. */
|
|
4
|
+
export interface Paint {
|
|
5
|
+
readonly done: (text: string) => string;
|
|
6
|
+
readonly failed: (text: string) => string;
|
|
7
|
+
readonly stopped: (text: string) => string;
|
|
8
|
+
readonly active: (text: string) => string;
|
|
9
|
+
readonly faint: (text: string) => string;
|
|
10
|
+
readonly strong: (text: string) => string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A line a resource's own event adds to the run's progress, and the lane the line names: the run's, the cleanup's, or
|
|
14
|
+
* the resource's own lane, `Lane`.
|
|
15
|
+
*/
|
|
16
|
+
export interface ResourceNotice<Lane extends string = never> {
|
|
17
|
+
readonly lane: "run" | "cleanup" | Lane;
|
|
18
|
+
readonly text: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* How a lane's parts are drawn, live at `now`, or in a final form, with `now` undefined, where a span still running
|
|
22
|
+
* shows no time. `line` lays out one text under the lane's row, cut to the width when live; `elapsed` is a span's
|
|
23
|
+
* time, such as `4.2s`, or nothing when it has no end and no `now`; `seconds` is a duration as progress shows it.
|
|
24
|
+
*/
|
|
25
|
+
export interface LaneDraw {
|
|
26
|
+
readonly now: number | undefined;
|
|
27
|
+
readonly paint: Paint;
|
|
28
|
+
readonly glyph: (status: SpanStatus) => string;
|
|
29
|
+
readonly line: (text: string) => string;
|
|
30
|
+
readonly elapsed: (from: number | undefined, to: number | undefined) => string;
|
|
31
|
+
readonly seconds: (ms: number) => string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* What the views draw of one lane of kind `Kind`. The views lay out each row: its glyph, the lane's name and the
|
|
35
|
+
* text, with what goes flush right; a lane gives the text.
|
|
36
|
+
*
|
|
37
|
+
* - `label`: its row's name on the waterfall and in the job summary, such as `<lane>-setup`.
|
|
38
|
+
* - `steps`: its steps' names, in the waterfall's order, which a ran outcome's timeline names.
|
|
39
|
+
* - `lanesRow`: its row beside the runner's in a runner run, from its state, undefined until its lane starts; `run`
|
|
40
|
+
* says whether the run is stopping and whether the runner still runs. `right` is all the row has flush right, its
|
|
41
|
+
* time included.
|
|
42
|
+
* - `localRow`: its row in a local run, alone, and what the row under it says, if anything.
|
|
43
|
+
* - `record`: its final form: its row's text and the lines under it.
|
|
44
|
+
*/
|
|
45
|
+
export interface LanePresentation<Kind extends ResourceKind> {
|
|
46
|
+
readonly label: string;
|
|
47
|
+
readonly steps: readonly Kind["laneStep"][];
|
|
48
|
+
readonly lanesRow: (state: Kind["laneState"] | undefined, draw: LaneDraw, run: {
|
|
49
|
+
readonly stopping: boolean;
|
|
50
|
+
readonly runnerRunning: boolean;
|
|
51
|
+
}) => {
|
|
52
|
+
readonly text: string;
|
|
53
|
+
readonly right: string;
|
|
54
|
+
};
|
|
55
|
+
readonly localRow: (state: Kind["laneState"], draw: LaneDraw) => {
|
|
56
|
+
readonly text: string;
|
|
57
|
+
readonly below?: string;
|
|
58
|
+
};
|
|
59
|
+
readonly record: (state: Kind["laneState"], draw: LaneDraw) => {
|
|
60
|
+
readonly text: string;
|
|
61
|
+
readonly lines: readonly string[];
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Whether a resource's release is under way (`doing`) or over (`done`), as a line about it says it. */
|
|
65
|
+
export type ReleaseTense = "doing" | "done";
|
|
66
|
+
/**
|
|
67
|
+
* How resource `Kind` shows in a run's progress.
|
|
68
|
+
*
|
|
69
|
+
* - `plain`: plain progress for one run: each of its own events' lines, given when it happened; a resource may
|
|
70
|
+
* remember earlier events, such as when a step started.
|
|
71
|
+
* - `notices`: the live view's notices for one of its own events: what its lane's rows can't hold, printed above.
|
|
72
|
+
* - `release`: what releasing it does, as the cleanup line and the stopping line say it: from what the run held of it
|
|
73
|
+
* as cleanup started (`holding`), such as `releasing 2 leases`, or, on the stopping line, before the run knows that,
|
|
74
|
+
* with `holding` undefined, such as `releasing the leases`. `tense` is `doing` while the cleanup runs and `done` once
|
|
75
|
+
* it ended. Undefined says nothing.
|
|
76
|
+
* - `lane`: what the views draw of its lane; none for a kind without one.
|
|
77
|
+
*/
|
|
78
|
+
export interface ResourcePresentation<Kind extends ResourceKind> {
|
|
79
|
+
readonly plain: (options: {
|
|
80
|
+
readonly verbose: boolean;
|
|
81
|
+
}) => (event: Kind["event"], now: number) => readonly ResourceNotice<Kind["lane"]>[];
|
|
82
|
+
readonly notices: (event: Kind["event"], options: {
|
|
83
|
+
readonly verbose: boolean;
|
|
84
|
+
}) => readonly ResourceNotice<Kind["lane"]>[];
|
|
85
|
+
readonly release: (holding: Kind["holding"] | undefined, tense: ReleaseTense) => string | undefined;
|
|
86
|
+
readonly lane: [Kind["lane"]] extends [never] ? undefined : LanePresentation<Kind>;
|
|
87
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// The presentation contract: how a resource shows in a run's progress. A resource renders its own events as plain
|
|
2
|
+
// lines and as the live view's notices, and, with a lane, its lane's rows in the live view's blocks and its row's label
|
|
3
|
+
// on the waterfall. A run's views own the layout around them: the time and lane prefix of a plain line,
|
|
4
|
+
// each block's rows and their order, the glyphs and the widths. It names no resource.
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { LaneStates } from "./lane.ts";
|
|
2
|
+
import type { LaneDraw, ReleaseTense, ResourceNotice } from "./presentation.ts";
|
|
3
|
+
import type { ProviderList } from "./provider.ts";
|
|
4
|
+
import type { ResourceEvent, ResourceHoldings, RunLane } from "./resource.ts";
|
|
5
|
+
import type { Span, SpanStatus } from "./run-state.ts";
|
|
6
|
+
/**
|
|
7
|
+
* One resource lane as the views draw it, bound to its resource's name: each operation reads the lane's state from
|
|
8
|
+
* the run's (`LaneStates`), and answers nothing when its lane hasn't started. Each row comes with the lane's span or
|
|
9
|
+
* status, which the views draw its glyph and time by.
|
|
10
|
+
*/
|
|
11
|
+
export interface PresentedLane<K> {
|
|
12
|
+
readonly lane: RunLane<K>;
|
|
13
|
+
readonly label: string;
|
|
14
|
+
readonly steps: readonly string[];
|
|
15
|
+
lanesRow(states: LaneStates<K>, draw: LaneDraw, run: {
|
|
16
|
+
readonly stopping: boolean;
|
|
17
|
+
readonly runnerRunning: boolean;
|
|
18
|
+
}): {
|
|
19
|
+
readonly status: SpanStatus | undefined;
|
|
20
|
+
readonly text: string;
|
|
21
|
+
readonly right: string;
|
|
22
|
+
};
|
|
23
|
+
localRow(states: LaneStates<K>, draw: LaneDraw): {
|
|
24
|
+
readonly span: Span;
|
|
25
|
+
readonly text: string;
|
|
26
|
+
readonly below: string | undefined;
|
|
27
|
+
} | undefined;
|
|
28
|
+
record(states: LaneStates<K>, draw: LaneDraw): {
|
|
29
|
+
readonly span: Span;
|
|
30
|
+
readonly text: string;
|
|
31
|
+
readonly lines: readonly string[];
|
|
32
|
+
} | undefined;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Every resource's presentation, in provider order, over kinds map `K`.
|
|
36
|
+
*
|
|
37
|
+
* - `plain`: plain progress for one run: the lines of a resource's own event, given when it happened.
|
|
38
|
+
* - `notices`: the live view's notices for a resource's own event.
|
|
39
|
+
* - `releaseTexts`: what releasing each resource in `holdings` does, in provider order, for the cleanup line.
|
|
40
|
+
* - `stoppingTexts`: what releasing each of the `held` resources does, in provider order, for the stopping line, before
|
|
41
|
+
* the run knows what it holds of each.
|
|
42
|
+
* - `lanes`: each resource lane as the views draw it, in provider order.
|
|
43
|
+
*/
|
|
44
|
+
export interface ResourcePresentations<K> {
|
|
45
|
+
plain(options: {
|
|
46
|
+
readonly verbose: boolean;
|
|
47
|
+
}): (event: ResourceEvent<K>, now: number) => readonly ResourceNotice<RunLane<K>>[];
|
|
48
|
+
notices(event: ResourceEvent<K>, options: {
|
|
49
|
+
readonly verbose: boolean;
|
|
50
|
+
}): readonly ResourceNotice<RunLane<K>>[];
|
|
51
|
+
releaseTexts(holdings: ResourceHoldings<K>, tense: ReleaseTense): readonly string[];
|
|
52
|
+
stoppingTexts(held: readonly (keyof K & string)[]): readonly string[];
|
|
53
|
+
readonly lanes: readonly PresentedLane<K>[];
|
|
54
|
+
}
|
|
55
|
+
/** Every one of `providers`' presentations, bound to their names, in order. */
|
|
56
|
+
export declare function resourcePresentations<K>(providers: ProviderList<K>): ResourcePresentations<K>;
|