@opensip-cli/simulation 0.1.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/LICENSE +202 -0
- package/NOTICE +8 -0
- package/README.md +31 -0
- package/dist/__tests__/internal-surface.test.d.ts +9 -0
- package/dist/__tests__/internal-surface.test.d.ts.map +1 -0
- package/dist/__tests__/internal-surface.test.js +38 -0
- package/dist/__tests__/internal-surface.test.js.map +1 -0
- package/dist/__tests__/plugin-loader.test.d.ts +2 -0
- package/dist/__tests__/plugin-loader.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-loader.test.js +64 -0
- package/dist/__tests__/plugin-loader.test.js.map +1 -0
- package/dist/__tests__/public-api.test.d.ts +15 -0
- package/dist/__tests__/public-api.test.d.ts.map +1 -0
- package/dist/__tests__/public-api.test.js +73 -0
- package/dist/__tests__/public-api.test.js.map +1 -0
- package/dist/__tests__/registry-cross-kind.test.d.ts +6 -0
- package/dist/__tests__/registry-cross-kind.test.d.ts.map +1 -0
- package/dist/__tests__/registry-cross-kind.test.js +86 -0
- package/dist/__tests__/registry-cross-kind.test.js.map +1 -0
- package/dist/__tests__/scenario-execution.test.d.ts +10 -0
- package/dist/__tests__/scenario-execution.test.d.ts.map +1 -0
- package/dist/__tests__/scenario-execution.test.js +92 -0
- package/dist/__tests__/scenario-execution.test.js.map +1 -0
- package/dist/__tests__/sim-capability-contract.test.d.ts +10 -0
- package/dist/__tests__/sim-capability-contract.test.d.ts.map +1 -0
- package/dist/__tests__/sim-capability-contract.test.js +131 -0
- package/dist/__tests__/sim-capability-contract.test.js.map +1 -0
- package/dist/__tests__/sim-config-schema.test.d.ts +5 -0
- package/dist/__tests__/sim-config-schema.test.d.ts.map +1 -0
- package/dist/__tests__/sim-config-schema.test.js +23 -0
- package/dist/__tests__/sim-config-schema.test.js.map +1 -0
- package/dist/__tests__/sim-failure-signal.test.d.ts +10 -0
- package/dist/__tests__/sim-failure-signal.test.d.ts.map +1 -0
- package/dist/__tests__/sim-failure-signal.test.js +86 -0
- package/dist/__tests__/sim-failure-signal.test.js.map +1 -0
- package/dist/__tests__/surviving-surface-edges.test.d.ts +10 -0
- package/dist/__tests__/surviving-surface-edges.test.d.ts.map +1 -0
- package/dist/__tests__/surviving-surface-edges.test.js +122 -0
- package/dist/__tests__/surviving-surface-edges.test.js.map +1 -0
- package/dist/__tests__/test-utils/targets.d.ts +26 -0
- package/dist/__tests__/test-utils/targets.d.ts.map +1 -0
- package/dist/__tests__/test-utils/targets.js +38 -0
- package/dist/__tests__/test-utils/targets.js.map +1 -0
- package/dist/__tests__/test-utils/with-sim-scope.d.ts +12 -0
- package/dist/__tests__/test-utils/with-sim-scope.d.ts.map +1 -0
- package/dist/__tests__/test-utils/with-sim-scope.js +22 -0
- package/dist/__tests__/test-utils/with-sim-scope.js.map +1 -0
- package/dist/__tests__/tool-live-view.test.d.ts +20 -0
- package/dist/__tests__/tool-live-view.test.d.ts.map +1 -0
- package/dist/__tests__/tool-live-view.test.js +146 -0
- package/dist/__tests__/tool-live-view.test.js.map +1 -0
- package/dist/__tests__/tool-show-mode.test.d.ts +10 -0
- package/dist/__tests__/tool-show-mode.test.d.ts.map +1 -0
- package/dist/__tests__/tool-show-mode.test.js +156 -0
- package/dist/__tests__/tool-show-mode.test.js.map +1 -0
- package/dist/__tests__/tool.test.d.ts +15 -0
- package/dist/__tests__/tool.test.d.ts.map +1 -0
- package/dist/__tests__/tool.test.js +250 -0
- package/dist/__tests__/tool.test.js.map +1 -0
- package/dist/cli/__tests__/sim-config.test.d.ts +2 -0
- package/dist/cli/__tests__/sim-config.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-config.test.js +94 -0
- package/dist/cli/__tests__/sim-config.test.js.map +1 -0
- package/dist/cli/__tests__/sim-runner.test.d.ts +23 -0
- package/dist/cli/__tests__/sim-runner.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-runner.test.js +188 -0
- package/dist/cli/__tests__/sim-runner.test.js.map +1 -0
- package/dist/cli/__tests__/sim-worker.test.d.ts +12 -0
- package/dist/cli/__tests__/sim-worker.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim-worker.test.js +69 -0
- package/dist/cli/__tests__/sim-worker.test.js.map +1 -0
- package/dist/cli/__tests__/sim.test.d.ts +2 -0
- package/dist/cli/__tests__/sim.test.d.ts.map +1 -0
- package/dist/cli/__tests__/sim.test.js +232 -0
- package/dist/cli/__tests__/sim.test.js.map +1 -0
- package/dist/cli/sim-config-schema.d.ts +30 -0
- package/dist/cli/sim-config-schema.d.ts.map +1 -0
- package/dist/cli/sim-config-schema.js +33 -0
- package/dist/cli/sim-config-schema.js.map +1 -0
- package/dist/cli/sim-config.d.ts +22 -0
- package/dist/cli/sim-config.d.ts.map +1 -0
- package/dist/cli/sim-config.js +73 -0
- package/dist/cli/sim-config.js.map +1 -0
- package/dist/cli/sim-runner.d.ts +60 -0
- package/dist/cli/sim-runner.d.ts.map +1 -0
- package/dist/cli/sim-runner.js +175 -0
- package/dist/cli/sim-runner.js.map +1 -0
- package/dist/cli/sim-worker.d.ts +24 -0
- package/dist/cli/sim-worker.d.ts.map +1 -0
- package/dist/cli/sim-worker.js +65 -0
- package/dist/cli/sim-worker.js.map +1 -0
- package/dist/cli/sim.d.ts +56 -0
- package/dist/cli/sim.d.ts.map +1 -0
- package/dist/cli/sim.js +265 -0
- package/dist/cli/sim.js.map +1 -0
- package/dist/framework/__tests__/assertions.test.d.ts +2 -0
- package/dist/framework/__tests__/assertions.test.d.ts.map +1 -0
- package/dist/framework/__tests__/assertions.test.js +122 -0
- package/dist/framework/__tests__/assertions.test.js.map +1 -0
- package/dist/framework/__tests__/misc-coverage.test.d.ts +18 -0
- package/dist/framework/__tests__/misc-coverage.test.d.ts.map +1 -0
- package/dist/framework/__tests__/misc-coverage.test.js +142 -0
- package/dist/framework/__tests__/misc-coverage.test.js.map +1 -0
- package/dist/framework/__tests__/resolve-metric.test.d.ts +12 -0
- package/dist/framework/__tests__/resolve-metric.test.d.ts.map +1 -0
- package/dist/framework/__tests__/resolve-metric.test.js +124 -0
- package/dist/framework/__tests__/resolve-metric.test.js.map +1 -0
- package/dist/framework/__tests__/result-builder.test.d.ts +2 -0
- package/dist/framework/__tests__/result-builder.test.d.ts.map +1 -0
- package/dist/framework/__tests__/result-builder.test.js +180 -0
- package/dist/framework/__tests__/result-builder.test.js.map +1 -0
- package/dist/framework/__tests__/scenario-logger.test.d.ts +9 -0
- package/dist/framework/__tests__/scenario-logger.test.d.ts.map +1 -0
- package/dist/framework/__tests__/scenario-logger.test.js +110 -0
- package/dist/framework/__tests__/scenario-logger.test.js.map +1 -0
- package/dist/framework/__tests__/validation.test.d.ts +9 -0
- package/dist/framework/__tests__/validation.test.d.ts.map +1 -0
- package/dist/framework/__tests__/validation.test.js +126 -0
- package/dist/framework/__tests__/validation.test.js.map +1 -0
- package/dist/framework/assertions.d.ts +106 -0
- package/dist/framework/assertions.d.ts.map +1 -0
- package/dist/framework/assertions.js +256 -0
- package/dist/framework/assertions.js.map +1 -0
- package/dist/framework/execution/__tests__/execution-engine.test.d.ts +9 -0
- package/dist/framework/execution/__tests__/execution-engine.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/execution-engine.test.js +138 -0
- package/dist/framework/execution/__tests__/execution-engine.test.js.map +1 -0
- package/dist/framework/execution/__tests__/fault-builders.test.d.ts +5 -0
- package/dist/framework/execution/__tests__/fault-builders.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/fault-builders.test.js +23 -0
- package/dist/framework/execution/__tests__/fault-builders.test.js.map +1 -0
- package/dist/framework/execution/__tests__/fault-model.test.d.ts +6 -0
- package/dist/framework/execution/__tests__/fault-model.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/fault-model.test.js +64 -0
- package/dist/framework/execution/__tests__/fault-model.test.js.map +1 -0
- package/dist/framework/execution/__tests__/http-target.test.d.ts +5 -0
- package/dist/framework/execution/__tests__/http-target.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/http-target.test.js +36 -0
- package/dist/framework/execution/__tests__/http-target.test.js.map +1 -0
- package/dist/framework/execution/__tests__/run-load-window.test.d.ts +7 -0
- package/dist/framework/execution/__tests__/run-load-window.test.d.ts.map +1 -0
- package/dist/framework/execution/__tests__/run-load-window.test.js +89 -0
- package/dist/framework/execution/__tests__/run-load-window.test.js.map +1 -0
- package/dist/framework/execution/execution-engine.d.ts +55 -0
- package/dist/framework/execution/execution-engine.d.ts.map +1 -0
- package/dist/framework/execution/execution-engine.js +111 -0
- package/dist/framework/execution/execution-engine.js.map +1 -0
- package/dist/framework/execution/fault-builders.d.ts +26 -0
- package/dist/framework/execution/fault-builders.d.ts.map +1 -0
- package/dist/framework/execution/fault-builders.js +24 -0
- package/dist/framework/execution/fault-builders.js.map +1 -0
- package/dist/framework/execution/fault-model.d.ts +49 -0
- package/dist/framework/execution/fault-model.d.ts.map +1 -0
- package/dist/framework/execution/fault-model.js +108 -0
- package/dist/framework/execution/fault-model.js.map +1 -0
- package/dist/framework/execution/fault-spec.d.ts +40 -0
- package/dist/framework/execution/fault-spec.d.ts.map +1 -0
- package/dist/framework/execution/fault-spec.js +23 -0
- package/dist/framework/execution/fault-spec.js.map +1 -0
- package/dist/framework/execution/http-target.d.ts +34 -0
- package/dist/framework/execution/http-target.d.ts.map +1 -0
- package/dist/framework/execution/http-target.js +41 -0
- package/dist/framework/execution/http-target.js.map +1 -0
- package/dist/framework/execution/latency-tracker.d.ts +44 -0
- package/dist/framework/execution/latency-tracker.d.ts.map +1 -0
- package/dist/framework/execution/latency-tracker.js +76 -0
- package/dist/framework/execution/latency-tracker.js.map +1 -0
- package/dist/framework/execution/run-load-window.d.ts +45 -0
- package/dist/framework/execution/run-load-window.d.ts.map +1 -0
- package/dist/framework/execution/run-load-window.js +136 -0
- package/dist/framework/execution/run-load-window.js.map +1 -0
- package/dist/framework/execution/scenario-aborted-error.d.ts +14 -0
- package/dist/framework/execution/scenario-aborted-error.d.ts.map +1 -0
- package/dist/framework/execution/scenario-aborted-error.js +24 -0
- package/dist/framework/execution/scenario-aborted-error.js.map +1 -0
- package/dist/framework/execution/target.d.ts +35 -0
- package/dist/framework/execution/target.d.ts.map +1 -0
- package/dist/framework/execution/target.js +21 -0
- package/dist/framework/execution/target.js.map +1 -0
- package/dist/framework/registry.d.ts +67 -0
- package/dist/framework/registry.d.ts.map +1 -0
- package/dist/framework/registry.js +113 -0
- package/dist/framework/registry.js.map +1 -0
- package/dist/framework/resolve-metric.d.ts +79 -0
- package/dist/framework/resolve-metric.d.ts.map +1 -0
- package/dist/framework/resolve-metric.js +135 -0
- package/dist/framework/resolve-metric.js.map +1 -0
- package/dist/framework/result-builder.d.ts +72 -0
- package/dist/framework/result-builder.d.ts.map +1 -0
- package/dist/framework/result-builder.js +214 -0
- package/dist/framework/result-builder.js.map +1 -0
- package/dist/framework/result-renderers.d.ts +37 -0
- package/dist/framework/result-renderers.d.ts.map +1 -0
- package/dist/framework/result-renderers.js +62 -0
- package/dist/framework/result-renderers.js.map +1 -0
- package/dist/framework/runnable-scenario.d.ts +37 -0
- package/dist/framework/runnable-scenario.d.ts.map +1 -0
- package/dist/framework/runnable-scenario.js +9 -0
- package/dist/framework/runnable-scenario.js.map +1 -0
- package/dist/framework/scenario-executor-result.d.ts +44 -0
- package/dist/framework/scenario-executor-result.d.ts.map +1 -0
- package/dist/framework/scenario-executor-result.js +13 -0
- package/dist/framework/scenario-executor-result.js.map +1 -0
- package/dist/framework/scenario-logger.d.ts +18 -0
- package/dist/framework/scenario-logger.d.ts.map +1 -0
- package/dist/framework/scenario-logger.js +39 -0
- package/dist/framework/scenario-logger.js.map +1 -0
- package/dist/framework/scenario-metric-key.d.ts +24 -0
- package/dist/framework/scenario-metric-key.d.ts.map +1 -0
- package/dist/framework/scenario-metric-key.js +17 -0
- package/dist/framework/scenario-metric-key.js.map +1 -0
- package/dist/framework/validation.d.ts +83 -0
- package/dist/framework/validation.d.ts.map +1 -0
- package/dist/framework/validation.js +93 -0
- package/dist/framework/validation.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/internal.d.ts +19 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +16 -0
- package/dist/internal.js.map +1 -0
- package/dist/kinds/chaos/__tests__/executor.test.d.ts +6 -0
- package/dist/kinds/chaos/__tests__/executor.test.d.ts.map +1 -0
- package/dist/kinds/chaos/__tests__/executor.test.js +117 -0
- package/dist/kinds/chaos/__tests__/executor.test.js.map +1 -0
- package/dist/kinds/chaos/config.d.ts +48 -0
- package/dist/kinds/chaos/config.d.ts.map +1 -0
- package/dist/kinds/chaos/config.js +15 -0
- package/dist/kinds/chaos/config.js.map +1 -0
- package/dist/kinds/chaos/define.d.ts +32 -0
- package/dist/kinds/chaos/define.d.ts.map +1 -0
- package/dist/kinds/chaos/define.js +111 -0
- package/dist/kinds/chaos/define.js.map +1 -0
- package/dist/kinds/chaos/executor.d.ts +21 -0
- package/dist/kinds/chaos/executor.d.ts.map +1 -0
- package/dist/kinds/chaos/executor.js +107 -0
- package/dist/kinds/chaos/executor.js.map +1 -0
- package/dist/kinds/chaos/result.d.ts +43 -0
- package/dist/kinds/chaos/result.d.ts.map +1 -0
- package/dist/kinds/chaos/result.js +12 -0
- package/dist/kinds/chaos/result.js.map +1 -0
- package/dist/kinds/load/__tests__/executor.test.d.ts +6 -0
- package/dist/kinds/load/__tests__/executor.test.d.ts.map +1 -0
- package/dist/kinds/load/__tests__/executor.test.js +75 -0
- package/dist/kinds/load/__tests__/executor.test.js.map +1 -0
- package/dist/kinds/load/config.d.ts +30 -0
- package/dist/kinds/load/config.d.ts.map +1 -0
- package/dist/kinds/load/config.js +9 -0
- package/dist/kinds/load/config.js.map +1 -0
- package/dist/kinds/load/define.d.ts +47 -0
- package/dist/kinds/load/define.d.ts.map +1 -0
- package/dist/kinds/load/define.js +76 -0
- package/dist/kinds/load/define.js.map +1 -0
- package/dist/kinds/load/executor.d.ts +16 -0
- package/dist/kinds/load/executor.d.ts.map +1 -0
- package/dist/kinds/load/executor.js +90 -0
- package/dist/kinds/load/executor.js.map +1 -0
- package/dist/kinds/load/result.d.ts +21 -0
- package/dist/kinds/load/result.d.ts.map +1 -0
- package/dist/kinds/load/result.js +10 -0
- package/dist/kinds/load/result.js.map +1 -0
- package/dist/persistence/session-payload.d.ts +32 -0
- package/dist/persistence/session-payload.d.ts.map +1 -0
- package/dist/persistence/session-payload.js +46 -0
- package/dist/persistence/session-payload.js.map +1 -0
- package/dist/persistence/session-replay.d.ts +13 -0
- package/dist/persistence/session-replay.d.ts.map +1 -0
- package/dist/persistence/session-replay.js +76 -0
- package/dist/persistence/session-replay.js.map +1 -0
- package/dist/persistence/session-replay.test.d.ts +10 -0
- package/dist/persistence/session-replay.test.d.ts.map +1 -0
- package/dist/persistence/session-replay.test.js +169 -0
- package/dist/persistence/session-replay.test.js.map +1 -0
- package/dist/plugins/__tests__/loader-scenarios.test.d.ts +12 -0
- package/dist/plugins/__tests__/loader-scenarios.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/loader-scenarios.test.js +61 -0
- package/dist/plugins/__tests__/loader-scenarios.test.js.map +1 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts +2 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.d.ts.map +1 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.js +43 -0
- package/dist/plugins/__tests__/scenario-package-discovery.test.js.map +1 -0
- package/dist/plugins/loader.d.ts +32 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +119 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/scenario-package-discovery.d.ts +23 -0
- package/dist/plugins/scenario-package-discovery.d.ts.map +1 -0
- package/dist/plugins/scenario-package-discovery.js +42 -0
- package/dist/plugins/scenario-package-discovery.js.map +1 -0
- package/dist/plugins/types.d.ts +24 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +18 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/recipes/__tests__/recipes.test.d.ts +2 -0
- package/dist/recipes/__tests__/recipes.test.d.ts.map +1 -0
- package/dist/recipes/__tests__/recipes.test.js +515 -0
- package/dist/recipes/__tests__/recipes.test.js.map +1 -0
- package/dist/recipes/built-in-recipes.d.ts +16 -0
- package/dist/recipes/built-in-recipes.d.ts.map +1 -0
- package/dist/recipes/built-in-recipes.js +37 -0
- package/dist/recipes/built-in-recipes.js.map +1 -0
- package/dist/recipes/define-recipe.d.ts +29 -0
- package/dist/recipes/define-recipe.d.ts.map +1 -0
- package/dist/recipes/define-recipe.js +68 -0
- package/dist/recipes/define-recipe.js.map +1 -0
- package/dist/recipes/registry.d.ts +54 -0
- package/dist/recipes/registry.d.ts.map +1 -0
- package/dist/recipes/registry.js +89 -0
- package/dist/recipes/registry.js.map +1 -0
- package/dist/recipes/service.d.ts +61 -0
- package/dist/recipes/service.d.ts.map +1 -0
- package/dist/recipes/service.js +205 -0
- package/dist/recipes/service.js.map +1 -0
- package/dist/recipes/types.d.ts +62 -0
- package/dist/recipes/types.d.ts.map +1 -0
- package/dist/recipes/types.js +10 -0
- package/dist/recipes/types.js.map +1 -0
- package/dist/scaffold/examples.d.ts +22 -0
- package/dist/scaffold/examples.d.ts.map +1 -0
- package/dist/scaffold/examples.js +91 -0
- package/dist/scaffold/examples.js.map +1 -0
- package/dist/scope-augmentation.d.ts +70 -0
- package/dist/scope-augmentation.d.ts.map +1 -0
- package/dist/scope-augmentation.js +28 -0
- package/dist/scope-augmentation.js.map +1 -0
- package/dist/tool.d.ts +21 -0
- package/dist/tool.d.ts.map +1 -0
- package/dist/tool.js +347 -0
- package/dist/tool.js.map +1 -0
- package/dist/types/base-types.d.ts +35 -0
- package/dist/types/base-types.d.ts.map +1 -0
- package/dist/types/base-types.js +8 -0
- package/dist/types/base-types.js.map +1 -0
- package/dist/types/framework-types.d.ts +62 -0
- package/dist/types/framework-types.d.ts.map +1 -0
- package/dist/types/framework-types.js +15 -0
- package/dist/types/framework-types.js.map +1 -0
- package/dist/types/kind-types.d.ts +24 -0
- package/dist/types/kind-types.d.ts.map +1 -0
- package/dist/types/kind-types.js +22 -0
- package/dist/types/kind-types.js.map +1 -0
- package/dist/types/workload.d.ts +30 -0
- package/dist/types/workload.d.ts.map +1 -0
- package/dist/types/workload.js +20 -0
- package/dist/types/workload.js.map +1 -0
- package/package.json +120 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* sim-runner — owns the live-view state machine for `opensip sim`
|
|
4
|
+
* (ADR-0016). Before this, sim had NO live view: it ran to completion silently
|
|
5
|
+
* and printed a static envelope-to-table. It now renders the shared
|
|
6
|
+
* <LiveProgress> (pool mode) during the run, so the user sees an animated
|
|
7
|
+
* spinner + scenario `completed/total` — including for parallel recipes, where
|
|
8
|
+
* the counter advances as concurrent scenarios finish.
|
|
9
|
+
*
|
|
10
|
+
* Shared presentational primitives (Banner, RunHeader, RunSummary, LiveProgress)
|
|
11
|
+
* come from @opensip-cli/cli-ui. Effectful egress (cloud + --report-to) stays
|
|
12
|
+
* at the composition root: this runner returns the run's SignalEnvelope and the
|
|
13
|
+
* tool's registerLiveView callback delivers it once the Ink app exits.
|
|
14
|
+
*
|
|
15
|
+
* The live run executes OFF the main process (ADR-0028): it forks the CLI to the
|
|
16
|
+
* internal `sim-run-worker` subcommand and relays progress + result over IPC, so
|
|
17
|
+
* the spinner + 80ms clock never block on a synchronous chunk. It falls back to
|
|
18
|
+
* in-process when forking is disabled/unavailable (OPENSIP_CLI_NO_WORKER).
|
|
19
|
+
*/
|
|
20
|
+
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
|
|
21
|
+
import { tmpdir } from 'node:os';
|
|
22
|
+
import { join } from 'node:path';
|
|
23
|
+
import { Banner, ClockProvider, ErrorMessage, LiveProgress, normalizeBannerSize, ProjectHeader, renderToInk, RunFooterHints, RunHeader, RunSummary, RunTimingProvider, ThemeProvider, UpdateHint, VERBOSE_DETAIL_HINT, viewFindingsGroups, } from '@opensip-cli/cli-ui';
|
|
24
|
+
import { runOffThreadOrInProcess, currentScope, } from '@opensip-cli/core';
|
|
25
|
+
import { Box, Static, useApp, render } from 'ink';
|
|
26
|
+
import React, { useEffect, useState } from 'react';
|
|
27
|
+
import { buildSimulationSessionPayload } from '../persistence/session-payload.js';
|
|
28
|
+
import { executeSim } from './sim.js';
|
|
29
|
+
const SIM_TOOL_TITLE = 'Simulation Scenarios';
|
|
30
|
+
const SIM_TOOL_DESCRIPTION = 'Running simulation scenarios against your codebase.';
|
|
31
|
+
const SIM_RUNNING_SURFACE = { shape: 'pool', label: 'Running scenarios...' };
|
|
32
|
+
const SIM_LOADING_SURFACE = { shape: 'pool', label: 'Loading scenarios...' };
|
|
33
|
+
const NO_PROGRESS = () => {
|
|
34
|
+
// The loading phase has no event stream yet — render a bare animated spinner.
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Run sim through the transport, translating the engine's `(completed, total)`
|
|
38
|
+
* callback into pool ProgressEvents on the `'scenarios'` stage. Hoisted to
|
|
39
|
+
* module scope so the emit translation isn't a deeply-nested function.
|
|
40
|
+
*/
|
|
41
|
+
function executeSimWithProgress(args, emit) {
|
|
42
|
+
emit({ type: 'stage-start', stage: 'scenarios', label: 'Running scenarios...' });
|
|
43
|
+
return executeSim(args, {
|
|
44
|
+
onProgress: (completed, total) => emit({ type: 'stage-progress', stage: 'scenarios', completed, total }),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/** The sim live-view component (loading → running → done/error). Exported for
|
|
48
|
+
* testing; production renders it through {@link renderSimLive}. */
|
|
49
|
+
export function SimRunner({ args, setExitCode, onEnvelope, onSession, liveContext, }) {
|
|
50
|
+
const { exit } = useApp();
|
|
51
|
+
const [state, setState] = useState({ phase: 'loading' });
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
let cancelled = false;
|
|
54
|
+
// Execute OFF the main process (ADR-0028): fork the CLI to `sim-run-worker`,
|
|
55
|
+
// which re-bootstraps the full scope and streams progress + the final result
|
|
56
|
+
// over IPC, so this process stays free to animate the spinner + 80ms clock.
|
|
57
|
+
// Falls back to the in-process closure (OPENSIP_CLI_NO_WORKER / fork
|
|
58
|
+
// failure) — identical result. The worker reads its serializable args spec
|
|
59
|
+
// from a temp file cleaned up after the run settles.
|
|
60
|
+
const specDir = mkdtempSync(join(tmpdir(), 'sim-worker-'));
|
|
61
|
+
const specPath = join(specDir, 'spec.json');
|
|
62
|
+
writeFileSync(specPath, JSON.stringify(args), 'utf8');
|
|
63
|
+
const run = runOffThreadOrInProcess({
|
|
64
|
+
descriptor: { command: process.argv[1] ?? '', argv: ['sim-run-worker', specPath] },
|
|
65
|
+
inProcess: (emit) => executeSimWithProgress(args, emit),
|
|
66
|
+
});
|
|
67
|
+
setState({ phase: 'running', subscribe: run.onProgress });
|
|
68
|
+
void (async () => {
|
|
69
|
+
let simResult;
|
|
70
|
+
try {
|
|
71
|
+
simResult = await run.result;
|
|
72
|
+
}
|
|
73
|
+
finally {
|
|
74
|
+
rmSync(specDir, { recursive: true, force: true });
|
|
75
|
+
}
|
|
76
|
+
const { result } = simResult;
|
|
77
|
+
if (cancelled)
|
|
78
|
+
return;
|
|
79
|
+
if (result.type === 'error') {
|
|
80
|
+
setState({ phase: 'error', result });
|
|
81
|
+
setExitCode?.(result.exitCode);
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
// ADR-0035: the host owns the findings exit. The live renderer hands the
|
|
85
|
+
// envelope to `setUpSimLiveView` via `onEnvelope`, which calls
|
|
86
|
+
// `deliverSignals`; the root sets the exit from `envelope.verdict.passed`.
|
|
87
|
+
// Host-owned persistence (host-owned-run-timing Phase 2): surface the
|
|
88
|
+
// contribution; the host persists after the live view exits.
|
|
89
|
+
if (result.type === 'sim-done') {
|
|
90
|
+
onSession?.({
|
|
91
|
+
tool: 'sim',
|
|
92
|
+
cwd: result.cwd,
|
|
93
|
+
recipe: result.recipeName,
|
|
94
|
+
score: result.envelope.verdict.score,
|
|
95
|
+
passed: result.envelope.verdict.passed,
|
|
96
|
+
payload: buildSimulationSessionPayload(result.envelope),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
onEnvelope?.(result.envelope);
|
|
100
|
+
setState({
|
|
101
|
+
phase: 'done',
|
|
102
|
+
result: {
|
|
103
|
+
envelope: result.envelope,
|
|
104
|
+
// duration omitted for summary (host provider supplies); keep if present for other internal use
|
|
105
|
+
...(result.durationMs === undefined ? {} : { durationMs: result.durationMs }),
|
|
106
|
+
verboseDetail: result.verboseDetail,
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
setTimeout(() => exit(), 100);
|
|
111
|
+
})();
|
|
112
|
+
return () => {
|
|
113
|
+
cancelled = true;
|
|
114
|
+
};
|
|
115
|
+
}, []);
|
|
116
|
+
if (state.phase === 'error') {
|
|
117
|
+
return _jsx(ErrorMessage, { message: state.result.message, suggestion: state.result.suggestion });
|
|
118
|
+
}
|
|
119
|
+
const scope = currentScope();
|
|
120
|
+
const ui = scope?.ui;
|
|
121
|
+
const walkedUp = scope?.projectContext?.walkedUp;
|
|
122
|
+
const bannerSize = normalizeBannerSize(ui?.bannerSize);
|
|
123
|
+
const recipe = args.recipe ?? 'default';
|
|
124
|
+
const header = args.quiet === true ? null : (_jsx(Static, { items: ['header'], children: () => (_jsxs(React.Fragment, { children: [_jsx(Banner, { size: bannerSize, version: ui?.version, projectPath: args.cwd, walkedUp: walkedUp, update: ui?.update }), bannerSize === 'mini' && ui?.update !== undefined && _jsx(UpdateHint, {}), bannerSize !== 'mini' && _jsx(ProjectHeader, { root: args.cwd, walkedUp: walkedUp }), _jsx(RunHeader, { tool: SIM_TOOL_TITLE, description: SIM_TOOL_DESCRIPTION, metadata: [{ label: 'Recipe', value: recipe }] })] }, "header")) }));
|
|
125
|
+
if (state.phase === 'loading') {
|
|
126
|
+
return (_jsxs(_Fragment, { children: [header, _jsx(Box, { paddingTop: 1, children: _jsx(LiveProgress, { surface: SIM_LOADING_SURFACE, subscribe: NO_PROGRESS }) })] }));
|
|
127
|
+
}
|
|
128
|
+
if (state.phase === 'running') {
|
|
129
|
+
return (_jsxs(_Fragment, { children: [header, _jsx(LiveProgress, { surface: SIM_RUNNING_SURFACE, subscribe: state.subscribe })] }));
|
|
130
|
+
}
|
|
131
|
+
const { summary } = state.result.envelope.verdict;
|
|
132
|
+
const { verboseDetail } = state.result;
|
|
133
|
+
const findingsDetail = verboseDetail?.kind === 'findings' && verboseDetail.groups.length > 0
|
|
134
|
+
? verboseDetail
|
|
135
|
+
: undefined;
|
|
136
|
+
return (_jsxs(_Fragment, { children: [header, _jsxs(Box, { flexDirection: "column", children: [args.quiet !== true && findingsDetail !== undefined && (_jsx(Box, { children: renderToInk(viewFindingsGroups(findingsDetail.groups)) })), (() => {
|
|
137
|
+
const summaryEl = (_jsx(RunSummary, { passed: state.result.envelope.verdict.passed, errors: summary.errors, warnings: summary.warnings }));
|
|
138
|
+
return liveContext?.runSession ? (_jsx(RunTimingProvider, { timer: liveContext.runSession.timing, children: summaryEl })) : (summaryEl);
|
|
139
|
+
})(), args.quiet !== true && (_jsx(RunFooterHints, { hints: args.verbose === true
|
|
140
|
+
? [
|
|
141
|
+
{
|
|
142
|
+
text: 'opensip report for HTML report',
|
|
143
|
+
bold: ['opensip report'],
|
|
144
|
+
},
|
|
145
|
+
]
|
|
146
|
+
: [
|
|
147
|
+
VERBOSE_DETAIL_HINT,
|
|
148
|
+
{
|
|
149
|
+
text: 'opensip report for HTML report',
|
|
150
|
+
bold: ['opensip report'],
|
|
151
|
+
},
|
|
152
|
+
] }))] })] }));
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Render the live `sim` view. Resolves once the Ink app exits with a
|
|
156
|
+
* {@link ToolRunCompletion} carrying the run's `envelope` (for root-owned
|
|
157
|
+
* egress) and `session` contribution (persisted by the HOST after this
|
|
158
|
+
* resolves — host-owned-run-timing Phase 2; the component no longer writes the
|
|
159
|
+
* session itself).
|
|
160
|
+
*/
|
|
161
|
+
export async function renderSimLive(args, options, liveContext) {
|
|
162
|
+
let envelope;
|
|
163
|
+
let session;
|
|
164
|
+
const app = render(_jsx(ThemeProvider, { children: _jsx(ClockProvider, { children: _jsx(SimRunner, { args: args, setExitCode: options?.setExitCode, onEnvelope: (e) => {
|
|
165
|
+
envelope = e;
|
|
166
|
+
}, onSession: (c) => {
|
|
167
|
+
session = c;
|
|
168
|
+
}, liveContext: liveContext }) }) }));
|
|
169
|
+
await app.waitUntilExit();
|
|
170
|
+
process.stdout.write('\n');
|
|
171
|
+
// host-owned-run-timing Phase 3: the host persists the returned session
|
|
172
|
+
// contribution after this live renderer resolves.
|
|
173
|
+
return { envelope, session };
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=sim-runner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-runner.js","sourceRoot":"","sources":["../../src/cli/sim-runner.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,MAAM,EACN,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,cAAc,EACd,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,UAAU,EACV,mBAAmB,EACnB,kBAAkB,GAGnB,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EACL,uBAAuB,EACvB,YAAY,GAIb,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,GAA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,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sim-run-worker <specPath>` — the headless sim run forked by the live view
|
|
3
|
+
* (ADR-0028). The live runner forks `node <cliScript> sim-run-worker <spec>`;
|
|
4
|
+
* because it runs through the full CLI bootstrap, the scenario registry, project,
|
|
5
|
+
* and config are populated in scope exactly as a normal `sim` run (executeSim's
|
|
6
|
+
* own `ensureScenariosLoaded` rebuilds the registry), so results are
|
|
7
|
+
* byte-identical — the reason this is a forked subcommand, not a worker thread.
|
|
8
|
+
*
|
|
9
|
+
* It is headless: instead of rendering, it streams pool progress and its final
|
|
10
|
+
* result over the fork IPC channel (`process.send`) as {@link WorkerMessage}s,
|
|
11
|
+
* which the parent's subprocess transport relays to the shared `<LiveProgress>`
|
|
12
|
+
* renderer. Persistence + egress stay on the parent (the engine is
|
|
13
|
+
* persistence-free; Phase 2). Internal command — the live runner is its only caller.
|
|
14
|
+
*/
|
|
15
|
+
import { type CommandSpec, type ToolCliContext } from '@opensip-cli/core';
|
|
16
|
+
/**
|
|
17
|
+
* Read the sim-args spec, run `executeSim` headless, and stream progress + the
|
|
18
|
+
* final result over IPC. Never throws to the caller — a failure is sent as a
|
|
19
|
+
* `{ kind: 'error' }` message so the parent's `result` promise rejects cleanly.
|
|
20
|
+
*/
|
|
21
|
+
export declare function executeSimWorker(specPath: string): Promise<void>;
|
|
22
|
+
/** `sim-run-worker` — [internal] headless sim run, IPC progress/result. */
|
|
23
|
+
export declare const simRunWorkerCommandSpec: CommandSpec<unknown, ToolCliContext>;
|
|
24
|
+
//# sourceMappingURL=sim-worker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-worker.d.ts","sourceRoot":"","sources":["../../src/cli/sim-worker.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,cAAc,EAEpB,MAAM,mBAAmB,CAAC;AAgB3B;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBtE;AAED,2EAA2E;AAC3E,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,OAAO,EAAE,cAAc,CAgBvE,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// @fitness-ignore-file detached-promises -- this worker's `send()` helper is synchronous (it calls process.send, which returns immediately); the name-based heuristic mistakes the floating send(...) IPC posts for promise-returning calls. The one genuine async call (executeSim) is awaited.
|
|
2
|
+
/**
|
|
3
|
+
* `sim-run-worker <specPath>` — the headless sim run forked by the live view
|
|
4
|
+
* (ADR-0028). The live runner forks `node <cliScript> sim-run-worker <spec>`;
|
|
5
|
+
* because it runs through the full CLI bootstrap, the scenario registry, project,
|
|
6
|
+
* and config are populated in scope exactly as a normal `sim` run (executeSim's
|
|
7
|
+
* own `ensureScenariosLoaded` rebuilds the registry), so results are
|
|
8
|
+
* byte-identical — the reason this is a forked subcommand, not a worker thread.
|
|
9
|
+
*
|
|
10
|
+
* It is headless: instead of rendering, it streams pool progress and its final
|
|
11
|
+
* result over the fork IPC channel (`process.send`) as {@link WorkerMessage}s,
|
|
12
|
+
* which the parent's subprocess transport relays to the shared `<LiveProgress>`
|
|
13
|
+
* renderer. Persistence + egress stay on the parent (the engine is
|
|
14
|
+
* persistence-free; Phase 2). Internal command — the live runner is its only caller.
|
|
15
|
+
*/
|
|
16
|
+
import { readFileSync } from 'node:fs';
|
|
17
|
+
import { defineCommand, } from '@opensip-cli/core';
|
|
18
|
+
import { executeSim } from './sim.js';
|
|
19
|
+
/** Post one IPC message to the parent (no-op when not forked). */
|
|
20
|
+
function send(msg) {
|
|
21
|
+
process.send?.(msg);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Read the sim-args spec, run `executeSim` headless, and stream progress + the
|
|
25
|
+
* final result over IPC. Never throws to the caller — a failure is sent as a
|
|
26
|
+
* `{ kind: 'error' }` message so the parent's `result` promise rejects cleanly.
|
|
27
|
+
*/
|
|
28
|
+
export async function executeSimWorker(specPath) {
|
|
29
|
+
try {
|
|
30
|
+
const args = JSON.parse(readFileSync(specPath, 'utf8'));
|
|
31
|
+
send({
|
|
32
|
+
kind: 'progress',
|
|
33
|
+
event: { type: 'stage-start', stage: 'scenarios', label: 'Running scenarios...' },
|
|
34
|
+
});
|
|
35
|
+
const simResult = await executeSim(args, {
|
|
36
|
+
onProgress: (completed, total) => send({
|
|
37
|
+
kind: 'progress',
|
|
38
|
+
event: { type: 'stage-progress', stage: 'scenarios', completed, total },
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
send({ kind: 'result', value: simResult });
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
send({
|
|
45
|
+
kind: 'error',
|
|
46
|
+
message: error instanceof Error ? error.message : String(error),
|
|
47
|
+
...(error instanceof Error && error.stack !== undefined ? { stack: error.stack } : {}),
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/** `sim-run-worker` — [internal] headless sim run, IPC progress/result. */
|
|
52
|
+
export const simRunWorkerCommandSpec = defineCommand({
|
|
53
|
+
name: 'sim-run-worker',
|
|
54
|
+
description: '[internal] Run sim headless and stream progress + result over IPC (forked by the live view)',
|
|
55
|
+
commonFlags: [],
|
|
56
|
+
args: [{ name: 'specPath', description: 'Path to a JSON sim-args spec file' }],
|
|
57
|
+
scope: 'project',
|
|
58
|
+
output: 'raw-stream',
|
|
59
|
+
rawStreamReason: 'worker-ipc',
|
|
60
|
+
handler: async (rawOpts) => {
|
|
61
|
+
const specPath = rawOpts._args?.[0] ?? '';
|
|
62
|
+
await executeSimWorker(specPath);
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=sim-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim-worker.js","sourceRoot":"","sources":["../../src/cli/sim-worker.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C,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACvF,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,2EAA2E;AAC3E,MAAM,CAAC,MAAM,uBAAuB,GAAyC,aAAa,CAGxF;IACA,IAAI,EAAE,gBAAgB;IACtB,WAAW,EACT,6FAA6F;IAC/F,WAAW,EAAE,EAAE;IACf,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,mCAAmC,EAAE,CAAC;IAC9E,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,YAAY;IACpB,eAAe,EAAE,YAAY;IAC7B,OAAO,EAAE,KAAK,EAAE,OAAO,EAAiB,EAAE;QACxC,MAAM,QAAQ,GAAI,OAAyC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7E,MAAM,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sim command — run simulation scenarios via a named recipe.
|
|
3
|
+
*
|
|
4
|
+
* Without `--recipe`, runs the built-in `default` recipe (every
|
|
5
|
+
* registered scenario, parallel mode). With `--recipe <name>`, looks
|
|
6
|
+
* the recipe up in the registry and runs it.
|
|
7
|
+
*
|
|
8
|
+
* Returns a structured `SimDoneResult` with per-scenario outcomes;
|
|
9
|
+
* callers (CLI / Tool layer) render or JSON-serialize as appropriate.
|
|
10
|
+
*
|
|
11
|
+
* Scenario loading lifecycle (mirrors fitness's `ensureChecksLoaded`):
|
|
12
|
+
*
|
|
13
|
+
* 1. .mjs plugin discovery via `loadAllSimPlugins(projectDir)`.
|
|
14
|
+
* 2. npm package discovery: `@opensip-cli/scenarios-*` packages
|
|
15
|
+
* (or anything under `plugins.scenarioPackages` / customer scopes).
|
|
16
|
+
* 3. No-scenarios guard: `executeSim` fails the run closed with a
|
|
17
|
+
* CONFIGURATION_ERROR (exit 2) when zero scenarios would run,
|
|
18
|
+
* because a silent green run simulating nothing is the failure mode
|
|
19
|
+
* the CLI exists to prevent. (The loader only structured-logs the
|
|
20
|
+
* empty registry; the fatal decision is the command's.)
|
|
21
|
+
*/
|
|
22
|
+
import type { ErrorResult, SimDoneResult, ToolOptions } from '@opensip-cli/contracts';
|
|
23
|
+
/**
|
|
24
|
+
* Plugin load errors recorded during the most recent ensureScenariosLoaded()
|
|
25
|
+
* call — on `scope.simulation.load` now, NOT a module singleton (audit F1). Read
|
|
26
|
+
* by the runner to fail the run if a broken plugin silently suppressed its
|
|
27
|
+
* scenarios while the CLI exits 0.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getPluginLoadErrors(): readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* Discover and load every sim plugin and scenario package for the project.
|
|
32
|
+
* Idempotent per-projectDir, memoized on `scope.simulation.load` (audit F1).
|
|
33
|
+
*/
|
|
34
|
+
export declare function ensureScenariosLoaded(projectDir?: string): Promise<void>;
|
|
35
|
+
/** Options for {@link executeSim}. */
|
|
36
|
+
export interface ExecuteSimOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Live-progress callback (ADR-0016). Forwarded to the recipe service, which
|
|
39
|
+
* fires `(0, total)` at start and a monotonic `(completed, total)` per
|
|
40
|
+
* scenario. The interactive sim runner maps these to pool ProgressEvents;
|
|
41
|
+
* non-interactive callers (json / non-TTY) omit it.
|
|
42
|
+
*/
|
|
43
|
+
readonly onProgress?: (completed: number, total: number) => void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Run sim and return a SimDoneResult (or an ErrorResult when the
|
|
47
|
+
* recipe is missing). The caller decides what to print or render.
|
|
48
|
+
*/
|
|
49
|
+
export declare function executeSim(args: ToolOptions & {
|
|
50
|
+
readonly verbose?: boolean;
|
|
51
|
+
}, opts?: ExecuteSimOptions): Promise<{
|
|
52
|
+
result: SimDoneResult;
|
|
53
|
+
} | {
|
|
54
|
+
result: ErrorResult;
|
|
55
|
+
}>;
|
|
56
|
+
//# sourceMappingURL=sim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim.d.ts","sourceRoot":"","sources":["../../src/cli/sim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAyBH,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,WAAW,EAGZ,MAAM,wBAAwB,CAAC;AAOhC;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,MAAM,EAAE,CAEvD;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiC9E;AAmFD,sCAAsC;AACtC,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAClE;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAC9B,IAAI,EAAE,WAAW,GAAG;IAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EAClD,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC;IAAE,MAAM,EAAE,aAAa,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,CAAC,CA4H9D"}
|
package/dist/cli/sim.js
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* sim command — run simulation scenarios via a named recipe.
|
|
3
|
+
*
|
|
4
|
+
* Without `--recipe`, runs the built-in `default` recipe (every
|
|
5
|
+
* registered scenario, parallel mode). With `--recipe <name>`, looks
|
|
6
|
+
* the recipe up in the registry and runs it.
|
|
7
|
+
*
|
|
8
|
+
* Returns a structured `SimDoneResult` with per-scenario outcomes;
|
|
9
|
+
* callers (CLI / Tool layer) render or JSON-serialize as appropriate.
|
|
10
|
+
*
|
|
11
|
+
* Scenario loading lifecycle (mirrors fitness's `ensureChecksLoaded`):
|
|
12
|
+
*
|
|
13
|
+
* 1. .mjs plugin discovery via `loadAllSimPlugins(projectDir)`.
|
|
14
|
+
* 2. npm package discovery: `@opensip-cli/scenarios-*` packages
|
|
15
|
+
* (or anything under `plugins.scenarioPackages` / customer scopes).
|
|
16
|
+
* 3. No-scenarios guard: `executeSim` fails the run closed with a
|
|
17
|
+
* CONFIGURATION_ERROR (exit 2) when zero scenarios would run,
|
|
18
|
+
* because a silent green run simulating nothing is the failure mode
|
|
19
|
+
* the CLI exists to prevent. (The loader only structured-logs the
|
|
20
|
+
* empty registry; the fatal decision is the command's.)
|
|
21
|
+
*/
|
|
22
|
+
import { BUILTIN_DEFAULT_RECIPE, buildFindingGroups, buildSignalEnvelope, EXIT_CODES, } from '@opensip-cli/contracts';
|
|
23
|
+
import { currentScope, loadCapabilityDomain, logger, resolveScopes, resolveVerdictPolicy, } from '@opensip-cli/core';
|
|
24
|
+
import { currentScenarioRegistry, currentSimulationLoadState } from '../framework/registry.js';
|
|
25
|
+
import { loadAllSimPlugins } from '../plugins/loader.js';
|
|
26
|
+
import { readScenarioPackagePreferences } from '../plugins/scenario-package-discovery.js';
|
|
27
|
+
import { currentSimulationRecipeRegistry } from '../recipes/registry.js';
|
|
28
|
+
import { SimulationRecipeService } from '../recipes/service.js';
|
|
29
|
+
import { resolveSimRecipeSelection } from './sim-config.js';
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Lazy-load simulation scenarios
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
/**
|
|
34
|
+
* Plugin load errors recorded during the most recent ensureScenariosLoaded()
|
|
35
|
+
* call — on `scope.simulation.load` now, NOT a module singleton (audit F1). Read
|
|
36
|
+
* by the runner to fail the run if a broken plugin silently suppressed its
|
|
37
|
+
* scenarios while the CLI exits 0.
|
|
38
|
+
*/
|
|
39
|
+
export function getPluginLoadErrors() {
|
|
40
|
+
return currentSimulationLoadState().pluginLoadErrors;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Discover and load every sim plugin and scenario package for the project.
|
|
44
|
+
* Idempotent per-projectDir, memoized on `scope.simulation.load` (audit F1).
|
|
45
|
+
*/
|
|
46
|
+
export async function ensureScenariosLoaded(projectDir) {
|
|
47
|
+
const key = projectDir ?? '';
|
|
48
|
+
const load = currentSimulationLoadState();
|
|
49
|
+
if (load.loadedFor === key)
|
|
50
|
+
return;
|
|
51
|
+
// 1. Load .mjs sim plugins — project-local scenarios/recipes + plugins.sim
|
|
52
|
+
// packages. Scenarios self-register on import; recipes via the loader.
|
|
53
|
+
const pluginResult = await loadAllSimPlugins(projectDir);
|
|
54
|
+
load.pluginLoadErrors = pluginResult.errors;
|
|
55
|
+
for (const err of pluginResult.errors) {
|
|
56
|
+
process.stderr.write(`opensip: plugin failed to load — ${err}\n`);
|
|
57
|
+
logger.warn({ evt: 'cli.plugin.warning', module: 'cli:sim', message: err });
|
|
58
|
+
}
|
|
59
|
+
// 2. Scenario packages (+ co-located recipes → the sim-recipe domain) through
|
|
60
|
+
// the GENERIC capability substrate (§5.3): name-pattern `<scope>/scenarios-*`
|
|
61
|
+
// discovery, the documented plugins.{scenarioPackages,autoDiscoverScenarios,
|
|
62
|
+
// packageScopes} keys, and the single-core guard all live in core now — sim
|
|
63
|
+
// no longer carries a bespoke loader. Memoized per (domain, project) on the
|
|
64
|
+
// scope capability registry, so the CLI pre-action hook and this don't
|
|
65
|
+
// double-load.
|
|
66
|
+
await loadSimScenarioPackages(projectDir ?? '');
|
|
67
|
+
// 3. No-scenarios guard (structured-log only; executeSim owns the fatal exit).
|
|
68
|
+
if (currentScenarioRegistry().size === 0) {
|
|
69
|
+
logger.warn({
|
|
70
|
+
evt: 'cli.scenario_packages.empty',
|
|
71
|
+
module: 'cli:sim',
|
|
72
|
+
msg: 'no scenarios loaded',
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
load.loadedFor = key;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Drive the generic capability loader for the `sim-pack` domain. A no-op when the
|
|
79
|
+
* run carries no capability registry (a programmatic sim use that never wired the
|
|
80
|
+
* host capability plane), the domain is unregistered, or no projectDir. Scopes are
|
|
81
|
+
* merged (default `@opensip-cli` ∪ customer `packageScopes`) here so name-pattern
|
|
82
|
+
* discovery matches the prior `resolveScopes` behavior. No `@opensip-cli/config` dep.
|
|
83
|
+
*/
|
|
84
|
+
async function loadSimScenarioPackages(projectDir) {
|
|
85
|
+
if (projectDir === '')
|
|
86
|
+
return;
|
|
87
|
+
const registry = currentScope()?.capabilities;
|
|
88
|
+
if (!registry?.hasDomain('sim-pack') || registry.isDomainLoaded('sim-pack', projectDir))
|
|
89
|
+
return;
|
|
90
|
+
const prefs = readScenarioPackagePreferences(projectDir);
|
|
91
|
+
const scopes = resolveScopes('@opensip-cli', prefs.packageScopes ?? [], 'plugin.scenario_package.invalid_scope');
|
|
92
|
+
const preferences = {
|
|
93
|
+
...(prefs.scenarioPackages === undefined ? {} : { packages: prefs.scenarioPackages }),
|
|
94
|
+
...(prefs.autoDiscoverScenarios === undefined
|
|
95
|
+
? {}
|
|
96
|
+
: { autoDiscover: prefs.autoDiscoverScenarios }),
|
|
97
|
+
scopes,
|
|
98
|
+
};
|
|
99
|
+
await loadCapabilityDomain({ registry, domainId: 'sim-pack', projectDir, preferences });
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* A scenario passes the verdict when it emitted no `critical`/`high` signals
|
|
103
|
+
* AND its own pass/fail verdict held (assertions passed, no thrown error).
|
|
104
|
+
* Mirrors {@link buildSignalEnvelope}'s "no critical/high ⇒ passed" rule and
|
|
105
|
+
* folds in the scenario's assertion verdict (a scenario can fail assertions
|
|
106
|
+
* without emitting a critical/high signal).
|
|
107
|
+
*/
|
|
108
|
+
function scenarioPassed(scenario, signals) {
|
|
109
|
+
const hasErrorSignal = signals.some((s) => s.severity === 'critical' || s.severity === 'high');
|
|
110
|
+
return scenario.passed && !hasErrorSignal;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Collapse the recipe's per-scenario results into the envelope's two
|
|
114
|
+
* orthogonal carriers (ADR-0011):
|
|
115
|
+
*
|
|
116
|
+
* - `signals`: the flat run-wide `Signal[]`. Each scenario's signals are
|
|
117
|
+
* remapped to `source: <scenarioId>` so the shared table formatter
|
|
118
|
+
* (which groups by `signal.source`) attributes them to the right unit
|
|
119
|
+
* row even if a scenario authored a divergent `source`.
|
|
120
|
+
* - `units`: one {@link UnitResult} per scenario (`slug: scenarioId`,
|
|
121
|
+
* `passed`, `durationMs`, `error?`) — the per-unit ran/errored/timing
|
|
122
|
+
* facts a flat signal list cannot express.
|
|
123
|
+
*
|
|
124
|
+
* `SimulationMetrics` (load p50/p95/p99) stays a tool-specific artifact on the
|
|
125
|
+
* per-kind `result` and is NOT lifted into the envelope's core shape.
|
|
126
|
+
*/
|
|
127
|
+
function assembleEnvelopeInputs(scenarios) {
|
|
128
|
+
const units = [];
|
|
129
|
+
const signals = [];
|
|
130
|
+
for (const scenario of scenarios) {
|
|
131
|
+
const scenarioSignals = scenario.result?.signals ?? [];
|
|
132
|
+
// Remap source → scenarioId so per-scenario grouping is exact (the
|
|
133
|
+
// unit slug IS the scenarioId, per the migrated-tool contract).
|
|
134
|
+
for (const signal of scenarioSignals) {
|
|
135
|
+
signals.push(signal.source === scenario.scenarioId ? signal : { ...signal, source: scenario.scenarioId });
|
|
136
|
+
}
|
|
137
|
+
units.push({
|
|
138
|
+
slug: scenario.scenarioId,
|
|
139
|
+
passed: scenarioPassed(scenario, scenarioSignals),
|
|
140
|
+
durationMs: scenario.durationMs,
|
|
141
|
+
...(scenario.error === undefined ? {} : { error: scenario.error }),
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
return { units, signals };
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Run sim and return a SimDoneResult (or an ErrorResult when the
|
|
148
|
+
* recipe is missing). The caller decides what to print or render.
|
|
149
|
+
*/
|
|
150
|
+
export async function executeSim(args, opts = {}) {
|
|
151
|
+
// Lifecycle: load .mjs plugins + scenario packages before the recipe
|
|
152
|
+
// registry is read. Idempotent per project dir.
|
|
153
|
+
await ensureScenariosLoaded(args.cwd);
|
|
154
|
+
// Tool-scoped recipe resolution (ADR-0022): explicit --recipe >
|
|
155
|
+
// simulation.recipe > built-in default. A config-sourced unknown name
|
|
156
|
+
// tolerantly falls back to `default`; an explicit --recipe typo hard-fails.
|
|
157
|
+
const recipeSelection = resolveSimRecipeSelection(args.cwd, args.recipe);
|
|
158
|
+
let recipeName = recipeSelection.name;
|
|
159
|
+
let recipe = currentSimulationRecipeRegistry().loadRecipe(recipeName);
|
|
160
|
+
if (!recipe && recipeSelection.tolerant && recipeName !== BUILTIN_DEFAULT_RECIPE) {
|
|
161
|
+
logger.warn({
|
|
162
|
+
evt: 'sim.recipe.unknown_config_default',
|
|
163
|
+
module: 'cli:sim',
|
|
164
|
+
requested: recipeName,
|
|
165
|
+
fallback: BUILTIN_DEFAULT_RECIPE,
|
|
166
|
+
msg: `Configured sim recipe '${recipeName}' not found; using '${BUILTIN_DEFAULT_RECIPE}'. If '${recipeName}' is a recipe for another tool, move it under that tool's <tool>.recipe key (ADR-0022).`,
|
|
167
|
+
});
|
|
168
|
+
recipeName = BUILTIN_DEFAULT_RECIPE;
|
|
169
|
+
recipe = currentSimulationRecipeRegistry().loadRecipe(recipeName);
|
|
170
|
+
}
|
|
171
|
+
if (!recipe) {
|
|
172
|
+
return {
|
|
173
|
+
result: {
|
|
174
|
+
type: 'error',
|
|
175
|
+
message: `Unknown sim recipe '${recipeName}'.`,
|
|
176
|
+
suggestion: 'Run `opensip sim --recipes` to see available recipes.',
|
|
177
|
+
exitCode: EXIT_CODES.CONFIGURATION_ERROR,
|
|
178
|
+
},
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const service = new SimulationRecipeService({ cwd: args.cwd, onProgress: opts.onProgress });
|
|
182
|
+
const recipeResult = await service.runRecipe(recipe);
|
|
183
|
+
const scenarios = recipeResult.scenarios;
|
|
184
|
+
// Fail closed on an empty run. Zero executed scenarios — whether because
|
|
185
|
+
// no scenario packages were loaded at all, or because the recipe selector
|
|
186
|
+
// matched none of the registered scenarios — must NOT report as a pass
|
|
187
|
+
// (exit 0). A green run that simulated nothing is the exact failure mode
|
|
188
|
+
// that masks a misconfig or missing dependency in CI. It is a
|
|
189
|
+
// configuration/unavailable condition (exit 2), distinct from an actual
|
|
190
|
+
// scenario failure (exit 1). Tailor the guidance to the cause.
|
|
191
|
+
if (scenarios.length === 0) {
|
|
192
|
+
const registryEmpty = currentScenarioRegistry().size === 0;
|
|
193
|
+
logger.warn({
|
|
194
|
+
evt: 'cli.sim.empty_run',
|
|
195
|
+
module: 'cli:sim',
|
|
196
|
+
recipeName,
|
|
197
|
+
registryEmpty,
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
result: {
|
|
201
|
+
type: 'error',
|
|
202
|
+
message: registryEmpty
|
|
203
|
+
? 'No scenarios were loaded — nothing to simulate.'
|
|
204
|
+
: `Recipe '${recipeName}' selected zero scenarios — nothing to simulate.`,
|
|
205
|
+
suggestion: registryEmpty
|
|
206
|
+
? 'Install at least one @opensip-cli/scenarios-* package, declare plugins.scenarioPackages in opensip-cli.config.yml, or run `opensip init` to scaffold example scenarios.'
|
|
207
|
+
: 'Check the recipe selector — at least one registered scenario must match.',
|
|
208
|
+
exitCode: EXIT_CODES.CONFIGURATION_ERROR,
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
const passed = scenarios.filter((s) => s.passed).length;
|
|
213
|
+
const failed = scenarios.length - passed;
|
|
214
|
+
logger.info({
|
|
215
|
+
evt: 'cli.sim.complete',
|
|
216
|
+
module: 'cli:sim',
|
|
217
|
+
recipeName,
|
|
218
|
+
passed,
|
|
219
|
+
failed,
|
|
220
|
+
durationMs: recipeResult.durationMs,
|
|
221
|
+
});
|
|
222
|
+
// ADR-0011: surface every scenario's Signal[] into the one run envelope.
|
|
223
|
+
// `runId`/`createdAt` come off the live scope so cloud egress correlates
|
|
224
|
+
// with the same run id the logger stamps; `currentScope()` is bound for the
|
|
225
|
+
// whole dynamic extent of the action body (enterScope in the pre-action hook).
|
|
226
|
+
const { units, signals } = assembleEnvelopeInputs(scenarios);
|
|
227
|
+
const envelope = buildSignalEnvelope({
|
|
228
|
+
tool: 'sim',
|
|
229
|
+
recipe: recipeName,
|
|
230
|
+
runId: currentScope()?.runId ?? '',
|
|
231
|
+
createdAt: new Date().toISOString(),
|
|
232
|
+
units,
|
|
233
|
+
signals,
|
|
234
|
+
// ADR-0035: sim declares no failOn* keys, so it inherits the host fallback
|
|
235
|
+
// {1,0}. With Phase 0 (a failed scenario emits an error signal), this
|
|
236
|
+
// reproduces sim's historical `failed > 0` exit exactly. Scenario throws land
|
|
237
|
+
// in UnitResult.error (a unit fault), so runFaulted stays false here.
|
|
238
|
+
policy: resolveVerdictPolicy('simulation'),
|
|
239
|
+
runFaulted: false,
|
|
240
|
+
});
|
|
241
|
+
// ADR-0021: on --verbose, carry the per-scenario detail body so the shared
|
|
242
|
+
// resultToView seam renders it identically in a TTY and a pipe. Reuses the
|
|
243
|
+
// shared contracts mapping (sim scenario ids are the unit slugs; identity
|
|
244
|
+
// display name).
|
|
245
|
+
const verboseDetail = args.verbose === true
|
|
246
|
+
? { kind: 'findings', groups: buildFindingGroups(units, signals) }
|
|
247
|
+
: undefined;
|
|
248
|
+
const result = {
|
|
249
|
+
type: 'sim-done',
|
|
250
|
+
recipeName,
|
|
251
|
+
cwd: args.cwd,
|
|
252
|
+
// durationMs optional on SimDoneResult (phase2 host timing); internal recipe makespan may be present.
|
|
253
|
+
...(recipeResult.durationMs === undefined ? {} : { durationMs: recipeResult.durationMs }),
|
|
254
|
+
// ADR-0035: the run verdict is the single host verdict. With Phase 0 a failed
|
|
255
|
+
// scenario emits an error signal, so `envelope.verdict.passed` (with the {1,0}
|
|
256
|
+
// policy) is exactly the old `failed > 0`; the host derives the exit from it.
|
|
257
|
+
envelope,
|
|
258
|
+
...(verboseDetail === undefined ? {} : { verboseDetail }),
|
|
259
|
+
};
|
|
260
|
+
// Persistence is host-owned (host-owned-run-timing Phase 3): the engine returns
|
|
261
|
+
// only the result; the sim handler RETURNS a ToolSessionContribution and the
|
|
262
|
+
// host run plane writes the generic session row. No tool-side persist helper.
|
|
263
|
+
return { result };
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=sim.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sim.js","sourceRoot":"","sources":["../../src/cli/sim.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,UAAU,GACX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,MAAM,EACN,aAAa,EACb,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAC/F,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,8BAA8B,EAAE,MAAM,0CAA0C,CAAC;AAC1F,OAAO,EAAE,+BAA+B,EAAE,MAAM,wBAAwB,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iBAAiB,CAAC;AAY5D,8EAA8E;AAC9E,iCAAiC;AACjC,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO,0BAA0B,EAAE,CAAC,gBAAgB,CAAC;A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EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE;QAClE,CAAC,CAAC,SAAS,CAAC;IAEhB,MAAM,MAAM,GAAkB;QAC5B,IAAI,EAAE,UAAU;QAChB,UAAU;QACV,GAAG,EAAE,IAAI,CAAC,GAAG;QACb,sGAAsG;QACtG,GAAG,CAAC,YAAY,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,UAAU,EAAE,CAAC;QACzF,8EAA8E;QAC9E,+EAA+E;QAC/E,8EAA8E;QAC9E,QAAQ;QACR,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;KAC1D,CAAC;IACF,gFAAgF;IAChF,6EAA6E;IAC7E,8EAA8E;IAC9E,OAAO,EAAE,MAAM,EAAE,CAAC;AACpB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertions.test.d.ts","sourceRoot":"","sources":["../../../src/framework/__tests__/assertions.test.ts"],"names":[],"mappings":""}
|