@probelabs/visor 0.1.106 → 0.1.107

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.
Files changed (450) hide show
  1. package/README.md +65 -2
  2. package/action.yml +1 -1
  3. package/defaults/code-refiner.yaml +114 -0
  4. package/defaults/{.visor.yaml → code-review.yaml} +35 -226
  5. package/defaults/override.yaml +52 -0
  6. package/defaults/task-refinement.yaml +620 -0
  7. package/defaults/visor.tests.yaml +674 -0
  8. package/defaults/visor.yaml +482 -0
  9. package/dist/663.index.js +2 -3
  10. package/dist/80.index.js +2 -3
  11. package/dist/action-cli-bridge.d.ts +11 -82
  12. package/dist/action-cli-bridge.d.ts.map +1 -1
  13. package/dist/ai-review-service.d.ts +15 -0
  14. package/dist/ai-review-service.d.ts.map +1 -1
  15. package/dist/check-execution-engine.d.ts +19 -331
  16. package/dist/check-execution-engine.d.ts.map +1 -1
  17. package/dist/cli-main.d.ts.map +1 -1
  18. package/dist/cli.d.ts +0 -1
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/config.d.ts +16 -0
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/cron-scheduler.d.ts +3 -3
  23. package/dist/cron-scheduler.d.ts.map +1 -1
  24. package/dist/debug-visualizer/ws-server.d.ts.map +1 -1
  25. package/dist/defaults/code-refiner.yaml +114 -0
  26. package/dist/defaults/{.visor.yaml → code-review.yaml} +35 -226
  27. package/dist/defaults/override.yaml +52 -0
  28. package/dist/defaults/task-refinement.yaml +620 -0
  29. package/dist/defaults/visor.tests.yaml +674 -0
  30. package/dist/defaults/visor.yaml +482 -0
  31. package/dist/docs/DEPLOYMENT.md +118 -0
  32. package/dist/docs/GITHUB_CHECKS.md +280 -0
  33. package/dist/docs/NPM_USAGE.md +208 -0
  34. package/dist/docs/action-reference.md +19 -0
  35. package/dist/docs/advanced-ai.md +178 -0
  36. package/dist/docs/ai-configuration.md +468 -0
  37. package/dist/docs/author-permissions.md +610 -0
  38. package/dist/docs/ci-cli-mode.md +34 -0
  39. package/dist/docs/claude-code.md +74 -0
  40. package/dist/docs/command-provider.md +559 -0
  41. package/dist/docs/commands.md +8 -0
  42. package/dist/docs/configuration.md +303 -0
  43. package/dist/docs/custom-tools.md +424 -0
  44. package/dist/docs/dashboards/README.md +23 -0
  45. package/dist/docs/dashboards/grafana-visor-diagrams.json +20 -0
  46. package/dist/docs/dashboards/grafana-visor-overview.json +33 -0
  47. package/dist/docs/debug-visualizer-progress.md +572 -0
  48. package/dist/docs/debug-visualizer-rfc.md +691 -0
  49. package/dist/docs/debug-visualizer.md +114 -0
  50. package/dist/docs/debugging.md +636 -0
  51. package/dist/docs/default-output-schema.md +28 -0
  52. package/dist/docs/dependencies.md +369 -0
  53. package/dist/docs/dev-playbook.md +9 -0
  54. package/dist/docs/engine-state-machine-plan.md +333 -0
  55. package/dist/docs/event-driven-github-integration-rfc.md +743 -0
  56. package/dist/docs/event-triggers.md +292 -0
  57. package/dist/docs/execution-statistics-rfc.md +290 -0
  58. package/dist/docs/fact-validator-gap-analysis.md +178 -0
  59. package/dist/docs/fact-validator-implementation-plan.md +1235 -0
  60. package/dist/docs/fail-if.md +95 -0
  61. package/dist/docs/failure-conditions-implementation.md +271 -0
  62. package/dist/docs/failure-conditions-schema.md +173 -0
  63. package/dist/docs/failure-routing-rfc.md +193 -0
  64. package/dist/docs/failure-routing.md +507 -0
  65. package/dist/docs/foreach-dependency-propagation.md +473 -0
  66. package/dist/docs/github-ops.md +89 -0
  67. package/dist/docs/goto-forward-run-plan.md +113 -0
  68. package/dist/docs/guides/criticality-modes.md +332 -0
  69. package/dist/docs/guides/fault-management-and-contracts.md +738 -0
  70. package/dist/docs/guides/workflow-style-guide.md +224 -0
  71. package/dist/docs/http.md +299 -0
  72. package/dist/docs/human-input-provider.md +372 -0
  73. package/dist/docs/limits.md +64 -0
  74. package/dist/docs/liquid-templates.md +347 -0
  75. package/dist/docs/loop-routing-refactor.md +89 -0
  76. package/dist/docs/mcp-provider.md +557 -0
  77. package/dist/docs/mcp.md +124 -0
  78. package/dist/docs/memory.md +903 -0
  79. package/dist/docs/observability.md +12 -0
  80. package/dist/docs/output-formats.md +20 -0
  81. package/dist/docs/output-formatting.md +29 -0
  82. package/dist/docs/output-history.md +383 -0
  83. package/dist/docs/performance.md +6 -0
  84. package/dist/docs/pluggable.md +124 -0
  85. package/dist/docs/proposals/snapshot-scope-execution.md +236 -0
  86. package/dist/docs/recipes.md +21 -0
  87. package/dist/docs/roadmap/criticality-implementation-tasks.md +92 -0
  88. package/dist/docs/schema-next-pr.md +10 -0
  89. package/dist/docs/schema-templates.md +68 -0
  90. package/dist/docs/script.md +34 -0
  91. package/dist/docs/sdk.md +222 -0
  92. package/dist/docs/security.md +7 -0
  93. package/dist/docs/suppressions.md +89 -0
  94. package/dist/docs/tag-filtering.md +258 -0
  95. package/dist/docs/telemetry-setup.md +119 -0
  96. package/dist/docs/telemetry-tracing-rfc.md +275 -0
  97. package/dist/docs/test-framework-rfc.md +680 -0
  98. package/dist/docs/testing/assertions.md +85 -0
  99. package/dist/docs/testing/ci.md +44 -0
  100. package/dist/docs/testing/cli.md +41 -0
  101. package/dist/docs/testing/cookbook.md +172 -0
  102. package/dist/docs/testing/dsl-reference.md +199 -0
  103. package/dist/docs/testing/fixtures-and-mocks.md +91 -0
  104. package/dist/docs/testing/flows.md +92 -0
  105. package/dist/docs/testing/getting-started.md +93 -0
  106. package/dist/docs/testing/troubleshooting.md +55 -0
  107. package/dist/docs/timeouts.md +50 -0
  108. package/dist/docs/troubleshooting.md +7 -0
  109. package/dist/docs/visor-sdk-rfc.md +186 -0
  110. package/dist/docs/workflows.md +569 -0
  111. package/dist/engine/on-finish/orchestrator.d.ts +19 -0
  112. package/dist/engine/on-finish/orchestrator.d.ts.map +1 -0
  113. package/dist/engine/on-finish/utils.d.ts +44 -0
  114. package/dist/engine/on-finish/utils.d.ts.map +1 -0
  115. package/dist/event-bus/event-bus.d.ts +13 -0
  116. package/dist/event-bus/event-bus.d.ts.map +1 -0
  117. package/dist/event-bus/types.d.ts +57 -0
  118. package/dist/event-bus/types.d.ts.map +1 -0
  119. package/dist/examples/.claude/agents/code-reviewer.md +69 -0
  120. package/dist/examples/.mcp.json +34 -0
  121. package/dist/examples/CALCULATOR-SDK.md +364 -0
  122. package/dist/examples/README.md +384 -0
  123. package/dist/examples/ai-retry-fallback-config.yaml +180 -0
  124. package/dist/examples/ai-with-bash.yaml +126 -0
  125. package/dist/examples/ai-with-mcp.yaml +82 -0
  126. package/dist/examples/basic-human-input.yaml +15 -0
  127. package/dist/examples/bedrock-config.yaml +77 -0
  128. package/dist/examples/calculator-config.yaml +133 -0
  129. package/dist/examples/calculator-json-output-guide.md +311 -0
  130. package/dist/examples/calculator-sdk-automated.ts +340 -0
  131. package/dist/examples/calculator-sdk-example.ts +275 -0
  132. package/dist/examples/calculator-sdk-json.ts +331 -0
  133. package/dist/examples/calculator-sdk-real.ts +374 -0
  134. package/dist/examples/calculator-sdk-test.ts +148 -0
  135. package/dist/examples/claude-code-config.yaml +191 -0
  136. package/dist/examples/cron-webhook-config.yaml +215 -0
  137. package/dist/examples/custom-template.liquid +57 -0
  138. package/dist/examples/custom-tools-example.yaml +281 -0
  139. package/dist/examples/enhanced-config.yaml +165 -0
  140. package/dist/examples/environments/visor.base.yaml +92 -0
  141. package/dist/examples/environments/visor.dev.yaml +33 -0
  142. package/dist/examples/environments/visor.prod.yaml +95 -0
  143. package/dist/examples/environments/visor.staging.yaml +46 -0
  144. package/dist/examples/fact-validator.yaml +361 -0
  145. package/dist/examples/fail-if-simple.yaml +90 -0
  146. package/dist/examples/failure-conditions-advanced.yaml +136 -0
  147. package/dist/examples/failure-conditions-basic.yaml +48 -0
  148. package/dist/examples/failure-conditions-github-style.yaml +119 -0
  149. package/dist/examples/failure-conditions-migration.yaml +74 -0
  150. package/dist/examples/for-loop-example.yaml +176 -0
  151. package/dist/examples/forEach-example.yaml +120 -0
  152. package/dist/examples/github-workflow-with-tags.yml +163 -0
  153. package/dist/examples/http-integration-config.yaml +240 -0
  154. package/dist/examples/https-server-config.yaml +209 -0
  155. package/dist/examples/human-input-example.yaml +63 -0
  156. package/dist/examples/if-conditions.yaml +173 -0
  157. package/dist/examples/jira-simple-example.yaml +56 -0
  158. package/dist/examples/jira-single-issue-workflow.yaml +166 -0
  159. package/dist/examples/jira-workflow-mcp.yaml +182 -0
  160. package/dist/examples/mcp/analyzer.py +119 -0
  161. package/dist/examples/mcp-provider-example.yaml +301 -0
  162. package/dist/examples/memory-counter.yaml +99 -0
  163. package/dist/examples/memory-error-collection.yaml +104 -0
  164. package/dist/examples/memory-exec-js.yaml +247 -0
  165. package/dist/examples/memory-namespace-isolation.yaml +184 -0
  166. package/dist/examples/memory-retry-counter.yaml +65 -0
  167. package/dist/examples/memory-state-machine.yaml +170 -0
  168. package/dist/examples/outputs-raw-basic.yaml +26 -0
  169. package/dist/examples/project-with-tools.yaml +174 -0
  170. package/dist/examples/prompts/architecture-analysis.liquid +116 -0
  171. package/dist/examples/prompts/security-comprehensive.liquid +107 -0
  172. package/dist/examples/quick-start-tags.yaml +53 -0
  173. package/dist/examples/routing-basic.yaml +35 -0
  174. package/dist/examples/routing-dynamic-js.yaml +46 -0
  175. package/dist/examples/routing-foreach.yaml +34 -0
  176. package/dist/examples/routing-goto-event.yaml +34 -0
  177. package/dist/examples/routing-on-success.yaml +25 -0
  178. package/dist/examples/run-calculator-demo.sh +71 -0
  179. package/dist/examples/sdk-basic.mjs +10 -0
  180. package/dist/examples/sdk-cjs.cjs +10 -0
  181. package/dist/examples/sdk-comprehensive.mjs +175 -0
  182. package/dist/examples/sdk-manual-config.mjs +65 -0
  183. package/dist/examples/sdk-typescript.js +81 -0
  184. package/dist/examples/sdk-typescript.ts +92 -0
  185. package/dist/examples/session-reuse-config.yaml +151 -0
  186. package/dist/examples/templates/security-report.liquid +137 -0
  187. package/dist/examples/tools-library.yaml +281 -0
  188. package/dist/examples/transform-example.yaml +199 -0
  189. package/dist/examples/visor-with-tags.yaml +198 -0
  190. package/dist/examples/webhook-pipeline-config.yaml +218 -0
  191. package/dist/examples/workflows/calculator-workflow.yaml +163 -0
  192. package/dist/examples/workflows/code-quality.yaml +222 -0
  193. package/dist/examples/workflows/quick-pr-check.yaml +90 -0
  194. package/dist/examples/workflows/workflow-composition-example.yaml +130 -0
  195. package/dist/failure-condition-evaluator.d.ts +1 -0
  196. package/dist/failure-condition-evaluator.d.ts.map +1 -1
  197. package/dist/frontends/github-frontend.d.ts +38 -0
  198. package/dist/frontends/github-frontend.d.ts.map +1 -0
  199. package/dist/frontends/host.d.ts +43 -0
  200. package/dist/frontends/host.d.ts.map +1 -0
  201. package/dist/frontends/ndjson-sink.d.ts +12 -0
  202. package/dist/frontends/ndjson-sink.d.ts.map +1 -0
  203. package/dist/generated/config-schema.d.ts +564 -22
  204. package/dist/generated/config-schema.d.ts.map +1 -1
  205. package/dist/generated/config-schema.json +612 -24
  206. package/dist/github-check-service.d.ts +4 -6
  207. package/dist/github-check-service.d.ts.map +1 -1
  208. package/dist/github-comments.d.ts +0 -4
  209. package/dist/github-comments.d.ts.map +1 -1
  210. package/dist/index.d.ts.map +1 -1
  211. package/dist/index.js +70335 -62514
  212. package/dist/liquid-extensions.d.ts.map +1 -1
  213. package/dist/logger.d.ts +1 -0
  214. package/dist/logger.d.ts.map +1 -1
  215. package/dist/memory-store.d.ts +6 -0
  216. package/dist/memory-store.d.ts.map +1 -1
  217. package/dist/output/assistant-json/template.liquid +0 -0
  218. package/dist/output/traces/run-2025-11-21T11-50-46-505Z.ndjson +138 -0
  219. package/dist/output/traces/run-2025-11-21T11-51-33-674Z.ndjson +839 -0
  220. package/dist/output-formatters.d.ts +1 -1
  221. package/dist/output-formatters.d.ts.map +1 -1
  222. package/dist/providers/ai-check-provider.d.ts.map +1 -1
  223. package/dist/providers/check-provider-registry.d.ts +6 -0
  224. package/dist/providers/check-provider-registry.d.ts.map +1 -1
  225. package/dist/providers/check-provider.interface.d.ts +34 -1
  226. package/dist/providers/check-provider.interface.d.ts.map +1 -1
  227. package/dist/providers/claude-code-check-provider.d.ts.map +1 -1
  228. package/dist/providers/command-check-provider.d.ts +1 -1
  229. package/dist/providers/command-check-provider.d.ts.map +1 -1
  230. package/dist/providers/custom-tool-executor.d.ts +61 -0
  231. package/dist/providers/custom-tool-executor.d.ts.map +1 -0
  232. package/dist/providers/github-ops-provider.d.ts.map +1 -1
  233. package/dist/providers/http-client-provider.d.ts +1 -4
  234. package/dist/providers/http-client-provider.d.ts.map +1 -1
  235. package/dist/providers/human-input-check-provider.d.ts +3 -0
  236. package/dist/providers/human-input-check-provider.d.ts.map +1 -1
  237. package/dist/providers/index.d.ts +1 -0
  238. package/dist/providers/index.d.ts.map +1 -1
  239. package/dist/providers/log-check-provider.d.ts +2 -5
  240. package/dist/providers/log-check-provider.d.ts.map +1 -1
  241. package/dist/providers/mcp-check-provider.d.ts +9 -3
  242. package/dist/providers/mcp-check-provider.d.ts.map +1 -1
  243. package/dist/providers/memory-check-provider.d.ts +2 -8
  244. package/dist/providers/memory-check-provider.d.ts.map +1 -1
  245. package/dist/providers/script-check-provider.d.ts +25 -0
  246. package/dist/providers/script-check-provider.d.ts.map +1 -0
  247. package/dist/providers/workflow-check-provider.d.ts +56 -0
  248. package/dist/providers/workflow-check-provider.d.ts.map +1 -0
  249. package/dist/reviewer.d.ts +2 -1
  250. package/dist/reviewer.d.ts.map +1 -1
  251. package/dist/sdk/chunk-37ZSCMFC.mjs +482 -0
  252. package/dist/sdk/chunk-37ZSCMFC.mjs.map +1 -0
  253. package/dist/sdk/chunk-6Y4YTKCF.mjs +197 -0
  254. package/dist/sdk/chunk-6Y4YTKCF.mjs.map +1 -0
  255. package/dist/sdk/chunk-CNX7V5JK.mjs +89 -0
  256. package/dist/sdk/chunk-CNX7V5JK.mjs.map +1 -0
  257. package/dist/sdk/chunk-IEO6CFLG.mjs +1215 -0
  258. package/dist/sdk/chunk-IEO6CFLG.mjs.map +1 -0
  259. package/dist/sdk/chunk-JEHPDJIF.mjs +223 -0
  260. package/dist/sdk/chunk-JEHPDJIF.mjs.map +1 -0
  261. package/dist/sdk/chunk-O5EZDNYL.mjs +274 -0
  262. package/dist/sdk/chunk-O5EZDNYL.mjs.map +1 -0
  263. package/dist/sdk/{chunk-TUTOLSFV.mjs → chunk-OOZITMRU.mjs} +1 -1
  264. package/dist/sdk/chunk-OOZITMRU.mjs.map +1 -0
  265. package/dist/sdk/chunk-OWUVOILT.mjs +557 -0
  266. package/dist/sdk/chunk-OWUVOILT.mjs.map +1 -0
  267. package/dist/sdk/chunk-OZJ263FM.mjs +986 -0
  268. package/dist/sdk/chunk-OZJ263FM.mjs.map +1 -0
  269. package/dist/sdk/chunk-PTL3K3PN.mjs +3128 -0
  270. package/dist/sdk/chunk-PTL3K3PN.mjs.map +1 -0
  271. package/dist/sdk/chunk-S2RUE2RG.mjs +145 -0
  272. package/dist/sdk/chunk-S2RUE2RG.mjs.map +1 -0
  273. package/dist/sdk/chunk-VMPLF6FT.mjs +127 -0
  274. package/dist/sdk/chunk-VMPLF6FT.mjs.map +1 -0
  275. package/dist/sdk/chunk-YSN4G6CI.mjs +146 -0
  276. package/dist/sdk/chunk-YSN4G6CI.mjs.map +1 -0
  277. package/dist/sdk/chunk-ZYAUYXSW.mjs +206 -0
  278. package/dist/sdk/chunk-ZYAUYXSW.mjs.map +1 -0
  279. package/dist/sdk/config-M4ZNO6NU.mjs +14 -0
  280. package/dist/sdk/config-merger-PX3WIT57.mjs +10 -0
  281. package/dist/sdk/event-bus-5BEVPQ6T.mjs +35 -0
  282. package/dist/sdk/event-bus-5BEVPQ6T.mjs.map +1 -0
  283. package/dist/sdk/failure-condition-evaluator-NBO5YRXW.mjs +16 -0
  284. package/dist/sdk/git-repository-analyzer-HJC4MYW4.mjs +458 -0
  285. package/dist/sdk/git-repository-analyzer-HJC4MYW4.mjs.map +1 -0
  286. package/dist/sdk/github-frontend-4AWRJT7D.mjs +1242 -0
  287. package/dist/sdk/github-frontend-4AWRJT7D.mjs.map +1 -0
  288. package/dist/sdk/host-7GBC3S7L.mjs +49 -0
  289. package/dist/sdk/host-7GBC3S7L.mjs.map +1 -0
  290. package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs → liquid-extensions-C7EG3YKH.mjs} +7 -2
  291. package/dist/sdk/memory-store-GJACZC2A.mjs +11 -0
  292. package/dist/sdk/metrics-7PP3EJUH.mjs +29 -0
  293. package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs +44 -0
  294. package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs.map +1 -0
  295. package/dist/sdk/renderer-schema-6RF26VUS.mjs +50 -0
  296. package/dist/sdk/renderer-schema-6RF26VUS.mjs.map +1 -0
  297. package/dist/sdk/routing-RP56JTV2.mjs +23 -0
  298. package/dist/sdk/routing-RP56JTV2.mjs.map +1 -0
  299. package/dist/sdk/sdk.d.mts +326 -21
  300. package/dist/sdk/sdk.d.ts +326 -21
  301. package/dist/sdk/sdk.js +21403 -16366
  302. package/dist/sdk/sdk.js.map +1 -1
  303. package/dist/sdk/sdk.mjs +13510 -2096
  304. package/dist/sdk/sdk.mjs.map +1 -1
  305. package/dist/sdk/session-registry-N5FFYFTM.mjs +10 -0
  306. package/dist/sdk/session-registry-N5FFYFTM.mjs.map +1 -0
  307. package/dist/sdk/trace-helpers-VP6QYVBX.mjs +23 -0
  308. package/dist/sdk/trace-helpers-VP6QYVBX.mjs.map +1 -0
  309. package/dist/sdk/{tracer-init-WC75N5NW.mjs → tracer-init-WP4X46IF.mjs} +2 -2
  310. package/dist/sdk/tracer-init-WP4X46IF.mjs.map +1 -0
  311. package/dist/sdk/workflow-registry-2YIIXQCK.mjs +11 -0
  312. package/dist/sdk/workflow-registry-2YIIXQCK.mjs.map +1 -0
  313. package/dist/sdk.d.ts.map +1 -1
  314. package/dist/snapshot-store.d.ts +59 -0
  315. package/dist/snapshot-store.d.ts.map +1 -0
  316. package/dist/state-machine/context/build-engine-context.d.ts +9 -0
  317. package/dist/state-machine/context/build-engine-context.d.ts.map +1 -0
  318. package/dist/state-machine/dispatch/dependency-gating.d.ts +12 -0
  319. package/dist/state-machine/dispatch/dependency-gating.d.ts.map +1 -0
  320. package/dist/state-machine/dispatch/execution-invoker.d.ts +14 -0
  321. package/dist/state-machine/dispatch/execution-invoker.d.ts.map +1 -0
  322. package/dist/state-machine/dispatch/foreach-processor.d.ts +8 -0
  323. package/dist/state-machine/dispatch/foreach-processor.d.ts.map +1 -0
  324. package/dist/state-machine/dispatch/history-snapshot.d.ts +8 -0
  325. package/dist/state-machine/dispatch/history-snapshot.d.ts.map +1 -0
  326. package/dist/state-machine/dispatch/renderer-schema.d.ts +8 -0
  327. package/dist/state-machine/dispatch/renderer-schema.d.ts.map +1 -0
  328. package/dist/state-machine/dispatch/stats-manager.d.ts +15 -0
  329. package/dist/state-machine/dispatch/stats-manager.d.ts.map +1 -0
  330. package/dist/state-machine/dispatch/template-renderer.d.ts +7 -0
  331. package/dist/state-machine/dispatch/template-renderer.d.ts.map +1 -0
  332. package/dist/state-machine/execution/summary.d.ts +8 -0
  333. package/dist/state-machine/execution/summary.d.ts.map +1 -0
  334. package/dist/state-machine/runner.d.ts +73 -0
  335. package/dist/state-machine/runner.d.ts.map +1 -0
  336. package/dist/state-machine/states/check-running.d.ts +14 -0
  337. package/dist/state-machine/states/check-running.d.ts.map +1 -0
  338. package/dist/state-machine/states/completed.d.ts +12 -0
  339. package/dist/state-machine/states/completed.d.ts.map +1 -0
  340. package/dist/state-machine/states/error.d.ts +11 -0
  341. package/dist/state-machine/states/error.d.ts.map +1 -0
  342. package/dist/state-machine/states/init.d.ts +11 -0
  343. package/dist/state-machine/states/init.d.ts.map +1 -0
  344. package/dist/state-machine/states/level-dispatch.d.ts +17 -0
  345. package/dist/state-machine/states/level-dispatch.d.ts.map +1 -0
  346. package/dist/state-machine/states/plan-ready.d.ts +12 -0
  347. package/dist/state-machine/states/plan-ready.d.ts.map +1 -0
  348. package/dist/state-machine/states/routing.d.ts +52 -0
  349. package/dist/state-machine/states/routing.d.ts.map +1 -0
  350. package/dist/state-machine/states/wave-planning.d.ts +14 -0
  351. package/dist/state-machine/states/wave-planning.d.ts.map +1 -0
  352. package/dist/state-machine/workflow-projection.d.ts +47 -0
  353. package/dist/state-machine/workflow-projection.d.ts.map +1 -0
  354. package/dist/state-machine-execution-engine.d.ts +147 -0
  355. package/dist/state-machine-execution-engine.d.ts.map +1 -0
  356. package/dist/telemetry/opentelemetry.d.ts.map +1 -1
  357. package/dist/test-runner/assertions.d.ts +59 -0
  358. package/dist/test-runner/assertions.d.ts.map +1 -0
  359. package/dist/test-runner/core/environment.d.ts +8 -0
  360. package/dist/test-runner/core/environment.d.ts.map +1 -0
  361. package/dist/test-runner/core/fixture.d.ts +3 -0
  362. package/dist/test-runner/core/fixture.d.ts.map +1 -0
  363. package/dist/test-runner/core/flow-stage.d.ts +32 -0
  364. package/dist/test-runner/core/flow-stage.d.ts.map +1 -0
  365. package/dist/test-runner/core/mocks.d.ts +8 -0
  366. package/dist/test-runner/core/mocks.d.ts.map +1 -0
  367. package/dist/test-runner/core/test-execution-wrapper.d.ts +18 -0
  368. package/dist/test-runner/core/test-execution-wrapper.d.ts.map +1 -0
  369. package/dist/test-runner/evaluators.d.ts +12 -0
  370. package/dist/test-runner/evaluators.d.ts.map +1 -0
  371. package/dist/test-runner/fixture-loader.d.ts +30 -0
  372. package/dist/test-runner/fixture-loader.d.ts.map +1 -0
  373. package/dist/test-runner/index.d.ts +120 -0
  374. package/dist/test-runner/index.d.ts.map +1 -0
  375. package/dist/test-runner/recorders/github-recorder.d.ts +23 -0
  376. package/dist/test-runner/recorders/github-recorder.d.ts.map +1 -0
  377. package/dist/test-runner/recorders/global-recorder.d.ts +4 -0
  378. package/dist/test-runner/recorders/global-recorder.d.ts.map +1 -0
  379. package/dist/test-runner/utils/selectors.d.ts +2 -0
  380. package/dist/test-runner/utils/selectors.d.ts.map +1 -0
  381. package/dist/test-runner/validator.d.ts +8 -0
  382. package/dist/test-runner/validator.d.ts.map +1 -0
  383. package/dist/traces/run-2025-11-21T11-50-46-505Z.ndjson +138 -0
  384. package/dist/traces/run-2025-11-21T11-51-33-674Z.ndjson +839 -0
  385. package/dist/types/cli.d.ts +4 -1
  386. package/dist/types/cli.d.ts.map +1 -1
  387. package/dist/types/config.d.ts +278 -5
  388. package/dist/types/config.d.ts.map +1 -1
  389. package/dist/types/engine.d.ts +172 -0
  390. package/dist/types/engine.d.ts.map +1 -0
  391. package/dist/types/execution.d.ts +73 -0
  392. package/dist/types/execution.d.ts.map +1 -0
  393. package/dist/types/github.d.ts +51 -0
  394. package/dist/types/github.d.ts.map +1 -0
  395. package/dist/types/workflow.d.ts +237 -0
  396. package/dist/types/workflow.d.ts.map +1 -0
  397. package/dist/utils/command-executor.d.ts +43 -0
  398. package/dist/utils/command-executor.d.ts.map +1 -0
  399. package/dist/utils/comment-metadata.d.ts +21 -0
  400. package/dist/utils/comment-metadata.d.ts.map +1 -0
  401. package/dist/utils/config-loader.d.ts.map +1 -1
  402. package/dist/utils/config-merger.d.ts.map +1 -1
  403. package/dist/utils/env-exposure.d.ts +3 -0
  404. package/dist/utils/env-exposure.d.ts.map +1 -0
  405. package/dist/utils/file-exclusion.d.ts.map +1 -1
  406. package/dist/utils/interactive-prompt.d.ts +1 -1
  407. package/dist/utils/interactive-prompt.d.ts.map +1 -1
  408. package/dist/utils/sandbox.d.ts.map +1 -1
  409. package/dist/utils/script-memory-ops.d.ts +21 -0
  410. package/dist/utils/script-memory-ops.d.ts.map +1 -0
  411. package/dist/utils/template-context.d.ts +7 -0
  412. package/dist/utils/template-context.d.ts.map +1 -0
  413. package/dist/webhook-server.d.ts +3 -3
  414. package/dist/webhook-server.d.ts.map +1 -1
  415. package/dist/workflow-executor.d.ts +81 -0
  416. package/dist/workflow-executor.d.ts.map +1 -0
  417. package/dist/workflow-registry.d.ts +79 -0
  418. package/dist/workflow-registry.d.ts.map +1 -0
  419. package/package.json +10 -5
  420. package/dist/output/traces/run-2025-10-22T18-22-56-873Z.ndjson +0 -218
  421. package/dist/sdk/check-execution-engine-2YYKUUSH.mjs +0 -11
  422. package/dist/sdk/check-execution-engine-6QJXYYON.mjs +0 -11
  423. package/dist/sdk/check-execution-engine-PJZ4ZOKG.mjs +0 -11
  424. package/dist/sdk/chunk-33QVZ2D4.mjs +0 -316
  425. package/dist/sdk/chunk-33QVZ2D4.mjs.map +0 -1
  426. package/dist/sdk/chunk-B5QBV2QJ.mjs +0 -752
  427. package/dist/sdk/chunk-B5QBV2QJ.mjs.map +0 -1
  428. package/dist/sdk/chunk-BVFNRCHT.mjs +0 -14129
  429. package/dist/sdk/chunk-BVFNRCHT.mjs.map +0 -1
  430. package/dist/sdk/chunk-KWZW23FG.mjs +0 -14129
  431. package/dist/sdk/chunk-KWZW23FG.mjs.map +0 -1
  432. package/dist/sdk/chunk-O4RP4BRH.mjs +0 -14092
  433. package/dist/sdk/chunk-O4RP4BRH.mjs.map +0 -1
  434. package/dist/sdk/chunk-TUTOLSFV.mjs.map +0 -1
  435. package/dist/sdk/chunk-U5D2LY66.mjs +0 -245
  436. package/dist/sdk/chunk-U5D2LY66.mjs.map +0 -1
  437. package/dist/sdk/chunk-U7X54EMV.mjs +0 -331
  438. package/dist/sdk/chunk-U7X54EMV.mjs.map +0 -1
  439. package/dist/sdk/config-merger-TWUBWFC2.mjs +0 -8
  440. package/dist/sdk/mermaid-telemetry-SN6A2TKW.mjs +0 -61
  441. package/dist/sdk/mermaid-telemetry-SN6A2TKW.mjs.map +0 -1
  442. package/dist/sdk/mermaid-telemetry-YCTIG76M.mjs +0 -61
  443. package/dist/sdk/mermaid-telemetry-YCTIG76M.mjs.map +0 -1
  444. package/dist/traces/run-2025-10-22T18-22-56-873Z.ndjson +0 -218
  445. /package/dist/sdk/{check-execution-engine-2YYKUUSH.mjs.map → config-M4ZNO6NU.mjs.map} +0 -0
  446. /package/dist/sdk/{check-execution-engine-6QJXYYON.mjs.map → config-merger-PX3WIT57.mjs.map} +0 -0
  447. /package/dist/sdk/{check-execution-engine-PJZ4ZOKG.mjs.map → failure-condition-evaluator-NBO5YRXW.mjs.map} +0 -0
  448. /package/dist/sdk/{config-merger-TWUBWFC2.mjs.map → liquid-extensions-C7EG3YKH.mjs.map} +0 -0
  449. /package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs.map → memory-store-GJACZC2A.mjs.map} +0 -0
  450. /package/dist/sdk/{tracer-init-WC75N5NW.mjs.map → metrics-7PP3EJUH.mjs.map} +0 -0
@@ -0,0 +1,340 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Calculator SDK - Fully Automated (Non-Interactive)
5
+ *
6
+ * This example shows how to:
7
+ * - Run calculations without user interaction
8
+ * - Provide inputs programmatically
9
+ * - Get pure JSON output
10
+ * - Use for testing or automation
11
+ *
12
+ * Usage:
13
+ * npm run build
14
+ * bun examples/calculator-sdk-automated.ts
15
+ * bun examples/calculator-sdk-automated.ts 10 5 +
16
+ */
17
+
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
+ },
39
+
40
+ "store-number1": {
41
+ type: "memory",
42
+ depends_on: ["get-number1"],
43
+ operation: "set",
44
+ namespace: "calculator",
45
+ key: "number1",
46
+ value_js: "parseFloat(outputs['get-number1'])"
47
+ },
48
+
49
+ "get-number2": {
50
+ type: "human-input",
51
+ depends_on: ["store-number1"],
52
+ prompt: "Enter the second number:",
53
+ },
54
+
55
+ "store-number2": {
56
+ type: "memory",
57
+ depends_on: ["get-number2"],
58
+ operation: "set",
59
+ namespace: "calculator",
60
+ key: "number2",
61
+ value_js: "parseFloat(outputs['get-number2'])"
62
+ },
63
+
64
+ "get-operation": {
65
+ type: "human-input",
66
+ depends_on: ["store-number2"],
67
+ prompt: "Select operation (+, -, *, /):",
68
+ },
69
+
70
+ "store-operation": {
71
+ type: "memory",
72
+ depends_on: ["get-operation"],
73
+ operation: "set",
74
+ namespace: "calculator",
75
+ key: "operation",
76
+ value_js: "outputs['get-operation'].trim()",
77
+ fail_if: "!['+', '-', '*', '/'].includes(outputs['get-operation'].trim())"
78
+ },
79
+
80
+ "calculate": {
81
+ type: "script",
82
+ depends_on: ["store-operation"],
83
+ content: `
84
+ const num1 = memory.get('number1', 'calculator');
85
+ const num2 = memory.get('number2', 'calculator');
86
+ const op = memory.get('operation', 'calculator');
87
+
88
+ let result;
89
+ switch(op) {
90
+ case '+': result = num1 + num2; break;
91
+ case '-': result = num1 - num2; break;
92
+ case '*': result = num1 * num2; break;
93
+ case '/':
94
+ if (num2 === 0) throw new Error('Division by zero!');
95
+ result = num1 / num2;
96
+ break;
97
+ default: throw new Error('Invalid operation: ' + op);
98
+ }
99
+
100
+ return result;
101
+ `
102
+ }
103
+ }
104
+ };
105
+
106
+ // ============================================================================
107
+ // AUTOMATED INPUT PROVIDER
108
+ // ============================================================================
109
+
110
+ interface CalculatorInputs {
111
+ 'get-number1': string;
112
+ 'get-number2': string;
113
+ 'get-operation': string;
114
+ }
115
+
116
+ /**
117
+ * Create an automated input handler with predefined values
118
+ */
119
+ function createAutomatedInputHandler(inputs: CalculatorInputs) {
120
+ return async (request: HumanInputRequest): Promise<string> => {
121
+ const checkId = request.checkId as keyof CalculatorInputs;
122
+ const value = inputs[checkId];
123
+
124
+ if (value === undefined) {
125
+ throw new Error(`No automated input provided for check: ${checkId}`);
126
+ }
127
+
128
+ return value;
129
+ };
130
+ }
131
+
132
+ // ============================================================================
133
+ // SUPPRESS ALL CONSOLE OUTPUT
134
+ // ============================================================================
135
+
136
+ function suppressAllOutput() {
137
+ const noop = () => {};
138
+ const originalLog = console.log;
139
+ const originalError = console.error;
140
+ const originalWarn = console.warn;
141
+ const originalInfo = console.info;
142
+ const originalDebug = console.debug;
143
+
144
+ console.log = noop;
145
+ console.error = noop;
146
+ console.warn = noop;
147
+ console.info = noop;
148
+ console.debug = noop;
149
+
150
+ return {
151
+ restore: () => {
152
+ console.log = originalLog;
153
+ console.error = originalError;
154
+ console.warn = originalWarn;
155
+ console.info = originalInfo;
156
+ console.debug = originalDebug;
157
+ }
158
+ };
159
+ }
160
+
161
+ // ============================================================================
162
+ // CALCULATION FUNCTION
163
+ // ============================================================================
164
+
165
+ interface CalculationResult {
166
+ success: boolean;
167
+ calculation?: {
168
+ number1: number;
169
+ number2: number;
170
+ operation: string;
171
+ result: number;
172
+ expression: string;
173
+ };
174
+ executionTime?: number;
175
+ issues?: any[];
176
+ error?: string;
177
+ }
178
+
179
+ async function calculate(
180
+ num1: string,
181
+ num2: string,
182
+ operation: string,
183
+ options: { verbose?: boolean; suppressOutput?: boolean } = {}
184
+ ): Promise<CalculationResult> {
185
+ const { verbose = false, suppressOutput = true } = options;
186
+
187
+ try {
188
+ // Set up automated inputs
189
+ HumanInputCheckProvider.setHooks({
190
+ onHumanInput: createAutomatedInputHandler({
191
+ 'get-number1': num1,
192
+ 'get-number2': num2,
193
+ 'get-operation': operation
194
+ })
195
+ });
196
+
197
+ // Suppress console output if requested
198
+ const suppressor = suppressOutput ? suppressAllOutput() : null;
199
+
200
+ // Create execution engine
201
+ const engine = new CheckExecutionEngine();
202
+
203
+ // Execute all checks
204
+ const checksToRun = Object.keys(calculatorConfig.checks || {});
205
+
206
+ const result = await engine.executeChecks({
207
+ checks: checksToRun,
208
+ config: calculatorConfig,
209
+ outputFormat: 'json',
210
+ maxParallelism: 1,
211
+ debug: false
212
+ });
213
+
214
+ // Restore console
215
+ if (suppressor) suppressor.restore();
216
+
217
+ // Extract results from memory
218
+ const { MemoryStore } = await import('../src/memory-store');
219
+ const memoryStore = MemoryStore.getInstance(calculatorConfig.memory);
220
+
221
+ const n1 = memoryStore.get('number1', 'calculator');
222
+ const n2 = memoryStore.get('number2', 'calculator');
223
+ const op = memoryStore.get('operation', 'calculator');
224
+ const resultValue = memoryStore.get('result', 'calculator');
225
+
226
+ return {
227
+ success: true,
228
+ calculation: {
229
+ number1: n1,
230
+ number2: n2,
231
+ operation: op,
232
+ result: resultValue,
233
+ expression: `${n1} ${op} ${n2} = ${resultValue}`
234
+ },
235
+ executionTime: result.executionTime,
236
+ issues: result.summary?.issues || []
237
+ };
238
+
239
+ } catch (error) {
240
+ return {
241
+ success: false,
242
+ error: error instanceof Error ? error.message : String(error)
243
+ };
244
+ }
245
+ }
246
+
247
+ // ============================================================================
248
+ // MAIN EXECUTION
249
+ // ============================================================================
250
+
251
+ async function main() {
252
+ // Parse command line arguments
253
+ const args = process.argv.slice(2);
254
+
255
+ let num1: string, num2: string, operation: string;
256
+
257
+ if (args.length >= 3) {
258
+ // Use command line arguments
259
+ [num1, num2, operation] = args;
260
+ } else {
261
+ // Use default values for demo
262
+ num1 = '10';
263
+ num2 = '5';
264
+ operation = '+';
265
+ }
266
+
267
+ console.log('🧮 Calculator SDK - Automated Mode\n');
268
+ console.log(`Input: ${num1} ${operation} ${num2}\n`);
269
+
270
+ // Run calculation
271
+ const result = await calculate(num1, num2, operation, {
272
+ verbose: false,
273
+ suppressOutput: true
274
+ });
275
+
276
+ // Display result
277
+ if (result.success && result.calculation) {
278
+ console.log('✅ Calculation Complete!\n');
279
+ console.log('📊 Result (JSON):\n');
280
+ console.log(JSON.stringify(result, null, 2));
281
+
282
+ console.log('\n' + '─'.repeat(50));
283
+ console.log('Expression:', result.calculation.expression);
284
+ console.log('─'.repeat(50));
285
+
286
+ if (result.issues && result.issues.length > 0) {
287
+ console.log(`\n⚠️ ${result.issues.length} issue(s) found`);
288
+ }
289
+ } else {
290
+ console.log('❌ Calculation Failed!\n');
291
+ console.log('Error:', result.error);
292
+ }
293
+
294
+ console.log();
295
+
296
+ // Run additional test cases
297
+ console.log('🧪 Running Test Cases...\n');
298
+
299
+ const testCases = [
300
+ { num1: '100', num2: '25', operation: '-', expected: 75 },
301
+ { num1: '7', num2: '8', operation: '*', expected: 56 },
302
+ { num1: '100', num2: '4', operation: '/', expected: 25 },
303
+ { num1: '15', num2: '3', operation: '+', expected: 18 },
304
+ ];
305
+
306
+ const results = await Promise.all(
307
+ testCases.map(tc =>
308
+ calculate(tc.num1, tc.num2, tc.operation, { suppressOutput: true })
309
+ )
310
+ );
311
+
312
+ console.log('Test Results:');
313
+ console.log('─'.repeat(70));
314
+ console.log('Input'.padEnd(20), 'Expected'.padEnd(15), 'Actual'.padEnd(15), 'Status');
315
+ console.log('─'.repeat(70));
316
+
317
+ results.forEach((result, idx) => {
318
+ const tc = testCases[idx];
319
+ const input = `${tc.num1} ${tc.operation} ${tc.num2}`;
320
+ const expected = tc.expected;
321
+ const actual = result.calculation?.result;
322
+ const status = actual === expected ? '✅ PASS' : '❌ FAIL';
323
+
324
+ console.log(
325
+ input.padEnd(20),
326
+ String(expected).padEnd(15),
327
+ String(actual).padEnd(15),
328
+ status
329
+ );
330
+ });
331
+
332
+ console.log('─'.repeat(70));
333
+ console.log('\n✨ Done!\n');
334
+ }
335
+
336
+ // Run main
337
+ main().catch((error) => {
338
+ console.error('Fatal error:', error);
339
+ process.exit(1);
340
+ });
@@ -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 };