@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,236 @@
1
+ # Snapshot + Scope Execution Model — Plan & Tracker
2
+
3
+ Status: In progress
4
+ Last updated: 2025-10-20
5
+
6
+ This document captures an incremental plan to simplify Visor’s execution model using snapshot isolation (MVCC‑style) and scope‑aware output resolution, while preserving today’s routing semantics and recently added `on_finish` behavior (PR #146).
7
+
8
+ It also lists a set of quick wins we can land immediately to polish PR #146 and align docs/engine behavior.
9
+
10
+ ---
11
+
12
+ ## Status Dashboard
13
+
14
+ Priority scale: P0 = must‑have next; P1 = important; P2 = nice‑to‑have.
15
+
16
+ Overall progress: ~85% complete (Phases 0–3 done; Phases 2 and 4 now complete; Phase 5 pending).
17
+
18
+ | Phase | Priority | Status | % Complete | Notes |
19
+ |---|---|---:|---:|---|
20
+ | Phase 0 — Lay Hooks | P0 | ✅ Done | 100% | Journal + commits wired; unit coverage present. |
21
+ | Phase 1 — Snapshot Visibility | P0 | ✅ Done | 100% | Engine builds dependencyResults from snapshot. |
22
+ | Phase 2 — Outputs Surface | P1 | ✅ Done | 100% | outputs + outputs_history + outputs_raw shipped; docs updated with precedence matrix and examples. |
23
+ | Phase 3 — Unified Scheduling | P0 | ✅ Done | 100% | runNamedCheck added; routing uses it; loop budget uniform. |
24
+ | Phase 4 — Remove Per‑Item Map Cloning | P1 | ✅ Done | 100% | executeCheckInline and grouped forEach paths now use ScopePath + snapshot; minimal per-item overlay remains only within the same item’s inline descendant chain. |
25
+ | Phase 5 — Fan‑Out/Reduce Control | P2 | ⏳ Not Started | 0% | Add reduce/fanout flag; keep default single‑run. |
26
+
27
+ High‑priority backlog (outside phases)
28
+ - [P0] Journal Event Scoping: tag entries with event; filter ContextView by current/goto_event.
29
+ - [P1] Journal Performance Indexes: per‑(sessionId, checkId) indexes for readVisible.
30
+
31
+ ## Goals
32
+ - Deterministic reads under concurrency: each step sees a point‑in‑time view of prior results in the current run/session.
33
+ - Scope‑aware outputs for forEach: nearest item wins, with explicit raw/history accessors.
34
+ - Unify inline/goto execution as scheduling in the same scope (no special contexts), with loop budgets enforced.
35
+ - Keep provider interfaces, routing model (`on_success`, `on_fail`, `on_finish`, `goto_event`), and CI behavior.
36
+
37
+ ## Non‑Goals (for this iteration)
38
+ - Dataflow auto‑scheduling when a template references a not‑yet‑executed step.
39
+ - A new DSL for reduce/zip/cartesian across multiple forEach parents (we’ll add a minimal flag later if needed).
40
+
41
+ ---
42
+
43
+ ## Quick Wins For PR #146 (Low Risk)
44
+ - [x] Fix built-in schema lookup for Action runs (load from dist/output via __dirname with cwd fallback).
45
+
46
+ Checklist targets polish and parity; can be merged ahead of the snapshot work.
47
+
48
+ - [x] Expose `outputs.history` (or `outputs_history`) in `on_finish.goto_js` sandbox to match docs and examples.
49
+ - [x] Implement `on_finish.run_js` (docs mention it; engine currently ignores it).
50
+ - [x] Count `on_finish` routing toward `routing.max_loops` (prevent cycles); add tests.
51
+ - [x] Add `output_format` (command provider) to the config schema to remove warnings in examples.
52
+ - [ ] Keep `defaults/.visor.yaml` and `dist/defaults/.visor.yaml` in sync or clearly document source of truth. (tracked separately)
53
+
54
+ Acceptance checks
55
+ - [x] Unit/E2E: `on_finish.run_js` executes and merges with static `run` (order defined and tested). See `tests/e2e/on-finish-run-js-e2e.test.ts`.
56
+ - [x] E2E: `routing.max_loops` caps `on_finish` run/goto deterministically. See `tests/e2e/on-finish-loop-budget-e2e.test.ts`.
57
+ - [x] E2E: fact‑validator example runs without schema warnings. Manual run verified.
58
+
59
+ Target: by 2025-10-22
60
+
61
+ ---
62
+
63
+ ## Design At A Glance (Snapshot + Scope)
64
+
65
+ Primitives
66
+ ```
67
+ type ScopePath = Array<{ check: string; index: number }>; // e.g., [{check:"comments", index:3}]
68
+
69
+ interface JournalEntry {
70
+ commitId: number; // strictly increasing per session
71
+ sessionId: string; // current run
72
+ scope: ScopePath; // where this result belongs
73
+ checkId: string; // producer
74
+ result: ReviewSummary & { output?: unknown; content?: string };
75
+ }
76
+ ```
77
+
78
+ ExecutionJournal
79
+ - `beginSnapshot()` → returns the highest visible commitId now.
80
+ - `commit(entry)` → stores a result with the next commitId.
81
+ - `readVisible(sessionId, commitMax)` → entries ≤ commitMax.
82
+
83
+ ContextView (what templates/routing read)
84
+ - `get(checkId)` → nearest item in current scope; else ancestor; else latest.
85
+ - `getRaw(checkId)` → aggregate output (e.g., full array for forEach parent).
86
+ - `getHistory(checkId)` → all results up to snapshot.
87
+
88
+ Resolution rules
89
+ 1) If current scope includes `{check:X,index:i}`, then `outputs['X']` → item `i`.
90
+ 2) Else prefer an ancestor scope entry for `X`.
91
+ 3) Else the latest committed result of `X` in the snapshot.
92
+ 4) `outputs_raw['X']` returns the aggregate parent output.
93
+ 5) `outputs_history['X']` returns prior committed outputs.
94
+
95
+ ---
96
+
97
+ ## Phased Plan (Incremental)
98
+
99
+ Phase 0 — Lay Hooks (no behavior change)
100
+ - [x] Add `ExecutionJournal` and `ContextView` (internal module).
101
+ - [x] Commit every enriched result to the journal (in both normal and inline paths).
102
+ - [x] No feature flags — default-ready rollout.
103
+
104
+ Acceptance
105
+ - [x] Unit: journal commits monotonicity (see tests/unit/snapshot-store.test.ts).
106
+
107
+ Target: by 2025-10-24
108
+
109
+ Phase 1 — Snapshot‑based Visibility (minimal surface)
110
+ - [x] Build `dependencyResults` from a snapshot view instead of ad‑hoc `depends_on` maps in:
111
+ - [x] `executeWithRouting(...)`
112
+ - [x] `executeCheckInline(...)`
113
+ - [x] Keep dependency graph for ordering; this change affects visibility only.
114
+
115
+ Acceptance
116
+ - [x] Unit: parallel checks read only entries ≤ their snapshot; later commits are not visible. (covered by snapshot-store tests)
117
+ - [x] Integration: no‑deps visibility validated via snapshot with goto (see `tests/integration/snapshot-visibility-integration.test.ts`).
118
+
119
+ Target: by 2025-10-28
120
+
121
+ Phase 2 — Standardize Outputs Surface
122
+ - [x] Expose `outputs`, `outputs_history` consistently in:
123
+ - [x] Liquid templates (providers: ai, command, log, memory)
124
+ - [x] Routing sandboxes (`on_success.run_js`, `on_success.goto_js`, `on_fail.run_js`, `on_fail.goto_js`, `on_finish.goto_js`)
125
+ - [x] Expose `outputs_raw` for aggregate parent values (scope‑aware raw access)
126
+ - [x] Document precedence and examples (short snippet + table)
127
+
128
+ Acceptance
129
+ - [x] Unit/Integration: routing sandboxes read outputs_history (see tests/integration/output-history-integration.test.ts).
130
+ - [x] E2E: on_finish.goto_js can read outputs.history (see tests/e2e/on-finish-outputs-history-e2e.test.ts).
131
+ - [x] outputs_raw surfaced across providers and routing (tests/integration/outputs-raw-integration.test.ts).
132
+
133
+ Example: using outputs_raw
134
+
135
+ ```
136
+ checks:
137
+ list:
138
+ type: command
139
+ exec: echo '["a","b","c"]'
140
+ forEach: true
141
+
142
+ use-raw-memory:
143
+ type: script
144
+ depends_on: [list]
145
+ content: |
146
+ const arr = outputs_raw["list"]; // → ["a","b","c"]
147
+ return { count: arr.length };
148
+
149
+ route-by-raw:
150
+ type: script
151
+ depends_on: [list]
152
+ content: |
153
+ return 'ok';
154
+ on_success:
155
+ goto_js: |
156
+ // Branch using the aggregate array
157
+ return (outputs_raw["list"] || []).length >= 3 ? 'after-route' : null;
158
+
159
+ after-route:
160
+ type: log
161
+ message: Reached after-route
162
+ ```
163
+
164
+ Target: by 2025-10-31
165
+
166
+ Phase 3 — Unified Scheduling Helper (same scope)
167
+ - [x] Introduce `runNamedCheck(target, scope, opts)` used by inline/goto/on_finish.
168
+ - [x] Ensure routing transitions count toward `routing.max_loops` uniformly.
169
+ - [x] Preserve current single‑run semantics (no fan‑out yet).
170
+ Note: Fan‑out control is deferred to Phase 5.
171
+
172
+ Acceptance
173
+ - [x] Integration: on_success/on_fail loop budgets enforced uniformly (tests/integration/routing-loop-budget-uniformity.test.ts).
174
+ - [x] Integration: forEach item retry/remediation uses item context (tests/integration/routing-integration.test.ts).
175
+
176
+ Target: by 2025-11-01
177
+
178
+ Phase 4 — Remove Per‑Iteration Map Cloning
179
+ - [ ] Delete special “override resultsMap per iteration” code; rely on `ContextView` unwrapping.
180
+
181
+ Acceptance
182
+ - [ ] Unit: forEach dependent checks still see the correct per‑item output.
183
+
184
+ Target: by 2025-11-04
185
+
186
+ Phase 5 — Optional Fan‑Out/Reduce Control
187
+ - [ ] Add `fanout: map|reduce` (or `reduce: true`) on targets to control default behavior after forEach.
188
+ - [ ] Default remains current (single run) for backward compatibility.
189
+
190
+ Acceptance
191
+ - [ ] Unit/E2E: with `fanout: map`, target runs once per item; with `reduce: true`, runs once at parent.
192
+
193
+ Target: by 2025-11-06
194
+
195
+ ---
196
+
197
+ ## Engine Touchpoints (Where Changes Land)
198
+ - `src/check-execution-engine.ts`
199
+ - Commit to journal after provider returns (both main and inline paths).
200
+ - Build snapshot‑based `dependencyResults` (Phase 1, default, no flags).
201
+ - Add `runNamedCheck(...)` and route `on_success`/`on_fail`/`on_finish` through it (Phase 3).
202
+ - Count `on_finish` routing toward loop budgets (Quick Win).
203
+ - Routing sandbox init
204
+ - Inject `outputs`, `outputs_raw`, `outputs_history` (Phase 2).
205
+ - Providers (AI/command/memory/log)
206
+ - Use standardized outputs surface for templates (Phase 2).
207
+
208
+ ---
209
+
210
+ ## Event Scoping & Safety
211
+ - Journal entries should carry event context; default ContextView visibility is current event unless explicitly overridden by `goto_event`.
212
+ - Loop budgets: every routing transition (success/fail/finish) consumes the same `routing.max_loops` counter.
213
+
214
+ ---
215
+
216
+ ## Performance Notes
217
+ - Start with simple arrays; quickly add indexes by `(sessionId, checkId)`.
218
+ - Snapshot build: avoid O(N) scans by caching latest per checkId per snapshot when feasible.
219
+
220
+ ---
221
+
222
+ ## Test Plan (Highlights)
223
+ - Snapshot isolation under concurrency (parallel suites).
224
+ - Event elevation with `goto_event` (issue → PR context) does not leak across events.
225
+ - Fan‑out/Reduce behavior gated by explicit config.
226
+ - Loop budget exhaustion errors are deterministic and logged.
227
+
228
+ ---
229
+
230
+ ## Rollout & Backout
231
+ - Default rollout (no flags). Backout by reverting the engine changes if needed.
232
+
233
+ ---
234
+
235
+ ## Decision Log
236
+ - 2025-10-20: Adopt snapshot+scope plan incrementally; keep dependency graph for ordering; visibility moves to snapshots.
@@ -0,0 +1,21 @@
1
+ ## 📚 Examples & Recipes
2
+
3
+ - Minimal `.visor.yaml` starter
4
+ ```yaml
5
+ version: "1.0"
6
+ steps:
7
+ security:
8
+ type: ai
9
+ schema: code-review
10
+ prompt: "Identify security vulnerabilities in changed files"
11
+ ```
12
+
13
+ - Fast local pre-commit hook (Husky)
14
+ ```bash
15
+ npx husky add .husky/pre-commit "npx -y @probelabs/visor@latest --tags local,fast --output table || exit 1"
16
+ ```
17
+
18
+ - More examples
19
+ - docs/NPM_USAGE.md – CLI usage and flags
20
+ - GITHUB_CHECKS.md – Checks, outputs, and workflow integration
21
+ - examples/ – MCP, Jira, and advanced configs
@@ -0,0 +1,92 @@
1
+ # Criticality & Contracts — Implementation Tasks (Do‑It‑Right)
2
+
3
+ This file lists the remaining engineering tasks to fully implement the criticality model, contracts, and transitions as documented. Items are grouped and check‑listable. “(optional)” items can be phased in later.
4
+
5
+ ## 1) Schema & Types
6
+ - [ ] Add `criticality` field to `CheckConfig` (`external | internal | policy | info`).
7
+ - [ ] (optional) Add `assume_mode: 'skip' | 'fail'` to control unmet preconditions handling.
8
+ - [ ] (optional) Add `retry_on: ['transient'] | ['transient','logical']` to narrow retry classes.
9
+ - [ ] Update JSON schema generator and `src/generated/config-schema.ts`.
10
+ - [ ] Update TypeScript types (`src/types/config.ts`, SDK exports).
11
+
12
+ ## 2) Config Validation & Linting
13
+ - [ ] Validator: warn when `criticality` omitted on mutating providers (external inference) or forEach parents (control‑plane inference).
14
+ - [ ] Validator: warn when critical steps lack `assume`/`guarantee`.
15
+ - [ ] Validator: warn when `assume` references this step’s own `output`.
16
+ - [ ] Validator: warn when `guarantee` contains policy thresholds better modeled as `fail_if`.
17
+ - [ ] Validator: ensure `transitions[].to` targets exist (or null) and expressions compile.
18
+
19
+ ## 3) Engine Policy Mapping
20
+ - [ ] Derive defaults from `criticality` at load time (but allow per‑check overrides):
21
+ - external/control‑plane/policy: `continue_on_failure=false`, retries transient‑only (max 2–3), loop budgets tighter (e.g., 8), contracts required.
22
+ - non‑critical: contracts optional, `continue_on_failure` may be true, default loop budget 10, retries standard.
23
+ - [ ] Enforce “no auto‑retry for logical failures” in critical modes (fail_if/guarantee violations).
24
+ - [ ] (optional) Per‑criticality loop budget override (e.g., control‑plane default 8).
25
+
26
+ ## 4) Runtime Semantics (clarity & safety)
27
+ - [ ] Ensure `assume` is evaluated pre‑exec (no access to this step’s `output`), with clear error messaging.
28
+ - [ ] Ensure `guarantee` is evaluated post‑exec, with issues emitted as `contract/guarantee_failed`.
29
+ - [ ] Keep expressions sandboxed, pure, and short‑timed; log evaluation errors as fail‑secure decisions.
30
+ - [ ] Transitions precedence over `goto_js` when both present; loop budget enforcement per scope.
31
+ - [ ] (optional) forEach per‑item concurrency with default 1; cap via config.
32
+
33
+ ## 5) Side‑Effect Classification
34
+ - [ ] Provider capability flags: identify mutating actions (GitHub ops except read‑only; HTTP methods ≠ GET/HEAD; file writes).
35
+ - [ ] For critical external steps: provide idempotency and/or compensation hooks (sagas) (optional roadmap).
36
+ - [ ] Suppress downstream mutating steps when contracts/fail_if fail in critical branches (via dependency gating).
37
+
38
+ ## 6) CLI & Safety Switches
39
+ - [ ] `--safe-mode` flag to disable mutating providers (dry‑run all externals) for verification.
40
+ - [ ] (optional) `--safety-profile strict|standard` to adjust loop budgets and retry caps globally.
41
+
42
+ ## 7) Telemetry & Observability
43
+ - [ ] Emit structured fault events: `fault.detected`, `fault.isolated`, `fault.recovery.{attempted,failed,succeeded}`.
44
+ - [ ] Metrics: retries attempted, logical vs transient failure counts, loop budget hits, contract violations by check.
45
+ - [ ] Journal: ensure all contract/transition decisions and expressions are captured with scope/timestamps.
46
+
47
+ ## 8) Persistence
48
+ - [ ] Keep JSON snapshot export (done) and add (optional) debug‑resume path gated by a debug flag.
49
+
50
+ ## 9) Defaults & Examples
51
+ - [ ] Update `defaults/visor.yaml` (and any bundled defaults) to declare `criticality` for relevant checks and prefer `transitions` over `goto_js` where applicable.
52
+ - [ ] Update `defaults/task-refinement.yaml` and `defaults/agent-builder.yaml` to use `criticality` and transitions where appropriate; ensure no `assume` refers to own output.
53
+ - [ ] Convert inline YAML arrays in defaults to block‑style lists for consistency.
54
+ - [ ] Add an annotated example block with all primitives (if, assume, guarantee, fail_if, transitions) and modes (reference the guides) in the defaults or examples folder.
55
+ - [ ] Verify defaults run green via dist CLI:
56
+ - `npm run build:cli`
57
+ - `node dist/index.js test defaults/visor.tests.yaml --progress compact`
58
+ - Any other default suites (`task-refinement`, `agent-builder`) if present.
59
+
60
+ ## 10) Tests
61
+ - [ ] Unit (engine/native):
62
+ - `assume` skip vs guard‑step hard‑fail (no provider call on skip).
63
+ - `guarantee` violation adds `contract/guarantee_failed` and does not double‑execute provider.
64
+ - Transitions precedence over `goto_js`; undefined transition falls back to `goto`.
65
+ - Loop budget enforcement per scope (error surfaced; routing halts in that scope).
66
+ - Criticality policy mapping (external/control‑plane/policy/non‑critical) sets defaults (gating, retries, budgets).
67
+ - [ ] Integration:
68
+ - Critical external step blocks downstream mutating side‑effects on contract/fail_if failure (dependents gated).
69
+ - Control‑plane forEach parent respects tighter loop budget; no oscillation beyond cap.
70
+ - Retry classifier: transient provider errors retried; logical (fail_if/guarantee) not auto‑retried in critical modes.
71
+ - Non‑critical step with `continue_on_failure: true` does not block pipeline.
72
+ - [ ] YAML e2e / Defaults:
73
+ - `defaults/visor.yaml` flow passes using transitions.
74
+ - `defaults/task-refinement.yaml` and `defaults/agent-builder.yaml` pass with `criticality` declared.
75
+ - Add a strict safety profile scenario (e.g., `safety: strict`) and ensure it passes.
76
+ - [ ] CI Gates:
77
+ - Add a job to build CLI and run default YAML suites with `--progress compact`.
78
+ - Run unit/integration on PR; block merges on regressions.
79
+
80
+ ## 11) Docs (remaining polish)
81
+ - [ ] README or landing page: link to Criticality Modes and Fault Management guides.
82
+ - [ ] Ensure quick‑starts show `criticality` in at least one example (SDK & CLI done).
83
+ - [ ] Sweep older docs for inline arrays (`[a, b]`) and convert to block lists.
84
+ - [ ] Add “assume vs guarantee — do’s and don’ts” callout in any doc that introduces contracts (done for two guides).
85
+
86
+ ## Acceptance Criteria
87
+ - [ ] All tests pass (unit/integration/YAML) with representative critical/non‑critical mixes.
88
+ - [ ] Config validator warns on unsafe/missing contracts and mis‑declared criticality.
89
+ - [ ] Engine enforces defaults per `criticality` while allowing explicit overrides.
90
+ - [ ] Logs have timestamps; debug gated; decisions visible in journal and metrics.
91
+ - [ ] No dist/ artifacts in commits.
92
+ - [ ] Updated defaults (`defaults/visor.yaml`, `defaults/task-refinement.yaml`, `defaults/agent-builder.yaml`) run green via dist CLI in CI.
@@ -0,0 +1,10 @@
1
+ # Schema Coverage – Next Phase
2
+
3
+ This PR tracks follow-up work to expand the generated JSON Schema to cover all provider-specific keys and options without relying on runtime generation.
4
+
5
+ Planned tasks:
6
+ - Validate and document provider-specific fields (ai, log, command, http, http_input, http_client, claude-code).
7
+ - Ensure additionalProperties is set appropriately per object; allow `x-` extensions.
8
+ - Keep human-friendly error messages while surfacing unknown keys via Ajv warnings.
9
+
10
+ This doc will be updated as changes land.
@@ -0,0 +1,68 @@
1
+ ## 📋 Schema-Template System
2
+
3
+ Visor pairs JSON Schemas (data shape) with Liquid templates (rendering) so outputs are predictable, auditable, and GitHub‑native.
4
+
5
+ ### Overview
6
+ - Schema validates check output at runtime (via AJV)
7
+ - Template renders tables/markdown and GitHub Checks annotations
8
+ - Group controls which GitHub comment a check posts to
9
+
10
+ ### Quick Example
11
+
12
+ ```yaml
13
+ steps:
14
+ security:
15
+ type: ai
16
+ group: code-review
17
+ schema: code-review
18
+ prompt: "Review for security issues and return JSON"
19
+
20
+ overview:
21
+ type: ai
22
+ group: summary
23
+ schema: text
24
+ prompt: "Summarize PR in markdown"
25
+ ```
26
+
27
+ ### Built-in Schemas
28
+ - code-review: structured findings with severity, file, line → native annotations
29
+ - text: free‑form markdown content (no annotations)
30
+
31
+ ### Grouping
32
+
33
+ ```yaml
34
+ steps:
35
+ security: { group: code-review }
36
+ performance:{ group: code-review }
37
+ overview: { group: summary }
38
+ assistant: { group: dynamic } # always creates a new comment
39
+ ```
40
+
41
+ ### Custom Schemas
42
+
43
+ ```yaml
44
+ schemas:
45
+ custom-metrics:
46
+ file: ./schemas/metrics.json
47
+
48
+ steps:
49
+ metrics:
50
+ schema: custom-metrics
51
+ group: metrics
52
+ ```
53
+
54
+ ### GitHub Checks API Compatibility
55
+
56
+ For status checks and annotations, use structured output with `issues[]` having:
57
+ - severity: critical | error | warning | info
58
+ - file, line, message
59
+
60
+ Unstructured (none/plain) → posted as-is, no status checks.
61
+
62
+ ### Enhanced Prompts
63
+ - Smart auto‑detection, Liquid templating, file‑based prompts
64
+ - Template context: `pr`, `files`, `event`, `outputs`, `utils`
65
+ - See [Liquid Templates Guide](./liquid-templates.md) for available variables and filters
66
+
67
+ See full examples in `defaults/.visor.yaml`.
68
+
@@ -0,0 +1,34 @@
1
+ ## Script step (type: `script`)
2
+
3
+ The `script` provider executes JavaScript in a secure sandbox with access to
4
+ PR context, dependency outputs, and the Visor memory store.
5
+
6
+ - Use `type: script` with a `content` block containing your code.
7
+ - The sandbox exposes these objects:
8
+ - `pr`: basic PR metadata and file list.
9
+ - `outputs`: map of dependency outputs (plus `outputs.history`).
10
+ - `outputs_raw`: aggregated values from `-raw` dependencies.
11
+ - `outputs_history_stage`: per-stage output history slice for tests.
12
+ - `memory`: synchronous helpers `get`, `set`, `append`, `increment`, `delete`, `clear`.
13
+ - The value you `return` becomes this step’s `output` (for `depends_on`).
14
+
15
+ Example:
16
+
17
+ ```yaml
18
+ steps:
19
+ extract-facts:
20
+ type: command
21
+ exec: node ./scripts/extract-facts.js
22
+
23
+ aggregate:
24
+ type: script
25
+ depends_on: [extract-facts]
26
+ content: |
27
+ const facts = outputs['extract-facts'] || [];
28
+ memory.set('total_facts', Array.isArray(facts) ? facts.length : 0, 'fact-validation');
29
+ const allValid = Array.isArray(facts) && facts.every(f => f.valid === true);
30
+ memory.set('all_valid', allValid, 'fact-validation');
31
+ return { total: memory.get('total_facts', 'fact-validation'), allValid };
32
+ ```
33
+
34
+ The script context and memory helpers mirror other providers’ contexts.
@@ -0,0 +1,222 @@
1
+ # Visor SDK (Programmatic Usage)
2
+
3
+ Run Visor from Node.js without shelling out. The SDK is a thin façade over the existing engine: it just wires inputs/outputs and reuses all core behavior (routing, providers, templates, etc.).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm i -D @probelabs/visor
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ### JavaScript (ESM)
14
+ ```ts
15
+ import { loadConfig, runChecks } from '@probelabs/visor/sdk';
16
+
17
+ // Load config from object (not file!) - validation and defaults applied
18
+ const config = await loadConfig({
19
+ version: '1.0',
20
+ checks: {
21
+ 'security': { type: 'command', exec: 'npm audit' },
22
+ 'lint': { type: 'command', exec: 'npm run lint' },
23
+ }
24
+ });
25
+
26
+ const result = await runChecks({
27
+ config,
28
+ checks: Object.keys(config.checks),
29
+ output: { format: 'json' },
30
+ });
31
+ console.log('Total issues:', result.reviewSummary.issues?.length ?? 0);
32
+ ```
33
+
34
+ ### TypeScript
35
+ ```typescript
36
+ import { loadConfig, runChecks, type VisorConfig, type RunOptions } from '@probelabs/visor/sdk';
37
+
38
+ // Type-safe config construction
39
+ const rawConfig: Partial<VisorConfig> = {
40
+ version: '1.0',
41
+ checks: {
42
+ 'security': { type: 'command', exec: 'npm audit' },
43
+ 'lint': { type: 'command', exec: 'npm run lint' },
44
+ }
45
+ };
46
+
47
+ const config = await loadConfig(rawConfig);
48
+ const result = await runChecks({
49
+ config,
50
+ checks: Object.keys(config.checks),
51
+ output: { format: 'json' },
52
+ });
53
+
54
+ // Type-safe result access with full type inference
55
+ console.log('Total issues:', result.reviewSummary.issues?.length ?? 0);
56
+ console.log('Checks executed:', result.checksExecuted);
57
+ console.log('Execution time:', result.executionTime);
58
+ ```
59
+
60
+ CommonJS
61
+ ```js
62
+ const { loadConfig, runChecks } = require('@probelabs/visor/sdk');
63
+ (async () => {
64
+ const config = await loadConfig({
65
+ version: '1.0',
66
+ checks: { test: { type: 'command', exec: 'echo test' } }
67
+ });
68
+ const result = await runChecks({ config, checks: Object.keys(config.checks), output: { format: 'json' } });
69
+ console.log('Total issues:', result.reviewSummary.issues?.length ?? 0);
70
+ })();
71
+ ```
72
+
73
+ ### Loading from Files
74
+
75
+ You can also load config from files:
76
+
77
+ ```ts
78
+ import { loadConfig, runChecks } from '@probelabs/visor/sdk';
79
+
80
+ // Load from specific file path
81
+ const config = await loadConfig('./my-config.yaml');
82
+
83
+ // Or discover default (.visor.yaml/.visor.yml)
84
+ const config2 = await loadConfig();
85
+
86
+ const result = await runChecks({
87
+ config,
88
+ checks: Object.keys(config.checks),
89
+ output: { format: 'json' },
90
+ });
91
+ ```
92
+
93
+ **Note:** The `output` parameter in `runChecks()` options controls the CLI output format (table/json/markdown/sarif). The config's `output` field is for GitHub PR comments and is optional for programmatic use.
94
+
95
+ ### Strict Validation Mode
96
+
97
+ By default, unknown config keys generate warnings but don't fail. Enable strict mode to catch config errors early:
98
+
99
+ ```ts
100
+ import { runChecks } from '@probelabs/visor/sdk';
101
+
102
+ const config = {
103
+ version: '1.0',
104
+ checks: { test: { type: 'command', exec: 'echo test' } },
105
+ typo_field: 'oops' // This would normally just warn
106
+ };
107
+
108
+ try {
109
+ await runChecks({
110
+ config,
111
+ checks: ['test'],
112
+ strictValidation: true // Now throws error for unknown keys
113
+ });
114
+ } catch (error) {
115
+ console.error('Config error:', error.message);
116
+ // Error: Unknown top-level key 'typo_field' will be ignored.
117
+ }
118
+ ```
119
+
120
+ ## API
121
+
122
+ - `loadConfig(configOrPath?: string | Partial<VisorConfig>, options?: { strict?: boolean }): Promise<VisorConfig>`
123
+ - Loads and validates a config from an object, file path, or discovers defaults
124
+ - Accepts config objects (validates and applies defaults) or file paths
125
+ - Returns fully validated config with all defaults applied
126
+ - Set `options.strict` to treat warnings as errors
127
+ - `resolveChecks(checkIds: string[], config: VisorConfig | undefined): string[]`
128
+ - Expands check IDs to include dependencies in the correct order.
129
+ - `runChecks(options: RunOptions): Promise<AnalysisResult>`
130
+ - Runs checks programmatically. Thin wrapper around the engine's `executeChecks`.
131
+
132
+ ### Types
133
+
134
+ - `RunOptions`
135
+ - `config?: VisorConfig` | `configPath?: string`
136
+ - `checks?: string[]`
137
+ - `cwd?: string`
138
+ - `timeoutMs?: number`
139
+ - `output?: { format?: 'table'|'json'|'markdown'|'sarif' }`
140
+ - `debug?: boolean`
141
+ - `maxParallelism?: number`
142
+ - `failFast?: boolean`
143
+ - `tagFilter?: { include?: string[]; exclude?: string[] }`
144
+ - `strictValidation?: boolean` - Treat config warnings (unknown keys) as errors (default: false)
145
+
146
+ - `AnalysisResult`
147
+ - `reviewSummary.issues: Issue[]`
148
+ - `executionTime: number`, `timestamp: string`, `checksExecuted: string[]`
149
+
150
+ Refer to `src/types/config.ts` for `VisorConfig`, `Issue`, and related types.
151
+
152
+ ## Safety & Criticality (Quick Note)
153
+
154
+ When building configs programmatically, model safety explicitly:
155
+
156
+ - Declare criticality on steps with `criticality: external|internal|policy|info`.
157
+ - Add contracts to critical steps:
158
+ - `assume:` preconditions checked before execution
159
+ - `guarantee:` postconditions checked after execution
160
+ - Use declarative `transitions` for routing rather than `goto_js`.
161
+
162
+ Example config (JS object):
163
+ ```ts
164
+ const cfg = await loadConfig({
165
+ version: '1.0',
166
+ checks: {
167
+ 'post-comment': {
168
+ type: 'github',
169
+ criticality: 'external',
170
+ on: ['pr_opened'],
171
+ op: 'comment.create',
172
+ assume: ["isMember()"],
173
+ guarantee: ["output && typeof output.id === 'number'"],
174
+ continue_on_failure: false,
175
+ },
176
+ // Structured outputs with unified `schema` (object) for validation
177
+ 'summarize-json': {
178
+ type: 'ai',
179
+ schema: {
180
+ type: 'object',
181
+ properties: { ok: { type: 'boolean' }, items: { type: 'array', items: { type: 'string' } } },
182
+ required: ['ok', 'items']
183
+ },
184
+ prompt: 'Return JSON with ok and items...'
185
+ },
186
+ // Command/script can also use JSON Schema via `schema`
187
+ 'aggregate': {
188
+ type: 'script',
189
+ content: 'return { all_valid: true };',
190
+ schema: { type: 'object', properties: { all_valid: { type: 'boolean' } }, required: ['all_valid'], additionalProperties: false }
191
+ }
192
+ },
193
+ });
194
+ ```
195
+
196
+ ## Notes
197
+
198
+ - SDK adds no new sandboxing or providers; all safety lives in the core engine.
199
+ - For offline demos, unset provider env vars if you rely on mock providers.
200
+ - You can still use all CLI features alongside the SDK in the same project.
201
+
202
+ ## Examples (in repo)
203
+
204
+ - `examples/sdk-basic.mjs` (ESM) – Minimal example with raw config object
205
+ - `examples/sdk-cjs.cjs` (CJS) – CommonJS usage
206
+ - `examples/sdk-manual-config.mjs` (ESM) – Manual config construction with validation
207
+ - `examples/sdk-typescript.ts` (TypeScript) – **Type-safe example** showing:
208
+ - Full TypeScript type safety with SDK type definitions
209
+ - Importing types from `@probelabs/visor/sdk`
210
+ - Type inference for configs and results
211
+ - Compile-time type checking
212
+ - Using exported types (`VisorConfig`, `RunOptions`)
213
+ - To run: `npx tsc examples/sdk-typescript.ts --module esnext --target es2022 --moduleResolution bundler --esModuleInterop --skipLibCheck && node examples/sdk-typescript.js`
214
+ - `examples/sdk-comprehensive.mjs` (ESM) – **Complex example** showing:
215
+ - Multi-level check dependencies (`depends_on`)
216
+ - Tag filtering
217
+ - Parallel execution control
218
+ - Dependency resolution with `resolveChecks()`
219
+ - Strict validation mode
220
+ - Complete pipeline execution
221
+
222
+ These are also exercised by CI smoke tests.