@probelabs/visor 0.1.106 → 0.1.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (530) hide show
  1. package/README.md +71 -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 +624 -0
  7. package/defaults/visor.tests.yaml +685 -0
  8. package/defaults/visor.yaml +483 -0
  9. package/dist/action-cli-bridge.d.ts +11 -82
  10. package/dist/action-cli-bridge.d.ts.map +1 -1
  11. package/dist/ai-review-service.d.ts +28 -9
  12. package/dist/ai-review-service.d.ts.map +1 -1
  13. package/dist/check-execution-engine.d.ts +19 -331
  14. package/dist/check-execution-engine.d.ts.map +1 -1
  15. package/dist/cli-main.d.ts.map +1 -1
  16. package/dist/cli.d.ts +0 -1
  17. package/dist/cli.d.ts.map +1 -1
  18. package/dist/config.d.ts +16 -0
  19. package/dist/config.d.ts.map +1 -1
  20. package/dist/cron-scheduler.d.ts +3 -3
  21. package/dist/cron-scheduler.d.ts.map +1 -1
  22. package/dist/debug-visualizer/ws-server.d.ts +7 -1
  23. package/dist/debug-visualizer/ws-server.d.ts.map +1 -1
  24. package/dist/defaults/code-refiner.yaml +114 -0
  25. package/dist/defaults/{.visor.yaml → code-review.yaml} +35 -226
  26. package/dist/defaults/override.yaml +52 -0
  27. package/dist/defaults/task-refinement.yaml +624 -0
  28. package/dist/defaults/visor.tests.yaml +685 -0
  29. package/dist/defaults/visor.yaml +483 -0
  30. package/dist/docs/DEPLOYMENT.md +118 -0
  31. package/dist/docs/GITHUB_CHECKS.md +280 -0
  32. package/dist/docs/NPM_USAGE.md +208 -0
  33. package/dist/docs/action-reference.md +19 -0
  34. package/dist/docs/advanced-ai.md +237 -0
  35. package/dist/docs/ai-configuration.md +535 -0
  36. package/dist/docs/ai-custom-tools-usage.md +261 -0
  37. package/dist/docs/ai-custom-tools.md +392 -0
  38. package/dist/docs/author-permissions.md +610 -0
  39. package/dist/docs/bot-transports-rfc.md +23 -0
  40. package/dist/docs/ci-cli-mode.md +34 -0
  41. package/dist/docs/claude-code.md +74 -0
  42. package/dist/docs/command-provider.md +559 -0
  43. package/dist/docs/commands.md +8 -0
  44. package/dist/docs/configuration.md +324 -0
  45. package/dist/docs/custom-tools.md +424 -0
  46. package/dist/docs/dashboards/README.md +23 -0
  47. package/dist/docs/dashboards/grafana-visor-diagrams.json +20 -0
  48. package/dist/docs/dashboards/grafana-visor-overview.json +33 -0
  49. package/dist/docs/debug-visualizer-progress.md +572 -0
  50. package/dist/docs/debug-visualizer-rfc.md +691 -0
  51. package/dist/docs/debug-visualizer.md +114 -0
  52. package/dist/docs/debugging.md +636 -0
  53. package/dist/docs/default-output-schema.md +28 -0
  54. package/dist/docs/dependencies.md +369 -0
  55. package/dist/docs/dev-playbook.md +9 -0
  56. package/dist/docs/engine-pause-resume-rfc.md +192 -0
  57. package/dist/docs/engine-state-machine-plan.md +333 -0
  58. package/dist/docs/event-driven-github-integration-rfc.md +743 -0
  59. package/dist/docs/event-triggers.md +292 -0
  60. package/dist/docs/execution-statistics-rfc.md +290 -0
  61. package/dist/docs/fact-validator-gap-analysis.md +178 -0
  62. package/dist/docs/fact-validator-implementation-plan.md +1235 -0
  63. package/dist/docs/fail-if.md +95 -0
  64. package/dist/docs/failure-conditions-implementation.md +271 -0
  65. package/dist/docs/failure-conditions-schema.md +173 -0
  66. package/dist/docs/failure-routing-rfc.md +193 -0
  67. package/dist/docs/failure-routing.md +507 -0
  68. package/dist/docs/foreach-dependency-propagation.md +473 -0
  69. package/dist/docs/github-ops.md +89 -0
  70. package/dist/docs/goto-forward-run-plan.md +113 -0
  71. package/dist/docs/guides/criticality-modes.md +332 -0
  72. package/dist/docs/guides/fault-management-and-contracts.md +738 -0
  73. package/dist/docs/guides/workflow-style-guide.md +224 -0
  74. package/dist/docs/http.md +299 -0
  75. package/dist/docs/human-input-provider.md +372 -0
  76. package/dist/docs/lifecycle-hooks.md +253 -0
  77. package/dist/docs/limits.md +64 -0
  78. package/dist/docs/liquid-templates.md +490 -0
  79. package/dist/docs/loop-routing-refactor.md +89 -0
  80. package/dist/docs/mcp-provider.md +557 -0
  81. package/dist/docs/mcp.md +124 -0
  82. package/dist/docs/memory.md +903 -0
  83. package/dist/docs/observability.md +12 -0
  84. package/dist/docs/output-formats.md +20 -0
  85. package/dist/docs/output-formatting.md +29 -0
  86. package/dist/docs/output-history.md +383 -0
  87. package/dist/docs/performance.md +6 -0
  88. package/dist/docs/pluggable.md +124 -0
  89. package/dist/docs/proposals/snapshot-scope-execution.md +236 -0
  90. package/dist/docs/providers/git-checkout.md +589 -0
  91. package/dist/docs/recipes.md +474 -0
  92. package/dist/docs/rfc/git-checkout-step.md +601 -0
  93. package/dist/docs/rfc/on_init-hook.md +1294 -0
  94. package/dist/docs/rfc/workspace-isolation.md +216 -0
  95. package/dist/docs/roadmap/criticality-implementation-tasks.md +92 -0
  96. package/dist/docs/router-patterns.md +339 -0
  97. package/dist/docs/schema-next-pr.md +10 -0
  98. package/dist/docs/schema-templates.md +68 -0
  99. package/dist/docs/script.md +34 -0
  100. package/dist/docs/sdk.md +222 -0
  101. package/dist/docs/security.md +7 -0
  102. package/dist/docs/suppressions.md +89 -0
  103. package/dist/docs/tag-filtering.md +258 -0
  104. package/dist/docs/telemetry-setup.md +119 -0
  105. package/dist/docs/telemetry-tracing-rfc.md +275 -0
  106. package/dist/docs/test-framework-rfc.md +680 -0
  107. package/dist/docs/testing/assertions.md +85 -0
  108. package/dist/docs/testing/ci.md +44 -0
  109. package/dist/docs/testing/cli.md +41 -0
  110. package/dist/docs/testing/cookbook.md +172 -0
  111. package/dist/docs/testing/dsl-reference.md +199 -0
  112. package/dist/docs/testing/fixtures-and-mocks.md +91 -0
  113. package/dist/docs/testing/flows.md +92 -0
  114. package/dist/docs/testing/getting-started.md +93 -0
  115. package/dist/docs/testing/troubleshooting.md +55 -0
  116. package/dist/docs/timeouts.md +50 -0
  117. package/dist/docs/troubleshooting.md +7 -0
  118. package/dist/docs/visor-sdk-rfc.md +186 -0
  119. package/dist/docs/workflows.md +569 -0
  120. package/dist/engine/on-finish/orchestrator.d.ts +19 -0
  121. package/dist/engine/on-finish/orchestrator.d.ts.map +1 -0
  122. package/dist/engine/on-finish/utils.d.ts +44 -0
  123. package/dist/engine/on-finish/utils.d.ts.map +1 -0
  124. package/dist/event-bus/event-bus.d.ts +13 -0
  125. package/dist/event-bus/event-bus.d.ts.map +1 -0
  126. package/dist/event-bus/types.d.ts +71 -0
  127. package/dist/event-bus/types.d.ts.map +1 -0
  128. package/dist/examples/.claude/agents/code-reviewer.md +69 -0
  129. package/dist/examples/.mcp.json +34 -0
  130. package/dist/examples/CALCULATOR-SDK.md +364 -0
  131. package/dist/examples/README.md +384 -0
  132. package/dist/examples/ai-custom-tools-example.yaml +206 -0
  133. package/dist/examples/ai-custom-tools-simple.yaml +76 -0
  134. package/dist/examples/ai-retry-fallback-config.yaml +180 -0
  135. package/dist/examples/ai-with-bash.yaml +126 -0
  136. package/dist/examples/ai-with-mcp.yaml +82 -0
  137. package/dist/examples/basic-human-input.yaml +15 -0
  138. package/dist/examples/bedrock-config.yaml +77 -0
  139. package/dist/examples/calculator-config.yaml +133 -0
  140. package/dist/examples/calculator-json-output-guide.md +311 -0
  141. package/dist/examples/calculator-sdk-automated.ts +340 -0
  142. package/dist/examples/calculator-sdk-example.ts +275 -0
  143. package/dist/examples/calculator-sdk-json.ts +331 -0
  144. package/dist/examples/calculator-sdk-real.ts +374 -0
  145. package/dist/examples/calculator-sdk-test.ts +148 -0
  146. package/dist/examples/claude-code-config.yaml +191 -0
  147. package/dist/examples/cron-webhook-config.yaml +215 -0
  148. package/dist/examples/custom-template.liquid +57 -0
  149. package/dist/examples/custom-tools-example.yaml +281 -0
  150. package/dist/examples/enhanced-config.yaml +165 -0
  151. package/dist/examples/environments/visor.base.yaml +92 -0
  152. package/dist/examples/environments/visor.dev.yaml +33 -0
  153. package/dist/examples/environments/visor.prod.yaml +95 -0
  154. package/dist/examples/environments/visor.staging.yaml +46 -0
  155. package/dist/examples/fact-validator.yaml +361 -0
  156. package/dist/examples/fail-if-simple.yaml +90 -0
  157. package/dist/examples/failure-conditions-advanced.yaml +136 -0
  158. package/dist/examples/failure-conditions-basic.yaml +48 -0
  159. package/dist/examples/failure-conditions-github-style.yaml +119 -0
  160. package/dist/examples/failure-conditions-migration.yaml +74 -0
  161. package/dist/examples/for-loop-example.yaml +176 -0
  162. package/dist/examples/forEach-example.yaml +120 -0
  163. package/dist/examples/git-checkout-basic.yaml +32 -0
  164. package/dist/examples/git-checkout-compare.yaml +59 -0
  165. package/dist/examples/git-checkout-cross-repo.yaml +76 -0
  166. package/dist/examples/github-workflow-with-tags.yml +163 -0
  167. package/dist/examples/http-integration-config.yaml +240 -0
  168. package/dist/examples/https-server-config.yaml +209 -0
  169. package/dist/examples/human-input-example.yaml +63 -0
  170. package/dist/examples/if-conditions.yaml +173 -0
  171. package/dist/examples/jira-simple-example.yaml +56 -0
  172. package/dist/examples/jira-single-issue-workflow.yaml +166 -0
  173. package/dist/examples/jira-workflow-mcp.yaml +182 -0
  174. package/dist/examples/mcp/analyzer.py +119 -0
  175. package/dist/examples/mcp-provider-example.yaml +301 -0
  176. package/dist/examples/memory-counter.yaml +99 -0
  177. package/dist/examples/memory-error-collection.yaml +104 -0
  178. package/dist/examples/memory-exec-js.yaml +247 -0
  179. package/dist/examples/memory-namespace-isolation.yaml +184 -0
  180. package/dist/examples/memory-retry-counter.yaml +65 -0
  181. package/dist/examples/memory-state-machine.yaml +170 -0
  182. package/dist/examples/on-init-import-demo.yaml +179 -0
  183. package/dist/examples/outputs-raw-basic.yaml +26 -0
  184. package/dist/examples/project-with-tools.yaml +174 -0
  185. package/dist/examples/prompts/architecture-analysis.liquid +116 -0
  186. package/dist/examples/prompts/security-comprehensive.liquid +107 -0
  187. package/dist/examples/quick-start-tags.yaml +53 -0
  188. package/dist/examples/reusable-tools.yaml +92 -0
  189. package/dist/examples/reusable-workflows.yaml +88 -0
  190. package/dist/examples/routing-basic.yaml +35 -0
  191. package/dist/examples/routing-dynamic-js.yaml +46 -0
  192. package/dist/examples/routing-foreach.yaml +34 -0
  193. package/dist/examples/routing-goto-event.yaml +34 -0
  194. package/dist/examples/routing-on-success.yaml +25 -0
  195. package/dist/examples/run-calculator-demo.sh +71 -0
  196. package/dist/examples/sdk-basic.mjs +10 -0
  197. package/dist/examples/sdk-cjs.cjs +10 -0
  198. package/dist/examples/sdk-comprehensive.mjs +175 -0
  199. package/dist/examples/sdk-manual-config.mjs +65 -0
  200. package/dist/examples/sdk-typescript.js +81 -0
  201. package/dist/examples/sdk-typescript.ts +92 -0
  202. package/dist/examples/session-reuse-config.yaml +151 -0
  203. package/dist/examples/session-reuse-self.yaml +81 -0
  204. package/dist/examples/slack-simple-chat.yaml +775 -0
  205. package/dist/examples/templates/security-report.liquid +137 -0
  206. package/dist/examples/tools-library.yaml +281 -0
  207. package/dist/examples/transform-example.yaml +199 -0
  208. package/dist/examples/visor-with-tags.yaml +198 -0
  209. package/dist/examples/webhook-pipeline-config.yaml +218 -0
  210. package/dist/examples/workflows/calculator-workflow.yaml +163 -0
  211. package/dist/examples/workflows/code-quality.yaml +222 -0
  212. package/dist/examples/workflows/quick-pr-check.yaml +90 -0
  213. package/dist/examples/workflows/workflow-composition-example.yaml +130 -0
  214. package/dist/failure-condition-evaluator.d.ts +3 -0
  215. package/dist/failure-condition-evaluator.d.ts.map +1 -1
  216. package/dist/frontends/github-frontend.d.ts +58 -0
  217. package/dist/frontends/github-frontend.d.ts.map +1 -0
  218. package/dist/frontends/host.d.ts +47 -0
  219. package/dist/frontends/host.d.ts.map +1 -0
  220. package/dist/frontends/ndjson-sink.d.ts +12 -0
  221. package/dist/frontends/ndjson-sink.d.ts.map +1 -0
  222. package/dist/frontends/slack-frontend.d.ts +58 -0
  223. package/dist/frontends/slack-frontend.d.ts.map +1 -0
  224. package/dist/generated/config-schema.d.ts +967 -57
  225. package/dist/generated/config-schema.d.ts.map +1 -1
  226. package/dist/generated/config-schema.json +1033 -56
  227. package/dist/github-check-service.d.ts +4 -6
  228. package/dist/github-check-service.d.ts.map +1 -1
  229. package/dist/github-comments.d.ts +2 -4
  230. package/dist/github-comments.d.ts.map +1 -1
  231. package/dist/index.d.ts.map +1 -1
  232. package/dist/index.js +134327 -99004
  233. package/dist/liquid-extensions.d.ts.map +1 -1
  234. package/dist/logger.d.ts +2 -0
  235. package/dist/logger.d.ts.map +1 -1
  236. package/dist/memory-store.d.ts +6 -0
  237. package/dist/memory-store.d.ts.map +1 -1
  238. package/dist/output/assistant-json/template.liquid +0 -0
  239. package/dist/output/traces/run-2026-01-20T19-22-58-043Z.ndjson +138 -0
  240. package/dist/output/traces/run-2026-01-20T19-23-52-175Z.ndjson +1067 -0
  241. package/dist/output-formatters.d.ts +1 -1
  242. package/dist/output-formatters.d.ts.map +1 -1
  243. package/dist/providers/ai-check-provider.d.ts +12 -0
  244. package/dist/providers/ai-check-provider.d.ts.map +1 -1
  245. package/dist/providers/check-provider-registry.d.ts +6 -0
  246. package/dist/providers/check-provider-registry.d.ts.map +1 -1
  247. package/dist/providers/check-provider.interface.d.ts +43 -1
  248. package/dist/providers/check-provider.interface.d.ts.map +1 -1
  249. package/dist/providers/claude-code-check-provider.d.ts.map +1 -1
  250. package/dist/providers/command-check-provider.d.ts +1 -1
  251. package/dist/providers/command-check-provider.d.ts.map +1 -1
  252. package/dist/providers/custom-tool-executor.d.ts +61 -0
  253. package/dist/providers/custom-tool-executor.d.ts.map +1 -0
  254. package/dist/providers/git-checkout-provider.d.ts +25 -0
  255. package/dist/providers/git-checkout-provider.d.ts.map +1 -0
  256. package/dist/providers/github-ops-provider.d.ts.map +1 -1
  257. package/dist/providers/http-client-provider.d.ts +4 -4
  258. package/dist/providers/http-client-provider.d.ts.map +1 -1
  259. package/dist/providers/human-input-check-provider.d.ts +5 -0
  260. package/dist/providers/human-input-check-provider.d.ts.map +1 -1
  261. package/dist/providers/index.d.ts +1 -0
  262. package/dist/providers/index.d.ts.map +1 -1
  263. package/dist/providers/log-check-provider.d.ts +2 -5
  264. package/dist/providers/log-check-provider.d.ts.map +1 -1
  265. package/dist/providers/mcp-check-provider.d.ts +10 -4
  266. package/dist/providers/mcp-check-provider.d.ts.map +1 -1
  267. package/dist/providers/mcp-custom-sse-server.d.ts +66 -0
  268. package/dist/providers/mcp-custom-sse-server.d.ts.map +1 -0
  269. package/dist/providers/memory-check-provider.d.ts +2 -8
  270. package/dist/providers/memory-check-provider.d.ts.map +1 -1
  271. package/dist/providers/script-check-provider.d.ts +25 -0
  272. package/dist/providers/script-check-provider.d.ts.map +1 -0
  273. package/dist/providers/workflow-check-provider.d.ts +56 -0
  274. package/dist/providers/workflow-check-provider.d.ts.map +1 -0
  275. package/dist/reviewer.d.ts +2 -1
  276. package/dist/reviewer.d.ts.map +1 -1
  277. package/dist/sdk/check-provider-registry-534KL5HT.mjs +27 -0
  278. package/dist/sdk/chunk-23L3QRYX.mjs +16872 -0
  279. package/dist/sdk/chunk-23L3QRYX.mjs.map +1 -0
  280. package/dist/sdk/{chunk-TUTOLSFV.mjs → chunk-3OMWVM6J.mjs} +11 -1
  281. package/dist/sdk/chunk-3OMWVM6J.mjs.map +1 -0
  282. package/dist/sdk/chunk-7UK3NIIT.mjs +482 -0
  283. package/dist/sdk/chunk-7UK3NIIT.mjs.map +1 -0
  284. package/dist/sdk/chunk-AGIZJ4UZ.mjs +173 -0
  285. package/dist/sdk/chunk-AGIZJ4UZ.mjs.map +1 -0
  286. package/dist/sdk/chunk-AIVFBIS4.mjs +1371 -0
  287. package/dist/sdk/chunk-AIVFBIS4.mjs.map +1 -0
  288. package/dist/sdk/chunk-AK6BVWIT.mjs +426 -0
  289. package/dist/sdk/chunk-AK6BVWIT.mjs.map +1 -0
  290. package/dist/sdk/chunk-AUT26LHW.mjs +139 -0
  291. package/dist/sdk/chunk-AUT26LHW.mjs.map +1 -0
  292. package/dist/sdk/chunk-BOVFH3LI.mjs +232 -0
  293. package/dist/sdk/chunk-BOVFH3LI.mjs.map +1 -0
  294. package/dist/sdk/chunk-CNX7V5JK.mjs +89 -0
  295. package/dist/sdk/chunk-CNX7V5JK.mjs.map +1 -0
  296. package/dist/sdk/chunk-HTOKWMPO.mjs +157 -0
  297. package/dist/sdk/chunk-HTOKWMPO.mjs.map +1 -0
  298. package/dist/sdk/chunk-NAW3DB3I.mjs +197 -0
  299. package/dist/sdk/chunk-NAW3DB3I.mjs.map +1 -0
  300. package/dist/sdk/chunk-O5EZDNYL.mjs +274 -0
  301. package/dist/sdk/chunk-O5EZDNYL.mjs.map +1 -0
  302. package/dist/sdk/chunk-QR7MOMJH.mjs +558 -0
  303. package/dist/sdk/chunk-QR7MOMJH.mjs.map +1 -0
  304. package/dist/sdk/chunk-QY2XYPEV.mjs +3556 -0
  305. package/dist/sdk/chunk-QY2XYPEV.mjs.map +1 -0
  306. package/dist/sdk/chunk-S2RUE2RG.mjs +145 -0
  307. package/dist/sdk/chunk-S2RUE2RG.mjs.map +1 -0
  308. package/dist/sdk/chunk-SIWNBRTK.mjs +800 -0
  309. package/dist/sdk/chunk-SIWNBRTK.mjs.map +1 -0
  310. package/dist/sdk/chunk-YSN4G6CI.mjs +146 -0
  311. package/dist/sdk/chunk-YSN4G6CI.mjs.map +1 -0
  312. package/dist/sdk/chunk-ZYAUYXSW.mjs +206 -0
  313. package/dist/sdk/chunk-ZYAUYXSW.mjs.map +1 -0
  314. package/dist/sdk/command-executor-TYUV6HUS.mjs +14 -0
  315. package/dist/sdk/config-YNC2EOOT.mjs +16 -0
  316. package/dist/sdk/config-merger-PX3WIT57.mjs +10 -0
  317. package/dist/sdk/event-bus-5BEVPQ6T.mjs +35 -0
  318. package/dist/sdk/event-bus-5BEVPQ6T.mjs.map +1 -0
  319. package/dist/sdk/failure-condition-evaluator-YGTF2GHG.mjs +17 -0
  320. package/dist/sdk/git-repository-analyzer-HJC4MYW4.mjs +458 -0
  321. package/dist/sdk/git-repository-analyzer-HJC4MYW4.mjs.map +1 -0
  322. package/dist/sdk/github-frontend-SIAEOCON.mjs +1420 -0
  323. package/dist/sdk/github-frontend-SIAEOCON.mjs.map +1 -0
  324. package/dist/sdk/host-DXUYTNMU.mjs +52 -0
  325. package/dist/sdk/host-DXUYTNMU.mjs.map +1 -0
  326. package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs → liquid-extensions-PKWCKK7E.mjs} +8 -2
  327. package/dist/sdk/memory-store-XGBB7LX7.mjs +12 -0
  328. package/dist/sdk/memory-store-XGBB7LX7.mjs.map +1 -0
  329. package/dist/sdk/metrics-7PP3EJUH.mjs +29 -0
  330. package/dist/sdk/metrics-7PP3EJUH.mjs.map +1 -0
  331. package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs +44 -0
  332. package/dist/sdk/ndjson-sink-B4V4NTAQ.mjs.map +1 -0
  333. package/dist/sdk/prompt-state-YRJY6QAL.mjs +16 -0
  334. package/dist/sdk/prompt-state-YRJY6QAL.mjs.map +1 -0
  335. package/dist/sdk/renderer-schema-LPKN5UJS.mjs +51 -0
  336. package/dist/sdk/renderer-schema-LPKN5UJS.mjs.map +1 -0
  337. package/dist/sdk/routing-6N45MJ4F.mjs +24 -0
  338. package/dist/sdk/routing-6N45MJ4F.mjs.map +1 -0
  339. package/dist/sdk/sdk.d.mts +541 -22
  340. package/dist/sdk/sdk.d.ts +541 -22
  341. package/dist/sdk/sdk.js +27963 -16505
  342. package/dist/sdk/sdk.js.map +1 -1
  343. package/dist/sdk/sdk.mjs +1116 -2169
  344. package/dist/sdk/sdk.mjs.map +1 -1
  345. package/dist/sdk/session-registry-4E6YRQ77.mjs +10 -0
  346. package/dist/sdk/session-registry-4E6YRQ77.mjs.map +1 -0
  347. package/dist/sdk/slack-frontend-BVKW3GD5.mjs +735 -0
  348. package/dist/sdk/slack-frontend-BVKW3GD5.mjs.map +1 -0
  349. package/dist/sdk/trace-helpers-VP6QYVBX.mjs +23 -0
  350. package/dist/sdk/trace-helpers-VP6QYVBX.mjs.map +1 -0
  351. package/dist/sdk/{tracer-init-WC75N5NW.mjs → tracer-init-GSLPPLCD.mjs} +2 -2
  352. package/dist/sdk/tracer-init-GSLPPLCD.mjs.map +1 -0
  353. package/dist/sdk/workflow-registry-R6KSACFR.mjs +12 -0
  354. package/dist/sdk/workflow-registry-R6KSACFR.mjs.map +1 -0
  355. package/dist/sdk.d.ts.map +1 -1
  356. package/dist/slack/adapter.d.ts +36 -0
  357. package/dist/slack/adapter.d.ts.map +1 -0
  358. package/dist/slack/cache-prewarmer.d.ts +31 -0
  359. package/dist/slack/cache-prewarmer.d.ts.map +1 -0
  360. package/dist/slack/client.d.ts +77 -0
  361. package/dist/slack/client.d.ts.map +1 -0
  362. package/dist/slack/markdown.d.ts +45 -0
  363. package/dist/slack/markdown.d.ts.map +1 -0
  364. package/dist/slack/prompt-state.d.ts +33 -0
  365. package/dist/slack/prompt-state.d.ts.map +1 -0
  366. package/dist/slack/rate-limiter.d.ts +56 -0
  367. package/dist/slack/rate-limiter.d.ts.map +1 -0
  368. package/dist/slack/signature.d.ts +2 -0
  369. package/dist/slack/signature.d.ts.map +1 -0
  370. package/dist/slack/socket-runner.d.ts +42 -0
  371. package/dist/slack/socket-runner.d.ts.map +1 -0
  372. package/dist/slack/thread-cache.d.ts +51 -0
  373. package/dist/slack/thread-cache.d.ts.map +1 -0
  374. package/dist/snapshot-store.d.ts +59 -0
  375. package/dist/snapshot-store.d.ts.map +1 -0
  376. package/dist/state-machine/context/build-engine-context.d.ts +17 -0
  377. package/dist/state-machine/context/build-engine-context.d.ts.map +1 -0
  378. package/dist/state-machine/dispatch/dependency-gating.d.ts +12 -0
  379. package/dist/state-machine/dispatch/dependency-gating.d.ts.map +1 -0
  380. package/dist/state-machine/dispatch/execution-invoker.d.ts +14 -0
  381. package/dist/state-machine/dispatch/execution-invoker.d.ts.map +1 -0
  382. package/dist/state-machine/dispatch/foreach-processor.d.ts +8 -0
  383. package/dist/state-machine/dispatch/foreach-processor.d.ts.map +1 -0
  384. package/dist/state-machine/dispatch/history-snapshot.d.ts +8 -0
  385. package/dist/state-machine/dispatch/history-snapshot.d.ts.map +1 -0
  386. package/dist/state-machine/dispatch/on-init-handlers.d.ts +43 -0
  387. package/dist/state-machine/dispatch/on-init-handlers.d.ts.map +1 -0
  388. package/dist/state-machine/dispatch/renderer-schema.d.ts +8 -0
  389. package/dist/state-machine/dispatch/renderer-schema.d.ts.map +1 -0
  390. package/dist/state-machine/dispatch/stats-manager.d.ts +15 -0
  391. package/dist/state-machine/dispatch/stats-manager.d.ts.map +1 -0
  392. package/dist/state-machine/dispatch/template-renderer.d.ts +7 -0
  393. package/dist/state-machine/dispatch/template-renderer.d.ts.map +1 -0
  394. package/dist/state-machine/execution/summary.d.ts +8 -0
  395. package/dist/state-machine/execution/summary.d.ts.map +1 -0
  396. package/dist/state-machine/runner.d.ts +79 -0
  397. package/dist/state-machine/runner.d.ts.map +1 -0
  398. package/dist/state-machine/states/check-running.d.ts +14 -0
  399. package/dist/state-machine/states/check-running.d.ts.map +1 -0
  400. package/dist/state-machine/states/completed.d.ts +12 -0
  401. package/dist/state-machine/states/completed.d.ts.map +1 -0
  402. package/dist/state-machine/states/error.d.ts +11 -0
  403. package/dist/state-machine/states/error.d.ts.map +1 -0
  404. package/dist/state-machine/states/init.d.ts +11 -0
  405. package/dist/state-machine/states/init.d.ts.map +1 -0
  406. package/dist/state-machine/states/level-dispatch.d.ts +17 -0
  407. package/dist/state-machine/states/level-dispatch.d.ts.map +1 -0
  408. package/dist/state-machine/states/plan-ready.d.ts +12 -0
  409. package/dist/state-machine/states/plan-ready.d.ts.map +1 -0
  410. package/dist/state-machine/states/routing.d.ts +52 -0
  411. package/dist/state-machine/states/routing.d.ts.map +1 -0
  412. package/dist/state-machine/states/wave-planning.d.ts +14 -0
  413. package/dist/state-machine/states/wave-planning.d.ts.map +1 -0
  414. package/dist/state-machine/workflow-projection.d.ts +47 -0
  415. package/dist/state-machine/workflow-projection.d.ts.map +1 -0
  416. package/dist/state-machine-execution-engine.d.ts +159 -0
  417. package/dist/state-machine-execution-engine.d.ts.map +1 -0
  418. package/dist/telemetry/opentelemetry.d.ts.map +1 -1
  419. package/dist/telemetry/state-capture.d.ts +5 -0
  420. package/dist/telemetry/state-capture.d.ts.map +1 -1
  421. package/dist/test-runner/assertions.d.ts +59 -0
  422. package/dist/test-runner/assertions.d.ts.map +1 -0
  423. package/dist/test-runner/core/environment.d.ts +8 -0
  424. package/dist/test-runner/core/environment.d.ts.map +1 -0
  425. package/dist/test-runner/core/fixture.d.ts +3 -0
  426. package/dist/test-runner/core/fixture.d.ts.map +1 -0
  427. package/dist/test-runner/core/flow-stage.d.ts +32 -0
  428. package/dist/test-runner/core/flow-stage.d.ts.map +1 -0
  429. package/dist/test-runner/core/mocks.d.ts +8 -0
  430. package/dist/test-runner/core/mocks.d.ts.map +1 -0
  431. package/dist/test-runner/core/test-execution-wrapper.d.ts +18 -0
  432. package/dist/test-runner/core/test-execution-wrapper.d.ts.map +1 -0
  433. package/dist/test-runner/evaluators.d.ts +45 -0
  434. package/dist/test-runner/evaluators.d.ts.map +1 -0
  435. package/dist/test-runner/fixture-loader.d.ts +30 -0
  436. package/dist/test-runner/fixture-loader.d.ts.map +1 -0
  437. package/dist/test-runner/index.d.ts +127 -0
  438. package/dist/test-runner/index.d.ts.map +1 -0
  439. package/dist/test-runner/recorders/github-recorder.d.ts +23 -0
  440. package/dist/test-runner/recorders/github-recorder.d.ts.map +1 -0
  441. package/dist/test-runner/recorders/global-recorder.d.ts +4 -0
  442. package/dist/test-runner/recorders/global-recorder.d.ts.map +1 -0
  443. package/dist/test-runner/recorders/slack-recorder.d.ts +17 -0
  444. package/dist/test-runner/recorders/slack-recorder.d.ts.map +1 -0
  445. package/dist/test-runner/utils/selectors.d.ts +2 -0
  446. package/dist/test-runner/utils/selectors.d.ts.map +1 -0
  447. package/dist/test-runner/validator.d.ts +8 -0
  448. package/dist/test-runner/validator.d.ts.map +1 -0
  449. package/dist/traces/run-2026-01-20T19-22-58-043Z.ndjson +138 -0
  450. package/dist/traces/run-2026-01-20T19-23-52-175Z.ndjson +1067 -0
  451. package/dist/types/bot.d.ts +109 -0
  452. package/dist/types/bot.d.ts.map +1 -0
  453. package/dist/types/cli.d.ts +8 -1
  454. package/dist/types/cli.d.ts.map +1 -1
  455. package/dist/types/config.d.ts +459 -9
  456. package/dist/types/config.d.ts.map +1 -1
  457. package/dist/types/engine.d.ts +177 -0
  458. package/dist/types/engine.d.ts.map +1 -0
  459. package/dist/types/execution.d.ts +73 -0
  460. package/dist/types/execution.d.ts.map +1 -0
  461. package/dist/types/git-checkout.d.ts +76 -0
  462. package/dist/types/git-checkout.d.ts.map +1 -0
  463. package/dist/types/github.d.ts +51 -0
  464. package/dist/types/github.d.ts.map +1 -0
  465. package/dist/types/workflow.d.ts +237 -0
  466. package/dist/types/workflow.d.ts.map +1 -0
  467. package/dist/utils/command-executor.d.ts +43 -0
  468. package/dist/utils/command-executor.d.ts.map +1 -0
  469. package/dist/utils/comment-metadata.d.ts +21 -0
  470. package/dist/utils/comment-metadata.d.ts.map +1 -0
  471. package/dist/utils/config-loader.d.ts.map +1 -1
  472. package/dist/utils/config-merger.d.ts.map +1 -1
  473. package/dist/utils/env-exposure.d.ts +3 -0
  474. package/dist/utils/env-exposure.d.ts.map +1 -0
  475. package/dist/utils/file-exclusion.d.ts.map +1 -1
  476. package/dist/utils/interactive-prompt.d.ts +1 -1
  477. package/dist/utils/interactive-prompt.d.ts.map +1 -1
  478. package/dist/utils/json-text-extractor.d.ts +17 -0
  479. package/dist/utils/json-text-extractor.d.ts.map +1 -0
  480. package/dist/utils/sandbox.d.ts +10 -0
  481. package/dist/utils/sandbox.d.ts.map +1 -1
  482. package/dist/utils/script-memory-ops.d.ts +21 -0
  483. package/dist/utils/script-memory-ops.d.ts.map +1 -0
  484. package/dist/utils/template-context.d.ts +8 -0
  485. package/dist/utils/template-context.d.ts.map +1 -0
  486. package/dist/utils/tracer-init.d.ts.map +1 -1
  487. package/dist/utils/workspace-manager.d.ts +118 -0
  488. package/dist/utils/workspace-manager.d.ts.map +1 -0
  489. package/dist/utils/worktree-cleanup.d.ts +33 -0
  490. package/dist/utils/worktree-cleanup.d.ts.map +1 -0
  491. package/dist/utils/worktree-manager.d.ts +153 -0
  492. package/dist/utils/worktree-manager.d.ts.map +1 -0
  493. package/dist/webhook-server.d.ts +3 -3
  494. package/dist/webhook-server.d.ts.map +1 -1
  495. package/dist/workflow-executor.d.ts +81 -0
  496. package/dist/workflow-executor.d.ts.map +1 -0
  497. package/dist/workflow-registry.d.ts +79 -0
  498. package/dist/workflow-registry.d.ts.map +1 -0
  499. package/package.json +12 -5
  500. package/dist/output/traces/run-2025-10-22T18-22-56-873Z.ndjson +0 -218
  501. package/dist/sdk/check-execution-engine-2YYKUUSH.mjs +0 -11
  502. package/dist/sdk/check-execution-engine-6QJXYYON.mjs +0 -11
  503. package/dist/sdk/check-execution-engine-PJZ4ZOKG.mjs +0 -11
  504. package/dist/sdk/chunk-33QVZ2D4.mjs +0 -316
  505. package/dist/sdk/chunk-33QVZ2D4.mjs.map +0 -1
  506. package/dist/sdk/chunk-B5QBV2QJ.mjs +0 -752
  507. package/dist/sdk/chunk-B5QBV2QJ.mjs.map +0 -1
  508. package/dist/sdk/chunk-BVFNRCHT.mjs +0 -14129
  509. package/dist/sdk/chunk-BVFNRCHT.mjs.map +0 -1
  510. package/dist/sdk/chunk-KWZW23FG.mjs +0 -14129
  511. package/dist/sdk/chunk-KWZW23FG.mjs.map +0 -1
  512. package/dist/sdk/chunk-O4RP4BRH.mjs +0 -14092
  513. package/dist/sdk/chunk-O4RP4BRH.mjs.map +0 -1
  514. package/dist/sdk/chunk-TUTOLSFV.mjs.map +0 -1
  515. package/dist/sdk/chunk-U5D2LY66.mjs +0 -245
  516. package/dist/sdk/chunk-U5D2LY66.mjs.map +0 -1
  517. package/dist/sdk/chunk-U7X54EMV.mjs +0 -331
  518. package/dist/sdk/chunk-U7X54EMV.mjs.map +0 -1
  519. package/dist/sdk/config-merger-TWUBWFC2.mjs +0 -8
  520. package/dist/sdk/mermaid-telemetry-SN6A2TKW.mjs +0 -61
  521. package/dist/sdk/mermaid-telemetry-SN6A2TKW.mjs.map +0 -1
  522. package/dist/sdk/mermaid-telemetry-YCTIG76M.mjs +0 -61
  523. package/dist/sdk/mermaid-telemetry-YCTIG76M.mjs.map +0 -1
  524. package/dist/traces/run-2025-10-22T18-22-56-873Z.ndjson +0 -218
  525. /package/dist/sdk/{check-execution-engine-2YYKUUSH.mjs.map → check-provider-registry-534KL5HT.mjs.map} +0 -0
  526. /package/dist/sdk/{check-execution-engine-6QJXYYON.mjs.map → command-executor-TYUV6HUS.mjs.map} +0 -0
  527. /package/dist/sdk/{check-execution-engine-PJZ4ZOKG.mjs.map → config-YNC2EOOT.mjs.map} +0 -0
  528. /package/dist/sdk/{config-merger-TWUBWFC2.mjs.map → config-merger-PX3WIT57.mjs.map} +0 -0
  529. /package/dist/sdk/{liquid-extensions-KVL4MKRH.mjs.map → failure-condition-evaluator-YGTF2GHG.mjs.map} +0 -0
  530. /package/dist/sdk/{tracer-init-WC75N5NW.mjs.map → liquid-extensions-PKWCKK7E.mjs.map} +0 -0
@@ -0,0 +1,92 @@
1
+ # Flow Tests
2
+
3
+ > Model realistic user journeys across multiple external events in one case.
4
+
5
+ A flow case defines a `flow:` array of stages. Each stage has its own `event`, `fixture`, optional `env` and `mocks`, plus `expect`.
6
+
7
+ ```yaml
8
+ - name: pr-review-e2e-flow
9
+ strict: true
10
+ flow:
11
+ - name: pr-open
12
+ event: pr_opened
13
+ fixture: gh.pr_open.minimal
14
+ mocks: { overview: { text: "Overview body", tags: { label: feature, review-effort: 2 } } }
15
+ expect:
16
+ calls:
17
+ - step: overview
18
+ exactly: 1
19
+ - step: apply-overview-labels
20
+ exactly: 1
21
+
22
+ - name: visor-retrigger
23
+ event: issue_comment
24
+ fixture: gh.issue_comment.visor_regenerate
25
+ mocks:
26
+ comment-assistant: { text: "Regenerating.", intent: comment_retrigger }
27
+ overview: { text: "Overview (regenerated)", tags: { label: feature, review-effort: 2 } }
28
+ expect:
29
+ calls:
30
+ - step: comment-assistant
31
+ exactly: 1
32
+ - step: overview
33
+ exactly: 1
34
+ ```
35
+
36
+ ## Stage selection and deltas
37
+
38
+ - Run a single stage: `--only case#stage` (name substring) or `--only case#N` (1‑based index).
39
+ - Coverage, prompts, outputs, and provider calls are computed per‑stage as deltas from the previous stage.
40
+ - The same engine instance is reused across stages, so memory and output history carry over.
41
+
42
+ ## Ordering and `on_finish`
43
+
44
+ - Flow execution honors dependencies and `on_success`/`on_fail` routing.
45
+ - For forEach parents with `on_finish.run`, the runner defers static targets from the initial set so they execute after per-item processing.
46
+ - Dynamic `on_finish.run_js` is executed and counted like regular steps.
47
+
48
+ ## Strict mode across stages
49
+
50
+ - If any step executes in a stage and lacks a corresponding `expect.calls` entry for that stage, the stage fails under strict mode.
51
+ - Use `no_calls` to assert absence (e.g., a standard comment should not trigger a reply or fact validation).
52
+
53
+ ## Example: Fact Validation Loop (pattern)
54
+
55
+ Note: This is not a built‑in feature, just a concrete example of how to model a multi‑step workflow with your own step names.
56
+
57
+ - Per-item validation (example): a step named `validate-fact` depends on `extract-facts` (which outputs an array) and runs once per item.
58
+ - Aggregation (example): a step named `aggregate-validations` (type: `memory`) summarizes the latest validation wave and, when not all facts are valid, schedules a correction comment via `on_finish.run_js`.
59
+ - In tests: provide array mocks for `extract-facts` and per‑call list mocks for `validate-fact[]`. Assert that only invalid facts appear in the correction prompt using `prompts.contains`/`not_contains`.
60
+
61
+ Inline example:
62
+
63
+ ```yaml
64
+ flow:
65
+ - name: facts-invalid
66
+ event: issue_comment
67
+ fixture: gh.issue_comment.visor_help
68
+ env: { ENABLE_FACT_VALIDATION: "true" }
69
+ mocks:
70
+ extract-facts:
71
+ - { id: f1, claim: "max_parallelism defaults to 4" }
72
+ validate-fact[]:
73
+ - { fact_id: f1, is_valid: false, correction: "max_parallelism defaults to 3" }
74
+ expect:
75
+ calls:
76
+ - step: validate-fact
77
+ exactly: 1
78
+ prompts:
79
+ - step: comment-assistant
80
+ index: last
81
+ contains: ["<previous_response>", "Correction:"]
82
+ ```
83
+
84
+ ## Stage-local mocks and env
85
+
86
+ - Stage mocks override flow-level defaults: the runner merges `{...flow.mocks, ...stage.mocks}`.
87
+ - `env:` applies only for the stage and is restored afterward.
88
+
89
+ ## Debugging flows
90
+
91
+ - Set `VISOR_DEBUG=true` to print stage headers, selected checks, and internal debug lines from the engine.
92
+ - To reduce noise, limit the run to a stage: `VISOR_DEBUG=true visor test --only pr-review-e2e-flow#facts-invalid`.
@@ -0,0 +1,93 @@
1
+ # Visor Tests — Getting Started
2
+
3
+ This is the developer-facing guide for writing and running integration tests for your Visor config. It focuses on minimal setup, helpful errors, and clear output.
4
+
5
+ ## TL;DR
6
+
7
+ - Put your tests in `defaults/.visor.tests.yaml`.
8
+ - Reference your base config with `extends: ".visor.yaml"`.
9
+ - Use built-in GitHub fixtures like `gh.pr_open.minimal`.
10
+ - Run with `visor test --config defaults/.visor.tests.yaml`.
11
+ - Validate only with `visor test --validate`.
12
+
13
+ ```yaml
14
+ version: "1.0"
15
+ extends: ".visor.yaml"
16
+
17
+ tests:
18
+ defaults:
19
+ strict: true # every executed step must be asserted
20
+ ai_provider: mock # offline by default
21
+ cases:
22
+ - name: label-flow
23
+ event: pr_opened
24
+ fixture: gh.pr_open.minimal
25
+ mocks:
26
+ overview:
27
+ text: "Overview body"
28
+ tags: { label: feature, review-effort: 2 }
29
+ expect:
30
+ calls:
31
+ - step: overview
32
+ exactly: 1
33
+ - step: apply-overview-labels
34
+ exactly: 1
35
+ - provider: github
36
+ op: labels.add
37
+ at_least: 1
38
+ args: { contains: [feature] }
39
+ ```
40
+
41
+ ## Why integration tests in YAML?
42
+
43
+ - You test the same thing you ship: events → checks → outputs → effects.
44
+ - No network required; GitHub calls are recorded, AI is mocked.
45
+ - Flows let you simulate real user journeys across multiple events.
46
+
47
+ ## Strict by default
48
+
49
+ If a step runs and you didn’t assert it under `expect.calls`, the case fails. This prevents silent regressions and “accidental” work.
50
+
51
+ Turn off per-case via `strict: false` if you need to iterate.
52
+
53
+ ## CLI recipes
54
+
55
+ - List cases: `visor test --list`
56
+ - Run a subset: `visor test --only pr-review`
57
+ - Stop on first failure: `--bail`
58
+ - Validate tests file only: `--validate`
59
+ - Parallelize cases: `--max-parallel 4`
60
+ - Throttle prompt capture: `--prompt-max-chars 16000`
61
+
62
+ ## Coverage output
63
+
64
+ After each case/stage, a compact table shows expected vs actual step calls:
65
+
66
+ ```
67
+ Coverage (label-flow):
68
+ • overview want =1 got 1 ok
69
+ • apply-overview-labels want =1 got 1 ok
70
+ ```
71
+
72
+ Unexpected executed steps are listed under `unexpected:` to help you add missing assertions quickly.
73
+
74
+ ## Helpful validation errors
75
+
76
+ Run `visor test --validate` to get precise YAML-path errors and suggestions:
77
+
78
+ ```
79
+ ❌ Tests file has 2 error(s):
80
+ • tests.cases[0].expext: must NOT have additional properties (Did you mean "expect"?)
81
+ • tests.cases[3].event: must be equal to one of the allowed values (allowed: manual, pr_opened, pr_updated, pr_closed, issue_opened, issue_comment)
82
+ ```
83
+
84
+ Next steps:
85
+ - Core reference: `docs/testing/dsl-reference.md`
86
+ - Flows: `docs/testing/flows.md`
87
+ - Mocks & fixtures: `docs/testing/fixtures-and-mocks.md`
88
+ - Assertions: `docs/testing/assertions.md`
89
+ - Cookbook: `docs/testing/cookbook.md`
90
+ - CLI & reporters: `docs/testing/cli.md`
91
+ - CI integration: `docs/testing/ci.md`
92
+ - Troubleshooting: `docs/testing/troubleshooting.md`
93
+ - Browse `defaults/.visor.tests.yaml` for full examples.
@@ -0,0 +1,55 @@
1
+ # Test Runner Troubleshooting
2
+
3
+ Common issues and how to fix them quickly.
4
+
5
+ ## “Unmocked AI step executed” warnings
6
+
7
+ - The runner forces `ai_provider=mock` by default, but if a step overrides the provider to a real one, it can execute with keys from your env.
8
+ - Add a mock under `mocks:` for that step to silence the warning, or keep `ai_provider: mock` and avoid overriding providers in tests.
9
+
10
+ ## “No captured prompt for step … at index …”
11
+
12
+ - The step may not have executed in that stage (strict mode would also flag it).
13
+ - Your `index` might be out of bounds (e.g., `last` when there are no prompts). Drop the `index` or use `where` to select by content.
14
+ - Ensure the step is an AI provider (prompts are only captured for AI steps).
15
+
16
+ ## GitHub op not recorded (e.g., `labels.add`)
17
+
18
+ - Check that your AI mock provides the fields your provider expects to do the op (e.g., `overview.tags.label`).
19
+ - Use `VISOR_DEBUG=true` to print provider debug. Confirm the step ran and the recorder printed the intended op.
20
+
21
+ ## Strict mode failure (“Step executed without expect”)
22
+
23
+ - Add the missing step to `expect.calls` with a count. If the step should not run, add it to `expect.no_calls` and fix your config to avoid running it.
24
+ - Temporarily set `strict: false` at the case or stage level to iterate quickly (not recommended long term).
25
+
26
+ ## Fact validation behaves unexpectedly
27
+
28
+ - Provide array mocks for `extract-facts` and per‑call list mocks for `validate-fact[]`.
29
+ - Remember that aggregation uses the latest validation wave (size inferred from the last `extract-facts` output).
30
+
31
+ ## Prompts are huge or contain entire diffs
32
+
33
+ - Use `--prompt-max-chars` (or `tests.defaults.prompt_max_chars`) to truncate captured text for assertions.
34
+ - In config, you can keep AI focused with `skip_code_context` if available, or provide narrower mocks in tests.
35
+
36
+ ## How do I see more logs?
37
+
38
+ - Set `VISOR_DEBUG=true`.
39
+ - To isolate the problem, run a single stage: `visor test --only case#stage`.
40
+
41
+ ## Pause at “on_finish: no result found … — skip”
42
+
43
+ Symptom: a short pause appears before the runner prints the coverage table, often preceded by a line like:
44
+
45
+ ```
46
+ ⏭ on_finish: no result found for "extract-facts" — skip
47
+ ```
48
+
49
+ What it was: the engine always entered the `on_finish` scan, even when none of the forEach parents had produced any results in the current run. Internally it waited for a (now redundant) scan window to complete.
50
+
51
+ What we changed: we added an early return in `handleOnFinishHooks` when there are zero forEach parents with results in the current grouped run. This preserves behavior (no hooks to run) and removes the delay entirely.
52
+
53
+ Downsides: none functionally. The only trade‑off is that debug visibility is slightly reduced in that specific “no parents ran” case; enable `VISOR_DEBUG=true` if you need to trace the discovery step regardless.
54
+
55
+ Guarantee: if a check executed and defines `on_finish`, `on_finish` still executes for that check once its forEach finishes. The early return only triggers when no eligible parent produced results in the run.
@@ -0,0 +1,50 @@
1
+ # Timeouts: configuration and behavior
2
+
3
+ Checks can specify a per‑check timeout. When a timeout is reached, the provider is aborted and the engine records a timeout error and skips direct dependents.
4
+
5
+ ## Configuration
6
+
7
+ ```yaml
8
+ steps:
9
+ fetch-tickets:
10
+ type: command
11
+ timeout: 300 # seconds (command)
12
+ exec: node scripts/jira/batch-fetch.js "$JQL" --limit $LIMIT
13
+ ```
14
+
15
+ Provider units and defaults:
16
+
17
+ - `command`:
18
+ - Units: seconds.
19
+ - Default: 60s if not specified.
20
+ - Effect on timeout: issue `command/timeout` with message “Command execution timed out after <N> seconds”. Direct dependents are skipped.
21
+ - `http_client`:
22
+ - Units: milliseconds.
23
+ - Default: provider default (see provider docs/test for specifics).
24
+ - `ai`:
25
+ - Use `ai.timeout` (milliseconds). CLI `--timeout` also maps to AI timeout.
26
+
27
+ The engine propagates the per‑check timeout into providers in dependency‑aware execution so behavior is consistent even in multi‑check workflows.
28
+
29
+ ## Examples
30
+
31
+ ```yaml
32
+ steps:
33
+ fetch:
34
+ type: command
35
+ timeout: 120
36
+ exec: curl -s https://example.com/data
37
+
38
+ process:
39
+ type: command
40
+ depends_on: [fetch]
41
+ exec: echo "{{ outputs.fetch }}" | jq '.items | length'
42
+ ```
43
+
44
+ If `fetch` exceeds 120s, `process` is skipped with reason `dependency_failed`.
45
+
46
+ ## Notes
47
+
48
+ - Be mindful of units when switching providers (seconds vs milliseconds).
49
+ - Consider adding `fail_if` conditions for additional guarding (e.g., `fail_if: !output || length(output.items) === 0`).
50
+
@@ -0,0 +1,7 @@
1
+ ## 🛠️ Troubleshooting
2
+
3
+ - Increase logging with `--debug` or action `debug: true`.
4
+ - Validate config locally: `npx -y @probelabs/visor@latest --check all`.
5
+ - Ensure required permissions in Actions: contents/read, pull-requests/write, issues/write, checks/write.
6
+ - If annotations don’t appear, confirm schema is `code-review` and issues have file/line.
7
+ - For remote extends, set `--allowed-remote-patterns` or disable via `--no-remote-extends`.
@@ -0,0 +1,186 @@
1
+ # Visor SDK for Node.js (ESM/CJS) — RFC
2
+
3
+ Status: Draft
4
+ Owner: Probe Labs
5
+ Last updated: 2025-10-03
6
+
7
+ ## 1) Motivation
8
+
9
+ Visor is currently distributed primarily as a CLI and GitHub Action. Users increasingly want to:
10
+ - Call Visor programmatically from build scripts, test runners, or IDE extensions.
11
+ - Orchestrate checks dynamically (e.g., select checks at runtime, react to results, implement custom routing).
12
+ - Integrate Visor output into custom dashboards and CI pipelines without shelling out.
13
+
14
+ Delivering a first‑class SDK with proper TypeScript types and dual ESM/CJS builds unlocks these scenarios while keeping the CLI intact.
15
+
16
+ ### Principles (very thin shim)
17
+ - SDK is a façade over the existing Visor engine. No new execution logic.
18
+ - No bespoke sandboxing, schedulers, or provider behavior in the SDK.
19
+ - The SDK only wires inputs/outputs, surfaces types/events, and forwards options to the core.
20
+ - All safety and behavior live in the core engine; SDK remains lightweight and stable.
21
+
22
+ ## 2) Goals (MVP)
23
+ - Dual module support: native ESM and CommonJS with a single npm package `@probelabs/visor`.
24
+ - First‑class TypeScript: bundled `.d.ts` with JSDoc, no `any` in public API.
25
+ - Stable public surface for: loading config, resolving checks, executing checks, streaming events, and collecting results.
26
+ - Programmatic access to routing (on_fail/on_success) including retry/backoff and ancestor‑only `goto`.
27
+ - Reasonable defaults that mirror CLI behavior; no breaking changes to CLI or Action.
28
+ - Small, tree‑shakable entry for SDK; CLI remains bundled separately.
29
+
30
+ ### Non‑Goals (for MVP)
31
+ - Browser/runtime‑agnostic build. Node 18+ only for MVP.
32
+ - Public provider/engine SPI for third‑party engines (possible in a later phase).
33
+
34
+ ## 3) Public API (proposed)
35
+ Top‑level entry: `@probelabs/visor/sdk` (via package `exports`).
36
+
37
+ ```ts
38
+ // ESM
39
+ import {
40
+ createVisor,
41
+ runChecks,
42
+ loadConfig,
43
+ resolveChecks,
44
+ type Visor,
45
+ type VisorOptions,
46
+ type RunOptions,
47
+ type RunSummary,
48
+ type VisorConfig,
49
+ type CheckResult,
50
+ type Issue,
51
+ type RoutingTrace,
52
+ } from '@probelabs/visor/sdk';
53
+
54
+ // CJS
55
+ const {
56
+ createVisor,
57
+ runChecks,
58
+ loadConfig,
59
+ resolveChecks,
60
+ } = require('@probelabs/visor/sdk');
61
+ ```
62
+
63
+ ### 3.1 Core types
64
+ - `VisorOptions`
65
+ - `cwd?: string`
66
+ - `logger?: LoggerLike` (info/debug/warn/error)
67
+ - `ai?: { provider?: ProviderId; model?: string }`
68
+ - `parallelism?: number`
69
+ - `env?: NodeJS.ProcessEnv`
70
+ - `RunOptions`
71
+ - `config: VisorConfig` or `configPath: string`
72
+ - `checks?: string[]` (IDs or `['all']`)
73
+ - `tags?: { include?: string[]; exclude?: string[] }`
74
+ - `inputs?: Record<string, unknown>` (templating context)
75
+ - `output?: { format?: 'table'|'markdown'|'json'|'sarif'; groupBy?: 'check'|'file' }`
76
+ - `RunSummary`
77
+ - `checks: CheckResult[]`
78
+ - `issues: Issue[]` (all aggregated)
79
+ - `stats: { durationMs: number; successCount: number; failureCount: number }`
80
+ - `routing?: RoutingTrace[]`
81
+
82
+ Public types will be exported from `src/types/*` and surfaced by the SDK bundle (`.d.ts`).
83
+
84
+ ### 3.2 Instances and helpers
85
+ - `createVisor(opts?: VisorOptions): Visor`
86
+ - Returns an instance exposing:
87
+ - `events`: `EventEmitter` (typed)
88
+ - `check:start`, `check:success`, `check:fail`
89
+ - `routing:action` (run/goto/retry), `routing:loop`
90
+ - `log` (debug/info/warn/error)
91
+ - `done`
92
+ - `run(opts: RunOptions): Promise<RunSummary>`
93
+ - `stream(opts: RunOptions): AsyncIterable<VisorEvent>` (optional sugar)
94
+ - `loadConfig(path: string): Promise<VisorConfig>`
95
+ - `resolveChecks(checkIds: string[], config: VisorConfig): string[]` (dependency expansion)
96
+ - `runChecks(runOpts: RunOptions & { visor?: VisorOptions }): Promise<RunSummary>` (one‑shot convenience)
97
+
98
+ ### 3.3 Routing access in SDK
99
+ - The SDK honors `on_fail`/`on_success` from the provided config.
100
+ - `RunSummary.routing` returns a concise, machine‑readable trace of routing actions (retry, goto, run_js, goto_js) including loop counters and decision metadata.
101
+ - Per‑check attempt counters exposed in trace; forEach items are isolated.
102
+
103
+ ## 4) Packaging & Build
104
+ - Keep CLI bundle via `@vercel/ncc` at `dist/index.js` for `bin` and GitHub Action.
105
+ - Add SDK build via `tsup` (preferred) or Rollup:
106
+ - Inputs: `src/sdk.ts`
107
+ - Outputs: `dist/sdk/index.mjs` (ESM), `dist/sdk/index.cjs` (CJS), `dist/sdk/index.d.ts` (types)
108
+ - `sideEffects: false` for tree‑shaking
109
+ - Target: Node `>=18`
110
+ - Sourcemaps enabled
111
+ - `package.json` changes (illustrative):
112
+ - `exports`:
113
+ ```json
114
+ {
115
+ ".": {
116
+ "import": "./dist/sdk/index.mjs",
117
+ "require": "./dist/sdk/index.cjs",
118
+ "types": "./dist/sdk/index.d.ts"
119
+ },
120
+ "./sdk": {
121
+ "import": "./dist/sdk/index.mjs",
122
+ "require": "./dist/sdk/index.cjs",
123
+ "types": "./dist/sdk/index.d.ts"
124
+ },
125
+ "./cli": {
126
+ "require": "./dist/index.js"
127
+ }
128
+ }
129
+ ```
130
+ - `types`: `./dist/sdk/index.d.ts`
131
+ - `files`: include `dist/` (SDK + CLI) and `defaults/`
132
+ - Scripts:
133
+ - `build:cli` (unchanged `ncc`)
134
+ - `build:sdk` (tsup for dual build + d.ts)
135
+ - `build` runs both
136
+
137
+ ## 5) Types & Stability
138
+ - All exported types live in `src/types/` and are re‑exported from `src/sdk.ts`.
139
+ - No `any` in public API; use discriminated unions for events and results.
140
+ - Introduce `VisorError` with stable `code` (e.g., `CONFIG_NOT_FOUND`, `ROUTING_MAX_LOOPS_EXCEEDED`, `CHECK_FAILED`).
141
+ - Semver policy: public types are part of the contract; breaking changes require a major bump.
142
+
143
+ ## 6) JS Sandbox Safety (run_js/goto_js)
144
+ Out of scope for the SDK. The SDK does not introduce or maintain any sandbox. Safety is enforced by the core engine. The SDK will:
145
+ - Pass through any routing/sandbox options to the core.
146
+ - Surface resulting events and traces unchanged.
147
+
148
+ If/when the core provides stricter sandbox controls (e.g., worker‑thread limits), the SDK will forward those knobs without adding behavior.
149
+
150
+ ## 7) Examples (to add alongside implementation)
151
+ - `examples/sdk-basic.mjs` — load config, run checks, print table/markdown.
152
+ - `examples/sdk-cjs.cjs` — CommonJS require + run.
153
+ - `examples/sdk-types.ts` — TypeScript usage with typed events.
154
+ - `examples/sdk-routing.ts` — demonstrates routing events and traces.
155
+
156
+ ## 8) Testing & CI
157
+ - Unit: type tests for public API (tsd or TypeScript compile fixtures).
158
+ - Integration:
159
+ - ESM import works on Node 18+.
160
+ - CJS require works on Node 18+.
161
+ - Event stream delivers expected sequence for simple config.
162
+ - Routing trace emitted for retry/goto; loop caps enforced deterministically.
163
+ - Workflows:
164
+ - Add a matrix job `sdk-consume` to compile and run the three examples with `npm ci`.
165
+
166
+ ## 9) Migration & Backwards Compatibility
167
+ - CLI remains at `dist/index.js` with existing `bin` and Action behavior.
168
+ - No changes required for current users. New consumers import `@probelabs/visor/sdk`.
169
+ - README will gain an “SDK Usage” section after implementation; `docs/NPM_USAGE.md` will link to it.
170
+
171
+ ## 10) Phased Plan
172
+ 1. RFC sign‑off (this doc).
173
+ 2. Create `src/sdk.ts` façade and re‑export stable types; wire through existing engine (`CheckExecutionEngine`).
174
+ 3. Add `tsup` and dual build; update `package.json` exports; keep `ncc` for CLI.
175
+ 4. (Core) Harden JS sandbox in engine as a separate track; SDK simply forwards options.
176
+ 5. Write examples and tests; add CI matrix for ESM/CJS/TS.
177
+ 6. Docs: README section and `docs/sdk.md` (guide). Release minor version.
178
+
179
+ ## 11) Open Questions
180
+ - Do we want a browser/WebWorker build later? If yes, we’ll need to abstract fs/git and remove Node‑only deps from the core.
181
+ - Should SDK expose a plugin registration API now (providers/check types), or defer until a stable SPI is designed?
182
+ - Should `run()` also return an async iterator for live consumption, or keep `.events` as the primary streaming method?
183
+
184
+ ---
185
+
186
+ If accepted, implementation will proceed under branch `feat/sdk` with a draft PR for incremental review.