@attalabs/vinaya 0.35.0 → 0.37.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 (246) 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 +9 -10
  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 +13 -16
  10. package/aeg-root/roles/developer.md +7 -3
  11. package/aeg-root/roles/operator.md +18 -18
  12. package/aeg-root/roles/planner/reference.md +23 -8
  13. package/aeg-root/roles/planner.md +2 -0
  14. package/aeg-root/roles/principal.md +6 -1
  15. package/aeg-root/roles/reviewer.md +11 -3
  16. package/aeg-root/roles/security.md +19 -9
  17. package/aeg-root/roles/tranche-archivist.md +14 -2
  18. package/aeg-root/state-machine.md +11 -10
  19. package/aeg-root/templates/brief-template.md +10 -4
  20. package/aeg-root/templates/pr-report-template.md +1 -9
  21. package/aeg-root/tranche-model.md +4 -4
  22. package/dist/checks/bin/check-body-bare-digits.js +2081 -1883
  23. package/dist/checks/bin/check-branch-topology.js +1376 -1139
  24. package/dist/checks/bin/check-brief-shape.js +2081 -1883
  25. package/dist/checks/bin/check-changeset-coverage.js +2564 -2025
  26. package/dist/checks/bin/check-closes-n.js +1376 -1139
  27. package/dist/checks/bin/check-coherence.js +1480 -1228
  28. package/dist/checks/bin/check-dead-branch-push.js +1339 -1156
  29. package/dist/checks/bin/check-dispatch-readiness.js +1480 -1228
  30. package/dist/checks/bin/check-doc-coverage-push.js +2563 -2024
  31. package/dist/checks/bin/check-doc-coverage.js +2565 -2026
  32. package/dist/checks/bin/check-doctrine-no-procedures.js +2081 -1883
  33. package/dist/checks/bin/check-doctrine-portability.js +2563 -2024
  34. package/dist/checks/bin/check-evidence-fresh.js +1906 -1536
  35. package/dist/checks/bin/check-exec-bits.js +2136 -1597
  36. package/dist/checks/bin/check-first-push-dispatch.js +1480 -1228
  37. package/dist/checks/bin/check-issue-assignment.js +1376 -1139
  38. package/dist/checks/bin/check-issue-milestone-attach.js +1339 -1156
  39. package/dist/checks/bin/check-issue-objectives-numbering.js +2081 -1883
  40. package/dist/checks/bin/check-issue-parts-coverage.js +1339 -1156
  41. package/dist/checks/bin/check-issue-surface-globs.js +1488 -1227
  42. package/dist/checks/bin/check-issue-title-grammar.js +1339 -1156
  43. package/dist/checks/bin/check-issue-tranche-label.js +1339 -1156
  44. package/dist/checks/bin/check-main-branch-refusal.js +1342 -1159
  45. package/dist/checks/bin/check-no-disk-state.js +1342 -1159
  46. package/dist/checks/bin/check-pr-premise-reassert.js +2081 -1883
  47. package/dist/checks/bin/check-pr-report-density.js +1342 -1159
  48. package/dist/checks/bin/check-principal-test-plan-wait.js +1342 -1159
  49. package/dist/checks/bin/check-quoted-command.js +4063 -3526
  50. package/dist/checks/bin/check-reader-resolvable-prose.js +4082 -3533
  51. package/dist/checks/bin/check-registry-gates.js +1363 -1167
  52. package/dist/checks/bin/check-retired-vocabulary.js +4057 -3520
  53. package/dist/checks/bin/check-review-gate.js +2081 -1883
  54. package/dist/checks/bin/check-single-plan-pr.js +1339 -1156
  55. package/dist/checks/bin/check-surface-scope.js +1376 -1139
  56. package/dist/checks/bin/check-test-plan.js +1339 -1156
  57. package/dist/checks/bin/check-token-collection-wired.js +1342 -1159
  58. package/dist/checks/bin/check-token-report.js +1409 -1342
  59. package/dist/checks/bin/check-workspace-escape.js +2562 -2023
  60. package/dist/index.js +14171 -6490
  61. package/dist/lib/pre-push-cache-test-run.js +1044 -641
  62. package/dist/lib/pre-push-select-tests.js +641 -444
  63. package/package.json +2 -2
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +38 -0
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +19 -0
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +257 -10
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +2 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +69 -11
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +139 -2
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +27 -1
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +757 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +8 -1
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +163 -21
  77. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  78. package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
  79. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  80. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  81. package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
  82. package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
  83. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
  84. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  85. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  86. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  87. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  88. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  89. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  90. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  91. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  92. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  93. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  95. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
  129. 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
  130. 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
  131. 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
  132. 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
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
  138. 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
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0zc_0gx._.js → [root-of-the-server]__14ui9sz._.js} +2 -2
  140. 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
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  143. 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
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
  145. 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
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
  164. 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
  165. 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
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  173. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
  174. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
  175. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
  176. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vtfb0g813gki.js +1 -0
  177. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
  178. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
  180. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
  182. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
  184. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
  185. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
  186. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
  187. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3ip5z3cf43bgo.js → 3l56x8wjdzvaw.js} +5 -5
  188. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
  189. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3goaig_rysc6p.js → 3qtt1v3ya-ofe.js} +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  191. package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
  192. 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/aeg-core/bin/verify-coherence.ts +0 -1089
  193. package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
  201. 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
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
  205. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
  207. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
  208. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
  209. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
  210. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
  212. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
  213. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
  214. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
  215. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
  216. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
  217. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
  218. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
  219. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
  220. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
  221. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
  222. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
  223. 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
  224. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
  225. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
  226. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
  227. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
  228. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
  229. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
  230. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
  231. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
  232. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
  233. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
  234. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
  235. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
  236. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
  237. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
  238. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
  239. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
  240. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
  241. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
  242. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3u9emqjwpd0t9.js +0 -1
  243. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
  244. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
  245. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
  246. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_ssgManifest.js +0 -0
@@ -1885,45 +1885,6 @@ var DERIVED_STATUSES = [
1885
1885
  "incoherent"
1886
1886
  ];
1887
1887
  var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
1888
- // ../../packages/aeg-core/src/parse-ledger.ts
1889
- function rowFromCells(cells) {
1890
- if (cells.length < 7)
1891
- return null;
1892
- const phase = (cells[0] ?? "").trim();
1893
- if (!phase)
1894
- return null;
1895
- return {
1896
- phase,
1897
- role: (cells[1] ?? "").trim(),
1898
- agentModel: (cells[2] ?? "").trim(),
1899
- tokensIn: parseIntCell(cells[3] ?? ""),
1900
- tokensOut: parseIntCell(cells[4] ?? ""),
1901
- cost: parseCostCell(cells[5] ?? ""),
1902
- date: (cells[6] ?? "").trim()
1903
- };
1904
- }
1905
- function parseIntCell(cell) {
1906
- const trimmed = cell.replace(/`/g, "").trim();
1907
- if (!trimmed || isEmDashOrDash(trimmed))
1908
- return null;
1909
- const normalized = trimmed.replace(/[,_\s]/g, "");
1910
- if (!/^-?\d+$/.test(normalized))
1911
- return null;
1912
- return Number(normalized);
1913
- }
1914
- function parseCostCell(cell) {
1915
- const trimmed = cell.replace(/`/g, "").trim();
1916
- if (!trimmed || isEmDashOrDash(trimmed))
1917
- return null;
1918
- const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
1919
- if (!/^-?\d+(\.\d+)?$/.test(normalized))
1920
- return null;
1921
- return Number(normalized);
1922
- }
1923
- function isEmDashOrDash(s) {
1924
- const t = s.trim();
1925
- return t === "—" || t === "-" || t === "–";
1926
- }
1927
1888
  // ../../packages/aeg-core/src/waiver-label.ts
1928
1889
  var WAIVER_LABEL = label("waiver-docs");
1929
1890
  var WAIVER_LABEL_REVIEW = label("waiver-review");
@@ -1939,61 +1900,6 @@ function isWaiverLabelActorVerified(opts) {
1939
1900
  return false;
1940
1901
  return isPrincipal(opts.labelActor, opts.principalAllowlist);
1941
1902
  }
1942
-
1943
- // ../../packages/aeg-core/src/parse-token-report.ts
1944
- var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
1945
- var INLINE_FIELD_LIST = /Phase:\s*([^|]+?)\s*\|\s*Role:\s*([^|]+?)\s*\|\s*Agent\/Model:\s*([^|]+?)\s*\|\s*Tokens in:\s*([^|]+?)\s*\|\s*Tokens out:\s*([^|]+?)\s*\|\s*Cost:\s*([^|]+?)\s*\|\s*Date:\s*(.+?)\s*$/im;
1946
- function parseTokenReportEntries(body) {
1947
- const lines = body.split(/\r?\n/);
1948
- const headingIdxs = [];
1949
- lines.forEach((line, i) => {
1950
- if (TOKEN_REPORT_HEADING.test(line))
1951
- headingIdxs.push(i);
1952
- });
1953
- const out = [];
1954
- for (let h = 0;h < headingIdxs.length; h++) {
1955
- const start = headingIdxs[h] + 1;
1956
- const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
1957
- const section = lines.slice(start, end).join(`
1958
- `);
1959
- const tableRows = parseTableSection(section);
1960
- if (tableRows.length > 0) {
1961
- out.push(...tableRows);
1962
- continue;
1963
- }
1964
- const inlineRow = parseInlineFieldList(section);
1965
- if (inlineRow)
1966
- out.push(inlineRow);
1967
- }
1968
- return out;
1969
- }
1970
- function parseTableSection(section) {
1971
- const lines = section.split(/\r?\n/);
1972
- let i = 0;
1973
- for (;i < lines.length; i++) {
1974
- if ((lines[i] ?? "").trim().startsWith("|"))
1975
- break;
1976
- }
1977
- if (i + 1 >= lines.length)
1978
- return [];
1979
- i += 2;
1980
- const out = [];
1981
- for (;i < lines.length; i++) {
1982
- const trimmed = (lines[i] ?? "").trim();
1983
- if (!trimmed.startsWith("|"))
1984
- break;
1985
- const row = rowFromCells(splitTableRow(trimmed));
1986
- if (row)
1987
- out.push(row);
1988
- }
1989
- return out;
1990
- }
1991
- function parseInlineFieldList(section) {
1992
- const m = section.match(INLINE_FIELD_LIST);
1993
- if (!m)
1994
- return null;
1995
- return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
1996
- }
1997
1903
  // ../../packages/aeg-core/src/verdict-extraction.ts
1998
1904
  var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
1999
1905
  var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
@@ -2442,10 +2348,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
2442
2348
  var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
2443
2349
  var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
2444
2350
  var DEFAULT_MAX_ROUNDS = 3;
2351
+ var DEFAULT_MAX_TASK_MINUTES = 180;
2445
2352
  var DEFAULT_REVIEW_POLICY = {
2446
2353
  codeReviewThreshold: "BLOCKER",
2447
2354
  securityThreshold: "HIGH",
2448
- maxRounds: DEFAULT_MAX_ROUNDS
2355
+ maxRounds: DEFAULT_MAX_ROUNDS,
2356
+ maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
2449
2357
  };
2450
2358
  var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
2451
2359
  var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
@@ -2465,16 +2373,42 @@ function blockingSeverities(scale, threshold) {
2465
2373
  }
2466
2374
  return scale.slice(0, idx + 1);
2467
2375
  }
2468
- function evaluateReviewFindings(findings, scale, threshold) {
2469
- const blocking = new Set(blockingSeverities(scale, threshold));
2470
- const blockingFindings = findings.filter((f) => {
2471
- if (!scale.includes(f.severity)) {
2472
- throw new Error(`evaluateReviewFindings: severity "${f.severity}" is not one of ${scale.join(" > ")}`);
2473
- }
2474
- const effectiveSeverity = f.location !== undefined && isProseLocation(f.location) ? PROSE_CAP_SEVERITY : f.severity;
2475
- return blocking.has(effectiveSeverity);
2476
- });
2477
- return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings };
2376
+ var DEFERRAL_REASON_TEXT = {
2377
+ "unchanged-line": "unchanged line",
2378
+ "outside-surface": "outside the Surface"
2379
+ };
2380
+ var SECURITY_HIGH_AND_ABOVE = blockingSeverities(SECURITY_SEVERITY_ORDER, "HIGH");
2381
+ function classifyFinding(finding, scale, threshold, context = {}) {
2382
+ if (!scale.includes(finding.severity)) {
2383
+ throw new Error(`classifyFinding: severity "${finding.severity}" is not one of ${scale.join(" > ")}`);
2384
+ }
2385
+ const location = finding.location;
2386
+ const effectiveSeverity = location !== undefined && isProseLocation(location) ? PROSE_CAP_SEVERITY : finding.severity;
2387
+ const wouldBlock = blockingSeverities(scale, threshold).includes(effectiveSeverity);
2388
+ if (!wouldBlock)
2389
+ return { outcome: "non_blocking", deferralReason: null };
2390
+ const hasLocation = location !== undefined && location.length > 0;
2391
+ if (hasLocation && context.inSurface && !context.inSurface(location)) {
2392
+ return { outcome: "deferred", deferralReason: "outside-surface" };
2393
+ }
2394
+ if (hasLocation && context.changedLine && !SECURITY_HIGH_AND_ABOVE.includes(effectiveSeverity)) {
2395
+ if (!context.changedLine(location)) {
2396
+ return { outcome: "deferred", deferralReason: "unchanged-line" };
2397
+ }
2398
+ }
2399
+ return { outcome: "blocking", deferralReason: null };
2400
+ }
2401
+ function evaluateReviewFindings(findings, scale, threshold, context = {}) {
2402
+ const blockingFindings = [];
2403
+ const deferredFindings = [];
2404
+ for (const f of findings) {
2405
+ const c = classifyFinding(f, scale, threshold, context);
2406
+ if (c.outcome === "blocking")
2407
+ blockingFindings.push(f);
2408
+ else if (c.outcome === "deferred")
2409
+ deferredFindings.push({ finding: f, reason: c.deferralReason });
2410
+ }
2411
+ return { outcome: blockingFindings.length > 0 ? "blocked" : "clean", blockingFindings, deferredFindings };
2478
2412
  }
2479
2413
  function isConsequentialFinding(finding) {
2480
2414
  return finding.state !== "resolved";
@@ -2482,11 +2416,11 @@ function isConsequentialFinding(finding) {
2482
2416
  function consequentialFindings(findings) {
2483
2417
  return findings.filter((f) => isConsequentialFinding(f));
2484
2418
  }
2485
- function evaluateCodeReview(findings, policy) {
2486
- return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold);
2419
+ function evaluateCodeReview(findings, policy, context = {}) {
2420
+ return evaluateReviewFindings(findings, CODE_REVIEW_SEVERITY_ORDER, policy.codeReviewThreshold, context);
2487
2421
  }
2488
- function evaluateSecurityReview(findings, policy) {
2489
- return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold);
2422
+ function evaluateSecurityReview(findings, policy, context = {}) {
2423
+ return evaluateReviewFindings(findings, SECURITY_SEVERITY_ORDER, policy.securityThreshold, context);
2490
2424
  }
2491
2425
  function isKnownSeverity(scale, value) {
2492
2426
  return scale.includes(value);
@@ -2820,11 +2754,13 @@ function checkDocUpdateList(prBody) {
2820
2754
  return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
2821
2755
  }
2822
2756
  function checkWorktreeStep0(prBody) {
2823
- if (/git worktree add/.test(prBody))
2757
+ if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
2824
2758
  return { status: "pass", errors: [] };
2825
2759
  return {
2826
2760
  status: "fail",
2827
- errors: ["brief-validation worktree Step 0: no `git worktree add` command found in the PR body."]
2761
+ errors: [
2762
+ "brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
2763
+ ]
2828
2764
  };
2829
2765
  }
2830
2766
  function checkStopConditions(prBody) {
@@ -3014,7 +2950,8 @@ function isCommandBlock(content) {
3014
2950
  return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
3015
2951
  }
3016
2952
  function isStep0Block(content) {
3017
- return firstNonBlankLine(content).startsWith("git worktree add");
2953
+ const first = firstNonBlankLine(content);
2954
+ return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
3018
2955
  }
3019
2956
  function checkCommandsCarryOutput(prBody) {
3020
2957
  const errors = [];
@@ -3400,161 +3337,592 @@ function checkPrReportDensity(prBody) {
3400
3337
  const results = [checkDecisionsDensity(prBody), checkScopeDensity(prBody)];
3401
3338
  return { errors: results.flatMap((r) => r.errors) };
3402
3339
  }
3403
- // ../../packages/aeg-core/src/issue-validation.ts
3404
- function hasRationaleField(body, labelPattern) {
3405
- const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
3406
- return re.test(body);
3407
- }
3408
- var RATIONALE_FIELDS = [
3409
- { name: "Boundary", pattern: "Boundary" },
3410
- { name: "Sizing", pattern: "Sizing" },
3411
- { name: "Project(s) + blast radius", pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius" },
3412
- { name: "Dependency rationale", pattern: "Dependency rationale|Depends[- ]on" },
3413
- { name: "Traps to avoid", pattern: "Traps" },
3414
- { name: "Suggested agent-class", pattern: "(?:Suggested\\s+)?agent-class" },
3415
- { name: "Stop-and-escalate", pattern: "Stop-and-escalate" },
3416
- { name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7" }
3340
+ // ../../packages/aeg-core/src/reader-resolvable-prose.ts
3341
+ var PRODUCT_SLUG_SCOPE = [
3342
+ "apps/cli/src",
3343
+ ".github/workflows",
3344
+ ".vinaya",
3345
+ "apps/cli/README.md",
3346
+ "packages/sources/README.md"
3417
3347
  ];
3418
- var DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale";
3419
- function checkIssueRationale(body) {
3420
- const errors = [];
3421
- for (const f of RATIONALE_FIELDS) {
3422
- if (!hasRationaleField(body, f.pattern)) {
3423
- errors.push(`issue-validation ${f.name}: rationale field not found in the Issue body — every task Issue carries the full Planner's rationale (aeg-root/contracts/planner-brief.md).`);
3424
- continue;
3425
- }
3426
- if (f.name === DEPENDENCY_RATIONALE_FIELD_NAME && !SECTION_HEADER.test(body)) {
3427
- errors.push(`issue-validation ${f.name}: rationale field found, but not in the form amend-deps requires — ` + "write `**Dependency rationale** — …`, not `**Dependency rationale:** …`. " + "`amendRationaleDeps` (the only sanctioned way to edit Depends-on/Conflicts-with) locates this " + "section by the exact anchor `**Dependency rationale**`; a colon inside the bold breaks that match " + "and the Issue becomes unamendable.");
3428
- }
3429
- }
3430
- return { status: errors.length > 0 ? "fail" : "pass", errors };
3431
- }
3432
- var OBJECTIVES_SINCE_ISSUE = 404;
3433
- function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
3434
- if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
3435
- return { status: "pass", errors: [] };
3436
- const result = objectivesOf(body);
3437
- if (result.ok)
3438
- return { status: "pass", errors: [] };
3439
- return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
3348
+ function isUnderOrEqual(path, prefix) {
3349
+ return path === prefix || path.startsWith(`${prefix}/`);
3440
3350
  }
3441
- function topLevelSectionText(body, headingName) {
3442
- const headingRe = new RegExp(`^##[ \\t]*${headingName}[ \\t]*$`, "im");
3443
- const heading = headingRe.exec(body);
3444
- if (!heading)
3445
- return null;
3446
- const afterHeading = body.slice(heading.index + heading[0].length);
3447
- const next = /^##[ \t]/m.exec(afterHeading);
3448
- return next ? afterHeading.slice(0, next.index) : afterHeading;
3351
+ function isProductScopeFile(path) {
3352
+ return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
3449
3353
  }
3450
- function partHasBacktickedPath(text) {
3451
- let i = 0;
3452
- while (i < text.length) {
3453
- const start = text.indexOf("`", i);
3454
- if (start === -1)
3455
- return false;
3456
- const end = text.indexOf("`", start + 1);
3457
- if (end === -1)
3458
- return false;
3459
- if (text.slice(start + 1, end).includes("/"))
3460
- return true;
3461
- i = end + 1;
3462
- }
3463
- return false;
3354
+ var SHIPS_PREFIX = "aeg-root/";
3355
+ function shipsArchivePrefix(shipsPrefix) {
3356
+ return `${shipsPrefix}tranches/completed/`;
3464
3357
  }
3465
- var PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3;
3466
- function stripPartBackticks(text) {
3467
- return text.replace(/`[^`\n]*`/g, " ");
3358
+ var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
3359
+ function normalizeSpecPath(entry) {
3360
+ let out = entry.replace(/\\/g, "/");
3361
+ while (out.startsWith("./"))
3362
+ out = out.slice(2);
3363
+ out = out.replace(/\/{2,}/g, "/");
3364
+ while (out.endsWith("/"))
3365
+ out = out.slice(0, -1);
3366
+ return out;
3468
3367
  }
3469
- function partWordCount(text) {
3470
- return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
3368
+ function isSpecFile2(path, specPaths) {
3369
+ if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
3370
+ return true;
3371
+ if (!path.endsWith(".md"))
3372
+ return false;
3373
+ return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
3471
3374
  }
3472
- function looksLikeFilePath(entry) {
3473
- const stripped = entry.replace(/\/\*\*?$/, "");
3474
- const lastSegment = stripped.split("/").pop() ?? stripped;
3475
- const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
3476
- return extMatch !== null && extMatch.index > 0;
3375
+ function isClaudeMdFile(path) {
3376
+ return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
3477
3377
  }
3478
- function splitGlobList(raw) {
3479
- return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
3378
+ function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
3379
+ if (path.startsWith(shipsPrefix)) {
3380
+ return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
3381
+ }
3382
+ if (path.startsWith(readerFacingPrefix) && path.endsWith(readerFacingSuffix)) {
3383
+ return "reader-facing";
3384
+ }
3385
+ if (isClaudeMdFile(path))
3386
+ return "internal";
3387
+ if (isSpecFile2(path, specPaths))
3388
+ return "spec";
3389
+ if (isProductScopeFile(path))
3390
+ return "product";
3391
+ return null;
3480
3392
  }
3481
- function parseIssueSurface(body) {
3482
- const section = topLevelSectionText(body, "Surface");
3483
- if (section === null)
3484
- return { ok: false, errors: ["no `## Surface` heading found in the body."] };
3485
- const inLine = /^in:\s*(.+)$/im.exec(section);
3486
- const outLine = /^out:\s*(.+)$/im.exec(section);
3487
- const errors = [];
3488
- if (!inLine)
3489
- errors.push("`## Surface` has no `in:` line.");
3490
- if (!outLine)
3491
- errors.push("`## Surface` has no `out:` line.");
3492
- if (errors.length > 0)
3493
- return { ok: false, errors };
3494
- const inGlobs = splitGlobList(inLine[1]);
3495
- const outGlobs = splitGlobList(outLine[1]);
3496
- for (const g of [...inGlobs, ...outGlobs]) {
3497
- if (looksLikeFilePath(g)) {
3498
- errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
3499
- }
3393
+ var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
3394
+ function stripNonProse(path, content) {
3395
+ if (path.endsWith(".md")) {
3396
+ return content.replace(/```.*?```/gs, (m) => m.replace(/[^\n]/g, "")).replace(/`[^`\n]*`/g, (m) => m.replace(/[^\n]/g, ""));
3500
3397
  }
3501
- if (inGlobs.length === 0)
3502
- errors.push("`## Surface`'s `in:` line resolved to zero globs.");
3503
- if (errors.length > 0)
3504
- return { ok: false, errors };
3505
- return { ok: true, value: { in: inGlobs, out: outGlobs } };
3398
+ if (path.endsWith(".tsx") || path.endsWith(".ts")) {
3399
+ return content.replace(/\/\*.*?\*\//gs, (m) => m.replace(/[^\n]/g, "")).replace(/(^|[^:])\/\/[^\n]*/g, (m) => m.replace(/[^\n]/g, ""));
3400
+ }
3401
+ return content;
3506
3402
  }
3507
- function globCoversPath(glob, path) {
3508
- const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
3509
- const p = path.replace(/\/+$/, "");
3510
- if (g === "*")
3511
- return !p.includes("/");
3512
- return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
3403
+ function stripNonProseForProduct(path, content) {
3404
+ return path.endsWith(".md") ? stripNonProse(path, content) : content;
3513
3405
  }
3514
- function checkSurfaceGlobsResolve(body, resolvesToFile) {
3515
- const surface = parseIssueSurface(body);
3516
- if (!surface.ok)
3517
- return { status: "pass", errors: [] };
3518
- const errors = [];
3519
- for (const glob of surface.value.in) {
3520
- if (!resolvesToFile(glob)) {
3521
- errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
3522
- }
3406
+ function lineAt(content, index) {
3407
+ let line = 1;
3408
+ for (let i = 0;i < index; i++) {
3409
+ if (content.charCodeAt(i) === 10)
3410
+ line++;
3523
3411
  }
3524
- return { status: errors.length > 0 ? "fail" : "pass", errors };
3412
+ return line;
3525
3413
  }
3526
- function checkSurfaceScope(changedFiles, outGlobs) {
3527
- if (outGlobs.length === 0)
3528
- return { ok: true };
3529
- const violations = [];
3530
- for (const file of changedFiles) {
3531
- const glob = outGlobs.find((g) => globCoversPath(g, file));
3532
- if (glob)
3533
- violations.push({ file, glob });
3534
- }
3535
- return violations.length > 0 ? { ok: false, violations } : { ok: true };
3414
+ var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
3415
+ var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
3416
+ var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
3417
+ function legacySlugPattern(legacySlugs) {
3418
+ if (legacySlugs.length === 0)
3419
+ return null;
3420
+ const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
3421
+ return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
3536
3422
  }
3537
- var ISSUE_PART_LINE_RE = /^Part\s+(\d+)\s*\(([^)]*)\)\s*[-—–]\s*(.*)$/i;
3538
- function parseIssueParts(body) {
3539
- const section = topLevelSectionText(body, "Parts");
3540
- if (section === null)
3541
- return { ok: false, errors: ["no `## Parts` heading found in the body."] };
3542
- const lines = section.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
3543
- const parts = [];
3544
- const errors = [];
3545
- for (const line of lines) {
3546
- const m = ISSUE_PART_LINE_RE.exec(line);
3547
- if (!m) {
3548
- errors.push(`"${line}" is not a well-formed Parts line — expected \`Part <n> (<refs>) — <outcome>\`.`);
3549
- continue;
3550
- }
3551
- const n = Number.parseInt(m[1], 10);
3552
- const refs = m[2];
3553
- const text = m[3].trim();
3554
- if (text.length === 0) {
3555
- errors.push(`Part ${n} has no outcome text after the dash — every Part states one observable outcome.`);
3556
- continue;
3557
- }
3423
+ function specGrandfatherPaths(specGrandfather) {
3424
+ return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
3425
+ }
3426
+ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
3427
+ const findings = [];
3428
+ const legacyPattern = legacySlugPattern(legacySlugs);
3429
+ const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
3430
+ const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
3431
+ const patterns = [
3432
+ { pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
3433
+ { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
3434
+ ...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
3435
+ ];
3436
+ const productPatterns = [
3437
+ { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
3438
+ ];
3439
+ const specPatterns = [
3440
+ ...patterns,
3441
+ { pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
3442
+ ];
3443
+ for (const file of files) {
3444
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
3445
+ if (!cls || cls === "internal")
3446
+ continue;
3447
+ if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
3448
+ continue;
3449
+ if (cls === "spec" && grandfatheredWhole.has(file.path))
3450
+ continue;
3451
+ const blocking = cls === "product" || cls === "spec";
3452
+ const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
3453
+ const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
3454
+ const fileFindings = [];
3455
+ for (const { pattern, what, group } of patternsToRun) {
3456
+ pattern.lastIndex = 0;
3457
+ let match = pattern.exec(scrubbed);
3458
+ while (match !== null) {
3459
+ const cited = group !== undefined ? match[group] ?? match[0] : match[0];
3460
+ const citedIndex = match.index + match[0].indexOf(cited);
3461
+ fileFindings.push({
3462
+ file: file.path,
3463
+ line: lineAt(scrubbed, citedIndex),
3464
+ message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
3465
+ blocking
3466
+ });
3467
+ match = pattern.exec(scrubbed);
3468
+ }
3469
+ }
3470
+ const limit = cls === "spec" ? limits.get(file.path) : undefined;
3471
+ if (limit !== undefined) {
3472
+ if (fileFindings.length <= limit)
3473
+ continue;
3474
+ for (const f of fileFindings) {
3475
+ f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
3476
+ }
3477
+ }
3478
+ findings.push(...fileFindings);
3479
+ }
3480
+ return findings;
3481
+ }
3482
+ function escapeTerm(term) {
3483
+ return term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
3484
+ }
3485
+ function containsWholeWord(text, term) {
3486
+ const escaped = escapeTerm(term);
3487
+ const re = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)`, "i");
3488
+ return re.test(text);
3489
+ }
3490
+ function findWholeWordLine(content, term) {
3491
+ const lines = content.split(`
3492
+ `);
3493
+ let lineNo = 0;
3494
+ for (const line of lines) {
3495
+ lineNo++;
3496
+ if (containsWholeWord(line, term))
3497
+ return lineNo;
3498
+ }
3499
+ return null;
3500
+ }
3501
+ function definesOrLinksGlossary(content, term) {
3502
+ const escaped = escapeTerm(term);
3503
+ const definesInline = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)[^\\n]{0,3}—`, "i").test(content);
3504
+ if (definesInline)
3505
+ return true;
3506
+ return /docs\/glossary|glossary\.md/i.test(content);
3507
+ }
3508
+ function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
3509
+ const findings = [];
3510
+ for (const file of files) {
3511
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
3512
+ if (!cls || !SWEPT_CLASSES.has(cls))
3513
+ continue;
3514
+ const scrubbed = stripNonProse(file.path, file.content);
3515
+ for (const term of glossaryTerms) {
3516
+ const line = findWholeWordLine(scrubbed, term);
3517
+ if (line === null)
3518
+ continue;
3519
+ if (definesOrLinksGlossary(scrubbed, term))
3520
+ continue;
3521
+ findings.push({
3522
+ file: file.path,
3523
+ line,
3524
+ message: `uses coined term "${term}" without defining it inline or linking the glossary`,
3525
+ blocking: false
3526
+ });
3527
+ }
3528
+ }
3529
+ return findings;
3530
+ }
3531
+ var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g;
3532
+ var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g;
3533
+ function extractComments(path, content) {
3534
+ if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
3535
+ return content.replace(/[^\n]/g, "");
3536
+ let state = "code";
3537
+ let out = "";
3538
+ const n = content.length;
3539
+ let i = 0;
3540
+ const blank = (ch) => ch === `
3541
+ ` ? `
3542
+ ` : " ";
3543
+ while (i < n) {
3544
+ const c = content[i];
3545
+ const next = i + 1 < n ? content[i + 1] : "";
3546
+ if (state === "code") {
3547
+ if (c === "/" && next === "/") {
3548
+ state = "line-comment";
3549
+ out += c;
3550
+ i++;
3551
+ continue;
3552
+ }
3553
+ if (c === "/" && next === "*") {
3554
+ state = "block-comment";
3555
+ out += c;
3556
+ i++;
3557
+ continue;
3558
+ }
3559
+ if (c === "'") {
3560
+ state = "single-quote";
3561
+ out += blank(c);
3562
+ i++;
3563
+ continue;
3564
+ }
3565
+ if (c === '"') {
3566
+ state = "double-quote";
3567
+ out += blank(c);
3568
+ i++;
3569
+ continue;
3570
+ }
3571
+ if (c === "`") {
3572
+ state = "template";
3573
+ out += blank(c);
3574
+ i++;
3575
+ continue;
3576
+ }
3577
+ out += blank(c);
3578
+ i++;
3579
+ continue;
3580
+ }
3581
+ if (state === "line-comment") {
3582
+ if (c === `
3583
+ `) {
3584
+ state = "code";
3585
+ out += `
3586
+ `;
3587
+ i++;
3588
+ continue;
3589
+ }
3590
+ out += c;
3591
+ i++;
3592
+ continue;
3593
+ }
3594
+ if (state === "block-comment") {
3595
+ if (c === "*" && next === "/") {
3596
+ out += c;
3597
+ out += next;
3598
+ state = "code";
3599
+ i += 2;
3600
+ continue;
3601
+ }
3602
+ out += c === `
3603
+ ` ? `
3604
+ ` : c;
3605
+ i++;
3606
+ continue;
3607
+ }
3608
+ const closer = state === "single-quote" ? "'" : state === "double-quote" ? '"' : "`";
3609
+ if (c === "\\") {
3610
+ out += blank(c);
3611
+ i++;
3612
+ if (i < n) {
3613
+ out += blank(content[i]);
3614
+ i++;
3615
+ }
3616
+ continue;
3617
+ }
3618
+ if (c === closer) {
3619
+ state = "code";
3620
+ out += blank(c);
3621
+ i++;
3622
+ continue;
3623
+ }
3624
+ out += blank(c);
3625
+ i++;
3626
+ }
3627
+ return out;
3628
+ }
3629
+ function checkSourceComments(files, allowlist = []) {
3630
+ const findings = [];
3631
+ const allowed = new Set(allowlist);
3632
+ const patterns = [
3633
+ { pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
3634
+ { pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
3635
+ ];
3636
+ for (const file of files) {
3637
+ if (!file.path.endsWith(".ts"))
3638
+ continue;
3639
+ if (allowed.has(file.path))
3640
+ continue;
3641
+ const comments = extractComments(file.path, file.content);
3642
+ for (const { pattern, what } of patterns) {
3643
+ pattern.lastIndex = 0;
3644
+ let match = pattern.exec(comments);
3645
+ while (match !== null) {
3646
+ findings.push({
3647
+ file: file.path,
3648
+ line: lineAt(comments, match.index),
3649
+ message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
3650
+ blocking: false
3651
+ });
3652
+ match = pattern.exec(comments);
3653
+ }
3654
+ }
3655
+ }
3656
+ return findings;
3657
+ }
3658
+ function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
3659
+ return [
3660
+ ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
3661
+ ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
3662
+ ];
3663
+ }
3664
+ function parseGlossaryTerms(glossaryContent) {
3665
+ const terms = [];
3666
+ const re = /^\*\*(.+?)\*\* —/gm;
3667
+ let match = re.exec(glossaryContent);
3668
+ while (match !== null) {
3669
+ if (match[1] !== undefined)
3670
+ terms.push(match[1]);
3671
+ match = re.exec(glossaryContent);
3672
+ }
3673
+ return terms;
3674
+ }
3675
+
3676
+ // ../../packages/aeg-core/src/quoted-command.ts
3677
+ var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
3678
+ var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
3679
+ var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
3680
+ var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
3681
+ function isValidCitedFilePath(path) {
3682
+ if (path.length === 0)
3683
+ return false;
3684
+ if (path.startsWith("/") || path.startsWith("\\"))
3685
+ return false;
3686
+ if (/^[A-Za-z]:[\\/]/.test(path))
3687
+ return false;
3688
+ return !path.split(/[\\/]+/).includes("..");
3689
+ }
3690
+ function quotedCommandLineAt(content, index) {
3691
+ let line = 1;
3692
+ for (let i = 0;i < index; i++) {
3693
+ if (content.charCodeAt(i) === 10)
3694
+ line++;
3695
+ }
3696
+ return line;
3697
+ }
3698
+ function extractQuotedText(raw) {
3699
+ const trimmed = raw.trim();
3700
+ const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
3701
+ if (fenced)
3702
+ return (fenced[1] ?? "").trim();
3703
+ const inline = /^`([^`]+)`$/.exec(trimmed);
3704
+ if (inline)
3705
+ return (inline[1] ?? "").trim();
3706
+ return trimmed;
3707
+ }
3708
+ function findQuotesInFile(path, content) {
3709
+ const masked = maskCode(content);
3710
+ const quotes = [];
3711
+ START_PATTERN.lastIndex = 0;
3712
+ let start = START_PATTERN.exec(masked);
3713
+ while (start !== null) {
3714
+ const citedFile = start[1];
3715
+ const innerStart = start.index + start[0].length;
3716
+ const end = END_PATTERN.exec(masked.slice(innerStart));
3717
+ if (end === null) {
3718
+ START_PATTERN.lastIndex = innerStart;
3719
+ start = START_PATTERN.exec(masked);
3720
+ continue;
3721
+ }
3722
+ const innerEnd = innerStart + end.index;
3723
+ if (isValidCitedFilePath(citedFile)) {
3724
+ const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
3725
+ if (quotedText.length > 0) {
3726
+ quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
3727
+ }
3728
+ }
3729
+ START_PATTERN.lastIndex = innerEnd + end[0].length;
3730
+ start = START_PATTERN.exec(masked);
3731
+ }
3732
+ return quotes;
3733
+ }
3734
+ function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
3735
+ const quotes = [];
3736
+ for (const file of files) {
3737
+ const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
3738
+ if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
3739
+ continue;
3740
+ quotes.push(...findQuotesInFile(file.path, file.content));
3741
+ }
3742
+ return quotes;
3743
+ }
3744
+ function evaluateCitedQuotes(citedQuotes, citedFileContents) {
3745
+ const findings = [];
3746
+ for (const quote of citedQuotes) {
3747
+ const content = citedFileContents.get(quote.citedFile);
3748
+ if (content === undefined) {
3749
+ findings.push({
3750
+ file: quote.file,
3751
+ line: quote.line,
3752
+ citedFile: quote.citedFile,
3753
+ quotedText: quote.quotedText,
3754
+ message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
3755
+ });
3756
+ continue;
3757
+ }
3758
+ if (!content.includes(quote.quotedText)) {
3759
+ findings.push({
3760
+ file: quote.file,
3761
+ line: quote.line,
3762
+ citedFile: quote.citedFile,
3763
+ quotedText: quote.quotedText,
3764
+ message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
3765
+ });
3766
+ }
3767
+ }
3768
+ return findings;
3769
+ }
3770
+
3771
+ // ../../packages/aeg-core/src/issue-validation.ts
3772
+ function hasRationaleField(body, labelPattern) {
3773
+ const re = new RegExp(`(?:\\*\\*|^#{1,4}\\s+)\\s*(?:${labelPattern})`, "im");
3774
+ return re.test(body);
3775
+ }
3776
+ var RATIONALE_FIELDS = [
3777
+ { name: "Boundary", pattern: "Boundary" },
3778
+ { name: "Sizing", pattern: "Sizing" },
3779
+ { name: "Project(s) + blast radius", pattern: "Project\\(s\\)|Project(?:s)?\\s*\\+|blast radius" },
3780
+ { name: "Dependency rationale", pattern: "Dependency rationale|Depends[- ]on" },
3781
+ { name: "Traps to avoid", pattern: "Traps" },
3782
+ { name: "Suggested agent-class", pattern: "(?:Suggested\\s+)?agent-class" },
3783
+ { name: "Stop-and-escalate", pattern: "Stop-and-escalate" },
3784
+ { name: "Docs to keep coherent", pattern: "Docs to keep coherent|§7" }
3785
+ ];
3786
+ var DEPENDENCY_RATIONALE_FIELD_NAME = "Dependency rationale";
3787
+ function checkIssueRationale(body) {
3788
+ const errors = [];
3789
+ for (const f of RATIONALE_FIELDS) {
3790
+ if (!hasRationaleField(body, f.pattern)) {
3791
+ errors.push(`issue-validation ${f.name}: rationale field not found in the Issue body — every task Issue carries the full Planner's rationale (aeg-root/contracts/planner-brief.md).`);
3792
+ continue;
3793
+ }
3794
+ if (f.name === DEPENDENCY_RATIONALE_FIELD_NAME && !SECTION_HEADER.test(body)) {
3795
+ errors.push(`issue-validation ${f.name}: rationale field found, but not in the form amend-deps requires — ` + "write `**Dependency rationale** — …`, not `**Dependency rationale:** …`. " + "`amendRationaleDeps` (the only sanctioned way to edit Depends-on/Conflicts-with) locates this " + "section by the exact anchor `**Dependency rationale**`; a colon inside the bold breaks that match " + "and the Issue becomes unamendable.");
3796
+ }
3797
+ }
3798
+ return { status: errors.length > 0 ? "fail" : "pass", errors };
3799
+ }
3800
+ var OBJECTIVES_SINCE_ISSUE = 404;
3801
+ function checkIssueObjectives(body, issueNumber, sinceIssue = OBJECTIVES_SINCE_ISSUE) {
3802
+ if (sinceIssue !== null && issueNumber !== null && issueNumber < sinceIssue)
3803
+ return { status: "pass", errors: [] };
3804
+ const result = objectivesOf(body);
3805
+ if (result.ok)
3806
+ return { status: "pass", errors: [] };
3807
+ return { status: "fail", errors: result.errors.map((e) => `issue-validation objectives: ${e}`) };
3808
+ }
3809
+ function topLevelSectionText(body, headingName) {
3810
+ const headingRe = new RegExp(`^##[ \\t]*${headingName}[ \\t]*$`, "im");
3811
+ const heading = headingRe.exec(body);
3812
+ if (!heading)
3813
+ return null;
3814
+ const afterHeading = body.slice(heading.index + heading[0].length);
3815
+ const next = /^##[ \t]/m.exec(afterHeading);
3816
+ return next ? afterHeading.slice(0, next.index) : afterHeading;
3817
+ }
3818
+ function partHasBacktickedPath(text) {
3819
+ let i = 0;
3820
+ while (i < text.length) {
3821
+ const start = text.indexOf("`", i);
3822
+ if (start === -1)
3823
+ return false;
3824
+ const end = text.indexOf("`", start + 1);
3825
+ if (end === -1)
3826
+ return false;
3827
+ if (text.slice(start + 1, end).includes("/"))
3828
+ return true;
3829
+ i = end + 1;
3830
+ }
3831
+ return false;
3832
+ }
3833
+ var PART_MIN_WORDS_OUTSIDE_BACKTICKS = 3;
3834
+ function stripPartBackticks(text) {
3835
+ return text.replace(/`[^`\n]*`/g, " ");
3836
+ }
3837
+ function partWordCount(text) {
3838
+ return text.split(/\s+/).filter((w) => /[a-z]/i.test(w)).length;
3839
+ }
3840
+ function looksLikeFilePath(entry) {
3841
+ const stripped = entry.replace(/\/\*\*?$/, "");
3842
+ const lastSegment = stripped.split("/").pop() ?? stripped;
3843
+ const extMatch = /\.[A-Za-z0-9]{1,6}$/.exec(lastSegment);
3844
+ return extMatch !== null && extMatch.index > 0;
3845
+ }
3846
+ function splitGlobList(raw) {
3847
+ return raw.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
3848
+ }
3849
+ function parseIssueSurface(body) {
3850
+ const section = topLevelSectionText(body, "Surface");
3851
+ if (section === null)
3852
+ return { ok: false, errors: ["no `## Surface` heading found in the body."] };
3853
+ const inLine = /^in:\s*(.+)$/im.exec(section);
3854
+ const outLine = /^out:\s*(.+)$/im.exec(section);
3855
+ const errors = [];
3856
+ if (!inLine)
3857
+ errors.push("`## Surface` has no `in:` line.");
3858
+ if (!outLine)
3859
+ errors.push("`## Surface` has no `out:` line.");
3860
+ if (errors.length > 0)
3861
+ return { ok: false, errors };
3862
+ const inGlobs = splitGlobList(inLine[1]);
3863
+ const outGlobs = splitGlobList(outLine[1]);
3864
+ for (const g of [...inGlobs, ...outGlobs]) {
3865
+ if (looksLikeFilePath(g)) {
3866
+ errors.push(`\`${g}\` in \`## Surface\` looks like a file path — Surface entries are directory-level globs, never file paths.`);
3867
+ }
3868
+ }
3869
+ if (inGlobs.length === 0)
3870
+ errors.push("`## Surface`'s `in:` line resolved to zero globs.");
3871
+ if (errors.length > 0)
3872
+ return { ok: false, errors };
3873
+ return { ok: true, value: { in: inGlobs, out: outGlobs } };
3874
+ }
3875
+ function globCoversPath(glob, path) {
3876
+ const g = glob.replace(/\/\*\*?$/, "").replace(/\/+$/, "");
3877
+ const p = path.replace(/\/+$/, "");
3878
+ if (g === "*")
3879
+ return !p.includes("/");
3880
+ return g === p || g.startsWith(`${p}/`) || p.startsWith(`${g}/`);
3881
+ }
3882
+ function checkSurfaceGlobsResolve(body, resolvesToFile) {
3883
+ const surface = parseIssueSurface(body);
3884
+ if (!surface.ok)
3885
+ return { status: "pass", errors: [] };
3886
+ const errors = [];
3887
+ for (const glob of surface.value.in) {
3888
+ if (!resolvesToFile(glob)) {
3889
+ errors.push(`issue-validation Surface: \`${glob}\` in \`## Surface\`'s \`in:\` list matches no tracked file — a Surface that cannot resolve cannot render a brief's file list.`);
3890
+ }
3891
+ }
3892
+ return { status: errors.length > 0 ? "fail" : "pass", errors };
3893
+ }
3894
+ function checkSurfaceScope(changedFiles, outGlobs) {
3895
+ if (outGlobs.length === 0)
3896
+ return { ok: true };
3897
+ const violations = [];
3898
+ for (const file of changedFiles) {
3899
+ const glob = outGlobs.find((g) => globCoversPath(g, file));
3900
+ if (glob)
3901
+ violations.push({ file, glob });
3902
+ }
3903
+ return violations.length > 0 ? { ok: false, violations } : { ok: true };
3904
+ }
3905
+ var ISSUE_PART_LINE_RE = /^Part\s+(\d+)\s*\(([^)]*)\)\s*[-—–]\s*(.*)$/i;
3906
+ function parseIssueParts(body) {
3907
+ const section = topLevelSectionText(body, "Parts");
3908
+ if (section === null)
3909
+ return { ok: false, errors: ["no `## Parts` heading found in the body."] };
3910
+ const lines = section.split(/\r?\n/).map((l) => l.trim()).filter((l) => l.length > 0);
3911
+ const parts = [];
3912
+ const errors = [];
3913
+ for (const line of lines) {
3914
+ const m = ISSUE_PART_LINE_RE.exec(line);
3915
+ if (!m) {
3916
+ errors.push(`"${line}" is not a well-formed Parts line — expected \`Part <n> (<refs>) — <outcome>\`.`);
3917
+ continue;
3918
+ }
3919
+ const n = Number.parseInt(m[1], 10);
3920
+ const refs = m[2];
3921
+ const text = m[3].trim();
3922
+ if (text.length === 0) {
3923
+ errors.push(`Part ${n} has no outcome text after the dash — every Part states one observable outcome.`);
3924
+ continue;
3925
+ }
3558
3926
  if (partHasBacktickedPath(text) && partWordCount(stripPartBackticks(text)) < PART_MIN_WORDS_OUTSIDE_BACKTICKS) {
3559
3927
  errors.push(`Part ${n} is little more than a file path — a Part names an outcome and symbols, never a bare path.`);
3560
3928
  continue;
@@ -3668,6 +4036,27 @@ function checkProjectsRegistered(body, _labels, registeredNames) {
3668
4036
  }
3669
4037
  var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
3670
4038
  var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
4039
+ var FILE_EXTENSIONS = new Set([
4040
+ "ts",
4041
+ "tsx",
4042
+ "js",
4043
+ "jsx",
4044
+ "mjs",
4045
+ "cjs",
4046
+ "json",
4047
+ "jsonc",
4048
+ "md",
4049
+ "mdx",
4050
+ "yml",
4051
+ "yaml",
4052
+ "txt",
4053
+ "sh",
4054
+ "lock",
4055
+ "toml",
4056
+ "ndjson",
4057
+ "html",
4058
+ "css"
4059
+ ]);
3671
4060
 
3672
4061
  // ../../packages/aeg-core/src/task-branch-identity.ts
3673
4062
  var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
@@ -4046,8 +4435,7 @@ function briefHash(brief) {
4046
4435
  function policyDigest(policy) {
4047
4436
  return createHash4("sha256").update(JSON.stringify({
4048
4437
  codeReviewThreshold: policy.codeReviewThreshold,
4049
- securityThreshold: policy.securityThreshold,
4050
- maxRounds: policy.maxRounds
4438
+ securityThreshold: policy.securityThreshold
4051
4439
  })).digest("hex");
4052
4440
  }
4053
4441
  function isBoundToHead(echoed, headSha) {
@@ -4113,6 +4501,15 @@ function compareManifest(echoed, current, patchIdOf) {
4113
4501
  }
4114
4502
 
4115
4503
  // ../../packages/aeg-core/src/review-gate.ts
4504
+ function renderGateDeferred(deferred) {
4505
+ if (deferred.length === 0)
4506
+ return "";
4507
+ const items = deferred.map((d) => {
4508
+ const where = d.finding.location && d.finding.location.length > 0 ? d.finding.location : "(no location)";
4509
+ return `${d.finding.severity} ${where} (${DEFERRAL_REASON_TEXT[d.reason]})`;
4510
+ }).join("; ");
4511
+ return ` ${deferred.length} finding(s) deferred, not blocking this round: ${items}.`;
4512
+ }
4116
4513
  function checkReviewGate(input) {
4117
4514
  const principalAllowlist = input.principalAllowlist ?? PRINCIPAL_ALLOWLIST;
4118
4515
  const waived = isWaiverLabelActorVerified({
@@ -4137,8 +4534,8 @@ function checkReviewGate(input) {
4137
4534
  let codeReviewPolicyEvaluation;
4138
4535
  let securityPolicyEvaluation;
4139
4536
  try {
4140
- codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy);
4141
- securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy);
4537
+ codeReviewPolicyEvaluation = evaluateCodeReview(consequentialFindings(codeReview.findingSeverities), policy, input.deferralContext);
4538
+ securityPolicyEvaluation = evaluateSecurityReview(consequentialFindings(security.findingSeverities), policy, input.deferralContext);
4142
4539
  } catch (err) {
4143
4540
  return {
4144
4541
  verdict: "fail",
@@ -4184,10 +4581,14 @@ function checkReviewGate(input) {
4184
4581
  const securityObjectivesBound = securityBinding.objectivesVersion;
4185
4582
  const codeReviewRulingsBound = codeReviewBinding.rulingOrdinal;
4186
4583
  const securityRulingsBound = securityBinding.rulingOrdinal;
4584
+ const deferredNote = renderGateDeferred([
4585
+ ...codeReviewPolicyEvaluation.deferredFindings,
4586
+ ...securityPolicyEvaluation.deferredFindings
4587
+ ]);
4187
4588
  if (codeReviewClean && codeReviewBinding.bound && securityClean && securityBinding.bound) {
4188
4589
  return {
4189
4590
  verdict: "pass",
4190
- reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.`,
4591
+ reason: `code-reviewer verdict is a clean APPROVE and security-review verdict is a clean PASS, both covering head ${input.headSha}.${deferredNote}`,
4191
4592
  waived: false
4192
4593
  };
4193
4594
  }
@@ -4229,7 +4630,7 @@ function checkReviewGate(input) {
4229
4630
  const ignoredNote = ignoredCount > 0 ? ` ${ignoredCount} verdict-shaped comment(s) from authors outside the principal allowlist were ignored.` : "";
4230
4631
  return {
4231
4632
  verdict: "fail",
4232
- reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}`,
4633
+ reason: `${problems.join("; ")}. A principal can apply an actor-verified \`${WAIVER_LABEL_REVIEW}\` label to skip this requirement, or post the missing/clean verdict comment(s).${ignoredNote}${deferredNote}`,
4233
4634
  waived: false
4234
4635
  };
4235
4636
  }
@@ -4336,577 +4737,202 @@ function parseEnforcementRegistry(content) {
4336
4737
  const action = stripBold(cells[0] ?? "");
4337
4738
  const summary = stripBackticks2(cells[1] ?? "");
4338
4739
  const category = stripBackticks2(cells[2] ?? "");
4339
- const implementation = stripBackticks2((implementationIndex === -1 ? cells[cells.length - 1] : cells[implementationIndex]) ?? "");
4340
- const description = descriptionIndex === -1 ? undefined : stripBackticks2(cells[descriptionIndex] ?? "") || undefined;
4341
- const specIndex = (audienceIndex === -1 ? cells.length - 1 : audienceIndex) - 1;
4342
- const spec = specIndex >= 3 ? stripBackticks2(cells[specIndex] ?? "") || undefined : undefined;
4343
- const audience = audienceIndex === -1 ? "repo-own" : stripBackticks2(cells[audienceIndex] ?? "") === "product" ? "product" : "repo-own";
4344
- result.push({ ring, action, summary, category, description, spec, implementation, audience, line: row.line });
4345
- }
4346
- }
4347
- return result;
4348
- }
4349
- // ../../packages/aeg-core/src/registry-checks.ts
4350
- function checkG1(rows, existsFn) {
4351
- const findings = [];
4352
- for (const row of rows) {
4353
- if (row.implementation === "")
4354
- continue;
4355
- if (!existsFn(row.implementation)) {
4356
- findings.push({
4357
- row: row.action,
4358
- path: row.implementation,
4359
- reason: `${row.ring} row "${row.action}" names implementation "${row.implementation}", which does not exist on disk`
4360
- });
4361
- }
4362
- }
4363
- return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
4364
- }
4365
- var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
4366
- var NON_GATE_BIN_NAMES = NON_GATE_BINS;
4367
- var TWIN_CANDIDATE_EXCEPTIONS = {
4368
- "apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
4369
- "apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
4370
- "apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
4371
- };
4372
- var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
4373
- function checkG2(rows, candidateFiles) {
4374
- const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
4375
- const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
4376
- const findings = [];
4377
- for (const path of candidateFiles) {
4378
- if (implementations.has(path))
4379
- continue;
4380
- if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
4381
- continue;
4382
- if (NON_GATE_HOOK_SCRIPTS.includes(path))
4383
- continue;
4384
- if (path in TWIN_CANDIDATE_EXCEPTIONS)
4385
- continue;
4386
- const candidateNames = claimedCheckNames(path);
4387
- if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
4388
- continue;
4389
- findings.push({
4390
- path,
4391
- reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
4392
- });
4393
- }
4394
- for (const row of rows) {
4395
- const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
4396
- if (carriesPlaceholder) {
4397
- findings.push({
4398
- row: row.action,
4399
- path: row.implementation,
4400
- reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
4401
- });
4402
- }
4403
- }
4404
- return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
4405
- }
4406
- function checkG3(ring0Rows, crossingFiles) {
4407
- const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
4408
- const findings = [];
4409
- for (const path of crossingFiles) {
4410
- if (!ring0Implementations.has(path)) {
4411
- findings.push({
4412
- path,
4413
- reason: `"${path}" makes a GitHub-crossing call but is not named by any Ring-0 row's implementation — a seventh, unlisted way into GitHub`
4414
- });
4415
- }
4416
- }
4417
- return { check: "G3", status: findings.length > 0 ? "fail" : "pass", findings };
4418
- }
4419
- function checkG4(content, resolveFn) {
4420
- const cited = new Set;
4421
- for (const hit of content.matchAll(/#(\d{3,})\b/g)) {
4422
- cited.add(Number(hit[1]));
4423
- }
4424
- const findings = [];
4425
- for (const n of cited) {
4426
- if (!resolveFn(n)) {
4427
- findings.push({
4428
- reason: `#${n} is cited in enforcement.md but does not resolve to a real Issue or PR in the forge`
4429
- });
4430
- }
4431
- }
4432
- return { check: "G4", status: findings.length > 0 ? "fail" : "pass", findings };
4433
- }
4434
- function checkG5(roles, contracts) {
4435
- const roleIds = new Set(roles.map((r) => r.role_id));
4436
- const findings = [];
4437
- for (const contract of contracts) {
4438
- if (!roleIds.has(contract.producer)) {
4439
- findings.push({
4440
- path: contract.file,
4441
- reason: `contract "${contract.file}" names producer "${contract.producer}", which is not a real role_id`
4442
- });
4443
- }
4444
- if (!roleIds.has(contract.consumer)) {
4445
- findings.push({
4446
- path: contract.file,
4447
- reason: `contract "${contract.file}" names consumer "${contract.consumer}", which is not a real role_id`
4448
- });
4449
- }
4450
- }
4451
- for (const role of roles) {
4452
- if (role.performs.length === 0) {
4453
- findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty performs array` });
4454
- }
4455
- if (role.refuses_when.trim() === "") {
4456
- findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty refuses_when` });
4457
- }
4458
- }
4459
- return { check: "G5", status: findings.length > 0 ? "fail" : "pass", findings };
4460
- }
4461
- var SHIPPED_BIN_PATH_PREFIX = "apps/cli/src/checks/bin/check-";
4462
- var AEG_CORE_BIN_PATH_PREFIX = "packages/aeg-core/bin/";
4463
- function basenameNoExt(path) {
4464
- const base = path.slice(path.lastIndexOf("/") + 1);
4465
- return base.replace(/\.ts$/, "");
4466
- }
4467
- function claimedCheckNames(implementation) {
4468
- if (implementation.startsWith(SHIPPED_BIN_PATH_PREFIX) && implementation.endsWith(".ts")) {
4469
- return [implementation.slice(SHIPPED_BIN_PATH_PREFIX.length, -".ts".length)];
4470
- }
4471
- if (implementation.startsWith(AEG_CORE_BIN_PATH_PREFIX)) {
4472
- const audience = GATE_AUDIENCE[basenameNoExt(implementation)];
4473
- if (audience && isShipped(audience)) {
4474
- return Array.isArray(audience.shippedAs) ? audience.shippedAs : [audience.shippedAs];
4475
- }
4476
- }
4477
- return [];
4478
- }
4479
- function checkG6(rows, registeredCheckNames) {
4480
- const findings = [];
4481
- for (const row of rows) {
4482
- if (row.audience !== "product")
4483
- continue;
4484
- const candidates = claimedCheckNames(row.implementation);
4485
- if (!candidates.some((name) => registeredCheckNames.has(name))) {
4486
- findings.push({
4487
- row: row.action,
4488
- path: row.implementation,
4489
- reason: `${row.ring} row "${row.action}" is marked \`product\` but its implementation "${row.implementation}" does not resolve to a coreCheckRegistry() entry`
4490
- });
4491
- }
4492
- }
4493
- return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
4494
- }
4495
- // ../../packages/aeg-core/src/reader-resolvable-prose.ts
4496
- var PRODUCT_SLUG_SCOPE = [
4497
- "apps/cli/src",
4498
- ".github/workflows",
4499
- ".vinaya",
4500
- "apps/cli/README.md",
4501
- "packages/sources/README.md"
4502
- ];
4503
- function isUnderOrEqual(path, prefix) {
4504
- return path === prefix || path.startsWith(`${prefix}/`);
4505
- }
4506
- function isProductScopeFile(path) {
4507
- return PRODUCT_SLUG_SCOPE.some((prefix) => isUnderOrEqual(path, prefix));
4508
- }
4509
- var SHIPS_PREFIX = "aeg-root/";
4510
- function shipsArchivePrefix(shipsPrefix) {
4511
- return `${shipsPrefix}tranches/completed/`;
4512
- }
4513
- var DEFAULT_SPEC_PATHS = ["SPEC.md", "CONTEXT.md", "docs/adr"];
4514
- function normalizeSpecPath(entry) {
4515
- let out = entry.replace(/\\/g, "/");
4516
- while (out.startsWith("./"))
4517
- out = out.slice(2);
4518
- out = out.replace(/\/{2,}/g, "/");
4519
- while (out.endsWith("/"))
4520
- out = out.slice(0, -1);
4521
- return out;
4522
- }
4523
- function isSpecFile2(path, specPaths) {
4524
- if (path.startsWith("apps/") && path.includes("/specs/") && path.endsWith(".md"))
4525
- return true;
4526
- if (!path.endsWith(".md"))
4527
- return false;
4528
- return specPaths.some((entry) => isUnderOrEqual(path, normalizeSpecPath(entry)));
4529
- }
4530
- function isClaudeMdFile(path) {
4531
- return path === "CLAUDE.md" || path.endsWith("/CLAUDE.md");
4532
- }
4533
- function classifyProseFile(path, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX, specPaths = DEFAULT_SPEC_PATHS) {
4534
- if (path.startsWith(shipsPrefix)) {
4535
- return path.startsWith(shipsArchivePrefix(shipsPrefix)) ? "internal" : "ships";
4536
- }
4537
- if (path.startsWith(readerFacingPrefix) && path.endsWith(readerFacingSuffix)) {
4538
- return "reader-facing";
4539
- }
4540
- if (isClaudeMdFile(path))
4541
- return "internal";
4542
- if (isSpecFile2(path, specPaths))
4543
- return "spec";
4544
- if (isProductScopeFile(path))
4545
- return "product";
4546
- return null;
4547
- }
4548
- var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
4549
- function stripNonProse(path, content) {
4550
- if (path.endsWith(".md")) {
4551
- return content.replace(/```.*?```/gs, (m) => m.replace(/[^\n]/g, "")).replace(/`[^`\n]*`/g, (m) => m.replace(/[^\n]/g, ""));
4552
- }
4553
- if (path.endsWith(".tsx") || path.endsWith(".ts")) {
4554
- return content.replace(/\/\*.*?\*\//gs, (m) => m.replace(/[^\n]/g, "")).replace(/(^|[^:])\/\/[^\n]*/g, (m) => m.replace(/[^\n]/g, ""));
4740
+ const implementation = stripBackticks2((implementationIndex === -1 ? cells[cells.length - 1] : cells[implementationIndex]) ?? "");
4741
+ const description = descriptionIndex === -1 ? undefined : stripBackticks2(cells[descriptionIndex] ?? "") || undefined;
4742
+ const specIndex = (audienceIndex === -1 ? cells.length - 1 : audienceIndex) - 1;
4743
+ const spec = specIndex >= 3 ? stripBackticks2(cells[specIndex] ?? "") || undefined : undefined;
4744
+ const audience = audienceIndex === -1 ? "repo-own" : stripBackticks2(cells[audienceIndex] ?? "") === "product" ? "product" : "repo-own";
4745
+ result.push({ ring, action, summary, category, description, spec, implementation, audience, line: row.line });
4746
+ }
4555
4747
  }
4556
- return content;
4748
+ return result;
4557
4749
  }
4558
- function stripNonProseForProduct(path, content) {
4559
- return path.endsWith(".md") ? stripNonProse(path, content) : content;
4750
+ // ../../packages/aeg-core/src/registry-checks.ts
4751
+ var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
4752
+ var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
4753
+ function basename(path) {
4754
+ return path.slice(path.lastIndexOf("/") + 1);
4560
4755
  }
4561
- function lineAt(content, index) {
4756
+ function lineOf(content, index) {
4562
4757
  let line = 1;
4563
- for (let i = 0;i < index; i++) {
4758
+ for (let i = 0;i < index; i++)
4564
4759
  if (content.charCodeAt(i) === 10)
4565
4760
  line++;
4566
- }
4567
4761
  return line;
4568
4762
  }
4569
- var FORGE_NUMBER_PATTERN = /#[0-9]{2,4}/g;
4570
- var TRANCHE_SLUG_VN_PATTERN = /[a-z][a-z-]+-v[0-9]/g;
4571
- var TASK_NUMBER_PATTERN = /(^|[^a-z0-9-])(tasks?[ \t]+#?[0-9]+)/gi;
4572
- function legacySlugPattern(legacySlugs) {
4573
- if (legacySlugs.length === 0)
4574
- return null;
4575
- const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
4576
- return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
4577
- }
4578
- function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4763
+ function findUnshippedHookRefs(docs, shipped) {
4764
+ const shippedNames = new Set([...shipped].map(basename));
4579
4765
  const findings = [];
4580
- const legacyPattern = legacySlugPattern(legacySlugs);
4581
- const grandfathered = new Set(specGrandfather);
4582
- const patterns = [
4583
- { pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
4584
- { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
4585
- ...legacyPattern ? [{ pattern: legacyPattern, what: "an internal tranche slug", group: 2 }] : []
4586
- ];
4587
- const productPatterns = [
4588
- { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug in product code" }
4589
- ];
4590
- const specPatterns = [
4591
- ...patterns,
4592
- { pattern: TASK_NUMBER_PATTERN, what: "a task number", group: 2 }
4593
- ];
4594
- for (const file of files) {
4595
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix, specPaths);
4596
- if (!cls || cls === "internal")
4597
- continue;
4598
- if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
4599
- continue;
4600
- if (cls === "spec" && grandfathered.has(file.path))
4601
- continue;
4602
- const blocking = cls === "product" || cls === "spec";
4603
- const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
4604
- const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
4605
- for (const { pattern, what, group } of patternsToRun) {
4606
- pattern.lastIndex = 0;
4607
- let match = pattern.exec(scrubbed);
4608
- while (match !== null) {
4609
- const cited = group !== undefined ? match[group] ?? match[0] : match[0];
4610
- const citedIndex = match.index + match[0].indexOf(cited);
4611
- findings.push({
4612
- file: file.path,
4613
- line: lineAt(scrubbed, citedIndex),
4614
- message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
4615
- blocking
4616
- });
4617
- match = pattern.exec(scrubbed);
4618
- }
4766
+ const flag = (doc, token, index) => {
4767
+ findings.push({
4768
+ path: doc.path,
4769
+ reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
4770
+ });
4771
+ };
4772
+ for (const doc of docs) {
4773
+ for (const { cited, index } of extractCitedPaths(doc.content)) {
4774
+ if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
4775
+ continue;
4776
+ if (!shipped.has(cited))
4777
+ flag(doc, cited, index);
4778
+ }
4779
+ const spanPattern = /`([^`\n]+)`/g;
4780
+ let match = spanPattern.exec(doc.content);
4781
+ while (match !== null) {
4782
+ const token = match[1] ?? "";
4783
+ if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
4784
+ flag(doc, token, match.index);
4785
+ match = spanPattern.exec(doc.content);
4619
4786
  }
4620
4787
  }
4621
4788
  return findings;
4622
4789
  }
4623
- function escapeTerm(term) {
4624
- return term.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4625
- }
4626
- function containsWholeWord(text, term) {
4627
- const escaped = escapeTerm(term);
4628
- const re = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)`, "i");
4629
- return re.test(text);
4630
- }
4631
- function findWholeWordLine(content, term) {
4632
- const lines = content.split(`
4633
- `);
4634
- let lineNo = 0;
4635
- for (const line of lines) {
4636
- lineNo++;
4637
- if (containsWholeWord(line, term))
4638
- return lineNo;
4639
- }
4640
- return null;
4641
- }
4642
- function definesOrLinksGlossary(content, term) {
4643
- const escaped = escapeTerm(term);
4644
- const definesInline = new RegExp(`(^|[^a-zA-Z])${escaped}([^a-zA-Z]|$)[^\\n]{0,3}—`, "i").test(content);
4645
- if (definesInline)
4646
- return true;
4647
- return /docs\/glossary|glossary\.md/i.test(content);
4648
- }
4649
- function checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix = SHIPS_PREFIX) {
4790
+ function checkG1(rows, existsFn, hookRefs) {
4650
4791
  const findings = [];
4651
- for (const file of files) {
4652
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
4653
- if (!cls || !SWEPT_CLASSES.has(cls))
4792
+ for (const row of rows) {
4793
+ if (row.implementation === "")
4654
4794
  continue;
4655
- const scrubbed = stripNonProse(file.path, file.content);
4656
- for (const term of glossaryTerms) {
4657
- const line = findWholeWordLine(scrubbed, term);
4658
- if (line === null)
4659
- continue;
4660
- if (definesOrLinksGlossary(scrubbed, term))
4661
- continue;
4795
+ if (!existsFn(row.implementation)) {
4662
4796
  findings.push({
4663
- file: file.path,
4664
- line,
4665
- message: `uses coined term "${term}" without defining it inline or linking the glossary`,
4666
- blocking: false
4797
+ row: row.action,
4798
+ path: row.implementation,
4799
+ reason: `${row.ring} row "${row.action}" names implementation "${row.implementation}", which does not exist on disk`
4667
4800
  });
4668
4801
  }
4669
4802
  }
4670
- return findings;
4803
+ if (hookRefs)
4804
+ findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
4805
+ return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
4671
4806
  }
4672
- var SOURCE_COMMENT_TRANCHE_SLUG_PATTERN = /[a-z0-9]+(?:-[a-z0-9]+)*-v[0-9]+/g;
4673
- var SOURCE_COMMENT_FORGE_NUMBER_PATTERN = /#[0-9]{2,}/g;
4674
- function extractComments(path, content) {
4675
- if (!path.endsWith(".ts") && !path.endsWith(".tsx"))
4676
- return content.replace(/[^\n]/g, "");
4677
- let state = "code";
4678
- let out = "";
4679
- const n = content.length;
4680
- let i = 0;
4681
- const blank = (ch) => ch === `
4682
- ` ? `
4683
- ` : " ";
4684
- while (i < n) {
4685
- const c = content[i];
4686
- const next = i + 1 < n ? content[i + 1] : "";
4687
- if (state === "code") {
4688
- if (c === "/" && next === "/") {
4689
- state = "line-comment";
4690
- out += c;
4691
- i++;
4692
- continue;
4693
- }
4694
- if (c === "/" && next === "*") {
4695
- state = "block-comment";
4696
- out += c;
4697
- i++;
4698
- continue;
4699
- }
4700
- if (c === "'") {
4701
- state = "single-quote";
4702
- out += blank(c);
4703
- i++;
4704
- continue;
4705
- }
4706
- if (c === '"') {
4707
- state = "double-quote";
4708
- out += blank(c);
4709
- i++;
4710
- continue;
4711
- }
4712
- if (c === "`") {
4713
- state = "template";
4714
- out += blank(c);
4715
- i++;
4716
- continue;
4717
- }
4718
- out += blank(c);
4719
- i++;
4807
+ var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
4808
+ var NON_GATE_BIN_NAMES = NON_GATE_BINS;
4809
+ var TWIN_CANDIDATE_EXCEPTIONS = {
4810
+ "apps/cli/src/checks/bin/check-dead-branch-push.ts": 'Ring 0 "Pushing to a branch whose pull request already resolved" (implementation: check-push-target.ts)',
4811
+ "apps/cli/src/checks/bin/check-issue-assignment.ts": `Ring 0 "A task branch's first push (Issue self-assignment)" (implementation: assign-task-issue.ts)`,
4812
+ "apps/cli/src/checks/bin/check-closes-n.ts": 'Ring 1 "Closes linkage" (implementation: verify-coherence.ts)'
4813
+ };
4814
+ var NON_GATE_HOOK_SCRIPTS = [".claude/hooks/track-transcript.sh"];
4815
+ function checkG2(rows, candidateFiles) {
4816
+ const implementations = new Set(rows.map((r) => r.implementation).filter((p) => p !== ""));
4817
+ const claimedNames = new Set(rows.flatMap((r) => claimedCheckNames(r.implementation)));
4818
+ const findings = [];
4819
+ for (const path of candidateFiles) {
4820
+ if (implementations.has(path))
4720
4821
  continue;
4721
- }
4722
- if (state === "line-comment") {
4723
- if (c === `
4724
- `) {
4725
- state = "code";
4726
- out += `
4727
- `;
4728
- i++;
4729
- continue;
4730
- }
4731
- out += c;
4732
- i++;
4822
+ if (path.startsWith(AEG_CORE_BIN_PATH_PREFIX) && NON_GATE_BIN_NAMES.includes(basenameNoExt(path)))
4733
4823
  continue;
4734
- }
4735
- if (state === "block-comment") {
4736
- if (c === "*" && next === "/") {
4737
- out += c;
4738
- out += next;
4739
- state = "code";
4740
- i += 2;
4741
- continue;
4742
- }
4743
- out += c === `
4744
- ` ? `
4745
- ` : c;
4746
- i++;
4824
+ if (NON_GATE_HOOK_SCRIPTS.includes(path))
4747
4825
  continue;
4748
- }
4749
- const closer = state === "single-quote" ? "'" : state === "double-quote" ? '"' : "`";
4750
- if (c === "\\") {
4751
- out += blank(c);
4752
- i++;
4753
- if (i < n) {
4754
- out += blank(content[i]);
4755
- i++;
4756
- }
4826
+ if (path in TWIN_CANDIDATE_EXCEPTIONS)
4757
4827
  continue;
4758
- }
4759
- if (c === closer) {
4760
- state = "code";
4761
- out += blank(c);
4762
- i++;
4828
+ const candidateNames = claimedCheckNames(path);
4829
+ if (candidateNames.length > 0 && candidateNames.some((n) => claimedNames.has(n)))
4763
4830
  continue;
4764
- }
4765
- out += blank(c);
4766
- i++;
4831
+ findings.push({
4832
+ path,
4833
+ reason: `"${path}" is not named as the implementation of any row in enforcement.md's ring tables`
4834
+ });
4767
4835
  }
4768
- return out;
4769
- }
4770
- function checkSourceComments(files, allowlist = []) {
4771
- const findings = [];
4772
- const allowed = new Set(allowlist);
4773
- const patterns = [
4774
- { pattern: SOURCE_COMMENT_TRANCHE_SLUG_PATTERN, what: "a tranche-slug citation" },
4775
- { pattern: SOURCE_COMMENT_FORGE_NUMBER_PATTERN, what: "a forge-number citation" }
4776
- ];
4777
- for (const file of files) {
4778
- if (!file.path.endsWith(".ts"))
4779
- continue;
4780
- if (allowed.has(file.path))
4781
- continue;
4782
- const comments = extractComments(file.path, file.content);
4783
- for (const { pattern, what } of patterns) {
4784
- pattern.lastIndex = 0;
4785
- let match = pattern.exec(comments);
4786
- while (match !== null) {
4787
- findings.push({
4788
- file: file.path,
4789
- line: lineAt(comments, match.index),
4790
- message: `comment cites ${what} ("${match[0]}") a reader outside this repo's tracker cannot resolve`,
4791
- blocking: false
4792
- });
4793
- match = pattern.exec(comments);
4794
- }
4836
+ for (const row of rows) {
4837
+ const carriesPlaceholder = [row.summary, row.description, row.spec].some((cell) => cell === SCAFFOLD_PLACEHOLDER);
4838
+ if (carriesPlaceholder) {
4839
+ findings.push({
4840
+ row: row.action,
4841
+ path: row.implementation,
4842
+ reason: `${row.ring} row "${row.action}" still carries the scaffold placeholder marker — the why is owed`
4843
+ });
4795
4844
  }
4796
4845
  }
4797
- return findings;
4798
- }
4799
- function checkReaderResolvableProse(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
4800
- return [
4801
- ...checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs, shipsPrefix, specGrandfather, specPaths),
4802
- ...checkUndefinedVocabulary(files, glossaryTerms, readerFacingPrefix, readerFacingSuffix, shipsPrefix)
4803
- ];
4846
+ return { check: "G2", status: findings.length > 0 ? "fail" : "pass", findings };
4804
4847
  }
4805
- function parseGlossaryTerms(glossaryContent) {
4806
- const terms = [];
4807
- const re = /^\*\*(.+?)\*\* —/gm;
4808
- let match = re.exec(glossaryContent);
4809
- while (match !== null) {
4810
- if (match[1] !== undefined)
4811
- terms.push(match[1]);
4812
- match = re.exec(glossaryContent);
4848
+ function checkG3(ring0Rows, crossingFiles) {
4849
+ const ring0Implementations = new Set(ring0Rows.map((r) => r.implementation));
4850
+ const findings = [];
4851
+ for (const path of crossingFiles) {
4852
+ if (!ring0Implementations.has(path)) {
4853
+ findings.push({
4854
+ path,
4855
+ reason: `"${path}" makes a GitHub-crossing call but is not named by any Ring-0 row's implementation — a seventh, unlisted way into GitHub`
4856
+ });
4857
+ }
4813
4858
  }
4814
- return terms;
4815
- }
4816
-
4817
- // ../../packages/aeg-core/src/quoted-command.ts
4818
- var QUOTED_COMMAND_SHIPS_PREFIX = "aeg-root/";
4819
- var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
4820
- var START_PATTERN = /<!--\s*AEG:QUOTES-FILE:START:(\S+?)\s*-->/g;
4821
- var END_PATTERN = /<!--\s*AEG:QUOTES-FILE:END\s*-->/;
4822
- function isValidCitedFilePath(path) {
4823
- if (path.length === 0)
4824
- return false;
4825
- if (path.startsWith("/") || path.startsWith("\\"))
4826
- return false;
4827
- if (/^[A-Za-z]:[\\/]/.test(path))
4828
- return false;
4829
- return !path.split(/[\\/]+/).includes("..");
4859
+ return { check: "G3", status: findings.length > 0 ? "fail" : "pass", findings };
4830
4860
  }
4831
- function quotedCommandLineAt(content, index) {
4832
- let line = 1;
4833
- for (let i = 0;i < index; i++) {
4834
- if (content.charCodeAt(i) === 10)
4835
- line++;
4861
+ function checkG4(content, resolveFn) {
4862
+ const cited = new Set;
4863
+ for (const hit of content.matchAll(/#(\d{3,})\b/g)) {
4864
+ cited.add(Number(hit[1]));
4836
4865
  }
4837
- return line;
4838
- }
4839
- function extractQuotedText(raw) {
4840
- const trimmed = raw.trim();
4841
- const fenced = /^(?:`{3,}|~{3,})[^\n]*\n([\s\S]*?)\n?(?:`{3,}|~{3,})$/.exec(trimmed);
4842
- if (fenced)
4843
- return (fenced[1] ?? "").trim();
4844
- const inline = /^`([^`]+)`$/.exec(trimmed);
4845
- if (inline)
4846
- return (inline[1] ?? "").trim();
4847
- return trimmed;
4866
+ const findings = [];
4867
+ for (const n of cited) {
4868
+ if (!resolveFn(n)) {
4869
+ findings.push({
4870
+ reason: `#${n} is cited in enforcement.md but does not resolve to a real Issue or PR in the forge`
4871
+ });
4872
+ }
4873
+ }
4874
+ return { check: "G4", status: findings.length > 0 ? "fail" : "pass", findings };
4848
4875
  }
4849
- function findQuotesInFile(path, content) {
4850
- const masked = maskCode(content);
4851
- const quotes = [];
4852
- START_PATTERN.lastIndex = 0;
4853
- let start = START_PATTERN.exec(masked);
4854
- while (start !== null) {
4855
- const citedFile = start[1];
4856
- const innerStart = start.index + start[0].length;
4857
- const end = END_PATTERN.exec(masked.slice(innerStart));
4858
- if (end === null) {
4859
- START_PATTERN.lastIndex = innerStart;
4860
- start = START_PATTERN.exec(masked);
4861
- continue;
4876
+ function checkG5(roles, contracts) {
4877
+ const roleIds = new Set(roles.map((r) => r.role_id));
4878
+ const findings = [];
4879
+ for (const contract of contracts) {
4880
+ if (!roleIds.has(contract.producer)) {
4881
+ findings.push({
4882
+ path: contract.file,
4883
+ reason: `contract "${contract.file}" names producer "${contract.producer}", which is not a real role_id`
4884
+ });
4862
4885
  }
4863
- const innerEnd = innerStart + end.index;
4864
- if (isValidCitedFilePath(citedFile)) {
4865
- const quotedText = extractQuotedText(content.slice(innerStart, innerEnd));
4866
- if (quotedText.length > 0) {
4867
- quotes.push({ file: path, line: quotedCommandLineAt(content, innerStart), quotedText, citedFile });
4868
- }
4886
+ if (!roleIds.has(contract.consumer)) {
4887
+ findings.push({
4888
+ path: contract.file,
4889
+ reason: `contract "${contract.file}" names consumer "${contract.consumer}", which is not a real role_id`
4890
+ });
4869
4891
  }
4870
- START_PATTERN.lastIndex = innerEnd + end[0].length;
4871
- start = START_PATTERN.exec(masked);
4872
4892
  }
4873
- return quotes;
4893
+ for (const role of roles) {
4894
+ if (role.performs.length === 0) {
4895
+ findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty performs array` });
4896
+ }
4897
+ if (role.refuses_when.trim() === "") {
4898
+ findings.push({ path: role.file, reason: `role "${role.role_id}" has an empty refuses_when` });
4899
+ }
4900
+ }
4901
+ return { check: "G5", status: findings.length > 0 ? "fail" : "pass", findings };
4874
4902
  }
4875
- function findCitedQuotes(files, readerFacingPrefix, readerFacingSuffix, shipsPrefix = QUOTED_COMMAND_SHIPS_PREFIX) {
4876
- const quotes = [];
4877
- for (const file of files) {
4878
- const cls = classifyProseFile(file.path, readerFacingPrefix, readerFacingSuffix, shipsPrefix);
4879
- if (!cls || !QUOTED_COMMAND_SWEPT_CLASSES.has(cls))
4880
- continue;
4881
- quotes.push(...findQuotesInFile(file.path, file.content));
4903
+ var SHIPPED_BIN_PATH_PREFIX = "apps/cli/src/checks/bin/check-";
4904
+ var AEG_CORE_BIN_PATH_PREFIX = "packages/aeg-core/bin/";
4905
+ function basenameNoExt(path) {
4906
+ const base = path.slice(path.lastIndexOf("/") + 1);
4907
+ return base.replace(/\.ts$/, "");
4908
+ }
4909
+ function claimedCheckNames(implementation) {
4910
+ if (implementation.startsWith(SHIPPED_BIN_PATH_PREFIX) && implementation.endsWith(".ts")) {
4911
+ return [implementation.slice(SHIPPED_BIN_PATH_PREFIX.length, -".ts".length)];
4882
4912
  }
4883
- return quotes;
4913
+ if (implementation.startsWith(AEG_CORE_BIN_PATH_PREFIX)) {
4914
+ const audience = GATE_AUDIENCE[basenameNoExt(implementation)];
4915
+ if (audience && isShipped(audience)) {
4916
+ return Array.isArray(audience.shippedAs) ? audience.shippedAs : [audience.shippedAs];
4917
+ }
4918
+ }
4919
+ return [];
4884
4920
  }
4885
- function evaluateCitedQuotes(citedQuotes, citedFileContents) {
4921
+ function checkG6(rows, registeredCheckNames) {
4886
4922
  const findings = [];
4887
- for (const quote of citedQuotes) {
4888
- const content = citedFileContents.get(quote.citedFile);
4889
- if (content === undefined) {
4890
- findings.push({
4891
- file: quote.file,
4892
- line: quote.line,
4893
- citedFile: quote.citedFile,
4894
- quotedText: quote.quotedText,
4895
- message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but that file could not be read`
4896
- });
4923
+ for (const row of rows) {
4924
+ if (row.audience !== "product")
4897
4925
  continue;
4898
- }
4899
- if (!content.includes(quote.quotedText)) {
4926
+ const candidates = claimedCheckNames(row.implementation);
4927
+ if (!candidates.some((name) => registeredCheckNames.has(name))) {
4900
4928
  findings.push({
4901
- file: quote.file,
4902
- line: quote.line,
4903
- citedFile: quote.citedFile,
4904
- quotedText: quote.quotedText,
4905
- message: `${quote.file}:${quote.line} quotes "${quote.quotedText}" as citing \`${quote.citedFile}\`, but \`${quote.citedFile}\` no longer contains that text verbatim`
4929
+ row: row.action,
4930
+ path: row.implementation,
4931
+ reason: `${row.ring} row "${row.action}" is marked \`product\` but its implementation "${row.implementation}" does not resolve to a coreCheckRegistry() entry`
4906
4932
  });
4907
4933
  }
4908
4934
  }
4909
- return findings;
4935
+ return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
4910
4936
  }
4911
4937
  // ../../packages/aeg-core/src/dead-branch-push-guard.ts
4912
4938
  function checkDeadBranchPush(input) {
@@ -5329,7 +5355,6 @@ var TaskPrPauseSchema = z.object({
5329
5355
  var TaskPrReviewRecordSchema = z.object({
5330
5356
  verdicts: z.array(TaskPrVerdictSchema),
5331
5357
  roundMarkers: z.array(z.number().int().nonnegative()),
5332
- summaryTable: z.string().nullable(),
5333
5358
  pause: TaskPrPauseSchema.nullable()
5334
5359
  });
5335
5360
  var TaskPrReadInputSchema = z.object({
@@ -5376,16 +5401,6 @@ var TaskCancelResultSchema = z.object({
5376
5401
  authenticatedFrom: z.string().min(1),
5377
5402
  fencedEffectKeys: z.array(z.string())
5378
5403
  });
5379
- var TASK_TOOL_NAMES = [
5380
- "task_start",
5381
- "task_status",
5382
- "task_escalation_read",
5383
- "task_pr_read",
5384
- "task_resume",
5385
- "task_cancel"
5386
- ];
5387
- var OPERATOR_STATUS_FOLLOW = "task_status_follow";
5388
- var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
5389
5404
  // ../../packages/aeg-core/src/first-push-dispatch-gate.ts
5390
5405
  function parseTaskBranch(branch) {
5391
5406
  const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
@@ -5616,15 +5631,69 @@ var NO_GATE_CUTOVERS = {
5616
5631
  briefRulesSincePr: null,
5617
5632
  agentBoxesRefusedSincePr: null
5618
5633
  };
5619
- // ../../packages/aeg-core/src/dev-review-loop/types.ts
5620
- var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5621
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
5622
- var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
5623
- // ../../packages/aeg-core/src/log/envelope.ts
5624
- import { createHash as createHash5 } from "node:crypto";
5625
-
5626
5634
  // ../../packages/aeg-core/src/log/schema.ts
5635
+ import { z as z3 } from "zod";
5636
+
5637
+ // ../../packages/aeg-core/src/log/custom.ts
5627
5638
  import { z as z2 } from "zod";
5639
+ var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
5640
+ var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
5641
+ var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
5642
+ var CUSTOM_EVENT_MAX_FIELDS = 20;
5643
+ var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
5644
+ var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
5645
+ var CUSTOM_TEXT_MAX_LENGTH = 500;
5646
+ var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
5647
+ var CUSTOM_WORD_MAX_LENGTH = 64;
5648
+ var CUSTOM_FIELD_MAX_WORDS = 50;
5649
+ var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
5650
+ var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
5651
+ fields: z2.record(z2.string(), CustomFieldTypeSchema)
5652
+ }).strict()).superRefine((events, ctx) => {
5653
+ for (const [name, declaration] of Object.entries(events)) {
5654
+ const refuse = (message, path = []) => {
5655
+ ctx.addIssue({
5656
+ code: z2.ZodIssueCode.custom,
5657
+ path: [name, ...path],
5658
+ message: `logs.events "${name}": ${message}`
5659
+ });
5660
+ };
5661
+ if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
5662
+ refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
5663
+ }
5664
+ if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
5665
+ refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
5666
+ } else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
5667
+ refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
5668
+ }
5669
+ const fieldEntries = Object.entries(declaration.fields);
5670
+ if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
5671
+ refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
5672
+ }
5673
+ for (const [field, type] of fieldEntries) {
5674
+ if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
5675
+ refuse(`field "${field}": a field name is lowercase letters, digits and \`_\`, starting with a letter, at most ${CUSTOM_FIELD_NAME_MAX_LENGTH} characters`, ["fields", field]);
5676
+ }
5677
+ if (typeof type === "string")
5678
+ continue;
5679
+ if (type.length === 0) {
5680
+ refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
5681
+ }
5682
+ if (type.length > CUSTOM_FIELD_MAX_WORDS) {
5683
+ refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
5684
+ }
5685
+ const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
5686
+ if (bad.length > 0) {
5687
+ refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
5688
+ }
5689
+ if (new Set(type).size !== type.length) {
5690
+ refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
5691
+ }
5692
+ }
5693
+ }
5694
+ });
5695
+
5696
+ // ../../packages/aeg-core/src/log/schema.ts
5628
5697
  var CONFIDENCE_REASON_MAX_LENGTH = 280;
5629
5698
  var ROLE_VALUES = [
5630
5699
  "planner",
@@ -5635,244 +5704,297 @@ var ROLE_VALUES = [
5635
5704
  "archivist",
5636
5705
  "architect"
5637
5706
  ];
5638
- var RoleSchema = z2.enum(ROLE_VALUES);
5707
+ var RoleSchema = z3.enum(ROLE_VALUES);
5639
5708
  var HOST_VALUES = ["hook", "ci", "cli", "loop"];
5640
- var HostSchema = z2.enum(HOST_VALUES);
5709
+ var HostSchema = z3.enum(HOST_VALUES);
5641
5710
  var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
5642
5711
  var headerMetaCore = {
5643
- ts: z2.string(),
5644
- run_id: z2.string().regex(RUN_ID_PATTERN),
5645
- seq: z2.number().int().nonnegative(),
5646
- repo: z2.string().nullable(),
5647
- vinaya: z2.string(),
5648
- doctrine: z2.string(),
5712
+ ts: z3.string(),
5713
+ run_id: z3.string().regex(RUN_ID_PATTERN),
5714
+ seq: z3.number().int().nonnegative(),
5715
+ repo: z3.string().nullable(),
5716
+ vinaya: z3.string(),
5717
+ doctrine: z3.string(),
5649
5718
  host: HostSchema,
5650
- machine: z2.string()
5719
+ machine: z3.string()
5651
5720
  };
5652
- var HeaderMetaV1Schema = z2.object({
5653
- schema: z2.literal(1),
5721
+ var HeaderMetaV1Schema = z3.object({
5722
+ schema: z3.literal(1),
5654
5723
  ...headerMetaCore
5655
5724
  }).strict();
5656
- var LineageSchema = z2.object({
5657
- run: z2.string().nullable(),
5658
- attempt: z2.number().int().nullable(),
5659
- parent: z2.string().nullable()
5725
+ var LineageSchema = z3.object({
5726
+ run: z3.string().nullable(),
5727
+ attempt: z3.number().int().nullable(),
5728
+ parent: z3.string().nullable()
5660
5729
  }).strict();
5661
- var InputVersionsSchema = z2.object({
5662
- objectives_version: z2.string().nullable(),
5663
- brief_hash: z2.string().nullable(),
5664
- ruling_ordinal: z2.number().int().nullable(),
5665
- policy_digest: z2.string().nullable()
5730
+ var InputVersionsSchema = z3.object({
5731
+ objectives_version: z3.string().nullable(),
5732
+ brief_hash: z3.string().nullable(),
5733
+ ruling_ordinal: z3.number().int().nullable(),
5734
+ policy_digest: z3.string().nullable()
5666
5735
  }).strict();
5667
- var ProvenanceSchema = z2.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
5668
- var HeaderMetaV2Schema = z2.object({
5669
- schema: z2.literal(2),
5736
+ var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
5737
+ var HeaderMetaV2Schema = z3.object({
5738
+ schema: z3.literal(2),
5670
5739
  ...headerMetaCore,
5671
- event_id: z2.string().min(1),
5672
- process_id: z2.string().min(1),
5673
- actor_id: z2.string().nullable(),
5740
+ event_id: z3.string().min(1),
5741
+ process_id: z3.string().min(1),
5742
+ actor_id: z3.string().nullable(),
5674
5743
  lineage: LineageSchema,
5675
5744
  input_versions: InputVersionsSchema,
5676
5745
  provenance: ProvenanceSchema
5677
5746
  }).strict();
5678
- var HeaderMetaSchema = z2.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema]);
5679
- var SubjectSchema = z2.object({
5680
- issue: z2.number().int().nullable(),
5681
- pr: z2.number().int().optional(),
5682
- sha: z2.string().optional(),
5683
- role: z2.union([RoleSchema, z2.literal("unattributed")]),
5684
- round: z2.number().int().optional(),
5685
- objectives_version: z2.string().optional()
5747
+ var WorkSchema = z3.object({
5748
+ ref: z3.string().nullable(),
5749
+ repo: z3.string().nullable(),
5750
+ change: z3.string().nullable(),
5751
+ revision: z3.string().nullable()
5686
5752
  }).strict();
5687
- var HeaderSchema = z2.object({
5753
+ var FlowSchema = z3.object({
5754
+ id: z3.string().nullable(),
5755
+ version: z3.string().nullable()
5756
+ }).strict();
5757
+ var HeaderMetaV3Schema = z3.object({
5758
+ schema: z3.literal(3),
5759
+ ...headerMetaCore,
5760
+ event_id: z3.string().min(1),
5761
+ process_id: z3.string().min(1),
5762
+ actor_id: z3.string().nullable(),
5763
+ lineage: LineageSchema,
5764
+ input_versions: InputVersionsSchema,
5765
+ provenance: ProvenanceSchema,
5766
+ work: WorkSchema,
5767
+ flow: FlowSchema,
5768
+ runtime: z3.string().nullable(),
5769
+ source: z3.string().nullable()
5770
+ }).strict();
5771
+ var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
5772
+ var SubjectSchema = z3.object({
5773
+ issue: z3.number().int().nullable(),
5774
+ pr: z3.number().int().optional(),
5775
+ sha: z3.string().optional(),
5776
+ role: z3.union([RoleSchema, z3.literal("unattributed")]),
5777
+ round: z3.number().int().optional(),
5778
+ objectives_version: z3.string().optional()
5779
+ }).strict();
5780
+ var HeaderSchema = z3.object({
5688
5781
  meta: HeaderMetaSchema,
5689
5782
  subject: SubjectSchema
5690
5783
  }).strict();
5691
5784
  var envelopeTail = {
5692
- duration_ms: z2.number().nonnegative().optional(),
5693
- payload: z2.object({}).strict()
5785
+ duration_ms: z3.number().nonnegative().optional(),
5786
+ payload: z3.object({}).strict()
5694
5787
  };
5695
- var ReviewFindingSchema = z2.object({
5696
- id: z2.string(),
5697
- severity: z2.string(),
5698
- state: z2.string().optional(),
5699
- severity_scale: z2.string().optional(),
5700
- policy_treatment: z2.enum(["blocking", "non_blocking", "unavailable"]).optional(),
5701
- confidence: z2.number().min(0).max(1).optional(),
5702
- confidence_scale: z2.string().optional(),
5703
- confidence_source: z2.string().optional()
5788
+ var ReviewFindingSchema = z3.object({
5789
+ id: z3.string(),
5790
+ severity: z3.string(),
5791
+ state: z3.string().optional(),
5792
+ severity_scale: z3.string().optional(),
5793
+ policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
5794
+ confidence: z3.number().min(0).max(1).optional(),
5795
+ confidence_scale: z3.string().optional(),
5796
+ confidence_source: z3.string().optional()
5704
5797
  }).strict();
5705
- var DispatchOutcomeSchema = z2.discriminatedUnion("type", [
5706
- z2.object({ type: z2.literal("pr_opened"), pr: z2.number().int(), head: z2.string() }).strict(),
5707
- z2.object({
5708
- type: z2.literal("round_pushed"),
5709
- pr: z2.number().int(),
5710
- head: z2.string(),
5711
- comment_id: z2.number().int()
5798
+ var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
5799
+ z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
5800
+ z3.object({
5801
+ type: z3.literal("round_pushed"),
5802
+ pr: z3.number().int(),
5803
+ head: z3.string(),
5804
+ comment_id: z3.number().int()
5712
5805
  }).strict(),
5713
- z2.object({
5714
- type: z2.literal("verdict"),
5715
- verdict: z2.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
5716
- head: z2.string(),
5717
- comment_id: z2.number().int(),
5718
- objectives: z2.array(z2.object({ id: z2.string(), met: z2.boolean() }).strict()),
5719
- findings: z2.array(ReviewFindingSchema)
5806
+ z3.object({
5807
+ type: z3.literal("verdict"),
5808
+ verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
5809
+ head: z3.string(),
5810
+ comment_id: z3.number().int(),
5811
+ objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
5812
+ findings: z3.array(ReviewFindingSchema)
5720
5813
  }).strict(),
5721
- z2.object({
5722
- type: z2.literal("escalation"),
5723
- class: z2.enum(["authority", "strategy", "product"]),
5724
- comment_id: z2.number().int()
5814
+ z3.object({
5815
+ type: z3.literal("escalation"),
5816
+ class: z3.enum(["authority", "strategy", "product"]),
5817
+ comment_id: z3.number().int()
5725
5818
  }).strict(),
5726
- z2.object({ type: z2.literal("brief"), comment_id: z2.number().int(), hash: z2.string() }).strict(),
5727
- z2.object({ type: z2.literal("plan"), issues: z2.array(z2.number().int()) }).strict(),
5728
- z2.object({ type: z2.literal("archive"), provenance_comment_id: z2.number().int() }).strict(),
5729
- z2.object({ type: z2.literal("completed") }).strict()
5819
+ z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
5820
+ z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
5821
+ z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
5822
+ z3.object({ type: z3.literal("completed") }).strict()
5730
5823
  ]);
5731
5824
  var dispatchShared = {
5732
5825
  meta: HeaderMetaSchema,
5733
5826
  subject: SubjectSchema,
5734
- kind: z2.literal("dispatch"),
5827
+ kind: z3.literal("dispatch"),
5735
5828
  ...envelopeTail,
5736
5829
  target_role: RoleSchema,
5737
- model: z2.string(),
5738
- round: z2.number().int().optional(),
5739
- effect_id: z2.string()
5830
+ model: z3.string(),
5831
+ round: z3.number().int().optional(),
5832
+ effect_id: z3.string()
5740
5833
  };
5741
- var dispatchUsageField = z2.object({ input: z2.number().nonnegative(), output: z2.number().nonnegative() }).strict().nullable();
5742
- var DispatchEventSchema = z2.discriminatedUnion("event", [
5743
- z2.object({ ...dispatchShared, event: z2.literal("dispatched"), prompt_hash: z2.string() }).strict(),
5744
- z2.object({
5834
+ var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
5835
+ var DispatchEventSchema = z3.discriminatedUnion("event", [
5836
+ z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
5837
+ z3.object({
5745
5838
  ...dispatchShared,
5746
- event: z2.literal("outcome_received"),
5839
+ event: z3.literal("outcome_received"),
5747
5840
  outcome: DispatchOutcomeSchema,
5748
5841
  usage: dispatchUsageField
5749
5842
  }).strict(),
5750
- z2.object({
5843
+ z3.object({
5751
5844
  ...dispatchShared,
5752
- event: z2.literal("dispatch_failed"),
5753
- reason: z2.enum(["timeout", "crash", "refused", "unattributed_write"]),
5845
+ event: z3.literal("dispatch_failed"),
5846
+ reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
5754
5847
  usage: dispatchUsageField
5755
5848
  }).strict()
5756
5849
  ]);
5850
+ var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
5851
+ var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
5852
+ var ReviewerVerdictSchema = z3.object({
5853
+ role: RoleSchema,
5854
+ outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
5855
+ blockers: z3.number().int().nonnegative()
5856
+ }).strict();
5757
5857
  var loopShared = {
5758
5858
  meta: HeaderMetaSchema,
5759
5859
  subject: SubjectSchema,
5760
- kind: z2.literal("dev_review_loop"),
5860
+ kind: z3.literal("dev_review_loop"),
5761
5861
  ...envelopeTail,
5762
- loop_id: z2.string()
5862
+ loop_id: z3.string()
5763
5863
  };
5764
- var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
5765
- z2.object({
5864
+ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
5865
+ z3.object({
5766
5866
  ...loopShared,
5767
- event: z2.literal("loop_started"),
5768
- task: z2.number().int(),
5769
- policy: z2.object({
5770
- max_rounds: z2.number().int().nonnegative(),
5771
- reviewers: z2.array(RoleSchema),
5772
- models: z2.record(RoleSchema, z2.string())
5867
+ event: z3.literal("loop_started"),
5868
+ task: z3.number().int(),
5869
+ policy: z3.object({
5870
+ max_rounds: z3.number().int().nonnegative(),
5871
+ reviewers: z3.array(RoleSchema),
5872
+ models: z3.record(RoleSchema, z3.string())
5773
5873
  }).strict()
5774
5874
  }).strict(),
5775
- z2.object({ ...loopShared, event: z2.literal("round_started"), round: z2.number().int(), base_head: z2.string() }).strict(),
5776
- z2.object({
5875
+ z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
5876
+ z3.object({
5777
5877
  ...loopShared,
5778
- event: z2.literal("gate_result_read"),
5779
- round: z2.number().int(),
5780
- head: z2.string(),
5781
- green: z2.boolean(),
5782
- confidence_value: z2.number().int().min(0).max(100).optional(),
5783
- confidence_reason: z2.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
5784
- confidence_unavailable: z2.boolean().optional(),
5785
- extra_turn_spent: z2.boolean().optional()
5878
+ event: z3.literal("gate_result_read"),
5879
+ round: z3.number().int(),
5880
+ head: z3.string(),
5881
+ green: z3.boolean(),
5882
+ confidence_value: z3.number().int().min(0).max(100).optional(),
5883
+ confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
5884
+ confidence_unavailable: z3.boolean().optional(),
5885
+ extra_turn_spent: z3.boolean().optional()
5786
5886
  }).strict(),
5787
- z2.object({
5887
+ z3.object({
5788
5888
  ...loopShared,
5789
- event: z2.literal("verdicts_read"),
5790
- round: z2.number().int(),
5791
- head: z2.string(),
5792
- all_approve: z2.boolean(),
5793
- blockers: z2.number().int().nonnegative(),
5794
- findings: z2.array(ReviewFindingSchema).optional()
5889
+ event: z3.literal("verdicts_read"),
5890
+ round: z3.number().int(),
5891
+ head: z3.string(),
5892
+ all_approve: z3.boolean(),
5893
+ blockers: z3.number().int().nonnegative(),
5894
+ findings: z3.array(ReviewFindingSchema).optional(),
5895
+ reviewers: z3.array(ReviewerVerdictSchema).optional()
5795
5896
  }).strict(),
5796
- z2.object({
5897
+ z3.object({
5797
5898
  ...loopShared,
5798
- event: z2.literal("findings_compared"),
5799
- round: z2.number().int(),
5800
- open: z2.array(z2.string()),
5801
- resolved: z2.array(z2.string()),
5802
- new: z2.array(z2.string()),
5803
- recurring: z2.array(z2.string())
5899
+ event: z3.literal("findings_compared"),
5900
+ round: z3.number().int(),
5901
+ open: z3.array(z3.string()),
5902
+ resolved: z3.array(z3.string()),
5903
+ new: z3.array(z3.string()),
5904
+ recurring: z3.array(z3.string())
5804
5905
  }).strict(),
5805
- z2.object({
5906
+ z3.object({
5806
5907
  ...loopShared,
5807
- event: z2.literal("stop_condition_met"),
5808
- round: z2.number().int(),
5809
- condition: z2.enum([
5908
+ event: z3.literal("stop_condition_met"),
5909
+ round: z3.number().int(),
5910
+ condition: z3.enum([
5810
5911
  "green",
5811
5912
  "max_rounds",
5812
5913
  "no_progress",
5813
5914
  "escalated",
5814
5915
  "principal_stop",
5815
5916
  "confidence",
5816
- "reappearance"
5917
+ "reappearance",
5918
+ "repeat_finding",
5919
+ "repeat_failure",
5920
+ "time_budget"
5817
5921
  ])
5818
5922
  }).strict(),
5819
- z2.object({
5923
+ z3.object({
5924
+ ...loopShared,
5925
+ event: z3.literal("paused"),
5926
+ round: z3.number().int(),
5927
+ reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
5928
+ reason_code: CodeTokenSchema.optional()
5929
+ }).strict(),
5930
+ z3.object({
5931
+ ...loopShared,
5932
+ event: z3.literal("resumed"),
5933
+ round: z3.number().int(),
5934
+ by: z3.enum(["principal", "driver"])
5935
+ }).strict(),
5936
+ z3.object({
5820
5937
  ...loopShared,
5821
- event: z2.literal("paused"),
5822
- round: z2.number().int(),
5823
- reason: z2.enum(["escalation", "principal_item", "refreeze_needed"])
5938
+ event: z3.literal("cancelled"),
5939
+ round: z3.number().int(),
5940
+ by: z3.literal("principal")
5824
5941
  }).strict(),
5825
- z2.object({
5942
+ z3.object({
5826
5943
  ...loopShared,
5827
- event: z2.literal("resumed"),
5828
- round: z2.number().int(),
5829
- by: z2.enum(["principal", "driver"])
5944
+ event: z3.literal("unpushed_work_resume"),
5945
+ round: z3.number().int(),
5946
+ branch: z3.string(),
5947
+ detail: z3.string()
5830
5948
  }).strict(),
5831
- z2.object({
5949
+ z3.object({
5832
5950
  ...loopShared,
5833
- event: z2.literal("cancelled"),
5834
- round: z2.number().int(),
5835
- by: z2.literal("principal")
5951
+ event: z3.literal("round_ended"),
5952
+ round: z3.number().int(),
5953
+ base_head: z3.string(),
5954
+ head: z3.string(),
5955
+ files_changed: z3.number().int().nonnegative(),
5956
+ insertions: z3.number().int().nonnegative(),
5957
+ deletions: z3.number().int().nonnegative(),
5958
+ wall_ms: z3.number().nonnegative(),
5959
+ outcome: z3.enum(["green", "changes_requested", "escalated"])
5836
5960
  }).strict(),
5837
- z2.object({
5961
+ z3.object({
5838
5962
  ...loopShared,
5839
- event: z2.literal("unpushed_work_resume"),
5840
- round: z2.number().int(),
5841
- branch: z2.string(),
5842
- detail: z2.string()
5963
+ event: z3.literal("journal_finalized"),
5964
+ rounds: z3.number().int().nonnegative(),
5965
+ total_wall_ms: z3.number().nonnegative(),
5966
+ time_to_green_ms: z3.number().nonnegative().nullable(),
5967
+ files_changed_total: z3.number().int().nonnegative(),
5968
+ final_head: z3.string(),
5969
+ result: z3.enum(["merged_ready", "stopped"])
5843
5970
  }).strict(),
5844
- z2.object({
5971
+ z3.object({
5845
5972
  ...loopShared,
5846
- event: z2.literal("round_ended"),
5847
- round: z2.number().int(),
5848
- base_head: z2.string(),
5849
- head: z2.string(),
5850
- files_changed: z2.number().int().nonnegative(),
5851
- insertions: z2.number().int().nonnegative(),
5852
- deletions: z2.number().int().nonnegative(),
5853
- wall_ms: z2.number().nonnegative(),
5854
- outcome: z2.enum(["green", "changes_requested", "escalated"])
5973
+ event: z3.literal("infrastructure_retry"),
5974
+ round: z3.number().int(),
5975
+ failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
5976
+ attempts: z3.number().int().positive(),
5977
+ outcome: z3.enum(["recovered", "exhausted"])
5855
5978
  }).strict(),
5856
- z2.object({
5979
+ z3.object({
5857
5980
  ...loopShared,
5858
- event: z2.literal("journal_finalized"),
5859
- rounds: z2.number().int().nonnegative(),
5860
- total_wall_ms: z2.number().nonnegative(),
5861
- time_to_green_ms: z2.number().nonnegative().nullable(),
5862
- files_changed_total: z2.number().int().nonnegative(),
5863
- final_head: z2.string(),
5864
- result: z2.enum(["merged_ready", "stopped"])
5981
+ event: z3.literal("driver_heartbeat"),
5982
+ task: z3.number().int(),
5983
+ pr: z3.number().int().positive().optional(),
5984
+ round: z3.number().int(),
5985
+ phase: z3.string()
5865
5986
  }).strict(),
5866
- z2.object({
5987
+ z3.object({
5867
5988
  ...loopShared,
5868
- event: z2.literal("infrastructure_retry"),
5869
- round: z2.number().int(),
5870
- failure_kind: z2.enum(["pause_comment_post", "developer_connection"]),
5871
- attempts: z2.number().int().positive(),
5872
- outcome: z2.enum(["recovered", "exhausted"])
5989
+ event: z3.literal("driver_exited"),
5990
+ task: z3.number().int(),
5991
+ reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
5992
+ last_decision: z3.string(),
5993
+ exit_code: z3.number().int().optional(),
5994
+ error_class: CodeTokenSchema.optional()
5873
5995
  }).strict()
5874
5996
  ]);
5875
- var ForgeOpSchema = z2.enum([
5997
+ var ForgeOpSchema = z3.enum([
5876
5998
  "pr.create",
5877
5999
  "pr.comment",
5878
6000
  "pr.body.replace",
@@ -5886,24 +6008,24 @@ var ForgeOpSchema = z2.enum([
5886
6008
  "label.add",
5887
6009
  "label.remove"
5888
6010
  ]);
5889
- var ForgeWriteTargetSchema = z2.object({
5890
- issue: z2.number().int().optional(),
5891
- pr: z2.number().int().optional()
6011
+ var ForgeWriteTargetSchema = z3.object({
6012
+ issue: z3.number().int().optional(),
6013
+ pr: z3.number().int().optional()
5892
6014
  }).strict();
5893
6015
  var forgeWriteShared = {
5894
6016
  meta: HeaderMetaSchema,
5895
6017
  subject: SubjectSchema,
5896
- kind: z2.literal("forge_write"),
6018
+ kind: z3.literal("forge_write"),
5897
6019
  ...envelopeTail,
5898
6020
  op: ForgeOpSchema,
5899
6021
  target: ForgeWriteTargetSchema
5900
6022
  };
5901
- var ForgeWriteEventSchema = z2.discriminatedUnion("event", [
5902
- z2.object({ ...forgeWriteShared, event: z2.literal("validated") }).strict(),
5903
- z2.object({ ...forgeWriteShared, event: z2.literal("refused"), reason: z2.string() }).strict(),
5904
- z2.object({ ...forgeWriteShared, event: z2.literal("written"), comment_ids: z2.array(z2.string()) }).strict()
6023
+ var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
6024
+ z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
6025
+ z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
6026
+ z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
5905
6027
  ]);
5906
- var GateOutcomeSchema = z2.enum([
6028
+ var GateOutcomeSchema = z3.enum([
5907
6029
  "pass",
5908
6030
  "fail",
5909
6031
  "wait",
@@ -5916,61 +6038,74 @@ var GateOutcomeSchema = z2.enum([
5916
6038
  var gateShared = {
5917
6039
  meta: HeaderMetaSchema,
5918
6040
  subject: SubjectSchema,
5919
- kind: z2.literal("gate"),
6041
+ kind: z3.literal("gate"),
5920
6042
  ...envelopeTail,
5921
- check: z2.string(),
5922
- check_version: z2.string().nullable(),
5923
- policy_version: z2.string().nullable(),
5924
- input_fingerprint: z2.string().nullable()
6043
+ check: z3.string(),
6044
+ check_version: z3.string().nullable(),
6045
+ policy_version: z3.string().nullable(),
6046
+ input_fingerprint: z3.string().nullable()
5925
6047
  };
5926
- var GateEventSchema = z2.discriminatedUnion("event", [
5927
- z2.object({
6048
+ var GateEventSchema = z3.discriminatedUnion("event", [
6049
+ z3.object({
5928
6050
  ...gateShared,
5929
- event: z2.literal("checked"),
6051
+ event: z3.literal("checked"),
5930
6052
  outcome: GateOutcomeSchema,
5931
- reason: z2.string().optional()
6053
+ reason: z3.string().optional()
6054
+ }).strict(),
6055
+ z3.object({
6056
+ meta: HeaderMetaSchema,
6057
+ subject: SubjectSchema,
6058
+ kind: z3.literal("gate"),
6059
+ ...envelopeTail,
6060
+ event: z3.literal("summary"),
6061
+ ran: z3.number().int().nonnegative(),
6062
+ passed: z3.number().int().nonnegative(),
6063
+ failed: z3.number().int().nonnegative(),
6064
+ skipped: z3.number().int().nonnegative(),
6065
+ failed_checks: z3.array(z3.string())
5932
6066
  }).strict()
5933
6067
  ]);
5934
- var OperationResultSchema = z2.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
6068
+ var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
5935
6069
  var operationShared = {
5936
6070
  meta: HeaderMetaSchema,
5937
6071
  subject: SubjectSchema,
5938
- kind: z2.literal("operation"),
6072
+ kind: z3.literal("operation"),
5939
6073
  ...envelopeTail,
5940
- operation: z2.string(),
5941
- target: z2.string().nullable()
6074
+ operation: z3.string(),
6075
+ target: z3.string().nullable()
5942
6076
  };
5943
- var OperationEventSchema = z2.discriminatedUnion("event", [
5944
- z2.object({
6077
+ var OperationEventSchema = z3.discriminatedUnion("event", [
6078
+ z3.object({
5945
6079
  ...operationShared,
5946
- event: z2.literal("completed"),
6080
+ event: z3.literal("completed"),
5947
6081
  result: OperationResultSchema,
5948
- error_class: z2.string().nullable()
6082
+ error_class: z3.string().nullable(),
6083
+ field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
5949
6084
  }).strict()
5950
6085
  ]);
5951
- var UsageUnitsSchema = z2.object({
5952
- input: z2.number().nonnegative().nullable(),
5953
- output: z2.number().nonnegative().nullable(),
5954
- cache: z2.number().nonnegative().nullable()
6086
+ var UsageUnitsSchema = z3.object({
6087
+ input: z3.number().nonnegative().nullable(),
6088
+ output: z3.number().nonnegative().nullable(),
6089
+ cache: z3.number().nonnegative().nullable()
5955
6090
  }).strict();
5956
6091
  var usageShared = {
5957
6092
  meta: HeaderMetaSchema,
5958
6093
  subject: SubjectSchema,
5959
- kind: z2.literal("usage"),
6094
+ kind: z3.literal("usage"),
5960
6095
  ...envelopeTail,
5961
- model: z2.string().nullable(),
5962
- source: z2.string(),
5963
- semantics: z2.enum(["cumulative", "delta"])
6096
+ model: z3.string().nullable(),
6097
+ source: z3.string(),
6098
+ semantics: z3.enum(["cumulative", "delta"])
5964
6099
  };
5965
- var UsageEventSchema = z2.discriminatedUnion("event", [
5966
- z2.object({
6100
+ var UsageEventSchema = z3.discriminatedUnion("event", [
6101
+ z3.object({
5967
6102
  ...usageShared,
5968
- event: z2.literal("observed"),
6103
+ event: z3.literal("observed"),
5969
6104
  units: UsageUnitsSchema,
5970
- unknown_reason: z2.string().nullable()
6105
+ unknown_reason: z3.string().nullable()
5971
6106
  }).strict()
5972
6107
  ]);
5973
- var RoleAttemptOutcomeSchema = z2.enum([
6108
+ var RoleAttemptOutcomeSchema = z3.enum([
5974
6109
  "completed",
5975
6110
  "incomplete",
5976
6111
  "infrastructure_failed",
@@ -5981,17 +6116,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
5981
6116
  var roleAttemptShared = {
5982
6117
  meta: HeaderMetaSchema,
5983
6118
  subject: SubjectSchema,
5984
- kind: z2.literal("role_attempt"),
6119
+ kind: z3.literal("role_attempt"),
5985
6120
  ...envelopeTail,
5986
- actor: z2.string().nullable(),
5987
- attempt: z2.number().int().nullable(),
5988
- effect_id: z2.string(),
5989
- model: z2.string().nullable()
6121
+ actor: z3.string().nullable(),
6122
+ attempt: z3.number().int().nullable(),
6123
+ effect_id: z3.string(),
6124
+ model: z3.string().nullable()
5990
6125
  };
5991
- var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
5992
- z2.object({
6126
+ var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
6127
+ z3.object({
5993
6128
  ...roleAttemptShared,
5994
- event: z2.literal("attempted"),
6129
+ event: z3.literal("attempted"),
5995
6130
  outcome: RoleAttemptOutcomeSchema,
5996
6131
  usage: dispatchUsageField
5997
6132
  }).strict()
@@ -5999,42 +6134,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
5999
6134
  var handoffShared = {
6000
6135
  meta: HeaderMetaSchema,
6001
6136
  subject: SubjectSchema,
6002
- kind: z2.literal("handoff"),
6137
+ kind: z3.literal("handoff"),
6003
6138
  ...envelopeTail,
6004
- class: z2.enum(["authority", "strategy", "product"]),
6005
- reason: z2.string()
6139
+ class: z3.enum(["authority", "strategy", "product"]),
6140
+ reason: z3.string()
6006
6141
  };
6007
- var HandoffEventSchema = z2.discriminatedUnion("event", [
6008
- z2.object({
6142
+ var HandoffEventSchema = z3.discriminatedUnion("event", [
6143
+ z3.object({
6009
6144
  ...handoffShared,
6010
- event: z2.literal("raised"),
6011
- requested_decision: z2.string().nullable()
6145
+ event: z3.literal("raised"),
6146
+ requested_decision: z3.string().nullable()
6012
6147
  }).strict(),
6013
- z2.object({
6148
+ z3.object({
6014
6149
  ...handoffShared,
6015
- event: z2.literal("resolved"),
6016
- resolution: z2.string().nullable(),
6017
- resolved_by: z2.string().nullable()
6150
+ event: z3.literal("resolved"),
6151
+ resolution: z3.string().nullable(),
6152
+ resolved_by: z3.string().nullable()
6018
6153
  }).strict()
6019
6154
  ]);
6020
- var EffectTargetSchema = z2.object({
6021
- kind: z2.string(),
6022
- ref: z2.string()
6155
+ var EffectTargetSchema = z3.object({
6156
+ kind: z3.string(),
6157
+ ref: z3.string()
6023
6158
  }).strict();
6024
6159
  var effectShared = {
6025
6160
  meta: HeaderMetaSchema,
6026
6161
  subject: SubjectSchema,
6027
- kind: z2.literal("effect"),
6162
+ kind: z3.literal("effect"),
6028
6163
  ...envelopeTail,
6029
- effect_id: z2.string(),
6164
+ effect_id: z3.string(),
6030
6165
  target: EffectTargetSchema
6031
6166
  };
6032
- var EffectEventSchema = z2.discriminatedUnion("event", [
6033
- z2.object({ ...effectShared, event: z2.literal("attempted") }).strict(),
6034
- z2.object({ ...effectShared, event: z2.literal("observed"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict(),
6035
- z2.object({ ...effectShared, event: z2.literal("verified"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict()
6167
+ var EffectEventSchema = z3.discriminatedUnion("event", [
6168
+ z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
6169
+ z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
6170
+ z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
6171
+ ]);
6172
+ var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
6173
+ var customShared = {
6174
+ meta: HeaderMetaV3Schema,
6175
+ subject: SubjectSchema,
6176
+ kind: z3.literal("custom"),
6177
+ ...envelopeTail
6178
+ };
6179
+ var CustomEventSchema = z3.discriminatedUnion("event", [
6180
+ z3.object({
6181
+ ...customShared,
6182
+ event: z3.literal("recorded"),
6183
+ name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
6184
+ fields: z3.record(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH).regex(CUSTOM_FIELD_NAME_PATTERN), CustomFieldValueSchema).refine((f) => Object.keys(f).length <= CUSTOM_EVENT_MAX_FIELDS, {
6185
+ message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
6186
+ })
6187
+ }).strict()
6036
6188
  ]);
6037
- var LogEventSchema = z2.union([
6189
+ var LogEventSchema = z3.union([
6038
6190
  DispatchEventSchema,
6039
6191
  DevReviewLoopEventSchema,
6040
6192
  ForgeWriteEventSchema,
@@ -6043,10 +6195,11 @@ var LogEventSchema = z2.union([
6043
6195
  UsageEventSchema,
6044
6196
  RoleAttemptEventSchema,
6045
6197
  HandoffEventSchema,
6046
- EffectEventSchema
6198
+ EffectEventSchema,
6199
+ CustomEventSchema
6047
6200
  ]);
6048
-
6049
6201
  // ../../packages/aeg-core/src/log/envelope.ts
6202
+ import { createHash as createHash5 } from "node:crypto";
6050
6203
  function isRole(value) {
6051
6204
  return value !== undefined && ROLE_VALUES.includes(value);
6052
6205
  }
@@ -6083,18 +6236,27 @@ function roundFromEnv(round) {
6083
6236
  const n = Number(round);
6084
6237
  return Number.isInteger(n) ? n : undefined;
6085
6238
  }
6239
+ function prFromEnv(pr) {
6240
+ if (pr === undefined || pr === "")
6241
+ return;
6242
+ const n = Number(pr);
6243
+ return Number.isInteger(n) && n > 0 ? n : undefined;
6244
+ }
6086
6245
  function buildHeader(input) {
6087
6246
  const role = isRole(input.env.role) ? input.env.role : "unattributed";
6088
6247
  const round = roundFromEnv(input.env.round);
6248
+ const pr = prFromEnv(input.env.pr);
6089
6249
  const subject = {
6090
6250
  issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
6091
6251
  role,
6092
6252
  ...round !== undefined ? { round } : {},
6253
+ ...pr !== undefined ? { pr } : {},
6093
6254
  ...input.subject ?? {}
6094
6255
  };
6256
+ const issue = subject.issue;
6095
6257
  return {
6096
6258
  meta: {
6097
- schema: 2,
6259
+ schema: 3,
6098
6260
  ts: input.now.toISOString(),
6099
6261
  run_id: input.runId,
6100
6262
  seq: input.seq,
@@ -6117,7 +6279,19 @@ function buildHeader(input) {
6117
6279
  ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
6118
6280
  policy_digest: input.inputVersions?.policyDigest ?? null
6119
6281
  },
6120
- provenance: provenanceFor(input)
6282
+ provenance: provenanceFor(input),
6283
+ work: {
6284
+ ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
6285
+ repo: input.repo,
6286
+ change: null,
6287
+ revision: null
6288
+ },
6289
+ flow: {
6290
+ id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
6291
+ version: lineageFieldFromEnv(input.env.flowVersion)
6292
+ },
6293
+ runtime: lineageFieldFromEnv(input.env.runtime),
6294
+ source: lineageFieldFromEnv(input.env.source)
6121
6295
  },
6122
6296
  subject
6123
6297
  };
@@ -6160,7 +6334,7 @@ function redact(value, home) {
6160
6334
  return value;
6161
6335
  }
6162
6336
  // ../../packages/aeg-core/src/log/store.ts
6163
- var KNOWN_SCHEMA_VERSIONS = [1, 2];
6337
+ var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
6164
6338
  function metaOf(obj) {
6165
6339
  if (obj === null || typeof obj !== "object")
6166
6340
  return null;
@@ -6226,7 +6400,7 @@ function classifyStoredLine(raw, home) {
6226
6400
  return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
6227
6401
  }
6228
6402
  const redacted = redact(event, home);
6229
- const provenance = version === 2 ? event.meta.provenance ?? null : null;
6403
+ const provenance = version >= 2 ? event.meta.provenance ?? null : null;
6230
6404
  return {
6231
6405
  status: "ok",
6232
6406
  identity,
@@ -6239,134 +6413,143 @@ function classifyStoredLine(raw, home) {
6239
6413
  };
6240
6414
  }
6241
6415
  // ../../packages/aeg-core/src/control-store/records.ts
6242
- import { z as z3 } from "zod";
6243
- var isoTimestamp = z3.string().min(1);
6244
- var taskId = z3.number().int().positive();
6245
- var epochNumber = z3.number().int().nonnegative();
6246
- var RunRecordSchema = z3.object({
6247
- version: z3.literal(1),
6248
- kind: z3.literal("run"),
6416
+ import { z as z4 } from "zod";
6417
+ var isoTimestamp = z4.string().min(1);
6418
+ var taskId = z4.number().int().positive();
6419
+ var epochNumber = z4.number().int().nonnegative();
6420
+ var RunRecordSchema = z4.object({
6421
+ version: z4.literal(1),
6422
+ kind: z4.literal("run"),
6249
6423
  task: taskId,
6250
- runId: z3.string().min(1),
6251
- pid: z3.number().int().positive(),
6252
- host: z3.string().min(1),
6424
+ runId: z4.string().min(1),
6425
+ pid: z4.number().int().positive(),
6426
+ host: z4.string().min(1),
6253
6427
  startedAt: isoTimestamp,
6254
- childStartedAt: z3.string().min(1).nullable().optional(),
6255
- childCommand: z3.string().min(1).nullable().optional()
6428
+ childStartedAt: z4.string().min(1).nullable().optional(),
6429
+ childCommand: z4.string().min(1).nullable().optional()
6256
6430
  }).strict();
6257
- var InputRecordSchema = z3.object({
6258
- version: z3.literal(1),
6259
- kind: z3.literal("input"),
6431
+ var InputRecordSchema = z4.object({
6432
+ version: z4.literal(1),
6433
+ kind: z4.literal("input"),
6260
6434
  task: taskId,
6261
- runId: z3.string().min(1),
6262
- source: z3.union([z3.literal("fresh"), z3.literal("resume")]),
6263
- pr: z3.number().int().positive().nullable(),
6264
- round: z3.number().int().nonnegative(),
6435
+ runId: z4.string().min(1),
6436
+ source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
6437
+ pr: z4.number().int().positive().nullable(),
6438
+ round: z4.number().int().nonnegative(),
6265
6439
  recordedAt: isoTimestamp
6266
6440
  }).strict();
6267
- var OwnershipRecordSchema = z3.object({
6268
- version: z3.literal(1),
6269
- kind: z3.literal("ownership"),
6441
+ var OwnershipRecordSchema = z4.object({
6442
+ version: z4.literal(1),
6443
+ kind: z4.literal("ownership"),
6270
6444
  task: taskId,
6271
6445
  epoch: epochNumber,
6272
- ownerId: z3.string().min(1),
6273
- pid: z3.number().int().positive(),
6274
- host: z3.string().min(1),
6446
+ ownerId: z4.string().min(1),
6447
+ pid: z4.number().int().positive(),
6448
+ host: z4.string().min(1),
6275
6449
  acquiredAt: isoTimestamp
6276
6450
  }).strict();
6277
- var TransitionRecordSchema = z3.object({
6278
- version: z3.literal(1),
6279
- kind: z3.literal("transition"),
6451
+ var TransitionRecordSchema = z4.object({
6452
+ version: z4.literal(1),
6453
+ kind: z4.literal("transition"),
6280
6454
  task: taskId,
6281
6455
  epoch: epochNumber,
6282
- seq: z3.number().int().nonnegative(),
6283
- from: z3.string().min(1),
6284
- to: z3.string().min(1),
6285
- detail: z3.string().optional(),
6456
+ seq: z4.number().int().nonnegative(),
6457
+ from: z4.string().min(1),
6458
+ to: z4.string().min(1),
6459
+ detail: z4.string().optional(),
6286
6460
  at: isoTimestamp
6287
6461
  }).strict();
6288
- var ManifestRecordSchema = z3.object({
6289
- version: z3.literal(1),
6290
- kind: z3.literal("manifest"),
6462
+ var ManifestRecordSchema = z4.object({
6463
+ version: z4.literal(1),
6464
+ kind: z4.literal("manifest"),
6291
6465
  task: taskId,
6292
6466
  round: epochNumber,
6293
- repository: z3.string().min(1),
6294
- pr: z3.number().int().positive(),
6295
- branch: z3.string().min(1),
6296
- baseSha: z3.string().min(1).nullable(),
6297
- headSha: z3.string().min(1),
6298
- briefHash: z3.string().min(1).nullable(),
6299
- objectivesVersion: z3.string().min(1).nullable(),
6467
+ repository: z4.string().min(1),
6468
+ pr: z4.number().int().positive(),
6469
+ branch: z4.string().min(1),
6470
+ baseSha: z4.string().min(1).nullable(),
6471
+ headSha: z4.string().min(1),
6472
+ briefHash: z4.string().min(1).nullable(),
6473
+ objectivesVersion: z4.string().min(1).nullable(),
6300
6474
  rulingOrdinal: epochNumber,
6301
- policyDigest: z3.string().min(1),
6475
+ policyDigest: z4.string().min(1),
6302
6476
  recordedAt: isoTimestamp
6303
6477
  }).strict();
6304
- var roundHeadIdentity = z3.object({ round: z3.number().int().positive(), head: z3.string().min(1) }).strict();
6305
- var LoopBudgetsSchema = z3.object({
6306
- mechanicalRetries: z3.number().int().nonnegative(),
6307
- reviewRounds: z3.number().int().nonnegative(),
6308
- infrastructureRetries: z3.number().int().nonnegative()
6478
+ var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
6479
+ var LoopBudgetsSchema = z4.object({
6480
+ mechanicalRetries: z4.number().int().nonnegative(),
6481
+ reviewRounds: z4.number().int().nonnegative(),
6482
+ infrastructureRetries: z4.number().int().nonnegative()
6309
6483
  }).strict();
6310
- var LoopStateRecordSchema = z3.object({
6311
- version: z3.literal(1),
6312
- kind: z3.literal("loop_state"),
6484
+ var LoopStateRecordSchema = z4.object({
6485
+ version: z4.literal(1),
6486
+ kind: z4.literal("loop_state"),
6313
6487
  task: taskId,
6314
- round: z3.number().int().positive(),
6315
- phase: z3.string().min(1),
6316
- pauseReason: z3.string().min(1).nullable(),
6488
+ round: z4.number().int().positive(),
6489
+ phase: z4.string().min(1),
6490
+ pauseReason: z4.string().min(1).nullable(),
6317
6491
  budgets: LoopBudgetsSchema,
6318
6492
  heldResult: roundHeadIdentity.nullable(),
6319
6493
  deliveredFindings: roundHeadIdentity.nullable(),
6494
+ repeatMemory: z4.object({
6495
+ blockingFindings: z4.array(z4.string()),
6496
+ lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
6497
+ }).strict().optional(),
6498
+ publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
6499
+ taskStartedAt: isoTimestamp.optional(),
6500
+ phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
6320
6501
  recordedAt: isoTimestamp
6321
6502
  }).strict();
6322
- var EffectRecordSchema = z3.object({
6323
- version: z3.literal(1),
6324
- kind: z3.literal("effect"),
6503
+ var EffectRecordSchema = z4.object({
6504
+ version: z4.literal(1),
6505
+ kind: z4.literal("effect"),
6325
6506
  task: taskId,
6326
- key: z3.string().min(1),
6327
- operation: z3.string().min(1),
6328
- target: z3.string().min(1),
6329
- inputVersion: z3.number().int().nonnegative(),
6330
- payloadDigest: z3.string().min(1),
6331
- status: z3.union([z3.literal("started"), z3.literal("verified"), z3.literal("uncertain")]),
6332
- url: z3.string().optional(),
6507
+ key: z4.string().min(1),
6508
+ operation: z4.string().min(1),
6509
+ target: z4.string().min(1),
6510
+ inputVersion: z4.number().int().nonnegative(),
6511
+ payloadDigest: z4.string().min(1),
6512
+ status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
6513
+ url: z4.string().optional(),
6333
6514
  recordedAt: isoTimestamp
6334
6515
  }).strict();
6335
- var EscalationRecordSchema = z3.object({
6336
- version: z3.literal(1),
6337
- kind: z3.literal("escalation"),
6516
+ var EscalationRecordSchema = z4.object({
6517
+ version: z4.literal(1),
6518
+ kind: z4.literal("escalation"),
6338
6519
  task: taskId,
6339
- escalationId: z3.string().min(1),
6520
+ escalationId: z4.string().min(1),
6340
6521
  round: epochNumber,
6341
- head: z3.string().min(1),
6342
- branch: z3.string().min(1),
6343
- pr: z3.number().int().positive().nullable(),
6344
- runId: z3.string().min(1),
6345
- pid: z3.number().int().positive(),
6346
- host: z3.string().min(1),
6347
- agent: z3.string().min(1).optional(),
6348
- reason: z3.string().min(1),
6349
- detail: z3.string().optional(),
6350
- evidence: z3.string().optional(),
6351
- attemptedRecovery: z3.string().min(1),
6352
- requestedDecision: z3.string().min(1),
6353
- recipient: z3.string().min(1),
6354
- briefHash: z3.string().min(1).nullable(),
6355
- objectivesVersion: z3.string().min(1).nullable(),
6522
+ head: z4.string().min(1),
6523
+ branch: z4.string().min(1),
6524
+ pr: z4.number().int().positive().nullable(),
6525
+ runId: z4.string().min(1),
6526
+ pid: z4.number().int().positive(),
6527
+ host: z4.string().min(1),
6528
+ agent: z4.string().min(1).optional(),
6529
+ reason: z4.string().min(1),
6530
+ detail: z4.string().optional(),
6531
+ evidence: z4.string().optional(),
6532
+ attemptedRecovery: z4.string().min(1),
6533
+ requestedDecision: z4.string().min(1),
6534
+ recipient: z4.string().min(1),
6535
+ briefHash: z4.string().min(1).nullable(),
6536
+ objectivesVersion: z4.string().min(1).nullable(),
6356
6537
  rulingOrdinal: epochNumber,
6357
- policyDigest: z3.string().min(1),
6538
+ policyDigest: z4.string().min(1),
6358
6539
  recordedAt: isoTimestamp
6359
6540
  }).strict();
6360
- var ResolutionRecordSchema = z3.object({
6361
- version: z3.literal(1),
6362
- kind: z3.literal("resolution"),
6541
+ var ResolutionRecordSchema = z4.object({
6542
+ version: z4.literal(1),
6543
+ kind: z4.literal("resolution"),
6363
6544
  task: taskId,
6364
- escalationId: z3.string().min(1),
6365
- decision: z3.union([z3.literal("resume"), z3.literal("cancel")]),
6366
- authenticatedBy: z3.string().min(1),
6367
- authenticatedFrom: z3.string().min(1),
6545
+ escalationId: z4.string().min(1),
6546
+ decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
6547
+ authenticatedBy: z4.string().min(1),
6548
+ authenticatedFrom: z4.string().min(1),
6368
6549
  consumedAt: isoTimestamp
6369
6550
  }).strict();
6551
+ // ../../packages/aeg-core/src/control-store/local.ts
6552
+ var CONTROL_AREA_DIRNAME = "control";
6370
6553
  // ../../packages/sources/src/commands.ts
6371
6554
  var COMMANDS = [
6372
6555
  {
@@ -6521,7 +6704,7 @@ var COMMANDS = [
6521
6704
  "Composes `task brief`'s own preparation (`prepareTask`) with the watching driver (`runDriverLoop`, `dev-review-loop.ts`) — nothing else. Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
6522
6705
  "A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
6523
6706
  "Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
6524
- "issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the exact `vinaya task run <tranche> <n>` command to continue by hand), a usage/argv error (exit `2`), and any other failure (exit `3`)."
6707
+ "issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the working `vinaya task run` command for this task's own branch to continue by hand — `<tranche> <n>` for a tranche task, `--issue <n>` for a backlog one — never a `dev-review-loop --resume` line naming a pull-request number this pause does not have), a usage/argv error (exit `2`), and any other failure (exit `3`)."
6525
6708
  ],
6526
6709
  status: "shipped"
6527
6710
  },
@@ -6606,13 +6789,14 @@ var COMMANDS = [
6606
6789
  },
6607
6790
  {
6608
6791
  flag: "--push",
6609
- description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE/AEG:TOKENS regions changed. Mutually exclusive with --write."
6792
+ description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE region changed. Mutually exclusive with --write."
6610
6793
  }
6611
6794
  ],
6612
6795
  details: [
6613
6796
  "Two groups: Group A (recomputable) is the head sha and a width-invariant `git diff --numstat` against the merge-base with `BASE_SHA` (else `origin/main`, then `main`) — `check-evidence-fresh` recomputes and byte-compares this exactly. Group B (attested) is the result of `vinaya check --all --diff-only`, this CLI's own portable gate suite — `check-evidence-fresh` can only check it for staleness (the block's recorded head still matches the PR's real head), never re-run it.",
6614
6797
  "With no `--write`/`--push`, prints the block to stdout instead of writing a file. Exits non-zero whenever the gate run failed, whether or not `--write`/`--push` was given — the block records a failing result rather than hiding one, and a non-zero exit stops a scripted `--write && open-pr` (or `--push`) from carrying a failing suite onto the forge.",
6615
- "`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number. When the live body has no real `AEG:TOKENS` pair, the token splice is skipped (same reasoning, softer outcome) rather than creating one. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside the two anchored regions changed."
6798
+ "`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside that one anchored region changed.",
6799
+ "A pull-request body carries no token table, and this command writes none: a dispatched turn's token use is recorded as the Vinaya log's own `usage` event instead. A body that still carries an older run's table keeps it byte for byte — it is prose this command does not own, and a change inside it reads as real drift."
6616
6800
  ],
6617
6801
  status: "shipped"
6618
6802
  },
@@ -6637,7 +6821,7 @@ var COMMANDS = [
6637
6821
  "Deliberately a command, not a check: `evidence-fresh` runs inside `vinaya check --all`, and `pr report` runs `vinaya check --all --diff-only`, so a check that regenerated the block would run the suite containing itself. That recursion is why `evidence-fresh` verifies Group A only and leaves Group B attested.",
6638
6822
  "Must be run from the repository ROOT of a CLEAN checkout at the pull request's head, and refuses otherwise. The regeneration inherits the working directory and several gates resolve their scan root from it, so a subdirectory silently narrows what the fresh run inspects. On cleanliness: Group B is regenerated by diff-scoped checks, so uncommitted or untracked files change which files are scanned and can produce a MATCH a clean checkout would not. Ignored paths are deliberately NOT inspected — `git diff` never reports one, so they cannot change the scope, and including them would refuse in every real checkout since `node_modules` is ignored and always present. The head is read from the forge and both a mismatch AND an unreadable head refuse — the verdict is bound to a commit, never merely attested. `BASE_SHA` is refused as well, since it steers the regeneration's merge-base.",
6639
6823
  "Exits 0 on MATCH; 1 on DIFFERS, HIDDEN, or no block; 2 on a refusal (dirty worktree, wrong head, usage error). HIDDEN means the anchor pair sits inside a collapsed `<details>` block, where `body-bare-digits` blanks every digit and nothing can verify what it claims.",
6640
- "Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read, since AEG:TOKENS appends by design. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
6824
+ "Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read: every other section of the body is prose no regeneration reproduces. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
6641
6825
  ],
6642
6826
  status: "shipped"
6643
6827
  },
@@ -6808,7 +6992,7 @@ var COMMANDS = [
6808
6992
  { flag: "--secrets", description: "security only: the SECRETS line" },
6809
6993
  {
6810
6994
  flag: "--secrets-evidence-file",
6811
- description: 'security only: required whenever `--secrets` claims "none found" — the pasted scanner output backing that claim'
6995
+ description: 'security only: required whenever `--secrets` claims "none found" — the passing `atta-labs/secret-scan` check result on the judged head that backs it; never run or paste the scanner'
6812
6996
  },
6813
6997
  { flag: "--task-id", description: "the closing `Tokens:` line's task id" },
6814
6998
  { flag: "--model", description: "the closing `Tokens:` line's model name" },
@@ -6916,7 +7100,20 @@ var COMMANDS = [
6916
7100
  flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
6917
7101
  details: [
6918
7102
  "Refuses if any task Issue attached to the named tranche is still open, naming each one — closing a tranche with unresolved work is never silently allowed.",
6919
- "Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes the GitHub Milestone."
7103
+ "Once every task Issue is closed, prompts for confirmation (unless `--yes`), records the tranche's retrospective in the Milestone its task Issues are attached to, and closes that Milestone once nothing else in it is still open.",
7104
+ "A tranche none of whose task Issues carry a Milestone gets one: a Milestone titled with the tranche's slug is created, the tranche's closed task Issues are attached to it, the retrospective is recorded, and it is closed — so the tranche reads as archived. An Issue already on a Milestone is never moved.",
7105
+ "Idempotent: on a tranche whose Milestone is already closed and carries its retrospective, changes nothing and says it is already archived.",
7106
+ "The generated `vinaya-archivist.yml` workflow runs it after a task pull request merges, and again when an Issue labeled with the tranche closes without a merge (dropped, replaced or closed by hand) — the tranche's slug read from that Issue's own label."
7107
+ ],
7108
+ status: "shipped"
7109
+ },
7110
+ {
7111
+ name: "archive tranches",
7112
+ description: "Archive every finished tranche that has no closed Milestone carrying its retrospective",
7113
+ flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
7114
+ details: [
7115
+ "Walks every `vinaya/tranche:<slug>` label, skips each tranche that still has an open task Issue, and runs `archive tranche` for each finished one whose Milestone is not already closed with its retrospective. One tranche failing does not stop the others; the exit code reports it.",
7116
+ "The generated `vinaya-archivist.yml` workflow calls it on its daily scheduled run, so a tranche that finished before the workflow could see it is archived within a day. Running it again when every finished tranche is archived changes nothing and says so."
6920
7117
  ],
6921
7118
  status: "shipped"
6922
7119
  },
@@ -7060,6 +7257,29 @@ var COMMANDS = [
7060
7257
  ],
7061
7258
  status: "shipped"
7062
7259
  },
7260
+ {
7261
+ name: "log selftest",
7262
+ description: "Prove log delivery works end to end: send one marked test event and read it back — PASS (exit 0) or FAIL with the one reason (exit 1)",
7263
+ details: [
7264
+ "Resolves the destination exactly as an UNATTENDED review-loop run does in this repository — the same trust-anchor read and credential lookup, forced unattended so running it by hand proves the launch path's own resolution, not a human's. It sends one test event to the configured `logs.url` server, then reads it back from the server by the event's own id through the server's cursor read.",
7265
+ "PASS (exit 0) only when the event round-trips. Otherwise FAIL (exit 1) with the ONE reason that stopped it: no server is configured, the default branch's config could not be read to confirm the url (and why), this host holds no ingest or read credential, the server refused with its status, or the event could not be read back. It never prints a credential value.",
7266
+ "The read-back needs a READ credential distinct from the write-only ingest one the server refuses on a read route: set `logs.readHeaders` in vinaya.config.json to the server's read token (referenced by variable name, resolved from the environment exactly as `logs.headers` is). The test event is marked `operation: 'log.selftest'` so a reader can exclude it from real telemetry."
7267
+ ],
7268
+ status: "shipped"
7269
+ },
7270
+ {
7271
+ name: "log emit",
7272
+ description: "Record a consumer-declared event (`logs.events` in vinaya.config.json) from a script or agent outside Vinaya",
7273
+ flags: [
7274
+ { flag: "--json '<json>'", description: "The field values as one JSON object (else read from standard input)" }
7275
+ ],
7276
+ details: [
7277
+ "Reads the field values as ONE JSON object — `--json '<json>'` or piped on standard input, never positional arguments — and records them through `emitCustomEvent`, the same chokepoint every custom event goes through, so the refusal event and the redaction stay in one place.",
7278
+ "A declared event with every field present and of its declared type exits 0 and prints the event name and the kind of destination it was recorded toward (`folder`, `server`, or `none`) — never a field value. A refused event (an undeclared name, or a missing, extra, wrong-typed or too-long field) exits 1 and prints the reason class and the field names — never a value, since a rejected value may be the secret. A missing event name, unreadable JSON, or JSON that is not a flat object is a usage error: exit 2, before anything is recorded.",
7279
+ "A process with only `VINAYA_WORK_REF` and `VINAYA_FLOW` set, and no Vinaya role or task, still gets a header carrying that work reference and way-of-working id — the same environment read every event already honours (`apps/cli/specs/log.md` § Attribution)."
7280
+ ],
7281
+ status: "shipped"
7282
+ },
7063
7283
  {
7064
7284
  name: "log send",
7065
7285
  description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
@@ -7070,6 +7290,23 @@ var COMMANDS = [
7070
7290
  "Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
7071
7291
  ],
7072
7292
  status: "shipped"
7293
+ },
7294
+ {
7295
+ name: "sync",
7296
+ description: "Fill, resume and rebuild the local log cache from this repository's configured destination (read-only)",
7297
+ flags: [
7298
+ {
7299
+ flag: "--rebuild",
7300
+ description: "Delete the cache file and sync from the beginning of what the destination still retains"
7301
+ },
7302
+ { flag: "--json", description: "Enveloped JSON output (schema: 1)" }
7303
+ ],
7304
+ details: [
7305
+ "Resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — then reads a folder destination through the folder source or a server destination through the server source (with the configured `logs.readHeaders`, substituted from the environment), and runs the bounded sync engine against the durable cache this repository holds under its runtime directory. Prints pages read, rows stored, duplicates, edits, deletions, gaps, quarantined lines and, for a server destination, its lost-event diagnostic. Reads the destination and writes only its own cache directory — never the folder, the server, or the forge.",
7306
+ "Exits 0 when the run completed or stopped cleanly on its page bound (and says more is available), 1 when it failed part way (the progress made is kept — a second run resumes from the stored cursor), and 2 for a usage or configuration problem: no destination is configured, or a server destination is configured with no usable read credential. A missing credential names the environment variable to set and never prints its value.",
7307
+ "`--rebuild` deletes the cache file ALONE — never anything else under the cache directory — and syncs again from the beginning of what the destination still retains; an event already rotated out of a folder's single backup slot, or no longer retained by the destination, cannot be recovered and shows up as a gap, never silently."
7308
+ ],
7309
+ status: "shipped"
7073
7310
  }
7074
7311
  ];
7075
7312
  // ../../packages/sources/src/forge-adapter.ts
@@ -7081,10 +7318,10 @@ function createForgeSource(config) {
7081
7318
  };
7082
7319
  }
7083
7320
  // ../../packages/sources/src/select-source.ts
7084
- import { z as z4 } from "zod";
7085
- var StateSourceConfigSchema = z4.discriminatedUnion("kind", [
7086
- z4.object({ kind: z4.literal("forge"), owner: z4.string(), repo: z4.string() }),
7087
- z4.object({ kind: z4.literal("file"), root: z4.string().optional() })
7321
+ import { z as z5 } from "zod";
7322
+ var StateSourceConfigSchema = z5.discriminatedUnion("kind", [
7323
+ z5.object({ kind: z5.literal("forge"), owner: z5.string(), repo: z5.string() }),
7324
+ z5.object({ kind: z5.literal("file"), root: z5.string().optional() })
7088
7325
  ]);
7089
7326
  // src/checks/contract.ts
7090
7327
  var CHECK_SCHEMA_VERSION = 1;