@cnc-tools/storm 0.9.0 → 0.10.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/storm.js +11 -13
- package/dist/application.d.ts +18 -10
- package/dist/application.js +13 -12
- package/dist/bin/storm.js +102 -42
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-AGWW3HDT.js +2559 -0
- package/dist/chunks/chunk-AKKNF3WZ.js +2023 -0
- package/dist/chunks/chunk-H2VCSNVU.js +351 -0
- package/dist/chunks/chunk-I5GZLOLQ.js +38 -0
- package/dist/chunks/chunk-J6ZNYUDV.js +21 -0
- package/dist/chunks/chunk-JQ2HK4RN.js +425 -0
- package/dist/chunks/chunk-OVXD7GES.js +841 -0
- package/dist/chunks/chunk-VJQLMGOH.js +4716 -0
- package/dist/chunks/chunk-WF4KJ7YG.js +431 -0
- package/dist/chunks/chunk-XHJGHJBW.js +1509 -0
- package/dist/chunks/chunk-YF3ICDBY.js +10 -0
- package/dist/chunks/chunk-ZJ2USLAT.js +4420 -0
- package/dist/chunks/live-app-RIJM3QFD.js +97 -0
- package/dist/chunks/version-X7RMSKZI.js +12 -0
- package/dist/command-tree.d.ts +3 -0
- package/dist/command-tree.js +3 -0
- package/dist/commands/dashboard.d.ts +1 -1
- package/dist/commands/dashboard.js +1 -1
- package/dist/commands/exec/cleanup.d.ts +27 -43
- package/dist/commands/exec/cleanup.js +20 -54
- package/dist/commands/exec/command.d.ts +72 -544
- package/dist/commands/exec/command.js +69 -22
- package/dist/commands/exec/job-summary.d.ts +2 -2
- package/dist/commands/exec/job-summary.js +3 -3
- package/dist/commands/exec/live-view.d.ts +9 -9
- package/dist/commands/exec/live-view.js +48 -41
- package/dist/commands/exec/metadata.d.ts +0 -65
- package/dist/commands/exec/metadata.js +7 -58
- package/dist/commands/exec/mint-failed.d.ts +1 -1
- package/dist/commands/exec/mint-failed.js +8 -8
- package/dist/commands/exec/outcomes.d.ts +63 -468
- package/dist/commands/exec/outcomes.js +42 -69
- package/dist/commands/exec/plan-run.d.ts +150 -0
- package/dist/commands/exec/plan-run.js +121 -0
- package/dist/commands/exec/progress.d.ts +25 -15
- package/dist/commands/exec/progress.js +61 -40
- package/dist/commands/exec/redaction.d.ts +3 -3
- package/dist/commands/exec/redaction.js +4 -4
- package/dist/commands/exec/resource-flags.d.ts +50 -0
- package/dist/commands/exec/resource-flags.js +125 -0
- package/dist/commands/exec/resource-refusals.d.ts +64 -0
- package/dist/commands/exec/resource-refusals.js +58 -0
- package/dist/commands/exec/run-collector.d.ts +15 -10
- package/dist/commands/exec/run-collector.js +5 -5
- package/dist/commands/exec/run-command.d.ts +80 -165
- package/dist/commands/exec/run-command.js +264 -275
- package/dist/commands/exec/run-metadata.d.ts +20 -43
- package/dist/commands/exec/run-metadata.js +18 -37
- package/dist/commands/exec/run-record.d.ts +67 -58
- package/dist/commands/exec/run-record.js +15 -32
- package/dist/commands/exec/test-plan.d.ts +45 -0
- package/dist/commands/exec/test-plan.js +59 -0
- package/dist/commands/exec/tests-summary.d.ts +5 -5
- package/dist/commands/exec/tests-summary.js +2 -2
- package/dist/commands/exec/text.d.ts +8 -2
- package/dist/commands/exec/text.js +8 -0
- package/dist/commands/exec/timeline-facts.d.ts +57 -0
- package/dist/commands/exec/timeline-facts.js +92 -0
- package/dist/commands/exec/view.d.ts +5 -7
- package/dist/commands/exec/view.js +21 -13
- package/dist/commands/exec/waterfall.d.ts +2 -9
- package/dist/commands/exec/waterfall.js +9 -30
- package/dist/commands/exec/worker-chart.d.ts +1 -1
- package/dist/commands/ext/metadata.d.ts +4 -0
- package/dist/commands/ext/metadata.js +8 -0
- package/dist/commands/runs/facts.d.ts +9 -5
- package/dist/commands/runs/facts.js +26 -14
- package/dist/commands/runs/list/command.d.ts +15 -8
- package/dist/commands/runs/list/command.js +142 -33
- package/dist/commands/runs/list/metadata.d.ts +16 -14
- package/dist/commands/runs/list/metadata.js +21 -15
- package/dist/commands/runs/list/outcomes.d.ts +6 -2
- package/dist/commands/runs/logs/command.d.ts +3 -4
- package/dist/commands/runs/logs/command.js +135 -49
- package/dist/commands/runs/logs/metadata.d.ts +17 -15
- package/dist/commands/runs/logs/metadata.js +23 -17
- package/dist/commands/runs/metadata.js +6 -2
- package/dist/commands/runs/past-run.d.ts +3 -9
- package/dist/commands/runs/past-run.js +2 -17
- package/dist/commands/runs/show/command.d.ts +57 -42
- package/dist/commands/runs/show/command.js +404 -74
- package/dist/commands/runs/show/metadata.d.ts +20 -18
- package/dist/commands/runs/show/metadata.js +23 -17
- package/dist/commands/runs/show/outcomes.d.ts +27 -19
- package/dist/commands/runs/show/outcomes.js +8 -6
- package/dist/commands/vitest/command.d.ts +94 -559
- package/dist/commands/vitest/command.js +176 -132
- package/dist/commands/vitest/metadata.d.ts +0 -65
- package/dist/commands/vitest/metadata.js +7 -38
- package/dist/commands/vitest/outcomes.d.ts +44 -274
- package/dist/commands/vitest/outcomes.js +7 -14
- package/dist/config/credential-resolver.d.ts +131 -0
- package/dist/config/credential-resolver.js +69 -0
- package/dist/{credential/settle.d.ts → config/credential-settle.d.ts} +1 -2
- package/dist/config/errors.d.ts +1 -1
- package/dist/config/errors.js +5 -5
- package/dist/config/index.d.ts +7 -6
- package/dist/config/index.js +13 -9
- package/dist/config/load.d.ts +16 -13
- package/dist/config/load.js +55 -40
- package/dist/config/recipe-run.d.ts +26 -0
- package/dist/config/recipe-run.js +27 -0
- package/dist/config/resolve.d.ts +103 -15
- package/dist/config/resolve.js +137 -47
- package/dist/config/resolver.d.ts +40 -0
- package/dist/config/resolver.js +31 -0
- package/dist/config/schema.d.ts +13 -17
- package/dist/config/schema.js +14 -35
- package/dist/config/settings-file.d.ts +28 -16
- package/dist/config/settings-file.js +39 -24
- package/dist/config/typed-options.d.ts +21 -0
- package/dist/config/typed-options.js +28 -0
- package/dist/config-file/define.d.ts +33 -31
- package/dist/config-file/define.js +14 -4
- package/dist/config-file/toolchain.d.ts +1 -1
- package/dist/context.d.ts +37 -24
- package/dist/context.js +16 -8
- package/dist/core/before-run.d.ts +37 -0
- package/dist/core/before-run.js +44 -0
- package/dist/core/events.d.ts +55 -46
- package/dist/core/gateways.d.ts +17 -18
- package/dist/core/index.d.ts +12 -12
- package/dist/core/index.js +12 -8
- package/dist/core/launcher-supplies.d.ts +11 -0
- package/dist/core/launcher-supplies.js +28 -0
- package/dist/core/mint.js +2 -2
- package/dist/core/payload.d.ts +13 -14
- package/dist/core/payload.js +9 -8
- package/dist/core/presentations.d.ts +37 -37
- package/dist/core/presentations.js +49 -56
- package/dist/core/reports.d.ts +5 -0
- package/dist/core/reports.js +13 -0
- package/dist/core/resource-registry.d.ts +54 -0
- package/dist/core/resource-registry.js +57 -0
- package/dist/core/resource-reports.d.ts +36 -0
- package/dist/core/resource-reports.js +38 -0
- package/dist/core/resource.d.ts +135 -243
- package/dist/core/resource.js +7 -5
- package/dist/core/resources-of.d.ts +16 -0
- package/dist/core/resources-of.js +8 -0
- package/dist/core/resources.d.ts +96 -84
- package/dist/core/resources.js +168 -165
- package/dist/core/run-directory.d.ts +10 -11
- package/dist/core/run-directory.js +9 -9
- package/dist/core/run-state.d.ts +29 -41
- package/dist/core/run-state.js +56 -60
- package/dist/core/run.d.ts +77 -66
- package/dist/core/run.js +83 -74
- package/dist/core/state-directory.js +4 -3
- package/dist/core/timeline.d.ts +42 -24
- package/dist/core/timeline.js +45 -27
- package/dist/core/timing.d.ts +3 -3
- package/dist/core/timing.js +1 -1
- package/dist/credential/gateways.d.ts +1 -80
- package/dist/credential/index.d.ts +3 -5
- package/dist/credential/index.js +7 -5
- package/dist/credential/live/github-actions-token-response.js +1 -1
- package/dist/credential/live/vercel-cli-gateway.d.ts +2 -1
- package/dist/credential/live/vercel-cli-gateway.js +1 -1
- package/dist/credential/live/vercel-output.d.ts +1 -1
- package/dist/credential/source.d.ts +16 -59
- package/dist/credential/source.js +21 -7
- package/dist/credential/target.d.ts +1 -1
- package/dist/extension-commands.d.ts +14 -0
- package/dist/extension-commands.js +20 -0
- package/dist/extensions/github/definition.d.ts +26 -0
- package/dist/extensions/github/definition.js +29 -0
- package/dist/extensions/github/extension.d.ts +18 -0
- package/dist/extensions/github/extension.js +6 -0
- package/dist/{resources → extensions}/github/fixture-repo.d.ts +11 -8
- package/dist/{resources → extensions}/github/fixture-repo.js +8 -4
- package/dist/extensions/github/index.d.ts +13 -0
- package/dist/extensions/github/index.js +17 -0
- package/dist/extensions/github/lifecycle.d.ts +30 -0
- package/dist/extensions/github/lifecycle.js +69 -0
- package/dist/extensions/github/live/world.d.ts +6 -0
- package/dist/extensions/github/live/world.js +16 -0
- package/dist/extensions/github/options.d.ts +36 -0
- package/dist/extensions/github/options.js +36 -0
- package/dist/extensions/github/refusals.d.ts +32 -0
- package/dist/extensions/github/refusals.js +43 -0
- package/dist/extensions/github/release.d.ts +17 -0
- package/dist/extensions/github/release.js +34 -0
- package/dist/extensions/github/resource.d.ts +36 -0
- package/dist/extensions/github/resource.js +21 -0
- package/dist/extensions/github/run/payload.d.ts +27 -0
- package/dist/extensions/github/run/payload.js +42 -0
- package/dist/extensions/github/world.d.ts +15 -0
- package/dist/extensions/github/world.js +3 -0
- package/dist/extensions/testserver/canceled.d.ts +7 -0
- package/dist/extensions/testserver/canceled.js +27 -0
- package/dist/extensions/testserver/command-tree.d.ts +6 -0
- package/dist/extensions/testserver/command-tree.js +21 -0
- package/dist/extensions/testserver/commands/app.d.ts +22 -0
- package/dist/extensions/testserver/commands/app.js +5 -0
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/command.d.ts +277 -237
- package/dist/extensions/testserver/commands/pool/create/command.js +352 -0
- package/dist/extensions/testserver/commands/pool/create/metadata.d.ts +33 -0
- package/dist/extensions/testserver/commands/pool/create/metadata.js +55 -0
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/outcomes.d.ts +132 -112
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/create/outcomes.js +6 -24
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/command.d.ts +3 -4
- package/dist/extensions/testserver/commands/pool/list/command.js +203 -0
- package/dist/extensions/testserver/commands/pool/list/metadata.d.ts +11 -0
- package/dist/extensions/testserver/commands/pool/list/metadata.js +15 -0
- package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/outcomes.js +1 -1
- package/dist/extensions/testserver/commands/pool/metadata.d.ts +3 -0
- package/dist/extensions/testserver/commands/pool/metadata.js +7 -0
- package/dist/extensions/testserver/commands/tree.d.ts +2 -0
- package/dist/extensions/testserver/commands/tree.js +6 -0
- package/dist/{resources → extensions}/testserver/credential-facts.d.ts +6 -40
- package/dist/{resources → extensions}/testserver/credential-facts.js +13 -35
- package/dist/extensions/testserver/definition.d.ts +57 -0
- package/dist/extensions/testserver/definition.js +71 -0
- package/dist/{resources → extensions}/testserver/events.d.ts +5 -4
- package/dist/extensions/testserver/events.js +4 -0
- package/dist/extensions/testserver/extension.d.ts +46 -0
- package/dist/extensions/testserver/extension.js +68 -0
- package/dist/extensions/testserver/index.d.ts +20 -0
- package/dist/extensions/testserver/index.js +31 -0
- package/dist/extensions/testserver/lifecycle.d.ts +24 -0
- package/dist/extensions/testserver/lifecycle.js +116 -0
- package/dist/{core → extensions/testserver}/limit.js +1 -0
- package/dist/extensions/testserver/live/world.d.ts +8 -0
- package/dist/extensions/testserver/live/world.js +38 -0
- package/dist/{resources/testserver/sandbox → extensions/testserver/options}/channels.d.ts +1 -1
- package/dist/extensions/testserver/options/index.d.ts +5 -0
- package/dist/extensions/testserver/options/index.js +11 -0
- package/dist/extensions/testserver/options/rules.d.ts +69 -0
- package/dist/extensions/testserver/options/rules.js +92 -0
- package/dist/extensions/testserver/options/sandboxes.d.ts +29 -0
- package/dist/extensions/testserver/options/sandboxes.js +33 -0
- package/dist/extensions/testserver/options/ttl.d.ts +23 -0
- package/dist/extensions/testserver/options/ttl.js +42 -0
- package/dist/{resources → extensions}/testserver/pool/channels.d.ts +3 -3
- package/dist/{resources → extensions}/testserver/pool/channels.js +2 -2
- package/dist/{resources → extensions}/testserver/pool/create.d.ts +1 -2
- package/dist/{resources → extensions}/testserver/pool/create.js +2 -1
- package/dist/{resources → extensions}/testserver/pool/index.d.ts +0 -1
- package/dist/{resources → extensions}/testserver/pool/index.js +2 -3
- package/dist/{resources → extensions}/testserver/pool/inspect.d.ts +1 -1
- package/dist/{resources → extensions}/testserver/pool/lease.d.ts +1 -1
- package/dist/extensions/testserver/pool/live/pool-store-gateway.d.ts +12 -0
- package/dist/{resources → extensions}/testserver/pool/live/pool-store-gateway.js +4 -4
- package/dist/{resources → extensions}/testserver/pool/pull-request.d.ts +8 -5
- package/dist/{resources → extensions}/testserver/pool/pull-request.js +2 -2
- package/dist/extensions/testserver/pr-build-facts.d.ts +156 -0
- package/dist/extensions/testserver/pr-build-facts.js +309 -0
- package/dist/extensions/testserver/presentation.d.ts +11 -0
- package/dist/{resources → extensions}/testserver/presentation.js +35 -56
- package/dist/{resources/testserver/lane.d.ts → extensions/testserver/progress.d.ts} +10 -6
- package/dist/{resources/testserver/lane.js → extensions/testserver/progress.js} +21 -16
- package/dist/extensions/testserver/provision.d.ts +160 -0
- package/dist/{resources/testserver/provider.js → extensions/testserver/provision.js} +80 -108
- package/dist/{resources → extensions}/testserver/pull-request/gateways.d.ts +1 -1
- package/dist/extensions/testserver/pull-request/gateways.js +5 -0
- package/dist/{resources → extensions}/testserver/pull-request/index.js +2 -2
- package/dist/{resources → extensions}/testserver/pull-request/live/github-token-gateway.d.ts +4 -4
- package/dist/{resources → extensions}/testserver/pull-request/live/github-token-gateway.js +4 -4
- package/dist/extensions/testserver/refusals.d.ts +72 -0
- package/dist/extensions/testserver/refusals.js +117 -0
- package/dist/extensions/testserver/release.d.ts +14 -0
- package/dist/extensions/testserver/release.js +26 -0
- package/dist/extensions/testserver/resource.d.ts +57 -0
- package/dist/extensions/testserver/resource.js +19 -0
- package/dist/extensions/testserver/result.d.ts +55 -0
- package/dist/extensions/testserver/result.js +98 -0
- package/dist/extensions/testserver/run/connection.d.ts +21 -0
- package/dist/extensions/testserver/run/connection.js +39 -0
- package/dist/extensions/testserver/run-sandbox.d.ts +16 -0
- package/dist/extensions/testserver/run-sandbox.js +11 -0
- package/dist/{resources → extensions}/testserver/sandbox/create.d.ts +1 -11
- package/dist/{resources → extensions}/testserver/sandbox/create.js +0 -15
- package/dist/{resources → extensions}/testserver/sandbox/gateways.d.ts +1 -1
- package/dist/{resources → extensions}/testserver/sandbox/index.d.ts +1 -3
- package/dist/extensions/testserver/sandbox/index.js +6 -0
- package/dist/extensions/testserver/testserver-sdk.d.ts +1 -0
- package/dist/extensions/testserver/testserver-sdk.js +4 -0
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/arguments.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/context.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/driver.d.ts +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/gateways.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/index.js +4 -4
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/invocation.d.ts +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/invocation.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/redaction.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/report.d.ts +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/report.js +1 -1
- package/dist/{vercel-cli → extensions/testserver/vercel-cli}/verbose.js +1 -1
- package/dist/extensions/testserver/vitest/config.d.ts +28 -0
- package/dist/extensions/testserver/vitest/config.js +39 -0
- package/dist/{vitest → extensions/testserver/vitest}/container-scope.d.ts +33 -15
- package/dist/{vitest → extensions/testserver/vitest}/container-scope.js +75 -14
- package/dist/extensions/testserver/vitest/container-start.d.ts +19 -0
- package/dist/extensions/testserver/vitest/container-start.js +31 -0
- package/dist/{vitest → extensions/testserver/vitest}/diagnostics.d.ts +72 -29
- package/dist/{vitest → extensions/testserver/vitest}/diagnostics.js +151 -52
- package/dist/{vitest → extensions/testserver/vitest}/fixtures.d.ts +8 -5
- package/dist/{vitest → extensions/testserver/vitest}/fixtures.js +45 -22
- package/dist/extensions/testserver/vitest/index.d.ts +3 -0
- package/dist/extensions/testserver/vitest/index.js +10 -0
- package/dist/extensions/testserver/vitest/sandbox.d.ts +25 -0
- package/dist/extensions/testserver/vitest/sandbox.js +43 -0
- package/dist/{vitest → extensions/testserver/vitest}/types.d.ts +1 -1
- package/dist/extensions/testserver/world.d.ts +25 -0
- package/dist/extensions/testserver/world.js +4 -0
- package/dist/extensions.d.ts +153 -0
- package/dist/extensions.js +53 -0
- package/dist/help-logo.js +5 -5
- package/dist/launch.js +46 -0
- package/dist/launcher-resolvers/index.d.ts +1 -0
- package/dist/launcher-resolvers/index.js +7 -0
- package/dist/live-app.d.ts +9 -0
- package/dist/live-app.js +25 -0
- package/dist/presentation.js +2 -2
- package/dist/runner/base.js +1 -1
- package/dist/runner/context.js +1 -1
- package/dist/runner/events.js +1 -1
- package/dist/runner/gateways.d.ts +11 -11
- package/dist/runner/gateways.js +1 -1
- package/dist/runner/index.d.ts +4 -4
- package/dist/runner/index.js +1 -1
- package/dist/runner/live/sandbox-gateway.js +4 -4
- package/dist/runner/live/terminal.d.ts +1 -1
- package/dist/runner/live/terminal.js +1 -1
- package/dist/runner/prepare.d.ts +13 -12
- package/dist/runner/prepare.js +3 -3
- package/dist/runner/ready.js +2 -2
- package/dist/runner/recipe.d.ts +24 -20
- package/dist/runner/recipe.js +19 -17
- package/dist/runner/{remote-command.d.ts → sandboxed-command.d.ts} +18 -19
- package/dist/runner/{remote-command.js → sandboxed-command.js} +21 -22
- package/dist/runner/scope.d.ts +3 -3
- package/dist/runner/secrets.js +1 -1
- package/dist/runner/snapshot-key.d.ts +1 -1
- package/dist/runner/snapshot-key.js +4 -4
- package/dist/runner/snapshot-save.js +3 -3
- package/dist/sdk/extension/commands.d.ts +71 -0
- package/dist/sdk/extension/commands.js +31 -0
- package/dist/{credential/diagnosis.d.ts → sdk/extension/credential-diagnosis.d.ts} +1 -7
- package/dist/{credential/diagnosis.js → sdk/extension/credential-diagnosis.js} +2 -11
- package/dist/sdk/extension/credential-source.d.ts +132 -0
- package/dist/sdk/extension/credential-source.js +5 -0
- package/dist/{credential → sdk/extension}/credential.d.ts +8 -7
- package/dist/{credential → sdk/extension}/credential.js +9 -6
- package/dist/sdk/extension/index.d.ts +15 -0
- package/dist/sdk/extension/index.js +39 -0
- package/dist/sdk/extension/launcher-supplies.d.ts +24 -0
- package/dist/sdk/extension/launcher-supplies.js +3 -0
- package/dist/sdk/extension/lifecycle.d.ts +211 -0
- package/dist/sdk/extension/lifecycle.js +9 -0
- package/dist/sdk/extension/presentation.d.ts +31 -0
- package/dist/sdk/extension/presentation.js +7 -0
- package/dist/sdk/extension/progress.d.ts +75 -0
- package/dist/sdk/extension/progress.js +8 -0
- package/dist/sdk/extension/reports.d.ts +15 -0
- package/dist/sdk/extension/reports.js +5 -0
- package/dist/sdk/extension/resource-definition.d.ts +204 -0
- package/dist/sdk/extension/resource-definition.js +24 -0
- package/dist/sdk/extension/resource-factory.d.ts +10 -0
- package/dist/sdk/extension/resource-factory.js +15 -0
- package/dist/sdk/extension/resource.d.ts +60 -0
- package/dist/sdk/extension/resource.js +42 -0
- package/dist/sdk/extension/rules.d.ts +16 -0
- package/dist/sdk/extension/rules.js +30 -0
- package/dist/sdk/extension/span.d.ts +8 -0
- package/dist/sdk/extension/span.js +4 -0
- package/dist/sdk/extension/time.d.ts +11 -0
- package/dist/sdk/extension/time.js +4 -0
- package/dist/sdk/extension/token-request-facts.d.ts +39 -0
- package/dist/sdk/extension/token-request-facts.js +35 -0
- package/dist/sdk/index.d.ts +4 -7
- package/dist/sdk/index.js +7 -15
- package/dist/sdk/run/contract.d.ts +32 -0
- package/dist/sdk/run/contract.js +12 -0
- package/dist/sdk/run/launcher.d.ts +5 -0
- package/dist/sdk/run/launcher.js +6 -0
- package/dist/sdk/run/payload.d.ts +58 -0
- package/dist/sdk/run/payload.js +73 -0
- package/dist/sdk/run/present.d.ts +11 -0
- package/dist/sdk/run/present.js +4 -0
- package/dist/sdk/run/redact.d.ts +5 -0
- package/dist/sdk/run/redact.js +12 -0
- package/dist/time/duration.js +2 -2
- package/dist/time/index.js +2 -1
- package/dist/time/time.d.ts +2 -11
- package/dist/time/time.js +2 -2
- package/dist/{sdk → vendor/testserver-sdk}/container/api-request.d.ts +14 -2
- package/dist/vendor/testserver-sdk/container/api-request.js +68 -0
- package/dist/{sdk → vendor/testserver-sdk}/container/container.d.ts +74 -24
- package/dist/{sdk → vendor/testserver-sdk}/container/container.js +180 -90
- package/dist/vendor/testserver-sdk/container/external.d.ts +111 -0
- package/dist/vendor/testserver-sdk/container/external.js +76 -0
- package/dist/vendor/testserver-sdk/container/gateways.d.ts +156 -0
- package/dist/{sdk → vendor/testserver-sdk}/container/index.d.ts +2 -1
- package/dist/{sdk → vendor/testserver-sdk}/container/index.js +2 -1
- package/dist/vendor/testserver-sdk/container/live/container-gateway.d.ts +22 -0
- package/dist/vendor/testserver-sdk/container/live/container-gateway.js +165 -0
- package/dist/vendor/testserver-sdk/container/recorder.d.ts +69 -0
- package/dist/vendor/testserver-sdk/container/recorder.js +121 -0
- package/dist/{sdk → vendor/testserver-sdk}/factories/build.d.ts +33 -12
- package/dist/{sdk → vendor/testserver-sdk}/factories/build.js +36 -14
- package/dist/vendor/testserver-sdk/factories/definition.d.ts +39 -0
- package/dist/{sdk → vendor/testserver-sdk}/factories/definition.js +1 -1
- package/dist/{sdk → vendor/testserver-sdk}/factories/definitions.d.ts +7 -4
- package/dist/{sdk → vendor/testserver-sdk}/factories/definitions.js +10 -0
- package/dist/vendor/testserver-sdk/factories/gateways.d.ts +31 -0
- package/dist/vendor/testserver-sdk/factories/index.d.ts +4 -0
- package/dist/{sdk → vendor/testserver-sdk}/factories/index.js +3 -3
- package/dist/vendor/testserver-sdk/index.d.ts +6 -0
- package/dist/vendor/testserver-sdk/index.js +11 -0
- package/dist/{sdk → vendor/testserver-sdk}/proxy/exchange.d.ts +2 -1
- package/dist/{sdk → vendor/testserver-sdk}/proxy/exchange.js +8 -4
- package/dist/{sdk → vendor/testserver-sdk}/proxy/faulted-exchange.js +7 -2
- package/dist/{sdk → vendor/testserver-sdk}/proxy/faults.d.ts +2 -1
- package/dist/{sdk → vendor/testserver-sdk}/proxy/records.d.ts +10 -1
- package/dist/{sdk → vendor/testserver-sdk}/proxy/records.js +13 -0
- package/dist/{sdk → vendor/testserver-sdk}/records/index.d.ts +1 -1
- package/dist/{sdk → vendor/testserver-sdk}/records/records.d.ts +17 -1
- package/dist/vendor/testserver-sdk/testserver/external-ids.d.ts +38 -0
- package/dist/vendor/testserver-sdk/testserver/external-ids.js +46 -0
- package/dist/vendor/testserver-sdk/testserver/failure.d.ts +101 -0
- package/dist/vendor/testserver-sdk/testserver/failure.js +108 -0
- package/dist/vendor/testserver-sdk/testserver/index.d.ts +7 -0
- package/dist/vendor/testserver-sdk/testserver/index.js +11 -0
- package/dist/{sdk → vendor/testserver-sdk}/testserver/live/request.d.ts +8 -10
- package/dist/{sdk → vendor/testserver-sdk}/testserver/live/request.js +8 -6
- package/dist/vendor/testserver-sdk/testserver/routes.d.ts +60 -0
- package/dist/vendor/testserver-sdk/testserver/routes.js +84 -0
- package/dist/vendor/testserver-sdk/testserver/service-ids.d.ts +31 -0
- package/dist/{sdk → vendor/testserver-sdk}/testserver/service-ids.js +27 -4
- package/dist/version.d.ts +2 -2
- package/dist/version.js +10 -11
- package/dist/vitest/config.d.ts +2 -32
- package/dist/vitest/config.js +6 -40
- package/dist/vitest/gateways.js +1 -1
- package/dist/vitest/index.d.ts +2 -3
- package/dist/vitest/index.js +5 -9
- package/dist/vitest/plan.d.ts +1 -16
- package/dist/vitest/plan.js +4 -36
- package/dist/vitest/test-events.d.ts +1 -18
- package/dist/vitest/test-events.js +2 -31
- package/package.json +53 -23
- package/skills/overview.md +9 -9
- package/skills/read-run-output.md +25 -2
- package/skills/testserver-builds.md +8 -8
- package/bin/node-version.js +0 -24
- package/dist/closed-terminal.d.ts +0 -7
- package/dist/closed-terminal.js +0 -18
- package/dist/combine-errors.d.ts +0 -11
- package/dist/combine-errors.js +0 -19
- package/dist/commands/exec/testserver-flags.d.ts +0 -48
- package/dist/commands/exec/testserver-flags.js +0 -80
- package/dist/config/by-name.d.ts +0 -24
- package/dist/config/by-name.js +0 -26
- package/dist/config/resource-config.d.ts +0 -132
- package/dist/config/resource-config.js +0 -19
- package/dist/config/set.d.ts +0 -27
- package/dist/config/set.js +0 -71
- package/dist/core/command-provider.d.ts +0 -126
- package/dist/core/command-provider.js +0 -13
- package/dist/core/command-slots.d.ts +0 -73
- package/dist/core/command-slots.js +0 -140
- package/dist/core/keyed.d.ts +0 -12
- package/dist/core/keyed.js +0 -24
- package/dist/core/lane.d.ts +0 -46
- package/dist/core/lane.js +0 -5
- package/dist/core/presentation.d.ts +0 -87
- package/dist/core/presentation.js +0 -5
- package/dist/core/provider.d.ts +0 -69
- package/dist/core/provider.js +0 -5
- package/dist/resources/github/cleanup.d.ts +0 -23
- package/dist/resources/github/cleanup.js +0 -39
- package/dist/resources/github/command.d.ts +0 -126
- package/dist/resources/github/command.js +0 -117
- package/dist/resources/github/config.d.ts +0 -16
- package/dist/resources/github/config.js +0 -37
- package/dist/resources/github/events.d.ts +0 -26
- package/dist/resources/github/events.js +0 -2
- package/dist/resources/github/index.d.ts +0 -12
- package/dist/resources/github/index.js +0 -15
- package/dist/resources/github/live/gateways.d.ts +0 -6
- package/dist/resources/github/live/gateways.js +0 -13
- package/dist/resources/github/presentation.d.ts +0 -13
- package/dist/resources/github/presentation.js +0 -43
- package/dist/resources/github/provider.d.ts +0 -66
- package/dist/resources/github/provider.js +0 -58
- package/dist/resources/github/resource-provider.d.ts +0 -6
- package/dist/resources/github/resource-provider.js +0 -20
- package/dist/resources/github/resource.d.ts +0 -33
- package/dist/resources/github/resource.js +0 -12
- package/dist/resources/testserver/cleanup.d.ts +0 -14
- package/dist/resources/testserver/cleanup.js +0 -22
- package/dist/resources/testserver/command.d.ts +0 -520
- package/dist/resources/testserver/command.js +0 -252
- package/dist/resources/testserver/commands/app.d.ts +0 -18
- package/dist/resources/testserver/commands/app.js +0 -3
- package/dist/resources/testserver/commands/create/command.js +0 -208
- package/dist/resources/testserver/commands/create/metadata.d.ts +0 -31
- package/dist/resources/testserver/commands/create/metadata.js +0 -49
- package/dist/resources/testserver/commands/list/command.js +0 -56
- package/dist/resources/testserver/commands/list/metadata.d.ts +0 -9
- package/dist/resources/testserver/commands/list/metadata.js +0 -9
- package/dist/resources/testserver/config.d.ts +0 -18
- package/dist/resources/testserver/config.js +0 -88
- package/dist/resources/testserver/events.js +0 -4
- package/dist/resources/testserver/index.d.ts +0 -16
- package/dist/resources/testserver/index.js +0 -25
- package/dist/resources/testserver/live/gateways.d.ts +0 -8
- package/dist/resources/testserver/live/gateways.js +0 -39
- package/dist/resources/testserver/options.d.ts +0 -5
- package/dist/resources/testserver/options.js +0 -5
- package/dist/resources/testserver/pool/directory.d.ts +0 -4
- package/dist/resources/testserver/pool/directory.js +0 -5
- package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +0 -12
- package/dist/resources/testserver/pr-build-facts.d.ts +0 -130
- package/dist/resources/testserver/pr-build-facts.js +0 -261
- package/dist/resources/testserver/presentation.d.ts +0 -9
- package/dist/resources/testserver/provider.d.ts +0 -187
- package/dist/resources/testserver/pull-request/gateways.js +0 -5
- package/dist/resources/testserver/ran.d.ts +0 -92
- package/dist/resources/testserver/ran.js +0 -156
- package/dist/resources/testserver/resource-provider.d.ts +0 -12
- package/dist/resources/testserver/resource-provider.js +0 -38
- package/dist/resources/testserver/resource.d.ts +0 -36
- package/dist/resources/testserver/resource.js +0 -10
- package/dist/resources/testserver/run-sandbox.d.ts +0 -13
- package/dist/resources/testserver/run-sandbox.js +0 -6
- package/dist/resources/testserver/sandbox/index.js +0 -8
- package/dist/resources.d.ts +0 -705
- package/dist/resources.js +0 -88
- package/dist/sdk/container/api-request.js +0 -46
- package/dist/sdk/container/gateways.d.ts +0 -108
- package/dist/sdk/container/live/container-gateway.d.ts +0 -17
- package/dist/sdk/container/live/container-gateway.js +0 -114
- package/dist/sdk/factories/definition.d.ts +0 -28
- package/dist/sdk/factories/gateways.d.ts +0 -25
- package/dist/sdk/factories/index.d.ts +0 -5
- package/dist/sdk/factories/live/factory-gateway.d.ts +0 -10
- package/dist/sdk/factories/live/factory-gateway.js +0 -29
- package/dist/sdk/payload/index.d.ts +0 -2
- package/dist/sdk/payload/index.js +0 -4
- package/dist/sdk/payload/payload.d.ts +0 -47
- package/dist/sdk/payload/payload.js +0 -74
- package/dist/sdk/testserver/failure.d.ts +0 -73
- package/dist/sdk/testserver/failure.js +0 -61
- package/dist/sdk/testserver/index.d.ts +0 -5
- package/dist/sdk/testserver/index.js +0 -8
- package/dist/sdk/testserver/service-ids.d.ts +0 -19
- package/dist/vitest/sandbox.d.ts +0 -16
- package/dist/vitest/sandbox.js +0 -35
- /package/dist/{credential/settle.js → config/credential-settle.js} +0 -0
- /package/dist/{resources → extensions}/github/gateways.d.ts +0 -0
- /package/dist/{resources → extensions}/github/gateways.js +0 -0
- /package/dist/{resources → extensions}/github/live/fixture-repo-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/github/live/fixture-repo-gateway.js +0 -0
- /package/dist/{resources/testserver/commands → extensions/testserver/commands/pool}/list/outcomes.d.ts +0 -0
- /package/dist/{core → extensions/testserver}/limit.d.ts +0 -0
- /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/build-reference.d.ts +0 -0
- /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/build-reference.js +0 -0
- /package/dist/{resources/testserver/sandbox → extensions/testserver/options}/channels.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/gateways.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pool/gateways.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/host.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pool/host.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/inspect.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/lease.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/live/pool-records.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pool/live/pool-records.js +0 -0
- /package/dist/{resources → extensions}/testserver/pool/staleness.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pool/staleness.js +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/index.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/github-rest.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/github-rest.js +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/pull-request-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/pull-request-gateway.js +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/testserver-workflow-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/pull-request/live/testserver-workflow-gateway.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/create-failure.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/create-failure.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/gateways.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/builds-response.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/builds-response.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/control-plane-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/control-plane-gateway.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/create-response.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/create-response.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/fetch-failure.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/fetch-failure.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/health-check-gateway.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/health-check-gateway.js +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/sse.d.ts +0 -0
- /package/dist/{resources → extensions}/testserver/sandbox/live/sse.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/ansi.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/ansi.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/arguments.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/auth-config.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/auth-config.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/clock.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/clock.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/config-files.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/config-files.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/context.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/driver.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/entry.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/entry.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/environment.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/environment.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/errors.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/errors.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/gateways.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/index.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/keys.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/keys.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/config-files.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/config-files.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/process-gateway.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/live/process-gateway.js +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/redaction.d.ts +0 -0
- /package/dist/{vercel-cli → extensions/testserver/vercel-cli}/verbose.d.ts +0 -0
- /package/dist/{vitest → extensions/testserver/vitest}/types.js +0 -0
- /package/dist/sdk/{payload → run}/test-events.d.ts +0 -0
- /package/dist/sdk/{payload → run}/test-events.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/container/feature-flags.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/container/feature-flags.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/container/gateways.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/factories/gateways.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/faulted-exchange.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/faults.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/index.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/index.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/proxy.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/proxy/proxy.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/records/body.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/records/body.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/records/index.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/records/records.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/seed/index.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/seed/index.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/seed/seed.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/seed/seed.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/clock.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/clock.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/live/connect-failure.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/live/connect-failure.js +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/test-id.d.ts +0 -0
- /package/dist/{sdk → vendor/testserver-sdk}/testserver/test-id.js +0 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Clock, Timer } from "./time.ts";
|
|
2
|
+
/**
|
|
3
|
+
* A resource definition's own state directory, `$XDG_STATE_HOME/storm/<name>`, which every resource instance of it
|
|
4
|
+
* shares: `ok` with its path, or not, with why the launcher couldn't resolve it and how to name its location, such as
|
|
5
|
+
* `${XDG_STATE_HOME:-~/.local/state}/storm/<name>`.
|
|
6
|
+
*/
|
|
7
|
+
export type StateDirectory = {
|
|
8
|
+
readonly ok: true;
|
|
9
|
+
readonly directory: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly ok: false;
|
|
12
|
+
readonly reason: string;
|
|
13
|
+
readonly pattern: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* What the launcher hands a resource definition to build its world from: the launcher environment, its own state
|
|
17
|
+
* directory, and the launcher's clock and timer, so a extension folder imports no clock or timer of its own.
|
|
18
|
+
*/
|
|
19
|
+
export interface LauncherSupplies {
|
|
20
|
+
readonly env: Readonly<Record<string, string | undefined>>;
|
|
21
|
+
readonly stateDirectory: StateDirectory;
|
|
22
|
+
readonly clock: Clock;
|
|
23
|
+
readonly timer: Timer;
|
|
24
|
+
}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import type { CredentialFailure, CredentialSource } from "./credential-source.ts";
|
|
2
|
+
import type { Row } from "./reports.ts";
|
|
3
|
+
/** What a person or agent can do next about a refusal: run a command, storm's or another tool's, open a page, or read a sentence. */
|
|
4
|
+
export type NextStep = {
|
|
5
|
+
readonly type: "command" | "external";
|
|
6
|
+
readonly argv: readonly string[];
|
|
7
|
+
readonly label: string;
|
|
8
|
+
readonly when?: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly type: "url";
|
|
11
|
+
readonly url: string;
|
|
12
|
+
readonly label: string;
|
|
13
|
+
} | {
|
|
14
|
+
readonly type: "text";
|
|
15
|
+
readonly text: string;
|
|
16
|
+
};
|
|
17
|
+
/** What a refusal says: what failed and its cause, the next steps, and rows that show some of its data. */
|
|
18
|
+
export interface RefusalContent {
|
|
19
|
+
readonly message: string;
|
|
20
|
+
readonly next?: readonly NextStep[];
|
|
21
|
+
readonly rows?: readonly Row[];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A lifecycle point's refusal, worded where it refuses: what it says (`RefusalContent`: its message, its next steps
|
|
25
|
+
* and rows that show some of its data), its snake_case reason (`refused`, such as `token_missing`) and its own data
|
|
26
|
+
* (`data`), which the JSON carries. The launcher ends the command or the run with one of its own two errors, which
|
|
27
|
+
* carry the reason and the data under `data.refusal` and `data.data`, and the refusal's content as their own: a
|
|
28
|
+
* `beforeRun` refusal with `resource_refused_before_run`, an `acquireForRun` refusal with `resource_refused`. Its rows
|
|
29
|
+
* show some of its data, so what a person reads stays a function of the JSON.
|
|
30
|
+
*/
|
|
31
|
+
export type Refusal = RefusalContent & {
|
|
32
|
+
readonly refused: string;
|
|
33
|
+
readonly data: Readonly<Record<string, unknown>>;
|
|
34
|
+
};
|
|
35
|
+
/** What `beforeRun` works from: the resource's resolved options, and where each option's value came from. */
|
|
36
|
+
export interface BeforeRunInput<Options, Sources> {
|
|
37
|
+
readonly options: Options;
|
|
38
|
+
readonly sources: Sources;
|
|
39
|
+
}
|
|
40
|
+
/** The secrets of a resource that hands the run none. */
|
|
41
|
+
export type NoSecrets = Readonly<Record<never, string>>;
|
|
42
|
+
/**
|
|
43
|
+
* What a run uses a resource with, once its `beforeRun` lets the run go on: the secrets it hands the run, by name,
|
|
44
|
+
* which the run hides as `<token>` and hands its `acquireForRun`; whether it needs the Vercel credential, which the
|
|
45
|
+
* launcher chooses a source for (`--credential`) only when one of the run's resources does; and the launcher
|
|
46
|
+
* environment's variables it hides from the run's command (`hiddenVariables`), which the launcher leaves out of the
|
|
47
|
+
* command's environment.
|
|
48
|
+
*/
|
|
49
|
+
export interface ResourceUse<Secrets> {
|
|
50
|
+
readonly secrets: Secrets;
|
|
51
|
+
readonly needsVercelCredential: boolean;
|
|
52
|
+
readonly hiddenVariables: readonly string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* How `beforeRun` answers: `use`, the run goes on with the resource (`ResourceUse`: its secrets, whether it needs the
|
|
56
|
+
* Vercel credential, and the launcher variables it hides from the command); `skip`, the run goes on without it, hides
|
|
57
|
+
* nothing from the command, and says `notice` right after it starts; or a refusal (`Refusal`), which ends the command
|
|
58
|
+
* before the run starts.
|
|
59
|
+
*/
|
|
60
|
+
export type BeforeRunAnswer<Secrets> = {
|
|
61
|
+
readonly use: ResourceUse<Secrets>;
|
|
62
|
+
} | {
|
|
63
|
+
readonly skip: string;
|
|
64
|
+
} | Refusal;
|
|
65
|
+
/**
|
|
66
|
+
* What every resource instance reports as it goes, each with its resource key, which the launcher adds:
|
|
67
|
+
*
|
|
68
|
+
* - `run` and `cleanup`: a line in the run's lane or the cleanup's (its `resource-notice` event).
|
|
69
|
+
* - `warning`: one thing it couldn't do that doesn't stop the run, as a snake_case reason of its own choosing, such as
|
|
70
|
+
* `release_failed`, and a sentence (its `resource-warning` event). The launcher prints it in the lane of the
|
|
71
|
+
* lifecycle point that reports it, the run's while it acquires and the cleanup's while it releases, and keeps it: in
|
|
72
|
+
* the instance's `ran` record when its acquire reports it, in its cleanup record when its release does. Every
|
|
73
|
+
* outcome shows it from there, in the same words for every resource.
|
|
74
|
+
*/
|
|
75
|
+
export interface ReportLines {
|
|
76
|
+
readonly run: (text: string) => Promise<void>;
|
|
77
|
+
readonly cleanup: (text: string) => Promise<void>;
|
|
78
|
+
readonly warning: (reason: string, message: string) => Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* What a resource instance reports as it goes (`ReportLines`), and, for a resource with its own progress, whose events
|
|
82
|
+
* are `Event`, one of those events (`progress`), which the launcher nests under the resource key. A resource without
|
|
83
|
+
* progress has no `progress`.
|
|
84
|
+
*/
|
|
85
|
+
export type Report<Event = never> = [Event] extends [never] ? ReportLines : ReportLines & {
|
|
86
|
+
readonly progress: (event: Event) => Promise<void>;
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* What `acquireForRun` works from, beside its world: only what the launcher owns.
|
|
90
|
+
*
|
|
91
|
+
* - `options` and `secrets`: its resolved options, and the secrets its `beforeRun` handed the run.
|
|
92
|
+
* - `credential`: the run's credential source, which it calls `obtain()` on only when it needs a credential: the one
|
|
93
|
+
* mint the run shares with the runner sandbox, when it has one (`obtainedSource`); else the source the run's
|
|
94
|
+
* credential choice names, which the launcher builds once and reports (`minting`, `minted`, `requesting-token`).
|
|
95
|
+
* Undefined when the run chose no source, which it does only when it has no runner sandbox and no resource's
|
|
96
|
+
* `beforeRun` said it needs the Vercel credential (`ResourceUse.needsVercelCredential`).
|
|
97
|
+
* - `take`: what it calls with each thing it takes (`Taken`), as soon as it holds it and before any other await, so the
|
|
98
|
+
* run releases it however the run ends, a throw included: the launcher keeps everything taken and hands it to
|
|
99
|
+
* `releaseAfterRun`.
|
|
100
|
+
* - `report`: what it reports as it goes (`Report`): its lines, its warnings and its progress events.
|
|
101
|
+
* - `signal`: the user's signal combined with the run's internal abort, which another resource's refusal or the
|
|
102
|
+
* runner lane's failure aborts. An acquire that sees it aborted stops as soon as it safely can.
|
|
103
|
+
*/
|
|
104
|
+
export interface AcquireForRunInput<Options, Secrets, Taken, Event = never> {
|
|
105
|
+
readonly options: Options;
|
|
106
|
+
readonly secrets: Secrets;
|
|
107
|
+
readonly credential: CredentialSource | undefined;
|
|
108
|
+
readonly take: (one: Taken) => void;
|
|
109
|
+
readonly report: Report<Event>;
|
|
110
|
+
readonly signal: AbortSignal;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* An acquired resource instance's result, what a `ran` outcome reports of it, rendered as its acquire answers: its
|
|
114
|
+
* facts (`Facts`, the lifecycle's own type, which `--json-schema` shows as unknown), under `resources.<key>.facts`;
|
|
115
|
+
* and the rows `storm runs show` lists for it, which storm keeps in the run directory's `run.json`. The warnings its
|
|
116
|
+
* acquire reported go beside them.
|
|
117
|
+
*/
|
|
118
|
+
export interface ResultAnswer<Facts> {
|
|
119
|
+
readonly facts: Facts;
|
|
120
|
+
readonly rows: readonly Row[];
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* An acquired resource instance: what it hands the command through the run payload (`payload`, what its payload
|
|
124
|
+
* contract holds); its result (`result`, `ResultAnswer`), none when a `ran` outcome reports nothing of it; for a
|
|
125
|
+
* resource with its own progress, the progress event the launcher emits once it says the run acquired it
|
|
126
|
+
* (`announce`), such as what it holds; and what a canceled run says it changed, should the run be canceled after it
|
|
127
|
+
* acquired (`canceled`).
|
|
128
|
+
*/
|
|
129
|
+
export interface Acquired<Payload, Result = never, Event = never> {
|
|
130
|
+
readonly payload: Payload;
|
|
131
|
+
readonly result?: Result;
|
|
132
|
+
readonly announce?: Event;
|
|
133
|
+
readonly canceled?: readonly string[];
|
|
134
|
+
}
|
|
135
|
+
/** A failed mint, as the credential source answers it: what the mint was for, and why it failed. */
|
|
136
|
+
export type MintFailed = Extract<CredentialFailure, {
|
|
137
|
+
readonly source: "mint";
|
|
138
|
+
}>;
|
|
139
|
+
/**
|
|
140
|
+
* How `acquireForRun` answers: `acquired` (`Acquired`); a refusal (`Refusal`), to which the launcher adds the run's
|
|
141
|
+
* cleanup; `canceled`, stopped by the signal, with what a canceled run says it changed; or `mintFailed`, the run's
|
|
142
|
+
* mint failed and it had nothing to go on with, which the launcher owns: it ends the run as its own `mint_failed`,
|
|
143
|
+
* with the run's cleanup.
|
|
144
|
+
*/
|
|
145
|
+
export type AcquireForRunAnswer<Payload, Result = never, Event = never> = {
|
|
146
|
+
readonly acquired: Acquired<Payload, Result, Event>;
|
|
147
|
+
} | Refusal | {
|
|
148
|
+
readonly canceled: readonly string[];
|
|
149
|
+
} | {
|
|
150
|
+
readonly mintFailed: MintFailed;
|
|
151
|
+
};
|
|
152
|
+
/**
|
|
153
|
+
* What `releaseAfterRun` works from, beside its world: everything its acquire took, in the order it called `take`,
|
|
154
|
+
* whether or not the acquire finished, and what it reports as it goes (`Report`), each thing it couldn't release a
|
|
155
|
+
* warning.
|
|
156
|
+
*/
|
|
157
|
+
export interface ReleaseAfterRunInput<Taken, Event = never> {
|
|
158
|
+
readonly taken: readonly Taken[];
|
|
159
|
+
readonly report: Report<Event>;
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* What releasing a resource instance did: what a canceled run says it finished (`done`), such as that the run holds
|
|
163
|
+
* nothing. What it couldn't do are the warnings its release reported, which outcomes report under
|
|
164
|
+
* `cleanup.resources.<key>.warnings`.
|
|
165
|
+
*/
|
|
166
|
+
export interface Released {
|
|
167
|
+
readonly done: readonly string[];
|
|
168
|
+
}
|
|
169
|
+
/** How `releaseAfterRun` answers: what releasing did (`Released`), or `nothingTaken`: its acquire took nothing. */
|
|
170
|
+
export type ReleaseAfterRunAnswer = Released | {
|
|
171
|
+
readonly nothingTaken: true;
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* What one resource definition's lifecycle works with, from which `defineResource` types it: its options and their
|
|
175
|
+
* sources, the secrets its `beforeRun` hands the run, one thing its acquire takes, what it hands the command, and its
|
|
176
|
+
* progress events (never without progress). Every lifecycle answers its refusals, its warnings and its result in the
|
|
177
|
+
* same shapes (`Refusal`, `Report`, `ResultAnswer`), each with values of its own. The extension API builds it from the
|
|
178
|
+
* definition; a extension folder writes none. As it is, each `unknown`, it is what the core sees of any resource's
|
|
179
|
+
* lifecycle.
|
|
180
|
+
*/
|
|
181
|
+
export interface LifecycleTypes {
|
|
182
|
+
readonly options: unknown;
|
|
183
|
+
readonly sources: unknown;
|
|
184
|
+
readonly secrets: Readonly<Record<string, string>>;
|
|
185
|
+
readonly taken: unknown;
|
|
186
|
+
readonly payload: unknown;
|
|
187
|
+
readonly event: unknown;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* The lifecycle of one resource definition, typed by `T`, over the world its `lifecycle(world)` was given; with no
|
|
191
|
+
* `T`, any resource's lifecycle as the core calls it. storm calls each on the launch machine. Each is a function
|
|
192
|
+
* property, so its parameter is checked contravariantly.
|
|
193
|
+
*
|
|
194
|
+
* - `secrets`: optional, and pure: no I/O. The values the launcher hides as `<token>` in a refusal that comes before
|
|
195
|
+
* `beforeRun`, such as one from the count, given the options resolved for that alone. A resource with no secrets
|
|
196
|
+
* leaves it out.
|
|
197
|
+
* - `beforeRun`: once, before the run starts, given the final options and their sources: before a mint, before a
|
|
198
|
+
* runner sandbox starts and before the run directory opens. It may do I/O.
|
|
199
|
+
* - `acquireForRun`: for every resource instance the run uses at once, while the runner, when there is one, readies
|
|
200
|
+
* the runner sandbox. A refusal aborts `signal` for the others.
|
|
201
|
+
* - `releaseAfterRun`: however the run ends, after the command stops (and the runner's sandboxes are closed), one
|
|
202
|
+
* resource instance at a time, in the reverse of the registry's order.
|
|
203
|
+
*/
|
|
204
|
+
export interface ResourceLifecycle<T extends LifecycleTypes = LifecycleTypes> {
|
|
205
|
+
readonly secrets?: (input: {
|
|
206
|
+
readonly options: T["options"];
|
|
207
|
+
}) => readonly string[];
|
|
208
|
+
readonly beforeRun: (input: BeforeRunInput<T["options"], T["sources"]>) => Promise<BeforeRunAnswer<T["secrets"]>>;
|
|
209
|
+
readonly acquireForRun: (input: AcquireForRunInput<T["options"], T["secrets"], T["taken"], T["event"]>) => Promise<AcquireForRunAnswer<T["payload"], ResultAnswer<unknown>, T["event"]>>;
|
|
210
|
+
readonly releaseAfterRun: (input: ReleaseAfterRunInput<T["taken"], T["event"]>) => Promise<ReleaseAfterRunAnswer>;
|
|
211
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// A resource definition's lifecycle: what the launcher calls on each of its resource instances, over the definition's
|
|
2
|
+
// world, around a run, all on the launch machine, and what each lifecycle point works from and answers. A resource
|
|
3
|
+
// folder writes `lifecycle(world)` in its `lifecycle.ts`, which its `defineResource` carries, typing each lifecycle
|
|
4
|
+
// point with the inputs and answers below. Each lifecycle point says in its answer how it ended: a lifecycle point that
|
|
5
|
+
// refuses a run words its refusal where it refuses (`Refusal`), a warning takes a snake_case reason of the resource's
|
|
6
|
+
// own, and an acquire's result (`ResultAnswer`) is typed by the lifecycle. The lifecycle holds `beforeRun`, the
|
|
7
|
+
// optional `secrets`, `acquireForRun` and `releaseAfterRun`. A resource instance is acquired once its `acquireForRun`
|
|
8
|
+
// succeeds, until its `releaseAfterRun`. It names no resource.
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SpanStatus } from "./span.ts";
|
|
2
|
+
/** How a frame's parts are painted: color codes on a terminal that shows color, the text alone otherwise. */
|
|
3
|
+
export interface Paint {
|
|
4
|
+
readonly done: (text: string) => string;
|
|
5
|
+
readonly failed: (text: string) => string;
|
|
6
|
+
readonly stopped: (text: string) => string;
|
|
7
|
+
readonly active: (text: string) => string;
|
|
8
|
+
readonly faint: (text: string) => string;
|
|
9
|
+
readonly strong: (text: string) => string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 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
|
|
13
|
+
* the resource's own lane, `Lane`.
|
|
14
|
+
*/
|
|
15
|
+
export interface ResourceNotice<Lane extends string = never> {
|
|
16
|
+
readonly lane: "run" | "cleanup" | Lane;
|
|
17
|
+
readonly text: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* How a lane's parts are drawn, live at `now`, or in a final form, with `now` undefined, where a span still running
|
|
21
|
+
* shows no time. `line` lays out one text under the lane's row, cut to the width when live; `elapsed` is a span's
|
|
22
|
+
* time, such as `4.2s`, or nothing when it has no end and no `now`; `seconds` is a duration as progress shows it.
|
|
23
|
+
*/
|
|
24
|
+
export interface LaneDraw {
|
|
25
|
+
readonly now: number | undefined;
|
|
26
|
+
readonly paint: Paint;
|
|
27
|
+
readonly glyph: (status: SpanStatus) => string;
|
|
28
|
+
readonly line: (text: string) => string;
|
|
29
|
+
readonly elapsed: (from: number | undefined, to: number | undefined) => string;
|
|
30
|
+
readonly seconds: (ms: number) => string;
|
|
31
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// What a resource's progress draws with, and what its lines are: a resource with its own progress renders its own
|
|
2
|
+
// events as plain lines and as the live view's notices, and its lane's live row, its final form and its row's label on
|
|
3
|
+
// the waterfall (`ResourceProgress`, `progress.ts`); a resource without it reports its lines (`Report`,
|
|
4
|
+
// `lifecycle.ts`). A run's views own the layout around them: the time and lane prefix of a plain line, each block's
|
|
5
|
+
// rows and their order, the glyphs and the widths, how a duration shows, each lane row's time, `stopping` while a
|
|
6
|
+
// signal stops the run, and how long a ready lane waits for the others. It names no resource.
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { LaneDraw, ResourceNotice } from "./presentation.ts";
|
|
2
|
+
import type { Span } from "./span.ts";
|
|
3
|
+
/** How a lane ended: ready for the command, failed, or stopped short of ready. */
|
|
4
|
+
export type LaneOutcome = "ready" | "failed" | "stopped";
|
|
5
|
+
/** A resource lane's row on the waterfall: its steps that started, in order, and what it holds, if it counts that. */
|
|
6
|
+
export interface LaneRow<Step extends string> {
|
|
7
|
+
readonly steps: readonly {
|
|
8
|
+
readonly name: Step;
|
|
9
|
+
readonly span: Span;
|
|
10
|
+
}[];
|
|
11
|
+
/** How many things the lane holds that it reused, and how many it created. */
|
|
12
|
+
readonly sandboxes?: {
|
|
13
|
+
readonly reused: number;
|
|
14
|
+
readonly created: number;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* A resource's progress, in its lane named `Lane`, whose state is `State`: it applies the resource's own events
|
|
19
|
+
* (`Event`), and its waterfall row names its steps (`Step`); with its defaults, the progress as the core holds it. It
|
|
20
|
+
* is pure: it applies events, projects state and draws, and reaches nothing. Each operation is a function property, so
|
|
21
|
+
* its parameters are checked contravariantly. The views own the layout around what it draws: each row's glyph, the
|
|
22
|
+
* lane's name, the time, `stopping` while a signal stops the run, and how long a ready lane waits for the others.
|
|
23
|
+
*
|
|
24
|
+
* - `lane`: the lane's name, which `lane-started` and `lane-ended` events name.
|
|
25
|
+
* - `label`: its row's name on the waterfall and in the job summary, such as `<lane>-setup`.
|
|
26
|
+
* - `steps`: its steps' names, in the waterfall's order, which a ran outcome's timeline names.
|
|
27
|
+
* - `start`: the lane's state when it starts, at `startedAt`.
|
|
28
|
+
* - `apply`: the lane after one of the resource's own events, at `at`, its acquire's `announce` among them, which the
|
|
29
|
+
* launcher emits once it said the run acquired the resource.
|
|
30
|
+
* - `ended`: the lane once it ended as `outcome` at `at`: its span ends, and a lane that failed or stopped ends each of
|
|
31
|
+
* its steps still running the same way.
|
|
32
|
+
* - `row`: its waterfall row's steps and counts.
|
|
33
|
+
* - `live`: its live row, from its state once its lane started: the row's text, and, while something is in flight, a
|
|
34
|
+
* detail, such as the creates under way. The live view lays the row out: beside the runner, the row shows the detail
|
|
35
|
+
* when there is one, else the text; alone, the text, with the detail on the line under it.
|
|
36
|
+
* - `record`: its final form: its row's text and the lines under it.
|
|
37
|
+
* - `plain`: plain progress for one run: each of its events' lines, given when it happened; it may remember earlier
|
|
38
|
+
* events, such as when a step started. `seconds` is a duration as progress shows it, such as `4.2s`, the launcher's,
|
|
39
|
+
* as `LaneDraw` has.
|
|
40
|
+
* - `notices`: the live view's notices for one of its events: what its rows can't hold, printed above.
|
|
41
|
+
*/
|
|
42
|
+
export interface ResourceProgress<Lane extends string = string, State extends Span = Span, Event = unknown, Step extends string = string> {
|
|
43
|
+
readonly lane: Lane;
|
|
44
|
+
readonly label: string;
|
|
45
|
+
readonly steps: readonly Step[];
|
|
46
|
+
readonly start: (startedAt: number) => State;
|
|
47
|
+
readonly apply: (state: State, event: Event, at: number) => State;
|
|
48
|
+
readonly ended: (state: State, outcome: LaneOutcome, at: number) => State;
|
|
49
|
+
readonly row: (state: State) => LaneRow<Step>;
|
|
50
|
+
readonly live: (state: State, draw: LaneDraw) => {
|
|
51
|
+
readonly text: string;
|
|
52
|
+
readonly detail?: string;
|
|
53
|
+
};
|
|
54
|
+
readonly record: (state: State, draw: LaneDraw) => {
|
|
55
|
+
readonly text: string;
|
|
56
|
+
readonly lines: readonly string[];
|
|
57
|
+
};
|
|
58
|
+
readonly plain: (options: {
|
|
59
|
+
readonly verbose: boolean;
|
|
60
|
+
readonly seconds: (ms: number) => string;
|
|
61
|
+
}) => (event: Event, now: number) => readonly ResourceNotice<Lane>[];
|
|
62
|
+
readonly notices: (event: Event, options: {
|
|
63
|
+
readonly verbose: boolean;
|
|
64
|
+
}) => readonly ResourceNotice<Lane>[];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Each resource instance's lane state, by resource key, with its definition's name, in the order the lanes started; an
|
|
68
|
+
* instance whose lane hasn't started, or that has none, is absent.
|
|
69
|
+
*/
|
|
70
|
+
export type LaneStates = {
|
|
71
|
+
readonly [key: string]: {
|
|
72
|
+
readonly definition: string;
|
|
73
|
+
readonly state: Span;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The progress contract: what a resource with its own progress gives the run's state and its views. Its progress
|
|
2
|
+
// applies the resource's own events to its own lane state, from its lane's start to its end, projects its row on the
|
|
3
|
+
// waterfall, and draws itself: its live row, its final form, its waterfall label and steps, and its events as plain
|
|
4
|
+
// lines and as the live view's notices. A extension folder writes its progress against its own event, lane-state and
|
|
5
|
+
// step types, and its `defineResource` carries it; the core sees it with its defaults, `unknown` events over a span
|
|
6
|
+
// (`ResourceProgress`). The run's state applies every event through the resource definitions (`applyRunEvent`), each
|
|
7
|
+
// resource instance's to its own lane state. It names no resource.
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One labeled row an outcome lists: a label, and one value or several. The same tuple as Clinkr's `Row`, which the
|
|
3
|
+
* composition layer hands it to as it is; `test/unit/sdk/extension/clinkr-shapes.test.ts` holds the two together.
|
|
4
|
+
*/
|
|
5
|
+
export type Row = readonly [label: string, value: string | readonly string[]];
|
|
6
|
+
/**
|
|
7
|
+
* One warning a resource instance reported (`report.warning`): one thing it couldn't do that doesn't stop the run, as
|
|
8
|
+
* a snake_case reason (`Reason`) and a sentence. The same shape as Clinkr's `Warning`, which
|
|
9
|
+
* `test/unit/sdk/extension/clinkr-shapes.test.ts` holds it to. Every outcome shows it the same way: as a warning, as a
|
|
10
|
+
* value under `Warnings` in the rows an error lists, in a canceled run's text, and in the JSON.
|
|
11
|
+
*/
|
|
12
|
+
export interface Warning<Reason extends string = string> {
|
|
13
|
+
readonly reason: Reason;
|
|
14
|
+
readonly message: string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// What a resource reports beside its data: the rows an outcome lists, and its warnings. storm declares its own `Row`
|
|
2
|
+
// and `Warning`, the shapes Clinkr's outcomes take, so its declarations mention no Clinkr: a resource's code reaches
|
|
3
|
+
// them, and a published resource export must load and declare no Clinkr (`tools/storm/AGENTS.md`). The words every
|
|
4
|
+
// resource's warnings show in are the core's (`warningTally`, `warningRows`, `core/reports.ts`). It names no resource.
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { PayloadContract } from "../run/contract.ts";
|
|
3
|
+
import type { LauncherSupplies } from "./launcher-supplies.ts";
|
|
4
|
+
import type { ResourceLifecycle } from "./lifecycle.ts";
|
|
5
|
+
import type { ResourceProgress } from "./progress.ts";
|
|
6
|
+
/** Where a value came from: a flag (`--scope`, a command's own option flag), the file, or a default. */
|
|
7
|
+
export type SettingSource = "flag" | "file" | "default";
|
|
8
|
+
/** A value and where it came from. */
|
|
9
|
+
export interface Setting<T> {
|
|
10
|
+
readonly value: T;
|
|
11
|
+
readonly source: SettingSource;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* What a run counted before it started: `counted`, the tests `storm vitest`'s `vitest list` lists and the files they
|
|
15
|
+
* are in; `not-counted` for a run that counts nothing, such as `storm exec`'s, and for a command that plans no run,
|
|
16
|
+
* such as an extension's own command.
|
|
17
|
+
*/
|
|
18
|
+
export type RunTestPlan = {
|
|
19
|
+
readonly kind: "counted";
|
|
20
|
+
readonly tests: number;
|
|
21
|
+
readonly files: number;
|
|
22
|
+
} | {
|
|
23
|
+
readonly kind: "not-counted";
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The run as storm planned it before it resolves the options, which an option's default may depend on: what it
|
|
27
|
+
* counted. storm builds it once per run, frozen, and hands the same one to every default.
|
|
28
|
+
*/
|
|
29
|
+
export interface PlannedRun {
|
|
30
|
+
readonly testPlan: RunTestPlan;
|
|
31
|
+
}
|
|
32
|
+
/** The planned run of a run that counts nothing, such as `storm exec`'s, or of a command that plans no run. */
|
|
33
|
+
export declare const NOT_COUNTED: PlannedRun;
|
|
34
|
+
/** An option's default: a value, or a function of the planned run that gives one. */
|
|
35
|
+
export type OptionDefault<T> = T | ((run: PlannedRun) => T);
|
|
36
|
+
/**
|
|
37
|
+
* A run flag's help: Clinkr's field description, its `description`, and the label of its value, such as `N` in
|
|
38
|
+
* `--<prefix>-<option> <N>`. A boolean flag takes no label.
|
|
39
|
+
* storm bundles Clinkr, so a published declaration names none of Clinkr's types (`tools/storm/AGENTS.md`); `exec`'s
|
|
40
|
+
* and `vitest`'s help, which hand it to Clinkr, check that the shape still fits.
|
|
41
|
+
*/
|
|
42
|
+
export interface FlagHelp {
|
|
43
|
+
readonly description?: string;
|
|
44
|
+
readonly valueLabel?: string;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* How one resource option is checked, defaulted and flagged.
|
|
48
|
+
*
|
|
49
|
+
* - `schema`: the option's zod schema, for a value from the file or from a command's own flag. It gives the option's
|
|
50
|
+
* value, which a transform may normalize, such as a URL to a short form. Its error messages follow
|
|
51
|
+
* the option's key path, `must be …, not …` (`mustBe`), so the file and the flag say the same.
|
|
52
|
+
* - `default`: the value when neither the file nor a flag gives one; or a function of the planned run, such as one
|
|
53
|
+
* that sizes the option from the tests `storm vitest` counted, called once as the options resolve, whose value
|
|
54
|
+
* `schema` checks too. An option whose default is a function takes a string, number or boolean, and the run's test
|
|
55
|
+
* plan lists it with its value and where that came from.
|
|
56
|
+
* - `required`: a resource without this option is a problem.
|
|
57
|
+
* - `flag`: the option's run flag on `exec` and `vitest`, `--<flagPrefix>-<option>`, with its help, whose request field
|
|
58
|
+
* the launcher makes from `schema`. An option without one comes only from the file or its default. The usage names a
|
|
59
|
+
* boolean flag as `--x=false` when its default is true, since only that value changes the request then.
|
|
60
|
+
*/
|
|
61
|
+
export interface OptionRule<T> {
|
|
62
|
+
readonly schema: z.ZodType<T>;
|
|
63
|
+
readonly default?: OptionDefault<T>;
|
|
64
|
+
readonly required?: boolean;
|
|
65
|
+
readonly flag?: FlagHelp;
|
|
66
|
+
}
|
|
67
|
+
/** A resource's option rules, by option name, whatever their values. */
|
|
68
|
+
export interface OptionRules {
|
|
69
|
+
readonly [option: string]: OptionRule<unknown>;
|
|
70
|
+
}
|
|
71
|
+
/** The value option rule `R`'s schema gives: what the lifecycle sees of the option. */
|
|
72
|
+
export type OptionValue<R> = R extends {
|
|
73
|
+
readonly schema: z.ZodType<infer T>;
|
|
74
|
+
} ? T : never;
|
|
75
|
+
/** What option rule `R`'s schema takes: what the config file gives the option. */
|
|
76
|
+
type OptionInput<R> = R extends {
|
|
77
|
+
readonly schema: infer Schema extends z.ZodType;
|
|
78
|
+
} ? z.input<Schema> : never;
|
|
79
|
+
/** The options of `Rules` a resource always has a value for: each with a default, or required. */
|
|
80
|
+
export type PresentOption<Rules> = {
|
|
81
|
+
readonly [K in keyof Rules]-?: Rules[K] extends {
|
|
82
|
+
readonly default: unknown;
|
|
83
|
+
} | {
|
|
84
|
+
readonly required: true;
|
|
85
|
+
} ? K : never;
|
|
86
|
+
}[keyof Rules];
|
|
87
|
+
/** The options of `Rules` a resource must give. */
|
|
88
|
+
type RequiredOption<Rules> = {
|
|
89
|
+
readonly [K in keyof Rules]-?: Rules[K] extends {
|
|
90
|
+
readonly required: true;
|
|
91
|
+
} ? K : never;
|
|
92
|
+
}[keyof Rules];
|
|
93
|
+
/** Every option of `Rules`, as the config file gives it; mapped over `Rules`, so each keeps its rule's doc comment. */
|
|
94
|
+
type OptionInputs<Rules> = {
|
|
95
|
+
readonly [K in keyof Rules]: OptionInput<Rules[K]>;
|
|
96
|
+
};
|
|
97
|
+
/** Every option of `Rules`, as its schema gives it; mapped over `Rules`, so each keeps its rule's doc comment. */
|
|
98
|
+
type OptionValues<Rules> = {
|
|
99
|
+
readonly [K in keyof Rules]: OptionValue<Rules[K]>;
|
|
100
|
+
};
|
|
101
|
+
/** What a resource holds as the config file writes it: the options it gives, each required one among them. */
|
|
102
|
+
export type WrittenOptions<Rules> = Pick<OptionInputs<Rules>, RequiredOption<Rules>> & Partial<Pick<OptionInputs<Rules>, Exclude<keyof Rules, RequiredOption<Rules>>>>;
|
|
103
|
+
/**
|
|
104
|
+
* A resource's options: the plain values, shaped as in the config file, once defaults, the file and the flags are
|
|
105
|
+
* merged. Its lifecycle, a runner recipe and the run payload all see these. An option with neither a default nor
|
|
106
|
+
* `required` may be absent.
|
|
107
|
+
*/
|
|
108
|
+
export type ResolvedOptions<Rules> = Pick<OptionValues<Rules>, PresentOption<Rules>> & Partial<Pick<OptionValues<Rules>, Exclude<keyof Rules, PresentOption<Rules>>>>;
|
|
109
|
+
/** Each option of a resource as a `Setting`, once defaults, the file and the flags are merged: what `check` sees. */
|
|
110
|
+
export type OptionSettings<Rules> = {
|
|
111
|
+
readonly [K in keyof Rules]-?: K extends PresentOption<Rules> ? Setting<OptionValue<Rules[K]>> : Setting<OptionValue<Rules[K]>> | undefined;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Where each option of a resource came from, once defaults, the file and the flags are merged, by option name:
|
|
115
|
+
* what its `beforeRun` reads beside its options. An option with neither a default nor `required` may be given by none,
|
|
116
|
+
* and has no source.
|
|
117
|
+
*/
|
|
118
|
+
export type OptionSources<Rules> = {
|
|
119
|
+
readonly [K in keyof Rules]-?: K extends PresentOption<Rules> ? SettingSource : SettingSource | undefined;
|
|
120
|
+
};
|
|
121
|
+
/**
|
|
122
|
+
* One thing wrong with a resource's merged options: the option it is about, what is wrong, worded to follow the
|
|
123
|
+
* option's key path, and every option whose value it is about, `option` included, whose sources the error names.
|
|
124
|
+
*/
|
|
125
|
+
export interface OptionProblem<Option extends string> {
|
|
126
|
+
readonly option: Option;
|
|
127
|
+
readonly problem: string;
|
|
128
|
+
readonly involves: readonly Option[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* A resource: its definition's name and the options the config file gives the resource it
|
|
132
|
+
* declares, under the resource's key in `resources`, which for now must be the definition's name. The definition's
|
|
133
|
+
* resource factory makes one (`resourceFactory`).
|
|
134
|
+
*/
|
|
135
|
+
export interface Resource<Name extends string = string, Options = unknown> {
|
|
136
|
+
readonly name: Name;
|
|
137
|
+
readonly options: Options;
|
|
138
|
+
}
|
|
139
|
+
/** Each rule's default fits its own schema: a value the schema gives, or a function of the planned run that gives one. */
|
|
140
|
+
export type DefaultsFit<Rules> = {
|
|
141
|
+
readonly [K in keyof Rules]: {
|
|
142
|
+
readonly default?: OptionDefault<OptionValue<Rules[K]>>;
|
|
143
|
+
};
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* A resource definition (`GLOSSARY.md`, **Resource definition**), as the extension API's `defineResource` returns it:
|
|
147
|
+
* what one resource declares about its section under `resources` in `storm.config.ts`, and how the launcher fulfills
|
|
148
|
+
* it. With its defaults, each `unknown`, it is any resource definition, as `config` and the core loop over them.
|
|
149
|
+
*
|
|
150
|
+
* - `name`: its key under `resources`, and the name everything about it is keyed by.
|
|
151
|
+
* - `flagPrefix`: the prefix of its options' run flags: `<prefix>` in `--<prefix>-<option>`.
|
|
152
|
+
* - `options`: one rule for each option, each with its doc comment, which the config file's editor shows.
|
|
153
|
+
* - `check`: the checks across its options, given each as a `Setting`: it only refuses, with each thing wrong, and
|
|
154
|
+
* derives nothing. A required option that is missing never reaches it.
|
|
155
|
+
* - `payload`: its payload contract: its name and the check of what storm wrote under `resources.<key>.payload` in the
|
|
156
|
+
* run payload, the section the resource hands its command, which a command reads with
|
|
157
|
+
* `readRunPayload().get(contract)`.
|
|
158
|
+
* - `world`: its world, built live from what the launcher supplies (`LauncherSupplies`), which keeps its type, since an
|
|
159
|
+
* extension's commands read it.
|
|
160
|
+
* - `lifecycle`: its lifecycle over its world, which the launcher hands it by its name, seen as `unknown` wherever the
|
|
161
|
+
* resource has types of its own (`ResourceLifecycle`).
|
|
162
|
+
* - `progress`: its own progress, joined with what the views draw of it; absent for a resource without it.
|
|
163
|
+
*
|
|
164
|
+
* `check` is a method, so a list of definitions fits the bare `ResourceDefinition`: a method's parameter is checked
|
|
165
|
+
* both ways, where a function property's would be checked only contravariantly. The definition isn't callable: what a
|
|
166
|
+
* config file calls to make a resource is its resource factory (`resourceFactory`).
|
|
167
|
+
*/
|
|
168
|
+
export interface ResourceDefinition<Name extends string = string, Rules extends OptionRules = OptionRules, Payload = unknown, World = unknown> {
|
|
169
|
+
readonly name: Name;
|
|
170
|
+
readonly flagPrefix: string;
|
|
171
|
+
readonly options: Rules;
|
|
172
|
+
check(settings: OptionSettings<Rules>): readonly OptionProblem<keyof Rules & string>[];
|
|
173
|
+
readonly payload: PayloadContract<Payload>;
|
|
174
|
+
readonly world: (supplies: LauncherSupplies) => World;
|
|
175
|
+
readonly lifecycle: (world: unknown) => ResourceLifecycle;
|
|
176
|
+
readonly progress?: ResourceProgress;
|
|
177
|
+
}
|
|
178
|
+
/** A definition's option names. */
|
|
179
|
+
export type OptionOf<D extends ResourceDefinition> = keyof D["options"] & string;
|
|
180
|
+
/** A resource's options as the file or the flags give them, each checked; an option not given is absent. */
|
|
181
|
+
export type GivenOptions<D extends ResourceDefinition> = {
|
|
182
|
+
readonly [K in OptionOf<D>]?: OptionValue<D["options"][K]>;
|
|
183
|
+
};
|
|
184
|
+
/** What a definition's `check` takes: each option as a `Setting`. */
|
|
185
|
+
export type SettingsOf<D extends ResourceDefinition> = OptionSettings<D["options"]>;
|
|
186
|
+
/** A resource's options, the plain values, of definition `D`. */
|
|
187
|
+
export type OptionsOf<D extends ResourceDefinition> = ResolvedOptions<D["options"]>;
|
|
188
|
+
/** The section of the run payload a resource of definition `D` hands its command: what its payload contract holds. */
|
|
189
|
+
export type PayloadOf<D extends ResourceDefinition> = D["payload"] extends PayloadContract<infer T> ? T : never;
|
|
190
|
+
/** Where each option of a resource of definition `D` came from. */
|
|
191
|
+
export type SourcesOf<D extends ResourceDefinition> = OptionSources<D["options"]>;
|
|
192
|
+
/**
|
|
193
|
+
* The key of definition `definition`'s default resource under `resources`: its name. A run's own flags for the
|
|
194
|
+
* definition's options set this resource, and a read that names no key, such as a runner recipe's `run.get(<name>)`,
|
|
195
|
+
* reads it. For now a config file may hold only default resources (`defineConfig` and `loadConfig` check each key).
|
|
196
|
+
*/
|
|
197
|
+
export declare function defaultResourceKey(definition: {
|
|
198
|
+
readonly name: string;
|
|
199
|
+
}): string;
|
|
200
|
+
/** A resource's option's place in the file, as problems name it: `resources.<key>.<option>`. */
|
|
201
|
+
export declare function optionKeyPath(key: string, option: string): string;
|
|
202
|
+
/** How a problem names the call that makes a resource of definition `name`: `<name>({ … })`. */
|
|
203
|
+
export declare function resourceCall(name: string): string;
|
|
204
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// The resource definition: what one resource declares about its section under `resources` in `storm.config.ts`, and how
|
|
2
|
+
// the launcher fulfills it, as one interface (`ResourceDefinition`), with the types storm reads its options and its
|
|
3
|
+
// merged options by. Each extension folder writes its definition with the extension API's `defineResource`
|
|
4
|
+
// (`resource.ts`), and a config file makes a resource with its resource factory (`resource-factory.ts`);
|
|
5
|
+
// the extension API declares the shapes and names no resource. `config` (`load.ts`, `resolve.ts`) loops over the definitions
|
|
6
|
+
// its caller passes in, and keeps each resource as a plain record by its resource key.
|
|
7
|
+
/** The planned run of a run that counts nothing, such as `storm exec`'s, or of a command that plans no run. */
|
|
8
|
+
export const NOT_COUNTED = Object.freeze({ testPlan: Object.freeze({ kind: "not-counted" }) });
|
|
9
|
+
/**
|
|
10
|
+
* The key of definition `definition`'s default resource under `resources`: its name. A run's own flags for the
|
|
11
|
+
* definition's options set this resource, and a read that names no key, such as a runner recipe's `run.get(<name>)`,
|
|
12
|
+
* reads it. For now a config file may hold only default resources (`defineConfig` and `loadConfig` check each key).
|
|
13
|
+
*/
|
|
14
|
+
export function defaultResourceKey(definition) {
|
|
15
|
+
return definition.name;
|
|
16
|
+
}
|
|
17
|
+
/** A resource's option's place in the file, as problems name it: `resources.<key>.<option>`. */
|
|
18
|
+
export function optionKeyPath(key, option) {
|
|
19
|
+
return ["resources", key, option].join(".");
|
|
20
|
+
}
|
|
21
|
+
/** How a problem names the call that makes a resource of definition `name`: `<name>({ … })`. */
|
|
22
|
+
export function resourceCall(name) {
|
|
23
|
+
return `${name}({ … })`;
|
|
24
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Resource, ResourceDefinition, WrittenOptions } from "./resource-definition.ts";
|
|
2
|
+
/**
|
|
3
|
+
* What a config file calls to make a resource of definition `D` (`<name>({ … })`), with every option optional but the
|
|
4
|
+
* required ones, and none at all when none is required. It holds its definition (`definition`).
|
|
5
|
+
*/
|
|
6
|
+
export type ResourceFactory<D extends ResourceDefinition> = ((...options: Record<never, never> extends WrittenOptions<D["options"]> ? [options?: WrittenOptions<D["options"]>] : [options: WrittenOptions<D["options"]>]) => Resource<D["name"], WrittenOptions<D["options"]>>) & {
|
|
7
|
+
readonly definition: D;
|
|
8
|
+
};
|
|
9
|
+
/** The resource factory of `definition`: what a config file calls to make a resource of it. */
|
|
10
|
+
export declare function resourceFactory<D extends ResourceDefinition>(definition: D): ResourceFactory<D>;
|