@attalabs/vinaya 0.35.0 → 0.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/README.md +6 -6
  2. package/aeg-root/contracts/developer-reviewer.md +1 -1
  3. package/aeg-root/contracts/planner-operator.md +1 -1
  4. package/aeg-root/contracts/principal-operator.md +6 -6
  5. package/aeg-root/contracts/security-archivist.md +1 -1
  6. package/aeg-root/enforcement.md +9 -10
  7. package/aeg-root/process.md +3 -1
  8. package/aeg-root/roles/archivist.md +2 -2
  9. package/aeg-root/roles/developer/reference.md +13 -16
  10. package/aeg-root/roles/developer.md +7 -3
  11. package/aeg-root/roles/operator.md +18 -18
  12. package/aeg-root/roles/planner/reference.md +23 -8
  13. package/aeg-root/roles/planner.md +2 -0
  14. package/aeg-root/roles/principal.md +6 -1
  15. package/aeg-root/roles/reviewer.md +11 -3
  16. package/aeg-root/roles/security.md +19 -9
  17. package/aeg-root/roles/tranche-archivist.md +14 -2
  18. package/aeg-root/state-machine.md +11 -10
  19. package/aeg-root/templates/brief-template.md +10 -4
  20. package/aeg-root/templates/pr-report-template.md +1 -9
  21. package/aeg-root/tranche-model.md +4 -4
  22. package/dist/checks/bin/check-body-bare-digits.js +2081 -1883
  23. package/dist/checks/bin/check-branch-topology.js +1376 -1139
  24. package/dist/checks/bin/check-brief-shape.js +2081 -1883
  25. package/dist/checks/bin/check-changeset-coverage.js +2564 -2025
  26. package/dist/checks/bin/check-closes-n.js +1376 -1139
  27. package/dist/checks/bin/check-coherence.js +1480 -1228
  28. package/dist/checks/bin/check-dead-branch-push.js +1339 -1156
  29. package/dist/checks/bin/check-dispatch-readiness.js +1480 -1228
  30. package/dist/checks/bin/check-doc-coverage-push.js +2563 -2024
  31. package/dist/checks/bin/check-doc-coverage.js +2565 -2026
  32. package/dist/checks/bin/check-doctrine-no-procedures.js +2081 -1883
  33. package/dist/checks/bin/check-doctrine-portability.js +2563 -2024
  34. package/dist/checks/bin/check-evidence-fresh.js +1906 -1536
  35. package/dist/checks/bin/check-exec-bits.js +2136 -1597
  36. package/dist/checks/bin/check-first-push-dispatch.js +1480 -1228
  37. package/dist/checks/bin/check-issue-assignment.js +1376 -1139
  38. package/dist/checks/bin/check-issue-milestone-attach.js +1339 -1156
  39. package/dist/checks/bin/check-issue-objectives-numbering.js +2081 -1883
  40. package/dist/checks/bin/check-issue-parts-coverage.js +1339 -1156
  41. package/dist/checks/bin/check-issue-surface-globs.js +1488 -1227
  42. package/dist/checks/bin/check-issue-title-grammar.js +1339 -1156
  43. package/dist/checks/bin/check-issue-tranche-label.js +1339 -1156
  44. package/dist/checks/bin/check-main-branch-refusal.js +1342 -1159
  45. package/dist/checks/bin/check-no-disk-state.js +1342 -1159
  46. package/dist/checks/bin/check-pr-premise-reassert.js +2081 -1883
  47. package/dist/checks/bin/check-pr-report-density.js +1342 -1159
  48. package/dist/checks/bin/check-principal-test-plan-wait.js +1342 -1159
  49. package/dist/checks/bin/check-quoted-command.js +4063 -3526
  50. package/dist/checks/bin/check-reader-resolvable-prose.js +4082 -3533
  51. package/dist/checks/bin/check-registry-gates.js +1363 -1167
  52. package/dist/checks/bin/check-retired-vocabulary.js +4057 -3520
  53. package/dist/checks/bin/check-review-gate.js +2081 -1883
  54. package/dist/checks/bin/check-single-plan-pr.js +1339 -1156
  55. package/dist/checks/bin/check-surface-scope.js +1376 -1139
  56. package/dist/checks/bin/check-test-plan.js +1339 -1156
  57. package/dist/checks/bin/check-token-collection-wired.js +1342 -1159
  58. package/dist/checks/bin/check-token-report.js +1409 -1342
  59. package/dist/checks/bin/check-workspace-escape.js +2562 -2023
  60. package/dist/index.js +14171 -6490
  61. package/dist/lib/pre-push-cache-test-run.js +1044 -641
  62. package/dist/lib/pre-push-select-tests.js +641 -444
  63. package/package.json +2 -2
  64. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/brief-render.ts +38 -0
  65. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/control-store/records.ts +19 -0
  66. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/assess-round.ts +257 -10
  67. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/fakes.ts +7 -2
  68. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/index.ts +2 -0
  69. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/render-summary.ts +69 -11
  70. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/dev-review-loop/types.ts +139 -2
  71. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/doc-claim.ts +32 -6
  72. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/index.ts +27 -1
  73. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/issue-validation.ts +757 -0
  74. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/log/schema.ts +8 -1
  75. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-gate.ts +52 -4
  76. package/studio-standalone/_node_modules/@attalabs/aeg-core/src/review-policy.ts +163 -21
  77. package/studio-standalone/apps/vinaya-studio/web/.next/BUILD_ID +1 -1
  78. package/studio-standalone/apps/vinaya-studio/web/.next/app-path-routes-manifest.json +0 -1
  79. package/studio-standalone/apps/vinaya-studio/web/.next/build-manifest.json +3 -3
  80. package/studio-standalone/apps/vinaya-studio/web/.next/prerender-manifest.json +3 -3
  81. package/studio-standalone/apps/vinaya-studio/web/.next/required-server-files.json +0 -5
  82. package/studio-standalone/apps/vinaya-studio/web/.next/routes-manifest.json +0 -6
  83. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js +1 -1
  84. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error/page.js.nft.json +1 -1
  85. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.html +1 -1
  86. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.rsc +1 -1
  87. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  88. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  89. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  90. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  91. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  92. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page/server-reference-manifest.json +2 -2
  93. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js +1 -1
  94. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  95. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  96. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page/server-reference-manifest.json +2 -2
  97. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js +1 -1
  98. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page.js.nft.json +1 -1
  99. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/page_client-reference-manifest.js +1 -1
  100. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page/server-reference-manifest.json +2 -2
  101. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js +3 -3
  102. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page.js.nft.json +1 -1
  103. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/backlog/page_client-reference-manifest.js +1 -1
  104. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page/server-reference-manifest.json +2 -2
  105. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js +3 -3
  106. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page.js.nft.json +1 -1
  107. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/page_client-reference-manifest.js +1 -1
  108. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page/server-reference-manifest.json +2 -2
  109. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js +3 -3
  110. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page.js.nft.json +1 -1
  111. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/page_client-reference-manifest.js +1 -1
  112. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page/server-reference-manifest.json +3 -3
  113. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js +5 -5
  114. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page.js.nft.json +1 -1
  115. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/page_client-reference-manifest.js +1 -1
  116. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page/server-reference-manifest.json +2 -2
  117. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js +3 -3
  118. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page.js.nft.json +1 -1
  119. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/[name]/tranches/[slug]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  120. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page/server-reference-manifest.json +2 -2
  121. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js +3 -3
  122. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page.js.nft.json +1 -1
  123. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/projects/page_client-reference-manifest.js +1 -1
  124. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page/server-reference-manifest.json +2 -2
  125. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js +3 -3
  126. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page.js.nft.json +1 -1
  127. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/studio/tranches/page_client-reference-manifest.js +1 -1
  128. package/studio-standalone/apps/vinaya-studio/web/.next/server/app-paths-manifest.json +0 -1
  129. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/044u_vinaya-studio_web_src_app_studio_backlog__components_BacklogTable_tsx_0oha0bt._.js +3 -0
  130. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/1q96_modules_@clerk_nextjs_dist_esm_app-router_client_keyless-creator-reader_0lom2js.js +1 -1
  131. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1bh2awk._.js → [root-of-the-server]__038scsm._.js} +2 -2
  132. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1widio3._.js → [root-of-the-server]__03__s45._.js} +2 -2
  133. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{_15gdg48._.js → [root-of-the-server]__04adkz-._.js} +3 -3
  134. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__05zwn98._.js +14 -0
  135. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__08e39jo._.js +3 -0
  136. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ls23oh._.js +1 -1
  137. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__10riywf._.js +3 -0
  138. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13znegp._.js → [root-of-the-server]__134x-65._.js} +2 -2
  139. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__0zc_0gx._.js → [root-of-the-server]__14ui9sz._.js} +2 -2
  140. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__13eeix2._.js → [root-of-the-server]__1_l_l1u._.js} +2 -2
  141. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1f4bb3_._.js +3 -0
  142. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1gjqmhq._.js +1 -1
  143. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__1dky4g0._.js → [root-of-the-server]__1my83lt._.js} +2 -2
  144. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1ng2x88._.js +3 -0
  145. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/{[root-of-the-server]__040smoa._.js → [root-of-the-server]__1qpc6at._.js} +2 -2
  146. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1snpgaw._.js +56 -0
  147. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1wc4-ip._.js +2 -2
  148. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_06h3wbl._.js +3 -0
  149. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_08onyya._.js +1 -1
  150. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_096f46i._.js +1 -1
  151. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0af2one._.js +1 -1
  152. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0e5tkdd._.js +1 -1
  153. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0gs4gvl._.js +3 -0
  154. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0kf2g72._.js +1 -1
  155. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0zf4d27._.js +1 -1
  156. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1-wo68i._.js +1 -1
  157. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_121lrn5._.js +3 -0
  158. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1achbh9._.js +1 -1
  159. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1o4v6lb._.js +3 -0
  160. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1q7h5mz._.js +1 -1
  161. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1ztd4i3._.js +3 -0
  162. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_209-ugd._.js +3 -0
  163. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_214d71c._.js +3 -0
  164. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_17dho0f._.js +3 -0
  165. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_@clerk_nextjs_dist_esm_app-router_server-actions_1x7vfhn.js +2 -2
  166. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/node_modules_next_dist_1lzmr5o._.js +1 -1
  167. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_animate_components_index_ts_186fje1._.js +1 -1
  168. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_index_ts_0xk1vda._.js +1 -1
  169. package/studio-standalone/apps/vinaya-studio/web/.next/server/middleware-build-manifest.js +3 -3
  170. package/studio-standalone/apps/vinaya-studio/web/.next/server/pages/500.html +1 -1
  171. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.js +1 -1
  172. package/studio-standalone/apps/vinaya-studio/web/.next/server/server-reference-manifest.json +4 -4
  173. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/09fcolor69bun.js +1 -0
  174. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0lcwmwzxacdie.js +1 -0
  175. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ojry7lrbzkfd.css +1 -0
  176. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vtfb0g813gki.js +1 -0
  177. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1giu47hrbhroj.js +1 -0
  178. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1shz6lwruld25.js +1 -0
  179. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1ytvuy1mmnc6j.js +1 -0
  180. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3oxhhhm_psozq.js → 21a6_5cr956wj.js} +1 -1
  181. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2g8mwnydod96u.js +1 -0
  182. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3li0ueedy-ozv.js → 2nrnuawd5fwpv.js} +1 -1
  183. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2nw47832_uvfe.js +1 -0
  184. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qdxnj8wk2h0s.js +1 -0
  185. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3b9q75p-z5ma5.js +1 -0
  186. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3cv-oe7153242.js +1 -0
  187. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3ip5z3cf43bgo.js → 3l56x8wjdzvaw.js} +5 -5
  188. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3m310lbjj4p5u.js +1 -0
  189. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/{3goaig_rysc6p.js → 3qtt1v3ya-ofe.js} +1 -1
  190. package/studio-standalone/apps/vinaya-studio/web/package.json +2 -2
  191. package/studio-standalone/apps/vinaya-studio/web/server.js +1 -1
  192. package/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/vinaya/studio-standalone/_node_modules/@attalabs/aeg-core/bin/verify-coherence.ts +0 -1089
  193. package/studio-standalone/_node_modules/next/dist/compiled/next-server/app-route-turbo.runtime.prod.js +0 -6
  194. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/app-paths-manifest.json +0 -3
  195. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/build-manifest.json +0 -9
  196. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route/server-reference-manifest.json +0 -4
  197. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js +0 -6
  198. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.map +0 -5
  199. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route.js.nft.json +0 -1
  200. package/studio-standalone/apps/vinaya-studio/web/.next/server/app/api/coherence/route_client-reference-manifest.js +0 -3
  201. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/044u_vinaya-studio_web__next-internal_server_app_api_coherence_route_actions_1rnzea1.js +0 -3
  202. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[externals]__0cki-x_._.js +0 -3
  203. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[root-of-the-server]__02a-3g8._.js +0 -15
  204. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/[turbopack]_runtime.js +0 -903
  205. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__074w9nf._.js +0 -3
  206. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0ln09ua._.js +0 -3
  207. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__0oegopp._.js +0 -3
  208. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__13yxbjd._.js +0 -51
  209. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1duqmtm._.js +0 -3
  210. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/[root-of-the-server]__1z7dml9._.js +0 -9
  211. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0bfs_u4._.js +0 -3
  212. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0g8_eot._.js +0 -3
  213. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0hrh_v-._.js +0 -181
  214. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0i4-dea._.js +0 -3
  215. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0o54suy._.js +0 -3
  216. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0rxd7s0._.js +0 -3
  217. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_0y1jv16._.js +0 -3
  218. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_151m4rz._.js +0 -3
  219. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1a9dieq._.js +0 -3
  220. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sxsf5q._.js +0 -3
  221. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_1sy_yfr._.js +0 -3
  222. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/_219v2an._.js +0 -3
  223. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/apps_vinaya-studio_web_src_app_studio_projects_[name]_tranches_[slug]_05ufo8i._.js +0 -3
  224. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_basic_components_form_input_tsx_0es8d8b._.js +0 -3
  225. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_brutal_components_index_ts_0n_lcc4._.js +0 -3
  226. package/studio-standalone/apps/vinaya-studio/web/.next/server/chunks/ssr/packages_ui_libraries_retro_components_index_ts_0wvpm_z._.js +0 -3
  227. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0bjnj-5fy4e7l.js +0 -1
  228. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0c8uwz_-m8s99.js +0 -165
  229. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ct0c-xj0baf6.js +0 -1
  230. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0ko698wh8xx2g.css +0 -1
  231. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0t5n_r4xm__t-.js +0 -1
  232. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/0vc2u252q5q6o.js +0 -1
  233. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/16r_o07lw0vm0.js +0 -1
  234. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1cah7_e5a1zvu.js +0 -1
  235. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/1gjo9-6dz7nup.js +0 -1
  236. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/24tz8aro1uto4.js +0 -1
  237. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ef2g5fozszw7.js +0 -1
  238. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2ka8dg687auhj.js +0 -1
  239. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2pf3f50gbrkyv.js +0 -1
  240. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/2qq49pct3q51-.js +0 -1
  241. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3et66z7glk65w.js +0 -1
  242. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3u9emqjwpd0t9.js +0 -1
  243. package/studio-standalone/apps/vinaya-studio/web/.next/static/chunks/3y6u3prmrkea-.js +0 -1
  244. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_buildManifest.js +0 -0
  245. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_clientMiddlewareManifest.js +0 -0
  246. /package/studio-standalone/apps/vinaya-studio/web/.next/static/{ca66rAHI_w9D7S7ceXDvR → yR5RsCxb1OGnYggiaO09S}/_ssgManifest.js +0 -0
@@ -1,27 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/lib/pre-push-cache-test-run.ts
4
- import { readFileSync as readFileSync8 } from "node:fs";
4
+ import { readFileSync as readFileSync9 } from "node:fs";
5
5
 
6
6
  // src/lib/pr-report-engine.ts
7
7
  import { execFile as execFile6 } from "node:child_process";
8
8
  import { createHash as createHash2, randomUUID as randomUUID3 } from "node:crypto";
9
9
  import {
10
- closeSync as closeSync5,
11
- constants as fsConstants5,
10
+ closeSync as closeSync6,
11
+ constants as fsConstants6,
12
12
  existsSync as existsSync8,
13
13
  fsyncSync as fsyncSync2,
14
- lstatSync as lstatSync3,
14
+ lstatSync as lstatSync4,
15
15
  mkdtempSync,
16
- openSync as openSync5,
17
- readFileSync as readFileSync7,
16
+ openSync as openSync6,
17
+ readFileSync as readFileSync8,
18
18
  renameSync as renameSync4,
19
19
  rmSync,
20
- writeFileSync as writeFileSync3,
21
- writeSync as writeSync4
20
+ writeFileSync as writeFileSync4,
21
+ writeSync as writeSync5
22
22
  } from "node:fs";
23
23
  import { hostname, tmpdir } from "node:os";
24
- import { dirname as dirname7, join as join9, resolve as resolvePath2 } from "node:path";
24
+ import { dirname as dirname8, join as join9, resolve as resolvePath2 } from "node:path";
25
25
  import { promisify as promisify6 } from "node:util";
26
26
  // ../../packages/aeg-forge-state/src/gh.ts
27
27
  import { execFile, execFileSync } from "node:child_process";
@@ -427,6 +427,16 @@ function globToRegex(pat) {
427
427
  return new RegExp(re);
428
428
  }
429
429
  var SEPARATOR = /(?:[ \t]*[—–][ \t]*|[ \t]+-[ \t]+)/.source;
430
+ // ../../packages/aeg-core/src/review-policy.ts
431
+ var SECURITY_SEVERITY_ORDER = ["CRITICAL", "HIGH", "MEDIUM", "LOW"];
432
+ function blockingSeverities(scale, threshold) {
433
+ const idx = scale.indexOf(threshold);
434
+ if (idx === -1) {
435
+ throw new Error(`blockingSeverities: threshold "${threshold}" is not one of ${scale.join(" > ")}`);
436
+ }
437
+ return scale.slice(0, idx + 1);
438
+ }
439
+ var SECURITY_HIGH_AND_ABOVE = blockingSeverities(SECURITY_SEVERITY_ORDER, "HIGH");
430
440
  // ../../packages/aeg-core/src/pr-tier.ts
431
441
  var OVERRIDE_BODY_TOKEN = `[${label("override-docs")}]`;
432
442
  // ../../packages/aeg-core/src/premise-check.ts
@@ -457,20 +467,42 @@ var NON_PATH_TOP_SEGMENTS = new Set(["origin", "refs", "HEAD", "vinaya", "fix"])
457
467
 
458
468
  // ../../packages/aeg-core/src/doctrine-no-procedures.ts
459
469
  var SHELL_LANGS = new Set(["", "sh", "bash", "shell", "console"]);
470
+ // ../../packages/aeg-core/src/reader-resolvable-prose.ts
471
+ var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
472
+
473
+ // ../../packages/aeg-core/src/quoted-command.ts
474
+ var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
475
+
460
476
  // ../../packages/aeg-core/src/issue-validation.ts
461
477
  var TYPE_LABEL_IDS = LABELS.filter((l) => l.category === "type").map((l) => l.id);
462
478
  var DOC_PATH_RE = /(?:(?:aeg-root|apps|packages|specs|docs|tools|\.claude|\.github)\/[\w./@-]*\.(?:md|mdx)|\.claude\/(?:skills|rules)\/[\w./-]+|\b(?:docs-index|decisions|projects|state-machine|enforcement|process|README|CLAUDE)\.md\b|\b[\w-]+-(?:spec|decisions|backlog)\.md\b)/i;
463
479
  var DOC_PATH_RE_GLOBAL = new RegExp(DOC_PATH_RE.source, "gi");
480
+ var FILE_EXTENSIONS = new Set([
481
+ "ts",
482
+ "tsx",
483
+ "js",
484
+ "jsx",
485
+ "mjs",
486
+ "cjs",
487
+ "json",
488
+ "jsonc",
489
+ "md",
490
+ "mdx",
491
+ "yml",
492
+ "yaml",
493
+ "txt",
494
+ "sh",
495
+ "lock",
496
+ "toml",
497
+ "ndjson",
498
+ "html",
499
+ "css"
500
+ ]);
464
501
 
465
502
  // ../../packages/aeg-core/src/coherence-checks.ts
466
503
  var R1_GRANDFATHERED_ISSUES = new Set([279, 280, 281, 282]);
467
504
  // ../../packages/aeg-core/src/diagram-model.ts
468
505
  import matter from "gray-matter";
469
- // ../../packages/aeg-core/src/reader-resolvable-prose.ts
470
- var SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
471
-
472
- // ../../packages/aeg-core/src/quoted-command.ts
473
- var QUOTED_COMMAND_SWEPT_CLASSES = new Set(["ships", "reader-facing"]);
474
506
  // ../../packages/aeg-core/src/retired-vocabulary.ts
475
507
  var RETIRED_PATTERNS = [
476
508
  String.raw`\bD-[0-9]{3}\b`,
@@ -645,7 +677,6 @@ var TaskPrPauseSchema = z.object({
645
677
  var TaskPrReviewRecordSchema = z.object({
646
678
  verdicts: z.array(TaskPrVerdictSchema),
647
679
  roundMarkers: z.array(z.number().int().nonnegative()),
648
- summaryTable: z.string().nullable(),
649
680
  pause: TaskPrPauseSchema.nullable()
650
681
  });
651
682
  var TaskPrReadInputSchema = z.object({
@@ -692,25 +723,69 @@ var TaskCancelResultSchema = z.object({
692
723
  authenticatedFrom: z.string().min(1),
693
724
  fencedEffectKeys: z.array(z.string())
694
725
  });
695
- var TASK_TOOL_NAMES = [
696
- "task_start",
697
- "task_status",
698
- "task_escalation_read",
699
- "task_pr_read",
700
- "task_resume",
701
- "task_cancel"
702
- ];
703
- var OPERATOR_STATUS_FOLLOW = "task_status_follow";
704
- var OPERATOR_TOOL_GRANT = [...TASK_TOOL_NAMES, OPERATOR_STATUS_FOLLOW];
705
- // ../../packages/aeg-core/src/dev-review-loop/types.ts
706
- var SEVERITY_COLUMNS = ["blocker", "major", "minor", "critical", "high", "medium", "low"];
707
- // ../../packages/aeg-core/src/dev-review-loop/journal-reconstruction.ts
708
- var SUMMARY_TABLE_HEADER = `| round | ${SEVERITY_COLUMNS.join(" | ")} | confidence | outcome |`;
709
- // ../../packages/aeg-core/src/log/envelope.ts
710
- import { createHash } from "node:crypto";
711
-
712
726
  // ../../packages/aeg-core/src/log/schema.ts
727
+ import { z as z3 } from "zod";
728
+
729
+ // ../../packages/aeg-core/src/log/custom.ts
713
730
  import { z as z2 } from "zod";
731
+ var CUSTOM_EVENT_NAME_PATTERN = /^[a-z][a-z0-9_]*\.[a-z][a-z0-9_.]*$/;
732
+ var CUSTOM_EVENT_NAME_MAX_LENGTH = 64;
733
+ var CUSTOM_EVENT_RESERVED_NAMESPACE = "vinaya";
734
+ var CUSTOM_EVENT_MAX_FIELDS = 20;
735
+ var CUSTOM_FIELD_NAME_PATTERN = /^[a-z][a-z0-9_]*$/;
736
+ var CUSTOM_FIELD_NAME_MAX_LENGTH = 64;
737
+ var CUSTOM_TEXT_MAX_LENGTH = 500;
738
+ var CUSTOM_WORD_PATTERN = /^[a-z0-9][a-z0-9_-]*$/;
739
+ var CUSTOM_WORD_MAX_LENGTH = 64;
740
+ var CUSTOM_FIELD_MAX_WORDS = 50;
741
+ var CustomFieldTypeSchema = z2.union([z2.enum(["text", "number", "boolean"]), z2.array(z2.string())]);
742
+ var CustomEventDeclarationsSchema = z2.record(z2.string(), z2.object({
743
+ fields: z2.record(z2.string(), CustomFieldTypeSchema)
744
+ }).strict()).superRefine((events, ctx) => {
745
+ for (const [name, declaration] of Object.entries(events)) {
746
+ const refuse = (message, path = []) => {
747
+ ctx.addIssue({
748
+ code: z2.ZodIssueCode.custom,
749
+ path: [name, ...path],
750
+ message: `logs.events "${name}": ${message}`
751
+ });
752
+ };
753
+ if (name.length > CUSTOM_EVENT_NAME_MAX_LENGTH) {
754
+ refuse(`the name must be at most ${CUSTOM_EVENT_NAME_MAX_LENGTH} characters`);
755
+ }
756
+ if (!CUSTOM_EVENT_NAME_PATTERN.test(name)) {
757
+ refuse("the name must be `<namespace>.<event>` — lowercase letters, digits and `_`, a dot between them");
758
+ } else if (name.split(".")[0] === CUSTOM_EVENT_RESERVED_NAMESPACE) {
759
+ refuse(`the \`${CUSTOM_EVENT_RESERVED_NAMESPACE}.\` namespace is reserved for Vinaya's own events`);
760
+ }
761
+ const fieldEntries = Object.entries(declaration.fields);
762
+ if (fieldEntries.length > CUSTOM_EVENT_MAX_FIELDS) {
763
+ refuse(`at most ${CUSTOM_EVENT_MAX_FIELDS} fields may be declared (found ${fieldEntries.length})`, ["fields"]);
764
+ }
765
+ for (const [field, type] of fieldEntries) {
766
+ if (field.length > CUSTOM_FIELD_NAME_MAX_LENGTH || !CUSTOM_FIELD_NAME_PATTERN.test(field)) {
767
+ 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]);
768
+ }
769
+ if (typeof type === "string")
770
+ continue;
771
+ if (type.length === 0) {
772
+ refuse(`field "${field}": a list of words must name at least one word`, ["fields", field]);
773
+ }
774
+ if (type.length > CUSTOM_FIELD_MAX_WORDS) {
775
+ refuse(`field "${field}": a list of words may name at most ${CUSTOM_FIELD_MAX_WORDS}`, ["fields", field]);
776
+ }
777
+ const bad = type.filter((w) => w.length > CUSTOM_WORD_MAX_LENGTH || !CUSTOM_WORD_PATTERN.test(w));
778
+ if (bad.length > 0) {
779
+ refuse(`field "${field}": a listed word is lowercase letters, digits, \`_\` and \`-\`, at most ${CUSTOM_WORD_MAX_LENGTH} characters`, ["fields", field]);
780
+ }
781
+ if (new Set(type).size !== type.length) {
782
+ refuse(`field "${field}": a list of words names a word twice`, ["fields", field]);
783
+ }
784
+ }
785
+ }
786
+ });
787
+
788
+ // ../../packages/aeg-core/src/log/schema.ts
714
789
  var CONFIDENCE_REASON_MAX_LENGTH = 280;
715
790
  var ROLE_VALUES = [
716
791
  "planner",
@@ -721,244 +796,297 @@ var ROLE_VALUES = [
721
796
  "archivist",
722
797
  "architect"
723
798
  ];
724
- var RoleSchema = z2.enum(ROLE_VALUES);
799
+ var RoleSchema = z3.enum(ROLE_VALUES);
725
800
  var HOST_VALUES = ["hook", "ci", "cli", "loop"];
726
- var HostSchema = z2.enum(HOST_VALUES);
801
+ var HostSchema = z3.enum(HOST_VALUES);
727
802
  var RUN_ID_PATTERN = /^[A-Za-z0-9_.-]{1,128}$/;
728
803
  var headerMetaCore = {
729
- ts: z2.string(),
730
- run_id: z2.string().regex(RUN_ID_PATTERN),
731
- seq: z2.number().int().nonnegative(),
732
- repo: z2.string().nullable(),
733
- vinaya: z2.string(),
734
- doctrine: z2.string(),
804
+ ts: z3.string(),
805
+ run_id: z3.string().regex(RUN_ID_PATTERN),
806
+ seq: z3.number().int().nonnegative(),
807
+ repo: z3.string().nullable(),
808
+ vinaya: z3.string(),
809
+ doctrine: z3.string(),
735
810
  host: HostSchema,
736
- machine: z2.string()
811
+ machine: z3.string()
737
812
  };
738
- var HeaderMetaV1Schema = z2.object({
739
- schema: z2.literal(1),
813
+ var HeaderMetaV1Schema = z3.object({
814
+ schema: z3.literal(1),
740
815
  ...headerMetaCore
741
816
  }).strict();
742
- var LineageSchema = z2.object({
743
- run: z2.string().nullable(),
744
- attempt: z2.number().int().nullable(),
745
- parent: z2.string().nullable()
817
+ var LineageSchema = z3.object({
818
+ run: z3.string().nullable(),
819
+ attempt: z3.number().int().nullable(),
820
+ parent: z3.string().nullable()
746
821
  }).strict();
747
- var InputVersionsSchema = z2.object({
748
- objectives_version: z2.string().nullable(),
749
- brief_hash: z2.string().nullable(),
750
- ruling_ordinal: z2.number().int().nullable(),
751
- policy_digest: z2.string().nullable()
822
+ var InputVersionsSchema = z3.object({
823
+ objectives_version: z3.string().nullable(),
824
+ brief_hash: z3.string().nullable(),
825
+ ruling_ordinal: z3.number().int().nullable(),
826
+ policy_digest: z3.string().nullable()
752
827
  }).strict();
753
- var ProvenanceSchema = z2.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
754
- var HeaderMetaV2Schema = z2.object({
755
- schema: z2.literal(2),
828
+ var ProvenanceSchema = z3.enum(["parent_attributed", "env_correlated", "self_reported", "unavailable"]);
829
+ var HeaderMetaV2Schema = z3.object({
830
+ schema: z3.literal(2),
756
831
  ...headerMetaCore,
757
- event_id: z2.string().min(1),
758
- process_id: z2.string().min(1),
759
- actor_id: z2.string().nullable(),
832
+ event_id: z3.string().min(1),
833
+ process_id: z3.string().min(1),
834
+ actor_id: z3.string().nullable(),
760
835
  lineage: LineageSchema,
761
836
  input_versions: InputVersionsSchema,
762
837
  provenance: ProvenanceSchema
763
838
  }).strict();
764
- var HeaderMetaSchema = z2.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema]);
765
- var SubjectSchema = z2.object({
766
- issue: z2.number().int().nullable(),
767
- pr: z2.number().int().optional(),
768
- sha: z2.string().optional(),
769
- role: z2.union([RoleSchema, z2.literal("unattributed")]),
770
- round: z2.number().int().optional(),
771
- objectives_version: z2.string().optional()
839
+ var WorkSchema = z3.object({
840
+ ref: z3.string().nullable(),
841
+ repo: z3.string().nullable(),
842
+ change: z3.string().nullable(),
843
+ revision: z3.string().nullable()
844
+ }).strict();
845
+ var FlowSchema = z3.object({
846
+ id: z3.string().nullable(),
847
+ version: z3.string().nullable()
848
+ }).strict();
849
+ var HeaderMetaV3Schema = z3.object({
850
+ schema: z3.literal(3),
851
+ ...headerMetaCore,
852
+ event_id: z3.string().min(1),
853
+ process_id: z3.string().min(1),
854
+ actor_id: z3.string().nullable(),
855
+ lineage: LineageSchema,
856
+ input_versions: InputVersionsSchema,
857
+ provenance: ProvenanceSchema,
858
+ work: WorkSchema,
859
+ flow: FlowSchema,
860
+ runtime: z3.string().nullable(),
861
+ source: z3.string().nullable()
862
+ }).strict();
863
+ var HeaderMetaSchema = z3.discriminatedUnion("schema", [HeaderMetaV1Schema, HeaderMetaV2Schema, HeaderMetaV3Schema]);
864
+ var SubjectSchema = z3.object({
865
+ issue: z3.number().int().nullable(),
866
+ pr: z3.number().int().optional(),
867
+ sha: z3.string().optional(),
868
+ role: z3.union([RoleSchema, z3.literal("unattributed")]),
869
+ round: z3.number().int().optional(),
870
+ objectives_version: z3.string().optional()
772
871
  }).strict();
773
- var HeaderSchema = z2.object({
872
+ var HeaderSchema = z3.object({
774
873
  meta: HeaderMetaSchema,
775
874
  subject: SubjectSchema
776
875
  }).strict();
777
876
  var envelopeTail = {
778
- duration_ms: z2.number().nonnegative().optional(),
779
- payload: z2.object({}).strict()
877
+ duration_ms: z3.number().nonnegative().optional(),
878
+ payload: z3.object({}).strict()
780
879
  };
781
- var ReviewFindingSchema = z2.object({
782
- id: z2.string(),
783
- severity: z2.string(),
784
- state: z2.string().optional(),
785
- severity_scale: z2.string().optional(),
786
- policy_treatment: z2.enum(["blocking", "non_blocking", "unavailable"]).optional(),
787
- confidence: z2.number().min(0).max(1).optional(),
788
- confidence_scale: z2.string().optional(),
789
- confidence_source: z2.string().optional()
880
+ var ReviewFindingSchema = z3.object({
881
+ id: z3.string(),
882
+ severity: z3.string(),
883
+ state: z3.string().optional(),
884
+ severity_scale: z3.string().optional(),
885
+ policy_treatment: z3.enum(["blocking", "non_blocking", "unavailable"]).optional(),
886
+ confidence: z3.number().min(0).max(1).optional(),
887
+ confidence_scale: z3.string().optional(),
888
+ confidence_source: z3.string().optional()
790
889
  }).strict();
791
- var DispatchOutcomeSchema = z2.discriminatedUnion("type", [
792
- z2.object({ type: z2.literal("pr_opened"), pr: z2.number().int(), head: z2.string() }).strict(),
793
- z2.object({
794
- type: z2.literal("round_pushed"),
795
- pr: z2.number().int(),
796
- head: z2.string(),
797
- comment_id: z2.number().int()
890
+ var DispatchOutcomeSchema = z3.discriminatedUnion("type", [
891
+ z3.object({ type: z3.literal("pr_opened"), pr: z3.number().int(), head: z3.string() }).strict(),
892
+ z3.object({
893
+ type: z3.literal("round_pushed"),
894
+ pr: z3.number().int(),
895
+ head: z3.string(),
896
+ comment_id: z3.number().int()
798
897
  }).strict(),
799
- z2.object({
800
- type: z2.literal("verdict"),
801
- verdict: z2.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
802
- head: z2.string(),
803
- comment_id: z2.number().int(),
804
- objectives: z2.array(z2.object({ id: z2.string(), met: z2.boolean() }).strict()),
805
- findings: z2.array(ReviewFindingSchema)
898
+ z3.object({
899
+ type: z3.literal("verdict"),
900
+ verdict: z3.enum(["APPROVE", "REQUEST CHANGES", "PASS", "FAIL"]),
901
+ head: z3.string(),
902
+ comment_id: z3.number().int(),
903
+ objectives: z3.array(z3.object({ id: z3.string(), met: z3.boolean() }).strict()),
904
+ findings: z3.array(ReviewFindingSchema)
806
905
  }).strict(),
807
- z2.object({
808
- type: z2.literal("escalation"),
809
- class: z2.enum(["authority", "strategy", "product"]),
810
- comment_id: z2.number().int()
906
+ z3.object({
907
+ type: z3.literal("escalation"),
908
+ class: z3.enum(["authority", "strategy", "product"]),
909
+ comment_id: z3.number().int()
811
910
  }).strict(),
812
- z2.object({ type: z2.literal("brief"), comment_id: z2.number().int(), hash: z2.string() }).strict(),
813
- z2.object({ type: z2.literal("plan"), issues: z2.array(z2.number().int()) }).strict(),
814
- z2.object({ type: z2.literal("archive"), provenance_comment_id: z2.number().int() }).strict(),
815
- z2.object({ type: z2.literal("completed") }).strict()
911
+ z3.object({ type: z3.literal("brief"), comment_id: z3.number().int(), hash: z3.string() }).strict(),
912
+ z3.object({ type: z3.literal("plan"), issues: z3.array(z3.number().int()) }).strict(),
913
+ z3.object({ type: z3.literal("archive"), provenance_comment_id: z3.number().int() }).strict(),
914
+ z3.object({ type: z3.literal("completed") }).strict()
816
915
  ]);
817
916
  var dispatchShared = {
818
917
  meta: HeaderMetaSchema,
819
918
  subject: SubjectSchema,
820
- kind: z2.literal("dispatch"),
919
+ kind: z3.literal("dispatch"),
821
920
  ...envelopeTail,
822
921
  target_role: RoleSchema,
823
- model: z2.string(),
824
- round: z2.number().int().optional(),
825
- effect_id: z2.string()
922
+ model: z3.string(),
923
+ round: z3.number().int().optional(),
924
+ effect_id: z3.string()
826
925
  };
827
- var dispatchUsageField = z2.object({ input: z2.number().nonnegative(), output: z2.number().nonnegative() }).strict().nullable();
828
- var DispatchEventSchema = z2.discriminatedUnion("event", [
829
- z2.object({ ...dispatchShared, event: z2.literal("dispatched"), prompt_hash: z2.string() }).strict(),
830
- z2.object({
926
+ var dispatchUsageField = z3.object({ input: z3.number().nonnegative(), output: z3.number().nonnegative() }).strict().nullable();
927
+ var DispatchEventSchema = z3.discriminatedUnion("event", [
928
+ z3.object({ ...dispatchShared, event: z3.literal("dispatched"), prompt_hash: z3.string() }).strict(),
929
+ z3.object({
831
930
  ...dispatchShared,
832
- event: z2.literal("outcome_received"),
931
+ event: z3.literal("outcome_received"),
833
932
  outcome: DispatchOutcomeSchema,
834
933
  usage: dispatchUsageField
835
934
  }).strict(),
836
- z2.object({
935
+ z3.object({
837
936
  ...dispatchShared,
838
- event: z2.literal("dispatch_failed"),
839
- reason: z2.enum(["timeout", "crash", "refused", "unattributed_write"]),
937
+ event: z3.literal("dispatch_failed"),
938
+ reason: z3.enum(["timeout", "crash", "refused", "unattributed_write"]),
840
939
  usage: dispatchUsageField
841
940
  }).strict()
842
941
  ]);
942
+ var CODE_TOKEN_PATTERN = /^[A-Za-z0-9._-]{1,64}$/;
943
+ var CodeTokenSchema = z3.string().regex(CODE_TOKEN_PATTERN);
944
+ var ReviewerVerdictSchema = z3.object({
945
+ role: RoleSchema,
946
+ outcome: z3.enum(["approve", "changes_requested", "not_reviewed"]),
947
+ blockers: z3.number().int().nonnegative()
948
+ }).strict();
843
949
  var loopShared = {
844
950
  meta: HeaderMetaSchema,
845
951
  subject: SubjectSchema,
846
- kind: z2.literal("dev_review_loop"),
952
+ kind: z3.literal("dev_review_loop"),
847
953
  ...envelopeTail,
848
- loop_id: z2.string()
954
+ loop_id: z3.string()
849
955
  };
850
- var DevReviewLoopEventSchema = z2.discriminatedUnion("event", [
851
- z2.object({
956
+ var DevReviewLoopEventSchema = z3.discriminatedUnion("event", [
957
+ z3.object({
852
958
  ...loopShared,
853
- event: z2.literal("loop_started"),
854
- task: z2.number().int(),
855
- policy: z2.object({
856
- max_rounds: z2.number().int().nonnegative(),
857
- reviewers: z2.array(RoleSchema),
858
- models: z2.record(RoleSchema, z2.string())
959
+ event: z3.literal("loop_started"),
960
+ task: z3.number().int(),
961
+ policy: z3.object({
962
+ max_rounds: z3.number().int().nonnegative(),
963
+ reviewers: z3.array(RoleSchema),
964
+ models: z3.record(RoleSchema, z3.string())
859
965
  }).strict()
860
966
  }).strict(),
861
- z2.object({ ...loopShared, event: z2.literal("round_started"), round: z2.number().int(), base_head: z2.string() }).strict(),
862
- z2.object({
967
+ z3.object({ ...loopShared, event: z3.literal("round_started"), round: z3.number().int(), base_head: z3.string() }).strict(),
968
+ z3.object({
863
969
  ...loopShared,
864
- event: z2.literal("gate_result_read"),
865
- round: z2.number().int(),
866
- head: z2.string(),
867
- green: z2.boolean(),
868
- confidence_value: z2.number().int().min(0).max(100).optional(),
869
- confidence_reason: z2.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
870
- confidence_unavailable: z2.boolean().optional(),
871
- extra_turn_spent: z2.boolean().optional()
970
+ event: z3.literal("gate_result_read"),
971
+ round: z3.number().int(),
972
+ head: z3.string(),
973
+ green: z3.boolean(),
974
+ confidence_value: z3.number().int().min(0).max(100).optional(),
975
+ confidence_reason: z3.string().max(CONFIDENCE_REASON_MAX_LENGTH).optional(),
976
+ confidence_unavailable: z3.boolean().optional(),
977
+ extra_turn_spent: z3.boolean().optional()
872
978
  }).strict(),
873
- z2.object({
979
+ z3.object({
874
980
  ...loopShared,
875
- event: z2.literal("verdicts_read"),
876
- round: z2.number().int(),
877
- head: z2.string(),
878
- all_approve: z2.boolean(),
879
- blockers: z2.number().int().nonnegative(),
880
- findings: z2.array(ReviewFindingSchema).optional()
981
+ event: z3.literal("verdicts_read"),
982
+ round: z3.number().int(),
983
+ head: z3.string(),
984
+ all_approve: z3.boolean(),
985
+ blockers: z3.number().int().nonnegative(),
986
+ findings: z3.array(ReviewFindingSchema).optional(),
987
+ reviewers: z3.array(ReviewerVerdictSchema).optional()
881
988
  }).strict(),
882
- z2.object({
989
+ z3.object({
883
990
  ...loopShared,
884
- event: z2.literal("findings_compared"),
885
- round: z2.number().int(),
886
- open: z2.array(z2.string()),
887
- resolved: z2.array(z2.string()),
888
- new: z2.array(z2.string()),
889
- recurring: z2.array(z2.string())
991
+ event: z3.literal("findings_compared"),
992
+ round: z3.number().int(),
993
+ open: z3.array(z3.string()),
994
+ resolved: z3.array(z3.string()),
995
+ new: z3.array(z3.string()),
996
+ recurring: z3.array(z3.string())
890
997
  }).strict(),
891
- z2.object({
998
+ z3.object({
892
999
  ...loopShared,
893
- event: z2.literal("stop_condition_met"),
894
- round: z2.number().int(),
895
- condition: z2.enum([
1000
+ event: z3.literal("stop_condition_met"),
1001
+ round: z3.number().int(),
1002
+ condition: z3.enum([
896
1003
  "green",
897
1004
  "max_rounds",
898
1005
  "no_progress",
899
1006
  "escalated",
900
1007
  "principal_stop",
901
1008
  "confidence",
902
- "reappearance"
1009
+ "reappearance",
1010
+ "repeat_finding",
1011
+ "repeat_failure",
1012
+ "time_budget"
903
1013
  ])
904
1014
  }).strict(),
905
- z2.object({
1015
+ z3.object({
1016
+ ...loopShared,
1017
+ event: z3.literal("paused"),
1018
+ round: z3.number().int(),
1019
+ reason: z3.enum(["escalation", "principal_item", "refreeze_needed"]),
1020
+ reason_code: CodeTokenSchema.optional()
1021
+ }).strict(),
1022
+ z3.object({
906
1023
  ...loopShared,
907
- event: z2.literal("paused"),
908
- round: z2.number().int(),
909
- reason: z2.enum(["escalation", "principal_item", "refreeze_needed"])
1024
+ event: z3.literal("resumed"),
1025
+ round: z3.number().int(),
1026
+ by: z3.enum(["principal", "driver"])
910
1027
  }).strict(),
911
- z2.object({
1028
+ z3.object({
912
1029
  ...loopShared,
913
- event: z2.literal("resumed"),
914
- round: z2.number().int(),
915
- by: z2.enum(["principal", "driver"])
1030
+ event: z3.literal("cancelled"),
1031
+ round: z3.number().int(),
1032
+ by: z3.literal("principal")
916
1033
  }).strict(),
917
- z2.object({
1034
+ z3.object({
918
1035
  ...loopShared,
919
- event: z2.literal("cancelled"),
920
- round: z2.number().int(),
921
- by: z2.literal("principal")
1036
+ event: z3.literal("unpushed_work_resume"),
1037
+ round: z3.number().int(),
1038
+ branch: z3.string(),
1039
+ detail: z3.string()
922
1040
  }).strict(),
923
- z2.object({
1041
+ z3.object({
924
1042
  ...loopShared,
925
- event: z2.literal("unpushed_work_resume"),
926
- round: z2.number().int(),
927
- branch: z2.string(),
928
- detail: z2.string()
1043
+ event: z3.literal("round_ended"),
1044
+ round: z3.number().int(),
1045
+ base_head: z3.string(),
1046
+ head: z3.string(),
1047
+ files_changed: z3.number().int().nonnegative(),
1048
+ insertions: z3.number().int().nonnegative(),
1049
+ deletions: z3.number().int().nonnegative(),
1050
+ wall_ms: z3.number().nonnegative(),
1051
+ outcome: z3.enum(["green", "changes_requested", "escalated"])
929
1052
  }).strict(),
930
- z2.object({
1053
+ z3.object({
931
1054
  ...loopShared,
932
- event: z2.literal("round_ended"),
933
- round: z2.number().int(),
934
- base_head: z2.string(),
935
- head: z2.string(),
936
- files_changed: z2.number().int().nonnegative(),
937
- insertions: z2.number().int().nonnegative(),
938
- deletions: z2.number().int().nonnegative(),
939
- wall_ms: z2.number().nonnegative(),
940
- outcome: z2.enum(["green", "changes_requested", "escalated"])
1055
+ event: z3.literal("journal_finalized"),
1056
+ rounds: z3.number().int().nonnegative(),
1057
+ total_wall_ms: z3.number().nonnegative(),
1058
+ time_to_green_ms: z3.number().nonnegative().nullable(),
1059
+ files_changed_total: z3.number().int().nonnegative(),
1060
+ final_head: z3.string(),
1061
+ result: z3.enum(["merged_ready", "stopped"])
941
1062
  }).strict(),
942
- z2.object({
1063
+ z3.object({
943
1064
  ...loopShared,
944
- event: z2.literal("journal_finalized"),
945
- rounds: z2.number().int().nonnegative(),
946
- total_wall_ms: z2.number().nonnegative(),
947
- time_to_green_ms: z2.number().nonnegative().nullable(),
948
- files_changed_total: z2.number().int().nonnegative(),
949
- final_head: z2.string(),
950
- result: z2.enum(["merged_ready", "stopped"])
1065
+ event: z3.literal("infrastructure_retry"),
1066
+ round: z3.number().int(),
1067
+ failure_kind: z3.enum(["pause_comment_post", "developer_connection"]),
1068
+ attempts: z3.number().int().positive(),
1069
+ outcome: z3.enum(["recovered", "exhausted"])
951
1070
  }).strict(),
952
- z2.object({
1071
+ z3.object({
953
1072
  ...loopShared,
954
- event: z2.literal("infrastructure_retry"),
955
- round: z2.number().int(),
956
- failure_kind: z2.enum(["pause_comment_post", "developer_connection"]),
957
- attempts: z2.number().int().positive(),
958
- outcome: z2.enum(["recovered", "exhausted"])
1073
+ event: z3.literal("driver_heartbeat"),
1074
+ task: z3.number().int(),
1075
+ pr: z3.number().int().positive().optional(),
1076
+ round: z3.number().int(),
1077
+ phase: z3.string()
1078
+ }).strict(),
1079
+ z3.object({
1080
+ ...loopShared,
1081
+ event: z3.literal("driver_exited"),
1082
+ task: z3.number().int(),
1083
+ reason: z3.enum(["finished", "paused", "reexec", "error", "signal"]),
1084
+ last_decision: z3.string(),
1085
+ exit_code: z3.number().int().optional(),
1086
+ error_class: CodeTokenSchema.optional()
959
1087
  }).strict()
960
1088
  ]);
961
- var ForgeOpSchema = z2.enum([
1089
+ var ForgeOpSchema = z3.enum([
962
1090
  "pr.create",
963
1091
  "pr.comment",
964
1092
  "pr.body.replace",
@@ -972,24 +1100,24 @@ var ForgeOpSchema = z2.enum([
972
1100
  "label.add",
973
1101
  "label.remove"
974
1102
  ]);
975
- var ForgeWriteTargetSchema = z2.object({
976
- issue: z2.number().int().optional(),
977
- pr: z2.number().int().optional()
1103
+ var ForgeWriteTargetSchema = z3.object({
1104
+ issue: z3.number().int().optional(),
1105
+ pr: z3.number().int().optional()
978
1106
  }).strict();
979
1107
  var forgeWriteShared = {
980
1108
  meta: HeaderMetaSchema,
981
1109
  subject: SubjectSchema,
982
- kind: z2.literal("forge_write"),
1110
+ kind: z3.literal("forge_write"),
983
1111
  ...envelopeTail,
984
1112
  op: ForgeOpSchema,
985
1113
  target: ForgeWriteTargetSchema
986
1114
  };
987
- var ForgeWriteEventSchema = z2.discriminatedUnion("event", [
988
- z2.object({ ...forgeWriteShared, event: z2.literal("validated") }).strict(),
989
- z2.object({ ...forgeWriteShared, event: z2.literal("refused"), reason: z2.string() }).strict(),
990
- z2.object({ ...forgeWriteShared, event: z2.literal("written"), comment_ids: z2.array(z2.string()) }).strict()
1115
+ var ForgeWriteEventSchema = z3.discriminatedUnion("event", [
1116
+ z3.object({ ...forgeWriteShared, event: z3.literal("validated") }).strict(),
1117
+ z3.object({ ...forgeWriteShared, event: z3.literal("refused"), reason: z3.string() }).strict(),
1118
+ z3.object({ ...forgeWriteShared, event: z3.literal("written"), comment_ids: z3.array(z3.string()) }).strict()
991
1119
  ]);
992
- var GateOutcomeSchema = z2.enum([
1120
+ var GateOutcomeSchema = z3.enum([
993
1121
  "pass",
994
1122
  "fail",
995
1123
  "wait",
@@ -1002,61 +1130,74 @@ var GateOutcomeSchema = z2.enum([
1002
1130
  var gateShared = {
1003
1131
  meta: HeaderMetaSchema,
1004
1132
  subject: SubjectSchema,
1005
- kind: z2.literal("gate"),
1133
+ kind: z3.literal("gate"),
1006
1134
  ...envelopeTail,
1007
- check: z2.string(),
1008
- check_version: z2.string().nullable(),
1009
- policy_version: z2.string().nullable(),
1010
- input_fingerprint: z2.string().nullable()
1135
+ check: z3.string(),
1136
+ check_version: z3.string().nullable(),
1137
+ policy_version: z3.string().nullable(),
1138
+ input_fingerprint: z3.string().nullable()
1011
1139
  };
1012
- var GateEventSchema = z2.discriminatedUnion("event", [
1013
- z2.object({
1140
+ var GateEventSchema = z3.discriminatedUnion("event", [
1141
+ z3.object({
1014
1142
  ...gateShared,
1015
- event: z2.literal("checked"),
1143
+ event: z3.literal("checked"),
1016
1144
  outcome: GateOutcomeSchema,
1017
- reason: z2.string().optional()
1145
+ reason: z3.string().optional()
1146
+ }).strict(),
1147
+ z3.object({
1148
+ meta: HeaderMetaSchema,
1149
+ subject: SubjectSchema,
1150
+ kind: z3.literal("gate"),
1151
+ ...envelopeTail,
1152
+ event: z3.literal("summary"),
1153
+ ran: z3.number().int().nonnegative(),
1154
+ passed: z3.number().int().nonnegative(),
1155
+ failed: z3.number().int().nonnegative(),
1156
+ skipped: z3.number().int().nonnegative(),
1157
+ failed_checks: z3.array(z3.string())
1018
1158
  }).strict()
1019
1159
  ]);
1020
- var OperationResultSchema = z2.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
1160
+ var OperationResultSchema = z3.enum(["ok", "error", "refused", "timeout", "cancelled", "unavailable"]);
1021
1161
  var operationShared = {
1022
1162
  meta: HeaderMetaSchema,
1023
1163
  subject: SubjectSchema,
1024
- kind: z2.literal("operation"),
1164
+ kind: z3.literal("operation"),
1025
1165
  ...envelopeTail,
1026
- operation: z2.string(),
1027
- target: z2.string().nullable()
1166
+ operation: z3.string(),
1167
+ target: z3.string().nullable()
1028
1168
  };
1029
- var OperationEventSchema = z2.discriminatedUnion("event", [
1030
- z2.object({
1169
+ var OperationEventSchema = z3.discriminatedUnion("event", [
1170
+ z3.object({
1031
1171
  ...operationShared,
1032
- event: z2.literal("completed"),
1172
+ event: z3.literal("completed"),
1033
1173
  result: OperationResultSchema,
1034
- error_class: z2.string().nullable()
1174
+ error_class: z3.string().nullable(),
1175
+ field_names: z3.array(z3.string().max(CUSTOM_FIELD_NAME_MAX_LENGTH)).max(CUSTOM_EVENT_MAX_FIELDS).optional()
1035
1176
  }).strict()
1036
1177
  ]);
1037
- var UsageUnitsSchema = z2.object({
1038
- input: z2.number().nonnegative().nullable(),
1039
- output: z2.number().nonnegative().nullable(),
1040
- cache: z2.number().nonnegative().nullable()
1178
+ var UsageUnitsSchema = z3.object({
1179
+ input: z3.number().nonnegative().nullable(),
1180
+ output: z3.number().nonnegative().nullable(),
1181
+ cache: z3.number().nonnegative().nullable()
1041
1182
  }).strict();
1042
1183
  var usageShared = {
1043
1184
  meta: HeaderMetaSchema,
1044
1185
  subject: SubjectSchema,
1045
- kind: z2.literal("usage"),
1186
+ kind: z3.literal("usage"),
1046
1187
  ...envelopeTail,
1047
- model: z2.string().nullable(),
1048
- source: z2.string(),
1049
- semantics: z2.enum(["cumulative", "delta"])
1188
+ model: z3.string().nullable(),
1189
+ source: z3.string(),
1190
+ semantics: z3.enum(["cumulative", "delta"])
1050
1191
  };
1051
- var UsageEventSchema = z2.discriminatedUnion("event", [
1052
- z2.object({
1192
+ var UsageEventSchema = z3.discriminatedUnion("event", [
1193
+ z3.object({
1053
1194
  ...usageShared,
1054
- event: z2.literal("observed"),
1195
+ event: z3.literal("observed"),
1055
1196
  units: UsageUnitsSchema,
1056
- unknown_reason: z2.string().nullable()
1197
+ unknown_reason: z3.string().nullable()
1057
1198
  }).strict()
1058
1199
  ]);
1059
- var RoleAttemptOutcomeSchema = z2.enum([
1200
+ var RoleAttemptOutcomeSchema = z3.enum([
1060
1201
  "completed",
1061
1202
  "incomplete",
1062
1203
  "infrastructure_failed",
@@ -1067,17 +1208,17 @@ var RoleAttemptOutcomeSchema = z2.enum([
1067
1208
  var roleAttemptShared = {
1068
1209
  meta: HeaderMetaSchema,
1069
1210
  subject: SubjectSchema,
1070
- kind: z2.literal("role_attempt"),
1211
+ kind: z3.literal("role_attempt"),
1071
1212
  ...envelopeTail,
1072
- actor: z2.string().nullable(),
1073
- attempt: z2.number().int().nullable(),
1074
- effect_id: z2.string(),
1075
- model: z2.string().nullable()
1213
+ actor: z3.string().nullable(),
1214
+ attempt: z3.number().int().nullable(),
1215
+ effect_id: z3.string(),
1216
+ model: z3.string().nullable()
1076
1217
  };
1077
- var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
1078
- z2.object({
1218
+ var RoleAttemptEventSchema = z3.discriminatedUnion("event", [
1219
+ z3.object({
1079
1220
  ...roleAttemptShared,
1080
- event: z2.literal("attempted"),
1221
+ event: z3.literal("attempted"),
1081
1222
  outcome: RoleAttemptOutcomeSchema,
1082
1223
  usage: dispatchUsageField
1083
1224
  }).strict()
@@ -1085,42 +1226,59 @@ var RoleAttemptEventSchema = z2.discriminatedUnion("event", [
1085
1226
  var handoffShared = {
1086
1227
  meta: HeaderMetaSchema,
1087
1228
  subject: SubjectSchema,
1088
- kind: z2.literal("handoff"),
1229
+ kind: z3.literal("handoff"),
1089
1230
  ...envelopeTail,
1090
- class: z2.enum(["authority", "strategy", "product"]),
1091
- reason: z2.string()
1231
+ class: z3.enum(["authority", "strategy", "product"]),
1232
+ reason: z3.string()
1092
1233
  };
1093
- var HandoffEventSchema = z2.discriminatedUnion("event", [
1094
- z2.object({
1234
+ var HandoffEventSchema = z3.discriminatedUnion("event", [
1235
+ z3.object({
1095
1236
  ...handoffShared,
1096
- event: z2.literal("raised"),
1097
- requested_decision: z2.string().nullable()
1237
+ event: z3.literal("raised"),
1238
+ requested_decision: z3.string().nullable()
1098
1239
  }).strict(),
1099
- z2.object({
1240
+ z3.object({
1100
1241
  ...handoffShared,
1101
- event: z2.literal("resolved"),
1102
- resolution: z2.string().nullable(),
1103
- resolved_by: z2.string().nullable()
1242
+ event: z3.literal("resolved"),
1243
+ resolution: z3.string().nullable(),
1244
+ resolved_by: z3.string().nullable()
1104
1245
  }).strict()
1105
1246
  ]);
1106
- var EffectTargetSchema = z2.object({
1107
- kind: z2.string(),
1108
- ref: z2.string()
1247
+ var EffectTargetSchema = z3.object({
1248
+ kind: z3.string(),
1249
+ ref: z3.string()
1109
1250
  }).strict();
1110
1251
  var effectShared = {
1111
1252
  meta: HeaderMetaSchema,
1112
1253
  subject: SubjectSchema,
1113
- kind: z2.literal("effect"),
1254
+ kind: z3.literal("effect"),
1114
1255
  ...envelopeTail,
1115
- effect_id: z2.string(),
1256
+ effect_id: z3.string(),
1116
1257
  target: EffectTargetSchema
1117
1258
  };
1118
- var EffectEventSchema = z2.discriminatedUnion("event", [
1119
- z2.object({ ...effectShared, event: z2.literal("attempted") }).strict(),
1120
- z2.object({ ...effectShared, event: z2.literal("observed"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict(),
1121
- z2.object({ ...effectShared, event: z2.literal("verified"), outcome: z2.enum(["success", "failure", "uncertain"]) }).strict()
1259
+ var EffectEventSchema = z3.discriminatedUnion("event", [
1260
+ z3.object({ ...effectShared, event: z3.literal("attempted") }).strict(),
1261
+ z3.object({ ...effectShared, event: z3.literal("observed"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict(),
1262
+ z3.object({ ...effectShared, event: z3.literal("verified"), outcome: z3.enum(["success", "failure", "uncertain"]) }).strict()
1122
1263
  ]);
1123
- var LogEventSchema = z2.union([
1264
+ var CustomFieldValueSchema = z3.union([z3.string().max(CUSTOM_TEXT_MAX_LENGTH), z3.number().finite(), z3.boolean()]);
1265
+ var customShared = {
1266
+ meta: HeaderMetaV3Schema,
1267
+ subject: SubjectSchema,
1268
+ kind: z3.literal("custom"),
1269
+ ...envelopeTail
1270
+ };
1271
+ var CustomEventSchema = z3.discriminatedUnion("event", [
1272
+ z3.object({
1273
+ ...customShared,
1274
+ event: z3.literal("recorded"),
1275
+ name: z3.string().max(CUSTOM_EVENT_NAME_MAX_LENGTH).regex(CUSTOM_EVENT_NAME_PATTERN),
1276
+ 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, {
1277
+ message: `custom: at most ${CUSTOM_EVENT_MAX_FIELDS} fields`
1278
+ })
1279
+ }).strict()
1280
+ ]);
1281
+ var LogEventSchema = z3.union([
1124
1282
  DispatchEventSchema,
1125
1283
  DevReviewLoopEventSchema,
1126
1284
  ForgeWriteEventSchema,
@@ -1129,10 +1287,11 @@ var LogEventSchema = z2.union([
1129
1287
  UsageEventSchema,
1130
1288
  RoleAttemptEventSchema,
1131
1289
  HandoffEventSchema,
1132
- EffectEventSchema
1290
+ EffectEventSchema,
1291
+ CustomEventSchema
1133
1292
  ]);
1134
-
1135
1293
  // ../../packages/aeg-core/src/log/envelope.ts
1294
+ import { createHash } from "node:crypto";
1136
1295
  function isRole(value) {
1137
1296
  return value !== undefined && ROLE_VALUES.includes(value);
1138
1297
  }
@@ -1169,18 +1328,27 @@ function roundFromEnv(round) {
1169
1328
  const n = Number(round);
1170
1329
  return Number.isInteger(n) ? n : undefined;
1171
1330
  }
1331
+ function prFromEnv(pr) {
1332
+ if (pr === undefined || pr === "")
1333
+ return;
1334
+ const n = Number(pr);
1335
+ return Number.isInteger(n) && n > 0 ? n : undefined;
1336
+ }
1172
1337
  function buildHeader(input) {
1173
1338
  const role = isRole(input.env.role) ? input.env.role : "unattributed";
1174
1339
  const round = roundFromEnv(input.env.round);
1340
+ const pr = prFromEnv(input.env.pr);
1175
1341
  const subject = {
1176
1342
  issue: issueFromTask(input.env.task) ?? input.branchIssue ?? null,
1177
1343
  role,
1178
1344
  ...round !== undefined ? { round } : {},
1345
+ ...pr !== undefined ? { pr } : {},
1179
1346
  ...input.subject ?? {}
1180
1347
  };
1348
+ const issue = subject.issue;
1181
1349
  return {
1182
1350
  meta: {
1183
- schema: 2,
1351
+ schema: 3,
1184
1352
  ts: input.now.toISOString(),
1185
1353
  run_id: input.runId,
1186
1354
  seq: input.seq,
@@ -1203,7 +1371,19 @@ function buildHeader(input) {
1203
1371
  ruling_ordinal: input.inputVersions?.rulingOrdinal ?? null,
1204
1372
  policy_digest: input.inputVersions?.policyDigest ?? null
1205
1373
  },
1206
- provenance: provenanceFor(input)
1374
+ provenance: provenanceFor(input),
1375
+ work: {
1376
+ ref: lineageFieldFromEnv(input.env.workRef) ?? (issue === null ? null : String(issue)),
1377
+ repo: input.repo,
1378
+ change: null,
1379
+ revision: null
1380
+ },
1381
+ flow: {
1382
+ id: lineageFieldFromEnv(input.env.flow) ?? "vinaya",
1383
+ version: lineageFieldFromEnv(input.env.flowVersion)
1384
+ },
1385
+ runtime: lineageFieldFromEnv(input.env.runtime),
1386
+ source: lineageFieldFromEnv(input.env.source)
1207
1387
  },
1208
1388
  subject
1209
1389
  };
@@ -1246,7 +1426,7 @@ function redact(value, home) {
1246
1426
  return value;
1247
1427
  }
1248
1428
  // ../../packages/aeg-core/src/log/store.ts
1249
- var KNOWN_SCHEMA_VERSIONS = [1, 2];
1429
+ var KNOWN_SCHEMA_VERSIONS = [1, 2, 3];
1250
1430
  function metaOf(obj) {
1251
1431
  if (obj === null || typeof obj !== "object")
1252
1432
  return null;
@@ -1312,7 +1492,7 @@ function classifyStoredLine(raw, home) {
1312
1492
  return { status: "invalid", identity: null, raw, reason: "valid event with no derivable identity" };
1313
1493
  }
1314
1494
  const redacted = redact(event, home);
1315
- const provenance = version === 2 ? event.meta.provenance ?? null : null;
1495
+ const provenance = version >= 2 ? event.meta.provenance ?? null : null;
1316
1496
  return {
1317
1497
  status: "ok",
1318
1498
  identity,
@@ -1325,132 +1505,139 @@ function classifyStoredLine(raw, home) {
1325
1505
  };
1326
1506
  }
1327
1507
  // ../../packages/aeg-core/src/control-store/records.ts
1328
- import { z as z3 } from "zod";
1329
- var isoTimestamp = z3.string().min(1);
1330
- var taskId = z3.number().int().positive();
1331
- var epochNumber = z3.number().int().nonnegative();
1332
- var RunRecordSchema = z3.object({
1333
- version: z3.literal(1),
1334
- kind: z3.literal("run"),
1508
+ import { z as z4 } from "zod";
1509
+ var isoTimestamp = z4.string().min(1);
1510
+ var taskId = z4.number().int().positive();
1511
+ var epochNumber = z4.number().int().nonnegative();
1512
+ var RunRecordSchema = z4.object({
1513
+ version: z4.literal(1),
1514
+ kind: z4.literal("run"),
1335
1515
  task: taskId,
1336
- runId: z3.string().min(1),
1337
- pid: z3.number().int().positive(),
1338
- host: z3.string().min(1),
1516
+ runId: z4.string().min(1),
1517
+ pid: z4.number().int().positive(),
1518
+ host: z4.string().min(1),
1339
1519
  startedAt: isoTimestamp,
1340
- childStartedAt: z3.string().min(1).nullable().optional(),
1341
- childCommand: z3.string().min(1).nullable().optional()
1520
+ childStartedAt: z4.string().min(1).nullable().optional(),
1521
+ childCommand: z4.string().min(1).nullable().optional()
1342
1522
  }).strict();
1343
- var InputRecordSchema = z3.object({
1344
- version: z3.literal(1),
1345
- kind: z3.literal("input"),
1523
+ var InputRecordSchema = z4.object({
1524
+ version: z4.literal(1),
1525
+ kind: z4.literal("input"),
1346
1526
  task: taskId,
1347
- runId: z3.string().min(1),
1348
- source: z3.union([z3.literal("fresh"), z3.literal("resume")]),
1349
- pr: z3.number().int().positive().nullable(),
1350
- round: z3.number().int().nonnegative(),
1527
+ runId: z4.string().min(1),
1528
+ source: z4.union([z4.literal("fresh"), z4.literal("resume")]),
1529
+ pr: z4.number().int().positive().nullable(),
1530
+ round: z4.number().int().nonnegative(),
1351
1531
  recordedAt: isoTimestamp
1352
1532
  }).strict();
1353
- var OwnershipRecordSchema = z3.object({
1354
- version: z3.literal(1),
1355
- kind: z3.literal("ownership"),
1533
+ var OwnershipRecordSchema = z4.object({
1534
+ version: z4.literal(1),
1535
+ kind: z4.literal("ownership"),
1356
1536
  task: taskId,
1357
1537
  epoch: epochNumber,
1358
- ownerId: z3.string().min(1),
1359
- pid: z3.number().int().positive(),
1360
- host: z3.string().min(1),
1538
+ ownerId: z4.string().min(1),
1539
+ pid: z4.number().int().positive(),
1540
+ host: z4.string().min(1),
1361
1541
  acquiredAt: isoTimestamp
1362
1542
  }).strict();
1363
- var TransitionRecordSchema = z3.object({
1364
- version: z3.literal(1),
1365
- kind: z3.literal("transition"),
1543
+ var TransitionRecordSchema = z4.object({
1544
+ version: z4.literal(1),
1545
+ kind: z4.literal("transition"),
1366
1546
  task: taskId,
1367
1547
  epoch: epochNumber,
1368
- seq: z3.number().int().nonnegative(),
1369
- from: z3.string().min(1),
1370
- to: z3.string().min(1),
1371
- detail: z3.string().optional(),
1548
+ seq: z4.number().int().nonnegative(),
1549
+ from: z4.string().min(1),
1550
+ to: z4.string().min(1),
1551
+ detail: z4.string().optional(),
1372
1552
  at: isoTimestamp
1373
1553
  }).strict();
1374
- var ManifestRecordSchema = z3.object({
1375
- version: z3.literal(1),
1376
- kind: z3.literal("manifest"),
1554
+ var ManifestRecordSchema = z4.object({
1555
+ version: z4.literal(1),
1556
+ kind: z4.literal("manifest"),
1377
1557
  task: taskId,
1378
1558
  round: epochNumber,
1379
- repository: z3.string().min(1),
1380
- pr: z3.number().int().positive(),
1381
- branch: z3.string().min(1),
1382
- baseSha: z3.string().min(1).nullable(),
1383
- headSha: z3.string().min(1),
1384
- briefHash: z3.string().min(1).nullable(),
1385
- objectivesVersion: z3.string().min(1).nullable(),
1559
+ repository: z4.string().min(1),
1560
+ pr: z4.number().int().positive(),
1561
+ branch: z4.string().min(1),
1562
+ baseSha: z4.string().min(1).nullable(),
1563
+ headSha: z4.string().min(1),
1564
+ briefHash: z4.string().min(1).nullable(),
1565
+ objectivesVersion: z4.string().min(1).nullable(),
1386
1566
  rulingOrdinal: epochNumber,
1387
- policyDigest: z3.string().min(1),
1567
+ policyDigest: z4.string().min(1),
1388
1568
  recordedAt: isoTimestamp
1389
1569
  }).strict();
1390
- var roundHeadIdentity = z3.object({ round: z3.number().int().positive(), head: z3.string().min(1) }).strict();
1391
- var LoopBudgetsSchema = z3.object({
1392
- mechanicalRetries: z3.number().int().nonnegative(),
1393
- reviewRounds: z3.number().int().nonnegative(),
1394
- infrastructureRetries: z3.number().int().nonnegative()
1570
+ var roundHeadIdentity = z4.object({ round: z4.number().int().positive(), head: z4.string().min(1) }).strict();
1571
+ var LoopBudgetsSchema = z4.object({
1572
+ mechanicalRetries: z4.number().int().nonnegative(),
1573
+ reviewRounds: z4.number().int().nonnegative(),
1574
+ infrastructureRetries: z4.number().int().nonnegative()
1395
1575
  }).strict();
1396
- var LoopStateRecordSchema = z3.object({
1397
- version: z3.literal(1),
1398
- kind: z3.literal("loop_state"),
1576
+ var LoopStateRecordSchema = z4.object({
1577
+ version: z4.literal(1),
1578
+ kind: z4.literal("loop_state"),
1399
1579
  task: taskId,
1400
- round: z3.number().int().positive(),
1401
- phase: z3.string().min(1),
1402
- pauseReason: z3.string().min(1).nullable(),
1580
+ round: z4.number().int().positive(),
1581
+ phase: z4.string().min(1),
1582
+ pauseReason: z4.string().min(1).nullable(),
1403
1583
  budgets: LoopBudgetsSchema,
1404
1584
  heldResult: roundHeadIdentity.nullable(),
1405
1585
  deliveredFindings: roundHeadIdentity.nullable(),
1586
+ repeatMemory: z4.object({
1587
+ blockingFindings: z4.array(z4.string()),
1588
+ lastFailure: z4.object({ signature: z4.string(), message: z4.string() }).nullable()
1589
+ }).strict().optional(),
1590
+ publicationExpectedBase: z4.string().regex(/^[0-9a-f]{40}$/).nullable().optional(),
1591
+ taskStartedAt: isoTimestamp.optional(),
1592
+ phaseMs: z4.record(z4.string(), z4.number().nonnegative()).optional(),
1406
1593
  recordedAt: isoTimestamp
1407
1594
  }).strict();
1408
- var EffectRecordSchema = z3.object({
1409
- version: z3.literal(1),
1410
- kind: z3.literal("effect"),
1595
+ var EffectRecordSchema = z4.object({
1596
+ version: z4.literal(1),
1597
+ kind: z4.literal("effect"),
1411
1598
  task: taskId,
1412
- key: z3.string().min(1),
1413
- operation: z3.string().min(1),
1414
- target: z3.string().min(1),
1415
- inputVersion: z3.number().int().nonnegative(),
1416
- payloadDigest: z3.string().min(1),
1417
- status: z3.union([z3.literal("started"), z3.literal("verified"), z3.literal("uncertain")]),
1418
- url: z3.string().optional(),
1599
+ key: z4.string().min(1),
1600
+ operation: z4.string().min(1),
1601
+ target: z4.string().min(1),
1602
+ inputVersion: z4.number().int().nonnegative(),
1603
+ payloadDigest: z4.string().min(1),
1604
+ status: z4.union([z4.literal("started"), z4.literal("verified"), z4.literal("uncertain")]),
1605
+ url: z4.string().optional(),
1419
1606
  recordedAt: isoTimestamp
1420
1607
  }).strict();
1421
- var EscalationRecordSchema = z3.object({
1422
- version: z3.literal(1),
1423
- kind: z3.literal("escalation"),
1608
+ var EscalationRecordSchema = z4.object({
1609
+ version: z4.literal(1),
1610
+ kind: z4.literal("escalation"),
1424
1611
  task: taskId,
1425
- escalationId: z3.string().min(1),
1612
+ escalationId: z4.string().min(1),
1426
1613
  round: epochNumber,
1427
- head: z3.string().min(1),
1428
- branch: z3.string().min(1),
1429
- pr: z3.number().int().positive().nullable(),
1430
- runId: z3.string().min(1),
1431
- pid: z3.number().int().positive(),
1432
- host: z3.string().min(1),
1433
- agent: z3.string().min(1).optional(),
1434
- reason: z3.string().min(1),
1435
- detail: z3.string().optional(),
1436
- evidence: z3.string().optional(),
1437
- attemptedRecovery: z3.string().min(1),
1438
- requestedDecision: z3.string().min(1),
1439
- recipient: z3.string().min(1),
1440
- briefHash: z3.string().min(1).nullable(),
1441
- objectivesVersion: z3.string().min(1).nullable(),
1614
+ head: z4.string().min(1),
1615
+ branch: z4.string().min(1),
1616
+ pr: z4.number().int().positive().nullable(),
1617
+ runId: z4.string().min(1),
1618
+ pid: z4.number().int().positive(),
1619
+ host: z4.string().min(1),
1620
+ agent: z4.string().min(1).optional(),
1621
+ reason: z4.string().min(1),
1622
+ detail: z4.string().optional(),
1623
+ evidence: z4.string().optional(),
1624
+ attemptedRecovery: z4.string().min(1),
1625
+ requestedDecision: z4.string().min(1),
1626
+ recipient: z4.string().min(1),
1627
+ briefHash: z4.string().min(1).nullable(),
1628
+ objectivesVersion: z4.string().min(1).nullable(),
1442
1629
  rulingOrdinal: epochNumber,
1443
- policyDigest: z3.string().min(1),
1630
+ policyDigest: z4.string().min(1),
1444
1631
  recordedAt: isoTimestamp
1445
1632
  }).strict();
1446
- var ResolutionRecordSchema = z3.object({
1447
- version: z3.literal(1),
1448
- kind: z3.literal("resolution"),
1633
+ var ResolutionRecordSchema = z4.object({
1634
+ version: z4.literal(1),
1635
+ kind: z4.literal("resolution"),
1449
1636
  task: taskId,
1450
- escalationId: z3.string().min(1),
1451
- decision: z3.union([z3.literal("resume"), z3.literal("cancel")]),
1452
- authenticatedBy: z3.string().min(1),
1453
- authenticatedFrom: z3.string().min(1),
1637
+ escalationId: z4.string().min(1),
1638
+ decision: z4.union([z4.literal("resume"), z4.literal("cancel")]),
1639
+ authenticatedBy: z4.string().min(1),
1640
+ authenticatedFrom: z4.string().min(1),
1454
1641
  consumedAt: isoTimestamp
1455
1642
  }).strict();
1456
1643
  // ../../packages/aeg-core/src/control-store/local.ts
@@ -1530,8 +1717,8 @@ function mkdirNoSymlinks(dir, mode, trustedRoot) {
1530
1717
  }
1531
1718
  var CONTROL_AREA_DIRNAME = "control";
1532
1719
  // src/checks/registry.ts
1533
- import { existsSync as existsSync3 } from "node:fs";
1534
- import { join as join3 } from "node:path";
1720
+ import { join as join3, relative, sep as sep2 } from "node:path";
1721
+ import { fileURLToPath as fileURLToPath2 } from "node:url";
1535
1722
 
1536
1723
  // src/lib/package-root.ts
1537
1724
  import { existsSync as existsSync2 } from "node:fs";
@@ -1551,10 +1738,14 @@ function packageRoot(moduleUrl) {
1551
1738
  }
1552
1739
 
1553
1740
  // src/checks/registry.ts
1554
- var DIST_BIN_DIR = join3(packageRoot(import.meta.url), "dist", "checks", "bin");
1555
- var SRC_BIN_DIR = join3(packageRoot(import.meta.url), "src", "checks", "bin");
1556
- var BIN_DIR = existsSync3(DIST_BIN_DIR) ? DIST_BIN_DIR : SRC_BIN_DIR;
1557
- var BIN_EXT = BIN_DIR === DIST_BIN_DIR ? ".js" : ".ts";
1741
+ function resolveCheckBin(packageDir, moduleUrl) {
1742
+ const fromPackage = relative(packageDir, fileURLToPath2(moduleUrl));
1743
+ const bundled = fromPackage === "dist" || fromPackage.startsWith(`dist${sep2}`);
1744
+ return bundled ? { dir: join3(packageDir, "dist", "checks", "bin"), ext: ".js" } : { dir: join3(packageDir, "src", "checks", "bin"), ext: ".ts" };
1745
+ }
1746
+ var CHECK_BIN = resolveCheckBin(packageRoot(import.meta.url), import.meta.url);
1747
+ var BIN_DIR = CHECK_BIN.dir;
1748
+ var BIN_EXT = CHECK_BIN.ext;
1558
1749
  function bin(name) {
1559
1750
  return join3(BIN_DIR, `${name}${BIN_EXT}`);
1560
1751
  }
@@ -1752,23 +1943,6 @@ var REGISTRY = [
1752
1943
  },
1753
1944
  1
1754
1945
  ],
1755
- [
1756
- {
1757
- name: "token-report",
1758
- validates: "body",
1759
- run: bin("check-token-report"),
1760
- scope: "diff",
1761
- timeoutMs: 15000,
1762
- requiresOpenPr: true,
1763
- env: {
1764
- PR_BODY: { optional: true },
1765
- BRANCH: { optional: true },
1766
- CLAUDE_PROJECT_DIR: { optional: true },
1767
- CLAUDE_CODE_SESSION_ID: { optional: true }
1768
- }
1769
- },
1770
- 1
1771
- ],
1772
1946
  [
1773
1947
  {
1774
1948
  name: "no-disk-state",
@@ -2118,49 +2292,52 @@ var CORE_CHECK_RING = Object.fromEntries(REGISTRY.map(([spec, ring]) => [spec.na
2118
2292
  import { execFile as execFile5 } from "node:child_process";
2119
2293
  import { randomUUID as randomUUID2 } from "node:crypto";
2120
2294
  import {
2121
- closeSync as closeSync4,
2122
- constants as fsConstants4,
2295
+ appendFileSync,
2296
+ closeSync as closeSync5,
2297
+ constants as fsConstants5,
2123
2298
  existsSync as existsSync6,
2124
- fstatSync as fstatSync2,
2125
- mkdirSync as mkdirSync4,
2126
- openSync as openSync4,
2127
- readFileSync as readFileSync5,
2299
+ fstatSync as fstatSync3,
2300
+ mkdirSync as mkdirSync5,
2301
+ lstatSync as lstatSync3,
2302
+ openSync as openSync5,
2303
+ readFileSync as readFileSync6,
2128
2304
  renameSync as renameSync3,
2129
- writeSync as writeSync3
2305
+ writeFileSync as writeFileSync3,
2306
+ writeSync as writeSync4
2130
2307
  } from "node:fs";
2131
2308
  import { hostname as osHostname, homedir as homedir3 } from "node:os";
2132
- import { dirname as dirname6, join as join7 } from "node:path";
2309
+ import { dirname as dirname7, join as join7 } from "node:path";
2133
2310
  import { promisify as promisify5 } from "node:util";
2134
2311
 
2135
2312
  // src/lib/config.ts
2136
2313
  import { execFile as execFile4, execFileSync as execFileSync2 } from "node:child_process";
2137
2314
  import { promisify as promisify4 } from "node:util";
2138
- import { existsSync as existsSync4, mkdirSync as mkdirSync2, readFileSync as readFileSync3, realpathSync, writeFileSync } from "node:fs";
2315
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, realpathSync, writeFileSync } from "node:fs";
2139
2316
  import { homedir } from "node:os";
2140
2317
  import { dirname as dirname3, isAbsolute, join as join4, resolve as resolve2 } from "node:path";
2141
- import { z as z4 } from "zod";
2318
+ import { z as z5 } from "zod";
2142
2319
 
2143
2320
  // src/lib/agent-vendors.ts
2144
2321
  var AGENT_VENDORS = ["skills", "claude", "gemini"];
2145
2322
 
2146
2323
  // src/lib/config.ts
2147
- var EnvEntrySchema = z4.union([
2148
- z4.literal(true),
2149
- z4.object({ optional: z4.literal(true) }),
2150
- z4.object({ anyOf: z4.array(z4.string()).min(2) }),
2151
- z4.string()
2324
+ var EnvEntrySchema = z5.union([
2325
+ z5.literal(true),
2326
+ z5.object({ optional: z5.literal(true) }),
2327
+ z5.object({ anyOf: z5.array(z5.string()).min(2) }),
2328
+ z5.string()
2152
2329
  ]);
2153
- var CheckEntrySchema = z4.object({
2154
- run: z4.string(),
2155
- scope: z4.enum(["diff", "full"]),
2156
- include: z4.array(z4.string()).optional(),
2157
- args: z4.array(z4.string()).optional(),
2158
- timeoutMs: z4.number().optional(),
2159
- env: z4.record(z4.string(), EnvEntrySchema).optional(),
2160
- requiresOpenPr: z4.boolean().optional(),
2161
- ownWorkflow: z4.boolean().optional(),
2162
- principalOwed: z4.literal(true).optional(),
2163
- validates: z4.enum(["body", "issue"]).optional()
2330
+ var CheckEntrySchema = z5.object({
2331
+ run: z5.string(),
2332
+ scope: z5.enum(["diff", "full"]),
2333
+ include: z5.array(z5.string()).optional(),
2334
+ args: z5.array(z5.string()).optional(),
2335
+ timeoutMs: z5.number().optional(),
2336
+ env: z5.record(z5.string(), EnvEntrySchema).optional(),
2337
+ requiresOpenPr: z5.boolean().optional(),
2338
+ ownWorkflow: z5.boolean().optional(),
2339
+ principalOwed: z5.literal(true).optional(),
2340
+ validates: z5.enum(["body", "issue"]).optional()
2164
2341
  }).superRefine((entry, ctx) => {
2165
2342
  if (!entry.env)
2166
2343
  return;
@@ -2170,22 +2347,22 @@ var CheckEntrySchema = z4.object({
2170
2347
  const members = value.anyOf;
2171
2348
  if (new Set(members).size !== members.length) {
2172
2349
  ctx.addIssue({
2173
- code: z4.ZodIssueCode.custom,
2350
+ code: z5.ZodIssueCode.custom,
2174
2351
  message: `env.${key}.anyOf has duplicate members`,
2175
2352
  path: ["env", key, "anyOf"]
2176
2353
  });
2177
2354
  }
2178
2355
  if (!members.includes(key)) {
2179
2356
  ctx.addIssue({
2180
- code: z4.ZodIssueCode.custom,
2357
+ code: z5.ZodIssueCode.custom,
2181
2358
  message: `env.${key}.anyOf must include "${key}" itself as a member`,
2182
2359
  path: ["env", key, "anyOf"]
2183
2360
  });
2184
2361
  }
2185
2362
  }
2186
2363
  });
2187
- var RoleEntrySchema = z4.object({
2188
- contract: z4.string().refine((p) => p.includes("/"), {
2364
+ var RoleEntrySchema = z5.object({
2365
+ contract: z5.string().refine((p) => p.includes("/"), {
2189
2366
  message: 'must be a path (contain at least one "/"), not a bare filename'
2190
2367
  })
2191
2368
  });
@@ -2209,17 +2386,17 @@ var BRIEF_BUILTINS = [
2209
2386
  "briefSections",
2210
2387
  "milestoneShape"
2211
2388
  ];
2212
- var BriefSectionSchema = z4.union([
2213
- z4.object({ builtin: z4.enum(BRIEF_BUILTINS) }),
2214
- z4.object({ heading: z4.string().min(1), name: z4.string().optional() }),
2215
- z4.object({ field: z4.string().min(1), name: z4.string().optional() }),
2216
- z4.object({ phrase: z4.string().min(1), name: z4.string().optional() })
2389
+ var BriefSectionSchema = z5.union([
2390
+ z5.object({ builtin: z5.enum(BRIEF_BUILTINS) }),
2391
+ z5.object({ heading: z5.string().min(1), name: z5.string().optional() }),
2392
+ z5.object({ field: z5.string().min(1), name: z5.string().optional() }),
2393
+ z5.object({ phrase: z5.string().min(1), name: z5.string().optional() })
2217
2394
  ]);
2218
- var BriefSchemaSchema = z4.object({
2219
- pr: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2220
- issue: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2221
- milestone: z4.object({ sections: z4.array(BriefSectionSchema) }).optional(),
2222
- ack: z4.array(z4.enum(BRIEF_BUILTINS)).optional()
2395
+ var BriefSchemaSchema = z5.object({
2396
+ pr: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
2397
+ issue: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
2398
+ milestone: z5.object({ sections: z5.array(BriefSectionSchema) }).optional(),
2399
+ ack: z5.array(z5.enum(BRIEF_BUILTINS)).optional()
2223
2400
  });
2224
2401
  function isSafeRepoRelPath(p) {
2225
2402
  if (p.length === 0)
@@ -2228,7 +2405,7 @@ function isSafeRepoRelPath(p) {
2228
2405
  return false;
2229
2406
  return p.split(/[\\/]/).every((seg) => seg !== ".." && seg !== "");
2230
2407
  }
2231
- var SafeRepoRelPath = z4.string().refine(isSafeRepoRelPath, {
2408
+ var SafeRepoRelPath = z5.string().refine(isSafeRepoRelPath, {
2232
2409
  message: "must be a repo-root-relative path with no `..` segment or absolute root"
2233
2410
  });
2234
2411
  var CANONICAL_HOOK_BLOCK_PREFIXES = [".git/", ".husky/", ".vinaya/hooks/", ".claude/hooks/"];
@@ -2238,22 +2415,22 @@ function isCanonicalHookBlockPath(p) {
2238
2415
  var ManagedHookBlockPath = SafeRepoRelPath.refine(isCanonicalHookBlockPath, {
2239
2416
  message: `must start with one of ${CANONICAL_HOOK_BLOCK_PREFIXES.join(", ")} (byte-exact, case-sensitive)`
2240
2417
  });
2241
- var ManagedBlockRecordSchema = z4.object({
2418
+ var ManagedBlockRecordSchema = z5.object({
2242
2419
  path: ManagedHookBlockPath,
2243
- marker: z4.string(),
2244
- comment: z4.enum(["hash", "html"])
2420
+ marker: z5.string(),
2421
+ comment: z5.enum(["hash", "html"])
2245
2422
  });
2246
- var ManagedManifestSchema = z4.object({
2247
- version: z4.number().int().positive(),
2248
- files: z4.array(SafeRepoRelPath),
2249
- blocks: z4.array(ManagedBlockRecordSchema),
2250
- labels: z4.array(z4.string()),
2251
- agents: z4.array(z4.enum(AGENT_VENDORS)).optional()
2423
+ var ManagedManifestSchema = z5.object({
2424
+ version: z5.number().int().positive(),
2425
+ files: z5.array(SafeRepoRelPath),
2426
+ blocks: z5.array(ManagedBlockRecordSchema),
2427
+ labels: z5.array(z5.string()),
2428
+ agents: z5.array(z5.enum(AGENT_VENDORS)).optional()
2252
2429
  });
2253
- var ProjectEntrySchema = z4.object({
2254
- name: z4.string().min(1),
2255
- description: z4.string().min(1).optional(),
2256
- path: z4.string().min(1).optional()
2430
+ var ProjectEntrySchema = z5.object({
2431
+ name: z5.string().min(1),
2432
+ description: z5.string().min(1).optional(),
2433
+ path: z5.string().min(1).optional()
2257
2434
  });
2258
2435
  function parseTokensCollectDeclaration(value) {
2259
2436
  const m = value.trim().match(/^(\S+)\s+(\S+)$/);
@@ -2264,87 +2441,97 @@ function parseTokensCollectDeclaration(value) {
2264
2441
  return null;
2265
2442
  return { interpreter, script };
2266
2443
  }
2267
- var VinayaConfigSchema = z4.object({
2268
- rings: z4.object({
2269
- ring1_forgeWriteInterception: z4.boolean(),
2270
- ring2_asyncAudits: z4.boolean()
2444
+ var VinayaConfigSchema = z5.object({
2445
+ rings: z5.object({
2446
+ ring1_forgeWriteInterception: z5.boolean(),
2447
+ ring2_asyncAudits: z5.boolean()
2271
2448
  }).optional(),
2272
- checks: z4.record(z4.string(), CheckEntrySchema).optional(),
2273
- roles: z4.record(z4.string(), RoleEntrySchema).optional(),
2449
+ checks: z5.record(z5.string(), CheckEntrySchema).optional(),
2450
+ roles: z5.record(z5.string(), RoleEntrySchema).optional(),
2274
2451
  briefSchema: BriefSchemaSchema.optional(),
2275
2452
  managed: ManagedManifestSchema.optional(),
2276
- principals: z4.array(z4.string()).min(1).optional(),
2277
- releaseActor: z4.string().min(1).optional(),
2278
- ci: z4.object({ setup: z4.string().min(1) }).optional(),
2279
- tokens: z4.object({
2280
- collect: z4.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
2453
+ principals: z5.array(z5.string()).min(1).optional(),
2454
+ releaseActor: z5.string().min(1).optional(),
2455
+ ci: z5.object({ setup: z5.string().min(1) }).optional(),
2456
+ tokens: z5.object({
2457
+ collect: z5.string().min(1).refine((v) => parseTokensCollectDeclaration(v) !== null, {
2281
2458
  message: 'tokens.collect must be exactly "<interpreter> <repo-relative-script-path>" — two whitespace-separated tokens, no flags, no shell syntax, no quoting'
2282
2459
  })
2283
2460
  }).optional(),
2284
- blastRadius: z4.object({ extraDomains: z4.array(z4.string()).optional() }).optional(),
2285
- proseGates: z4.object({
2286
- doctrineRoot: z4.string().min(1).optional(),
2287
- readerFacingPrefix: z4.string().min(1).optional(),
2288
- readerFacingSuffix: z4.string().min(1).optional(),
2289
- legacySlugDir: z4.string().min(1).optional(),
2290
- sourceComments: z4.object({
2291
- globs: z4.array(z4.string().min(1)).optional(),
2292
- allowlist: z4.array(z4.string().min(1)).optional(),
2293
- severity: z4.enum(["warning", "error"]).optional()
2461
+ blastRadius: z5.object({ extraDomains: z5.array(z5.string()).optional() }).optional(),
2462
+ proseGates: z5.object({
2463
+ doctrineRoot: z5.string().min(1).optional(),
2464
+ readerFacingPrefix: z5.string().min(1).optional(),
2465
+ readerFacingSuffix: z5.string().min(1).optional(),
2466
+ legacySlugDir: z5.string().min(1).optional(),
2467
+ sourceComments: z5.object({
2468
+ globs: z5.array(z5.string().min(1)).optional(),
2469
+ allowlist: z5.array(z5.string().min(1)).optional(),
2470
+ severity: z5.enum(["warning", "error"]).optional()
2294
2471
  }).optional(),
2295
- specGrandfather: z4.array(z4.string().min(1)).optional(),
2296
- specPaths: z4.array(z4.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
2472
+ specGrandfather: z5.union([z5.array(z5.string().min(1)), z5.record(z5.string().min(1), z5.number().int().min(0))]).optional(),
2473
+ specPaths: z5.array(z5.string().min(1).refine((entry) => !entry.startsWith("/") && !/^[A-Za-z]:/.test(entry), {
2297
2474
  message: "must be a repository-relative path, not an absolute one"
2298
2475
  }).refine((entry) => !entry.split(/[\\/]/).includes(".."), {
2299
2476
  message: "must stay inside the repository — no `..` segment"
2300
2477
  })).optional()
2301
2478
  }).optional(),
2302
- projects: z4.array(ProjectEntrySchema).optional(),
2303
- dispatch: z4.object({
2304
- timeoutMs: z4.number().int().positive().optional(),
2305
- killGraceMs: z4.number().int().positive().optional(),
2306
- agent: z4.enum(["claude", "codex", "gemini"]).optional(),
2307
- requireWorkerIsolation: z4.boolean().optional()
2479
+ projects: z5.array(ProjectEntrySchema).optional(),
2480
+ dispatch: z5.object({
2481
+ timeoutMs: z5.number().int().positive().optional(),
2482
+ killGraceMs: z5.number().int().positive().optional(),
2483
+ agent: z5.enum(["claude", "codex", "gemini"]).optional()
2484
+ }).optional(),
2485
+ reviewPolicy: z5.object({
2486
+ codeReviewThreshold: z5.string().min(1).optional(),
2487
+ securityThreshold: z5.string().min(1).optional(),
2488
+ maxRounds: z5.number().optional(),
2489
+ maxTaskMinutes: z5.number().optional()
2308
2490
  }).optional(),
2309
- reviewPolicy: z4.object({
2310
- codeReviewThreshold: z4.string().min(1).optional(),
2311
- securityThreshold: z4.string().min(1).optional(),
2312
- maxRounds: z4.number().optional()
2491
+ securityScan: z5.object({
2492
+ command: z5.array(z5.string().min(1)).min(1)
2313
2493
  }).optional(),
2314
- gateCutovers: z4.object({
2315
- objectivesSinceIssue: z4.number().int().nonnegative().optional(),
2316
- briefSectionsSinceIssue: z4.number().int().nonnegative().optional(),
2317
- documentationSinceIssue: z4.number().int().nonnegative().optional(),
2318
- briefRulesSincePr: z4.number().int().nonnegative().optional(),
2319
- agentBoxesRefusedSincePr: z4.number().int().nonnegative().optional()
2494
+ gateCutovers: z5.object({
2495
+ objectivesSinceIssue: z5.number().int().nonnegative().optional(),
2496
+ briefSectionsSinceIssue: z5.number().int().nonnegative().optional(),
2497
+ documentationSinceIssue: z5.number().int().nonnegative().optional(),
2498
+ briefRulesSincePr: z5.number().int().nonnegative().optional(),
2499
+ agentBoxesRefusedSincePr: z5.number().int().nonnegative().optional()
2320
2500
  }).optional(),
2321
- prePush: z4.object({
2322
- alwaysRun: z4.array(z4.string()).optional()
2501
+ planning: z5.object({
2502
+ collisionThreshold: z5.number().int().nonnegative().optional()
2323
2503
  }).optional(),
2324
- report: z4.object({
2325
- commandTimeoutMs: z4.number().int().positive().optional()
2504
+ prePush: z5.object({
2505
+ alwaysRun: z5.array(z5.string()).optional()
2506
+ }).optional(),
2507
+ report: z5.object({
2508
+ commandTimeoutMs: z5.number().int().positive().optional()
2326
2509
  }).superRefine((report, ctx) => {
2327
2510
  const commandTimeoutMs = report.commandTimeoutMs;
2328
2511
  if (commandTimeoutMs !== undefined && commandTimeoutMs > MAX_REPORT_COMMAND_TIMEOUT_MS) {
2329
2512
  ctx.addIssue({
2330
- code: z4.ZodIssueCode.custom,
2513
+ code: z5.ZodIssueCode.custom,
2331
2514
  path: ["commandTimeoutMs"],
2332
2515
  message: "must be at most 3600000 (1 hour)"
2333
2516
  });
2334
2517
  }
2335
2518
  }).optional(),
2336
- logPublish: z4.unknown().refine((v) => v === undefined, {
2519
+ logPublish: z5.unknown().refine((v) => v === undefined, {
2337
2520
  message: "logPublish is removed — telemetry is never posted to a tracker or a code host; configure `logs` instead (a folder or a server destination)"
2338
2521
  }),
2339
- runtimeDir: z4.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
2340
- logs: z4.object({
2341
- folder: z4.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
2342
- url: z4.string().url().optional(),
2343
- headers: z4.record(z4.string()).optional()
2522
+ runtimeDir: z5.string().min(1).refine((v) => isAbsolute(v), { message: "runtimeDir: must be an absolute path" }).optional(),
2523
+ logs: z5.object({
2524
+ folder: z5.string().min(1).refine((v) => isAbsolute(v), { message: "logs.folder: must be an absolute path" }).optional(),
2525
+ url: z5.string().url().optional(),
2526
+ headers: z5.record(z5.string()).optional(),
2527
+ readHeaders: z5.record(z5.string()).optional(),
2528
+ events: CustomEventDeclarationsSchema.optional()
2344
2529
  }).refine((v) => [v.folder, v.url].filter((x) => x !== undefined).length <= 1, {
2345
2530
  message: "logs: set at most one of folder/url"
2346
2531
  }).refine((v) => v.headers === undefined || v.url !== undefined, {
2347
2532
  message: "logs: headers requires url"
2533
+ }).refine((v) => v.readHeaders === undefined || v.url !== undefined, {
2534
+ message: "logs: readHeaders requires url"
2348
2535
  }).optional()
2349
2536
  });
2350
2537
  var GLOBAL_VINAYA_HOME = join4(homedir(), ".vinaya");
@@ -2354,9 +2541,9 @@ function findLocalConfig() {
2354
2541
  let dir = process.cwd();
2355
2542
  while (true) {
2356
2543
  const candidate = join4(dir, LOCAL_CONFIG_FILENAME);
2357
- if (existsSync4(candidate))
2544
+ if (existsSync3(candidate))
2358
2545
  return candidate;
2359
- if (existsSync4(join4(dir, ".git")))
2546
+ if (existsSync3(join4(dir, ".git")))
2360
2547
  return null;
2361
2548
  const parent = dirname3(dir);
2362
2549
  if (parent === dir)
@@ -2368,7 +2555,7 @@ function configPath() {
2368
2555
  const local = findLocalConfig();
2369
2556
  if (local)
2370
2557
  return local;
2371
- if (existsSync4(GLOBAL_CONFIG_PATH))
2558
+ if (existsSync3(GLOBAL_CONFIG_PATH))
2372
2559
  return GLOBAL_CONFIG_PATH;
2373
2560
  return null;
2374
2561
  }
@@ -2619,7 +2806,7 @@ var TOKENS_COLLECT_TRUST_PATH = join4(GLOBAL_VINAYA_HOME, "tokens-collect-trust.
2619
2806
 
2620
2807
  // src/lib/run-paths.ts
2621
2808
  import { execFileSync as execFileSync3 } from "node:child_process";
2622
- import { chmodSync, existsSync as existsSync5, realpathSync as realpathSync2 } from "node:fs";
2809
+ import { chmodSync, existsSync as existsSync4, realpathSync as realpathSync2 } from "node:fs";
2623
2810
  import { dirname as dirname4, join as join5, resolve as resolvePath } from "node:path";
2624
2811
  var TASKS_EXECUTION_DIRNAME = "tasks-execution";
2625
2812
  var RUN_AREA_DIRNAMES = {
@@ -2749,7 +2936,7 @@ function repoRootSync(start = process.cwd()) {
2749
2936
  return null;
2750
2937
  }
2751
2938
  for (;; ) {
2752
- if (existsSync5(join5(dir, ".git")))
2939
+ if (existsSync4(join5(dir, ".git")))
2753
2940
  return dir;
2754
2941
  const parent = dirname4(dir);
2755
2942
  if (parent === dir)
@@ -2793,25 +2980,62 @@ function ensureRunDir(dir, runtimeDir) {
2793
2980
  chmodSync(dir, 448);
2794
2981
  }
2795
2982
 
2796
- // src/lib/log-webhook-drain.ts
2983
+ // src/lib/loop-log.ts
2797
2984
  import {
2798
2985
  closeSync as closeSync3,
2799
2986
  constants as fsConstants3,
2800
- lstatSync as lstatSync2,
2987
+ existsSync as existsSync5,
2988
+ fstatSync as fstatSync2,
2801
2989
  mkdirSync as mkdirSync3,
2802
2990
  openSync as openSync3,
2803
- linkSync as linkSync2,
2804
2991
  readFileSync as readFileSync4,
2805
- renameSync as renameSync2,
2992
+ readSync,
2806
2993
  statSync as statSync2,
2994
+ writeSync as writeSync2
2995
+ } from "node:fs";
2996
+ import { dirname as dirname5 } from "node:path";
2997
+ function loopsRoot() {
2998
+ return runtimeDirForThisRepo();
2999
+ }
3000
+ function loopLogPathFor(_repo, issue, root = loopsRoot()) {
3001
+ return runPath(root, issue, { area: "output", file: "driver.log" });
3002
+ }
3003
+ var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
3004
+ function appendLoopLogLine(path, line) {
3005
+ try {
3006
+ mkdirSync3(dirname5(path), { recursive: true, mode: 448 });
3007
+ const fd = openSync3(path, fsConstants3.O_WRONLY | fsConstants3.O_APPEND | fsConstants3.O_CREAT | fsConstants3.O_NOFOLLOW, 384);
3008
+ try {
3009
+ const stat = fstatSync2(fd);
3010
+ if (stat.isFile() && stat.size < LOOP_LOG_MAX_BYTES) {
3011
+ writeSync2(fd, `${line}
3012
+ `);
3013
+ }
3014
+ } finally {
3015
+ closeSync3(fd);
3016
+ }
3017
+ } catch {}
3018
+ }
3019
+
3020
+ // src/lib/log-webhook-drain.ts
3021
+ import {
3022
+ closeSync as closeSync4,
3023
+ constants as fsConstants4,
3024
+ lstatSync as lstatSync2,
3025
+ mkdirSync as mkdirSync4,
3026
+ openSync as openSync4,
3027
+ linkSync as linkSync2,
3028
+ readFileSync as readFileSync5,
3029
+ renameSync as renameSync2,
3030
+ statSync as statSync3,
2807
3031
  unlinkSync as unlinkSync2,
2808
3032
  utimesSync,
2809
3033
  writeFileSync as writeFileSync2,
2810
- writeSync as writeSync2
3034
+ writeSync as writeSync3
2811
3035
  } from "node:fs";
2812
3036
  import { randomUUID } from "node:crypto";
2813
3037
  import { homedir as homedir2 } from "node:os";
2814
- import { dirname as dirname5, join as join6 } from "node:path";
3038
+ import { dirname as dirname6, join as join6 } from "node:path";
2815
3039
  var MAX_WEBHOOK_BODY_BYTES = 5 * 1024 * 1024;
2816
3040
  var WEBHOOK_FETCH_TIMEOUT_MS = 30000;
2817
3041
  var SAFE_PATH_SEGMENT2 = /^[A-Za-z0-9](?:[A-Za-z0-9._-]*[A-Za-z0-9])?$/;
@@ -2827,13 +3051,13 @@ function isEnoent(err) {
2827
3051
  var WEBHOOK_DRAIN_LOCK_STALE_MS = 4 * WEBHOOK_FETCH_TIMEOUT_MS;
2828
3052
  function tryCreateLock(lockPath, token) {
2829
3053
  try {
2830
- mkdirSync3(dirname5(lockPath), { recursive: true, mode: 448 });
2831
- const fd = openSync3(lockPath, fsConstants3.O_WRONLY | fsConstants3.O_CREAT | fsConstants3.O_EXCL, 384);
3054
+ mkdirSync4(dirname6(lockPath), { recursive: true, mode: 448 });
3055
+ const fd = openSync4(lockPath, fsConstants4.O_WRONLY | fsConstants4.O_CREAT | fsConstants4.O_EXCL, 384);
2832
3056
  try {
2833
- writeSync2(fd, `${token}
3057
+ writeSync3(fd, `${token}
2834
3058
  `);
2835
3059
  } finally {
2836
- closeSync3(fd);
3060
+ closeSync4(fd);
2837
3061
  }
2838
3062
  return true;
2839
3063
  } catch (err) {
@@ -2848,7 +3072,7 @@ function acquireDrainLock(lockPath) {
2848
3072
  return token;
2849
3073
  let observedMtimeMs;
2850
3074
  try {
2851
- observedMtimeMs = statSync2(lockPath).mtimeMs;
3075
+ observedMtimeMs = statSync3(lockPath).mtimeMs;
2852
3076
  } catch (err) {
2853
3077
  if (!isEnoent(err))
2854
3078
  throw err;
@@ -2866,7 +3090,7 @@ function acquireDrainLock(lockPath) {
2866
3090
  }
2867
3091
  let claimedMtimeMs = null;
2868
3092
  try {
2869
- claimedMtimeMs = statSync2(claimed).mtimeMs;
3093
+ claimedMtimeMs = statSync3(claimed).mtimeMs;
2870
3094
  } catch (err) {
2871
3095
  if (!isEnoent(err))
2872
3096
  throw err;
@@ -2892,7 +3116,7 @@ function acquireDrainLock(lockPath) {
2892
3116
  function renewDrainLock(lockPath, token) {
2893
3117
  let holder;
2894
3118
  try {
2895
- holder = readFileSync4(lockPath, "utf8").trim();
3119
+ holder = readFileSync5(lockPath, "utf8").trim();
2896
3120
  } catch (err) {
2897
3121
  if (!isEnoent(err))
2898
3122
  throw err;
@@ -2912,7 +3136,7 @@ function renewDrainLock(lockPath, token) {
2912
3136
  }
2913
3137
  function releaseDrainLock(lockPath, token) {
2914
3138
  try {
2915
- const holder = readFileSync4(lockPath, "utf8").trim();
3139
+ const holder = readFileSync5(lockPath, "utf8").trim();
2916
3140
  if (holder !== token)
2917
3141
  return;
2918
3142
  unlinkSync2(lockPath);
@@ -2962,7 +3186,7 @@ function queueLines(buf) {
2962
3186
  return lines;
2963
3187
  }
2964
3188
  function removeQueueHead(path, cut) {
2965
- const remaining = readFileSync4(path);
3189
+ const remaining = readFileSync5(path);
2966
3190
  writeFileSync2(path, remaining.subarray(Math.min(cut, remaining.byteLength)));
2967
3191
  }
2968
3192
  function queueBucketSize(path) {
@@ -2983,7 +3207,7 @@ function queueBucketSize(path) {
2983
3207
  function readQueueFile(path) {
2984
3208
  if (queueBucketSize(path) === null)
2985
3209
  return null;
2986
- return readFileSync4(path);
3210
+ return readFileSync5(path);
2987
3211
  }
2988
3212
  function rejectLine(rejectedPath, reason, status, identity, raw) {
2989
3213
  const record = JSON.stringify({
@@ -3165,13 +3389,19 @@ function logsCredentialMissing(headers, env) {
3165
3389
  const varPattern = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}/g;
3166
3390
  for (const value of Object.values(headers)) {
3167
3391
  for (const match of value.matchAll(varPattern)) {
3168
- if (!env[match[1]])
3169
- return true;
3392
+ const name = match[1];
3393
+ if (env[name])
3394
+ continue;
3395
+ return true;
3170
3396
  }
3171
3397
  }
3172
3398
  return false;
3173
3399
  }
3174
3400
  function resolveLogDestinationFrom(input) {
3401
+ const spoolDir = input.env.VINAYA_LOG_SPOOL_DIR;
3402
+ if (spoolDir !== undefined && spoolDir.trim() !== "") {
3403
+ return { kind: "folder", folder: spoolDir };
3404
+ }
3175
3405
  const local = resolveLogsSetting(input.localConfig);
3176
3406
  let effective = null;
3177
3407
  let fallbackReason;
@@ -3211,23 +3441,72 @@ function resolveLogDestinationFrom(input) {
3211
3441
  const folder = effective && "folder" in effective ? effective.folder : input.defaultFolder;
3212
3442
  return fallbackReason ? { kind: "folder", folder, fallbackReason } : { kind: "folder", folder };
3213
3443
  }
3214
- var processTrustAnchorOnce;
3215
- function processTrustAnchor() {
3216
- if (processTrustAnchorOnce === undefined)
3217
- processTrustAnchorOnce = safeLoadTrustAnchorConfig();
3218
- return processTrustAnchorOnce;
3444
+ var processTrustAnchorByRepo = new Map;
3445
+ function processTrustAnchor(repoRoot) {
3446
+ const cached = processTrustAnchorByRepo.get(repoRoot);
3447
+ if (cached !== undefined)
3448
+ return cached;
3449
+ const reading = safeLoadTrustAnchorConfig();
3450
+ processTrustAnchorByRepo.set(repoRoot, reading);
3451
+ return reading;
3219
3452
  }
3220
3453
  async function defaultResolveLogDestination(repo, env) {
3221
3454
  const localConfig = loadConfig();
3222
3455
  const unattended = isUnattendedProcess(process.env);
3456
+ const repoRoot = repoRootSync();
3223
3457
  return resolveLogDestinationFrom({
3224
3458
  localConfig,
3225
- trustAnchorConfig: unattended ? await processTrustAnchor() : null,
3459
+ trustAnchorConfig: unattended ? await processTrustAnchor(repoRoot) : null,
3226
3460
  unattended,
3227
3461
  env,
3228
3462
  defaultFolder: join7(await runtimeDirForRepoAsync(repo), "logs"),
3229
- repoRoot: repoRootSync()
3463
+ repoRoot
3464
+ });
3465
+ }
3466
+ function unresolvedLogDestination(env) {
3467
+ if (hostFromEnv(env) === "ci") {
3468
+ return {
3469
+ kind: "none",
3470
+ reason: "the process ended before its log destination was resolved, and a CI job never records to a folder"
3471
+ };
3472
+ }
3473
+ const loaded = loadConfig();
3474
+ const localConfig = loaded?.logs?.url !== undefined ? { ...loaded, logs: undefined } : loaded;
3475
+ const unattended = isUnattendedProcess(process.env);
3476
+ const repoRoot = repoRootSync();
3477
+ const runtimeDir = process.env[RUNTIME_DIR_ENV_KEY] || resolveRuntimeDir({ repo: null, localConfig, trustAnchorConfig: null, unattended, repoRoot });
3478
+ const defaultFolder = join7(runtimeDir, "logs");
3479
+ const resolved = resolveLogDestinationFrom({
3480
+ localConfig,
3481
+ trustAnchorConfig: null,
3482
+ unattended,
3483
+ env,
3484
+ defaultFolder,
3485
+ repoRoot
3230
3486
  });
3487
+ return resolved.kind === "folder" ? resolved : { kind: "folder", folder: defaultFolder };
3488
+ }
3489
+ function folderFallbackStatePath(repo, stateRoot = GLOBAL_VINAYA_HOME) {
3490
+ const dirName = repo ? `${repo.owner}-${repo.repo}` : "unresolved";
3491
+ return join7(stateRoot, "fallback", `${dirName}.json`);
3492
+ }
3493
+ function recordFolderFallback(repo, issue, reason, now, runtimeDir, stateRoot = GLOBAL_VINAYA_HOME) {
3494
+ const message = describeFolderFallback(reason);
3495
+ if (issue !== null) {
3496
+ appendLoopLogLine(loopLogPathFor(repo, issue, runtimeDir), `[log] ${message}`);
3497
+ }
3498
+ try {
3499
+ const record = {
3500
+ at: now.toISOString(),
3501
+ reason: message,
3502
+ intendedUrl: reason.intendedUrl,
3503
+ kind: reason.kind
3504
+ };
3505
+ const path = folderFallbackStatePath(repo, stateRoot);
3506
+ mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
3507
+ writeFileSync3(path, `${JSON.stringify(record)}
3508
+ `, { mode: 384 });
3509
+ } catch {}
3231
3510
  }
3232
3511
  function isEnoent2(err) {
3233
3512
  return typeof err === "object" && err !== null && err.code === "ENOENT";
@@ -3341,7 +3620,7 @@ async function resolveBranchIssue(cwd, env = process.env, repo = null) {
3341
3620
  }
3342
3621
  function readVinayaVersion() {
3343
3622
  try {
3344
- const pkg = JSON.parse(readFileSync5(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
3623
+ const pkg = JSON.parse(readFileSync6(join7(packageRoot(import.meta.url), "package.json"), "utf8"));
3345
3624
  return pkg.version ?? "unknown";
3346
3625
  } catch {
3347
3626
  return "unknown";
@@ -3379,6 +3658,7 @@ function defaultStderr(message) {
3379
3658
  }
3380
3659
  var branchIssueFallbackEnabled = true;
3381
3660
  var branchIssueByCwd = new Map;
3661
+ var branchIssueSettledByCwd = new Map;
3382
3662
  function branchIssueRead(key, read, shared) {
3383
3663
  if (!shared)
3384
3664
  return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
@@ -3387,8 +3667,30 @@ function branchIssueRead(key, read, shared) {
3387
3667
  return cached;
3388
3668
  const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
3389
3669
  branchIssueByCwd.set(key, reading);
3670
+ reading.then((value) => branchIssueSettledByCwd.set(key, value));
3390
3671
  return reading;
3391
3672
  }
3673
+ var headShaByCwd = new Map;
3674
+ var headShaSettledByCwd = new Map;
3675
+ function headShaRead(key, read, shared) {
3676
+ if (!shared)
3677
+ return withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
3678
+ const cached = headShaByCwd.get(key);
3679
+ if (cached !== undefined)
3680
+ return cached;
3681
+ const reading = withDeadline(Promise.resolve().then(read), LOG_CONTEXT_LOOKUP_DEADLINE_MS, null);
3682
+ headShaByCwd.set(key, reading);
3683
+ reading.then((value) => headShaSettledByCwd.set(key, value));
3684
+ return reading;
3685
+ }
3686
+ async function resolveHeadSha(cwd) {
3687
+ try {
3688
+ const out = (await execFileAsync5("git", ["-C", cwd, "rev-parse", "HEAD"], { encoding: "utf8" })).stdout.trim();
3689
+ return /^[0-9a-f]{40}$/.test(out) ? out : null;
3690
+ } catch {
3691
+ return null;
3692
+ }
3693
+ }
3392
3694
  function defaultDeps() {
3393
3695
  return {
3394
3696
  outboxRoot: () => join7(GLOBAL_VINAYA_HOME, "outbox"),
@@ -3403,29 +3705,30 @@ function defaultDeps() {
3403
3705
  inputVersions: () => {
3404
3706
  return;
3405
3707
  },
3406
- resolveLogDestination: defaultResolveLogDestination
3708
+ resolveLogDestination: defaultResolveLogDestination,
3709
+ unresolvedLogDestination
3407
3710
  };
3408
3711
  }
3409
- var APPEND_OPEN_FLAGS = fsConstants4.O_WRONLY | fsConstants4.O_APPEND | fsConstants4.O_CREAT | fsConstants4.O_NOFOLLOW | fsConstants4.O_NONBLOCK;
3712
+ var APPEND_OPEN_FLAGS = fsConstants5.O_WRONLY | fsConstants5.O_APPEND | fsConstants5.O_CREAT | fsConstants5.O_NOFOLLOW | fsConstants5.O_NONBLOCK;
3410
3713
  function guardedAppendOpen(path) {
3411
3714
  try {
3412
- return openSync4(path, APPEND_OPEN_FLAGS, 384);
3715
+ return openSync5(path, APPEND_OPEN_FLAGS, 384);
3413
3716
  } catch {
3414
3717
  return;
3415
3718
  }
3416
3719
  }
3417
3720
  function appendHardenedLine(path, line) {
3418
3721
  try {
3419
- mkdirSync4(dirname6(path), { recursive: true, mode: 448 });
3722
+ mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
3420
3723
  const fd = guardedAppendOpen(path);
3421
3724
  if (fd === undefined)
3422
3725
  return `target could not be opened (symlink, FIFO, or unwritable): ${path}`;
3423
3726
  try {
3424
- if (!fstatSync2(fd).isFile())
3727
+ if (!fstatSync3(fd).isFile())
3425
3728
  return `target is not a regular file: ${path}`;
3426
- writeSync3(fd, line);
3729
+ writeSync4(fd, line);
3427
3730
  } finally {
3428
- closeSync4(fd);
3731
+ closeSync5(fd);
3429
3732
  }
3430
3733
  return null;
3431
3734
  } catch (err) {
@@ -3435,7 +3738,7 @@ function appendHardenedLine(path, line) {
3435
3738
  function reportRotationOverflow(backupPath, warn) {
3436
3739
  let raw;
3437
3740
  try {
3438
- raw = readFileSync5(backupPath, "utf8");
3741
+ raw = readFileSync6(backupPath, "utf8");
3439
3742
  } catch {
3440
3743
  return;
3441
3744
  }
@@ -3458,7 +3761,7 @@ function reportRotationOverflow(backupPath, warn) {
3458
3761
  }
3459
3762
  function appendLine(path, line, warn) {
3460
3763
  try {
3461
- mkdirSync4(dirname6(path), { recursive: true, mode: 448 });
3764
+ mkdirSync5(dirname7(path), { recursive: true, mode: 448 });
3462
3765
  let fd = guardedAppendOpen(path);
3463
3766
  if (fd === undefined) {
3464
3767
  warn(`vinaya: log outbox target could not be opened (symlink, FIFO, or unwritable) — refusing: ${path}
@@ -3467,14 +3770,14 @@ function appendLine(path, line, warn) {
3467
3770
  }
3468
3771
  let closed = false;
3469
3772
  try {
3470
- const stat = fstatSync2(fd);
3773
+ const stat = fstatSync3(fd);
3471
3774
  if (!stat.isFile()) {
3472
3775
  warn(`vinaya: log outbox target is not a regular file — refusing to write: ${path}
3473
3776
  `);
3474
3777
  return;
3475
3778
  }
3476
3779
  if (stat.size > OUTBOX_MAX_BYTES) {
3477
- closeSync4(fd);
3780
+ closeSync5(fd);
3478
3781
  closed = true;
3479
3782
  const backupPath = path.replace(/\.ndjson$/, ".1.ndjson");
3480
3783
  reportRotationOverflow(backupPath, warn);
@@ -3488,10 +3791,10 @@ function appendLine(path, line, warn) {
3488
3791
  fd = rotated;
3489
3792
  closed = false;
3490
3793
  }
3491
- writeSync3(fd, line);
3794
+ writeSync4(fd, line);
3492
3795
  } finally {
3493
3796
  if (!closed)
3494
- closeSync4(fd);
3797
+ closeSync5(fd);
3495
3798
  }
3496
3799
  } catch (err) {
3497
3800
  warn(`vinaya: log outbox write failed — ${err instanceof Error ? err.message : String(err)}
@@ -3502,12 +3805,14 @@ function createLogSink(overrides = {}) {
3502
3805
  const deps = {
3503
3806
  ...defaultDeps(),
3504
3807
  resolveBranchIssue: (repo) => resolveBranchIssue(deps.cwd(), deps.env(), repo),
3808
+ resolveHeadSha: () => resolveHeadSha(deps.cwd()),
3505
3809
  ...overrides
3506
3810
  };
3507
3811
  const runId = deps.env().VINAYA_RUN_ID || randomUUID2();
3508
3812
  const processId = randomUUID2();
3509
3813
  let seq = 0;
3510
3814
  let warned = false;
3815
+ let folderFallbackRecorded = false;
3511
3816
  const warnOnce = (message) => {
3512
3817
  if (warned)
3513
3818
  return;
@@ -3525,6 +3830,7 @@ function createLogSink(overrides = {}) {
3525
3830
  };
3526
3831
  const readerIsReal = overrides.resolveBranchIssue === undefined;
3527
3832
  let ownBranchIssue;
3833
+ let ownBranchIssueSettled = null;
3528
3834
  const branchIssueOnce = (repo) => {
3529
3835
  if (!branchIssueFallbackEnabled)
3530
3836
  return Promise.resolve(null);
@@ -3532,10 +3838,36 @@ function createLogSink(overrides = {}) {
3532
3838
  const read = () => deps.resolveBranchIssue(slug);
3533
3839
  if (readerIsReal)
3534
3840
  return branchIssueRead(`${deps.cwd()}\x00${slug ?? ""}`, read, true);
3535
- if (ownBranchIssue === undefined)
3841
+ if (ownBranchIssue === undefined) {
3536
3842
  ownBranchIssue = branchIssueRead(deps.cwd(), read, false);
3843
+ ownBranchIssue.then((value) => {
3844
+ ownBranchIssueSettled = value;
3845
+ });
3846
+ }
3537
3847
  return ownBranchIssue;
3538
3848
  };
3849
+ const branchIssueIfSettled = (repo) => {
3850
+ if (!branchIssueFallbackEnabled)
3851
+ return null;
3852
+ if (!readerIsReal)
3853
+ return ownBranchIssueSettled;
3854
+ return branchIssueSettledByCwd.get(`${deps.cwd()}\x00${safeRepoSlug(repo) ?? ""}`) ?? null;
3855
+ };
3856
+ const headShaReaderIsReal = overrides.resolveHeadSha === undefined;
3857
+ let ownHeadSha;
3858
+ let ownHeadShaSettled = null;
3859
+ const headShaOnce = () => {
3860
+ if (headShaReaderIsReal)
3861
+ return headShaRead(deps.cwd(), deps.resolveHeadSha, true);
3862
+ if (ownHeadSha === undefined) {
3863
+ ownHeadSha = headShaRead(deps.cwd(), deps.resolveHeadSha, false);
3864
+ ownHeadSha.then((value) => {
3865
+ ownHeadShaSettled = value;
3866
+ });
3867
+ }
3868
+ return ownHeadSha;
3869
+ };
3870
+ const headShaIfSettled = () => headShaReaderIsReal ? headShaSettledByCwd.get(deps.cwd()) ?? null : ownHeadShaSettled;
3539
3871
  let resolveRepoCache;
3540
3872
  const resolveRepoOnce = () => {
3541
3873
  if (resolveRepoCache === undefined)
@@ -3543,6 +3875,7 @@ function createLogSink(overrides = {}) {
3543
3875
  return resolveRepoCache;
3544
3876
  };
3545
3877
  let contextCache;
3878
+ let settledContext;
3546
3879
  const context = () => {
3547
3880
  if (contextCache === undefined) {
3548
3881
  const env = deps.env();
@@ -3551,11 +3884,16 @@ function createLogSink(overrides = {}) {
3551
3884
  doctrine()
3552
3885
  ]).then(async ([resolved, doctrineValue]) => {
3553
3886
  const repo = resolved && isSafeRepoSegment3(resolved.owner) && isSafeRepoSegment3(resolved.repo) ? resolved : null;
3554
- return { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
3887
+ settledContext = { repo, doctrine: doctrineValue, destination: await deps.resolveLogDestination(repo, env) };
3888
+ return settledContext;
3555
3889
  });
3556
3890
  }
3557
3891
  return contextCache;
3558
3892
  };
3893
+ const resetContext = () => {
3894
+ contextCache = undefined;
3895
+ settledContext = undefined;
3896
+ };
3559
3897
  let drainChain = Promise.resolve();
3560
3898
  const pendingWrites = new Set;
3561
3899
  let writeChain = Promise.resolve();
@@ -3567,63 +3905,88 @@ function createLogSink(overrides = {}) {
3567
3905
  `);
3568
3906
  });
3569
3907
  };
3570
- function log(e) {
3571
- try {
3572
- const env = deps.env();
3573
- const host = hostFromEnv(env);
3574
- const now = deps.now();
3575
- const mySeq = seq++;
3576
- const envFields = {
3908
+ const snapshot = () => {
3909
+ const env = deps.env();
3910
+ return {
3911
+ host: hostFromEnv(env),
3912
+ now: deps.now(),
3913
+ seq: seq++,
3914
+ envFields: {
3577
3915
  role: env.VINAYA_ROLE,
3578
3916
  task: env.VINAYA_TASK,
3579
3917
  round: env.VINAYA_ROUND,
3918
+ pr: env.VINAYA_PR,
3580
3919
  run: env.VINAYA_RUN || runId,
3581
3920
  attempt: env.VINAYA_ATTEMPT,
3582
- parent: env.VINAYA_PARENT_EVENT
3583
- };
3584
- const write = async () => {
3585
- const { repo, doctrine: doctrineValue, destination: resolvedDestination } = await context();
3586
- if (resolvedDestination.kind === "none") {
3587
- warnOnce(`vinaya: not recording — ${resolvedDestination.reason}
3921
+ parent: env.VINAYA_PARENT_EVENT,
3922
+ workRef: env.VINAYA_WORK_REF,
3923
+ flow: env.VINAYA_FLOW,
3924
+ flowVersion: env.VINAYA_FLOW_VERSION,
3925
+ runtime: env.VINAYA_RUNTIME,
3926
+ source: env.VINAYA_SOURCE
3927
+ }
3928
+ };
3929
+ };
3930
+ const writeEvent = (e, call, ctx, branchIssue, headSha, deliver) => {
3931
+ const { repo, doctrine: doctrineValue, destination } = ctx;
3932
+ if (destination.kind === "none") {
3933
+ warnOnce(`vinaya: not recording — ${destination.reason}
3588
3934
  `);
3589
- return;
3590
- }
3591
- if (resolvedDestination.kind === "folder" && resolvedDestination.fallbackReason) {
3592
- warnOnce(`vinaya: ${describeFolderFallback(resolvedDestination.fallbackReason)}
3935
+ return;
3936
+ }
3937
+ if (destination.kind === "folder" && destination.fallbackReason) {
3938
+ warnOnce(`vinaya: ${describeFolderFallback(destination.fallbackReason)}
3593
3939
  `);
3594
- }
3595
- const branchIssue = envFields.task ? null : await branchIssueOnce(repo);
3596
- const header = buildHeader({
3597
- now,
3598
- runId,
3599
- seq: mySeq,
3600
- repo: repo ? `${repo.owner}/${repo.repo}` : null,
3601
- vinaya: deps.vinayaVersion(),
3602
- doctrine: doctrineValue,
3603
- host,
3604
- hostname: deps.hostname(),
3605
- env: envFields,
3606
- branchIssue,
3607
- eventId: randomUUID2(),
3608
- processId,
3609
- inputVersions: deps.inputVersions()
3610
- });
3611
- const full = { ...e, ...header };
3612
- const parsed = LogEventSchema.safeParse(full);
3613
- if (!parsed.success) {
3614
- warnOnce(`vinaya: log() refused an invalid payload — ${parsed.error.issues[0]?.message ?? "schema violation"}
3940
+ }
3941
+ const built = buildHeader({
3942
+ now: call.now,
3943
+ runId,
3944
+ seq: call.seq,
3945
+ repo: repo ? `${repo.owner}/${repo.repo}` : null,
3946
+ vinaya: deps.vinayaVersion(),
3947
+ doctrine: doctrineValue,
3948
+ host: call.host,
3949
+ hostname: deps.hostname(),
3950
+ env: call.envFields,
3951
+ branchIssue,
3952
+ eventId: randomUUID2(),
3953
+ processId,
3954
+ inputVersions: deps.inputVersions()
3955
+ });
3956
+ const header = headSha === null ? built : { ...built, subject: { ...built.subject, sha: headSha } };
3957
+ if (destination.kind === "folder" && destination.fallbackReason && !folderFallbackRecorded) {
3958
+ folderFallbackRecorded = true;
3959
+ recordFolderFallback(repo, header.subject.issue, destination.fallbackReason, call.now, dirname7(destination.folder), join7(deps.home(), ".vinaya"));
3960
+ }
3961
+ const full = { ...e, ...header };
3962
+ const parsed = LogEventSchema.safeParse(full);
3963
+ if (!parsed.success) {
3964
+ warnOnce(`vinaya: log() refused an invalid payload — ${parsed.error.issues[0]?.message ?? "schema violation"}
3615
3965
  `);
3616
- return;
3617
- }
3618
- const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
3966
+ return;
3967
+ }
3968
+ const line = `${JSON.stringify(redact(parsed.data, deps.home()))}
3619
3969
  `;
3620
- const destination = resolvedDestination;
3621
- if (destination.kind === "server") {
3622
- appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
3623
- scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
3624
- } else {
3625
- appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
3970
+ if (destination.kind === "server") {
3971
+ appendLine(outboxPathFor(deps, repo, header.subject.issue), line, warnOnce);
3972
+ if (deliver)
3973
+ scheduleWebhookDrain(header.subject.issue, destination.url, destination.headers);
3974
+ } else {
3975
+ appendLine(outboxPathFor({ outboxRoot: () => destination.folder }, repo, header.subject.issue), line, warnOnce);
3976
+ }
3977
+ };
3978
+ function log(e) {
3979
+ try {
3980
+ const call = snapshot();
3981
+ const write = async () => {
3982
+ const ctx = await context();
3983
+ if (ctx.destination.kind === "none") {
3984
+ writeEvent(e, call, ctx, null, null, true);
3985
+ return;
3626
3986
  }
3987
+ const branchIssue = call.envFields.task ? null : await branchIssueOnce(ctx.repo);
3988
+ const headSha = e.kind === "gate" ? await headShaOnce() : null;
3989
+ writeEvent(e, call, ctx, branchIssue, headSha, true);
3627
3990
  };
3628
3991
  const written = writeChain.then(write).catch((err) => {
3629
3992
  warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
@@ -3634,6 +3997,26 @@ function createLogSink(overrides = {}) {
3634
3997
  written.finally(() => pendingWrites.delete(written));
3635
3998
  } catch (err) {
3636
3999
  warnOnce(`vinaya: log() failed — ${err instanceof Error ? err.message : String(err)}
4000
+ `);
4001
+ }
4002
+ }
4003
+ function logSync(e, opts = {}) {
4004
+ try {
4005
+ const call = snapshot();
4006
+ let ctx = settledContext;
4007
+ if (ctx === undefined) {
4008
+ const destination = deps.unresolvedLogDestination(deps.env());
4009
+ if (destination.kind === "folder" && !opts.quiet) {
4010
+ warnOnce(`vinaya: the process ended before its log destination was resolved — the event is written to ${destination.folder}; \`vinaya log send\` delivers it to a configured server later
4011
+ `);
4012
+ }
4013
+ ctx = { repo: null, doctrine: "unknown", destination };
4014
+ }
4015
+ const branchIssue = ctx.destination.kind === "none" || call.envFields.task ? null : branchIssueIfSettled(ctx.repo);
4016
+ const headSha = e.kind === "gate" && ctx.destination.kind !== "none" ? headShaIfSettled() : null;
4017
+ writeEvent(e, call, ctx, branchIssue, headSha, false);
4018
+ } catch (err) {
4019
+ warnOnce(`vinaya: logSync() failed — ${err instanceof Error ? err.message : String(err)}
3637
4020
  `);
3638
4021
  }
3639
4022
  }
@@ -3654,18 +4037,15 @@ function createLogSink(overrides = {}) {
3654
4037
  return;
3655
4038
  });
3656
4039
  };
3657
- return { log, runId, warmup, drain };
4040
+ return { log, logSync, runId, warmup, drain, resetContext };
3658
4041
  }
3659
4042
  var defaultSink = createLogSink();
3660
4043
 
3661
4044
  // src/checks/runner.ts
3662
4045
  var activeChecks = new Map;
3663
4046
 
3664
- // src/lib/loop-log.ts
3665
- var LOOP_LOG_MAX_BYTES = 8 * 1024 * 1024;
3666
-
3667
4047
  // src/lib/brief-assembly.ts
3668
- import { existsSync as existsSync7, readFileSync as readFileSync6, readdirSync as readdirSync2 } from "node:fs";
4048
+ import { existsSync as existsSync7, readFileSync as readFileSync7, readdirSync as readdirSync2 } from "node:fs";
3669
4049
  import { join as join8 } from "node:path";
3670
4050
 
3671
4051
  // ../../packages/sources/src/commands.ts
@@ -3822,7 +4202,7 @@ var COMMANDS = [
3822
4202
  "Composes `task brief`'s own preparation (`prepareTask`) with the watching driver (`runDriverLoop`, `dev-review-loop.ts`) — nothing else. Preparation starts no agent; the loop's own round 1 reads the frozen brief off the Issue and is the only place a developer is ever dispatched from a fresh task, so exactly one developer is started by construction.",
3823
4203
  "A brief already frozen on the Issue is reused, never re-posted — the second `task dispatch`/`task brief` call this composes around does not fail the whole run, it just skips straight to running the loop. A task whose Issue refuses preparation (a missing brief section, an unmet dispatch gate) is refused before any agent starts, with nothing posted.",
3824
4204
  "Refuses when the frozen brief's developer branch already has an open pull request AND a driver is still live for it — a driver that crashed or was killed leaves its PR behind, and this command is the one that revives it, in any state, pause held or not.",
3825
- "issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the exact `vinaya task run <tranche> <n>` command to continue by hand), a usage/argv error (exit `2`), and any other failure (exit `3`)."
4205
+ "issue-711 O4: a pause never ends this process — it keeps running and watches the pull request, continuing on its own once a newer Principal ruling appears (or, for an `'infrastructure'`/`'stale_driver'` pause, after a bounded backoff), with no `--resume` command needed for the ordinary case. Exit and printed summary distinguish a published pull request OR a watched pause's own genuine end — merged, closed, or an operator's own `--cancel` (exit `0` either way, the PR URL) — from the one pause this process can never watch (no pull request exists yet — exit `1`, with the working `vinaya task run` command for this task's own branch to continue by hand — `<tranche> <n>` for a tranche task, `--issue <n>` for a backlog one — never a `dev-review-loop --resume` line naming a pull-request number this pause does not have), a usage/argv error (exit `2`), and any other failure (exit `3`)."
3826
4206
  ],
3827
4207
  status: "shipped"
3828
4208
  },
@@ -3907,13 +4287,14 @@ var COMMANDS = [
3907
4287
  },
3908
4288
  {
3909
4289
  flag: "--push",
3910
- description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE/AEG:TOKENS regions changed. Mutually exclusive with --write."
4290
+ description: "PR number; splices the same content into that PR's LIVE body (fetched from the forge) and pushes it via `gh pr edit`, self-verifying nothing outside the AEG:EVIDENCE region changed. Mutually exclusive with --write."
3911
4291
  }
3912
4292
  ],
3913
4293
  details: [
3914
4294
  "Two groups: Group A (recomputable) is the head sha and a width-invariant `git diff --numstat` against the merge-base with `BASE_SHA` (else `origin/main`, then `main`) — `check-evidence-fresh` recomputes and byte-compares this exactly. Group B (attested) is the result of `vinaya check --all --diff-only`, this CLI's own portable gate suite — `check-evidence-fresh` can only check it for staleness (the block's recorded head still matches the PR's real head), never re-run it.",
3915
4295
  "With no `--write`/`--push`, prints the block to stdout instead of writing a file. Exits non-zero whenever the gate run failed, whether or not `--write`/`--push` was given — the block records a failing result rather than hiding one, and a non-zero exit stops a scripted `--write && open-pr` (or `--push`) from carrying a failing suite onto the forge.",
3916
- "`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number. When the live body has no real `AEG:TOKENS` pair, the token splice is skipped (same reasoning, softer outcome) rather than creating one. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside the two anchored regions changed."
4296
+ "`--push` refuses before writing anything when the live body carries no real `AEG:EVIDENCE` pair (it never appends one, unlike `--write`), when the anchor resolves differently before and after normalisation, or when `<pr>` isn't a bare number. After pushing, it re-reads the live body and restores the pre-edit body — exiting non-zero — if anything outside that one anchored region changed.",
4297
+ "A pull-request body carries no token table, and this command writes none: a dispatched turn's token use is recorded as the Vinaya log's own `usage` event instead. A body that still carries an older run's table keeps it byte for byte — it is prose this command does not own, and a change inside it reads as real drift."
3917
4298
  ],
3918
4299
  status: "shipped"
3919
4300
  },
@@ -3938,7 +4319,7 @@ var COMMANDS = [
3938
4319
  "Deliberately a command, not a check: `evidence-fresh` runs inside `vinaya check --all`, and `pr report` runs `vinaya check --all --diff-only`, so a check that regenerated the block would run the suite containing itself. That recursion is why `evidence-fresh` verifies Group A only and leaves Group B attested.",
3939
4320
  "Must be run from the repository ROOT of a CLEAN checkout at the pull request's head, and refuses otherwise. The regeneration inherits the working directory and several gates resolve their scan root from it, so a subdirectory silently narrows what the fresh run inspects. On cleanliness: Group B is regenerated by diff-scoped checks, so uncommitted or untracked files change which files are scanned and can produce a MATCH a clean checkout would not. Ignored paths are deliberately NOT inspected — `git diff` never reports one, so they cannot change the scope, and including them would refuse in every real checkout since `node_modules` is ignored and always present. The head is read from the forge and both a mismatch AND an unreadable head refuse — the verdict is bound to a commit, never merely attested. `BASE_SHA` is refused as well, since it steers the regeneration's merge-base.",
3940
4321
  "Exits 0 on MATCH; 1 on DIFFERS, HIDDEN, or no block; 2 on a refusal (dirty worktree, wrong head, usage error). HIDDEN means the anchor pair sits inside a collapsed `<details>` block, where `body-bare-digits` blanks every digit and nothing can verify what it claims.",
3941
- "Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read, since AEG:TOKENS appends by design. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
4322
+ "Comparison is a multiset of repo-relative, control-stripped lines: absolute paths (local AND foreign, so a block generated in CI compares against one generated on a laptop) and line order are ignored — a reorder is not a fabrication. Only the AEG:EVIDENCE region is read: every other section of the body is prose no regeneration reproduces. A moved merge-base is reported ALONGSIDE the differing lines, never instead of them."
3942
4323
  ],
3943
4324
  status: "shipped"
3944
4325
  },
@@ -4109,7 +4490,7 @@ var COMMANDS = [
4109
4490
  { flag: "--secrets", description: "security only: the SECRETS line" },
4110
4491
  {
4111
4492
  flag: "--secrets-evidence-file",
4112
- description: 'security only: required whenever `--secrets` claims "none found" — the pasted scanner output backing that claim'
4493
+ description: 'security only: required whenever `--secrets` claims "none found" — the passing `atta-labs/secret-scan` check result on the judged head that backs it; never run or paste the scanner'
4113
4494
  },
4114
4495
  { flag: "--task-id", description: "the closing `Tokens:` line's task id" },
4115
4496
  { flag: "--model", description: "the closing `Tokens:` line's model name" },
@@ -4217,7 +4598,20 @@ var COMMANDS = [
4217
4598
  flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
4218
4599
  details: [
4219
4600
  "Refuses if any task Issue attached to the named tranche is still open, naming each one — closing a tranche with unresolved work is never silently allowed.",
4220
- "Once every task Issue is closed, prompts for confirmation (unless `--yes`) and closes the GitHub Milestone."
4601
+ "Once every task Issue is closed, prompts for confirmation (unless `--yes`), records the tranche's retrospective in the Milestone its task Issues are attached to, and closes that Milestone once nothing else in it is still open.",
4602
+ "A tranche none of whose task Issues carry a Milestone gets one: a Milestone titled with the tranche's slug is created, the tranche's closed task Issues are attached to it, the retrospective is recorded, and it is closed — so the tranche reads as archived. An Issue already on a Milestone is never moved.",
4603
+ "Idempotent: on a tranche whose Milestone is already closed and carries its retrospective, changes nothing and says it is already archived.",
4604
+ "The generated `vinaya-archivist.yml` workflow runs it after a task pull request merges, and again when an Issue labeled with the tranche closes without a merge (dropped, replaced or closed by hand) — the tranche's slug read from that Issue's own label."
4605
+ ],
4606
+ status: "shipped"
4607
+ },
4608
+ {
4609
+ name: "archive tranches",
4610
+ description: "Archive every finished tranche that has no closed Milestone carrying its retrospective",
4611
+ flags: [{ flag: "--yes", description: "Skip the confirmation prompt" }],
4612
+ details: [
4613
+ "Walks every `vinaya/tranche:<slug>` label, skips each tranche that still has an open task Issue, and runs `archive tranche` for each finished one whose Milestone is not already closed with its retrospective. One tranche failing does not stop the others; the exit code reports it.",
4614
+ "The generated `vinaya-archivist.yml` workflow calls it on its daily scheduled run, so a tranche that finished before the workflow could see it is archived within a day. Running it again when every finished tranche is archived changes nothing and says so."
4221
4615
  ],
4222
4616
  status: "shipped"
4223
4617
  },
@@ -4361,6 +4755,29 @@ var COMMANDS = [
4361
4755
  ],
4362
4756
  status: "shipped"
4363
4757
  },
4758
+ {
4759
+ name: "log selftest",
4760
+ description: "Prove log delivery works end to end: send one marked test event and read it back — PASS (exit 0) or FAIL with the one reason (exit 1)",
4761
+ details: [
4762
+ "Resolves the destination exactly as an UNATTENDED review-loop run does in this repository — the same trust-anchor read and credential lookup, forced unattended so running it by hand proves the launch path's own resolution, not a human's. It sends one test event to the configured `logs.url` server, then reads it back from the server by the event's own id through the server's cursor read.",
4763
+ "PASS (exit 0) only when the event round-trips. Otherwise FAIL (exit 1) with the ONE reason that stopped it: no server is configured, the default branch's config could not be read to confirm the url (and why), this host holds no ingest or read credential, the server refused with its status, or the event could not be read back. It never prints a credential value.",
4764
+ "The read-back needs a READ credential distinct from the write-only ingest one the server refuses on a read route: set `logs.readHeaders` in vinaya.config.json to the server's read token (referenced by variable name, resolved from the environment exactly as `logs.headers` is). The test event is marked `operation: 'log.selftest'` so a reader can exclude it from real telemetry."
4765
+ ],
4766
+ status: "shipped"
4767
+ },
4768
+ {
4769
+ name: "log emit",
4770
+ description: "Record a consumer-declared event (`logs.events` in vinaya.config.json) from a script or agent outside Vinaya",
4771
+ flags: [
4772
+ { flag: "--json '<json>'", description: "The field values as one JSON object (else read from standard input)" }
4773
+ ],
4774
+ details: [
4775
+ "Reads the field values as ONE JSON object — `--json '<json>'` or piped on standard input, never positional arguments — and records them through `emitCustomEvent`, the same chokepoint every custom event goes through, so the refusal event and the redaction stay in one place.",
4776
+ "A declared event with every field present and of its declared type exits 0 and prints the event name and the kind of destination it was recorded toward (`folder`, `server`, or `none`) — never a field value. A refused event (an undeclared name, or a missing, extra, wrong-typed or too-long field) exits 1 and prints the reason class and the field names — never a value, since a rejected value may be the secret. A missing event name, unreadable JSON, or JSON that is not a flat object is a usage error: exit 2, before anything is recorded.",
4777
+ "A process with only `VINAYA_WORK_REF` and `VINAYA_FLOW` set, and no Vinaya role or task, still gets a header carrying that work reference and way-of-working id — the same environment read every event already honours (`apps/cli/specs/log.md` § Attribution)."
4778
+ ],
4779
+ status: "shipped"
4780
+ },
4364
4781
  {
4365
4782
  name: "log send",
4366
4783
  description: "Deliver this repository's locally-held log events to the configured `logs.url` server, once",
@@ -4371,20 +4788,44 @@ var COMMANDS = [
4371
4788
  "Safe to run more than once: the server stores events by `event_id` and ignores one it already holds, so a re-sent chunk creates no duplicate, and a second run finds the folder emptied and the queue drained."
4372
4789
  ],
4373
4790
  status: "shipped"
4791
+ },
4792
+ {
4793
+ name: "sync",
4794
+ description: "Fill, resume and rebuild the local log cache from this repository's configured destination (read-only)",
4795
+ flags: [
4796
+ {
4797
+ flag: "--rebuild",
4798
+ description: "Delete the cache file and sync from the beginning of what the destination still retains"
4799
+ },
4800
+ { flag: "--json", description: "Enveloped JSON output (schema: 1)" }
4801
+ ],
4802
+ details: [
4803
+ "Resolves the destination exactly the way a normal event does — the sink's own decision over `vinaya.config.json`'s `logs` setting, trust-anchor-gated for an unattended caller — then reads a folder destination through the folder source or a server destination through the server source (with the configured `logs.readHeaders`, substituted from the environment), and runs the bounded sync engine against the durable cache this repository holds under its runtime directory. Prints pages read, rows stored, duplicates, edits, deletions, gaps, quarantined lines and, for a server destination, its lost-event diagnostic. Reads the destination and writes only its own cache directory — never the folder, the server, or the forge.",
4804
+ "Exits 0 when the run completed or stopped cleanly on its page bound (and says more is available), 1 when it failed part way (the progress made is kept — a second run resumes from the stored cursor), and 2 for a usage or configuration problem: no destination is configured, or a server destination is configured with no usable read credential. A missing credential names the environment variable to set and never prints its value.",
4805
+ "`--rebuild` deletes the cache file ALONE — never anything else under the cache directory — and syncs again from the beginning of what the destination still retains; an event already rotated out of a folder's single backup slot, or no longer retained by the destination, cannot be recovered and shows up as a gap, never silently."
4806
+ ],
4807
+ status: "shipped"
4374
4808
  }
4375
4809
  ];
4376
4810
  // ../../packages/sources/src/select-source.ts
4377
- import { z as z5 } from "zod";
4378
- var StateSourceConfigSchema = z5.discriminatedUnion("kind", [
4379
- z5.object({ kind: z5.literal("forge"), owner: z5.string(), repo: z5.string() }),
4380
- z5.object({ kind: z5.literal("file"), root: z5.string().optional() })
4811
+ import { z as z6 } from "zod";
4812
+ var StateSourceConfigSchema = z6.discriminatedUnion("kind", [
4813
+ z6.object({ kind: z6.literal("forge"), owner: z6.string(), repo: z6.string() }),
4814
+ z6.object({ kind: z6.literal("file"), root: z6.string().optional() })
4381
4815
  ]);
4382
4816
  // src/checks/edge-resolve.ts
4383
4817
  var issueCache = new Map;
4384
4818
  var siblingTrancheCache = new Map;
4385
4819
 
4386
4820
  // src/commands/doctrine.ts
4821
+ import matter4 from "gray-matter";
4822
+
4823
+ // ../../packages/aeg-core/src/docs/parse-doc.ts
4387
4824
  import matter2 from "gray-matter";
4825
+ // ../../packages/aeg-core/src/docs/surfaced-manifest.ts
4826
+ var NO_MODEL_BACKED_PATHS = new Set;
4827
+ // src/roles/contract.ts
4828
+ import matter3 from "gray-matter";
4388
4829
 
4389
4830
  // src/lib/brief-assembly.ts
4390
4831
  var PACKAGE_ROOT = packageRoot(import.meta.url);
@@ -4393,36 +4834,13 @@ var TEMPLATE_PATH = existsSync7(PACKAGED_TEMPLATE_PATH) ? PACKAGED_TEMPLATE_PATH
4393
4834
  var DRAFT_ISSUE_SENTINEL = Number.MAX_SAFE_INTEGER;
4394
4835
 
4395
4836
  // src/lib/forge-write.ts
4837
+ var IMPORTABLE_EXTENSIONS = [".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs"];
4838
+ var IMPORT_SEARCH_PATHSPEC = IMPORTABLE_EXTENSIONS.map((e) => `*${e}`);
4396
4839
  var INFORMATIONAL_DISPATCH_BLOCKER_CLASSES = new Set([
4397
4840
  "depends-on-not-merged",
4398
4841
  "conflicts-with"
4399
4842
  ]);
4400
4843
 
4401
- // src/lib/dispatch.ts
4402
- var MAX_TEE_BYTES = 8 * 1024 * 1024;
4403
- var CLAUDE_MODEL_ALIASES = new Set(["fable", "opus", "sonnet", "haiku"]);
4404
- var NO_SUBSCRIPTION_LOGIN_REASON = "this agent has no subscription login in Vinaya yet, and no agent authenticates with an API key — " + "dispatch a vendor whose subscription login Vinaya can stage (claude, codex)";
4405
-
4406
- // src/commands/tokens.ts
4407
- var USAGE = [
4408
- 'Usage: vinaya tokens --phase "<task-id>: develop" --role Developer',
4409
- " [--model <id>] [--transcript <path>] [--in <tokens-in> --out <tokens-out>]",
4410
- "",
4411
- " --transcript Read this transcript directly. Supported primary route — use it whenever you know",
4412
- " which transcript is yours, and always in a repo with no track-transcript.sh hook.",
4413
- " (omitted) Resolve via the Stop-hook pointer file, if this repo installs that hook.",
4414
- " --in/--out Manual entry: the exact token figures, for a host whose usage arrives by some other",
4415
- " means than a Claude Code transcript. Both required together; skips transcript",
4416
- " resolution entirely.",
4417
- "",
4418
- "Usage: vinaya tokens --trust-collect",
4419
- " Approves this repo's declared tokens.collect command, pinned to the script's exact current",
4420
- " content, on this machine. Run this once before tokens.collect will ever execute — a changed",
4421
- " interpreter, script path, or script CONTENT needs its own fresh approval. Does not take",
4422
- " --phase/--role and never emits a Tokens: line."
4423
- ].join(`
4424
- `);
4425
-
4426
4844
  // src/lib/pr-report-engine.ts
4427
4845
  var execFileAsync6 = promisify6(execFile6);
4428
4846
  var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
@@ -4432,21 +4850,21 @@ var BODY_READING_CHECK_NAMES = new Set(coreCheckRegistry().filter((spec) => {
4432
4850
  var FAILING_STATUSES = new Set(["fail", "error", "timeout"]);
4433
4851
  function readTestRunCacheFile(path) {
4434
4852
  try {
4435
- if (!lstatSync3(path).isFile())
4853
+ if (!lstatSync4(path).isFile())
4436
4854
  return {};
4437
- return JSON.parse(readFileSync7(path, "utf8"));
4855
+ return JSON.parse(readFileSync8(path, "utf8"));
4438
4856
  } catch {
4439
4857
  return {};
4440
4858
  }
4441
4859
  }
4442
4860
  function writeTestRunCacheFile(path, all) {
4443
4861
  const tmp = `${path}.tmp-${process.pid}-${randomUUID3()}`;
4444
- const fd = openSync5(tmp, fsConstants5.O_WRONLY | fsConstants5.O_CREAT | fsConstants5.O_EXCL, 384);
4862
+ const fd = openSync6(tmp, fsConstants6.O_WRONLY | fsConstants6.O_CREAT | fsConstants6.O_EXCL, 384);
4445
4863
  try {
4446
- writeSync4(fd, JSON.stringify(all, null, 2), null, "utf8");
4864
+ writeSync5(fd, JSON.stringify(all, null, 2), null, "utf8");
4447
4865
  fsyncSync2(fd);
4448
4866
  } finally {
4449
- closeSync5(fd);
4867
+ closeSync6(fd);
4450
4868
  }
4451
4869
  renameSync4(tmp, path);
4452
4870
  }
@@ -4456,7 +4874,7 @@ function fileBackedTestRunCache(path, runtimeDir) {
4456
4874
  set: (key, record) => {
4457
4875
  const all = readTestRunCacheFile(path);
4458
4876
  all[key] = record;
4459
- ensureRunDir(dirname7(path), runtimeDir);
4877
+ ensureRunDir(dirname8(path), runtimeDir);
4460
4878
  writeTestRunCacheFile(path, all);
4461
4879
  }
4462
4880
  };
@@ -4498,7 +4916,7 @@ async function collectStateFields(cwd) {
4498
4916
  for (const f of uncommitted) {
4499
4917
  fields.push(f);
4500
4918
  try {
4501
- fields.push(readFileSync7(join9(base, f)));
4919
+ fields.push(readFileSync8(join9(base, f)));
4502
4920
  } catch {
4503
4921
  fields.push("MISSING");
4504
4922
  }
@@ -4596,21 +5014,6 @@ async function recordGreenTestRun(command, output, cwd, source, cache = defaultT
4596
5014
  }
4597
5015
  return true;
4598
5016
  }
4599
- var TOKEN_ROW_REMEDY = [
4600
- "Nothing here established that this host cannot meter — only that this session resolved no",
4601
- "transcript of its own. Report real figures by naming your own transcript:",
4602
- "",
4603
- " vinaya pr report --write <body-file> --transcript <path>",
4604
- "",
4605
- "or, on a host whose usage arrives by some other means, format figures you already hold with:",
4606
- "",
4607
- ' vinaya tokens --phase "<task-id>: develop" --role Developer --in <tokens-in> --out <tokens-out>',
4608
- "",
4609
- "and transcribe them into the `## Token report` table. That command prints a `Tokens:` line, not",
4610
- "a table row — the table takes | Phase | Role | Agent/Model | Tokens in | Tokens out | Cost | Date |,",
4611
- "and a line inside the block that does not start with `|` truncates the table for every row after it."
4612
- ].join(`
4613
- `);
4614
5017
 
4615
5018
  // src/lib/pre-push-cache-test-run.ts
4616
5019
  async function main() {
@@ -4623,7 +5026,7 @@ async function main() {
4623
5026
  }
4624
5027
  let output;
4625
5028
  try {
4626
- output = readFileSync8(logPath, "utf8");
5029
+ output = readFileSync9(logPath, "utf8");
4627
5030
  } catch (err) {
4628
5031
  process.stderr.write(`vinaya pre-push: could not read ${logPath} to cache this run — nothing recorded (${err instanceof Error ? err.message : String(err)}).
4629
5032
  `);