@kontourai/flow-agents 4.0.0 → 4.2.0

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 (507) hide show
  1. package/.github/workflows/ci.yml +8 -0
  2. package/CHANGELOG.md +34 -0
  3. package/CONTEXT.md +5 -0
  4. package/agents/tool-security-reviewer.json +1 -1
  5. package/build/src/cli/init.js +35 -3
  6. package/build/src/cli/kit.js +95 -2
  7. package/build/src/cli/pull-work-provider.js +7 -1
  8. package/build/src/cli/validate-workflow-artifacts.js +53 -0
  9. package/build/src/cli/workflow.js +5 -1
  10. package/build/src/flow-kit/provision.d.ts +23 -0
  11. package/build/src/flow-kit/provision.js +99 -0
  12. package/build/src/flow-kit/validate.d.ts +52 -0
  13. package/build/src/flow-kit/validate.js +214 -9
  14. package/build/src/runtime-adapters.js +1 -1
  15. package/context/contracts/execution-contract.md +30 -1
  16. package/context/contracts/review-contract.md +4 -0
  17. package/context/contracts/trigger-guards.md +73 -0
  18. package/context/scripts/telemetry/lib/config.sh +29 -0
  19. package/context/settings/backlog-provider-settings.json +1 -1
  20. package/context/settings/workspace-backlog-provider-settings.example.json +1 -1
  21. package/dist/base/build/package.json +1 -1
  22. package/dist/base/build/src/cli/init.js +35 -3
  23. package/dist/base/build/src/cli/kit.js +95 -2
  24. package/dist/base/build/src/cli/pull-work-provider.js +7 -1
  25. package/dist/base/build/src/cli/validate-workflow-artifacts.js +53 -0
  26. package/dist/base/build/src/cli/workflow.js +5 -1
  27. package/dist/base/build/src/flow-kit/provision.d.ts +23 -0
  28. package/dist/base/build/src/flow-kit/provision.js +99 -0
  29. package/dist/base/build/src/flow-kit/validate.d.ts +52 -0
  30. package/dist/base/build/src/flow-kit/validate.js +214 -9
  31. package/dist/base/build/src/runtime-adapters.js +1 -1
  32. package/dist/base/context/contracts/execution-contract.md +30 -1
  33. package/dist/base/context/contracts/review-contract.md +4 -0
  34. package/dist/base/context/contracts/trigger-guards.md +73 -0
  35. package/dist/base/context/scripts/telemetry/lib/config.sh +29 -0
  36. package/dist/base/context/settings/backlog-provider-settings.json +1 -1
  37. package/dist/base/context/settings/workspace-backlog-provider-settings.example.json +1 -1
  38. package/dist/base/docs/adr/0023-kit-provisioning.md +47 -0
  39. package/dist/base/docs/adr/index.md +1 -0
  40. package/dist/base/docs/architecture-engine-and-kits.md +17 -0
  41. package/dist/base/docs/context-map.md +3 -0
  42. package/dist/base/docs/decisions/backlog-readiness-source.md +89 -0
  43. package/dist/base/docs/decisions/index.md +1 -0
  44. package/dist/base/docs/developer-architecture.md +3 -3
  45. package/dist/base/docs/flow-kit-repository-contract.md +34 -3
  46. package/dist/base/docs/kit-authoring-guide.md +1 -1
  47. package/dist/base/docs/veritas-integration.md +12 -0
  48. package/dist/base/evals/ci/run-baseline.sh +4 -0
  49. package/dist/base/evals/integration/test_kit_provisioning.sh +112 -0
  50. package/dist/base/evals/integration/test_liveness_console_relay.sh +91 -1
  51. package/dist/base/evals/integration/test_liveness_heartbeat.sh +66 -0
  52. package/dist/base/evals/integration/test_pull_work_provider.sh +18 -0
  53. package/dist/base/evals/integration/test_veritas_governance_kit.sh +256 -0
  54. package/dist/base/evals/integration/test_workflow_artifacts.sh +257 -0
  55. package/dist/base/evals/static/test_package.sh +6 -0
  56. package/dist/base/evals/static/test_workflow_skills.sh +16 -0
  57. package/dist/base/install.sh +1 -1
  58. package/dist/base/kits/builder/flows/publish-learn.flow.json +9 -1
  59. package/dist/base/kits/builder/skills/execute-plan/SKILL.md +4 -3
  60. package/dist/base/kits/builder/skills/pull-work/SKILL.md +12 -0
  61. package/dist/base/kits/builder/skills/review-work/SKILL.md +11 -0
  62. package/dist/base/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
  63. package/dist/base/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
  64. package/dist/base/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
  65. package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
  66. package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
  67. package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
  68. package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
  69. package/dist/base/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
  70. package/dist/base/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
  71. package/dist/base/kits/veritas-governance/docs/README.md +141 -10
  72. package/dist/base/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
  73. package/dist/base/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
  74. package/dist/base/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
  75. package/dist/base/kits/veritas-governance/kit.json +65 -0
  76. package/dist/base/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
  77. package/dist/base/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
  78. package/dist/base/schemas/backlog-provider-settings.schema.json +1 -1
  79. package/dist/base/schemas/workflow-waves.schema.json +347 -0
  80. package/dist/base/scripts/check-layer-boundary.mjs +98 -0
  81. package/dist/base/scripts/hooks/claude-telemetry-hook.js +6 -0
  82. package/dist/base/scripts/hooks/lib/liveness-heartbeat.js +42 -1
  83. package/dist/base/scripts/hooks/lib/liveness-write.js +109 -9
  84. package/dist/base/scripts/liveness/relay.sh +23 -11
  85. package/dist/base/scripts/telemetry/lib/config.sh +29 -0
  86. package/dist/catalog.json +2 -0
  87. package/dist/claude-code/.claude/agents/tool-security-reviewer.md +2 -1
  88. package/dist/claude-code/.claude/skills/consult-standards/SKILL.md +73 -0
  89. package/dist/claude-code/.claude/skills/execute-plan/SKILL.md +4 -3
  90. package/dist/claude-code/.claude/skills/pull-work/SKILL.md +12 -0
  91. package/dist/claude-code/.claude/skills/review-work/SKILL.md +11 -0
  92. package/dist/claude-code/.claude/skills/standards-authoring/SKILL.md +87 -0
  93. package/dist/claude-code/build/package.json +1 -1
  94. package/dist/claude-code/build/src/cli/init.js +35 -3
  95. package/dist/claude-code/build/src/cli/kit.js +95 -2
  96. package/dist/claude-code/build/src/cli/pull-work-provider.js +7 -1
  97. package/dist/claude-code/build/src/cli/validate-workflow-artifacts.js +53 -0
  98. package/dist/claude-code/build/src/cli/workflow.js +5 -1
  99. package/dist/claude-code/build/src/flow-kit/provision.d.ts +23 -0
  100. package/dist/claude-code/build/src/flow-kit/provision.js +99 -0
  101. package/dist/claude-code/build/src/flow-kit/validate.d.ts +52 -0
  102. package/dist/claude-code/build/src/flow-kit/validate.js +214 -9
  103. package/dist/claude-code/build/src/runtime-adapters.js +1 -1
  104. package/dist/claude-code/context/contracts/execution-contract.md +30 -1
  105. package/dist/claude-code/context/contracts/review-contract.md +4 -0
  106. package/dist/claude-code/context/contracts/trigger-guards.md +73 -0
  107. package/dist/claude-code/context/scripts/telemetry/lib/config.sh +29 -0
  108. package/dist/claude-code/context/settings/backlog-provider-settings.json +1 -1
  109. package/dist/claude-code/context/settings/workspace-backlog-provider-settings.example.json +1 -1
  110. package/dist/claude-code/docs/adr/0023-kit-provisioning.md +47 -0
  111. package/dist/claude-code/docs/adr/index.md +1 -0
  112. package/dist/claude-code/docs/architecture-engine-and-kits.md +17 -0
  113. package/dist/claude-code/docs/context-map.md +3 -0
  114. package/dist/claude-code/docs/decisions/backlog-readiness-source.md +89 -0
  115. package/dist/claude-code/docs/decisions/index.md +1 -0
  116. package/dist/claude-code/docs/developer-architecture.md +3 -3
  117. package/dist/claude-code/docs/flow-kit-repository-contract.md +34 -3
  118. package/dist/claude-code/docs/kit-authoring-guide.md +1 -1
  119. package/dist/claude-code/docs/veritas-integration.md +12 -0
  120. package/dist/claude-code/evals/ci/run-baseline.sh +4 -0
  121. package/dist/claude-code/evals/integration/test_kit_provisioning.sh +112 -0
  122. package/dist/claude-code/evals/integration/test_liveness_console_relay.sh +91 -1
  123. package/dist/claude-code/evals/integration/test_liveness_heartbeat.sh +66 -0
  124. package/dist/claude-code/evals/integration/test_pull_work_provider.sh +18 -0
  125. package/dist/claude-code/evals/integration/test_veritas_governance_kit.sh +256 -0
  126. package/dist/claude-code/evals/integration/test_workflow_artifacts.sh +257 -0
  127. package/dist/claude-code/evals/static/test_package.sh +6 -0
  128. package/dist/claude-code/evals/static/test_workflow_skills.sh +16 -0
  129. package/dist/claude-code/install.sh +1 -1
  130. package/dist/claude-code/kits/builder/flows/publish-learn.flow.json +9 -1
  131. package/dist/claude-code/kits/builder/skills/execute-plan/SKILL.md +4 -3
  132. package/dist/claude-code/kits/builder/skills/pull-work/SKILL.md +12 -0
  133. package/dist/claude-code/kits/builder/skills/review-work/SKILL.md +11 -0
  134. package/dist/claude-code/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
  135. package/dist/claude-code/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
  136. package/dist/claude-code/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
  137. package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
  138. package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
  139. package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
  140. package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
  141. package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
  142. package/dist/claude-code/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
  143. package/dist/claude-code/kits/veritas-governance/docs/README.md +141 -10
  144. package/dist/claude-code/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
  145. package/dist/claude-code/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
  146. package/dist/claude-code/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
  147. package/dist/claude-code/kits/veritas-governance/kit.json +65 -0
  148. package/dist/claude-code/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
  149. package/dist/claude-code/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
  150. package/dist/claude-code/schemas/backlog-provider-settings.schema.json +1 -1
  151. package/dist/claude-code/schemas/workflow-waves.schema.json +347 -0
  152. package/dist/claude-code/scripts/check-layer-boundary.mjs +98 -0
  153. package/dist/claude-code/scripts/hooks/claude-telemetry-hook.js +6 -0
  154. package/dist/claude-code/scripts/hooks/lib/liveness-heartbeat.js +42 -1
  155. package/dist/claude-code/scripts/hooks/lib/liveness-write.js +109 -9
  156. package/dist/claude-code/scripts/liveness/relay.sh +23 -11
  157. package/dist/claude-code/scripts/telemetry/lib/config.sh +29 -0
  158. package/dist/codex/.agents/skills/builder-shape/context/contracts/execution-contract.md +30 -1
  159. package/dist/codex/.agents/skills/consult-standards/SKILL.md +73 -0
  160. package/dist/codex/.agents/skills/deliver/context/contracts/execution-contract.md +30 -1
  161. package/dist/codex/.agents/skills/design-probe/context/contracts/execution-contract.md +30 -1
  162. package/dist/codex/.agents/skills/execute-plan/SKILL.md +4 -3
  163. package/dist/codex/.agents/skills/execute-plan/context/contracts/execution-contract.md +30 -1
  164. package/dist/codex/.agents/skills/fix-bug/context/contracts/execution-contract.md +30 -1
  165. package/dist/codex/.agents/skills/idea-to-backlog/context/contracts/execution-contract.md +30 -1
  166. package/dist/codex/.agents/skills/plan-work/context/contracts/execution-contract.md +30 -1
  167. package/dist/codex/.agents/skills/pull-work/SKILL.md +12 -0
  168. package/dist/codex/.agents/skills/pull-work/context/contracts/execution-contract.md +30 -1
  169. package/dist/codex/.agents/skills/review-work/SKILL.md +11 -0
  170. package/dist/codex/.agents/skills/review-work/context/contracts/execution-contract.md +30 -1
  171. package/dist/codex/.agents/skills/standards-authoring/SKILL.md +87 -0
  172. package/dist/codex/.agents/skills/tdd-workflow/context/contracts/execution-contract.md +30 -1
  173. package/dist/codex/.agents/skills/verify-work/context/contracts/execution-contract.md +30 -1
  174. package/dist/codex/.codex/agents/tool-security-reviewer.toml +1 -1
  175. package/dist/codex/build/package.json +1 -1
  176. package/dist/codex/build/src/cli/init.js +35 -3
  177. package/dist/codex/build/src/cli/kit.js +95 -2
  178. package/dist/codex/build/src/cli/pull-work-provider.js +7 -1
  179. package/dist/codex/build/src/cli/validate-workflow-artifacts.js +53 -0
  180. package/dist/codex/build/src/cli/workflow.js +5 -1
  181. package/dist/codex/build/src/flow-kit/provision.d.ts +23 -0
  182. package/dist/codex/build/src/flow-kit/provision.js +99 -0
  183. package/dist/codex/build/src/flow-kit/validate.d.ts +52 -0
  184. package/dist/codex/build/src/flow-kit/validate.js +214 -9
  185. package/dist/codex/build/src/runtime-adapters.js +1 -1
  186. package/dist/codex/context/contracts/execution-contract.md +30 -1
  187. package/dist/codex/context/contracts/review-contract.md +4 -0
  188. package/dist/codex/context/contracts/trigger-guards.md +73 -0
  189. package/dist/codex/context/scripts/telemetry/lib/config.sh +29 -0
  190. package/dist/codex/context/settings/backlog-provider-settings.json +1 -1
  191. package/dist/codex/context/settings/workspace-backlog-provider-settings.example.json +1 -1
  192. package/dist/codex/docs/adr/0023-kit-provisioning.md +47 -0
  193. package/dist/codex/docs/adr/index.md +1 -0
  194. package/dist/codex/docs/architecture-engine-and-kits.md +17 -0
  195. package/dist/codex/docs/context-map.md +3 -0
  196. package/dist/codex/docs/decisions/backlog-readiness-source.md +89 -0
  197. package/dist/codex/docs/decisions/index.md +1 -0
  198. package/dist/codex/docs/developer-architecture.md +3 -3
  199. package/dist/codex/docs/flow-kit-repository-contract.md +34 -3
  200. package/dist/codex/docs/kit-authoring-guide.md +1 -1
  201. package/dist/codex/docs/veritas-integration.md +12 -0
  202. package/dist/codex/evals/ci/run-baseline.sh +4 -0
  203. package/dist/codex/evals/integration/test_kit_provisioning.sh +112 -0
  204. package/dist/codex/evals/integration/test_liveness_console_relay.sh +91 -1
  205. package/dist/codex/evals/integration/test_liveness_heartbeat.sh +66 -0
  206. package/dist/codex/evals/integration/test_pull_work_provider.sh +18 -0
  207. package/dist/codex/evals/integration/test_veritas_governance_kit.sh +256 -0
  208. package/dist/codex/evals/integration/test_workflow_artifacts.sh +257 -0
  209. package/dist/codex/evals/static/test_package.sh +6 -0
  210. package/dist/codex/evals/static/test_workflow_skills.sh +16 -0
  211. package/dist/codex/install.sh +1 -1
  212. package/dist/codex/kits/builder/flows/publish-learn.flow.json +9 -1
  213. package/dist/codex/kits/builder/skills/execute-plan/SKILL.md +4 -3
  214. package/dist/codex/kits/builder/skills/pull-work/SKILL.md +12 -0
  215. package/dist/codex/kits/builder/skills/review-work/SKILL.md +11 -0
  216. package/dist/codex/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
  217. package/dist/codex/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
  218. package/dist/codex/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
  219. package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
  220. package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
  221. package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
  222. package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
  223. package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
  224. package/dist/codex/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
  225. package/dist/codex/kits/veritas-governance/docs/README.md +141 -10
  226. package/dist/codex/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
  227. package/dist/codex/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
  228. package/dist/codex/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
  229. package/dist/codex/kits/veritas-governance/kit.json +65 -0
  230. package/dist/codex/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
  231. package/dist/codex/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
  232. package/dist/codex/schemas/backlog-provider-settings.schema.json +1 -1
  233. package/dist/codex/schemas/workflow-waves.schema.json +347 -0
  234. package/dist/codex/scripts/check-layer-boundary.mjs +98 -0
  235. package/dist/codex/scripts/hooks/claude-telemetry-hook.js +6 -0
  236. package/dist/codex/scripts/hooks/lib/liveness-heartbeat.js +42 -1
  237. package/dist/codex/scripts/hooks/lib/liveness-write.js +109 -9
  238. package/dist/codex/scripts/liveness/relay.sh +23 -11
  239. package/dist/codex/scripts/telemetry/lib/config.sh +29 -0
  240. package/dist/kiro/agents/tool-security-reviewer.json +1 -1
  241. package/dist/kiro/build/package.json +1 -1
  242. package/dist/kiro/build/src/cli/init.js +35 -3
  243. package/dist/kiro/build/src/cli/kit.js +95 -2
  244. package/dist/kiro/build/src/cli/pull-work-provider.js +7 -1
  245. package/dist/kiro/build/src/cli/validate-workflow-artifacts.js +53 -0
  246. package/dist/kiro/build/src/cli/workflow.js +5 -1
  247. package/dist/kiro/build/src/flow-kit/provision.d.ts +23 -0
  248. package/dist/kiro/build/src/flow-kit/provision.js +99 -0
  249. package/dist/kiro/build/src/flow-kit/validate.d.ts +52 -0
  250. package/dist/kiro/build/src/flow-kit/validate.js +214 -9
  251. package/dist/kiro/build/src/runtime-adapters.js +1 -1
  252. package/dist/kiro/context/contracts/execution-contract.md +30 -1
  253. package/dist/kiro/context/contracts/review-contract.md +4 -0
  254. package/dist/kiro/context/contracts/trigger-guards.md +73 -0
  255. package/dist/kiro/context/scripts/telemetry/lib/config.sh +29 -0
  256. package/dist/kiro/context/settings/backlog-provider-settings.json +1 -1
  257. package/dist/kiro/context/settings/workspace-backlog-provider-settings.example.json +1 -1
  258. package/dist/kiro/docs/adr/0023-kit-provisioning.md +47 -0
  259. package/dist/kiro/docs/adr/index.md +1 -0
  260. package/dist/kiro/docs/architecture-engine-and-kits.md +17 -0
  261. package/dist/kiro/docs/context-map.md +3 -0
  262. package/dist/kiro/docs/decisions/backlog-readiness-source.md +89 -0
  263. package/dist/kiro/docs/decisions/index.md +1 -0
  264. package/dist/kiro/docs/developer-architecture.md +3 -3
  265. package/dist/kiro/docs/flow-kit-repository-contract.md +34 -3
  266. package/dist/kiro/docs/kit-authoring-guide.md +1 -1
  267. package/dist/kiro/docs/veritas-integration.md +12 -0
  268. package/dist/kiro/evals/ci/run-baseline.sh +4 -0
  269. package/dist/kiro/evals/integration/test_kit_provisioning.sh +112 -0
  270. package/dist/kiro/evals/integration/test_liveness_console_relay.sh +91 -1
  271. package/dist/kiro/evals/integration/test_liveness_heartbeat.sh +66 -0
  272. package/dist/kiro/evals/integration/test_pull_work_provider.sh +18 -0
  273. package/dist/kiro/evals/integration/test_veritas_governance_kit.sh +256 -0
  274. package/dist/kiro/evals/integration/test_workflow_artifacts.sh +257 -0
  275. package/dist/kiro/evals/static/test_package.sh +6 -0
  276. package/dist/kiro/evals/static/test_workflow_skills.sh +16 -0
  277. package/dist/kiro/install.sh +1 -1
  278. package/dist/kiro/kits/builder/flows/publish-learn.flow.json +9 -1
  279. package/dist/kiro/kits/builder/skills/execute-plan/SKILL.md +4 -3
  280. package/dist/kiro/kits/builder/skills/pull-work/SKILL.md +12 -0
  281. package/dist/kiro/kits/builder/skills/review-work/SKILL.md +11 -0
  282. package/dist/kiro/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
  283. package/dist/kiro/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
  284. package/dist/kiro/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
  285. package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
  286. package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
  287. package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
  288. package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
  289. package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
  290. package/dist/kiro/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
  291. package/dist/kiro/kits/veritas-governance/docs/README.md +141 -10
  292. package/dist/kiro/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
  293. package/dist/kiro/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
  294. package/dist/kiro/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
  295. package/dist/kiro/kits/veritas-governance/kit.json +65 -0
  296. package/dist/kiro/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
  297. package/dist/kiro/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
  298. package/dist/kiro/schemas/backlog-provider-settings.schema.json +1 -1
  299. package/dist/kiro/schemas/workflow-waves.schema.json +347 -0
  300. package/dist/kiro/scripts/check-layer-boundary.mjs +98 -0
  301. package/dist/kiro/scripts/hooks/claude-telemetry-hook.js +6 -0
  302. package/dist/kiro/scripts/hooks/lib/liveness-heartbeat.js +42 -1
  303. package/dist/kiro/scripts/hooks/lib/liveness-write.js +109 -9
  304. package/dist/kiro/scripts/liveness/relay.sh +23 -11
  305. package/dist/kiro/scripts/telemetry/lib/config.sh +29 -0
  306. package/dist/opencode/.opencode/agents/tool-security-reviewer.md +2 -1
  307. package/dist/opencode/.opencode/skills/consult-standards/SKILL.md +73 -0
  308. package/dist/opencode/.opencode/skills/execute-plan/SKILL.md +4 -3
  309. package/dist/opencode/.opencode/skills/pull-work/SKILL.md +12 -0
  310. package/dist/opencode/.opencode/skills/review-work/SKILL.md +11 -0
  311. package/dist/opencode/.opencode/skills/standards-authoring/SKILL.md +87 -0
  312. package/dist/opencode/build/package.json +1 -1
  313. package/dist/opencode/build/src/cli/init.js +35 -3
  314. package/dist/opencode/build/src/cli/kit.js +95 -2
  315. package/dist/opencode/build/src/cli/pull-work-provider.js +7 -1
  316. package/dist/opencode/build/src/cli/validate-workflow-artifacts.js +53 -0
  317. package/dist/opencode/build/src/cli/workflow.js +5 -1
  318. package/dist/opencode/build/src/flow-kit/provision.d.ts +23 -0
  319. package/dist/opencode/build/src/flow-kit/provision.js +99 -0
  320. package/dist/opencode/build/src/flow-kit/validate.d.ts +52 -0
  321. package/dist/opencode/build/src/flow-kit/validate.js +214 -9
  322. package/dist/opencode/build/src/runtime-adapters.js +1 -1
  323. package/dist/opencode/context/contracts/execution-contract.md +30 -1
  324. package/dist/opencode/context/contracts/review-contract.md +4 -0
  325. package/dist/opencode/context/contracts/trigger-guards.md +73 -0
  326. package/dist/opencode/context/scripts/telemetry/lib/config.sh +29 -0
  327. package/dist/opencode/context/settings/backlog-provider-settings.json +1 -1
  328. package/dist/opencode/context/settings/workspace-backlog-provider-settings.example.json +1 -1
  329. package/dist/opencode/docs/adr/0023-kit-provisioning.md +47 -0
  330. package/dist/opencode/docs/adr/index.md +1 -0
  331. package/dist/opencode/docs/architecture-engine-and-kits.md +17 -0
  332. package/dist/opencode/docs/context-map.md +3 -0
  333. package/dist/opencode/docs/decisions/backlog-readiness-source.md +89 -0
  334. package/dist/opencode/docs/decisions/index.md +1 -0
  335. package/dist/opencode/docs/developer-architecture.md +3 -3
  336. package/dist/opencode/docs/flow-kit-repository-contract.md +34 -3
  337. package/dist/opencode/docs/kit-authoring-guide.md +1 -1
  338. package/dist/opencode/docs/veritas-integration.md +12 -0
  339. package/dist/opencode/evals/ci/run-baseline.sh +4 -0
  340. package/dist/opencode/evals/integration/test_kit_provisioning.sh +112 -0
  341. package/dist/opencode/evals/integration/test_liveness_console_relay.sh +91 -1
  342. package/dist/opencode/evals/integration/test_liveness_heartbeat.sh +66 -0
  343. package/dist/opencode/evals/integration/test_pull_work_provider.sh +18 -0
  344. package/dist/opencode/evals/integration/test_veritas_governance_kit.sh +256 -0
  345. package/dist/opencode/evals/integration/test_workflow_artifacts.sh +257 -0
  346. package/dist/opencode/evals/static/test_package.sh +6 -0
  347. package/dist/opencode/evals/static/test_workflow_skills.sh +16 -0
  348. package/dist/opencode/install.sh +1 -1
  349. package/dist/opencode/kits/builder/flows/publish-learn.flow.json +9 -1
  350. package/dist/opencode/kits/builder/skills/execute-plan/SKILL.md +4 -3
  351. package/dist/opencode/kits/builder/skills/pull-work/SKILL.md +12 -0
  352. package/dist/opencode/kits/builder/skills/review-work/SKILL.md +11 -0
  353. package/dist/opencode/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
  354. package/dist/opencode/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
  355. package/dist/opencode/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
  356. package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
  357. package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
  358. package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
  359. package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
  360. package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
  361. package/dist/opencode/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
  362. package/dist/opencode/kits/veritas-governance/docs/README.md +141 -10
  363. package/dist/opencode/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
  364. package/dist/opencode/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
  365. package/dist/opencode/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
  366. package/dist/opencode/kits/veritas-governance/kit.json +65 -0
  367. package/dist/opencode/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
  368. package/dist/opencode/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
  369. package/dist/opencode/schemas/backlog-provider-settings.schema.json +1 -1
  370. package/dist/opencode/schemas/workflow-waves.schema.json +347 -0
  371. package/dist/opencode/scripts/check-layer-boundary.mjs +98 -0
  372. package/dist/opencode/scripts/hooks/claude-telemetry-hook.js +6 -0
  373. package/dist/opencode/scripts/hooks/lib/liveness-heartbeat.js +42 -1
  374. package/dist/opencode/scripts/hooks/lib/liveness-write.js +109 -9
  375. package/dist/opencode/scripts/liveness/relay.sh +23 -11
  376. package/dist/opencode/scripts/telemetry/lib/config.sh +29 -0
  377. package/dist/pi/.pi/skills/consult-standards/SKILL.md +73 -0
  378. package/dist/pi/.pi/skills/execute-plan/SKILL.md +4 -3
  379. package/dist/pi/.pi/skills/pull-work/SKILL.md +12 -0
  380. package/dist/pi/.pi/skills/review-work/SKILL.md +11 -0
  381. package/dist/pi/.pi/skills/standards-authoring/SKILL.md +87 -0
  382. package/dist/pi/build/package.json +1 -1
  383. package/dist/pi/build/src/cli/init.js +35 -3
  384. package/dist/pi/build/src/cli/kit.js +95 -2
  385. package/dist/pi/build/src/cli/pull-work-provider.js +7 -1
  386. package/dist/pi/build/src/cli/validate-workflow-artifacts.js +53 -0
  387. package/dist/pi/build/src/cli/workflow.js +5 -1
  388. package/dist/pi/build/src/flow-kit/provision.d.ts +23 -0
  389. package/dist/pi/build/src/flow-kit/provision.js +99 -0
  390. package/dist/pi/build/src/flow-kit/validate.d.ts +52 -0
  391. package/dist/pi/build/src/flow-kit/validate.js +214 -9
  392. package/dist/pi/build/src/runtime-adapters.js +1 -1
  393. package/dist/pi/context/contracts/execution-contract.md +30 -1
  394. package/dist/pi/context/contracts/review-contract.md +4 -0
  395. package/dist/pi/context/contracts/trigger-guards.md +73 -0
  396. package/dist/pi/context/scripts/telemetry/lib/config.sh +29 -0
  397. package/dist/pi/context/settings/backlog-provider-settings.json +1 -1
  398. package/dist/pi/context/settings/workspace-backlog-provider-settings.example.json +1 -1
  399. package/dist/pi/docs/adr/0023-kit-provisioning.md +47 -0
  400. package/dist/pi/docs/adr/index.md +1 -0
  401. package/dist/pi/docs/architecture-engine-and-kits.md +17 -0
  402. package/dist/pi/docs/context-map.md +3 -0
  403. package/dist/pi/docs/decisions/backlog-readiness-source.md +89 -0
  404. package/dist/pi/docs/decisions/index.md +1 -0
  405. package/dist/pi/docs/developer-architecture.md +3 -3
  406. package/dist/pi/docs/flow-kit-repository-contract.md +34 -3
  407. package/dist/pi/docs/kit-authoring-guide.md +1 -1
  408. package/dist/pi/docs/veritas-integration.md +12 -0
  409. package/dist/pi/evals/ci/run-baseline.sh +4 -0
  410. package/dist/pi/evals/integration/test_kit_provisioning.sh +112 -0
  411. package/dist/pi/evals/integration/test_liveness_console_relay.sh +91 -1
  412. package/dist/pi/evals/integration/test_liveness_heartbeat.sh +66 -0
  413. package/dist/pi/evals/integration/test_pull_work_provider.sh +18 -0
  414. package/dist/pi/evals/integration/test_veritas_governance_kit.sh +256 -0
  415. package/dist/pi/evals/integration/test_workflow_artifacts.sh +257 -0
  416. package/dist/pi/evals/static/test_package.sh +6 -0
  417. package/dist/pi/evals/static/test_workflow_skills.sh +16 -0
  418. package/dist/pi/install.sh +1 -1
  419. package/dist/pi/kits/builder/flows/publish-learn.flow.json +9 -1
  420. package/dist/pi/kits/builder/skills/execute-plan/SKILL.md +4 -3
  421. package/dist/pi/kits/builder/skills/pull-work/SKILL.md +12 -0
  422. package/dist/pi/kits/builder/skills/review-work/SKILL.md +11 -0
  423. package/dist/pi/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
  424. package/dist/pi/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
  425. package/dist/pi/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
  426. package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
  427. package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
  428. package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
  429. package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
  430. package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
  431. package/dist/pi/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
  432. package/dist/pi/kits/veritas-governance/docs/README.md +141 -10
  433. package/dist/pi/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
  434. package/dist/pi/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
  435. package/dist/pi/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
  436. package/dist/pi/kits/veritas-governance/kit.json +65 -0
  437. package/dist/pi/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
  438. package/dist/pi/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
  439. package/dist/pi/schemas/backlog-provider-settings.schema.json +1 -1
  440. package/dist/pi/schemas/workflow-waves.schema.json +347 -0
  441. package/dist/pi/scripts/check-layer-boundary.mjs +98 -0
  442. package/dist/pi/scripts/hooks/claude-telemetry-hook.js +6 -0
  443. package/dist/pi/scripts/hooks/lib/liveness-heartbeat.js +42 -1
  444. package/dist/pi/scripts/hooks/lib/liveness-write.js +109 -9
  445. package/dist/pi/scripts/liveness/relay.sh +23 -11
  446. package/dist/pi/scripts/telemetry/lib/config.sh +29 -0
  447. package/docs/adr/0023-kit-provisioning.md +47 -0
  448. package/docs/adr/index.md +1 -0
  449. package/docs/architecture-engine-and-kits.md +17 -0
  450. package/docs/context-map.md +3 -0
  451. package/docs/decisions/backlog-readiness-source.md +89 -0
  452. package/docs/decisions/index.md +1 -0
  453. package/docs/developer-architecture.md +3 -3
  454. package/docs/flow-kit-repository-contract.md +34 -3
  455. package/docs/kit-authoring-guide.md +1 -1
  456. package/docs/veritas-integration.md +12 -0
  457. package/evals/ci/run-baseline.sh +4 -0
  458. package/evals/integration/test_kit_provisioning.sh +112 -0
  459. package/evals/integration/test_liveness_console_relay.sh +91 -1
  460. package/evals/integration/test_liveness_heartbeat.sh +66 -0
  461. package/evals/integration/test_pull_work_provider.sh +18 -0
  462. package/evals/integration/test_veritas_governance_kit.sh +256 -0
  463. package/evals/integration/test_workflow_artifacts.sh +257 -0
  464. package/evals/static/test_package.sh +6 -0
  465. package/evals/static/test_workflow_skills.sh +16 -0
  466. package/kits/builder/flows/publish-learn.flow.json +9 -1
  467. package/kits/builder/skills/execute-plan/SKILL.md +4 -3
  468. package/kits/builder/skills/pull-work/SKILL.md +12 -0
  469. package/kits/builder/skills/review-work/SKILL.md +11 -0
  470. package/kits/veritas-governance/adapter/readiness-to-trust-bundle.mjs +19 -20
  471. package/kits/veritas-governance/assets/starter-hooks/githooks/post-commit +13 -0
  472. package/kits/veritas-governance/assets/starter-hooks/githooks/pre-push +13 -0
  473. package/kits/veritas-governance/assets/starter-standards/veritas/GOVERNANCE.md +23 -0
  474. package/kits/veritas-governance/assets/starter-standards/veritas/README.md +58 -0
  475. package/kits/veritas-governance/assets/starter-standards/veritas/authority/default.authority-settings.json +30 -0
  476. package/kits/veritas-governance/assets/starter-standards/veritas/repo-map.json +115 -0
  477. package/kits/veritas-governance/assets/starter-standards/veritas/repo-standards/default.repo-standards.json +54 -0
  478. package/kits/veritas-governance/assets/starter-standards/veritas.claims.json +179 -0
  479. package/kits/veritas-governance/docs/README.md +141 -10
  480. package/kits/veritas-governance/fixtures/standards-authoring/approved.trust-bundle.json +74 -0
  481. package/kits/veritas-governance/fixtures/standards-authoring/not-approved.trust-bundle.json +74 -0
  482. package/kits/veritas-governance/flows/standards-authoring.flow.json +35 -0
  483. package/kits/veritas-governance/kit.json +65 -0
  484. package/kits/veritas-governance/skills/consult-standards/SKILL.md +73 -0
  485. package/kits/veritas-governance/skills/standards-authoring/SKILL.md +87 -0
  486. package/package.json +2 -1
  487. package/schemas/backlog-provider-settings.schema.json +1 -1
  488. package/schemas/workflow-waves.schema.json +347 -0
  489. package/scripts/check-layer-boundary.mjs +98 -0
  490. package/scripts/hooks/claude-telemetry-hook.js +6 -0
  491. package/scripts/hooks/lib/liveness-heartbeat.js +42 -1
  492. package/scripts/hooks/lib/liveness-write.js +109 -9
  493. package/scripts/liveness/relay.sh +23 -11
  494. package/scripts/telemetry/lib/config.sh +29 -0
  495. package/src/cli/builder-flow-runtime.test.mjs +86 -0
  496. package/src/cli/flow-resolver-composition.test.mjs +20 -1
  497. package/src/cli/init.ts +31 -3
  498. package/src/cli/kit-metadata-security.test.mjs +163 -1
  499. package/src/cli/kit-provisioning.test.mjs +122 -0
  500. package/src/cli/kit.ts +83 -2
  501. package/src/cli/pull-work-provider.ts +7 -1
  502. package/src/cli/validate-waves.test.mjs +134 -0
  503. package/src/cli/validate-workflow-artifacts.ts +47 -0
  504. package/src/cli/workflow.ts +7 -1
  505. package/src/flow-kit/provision.ts +118 -0
  506. package/src/flow-kit/validate.ts +233 -10
  507. package/src/runtime-adapters.ts +1 -1
@@ -0,0 +1,347 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://flow-agents.dev/schemas/workflow-waves.schema.json",
4
+ "title": "Flow Agents Workflow Waves",
5
+ "description": "Fan-out wave manifest for a workflow session. Each wave declares its expected workers (M) before dispatch; every worker lands exactly one terminal status record; the orchestrator reconciles worker_results against expected_workers at wave close and records an explicit 'N of M reported' reconciliation. A worker that never reported is recorded as not_reported — visible data, never silently absorbed. This sidecar is additive: a session without waves.json declares no fan-out and is unaffected.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "schema_version",
10
+ "task_slug",
11
+ "waves"
12
+ ],
13
+ "$defs": {
14
+ "evidence_ref": {
15
+ "type": "object",
16
+ "additionalProperties": false,
17
+ "required": [
18
+ "kind"
19
+ ],
20
+ "properties": {
21
+ "kind": {
22
+ "type": "string",
23
+ "enum": [
24
+ "source",
25
+ "command",
26
+ "artifact",
27
+ "provider",
28
+ "external"
29
+ ]
30
+ },
31
+ "url": {
32
+ "type": "string",
33
+ "minLength": 1
34
+ },
35
+ "file": {
36
+ "type": "string",
37
+ "minLength": 1
38
+ },
39
+ "line_start": {
40
+ "type": "integer",
41
+ "minimum": 1
42
+ },
43
+ "line_end": {
44
+ "type": "integer",
45
+ "minimum": 1
46
+ },
47
+ "excerpt": {
48
+ "type": "string",
49
+ "minLength": 1
50
+ },
51
+ "summary": {
52
+ "type": "string",
53
+ "minLength": 1
54
+ }
55
+ },
56
+ "allOf": [
57
+ {
58
+ "if": {
59
+ "type": "object",
60
+ "properties": {
61
+ "kind": {
62
+ "const": "source"
63
+ }
64
+ },
65
+ "required": [
66
+ "kind"
67
+ ]
68
+ },
69
+ "then": {
70
+ "required": [
71
+ "file",
72
+ "line_start",
73
+ "line_end",
74
+ "excerpt"
75
+ ]
76
+ }
77
+ },
78
+ {
79
+ "if": {
80
+ "type": "object",
81
+ "properties": {
82
+ "kind": {
83
+ "const": "artifact"
84
+ }
85
+ },
86
+ "required": [
87
+ "kind"
88
+ ]
89
+ },
90
+ "then": {
91
+ "allOf": [
92
+ {
93
+ "anyOf": [
94
+ {
95
+ "type": "object",
96
+ "required": [
97
+ "file"
98
+ ]
99
+ },
100
+ {
101
+ "type": "object",
102
+ "required": [
103
+ "url"
104
+ ]
105
+ }
106
+ ]
107
+ },
108
+ {
109
+ "anyOf": [
110
+ {
111
+ "type": "object",
112
+ "required": [
113
+ "summary"
114
+ ]
115
+ },
116
+ {
117
+ "type": "object",
118
+ "required": [
119
+ "excerpt"
120
+ ]
121
+ }
122
+ ]
123
+ }
124
+ ]
125
+ }
126
+ },
127
+ {
128
+ "if": {
129
+ "type": "object",
130
+ "properties": {
131
+ "kind": {
132
+ "const": "command"
133
+ }
134
+ },
135
+ "required": [
136
+ "kind"
137
+ ]
138
+ },
139
+ "then": {
140
+ "anyOf": [
141
+ {
142
+ "type": "object",
143
+ "required": [
144
+ "excerpt"
145
+ ]
146
+ },
147
+ {
148
+ "type": "object",
149
+ "required": [
150
+ "summary"
151
+ ]
152
+ },
153
+ {
154
+ "type": "object",
155
+ "required": [
156
+ "url"
157
+ ]
158
+ }
159
+ ]
160
+ }
161
+ },
162
+ {
163
+ "if": {
164
+ "type": "object",
165
+ "properties": {
166
+ "kind": {
167
+ "enum": [
168
+ "provider",
169
+ "external"
170
+ ]
171
+ }
172
+ },
173
+ "required": [
174
+ "kind"
175
+ ]
176
+ },
177
+ "then": {
178
+ "required": [
179
+ "url"
180
+ ]
181
+ }
182
+ }
183
+ ]
184
+ },
185
+ "expected_worker": {
186
+ "type": "object",
187
+ "additionalProperties": false,
188
+ "required": [
189
+ "worker_id",
190
+ "task"
191
+ ],
192
+ "properties": {
193
+ "worker_id": {
194
+ "type": "string",
195
+ "minLength": 1
196
+ },
197
+ "task": {
198
+ "type": "string",
199
+ "minLength": 1
200
+ },
201
+ "role": {
202
+ "type": "string",
203
+ "minLength": 1
204
+ },
205
+ "owned_files": {
206
+ "type": "array",
207
+ "items": {
208
+ "type": "string",
209
+ "minLength": 1
210
+ }
211
+ }
212
+ }
213
+ },
214
+ "worker_result": {
215
+ "type": "object",
216
+ "additionalProperties": false,
217
+ "required": [
218
+ "worker_id",
219
+ "status",
220
+ "summary",
221
+ "recorded_at"
222
+ ],
223
+ "properties": {
224
+ "worker_id": {
225
+ "type": "string",
226
+ "minLength": 1
227
+ },
228
+ "status": {
229
+ "type": "string",
230
+ "enum": [
231
+ "completed",
232
+ "failed",
233
+ "blocked",
234
+ "not_reported"
235
+ ]
236
+ },
237
+ "summary": {
238
+ "type": "string",
239
+ "minLength": 1
240
+ },
241
+ "recorded_at": {
242
+ "type": "string",
243
+ "format": "date-time"
244
+ },
245
+ "evidence_refs": {
246
+ "type": "array",
247
+ "items": {
248
+ "$ref": "#/$defs/evidence_ref"
249
+ }
250
+ }
251
+ }
252
+ },
253
+ "reconciliation": {
254
+ "type": "object",
255
+ "additionalProperties": false,
256
+ "required": [
257
+ "status",
258
+ "expected_count",
259
+ "reported_count",
260
+ "summary",
261
+ "reconciled_at"
262
+ ],
263
+ "properties": {
264
+ "status": {
265
+ "type": "string",
266
+ "enum": [
267
+ "complete",
268
+ "incomplete"
269
+ ]
270
+ },
271
+ "expected_count": {
272
+ "type": "integer",
273
+ "minimum": 0
274
+ },
275
+ "reported_count": {
276
+ "type": "integer",
277
+ "minimum": 0
278
+ },
279
+ "summary": {
280
+ "type": "string",
281
+ "minLength": 1
282
+ },
283
+ "reconciled_at": {
284
+ "type": "string",
285
+ "format": "date-time"
286
+ }
287
+ }
288
+ },
289
+ "wave": {
290
+ "type": "object",
291
+ "additionalProperties": false,
292
+ "required": [
293
+ "wave_id",
294
+ "step",
295
+ "declared_at",
296
+ "expected_workers"
297
+ ],
298
+ "properties": {
299
+ "wave_id": {
300
+ "type": "string",
301
+ "minLength": 1
302
+ },
303
+ "step": {
304
+ "type": "string",
305
+ "minLength": 1
306
+ },
307
+ "declared_at": {
308
+ "type": "string",
309
+ "format": "date-time"
310
+ },
311
+ "expected_workers": {
312
+ "type": "array",
313
+ "minItems": 1,
314
+ "items": {
315
+ "$ref": "#/$defs/expected_worker"
316
+ }
317
+ },
318
+ "worker_results": {
319
+ "type": "array",
320
+ "items": {
321
+ "$ref": "#/$defs/worker_result"
322
+ }
323
+ },
324
+ "reconciliation": {
325
+ "$ref": "#/$defs/reconciliation"
326
+ }
327
+ }
328
+ }
329
+ },
330
+ "properties": {
331
+ "schema_version": {
332
+ "type": "string",
333
+ "const": "1.0"
334
+ },
335
+ "task_slug": {
336
+ "type": "string",
337
+ "minLength": 1
338
+ },
339
+ "waves": {
340
+ "type": "array",
341
+ "minItems": 1,
342
+ "items": {
343
+ "$ref": "#/$defs/wave"
344
+ }
345
+ }
346
+ }
347
+ }
@@ -0,0 +1,98 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * check-layer-boundary — kit/engine layer-doctrine ratchet.
4
+ *
5
+ * Doctrine (veritas docs/architecture/engine-surface-seam.md, Invariant 3; ADR 0008/0016):
6
+ * kits distribute by copy/activate/CLI and consume a product engine via CLI + artifacts, NEVER
7
+ * as an npm library import. A kit that `import`s the veritas evaluation engine would fork the
8
+ * layer boundary — the kit must wrap the engine's CLI, not link its code. This is the executable
9
+ * enforcement of that invariant (flow-agents#651).
10
+ *
11
+ * FAILS if any tracked file under kits/ imports `@kontourai/veritas` (or its `/engine` subpath),
12
+ * or if any kit.json declares it as a dependency. The kit's trust-bundle adapter may import
13
+ * `@kontourai/surface` (the open trust format, Layer 3) — that is the sanctioned channel and is
14
+ * NOT matched here. No allowlist: the count is zero today and must stay zero.
15
+ *
16
+ * Not a violation (and not matched — import-syntax-scoped): the many descriptive strings naming
17
+ * "@kontourai/veritas" in kit.json descriptions, docs, and recorded CLI-output fixtures are prose
18
+ * and data, not code imports.
19
+ */
20
+ import { execFileSync } from "node:child_process";
21
+ import { readFileSync } from "node:fs";
22
+
23
+ // Match import/require/dynamic-import of the veritas package (root or /engine subpath) only, so
24
+ // prose/fixture mentions of the package name can never trip it — only an actual code link does.
25
+ const PKG = String.raw`@kontourai/veritas(?:/[A-Za-z0-9_./-]+)?`;
26
+ const IMPORT_PATTERNS = [
27
+ new RegExp(String.raw`from\s+['"](?:${PKG})['"]`),
28
+ new RegExp(String.raw`require(?:\.resolve)?\(\s*['"](?:${PKG})['"]\s*\)`),
29
+ new RegExp(String.raw`import\(\s*['"](?:${PKG})['"]\s*\)`),
30
+ ];
31
+ const SOURCE_EXT = /\.(ts|tsx|mjs|cjs|js|jsx)$/;
32
+
33
+ // Strip comments so an import-SHAPED example inside a doc comment (e.g. a JSDoc `* import ...`
34
+ // line) is not a false positive. A real import statement never starts a line with `//` or `*`,
35
+ // so this only removes prose, never a genuine dependency edge. (Line-scoped — not a full parser;
36
+ // a package name inside a string literal remains matchable, which is intentional.)
37
+ function codeOnly(line) {
38
+ const trimmed = line.trimStart();
39
+ if (trimmed.startsWith("//") || trimmed.startsWith("*") || trimmed.startsWith("/*")) return "";
40
+ return line.replace(/\/\*.*?\*\//g, "").replace(/\/\/.*$/, "");
41
+ }
42
+
43
+ function trackedFiles(dir) {
44
+ return execFileSync("git", ["ls-files", dir], { encoding: "utf8" })
45
+ .split("\n")
46
+ .map((line) => line.trim())
47
+ .filter(Boolean);
48
+ }
49
+
50
+ const violations = [];
51
+
52
+ // 1. Source imports under kits/.
53
+ for (const file of trackedFiles("kits").filter((f) => SOURCE_EXT.test(f))) {
54
+ let text;
55
+ try {
56
+ text = readFileSync(file, "utf8");
57
+ } catch {
58
+ continue;
59
+ }
60
+ text.split("\n").forEach((line, index) => {
61
+ if (IMPORT_PATTERNS.some((re) => re.test(codeOnly(line)))) {
62
+ violations.push(`${file}:${index + 1} imports @kontourai/veritas — kits wrap the engine via CLI, not as a library`);
63
+ }
64
+ });
65
+ }
66
+
67
+ // 2. kit.json dependency declarations.
68
+ for (const file of trackedFiles("kits").filter((f) => f.endsWith("kit.json"))) {
69
+ let manifest;
70
+ try {
71
+ manifest = JSON.parse(readFileSync(file, "utf8"));
72
+ } catch {
73
+ continue;
74
+ }
75
+ for (const field of ["dependencies", "devDependencies", "optionalDependencies", "peerDependencies"]) {
76
+ const decl = manifest[field];
77
+ if (decl && typeof decl === "object" && !Array.isArray(decl)) {
78
+ for (const name of ["@kontourai/veritas"]) {
79
+ if (Object.prototype.hasOwnProperty.call(decl, name)) {
80
+ violations.push(`${file} ${field}.${name} — a kit must not declare the engine as an npm dependency`);
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+
87
+ if (violations.length) {
88
+ console.error("[check-layer-boundary] FAILED — a kit imports/depends on the veritas engine as a library (engine/surface seam, Invariant 3):");
89
+ for (const v of violations) console.error(` ${v}`);
90
+ console.error(
91
+ "\nKits distribute by copy/activate/CLI and consume the engine via its CLI + recorded artifacts,\n" +
92
+ "never as an npm library import. The trust-bundle adapter may import @kontourai/surface (the open\n" +
93
+ "trust format); it must not import @kontourai/veritas. See veritas docs/architecture/engine-surface-seam.md.",
94
+ );
95
+ process.exitCode = 1;
96
+ } else {
97
+ console.log("[check-layer-boundary] OK — no kit imports or declares the veritas engine as a library.");
98
+ }
@@ -105,9 +105,15 @@ async function main() {
105
105
  let conflict;
106
106
  if (canonical === 'postToolUse') {
107
107
  try {
108
+ // Richer "real liveness": name the tool this pulse rode in on so the heartbeat says WHAT the
109
+ // agent is doing, not just that it is alive. Claude Code's PostToolUse payload carries the
110
+ // tool name as `tool_name` (fall back to `toolName`); the heartbeat sanitizes it, so a
111
+ // missing/odd value degrades to a plain aliveness pulse rather than an error.
112
+ const toolName = payload.tool_name || payload.toolName;
108
113
  const heartbeatResult = require('./lib/liveness-heartbeat').maybeEmitHeartbeat({
109
114
  cwd: process.cwd(),
110
115
  env: process.env,
116
+ activity: toolName ? { tool: toolName } : undefined,
111
117
  });
112
118
  conflict = heartbeatResult && heartbeatResult.conflict;
113
119
  } catch (err) {
@@ -164,6 +164,39 @@ function readActiveSlug(root, actorKey) {
164
164
  return sanitized === 'unknown' ? '' : sanitized;
165
165
  }
166
166
 
167
+ /**
168
+ * Sanitize an optional caller-supplied `activity` descriptor into a clean, bounded shape suitable
169
+ * for embedding in the emitted heartbeat event (issue: richer "real liveness" signals). The point
170
+ * is to make each pulse say WHAT the agent is doing right now — the tool it just ran — not merely
171
+ * that it is alive. Every field flows both into the local append-only JSONL and (via relay.sh) into
172
+ * the hosted Console record, so each value is passed through the same allowlist+64-cap
173
+ * `sanitizeSegment` the write side already applies to actors/slugs: a hostile or oversized tool
174
+ * name (a custom MCP tool string, a hand-edited hook payload) can never inject control bytes or
175
+ * unbounded text downstream. Returns `undefined` when there is no usable activity, so the caller
176
+ * omits the field entirely rather than emitting `activity: {}` noise.
177
+ *
178
+ * @param {{tool?: string}|undefined} activity
179
+ * @returns {{tool: string}|undefined}
180
+ */
181
+ function sanitizeActivity(activity) {
182
+ // Fully self-contained fail-safe: this runs on the hot path just BEFORE the durable local append
183
+ // in maybeEmitHeartbeat, and local-first is sacred (ADR 0012 §5) — enriching the pulse must never
184
+ // be able to prevent the write. `String(activity.tool)` could in principle throw for an exotic
185
+ // caller value (a throwing toString/valueOf); swallow it here and degrade to a plain aliveness
186
+ // pulse rather than letting the durable write be skipped.
187
+ try {
188
+ if (!activity || typeof activity !== 'object') return undefined;
189
+ const out = {};
190
+ if (activity.tool != null && String(activity.tool).trim()) {
191
+ const tool = sanitizeSegment(activity.tool);
192
+ if (tool && tool !== 'unknown') out.tool = tool;
193
+ }
194
+ return Object.keys(out).length ? out : undefined;
195
+ } catch {
196
+ return undefined;
197
+ }
198
+ }
199
+
167
200
  /**
168
201
  * Filter a list of parsed liveness events down to the ones matching a given
169
202
  * (subjectId, actor) pair. Shared by the bounded tail read and the full-read
@@ -270,7 +303,11 @@ function attachConflictField(result, conflict) {
270
303
  * wall-clock timer), so it fires once per genuinely new conflicting event, independent of
271
304
  * whether our own heartbeat emits or throttles this call.
272
305
  *
273
- * @param {{cwd?: string, env?: NodeJS.ProcessEnv, now?: Date|string}} [opts]
306
+ * @param {{cwd?: string, env?: NodeJS.ProcessEnv, now?: Date|string, activity?: {tool?: string}}} [opts]
307
+ * `activity` is an optional descriptor of what the agent is doing right now (e.g. the tool this
308
+ * postToolUse pulse rode in on); when present + usable it is sanitized and embedded in the emitted
309
+ * heartbeat so the fleet view shows WHAT, not just aliveness. Purely additive — never affects the
310
+ * throttle/emit/conflict decisions.
274
311
  * @returns {{emitted: boolean, reason?: string, conflict?: {actor: string, lastAt: string, ttlSeconds: number}}}
275
312
  */
276
313
  function maybeEmitHeartbeat(opts = {}) {
@@ -383,12 +420,16 @@ function maybeEmitHeartbeat(opts = {}) {
383
420
  const conflict = computeConflict(holderEvents, slug, actor, nowMs, last.at);
384
421
 
385
422
  const nowIso = new Date(nowMs).toISOString();
423
+ const activity = sanitizeActivity(opts.activity);
386
424
  appendLivenessEvent(root, {
387
425
  type: 'heartbeat',
388
426
  subjectId: slug,
389
427
  actor,
390
428
  at: nowIso,
391
429
  source: 'tool-activity',
430
+ // Richer "real liveness": name the tool this pulse rode in on, so the fleet view shows WHAT
431
+ // each agent is doing, not just that it is alive. Omitted entirely when no usable activity.
432
+ ...(activity ? { activity } : {}),
392
433
  });
393
434
  return attachConflictField({ emitted: true }, conflict);
394
435
  } catch (err) {
@@ -18,27 +18,127 @@
18
18
  */
19
19
 
20
20
  const fs = require('fs');
21
+ const os = require('os');
21
22
  const path = require('path');
22
23
  const { spawn } = require('child_process');
23
24
 
25
+ const TRUTHY = new Set(['1', 'true', 'yes', 'on']);
26
+ const FALSY = new Set(['0', 'false', 'no', 'off']);
27
+ // Cheap per-process memo keyed by the exact env inputs, so a throttled hot path does at most one
28
+ // conf read per (env flag, conf path) signature. Keyed inputs make unit tests that vary
29
+ // TELEMETRY_CONFIG_FILE independent.
30
+ const relayEnabledCache = new Map();
31
+
32
+ /**
33
+ * The console-conf resolution chain, mirroring scripts/telemetry/lib/config.sh's slot order:
34
+ * 1. TELEMETRY_CONFIG_FILE (env) if set + readable
35
+ * 2. per-workspace override: <workspace-root>/.kontourai/telemetry-console.conf
36
+ * 3. user-global durable override: <bundle-root>/telemetry-console.conf
37
+ * 4. the shipped default: scripts/telemetry/telemetry.conf (relative to this file)
38
+ * Slot 4's path is <this file>/../../telemetry/telemetry.conf; the workspace root for slot 2 is
39
+ * three levels up from scripts/hooks/lib. This resolver is only the SPAWN pre-gate — it is
40
+ * intentionally lenient (no mode-600 trust gate). relay.sh re-sources config.sh, which applies the
41
+ * trust gate and is the authoritative decision for both enablement and the POST endpoint, so a
42
+ * lenient "enabled" here at worst spawns a relay.sh that then trust-gates itself to a no-op.
43
+ *
44
+ * ACCEPTED, BY DESIGN (security review LOW, A04): because this pre-gate does NOT re-apply
45
+ * config.sh's mode-600/owner gate, it can read an explicit key from an UNtrusted default-path conf
46
+ * (a mode-644 .kontourai/telemetry-console.conf a local tool dropped) that config.sh would skip.
47
+ * This is fail-toward-no-op, never fail-toward-exfil: the only divergence is (a) we spawn a
48
+ * relay.sh that config.sh then no-ops (harmless), or (b) an untrusted `=0` here suppresses a spawn
49
+ * that a trusted conf would have enabled (a missed pulse — availability only, requiring local FS
50
+ * write access). The pre-gate deliberately does not guarantee relay AVAILABILITY — only that we
51
+ * avoid spawning when nothing plausibly enables it. It NEVER weakens the exfil defense, which lives
52
+ * entirely in relay.sh's authoritative, trust-gated re-resolution.
53
+ * @returns {string|null} first readable conf path, or null
54
+ */
55
+ function resolveConsoleConfPath(env) {
56
+ const candidates = [
57
+ env.TELEMETRY_CONFIG_FILE,
58
+ path.join(__dirname, '..', '..', '..', '.kontourai', 'telemetry-console.conf'),
59
+ path.join(os.homedir(), '.flow-agents', 'telemetry-console.conf'),
60
+ path.join(__dirname, '..', '..', 'telemetry', 'telemetry.conf'),
61
+ ];
62
+ for (const c of candidates) {
63
+ try {
64
+ if (c && fs.existsSync(c) && fs.statSync(c).isFile()) return c;
65
+ } catch {
66
+ /* keep scanning */
67
+ }
68
+ }
69
+ return null;
70
+ }
71
+
72
+ /**
73
+ * Conf-driven liveness relay enablement (#567 — parity with the economics relay #469, so an
74
+ * operator enables via `console_liveness_relay=1` in the console conf, NOT an env var/.profile).
75
+ * Precedence mirrors config.sh's economics rule EXACTLY (config.sh:182-204): an explicit
76
+ * `console_liveness_relay` conf key wins over the env var; absent a key, a pre-set env var is
77
+ * honored; absent both, default ON once a console sink is configured (any console_*url key present)
78
+ * — opt-out, not silent-off. Best-effort and cheap: any FS/parse failure falls back to the env-only
79
+ * decision; never throws. This is the spawn pre-gate; relay.sh+config.sh is authoritative.
80
+ */
81
+ function resolveLivenessRelayEnabled(env) {
82
+ const envFlag = String(env.FLOW_AGENTS_CONSOLE_LIVENESS_RELAY || '').toLowerCase();
83
+ const envDecision = TRUTHY.has(envFlag) ? true : FALSY.has(envFlag) ? false : null;
84
+ const cacheKey = `${envFlag}|${env.TELEMETRY_CONFIG_FILE || ''}`;
85
+ if (relayEnabledCache.has(cacheKey)) return relayEnabledCache.get(cacheKey);
86
+ let enabled;
87
+ try {
88
+ let explicit = null;
89
+ let hasConsoleUrl = false;
90
+ const confPath = resolveConsoleConfPath(env);
91
+ if (confPath) {
92
+ for (const raw of fs.readFileSync(confPath, 'utf8').split('\n')) {
93
+ const line = raw.trim();
94
+ if (!line || line.startsWith('#')) continue;
95
+ const eq = line.indexOf('=');
96
+ if (eq < 0) continue;
97
+ const key = line.slice(0, eq).trim();
98
+ const value = line.slice(eq + 1).trim().toLowerCase();
99
+ if (key === 'console_liveness_relay') {
100
+ if (TRUTHY.has(value)) explicit = true;
101
+ else if (FALSY.has(value)) explicit = false;
102
+ } else if (key === 'console_telemetry_url' || key === 'console_url' || key === 'console_telemetry_endpoint_url') {
103
+ if (value) hasConsoleUrl = true;
104
+ }
105
+ }
106
+ }
107
+ // config.sh precedence: explicit conf key > pre-set env var > default-on when a console url resolves.
108
+ enabled = explicit !== null ? explicit : envDecision !== null ? envDecision : hasConsoleUrl;
109
+ } catch {
110
+ enabled = envDecision === true; // best-effort: honor only an explicit env-on if the conf read failed
111
+ }
112
+ relayEnabledCache.set(cacheKey, enabled);
113
+ return enabled;
114
+ }
115
+
24
116
  /**
25
- * OPTIONAL console liveness relay (#295, ADR 0021 §4/§7). Best-effort, FULLY detached mirror of a
26
- * liveness event to the hosted Console via `scripts/liveness/relay.sh`. Local-first is sacred: this
27
- * runs AFTER the durable local append and can never block, throw, or affect it — gated on
28
- * `FLOW_AGENTS_CONSOLE_LIVENESS_RELAY`, the whole thing wrapped so any failure (missing script,
29
- * spawn error) is swallowed. No flag ⇒ a single cheap env read and return (true no-op).
117
+ * OPTIONAL console liveness relay (#295, ADR 0021 §4/§7; conf-driven per #567). Best-effort, FULLY
118
+ * detached mirror of a liveness event to the hosted Console via `scripts/liveness/relay.sh`.
119
+ * Local-first is sacred: this runs AFTER the durable local append and can never block, throw, or
120
+ * affect it — gated on `resolveLivenessRelayEnabled`, the whole thing wrapped so any failure
121
+ * (missing script, spawn error) is swallowed. Not enabled ⇒ a cheap resolve and return (true no-op).
30
122
  *
31
123
  * @param {object} evt The liveness event just written locally.
32
124
  * @returns {void}
33
125
  */
34
126
  function relayLivenessEvent(evt) {
35
127
  try {
36
- const flag = String(process.env.FLOW_AGENTS_CONSOLE_LIVENESS_RELAY || '').toLowerCase();
37
- if (flag !== '1' && flag !== 'true' && flag !== 'yes' && flag !== 'on') return;
128
+ if (!resolveLivenessRelayEnabled(process.env)) return;
38
129
  // scripts/hooks/lib/ -> scripts/liveness/relay.sh (same relative layout in dist/* bundles).
39
130
  const relay = path.join(__dirname, '..', '..', 'liveness', 'relay.sh');
40
131
  if (!fs.existsSync(relay)) return;
41
- const child = spawn('bash', [relay, JSON.stringify(evt)], { detached: true, stdio: 'ignore' });
132
+ // Pass the environment through UNCHANGED do not force the enable flag. relay.sh re-sources
133
+ // config.sh, which is the authoritative, trust-gated decision for both enablement (conf key >
134
+ // env > default-on) and the POST endpoint. Our resolve above is only a lenient spawn pre-gate:
135
+ // if we enabled from an untrusted default-path conf, config.sh trust-gates relay.sh to a no-op
136
+ // rather than us bypassing it by forcing the flag on.
137
+ const child = spawn('bash', [relay, JSON.stringify(evt)], {
138
+ detached: true,
139
+ stdio: 'ignore',
140
+ env: process.env,
141
+ });
42
142
  child.on('error', () => {}); // never surface a spawn failure
43
143
  child.unref(); // fully detach — the parent never waits on the relay
44
144
  } catch {
@@ -70,4 +170,4 @@ function appendLivenessEvent(root, evt) {
70
170
  relayLivenessEvent(evt); // then optionally mirror to the Console — best-effort, detached, off by default
71
171
  }
72
172
 
73
- module.exports = { livenessStreamFile, appendLivenessEvent };
173
+ module.exports = { livenessStreamFile, appendLivenessEvent, resolveLivenessRelayEnabled };