@attalabs/vinaya 0.36.0 → 0.38.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 (292) hide show
  1. package/README.md +6 -6
  2. package/aeg-root/contracts/developer-reviewer.md +1 -1
  3. package/aeg-root/contracts/planner-operator.md +1 -1
  4. package/aeg-root/contracts/principal-operator.md +6 -6
  5. package/aeg-root/contracts/security-archivist.md +1 -1
  6. package/aeg-root/enforcement.md +14 -14
  7. package/aeg-root/process.md +3 -1
  8. package/aeg-root/roles/archivist.md +2 -2
  9. package/aeg-root/roles/developer/reference.md +36 -37
  10. package/aeg-root/roles/developer.md +9 -5
  11. package/aeg-root/roles/operator.md +18 -18
  12. package/aeg-root/roles/planner/reference.md +15 -4
  13. package/aeg-root/roles/principal.md +6 -1
  14. package/aeg-root/roles/reviewer.md +14 -6
  15. package/aeg-root/roles/security.md +22 -11
  16. package/aeg-root/roles/tranche-archivist.md +14 -2
  17. package/aeg-root/state-machine.md +12 -11
  18. package/aeg-root/templates/brief-template.md +8 -6
  19. package/aeg-root/templates/pr-report-template.md +1 -9
  20. package/aeg-root/tranche-model.md +10 -4
  21. package/dist/checks/bin/check-body-bare-digits.js +823 -595
  22. package/dist/checks/bin/check-branch-topology.js +796 -478
  23. package/dist/checks/bin/check-brief-shape.js +824 -596
  24. package/dist/checks/bin/check-changeset-coverage.js +1337 -747
  25. package/dist/checks/bin/check-closes-n.js +796 -478
  26. package/dist/checks/bin/check-coherence.js +914 -611
  27. package/dist/checks/bin/check-dead-branch-push.js +705 -462
  28. package/dist/checks/bin/check-dispatch-readiness.js +941 -624
  29. package/dist/checks/bin/check-doc-coverage-push.js +1332 -742
  30. package/dist/checks/bin/check-doc-coverage.js +1339 -742
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +821 -593
  32. package/dist/checks/bin/check-doctrine-portability.js +1332 -742
  33. package/dist/checks/bin/check-evidence-fresh.js +1339 -918
  34. package/dist/checks/bin/check-exec-bits.js +1331 -741
  35. package/dist/checks/bin/check-first-push-dispatch.js +917 -614
  36. package/dist/checks/bin/check-issue-assignment.js +796 -478
  37. package/dist/checks/bin/check-issue-milestone-attach.js +705 -462
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +821 -593
  39. package/dist/checks/bin/check-issue-parts-coverage.js +705 -462
  40. package/dist/checks/bin/check-issue-surface-globs.js +925 -613
  41. package/dist/checks/bin/check-issue-title-grammar.js +705 -462
  42. package/dist/checks/bin/check-issue-tranche-label.js +705 -462
  43. package/dist/checks/bin/check-main-branch-refusal.js +705 -462
  44. package/dist/checks/bin/check-no-disk-state.js +705 -462
  45. package/dist/checks/bin/check-pr-premise-reassert.js +821 -593
  46. package/dist/checks/bin/check-pr-report-density.js +705 -462
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +705 -462
  48. package/dist/checks/bin/check-quoted-command.js +1816 -1228
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +1835 -1235
  50. package/dist/checks/bin/check-registry-gates.js +993 -526
  51. package/dist/checks/bin/check-retired-vocabulary.js +1810 -1222
  52. package/dist/checks/bin/check-review-gate.js +832 -604
  53. package/dist/checks/bin/check-single-plan-pr.js +705 -462
  54. package/dist/checks/bin/check-surface-scope.js +796 -478
  55. package/dist/checks/bin/check-test-plan.js +705 -462
  56. package/dist/checks/bin/check-token-collection-wired.js +705 -462
  57. package/dist/checks/bin/check-workspace-escape.js +1332 -742
  58. package/dist/checks/bin/verify-dispatch.js +3849 -0
  59. package/dist/index.js +20876 -10091
  60. package/dist/lib/pre-push-cache-test-run.js +1045 -682
  61. package/dist/lib/pre-push-changed-files.js +16 -11
  62. package/dist/lib/pre-push-select-tests.js +785 -500
  63. package/package.json +2 -2
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +7 -6
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +71 -15
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +51 -12
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +1 -0
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +31 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +50 -2
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +443 -28
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +18 -5
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +6 -4
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +13 -13
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +46 -110
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +169 -11
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +3 -1
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +30 -0
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -2
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +0 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +82 -8
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +754 -7
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +24 -6
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/custom.ts +157 -0
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +44 -6
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/executions.ts +493 -0
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/fact-sheets.ts +111 -0
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/generator.ts +155 -0
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/index.ts +12 -0
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +128 -0
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/catches.ts +63 -0
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/checks.ts +146 -0
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/common.ts +137 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/completion.ts +137 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/convergence.ts +420 -0
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/determinism.ts +65 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/index.ts +69 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/judgment.ts +132 -0
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/labels.ts +21 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/time.ts +167 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/usage.ts +139 -0
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +226 -15
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +7 -7
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/cache-contract.ts +207 -0
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/contracts.ts +105 -0
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/engine.ts +308 -0
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/index.ts +34 -0
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/measured.ts +20 -0
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/memory-cache.ts +78 -0
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/normalize.ts +156 -0
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/row.ts +103 -0
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +34 -6
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +70 -6
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +19 -14
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +201 -24
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +5 -2
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +46 -0
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +15 -28
  120. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  123. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  124. package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
  125. package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0h9yhwx._.js +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__0jdjsxe._.js} +2 -2
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
  205. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
  207. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
  208. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
  209. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
  210. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
  212. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
  213. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
  214. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  215. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  216. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  217. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  218. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
  219. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
  220. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
  221. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1-acpmtfmrc35.js +1 -0
  222. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
  223. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
  224. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
  225. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
  226. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 2f2y8xxok8zph.js} +1 -1
  227. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
  228. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
  229. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
  230. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
  231. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 2xevgia1h8g0y.js} +2 -2
  232. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
  233. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
  234. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
  235. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  236. package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
  237. package/dist/checks/bin/check-token-report.js +0 -6526
  238. package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
  239. package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
  240. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
  241. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
  242. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
  243. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
  244. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
  245. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
  246. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
  247. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
  248. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
  249. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
  250. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
  251. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
  252. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
  253. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
  254. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
  255. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
  256. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
  257. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
  258. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
  259. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
  260. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
  261. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
  262. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
  263. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
  264. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
  265. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
  266. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
  267. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
  268. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
  269. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
  270. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
  271. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
  272. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
  273. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00z3-ljjd1gj9.js +0 -1
  274. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
  275. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
  276. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
  277. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
  278. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
  279. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
  280. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
  281. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
  282. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
  283. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
  284. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
  285. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
  286. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
  287. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
  288. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
  289. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
  290. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_buildManifest.js +0 -0
  291. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_clientMiddlewareManifest.js +0 -0
  292. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_ssgManifest.js +0 -0
@@ -16,8 +16,9 @@
16
16
  * same thing) or `2` (adds `event_id`, `process_id`, `lineage`,
17
17
  * `input_versions`, `provenance` — O1's "task/run/attempt/parent lineage,
18
18
  * producer sequence, opaque role and process identifiers, input versions
19
- * and trust provenance"). `buildHeader` (`envelope.ts`) builds `2` for
20
- * every event from this task forward; `1` exists so a line already on disk
19
+ * and trust provenance") or `3` (adds `work`, `flow`, `runtime`, `source`).
20
+ * `buildHeader` (`envelope.ts`) builds `3` for every event; `1` and `2`
21
+ * exist so a line already on disk
21
22
  * (or a fixture recorded before this task) keeps parsing, never a schema
22
23
  * violation just because it predates these fields (O1's "compatible").
23
24
  * Absent per-field data on a `2` header is `null`, never invented — the
@@ -43,6 +44,14 @@
43
44
  */
44
45
 
45
46
  import { z } from 'zod'
47
+ import {
48
+ CUSTOM_EVENT_MAX_FIELDS,
49
+ CUSTOM_EVENT_NAME_MAX_LENGTH,
50
+ CUSTOM_EVENT_NAME_PATTERN,
51
+ CUSTOM_FIELD_NAME_MAX_LENGTH,
52
+ CUSTOM_FIELD_NAME_PATTERN,
53
+ CUSTOM_TEXT_MAX_LENGTH
54
+ } from './custom'
46
55
 
47
56
  /**
48
57
  * The one bound shared by `gate_result_read.confidence_reason` below and the
@@ -146,10 +155,58 @@ const HeaderMetaV2Schema = z
146
155
  })
147
156
  .strict()
148
157
 
149
- const HeaderMetaSchema = z.discriminatedUnion('schema', [HeaderMetaV1Schema, HeaderMetaV2Schema])
150
- export { HeaderMetaV1Schema, HeaderMetaV2Schema, LineageSchema, InputVersionsSchema, ProvenanceSchema }
158
+ /** The unit of work an event belongs to (schema 3). `ref` is opaque — an Issue number as text, a ticket key, a branch name; the log never parses it. Each part is `null` until a caller names it, never guessed. */
159
+ const WorkSchema = z
160
+ .object({
161
+ ref: z.string().nullable(),
162
+ repo: z.string().nullable(),
163
+ change: z.string().nullable(),
164
+ revision: z.string().nullable()
165
+ })
166
+ .strict()
167
+
168
+ /** The way of working an event belongs to (schema 3): an opaque id and a version. Vinaya's own process reads `id: 'vinaya'`; a foreign one names itself or stays `null`. */
169
+ const FlowSchema = z
170
+ .object({
171
+ id: z.string().nullable(),
172
+ version: z.string().nullable()
173
+ })
174
+ .strict()
175
+
176
+ /** Schema 3 = every schema 2 field, unchanged, plus `work`, `flow`, `runtime` and `source`. A new version rather than extra fields on 2: a server that knows only 1 and 2 keeps a 3 line as an unknown-version record, where an extra field on 2 would be rejected as invalid. */
177
+ const HeaderMetaV3Schema = z
178
+ .object({
179
+ schema: z.literal(3),
180
+ ...headerMetaCore,
181
+ event_id: z.string().min(1),
182
+ process_id: z.string().min(1),
183
+ actor_id: z.string().nullable(),
184
+ lineage: LineageSchema,
185
+ input_versions: InputVersionsSchema,
186
+ provenance: ProvenanceSchema,
187
+ work: WorkSchema,
188
+ flow: FlowSchema,
189
+ runtime: z.string().nullable(),
190
+ source: z.string().nullable()
191
+ })
192
+ .strict()
193
+
194
+ const HeaderMetaSchema = z.discriminatedUnion('schema', [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema])
195
+ export {
196
+ HeaderMetaV1Schema,
197
+ HeaderMetaV2Schema,
198
+ HeaderMetaV3Schema,
199
+ WorkSchema,
200
+ FlowSchema,
201
+ LineageSchema,
202
+ InputVersionsSchema,
203
+ ProvenanceSchema
204
+ }
151
205
  export type HeaderMetaV1 = z.infer<typeof HeaderMetaV1Schema>
152
206
  export type HeaderMetaV2 = z.infer<typeof HeaderMetaV2Schema>
207
+ export type HeaderMetaV3 = z.infer<typeof HeaderMetaV3Schema>
208
+ export type Work = z.infer<typeof WorkSchema>
209
+ export type Flow = z.infer<typeof FlowSchema>
153
210
  export type Lineage = z.infer<typeof LineageSchema>
154
211
  export type InputVersions = z.infer<typeof InputVersionsSchema>
155
212
  export type Provenance = z.infer<typeof ProvenanceSchema>
@@ -300,8 +357,29 @@ export const DispatchEventSchema = z.discriminatedUnion('event', [
300
357
  export type DispatchEvent = z.infer<typeof DispatchEventSchema>
301
358
 
302
359
  // ---------------------------------------------------------------------------
303
- // `dev_review_loop` family (§5.2) — twelve events (a later addition added
304
- // `cancelled`), `loop_id` shared on each.
360
+ // `dev_review_loop` family (§5.2) — `loop_id` shared on each. Later
361
+ // additions widened it past the spec's original set: `cancelled`,
362
+ // `infrastructure_retry`, and the `driver_heartbeat`/`driver_exited`
363
+ // liveness pair that lets a reader tell a running loop from a dead one.
364
+
365
+ /**
366
+ * A short code token: letters, digits, dot, dash, underscore, 64 characters
367
+ * at most. The shape carries no path separator, no whitespace and no room for
368
+ * a sentence, so a pause code or an error class can never hold a path or a
369
+ * message. Used by `paused.reason_code` and `driver_exited.error_class`.
370
+ */
371
+ export const CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/
372
+ const CodeTokenSchema = z.string().regex(CODE_TOKEN_PATTERN)
373
+
374
+ /** One reviewer role's outcome in a round's `verdicts_read`: the role, one of three words, and how many blocking verdicts it contributed (0 or 1). */
375
+ const ReviewerVerdictSchema = z
376
+ .object({
377
+ role: RoleSchema,
378
+ outcome: z.enum(['approve', 'changes_requested', 'not_reviewed']),
379
+ blockers: z.number().int().nonnegative()
380
+ })
381
+ .strict()
382
+ export type ReviewerVerdict = z.infer<typeof ReviewerVerdictSchema>
305
383
 
306
384
  const loopShared = {
307
385
  meta: HeaderMetaSchema,
@@ -370,7 +448,12 @@ export const DevReviewLoopEventSchema = z.discriminatedUnion('event', [
370
448
  // — a schema change is additive here, never a reason an old line on
371
449
  // disk starts reading as corrupt. This task's own producer
372
450
  // (`assess-round.ts`) always sets it explicitly, `[]` included.
373
- findings: z.array(ReviewFindingSchema).optional()
451
+ findings: z.array(ReviewFindingSchema).optional(),
452
+ // One entry per reviewer role the loop held or expected a verdict from,
453
+ // so a reader tells a role that approved with no findings from one that
454
+ // never reported. The entries' `blockers` add up to `blockers` above.
455
+ // Optional: a line recorded before it existed still parses.
456
+ reviewers: z.array(ReviewerVerdictSchema).optional()
374
457
  })
375
458
  .strict(),
376
459
  z
@@ -394,6 +477,14 @@ export const DevReviewLoopEventSchema = z.discriminatedUnion('event', [
394
477
  // confidence collapse and a finding-id reappearance are each their own
395
478
  // condition, distinguished from the generic `no_progress` stall and
396
479
  // from each other, rather than collapsing all three into one value.
480
+ // `repeat_finding` and `repeat_failure` widen it the same way: a
481
+ // blocking finding open for two consecutive reviewed rounds, and two
482
+ // consecutive attempts ending on the same mechanical failure, are each
483
+ // their own condition too — never folded into `no_progress`, whose own
484
+ // (removed) rule paused on any round that resolved nothing.
485
+ // `time_budget` widens it once more, and is the only member that counts
486
+ // neither rounds nor findings: the task's wall clock passed its
487
+ // configured budget, whatever the time went to.
397
488
  condition: z.enum([
398
489
  'green',
399
490
  'max_rounds',
@@ -401,7 +492,10 @@ export const DevReviewLoopEventSchema = z.discriminatedUnion('event', [
401
492
  'escalated',
402
493
  'principal_stop',
403
494
  'confidence',
404
- 'reappearance'
495
+ 'reappearance',
496
+ 'repeat_finding',
497
+ 'repeat_failure',
498
+ 'time_budget'
405
499
  ])
406
500
  })
407
501
  .strict(),
@@ -410,7 +504,12 @@ export const DevReviewLoopEventSchema = z.discriminatedUnion('event', [
410
504
  ...loopShared,
411
505
  event: z.literal('paused'),
412
506
  round: z.number().int(),
413
- reason: z.enum(['escalation', 'principal_item', 'refreeze_needed'])
507
+ reason: z.enum(['escalation', 'principal_item', 'refreeze_needed']),
508
+ // The loop's own pause reason code (`confidence`, `max_rounds`,
509
+ // `infrastructure`, …) as a short string, never prose and never a closed
510
+ // list: a new pause reason needs no schema change. Optional: a line
511
+ // recorded before it existed still parses.
512
+ reason_code: CodeTokenSchema.optional()
414
513
  })
415
514
  .strict(),
416
515
  z
@@ -511,6 +610,53 @@ export const DevReviewLoopEventSchema = z.discriminatedUnion('event', [
511
610
  attempts: z.number().int().positive(),
512
611
  outcome: z.enum(['recovered', 'exhausted'])
513
612
  })
613
+ .strict(),
614
+ // (O1/O3) A liveness ping the driver emits at most every five
615
+ // minutes while its process is alive — the Log's one positive signal that
616
+ // a loop is running, as opposed to finished, paused or dead. Before it, a
617
+ // loop in its first Developer turn and one that died before pushing both
618
+ // looked identical from the Log (`loop_started` with nothing after). A NEW,
619
+ // additive member: a line written before this task carries none of these
620
+ // fields and parses exactly as it always did. `task` is the task Issue
621
+ // (the same number `subject.issue` carries, repeated here so a reader has
622
+ // it without resolving the envelope); `pr` is the pull request once one
623
+ // exists (absent on a first turn before any PR has opened); `round` and
624
+ // `phase` are the loop's current round and phase (`phase` the same
625
+ // free-form string the control store's own `loop_state.phase` carries —
626
+ // `dispatch_developer`, `publish`, `pause`, …). The machine it runs on is
627
+ // `meta.machine`, on every line already.
628
+ z
629
+ .object({
630
+ ...loopShared,
631
+ event: z.literal('driver_heartbeat'),
632
+ task: z.number().int(),
633
+ pr: z.number().int().positive().optional(),
634
+ round: z.number().int(),
635
+ phase: z.string()
636
+ })
637
+ .strict(),
638
+ // (O2/O3) Emitted exactly once when a review-loop driver process
639
+ // ends, on every exit path the driver already traces in its role log
640
+ // (a re-exec hand-off, an uncaught error, an OS signal) plus a normal
641
+ // return (a clean `publish` is `finished`, a decided pause is `paused`).
642
+ // The twin of `driver_heartbeat` above: a heartbeat says "still alive," a
643
+ // `driver_exited` says "stopped, and why." `last_decision` is the driver's
644
+ // last decision in the same form its role-log line records it — `publish`,
645
+ // or `pause(<reason>)`. A NEW, additive member; an earlier line parses
646
+ // unchanged.
647
+ z
648
+ .object({
649
+ ...loopShared,
650
+ event: z.literal('driver_exited'),
651
+ task: z.number().int(),
652
+ reason: z.enum(['finished', 'paused', 'reexec', 'error', 'signal']),
653
+ last_decision: z.string(),
654
+ // The process exit code when the driver ends with one, and — when it
655
+ // ends on an error — the error's own code or constructor name, never its
656
+ // message. Both optional: a line recorded before them still parses.
657
+ exit_code: z.number().int().optional(),
658
+ error_class: CodeTokenSchema.optional()
659
+ })
514
660
  .strict()
515
661
  ])
516
662
  export type DevReviewLoopEvent = z.infer<typeof DevReviewLoopEventSchema>
@@ -559,7 +705,8 @@ export const ForgeWriteEventSchema = z.discriminatedUnion('event', [
559
705
  export type ForgeWriteEvent = z.infer<typeof ForgeWriteEventSchema>
560
706
 
561
707
  // ---------------------------------------------------------------------------
562
- // `gate` family (O2) — one gate runner's attempted check. `loop` (the
708
+ // `gate` family (O2) — one gate runner's check run: a `summary` per run and a
709
+ // `checked` event for each check that did not pass. `loop` (the
563
710
  // spec's "loop coordinator") is already typed by `dev_review_loop` above;
564
711
  // this task does not introduce a second loop schema for it.
565
712
 
@@ -594,6 +741,27 @@ export const GateEventSchema = z.discriminatedUnion('event', [
594
741
  outcome: GateOutcomeSchema,
595
742
  reason: z.string().optional()
596
743
  })
744
+ .strict(),
745
+ // One per check run. A run records this and a `checked` event only for a
746
+ // check that did not pass, so the Log's volume tracks failures, not the
747
+ // number of checks. `ran` counts the checks that executed (`passed` +
748
+ // `failed`); `skipped` are not in it. `failed` is every executed check that
749
+ // did not pass — a failure, a wait, a timeout or an error — and
750
+ // `failed_checks` names them. The run's total time is the envelope's
751
+ // `duration_ms`.
752
+ z
753
+ .object({
754
+ meta: HeaderMetaSchema,
755
+ subject: SubjectSchema,
756
+ kind: z.literal('gate'),
757
+ ...envelopeTail,
758
+ event: z.literal('summary'),
759
+ ran: z.number().int().nonnegative(),
760
+ passed: z.number().int().nonnegative(),
761
+ failed: z.number().int().nonnegative(),
762
+ skipped: z.number().int().nonnegative(),
763
+ failed_checks: z.array(z.string())
764
+ })
597
765
  .strict()
598
766
  ])
599
767
  export type GateEvent = z.infer<typeof GateEventSchema>
@@ -621,7 +789,12 @@ export const OperationEventSchema = z.discriminatedUnion('event', [
621
789
  ...operationShared,
622
790
  event: z.literal('completed'),
623
791
  result: OperationResultSchema,
624
- error_class: z.string().nullable()
792
+ error_class: z.string().nullable(),
793
+ // The field NAMES an operation's outcome concerns — a refused `custom`
794
+ // event's missing, extra or mistyped fields — never their values,
795
+ // since a rejected value may be the secret. Optional: no other
796
+ // operation sets it, and a line written before it existed still parses.
797
+ field_names: z.array(z.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
625
798
  })
626
799
  .strict()
627
800
  ])
@@ -749,8 +922,10 @@ export type HandoffEvent = z.infer<typeof HandoffEventSchema>
749
922
 
750
923
  // ---------------------------------------------------------------------------
751
924
  // `effect` family (O2) — the spec's "shared effect executor": a generic
752
- // external effect's attempted/observed/verified outcome, including failure
753
- // and uncertainty. This is additive to, and does not replace, the existing
925
+ // external effect's outcome, including failure and uncertainty. The
926
+ // executor records ONE `verified` event per write, carrying its final
927
+ // outcome; `attempted` and `observed` stay parseable so a line stored
928
+ // before that change still reads, but nothing emits them any more. This is additive to, and does not replace, the existing
754
929
  // `forge_write` family, which stays exactly as it was — a forge write is
755
930
  // one specific effect this schema does not yet generalize `forge_write`
756
931
  // into; "telemetry never substitutes for required intent" (the spec's own
@@ -784,9 +959,44 @@ export const EffectEventSchema = z.discriminatedUnion('event', [
784
959
  ])
785
960
  export type EffectEvent = z.infer<typeof EffectEventSchema>
786
961
 
962
+ // ---------------------------------------------------------------------------
963
+ // `custom` family — an event a consumer declared under `logs.events` in its
964
+ // own `vinaya.config.json` (`custom.ts`). `kind` and `event` are fixed; the
965
+ // declared name is data in `name`, and the values sit flat under `fields`,
966
+ // never nested. Whether `name` is declared and each value matches its
967
+ // declared type is the writer's check (`checkCustomEvent`) — this schema
968
+ // holds only the shape every declaration shares. Valid under a schema 3
969
+ // header only: the family is newer than 1 and 2, so a line claiming either
970
+ // with a `custom` body is not one this log ever wrote.
971
+
972
+ const CustomFieldValueSchema = z.union([z.string().max(CUSTOM_TEXT_MAX_LENGTH), z.number().finite(), z.boolean()])
973
+
974
+ const customShared = {
975
+ meta: HeaderMetaV3Schema,
976
+ subject: SubjectSchema,
977
+ kind: z.literal('custom'),
978
+ ...envelopeTail
979
+ }
980
+
981
+ export const CustomEventSchema = z.discriminatedUnion('event', [
982
+ z
983
+ .object({
984
+ ...customShared,
985
+ event: z.literal('recorded'),
986
+ name: z.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
987
+ fields: z
988
+ .record(z.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH).regex(CUSTOM_FIELD_NAME_PATTERN), CustomFieldValueSchema)
989
+ .refine((f) => Object.keys(f).length <= CUSTOM_EVENT_MAX_FIELDS, {
990
+ message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
991
+ })
992
+ })
993
+ .strict()
994
+ ])
995
+ export type CustomEvent = z.infer<typeof CustomEventSchema>
996
+
787
997
  // ---------------------------------------------------------------------------
788
998
 
789
- /** Every family shipped so far: the first three (`dispatch`, `dev_review_loop`, `forge_write`) plus this task's six (`gate`, `operation`, `usage`, `role_attempt`, `handoff`, `effect`). `kind: 'command' | 'tokens'` is still refused — `command` folds into `operation`, `tokens` into `usage`, so neither name is a separate family. */
999
+ /** Every family shipped so far: the first three (`dispatch`, `dev_review_loop`, `forge_write`), the six after them (`gate`, `operation`, `usage`, `role_attempt`, `handoff`, `effect`), and `custom`, a consumer's own declared event. `kind: 'command' | 'tokens'` is still refused — `command` folds into `operation`, `tokens` into `usage`, so neither name is a separate family. */
790
1000
  export const LogEventSchema = z.union([
791
1001
  DispatchEventSchema,
792
1002
  DevReviewLoopEventSchema,
@@ -796,6 +1006,7 @@ export const LogEventSchema = z.union([
796
1006
  UsageEventSchema,
797
1007
  RoleAttemptEventSchema,
798
1008
  HandoffEventSchema,
799
- EffectEventSchema
1009
+ EffectEventSchema,
1010
+ CustomEventSchema
800
1011
  ])
801
1012
  export type LogEvent = z.infer<typeof LogEventSchema>
@@ -19,7 +19,7 @@
19
19
  * overflow past a store's capacity is REPORTED (`AppendOutcome.overflow`),
20
20
  * never the silent single-slot overwrite the outbox rotation performed.
21
21
  * Read-back (`readPage` / `classifyStoredLine`) validates each line's schema
22
- * version and — for a `schema: 2` line — its provenance, re-applies
22
+ * version and — for a `schema: 2` or `3` line — its provenance, re-applies
23
23
  * `redact()` at the read (transport) boundary, and PRESERVES a record whose
24
24
  * schema version this build has never heard of as an `unknown_version`
25
25
  * record for diagnosis rather than dropping it or failing the whole page.
@@ -32,14 +32,14 @@ import { LogEventSchema, type LogEvent, type Provenance } from './schema'
32
32
  * The schema versions this build validates in full. A stored line carrying a
33
33
  * `meta.schema` outside this set is neither trusted nor discarded — it is
34
34
  * kept as an `unknown_version` read record (O3). Mirrors the
35
- * `HeaderMetaSchema` discriminated union in `schema.ts` (`1` | `2`); a future
35
+ * `HeaderMetaSchema` discriminated union in `schema.ts` (`1` | `2` | `3`); a future
36
36
  * task widening that union widens this set in the same change.
37
37
  */
38
- export const KNOWN_SCHEMA_VERSIONS = [1, 2] as const
38
+ export const KNOWN_SCHEMA_VERSIONS = [1, 2, 3] as const
39
39
 
40
40
  /**
41
41
  * A record's stable identity across retry, concurrent append and a lost
42
- * acknowledgement (O2). A `schema: 2` line carries a per-event `event_id`,
42
+ * acknowledgement (O2). A `schema: 2` or `3` line carries a per-event `event_id`,
43
43
  * generated once per `log()` call — that is the identity. A `schema: 1` line
44
44
  * predates `event_id`; its identity is `${run_id}:${seq}`, the same
45
45
  * `run_id`/`seq` pair the flush's `<!-- aeg:log:<run_id>:<seq> -->` marker is
@@ -94,7 +94,7 @@ export type ReadRecord =
94
94
  runId: string
95
95
  seq: number
96
96
  schema: number
97
- /** Trust provenance for a `schema: 2` line; `null` for a `schema: 1` line, which has no such field. */
97
+ /** Trust provenance for a `schema: 2` or `3` line; `null` for a `schema: 1` line, which has no such field. */
98
98
  provenance: Provenance | null
99
99
  /** The re-validated event. */
100
100
  event: LogEvent
@@ -119,7 +119,7 @@ export type ReadRecord =
119
119
 
120
120
  /**
121
121
  * Classifies one stored line: validates its schema version and (for
122
- * `schema: 2`) its provenance, re-applies `redact(event, home)` at this read
122
+ * `schema: 2` or `3`) its provenance, re-applies `redact(event, home)` at this read
123
123
  * (transport) boundary, and distinguishes three outcomes:
124
124
  *
125
125
  * - `ok` — a known schema version that fully re-validated. `postLine` is the
@@ -177,7 +177,7 @@ export function classifyStoredLine(raw: string, home: string): ReadRecord {
177
177
  }
178
178
 
179
179
  const redacted = redact(event, home)
180
- const provenance = version === 2 ? ((event.meta as { provenance?: Provenance }).provenance ?? null) : null
180
+ const provenance = version >= 2 ? ((event.meta as { provenance?: Provenance }).provenance ?? null) : null
181
181
  return {
182
182
  status: 'ok',
183
183
  identity,
@@ -0,0 +1,207 @@
1
+ /**
2
+ * The cache contract's behaviours, written once (`apps/cli/specs/log-sync.md`).
3
+ * Every `LogCache` backend's own test runs each case against a fresh
4
+ * instance of that backend:
5
+ *
6
+ * for (const c of cacheContractCases) it(c.name, () => c.run(createMyCache()))
7
+ *
8
+ * A case throws on the first broken expectation. No test framework is
9
+ * imported here, so a backend in any package can run the same list.
10
+ */
11
+
12
+ import type { LogCache } from './contracts'
13
+ import { unknownBecause, known } from './measured'
14
+ import { normalizeStoredLine } from './normalize'
15
+ import type { NormalizedLine, RowOrigin } from './row'
16
+
17
+ export type CacheContractCase = {
18
+ name: string
19
+ run(cache: LogCache): void
20
+ }
21
+
22
+ function check(condition: boolean, message: string): void {
23
+ if (!condition) throw new Error(`cache contract: ${message}`)
24
+ }
25
+
26
+ function same(actual: unknown, expected: unknown, message: string): void {
27
+ const a = JSON.stringify(actual)
28
+ const e = JSON.stringify(expected)
29
+ check(a === e, `${message} — expected ${e}, got ${a}`)
30
+ }
31
+
32
+ /** A valid schema 3 `operation` line with the given identity, time and result. */
33
+ function line(eventId: string, ts: string, result = 'ok', origin: RowOrigin | null = null): NormalizedLine {
34
+ const raw = JSON.stringify({
35
+ meta: {
36
+ schema: 3,
37
+ ts,
38
+ run_id: 'contract-run',
39
+ seq: 0,
40
+ repo: 'owner/repo',
41
+ vinaya: '0.36.0',
42
+ doctrine: 'aeg-root@contract',
43
+ host: 'cli',
44
+ machine: 'contract-machine',
45
+ event_id: eventId,
46
+ process_id: 'contract-process',
47
+ actor_id: null,
48
+ lineage: { run: null, attempt: null, parent: null },
49
+ input_versions: { objectives_version: null, brief_hash: null, ruling_ordinal: null, policy_digest: null },
50
+ provenance: 'unavailable',
51
+ work: { ref: null, repo: null, change: null, revision: null },
52
+ flow: { id: 'vinaya', version: null },
53
+ runtime: null,
54
+ source: null
55
+ },
56
+ subject: { issue: null, role: 'unattributed' },
57
+ kind: 'operation',
58
+ event: 'completed',
59
+ payload: {},
60
+ operation: 'contract',
61
+ target: null,
62
+ result,
63
+ error_class: null
64
+ })
65
+ const normalized = normalizeStoredLine(raw, origin)
66
+ check(normalized.type === 'row', 'fixture line must normalise into a row')
67
+ return normalized
68
+ }
69
+
70
+ function quarantined(raw: string, origin: RowOrigin | null = null): NormalizedLine {
71
+ const normalized = normalizeStoredLine(raw, origin)
72
+ check(normalized.type === 'quarantine', 'fixture line must normalise into a quarantine record')
73
+ return normalized
74
+ }
75
+
76
+ const T1 = '2026-09-20T10:00:00.000Z'
77
+ const T2 = '2026-09-20T11:00:00.000Z'
78
+
79
+ export const cacheContractCases: readonly CacheContractCase[] = [
80
+ {
81
+ name: 'storing one identity twice leaves one row',
82
+ run(cache) {
83
+ same(
84
+ cache.put(line('e-1', T1, 'ok', { source: 'a', position: '1' })),
85
+ { type: 'row', result: 'inserted' },
86
+ 'first put'
87
+ )
88
+ same(
89
+ cache.put(line('e-1', T1, 'ok', { source: 'b', position: '9' })),
90
+ { type: 'row', result: 'duplicate' },
91
+ 'second put'
92
+ )
93
+ const rows = cache.dataset().rows()
94
+ same(
95
+ rows.map((r) => r.identity),
96
+ ['e-1'],
97
+ 'rows'
98
+ )
99
+ same(rows[0]?.origin, { source: 'a', position: '1' }, 'the first origin is kept')
100
+ same(cache.edits(), [], 'no edit for identical content')
101
+ }
102
+ },
103
+ {
104
+ name: 'storing one identity with different content keeps the first row and records one edit',
105
+ run(cache) {
106
+ const first = line('e-1', T1, 'ok')
107
+ const edited = line('e-1', T1, 'error', { source: 'b', position: '2' })
108
+ cache.put(first)
109
+ same(cache.put(edited), { type: 'row', result: 'edited' }, 'edited put')
110
+ same(cache.put(edited), { type: 'row', result: 'edited' }, 'repeated edited put')
111
+ const rows = cache.dataset().rows()
112
+ same(rows.length, 1, 'row count')
113
+ check(first.type === 'row' && edited.type === 'row', 'fixtures are rows')
114
+ if (first.type !== 'row' || edited.type !== 'row') return
115
+ same(rows[0]?.contentHash, first.row.contentHash, 'the kept row is the first')
116
+ same(
117
+ cache.edits(),
118
+ [
119
+ {
120
+ identity: 'e-1',
121
+ keptHash: first.row.contentHash,
122
+ editedHash: edited.row.contentHash,
123
+ origin: { source: 'b', position: '2' }
124
+ }
125
+ ],
126
+ 'edits'
127
+ )
128
+ }
129
+ },
130
+ {
131
+ name: 'rows read back ordered by time, then identity',
132
+ run(cache) {
133
+ cache.put(line('e-3', T2))
134
+ cache.put(line('e-2', T1))
135
+ cache.put(line('e-1', T2))
136
+ same(
137
+ cache
138
+ .dataset()
139
+ .rows()
140
+ .map((r) => r.identity),
141
+ ['e-2', 'e-1', 'e-3'],
142
+ 'order'
143
+ )
144
+ }
145
+ },
146
+ {
147
+ name: 'a row reads back exactly as stored',
148
+ run(cache) {
149
+ const stored = line('e-1', T1, 'ok', { source: 'a', position: '7' })
150
+ cache.put(stored)
151
+ check(stored.type === 'row', 'fixture is a row')
152
+ if (stored.type !== 'row') return
153
+ same(cache.dataset().rows()[0], stored.row, 'row')
154
+ }
155
+ },
156
+ {
157
+ name: 'a source cursor reads back as written, per source',
158
+ run(cache) {
159
+ same(cache.cursor('folder:/logs'), null, 'no cursor yet')
160
+ cache.setCursor('folder:/logs', 'a.ndjson:10')
161
+ cache.setCursor('server:https://logs', '42')
162
+ cache.setCursor('folder:/logs', 'b.ndjson:3')
163
+ same(cache.cursor('folder:/logs'), 'b.ndjson:3', 'folder cursor')
164
+ same(cache.cursor('server:https://logs'), '42', 'server cursor')
165
+ }
166
+ },
167
+ {
168
+ name: 'a gap reads back as written, and recording it twice keeps one',
169
+ run(cache) {
170
+ const counted = {
171
+ source: 'folder:/logs',
172
+ from: 'a.ndjson:1',
173
+ to: 'a.ndjson:90',
174
+ reason: 'rotated away',
175
+ lost: known(90)
176
+ }
177
+ const uncounted = {
178
+ source: 'server:https://logs',
179
+ from: null,
180
+ to: '100',
181
+ reason: 'past retention',
182
+ lost: unknownBecause<number>('the server does not count expired events')
183
+ }
184
+ cache.recordGap(counted)
185
+ cache.recordGap(uncounted)
186
+ cache.recordGap(counted)
187
+ same(cache.dataset().gaps(), [counted, uncounted], 'gaps')
188
+ }
189
+ },
190
+ {
191
+ name: 'a quarantine record reads back as written, once, and adds no row',
192
+ run(cache) {
193
+ const unknownVersion = quarantined(
194
+ JSON.stringify({ meta: { schema: 99, event_id: 'future-1', run_id: 'r', seq: 0 } }),
195
+ { source: 'a', position: '3' }
196
+ )
197
+ const torn = quarantined('{"meta": torn')
198
+ same(cache.put(unknownVersion), { type: 'quarantine', result: 'inserted' }, 'first quarantine put')
199
+ same(cache.put(torn), { type: 'quarantine', result: 'inserted' }, 'second quarantine put')
200
+ same(cache.put(unknownVersion), { type: 'quarantine', result: 'duplicate' }, 'repeated quarantine put')
201
+ check(unknownVersion.type === 'quarantine' && torn.type === 'quarantine', 'fixtures are quarantine records')
202
+ if (unknownVersion.type !== 'quarantine' || torn.type !== 'quarantine') return
203
+ same(cache.dataset().quarantined(), [unknownVersion.record, torn.record], 'quarantine')
204
+ same(cache.dataset().rows(), [], 'no rows')
205
+ }
206
+ }
207
+ ]