@cnc-tools/storm 0.11.0 → 0.13.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/dist/bin/storm.js +7 -12
- package/dist/build-info.js +1 -1
- package/dist/chunks/chunk-2NZXL6OH.js +62 -0
- package/dist/chunks/{chunk-3ZZVZPMG.js → chunk-43MWZLJR.js} +1 -1
- package/dist/chunks/{chunk-NPPJ57W7.js → chunk-5UMJNVKT.js} +498 -215
- package/dist/chunks/{chunk-KR7WIYLG.js → chunk-6EQKA7LI.js} +200 -985
- package/dist/chunks/{chunk-4EU4AH7E.js → chunk-AX4EQZUS.js} +186 -144
- package/dist/chunks/{chunk-ETCZ6WP7.js → chunk-BW2ADH7U.js} +1 -1
- package/dist/chunks/chunk-DOFB2ACU.js +49 -0
- package/dist/chunks/chunk-EGNP3S6C.js +161 -0
- package/dist/chunks/chunk-GQIL3AHY.js +20 -0
- package/dist/chunks/{chunk-ICB4BZJX.js → chunk-GSC6SRTW.js} +7 -2
- package/dist/chunks/{chunk-OJOKQRM6.js → chunk-IYM44FUX.js} +30 -26
- package/dist/chunks/{chunk-GRMD7G4J.js → chunk-LQKNI3EG.js} +6 -5
- package/dist/chunks/chunk-N7E6DAUE.js +40 -0
- package/dist/chunks/chunk-NMVODY3P.js +19 -0
- package/dist/chunks/{chunk-TRFEAYNC.js → chunk-Q4TKRILH.js} +261 -354
- package/dist/chunks/{chunk-VZZTHCBW.js → chunk-RTILVSYQ.js} +5 -18
- package/dist/chunks/{chunk-L4ZPMSKQ.js → chunk-T6AZIDZD.js} +43 -363
- package/dist/chunks/chunk-X4WBJIOF.js +308 -0
- package/dist/chunks/chunk-YGS5VRQT.js +794 -0
- package/dist/chunks/{chunk-4PRAB24Y.js → chunk-YM6TZV4L.js} +394 -396
- package/dist/chunks/{chunk-AMTYHUYB.js → chunk-YT5OROR7.js} +22 -8
- package/dist/chunks/{chunk-O4BUT7BE.js → chunk-ZDJLKF2G.js} +1625 -1583
- package/dist/chunks/{live-app-LOGYUBKB.js → live-app-QFHS54SX.js} +25 -46
- package/dist/command-tree.d.ts +4 -1
- package/dist/command-tree.js +4 -1
- package/dist/commands/exec/cleanup.js +4 -4
- package/dist/commands/exec/command.d.ts +6 -55
- package/dist/commands/exec/command.js +51 -46
- package/dist/commands/exec/define-run-command.d.ts +664 -0
- package/dist/commands/exec/define-run-command.js +58 -0
- package/dist/commands/exec/driver-plan.d.ts +30 -0
- package/dist/commands/exec/driver-plan.js +44 -0
- package/dist/commands/exec/driver-refusals.d.ts +89 -0
- package/dist/commands/exec/driver-refusals.js +65 -0
- package/dist/commands/exec/exec-words.d.ts +5 -0
- package/dist/commands/exec/exec-words.js +31 -0
- package/dist/commands/exec/live-view.js +68 -42
- package/dist/commands/exec/mint-failed.js +4 -4
- package/dist/commands/exec/outcomes.d.ts +6 -48
- package/dist/commands/exec/outcomes.js +10 -12
- package/dist/commands/exec/plan-run.js +3 -3
- package/dist/commands/exec/progress.d.ts +21 -17
- package/dist/commands/exec/progress.js +59 -78
- package/dist/commands/exec/resource-flags.d.ts +10 -3
- package/dist/commands/exec/resource-flags.js +25 -14
- package/dist/commands/exec/resource-refusals.d.ts +1 -1
- package/dist/commands/exec/resource-refusals.js +9 -9
- package/dist/commands/exec/run-bin.d.ts +35 -0
- package/dist/commands/exec/run-bin.js +32 -0
- package/dist/commands/exec/run-command.d.ts +64 -23
- package/dist/commands/exec/run-command.js +35 -94
- package/dist/commands/exec/run-metadata.d.ts +25 -19
- package/dist/commands/exec/run-metadata.js +34 -18
- package/dist/commands/exec/snapshot-text.d.ts +31 -0
- package/dist/commands/exec/snapshot-text.js +72 -0
- package/dist/commands/exec/test-plan.d.ts +2 -2
- package/dist/commands/exec/test-plan.js +11 -8
- package/dist/commands/exec/tests-summary.d.ts +21 -12
- package/dist/commands/exec/tests-summary.js +67 -39
- package/dist/commands/exec/text.d.ts +5 -0
- package/dist/commands/exec/text.js +7 -0
- package/dist/commands/exec/view.js +12 -13
- package/dist/commands/exec/waterfall.js +4 -4
- package/dist/commands/exec/worker-chart.d.ts +19 -11
- package/dist/commands/exec/worker-chart.js +66 -36
- package/dist/commands/playwright/command.d.ts +658 -0
- package/dist/commands/playwright/command.js +31 -0
- package/dist/commands/playwright/metadata.js +8 -0
- package/dist/commands/runs/facts.d.ts +5 -28
- package/dist/commands/runs/facts.js +11 -33
- package/dist/commands/runs/list/command.d.ts +4 -50
- package/dist/commands/runs/list/command.js +15 -11
- package/dist/commands/runs/list/outcomes.d.ts +2 -25
- package/dist/commands/runs/logs/command.js +13 -9
- package/dist/commands/runs/logs/outcomes.js +1 -1
- package/dist/commands/runs/show/command.d.ts +6 -50
- package/dist/commands/runs/show/command.js +37 -47
- package/dist/commands/runs/show/metadata.js +1 -1
- package/dist/commands/runs/show/outcomes.d.ts +3 -25
- package/dist/commands/runs/show/outcomes.js +18 -31
- package/dist/commands/snapshots/build/command.d.ts +501 -0
- package/dist/commands/snapshots/build/command.js +336 -0
- package/dist/commands/snapshots/build/metadata.d.ts +28 -0
- package/dist/commands/snapshots/build/metadata.js +37 -0
- package/dist/commands/snapshots/build/outcomes.d.ts +254 -0
- package/dist/commands/snapshots/build/outcomes.js +155 -0
- package/dist/commands/snapshots/list/command.d.ts +238 -0
- package/dist/commands/snapshots/list/command.js +269 -0
- package/dist/commands/snapshots/list/metadata.d.ts +16 -0
- package/dist/commands/snapshots/list/metadata.js +24 -0
- package/dist/commands/snapshots/list/outcomes.d.ts +148 -0
- package/dist/commands/snapshots/list/outcomes.js +217 -0
- package/dist/commands/snapshots/metadata.d.ts +3 -0
- package/dist/commands/snapshots/metadata.js +7 -0
- package/dist/commands/vitest/command.d.ts +185 -304
- package/dist/commands/vitest/command.js +23 -181
- package/dist/commands/vitest/metadata.js +1 -1
- package/dist/config-file/define.d.ts +1 -1
- package/dist/context.d.ts +32 -30
- package/dist/context.js +13 -17
- package/dist/core/before-run.d.ts +5 -5
- package/dist/core/before-run.js +8 -8
- package/dist/core/definition-lookup.d.ts +5 -5
- package/dist/core/definition-lookup.js +13 -12
- package/dist/core/drivers-of.d.ts +23 -0
- package/dist/core/drivers-of.js +13 -0
- package/dist/core/events.d.ts +6 -9
- package/dist/core/gateways.d.ts +32 -24
- package/dist/core/index.d.ts +7 -5
- package/dist/core/index.js +9 -6
- package/dist/core/launcher-context.d.ts +11 -0
- package/dist/core/launcher-context.js +31 -0
- package/dist/core/live/package-bin-gateway.d.ts +6 -0
- package/dist/core/live/package-bin-gateway.js +24 -0
- package/dist/core/package-bin.d.ts +7 -0
- package/dist/core/package-bin.js +30 -0
- package/dist/core/presentations.d.ts +1 -1
- package/dist/core/presentations.js +6 -5
- package/dist/core/{resource-registry.d.ts → resource-definition-set.d.ts} +15 -14
- package/dist/core/resource-definition-set.js +31 -0
- package/dist/core/resource-reports.d.ts +1 -1
- package/dist/core/resource-reports.js +16 -15
- package/dist/core/resource.d.ts +4 -4
- package/dist/core/resources.d.ts +6 -6
- package/dist/core/resources.js +11 -11
- package/dist/core/run-state.d.ts +20 -31
- package/dist/core/run-state.js +34 -25
- package/dist/core/run.d.ts +30 -32
- package/dist/core/run.js +33 -39
- package/dist/core/setup-phases.d.ts +14 -0
- package/dist/core/setup-phases.js +24 -0
- package/dist/core/state-directory.d.ts +2 -2
- package/dist/core/state-directory.js +3 -3
- package/dist/core/timeline.d.ts +4 -2
- package/dist/core/timeline.js +11 -5
- package/dist/extension-commands.js +6 -10
- package/dist/extensions/github/{world.d.ts → context.d.ts} +1 -1
- package/dist/extensions/github/context.js +3 -0
- package/dist/extensions/github/definition.d.ts +1 -1
- package/dist/extensions/github/definition.js +3 -3
- package/dist/extensions/github/extension.d.ts +1 -1
- package/dist/extensions/github/index.d.ts +2 -2
- package/dist/extensions/github/index.js +4 -4
- package/dist/extensions/github/lifecycle.d.ts +3 -3
- package/dist/extensions/github/lifecycle.js +14 -14
- package/dist/extensions/github/live/context.d.ts +6 -0
- package/dist/extensions/github/live/context.js +16 -0
- package/dist/extensions/github/resource.d.ts +1 -1
- package/dist/extensions/playwright/driver.d.ts +8 -0
- package/dist/extensions/playwright/driver.js +60 -0
- package/dist/extensions/playwright/extension.d.ts +2 -0
- package/dist/extensions/playwright/extension.js +12 -0
- package/dist/extensions/playwright/plan/gateways.d.ts +62 -0
- package/dist/extensions/playwright/plan/gateways.js +4 -0
- package/dist/extensions/playwright/plan/list-output.d.ts +26 -0
- package/dist/extensions/playwright/plan/list-output.js +101 -0
- package/dist/extensions/playwright/plan/live/list-gateway.d.ts +15 -0
- package/dist/extensions/playwright/plan/live/list-gateway.js +100 -0
- package/dist/extensions/playwright/plan/plan.d.ts +44 -0
- package/dist/extensions/playwright/plan/plan.js +53 -0
- package/dist/extensions/testserver/command-tree.d.ts +1 -1
- package/dist/extensions/testserver/command-tree.js +2 -2
- package/dist/extensions/testserver/commands/app.d.ts +7 -7
- package/dist/extensions/testserver/commands/pool/create/command.d.ts +5 -5
- package/dist/extensions/testserver/commands/pool/create/command.js +12 -13
- package/dist/extensions/testserver/commands/pool/list/command.js +5 -6
- package/dist/extensions/testserver/{world.d.ts → context.d.ts} +1 -1
- package/dist/extensions/testserver/context.js +4 -0
- package/dist/extensions/testserver/definition.d.ts +2 -2
- package/dist/extensions/testserver/definition.js +8 -7
- package/dist/extensions/testserver/events.d.ts +1 -1
- package/dist/extensions/testserver/extension.d.ts +4 -3
- package/dist/extensions/testserver/extension.js +33 -20
- package/dist/extensions/testserver/index.d.ts +2 -2
- package/dist/extensions/testserver/index.js +2 -2
- package/dist/extensions/testserver/lifecycle.d.ts +6 -5
- package/dist/extensions/testserver/lifecycle.js +9 -8
- package/dist/extensions/testserver/live/context.d.ts +8 -0
- package/dist/extensions/testserver/live/{world.js → context.js} +6 -7
- package/dist/extensions/testserver/options/rules.d.ts +3 -3
- package/dist/extensions/testserver/options/rules.js +5 -4
- package/dist/extensions/testserver/options/sandboxes.d.ts +3 -2
- package/dist/extensions/testserver/options/sandboxes.js +3 -2
- package/dist/extensions/testserver/playwright/index.d.ts +33 -0
- package/dist/extensions/testserver/playwright/index.js +43 -0
- package/dist/extensions/testserver/presentation.d.ts +4 -4
- package/dist/extensions/testserver/presentation.js +7 -7
- package/dist/extensions/testserver/progress.d.ts +3 -3
- package/dist/extensions/testserver/progress.js +3 -3
- package/dist/extensions/testserver/provision.d.ts +2 -2
- package/dist/extensions/testserver/provision.js +10 -10
- package/dist/extensions/testserver/resource.d.ts +2 -2
- package/dist/extensions/testserver/result.d.ts +2 -2
- package/dist/extensions/testserver/result.js +1 -1
- package/dist/extensions/testserver/run/connection.d.ts +1 -1
- package/dist/extensions/testserver/run/connection.js +3 -3
- package/dist/extensions/testserver/run/sandbox.d.ts +31 -0
- package/dist/extensions/testserver/run/sandbox.js +58 -0
- package/dist/extensions/testserver/run-sandbox.d.ts +2 -2
- package/dist/extensions/testserver/run-sandbox.js +3 -3
- package/dist/extensions/testserver/vercel-cli/arguments.d.ts +2 -2
- package/dist/extensions/testserver/vercel-cli/arguments.js +6 -6
- package/dist/extensions/testserver/vercel-cli/auth-config.d.ts +7 -7
- package/dist/extensions/testserver/vercel-cli/auth-config.js +4 -4
- package/dist/extensions/testserver/vercel-cli/clock.js +1 -1
- package/dist/extensions/testserver/vercel-cli/config-files.js +1 -1
- package/dist/extensions/testserver/vercel-cli/context.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/context.js +2 -2
- package/dist/extensions/testserver/vercel-cli/entry.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/entry.js +1 -1
- package/dist/extensions/testserver/vercel-cli/environment.d.ts +5 -5
- package/dist/extensions/testserver/vercel-cli/environment.js +6 -6
- package/dist/extensions/testserver/vercel-cli/gateways.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/gateways.js +3 -3
- package/dist/extensions/testserver/vercel-cli/index.d.ts +1 -1
- package/dist/extensions/testserver/vercel-cli/index.js +8 -9
- package/dist/extensions/testserver/vercel-cli/invocation.d.ts +13 -12
- package/dist/extensions/testserver/vercel-cli/invocation.js +1 -1
- package/dist/extensions/testserver/vercel-cli/{driver.d.ts → invoker.d.ts} +18 -17
- package/dist/extensions/testserver/vercel-cli/{driver.js → invoker.js} +8 -8
- package/dist/extensions/testserver/vercel-cli/live/config-files.d.ts +2 -2
- package/dist/extensions/testserver/vercel-cli/live/config-files.js +2 -2
- package/dist/extensions/testserver/vercel-cli/live/process-gateway.js +1 -1
- package/dist/extensions/testserver/vercel-cli/report.js +2 -2
- package/dist/extensions/testserver/vercel-cli/verbose.js +1 -1
- package/dist/extensions/testserver/vitest/config.d.ts +3 -3
- package/dist/extensions/testserver/vitest/config.js +5 -13
- package/dist/extensions/testserver/vitest/container-scope.d.ts +11 -11
- package/dist/extensions/testserver/vitest/container-scope.js +9 -9
- package/dist/extensions/testserver/vitest/container-start.d.ts +6 -6
- package/dist/extensions/testserver/vitest/container-start.js +14 -11
- package/dist/extensions/testserver/vitest/diagnostics.d.ts +1 -1
- package/dist/extensions/testserver/vitest/fixtures.d.ts +11 -11
- package/dist/extensions/testserver/vitest/fixtures.js +14 -23
- package/dist/extensions/testserver/vitest/index.d.ts +1 -1
- package/dist/extensions/testserver/vitest/index.js +4 -4
- package/dist/extensions/testserver/vitest/types.d.ts +16 -18
- package/dist/extensions/testserver/vitest/types.js +2 -2
- package/dist/extensions/testserver/vitest/worker-sandbox.d.ts +8 -0
- package/dist/extensions/testserver/vitest/worker-sandbox.js +17 -0
- package/dist/extensions/vitest/driver.d.ts +8 -0
- package/dist/extensions/vitest/driver.js +62 -0
- package/dist/extensions/vitest/extension.d.ts +2 -0
- package/dist/extensions/vitest/extension.js +8 -0
- package/dist/{vitest → extensions/vitest/plan}/gateways.d.ts +1 -26
- package/dist/extensions/vitest/plan/gateways.js +3 -0
- package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.d.ts +1 -2
- package/dist/{vitest → extensions/vitest/plan}/live/list-gateway.js +1 -20
- package/dist/extensions/vitest/plan/plan-over.d.ts +38 -0
- package/dist/extensions/vitest/plan/plan-over.js +31 -0
- package/dist/extensions/vitest/plan/plan.d.ts +24 -0
- package/dist/{vitest → extensions/vitest/plan}/plan.js +11 -26
- package/dist/extensions.d.ts +40 -18
- package/dist/extensions.js +49 -22
- package/dist/forward-sigterm.js +1 -1
- package/dist/launcher-resolvers/index.d.ts +1 -1
- package/dist/launcher-resolvers/local-services.d.ts +9 -44
- package/dist/launcher-resolvers/local-services.js +4 -5
- package/dist/live-app.js +7 -6
- package/dist/local-services.d.ts +7 -15
- package/dist/local-services.js +8 -29
- package/dist/playwright/index.d.ts +1 -0
- package/dist/playwright/index.js +4 -0
- package/dist/playwright/reporter.d.ts +96 -0
- package/dist/playwright/reporter.js +162 -0
- package/dist/playwright/worker-index.d.ts +7 -0
- package/dist/playwright/worker-index.js +20 -0
- package/dist/run-directory/index.d.ts +1 -1
- package/dist/run-directory/index.js +2 -3
- package/dist/run-directory/plan.d.ts +3 -3
- package/dist/run-directory/plan.js +5 -5
- package/dist/run-directory/reader.js +2 -2
- package/dist/run-directory/recording.d.ts +8 -5
- package/dist/run-directory/recording.js +6 -6
- package/dist/run-directory/run-collector.d.ts +5 -5
- package/dist/run-directory/run-collector.js +5 -5
- package/dist/run-directory/run-record.d.ts +17 -90
- package/dist/run-directory/run-record.js +15 -55
- package/dist/run-directory/timeline-facts.d.ts +2 -1
- package/dist/run-directory/timeline-facts.js +4 -2
- package/dist/runner/build-snapshots.d.ts +115 -0
- package/dist/runner/build-snapshots.js +146 -0
- package/dist/runner/context.js +2 -1
- package/dist/runner/events.d.ts +24 -69
- package/dist/runner/gateways.d.ts +20 -18
- package/dist/runner/index.d.ts +8 -7
- package/dist/runner/index.js +5 -3
- package/dist/runner/live/checkout-gateway.js +15 -7
- package/dist/runner/live/snapshot-records.js +7 -17
- package/dist/runner/prepare.d.ts +17 -50
- package/dist/runner/prepare.js +21 -25
- package/dist/runner/ready.d.ts +15 -11
- package/dist/runner/ready.js +32 -40
- package/dist/runner/recipe.d.ts +4 -18
- package/dist/runner/recipe.js +1 -13
- package/dist/runner/scope.d.ts +8 -32
- package/dist/runner/scope.js +4 -12
- package/dist/runner/secrets.d.ts +6 -0
- package/dist/runner/secrets.js +10 -0
- package/dist/runner/session.d.ts +19 -38
- package/dist/runner/session.js +16 -55
- package/dist/runner/snapshot-build.d.ts +21 -11
- package/dist/runner/snapshot-build.js +11 -16
- package/dist/runner/snapshot-cache.d.ts +98 -72
- package/dist/runner/snapshot-cache.js +69 -118
- package/dist/runner/snapshot-inspect.d.ts +85 -0
- package/dist/runner/snapshot-inspect.js +164 -0
- package/dist/runner/snapshot-key.d.ts +13 -15
- package/dist/runner/snapshot-key.js +15 -22
- package/dist/sdk/extension/commands.d.ts +35 -17
- package/dist/sdk/extension/commands.js +13 -11
- package/dist/sdk/extension/driver.d.ts +143 -0
- package/dist/sdk/extension/driver.js +28 -0
- package/dist/sdk/extension/index.d.ts +2 -1
- package/dist/sdk/extension/index.js +15 -9
- package/dist/sdk/extension/{launcher-supplies.d.ts → launcher-context.d.ts} +3 -3
- package/dist/sdk/extension/launcher-context.js +5 -0
- package/dist/sdk/extension/lifecycle.d.ts +6 -5
- package/dist/sdk/extension/lifecycle.js +2 -2
- package/dist/sdk/extension/resource-definition.d.ts +13 -13
- package/dist/sdk/extension/resource-definition.js +2 -2
- package/dist/sdk/extension/resource.d.ts +13 -13
- package/dist/sdk/extension/resource.js +11 -11
- package/dist/sdk/extension/time.js +2 -2
- package/dist/sdk/index.d.ts +2 -0
- package/dist/sdk/index.js +3 -1
- package/dist/sdk/run/launcher.d.ts +1 -1
- package/dist/sdk/run/launcher.js +4 -3
- package/dist/sdk/run/payload.js +1 -1
- package/dist/sdk/run/test-events.d.ts +24 -18
- package/dist/sdk/run/test-events.js +5 -4
- package/dist/sdk/run/test-result-writer.d.ts +77 -0
- package/dist/sdk/run/test-result-writer.js +143 -0
- package/dist/sdk/run/worker-test-event-writer.d.ts +13 -0
- package/dist/sdk/run/worker-test-event-writer.js +31 -0
- package/dist/vendor/testserver-sdk/container/container.d.ts +1 -6
- package/dist/vendor/testserver-sdk/container/container.js +1 -5
- package/dist/vendor/testserver-sdk/factories/build.d.ts +12 -40
- package/dist/vendor/testserver-sdk/factories/build.js +15 -66
- package/dist/vendor/testserver-sdk/factories/gateways.d.ts +1 -2
- package/dist/vendor/testserver-sdk/factories/index.d.ts +1 -3
- package/dist/vendor/testserver-sdk/factories/index.js +3 -5
- package/dist/vendor/testserver-sdk/index.d.ts +1 -2
- package/dist/vendor/testserver-sdk/index.js +5 -6
- package/dist/vendor/testserver-sdk/records/body.d.ts +1 -1
- package/dist/vendor/testserver-sdk/records/body.js +1 -1
- package/dist/vitest/index.d.ts +2 -1
- package/dist/vitest/index.js +6 -4
- package/dist/vitest/test-events.d.ts +6 -16
- package/dist/vitest/test-events.js +15 -40
- package/dist/vitest/test-results.d.ts +9 -31
- package/dist/vitest/test-results.js +34 -105
- package/dist/vitest/worker-index.d.ts +6 -0
- package/dist/vitest/worker-index.js +17 -0
- package/package.json +23 -9
- package/skills/overview.md +6 -8
- package/skills/read-run-output.md +21 -7
- package/dist/chunks/chunk-FVMQKYTT.js +0 -10
- package/dist/chunks/chunk-SLNKW4ZM.js +0 -40
- package/dist/chunks/chunk-WNIQA5J6.js +0 -19
- package/dist/chunks/chunk-WSIF7SR6.js +0 -10
- package/dist/commands/vitest/outcomes.d.ts +0 -379
- package/dist/commands/vitest/outcomes.js +0 -70
- package/dist/core/launcher-supplies.d.ts +0 -11
- package/dist/core/launcher-supplies.js +0 -28
- package/dist/core/live/terminal-command-gateway.d.ts +0 -8
- package/dist/core/live/terminal-command-gateway.js +0 -49
- package/dist/core/resource-registry.js +0 -30
- package/dist/extensions/github/live/world.d.ts +0 -6
- package/dist/extensions/github/live/world.js +0 -16
- package/dist/extensions/github/world.js +0 -3
- package/dist/extensions/story/command-tree.d.ts +0 -6
- package/dist/extensions/story/command-tree.js +0 -21
- package/dist/extensions/story/commands/app.d.ts +0 -23
- package/dist/extensions/story/commands/app.js +0 -5
- package/dist/extensions/story/commands/run/command.d.ts +0 -211
- package/dist/extensions/story/commands/run/command.js +0 -259
- package/dist/extensions/story/commands/run/metadata.js +0 -8
- package/dist/extensions/story/commands/run/outcomes.d.ts +0 -101
- package/dist/extensions/story/commands/run/outcomes.js +0 -73
- package/dist/extensions/story/commands/tree.d.ts +0 -2
- package/dist/extensions/story/commands/tree.js +0 -6
- package/dist/extensions/story/extension.d.ts +0 -2
- package/dist/extensions/story/extension.js +0 -8
- package/dist/extensions/testserver/live/world.d.ts +0 -8
- package/dist/extensions/testserver/vitest/sandbox.d.ts +0 -25
- package/dist/extensions/testserver/vitest/sandbox.js +0 -43
- package/dist/extensions/testserver/world.js +0 -4
- package/dist/runner/snapshot-save.d.ts +0 -56
- package/dist/runner/snapshot-save.js +0 -151
- package/dist/sdk/extension/launcher-supplies.js +0 -3
- package/dist/story/align.d.ts +0 -37
- package/dist/story/align.js +0 -39
- package/dist/story/command-line.d.ts +0 -24
- package/dist/story/command-line.js +0 -88
- package/dist/story/definition.d.ts +0 -59
- package/dist/story/definition.js +0 -9
- package/dist/story/diff.d.ts +0 -9
- package/dist/story/diff.js +0 -97
- package/dist/story/errors.d.ts +0 -14
- package/dist/story/errors.js +0 -21
- package/dist/story/gateways.d.ts +0 -94
- package/dist/story/gateways.js +0 -3
- package/dist/story/host.d.ts +0 -30
- package/dist/story/host.js +0 -97
- package/dist/story/index.d.ts +0 -8
- package/dist/story/index.js +0 -11
- package/dist/story/json.d.ts +0 -16
- package/dist/story/json.js +0 -59
- package/dist/story/launch.d.ts +0 -70
- package/dist/story/launch.js +0 -77
- package/dist/story/live/recording-gateway.d.ts +0 -2
- package/dist/story/live/recording-gateway.js +0 -103
- package/dist/story/orphans.d.ts +0 -35
- package/dist/story/orphans.js +0 -51
- package/dist/story/recording.d.ts +0 -62
- package/dist/story/recording.js +0 -97
- package/dist/story/report.d.ts +0 -42
- package/dist/story/report.js +0 -129
- package/dist/story/sequence.d.ts +0 -30
- package/dist/story/sequence.js +0 -74
- package/dist/story/settle.d.ts +0 -96
- package/dist/story/settle.js +0 -71
- package/dist/story/start.d.ts +0 -50
- package/dist/story/start.js +0 -183
- package/dist/vendor/testserver-sdk/factories/definition.d.ts +0 -39
- package/dist/vendor/testserver-sdk/factories/definition.js +0 -16
- package/dist/vendor/testserver-sdk/factories/definitions.d.ts +0 -169
- package/dist/vendor/testserver-sdk/factories/definitions.js +0 -245
- package/dist/vendor/testserver-sdk/seed/index.d.ts +0 -1
- package/dist/vendor/testserver-sdk/seed/index.js +0 -3
- package/dist/vendor/testserver-sdk/seed/seed.d.ts +0 -221
- package/dist/vendor/testserver-sdk/seed/seed.js +0 -171
- package/dist/vitest/find-vitest.d.ts +0 -7
- package/dist/vitest/find-vitest.js +0 -28
- package/dist/vitest/gateways.js +0 -4
- package/dist/vitest/plan.d.ts +0 -51
- /package/dist/{extensions/story/commands/run → commands/playwright}/metadata.d.ts +0 -0
- /package/dist/{vitest → extensions/vitest/plan}/list-output.d.ts +0 -0
- /package/dist/{vitest → extensions/vitest/plan}/list-output.js +0 -0
|
@@ -0,0 +1,794 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EMPTY_RUN_STATE,
|
|
3
|
+
commandExitStatus,
|
|
4
|
+
observeAll
|
|
5
|
+
} from "./chunk-6EQKA7LI.js";
|
|
6
|
+
import {
|
|
7
|
+
parseTestEvent,
|
|
8
|
+
testEventLine
|
|
9
|
+
} from "./chunk-ZDJLKF2G.js";
|
|
10
|
+
|
|
11
|
+
// src/run-directory/run-directory.ts
|
|
12
|
+
import { join } from "node:path";
|
|
13
|
+
var RUNS_SUBPATH = ["runs"];
|
|
14
|
+
var RUN_DIRECTORIES_KEPT = 1e3;
|
|
15
|
+
var RUN_FILE = "run.json";
|
|
16
|
+
var TESTS_FILE = "tests.jsonl";
|
|
17
|
+
var TESTS_PARTIAL_FILE = ".tests.jsonl.partial";
|
|
18
|
+
var TEST_EVENTS_STAGING_FILE = ".test-events.jsonl";
|
|
19
|
+
var TIMELINE_FILE = "timeline.json";
|
|
20
|
+
var EVENTS_FILE = "events.jsonl";
|
|
21
|
+
var COMMAND_LOG = "command.log";
|
|
22
|
+
var RUN_LOGS = ["snapshot", "apply", "install", "build", "command"];
|
|
23
|
+
function runLogFile(log) {
|
|
24
|
+
return log === "command" ? COMMAND_LOG : `${log}.log`;
|
|
25
|
+
}
|
|
26
|
+
var ACTIVE_MARKER = "active.json";
|
|
27
|
+
var RUN_ID_PATTERN = /^\d{8}T\d{6}-[0-9a-z]+$/;
|
|
28
|
+
function runIdPrefix(startedAt) {
|
|
29
|
+
return startedAt.toISOString().replace(/[-:]/g, "").replace(/\.\d+Z$/, "");
|
|
30
|
+
}
|
|
31
|
+
function testEventsPath(path) {
|
|
32
|
+
return join(path, TEST_EVENTS_STAGING_FILE);
|
|
33
|
+
}
|
|
34
|
+
function stepLogPath(path, step) {
|
|
35
|
+
return join(path, runLogFile(step));
|
|
36
|
+
}
|
|
37
|
+
function stepLog(path, step) {
|
|
38
|
+
return step === "snapshot" || step === "apply" || step === "install" || step === "build" ? stepLogPath(path, step) : void 0;
|
|
39
|
+
}
|
|
40
|
+
function runDirectoryObserver(directory) {
|
|
41
|
+
return {
|
|
42
|
+
observe: async ({ event, at }) => {
|
|
43
|
+
if (event.kind === "runner" && event.event.kind === "step-output") {
|
|
44
|
+
directory.appendStepOutput(event.event.phase, `${at.toISOString()} ${event.event.line}`);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
directory.appendEvent(JSON.stringify({ at: at.toISOString(), ...event }));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/run-directory/run-record.ts
|
|
53
|
+
import { z as z2 } from "zod";
|
|
54
|
+
|
|
55
|
+
// src/run-directory/plan.ts
|
|
56
|
+
import { z } from "zod";
|
|
57
|
+
var planOptionSchema = z.object({
|
|
58
|
+
/** The option's key path, `resources.<key>.<option>`, under its resource key. */
|
|
59
|
+
path: z.string(),
|
|
60
|
+
/** Its value. */
|
|
61
|
+
value: z.union([z.string(), z.number(), z.boolean()]),
|
|
62
|
+
/** Where the value came from: its flag (`flag`), storm.config.ts (`file`), or its default, given the test plan (`default`). */
|
|
63
|
+
from: z.enum(["flag", "file", "default"])
|
|
64
|
+
});
|
|
65
|
+
var planSchema = z.object({
|
|
66
|
+
/** How many tests `vitest list --json <args>` or `playwright test <args> --list` counted. */
|
|
67
|
+
tests: z.number().int().nonnegative(),
|
|
68
|
+
/** How many distinct test files they are in. */
|
|
69
|
+
files: z.number().int().nonnegative(),
|
|
70
|
+
/**
|
|
71
|
+
* Each resource option whose default is a function of the test plan, with its value and where that came from; empty
|
|
72
|
+
* when the run has none.
|
|
73
|
+
*/
|
|
74
|
+
options: z.array(planOptionSchema)
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// src/run-directory/run-record.ts
|
|
78
|
+
var testTotalsSchema = z2.object({
|
|
79
|
+
passed: z2.number().int().nonnegative(),
|
|
80
|
+
failed: z2.number().int().nonnegative(),
|
|
81
|
+
skipped: z2.number().int().nonnegative()
|
|
82
|
+
});
|
|
83
|
+
var endedSchema = z2.object({
|
|
84
|
+
outcome: z2.string(),
|
|
85
|
+
exitCode: z2.number().int().nullable(),
|
|
86
|
+
signal: z2.string().nullable(),
|
|
87
|
+
ms: z2.number().nonnegative().nullable(),
|
|
88
|
+
tests: testTotalsSchema.nullable(),
|
|
89
|
+
testsIncomplete: z2.string().nullable(),
|
|
90
|
+
resources: z2.record(z2.string(), z2.object({ definition: z2.string(), facts: z2.unknown() })).nullable(),
|
|
91
|
+
resourceRows: z2.array(z2.tuple([z2.string(), z2.union([z2.string(), z2.array(z2.string())])]))
|
|
92
|
+
});
|
|
93
|
+
var snapshotSchema = z2.object({
|
|
94
|
+
id: z2.string(),
|
|
95
|
+
base: z2.string(),
|
|
96
|
+
built: z2.boolean(),
|
|
97
|
+
builtBehind: z2.number().nullable()
|
|
98
|
+
});
|
|
99
|
+
var whereSchema = z2.discriminatedUnion("kind", [
|
|
100
|
+
z2.object({ kind: z2.literal("unsandboxed") }),
|
|
101
|
+
z2.object({
|
|
102
|
+
kind: z2.literal("runner"),
|
|
103
|
+
team: z2.string(),
|
|
104
|
+
project: z2.string(),
|
|
105
|
+
region: z2.string(),
|
|
106
|
+
runtime: z2.string(),
|
|
107
|
+
vcpus: z2.number().int().positive(),
|
|
108
|
+
base: z2.string(),
|
|
109
|
+
baseRef: z2.string(),
|
|
110
|
+
sandbox: z2.string().nullable(),
|
|
111
|
+
snapshot: snapshotSchema.nullable(),
|
|
112
|
+
keptUntil: z2.string().nullable(),
|
|
113
|
+
uploadBytes: z2.number().nullable()
|
|
114
|
+
})
|
|
115
|
+
]);
|
|
116
|
+
var gitSchema = z2.object({ branch: z2.string().nullable(), commit: z2.string(), dirty: z2.boolean() });
|
|
117
|
+
var runRecordSchema = z2.object({
|
|
118
|
+
version: z2.literal(5),
|
|
119
|
+
startedAt: z2.string(),
|
|
120
|
+
cwd: z2.string(),
|
|
121
|
+
configFile: z2.string().nullable(),
|
|
122
|
+
argv: z2.array(z2.string()).readonly(),
|
|
123
|
+
// Only a `storm vitest` run has one.
|
|
124
|
+
plan: planSchema.exactOptional(),
|
|
125
|
+
where: whereSchema,
|
|
126
|
+
git: gitSchema.nullable(),
|
|
127
|
+
ended: endedSchema.exactOptional()
|
|
128
|
+
});
|
|
129
|
+
function runRecordText(record) {
|
|
130
|
+
return JSON.stringify(record);
|
|
131
|
+
}
|
|
132
|
+
function parseRunRecord(text) {
|
|
133
|
+
if (text === void 0) return void 0;
|
|
134
|
+
let json;
|
|
135
|
+
try {
|
|
136
|
+
json = JSON.parse(text);
|
|
137
|
+
} catch {
|
|
138
|
+
return void 0;
|
|
139
|
+
}
|
|
140
|
+
const parsed = runRecordSchema.safeParse(json);
|
|
141
|
+
return parsed.success ? parsed.data : void 0;
|
|
142
|
+
}
|
|
143
|
+
function testTotals(events) {
|
|
144
|
+
let passed = 0;
|
|
145
|
+
let failed = 0;
|
|
146
|
+
let skipped = 0;
|
|
147
|
+
let any = false;
|
|
148
|
+
for (const event of events) {
|
|
149
|
+
if (event.kind !== "test-result") continue;
|
|
150
|
+
any = true;
|
|
151
|
+
if (event.state === "pass") passed += 1;
|
|
152
|
+
else if (event.state === "fail") failed += 1;
|
|
153
|
+
else skipped += 1;
|
|
154
|
+
}
|
|
155
|
+
return any ? { passed, failed, skipped } : null;
|
|
156
|
+
}
|
|
157
|
+
function runEnd(outcome, ran, tests, reports) {
|
|
158
|
+
const command = outcome.kind === "ran" ? outcome.command : void 0;
|
|
159
|
+
const ranRecords = outcome.kind === "ran" ? outcome.resources : void 0;
|
|
160
|
+
const ms = ran?.outcome === void 0 || ran.outcome === "stopped" || ran.endedAt === void 0 ? null : ran.endedAt - ran.startedAt;
|
|
161
|
+
return {
|
|
162
|
+
outcome: outcome.kind,
|
|
163
|
+
exitCode: command === void 0 ? null : commandExitStatus(command),
|
|
164
|
+
signal: command?.kind === "signaled" ? command.signal : null,
|
|
165
|
+
ms,
|
|
166
|
+
tests: testTotals(tests.events),
|
|
167
|
+
testsIncomplete: tests.incomplete ?? null,
|
|
168
|
+
resources: ranRecords === void 0 ? null : reports.ranFacts(ranRecords),
|
|
169
|
+
resourceRows: ranRecords === void 0 ? [] : reports.ranRows(ranRecords)
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function startedWhere(run) {
|
|
173
|
+
if (run.runner === void 0) return { kind: "unsandboxed" };
|
|
174
|
+
const { prepared, target } = run.runner;
|
|
175
|
+
return {
|
|
176
|
+
kind: "runner",
|
|
177
|
+
team: target.team,
|
|
178
|
+
project: target.project,
|
|
179
|
+
region: prepared.recipe.region,
|
|
180
|
+
runtime: prepared.recipe.runtime,
|
|
181
|
+
vcpus: prepared.vcpus,
|
|
182
|
+
base: prepared.base,
|
|
183
|
+
baseRef: prepared.baseRef,
|
|
184
|
+
sandbox: null,
|
|
185
|
+
snapshot: null,
|
|
186
|
+
keptUntil: null,
|
|
187
|
+
uploadBytes: null
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function endedWhere(where, runner) {
|
|
191
|
+
if (where.kind === "unsandboxed") return where;
|
|
192
|
+
const snapshot = runner?.snapshot;
|
|
193
|
+
return {
|
|
194
|
+
...where,
|
|
195
|
+
sandbox: runner?.sandbox?.name ?? null,
|
|
196
|
+
snapshot: snapshot === void 0 || snapshot.kind === "building" ? null : {
|
|
197
|
+
id: snapshot.id,
|
|
198
|
+
base: snapshot.base,
|
|
199
|
+
built: snapshot.kind === "built",
|
|
200
|
+
builtBehind: snapshot.builtBehind
|
|
201
|
+
},
|
|
202
|
+
keptUntil: runner?.kept?.stopsAt ?? null,
|
|
203
|
+
uploadBytes: runner?.uploadBytes ?? null
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/run-directory/timeline-facts.ts
|
|
208
|
+
import { z as z3 } from "zod";
|
|
209
|
+
var rowRefShape = {
|
|
210
|
+
/** The row's name: `mint`, a resource lane's name, `runner`, `tests` or `cleanup`. */
|
|
211
|
+
name: z3.string(),
|
|
212
|
+
/** For a resource instance's lane, the resource key; null for every other row. */
|
|
213
|
+
resource: z3.string().nullable()
|
|
214
|
+
};
|
|
215
|
+
var timelineOutcomeSchema = z3.enum(["done", "failed", "stopped", "unfinished"]);
|
|
216
|
+
var timelineSchema = z3.object({
|
|
217
|
+
/** When the run started, as an ISO time. */
|
|
218
|
+
startedAt: z3.string(),
|
|
219
|
+
/** From the run's start to its last event. */
|
|
220
|
+
totalMs: z3.number(),
|
|
221
|
+
/**
|
|
222
|
+
* The lanes in order: mint, each resource instance's lane, runner, tests, cleanup; each only when the run got that
|
|
223
|
+
* far.
|
|
224
|
+
*/
|
|
225
|
+
rows: z3.array(
|
|
226
|
+
z3.object({
|
|
227
|
+
...rowRefShape,
|
|
228
|
+
/** The row's label, as the waterfall named it when the run ended, such as `credential` or `runner-setup`. */
|
|
229
|
+
label: z3.string(),
|
|
230
|
+
startMs: z3.number(),
|
|
231
|
+
endMs: z3.number(),
|
|
232
|
+
outcome: timelineOutcomeSchema,
|
|
233
|
+
/** The lane's steps: a resource lane's, as its presentation named them, and the runner's snapshot, start, upload, apply, install and build. */
|
|
234
|
+
steps: z3.array(
|
|
235
|
+
z3.object({
|
|
236
|
+
name: z3.string(),
|
|
237
|
+
startMs: z3.number(),
|
|
238
|
+
endMs: z3.number(),
|
|
239
|
+
outcome: timelineOutcomeSchema,
|
|
240
|
+
/** The runner's upload step's: how many bytes of changes it uploaded; absent on any other step and in a timeline written before storm recorded it. */
|
|
241
|
+
bytes: z3.number().optional()
|
|
242
|
+
})
|
|
243
|
+
),
|
|
244
|
+
/** How long the lane, once ready, waited for the other before the command started. */
|
|
245
|
+
idleMs: z3.number(),
|
|
246
|
+
/** The runner lane's: whether it reused or built its runner snapshot. */
|
|
247
|
+
snapshot: z3.enum(["reused", "built"]).optional(),
|
|
248
|
+
/** A resource lane's that counts them: how many of the things it holds it reused, and how many it created. */
|
|
249
|
+
sandboxes: z3.object({ reused: z3.number(), created: z3.number() }).optional()
|
|
250
|
+
})
|
|
251
|
+
),
|
|
252
|
+
/** The lanes the command waited on, then the command, each by its row; empty when the command didn't start. */
|
|
253
|
+
criticalPath: z3.array(z3.object(rowRefShape))
|
|
254
|
+
});
|
|
255
|
+
function timelineFacts(timeline, laneKinds) {
|
|
256
|
+
return {
|
|
257
|
+
startedAt: timeline.startedAt,
|
|
258
|
+
totalMs: timeline.totalMs,
|
|
259
|
+
rows: timeline.rows.map((row) => ({
|
|
260
|
+
...row,
|
|
261
|
+
label: laneLabel(row.name, laneKinds),
|
|
262
|
+
steps: row.steps.map((step) => ({ ...step }))
|
|
263
|
+
})),
|
|
264
|
+
criticalPath: timeline.criticalPath.map((step) => ({ ...step }))
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function laneLabel(name, laneKinds) {
|
|
268
|
+
if (name === "mint") return "credential";
|
|
269
|
+
if (name === "runner") return "runner-setup";
|
|
270
|
+
return laneKinds.find(({ lane }) => lane === name)?.label ?? name;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
// src/run-directory/reader.ts
|
|
274
|
+
function pastRuns(gateway) {
|
|
275
|
+
return {
|
|
276
|
+
list: async (request) => {
|
|
277
|
+
const listed = await gateway.list(request);
|
|
278
|
+
return listed.ok ? { ok: true, runs: listed.runs.map(listedRun) } : listed;
|
|
279
|
+
},
|
|
280
|
+
read: async (request) => {
|
|
281
|
+
const read2 = await gateway.read(request);
|
|
282
|
+
return read2.kind === "found" ? { kind: "found", run: pastRun(read2.directory) } : read2;
|
|
283
|
+
},
|
|
284
|
+
readLog: async (request) => await gateway.readLog(request)
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
function listedRun({ id, path, active, run }) {
|
|
288
|
+
return { id, path, active, record: parseRunRecord(run) };
|
|
289
|
+
}
|
|
290
|
+
function pastRun(directory) {
|
|
291
|
+
const parsed = (directory.tests ?? []).map(parseTestEvent);
|
|
292
|
+
return {
|
|
293
|
+
...listedRun(directory),
|
|
294
|
+
finished: directory.tests !== void 0,
|
|
295
|
+
events: parsed.filter((event) => event !== void 0),
|
|
296
|
+
unreadableTestLines: parsed.filter((event) => event === void 0).length,
|
|
297
|
+
timeline: parseTimeline(directory.timeline),
|
|
298
|
+
logs: directory.logs.map((log) => ({ log, path: `${directory.path}/${runLogFile(log)}` }))
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
function parseTimeline(text) {
|
|
302
|
+
if (text === void 0) return void 0;
|
|
303
|
+
let json;
|
|
304
|
+
try {
|
|
305
|
+
json = JSON.parse(text);
|
|
306
|
+
} catch {
|
|
307
|
+
return void 0;
|
|
308
|
+
}
|
|
309
|
+
const parsed = timelineSchema.safeParse(json);
|
|
310
|
+
return parsed.success ? parsed.data : void 0;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// src/run-directory/live/run-directory-gateway.ts
|
|
314
|
+
import { randomBytes } from "node:crypto";
|
|
315
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
316
|
+
import { mkdir, readdir, readFile, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
317
|
+
import { hostname as osHostname } from "node:os";
|
|
318
|
+
import { join as join2 } from "node:path";
|
|
319
|
+
import { z as z4 } from "zod";
|
|
320
|
+
var DIRECTORY_MODE = 448;
|
|
321
|
+
var FILE_MODE = 384;
|
|
322
|
+
var ACTIVE_MARKER_TRUST_MS = 24 * 60 * 60 * 1e3;
|
|
323
|
+
var LIST_BATCH = 32;
|
|
324
|
+
function liveRunDirectoryGateway(options) {
|
|
325
|
+
const holders = {
|
|
326
|
+
self: options.holder ?? { pid: process.pid, hostname: osHostname() },
|
|
327
|
+
isAlive: options.isAlive ?? isAlive
|
|
328
|
+
};
|
|
329
|
+
return {
|
|
330
|
+
open: (request) => open(options.directory, holders, request),
|
|
331
|
+
list: (request) => list(options.directory, holders, request.now),
|
|
332
|
+
read: (request) => read(options.directory, holders, request),
|
|
333
|
+
readLog: (request) => readLog(options.directory, request)
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
function unavailableRunDirectoryGateway(location, reason) {
|
|
337
|
+
const failure = () => ({ path: location, message: reason });
|
|
338
|
+
return {
|
|
339
|
+
open: async () => ({ ok: false, failure: failure() }),
|
|
340
|
+
list: async () => ({ ok: false, failure: failure() }),
|
|
341
|
+
read: async () => ({ kind: "failed", failure: failure() }),
|
|
342
|
+
readLog: async () => ({ kind: "failed", failure: failure() })
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
var markerSchema = z4.object({
|
|
346
|
+
pid: z4.number().int().positive(),
|
|
347
|
+
hostname: z4.string().min(1),
|
|
348
|
+
startedAt: z4.iso.datetime()
|
|
349
|
+
});
|
|
350
|
+
async function open(root, holders, request) {
|
|
351
|
+
const id = `${runIdPrefix(request.startedAt)}-${randomBytes(2).toString("hex")}`;
|
|
352
|
+
const path = join2(root, id);
|
|
353
|
+
const opening = join2(root, `.opening-${id}-${randomBytes(4).toString("hex")}`);
|
|
354
|
+
try {
|
|
355
|
+
await mkdir(root, { recursive: true, mode: DIRECTORY_MODE });
|
|
356
|
+
await mkdir(opening, { mode: DIRECTORY_MODE });
|
|
357
|
+
const marker = { ...holders.self, startedAt: request.startedAt.toISOString() };
|
|
358
|
+
await writeFile(join2(opening, ACTIVE_MARKER), `${JSON.stringify(marker)}
|
|
359
|
+
`, { mode: FILE_MODE, flag: "wx" });
|
|
360
|
+
await writeFile(join2(opening, RUN_FILE), `${request.run}
|
|
361
|
+
`, { mode: FILE_MODE, flag: "wx" });
|
|
362
|
+
await rename(opening, path);
|
|
363
|
+
} catch (error) {
|
|
364
|
+
await rm(opening, { recursive: true, force: true }).catch(() => void 0);
|
|
365
|
+
return { ok: false, failure: { path, message: messageOf(error) } };
|
|
366
|
+
}
|
|
367
|
+
return {
|
|
368
|
+
ok: true,
|
|
369
|
+
directory: runDirectory(path, id),
|
|
370
|
+
pruneFailures: await prune(root, request.keep, holders, request.startedAt)
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
async function prune(root, keep, holders, now) {
|
|
374
|
+
let names;
|
|
375
|
+
try {
|
|
376
|
+
names = (await readdir(root)).filter((name) => RUN_ID_PATTERN.test(name));
|
|
377
|
+
} catch (error) {
|
|
378
|
+
return [{ path: root, message: messageOf(error) }];
|
|
379
|
+
}
|
|
380
|
+
const completed = [];
|
|
381
|
+
for (const name of names) if (!await isActive(join2(root, name), holders, now)) completed.push(name);
|
|
382
|
+
const failures = [];
|
|
383
|
+
const newestFirst = completed.toSorted().toReversed();
|
|
384
|
+
for (const name of newestFirst.slice(keep)) {
|
|
385
|
+
const path = join2(root, name);
|
|
386
|
+
try {
|
|
387
|
+
await rm(path, { recursive: true, force: true });
|
|
388
|
+
} catch (error) {
|
|
389
|
+
failures.push({ path, message: messageOf(error) });
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
const kept = newestFirst.slice(0, keep);
|
|
393
|
+
const leftovers = kept.flatMap(
|
|
394
|
+
(name) => [TEST_EVENTS_STAGING_FILE, TESTS_PARTIAL_FILE].map((file) => join2(root, name, file))
|
|
395
|
+
);
|
|
396
|
+
for (let start = 0; start < leftovers.length; start += LIST_BATCH) {
|
|
397
|
+
const removed = await Promise.all(
|
|
398
|
+
leftovers.slice(start, start + LIST_BATCH).map(async (file) => {
|
|
399
|
+
try {
|
|
400
|
+
await rm(file, { force: true });
|
|
401
|
+
return [];
|
|
402
|
+
} catch (error) {
|
|
403
|
+
return [{ path: file, message: messageOf(error) }];
|
|
404
|
+
}
|
|
405
|
+
})
|
|
406
|
+
);
|
|
407
|
+
failures.push(...removed.flat());
|
|
408
|
+
}
|
|
409
|
+
return failures;
|
|
410
|
+
}
|
|
411
|
+
async function list(root, holders, now) {
|
|
412
|
+
let names;
|
|
413
|
+
try {
|
|
414
|
+
names = (await readdir(root)).filter((name) => RUN_ID_PATTERN.test(name));
|
|
415
|
+
} catch (error) {
|
|
416
|
+
if (errorCode(error) === "ENOENT") return { ok: true, runs: [] };
|
|
417
|
+
return { ok: false, failure: { path: root, message: messageOf(error) } };
|
|
418
|
+
}
|
|
419
|
+
const ordered = names.toSorted().toReversed();
|
|
420
|
+
const runs = [];
|
|
421
|
+
for (let start = 0; start < ordered.length; start += LIST_BATCH) {
|
|
422
|
+
runs.push(
|
|
423
|
+
...await Promise.all(
|
|
424
|
+
ordered.slice(start, start + LIST_BATCH).map(async (id) => {
|
|
425
|
+
const path = join2(root, id);
|
|
426
|
+
const run = await readOptional(join2(path, RUN_FILE));
|
|
427
|
+
return {
|
|
428
|
+
id,
|
|
429
|
+
path,
|
|
430
|
+
active: await isActive(path, holders, now),
|
|
431
|
+
run: run.kind === "found" ? run.text : void 0
|
|
432
|
+
};
|
|
433
|
+
})
|
|
434
|
+
)
|
|
435
|
+
);
|
|
436
|
+
}
|
|
437
|
+
return { ok: true, runs };
|
|
438
|
+
}
|
|
439
|
+
async function read(root, holders, request) {
|
|
440
|
+
if (!RUN_ID_PATTERN.test(request.id)) return { kind: "not-found" };
|
|
441
|
+
const path = join2(root, request.id);
|
|
442
|
+
try {
|
|
443
|
+
if (!(await stat(path)).isDirectory()) return { kind: "not-found" };
|
|
444
|
+
} catch (error) {
|
|
445
|
+
if (errorCode(error) === "ENOENT") return { kind: "not-found" };
|
|
446
|
+
return { kind: "failed", failure: { path, message: messageOf(error) } };
|
|
447
|
+
}
|
|
448
|
+
const [run, tests, timeline] = await Promise.all(
|
|
449
|
+
[RUN_FILE, TESTS_FILE, TIMELINE_FILE].map((name) => readOptional(join2(path, name)))
|
|
450
|
+
);
|
|
451
|
+
for (const file of [run, tests, timeline])
|
|
452
|
+
if (file?.kind === "failed") return { kind: "failed", failure: file.failure };
|
|
453
|
+
const text = (file) => file?.kind === "found" ? file.text : void 0;
|
|
454
|
+
const testsText = text(tests);
|
|
455
|
+
const held = await Promise.all(RUN_LOGS.map(async (log) => await exists(join2(path, runLogFile(log))) ? log : []));
|
|
456
|
+
return {
|
|
457
|
+
kind: "found",
|
|
458
|
+
directory: {
|
|
459
|
+
id: request.id,
|
|
460
|
+
path,
|
|
461
|
+
active: await isActive(path, holders, request.now),
|
|
462
|
+
run: text(run),
|
|
463
|
+
tests: testsText === void 0 ? void 0 : testsText.split("\n").filter((line) => line !== ""),
|
|
464
|
+
timeline: text(timeline),
|
|
465
|
+
logs: held.flat()
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
async function exists(file) {
|
|
470
|
+
try {
|
|
471
|
+
await stat(file);
|
|
472
|
+
return true;
|
|
473
|
+
} catch {
|
|
474
|
+
return false;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
async function readLog(root, request) {
|
|
478
|
+
if (!RUN_ID_PATTERN.test(request.id)) return { kind: "not-found" };
|
|
479
|
+
const file = join2(root, request.id, runLogFile(request.log));
|
|
480
|
+
try {
|
|
481
|
+
return { kind: "found", path: file, text: completeUtf8(await readFile(file)).toString("utf8") };
|
|
482
|
+
} catch (error) {
|
|
483
|
+
if (errorCode(error) === "ENOENT") return { kind: "not-found" };
|
|
484
|
+
return { kind: "failed", failure: { path: file, message: messageOf(error) } };
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
function completeUtf8(bytes) {
|
|
488
|
+
for (let back = 1; back <= Math.min(3, bytes.length); back += 1) {
|
|
489
|
+
const byte = bytes[bytes.length - back] ?? 0;
|
|
490
|
+
if ((byte & 192) === 128) continue;
|
|
491
|
+
const needs = byte >= 240 ? 4 : byte >= 224 ? 3 : byte >= 192 ? 2 : 1;
|
|
492
|
+
return needs > back ? bytes.subarray(0, bytes.length - back) : bytes;
|
|
493
|
+
}
|
|
494
|
+
return bytes;
|
|
495
|
+
}
|
|
496
|
+
async function readOptional(file) {
|
|
497
|
+
try {
|
|
498
|
+
return { kind: "found", text: await readFile(file, "utf8") };
|
|
499
|
+
} catch (error) {
|
|
500
|
+
if (errorCode(error) === "ENOENT") return { kind: "missing" };
|
|
501
|
+
return { kind: "failed", failure: { path: file, message: messageOf(error) } };
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
async function isActive(path, holders, now) {
|
|
505
|
+
const file = join2(path, ACTIVE_MARKER);
|
|
506
|
+
let text;
|
|
507
|
+
try {
|
|
508
|
+
text = await readFile(file, "utf8");
|
|
509
|
+
} catch (error) {
|
|
510
|
+
if (errorCode(error) === "ENOENT") return false;
|
|
511
|
+
return trustedSince(file, now);
|
|
512
|
+
}
|
|
513
|
+
const parsed = markerSchema.safeParse(parseJson(text));
|
|
514
|
+
if (!parsed.success) return trustedSince(file, now);
|
|
515
|
+
const { pid, hostname, startedAt } = parsed.data;
|
|
516
|
+
if (hostname === holders.self.hostname) return holders.isAlive(pid);
|
|
517
|
+
return now.getTime() - Date.parse(startedAt) < ACTIVE_MARKER_TRUST_MS;
|
|
518
|
+
}
|
|
519
|
+
async function trustedSince(file, now) {
|
|
520
|
+
try {
|
|
521
|
+
return now.getTime() - (await stat(file)).mtime.getTime() < ACTIVE_MARKER_TRUST_MS;
|
|
522
|
+
} catch {
|
|
523
|
+
return false;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
function parseJson(text) {
|
|
527
|
+
try {
|
|
528
|
+
return JSON.parse(text);
|
|
529
|
+
} catch {
|
|
530
|
+
return void 0;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
function isAlive(pid) {
|
|
534
|
+
try {
|
|
535
|
+
process.kill(pid, 0);
|
|
536
|
+
return true;
|
|
537
|
+
} catch (error) {
|
|
538
|
+
return errorCode(error) !== "ESRCH";
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function errorCode(error) {
|
|
542
|
+
return error instanceof Error && "code" in error && typeof error.code === "string" ? error.code : void 0;
|
|
543
|
+
}
|
|
544
|
+
function runDirectory(path, id) {
|
|
545
|
+
const streams = /* @__PURE__ */ new Map();
|
|
546
|
+
let failure;
|
|
547
|
+
let closed = false;
|
|
548
|
+
let testsPublished = false;
|
|
549
|
+
let changing = Promise.resolve();
|
|
550
|
+
const inTurn = (file, change) => {
|
|
551
|
+
if (failure !== void 0 || closed) return;
|
|
552
|
+
changing = changing.then(async () => {
|
|
553
|
+
if (failure !== void 0) return;
|
|
554
|
+
try {
|
|
555
|
+
await change();
|
|
556
|
+
} catch (error) {
|
|
557
|
+
failure ??= { path: file, message: messageOf(error) };
|
|
558
|
+
}
|
|
559
|
+
});
|
|
560
|
+
};
|
|
561
|
+
const replace = (name, text) => {
|
|
562
|
+
const file = join2(path, name);
|
|
563
|
+
inTurn(file, async () => {
|
|
564
|
+
const temporary = join2(path, `.${name}.${randomBytes(4).toString("hex")}.tmp`);
|
|
565
|
+
try {
|
|
566
|
+
await writeFile(temporary, text, { mode: FILE_MODE, flag: "wx" });
|
|
567
|
+
await rename(temporary, file);
|
|
568
|
+
} catch (error) {
|
|
569
|
+
await rm(temporary, { force: true }).catch(() => void 0);
|
|
570
|
+
throw error;
|
|
571
|
+
}
|
|
572
|
+
});
|
|
573
|
+
};
|
|
574
|
+
const stream = (name) => {
|
|
575
|
+
if (failure !== void 0 || closed) return void 0;
|
|
576
|
+
let opened = streams.get(name);
|
|
577
|
+
if (opened === void 0) {
|
|
578
|
+
const file = join2(path, name);
|
|
579
|
+
opened = createWriteStream(file, { flags: "a", mode: FILE_MODE });
|
|
580
|
+
opened.on("error", (error) => {
|
|
581
|
+
failure ??= { path: file, message: messageOf(error) };
|
|
582
|
+
});
|
|
583
|
+
streams.set(name, opened);
|
|
584
|
+
}
|
|
585
|
+
return opened;
|
|
586
|
+
};
|
|
587
|
+
const append = (name, text) => void stream(name)?.write(text);
|
|
588
|
+
const endStream = async (name) => {
|
|
589
|
+
const opened = streams.get(name);
|
|
590
|
+
if (opened === void 0) return;
|
|
591
|
+
streams.delete(name);
|
|
592
|
+
await ended(opened);
|
|
593
|
+
};
|
|
594
|
+
return {
|
|
595
|
+
path,
|
|
596
|
+
id,
|
|
597
|
+
writeRun: (text) => replace(RUN_FILE, `${text}
|
|
598
|
+
`),
|
|
599
|
+
appendEvent: (line) => append(EVENTS_FILE, `${line}
|
|
600
|
+
`),
|
|
601
|
+
appendStepOutput: (step, line) => append(runLogFile(step), `${line}
|
|
602
|
+
`),
|
|
603
|
+
appendCommandOutput: (text) => append(COMMAND_LOG, text),
|
|
604
|
+
appendTestEvent: (line) => {
|
|
605
|
+
if (!testsPublished) append(TESTS_PARTIAL_FILE, `${line}
|
|
606
|
+
`);
|
|
607
|
+
},
|
|
608
|
+
publishTestEvents: () => {
|
|
609
|
+
if (testsPublished) return;
|
|
610
|
+
testsPublished = true;
|
|
611
|
+
const partial = join2(path, TESTS_PARTIAL_FILE);
|
|
612
|
+
inTurn(join2(path, TESTS_FILE), async () => {
|
|
613
|
+
await endStream(TESTS_PARTIAL_FILE);
|
|
614
|
+
if (failure !== void 0) return;
|
|
615
|
+
await writeFile(partial, "", { mode: FILE_MODE, flag: "a" });
|
|
616
|
+
await rename(partial, join2(path, TESTS_FILE));
|
|
617
|
+
});
|
|
618
|
+
},
|
|
619
|
+
writeTimeline: (text) => replace(TIMELINE_FILE, `${text}
|
|
620
|
+
`),
|
|
621
|
+
readTestEvents: (onLine) => readStagedTestEvents(join2(path, TEST_EVENTS_STAGING_FILE), onLine),
|
|
622
|
+
close: async () => {
|
|
623
|
+
closed = true;
|
|
624
|
+
await changing;
|
|
625
|
+
await Promise.all([...streams.values()].map(ended));
|
|
626
|
+
streams.clear();
|
|
627
|
+
for (const name of [TEST_EVENTS_STAGING_FILE, TESTS_PARTIAL_FILE]) {
|
|
628
|
+
const file = join2(path, name);
|
|
629
|
+
try {
|
|
630
|
+
await rm(file, { force: true });
|
|
631
|
+
} catch (error) {
|
|
632
|
+
failure ??= { path: file, message: messageOf(error) };
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
const marker = join2(path, ACTIVE_MARKER);
|
|
636
|
+
try {
|
|
637
|
+
await unlink(marker);
|
|
638
|
+
} catch (error) {
|
|
639
|
+
failure ??= { path: marker, message: messageOf(error) };
|
|
640
|
+
}
|
|
641
|
+
return failure;
|
|
642
|
+
}
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
function ended(stream) {
|
|
646
|
+
return new Promise((resolve) => {
|
|
647
|
+
if (stream.closed || stream.destroyed) resolve();
|
|
648
|
+
else {
|
|
649
|
+
stream.once("close", () => resolve());
|
|
650
|
+
stream.end();
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
async function readStagedTestEvents(file, onLine) {
|
|
655
|
+
let pending = "";
|
|
656
|
+
try {
|
|
657
|
+
for await (const chunk of createReadStream(file, { encoding: "utf8" })) {
|
|
658
|
+
const lines = `${pending}${String(chunk)}`.split("\n");
|
|
659
|
+
pending = lines.pop() ?? "";
|
|
660
|
+
for (const line of lines) if (line !== "") onLine(line);
|
|
661
|
+
}
|
|
662
|
+
if (pending !== "") onLine(pending);
|
|
663
|
+
return { ok: true };
|
|
664
|
+
} catch (error) {
|
|
665
|
+
if (errorCode(error) === "ENOENT") return { ok: true };
|
|
666
|
+
return { ok: false, failure: { path: file, message: messageOf(error) } };
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
function messageOf(error) {
|
|
670
|
+
return error instanceof Error ? error.message : String(error);
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// src/run-directory/run-collector.ts
|
|
674
|
+
function runCollector(definitionSet, directory) {
|
|
675
|
+
let state = EMPTY_RUN_STATE;
|
|
676
|
+
const events = [];
|
|
677
|
+
let unreadable = 0;
|
|
678
|
+
let incomplete;
|
|
679
|
+
let workerOffsetMs = Infinity;
|
|
680
|
+
const collect = (event) => {
|
|
681
|
+
directory?.appendTestEvent(testEventLine(event));
|
|
682
|
+
events.push(summaryEvent(event));
|
|
683
|
+
};
|
|
684
|
+
return {
|
|
685
|
+
observer: {
|
|
686
|
+
observe: async (timed) => {
|
|
687
|
+
const { event } = timed;
|
|
688
|
+
if (event.kind === "runner" && event.event.kind === "step-output") return;
|
|
689
|
+
state = definitionSet.applyEvent(state, timed);
|
|
690
|
+
if (event.kind === "test") {
|
|
691
|
+
collect(event.event);
|
|
692
|
+
if (event.event.kind !== "test-result")
|
|
693
|
+
workerOffsetMs = Math.min(workerOffsetMs, timed.at.getTime() - event.event.at);
|
|
694
|
+
} else if (event.kind === "test-event-unreadable") unreadable += 1;
|
|
695
|
+
else if (event.kind === "test-events-incomplete") incomplete ??= event.message;
|
|
696
|
+
}
|
|
697
|
+
},
|
|
698
|
+
readStaged: async (runDirectory2, redact) => {
|
|
699
|
+
const read2 = await runDirectory2.readTestEvents((line) => {
|
|
700
|
+
const event = parseTestEvent(line);
|
|
701
|
+
if (event === void 0) unreadable += 1;
|
|
702
|
+
else collect(redact(event));
|
|
703
|
+
});
|
|
704
|
+
if (!read2.ok) incomplete ??= read2.failure.message;
|
|
705
|
+
},
|
|
706
|
+
finish: () => ({
|
|
707
|
+
state,
|
|
708
|
+
tests: { events, unreadable, incomplete },
|
|
709
|
+
workerOffsetMs: workerOffsetMs === Infinity ? 0 : workerOffsetMs
|
|
710
|
+
})
|
|
711
|
+
};
|
|
712
|
+
}
|
|
713
|
+
function summaryEvent(event) {
|
|
714
|
+
if (event.kind !== "test-result") return event;
|
|
715
|
+
return {
|
|
716
|
+
kind: event.kind,
|
|
717
|
+
id: event.id,
|
|
718
|
+
file: event.file,
|
|
719
|
+
test: event.test,
|
|
720
|
+
state: event.state,
|
|
721
|
+
retryCount: event.retryCount,
|
|
722
|
+
flaky: event.flaky,
|
|
723
|
+
at: event.at
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// src/run-directory/recording.ts
|
|
728
|
+
async function recordRun(gateway, start) {
|
|
729
|
+
const { definitionSet } = start;
|
|
730
|
+
const record = start.redact({
|
|
731
|
+
version: 5,
|
|
732
|
+
startedAt: start.startedAt.toISOString(),
|
|
733
|
+
cwd: start.cwd,
|
|
734
|
+
configFile: start.configFile,
|
|
735
|
+
argv: start.argv,
|
|
736
|
+
...start.plan === void 0 ? {} : { plan: start.plan },
|
|
737
|
+
where: startedWhere(start.run),
|
|
738
|
+
git: start.git
|
|
739
|
+
});
|
|
740
|
+
const result = await gateway.open({
|
|
741
|
+
startedAt: start.startedAt,
|
|
742
|
+
keep: RUN_DIRECTORIES_KEPT,
|
|
743
|
+
run: runRecordText(record)
|
|
744
|
+
});
|
|
745
|
+
const directory = result.ok ? result.directory : void 0;
|
|
746
|
+
const opened = result.ok ? { ok: true, id: result.directory.id, path: result.directory.path, pruneFailures: result.pruneFailures } : { ok: false, failure: result.failure };
|
|
747
|
+
const collector = runCollector(definitionSet, directory);
|
|
748
|
+
return {
|
|
749
|
+
opened,
|
|
750
|
+
testEvents: directory === void 0 ? void 0 : testEventsPath(directory.path),
|
|
751
|
+
observer: (beside) => directory === void 0 ? observeAll(collector.observer, beside) : observeAll(collector.observer, beside, runDirectoryObserver(directory)),
|
|
752
|
+
terminal: (terminal) => directory === void 0 ? terminal : {
|
|
753
|
+
color: terminal.color,
|
|
754
|
+
writeStdout: (text) => {
|
|
755
|
+
directory.appendCommandOutput(text);
|
|
756
|
+
terminal.writeStdout(text);
|
|
757
|
+
},
|
|
758
|
+
writeStderr: (text) => {
|
|
759
|
+
directory.appendCommandOutput(text);
|
|
760
|
+
terminal.writeStderr(text);
|
|
761
|
+
}
|
|
762
|
+
},
|
|
763
|
+
stepLog: (step) => directory === void 0 ? void 0 : stepLog(directory.path, step),
|
|
764
|
+
end: async (outcome) => {
|
|
765
|
+
if (directory !== void 0) await collector.readStaged(directory, start.redact);
|
|
766
|
+
const { state, tests, workerOffsetMs } = collector.finish();
|
|
767
|
+
const timeline = timelineFacts(definitionSet.timeline(state), definitionSet.presentations.laneKinds);
|
|
768
|
+
directory?.publishTestEvents();
|
|
769
|
+
directory?.writeTimeline(JSON.stringify(timeline, null, 2));
|
|
770
|
+
directory?.writeRun(
|
|
771
|
+
runRecordText({
|
|
772
|
+
...record,
|
|
773
|
+
where: endedWhere(record.where, state.runner),
|
|
774
|
+
ended: runEnd(outcome, state.command, tests, definitionSet.reports)
|
|
775
|
+
})
|
|
776
|
+
);
|
|
777
|
+
const writeFailure = await directory?.close();
|
|
778
|
+
return { state, timeline, tests, workerOffsetMs, writeFailure };
|
|
779
|
+
},
|
|
780
|
+
abandon: async () => {
|
|
781
|
+
await directory?.close();
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
export {
|
|
787
|
+
RUNS_SUBPATH,
|
|
788
|
+
liveRunDirectoryGateway,
|
|
789
|
+
unavailableRunDirectoryGateway,
|
|
790
|
+
planSchema,
|
|
791
|
+
timelineSchema,
|
|
792
|
+
recordRun,
|
|
793
|
+
pastRuns
|
|
794
|
+
};
|