@probelabs/visor 0.1.124 → 0.1.126

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 (195) hide show
  1. package/dist/config.d.ts.map +1 -1
  2. package/dist/docs/DEPLOYMENT.md +117 -11
  3. package/dist/docs/GITHUB_CHECKS.md +18 -4
  4. package/dist/docs/NPM_USAGE.md +112 -39
  5. package/dist/docs/action-reference.md +63 -9
  6. package/dist/docs/advanced-ai.md +58 -51
  7. package/dist/docs/ai-configuration.md +99 -11
  8. package/dist/docs/ai-custom-tools-usage.md +70 -33
  9. package/dist/docs/ai-custom-tools.md +50 -27
  10. package/dist/docs/architecture.md +1232 -0
  11. package/dist/docs/bot-transports-rfc.md +13 -3
  12. package/dist/docs/ci-cli-mode.md +116 -8
  13. package/dist/docs/claude-code.md +111 -41
  14. package/dist/docs/command-provider.md +37 -15
  15. package/dist/docs/commands.md +252 -6
  16. package/dist/docs/configuration.md +138 -4
  17. package/dist/docs/contributing.md +737 -0
  18. package/dist/docs/custom-tools.md +39 -8
  19. package/dist/docs/dashboards/README.md +33 -19
  20. package/dist/docs/debug-visualizer-progress.md +14 -13
  21. package/dist/docs/debug-visualizer-rfc.md +14 -13
  22. package/dist/docs/debug-visualizer.md +30 -5
  23. package/dist/docs/debugging.md +73 -8
  24. package/dist/docs/default-output-schema.md +24 -20
  25. package/dist/docs/dependencies.md +75 -21
  26. package/dist/docs/dev-playbook.md +85 -9
  27. package/dist/docs/engine-pause-resume-rfc.md +11 -11
  28. package/dist/docs/engine-state-machine-plan.md +10 -3
  29. package/dist/docs/event-driven-github-integration-rfc.md +20 -11
  30. package/dist/docs/event-triggers.md +95 -6
  31. package/dist/docs/execution-statistics-rfc.md +16 -4
  32. package/dist/docs/fact-validator-gap-analysis.md +12 -1
  33. package/dist/docs/fact-validator-implementation-plan.md +19 -11
  34. package/dist/docs/fail-if.md +116 -11
  35. package/dist/docs/failure-conditions-implementation.md +40 -6
  36. package/dist/docs/failure-conditions-schema.md +243 -87
  37. package/dist/docs/failure-routing-rfc.md +43 -18
  38. package/dist/docs/failure-routing.md +80 -23
  39. package/dist/docs/faq.md +836 -0
  40. package/dist/docs/foreach-dependency-propagation.md +32 -15
  41. package/dist/docs/github-ops.md +6 -5
  42. package/dist/docs/glossary.md +322 -0
  43. package/dist/docs/goto-forward-run-plan.md +23 -10
  44. package/dist/docs/guides/criticality-modes.md +15 -13
  45. package/dist/docs/guides/fault-management-and-contracts.md +8 -5
  46. package/dist/docs/guides/workflow-style-guide.md +17 -8
  47. package/dist/docs/http.md +102 -3
  48. package/dist/docs/human-input-provider.md +20 -36
  49. package/dist/docs/index.md +206 -0
  50. package/dist/docs/lifecycle-hooks.md +322 -2
  51. package/dist/docs/limits.md +20 -5
  52. package/dist/docs/liquid-templates.md +86 -14
  53. package/dist/docs/loop-routing-refactor.md +4 -2
  54. package/dist/docs/mcp-provider.md +53 -19
  55. package/dist/docs/mcp.md +27 -1
  56. package/dist/docs/memory.md +7 -2
  57. package/dist/docs/migration.md +596 -0
  58. package/dist/docs/observability.md +227 -6
  59. package/dist/docs/output-formats.md +388 -9
  60. package/dist/docs/output-history.md +36 -6
  61. package/dist/docs/performance.md +510 -4
  62. package/dist/docs/pluggable.md +95 -4
  63. package/dist/docs/proposals/snapshot-scope-execution.md +6 -5
  64. package/dist/docs/providers/git-checkout.md +16 -14
  65. package/dist/docs/providers/noop.md +696 -0
  66. package/dist/docs/recipes.md +8 -9
  67. package/dist/docs/rfc/git-checkout-step.md +3 -1
  68. package/dist/docs/rfc/on_init-hook.md +18 -5
  69. package/dist/docs/rfc/workspace-isolation.md +16 -0
  70. package/dist/docs/roadmap/criticality-implementation-tasks.md +27 -27
  71. package/dist/docs/router-patterns.md +155 -43
  72. package/dist/docs/schema-templates.md +51 -15
  73. package/dist/docs/script.md +162 -13
  74. package/dist/docs/sdk.md +46 -12
  75. package/dist/docs/security.md +464 -5
  76. package/dist/docs/slack-integration.md +481 -0
  77. package/dist/docs/tag-filtering.md +60 -20
  78. package/dist/docs/telemetry-setup.md +157 -46
  79. package/dist/docs/test-framework-rfc.md +37 -36
  80. package/dist/docs/testing/assertions.md +92 -4
  81. package/dist/docs/testing/ci.md +56 -7
  82. package/dist/docs/testing/cli.md +57 -15
  83. package/dist/docs/testing/cookbook.md +53 -20
  84. package/dist/docs/testing/dsl-reference.md +110 -9
  85. package/dist/docs/testing/fixtures-and-mocks.md +28 -3
  86. package/dist/docs/testing/flows.md +59 -4
  87. package/dist/docs/testing/getting-started.md +14 -13
  88. package/dist/docs/testing/troubleshooting.md +39 -2
  89. package/dist/docs/timeouts.md +174 -18
  90. package/dist/docs/troubleshooting.md +176 -6
  91. package/dist/docs/workflow-creation-guide.md +101 -3
  92. package/dist/docs/workflows.md +138 -41
  93. package/dist/examples/README.md +169 -4
  94. package/dist/examples/ai-custom-tools-simple.yaml +2 -3
  95. package/dist/examples/cron-webhook-config.yaml +15 -0
  96. package/dist/examples/forEach-example.yaml +6 -0
  97. package/dist/examples/git-checkout-basic.yaml +4 -0
  98. package/dist/examples/git-checkout-compare.yaml +6 -0
  99. package/dist/examples/git-checkout-cross-repo.yaml +7 -0
  100. package/dist/examples/http-integration-config.yaml +30 -0
  101. package/dist/examples/https-server-config.yaml +15 -0
  102. package/dist/examples/mcp-provider-example.yaml +10 -10
  103. package/dist/examples/transform-example.yaml +3 -0
  104. package/dist/examples/webhook-pipeline-config.yaml +18 -0
  105. package/dist/examples/workflows/workflow-composition-example.yaml +4 -0
  106. package/dist/frontends/slack-frontend.d.ts +2 -0
  107. package/dist/frontends/slack-frontend.d.ts.map +1 -1
  108. package/dist/generated/config-schema.d.ts +11 -7
  109. package/dist/generated/config-schema.d.ts.map +1 -1
  110. package/dist/generated/config-schema.json +11 -7
  111. package/dist/index.js +3127 -974
  112. package/dist/output/traces/{run-2026-01-28T16-15-24-569Z.ndjson → run-2026-01-31T16-37-22-321Z.ndjson} +84 -84
  113. package/dist/output/traces/{run-2026-01-28T16-16-09-757Z.ndjson → run-2026-01-31T16-38-06-031Z.ndjson} +1013 -1013
  114. package/dist/providers/ai-check-provider.d.ts +9 -2
  115. package/dist/providers/ai-check-provider.d.ts.map +1 -1
  116. package/dist/providers/command-check-provider.d.ts.map +1 -1
  117. package/dist/providers/mcp-custom-sse-server.d.ts +17 -1
  118. package/dist/providers/mcp-custom-sse-server.d.ts.map +1 -1
  119. package/dist/providers/workflow-check-provider.d.ts.map +1 -1
  120. package/dist/providers/workflow-tool-executor.d.ts +68 -0
  121. package/dist/providers/workflow-tool-executor.d.ts.map +1 -0
  122. package/dist/sdk/{check-provider-registry-AQ3JETBG.mjs → check-provider-registry-3KI5RKXT.mjs} +6 -5
  123. package/dist/sdk/check-provider-registry-IYILYY35.mjs +28 -0
  124. package/dist/sdk/chunk-2CPMMNIX.mjs +1459 -0
  125. package/dist/sdk/chunk-2CPMMNIX.mjs.map +1 -0
  126. package/dist/sdk/chunk-5LI6T4O3.mjs +3600 -0
  127. package/dist/sdk/chunk-5LI6T4O3.mjs.map +1 -0
  128. package/dist/sdk/{chunk-YLQ4UN62.mjs → chunk-A4PGHURG.mjs} +6838 -6257
  129. package/dist/sdk/chunk-A4PGHURG.mjs.map +1 -0
  130. package/dist/sdk/chunk-EXFGO4FX.mjs +147 -0
  131. package/dist/sdk/chunk-EXFGO4FX.mjs.map +1 -0
  132. package/dist/sdk/chunk-PJ7K5UFC.mjs +17732 -0
  133. package/dist/sdk/chunk-PJ7K5UFC.mjs.map +1 -0
  134. package/dist/sdk/{chunk-BHZ4CKUS.mjs → chunk-PXFIALUH.mjs} +77 -8
  135. package/dist/sdk/chunk-PXFIALUH.mjs.map +1 -0
  136. package/dist/sdk/{chunk-PVITVJ6J.mjs → chunk-RTKJXNZS.mjs} +32 -9
  137. package/dist/sdk/chunk-RTKJXNZS.mjs.map +1 -0
  138. package/dist/sdk/chunk-VW2GBXQT.mjs +606 -0
  139. package/dist/sdk/chunk-VW2GBXQT.mjs.map +1 -0
  140. package/dist/sdk/{config-RQQPMLRD.mjs → config-5AUYQFHE.mjs} +2 -2
  141. package/dist/sdk/config-6CUVEH7H.mjs +16 -0
  142. package/dist/sdk/config-6CUVEH7H.mjs.map +1 -0
  143. package/dist/sdk/{github-frontend-6Q4BISZX.mjs → github-frontend-BZ4N3BFZ.mjs} +7 -3
  144. package/dist/sdk/github-frontend-BZ4N3BFZ.mjs.map +1 -0
  145. package/dist/sdk/host-4MT3EW2I.mjs +52 -0
  146. package/dist/sdk/{host-P5NQICP7.mjs → host-NYWXLIFC.mjs} +2 -2
  147. package/dist/sdk/host-NYWXLIFC.mjs.map +1 -0
  148. package/dist/sdk/{routing-DEY2AIXM.mjs → routing-6R42GXUO.mjs} +2 -2
  149. package/dist/sdk/routing-6R42GXUO.mjs.map +1 -0
  150. package/dist/sdk/routing-7FXPULTO.mjs +24 -0
  151. package/dist/sdk/routing-7FXPULTO.mjs.map +1 -0
  152. package/dist/sdk/sdk.d.mts +3 -1
  153. package/dist/sdk/sdk.d.ts +3 -1
  154. package/dist/sdk/sdk.js +12163 -11204
  155. package/dist/sdk/sdk.js.map +1 -1
  156. package/dist/sdk/sdk.mjs +14 -10
  157. package/dist/sdk/sdk.mjs.map +1 -1
  158. package/dist/sdk/slack-frontend-JUT3TYVC.mjs +821 -0
  159. package/dist/sdk/slack-frontend-JUT3TYVC.mjs.map +1 -0
  160. package/dist/sdk/workflow-check-provider-H3CUOLUD.mjs +28 -0
  161. package/dist/sdk/workflow-check-provider-H3CUOLUD.mjs.map +1 -0
  162. package/dist/sdk/workflow-check-provider-YUNNF4KC.mjs +28 -0
  163. package/dist/sdk/workflow-check-provider-YUNNF4KC.mjs.map +1 -0
  164. package/dist/sdk/workflow-registry-KFWSDSLM.mjs +12 -0
  165. package/dist/sdk/workflow-registry-KFWSDSLM.mjs.map +1 -0
  166. package/dist/slack/socket-runner.d.ts +2 -0
  167. package/dist/slack/socket-runner.d.ts.map +1 -1
  168. package/dist/state-machine/context/workflow-inputs.d.ts +20 -0
  169. package/dist/state-machine/context/workflow-inputs.d.ts.map +1 -0
  170. package/dist/state-machine/dispatch/execution-invoker.d.ts.map +1 -1
  171. package/dist/state-machine/dispatch/foreach-processor.d.ts.map +1 -1
  172. package/dist/state-machine/dispatch/stats-manager.d.ts.map +1 -1
  173. package/dist/state-machine/states/level-dispatch.d.ts.map +1 -1
  174. package/dist/state-machine/states/routing.d.ts +2 -1
  175. package/dist/state-machine/states/routing.d.ts.map +1 -1
  176. package/dist/traces/{run-2026-01-28T16-15-24-569Z.ndjson → run-2026-01-31T16-37-22-321Z.ndjson} +84 -84
  177. package/dist/traces/{run-2026-01-28T16-16-09-757Z.ndjson → run-2026-01-31T16-38-06-031Z.ndjson} +1013 -1013
  178. package/dist/types/config.d.ts +3 -1
  179. package/dist/types/config.d.ts.map +1 -1
  180. package/dist/utils/human-id.d.ts +12 -0
  181. package/dist/utils/human-id.d.ts.map +1 -0
  182. package/dist/utils/worktree-manager.d.ts +3 -0
  183. package/dist/utils/worktree-manager.d.ts.map +1 -1
  184. package/dist/workflow-executor.d.ts.map +1 -1
  185. package/dist/workflow-registry.d.ts +1 -0
  186. package/dist/workflow-registry.d.ts.map +1 -1
  187. package/package.json +2 -2
  188. package/dist/sdk/chunk-BHZ4CKUS.mjs.map +0 -1
  189. package/dist/sdk/chunk-PVITVJ6J.mjs.map +0 -1
  190. package/dist/sdk/chunk-YLQ4UN62.mjs.map +0 -1
  191. package/dist/sdk/github-frontend-6Q4BISZX.mjs.map +0 -1
  192. /package/dist/sdk/{check-provider-registry-AQ3JETBG.mjs.map → check-provider-registry-3KI5RKXT.mjs.map} +0 -0
  193. /package/dist/sdk/{config-RQQPMLRD.mjs.map → check-provider-registry-IYILYY35.mjs.map} +0 -0
  194. /package/dist/sdk/{routing-DEY2AIXM.mjs.map → config-5AUYQFHE.mjs.map} +0 -0
  195. /package/dist/sdk/{host-P5NQICP7.mjs.map → host-4MT3EW2I.mjs.map} +0 -0
@@ -1,9 +1,85 @@
1
- ## 🧭 Developer Experience Playbook
2
-
3
- - Start with defaults: copy `defaults/.visor.yaml` or an example; run `npx -y @probelabs/visor@latest --check all --debug`.
4
- - Treat config as code: review `.visor.yaml` and templates; pin providers/models for reproducibility.
5
- - Roll out gradually: gate heavier checks with tags (`local`, `fast`, `critical`).
6
- - Secure credentials: prefer GitHub App in production; scope/rotate API keys.
7
- - Make feedback actionable: group related checks; use `/review --check ...` triggers; enable `reuse_ai_session` for follow-ups.
8
- - Keep suppressions intentional: annotate context; audit `visor-disable-file` periodically.
9
- - Validate locally: `npx -y @probelabs/visor@latest --check security --output markdown`; run tests; `--fail-fast` for fast lanes.
1
+ ## Developer Experience Playbook
2
+
3
+ This guide covers both contributing to Visor and using it effectively.
4
+
5
+ ### Quick Start for Contributors
6
+
7
+ ```bash
8
+ # Install dependencies
9
+ npm install
10
+
11
+ # Build the project
12
+ npm run build
13
+
14
+ # Run tests
15
+ npm test
16
+
17
+ # Run the CLI locally
18
+ ./dist/index.js --help
19
+ ```
20
+
21
+ ### Development Commands
22
+
23
+ #### Build
24
+ | Command | Description |
25
+ |---------|-------------|
26
+ | `npm run build` | Build CLI and SDK |
27
+ | `npm run build:cli` | Build CLI only |
28
+ | `npm run build:sdk` | Build SDK only |
29
+ | `npm run clean` | Clean dist directory |
30
+
31
+ #### Testing
32
+ | Command | Description |
33
+ |---------|-------------|
34
+ | `npm test` | Run all tests (Jest + YAML tests) |
35
+ | `npm run test:watch` | Run tests in watch mode |
36
+ | `npm run test:coverage` | Generate coverage report |
37
+ | `npm run test:yaml` | Run YAML-based tests only |
38
+ | `npm run test:yaml:parallel` | Run YAML tests with parallelism |
39
+
40
+ #### Code Quality
41
+ | Command | Description |
42
+ |---------|-------------|
43
+ | `npm run lint` | Lint TypeScript files |
44
+ | `npm run lint:fix` | Auto-fix linting issues |
45
+ | `npm run format` | Format code with Prettier |
46
+ | `npm run format:check` | Check code formatting |
47
+
48
+ #### Release
49
+ | Command | Description |
50
+ |---------|-------------|
51
+ | `npm run release` | Interactive release |
52
+ | `npm run release:patch` | Release patch version |
53
+ | `npm run release:minor` | Release minor version |
54
+ | `npm run release:major` | Release major version |
55
+
56
+ #### Deployment
57
+ | Command | Description |
58
+ |---------|-------------|
59
+ | `npm run deploy` | Deploy site and worker |
60
+ | `npm run deploy:site` | Deploy site to Cloudflare Pages |
61
+ | `npm run deploy:worker` | Deploy worker to Cloudflare |
62
+
63
+ #### Simulation & Debugging
64
+ | Command | Description |
65
+ |---------|-------------|
66
+ | `npm run simulate:issue` | Simulate GitHub issue event |
67
+ | `npm run simulate:comment` | Simulate GitHub comment event |
68
+
69
+ ### Using Visor Effectively
70
+
71
+ - **Start with defaults**: Copy `defaults/visor.yaml` or an example from `examples/`; run `npx -y @probelabs/visor@latest --check all --debug`.
72
+ - **Treat config as code**: Review `.visor.yaml` and templates; pin providers/models for reproducibility.
73
+ - **Roll out gradually**: Gate heavier checks with tags (`local`, `fast`, `critical`). See [Tag Filtering](tag-filtering.md).
74
+ - **Secure credentials**: Prefer GitHub App in production; scope/rotate API keys. See [Security](security.md).
75
+ - **Make feedback actionable**: Group related checks; use `/review --check ...` triggers; enable `reuse_ai_session` for follow-ups.
76
+ - **Keep suppressions intentional**: Annotate context; audit `visor-disable-file` periodically. See [Suppressions](suppressions.md).
77
+ - **Validate locally**: `npx -y @probelabs/visor@latest --check security --output markdown`; run tests; `--fail-fast` for fast lanes.
78
+
79
+ ### Related Documentation
80
+
81
+ - [Configuration](configuration.md) - Full configuration reference
82
+ - [Debugging](debugging.md) - Debugging techniques and troubleshooting
83
+ - [Troubleshooting](troubleshooting.md) - Common issues and solutions
84
+ - [CI/CLI Mode](ci-cli-mode.md) - Running Visor in CI environments
85
+ - [Output Formats](output-formats.md) - Available output formats
@@ -1,10 +1,10 @@
1
1
  # RFC: Proper Pause/Resume for State-Machine Engine (Event‑Bus + Snapshots)
2
2
 
3
- Status: draft
3
+ Status: implemented
4
4
 
5
5
  Owner: visor engine
6
6
 
7
- Last updated: 2025-11-20
7
+ Last updated: 2026-01-28
8
8
 
9
9
  ## Summary
10
10
 
@@ -165,19 +165,19 @@ We will add first‑class pause/resume to the state‑machine engine so long‑r
165
165
  ## Work Items
166
166
 
167
167
  - Runner
168
- - [ ] Add `deserializeRunState()`
169
- - [ ] Add `runner.setState()`
168
+ - [x] Add `runner.setState()` - Implemented in `src/state-machine/runner.ts`
169
+ - [~] Add `deserializeRunState()` - Not needed; resume uses fresh run with journal hydration
170
170
  - Engine
171
- - [ ] Add `resumeFromSnapshot()`
172
- - [ ] On HumanInputRequested → `saveSnapshotToFile()` (path via threadKey+checkId)
171
+ - [x] Add `resumeFromSnapshot()` - Implemented in `src/state-machine-execution-engine.ts`
172
+ - [x] On HumanInputRequested → `saveSnapshotToFile()` (path via threadKey+checkId)
173
173
  - Slack
174
- - [ ] PromptState stores `snapshotPath` alongside prompt metadata
175
- - [ ] Socket runner loads snapshot and calls `resumeFromSnapshot()` on reply
174
+ - [x] PromptState stores `snapshotPath` alongside prompt metadata - Implemented in `src/slack/prompt-state.ts`
175
+ - [x] Socket runner loads snapshot and calls `resumeFromSnapshot()` on reply - Implemented in `src/slack/socket-runner.ts`
176
176
  - Tests
177
- - [ ] Unit: serialize/deserialize round‑trip
178
- - [ ] Integration: pause/resume end‑to‑end (Slack fixture), snapshot deletion
177
+ - [x] Unit: workspace initialization test in `tests/unit/resume-from-snapshot-workspace.test.ts`
178
+ - [x] Integration: pause/resume tests in `tests/integration/slack-pause-resume-e2e.test.ts` and `tests/integration/slack-resume-from-snapshot.test.ts`
179
179
  - Docs
180
- - [ ] Update Slack integration docs and humaninput provider docs
180
+ - [x] Human-input provider docs mention workflow pausing in `docs/human-input-provider.md`
181
181
 
182
182
  ## Alternatives Considered
183
183
 
@@ -1,5 +1,11 @@
1
1
  # Engine State Machine (v2) Research
2
2
 
3
+ > **Status: COMPLETED**
4
+ >
5
+ > This planning document describes the state machine engine implementation. All milestones (M0-M4) have been completed. The state machine is now the default engine, and `CheckExecutionEngine` in `src/check-execution-engine.ts` is a compatibility wrapper that re-exports `StateMachineExecutionEngine`.
6
+ >
7
+ > **Note:** Line references in section 1 ("Current Engine Map") are historical and refer to the legacy implementation that has since been refactored into `src/state-machine/`. See `src/state-machine/runner.ts` and `src/state-machine/states/` for the current implementation.
8
+
3
9
  This note captures the current execution flow of the Visor engine, the surfaces where a feature flag can live, and an initial proposal for a bespoke state-machine-based Runner v2. The user-provided research artifact referenced in the request is not available inside this workspace yet, so there are a few open questions that we should fill in once we can read it.
4
10
 
5
11
  > Safety Model & Criticality (Summary)
@@ -296,12 +302,13 @@ Execution steps:
296
302
  3. Emit telemetry (`engine.contract.assume_failed`, `engine.contract.guarantee_failed`) so CI and runtime monitoring can flag contract regressions.
297
303
 
298
304
  By lifting control flow into `transitions` and correctness rules into `assume`/`guarantee`, we make configurations statically analyzable, reduce reliance on imperative `goto_js`, and move closer to NASA-inspired static validation goals while still honoring legacy constructs for advanced scenarios.
299
- ## 5. Routing and Loops (spec to impl status)
305
+
306
+ ## 6. Routing and Loops (spec to impl status)
300
307
 
301
308
  - on_success/on_fail evaluate `run`, `run_js`, and `goto` (with optional `goto_event`).
302
309
  - on_finish for forEach parents is processed after children complete; loop budget enforced.
303
310
 
304
- ### 5.1 Declarative transitions (implemented)
311
+ ### 6.1 Declarative transitions (implemented)
305
312
 
306
313
  In addition to `goto`/`goto_js`, checks can use declarative transitions on `on_success`, `on_fail`, and `on_finish`:
307
314
 
@@ -318,7 +325,7 @@ on_finish:
318
325
  - Backward compatible: if `transitions` is omitted or none match, the engine falls back to `goto_js/goto`.
319
326
  - Helpers available: `outputs`, `outputs_history`, `output`, `event`, `memory`, plus `any/all/none/count`.
320
327
 
321
- ### 5.2 Assume/Guarantee contracts (implemented)
328
+ ### 6.2 Assume/Guarantee contracts (implemented)
322
329
 
323
330
  Per-check contracts:
324
331
 
@@ -1,7 +1,8 @@
1
1
  # RFC: Event-Driven Integrations via Frontends (GitHub, Slack, …)
2
2
 
3
- **Status**: Proposed
3
+ **Status**: Implemented (Phases 1-2 Complete)
4
4
  **Created**: 2025-11-19
5
+ **Updated**: 2026-01-28
5
6
  **Author**: Architecture Planning
6
7
 
7
8
  ## Abstract
@@ -710,24 +711,32 @@ Kept intentionally small after adopting defaults above:
710
711
  ## Implementation Checklist
711
712
 
712
713
  ### Phase 1: Foundation
713
- - [ ] Implement `EventBus` class with subscription management
714
- - [ ] Add `eventBus` optional parameter to `StateMachineRunner`
715
- - [ ] Modify `emitEvent()` to publish to event bus
714
+ - [x] Implement `EventBus` class with subscription management (`src/event-bus/event-bus.ts`)
715
+ - [x] Implement `EventEnvelope` and `IntegrationEvent` types (`src/event-bus/types.ts`)
716
+ - [x] Add `eventBus` optional parameter to `StateMachineRunner` (via `EngineContext`)
717
+ - [x] Implement `FrontendsHost` with `Frontend` API (`src/frontends/host.ts`)
718
+ - [x] Implement `NdjsonSink` frontend (`src/frontends/ndjson-sink.ts`)
716
719
  - [ ] Add unit tests for `EventBus`
717
720
 
718
- ### Phase 2: GitHub Adapter
719
- - [ ] Implement `GitHubEventAdapter` with request handlers
720
- - [ ] Add feature flag `experimental.eventDrivenGitHub`
721
- - [ ] Wire up adapter in `state-machine-execution-engine.ts`
721
+ ### Phase 2: GitHub Frontend
722
+ - [x] Implement `GitHubFrontend` with request handlers (`src/frontends/github-frontend.ts`)
723
+ - [x] Wire up adapter in `state-machine-execution-engine.ts`
724
+ - [x] Implement comment grouping with section markers
725
+ - [x] Implement debounce/coalescing for comment updates
726
+ - [x] Implement mutex-based serialization for updates
727
+ - [ ] Add feature flag `experimental.eventDrivenGitHub` (skipped - frontends are enabled by default)
722
728
  - [ ] Add integration tests for dual-mode operation
723
729
 
724
- ### Phase 3: Multi-Platform Examples
725
- - [ ] Implement `SlackEventAdapter` (example)
730
+ ### Phase 3: Multi-Platform Frontends
731
+ - [x] Implement `SlackFrontend` with direct replies (`src/frontends/slack-frontend.ts`)
732
+ - [x] Slack reaction management (acknowledgement and completion)
733
+ - [x] Mermaid diagram rendering and upload
734
+ - [x] Human input prompt handling via prompt-state
726
735
  - [ ] Implement `MetricsEventAdapter` (example)
727
736
  - [ ] Document adapter API and patterns
728
737
 
729
738
  ### Phase 4: Migration (Breaking Change)
730
- - [ ] Remove `gitHubChecks` from `EngineContext`
739
+ - [ ] Remove `gitHubChecks` from `EngineContext` (legacy DI still present for backward compatibility)
731
740
  - [ ] Make `eventBus` required parameter
732
741
  - [ ] Update all state handlers to emit events
733
742
  - [ ] Update all tests to new pattern
@@ -22,10 +22,11 @@ Visor can be triggered in two main modes:
22
22
  When running as a GitHub Action, Visor responds to these events:
23
23
 
24
24
  ### Pull Request Events (`pull_request`)
25
- - **Actions**: `opened`, `synchronize`, `edited`
25
+ - **Actions**: `opened`, `synchronize`, `edited`, `closed`
26
26
  - **Trigger mapping**:
27
27
  - `opened` → `pr_opened`
28
28
  - `synchronize` / `edited` → `pr_updated`
29
+ - `closed` → `pr_closed`
29
30
  - **Log format**:
30
31
  ```
31
32
  🤖 Mode: GitHub Action
@@ -35,6 +36,18 @@ When running as a GitHub Action, Visor responds to these events:
35
36
  🔀 Context: Pull Request #123
36
37
  ```
37
38
 
39
+ ### Pull Request Review Events (`pull_request_review`)
40
+ - **Actions**: `submitted`, `edited`, `dismissed`
41
+ - **Trigger mapping**: `pr_updated`
42
+ - **Log format**:
43
+ ```
44
+ 🤖 Mode: GitHub Action
45
+ 📂 Repository: owner/repo
46
+ 📋 Event: pull_request_review (action: submitted)
47
+ 🎯 Trigger: pr_updated
48
+ 🔀 Context: Pull Request #123
49
+ ```
50
+
38
51
  ### Issue Events (`issues`)
39
52
  - **Actions**: `opened`, `edited`, etc.
40
53
  - **Trigger mapping**: `issue_opened`
@@ -51,6 +64,7 @@ When running as a GitHub Action, Visor responds to these events:
51
64
  - **Actions**: `created`, `edited`
52
65
  - **Trigger mapping**: `issue_comment`
53
66
  - **Context**: Can be on either a Pull Request or an Issue
67
+ - **Note**: The EventMapper class may treat PR comments as `pr_updated` for advanced routing, but the GitHub Action entry point maps all issue comments to `issue_comment`.
54
68
  - **Log format** (on PR):
55
69
  ```
56
70
  🤖 Mode: GitHub Action
@@ -68,6 +82,28 @@ When running as a GitHub Action, Visor responds to these events:
68
82
  💬 Context: Comment on Issue #456
69
83
  ```
70
84
 
85
+ ### Schedule Events (`schedule`)
86
+ - **Trigger mapping**: `schedule`
87
+ - **Use case**: Cron-triggered workflows
88
+ - **Log format**:
89
+ ```
90
+ 🤖 Mode: GitHub Action
91
+ 📂 Repository: owner/repo
92
+ 📋 Event: schedule
93
+ 🎯 Trigger: schedule
94
+ ```
95
+
96
+ ### Workflow Dispatch Events (`workflow_dispatch`)
97
+ - **Trigger mapping**: `schedule` (treated as scheduled execution)
98
+ - **Use case**: Manual workflow triggers
99
+ - **Log format**:
100
+ ```
101
+ 🤖 Mode: GitHub Action
102
+ 📂 Repository: owner/repo
103
+ 📋 Event: workflow_dispatch
104
+ 🎯 Trigger: schedule
105
+ ```
106
+
71
107
  ## Example Logs
72
108
 
73
109
  ### Before (old logging):
@@ -135,9 +171,24 @@ This is **normal and correct** - it means:
135
171
  ✓ Skipping bot's own comment to prevent recursion. Author: probelabs[bot], Type: Bot, Has markers: true
136
172
  ```
137
173
 
174
+ ## Available Event Triggers
175
+
176
+ The complete list of event triggers that can be used in the `on` field:
177
+
178
+ | Trigger | Description |
179
+ |---------|-------------|
180
+ | `pr_opened` | Pull request was opened |
181
+ | `pr_updated` | Pull request was updated (synchronize, edited, or review submitted) |
182
+ | `pr_closed` | Pull request was closed (merged or dismissed) |
183
+ | `issue_opened` | Issue was opened |
184
+ | `issue_comment` | Comment on an issue (not a PR) |
185
+ | `manual` | Manual CLI invocation |
186
+ | `schedule` | Scheduled execution (cron or workflow_dispatch) |
187
+ | `webhook_received` | HTTP webhook was received (via http_input provider) |
188
+
138
189
  ## Configuration
139
190
 
140
- Checks are configured to run on specific triggers using the `on` field:
191
+ Steps are configured to run on specific triggers using the `on` field:
141
192
 
142
193
  ```yaml
143
194
  steps:
@@ -150,13 +201,24 @@ steps:
150
201
  on: [issue_comment, issue_opened] # Runs on issue events
151
202
  type: ai
152
203
  # ... rest of config
204
+
205
+ scheduled-report:
206
+ on: [schedule] # Only runs on scheduled triggers
207
+ type: ai
208
+ schedule: "0 9 * * 1" # Every Monday at 9am
209
+ # ... rest of config
210
+
211
+ webhook-handler:
212
+ on: [webhook_received] # Only runs when webhook is received
213
+ type: http_input
214
+ # ... rest of config
153
215
  ```
154
216
 
155
- If `on` is not specified, the check can run on any event type.
217
+ If `on` is not specified, the check can run on any event type (except `manual`-only checks when using `--event all`).
156
218
 
157
219
  ### Using goto_event to simulate a different trigger for a jump
158
220
 
159
- Sometimes you want to re-run an ancestor step as if a different event happened (e.g., from an `issue_comment` flow you want to re-execute a PR step under `pr_updated`). Use `goto_event` together with `goto`:
221
+ Sometimes you want to "re-run" an ancestor step as if a different event happened (e.g., from an `issue_comment` flow you want to re-execute a PR step under `pr_updated`). Use `goto_event` together with `goto` in `on_success` or `on_fail` blocks:
160
222
 
161
223
  ```yaml
162
224
  steps:
@@ -173,7 +235,14 @@ steps:
173
235
  goto_event: pr_updated # simulate PR update for the inline jump
174
236
  ```
175
237
 
176
- During that inline execution, event filtering and `if:` expressions see the simulated event. The current step is then re-run once. For a full PR re-run from an issue comment, synthesize a PR event and re-invoke the action entrypoint (see failure-routing docs for details).
238
+ During that inline execution, event filtering and `if:` expressions see the simulated event. The current step is then re-run once.
239
+
240
+ The `goto_event` field accepts any valid `EventTrigger` value:
241
+ - `pr_opened`, `pr_updated`, `pr_closed`
242
+ - `issue_opened`, `issue_comment`
243
+ - `manual`, `schedule`, `webhook_received`
244
+
245
+ For complete documentation on failure routing, retry policies, and loop control, see [Failure Routing](./failure-routing.md).
177
246
 
178
247
  ## CLI Event Simulation
179
248
 
@@ -188,12 +257,21 @@ visor --event pr_updated
188
257
  # Simulate a PR opened event
189
258
  visor --event pr_opened
190
259
 
260
+ # Simulate a PR closed event
261
+ visor --event pr_closed
262
+
191
263
  # Simulate an issue comment event
192
264
  visor --event issue_comment
193
265
 
194
266
  # Simulate an issue opened event
195
267
  visor --event issue_opened
196
268
 
269
+ # Simulate a manual trigger (runs checks with on: [manual])
270
+ visor --event manual
271
+
272
+ # Simulate a scheduled trigger
273
+ visor --event schedule
274
+
197
275
  # Run all checks regardless of event filters (default)
198
276
  visor --event all
199
277
  ```
@@ -215,10 +293,13 @@ visor --check security --event pr_updated
215
293
 
216
294
  | Flag | Behavior | Use Case |
217
295
  |------|----------|----------|
218
- | `--event pr_updated` | Only runs checks with `on: [pr_updated]` | Test PR update scenario locally |
219
296
  | `--event pr_opened` | Only runs checks with `on: [pr_opened]` | Test PR opened scenario |
297
+ | `--event pr_updated` | Only runs checks with `on: [pr_updated]` | Test PR update scenario locally |
298
+ | `--event pr_closed` | Only runs checks with `on: [pr_closed]` | Test PR close/merge scenario |
299
+ | `--event issue_opened` | Only runs checks with `on: [issue_opened]` | Test issue opened scenario |
220
300
  | `--event issue_comment` | Only runs checks with `on: [issue_comment]` | Test comment assistant |
221
301
  | `--event manual` | Only runs checks with `on: [manual]` | Test manual-triggered checks |
302
+ | `--event schedule` | Only runs checks with `on: [schedule]` | Test scheduled/cron checks |
222
303
  | `--event all` | Runs all checks (except manual-only) | Default behavior, ignores `on:` filters |
223
304
  | (no flag) | Auto-detects based on schema | Smart default |
224
305
 
@@ -290,3 +371,11 @@ visor --event issue_comment
290
371
  ```bash
291
372
  visor --event all # or just: visor
292
373
  ```
374
+
375
+ ## Related Documentation
376
+
377
+ - [Configuration](./configuration.md) - Full configuration reference including check types
378
+ - [CI/CLI Mode](./ci-cli-mode.md) - Running Visor in CI environments
379
+ - [Failure Routing](./failure-routing.md) - Auto-fix loops and `goto_event` usage
380
+ - [Commands](./commands.md) - CLI commands and PR comment commands
381
+ - [Tag Filtering](./tag-filtering.md) - Selective check execution with tags
@@ -1,9 +1,22 @@
1
1
  # RFC: Enhanced Execution Logging & Statistics
2
2
 
3
- **Status:** Implemented
3
+ **Status:** Implemented (with architectural changes)
4
4
  **Date:** 2025-10-04
5
5
  **Version:** 1.0
6
6
 
7
+ > **Note (January 2026):** This RFC has been implemented, but the underlying architecture
8
+ > has evolved significantly since the original design. The `CheckExecutionEngine` class
9
+ > described below has been replaced by `StateMachineExecutionEngine` (see
10
+ > `src/state-machine-execution-engine.ts`). Statistics tracking is now handled via:
11
+ > - `src/types/execution.ts` - Type definitions for `CheckExecutionStats` and `ExecutionStatistics`
12
+ > - `src/state-machine/dispatch/stats-manager.ts` - Runtime statistics collection
13
+ > - `src/state-machine/execution/summary.ts` - Result aggregation
14
+ >
15
+ > The data structures remain largely compatible with the RFC specification, with some
16
+ > additions like `skippedRuns`, `providerDurationMs`, and additional skip reasons
17
+ > (`forEach_empty`, `assume`). The formatting methods (`formatStatusColumn`,
18
+ > `formatDetailsColumn`) remain in the engine class for test compatibility.
19
+
7
20
  ## Summary
8
21
 
9
22
  This RFC describes the implementation of comprehensive execution statistics tracking and enhanced logging for Visor checks, providing users with clear visibility into forEach iterations, skip reasons, and overall execution metrics.
@@ -285,6 +298,5 @@ Potential future improvements:
285
298
 
286
299
  ## References
287
300
 
288
- - Implementation PR: [Link to PR]
289
- - Related Issues: Enhanced logging visibility (#XX)
290
- - Documentation: Updated in CLAUDE.md and README.md
301
+ - Implementation: See `src/state-machine-execution-engine.ts`, `src/types/execution.ts`, and `src/state-machine/dispatch/stats-manager.ts`
302
+ - Tests: `tests/unit/execution-statistics.test.ts`, `tests/unit/execution-statistics-formatting.test.ts`, `tests/integration/execution-statistics-integration.test.ts`
@@ -1,7 +1,18 @@
1
1
  # on_finish Hook - Implementation Status
2
2
 
3
+ > **Note (2026-01-28)**: This is a **historical planning document** from October 2025.
4
+ > The `on_finish` feature has been implemented but the codebase has since been refactored.
5
+ > Some file paths and line numbers in this document are outdated.
6
+ >
7
+ > **Current implementation locations:**
8
+ > - Core logic: `src/engine/on-finish/orchestrator.ts`, `src/engine/on-finish/utils.ts`
9
+ > - State machine integration: `src/state-machine/states/level-dispatch.ts`, `src/state-machine/dispatch/foreach-processor.ts`
10
+ > - Tests: `tests/engine/foreach-on-finish.engine.test.ts`, `tests/e2e/on-finish-*.test.ts`
11
+ >
12
+ > For current usage documentation, see `docs/failure-routing.md` and `docs/foreach-dependency-propagation.md`.
13
+
3
14
  **Last Updated:** 2025-10-16
4
- **Status:** ✅ FEATURE COMPLETE (Infrastructure Ready)
15
+ **Status:** ✅ FEATURE COMPLETE (Infrastructure Ready) - See note above for current locations
5
16
 
6
17
  ## What Was Built
7
18
 
@@ -1,23 +1,31 @@
1
1
  # Fact Validator Implementation Plan
2
2
 
3
- ## 🎯 CURRENT STATUS: 50% COMPLETE
3
+ > **Note (2026-01-28)**: This is a historical planning document. The core `on_finish` hook
4
+ > infrastructure has been implemented and refactored since this plan was written.
5
+ > Implementation has moved from `src/check-execution-engine.ts` to a dedicated module at
6
+ > `src/engine/on-finish/orchestrator.ts` and `src/engine/on-finish/utils.ts`. Method names
7
+ > like `executeCheckInline()` and `handleOnFinishHooks()` mentioned below no longer exist.
8
+ > The test file references may also be outdated. See the actual source files for current
9
+ > implementation details.
4
10
 
5
- **Last Updated:** 2025-10-16
11
+ ## 🎯 CURRENT STATUS: 50% COMPLETE (Phases 1-4 done, Phases 5-6 pending)
12
+
13
+ **Last Updated:** 2025-10-16 (see note above for 2026 status)
6
14
 
7
15
  ### Implementation Status
8
16
 
9
17
  | Component | Status | Files |
10
18
  |-----------|--------|-------|
11
- | **Phase 1: Infrastructure** | ✅ COMPLETE | `src/types/config.ts`, `src/config.ts`, `src/check-execution-engine.ts` |
12
- | **Phase 2: Execution** | ✅ COMPLETE | `src/check-execution-engine.ts` (lines 283-748) |
19
+ | **Phase 1: Infrastructure** | ✅ COMPLETE | `src/types/config.ts`, `src/config.ts` |
20
+ | **Phase 2: Execution** | ✅ COMPLETE | `src/engine/on-finish/orchestrator.ts`, `src/engine/on-finish/utils.ts` |
13
21
  | **Phase 3: Configuration** | ✅ COMPLETE | `examples/fact-validator.yaml` |
14
- | **Phase 4: Documentation** | PENDING | - |
15
- | **Phase 5: Testing** | PENDING | - |
22
+ | **Phase 4: Documentation** | COMPLETE | `docs/failure-routing.md`, `docs/dependencies.md`, `docs/foreach-dependency-propagation.md` |
23
+ | **Phase 5: Testing** | 🚧 PARTIAL | `tests/engine/foreach-on-finish.engine.test.ts`, `tests/unit/on-finish-validation.test.ts` |
16
24
  | **Phase 6: Deployment** | ⏳ PENDING | - |
17
25
 
18
26
  ### Test Results
19
27
 
20
- ✅ **1438 tests passing, 0 failures**
28
+ ✅ **16 on_finish-specific tests passing** (as of 2026-01-28)
21
29
 
22
30
  ### What's Working
23
31
 
@@ -613,10 +621,10 @@ if (check.on_finish && !check.forEach) {
613
621
 
614
622
  ### Documentation Updates
615
623
 
616
- 1. **`docs/failure-routing.md`**: Add `on_finish` section
617
- 2. **`docs/dependencies.md`**: Explain `on_finish` with forEach
618
- 3. **`examples/foreach-on-finish.yaml`**: Complete working example
619
- 4. **`docs/foreach-dependency-propagation.md`**: Update with `on_finish`
624
+ 1. **`docs/failure-routing.md`**: Add `on_finish` section
625
+ 2. **`docs/dependencies.md`**: Explain `on_finish` with forEach
626
+ 3. **`examples/fact-validator.yaml`**: Complete working example
627
+ 4. **`docs/foreach-dependency-propagation.md`**: Update with `on_finish`
620
628
 
621
629
  ## Testing Strategy
622
630