@cnc-tools/storm 0.0.0-stage → 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 +123 -4
- package/skills/overview.md +32 -0
- package/skills/read-run-output.md +65 -0
- package/README.md +0 -3
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// `story()` on Vitest: the one file in `src/story/` that imports vitest. Each story is a Vitest test whose artifact
|
|
2
|
+
// sits beside its file, and runs over the live artifact gateway.
|
|
3
|
+
import { basename } from "node:path";
|
|
4
|
+
import { test } from "vitest";
|
|
5
|
+
import { artifactPath } from "./artifact.js";
|
|
6
|
+
import { liveStoryArtifactGateway } from "./live/artifact-gateway.js";
|
|
7
|
+
import { resolveStoryRecordLevel } from "./mode.js";
|
|
8
|
+
import { findOrphans } from "./orphans.js";
|
|
9
|
+
import { startStoryRun } from "./run.js";
|
|
10
|
+
/** The test ids of the stories that ended, by story file, for finding each file's last story. */
|
|
11
|
+
const endedStories = new Map();
|
|
12
|
+
/**
|
|
13
|
+
* The `story` function for `harness`. A story's name is its full test name, its `describe` names first; its artifact
|
|
14
|
+
* is `artifactPath(<story file>, <name>)`. When the story ends, each call becomes a Vitest annotation of type `story`
|
|
15
|
+
* (`storyEventLines`), and a line saying what it changed goes to stderr too. A story whose body threw prints its
|
|
16
|
+
* report on stderr, when there is one, and fails with its body's error; one that diverged or went stale fails with
|
|
17
|
+
* the report as the error. A story Vitest stops (a timeout, or a canceled run) ends then, without waiting for its body,
|
|
18
|
+
* and counts as one whose body threw: its session closes, and it writes nothing and removes no orphans, even when its
|
|
19
|
+
* body returns later or the stop comes while its end is changing the artifact. When every story in the file runs (no
|
|
20
|
+
* test name filter, `.only` or `.skip` left one out), the last to end also finds the file's orphans.
|
|
21
|
+
*/
|
|
22
|
+
export function createStory(harness, options = {}) {
|
|
23
|
+
return (name, body) => {
|
|
24
|
+
test(name, { meta: { story: true }, ...(options.timeout === undefined ? {} : { timeout: options.timeout }) }, async (context) => {
|
|
25
|
+
const file = context.task.file.filepath;
|
|
26
|
+
const story = { file: basename(file), name: context.task.fullTestName };
|
|
27
|
+
const level = resolveStoryRecordLevel(options.env ?? process.env);
|
|
28
|
+
const run = startStoryRun(harness, { story, path: artifactPath(file, story.name), level, signal: context.signal }, liveStoryArtifactGateway);
|
|
29
|
+
const ended = await bodyEnd(() => body(run.handles), context.signal);
|
|
30
|
+
const orphans = await fileOrphans(context);
|
|
31
|
+
const end = await run.finish({
|
|
32
|
+
bodyPassed: ended.passed,
|
|
33
|
+
orphans: orphans.kind === "found" ? orphans.paths : [],
|
|
34
|
+
});
|
|
35
|
+
const annotations = end.events.map((line) => context.annotate(line, "story"));
|
|
36
|
+
if (end.changeLine !== undefined) {
|
|
37
|
+
console.error(end.changeLine);
|
|
38
|
+
annotations.push(context.annotate(end.changeLine, "story"));
|
|
39
|
+
}
|
|
40
|
+
await Promise.all(annotations);
|
|
41
|
+
if (!ended.passed) {
|
|
42
|
+
if (end.report !== undefined)
|
|
43
|
+
console.error(end.report);
|
|
44
|
+
if (end.error !== undefined)
|
|
45
|
+
console.error(end.error.message);
|
|
46
|
+
throw ended.error;
|
|
47
|
+
}
|
|
48
|
+
if (end.error !== undefined)
|
|
49
|
+
throw end.error;
|
|
50
|
+
if (orphans.kind === "failed")
|
|
51
|
+
throw new Error(`story: couldn't look for orphans: ${orphans.message}`);
|
|
52
|
+
});
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Runs `body` until it settles or `signal` aborts, whichever comes first. Vitest aborts the signal when it times the
|
|
57
|
+
* story out or cancels the run, and has already failed the test by then, so a stopped body has not passed, even if it
|
|
58
|
+
* returns later. A body still running then keeps running: nothing can stop it, but the story ends without it, so its
|
|
59
|
+
* session closes, and any tool it calls after that throws.
|
|
60
|
+
*/
|
|
61
|
+
function bodyEnd(body, signal) {
|
|
62
|
+
const stopped = () => ({
|
|
63
|
+
passed: false,
|
|
64
|
+
error: signal.reason ?? new Error("story: Vitest stopped the story before its body returned"),
|
|
65
|
+
});
|
|
66
|
+
if (signal.aborted)
|
|
67
|
+
return Promise.resolve(stopped());
|
|
68
|
+
return new Promise((resolve) => {
|
|
69
|
+
const onAbort = () => resolve(stopped());
|
|
70
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
71
|
+
const settle = (end) => {
|
|
72
|
+
signal.removeEventListener("abort", onAbort);
|
|
73
|
+
resolve(signal.aborted ? stopped() : end);
|
|
74
|
+
};
|
|
75
|
+
Promise.resolve()
|
|
76
|
+
.then(body)
|
|
77
|
+
.then(() => settle({ passed: true }), (error) => settle({ passed: false, error }));
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The orphans of the running story's file, found only by the last of its stories to end, and only when every story
|
|
82
|
+
* in the file runs; none otherwise. Records that this story ended.
|
|
83
|
+
*/
|
|
84
|
+
async function fileOrphans(context) {
|
|
85
|
+
const file = context.task.file;
|
|
86
|
+
const ended = endedStories.get(file.filepath) ?? new Set();
|
|
87
|
+
endedStories.set(file.filepath, ended);
|
|
88
|
+
ended.add(context.task.id);
|
|
89
|
+
const stories = storyTests(file.tasks);
|
|
90
|
+
if (!stories.every((each) => each.mode === "run" && ended.has(each.id)))
|
|
91
|
+
return { kind: "found", paths: [] };
|
|
92
|
+
return findOrphans({ storyFile: file.filepath, expected: stories.map((each) => artifactPath(file.filepath, each.fullTestName)) }, liveStoryArtifactGateway);
|
|
93
|
+
}
|
|
94
|
+
/** Every test `story()` declared among `tasks`, in suites too. */
|
|
95
|
+
function storyTests(tasks) {
|
|
96
|
+
return tasks.flatMap((task) => task.type === "suite" ? storyTests(task.tasks) : task.meta.story === true ? [task] : []);
|
|
97
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { artifactDirectory, artifactPath, parseArtifact, type ParsedStoryArtifact, STORY_ARTIFACT_SCHEMA_VERSION, type StoryArtifact, type StoryCall, type StoryIdentity, } from "./artifact.ts";
|
|
2
|
+
export { type AnyStoryTool, type StoryAgent, type StoryAgents, type StoryHandles, type StoryHarness, type StorySession, type StoryTool, type StoryToolCall, storyTool, } from "./definition.ts";
|
|
3
|
+
export { StoryDivergenceError, StoryStaleError } from "./errors.ts";
|
|
4
|
+
export { createStory, type StoryFunction, type StoryHostOptions } from "./host.ts";
|
|
5
|
+
export type { StoryJson } from "./json.ts";
|
|
6
|
+
export { STORY_RECORD_VARIABLE, type StoryRecordLevel } from "./mode.ts";
|
|
7
|
+
export type { StoryDivergence, StoryStaleEntry } from "./settle.ts";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// story, exported as `@cnc-tools/storm/story`: stories whose agents call tools, each call's observation recorded in
|
|
2
|
+
// an artifact beside the story file and compared on every run. `README.md` beside this file is its design and
|
|
3
|
+
// authoring guide. It depends only on Node builtins, `zod`, and `vitest` (an optional peer dependency of
|
|
4
|
+
// `@cnc-tools/storm`), and on nothing else in storm; `.oxlintrc.json` checks the boundary.
|
|
5
|
+
export { artifactDirectory, artifactPath, parseArtifact, STORY_ARTIFACT_SCHEMA_VERSION, } from "./artifact.js";
|
|
6
|
+
export { storyTool, } from "./definition.js";
|
|
7
|
+
export { StoryDivergenceError, StoryStaleError } from "./errors.js";
|
|
8
|
+
export { createStory } from "./host.js";
|
|
9
|
+
export { STORY_RECORD_VARIABLE } from "./mode.js";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** A JSON value, as a story artifact holds it. */
|
|
2
|
+
export type StoryJson = null | boolean | number | string | readonly StoryJson[] | {
|
|
3
|
+
readonly [key: string]: StoryJson;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* `value` as `StoryJson`, a copy, or a `TypeError` that says `what` and why `value` isn't JSON: a function, a
|
|
7
|
+
* `bigint`, a symbol, `undefined` (in an array, or as the whole value), a number that isn't finite, an object that
|
|
8
|
+
* isn't plain, or a cycle. An object's `undefined` fields are dropped, as `JSON.stringify` drops them.
|
|
9
|
+
*/
|
|
10
|
+
export declare function toStoryJson(value: unknown, what: string): StoryJson;
|
|
11
|
+
/** `value` as compact JSON with every object's keys sorted: the same text for the same value. */
|
|
12
|
+
export declare function canonicalJson(value: StoryJson): string;
|
|
13
|
+
/** Whether two JSON values are equal, whatever their objects' key order. */
|
|
14
|
+
export declare function sameJson(left: StoryJson, right: StoryJson): boolean;
|
|
15
|
+
/** `value` with every object's keys sorted, so `JSON.stringify` writes it the same way each time. */
|
|
16
|
+
export declare function sortKeys(value: StoryJson): StoryJson;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// The JSON a story artifact holds: tool inputs and observations. Pure.
|
|
2
|
+
/**
|
|
3
|
+
* `value` as `StoryJson`, a copy, or a `TypeError` that says `what` and why `value` isn't JSON: a function, a
|
|
4
|
+
* `bigint`, a symbol, `undefined` (in an array, or as the whole value), a number that isn't finite, an object that
|
|
5
|
+
* isn't plain, or a cycle. An object's `undefined` fields are dropped, as `JSON.stringify` drops them.
|
|
6
|
+
*/
|
|
7
|
+
export function toStoryJson(value, what) {
|
|
8
|
+
const problem = jsonProblem(value, new Set());
|
|
9
|
+
if (problem !== undefined)
|
|
10
|
+
throw new TypeError(`story: ${what}, but ${problem}`);
|
|
11
|
+
return JSON.parse(JSON.stringify(value));
|
|
12
|
+
}
|
|
13
|
+
/** `value` as compact JSON with every object's keys sorted: the same text for the same value. */
|
|
14
|
+
export function canonicalJson(value) {
|
|
15
|
+
return JSON.stringify(sortKeys(value));
|
|
16
|
+
}
|
|
17
|
+
/** Whether two JSON values are equal, whatever their objects' key order. */
|
|
18
|
+
export function sameJson(left, right) {
|
|
19
|
+
return canonicalJson(left) === canonicalJson(right);
|
|
20
|
+
}
|
|
21
|
+
/** `value` with every object's keys sorted, so `JSON.stringify` writes it the same way each time. */
|
|
22
|
+
export function sortKeys(value) {
|
|
23
|
+
if (Array.isArray(value))
|
|
24
|
+
return value.map(sortKeys);
|
|
25
|
+
if (typeof value === "object" && value !== null) {
|
|
26
|
+
return Object.fromEntries(Object.keys(value)
|
|
27
|
+
.toSorted()
|
|
28
|
+
.map((key) => [key, sortKeys(value[key] ?? null)]));
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
/** Why `value` isn't JSON a story artifact can hold, or `undefined` when it is. */
|
|
33
|
+
function jsonProblem(value, seen) {
|
|
34
|
+
if (value === null || typeof value === "string" || typeof value === "boolean")
|
|
35
|
+
return undefined;
|
|
36
|
+
if (typeof value === "number")
|
|
37
|
+
return Number.isFinite(value) ? undefined : `${value} isn't JSON`;
|
|
38
|
+
if (value === undefined)
|
|
39
|
+
return "undefined isn't JSON";
|
|
40
|
+
if (typeof value !== "object")
|
|
41
|
+
return `a ${typeof value} isn't JSON`;
|
|
42
|
+
if (seen.has(value))
|
|
43
|
+
return "a cycle isn't JSON";
|
|
44
|
+
const prototype = Object.getPrototypeOf(value);
|
|
45
|
+
if (!Array.isArray(value) && prototype !== Object.prototype && prototype !== null) {
|
|
46
|
+
return "an object that isn't plain isn't JSON";
|
|
47
|
+
}
|
|
48
|
+
seen.add(value);
|
|
49
|
+
const children = Array.isArray(value) ? value : Object.values(value);
|
|
50
|
+
for (const child of children) {
|
|
51
|
+
if (child === undefined && !Array.isArray(value))
|
|
52
|
+
continue;
|
|
53
|
+
const problem = jsonProblem(child, seen);
|
|
54
|
+
if (problem !== undefined)
|
|
55
|
+
return problem;
|
|
56
|
+
}
|
|
57
|
+
seen.delete(value);
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// The live artifact gateway: one JSON file per story on disk. A write goes to a temporary file beside the artifact
|
|
2
|
+
// and is renamed into place, so a reader never sees half an artifact. A write or removal checks its signal before it
|
|
3
|
+
// starts and again just before the rename or `rm` that makes the change.
|
|
4
|
+
import { randomBytes } from "node:crypto";
|
|
5
|
+
import { mkdir, readdir, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import { parseArtifact, serializeArtifact } from "../artifact.js";
|
|
8
|
+
export const liveStoryArtifactGateway = {
|
|
9
|
+
async readArtifact({ path }) {
|
|
10
|
+
let text;
|
|
11
|
+
try {
|
|
12
|
+
text = await readFile(path, "utf8");
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
return codeOf(error) === "ENOENT" ? { kind: "missing" } : { kind: "failed", message: messageOf(error) };
|
|
16
|
+
}
|
|
17
|
+
const parsed = parseArtifact(text);
|
|
18
|
+
return parsed.ok ? { kind: "found", artifact: parsed.artifact } : { kind: "unreadable", problem: parsed.problem };
|
|
19
|
+
},
|
|
20
|
+
async writeArtifact({ path, artifact, signal }) {
|
|
21
|
+
if (aborted(signal))
|
|
22
|
+
return { kind: "canceled" };
|
|
23
|
+
const text = serializeArtifact(artifact);
|
|
24
|
+
try {
|
|
25
|
+
if ((await readFile(path, "utf8")) === text)
|
|
26
|
+
return { kind: "unchanged" };
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (codeOf(error) !== "ENOENT")
|
|
30
|
+
return { kind: "failed", message: messageOf(error) };
|
|
31
|
+
}
|
|
32
|
+
const temporary = `${path}.${randomBytes(4).toString("hex")}.tmp`;
|
|
33
|
+
try {
|
|
34
|
+
await mkdir(dirname(path), { recursive: true });
|
|
35
|
+
await writeFile(temporary, text, "utf8");
|
|
36
|
+
if (aborted(signal)) {
|
|
37
|
+
await rm(temporary, { force: true });
|
|
38
|
+
return { kind: "canceled" };
|
|
39
|
+
}
|
|
40
|
+
await rename(temporary, path);
|
|
41
|
+
return { kind: "written" };
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
await rm(temporary, { force: true });
|
|
45
|
+
return { kind: "failed", message: messageOf(error) };
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
async removeArtifact({ path, signal }) {
|
|
49
|
+
if (aborted(signal))
|
|
50
|
+
return { kind: "canceled" };
|
|
51
|
+
try {
|
|
52
|
+
await rm(path);
|
|
53
|
+
return { kind: "removed" };
|
|
54
|
+
}
|
|
55
|
+
catch (error) {
|
|
56
|
+
return codeOf(error) === "ENOENT" ? { kind: "missing" } : { kind: "failed", message: messageOf(error) };
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
async listArtifacts({ directory }) {
|
|
60
|
+
try {
|
|
61
|
+
const entries = await readdir(directory, { withFileTypes: true });
|
|
62
|
+
const paths = entries
|
|
63
|
+
.filter((entry) => entry.isFile() && entry.name.endsWith(".json"))
|
|
64
|
+
.map((entry) => join(directory, entry.name))
|
|
65
|
+
.toSorted();
|
|
66
|
+
return { kind: "listed", paths };
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
return codeOf(error) === "ENOENT" ? { kind: "listed", paths: [] } : { kind: "failed", message: messageOf(error) };
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
/** Whether `signal` has aborted, read afresh at each check: a signal aborts while a method awaits. */
|
|
74
|
+
function aborted(signal) {
|
|
75
|
+
return signal?.aborted === true;
|
|
76
|
+
}
|
|
77
|
+
function codeOf(error) {
|
|
78
|
+
return typeof error === "object" && error !== null && "code" in error ? error.code : undefined;
|
|
79
|
+
}
|
|
80
|
+
function messageOf(error) {
|
|
81
|
+
return error instanceof Error ? error.message : String(error);
|
|
82
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How much a story run may change its artifacts:
|
|
3
|
+
*
|
|
4
|
+
* - `none` compares and writes nothing. A divergence or a stale entry fails the story.
|
|
5
|
+
* - `stale` rewrites the artifact so it fits the story again, when the only problems are stale entries. A divergence
|
|
6
|
+
* still fails the story, and then nothing is written.
|
|
7
|
+
* - `all` also accepts divergences, recording the new observations.
|
|
8
|
+
*/
|
|
9
|
+
export type StoryRecordLevel = "none" | "stale" | "all";
|
|
10
|
+
/** The variable that sets the level. */
|
|
11
|
+
export declare const STORY_RECORD_VARIABLE = "STORY_RECORD";
|
|
12
|
+
/**
|
|
13
|
+
* The level `env` sets: `STORY_RECORD` when it is set and non-empty; otherwise `none` when `CI` is set and non-empty,
|
|
14
|
+
* since CI must not change a recording, and `stale` elsewhere. Any other value of `STORY_RECORD` is a `TypeError`
|
|
15
|
+
* naming it.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveStoryRecordLevel(env: Readonly<Record<string, string | undefined>>): StoryRecordLevel;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// How much a story run may change its artifacts, from `STORY_RECORD`. Pure.
|
|
2
|
+
/** The variable that sets the level. */
|
|
3
|
+
export const STORY_RECORD_VARIABLE = "STORY_RECORD";
|
|
4
|
+
const LEVELS = ["none", "stale", "all"];
|
|
5
|
+
/**
|
|
6
|
+
* The level `env` sets: `STORY_RECORD` when it is set and non-empty; otherwise `none` when `CI` is set and non-empty,
|
|
7
|
+
* since CI must not change a recording, and `stale` elsewhere. Any other value of `STORY_RECORD` is a `TypeError`
|
|
8
|
+
* naming it.
|
|
9
|
+
*/
|
|
10
|
+
export function resolveStoryRecordLevel(env) {
|
|
11
|
+
const value = env[STORY_RECORD_VARIABLE];
|
|
12
|
+
if (value === undefined || value === "") {
|
|
13
|
+
const ci = env["CI"];
|
|
14
|
+
return ci !== undefined && ci !== "" ? "none" : "stale";
|
|
15
|
+
}
|
|
16
|
+
const level = LEVELS.find((each) => each === value);
|
|
17
|
+
if (level === undefined) {
|
|
18
|
+
throw new TypeError(`story: ${STORY_RECORD_VARIABLE} must be none, stale or all, or unset, not ${JSON.stringify(value)}`);
|
|
19
|
+
}
|
|
20
|
+
return level;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StoryArtifactGateway } from "./gateways.ts";
|
|
2
|
+
export type StoryOrphans = {
|
|
3
|
+
readonly kind: "found";
|
|
4
|
+
readonly paths: readonly string[];
|
|
5
|
+
} | {
|
|
6
|
+
readonly kind: "failed";
|
|
7
|
+
readonly message: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* The orphans of `storyFile`, whose stories' artifacts are at `expected`: every artifact in its artifact directory
|
|
11
|
+
* but those, sorted. The directory is the file's alone (`artifactDirectory`), so an artifact there that no story
|
|
12
|
+
* expects is an orphan whatever it holds, an unreadable one too, and another file's artifacts are never listed.
|
|
13
|
+
*/
|
|
14
|
+
export declare function findOrphans(request: {
|
|
15
|
+
readonly storyFile: string;
|
|
16
|
+
readonly expected: readonly string[];
|
|
17
|
+
}, gateway: StoryArtifactGateway): Promise<StoryOrphans>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Finding a story file's orphans: artifacts in its artifact directory that belong to none of its stories. Domain
|
|
2
|
+
// logic over the artifact gateway.
|
|
3
|
+
import { artifactDirectory } from "./artifact.js";
|
|
4
|
+
/**
|
|
5
|
+
* The orphans of `storyFile`, whose stories' artifacts are at `expected`: every artifact in its artifact directory
|
|
6
|
+
* but those, sorted. The directory is the file's alone (`artifactDirectory`), so an artifact there that no story
|
|
7
|
+
* expects is an orphan whatever it holds, an unreadable one too, and another file's artifacts are never listed.
|
|
8
|
+
*/
|
|
9
|
+
export async function findOrphans(request, gateway) {
|
|
10
|
+
const listed = await gateway.listArtifacts({ directory: artifactDirectory(request.storyFile) });
|
|
11
|
+
if (listed.kind === "failed")
|
|
12
|
+
return listed;
|
|
13
|
+
const expected = new Set(request.expected);
|
|
14
|
+
return { kind: "found", paths: listed.paths.filter((path) => !expected.has(path)) };
|
|
15
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { StoryCall, StoryIdentity } from "./artifact.ts";
|
|
2
|
+
import { type StoryRecordLevel } from "./mode.ts";
|
|
3
|
+
import type { StorySettlement } from "./settle.ts";
|
|
4
|
+
/** `user calls slot {"command":"list --json"}`, the input as compact JSON cut to 100 characters. */
|
|
5
|
+
export declare function describeCall(call: Pick<StoryCall, "agent" | "tool" | "input">): string;
|
|
6
|
+
/**
|
|
7
|
+
* One line per aligned call, then one per unreadable artifact and orphan, each with its status in brackets:
|
|
8
|
+
* `matched`, `divergence`, `unrecorded` or `unmade`, `orphan` or `unreadable`. When the story's end `applied` its
|
|
9
|
+
* change, an unrecorded call reads `recorded`, an accepted divergence `divergence accepted`, an unmade call
|
|
10
|
+
* `unmade removed`, an unreadable artifact `unreadable rewritten` and an orphan `orphan removed`.
|
|
11
|
+
*/
|
|
12
|
+
export declare function storyEventLines(settlement: StorySettlement, applied: boolean): readonly string[];
|
|
13
|
+
export interface StoryReportInput {
|
|
14
|
+
readonly story: StoryIdentity;
|
|
15
|
+
readonly level: StoryRecordLevel;
|
|
16
|
+
readonly settlement: StorySettlement;
|
|
17
|
+
/** Whether the story's body threw, so nothing was written. */
|
|
18
|
+
readonly bodyFailed: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The report of a story that failed: a heading naming the story and the level, each divergence with its
|
|
22
|
+
* observation's diff, each stale entry by kind, a line for the recorded calls a story that threw never reached, and a
|
|
23
|
+
* summary line saying what to do.
|
|
24
|
+
*/
|
|
25
|
+
export declare function storyReport(input: StoryReportInput): string;
|
|
26
|
+
/**
|
|
27
|
+
* The line for what a passing story's end changed, or `undefined` when it changed nothing: how many calls it
|
|
28
|
+
* recorded, divergences it accepted, unmade calls it removed, unreadable artifacts it rewrote and orphans it removed.
|
|
29
|
+
*/
|
|
30
|
+
export declare function storyChangeLine(story: StoryIdentity, path: string, settlement: StorySettlement): string | undefined;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// What a story says about its calls: one event line per call, the report of a failed story, and the line for what a
|
|
2
|
+
// passing story changed. Pure.
|
|
3
|
+
import { describeObservationDiff } from "./diff.js";
|
|
4
|
+
import { STORY_RECORD_VARIABLE } from "./mode.js";
|
|
5
|
+
/** How much of a call's input its line keeps. */
|
|
6
|
+
const INPUT_CHARS = 100;
|
|
7
|
+
/** `user calls slot {"command":"list --json"}`, the input as compact JSON cut to 100 characters. */
|
|
8
|
+
export function describeCall(call) {
|
|
9
|
+
const input = JSON.stringify(call.input);
|
|
10
|
+
return `${call.agent} calls ${call.tool} ${input.length > INPUT_CHARS ? `${input.slice(0, INPUT_CHARS - 1)}…` : input}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* One line per aligned call, then one per unreadable artifact and orphan, each with its status in brackets:
|
|
14
|
+
* `matched`, `divergence`, `unrecorded` or `unmade`, `orphan` or `unreadable`. When the story's end `applied` its
|
|
15
|
+
* change, an unrecorded call reads `recorded`, an accepted divergence `divergence accepted`, an unmade call
|
|
16
|
+
* `unmade removed`, an unreadable artifact `unreadable rewritten` and an orphan `orphan removed`.
|
|
17
|
+
*/
|
|
18
|
+
export function storyEventLines(settlement, applied) {
|
|
19
|
+
const written = applied && settlement.change.kind !== "leave";
|
|
20
|
+
const calls = settlement.aligned.map((each) => `${describeAligned(each)} [${callStatus(each, written, settlement.accepted)}]`);
|
|
21
|
+
const files = settlement.stale.flatMap((entry) => entry.kind === "unreadable"
|
|
22
|
+
? [`artifact ${entry.path} [${written ? "unreadable rewritten" : "unreadable"}]`]
|
|
23
|
+
: entry.kind === "orphan"
|
|
24
|
+
? [
|
|
25
|
+
`artifact ${entry.path} [${applied && settlement.removeOrphans.includes(entry.path) ? "orphan removed" : "orphan"}]`,
|
|
26
|
+
]
|
|
27
|
+
: []);
|
|
28
|
+
return [...calls, ...files];
|
|
29
|
+
}
|
|
30
|
+
function describeAligned(each) {
|
|
31
|
+
return describeCall(each.kind === "unmade" ? each.recorded : each.live);
|
|
32
|
+
}
|
|
33
|
+
function callStatus(each, written, accepted) {
|
|
34
|
+
switch (each.kind) {
|
|
35
|
+
case "matched":
|
|
36
|
+
return "matched";
|
|
37
|
+
case "divergence":
|
|
38
|
+
return written && accepted ? "divergence accepted" : "divergence";
|
|
39
|
+
case "unrecorded":
|
|
40
|
+
return written ? "recorded" : "unrecorded";
|
|
41
|
+
case "unmade":
|
|
42
|
+
return written ? "unmade removed" : "unmade";
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The report of a story that failed: a heading naming the story and the level, each divergence with its
|
|
47
|
+
* observation's diff, each stale entry by kind, a line for the recorded calls a story that threw never reached, and a
|
|
48
|
+
* summary line saying what to do.
|
|
49
|
+
*/
|
|
50
|
+
export function storyReport(input) {
|
|
51
|
+
const { settlement } = input;
|
|
52
|
+
const lines = [`story "${input.story.name}" (${input.story.file}), ${STORY_RECORD_VARIABLE}=${input.level}:`];
|
|
53
|
+
for (const divergence of settlement.divergences) {
|
|
54
|
+
lines.push(` divergence: ${describeCall(divergence.live)}`);
|
|
55
|
+
for (const line of describeObservationDiff(divergence.recorded.observation, divergence.live.observation)) {
|
|
56
|
+
lines.push(line === "" ? "" : ` ${line}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
for (const kind of ["unrecorded", "unmade", "unreadable", "orphan"]) {
|
|
60
|
+
for (const entry of settlement.stale)
|
|
61
|
+
if (entry.kind === kind)
|
|
62
|
+
lines.push(` stale, ${kind}: ${describeStale(entry)}`);
|
|
63
|
+
}
|
|
64
|
+
if (settlement.unreached > 0) {
|
|
65
|
+
lines.push(` the story threw before ${count(settlement.unreached, "recorded call")}`);
|
|
66
|
+
}
|
|
67
|
+
lines.push(summary(input));
|
|
68
|
+
return lines.join("\n");
|
|
69
|
+
}
|
|
70
|
+
function describeStale(entry) {
|
|
71
|
+
switch (entry.kind) {
|
|
72
|
+
case "unrecorded":
|
|
73
|
+
case "unmade":
|
|
74
|
+
return describeCall(entry.call);
|
|
75
|
+
case "orphan":
|
|
76
|
+
return entry.path;
|
|
77
|
+
case "unreadable":
|
|
78
|
+
return `${entry.path}: ${entry.problem}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function summary(input) {
|
|
82
|
+
const { divergences, stale, aligned } = input.settlement;
|
|
83
|
+
const matched = aligned.filter((each) => each.kind === "matched").length;
|
|
84
|
+
const counts = `${count(divergences.length, "divergence")}, ${count(stale.length, "stale entry", "stale entries")}, ${matched} matched.`;
|
|
85
|
+
if (input.bodyFailed)
|
|
86
|
+
return `${counts} The story threw, so nothing was written.`;
|
|
87
|
+
if (divergences.length > 0) {
|
|
88
|
+
return `${counts} A divergence means the tool behaved differently. If that is intended, record it with ${STORY_RECORD_VARIABLE}=all.`;
|
|
89
|
+
}
|
|
90
|
+
return `${counts} The recording no longer fits the story. Record it again with ${STORY_RECORD_VARIABLE}=stale.`;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The line for what a passing story's end changed, or `undefined` when it changed nothing: how many calls it
|
|
94
|
+
* recorded, divergences it accepted, unmade calls it removed, unreadable artifacts it rewrote and orphans it removed.
|
|
95
|
+
*/
|
|
96
|
+
export function storyChangeLine(story, path, settlement) {
|
|
97
|
+
const parts = [];
|
|
98
|
+
const written = settlement.change.kind !== "leave";
|
|
99
|
+
if (written) {
|
|
100
|
+
const kinds = (kind) => settlement.stale.filter((entry) => entry.kind === kind).length;
|
|
101
|
+
if (kinds("unrecorded") > 0)
|
|
102
|
+
parts.push(`recorded ${count(kinds("unrecorded"), "call")}`);
|
|
103
|
+
if (settlement.divergences.length > 0)
|
|
104
|
+
parts.push(`accepted ${count(settlement.divergences.length, "divergence")}`);
|
|
105
|
+
if (kinds("unmade") > 0)
|
|
106
|
+
parts.push(`removed ${count(kinds("unmade"), "unmade call")}`);
|
|
107
|
+
if (kinds("unreadable") > 0)
|
|
108
|
+
parts.push("rewrote an unreadable artifact");
|
|
109
|
+
}
|
|
110
|
+
if (settlement.removeOrphans.length > 0)
|
|
111
|
+
parts.push(`removed ${count(settlement.removeOrphans.length, "orphan")}`);
|
|
112
|
+
if (parts.length === 0)
|
|
113
|
+
return undefined;
|
|
114
|
+
return `story "${story.name}": ${parts.join(", ")} (${path})`;
|
|
115
|
+
}
|
|
116
|
+
function count(n, one, many = `${one}s`) {
|
|
117
|
+
return `${n} ${n === 1 ? one : many}`;
|
|
118
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { StoryIdentity } from "./artifact.ts";
|
|
2
|
+
import type { StoryAgents, StoryHandles, StoryHarness, StorySession } from "./definition.ts";
|
|
3
|
+
import type { StoryArtifactGateway } from "./gateways.ts";
|
|
4
|
+
import type { StoryRecordLevel } from "./mode.ts";
|
|
5
|
+
export interface StoryRunOptions {
|
|
6
|
+
readonly story: StoryIdentity;
|
|
7
|
+
/** The story's artifact path (`artifactPath`). */
|
|
8
|
+
readonly path: string;
|
|
9
|
+
readonly level: StoryRecordLevel;
|
|
10
|
+
/**
|
|
11
|
+
* Aborts when the story is stopped, as by a timeout. A story stopped before its end compares as one whose body
|
|
12
|
+
* threw, so it changes nothing; one stopped while its end changes the artifact stops before the next change.
|
|
13
|
+
*/
|
|
14
|
+
readonly signal?: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
/** How a story's end went. */
|
|
17
|
+
export interface StoryRunEnd {
|
|
18
|
+
/** One line per call, unreadable artifact and orphan (`storyEventLines`). */
|
|
19
|
+
readonly events: readonly string[];
|
|
20
|
+
/** The report, when the story fails or its body threw with something to report; otherwise `undefined`. */
|
|
21
|
+
readonly report: string | undefined;
|
|
22
|
+
/** What a passing story changed (`storyChangeLine`), or `undefined`. */
|
|
23
|
+
readonly changeLine: string | undefined;
|
|
24
|
+
/**
|
|
25
|
+
* Why the story fails beyond its body: a `StoryDivergenceError`, a `StoryStaleError`, an artifact that couldn't be
|
|
26
|
+
* read, written or removed, or a session whose `close()` threw. `undefined` when nothing did.
|
|
27
|
+
*/
|
|
28
|
+
readonly error: Error | undefined;
|
|
29
|
+
}
|
|
30
|
+
/** How a story's body ended, and the story file's orphans when this story's end checks for them (none otherwise). */
|
|
31
|
+
export interface StoryRunFinish {
|
|
32
|
+
readonly bodyPassed: boolean;
|
|
33
|
+
readonly orphans: readonly string[];
|
|
34
|
+
}
|
|
35
|
+
export interface StoryRun<Agents> {
|
|
36
|
+
/** What the story's body gets: one handle per agent, each with a function per tool. */
|
|
37
|
+
readonly handles: StoryHandles<Agents>;
|
|
38
|
+
/**
|
|
39
|
+
* Ends the story, once: whether its body passed, and the story file's orphans when this end checks for them.
|
|
40
|
+
* Closes the session, if one started, whatever else happens.
|
|
41
|
+
*/
|
|
42
|
+
finish(end: StoryRunFinish): Promise<StoryRunEnd>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Starts one story's run. Each tool call checks its input against the tool's schema (a `TypeError` when it doesn't
|
|
46
|
+
* match), starts the session on the first call, runs the tool, and keeps its observation; a tool that throws keeps
|
|
47
|
+
* nothing. Its input and observation must be JSON (a `TypeError` otherwise).
|
|
48
|
+
*/
|
|
49
|
+
export declare function startStoryRun<Session extends StorySession, Agents extends StoryAgents<Session>>(harness: StoryHarness<Session, Agents>, options: StoryRunOptions, gateway: StoryArtifactGateway): StoryRun<Agents>;
|