@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,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
+ });
@@ -0,0 +1,374 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Real SDK Calculator Example
5
+ *
6
+ * This is a complete, runnable example showing how to use Visor SDK with human-input.
7
+ * The config is defined inline and the workflow executes programmatically.
8
+ *
9
+ * Usage:
10
+ * npm run build
11
+ * ts-node examples/calculator-sdk-real.ts
12
+ *
13
+ * Or after build:
14
+ * node examples/calculator-sdk-real.js
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 - Defined inline
24
+ // ============================================================================
25
+
26
+ const calculatorConfig: VisorConfig = {
27
+ version: "1.0",
28
+
29
+ // Memory configuration for storing values between steps
30
+ memory: {
31
+ storage: 'memory',
32
+ namespace: 'calculator'
33
+ },
34
+
35
+ // Define our workflow checks
36
+ checks: {
37
+ // Step 1: Get first number from user
38
+ "get-number1": {
39
+ type: "human-input",
40
+ prompt: "Enter the first number:",
41
+ placeholder: "e.g., 42",
42
+ allow_empty: false
43
+ },
44
+
45
+ // Step 2: Parse and store first number in memory
46
+ "store-number1": {
47
+ type: "memory",
48
+ depends_on: ["get-number1"],
49
+ operation: "set",
50
+ namespace: "calculator",
51
+ key: "number1",
52
+ value_js: "parseFloat(outputs['get-number1'])"
53
+ },
54
+
55
+ // Step 3: Get second number from user
56
+ "get-number2": {
57
+ type: "human-input",
58
+ depends_on: ["store-number1"],
59
+ prompt: "Enter the second number:",
60
+ placeholder: "e.g., 7",
61
+ allow_empty: false
62
+ },
63
+
64
+ // Step 4: Parse and store second number in memory
65
+ "store-number2": {
66
+ type: "memory",
67
+ depends_on: ["get-number2"],
68
+ operation: "set",
69
+ namespace: "calculator",
70
+ key: "number2",
71
+ value_js: "parseFloat(outputs['get-number2'])"
72
+ },
73
+
74
+ // Step 5: Get operation from user
75
+ "get-operation": {
76
+ type: "human-input",
77
+ depends_on: ["store-number2"],
78
+ prompt: "Select operation (+, -, *, /):",
79
+ placeholder: "Enter one of: + - * /",
80
+ allow_empty: false
81
+ },
82
+
83
+ // Step 6: Validate and store operation
84
+ "store-operation": {
85
+ type: "memory",
86
+ depends_on: ["get-operation"],
87
+ operation: "set",
88
+ namespace: "calculator",
89
+ key: "operation",
90
+ value_js: "outputs['get-operation'].trim()",
91
+ // Validate operation
92
+ fail_if: "!['+', '-', '*', '/'].includes(outputs['get-operation'].trim())"
93
+ },
94
+
95
+ // Step 7: Perform calculation using JavaScript
96
+ "calculate": {
97
+ type: "script",
98
+ depends_on: ["store-operation"],
99
+ content: `
100
+ // Get values from memory
101
+ const num1 = memory.get('number1', 'calculator');
102
+ const num2 = memory.get('number2', 'calculator');
103
+ const op = memory.get('operation', 'calculator');
104
+
105
+ // Debug logging
106
+ log('🔢 Calculating:', num1, op, num2);
107
+
108
+ // Validate numbers
109
+ if (isNaN(num1)) {
110
+ throw new Error('First number is invalid: ' + num1);
111
+ }
112
+ if (isNaN(num2)) {
113
+ throw new Error('Second number is invalid: ' + num2);
114
+ }
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 + ' (must be +, -, *, or /)');
136
+ }
137
+
138
+ log('✅ Result:', result);
139
+
140
+ // Return result for dependent checks
141
+ return result;
142
+ `
143
+ },
144
+
145
+ // Step 8: Display the final result
146
+ "show-result": {
147
+ type: "log",
148
+ depends_on: ["calculate"],
149
+ level: "info",
150
+ message: `
151
+ ╔════════════════════════════════════════╗
152
+ ║ CALCULATION RESULT ║
153
+ ╠════════════════════════════════════════╣
154
+ ║ ║
155
+ ║ {{ outputs['get-number1'] }} {{ outputs['get-operation'] }} {{ outputs['get-number2'] }} = {{ outputs['calculate'] }}
156
+ ║ ║
157
+ ╚════════════════════════════════════════╝
158
+ `
159
+ }
160
+ },
161
+
162
+ // Output configuration
163
+ output: {
164
+ pr_comment: {
165
+ format: "markdown",
166
+ group_by: "check",
167
+ collapse: false
168
+ }
169
+ }
170
+ };
171
+
172
+ // ============================================================================
173
+ // CUSTOM HOOK IMPLEMENTATION
174
+ // ============================================================================
175
+
176
+ /**
177
+ * Custom readline-based input handler for SDK mode
178
+ * This shows how to implement your own input mechanism
179
+ */
180
+ async function customHumanInputHandler(request: HumanInputRequest): Promise<string> {
181
+ return new Promise((resolve, reject) => {
182
+ const rl = readline.createInterface({
183
+ input: process.stdin,
184
+ output: process.stdout
185
+ });
186
+
187
+ // Display a nice prompt
188
+ console.log('\n┌─────────────────────────────────────────────────────────┐');
189
+ const padding = 57 - request.prompt.length;
190
+ console.log(`│ 💬 ${request.prompt}${' '.repeat(Math.max(0, padding))}│`);
191
+ console.log('└─────────────────────────────────────────────────────────┘');
192
+
193
+ if (request.placeholder) {
194
+ console.log(` ${request.placeholder}`);
195
+ }
196
+
197
+ rl.question('\n> ', (answer) => {
198
+ rl.close();
199
+
200
+ const trimmed = answer.trim();
201
+
202
+ // Handle empty input
203
+ if (!trimmed) {
204
+ if (request.allowEmpty) {
205
+ resolve(request.default || '');
206
+ } else if (request.default) {
207
+ console.log(` (using default: ${request.default})`);
208
+ resolve(request.default);
209
+ } else {
210
+ console.log(' ❌ Empty input not allowed\n');
211
+ reject(new Error('Empty input not allowed'));
212
+ }
213
+ } else {
214
+ resolve(trimmed);
215
+ }
216
+ });
217
+
218
+ // Handle timeout if specified
219
+ if (request.timeout) {
220
+ setTimeout(() => {
221
+ rl.close();
222
+ if (request.default) {
223
+ console.log(`\n ⏱️ Timeout - using default: ${request.default}`);
224
+ resolve(request.default);
225
+ } else {
226
+ reject(new Error('Input timeout'));
227
+ }
228
+ }, request.timeout);
229
+ }
230
+ });
231
+ }
232
+
233
+ // ============================================================================
234
+ // MAIN EXECUTION
235
+ // ============================================================================
236
+
237
+ async function main() {
238
+ console.log('\n╔═══════════════════════════════════════════════════════════╗');
239
+ console.log('║ Visor SDK Calculator - Real Implementation ║');
240
+ console.log('║ Human Input + Memory + JavaScript ║');
241
+ console.log('╚═══════════════════════════════════════════════════════════╝\n');
242
+
243
+ console.log('This is a real SDK example with:');
244
+ console.log(' ✓ Inline configuration (no YAML files needed)');
245
+ console.log(' ✓ Custom human-input hook using readline');
246
+ console.log(' ✓ Memory provider for state management');
247
+ console.log(' ✓ JavaScript execution for calculations');
248
+ console.log(' ✓ Full dependency chain with error handling\n');
249
+
250
+ console.log('═'.repeat(59));
251
+ console.log('Starting calculator workflow...');
252
+ console.log('═'.repeat(59));
253
+
254
+ try {
255
+ // Set up the human input hook
256
+ HumanInputCheckProvider.setHooks({
257
+ onHumanInput: customHumanInputHandler
258
+ });
259
+
260
+ // Create execution engine
261
+ const engine = new CheckExecutionEngine();
262
+
263
+ // Execute all checks in the workflow
264
+ const checksToRun = Object.keys(calculatorConfig.checks || {});
265
+
266
+ console.log(`\n📋 Running ${checksToRun.length} checks...\n`);
267
+
268
+ const result = await engine.executeChecks({
269
+ checks: checksToRun,
270
+ config: calculatorConfig,
271
+ outputFormat: 'json',
272
+ maxParallelism: 1, // Run sequentially for human input
273
+ debug: false
274
+ });
275
+
276
+ // Display results summary
277
+ console.log('\n═'.repeat(59));
278
+ console.log('✅ Calculator workflow completed successfully!');
279
+ console.log('═'.repeat(59));
280
+
281
+ console.log(`\n📊 Summary:`);
282
+ console.log(` - Total checks: ${checksToRun.length}`);
283
+ console.log(` - Execution time: ${result.executionTime}ms`);
284
+ console.log(` - Timestamp: ${result.timestamp}`);
285
+ console.log(` - Memory namespace: ${calculatorConfig.memory?.namespace}`);
286
+
287
+ // Access memory store to show final values
288
+ if (calculatorConfig.memory) {
289
+ const { MemoryStore } = await import('../src/memory-store');
290
+ const memoryStore = MemoryStore.getInstance(calculatorConfig.memory);
291
+
292
+ console.log('\n💾 Final memory state:');
293
+ const keys = memoryStore.list('calculator');
294
+ for (const key of keys) {
295
+ const value = memoryStore.get(key, 'calculator');
296
+ console.log(` ${key}: ${value}`);
297
+ }
298
+ }
299
+
300
+ } catch (error) {
301
+ console.error('\n❌ Error running calculator:');
302
+ if (error instanceof Error) {
303
+ console.error(` ${error.message}`);
304
+ if (error.stack) {
305
+ console.error(`\n${error.stack}`);
306
+ }
307
+ } else {
308
+ console.error(` ${error}`);
309
+ }
310
+ process.exit(1);
311
+ }
312
+
313
+ console.log('\n✨ Done!\n');
314
+ }
315
+
316
+ // ============================================================================
317
+ // ALTERNATIVE: Non-interactive mode for testing
318
+ // ============================================================================
319
+
320
+ /**
321
+ * Run calculator with predefined inputs (for testing/automation)
322
+ */
323
+ async function runWithPredefinedInputs(num1: number, num2: number, op: string) {
324
+ console.log('\n🤖 Running in automated mode with predefined inputs...\n');
325
+
326
+ const inputs = [num1.toString(), num2.toString(), op];
327
+ let inputIndex = 0;
328
+
329
+ // Set up hook that uses predefined inputs
330
+ HumanInputCheckProvider.setHooks({
331
+ onHumanInput: async (request: HumanInputRequest) => {
332
+ const value = inputs[inputIndex++];
333
+ console.log(`${request.prompt} ${value}`);
334
+ return value;
335
+ }
336
+ });
337
+
338
+ // Run main workflow
339
+ await main();
340
+ }
341
+
342
+ // ============================================================================
343
+ // ENTRY POINT
344
+ // ============================================================================
345
+
346
+ if (require.main === module) {
347
+ // Check for command line arguments for automated mode
348
+ const args = process.argv.slice(2);
349
+
350
+ if (args.length === 3) {
351
+ // Automated mode: node calculator-sdk-real.js 42 7 +
352
+ const [num1, num2, op] = args;
353
+ runWithPredefinedInputs(parseFloat(num1), parseFloat(num2), op)
354
+ .catch(err => {
355
+ console.error('Error:', err);
356
+ process.exit(1);
357
+ });
358
+ } else if (args.length > 0) {
359
+ console.error('Usage:');
360
+ console.error(' Interactive mode: ts-node calculator-sdk-real.ts');
361
+ console.error(' Automated mode: ts-node calculator-sdk-real.ts <num1> <num2> <op>');
362
+ console.error(' Example: ts-node calculator-sdk-real.ts 42 7 +');
363
+ process.exit(1);
364
+ } else {
365
+ // Interactive mode
366
+ main().catch(err => {
367
+ console.error('Error:', err);
368
+ process.exit(1);
369
+ });
370
+ }
371
+ }
372
+
373
+ // Export for use as a module
374
+ export { calculatorConfig, customHumanInputHandler, main };