@attalabs/vinaya 0.36.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/README.md +6 -6
  2. package/aeg-root/contracts/developer-reviewer.md +1 -1
  3. package/aeg-root/contracts/planner-operator.md +1 -1
  4. package/aeg-root/contracts/principal-operator.md +6 -6
  5. package/aeg-root/contracts/security-archivist.md +1 -1
  6. package/aeg-root/enforcement.md +14 -14
  7. package/aeg-root/process.md +3 -1
  8. package/aeg-root/roles/archivist.md +2 -2
  9. package/aeg-root/roles/developer/reference.md +36 -37
  10. package/aeg-root/roles/developer.md +9 -5
  11. package/aeg-root/roles/operator.md +18 -18
  12. package/aeg-root/roles/planner/reference.md +15 -4
  13. package/aeg-root/roles/principal.md +6 -1
  14. package/aeg-root/roles/reviewer.md +14 -6
  15. package/aeg-root/roles/security.md +22 -11
  16. package/aeg-root/roles/tranche-archivist.md +14 -2
  17. package/aeg-root/state-machine.md +12 -11
  18. package/aeg-root/templates/brief-template.md +8 -6
  19. package/aeg-root/templates/pr-report-template.md +1 -9
  20. package/aeg-root/tranche-model.md +10 -4
  21. package/dist/checks/bin/check-body-bare-digits.js +823 -595
  22. package/dist/checks/bin/check-branch-topology.js +796 -478
  23. package/dist/checks/bin/check-brief-shape.js +824 -596
  24. package/dist/checks/bin/check-changeset-coverage.js +1337 -747
  25. package/dist/checks/bin/check-closes-n.js +796 -478
  26. package/dist/checks/bin/check-coherence.js +914 -611
  27. package/dist/checks/bin/check-dead-branch-push.js +705 -462
  28. package/dist/checks/bin/check-dispatch-readiness.js +941 -624
  29. package/dist/checks/bin/check-doc-coverage-push.js +1332 -742
  30. package/dist/checks/bin/check-doc-coverage.js +1339 -742
  31. package/dist/checks/bin/check-doctrine-no-procedures.js +821 -593
  32. package/dist/checks/bin/check-doctrine-portability.js +1332 -742
  33. package/dist/checks/bin/check-evidence-fresh.js +1339 -918
  34. package/dist/checks/bin/check-exec-bits.js +1331 -741
  35. package/dist/checks/bin/check-first-push-dispatch.js +917 -614
  36. package/dist/checks/bin/check-issue-assignment.js +796 -478
  37. package/dist/checks/bin/check-issue-milestone-attach.js +705 -462
  38. package/dist/checks/bin/check-issue-objectives-numbering.js +821 -593
  39. package/dist/checks/bin/check-issue-parts-coverage.js +705 -462
  40. package/dist/checks/bin/check-issue-surface-globs.js +925 -613
  41. package/dist/checks/bin/check-issue-title-grammar.js +705 -462
  42. package/dist/checks/bin/check-issue-tranche-label.js +705 -462
  43. package/dist/checks/bin/check-main-branch-refusal.js +705 -462
  44. package/dist/checks/bin/check-no-disk-state.js +705 -462
  45. package/dist/checks/bin/check-pr-premise-reassert.js +821 -593
  46. package/dist/checks/bin/check-pr-report-density.js +705 -462
  47. package/dist/checks/bin/check-principal-test-plan-wait.js +705 -462
  48. package/dist/checks/bin/check-quoted-command.js +1816 -1228
  49. package/dist/checks/bin/check-reader-resolvable-prose.js +1835 -1235
  50. package/dist/checks/bin/check-registry-gates.js +993 -526
  51. package/dist/checks/bin/check-retired-vocabulary.js +1810 -1222
  52. package/dist/checks/bin/check-review-gate.js +832 -604
  53. package/dist/checks/bin/check-single-plan-pr.js +705 -462
  54. package/dist/checks/bin/check-surface-scope.js +796 -478
  55. package/dist/checks/bin/check-test-plan.js +705 -462
  56. package/dist/checks/bin/check-token-collection-wired.js +705 -462
  57. package/dist/checks/bin/check-workspace-escape.js +1332 -742
  58. package/dist/checks/bin/verify-dispatch.js +3849 -0
  59. package/dist/index.js +20876 -10091
  60. package/dist/lib/pre-push-cache-test-run.js +1045 -682
  61. package/dist/lib/pre-push-changed-files.js +16 -11
  62. package/dist/lib/pre-push-select-tests.js +785 -500
  63. package/package.json +2 -2
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/anchored-region.ts +7 -6
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +71 -15
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-validation.ts +51 -12
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/index.ts +1 -0
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/local.ts +31 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +50 -2
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +443 -28
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +18 -5
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +6 -4
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/journal-reconstruction.ts +13 -13
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +46 -110
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +169 -11
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
  77. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/index.ts +3 -1
  78. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/docs/published-prose.ts +30 -0
  79. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doctrine-portability.ts +6 -2
  80. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/gate-audience.ts +0 -1
  81. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +82 -8
  82. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +754 -7
  83. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/leftover-detection.ts +24 -6
  84. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/custom.ts +157 -0
  85. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/envelope.ts +44 -6
  86. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/executions.ts +493 -0
  87. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/fact-sheets.ts +111 -0
  88. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/generator.ts +155 -0
  89. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/fixtures/index.ts +12 -0
  90. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/index.ts +128 -0
  91. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/catches.ts +63 -0
  92. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/checks.ts +146 -0
  93. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/common.ts +137 -0
  94. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/completion.ts +137 -0
  95. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/convergence.ts +420 -0
  96. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/determinism.ts +65 -0
  97. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/index.ts +69 -0
  98. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/judgment.ts +132 -0
  99. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/labels.ts +21 -0
  100. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/time.ts +167 -0
  101. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/questions/usage.ts +139 -0
  102. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +226 -15
  103. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/store.ts +7 -7
  104. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/cache-contract.ts +207 -0
  105. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/contracts.ts +105 -0
  106. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/engine.ts +308 -0
  107. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/index.ts +34 -0
  108. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/measured.ts +20 -0
  109. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/memory-cache.ts +78 -0
  110. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/normalize.ts +156 -0
  111. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/sync/row.ts +103 -0
  112. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/reader-resolvable-prose.ts +34 -6
  113. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/registry-checks.ts +70 -6
  114. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
  115. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-input-manifest.ts +19 -14
  116. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +201 -24
  117. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-status.ts +5 -2
  118. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-phase-history.ts +46 -0
  119. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/task-tools.ts +15 -28
  120. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  121. package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
  122. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  123. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  124. package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
  125. package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
  173. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
  174. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
  175. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
  176. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
  177. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
  178. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
  180. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0h9yhwx._.js +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1wy7w66._.js → [root-of-the-server]__0jdjsxe._.js} +2 -2
  182. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
  184. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
  185. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
  186. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
  187. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  188. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
  189. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
  190. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
  191. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
  192. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
  193. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
  205. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
  207. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
  208. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
  209. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
  210. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
  212. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
  213. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
  214. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  215. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  216. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  217. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  218. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
  219. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
  220. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
  221. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1-acpmtfmrc35.js +1 -0
  222. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
  223. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
  224. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
  225. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
  226. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{2o9l0b7eqbr57.js → 2f2y8xxok8zph.js} +1 -1
  227. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
  228. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
  229. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
  230. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
  231. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3lqjwjrcvq481.js → 2xevgia1h8g0y.js} +2 -2
  232. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
  233. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
  234. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
  235. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  236. package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
  237. package/dist/checks/bin/check-token-report.js +0 -6526
  238. package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
  239. package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
  240. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
  241. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
  242. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
  243. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
  244. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
  245. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
  246. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
  247. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
  248. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
  249. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
  250. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
  251. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
  252. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
  253. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
  254. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
  255. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
  256. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
  257. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
  258. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
  259. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
  260. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
  261. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
  262. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
  263. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
  264. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
  265. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
  266. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
  267. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
  268. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
  269. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
  270. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
  271. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
  272. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
  273. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/00z3-ljjd1gj9.js +0 -1
  274. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
  275. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
  276. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
  277. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
  278. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
  279. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
  280. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
  281. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
  282. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
  283. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
  284. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
  285. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
  286. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
  287. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
  288. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
  289. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
  290. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_buildManifest.js +0 -0
  291. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_clientMiddlewareManifest.js +0 -0
  292. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{z1fTSBP6ZlUjObzFIp-qq → yNZEFRSjP9BLUfdf96Eol}/_ssgManifest.js +0 -0
@@ -630,6 +630,33 @@ function tasksFromIssues(issues) {
630
630
  }
631
631
  return tasks.sort((a, b) => compareTaskIds(a.id, b.id));
632
632
  }
633
+ function resolveDuplicateTasks(tasks, isOpen) {
634
+ const byId = new Map;
635
+ for (const t of tasks)
636
+ byId.set(t.id, [...byId.get(t.id) ?? [], t]);
637
+ const resolved = [];
638
+ const conflicts = [];
639
+ for (const [id, group] of byId) {
640
+ const first = group[0];
641
+ if (!first)
642
+ continue;
643
+ if (group.length === 1) {
644
+ resolved.push(first);
645
+ continue;
646
+ }
647
+ const number = (t) => t.issue ?? 0;
648
+ const open = group.filter((t) => t.issue !== null && isOpen(t.issue)).sort((a, b) => number(a) - number(b));
649
+ if (open.length > 1) {
650
+ conflicts.push({ id, issues: open.map(number) });
651
+ resolved.push(open[0]);
652
+ } else if (open.length === 1) {
653
+ resolved.push(open[0]);
654
+ } else {
655
+ resolved.push([...group].sort((a, b) => number(b) - number(a))[0]);
656
+ }
657
+ }
658
+ return { tasks: resolved.sort((a, b) => compareTaskIds(a.id, b.id)), conflicts };
659
+ }
633
660
  async function fetchTrancheIssuesAsync(owner, repo, slug) {
634
661
  return ghIssueListByAnyLabelAsync(owner, repo, [trancheLabel(slug)]);
635
662
  }
@@ -1437,7 +1464,7 @@ function mapReviewDecision(decision) {
1437
1464
  function buildBranchName(tranche, taskId) {
1438
1465
  return `task/${tranche}/${taskId}`;
1439
1466
  }
1440
- async function fetchForgeFacts(input) {
1467
+ async function fetchForgeFactsByIssue(input) {
1441
1468
  const token = await resolveGithubToken(input.token);
1442
1469
  if (!token) {
1443
1470
  return {
@@ -1447,7 +1474,13 @@ async function fetchForgeFacts(input) {
1447
1474
  reason: "No GitHub token available (set GITHUB_TOKEN/GH_TOKEN or `gh auth login`)."
1448
1475
  };
1449
1476
  }
1450
- const queriedTasks = input.tasks.filter((t) => t.issue !== null);
1477
+ const seen = new Set;
1478
+ const queriedTasks = input.tasks.filter((t) => {
1479
+ if (t.issue === null || seen.has(t.issue))
1480
+ return false;
1481
+ seen.add(t.issue);
1482
+ return true;
1483
+ });
1451
1484
  if (queriedTasks.length === 0) {
1452
1485
  return { facts: new Map, prRefs: new Map, unavailable: false };
1453
1486
  }
@@ -1475,21 +1508,52 @@ async function fetchForgeFacts(input) {
1475
1508
  };
1476
1509
  }
1477
1510
  for (const task of queriedTasks) {
1478
- const alias = aliasFor(task.id);
1479
- const raw = extractRawFromResponse(response.repository, alias);
1511
+ const raw = extractRawFromResponse(response.repository, aliasFor(task.issue));
1480
1512
  const mapped = mapForgeFacts(raw);
1481
1513
  if (mapped)
1482
- facts.set(task.id, mapped);
1514
+ facts.set(task.issue, mapped);
1483
1515
  const pr = raw.pullRequest;
1484
1516
  if (pr && typeof pr.number === "number" && typeof pr.url === "string") {
1485
- prRefs.set(task.id, { number: pr.number, url: pr.url, state: pr.state });
1517
+ prRefs.set(task.issue, { number: pr.number, url: pr.url, state: pr.state });
1486
1518
  }
1487
1519
  }
1488
1520
  return { facts, prRefs, unavailable: false };
1489
1521
  }
1522
+ async function fetchForgeFacts(input) {
1523
+ const byIssue = await fetchForgeFactsByIssue(input);
1524
+ if (byIssue.unavailable) {
1525
+ return { facts: new Map, prRefs: new Map, unavailable: true, reason: byIssue.reason };
1526
+ }
1527
+ const facts = new Map;
1528
+ const prRefs = new Map;
1529
+ const winner = new Map;
1530
+ for (const task of input.tasks) {
1531
+ if (task.issue === null)
1532
+ continue;
1533
+ const current = winner.get(task.id);
1534
+ if (current === undefined || outranks(byIssue.facts, task.issue, current))
1535
+ winner.set(task.id, task.issue);
1536
+ }
1537
+ for (const [taskId, issue] of winner) {
1538
+ const f = byIssue.facts.get(issue);
1539
+ if (f)
1540
+ facts.set(taskId, f);
1541
+ const pr = byIssue.prRefs.get(issue);
1542
+ if (pr)
1543
+ prRefs.set(taskId, pr);
1544
+ }
1545
+ return { facts, prRefs, unavailable: false };
1546
+ }
1547
+ function outranks(facts, candidate, current) {
1548
+ const candidateOpen = facts.get(candidate)?.issueState === "open";
1549
+ const currentOpen = facts.get(current)?.issueState === "open";
1550
+ if (candidateOpen !== currentOpen)
1551
+ return candidateOpen;
1552
+ return candidate > current;
1553
+ }
1490
1554
  function buildBatchQuery(tranche, tasks) {
1491
1555
  const perTask = tasks.map((task) => {
1492
- const a = aliasFor(task.id);
1556
+ const a = aliasFor(task.issue);
1493
1557
  const branch = buildBranchName(tranche, task.id);
1494
1558
  return `
1495
1559
  ${a}_issue: issue(number: ${task.issue}) {
@@ -1531,9 +1595,8 @@ function buildBatchQuery(tranche, tasks) {
1531
1595
  }
1532
1596
  }`;
1533
1597
  }
1534
- function aliasFor(taskId) {
1535
- const sanitized = taskId.replace(/[^a-zA-Z0-9_]/g, "_");
1536
- return `t_${sanitized}`;
1598
+ function aliasFor(issue) {
1599
+ return `i_${issue}`;
1537
1600
  }
1538
1601
  function extractRawFromResponse(repository, alias) {
1539
1602
  const issue = repository[`${alias}_issue`];
@@ -1888,45 +1951,6 @@ var DERIVED_STATUSES = [
1888
1951
  "incoherent"
1889
1952
  ];
1890
1953
  var DERIVABLE_STATUSES = DERIVED_STATUSES.filter((s) => s !== "backlog");
1891
- // ../../packages/aeg-core/src/parse-ledger.ts
1892
- function rowFromCells(cells) {
1893
- if (cells.length < 7)
1894
- return null;
1895
- const phase = (cells[0] ?? "").trim();
1896
- if (!phase)
1897
- return null;
1898
- return {
1899
- phase,
1900
- role: (cells[1] ?? "").trim(),
1901
- agentModel: (cells[2] ?? "").trim(),
1902
- tokensIn: parseIntCell(cells[3] ?? ""),
1903
- tokensOut: parseIntCell(cells[4] ?? ""),
1904
- cost: parseCostCell(cells[5] ?? ""),
1905
- date: (cells[6] ?? "").trim()
1906
- };
1907
- }
1908
- function parseIntCell(cell) {
1909
- const trimmed = cell.replace(/`/g, "").trim();
1910
- if (!trimmed || isEmDashOrDash(trimmed))
1911
- return null;
1912
- const normalized = trimmed.replace(/[,_\s]/g, "");
1913
- if (!/^-?\d+$/.test(normalized))
1914
- return null;
1915
- return Number(normalized);
1916
- }
1917
- function parseCostCell(cell) {
1918
- const trimmed = cell.replace(/`/g, "").trim();
1919
- if (!trimmed || isEmDashOrDash(trimmed))
1920
- return null;
1921
- const normalized = trimmed.replace(/^\$/, "").replace(/[,_\s]/g, "");
1922
- if (!/^-?\d+(\.\d+)?$/.test(normalized))
1923
- return null;
1924
- return Number(normalized);
1925
- }
1926
- function isEmDashOrDash(s) {
1927
- const t = s.trim();
1928
- return t === "—" || t === "-" || t === "–";
1929
- }
1930
1954
  // ../../packages/aeg-core/src/waiver-label.ts
1931
1955
  var WAIVER_LABEL = label("waiver-docs");
1932
1956
  var WAIVER_LABEL_REVIEW = label("waiver-review");
@@ -1942,61 +1966,6 @@ function isWaiverLabelActorVerified(opts) {
1942
1966
  return false;
1943
1967
  return isPrincipal(opts.labelActor, opts.principalAllowlist);
1944
1968
  }
1945
-
1946
- // ../../packages/aeg-core/src/parse-token-report.ts
1947
- var TOKEN_REPORT_HEADING = /^\s*(?:#{1,6}\s*Token report\s*|\*\*Token report\*\*)\s*$/i;
1948
- 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;
1949
- function parseTokenReportEntries(body) {
1950
- const lines = body.split(/\r?\n/);
1951
- const headingIdxs = [];
1952
- lines.forEach((line, i) => {
1953
- if (TOKEN_REPORT_HEADING.test(line))
1954
- headingIdxs.push(i);
1955
- });
1956
- const out = [];
1957
- for (let h = 0;h < headingIdxs.length; h++) {
1958
- const start = headingIdxs[h] + 1;
1959
- const end = h + 1 < headingIdxs.length ? headingIdxs[h + 1] : lines.length;
1960
- const section = lines.slice(start, end).join(`
1961
- `);
1962
- const tableRows = parseTableSection(section);
1963
- if (tableRows.length > 0) {
1964
- out.push(...tableRows);
1965
- continue;
1966
- }
1967
- const inlineRow = parseInlineFieldList(section);
1968
- if (inlineRow)
1969
- out.push(inlineRow);
1970
- }
1971
- return out;
1972
- }
1973
- function parseTableSection(section) {
1974
- const lines = section.split(/\r?\n/);
1975
- let i = 0;
1976
- for (;i < lines.length; i++) {
1977
- if ((lines[i] ?? "").trim().startsWith("|"))
1978
- break;
1979
- }
1980
- if (i + 1 >= lines.length)
1981
- return [];
1982
- i += 2;
1983
- const out = [];
1984
- for (;i < lines.length; i++) {
1985
- const trimmed = (lines[i] ?? "").trim();
1986
- if (!trimmed.startsWith("|"))
1987
- break;
1988
- const row = rowFromCells(splitTableRow(trimmed));
1989
- if (row)
1990
- out.push(row);
1991
- }
1992
- return out;
1993
- }
1994
- function parseInlineFieldList(section) {
1995
- const m = section.match(INLINE_FIELD_LIST);
1996
- if (!m)
1997
- return null;
1998
- return rowFromCells([m[1], m[2], m[3], m[4], m[5], m[6], m[7]]);
1999
- }
2000
1969
  // ../../packages/aeg-core/src/verdict-extraction.ts
2001
1970
  var HEAD_SHA_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Judged head:\s*([0-9a-f]{7,40})(?![A-Za-z0-9])/im;
2002
1971
  var OBJECTIVES_VERSION_PATTERN = /^[ \t]*(?:\*{1,3}|_{1,3})?Objectives version:\s*([0-9a-f]{64})(?![A-Za-z0-9])/im;
@@ -2445,10 +2414,12 @@ function evaluateC5(changed, docOwnersContent, prBody, fileExists, waiverActive,
2445
2414
  var CODE_REVIEW_SEVERITY_ORDER = ["BLOCKER", "MAJOR", "MINOR"];
2446
2415
  var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
2447
2416
  var DEFAULT_MAX_ROUNDS = 3;
2417
+ var DEFAULT_MAX_TASK_MINUTES = 180;
2448
2418
  var DEFAULT_REVIEW_POLICY = {
2449
2419
  codeReviewThreshold: "BLOCKER",
2450
2420
  securityThreshold: "HIGH",
2451
- maxRounds: DEFAULT_MAX_ROUNDS
2421
+ maxRounds: DEFAULT_MAX_ROUNDS,
2422
+ maxTaskMinutes: DEFAULT_MAX_TASK_MINUTES
2452
2423
  };
2453
2424
  var FILE_SHAPED_LOCATION = /\.[a-zA-Z0-9]{1,10}(:\d+)?\s*$/;
2454
2425
  var PROSE_LOCATION_PATTERNS = [/\bpr\s*body\b/i, /\bcomment\b/i];
@@ -2456,6 +2427,9 @@ var ROLE_FILE_LOCATION = /(^|\/)aeg-root\/roles\//i;
2456
2427
  function isProseLocation(location) {
2457
2428
  if (ROLE_FILE_LOCATION.test(location))
2458
2429
  return true;
2430
+ return isBodyOrCommentLocation(location);
2431
+ }
2432
+ function isBodyOrCommentLocation(location) {
2459
2433
  if (FILE_SHAPED_LOCATION.test(location))
2460
2434
  return false;
2461
2435
  return PROSE_LOCATION_PATTERNS.some((pattern) => pattern.test(location));
@@ -2482,7 +2456,7 @@ function classifyFinding(finding, scale, threshold, context = {}) {
2482
2456
  const wouldBlock = blockingSeverities(scale, threshold).includes(effectiveSeverity);
2483
2457
  if (!wouldBlock)
2484
2458
  return { outcome: "non_blocking", deferralReason: null };
2485
- const hasLocation = location !== undefined && location.length > 0;
2459
+ const hasLocation = location !== undefined && location.length > 0 && !isBodyOrCommentLocation(location);
2486
2460
  if (hasLocation && context.inSurface && !context.inSurface(location)) {
2487
2461
  return { outcome: "deferred", deferralReason: "outside-surface" };
2488
2462
  }
@@ -2849,11 +2823,13 @@ function checkDocUpdateList(prBody) {
2849
2823
  return headingCheck(prBody, "(?:documentation|doc)[- ]update(?:\\s+list)?", "Documentation-update list");
2850
2824
  }
2851
2825
  function checkWorktreeStep0(prBody) {
2852
- if (/git worktree add/.test(prBody))
2826
+ if (/git worktree add/.test(prBody) || /cd \.worktrees\//.test(prBody) || /bun install --frozen-lockfile/.test(prBody))
2853
2827
  return { status: "pass", errors: [] };
2854
2828
  return {
2855
2829
  status: "fail",
2856
- errors: ["brief-validation worktree Step 0: no `git worktree add` command found in the PR body."]
2830
+ errors: [
2831
+ "brief-validation worktree Step 0: no `git worktree add`, `cd .worktrees/`, or `bun install --frozen-lockfile` command found in the PR body."
2832
+ ]
2857
2833
  };
2858
2834
  }
2859
2835
  function checkStopConditions(prBody) {
@@ -3043,7 +3019,8 @@ function isCommandBlock(content) {
3043
3019
  return COMMAND_WORDS.includes(commandWordOf(firstNonBlankLine(content)));
3044
3020
  }
3045
3021
  function isStep0Block(content) {
3046
- return firstNonBlankLine(content).startsWith("git worktree add");
3022
+ const first = firstNonBlankLine(content);
3023
+ return first.startsWith("git worktree add") || first.startsWith("cd .worktrees/") || first.startsWith("bun install --frozen-lockfile");
3047
3024
  }
3048
3025
  function checkCommandsCarryOutput(prBody) {
3049
3026
  const errors = [];
@@ -3512,10 +3489,14 @@ function legacySlugPattern(legacySlugs) {
3512
3489
  const alternation = legacySlugs.map((s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")).join("|");
3513
3490
  return new RegExp(`(^|[^a-zA-Z0-9\\n-])(${alternation})([^a-zA-Z0-9\\n-]|$)`, "g");
3514
3491
  }
3492
+ function specGrandfatherPaths(specGrandfather) {
3493
+ return Array.isArray(specGrandfather) ? [...specGrandfather] : Object.keys(specGrandfather);
3494
+ }
3515
3495
  function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuffix, legacySlugs = [], shipsPrefix = SHIPS_PREFIX, specGrandfather = [], specPaths = DEFAULT_SPEC_PATHS) {
3516
3496
  const findings = [];
3517
3497
  const legacyPattern = legacySlugPattern(legacySlugs);
3518
- const grandfathered = new Set(specGrandfather);
3498
+ const grandfatheredWhole = new Set(Array.isArray(specGrandfather) ? specGrandfather : []);
3499
+ const limits = new Map(Array.isArray(specGrandfather) ? [] : Object.entries(specGrandfather));
3519
3500
  const patterns = [
3520
3501
  { pattern: FORGE_NUMBER_PATTERN, what: "a forge number" },
3521
3502
  { pattern: TRANCHE_SLUG_VN_PATTERN, what: "an internal tranche slug" },
@@ -3534,18 +3515,19 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
3534
3515
  continue;
3535
3516
  if (cls !== "product" && cls !== "spec" && !SWEPT_CLASSES.has(cls))
3536
3517
  continue;
3537
- if (cls === "spec" && grandfathered.has(file.path))
3518
+ if (cls === "spec" && grandfatheredWhole.has(file.path))
3538
3519
  continue;
3539
3520
  const blocking = cls === "product" || cls === "spec";
3540
3521
  const scrubbed = cls === "product" ? stripNonProseForProduct(file.path, file.content) : stripNonProse(file.path, file.content);
3541
3522
  const patternsToRun = cls === "product" ? productPatterns : cls === "spec" ? specPatterns : patterns;
3523
+ const fileFindings = [];
3542
3524
  for (const { pattern, what, group } of patternsToRun) {
3543
3525
  pattern.lastIndex = 0;
3544
3526
  let match = pattern.exec(scrubbed);
3545
3527
  while (match !== null) {
3546
3528
  const cited = group !== undefined ? match[group] ?? match[0] : match[0];
3547
3529
  const citedIndex = match.index + match[0].indexOf(cited);
3548
- findings.push({
3530
+ fileFindings.push({
3549
3531
  file: file.path,
3550
3532
  line: lineAt(scrubbed, citedIndex),
3551
3533
  message: `references ${what} ("${cited}") a reader outside this repo's tracker cannot resolve`,
@@ -3554,6 +3536,15 @@ function checkUnresolvableReferences(files, readerFacingPrefix, readerFacingSuff
3554
3536
  match = pattern.exec(scrubbed);
3555
3537
  }
3556
3538
  }
3539
+ const limit = cls === "spec" ? limits.get(file.path) : undefined;
3540
+ if (limit !== undefined) {
3541
+ if (fileFindings.length <= limit)
3542
+ continue;
3543
+ for (const f of fileFindings) {
3544
+ f.message += `; ${file.path} carries ${fileFindings.length} such findings, over its proseGates.specGrandfather limit of ${limit}`;
3545
+ }
3546
+ }
3547
+ findings.push(...fileFindings);
3557
3548
  }
3558
3549
  return findings;
3559
3550
  }
@@ -4135,6 +4126,8 @@ var FILE_EXTENSIONS = new Set([
4135
4126
  "html",
4136
4127
  "css"
4137
4128
  ]);
4129
+ var CI_SHARD_DIR = "apps/cli/tests/ci-shards";
4130
+ var CI_SHARD_PROBE = `${CI_SHARD_DIR}/shard-1.txt`;
4138
4131
 
4139
4132
  // ../../packages/aeg-core/src/task-branch-identity.ts
4140
4133
  var ISSUE_BRANCH_PATTERN = /^task\/issue-(\d+)$/;
@@ -4513,8 +4506,7 @@ function briefHash(brief) {
4513
4506
  function policyDigest(policy) {
4514
4507
  return createHash4("sha256").update(JSON.stringify({
4515
4508
  codeReviewThreshold: policy.codeReviewThreshold,
4516
- securityThreshold: policy.securityThreshold,
4517
- maxRounds: policy.maxRounds
4509
+ securityThreshold: policy.securityThreshold
4518
4510
  })).digest("hex");
4519
4511
  }
4520
4512
  function isBoundToHead(echoed, headSha) {
@@ -4827,7 +4819,46 @@ function parseEnforcementRegistry(content) {
4827
4819
  return result;
4828
4820
  }
4829
4821
  // ../../packages/aeg-core/src/registry-checks.ts
4830
- function checkG1(rows, existsFn) {
4822
+ var HOOK_DIR_PREFIXES = [".claude/hooks/", ".vinaya/hooks/", ".husky/", ".git/hooks/"];
4823
+ var BARE_HOOK_NAME = /^check-[A-Za-z0-9_.-]*\.sh$/;
4824
+ function basename(path) {
4825
+ return path.slice(path.lastIndexOf("/") + 1);
4826
+ }
4827
+ function lineOf(content, index) {
4828
+ let line = 1;
4829
+ for (let i = 0;i < index; i++)
4830
+ if (content.charCodeAt(i) === 10)
4831
+ line++;
4832
+ return line;
4833
+ }
4834
+ function findUnshippedHookRefs(docs, shipped) {
4835
+ const shippedNames = new Set([...shipped].map(basename));
4836
+ const findings = [];
4837
+ const flag = (doc, token, index) => {
4838
+ findings.push({
4839
+ path: doc.path,
4840
+ reason: `${doc.path}:${lineOf(doc.content, index)} names hook "${token}", which is neither tracked in git nor emitted by \`vinaya init\``
4841
+ });
4842
+ };
4843
+ for (const doc of docs) {
4844
+ for (const { cited, index } of extractCitedPaths(doc.content)) {
4845
+ if (cited.endsWith("/") || !HOOK_DIR_PREFIXES.some((p) => cited.startsWith(p)))
4846
+ continue;
4847
+ if (!shipped.has(cited))
4848
+ flag(doc, cited, index);
4849
+ }
4850
+ const spanPattern = /`([^`\n]+)`/g;
4851
+ let match = spanPattern.exec(doc.content);
4852
+ while (match !== null) {
4853
+ const token = match[1] ?? "";
4854
+ if (BARE_HOOK_NAME.test(token) && !shippedNames.has(token))
4855
+ flag(doc, token, match.index);
4856
+ match = spanPattern.exec(doc.content);
4857
+ }
4858
+ }
4859
+ return findings;
4860
+ }
4861
+ function checkG1(rows, existsFn, hookRefs) {
4831
4862
  const findings = [];
4832
4863
  for (const row of rows) {
4833
4864
  if (row.implementation === "")
@@ -4840,6 +4871,8 @@ function checkG1(rows, existsFn) {
4840
4871
  });
4841
4872
  }
4842
4873
  }
4874
+ if (hookRefs)
4875
+ findings.push(...findUnshippedHookRefs(hookRefs.docs, hookRefs.shipped));
4843
4876
  return { check: "G1", status: findings.length > 0 ? "fail" : "pass", findings };
4844
4877
  }
4845
4878
  var SCAFFOLD_PLACEHOLDER = "[undocumented — fill in why]";
@@ -4972,6 +5005,55 @@ function checkG6(rows, registeredCheckNames) {
4972
5005
  }
4973
5006
  return { check: "G6", status: findings.length > 0 ? "fail" : "pass", findings };
4974
5007
  }
5008
+ function reachesProducer(file, producers, imports) {
5009
+ const seen = new Set([file]);
5010
+ const queue = [file];
5011
+ for (let next = queue.pop();next !== undefined; next = queue.pop()) {
5012
+ if (producers.has(next))
5013
+ return true;
5014
+ for (const dep of imports.get(next) ?? []) {
5015
+ if (!seen.has(dep)) {
5016
+ seen.add(dep);
5017
+ queue.push(dep);
5018
+ }
5019
+ }
5020
+ }
5021
+ return false;
5022
+ }
5023
+ function checkG7(input) {
5024
+ if (!input.enforcementMapPresent)
5025
+ return { check: "G7", status: "info", findings: [] };
5026
+ const subjects = new Set([...input.crossingFiles, ...input.blockingFiles]);
5027
+ const findings = [];
5028
+ for (const path of subjects) {
5029
+ if (path in input.exemptions)
5030
+ continue;
5031
+ if (!reachesProducer(path, input.producers, input.imports)) {
5032
+ findings.push({
5033
+ path,
5034
+ reason: `"${path}" ${input.crossingFiles.includes(path) ? "makes a GitHub-writing call" : "implements a blocking gate"} but neither is a log producer nor imports one, and it is not exempted with a reason`
5035
+ });
5036
+ }
5037
+ }
5038
+ for (const [path, reason] of Object.entries(input.exemptions)) {
5039
+ if (reason.trim() === "") {
5040
+ findings.push({ path, reason: `exemption for "${path}" states no reason` });
5041
+ } else if (!input.existsFn(path)) {
5042
+ findings.push({ path, reason: `exemption names "${path}", which no longer exists` });
5043
+ } else if (!subjects.has(path)) {
5044
+ findings.push({
5045
+ path,
5046
+ reason: `exemption names "${path}", which is neither a GitHub-writing file nor a blocking gate's implementation`
5047
+ });
5048
+ } else if (reachesProducer(path, input.producers, input.imports)) {
5049
+ findings.push({
5050
+ path,
5051
+ reason: `exemption names "${path}", which does reach a log producer — remove the exemption`
5052
+ });
5053
+ }
5054
+ }
5055
+ return { check: "G7", status: findings.length > 0 ? "fail" : "pass", findings };
5056
+ }
4975
5057
  // ../../packages/aeg-core/src/dead-branch-push-guard.ts
4976
5058
  function checkDeadBranchPush(input) {
4977
5059
  const { branch, prState, prNumber } = input;
@@ -5151,6 +5233,11 @@ function checkDispatchReadiness(input) {
5151
5233
  push("depends-on-unresolvable", `dispatch-gate depends-on: ${taskLabel} depends on "${dep.id}", which is UNRESOLVABLE — the resolver could not find a matching tranche/task/Issue for this edge (not a claim about merge status). Not dispatchable until the edge is corrected.`);
5152
5234
  continue;
5153
5235
  }
5236
+ if (dep.readFailed === true) {
5237
+ const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
5238
+ push("depends-on-read-failed", `dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, but the forge could not be read for that dependency — not a claim about its merge status. Retry the check.`);
5239
+ continue;
5240
+ }
5154
5241
  if (!dep.merged && !isHandClosedByRecognizedPrincipal(dep, principalAllowlist)) {
5155
5242
  const issueStr = dep.issue !== null ? ` (#${dep.issue})` : "";
5156
5243
  push("depends-on-not-merged", `dispatch-gate depends-on: ${taskLabel} depends on ${dep.id}${issueStr}, whose PR is not merged yet — not dispatchable, it serializes behind it.`);
@@ -5393,7 +5480,6 @@ var TaskPrPauseSchema = z.object({
5393
5480
  var TaskPrReviewRecordSchema = z.object({
5394
5481
  verdicts: z.array(TaskPrVerdictSchema),
5395
5482
  roundMarkers: z.array(z.number().int().nonnegative()),
5396
- summaryTable: z.string().nullable(),
5397
5483
  pause: TaskPrPauseSchema.nullable()
5398
5484
  });
5399
5485
  var TaskPrReadInputSchema = z.object({
@@ -5440,16 +5526,6 @@ var TaskCancelResultSchema = z.object({
5440
5526
  authenticatedFrom: z.string().min(1),
5441
5527
  fencedEffectKeys: z.array(z.string())
5442
5528
  });
5443
- var TASK_TOOL_NAMES = [
5444
- "task_start",
5445
- "task_status",
5446
- "task_escalation_read",
5447
- "task_pr_read",
5448
- "task_resume",
5449
- "task_cancel"
5450
- ];
5451
- var OPERATOR_STATUS_FOLLOW = "task_status_follow";
5452
- var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
5453
5529
  // ../../packages/aeg-core/src/first-push-dispatch-gate.ts
5454
5530
  function parseTaskBranch(branch) {
5455
5531
  const m = /^task\/([^/]+)\/([^/]+)$/.exec(branch);
@@ -5680,16 +5756,71 @@ var NO_GATE_CUTOVERS = {
5680
5756
  briefRulesSincePr: null,
5681
5757
  agentBoxesRefusedSincePr: null
5682
5758
  };
5683
- // ../../packages/aeg-core/src/dev-review-loop/types.ts
5684
- var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
5685
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
5686
- var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
5687
- // ../../packages/aeg-core/src/log/envelope.ts
5688
- import { createHash as createHash5 } from "node:crypto";
5689
-
5690
5759
  // ../../packages/aeg-core/src/log/schema.ts
5760
+ import { z as z3 } from "zod";
5761
+
5762
+ // ../../packages/aeg-core/src/log/custom.ts
5691
5763
  import { z as z2 } from "zod";
5764
+ var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
5765
+ var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
5766
+ var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
5767
+ var CUSTOM_EVENT_MAX_FIELDS = 20;
5768
+ var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
5769
+ var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
5770
+ var CUSTOM_TEXT_MAX_LENGTH = 500;
5771
+ var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
5772
+ var CUSTOM_WORD_MAX_LENGTH = 64;
5773
+ var CUSTOM_FIELD_MAX_WORDS = 50;
5774
+ var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
5775
+ var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
5776
+ fields: z2.record(z2.string(), CustomFieldTypeSchema)
5777
+ }).strict()).superRefine((events, ctx) => {
5778
+ for (const [name, declaration] of Object.entries(events)) {
5779
+ const refuse = (message, path = []) => {
5780
+ ctx.addIssue({
5781
+ code: z2.ZodIssueCode.custom,
5782
+ path: [name, ...path],
5783
+ message: `logs.events "${name}": ${message}`
5784
+ });
5785
+ };
5786
+ if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
5787
+ refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
5788
+ }
5789
+ if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
5790
+ refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
5791
+ } else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
5792
+ refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
5793
+ }
5794
+ const fieldEntries = Object.entries(declaration.fields);
5795
+ if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
5796
+ refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
5797
+ }
5798
+ for (const [field, type] of fieldEntries) {
5799
+ if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
5800
+ 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]);
5801
+ }
5802
+ if (typeof type === "string")
5803
+ continue;
5804
+ if (type.length === 0) {
5805
+ refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
5806
+ }
5807
+ if (type.length > CUSTOM_FIELD_MAX_WORDS) {
5808
+ refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
5809
+ }
5810
+ const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
5811
+ if (bad.length > 0) {
5812
+ refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
5813
+ }
5814
+ if (new Set(type).size !== type.length) {
5815
+ refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
5816
+ }
5817
+ }
5818
+ }
5819
+ });
5820
+
5821
+ // ../../packages/aeg-core/src/log/schema.ts
5692
5822
  var CONFIDENCE_REASON_MAX_LENGTH = 280;
5823
+ var REVIEW_FINDING_DESCRIPTION_MAX_LENGTH = 1000;
5693
5824
  var ROLE_VALUES = [
5694
5825
  "planner",
5695
5826
  "developer",
@@ -5699,178 +5830,214 @@ var ROLE_VALUES = [
5699
5830
  "archivist",
5700
5831
  "architect"
5701
5832
  ];
5702
- var RoleSchema = z2.enum(ROLE_VALUES);
5833
+ var RoleSchema = z3.enum(ROLE_VALUES);
5703
5834
  var HOST_VALUES = ["hook", "ci", "cli", "loop"];
5704
- var HostSchema = z2.enum(HOST_VALUES);
5835
+ var HostSchema = z3.enum(HOST_VALUES);
5705
5836
  var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
5706
5837
  var headerMetaCore = {
5707
- ts: z2.string(),
5708
- run_id: z2.string().regex(RUN_ID_PATTERN),
5709
- seq: z2.number().int().nonnegative(),
5710
- repo: z2.string().nullable(),
5711
- vinaya: z2.string(),
5712
- doctrine: z2.string(),
5838
+ ts: z3.string(),
5839
+ run_id: z3.string().regex(RUN_ID_PATTERN),
5840
+ seq: z3.number().int().nonnegative(),
5841
+ repo: z3.string().nullable(),
5842
+ vinaya: z3.string(),
5843
+ doctrine: z3.string(),
5713
5844
  host: HostSchema,
5714
- machine: z2.string()
5845
+ machine: z3.string()
5715
5846
  };
5716
- var HeaderMetaV1Schema = z2.object({
5717
- schema: z2.literal(1),
5847
+ var HeaderMetaV1Schema = z3.object({
5848
+ schema: z3.literal(1),
5718
5849
  ...headerMetaCore
5719
5850
  }).strict();
5720
- var LineageSchema = z2.object({
5721
- run: z2.string().nullable(),
5722
- attempt: z2.number().int().nullable(),
5723
- parent: z2.string().nullable()
5851
+ var LineageSchema = z3.object({
5852
+ run: z3.string().nullable(),
5853
+ attempt: z3.number().int().nullable(),
5854
+ parent: z3.string().nullable()
5724
5855
  }).strict();
5725
- var InputVersionsSchema = z2.object({
5726
- objectives_version: z2.string().nullable(),
5727
- brief_hash: z2.string().nullable(),
5728
- ruling_ordinal: z2.number().int().nullable(),
5729
- policy_digest: z2.string().nullable()
5856
+ var InputVersionsSchema = z3.object({
5857
+ objectives_version: z3.string().nullable(),
5858
+ brief_hash: z3.string().nullable(),
5859
+ ruling_ordinal: z3.number().int().nullable(),
5860
+ policy_digest: z3.string().nullable()
5730
5861
  }).strict();
5731
- var ProvenanceSchema = z2.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
5732
- var HeaderMetaV2Schema = z2.object({
5733
- schema: z2.literal(2),
5862
+ var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
5863
+ var HeaderMetaV2Schema = z3.object({
5864
+ schema: z3.literal(2),
5734
5865
  ...headerMetaCore,
5735
- event_id: z2.string().min(1),
5736
- process_id: z2.string().min(1),
5737
- actor_id: z2.string().nullable(),
5866
+ event_id: z3.string().min(1),
5867
+ process_id: z3.string().min(1),
5868
+ actor_id: z3.string().nullable(),
5738
5869
  lineage: LineageSchema,
5739
5870
  input_versions: InputVersionsSchema,
5740
5871
  provenance: ProvenanceSchema
5741
5872
  }).strict();
5742
- var HeaderMetaSchema = z2.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema]);
5743
- var SubjectSchema = z2.object({
5744
- issue: z2.number().int().nullable(),
5745
- pr: z2.number().int().optional(),
5746
- sha: z2.string().optional(),
5747
- role: z2.union([RoleSchema, z2.literal("unattributed")]),
5748
- round: z2.number().int().optional(),
5749
- objectives_version: z2.string().optional()
5873
+ var WorkSchema = z3.object({
5874
+ ref: z3.string().nullable(),
5875
+ repo: z3.string().nullable(),
5876
+ change: z3.string().nullable(),
5877
+ revision: z3.string().nullable()
5878
+ }).strict();
5879
+ var FlowSchema = z3.object({
5880
+ id: z3.string().nullable(),
5881
+ version: z3.string().nullable()
5882
+ }).strict();
5883
+ var HeaderMetaV3Schema = z3.object({
5884
+ schema: z3.literal(3),
5885
+ ...headerMetaCore,
5886
+ event_id: z3.string().min(1),
5887
+ process_id: z3.string().min(1),
5888
+ actor_id: z3.string().nullable(),
5889
+ lineage: LineageSchema,
5890
+ input_versions: InputVersionsSchema,
5891
+ provenance: ProvenanceSchema,
5892
+ work: WorkSchema,
5893
+ flow: FlowSchema,
5894
+ runtime: z3.string().nullable(),
5895
+ source: z3.string().nullable()
5750
5896
  }).strict();
5751
- var HeaderSchema = z2.object({
5897
+ var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
5898
+ var SubjectSchema = z3.object({
5899
+ issue: z3.number().int().nullable(),
5900
+ pr: z3.number().int().optional(),
5901
+ sha: z3.string().optional(),
5902
+ role: z3.union([RoleSchema, z3.literal("unattributed")]),
5903
+ round: z3.number().int().optional(),
5904
+ objectives_version: z3.string().optional()
5905
+ }).strict();
5906
+ var HeaderSchema = z3.object({
5752
5907
  meta: HeaderMetaSchema,
5753
5908
  subject: SubjectSchema
5754
5909
  }).strict();
5755
5910
  var envelopeTail = {
5756
- duration_ms: z2.number().nonnegative().optional(),
5757
- payload: z2.object({}).strict()
5911
+ duration_ms: z3.number().nonnegative().optional(),
5912
+ payload: z3.object({}).strict()
5758
5913
  };
5759
- var ReviewFindingSchema = z2.object({
5760
- id: z2.string(),
5761
- severity: z2.string(),
5762
- state: z2.string().optional(),
5763
- severity_scale: z2.string().optional(),
5764
- policy_treatment: z2.enum(["blocking", "non_blocking", "unavailable"]).optional(),
5765
- confidence: z2.number().min(0).max(1).optional(),
5766
- confidence_scale: z2.string().optional(),
5767
- confidence_source: z2.string().optional()
5914
+ var ReviewFindingSchema = z3.object({
5915
+ id: z3.string(),
5916
+ severity: z3.string(),
5917
+ location: z3.string().optional(),
5918
+ deferral_reason: z3.enum(["outside-surface", "unchanged-line"]).optional(),
5919
+ description: z3.string().max(REVIEW_FINDING_DESCRIPTION_MAX_LENGTH).optional(),
5920
+ state: z3.string().optional(),
5921
+ severity_scale: z3.string().optional(),
5922
+ policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
5923
+ confidence: z3.number().min(0).max(1).optional(),
5924
+ confidence_scale: z3.string().optional(),
5925
+ confidence_source: z3.string().optional()
5768
5926
  }).strict();
5769
- var DispatchOutcomeSchema = z2.discriminatedUnion("type", [
5770
- z2.object({ type: z2.literal("pr_opened"), pr: z2.number().int(), head: z2.string() }).strict(),
5771
- z2.object({
5772
- type: z2.literal("round_pushed"),
5773
- pr: z2.number().int(),
5774
- head: z2.string(),
5775
- comment_id: z2.number().int()
5927
+ var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
5928
+ z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
5929
+ z3.object({
5930
+ type: z3.literal("round_pushed"),
5931
+ pr: z3.number().int(),
5932
+ head: z3.string(),
5933
+ comment_id: z3.number().int()
5776
5934
  }).strict(),
5777
- z2.object({
5778
- type: z2.literal("verdict"),
5779
- verdict: z2.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
5780
- head: z2.string(),
5781
- comment_id: z2.number().int(),
5782
- objectives: z2.array(z2.object({ id: z2.string(), met: z2.boolean() }).strict()),
5783
- findings: z2.array(ReviewFindingSchema)
5935
+ z3.object({
5936
+ type: z3.literal("verdict"),
5937
+ verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
5938
+ head: z3.string(),
5939
+ comment_id: z3.number().int(),
5940
+ objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
5941
+ findings: z3.array(ReviewFindingSchema)
5784
5942
  }).strict(),
5785
- z2.object({
5786
- type: z2.literal("escalation"),
5787
- class: z2.enum(["authority", "strategy", "product"]),
5788
- comment_id: z2.number().int()
5943
+ z3.object({
5944
+ type: z3.literal("escalation"),
5945
+ class: z3.enum(["authority", "strategy", "product"]),
5946
+ comment_id: z3.number().int()
5789
5947
  }).strict(),
5790
- z2.object({ type: z2.literal("brief"), comment_id: z2.number().int(), hash: z2.string() }).strict(),
5791
- z2.object({ type: z2.literal("plan"), issues: z2.array(z2.number().int()) }).strict(),
5792
- z2.object({ type: z2.literal("archive"), provenance_comment_id: z2.number().int() }).strict(),
5793
- z2.object({ type: z2.literal("completed") }).strict()
5948
+ z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
5949
+ z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
5950
+ z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
5951
+ z3.object({ type: z3.literal("completed") }).strict()
5794
5952
  ]);
5795
5953
  var dispatchShared = {
5796
5954
  meta: HeaderMetaSchema,
5797
5955
  subject: SubjectSchema,
5798
- kind: z2.literal("dispatch"),
5956
+ kind: z3.literal("dispatch"),
5799
5957
  ...envelopeTail,
5800
5958
  target_role: RoleSchema,
5801
- model: z2.string(),
5802
- round: z2.number().int().optional(),
5803
- effect_id: z2.string()
5959
+ model: z3.string(),
5960
+ round: z3.number().int().optional(),
5961
+ effect_id: z3.string()
5804
5962
  };
5805
- var dispatchUsageField = z2.object({ input: z2.number().nonnegative(), output: z2.number().nonnegative() }).strict().nullable();
5806
- var DispatchEventSchema = z2.discriminatedUnion("event", [
5807
- z2.object({ ...dispatchShared, event: z2.literal("dispatched"), prompt_hash: z2.string() }).strict(),
5808
- z2.object({
5963
+ var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
5964
+ var DispatchEventSchema = z3.discriminatedUnion("event", [
5965
+ z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
5966
+ z3.object({
5809
5967
  ...dispatchShared,
5810
- event: z2.literal("outcome_received"),
5968
+ event: z3.literal("outcome_received"),
5811
5969
  outcome: DispatchOutcomeSchema,
5812
5970
  usage: dispatchUsageField
5813
5971
  }).strict(),
5814
- z2.object({
5972
+ z3.object({
5815
5973
  ...dispatchShared,
5816
- event: z2.literal("dispatch_failed"),
5817
- reason: z2.enum(["timeout", "crash", "refused", "unattributed_write"]),
5974
+ event: z3.literal("dispatch_failed"),
5975
+ reason: z3.enum(["timeout", "crash", "refused", "unattributed_write", "usage_limit"]),
5976
+ usage_limit: z3.object({ agent: z3.string().min(1), reset_at: z3.string().nullable() }).strict().optional(),
5818
5977
  usage: dispatchUsageField
5819
5978
  }).strict()
5820
5979
  ]);
5980
+ var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
5981
+ var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
5982
+ var ReviewerVerdictSchema = z3.object({
5983
+ role: RoleSchema,
5984
+ outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
5985
+ blockers: z3.number().int().nonnegative()
5986
+ }).strict();
5821
5987
  var loopShared = {
5822
5988
  meta: HeaderMetaSchema,
5823
5989
  subject: SubjectSchema,
5824
- kind: z2.literal("dev_review_loop"),
5990
+ kind: z3.literal("dev_review_loop"),
5825
5991
  ...envelopeTail,
5826
- loop_id: z2.string()
5992
+ loop_id: z3.string()
5827
5993
  };
5828
- var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
5829
- z2.object({
5994
+ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
5995
+ z3.object({
5830
5996
  ...loopShared,
5831
- event: z2.literal("loop_started"),
5832
- task: z2.number().int(),
5833
- policy: z2.object({
5834
- max_rounds: z2.number().int().nonnegative(),
5835
- reviewers: z2.array(RoleSchema),
5836
- models: z2.record(RoleSchema, z2.string())
5997
+ event: z3.literal("loop_started"),
5998
+ task: z3.number().int(),
5999
+ policy: z3.object({
6000
+ max_rounds: z3.number().int().nonnegative(),
6001
+ reviewers: z3.array(RoleSchema),
6002
+ models: z3.record(RoleSchema, z3.string())
5837
6003
  }).strict()
5838
6004
  }).strict(),
5839
- z2.object({ ...loopShared, event: z2.literal("round_started"), round: z2.number().int(), base_head: z2.string() }).strict(),
5840
- z2.object({
6005
+ z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
6006
+ z3.object({
5841
6007
  ...loopShared,
5842
- event: z2.literal("gate_result_read"),
5843
- round: z2.number().int(),
5844
- head: z2.string(),
5845
- green: z2.boolean(),
5846
- confidence_value: z2.number().int().min(0).max(100).optional(),
5847
- confidence_reason: z2.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
5848
- confidence_unavailable: z2.boolean().optional(),
5849
- extra_turn_spent: z2.boolean().optional()
6008
+ event: z3.literal("gate_result_read"),
6009
+ round: z3.number().int(),
6010
+ head: z3.string(),
6011
+ green: z3.boolean(),
6012
+ confidence_value: z3.number().int().min(0).max(100).optional(),
6013
+ confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
6014
+ confidence_unavailable: z3.boolean().optional(),
6015
+ extra_turn_spent: z3.boolean().optional()
5850
6016
  }).strict(),
5851
- z2.object({
6017
+ z3.object({
5852
6018
  ...loopShared,
5853
- event: z2.literal("verdicts_read"),
5854
- round: z2.number().int(),
5855
- head: z2.string(),
5856
- all_approve: z2.boolean(),
5857
- blockers: z2.number().int().nonnegative(),
5858
- findings: z2.array(ReviewFindingSchema).optional()
6019
+ event: z3.literal("verdicts_read"),
6020
+ round: z3.number().int(),
6021
+ head: z3.string(),
6022
+ all_approve: z3.boolean(),
6023
+ blockers: z3.number().int().nonnegative(),
6024
+ findings: z3.array(ReviewFindingSchema).optional(),
6025
+ reviewers: z3.array(ReviewerVerdictSchema).optional()
5859
6026
  }).strict(),
5860
- z2.object({
6027
+ z3.object({
5861
6028
  ...loopShared,
5862
- event: z2.literal("findings_compared"),
5863
- round: z2.number().int(),
5864
- open: z2.array(z2.string()),
5865
- resolved: z2.array(z2.string()),
5866
- new: z2.array(z2.string()),
5867
- recurring: z2.array(z2.string())
6029
+ event: z3.literal("findings_compared"),
6030
+ round: z3.number().int(),
6031
+ open: z3.array(z3.string()),
6032
+ resolved: z3.array(z3.string()),
6033
+ new: z3.array(z3.string()),
6034
+ recurring: z3.array(z3.string())
5868
6035
  }).strict(),
5869
- z2.object({
6036
+ z3.object({
5870
6037
  ...loopShared,
5871
- event: z2.literal("stop_condition_met"),
5872
- round: z2.number().int(),
5873
- condition: z2.enum([
6038
+ event: z3.literal("stop_condition_met"),
6039
+ round: z3.number().int(),
6040
+ condition: z3.enum([
5874
6041
  "green",
5875
6042
  "max_rounds",
5876
6043
  "no_progress",
@@ -5879,66 +6046,85 @@ var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
5879
6046
  "confidence",
5880
6047
  "reappearance",
5881
6048
  "repeat_finding",
5882
- "repeat_failure"
6049
+ "repeat_failure",
6050
+ "time_budget"
5883
6051
  ])
5884
6052
  }).strict(),
5885
- z2.object({
6053
+ z3.object({
6054
+ ...loopShared,
6055
+ event: z3.literal("paused"),
6056
+ round: z3.number().int(),
6057
+ reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
6058
+ reason_code: CodeTokenSchema.optional()
6059
+ }).strict(),
6060
+ z3.object({
6061
+ ...loopShared,
6062
+ event: z3.literal("resumed"),
6063
+ round: z3.number().int(),
6064
+ by: z3.enum(["principal", "driver"])
6065
+ }).strict(),
6066
+ z3.object({
5886
6067
  ...loopShared,
5887
- event: z2.literal("paused"),
5888
- round: z2.number().int(),
5889
- reason: z2.enum(["escalation", "principal_item", "refreeze_needed"])
6068
+ event: z3.literal("cancelled"),
6069
+ round: z3.number().int(),
6070
+ by: z3.literal("principal")
5890
6071
  }).strict(),
5891
- z2.object({
6072
+ z3.object({
5892
6073
  ...loopShared,
5893
- event: z2.literal("resumed"),
5894
- round: z2.number().int(),
5895
- by: z2.enum(["principal", "driver"])
6074
+ event: z3.literal("unpushed_work_resume"),
6075
+ round: z3.number().int(),
6076
+ branch: z3.string(),
6077
+ detail: z3.string()
5896
6078
  }).strict(),
5897
- z2.object({
6079
+ z3.object({
5898
6080
  ...loopShared,
5899
- event: z2.literal("cancelled"),
5900
- round: z2.number().int(),
5901
- by: z2.literal("principal")
6081
+ event: z3.literal("round_ended"),
6082
+ round: z3.number().int(),
6083
+ base_head: z3.string(),
6084
+ head: z3.string(),
6085
+ files_changed: z3.number().int().nonnegative(),
6086
+ insertions: z3.number().int().nonnegative(),
6087
+ deletions: z3.number().int().nonnegative(),
6088
+ wall_ms: z3.number().nonnegative(),
6089
+ outcome: z3.enum(["green", "changes_requested", "escalated"])
5902
6090
  }).strict(),
5903
- z2.object({
6091
+ z3.object({
5904
6092
  ...loopShared,
5905
- event: z2.literal("unpushed_work_resume"),
5906
- round: z2.number().int(),
5907
- branch: z2.string(),
5908
- detail: z2.string()
6093
+ event: z3.literal("journal_finalized"),
6094
+ rounds: z3.number().int().nonnegative(),
6095
+ total_wall_ms: z3.number().nonnegative(),
6096
+ time_to_green_ms: z3.number().nonnegative().nullable(),
6097
+ files_changed_total: z3.number().int().nonnegative(),
6098
+ final_head: z3.string(),
6099
+ result: z3.enum(["merged_ready", "stopped"])
5909
6100
  }).strict(),
5910
- z2.object({
6101
+ z3.object({
5911
6102
  ...loopShared,
5912
- event: z2.literal("round_ended"),
5913
- round: z2.number().int(),
5914
- base_head: z2.string(),
5915
- head: z2.string(),
5916
- files_changed: z2.number().int().nonnegative(),
5917
- insertions: z2.number().int().nonnegative(),
5918
- deletions: z2.number().int().nonnegative(),
5919
- wall_ms: z2.number().nonnegative(),
5920
- outcome: z2.enum(["green", "changes_requested", "escalated"])
6103
+ event: z3.literal("infrastructure_retry"),
6104
+ round: z3.number().int(),
6105
+ failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
6106
+ attempts: z3.number().int().positive(),
6107
+ outcome: z3.enum(["recovered", "exhausted"])
5921
6108
  }).strict(),
5922
- z2.object({
6109
+ z3.object({
5923
6110
  ...loopShared,
5924
- event: z2.literal("journal_finalized"),
5925
- rounds: z2.number().int().nonnegative(),
5926
- total_wall_ms: z2.number().nonnegative(),
5927
- time_to_green_ms: z2.number().nonnegative().nullable(),
5928
- files_changed_total: z2.number().int().nonnegative(),
5929
- final_head: z2.string(),
5930
- result: z2.enum(["merged_ready", "stopped"])
6111
+ event: z3.literal("driver_heartbeat"),
6112
+ task: z3.number().int(),
6113
+ pr: z3.number().int().positive().optional(),
6114
+ round: z3.number().int(),
6115
+ phase: z3.string()
5931
6116
  }).strict(),
5932
- z2.object({
6117
+ z3.object({
5933
6118
  ...loopShared,
5934
- event: z2.literal("infrastructure_retry"),
5935
- round: z2.number().int(),
5936
- failure_kind: z2.enum(["pause_comment_post", "developer_connection"]),
5937
- attempts: z2.number().int().positive(),
5938
- outcome: z2.enum(["recovered", "exhausted"])
6119
+ event: z3.literal("driver_exited"),
6120
+ task: z3.number().int(),
6121
+ reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
6122
+ last_decision: z3.string(),
6123
+ exit_code: z3.number().int().optional(),
6124
+ error_class: CodeTokenSchema.optional()
5939
6125
  }).strict()
5940
6126
  ]);
5941
- var ForgeOpSchema = z2.enum([
6127
+ var ForgeOpSchema = z3.enum([
5942
6128
  "pr.create",
5943
6129
  "pr.comment",
5944
6130
  "pr.body.replace",
@@ -5952,24 +6138,24 @@ var ForgeOpSchema = z2.enum([
5952
6138
  "label.add",
5953
6139
  "label.remove"
5954
6140
  ]);
5955
- var ForgeWriteTargetSchema = z2.object({
5956
- issue: z2.number().int().optional(),
5957
- pr: z2.number().int().optional()
6141
+ var ForgeWriteTargetSchema = z3.object({
6142
+ issue: z3.number().int().optional(),
6143
+ pr: z3.number().int().optional()
5958
6144
  }).strict();
5959
6145
  var forgeWriteShared = {
5960
6146
  meta: HeaderMetaSchema,
5961
6147
  subject: SubjectSchema,
5962
- kind: z2.literal("forge_write"),
6148
+ kind: z3.literal("forge_write"),
5963
6149
  ...envelopeTail,
5964
6150
  op: ForgeOpSchema,
5965
6151
  target: ForgeWriteTargetSchema
5966
6152
  };
5967
- var ForgeWriteEventSchema = z2.discriminatedUnion("event", [
5968
- z2.object({ ...forgeWriteShared, event: z2.literal("validated") }).strict(),
5969
- z2.object({ ...forgeWriteShared, event: z2.literal("refused"), reason: z2.string() }).strict(),
5970
- z2.object({ ...forgeWriteShared, event: z2.literal("written"), comment_ids: z2.array(z2.string()) }).strict()
6153
+ var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
6154
+ z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
6155
+ z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
6156
+ z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
5971
6157
  ]);
5972
- var GateOutcomeSchema = z2.enum([
6158
+ var GateOutcomeSchema = z3.enum([
5973
6159
  "pass",
5974
6160
  "fail",
5975
6161
  "wait",
@@ -5982,61 +6168,74 @@ var GateOutcomeSchema = z2.enum([
5982
6168
  var gateShared = {
5983
6169
  meta: HeaderMetaSchema,
5984
6170
  subject: SubjectSchema,
5985
- kind: z2.literal("gate"),
6171
+ kind: z3.literal("gate"),
5986
6172
  ...envelopeTail,
5987
- check: z2.string(),
5988
- check_version: z2.string().nullable(),
5989
- policy_version: z2.string().nullable(),
5990
- input_fingerprint: z2.string().nullable()
6173
+ check: z3.string(),
6174
+ check_version: z3.string().nullable(),
6175
+ policy_version: z3.string().nullable(),
6176
+ input_fingerprint: z3.string().nullable()
5991
6177
  };
5992
- var GateEventSchema = z2.discriminatedUnion("event", [
5993
- z2.object({
6178
+ var GateEventSchema = z3.discriminatedUnion("event", [
6179
+ z3.object({
5994
6180
  ...gateShared,
5995
- event: z2.literal("checked"),
6181
+ event: z3.literal("checked"),
5996
6182
  outcome: GateOutcomeSchema,
5997
- reason: z2.string().optional()
6183
+ reason: z3.string().optional()
6184
+ }).strict(),
6185
+ z3.object({
6186
+ meta: HeaderMetaSchema,
6187
+ subject: SubjectSchema,
6188
+ kind: z3.literal("gate"),
6189
+ ...envelopeTail,
6190
+ event: z3.literal("summary"),
6191
+ ran: z3.number().int().nonnegative(),
6192
+ passed: z3.number().int().nonnegative(),
6193
+ failed: z3.number().int().nonnegative(),
6194
+ skipped: z3.number().int().nonnegative(),
6195
+ failed_checks: z3.array(z3.string())
5998
6196
  }).strict()
5999
6197
  ]);
6000
- var OperationResultSchema = z2.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
6198
+ var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
6001
6199
  var operationShared = {
6002
6200
  meta: HeaderMetaSchema,
6003
6201
  subject: SubjectSchema,
6004
- kind: z2.literal("operation"),
6202
+ kind: z3.literal("operation"),
6005
6203
  ...envelopeTail,
6006
- operation: z2.string(),
6007
- target: z2.string().nullable()
6204
+ operation: z3.string(),
6205
+ target: z3.string().nullable()
6008
6206
  };
6009
- var OperationEventSchema = z2.discriminatedUnion("event", [
6010
- z2.object({
6207
+ var OperationEventSchema = z3.discriminatedUnion("event", [
6208
+ z3.object({
6011
6209
  ...operationShared,
6012
- event: z2.literal("completed"),
6210
+ event: z3.literal("completed"),
6013
6211
  result: OperationResultSchema,
6014
- error_class: z2.string().nullable()
6212
+ error_class: z3.string().nullable(),
6213
+ field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
6015
6214
  }).strict()
6016
6215
  ]);
6017
- var UsageUnitsSchema = z2.object({
6018
- input: z2.number().nonnegative().nullable(),
6019
- output: z2.number().nonnegative().nullable(),
6020
- cache: z2.number().nonnegative().nullable()
6216
+ var UsageUnitsSchema = z3.object({
6217
+ input: z3.number().nonnegative().nullable(),
6218
+ output: z3.number().nonnegative().nullable(),
6219
+ cache: z3.number().nonnegative().nullable()
6021
6220
  }).strict();
6022
6221
  var usageShared = {
6023
6222
  meta: HeaderMetaSchema,
6024
6223
  subject: SubjectSchema,
6025
- kind: z2.literal("usage"),
6224
+ kind: z3.literal("usage"),
6026
6225
  ...envelopeTail,
6027
- model: z2.string().nullable(),
6028
- source: z2.string(),
6029
- semantics: z2.enum(["cumulative", "delta"])
6226
+ model: z3.string().nullable(),
6227
+ source: z3.string(),
6228
+ semantics: z3.enum(["cumulative", "delta"])
6030
6229
  };
6031
- var UsageEventSchema = z2.discriminatedUnion("event", [
6032
- z2.object({
6230
+ var UsageEventSchema = z3.discriminatedUnion("event", [
6231
+ z3.object({
6033
6232
  ...usageShared,
6034
- event: z2.literal("observed"),
6233
+ event: z3.literal("observed"),
6035
6234
  units: UsageUnitsSchema,
6036
- unknown_reason: z2.string().nullable()
6235
+ unknown_reason: z3.string().nullable()
6037
6236
  }).strict()
6038
6237
  ]);
6039
- var RoleAttemptOutcomeSchema = z2.enum([
6238
+ var RoleAttemptOutcomeSchema = z3.enum([
6040
6239
  "completed",
6041
6240
  "incomplete",
6042
6241
  "infrastructure_failed",
@@ -6047,17 +6246,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
6047
6246
  var roleAttemptShared = {
6048
6247
  meta: HeaderMetaSchema,
6049
6248
  subject: SubjectSchema,
6050
- kind: z2.literal("role_attempt"),
6249
+ kind: z3.literal("role_attempt"),
6051
6250
  ...envelopeTail,
6052
- actor: z2.string().nullable(),
6053
- attempt: z2.number().int().nullable(),
6054
- effect_id: z2.string(),
6055
- model: z2.string().nullable()
6251
+ actor: z3.string().nullable(),
6252
+ attempt: z3.number().int().nullable(),
6253
+ effect_id: z3.string(),
6254
+ model: z3.string().nullable()
6056
6255
  };
6057
- var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
6058
- z2.object({
6256
+ var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
6257
+ z3.object({
6059
6258
  ...roleAttemptShared,
6060
- event: z2.literal("attempted"),
6259
+ event: z3.literal("attempted"),
6061
6260
  outcome: RoleAttemptOutcomeSchema,
6062
6261
  usage: dispatchUsageField
6063
6262
  }).strict()
@@ -6065,42 +6264,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
6065
6264
  var handoffShared = {
6066
6265
  meta: HeaderMetaSchema,
6067
6266
  subject: SubjectSchema,
6068
- kind: z2.literal("handoff"),
6267
+ kind: z3.literal("handoff"),
6069
6268
  ...envelopeTail,
6070
- class: z2.enum(["authority", "strategy", "product"]),
6071
- reason: z2.string()
6269
+ class: z3.enum(["authority", "strategy", "product"]),
6270
+ reason: z3.string()
6072
6271
  };
6073
- var HandoffEventSchema = z2.discriminatedUnion("event", [
6074
- z2.object({
6272
+ var HandoffEventSchema = z3.discriminatedUnion("event", [
6273
+ z3.object({
6075
6274
  ...handoffShared,
6076
- event: z2.literal("raised"),
6077
- requested_decision: z2.string().nullable()
6275
+ event: z3.literal("raised"),
6276
+ requested_decision: z3.string().nullable()
6078
6277
  }).strict(),
6079
- z2.object({
6278
+ z3.object({
6080
6279
  ...handoffShared,
6081
- event: z2.literal("resolved"),
6082
- resolution: z2.string().nullable(),
6083
- resolved_by: z2.string().nullable()
6280
+ event: z3.literal("resolved"),
6281
+ resolution: z3.string().nullable(),
6282
+ resolved_by: z3.string().nullable()
6084
6283
  }).strict()
6085
6284
  ]);
6086
- var EffectTargetSchema = z2.object({
6087
- kind: z2.string(),
6088
- ref: z2.string()
6285
+ var EffectTargetSchema = z3.object({
6286
+ kind: z3.string(),
6287
+ ref: z3.string()
6089
6288
  }).strict();
6090
6289
  var effectShared = {
6091
6290
  meta: HeaderMetaSchema,
6092
6291
  subject: SubjectSchema,
6093
- kind: z2.literal("effect"),
6292
+ kind: z3.literal("effect"),
6094
6293
  ...envelopeTail,
6095
- effect_id: z2.string(),
6294
+ effect_id: z3.string(),
6096
6295
  target: EffectTargetSchema
6097
6296
  };
6098
- var EffectEventSchema = z2.discriminatedUnion("event", [
6099
- z2.object({ ...effectShared, event: z2.literal("attempted") }).strict(),
6100
- z2.object({ ...effectShared, event: z2.literal("observed"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict(),
6101
- z2.object({ ...effectShared, event: z2.literal("verified"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict()
6297
+ var EffectEventSchema = z3.discriminatedUnion("event", [
6298
+ z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
6299
+ z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
6300
+ z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
6102
6301
  ]);
6103
- var LogEventSchema = z2.union([
6302
+ var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
6303
+ var customShared = {
6304
+ meta: HeaderMetaV3Schema,
6305
+ subject: SubjectSchema,
6306
+ kind: z3.literal("custom"),
6307
+ ...envelopeTail
6308
+ };
6309
+ var CustomEventSchema = z3.discriminatedUnion("event", [
6310
+ z3.object({
6311
+ ...customShared,
6312
+ event: z3.literal("recorded"),
6313
+ name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
6314
+ 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, {
6315
+ message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
6316
+ })
6317
+ }).strict()
6318
+ ]);
6319
+ var LogEventSchema = z3.union([
6104
6320
  DispatchEventSchema,
6105
6321
  DevReviewLoopEventSchema,
6106
6322
  ForgeWriteEventSchema,
@@ -6109,10 +6325,11 @@ var LogEventSchema = z2.union([
6109
6325
  UsageEventSchema,
6110
6326
  RoleAttemptEventSchema,
6111
6327
  HandoffEventSchema,
6112
- EffectEventSchema
6328
+ EffectEventSchema,
6329
+ CustomEventSchema
6113
6330
  ]);
6114
-
6115
6331
  // ../../packages/aeg-core/src/log/envelope.ts
6332
+ import { createHash as createHash5 } from "node:crypto";
6116
6333
  function isRole(value) {
6117
6334
  return value !== undefined && ROLE_VALUES.includes(value);
6118
6335
  }
@@ -6149,18 +6366,27 @@ function roundFromEnv(round) {
6149
6366
  const n = Number(round);
6150
6367
  return Number.isInteger(n) ? n : undefined;
6151
6368
  }
6369
+ function prFromEnv(pr) {
6370
+ if (pr === undefined || pr === "")
6371
+ return;
6372
+ const n = Number(pr);
6373
+ return Number.isInteger(n) && n > 0 ? n : undefined;
6374
+ }
6152
6375
  function buildHeader(input) {
6153
6376
  const role = isRole(input.env.role) ? input.env.role : "unattributed";
6154
6377
  const round = roundFromEnv(input.env.round);
6378
+ const pr = prFromEnv(input.env.pr);
6155
6379
  const subject = {
6156
6380
  issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
6157
6381
  role,
6158
6382
  ...round !== undefined ? { round } : {},
6383
+ ...pr !== undefined ? { pr } : {},
6159
6384
  ...input.subject ?? {}
6160
6385
  };
6386
+ const issue = subject.issue;
6161
6387
  return {
6162
6388
  meta: {
6163
- schema: 2,
6389
+ schema: 3,
6164
6390
  ts: input.now.toISOString(),
6165
6391
  run_id: input.runId,
6166
6392
  seq: input.seq,
@@ -6183,7 +6409,19 @@ function buildHeader(input) {
6183
6409
  ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
6184
6410
  policy_digest: input.inputVersions?.policyDigest ?? null
6185
6411
  },
6186
- provenance: provenanceFor(input)
6412
+ provenance: provenanceFor(input),
6413
+ work: {
6414
+ ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
6415
+ repo: input.repo,
6416
+ change: null,
6417
+ revision: null
6418
+ },
6419
+ flow: {
6420
+ id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
6421
+ version: lineageFieldFromEnv(input.env.flowVersion)
6422
+ },
6423
+ runtime: lineageFieldFromEnv(input.env.runtime),
6424
+ source: lineageFieldFromEnv(input.env.source)
6187
6425
  },
6188
6426
  subject
6189
6427
  };
@@ -6226,7 +6464,7 @@ function redact(value, home) {
6226
6464
  return value;
6227
6465
  }
6228
6466
  // ../../packages/aeg-core/src/log/store.ts
6229
- var KNOWN_SCHEMA_VERSIONS = [1, 2];
6467
+ var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
6230
6468
  function metaOf(obj) {
6231
6469
  if (obj === null || typeof obj !== "object")
6232
6470
  return null;
@@ -6292,7 +6530,7 @@ function classifyStoredLine(raw, home) {
6292
6530
  return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
6293
6531
  }
6294
6532
  const redacted = redact(event, home);
6295
- const provenance = version === 2 ? event.meta.provenance ?? null : null;
6533
+ const provenance = version >= 2 ? event.meta.provenance ?? null : null;
6296
6534
  return {
6297
6535
  status: "ok",
6298
6536
  identity,
@@ -6305,138 +6543,143 @@ function classifyStoredLine(raw, home) {
6305
6543
  };
6306
6544
  }
6307
6545
  // ../../packages/aeg-core/src/control-store/records.ts
6308
- import { z as z3 } from "zod";
6309
- var isoTimestamp = z3.string().min(1);
6310
- var taskId = z3.number().int().positive();
6311
- var epochNumber = z3.number().int().nonnegative();
6312
- var RunRecordSchema = z3.object({
6313
- version: z3.literal(1),
6314
- kind: z3.literal("run"),
6546
+ import { z as z4 } from "zod";
6547
+ var isoTimestamp = z4.string().min(1);
6548
+ var taskId = z4.number().int().positive();
6549
+ var epochNumber = z4.number().int().nonnegative();
6550
+ var RunRecordSchema = z4.object({
6551
+ version: z4.literal(1),
6552
+ kind: z4.literal("run"),
6315
6553
  task: taskId,
6316
- runId: z3.string().min(1),
6317
- pid: z3.number().int().positive(),
6318
- host: z3.string().min(1),
6554
+ runId: z4.string().min(1),
6555
+ pid: z4.number().int().positive(),
6556
+ host: z4.string().min(1),
6319
6557
  startedAt: isoTimestamp,
6320
- childStartedAt: z3.string().min(1).nullable().optional(),
6321
- childCommand: z3.string().min(1).nullable().optional()
6558
+ childStartedAt: z4.string().min(1).nullable().optional(),
6559
+ childCommand: z4.string().min(1).nullable().optional()
6322
6560
  }).strict();
6323
- var InputRecordSchema = z3.object({
6324
- version: z3.literal(1),
6325
- kind: z3.literal("input"),
6561
+ var InputRecordSchema = z4.object({
6562
+ version: z4.literal(1),
6563
+ kind: z4.literal("input"),
6326
6564
  task: taskId,
6327
- runId: z3.string().min(1),
6328
- source: z3.union([z3.literal("fresh"), z3.literal("resume")]),
6329
- pr: z3.number().int().positive().nullable(),
6330
- round: z3.number().int().nonnegative(),
6565
+ runId: z4.string().min(1),
6566
+ source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
6567
+ pr: z4.number().int().positive().nullable(),
6568
+ round: z4.number().int().nonnegative(),
6331
6569
  recordedAt: isoTimestamp
6332
6570
  }).strict();
6333
- var OwnershipRecordSchema = z3.object({
6334
- version: z3.literal(1),
6335
- kind: z3.literal("ownership"),
6571
+ var OwnershipRecordSchema = z4.object({
6572
+ version: z4.literal(1),
6573
+ kind: z4.literal("ownership"),
6336
6574
  task: taskId,
6337
6575
  epoch: epochNumber,
6338
- ownerId: z3.string().min(1),
6339
- pid: z3.number().int().positive(),
6340
- host: z3.string().min(1),
6576
+ ownerId: z4.string().min(1),
6577
+ pid: z4.number().int().positive(),
6578
+ host: z4.string().min(1),
6341
6579
  acquiredAt: isoTimestamp
6342
6580
  }).strict();
6343
- var TransitionRecordSchema = z3.object({
6344
- version: z3.literal(1),
6345
- kind: z3.literal("transition"),
6581
+ var TransitionRecordSchema = z4.object({
6582
+ version: z4.literal(1),
6583
+ kind: z4.literal("transition"),
6346
6584
  task: taskId,
6347
6585
  epoch: epochNumber,
6348
- seq: z3.number().int().nonnegative(),
6349
- from: z3.string().min(1),
6350
- to: z3.string().min(1),
6351
- detail: z3.string().optional(),
6586
+ seq: z4.number().int().nonnegative(),
6587
+ from: z4.string().min(1),
6588
+ to: z4.string().min(1),
6589
+ detail: z4.string().optional(),
6352
6590
  at: isoTimestamp
6353
6591
  }).strict();
6354
- var ManifestRecordSchema = z3.object({
6355
- version: z3.literal(1),
6356
- kind: z3.literal("manifest"),
6592
+ var ManifestRecordSchema = z4.object({
6593
+ version: z4.literal(1),
6594
+ kind: z4.literal("manifest"),
6357
6595
  task: taskId,
6358
6596
  round: epochNumber,
6359
- repository: z3.string().min(1),
6360
- pr: z3.number().int().positive(),
6361
- branch: z3.string().min(1),
6362
- baseSha: z3.string().min(1).nullable(),
6363
- headSha: z3.string().min(1),
6364
- briefHash: z3.string().min(1).nullable(),
6365
- objectivesVersion: z3.string().min(1).nullable(),
6597
+ repository: z4.string().min(1),
6598
+ pr: z4.number().int().positive(),
6599
+ branch: z4.string().min(1),
6600
+ baseSha: z4.string().min(1).nullable(),
6601
+ headSha: z4.string().min(1),
6602
+ briefHash: z4.string().min(1).nullable(),
6603
+ objectivesVersion: z4.string().min(1).nullable(),
6366
6604
  rulingOrdinal: epochNumber,
6367
- policyDigest: z3.string().min(1),
6605
+ policyDigest: z4.string().min(1),
6368
6606
  recordedAt: isoTimestamp
6369
6607
  }).strict();
6370
- var roundHeadIdentity = z3.object({ round: z3.number().int().positive(), head: z3.string().min(1) }).strict();
6371
- var LoopBudgetsSchema = z3.object({
6372
- mechanicalRetries: z3.number().int().nonnegative(),
6373
- reviewRounds: z3.number().int().nonnegative(),
6374
- infrastructureRetries: z3.number().int().nonnegative()
6608
+ var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
6609
+ var LoopBudgetsSchema = z4.object({
6610
+ mechanicalRetries: z4.number().int().nonnegative(),
6611
+ reviewRounds: z4.number().int().nonnegative(),
6612
+ infrastructureRetries: z4.number().int().nonnegative()
6375
6613
  }).strict();
6376
- var LoopStateRecordSchema = z3.object({
6377
- version: z3.literal(1),
6378
- kind: z3.literal("loop_state"),
6614
+ var LoopStateRecordSchema = z4.object({
6615
+ version: z4.literal(1),
6616
+ kind: z4.literal("loop_state"),
6379
6617
  task: taskId,
6380
- round: z3.number().int().positive(),
6381
- phase: z3.string().min(1),
6382
- pauseReason: z3.string().min(1).nullable(),
6618
+ round: z4.number().int().positive(),
6619
+ phase: z4.string().min(1),
6620
+ pauseReason: z4.string().min(1).nullable(),
6383
6621
  budgets: LoopBudgetsSchema,
6384
6622
  heldResult: roundHeadIdentity.nullable(),
6385
6623
  deliveredFindings: roundHeadIdentity.nullable(),
6386
- repeatMemory: z3.object({
6387
- blockingFindings: z3.array(z3.string()),
6388
- lastFailure: z3.object({ signature: z3.string(), message: z3.string() }).nullable()
6624
+ repeatMemory: z4.object({
6625
+ blockingFindings: z4.array(z4.string()),
6626
+ lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
6389
6627
  }).strict().optional(),
6628
+ publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
6629
+ taskStartedAt: isoTimestamp.optional(),
6630
+ phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
6390
6631
  recordedAt: isoTimestamp
6391
6632
  }).strict();
6392
- var EffectRecordSchema = z3.object({
6393
- version: z3.literal(1),
6394
- kind: z3.literal("effect"),
6633
+ var EffectRecordSchema = z4.object({
6634
+ version: z4.literal(1),
6635
+ kind: z4.literal("effect"),
6395
6636
  task: taskId,
6396
- key: z3.string().min(1),
6397
- operation: z3.string().min(1),
6398
- target: z3.string().min(1),
6399
- inputVersion: z3.number().int().nonnegative(),
6400
- payloadDigest: z3.string().min(1),
6401
- status: z3.union([z3.literal("started"), z3.literal("verified"), z3.literal("uncertain")]),
6402
- url: z3.string().optional(),
6637
+ key: z4.string().min(1),
6638
+ operation: z4.string().min(1),
6639
+ target: z4.string().min(1),
6640
+ inputVersion: z4.number().int().nonnegative(),
6641
+ payloadDigest: z4.string().min(1),
6642
+ status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
6643
+ url: z4.string().optional(),
6403
6644
  recordedAt: isoTimestamp
6404
6645
  }).strict();
6405
- var EscalationRecordSchema = z3.object({
6406
- version: z3.literal(1),
6407
- kind: z3.literal("escalation"),
6646
+ var EscalationRecordSchema = z4.object({
6647
+ version: z4.literal(1),
6648
+ kind: z4.literal("escalation"),
6408
6649
  task: taskId,
6409
- escalationId: z3.string().min(1),
6650
+ escalationId: z4.string().min(1),
6410
6651
  round: epochNumber,
6411
- head: z3.string().min(1),
6412
- branch: z3.string().min(1),
6413
- pr: z3.number().int().positive().nullable(),
6414
- runId: z3.string().min(1),
6415
- pid: z3.number().int().positive(),
6416
- host: z3.string().min(1),
6417
- agent: z3.string().min(1).optional(),
6418
- reason: z3.string().min(1),
6419
- detail: z3.string().optional(),
6420
- evidence: z3.string().optional(),
6421
- attemptedRecovery: z3.string().min(1),
6422
- requestedDecision: z3.string().min(1),
6423
- recipient: z3.string().min(1),
6424
- briefHash: z3.string().min(1).nullable(),
6425
- objectivesVersion: z3.string().min(1).nullable(),
6652
+ head: z4.string().min(1),
6653
+ branch: z4.string().min(1),
6654
+ pr: z4.number().int().positive().nullable(),
6655
+ runId: z4.string().min(1),
6656
+ pid: z4.number().int().positive(),
6657
+ host: z4.string().min(1),
6658
+ agent: z4.string().min(1).optional(),
6659
+ reason: z4.string().min(1),
6660
+ detail: z4.string().optional(),
6661
+ evidence: z4.string().optional(),
6662
+ attemptedRecovery: z4.string().min(1),
6663
+ requestedDecision: z4.string().min(1),
6664
+ recipient: z4.string().min(1),
6665
+ briefHash: z4.string().min(1).nullable(),
6666
+ objectivesVersion: z4.string().min(1).nullable(),
6426
6667
  rulingOrdinal: epochNumber,
6427
- policyDigest: z3.string().min(1),
6668
+ policyDigest: z4.string().min(1),
6428
6669
  recordedAt: isoTimestamp
6429
6670
  }).strict();
6430
- var ResolutionRecordSchema = z3.object({
6431
- version: z3.literal(1),
6432
- kind: z3.literal("resolution"),
6671
+ var ResolutionRecordSchema = z4.object({
6672
+ version: z4.literal(1),
6673
+ kind: z4.literal("resolution"),
6433
6674
  task: taskId,
6434
- escalationId: z3.string().min(1),
6435
- decision: z3.union([z3.literal("resume"), z3.literal("cancel")]),
6436
- authenticatedBy: z3.string().min(1),
6437
- authenticatedFrom: z3.string().min(1),
6675
+ escalationId: z4.string().min(1),
6676
+ decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
6677
+ authenticatedBy: z4.string().min(1),
6678
+ authenticatedFrom: z4.string().min(1),
6438
6679
  consumedAt: isoTimestamp
6439
6680
  }).strict();
6681
+ // ../../packages/aeg-core/src/control-store/local.ts
6682
+ var CONTROL_AREA_DIRNAME = "control";
6440
6683
  // src/checks/contract.ts
6441
6684
  var CHECK_SCHEMA_VERSION = 1;
6442
6685
  function emitCheckError(error) {
@@ -6448,56 +6691,34 @@ function emitCheckError(error) {
6448
6691
  import { dirname as dirname2, isAbsolute as isAbsolute2, join as join2, resolve as resolve2, sep } from "node:path";
6449
6692
 
6450
6693
  // src/lib/config.ts
6451
- import { execFile as execFile4, execFileSync as execFileSync3 } from "node:child_process";
6694
+ import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
6452
6695
  import { promisify as promisify4 } from "node:util";
6453
6696
  import { existsSync, mkdirSync, readFileSync as readFileSync2, realpathSync, writeFileSync } from "node:fs";
6454
6697
  import { homedir } from "node:os";
6455
6698
  import { dirname, isAbsolute, join, resolve } from "node:path";
6456
- import { z as z4 } from "zod";
6699
+ import { z as z5 } from "zod";
6457
6700
 
6458
6701
  // src/lib/agent-vendors.ts
6459
6702
  var AGENT_VENDORS = ["skills", "claude", "gemini"];
6460
6703
 
6461
- // src/lib/worker-boundary.ts
6462
- import { execFileSync as execFileSync2 } from "node:child_process";
6463
- var LOG_HEADER_KEYCHAIN_SERVICE = "Vinaya Log";
6464
- var logHeaderKeychainCache = new Map;
6465
- function readRealLogHeaderKeychainCredential(variable) {
6466
- if (process.platform !== "darwin")
6467
- return null;
6468
- try {
6469
- return execFileSync2("/usr/bin/security", ["find-generic-password", "-s", LOG_HEADER_KEYCHAIN_SERVICE, "-a", variable, "-w"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5000, maxBuffer: 1024 * 1024 }).replace(/\n$/, "");
6470
- } catch {
6471
- return null;
6472
- }
6473
- }
6474
- function readLogHeaderKeychainCredential(variable) {
6475
- const cached = logHeaderKeychainCache.get(variable);
6476
- if (cached !== undefined)
6477
- return cached;
6478
- const value = readRealLogHeaderKeychainCredential(variable);
6479
- logHeaderKeychainCache.set(variable, value);
6480
- return value;
6481
- }
6482
-
6483
6704
  // src/lib/config.ts
6484
- var EnvEntrySchema = z4.union([
6485
- z4.literal(true),
6486
- z4.object({ optional: z4.literal(true) }),
6487
- z4.object({ anyOf: z4.array(z4.string()).min(2) }),
6488
- z4.string()
6705
+ var EnvEntrySchema = z5.union([
6706
+ z5.literal(true),
6707
+ z5.object({ optional: z5.literal(true) }),
6708
+ z5.object({ anyOf: z5.array(z5.string()).min(2) }),
6709
+ z5.string()
6489
6710
  ]);
6490
- var CheckEntrySchema = z4.object({
6491
- run: z4.string(),
6492
- scope: z4.enum(["diff", "full"]),
6493
- include: z4.array(z4.string()).optional(),
6494
- args: z4.array(z4.string()).optional(),
6495
- timeoutMs: z4.number().optional(),
6496
- env: z4.record(z4.string(), EnvEntrySchema).optional(),
6497
- requiresOpenPr: z4.boolean().optional(),
6498
- ownWorkflow: z4.boolean().optional(),
6499
- principalOwed: z4.literal(true).optional(),
6500
- validates: z4.enum(["body", "issue"]).optional()
6711
+ var CheckEntrySchema = z5.object({
6712
+ run: z5.string(),
6713
+ scope: z5.enum(["diff", "full"]),
6714
+ include: z5.array(z5.string()).optional(),
6715
+ args: z5.array(z5.string()).optional(),
6716
+ timeoutMs: z5.number().optional(),
6717
+ env: z5.record(z5.string(), EnvEntrySchema).optional(),
6718
+ requiresOpenPr: z5.boolean().optional(),
6719
+ ownWorkflow: z5.boolean().optional(),
6720
+ principalOwed: z5.literal(true).optional(),
6721
+ validates: z5.enum(["body", "issue"]).optional()
6501
6722
  }).superRefine((entry, ctx) => {
6502
6723
  if (!entry.env)
6503
6724
  return;
@@ -6507,22 +6728,22 @@ var CheckEntrySchema = z4.object({
6507
6728
  const members = value.anyOf;
6508
6729
  if (new Set(members).size !== members.length) {
6509
6730
  ctx.addIssue({
6510
- code: z4.ZodIssueCode.custom,
6731
+ code: z5.ZodIssueCode.custom,
6511
6732
  message: `env.${key}.anyOf has duplicate members`,
6512
6733
  path: ["env", key, "anyOf"]
6513
6734
  });
6514
6735
  }
6515
6736
  if (!members.includes(key)) {
6516
6737
  ctx.addIssue({
6517
- code: z4.ZodIssueCode.custom,
6738
+ code: z5.ZodIssueCode.custom,
6518
6739
  message: `env.${key}.anyOf must include "${key}" itself as a member`,
6519
6740
  path: ["env", key, "anyOf"]
6520
6741
  });
6521
6742
  }
6522
6743
  }
6523
6744
  });
6524
- var RoleEntrySchema = z4.object({
6525
- contract: z4.string().refine((p) => p.includes("/"), {
6745
+ var RoleEntrySchema = z5.object({
6746
+ contract: z5.string().refine((p) => p.includes("/"), {
6526
6747
  message: 'must be a path (contain at least one "/"), not a bare filename'
6527
6748
  })
6528
6749
  });
@@ -6546,17 +6767,17 @@ var BRIEF_BUILTINS = [
6546
6767
  "briefSections",
6547
6768
  "milestoneShape"
6548
6769
  ];
6549
- var BriefSectionSchema = z4.union([
6550
- z4.object({ builtin: z4.enum(BRIEF_BUILTINS) }),
6551
- z4.object({ heading: z4.string().min(1), name: z4.string().optional() }),
6552
- z4.object({ field: z4.string().min(1), name: z4.string().optional() }),
6553
- z4.object({ phrase: z4.string().min(1), name: z4.string().optional() })
6770
+ var BriefSectionSchema = z5.union([
6771
+ z5.object({ builtin: z5.enum(BRIEF_BUILTINS) }),
6772
+ z5.object({ heading: z5.string().min(1), name: z5.string().optional() }),
6773
+ z5.object({ field: z5.string().min(1), name: z5.string().optional() }),
6774
+ z5.object({ phrase: z5.string().min(1), name: z5.string().optional() })
6554
6775
  ]);
6555
- var BriefSchemaSchema = z4.object({
6556
- pr: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
6557
- issue: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
6558
- milestone: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
6559
- ack: z4.array(z4.enum(BRIEF_BUILTINS)).optional()
6776
+ var BriefSchemaSchema = z5.object({
6777
+ pr: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
6778
+ issue: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
6779
+ milestone: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
6780
+ ack: z5.array(z5.enum(BRIEF_BUILTINS)).optional()
6560
6781
  });
6561
6782
  function isSafeRepoRelPath(p) {
6562
6783
  if (p.length === 0)
@@ -6565,7 +6786,7 @@ function isSafeRepoRelPath(p) {
6565
6786
  return false;
6566
6787
  return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
6567
6788
  }
6568
- var SafeRepoRelPath = z4.string().refine(isSafeRepoRelPath, {
6789
+ var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
6569
6790
  message: "must be a repo-root-relative path with no `..` segment or absolute root"
6570
6791
  });
6571
6792
  var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
@@ -6575,22 +6796,22 @@ function isCanonicalHookBlockPath(p) {
6575
6796
  var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
6576
6797
  message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
6577
6798
  });
6578
- var ManagedBlockRecordSchema = z4.object({
6799
+ var ManagedBlockRecordSchema = z5.object({
6579
6800
  path: ManagedHookBlockPath,
6580
- marker: z4.string(),
6581
- comment: z4.enum(["hash", "html"])
6801
+ marker: z5.string(),
6802
+ comment: z5.enum(["hash", "html"])
6582
6803
  });
6583
- var ManagedManifestSchema = z4.object({
6584
- version: z4.number().int().positive(),
6585
- files: z4.array(SafeRepoRelPath),
6586
- blocks: z4.array(ManagedBlockRecordSchema),
6587
- labels: z4.array(z4.string()),
6588
- agents: z4.array(z4.enum(AGENT_VENDORS)).optional()
6804
+ var ManagedManifestSchema = z5.object({
6805
+ version: z5.number().int().positive(),
6806
+ files: z5.array(SafeRepoRelPath),
6807
+ blocks: z5.array(ManagedBlockRecordSchema),
6808
+ labels: z5.array(z5.string()),
6809
+ agents: z5.array(z5.enum(AGENT_VENDORS)).optional()
6589
6810
  });
6590
- var ProjectEntrySchema = z4.object({
6591
- name: z4.string().min(1),
6592
- description: z4.string().min(1).optional(),
6593
- path: z4.string().min(1).optional()
6811
+ var ProjectEntrySchema = z5.object({
6812
+ name: z5.string().min(1),
6813
+ description: z5.string().min(1).optional(),
6814
+ path: z5.string().min(1).optional()
6594
6815
  });
6595
6816
  function parseTokensCollectDeclaration(value) {
6596
6817
  const m = value.trim().match(/^(\S+)\s+(\S+)$/);
@@ -6601,90 +6822,97 @@ function parseTokensCollectDeclaration(value) {
6601
6822
  return null;
6602
6823
  return { interpreter, script };
6603
6824
  }
6604
- var VinayaConfigSchema = z4.object({
6605
- rings: z4.object({
6606
- ring1_forgeWriteInterception: z4.boolean(),
6607
- ring2_asyncAudits: z4.boolean()
6825
+ var VinayaConfigSchema = z5.object({
6826
+ rings: z5.object({
6827
+ ring1_forgeWriteInterception: z5.boolean(),
6828
+ ring2_asyncAudits: z5.boolean()
6608
6829
  }).optional(),
6609
- checks: z4.record(z4.string(), CheckEntrySchema).optional(),
6610
- roles: z4.record(z4.string(), RoleEntrySchema).optional(),
6830
+ checks: z5.record(z5.string(), CheckEntrySchema).optional(),
6831
+ roles: z5.record(z5.string(), RoleEntrySchema).optional(),
6611
6832
  briefSchema: BriefSchemaSchema.optional(),
6612
6833
  managed: ManagedManifestSchema.optional(),
6613
- principals: z4.array(z4.string()).min(1).optional(),
6614
- releaseActor: z4.string().min(1).optional(),
6615
- ci: z4.object({ setup: z4.string().min(1) }).optional(),
6616
- tokens: z4.object({
6617
- collect: z4.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
6834
+ principals: z5.array(z5.string()).min(1).optional(),
6835
+ releaseActor: z5.string().min(1).optional(),
6836
+ ci: z5.object({ setup: z5.string().min(1) }).optional(),
6837
+ tokens: z5.object({
6838
+ collect: z5.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
6618
6839
  message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
6619
6840
  })
6620
6841
  }).optional(),
6621
- blastRadius: z4.object({ extraDomains: z4.array(z4.string()).optional() }).optional(),
6622
- proseGates: z4.object({
6623
- doctrineRoot: z4.string().min(1).optional(),
6624
- readerFacingPrefix: z4.string().min(1).optional(),
6625
- readerFacingSuffix: z4.string().min(1).optional(),
6626
- legacySlugDir: z4.string().min(1).optional(),
6627
- sourceComments: z4.object({
6628
- globs: z4.array(z4.string().min(1)).optional(),
6629
- allowlist: z4.array(z4.string().min(1)).optional(),
6630
- severity: z4.enum(["warning", "error"]).optional()
6842
+ blastRadius: z5.object({ extraDomains: z5.array(z5.string()).optional() }).optional(),
6843
+ proseGates: z5.object({
6844
+ doctrineRoot: z5.string().min(1).optional(),
6845
+ readerFacingPrefix: z5.string().min(1).optional(),
6846
+ readerFacingSuffix: z5.string().min(1).optional(),
6847
+ legacySlugDir: z5.string().min(1).optional(),
6848
+ sourceComments: z5.object({
6849
+ globs: z5.array(z5.string().min(1)).optional(),
6850
+ allowlist: z5.array(z5.string().min(1)).optional(),
6851
+ severity: z5.enum(["warning", "error"]).optional()
6631
6852
  }).optional(),
6632
- specGrandfather: z4.array(z4.string().min(1)).optional(),
6633
- specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
6853
+ specGrandfather: z5.union([z5.array(z5.string().min(1)), z5.record(z5.string().min(1), z5.number().int().min(0))]).optional(),
6854
+ specPaths: z5.array(z5.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
6634
6855
  message: "must be a repository-relative path, not an absolute one"
6635
6856
  }).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
6636
6857
  message: "must stay inside the repository — no `..` segment"
6637
6858
  })).optional()
6638
6859
  }).optional(),
6639
- projects: z4.array(ProjectEntrySchema).optional(),
6640
- dispatch: z4.object({
6641
- timeoutMs: z4.number().int().positive().optional(),
6642
- killGraceMs: z4.number().int().positive().optional(),
6643
- agent: z4.enum(["claude", "codex", "gemini"]).optional(),
6644
- requireWorkerIsolation: z4.boolean().optional()
6860
+ projects: z5.array(ProjectEntrySchema).optional(),
6861
+ dispatch: z5.object({
6862
+ timeoutMs: z5.number().int().positive().optional(),
6863
+ killGraceMs: z5.number().int().positive().optional(),
6864
+ agent: z5.enum(["claude", "codex", "gemini"]).optional()
6865
+ }).optional(),
6866
+ reviewPolicy: z5.object({
6867
+ codeReviewThreshold: z5.string().min(1).optional(),
6868
+ securityThreshold: z5.string().min(1).optional(),
6869
+ maxRounds: z5.number().optional(),
6870
+ maxTaskMinutes: z5.number().optional()
6645
6871
  }).optional(),
6646
- reviewPolicy: z4.object({
6647
- codeReviewThreshold: z4.string().min(1).optional(),
6648
- securityThreshold: z4.string().min(1).optional(),
6649
- maxRounds: z4.number().optional()
6872
+ securityScan: z5.object({
6873
+ command: z5.array(z5.string().min(1)).min(1)
6650
6874
  }).optional(),
6651
- gateCutovers: z4.object({
6652
- objectivesSinceIssue: z4.number().int().nonnegative().optional(),
6653
- briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
6654
- documentationSinceIssue: z4.number().int().nonnegative().optional(),
6655
- briefRulesSincePr: z4.number().int().nonnegative().optional(),
6656
- agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
6875
+ gateCutovers: z5.object({
6876
+ objectivesSinceIssue: z5.number().int().nonnegative().optional(),
6877
+ briefSectionsSinceIssue: z5.number().int().nonnegative().optional(),
6878
+ documentationSinceIssue: z5.number().int().nonnegative().optional(),
6879
+ briefRulesSincePr: z5.number().int().nonnegative().optional(),
6880
+ agentBoxesRefusedSincePr: z5.number().int().nonnegative().optional()
6657
6881
  }).optional(),
6658
- planning: z4.object({
6659
- collisionThreshold: z4.number().int().nonnegative().optional()
6882
+ planning: z5.object({
6883
+ collisionThreshold: z5.number().int().nonnegative().optional()
6660
6884
  }).optional(),
6661
- prePush: z4.object({
6662
- alwaysRun: z4.array(z4.string()).optional()
6885
+ prePush: z5.object({
6886
+ alwaysRun: z5.array(z5.string()).optional()
6663
6887
  }).optional(),
6664
- report: z4.object({
6665
- commandTimeoutMs: z4.number().int().positive().optional()
6888
+ report: z5.object({
6889
+ commandTimeoutMs: z5.number().int().positive().optional()
6666
6890
  }).superRefine((report, ctx) => {
6667
6891
  const commandTimeoutMs = report.commandTimeoutMs;
6668
6892
  if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
6669
6893
  ctx.addIssue({
6670
- code: z4.ZodIssueCode.custom,
6894
+ code: z5.ZodIssueCode.custom,
6671
6895
  path: ["commandTimeoutMs"],
6672
6896
  message: "must be at most 3600000 (1 hour)"
6673
6897
  });
6674
6898
  }
6675
6899
  }).optional(),
6676
- logPublish: z4.unknown().refine((v) => v === undefined, {
6900
+ logPublish: z5.unknown().refine((v) => v === undefined, {
6677
6901
  message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
6678
6902
  }),
6679
- runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
6680
- logs: z4.object({
6681
- folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
6682
- url: z4.string().url().optional(),
6683
- headers: z4.record(z4.string()).optional()
6903
+ runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
6904
+ logs: z5.object({
6905
+ folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
6906
+ url: z5.string().url().optional(),
6907
+ headers: z5.record(z5.string()).optional(),
6908
+ readHeaders: z5.record(z5.string()).optional(),
6909
+ events: CustomEventDeclarationsSchema.optional()
6684
6910
  }).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
6685
6911
  message: "logs: set at most one of folder/url"
6686
6912
  }).refine((v) => v.headers === undefined || v.url !== undefined, {
6687
6913
  message: "logs: headers requires url"
6914
+ }).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
6915
+ message: "logs: readHeaders requires url"
6688
6916
  }).optional()
6689
6917
  });
6690
6918
  var GLOBAL_VINAYA_HOME = join(homedir(), ".vinaya");
@@ -6789,10 +7017,15 @@ function resolveReviewPolicy(config) {
6789
7017
  if (!Number.isInteger(maxRounds) || maxRounds < 1) {
6790
7018
  throw new Error(`vinaya.config.json: reviewPolicy.maxRounds "${maxRounds}" is not a positive integer — fix the config, this never falls back to a default.`);
6791
7019
  }
7020
+ const maxTaskMinutes = raw.maxTaskMinutes ?? DEFAULT_REVIEW_POLICY.maxTaskMinutes;
7021
+ if (!Number.isInteger(maxTaskMinutes) || maxTaskMinutes < 0) {
7022
+ throw new Error(`vinaya.config.json: reviewPolicy.maxTaskMinutes "${maxTaskMinutes}" is not a non-negative integer (0 turns the budget off) — fix the config, this never falls back to a default.`);
7023
+ }
6792
7024
  return {
6793
7025
  codeReviewThreshold,
6794
7026
  securityThreshold,
6795
- maxRounds
7027
+ maxRounds,
7028
+ maxTaskMinutes
6796
7029
  };
6797
7030
  }
6798
7031
  function resolveGateCutovers(config) {
@@ -6832,17 +7065,12 @@ function resolveTrustAnchorLogsDestination(local, trustAnchorConfig) {
6832
7065
  return "url" in anchored && anchored.url === local.url ? anchored : null;
6833
7066
  return "folder" in anchored && anchored.folder === local.folder ? anchored : null;
6834
7067
  }
6835
- function resolveLogsHeaderValues(headers, env, readKeychain = readLogHeaderKeychainCredential) {
7068
+ function resolveLogsHeaderValues(headers, env) {
6836
7069
  if (!headers)
6837
7070
  return;
6838
7071
  const resolved = {};
6839
7072
  for (const [key, value] of Object.entries(headers)) {
6840
- resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => {
6841
- const fromEnv = env[name];
6842
- if (fromEnv !== undefined)
6843
- return fromEnv;
6844
- return readKeychain(name) ?? "";
6845
- });
7073
+ resolved[key] = value.replace(/\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g, (_match, name) => env[name] ?? "");
6846
7074
  }
6847
7075
  return resolved;
6848
7076
  }
@@ -6851,7 +7079,7 @@ function trustAnchorRepo() {
6851
7079
  if (fromRunner)
6852
7080
  return fromRunner;
6853
7081
  try {
6854
- const url = execFileSync3("git", ["remote", "get-url", "origin"], {
7082
+ const url = execFileSync2("git", ["remote", "get-url", "origin"], {
6855
7083
  encoding: "utf-8",
6856
7084
  stdio: ["ignore", "pipe", "pipe"]
6857
7085
  });
@@ -6898,7 +7126,7 @@ function resolveCiTrustAnchorProbeRef(env = process.env) {
6898
7126
  return ref;
6899
7127
  }
6900
7128
  function readTrustAnchorConfigAtRef(ref) {
6901
- const raw = execFileSync3("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
7129
+ const raw = execFileSync2("git", ["show", `${ref}:${LOCAL_CONFIG_FILENAME}`], {
6902
7130
  encoding: "utf-8",
6903
7131
  stdio: ["ignore", "pipe", "pipe"],
6904
7132
  timeout: 1e4
@@ -6912,7 +7140,7 @@ function ghFetchTrustAnchorConfig() {
6912
7140
  const repo = trustAnchorRepo();
6913
7141
  if (!repo)
6914
7142
  throw new Error("could not resolve repo identity for the trust-anchor read");
6915
- return execFileSync3("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
7143
+ return execFileSync2("gh", ["api", `repos/${repo}/contents/${LOCAL_CONFIG_FILENAME}`, "--jq", ".content"], {
6916
7144
  encoding: "utf-8",
6917
7145
  stdio: ["ignore", "pipe", "pipe"]
6918
7146
  });