@cnc-tools/storm 0.0.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/node-version.js +24 -0
- package/bin/storm.js +16 -0
- package/dist/application.d.ts +13 -0
- package/dist/application.js +23 -0
- package/dist/bin/storm.d.ts +1 -0
- package/dist/bin/storm.js +45 -0
- package/dist/build-info.js +3 -0
- package/dist/closed-terminal.d.ts +7 -0
- package/dist/closed-terminal.js +18 -0
- package/dist/combine-errors.d.ts +11 -0
- package/dist/combine-errors.js +19 -0
- package/dist/commands/dashboard.d.ts +11 -0
- package/dist/commands/dashboard.js +18 -0
- package/dist/commands/run/cleanup.d.ts +135 -0
- package/dist/commands/run/cleanup.js +171 -0
- package/dist/commands/run/command.d.ts +327 -0
- package/dist/commands/run/command.js +620 -0
- package/dist/commands/run/job-summary.d.ts +6 -0
- package/dist/commands/run/job-summary.js +31 -0
- package/dist/commands/run/live-view.d.ts +22 -0
- package/dist/commands/run/live-view.js +395 -0
- package/dist/commands/run/metadata.d.ts +47 -0
- package/dist/commands/run/metadata.js +83 -0
- package/dist/commands/run/mint-failed.d.ts +11 -0
- package/dist/commands/run/mint-failed.js +33 -0
- package/dist/commands/run/outcomes.d.ts +307 -0
- package/dist/commands/run/outcomes.js +332 -0
- package/dist/commands/run/progress.d.ts +44 -0
- package/dist/commands/run/progress.js +277 -0
- package/dist/commands/run/redaction.d.ts +15 -0
- package/dist/commands/run/redaction.js +40 -0
- package/dist/commands/run/run-collector.d.ts +30 -0
- package/dist/commands/run/run-collector.js +73 -0
- package/dist/commands/run/run-record.d.ts +144 -0
- package/dist/commands/run/run-record.js +96 -0
- package/dist/commands/run/tests-summary.d.ts +34 -0
- package/dist/commands/run/tests-summary.js +141 -0
- package/dist/commands/run/text.d.ts +22 -0
- package/dist/commands/run/text.js +74 -0
- package/dist/commands/run/view.d.ts +35 -0
- package/dist/commands/run/view.js +163 -0
- package/dist/commands/run/waterfall.d.ts +25 -0
- package/dist/commands/run/waterfall.js +108 -0
- package/dist/commands/run/worker-chart.d.ts +79 -0
- package/dist/commands/run/worker-chart.js +313 -0
- package/dist/commands/runs/facts.d.ts +150 -0
- package/dist/commands/runs/facts.js +292 -0
- package/dist/commands/runs/list/command.d.ts +86 -0
- package/dist/commands/runs/list/command.js +36 -0
- package/dist/commands/runs/list/metadata.d.ts +22 -0
- package/dist/commands/runs/list/metadata.js +19 -0
- package/dist/commands/runs/list/outcomes.d.ts +74 -0
- package/dist/commands/runs/list/outcomes.js +89 -0
- package/dist/commands/runs/logs/command.d.ts +72 -0
- package/dist/commands/runs/logs/command.js +51 -0
- package/dist/commands/runs/logs/metadata.d.ts +22 -0
- package/dist/commands/runs/logs/metadata.js +22 -0
- package/dist/commands/runs/logs/outcomes.d.ts +55 -0
- package/dist/commands/runs/logs/outcomes.js +77 -0
- package/dist/commands/runs/metadata.d.ts +3 -0
- package/dist/commands/runs/metadata.js +3 -0
- package/dist/commands/runs/past-run.d.ts +72 -0
- package/dist/commands/runs/past-run.js +99 -0
- package/dist/commands/runs/show/command.d.ts +176 -0
- package/dist/commands/runs/show/command.js +76 -0
- package/dist/commands/runs/show/metadata.d.ts +25 -0
- package/dist/commands/runs/show/metadata.js +22 -0
- package/dist/commands/runs/show/outcomes.d.ts +164 -0
- package/dist/commands/runs/show/outcomes.js +317 -0
- package/dist/config/by-name.d.ts +24 -0
- package/dist/config/by-name.js +26 -0
- package/dist/config/errors.d.ts +58 -0
- package/dist/config/errors.js +101 -0
- package/dist/config/gateways.d.ts +32 -0
- package/dist/config/gateways.js +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.js +12 -0
- package/dist/config/live/config-gateway.d.ts +6 -0
- package/dist/config/live/config-gateway.js +71 -0
- package/dist/config/load.d.ts +54 -0
- package/dist/config/load.js +175 -0
- package/dist/config/resolve.d.ts +49 -0
- package/dist/config/resolve.js +94 -0
- package/dist/config/resource-config.d.ts +132 -0
- package/dist/config/resource-config.js +19 -0
- package/dist/config/schema.d.ts +64 -0
- package/dist/config/schema.js +57 -0
- package/dist/config/set.d.ts +16 -0
- package/dist/config/set.js +55 -0
- package/dist/config/settings-file.d.ts +41 -0
- package/dist/config/settings-file.js +72 -0
- package/dist/config-file/define.d.ts +37 -0
- package/dist/config-file/define.js +9 -0
- package/dist/config-file/toolchain.d.ts +9 -0
- package/dist/config-file/toolchain.js +41 -0
- package/dist/context.d.ts +86 -0
- package/dist/context.js +43 -0
- package/dist/core/command-provider.d.ts +126 -0
- package/dist/core/command-provider.js +13 -0
- package/dist/core/command-slots.d.ts +67 -0
- package/dist/core/command-slots.js +136 -0
- package/dist/core/events.d.ts +128 -0
- package/dist/core/events.js +15 -0
- package/dist/core/gateways.d.ts +249 -0
- package/dist/core/gateways.js +1 -0
- package/dist/core/index.d.ts +20 -0
- package/dist/core/index.js +18 -0
- package/dist/core/keyed.d.ts +12 -0
- package/dist/core/keyed.js +24 -0
- package/dist/core/lane.d.ts +46 -0
- package/dist/core/lane.js +5 -0
- package/dist/core/limit.d.ts +9 -0
- package/dist/core/limit.js +29 -0
- package/dist/core/live/command-gateway.d.ts +11 -0
- package/dist/core/live/command-gateway.js +83 -0
- package/dist/core/live/job-summary-gateway.d.ts +5 -0
- package/dist/core/live/job-summary-gateway.js +20 -0
- package/dist/core/live/progress-terminal.d.ts +20 -0
- package/dist/core/live/progress-terminal.js +173 -0
- package/dist/core/live/run-directory-gateway.d.ts +24 -0
- package/dist/core/live/run-directory-gateway.js +437 -0
- package/dist/core/mint.d.ts +10 -0
- package/dist/core/mint.js +14 -0
- package/dist/core/payload.d.ts +26 -0
- package/dist/core/payload.js +33 -0
- package/dist/core/presentation.d.ts +87 -0
- package/dist/core/presentation.js +5 -0
- package/dist/core/presentations.d.ts +56 -0
- package/dist/core/presentations.js +66 -0
- package/dist/core/provider.d.ts +69 -0
- package/dist/core/provider.js +5 -0
- package/dist/core/resource.d.ts +262 -0
- package/dist/core/resource.js +6 -0
- package/dist/core/resources.d.ts +131 -0
- package/dist/core/resources.js +254 -0
- package/dist/core/run-directory.d.ts +69 -0
- package/dist/core/run-directory.js +94 -0
- package/dist/core/run-state.d.ts +152 -0
- package/dist/core/run-state.js +313 -0
- package/dist/core/run.d.ts +187 -0
- package/dist/core/run.js +321 -0
- package/dist/core/state-directory.d.ts +19 -0
- package/dist/core/state-directory.js +29 -0
- package/dist/core/timeline.d.ts +63 -0
- package/dist/core/timeline.js +97 -0
- package/dist/core/timing.d.ts +22 -0
- package/dist/core/timing.js +26 -0
- package/dist/credential/credential.d.ts +46 -0
- package/dist/credential/credential.js +80 -0
- package/dist/credential/diagnosis.d.ts +18 -0
- package/dist/credential/diagnosis.js +99 -0
- package/dist/credential/gateways.d.ts +109 -0
- package/dist/credential/gateways.js +1 -0
- package/dist/credential/index.d.ts +7 -0
- package/dist/credential/index.js +7 -0
- package/dist/credential/live/github-actions-token-gateway.d.ts +15 -0
- package/dist/credential/live/github-actions-token-gateway.js +43 -0
- package/dist/credential/live/github-actions-token-response.d.ts +19 -0
- package/dist/credential/live/github-actions-token-response.js +49 -0
- package/dist/credential/live/vercel-cli-gateway.d.ts +9 -0
- package/dist/credential/live/vercel-cli-gateway.js +64 -0
- package/dist/credential/live/vercel-output.d.ts +60 -0
- package/dist/credential/live/vercel-output.js +122 -0
- package/dist/credential/live/vercel-process.d.ts +14 -0
- package/dist/credential/live/vercel-process.js +3 -0
- package/dist/credential/settle.d.ts +31 -0
- package/dist/credential/settle.js +49 -0
- package/dist/credential/source.d.ts +110 -0
- package/dist/credential/source.js +114 -0
- package/dist/help-logo.d.ts +11 -0
- package/dist/help-logo.js +56 -0
- package/dist/presentation.d.ts +26 -0
- package/dist/presentation.js +21 -0
- package/dist/resources/github/cleanup.d.ts +23 -0
- package/dist/resources/github/cleanup.js +39 -0
- package/dist/resources/github/command.d.ts +74 -0
- package/dist/resources/github/command.js +117 -0
- package/dist/resources/github/config.d.ts +16 -0
- package/dist/resources/github/config.js +37 -0
- package/dist/resources/github/events.d.ts +26 -0
- package/dist/resources/github/events.js +2 -0
- package/dist/resources/github/fixture-repo.d.ts +69 -0
- package/dist/resources/github/fixture-repo.js +60 -0
- package/dist/resources/github/gateways.d.ts +62 -0
- package/dist/resources/github/gateways.js +1 -0
- package/dist/resources/github/index.d.ts +12 -0
- package/dist/resources/github/index.js +15 -0
- package/dist/resources/github/live/fixture-repo-gateway.d.ts +12 -0
- package/dist/resources/github/live/fixture-repo-gateway.js +92 -0
- package/dist/resources/github/live/gateways.d.ts +6 -0
- package/dist/resources/github/live/gateways.js +13 -0
- package/dist/resources/github/presentation.d.ts +13 -0
- package/dist/resources/github/presentation.js +43 -0
- package/dist/resources/github/provider.d.ts +66 -0
- package/dist/resources/github/provider.js +58 -0
- package/dist/resources/github/resource-provider.d.ts +6 -0
- package/dist/resources/github/resource-provider.js +20 -0
- package/dist/resources/github/resource.d.ts +33 -0
- package/dist/resources/github/resource.js +12 -0
- package/dist/resources/testserver/cleanup.d.ts +14 -0
- package/dist/resources/testserver/cleanup.js +22 -0
- package/dist/resources/testserver/command.d.ts +322 -0
- package/dist/resources/testserver/command.js +245 -0
- package/dist/resources/testserver/commands/app.d.ts +18 -0
- package/dist/resources/testserver/commands/app.js +3 -0
- package/dist/resources/testserver/commands/create/command.d.ts +136 -0
- package/dist/resources/testserver/commands/create/command.js +158 -0
- package/dist/resources/testserver/commands/create/metadata.d.ts +31 -0
- package/dist/resources/testserver/commands/create/metadata.js +45 -0
- package/dist/resources/testserver/commands/create/outcomes.d.ts +111 -0
- package/dist/resources/testserver/commands/create/outcomes.js +172 -0
- package/dist/resources/testserver/commands/list/command.d.ts +60 -0
- package/dist/resources/testserver/commands/list/command.js +56 -0
- package/dist/resources/testserver/commands/list/metadata.d.ts +9 -0
- package/dist/resources/testserver/commands/list/metadata.js +9 -0
- package/dist/resources/testserver/commands/list/outcomes.d.ts +54 -0
- package/dist/resources/testserver/commands/list/outcomes.js +152 -0
- package/dist/resources/testserver/config.d.ts +18 -0
- package/dist/resources/testserver/config.js +77 -0
- package/dist/resources/testserver/credential-facts.d.ts +80 -0
- package/dist/resources/testserver/credential-facts.js +83 -0
- package/dist/resources/testserver/events.d.ts +59 -0
- package/dist/resources/testserver/events.js +4 -0
- package/dist/resources/testserver/index.d.ts +16 -0
- package/dist/resources/testserver/index.js +24 -0
- package/dist/resources/testserver/lane.d.ts +28 -0
- package/dist/resources/testserver/lane.js +139 -0
- package/dist/resources/testserver/live/gateways.d.ts +6 -0
- package/dist/resources/testserver/live/gateways.js +26 -0
- package/dist/resources/testserver/options.d.ts +5 -0
- package/dist/resources/testserver/options.js +5 -0
- package/dist/resources/testserver/pool/channels.d.ts +80 -0
- package/dist/resources/testserver/pool/channels.js +48 -0
- package/dist/resources/testserver/pool/create.d.ts +48 -0
- package/dist/resources/testserver/pool/create.js +45 -0
- package/dist/resources/testserver/pool/directory.d.ts +4 -0
- package/dist/resources/testserver/pool/directory.js +5 -0
- package/dist/resources/testserver/pool/gateways.d.ts +190 -0
- package/dist/resources/testserver/pool/gateways.js +1 -0
- package/dist/resources/testserver/pool/host.d.ts +8 -0
- package/dist/resources/testserver/pool/host.js +21 -0
- package/dist/resources/testserver/pool/index.d.ts +9 -0
- package/dist/resources/testserver/pool/index.js +10 -0
- package/dist/resources/testserver/pool/inspect.d.ts +53 -0
- package/dist/resources/testserver/pool/inspect.js +45 -0
- package/dist/resources/testserver/pool/lease.d.ts +84 -0
- package/dist/resources/testserver/pool/lease.js +125 -0
- package/dist/resources/testserver/pool/live/pool-records.d.ts +17 -0
- package/dist/resources/testserver/pool/live/pool-records.js +70 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.d.ts +12 -0
- package/dist/resources/testserver/pool/live/pool-store-gateway.js +435 -0
- package/dist/resources/testserver/pool/staleness.d.ts +16 -0
- package/dist/resources/testserver/pool/staleness.js +27 -0
- package/dist/resources/testserver/presentation.d.ts +9 -0
- package/dist/resources/testserver/presentation.js +217 -0
- package/dist/resources/testserver/provider.d.ts +177 -0
- package/dist/resources/testserver/provider.js +254 -0
- package/dist/resources/testserver/ran.d.ts +87 -0
- package/dist/resources/testserver/ran.js +140 -0
- package/dist/resources/testserver/resource-provider.d.ts +12 -0
- package/dist/resources/testserver/resource-provider.js +38 -0
- package/dist/resources/testserver/resource.d.ts +32 -0
- package/dist/resources/testserver/resource.js +10 -0
- package/dist/resources/testserver/run-sandbox.d.ts +13 -0
- package/dist/resources/testserver/run-sandbox.js +6 -0
- package/dist/resources/testserver/sandbox/channels.d.ts +12 -0
- package/dist/resources/testserver/sandbox/channels.js +21 -0
- package/dist/resources/testserver/sandbox/create-failure.d.ts +35 -0
- package/dist/resources/testserver/sandbox/create-failure.js +65 -0
- package/dist/resources/testserver/sandbox/create.d.ts +29 -0
- package/dist/resources/testserver/sandbox/create.js +37 -0
- package/dist/resources/testserver/sandbox/gateways.d.ts +150 -0
- package/dist/resources/testserver/sandbox/gateways.js +1 -0
- package/dist/resources/testserver/sandbox/index.d.ts +6 -0
- package/dist/resources/testserver/sandbox/index.js +7 -0
- package/dist/resources/testserver/sandbox/live/builds-response.d.ts +9 -0
- package/dist/resources/testserver/sandbox/live/builds-response.js +27 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.d.ts +17 -0
- package/dist/resources/testserver/sandbox/live/control-plane-gateway.js +133 -0
- package/dist/resources/testserver/sandbox/live/create-response.d.ts +35 -0
- package/dist/resources/testserver/sandbox/live/create-response.js +78 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.d.ts +24 -0
- package/dist/resources/testserver/sandbox/live/fetch-failure.js +45 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.d.ts +11 -0
- package/dist/resources/testserver/sandbox/live/health-check-gateway.js +36 -0
- package/dist/resources/testserver/sandbox/live/sse.d.ts +12 -0
- package/dist/resources/testserver/sandbox/live/sse.js +32 -0
- package/dist/resources.d.ts +452 -0
- package/dist/resources.js +88 -0
- package/dist/runner/base.d.ts +40 -0
- package/dist/runner/base.js +52 -0
- package/dist/runner/context.d.ts +13 -0
- package/dist/runner/context.js +9 -0
- package/dist/runner/events.d.ts +179 -0
- package/dist/runner/events.js +16 -0
- package/dist/runner/gateways.d.ts +351 -0
- package/dist/runner/gateways.js +3 -0
- package/dist/runner/index.d.ts +19 -0
- package/dist/runner/index.js +18 -0
- package/dist/runner/live/checkout-gateway.d.ts +3 -0
- package/dist/runner/live/checkout-gateway.js +206 -0
- package/dist/runner/live/git-output.d.ts +14 -0
- package/dist/runner/live/git-output.js +32 -0
- package/dist/runner/live/sandbox-errors.d.ts +7 -0
- package/dist/runner/live/sandbox-errors.js +21 -0
- package/dist/runner/live/sandbox-gateway.d.ts +7 -0
- package/dist/runner/live/sandbox-gateway.js +427 -0
- package/dist/runner/live/snapshot-cache-gateway.d.ts +12 -0
- package/dist/runner/live/snapshot-cache-gateway.js +104 -0
- package/dist/runner/live/snapshot-records.d.ts +11 -0
- package/dist/runner/live/snapshot-records.js +57 -0
- package/dist/runner/live/terminal.d.ts +16 -0
- package/dist/runner/live/terminal.js +37 -0
- package/dist/runner/live/user.d.ts +2 -0
- package/dist/runner/live/user.js +11 -0
- package/dist/runner/output.d.ts +23 -0
- package/dist/runner/output.js +58 -0
- package/dist/runner/prepare.d.ts +67 -0
- package/dist/runner/prepare.js +59 -0
- package/dist/runner/ready.d.ts +68 -0
- package/dist/runner/ready.js +159 -0
- package/dist/runner/recipe.d.ts +126 -0
- package/dist/runner/recipe.js +302 -0
- package/dist/runner/remote-command.d.ts +77 -0
- package/dist/runner/remote-command.js +127 -0
- package/dist/runner/scope.d.ts +58 -0
- package/dist/runner/scope.js +117 -0
- package/dist/runner/snapshot-build.d.ts +33 -0
- package/dist/runner/snapshot-build.js +112 -0
- package/dist/runner/snapshot-cache.d.ts +84 -0
- package/dist/runner/snapshot-cache.js +126 -0
- package/dist/runner/snapshot-key.d.ts +52 -0
- package/dist/runner/snapshot-key.js +91 -0
- package/dist/runner/steps.d.ts +41 -0
- package/dist/runner/steps.js +49 -0
- package/dist/sdk/container/api-request.d.ts +32 -0
- package/dist/sdk/container/api-request.js +46 -0
- package/dist/sdk/container/container.d.ts +144 -0
- package/dist/sdk/container/container.js +346 -0
- package/dist/sdk/container/feature-flags.d.ts +37 -0
- package/dist/sdk/container/feature-flags.js +118 -0
- package/dist/sdk/container/gateways.d.ts +108 -0
- package/dist/sdk/container/gateways.js +1 -0
- package/dist/sdk/container/index.d.ts +5 -0
- package/dist/sdk/container/index.js +5 -0
- package/dist/sdk/container/live/container-gateway.d.ts +17 -0
- package/dist/sdk/container/live/container-gateway.js +114 -0
- package/dist/sdk/factories/build.d.ts +66 -0
- package/dist/sdk/factories/build.js +98 -0
- package/dist/sdk/factories/definition.d.ts +28 -0
- package/dist/sdk/factories/definition.js +16 -0
- package/dist/sdk/factories/definitions.d.ts +166 -0
- package/dist/sdk/factories/definitions.js +235 -0
- package/dist/sdk/factories/gateways.d.ts +25 -0
- package/dist/sdk/factories/gateways.js +1 -0
- package/dist/sdk/factories/index.d.ts +5 -0
- package/dist/sdk/factories/index.js +5 -0
- package/dist/sdk/factories/live/factory-gateway.d.ts +10 -0
- package/dist/sdk/factories/live/factory-gateway.js +29 -0
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.js +15 -0
- package/dist/sdk/payload/index.d.ts +2 -0
- package/dist/sdk/payload/index.js +4 -0
- package/dist/sdk/payload/payload.d.ts +47 -0
- package/dist/sdk/payload/payload.js +74 -0
- package/dist/sdk/payload/test-events.d.ts +102 -0
- package/dist/sdk/payload/test-events.js +59 -0
- package/dist/sdk/proxy/exchange.d.ts +58 -0
- package/dist/sdk/proxy/exchange.js +173 -0
- package/dist/sdk/proxy/faulted-exchange.d.ts +10 -0
- package/dist/sdk/proxy/faulted-exchange.js +106 -0
- package/dist/sdk/proxy/faults.d.ts +133 -0
- package/dist/sdk/proxy/faults.js +147 -0
- package/dist/sdk/proxy/index.d.ts +3 -0
- package/dist/sdk/proxy/index.js +3 -0
- package/dist/sdk/proxy/proxy.d.ts +93 -0
- package/dist/sdk/proxy/proxy.js +99 -0
- package/dist/sdk/proxy/records.d.ts +56 -0
- package/dist/sdk/proxy/records.js +56 -0
- package/dist/sdk/records/body.d.ts +89 -0
- package/dist/sdk/records/body.js +236 -0
- package/dist/sdk/records/index.d.ts +2 -0
- package/dist/sdk/records/index.js +4 -0
- package/dist/sdk/records/records.d.ts +49 -0
- package/dist/sdk/records/records.js +16 -0
- package/dist/sdk/seed/index.d.ts +1 -0
- package/dist/sdk/seed/index.js +3 -0
- package/dist/sdk/seed/seed.d.ts +221 -0
- package/dist/sdk/seed/seed.js +171 -0
- package/dist/sdk/testserver/clock.d.ts +8 -0
- package/dist/sdk/testserver/clock.js +10 -0
- package/dist/sdk/testserver/failure.d.ts +73 -0
- package/dist/sdk/testserver/failure.js +61 -0
- package/dist/sdk/testserver/index.d.ts +5 -0
- package/dist/sdk/testserver/index.js +8 -0
- package/dist/sdk/testserver/live/connect-failure.d.ts +7 -0
- package/dist/sdk/testserver/live/connect-failure.js +30 -0
- package/dist/sdk/testserver/live/request.d.ts +69 -0
- package/dist/sdk/testserver/live/request.js +89 -0
- package/dist/sdk/testserver/service-ids.d.ts +19 -0
- package/dist/sdk/testserver/service-ids.js +77 -0
- package/dist/sdk/testserver/test-id.d.ts +15 -0
- package/dist/sdk/testserver/test-id.js +28 -0
- package/dist/story/align.d.ts +37 -0
- package/dist/story/align.js +39 -0
- package/dist/story/artifact.d.ts +60 -0
- package/dist/story/artifact.js +93 -0
- package/dist/story/definition.d.ts +52 -0
- package/dist/story/definition.js +9 -0
- package/dist/story/diff.d.ts +9 -0
- package/dist/story/diff.js +97 -0
- package/dist/story/errors.d.ts +14 -0
- package/dist/story/errors.js +21 -0
- package/dist/story/gateways.d.ts +74 -0
- package/dist/story/gateways.js +3 -0
- package/dist/story/host.d.ts +27 -0
- package/dist/story/host.js +97 -0
- package/dist/story/index.d.ts +7 -0
- package/dist/story/index.js +9 -0
- package/dist/story/json.d.ts +16 -0
- package/dist/story/json.js +59 -0
- package/dist/story/live/artifact-gateway.d.ts +2 -0
- package/dist/story/live/artifact-gateway.js +82 -0
- package/dist/story/mode.d.ts +17 -0
- package/dist/story/mode.js +21 -0
- package/dist/story/orphans.d.ts +17 -0
- package/dist/story/orphans.js +15 -0
- package/dist/story/report.d.ts +30 -0
- package/dist/story/report.js +118 -0
- package/dist/story/run.d.ts +49 -0
- package/dist/story/run.js +160 -0
- package/dist/story/sequence.d.ts +30 -0
- package/dist/story/sequence.js +74 -0
- package/dist/story/settle.d.ts +94 -0
- package/dist/story/settle.js +70 -0
- package/dist/time/duration.d.ts +19 -0
- package/dist/time/duration.js +37 -0
- package/dist/time/index.d.ts +2 -0
- package/dist/time/index.js +4 -0
- package/dist/time/time.d.ts +15 -0
- package/dist/time/time.js +23 -0
- package/dist/vercel-cli/ansi.d.ts +13 -0
- package/dist/vercel-cli/ansi.js +32 -0
- package/dist/vercel-cli/arguments.d.ts +25 -0
- package/dist/vercel-cli/arguments.js +78 -0
- package/dist/vercel-cli/auth-config.d.ts +43 -0
- package/dist/vercel-cli/auth-config.js +36 -0
- package/dist/vercel-cli/clock.d.ts +9 -0
- package/dist/vercel-cli/clock.js +10 -0
- package/dist/vercel-cli/config-files.d.ts +24 -0
- package/dist/vercel-cli/config-files.js +40 -0
- package/dist/vercel-cli/context.d.ts +12 -0
- package/dist/vercel-cli/context.js +12 -0
- package/dist/vercel-cli/driver.d.ts +218 -0
- package/dist/vercel-cli/driver.js +364 -0
- package/dist/vercel-cli/entry.d.ts +8 -0
- package/dist/vercel-cli/entry.js +13 -0
- package/dist/vercel-cli/environment.d.ts +33 -0
- package/dist/vercel-cli/environment.js +72 -0
- package/dist/vercel-cli/errors.d.ts +8 -0
- package/dist/vercel-cli/errors.js +8 -0
- package/dist/vercel-cli/gateways.d.ts +103 -0
- package/dist/vercel-cli/gateways.js +4 -0
- package/dist/vercel-cli/index.d.ts +10 -0
- package/dist/vercel-cli/index.js +15 -0
- package/dist/vercel-cli/invocation.d.ts +234 -0
- package/dist/vercel-cli/invocation.js +397 -0
- package/dist/vercel-cli/keys.d.ts +14 -0
- package/dist/vercel-cli/keys.js +12 -0
- package/dist/vercel-cli/live/config-files.d.ts +28 -0
- package/dist/vercel-cli/live/config-files.js +66 -0
- package/dist/vercel-cli/live/process-gateway.d.ts +14 -0
- package/dist/vercel-cli/live/process-gateway.js +178 -0
- package/dist/vercel-cli/redaction.d.ts +13 -0
- package/dist/vercel-cli/redaction.js +22 -0
- package/dist/vercel-cli/report.d.ts +22 -0
- package/dist/vercel-cli/report.js +110 -0
- package/dist/vercel-cli/verbose.d.ts +7 -0
- package/dist/vercel-cli/verbose.js +24 -0
- package/dist/version.d.ts +20 -0
- package/dist/version.js +57 -0
- package/dist/vitest/config.d.ts +51 -0
- package/dist/vitest/config.js +61 -0
- package/dist/vitest/container-scope.d.ts +108 -0
- package/dist/vitest/container-scope.js +234 -0
- package/dist/vitest/diagnostics.d.ts +146 -0
- package/dist/vitest/diagnostics.js +306 -0
- package/dist/vitest/fixtures.d.ts +64 -0
- package/dist/vitest/fixtures.js +172 -0
- package/dist/vitest/gateways.d.ts +47 -0
- package/dist/vitest/gateways.js +3 -0
- package/dist/vitest/index.d.ts +3 -0
- package/dist/vitest/index.js +9 -0
- package/dist/vitest/list-output.d.ts +3 -0
- package/dist/vitest/list-output.js +19 -0
- package/dist/vitest/live/list-gateway.d.ts +7 -0
- package/dist/vitest/live/list-gateway.js +60 -0
- package/dist/vitest/ownership.d.ts +29 -0
- package/dist/vitest/ownership.js +68 -0
- package/dist/vitest/plan.d.ts +33 -0
- package/dist/vitest/plan.js +73 -0
- package/dist/vitest/sandbox.d.ts +16 -0
- package/dist/vitest/sandbox.js +35 -0
- package/dist/vitest/test-events.d.ts +41 -0
- package/dist/vitest/test-events.js +92 -0
- package/dist/vitest/test-results.d.ts +84 -0
- package/dist/vitest/test-results.js +160 -0
- package/dist/vitest/types.d.ts +68 -0
- package/dist/vitest/types.js +4 -0
- package/package.json +119 -3
- package/skills/overview.md +32 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
/** The header Testserver reads a request's test id from. */
|
|
3
|
+
export const TEST_ID_HEADER = "test-id";
|
|
4
|
+
/**
|
|
5
|
+
* The longest test id the SDK sends. Testserver never answers `PUT /_/test` for a test id of 50 characters or
|
|
6
|
+
* more (observed 2026-10-29; the cause is unknown), so the SDK refuses one before sending anything.
|
|
7
|
+
*/
|
|
8
|
+
export const MAX_TEST_ID_LENGTH = 49;
|
|
9
|
+
const TEST_ID_CHARACTERS = /^[A-Za-z0-9._-]+$/;
|
|
10
|
+
/** A caller-supplied test id was empty, too long, or held a character outside `A-Z a-z 0-9 . _ -`. */
|
|
11
|
+
export class TestIdError extends Error {
|
|
12
|
+
name = "TestIdError";
|
|
13
|
+
}
|
|
14
|
+
/** A fresh test id: `ts-` and 16 lowercase hex characters, 19 characters in all. */
|
|
15
|
+
export function generateTestId() {
|
|
16
|
+
return `ts-${randomUUID().replaceAll("-", "").slice(0, 16)}`;
|
|
17
|
+
}
|
|
18
|
+
/** Throws a `TestIdError` unless `testId` is 1 to 49 characters of `A-Z a-z 0-9 . _ -`. */
|
|
19
|
+
export function checkTestId(testId) {
|
|
20
|
+
if (testId.length === 0)
|
|
21
|
+
throw new TestIdError("a test id can't be empty");
|
|
22
|
+
if (testId.length > MAX_TEST_ID_LENGTH) {
|
|
23
|
+
throw new TestIdError(`test id ${JSON.stringify(testId)} is ${testId.length} characters; Testserver never answers for one longer than ${MAX_TEST_ID_LENGTH}`);
|
|
24
|
+
}
|
|
25
|
+
if (!TEST_ID_CHARACTERS.test(testId)) {
|
|
26
|
+
throw new TestIdError(`test id ${JSON.stringify(testId)} may hold only A-Z, a-z, 0-9, ".", "_" and "-"`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { StoryCall } from "./artifact.ts";
|
|
2
|
+
/**
|
|
3
|
+
* One place in the alignment of recorded and live calls:
|
|
4
|
+
*
|
|
5
|
+
* - `matched`: a recorded call and a live call with the same key and the same observation.
|
|
6
|
+
* - `divergence`: the same key, a different observation. The tool behaved differently.
|
|
7
|
+
* - `unrecorded`: a live call no recorded call aligns with.
|
|
8
|
+
* - `unmade`: a recorded call no live call aligns with.
|
|
9
|
+
*/
|
|
10
|
+
export type StoryAlignedCall = {
|
|
11
|
+
readonly kind: "matched";
|
|
12
|
+
readonly recorded: StoryCall;
|
|
13
|
+
readonly live: StoryCall;
|
|
14
|
+
} | {
|
|
15
|
+
readonly kind: "divergence";
|
|
16
|
+
readonly recorded: StoryCall;
|
|
17
|
+
readonly live: StoryCall;
|
|
18
|
+
} | {
|
|
19
|
+
readonly kind: "unrecorded";
|
|
20
|
+
readonly live: StoryCall;
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "unmade";
|
|
23
|
+
readonly recorded: StoryCall;
|
|
24
|
+
};
|
|
25
|
+
/** A call's key, (agent, tool, input), as one string: two calls have the same key when these are equal. */
|
|
26
|
+
export declare function callKey(call: Pick<StoryCall, "agent" | "tool" | "input">): string;
|
|
27
|
+
/**
|
|
28
|
+
* The alignment of `recorded` with `live`, in story order: a longest common subsequence of their keys, so an inserted
|
|
29
|
+
* or removed call leaves every other call aligned. Each pair the subsequence keeps is `matched` or a `divergence`, by
|
|
30
|
+
* its observations; every other recorded call is `unmade`, and every other live call `unrecorded`. Where both sides
|
|
31
|
+
* have calls the subsequence skips, the unmade ones come first, so a call whose input changed reads as one unmade
|
|
32
|
+
* call followed by one unrecorded call.
|
|
33
|
+
*
|
|
34
|
+
* Calls too many to compare (`MAX_SEQUENCE_CELLS`) are a `RangeError`, not every call unmade and unrecorded: that
|
|
35
|
+
* would hide each divergence among them as a stale entry, which `STORY_RECORD=stale` rewrites.
|
|
36
|
+
*/
|
|
37
|
+
export declare function alignCalls(recorded: readonly StoryCall[], live: readonly StoryCall[]): readonly StoryAlignedCall[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Aligning the calls a story made with the calls its artifact recorded. Pure.
|
|
2
|
+
import { canonicalJson, sameJson } from "./json.js";
|
|
3
|
+
import { diffSequences, MAX_SEQUENCE_CELLS } from "./sequence.js";
|
|
4
|
+
/** A call's key, (agent, tool, input), as one string: two calls have the same key when these are equal. */
|
|
5
|
+
export function callKey(call) {
|
|
6
|
+
return canonicalJson([call.agent, call.tool, call.input]);
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The alignment of `recorded` with `live`, in story order: a longest common subsequence of their keys, so an inserted
|
|
10
|
+
* or removed call leaves every other call aligned. Each pair the subsequence keeps is `matched` or a `divergence`, by
|
|
11
|
+
* its observations; every other recorded call is `unmade`, and every other live call `unrecorded`. Where both sides
|
|
12
|
+
* have calls the subsequence skips, the unmade ones come first, so a call whose input changed reads as one unmade
|
|
13
|
+
* call followed by one unrecorded call.
|
|
14
|
+
*
|
|
15
|
+
* Calls too many to compare (`MAX_SEQUENCE_CELLS`) are a `RangeError`, not every call unmade and unrecorded: that
|
|
16
|
+
* would hide each divergence among them as a stale entry, which `STORY_RECORD=stale` rewrites.
|
|
17
|
+
*/
|
|
18
|
+
export function alignCalls(recorded, live) {
|
|
19
|
+
const diff = diffSequences(recorded.map(callKey), live.map(callKey));
|
|
20
|
+
if (!diff.exact) {
|
|
21
|
+
throw new RangeError(`story: can't align ${recorded.length} recorded calls with ${live.length} live calls: the calls between the ` +
|
|
22
|
+
`first and the last that differ are more than ${MAX_SEQUENCE_CELLS} pairs to compare`);
|
|
23
|
+
}
|
|
24
|
+
return diff.steps.map((step) => {
|
|
25
|
+
if (step.kind === "before")
|
|
26
|
+
return { kind: "unmade", recorded: at(recorded, step.before) };
|
|
27
|
+
if (step.kind === "after")
|
|
28
|
+
return { kind: "unrecorded", live: at(live, step.after) };
|
|
29
|
+
const old = at(recorded, step.before);
|
|
30
|
+
const made = at(live, step.after);
|
|
31
|
+
return { kind: sameJson(old.observation, made.observation) ? "matched" : "divergence", recorded: old, live: made };
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function at(calls, index) {
|
|
35
|
+
const call = calls[index];
|
|
36
|
+
if (call === undefined)
|
|
37
|
+
throw new RangeError(`story: no call at ${index}`);
|
|
38
|
+
return call;
|
|
39
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type StoryJson } from "./json.ts";
|
|
2
|
+
/** The artifact format this version of story writes and reads. */
|
|
3
|
+
export declare const STORY_ARTIFACT_SCHEMA_VERSION = 1;
|
|
4
|
+
/** Which story an artifact belongs to: the story file's name (no directory) and the story's full test name. */
|
|
5
|
+
export interface StoryIdentity {
|
|
6
|
+
readonly file: string;
|
|
7
|
+
readonly name: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* One tool call: the agent, the tool, the input the tool ran with (after its schema parsed it), and what its
|
|
11
|
+
* `observe` returned. (agent, tool, input) is the call's key.
|
|
12
|
+
*/
|
|
13
|
+
export interface StoryCall {
|
|
14
|
+
readonly agent: string;
|
|
15
|
+
readonly tool: string;
|
|
16
|
+
readonly input: StoryJson;
|
|
17
|
+
readonly observation: StoryJson;
|
|
18
|
+
}
|
|
19
|
+
/** One story's artifact. */
|
|
20
|
+
export interface StoryArtifact {
|
|
21
|
+
readonly schemaVersion: typeof STORY_ARTIFACT_SCHEMA_VERSION;
|
|
22
|
+
readonly story: StoryIdentity;
|
|
23
|
+
readonly calls: readonly StoryCall[];
|
|
24
|
+
}
|
|
25
|
+
/** An artifact's text, read back: the artifact, or why it can't be one. */
|
|
26
|
+
export type ParsedStoryArtifact = {
|
|
27
|
+
readonly ok: true;
|
|
28
|
+
readonly artifact: StoryArtifact;
|
|
29
|
+
} | {
|
|
30
|
+
readonly ok: false;
|
|
31
|
+
readonly problem: string;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The directory that holds a story file's artifacts: `<story file dir>/__story__/<story file name>`
|
|
35
|
+
* (`__story__/slot-surface.story.test.ts`). Each story file has a directory of its own, so the path alone says which
|
|
36
|
+
* file owns an artifact, whatever the artifact holds.
|
|
37
|
+
*/
|
|
38
|
+
export declare function artifactDirectory(storyFile: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Where a story's artifact lives: `<artifactDirectory>/<slug>-<id8>.json`. The slug is the story's name for people,
|
|
41
|
+
* cut to 80 characters; `id8`, the first 8 hex characters of the SHA-256 of the canonical JSON of
|
|
42
|
+
* `{ file, story }` (the file's name and the story's full name), keeps two stories whose names slug alike apart.
|
|
43
|
+
*/
|
|
44
|
+
export declare function artifactPath(storyFile: string, story: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* `text` lowercased, each run of characters other than ASCII letters and digits replaced by one `-`, with no `-` at
|
|
47
|
+
* either end, cut to `max` characters; `story` when nothing is left.
|
|
48
|
+
*/
|
|
49
|
+
export declare function slugify(text: string, max: number): string;
|
|
50
|
+
/**
|
|
51
|
+
* The artifact's text: its fields in a fixed order (`schemaVersion`, `story`, `calls`, and each call's `agent`,
|
|
52
|
+
* `tool`, `input`, `observation`), each input and observation's keys sorted, indented by 2 spaces, with a trailing
|
|
53
|
+
* newline. The same artifact always gives the same bytes.
|
|
54
|
+
*/
|
|
55
|
+
export declare function serializeArtifact(artifact: StoryArtifact): string;
|
|
56
|
+
/**
|
|
57
|
+
* `text` as an artifact, or the problem: it isn't JSON, its `schemaVersion` isn't 1, or its fields don't have the
|
|
58
|
+
* artifact's shape (unknown fields included).
|
|
59
|
+
*/
|
|
60
|
+
export declare function parseArtifact(text: string): ParsedStoryArtifact;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
// A story's artifact: the tool calls one story made, each with its observation, in story order. Where it lives,
|
|
2
|
+
// how it is written and how it is read back. Pure, but for hashing with `node:crypto`.
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { basename, dirname, join } from "node:path";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { canonicalJson, sortKeys } from "./json.js";
|
|
7
|
+
/** The artifact format this version of story writes and reads. */
|
|
8
|
+
export const STORY_ARTIFACT_SCHEMA_VERSION = 1;
|
|
9
|
+
/** How much of the story's name its artifact's file name keeps. */
|
|
10
|
+
const STORY_SLUG_CHARS = 80;
|
|
11
|
+
const artifactSchema = z.strictObject({
|
|
12
|
+
schemaVersion: z.literal(STORY_ARTIFACT_SCHEMA_VERSION),
|
|
13
|
+
story: z.strictObject({ file: z.string(), name: z.string() }),
|
|
14
|
+
calls: z.array(z.strictObject({ agent: z.string(), tool: z.string(), input: z.json(), observation: z.json() })),
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* The directory that holds a story file's artifacts: `<story file dir>/__story__/<story file name>`
|
|
18
|
+
* (`__story__/slot-surface.story.test.ts`). Each story file has a directory of its own, so the path alone says which
|
|
19
|
+
* file owns an artifact, whatever the artifact holds.
|
|
20
|
+
*/
|
|
21
|
+
export function artifactDirectory(storyFile) {
|
|
22
|
+
return join(dirname(storyFile), "__story__", basename(storyFile));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Where a story's artifact lives: `<artifactDirectory>/<slug>-<id8>.json`. The slug is the story's name for people,
|
|
26
|
+
* cut to 80 characters; `id8`, the first 8 hex characters of the SHA-256 of the canonical JSON of
|
|
27
|
+
* `{ file, story }` (the file's name and the story's full name), keeps two stories whose names slug alike apart.
|
|
28
|
+
*/
|
|
29
|
+
export function artifactPath(storyFile, story) {
|
|
30
|
+
const id = createHash("sha256")
|
|
31
|
+
.update(canonicalJson({ file: basename(storyFile), story }))
|
|
32
|
+
.digest("hex")
|
|
33
|
+
.slice(0, 8);
|
|
34
|
+
return join(artifactDirectory(storyFile), `${slugify(story, STORY_SLUG_CHARS)}-${id}.json`);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* `text` lowercased, each run of characters other than ASCII letters and digits replaced by one `-`, with no `-` at
|
|
38
|
+
* either end, cut to `max` characters; `story` when nothing is left.
|
|
39
|
+
*/
|
|
40
|
+
export function slugify(text, max) {
|
|
41
|
+
const slug = text
|
|
42
|
+
.toLowerCase()
|
|
43
|
+
.replaceAll(/[^a-z0-9]+/g, "-")
|
|
44
|
+
.replaceAll(/^-+|-+$/g, "")
|
|
45
|
+
.slice(0, max)
|
|
46
|
+
.replace(/-+$/, "");
|
|
47
|
+
return slug === "" ? "story" : slug;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* The artifact's text: its fields in a fixed order (`schemaVersion`, `story`, `calls`, and each call's `agent`,
|
|
51
|
+
* `tool`, `input`, `observation`), each input and observation's keys sorted, indented by 2 spaces, with a trailing
|
|
52
|
+
* newline. The same artifact always gives the same bytes.
|
|
53
|
+
*/
|
|
54
|
+
export function serializeArtifact(artifact) {
|
|
55
|
+
const ordered = {
|
|
56
|
+
schemaVersion: artifact.schemaVersion,
|
|
57
|
+
story: { file: artifact.story.file, name: artifact.story.name },
|
|
58
|
+
calls: artifact.calls.map((call) => ({
|
|
59
|
+
agent: call.agent,
|
|
60
|
+
tool: call.tool,
|
|
61
|
+
input: sortKeys(call.input),
|
|
62
|
+
observation: sortKeys(call.observation),
|
|
63
|
+
})),
|
|
64
|
+
};
|
|
65
|
+
return `${JSON.stringify(ordered, null, 2)}\n`;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* `text` as an artifact, or the problem: it isn't JSON, its `schemaVersion` isn't 1, or its fields don't have the
|
|
69
|
+
* artifact's shape (unknown fields included).
|
|
70
|
+
*/
|
|
71
|
+
export function parseArtifact(text) {
|
|
72
|
+
let value;
|
|
73
|
+
try {
|
|
74
|
+
value = JSON.parse(text);
|
|
75
|
+
}
|
|
76
|
+
catch (error) {
|
|
77
|
+
return { ok: false, problem: `not JSON: ${error.message}` };
|
|
78
|
+
}
|
|
79
|
+
const version = typeof value === "object" && value !== null ? value.schemaVersion : undefined;
|
|
80
|
+
if (version !== STORY_ARTIFACT_SCHEMA_VERSION) {
|
|
81
|
+
return {
|
|
82
|
+
ok: false,
|
|
83
|
+
problem: `schemaVersion is ${JSON.stringify(version) ?? "missing"}, and this story reads ${STORY_ARTIFACT_SCHEMA_VERSION}`,
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
const parsed = artifactSchema.safeParse(value);
|
|
87
|
+
if (!parsed.success) {
|
|
88
|
+
const issue = parsed.error.issues[0];
|
|
89
|
+
const where = issue === undefined || issue.path.length === 0 ? "the artifact" : issue.path.join(".");
|
|
90
|
+
return { ok: false, problem: `${where}: ${issue?.message ?? "not an artifact"}` };
|
|
91
|
+
}
|
|
92
|
+
return { ok: true, artifact: parsed.data };
|
|
93
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
import type { StoryJson } from "./json.ts";
|
|
3
|
+
/** One story's session: what the tools run against. Story calls `close()` once the story ends, pass or fail. */
|
|
4
|
+
export interface StorySession {
|
|
5
|
+
close(): void | Promise<void>;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* A tool an agent calls: `input`, the schema its input must match; `run`, which does the work against the story's
|
|
9
|
+
* session with the parsed input and returns a result; and `observe`, the JSON story records and compares for that
|
|
10
|
+
* result. The story gets the result itself; only the observation reaches the artifact. `run` and `observe` are
|
|
11
|
+
* methods, so a tool of any input and result fits an agent's `tools` map (`AnyStoryTool`).
|
|
12
|
+
*/
|
|
13
|
+
export interface StoryTool<Session, Schema extends z.ZodType, Result> {
|
|
14
|
+
readonly input: Schema;
|
|
15
|
+
run(session: Session, input: z.output<Schema>): Result | Promise<Result>;
|
|
16
|
+
observe(result: Result): StoryJson;
|
|
17
|
+
}
|
|
18
|
+
/** A tool with any input and result, as an agent's `tools` map holds it. */
|
|
19
|
+
export type AnyStoryTool<Session> = StoryTool<Session, z.ZodType, unknown>;
|
|
20
|
+
/** An agent: a name in the harness's `agents`, and the tools it may call. */
|
|
21
|
+
export interface StoryAgent<Session> {
|
|
22
|
+
readonly tools: {
|
|
23
|
+
readonly [tool: string]: AnyStoryTool<Session>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
/** The agents a harness declares, by name. */
|
|
27
|
+
export type StoryAgents<Session> = {
|
|
28
|
+
readonly [agent: string]: StoryAgent<Session>;
|
|
29
|
+
};
|
|
30
|
+
/** What `createStory` takes. */
|
|
31
|
+
export interface StoryHarness<Session extends StorySession, Agents extends StoryAgents<Session>> {
|
|
32
|
+
/** Starts the story's session, at its first tool call. A story that calls no tool starts none. */
|
|
33
|
+
readonly start: () => Session | Promise<Session>;
|
|
34
|
+
readonly agents: Agents;
|
|
35
|
+
}
|
|
36
|
+
/** How a story calls one tool: with the tool's input, resolving with its result. */
|
|
37
|
+
export type StoryToolCall<Tool> = Tool extends StoryTool<infer _Session, infer Schema, infer Result> ? (input: z.input<Schema>) => Promise<Result> : never;
|
|
38
|
+
/** What a story's body gets: one handle per agent, each with a function per tool. */
|
|
39
|
+
export type StoryHandles<Agents> = {
|
|
40
|
+
readonly [Agent in keyof Agents]: {
|
|
41
|
+
readonly tools: Agents[Agent] extends {
|
|
42
|
+
readonly tools: infer Tools;
|
|
43
|
+
} ? {
|
|
44
|
+
readonly [Tool in keyof Tools]: StoryToolCall<Tools[Tool]>;
|
|
45
|
+
} : never;
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* `tool`, typed: TypeScript infers its input from `input`, its session from `run`'s first parameter, and its result
|
|
50
|
+
* from what `run` returns, so `run` and `observe` need no other annotation. Annotate `run`'s session parameter.
|
|
51
|
+
*/
|
|
52
|
+
export declare function storyTool<Session, Schema extends z.ZodType, Result>(tool: StoryTool<Session, Schema, Result>): StoryTool<Session, Schema, Result>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// What a story harness declares: how to start a session, and the agents with their tools. Types only, but for
|
|
2
|
+
// `storyTool`, which returns its argument.
|
|
3
|
+
/**
|
|
4
|
+
* `tool`, typed: TypeScript infers its input from `input`, its session from `run`'s first parameter, and its result
|
|
5
|
+
* from what `run` returns, so `run` and `observe` need no other annotation. Annotate `run`'s session parameter.
|
|
6
|
+
*/
|
|
7
|
+
export function storyTool(tool) {
|
|
8
|
+
return tool;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type StoryJson } from "./json.ts";
|
|
2
|
+
/**
|
|
3
|
+
* The lines that say how `after` differs from `before`, `[]` when they are equal. Each place that differs is named by
|
|
4
|
+
* its path (`stdout`, `result.slots[0]`, or `(observation)` for the whole value). Two strings get a line diff under
|
|
5
|
+
* their path: `-` for a line only `before` has, `+` for one only `after` has, two spaces for one both have, two
|
|
6
|
+
* unchanged lines around each change and `…` where unchanged lines are skipped. Any other value that differs is one
|
|
7
|
+
* line, `<path>: <before> → <after>`, as compact JSON, `absent` for a field one side lacks.
|
|
8
|
+
*/
|
|
9
|
+
export declare function describeObservationDiff(before: StoryJson, after: StoryJson): readonly string[];
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// How a divergence's observation changed, in lines a person reads. Pure.
|
|
2
|
+
import { sameJson } from "./json.js";
|
|
3
|
+
import { diffSequences } from "./sequence.js";
|
|
4
|
+
/** How many unchanged lines a line diff keeps around each change. */
|
|
5
|
+
const CONTEXT_LINES = 2;
|
|
6
|
+
/** The widest a changed value's JSON may be before it is cut. */
|
|
7
|
+
const VALUE_CHARS = 200;
|
|
8
|
+
/**
|
|
9
|
+
* The lines that say how `after` differs from `before`, `[]` when they are equal. Each place that differs is named by
|
|
10
|
+
* its path (`stdout`, `result.slots[0]`, or `(observation)` for the whole value). Two strings get a line diff under
|
|
11
|
+
* their path: `-` for a line only `before` has, `+` for one only `after` has, two spaces for one both have, two
|
|
12
|
+
* unchanged lines around each change and `…` where unchanged lines are skipped. Any other value that differs is one
|
|
13
|
+
* line, `<path>: <before> → <after>`, as compact JSON, `absent` for a field one side lacks.
|
|
14
|
+
*/
|
|
15
|
+
export function describeObservationDiff(before, after) {
|
|
16
|
+
const lines = [];
|
|
17
|
+
walk(before, after, [], lines);
|
|
18
|
+
return lines;
|
|
19
|
+
}
|
|
20
|
+
function walk(before, after, path, lines) {
|
|
21
|
+
if (before !== undefined && after !== undefined && sameJson(before, after))
|
|
22
|
+
return;
|
|
23
|
+
const name = pathName(path);
|
|
24
|
+
if (typeof before === "string" && typeof after === "string") {
|
|
25
|
+
lines.push(`${name}:`);
|
|
26
|
+
for (const line of lineDiff(before.split("\n"), after.split("\n")))
|
|
27
|
+
lines.push(line === " " ? "" : ` ${line}`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(before) && Array.isArray(after)) {
|
|
31
|
+
const left = before;
|
|
32
|
+
const right = after;
|
|
33
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
34
|
+
walk(left[index], right[index], [...path, index], lines);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (isObject(before) && isObject(after)) {
|
|
39
|
+
const keys = [...Object.keys(before), ...Object.keys(after).filter((key) => !Object.hasOwn(before, key))];
|
|
40
|
+
for (const key of keys)
|
|
41
|
+
walk(before[key], after[key], [...path, key], lines);
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
lines.push(`${name}: ${valueText(before)} → ${valueText(after)}`);
|
|
45
|
+
}
|
|
46
|
+
function isObject(value) {
|
|
47
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
48
|
+
}
|
|
49
|
+
/** `stdout`, `result.slots[0]`, `[1]`, or `(observation)` for the whole value. */
|
|
50
|
+
function pathName(path) {
|
|
51
|
+
if (path.length === 0)
|
|
52
|
+
return "(observation)";
|
|
53
|
+
let name = "";
|
|
54
|
+
for (const part of path)
|
|
55
|
+
name += typeof part === "number" ? `[${part}]` : name === "" ? part : `.${part}`;
|
|
56
|
+
return name;
|
|
57
|
+
}
|
|
58
|
+
function valueText(value) {
|
|
59
|
+
if (value === undefined)
|
|
60
|
+
return "absent";
|
|
61
|
+
const text = JSON.stringify(value);
|
|
62
|
+
return text.length > VALUE_CHARS ? `${text.slice(0, VALUE_CHARS - 1)}…` : text;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* A line diff of `before` and `after`, cut to each change and `CONTEXT_LINES` around it, `…` for each gap. Two texts
|
|
66
|
+
* too long to compare (`diffSequences`) show every line between their first and last change as removed and added.
|
|
67
|
+
*/
|
|
68
|
+
function lineDiff(before, after) {
|
|
69
|
+
const marked = diffSequences(before, after).steps.map((step) => step.kind === "both"
|
|
70
|
+
? { mark: " ", text: before[step.before] ?? "" }
|
|
71
|
+
: step.kind === "before"
|
|
72
|
+
? { mark: "-", text: before[step.before] ?? "" }
|
|
73
|
+
: { mark: "+", text: after[step.after] ?? "" });
|
|
74
|
+
const keep = marked.map(() => false);
|
|
75
|
+
marked.forEach((line, index) => {
|
|
76
|
+
if (line.mark === " ")
|
|
77
|
+
return;
|
|
78
|
+
for (let near = Math.max(0, index - CONTEXT_LINES); near <= Math.min(marked.length - 1, index + CONTEXT_LINES); near += 1) {
|
|
79
|
+
keep[near] = true;
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
const out = [];
|
|
83
|
+
let skipped = false;
|
|
84
|
+
marked.forEach((line, index) => {
|
|
85
|
+
if (!keep[index]) {
|
|
86
|
+
skipped = true;
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
if (skipped)
|
|
90
|
+
out.push("…");
|
|
91
|
+
skipped = false;
|
|
92
|
+
out.push(line.text === "" ? line.mark : `${line.mark} ${line.text}`);
|
|
93
|
+
});
|
|
94
|
+
if (skipped)
|
|
95
|
+
out.push("…");
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { StoryDivergence, StoryStaleEntry } from "./settle.ts";
|
|
2
|
+
/** A story made a call whose observation differs from the recorded one: the tool behaved differently. */
|
|
3
|
+
export declare class StoryDivergenceError extends Error {
|
|
4
|
+
readonly name = "StoryDivergenceError";
|
|
5
|
+
readonly divergences: readonly StoryDivergence[];
|
|
6
|
+
readonly stale: readonly StoryStaleEntry[];
|
|
7
|
+
constructor(report: string, divergences: readonly StoryDivergence[], stale: readonly StoryStaleEntry[]);
|
|
8
|
+
}
|
|
9
|
+
/** A story's recording no longer fits it, and `STORY_RECORD=none` may not change it. */
|
|
10
|
+
export declare class StoryStaleError extends Error {
|
|
11
|
+
readonly name = "StoryStaleError";
|
|
12
|
+
readonly stale: readonly StoryStaleEntry[];
|
|
13
|
+
constructor(report: string, stale: readonly StoryStaleEntry[]);
|
|
14
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// The errors a story fails with when its body passed but its calls don't fit its artifact.
|
|
2
|
+
/** A story made a call whose observation differs from the recorded one: the tool behaved differently. */
|
|
3
|
+
export class StoryDivergenceError extends Error {
|
|
4
|
+
name = "StoryDivergenceError";
|
|
5
|
+
divergences;
|
|
6
|
+
stale;
|
|
7
|
+
constructor(report, divergences, stale) {
|
|
8
|
+
super(report);
|
|
9
|
+
this.divergences = divergences;
|
|
10
|
+
this.stale = stale;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
/** A story's recording no longer fits it, and `STORY_RECORD=none` may not change it. */
|
|
14
|
+
export class StoryStaleError extends Error {
|
|
15
|
+
name = "StoryStaleError";
|
|
16
|
+
stale;
|
|
17
|
+
constructor(report, stale) {
|
|
18
|
+
super(report);
|
|
19
|
+
this.stale = stale;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { StoryArtifact } from "./artifact.ts";
|
|
2
|
+
/** An artifact, read: found, missing, unreadable (not an artifact, with why), or a read that failed. */
|
|
3
|
+
export type StoryArtifactRead = {
|
|
4
|
+
readonly kind: "found";
|
|
5
|
+
readonly artifact: StoryArtifact;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: "missing";
|
|
8
|
+
} | {
|
|
9
|
+
readonly kind: "unreadable";
|
|
10
|
+
readonly problem: string;
|
|
11
|
+
} | {
|
|
12
|
+
readonly kind: "failed";
|
|
13
|
+
readonly message: string;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* An artifact, written: written, unchanged (its bytes were already there, so nothing was written), canceled (the
|
|
17
|
+
* signal aborted first, so nothing was written), or failed.
|
|
18
|
+
*/
|
|
19
|
+
export type StoryArtifactWrite = {
|
|
20
|
+
readonly kind: "written";
|
|
21
|
+
} | {
|
|
22
|
+
readonly kind: "unchanged";
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: "canceled";
|
|
25
|
+
} | {
|
|
26
|
+
readonly kind: "failed";
|
|
27
|
+
readonly message: string;
|
|
28
|
+
};
|
|
29
|
+
/** An artifact, removed: removed, missing (nothing was there), canceled (the signal aborted first), or failed. */
|
|
30
|
+
export type StoryArtifactRemove = {
|
|
31
|
+
readonly kind: "removed";
|
|
32
|
+
} | {
|
|
33
|
+
readonly kind: "missing";
|
|
34
|
+
} | {
|
|
35
|
+
readonly kind: "canceled";
|
|
36
|
+
} | {
|
|
37
|
+
readonly kind: "failed";
|
|
38
|
+
readonly message: string;
|
|
39
|
+
};
|
|
40
|
+
/** The artifacts in one story file's artifact directory, by absolute path, sorted; none when it doesn't exist. */
|
|
41
|
+
export type StoryArtifactList = {
|
|
42
|
+
readonly kind: "listed";
|
|
43
|
+
readonly paths: readonly string[];
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: "failed";
|
|
46
|
+
readonly message: string;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Where story artifacts live: one per story, by absolute path. A write or a removal given an aborted `signal` changes
|
|
50
|
+
* nothing and returns `canceled`; the signal is checked again just before the change is made, so one that aborts
|
|
51
|
+
* while the method waits still stops it.
|
|
52
|
+
*/
|
|
53
|
+
export interface StoryArtifactGateway {
|
|
54
|
+
readArtifact(request: {
|
|
55
|
+
readonly path: string;
|
|
56
|
+
}): Promise<StoryArtifactRead>;
|
|
57
|
+
/**
|
|
58
|
+
* Writes `artifact` at `path` as `serializeArtifact` gives it, making missing directories, unless those bytes are
|
|
59
|
+
* already there. A reader never sees half an artifact.
|
|
60
|
+
*/
|
|
61
|
+
writeArtifact(request: {
|
|
62
|
+
readonly path: string;
|
|
63
|
+
readonly artifact: StoryArtifact;
|
|
64
|
+
readonly signal?: AbortSignal;
|
|
65
|
+
}): Promise<StoryArtifactWrite>;
|
|
66
|
+
removeArtifact(request: {
|
|
67
|
+
readonly path: string;
|
|
68
|
+
readonly signal?: AbortSignal;
|
|
69
|
+
}): Promise<StoryArtifactRemove>;
|
|
70
|
+
/** The `.json` files directly in `directory`. */
|
|
71
|
+
listArtifacts(request: {
|
|
72
|
+
readonly directory: string;
|
|
73
|
+
}): Promise<StoryArtifactList>;
|
|
74
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { StoryAgents, StoryHandles, StoryHarness, StorySession } from "./definition.ts";
|
|
2
|
+
declare module "vitest" {
|
|
3
|
+
interface TaskMeta {
|
|
4
|
+
/** Set on every test `story()` declares, so a story's end can find its file's other stories. */
|
|
5
|
+
story?: true;
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/** What `createStory` takes beside the harness. */
|
|
9
|
+
export interface StoryHostOptions {
|
|
10
|
+
/** Each story's timeout; default the Vitest project's `testTimeout`. */
|
|
11
|
+
readonly timeout?: number;
|
|
12
|
+
/** Where `STORY_RECORD` and `CI` come from; default `process.env`. */
|
|
13
|
+
readonly env?: Readonly<Record<string, string | undefined>>;
|
|
14
|
+
}
|
|
15
|
+
/** Declares one story, a Vitest test named `name`, whose body gets one handle per agent. */
|
|
16
|
+
export type StoryFunction<Agents> = (name: string, body: (agents: StoryHandles<Agents>) => Promise<void>) => void;
|
|
17
|
+
/**
|
|
18
|
+
* The `story` function for `harness`. A story's name is its full test name, its `describe` names first; its artifact
|
|
19
|
+
* is `artifactPath(<story file>, <name>)`. When the story ends, each call becomes a Vitest annotation of type `story`
|
|
20
|
+
* (`storyEventLines`), and a line saying what it changed goes to stderr too. A story whose body threw prints its
|
|
21
|
+
* report on stderr, when there is one, and fails with its body's error; one that diverged or went stale fails with
|
|
22
|
+
* the report as the error. A story Vitest stops (a timeout, or a canceled run) ends then, without waiting for its body,
|
|
23
|
+
* and counts as one whose body threw: its session closes, and it writes nothing and removes no orphans, even when its
|
|
24
|
+
* body returns later or the stop comes while its end is changing the artifact. When every story in the file runs (no
|
|
25
|
+
* test name filter, `.only` or `.skip` left one out), the last to end also finds the file's orphans.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createStory<Session extends StorySession, Agents extends StoryAgents<Session>>(harness: StoryHarness<Session, Agents>, options?: StoryHostOptions): StoryFunction<Agents>;
|