@probelabs/visor 0.1.106 → 0.1.111
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/README.md +71 -2
- package/action.yml +1 -1
- package/defaults/code-refiner.yaml +114 -0
- package/defaults/{.visor.yaml → code-review.yaml} +35 -226
- package/defaults/override.yaml +52 -0
- package/defaults/task-refinement.yaml +624 -0
- package/defaults/visor.tests.yaml +685 -0
- package/defaults/visor.yaml +483 -0
- package/dist/action-cli-bridge.d.ts +11 -82
- package/dist/action-cli-bridge.d.ts.map +1 -1
- package/dist/ai-review-service.d.ts +28 -9
- package/dist/ai-review-service.d.ts.map +1 -1
- package/dist/check-execution-engine.d.ts +19 -331
- package/dist/check-execution-engine.d.ts.map +1 -1
- package/dist/cli-main.d.ts.map +1 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/config.d.ts +16 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/cron-scheduler.d.ts +3 -3
- package/dist/cron-scheduler.d.ts.map +1 -1
- package/dist/debug-visualizer/ws-server.d.ts +7 -1
- package/dist/debug-visualizer/ws-server.d.ts.map +1 -1
- package/dist/defaults/code-refiner.yaml +114 -0
- package/dist/defaults/{.visor.yaml → code-review.yaml} +35 -226
- package/dist/defaults/override.yaml +52 -0
- package/dist/defaults/task-refinement.yaml +624 -0
- package/dist/defaults/visor.tests.yaml +685 -0
- package/dist/defaults/visor.yaml +483 -0
- package/dist/docs/DEPLOYMENT.md +118 -0
- package/dist/docs/GITHUB_CHECKS.md +280 -0
- package/dist/docs/NPM_USAGE.md +208 -0
- package/dist/docs/action-reference.md +19 -0
- package/dist/docs/advanced-ai.md +237 -0
- package/dist/docs/ai-configuration.md +535 -0
- package/dist/docs/ai-custom-tools-usage.md +261 -0
- package/dist/docs/ai-custom-tools.md +392 -0
- package/dist/docs/author-permissions.md +610 -0
- package/dist/docs/bot-transports-rfc.md +23 -0
- package/dist/docs/ci-cli-mode.md +34 -0
- package/dist/docs/claude-code.md +74 -0
- package/dist/docs/command-provider.md +559 -0
- package/dist/docs/commands.md +8 -0
- package/dist/docs/configuration.md +324 -0
- package/dist/docs/custom-tools.md +424 -0
- package/dist/docs/dashboards/README.md +23 -0
- package/dist/docs/dashboards/grafana-visor-diagrams.json +20 -0
- package/dist/docs/dashboards/grafana-visor-overview.json +33 -0
- package/dist/docs/debug-visualizer-progress.md +572 -0
- package/dist/docs/debug-visualizer-rfc.md +691 -0
- package/dist/docs/debug-visualizer.md +114 -0
- package/dist/docs/debugging.md +636 -0
- package/dist/docs/default-output-schema.md +28 -0
- package/dist/docs/dependencies.md +369 -0
- package/dist/docs/dev-playbook.md +9 -0
- package/dist/docs/engine-pause-resume-rfc.md +192 -0
- package/dist/docs/engine-state-machine-plan.md +333 -0
- package/dist/docs/event-driven-github-integration-rfc.md +743 -0
- package/dist/docs/event-triggers.md +292 -0
- package/dist/docs/execution-statistics-rfc.md +290 -0
- package/dist/docs/fact-validator-gap-analysis.md +178 -0
- package/dist/docs/fact-validator-implementation-plan.md +1235 -0
- package/dist/docs/fail-if.md +95 -0
- package/dist/docs/failure-conditions-implementation.md +271 -0
- package/dist/docs/failure-conditions-schema.md +173 -0
- package/dist/docs/failure-routing-rfc.md +193 -0
- package/dist/docs/failure-routing.md +507 -0
- package/dist/docs/foreach-dependency-propagation.md +473 -0
- package/dist/docs/github-ops.md +89 -0
- package/dist/docs/goto-forward-run-plan.md +113 -0
- package/dist/docs/guides/criticality-modes.md +332 -0
- package/dist/docs/guides/fault-management-and-contracts.md +738 -0
- package/dist/docs/guides/workflow-style-guide.md +224 -0
- package/dist/docs/http.md +299 -0
- package/dist/docs/human-input-provider.md +372 -0
- package/dist/docs/lifecycle-hooks.md +253 -0
- package/dist/docs/limits.md +64 -0
- package/dist/docs/liquid-templates.md +490 -0
- package/dist/docs/loop-routing-refactor.md +89 -0
- package/dist/docs/mcp-provider.md +557 -0
- package/dist/docs/mcp.md +124 -0
- package/dist/docs/memory.md +903 -0
- package/dist/docs/observability.md +12 -0
- package/dist/docs/output-formats.md +20 -0
- package/dist/docs/output-formatting.md +29 -0
- package/dist/docs/output-history.md +383 -0
- package/dist/docs/performance.md +6 -0
- package/dist/docs/pluggable.md +124 -0
- package/dist/docs/proposals/snapshot-scope-execution.md +236 -0
- package/dist/docs/providers/git-checkout.md +589 -0
- package/dist/docs/recipes.md +474 -0
- package/dist/docs/rfc/git-checkout-step.md +601 -0
- package/dist/docs/rfc/on_init-hook.md +1294 -0
- package/dist/docs/rfc/workspace-isolation.md +216 -0
- package/dist/docs/roadmap/criticality-implementation-tasks.md +92 -0
- package/dist/docs/router-patterns.md +339 -0
- package/dist/docs/schema-next-pr.md +10 -0
- package/dist/docs/schema-templates.md +68 -0
- package/dist/docs/script.md +34 -0
- package/dist/docs/sdk.md +222 -0
- package/dist/docs/security.md +7 -0
- package/dist/docs/suppressions.md +89 -0
- package/dist/docs/tag-filtering.md +258 -0
- package/dist/docs/telemetry-setup.md +119 -0
- package/dist/docs/telemetry-tracing-rfc.md +275 -0
- package/dist/docs/test-framework-rfc.md +680 -0
- package/dist/docs/testing/assertions.md +85 -0
- package/dist/docs/testing/ci.md +44 -0
- package/dist/docs/testing/cli.md +41 -0
- package/dist/docs/testing/cookbook.md +172 -0
- package/dist/docs/testing/dsl-reference.md +199 -0
- package/dist/docs/testing/fixtures-and-mocks.md +91 -0
- package/dist/docs/testing/flows.md +92 -0
- package/dist/docs/testing/getting-started.md +93 -0
- package/dist/docs/testing/troubleshooting.md +55 -0
- package/dist/docs/timeouts.md +50 -0
- package/dist/docs/troubleshooting.md +7 -0
- package/dist/docs/visor-sdk-rfc.md +186 -0
- package/dist/docs/workflows.md +569 -0
- package/dist/engine/on-finish/orchestrator.d.ts +19 -0
- package/dist/engine/on-finish/orchestrator.d.ts.map +1 -0
- package/dist/engine/on-finish/utils.d.ts +44 -0
- package/dist/engine/on-finish/utils.d.ts.map +1 -0
- package/dist/event-bus/event-bus.d.ts +13 -0
- package/dist/event-bus/event-bus.d.ts.map +1 -0
- package/dist/event-bus/types.d.ts +71 -0
- package/dist/event-bus/types.d.ts.map +1 -0
- package/dist/examples/.claude/agents/code-reviewer.md +69 -0
- package/dist/examples/.mcp.json +34 -0
- package/dist/examples/CALCULATOR-SDK.md +364 -0
- package/dist/examples/README.md +384 -0
- package/dist/examples/ai-custom-tools-example.yaml +206 -0
- package/dist/examples/ai-custom-tools-simple.yaml +76 -0
- package/dist/examples/ai-retry-fallback-config.yaml +180 -0
- package/dist/examples/ai-with-bash.yaml +126 -0
- package/dist/examples/ai-with-mcp.yaml +82 -0
- package/dist/examples/basic-human-input.yaml +15 -0
- package/dist/examples/bedrock-config.yaml +77 -0
- package/dist/examples/calculator-config.yaml +133 -0
- package/dist/examples/calculator-json-output-guide.md +311 -0
- package/dist/examples/calculator-sdk-automated.ts +340 -0
- package/dist/examples/calculator-sdk-example.ts +275 -0
- package/dist/examples/calculator-sdk-json.ts +331 -0
- package/dist/examples/calculator-sdk-real.ts +374 -0
- package/dist/examples/calculator-sdk-test.ts +148 -0
- package/dist/examples/claude-code-config.yaml +191 -0
- package/dist/examples/cron-webhook-config.yaml +215 -0
- package/dist/examples/custom-template.liquid +57 -0
- package/dist/examples/custom-tools-example.yaml +281 -0
- package/dist/examples/enhanced-config.yaml +165 -0
- package/dist/examples/environments/visor.base.yaml +92 -0
- package/dist/examples/environments/visor.dev.yaml +33 -0
- package/dist/examples/environments/visor.prod.yaml +95 -0
- package/dist/examples/environments/visor.staging.yaml +46 -0
- package/dist/examples/fact-validator.yaml +361 -0
- package/dist/examples/fail-if-simple.yaml +90 -0
- package/dist/examples/failure-conditions-advanced.yaml +136 -0
- package/dist/examples/failure-conditions-basic.yaml +48 -0
- package/dist/examples/failure-conditions-github-style.yaml +119 -0
- package/dist/examples/failure-conditions-migration.yaml +74 -0
- package/dist/examples/for-loop-example.yaml +176 -0
- package/dist/examples/forEach-example.yaml +120 -0
- package/dist/examples/git-checkout-basic.yaml +32 -0
- package/dist/examples/git-checkout-compare.yaml +59 -0
- package/dist/examples/git-checkout-cross-repo.yaml +76 -0
- package/dist/examples/github-workflow-with-tags.yml +163 -0
- package/dist/examples/http-integration-config.yaml +240 -0
- package/dist/examples/https-server-config.yaml +209 -0
- package/dist/examples/human-input-example.yaml +63 -0
- package/dist/examples/if-conditions.yaml +173 -0
- package/dist/examples/jira-simple-example.yaml +56 -0
- package/dist/examples/jira-single-issue-workflow.yaml +166 -0
- package/dist/examples/jira-workflow-mcp.yaml +182 -0
- package/dist/examples/mcp/analyzer.py +119 -0
- package/dist/examples/mcp-provider-example.yaml +301 -0
- package/dist/examples/memory-counter.yaml +99 -0
- package/dist/examples/memory-error-collection.yaml +104 -0
- package/dist/examples/memory-exec-js.yaml +247 -0
- package/dist/examples/memory-namespace-isolation.yaml +184 -0
- package/dist/examples/memory-retry-counter.yaml +65 -0
- package/dist/examples/memory-state-machine.yaml +170 -0
- package/dist/examples/on-init-import-demo.yaml +179 -0
- package/dist/examples/outputs-raw-basic.yaml +26 -0
- package/dist/examples/project-with-tools.yaml +174 -0
- package/dist/examples/prompts/architecture-analysis.liquid +116 -0
- package/dist/examples/prompts/security-comprehensive.liquid +107 -0
- package/dist/examples/quick-start-tags.yaml +53 -0
- package/dist/examples/reusable-tools.yaml +92 -0
- package/dist/examples/reusable-workflows.yaml +88 -0
- package/dist/examples/routing-basic.yaml +35 -0
- package/dist/examples/routing-dynamic-js.yaml +46 -0
- package/dist/examples/routing-foreach.yaml +34 -0
- package/dist/examples/routing-goto-event.yaml +34 -0
- package/dist/examples/routing-on-success.yaml +25 -0
- package/dist/examples/run-calculator-demo.sh +71 -0
- package/dist/examples/sdk-basic.mjs +10 -0
- package/dist/examples/sdk-cjs.cjs +10 -0
- package/dist/examples/sdk-comprehensive.mjs +175 -0
- package/dist/examples/sdk-manual-config.mjs +65 -0
- package/dist/examples/sdk-typescript.js +81 -0
- package/dist/examples/sdk-typescript.ts +92 -0
- package/dist/examples/session-reuse-config.yaml +151 -0
- package/dist/examples/session-reuse-self.yaml +81 -0
- package/dist/examples/slack-simple-chat.yaml +775 -0
- package/dist/examples/templates/security-report.liquid +137 -0
- package/dist/examples/tools-library.yaml +281 -0
- package/dist/examples/transform-example.yaml +199 -0
- package/dist/examples/visor-with-tags.yaml +198 -0
- package/dist/examples/webhook-pipeline-config.yaml +218 -0
- package/dist/examples/workflows/calculator-workflow.yaml +163 -0
- package/dist/examples/workflows/code-quality.yaml +222 -0
- package/dist/examples/workflows/quick-pr-check.yaml +90 -0
- package/dist/examples/workflows/workflow-composition-example.yaml +130 -0
- package/dist/failure-condition-evaluator.d.ts +3 -0
- package/dist/failure-condition-evaluator.d.ts.map +1 -1
- package/dist/frontends/github-frontend.d.ts +58 -0
- package/dist/frontends/github-frontend.d.ts.map +1 -0
- package/dist/frontends/host.d.ts +47 -0
- package/dist/frontends/host.d.ts.map +1 -0
- package/dist/frontends/ndjson-sink.d.ts +12 -0
- package/dist/frontends/ndjson-sink.d.ts.map +1 -0
- package/dist/frontends/slack-frontend.d.ts +58 -0
- package/dist/frontends/slack-frontend.d.ts.map +1 -0
- package/dist/generated/config-schema.d.ts +967 -57
- package/dist/generated/config-schema.d.ts.map +1 -1
- package/dist/generated/config-schema.json +1033 -56
- package/dist/github-check-service.d.ts +4 -6
- package/dist/github-check-service.d.ts.map +1 -1
- package/dist/github-comments.d.ts +2 -4
- package/dist/github-comments.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +134327 -99004
- package/dist/liquid-extensions.d.ts.map +1 -1
- package/dist/logger.d.ts +2 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/memory-store.d.ts +6 -0
- package/dist/memory-store.d.ts.map +1 -1
- package/dist/output/assistant-json/template.liquid +0 -0
- package/dist/output/traces/run-2026-01-20T19-22-58-043Z.ndjson +138 -0
- package/dist/output/traces/run-2026-01-20T19-23-52-175Z.ndjson +1067 -0
- package/dist/output-formatters.d.ts +1 -1
- package/dist/output-formatters.d.ts.map +1 -1
- package/dist/providers/ai-check-provider.d.ts +12 -0
- package/dist/providers/ai-check-provider.d.ts.map +1 -1
- package/dist/providers/check-provider-registry.d.ts +6 -0
- package/dist/providers/check-provider-registry.d.ts.map +1 -1
- package/dist/providers/check-provider.interface.d.ts +43 -1
- package/dist/providers/check-provider.interface.d.ts.map +1 -1
- package/dist/providers/claude-code-check-provider.d.ts.map +1 -1
- package/dist/providers/command-check-provider.d.ts +1 -1
- package/dist/providers/command-check-provider.d.ts.map +1 -1
- package/dist/providers/custom-tool-executor.d.ts +61 -0
- package/dist/providers/custom-tool-executor.d.ts.map +1 -0
- package/dist/providers/git-checkout-provider.d.ts +25 -0
- package/dist/providers/git-checkout-provider.d.ts.map +1 -0
- package/dist/providers/github-ops-provider.d.ts.map +1 -1
- package/dist/providers/http-client-provider.d.ts +4 -4
- package/dist/providers/http-client-provider.d.ts.map +1 -1
- package/dist/providers/human-input-check-provider.d.ts +5 -0
- package/dist/providers/human-input-check-provider.d.ts.map +1 -1
- package/dist/providers/index.d.ts +1 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/log-check-provider.d.ts +2 -5
- package/dist/providers/log-check-provider.d.ts.map +1 -1
- package/dist/providers/mcp-check-provider.d.ts +10 -4
- package/dist/providers/mcp-check-provider.d.ts.map +1 -1
- package/dist/providers/mcp-custom-sse-server.d.ts +66 -0
- package/dist/providers/mcp-custom-sse-server.d.ts.map +1 -0
- package/dist/providers/memory-check-provider.d.ts +2 -8
- package/dist/providers/memory-check-provider.d.ts.map +1 -1
- package/dist/providers/script-check-provider.d.ts +25 -0
- package/dist/providers/script-check-provider.d.ts.map +1 -0
- package/dist/providers/workflow-check-provider.d.ts +56 -0
- package/dist/providers/workflow-check-provider.d.ts.map +1 -0
- package/dist/reviewer.d.ts +2 -1
- package/dist/reviewer.d.ts.map +1 -1
- package/dist/sdk/check-provider-registry-534KL5HT.mjs +27 -0
- package/dist/sdk/chunk-23L3QRYX.mjs +16872 -0
- package/dist/sdk/chunk-23L3QRYX.mjs.map +1 -0
- package/dist/sdk/{chunk-TUTOLSFV.mjs → chunk-3OMWVM6J.mjs} +11 -1
- package/dist/sdk/chunk-3OMWVM6J.mjs.map +1 -0
- package/dist/sdk/chunk-7UK3NIIT.mjs +482 -0
- package/dist/sdk/chunk-7UK3NIIT.mjs.map +1 -0
- package/dist/sdk/chunk-AGIZJ4UZ.mjs +173 -0
- package/dist/sdk/chunk-AGIZJ4UZ.mjs.map +1 -0
- package/dist/sdk/chunk-AIVFBIS4.mjs +1371 -0
- package/dist/sdk/chunk-AIVFBIS4.mjs.map +1 -0
- package/dist/sdk/chunk-AK6BVWIT.mjs +426 -0
- package/dist/sdk/chunk-AK6BVWIT.mjs.map +1 -0
- package/dist/sdk/chunk-AUT26LHW.mjs +139 -0
- package/dist/sdk/chunk-AUT26LHW.mjs.map +1 -0
- package/dist/sdk/chunk-BOVFH3LI.mjs +232 -0
- package/dist/sdk/chunk-BOVFH3LI.mjs.map +1 -0
- package/dist/sdk/chunk-CNX7V5JK.mjs +89 -0
- package/dist/sdk/chunk-CNX7V5JK.mjs.map +1 -0
- package/dist/sdk/chunk-HTOKWMPO.mjs +157 -0
- package/dist/sdk/chunk-HTOKWMPO.mjs.map +1 -0
- package/dist/sdk/chunk-NAW3DB3I.mjs +197 -0
- package/dist/sdk/chunk-NAW3DB3I.mjs.map +1 -0
- package/dist/sdk/chunk-O5EZDNYL.mjs +274 -0
- package/dist/sdk/chunk-O5EZDNYL.mjs.map +1 -0
- package/dist/sdk/chunk-QR7MOMJH.mjs +558 -0
- package/dist/sdk/chunk-QR7MOMJH.mjs.map +1 -0
- package/dist/sdk/chunk-QY2XYPEV.mjs +3556 -0
- package/dist/sdk/chunk-QY2XYPEV.mjs.map +1 -0
- package/dist/sdk/chunk-S2RUE2RG.mjs +145 -0
- package/dist/sdk/chunk-S2RUE2RG.mjs.map +1 -0
- package/dist/sdk/chunk-SIWNBRTK.mjs +800 -0
- package/dist/sdk/chunk-SIWNBRTK.mjs.map +1 -0
- package/dist/sdk/chunk-YSN4G6CI.mjs +146 -0
- package/dist/sdk/chunk-YSN4G6CI.mjs.map +1 -0
- package/dist/sdk/chunk-ZYAUYXSW.mjs +206 -0
- package/dist/sdk/chunk-ZYAUYXSW.mjs.map +1 -0
- package/dist/sdk/command-executor-TYUV6HUS.mjs +14 -0
- package/dist/sdk/config-YNC2EOOT.mjs +16 -0
- package/dist/sdk/config-merger-PX3WIT57.mjs +10 -0
- package/dist/sdk/event-bus-5BEVPQ6T.mjs +35 -0
- package/dist/sdk/event-bus-5BEVPQ6T.mjs.map +1 -0
- package/dist/sdk/failure-condition-evaluator-YGTF2GHG.mjs +17 -0
- package/dist/sdk/git-repository-analyzer-HJC4MYW4.mjs +458 -0
- package/dist/sdk/git-repository-analyzer-HJC4MYW4.mjs.map +1 -0
- package/dist/sdk/github-frontend-SIAEOCON.mjs +1420 -0
- package/dist/sdk/github-frontend-SIAEOCON.mjs.map +1 -0
- package/dist/sdk/host-DXUYTNMU.mjs +52 -0
- package/dist/sdk/host-DXUYTNMU.mjs.map +1 -0
- package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs → liquid-extensions-PKWCKK7E.mjs} +8 -2
- package/dist/sdk/memory-store-XGBB7LX7.mjs +12 -0
- package/dist/sdk/memory-store-XGBB7LX7.mjs.map +1 -0
- package/dist/sdk/metrics-7PP3EJUH.mjs +29 -0
- package/dist/sdk/metrics-7PP3EJUH.mjs.map +1 -0
- package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs +44 -0
- package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs.map +1 -0
- package/dist/sdk/prompt-state-YRJY6QAL.mjs +16 -0
- package/dist/sdk/prompt-state-YRJY6QAL.mjs.map +1 -0
- package/dist/sdk/renderer-schema-LPKN5UJS.mjs +51 -0
- package/dist/sdk/renderer-schema-LPKN5UJS.mjs.map +1 -0
- package/dist/sdk/routing-6N45MJ4F.mjs +24 -0
- package/dist/sdk/routing-6N45MJ4F.mjs.map +1 -0
- package/dist/sdk/sdk.d.mts +541 -22
- package/dist/sdk/sdk.d.ts +541 -22
- package/dist/sdk/sdk.js +27963 -16505
- package/dist/sdk/sdk.js.map +1 -1
- package/dist/sdk/sdk.mjs +1116 -2169
- package/dist/sdk/sdk.mjs.map +1 -1
- package/dist/sdk/session-registry-4E6YRQ77.mjs +10 -0
- package/dist/sdk/session-registry-4E6YRQ77.mjs.map +1 -0
- package/dist/sdk/slack-frontend-BVKW3GD5.mjs +735 -0
- package/dist/sdk/slack-frontend-BVKW3GD5.mjs.map +1 -0
- package/dist/sdk/trace-helpers-VP6QYVBX.mjs +23 -0
- package/dist/sdk/trace-helpers-VP6QYVBX.mjs.map +1 -0
- package/dist/sdk/{tracer-init-WC75N5NW.mjs → tracer-init-GSLPPLCD.mjs} +2 -2
- package/dist/sdk/tracer-init-GSLPPLCD.mjs.map +1 -0
- package/dist/sdk/workflow-registry-R6KSACFR.mjs +12 -0
- package/dist/sdk/workflow-registry-R6KSACFR.mjs.map +1 -0
- package/dist/sdk.d.ts.map +1 -1
- package/dist/slack/adapter.d.ts +36 -0
- package/dist/slack/adapter.d.ts.map +1 -0
- package/dist/slack/cache-prewarmer.d.ts +31 -0
- package/dist/slack/cache-prewarmer.d.ts.map +1 -0
- package/dist/slack/client.d.ts +77 -0
- package/dist/slack/client.d.ts.map +1 -0
- package/dist/slack/markdown.d.ts +45 -0
- package/dist/slack/markdown.d.ts.map +1 -0
- package/dist/slack/prompt-state.d.ts +33 -0
- package/dist/slack/prompt-state.d.ts.map +1 -0
- package/dist/slack/rate-limiter.d.ts +56 -0
- package/dist/slack/rate-limiter.d.ts.map +1 -0
- package/dist/slack/signature.d.ts +2 -0
- package/dist/slack/signature.d.ts.map +1 -0
- package/dist/slack/socket-runner.d.ts +42 -0
- package/dist/slack/socket-runner.d.ts.map +1 -0
- package/dist/slack/thread-cache.d.ts +51 -0
- package/dist/slack/thread-cache.d.ts.map +1 -0
- package/dist/snapshot-store.d.ts +59 -0
- package/dist/snapshot-store.d.ts.map +1 -0
- package/dist/state-machine/context/build-engine-context.d.ts +17 -0
- package/dist/state-machine/context/build-engine-context.d.ts.map +1 -0
- package/dist/state-machine/dispatch/dependency-gating.d.ts +12 -0
- package/dist/state-machine/dispatch/dependency-gating.d.ts.map +1 -0
- package/dist/state-machine/dispatch/execution-invoker.d.ts +14 -0
- package/dist/state-machine/dispatch/execution-invoker.d.ts.map +1 -0
- package/dist/state-machine/dispatch/foreach-processor.d.ts +8 -0
- package/dist/state-machine/dispatch/foreach-processor.d.ts.map +1 -0
- package/dist/state-machine/dispatch/history-snapshot.d.ts +8 -0
- package/dist/state-machine/dispatch/history-snapshot.d.ts.map +1 -0
- package/dist/state-machine/dispatch/on-init-handlers.d.ts +43 -0
- package/dist/state-machine/dispatch/on-init-handlers.d.ts.map +1 -0
- package/dist/state-machine/dispatch/renderer-schema.d.ts +8 -0
- package/dist/state-machine/dispatch/renderer-schema.d.ts.map +1 -0
- package/dist/state-machine/dispatch/stats-manager.d.ts +15 -0
- package/dist/state-machine/dispatch/stats-manager.d.ts.map +1 -0
- package/dist/state-machine/dispatch/template-renderer.d.ts +7 -0
- package/dist/state-machine/dispatch/template-renderer.d.ts.map +1 -0
- package/dist/state-machine/execution/summary.d.ts +8 -0
- package/dist/state-machine/execution/summary.d.ts.map +1 -0
- package/dist/state-machine/runner.d.ts +79 -0
- package/dist/state-machine/runner.d.ts.map +1 -0
- package/dist/state-machine/states/check-running.d.ts +14 -0
- package/dist/state-machine/states/check-running.d.ts.map +1 -0
- package/dist/state-machine/states/completed.d.ts +12 -0
- package/dist/state-machine/states/completed.d.ts.map +1 -0
- package/dist/state-machine/states/error.d.ts +11 -0
- package/dist/state-machine/states/error.d.ts.map +1 -0
- package/dist/state-machine/states/init.d.ts +11 -0
- package/dist/state-machine/states/init.d.ts.map +1 -0
- package/dist/state-machine/states/level-dispatch.d.ts +17 -0
- package/dist/state-machine/states/level-dispatch.d.ts.map +1 -0
- package/dist/state-machine/states/plan-ready.d.ts +12 -0
- package/dist/state-machine/states/plan-ready.d.ts.map +1 -0
- package/dist/state-machine/states/routing.d.ts +52 -0
- package/dist/state-machine/states/routing.d.ts.map +1 -0
- package/dist/state-machine/states/wave-planning.d.ts +14 -0
- package/dist/state-machine/states/wave-planning.d.ts.map +1 -0
- package/dist/state-machine/workflow-projection.d.ts +47 -0
- package/dist/state-machine/workflow-projection.d.ts.map +1 -0
- package/dist/state-machine-execution-engine.d.ts +159 -0
- package/dist/state-machine-execution-engine.d.ts.map +1 -0
- package/dist/telemetry/opentelemetry.d.ts.map +1 -1
- package/dist/telemetry/state-capture.d.ts +5 -0
- package/dist/telemetry/state-capture.d.ts.map +1 -1
- package/dist/test-runner/assertions.d.ts +59 -0
- package/dist/test-runner/assertions.d.ts.map +1 -0
- package/dist/test-runner/core/environment.d.ts +8 -0
- package/dist/test-runner/core/environment.d.ts.map +1 -0
- package/dist/test-runner/core/fixture.d.ts +3 -0
- package/dist/test-runner/core/fixture.d.ts.map +1 -0
- package/dist/test-runner/core/flow-stage.d.ts +32 -0
- package/dist/test-runner/core/flow-stage.d.ts.map +1 -0
- package/dist/test-runner/core/mocks.d.ts +8 -0
- package/dist/test-runner/core/mocks.d.ts.map +1 -0
- package/dist/test-runner/core/test-execution-wrapper.d.ts +18 -0
- package/dist/test-runner/core/test-execution-wrapper.d.ts.map +1 -0
- package/dist/test-runner/evaluators.d.ts +45 -0
- package/dist/test-runner/evaluators.d.ts.map +1 -0
- package/dist/test-runner/fixture-loader.d.ts +30 -0
- package/dist/test-runner/fixture-loader.d.ts.map +1 -0
- package/dist/test-runner/index.d.ts +127 -0
- package/dist/test-runner/index.d.ts.map +1 -0
- package/dist/test-runner/recorders/github-recorder.d.ts +23 -0
- package/dist/test-runner/recorders/github-recorder.d.ts.map +1 -0
- package/dist/test-runner/recorders/global-recorder.d.ts +4 -0
- package/dist/test-runner/recorders/global-recorder.d.ts.map +1 -0
- package/dist/test-runner/recorders/slack-recorder.d.ts +17 -0
- package/dist/test-runner/recorders/slack-recorder.d.ts.map +1 -0
- package/dist/test-runner/utils/selectors.d.ts +2 -0
- package/dist/test-runner/utils/selectors.d.ts.map +1 -0
- package/dist/test-runner/validator.d.ts +8 -0
- package/dist/test-runner/validator.d.ts.map +1 -0
- package/dist/traces/run-2026-01-20T19-22-58-043Z.ndjson +138 -0
- package/dist/traces/run-2026-01-20T19-23-52-175Z.ndjson +1067 -0
- package/dist/types/bot.d.ts +109 -0
- package/dist/types/bot.d.ts.map +1 -0
- package/dist/types/cli.d.ts +8 -1
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/config.d.ts +459 -9
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/engine.d.ts +177 -0
- package/dist/types/engine.d.ts.map +1 -0
- package/dist/types/execution.d.ts +73 -0
- package/dist/types/execution.d.ts.map +1 -0
- package/dist/types/git-checkout.d.ts +76 -0
- package/dist/types/git-checkout.d.ts.map +1 -0
- package/dist/types/github.d.ts +51 -0
- package/dist/types/github.d.ts.map +1 -0
- package/dist/types/workflow.d.ts +237 -0
- package/dist/types/workflow.d.ts.map +1 -0
- package/dist/utils/command-executor.d.ts +43 -0
- package/dist/utils/command-executor.d.ts.map +1 -0
- package/dist/utils/comment-metadata.d.ts +21 -0
- package/dist/utils/comment-metadata.d.ts.map +1 -0
- package/dist/utils/config-loader.d.ts.map +1 -1
- package/dist/utils/config-merger.d.ts.map +1 -1
- package/dist/utils/env-exposure.d.ts +3 -0
- package/dist/utils/env-exposure.d.ts.map +1 -0
- package/dist/utils/file-exclusion.d.ts.map +1 -1
- package/dist/utils/interactive-prompt.d.ts +1 -1
- package/dist/utils/interactive-prompt.d.ts.map +1 -1
- package/dist/utils/json-text-extractor.d.ts +17 -0
- package/dist/utils/json-text-extractor.d.ts.map +1 -0
- package/dist/utils/sandbox.d.ts +10 -0
- package/dist/utils/sandbox.d.ts.map +1 -1
- package/dist/utils/script-memory-ops.d.ts +21 -0
- package/dist/utils/script-memory-ops.d.ts.map +1 -0
- package/dist/utils/template-context.d.ts +8 -0
- package/dist/utils/template-context.d.ts.map +1 -0
- package/dist/utils/tracer-init.d.ts.map +1 -1
- package/dist/utils/workspace-manager.d.ts +118 -0
- package/dist/utils/workspace-manager.d.ts.map +1 -0
- package/dist/utils/worktree-cleanup.d.ts +33 -0
- package/dist/utils/worktree-cleanup.d.ts.map +1 -0
- package/dist/utils/worktree-manager.d.ts +153 -0
- package/dist/utils/worktree-manager.d.ts.map +1 -0
- package/dist/webhook-server.d.ts +3 -3
- package/dist/webhook-server.d.ts.map +1 -1
- package/dist/workflow-executor.d.ts +81 -0
- package/dist/workflow-executor.d.ts.map +1 -0
- package/dist/workflow-registry.d.ts +79 -0
- package/dist/workflow-registry.d.ts.map +1 -0
- package/package.json +12 -5
- package/dist/output/traces/run-2025-10-22T18-22-56-873Z.ndjson +0 -218
- package/dist/sdk/check-execution-engine-2YYKUUSH.mjs +0 -11
- package/dist/sdk/check-execution-engine-6QJXYYON.mjs +0 -11
- package/dist/sdk/check-execution-engine-PJZ4ZOKG.mjs +0 -11
- package/dist/sdk/chunk-33QVZ2D4.mjs +0 -316
- package/dist/sdk/chunk-33QVZ2D4.mjs.map +0 -1
- package/dist/sdk/chunk-B5QBV2QJ.mjs +0 -752
- package/dist/sdk/chunk-B5QBV2QJ.mjs.map +0 -1
- package/dist/sdk/chunk-BVFNRCHT.mjs +0 -14129
- package/dist/sdk/chunk-BVFNRCHT.mjs.map +0 -1
- package/dist/sdk/chunk-KWZW23FG.mjs +0 -14129
- package/dist/sdk/chunk-KWZW23FG.mjs.map +0 -1
- package/dist/sdk/chunk-O4RP4BRH.mjs +0 -14092
- package/dist/sdk/chunk-O4RP4BRH.mjs.map +0 -1
- package/dist/sdk/chunk-TUTOLSFV.mjs.map +0 -1
- package/dist/sdk/chunk-U5D2LY66.mjs +0 -245
- package/dist/sdk/chunk-U5D2LY66.mjs.map +0 -1
- package/dist/sdk/chunk-U7X54EMV.mjs +0 -331
- package/dist/sdk/chunk-U7X54EMV.mjs.map +0 -1
- package/dist/sdk/config-merger-TWUBWFC2.mjs +0 -8
- package/dist/sdk/mermaid-telemetry-SN6A2TKW.mjs +0 -61
- package/dist/sdk/mermaid-telemetry-SN6A2TKW.mjs.map +0 -1
- package/dist/sdk/mermaid-telemetry-YCTIG76M.mjs +0 -61
- package/dist/sdk/mermaid-telemetry-YCTIG76M.mjs.map +0 -1
- package/dist/traces/run-2025-10-22T18-22-56-873Z.ndjson +0 -218
- /package/dist/sdk/{check-execution-engine-2YYKUUSH.mjs.map → check-provider-registry-534KL5HT.mjs.map} +0 -0
- /package/dist/sdk/{check-execution-engine-6QJXYYON.mjs.map → command-executor-TYUV6HUS.mjs.map} +0 -0
- /package/dist/sdk/{check-execution-engine-PJZ4ZOKG.mjs.map → config-YNC2EOOT.mjs.map} +0 -0
- /package/dist/sdk/{config-merger-TWUBWFC2.mjs.map → config-merger-PX3WIT57.mjs.map} +0 -0
- /package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs.map → failure-condition-evaluator-YGTF2GHG.mjs.map} +0 -0
- /package/dist/sdk/{tracer-init-WC75N5NW.mjs.map → liquid-extensions-PKWCKK7E.mjs.map} +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Calculator SDK Example
|
|
5
|
+
*
|
|
6
|
+
* This example demonstrates how to use the human-input provider with SDK hooks
|
|
7
|
+
* to create an interactive calculator that:
|
|
8
|
+
* 1. Asks user for first number
|
|
9
|
+
* 2. Asks user for second number
|
|
10
|
+
* 3. Asks user for operation (+, -, *, /)
|
|
11
|
+
* 4. Stores values in memory
|
|
12
|
+
* 5. Performs calculation using JavaScript
|
|
13
|
+
* 6. Outputs the result
|
|
14
|
+
*
|
|
15
|
+
* Usage:
|
|
16
|
+
* node examples/calculator-sdk-example.ts
|
|
17
|
+
*
|
|
18
|
+
* Or with custom hook implementation:
|
|
19
|
+
* ts-node examples/calculator-sdk-example.ts
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
import * as readline from 'readline';
|
|
23
|
+
import { HumanInputRequest } from '../src/types/config';
|
|
24
|
+
|
|
25
|
+
// Mock the CheckExecutionEngine - in real usage, you'd import from '@probelabs/visor'
|
|
26
|
+
// For this example, we'll simulate the workflow
|
|
27
|
+
|
|
28
|
+
interface CalculatorConfig {
|
|
29
|
+
version: string;
|
|
30
|
+
checks: Record<string, any>;
|
|
31
|
+
output: any;
|
|
32
|
+
memory?: {
|
|
33
|
+
storage: 'memory';
|
|
34
|
+
namespace: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const calculatorConfig: CalculatorConfig = {
|
|
39
|
+
version: "1.0",
|
|
40
|
+
|
|
41
|
+
memory: {
|
|
42
|
+
storage: 'memory',
|
|
43
|
+
namespace: 'calculator'
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
checks: {
|
|
47
|
+
// Step 1: Get first number
|
|
48
|
+
"get-number1": {
|
|
49
|
+
type: "human-input",
|
|
50
|
+
prompt: "Enter the first number:",
|
|
51
|
+
placeholder: "e.g., 42",
|
|
52
|
+
allow_empty: false
|
|
53
|
+
},
|
|
54
|
+
|
|
55
|
+
// Step 2: Store first number in memory
|
|
56
|
+
"store-number1": {
|
|
57
|
+
type: "memory",
|
|
58
|
+
depends_on: ["get-number1"],
|
|
59
|
+
operation: "set",
|
|
60
|
+
namespace: "calculator",
|
|
61
|
+
key: "number1",
|
|
62
|
+
value_js: "parseFloat(outputs['get-number1'])"
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
// Step 3: Get second number
|
|
66
|
+
"get-number2": {
|
|
67
|
+
type: "human-input",
|
|
68
|
+
depends_on: ["store-number1"],
|
|
69
|
+
prompt: "Enter the second number:",
|
|
70
|
+
placeholder: "e.g., 7",
|
|
71
|
+
allow_empty: false
|
|
72
|
+
},
|
|
73
|
+
|
|
74
|
+
// Step 4: Store second number in memory
|
|
75
|
+
"store-number2": {
|
|
76
|
+
type: "memory",
|
|
77
|
+
depends_on: ["get-number2"],
|
|
78
|
+
operation: "set",
|
|
79
|
+
namespace: "calculator",
|
|
80
|
+
key: "number2",
|
|
81
|
+
value_js: "parseFloat(outputs['get-number2'])"
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
// Step 5: Get operation
|
|
85
|
+
"get-operation": {
|
|
86
|
+
type: "human-input",
|
|
87
|
+
depends_on: ["store-number2"],
|
|
88
|
+
prompt: "Select operation (+, -, *, /):",
|
|
89
|
+
placeholder: "Enter one of: + - * /",
|
|
90
|
+
allow_empty: false
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
// Step 6: Store operation in memory
|
|
94
|
+
"store-operation": {
|
|
95
|
+
type: "memory",
|
|
96
|
+
depends_on: ["get-operation"],
|
|
97
|
+
operation: "set",
|
|
98
|
+
namespace: "calculator",
|
|
99
|
+
key: "operation",
|
|
100
|
+
value_js: "outputs['get-operation'].trim()"
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// Step 7: Perform calculation using memory and JavaScript
|
|
104
|
+
"calculate": {
|
|
105
|
+
type: "script",
|
|
106
|
+
depends_on: ["store-operation"],
|
|
107
|
+
content: `
|
|
108
|
+
// Get values from memory
|
|
109
|
+
const num1 = memory.get('number1', 'calculator');
|
|
110
|
+
const num2 = memory.get('number2', 'calculator');
|
|
111
|
+
const op = memory.get('operation', 'calculator');
|
|
112
|
+
|
|
113
|
+
// Log for debugging
|
|
114
|
+
log('Calculating:', num1, op, num2);
|
|
115
|
+
|
|
116
|
+
// Perform calculation
|
|
117
|
+
let result;
|
|
118
|
+
switch(op) {
|
|
119
|
+
case '+':
|
|
120
|
+
result = num1 + num2;
|
|
121
|
+
break;
|
|
122
|
+
case '-':
|
|
123
|
+
result = num1 - num2;
|
|
124
|
+
break;
|
|
125
|
+
case '*':
|
|
126
|
+
result = num1 * num2;
|
|
127
|
+
break;
|
|
128
|
+
case '/':
|
|
129
|
+
if (num2 === 0) {
|
|
130
|
+
throw new Error('Division by zero!');
|
|
131
|
+
}
|
|
132
|
+
result = num1 / num2;
|
|
133
|
+
break;
|
|
134
|
+
default:
|
|
135
|
+
throw new Error('Invalid operation: ' + op);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Return result for output
|
|
139
|
+
return result;
|
|
140
|
+
`
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
// Step 8: Display the result
|
|
144
|
+
"show-result": {
|
|
145
|
+
type: "log",
|
|
146
|
+
depends_on: ["calculate"],
|
|
147
|
+
message: `
|
|
148
|
+
╔════════════════════════════════════════╗
|
|
149
|
+
║ CALCULATION RESULT ║
|
|
150
|
+
╠════════════════════════════════════════╣
|
|
151
|
+
║ ║
|
|
152
|
+
║ {{ memory.get('number1', 'calculator') }} {{ memory.get('operation', 'calculator') }} {{ memory.get('number2', 'calculator') }} = {{ memory.get('result', 'calculator') }}
|
|
153
|
+
║ ║
|
|
154
|
+
╚════════════════════════════════════════╝
|
|
155
|
+
`
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
output: {
|
|
160
|
+
pr_comment: {
|
|
161
|
+
format: "markdown",
|
|
162
|
+
group_by: "check",
|
|
163
|
+
collapse: false
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Custom hook for handling human input via readline
|
|
170
|
+
* This is what users would implement in their SDK integration
|
|
171
|
+
*/
|
|
172
|
+
async function customHumanInputHandler(request: HumanInputRequest): Promise<string> {
|
|
173
|
+
return new Promise((resolve) => {
|
|
174
|
+
const rl = readline.createInterface({
|
|
175
|
+
input: process.stdin,
|
|
176
|
+
output: process.stdout
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
console.log('\n┌─────────────────────────────────────────┐');
|
|
180
|
+
console.log(`│ ${request.prompt.padEnd(39)} │`);
|
|
181
|
+
console.log('└─────────────────────────────────────────┘');
|
|
182
|
+
|
|
183
|
+
rl.question('> ', (answer) => {
|
|
184
|
+
rl.close();
|
|
185
|
+
|
|
186
|
+
const trimmed = answer.trim();
|
|
187
|
+
if (!trimmed && !request.allowEmpty) {
|
|
188
|
+
console.log('❌ Empty input not allowed. Please try again.\n');
|
|
189
|
+
// In real implementation, would retry
|
|
190
|
+
resolve('');
|
|
191
|
+
} else {
|
|
192
|
+
resolve(trimmed || request.default || '');
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Main SDK example
|
|
200
|
+
*/
|
|
201
|
+
async function main() {
|
|
202
|
+
console.log('╔═══════════════════════════════════════════╗');
|
|
203
|
+
console.log('║ Visor SDK Calculator Example ║');
|
|
204
|
+
console.log('║ Human Input + Memory + JavaScript ║');
|
|
205
|
+
console.log('╚═══════════════════════════════════════════╝\n');
|
|
206
|
+
|
|
207
|
+
console.log('This example demonstrates:');
|
|
208
|
+
console.log(' • Using human-input checks with SDK hooks');
|
|
209
|
+
console.log(' • Storing data in memory between steps');
|
|
210
|
+
console.log(' • Performing calculations with JavaScript');
|
|
211
|
+
console.log(' • Sequential workflow with dependencies\n');
|
|
212
|
+
|
|
213
|
+
console.log('Configuration loaded:');
|
|
214
|
+
console.log(` - ${Object.keys(calculatorConfig.checks).length} checks defined`);
|
|
215
|
+
console.log(` - Memory namespace: ${calculatorConfig.memory?.namespace}\n`);
|
|
216
|
+
|
|
217
|
+
console.log('─'.repeat(45));
|
|
218
|
+
console.log('Starting interactive calculator workflow...');
|
|
219
|
+
console.log('─'.repeat(45));
|
|
220
|
+
|
|
221
|
+
// In a real implementation, you would:
|
|
222
|
+
//
|
|
223
|
+
// import { CheckExecutionEngine } from '@probelabs/visor';
|
|
224
|
+
// import { HumanInputCheckProvider } from '@probelabs/visor/providers';
|
|
225
|
+
//
|
|
226
|
+
// // Set the hook
|
|
227
|
+
// HumanInputCheckProvider.setHooks({
|
|
228
|
+
// onHumanInput: customHumanInputHandler
|
|
229
|
+
// });
|
|
230
|
+
//
|
|
231
|
+
// // Run the checks
|
|
232
|
+
// const engine = new CheckExecutionEngine();
|
|
233
|
+
// const results = await engine.executeChecks(
|
|
234
|
+
// prInfo,
|
|
235
|
+
// calculatorConfig,
|
|
236
|
+
// Object.keys(calculatorConfig.checks)
|
|
237
|
+
// );
|
|
238
|
+
//
|
|
239
|
+
// console.log('Results:', results);
|
|
240
|
+
|
|
241
|
+
console.log('\n📝 To run this example with actual Visor SDK:');
|
|
242
|
+
console.log(' 1. Import CheckExecutionEngine and HumanInputCheckProvider');
|
|
243
|
+
console.log(' 2. Set the onHumanInput hook with customHumanInputHandler');
|
|
244
|
+
console.log(' 3. Execute the checks with the calculator configuration');
|
|
245
|
+
console.log(' 4. The workflow will prompt for inputs and calculate result');
|
|
246
|
+
|
|
247
|
+
console.log('\n💡 Alternatively, run with CLI:');
|
|
248
|
+
console.log(' Save the config to calculator.yaml and run:');
|
|
249
|
+
console.log(' $ visor --config calculator.yaml');
|
|
250
|
+
console.log(' (Will use interactive terminal prompts automatically)');
|
|
251
|
+
|
|
252
|
+
// Save the config for CLI usage
|
|
253
|
+
const fs = require('fs');
|
|
254
|
+
const yaml = require('js-yaml');
|
|
255
|
+
const configPath = __dirname + '/calculator-config.yaml';
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
const yamlContent = yaml.dump(calculatorConfig);
|
|
259
|
+
fs.writeFileSync(configPath, yamlContent);
|
|
260
|
+
console.log(`\n✅ Configuration saved to: ${configPath}`);
|
|
261
|
+
} catch (error) {
|
|
262
|
+
console.log('\n⚠️ Could not save YAML config (js-yaml not installed)');
|
|
263
|
+
console.log(' Install with: npm install js-yaml');
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Run if executed directly
|
|
268
|
+
if (require.main === module) {
|
|
269
|
+
main().catch(error => {
|
|
270
|
+
console.error('Error:', error);
|
|
271
|
+
process.exit(1);
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export { calculatorConfig, customHumanInputHandler };
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Calculator SDK Example with JSON Output
|
|
5
|
+
*
|
|
6
|
+
* This example shows how to:
|
|
7
|
+
* - Use JSON output format instead of table
|
|
8
|
+
* - Suppress stdout/stderr messages from the engine
|
|
9
|
+
* - Get clean JSON response for programmatic processing
|
|
10
|
+
* - Visualize results in custom script logic
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* npm run build
|
|
14
|
+
* bun examples/calculator-sdk-json.ts
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import * as readline from 'readline';
|
|
18
|
+
import { HumanInputRequest, VisorConfig } from '../src/types/config';
|
|
19
|
+
import { HumanInputCheckProvider } from '../src/providers/human-input-check-provider';
|
|
20
|
+
import { CheckExecutionEngine } from '../src/check-execution-engine';
|
|
21
|
+
|
|
22
|
+
// ============================================================================
|
|
23
|
+
// CONFIGURATION
|
|
24
|
+
// ============================================================================
|
|
25
|
+
|
|
26
|
+
const calculatorConfig: VisorConfig = {
|
|
27
|
+
version: "1.0",
|
|
28
|
+
|
|
29
|
+
memory: {
|
|
30
|
+
namespace: "calculator",
|
|
31
|
+
persist: false
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
checks: {
|
|
35
|
+
"get-number1": {
|
|
36
|
+
type: "human-input",
|
|
37
|
+
prompt: "Enter the first number:",
|
|
38
|
+
placeholder: "e.g., 42",
|
|
39
|
+
allow_empty: false,
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
"store-number1": {
|
|
43
|
+
type: "memory",
|
|
44
|
+
depends_on: ["get-number1"],
|
|
45
|
+
operation: "set",
|
|
46
|
+
namespace: "calculator",
|
|
47
|
+
key: "number1",
|
|
48
|
+
value_js: "parseFloat(outputs['get-number1'])"
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
"get-number2": {
|
|
52
|
+
type: "human-input",
|
|
53
|
+
depends_on: ["store-number1"],
|
|
54
|
+
prompt: "Enter the second number:",
|
|
55
|
+
placeholder: "e.g., 7",
|
|
56
|
+
allow_empty: false,
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
"store-number2": {
|
|
60
|
+
type: "memory",
|
|
61
|
+
depends_on: ["get-number2"],
|
|
62
|
+
operation: "set",
|
|
63
|
+
namespace: "calculator",
|
|
64
|
+
key: "number2",
|
|
65
|
+
value_js: "parseFloat(outputs['get-number2'])"
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
"get-operation": {
|
|
69
|
+
type: "human-input",
|
|
70
|
+
depends_on: ["store-number2"],
|
|
71
|
+
prompt: "Select operation (+, -, *, /):",
|
|
72
|
+
placeholder: "Enter one of: + - * /",
|
|
73
|
+
allow_empty: false,
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
"store-operation": {
|
|
77
|
+
type: "memory",
|
|
78
|
+
depends_on: ["get-operation"],
|
|
79
|
+
operation: "set",
|
|
80
|
+
namespace: "calculator",
|
|
81
|
+
key: "operation",
|
|
82
|
+
value_js: "outputs['get-operation'].trim()",
|
|
83
|
+
fail_if: "!['+', '-', '*', '/'].includes(outputs['get-operation'].trim())"
|
|
84
|
+
},
|
|
85
|
+
|
|
86
|
+
"calculate": {
|
|
87
|
+
type: "script",
|
|
88
|
+
depends_on: ["store-operation"],
|
|
89
|
+
content: `
|
|
90
|
+
const num1 = memory.get('number1', 'calculator');
|
|
91
|
+
const num2 = memory.get('number2', 'calculator');
|
|
92
|
+
const op = memory.get('operation', 'calculator');
|
|
93
|
+
|
|
94
|
+
let result;
|
|
95
|
+
switch(op) {
|
|
96
|
+
case '+': result = num1 + num2; break;
|
|
97
|
+
case '-': result = num1 - num2; break;
|
|
98
|
+
case '*': result = num1 * num2; break;
|
|
99
|
+
case '/':
|
|
100
|
+
if (num2 === 0) throw new Error('Division by zero!');
|
|
101
|
+
result = num1 / num2;
|
|
102
|
+
break;
|
|
103
|
+
default: throw new Error('Invalid operation: ' + op);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return result;
|
|
107
|
+
`
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
"format-result": {
|
|
111
|
+
type: "log",
|
|
112
|
+
depends_on: ["calculate"],
|
|
113
|
+
level: "info",
|
|
114
|
+
message: `{{ outputs['get-number1'] }} {{ outputs['get-operation'] }} {{ outputs['get-number2'] }} = {{ outputs['calculate'] }}`
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// ============================================================================
|
|
120
|
+
// CUSTOM INPUT HANDLER (Quiet Mode)
|
|
121
|
+
// ============================================================================
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Minimal readline-based input handler for SDK mode
|
|
125
|
+
* Only shows the prompt, not the engine's debug output
|
|
126
|
+
*/
|
|
127
|
+
async function customHumanInputHandler(request: HumanInputRequest): Promise<string> {
|
|
128
|
+
return new Promise((resolve, reject) => {
|
|
129
|
+
const rl = readline.createInterface({
|
|
130
|
+
input: process.stdin,
|
|
131
|
+
output: process.stdout
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
const promptText = request.placeholder
|
|
135
|
+
? `${request.prompt} (${request.placeholder}): `
|
|
136
|
+
: `${request.prompt}: `;
|
|
137
|
+
|
|
138
|
+
rl.question(promptText, (answer: string) => {
|
|
139
|
+
rl.close();
|
|
140
|
+
|
|
141
|
+
const trimmed = answer.trim();
|
|
142
|
+
|
|
143
|
+
// Validate
|
|
144
|
+
if (!request.allowEmpty && trimmed === '') {
|
|
145
|
+
if (request.default) {
|
|
146
|
+
resolve(request.default);
|
|
147
|
+
} else {
|
|
148
|
+
reject(new Error('Input cannot be empty'));
|
|
149
|
+
}
|
|
150
|
+
} else {
|
|
151
|
+
resolve(trimmed || request.default || '');
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
// Handle timeout if specified
|
|
156
|
+
if (request.timeout) {
|
|
157
|
+
setTimeout(() => {
|
|
158
|
+
rl.close();
|
|
159
|
+
if (request.default) {
|
|
160
|
+
resolve(request.default);
|
|
161
|
+
} else {
|
|
162
|
+
reject(new Error('Input timeout'));
|
|
163
|
+
}
|
|
164
|
+
}, request.timeout);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ============================================================================
|
|
170
|
+
// SUPPRESS ENGINE OUTPUT (Optional)
|
|
171
|
+
// ============================================================================
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Capture and suppress console output from the engine
|
|
175
|
+
* Returns a restore function to revert
|
|
176
|
+
*/
|
|
177
|
+
function suppressConsole() {
|
|
178
|
+
const originalLog = console.log;
|
|
179
|
+
const originalError = console.error;
|
|
180
|
+
const originalWarn = console.warn;
|
|
181
|
+
const originalInfo = console.info;
|
|
182
|
+
|
|
183
|
+
const logs: string[] = [];
|
|
184
|
+
|
|
185
|
+
console.log = (...args: any[]) => {
|
|
186
|
+
logs.push(args.map(String).join(' '));
|
|
187
|
+
};
|
|
188
|
+
console.error = (...args: any[]) => {
|
|
189
|
+
logs.push('[ERROR] ' + args.map(String).join(' '));
|
|
190
|
+
};
|
|
191
|
+
console.warn = (...args: any[]) => {
|
|
192
|
+
logs.push('[WARN] ' + args.map(String).join(' '));
|
|
193
|
+
};
|
|
194
|
+
console.info = (...args: any[]) => {
|
|
195
|
+
logs.push('[INFO] ' + args.map(String).join(' '));
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
restore: () => {
|
|
200
|
+
console.log = originalLog;
|
|
201
|
+
console.error = originalError;
|
|
202
|
+
console.warn = originalWarn;
|
|
203
|
+
console.info = originalInfo;
|
|
204
|
+
},
|
|
205
|
+
getLogs: () => logs
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// ============================================================================
|
|
210
|
+
// MAIN EXECUTION
|
|
211
|
+
// ============================================================================
|
|
212
|
+
|
|
213
|
+
async function main() {
|
|
214
|
+
console.log('🧮 Calculator SDK - JSON Output Mode\n');
|
|
215
|
+
|
|
216
|
+
try {
|
|
217
|
+
// Set up the human input hook
|
|
218
|
+
HumanInputCheckProvider.setHooks({
|
|
219
|
+
onHumanInput: customHumanInputHandler
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
// Suppress engine console output
|
|
223
|
+
const suppressor = suppressConsole();
|
|
224
|
+
|
|
225
|
+
// Create execution engine
|
|
226
|
+
const engine = new CheckExecutionEngine();
|
|
227
|
+
|
|
228
|
+
// Execute all checks in the workflow with JSON output
|
|
229
|
+
const checksToRun = Object.keys(calculatorConfig.checks || {});
|
|
230
|
+
|
|
231
|
+
const result = await engine.executeChecks({
|
|
232
|
+
checks: checksToRun,
|
|
233
|
+
config: calculatorConfig,
|
|
234
|
+
outputFormat: 'json', // ← JSON format for programmatic processing
|
|
235
|
+
maxParallelism: 1, // Sequential for human input
|
|
236
|
+
debug: false // No debug output
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
// Restore console
|
|
240
|
+
suppressor.restore();
|
|
241
|
+
|
|
242
|
+
// ========================================================================
|
|
243
|
+
// PROCESS JSON RESULT
|
|
244
|
+
// ========================================================================
|
|
245
|
+
|
|
246
|
+
console.log('\n📊 Execution Results (JSON):\n');
|
|
247
|
+
console.log(JSON.stringify(result, null, 2));
|
|
248
|
+
|
|
249
|
+
// ========================================================================
|
|
250
|
+
// CUSTOM VISUALIZATION
|
|
251
|
+
// ========================================================================
|
|
252
|
+
|
|
253
|
+
console.log('\n✨ Custom Visualization:\n');
|
|
254
|
+
|
|
255
|
+
// Extract calculation details from memory
|
|
256
|
+
const { MemoryStore } = await import('../src/memory-store');
|
|
257
|
+
const memoryStore = MemoryStore.getInstance(calculatorConfig.memory);
|
|
258
|
+
|
|
259
|
+
const num1 = memoryStore.get('number1', 'calculator');
|
|
260
|
+
const num2 = memoryStore.get('number2', 'calculator');
|
|
261
|
+
const operation = memoryStore.get('operation', 'calculator');
|
|
262
|
+
const resultValue = memoryStore.get('result', 'calculator');
|
|
263
|
+
|
|
264
|
+
// Display in custom format
|
|
265
|
+
console.log('┌─────────────────────────────────┐');
|
|
266
|
+
console.log('│ CALCULATION RESULT │');
|
|
267
|
+
console.log('├─────────────────────────────────┤');
|
|
268
|
+
console.log(`│ First Number: ${String(num1).padEnd(15)} │`);
|
|
269
|
+
console.log(`│ Second Number: ${String(num2).padEnd(15)} │`);
|
|
270
|
+
console.log(`│ Operation: ${String(operation).padEnd(15)} │`);
|
|
271
|
+
console.log('├─────────────────────────────────┤');
|
|
272
|
+
console.log(`│ Result: ${String(resultValue).padEnd(15)} │`);
|
|
273
|
+
console.log('└─────────────────────────────────┘');
|
|
274
|
+
|
|
275
|
+
// Show execution statistics
|
|
276
|
+
console.log('\n📈 Execution Statistics:');
|
|
277
|
+
console.log(` - Total checks: ${checksToRun.length}`);
|
|
278
|
+
console.log(` - Execution time: ${result.executionTime}ms`);
|
|
279
|
+
console.log(` - Timestamp: ${result.timestamp}`);
|
|
280
|
+
|
|
281
|
+
// Check for issues
|
|
282
|
+
const totalIssues = result.summary?.issues?.length || 0;
|
|
283
|
+
if (totalIssues > 0) {
|
|
284
|
+
console.log(`\n⚠️ Issues found: ${totalIssues}`);
|
|
285
|
+
result.summary.issues.forEach((issue: any, idx: number) => {
|
|
286
|
+
console.log(` ${idx + 1}. [${issue.severity}] ${issue.message}`);
|
|
287
|
+
});
|
|
288
|
+
} else {
|
|
289
|
+
console.log('\n✅ No issues found!');
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Return structured data for further processing
|
|
293
|
+
return {
|
|
294
|
+
success: true,
|
|
295
|
+
calculation: {
|
|
296
|
+
number1: num1,
|
|
297
|
+
number2: num2,
|
|
298
|
+
operation: operation,
|
|
299
|
+
result: resultValue,
|
|
300
|
+
expression: `${num1} ${operation} ${num2} = ${resultValue}`
|
|
301
|
+
},
|
|
302
|
+
executionTime: result.executionTime,
|
|
303
|
+
issues: result.summary?.issues || []
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
} catch (error) {
|
|
307
|
+
console.error('\n❌ Error running calculator:');
|
|
308
|
+
if (error instanceof Error) {
|
|
309
|
+
console.error(` ${error.message}`);
|
|
310
|
+
} else {
|
|
311
|
+
console.error(` ${error}`);
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return {
|
|
315
|
+
success: false,
|
|
316
|
+
error: error instanceof Error ? error.message : String(error)
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
// Run and display final result
|
|
322
|
+
main()
|
|
323
|
+
.then((finalResult) => {
|
|
324
|
+
console.log('\n🎯 Final Result Object:\n');
|
|
325
|
+
console.log(JSON.stringify(finalResult, null, 2));
|
|
326
|
+
console.log('\n✨ Done!\n');
|
|
327
|
+
})
|
|
328
|
+
.catch((error) => {
|
|
329
|
+
console.error('Fatal error:', error);
|
|
330
|
+
process.exit(1);
|
|
331
|
+
});
|